Samir Benmendil [Sat, 13 Jan 2018 22:06:26 +0000 (22:06 +0000)]
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`.
Samir Benmendil [Sat, 13 Jan 2018 21:56:06 +0000 (21:56 +0000)]
Hello World with argument
This will simply print "Hello, " followed by the first argument from the
commandline.
Every Haskell program needs to have a main "action" in the Main module.
This is the entry point.
Files starting with `module <Foo>` will be part of the `Foo` module.
By convention modules are capitalized and definitions aren't.
`import System.Environment` provides `getArgs` to access cli arguments.
Haskell is strongly typed and types may be assigned with `::`. In this case
`main` is of type `IO ()` which is an IO action holding no information.
(more on that later hopefully, as I don't fully understand that.)