git.iko.soy/distributed-process
on master help sign in
makefile improvement; additional unsafe primitives
commit79734d35205d26da7f5e7eef64e922e7126e3cc2 authorTim Watson <watson.timothy@gmail.com> dateThu 24 Oct 2013, 13:57 (13 years ago) parenta58da2f
3 files changed+12−59
Makefile+3−59 src/Control/Distributed/Process/Internal/Primitives.hs+4 src/Control/Distributed/Process/UnsafePrimitives.hs+5
Makefile+3−59
@@ -1,62 +1,6 @@
1−# CI build
21
3−GHC ?= $(shell which ghc)
4−CABAL ?= $(shell which cabal)
5−CABAL_DEV ?= $(shell which cabal-dev)
6−PWD = $(shell pwd)
7−SANDBOX ?= $(PWD)/cabal-dev
8−BRANCH ?= $(shell git branch | grep '*' | awk '/.*/ { print $NF }')
9−GIT_BASE ?= git://github.com/haskell-distributed
10−USE_LOCAL_UMBRELLA ?=
11−REPOS=$(shell cat REPOS | sed '/^$$/d')
12−
13−.PHONY: all
14−all:
15− $(info branch = ${BRANCH})
16−
17−.PHONY: clean
18−clean:
19− rm -rf ${REPOS} ./dist ./cabal-dev
20−
21−.PHONY: dev-install
22−ifneq (,$(CABAL_DEV))
23−dev-install: $(REPOS)
24− $(CABAL_DEV) install --enable-tests
2+ifneq (,$(BASE_DIR))
3+include $(BASE_DIR)/build.mk
254else
26−dev-install:
27− $(error install cabal-dev to proceed)
5+include ../build.mk
286endif
29−
30−.PHONY: ci
31−ci: travis-install travis-test
32−
33−.PHONY: travis-install
34−travis-install: $(REPOS)
35− $(CABAL) install --with-ghc=$(GHC) $(REPOS) --force-reinstalls
36− $(CABAL) install
37−
38−.PHONY: travis-test
39−travis-test:
40− $(CABAL) configure --enable-tests
41− $(CABAL) build
42− $(CABAL) test --show-details=always
43−
44−ifneq (,$(USE_LOCAL_UMBRELLA))
45−define clone
46− git clone $(GIT_BASE)/$1 $1
47−endef
48−else
49−define clone
50− git clone $(GIT_BASE)/$1.git $1
51−endef
52−endif
53−
54−$(REPOS):
55− $(call clone,$@)
56− git --git-dir=$@/.git \
57− --work-tree=$@ \
58− checkout $(BRANCH)
59− cd $@ && $(CABAL_DEV) install --sandbox=$(SANDBOX)
60−
61−./build:
62− mkdir -p build
src/Control/Distributed/Process/Internal/Primitives.hs+4
@@ -32,6 +32,7 @@ module Control.Distributed.Process.Internal.Primitives
3232 , matchMessageIf
3333 , isEncoded
3434 , wrapMessage
35+ , unsafeWrapMessage
3536 , unwrapMessage
3637 , handleMessage
3738 , handleMessageIf
@@ -433,6 +434,9 @@ forward msg them = do
433434wrapMessage :: Serializable a => a -> Message
434435wrapMessage = createUnencodedMessage -- see [note Serializable UnencodedMessage]
435436
437+unsafeWrapMessage :: Serializable a => a -> Message
438+unsafeWrapMessage = Unsafe.wrapMessage
439+
436440-- [note Serializable UnencodedMessage]
437441-- if we attempt to serialise an UnencodedMessage, it will be converted to an
438442-- EncodedMessage first, so we're ok here. See 'messageToPayload' in
src/Control/Distributed/Process/UnsafePrimitives.hs+5
@@ -44,6 +44,7 @@ module Control.Distributed.Process.UnsafePrimitives
4444 send
4545 , sendChan
4646 , nsend
47+ , wrapMessage
4748 ) where
4849
4950import Control.Distributed.Process.Internal.Messaging
@@ -62,6 +63,7 @@ import Control.Distributed.Process.Internal.Types
6263 , Identifier(..)
6364 , ImplicitReconnect(..)
6465 , SendPortId(..)
66+ , Message
6567 , sendPortProcessId
6668 , unsafeCreateUnencodedMessage
6769 )
@@ -104,6 +106,9 @@ sendChan (SendPort cid) msg = do
104106 NoImplicitReconnect
105107 msg
106108
109+wrapMessage :: Serializable a => a -> Message
110+wrapMessage = unsafeCreateUnencodedMessage
111+
107112unsafeSendLocal :: (Serializable a) => ProcessId -> a -> Process ()
108113unsafeSendLocal pid msg =
109114 sendCtrlMsg Nothing $ LocalSend pid (unsafeCreateUnencodedMessage msg)