on develop help sign in
Haddock those new instances
commit4eea26897466799fde89680ff24260da8b399a91 authorDan Bornside <dan.bornside@obsidian.systems> dateTue 10 Dec 2019, 16:57 (7 years ago) parentef72f04
2 files changed+11
src/Reflex/Patch.hs+7 src/Reflex/Query/Class.hs+4
src/Reflex/Patch.hs+7
@@ -53,11 +53,13 @@ instance (Ord k, Group q) => Group (MonoidalMap k q) where
5353
5454instance (Ord k, Additive q) => Additive (MonoidalMap k q)
5555
56+-- | Trivial group.
5657instance Group () where
5758 negateG _ = ()
5859 _ ~~ _ = ()
5960instance Additive ()
6061
62+-- | Product group. A Pair of groups gives rise to a group
6163instance (Group a, Group b) => Group (a, b) where
6264 negateG (a, b) = (negateG a, negateG b)
6365 (a, b) ~~ (c, d) = (a ~~ c, b ~~ d)
@@ -71,21 +73,26 @@ instance Group (f (g a)) => Group ((f :.: g) a) where
7173 Comp1 xs ~~ Comp1 ys = Comp1 (xs ~~ ys)
7274instance Additive (f (g a)) => Additive ((f :.: g) a)
7375
76+-- | Product of groups, Functor style.
7477instance (Group (f a), Group (g a)) => Group ((f :*: g) a) where
7578 negateG (a :*: b) = negateG a :*: negateG b
7679 (a :*: b) ~~ (c :*: d) = (a ~~ c :*: b ~~ d)
7780instance (Additive (f a), Additive (g a)) => Additive ((f :*: g) a)
7881
82+-- | Trivial group, Functor style
7983instance Group (Proxy x) where
8084 negateG _ = Proxy
8185 _ ~~ _ = Proxy
8286instance Additive (Proxy x)
8387
88+-- | Const lifts groups into a functor.
8489deriving instance Group a => Group (Const a x)
8590instance Additive a => Additive (Const a x)
91+-- | Ideitnty lifts groups pointwise (at only one point)
8692deriving instance Group a => Group (Identity a)
8793instance Additive a => Additive (Identity a)
8894
95+-- | Functions lift groups pointwise.
8996instance Group b => Group (a -> b) where
9097 negateG f = negateG . f
9198 (~~) = liftA2 (~~)
src/Reflex/Query/Class.hs+4
@@ -55,14 +55,18 @@ instance (Ord k, Query v) => Query (MonoidalMap k v) where
5555 type QueryResult (MonoidalMap k v) = MonoidalMap k (QueryResult v)
5656 crop q r = MonoidalMap.intersectionWith (flip crop) r q
5757
58+-- | the result of two queries is both results.
5859instance (Query a, Query b) => Query (a, b) where
5960 type QueryResult (a, b) = (QueryResult a, QueryResult b)
6061 crop (x, x') (y, y') = (crop x y, crop x' y')
6162
63+-- | Trivial queries have trivial results.
6264instance Query () where
6365 type QueryResult () = ()
6466 crop _ _ = ()
6567
68+-- | The result of an absurd query is trivial; If you can ask the question, the
69+-- answer cannot tell you anything you didn't already know
6670instance Query Void where
6771 type QueryResult Void = ()
6872 crop = absurd