diff --git a/src/Data/ByteArray/Builder/Bounded/Unsafe.hs b/src/Data/ByteArray/Builder/Bounded/Unsafe.hs index 9bad04f..5d5e58c 100644 --- a/src/Data/ByteArray/Builder/Bounded/Unsafe.hs +++ b/src/Data/ByteArray/Builder/Bounded/Unsafe.hs @@ -27,8 +27,11 @@ import Data.Primitive (MutableByteArray(..)) -- when executed. newtype Builder :: Nat -> Type where Builder :: - (forall s. MutableByteArray# s -> Int# -> State# s -> (# State# s, Int# #)) + (forall s. MutableByteArray# s -> Int# -> State# s -> (# State# s, Int# #)) + -- ^ This function takes a buffer, an offset, and a number of remaining bytes. + -- It returns the new offset. -> Builder n + -- | Constructor for 'Builder' that works on a function with lifted -- arguments instead of unlifted ones. This is just as unsafe as the diff --git a/src/Data/ByteArray/Builder/Unsafe.hs b/src/Data/ByteArray/Builder/Unsafe.hs index 18c2eba..844cf83 100644 --- a/src/Data/ByteArray/Builder/Unsafe.hs +++ b/src/Data/ByteArray/Builder/Unsafe.hs @@ -31,10 +31,11 @@ import qualified Data.ByteArray.Builder.Bounded.Unsafe as UnsafeBounded -- | An unmaterialized sequence of bytes that may be pasted -- into a mutable byte array. -newtype Builder = Builder - -- This functions takes an offset and a number of remaining bytes - -- and returns the new offset. - (forall s. MutableByteArray# s -> Int# -> Int# -> State# s -> (# State# s, Int# #)) +newtype Builder + = Builder (forall s. MutableByteArray# s -> Int# -> Int# -> State# s -> (# State# s, Int# #)) + -- ^ This function takes a buffer, an offset, and a number of remaining bytes. + -- It returns the new offset (should be greater than the old offset), or if + -- there was not enough space left in buffer, it returns -1. instance IsString Builder where {-# inline fromString #-}