{-# OPTIONS --cubical-compatible #-}
module Data.Bytestring.Primitive where
open import Agda.Builtin.Nat using (Nat)
open import Agda.Builtin.String using (String)
open import Agda.Builtin.Word using (Word64)
open import Data.Word8.Primitive using (Word8)
postulate
Bytestring : Set
index : Bytestring → Word64 → Word8
length : Bytestring → Nat
take : Word64 → Bytestring → Bytestring
drop : Word64 → Bytestring → Bytestring
show : Bytestring → String
{-# FOREIGN GHC import qualified Data.ByteString as B #-}
{-# FOREIGN GHC import qualified Data.Text as T #-}
{-# COMPILE GHC Bytestring = type B.ByteString #-}
{-# COMPILE GHC index = \ buf idx -> B.index buf (fromIntegral idx) #-}
{-# COMPILE GHC length = \ buf -> fromIntegral (B.length buf) #-}
{-# COMPILE GHC take = B.take . fromIntegral #-}
{-# COMPILE GHC drop = B.drop . fromIntegral #-}
{-# COMPILE GHC show = T.pack . Prelude.show #-}