Hangman

Hangman

Medium

Instructions

Implement the logic of the hangman game using functional reactive programming.

Hangman is a simple word guessing game.

Functional Reactive Programming is a way to write interactive programs. It differs from the usual perspective in that instead of saying "when the button is pressed increment the counter", you write "the value of the counter is the sum of the number of times the button is pressed."

Implement the basic logic behind hangman using functional reactive programming. You'll need to install an FRP library for this, this will be described in the language/track specific files of the exercise.

Except

The return value of the guess function is of type Except String Result.

An Except ε α represents a computation that may either result in an error of type ε or produce a successful value of type α. It is a monad, allowing such computations to be composed.

Reactive programming

For practical reasons, this exercise does not require a reactive programming approach. Instead, consider implementing a finite-state machine.

Edit via GitHub The link opens in a new window or tab
Lean Exercism

Ready to start Hangman?

Sign up to Exercism to learn and master Lean with 100 exercises, and real human mentoring, all for free.