<commit_before>module Allergies (Allergen(..), allergies, isAllergicTo) where

allergies :: Int -> [Allergen]
allergies = undefined

isAllergicTo :: Allergen -> Int -> Bool
isAllergicTo = undefined<commit_msg>abitAnd<commit_after>module Allergies (Allergen(..), allergies, isAllergicTo) where

import Data.Bits

data Allergen = Cats
              | Chocolate
              | Eggs
              | Peanuts
              | Pollen
              | Shellfish
              | Strawberries
              | Tomatoes deriving (Eq)

value :: Allergen -> Int
value Eggs = 1
value Peanuts = 2
value Shellfish = 4
value Strawberries = 8
value Tomatoes = 16
value Chocolate = 32
value Pollen = 64
value Cats = 128

bitAnd :: Int -> Int -> Bool
bitAnd n m = (.&.) n m == m

isAllergicTo :: Allergen -> Int -> Bool
isAllergicTo alg n = bitAnd n $ value alg

allergies' :: [Allergen]
allergies' = [Cats, Chocolate, Eggs, Peanuts, Pollen, Shellfish, Strawberries, Tomatoes]

allergies :: Int -> [Allergen]
allergies n = filter (\a -> isAllergicTo a n) allergies'
{'fraction_non_alphanumeric': 0.10546500479386385, 'fraction_numerical': 0.012464046021093002, 'mean_word_length': 2.8241758241758244, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '2547622', 'n_tokens_mistral': 371, 'n_tokens_neox': 332, 'n_words': 106}