[Haskell-cafe] retrospective on 'seq' -> 'unsafeSeq' ?

Neil Mitchell ndmitchell at gmail.com
Mon Apr 14 06:07:17 EDT 2008


Hi

> 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'.

That would be very neat!

> 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.)

Ideally, unsafeShow could also show types as they are underneath, not
as a pretty-printing Show might show them. I have often wanted to
overload Show to print things in a readable way, but to have a showRaw
which shows things as they are, for debugging purposes. I have even
written such code for Yhc:
http://www.cs.york.ac.uk/fp/yhc/snapshot/docs/Yhc-Core-ShowRaw.html

I think unsafeShow is a fantastic idea - and would be much more useful
to me than unsafeSeq - plus is a non-breaking change. I think Hugs
already has 90% of the code to support this, and GHCi's debugger I
think has a fair chunk of it, so it could be added given not too much
work.

Thanks

Neil


More information about the Haskell-Cafe mailing list