on master help sign in
Be stingier with default Maybe imports
6325b7eEvan Czaplicki
compiler/Metadata/Prelude.hs+9−3
@@ -22,13 +22,15 @@ add noPrelude (Module name path exs ims decls) =
22 Just _ -> []
22 Just _ -> []
23
23
24prelude :: [(String, ImportMethod)]
24prelude :: [(String, ImportMethod)]
25−prelude = text : string : map (\n -> (n, Module.open)) modules
25+prelude = string : text : maybe : map (\n -> (n, Module.open)) modules
26 where
26 where
27− string = ("String", Module.importing [Var.Value "show"])
28− modules = [ "Basics", "Signal", "List", "Maybe", "Time", "Color"
27+ modules = [ "Basics", "Signal", "List", "Time", "Color"
29 , "Graphics.Element", "Graphics.Collage"
28 , "Graphics.Element", "Graphics.Collage"
30 , "Native.Ports", "Native.Json"
29 , "Native.Ports", "Native.Json"
31 ]
30 ]
31+
32+ string = ("String", Module.importing [Var.Value "show"])
33+
32 text = ("Text", Module.importing textImports)
34 text = ("Text", Module.importing textImports)
33 textImports =
35 textImports =
34 Var.ADT "Text" (Var.Listing [] False) : map Var.Value
36 Var.ADT "Text" (Var.Listing [] False) : map Var.Value
@@ -36,6 +38,10 @@ prelude = text : string : map (\n -> (n, Module.open)) modules
36 , "plainText", "asText", "typeface", "monospace", "bold", "italic"
38 , "plainText", "asText", "typeface", "monospace", "bold", "italic"
37 ]
39 ]
38
40
41+ maybe =
42+ let imports = [ Var.ADT "Maybe" (Var.Listing ["Just", "Nothing"] False) ]
43+ in ("Maybe", Module.importing imports)
44+
39interfaces :: Bool -> IO Interfaces
45interfaces :: Bool -> IO Interfaces
40interfaces noPrelude =
46interfaces noPrelude =
41 if noPrelude
47 if noPrelude