I like John's idea with a class Strict, but I think there should also be
a second class Eval for computing whnf's:

        class Strict a where
         strict :: a -> Bool

        class Eval a where
         eval :: a -> Bool

Example: for Complex we get:

        instance Strict a => Strict (Complex a) where
         strict (a:+b) = strict a && strict b

        instance Eval (Complex a) where
         eval (a:+b) = True

Based on this we can define Miranda's "force" and "seq":

        force:: Strict a => a -> a
        force x | strict x = x

        seq:: Eval a => a -> b -> b
        seq x y | eval x = y

Stefan

Reply via email to