ku-fpg / haskino

Our Arduino experiments
BSD 3-Clause "New" or "Revised" License
72 stars 4 forks source link

Added infix pattern synonym for 'App' #4

Closed roboguy13 closed 7 years ago

roboguy13 commented 7 years ago

Does this look ok? I had this when I was trying to make a GHC plugin. It allows you to avoid deeply nesting parentheses when matching on/constructing function applications with multiple arguments.

Note that it associates a bit differently than ($) (it associates in the opposite direction). It's just that, for now, (:$) is the best name I can think of. So something like

f :$ x :$ y

is identical to

App (App f x) y
markgrebe commented 7 years ago

Yes, that looks good. I was less than happy with that large pattern match, but it does seem to be the most efficient way to do things there. The infix pattern does make it much more readable, Thanks!!

Mark

On Mar 11, 2017, at 2:55 PM, David Young notifications@github.com<mailto:notifications@github.com> wrote:

Does this look ok? I had this when I was trying to make a GHC plugin. It allows you to avoid deeply nesting parentheses when matching on/constructing function applications with multiple arguments.


You can view, comment on, or merge this pull request online at:

https://github.com/ku-fpg/haskino/pull/4

Commit Summary

File Changes

Patch Links:

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/ku-fpg/haskino/pull/4, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AIT4PfvN24t9cuG-0fktefkHl9KfpOYMks5rkwoygaJpZM4MaVOT.