Occasionally, for custom types, I forget to define a show
method that respects limit
. This can happen accidentally even with the best intentions, eg with unfortunate combinations of nested types.
This can lead to very long output in the REPL, which not all terminals and interfaces are happy with.
I am wondering it it would be possible to somehow customize the REPL or the display infrastructure to catch this. Eg when working the REPL, somehow impose a sanity check of cutting off at eg line 100, or after 10000 characters, whichever comes first.
But I don’t know where to start, is it possible to hook into the existing mechanisms for this?