Safe Haskell | Safe |
---|---|
Language | Haskell98 |
- data Name
- = NameVar !String
- | NameCon !String
- | NameExt !Name !String
- | NameTyConTetra !TyConTetra
- | NameDaConTetra !DaConTetra
- | NameOpError !OpError !Bool
- | NameOpFun !OpFun
- | NameOpVector !OpVector !Bool
- | NamePrimTyCon !PrimTyCon
- | NamePrimArith !PrimArith !Bool
- | NamePrimCast !PrimCast !Bool
- | NameLitBool !Bool
- | NameLitNat !Integer
- | NameLitInt !Integer
- | NameLitSize !Integer
- | NameLitWord !Integer !Int
- | NameLitFloat !Double !Int
- | NameLitChar !Char
- | NameLitTextLit !Text
- | NameLitUnboxed !Name
- | NameHole
- isNameHole :: Name -> Bool
- isNameLit :: Name -> Bool
- isNameLitUnboxed :: Name -> Bool
- readName :: String -> Maybe Name
- takeTypeOfLitName :: Name -> Maybe (Type Name)
- takeTypeOfPrimOpName :: Name -> Maybe (Type Name)
- data TyConTetra
- readTyConTetra :: String -> Maybe TyConTetra
- kindTyConTetra :: TyConTetra -> Type Name
- tTupleN :: [Type Name] -> Type Name
- tUnboxed :: Type Name -> Type Name
- tFunValue :: Type Name -> Type Name
- tCloValue :: Type Name -> Type Name
- tTextLit :: Type Name
- data DaConTetra = DaConTetraTuple Int
- readDaConTetra :: String -> Maybe DaConTetra
- typeDaConTetra :: DaConTetra -> Type Name
- data OpFun
- readOpFun :: String -> Maybe OpFun
- typeOpFun :: OpFun -> Type Name
- data OpVector
- readOpVectorFlag :: String -> Maybe (OpVector, Bool)
- typeOpVectorFlag :: OpVector -> Bool -> Type Name
- data OpError = OpErrorDefault
- readOpErrorFlag :: String -> Maybe (OpError, Bool)
- typeOpErrorFlag :: OpError -> Bool -> Type Name
- data PrimTyCon :: *
- pprPrimTyConStem :: PrimTyCon -> Doc
- readPrimTyCon :: String -> Maybe PrimTyCon
- readPrimTyConStem :: String -> Maybe PrimTyCon
- kindPrimTyCon :: PrimTyCon -> Kind Name
- data PrimArith :: *
- readPrimArithFlag :: String -> Maybe (PrimArith, Bool)
- typePrimArithFlag :: PrimArith -> Bool -> Type Name
- data PrimCast :: *
- readPrimCastFlag :: String -> Maybe (PrimCast, Bool)
- typePrimCastFlag :: PrimCast -> Bool -> Type Name
Names and lexing.
Names of things used in Disciple Core Tetra.
NameVar !String | User defined variables. |
NameCon !String | A user defined constructor. |
NameExt !Name !String | An extended name. |
NameTyConTetra !TyConTetra | Baked-in type constructors. |
NameDaConTetra !DaConTetra | Baked-in data constructors. |
NameOpError !OpError !Bool | Baked-in runtime error reporting. The flag indicates whether this is the boxed (False) or unboxed (True) version. |
NameOpFun !OpFun | Baked-in function operators. |
NameOpVector !OpVector !Bool | Baked-in vector operators. The flag indicates whether this is the boxed (False) or unboxed (True) version. |
NamePrimTyCon !PrimTyCon | A primitive type constructor. |
NamePrimArith !PrimArith !Bool | Primitive arithmetic, logic, comparison and bit-wise operators. The flag indicates whether this is the boxed (False) or unboxed (True) version. |
NamePrimCast !PrimCast !Bool | Primitive numeric casting operators. The flat indicates whether this is the boxed (False) or unboxed (True) version. |
NameLitBool !Bool | A boolean literal. |
NameLitNat !Integer | A natural literal, with enough precision to count every heap object. |
NameLitInt !Integer | An integer literal, with enough precision to count every heap object. |
NameLitSize !Integer | An unsigned size literal, with enough precision to count every addressable byte of memory. |
NameLitWord !Integer !Int | A word literal, with the given number of bits precision. |
NameLitFloat !Double !Int | A floating point literal, with the given number of bits precision. |
NameLitChar !Char | A character literal, These are special syntax for a Word32 expressing a Unicode codepoint. |
NameLitTextLit !Text | A text literal (UTF-8 encoded)
Note that |
NameLitUnboxed !Name | Wrapper to indicate an explicitly unboxed literal. |
NameHole | Hole used during type inference. |
isNameLitUnboxed :: Name -> Bool Source #
Check whether a name is an unboxed literal.
Baked-in type constructors.
data TyConTetra Source #
Baked-in type constructors.
TyConTetraTuple Int |
|
TyConTetraVector |
|
TyConTetraU |
|
TyConTetraF |
|
TyConTetraC |
|
readTyConTetra :: String -> Maybe TyConTetra Source #
Read the name of a baked-in type constructor.
kindTyConTetra :: TyConTetra -> Type Name Source #
Take the kind of a baked-in type constructor.
Baked-in data constructors.
readDaConTetra :: String -> Maybe DaConTetra Source #
Read the name of a baked-in data constructor.
typeDaConTetra :: DaConTetra -> Type Name Source #
Yield the type of a baked-in data constructor.
Baked-in function operators.
Operators for building function values and closures. The implicit versions work on functions of type (a -> b), while the explicit versions use expliciy closure types like C# (a -> b).
OpFunCurry Int | Partially apply a supecombinator to some arguments, producing an implicitly typed closure. |
OpFunApply Int | Apply an implicitly typed closure to some more arguments. |
OpFunCReify | Reify a function into an explicit functional value. |
OpFunCCurry Int | Apply an explicit functional value to some arguments, producing an explicitly typed closure. |
OpFunCExtend Int | Extend an explicitly typed closure with more arguments, producing a new closure. |
OpFunCApply Int | Apply an explicitly typed closure to some arguments, possibly evaluating the contained function. |
Baked-in vector operators.
Vector operators.
OpVectorAlloc | Allocate a new vector of a given length number of elements. |
OpVectorLength | Get the length of a vector, in elements. |
OpVectorRead | Read a value from a vector. |
OpVectorWrite | Write a value to a vector. |
readOpVectorFlag :: String -> Maybe (OpVector, Bool) Source #
Read a primitive vector operator, along with the flag that indicates whether this is the boxed or unboxed version.
typeOpVectorFlag :: OpVector -> Bool -> Type Name Source #
Take the type of a primitive vector operator.
Operators for runtime error reporting.
OpErrorDefault | Raise an error due to inexhaustive case expressions. |
Primitive type constructors.
Primitive type constructors.
PrimTyConVoid |
|
PrimTyConBool |
|
PrimTyConNat |
|
PrimTyConInt |
|
PrimTyConSize |
|
PrimTyConWord Int |
|
PrimTyConFloat Int |
|
PrimTyConVec Int |
|
PrimTyConAddr |
|
PrimTyConPtr |
|
PrimTyConTextLit |
|
PrimTyConTag |
|
pprPrimTyConStem :: PrimTyCon -> Doc #
Pretty print a primitive type constructor,
without the #
suffix.
readPrimTyCon :: String -> Maybe PrimTyCon #
Read a primitive type constructor.
Words are limited to 8, 16, 32, or 64 bits.
Floats are limited to 32 or 64 bits.
readPrimTyConStem :: String -> Maybe PrimTyCon #
Read a primitive type constructor, without the #
suffix.
Primitive arithmetic operators.
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 |
typePrimArithFlag :: PrimArith -> Bool -> Type Name Source #
Take the type of a primitive arithmetic operator.
Primitive numeric casts.
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.
PrimCastConvert | Convert a value to a new representation with the same precision. |
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. |
typePrimCastFlag :: PrimCast -> Bool -> Type Name Source #
Take the type of a primitive numeric cast operator.