Portability | semi-portable (MPTCs,...) |
---|---|

Stability | highly experimental |

Maintainer | wren@community.haskell.org |

Safe Haskell | Safe-Infered |

A ranked variant of Control.Unification.IntVar.

- newtype IntVar = IntVar Int
- data IntRBindingState t
- data IntRBindingT t m a
- runIntRBindingT :: IntRBindingT t m a -> m (a, IntRBindingState t)
- evalIntRBindingT :: Monad m => IntRBindingT t m a -> m a
- execIntRBindingT :: Monad m => IntRBindingT t m a -> m (IntRBindingState t)

# Documentation

A "mutable" unification variable implemented by an integer.
This provides an entirely pure alternative to truly mutable
alternatives (like `STVar`

), which can make backtracking easier.

N.B., because this implementation is pure, we can use it for both ranked and unranked monads.

Show IntVar | |

Variable IntVar | |

(Unifiable t, Applicative m, Monad m) => RankedBindingMonad IntVar t (IntRBindingT t m) | |

(Unifiable t, Applicative m, Monad m) => BindingMonad IntVar t (IntBindingT t m) | |

(Unifiable t, Applicative m, Monad m) => BindingMonad IntVar t (IntRBindingT t m) |

data IntRBindingState t Source

Ranked binding state for `IntVar`

.

Show (t (MutTerm IntVar t)) => Show (IntRBindingState t) | |

Monad m => MonadState (IntRBindingState t) (IntRBindingT t m) |

data IntRBindingT t m a Source

A monad for storing `IntVar`

bindings, implemented as a `StateT`

.
For a plain state monad, set `m = Identity`

; for a backtracking
state monad, set `m = Logic`

.

(Unifiable t, Applicative m, Monad m) => RankedBindingMonad IntVar t (IntRBindingT t m) | |

(Unifiable t, Applicative m, Monad m) => BindingMonad IntVar t (IntRBindingT t m) | |

MonadTrans (IntRBindingT t) | |

Monad m => MonadState (IntRBindingState t) (IntRBindingT t m) | |

Monad m => Monad (IntRBindingT t m) | |

Functor m => Functor (IntRBindingT t m) | |

MonadPlus m => MonadPlus (IntRBindingT t m) | |

(Functor m, Monad m) => Applicative (IntRBindingT t m) | |

(Functor m, MonadPlus m) => Alternative (IntRBindingT t m) | |

MonadLogic m => MonadLogic (IntRBindingT t m) |

runIntRBindingT :: IntRBindingT t m a -> m (a, IntRBindingState t)Source

evalIntRBindingT :: Monad m => IntRBindingT t m a -> m aSource

N.B., you should explicitly apply bindings before calling this function, or else the bindings will be lost

execIntRBindingT :: Monad m => IntRBindingT t m a -> m (IntRBindingState t)Source