Changes Maybe.ptr to Maybe.unsafe-ptr and all it's ocurrences

This commit is contained in:
GrayJack 2019-10-31 05:38:47 -03:00
parent d5ca0ed552
commit 2c0fcbd6c9
2 changed files with 6 additions and 6 deletions

View File

@ -52,9 +52,9 @@ It is the inverse of [`just?`](#just?).")
(Nothing) false
(Just y) (= x y))))
(doc ptr "Creates a `(Ptr a)` from a `(Maybe a)`. If the `Maybe` was
(doc unsafe-ptr "Creates a `(Ptr a)` from a `(Maybe a)`. If the `Maybe` was
`Nothing`, this function will return a `NULL` value.")
(defn ptr [a]
(defn unsafe-ptr [a]
(the (Ptr a) (Unsafe.coerce
(match @a
(Nothing) NULL

View File

@ -75,12 +75,12 @@
)
(assert-equal test
1
@(Pointer.to-ref (ptr &(Just 1)))
"ptr works on Just"
@(Pointer.to-ref (unsafe-ptr &(Just 1)))
"unsafe-ptr works on Just"
)
(assert-true test
(null? (ptr &(the (Maybe Int) (Nothing))))
"ptr works on Nothing"
(null? (unsafe-ptr &(the (Maybe Int) (Nothing))))
"unsafe-ptr works on Nothing"
)
(assert-equal test
&(Just 0)