[Haskell-beginners] Help on first program

Brandon Allbery allbery.b at gmail.com
Sat Mar 29 04:22:31 UTC 2014


On Sat, Mar 29, 2014 at 12:13 AM, John M. Dlugosz
<ngnr63q02 at sneakemail.com>wrote:

> 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 at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20140329/acc95013/attachment.html>


More information about the Beginners mailing list