Advice sought for 6.9 and Arrow/Category
Conal Elliott
conal at conal.net
Tue Jul 15 11:45:55 EDT 2008
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 <conal at conal.net> wrote:
> 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 <dons at galois.com> 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
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20080715/1e5c9a5a/attachment-0001.htm
More information about the Glasgow-haskell-users
mailing list