mirror of
https://github.com/unisonweb/unison.git
synced 2024-10-26 11:07:48 +03:00
fae001df80
Issue was actually in the parser. A pattern like `Foo Bar a b c` was being parsed as `Foo (Bar a b c)`. The pattern parser just needed to be factored a bit differently to fix.
26 lines
598 B
Plaintext
26 lines
598 B
Plaintext
|
|
unique type Color = Red | Black
|
|
unique type RBTree a = Leaf | Tree Color (RBTree a) a (RBTree a)
|
|
|
|
-- interesting, this typechecks fine
|
|
isRed = cases
|
|
Color.Red -> true
|
|
Color.Black -> false
|
|
|
|
-- as does this
|
|
RBTree.isRed1 = cases
|
|
RBTree.Tree _ _ _ _ -> true
|
|
_ -> false
|
|
|
|
-- but this did not (before this fix)
|
|
RBTree.isRed = cases
|
|
RBTree.Tree Color.Red _ _ _ -> true
|
|
_ -> false
|
|
|
|
-- 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
|
|
|