Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,17 @@
{-# LANGUAGE DeriveGeneric, OverloadedStrings #-}
import Data.Aeson
import GHC.Generics
data Person = Person { firstName :: String
, lastName :: String
, age :: Maybe Int
} deriving (Show, Eq, Generic)
instance FromJSON Person
instance ToJSON Person
main = do
let test1 = "{\"firstName\":\"Bob\", \"lastName\":\"Smith\"}"
test2 = "{\"firstName\":\"Miles\", \"lastName\":\"Davis\", \"age\": 45}"
print (decode test1 :: Maybe Person)
print (decode test2 :: Maybe Person)