hobbits-1.3.1: A library for canonically representing terms with binding
Copyright(c) 2020 Edwin Westbrook
LicenseBSD3
Maintainerwestbrook@galois.com
Stabilityexperimental
PortabilityGHC
Safe HaskellNone
LanguageHaskell2010

Data.Binding.Hobbits.MonadBind

Description

This module defines monads that are compatible with the notion of name-binding, where a monad is compatible with name-binding iff it can intuitively run computations that are inside name-bindings. More formally, a binding monad is a monad with an operation mbM that commutes name-binding with the monadic operations, meaning:

'mbM' ('nuMulti' $ \ns -> 'return' a) == 'return' ('nuMulti' $ \ns -> a)
'mbM' ('nuMulti' $ \ns -> m >>= f)
  == 'mbM' ('nuMulti' $ \ns -> m) >>= \mb_x ->
     'mbM' (('nuMulti' $ \ns x -> f x) `'mbApply'` mb_x)
Synopsis

Documentation

class Monad m => MonadBind m where Source #

The class of name-binding monads

Methods

mbM :: NuMatching a => Mb ctx (m a) -> m (Mb ctx a) Source #

Instances

Instances details
MonadBind Maybe Source # 
Instance details

Defined in Data.Binding.Hobbits.MonadBind

Methods

mbM :: forall k a (ctx :: RList k). NuMatching a => Mb ctx (Maybe a) -> Maybe (Mb ctx a) Source #

MonadBind Identity Source # 
Instance details

Defined in Data.Binding.Hobbits.MonadBind

Methods

mbM :: forall k a (ctx :: RList k). NuMatching a => Mb ctx (Identity a) -> Identity (Mb ctx a) Source #

MonadBind m => MonadBind (ReaderT r m) Source # 
Instance details

Defined in Data.Binding.Hobbits.MonadBind

Methods

mbM :: forall k a (ctx :: RList k). NuMatching a => Mb ctx (ReaderT r m a) -> ReaderT r m (Mb ctx a) Source #

(MonadBind m, BindState s) => MonadBind (StateT s m) Source # 
Instance details

Defined in Data.Binding.Hobbits.MonadBind

Methods

mbM :: forall k a (ctx :: RList k). NuMatching a => Mb ctx (StateT s m a) -> StateT s m (Mb ctx a) Source #

class MonadBind m => MonadStrongBind m where Source #

A version of MonadBind that does not require a NuMatching instance on the element type of the multi-binding in the monad

Methods

strongMbM :: Mb ctx (m a) -> m (Mb ctx a) Source #

Instances

Instances details
MonadStrongBind Identity Source # 
Instance details

Defined in Data.Binding.Hobbits.MonadBind

Methods

strongMbM :: forall k (ctx :: RList k) a. Mb ctx (Identity a) -> Identity (Mb ctx a) Source #

MonadStrongBind m => MonadStrongBind (ReaderT r m) Source # 
Instance details

Defined in Data.Binding.Hobbits.MonadBind

Methods

strongMbM :: forall k (ctx :: RList k) a. Mb ctx (ReaderT r m a) -> ReaderT r m (Mb ctx a) Source #

(MonadStrongBind m, BindState s) => MonadStrongBind (StateT s m) Source # 
Instance details

Defined in Data.Binding.Hobbits.MonadBind

Methods

strongMbM :: forall k (ctx :: RList k) a. Mb ctx (StateT s m a) -> StateT s m (Mb ctx a) Source #