Closed Ingo60 closed 9 years ago
I just recoginze, that the derived instances for Show may be broken with respect to showChars
. Will try to fix this.
This is what the REPL is doing to print an expression (if it is "showable"):
packed . take 80 . showChars $ expr
The limit should definitely be configurable. I will fix this. How about the configuration key showlimit
instead of listmax
since listmax
seems bit too general.
A new option show-limit
is now available to control the the amount of output.
frege> [1..]
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,3
frege> :set show-limit 30
frege> [1..]
[1,2,3,4,5,6,7,8,9,10,11,12,13
frege> :set show-limit 100
frege> [1..]
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,
Great!
One thought for future development: With lists, one sees immediately that the output has been cut. Not necessarily so with other data types. For example, in the ever re-occuring fibonacci examples, very large numbers are resulting very quickly, and it is often not immediately clear whether one sees the whole number or just a part of it. Therefore, an indication at the end of the cut output would be great, like a (possibly visually emphasized) ... Even better would it be when there was a key hat would result in printing of the next portion. One possibility that comes to mind is an empty line. Whenever there is a previous value that has been cut, just hitting "Enter" could print the next portion, and so on. Should not be too hard to implement, would it?
List output is truncated, which is a good thing in case someone tries to print an infinite list.
However, it is not transparent what the limit is (characters? list elements?) and, above all, it is not configurable. Hence I propose something like:
which would make the REPL print 30 list elements.
I understand it is hard, because there may be a finite list or something that has infinite sublists. But this seems to fail also today, try
Perhaps a character limit is in order, to make things not too complex. But also this limit should be configurable.