clash-lib-1.8.1: Clash: a functional hardware description language - As a library
Copyright(C) 2012-2016 University of Twente
2016 Myrtle Software Ltd
2017 Google Inc.
2021-2022 QBayLogic B.V.
LicenseBSD2 (see the file LICENSE)
MaintainerQBayLogic B.V. <devops@qbaylogic.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 Source #

Binary RewriteStep Source # 
Instance details

Defined in Clash.Rewrite.Types

NFData RewriteStep Source # 
Instance details

Defined in Clash.Rewrite.Types

Methods

rnf :: RewriteStep -> () Source #

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

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

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

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

uniqSupply :: forall extra. Lens' (RewriteState extra) Supply Source #

transformCounter :: forall extra. Lens' (RewriteState extra) Word 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

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

MonadWriter Any (RewriteMonad extra) Source # 
Instance details

Defined in Clash.Rewrite.Types

Methods

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

tell :: Any -> RewriteMonad extra () Source #

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

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

Monad (RewriteMonad extra) Source # 
Instance details

Defined in Clash.Rewrite.Types

Methods

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

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

return :: a -> RewriteMonad extra a Source #

Functor (RewriteMonad extra) Source # 
Instance details

Defined in Clash.Rewrite.Types

Methods

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

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

MonadFix (RewriteMonad extra) Source # 
Instance details

Defined in Clash.Rewrite.Types

Methods

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

Applicative (RewriteMonad extra) Source # 
Instance details

Defined in Clash.Rewrite.Types

Methods

pure :: a -> RewriteMonad extra a Source #

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

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

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

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

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

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

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

runR :: RewriteMonad extra a -> RewriteEnv -> RewriteState extra -> IO (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