Move show function to String library and get rid of Prelude library
This commit is contained in:
parent
cc3c8704e2
commit
74d0482ace
5 changed files with 17 additions and 16 deletions
|
@ -20,12 +20,12 @@ add noPrelude (Module name exs ims decls) = Module name exs (customIms ++ ims) d
|
|||
Just _ -> []
|
||||
|
||||
prelude :: [(String, ImportMethod)]
|
||||
prelude = string : text ++ map (\n -> (n, Hiding [])) modules
|
||||
prelude = string ++ text ++ map (\n -> (n, Hiding [])) modules
|
||||
where
|
||||
text = map ((,) "Text") [ As "Text", Hiding ["link", "color", "height"] ]
|
||||
string = ("String", As "String")
|
||||
modules = [ "Basics", "Signal", "List", "Maybe", "Time", "Prelude"
|
||||
, "Graphics.Element", "Color", "Graphics.Collage", "Native.Ports" ]
|
||||
string = map ((,) "String") [ As "String", Importing ["show"] ]
|
||||
modules = [ "Basics", "Signal", "List", "Maybe", "Time", "Color"
|
||||
, "Graphics.Element", "Graphics.Collage", "Native.Ports" ]
|
||||
|
||||
interfaces :: Bool -> IO Interfaces
|
||||
interfaces noPrelude =
|
||||
|
|
|
@ -35,7 +35,6 @@ import Basics (..)
|
|||
import Maybe (..)
|
||||
import Native.Error
|
||||
import List
|
||||
import String
|
||||
import Native.Utils
|
||||
|
||||
-- BBlack and NBlack should only be used during the deletion
|
||||
|
@ -197,7 +196,7 @@ lessBlackTree t = case t of
|
|||
|
||||
reportRemBug : String -> NColor -> String -> String -> a
|
||||
reportRemBug msg c lgot rgot =
|
||||
Native.Error.raise . String.concat <| [
|
||||
Native.Error.raise <| List.concat [
|
||||
"Internal red-black tree invariant violated, expected ",
|
||||
msg,
|
||||
"and got",
|
||||
|
|
|
@ -10,6 +10,7 @@ Elm.Native.String.make = function(elm) {
|
|||
var Maybe = Elm.Maybe.make(elm);
|
||||
var JS = Elm.JavaScript.make(elm);
|
||||
var Utils = Elm.Native.Utils.make(elm);
|
||||
var show = Elm.Native.Show.make(elm);
|
||||
|
||||
function isEmpty(str) {
|
||||
return str.length === 0;
|
||||
|
@ -243,9 +244,10 @@ Elm.Native.String.make = function(elm) {
|
|||
endsWith: F2(endsWith),
|
||||
indexes: F2(indexes),
|
||||
|
||||
show:show,
|
||||
toInt: toInt,
|
||||
toFloat: toFloat,
|
||||
toList: toList,
|
||||
fromList: fromList,
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
module Prelude where
|
||||
{-| Everything that is automatically imported -}
|
||||
|
||||
import Native.Show
|
||||
|
||||
-- Convert almost any value to its string representation.
|
||||
show : a -> String
|
||||
show = Native.Show.show
|
|
@ -15,7 +15,7 @@ are enclosed in `"double quotes"`. Strings are *not* lists of characters.
|
|||
@docs contains, startsWith, endsWith, indexes, indices
|
||||
|
||||
# Conversions
|
||||
@docs toInt, toFloat, toList, fromList
|
||||
@docs show, toInt, toFloat, toList, fromList
|
||||
|
||||
# Formatting
|
||||
Cosmetic operations such as padding with extra characters or trimming whitespace.
|
||||
|
@ -278,6 +278,14 @@ indexes = Native.String.indexes
|
|||
indices : String -> String -> [Int]
|
||||
indices = Native.String.indexes
|
||||
|
||||
{-| Turn any kind of value into a string.
|
||||
|
||||
show 42 == "42"
|
||||
show [1,2] == "[1,2]"
|
||||
-}
|
||||
show : a -> String
|
||||
show = Native.String.show
|
||||
|
||||
{-| Try to convert a string into an int, failing on improperly formatted strings.
|
||||
|
||||
toInt "123" == Just 123
|
||||
|
|
Loading…
Reference in a new issue