Optimisation of unpackCString#
igloo at earth.li
Tue Apr 29 17:58:03 EDT 2008
On Mon, Apr 28, 2008 at 02:00:38PM -0700, Donald Bruce Stewart wrote:
> 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 think that this is easy to do by, instead of desugaring
"foo" -> unpackCString# "foo"#
"foo" -> unpackCStringLen# 3# "foo"#
unpackCStringLen# _ = unpackCString#
It's not really feasible to do head#, tail# etc this way, though, so if
head#/tail# are done another way then it's probably best to do length#
that way too.
By the way, please do file tickets for the issues from this thread, so
that the issues and ideas don't get forgotten about!
More information about the Glasgow-haskell-users