Data.OldTypeable.Internal

base-4.7.0.0: Basic libraries

Copyright | (c) The University of Glasgow, CWI 2001--2011
License | BSD-style (see the file libraries/base/LICENSE)
Safe Haskell | Unsafe
Language | Haskell2010

Data.OldTypeable.Internal

Description

Deprecated: Use Data.Typeable.Internal instead

The representations of the types TyCon and TypeRep, and the function mkTyCon which is used by derived instances of Typeable to construct a TyCon.

Since: 4.7.0.0

Synopsis

- data TypeRep = TypeRep !Fingerprint TyCon [TypeRep]
- data TyCon = TyCon {
  - tyConHash :: !Fingerprint
  - tyConPackage :: String
  - tyConModule :: String
  - tyConName :: String
  }
- mkTyCon :: Word# -> Word# -> String -> String -> String -> TyCon
- mkTyCon3 :: String -> String -> String -> TyCon
- mkTyConApp :: TyCon -> [TypeRep] -> TypeRep
- mkAppTy :: TypeRep -> TypeRep -> TypeRep
- typeRepTyCon :: TypeRep -> TyCon
- 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
- class Typeable a where
  - typeOf :: a -> TypeRep
- class Typeable1 t where
  - typeOf1 :: t a -> TypeRep
- class Typeable2 t where
  - typeOf2 :: t a b -> TypeRep
- class Typeable3 t where
  - typeOf3 :: t a b c -> TypeRep
- class Typeable4 t where
  - typeOf4 :: t a b c d -> TypeRep
- class Typeable5 t where
  - typeOf5 :: t a b c d e -> TypeRep
- class Typeable6 t where
  - typeOf6 :: t a b c d e f -> TypeRep
- class Typeable7 t where
  - typeOf7 :: t a b c d e f g -> TypeRep
- mkFunTy :: TypeRep -> TypeRep -> TypeRep
- splitTyConApp :: TypeRep -> (TyCon, [TypeRep])
- funResultTy :: TypeRep -> TypeRep -> Maybe TypeRep
- typeRepArgs :: TypeRep -> [TypeRep]
- showsTypeRep :: TypeRep -> ShowS
- tyConString :: TyCon -> String
- listTc :: TyCon
- funTc :: TyCon

# Documentation

data TypeRep Source

A concrete representation of a (monomorphic) type. `TypeRep` supports reasonably efficient equality.

Constructors

TypeRep !Fingerprint TyCon [TypeRep] |

Instances

Eq TypeRep |
Ord TypeRep |
Show TypeRep |
Typeable TypeRep |

data TyCon Source

An abstract representation of a type constructor. `TyCon` objects can be built using `mkTyCon`.

Constructors

TyCon |
Fields tyConHash :: !Fingerprint tyConPackage :: String tyConModule :: String tyConName :: String

Instances

Eq TyCon |
Ord TyCon |
Show TyCon |
Typeable TyCon |

mkTyCon :: Word# -> Word# -> String -> String -> String -> TyCon Source

mkTyCon3 Source

Arguments

:: String | package name
-> String | module name
-> String | the name of the type constructor
-> TyCon | A unique `TyCon` object

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

mkAppTy :: TypeRep -> TypeRep -> TypeRep Source

Adds a TypeRep argument to a TypeRep.

typeRepTyCon :: TypeRep -> TyCon Source

Observe the type constructor of a type representation

typeOfDefault :: forall t a. (Typeable1 t, Typeable a) => t a -> TypeRep Source

For defining a `Typeable` instance from any `Typeable1` instance.

typeOf1Default :: forall t a b. (Typeable2 t, Typeable a) => t a b -> TypeRep Source

For defining a `Typeable1` instance from any `Typeable2` instance.

typeOf2Default :: forall t a b c. (Typeable3 t, Typeable a) => t a b c -> TypeRep Source

For defining a `Typeable2` instance from any `Typeable3` instance.

typeOf3Default :: forall t a b c d. (Typeable4 t, Typeable a) => t a b c d -> TypeRep Source

