git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Add test for Prelude's unsafeCompare FFI call
a1b6402Gary Burgess
examples/passing/Comparisons.pursnew file+23
@@ -0,0 +1,23 @@
1+module Main where
2+
3+import Control.Monad.Eff
4+import Debug.Trace
5+
6+foreign import data Assert :: !
7+
8+foreign import assert
9+ "function assert(x) {\
10+ \ return function () {\
11+ \ if (!x) throw new Error('assertion failed');\
12+ \ return {};\
13+ \ };\
14+ \};" :: forall e. Boolean -> Eff (assert :: Assert | e) Unit
15+
16+main = do
17+ assert (1 < 2)
18+ assert (2 == 2)
19+ assert (3 > 1)
20+ assert ("a" < "b")
21+ assert ("a" == "a")
22+ assert ("z" > "a")
23+ trace "Done!"