[Haskell] Mixing monadic and non-monadic functions
Benjamin.Rudiak-Gould at cl.cam.ac.uk
Sat Sep 17 07:19:28 EDT 2005
Bjorn Lisper wrote:
> However, there is a way to resolve the ambiguity that can be claimed to be
> the most natural one, and that is to always choose the "least possible"
> lifting. In the example above, this would mean to interpret []++[]
> precisely as []++[] (lift 0 levels) rather than [++] (lift 1
It's not the mathematics I'm worried about, it's the people. Consider the
"time flies like an arrow; fruit flies like a banana" example. What's
interesting about it is not just the existence of more than one parse, but
the fact that it's hard to even notice the other parses exist unless you're
looking for them, because people are so good at unconsciously resolving this
kind of ambiguity from context.
I'm afraid that once people get used to the idea that they can write
xs `op` ys and get implicit lifting, they will write xs ++ ys and never
notice that it has an unlifted interpretation which will take precedence.
This isn't the nastiest class of bug, but it's pretty nasty.
More information about the Haskell