[Haskell-cafe] Haskell function composition commutivity?

Viktor Dukhovni ietf-dane at dukhovni.org
Tue Apr 13 18:14:48 UTC 2021


> On Apr 13, 2021, at 2:02 PM, Tom Smeding <x at tomsmeding.com> wrote:
> 
> 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.

Yes, mathematically, with Haskell-like syntax.  Also the
functors in question were intended to stand for specific
functors, rather than be universally quantified.

So perhaps better:

  Yoneda (with A some type and F some functor):

	foo :: forall b. (A -> b) -> F b

    <=> foo bar = fmap bar (foo (id @A)

-- 
	Viktor.



More information about the Haskell-Cafe mailing list