| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Futhark.IR.Rephrase
Description
Facilities for changing the representation of some fragment, within a monadic context. We call this "rephrasing", for no deep reason.
Synopsis
- rephraseProg :: Monad m => Rephraser m from to -> Prog from -> m (Prog to)
- rephraseFunDef :: Monad m => Rephraser m from to -> FunDef from -> m (FunDef to)
- rephraseExp :: Monad m => Rephraser m from to -> Exp from -> m (Exp to)
- rephraseBody :: Monad m => Rephraser m from to -> GBody from res -> m (GBody to res)
- rephraseStm :: Monad m => Rephraser m from to -> Stm from -> m (Stm to)
- rephraseLambda :: Monad m => Rephraser m from to -> Lambda from -> m (Lambda to)
- rephrasePat :: Monad m => (from -> m to) -> Pat from -> m (Pat to)
- rephrasePatElem :: Monad m => (from -> m to) -> PatElem from -> m (PatElem to)
- data Rephraser (m :: Type -> Type) from to = Rephraser {
- rephraseExpDec :: ExpDec from -> m (ExpDec to)
- rephraseLetBoundDec :: LetDec from -> m (LetDec to)
- rephraseFParamDec :: FParamInfo from -> m (FParamInfo to)
- rephraseLParamDec :: LParamInfo from -> m (LParamInfo to)
- rephraseBodyDec :: BodyDec from -> m (BodyDec to)
- rephraseRetType :: RetType from -> m (RetType to)
- rephraseBranchType :: BranchType from -> m (BranchType to)
- rephraseOp :: Op from -> m (Op to)
- class RephraseOp (op :: Type -> Type) where
- rephraseInOp :: Monad m => Rephraser m from to -> op from -> m (op to)
Documentation
rephraseProg :: Monad m => Rephraser m from to -> Prog from -> m (Prog to) Source #
Rephrase an entire program.
rephraseFunDef :: Monad m => Rephraser m from to -> FunDef from -> m (FunDef to) Source #
Rephrase a function definition.
rephraseExp :: Monad m => Rephraser m from to -> Exp from -> m (Exp to) Source #
Rephrase an expression.
rephraseBody :: Monad m => Rephraser m from to -> GBody from res -> m (GBody to res) Source #
Rephrase a body.
rephraseStm :: Monad m => Rephraser m from to -> Stm from -> m (Stm to) Source #
Rephrase a statement.
rephraseLambda :: Monad m => Rephraser m from to -> Lambda from -> m (Lambda to) Source #
Rephrase a lambda.
rephrasePatElem :: Monad m => (from -> m to) -> PatElem from -> m (PatElem to) Source #
Rephrase a pattern element.
data Rephraser (m :: Type -> Type) from to Source #
A collection of functions that together allow us to rephrase some IR fragment, in some monad m. If we let m be the Maybe monad, we can conveniently do rephrasing that might fail. This is useful if you want to see if some IR in e.g. the Kernels rep actually uses any Kernels-specific operations.
Constructors
| Rephraser | |
Fields
| |
class RephraseOp (op :: Type -> Type) where Source #
Rephrasing any fragments inside an Op from one representation to another.
Methods
rephraseInOp :: Monad m => Rephraser m from to -> op from -> m (op to) Source #
Instances
| RephraseOp SOAC Source # | |
Defined in Futhark.IR.SOACS.SOAC | |
| RephraseOp op => RephraseOp (HostOp op) Source # | |
Defined in Futhark.IR.GPU.Op | |
| RephraseOp op => RephraseOp (MCOp op) Source # | |
Defined in Futhark.IR.MC.Op | |
| RephraseOp inner => RephraseOp (MemOp inner) Source # | |
Defined in Futhark.IR.Mem | |
| RephraseOp (NoOp :: Type -> Type) Source # | |
Defined in Futhark.IR.Rephrase | |
| RephraseOp (SegOp lvl) Source # | |
Defined in Futhark.IR.SegOp | |