[Learning Mode] Discussion: How do we best introduce case-expressions?
- Lingua principale
- Haskell
- Stelle
- 529
- Fork
- 201
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
The goal of this issue is to come up with a code example that can be used as the basis for an exercise that introduces `case-expressions` in Haskell.
A few thoughts:
- We don't have to teach _everything_ about case expressions (and indeed, we probably shouldn't). We'd rather have several smaller exercises that build on each other than one big exercise. This gets people writing code quickly, which helps the concept to start sinking in
- We'd like to introduce this as early as possible in the concept tree, maybe right after _Temperature_, which introduces a couple of basic numeric types (`Int` and `Float`). But if the example code is easier to do using something other than numbers, then we can introduce another exercise first, before `case-expressions`.
- The code doesn't need to be ideal, idiomatic Haskell. This is a tiny stepping stone towards understanding `case` in Haskell, but students will quickly move beyond this into code that uses more of the language, and uses the language in ways that are more typical.
Elixir introduces case expressions with this exercise:
https://exercism.org/tracks/elixir/exercises/german-sysadmin
The example solution looks like this:
https://github.com/exercism/elixir/blob/main/exercises/concept/german-sysadmin/.meta/exemplar.ex
Is this a bit of code that would translate well into Haskell? (Would it feel like decent Haskell, or would it feel weird and foreign?)
What are some other sample bits of code that use `case` in a way that is potentially easy to understand for people who are new to Haskell?
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.