Skip to content

Commit c7cb433

Browse files
Martinsostomjaguarpaw
authored andcommitted
fixes
1 parent a86cf4f commit c7cb433

File tree

1 file changed

+33
-38
lines changed

1 file changed

+33
-38
lines changed

site/get-started.markdown

Lines changed: 33 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,21 @@ isGettingStarted: true
77
# Get started
88
Welcome, new Haskeller! Read on to quickly set up your Haskell dev environment, execute your first lines of code, and get directions for further learning!
99

10+
## Content
11+
- [Set up Haskell dev environment](#set-up-haskell-dev-environment)
12+
- [GHCup: universal installer](#ghcup-universal-installer)
13+
- [Editor](#editor)
14+
- [Running first lines of code](#running-first-lines-of-code)
15+
- [Writing your first Haskell program](#writing-your-first-haskell-program)
16+
- [Join the community](#join-the-community)
17+
- [Next steps](#next-steps)
18+
1019
## Set up Haskell dev environment
1120

12-
### GHCup - universal installer
21+
### GHCup: universal installer
1322

1423
[GHCup](https://www.haskell.org/ghcup/#) is a universal installer for Haskell that will install for you everything you need to program in Haskell, and then will also help you manage those installations in the future (update, switch versions, ...).
1524

16-
It is simple to use, works the same way on all platforms (Linux, macOS, Windows), and gives you one central place/method to take care of your Haskell development setup.
17-
1825
Follow instructions at [GHCup webpage](https://www.haskell.org/ghcup/#) to install GHCup. Then, use it to install the Haskell Toolchain, which consists of:
1926

2027
1. **GHC** -> Haskell compiler. We will use it below to run our examples, but in practice, you will mostly be using a build tool like `cabal` or `Stack` to build your code, instead of `GHC` directly.
@@ -26,21 +33,11 @@ Follow instructions at [GHCup webpage](https://www.haskell.org/ghcup/#) to insta
2633
<div class="bs-callout bs-callout-info">
2734
<p>
2835
<h4>cabal and Stack -> which one should I install?</h4>
29-
cabal is the original build tool, while Stack was created as an alternative to cabal a time ago to solve some of the problems that cabal had and provide a more user-friendly experience. In the meantime, cabal solved most of those issues (including "cabal hell") and caught up with Stack regarding user experience, so the main difference between them at the moment is how they resolve dependencies, which for you as a beginner isn't a concern. Therefore, both are a good choice, and if not sure, you can install both and then use whatever the learning resources you will later use will point you to.
36+
We recommend installing both. Most Haskell projects can be built using Cabal, but some might require Stack. Installing both guarantees that you can use either, and while following the tutorial/book you can use whatever they recommend.
3037
</p>
3138
</div>
3239

33-
To confirm it is all installed correctly, you can run the following commands:
34-
```
35-
> ghc --version
36-
> haskell-language-server-wrapper --version
37-
> cabal --version # If you installed cabal
38-
> stack --version # If you installed Stack
39-
```
40-
4140
### Editor
42-
HLS (Haskell Language Server), which you just installed via GHCup, is the one that brings all the cool IDE features to editors, so as long as your editor has a decent Haskell language extension that utilizes HLS, you are good.
43-
4441
**Visual Studio Code** is a popular choice with well supported editor integration. Install the [Haskell extension](https://marketplace.visualstudio.com/items?itemName=haskell.haskell) and you are all set. It should work out of the box and use your installation of HLS.
4542

4643
Of other editors that have good Haskell extensions, the most popular ones are Vim and Emacs.
@@ -58,11 +55,10 @@ Let's do a simple calculation to check Haskell's computing capabilities:
5855
> 6 + 3^2 * 4
5956
42
6057
```
61-
Hey, they call Haskell lazy, but that was quick!
6258

63-
42 is a nice even number, but what about the even numbers after it? Let's get the first 10 even numbers after 42.
59+
42 is a nice even number, but what about the first 10 even numbers after it?
6460
```
65-
> take 10 $$ filter even [43..]
61+
> take 10 (filter even [43..])
6662
[44,46,48,50,52,54,56,58,60,62]
6763
```
6864

@@ -77,42 +73,43 @@ Great, you got the first taste of Haskell! Now let's get to running a real progr
7773

7874
## Writing your first Haskell program
7975

80-
In your editor, create a new file named `hievb.hs`.
76+
In your editor, create a new file named `hello.hs`.
8177

8278
Write the following in it:
83-
```
79+
```hs
8480
main = do
85-
putStrLn "Hi, everybody!"
86-
putStrLn $$ "Pls look at my favorite odd numbers: " ++ filter odd [10..20]
81+
putStrLn "Hello, everybody!"
82+
putStrLn ("Please look at my favorite odd numbers: " ++ filter odd [10..20])
8783
```
8884

89-
You can now compile it with `ghc`, which will produce `hievb` binary that we will then run:
85+
You can now compile it with `ghc`, which will produce `hello` binary that we will then run:
9086
```
91-
> ghc hievb.hs
92-
> ./hievb
93-
Hi, everybody!
94-
Pls look at my favorite odd numbers: [11,13,15,17,19]
87+
> ghc hello.hs
88+
> ./hello
89+
Hello, everybody!
90+
Please look at my favorite odd numbers: [11,13,15,17,19]
9591
```
9692

9793
There you go, you just wrote a short, polite program in Haskell!
9894

9995
**TIP**: To interpret the source file directly, without producing any build artifacts, you can use the special `runghc` command like this:
10096
```
101-
> runghc hievb.hs
102-
Hi, everybody!
103-
Pls look at my favorite odd numbers: [11,13,15,17,19]
97+
> runghc hello.hs
98+
Hello, everybody!
99+
Please look at my favorite odd numbers: [11,13,15,17,19]
104100
```
105101

106-
**GHCI TIP**: You can also load your file directly into `ghci`, which will enable you to play with any functions and other definitions you defined in it. So for our example, we can just load hievb.hs with ghci and then call the function `main` like this:
102+
**GHCI TIP**: You can also load your file directly into `ghci`, which will enable you to play with any functions and other definitions you defined in it. So for our example, we can just load `hello.hs` with ghci and then call the function `main` like this:
107103
```
108-
> ghci hievb.hs
109-
... Compiling ...
104+
> ghci hello.hs
105+
GHCi, version 8.10.7: https://www.haskell.org/ghc/ :? for help
106+
[1 of 1] Compiling Main ( hello.hs, interpreted )
107+
Ok, one module loaded.
110108
> main
111-
Hi, everybody!
109+
Hello, everybody!
110+
Please look at my favorite odd numbers: [11,13,15,17,19]
112111
```
113112

114-
**PRO TIP**: Once you progress a bit more in your Haskell journey, you will very likely want to use `cabal` or `Stack` for building your projects, and not `ghc` directly.
115-
116113
## Join the community
117114

118115
By joining the Haskell community you will find a great place to ask for help and learn about new developments in the Haskell ecosystem.
@@ -129,9 +126,7 @@ Check [https://www.haskell.org/community](https://www.haskell.org/community) for
129126

130127
## Next steps
131128

132-
There is a myth going around that you need Ph.D. in maths to be able to learn Haskell - and while it is true that Haskell in its elegance does often come close to the elegance of mathematics and borrows a lot of concepts from it, you certainly don't need any advanced math knowledge to be proficient with Haskell. Instead, what you need are some good learning resources!
133-
134-
Some popular free learning resources for beginners:
129+
Popular free learning resources for beginners:
135130

136131
- [Introductory Haskell course of the University of Pennsylvania (CIS194)](https://www.seas.upenn.edu/~cis1940/spring13/lectures.html) (course)
137132
- [Learn You a Haskell for Great Good!](http://learnyouahaskell.com/) (book)

0 commit comments

Comments
 (0)