octane-0.13.1: Parse Rocket League replays.

Safe HaskellNone
LanguageHaskell2010

Octane.Utility.Embed

Description

These helper functions are usually used with embedFile.

Synopsis

Documentation

decodeBimap :: (FromJSON (Map b a), Ord a, Ord b) => ByteString -> Bimap a b Source #

Decodes some bytes into a bidirection map. The bytes are assumed to be a JSON object mapping values to keys. That means the resulting bimap is twisted from what you might expect.

>>> decodeBimap "{ \"value\": \"key\" }" :: Bimap.Bimap String String
fromList [("key","value")]

decodeMap :: FromJSON (Map a b) => ByteString -> Map a b Source #

Decodes some bytes into a map. The bytes are assumed to be a JSON object mapping keys to values.

>>> decodeMap "{ \"key\": \"value\" }" :: Map.Map String String
fromList [("key","value")]

decodeSet :: (FromJSON a, Ord a) => ByteString -> Set a Source #

Decodes some bytes into a set. The bytes are assumed to be a JSON array.

>>> decodeSet "[\"element\"]" :: Set.Set String
fromList ["element"]