For defining a `Typeable3` instance from any `Typeable4` instance.

typeOf4Default :: forall t a b c d e. (Typeable5 t, Typeable a) => t a b c d e -> TypeRep Source

For defining a `Typeable4` instance from any `Typeable5` instance.

typeOf5Default :: forall t a b c d e f. (Typeable6 t, Typeable a) => t a b c d e f -> TypeRep Source

For defining a `Typeable5` instance from any `Typeable6` instance.

typeOf6Default :: forall t a b c d e f g. (Typeable7 t, Typeable a) => t a b c d e f g -> TypeRep Source

For defining a `Typeable6` instance from any `Typeable7` instance.

class Typeable a where Source

The class `Typeable` allows a concrete representation of a type to be calculated.

Methods

typeOf :: a -> TypeRep Source

Takes a value of type `a` and returns a concrete representation of that type. The value of the argument should be ignored by any instance of `Typeable`, so that it is safe to pass `undefined` as the argument.

Instances

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

class Typeable1 t where Source

Variant for unary type constructors

Methods

typeOf1 :: t a -> TypeRep Source

Instances

Typeable1 [] |
Typeable1 Ratio |
Typeable1 StablePtr |
Typeable1 IO |
Typeable1 Ptr |
Typeable1 FunPtr |
Typeable1 Maybe |
Typeable1 IORef |
Typeable1 MVar |
(Typeable2 s, Typeable a) => Typeable1 (s a) | One Typeable1 instance for all Typeable2 instances

class Typeable2 t where Source

Variant for binary type constructors

Methods

typeOf2 :: t a b -> TypeRep Source

Instances

Typeable2 (->) |
Typeable2 (,) |
Typeable2 ST |
Typeable2 STRef |
(Typeable3 s, Typeable a) => Typeable2 (s a) | One Typeable2 instance for all Typeable3 instances

class Typeable3 t where Source

Variant for 3-ary type constructors

Methods

typeOf3 :: t a b c -> TypeRep Source

Instances

Typeable3 (,,) |
(Typeable4 s, Typeable a) => Typeable3 (s a) | One Typeable3 instance for all Typeable4 instances

class Typeable4 t where Source

Variant for 4-ary type constructors

Methods

typeOf4 :: t a b c d -> TypeRep Source

Instances

Typeable4 (,,,) |
(Typeable5 s, Typeable a) => Typeable4 (s a) | One Typeable4 instance for all Typeable5 instances

class Typeable5 t where Source

Variant for 5-ary type constructors

Methods

typeOf5 :: t a b c d e -> TypeRep Source

Instances

Typeable5 (,,,,) |
(Typeable6 s, Typeable a) => Typeable5 (s a) | One Typeable5 instance for all Typeable6 instances

class Typeable6 t where Source

Variant for 6-ary type constructors

Methods

typeOf6 :: t a b c d e f -> TypeRep Source

Instances

Typeable6 (,,,,,) |
(Typeable7 s, Typeable a) => Typeable6 (s a) | One Typeable6 instance for all Typeable7 instances

class Typeable7 t where Source

Variant for 7-ary type constructors

Methods

typeOf7 :: t a b c d e f g -> TypeRep Source

Instances

Typeable7 (,,,,,,) |

mkFunTy :: TypeRep -> TypeRep -> TypeRep Source

A special case of `mkTyConApp`, which applies the function type constructor to a pair of types.

splitTyConApp :: TypeRep -> (TyCon, [TypeRep]) Source

Splits a type constructor application

funResultTy :: TypeRep -> TypeRep -> Maybe TypeRep Source

Applies a type to a function type. Returns: ``Just` u` if the first argument represents a function of type `t -> u` and the second argument represents a function of type `t`. Otherwise, returns `Nothing`.

typeRepArgs :: TypeRep -> [TypeRep] Source

Observe the argument types of a type representation

showsTypeRep :: TypeRep -> ShowS Source

tyConString :: TyCon -> String Source

Observe string encoding of a type representation

listTc :: TyCon Source

funTc :: TyCon Source