Differences in pattern matching syntax?

Daniel Fischer daniel.is.fischer at web.de
Thu Jan 15 19:24:17 EST 2009


Am Donnerstag, 15. Januar 2009 22:57 schrieb Han Joosten:
>
> I hardly use any let expressions (shame on me??) and I am not very familiar
> with them. But I figured out you might have mistaken, so I changed the bit
> to:
>    antecedent :: Rule -> Expression
>    antecedent r = case r of
>                    Ru{} -> if (rrsrt r == AlwaysExpr)  then error ("(Module
> ADLdataDef:) illegal call to antecedent of rule "++show r)
>                                                                    else
> rrant r
>                    Sg{} -> antecedent (srsig r)
>                    Gc{} -> let x = grspe r in r `seq` Tm x
>                    Fr{} -> frcmp r
>

Perhaps you should have replaced both occurrences of 'r' with 'x':

	Gc{} -> let x = grspe r in x `seq` Tm x

(That may or may not make a difference, depends on what your code actually 
does).
Should be worth a try anyway. Also, try compiling with -O2 to see if that 
makes a difference.


More information about the Glasgow-haskell-users mailing list