Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Dynamic
A value of type Dynamic
is an object encapsulated together with its type.
A Dynamic
may only represent a monomorphic value; an attempt to
create a value of type Dynamic
from a polymorphically-typed
expression will result in an ambiguity error (see toDyn
).
Show
ing a value of type Dynamic
returns a pretty-printed representation
of the object's type; useful for debugging.
Instances
Show Dynamic | Since: base-2.1 |
Exception Dynamic | Since: base-4.0.0.0 |
Defined in Data.Dynamic toException :: Dynamic -> SomeException # fromException :: SomeException -> Maybe Dynamic # displayException :: Dynamic -> String # |
toDyn :: Typeable a => a -> Dynamic #
Converts an arbitrary value into an object of type Dynamic
.
The type of the object must be an instance of Typeable
, which
ensures that only monomorphically-typed objects may be converted to
Dynamic
. To convert a polymorphic object into Dynamic
, give it
a monomorphic type signature. For example:
toDyn (id :: Int -> Int)
dynTypeRep :: Dynamic -> SomeTypeRep #