RE: Library report, monad zero laws
Well, * My reluctance to change the draft H98 report is rising sharply. * I don't think the H98 report has ever had laws about mzero etc. * And the whole laws business is flaky because people can and do make instances of Monad that don't obey the laws. * Lastly, where does one stop? Still, I have no concrete objection to adding the four "laws" below to the Monad library spec, with the same vague status as the other laws mentioned in the report. Comments, anyone? Even if the consensus is to add these four lines, I'm not going to reset the clock. I'm going to freeze in early July if nothing substantial arises before then. Simon | -----Original Message----- | From: Jon Fairbairn [mailto:Jon.Fairbairn@cl.cam.ac.uk] | Sent: 20 June 2002 16:27 | To: Simon Peyton-Jones | Subject: Library report, monad zero laws | | | The old report used to include | | m >> zero = zero | zero >>= m = zero | m ++ zero = m | zero ++ m = m | | after the other monad laws. Now mzero and mplus are in the | library, shouldn't there be some mention of these laws there? | I'd be particularly keen to see a remark about | | _|_ >> zero | | inevitably being _|_ | | Cheers, | | Jón | | | | -- | Jón Fairbairn | Jon.Fairbairn@cl.cam.ac.uk | 31 Chalmers Road | jf@cl.cam.ac.uk | Cambridge CB1 3SZ +44 1223 570179 (after 14:00 | only, please!) | | |
On Fri, Jun 21, 2002 at 12:50:21PM +0100, Simon Peyton-Jones wrote:
| From: Jon Fairbairn [mailto:Jon.Fairbairn@cl.cam.ac.uk] | Sent: 20 June 2002 16:27 | To: Simon Peyton-Jones | Subject: Library report, monad zero laws | | The old report used to include | | m >> zero = zero | zero >>= m = zero | m ++ zero = m | zero ++ m = m | | after the other monad laws. Now mzero and mplus are in the | library, shouldn't there be some mention of these laws there? | I'd be particularly keen to see a remark about | | _|_ >> zero | | inevitably being _|_
Would you put that next to m >> zero = zero ?
On Fri, Jun 21, 2002 at 12:50:21PM +0100, Simon Peyton-Jones wrote:
| From: Jon Fairbairn [mailto:Jon.Fairbairn@cl.cam.ac.uk] | Sent: 20 June 2002 16:27 | To: Simon Peyton-Jones | Subject: Library report, monad zero laws | | The old report used to include | | m >> zero = zero | zero >>= m = zero | m ++ zero = m | zero ++ m = m | | after the other monad laws. Now mzero and mplus are in the | library, shouldn't there be some mention of these laws there? | I'd be particularly keen to see a remark about | | _|_ >> zero | | inevitably being _|_
Would you put that next to m >> zero = zero ?
Well, that's rather the point. At the moment the library report just says "The class methods mzero and mplus are the zero and plus of the monad.", which implies m >> zero = zero, but it can't be. -- Jón Fairbairn Jon.Fairbairn@cl.cam.ac.uk 31 Chalmers Road jf@cl.cam.ac.uk Cambridge CB1 3SZ +44 1223 570179 (after 14:00 only, please!)
Apologies for responding to messages in reverse order . . .
* My reluctance to change the draft H98 report is rising sharply.
Understood!
* I don't think the H98 report has ever had laws about mzero etc.
No, they went on the transition from 1.4, I think.
* And the whole laws business is flaky because people can and do make instances of Monad that don't obey the laws.
That's what made me ask the question. Either it shouldn't say what it does about mzero being the zero, or it should explain more. So an alternative would be to remove the remark about the zero, but then we'd be left with no clues about the intentions. Jón -- Jón Fairbairn Jon.Fairbairn@cl.cam.ac.uk 31 Chalmers Road jf@cl.cam.ac.uk Cambridge CB1 3SZ +44 1223 570179 (after 14:00 only, please!)
participants (3)
-
Jon Fairbairn -
Ross Paterson -
Simon Peyton-Jones