Enforcing Strict Evaluation
Dean Herington
heringto@cs.unc.edu
Tue, 21 Aug 2001 23:31:38 -0400 (EDT)
Someone privately asked a question concerning my module "DeepSeq" for
"deep" strict evaluation:
> > module DeepSeq where
>
> > class DeepSeq a where
> > deepSeq :: a -> b -> b
> > deepSeq = seq -- default, for simple cases
>
> ...
>
> > instance DeepSeq Ordering where
>
> > instance DeepSeq Integer where
> > instance DeepSeq Int where
> > instance DeepSeq Float where
> > instance DeepSeq Double where
>
> Are these supposed to be empty?
Yes. These, plus the instances for (), Bool, and Char, are "simple
cases" where the default method definition (deepSeq = seq) suffices.
Now realizing that the "where" keyword is optional when there are no
accompanying declarations, I think it would be preferable to omit the
"where" keyword to indicate that the absence of declarations is
intentional.
Dean