on develop help sign in
Get rid of experimental-dependent-sum-instances
66d4b18Ryan Trinkle
reflex.cabal−8
@@ -38,11 +38,6 @@ flag debug-trace-events
38 default: False
38 default: False
39 manual: True
39 manual: True
40
40
41−flag experimental-dependent-sum-instances
42− description: Use experimental incoherent instances for certain forked dependent-sum typeclasses
43− default: False
44− manual: True
45−
46flag fast-weak
41flag fast-weak
47 description: Use the primitive implementation of FastWeak in GHCJS; note that this requires GHCJS to be built with FastWeak and FastWeakBag present in the RTS, which is not the default
42 description: Use the primitive implementation of FastWeak in GHCJS; note that this requires GHCJS to be built with FastWeak and FastWeakBag present in the RTS, which is not the default
48 default: False
43 default: False
@@ -158,9 +153,6 @@ library
158 if flag(expose-all-unfoldings)
153 if flag(expose-all-unfoldings)
159 ghc-options: -fexpose-all-unfoldings
154 ghc-options: -fexpose-all-unfoldings
160
155
161− if flag(experimental-dependent-sum-instances)
162− ghc-options: -DEXPERIMENTAL_DEPENDENT_SUM_INSTANCES
163−
164 if flag(fast-weak) && impl(ghcjs)
156 if flag(fast-weak) && impl(ghcjs)
165 ghc-options: -DGHCJS_FAST_WEAK
157 ghc-options: -DGHCJS_FAST_WEAK
166
158
src/Data/Functor/Misc.hs−72
@@ -84,48 +84,22 @@ deriving instance Show k => Show (Const2 k v v')
84deriving instance Read k => Read (Const2 k v v)
84deriving instance Read k => Read (Const2 k v v)
85
85
86instance Show k => GShow (Const2 k v) where
86instance Show k => GShow (Const2 k v) where
87−#ifdef EXPERIMENTAL_DEPENDENT_SUM_INSTANCES
88− gshowToShow (Const2 _) = id
89−#else
90 gshowsPrec n x@(Const2 _) = showsPrec n x
87 gshowsPrec n x@(Const2 _) = showsPrec n x
91−#endif
92
88
93instance (Show k, Show (f v)) => ShowTag (Const2 k v) f where
89instance (Show k, Show (f v)) => ShowTag (Const2 k v) f where
94−#ifdef EXPERIMENTAL_DEPENDENT_SUM_INSTANCES
95− showTagToShow (Const2 _) _ = id
96−#else
97 showTaggedPrec (Const2 _) = showsPrec
90 showTaggedPrec (Const2 _) = showsPrec
98−#endif
99
91
100instance Eq k => GEq (Const2 k v) where
92instance Eq k => GEq (Const2 k v) where
101−#ifdef EXPERIMENTAL_DEPENDENT_SUM_INSTANCES
102− geqToEq _ = id
103− geqUnify (Const2 _) (Const2 _) _ = id
104−#else
105 geq (Const2 a) (Const2 b) =
93 geq (Const2 a) (Const2 b) =
106 if a == b
94 if a == b
107 then Just Refl
95 then Just Refl
108 else Nothing
96 else Nothing
109−#endif
110
97
111instance Ord k => GCompare (Const2 k v) where
98instance Ord k => GCompare (Const2 k v) where
112−#ifdef EXPERIMENTAL_DEPENDENT_SUM_INSTANCES
113− gcompareToOrd (Const2 _) = id
114− gcompare (Const2 a) (Const2 b) = strengthenOrdering $ compare a b
115−#else
116 gcompare (Const2 a) (Const2 b) = case compare a b of
99 gcompare (Const2 a) (Const2 b) = case compare a b of
117 LT -> GLT
100 LT -> GLT
118 EQ -> GEQ
101 EQ -> GEQ
119 GT -> GGT
102 GT -> GGT
120−#endif
121−
122−#ifdef EXPERIMENTAL_DEPENDENT_SUM_INSTANCES
123−instance {-# INCOHERENT #-} (Eq k, Eq v) => EqTag (Const2 k v) Identity where
124− eqTagToEq (Const2 _) _ = id
125−
126−instance {-# INCOHERENT #-} Eq k => EqTag (Const2 k v) (Const2 k v) where
127− eqTagToEq (Const2 _) _ = id
128−#endif
129
103
130-- | Convert a 'DMap' to a regular 'Map'
104-- | Convert a 'DMap' to a regular 'Map'
131dmapToMap :: DMap (Const2 k v) Identity -> Map k v
105dmapToMap :: DMap (Const2 k v) Identity -> Map k v
@@ -175,17 +149,9 @@ deriving instance Show (f a) => Show (WrapArg g f (g' a))
175deriving instance Read (f a) => Read (WrapArg g f (g a))
149deriving instance Read (f a) => Read (WrapArg g f (g a))
176
150
177instance GEq f => GEq (WrapArg g f) where
151instance GEq f => GEq (WrapArg g f) where
178−#ifdef EXPERIMENTAL_DEPENDENT_SUM_INSTANCES
179− geqToEq (WrapArg f) = geqToEq f
180− geqUnify (WrapArg a) (WrapArg b) = geqUnify a b
181−#else
182 geq (WrapArg a) (WrapArg b) = (\Refl -> Refl) <$> geq a b
152 geq (WrapArg a) (WrapArg b) = (\Refl -> Refl) <$> geq a b
183−#endif
184
153
185instance GCompare f => GCompare (WrapArg g f) where
154instance GCompare f => GCompare (WrapArg g f) where
186−#ifdef EXPERIMENTAL_DEPENDENT_SUM_INSTANCES
187− gcompareToOrd (WrapArg f) = gcompareToOrd f
188−#endif
189 gcompare (WrapArg a) (WrapArg b) = case gcompare a b of
155 gcompare (WrapArg a) (WrapArg b) = case gcompare a b of
190 GLT -> GLT
156 GLT -> GLT
191 GEQ -> GEQ
157 GEQ -> GEQ
@@ -237,34 +203,13 @@ deriving instance Show (EitherTag l r a)
237deriving instance Eq (EitherTag l r a)
203deriving instance Eq (EitherTag l r a)
238deriving instance Ord (EitherTag l r a)
204deriving instance Ord (EitherTag l r a)
239
205
240−#ifdef EXPERIMENTAL_DEPENDENT_SUM_INSTANCES
241−instance {-# INCOHERENT #-} (Show (f l), Show (f r)) => ShowTag (EitherTag l r) f where
242− showTagToShow e _ = case e of
243− LeftTag -> id
244− RightTag -> id
245−
246−instance {-# INCOHERENT #-} (Eq (f l), Eq (f r)) => EqTag (EitherTag l r) f where
247− eqTagToEq e _ = case e of
248− LeftTag -> id
249− RightTag -> id
250−#endif
251−
252instance GEq (EitherTag l r) where
206instance GEq (EitherTag l r) where
253−#ifdef EXPERIMENTAL_DEPENDENT_SUM_INSTANCES
254− geqToEq _ = id
255− geqUnify LeftTag LeftTag _ same = same
256− geqUnify RightTag RightTag _ same = same
257− geqUnify _ _ unknown _ = unknown
258−#endif
259 geq a b = case (a, b) of
207 geq a b = case (a, b) of
260 (LeftTag, LeftTag) -> Just Refl
208 (LeftTag, LeftTag) -> Just Refl
261 (RightTag, RightTag) -> Just Refl
209 (RightTag, RightTag) -> Just Refl
262 _ -> Nothing
210 _ -> Nothing
263
211
264instance GCompare (EitherTag l r) where
212instance GCompare (EitherTag l r) where
265−#ifdef EXPERIMENTAL_DEPENDENT_SUM_INSTANCES
266− gcompareToOrd _ = id
267−#endif
268 gcompare a b = case (a, b) of
213 gcompare a b = case (a, b) of
269 (LeftTag, LeftTag) -> GEQ
214 (LeftTag, LeftTag) -> GEQ
270 (LeftTag, RightTag) -> GLT
215 (LeftTag, RightTag) -> GLT
@@ -272,24 +217,14 @@ instance GCompare (EitherTag l r) where
272 (RightTag, RightTag) -> GEQ
217 (RightTag, RightTag) -> GEQ
273
218
274instance GShow (EitherTag l r) where
219instance GShow (EitherTag l r) where
275−#ifdef EXPERIMENTAL_DEPENDENT_SUM_INSTANCES
276− gshowToShow _ = id
277−#else
278 gshowsPrec _ a = case a of
220 gshowsPrec _ a = case a of
279 LeftTag -> showString "LeftTag"
221 LeftTag -> showString "LeftTag"
280 RightTag -> showString "RightTag"
222 RightTag -> showString "RightTag"
281−#endif
282
223
283instance (Show l, Show r) => ShowTag (EitherTag l r) Identity where
224instance (Show l, Show r) => ShowTag (EitherTag l r) Identity where
284−#ifdef EXPERIMENTAL_DEPENDENT_SUM_INSTANCES
285− showTagToShow t _ = case t of
286− LeftTag -> id
287− RightTag -> id
288−#else
289 showTaggedPrec t n (Identity a) = case t of
225 showTaggedPrec t n (Identity a) = case t of
290 LeftTag -> showsPrec n a
226 LeftTag -> showsPrec n a
291 RightTag -> showsPrec n a
227 RightTag -> showsPrec n a
292−#endif
293
228
294-- | Convert 'Either' to a 'DSum'. Inverse of 'dsumToEither'.
229-- | Convert 'Either' to a 'DSum'. Inverse of 'dsumToEither'.
295eitherToDSum :: Either a b -> DSum (EitherTag a b) Identity
230eitherToDSum :: Either a b -> DSum (EitherTag a b) Identity
@@ -319,13 +254,6 @@ newtype ComposeMaybe (f :: * -> *) (a :: *) =
319
254
320deriving instance Functor f => Functor (ComposeMaybe f)
255deriving instance Functor f => Functor (ComposeMaybe f)
321
256
322−#ifdef EXPERIMENTAL_DEPENDENT_SUM_INSTANCES
323−instance {-# INCOHERENT #-} EqTag f g => EqTag f (ComposeMaybe g) where
324− eqTagToEq f _ = eqTagToEq f (Proxy :: Proxy g)
325−
326−instance {-# INCOHERENT #-} GShow k => ShowTag k (ComposeMaybe k) where
327− showTagToShow k _ r = gshowToShow k (showTagToShow k (Proxy :: Proxy k) r)
328−#endif
329--------------------------------------------------------------------------------
257--------------------------------------------------------------------------------
330-- Deprecated functions
258-- Deprecated functions
331--------------------------------------------------------------------------------
259--------------------------------------------------------------------------------
src/Reflex/Dynamic.hs−9
@@ -428,21 +428,12 @@ data FHList f l where
428 FHCons :: f e -> FHList f l -> FHList f (e ': l)
428 FHCons :: f e -> FHList f l -> FHList f (e ': l)
429
429
430instance GEq (HListPtr l) where
430instance GEq (HListPtr l) where
431−#ifdef EXPERIMENTAL_DEPENDENT_SUM_INSTANCES
432− geqToEq _ = id
433− geqUnify HHeadPtr HHeadPtr _ same = same
434− geqUnify (HTailPtr a) (HTailPtr b) different same = geqUnify a b different same
435− geqUnify _ _ different _ = different
436−#endif
437 HHeadPtr `geq` HHeadPtr = Just Refl
431 HHeadPtr `geq` HHeadPtr = Just Refl
438 HHeadPtr `geq` HTailPtr _ = Nothing
432 HHeadPtr `geq` HTailPtr _ = Nothing
439 HTailPtr _ `geq` HHeadPtr = Nothing
433 HTailPtr _ `geq` HHeadPtr = Nothing
440 HTailPtr a `geq` HTailPtr b = a `geq` b
434 HTailPtr a `geq` HTailPtr b = a `geq` b
441
435
442instance GCompare (HListPtr l) where -- Warning: This ordering can't change, dmapTo*HList will break
436instance GCompare (HListPtr l) where -- Warning: This ordering can't change, dmapTo*HList will break
443−#ifdef EXPERIMENTAL_DEPENDENT_SUM_INSTANCES
444− gcompareToOrd _ = id
445−#endif
446 HHeadPtr `gcompare` HHeadPtr = GEQ
437 HHeadPtr `gcompare` HHeadPtr = GEQ
447 HHeadPtr `gcompare` HTailPtr _ = GLT
438 HHeadPtr `gcompare` HTailPtr _ = GLT
448 HTailPtr _ `gcompare` HHeadPtr = GGT
439 HTailPtr _ `gcompare` HHeadPtr = GGT
src/Reflex/Patch/DMapWithMove.hs−17
@@ -34,12 +34,6 @@ import Data.Some (Some)
34import qualified Data.Some as Some
34import qualified Data.Some as Some
35import Data.These
35import Data.These
36
36
37−#ifdef EXPERIMENTAL_DEPENDENT_SUM_INSTANCES
38−import Data.Dependent.Sum (ShowTag (..))
39−import Data.GADT.Show (GShow (..))
40−import Data.Typeable (Proxy (..))
41−#endif
42−
43-- | Like 'PatchMapWithMove', but for 'DMap'. Each key carries a 'NodeInfo' which describes how it will be changed by the patch and connects move sources and
37-- | Like 'PatchMapWithMove', but for 'DMap'. Each key carries a 'NodeInfo' which describes how it will be changed by the patch and connects move sources and
44-- destinations.
38-- destinations.
45--
39--
@@ -48,9 +42,6 @@ import Data.Typeable (Proxy (..))
48-- * A key should not move to itself.
42-- * A key should not move to itself.
49-- * A move should always be represented with both the destination key (as a 'From_Move') and the source key (as a @'ComposeMaybe' ('Just' destination)@)
43-- * A move should always be represented with both the destination key (as a 'From_Move') and the source key (as a @'ComposeMaybe' ('Just' destination)@)
50newtype PatchDMapWithMove k v = PatchDMapWithMove (DMap k (NodeInfo k v))
44newtype PatchDMapWithMove k v = PatchDMapWithMove (DMap k (NodeInfo k v))
51−#ifdef EXPERIMENTAL_DEPENDENT_SUM_INSTANCES
52− deriving (Show)
53−#endif
54
45
55-- |Structure which represents what changes apply to a particular key. @_nodeInfo_from@ specifies what happens to this key, and in particular what other key
46-- |Structure which represents what changes apply to a particular key. @_nodeInfo_from@ specifies what happens to this key, and in particular what other key
56-- the current key is moving from, while @_nodeInfo_to@ specifies what key the current key is moving to if involved in a move.
47-- the current key is moving from, while @_nodeInfo_to@ specifies what key the current key is moving to if involved in a move.
@@ -62,14 +53,6 @@ data NodeInfo k v a = NodeInfo
62 }
53 }
63 deriving (Show)
54 deriving (Show)
64
55
65−#ifdef EXPERIMENTAL_DEPENDENT_SUM_INSTANCES
66−instance {-# INCOHERENT #-} (GShow k, ShowTag k v) => ShowTag k (NodeInfo k v) where
67− showTagToShow k _ r = gshowToShow k $ showTagToShow k (Proxy :: Proxy v) r
68−
69−instance {-# INCOHERENT #-} (GEq k, EqTag k v) => EqTag k (From k v) where
70− eqTagToEq k _ r = eqTagToEq k (Proxy :: Proxy v) (geqToEq k r)
71−#endif
72−
73-- |Structure describing a particular change to a key, be it inserting a new key (@From_Insert@), updating an existing key (@From_Insert@ again), deleting a
56-- |Structure describing a particular change to a key, be it inserting a new key (@From_Insert@), updating an existing key (@From_Insert@ again), deleting a
74-- key (@From_Delete@), or moving a key (@From_Move@).
57-- key (@From_Delete@), or moving a key (@From_Move@).
75data From (k :: a -> *) (v :: a -> *) :: a -> * where
58data From (k :: a -> *) (v :: a -> *) :: a -> * where
src/Reflex/Spider/Internal.hs−8
@@ -784,17 +784,9 @@ instance Eq (SpiderTimelineEnv x) where
784 _ == _ = True -- Since only one exists of each type
784 _ == _ = True -- Since only one exists of each type
785
785
786instance GEq SpiderTimelineEnv where
786instance GEq SpiderTimelineEnv where
787−#ifdef EXPERIMENTAL_DEPENDENT_SUM_INSTANCES
788− geqToEq _ = id
789− geqUnify (a :: SpiderTimelineEnv a) (b :: SpiderTimelineEnv b) different same = if _spiderTimeline_lock a == _spiderTimeline_lock b
790− then case unsafeCoerce Refl :: a :~: b of
791− Refl -> same -- This unsafeCoerce is safe because the same SpiderTimelineEnv can't have two different 'x' arguments
792− else different
793−#else
794 a `geq` b = if _spiderTimeline_lock a == _spiderTimeline_lock b
787 a `geq` b = if _spiderTimeline_lock a == _spiderTimeline_lock b
795 then Just $ unsafeCoerce Refl -- This unsafeCoerce is safe because the same SpiderTimelineEnv can't have two different 'x' arguments
788 then Just $ unsafeCoerce Refl -- This unsafeCoerce is safe because the same SpiderTimelineEnv can't have two different 'x' arguments
796 else Nothing
789 else Nothing
797−#endif
798
790
799data EventEnv x
791data EventEnv x
800 = EventEnv { eventEnvAssignments :: !(IORef [SomeAssignment x]) -- Needed for Subscribe
792 = EventEnv { eventEnvAssignments :: !(IORef [SomeAssignment x]) -- Needed for Subscribe