Implement Haskell Library to implement Sql function