Data flow optimisation using HOOPL

compiler-construction, haskell, hoopl

Solution

A good place to start is pulling the git repo, which has lots of additional files compared to what's on Hackage. Lookin the /testing subdirectory, and you can see some simple code defining a basic imperative language and some optimizations on it.

Problem

I am Haskell programmer ( I generally implement algorithms in Haskell ) and trying to understand HOOPL library but I am not able to decode it. I don't have compiler background ( currently learning from Coursera and Compilers: Principles, Techniques, and Tools ) and It would be great if you can suggest me a systematic way to proceed for understanding HOOPL library ( what is the prerequisite ). Lets say I have a small Haskell code on which I want to apply data flow optimization using HOOPL ``` add :: Int -> Int -> Int add x y = z where x' = 1 y' = 1 -- this will be dead code elimination z = x' + 1 ``` How to write HOOPL code to optimise this. It would be great if you can give a bit better example and pardon me if I sound stupid.

Original source