{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE UndecidableInstances #-}
#define HAS_POLY_TYPEABLE MIN_VERSION_base(4,7,0)
#if HAS_POLY_TYPEABLE
{-# LANGUAGE StandaloneDeriving #-}
#endif
module Data.Fix (
Fix (..),
hoistFix,
hoistFix',
foldFix,
unfoldFix,
wrapFix,
unwrapFix,
Mu (..),
hoistMu,
foldMu,
unfoldMu,
wrapMu,
unwrapMu,
Nu (..),
hoistNu,
foldNu,
unfoldNu,
wrapNu,
unwrapNu,
refold,
foldFixM,
unfoldFixM,
refoldM,
cata, ana, hylo,
cataM, anaM, hyloM,
) where
import Data.Traversable (Traversable (..))
import Prelude (Eq (..), Functor (..), Monad (..), Ord (..), Read (..), Show (..), showParen, showString, ($), (.), (=<<))
#ifdef __GLASGOW_HASKELL__
#if !HAS_POLY_TYPEABLE
import Prelude (const, error, undefined)
#endif
#endif
import Control.Monad (liftM)
import Data.Function (on)
import Data.Functor.Classes (Eq1, Ord1, Read1, Show1, compare1, eq1, readsPrec1, showsPrec1)
import Data.Hashable (Hashable (..))
import Data.Hashable.Lifted (Hashable1, hashWithSalt1)
import Data.Typeable (Typeable)
import GHC.Generics (Generic)
import Text.Read (Lexeme (Ident), Read (..), lexP, parens, prec, readS_to_Prec, step)
#if MIN_VERSION_deepseq(1,4,3)
import Control.DeepSeq (NFData (..), NFData1, rnf1)
#endif
#if HAS_POLY_TYPEABLE
import Data.Data (Data)
#else
import Data.Data
#endif
newtype Fix f = Fix { forall (f :: * -> *). Fix f -> f (Fix f)
unFix :: f (Fix f) }
deriving (forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (f :: * -> *) x. Rep (Fix f) x -> Fix f
forall (f :: * -> *) x. Fix f -> Rep (Fix f) x
$cto :: forall (f :: * -> *) x. Rep (Fix f) x -> Fix f
$cfrom :: forall (f :: * -> *) x. Fix f -> Rep (Fix f) x
Generic)
hoistFix :: Functor f => (forall a. f a -> g a) -> Fix f -> Fix g
hoistFix :: forall (f :: * -> *) (g :: * -> *).
Functor f =>
(forall a. f a -> g a) -> Fix f -> Fix g
hoistFix forall a. f a -> g a
nt = Fix f -> Fix g
go where go :: Fix f -> Fix g
go (Fix f (Fix f)
f) = forall (f :: * -> *). f (Fix f) -> Fix f
Fix (forall a. f a -> g a
nt (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Fix f -> Fix g
go f (Fix f)
f))
hoistFix' :: Functor g => (forall a. f a -> g a) -> Fix f -> Fix g
hoistFix' :: forall (g :: * -> *) (f :: * -> *).
Functor g =>
(forall a. f a -> g a) -> Fix f -> Fix g
hoistFix' forall a. f a -> g a
nt = Fix f -> Fix g
go where go :: Fix f -> Fix g
go (Fix f (Fix f)
f) = forall (f :: * -> *). f (Fix f) -> Fix f
Fix (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Fix f -> Fix g
go (forall a. f a -> g a
nt f (Fix f)
f))
foldFix :: Functor f => (f a -> a) -> Fix f -> a
foldFix :: forall (f :: * -> *) a. Functor f => (f a -> a) -> Fix f -> a
foldFix f a -> a
f = Fix f -> a
go where go :: Fix f -> a
go = f a -> a
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Fix f -> a
go forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *). Fix f -> f (Fix f)
unFix
unfoldFix :: Functor f => (a -> f a) -> a -> Fix f
unfoldFix :: forall (f :: * -> *) a. Functor f => (a -> f a) -> a -> Fix f
unfoldFix a -> f a
f = a -> Fix f
go where go :: a -> Fix f
go = forall (f :: * -> *). f (Fix f) -> Fix f
Fix forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> Fix f
go forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> f a
f
wrapFix :: f (Fix f) -> Fix f
wrapFix :: forall (f :: * -> *). f (Fix f) -> Fix f
wrapFix = forall (f :: * -> *). f (Fix f) -> Fix f
Fix
unwrapFix :: Fix f -> f (Fix f)
unwrapFix :: forall (f :: * -> *). Fix f -> f (Fix f)
unwrapFix = forall (f :: * -> *). Fix f -> f (Fix f)
unFix
instance Eq1 f => Eq (Fix f) where
Fix f (Fix f)
a == :: Fix f -> Fix f -> Bool
== Fix f (Fix f)
b = forall (f :: * -> *) a. (Eq1 f, Eq a) => f a -> f a -> Bool
eq1 f (Fix f)
a f (Fix f)
b
instance Ord1 f => Ord (Fix f) where
compare :: Fix f -> Fix f -> Ordering
compare (Fix f (Fix f)
a) (Fix f (Fix f)
b) = forall (f :: * -> *) a. (Ord1 f, Ord a) => f a -> f a -> Ordering
compare1 f (Fix f)
a f (Fix f)
b
instance Show1 f => Show (Fix f) where
showsPrec :: Int -> Fix f -> ShowS
showsPrec Int
d (Fix f (Fix f)
a) =
Bool -> ShowS -> ShowS
showParen (Int
d forall a. Ord a => a -> a -> Bool
>= Int
11)
forall a b. (a -> b) -> a -> b
$ String -> ShowS
showString String
"Fix "
forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a. (Show1 f, Show a) => Int -> f a -> ShowS
showsPrec1 Int
11 f (Fix f)
a
#ifdef __GLASGOW_HASKELL__
instance Read1 f => Read (Fix f) where
readPrec :: ReadPrec (Fix f)
readPrec = forall a. ReadPrec a -> ReadPrec a
parens forall a b. (a -> b) -> a -> b
$ forall a. Int -> ReadPrec a -> ReadPrec a
prec Int
10 forall a b. (a -> b) -> a -> b
$ do
Ident String
"Fix" <- ReadPrec Lexeme
lexP
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall (f :: * -> *). f (Fix f) -> Fix f
Fix (forall a. ReadPrec a -> ReadPrec a
step (forall a. (Int -> ReadS a) -> ReadPrec a
readS_to_Prec forall (f :: * -> *) a. (Read1 f, Read a) => Int -> ReadS (f a)
readsPrec1))
#endif
instance Hashable1 f => Hashable (Fix f) where
hashWithSalt :: Int -> Fix f -> Int
hashWithSalt Int
salt = forall (f :: * -> *) a.
(Hashable1 f, Hashable a) =>
Int -> f a -> Int
hashWithSalt1 Int
salt forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *). Fix f -> f (Fix f)
unFix
#if MIN_VERSION_deepseq(1,4,3)
instance NFData1 f => NFData (Fix f) where
rnf :: Fix f -> ()
rnf = forall (f :: * -> *) a. (NFData1 f, NFData a) => f a -> ()
rnf1 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *). Fix f -> f (Fix f)
unFix
#endif
#ifdef __GLASGOW_HASKELL__
#if HAS_POLY_TYPEABLE
deriving instance Typeable Fix
deriving instance (Typeable f, Data (f (Fix f))) => Data (Fix f)
#else
instance Typeable1 f => Typeable (Fix f) where
typeOf t = mkTyConApp fixTyCon [typeOf1 (undefined `asArgsTypeOf` t)]
where asArgsTypeOf :: f a -> Fix f -> f a
asArgsTypeOf = const
fixTyCon :: TyCon
#if MIN_VERSION_base(4,4,0)
fixTyCon = mkTyCon3 "recursion-schemes" "Data.Functor.Foldable" "Fix"
#else
fixTyCon = mkTyCon "Data.Functor.Foldable.Fix"
#endif
{-# NOINLINE fixTyCon #-}
instance (Typeable1 f, Data (f (Fix f))) => Data (Fix f) where
gfoldl f z (Fix a) = z Fix `f` a
toConstr _ = fixConstr
gunfold k z c = case constrIndex c of
1 -> k (z (Fix))
_ -> error "gunfold"
dataTypeOf _ = fixDataType
fixConstr :: Constr
fixConstr = mkConstr fixDataType "Fix" [] Prefix
fixDataType :: DataType
fixDataType = mkDataType "Data.Functor.Foldable.Fix" [fixConstr]
#endif
#endif
newtype Mu f = Mu { forall (f :: * -> *). Mu f -> forall a. (f a -> a) -> a
unMu :: forall a. (f a -> a) -> a }
instance (Functor f, Eq1 f) => Eq (Mu f) where
== :: Mu f -> Mu f -> Bool
(==) = forall a. Eq a => a -> a -> Bool
(==) forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
`on` forall (f :: * -> *) a. (f a -> a) -> Mu f -> a
foldMu forall (f :: * -> *). f (Fix f) -> Fix f
Fix
instance (Functor f, Ord1 f) => Ord (Mu f) where
compare :: Mu f -> Mu f -> Ordering
compare = forall a. Ord a => a -> a -> Ordering
compare forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
`on` forall (f :: * -> *) a. (f a -> a) -> Mu f -> a
foldMu forall (f :: * -> *). f (Fix f) -> Fix f
Fix
instance (Functor f, Show1 f) => Show (Mu f) where
showsPrec :: Int -> Mu f -> ShowS
showsPrec Int
d Mu f
f = Bool -> ShowS -> ShowS
showParen (Int
d forall a. Ord a => a -> a -> Bool
> Int
10) forall a b. (a -> b) -> a -> b
$
String -> ShowS
showString String
"unfoldMu unFix " forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Show a => Int -> a -> ShowS
showsPrec Int
11 (forall (f :: * -> *) a. (f a -> a) -> Mu f -> a
foldMu forall (f :: * -> *). f (Fix f) -> Fix f
Fix Mu f
f)
#ifdef __GLASGOW_HASKELL__
instance (Functor f, Read1 f) => Read (Mu f) where
readPrec :: ReadPrec (Mu f)
readPrec = forall a. ReadPrec a -> ReadPrec a
parens forall a b. (a -> b) -> a -> b
$ forall a. Int -> ReadPrec a -> ReadPrec a
prec Int
10 forall a b. (a -> b) -> a -> b
$ do
Ident String
"unfoldMu" <- ReadPrec Lexeme
lexP
Ident String
"unFix" <- ReadPrec Lexeme
lexP
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (forall (f :: * -> *) a. Functor f => (a -> f a) -> a -> Mu f
unfoldMu forall (f :: * -> *). Fix f -> f (Fix f)
unFix) (forall a. ReadPrec a -> ReadPrec a
step forall a. Read a => ReadPrec a
readPrec)
#endif
hoistMu :: (forall a. f a -> g a) -> Mu f -> Mu g
hoistMu :: forall (f :: * -> *) (g :: * -> *).
(forall a. f a -> g a) -> Mu f -> Mu g
hoistMu forall a. f a -> g a
n (Mu forall a. (f a -> a) -> a
mk) = forall (f :: * -> *). (forall a. (f a -> a) -> a) -> Mu f
Mu forall a b. (a -> b) -> a -> b
$ \g a -> a
roll -> forall a. (f a -> a) -> a
mk (g a -> a
roll forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. f a -> g a
n)
foldMu :: (f a -> a) -> Mu f -> a
foldMu :: forall (f :: * -> *) a. (f a -> a) -> Mu f -> a
foldMu f a -> a
f (Mu forall a. (f a -> a) -> a
mk) = forall a. (f a -> a) -> a
mk f a -> a
f
unfoldMu :: Functor f => (a -> f a) -> a -> Mu f
unfoldMu :: forall (f :: * -> *) a. Functor f => (a -> f a) -> a -> Mu f
unfoldMu a -> f a
f a
x = forall (f :: * -> *). (forall a. (f a -> a) -> a) -> Mu f
Mu forall a b. (a -> b) -> a -> b
$ \f a -> a
mk -> forall (f :: * -> *) b a.
Functor f =>
(f b -> b) -> (a -> f a) -> a -> b
refold f a -> a
mk a -> f a
f a
x
wrapMu :: Functor f => f (Mu f) -> Mu f
wrapMu :: forall (f :: * -> *). Functor f => f (Mu f) -> Mu f
wrapMu f (Mu f)
fx = forall (f :: * -> *). (forall a. (f a -> a) -> a) -> Mu f
Mu forall a b. (a -> b) -> a -> b
$ \f a -> a
f -> f a -> a
f (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (forall (f :: * -> *) a. (f a -> a) -> Mu f -> a
foldMu f a -> a
f) f (Mu f)
fx)
unwrapMu :: Functor f => Mu f -> f (Mu f)
unwrapMu :: forall (f :: * -> *). Functor f => Mu f -> f (Mu f)
unwrapMu = forall (f :: * -> *) a. (f a -> a) -> Mu f -> a
foldMu (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall (f :: * -> *). Functor f => f (Mu f) -> Mu f
wrapMu)
data Nu f = forall a. Nu (a -> f a) a
instance (Functor f, Eq1 f) => Eq (Nu f) where
== :: Nu f -> Nu f -> Bool
(==) = forall a. Eq a => a -> a -> Bool
(==) forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
`on` forall (f :: * -> *) a. Functor f => (f a -> a) -> Nu f -> a
foldNu forall (f :: * -> *). f (Fix f) -> Fix f
Fix
instance (Functor f, Ord1 f) => Ord (Nu f) where
compare :: Nu f -> Nu f -> Ordering
compare = forall a. Ord a => a -> a -> Ordering
compare forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
`on` forall (f :: * -> *) a. Functor f => (f a -> a) -> Nu f -> a
foldNu forall (f :: * -> *). f (Fix f) -> Fix f
Fix
instance (Functor f, Show1 f) => Show (Nu f) where
showsPrec :: Int -> Nu f -> ShowS
showsPrec Int
d Nu f
f = Bool -> ShowS -> ShowS
showParen (Int
d forall a. Ord a => a -> a -> Bool
> Int
10) forall a b. (a -> b) -> a -> b
$
String -> ShowS
showString String
"unfoldNu unFix " forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Show a => Int -> a -> ShowS
showsPrec Int
11 (forall (f :: * -> *) a. Functor f => (f a -> a) -> Nu f -> a
foldNu forall (f :: * -> *). f (Fix f) -> Fix f
Fix Nu f
f)
#ifdef __GLASGOW_HASKELL__
instance (Functor f, Read1 f) => Read (Nu f) where
readPrec :: ReadPrec (Nu f)
readPrec = forall a. ReadPrec a -> ReadPrec a
parens forall a b. (a -> b) -> a -> b
$ forall a. Int -> ReadPrec a -> ReadPrec a
prec Int
10 forall a b. (a -> b) -> a -> b
$ do
Ident String
"unfoldNu" <- ReadPrec Lexeme
lexP
Ident String
"unFix" <- ReadPrec Lexeme
lexP
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (forall a (f :: * -> *). (a -> f a) -> a -> Nu f
unfoldNu forall (f :: * -> *). Fix f -> f (Fix f)
unFix) (forall a. ReadPrec a -> ReadPrec a
step forall a. Read a => ReadPrec a
readPrec)
#endif
hoistNu :: (forall a. f a -> g a) -> Nu f -> Nu g
hoistNu :: forall (f :: * -> *) (g :: * -> *).
(forall a. f a -> g a) -> Nu f -> Nu g
hoistNu forall a. f a -> g a
n (Nu a -> f a
next a
seed) = forall (f :: * -> *) a. (a -> f a) -> a -> Nu f
Nu (forall a. f a -> g a
n forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> f a
next) a
seed
foldNu :: Functor f => (f a -> a) -> Nu f -> a
foldNu :: forall (f :: * -> *) a. Functor f => (f a -> a) -> Nu f -> a
foldNu f a -> a
f (Nu a -> f a
next a
seed) = forall (f :: * -> *) b a.
Functor f =>
(f b -> b) -> (a -> f a) -> a -> b
refold f a -> a
f a -> f a
next a
seed
unfoldNu :: (a -> f a) -> a -> Nu f
unfoldNu :: forall a (f :: * -> *). (a -> f a) -> a -> Nu f
unfoldNu = forall (f :: * -> *) a. (a -> f a) -> a -> Nu f
Nu
wrapNu :: Functor f => f (Nu f) -> Nu f
wrapNu :: forall (f :: * -> *). Functor f => f (Nu f) -> Nu f
wrapNu = forall a (f :: * -> *). (a -> f a) -> a -> Nu f
unfoldNu (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall (f :: * -> *). Functor f => Nu f -> f (Nu f)
unwrapNu)
unwrapNu :: Functor f => Nu f -> f (Nu f)
unwrapNu :: forall (f :: * -> *). Functor f => Nu f -> f (Nu f)
unwrapNu (Nu a -> f a
f a
x) = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (forall (f :: * -> *) a. (a -> f a) -> a -> Nu f
Nu a -> f a
f) (a -> f a
f a
x)
refold :: Functor f => (f b -> b) -> (a -> f a) -> a -> b
refold :: forall (f :: * -> *) b a.
Functor f =>
(f b -> b) -> (a -> f a) -> a -> b
refold f b -> b
f a -> f a
g = a -> b
h where h :: a -> b
h = f b -> b
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> b
h forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> f a
g
foldFixM:: (Monad m, Traversable t)
=> (t a -> m a) -> Fix t -> m a
foldFixM :: forall (m :: * -> *) (t :: * -> *) a.
(Monad m, Traversable t) =>
(t a -> m a) -> Fix t -> m a
foldFixM t a -> m a
f = Fix t -> m a
go where go :: Fix t -> m a
go = (t a -> m a
f forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<<) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM Fix t -> m a
go forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *). Fix f -> f (Fix f)
unFix
unfoldFixM :: (Monad m, Traversable t)
=> (a -> m (t a)) -> (a -> m (Fix t))
unfoldFixM :: forall (m :: * -> *) (t :: * -> *) a.
(Monad m, Traversable t) =>
(a -> m (t a)) -> a -> m (Fix t)
unfoldFixM a -> m (t a)
f = a -> m (Fix t)
go where go :: a -> m (Fix t)
go = forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM forall (f :: * -> *). f (Fix f) -> Fix f
Fix forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM a -> m (Fix t)
go forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<<) forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> m (t a)
f
refoldM :: (Monad m, Traversable t)
=> (t b -> m b) -> (a -> m (t a)) -> (a -> m b)
refoldM :: forall (m :: * -> *) (t :: * -> *) b a.
(Monad m, Traversable t) =>
(t b -> m b) -> (a -> m (t a)) -> a -> m b
refoldM t b -> m b
phi a -> m (t a)
psi = a -> m b
go where go :: a -> m b
go = (t b -> m b
phi forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<<) forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM a -> m b
go forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<<) forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> m (t a)
psi
cata :: Functor f => (f a -> a) -> (Fix f -> a)
cata :: forall (f :: * -> *) a. Functor f => (f a -> a) -> Fix f -> a
cata = forall (f :: * -> *) a. Functor f => (f a -> a) -> Fix f -> a
foldFix
{-# DEPRECATED cata "Use foldFix" #-}
ana :: Functor f => (a -> f a) -> (a -> Fix f)
ana :: forall (f :: * -> *) a. Functor f => (a -> f a) -> a -> Fix f
ana = forall (f :: * -> *) a. Functor f => (a -> f a) -> a -> Fix f
unfoldFix
{-# DEPRECATED ana "Use unfoldFix" #-}
hylo :: Functor f => (f b -> b) -> (a -> f a) -> (a -> b)
hylo :: forall (f :: * -> *) b a.
Functor f =>
(f b -> b) -> (a -> f a) -> a -> b
hylo = forall (f :: * -> *) b a.
Functor f =>
(f b -> b) -> (a -> f a) -> a -> b
refold
{-# DEPRECATED hylo "Use refold" #-}
cataM :: (Monad m, Traversable t)
=> (t a -> m a) -> Fix t -> m a
cataM :: forall (m :: * -> *) (t :: * -> *) a.
(Monad m, Traversable t) =>
(t a -> m a) -> Fix t -> m a
cataM = forall (m :: * -> *) (t :: * -> *) a.
(Monad m, Traversable t) =>
(t a -> m a) -> Fix t -> m a
foldFixM
{-# DEPRECATED cataM "Use foldFixM" #-}
anaM :: (Monad m, Traversable t)
=> (a -> m (t a)) -> (a -> m (Fix t))
anaM :: forall (m :: * -> *) (t :: * -> *) a.
(Monad m, Traversable t) =>
(a -> m (t a)) -> a -> m (Fix t)
anaM = forall (m :: * -> *) (t :: * -> *) a.
(Monad m, Traversable t) =>
(a -> m (t a)) -> a -> m (Fix t)
unfoldFixM
{-# DEPRECATED anaM "Use unfoldFixM" #-}
hyloM :: (Monad m, Traversable t)
=> (t b -> m b) -> (a -> m (t a)) -> (a -> m b)
hyloM :: forall (m :: * -> *) (t :: * -> *) b a.
(Monad m, Traversable t) =>
(t b -> m b) -> (a -> m (t a)) -> a -> m b
hyloM = forall (m :: * -> *) (t :: * -> *) b a.
(Monad m, Traversable t) =>
(t b -> m b) -> (a -> m (t a)) -> a -> m b
refoldM
{-# DEPRECATED hyloM "Use refoldM" #-}