Skip to content

Commit

Permalink
Merge pull request #330 from saulzar/cleanup-debug
Browse files Browse the repository at this point in the history
Add debug flag, make reflex compile with DEBUG set
  • Loading branch information
Ericson2314 authored Jan 17, 2020
2 parents 4f13ad4 + 01ddb99 commit cf9a8dd
Show file tree
Hide file tree
Showing 8 changed files with 650 additions and 249 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ script:
- if $GHCJS || ! $GHCJS && [ $HCNUMVER -lt 80800 ] ; then ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --constraint='these <1' all | color_cabal_output ; fi
# Constraint set old-witherable
- ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --constraint='witherable <0.3.2' all | color_cabal_output
# Constraint set debug-propagation
- ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --constraint='reflex +debug-propagation' all | color_cabal_output
# Constraint set debug-cycles
- ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --constraint='reflex +debug-cycles' all | color_cabal_output

# REGENDATA ["--config=cabal.haskell-ci","cabal.project"]
# EOF
3 changes: 3 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

* Additional instances for `Query` classes for basic types.

* Add cabal flags `debug-propagation` and `debug-event-cycles` to build in debugging
code for performance and for cyclic dependencies between events

## 0.6.3

* `Data.WeakBag.traverse` and `Data.FastWeakBag.traverse` have been deprecated.
Expand Down
6 changes: 6 additions & 0 deletions cabal.haskell-ci
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,9 @@ constraint-set old-these

constraint-set old-witherable
constraints: witherable <0.3.2

constraint-set debug-propagation
constraints: reflex +debug-propagation

constraint-set debug-cycles
constraints: reflex +debug-cycles
49 changes: 45 additions & 4 deletions reflex.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ flag fast-weak
default: False
manual: True

flag debug-propagation
description: Enable debugging of spider internals
default: False
manual: True

flag debug-cycles
description: Enable debugging of event cycles
default: False
manual: True

flag split-these
description: Use split these/semialign packages
manual: False
Expand Down Expand Up @@ -150,6 +160,12 @@ library
build-depends: ghc
exposed-modules: Reflex.Optimizer

if flag(debug-propagation)
cpp-options: -DDEBUG -DDEBUG_TRACE_PROPAGATION -DDEBUG_TRACE_INVALIDATION

if flag(debug-cycles)
cpp-options: -DDEBUG_CYCLES

if flag(use-template-haskell)
cpp-options: -DUSE_TEMPLATE_HASKELL
build-depends:
Expand Down Expand Up @@ -252,10 +268,35 @@ test-suite EventWriterT
build-depends: these-lens

other-modules:
Reflex.Test
Reflex.TestPlan
Reflex.Plan.Reflex
Reflex.Plan.Pure
Test.Run


test-suite DebugCycles
default-language: Haskell2010
type: exitcode-stdio-1.0
main-is: DebugCycles.hs
hs-source-dirs: test
ghc-options: -threaded
build-depends: base
, containers
, deepseq
, dependent-map
, dependent-sum
, hspec
, lens
, mtl
, these
, transformers
, reflex
, ref-tf
, witherable
, proctest


if flag(split-these)
build-depends: these-lens, semialign

other-modules:
Test.Run


Expand Down
4 changes: 4 additions & 0 deletions src/Data/FastMutableIntMap.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ module Data.FastMutableIntMap
, patchIntMapNewElements
, patchIntMapNewElementsMap
, getDeletions
, toList
) where

--TODO: Pure JS version
Expand Down Expand Up @@ -91,3 +92,6 @@ applyPatch (FastMutableIntMap r) p@(PatchIntMap m) = do
v <- readIORef r
writeIORef r $! applyAlways p v
return $ IntMap.intersection v m

toList :: FastMutableIntMap a -> IO [(Int, a)]
toList (FastMutableIntMap r) = IntMap.toList <$> readIORef r
Loading

0 comments on commit cf9a8dd

Please sign in to comment.