{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MonoLocalBinds #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving ,DeriveGeneric #-}
{-# LANGUAGE CPP #-}
module Flat.Instances.Containers (sizeMap
, encodeMap
, decodeMap
) where
import Flat.Instances.Util
import Data.Map
import Flat.Instances.Base()
import Flat.Instances.Mono
import Data.Tree
import Data.Set
import Data.IntMap
import Data.Sequence
instance Flat a => Flat (IntMap a) where
size :: IntMap a -> NumBits -> NumBits
size = forall r.
(Flat (ContainerKey r), Flat (MapValue r), IsMap r) =>
Size r
sizeMap
encode :: IntMap a -> Encoding
encode = forall map.
(Flat (ContainerKey map), Flat (MapValue map), IsMap map) =>
map -> Encoding
encodeMap
decode :: Get (IntMap a)
decode = forall map.
(Flat (ContainerKey map), Flat (MapValue map), IsMap map) =>
Get map
decodeMap
instance (Flat a, Flat b, Ord a) => Flat (Map a b) where
size :: Map a b -> NumBits -> NumBits
size = forall r.
(Flat (ContainerKey r), Flat (MapValue r), IsMap r) =>
Size r
sizeMap
encode :: Map a b -> Encoding
encode = forall map.
(Flat (ContainerKey map), Flat (MapValue map), IsMap map) =>
map -> Encoding
encodeMap
decode :: Get (Map a b)
decode = forall map.
(Flat (ContainerKey map), Flat (MapValue map), IsMap map) =>
Get map
decodeMap
instance Flat a => Flat (Seq a) where
size :: Seq a -> NumBits -> NumBits
size = forall mono.
(MonoFoldable mono, Flat (Element mono)) =>
mono -> NumBits -> NumBits
sizeList
encode :: Seq a -> Encoding
encode = forall mono.
(Flat (Element mono), MonoFoldable mono) =>
mono -> Encoding
encodeList
decode :: Get (Seq a)
decode = forall a. [a] -> Seq a
Data.Sequence.fromList forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall b. (IsSequence b, Flat (Element b)) => Get b
decodeList
instance (Flat a,Ord a) => Flat (Set a) where
size :: Set a -> NumBits -> NumBits
size = forall set. (IsSet set, Flat (Element set)) => Size set
sizeSet
encode :: Set a -> Encoding
encode = forall set. (IsSet set, Flat (Element set)) => set -> Encoding
encodeSet
decode :: Get (Set a)
decode = forall set. (IsSet set, Flat (Element set)) => Get set
decodeSet
#if ! MIN_VERSION_containers(0,5,8)
deriving instance Generic (Tree a)
#endif
instance (Flat a) => Flat (Tree a)