[Haskell-beginners] Named Pipes Et Cetera

matthew coolbeth mac01021 at engr.uconn.edu
Tue Nov 23 07:55:17 EST 2010

Hello, all.

Three questions:

1> What, if anything, can I do in a Haskell program to do blocking
reads from a Linux FIFO?  For the curious, there is a small program
below that doesn't block, but immediately terminates because of an EOF

2> How could I have found the answer to this question on my own? (The
documentation that Google found for me was not completely adequate)

3> Is this sort of question generally regarded as too unixy or not
haskelly enough to be appropriate for this mailing list?


module Main () where

import Control.Monad
import System.IO
import System.Posix.Files

pipeString = "/tmp/dld.fifo"

main :: IO ()
main = do
        createNamedPipe pipeString $ unionFileModes ownerReadMode ownerWriteMode
        pipe <- openFile pipeString ReadMode
        forever (hGetLine pipe >>= putStrLn)


More information about the Beginners mailing list