
11 Feb
2014
11 Feb
'14
11:51 p.m.
generic-maybe utilizes GHC.Generics to generalize the functions of Data.Maybe to arbitrary sum types with two constructors, with one "empty." Here is a quick example: λ> :set -XDeriveGeneric λ> import GHC.Generics λ> data Result a = Success a | Fail deriving (Show, Generic) λ> fromMaybe 'a' Fail 'a' λ> fromMaybe 'a' $ Success 'b' 'b' Additionally, it lets you convert between two representations: λ> convert (Just 'a') :: Result Char Success 'a' Documentation on Hackage: http://hackage.haskell.org/package/generic-maybe-0.3.0.2/docs/Data-Generics-... -Jonathan Fischoff
4119
Age (days ago)
4119
Last active (days ago)
0 comments
1 participants
participants (1)
-
Jonathan Fischoff