@@ -79,6 +79,7 @@ data Test
7979 | IsInt Int
8080 | IsChr Text
8181 | IsStr Text
82+ | IsBool Bool
8283 deriving (Eq, Ord)
8384
8485
@@ -159,6 +160,9 @@ isComplete tests =
159160 IsInt _ ->
160161 False
161162
163+ IsBool _ ->
164+ length tests == 2
165+
162166
163167
164168-- FLATTEN PATTERNS
@@ -227,6 +231,9 @@ flatten pathPattern@(path, A.At region pattern) otherPathPatterns =
227231 Can.PInt _ ->
228232 pathPattern : otherPathPatterns
229233
234+ Can.PBool _ _ ->
235+ pathPattern : otherPathPatterns
236+
230237
231238subPositions :: Path -> [Can.Pattern] -> [(Path, Can.Pattern)]
232239subPositions path patterns =
@@ -338,6 +345,9 @@ testAtPath selectedPath (Branch _ pathPatterns) =
338345 Can.PChr chr ->
339346 Just (IsChr chr)
340347
348+ Can.PBool _ bool ->
349+ Just (IsBool bool)
350+
341351 Can.PRecord _ ->
342352 Nothing
343353
@@ -423,6 +433,14 @@ toRelevantBranch test path branch@(Branch goal pathPatterns) =
423433 _ ->
424434 Nothing
425435
436+ Can.PBool _ bool ->
437+ case test of
438+ IsBool testBool | bool == testBool ->
439+ Just (Branch goal (start ++ end))
440+
441+ _ ->
442+ Nothing
443+
426444 Can.PUnit ->
427445 Just (Branch goal (start ++ end))
428446
@@ -497,6 +515,7 @@ needsTests (A.At _ pattern) =
497515 Can.PChr _ -> True
498516 Can.PStr _ -> True
499517 Can.PInt _ -> True
518+ Can.PBool _ _ -> True
500519 Can.PAlias _ _ ->
501520 error "aliases should never reach 'isIrrelevantTo' function"
502521
@@ -586,6 +605,7 @@ instance Binary Test where
586605 IsChr a -> putWord8 4 >> put a
587606 IsStr a -> putWord8 5 >> put a
588607 IsInt a -> putWord8 6 >> put a
608+ IsBool a -> putWord8 7 >> put a
589609
590610 get =
591611 do word <- getWord8
@@ -597,6 +617,7 @@ instance Binary Test where
597617 4 -> liftM IsChr get
598618 5 -> liftM IsStr get
599619 6 -> liftM IsInt get
620+ 7 -> liftM IsBool get
600621 _ -> error "problem getting DecisionTree.Test binary"
601622
602623