getLine' :: IO String
getLine' = do x <- getChar
if x == '\n' then
return []
else
do xs <- getLine'
return (x:xs)
getLine2 :: IO String
getLine2 = getChar >>=
\x ->
if x == '\n' then
return []
else
getLine2 >>= \xs ->
return (x:xs)
putStr' :: String -> IO ()
putStr' [] = return ()
putStr' (x:xs) = do putChar x
putStr' xs
putStrLn' :: String -> IO ()
putStrLn' s = do putStr' s
putChar '\n'
main :: IO ()
main = getLine' >>= \name -> putStrLn' ("World " ++ name ++ "!")
dropW :: (a -> Bool) -> [a] -> [a]
dropW _ [] = []
dropW p s@(x:xs) | p x = s
| otherwise = dropW p xs
bot = bot
g [1,2] = 1
g _ = 2
take1 :: Int -> [a] -> [a]
take1 0 _ = []
take1 _ [] = []
take1 n (x:xs) = x : take1 (n-1) xs
take2 :: Int -> [a] -> [a]
take2 _ [] = []
take2 0 _ = []
take2 n (x:xs) = x : take2 (n-1) xs
fn ~(a,b) = 1
fn2 (a,b) = 2
take3 :: Int -> [a] -> [a]
take3 m xs = case (m,xs) of
(0,_) -> []
(_,[]) -> []
(n,y:ys) -> y : take3 (n-1) ys