
31 Jul
2009
31 Jul
'09
2:26 a.m.
Ryan Ingram wrote:
The problem is this:
instance Num a => Num [a] where ...
test = deep_fmap (+1) [[[ 1, 2, 3 :: Int ]]]
What (+1) should be used?
(+1) :: Int -> Int (+1) :: [Int] -> [Int] (+1) :: [[Int]] -> [[Int]] (+1) :: [[[Int]]] -> [[[Int]]]
They could all be type-correct, so the snippet is ambiguous.
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"]] -- View this message in context: http://www.nabble.com/Deepest-polymorphic-functor-tp24709303p24751663.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.