Erlang's typer deduced weird types for strings

Viewed 38

I'm exploring typer, and gave it a function that does nothing but:

const_str() -> "qwe".

That guy's type is deduced as:

-spec const_str() -> [101 | 113 | 119,...]

, i.e. "eqw" (huh?!), followed by this '...' business.

It looks like constant strings are confusing typer; I understand I shouldn't be using them like this, there are atoms for that purpose; but as I am trying to wrap my head around typer (and Erlang's type options), I thought this is surprising and interesting. Could anyone explain what's happening here? Thanks!

1 Answers
Related