ref: b74c30e96017fbb348f5baab8f231937e80aebbc
parent: 784543ab913bda88958efb23f1e488f4f5737c0b
author: Lennart Augustsson <lennart.augustsson@epicgames.com>
date: Mon Nov 20 08:07:31 EST 2023
Monad instance for functions.
--- a/lib/Control/Monad.hs
+++ b/lib/Control/Monad.hs
@@ -87,7 +87,16 @@
b <- p x
(ts,fs) <- partitionM p xs
return $ if b then (x:ts, fs) else (ts, x:fs)
-
+
+instance forall a . Functor ((->) a) where
+ fmap = (.)
+
+instance forall a . Applicative ((->) a) where
+ pure = const
+ f <*> g = \ a -> f a (g a)
+
+instance forall a . Monad ((->) a) where
+ (>>=) x y z = y (x z) z
{--- Same for Maybe
--
⑨