aboutsummaryrefslogtreecommitdiff
path: root/src/Wordle.hs
blob: d722ffac28e38c6677470fa43ff938b194208489 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{-# LANGUAGE ExistentialQuantification, RankNTypes, GADTs #-}
module Wordle where

import Data.Set (Set)
import qualified Data.Set as Set

data Environment = Environment {
  wordLength :: Int,
  wordList :: Set String
}

newtype Hints = Hints [(Char, Hint)]

data Hint = Correct | Contains | DoesNotContain

data AI where
  AI :: forall s. {
    internalState :: s,
    guessWord :: s -> Environment -> IO String,
    updateHints :: s -> Hints -> IO s
  } -> AI