[Haskell] Type inference for arbitrary rank types