Skip to content

Instantly share code, notes, and snippets.

@missingfaktor
Created August 31, 2011 14:29
Show Gist options
  • Save missingfaktor/1183671 to your computer and use it in GitHub Desktop.
Save missingfaktor/1183671 to your computer and use it in GitHub Desktop.
Some Haskell Aeson code that I found interesting
data Coord = Coord { x :: Double, y :: Double }
instance FromJSON Coord where
parseJSON (Object v) =
Coord <$>
v .: "x" <*>
v .: "y"
@missingfaktor
Copy link
Author

This example shows a very interesting use of applicative, but couldn't this all boilerplate be avoided with a bit of reflection?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment