[...] it's just a pleasure to see all those one-line definitions
and feel how power the language should be to allow such cool things.

It is indeed. I find these explicit definitions often much more instructive than purely implicit definitions. But, call me a nitpicker, some of the definitions are still a bit longish for my taste.

For example:

break :: (a -> Bool) -> [a] -> ([a],[a])
break p xs

 = span 
<http://undergraduate.csse.uwa.edu.au/units/230.301/lectureNotes/tourofprelude.html#span>
 p' xs
   where
   p' x = not 
<http://undergraduate.csse.uwa.edu.au/units/230.301/lectureNotes/tourofprelude.html#not>
 (p x)


could be written as:

break p = span (not . p)

or:

and xs = foldr 
<http://undergraduate.csse.uwa.edu.au/units/230.301/lectureNotes/tourofprelude.html#foldr>
 (&&) True xs

as:

and = foldr 
<http://undergraduate.csse.uwa.edu.au/units/230.301/lectureNotes/tourofprelude.html#foldr>
 (&&) True


While the second case is pure nitpicking, I find that the point-free definition is much easier to read in the first case. Any reason to use the point-wise notation there? Is it considered to be easier to read or understand?
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to