<commit_before>{-# LANGUAGE CPP #-}

#include "fusion-phases.h"

module Data.Array.Parallel.Lifted.Unboxed (
  Segd,

  PArray_Int#,
  lengthPA_Int#, emptyPA_Int#,
  replicatePA_Int#, replicatelPA_Int#, repeatPA_Int#, repeatcPA_Int#,
  indexPA_Int#, extractPA_Int#, bpermutePA_Int#,
  appPA_Int#, applPA_Int#,
  packPA_Int#, pack'PA_Int#, combine2PA_Int#, combine2'PA_Int#,
  fromListPA_Int#,
  upToPA_Int#, enumFromToPA_Int#, enumFromThenToPA_Int#,
  enumFromStepLenPA_Int#, enumFromToEachPA_Int#,
  selectPA_Int#, selectorToIndices2PA#,
  lengthsSegdPA#, indicesSegdPA#, elementsSegdPA#, lengthsToSegdPA#, mkSegdPA#,
  sumPA_Int#, sumPAs_Int#,
  unsafe_mapPA_Int#, unsafe_zipWithPA_Int#, unsafe_foldPA_Int#,
  unsafe_scanPA_Int#,

  PArray_Word8#,
  lengthPA_Word8#, emptyPA_Word8#,
  replicatePA_Word8#, replicatelPA_Word8#, repeatPA_Word8#, repeatcPA_Word8#,
  indexPA_Word8#, extractPA_Word8#, bpermutePA_Word8#,
  appPA_Word8#, applPA_Word8#,
  packPA_Word8#, pack'PA_Word8#, combine2PA_Word8#, combine2'PA_Word8#,
  fromListPA_Word8#,
  unsafe_zipWithPA_Word8#, unsafe_foldPA_Word8#, unsafe_fold1PA_Word8#,
  unsafe_foldPAs_Word8#,

  PArray_Double#,
  lengthPA_Double#, emptyPA_Double#,
  replicatePA_Double#, replicatelPA_Double#, repeatPA_Double#, repeatcPA_Double#,
  indexPA_Double#, extractPA_Double#, bpermutePA_Double#,
  appPA_Double#, applPA_Double#,
  packPA_Double#, pack'PA_Double#, combine2PA_Double#, combine2'PA_Double#,
  fromListPA_Double#,
  unsafe_zipWithPA_Double#, unsafe_foldPA_Double#, unsafe_fold1PA_Double#,
  unsafe_foldPAs_Double#,

  PArray_Bool#,
  lengthPA_Bool#, replicatelPA_Bool#,
  packPA_Bool#, truesPA_Bool#, truesPAs_Bool#,

  fromBoolPA#, toBoolPA#
) where

import qualified Data.Array.Parallel.Unlifted as U
import Data.Array.Parallel.Base ((:*:)(..), fromBool, toBool)

import GHC.Exts ( Int#, Int(..), Word#,
                  Double#, Double(..) )
import GHC.Word ( Word8(..) )


import Debug.Trace

type Segd = U.Segd

type PArray_Int# = U.Array Int

lengthPA_Int# :: PArray_Int# -> Int#
lengthPA_Int# arr = case U.length arr of { I# n# -> n# }
{-# INLINE_PA lengthPA_Int# #-}

emptyPA_Int# :: PArray_Int#
emptyPA_Int# = U.empty
{-# INLINE_PA emptyPA_Int# #-}

replicatePA_Int# :: Int# -> Int# -> PArray_Int#
replicatePA_Int# n# i# = U.replicate (I# n#) (I# i#)
{-# INLINE_PA replicatePA_Int# #-}

{-# RULES

"replicatePA_Int#" forall n# i#.
  replicatePA_Int# n# i# = U.replicate (I# n#) (I# i#)

 #-}

replicatelPA_Int# :: Segd -> PArray_Int# -> PArray_Int#
replicatelPA_Int# segd is = U.replicate_s segd is
{-# INLINE_PA replicatelPA_Int# #-}

repeatPA_Int# :: Int# -> Int# -> PArray_Int# -> PArray_Int#
repeatPA_Int# n# len# is = U.repeat (I# n#) (I# len#) is
{-# INLINE_PA repeatPA_Int# #-}

repeatcPA_Int# :: Int# -> PArray_Int# -> Segd -> PArray_Int# -> PArray_Int#
repeatcPA_Int# n# ns segd is = U.repeat_c (I# n#) ns segd is
{-# INLINE_PA repeatcPA_Int# #-}

indexPA_Int# :: PArray_Int# -> Int# -> Int#
indexPA_Int# ns i# = case ns U.!: I# i# of { I# n# -> n# }
{-# INLINE_PA indexPA_Int# #-}

extractPA_Int# :: PArray_Int# -> Int# -> Int# -> PArray_Int#
extractPA_Int# xs i# n# = U.extract xs (I# i#) (I# n#)
{-# INLINE_PA extractPA_Int# #-}

bpermutePA_Int# :: PArray_Int# -> PArray_Int# -> PArray_Int#
bpermutePA_Int# ns is = U.bpermute ns is
{-# INLINE_PA bpermutePA_Int# #-}

appPA_Int# :: PArray_Int# -> PArray_Int# -> PArray_Int#
appPA_Int# ms ns = ms U.+:+ ns
{-# INLINE_PA appPA_Int# #-}

applPA_Int# :: Segd -> PArray_Int# -> Segd -> PArray_Int# -> PArray_Int#<commit_msg>Make sure replicatelPA_Int# is inlined<commit_after>{-# LANGUAGE CPP #-}

#include "fusion-phases.h"

module Data.Array.Parallel.Lifted.Unboxed (
  Segd,

  PArray_Int#,
  lengthPA_Int#, emptyPA_Int#,
  replicatePA_Int#, replicatelPA_Int#, repeatPA_Int#, repeatcPA_Int#,
  indexPA_Int#, extractPA_Int#, bpermutePA_Int#,
  appPA_Int#, applPA_Int#,
  packPA_Int#, pack'PA_Int#, combine2PA_Int#, combine2'PA_Int#,
  fromListPA_Int#,
  upToPA_Int#, enumFromToPA_Int#, enumFromThenToPA_Int#,
  enumFromStepLenPA_Int#, enumFromToEachPA_Int#,
  selectPA_Int#, selectorToIndices2PA#,
  lengthsSegdPA#, indicesSegdPA#, elementsSegdPA#, lengthsToSegdPA#, mkSegdPA#,
  sumPA_Int#, sumPAs_Int#,
  unsafe_mapPA_Int#, unsafe_zipWithPA_Int#, unsafe_foldPA_Int#,
  unsafe_scanPA_Int#,

  PArray_Word8#,
  lengthPA_Word8#, emptyPA_Word8#,
  replicatePA_Word8#, replicatelPA_Word8#, repeatPA_Word8#, repeatcPA_Word8#,
  indexPA_Word8#, extractPA_Word8#, bpermutePA_Word8#,
  appPA_Word8#, applPA_Word8#,
  packPA_Word8#, pack'PA_Word8#, combine2PA_Word8#, combine2'PA_Word8#,
  fromListPA_Word8#,
  unsafe_zipWithPA_Word8#, unsafe_foldPA_Word8#, unsafe_fold1PA_Word8#,
  unsafe_foldPAs_Word8#,

  PArray_Double#,
  lengthPA_Double#, emptyPA_Double#,
  replicatePA_Double#, replicatelPA_Double#, repeatPA_Double#, repeatcPA_Double#,
  indexPA_Double#, extractPA_Double#, bpermutePA_Double#,
  appPA_Double#, applPA_Double#,
  packPA_Double#, pack'PA_Double#, combine2PA_Double#, combine2'PA_Double#,
  fromListPA_Double#,
  unsafe_zipWithPA_Double#, unsafe_foldPA_Double#, unsafe_fold1PA_Double#,
  unsafe_foldPAs_Double#,

  PArray_Bool#,
  lengthPA_Bool#, replicatelPA_Bool#,
  packPA_Bool#, truesPA_Bool#, truesPAs_Bool#,

  fromBoolPA#, toBoolPA#
) where

import qualified Data.Array.Parallel.Unlifted as U
import Data.Array.Parallel.Base ((:*:)(..), fromBool, toBool)

import GHC.Exts ( Int#, Int(..), Word#,
                  Double#, Double(..) )
import GHC.Word ( Word8(..) )


import Debug.Trace

type Segd = U.Segd

type PArray_Int# = U.Array Int

lengthPA_Int# :: PArray_Int# -> Int#
lengthPA_Int# arr = case U.length arr of { I# n# -> n# }
{-# INLINE_PA lengthPA_Int# #-}

emptyPA_Int# :: PArray_Int#
emptyPA_Int# = U.empty
{-# INLINE_PA emptyPA_Int# #-}

replicatePA_Int# :: Int# -> Int# -> PArray_Int#
replicatePA_Int# n# i# = U.replicate (I# n#) (I# i#)
{-# INLINE_PA replicatePA_Int# #-}

{-# RULES

"replicatePA_Int#" forall n# i#.
  replicatePA_Int# n# i# = U.replicate (I# n#) (I# i#)

 #-}

replicatelPA_Int# :: Segd -> PArray_Int# -> PArray_Int#
replicatelPA_Int# segd is = U.replicate_s segd is
{-# INLINE_PA replicatelPA_Int# #-}

{-# RULES

"replicatelPA_Int#" forall segd is.
  replicatelPA_Int# segd is = U.replicate_s segd is

 #-}

repeatPA_Int# :: Int# -> Int# -> PArray_Int# -> PArray_Int#
repeatPA_Int# n# len# is = U.repeat (I# n#) (I# len#) is
{-# INLINE_PA repeatPA_Int# #-}

repeatcPA_Int# :: Int# -> PArray_Int# -> Segd -> PArray_Int# -> PArray_Int#
repeatcPA_Int# n# ns segd is = U.repeat_c (I# n#) ns segd is
{-# INLINE_PA repeatcPA_Int# #-}

indexPA_Int# :: PArray_Int# -> Int# -> Int#
indexPA_Int# ns i# = case ns U.!: I# i# of { I# n# -> n# }
{-# INLINE_PA indexPA_Int# #-}

extractPA_Int# :: PArray_Int# -> Int# -> Int# -> PArray_Int#
extractPA_Int# xs i# n# = U.extract xs (I# i#) (I# n#)
{-# INLINE_PA extractPA_Int# #-}

bpermutePA_Int# :: PArray_Int# -> PArray_Int# -> PArray_Int#
bpermutePA_Int# ns is = U.bpermute ns is
{-# INLINE_PA bpermutePA_Int# #-}

appPA_Int# :: PArray_Int# -> PArray_Int# -> PArray_Int#
appPA_Int# ms ns = ms U.+:+ ns
{-# INLINE_PA appPA_Int# #-}

applPA_Int# :: Segd -> PArray_Int# -> Segd -> PArray_Int# -> PArray_Int#
{'fraction_non_alphanumeric': 0.15246015246015246, 'fraction_numerical': 0.008593208593208593, 'mean_word_length': 5.110076206604572, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 57, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '818489', 'n_tokens_mistral': 3185, 'n_tokens_neox': 2995, 'n_words': 578}