Re: Improved documentation for Bool (Was: [Haskell-cafe] Comments from OCaml Hacker Brian Hurt)

2009-01-20 Thread Henning Thielemann
rocon...@theorem.ca schrieb:
 On Sun, 18 Jan 2009, Ross Paterson wrote:
 
 Anyone can check out the darcs repos for the libraries, and post
 suggested improvements to the documentation to librar...@haskell.org
 (though you have to subscribe).  It doesn't even have to be a patch.

 Sure, it could be smoother, but there's hardly a flood of contributions.
 
 I noticed the Bool datatype isn't well documented.  Since Bool is not a
 common English word, I figured it could use some haddock to help clarify
 it for newcomers.

The type should be named Truth.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Improved documentation for Bool (Was: [Haskell-cafe] Comments from OCaml Hacker Brian Hurt)

2009-01-18 Thread roconnor

On Sun, 18 Jan 2009, Ross Paterson wrote:


Anyone can check out the darcs repos for the libraries, and post
suggested improvements to the documentation to librar...@haskell.org
(though you have to subscribe).  It doesn't even have to be a patch.

Sure, it could be smoother, but there's hardly a flood of contributions.


I noticed the Bool datatype isn't well documented.  Since Bool is not a 
common English word, I figured it could use some haddock to help clarify 
it for newcomers.


-- |The Bool datatype is named after George Boole (1815-1864).
-- The Bool type is the coproduct of the terminal object with itself.
-- As a coproduct, it comes with two maps i : 1 - 1+1 and j : 1 - 1+1
-- such that for any Y and maps u: 1 - Y and v: 1 - Y, there is a unique 
-- map (u+v): 1+1 - Y such that (u+v) . i = u, and (u+v) . j = v

-- as shown in the diagram below.
--
--  1 -- u -- Y
--  ^ ^^
--  |/ |
--  i  u + v   v
--  | /|
-- 1+1 - j -- 1
--
-- In Haskell we call we define 'False' to be i(*) and 'True' to be j(*) 
-- where *:1.
-- Furthermore, if Y is any type, and we are given a:Y and b:Y, then we 
-- can define u(*) = a and v(*) = b.

-- From the above there is a unique map (u + v) : 1+1 - Y,
-- or in other words, (u+v) : Bool - Y.
-- Haskell has a built in syntax for this map:
-- @if z then a else b@ equals (u+v)(z).
--
-- From the commuting triangle in the diagram we see that
-- (u+v)(i(*)) = u(*).
--  Translated into Haskell notation, this law reads
-- @if True then a else b = a...@.
-- Similarly from the other commuting triangle we see that
-- (u+v)(j(*)) = v(*), which means
-- @if False then a else b = b@

