projects
/
ghc-base.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[project @ 2005-04-12 12:57:49 by ross]
[ghc-base.git]
/
Data
/
Dynamic.hs
diff --git
a/Data/Dynamic.hs
b/Data/Dynamic.hs
index
a43cc18
..
933224c
100644
(file)
--- a/
Data/Dynamic.hs
+++ b/
Data/Dynamic.hs
@@
-1,4
+1,4
@@
-{-# OPTIONS -fno-implicit-prelude #-}
+{-# OPTIONS_GHC -fno-implicit-prelude #-}
-----------------------------------------------------------------------------
-- |
-- Module : Data.Dynamic
-----------------------------------------------------------------------------
-- |
-- Module : Data.Dynamic
@@
-34,7
+34,8
@@
module Data.Dynamic
-- * Applying functions of dynamic type
dynApply,
-- * Applying functions of dynamic type
dynApply,
- dynApp
+ dynApp,
+ dynTypeRep
) where
) where
@@
-141,7
+142,7
@@
fromDyn (Dynamic t v) def
fromDynamic
:: Typeable a
=> Dynamic -- ^ the dynamically-typed object
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) =
-- object has the correct type (and @a@ is its value),
-- or 'Nothing' otherwise.
fromDynamic (Dynamic t v) =
@@
-162,3
+163,6
@@
dynApp f x = case dynApply f x of
Nothing -> error ("Type error in dynamic application.\n" ++
"Can't apply function " ++ show f ++
" to argument " ++ show x)
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