02-01 Defining a Function by Pattern Matching (Introduction to Haskell)

preview_player
Показать описание
We explain how to systematically define function by means of pattern matching, in a step-by-step process. We also introduce the concept of typed holes that help during the incremental development process.

00:00 Defining a function systematically
00:37 Setting up an empty module and GHCi
01:04 Compiler pragmas, enabling all warnings
01:49 Hiding functions from the Prelude
03:21 Type signature
05:28 A binding with a placeholder
06:10 undefined
07:07 Typed holes
10:08 Introducing names for the arguments
13:33 "One-liners" versus pattern matching
16:19 Systematic pattern matching
17:19 Splitting into multiple cases
18:56 Solving the case for the empty list
19:17 Recursion and solving the "cons" case
22:35 Improving the definition, fixing warnings
23:09 Wildcard patterns
24:23 Names that start with underscores
25:47 Trying out the function in GHCi
26:11 Discussing the quality of the definition
26:42 Recap: the "standard design pattern" (on lists)
27:15 Optionally aligning equations
27:52 Terminology: modules, declarations
Рекомендации по теме
Комментарии
Автор

hey just dropping and i am sorry that i forgot to comment in previous videos but your channel is just absolute treasure i learnt a lot of haskell and how to think in haskell way from you please keep going, also make videos on some hot topics like How rust programmer can pickup haskell how c programmers can benefit etc .... that will help the channel to grow and also a new perpective of thinking to many of us, thank you so much

masoom-theproudvegan
Автор

"length = foldr (\ _x -> (+) 1) 0"

hsklsri
visit shbcf.ru