A Haskell based query generator