Bas van Dijk | 30 Aug 17:44 2013
Picon

Proposal: infixr 9 `Compose`

I was just bitten by the fact that the type constructor Compose from
Data.Functor.Compose associates to the left instead of to the right
like function composition.

I would like to propose adding the following to Data.Functor.Compose:

  infixr 9 `Compose`   -- analogous to the fixity of (.)

This will likely break existing code which uses Compose infix like in
the following type:

  a `Compose` b `Compose` c

Discussion deadline: 13 September 2013.

Bas
Ross Paterson | 30 Aug 18:45 2013
Picon

Re: Proposal: infixr 9 `Compose`

On Fri, Aug 30, 2013 at 05:44:57PM +0200, Bas van Dijk wrote:
> I was just bitten by the fact that the type constructor Compose from
> Data.Functor.Compose associates to the left instead of to the right
> like function composition.
> 
> I would like to propose adding the following to Data.Functor.Compose:
> 
>   infixr 9 `Compose`   -- analogous to the fixity of (.)

Hmm, in standard Haskell there are no infix type constructors, so this
just sets the fixity of the newtype constructor of the same name (which
of course can't be used infix either).  Though if it's imported by a
module with LANGUAGE TypeOperators the declared fixity is attached to
the type constructor too (in GHC).

So I guess it's harmless for standard Haskell code but may be useful
in GHC Haskell.
Bas van Dijk | 3 Sep 09:37 2013
Picon

Re: Proposal: infixr 9 `Compose`

On 30 August 2013 18:45, Ross Paterson <R.Paterson <at> city.ac.uk> wrote:
> So I guess it's harmless for standard Haskell code but may be useful
> in GHC Haskell.

Yes that was my thinking to.

For the record, I don't recommend writing code like this:

  {-# LANGUAGE TypeOperators #-}

  a `Compose` b `Compose` c

I would prefer to write the parenthesis explicitly.

However, following the principle of least surprise I do think that
type composition should associate in the same way as function
composition.

Bas
Bas van Dijk | 13 Sep 13:13 2013
Picon

Re: Proposal: infixr 9 `Compose`

The deadline for this has passed and no objections were raised.

Ross, do you like me to make a patch for transformers or do you like
to add the following to Data.Functor.Compose yourself?

 infixr 9 `Compose`   -- analogous to the fixity of (.)

Cheers,

Bas

On 30 August 2013 17:44, Bas van Dijk <v.dijk.bas <at> gmail.com> wrote:
> I was just bitten by the fact that the type constructor Compose from
> Data.Functor.Compose associates to the left instead of to the right
> like function composition.
>
> I would like to propose adding the following to Data.Functor.Compose:
>
>   infixr 9 `Compose`   -- analogous to the fixity of (.)
>
> This will likely break existing code which uses Compose infix like in
> the following type:
>
>   a `Compose` b `Compose` c
>
> Discussion deadline: 13 September 2013.
>
> Bas
Ross Paterson | 13 Sep 19:53 2013
Picon

Re: Proposal: infixr 9 `Compose`

On Fri, Sep 13, 2013 at 01:13:38PM +0200, Bas van Dijk wrote:
> The deadline for this has passed and no objections were raised.
> 
> Ross, do you like me to make a patch for transformers or do you like
> to add the following to Data.Functor.Compose yourself?
> 
>  infixr 9 `Compose`   -- analogous to the fixity of (.)

OK, pushed.
Bas van Dijk | 13 Sep 23:48 2013
Picon

Re: Proposal: infixr 9 `Compose`

On 13 September 2013 19:53, Ross Paterson <R.Paterson <at> city.ac.uk> wrote:
> OK, pushed.

Thanks!

Gmane