all tasks
This commit is contained in:
parent
b83f433714
commit
68f8f3e56b
14735 changed files with 178959 additions and 0 deletions
17
Task/Variadic-function/Haskell/variadic-function.hs
Normal file
17
Task/Variadic-function/Haskell/variadic-function.hs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
class PrintAllType t where
|
||||
process :: [String] -> t
|
||||
|
||||
instance PrintAllType (IO a) where
|
||||
process args = do mapM_ putStrLn args
|
||||
return undefined
|
||||
|
||||
instance (Show a, PrintAllType r) => PrintAllType (a -> r) where
|
||||
process args = \a -> process (args ++ [show a])
|
||||
|
||||
printAll :: (PrintAllType t) => t
|
||||
printAll = process []
|
||||
|
||||
main :: IO ()
|
||||
main = do printAll 5 "Mary" "had" "a" "little" "lamb"
|
||||
printAll 4 3 5
|
||||
printAll "Rosetta" "Code" "Is" "Awseome!"
|
||||
Loading…
Add table
Add a link
Reference in a new issue