ArrowChoice unit law in haddock seems to be wrong
In the haddock documentation of !ArrowChoice there is an (unnamed) law: "left f >>> arr Left = arr Left >>> f". In Ross Paterson's Arrows and Computations paper there is a similar law named the unit law for !ArrowChoice that goes "pure Left >>> left f = f >>> pure Left" ("pure" in that paper is "arr" in the base library).
Reordering the unit law from the paper and replacing "pure" with "arr" the unit law from the paper is "f >>> arr Left = arr Left >>> left f" where the law from haddock is "left f >>> arr Left = arr Left >>> f". The laws are similar but "left" is used in different places.
The law from haddock appears to be invalid, there does not appear to be a way to create an arrow "f" in such a way that it works with both sides of the equation. This can be verified by typing the following lines in GHCi:
import Control.Arrow
let foo f = left f >>> arr Left
let bar f = arr Left >>> f
let same :: a b c -> a b c -> (); same _ _ = ()
\f -> same (foo f) (bar f)
The last line gives a type error.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.7 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | libraries/base |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |