1 definition module Data.GenType
4 from StdMaybe import :: Maybe
10 reBox x :== box (unBox x)
15 | GTyArrow GType GType
16 | GTyArray ArrayType GType
17 | GTyUList UListType GType
19 | GTyEither GType GType
21 | GTyCons GenericConsDescriptor GType
22 | GTyField GenericFieldDescriptor GType
23 | GTyObject GenericTypeDefDescriptor GType
24 | GTyRecord GenericRecordDescriptor GType
30 | TyArray ArrayType Type
31 | TyUList UListType Type
32 | TyNewType GenericTypeDefDescriptor GenericConsDescriptor Type
33 | TyObject GenericTypeDefDescriptor [(GenericConsDescriptor, [Type])]
34 | TyRecord GenericRecordDescriptor [(GenericFieldDescriptor, Type)]
36 :: BasicType = BTInt | BTChar | BTReal | BTBool | BTDynamic | BTFile | BTWorld
37 :: ArrayType = AStrict | ALazy | AUnboxed | APacked
38 :: UListType = ULLazy | ULStrict
40 instance == GType, Type, BasicType, ArrayType, UListType, GenType
41 instance toString GType, Type, BasicType, ArrayType, UListType, GenType
44 * Removes recursive types by replacing them with references
47 * @result the main type
48 * @result all the separate types grouped in the strongly connected components
50 flattenGType :: GType -> [[GType]]
53 * Convert a GType to a Type. This always returns a Just if the GType was
54 * constructed using the gType generic function
57 * @result a type on success
59 gTypeToType :: GType -> Type
62 * Gives the name for the type
64 typeName :: Type -> String
67 * Predicate whether the outer type is a builtin type
69 class isBuiltin a :: a -> Bool
70 instance isBuiltin Type
71 instance isBuiltin GType
74 * Replace builtin constructors with their pretty names
76 class replaceBuiltins a :: a -> a
77 instance replaceBuiltins Type
78 instance replaceBuiltins GType
79 instance replaceBuiltins GenType
82 * Creates a deep representation of the type
84 generic gType a :: Box GType a
85 derive gType UNIT, EITHER, PAIR, CONS of gcd, FIELD of gfd, OBJECT of gtd, RECORD of grd
86 derive gType Int, Bool, Real, Char, World, Dynamic, File
88 derive gType /*?#,*/ ?, ?^
89 derive gType [], [! ], [ !], [!!], [#], [#!], {}, {!}, {#}, {32#}
90 derive gType (), (,), (,,), (,,,), (,,,,), (,,,,,), (,,,,,,), (,,,,,,,)