Copyright | (c) The University of Glasgow, CWI 2001--2004 |
---|---|
License | BSD-style (see the file libraries/base/LICENSE) |
Maintainer | libraries@haskell.org |
Stability | experimental |
Portability | portable |
Safe Haskell | Trustworthy |
Language | Haskell2010 |
Deprecated: Use Data.Typeable instead
This module defines the old, kind-monomorphic Typeable
class. It is now
deprecated; users are recommended to use the kind-polymorphic
Data.Typeable module instead.
Since: 4.7.0.0
- class Typeable a where
- cast :: (Typeable a, Typeable b) => a -> Maybe b
- gcast :: (Typeable a, Typeable b) => c a -> Maybe (c b)
- data TypeRep
- showsTypeRep :: TypeRep -> ShowS
- data TyCon
- tyConString :: TyCon -> String
- tyConPackage :: TyCon -> String
- tyConModule :: TyCon -> String
- tyConName :: TyCon -> String
- mkTyCon :: String -> TyCon
- mkTyCon3 :: String -> String -> String -> TyCon
- mkTyConApp :: TyCon -> [TypeRep] -> TypeRep
- mkAppTy :: TypeRep -> TypeRep -> TypeRep
- mkFunTy :: TypeRep -> TypeRep -> TypeRep
- splitTyConApp :: TypeRep -> (TyCon, [TypeRep])
- funResultTy :: TypeRep -> TypeRep -> Maybe TypeRep
- typeRepTyCon :: TypeRep -> TyCon
- typeRepArgs :: TypeRep -> [TypeRep]
- typeRepKey :: TypeRep -> IO TypeRepKey
- data TypeRepKey
- class Typeable1 t where
- class Typeable2 t where
- class Typeable3 t where
- class Typeable4 t where
- class Typeable5 t where
- class Typeable6 t where
- class Typeable7 t where
- gcast1 :: (Typeable1 t, Typeable1 t') => c (t a) -> Maybe (c (t' a))
- gcast2 :: (Typeable2 t, Typeable2 t') => c (t a b) -> Maybe (c (t' a b))
- typeOfDefault :: forall t a. (Typeable1 t, Typeable a) => t a -> TypeRep
- typeOf1Default :: forall t a b. (Typeable2 t, Typeable a) => t a b -> TypeRep
- typeOf2Default :: forall t a b c. (Typeable3 t, Typeable a) => t a b c -> TypeRep
- typeOf3Default :: forall t a b c d. (Typeable4 t, Typeable a) => t a b c d -> TypeRep
- typeOf4Default :: forall t a b c d e. (Typeable5 t, Typeable a) => t a b c d e -> TypeRep
- typeOf5Default :: forall t a b c d e f. (Typeable6 t, Typeable a) => t a b c d e f -> TypeRep
- typeOf6Default :: forall t a b c d e f g. (Typeable7 t, Typeable a) => t a b c d e f g -> TypeRep
The Typeable class
The class Typeable
allows a concrete representation of a type to
be calculated.
Typeable Bool | |
Typeable Char | |
Typeable Double | |
Typeable Float | |
Typeable Int | |
Typeable Int8 | |
Typeable Int16 | |
Typeable Int32 | |
Typeable Int64 | |
Typeable Integer | |
Typeable Ordering | |
Typeable RealWorld | |
Typeable Word | |
Typeable Word8 | |
Typeable Word16 | |
Typeable Word32 | |
Typeable Word64 | |
Typeable () | |
Typeable TyCon | |
Typeable TypeRep | |
(Typeable1 s, Typeable a) => Typeable (s a) | One Typeable instance for all Typeable1 instances |
Type-safe cast
gcast :: (Typeable a, Typeable b) => c a -> Maybe (c b) Source
A flexible variation parameterised in a type constructor
Type representations
A concrete representation of a (monomorphic) type. TypeRep
supports reasonably efficient equality.
showsTypeRep :: TypeRep -> ShowS Source
tyConString :: TyCon -> String Source
Observe string encoding of a type representation
tyConPackage :: TyCon -> String Source
tyConModule :: TyCon -> String Source
Construction of type representations
:: String | package name |
-> String | module name |
-> String | the name of the type constructor |
-> TyCon | A unique |
Builds a TyCon
object representing a type constructor. An
implementation of Data.Typeable should ensure that the following holds:
A==A' ^ B==B' ^ C==C' ==> mkTyCon A B C == mkTyCon A' B' C'
mkTyConApp :: TyCon -> [TypeRep] -> TypeRep Source
Applies a type constructor to a sequence of types
mkFunTy :: TypeRep -> TypeRep -> TypeRep Source
A special case of mkTyConApp
, which applies the function
type constructor to a pair of types.
Observation of type representations
splitTyConApp :: TypeRep -> (TyCon, [TypeRep]) Source
Splits a type constructor application
typeRepTyCon :: TypeRep -> TyCon Source
Observe the type constructor of a type representation
typeRepArgs :: TypeRep -> [TypeRep] Source
Observe the argument types of a type representation
typeRepKey :: TypeRep -> IO TypeRepKey Source
The other Typeable classes
Note: The general instances are provided for GHC only.
Default instances
Note: These are not needed by GHC, for which these instances are generated by general instance declarations.
typeOfDefault :: forall t a. (Typeable1 t, Typeable a) => t a -> TypeRep Source
typeOf1Default :: forall t a b. (Typeable2 t, Typeable a) => t a b -> TypeRep Source
typeOf2Default :: forall t a b c. (Typeable3 t, Typeable a) => t a b c -> TypeRep Source
typeOf3Default :: forall t a b c d. (Typeable4 t, Typeable a) => t a b c d -> TypeRep Source
typeOf4Default :: forall t a b c d e. (Typeable5 t, Typeable a) => t a b c d e -> TypeRep Source
typeOf5Default :: forall t a b c d e f. (Typeable6 t, Typeable a) => t a b c d e f -> TypeRep Source