git.iko.soy/rowtype-yoga/purescript-native
on 4e7cfee help sign in
55 lines 1.2 kB history raw
1module Main where
3import Prelude
4import Control.Monad.Eff (Eff)
5import Control.Monad.Eff.Console (CONSOLE, log, logShow)
6import Data.Generic.Rep (class Generic)
7import Data.Generic.Rep.Eq (genericEq)
9data X a = X a
11derive instance genericX :: Generic (X a) _
13instance eqX :: Eq a => Eq (X a) where
14 eq xs ys = genericEq xs ys
16data Y a = Y | Z a (Y a)
18derive instance genericY :: Generic (Y a) _
20instance eqY :: Eq a => Eq (Y a) where
21 eq xs ys = genericEq xs ys
23data Z
25derive instance genericZ :: Generic Z _
27instance eqZ :: Eq Z where
28 eq x y = genericEq x y
30type MyString = String
32newtype W = W { x :: Int, y :: MyString }
34derive instance genericW :: Generic W _
36instance eqW :: Eq W where
37 eq x y = genericEq x y
39data V = V { x :: Int } { x :: Int }
41derive instance genericV :: Generic V _
43instance eqV :: Eq V where
44 eq x y = genericEq x y
46main :: Eff (console :: CONSOLE) Unit
47main = do
48 logShow (X 0 == X 1)
49 logShow (X 1 == X 1)
50 logShow (Z 1 Y == Z 1 Y)
51 logShow (Z 1 Y == Y)
52 logShow (Y == Y :: Y Z)
53 logShow (W { x: 0, y: "A" } == W { x: 0, y: "A" })
54 logShow (V { x: 0 } { x: 0 } == V { x: 0 } { x: 0 })
55 log "Done"