News for hackers. Stuff that matters.
Re:Why hasn't Haskell taken over the world? And the curious ... by nilkn on Monday January 23, 2017 @07:15PM (#13467635)
Current version: https://hackage.haskell.org/package/aeson-1.1.0.0/docs/Data-...

The key difference with Aeson is this line:

> deriving (Generic, Show)

Because of this, it's not necessary in that example to even write the JSON decoder manually. The compiler can generate it on its own. I don't personally know of any way to achieve this in Elm, as Elm doesn't have typeclasses and what's effectively happening here is that an instance of the FromJSON typeclass is being computed by the compiler.

A very similar trick is possible in PureScript:

http://www.purescript.org/learn/generic/

There are no comments on this comment yet.