@rae: Impredicative types and dynamic types -- useful in parsing JSON

preview_player
Показать описание
I demonstrate how using impredicative types and dynamic types (as they work in Haskell) can be useful for parsing a number in JSON (stored as a Scientific).

Рекомендации по теме
Комментарии
Автор

Thanks Richard! Now I understand I came across impredicative types the other day in fumieval's mason library for bytestring serializing. I apparently had to instantiate (?) the funky builder type to expose in a typeclass, or I'd get weird type errors, so I lost the ability to conveniently define serializers for any bytestring-like (strict, lazy, short). Wonder if it's an interaction with impredicative types & typeclasses or if I needed to tinker more.

raehik
Автор

Nice video! I wonder whether you could also get this to work with the original version of floatingOrInteger by using existential types AnyFloat and AnyInteger that encapsulate the universally quantified value?

Dregntael
Автор

I'm curious if impredicative types can be used as the backend of dependent types? I think most people use singleton to implement dependent types so just wondering.

stevemao
Автор

Hmm, to get rid of the fromInteger, I'm wondering if you couldn't simply move the last "Right" to before the "case"?

BjrnSH
Автор

10:37
Instead of

cabal repl --build-depends=scientific

we could also do

cabal install --lib --package-env . scientific
ghci

(scientific will only be visible in the local folder)

danieldiaz
Автор

The evaluation plugin probably didn't work because the file didn't compile.

eddiemundo