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

Futhark.IR.Prop.TypeOf

Description

This module provides facilities for obtaining the types of various Futhark constructs. Typically, you will need to execute these in a context where type information is available as a Scope; usually by using a monad that is an instance of HasScope. The information is returned as a list of ExtType values - one for each of the values the Futhark construct returns. Some constructs (such as subexpressions) can produce only a single value, and their typing functions hence do not return a list.

Some representations may have more specialised facilities enabling even more information - for example, Futhark.IR.Mem exposes functionality for also obtaining information about the storage location of results.

Synopsis

Documentation

expExtType :: (HasScope lore m, TypedOp (Op lore)) => Exp lore -> m [ExtType] Source #

The type of an expression.

expExtTypeSize :: (Decorations lore, TypedOp (Op lore)) => Exp lore -> Int Source #

The number of values returned by an expression.

subExpType :: HasScope t m => SubExp -> m Type Source #

The type of a subexpression.

primOpType :: HasScope lore m => BasicOp -> m [Type] Source #

The type of a primitive operation.

mapType :: SubExp -> Lambda lore -> [Type] Source #

mapType f arrts wraps each element in the return type of f in an array with size equal to the outermost dimension of the first element of arrts.

Return type

Type environment

Extensibility

class TypedOp op where Source #

Any operation must define an instance of this class, which describes the type of the operation (at the value level).

Methods

opType :: HasScope t m => op -> m [ExtType] Source #

Instances

Instances details
TypedOp () Source # 
Instance details

Defined in Futhark.IR.Prop.TypeOf

Methods

opType :: HasScope t m => () -> m [ExtType] Source #

TypedOp SizeOp Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

Methods

opType :: HasScope t m => SizeOp -> m [ExtType] Source #

TypedOp (SOAC lore) Source # 
Instance details

Defined in Futhark.IR.SOACS.SOAC

Methods

opType :: HasScope t m => SOAC lore -> m [ExtType] Source #

TypedOp inner => TypedOp (MemOp inner) Source # 
Instance details

Defined in Futhark.IR.Mem

Methods

opType :: HasScope t m => MemOp inner -> m [ExtType] Source #

TypedOp (SegOp lvl lore) Source # 
Instance details

Defined in Futhark.IR.SegOp

Methods

opType :: HasScope t m => SegOp lvl lore -> m [ExtType] Source #

TypedOp op => TypedOp (MCOp lore op) Source # 
Instance details

Defined in Futhark.IR.MC.Op

Methods

opType :: HasScope t m => MCOp lore op -> m [ExtType] Source #

TypedOp op => TypedOp (HostOp lore op) Source # 
Instance details

Defined in Futhark.IR.Kernels.Kernel

Methods

opType :: HasScope t m => HostOp lore op -> m [ExtType] Source #