moved Aeson instances to tickLeiste
This commit is contained in:
parent
58a2662d2a
commit
ba8c620abe
3 changed files with 2 additions and 38 deletions
|
@ -130,6 +130,7 @@ tickLeisteToPlayerList :: M.Map U.UUID T.Text -> TL.TickLeiste -> [(TL.Tick, [(U
|
|||
tickLeisteToPlayerList pl = tickLeisteListToPlayerList pl . TL.toList
|
||||
|
||||
-- uff good luck reading that
|
||||
-- maybe it would be better to collect the UUID to Text map in a list and call M.fromList in the end?
|
||||
playerNameListToTickLeisteList :: [(TL.Tick, [T.Text])] -> IO ([(TL.Tick, [U.UUID])], M.Map U.UUID T.Text)
|
||||
playerNameListToTickLeisteList =
|
||||
foldM
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Data.Aeson.TickLeiste
|
||||
( JSONRequest (..),
|
||||
JSONEvent (..),
|
||||
)
|
||||
where
|
||||
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import qualified Data.Text as T
|
||||
import Data.TickLeiste
|
||||
import qualified Data.UUID as U
|
||||
|
||||
$(deriveJSON defaultOptions {sumEncoding = defaultTaggedObject {tagFieldName = "tickType", contentsFieldName = "tickValue"}} ''Tick)
|
||||
|
||||
data JSONRequest
|
||||
= SetPlayerTickR {sptRplayerUUID :: U.UUID, sptRtick :: Tick}
|
||||
| AddPlayerTickR {aptRplayerName :: T.Text, aptRtick :: Tick}
|
||||
| InitializeTickLeisteR {itlRtickLeiste :: [(Tick, [T.Text])]}
|
||||
| TickLeisteR
|
||||
| ChangeNameR {cnaRplayerUUID :: U.UUID, cnaRplayerName :: T.Text}
|
||||
| RemovePlayerR {rmpRplayerUUID :: U.UUID}
|
||||
deriving (Show,Eq)
|
||||
|
||||
$(deriveJSON defaultOptions {sumEncoding = defaultTaggedObject {tagFieldName = "requestType"}, fieldLabelModifier = drop 4} ''JSONRequest)
|
||||
|
||||
data JSONEvent
|
||||
= SetPlayerTickE {sptEplayerUUID :: U.UUID, sptEtick :: Tick}
|
||||
| AddPlayerTickE {aptEplayerUUID :: U.UUID, aptEplayerName :: T.Text, aptEtick :: Tick}
|
||||
| InitializeTickLeisteE {itlEtickLeiste :: [(Tick, [(U.UUID, T.Text)])]}
|
||||
| ChangeNameE {cnaEplayerUUID :: U.UUID, cnaEplayerName :: T.Text}
|
||||
| RemovePlayerE {rmpEplayerUUID :: U.UUID}
|
||||
deriving (Show,Eq)
|
||||
|
||||
$(deriveJSON defaultOptions {sumEncoding = defaultTaggedObject {tagFieldName = "eventType"}, fieldLabelModifier = drop 4} ''JSONEvent)
|
|
@ -1 +1 @@
|
|||
Subproject commit 58e9e6c16ce132ac98c56c9821cee3176c6bbc5b
|
||||
Subproject commit 41055a852102dcaa8658452c09c1c0afd2f42900
|
Loading…
Add table
Add a link
Reference in a new issue