Commit 4ebeb1fb authored by Sumit Sahrawat's avatar Sumit Sahrawat

Formatting fixes

parent a8e09f58
...@@ -153,8 +153,8 @@ executeErrorParser = requestParser $ \obj -> do ...@@ -153,8 +153,8 @@ executeErrorParser = requestParser $ \obj -> do
return $ ExecuteError noHeader [] traceback ename evalue return $ ExecuteError noHeader [] traceback ename evalue
makeDisplayDatas :: Object -> [DisplayData] makeDisplayDatas :: Object -> [DisplayData]
makeDisplayDatas dataDict = [DisplayData (read $ unpack mimeType) content | makeDisplayDatas dataDict = [DisplayData (read $ unpack mimeType) content | (mimeType, String content) <- HM.toList
(mimeType, String content) <- HM.toList dataDict] dataDict]
-- | Parse an execute result -- | Parse an execute result
executeResultParser :: LByteString -> Message executeResultParser :: LByteString -> Message
...@@ -173,7 +173,8 @@ displayDataParser = requestParser $ \obj -> do ...@@ -173,7 +173,8 @@ displayDataParser = requestParser $ \obj -> do
maybeSource <- obj .:? "source" maybeSource <- obj .:? "source"
return $ PublishDisplayData noHeader (fromMaybe "" maybeSource) displayDatas return $ PublishDisplayData noHeader (fromMaybe "" maybeSource) displayDatas
requestParser parser content = case parseEither parser decoded of requestParser parser content =
case parseEither parser decoded of
Right parsed -> parsed Right parsed -> parsed
Left err -> trace ("Parse error: " ++ show err) SendNothing Left err -> trace ("Parse error: " ++ show err) SendNothing
where where
......
...@@ -29,13 +29,21 @@ instance ToJSON Message where ...@@ -29,13 +29,21 @@ instance ToJSON Message where
, "language_info" .= languageInfo rep , "language_info" .= languageInfo rep
] ]
toJSON ExecuteRequest { getCode = code, getSilent = silent, getStoreHistory = storeHistory, toJSON ExecuteRequest
getAllowStdin = allowStdin, getUserVariables = userVariables, { getCode = code
getUserExpressions = userExpressions , getSilent = silent
, getStoreHistory = storeHistory
, getAllowStdin = allowStdin
, getUserVariables = userVariables
, getUserExpressions = userExpressions
} = } =
object ["code" .= code, "silent" .= silent, "store_history" .= storeHistory, object
"allow_stdin" .= allowStdin, "user_variables" .= userVariables, [ "code" .= code
"user_expressions" .= userExpressions , "silent" .= silent
, "store_history" .= storeHistory
, "allow_stdin" .= allowStdin
, "user_variables" .= userVariables
, "user_expressions" .= userExpressions
] ]
toJSON ExecuteReply { status = status, executionCounter = counter, pagerOutput = pager } = toJSON ExecuteReply { status = status, executionCounter = counter, pagerOutput = pager } =
......
...@@ -349,17 +349,10 @@ data Message = ...@@ -349,17 +349,10 @@ data Message =
, inCode :: String -- ^ Submitted input code. , inCode :: String -- ^ Submitted input code.
, executionCount :: Int -- ^ Which input this is. , executionCount :: Int -- ^ Which input this is.
} }
| Input | Input { header :: MessageHeader, getCode :: Text, executionCount :: Int }
{ header :: MessageHeader | Output { header :: MessageHeader, getText :: [DisplayData], executionCount :: Int }
, getCode :: Text |
, executionCount :: Int CompleteRequest
}
| Output
{ header :: MessageHeader
, getText :: [DisplayData]
, executionCount :: Int
}
| CompleteRequest
{ header :: MessageHeader { header :: MessageHeader
, getCode :: Text {- ^ , getCode :: Text {- ^
The entire block of text where the line is. This may be useful in the The entire block of text where the line is. This may be useful in the
...@@ -489,7 +482,6 @@ instance FromJSON StreamType where ...@@ -489,7 +482,6 @@ instance FromJSON StreamType where
parseJSON (String "stdout") = return Stdout parseJSON (String "stdout") = return Stdout
parseJSON (String "stderr") = return Stderr parseJSON (String "stderr") = return Stderr
-- | Get the reply message type for a request message type. -- | Get the reply message type for a request message type.
replyType :: MessageType -> Maybe MessageType replyType :: MessageType -> Maybe MessageType
replyType KernelInfoRequestMessage = Just KernelInfoReplyMessage replyType KernelInfoRequestMessage = Just KernelInfoReplyMessage
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment