Safe Haskell | None |
---|---|
Language | Haskell2010 |
The most primitive ("core") aspects of the AST. Split out of Futhark.Representation.AST.Syntax in order for Futhark.Representation.AST.Annotations to use these definitions. This module is re-exported from Futhark.Representation.AST.Syntax and there should be no reason to include it explicitly.
Synopsis
- module Language.Futhark.Core
- module Futhark.Representation.Primitive
- data Uniqueness
- data NoUniqueness = NoUniqueness
- newtype ShapeBase d = Shape {
- shapeDims :: [d]
- type Shape = ShapeBase SubExp
- data Ext a
- type ExtSize = Ext SubExp
- type ExtShape = ShapeBase ExtSize
- newtype Rank = Rank Int
- class (Monoid a, Eq a, Ord a) => ArrayShape a where
- data Space
- type SpaceId = String
- data TypeBase shape u
- type Type = TypeBase Shape NoUniqueness
- type ExtType = TypeBase ExtShape NoUniqueness
- type DeclType = TypeBase Shape Uniqueness
- type DeclExtType = TypeBase ExtShape Uniqueness
- data Diet
- newtype ErrorMsg a = ErrorMsg [ErrorMsgPart a]
- data ErrorMsgPart a
- = ErrorString String
- | ErrorInt32 a
- data PrimValue
- = IntValue !IntValue
- | FloatValue !FloatValue
- | BoolValue !Bool
- | Checked
- data Ident = Ident {}
- newtype Certificates = Certificates {
- unCertificates :: [VName]
- data SubExp
- data ParamT attr = Param {}
- type Param = ParamT
- data DimIndex d
- type Slice d = [DimIndex d]
- dimFix :: DimIndex d -> Maybe d
- sliceIndices :: Slice d -> Maybe [d]
- sliceDims :: Slice d -> [d]
- unitSlice :: Num d => d -> d -> DimIndex d
- fixSlice :: Num d => Slice d -> [d] -> [d]
- data PatElemT attr = PatElem {
- patElemName :: VName
- patElemAttr :: attr
- type Names = Set VName
Documentation
module Language.Futhark.Core
Types
data Uniqueness Source #
The uniqueness attribute of a type. This essentially indicates
whether or not in-place modifications are acceptable. With respect
to ordering, Unique
is greater than Nonunique
.
Instances
data NoUniqueness Source #
A fancier name for '()' - encodes no uniqueness information.
Instances
The size of an array type as a list of its dimension sizes, with the type of sizes being parametric.
Instances
type Shape = ShapeBase SubExp Source #
The size of an array as a list of subexpressions. If a variable, that variable must be in scope where this array is used.
Something that may be existential.
Instances
type ExtShape = ShapeBase ExtSize Source #
Like ShapeBase
but some of its elements may be bound in a local
environment instead. These are denoted with integral indices.
The size of an array type as merely the number of dimensions, with no further information.
class (Monoid a, Eq a, Ord a) => ArrayShape a where Source #
A class encompassing types containing array shape information.
shapeRank :: a -> Int Source #
Return the rank of an array with the given size.
stripDims :: Int -> a -> a Source #
stripDims n shape
strips the outer n
dimensions from
shape
.
subShapeOf :: a -> a -> Bool Source #
Check whether one shape if a subset of another shape.
Instances
ArrayShape Rank Source # | |
ArrayShape (ShapeBase SubExp) Source # | |
ArrayShape (ShapeBase ExtSize) Source # | |
The memory space of a block. If DefaultSpace
, this is the "default"
space, whatever that is. The exact meaning of the SpaceID
depends on the backend used. In GPU kernels, for example, this is
used to distinguish between constant, global and shared memory
spaces. In GPU-enabled host code, it is used to distinguish
between host memory (DefaultSpace
) and GPU space.
data TypeBase shape u Source #
An Futhark type is either an array or an element type. When
comparing types for equality with ==
, shapes must match.
Instances
type Type = TypeBase Shape NoUniqueness Source #
A type with shape information, used for describing the type of variables.
type ExtType = TypeBase ExtShape NoUniqueness Source #
A type with existentially quantified shapes - used as part of function (and function-like) return types. Generally only makes sense when used in a list.
type DeclType = TypeBase Shape Uniqueness Source #
A type with shape and uniqueness information, used declaring return- and parameters types.
type DeclExtType = TypeBase ExtShape Uniqueness Source #
An ExtType
with uniqueness information, used for function
return types.
Information about which parts of a value/type are consumed. For
example, we might say that a function taking three arguments of
types ([int], *[int], [int])
has diet [Observe, Consume,
Observe]
.
An error message is a list of error parts, which are concatenated to form the final message.
ErrorMsg [ErrorMsgPart a] |
Instances
Functor ErrorMsg Source # | |
Foldable ErrorMsg Source # | |
Defined in Futhark.Representation.AST.Syntax.Core fold :: Monoid m => ErrorMsg m -> m # foldMap :: Monoid m => (a -> m) -> ErrorMsg a -> m # foldr :: (a -> b -> b) -> b -> ErrorMsg a -> b # foldr' :: (a -> b -> b) -> b -> ErrorMsg a -> b # foldl :: (b -> a -> b) -> b -> ErrorMsg a -> b # foldl' :: (b -> a -> b) -> b -> ErrorMsg a -> b # foldr1 :: (a -> a -> a) -> ErrorMsg a -> a # foldl1 :: (a -> a -> a) -> ErrorMsg a -> a # elem :: Eq a => a -> ErrorMsg a -> Bool # maximum :: Ord a => ErrorMsg a -> a # minimum :: Ord a => ErrorMsg a -> a # | |
Traversable ErrorMsg Source # | |
Defined in Futhark.Representation.AST.Syntax.Core | |
Eq a => Eq (ErrorMsg a) Source # | |
Ord a => Ord (ErrorMsg a) Source # | |
Defined in Futhark.Representation.AST.Syntax.Core | |
Show a => Show (ErrorMsg a) Source # | |
IsString (ErrorMsg a) Source # | |
Defined in Futhark.Representation.AST.Syntax.Core fromString :: String -> ErrorMsg a # | |
Pretty a => Pretty (ErrorMsg a) Source # | |
data ErrorMsgPart a Source #
A part of an error message.
ErrorString String | A literal string. |
ErrorInt32 a | A run-time integer value. |
Instances
Values
Non-array values.
IntValue !IntValue | |
FloatValue !FloatValue | |
BoolValue !Bool | |
Checked | The only value of type |
Abstract syntax tree
An identifier consists of its name and the type of the value bound to the identifier.
newtype Certificates Source #
A list of names used for certificates in some expressions.
Instances
A subexpression is either a scalar constant or a variable. One important property is that evaluation of a subexpression is guaranteed to complete in constant time.
Instances
A function parameter.
Instances
How to index a single dimension of an array.
Instances
An element of a pattern - consisting of a name (essentially a pair of the name and type) and an addditional parametric attribute. This attribute is what is expected to contain the type of the resulting variable.
PatElem | |
|