[m-rev.] For review: the maybe_error type is now polymorphic in the type of error
Paul Bone
paul at bone.id.au
Wed Feb 13 15:37:08 AEDT 2013
For review by anyone.
The maybe_error type now takes a second type argument allowing users to
customise the type of error that can be represented.
library/maybe.m:
As above.
NEWS:
Add a dot point for this change.
---
NEWS | 3 +++
library/maybe.m | 6 ++++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/NEWS b/NEWS
index 7d6114c..39b4139 100644
--- a/NEWS
+++ b/NEWS
@@ -48,6 +48,9 @@ Changes to the Mercury standard library:
list.all_true_corresponding/3, list.all_false_corresponding/3 and
list.same_length3/3.
+* The maybe_error type in the maybe module is now also polymorphic in type
+ of the error it can represent.
+
Changes to the Mercury compiler:
* The option `--warn-non-tail-recursion' no longer requires
diff --git a/library/maybe.m b/library/maybe.m
index 4796799..1643556 100644
--- a/library/maybe.m
+++ b/library/maybe.m
@@ -35,9 +35,11 @@
---> ok
; error(string).
-:- type maybe_error(T)
+:- type maybe_error(T) == maybe_error(T, string).
+
+:- type maybe_error(T, E)
---> ok(T)
- ; error(string).
+ ; error(E).
:- inst maybe_error(I)
---> ok(I)
--
1.8.1.3
More information about the reviews
mailing list