automate extraction to Haskell