ekmett / contravariant

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

Is this law incorrect? #47

Closed barrucadu closed 6 years ago

barrucadu commented 6 years ago

https://github.com/ekmett/contravariant/blob/3e605d46ed342cac4428ce80c07255ee4a0ed7b9/src/Data/Functor/Contravariant/Divisible.hs#L584-L592

The comment says that we need to reassociate, but the f' in the third law there doesn't appear to be reassociating at all, as it's throwing away the d component.

Should it be f' a = let (bc, d) = f a; (b, c) = g bc in (b, (c, d))?

ekmett commented 6 years ago

Yes, it should.

barrucadu commented 6 years ago

Cool, I'll submit a PR.