on develop help sign in
Add FunctorMaybe instance to Maybe
commit910470339b857e6ae8a0a4a7b0098ced3375b5a8 authorAlexandre Esteves <alexandre.fmp.esteves@gmail.com> dateFri 22 Dec 2017, 16:34 (9 years ago) parentf78a73e
1 file changed+4
src/Reflex/FunctorMaybe.hs+4
src/Reflex/FunctorMaybe.hs+4
@@ -24,6 +24,10 @@ class FunctorMaybe f where
2424 -- | Combined mapping and filtering function.
2525 fmapMaybe :: (a -> Maybe b) -> f a -> f b
2626
27+-- | @fmapMaybe = flip (>>=)
28+instance FunctorMaybe Maybe where
29+ fmapMaybe = flip (>>=)
30+
2731-- | @fmapMaybe f = catMaybes . fmap f@
2832instance FunctorMaybe [] where
2933 fmapMaybe f = catMaybes . fmap f