<commit_before>{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE CPP, MagicHash #-}
{-# OPTIONS_HADDOCK hide #-}

-- NoImplicitPrelude

module GHC.List (
 mtake
 ) where

import Data.Maybe
import GHC.Base hiding (assert) 
import Language.Haskell.Liquid.Prelude (liquidAssert, liquidError) 

{-@ assert mtake  :: n: {v: Int | 0 <= v} -> [a] -> {v:[a] | (len(v) = n)} @-}
mtake          :: Int -> [a] -> [a]
-- OK mtake n xs = if n == 0 then [] else case xs of z:zs -> z : mtake (n-1) zs

mtake 0 _      = []
mtake n (x:xs) = x : (mtake ((liquidAssert (n > 0) n)-1) xs)
--OK: mtake n (x:xs) = x : (take (n-1) xs)

{- assert take  :: n: {v: Int | v >= 0 } -> xs:[a] -> {v:[a] | len(v) = ((len(xs) < n) ? len(xs) : n) } @-}



{- INLINE [0] take -}
--take            :: Int -> [a] -> [a]
--take (I# n#) xs = take_unsafe_UInt n# xs
---- take (I# n#) xs = takeUInt n# xs
--<commit_msg>many changes: 1. consCB goes through += to check for shadowing, 2. ANFTx renames wilds to prevent above...<commit_after>{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE CPP, MagicHash #-}
{-# OPTIONS_HADDOCK hide #-}

-- NoImplicitPrelude

module GHC.List (
 foo, mtake
 ) where

import Data.Maybe
import GHC.Base hiding (assert) 
import Language.Haskell.Liquid.Prelude (liquidAssert, liquidError) 

{-@ assert mtake  :: n: {v: Int | 0 <= v} -> [a] -> {v:[a] | (len(v) = n)} @-}
mtake          :: Int -> [a] -> [a]
-- OK mtake n xs = if n == 0 then [] else case xs of z:zs -> z : mtake (n-1) zs

mtake 0 _      = []
mtake n (x:xs) = x : (mtake ((liquidAssert (n /= 0) n) - 1) xs)
--OK: mtake n (x:xs) = x : (take (n-1) xs)

{- assert take  :: n: {v: Int | v >= 0 } -> xs:[a] -> {v:[a] | len(v) = ((len(xs) < n) ? len(xs) : n) } @-}

{-@ assert foo :: Int -> Int @-}
foo :: Int -> Int
foo 0 = 0
foo n = liquidAssert (n /= 0) (n - 1)

{- INLINE [0] take -}
--take            :: Int -> [a] -> [a]
--take (I# n#) xs = take_unsafe_UInt n# xs
---- take (I# n#) xs = takeUInt n# xs
--
{'fraction_non_alphanumeric': 0.22668727460072127, 'fraction_numerical': 0.012364760432766615, 'mean_word_length': 2.4493783303730017, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 26, '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': '3376926', 'n_tokens_mistral': 887, 'n_tokens_neox': 827, 'n_words': 255}