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

Using Char #41

Open
alkubaig opened this issue Apr 6, 2018 · 4 comments
Open

Using Char #41

alkubaig opened this issue Apr 6, 2018 · 4 comments

Comments

@alkubaig
Copy link

alkubaig commented Apr 6, 2018

Hello all,

I am having an issue with using Characters in Eff
Whenever I use it, it says "unrecognised symbol" or "parser error"

The main reason why I want to use it is to be able to use the Split function from OCaml

external split_on_char : char -> string -> string list = "split_on_char"

I did everything to add Char as a type and it compiled << you can see that in my Pull-request
but I noticed that it cannot parse Char properly << maybe the single quote is the problem

let m = '4';;
let k = 's' ;;
@zigaLuksic
Copy link
Collaborator

The single quote currently has no special meaning in Eff as far as I could tell from the lexer.
So you would actually have to additionally adapt the lexer, the parser, and probably the core syntax, sugared syntax and the desugar phase.
Which seems like a serious amount of work.

Are you sure you cannot make a similar function that just uses strings instead of char?
You can always do an additional check, to make sure that the input makes sense for your function and raise an error otherwise.

@alkubaig
Copy link
Author

alkubaig commented Apr 6, 2018

I like the other idea more
I will do my best

Thanks

@alkubaig
Copy link
Author

alkubaig commented Apr 6, 2018

I used this method to get the first char of the string which is the only one
and it worked

val get : string -> int -> char

Thanks!

@andrejbauer
Copy link
Collaborator

@zigaLuksic : it's not that much work. It sounds like half an hour of work, so it's probably about two hours of work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants