Skip to content

Instantly share code, notes, and snippets.

@erantapaa
Created July 2, 2015 06:18
Show Gist options
  • Save erantapaa/4fe5baf90ba58bd0bcc5 to your computer and use it in GitHub Desktop.
Save erantapaa/4fe5baf90ba58bd0bcc5 to your computer and use it in GitHub Desktop.
Auto derive aeson ToJSON instance
{-# 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