rattletrap-9.3.2: src/lib/Rattletrap/Decode/Dictionary.hs
module Rattletrap.Decode.Dictionary
( decodeDictionary
)
where
import Rattletrap.Decode.Common
import Rattletrap.Decode.Str
import Rattletrap.Type.Dictionary
import Rattletrap.Type.Str
decodeDictionary :: Decode a -> Decode (Dictionary a)
decodeDictionary decodeValue = do
key <- decodeStr
case filter (/= '\x00') (fromStr key) of
"None" -> pure (DictionaryEnd key)
_ ->
DictionaryElement key <$> decodeValue <*> decodeDictionary decodeValue