moduleControl.Monad.HTwhereimportqualifiedControl.MonadasMimportPreludehiding(repeat,until,)infixr1<=<{- |
Also present in newer versions of the 'base' package.
-}(<=<)::Monadm=>(b->mc)->(a->mb)->(a->mc)(<=<)fg=(f=<<).g{- |
Monadic 'List.repeat'.
-}repeat::(Monadm)=>ma->m[a]repeatx=letgo=lift2(:)xgoingo{-# DEPRECATED untilM "use M.until" #-}{- | repeat action until result fulfills condition -}until,untilM::(Monadm)=>(a->Bool)->ma->mauntilM=untiluntilpm=letgo=dox<-mifpxthenreturnxelsegoingo{-# DEPRECATED iterateLimitM "use M.iterateLimit" #-}{- | parameter order equal to that of 'nest' -}iterateLimit,iterateLimitM::Monadm=>Int->(a->ma)->a->m[a]iterateLimitM=iterateLimititerateLimitmf=letauxnx=lift(x:)$ifn==0thenreturn[]elseaux(n-1)=<<fxinauxm{- |
Lazy monadic conjunction.
That is, when the first action returns @False@,
then @False@ is immediately returned, without running the second action.
-}andLazy::(Monadm)=>mBool->mBool->mBoolandLazym0m1=m0>>=\b->ifbthenm1elsereturnFalse{- |
Lazy monadic disjunction.
That is, when the first action returns @True@,
then @True@ is immediately returned, without running the second action.
-}orLazy::(Monadm)=>mBool->mBool->mBoolorLazym0m1=m0>>=\b->ifbthenreturnTrueelsem1void::(Monadm)=>ma->m()void=lift(const())for::Monadm=>[a]->(a->mb)->m[b]for=M.forMmap::Monadm=>(a->mb)->[a]->m[b]map=M.mapMzipWith::Monadm=>(a->b->mc)->[a]->[b]->m[c]zipWith=M.zipWithMfilter::Monadm=>(a->mBool)->[a]->m[a]filter=M.filterMreplicate::Monadm=>Int->ma->m[a]replicate=M.replicateMlift::Monadm=>(a->r)->ma->mrlift=M.liftMlift2::Monadm=>(a->b->r)->ma->mb->mrlift2=M.liftM2lift3::Monadm=>(a->b->c->r)->ma->mb->mc->mrlift3=M.liftM3lift4::Monadm=>(a->b->c->d->r)->ma->mb->mc->md->mrlift4=M.liftM4lift5::Monadm=>(a->b->c->d->e->r)->ma->mb->mc->md->me->mrlift5=M.liftM5{-
Add functions with restricted types?
Shall their element types be monoids?
Should we add these functions to a Foldable.HT module
in order to save the underscore?
(>>)
mapM_
zipWithM_
sequence_
...
-}