aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/DATS/valid.dats2
-rw-r--r--lib/SATS/valid.sats11
2 files changed, 7 insertions, 6 deletions
diff --git a/lib/DATS/valid.dats b/lib/DATS/valid.dats
index c13386e..7c3bbab 100644
--- a/lib/DATS/valid.dats
+++ b/lib/DATS/valid.dats
@@ -9,7 +9,7 @@ implement{a} create_valid(value) = (value,true)
implement{a} create_unvalid() = let
staload UN = "prelude/SATS/unsafe.sats"
in
- ($UN.ptr0_get<a>(the_null_ptr),false) //UNSAFE:
+ ($extval(a,"(void *)NULL"),false) //UNSAFE:
end
implement{a} unwrap_valid(v) = v.0
diff --git a/lib/SATS/valid.sats b/lib/SATS/valid.sats
index 83081fe..bfbbc23 100644
--- a/lib/SATS/valid.sats
+++ b/lib/SATS/valid.sats
@@ -8,16 +8,17 @@ absviewt@ype valid(a:viewt@ype,b:bool) = (a,bool b)
viewtypedef Valid(a:viewt@ype) = [b : bool] valid(a,b)
// Wraps valid value.
-fn {a:viewt@ype} create_valid(a) : valid(a,true)
+fn {a:viewt@ype} create_valid(a) :<> valid(a,true)
// Creates unvalid type.
-fn {a:viewt@ype} create_unvalid() : valid(a,false)
+fn {a:viewt@ype} create_unvalid() :<> valid(a,false)
// Only function that allows getting value. Only accepts valid values.
-fn {a:viewt@ype} unwrap_valid(valid(a,true)) : a
+fn {a:viewt@ype} unwrap_valid(valid(a,true)) :<> a
-castfn destroy_unvalid{a:viewt@ype}(valid(a,false)) : void
+castfn destroy_unvalid{a:viewt@ype}(valid(a,false)) :<> void
// Check if value is valid
-fn{a:viewt@ype} is_valid{b:bool}(!valid(a,b)) : bool b
+fn{a:viewt@ype} is_valid{c:bool}(!valid(a,c) >> valid(a,b)) :<> #[b:bool] bool b
+