git.iko.soy/rowtype-yoga/purescript-native
on fb511d9 help sign in
69 lines 1.3 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 map = liftM1
27instance applyData :: Apply Data where
28 apply = ap
30instance applicativeData :: Applicative Data where
31 pure = Data
33instance bindData :: Bind Data where
34 bind (Data a) f = f a
36instance monadData :: Monad Data
38data Maybe a = Nothing | Just a
40instance functorMaybe :: Functor Maybe where
41 map = liftM1
43instance applyMaybe :: Apply Maybe where
44 apply = ap
46instance applicativeMaybe :: Applicative Maybe where
47 pure = Just
49instance bindMaybe :: Bind Maybe where
50 bind Nothing _ = Nothing
51 bind (Just a) f = f a
53instance monadMaybe :: Monad Maybe
55test4 :: forall a m. (Monad m) => a -> m Number
56test4 = \_ -> return 1.0
58test5 = \_ -> Just 1.0 >>= \n -> return (n + 1.0)
60ask r = r
62runReader r f = f r
64test9 _ = runReader 0.0 $ do
65 n <- ask
66 return $ n + 1.0
68main = Control.Monad.Eff.Console.log (test7 "Done")