Skip to content
A variant data type made for compatibility with Aeson
PureScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
generated-docs/Data
src/Data
.gitignore
LICENSE
README.md
bower.json

README.md

purescript-tagged-sum

A simple row-based variant data type, supporting:

  • An Aeson-compatible JSON representation, via foreign-generic
  • (Polymorphic) traversals via Prisms from profunctor-lenses

Example

$ pulp repl

> import Data.Lens (review)
> import Data.Symbol (SProxy(..))
> import Data.TaggedSum (TaggedSum, tag)
> import Foreign.Generic (encodeJSON)

> _foo = SProxy :: SProxy "foo"
> x = review (tag _foo) 42 :: TaggedSum (foo :: Int)
> encodeJSON x
"{\"tag\":\"foo\",\"contents\":42}"
You can’t perform that action at this time.