git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Deriving tests
commit05e5c188222011fd589a7c69f5ea854f15c10a94 authorPhil Freeman <paf31@cantab.net> dateSat 6 Feb 2016, 15:53 (11 years ago) parentd5d0adf
1 file changed+19
examples/passing/Deriving.purs+19
examples/passing/Deriving.pursnew file+19
@@ -0,0 +1,19 @@
1+module Main where
2+
3+import Prelude
4+import Test.Assert
5+
6+data X = X Int | Y String
7+
8+derive instance eqX :: Eq X
9+
10+derive instance ordX :: Ord X
11+
12+main = do
13+ assert $ X 0 == X 0
14+ assert $ X 0 /= X 1
15+ assert $ Y "Foo" == Y "Foo"
16+ assert $ Y "Foo" /= Y "Bar"
17+ assert $ X 0 < X 1
18+ assert $ X 0 < Y "Foo"
19+ assert $ Y "Bar" < Y "Baz"