
31 Jul
2009
31 Jul
'09
3:07 a.m.
Hello Eduard, Friday, July 31, 2009, 10:26:08 AM, you wrote:
instance Num a => Num [a] where ...
But why then the following snippet doesn't cause ambiguity:
deep_fmap (++"a") "b" // -> "ba" deep_fmap (++"a") ["b"] // -> ["ba"] deep_fmap (++"a") [["b"]] // -> [["ba"]]
because it doesn't involve any instances. if you will declare class Appendable a where (++) :: a -> a -> a instance Appendable String ... instance Appendable a => Appendable [a] ... instance IsString [a] ... -- class IsString, like class Num, defines conversion rules for string constants you will get into the same trouble -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com