+type ParserStateReader a s r m = ConduitParser a (StateT s (ReaderT r m))
+
+-- | A session representing one instance of launching and connecting to a server.
+--
+-- You can send and receive messages to the server within 'Session' via 'getMessage',
+-- 'sendRequest' and 'sendNotification'.
+--
+-- @
+-- runSession \"path\/to\/root\/dir\" $ do
+-- docItem <- getDocItem "Desktop/simple.hs" "haskell"
+-- sendNotification TextDocumentDidOpen (DidOpenTextDocumentParams docItem)
+-- diagnostics <- getMessage :: Session PublishDiagnosticsNotification
+-- @
+type Session = ParserStateReader FromServerMessage SessionState SessionContext IO
+
+-- | Matches if the message is a notification.
+anyNotification :: Monad m => ConduitParser FromServerMessage m FromServerMessage
+anyNotification = satisfy isServerNotification
+
+notification :: forall m a. (Monad m, FromJSON a) => ConduitParser FromServerMessage m (NotificationMessage ServerMethod a)
+notification = do
+ let parser = decode . encodeMsg :: FromServerMessage -> Maybe (NotificationMessage ServerMethod a)
+ x <- satisfy (isJust . parser)
+ return $ fromJust $ decode $ encodeMsg x