[Haskell] generic currying (type classes and functional dependencies)