on develop help sign in
remove some useless editorializing.
6bf1fa0dan bornside
src/Reflex/Patch.hs+2−1
@@ -64,7 +64,8 @@ instance (Group a, Group b) => Group (a, b) where
64instance (Additive a, Additive b) => Additive (a, b)
64instance (Additive a, Additive b) => Additive (a, b)
65
65
66-- See https://gitlab.haskell.org/ghc/ghc/issues/11135#note_111802 for the reason Compose is not also provided.
66-- See https://gitlab.haskell.org/ghc/ghc/issues/11135#note_111802 for the reason Compose is not also provided.
67−-- Base does not define Monoid (Compose f g a) so this has no "home"
67+-- Base does not define Monoid (Compose f g a) so this is the best we can
68+-- really do for functor composition.
68instance Group (f (g a)) => Group ((f :.: g) a) where
69instance Group (f (g a)) => Group ((f :.: g) a) where
69 negateG (Comp1 xs) = Comp1 (negateG xs)
70 negateG (Comp1 xs) = Comp1 (negateG xs)
70 Comp1 xs ~~ Comp1 ys = Comp1 (xs ~~ ys)
71 Comp1 xs ~~ Comp1 ys = Comp1 (xs ~~ ys)
src/Reflex/Query/Class.hs+1−3
@@ -55,12 +55,10 @@ instance (Ord k, Query v) => Query (MonoidalMap k v) where
55 type QueryResult (MonoidalMap k v) = MonoidalMap k (QueryResult v)
55 type QueryResult (MonoidalMap k v) = MonoidalMap k (QueryResult v)
56 crop q r = MonoidalMap.intersectionWith (flip crop) r q
56 crop q r = MonoidalMap.intersectionWith (flip crop) r q
57
57
58−-- asking two questions is the same as asking both questions.
59instance (Query a, Query b) => Query (a, b) where
58instance (Query a, Query b) => Query (a, b) where
60 type QueryResult (a, b) = (QueryResult a, QueryResult b)
59 type QueryResult (a, b) = (QueryResult a, QueryResult b)
61 crop (x, x') (y, y') = (crop x y, crop x' y')
60 crop (x, x') (y, y') = (crop x y, crop x' y')
62
61
63−-- ¯\_(゚ヮ゚)_/¯ ¯\_(ツ)_/¯
64instance Query () where
62instance Query () where
65 type QueryResult () = ()
63 type QueryResult () = ()
66 crop _ _ = ()
64 crop _ _ = ()
@@ -143,7 +141,7 @@ queryDyn q = do
143 tellQueryDyn q
141 tellQueryDyn q
144 zipDynWith crop q <$> askQueryResult
142 zipDynWith crop q <$> askQueryResult
145
143
146−-- | We can already say this in reflex
144+-- | use a query morphism to operate on a smaller version of a query.
147subQuery :: (Reflex t, MonadQuery t q2 m, Monad m) => QueryMorphism q1 q2 -> Dynamic t q1 -> m (Dynamic t (QueryResult q1))
145subQuery :: (Reflex t, MonadQuery t q2 m, Monad m) => QueryMorphism q1 q2 -> Dynamic t q1 -> m (Dynamic t (QueryResult q1))
148subQuery (QueryMorphism f g) x = fmap g <$> queryDyn (fmap f x)
146subQuery (QueryMorphism f g) x = fmap g <$> queryDyn (fmap f x)
149
147