-{-# OPTIONS -fno-implicit-prelude #-}
+{-# OPTIONS_GHC -fno-implicit-prelude #-}
-----------------------------------------------------------------------------
-- |
-- Module : Data.Dynamic
-- * Applying functions of dynamic type
dynApply,
- dynApp
+ dynApp,
+ dynTypeRep
) where
fromDynamic
:: Typeable a
=> Dynamic -- ^ the dynamically-typed object
- -> Maybe a -- ^ returns: @'Just' a@, if the dyanmically-typed
+ -> Maybe a -- ^ returns: @'Just' a@, if the dynamically-typed
-- object has the correct type (and @a@ is its value),
-- or 'Nothing' otherwise.
fromDynamic (Dynamic t v) =
Nothing -> error ("Type error in dynamic application.\n" ++
"Can't apply function " ++ show f ++
" to argument " ++ show x)
+
+dynTypeRep :: Dynamic -> TypeRep
+dynTypeRep (Dynamic tr _) = tr