on master help sign in
cosmetic: remove Type.Alias mess from Build.Print
e9ecbe1Evan Czaplicki
compiler/Build/File.hs+2−4
@@ -122,9 +122,7 @@ retrieve filePath = do
122 iface <- liftIO $ Interface.load (Utils.elmi flags filePath)
122 iface <- liftIO $ Interface.load (Utils.elmi flags filePath)
123 case Interface.isValid filePath iface of
123 case Interface.isValid filePath iface of
124 Right (name, interface) ->
124 Right (name, interface) ->
125− do binterfaces <- get
126− let interfaces = snd <$> binterfaces
127− liftIO $ when (Flag.print_types flags) (Print.interfaceTypes interfaces interface)
125+ do liftIO $ when (Flag.print_types flags) (Print.types (Module.iTypes interface))
128 update name interface False
126 update name interface False
129
127
130 Left err -> liftIO $ Print.failure err
128 Left err -> liftIO $ Print.failure err
@@ -148,7 +146,7 @@ compile number filePath =
148 exitFailure
146 exitFailure
149
147
150 liftIO $ when (Flag.print_types flags) $ do
148 liftIO $ when (Flag.print_types flags) $ do
151− Print.moduleTypes interfaces canonicalModule
149+ Print.types (Module.types (Module.body canonicalModule))
152
150
153 let newInters = Module.toInterface canonicalModule
151 let newInters = Module.toInterface canonicalModule
154 generateCache name newInters canonicalModule
152 generateCache name newInters canonicalModule
compiler/Build/Print.hs+4−13
@@ -5,23 +5,14 @@ import System.Exit (exitFailure)
5
5
6import qualified Data.Map as Map
6import qualified Data.Map as Map
7import qualified Data.List as List
7import qualified Data.List as List
8−import qualified AST.Module as M
8+import qualified AST.Module as Module
9import qualified AST.PrettyPrint as Pretty
9import qualified AST.PrettyPrint as Pretty
10import qualified Text.PrettyPrint as P
10import qualified Text.PrettyPrint as P
11
11
12−moduleTypes :: Map.Map String M.Interface -> M.CanonicalModule -> IO ()
12+types :: Module.Types -> IO ()
13−moduleTypes interfaces modul =
13+types ts =
14− types interfaces (M.types body) (M.aliases body) (M.imports modul)
15− where
16− body = M.body modul
17−
18−interfaceTypes :: Map.Map String M.Interface -> M.Interface -> IO ()
19−interfaceTypes interfaces iface =
20− types interfaces (M.iTypes iface) (M.iAliases iface) (M.iImports iface)
21−
22−types interfaces types' aliases imports =
23 do putStrLn ""
14 do putStrLn ""
24− mapM_ printType (Map.toList types')
15+ mapM_ printType (Map.toList ts)
25 putStrLn ""
16 putStrLn ""
26 where
17 where
27 printType (n,t) = do
18 printType (n,t) = do