git.iko.soy/distributed-process
on master help sign in
Support staticFlip.
commit5ad27860a3ee7600272c8e0c2c03babe44a59468 authorEdsko de Vries <edsko@edsko.net> dateThu 27 Sep 2012, 16:18 (14 years ago) parentc70e302
3 files changed+17−1
distributed-static/ChangeLog+4 distributed-static/distributed-static.cabal+1−1 distributed-static/src/Control/Distributed/Static.hs+12
distributed-static/ChangeLog+4
@@ -1,3 +1,7 @@
1+<<date>> Edsko de Vries <edsko@well-typed.com> 0.2.1
2+
3+* Add support for 'staticFlip'
4+
152012-08-16 Edsko de Vries <edsko@well-typed.com> 0.2
26
37* Hide the 'Closure' constructor and export 'closure' instead so that we are
distributed-static/distributed-static.cabal+1−1
@@ -1,5 +1,5 @@
11Name: distributed-static
2−Version: 0.2.0.0
2+Version: 0.2.1
33Synopsis: Compositional, type-safe, polymorphic static values and closures
44Description: /Towards Haskell in the Cloud/ (Epstein et al, Haskell
55 Symposium 2011) introduces the concept of /static/ values:
distributed-static/src/Control/Distributed/Static.hs+12
@@ -205,6 +205,7 @@ module Control.Distributed.Static
205205 , staticCompose
206206 , staticSplit
207207 , staticConst
208+ , staticFlip
208209 -- * Closures
209210 , Closure
210211 , closure
@@ -310,6 +311,7 @@ initRemoteTable =
310311 . registerStatic "$split" (toDynamic ((***) :: (ANY1 -> ANY3) -> (ANY2 -> ANY4) -> (ANY1, ANY2) -> (ANY3, ANY4)))
311312 . registerStatic "$app" (toDynamic (app :: (ANY1 -> ANY2, ANY1) -> ANY2))
312313 . registerStatic "$decodeEnvPair" (toDynamic (decode :: ByteString -> (ByteString, ByteString)))
314+ . registerStatic "$flip" (toDynamic (flip :: (ANY1 -> ANY2 -> ANY3) -> ANY2 -> ANY1 -> ANY3))
313315 $ RemoteTable Map.empty
314316
315317-- | Register a static label
@@ -385,6 +387,11 @@ appStatic :: (Typeable a, Typeable b)
385387 => Static ((a -> b, a) -> b)
386388appStatic = staticLabel "$app"
387389
390+-- | Static version of 'flip'
391+flipStatic :: (Typeable a, Typeable b, Typeable c)
392+ => Static ((a -> b -> c) -> b -> a -> c)
393+flipStatic = staticLabel "$flip"
394+
388395--------------------------------------------------------------------------------
389396-- Combinators on static values --
390397--------------------------------------------------------------------------------
@@ -404,6 +411,11 @@ staticConst :: (Typeable a, Typeable b)
404411 => Static a -> Static (b -> a)
405412staticConst x = constStatic `staticApply` x
406413
414+-- | Static version of 'Prelude.flip'
415+staticFlip :: (Typeable a, Typeable b, Typeable c)
416+ => Static (a -> b -> c) -> Static (b -> a -> c)
417+staticFlip f = flipStatic `staticApply` f
418+
407419--------------------------------------------------------------------------------
408420-- Combinators on Closures --
409421--------------------------------------------------------------------------------