Skip to content

Instantly share code, notes, and snippets.

@Lifelovinglight
Created September 22, 2017 16:50
Show Gist options
  • Save Lifelovinglight/2c53fee9df1a6688a5f6f7256fe5291d to your computer and use it in GitHub Desktop.
Save Lifelovinglight/2c53fee9df1a6688a5f6f7256fe5291d to your computer and use it in GitHub Desktop.
how2adventure
data Verb = Look
| Take
| Drop
| Put
deriving (Enum, Show, Eq)
data Thing = Player
| Lantern
| Sword
| Bag
deriving (Enum, Show, Eq)
data Action = Verb (Maybe Thing) (Maybe Thing)
-- Parser state is list of visible/reachable things that can be resolved
data AdventureParser a = Parsec String [Things] a
parseCommand :: AdventureParser Action
parseCommand =
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment