Package

purescript-chirashi

Repository
justinwoo/purescript-chirashi
License
MIT
Uploaded by
justinwoo
Published on
2018-09-29T13:26:46Z

Build Status

Docs on Pursuit

An easy way to work with Errors by inserting a Variant, and reading it out later.

Usage

type ErrorVariant = Variant
  ( apple :: String
  , banana :: { info :: String }
  , cherry :: Unit
  )

main = do
  let
    knownVariant :: ErrorVariant
    knownVariant = Variant.inj (SProxy :: SProxy "banana") { info: "hello" }
    knownError = Chirashi.mkVariantError knownVariant
    resultKnownError = Chirashi.readVariant knownError

  Assert.assertEqual
    { expected: Just knownVariant
    , actual: resultKnownError
    }

See tests for more examples.

Modules
Chirashi
Dependencies