Re: [Haskell-cafe] fclabels 0.5

2012-08-21 Thread Sergey Mironov
just what I was looking for, thanks!

2012/8/20 Erik Hesselink hessel...@gmail.com:
 Untested, but this should be about right:

 osi (Bij f b) = iso (Bij b f)

 Erik

 On Mon, Aug 20, 2012 at 2:35 PM, Sergey Mironov ier...@gmail.com wrote:
 Hi. I'm porting old code, which uses fclabels 0.5. Old fclabels
 define Iso typeclass as follows:

 class Iso f where
   iso :: a :-: b - f a - f b
   iso (Lens a b) = osi (b - a)
   osi :: a :-: b - f b - f a
   osi (Lens a b) = iso (b - a)

 Newer one defines iso:

 class Iso (~) f where
   iso :: Bijection (~) a b - f a ~ f b

 instance Arrow (~) = Iso (~) (Lens (~) f) where
   iso bi = arr ((\a - lens (fw bi . _get a) (_set a . first (bw bi))) . 
 unLens)

 instance Arrow (~) = Iso (~) (Bijection (~) a) where
   iso = arr . (.)

 but no osi. I'm not a guru in categories, can you help me define osi?

 Thanks
 Sergey.

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] fclabels 0.5

2012-08-20 Thread Sergey Mironov
Hi. I'm porting old code, which uses fclabels 0.5. Old fclabels
define Iso typeclass as follows:

class Iso f where
  iso :: a :-: b - f a - f b
  iso (Lens a b) = osi (b - a)
  osi :: a :-: b - f b - f a
  osi (Lens a b) = iso (b - a)

Newer one defines iso:

class Iso (~) f where
  iso :: Bijection (~) a b - f a ~ f b

instance Arrow (~) = Iso (~) (Lens (~) f) where
  iso bi = arr ((\a - lens (fw bi . _get a) (_set a . first (bw bi))) . unLens)

instance Arrow (~) = Iso (~) (Bijection (~) a) where
  iso = arr . (.)

but no osi. I'm not a guru in categories, can you help me define osi?

Thanks
Sergey.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] fclabels 0.5

2012-08-20 Thread Erik Hesselink
Untested, but this should be about right:

osi (Bij f b) = iso (Bij b f)

Erik

On Mon, Aug 20, 2012 at 2:35 PM, Sergey Mironov ier...@gmail.com wrote:
 Hi. I'm porting old code, which uses fclabels 0.5. Old fclabels
 define Iso typeclass as follows:

 class Iso f where
   iso :: a :-: b - f a - f b
   iso (Lens a b) = osi (b - a)
   osi :: a :-: b - f b - f a
   osi (Lens a b) = iso (b - a)

 Newer one defines iso:

 class Iso (~) f where
   iso :: Bijection (~) a b - f a ~ f b

 instance Arrow (~) = Iso (~) (Lens (~) f) where
   iso bi = arr ((\a - lens (fw bi . _get a) (_set a . first (bw bi))) . 
 unLens)

 instance Arrow (~) = Iso (~) (Bijection (~) a) where
   iso = arr . (.)

 but no osi. I'm not a guru in categories, can you help me define osi?

 Thanks
 Sergey.

 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe