-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
len of a literal string #414
Comments
Might this have to do with IsString? On Thu, Jul 9, 2015, 15:15 Martin Stone Davis [email protected]
|
LH thinks that the length of the [Char] is >= 0, not recognizing that it's == 1.
|
@spinda, I am not using OverloadedStrings (if that answers your question). |
This is a known issue, the reason is that GHC compiles a string literal foo = "foo" into foo = unpackCString# "foo" where The |
We might be able to recover the length of the string literal by treating
should do it. |
Fwiw, I noticed the issue when trying to get the "bonus points" at the bottom of the demo for CSV: http://goto.ucsd.edu:8090/index.html#?demo=Csv.hs. (The link doesn't work. Select Demo -> Measures -> CSV Lists.) |
Yes, sorry about that -- I think that particular blog was written prior to On Thu, Jul 9, 2015 at 3:52 PM, Martin Stone Davis <[email protected]
Ranjit. |
add special rule for string literals fixes #414
It seems that the len of a literal string is not interpreted correctly. Viz the following code:
LH calls this one safe (and that seems fine to me):
LH thinks this is unsafe (but shouldn't it be safe?):
The text was updated successfully, but these errors were encountered: