darcs patch: Add justIf to Data.Maybe
Jon Fairbairn
jon.fairbairn at cl.cam.ac.uk
Wed Aug 26 13:58:23 EDT 2009
On 2009-08-25 at 12:32BST Simon Marlow wrote:
> I think that for consistency with if/then/else and guard we
> should use checkA.
See my response to Sebastian.
> It's not that hard to write
>
> all_spaces xs = checkA (all (isSpace xs)) xs
>
> if that's really what you want.
Not /hard/, but it involves using xs twice, which should tell us
something.
> I wouldn't call checkB more "general"; to me it's just a
> minor convenience issue, which is outweighed by consistency
> and simplicity.
See response to Sebastian.
> > is hard to write using checkA (suppose you are doing something like “map
> > (checkB predicate)”) since checkA doesn't look at the second argument.
>
> the "applying check to a list" case is not hard either:
>
> zipWithM checkA (map p xs) xs
which involves duplication again, and on top of that zipWithM,
which while not /hard/ is hardly conceptually simple.
Jón
--
Jón Fairbairn Jon.Fairbairn at cl.cam.ac.uk
More information about the Libraries
mailing list