matijapretnar/eff

Using Char

Opened this issue · 4 comments

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' ;;

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.

I like the other idea more
I will do my best

Thanks

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!

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