Returns Just if the precondition is fulfilled. prop> b x -> (guard b >> x) == (toMaybe b =<< (x::Maybe Char))
Moduleutility-ht-0.0.17.2Haskell98
Data.Maybe.HT
- 3 values
- Packageutility-ht-0.0.17.2
- Exports3
- LanguageHaskell98
- LicenceBSD-3-Clause
- SourceHT.hs
import Control.Monad (guard)This is an infix version of fmap for writing select style expressions using test functions, that produce Maybes.
The precedence is chosen to be higher than (:),
in order to allow:
alternatives default $
checkForA ?-> (\a -> f a) :
checkForB ?-> (\b -> g b) :
[]The operation is left associative in order to allow to write
checkForA ?-> f ?-> gwhich is equivalent to
checkForA ?-> g . fdue to the functor law.