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

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.

On 30 August 2013 18:45, Ross Paterson
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

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
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

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.
participants (2)
-
Bas van Dijk
-
Ross Paterson