module Flat.Instances.DList
()
where
import Flat.Class
import Flat.Instances.Mono
import Data.DList
instance Flat a => Flat (DList a) where
size :: DList a -> NumBits -> NumBits
size = [a] -> NumBits -> NumBits
forall mono.
(MonoFoldable mono, Flat (Element mono)) =>
mono -> NumBits -> NumBits
sizeList ([a] -> NumBits -> NumBits)
-> (DList a -> [a]) -> DList a -> NumBits -> NumBits
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DList a -> [a]
forall a. DList a -> [a]
toList
encode :: DList a -> Encoding
encode = [a] -> Encoding
forall mono.
(Flat (Element mono), MonoFoldable mono) =>
mono -> Encoding
encodeList ([a] -> Encoding) -> (DList a -> [a]) -> DList a -> Encoding
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DList a -> [a]
forall a. DList a -> [a]
toList
decode :: Get (DList a)
decode = [a] -> DList a
forall a. [a] -> DList a
fromList ([a] -> DList a) -> Get [a] -> Get (DList a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get [a]
forall b. (IsSequence b, Flat (Element b)) => Get b
decodeList