Skip to content

Commit

Permalink
Prepare 0.2.13.1 release
Browse files Browse the repository at this point in the history
Reformatted.
Added workflows.
Updated package metadata.
  • Loading branch information
brianjosephmckeon authored Feb 2, 2024
1 parent add05c6 commit b6fa1f0
Show file tree
Hide file tree
Showing 31 changed files with 2,109 additions and 1,696 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@byteverse/l3c
12 changes: 12 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: build
on:
pull_request:
branches:
- "*"

jobs:
call-workflow:
uses: byteverse/.github/.github/workflows/build.yaml@main
secrets: inherit
with:
release: false
12 changes: 12 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: release
on:
push:
tags:
- "*"

jobs:
call-workflow:
uses: byteverse/.github/.github/workflows/build.yaml@main
secrets: inherit
with:
release: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.vscode/
dist
dist-*
cabal-dev
Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Revision history for byteslice

## 0.2.13.1 -- 2024-02-01

* Update package metadata.

## 0.2.13.0 -- 2024-01-12

* Add `replicate` and `replicateByte` to `Data.Bytes.Chunks`.
Expand Down Expand Up @@ -64,7 +68,7 @@
## 0.2.5.0 -- 2021-01-22

* Add `Data.Bytes.Chunks.concatByteString`.
* Expose `pinnedToByteString` to end users.
* Expose `pinnedToByteString` to end users.

## 0.2.4.0 -- 2020-10-15

Expand Down
2 changes: 0 additions & 2 deletions Setup.hs

This file was deleted.

44 changes: 24 additions & 20 deletions bench/Main.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Gauge.Main (defaultMain, bench, whnf, bgroup)
import Gauge.Main (bench, bgroup, defaultMain, whnf)

import Data.Bytes.Types
import Data.List (permutations)
Expand All @@ -10,19 +10,21 @@ naiveMconcat :: [Bytes] -> Bytes
naiveMconcat = foldr mappend mempty

