git.iko.soy/rowtype-yoga/purescript-native
on 8030607 help sign in
59 lines 1.2 kB history raw
1module Main where
3import Prelude
5test1 = \_ -> show "testing"
7f :: forall a. (Prelude.Show a) => a -> String
8f x = show x
10test2 = \_ -> f "testing"
12test7 :: forall a. (Prelude.Show a) => a -> String
13test7 = show
15test8 = \_ -> show $ "testing"
17data Data a = Data a
19instance showData :: (Prelude.Show a) => Prelude.Show (Data a) where
20 show (Data a) = "Data (" ++ show a ++ ")"
22test3 = \_ -> show (Data "testing")
24instance monadData :: Prelude.Monad Data where
25 return = Data
26 (>>=) (Data a) f = f a
28data Maybe a = Nothing | Just a
30instance monadMaybe :: Prelude.Monad Maybe where
31 return = Just
32 (>>=) Nothing _ = Nothing
33 (>>=) (Just a) f = f a
35test4 :: forall a m. (Monad m) => a -> m Number
36test4 = \_ -> return 1
38test5 = \_ -> Just 1 >>= \n -> return (n + 1)
40instance showArray :: (Prelude.Show a) => Prelude.Show [a] where
41 show [] = "[]"
42 show (x:xs) = show x ++ ", " ++ show xs
44test6 = \_ -> show ["testing"]
46instance monadFunction :: Prelude.Monad ((->) r) where
47 return a r = a
48 (>>=) f g r = g (f r) r
50ask r = r
52runReader r f = f r
54test9 _ = runReader 0 $ do
55 n <- ask
56 return $ n + 1
58main = Debug.Trace.trace (test7 "Done")