]> git.rmz.io Git - my-scheme.git/commitdiff
Print the sum of two arguments
authorSamir Benmendil <me@rmz.io>
Sat, 13 Jan 2018 22:06:26 +0000 (22:06 +0000)
committerSamir Benmendil <me@rmz.io>
Sat, 13 Jan 2018 22:06:26 +0000 (22:06 +0000)
`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`.

app/Main.hs

index cdd564b7550b29999e1707a7a0dc8d76aa5e4119..16e49391cac7ef3f27a6cf3c0abffab9d0fe3794 100644 (file)
@@ -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)))