[m-dev.] maybe_error type

Paul Bone paul at bone.id.au
Sat Apr 20 21:26:07 AEST 2013


Hi Guys.

Recently I made a chage to mabye.m to make the maybe_error type polymorphic
in its error type:

:- type maybe_error(T, E)
    --->    ok(T)
    ;       error(E).

% Including an alias type for the old behaviour.
:- type maybe_error(T) == maybe_error(T, string).


Now I want to do something similar to the 'other' maybe_error type, the one
whose 'ok' function symbol has no arguments.

:- type maybe_error(E)
    --->    ok
    ;       error(E).

:- type maybe_error == maybe_error(string).

Unfortunatly two of these types have the same arity.  So I would like to ask
for comments about what to do.  Is it worthwhile introducing this new type?
Should we re-name one of the two types? what to?  Or should we remove the
type alias?  Whatever we do it'd be best to disrupt existing code the least
(both in the compiler and 3rd party code), but at the same time make the
best decision for future programs.

Thanks.


-- 
Paul Bone
http://www.bone.id.au



More information about the developers mailing list