Sha256: 7dbc506745c351e08d336bf1b536345bf186ac7c7166acae43b34ccb8ea5b0ee
Contents?: true
Size: 716 Bytes
Versions: 312
Compression:
Stored size: 716 Bytes
Contents
module SecretHandshake (handshake) where import Data.Bits (testBit) data Action = Wink | DoubleBlink | CloseYourEyes | Jump | Reverse deriving (Show, Eq, Enum, Bounded) handshake :: Int -> [String] handshake = foldr f [] . toActions where f Reverse acc = reverse acc f action acc = toString action:acc toString action = case action of Wink -> "wink" DoubleBlink -> "double blink" CloseYourEyes -> "close your eyes" Jump -> "jump" Reverse -> undefined toActions :: Int -> [Action] toActions n = [act | act <- Reverse:[Wink .. Jump], n `testBit` fromEnum act]
Version data entries
312 entries across 312 versions & 1 rubygems