Safe Haskell | None |
---|

A wrapper for the new GHC (and Hugs) Dynamic module. The main improvement over the original Dynamic module is that we provide flavours of TypeableXXXX for kinds with arguments other than *, a feature used by DisplayView.

- class Typeable a where
- data TypeRep
- type Dyn = Dynamic
- toDyn :: Typeable a => a -> Dyn
- fromDynamic :: Typeable a => Dyn -> Maybe a
- fromDynamicWE :: Typeable a => Dyn -> WithError a
- coerce :: Typeable a => Dyn -> a
- coerceIO :: Typeable a => Dyn -> IO a
- typeMismatch :: IOError
- dynCast :: (Typeable a, Typeable b) => String -> a -> b
- dynCastOpt :: (Typeable a, Typeable b) => a -> Maybe b

# Documentation

class Typeable a where

The class `Typeable`

allows a concrete representation of a type to
be calculated.

data TypeRep

A concrete representation of a (monomorphic) type. `TypeRep`

supports reasonably efficient equality.

fromDynamic :: Typeable a => Dyn -> Maybe aSource

fromDynamicWE :: Typeable a => Dyn -> WithError aSource

Like `fromDynamic`

but provides an error message indicating what
types are getting confused.

dynCastOpt :: (Typeable a, Typeable b) => a -> Maybe bSource