HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulerelude-1.2.0.0Haskell2010

Relude.Monad

SPDX-License-Identifier : MIT Maintainer : Kowainik xrom.xkov@gmail.com Stability : Stable Portability : Portable

Reexporting useful monadic stuff.

  • 2 values
  • Packagerelude-1.2.0.0
  • Exports2
  • LanguageHaskell2010
  • LicenceMIT
  • SourceMonad.hs

Reexports functions to work with different monads.

Provided new combinators to work with Relude.Maybe data type.

Provided new combinators to work with Relude.Either data type.

Monad transformers functions and combinators.

valuechainedTo :: Monad m => (a -> m b) -> m a -> m b
#

For chaining monadic operations in forward applications using (&) Named version of =<<.

Example2 expressions
Just [ 1 :: Int ] & chainedTo (viaNonEmpty head)Just 1Nothing & chainedTo (viaNonEmpty head)Nothing
valueinfinitely :: Applicative f => f a -> f Void
#

Repeat a monadic action indefinitely.

This is a more type safe version of forever, which has a convenient but unsafe type.

Consider the following two examples. In the getIntForever functions, it falsely expects Int as the result of the forever function. But it would need to wait *forever* to get that, and this mistake won't be caught by the type system and compiler:

getIntForever :: IO Int
getIntForever = do
    i <- forever $ do ...
    pure i

In contrast, using infinitely instead of forever in foo is a type error.