[Haskell-cafe] About instance

Ulises Juarez Martinez ujuarez71 at hotmail.com
Tue Jan 18 16:45:43 EST 2005


Hi.

I have the next definitions:

type Ocurrence = (String, Int)
type Inside = [Ocurrence]

data Pattern = Return Inside
  | Abort
  | Filter (Ocurrence -> Bool) Pattern

beyond :: Pattern -> Pattern
beyond (Filter pred Abort) = Abort
-- more definitions of beyond

optimous :: Pattern -> Pattern
optimous p = fixPoint beyond p
	where fixPoint f x = if(f x == x) then x else fixPoint f (f x)

When I load the program an error is produced:

ERROR - An instance of Eq (Event -> Bool) is required to derive Eq Pattern

I put:

data Pattern = Return Inside
  | Abort
  | Filter (Ocurrence -> Bool) Pattern
  deriving (Eq)

and a new error was produced:

ERROR - An instance of Eq (Ocurrence -> Bool) is required to derive Eq 
Pattern

Who can I do an instance of Eq (Ocurrence -> Bool)? Is there another option 
to avoid the error?

Regards
Ulises

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/



More information about the Haskell-Cafe mailing list