Safe Haskell | None |
---|---|
Language | Haskell2010 |
Frontend AST
Synopsis
- data BuiltinTy
- data KempeTy a
- data StackType b = StackType {}
- data ConsAnn a = ConsAnn {}
- data Atom c b
- data BuiltinFn
- data KempeDecl a c b
- data Pattern c b
- = PatternInt b Integer
- | PatternCons {
- patternKind :: c
- patternName :: TyName c
- | PatternWildcard b
- | PatternBool b Bool
- data ABI
- type Declarations a c b = [KempeDecl a c b]
- data Module a c b = Module {
- importFps :: [ByteString]
- body :: [KempeDecl a c b]
- freeVars :: [KempeTy a] -> Set (Name a)
- type MonoStackType = ([KempeTy ()], [KempeTy ()])
- type SizeEnv = IntMap Size
- type Size = [Int64] -> Int64
- size :: SizeEnv -> KempeTy a -> Size
- sizeStack :: SizeEnv -> [KempeTy a] -> Int64
- size' :: SizeEnv -> KempeTy a -> Int64
- cSize :: Size -> Int64
- prettyMonoStackType :: MonoStackType -> Doc a
- prettyTyped :: Atom (StackType ()) (StackType ()) -> Doc ann
- prettyTypedModule :: Declarations () (StackType ()) (StackType ()) -> Doc ann
- prettyFancyModule :: Declarations () (ConsAnn (StackType ())) (StackType ()) -> Doc ann
- prettyModule :: Module a c b -> Doc ann
- flipStackType :: StackType () -> StackType ()
- voidStackType :: StackType a -> StackType ()
Documentation
Instances
Eq BuiltinTy Source # | |
Ord BuiltinTy Source # | |
Defined in Kempe.AST | |
Generic BuiltinTy Source # | |
NFData BuiltinTy Source # | |
Pretty BuiltinTy Source # | |
Defined in Kempe.AST pretty :: BuiltinTy -> Doc ann prettyList :: [BuiltinTy] -> Doc ann | |
type Rep BuiltinTy Source # | |
Defined in Kempe.AST type Rep BuiltinTy = D1 ('MetaData "BuiltinTy" "Kempe.AST" "kempe-0.1.1.0-inplace-kempe-modules" 'False) ((C1 ('MetaCons "TyInt" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "TyBool" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "TyInt8" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "TyWord" 'PrefixI 'False) (U1 :: Type -> Type))) |
Instances
Instances
Eq b => Eq (StackType b) Source # | |
Ord b => Ord (StackType b) Source # | |
Generic (StackType b) Source # | |
NFData b => NFData (StackType b) Source # | |
Pretty (StackType a) Source # | |
Defined in Kempe.AST pretty :: StackType a -> Doc ann prettyList :: [StackType a] -> Doc ann | |
type Rep (StackType b) Source # | |
Defined in Kempe.AST type Rep (StackType b) = D1 ('MetaData "StackType" "Kempe.AST" "kempe-0.1.1.0-inplace-kempe-modules" 'False) (C1 ('MetaCons "StackType" 'PrefixI 'True) (S1 ('MetaSel ('Just "quantify") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Set (Name b))) :*: (S1 ('MetaSel ('Just "inTypes") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [KempeTy b]) :*: S1 ('MetaSel ('Just "outTypes") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [KempeTy b])))) |
Annotation carried on constructors to keep size information through the IR generation phase.
Instances
Functor ConsAnn Source # | |
Foldable ConsAnn Source # | |
Defined in Kempe.AST fold :: Monoid m => ConsAnn m -> m # foldMap :: Monoid m => (a -> m) -> ConsAnn a -> m # foldMap' :: Monoid m => (a -> m) -> ConsAnn a -> m # foldr :: (a -> b -> b) -> b -> ConsAnn a -> b # foldr' :: (a -> b -> b) -> b -> ConsAnn a -> b # foldl :: (b -> a -> b) -> b -> ConsAnn a -> b # foldl' :: (b -> a -> b) -> b -> ConsAnn a -> b # foldr1 :: (a -> a -> a) -> ConsAnn a -> a # foldl1 :: (a -> a -> a) -> ConsAnn a -> a # elem :: Eq a => a -> ConsAnn a -> Bool # maximum :: Ord a => ConsAnn a -> a # minimum :: Ord a => ConsAnn a -> a # | |
Traversable ConsAnn Source # | |
Generic (ConsAnn a) Source # | |
NFData a => NFData (ConsAnn a) Source # | |
Pretty a => Pretty (ConsAnn a) Source # | |
Defined in Kempe.AST pretty :: ConsAnn a -> Doc ann prettyList :: [ConsAnn a] -> Doc ann | |
type Rep (ConsAnn a) Source # | |
Defined in Kempe.AST type Rep (ConsAnn a) = D1 ('MetaData "ConsAnn" "Kempe.AST" "kempe-0.1.1.0-inplace-kempe-modules" 'False) (C1 ('MetaCons "ConsAnn" 'PrefixI 'True) (S1 ('MetaSel ('Just "tySz") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int64) :*: (S1 ('MetaSel ('Just "tag") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word8) :*: S1 ('MetaSel ('Just "consTy") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)))) |
AtName b (Name b) | |
Case b (NonEmpty (Pattern c b, [Atom c b])) | |
If b [Atom c b] [Atom c b] | |
Dip b [Atom c b] | |
IntLit b Integer | |
WordLit b Natural | |
Int8Lit b Int8 | |
BoolLit b Bool | |
AtBuiltin b BuiltinFn | |
AtCons c (TyName c) |
Instances
Instances
TyDecl a (TyName a) [Name a] [(TyName b, [KempeTy a])] | |
FunDecl b (Name b) [KempeTy a] [KempeTy a] [Atom c b] | |
ExtFnDecl b (Name b) [KempeTy a] [KempeTy a] ByteString | |
Export b ABI (Name b) |
Instances
PatternInt b Integer | |
PatternCons | |
| |
PatternWildcard b | |
PatternBool b Bool |
Instances
type Declarations a c b = [KempeDecl a c b] Source #
Module | |
|
Instances
Generic (Module a c b) Source # | |
(NFData a, NFData b, NFData c) => NFData (Module a c b) Source # | |
type Rep (Module a c b) Source # | |
Defined in Kempe.AST type Rep (Module a c b) = D1 ('MetaData "Module" "Kempe.AST" "kempe-0.1.1.0-inplace-kempe-modules" 'False) (C1 ('MetaCons "Module" 'PrefixI 'True) (S1 ('MetaSel ('Just "importFps") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [ByteString]) :*: S1 ('MetaSel ('Just "body") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [KempeDecl a c b]))) |
type MonoStackType = ([KempeTy ()], [KempeTy ()]) Source #
size :: SizeEnv -> KempeTy a -> Size Source #
Don't call this on ill-kinded types; it won't throw any error.
prettyMonoStackType :: MonoStackType -> Doc a Source #
prettyTypedModule :: Declarations () (StackType ()) (StackType ()) -> Doc ann Source #
prettyFancyModule :: Declarations () (ConsAnn (StackType ())) (StackType ()) -> Doc ann Source #
prettyModule :: Module a c b -> Doc ann Source #
flipStackType :: StackType () -> StackType () Source #
Used in Kempe.Monomorphize for patterns
I resent this...
voidStackType :: StackType a -> StackType () Source #