The generic-maybe package

[Tags:benchmark, bsd3, library]

This module is a drop in replacement for Data.Maybe. It generalizes the functions to any types that share the same "sum of products" view of Maybe.

To use the module for your type, enable GHC's DeriveGeneric extension and derive a Generic instance for your type.

 import GHC.Generics

 data Result a = Success a | Fail
    deriving (Show, Generic)

After which you can use the functions, like your type was Data.Maybe.Maybe

> fromMaybe 'a' Fail
'a'
> fromMaybe 'a' $ Success 'b'
'b'

Properties

Versions 0.1.0.0, 0.1.0.1, 0.1.1.0, 0.2.0.0, 0.2.1.0, 0.3.0.0, 0.3.0.1, 0.3.0.2, 0.3.0.3, 0.3.0.4
Dependencies base (>=4.5 && <4.8), ghc-prim [details]
License BSD3
Author Jonathan Fischoff
Maintainer jonathangfischoff@gmail.com
Category Generics
Home page https://github.com/jfischoff/generic-maybe
Uploaded Thu Feb 13 17:01:55 UTC 2014 by JonathanFischoff
Distributions NixOS:0.3.0.4
Downloads 2079 total (18 in the last 30 days)
Votes
0 []
Status Docs available [build log]
Successful builds reported [all 1 reports]
Hackage Matrix CI

Modules

[Index]

Flags

NameDescriptionDefaultType
test-doctestsEnabledManual
test-hlintEnabledManual

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

For package maintainers and hackage trustees