2020-07-29 16:31:38 +03:00
|
|
|
|
|
|
|
unique type Color = Red | Black
|
|
|
|
unique type RBTree a = Leaf | Tree Color (RBTree a) a (RBTree a)
|
|
|
|
|
2020-07-29 17:15:06 +03:00
|
|
|
-- interesting, this typechecks fine
|
2020-07-29 16:31:38 +03:00
|
|
|
isRed = cases
|
|
|
|
Color.Red -> true
|
|
|
|
Color.Black -> false
|
|
|
|
|
2020-07-29 17:15:06 +03:00
|
|
|
-- as does this
|
|
|
|
RBTree.isRed1 = cases
|
|
|
|
RBTree.Tree _ _ _ _ -> true
|
|
|
|
_ -> false
|
|
|
|
|
|
|
|
-- but this did not (before this fix)
|
2020-07-29 16:31:38 +03:00
|
|
|
RBTree.isRed = cases
|
|
|
|
RBTree.Tree Color.Red _ _ _ -> true
|
|
|
|
_ -> false
|
2020-07-29 17:15:06 +03:00
|
|
|
|
|
|
|
-- In fixing this bug, I noticed that the parser would previously reject
|
|
|
|
-- this perfectly cromulent pattern match, so I fixed that too.
|
|
|
|
thisIsTotallyLegit = cases
|
|
|
|
[RBTree.Tree _ _ _ _] -> true
|
|
|
|
_ -> false
|
|
|
|
|