mirror of
https://github.com/unisonweb/unison.git
synced 2024-10-26 11:07:48 +03:00
Fix representation of Option
This commit is contained in:
parent
b7d8eb0802
commit
774addbab5
@ -21,10 +21,10 @@
|
||||
(import (rnrs))
|
||||
|
||||
; Option a
|
||||
(define none (cons 0 ()))
|
||||
(define none `(0))
|
||||
|
||||
; a -> Option a
|
||||
(define (some a) (cons 1 a))
|
||||
(define (some a) `(1 ,a))
|
||||
|
||||
; Option a -> Bool
|
||||
(define (some? option) (eq? 1 (car option)))
|
||||
@ -36,7 +36,7 @@
|
||||
(define (option-get option)
|
||||
(if
|
||||
(some? option)
|
||||
(cdr option)
|
||||
(car (cdr option))
|
||||
(raise "Cannot get the value of an empty option ")))
|
||||
|
||||
; TODO this might be reduntant, #<void> works
|
||||
|
@ -5,8 +5,8 @@ concurrency.tests = Tests.main do
|
||||
!casTest
|
||||
!promiseSequentialTest
|
||||
!promiseConcurrentTest
|
||||
-- !forkKillTest
|
||||
-- !tryEvalForkTest
|
||||
-- !forkKillTest
|
||||
-- !tryEvalForkTest
|
||||
!fullTest
|
||||
|
||||
simpleRefTest = do
|
||||
@ -55,9 +55,8 @@ promiseSequentialTest = do
|
||||
Promise.write_ p 1
|
||||
v2 = read p
|
||||
checkEqual "Promise can only be written to once" v2 v1
|
||||
-- TODO fix bug in boot.ss here
|
||||
-- v3 = Promise.tryRead p
|
||||
-- checkEqual "Once the Promise is full, tryRead is the same as read" v3 (Some v2)
|
||||
v3 = Promise.tryRead p
|
||||
checkEqual "Once the Promise is full, tryRead is the same as read" v3 (Some v2)
|
||||
|
||||
millis = 1000
|
||||
sleep_ n = unsafeRun! do sleep n
|
||||
|
Loading…
Reference in New Issue
Block a user