Created
August 31, 2011 14:29
-
-
Save missingfaktor/1183671 to your computer and use it in GitHub Desktop.
Some Haskell Aeson code that I found interesting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data Coord = Coord { x :: Double, y :: Double } | |
instance FromJSON Coord where | |
parseJSON (Object v) = | |
Coord <$> | |
v .: "x" <*> | |
v .: "y" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This example shows a very interesting use of applicative, but couldn't this all boilerplate be avoided with a bit of reflection?