main :: IO ()
main = defaultMain
[ bench "mconcat" $ whnf mconcat mconcatBytes
, bench "naiveMconcat" $ whnf naiveMconcat mconcatBytes
, bgroup "replace"
[ bench "the-dog-and-the-shadow" (whnf replaceMeat theDogAndTheShadow)
main =
defaultMain
[ bench "mconcat" $ whnf mconcat mconcatBytes
, bench "naiveMconcat" $ whnf naiveMconcat mconcatBytes
, bgroup
"replace"
[ bench "the-dog-and-the-shadow" (whnf replaceMeat theDogAndTheShadow)
]
]
]

mconcatBytes :: [Bytes]
mconcatBytes = fmap Ascii.fromString $ permutations ['a'..'g']
mconcatBytes = fmap Ascii.fromString $ permutations ['a' .. 'g']

replaceMeat :: Bytes -> Bytes
{-# noinline replaceMeat #-}
{-# NOINLINE replaceMeat #-}
replaceMeat x = Bytes.replace meat gruel x

meat :: Bytes
Expand All @@ -32,14 +34,16 @@ gruel :: Bytes
gruel = Ascii.fromString "gruel"

theDogAndTheShadow :: Bytes
theDogAndTheShadow = Ascii.fromString $ concat
[ "It happened that a Dog had got a piece of meat and was "
, "carrying it home in his mouth to eat it in peace. "
, "Now on his way home he had to cross a plank lying across "
, "a running brook. As he crossed, he looked down and saw his "
, "own shadow reflected in the water beneath. Thinking it was "
, "another dog with another piece of meat, he made up his mind "
, "to have that also. So he made a snap at the shadow in the water, "
, "but as he opened his mouth the piece of meat fell out, dropped "
, "into the water and was never seen more."
]
theDogAndTheShadow =
Ascii.fromString $
concat
[ "It happened that a Dog had got a piece of meat and was "
, "carrying it home in his mouth to eat it in peace. "
, "Now on his way home he had to cross a plank lying across "
, "a running brook. As he crossed, he looked down and saw his "
, "own shadow reflected in the water beneath. Thinking it was "
, "another dog with another piece of meat, he made up his mind "
, "to have that also. So he made a snap at the shadow in the water, "
, "but as he opened his mouth the piece of meat fell out, dropped "
, "into the water and was never seen more."
]
111 changes: 63 additions & 48 deletions byteslice.cabal
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
cabal-version: 2.4
name: byteslice
version: 0.2.13.0
synopsis: Slicing managed and unmanaged memory
cabal-version: 2.4
name: byteslice
version: 0.2.13.1
synopsis: Slicing managed and unmanaged memory
description:
This library provides types that allow the user to talk about a slice of
a ByteArray or a MutableByteArray. It also offers UnmanagedBytes, which
is kind of like a slice into unmanaged memory. However, it is just an
address and a length.
homepage: https://github.com/andrewthad/byteslice
bug-reports: https://github.com/andrewthad/byteslice/issues
license: BSD-3-Clause
license-file: LICENSE
author: Andrew Martin
maintainer: [email protected]
copyright: 2020 Andrew Martin
category: Data
extra-source-files: CHANGELOG.md

homepage: https://github.com/byteverse/byteslice
bug-reports: https://github.com/byteverse/byteslice/issues
license: BSD-3-Clause
license-file: LICENSE
author: Andrew Martin
maintainer: [email protected]
copyright: 2020 Andrew Martin
category: Data
extra-doc-files: CHANGELOG.md

flag avoid-rawmemchr
default: True
description: Avoid using rawmemchr which is non-portable GNU libc only
default: True
description: Avoid using rawmemchr which is non-portable GNU libc only

library
exposed-modules:
Expand All @@ -35,70 +36,84 @@ library
Data.Bytes.Text.Utf8
Data.Bytes.Text.Windows1252
Data.Bytes.Types

other-modules:
Data.Bytes.Search
Cstrlen
Data.Bytes.Byte
Data.Bytes.Pure
Data.Bytes.IO
Data.Bytes.Internal.Show
Data.Bytes.IO
Data.Bytes.Pure
Data.Bytes.Search
Reps
Cstrlen

build-depends:
, base >=4.14 && <5
, bytestring >=0.10.8 && <0.13
, natural-arithmetic >=0.1.4
, primitive >=0.7.4 && <0.10
, primitive-addr >=0.1 && <0.2
, primitive-unlifted >=0.1.2 && <2.2
, run-st >=0.1.1 && <0.2
, text >=1.2.5
, text-short >=0.1.3 && <0.2
, tuples >=0.1 && <0.2
, vector >=0.12 && <0.14
hs-source-dirs: src
ghc-options: -Wall -O2
if impl(ghc>=9.2)
, base >=4.14 && <5
, bytestring >=0.10.8 && <0.13
, natural-arithmetic >=0.1.4
, primitive >=0.7.4 && <0.10
, primitive-addr >=0.1 && <0.2
, primitive-unlifted >=0.1.2 && <2.2
, run-st >=0.1.1 && <0.2
, text >=1.2.5
, text-short >=0.1.3 && <0.2
, tuples >=0.1 && <0.2
, vector >=0.12 && <0.14

hs-source-dirs: src
ghc-options: -Wall -O2

if impl(ghc >=9.2)
hs-source-dirs: src-new-reps

else
hs-source-dirs: src-old-reps
if impl(ghc>=9.0)

if impl(ghc >=9.0)
hs-source-dirs: src-ghc-cstrlen

else
hs-source-dirs: src-no-ghc-cstrlen

default-language: Haskell2010
include-dirs: include
includes: bs_custom.h
include-dirs: include
includes: bs_custom.h
install-includes: bs_custom.h
c-sources: cbits/bs_custom.c
c-sources: cbits/bs_custom.c

if flag(avoid-rawmemchr)
cc-options: -DAVOID_RAWMEMCHR=1

test-suite test
default-language: Haskell2010
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: Main.hs
ghc-options: -Wall -O2
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: Main.hs
ghc-options: -Wall -O2
build-depends:
, base >=4.11.1 && <5
, base >=4.11.1 && <5
, byteslice
, bytestring
, primitive
, quickcheck-classes >=0.6.4
, quickcheck-classes >=0.6.4
, tasty
, tasty-hunit
, tasty-quickcheck
, text >=1.2
, transformers
, text >=1.2

benchmark bench
type: exitcode-stdio-1.0
type: exitcode-stdio-1.0
build-depends:
, base
, byteslice
, gauge
, primitive
ghc-options: -Wall -O2

ghc-options: -Wall -O2
default-language: Haskell2010
hs-source-dirs: bench
main-is: Main.hs
hs-source-dirs: bench
main-is: Main.hs

source-repository head
type: git
location: git://github.com/byteverse/byteslice.git
51 changes: 51 additions & 0 deletions fourmolu.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Number of spaces per indentation step
indentation: 2

# Max line length for automatic line breaking
column-limit: 200

# Styling of arrows in type signatures (choices: trailing, leading, or leading-args)
function-arrows: trailing

# How to place commas in multi-line lists, records, etc. (choices: leading or trailing)
comma-style: leading

# Styling of import/export lists (choices: leading, trailing, or diff-friendly)
import-export-style: leading

# Whether to full-indent or half-indent 'where' bindings past the preceding body
indent-wheres: false

# Whether to leave a space before an opening record brace
record-brace-space: true

# Number of spaces between top-level declarations
newlines-between-decls: 1

# How to print Haddock comments (choices: single-line, multi-line, or multi-line-compact)
haddock-style: multi-line

# How to print module docstring
haddock-style-module: null

# Styling of let blocks (choices: auto, inline, newline, or mixed)
let-style: auto

# How to align the 'in' keyword with respect to the 'let' keyword (choices: left-align, right-align, or no-space)
in-style: right-align

# Whether to put parentheses around a single constraint (choices: auto, always, or never)
single-constraint-parens: always

# Output Unicode syntax (choices: detect, always, or never)
unicode: never

# Give the programmer more choice on where to insert blank lines
respectful: true

# Fixity information for operators
fixities: []

# Module reexports Fourmolu should know about
reexports: []

2 changes: 1 addition & 1 deletion src-ghc-cstrlen/Cstrlen.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{-# language MagicHash #-}
{-# LANGUAGE MagicHash #-}

module Cstrlen
( cstringLength#
Expand Down
18 changes: 9 additions & 9 deletions src-new-reps/Reps.hs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{-# language DataKinds #-}
{-# language GADTSyntax #-}
{-# language KindSignatures #-}
{-# language MagicHash #-}
{-# language UnboxedTuples #-}
{-# language UnliftedNewtypes #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTSyntax #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE UnboxedTuples #-}
{-# LANGUAGE UnliftedNewtypes #-}

module Reps
( Bytes#(..)
( Bytes# (..)
, word8ToWord#
) where

import GHC.Exts (ByteArray#,Int#,RuntimeRep(..),Levity(Unlifted),TYPE,word8ToWord#)
import GHC.Exts (ByteArray#, Int#, Levity (Unlifted), RuntimeRep (..), TYPE, word8ToWord#)

newtype Bytes# :: TYPE ('TupleRep '[ 'BoxedRep 'Unlifted,'IntRep,'IntRep]) where
newtype Bytes# :: TYPE ('TupleRep '[ 'BoxedRep 'Unlifted, 'IntRep, 'IntRep]) where
Bytes# :: (# ByteArray#, Int#, Int# #) -> Bytes#
8 changes: 4 additions & 4 deletions src-no-ghc-cstrlen/Cstrlen.hs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{-# language MagicHash #-}
{-# language TypeFamilies #-}
{-# language UnliftedFFITypes #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UnliftedFFITypes #-}

module Cstrlen
( cstringLength#
) where

import GHC.Exts (Addr#,Int#)
import GHC.Exts (Addr#, Int#)

foreign import ccall unsafe "strlen" c_strlen :: Addr# -> Int#

Expand Down
Loading

0 comments on commit b6fa1f0

Please sign in to comment.