on master help sign in
Switch tuples to #N constructors
669fa90Evan Czaplicki
src/AST/Helpers.hs+4−4
@@ -21,19 +21,19 @@ import Data.Text (Text)
21
21
22zeroTuple :: Text
22zeroTuple :: Text
23zeroTuple =
23zeroTuple =
24− "_Tuple0"
24+ "#0"
25
25
26
26
27makeTuple :: Int -> Text
27makeTuple :: Int -> Text
28makeTuple size =
28makeTuple size =
29− Text.pack ("_Tuple" ++ show size)
29+ Text.pack ('#' : show size)
30
30
31
31
32isTuple :: Text -> Bool
32isTuple :: Text -> Bool
33isTuple name =
33isTuple name =
34− Text.isPrefixOf "_Tuple" name
34+ Text.isPrefixOf "#" name
35 &&
35 &&
36− Text.all Char.isDigit (Text.drop 6 name)
36+ Text.all Char.isDigit (Text.drop 1 name)
37
37
38
38
39
39
src/Optimize/DecisionTree.hs+1−1
@@ -62,7 +62,7 @@ This helps us do a few optimizations:
62 one we want
62 one we want
63
63
64So this dictionary maps tags to the number of variants that exist, so it'll
64So this dictionary maps tags to the number of variants that exist, so it'll
65−contain things like [ ("Just", 2), ("Nothing", 2), ("_Tuple2", 1), ... ] which
65+contain things like [ ("Just", 2), ("Nothing", 2), ("#2", 1), ... ] which
66we can use for these optimizations.
66we can use for these optimizations.
67-}
67-}
68type VariantDict =
68type VariantDict =