Safe Haskell | None |
---|---|
Language | Haskell2010 |
This is an ever-changing syntax representation for Futhark. Some
types, such as Exp
, are parametrised by type and name
representation. See the https://futhark.readthedocs.org
for a
language reference, or this module may be a little hard to
understand.
Synopsis
- module Language.Futhark.Core
- data Uniqueness
- data IntType
- data FloatType
- data PrimType
- class Eq dim => ArrayDim dim where
- data DimDecl vn
- newtype ShapeDecl dim = ShapeDecl {
- shapeDims :: [dim]
- shapeRank :: ShapeDecl dim -> Int
- stripDims :: Int -> ShapeDecl dim -> Maybe (ShapeDecl dim)
- unifyShapes :: ArrayDim dim => ShapeDecl dim -> ShapeDecl dim -> Maybe (ShapeDecl dim)
- data TypeName = TypeName {}
- typeNameFromQualName :: QualName VName -> TypeName
- qualNameFromTypeName :: TypeName -> QualName VName
- data TypeBase dim as
- = Scalar (ScalarTypeBase dim as)
- | Array as Uniqueness (ScalarTypeBase dim ()) (ShapeDecl dim)
- data TypeArg dim
- = TypeArgDim dim SrcLoc
- | TypeArgType (TypeBase dim ()) SrcLoc
- data TypeExp vn
- = TEVar (QualName vn) SrcLoc
- | TETuple [TypeExp vn] SrcLoc
- | TERecord [(Name, TypeExp vn)] SrcLoc
- | TEArray (TypeExp vn) (DimDecl vn) SrcLoc
- | TEUnique (TypeExp vn) SrcLoc
- | TEApply (TypeExp vn) (TypeArgExp vn) SrcLoc
- | TEArrow (Maybe vn) (TypeExp vn) (TypeExp vn) SrcLoc
- | TESum [(Name, [TypeExp vn])] SrcLoc
- data TypeArgExp vn
- = TypeArgExpDim (DimDecl vn) SrcLoc
- | TypeArgExpType (TypeExp vn)
- data PName
- data ScalarTypeBase dim as
- type PatternType = TypeBase (DimDecl VName) Aliasing
- type StructType = TypeBase (DimDecl VName) ()
- data Diet
- data TypeDeclBase f vn = TypeDecl {
- declaredType :: TypeExp vn
- expandedType :: f StructType
- data IntValue
- = Int8Value !Int8
- | Int16Value !Int16
- | Int32Value !Int32
- | Int64Value !Int64
- data FloatValue
- data PrimValue
- class IsPrimValue v where
- data Value
- data BinOp
- data IdentBase f vn = Ident {
- identName :: vn
- identType :: f PatternType
- identSrcLoc :: SrcLoc
- data Inclusiveness a
- = DownToExclusive a
- | ToInclusive a
- | UpToExclusive a
- data DimIndexBase f vn
- data ExpBase f vn
- = Literal PrimValue SrcLoc
- | IntLit Integer (f PatternType) SrcLoc
- | FloatLit Double (f PatternType) SrcLoc
- | Parens (ExpBase f vn) SrcLoc
- | QualParens (QualName vn) (ExpBase f vn) SrcLoc
- | TupLit [ExpBase f vn] SrcLoc
- | RecordLit [FieldBase f vn] SrcLoc
- | ArrayLit [ExpBase f vn] (f PatternType) SrcLoc
- | Range (ExpBase f vn) (Maybe (ExpBase f vn)) (Inclusiveness (ExpBase f vn)) (f PatternType) SrcLoc
- | Var (QualName vn) (f PatternType) SrcLoc
- | Ascript (ExpBase f vn) (TypeDeclBase f vn) (f PatternType) SrcLoc
- | LetPat (PatternBase f vn) (ExpBase f vn) (ExpBase f vn) (f PatternType) SrcLoc
- | LetFun vn ([TypeParamBase vn], [PatternBase f vn], Maybe (TypeExp vn), f StructType, ExpBase f vn) (ExpBase f vn) SrcLoc
- | If (ExpBase f vn) (ExpBase f vn) (ExpBase f vn) (f PatternType) SrcLoc
- | Apply (ExpBase f vn) (ExpBase f vn) (f Diet) (f PatternType) SrcLoc
- | Negate (ExpBase f vn) SrcLoc
- | Lambda [PatternBase f vn] (ExpBase f vn) (Maybe (TypeExp vn)) (f (Aliasing, StructType)) SrcLoc
- | OpSection (QualName vn) (f PatternType) SrcLoc
- | OpSectionLeft (QualName vn) (f PatternType) (ExpBase f vn) (f StructType, f StructType) (f PatternType) SrcLoc
- | OpSectionRight (QualName vn) (f PatternType) (ExpBase f vn) (f StructType, f StructType) (f PatternType) SrcLoc
- | ProjectSection [Name] (f PatternType) SrcLoc
- | IndexSection [DimIndexBase f vn] (f PatternType) SrcLoc
- | DoLoop (PatternBase f vn) (ExpBase f vn) (LoopFormBase f vn) (ExpBase f vn) SrcLoc
- | BinOp (QualName vn) (f PatternType) (ExpBase f vn, f StructType) (ExpBase f vn, f StructType) (f PatternType) SrcLoc
- | Project Name (ExpBase f vn) (f PatternType) SrcLoc
- | LetWith (IdentBase f vn) (IdentBase f vn) [DimIndexBase f vn] (ExpBase f vn) (ExpBase f vn) (f PatternType) SrcLoc
- | Index (ExpBase f vn) [DimIndexBase f vn] (f PatternType) SrcLoc
- | Update (ExpBase f vn) [DimIndexBase f vn] (ExpBase f vn) SrcLoc
- | RecordUpdate (ExpBase f vn) [Name] (ExpBase f vn) (f PatternType) SrcLoc
- | Unsafe (ExpBase f vn) SrcLoc
- | Assert (ExpBase f vn) (ExpBase f vn) (f String) SrcLoc
- | Constr Name [ExpBase f vn] (f PatternType) SrcLoc
- | Match (ExpBase f vn) (NonEmpty (CaseBase f vn)) (f PatternType) SrcLoc
- data FieldBase f vn
- = RecordFieldExplicit Name (ExpBase f vn) SrcLoc
- | RecordFieldImplicit vn (f PatternType) SrcLoc
- data CaseBase f vn = CasePat (PatternBase f vn) (ExpBase f vn) SrcLoc
- data LoopFormBase f vn
- data PatternBase f vn
- = TuplePattern [PatternBase f vn] SrcLoc
- | RecordPattern [(Name, PatternBase f vn)] SrcLoc
- | PatternParens (PatternBase f vn) SrcLoc
- | Id vn (f PatternType) SrcLoc
- | Wildcard (f PatternType) SrcLoc
- | PatternAscription (PatternBase f vn) (TypeDeclBase f vn) SrcLoc
- | PatternLit (ExpBase f vn) (f PatternType) SrcLoc
- | PatternConstr Name (f PatternType) [PatternBase f vn] SrcLoc
- data SpecBase f vn
- = ValSpec {
- specName :: vn
- specTypeParams :: [TypeParamBase vn]
- specType :: TypeDeclBase f vn
- specDoc :: Maybe DocComment
- specLocation :: SrcLoc
- | TypeAbbrSpec (TypeBindBase f vn)
- | TypeSpec Liftedness vn [TypeParamBase vn] (Maybe DocComment) SrcLoc
- | ModSpec vn (SigExpBase f vn) (Maybe DocComment) SrcLoc
- | IncludeSpec (SigExpBase f vn) SrcLoc
- = ValSpec {
- data SigExpBase f vn
- = SigVar (QualName vn) SrcLoc
- | SigParens (SigExpBase f vn) SrcLoc
- | SigSpecs [SpecBase f vn] SrcLoc
- | SigWith (SigExpBase f vn) (TypeRefBase f vn) SrcLoc
- | SigArrow (Maybe vn) (SigExpBase f vn) (SigExpBase f vn) SrcLoc
- data TypeRefBase f vn = TypeRef (QualName vn) [TypeParamBase vn] (TypeDeclBase f vn) SrcLoc
- data SigBindBase f vn = SigBind {
- sigName :: vn
- sigExp :: SigExpBase f vn
- sigDoc :: Maybe DocComment
- sigLoc :: SrcLoc
- data ModExpBase f vn
- = ModVar (QualName vn) SrcLoc
- | ModParens (ModExpBase f vn) SrcLoc
- | ModImport FilePath (f FilePath) SrcLoc
- | ModDecs [DecBase f vn] SrcLoc
- | ModApply (ModExpBase f vn) (ModExpBase f vn) (f (Map VName VName)) (f (Map VName VName)) SrcLoc
- | ModAscript (ModExpBase f vn) (SigExpBase f vn) (f (Map VName VName)) SrcLoc
- | ModLambda (ModParamBase f vn) (Maybe (SigExpBase f vn, f (Map VName VName))) (ModExpBase f vn) SrcLoc
- data ModBindBase f vn = ModBind {
- modName :: vn
- modParams :: [ModParamBase f vn]
- modSignature :: Maybe (SigExpBase f vn, f (Map VName VName))
- modExp :: ModExpBase f vn
- modDoc :: Maybe DocComment
- modLocation :: SrcLoc
- data ModParamBase f vn = ModParam {
- modParamName :: vn
- modParamType :: SigExpBase f vn
- modParamAbs :: f [VName]
- modParamLocation :: SrcLoc
- data DocComment = DocComment String SrcLoc
- data ValBindBase f vn = ValBind {
- valBindEntryPoint :: Maybe (f StructType)
- valBindName :: vn
- valBindRetDecl :: Maybe (TypeExp vn)
- valBindRetType :: f StructType
- valBindTypeParams :: [TypeParamBase vn]
- valBindParams :: [PatternBase f vn]
- valBindBody :: ExpBase f vn
- valBindDoc :: Maybe DocComment
- valBindLocation :: SrcLoc
- data Liftedness
- data TypeBindBase f vn = TypeBind {
- typeAlias :: vn
- typeParams :: [TypeParamBase vn]
- typeExp :: TypeDeclBase f vn
- typeDoc :: Maybe DocComment
- typeBindLocation :: SrcLoc
- data TypeParamBase vn
- = TypeParamDim vn SrcLoc
- | TypeParamType Liftedness vn SrcLoc
- typeParamName :: TypeParamBase vn -> vn
- data ProgBase f vn = Prog {
- progDoc :: Maybe DocComment
- progDecs :: [DecBase f vn]
- data DecBase f vn
- = ValDec (ValBindBase f vn)
- | TypeDec (TypeBindBase f vn)
- | SigDec (SigBindBase f vn)
- | ModDec (ModBindBase f vn)
- | OpenDec (ModExpBase f vn) SrcLoc
- | LocalDec (DecBase f vn) SrcLoc
- | ImportDec FilePath (f FilePath) SrcLoc
- class (Show vn, Show (f VName), Show (f Diet), Show (f String), Show (f [VName]), Show (f PatternType), Show (f Int), Show (f StructType), Show (f (Aliasing, StructType)), Show (f (Map VName VName)), Show (f Uniqueness)) => Showable f vn
- data NoInfo a = NoInfo
- newtype Info a = Info {
- unInfo :: a
- data Alias
- type Aliasing = Set Alias
- data QualName vn = QualName {}
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
An integer type, ordered by size. Note that signedness is not a property of the type, but a property of the operations performed on values of these types.
Instances
Bounded IntType Source # | |
Enum IntType Source # | |
Eq IntType Source # | |
Ord IntType Source # | |
Defined in Futhark.Representation.Primitive | |
Show IntType Source # | |
Pretty IntType Source # | |
A floating point type.
Instances
Bounded FloatType Source # | |
Enum FloatType Source # | |
Defined in Futhark.Representation.Primitive succ :: FloatType -> FloatType # pred :: FloatType -> FloatType # fromEnum :: FloatType -> Int # enumFrom :: FloatType -> [FloatType] # enumFromThen :: FloatType -> FloatType -> [FloatType] # enumFromTo :: FloatType -> FloatType -> [FloatType] # enumFromThenTo :: FloatType -> FloatType -> FloatType -> [FloatType] # | |
Eq FloatType Source # | |
Ord FloatType Source # | |
Defined in Futhark.Representation.Primitive | |
Show FloatType Source # | |
Pretty FloatType Source # | |
Low-level primitive types.
Declaration of a dimension size.
NamedDim (QualName vn) | The size of the dimension is this name, which must be in scope. In a return type, this will give rise to an assertion. |
ConstDim Int | The size is a constant. |
AnyDim | No dimension declaration. |
Instances
newtype ShapeDecl dim Source #
The size of an array type is a list of its dimension sizes. If
Nothing
, that dimension is of a (statically) unknown size.
Instances
stripDims :: Int -> ShapeDecl dim -> Maybe (ShapeDecl dim) Source #
stripDims n shape
strips the outer n
dimensions from
shape
, returning Nothing
if this would result in zero or
fewer dimensions.
unifyShapes :: ArrayDim dim => ShapeDecl dim -> ShapeDecl dim -> Maybe (ShapeDecl dim) Source #
unifyShapes x y
combines x
and y
to contain their maximum
common information, and fails if they conflict.
A type name consists of qualifiers (for error messages) and a
VName
(for equality checking).
An expanded Futhark type is either an array, or something that can be an element of an array. When comparing types for equality, function parameter names are ignored. This representation permits some malformed types (arrays of functions), but importantly rules out arrays-of-arrays.
Scalar (ScalarTypeBase dim as) | |
Array as Uniqueness (ScalarTypeBase dim ()) (ShapeDecl dim) |
Instances
TypeArgDim dim SrcLoc | |
TypeArgType (TypeBase dim ()) SrcLoc |
Instances
Functor TypeArg Source # | |
Foldable TypeArg Source # | |
Defined in Language.Futhark.Syntax fold :: Monoid m => TypeArg m -> m # foldMap :: Monoid m => (a -> m) -> TypeArg a -> m # foldr :: (a -> b -> b) -> b -> TypeArg a -> b # foldr' :: (a -> b -> b) -> b -> TypeArg a -> b # foldl :: (b -> a -> b) -> b -> TypeArg a -> b # foldl' :: (b -> a -> b) -> b -> TypeArg a -> b # foldr1 :: (a -> a -> a) -> TypeArg a -> a # foldl1 :: (a -> a -> a) -> TypeArg a -> a # elem :: Eq a => a -> TypeArg a -> Bool # maximum :: Ord a => TypeArg a -> a # minimum :: Ord a => TypeArg a -> a # | |
Traversable TypeArg Source # | |
Eq dim => Eq (TypeArg dim) Source # | |
Ord dim => Ord (TypeArg dim) Source # | |
Defined in Language.Futhark.Syntax | |
Show dim => Show (TypeArg dim) Source # | |
Pretty (ShapeDecl dim) => Pretty (TypeArg dim) Source # | |
An unstructured type with type variables and possibly shape declarations - this is what the user types in the source program.
TEVar (QualName vn) SrcLoc | |
TETuple [TypeExp vn] SrcLoc | |
TERecord [(Name, TypeExp vn)] SrcLoc | |
TEArray (TypeExp vn) (DimDecl vn) SrcLoc | |
TEUnique (TypeExp vn) SrcLoc | |
TEApply (TypeExp vn) (TypeArgExp vn) SrcLoc | |
TEArrow (Maybe vn) (TypeExp vn) (TypeExp vn) SrcLoc | |
TESum [(Name, [TypeExp vn])] SrcLoc |
data TypeArgExp vn Source #
TypeArgExpDim (DimDecl vn) SrcLoc | |
TypeArgExpType (TypeExp vn) |
Instances
The name (if any) of a function parameter. The Eq
and Ord
instances always compare values of this type equal.
data ScalarTypeBase dim as Source #
Types that can be elements of arrays. This representation does allow arrays of records of functions, which is nonsensical, but it convolutes the code too much if we try to statically rule it out.
Prim PrimType | |
TypeVar as Uniqueness TypeName [TypeArg dim] | |
Record (Map Name (TypeBase dim as)) | |
Sum (Map Name [TypeBase dim as]) | |
Arrow as PName (TypeBase dim as) (TypeBase dim as) | The aliasing corresponds to the lexical closure of the function. |
Instances
type PatternType = TypeBase (DimDecl VName) Aliasing Source #
A type with aliasing information and shape annotations, used for describing the type patterns and expressions.
type StructType = TypeBase (DimDecl VName) () Source #
A "structural" type with shape annotations and no aliasing information, used for declarations.
Information about which parts of a value/type are consumed.
RecordDiet (Map Name Diet) | Consumes these fields in the record. |
FuncDiet Diet Diet | A function that consumes its argument(s) like this.
The final |
Consume | Consumes this value. |
Observe | Only observes value in this position, does not consume. |
data TypeDeclBase f vn Source #
A declaration of the type of something.
TypeDecl | |
|
Instances
Showable f vn => Show (TypeDeclBase f vn) Source # | |
Defined in Language.Futhark.Syntax showsPrec :: Int -> TypeDeclBase f vn -> ShowS # show :: TypeDeclBase f vn -> String # showList :: [TypeDeclBase f vn] -> ShowS # | |
(Eq vn, IsName vn, Annot f) => Pretty (TypeDeclBase f vn) Source # | |
Defined in Language.Futhark.Pretty ppr :: TypeDeclBase f vn -> Doc # pprPrec :: Int -> TypeDeclBase f vn -> Doc # pprList :: [TypeDeclBase f vn] -> Doc # | |
Located (TypeDeclBase f vn) Source # | |
Defined in Language.Futhark.Syntax locOf :: TypeDeclBase f vn -> Loc # locOfList :: [TypeDeclBase f vn] -> Loc # | |
ASTMappable (TypeDeclBase Info VName) Source # | |
Defined in Language.Futhark.Traversals |
Values
An integer value.
data FloatValue Source #
A floating-point value.
Instances
Non-array values.
class IsPrimValue v where Source #
Instances
Simple Futhark values. Values are fully evaluated and their type is always unambiguous.
PrimValue !PrimValue | |
ArrayValue !(Array Int Value) (TypeBase () ()) | It is assumed that the array is 0-indexed. The type is the full type. |
Abstract syntax tree
Default binary operators.
Backtick | A pseudo-operator standing in for any normal identifier used as an operator (they all have the same fixity). Binary Ops for Numbers |
Plus | |
Minus | |
Pow | |
Times | |
Divide | |
Mod | |
Quot | |
Rem | |
ShiftR | |
ShiftL | |
Band | |
Xor | |
Bor | |
LogAnd | |
LogOr | |
Equal | |
NotEqual | |
Less | |
Leq | |
Greater | |
Geq | |
PipeRight | |> |
PipeLeft |
|
An identifier consists of its name and the type of the value bound to the identifier.
Ident | |
|
Instances
Eq vn => Eq (IdentBase ty vn) Source # | |
Ord vn => Ord (IdentBase ty vn) Source # | |
Defined in Language.Futhark.Syntax compare :: IdentBase ty vn -> IdentBase ty vn -> Ordering # (<) :: IdentBase ty vn -> IdentBase ty vn -> Bool # (<=) :: IdentBase ty vn -> IdentBase ty vn -> Bool # (>) :: IdentBase ty vn -> IdentBase ty vn -> Bool # (>=) :: IdentBase ty vn -> IdentBase ty vn -> Bool # max :: IdentBase ty vn -> IdentBase ty vn -> IdentBase ty vn # min :: IdentBase ty vn -> IdentBase ty vn -> IdentBase ty vn # | |
Showable f vn => Show (IdentBase f vn) Source # | |
IsName vn => Pretty (IdentBase f vn) Source # | |
Located (IdentBase ty vn) Source # | |
ASTMappable (IdentBase Info VName) Source # | |
data Inclusiveness a Source #
Whether a bound for an end-point of a DimSlice
or a range
literal is inclusive or exclusive.
DownToExclusive a | |
ToInclusive a | May be "down to" if step is negative. |
UpToExclusive a |
Instances
data DimIndexBase f vn Source #
An indexing of a single dimension.
Instances
Showable f vn => Show (DimIndexBase f vn) Source # | |
Defined in Language.Futhark.Syntax showsPrec :: Int -> DimIndexBase f vn -> ShowS # show :: DimIndexBase f vn -> String # showList :: [DimIndexBase f vn] -> ShowS # | |
(Eq vn, IsName vn, Annot f) => Pretty (DimIndexBase f vn) Source # | |
Defined in Language.Futhark.Pretty ppr :: DimIndexBase f vn -> Doc # pprPrec :: Int -> DimIndexBase f vn -> Doc # pprList :: [DimIndexBase f vn] -> Doc # | |
ASTMappable (DimIndexBase Info VName) Source # | |
Defined in Language.Futhark.Traversals |
The Futhark expression language.
In a value of type Exp f vn
, annotations are wrapped in the
functor f
, and all names are of type vn
.
This allows us to encode whether or not the expression has been
type-checked in the Haskell type of the expression. Specifically,
the parser will produce expressions of type Exp
,
and the type checker will convert these to NoInfo
Name
Exp
, in
which type information is always present and all names are unique.Info
VName
Literal PrimValue SrcLoc | |
IntLit Integer (f PatternType) SrcLoc | A polymorphic integral literal. |
FloatLit Double (f PatternType) SrcLoc | A polymorphic decimal literal. |
Parens (ExpBase f vn) SrcLoc | A parenthesized expression. |
QualParens (QualName vn) (ExpBase f vn) SrcLoc | |
TupLit [ExpBase f vn] SrcLoc | Tuple literals, e.g., |
RecordLit [FieldBase f vn] SrcLoc | Record literals, e.g. |
ArrayLit [ExpBase f vn] (f PatternType) SrcLoc | Array literals, e.g., |
Range (ExpBase f vn) (Maybe (ExpBase f vn)) (Inclusiveness (ExpBase f vn)) (f PatternType) SrcLoc | |
Var (QualName vn) (f PatternType) SrcLoc | |
Ascript (ExpBase f vn) (TypeDeclBase f vn) (f PatternType) SrcLoc | Type ascription: |
LetPat (PatternBase f vn) (ExpBase f vn) (ExpBase f vn) (f PatternType) SrcLoc | |
LetFun vn ([TypeParamBase vn], [PatternBase f vn], Maybe (TypeExp vn), f StructType, ExpBase f vn) (ExpBase f vn) SrcLoc | |
If (ExpBase f vn) (ExpBase f vn) (ExpBase f vn) (f PatternType) SrcLoc | |
Apply (ExpBase f vn) (ExpBase f vn) (f Diet) (f PatternType) SrcLoc | |
Negate (ExpBase f vn) SrcLoc | Numeric negation (ugly special case; Haskell did it first). |
Lambda [PatternBase f vn] (ExpBase f vn) (Maybe (TypeExp vn)) (f (Aliasing, StructType)) SrcLoc | |
OpSection (QualName vn) (f PatternType) SrcLoc |
|
OpSectionLeft (QualName vn) (f PatternType) (ExpBase f vn) (f StructType, f StructType) (f PatternType) SrcLoc |
|
OpSectionRight (QualName vn) (f PatternType) (ExpBase f vn) (f StructType, f StructType) (f PatternType) SrcLoc |
|
ProjectSection [Name] (f PatternType) SrcLoc | Field projection as a section: |
IndexSection [DimIndexBase f vn] (f PatternType) SrcLoc | Array indexing as a section: |
DoLoop (PatternBase f vn) (ExpBase f vn) (LoopFormBase f vn) (ExpBase f vn) SrcLoc | |
BinOp (QualName vn) (f PatternType) (ExpBase f vn, f StructType) (ExpBase f vn, f StructType) (f PatternType) SrcLoc | |
Project Name (ExpBase f vn) (f PatternType) SrcLoc | |
LetWith (IdentBase f vn) (IdentBase f vn) [DimIndexBase f vn] (ExpBase f vn) (ExpBase f vn) (f PatternType) SrcLoc | |
Index (ExpBase f vn) [DimIndexBase f vn] (f PatternType) SrcLoc | |
Update (ExpBase f vn) [DimIndexBase f vn] (ExpBase f vn) SrcLoc | |
RecordUpdate (ExpBase f vn) [Name] (ExpBase f vn) (f PatternType) SrcLoc | |
Unsafe (ExpBase f vn) SrcLoc | Explore the Danger Zone and elide safety checks on array operations and other assertions during execution of this expression. Make really sure the code is correct. |
Assert (ExpBase f vn) (ExpBase f vn) (f String) SrcLoc | Fail if the first expression does not return true, and return the value of the second expression if it does. |
Constr Name [ExpBase f vn] (f PatternType) SrcLoc | An n-ary value constructor. |
Match (ExpBase f vn) (NonEmpty (CaseBase f vn)) (f PatternType) SrcLoc | A match expression. |
An entry in a record literal.
RecordFieldExplicit Name (ExpBase f vn) SrcLoc | |
RecordFieldImplicit vn (f PatternType) SrcLoc |
A case in a match expression.
CasePat (PatternBase f vn) (ExpBase f vn) SrcLoc |
data LoopFormBase f vn Source #
Whether the loop is a for
-loop or a while
-loop.
Instances
Showable f vn => Show (LoopFormBase f vn) Source # | |
Defined in Language.Futhark.Syntax showsPrec :: Int -> LoopFormBase f vn -> ShowS # show :: LoopFormBase f vn -> String # showList :: [LoopFormBase f vn] -> ShowS # | |
(Eq vn, IsName vn, Annot f) => Pretty (LoopFormBase f vn) Source # | |
Defined in Language.Futhark.Pretty ppr :: LoopFormBase f vn -> Doc # pprPrec :: Int -> LoopFormBase f vn -> Doc # pprList :: [LoopFormBase f vn] -> Doc # | |
ASTMappable (LoopFormBase Info VName) Source # | |
Defined in Language.Futhark.Traversals |
data PatternBase f vn Source #
A pattern as used most places where variables are bound (function
parameters, let
expressions, etc).
TuplePattern [PatternBase f vn] SrcLoc | |
RecordPattern [(Name, PatternBase f vn)] SrcLoc | |
PatternParens (PatternBase f vn) SrcLoc | |
Id vn (f PatternType) SrcLoc | |
Wildcard (f PatternType) SrcLoc | |
PatternAscription (PatternBase f vn) (TypeDeclBase f vn) SrcLoc | |
PatternLit (ExpBase f vn) (f PatternType) SrcLoc | |
PatternConstr Name (f PatternType) [PatternBase f vn] SrcLoc |
Instances
Showable f vn => Show (PatternBase f vn) Source # | |
Defined in Language.Futhark.Syntax showsPrec :: Int -> PatternBase f vn -> ShowS # show :: PatternBase f vn -> String # showList :: [PatternBase f vn] -> ShowS # | |
(Eq vn, IsName vn, Annot f) => Pretty (PatternBase f vn) Source # | |
Defined in Language.Futhark.Pretty ppr :: PatternBase f vn -> Doc # pprPrec :: Int -> PatternBase f vn -> Doc # pprList :: [PatternBase f vn] -> Doc # | |
Located (PatternBase f vn) Source # | |
Defined in Language.Futhark.Syntax locOf :: PatternBase f vn -> Loc # locOfList :: [PatternBase f vn] -> Loc # | |
ASTMappable (PatternBase Info VName) Source # | |
Defined in Language.Futhark.Traversals |
Module language
ValSpec | |
| |
TypeAbbrSpec (TypeBindBase f vn) | |
TypeSpec Liftedness vn [TypeParamBase vn] (Maybe DocComment) SrcLoc | Abstract type. |
ModSpec vn (SigExpBase f vn) (Maybe DocComment) SrcLoc | |
IncludeSpec (SigExpBase f vn) SrcLoc |
data SigExpBase f vn Source #
SigVar (QualName vn) SrcLoc | |
SigParens (SigExpBase f vn) SrcLoc | |
SigSpecs [SpecBase f vn] SrcLoc | |
SigWith (SigExpBase f vn) (TypeRefBase f vn) SrcLoc | |
SigArrow (Maybe vn) (SigExpBase f vn) (SigExpBase f vn) SrcLoc |
Instances
Showable f vn => Show (SigExpBase f vn) Source # | |
Defined in Language.Futhark.Syntax showsPrec :: Int -> SigExpBase f vn -> ShowS # show :: SigExpBase f vn -> String # showList :: [SigExpBase f vn] -> ShowS # | |
(Eq vn, IsName vn, Annot f) => Pretty (SigExpBase f vn) Source # | |
Defined in Language.Futhark.Pretty ppr :: SigExpBase f vn -> Doc # pprPrec :: Int -> SigExpBase f vn -> Doc # pprList :: [SigExpBase f vn] -> Doc # | |
Located (SigExpBase f vn) Source # | |
Defined in Language.Futhark.Syntax locOf :: SigExpBase f vn -> Loc # locOfList :: [SigExpBase f vn] -> Loc # |
data TypeRefBase f vn Source #
A type refinement.
TypeRef (QualName vn) [TypeParamBase vn] (TypeDeclBase f vn) SrcLoc |
Instances
Showable f vn => Show (TypeRefBase f vn) Source # | |
Defined in Language.Futhark.Syntax showsPrec :: Int -> TypeRefBase f vn -> ShowS # show :: TypeRefBase f vn -> String # showList :: [TypeRefBase f vn] -> ShowS # | |
Located (TypeRefBase f vn) Source # | |
Defined in Language.Futhark.Syntax locOf :: TypeRefBase f vn -> Loc # locOfList :: [TypeRefBase f vn] -> Loc # |
data SigBindBase f vn Source #
SigBind | |
|
Instances
Showable f vn => Show (SigBindBase f vn) Source # | |
Defined in Language.Futhark.Syntax showsPrec :: Int -> SigBindBase f vn -> ShowS # show :: SigBindBase f vn -> String # showList :: [SigBindBase f vn] -> ShowS # | |
(Eq vn, IsName vn, Annot f) => Pretty (SigBindBase f vn) Source # | |
Defined in Language.Futhark.Pretty ppr :: SigBindBase f vn -> Doc # pprPrec :: Int -> SigBindBase f vn -> Doc # pprList :: [SigBindBase f vn] -> Doc # | |
Located (SigBindBase f vn) Source # | |
Defined in Language.Futhark.Syntax locOf :: SigBindBase f vn -> Loc # locOfList :: [SigBindBase f vn] -> Loc # |
data ModExpBase f vn Source #
ModVar (QualName vn) SrcLoc | |
ModParens (ModExpBase f vn) SrcLoc | |
ModImport FilePath (f FilePath) SrcLoc | The contents of another file as a module. |
ModDecs [DecBase f vn] SrcLoc | |
ModApply (ModExpBase f vn) (ModExpBase f vn) (f (Map VName VName)) (f (Map VName VName)) SrcLoc | Functor application. |
ModAscript (ModExpBase f vn) (SigExpBase f vn) (f (Map VName VName)) SrcLoc | |
ModLambda (ModParamBase f vn) (Maybe (SigExpBase f vn, f (Map VName VName))) (ModExpBase f vn) SrcLoc |
Instances
Showable f vn => Show (ModExpBase f vn) Source # | |
Defined in Language.Futhark.Syntax showsPrec :: Int -> ModExpBase f vn -> ShowS # show :: ModExpBase f vn -> String # showList :: [ModExpBase f vn] -> ShowS # | |
(Eq vn, IsName vn, Annot f) => Pretty (ModExpBase f vn) Source # | |
Defined in Language.Futhark.Pretty ppr :: ModExpBase f vn -> Doc # pprPrec :: Int -> ModExpBase f vn -> Doc # pprList :: [ModExpBase f vn] -> Doc # | |
Located (ModExpBase f vn) Source # | |
Defined in Language.Futhark.Syntax locOf :: ModExpBase f vn -> Loc # locOfList :: [ModExpBase f vn] -> Loc # |
data ModBindBase f vn Source #
ModBind | |
|
Instances
Showable f vn => Show (ModBindBase f vn) Source # | |
Defined in Language.Futhark.Syntax showsPrec :: Int -> ModBindBase f vn -> ShowS # show :: ModBindBase f vn -> String # showList :: [ModBindBase f vn] -> ShowS # | |
(Eq vn, IsName vn, Annot f) => Pretty (ModBindBase f vn) Source # | |
Defined in Language.Futhark.Pretty ppr :: ModBindBase f vn -> Doc # pprPrec :: Int -> ModBindBase f vn -> Doc # pprList :: [ModBindBase f vn] -> Doc # | |
Located (ModBindBase f vn) Source # | |
Defined in Language.Futhark.Syntax locOf :: ModBindBase f vn -> Loc # locOfList :: [ModBindBase f vn] -> Loc # |
data ModParamBase f vn Source #
ModParam | |
|
Instances
Showable f vn => Show (ModParamBase f vn) Source # | |
Defined in Language.Futhark.Syntax showsPrec :: Int -> ModParamBase f vn -> ShowS # show :: ModParamBase f vn -> String # showList :: [ModParamBase f vn] -> ShowS # | |
(Eq vn, IsName vn, Annot f) => Pretty (ModParamBase f vn) Source # | |
Defined in Language.Futhark.Pretty ppr :: ModParamBase f vn -> Doc # pprPrec :: Int -> ModParamBase f vn -> Doc # pprList :: [ModParamBase f vn] -> Doc # | |
Located (ModParamBase f vn) Source # | |
Defined in Language.Futhark.Syntax locOf :: ModParamBase f vn -> Loc # locOfList :: [ModParamBase f vn] -> Loc # |
Definitions
data DocComment Source #
Documentation strings, including source location.
Instances
Show DocComment Source # | |
Defined in Language.Futhark.Syntax showsPrec :: Int -> DocComment -> ShowS # show :: DocComment -> String # showList :: [DocComment] -> ShowS # | |
Located DocComment Source # | |
Defined in Language.Futhark.Syntax locOf :: DocComment -> Loc # locOfList :: [DocComment] -> Loc # |
data ValBindBase f vn Source #
Function Declarations
ValBind | |
|
Instances
Showable f vn => Show (ValBindBase f vn) Source # | |
Defined in Language.Futhark.Syntax showsPrec :: Int -> ValBindBase f vn -> ShowS # show :: ValBindBase f vn -> String # showList :: [ValBindBase f vn] -> ShowS # | |
(Eq vn, IsName vn, Annot f) => Pretty (ValBindBase f vn) Source # | |
Defined in Language.Futhark.Pretty ppr :: ValBindBase f vn -> Doc # pprPrec :: Int -> ValBindBase f vn -> Doc # pprList :: [ValBindBase f vn] -> Doc # | |
Located (ValBindBase f vn) Source # | |
Defined in Language.Futhark.Syntax locOf :: ValBindBase f vn -> Loc # locOfList :: [ValBindBase f vn] -> Loc # |
data Liftedness Source #
The liftedness of a type parameter. By the Ord
instance,
Unlifted
is less than Lifted
.
Unlifted | May only be instantiated with a zero-order type. |
Lifted | May be instantiated to a functional type. |
Instances
Eq Liftedness Source # | |
Defined in Language.Futhark.Syntax (==) :: Liftedness -> Liftedness -> Bool # (/=) :: Liftedness -> Liftedness -> Bool # | |
Ord Liftedness Source # | |
Defined in Language.Futhark.Syntax compare :: Liftedness -> Liftedness -> Ordering # (<) :: Liftedness -> Liftedness -> Bool # (<=) :: Liftedness -> Liftedness -> Bool # (>) :: Liftedness -> Liftedness -> Bool # (>=) :: Liftedness -> Liftedness -> Bool # max :: Liftedness -> Liftedness -> Liftedness # min :: Liftedness -> Liftedness -> Liftedness # | |
Show Liftedness Source # | |
Defined in Language.Futhark.Syntax showsPrec :: Int -> Liftedness -> ShowS # show :: Liftedness -> String # showList :: [Liftedness] -> ShowS # |
data TypeBindBase f vn Source #
Type Declarations
TypeBind | |
|
Instances
Showable f vn => Show (TypeBindBase f vn) Source # | |
Defined in Language.Futhark.Syntax showsPrec :: Int -> TypeBindBase f vn -> ShowS # show :: TypeBindBase f vn -> String # showList :: [TypeBindBase f vn] -> ShowS # | |
(Eq vn, IsName vn, Annot f) => Pretty (TypeBindBase f vn) Source # | |
Defined in Language.Futhark.Pretty ppr :: TypeBindBase f vn -> Doc # pprPrec :: Int -> TypeBindBase f vn -> Doc # pprList :: [TypeBindBase f vn] -> Doc # | |
Located (TypeBindBase f vn) Source # | |
Defined in Language.Futhark.Syntax locOf :: TypeBindBase f vn -> Loc # locOfList :: [TypeBindBase f vn] -> Loc # |
data TypeParamBase vn Source #
TypeParamDim vn SrcLoc | A type parameter that must be a size. |
TypeParamType Liftedness vn SrcLoc | A type parameter that must be a type. |
Instances
typeParamName :: TypeParamBase vn -> vn Source #
The program described by a single Futhark file. May depend on other files.
A top-level binding.
ValDec (ValBindBase f vn) | |
TypeDec (TypeBindBase f vn) | |
SigDec (SigBindBase f vn) | |
ModDec (ModBindBase f vn) | |
OpenDec (ModExpBase f vn) SrcLoc | |
LocalDec (DecBase f vn) SrcLoc | |
ImportDec FilePath (f FilePath) SrcLoc |
Miscellaneous
class (Show vn, Show (f VName), Show (f Diet), Show (f String), Show (f [VName]), Show (f PatternType), Show (f Int), Show (f StructType), Show (f (Aliasing, StructType)), Show (f (Map VName VName)), Show (f Uniqueness)) => Showable f vn Source #
Convenience class for deriving Show
instances for the AST.
No information functor. Usually used for placeholder type- or aliasing information.
Instances
Functor NoInfo Source # | |
Foldable NoInfo Source # | |
Defined in Language.Futhark.Syntax fold :: Monoid m => NoInfo m -> m # foldMap :: Monoid m => (a -> m) -> NoInfo a -> m # foldr :: (a -> b -> b) -> b -> NoInfo a -> b # foldr' :: (a -> b -> b) -> b -> NoInfo a -> b # foldl :: (b -> a -> b) -> b -> NoInfo a -> b # foldl' :: (b -> a -> b) -> b -> NoInfo a -> b # foldr1 :: (a -> a -> a) -> NoInfo a -> a # foldl1 :: (a -> a -> a) -> NoInfo a -> a # elem :: Eq a => a -> NoInfo a -> Bool # maximum :: Ord a => NoInfo a -> a # minimum :: Ord a => NoInfo a -> a # | |
Traversable NoInfo Source # | |
Annot NoInfo Source # | |
Show vn => Showable NoInfo vn Source # | |
Defined in Language.Futhark.Syntax | |
Eq (NoInfo a) Source # | |
Ord (NoInfo a) Source # | |
Defined in Language.Futhark.Syntax | |
Show (NoInfo a) Source # | |
Some information. The dual to NoInfo
Instances
A variable that is aliased. Can be still in-scope, or have gone out of scope and be free. In the latter case, it behaves more like an equivalence class. See uniqueness-error18.fut for an example of why this is necessary.
Instances
Eq Alias Source # | |
Ord Alias Source # | |
Show Alias Source # | |
ASTMappable PatternType Source # | |
Defined in Language.Futhark.Traversals astMap :: Monad m => ASTMapper m -> PatternType -> m PatternType Source # | |
ASTMappable Aliasing Source # | |
ASTMappable Alias Source # | |
Substitutable (TypeBase () Aliasing) Source # | |
Substitutable (TypeBase (DimDecl VName) Aliasing) Source # | |
type Aliasing = Set Alias Source #
Aliasing for a type, which is a set of the variables that are aliased.
A name qualified with a breadcrumb of module accesses.