Copyright | (C) 2012-2016 University of Twente 2016 Myrtle Software Ltd 2017 Google Inc. |
---|---|
License | BSD2 (see the file LICENSE) |
Maintainer | Christiaan Baaij <christiaan.baaij@gmail.com> |
Safe Haskell | None |
Language | Haskell2010 |
Type and instance definitions for Rewrite modules
Synopsis
- data RewriteStep = RewriteStep {}
- data RewriteState extra = RewriteState {
- _transformCounter :: !Int
- _bindings :: !BindingMap
- _uniqSupply :: !Supply
- _curFun :: (Id, SrcSpan)
- _nameCounter :: !Int
- _globalHeap :: GlobalHeap
- _extra :: !extra
- uniqSupply :: forall extra. Lens' (RewriteState extra) Supply
- transformCounter :: forall extra. Lens' (RewriteState extra) Int
- nameCounter :: forall extra. Lens' (RewriteState extra) Int
- globalHeap :: forall extra. Lens' (RewriteState extra) GlobalHeap
- extra :: forall extra extra. Lens (RewriteState extra) (RewriteState extra) extra extra
- curFun :: forall extra. Lens' (RewriteState extra) (Id, SrcSpan)
- bindings :: forall extra. Lens' (RewriteState extra) BindingMap
- data RewriteEnv = RewriteEnv {
- _dbgLevel :: DebugLevel
- _typeTranslator :: CustomReprs -> TyConMap -> Type -> State HWMap (Maybe (Either String FilteredHWType))
- _tcCache :: TyConMap
- _tupleTcCache :: IntMap TyConName
- _evaluator :: PrimEvaluator
- _topEntities :: VarSet
- _customReprs :: CustomReprs
- typeTranslator :: Lens' RewriteEnv (CustomReprs -> TyConMap -> Type -> State HWMap (Maybe (Either String FilteredHWType)))
- tupleTcCache :: Lens' RewriteEnv (IntMap TyConName)
- topEntities :: Lens' RewriteEnv VarSet
- tcCache :: Lens' RewriteEnv TyConMap
- evaluator :: Lens' RewriteEnv PrimEvaluator
- dbgLevel :: Lens' RewriteEnv DebugLevel
- customReprs :: Lens' RewriteEnv CustomReprs
- newtype RewriteMonad extra a = R {
- unR :: RewriteEnv -> RewriteState extra -> Any -> (a, RewriteState extra, Any)
- runR :: RewriteMonad extra a -> RewriteEnv -> RewriteState extra -> (a, RewriteState extra, Any)
- censor :: (Any -> Any) -> RewriteMonad extra a -> RewriteMonad extra a
- data TransformContext = TransformContext {
- tfInScope :: !InScopeSet
- tfContext :: Context
- type Transform m = TransformContext -> Term -> m Term
- type Rewrite extra = Transform (RewriteMonad extra)
Documentation
data RewriteStep Source #
State used by the inspection mechanism for recording rewrite steps.
Instances
data RewriteState extra Source #
State of a rewriting session
RewriteState | |
|
Instances
MonadState (RewriteState extra) (RewriteMonad extra) Source # | |
Defined in Clash.Rewrite.Types get :: RewriteMonad extra (RewriteState extra) # put :: RewriteState extra -> RewriteMonad extra () # state :: (RewriteState extra -> (a, RewriteState extra)) -> RewriteMonad extra a # |
uniqSupply :: forall extra. Lens' (RewriteState extra) Supply Source #
transformCounter :: forall extra. Lens' (RewriteState extra) Int Source #
nameCounter :: forall extra. Lens' (RewriteState extra) Int Source #
globalHeap :: forall extra. Lens' (RewriteState extra) GlobalHeap Source #
extra :: forall extra extra. Lens (RewriteState extra) (RewriteState extra) extra extra Source #
bindings :: forall extra. Lens' (RewriteState extra) BindingMap Source #
data RewriteEnv Source #
Read-only environment of a rewriting session
RewriteEnv | |
|
Instances
MonadReader RewriteEnv (RewriteMonad extra) Source # | |
Defined in Clash.Rewrite.Types ask :: RewriteMonad extra RewriteEnv # local :: (RewriteEnv -> RewriteEnv) -> RewriteMonad extra a -> RewriteMonad extra a # reader :: (RewriteEnv -> a) -> RewriteMonad extra a # |
typeTranslator :: Lens' RewriteEnv (CustomReprs -> TyConMap -> Type -> State HWMap (Maybe (Either String FilteredHWType))) Source #
customReprs :: Lens' RewriteEnv CustomReprs Source #
newtype RewriteMonad extra a Source #
Monad that keeps track how many transformations have been applied and can generate fresh variables and unique identifiers. In addition, it keeps track if a transformation/rewrite has been successfully applied.
R | |
|
Instances
runR :: RewriteMonad extra a -> RewriteEnv -> RewriteState extra -> (a, RewriteState extra, Any) Source #
Run the computation in the RewriteMonad
censor :: (Any -> Any) -> RewriteMonad extra a -> RewriteMonad extra a Source #
type Transform m = TransformContext -> Term -> m Term Source #
Monadic action that transforms a term given a certain context
type Rewrite extra = Transform (RewriteMonad extra) Source #
A Transform
action in the context of the RewriteMonad