[nhc-bugs] getContents/hGetContents bug?

Amanda Clare afc@aber.ac.uk
Tue, 06 May 2003 18:52:52 +0100


Hello nhc-team,

The following doesn't work under nhc98 1.14 (made with hmake 3.05)

[afc@pcburum mipsmanual]$ nhc98 --version
/usr/local/funcprog/bin/nhc98: v1.14 (2002-06-13)
   [ config: ix86-Linux/ghc by malcolm@pc173 on 13 Jun 2002 ]

The program does nothing, and returns immediately without waiting for 
input. Just using getContents does the same.

--------------------------

module Main where
import IO


parse accum []       = [accum]
parse accum ('*':cs) = accum:parse [] cs     -- finished this expression
parse accum ('%':cs) = [accum]               -- end input here
parse accum (c:cs)   = parse (c:accum) cs


main = do text <- hGetContents stdin
           putStr (unlines (parse [] text))


--------------------------

Amanda