2 ms·
Where is this comment coming from? That is, how much have you looked at what the tool does/written Haskell in the past? I think the key thing is that sometimes
by dan-robertson 5y ago
Where is this comment coming from? That is, how much have you looked at what the tool does/written Haskell in the past?
I think the key thing is that sometimes there are multiple ways to answer something. For example consider this type:
[Maybe a] -> [a]
It takes a list of optional values and returns non-optional values. The ‘obvious’ semantics in Haskell could be achieved with:
f [] = []
f (Nothing:xs) = f xs
f (Just x:xs) = x:f xs
And there are plenty of other ways to write that function. But you could also write functions like
g xs = []
h xs = reverse (f xs)
j [Just a, Just b] = [b, a, b]
j _ = []
And all three would satisfy the type above. So the type may be a sufficient input to the tool as the programmer may select the suggestion, but it wouldn’t be sufficient input to the compiler as the compiler could just guess the wrong thing.
- deleted 5y ago[deleted]