Skip to content

Commit f95fa10

Browse files
authored
Merge pull request #487 from alexfmpe/sortable-list
Fix build of sortableList example
2 parents 1e93dcd + dda0926 commit f95fa10

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

cabal.project

+3
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ packages:
66

77
tests: True
88
benchmarks: True
9+
10+
package reflex-dom
11+
flags: +build-examples

cabal.project-nogtk

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ package reflex-dom-core
66
flags: -hlint-tests -hydration-tests -gc-tests
77

88
package reflex-dom
9-
flags: +use-warp -webkit2gtk
9+
flags: +use-warp -webkit2gtk +build-examples

reflex-dom/examples/sortableList.hs

+3-6
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,13 @@
55
{-# LANGUAGE RecursiveDo #-}
66
{-# LANGUAGE ScopedTypeVariables #-}
77
import Control.Lens
8-
import Control.Monad.Identity
8+
import Control.Monad.Fix
99
import Control.Monad.IO.Class
10-
import Data.Dependent.Map (DMap)
11-
import Data.Functor.Constant
12-
import Data.Functor.Misc
1310
import Data.List
1411
import Data.Map (Map)
1512
import qualified Data.Map as Map
16-
import Data.Monoid
1713
import Data.Ord
14+
import Data.Patch.MapWithMove
1815
import qualified Data.Text as T
1916
import Data.Time.Clock
2017
import Reflex.Dom
@@ -71,7 +68,7 @@ simpleSortableList :: forall t m k v. (MonadHold t m, MonadFix m, Adjustable t m
7168
simpleSortableList f m0 resortFunc resortSlowFunc = do
7269
rec let resortPatchFast = attachWith (flip patchThatSortsMapWith) (currentIncremental m) resortFunc
7370
redrawPatch :: Map k v -> (v -> v -> Ordering) -> PatchMapWithMove k v
74-
redrawPatch d cmp = unsafePatchMapWithMove $ fmap (MapEdit_Insert False) $ Map.fromList $ zip (Map.keys d) (sortBy cmp $ Map.elems d)
71+
redrawPatch d cmp = patchMapWithMoveInsertAll $ Map.fromList $ zip (Map.keys d) (sortBy cmp $ Map.elems d)
7572
resortPatchSlow = attachWith redrawPatch (currentIncremental m) resortSlowFunc
7673
resortPatch = leftmost
7774
[ resortPatchFast

reflex-dom/reflex-dom.cabal

+1
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ executable sortableList
142142
, dependent-map
143143
, lens
144144
, mtl
145+
, patch
145146
, random
146147
, reflex
147148
, reflex-dom

0 commit comments

Comments
 (0)