exercism / exercism/haskell

[Learning Mode] Discussion: How do we best introduce case-expressions?

Offen
#1,102 5 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
on hold
Vorherrschende Sprache
Haskell
Sterne
529
Forks
201
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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?

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.