summaryrefslogtreecommitdiff
path: root/KikiD
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2015-06-21 17:52:29 -0400
committerjoe <joe@jerkface.net>2015-06-21 17:52:29 -0400
commit3989ea283124745ab378c440459138f66602dc52 (patch)
treefb43b36a490cca4e91d7d3d5095168df0fb79255 /KikiD
parentd420aefe0b14081b00d4655f9e8317903b5b02c3 (diff)
Fixed serialization error
Diffstat (limited to 'KikiD')
-rw-r--r--KikiD/Message.hs14
1 files changed, 9 insertions, 5 deletions
diff --git a/KikiD/Message.hs b/KikiD/Message.hs
index c4903cc..5b642f3 100644
--- a/KikiD/Message.hs
+++ b/KikiD/Message.hs
@@ -5,14 +5,18 @@ import qualified KikiD.GetLine
5import qualified Data.ByteString.Char8 as B 5import qualified Data.ByteString.Char8 as B
6import Data.Monoid 6import Data.Monoid
7import Text.Read 7import Text.Read
8import Data.Char (ord)
9import Control.Monad
8 10
9data KikiDMessage = TODO deriving (Show,Read) 11data KikiDMessage = TODO deriving (Show,Read)
10 12
11instance Serialize KikiDMessage where 13instance Serialize KikiDMessage where
12 put = putByteString . B.pack . show 14 put m = mapM_ (putWord8 . fromIntegral . ord) "TODO"
15 -- putByteString . B.pack $ show m ++ "\n"
13 get = do 16 get = do
14 x <- KikiD.GetLine.getLine 17 t <- getWord8
15 case (readEither (B.unpack x) :: Either String KikiDMessage) of 18 o <- getWord8
16 Right m -> return m 19 d <- getWord8
17 Left er -> fail ("PARSE ERROR: " <> er) 20 o <- getWord8
21 return TODO
18 22