clash-lib-1.3.0: CAES Language for Synchronous Hardware - As a Library
Copyright(C) 2020 QBayLogic B.V.
LicenseBSD2 (see the file LICENSE)
MaintainerQBayLogic B.V. <devops@qbaylogic.com>
Safe HaskellNone
LanguageHaskell2010

Clash.Core.PartialEval.Monad

Description

The monad for partial evaluation, and its API. This should contain all auxiliary functions needed to define new evaluator implementations. This module is only needed to define new evaluators, for calling an existing evaluator see Clash.Core.PartialEval.

Synopsis

Partial Evaluation Monad

data Eval a Source #

The monad of partial evaluation. The inner monad is IO, as primitive evaluation can attempt to evaluate IO actions.

Instances

Instances details
Monad Eval Source # 
Instance details

Defined in Clash.Core.PartialEval.Monad

Methods

(>>=) :: Eval a -> (a -> Eval b) -> Eval b #

(>>) :: Eval a -> Eval b -> Eval b #

return :: a -> Eval a #

Functor Eval Source # 
Instance details

Defined in Clash.Core.PartialEval.Monad

Methods

fmap :: (a -> b) -> Eval a -> Eval b #

(<$) :: a -> Eval b -> Eval a #

MonadFail Eval Source # 
Instance details

Defined in Clash.Core.PartialEval.Monad

Methods

fail :: String -> Eval a #

Applicative Eval Source # 
Instance details

Defined in Clash.Core.PartialEval.Monad

Methods

pure :: a -> Eval a #

(<*>) :: Eval (a -> b) -> Eval a -> Eval b #

liftA2 :: (a -> b -> c) -> Eval a -> Eval b -> Eval c #

(*>) :: Eval a -> Eval b -> Eval b #

(<*) :: Eval a -> Eval b -> Eval a #

Alternative Eval Source # 
Instance details

Defined in Clash.Core.PartialEval.Monad

Methods

empty :: Eval a #

(<|>) :: Eval a -> Eval a -> Eval a #

some :: Eval a -> Eval [a] #

many :: Eval a -> Eval [a] #

MonadIO Eval Source # 
Instance details

Defined in Clash.Core.PartialEval.Monad

Methods

liftIO :: IO a -> Eval a #

MonadThrow Eval Source # 
Instance details

Defined in Clash.Core.PartialEval.Monad

Methods

throwM :: Exception e => e -> Eval a #

MonadCatch Eval Source # 
Instance details

Defined in Clash.Core.PartialEval.Monad

Methods

catch :: Exception e => Eval a -> (e -> Eval a) -> Eval a #

MonadMask Eval Source # 
Instance details

Defined in Clash.Core.PartialEval.Monad

Methods

mask :: ((forall a. Eval a -> Eval a) -> Eval b) -> Eval b #

uninterruptibleMask :: ((forall a. Eval a -> Eval a) -> Eval b) -> Eval b #

generalBracket :: Eval a -> (a -> ExitCase b -> Eval c) -> (a -> Eval b) -> Eval (b, c) #

MonadReader LocalEnv Eval Source # 
Instance details

Defined in Clash.Core.PartialEval.Monad

Methods

ask :: Eval LocalEnv #

local :: (LocalEnv -> LocalEnv) -> Eval a -> Eval a #

reader :: (LocalEnv -> a) -> Eval a #

MonadState GlobalEnv Eval Source # 
Instance details

Defined in Clash.Core.PartialEval.Monad

Methods

get :: Eval GlobalEnv #

put :: GlobalEnv -> Eval () #

state :: (GlobalEnv -> (a, GlobalEnv)) -> Eval a #

runEval :: GlobalEnv -> LocalEnv -> Eval a -> IO (a, GlobalEnv) Source #

Evaluate an action in the partial evaluator, returning the result, and the final state of the global environment.

Local and Global Environments

Evaluation Context

Local Type Bindings

withTyVar :: TyVar -> Type -> Eval a -> Eval a Source #

withTyVars :: [(TyVar, Type)] -> Eval a -> Eval a Source #

Local Term Bindings

withId :: Id -> Value -> Eval a -> Eval a Source #

withIds :: [(Id, Value)] -> Eval a -> Eval a Source #

withoutId :: Id -> Eval a -> Eval a Source #

Global Term Bindings

IO Heap Bindings

setRef :: Int -> Value -> Eval () Source #

Lifted Data Constructors

Fuel

Accessing Global State

Fresh Variable Generation

Work free check