[m-rev.] for review: discrete interval encoding tree

Peter Wang novalazy at gmail.com
Tue Mar 4 14:28:59 AEDT 2014


On Mon, 3 Mar 2014 15:35:57 +1100 (EST), Julien Fischer <jfischer at opturion.com> wrote:
> >>> +:- func det_from_int(int) = T <= enum(T).
> >>> +
> >>> +det_from_int(I) = X :-
> >>> +    ( X0 = from_int(I) ->
> >>> +        X = X0
> >>> +    ;
> >>> +        unexpected($module, $pred, "from_int failed")
> >>> +    ).
> >>
> >> Move this to the enum module.
> >
> > Are you sure?  I think enum should stay minimal.
> 
> It's an obvious utility predicate that the enum module ought to provide.
> (I've certainly wanted it in the past when I used the enum type class
> and the fact that you've required here suggests that it is something the
> enum modue should provide.)

Alright.  It does lose the more specific error message, though.

Peter



More information about the reviews mailing list