generic-maybe: A generic version of Data.Maybe

[ bsd3, generics, library ] [ Propose Tags ]

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
> fromMaybe 'a' $ Success 'b'




Manual Flags


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


Maintainer's Corner

For package maintainers and hackage trustees


  • No Candidates
Versions [RSS],,,,,,,,,
Dependencies base (>=4.5 && <4.8), ghc-prim [details]
License BSD-3-Clause
Author Jonathan Fischoff
Category Generics
Home page
Uploaded by JonathanFischoff at 2014-02-13T17:01:55Z
Distributions NixOS:
Downloads 7102 total (32 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Successful builds reported [all 1 reports]