a simple implementation of sql queries in haskell