How to totally redirect stdin and stdout with Node.js?

A bad title... I have a problem in create a command line interface..
At first I tried with a piece of Haskell code for beginners:

main = do
  c <- getLine
  print c
  main

The I was trying to reload it by watching the h.hs file and run runhaskell h.hs every time I save my code.. We can ignore how to reload it here as that's not so troublesome.

Here's my code in CoffeeScript to try that:

runner = spwan 'runhaskell', ['h.hs']
process.stdin.pipe runner.stdin
runner.stdout.pipe process.stdout
runner.stderr.pipe process.stderr

But it doesn't work as exprested, the outputs doesn't appear every time I press enter, rather it is printed after runner as killed.. What's the problem in the code?

My environment is Archlinux.