Slide 20
Slide 20 text
If all you want to do is read the type at the given field with the correct label and
type, why even deal with this?
Use Simple-JSON github.com/justinwoo/purescript-simple-json
type MyJSON =
{ apple :: String
, banana :: Int
, cherry :: Maybe Boolean
}
decodeToMyJSON :: String -> SimpleJSON.E MyJSON
decodeToMyJSON = SimpleJSON.readJSON
This is also flexible for inferred field type changing, field addition/removal, etc.
Justin Woo Type classes: pattern matching for types October 18 2018 20 / 23