renamed: derivedFor to derivedClasses; new function: isAlgTyCon; NewOrData(..) and Arity(..) moved to BasicTypes
SYN_IE(Arity), NewOrData(..),
isFunTyCon, isPrimTyCon, isBoxedTyCon,
SYN_IE(Arity), NewOrData(..),
isFunTyCon, isPrimTyCon, isBoxedTyCon,
- isDataTyCon, isSynTyCon, isNewTyCon, maybeNewTyCon,
+ isAlgTyCon, isDataTyCon, isSynTyCon, isNewTyCon, maybeNewTyCon,
maybeTyConSingleCon,
isEnumerationTyCon, isTupleTyCon,
maybeTyConSingleCon,
isEnumerationTyCon, isTupleTyCon,
) where
CHK_Ubiq() -- debugging consistency check
) where
CHK_Ubiq() -- debugging consistency check
--LATER: specMaybeTysSuffix
)
--LATER: specMaybeTysSuffix
)
+import BasicTypes ( SYN_IE(Arity), NewOrData(..) )
import TyVar ( GenTyVar, alphaTyVars, alphaTyVar, betaTyVar, SYN_IE(TyVar) )
import Usage ( GenUsage, SYN_IE(Usage) )
import Kind ( Kind, mkBoxedTypeKind, mkArrowKind, resultKind, argKind )
import TyVar ( GenTyVar, alphaTyVars, alphaTyVar, betaTyVar, SYN_IE(TyVar) )
import Usage ( GenUsage, SYN_IE(Usage) )
import Kind ( Kind, mkBoxedTypeKind, mkArrowKind, resultKind, argKind )
import Lex ( mkTupNameStr )
import SrcLoc ( SrcLoc, mkBuiltinSrcLoc )
import Util ( nOfThem, isIn, Ord3(..), panic, panic#, assertPanic )
import Lex ( mkTupNameStr )
import SrcLoc ( SrcLoc, mkBuiltinSrcLoc )
import Util ( nOfThem, isIn, Ord3(..), panic, panic#, assertPanic )
---import {-hide me-}
--- PprType (pprTyCon)
---import {-hide me-}
--- PprStyle--ToDo:rm
data TyCon
= FunTyCon -- Kind = Type -> Type -> Type
data TyCon
= FunTyCon -- Kind = Type -> Type -> Type
Type -- Right-hand side, mentioning these type vars.
-- Acts as a template for the expansion when
-- the tycon is applied to some types.
Type -- Right-hand side, mentioning these type vars.
-- Acts as a template for the expansion when
-- the tycon is applied to some types.
-
-data NewOrData
- = NewType -- "newtype Blah ..."
- | DataType -- "data Blah ..."
-- isBoxedTyCon is just the negation of isPrimTyCon.
isBoxedTyCon = not . isPrimTyCon
-- isBoxedTyCon is just the negation of isPrimTyCon.
isBoxedTyCon = not . isPrimTyCon
+-- isAlgTyCon returns True for both @data@ and @newtype@
+isAlgTyCon (DataTyCon _ _ _ _ _ _ _ _) = True
+isAlgTyCon (TupleTyCon _ _ _) = True
+isAlgTyCon other = False
+
-- isDataTyCon returns False for @newtype@.
-- isDataTyCon returns False for @newtype@.
--- Not sure about this decision yet.
isDataTyCon (DataTyCon _ _ _ _ _ _ _ DataType) = True
isDataTyCon (TupleTyCon _ _ _) = True
isDataTyCon other = False
isDataTyCon (DataTyCon _ _ _ _ _ _ _ DataType) = True
isDataTyCon (TupleTyCon _ _ _) = True
isDataTyCon other = False
ToDo: what about derivings for specialised tycons !!!
\begin{code}
ToDo: what about derivings for specialised tycons !!!
\begin{code}
-derivedFor :: Class -> TyCon -> Bool
-derivedFor clas (DataTyCon _ _ _ _ _ _ derivs _) = isIn "derivedFor" clas derivs
-derivedFor clas something_weird = False
+derivedClasses :: TyCon -> [Class]
+derivedClasses (DataTyCon _ _ _ _ _ _ derivs _) = derivs
+derivedClasses something_weird = []
\end{code}
%************************************************************************
\end{code}
%************************************************************************