Created
July 2, 2015 06:18
-
-
Save erantapaa/4fe5baf90ba58bd0bcc5 to your computer and use it in GitHub Desktop.
Auto derive aeson ToJSON instance
This file contains hidden or 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
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE DeriveGeneric #-} | |
module Lib | |
where | |
import Data.Aeson | |
import GHC.Generics (Generic) | |
import Data.Stringable | |
someFunc :: IO () | |
someFunc = putStrLn "someFunc" | |
data Foo = Foo { name :: String, number :: Int } | |
deriving (Generic) | |
instance ToJSON Foo | |
test1 = do | |
putStrLn $ toString (encode $ Foo "hello" 123) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment