[Haskell-cafe] Type classes... popular for newbies, isn't it?

Stefan Holdermans sholderm at students.cs.uu.nl
Sat Aug 7 02:10:54 EDT 2004


Arjun,

   AG> This class definition is giving me a lot of problems
   AG> with the successor function:

 > class (Ord st) => MinimaxState st where
 >   successors :: st -> [(action, st)]
 >   terminal   :: st -> Bool

< instance MinimaxState Int where
<   terminal i   = i == 0
<   successors i = [(1,i+1), (-1,i-1)]

See, http://www.haskell.org//pipermail/haskell-cafe/2004-July/006424.html.

HTH,

Stefan



More information about the Haskell-Cafe mailing list