blob: c4903ccdbf5472d2c5181f9b4bcc1ff5d3061244 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
module KikiD.Message where
import Data.Serialize
import qualified KikiD.GetLine
import qualified Data.ByteString.Char8 as B
import Data.Monoid
import Text.Read
data KikiDMessage = TODO deriving (Show,Read)
instance Serialize KikiDMessage where
put = putByteString . B.pack . show
get = do
x <- KikiD.GetLine.getLine
case (readEither (B.unpack x) :: Either String KikiDMessage) of
Right m -> return m
Left er -> fail ("PARSE ERROR: " <> er)
|