git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Add Monad example
commit832c8296b06cfeb63f48b894da2742cd1340b33c authorPhil Freeman <paf31@cantab.net> dateThu 16 Jan 2014, 16:20 (13 years ago) parentc638ad6
1 file changed+8
examples/passing/TypeClasses.purs+8
examples/passing/TypeClasses.purs+8
@@ -19,3 +19,11 @@ instance (TypeClasses.Show a) => TypeClasses.Show (Data a) where
1919 show (Data a) = "Data (" ++ show a ++ ")"
2020
2121test3 = show (Data "testing")
22+
23+class Monad m where
24+ ret :: forall a. a -> m a
25+ bind :: forall a b. m a -> (a -> m b) -> m b
26+
27+instance TypeClasses.Monad Data where
28+ ret = Data
29+ bind (Data a) f = f a