-
Notifications
You must be signed in to change notification settings - Fork 73
/
Copy pathboolean.lisp
44 lines (35 loc) · 933 Bytes
/
boolean.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
(coalton-library/utils:defstdlib-package #:coalton-library/boolean
(:use
#:coalton
#:coalton-library/classes)
(:import-from
#:coalton-library/hash
#:define-sxhash-hasher))
(in-package #:coalton-library/boolean)
(named-readtables:in-readtable coalton:coalton)
#+coalton-release
(cl:declaim #.coalton-impl/settings:*coalton-optimize-library*)
(coalton-toplevel
;;
;; Boolean instances
;;
(define-instance (Eq Boolean)
(define (== x y)
(lisp Boolean (x y)
(cl:eq x y))))
(define-instance (Ord Boolean)
(define (<=> x y)
(match x
((True)
(match y
((True) EQ)
((False) GT)))
((False)
(match y
((True) LT)
((False) EQ))))))
(define-instance (Default Boolean)
(define (default) False)))
(define-sxhash-hasher Boolean)
#+sb-package-locks
(sb-ext:lock-package "COALTON-LIBRARY/BOOLEAN")