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

Version Path
trackler-2.0.0.5 tracks/haskell/exercises/allergies/examples/success-standard/src/Allergies.hs
trackler-2.0.0.4 tracks/haskell/exercises/allergies/examples/success-standard/src/Allergies.hs
trackler-2.0.0.3 tracks/haskell/exercises/allergies/examples/success-standard/src/Allergies.hs
trackler-2.0.0.2 tracks/haskell/exercises/allergies/src/Example.hs
trackler-2.0.0.1 tracks/haskell/exercises/allergies/src/Example.hs
trackler-2.0.0.0 tracks/haskell/exercises/allergies/src/Example.hs
trackler-1.0.4.1 tracks/haskell/exercises/allergies/src/Example.hs
trackler-1.0.4.0 tracks/haskell/exercises/allergies/src/Example.hs
trackler-1.0.3.0 tracks/haskell/exercises/allergies/src/Example.hs
trackler-1.0.2.1 tracks/haskell/exercises/allergies/src/Example.hs
trackler-1.0.2.0 tracks/haskell/exercises/allergies/src/Example.hs
trackler-1.0.1.2 tracks/haskell/exercises/allergies/src/Example.hs
trackler-1.0.1.1 tracks/haskell/exercises/allergies/src/Example.hs
trackler-1.0.1.0 tracks/haskell/exercises/allergies/src/Example.hs
trackler-1.0.0.1 tracks/haskell/exercises/allergies/src/Example.hs
trackler-1.0.0 tracks/haskell/exercises/allergies/src/Example.hs