git.iko.soy/rowtype-yoga/purescript-native
on e82e607 help sign in
89 lines 1.8 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 functorData :: Functor Data where
25 (<$>) = liftM1
27instance applyData :: Apply Data where
28 (<*>) = ap
30instance applicativeData :: Applicative Data where
31 pure = Data
33instance bindData :: Bind Data where
34 (>>=) (Data a) f = f a
36instance monadData :: Monad Data
38data Maybe a = Nothing | Just a
40instance functorMaybe :: Functor Maybe where
41 (<$>) = liftM1
43instance applyMaybe :: Apply Maybe where
44 (<*>) = ap
46instance applicativeMaybe :: Applicative Maybe where
47 pure = Just
49instance bindMaybe :: Bind Maybe where
50 (>>=) Nothing _ = Nothing
51 (>>=) (Just a) f = f a
53instance monadMaybe :: Monad Maybe
55test4 :: forall a m. (Monad m) => a -> m Number
56test4 = \_ -> return 1
58test5 = \_ -> Just 1 >>= \n -> return (n + 1)
60instance showArray :: (Prelude.Show a) => Prelude.Show [a] where
61 show [] = "[]"
62 show (x:xs) = show x ++ ", " ++ show xs
64test6 = \_ -> show ["testing"]
66instance functorFunction :: Functor ((->) r) where
67 (<$>) = liftM1
69instance applyFunction :: Apply ((->) r) where
70 (<*>) = ap
72instance applicativeFunction :: Applicative ((->) r) where
73 pure a _ = a
75instance bindFunction :: Bind ((->) r) where
76 (>>=) f g r = g (f r) r
78instance monadFunction :: Monad ((->) r)
80ask r = r
82runReader r f = f r
84test9 _ = runReader 0 $ do
85 n <- ask
86 return $ n + 1
88main = Debug.Trace.trace (test7 "Done")