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

Modulerandom-fu-0.3.0.1Haskell2010

Data.Random.Lift

  • 1 class
  • Packagerandom-fu-0.3.0.1
  • Exports1
  • LanguageHaskell2010
  • LicenceLicenseRef-PublicDomain
  • SourceLift.hs
classclass Lift (m :: Type -> Type) (n :: Type -> Type) where
#

A class for "liftable" data structures. Conceptually an extension of MonadTrans to allow deep lifting, but lifting need not be done between monads only. Eg lifting between Applicatives is allowed.

For instances where m and n have return/pure defined, these instances must satisfy lift (return x) == return x.

This form of lift has an extremely general type and is used primarily to support sample. Its excessive generality is the main reason it's not exported from Data.Random. RVarT is, however, an instance of MonadTrans, which in most cases is the preferred way to do the lifting.

Methods

Instances5Lift
  • Monad m => Lift Identity mDefined in random-fu-0.3.0.1 · Data.Random.Lift

    This instance is incoherent with the others. However, by the law lift (return x) == return x, the results must always be the same.

  • Lift m mDefined in random-fu-0.3.0.1 · Data.Random.Lift
  • MonadTrans t => Lift Identity (t Identity)Defined in random-fu-0.3.0.1 · Data.Random.Lift

    This instance is again incoherent with the others, but provides a more-specific instance to resolve the overlap between the Lift m (t m) and Lift Identity m instances.

  • (Monad m, MonadTrans t) => Lift m (t m)Defined in random-fu-0.3.0.1 · Data.Random.Lift
  • Lift (RVarT Identity) (RVarT m)Defined in random-fu-0.3.0.1 · Data.Random.Lift