[Haskell-cafe] retrospective on 'seq' -> 'unsafeSeq' ?
lemming at henning-thielemann.de
Mon Apr 14 05:36:47 EDT 2008
When reading the section "10.3 Controlling Evaluation Order" in "History
of Haskell" I thought that the example that justified the 'seq' to be
unrestricted polymorphic was mainly a debugging problem. I wondered if the
better solution would have been to provide an 'unsafeSeq' which has no
type restriction but must be absent from production code just like
'trace'. With 'unsafeSeq' one could nicely play around until time and
space behaviour is as wanted and then one can replace all 'unsafeSeq's by
'seq' while adding type constraints accordingly. (Analogously there could
be an unsafeShow that allows showing offending values in an 'error'
without adding a Show constraint to the type signature.)
More information about the Haskell-Cafe