Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Revision history for array-builder

## 0.1.4.1 -- 2024-02-01

* Update package metadata.

## 0.1.4.0 -- 2023-08-30

* Add `constructN` functions to Data.Builder.Catenable.Bytes.
Expand Down
2 changes: 0 additions & 2 deletions Setup.hs

This file was deleted.

71 changes: 40 additions & 31 deletions array-builder.cabal
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
cabal-version: 2.2
name: array-builder
version: 0.1.4.0
synopsis: Builders for arrays
homepage: https://github.com/andrewthad/array-builder
bug-reports: https://github.com/andrewthad/array-builder/issues
license: BSD-3-Clause
license-file: LICENSE
author: Andrew Martin
maintainer: andrew.thaddeus@gmail.com
copyright: 2019 Andrew Martin
category: Data
extra-source-files: CHANGELOG.md
cabal-version: 2.2
name: array-builder
version: 0.1.4.1
synopsis: Builders for arrays
description: Builders for arrays.
homepage: https://github.com/byteverse/array-builder
bug-reports: https://github.com/byteverse/array-builder/issues
license: BSD-3-Clause
license-file: LICENSE
author: Andrew Martin
maintainer: amartin@layer3com.com
copyright: 2019 Andrew Martin
category: Data
extra-doc-files: CHANGELOG.md

library
exposed-modules:
Expand All @@ -19,35 +20,43 @@ library
Data.Builder.Catenable.Bytes
Data.Builder.Catenable.Text
Data.Builder.ST
other-modules:
Compat

other-modules: Compat
build-depends:
, array-chunks >=0.1 && <0.2
, base >=4.12 && <5
, bytebuild >=0.3.5
, byteslice >=0.2.7
, bytestring
, natural-arithmetic >=0.1.3
, primitive >=0.6.4 && <0.10
, run-st >=0.1 && <0.2
, text-short >=0.1.3
hs-source-dirs: src
if impl(ghc >= 8.9)
, array-chunks >=0.1 && <0.2
, base >=4.12 && <5
, bytebuild >=0.3.5 && <0.4
, byteslice >=0.2.7 && <0.3
, bytestring >=0.11.5 && <0.12
, natural-arithmetic >=0.1.3 && <0.3
, primitive >=0.6.4 && <0.10
, run-st >=0.1 && <0.2
, text-short >=0.1.3 && <0.2

hs-source-dirs: src

if impl(ghc >=8.9)
hs-source-dirs: src-post-8.9

else
hs-source-dirs: src-pre-8.9

default-language: Haskell2010
ghc-options: -Wall -O2
ghc-options: -Wall -O2

test-suite test
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: Main.hs
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: Main.hs
build-depends:
, array-builder
, base
, tasty
, tasty-hunit
ghc-options: -Wall -O2

ghc-options: -Wall -O2
default-language: Haskell2010

source-repository head
type: git
location: git://github.com/byteverse/array-builder.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: []

40 changes: 20 additions & 20 deletions src-post-8.9/Compat.hs
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
{-# language MagicHash #-}
{-# language UnboxedTuples #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE UnboxedTuples #-}

module Compat
( unsafeShrinkAndFreeze
, unsafeShrinkAndFreeze#
) where

import Data.Primitive (SmallArray(..),SmallMutableArray(..))
import GHC.Exts (SmallArray#,SmallMutableArray#,Int(I#))
import GHC.Exts (State#,Int#)
import GHC.ST (ST(ST))
import Data.Primitive (SmallArray (..), SmallMutableArray (..))
import GHC.Exts (Int (I#), Int#, SmallArray#, SmallMutableArray#, State#)
import GHC.ST (ST (ST))

import qualified GHC.Exts as Exts

-- Shrink the mutable array in place and then freeze it.
-- The argument must not be reused after being passed to
-- this function.
unsafeShrinkAndFreeze ::
SmallMutableArray s a
-> Int
-> ST s (SmallArray a)
{-# inline unsafeShrinkAndFreeze #-}
unsafeShrinkAndFreeze (SmallMutableArray x) (I# n) = ST
(\s0 -> case Exts.shrinkSmallMutableArray# x n s0 of
s1 -> case Exts.unsafeFreezeSmallArray# x s1 of
(# s2, r #) -> (# s2, SmallArray r #)
)
SmallMutableArray s a ->
Int ->
ST s (SmallArray a)
{-# INLINE unsafeShrinkAndFreeze #-}
unsafeShrinkAndFreeze (SmallMutableArray x) (I# n) =
ST
( \s0 -> case Exts.shrinkSmallMutableArray# x n s0 of
s1 -> case Exts.unsafeFreezeSmallArray# x s1 of
(# s2, r #) -> (# s2, SmallArray r #)
)

unsafeShrinkAndFreeze# ::
SmallMutableArray# s a
-> Int#
-> State# s
-> (# State# s, SmallArray# a #)
{-# inline unsafeShrinkAndFreeze# #-}
SmallMutableArray# s a ->
Int# ->
State# s ->
(# State# s, SmallArray# a #)
{-# INLINE unsafeShrinkAndFreeze# #-}
unsafeShrinkAndFreeze# x n s0 =
case Exts.shrinkSmallMutableArray# x n s0 of
s1 -> Exts.unsafeFreezeSmallArray# x s1
26 changes: 13 additions & 13 deletions src-pre-8.9/Compat.hs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{-# language MagicHash #-}
{-# language UnboxedTuples #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE UnboxedTuples #-}

module Compat
( unsafeShrinkAndFreeze
, unsafeShrinkAndFreeze#
) where

import Control.Monad.ST (ST)
import Data.Primitive (SmallArray,SmallMutableArray)
import GHC.Exts (SmallArray#,SmallMutableArray#,Int#,State#)
import Data.Primitive (SmallArray, SmallMutableArray)
import GHC.Exts (Int#, SmallArray#, SmallMutableArray#, State#)

import qualified Data.Primitive as PM
import qualified GHC.Exts as Exts
Expand All @@ -17,17 +17,17 @@ import qualified GHC.Exts as Exts
-- The argument must not be reused after being passed to
-- this function.
unsafeShrinkAndFreeze ::
SmallMutableArray s a
-> Int
-> ST s (SmallArray a)
{-# inline unsafeShrinkAndFreeze #-}
SmallMutableArray s a ->
Int ->
ST s (SmallArray a)
{-# INLINE unsafeShrinkAndFreeze #-}
unsafeShrinkAndFreeze arr = PM.freezeSmallArray arr 0

unsafeShrinkAndFreeze# ::
SmallMutableArray# s a
-> Int#
-> State# s
-> (# State# s, SmallArray# a #)
{-# inline unsafeShrinkAndFreeze# #-}
SmallMutableArray# s a ->
Int# ->
State# s ->
(# State# s, SmallArray# a #)
{-# INLINE unsafeShrinkAndFreeze# #-}
unsafeShrinkAndFreeze# x n s0 =
Exts.freezeSmallArray# x 0# n s0
Loading