on master help sign in
Move some library functions out of JS and into Elm
commita3ba3d3e2e0d3ff366fba8a0458be5bd17f7fff1 authorEvan Czaplicki <info@elm-lang.org> dateTue 29 Oct 2013, 17:16 (13 years ago) parent3ae8b16
2 files changed+4−14
libraries/Basics.elm+4−4 libraries/Native/Basics.js−10
libraries/Basics.elm+4−4
@@ -311,11 +311,11 @@ id x = x
311311
312312{-| Given a 2-tuple, returns the first value. -}
313313fst : (a,b) -> a
314−fst = Native.Basics.fst
314+fst (a,_) = a
315315
316316{-| Given a 2-tuple, returns the second value. -}
317317snd : (a,b) -> b
318−snd = Native.Basics.snd
318+snd (_,b) = b
319319
320320{-| Flips the order of the first two arguments to a function. -}
321321flip : (a -> b -> c) -> (b -> a -> c)
@@ -325,10 +325,10 @@ flip f b a = f a b
325325This splits paired arguments into two separate arguments.
326326-}
327327curry : ((a,b) -> c) -> a -> b -> c
328−curry = Native.Basics.curry
328+curry f a b = f (a,b)
329329
330330{-| Change how arguments are passed to a function.
331331This combines two arguments into a sigle pair.
332332-}
333333uncurry : (a -> b -> c) -> (a,b) -> c
334−uncurry = Native.Basics.uncurry
334+uncurry f (a,b) = f a b
libraries/Native/Basics.js−10
@@ -22,11 +22,6 @@ Elm.Native.Basics.make = function(elm) {
2222
2323 function truncate(n) { return n|0; }
2424
25− function curry(f,a,b) { return f(Utils.Tuple2(a,b)); }
26− function uncurry(f,v) { return A2(f,v._0,v._1); }
27− function fst(t) { return t._0; }
28− function snd(t) { return t._1; }
29−
3025 var basics = {
3126 div:F2(div),
3227 rem:F2(rem),
@@ -58,11 +53,6 @@ Elm.Native.Basics.make = function(elm) {
5853 floor:Math.floor,
5954 round:Math.round,
6055 toFloat:function(x) { return x; },
61−
62− curry:F3(curry),
63− uncurry:F2(uncurry),
64− fst:fst,
65− snd:snd
6656 };
6757
6858 return elm.Native.Basics.values = basics;