1 definition module Data.GenType
9 reBox x :== box (unBox x)
14 | GTyArrow GType GType
15 | GTyArray ArrayType GType
16 | GTyUList UListType GType
18 | GTyEither GType GType
20 | GTyCons GenericConsDescriptor GType
21 | GTyField GenericFieldDescriptor GType
22 | GTyObject GenericTypeDefDescriptor GType
23 | GTyRecord GenericRecordDescriptor GType
29 | TyArray ArrayType Type
30 | TyUList UListType Type
31 | TyNewType GenericTypeDefDescriptor GenericConsDescriptor Type
32 | TyObject GenericTypeDefDescriptor [(GenericConsDescriptor, [Type])]
33 | TyRecord GenericRecordDescriptor [(GenericFieldDescriptor, Type)]
35 :: BasicType = BTInt | BTChar | BTReal | BTBool | BTDynamic | BTFile | BTWorld
36 :: ArrayType = AStrict | ALazy | AUnboxed | APacked
37 :: UListType = ULLazy | ULStrict
39 instance == GType, Type, BasicType, ArrayType, UListType, GenType
40 instance toString GType, Type, BasicType, ArrayType, UListType, GenType
43 * Removes recursive types by replacing them with references
46 * @result the main type
47 * @result all the separate types grouped in the strongly connected components
49 flattenGType :: GType -> [[GType]]
52 * Convert a GType to a Type. This always returns a Just if the GType was
53 * constructed using the gType generic function
56 * @result a type on success
58 gTypeToType :: GType -> Type
61 * Gives the name for the type
63 typeName :: Type -> String
66 * Predicate whether the outer type is a builtin type
68 class isBuiltin a :: a -> Bool
69 instance isBuiltin Type, GType
72 * Predicate whether the outer type is a basic type
73 * Int, Bool, Char, Real, World, File, Dynamic
75 class isBasic a :: a -> Bool
76 instance isBasic Type, GType
79 * Replace builtin constructors with their pretty names
81 class replaceBuiltins a :: a -> a
82 instance replaceBuiltins Type, GType, GenType
85 * Creates a deep representation of the type
87 generic gType a :: Box GType a
88 derive gType UNIT, EITHER, PAIR, CONS of gcd, FIELD of gfd, OBJECT of gtd, RECORD of grd
89 derive gType Int, Bool, Real, Char, World, Dynamic, File
91 derive gType /*?#,*/ ?, ?^
92 derive gType [], [! ], [ !], [!!], [#], [#!], {}, {!}, {#}, {32#}
93 derive gType (), (,), (,,), (,,,), (,,,,), (,,,,,), (,,,,,,), (,,,,,,,)