Sha256: 2b8446f43ed0697d8ebf6102baeb717c60d8a67d8f16a6accf345bd97d616a39
Contents?: true
Size: 516 Bytes
Versions: 396
Compression:
Stored size: 516 Bytes
Contents
module Allergies (Allergen(..), isAllergicTo, allergies) where import Data.Bits (testBit) data Allergen = Eggs | Peanuts | Shellfish | Strawberries | Tomatoes | Chocolate | Pollen | Cats deriving (Show, Eq, Enum) isAllergicTo :: Allergen -> Int -> Bool isAllergicTo allergen code = testBit code (fromEnum allergen) allergies :: Int -> [Allergen] allergies code = filter (`isAllergicTo` code) [Eggs ..]
Version data entries
396 entries across 396 versions & 1 rubygems