I have the following program, which produces no output when run with runhaskell Toy.hs
, and instead hangs indefinitely. By my understanding, the program should print "hi" and then exit. I would appreciate an answer and/or advice about how to debug such an issue. I'm using Pipes 4.0.0 off of github (github.com/Gabriel439/Haskell-Pipes-Library).
module Toy where
import Pipes
import Control.Monad.State
type Request = String
type Response = String
serveChoice :: Request -> Server Request Response IO ()
serveChoice = forever go
where go req = do
lift $ putStrLn req
respond req
run :: Monad m => () -> Client Request Response (StateT Int m) ()
run () = do
request "hi"
return ()
main :: IO ()
main = evalStateT (runEffect $ hoist lift . serveChoice >-> run $ ()) 0