+++ /dev/null
-definition module Data.GenType
-
-import StdGeneric
-from StdOverloaded import class ==, class toString
-
-:: Box b a =: Box b
-derive bimap Box
-unBox (Box b) :== b
-box b :== Box b
-reBox x :== box (unBox x)
-
-:: GType
- = GTyBasic BasicType
- | GTyRef String
- | GTyArrow GType GType
- | GTyArray ArrayType GType
- | GTyUList UListType GType
- | GTyUMaybe GType
- | GTyUnit
- | GTyEither GType GType
- | GTyPair GType GType
- | GTyCons GenericConsDescriptor GType
- | GTyField GenericFieldDescriptor GType
- | GTyObject GenericTypeDefDescriptor GType
- | GTyRecord GenericRecordDescriptor GType
-
-:: Type
- = TyBasic BasicType
- | TyRef String
- | TyArrow Type Type
- | TyArray ArrayType Type
- | TyUList UListType Type
- | TyUMaybe Type
- | TyNewType GenericTypeDefDescriptor GenericConsDescriptor Type
- | TyObject GenericTypeDefDescriptor [(GenericConsDescriptor, [Type])]
- | TyRecord GenericRecordDescriptor [(GenericFieldDescriptor, Type)]
-
-:: BasicType = BTInt | BTChar | BTReal | BTBool | BTDynamic | BTFile | BTWorld
-:: ArrayType = AStrict | ALazy | AUnboxed | APacked
-:: UListType = ULLazy | ULStrict
-
-instance == GType, Type, BasicType, ArrayType, UListType, GenType
-instance toString GType, Type, BasicType, ArrayType, UListType, GenType
-
-/**
- * Removes recursive types by replacing them with references
- *
- * @param gtype
- * @result the main type
- * @result all the separate types grouped in the strongly connected components
- */
-flattenGType :: GType -> [[GType]]
-
-/**
- * Convert a GType to a Type. This always returns a Just if the GType was
- * constructed using the gType generic function
- *
- * @param gtype
- * @result a type on success
- */
-gTypeToType :: GType -> Type
-
-/**
- * Gives the name for the type
- */
-typeName :: Type -> String
-
-/**
- * Gives the genType for a type
- */
-typeGenType :: Type -> [GenType]
-
-/**
- * Return the kind of the type
- */
-:: Kind = KStar | (KArrow) infixr 1 Kind Kind
-genTypeKind :: GenType -> Kind
-
-/**
- * Predicate whether the outer type is a builtin type
- */
-class isBuiltin a :: a -> Bool
-instance isBuiltin Type, GType
-
-/**
- * Predicate whether the outer type is a basic type
- * Int, Bool, Char, Real, World, File, Dynamic
- */
-class isBasic a :: a -> Bool
-instance isBasic Type, GType
-
-/**
- * Replace builtin constructors with their pretty names
- */
-class replaceBuiltins a :: a -> a
-instance replaceBuiltins Type, GType, GenType
-
-/**
- * Creates a deep representation of the type
- */
-generic gType a :: Box GType a
-derive gType UNIT, EITHER, PAIR, CONS of gcd, FIELD of gfd, OBJECT of gtd, RECORD of grd
-derive gType Int, Bool, Real, Char, World, File
-derive gType (->)
-derive gType ?#, ?, ?^
-derive gType [], [! ], [ !], [!!], [#], [#!], {}, {!}, {#}, {32#}
-derive gType (), (,), (,,), (,,,), (,,,,), (,,,,,), (,,,,,,), (,,,,,,,)