| Safe Haskell | Safe | 
|---|---|
| Language | Haskell2010 | 
Typeable
Contents
Synopsis
- class Typeable (a :: k)
 - cast :: (Typeable a, Typeable b) => a -> Maybe b
 - eqT :: (Typeable a, Typeable b) => Maybe (a :~: b)
 - gcast :: (Typeable a, Typeable b) => c a -> Maybe (c b)
 - gcast1 :: (Typeable t, Typeable t') => c (t a) -> Maybe (c (t' a))
 - gcast2 :: (Typeable t, Typeable t') => c (t a b) -> Maybe (c (t' a b))
 - data TypeRep (a :: k) :: forall k. k -> *
 - typeRep :: Typeable a => TypeRep a
 - typeOf :: Typeable a => a -> TypeRep a
 - withTypeable :: TypeRep a -> (Typeable a -> r) -> r
 - pattern App :: forall k2 (t :: k2). () => forall k1 (a :: k1 -> k2) (b :: k1). t ~ a b => TypeRep a -> TypeRep b -> TypeRep t
 - pattern Con :: forall k (a :: k). () => IsApplication a ~ "" => TyCon -> TypeRep a
 - pattern Con' :: forall k (a :: k). () => IsApplication a ~ "" => TyCon -> [SomeTypeRep] -> TypeRep a
 - pattern Fun :: forall k (fun :: k). () => forall (r1 :: RuntimeRep) (r2 :: RuntimeRep) (arg :: TYPE r1) (res :: TYPE r2). (k ~ Type, fun ~~ (arg -> res)) => TypeRep arg -> TypeRep res -> TypeRep fun
 - typeRepTyCon :: TypeRep a -> TyCon
 - rnfTypeRep :: TypeRep a -> ()
 - eqTypeRep :: TypeRep a -> TypeRep b -> Maybe (a :~~: b)
 - typeRepKind :: TypeRep a -> TypeRep k
 - splitApps :: TypeRep a -> (TyCon, [SomeTypeRep])
 - data SomeTypeRep where
 - someTypeRep :: Typeable a => proxy a -> SomeTypeRep
 - someTypeRepTyCon :: SomeTypeRep -> TyCon
 - rnfSomeTypeRep :: SomeTypeRep -> ()
 - data TyCon
 - tyConPackage :: TyCon -> String
 - tyConModule :: TyCon -> String
 - tyConName :: TyCon -> String
 - rnfTyCon :: TyCon -> ()
 - data Module
 - moduleName :: Module -> String
 - modulePackage :: Module -> String
 - rnfModule :: Module -> ()
 - _cast :: (Typeable s, Typeable a) => Traversal' s a
 - _gcast :: (Typeable s, Typeable a) => Traversal' (c s) (c a)
 
Documentation
The class Typeable allows a concrete representation of a type to
 be calculated.
Minimal complete definition
typeRep#
eqT :: (Typeable a, Typeable b) => Maybe (a :~: b) #
Extract a witness of equality of two types
Since: base-4.7.0.0
gcast :: (Typeable a, Typeable b) => c a -> Maybe (c b) #
A flexible variation parameterised in a type constructor
data TypeRep (a :: k) :: forall k. k -> * #
A concrete representation of a (monomorphic) type.
 TypeRep supports reasonably efficient equality.
Instances
| TestEquality (TypeRep :: k -> *) | |
Defined in Data.Typeable.Internal  | |
| Eq (TypeRep a) | Since: base-2.1  | 
| Ord (TypeRep a) | Since: base-4.4.0.0  | 
| Show (TypeRep a) | |
| Hashable (TypeRep a) | |
Defined in Data.Hashable.Class  | |
| Typeable a => Serialise (TypeRep a) | Since: serialise-0.2.0.0  | 
pattern App :: forall k2 (t :: k2). () => forall k1 (a :: k1 -> k2) (b :: k1). t ~ a b => TypeRep a -> TypeRep b -> TypeRep t #
A type application.
For instance,
typeRep @(Maybe Int) === App (typeRep @Maybe) (typeRep @Int)
Note that this will also match a function type,
typeRep @(Int# -> Char) === App (App arrow (typeRep @Int#)) (typeRep @Char)
where arrow :: TypeRep ((->) :: TYPE IntRep -> Type -> Type).
pattern Con :: forall k (a :: k). () => IsApplication a ~ "" => TyCon -> TypeRep a #
Pattern match on a type constructor
pattern Con' :: forall k (a :: k). () => IsApplication a ~ "" => TyCon -> [SomeTypeRep] -> TypeRep a #
Pattern match on a type constructor including its instantiated kind variables.
For instance,
App (Con' proxyTyCon ks) intRep = typeRep @(Proxy @Int)
will bring into scope,
proxyTyCon :: TyCon
ks         == [someTypeRep Type] :: [SomeTypeRep]
intRep     == typeRep Int
pattern Fun :: forall k (fun :: k). () => forall (r1 :: RuntimeRep) (r2 :: RuntimeRep) (arg :: TYPE r1) (res :: TYPE r2). (k ~ Type, fun ~~ (arg -> res)) => TypeRep arg -> TypeRep res -> TypeRep fun #
The function type constructor.
For instance,
typeRep @(Int -> Char) === Fun (typeRep @Int) (typeRep @Char)
typeRepTyCon :: TypeRep a -> TyCon #
Observe the type constructor of a type representation
rnfTypeRep :: TypeRep a -> () #
Helper to fully evaluate TypeRep for use as NFData(rnf) implementation
Since: base-4.8.0.0
typeRepKind :: TypeRep a -> TypeRep k #
Observe the kind of a type.
splitApps :: TypeRep a -> (TyCon, [SomeTypeRep]) #
data SomeTypeRep where #
A non-indexed type representation.
Constructors
| SomeTypeRep :: SomeTypeRep | 
Instances
someTypeRep :: Typeable a => proxy a -> SomeTypeRep #
Takes a value of type a and returns a concrete representation
 of that type.
Since: base-4.7.0.0
someTypeRepTyCon :: SomeTypeRep -> TyCon #
Observe the type constructor of a quantified type representation.
rnfSomeTypeRep :: SomeTypeRep -> () #
Helper to fully evaluate SomeTypeRep for use as NFData(rnf)
 implementation
Since: base-4.10.0.0
tyConPackage :: TyCon -> String #
tyConModule :: TyCon -> String #
moduleName :: Module -> String #
modulePackage :: Module -> String #
Helper to fully evaluate TyCon for use as NFData(rnf) implementation
Since: base-4.8.0.0
Optics
_cast :: (Typeable s, Typeable a) => Traversal' s a #
A Traversal' for working with a cast of a Typeable value.
_gcast :: (Typeable s, Typeable a) => Traversal' (c s) (c a) #
A Traversal' for working with a gcast of a Typeable value.