Fireship · @fireship
Haskell in 100 Seconds
Uploaded November 29, 2021 · Length 2:30
Summary
haskell tutorial for beginners, covering its functional programming paradigm, lambda calculus, and immutable data
- haskell programming language
- functional programming
- lambda calculus
- immutable data
- haskell tutorial
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
haskell a statically typed
- 0:01
general-purpose language made famous for
- 0:03
expanding the minds of developers into
- 0:05
the functional programming paradigm you
- 0:07
see haskell is a purely functional
- 0:09
language based on lambda calculus which
- 0:11
means a function always produces the
- 0:13
same output given the same input unlike
- 0:15
an imperative language your code can't
- 0:17
modify the inputs or produce side
- 0:19
effects that would otherwise change the
- 0:20
behavior of the application it was first
- 0:22
developed in 1987 and named after
- 0:25
logician haskell curry whose work had a
- 0:27
massive influence on the functional
- 0:29
programming world it's been used to
- 0:30
build a wide variety of server-side
- 0:32
applications like the hasura api
- 0:34
platform spam filtering at facebook and
- 0:37
compilers for other languages like elm
- 0:39
and purescript and it's responsible for
- 0:41
a countless number of blog posts about
- 0:42
monads in haskell you write declarative
- 0:45
code where the program is a single
- 0:46
expression that is executed by
- 0:48
evaluating that expression it also uses
- 0:50
lazy evaluation which means an
- 0:52
expression is not evaluated until it's
- 0:55
actually used by a function this can
- 0:56
result in big performance gains but
- 0:58
unpredictable memory use at runtime all
- 1:00
data in a haskell program is immutable
- 1:02
which produces a lot of memory garbage
- 1:04
so it contains a garbage collector to
- 1:06
clean things up to get started install
- 1:08
the glasgow haskell compiler then create
- 1:10
a file ending in dot hs we don't work
- 1:12
with statements here only expressions
- 1:14
which is code that will always evaluate
- 1:16
to a value create a string with double
- 1:18
quotes then give it a name with the
- 1:20
equal sign the value is immutable and
- 1:22
can never be changed the type will
- 1:24
automatically be inferred or we can
- 1:25
strongly type it with a double colon as
- 1:27
a list of characters now to define a
- 1:30
function start with a name followed by
- 1:31
the arguments that you want to pass to
- 1:33
it on the right side define the logic of
- 1:35
the function and it will automatically
- 1:36
return a value based on the result of
- 1:38
the expression we can also statically
- 1:40
type it using an arrow to separate the
- 1:42
argument and return value we can call
- 1:44
the function by referencing its name
- 1:46
with the arguments all values including
- 1:48
functions are first class which means
- 1:50
they can be passed as arguments to other
- 1:52
functions if we try to print the result
- 1:53
to the standard output we get an error
- 1:55
that's because working with io creates a
- 1:57
side effect to write a program that
- 1:59
actually does something we write a main


