
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