| Safe Haskell | Safe |
|---|---|
| Language | Haskell2010 |
Relude.Extra.Enum
Documentation
inverseMap :: forall a k. (Bounded a, Enum a, Ord k) => (a -> k) -> k -> Maybe a Source #
Creates a function that is the inverse of a given function f.
>>>data Color = Red | Green | Blue deriving (Show, Enum, Bounded)>>>parse = inverseMap show :: String -> Maybe Color>>>parse "Red"Just Red>>>parse "Black"Nothing