Closed
Description
The first thing I always need to do when using argonaut in a project is to write functions fromJson
function which composes parseJson
and decodeJson
and toJson
composing encodeJson
and stringify
:
fromJson :: forall t. DecodeJson t => String -> Either JsonDecodeError t
fromJson = parseJson >=> decodeJson
toJson :: forall t. EncodeJson t => t -> String
toJson = encodeJson >>> stringify
So why not add them to argonaut
? They could also be named parseAndDecode
/ encodeAndStringify
or sth else, I don't really mind. Though I find fromJson
and toJson
just nicely minimalistic.
I have created a pr for it in #109 .
Update:
changed type variable from json
to t
in the first case to avoid confusion.
Metadata
Metadata
Assignees
Labels
No labels