Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- class Expansive (f :: Type -> Type) where
- expand :: f a -> f (Maybe a)
- unite :: f l -> f r -> f (These l r)
- unfilter :: (Bool -> a) -> f a -> f a
- emapMaybe :: (Maybe b -> a) -> f b -> f a
- econtramapMaybe :: Contravariant f => (a -> Maybe b) -> f b -> f a
- emapThese :: (These l r -> a) -> f l -> f r -> f a
- econtramapThese :: Contravariant f => (a -> These l r) -> f l -> f r -> f a
- eapplyMaybe :: Applicative f => f (Maybe a -> b) -> f a -> f b
- eapplyThese :: Applicative f => f (These l r -> a) -> f l -> f r -> f a
- ebindMaybe :: Applicative f => (f (Maybe b) -> a) -> f b -> f a
- ebindThese :: Applicative f => (f (These l r) -> a) -> f l -> f r -> f a
- uniteDichotomy :: (Functor f, Expansive f, Dichotomous g) => f l -> f r -> f (Maybe (g l r))
Expand
class Expansive (f :: Type -> Type) where Source #
Partial inverse of Compactable
expand (unite x y) = uniteDichotomy x y
unite = emapThese id
map Just = expand
(\x -> unite x x) = map (\x -> These x x)
emapThese f a b = map f (unite a b)
unite (f <$> x) (g <$> y) = bimap f g <$> unite x y
expand (unite x y) = swap <$> unite y x
emapThese f a b = f <$> unite a b
unite empty = map That
flip unite empty = map This
unite mempty = map That
flip unite mempty = map This
expand :: f a -> f (Maybe a) Source #
unite :: f l -> f r -> f (These l r) Source #
unfilter :: (Bool -> a) -> f a -> f a Source #
emapMaybe :: (Maybe b -> a) -> f b -> f a Source #
econtramapMaybe :: Contravariant f => (a -> Maybe b) -> f b -> f a Source #
emapThese :: (These l r -> a) -> f l -> f r -> f a Source #
econtramapThese :: Contravariant f => (a -> These l r) -> f l -> f r -> f a Source #
eapplyMaybe :: Applicative f => f (Maybe a -> b) -> f a -> f b Source #
eapplyThese :: Applicative f => f (These l r -> a) -> f l -> f r -> f a Source #
ebindMaybe :: Applicative f => (f (Maybe b) -> a) -> f b -> f a Source #
ebindThese :: Applicative f => (f (These l r) -> a) -> f l -> f r -> f a Source #
Instances
uniteDichotomy :: (Functor f, Expansive f, Dichotomous g) => f l -> f r -> f (Maybe (g l r)) Source #