
(My application is a haskell to java compiler, btw; I need the type for the proper use of generics in java.)
In that case why not just use the types attached with the CoreExprs? http://goto.ucsd.edu/~rjhala/ghc/html/libraries/ghc-7.1.20110517/CoreUtils.h... Just use GHC to crunch your haskell source to Core, and then use exprType? I have been wrestling with a similar issue (extracting source level types with minimal effort) a much simpler setting. The hack I use is to tweak the deSugaring process to add SrcSpan to each desugared expression: 1. I've added a "CoreLoc SrcSpan" constructor to the Note type http://goto.ucsd.edu/~rjhala/ghc/html/libraries/ghc-7.1.20110517/CoreSyn.htm... 2. I've changed: dsLExpr so that it wraps a SrcSpan around the desugared expression http://goto.ucsd.edu/~rjhala/ghc/html/libraries/ghc-7.1.20110517/src/DsExpr.... 3. Now you can walk over the final CoreExpr, and build a map from SrcSpan -> Type (exprType gives you the type of each coreExpr), and when you "join" that with Source-Expression-SrcSpan map then you should get the types of the (located) expressions ... Its a total hack but it allows one to operate only with the simple CoreExprs :)
Thanks again, Sven
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users