[Haskell-cafe] GHC + interactive input/output
Jonathan Cast
jonathanccast at fastmail.fm
Fri Feb 8 19:14:17 EST 2008
$ cat > foo.c
#include <stdio.h>
int
main()
{
char s[1024];
printf("gsi> ");
gets(s);
printf("%s\n", s);
return 0;
}
$ make foo
cc gsi.c -o gsi
$ ./foo
warning: this program uses gets(), which is unsafe.
gsi> hello
hello
$ cat > foo.hs
main = do
putStr "gsi> "
s <- getLine
putStrLn s
$ ghc foo.hs -o foo
$ ./foo
hello
gsi> hello
(This is on MacOS X). It strikes me that GHC is being
extraordinarily unhelpful here. Is there anyone on the planet who
ever actually wants this behavior?
jcc
More information about the Haskell-Cafe
mailing list