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
|
||||
|
||||
data Node = Node
|
||||
{ nodeText :: T.Text
|
||||
, nodeAct :: Bool
|
||||
, nodeEdit :: Bool
|
||||
, nodeDelete :: Bool
|
||||
, nodeReply :: Bool
|
||||
, nodeChildren :: Map.HashMap NodeId Node
|
||||
{ nodeText :: !T.Text
|
||||
, nodeAct :: !Bool
|
||||
, nodeEdit :: !Bool
|
||||
, nodeDelete :: !Bool
|
||||
, nodeReply :: !Bool
|
||||
, nodeChildren :: !(Map.HashMap NodeId Node)
|
||||
} deriving (Show, Generic)
|
||||
|
||||
nodeOptions :: Options
|
||||
|
|
@ -61,11 +61,11 @@ parsePacket value packetType parser = parseJSON value >>= \o -> do
|
|||
{- Client -}
|
||||
|
||||
data ClientPacket
|
||||
= ClientHello [T.Text]
|
||||
| ClientAct Path
|
||||
| ClientEdit Path T.Text
|
||||
| ClientDelete Path
|
||||
| ClientReply Path T.Text
|
||||
= ClientHello ![T.Text]
|
||||
| ClientAct !Path
|
||||
| ClientEdit !Path !T.Text
|
||||
| ClientDelete !Path
|
||||
| ClientReply !Path !T.Text
|
||||
deriving (Show)
|
||||
|
||||
instance ToJSON ClientPacket where
|
||||
|
|
@ -101,8 +101,8 @@ instance FromJSON ClientPacket where
|
|||
{- Server -}
|
||||
|
||||
data ServerPacket
|
||||
= ServerHello [T.Text]
|
||||
| ServerUpdate Path Node
|
||||
= ServerHello ![T.Text]
|
||||
| ServerUpdate !Path !Node
|
||||
deriving (Show)
|
||||
|
||||
instance ToJSON ServerPacket where
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue