
28 Apr
2008
28 Apr
'08
9:04 p.m.
Hi
This goes back to an old gripe of mine actually -- we can't get at the length of a C string literal at compile time either, which would be super useful in rules.
I was about to complain about this next, as soon as I got the previous part working :-)
If we had some light primitives for this, that GHC new about (head#, length#), that accessed the internal data about what strings are up to, that could be useful.
If we had the two simplification rules I suggested, and RULES, I think you can write length# yourself. Of course, its not necessarily going to be pleasant, and may require N rules iterations, where N is the length of the string. Thanks Neil