Skip to content

Commit 512e4ea

Browse files
committed
Merge branch 'develop' into queryt-optimization
2 parents 7494f05 + fc68de9 commit 512e4ea

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1326
-602
lines changed

.travis.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

Quickref.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ Since MonadHold depends on MonadSample, any [S] function also runs in [H] contex
9898
[ ] <> :: Monoid a => Behavior a -> Behavior a -> Behavior a
9999
-- ... plus many more due to typeclass membership
100100

101+
-- Combine multiple behaviors via applicative instance
102+
[ ] ffor2 :: Behavior a -> Behavior b -> (a -> b -> c) -> Behavior c
103+
[ ] ffor3 :: Behavior a -> Behavior b -> Behavior c -> (a -> b -> c -> d) -> Behavior d
104+
101105
-- Behavior to Behavior by sampling current values
102106
[S] sample :: Behavior a -> m a
103107
[ ] pull :: m a -> Behavior a
@@ -135,6 +139,10 @@ Since MonadHold depends on MonadSample, any [S] function also runs in [H] contex
135139
[ ] >>= :: Dynamic a -> (a -> Dynamic b) -> Dynamic b
136140
[ ] zipDynWith :: (a -> b -> c) -> Dynamic a -> Dynamic b -> Dynamic c
137141

142+
-- Combine multiple dynamics via applicative instance
143+
[ ] ffor2 :: Dynamic a -> Dynamic b -> (a -> b -> c) -> Dynamic c
144+
[ ] ffor3 :: Dynamic a -> Dynamic b -> Dynamic c -> (a -> b -> c -> d) -> Dynamic d
145+
138146
-- Efficient one-to-many fanout
139147
[ ] demux :: Ord k => Dynamic k -> Demux k
140148
[ ] demuxed :: Eq k => Demux k -> k -> Dynamic Bool
@@ -284,3 +292,20 @@ Th typeclasses and their associated annotations include:
284292
[P,T] delay :: NominalDiffTime -> Event t a -> m (Event t a)
285293
```
286294

295+
## Networks
296+
297+
```haskell
298+
-- Functions from Reflex.Network used to deal with Dynamics/Events carrying (m a)
299+
300+
-- Given a Dynamic of network-creating actions, create a network that is recreated whenever the Dynamic updates.
301+
-- The returned Event of network results occurs when the Dynamic does. Note: Often, the type a is an Event,
302+
-- in which case the return value is an Event-of-Events that would typically be flattened (via switchHold).
303+
[P,A] networkView :: Dynamic (m a) -> m (Event a)
304+
305+
-- Given an initial network and an Event of network-creating actions, create a network that is recreated whenever the
306+
-- Event fires. The returned Dynamic of network results occurs when the Event does. Note: Often, the type a is an
307+
-- Event, in which case the return value is a Dynamic-of-Events that would typically be flattened.
308+
[H,A] networkHold :: m a -> Event (m a) -> m (Dynamic a)
309+
310+
-- Render a placeholder network to be shown while another network is not yet done building
311+
[P,A] untilReady :: m a -> m b -> m (a, Event b)

