remote-monad 0.1.0.0 → 0.1.0.1
raw patch · 4 files changed
+19/−7 lines, 4 filesdep ~basedep ~remote-monad
Dependency ranges changed: base, remote-monad
Files
- remote-monad.cabal +2/−2
- src/Control/Remote/Applicative.hs +3/−2
- src/Control/Remote/Monad.hs +3/−2
- src/Control/Remote/Monad/Types.hs +11/−1
remote-monad.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: remote-monad-version: 0.1.0.0+version: 0.1.0.1 synopsis: An parametrizable Remote Monad, and parametrizable Applicative Functor description: An implementation of the concepts behind Remote Monads. There is support for various bundling strategies.@@ -80,7 +80,7 @@ main-is: Test.hs build-depends: base >= 4.7 && < 5 , containers >= 0.1 && < 0.6- , remote-monad == 0.1.0.0+ , remote-monad == 0.1.0.1 , QuickCheck == 2.8.* , quickcheck-instances >= 0.1 && < 0.4 , tasty >= 0.8 && < 0.12
src/Control/Remote/Applicative.hs view
@@ -20,7 +20,7 @@ , command , procedure -- * The run functions- , runApplicative+ , RunApplicative(runApplicative) , runWeakApplicative , runStrongApplicative , runApplicativeApplicative@@ -46,8 +46,9 @@ procedure :: p a -> RemoteApplicative c p a procedure p = RemoteApplicative (Procedure (pure id) p) +-- | 'RunApplicative' is the overloading for choosing the appropriate bundling strategy for applicative. class RunApplicative f where- -- | This overloaded function chooses the best bundling strategy+ -- | This overloaded function chooses the appropriate bundling strategy -- based on the type of the handler your provide. runApplicative :: (Monad m) => (f c p ~> m) -> (RemoteApplicative c p ~> m)
src/Control/Remote/Monad.hs view
@@ -19,7 +19,7 @@ , command , procedure -- * The run functions- , runMonad+ , RunMonad(runMonad) , runWeakMonad , runStrongMonad , runApplicativeMonad@@ -46,8 +46,9 @@ procedure :: p a -> RemoteMonad c p a procedure = Appl . A.procedure +-- 'RunMonad' is the overloading for choosing the appropriate bundling strategy for a monad. class RunMonad f where- -- | This overloaded function chooses the best bundling strategy+ -- | This overloaded function chooses the appropriate bundling strategy -- based on the type of the handler your provide. runMonad :: (Monad m) => (f c p ~> m) -> (RemoteMonad c p ~> m)
src/Control/Remote/Monad/Types.hs view
@@ -22,6 +22,7 @@ import Control.Remote.Monad.Packet.Applicative import Control.Natural +-- | 'RemoteMonad' is our monad that can be executed in a remote location. data RemoteMonad c p a where Appl :: RemoteApplicative c p a -> RemoteMonad c p a Bind :: RemoteApplicative c p a -> (a -> RemoteMonad c p b) -> RemoteMonad c p b@@ -32,9 +33,17 @@ instance Applicative (RemoteMonad c p) where pure a = Appl (pure a) Appl f <*> Appl g = Appl (f <*> g)- Appl f <*> Bind m k = Bind (pure (,) <*> f <*> m) (\ (a,b) -> fmap a $ k b)+ Appl f <*> Bind m k = Bind (pure (,) <*> f <*> m) (\ (a,b) -> pure a <*> k b) Bind m k <*> r = Bind m (\ a -> k a <*> r) + Appl f *> Appl g = Appl (f *> g)+ Appl f *> Bind m k = Bind (f *> m) k+ Bind m k *> r = Bind m (\ a -> k a *> r)++ Appl f <* Appl g = Appl (f <* g)+ Appl f <* Bind m k = Bind (pure (,) <*> f <*> m) (\ (a,b) -> pure a <* k b)+ Bind m k <* r = Bind m (\ a -> k a <* r)+ instance Monad (RemoteMonad c p) where return = pure Appl m >>= k = Bind m k@@ -42,6 +51,7 @@ m1 >> m2 = m1 *> m2 -- This improves our bundling opportunities +-- | 'RemoteApplicative' is our applicative that can be executed in a remote location. newtype RemoteApplicative c p a = RemoteApplicative (ApplicativePacket c p a) instance Functor (RemoteApplicative c p) where