[m-rev.] for review: subtypes

Peter Wang novalazy at gmail.com
Mon Jan 6 14:19:49 AEDT 2014


On Tue, 31 Dec 2013 05:05:15 +1100, Mark Brown <mark at mercurylang.org> wrote:
> Hi everyone,
> 
> I have had a shot at implementing something along the lines of the old
> subtypes proposal. It is for review by anyone. The log message is
> attached, and the diff can be found at
> 
> https://github.com/markbrown/mercury/
> 
> in the subtypes branch. Please note I am not currently subscribed to this list.
...
> 
> Another design issue is that subtypes are currenly only allowed to be used
> in pred and func declarations (including typeclass methods).  Alternative
> designs could include:
> 
> (1) Allowing subtypes to be used in ordinary type declarations, inferring a
> ground inst for every type that refers, directly or indirectly, to a subtype.

This seems a major restriction.  I think the main use I would have for
subtypes is to recover the inst of a value after passing through some
container (which doesn't use polymorphic modes).

construct would be even more complicated, no doubt.

Peter



More information about the reviews mailing list