[Haskell-cafe] Re: Re: Reflective capabilities of Haskell (cont'd)
Martin Hofmann
martin.hofmann at uni-bamberg.de
Wed Mar 12 05:04:50 EDT 2008
> Data.Typeable gives you most of what you want except for access to
> function bodies.
Thanks a lot, this helps a bit, but access to function bodies is exactly
what I need. Or being more precise, I need the functionality of ghci's
command ':t'. So functions that behave as follows, where everything is
of course meta-represented in some way as ADT:
Prelude Data.Typeable> typeOf (\a -> (Just (a:"")))
(\a -> (Just (a:""))) :: Char -> Maybe [Char]
Prelude Data.Typeable> getDomain $ typeOf (\a -> (Just (a:"")))
[Char]
Prelude Data.Typeable>getCodomain $ typeOf (\a -> (Just (a:"")))
(Maybe [Char])
Prelude Data.Typeable>getTypeConstructors (Maybe [Char])
[ (Just) :: [Char] -> Maybe [Char]
, (Nothing) :: Maybe [Char]
]
Prelude Data.Typeable>getTypeConstructors [Char]
[ (:) :: Char -> [Char] -> [Char]
, ([]) :: [Char]
]
I am much obliged for any kind of hint.
Cheers,
Martin
More information about the Haskell-Cafe
mailing list