add boolean patterns
This commit is contained in:
parent
6a45e9092c
commit
4ce2bb22d5
1
ast.hs
1
ast.hs
|
@ -33,6 +33,7 @@ data AST = Add AST AST
|
|||
data Pattern = VarP String
|
||||
| IntP Integer
|
||||
| StrP String
|
||||
| BoolP Bool
|
||||
| UnitP
|
||||
| ConsP Pattern Pattern
|
||||
| TupleP [Pattern]
|
||||
|
|
|
@ -324,6 +324,10 @@ patternBindings (IntP n) (IntV v)
|
|||
| otherwise = Nothing
|
||||
patternBindings (IntP n) _ = Nothing
|
||||
|
||||
patternBindings (BoolP b) (BoolV v)
|
||||
| v == b = Just M.empty
|
||||
| otherwise = Nothing
|
||||
|
||||
patternBindings UnitP UnitV = Just M.empty
|
||||
patternBindings UnitP _ = Nothing
|
||||
|
||||
|
|
Loading…
Reference in New Issue