[Haskell-cafe] Re: ANNOUNCE: deepseq-1.0.0.0
Luke Palmer
lrpalmer at gmail.com
Tue Nov 17 23:06:20 EST 2009
On Tue, Nov 17, 2009 at 8:48 PM, Dean Herington
<heringtonlacey at mindspring.com> wrote:
> The documentation claim that "The default implementation of 'deepseq' is
> simply 'seq'" is not exactly right, as `deepseq` and `seq` have different
> signatures. Which raises the more interesting question: Why did you choose
> a different signature? And, would a version of `seq` with the same
> signature as `deepseq` be useful?
The situation is analogous to, say, "null" having this signature:
null :: [a] -> Bool
Instead of this one:
null :: [a] -> b -> b -> b
Or the recent famous debate about returning Maybe a vs. Monad m => m a
for failure.
If we have seq' :: a -> (), then we have
seq = m . seq'
where m () = id
And of course we can go the other way too.
So it is a question of taste. deepseq is simpler by at least two
standards: it is not polymorphic and it has only one argument. There
are exactly two values of both () and forall b. b -> b, but that fact
is more obvious of the former (IMO). I think it is the right choice.
Luke
More information about the Haskell-Cafe
mailing list