[m-rev.] for review: Move some code from std_util.m to maybe.m

Paul Bone paul at bone.id.au
Fri Sep 2 16:41:48 AEST 2016


On Fri, Sep 02, 2016 at 10:00:32AM +1000, Julien Fischer wrote:
> >diff --git a/library/maybe.m b/library/maybe.m
> >index 89a5da1..2351d8e 100644
> >--- a/library/maybe.m
> >+++ b/library/maybe.m
> >@@ -2,6 +2,7 @@
> >% vim: ft=mercury ts=4 sw=4 et wm=0 tw=0
> >%---------------------------------------------------------------------------%
> >% Copyright (C) 1994-2006, 2010-2011 The University of Melbourne.
> >+% Copyright (C) 2016 The Mercury Team.
> >% This file may only be copied under the terms of the GNU Library General
> >% Public License - see the file COPYING.LIB in the Mercury distribution.
> >%---------------------------------------------------------------------------%
> >@@ -173,9 +174,15 @@
> >    %
> >    % Make a maybe value from a semidet predicate.
> >    %
> >-:- func pred_to_maybe(pred(X)) = maybe(X).
> >+:- func pred_to_maybe(pred(T)) = maybe(T).
> >:- mode pred_to_maybe(pred(out) is semidet) = out is det.
> >
> >+:- pred pred_to_maybe(pred(T), maybe(T)).
> >+:- mode pred_to_maybe(pred(out) is semidet, out) is det.
> 
> Do we really require a predicate verison of this as well?

wecause there was one in std_util.m, I agree, I would almost-always prefer
the function version.


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


More information about the reviews mailing list