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

Modulebasement-0.0.16Haskell2010

Basement.Monad

Allow to run operation in ST and IO, without having to distinguinsh between the two. Most operations exposes the bare nuts and bolts of how IO and ST actually works, and relatively easy to shoot yourself in the foot

this is highly similar to the Control.Monad.Primitive in the primitive package

  • 2 classes
  • 6 values
  • Packagebasement-0.0.16
  • Exports8
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceMonad.hs
classclass (Functor m, Applicative m, Monad m) => PrimMonad (m :: Type -> Type) where
#

Primitive monad that can handle mutation.

For example: IO and ST.

Associated types

Methods

Instances2PrimMonad
  • PrimMonad IODefined in basement-0.0.16 · Basement.Monad
  • PrimMonad (ST s)Defined in basement-0.0.16 · Basement.Monad
classclass Monad m => MonadFailure (m :: Type -> Type) where
#

Monad that can represent failure

Similar to MonadFail but with a parametrized Failure linked to the Monad

Associated types

  • type family Failure (m :: Type -> Type)

    The associated type with the MonadFailure, representing what failure can be encoded in this monad

Methods

Instances3MonadFailure
valueunsafePrimCast :: (PrimMonad m1, PrimMonad m2) => m1 a -> m2 a
#

Convert a prim monad to another prim monad.

The net effect is that it coerce the state repr to another, so the runtime representation should be the same, otherwise hilary ensues.