Haskell code for prototype generation