[erlang-questions] Maps branch and disclaimers

Chris King colanderman@REDACTED
Tue Oct 29 22:41:02 CET 2013


On Tue, Oct 29, 2013 at 4:33 PM, Jesper Louis Andersen <
jesper.louis.andersen@REDACTED> wrote:

>
> On Tue, Oct 29, 2013 at 8:51 PM, Chris King <colanderman@REDACTED> wrote:
>
>> No it's not.  Unless you define the input type as :- type order() :: eq |
>> lt | gt.  Well, you can do the same thing with integers in Erlang: :- type
>> order() :: -1 | 0 | 1.
>
>
> Depending on the type system, this is either possible or it is not. A type
> system based on success types can allow it, but then you have the problem
> that it isn't a traditional type system.
>

I know.  I used OCaml for years before coming to Erlang.  A smattering of
Coq too.


> If you want a traditional static type system, then I'd bet that it won't
> be trivial to handle -1 | 0 | 1 as a subtype of the integers.
>

OCaml manages it for atoms with polymorphic variant types.  Checking
integer subtypes in the presence of arithmetic is more difficult, yes, but
that's not an issue here (both because (a) we're not doing arithmetic and
(b) Dialyzer's type engine is complete but not sound).


> I really dislike not using atoms for this. Intuitively and because of the
> inherent type complexity (yes, I have a bias here).
>

Having migrated from the ML camp after living in it for a decade, I think
the perceived complexity is an artifact of the HM type system.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20131029/1762750c/attachment.htm>


More information about the erlang-questions mailing list