--
Russell O'Connor  http://r6.ca/
``All talk about `theft,''' the general counsel of the American Graphophone
Company wrote, ``is the merest claptrap, for there exists no property in
ideas musical, literary or artistic, except as defined by statute.''
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: Improved documentation for Bool (Was: [Haskell-cafe] Comments from OCaml Hacker Brian Hurt)

2009-01-18 Thread Cory Knapp

rocon...@theorem.ca wrote:

On Sun, 18 Jan 2009, Ross Paterson wrote:


Anyone can check out the darcs repos for the libraries, and post
suggested improvements to the documentation to librar...@haskell.org
(though you have to subscribe).  It doesn't even have to be a patch.

Sure, it could be smoother, but there's hardly a flood of contributions.


I noticed the Bool datatype isn't well documented.  Since Bool is not 
a common English word, I figured it could use some haddock to help 
clarify it for newcomers.


-- |The Bool datatype is named after George Boole (1815-1864).
-- The Bool type is the coproduct of the terminal object with itself.
-- As a coproduct, it comes with two maps i : 1 - 1+1 and j : 1 - 1+1
-- such that for any Y and maps u: 1 - Y and v: 1 - Y, there is a 
unique -- map (u+v): 1+1 - Y such that (u+v) . i = u, and (u+v) . j = v

-- as shown in the diagram below.
--
--  1 -- u -- Y
--  ^ ^^
--  |/ |
--  i  u + v   v
--  | /|
-- 1+1 - j -- 1
--
-- In Haskell we call we define 'False' to be i(*) and 'True' to be 
j(*) -- where *:1.
-- Furthermore, if Y is any type, and we are given a:Y and b:Y, then 
we -- can define u(*) = a and v(*) = b.

-- From the above there is a unique map (u + v) : 1+1 - Y,
-- or in other words, (u+v) : Bool - Y.
-- Haskell has a built in syntax for this map:
-- @if z then a else b@ equals (u+v)(z).
--
-- From the commuting triangle in the diagram we see that
-- (u+v)(i(*)) = u(*).
--  Translated into Haskell notation, this law reads
-- @if True then a else b = a...@.
-- Similarly from the other commuting triangle we see that
-- (u+v)(j(*)) = v(*), which means
-- @if False then a else b = b@

I'm going to go ahead and assume this was a joke and crack up... The sad 
part is I didn't actually find this difficult to read...


Cory lost touch with the real world Knapp
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: Improved documentation for Bool (Was: [Haskell-cafe] Comments from OCaml Hacker Brian Hurt)

2009-01-18 Thread Daniel Fischer
Am Sonntag, 18. Januar 2009 17:48 schrieb rocon...@theorem.ca:
 On Sun, 18 Jan 2009, Ross Paterson wrote:
  Anyone can check out the darcs repos for the libraries, and post
  suggested improvements to the documentation to librar...@haskell.org
  (though you have to subscribe).  It doesn't even have to be a patch.
 
  Sure, it could be smoother, but there's hardly a flood of contributions.

 I noticed the Bool datatype isn't well documented.  Since Bool is not a
 common English word, I figured it could use some haddock to help clarify
 it for newcomers.

Thanks. Really helpful. A few minor typos, though.


 -- |The Bool datatype is named after George Boole (1815-1864).
 -- The Bool type is the coproduct of the terminal object with itself.
 -- As a coproduct, it comes with two maps i : 1 - 1+1 and j : 1 - 1+1
 -- such that for any Y and maps u: 1 - Y and v: 1 - Y, there is a unique
 -- map (u+v): 1+1 - Y such that (u+v) . i = u, and (u+v) . j = v
 -- as shown in the diagram below.
 --
 --  1 -- u -- Y
 --  ^ ^^
 --  |/ |
 --  i  u + v   v
 --  | /|
 -- 1+1 - j -- 1

You have the arrows i and j pointing in the wrong direction.

 --
 -- In Haskell we call we define 'False' to be i(*) and 'True' to be j(*)

Delete we call.

 -- where *:1.
 -- Furthermore, if Y is any type, and we are given a:Y and b:Y, then we
 -- can define u(*) = a and v(*) = b.
 -- From the above there is a unique map (u + v) : 1+1 - Y,
 -- or in other words, (u+v) : Bool - Y.
 -- Haskell has a built in syntax for this map:
 -- @if z then a else b@ equals (u+v)(z).
 --
 -- From the commuting triangle in the diagram we see that
 -- (u+v)(i(*)) = u(*).
 --  Translated into Haskell notation, this law reads
 -- @if True then a else b = a...@.
 -- Similarly from the other commuting triangle we see that
 -- (u+v)(j(*)) = v(*), which means
 -- @if False then a else b = b@

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


Re: Improved documentation for Bool (Was: [Haskell-cafe] Comments from OCaml Hacker Brian Hurt)

2009-01-18 Thread Eugene Kirpichov
2009/1/18 Daniel Fischer daniel.is.fisc...@web.de:
 Am Sonntag, 18. Januar 2009 17:48 schrieb rocon...@theorem.ca:
 On Sun, 18 Jan 2009, Ross Paterson wrote:
  Anyone can check out the darcs repos for the libraries, and post
  suggested improvements to the documentation to librar...@haskell.org
  (though you have to subscribe).  It doesn't even have to be a patch.
 
  Sure, it could be smoother, but there's hardly a flood of contributions.

 I noticed the Bool datatype isn't well documented.  Since Bool is not a
 common English word, I figured it could use some haddock to help clarify
 it for newcomers.

 Thanks. Really helpful. A few minor typos, though.


 -- |The Bool datatype is named after George Boole (1815-1864).
 -- The Bool type is the coproduct of the terminal object with itself.
 -- As a coproduct, it comes with two maps i : 1 - 1+1 and j : 1 - 1+1
 -- such that for any Y and maps u: 1 - Y and v: 1 - Y, there is a unique
 -- map (u+v): 1+1 - Y such that (u+v) . i = u, and (u+v) . j = v
 -- as shown in the diagram below.
 --
 --  1 -- u -- Y
 --  ^ ^^
 --  |/ |
 --  i  u + v   v
 --  | /|
 -- 1+1 - j -- 1

 You have the arrows i and j pointing in the wrong direction.

 --
 -- In Haskell we call we define 'False' to be i(*) and 'True' to be j(*)

 Delete we call.

 -- where *:1.
 -- Furthermore, if Y is any type, and we are given a:Y and b:Y, then we
 -- can define u(*) = a and v(*) = b.
 -- From the above there is a unique map (u + v) : 1+1 - Y,
 -- or in other words, (u+v) : Bool - Y.
 -- Haskell has a built in syntax for this map:
 -- @if z then a else b@ equals (u+v)(z).
Also, equals (a+b)(z) should be here.

 --
 -- From the commuting triangle in the diagram we see that
 -- (u+v)(i(*)) = u(*).
 --  Translated into Haskell notation, this law reads
 -- @if True then a else b = a...@.
 -- Similarly from the other commuting triangle we see that
 -- (u+v)(j(*)) = v(*), which means
 -- @if False then a else b = b@

 ___
 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


Re: Improved documentation for Bool (Was: [Haskell-cafe] Comments from OCaml Hacker Brian Hurt)

2009-01-18 Thread Benja Fallenstein
On Sun, Jan 18, 2009 at 5:48 PM,  rocon...@theorem.ca wrote:
 I noticed the Bool datatype isn't well documented.  Since Bool is not a
 common English word, I figured it could use some haddock to help clarify it
 for newcomers.

 -- |The Bool datatype is named after George Boole (1815-1864).
 -- The Bool type is the coproduct of the terminal object with itself.

Russell, this does seem like it might be very helpful, but it might be
useful to include a note about what category you are working in.
People may sometimes naively assume that one is working in the
category of Haskell/Hugs/GHC data types and Haskell functions, in
which there are no terminal -- or initial -- objects ('undefined' and
'const undefined' are distinct maps between any two objects X and Y),
or else in the similar category without lifted bottoms, in which the
empty type is terminal and the unit type isn't ('undefined' and 'const
()' are both maps from any object X to the unit type). These niceties
will not confuse the advanced reader, but it may help the beginner if
you are more explicit.

- Benja


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


Re: Improved documentation for Bool (Was: [Haskell-cafe] Comments from OCaml Hacker Brian Hurt)

2009-01-18 Thread Sterling Clover
This is a great effort, but the root of the problem isn't just poor  
documentation, but an insistence on some obscure name. How about  
renaming Bool to YesOrNoDataVariable? I think this would help novice  
programmers a great deal.


It would also make the documentation flow much more naturally:

The Bool type is the coproduct of the terminal object with itself.

--huh?

The YesOrNoDataVariable is the coproduct of the terminal object with  
itself.


--Oh! Of course!

--S

On Jan 18, 2009, at 12:17 PM, Benja Fallenstein wrote:


On Sun, Jan 18, 2009 at 5:48 PM,  rocon...@theorem.ca wrote:
I noticed the Bool datatype isn't well documented.  Since Bool is  
not a
common English word, I figured it could use some haddock to help  
clarify it

for newcomers.

-- |The Bool datatype is named after George Boole (1815-1864).
-- The Bool type is the coproduct of the terminal object with itself.


Russell, this does seem like it might be very helpful, but it might be
useful to include a note about what category you are working in.
People may sometimes naively assume that one is working in the
category of Haskell/Hugs/GHC data types and Haskell functions, in
which there are no terminal -- or initial -- objects ('undefined' and
'const undefined' are distinct maps between any two objects X and Y),
or else in the similar category without lifted bottoms, in which the
empty type is terminal and the unit type isn't ('undefined' and 'const
()' are both maps from any object X to the unit type). These niceties
will not confuse the advanced reader, but it may help the beginner if
you are more explicit.

- Benja


P.S. :-)
___
Libraries mailing list
librar...@haskell.org
http://www.haskell.org/mailman/listinfo/libraries


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


Re: Improved documentation for Bool (Was: [Haskell-cafe] Comments from OCaml Hacker Brian Hurt)

2009-01-18 Thread Nathan Bloomfield
That's a great start, but coproduct is still pretty scary. Why not refer
to it as OneOrTheOtherButNotBothDataConstructor?

-Nathan Bloomfield

On Sun, Jan 18, 2009 at 11:32 AM, Sterling Clover s.clo...@gmail.comwrote:

 This is a great effort, but the root of the problem isn't just poor
 documentation, but an insistence on some obscure name. How about renaming
 Bool to YesOrNoDataVariable? I think this would help novice programmers a
 great deal.

 It would also make the documentation flow much more naturally:

 The Bool type is the coproduct of the terminal object with itself.

 --huh?

 The YesOrNoDataVariable is the coproduct of the terminal object with
 itself.

 --Oh! Of course!

 --S


 On Jan 18, 2009, at 12:17 PM, Benja Fallenstein wrote:

  On Sun, Jan 18, 2009 at 5:48 PM,  rocon...@theorem.ca wrote:

 I noticed the Bool datatype isn't well documented.  Since Bool is not a
 common English word, I figured it could use some haddock to help clarify
 it
 for newcomers.

 -- |The Bool datatype is named after George Boole (1815-1864).
 -- The Bool type is the coproduct of the terminal object with itself.


 Russell, this does seem like it might be very helpful, but it might be
 useful to include a note about what category you are working in.
 People may sometimes naively assume that one is working in the
 category of Haskell/Hugs/GHC data types and Haskell functions, in
 which there are no terminal -- or initial -- objects ('undefined' and
 'const undefined' are distinct maps between any two objects X and Y),
 or else in the similar category without lifted bottoms, in which the
 empty type is terminal and the unit type isn't ('undefined' and 'const
 ()' are both maps from any object X to the unit type). These niceties
 will not confuse the advanced reader, but it may help the beginner if
 you are more explicit.

 - Benja


 P.S. :-)
 ___
 Libraries mailing list
 librar...@haskell.org
 http://www.haskell.org/mailman/listinfo/libraries


 ___
 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


Re: Improved documentation for Bool (Was: [Haskell-cafe] Comments from OCaml Hacker Brian Hurt)

2009-01-18 Thread Derek Elkins
On Sun, 2009-01-18 at 18:17 +0100, Benja Fallenstein wrote:
 On Sun, Jan 18, 2009 at 5:48 PM,  rocon...@theorem.ca wrote:
  I noticed the Bool datatype isn't well documented.  Since Bool is not a
  common English word, I figured it could use some haddock to help clarify it
  for newcomers.
 
  -- |The Bool datatype is named after George Boole (1815-1864).
  -- The Bool type is the coproduct of the terminal object with itself.
 
 Russell, this does seem like it might be very helpful, but it might be
 useful to include a note about what category you are working in.
 People may sometimes naively assume that one is working in the
 category of Haskell/Hugs/GHC data types and Haskell functions, in
 which there are no terminal -- or initial -- objects 

The naive way of making a Haskell category doesn't even work.  Taking
objects to be Haskell types, all Haskell functions as arrows, arrow
equality being observational equality, and (.) and id to be the
composition and identity, you fail to even have a category.  Proof of
this is left as an (easy) exercise for the reader.

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