clash-lib-1.2.3: CAES Language for Synchronous Hardware - As a Library
Copyright(C) 2012-2016 University of Twente
2016 Myrtle Software Ltd
2017 Google Inc.
LicenseBSD2 (see the file LICENSE)
MaintainerChristiaan Baaij <christiaan.baaij@gmail.com>
Safe HaskellNone
LanguageHaskell2010

Clash.Rewrite.Types

Description

Type and instance definitions for Rewrite modules

Synopsis

Documentation

data RewriteStep Source #

State used by the inspection mechanism for recording rewrite steps.

Constructors

RewriteStep 

Fields

Instances

Instances details
Show RewriteStep Source # 
Instance details

Defined in Clash.Rewrite.Types

Generic RewriteStep Source # 
Instance details

Defined in Clash.Rewrite.Types

Associated Types

type Rep RewriteStep :: Type -> Type #

Hashable RewriteStep Source # 
Instance details

Defined in Clash.Rewrite.Types

Binary RewriteStep Source # 
Instance details

Defined in Clash.Rewrite.Types

NFData RewriteStep Source # 
Instance details

Defined in Clash.Rewrite.Types

Methods

rnf :: RewriteStep -> () #

type Rep RewriteStep Source # 
Instance details

Defined in Clash.Rewrite.Types

data RewriteState extra Source #

State of a rewriting session

Constructors

RewriteState 

Fields

Instances

Instances details
MonadState (RewriteState extra) (RewriteMonad extra) Source # 
Instance details

Defined in Clash.Rewrite.Types

Methods

get :: RewriteMonad extra (RewriteState extra) #

put :: RewriteState extra -> RewriteMonad extra () #

state :: (RewriteState extra -> (a, RewriteState extra)) -> RewriteMonad extra a #

workFreeBinders :: forall extra. Lens' (RewriteState extra) (VarEnv Bool) Source #

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) PrimHeap Source #

extra :: forall extra extra. Lens (RewriteState extra) (RewriteState extra) extra extra Source #

curFun :: forall extra. Lens' (RewriteState extra) (Id, SrcSpan) Source #

bindings :: forall extra. Lens' (RewriteState extra) BindingMap Source #

data RewriteEnv Source #

Read-only environment of a rewriting session

Constructors

RewriteEnv 

Fields

Instances

Instances details
MonadReader RewriteEnv (RewriteMonad extra) Source # 
Instance details

Defined in Clash.Rewrite.Types

Methods

ask :: RewriteMonad extra RewriteEnv #

local :: (RewriteEnv -> RewriteEnv) -> RewriteMonad extra a -> RewriteMonad extra a #

reader :: (RewriteEnv -> a) -> RewriteMonad extra a #

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.

Constructors

R 

Fields

Instances

Instances details
MonadReader RewriteEnv (RewriteMonad extra) Source # 
Instance details

Defined in Clash.Rewrite.Types

Methods

ask :: RewriteMonad extra RewriteEnv #

local :: (RewriteEnv -> RewriteEnv) -> RewriteMonad extra a -> RewriteMonad extra a #

reader :: (RewriteEnv -> a) -> RewriteMonad extra a #

MonadWriter Any (RewriteMonad extra) Source # 
Instance details

Defined in Clash.Rewrite.Types

Methods

writer :: (a, Any) -> RewriteMonad extra a #

tell :: Any -> RewriteMonad extra () #

listen :: RewriteMonad extra a -> RewriteMonad extra (a, Any) #

pass :: RewriteMonad extra (a, Any -> Any) -> RewriteMonad extra a #

Monad (RewriteMonad extra) Source # 
Instance details

Defined in Clash.Rewrite.Types

Methods

(>>=) :: RewriteMonad extra a -> (a -> RewriteMonad extra b) -> RewriteMonad extra b #

(>>) :: RewriteMonad extra a -> RewriteMonad extra b -> RewriteMonad extra b #

return :: a -> RewriteMonad extra a #

Functor (RewriteMonad extra) Source # 
Instance details

Defined in Clash.Rewrite.Types

Methods

fmap :: (a -> b) -> RewriteMonad extra a -> RewriteMonad extra b #

(<$) :: a -> RewriteMonad extra b -> RewriteMonad extra a #

MonadFix (RewriteMonad extra) Source # 
Instance details

Defined in Clash.Rewrite.Types

Methods

mfix :: (a -> RewriteMonad extra a) -> RewriteMonad extra a #

MonadFail (RewriteMonad extra) Source # 
Instance details

Defined in Clash.Rewrite.Types

Methods

fail :: String -> RewriteMonad extra a #

Applicative (RewriteMonad extra) Source # 
Instance details

Defined in Clash.Rewrite.Types

Methods

pure :: a -> RewriteMonad extra a #

(<*>) :: RewriteMonad extra (a -> b) -> RewriteMonad extra a -> RewriteMonad extra b #

liftA2 :: (a -> b -> c) -> RewriteMonad extra a -> RewriteMonad extra b -> RewriteMonad extra c #

(*>) :: RewriteMonad extra a -> RewriteMonad extra b -> RewriteMonad extra b #

(<*) :: RewriteMonad extra a -> RewriteMonad extra b -> RewriteMonad extra a #

MonadUnique (RewriteMonad extra) Source # 
Instance details

Defined in Clash.Rewrite.Types

MonadState (RewriteState extra) (RewriteMonad extra) Source # 
Instance details

Defined in Clash.Rewrite.Types

Methods

get :: RewriteMonad extra (RewriteState extra) #

put :: RewriteState extra -> RewriteMonad extra () #

state :: (RewriteState extra -> (a, RewriteState extra)) -> RewriteMonad extra a #

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