-
Notifications
You must be signed in to change notification settings - Fork 1
/
notes.txt
31 lines (28 loc) · 1.3 KB
/
notes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
this is a notes used to learn haskell following the wikiboks tutorial.
staring here:
1)forget everything learned in python , c++ or java as haskell is completely different.
2)GHC is a state-of-the-art, open source, compiler and interactive environment for the functional language Haskell. Highlights
3)first install ghc using(curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh)
4)haskell programs end with .hs file extension
5) creating haskell_1.hs
6)to run a program follow these steps:
debian:/home/jdtang/haskell_tutorial/code# ghc -o hello_you --make listing2.hs
debian:/home/jdtang/haskell_tutorial/code# ./hello_you Jonathan
Hello, Jonathan
7)-o helps create a specifies the name of the executable you want to create, and then you just specify the name of the Haskell source file
8)completed First steps from the article
*)module Main where
import System.Environment
include this the start of the program
*)main :: IO()
declaring main function
*)do
starts the program
*)args <- getArgs
this get function like ex: function main(args)
*)args <- getLine
this reads the entire line ex: args = in.nextLine()
*)there are two ways to output into the console
1)putStrLn()
2)print()
*)to concatenate into the string use ++