-- | integer sizes
data IntSz = PI8 | PI16 | PI32 | PI64 | PIsize
-- | primitive type literals
data PrimTy = PtType | PtBool | PtString | PtIntSz | PtUnsInt IntSz | PtSigInt IntSz
-- | all possible literals
data Literal = LPrimTy PrimTy | LIntSz IntSz | LNat Natural
-- | lookup a value in a list by its position (via Natural instead of Int);
-- this is only here because it has no dependencies
foldr ffun (const Nothing)
where
ffun x _ 0 = Just x
ffun _ r k = r (k-1)
-- | compute type of literal
PtUnsInt PIsize
litTypeOf (LIntSz _) = PtIntSz
litTypeOf (LPrimTy _) = PtType