git.iko.soy/rowtype-yoga/purescript-native
on cd4c708 help sign in
71 lines 1.3 kB history raw
1module Main where
3import Prelude
4import Control.Monad.Eff.Console (log)
6test1 = \_ -> show "testing"
8f :: forall a. (Show a) => a -> String
9f x = show x
11test2 = \_ -> f "testing"
13test7 :: forall a. (Show a) => a -> String
14test7 = show
16test8 = \_ -> show $ "testing"
18data Data a = Data a
20instance showData :: (Show a) => Show (Data a) where
21 show (Data a) = "Data (" <> show a <> ")"
23test3 = \_ -> show (Data "testing")
25instance functorData :: Functor Data where
26 map = liftM1
28instance applyData :: Apply Data where
29 apply = ap
31instance applicativeData :: Applicative Data where
32 pure = Data
34instance bindData :: Bind Data where
35 bind (Data a) f = f a
37instance monadData :: Monad Data
39data Maybe a = Nothing | Just a
41instance functorMaybe :: Functor Maybe where
42 map = liftM1
44instance applyMaybe :: Apply Maybe where
45 apply = ap
47instance applicativeMaybe :: Applicative Maybe where
48 pure = Just
50instance bindMaybe :: Bind Maybe where
51 bind Nothing _ = Nothing
52 bind (Just a) f = f a
54instance monadMaybe :: Monad Maybe
56test4 :: forall a m. (Monad m) => a -> m Number
57test4 = \_ -> pure 1.0
59test5 = \_ -> Just 1.0 >>= \n -> pure (n + 1.0)
61ask r = r
63runReader r f = f r
65test9 _ = runReader 0.0 $ do
66 n <- ask
67 pure $ n + 1.0
69main = do
70 log (test7 "Hello")
71 log "Done"