{-#LANGUAGE TypeSynonymInstances, FlexibleInstances #-} module Word where type WordString = String class Word w where create :: String -> w compareTo :: (Ord w) => w -> w -> Ordering toString :: w -> String instance Word WordString where create s = s :: WordString compareTo w1 w2 | w1 < w2 = LT | w1 > w2 = GT | otherwise = EQ toString w = w :: String