ekmett / contravariant

Haskell 98 contravariant functors
http://hackage.haskell.org/package/contravariant
Other
73 stars 24 forks source link

Add Divide Day instance #40

Open paf31 opened 6 years ago

paf31 commented 6 years ago

I think contravariant Day f g can be made into a Divide if f and g can. Something like:

instance (Divide f, Divide g) => Divide (Day f g) where
  divide f (Day fb1 gc1 f1) (Day fb1 gc1 f1) = 
    Day 
      (divided fb1 fb2) 
      (divided gc1 gc2)
      (\a -> let (b, c) = f a 
                 (b1, c1) = f1 b
                 (b2, c2) = f2 c
             in ((b1, b2), (c1, c2))