binary files in haskell

Koen Claessen koen@cs.chalmers.se
Tue, 6 Feb 2001 15:25:11 +0100 (MET)


Johannes Waldmann wrote:

 | Should this also apply to names in the standard
 | library? like Monad (filterM, zipWithM ,..)  I mean,
 | theoretically yes, but is it feasible to change it?

Obviously, these functions should have been called:

  Monad.filter, Monad.zipWith

The lazy programmer can then say:

  import Monad as M    (*)

  M.filter, M.zipWith

Just (asymptotically) 1 character more! :-)

 | getLine -> hGetLine always irritates me.

How about:

  import Handle as H

  H.getLine

(This is a good example where type classes would not help
making this any better, since the types of getLine and
H.getLine are very different.)

While we're at it, how about instead of the "fmap" function:

  Functor.map  (F.map)
  List.map     (L.map)
  Maybe.map    (M.map)

The programmer can pick him/herself what function to use.
(The Prelude really has too many functions in it, and very
often the rationale for a function being in Prelude or in
Char/List/Maybe/Monad/IO/etc. is not motivated.)

What do people think about this? If people prefer these
stylistic changes, I think we should not hesitate making
them for Haskell/2 by completely redesigning the module
structure and using more consistent naming conventions.

/Koen.

(*) What actually happened to the excellent proposal
somebody made a while ago for Haskell98:

  import M = Monad

? I like it a lot!

--
Koen Claessen         http://www.cs.chalmers.se/~koen
phone:+46-31-772 5424      mailto:koen@cs.chalmers.se
-----------------------------------------------------
Chalmers University of Technology, Gothenburg, Sweden