
On January 17, 2011 16:20:22 Conor McBride wrote:
Ahem
: )
The unfortunate pain you pay for this additional power is manually having to specify the application (<$> and <*>) and merging (join). If the compiler could figure this all out for you based on the underlying types, wow!
To achieve such a thing, one would need to ensure a slightly more deliberate separation of "value" and "computation" in the presentation of types. In Haskell, we use, e.g., [Int], for
* pure computations of lists of integers * nondeterministic computations of integers
and we spend syntax (do-notation, lifting operators) to distinguish the two modes of usage. If every type was clearly decomposable into its computation and value components, the above possibilities would be distinct (but isomorphic) and we could spend less syntax on plumbing in programs.
I'm pretty sure I know what "pure computations of lists of integers" is, but I'm not so sure about "nondeterministic computations of integers". If it is not too much of an effort, could you clarify with a quick example? Thanks! -Tyson