@@ -21,7 +21,7 @@ as SML/NJ to get nice trees.
2121-}
2222
2323import Control.Arrow (second)
24−import Control.Monad (liftM, liftM2, liftM4)
24+import Control.Monad (liftM, liftM2, liftM5)
2525import Data.Binary
2626import qualified Data.List as List
2727import qualified Data.Maybe as Maybe
@@ -29,6 +29,7 @@ import qualified Data.Set as Set
2929import Data.Text (Text)
3030
3131import qualified AST.Canonical as Can
32+import qualified AST.Module.Name as ModuleName
3233import qualified Data.Index as Index
3334import qualified Elm.Name as N
3435import qualified Reporting.Annotation as A
@@ -71,7 +72,7 @@ data DecisionTree
7172
7273
7374data Test
74− = IsCtor N.Name Index.ZeroBased Int Can.CtorOpts
75+ = IsCtor ModuleName.Canonical N.Name Index.ZeroBased Int Can.CtorOpts
7576 | IsCons
7677 | IsNil
7778 | IsTuple
@@ -137,7 +138,7 @@ toDecisionTree rawBranches =
137138isComplete :: [Test] -> Bool
138139isComplete tests =
139140 case head tests of
140− IsCtor _ _ numAlts _ ->
141+ IsCtor _ _ _ numAlts _ ->
141142 numAlts == length tests
142143
143144 IsCons ->
@@ -307,8 +308,8 @@ testAtPath selectedPath (Branch _ pathPatterns) =
307308
308309 Just (A.At _ pattern) ->
309310 case pattern of
310− Can.PCtor _ _ (Can.Union _ _ numAlts opts) name index _ ->
311− Just (IsCtor name index numAlts opts)
311+ Can.PCtor home _ (Can.Union _ _ numAlts opts) name index _ ->
312+ Just (IsCtor home name index numAlts opts)
312313
313314 Can.PList ps ->
314315 Just (case ps of { [] -> IsNil ; _ -> IsCons })
@@ -362,7 +363,7 @@ toRelevantBranch test path branch@(Branch goal pathPatterns) =
362363 case pattern of
363364 Can.PCtor _ _ (Can.Union _ _ numAlts _) name _ ctorArgs ->
364365 case test of
365− IsCtor testName _ _ _ | name == testName ->
366+ IsCtor _ testName _ _ _ | name == testName ->
366367 Just $ Branch goal $
367368 case map dearg ctorArgs of
368369 [arg] | numAlts == 1 ->
@@ -578,18 +579,18 @@ smallBranchingFactor branches path =
578579instance Binary Test where
579580 put test =
580581 case test of
581− IsCtor a b c d -> putWord8 0 >> put a >> put b >> put c >> put d
582− IsCons -> putWord8 1
583− IsNil -> putWord8 2
584− IsTuple -> putWord8 3
585− IsChr a -> putWord8 4 >> put a
586− IsStr a -> putWord8 5 >> put a
587− IsInt a -> putWord8 6 >> put a
582+ IsCtor a b c d e -> putWord8 0 >> put a >> put b >> put c >> put d >> put e
583+ IsCons -> putWord8 1
584+ IsNil -> putWord8 2
585+ IsTuple -> putWord8 3
586+ IsChr a -> putWord8 4 >> put a
587+ IsStr a -> putWord8 5 >> put a
588+ IsInt a -> putWord8 6 >> put a
588589
589590 get =
590591 do word <- getWord8
591592 case word of
592− 0 -> liftM4 IsCtor get get get get
593+ 0 -> liftM5 IsCtor get get get get get
593594 1 -> pure IsCons
594595 2 -> pure IsNil
595596 3 -> pure IsTuple