Advice sought for 6.9 and Arrow/Category

I want to use ghc-6.9 for improved support of type families, but I see that the change to the Arrow interface breaks some of my libraries (since (>>>) is no longer a method of Arrow). Will this change really be in ghc-6.9? Does anyone have coping strategies for keeping libraries working in 6.8 *and* 6.9, particularly ones that define instances of Arrow? Thanks, - Conal

conal:
I want to use ghc-6.9 for improved support of type families, but I see that the change to the Arrow interface breaks some of my libraries (since (>>>) is no longer a method of Arrow). Will this change really be in
(>>>) has been reexported from Control.Category through Arrow for a few months. Does that fix things, or is your code still broken? -- Don

All code that defines Arrow instance breaks, because (>>>) is not a method
of Arrow. I have a lot of such instances, so I'm now adding #if directives
to test for ghc-6.9 or later. - Conal
On Mon, Jul 14, 2008 at 8:38 PM, Don Stewart
conal:
I want to use ghc-6.9 for improved support of type families, but I see that the change to the Arrow interface breaks some of my libraries (since (>>>) is no longer a method of Arrow). Will this change really be in
(>>>) has been reexported from Control.Category through Arrow for a few months. Does that fix things, or is your code still broken?
-- Don

By the way, here's how I'm changing my code to work with the new and old
arrow interface. I'd appreciate any suggested improvements.
The old code (example):
import Control.Arrow
[...]
instance Arrow (~>) => Arrow (Bijection (~>)) where
Bi ab ba >>> Bi bc cb = Bi (ab >>> bc) (cb >>> ba)
[...]
The new code:
#if __GLASGOW_HASKELL__ >= 609
import Control.Category
import Prelude hiding ((.), id)
#endif
import Control.Arrow
[...]
#if __GLASGOW_HASKELL__ >= 609
instance Category (~>) => Category (Bijection (~>)) where
id = Bi id id
Bi bc cb . Bi ab ba = Bi (bc . ab) (ba . cb)
#endif
instance Arrow (~>) => Arrow (Bijection (~>)) where
#if __GLASGOW_HASKELL__ < 609
Bi ab ba >>> Bi bc cb = Bi (ab >>> bc) (cb >>> ba)
#endif
[...]
I'm testing for ghc version. Could I somehow test for the base-library
version instead? - Conal
On Tue, Jul 15, 2008 at 4:43 PM, Conal Elliott
All code that defines Arrow instance breaks, because (>>>) is not a method of Arrow. I have a lot of such instances, so I'm now adding #if directives to test for ghc-6.9 or later. - Conal
On Mon, Jul 14, 2008 at 8:38 PM, Don Stewart
wrote: conal:
I want to use ghc-6.9 for improved support of type families, but I see that the change to the Arrow interface breaks some of my libraries (since (>>>) is no longer a method of Arrow). Will this change really be in
(>>>) has been reexported from Control.Category through Arrow for a few months. Does that fix things, or is your code still broken?
-- Don

On Tue, Jul 15, 2008 at 05:45:55PM +0200, Conal Elliott wrote:
By the way, here's how I'm changing my code to work with the new and old arrow interface. I'd appreciate any suggested improvements.
The old code (example):
import Control.Arrow
[...]
instance Arrow (~>) => Arrow (Bijection (~>)) where Bi ab ba >>> Bi bc cb = Bi (ab >>> bc) (cb >>> ba) [...]
The new code:
#if __GLASGOW_HASKELL__ >= 609 import Control.Category import Prelude hiding ((.), id) #endif import Control.Arrow
[...]
#if __GLASGOW_HASKELL__ >= 609 instance Category (~>) => Category (Bijection (~>)) where id = Bi id id Bi bc cb . Bi ab ba = Bi (bc . ab) (ba . cb) #endif
instance Arrow (~>) => Arrow (Bijection (~>)) where #if __GLASGOW_HASKELL__ < 609 Bi ab ba >>> Bi bc cb = Bi (ab >>> bc) (cb >>> ba) #endif [...]
I'm testing for ghc version. Could I somehow test for the base-library version instead? - Conal
Yes. Here is a snippet from binary.cabal: flag applicative-in-base library if flag(applicative-in-base) build-depends: base >= 2.0 cpp-options: -DAPPLICATIVE_IN_BASE else build-depends: base < 2.0 Cheers, Spencer Janssen

On Tue, 2008-07-22 at 04:57 -0500, Spencer Janssen wrote:
I'm testing for ghc version. Could I somehow test for the base-library version instead? - Conal
Yes. Here is a snippet from binary.cabal:
flag applicative-in-base
library if flag(applicative-in-base) build-depends: base >= 2.0 cpp-options: -DAPPLICATIVE_IN_BASE else build-depends: base < 2.0
This is the sort of example where our Cabal syntactic sugar proposal helps a bit: library if package(base >= 2.0) cpp-options: -DAPPLICATIVE_IN_BASE So two lines rather than six and you don't need to understand the relational semantics so clearly to make sense of it. Now if only we'd get round to implementing it. Duncan

On Mon, Jul 14, 2008 at 01:58:00PM +0200, Conal Elliott wrote:
I want to use ghc-6.9 for improved support of type families, but I see that the change to the Arrow interface breaks some of my libraries (since (>>>) is no longer a method of Arrow). Will this change really be in ghc-6.9?
Yes. It was changed with a library proposal: http://hackage.haskell.org/trac/ghc/ticket/1773 http://www.haskell.org/pipermail/libraries/2007-October/008291.html Thanks Ian
participants (5)
-
Conal Elliott
-
Don Stewart
-
Duncan Coutts
-
Ian Lynagh
-
Spencer Janssen