Vectorise.Utils.Closure

ghc-8.4.0.20171214: The GHC API

Safe Haskell | None
Language | Haskell2010

Vectorise.Utils.Closure

Description

Utils concerning closure construction and application.

Synopsis

- mkClosure :: Type -> Type -> Type -> VExpr -> VExpr -> VM VExpr
- mkClosureApp :: Type -> Type -> VExpr -> VExpr -> VM VExpr
- buildClosures :: [TyVar] -> [Var] -> [VVar] -> [Type] -> Type -> VM VExpr -> VM VExpr

# Documentation

mkClosure Source #

Arguments

:: Type | Type of the argument.
-> Type | Type of the result.
-> Type | Type of the environment.
-> VExpr | The function to apply.
-> VExpr | The environment to use.
-> VM VExpr |

Make a closure.

mkClosureApp Source #

Arguments

:: Type | Type of the argument.
-> Type | Type of the result.
-> VExpr | Closure to apply.
-> VExpr | Argument to use.
-> VM VExpr |

Make a closure application.

buildClosures Source #

Arguments

:: [TyVar] | Type variables passed during closure construction.
-> [Var] | Variables passed during closure construction.
-> [VVar] | Variables in the environment.
-> [Type] | Type of the arguments.
-> Type | Type of result.
-> VM VExpr |
-> VM VExpr |

Build a set of `n` closures corresponding to an `n`-ary vectorised function. The length of the list of types of arguments determines the arity.

In addition to a set of type variables, a set of value variables is passed during closure construction. In contrast, the closure environment and the arguments are passed during closure application.