
7 Aug
2004
7 Aug
'04
2:29 a.m.
Arjan, AG> I'm curious as to why my class declaration AG> compiles in GHC, as there doesn't seem to AG> be any way to use it.
class (Ord st) => MinimaxState st where successors :: forall a . st -> [(a, st)] terminal :: st -> True
Any implementation of the successors method needs to produce values of an arbitrarely type a. Hence, it can only produce the empty list or a list of pairs that all have bottom as their first component.
instance MinimaxState Bool where successors = const [] terminal = not
instance MinimaxState Int where successors n = [(undefined, pred n), (undefined, succ n)] terminal 0 = True terminal n = False
HTH, Stefan