#7479: ArrowChoice unit law in haddock seems to be wrong
------------------------------+---------------------------------------------
Reporter:  pminten            |          Owner:                  
    Type:  bug                |         Status:  new             
Priority:  normal             |      Component:  libraries/base  
 Version:  7.7                |       Keywords:                  
      Os:  Unknown/Multiple   |   Architecture:  Unknown/Multiple
 Failure:  Documentation bug  |      Blockedby:                  
Blocking:                     |        Related:                  
------------------------------+---------------------------------------------
 In the haddock documentation of !ArrowChoice there is an (unnamed) law:
 "{{{left f >>> arr Left = arr Left >>> f}}}". In Ross Paterson's
 [http://www.soi.city.ac.uk/~ross/papers/fop.html 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.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7479>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to