
7 Aug
2004
7 Aug
'04
11:06 a.m.
How about inserting one more parameter, "action", in your class definition: class (Ord st) => MinimaxState st action where successors:: st -> [(action,st)] terminal:: st -> Bool instance MinimaxState Int Int where terminal i = i == 0 successors i = [(1,i+1), (-1,i-1)]
I'd rather not do that, but even if I did, the type-variable action would not be reachable in the terminal function. I could specify a functional dependency st -> action (though I've never used it, it would be a fun to learn).
Right... you need the functional dependency because of "terminal", and in general a type annotation for using it. Carlos