{-# OPTIONS_GHC -fno-warn-incomplete-patterns #-} module Main where import Message import Control.Concurrent.Mailbox import Control.Concurrent.Mailbox.Wrapper import Network import System.IO main :: IO () main = do hdl <- connectTo "" $ UnixSocket "test.socket" hPutStr hdl "Test123\n" hFlush hdl inBox <- wrapReadHandle hdl (\ inBox e -> inBox inBox mb Message -> mb Message -> Int -> IO () loop _inBox outBox 1000000 = outBox handler $ putStrLn $ "received error: " ++ e , \ (M 10) -> handler $ do putStrLn "received 10" loop inBox outBox (n + 1) , \ m -> handler $ do print m loop inBox outBox (n + 1) ]