Add haddocks for constructors

This commit is contained in:
Andrew Martin 2019-09-05 09:24:10 -04:00
parent 1c17d129ff
commit 68897b9316
2 changed files with 9 additions and 5 deletions

View file

@ -27,8 +27,11 @@ import Data.Primitive (MutableByteArray(..))
-- when executed. -- when executed.
newtype Builder :: Nat -> Type where newtype Builder :: Nat -> Type where
Builder :: 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 -> Builder n
-- | Constructor for 'Builder' that works on a function with lifted -- | Constructor for 'Builder' that works on a function with lifted
-- arguments instead of unlifted ones. This is just as unsafe as the -- arguments instead of unlifted ones. This is just as unsafe as the

View file

@ -31,10 +31,11 @@ import qualified Data.ByteArray.Builder.Bounded.Unsafe as UnsafeBounded
-- | An unmaterialized sequence of bytes that may be pasted -- | An unmaterialized sequence of bytes that may be pasted
-- into a mutable byte array. -- into a mutable byte array.
newtype Builder = Builder newtype Builder
-- This functions takes an offset and a number of remaining bytes = Builder (forall s. MutableByteArray# s -> Int# -> Int# -> State# s -> (# State# s, Int# #))
-- and returns the new offset. -- ^ This function takes a buffer, an offset, and a number of remaining bytes.
(forall s. MutableByteArray# s -> Int# -> Int# -> State# s -> (# State# s, Int# #)) -- 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 instance IsString Builder where
{-# inline fromString #-} {-# inline fromString #-}