on master help sign in
Switch tuples to #N constructors
commit669fa90bb358c16b0d2548c390fb384caaad9bd8 authorEvan Czaplicki <evancz@users.noreply.github.com> dateThu 11 May 2017, 00:01 (9 years ago) parentbefb3df
2 files changed+5−5
src/AST/Helpers.hs+4−4 src/Optimize/DecisionTree.hs+1−1
src/AST/Helpers.hs+4−4
@@ -21,19 +21,19 @@ import Data.Text (Text)
2121
2222zeroTuple :: Text
2323zeroTuple =
24− "_Tuple0"
24+ "#0"
2525
2626
2727makeTuple :: Int -> Text
2828makeTuple size =
29− Text.pack ("_Tuple" ++ show size)
29+ Text.pack ('#' : show size)
3030
3131
3232isTuple :: Text -> Bool
3333isTuple name =
34− Text.isPrefixOf "_Tuple" name
34+ Text.isPrefixOf "#" name
3535 &&
36− Text.all Char.isDigit (Text.drop 6 name)
36+ Text.all Char.isDigit (Text.drop 1 name)
3737
3838
3939
src/Optimize/DecisionTree.hs+1−1
@@ -62,7 +62,7 @@ This helps us do a few optimizations:
6262 one we want
6363
6464So 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
6666we can use for these optimizations.
6767-}
6868type VariantDict =