the same as compil but written in haskell