Changes between Version 13 and Version 14 of ViewPatterns


Ignore:
Timestamp:
Jan 25, 2007 8:57:35 AM (9 years ago)
Author:
simonpj
Comment:

Add the unfoldr example (suggested by Greg Fitzgerald)

Legend:

Unmodified
Added
Removed
Modified
  • ViewPatterns

    v13 v14  
    123123}}}
    124124Here the first argument `p` can be thought of as a pattern passed to `g`, which
    125 is used to match the second argument of `g`.
     125is used to match the second argument of `g`.
     126
     127Here is another rather cute example:
     128{{{
     129unfoldr :: (b -> Maybe (a, b)) -> b -> [a]
     130unfoldr f (f -> (a, b)) = a : unfoldr f b
     131unfoldr f other         = []
     132}}}
    126133
    127134=== Possible extension 1: multi-argument view patterns ===