
On Sat, Mar 29, 2014 at 12:13 AM, John M. Dlugosz
On 3/28/2014 6:56 PM, Brandon Allbery wrote:
The compiler doesn't see the different implementations as independent, and in fact doesn't
see multiple implementations of the function at all at type resolution
time; it's translated to a single function applying `case` to the parameters to determine which clause of the body to evaluate.
Can they be spread out among different source files or be discontiguous within one file?
Neither one; they must be together in the same file with nothing intervening, since they get rewritten into a single function. They also must all have the same number of parameters, even if one of them could take advantage of eta reduction (see http://www.haskell.org/haskellwiki/Eta_conversion), since the combination into a single function uses a common set of parameters. -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net