<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 17, 2015 at 1:14 PM, Alexander Berntsen <span dir="ltr"><<a href="mailto:alexander@plaimi.net" target="_blank">alexander@plaimi.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">-----BEGIN PGP SIGNED MESSAGE-----<br>
Hash: SHA256<br>
<span class=""><br>
On 17/02/15 05:30, Greg Weber wrote:<br>
> I had an idea whose goal is to ease people into Foldable,<br>
> Traversable, etc. There could be a notation that shows the<br>
> generalization that is occurring.<br>
><br>
> map :: Functor [_] => (a -> b) -> [a] -> [b]<br>
><br>
> This means that the syntax for the list type is now syntax for the<br>
> variable created by the Functor constraint.<br>
</span>I don't know how useful this is by itself.<br>
<br>
What I *really* want is list-style syntax sugar for pattern matching. I.e.<br>
<br>
  f = \xs  -> case xs of<br>
    []     -> foo<br>
    [x]    -> bar x<br>
    [x:y]  -> fu  x y<br>
    (x:xs) -> baz x xs<br>
<br></blockquote><div> </div><div>The existing IsList machinery gets you the [], [x], and [x,y] cases, but not (x:xs).</div><div><br></div><div>-Edward</div></div></div></div>