| Safe Haskell | Safe-Inferred | 
|---|---|
| Language | Haskell2010 | 
Language.Futhark.Syntax
Description
The Futhark source language AST definition.  Many types, such as
 ExpBase, are parametrised by type and name representation.
 E.g. in a value of type ExpBase f vn, annotations are wrapped in
 the functor f, and all names are of type vn.  See
 https://futhark.readthedocs.org for a language reference, or this
 module may be a little hard to understand.
The system of primitive types is interesting in itself. See Language.Futhark.Primitive.
Synopsis
- module Language.Futhark.Core
- prettyString :: Pretty a => a -> String
- prettyText :: Pretty a => a -> Text
- data Uniqueness
- data IntType
- data FloatType
- data PrimType
- data Size
- newtype Shape dim = Shape {- shapeDims :: [dim]
 
- shapeRank :: Shape dim -> Int
- stripDims :: Int -> Shape dim -> Maybe (Shape dim)
- data TypeBase dim as- = Scalar (ScalarTypeBase dim as)
- | Array as Uniqueness (Shape dim) (ScalarTypeBase dim ())
 
- data TypeArg dim- = TypeArgDim dim SrcLoc
- | TypeArgType (TypeBase dim ()) SrcLoc
 
- data SizeExp vn- = SizeExpNamed (QualName vn) SrcLoc
- | SizeExpConst Int SrcLoc
- | SizeExpAny
 
- data TypeExp vn- = TEVar (QualName vn) SrcLoc
- | TETuple [TypeExp vn] SrcLoc
- | TERecord [(Name, TypeExp vn)] SrcLoc
- | TEArray (SizeExp vn) (TypeExp 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
- | TEDim [vn] (TypeExp vn) SrcLoc
 
- data TypeArgExp vn- = TypeArgExpDim (SizeExp vn) SrcLoc
- | TypeArgExpType (TypeExp vn)
 
- data PName
- data ScalarTypeBase dim as
- data RetTypeBase dim as = RetType {}
- type PatType = TypeBase Size Aliasing
- type StructType = TypeBase Size ()
- type StructRetType = RetTypeBase Size ()
- type PatRetType = RetTypeBase Size Aliasing
- type ValueType = TypeBase Int64 ()
- data Diet
- data IntValue- = Int8Value !Int8
- | Int16Value !Int16
- | Int32Value !Int32
- | Int64Value !Int64
 
- data FloatValue
- data PrimValue
- class IsPrimValue v where
- data AttrInfo vn
- data AttrAtom vn
- data BinOp
- data IdentBase f vn = Ident {- identName :: vn
- identType :: f PatType
- identSrcLoc :: SrcLoc
 
- data Inclusiveness a- = DownToExclusive a
- | ToInclusive a
- | UpToExclusive a
 
- data DimIndexBase f vn
- type SliceBase f vn = [DimIndexBase f vn]
- data SizeBinder vn = SizeBinder {}
- data AppExpBase f vn- = Apply (ExpBase f vn) (ExpBase f vn) (f (Diet, Maybe VName)) SrcLoc
- | Coerce (ExpBase f vn) (TypeExp vn) SrcLoc
- | Range (ExpBase f vn) (Maybe (ExpBase f vn)) (Inclusiveness (ExpBase f vn)) SrcLoc
- | LetPat [SizeBinder vn] (PatBase f vn) (ExpBase f vn) (ExpBase f vn) SrcLoc
- | LetFun vn ([TypeParamBase vn], [PatBase f vn], Maybe (TypeExp vn), f StructRetType, ExpBase f vn) (ExpBase f vn) SrcLoc
- | If (ExpBase f vn) (ExpBase f vn) (ExpBase f vn) SrcLoc
- | DoLoop [VName] (PatBase f vn) (ExpBase f vn) (LoopFormBase f vn) (ExpBase f vn) SrcLoc
- | BinOp (QualName vn, SrcLoc) (f PatType) (ExpBase f vn, f (StructType, Maybe VName)) (ExpBase f vn, f (StructType, Maybe VName)) SrcLoc
- | LetWith (IdentBase f vn) (IdentBase f vn) (SliceBase f vn) (ExpBase f vn) (ExpBase f vn) SrcLoc
- | Index (ExpBase f vn) (SliceBase f vn) SrcLoc
- | Match (ExpBase f vn) (NonEmpty (CaseBase f vn)) SrcLoc
 
- data AppRes = AppRes {- appResType :: PatType
- appResExt :: [VName]
 
- data ExpBase f vn- = Literal PrimValue SrcLoc
- | IntLit Integer (f PatType) SrcLoc
- | FloatLit Double (f PatType) SrcLoc
- | StringLit [Word8] SrcLoc
- | Hole (f PatType) SrcLoc
- | Var (QualName vn) (f PatType) SrcLoc
- | Parens (ExpBase f vn) SrcLoc
- | QualParens (QualName vn, SrcLoc) (ExpBase f vn) SrcLoc
- | TupLit [ExpBase f vn] SrcLoc
- | RecordLit [FieldBase f vn] SrcLoc
- | ArrayLit [ExpBase f vn] (f PatType) SrcLoc
- | Attr (AttrInfo vn) (ExpBase f vn) SrcLoc
- | Project Name (ExpBase f vn) (f PatType) SrcLoc
- | Negate (ExpBase f vn) SrcLoc
- | Not (ExpBase f vn) SrcLoc
- | Assert (ExpBase f vn) (ExpBase f vn) (f Text) SrcLoc
- | Constr Name [ExpBase f vn] (f PatType) SrcLoc
- | Update (ExpBase f vn) (SliceBase f vn) (ExpBase f vn) SrcLoc
- | RecordUpdate (ExpBase f vn) [Name] (ExpBase f vn) (f PatType) SrcLoc
- | Lambda [PatBase f vn] (ExpBase f vn) (Maybe (TypeExp vn)) (f (Aliasing, StructRetType)) SrcLoc
- | OpSection (QualName vn) (f PatType) SrcLoc
- | OpSectionLeft (QualName vn) (f PatType) (ExpBase f vn) (f (PName, StructType, Maybe VName), f (PName, StructType)) (f PatRetType, f [VName]) SrcLoc
- | OpSectionRight (QualName vn) (f PatType) (ExpBase f vn) (f (PName, StructType), f (PName, StructType, Maybe VName)) (f PatRetType) SrcLoc
- | ProjectSection [Name] (f PatType) SrcLoc
- | IndexSection (SliceBase f vn) (f PatType) SrcLoc
- | Ascript (ExpBase f vn) (TypeExp vn) SrcLoc
- | AppExp (AppExpBase f vn) (f AppRes)
 
- data FieldBase f vn- = RecordFieldExplicit Name (ExpBase f vn) SrcLoc
- | RecordFieldImplicit vn (f PatType) SrcLoc
 
- data CaseBase f vn = CasePat (PatBase f vn) (ExpBase f vn) SrcLoc
- data LoopFormBase f vn
- data PatLit
- data PatBase f vn- = TuplePat [PatBase f vn] SrcLoc
- | RecordPat [(Name, PatBase f vn)] SrcLoc
- | PatParens (PatBase f vn) SrcLoc
- | Id vn (f PatType) SrcLoc
- | Wildcard (f PatType) SrcLoc
- | PatAscription (PatBase f vn) (TypeExp vn) SrcLoc
- | PatLit PatLit (f PatType) SrcLoc
- | PatConstr Name (f PatType) [PatBase f vn] SrcLoc
- | PatAttr (AttrInfo vn) (PatBase f vn) SrcLoc
 
- data SpecBase f vn- = ValSpec { - specName :: vn
- specTypeParams :: [TypeParamBase vn]
- specTypeExp :: TypeExp vn
- specType :: f StructType
- 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) (f (Map VName VName)) SrcLoc
- | SigParens (SigExpBase f vn) SrcLoc
- | SigSpecs [SpecBase f vn] SrcLoc
- | SigWith (SigExpBase f vn) (TypeRefBase vn) SrcLoc
- | SigArrow (Maybe vn) (SigExpBase f vn) (SigExpBase f vn) SrcLoc
 
- data TypeRefBase vn = TypeRef (QualName vn) [TypeParamBase vn] (TypeExp 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 EntryPoint)
- valBindName :: vn
- valBindRetDecl :: Maybe (TypeExp vn)
- valBindRetType :: f StructRetType
- valBindTypeParams :: [TypeParamBase vn]
- valBindParams :: [PatBase f vn]
- valBindBody :: ExpBase f vn
- valBindDoc :: Maybe DocComment
- valBindAttrs :: [AttrInfo vn]
- valBindLocation :: SrcLoc
 
- data EntryPoint = EntryPoint {}
- data EntryType = EntryType {}
- data EntryParam = EntryParam {}
- data Liftedness- = Unlifted
- | SizeLifted
- | Lifted
 
- data TypeBindBase f vn = TypeBind {- typeAlias :: vn
- typeLiftedness :: Liftedness
- typeParams :: [TypeParamBase vn]
- typeExp :: TypeExp vn
- typeElab :: f StructRetType
- 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
 
- 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
prettyString :: Pretty a => a -> String Source #
Prettyprint a value to a String, appropriately wrapped.
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.
Constructors
| Nonunique | May have references outside current function. | 
| Unique | No references outside current function. | 
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 # | |
| Show IntType Source # | |
| Eq IntType Source # | |
| Ord IntType Source # | |
| Defined in Language.Futhark.Primitive | |
| Pretty IntType Source # | |
| Defined in Language.Futhark.Primitive | |
A floating point type.
Instances
| Bounded FloatType Source # | |
| Enum FloatType Source # | |
| Defined in Language.Futhark.Primitive Methods 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] # | |
| Show FloatType Source # | |
| Eq FloatType Source # | |
| Ord FloatType Source # | |
| Pretty FloatType Source # | |
| Defined in Language.Futhark.Primitive | |
Low-level primitive types.
The elaborated size of a dimension.
Constructors
| NamedSize (QualName VName) | The size of the dimension is this name, which must be in scope. In a return type, this will give rise to an assertion. | 
| ConstSize Int | The size is a constant. | 
| AnySize (Maybe VName) | No known size.  If  | 
Instances
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 -> Shape dim -> Maybe (Shape dim) Source #
stripDims n shape strips the outer n dimensions from
 shape, returning Nothing if this would result in zero or
 fewer dimensions.
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.
Constructors
| Scalar (ScalarTypeBase dim as) | |
| Array as Uniqueness (Shape dim) (ScalarTypeBase dim ()) | 
Instances
An argument passed to a type constructor.
Constructors
| TypeArgDim dim SrcLoc | |
| TypeArgType (TypeBase dim ()) SrcLoc | 
Instances
| Foldable TypeArg Source # | |
| Defined in Language.Futhark.Syntax Methods fold :: Monoid m => TypeArg m -> m # foldMap :: Monoid m => (a -> m) -> TypeArg a -> 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 # | |
| Functor TypeArg Source # | |
| Show dim => Show (TypeArg dim) Source # | |
| Eq dim => Eq (TypeArg dim) Source # | |
| Ord dim => Ord (TypeArg dim) Source # | |
| Defined in Language.Futhark.Syntax | |
| Pretty (TypeArg Size) Source # | |
A size expression for use in a TypeExp.
Constructors
| SizeExpNamed (QualName vn) SrcLoc | The size of the dimension is this name, which must be in scope. | 
| SizeExpConst Int SrcLoc | The size is a constant. | 
| SizeExpAny | No dimension declaration. | 
Instances
| Show vn => Show (SizeExp vn) Source # | |
| ASTMappable (SizeExp VName) Source # | |
| Eq (SizeExp Name) Source # | |
| Eq (SizeExp VName) Source # | |
| Ord (SizeExp Name) Source # | |
| Defined in Language.Futhark.Syntax | |
| Ord (SizeExp VName) Source # | |
| Defined in Language.Futhark.Syntax Methods compare :: SizeExp VName -> SizeExp VName -> Ordering # (<) :: SizeExp VName -> SizeExp VName -> Bool # (<=) :: SizeExp VName -> SizeExp VName -> Bool # (>) :: SizeExp VName -> SizeExp VName -> Bool # (>=) :: SizeExp VName -> SizeExp VName -> Bool # | |
| IsName vn => Pretty (SizeExp vn) Source # | |
| Defined in Language.Futhark.Pretty | |
An unstructured type with type variables and possibly shape
 declarations - this is what the user types in the source program.
 These are used to construct TypeBases in the type checker.
Constructors
| TEVar (QualName vn) SrcLoc | |
| TETuple [TypeExp vn] SrcLoc | |
| TERecord [(Name, TypeExp vn)] SrcLoc | |
| TEArray (SizeExp vn) (TypeExp 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 | |
| TEDim [vn] (TypeExp vn) SrcLoc | 
Instances
| Show vn => Show (TypeExp vn) Source # | |
| ASTMappable (TypeExp VName) Source # | |
| Eq (TypeExp Name) Source # | |
| Eq (TypeExp VName) Source # | |
| Ord (TypeExp Name) Source # | |
| Defined in Language.Futhark.Syntax | |
| Ord (TypeExp VName) Source # | |
| Defined in Language.Futhark.Syntax Methods compare :: TypeExp VName -> TypeExp VName -> Ordering # (<) :: TypeExp VName -> TypeExp VName -> Bool # (<=) :: TypeExp VName -> TypeExp VName -> Bool # (>) :: TypeExp VName -> TypeExp VName -> Bool # (>=) :: TypeExp VName -> TypeExp VName -> Bool # | |
| (Eq vn, IsName vn) => Pretty (TypeExp vn) Source # | |
| Defined in Language.Futhark.Pretty | |
| Located (TypeExp vn) Source # | |
data TypeArgExp vn Source #
A type argument expression passed to a type constructor.
Constructors
| TypeArgExpDim (SizeExp 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.
Constructors
| Prim PrimType | |
| TypeVar as Uniqueness (QualName VName) [TypeArg dim] | |
| Record (Map Name (TypeBase dim as)) | |
| Sum (Map Name [TypeBase dim as]) | |
| Arrow as PName (TypeBase dim ()) (RetTypeBase dim as) | The aliasing corresponds to the lexical closure of the function. | 
Instances
data RetTypeBase dim as Source #
Types that can appear to the right of a function arrow. This just means they can be existentially quantified.
Instances
type PatType = TypeBase Size Aliasing Source #
A type with aliasing information and shape annotations, used for describing the type patterns and expressions.
type StructType = TypeBase Size () Source #
A "structural" type with shape annotations and no aliasing information, used for declarations.
type StructRetType = RetTypeBase Size () Source #
The return type version of StructType.
type PatRetType = RetTypeBase Size Aliasing Source #
The return type version of PatType.
Information about which parts of a value/type are consumed.
Constructors
| RecordDiet (Map Name Diet) | Consumes these fields in the record. | 
| SumDiet (Map Name [Diet]) | Consume these parts of the constructors. | 
| 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. | 
Values
An integer value.
Constructors
| Int8Value !Int8 | |
| Int16Value !Int16 | |
| Int32Value !Int32 | |
| Int64Value !Int64 | 
data FloatValue Source #
A floating-point value.
Constructors
| Float16Value !Half | |
| Float32Value !Float | |
| Float64Value !Double | 
Instances
| Show FloatValue Source # | |
| Defined in Language.Futhark.Primitive Methods showsPrec :: Int -> FloatValue -> ShowS # show :: FloatValue -> String # showList :: [FloatValue] -> ShowS # | |
| IsValue FloatValue Source # | |
| Defined in Futhark.IR.Prop.Constants Methods value :: FloatValue -> PrimValue Source # | |
| Eq FloatValue Source # | |
| Defined in Language.Futhark.Primitive | |
| Ord FloatValue Source # | |
| Defined in Language.Futhark.Primitive Methods compare :: FloatValue -> FloatValue -> Ordering # (<) :: FloatValue -> FloatValue -> Bool # (<=) :: FloatValue -> FloatValue -> Bool # (>) :: FloatValue -> FloatValue -> Bool # (>=) :: FloatValue -> FloatValue -> Bool # max :: FloatValue -> FloatValue -> FloatValue # min :: FloatValue -> FloatValue -> FloatValue # | |
| ToExp FloatValue Source # | |
| Defined in Futhark.CodeGen.Backends.SimpleRep Methods toExp :: FloatValue -> SrcLoc -> Exp # | |
| Pretty FloatValue Source # | |
| Defined in Language.Futhark.Primitive | |
Non-array values.
Constructors
| SignedValue !IntValue | |
| UnsignedValue !IntValue | |
| FloatValue !FloatValue | |
| BoolValue !Bool | 
Instances
| Show PrimValue Source # | |
| Eq PrimValue Source # | |
| Ord PrimValue Source # | |
| Pretty PrimValue Source # | |
| Defined in Language.Futhark.Pretty | |
class IsPrimValue v where Source #
A class for converting ordinary Haskell values to primitive Futhark values.
Instances
Abstract syntax tree
The payload of an attribute.
Instances
| Show (AttrInfo vn) Source # | |
| Eq (AttrInfo vn) Source # | |
| Ord (AttrInfo vn) Source # | |
| Defined in Language.Futhark.Syntax | |
| IsName vn => Pretty (AttrInfo vn) Source # | |
| Defined in Language.Futhark.Pretty | |
The value of an AttrAtom.
Instances
| Show (AttrAtom vn) Source # | |
| Eq (AttrAtom vn) Source # | |
| Ord (AttrAtom vn) Source # | |
| Defined in Language.Futhark.Syntax | |
| IsName vn => Pretty (AttrAtom vn) Source # | |
| Defined in Language.Futhark.Pretty | |
Default binary operators.
Constructors
| Backtick | A pseudo-operator standing in for any normal identifier used as an operator (they all have the same fixity). | 
| Bang | Not a real operator, but operator with this as a prefix may be defined by the user. | 
| Equ | Not a real operator, but operator with this as a prefix may be defined by the user. | 
| 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.
Instances
| Show (IdentBase Info VName) Source # | |
| Show vn => Show (IdentBase (NoInfo :: Type -> Type) vn) Source # | |
| ASTMappable (IdentBase Info VName) Source # | |
| Eq vn => Eq (IdentBase ty vn) Source # | |
| Ord vn => Ord (IdentBase ty vn) Source # | |
| Defined in Language.Futhark.Syntax Methods 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 # | |
| IsName vn => Pretty (IdentBase f vn) Source # | |
| Defined in Language.Futhark.Pretty | |
| Located (IdentBase ty vn) Source # | |
data Inclusiveness a Source #
Whether a bound for an end-point of a DimSlice or a range
 literal is inclusive or exclusive.
Constructors
| 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.
Constructors
| DimFix (ExpBase f vn) | |
| DimSlice (Maybe (ExpBase f vn)) (Maybe (ExpBase f vn)) (Maybe (ExpBase f vn)) | 
Instances
type SliceBase f vn = [DimIndexBase f vn] Source #
A slicing of an array (potentially multiple dimensions).
data SizeBinder vn Source #
A binding of a size in a pattern (essentially a size parameter in
 a let expression).
Constructors
| SizeBinder | |
Instances
data AppExpBase f vn Source #
An "application expression" is a semantic (not syntactic)
 grouping of expressions that have "funcall-like" semantics, mostly
 meaning that they can return existential sizes.  In our type
 theory, these are all thought to be bound to names (*Administrative
 Normal Form*), but as this is not practical in a real language, we
 instead use an annotation (AppRes) that stores the information we
 need, so we can pretend that an application expression was really
 bound to a name.
Constructors
| Apply (ExpBase f vn) (ExpBase f vn) (f (Diet, Maybe VName)) SrcLoc | The  | 
| Coerce (ExpBase f vn) (TypeExp vn) SrcLoc | Size coercion:  | 
| Range (ExpBase f vn) (Maybe (ExpBase f vn)) (Inclusiveness (ExpBase f vn)) SrcLoc | |
| LetPat [SizeBinder vn] (PatBase f vn) (ExpBase f vn) (ExpBase f vn) SrcLoc | |
| LetFun vn ([TypeParamBase vn], [PatBase f vn], Maybe (TypeExp vn), f StructRetType, ExpBase f vn) (ExpBase f vn) SrcLoc | |
| If (ExpBase f vn) (ExpBase f vn) (ExpBase f vn) SrcLoc | |
| DoLoop [VName] (PatBase f vn) (ExpBase f vn) (LoopFormBase f vn) (ExpBase f vn) SrcLoc | |
| BinOp (QualName vn, SrcLoc) (f PatType) (ExpBase f vn, f (StructType, Maybe VName)) (ExpBase f vn, f (StructType, Maybe VName)) SrcLoc | |
| LetWith (IdentBase f vn) (IdentBase f vn) (SliceBase f vn) (ExpBase f vn) (ExpBase f vn) SrcLoc | |
| Index (ExpBase f vn) (SliceBase f vn) SrcLoc | |
| Match (ExpBase f vn) (NonEmpty (CaseBase f vn)) SrcLoc | A match expression. | 
Instances
An annotation inserted by the type checker on constructs that are "function calls" (either literally or conceptually). This annotation encodes the result type, as well as any existential sizes that are generated here.
Constructors
| AppRes | |
| Fields 
 | |
The Futhark expression language.
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 NameExp , in
 which type information is always present and all names are unique.Info VName
Constructors
| Literal PrimValue SrcLoc | |
| IntLit Integer (f PatType) SrcLoc | A polymorphic integral literal. | 
| FloatLit Double (f PatType) SrcLoc | A polymorphic decimal literal. | 
| StringLit [Word8] SrcLoc | A string literal is just a fancy syntax for an array of bytes. | 
| Hole (f PatType) SrcLoc | |
| Var (QualName vn) (f PatType) SrcLoc | |
| Parens (ExpBase f vn) SrcLoc | A parenthesized expression. | 
| QualParens (QualName vn, SrcLoc) (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 PatType) SrcLoc | Array literals, e.g.,  | 
| Attr (AttrInfo vn) (ExpBase f vn) SrcLoc | An attribute applied to the following expression. | 
| Project Name (ExpBase f vn) (f PatType) SrcLoc | |
| Negate (ExpBase f vn) SrcLoc | Numeric negation (ugly special case; Haskell did it first). | 
| Not (ExpBase f vn) SrcLoc | Logical and bitwise negation. | 
| Assert (ExpBase f vn) (ExpBase f vn) (f Text) 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 PatType) SrcLoc | An n-ary value constructor. | 
| Update (ExpBase f vn) (SliceBase f vn) (ExpBase f vn) SrcLoc | |
| RecordUpdate (ExpBase f vn) [Name] (ExpBase f vn) (f PatType) SrcLoc | |
| Lambda [PatBase f vn] (ExpBase f vn) (Maybe (TypeExp vn)) (f (Aliasing, StructRetType)) SrcLoc | |
| OpSection (QualName vn) (f PatType) SrcLoc | 
 | 
| OpSectionLeft (QualName vn) (f PatType) (ExpBase f vn) (f (PName, StructType, Maybe VName), f (PName, StructType)) (f PatRetType, f [VName]) SrcLoc | 
 | 
| OpSectionRight (QualName vn) (f PatType) (ExpBase f vn) (f (PName, StructType), f (PName, StructType, Maybe VName)) (f PatRetType) SrcLoc | 
 | 
| ProjectSection [Name] (f PatType) SrcLoc | Field projection as a section:  | 
| IndexSection (SliceBase f vn) (f PatType) SrcLoc | Array indexing as a section:  | 
| Ascript (ExpBase f vn) (TypeExp vn) SrcLoc | Type ascription:  | 
| AppExp (AppExpBase f vn) (f AppRes) | 
Instances
An entry in a record literal.
Constructors
| RecordFieldExplicit Name (ExpBase f vn) SrcLoc | |
| RecordFieldImplicit vn (f PatType) SrcLoc | 
Instances
A case in a match expression.
Instances
data LoopFormBase f vn Source #
Whether the loop is a for-loop or a while-loop.
Constructors
| For (IdentBase f vn) (ExpBase f vn) | |
| ForIn (PatBase f vn) (ExpBase f vn) | |
| While (ExpBase f vn) | 
Instances
A literal in a pattern.
Constructors
| PatLitInt Integer | |
| PatLitFloat Double | |
| PatLitPrim PrimValue | 
A pattern as used most places where variables are bound (function
 parameters, let expressions, etc).
Constructors
| TuplePat [PatBase f vn] SrcLoc | |
| RecordPat [(Name, PatBase f vn)] SrcLoc | |
| PatParens (PatBase f vn) SrcLoc | |
| Id vn (f PatType) SrcLoc | |
| Wildcard (f PatType) SrcLoc | |
| PatAscription (PatBase f vn) (TypeExp vn) SrcLoc | |
| PatLit PatLit (f PatType) SrcLoc | |
| PatConstr Name (f PatType) [PatBase f vn] SrcLoc | |
| PatAttr (AttrInfo vn) (PatBase f vn) SrcLoc | 
Instances
Module language
A spec is a component of a module type.
Constructors
| ValSpec | |
| Fields 
 | |
| 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 #
A module type expression.
Constructors
| SigVar (QualName vn) (f (Map VName VName)) SrcLoc | |
| SigParens (SigExpBase f vn) SrcLoc | |
| SigSpecs [SpecBase f vn] SrcLoc | |
| SigWith (SigExpBase f vn) (TypeRefBase vn) SrcLoc | |
| SigArrow (Maybe vn) (SigExpBase f vn) (SigExpBase f vn) SrcLoc | 
Instances
| Show (SigExpBase Info VName) Source # | |
| Defined in Language.Futhark.Syntax | |
| Show (SigExpBase (NoInfo :: Type -> Type) Name) Source # | |
| Defined in Language.Futhark.Syntax | |
| (Eq vn, IsName vn, Annot f) => Pretty (SigExpBase f vn) Source # | |
| Defined in Language.Futhark.Pretty | |
| Located (SigExpBase f vn) Source # | |
| Defined in Language.Futhark.Syntax | |
data TypeRefBase vn Source #
A type refinement.
Constructors
| TypeRef (QualName vn) [TypeParamBase vn] (TypeExp vn) SrcLoc | 
Instances
| Show (TypeRefBase Name) Source # | |
| Defined in Language.Futhark.Syntax | |
| Show (TypeRefBase VName) Source # | |
| Defined in Language.Futhark.Syntax | |
| Located (TypeRefBase vn) Source # | |
| Defined in Language.Futhark.Syntax | |
data SigBindBase f vn Source #
Module type binding.
Constructors
| SigBind | |
| Fields 
 | |
Instances
| Show (SigBindBase Info VName) Source # | |
| Defined in Language.Futhark.Syntax | |
| Show (SigBindBase (NoInfo :: Type -> Type) Name) Source # | |
| Defined in Language.Futhark.Syntax | |
| (Eq vn, IsName vn, Annot f) => Pretty (SigBindBase f vn) Source # | |
| Defined in Language.Futhark.Pretty | |
| Located (SigBindBase f vn) Source # | |
| Defined in Language.Futhark.Syntax | |
data ModExpBase f vn Source #
Module expression.
Constructors
| 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. The first mapping is from parameter names to argument names, while the second maps names in the constructed module to the names inside the functor. | 
| 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
| Show (ModExpBase Info VName) Source # | |
| Defined in Language.Futhark.Syntax | |
| Show (ModExpBase (NoInfo :: Type -> Type) Name) Source # | |
| Defined in Language.Futhark.Syntax | |
| (Eq vn, IsName vn, Annot f) => Pretty (ModExpBase f vn) Source # | |
| Defined in Language.Futhark.Pretty | |
| Located (ModExpBase f vn) Source # | |
| Defined in Language.Futhark.Syntax | |
data ModBindBase f vn Source #
A module binding.
Constructors
| ModBind | |
| Fields 
 | |
Instances
| Show (ModBindBase Info VName) Source # | |
| Defined in Language.Futhark.Syntax | |
| Show (ModBindBase (NoInfo :: Type -> Type) Name) Source # | |
| Defined in Language.Futhark.Syntax | |
| (Eq vn, IsName vn, Annot f) => Pretty (ModBindBase f vn) Source # | |
| Defined in Language.Futhark.Pretty | |
| Located (ModBindBase f vn) Source # | |
| Defined in Language.Futhark.Syntax | |
data ModParamBase f vn Source #
A module parameter.
Constructors
| ModParam | |
| Fields 
 | |
Instances
| Show (ModParamBase Info VName) Source # | |
| Defined in Language.Futhark.Syntax | |
| Show (ModParamBase (NoInfo :: Type -> Type) Name) Source # | |
| Defined in Language.Futhark.Syntax | |
| (Eq vn, IsName vn, Annot f) => Pretty (ModParamBase f vn) Source # | |
| Defined in Language.Futhark.Pretty | |
| Located (ModParamBase f vn) Source # | |
| Defined in Language.Futhark.Syntax | |
Definitions
data DocComment Source #
Documentation strings, including source location.
Constructors
| DocComment String SrcLoc | 
Instances
| Show DocComment Source # | |
| Defined in Language.Futhark.Syntax Methods showsPrec :: Int -> DocComment -> ShowS # show :: DocComment -> String # showList :: [DocComment] -> ShowS # | |
| Located DocComment Source # | |
| Defined in Language.Futhark.Syntax | |
data ValBindBase f vn Source #
Function Declarations
Constructors
| ValBind | |
| Fields 
 | |
Instances
| Show (ValBindBase Info VName) Source # | |
| Defined in Language.Futhark.Syntax | |
| Show (ValBindBase (NoInfo :: Type -> Type) Name) Source # | |
| Defined in Language.Futhark.Syntax | |
| (Eq vn, IsName vn, Annot f) => Pretty (ValBindBase f vn) Source # | |
| Defined in Language.Futhark.Pretty | |
| Located (ValBindBase f vn) Source # | |
| Defined in Language.Futhark.Syntax | |
data EntryPoint Source #
Information about the external interface exposed by an entry point. The important thing is that that we remember the original source-language types, without desugaring them at all. The annoying thing is that we do not require type annotations on entry points, so the types can be either ascribed or inferred.
Constructors
| EntryPoint | |
| Fields 
 | |
Instances
| Show EntryPoint Source # | |
| Defined in Language.Futhark.Syntax Methods showsPrec :: Int -> EntryPoint -> ShowS # show :: EntryPoint -> String # showList :: [EntryPoint] -> ShowS # | |
Part of the type of an entry point. Has an actual type, and maybe also an ascribed type expression.
Constructors
| EntryType | |
| Fields 
 | |
data EntryParam Source #
A parameter of an entry point.
Constructors
| EntryParam | |
| Fields | |
Instances
| Show EntryParam Source # | |
| Defined in Language.Futhark.Syntax Methods showsPrec :: Int -> EntryParam -> ShowS # show :: EntryParam -> String # showList :: [EntryParam] -> ShowS # | |
data Liftedness Source #
The liftedness of a type parameter.  By the Ord instance,
 Unlifted < SizeLifted < Lifted.
Constructors
| Unlifted | May only be instantiated with a zero-order type of (possibly symbolically) known size. | 
| SizeLifted | May only be instantiated with a zero-order type, but the size can be varying. | 
| Lifted | May be instantiated with a functional type. | 
Instances
| Show Liftedness Source # | |
| Defined in Language.Futhark.Syntax Methods showsPrec :: Int -> Liftedness -> ShowS # show :: Liftedness -> String # showList :: [Liftedness] -> ShowS # | |
| Eq Liftedness Source # | |
| Defined in Language.Futhark.Syntax | |
| Ord Liftedness Source # | |
| Defined in Language.Futhark.Syntax Methods compare :: Liftedness -> Liftedness -> Ordering # (<) :: Liftedness -> Liftedness -> Bool # (<=) :: Liftedness -> Liftedness -> Bool # (>) :: Liftedness -> Liftedness -> Bool # (>=) :: Liftedness -> Liftedness -> Bool # max :: Liftedness -> Liftedness -> Liftedness # min :: Liftedness -> Liftedness -> Liftedness # | |
| Pretty Liftedness Source # | |
| Defined in Language.Futhark.Pretty | |
data TypeBindBase f vn Source #
Type Declarations
Constructors
| TypeBind | |
| Fields 
 | |
Instances
| Show (TypeBindBase Info VName) Source # | |
| Defined in Language.Futhark.Syntax | |
| Show (TypeBindBase (NoInfo :: Type -> Type) Name) Source # | |
| Defined in Language.Futhark.Syntax | |
| (Eq vn, IsName vn, Annot f) => Pretty (TypeBindBase f vn) Source # | |
| Defined in Language.Futhark.Pretty | |
| Located (TypeBindBase f vn) Source # | |
| Defined in Language.Futhark.Syntax | |
data TypeParamBase vn Source #
A type parameter.
Constructors
| 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 name of a type parameter.
The program described by a single Futhark file. May depend on other files.
A top-level binding.
Constructors
| 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
No information functor. Usually used for placeholder type- or aliasing information.
Constructors
| NoInfo | 
Instances
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
| Show Alias Source # | |
| ASTMappable Alias Source # | |
| ASTMappable Aliasing Source # | |
| ASTMappable PatRetType Source # | |
| Defined in Language.Futhark.Traversals Methods astMap :: Monad m => ASTMapper m -> PatRetType -> m PatRetType Source # | |
| ASTMappable PatType Source # | |
| Eq Alias Source # | |
| Ord Alias Source # | |
| Substitutable (RetTypeBase Size Aliasing) Source # | |
| Defined in Language.Futhark.TypeChecker.Types Methods applySubst :: TypeSubs -> RetTypeBase Size Aliasing -> RetTypeBase Size Aliasing Source # | |
| Substitutable (TypeBase Size 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.