I had some fun and redid the prettyMatrix function to use the Unicode box drawing characters to put square brackets around matrices when Shown.
λ> let a = fromLists [[1,2,3],[4,5,6],[7,8,9]]
λ> print a
emits
┌ ┐
│ 1 2 3 │
│ 4 5 6 │
│ 7 8 9 │
└ ┘
which, in my terminal, renders with smooth lines.
As ever with Show instances there's (still) a ridiculous amount of String concatenation; I removed one call to show; if you like I could have a go cleaning it up further I can.
Anyway, just thought it would be fun to replace the ( ... ) with ASCII art closer to what we'd write in mathematical notation.
I had some fun and redid the
prettyMatrix
function to use the Unicode box drawing characters to put square brackets around matrices when Shown.emits
which, in my terminal, renders with smooth lines.
As ever with Show instances there's (still) a ridiculous amount of String concatenation; I removed one call to
show
; if you like I could have a go cleaning it up further I can.Anyway, just thought it would be fun to replace the
( ... )
with ASCII art closer to what we'd write in mathematical notation.AfC