Skip to content

Commit ee8ba05

Browse files
Added get-started page. (#227)
Co-authored-by: Tom Ellis <[email protected]>
1 parent 30c0cc0 commit ee8ba05

File tree

5 files changed

+188
-1
lines changed

5 files changed

+188
-1
lines changed

site/css/hl.css

+61
Original file line numberDiff line numberDiff line change
@@ -4667,3 +4667,64 @@ pre .hs-keyglyph {
46674667
min-width: 292.5px;
46684668
width:100%
46694669
}
4670+
4671+
/* Boostrap-style callouts (nice informational boxes),
4672+
taken from https://codepen.io/chrisdpratt/pen/QWBqKY .
4673+
*/
4674+
4675+
.bs-callout {
4676+
padding: 0px 0px 10px 20px;
4677+
margin: 20px 0;
4678+
border: 1px solid #eee;
4679+
border-left-width: 5px;
4680+
border-radius: 3px;
4681+
}
4682+
.bs-callout h4 {
4683+
margin-top: 0;
4684+
margin-bottom: 5px;
4685+
}
4686+
.bs-callout p:last-child {
4687+
margin-bottom: 0;
4688+
}
4689+
.bs-callout code {
4690+
border-radius: 3px;
4691+
}
4692+
.bs-callout+.bs-callout {
4693+
margin-top: -5px;
4694+
}
4695+
.bs-callout-default {
4696+
border-left-color: #777;
4697+
}
4698+
.bs-callout-default h4 {
4699+
color: #777;
4700+
}
4701+
.bs-callout-primary {
4702+
border-left-color: #9E358F;
4703+
}
4704+
.bs-callout-primary h4 {
4705+
color: #9E358F;
4706+
}
4707+
.bs-callout-success {
4708+
border-left-color: #5cb85c;
4709+
}
4710+
.bs-callout-success h4 {
4711+
color: #5cb85c;
4712+
}
4713+
.bs-callout-danger {
4714+
border-left-color: #d9534f;
4715+
}
4716+
.bs-callout-danger h4 {
4717+
color: #d9534f;
4718+
}
4719+
.bs-callout-warning {
4720+
border-left-color: #f0ad4e;
4721+
}
4722+
.bs-callout-warning h4 {
4723+
color: #f0ad4e;
4724+
}
4725+
.bs-callout-info {
4726+
border-left-color: #5bc0de;
4727+
}
4728+
.bs-callout-info h4 {
4729+
color: #5bc0de;
4730+
}

site/downloads.markdown

+7
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ page: downloads
44
isDownloads: true
55
---
66

7+
<div class="bs-callout bs-callout-info" style="padding: 0px 0px 10px 20px">
8+
<p>
9+
<h4>Psssst!</h4>
10+
Looking to get started with Haskell? If so, check out the [Get Started](/get-started) page!
11+
</p>
12+
</div>
13+
714
# Downloads
815

916
## Recommended installation instructions

site/get-started.markdown

+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
---
2+
title: Get Started
3+
page: get-started
4+
isGettingStarted: true
5+
---
6+
7+
# Get started
8+
9+
Welcome, new Haskeller! Read on to quickly set up your Haskell development environment, execute your first lines of code, and get directions for further learning.
10+
11+
## Content
12+
- [Set up a Haskell development environment](#set-up-a-haskell-development-environment)
13+
- [GHCup: universal installer](#ghcup-universal-installer)
14+
- [Editor](#editor)
15+
- [Running your first lines of code](#running-your-first-lines-of-code)
16+
- [Writing your first Haskell program](#writing-your-first-haskell-program)
17+
- [Participate in the community](#participate-in-the-community)
18+
- [Next steps](#next-steps)
19+
20+
## Set up a Haskell development environment
21+
22+
A complete Haskell development environment consists of the Haskell toolchain (compiler, language server, build tool) and an editor with good Haskell support. The quickest way to get this set up is to:
23+
24+
1. Use **GHCup** to install and manage the Haskell toolchain.
25+
2. Use [**VSCode**](https://code.visualstudio.com/) as the editor, with the Haskell extension installed.
26+
27+
### GHCup: universal installer
28+
29+
[GHCup](https://www.haskell.org/ghcup/#) is a universal installer for Haskell that will install everything you need to program in Haskell, and will help you manage those installations (update, switch versions, ...). Follow the instructions on the [GHCup webpage](https://www.haskell.org/ghcup/#) to install GHCup. Then use it to install the Haskell toolchain, which consists of:
30+
31+
1. **GHC** (The Haskell compiler) We will use GHC below to run our examples, but in practice you will mostly use a tool like Cabal or Stack to build your code, instead of GHC directly.
32+
2. **HLS** (The Haskell Language Server) You won't use HLS directly, instead your code editor will use it in the background to provide you with a great experience while editing Haskell code.
33+
3. **Cabal** (A Haskell build tool) You will use Cabal to structure your Haskell projects, build them, run them, define dependencies, ... .
34+
4. **Stack** (A Haskell build tool) An alternative to Cabal.
35+
36+
37+
<div class="bs-callout bs-callout-info">
38+
<p>
39+
<h4>Cabal and Stack: which one should I install?</h4>
40+
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 a tutorial or book you can use whatever they recommend.
41+
</p>
42+
</div>
43+
44+
### Editor
45+
[**Visual Studio Code**](https://code.visualstudio.com/) ([**VSCode**](https://code.visualstudio.com/)) is a popular choice with well-supported Haskell 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. To learn about support for other editors, check out [HLS docs for editor configuration](https://haskell-language-server.readthedocs.io/en/latest/configuration.html#configuring-your-editor).
46+
47+
## Running your first lines of code
48+
49+
We have everything set up, let's use it! The Haskell compiler, GHC, comes with an interactive interpreter called GHCi which is great for playing with Haskell and trying things out, so let's give it a spin. Run `ghci` at your command prompt, which will start a new GHCi prompt for you. Let's do a simple calculation to check Haskell's computing capabilities:
50+
```
51+
> 6 + 3^2 * 4
52+
42
53+
```
54+
55+
42 is a nice even number, but what about the first 10 even numbers after it?
56+
```
57+
> take 10 (filter even [43..])
58+
[44,46,48,50,52,54,56,58,60,62]
59+
```
60+
61+
What is the sum of those?
62+
```
63+
> sum it
64+
530
65+
```
66+
**NOTE**: We used a special feature of GHCi here, which is a special `it` variable that remembers the result of the last expression.
67+
68+
Great, you got the first taste of Haskell! Now let's get to running a real program.
69+
70+
## Writing your first Haskell program
71+
72+
In your editor, create a new file named `hello.hs`. Write the following in it:
73+
```hs
74+
main = do
75+
putStrLn "Hello, everybody!"
76+
putStrLn ("Please look at my favorite odd numbers: " ++ show (filter odd [10..20]))
77+
```
78+
79+
You can now compile it with `ghc` to produce an executable called `hello` that we will then run:
80+
```
81+
> ghc hello.hs
82+
> ./hello
83+
Hello, everybody!
84+
Please look at my favorite odd numbers: [11,13,15,17,19]
85+
```
86+
87+
There you go, you just wrote a short, polite program in Haskell!
88+
89+
**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:
90+
```
91+
> ghci hello.hs
92+
GHCi, version 8.10.7: https://www.haskell.org/ghc/ :? for help
93+
[1 of 1] Compiling Main ( hello.hs, interpreted )
94+
Ok, one module loaded.
95+
> main
96+
Hello, everybody!
97+
Please look at my favorite odd numbers: [11,13,15,17,19]
98+
```
99+
100+
## Participate in the community
101+
102+
By participating in the Haskell community you be able to ask for help and learn about new developments in the Haskell ecosystem. Some of the most popular places to interact with the community are:
103+
104+
- [Haskell Discourse](https://discourse.haskell.org/)
105+
- [Haskell subreddit](https://www.reddit.com/r/haskell/)
106+
- [https://wiki.haskell.org/IRC_channel](https://wiki.haskell.org/IRC_channel)
107+
108+
We recommend joining right now, and don't be shy to ask for help! Check [https://www.haskell.org/community](https://www.haskell.org/community) for a full list of resources relating to the Haskell community.
109+
110+
## Next steps
111+
112+
Popular free learning resources for beginners:
113+
114+
- [Introductory Haskell course of the University of Pennsylvania (CIS194)](https://www.seas.upenn.edu/~cis1940/spring13/lectures.html) (course)
115+
- [Learn You a Haskell for Great Good!](http://learnyouahaskell.com/) (book)
116+
- [Learn Haskell by building a blog generator](https://lhbg-book.link) (book)
117+
118+
This is just the tip of the iceberg though: check [Documentation](https://www.haskell.org/documentation/) for a bigger list of learning resources. That is it, fellow Haskeller! Enjoy learning Haskell, do (not?) be lazy and see you in the community!

site/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ <h4 class="tag">Declarative, statically typed code.</h4>
3232
<div class="span12 col-sm-12" style="padding-top: 10px;">
3333
<br/>
3434
<p class="text-center">
35-
<a href="/downloads/" class="btn btn-lg btn-primary" style="font-size: 1.5em">Get Haskell</a>
35+
<a href="/get-started/" class="btn btn-lg btn-primary" style="font-size: 1.5em">Get started</a>
3636
</p>
3737
</div>
3838
</div>

site/templates/nav.html

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
</div>
99
<div id="haskell-menu" class="collapse navbar-collapse">
1010
<ul class="nav navbar-nav navbar-right">
11+
<li $if(isGetStarted)$ class="active" $endif$ ><a href="/get-started/">Get started</a></li>
1112
<li $if(isDownloads)$ class="active" $endif$ ><a href="/downloads/">Downloads</a></li>
1213
<li $if(isCommunity)$ class="active" $endif$ ><a href="/community/">Community</a></li>
1314
<li $if(isDocumentation)$ class="active" $endif$ ><a href="/documentation/">Documentation</a></li>

0 commit comments

Comments
 (0)