Use variables to identify choices and thus get rid of type `ChoiceIndent` and of the `allChoices` mapping function.
See also <https://chaos.social/@das_g/113456075190210290>:
> @piturnah@hachyderm.io Is there a reason not to use variables instead of separate values (be it indexes into a list or values of an Enum-like sum type) to identify the choices?
>
> I tried it and it seems to work fine:
|
||
|---|---|---|
| LICENSE | ||
| Main.hs | ||
| README.md | ||
CYOA Game with Day-1 Haskell
This program was made for the purposes of a tutorial on my blog.
You have embarked on a journey to create a CYOA game. How will you start?
(0) Choose a programming language
(1) Install compilers
(2) Give up and go home
I was chatting with a good friend of mine who is currently taking a one-semester module on functional programming using Haskell, and like many people is finding it hard to get anything to "click".
I think my issue is [that] unlike other languages where I could almost immediately see something I could make with it [...] I just don't see that in Haskell. Like I was trying to make cyoa games in Python from day 1.
The person who said this is a very competent game developer who has been writing code for a long time and has experience in multiple languages.
This stuck in my head, and I began considering how I might write a CYOA style game using only very simple Haskell, and I came to the conclusion that this is a very achievable goal.
I empathise a lot with the position that Haskell is obscure for new users, and I thought that perhaps some people may benefit from seeing this simple example of a "real" program a beginner may come up with using the kind of Haskell you would see in the very first stages of learning the language.