From: Samir Benmendil Date: Sat, 13 Jan 2018 22:06:26 +0000 (+0000) Subject: Print the sum of two arguments X-Git-Url: https://git.rmz.io/my-scheme.git/commitdiff_plain/0742b9f77a6fe617f929e21e143e35cd6e3d3ed6?hp=5bd76ea90313c3b469e1b7fce192f3cd54c57a33 Print the sum of two arguments `read`'s type is defined as `read :: (Read a) => String -> a`, i.e. `read` takes as `String` and returns an `a` (number?). I don't know what `=>` means. (`(Read a)` is an instance of class Read ?) `show`'s type is a bit more complicated it seems as it has multiple instances for various types of input. But in essence it takes a type and returns a `String`. --- diff --git a/app/Main.hs b/app/Main.hs index cdd564b..16e4939 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -4,4 +4,4 @@ import System.Environment main :: IO () main = do args <- getArgs - putStrLn (args !! 0 ++ args !! 1) + putStrLn (show (read (args !! 0) + read (args !! 1)))