bench-cbits/checkCapability.c

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ typedef struct Task_ {
4242
// or just continue immediately. It's a workaround for the fact
4343
// that signalling a condition variable doesn't do anything if the
4444
// thread is already running, but we want it to be sticky.
45-
rtsBool wakeup;
45+
HsBool wakeup;
4646
#endif
4747

4848
// This points to the Capability that the Task "belongs" to. If
@@ -62,14 +62,14 @@ typedef struct Task_ {
6262
// The current top-of-stack InCall
6363
struct InCall_ *incall;
6464

65-
nat n_spare_incalls;
65+
uint32_t n_spare_incalls;
6666
struct InCall_ *spare_incalls;
6767

68-
rtsBool worker; // == rtsTrue if this is a worker Task
69-
rtsBool stopped; // this task has stopped or exited Haskell
68+
HsBool worker; // == rtsTrue if this is a worker Task
69+
HsBool stopped; // this task has stopped or exited Haskell
7070

7171
// So that we can detect when a finalizer illegally calls back into Haskell
72-
rtsBool running_finalizers;
72+
HsBool running_finalizers;
7373

7474
// Links tasks on the returning_tasks queue of a Capability, and
7575
// on spare_workers.
@@ -88,7 +88,7 @@ struct Capability_ {
8888
StgFunTable f;
8989
StgRegTable r;
9090

91-
nat no; // capability number.
91+
uint32_t no; // capability number.
9292

9393
// The Task currently holding this Capability. This task has
9494
// exclusive access to the contents of this Capability (apart from
@@ -98,12 +98,12 @@ struct Capability_ {
9898

9999
// true if this Capability is running Haskell code, used for
100100
// catching unsafe call-ins.
101-
rtsBool in_haskell;
101+
HsBool in_haskell;
102102

103103
// Has there been any activity on this Capability since the last GC?
104-
nat idle;
104+
uint32_t idle;
105105

106-
rtsBool disabled;
106+
HsBool disabled;
107107

108108
// The run queue. The Task owning this Capability has exclusive
109109
// access to its run queue, so can wake up threads without
@@ -159,7 +159,7 @@ struct Capability_ {
159159
#if defined(THREADED_RTS)
160160
// Worker Tasks waiting in the wings. Singly-linked.
161161
Task *spare_workers;
162-
nat n_spare_workers; // count of above
162+
uint32_t n_spare_workers; // count of above
163163

164164
// This lock protects:
165165
// running_task
@@ -192,10 +192,9 @@ struct Capability_ {
192192

193193
// Per-capability STM-related data
194194
StgTVarWatchQueue *free_tvar_watch_queues;
195-
StgInvariantCheckQueue *free_invariant_check_queues;
196195
StgTRecChunk *free_trec_chunks;
197196
StgTRecHeader *free_trec_headers;
198-
nat transaction_tokens;
197+
uint32_t transaction_tokens;
199198
} // typedef Capability is defined in RtsAPI.h
200199
// We never want a Capability to overlap a cache line with anything
201200
// else, so round it up to a cache line size:

bench/Main.hs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import qualified Data.Dependent.Map as DMap
2020
import Data.Dependent.Sum
2121
import Data.Functor.Misc
2222
import Data.IORef
23+
import Data.Maybe (fromJust)
2324
import Reflex
2425
import Reflex.Host.Class
2526

@@ -70,7 +71,7 @@ micros =
7071
, withSetupWHNF "fireEventsOnly"
7172
(newEventWithTriggerRef >>= subscribePair)
7273
(\(_, trigger) -> do
73-
Just key <- liftIO $ readIORef trigger
74+
key <- fromJust <$> liftIO (readIORef trigger)
7475
fireEvents [key :=> Identity (42 :: Int)])
7576
, withSetupWHNF "fireEventsAndRead(head/merge1)"
7677
(setupMerge 1 >>= subscribePair)
@@ -84,26 +85,26 @@ micros =
8485
, withSetupWHNF "fireEventsOnly(head/merge100)"
8586
(setupMerge 100 >>= subscribePair)
8687
(\(_, t:_) -> do
87-
Just key <- liftIO $ readIORef t
88+
key <- fromJust <$> liftIO (readIORef t)
8889
fireEvents [key :=> Identity (42 :: Int)])
8990
, withSetupWHNF "hold" newEventWithTriggerRef $ \(ev, _) -> hold (42 :: Int) ev
9091
, withSetupWHNF "sample" (newEventWithTriggerRef >>= hold (42 :: Int) . fst) sample
9192
]
9293

9394
setupMerge :: Int
94-
-> SpiderHost Global ( Event (SpiderEnv Global) (DMap (Const2 Int a) Identity)
95+
-> SpiderHost Global ( Event (SpiderTimeline Global) (DMap (Const2 Int a) Identity)
9596
, [IORef (Maybe (EventTrigger Spider a))]
9697
)
9798
setupMerge num = do
9899
(evs, triggers) <- unzip <$> replicateM num newEventWithTriggerRef
99100
let !m = DMap.fromList [Const2 i :=> v | (i,v) <- zip [0..] evs]
100101
pure (merge m, triggers)
101102

102-
subscribePair :: (Event (SpiderEnv Global) a, b) -> SpiderHost Global (EventHandle (SpiderEnv Global) a, b)
103+
subscribePair :: (Event (SpiderTimeline Global) a, b) -> SpiderHost Global (EventHandle (SpiderTimeline Global) a, b)
103104
subscribePair (ev, b) = (,b) <$> subscribeEvent ev
104105

105-
fireAndRead :: IORef (Maybe (EventTrigger (SpiderEnv Global) a)) -> a -> EventHandle (SpiderEnv Global) b
106+
fireAndRead :: IORef (Maybe (EventTrigger (SpiderTimeline Global) a)) -> a -> EventHandle (SpiderTimeline Global) b
106107
-> SpiderHost Global (Maybe b)
107108
fireAndRead trigger val subd = do
108-
Just key <- liftIO $ readIORef trigger
109+
key <- fromJust <$> liftIO (readIORef trigger)
109110
fireEventsAndRead [key :=> Identity val] $ readEvent subd >>= sequence

bench/RunAll.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ benchmarks = implGroup "spider" runSpiderHost cases
136136
pattern RunTestCaseFlag = "--run-test-case"
137137

138138
spawnBenchmark :: String -> Benchmark
139-
spawnBenchmark name = Benchmark name $ Benchmarkable $ \n -> do
139+
spawnBenchmark name = bench name . toBenchmarkable $ \n -> do
140140
self <- getExecutablePath
141141
callProcess self [RunTestCaseFlag, name, show n, "+RTS", "-N1"]
142142

default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
}:
1212
mkDerivation {
1313
pname = "reflex";
14-
version = "0.5.0";
14+
version = "0.5";
1515
src = builtins.filterSource (path: type: !(builtins.elem (baseNameOf path) [ ".git" "dist" ])) ./.;
1616
libraryHaskellDepends = [
1717
base bifunctors containers dependent-map dependent-sum

hydra.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"enabled": 1,
3+
"hidden": true,
4+
"description": "Jobsets",
5+
"nixexprinput": "src",
6+
"nixexprpath": "jobsets.nix",
7+
"checkinterval": 300,
8+
"schedulingshares": 100,
9+
"enableemail": false,
10+
"emailoverride": "",
11+
"keepnr": 10,
12+
"inputs": {
13+
"src": {
14+
"type": "git",
15+
"value": "https://github.com/reflex-frp/reflex.git develop",
16+
"emailresponsible": false
17+
},
18+
"nixpkgs": {
19+
"type": "git",
20+
"value": "https://github.com/NixOS/nixpkgs-channels nixos-unstable",
21+
"emailresponsible": false
22+
},
23+
"prs": {
24+
"type": "githubpulls",
25+
"value": "reflex-frp reflex",
26+
"emailresponsible": false
27+
}
28+
}
29+
}

jobsets.nix

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{ prs }:
2+
3+
let
4+
pkgs = (import ./reflex-platform.nix {}).nixpkgs;
5+
mkFetchGithub = value: {
6+
inherit value;
7+
type = "git";
8+
emailresponsible = false;
9+
};
10+
in
11+
with pkgs.lib;
12+
let
13+
defaults = jobs: {
14+
inherit (jobs) description;
15+
enabled = 1;
16+
hidden = false;
17+
keepnr = 10;
18+
schedulingshares = 100;
19+
checkinterval = 120;
20+
enableemail = false;
21+
emailoverride = "";
22+
nixexprinput = "reflex";
23+
nixexprpath = "release.nix";
24+
inputs = jobs.inputs // {
25+
nixpkgs = {
26+
type = "git";
27+
value = "https://github.com/NixOS/nixpkgs-channels nixos-unstable";
28+
emailresponsible = false;
29+
};
30+
config = {
31+
type = "nix";
32+
value = "{ android_sdk.accept_license = true; }";
33+
emailresponsible = false;
34+
};
35+
};
36+
};
37+
branchJobset = branch: defaults {
38+
description = "reflex-${branch}";
39+
inputs = {
40+
reflex = {
41+
value = "https://github.com/reflex-frp/reflex ${branch}";
42+
type = "git";
43+
emailresponsible = false;
44+
};
45+
};
46+
};
47+
makePr = num: info: {
48+
name = "reflex-pr-${num}";
49+
value = defaults {
50+
description = "#${num}: ${info.title}";
51+
inputs = {
52+
reflex = {
53+
#NOTE: This should really use "pull/${num}/merge"; however, GitHub's
54+
#status checks only operate on PR heads. This creates a race
55+
#condition, which can currently only be solved by requiring PRs to be
56+
#up to date before they're merged. See
57+
#https://github.com/isaacs/github/issues/1002
58+
value = "https://github.com/reflex-frp/reflex pull/${num}/head";
59+
type = "git";
60+
emailresponsible = false;
61+
};
62+
};
63+
};
64+
};
65+
processedPrs = mapAttrs' makePr (builtins.fromJSON (builtins.readFile prs));
66+
jobsetsAttrs = processedPrs //
67+
genAttrs ["develop"] branchJobset;
68+
in {
69+
jobsets = pkgs.writeText "spec.json" (builtins.toJSON jobsetsAttrs);
70+
}

reflex-platform.nix

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
let
2+
reflex-platform-src = (import <nixpkgs> {}).fetchFromGitHub {
3+
owner = "reflex-frp";
4+
repo = "reflex-platform";
5+
rev = "384cd850f3adf1d404bced2424b5f6efb0f415f2";
6+
sha256 = "1ws77prqx8khmp8j6br1ij4k2v4dlgv170r9fmg0p1jivfbn8y9d";
7+
};
8+
in import reflex-platform-src

0 commit comments

Comments
 (0)