You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import Control.Lens
import Data.Monoid
newtype Compose f g a =
Compose (f (g a))
instance (Foldable f, Foldable g) => Foldable (Compose f g) where
foldr f z (Compose x) =
foldr (\a b -> foldr f b a) z x
collapse0 ::
(Cons r r a a, AsEmpty r) =>
Getting (Endo r) s a
-> s
-> r
collapse0 x =
foldrOf x cons (_Empty # ())
collapse1 ::
(Cons r r a a, AsEmpty r) =>
Getting (Endo r) (Compose f g b) a
-> f (g b)
-> r
collapse1 x =
collapse0 x . Compose
collapse2 ::
(Cons r r a a, AsEmpty r) =>
Getting (Endo r) (Compose (Compose f g) h b) a
-> f (g (h b))
-> r
collapse2 x =
collapse1 x . Compose
map1 ::
(Cons r r a a, AsEmpty r, Functor f) =>
Getting (Endo r) (f c) a
-> (b -> c)
-> f b
-> r
map1 x f =
collapse0 x . fmap f
map2 ::
(Cons r r a a, AsEmpty r, Functor f) =>
Getting (Endo r) (Compose f g c) a
-> (b -> g c)
-> f b
-> r
map2 x f =
collapse1 x . fmap f
map3 ::
(Cons r r a a, AsEmpty r, Functor f) =>
Getting (Endo r) (Compose (Compose f g) h c) a
-> (b -> g (h c))
-> f b
-> r
map3 x f =
collapse2 x . fmap f
----
mapMaybe ::
(a -> Maybe b)
-> [a]
-> [b]
mapMaybe =
map2 folded
catMaybes ::
[Maybe a]
-> [a]
catMaybes =
collapse1 folded
The text was updated successfully, but these errors were encountered:
tonymorris
added a commit
to data61/papa-lens-implement
that referenced
this issue
Jan 16, 2017
Belongs in
papa-lens-implement
The text was updated successfully, but these errors were encountered: