on master help sign in
Switch the internal data constructor name for tuples. Before tuple
0070a84Evan Czaplicki
compiler/Metadata/Libraries.hs+1−1
@@ -34,7 +34,7 @@ libraries =
34 ] ++ map makeTuple (inits ['a'..'i'])
34 ] ++ map makeTuple (inits ['a'..'i'])
35
35
36 makeTuple cs =
36 makeTuple cs =
37− let name = "Tuple" ++ show (length cs)
37+ let name = "_Tuple" ++ show (length cs)
38 in (name, concatMap (\c -> c : " -> ") cs ++
38 in (name, concatMap (\c -> c : " -> ") cs ++
39 name ++ concatMap (\c -> [' ',c]) cs)
39 name ++ concatMap (\c -> [' ',c]) cs)
40
40
compiler/SourceSyntax/Expression.hs+1−1
@@ -36,7 +36,7 @@ data Def tipe var
36 | TypeAnnotation String Type.Type
36 | TypeAnnotation String Type.Type
37 deriving (Eq, Show)
37 deriving (Eq, Show)
38
38
39−tuple es = Data ("Tuple" ++ show (length es)) es
39+tuple es = Data ("_Tuple" ++ show (length es)) es
40
40
41delist (Location.L _ _ (Data "::" [h,t])) = h : delist t
41delist (Location.L _ _ (Data "::" [h,t])) = h : delist t
42delist _ = []
42delist _ = []
compiler/SourceSyntax/Helpers.hs+1−1
@@ -6,7 +6,7 @@ import Data.Char (isSymbol,isDigit)
6brkt s = "{ " ++ s ++ " }"
6brkt s = "{ " ++ s ++ " }"
7
7
8isTuple name =
8isTuple name =
9− take 5 name == "Tuple" && all isDigit (drop 5 name)
9+ take 6 name == "_Tuple" && all isDigit (drop 6 name)
10
10
11isOp c =
11isOp c =
12 isSymbol c || elem c "+-/*=.$<>:&|^?%#@~!"
12 isSymbol c || elem c "+-/*=.$<>:&|^?%#@~!"
compiler/SourceSyntax/Pattern.hs+1−1
@@ -19,7 +19,7 @@ data Pattern = PData String [Pattern]
19cons h t = PData "::" [h,t]
19cons h t = PData "::" [h,t]
20nil = PData "[]" []
20nil = PData "[]" []
21list = foldr cons nil
21list = foldr cons nil
22−tuple es = PData ("Tuple" ++ show (length es)) es
22+tuple es = PData ("_Tuple" ++ show (length es)) es
23
23
24
24
25instance Pretty Pattern where
25instance Pretty Pattern where
compiler/SourceSyntax/Type.hs+1−1
@@ -23,7 +23,7 @@ listOf :: Type -> Type
23listOf t = Data "List" [t]
23listOf t = Data "List" [t]
24
24
25tupleOf :: [Type] -> Type
25tupleOf :: [Type] -> Type
26−tupleOf ts = Data ("Tuple" ++ show (length ts)) ts
26+tupleOf ts = Data ("_Tuple" ++ show (length ts)) ts
27
27
28
28
29instance Pretty Type where
29instance Pretty Type where
compiler/Type/Constrain/Declaration.hs+1−1
@@ -36,7 +36,7 @@ test filePath = do
36 let expr = sortDefs (toExpr decls)
36 let expr = sortDefs (toExpr decls)
37 print $ pretty expr
37 print $ pretty expr
38 constraint <- TcExpr.constrain env expr (T.VarN var)
38 constraint <- TcExpr.constrain env expr (T.VarN var)
39− print =<< T.extraPretty constraint
39+ --print =<< T.extraPretty constraint
40 (env,_,_,errors) <- execStateT (solve constraint) TS.initialState
40 (env,_,_,errors) <- execStateT (solve constraint) TS.initialState
41 forM (Map.toList env) $ \(n,t) -> do
41 forM (Map.toList env) $ \(n,t) -> do
42 pt <- T.extraPretty t
42 pt <- T.extraPretty t
tests/good/Soundness.elm+4−1
@@ -1,4 +1,8 @@
1
1
2+type F = {
3+ x : Int
4+}
5+
2trickyID x = let y = x in y
6trickyID x = let y = x in y
3
7
4quad f = twice (twice f)
8quad f = twice (twice f)
@@ -6,4 +10,3 @@ twice f x = f (f x)
6
10
7n = quad (quad trickyID) 4
11n = quad (quad trickyID) 4
8c = twice trickyID 'a'
12c = twice trickyID 'a'
9−