1-- | This module defines the FunctorMaybe class, which extends Functors with the
2-- ability to delete values.
3module Reflex.FunctorMaybe
9--TODO: See if there's a better class in the standard libraries already
11-- | A class for values that combines filtering and mapping using 'Maybe'.
12-- Morally, @'FunctorMaybe' ~ KleisliFunctor 'Maybe'@. Also similar is the
13-- @Witherable@ typeclass, but it requires @Foldable f@ and @Traverable f@,
14-- and e.g. 'Event' is instance of neither.
16-- A definition of 'fmapMaybe' must satisfy the following laws:
19-- @'fmapMaybe' 'Just' ≡ 'id'@
22-- @'fmapMaybe' (f <=< g) ≡ 'fmapMaybe' f . 'fmapMaybe' g@
23class FunctorMaybe f where
24 -- | Combined mapping and filtering function.
25 fmapMaybe :: (a -> Maybe b) -> f a -> f b
27-- | @fmapMaybe = (=<<)
28instance FunctorMaybe Maybe where
31-- | @fmapMaybe f = catMaybes . fmap f@
32instance FunctorMaybe [] where
33 fmapMaybe f = catMaybes . fmap f
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list