Copyright | Copyright (c) 2007--2014 wren gayle romano |
---|---|

License | BSD |

Maintainer | wren@community.haskell.org |

Stability | highly experimental |

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

Safe Haskell | None |

Language | Haskell98 |

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.

Eq IntVar | |

Show IntVar | |

Variable IntVar | |

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

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

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

data IntRBindingState t Source

Ranked binding state for `IntVar`

.

Show (t (UTerm t IntVar)) => 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 t IntVar (IntRBindingT t m) | |

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

MonadTrans (IntRBindingT t) | |

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

(Functor m, MonadPlus m) => Alternative (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) | |

MonadLogic m => MonadLogic (IntRBindingT t m) |

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

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

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