Overloadable list type notation

Alexander Berntsen alexander at plaimi.net
Tue Feb 17 18:14:11 UTC 2015


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 17/02/15 05:30, Greg Weber wrote:
> I had an idea whose goal is to ease people into Foldable,
> Traversable, etc. There could be a notation that shows the
> generalization that is occurring.
> 
> map :: Functor [_] => (a -> b) -> [a] -> [b]
> 
> This means that the syntax for the list type is now syntax for the
> variable created by the Functor constraint.
I don't know how useful this is by itself.

What I *really* want is list-style syntax sugar for pattern matching. I.e.

  f = \xs  -> case xs of
    []     -> foo
    [x]    -> bar x
    [x:y]  -> fu  x y
    (x:xs) -> baz x xs

etc.
- -- 
Alexander
alexander at plaimi.net
https://secure.plaimi.net/~alexander
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iF4EAREIAAYFAlTjhPEACgkQRtClrXBQc7UFjQD+PU24bAdL6ju7cuK7UBN0bXyA
Sxw4KZJgStb4XHVZQ6QA/iN2RXs27gyx8smAkyh55i/lRhW8+axMIiFaYFTc3/3l
=EqYq
-----END PGP SIGNATURE-----


More information about the Libraries mailing list