I'm not sure whether this is expected to work, but I thought it was:
-- count :: Int -> Int
count x = x
length :: List a -> Int
length = ...
-- count :: List a -> Int
count x = length x
With the type specifications, this is fine because unify gives the right answer. Without them, both are a -> b, which means count 1 is ambiguous and we never try either of them. It seems like we could make this work by attempting an entire inference pass on all possibilities in this case, but maybe we don't want to?
I'm not sure whether this is expected to work, but I thought it was:
With the type specifications, this is fine because unify gives the right answer. Without them, both are
a -> b, which meanscount 1is ambiguous and we never try either of them. It seems like we could make this work by attempting an entire inference pass on all possibilities in this case, but maybe we don't want to?