primitive (byte) string literal with length?
Sylvain Henry
sylvain at haskus.fr
Tue Aug 24 06:48:53 UTC 2021
Hi,
You can use cstringLength# which has a constant-folding rules for literals. That's what we use in GHC to build FastString literals.
Le 24 août 2021 à 06:34, à 06:34, Viktor Dukhovni <ietf-dane at dukhovni.org> a écrit:
>
>Is there any GHC syntax for constructing a primitive string literal
>with a known (not hand coded) byte count?
>With `"some bytes"#` I get just the `Addr#` pointer, but not the size.
>
>If there's nothing available, would it be reasonable to introduce a new
>syntax?
>Perhaps:
>
> "some bytes"## :: (# Addr#, Int# #)
>
>--
> Viktor.
>
>_______________________________________________
>ghc-devs mailing list
>ghc-devs at haskell.org
>http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20210824/75349e34/attachment.html>
More information about the ghc-devs
mailing list