From 68897b93168b045e325cd7d20712bc316d2b6330 Mon Sep 17 00:00:00 2001 From: Andrew Martin Date: Thu, 5 Sep 2019 09:24:10 -0400 Subject: [PATCH] Add haddocks for constructors --- src/Data/ByteArray/Builder/Bounded/Unsafe.hs | 5 ++++- src/Data/ByteArray/Builder/Unsafe.hs | 9 +++++---- 2 files changed, 9 insertions(+), 5 deletions(-) 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 #-}