[Hat] Proposal, Hierarchical module structure for tools
ndmitchell at gmail.com
Wed Oct 11 08:40:26 EDT 2006
> I intended the word "textual" to indicate an API that produces Strings,
> not something that interacts per se with a terminal. However, I now
> realise that your objection is probably that the text strings produced
> are not pure - they have ANSI terminal colour codes. Fair enough.
Ah, I thought your intention was to export a "main" from this -
returning Strings (coloured strings at that) is a perfectly reasonable
thing to have as an API.
The way I do terminal codes in Hoogle is to define a type, TagStr:
data TagStr = Str String | Tags [TagStr] | Underline TagStr | Bold
TagStr | Color Int TagStr
Now instead of dumping out escape codes, I dump out TagStr's, and then
have a routine that converts from TagStr -> String with escape codes.
This has the massive advantage that on OS's that don't support escape
codes, I can use exactly the same generation code, and then drop the
escape codes very simply.
Perhaps thats a better way to go instead of having an API that works
in very low level escape code terms.
> HatCoverText -> Tracing.Hat.Coverage.ANSIterm
The name ANSIterm makes me uneasy, Terminal perhaps? ANSIterm just
looks ugly, and the case of it is weird compared to the rest of
In general we now seem to be pretty much in agreement about the
More information about the Hat