Skip to content
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

Tabs in non formated print statements not working #76

Closed
TheGrandmother opened this issue Feb 6, 2015 · 13 comments
Closed

Tabs in non formated print statements not working #76

TheGrandmother opened this issue Feb 6, 2015 · 13 comments
Assignees
Labels

Comments

@TheGrandmother
Copy link
Contributor

Using tabs in print statements does not work.
Having say print(" lol") or print " lol" where the spaces are a tab (\t) will generate the following compiler error: unexpected "\"".

But.. It works if one uses a formatted print like this print(" lol{}",1).

@supercooldave
Copy link

You are certainly finding all the things we wouldn't even consider testing.
Which is a good thing.

@TheGrandmother
Copy link
Contributor Author

That is the nice/annoying thing with beta testing.

@supercooldave
Copy link

It is very much appreciated.

@kaeluka
Copy link
Contributor

kaeluka commented Sep 15, 2015

Confirmed that this is still a bug.

@TobiasWrigstad
Copy link
Contributor

Albert, can you fix this? Can't be that hard…

@albertnetymk
Copy link
Contributor

Yes, I can try.

@TobiasWrigstad
Copy link
Contributor

Thanks. Please request help from one of the resident Haskell gods (@EliasC, @kaeluka‚ …) if needed.

@EliasC
Copy link
Contributor

EliasC commented Oct 4, 2015

This seems to be an issue with the parsing library! The documentation for stringLiteral says

This lexeme parser parses a literal string. Returns the literal string value. This parsers deals correctly with escape sequences and gaps. The literal string is parsed according to the grammar rules defined in the Haskell report (which matches most programming languages quite closely).

and it seems to keep its promise - a string literal with a literal tab character (i.e. not \t, but an actual tab) will not compile under GHC!

I cannot get the formatted print string example to work either, so currently we don't support literal tabs (just as we don't support literal newlines) in string literals. Not sure if we should count this as bug or just a narrow minded grammar? I would be fine with closing this.

On a related note, I like Python where you can go

s1 = "this string cannot contain linebreaks"
s2 = 
"""
This is a 
multi-line
string literal
"""

@EliasC
Copy link
Contributor

EliasC commented Oct 5, 2015

Maybe I'm misunderstanding you, but I'd like to clarify that the string "\t" is valid while " " is not (the string consists of a single tab). Just like you can write

let s = "\n" in ...

but not

let s = "
" in ...

@TheGrandmother
Copy link
Contributor Author

@EliasC
Sorry. I completely forgot what bug it was that I had reported a year back :P

@EliasC
Copy link
Contributor

EliasC commented Oct 5, 2015

So are you happy with the current functionality? :)

@TheGrandmother
Copy link
Contributor Author

Yes. The current functionality is satisfactory :)

@EliasC
Copy link
Contributor

EliasC commented Oct 5, 2015

Then I'll close this issue, and anyone who is against it can re-open it!

@EliasC EliasC closed this as completed Oct 5, 2015
@EliasC EliasC removed the bug label Oct 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants