Make psend's argument message strict (#55)
If the message argument can't be evaluated successfully strict modifier will keep those errors outside of psend invocation. Psend will catch only actual IO exceptions.
This commit is contained in:
parent
87fbed4971
commit
7fc095725f
1 changed files with 2 additions and 1 deletions
|
@ -7,6 +7,7 @@
|
||||||
{-# LANGUAGE RecordWildCards, StandaloneDeriving, OverloadedStrings #-}
|
{-# LANGUAGE RecordWildCards, StandaloneDeriving, OverloadedStrings #-}
|
||||||
{-# LANGUAGE CPP, FlexibleContexts, TupleSections, TypeSynonymInstances #-}
|
{-# LANGUAGE CPP, FlexibleContexts, TupleSections, TypeSynonymInstances #-}
|
||||||
{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, UndecidableInstances #-}
|
{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, UndecidableInstances #-}
|
||||||
|
{-# LANGUAGE BangPatterns #-}
|
||||||
|
|
||||||
{-# LANGUAGE NamedFieldPuns, ScopedTypeVariables #-}
|
{-# LANGUAGE NamedFieldPuns, ScopedTypeVariables #-}
|
||||||
|
|
||||||
|
@ -143,7 +144,7 @@ listen Pipeline{..} = do
|
||||||
psend :: Pipeline -> Message -> IO ()
|
psend :: Pipeline -> Message -> IO ()
|
||||||
-- ^ Send message to destination; the destination must not response (otherwise future 'call's will get these responses instead of their own).
|
-- ^ Send message to destination; the destination must not response (otherwise future 'call's will get these responses instead of their own).
|
||||||
-- Throw IOError and close pipeline if send fails
|
-- Throw IOError and close pipeline if send fails
|
||||||
psend p@Pipeline{..} message = withMVar vStream (flip writeMessage message) `onException` close p
|
psend p@Pipeline{..} !message = withMVar vStream (flip writeMessage message) `onException` close p
|
||||||
|
|
||||||
pcall :: Pipeline -> Message -> IO (IO Response)
|
pcall :: Pipeline -> Message -> IO (IO Response)
|
||||||
-- ^ Send message to destination and return /promise/ of response from one message only. The destination must reply to the message (otherwise promises will have the wrong responses in them).
|
-- ^ Send message to destination and return /promise/ of response from one message only. The destination must reply to the message (otherwise promises will have the wrong responses in them).
|
||||||
|
|
Loading…
Reference in a new issue