Streamline data using HOOPL

I am a Haskell programmer (I generally implement algorithms in Haskell ) and try to understand HOOPL but I cannot decrypt it. I don’t have a compiler background (currently learning from Coursera and Compilers: Principles, Techniques and Tools), and it would be great if you would offer me a systematic way to get started with understanding the HOOPL library (which is a prerequisite). Let's say I have a little Haskell code on which I want to apply data stream 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 optimize it. It would be great if you could give a little better example and have mercy on me if I seem stupid.

+5
source share
1 answer

A good place to start is to pull out the git repository, which has a lot of extra files compared to what was in Hackage. Lookin the / testing subdirectory, and you can see simple code defining a basic imperative language and some optimizations on it.

+5
source