Adding this to the language feels like how other languages evolve, which is 
haphazardly.

I rather see a more general solution to this problem via some type of 
constraint-based type. For example, imagine you can define something as 
*String* but with a constraint that limits the values they can contain. 
This would solve all current problems we have with using types as Enums. 
We'd have exhaustive case statements checking and since it's already a 
String converting to String is unnecessary.



On Wednesday, May 3, 2017 at 8:52:05 AM UTC-7, Peter Damoc wrote:
>
> On Wed, May 3, 2017 at 6:17 PM, Max Goldstein <maxgol...@gmail.com 
> <javascript:>> wrote:
>
>> Building on Charles, how would this handle recursive union types?
>
>
> This can be handled as a convention at compiler level. 
>
> A new restricted type variable could be created, let's call it 
> "enumerable" and only non-recursive, non-function types be "enumerable". 
> If an non-enumerable type is used, the compiler throws an error the same 
> way it throws an error if a non-comparable type is used as a Dict key. 
>
>
>
> -- 
> There is NO FATE, we are the creators.
> blog: http://damoc.ro/
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to