Re: [Haskell-cafe] multi parameter type classes for NP problems

2006-12-20 Thread Joshua Ball
That works. Thanks. I didn't realize you could put types in the expression itself. On 12/20/06, Greg Buchholz <[EMAIL PROTECTED]> wrote: Joshua Ball wrote: > Here is how I am trying to solve the problem, using multi-parameter > type classes. > > class NPProblem inst cert where >validates ::

Re: [Haskell-cafe] multi parameter type classes for NP problems

2006-12-20 Thread Greg Buchholz
Joshua Ball wrote: > Here is how I am trying to solve the problem, using multi-parameter > type classes. > > class NPProblem inst cert where >validates :: cert -> inst -> Bool >certificates :: inst -> [cert] >decide :: inst -> Bool >decide i = any (\x -> x `validates` i) $ certific

[Haskell-cafe] multi parameter type classes for NP problems

2006-12-20 Thread Joshua Ball
Hi all, For my own study, I've been playing around with various NP complete problems. Previuosly I was doing so in Java, but because I want to learn Haskell, I'm trying to port the algorithms. In Java, I had an abstract class called AbstractNPProblem which looked like this: public abstract class