[Haskell-cafe] Haskell function composition commutivity?

Tom Smeding x at tomsmeding.com
Tue Apr 13 18:02:06 UTC 2021


(Viktor: sorry for the duplicate...)

Does it make a difference? To me the following function type signatures
mean exactly the same thing:

     foo :: (a -> b) -> f b
     foo :: forall a. (a -> b) -> f b
     foo :: forall b. (a -> b) -> f b
     foo :: forall a b. (a -> b) -> f b

This of course changes when the `forall` is put inside the parentheses
(though I don't think you meant that -- but I'm not a category
theorist), or if ScopedTypeVariables is used nontrivially, or... etc.

Although, because of the fact that you omitted 'Functor f =>' and
instead chose to write the constraint in prose beforehand, I get the
feeling that you may be speaking mathematically, not about Haskell as
compiled by GHC.

- Tom

On 13/04/2021 19:29, Viktor Dukhovni wrote:
>
> On Tue, Apr 13, 2021 at 01:06:41PM -0400, Viktor Dukhovni wrote:
>
>> - Yoneda Lemma: Given a functor f and some function `foo`
>>    with signature:
>>
>>        foo :: forall a. (a -> b) -> f b
>
> Sorry, typo, should be:
>
>      foo :: forall b. (a -> b) -> f b
>
> --
>      Viktor.
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
>



More information about the Haskell-Cafe mailing list