Overloadable list type notation

Edward Kmett ekmett at gmail.com
Tue Feb 17 18:23:26 UTC 2015


map :: Functor [] => (a -> b) -> [a] -> [b]

already has existing, different, semantics today to what Greg is proposing
here.

It is asking for an instance of Functor for [] to be supplied.

Since that instance exists an is scope, the constraint is trivially
satisfied, so this collapses to

map :: (a -> b) -> [a] -> [b]

the signature we already have, with the semantics we already have.

-Edward

On Tue, Feb 17, 2015 at 3:38 AM, Henning Thielemann <
lemming at henning-thielemann.de> wrote:

>
>
> On Mon, 16 Feb 2015, 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.
>>
>
> Btw. there is already a prefix name for the list type constructor, namely
> '[]'. Thus I think your example would be:
>
>  map :: Functor [] => (a -> b) -> [a] -> [b]
>>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20150217/cf400b8b/attachment.html>


More information about the Libraries mailing list