Safe Haskell | None |
---|
- data Name
- = NameVar String
- | NameVarMod Name String
- | NameCon String
- | NameKiConFlow KiConFlow
- | NameTyConFlow TyConFlow
- | NameDaConFlow DaConFlow
- | NameOpFlow OpFlow
- | NameOpLoop OpLoop
- | NameOpStore OpStore
- | NamePrimTyCon PrimTyCon
- | NamePrimArith PrimArith
- | NamePrimCast PrimCast
- | NameLitBool Bool
- | NameLitNat Integer
- | NameLitInt Integer
- | NameLitWord Integer Int
- readName :: String -> Maybe Name
- data KiConFlow = KiConFlowRate
- readKiConFlow :: String -> Maybe KiConFlow
- data TyConFlow
- readTyConFlow :: String -> Maybe TyConFlow
- kindTyConFlow :: TyConFlow -> Kind Name
- data DaConFlow = DaConFlowTuple Int
- readDaConFlow :: String -> Maybe DaConFlow
- typeDaConFlow :: DaConFlow -> Type Name
- data OpFlow
- readOpFlow :: String -> Maybe OpFlow
- typeOpFlow :: OpFlow -> Type Name
- data OpLoop
- = OpLoopLoop
- | OpLoopLoopN
- | OpLoopGuard
- readOpLoop :: String -> Maybe OpLoop
- typeOpLoop :: OpLoop -> Type Name
- data OpStore
- readOpStore :: String -> Maybe OpStore
- typeOpStore :: OpStore -> Type Name
- data PrimTyCon
- kindPrimTyCon :: PrimTyCon -> Kind Name
- data PrimArith
- = PrimArithNeg
- | PrimArithAdd
- | PrimArithSub
- | PrimArithMul
- | PrimArithDiv
- | PrimArithMod
- | PrimArithRem
- | PrimArithEq
- | PrimArithNeq
- | PrimArithGt
- | PrimArithGe
- | PrimArithLt
- | PrimArithLe
- | PrimArithAnd
- | PrimArithOr
- | PrimArithShl
- | PrimArithShr
- | PrimArithBAnd
- | PrimArithBOr
- | PrimArithBXOr
- typePrimArith :: PrimArith -> Type Name
- data PrimCast
- typePrimCast :: PrimCast -> Type Name
Names and lexing
Names of things used in Disciple Core Flow.
NameVar String | User defined variables. |
NameVarMod Name String | A name generated by modifying some other name `name$mod` |
NameCon String | A user defined constructor. |
NameKiConFlow KiConFlow | Fragment specific kind constructors. |
NameTyConFlow TyConFlow | Fragment specific type constructors. |
NameDaConFlow DaConFlow | Fragment specific data constructors. |
NameOpFlow OpFlow | Flow operators. |
NameOpLoop OpLoop | Loop operators. |
NameOpStore OpStore | Store operators. |
NamePrimTyCon PrimTyCon | A primitive type constructor. |
NamePrimArith PrimArith | Primitive arithmetic, logic, comparison and bit-wise operators. |
NamePrimCast PrimCast | Primitive casting between numeric types. |
NameLitBool Bool | A boolean literal. |
NameLitNat Integer | A natural literal. |
NameLitInt Integer | An integer literal. |
NameLitWord Integer Int | A word literal. |
Fragment specific kind constructors
Fragment specific kind constructors.
readKiConFlow :: String -> Maybe KiConFlowSource
Read a kind constructor name.
Fragment specific type constructors
Fragment specific type constructors.
TyConFlowTuple Int |
|
TyConFlowVector |
|
TyConFlowSeries |
|
TyConFlowSegd |
|
TyConFlowSel Int |
|
TyConFlowRef |
|
TyConFlowWorld |
|
TyConFlowRateNat |
|
readTyConFlow :: String -> Maybe TyConFlowSource
Read a type constructor name.
kindTyConFlow :: TyConFlow -> Kind NameSource
Yield the kind of a primitive type constructor.
Fragment specific data constructors
Primitive data constructors.
DaConFlowTuple Int |
|
readDaConFlow :: String -> Maybe DaConFlowSource
Read a data constructor name.
typeDaConFlow :: DaConFlow -> Type NameSource
Yield the type of a data constructor.
Flow operators
Flow operators.
readOpFlow :: String -> Maybe OpFlowSource
Read a data flow operator name.
typeOpFlow :: OpFlow -> Type NameSource
Yield the type of a data flow operator,
or error
if there isn't one.
Loop operators
Loop operators.
readOpLoop :: String -> Maybe OpLoopSource
Read a loop operator name.
typeOpLoop :: OpLoop -> Type NameSource
Yield the type of a loop operator.
Store operators
Store operators.
OpStoreNew | Allocate a new reference. |
OpStoreRead | Read from a reference. |
OpStoreWrite | Write to a reference. |
OpStoreNewVector | Allocate a new vector (taking a |
OpStoreNewVectorR | Allocate a new vector (taking a |
OpStoreNewVectorN | Allocate a new vector (taking a |
OpStoreReadVector | Read from a vector. |
OpStoreWriteVector | Write to a vector. |
OpStoreSliceVector | Slice after a pack/filter (taking a |
OpStoreNext | Take the next element from a series. |
readOpStore :: String -> Maybe OpStoreSource
Read a store operator name.
typeOpStore :: OpStore -> Type NameSource
Yield the type of a store operator.
Primitive type constructors
data PrimTyCon
Primitive type constructors.
PrimTyConVoid |
|
PrimTyConBool |
|
PrimTyConNat |
|
PrimTyConInt |
|
PrimTyConWord Int |
|
PrimTyConFloat Int |
|
PrimTyConTag |
|
PrimTyConAddr |
|
PrimTyConPtr |
|
PrimTyConString |
These are primitive until we can define our own unboxed types. |
kindPrimTyCon :: PrimTyCon -> Kind NameSource
Yield the kind of a type constructor.
Primitive arithmetic operators
data PrimArith
Primitive arithmetic, logic, and comparison opretors. We expect the backend/machine to be able to implement these directly.
For the Shift Right operator, the type that it is used at determines whether it is an arithmetic (with sign-extension) or logical (no sign-extension) shift.
PrimArithNeg | Negation |
PrimArithAdd | Addition |
PrimArithSub | Subtraction |
PrimArithMul | Multiplication |
PrimArithDiv | Division |
PrimArithMod | Modulus |
PrimArithRem | Remainder |
PrimArithEq | Equality |
PrimArithNeq | Negated Equality |
PrimArithGt | Greater Than |
PrimArithGe | Greater Than or Equal |
PrimArithLt | Less Than |
PrimArithLe | Less Than or Equal |
PrimArithAnd | Boolean And |
PrimArithOr | Boolean Or |
PrimArithShl | Shift Left |
PrimArithShr | Shift Right |
PrimArithBAnd | Bit-wise And |
PrimArithBOr | Bit-wise Or |
PrimArithBXOr | Bit-wise eXclusive Or |
typePrimArith :: PrimArith -> Type NameSource
Take the type of a primitive arithmetic operator.
Casting between primitive types
data PrimCast
Primitive cast between two types.
The exact set of available casts is determined by the target platform.
For example, you can only promote a Nat#
to a Word32#
on a 32-bit
system. On a 64-bit system the Nat#
type is 64-bits wide, so casting it
to a Word32#
would be a truncation.
PrimCastPromote | Promote a value to one of similar or larger width, without loss of precision. |
PrimCastTruncate | Truncate a value to a new width, possibly losing precision. |
typePrimCast :: PrimCast -> Type NameSource
Take the type of a primitive cast.