Skip to content

Commit

Permalink
Removes GHC.Word8.eqWord8 import for 7.10.3
Browse files Browse the repository at this point in the history
Removes import of GHC.Word.eqWord8 from BenchIndices,
as GHC.Word does not export eqWord8 in GHC 7.10.3.

Reimplements nilEq in terms of (==)
  • Loading branch information
archaephyrryx committed Aug 29, 2020
1 parent 7c7bf3e commit 43e4d41
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions bench/BenchIndices.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Data.Monoid
import Data.String
import Gauge
import Prelude hiding (words)
import GHC.Word (Word8, eqWord8)
import Data.Word (Word8)

import qualified Data.ByteString as S
import qualified Data.ByteString.Unsafe as S
Expand Down Expand Up @@ -99,7 +99,7 @@ bench_find_index_second bs =
{-# INLINE bench_find_index_second #-}

bench_elem_index_second :: S.ByteString -> Maybe Int
bench_elem_index_second bs =
bench_elem_index_second bs =
let nl = 0xa
in case S.elemIndex nl bs of
Just !i -> S.elemIndex nl (S.unsafeDrop (i+1) bs)
Expand All @@ -116,7 +116,7 @@ bench_elem_indices_second = safeHead . tail . bench_elem_indices

nilEq :: Word8 -> Word8 -> Bool
{-# NOINLINE nilEq #-}
nilEq = eqWord8
nilEq = (==)

bench_find_indices_inline :: S.ByteString -> [Int]
bench_find_indices_inline = S.findIndices (== 0xa)
Expand All @@ -132,4 +132,4 @@ bench_find_indices_noinline = S.findIndices (nilEq 0xa)

bench_find_index_noinline :: S.ByteString -> Maybe Int
bench_find_index_noinline = S.findIndex (nilEq 0xa)
{-# INLINE bench_find_index_noinline #-}
{-# INLINE bench_find_index_noinline #-}

0 comments on commit 43e4d41

Please sign in to comment.