
elim now runs. Parts of the stdlib have been converted to use elim, but it's complicated to program with. Need to implement case and fix in terms of elim, I think.
20 lines
542 B
Racket
20 lines
542 B
Racket
#lang s-exp "../redex-curnel.rkt"
|
|
(require "sugar.rkt")
|
|
(provide maybe none some)
|
|
|
|
(data maybe : (forall (A : Type) Type)
|
|
(none : (forall (A : Type) (maybe A)))
|
|
(some : (forall* (A : Type) (a : A) (maybe A))))
|
|
|
|
(module+ test
|
|
(require rackunit "bool.rkt")
|
|
;; TODO: Dependent pattern matching doesn't work yet
|
|
(check-equal?
|
|
(case* maybe (some bool btrue)
|
|
(lambda (x : (maybe bool)) bool)
|
|
[(none (A : Type)) with-IH ()
|
|
bfalse]
|
|
[(some (A : Type) (x : A)) with-IH ()
|
|
(if x btrue bfalse)])
|
|
btrue))
|