codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
module Main where import Control.Applicative import Control.Monad divisible x y = x `mod` y == 0 bigbad x = let a = f 3 "big"; b = f 5 "bad" in case liftM2 (++) a b <|> a <|> b of (Just a) -> a Nothing -> show x where f v s | divisible x v = Just s | otherwise = Nothing main = do print $ map bigbad $ enumFromTo 1 150
Private
[
?
]
Run code
Submit