module Rattletrap.BytePut where

import qualified Data.ByteString as ByteString
import qualified Data.ByteString.Builder as Builder
import qualified Data.ByteString.Lazy as LazyByteString
import qualified Data.Int as Int
import qualified Data.Word as Word

type BytePut = Builder.Builder

toByteString :: BytePut -> ByteString.ByteString
toByteString :: BytePut -> ByteString
toByteString = ByteString -> ByteString
LazyByteString.toStrict (ByteString -> ByteString)
-> (BytePut -> ByteString) -> BytePut -> ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BytePut -> ByteString
toLazyByteString

toLazyByteString :: BytePut -> LazyByteString.ByteString
toLazyByteString :: BytePut -> ByteString
toLazyByteString = BytePut -> ByteString
Builder.toLazyByteString

byteString :: ByteString.ByteString -> BytePut
byteString :: ByteString -> BytePut
byteString = ByteString -> BytePut
Builder.byteString

float :: Float -> BytePut
float :: Float -> BytePut
float = Float -> BytePut
Builder.floatLE

int8 :: Int.Int8 -> BytePut
int8 :: Int8 -> BytePut
int8 = Int8 -> BytePut
Builder.int8

int32 :: Int.Int32 -> BytePut
int32 :: Int32 -> BytePut
int32 = Int32 -> BytePut
Builder.int32LE

int64 :: Int.Int64 -> BytePut
int64 :: Int64 -> BytePut
int64 = Int64 -> BytePut
Builder.int64LE

word8 :: Word.Word8 -> BytePut
word8 :: Word8 -> BytePut
word8 = Word8 -> BytePut
Builder.word8

word32 :: Word.Word32 -> BytePut
word32 :: Word32 -> BytePut
word32 = Word32 -> BytePut
Builder.word32LE

word64 :: Word.Word64 -> BytePut
word64 :: Word64 -> BytePut
word64 = Word64 -> BytePut
Builder.word64LE