Skip to content

Commit a156990

Browse files
committed
Add Data.Bytes.Indexed for functions on ByteArrayN
1 parent 0572502 commit a156990

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

byteslice.cabal

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cabal-version: 2.4
22
name: byteslice
3-
version: 0.2.14.0
3+
version: 0.2.15.0
44
synopsis: Slicing managed and unmanaged memory
55
description:
66
This library provides types that allow the user to talk about a slice of
@@ -35,6 +35,7 @@ library
3535
exposed-modules:
3636
Data.Bytes
3737
Data.Bytes.Chunks
38+
Data.Bytes.Indexed
3839
Data.Bytes.Encode.BigEndian
3940
Data.Bytes.Encode.LittleEndian
4041
Data.Bytes.Internal

src/Data/Bytes/Indexed.hs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{-# language DataKinds #-}
2+
{-# language TypeOperators #-}
3+
4+
module Data.Bytes.Indexed
5+
( ByteArrayN
6+
, append
7+
) where
8+
9+
import Data.Bytes.Types (ByteArrayN(ByteArrayN))
10+
import GHC.TypeNats (type (+))
11+
12+
append :: ByteArrayN m -> ByteArrayN n -> ByteArrayN (m + n)
13+
{-# inline append #-}
14+
append (ByteArrayN x) (ByteArrayN y) = ByteArrayN (x <> y)

0 commit comments

Comments
 (0)