[Haskell-cafe] About understanding FunBind in haskell-src-exts.

Magicloud Magiclouds magicloud.magiclouds at gmail.com
Sat Dec 29 11:39:44 UTC 2018


Hi,

I can see the case of one FunBind contains multiple Matches, like this one.

But I cannot see why the "name" (isJust) is in Match, instead of
FunBind. Are there cases other than yours that a few functions having
different names should be grouped together?

PS: FunBind and Match definitions:

FunBind l [Match l]

Match l (Name l) [Pat l] (Rhs l) (Maybe (Binds l))

On Sat, Dec 29, 2018 at 6:56 PM Alan & Kim Zimmerman
<alan.zimm at gmail.com> wrote:
>
> This is for the case when you have a function like
>
> isJust Nothing = False
> isJust (Maybe _) = True
>
> This is a single FunBind for isJust, but has two Matches
>
> Alan
>
> On Sat, 29 Dec 2018 at 12:25, Magicloud Magiclouds <magicloud.magiclouds at gmail.com> wrote:
>>
>> Hi,
>>
>> Recently I am playing with haskell-src-exts to help understanding
>> Haskell syntax more. Then I got this question.
>>
>> As top level declarations (the type Decl), TypeSig, PatBind are quite
>> straight forward, they mean one item in the source. But `FunBind l
>> [Match l]
>> `, I could not see it maps to "one item" in the source.
>>
>> Apparently, the list of Match can hold a few non-related functions
>> with different names. Then why a FunBind to hold them together?
>>
>> --
>> 竹密岂妨流水过
>> 山高哪阻野云飞
>> _______________________________________________
>> Haskell-Cafe mailing list
>> To (un)subscribe, modify options or view archives go to:
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>> Only members subscribed via the mailman list are allowed to post.



-- 
竹密岂妨流水过
山高哪阻野云飞

And for G+, please use magiclouds#gmail.com.


More information about the Haskell-Cafe mailing list