Conal Elliott | 1 May 23:13 2013
Picon

Simplifying Core pretty-printing via GHC API?

I'm using the GHC API to compile Haskell source code to Core. I'd like to pretty-print the result with the sort of simplifications I get with -dsuppress-type-applications, -dsuppress-uniques, etc (used in combination with -ddump-simpl on ghc's command line). How can I set these options via the GHC API? Has the answer changed since 7.4.1 (which I'm currently using)?

Thanks.  - Conal
_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users <at> haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Johan Tibell | 2 May 00:59 2013
Picon

Re: Simplifying Core pretty-printing via GHC API?

On Wed, May 1, 2013 at 2:13 PM, Conal Elliott <conal <at> conal.net> wrote:
I'm using the GHC API to compile Haskell source code to Core. I'd like to pretty-print the result with the sort of simplifications I get with -dsuppress-type-applications, -dsuppress-uniques, etc (used in combination with -ddump-simpl on ghc's command line). How can I set these options via the GHC API? Has the answer changed since 7.4.1 (which I'm currently using)?

I'd also be interested in the answer and whatever you're working on Conal. I spend more time looking at core than I like and anything that can made that time more efficient would be great.
 
_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users <at> haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Conal Elliott | 2 May 03:28 2013
Picon

Re: Simplifying Core pretty-printing via GHC API?

I think I found an answer: invoke parseStaticFlags, passing in the flags specified as if on the ghc command line. For instance:

    parseStaticFlags $ noLoc <$> ["-dsuppress-uniques", "-dsuppress-type-applications", "-dsuppress-idinfo"]

This call must be made before a compilation gets made. I'm (now) doing it before calling runGhc for the first time.

Johan: I'm working toward making a GHC back-end that maps from Core to a programmable logic architecture (similar to FPGA).

-- Conal



On Wed, May 1, 2013 at 3:59 PM, Johan Tibell <johan.tibell <at> gmail.com> wrote:
On Wed, May 1, 2013 at 2:13 PM, Conal Elliott <conal <at> conal.net> wrote:
I'm using the GHC API to compile Haskell source code to Core. I'd like to pretty-print the result with the sort of simplifications I get with -dsuppress-type-applications, -dsuppress-uniques, etc (used in combination with -ddump-simpl on ghc's command line). How can I set these options via the GHC API? Has the answer changed since 7.4.1 (which I'm currently using)?

I'd also be interested in the answer and whatever you're working on Conal. I spend more time looking at core than I like and anything that can made that time more efficient would be great.
 

_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users <at> haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Gmane