@@ -1,7 +1,7 @@
2module Basics where
2module Basics where
4−import Native.Basics as Native
4+import Native.Basics
6type String = [Char]
6type String = [Char]
@@ -11,72 +11,72 @@ radians t = t
12-- Convert degrees to standard Elm angles (radians).
12-- Convert degrees to standard Elm angles (radians).
13degrees : Float -> Float
13degrees : Float -> Float
14−degrees d = d * Native.pi / 180
14+degrees d = d * Native.Basics.pi / 180
16-- Convert turns to standard Elm angles (radians).
16-- Convert turns to standard Elm angles (radians).
17-- One turn is equal to 360°.
17-- One turn is equal to 360°.
18turns : Float -> Float
18turns : Float -> Float
19−turns r = 2 * Native.pi * r
19+turns r = 2 * Native.Basics.pi * r
21-- Start with polar coordinates (r,θ)
21-- Start with polar coordinates (r,θ)
22-- and get out cartesian coordinates (x,y).
22-- and get out cartesian coordinates (x,y).
23fromPolar : (Float,Float) -> (Float,Float)
23fromPolar : (Float,Float) -> (Float,Float)
24−fromPolar (r,t) = (r * Native.cos t, r * Native.sin t)
24+fromPolar (r,t) = (r * Native.Basics.cos t, r * Native.Basics.sin t)
26-- Start with cartesian coordinates (x,y)
26-- Start with cartesian coordinates (x,y)
27-- and get out polar coordinates (r,θ).
27-- and get out polar coordinates (r,θ).
28toPolar : (Float,Float) -> (Float,Float)
28toPolar : (Float,Float) -> (Float,Float)
29−toPolar (x,y) = (Native.sqrt (x^2 + y^2), Native.atan2 y x)
29+toPolar (x,y) = (Native.Basics.sqrt (x^2 + y^2), Native.Basics.atan2 y x)
31(+) : number -> number -> number
31(+) : number -> number -> number
32−(+) = Native.add
32+(+) = Native.Basics.add
34(-) : number -> number -> number
34(-) : number -> number -> number
35−(-) = Native.sub
35+(-) = Native.Basics.sub
37(*) : number -> number -> number
37(*) : number -> number -> number
38−(*) = Native.mul
38+(*) = Native.Basics.mul
40-- Floating point division.
40-- Floating point division.
41(/) : Float -> Float -> Float
41(/) : Float -> Float -> Float
42−(/) = Native.floatDiv
42+(/) = Native.Basics.floatDiv
44-- Integer division, remainder is discarded.
44-- Integer division, remainder is discarded.
45div : Int -> Int -> Int
45div : Int -> Int -> Int
46−div = Native.div
46+div = Native.Basics.div
48-- Finds the remainder after dividing one number by another: ``4 `rem` 3 == 1``
48-- Finds the remainder after dividing one number by another: ``4 `rem` 3 == 1``
49rem : Int -> Int -> Int
49rem : Int -> Int -> Int
50−rem = Native.rem
50+rem = Native.Basics.rem
52-- Perform modular arithmetic: ``7 `mod` 2 == 1``
52-- Perform modular arithmetic: ``7 `mod` 2 == 1``
53mod : Int -> Int -> Int
53mod : Int -> Int -> Int
54−mod = Native.mod
54+mod = Native.Basics.mod
56-- Exponentiation: `3^2 == 9`
56-- Exponentiation: `3^2 == 9`
57(^) : number -> number -> number
57(^) : number -> number -> number
58−(^) = Native.exp
58+(^) = Native.Basics.exp
60cos : Float -> Float
60cos : Float -> Float
61−cos = Native.cos
61+cos = Native.Basics.cos
63sin : Float -> Float
63sin : Float -> Float
64−sin = Native.sin
64+sin = Native.Basics.sin
66tan : Float -> Float
66tan : Float -> Float
67−tan = Native.tan
67+tan = Native.Basics.tan
69acos : Float -> Float
69acos : Float -> Float
70−acos = Native.acos
70+acos = Native.Basics.acos
72asin : Float -> Float
72asin : Float -> Float
73−asin = Native.asin
73+asin = Native.Basics.asin
75-- You probably do not want to use this. Because it takes `(y/x)` as the argument
75-- You probably do not want to use this. Because it takes `(y/x)` as the argument
76-- there is no way to know where the negative signs come from so the resulting
76-- there is no way to know where the negative signs come from so the resulting
77-- angle is always between π/2 and -π/2 (in quadrants I and IV).
77-- angle is always between π/2 and -π/2 (in quadrants I and IV).
78atan : Float -> Float
78atan : Float -> Float
79−atan = Native.atan
79+atan = Native.Basics.atan
81-- This helps you find the angle of a cartesian coordinate.
81-- This helps you find the angle of a cartesian coordinate.
82-- You will almost certainly want to use this instead of `atan`.
82-- You will almost certainly want to use this instead of `atan`.
@@ -84,27 +84,27 @@ atan = Native.atan
84-- quadrant the angle should really be in. The result will be between
84-- quadrant the angle should really be in. The result will be between
85-- π and -π, giving you the full range of angles.
85-- π and -π, giving you the full range of angles.
86atan2 : Float -> Float -> Float
86atan2 : Float -> Float -> Float
87−atan2 = Native.atan2
87+atan2 = Native.Basics.atan2
89-- Take the square root of a number.
89-- Take the square root of a number.
90sqrt : number -> number
90sqrt : number -> number
91−sqrt = Native.sqrt
91+sqrt = Native.Basics.sqrt
93-- Take the absolute value of a number.
93-- Take the absolute value of a number.
94abs : number -> number
94abs : number -> number
95−abs = Native.abs
95+abs = Native.Basics.abs
97-- Calculate the logarithm of a number with a given base: `logBase 10 100 == 2`
97-- Calculate the logarithm of a number with a given base: `logBase 10 100 == 2`
98logBase : number -> number -> number
98logBase : number -> number -> number
99−logBase = Native.logBase
99+logBase = Native.Basics.logBase
101-- Given two comparables, returns the smaller one.
101-- Given two comparables, returns the smaller one.
102min : comparable -> comparable -> comparable
102min : comparable -> comparable -> comparable
103−min = Native.min
103+min = Native.Basics.min
105-- Given two comparables, returns the larger one.
105-- Given two comparables, returns the larger one.
106max : comparable -> comparable -> comparable
106max : comparable -> comparable -> comparable
107−max = Native.max
107+max = Native.Basics.max
109-- Clamps a number within a given range. With the expression `clamp 100 200 x`
109-- Clamps a number within a given range. With the expression `clamp 100 200 x`
110-- the results are as follows:
110-- the results are as follows:
@@ -113,40 +113,40 @@ max = Native.max
113-- * ` x if 100 <= x < 200`
113-- * ` x if 100 <= x < 200`
114-- * `200 if 200 <= x`
114-- * `200 if 200 <= x`
115clamp : number -> number -> number -> number
115clamp : number -> number -> number -> number
116−clamp = Native.clamp
116+clamp = Native.Basics.clamp
118-- An approximation of pi.
118-- An approximation of pi.
119pi : Float
119pi : Float
120−pi = Native.pi
120+pi = Native.Basics.pi
122-- An approximation of e.
122-- An approximation of e.
124−e = Native.e
124+e = Native.Basics.e
126-- Compare any two values for structural equality. Functions cannot be compared.
126-- Compare any two values for structural equality. Functions cannot be compared.
127(==) : a -> a -> Bool
127(==) : a -> a -> Bool
128−(==) = Native.eq
128+(==) = Native.Basics.eq
130(/=) : a -> a -> Bool
130(/=) : a -> a -> Bool
131−(/=) = Native.neq
131+(/=) = Native.Basics.neq
133(<) : comparable -> comparable -> Bool
133(<) : comparable -> comparable -> Bool
134−(<) = Native.lt
134+(<) = Native.Basics.lt
136(>) : comparable -> comparable -> Bool
136(>) : comparable -> comparable -> Bool
137−(>) = Native.gt
137+(>) = Native.Basics.gt
139(<=) : comparable -> comparable -> Bool
139(<=) : comparable -> comparable -> Bool
140−(<=) = Native.le
140+(<=) = Native.Basics.le
142(>=) : comparable -> comparable -> Bool
142(>=) : comparable -> comparable -> Bool
143−(>=) = Native.ge
143+(>=) = Native.Basics.ge
145-- Compare any two comparable values. Comparable values include `String`, `Char`,
145-- Compare any two comparable values. Comparable values include `String`, `Char`,
146-- `Int`, `Float`, `Time`, or a list or tuple containing comparable values.
146-- `Int`, `Float`, `Time`, or a list or tuple containing comparable values.
147-- These are also the only values that work as `Dict` keys or `Set` members.
147-- These are also the only values that work as `Dict` keys or `Set` members.
148compare : comparable -> comparable -> Order
148compare : comparable -> comparable -> Order
149−compare = Native.compare
149+compare = Native.Basics.compare
151-- Represents the relative ordering of two things.
151-- Represents the relative ordering of two things.
152-- The relations are less than, equal to, and greater than.
152-- The relations are less than, equal to, and greater than.
@@ -154,19 +154,19 @@ data Order = LT | EQ | GT
155-- The and operator. True if both inputs are True.
155-- The and operator. True if both inputs are True.
156(&&) : Bool -> Bool -> Bool
156(&&) : Bool -> Bool -> Bool
157−(&&) = Native.and
157+(&&) = Native.Basics.and
159-- The or operator. True if one or both inputs are True.
159-- The or operator. True if one or both inputs are True.
160(||) : Bool -> Bool -> Bool
160(||) : Bool -> Bool -> Bool
161−(||) = Native.or
161+(||) = Native.Basics.or
163-- The exclusive-or operator. True if exactly one input is True.
163-- The exclusive-or operator. True if exactly one input is True.
164xor : Bool -> Bool -> Bool
164xor : Bool -> Bool -> Bool
165−xor = Native.xor
165+xor = Native.Basics.xor
167-- Negate a boolean value: `(not True == False)` and `(not False == True)`
167-- Negate a boolean value: `(not True == False)` and `(not False == True)`
168not : Bool -> Bool
168not : Bool -> Bool
169−not = Native.not
169+not = Native.Basics.not
171-- Equal to true. Useful as the last case of a multi-way-if.
171-- Equal to true. Useful as the last case of a multi-way-if.
172otherwise : Bool
172otherwise : Bool
@@ -177,35 +177,35 @@ otherwise = True
178-- Round a number to the nearest integer.
178-- Round a number to the nearest integer.
179round : Float -> Int
179round : Float -> Int
180−round = Native.round
180+round = Native.Basics.round
182-- Truncate a decimal number, rounding towards zero.
182-- Truncate a decimal number, rounding towards zero.
183truncate : Float -> Int
183truncate : Float -> Int
184−truncate = Native.truncate
184+truncate = Native.Basics.truncate
186-- Floor function, rounding down.
186-- Floor function, rounding down.
187floor : Float -> Int
187floor : Float -> Int
188−floor = Native.floor
188+floor = Native.Basics.floor
190-- Ceiling function, rounding up.
190-- Ceiling function, rounding up.
191ceiling : Float -> Int
191ceiling : Float -> Int
192−ceiling = Native.ceiling
192+ceiling = Native.Basics.ceiling
194-- Convert an integer into a float.
194-- Convert an integer into a float.
195toFloat : Int -> Float
195toFloat : Int -> Float
196−toFloat = Native.toFloat
196+toFloat = Native.Basics.toFloat
198-- Convert almost any value to its string representation.
198-- Convert almost any value to its string representation.
199show : a -> String
199show : a -> String
200−show = Native.show
200+show = Native.Basics.show
202-- Read an integer from a string
202-- Read an integer from a string
203-- readInt : String -> Maybe Int
203-- readInt : String -> Maybe Int
204−readInt = Native.readInt
204+--readInt = Native.Basics.readInt
206-- Read a float from a string.
206-- Read a float from a string.
207-- readFloat : String -> Maybe Float
207-- readFloat : String -> Maybe Float
208−readFloat = Native.readFloat
208+--readFloat = Native.Basics.readFloat
210-- Function Helpers
210-- Function Helpers
@@ -244,11 +244,11 @@ id x = x
245-- Given a 2-tuple, returns the first value.
245-- Given a 2-tuple, returns the first value.
246fst : (a,b) -> a
246fst : (a,b) -> a
247−fst = Native.fst
247+fst = Native.Basics.fst
249-- Given a 2-tuple, returns the second value.
249-- Given a 2-tuple, returns the second value.
250snd : (a,b) -> b
250snd : (a,b) -> b
251−snd = Native.snd
251+snd = Native.Basics.snd
253-- Flips the order of the first two arguments to a function.
253-- Flips the order of the first two arguments to a function.
254flip : (a -> b -> c) -> (b -> a -> c)
254flip : (a -> b -> c) -> (b -> a -> c)
@@ -257,9 +257,9 @@ flip f b a = f a b
257-- Change how arguments are passed to a function. This splits paired arguments
257-- Change how arguments are passed to a function. This splits paired arguments
258-- into two separate arguments.
258-- into two separate arguments.
259curry : ((a,b) -> c) -> a -> b -> c
259curry : ((a,b) -> c) -> a -> b -> c
260−curry = Native.curry
260+curry = Native.Basics.curry
262-- Change how arguments are passed to a function. This combines two arguments
262-- Change how arguments are passed to a function. This combines two arguments
263-- into a sigle pair.
263-- into a sigle pair.
264uncurry : (a -> b -> c) -> (a,b) -> c
264uncurry : (a -> b -> c) -> (a,b) -> c
265−uncurry = Native.uncurry
265+uncurry = Native.Basics.uncurry