Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

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}"

About

A variant data type made for compatibility with Aeson

Resources

License

Packages

No packages published