[Haskell-cafe] Simple shell scripts

Eric Tanter etanter at dcc.uchile.cl
Mon Aug 27 19:55:57 CEST 2012


Hi,

Here is a simple shell script (upper.hs):

import Data.Char
main = interact $ map toUpper

which composes fine with other scripts:

bash-3.2$ yes | head -n 3 | runghc upper.hs 
Y
Y
Y

but not always:

bash-3.2$ yes | runghc upper.hs | head -n 3
Y
Y
Y
<stdout>: hFlush: resource vanished (Broken pipe)

Any idea why this error occurs/how to avoid it?

(running just:
yes | runghc upper.hs
gives the expected infinite stream of Ys)

Thanks!

-- Éric



More information about the Haskell-Cafe mailing list