Open
Description
For example, this existing EncodeJSON
instance for Either
:
instance encodeJsonEither :: (EncodeJson a, EncodeJson b) => EncodeJson (Either a b) where
encodeJson = either (obj "Left") (obj "Right")
where
obj :: forall c. EncodeJson c => String -> c -> Json
obj tag x =
fromObject $ FO.fromFoldable $
Tuple "tag" (fromString tag) : Tuple "value" (encodeJson x) : Nil
Metadata
Metadata
Assignees
Labels
No labels