on master help sign in
Merge branch 'dev' into text
41aa199Evan Czaplicki
compiler/Metadata/Prelude.hs+4−4
@@ -20,12 +20,12 @@ add noPrelude (Module name exs ims decls) = Module name exs (customIms ++ ims) d
20 Just _ -> []
20 Just _ -> []
21
21
22prelude :: [(String, ImportMethod)]
22prelude :: [(String, ImportMethod)]
23−prelude = string : text ++ map (\n -> (n, Hiding [])) modules
23+prelude = string ++ text ++ map (\n -> (n, Hiding [])) modules
24 where
24 where
25 text = map ((,) "Text") [ As "Text", Hiding ["link", "color", "height"] ]
25 text = map ((,) "Text") [ As "Text", Hiding ["link", "color", "height"] ]
26− string = ("String", As "String")
26+ string = map ((,) "String") [ As "String", Importing ["show"] ]
27− modules = [ "Basics", "Signal", "List", "Maybe", "Time", "Prelude"
27+ modules = [ "Basics", "Signal", "List", "Maybe", "Time", "Color"
28− , "Graphics.Element", "Color", "Graphics.Collage", "Native.Ports" ]
28+ , "Graphics.Element", "Graphics.Collage", "Native.Ports" ]
29
29
30interfaces :: Bool -> IO Interfaces
30interfaces :: Bool -> IO Interfaces
31interfaces noPrelude =
31interfaces noPrelude =
libraries/Dict.elm+1−2
@@ -35,7 +35,6 @@ import Basics (..)
35import Maybe (..)
35import Maybe (..)
36import Native.Error
36import Native.Error
37import List
37import List
38−import String
39import Native.Utils
38import Native.Utils
40
39
41-- BBlack and NBlack should only be used during the deletion
40-- BBlack and NBlack should only be used during the deletion
@@ -197,7 +196,7 @@ lessBlackTree t = case t of
197
196
198reportRemBug : String -> NColor -> String -> String -> a
197reportRemBug : String -> NColor -> String -> String -> a
199reportRemBug msg c lgot rgot =
198reportRemBug msg c lgot rgot =
200− Native.Error.raise . String.concat <| [
199+ Native.Error.raise <| List.concat [
201 "Internal red-black tree invariant violated, expected ",
200 "Internal red-black tree invariant violated, expected ",
202 msg,
201 msg,
203 "and got",
202 "and got",
libraries/Native/String.js+3−1
@@ -10,6 +10,7 @@ Elm.Native.String.make = function(elm) {
10 var Maybe = Elm.Maybe.make(elm);
10 var Maybe = Elm.Maybe.make(elm);
11 var JS = Elm.JavaScript.make(elm);
11 var JS = Elm.JavaScript.make(elm);
12 var Utils = Elm.Native.Utils.make(elm);
12 var Utils = Elm.Native.Utils.make(elm);
13+ var show = Elm.Native.Show.make(elm);
13
14
14 function isEmpty(str) {
15 function isEmpty(str) {
15 return str.length === 0;
16 return str.length === 0;
@@ -243,9 +244,10 @@ Elm.Native.String.make = function(elm) {
243 endsWith: F2(endsWith),
244 endsWith: F2(endsWith),
244 indexes: F2(indexes),
245 indexes: F2(indexes),
245
246
247+ show:show,
246 toInt: toInt,
248 toInt: toInt,
247 toFloat: toFloat,
249 toFloat: toFloat,
248 toList: toList,
250 toList: toList,
249 fromList: fromList,
251 fromList: fromList,
250 };
252 };
251−};
253+};
libraries/Prelude.elmdeleted−8
@@ -1,8 +0,0 @@
1−module Prelude where
2−{-| Everything that is automatically imported -}
3−
4−import Native.Show
5−
6−-- Convert almost any value to its string representation.
7−show : a -> String
8−show = Native.Show.show
libraries/String.elm+9−1
@@ -15,7 +15,7 @@ are enclosed in `"double quotes"`. Strings are *not* lists of characters.
15@docs contains, startsWith, endsWith, indexes, indices
15@docs contains, startsWith, endsWith, indexes, indices
16
16
17# Conversions
17# Conversions
18−@docs toInt, toFloat, toList, fromList
18+@docs show, toInt, toFloat, toList, fromList
19
19
20# Formatting
20# Formatting
21Cosmetic operations such as padding with extra characters or trimming whitespace.
21Cosmetic operations such as padding with extra characters or trimming whitespace.
@@ -278,6 +278,14 @@ indexes = Native.String.indexes
278indices : String -> String -> [Int]
278indices : String -> String -> [Int]
279indices = Native.String.indexes
279indices = Native.String.indexes
280
280
281+{-| Turn any kind of value into a string.
282+
283+ show 42 == "42"
284+ show [1,2] == "[1,2]"
285+-}
286+show : a -> String
287+show = Native.String.show
288+
281{-| Try to convert a string into an int, failing on improperly formatted strings.
289{-| Try to convert a string into an int, failing on improperly formatted strings.
282
290
283 toInt "123" == Just 123
291 toInt "123" == Just 123