on master help sign in
Properly import the Text type by default
bf9573cEvan Czaplicki
compiler/AST/Module.hs+2−2
@@ -91,8 +91,8 @@ data ImportMethod
91open :: ImportMethod
91open :: ImportMethod
92open = Open (Var.openListing)
92open = Open (Var.openListing)
93
93
94−importing :: [String] -> ImportMethod
94+importing :: [Var.Value] -> ImportMethod
95−importing xs = Open (Var.Listing (map Var.Value xs) False)
95+importing xs = Open (Var.Listing xs False)
96
96
97instance Binary ImportMethod where
97instance Binary ImportMethod where
98 put method =
98 put method =
compiler/Metadata/Prelude.hs+4−2
@@ -6,6 +6,7 @@ import qualified Control.Exception as E
6import System.Exit
6import System.Exit
7import System.IO
7import System.IO
8import AST.Module as Module
8import AST.Module as Module
9+import qualified AST.Variable as Var
9import qualified Build.Interface as Interface
10import qualified Build.Interface as Interface
10import Build.Utils (getDataFile)
11import Build.Utils (getDataFile)
11
12
@@ -23,15 +24,16 @@ add noPrelude (Module name path exs ims decls) =
23prelude :: [(String, ImportMethod)]
24prelude :: [(String, ImportMethod)]
24prelude = text : string : map (\n -> (n, Module.open)) modules
25prelude = text : string : map (\n -> (n, Module.open)) modules
25 where
26 where
26− string = ("String", Module.importing ["show"])
27+ string = ("String", Module.importing [Var.Value "show"])
27 modules = [ "Basics", "Signal", "List", "Maybe", "Time", "Color"
28 modules = [ "Basics", "Signal", "List", "Maybe", "Time", "Color"
28 , "Graphics.Element", "Graphics.Collage"
29 , "Graphics.Element", "Graphics.Collage"
29 , "Native.Ports", "Native.Json"
30 , "Native.Ports", "Native.Json"
30 ]
31 ]
31 text = ("Text", Module.importing textImports)
32 text = ("Text", Module.importing textImports)
32 textImports =
33 textImports =
34+ Var.ADT "Text" (Var.Listing [] False) : map Var.Value
33 [ "toText", "leftAligned", "rightAligned", "centered", "justified"
35 [ "toText", "leftAligned", "rightAligned", "centered", "justified"
34− , "plainText", "asText", "typeface", "monospace", "bold", "italic"
36+ , "plainText", "asText", "typeface", "monospace", "bold", "italic"
35 ]
37 ]
36
38
37interfaces :: Bool -> IO Interfaces
39interfaces :: Bool -> IO Interfaces