on master help sign in
Switch more files over to new Expressions
947b82eEvan Czaplicki
compiler/Generate/Noscript.hs+1−2
@@ -19,8 +19,7 @@ instance Extract (Declaration t v) where
19 extract _ = []
19 extract _ = []
20
20
21instance Extract (Def t v) where
21instance Extract (Def t v) where
22− extract (FnDef _ _ e) = extract e
22+ extract (Def _ e) = extract e
23− extract (OpDef _ _ _ e) = extract e
24 extract _ = []
23 extract _ = []
25
24
26instance Extract e => Extract (Located e) where
25instance Extract e => Extract (Located e) where
compiler/Types/Alias.hs+4−8
@@ -6,6 +6,7 @@ import Control.Arrow (second)
6import Data.List (group,sort)
6import Data.List (group,sort)
7import qualified Data.Map as Map
7import qualified Data.Map as Map
8import qualified Data.Set as Set
8import qualified Data.Set as Set
9+import Transform.SortDefinitions
9import Types.Substitutions (subst)
10import Types.Substitutions (subst)
10import Types.Types
11import Types.Types
11import Data.Data
12import Data.Data
@@ -77,9 +78,7 @@ badKinds decls = map msg (concatMap bad decls)
77 badDef def =
78 badDef def =
78 case def of
79 case def of
79 TypeAnnotation _ tipe -> badType tipe
80 TypeAnnotation _ tipe -> badType tipe
80− FnDef _ _ expr ->
81− concatMap badDef $ concat [defList | Let defList _ <- universeBi expr]
82− OpDef _ _ _ expr ->
81+ Def _ expr ->
83 concatMap badDef $ concat [defList | Let defList _ <- universeBi expr]
82 concatMap badDef $ concat [defList | Let defList _ <- universeBi expr]
84
83
85 --bad :: Declaration t v -> [String]
84 --bad :: Declaration t v -> [String]
@@ -106,8 +105,7 @@ definition s =
106defName :: Def t v -> [String]
105defName :: Def t v -> [String]
107defName d =
106defName d =
108 case d of
107 case d of
109− FnDef n _ _ -> [n]
108+ Def pattern _ -> Set.toList (boundVars pattern)
110− OpDef n _ _ _ -> [n]
111 _ -> []
109 _ -> []
112
110
113dups :: [Declaration t v] -> [String]
111dups :: [Declaration t v] -> [String]
@@ -141,9 +139,7 @@ badOrder decls =
141 --actualPairs :: [Def t v] -> [String]
139 --actualPairs :: [Def t v] -> [String]
142 actualPairs decls =
140 actualPairs decls =
143 case decls of
141 case decls of
144− Definition (TypeAnnotation n _) : Definition (FnDef m _ _) : rest ->
142+ Definition (TypeAnnotation n _) : Definition (Def (PVar m) _) : rest ->
145− (if n == m then [n] else []) ++ actualPairs rest
146− Definition (TypeAnnotation n _) : Definition (OpDef m _ _ _) : rest ->
147 (if n == m then [n] else []) ++ actualPairs rest
143 (if n == m then [n] else []) ++ actualPairs rest
148 t:s:rest -> actualPairs (s:rest)
144 t:s:rest -> actualPairs (s:rest)
149 _ -> []
145 _ -> []