September Morn Update
This commit is contained in:
parent
4e2d22a71d
commit
aac6731f2c
6856 changed files with 141342 additions and 21127 deletions
17
Task/Variadic-function/Haskell/variadic-function-1.hs
Normal file
17
Task/Variadic-function/Haskell/variadic-function-1.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" "Awesome!"
|
||||
Loading…
Add table
Add a link
Reference in a new issue