On Tue, Nov 17, 2009 at 8:48 PM, Dean Herington
<heringtonla...@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
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to