module Language.Haskell.LSP.Test.Parsing
( -- $receiving
- message
+ satisfy
+ , message
, anyRequest
, anyResponse
, anyNotification
import qualified Data.Text as T
import Data.Typeable
import Language.Haskell.LSP.Messages
-import Language.Haskell.LSP.Types as LSP hiding (error, message)
+import Language.Haskell.LSP.Types
+import qualified Language.Haskell.LSP.Types.Lens as LSP
import Language.Haskell.LSP.Test.Messages
import Language.Haskell.LSP.Test.Session
-- anyResponse
-- @
+-- | Consumes and returns the next message, if it satisfies the specified predicate.
+--
+-- @since 0.5.2.0
satisfy :: (FromServerMessage -> Bool) -> Session FromServerMessage
satisfy pred = do
return x
else empty
--- | Matches a message of type 'a'.
+-- | Matches a message of type @a@.
message :: forall a. (Typeable a, FromJSON a) => Session a
message =
let parser = decode . encodeMsg :: FromServerMessage -> Maybe a