<commit_before>module PatternGuard where

import Prelude hiding (take)

checkNum :: Int -> Bool
checkNum 2 = True
checkNum _ = False

take                   :: Int -> [a] -> [a]
take n _      | n <= 0 =  []
take _ []              =  []
take n (x:xs)          =  x : take (n-1) xs
<commit_msg>Make PatternGuard test self-contained<commit_after>module PatternGuard where

import Prelude hiding (take)

checkNum :: Int -> Bool
checkNum 2 = True
checkNum _ = False

-- Inline data structures, so that this test case
-- works independent of inter-module data flow
data Pair a b = Pair a b
data List a = Nil | Cons a (List a)


take :: Int -> List a -> List a
take n _      | n <= 0 =  Nil
take _ Nil             =  Nil
take n (Cons x xs)     =  Cons x (take (n-1) xs)


take2 :: Int -> List a -> List a
take2 n x = case Pair n x of
        Pair n _      | n <= 0 -> Nil
        Pair _ Nil             -> Nil
        Pair n (Cons x xs)     -> Cons x (take2 (n-1) xs)

{'fraction_non_alphanumeric': 0.10926118626430802, 'fraction_numerical': 0.011446409989594173, 'mean_word_length': 1.8975903614457832, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 14, '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': '2259293', 'n_tokens_mistral': 340, 'n_tokens_neox': 310, 'n_words': 134}