Make API data types strict
This commit is contained in:
parent
4b0c40bf2b
commit
5c11dac047
1 changed files with 13 additions and 13 deletions
|
|
@ -30,12 +30,12 @@ import GHC.Generics
|
||||||
type NodeId = T.Text
|
type NodeId = T.Text
|
||||||
|
|
||||||
data Node = Node
|
data Node = Node
|
||||||
{ nodeText :: T.Text
|
{ nodeText :: !T.Text
|
||||||
, nodeAct :: Bool
|
, nodeAct :: !Bool
|
||||||
, nodeEdit :: Bool
|
, nodeEdit :: !Bool
|
||||||
, nodeDelete :: Bool
|
, nodeDelete :: !Bool
|
||||||
, nodeReply :: Bool
|
, nodeReply :: !Bool
|
||||||
, nodeChildren :: Map.HashMap NodeId Node
|
, nodeChildren :: !(Map.HashMap NodeId Node)
|
||||||
} deriving (Show, Generic)
|
} deriving (Show, Generic)
|
||||||
|
|
||||||
nodeOptions :: Options
|
nodeOptions :: Options
|
||||||
|
|
@ -61,11 +61,11 @@ parsePacket value packetType parser = parseJSON value >>= \o -> do
|
||||||
{- Client -}
|
{- Client -}
|
||||||
|
|
||||||
data ClientPacket
|
data ClientPacket
|
||||||
= ClientHello [T.Text]
|
= ClientHello ![T.Text]
|
||||||
| ClientAct Path
|
| ClientAct !Path
|
||||||
| ClientEdit Path T.Text
|
| ClientEdit !Path !T.Text
|
||||||
| ClientDelete Path
|
| ClientDelete !Path
|
||||||
| ClientReply Path T.Text
|
| ClientReply !Path !T.Text
|
||||||
deriving (Show)
|
deriving (Show)
|
||||||
|
|
||||||
instance ToJSON ClientPacket where
|
instance ToJSON ClientPacket where
|
||||||
|
|
@ -101,8 +101,8 @@ instance FromJSON ClientPacket where
|
||||||
{- Server -}
|
{- Server -}
|
||||||
|
|
||||||
data ServerPacket
|
data ServerPacket
|
||||||
= ServerHello [T.Text]
|
= ServerHello ![T.Text]
|
||||||
| ServerUpdate Path Node
|
| ServerUpdate !Path !Node
|
||||||
deriving (Show)
|
deriving (Show)
|
||||||
|
|
||||||
instance ToJSON ServerPacket where
|
instance ToJSON ServerPacket where
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue