module Network.HPACK.Builder where

newtype Builder a = Builder ([a] -> [a])

(<<) :: Builder a -> a -> Builder a
Builder [a] -> [a]
b << :: forall a. Builder a -> a -> Builder a
<< a
entry = forall a. ([a] -> [a]) -> Builder a
Builder forall a b. (a -> b) -> a -> b
$ [a] -> [a]
b forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a
entry forall a. a -> [a] -> [a]
:)

empty :: Builder a
empty :: forall a. Builder a
empty = forall a. ([a] -> [a]) -> Builder a
Builder forall a. a -> a
id

singleton :: a -> Builder a
singleton :: forall a. a -> Builder a
singleton a
x = forall a. ([a] -> [a]) -> Builder a
Builder (a
x forall a. a -> [a] -> [a]
:)

run :: Builder a -> [a]
run :: forall a. Builder a -> [a]
run (Builder [a] -> [a]
b) = [a] -> [a]
b []