git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Add another test for newtypes
dfb4475Phil Freeman
examples/passing/NewtypeEff.pursnew file+28
@@ -0,0 +1,28 @@
1+module Main where
2+
3+import Debug.Trace
4+import Control.Monad.Eff
5+
6+newtype T a = T (Eff (trace :: Trace) a)
7+
8+runT :: forall a. T a -> Eff (trace :: Trace) a
9+runT (T t) = t
10+
11+instance functorT :: Functor T where
12+ (<$>) f (T t) = T (f <$> t)
13+
14+instance applyT :: Apply T where
15+ (<*>) (T f) (T x) = T (f <*> x)
16+
17+instance applicativeT :: Applicative T where
18+ pure t = T (pure t)
19+
20+instance bindT :: Bind T where
21+ (>>=) (T t) f = T (t >>= \x -> runT (f x))
22+
23+instance monadT :: Monad T
24+
25+main = runT do
26+ T $ trace "Done"
27+ T $ trace "Done"
28+ T $ trace "Done"