exercism / exercism/haskell

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

Abierto
#1,102 5 comentarios 0 reacciones 0 asignados Ver en GitHub
on hold
Lenguaje dominante
Haskell
Estrellas
529
Forks
201
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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?

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.