About

Metadata

  • Last updated , by fpringle
  • License BSD-3-Clause
  • Categories Generics
  • Maintained by: freddyjepringle@gmail.com

  • Lottery factor: 1

Links

Installation

Tested Compilers

  1. 9.12.2
  2. 9.10.1
  3. 9.8.2
  4. 9.6.5
  5. 9.4.8
  6. 9.2.8
  7. 9.0.2
  8. 8.10.7
  9. 8.6.5

Readme

Haskell CI

Generic case analysis functions

"Case analysis" functions are those which take one function for each constructor of a sum type, examine a value of that type, and call the relevant function depending on which constructor was used to build that type. Examples include maybe, either and bool. generic-case gives you these functions for any type which implements Generic from generics-sop.

maybe :: forall a r. r -> (a -> r) -> Maybe a -> r
maybe = gcaseR @(Maybe a)

For more detailed documentation, see Generics.Case.