futhark-0.16.2: An optimising compiler for a functional, array-oriented language.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Futhark.Analysis.PrimExp.Convert

Description

Converting back and forth between PrimExps. Use the ToExp instance to convert to Futhark expressions.

Synopsis

Documentation

primExpFromExp :: (MonadFail m, Decorations lore) => (VName -> m (PrimExp v)) -> Exp lore -> m (PrimExp v) Source #

Convert an expression to a PrimExp. The provided function is used to convert expressions that are not trivially PrimExps. This includes constants and variable names, which are passed as SubExps.

primExpFromSubExp :: PrimType -> SubExp -> PrimExp VName Source #

Convert SubExps of a given type.

primExpFromSubExpM :: Applicative m => (VName -> m (PrimExp v)) -> SubExp -> m (PrimExp v) Source #

Like primExpFromExp, but for a SubExp.

replaceInPrimExp :: (a -> PrimType -> PrimExp b) -> PrimExp a -> PrimExp b Source #

As replaceInPrimExpM, but in the identity monad.

replaceInPrimExpM :: Monad m => (a -> PrimType -> m (PrimExp b)) -> PrimExp a -> m (PrimExp b) Source #

Applying a monadic transformation to the leaves in a PrimExp.

substituteInPrimExp :: Ord v => Map v (PrimExp v) -> PrimExp v -> PrimExp v Source #

Substituting names in a PrimExp with other PrimExps

primExpSlice :: Slice SubExp -> Slice (PrimExp VName) Source #

Convert a SubExp slice to a PrimExp slice.

subExpSlice :: MonadBinder m => Slice (PrimExp VName) -> m (Slice SubExp) Source #

Convert a PrimExp slice to a SubExp slice.

Module reexport

Orphan instances

ToExp v => ToExp (PrimExp v) Source # 
Instance details

Methods

toExp :: MonadBinder m => PrimExp v -> m (Exp (Lore m)) Source #