on master help sign in
Functor and Applicative instances for Process.

I think this is the last one!

commit77e407ee3ec7eaee4da9429132bf6e5450fb27b2 authorstartling <tdixon51793@gmail.com> dateMon 19 Nov 2012, 13:31 (14 years ago) parent09615d5
1 file changed+7
lib/System/Concurrency/Process.idr+7
lib/System/Concurrency/Process.idr+7
@@ -15,6 +15,13 @@ data ProcID msg = MkPID Ptr
1515data Process : (msgType : Set) -> Set -> Set where
1616 lift : IO a -> Process msg a
1717
18+instance Functor (Process msg) where
19+ fmap f (lift a) = lift (fmap f a)
20+
21+instance Applicative (Process msg) where
22+ pure = lift . return
23+ (lift f) <$> (lift a) = lift (f <$> a)
24+
1825instance Monad (Process msg) where
1926 return = lift . return
2027 (lift io) >>= k = lift (do x <- io