Commit 40c64c60 authored by Björn Peemöller 's avatar Björn Peemöller
Browse files

Fix for primitive type constructors

parent 23ba4e77
......@@ -253,38 +253,41 @@ There are a few predefined types:
\begin{verbatim}
> unitType :: Type
> unitType = TypeConstructor qUnitId []
> unitType = primType unitId []
> boolType :: Type
> boolType = TypeConstructor qBoolId []
> boolType = primType boolId []
> charType :: Type
> charType = TypeConstructor qCharId []
> charType = primType charId []
> intType :: Type
> intType = TypeConstructor qIntId []
> intType = primType intId []
> floatType :: Type
> floatType = TypeConstructor qFloatId []
> floatType = primType floatId []
> stringType :: Type
> stringType = listType charType
> successType :: Type
> successType = TypeConstructor qSuccessId []
> successType = primType successId []
> listType :: Type -> Type
> listType ty = TypeConstructor qListId [ty]
> listType ty = primType listId [ty]
> ioType :: Type -> Type
> ioType ty = TypeConstructor qIOId [ty]
> ioType ty = primType ioId [ty]
> tupleType :: [Type] -> Type
> tupleType tys = TypeConstructor (qTupleId (length tys)) tys
> tupleType tys = primType (tupleId (length tys)) tys
> typeVar :: Int -> Type
> typeVar = TypeVariable
> primType :: Ident -> [Type] -> Type
> primType = TypeConstructor . qualifyWith preludeMIdent
> predefTypes :: [(Type, [DataConstr])]
> predefTypes = let a = typeVar 0 in
> [ (unitType , [ DataConstr unitId 0 [] ])
......
......@@ -101,8 +101,16 @@ lookupTC tc tcEnv = lookupTopEnv tc tcEnv ++! lookupTupleTC tc
qualLookupTC :: QualIdent -> TCEnv -> [TypeInfo]
qualLookupTC tc tcEnv = qualLookupTopEnv tc tcEnv
++! qualLookupList tc tcEnv
++! lookupTupleTC (unqualify tc)
qualLookupList :: QualIdent -> TCEnv -> [TypeInfo]
qualLookupList tc tcEnv
| mmid == Just preludeMIdent && qid == listId
= qualLookupTopEnv (qualify qid) tcEnv
| otherwise = []
where (mmid, qid) = (qidModule tc, qidIdent tc)
lookupTupleTC :: Ident -> [TypeInfo]
lookupTupleTC tc | isTupleId tc = [tupleTCs !! (tupleArity tc - 2)]
| otherwise = []
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment