cur/stdlib/maybe.rkt
William J. Bowman 8ba4ed17d9
Fixed bug in reduction of elim
elim was not checking that the arguments to be used for the parameters
of the inductive matched the actual parameters expected, resulting in
incorrect and non-deterministic unification, and thus incorrect
reduction when the parameters were unified incorrectly.
2015-09-25 16:52:49 -04:00

20 lines
552 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")
#;(check-equal?
(case* maybe Type (some bool btrue) (bool)
(lambda* (A : Type) (x : (maybe A)) A)
[(none (A : Type)) IH: ()
bfalse]
[(some (A : Type) (x : A)) IH: ()
;; TODO: Don't know how to use dependency yet
(if x btrue bfalse)])
btrue))