diff options
author | joe <joe@jerkface.net> | 2015-06-21 17:52:29 -0400 |
---|---|---|
committer | joe <joe@jerkface.net> | 2015-06-21 17:52:29 -0400 |
commit | 3989ea283124745ab378c440459138f66602dc52 (patch) | |
tree | fb43b36a490cca4e91d7d3d5095168df0fb79255 /KikiD | |
parent | d420aefe0b14081b00d4655f9e8317903b5b02c3 (diff) |
Fixed serialization error
Diffstat (limited to 'KikiD')
-rw-r--r-- | KikiD/Message.hs | 14 |
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 | |||
5 | import qualified Data.ByteString.Char8 as B | 5 | import qualified Data.ByteString.Char8 as B |
6 | import Data.Monoid | 6 | import Data.Monoid |
7 | import Text.Read | 7 | import Text.Read |
8 | import Data.Char (ord) | ||
9 | import Control.Monad | ||
8 | 10 | ||
9 | data KikiDMessage = TODO deriving (Show,Read) | 11 | data KikiDMessage = TODO deriving (Show,Read) |
10 | 12 | ||
11 | instance Serialize KikiDMessage where | 13 | instance 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 | ||