Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch Data.Text.Array to Data.Array.Byte #474

Merged
merged 2 commits into from
Feb 28, 2023
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
5 changes: 3 additions & 2 deletions .github/workflows/emulated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ jobs:
githubToken: ${{ github.token }}
install: |
apt-get update -y
apt-get install -y ghc libghc-tasty-quickcheck-dev libghc-tasty-hunit-dev
apt-get install -y curl ghc libghc-tasty-quickcheck-dev libghc-tasty-hunit-dev
run: |
curl -s https://hackage.haskell.org/package/data-array-byte-0.1/data-array-byte-0.1.tar.gz | tar xz
ghc --version
ghc --make -isrc:tests -o Main cbits/*.c tests/Tests.hs +RTS -s
ghc --make -isrc:tests:data-array-byte-0.1 -o Main cbits/*.c tests/Tests.hs +RTS -s
./Main +RTS -s
22 changes: 16 additions & 6 deletions src/Data/Text/Array.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
{-# LANGUAGE BangPatterns, CPP, MagicHash, RankNTypes,
RecordWildCards, UnboxedTuples, UnliftedFFITypes #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE UnboxedTuples #-}
{-# LANGUAGE UnliftedFFITypes #-}

{-# OPTIONS_GHC -fno-warn-unused-matches #-}
-- |
-- Module : Data.Text.Array
Expand All @@ -24,8 +31,10 @@
module Data.Text.Array
(
-- * Types
Array(..)
, MArray(..)
Array
, pattern ByteArray
, MArray
, pattern MutableByteArray
-- * Functions
, resizeM
, shrinkM
Expand Down Expand Up @@ -60,12 +69,13 @@ import GHC.ST (ST(..), runST)
import GHC.Word (Word8(..))
import qualified Prelude
import Prelude hiding (length, read, compare)
import Data.Array.Byte (ByteArray(..), MutableByteArray(..))

-- | Immutable array type.
data Array = ByteArray ByteArray#
type Array = ByteArray

-- | Mutable array type, for use in the ST monad.
data MArray s = MutableByteArray (MutableByteArray# s)
type MArray = MutableByteArray

-- | Create an uninitialized mutable array.
new :: forall s. Int -> ST s (MArray s)
Expand Down
3 changes: 3 additions & 0 deletions text.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ library
ghc-prim >= 0.2 && < 0.11,
template-haskell >= 2.5 && < 2.21

if impl(ghc < 9.4)
build-depends: data-array-byte >= 0.1 && < 0.2

ghc-options: -Wall -fwarn-tabs -funbox-strict-fields -O2
if flag(developer)
ghc-options: -fno-ignore-asserts
Expand Down