futhark-0.25.27: An optimising compiler for a functional, array-oriented language.

Safe Haskell | Safe-Inferred
Language | GHC2021

Futhark.IR.Prop.TypeOf

Contents

- Return type
- Type environment
- Extensibility

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

- expExtType :: (HasScope rep m, TypedOp (OpC rep)) => Exp rep -> m [ExtType]
- subExpType :: HasScope t m => SubExp -> m Type
- subExpResType :: HasScope t m => SubExpRes -> m Type
- basicOpType :: HasScope rep m => BasicOp -> m [Type]
- mapType :: SubExp -> Lambda rep -> [Type]
- module Futhark.IR.RetType
- module Futhark.IR.Prop.Scope
- class TypedOp op where
  - opType :: HasScope rep m => op rep -> m [ExtType]

# Documentation

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

The type of an expression.

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

The type of a subexpression.

subExpResType :: HasScope t m => SubExpRes -> m Type Source #

Type type of a `SubExpRes` - not that this might refer to names bound in the body containing the result.

basicOpType :: HasScope rep m => BasicOp -> m [Type] Source #

The type of a primitive operation.

mapType :: SubExp -> Lambda rep -> [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

module Futhark.IR.RetType

# Type environment

module Futhark.IR.Prop.Scope

# 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 rep m => op rep -> m [ExtType] Source #

#### Instances

Instances details

TypedOp SOAC Source # |
Instance details Defined in Futhark.IR.SOACS.SOAC Methods opType :: HasScope rep m => SOAC rep -> m [ExtType] Source #
TypedOp op => TypedOp (HostOp op) Source # |
Instance details Defined in Futhark.IR.GPU.Op Methods opType :: HasScope rep m => HostOp op rep -> m [ExtType] Source #
TypedOp op => TypedOp (MCOp op) Source # |
Instance details Defined in Futhark.IR.MC.Op Methods opType :: HasScope rep m => MCOp op rep -> m [ExtType] Source #
TypedOp inner => TypedOp (MemOp inner) Source # |
Instance details Defined in Futhark.IR.Mem Methods opType :: HasScope rep m => MemOp inner rep -> m [ExtType] Source #
TypedOp (NoOp :: Type -> Type) Source # |
Instance details Defined in Futhark.IR.Prop.TypeOf Methods opType :: HasScope rep m => NoOp rep -> m [ExtType] Source #
TypedOp (SegOp lvl) Source # |
Instance details Defined in Futhark.IR.SegOp Methods opType :: HasScope rep m => SegOp lvl rep -> m [ExtType] Source #