A Create-Your-Own-Adventure style game written in simple Haskell https://piturnah.xyz/blog/haskell-cyoa-day-1/
Find a file
Raphael Borun Das Gupta 6186ec9b73 Use variables to identify choices (#1)
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: ac0beb0f62

Reviewed-on: #1
Reviewed-by: Peter Hebden <piturnah@noreply.codeberg.org>
Co-authored-by: Raphael Borun Das Gupta <git@raphael.dasgupta.ch>
Co-committed-by: Raphael Borun Das Gupta <git@raphael.dasgupta.ch>
2024-11-11 19:33:16 +00:00
LICENSE Use variables to identify choices (#1) 2024-11-11 19:33:16 +00:00
Main.hs Use variables to identify choices (#1) 2024-11-11 19:33:16 +00:00
README.md Cabinet reshuffle 2024-11-09 16:05:51 +00:00

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.