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

Safe Haskell | None
Language | GHC2021

Futhark.IR.RetType

Description

This module exports a type class covering representations of function return types.

Synopsis

- class (Show rt, Eq rt, Ord rt, ExtTyped rt) => IsBodyType rt where
  - primBodyType :: PrimType -> rt
- class (Show rt, Eq rt, Ord rt, ExtTyped rt, DeclExtTyped rt) => IsRetType rt where
  - primRetType :: PrimType -> rt
  - applyRetType :: Typed dec => [rt] -> [Param dec] -> [(SubExp, Type)] -> Maybe [rt]
- expectedTypes :: Typed t => [VName] -> [t] -> [SubExp] -> [Type]

# Documentation

class (Show rt, Eq rt, Ord rt, ExtTyped rt) => IsBodyType rt where Source #

A type representing the return type of a body. It should contain at least the information contained in a list of `ExtType`s, but may have more, notably an existential context.

Methods

primBodyType :: PrimType -> rt Source #

Construct a body type from a primitive type.

#### Instances

Instances details

IsBodyType BodyReturns Source # |
Instance details Defined in Futhark.IR.Mem Methods primBodyType :: PrimType -> BodyReturns Source #
IsBodyType ExtType Source # |
Instance details Defined in Futhark.IR.RetType Methods primBodyType :: PrimType -> ExtType Source #

class (Show rt, Eq rt, Ord rt, ExtTyped rt, DeclExtTyped rt) => IsRetType rt where Source #

A type representing the return type of a function. In practice, a list of these will be used. It should contain at least the information contained in an `ExtType`, but may have more, notably an existential context.

Methods

primRetType :: PrimType -> rt Source #

Contruct a return type from a primitive type.

applyRetType :: Typed dec => [rt] -> [Param dec] -> [(SubExp, Type)] -> Maybe [rt] Source #

Given a function return type, the parameters of the function, and the arguments for a concrete call, return the instantiated return type for the concrete call, if valid.

#### Instances

Instances details

IsRetType FunReturns Source # |
Instance details Defined in Futhark.IR.Mem Methods primRetType :: PrimType -> FunReturns Source # applyRetType :: Typed dec => [FunReturns] -> [Param dec] -> [(SubExp, Type)] -> Maybe [FunReturns] Source #
IsRetType DeclExtType Source # |
Instance details Defined in Futhark.IR.RetType Methods primRetType :: PrimType -> DeclExtType Source # applyRetType :: Typed dec => [DeclExtType] -> [Param dec] -> [(SubExp, Type)] -> Maybe [DeclExtType] Source #

expectedTypes :: Typed t => [VName] -> [t] -> [SubExp] -> [Type] Source #

Given shape parameter names and types, produce the types of arguments accepted.