module Linear.Binary
( putLinear
, getLinear
) where
import Data.Binary
import Data.Foldable (traverse_)
putLinear :: (Binary a, Foldable t) => t a -> Put
putLinear :: t a -> Put
putLinear = (a -> Put) -> t a -> Put
forall (t :: * -> *) (f :: * -> *) a b.
(Foldable t, Applicative f) =>
(a -> f b) -> t a -> f ()
traverse_ a -> Put
forall t. Binary t => t -> Put
put
getLinear :: (Binary a, Applicative t, Traversable t) => Get (t a)
getLinear :: Get (t a)
getLinear = t (Get a) -> Get (t a)
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA (t (Get a) -> Get (t a)) -> t (Get a) -> Get (t a)
forall a b. (a -> b) -> a -> b
$ Get a -> t (Get a)
forall (f :: * -> *) a. Applicative f => a -> f a
pure Get a
forall t. Binary t => Get t
get