Changes between Version 3 and Version 4 of MultiWayIf


Ignore:
Timestamp:
Dec 3, 2005 8:53:13 AM (10 years ago)
Author:
malcolm.wallace@…
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • MultiWayIf

    v3 v4  
    1010}}}
    1111
    12 this is very powerful in conjunction with PatternGuards, incedentally.  But it's ugly.  I propose a simpler form:
     12this is very powerful in conjunction with PatternGuards, incidentally.  But it's ugly.  I propose a simpler form:
    1313
    1414{{{
     
    2727
    2828  * LambdaCase
     29
     30== Observations ==
     31
     32Currently, guards are permitted at the definition clause level.  But this proposal can be viewed as permitting guards at the expression level too.  In the spirit of reducing unnecessary duplication, it would then be possible to remove definition-level guards from the language.  The current form
     33{{{
     34foo (x:xs)
     35    | x < n  = ...
     36    | x > n  = ...
     37}}}
     38can be straightforwardly replaced by
     39{{{
     40foo (x:xs) = case
     41    | x < n  -> ...
     42    | x > n  -> ...
     43}}}
     44Note the change in the equals sign, from one per guard to one per clause.  Case-style alternatives use -> instead of =.  However, this removal would break old programs.