Cale Gibbard wrote:
apfelmus wrote:

Unfortunately, the identity functor currently can't be overloaded,
although I think it would be unambiguous.


Unfortunately, it would be quite ambiguous -- the identity functor
overlaps with basically any other. Consider the case:

    reverse . [[1,2,3],[4,5]]

which if (.) is fmap would normally mean [[3,2,1],[5,4]], but if the
identity functor is used instead would mean [[4,5],[1,2,3]].

Whoops, what I did think here? I somehow thought that the argument of the function applied ( reverse in this case) would fix the functor. But this only works if the function is monomorphic:

  (reverse :: [[Int]] -> [[Int]]) .  [[1,2,3],[4,5]]
  (reverse :: [Int] -> [Int]) .  [[1,2,3],[4,5]]

not if it's polymorphic.


Regards,
apfelmus

_______________________________________________
Haskell-prime mailing list
Haskell-prime@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-prime

Reply via email to