darcs patch: Add justIf to Data.Maybe

Jon Fairbairn jon.fairbairn at cl.cam.ac.uk
Thu Sep 3 04:02:10 EDT 2009

Duncan Coutts <duncan.coutts at worc.ox.ac.uk> writes:

> On Wed, 2009-08-26 at 18:58 +0100, Jon Fairbairn wrote:
>> > 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'm not sure it does tell us much,

One thing it tells us is that it's going to be awkward to write in a
point-free style.

> given that there are also cases where we need to use it only once, and
> would be forced to use \_ -> to ignore it in the predicate.

The other thing it tells us is that it makes a linear (or should I be
saying single-threaded here?) term look like it's not. Using const in
the opposite case doesn't have that effect.

Jón Fairbairn                                 Jon.Fairbairn at cl.cam.ac.uk
http://www.chaos.org.uk/~jf/Stuff-I-dont-want.html  (updated 2009-01-31)

More information about the Libraries mailing list