git.iko.soy/rowtype-yoga/purescript-native
on da472aa help sign in
53 lines 1.1 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
30newtype W = W { x :: Int, y :: String }
32derive instance genericW :: Generic W _
34instance eqW :: Eq W where
35 eq x y = genericEq x y
37data V = V { x :: Int } { x :: Int }
39derive instance genericV :: Generic V _
41instance eqV :: Eq V where
42 eq x y = genericEq x y
44main :: Eff (console :: CONSOLE) Unit
45main = do
46 logShow (X 0 == X 1)
47 logShow (X 1 == X 1)
48 logShow (Z 1 Y == Z 1 Y)
49 logShow (Z 1 Y == Y)
50 logShow (Y == Y :: Y Z)
51 logShow (W { x: 0, y: "A" } == W { x: 0, y: "A" })
52 logShow (V { x: 0 } { x: 0 } == V { x: 0 } { x: 0 })
53 log "Done"