Skip to content

Commit 2e9cd95

Browse files
committed
Added get-started page.
1 parent 64fcfac commit 2e9cd95

File tree

5 files changed

+239
-11
lines changed

5 files changed

+239
-11
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

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

site/index.html

+28-11
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,48 @@
55
---
66
<div class="header">
77
<div class=" container ">
8-
<div class=" row ">
9-
<div class=" span12 col-sm-12 hidden-xs"><br></div>
8+
<div class="row" >
9+
<div class=" span12 col-sm-12 hidden-xs"><br><br></div>
10+
</div>
11+
<div class=" row " style="display: flex; align-items: center">
1012
<div class=" span6 col-md-6">
1113
<div class="branding">
12-
<br class="hidden-xs"><img src="/img/haskell-logo.svg" class="img-responsive">
13-
<h4 class="summary">An advanced, purely functional programming language</h4>
14+
<br class="hidden-xs">
15+
<img src="/img/haskell-logo.svg" class="img-responsive">
16+
<h4 class="summary">An advanced, purely functional programming language</h4>
1417
</div>
1518
</div>
1619
<div class=" span6 col-md-6">
17-
<div class="branding sample">
18-
<br class="visible-xs visible-sm">
19-
<h4 class="tag">Declarative, statically typed code.</h4>
20-
<div title="This example is contrived in order to demonstrate what Haskell looks like, including: (1) where syntax, (2) enumeration syntax, (3) pattern matching, (4) consing as an operator, (5) list comprehensions, (6) infix functions. Don&#39;t take it seriously as an efficient prime number generator." class="code-sample">
21-
<pre><span class='hs-definition'>primes</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>filterPrime</span> <span class='hs-keyglyph'>[</span><span class='hs-num'>2</span><span class='hs-keyglyph'>..</span><span class='hs-keyglyph'>]</span>
20+
<div class="row" id="code-example">
21+
<div class="branding sample">
22+
<br class="visible-xs visible-sm">
23+
<h4 class="tag">Declarative, statically typed code.</h4>
24+
<div title="This example is contrived in order to demonstrate what Haskell looks like, including: (1) where syntax, (2) enumeration syntax, (3) pattern matching, (4) consing as an operator, (5) list comprehensions, (6) infix functions. Don&#39;t take it seriously as an efficient prime number generator." class="code-sample">
25+
<pre><span class='hs-definition'>primes</span> <span class='hs-keyglyph'>=</span> <span class='hs-varid'>filterPrime</span> <span class='hs-keyglyph'>[</span><span class='hs-num'>2</span><span class='hs-keyglyph'>..</span><span class='hs-keyglyph'>]</span>
2226
<span class='hs-keyword'>where</span> <span class='hs-varid'>filterPrime</span> <span class='hs-layout'>(</span><span class='hs-varid'>p</span><span class='hs-conop'>:</span><span class='hs-varid'>xs</span><span class='hs-layout'>)</span> <span class='hs-keyglyph'>=</span>
2327
<span class='hs-varid'>p</span> <span class='hs-conop'>:</span> <span class='hs-varid'>filterPrime</span> <span class='hs-keyglyph'>[</span><span class='hs-varid'>x</span> <span class='hs-keyglyph'>|</span> <span class='hs-varid'>x</span> <span class='hs-keyglyph'>&lt;-</span> <span class='hs-varid'>xs</span><span class='hs-layout'>,</span> <span class='hs-varid'>x</span> <span class='hs-varop'>`mod`</span> <span class='hs-varid'>p</span> <span class='hs-varop'>/=</span> <span class='hs-num'>0</span><span class='hs-keyglyph'>]</span></pre>
28+
</div>
2429
</div>
2530
</div>
2631
<div class="row" id="get-started-button">
2732
<div class="span12 col-sm-12" style="padding-top: 10px;">
2833
<br/>
2934
<p class="text-center">
30-
<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>
3136
</p>
3237
</div>
3338
</div>
3439
</div>
3540
</div>
3641
</div>
3742
</div>
38-
<br><br class="hidden-xs hidden-sm"><br class="hidden-xs hidden-sm">
43+
44+
<br>
45+
<br class="hidden-sm">
46+
<br class="hidden-sm">
47+
<br class="hidden-xs hidden-sm">
48+
<br class="hidden-xs hidden-sm">
49+
3950
<div class="pattern-bg">
4051
<div class=" container ">
4152
<div class=" row ">
@@ -63,7 +74,13 @@ <h2>Try it!</h2>
6374
</div>
6475
</div>
6576
</div>
77+
6678
<br>
79+
<br class="hidden-sm">
80+
<br class="hidden-sm">
81+
<br class="hidden-xs hidden-sm">
82+
<br class="hidden-xs hidden-sm">
83+
6784
<div id="community-wrapper">
6885
<div class="videos">
6986
<div class=" container ">

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)