exercism / exercism/haskell

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

Đang mở
#1,102 5 bình luận 0 reaction 0 người được giao Xem trên GitHub
on hold
Ngôn ngữ chính
Haskell
Star
529
Fork
201
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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?

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.