preprocessing printf/regex strings (like ocaml)
Ralf Hinze
ralf@informatik.uni-bonn.de
Sun, 12 May 2002 17:17:10 +0200
> I'm interested to know why a string translating preprocessor doesn't
> exist for haskell. It seems to me that it would alleviate printf and
> regex like problems in an convenient, elegant and type-safe manner.
>
> An example of this I came across recently was the ocaml printf
> statement:
>
> # Printf.printf "roar";;
> roar- : unit =3D ()
>
> # Printf.printf "numbers %d %d" 11 23;;
> numbers 11 23- : unit =3D ()
>
> # Printf.printf "a number %d" "word";;
> This expression has type string but is here used with type int
>
>
> You can see logically how this might work in haskell, compile time
> evaluation would translate the string into the appropriate native
> expressions before the statements type is evaluated.
Incidentally, I've written a small functional pearl about implementing
printf in Haskell, see
=09http://www.informatik.uni-bonn.de/~ralf/publications.html#J11
Cheers, Ralf