Optimisation of unpackCString#

Neil Mitchell ndmitchell at gmail.com
Mon Apr 28 17:04:34 EDT 2008


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


More information about the Glasgow-haskell-users mailing list