Skip to content

Commit 4eea268

Browse files
committed
Haddock those new instances
1 parent ef72f04 commit 4eea268

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/Reflex/Patch.hs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,13 @@ instance (Ord k, Group q) => Group (MonoidalMap k q) where
5353

5454
instance (Ord k, Additive q) => Additive (MonoidalMap k q)
5555

56+
-- | Trivial group.
5657
instance Group () where
5758
negateG _ = ()
5859
_ ~~ _ = ()
5960
instance Additive ()
6061

62+
-- | Product group. A Pair of groups gives rise to a group
6163
instance (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)
7274
instance Additive (f (g a)) => Additive ((f :.: g) a)
7375

76+
-- | Product of groups, Functor style.
7477
instance (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)
7780
instance (Additive (f a), Additive (g a)) => Additive ((f :*: g) a)
7881

82+
-- | Trivial group, Functor style
7983
instance Group (Proxy x) where
8084
negateG _ = Proxy
8185
_ ~~ _ = Proxy
8286
instance Additive (Proxy x)
8387

88+
-- | Const lifts groups into a functor.
8489
deriving instance Group a => Group (Const a x)
8590
instance Additive a => Additive (Const a x)
91+
-- | Ideitnty lifts groups pointwise (at only one point)
8692
deriving instance Group a => Group (Identity a)
8793
instance Additive a => Additive (Identity a)
8894

95+
-- | Functions lift groups pointwise.
8996
instance Group b => Group (a -> b) where
9097
negateG f = negateG . f
9198
(~~) = liftA2 (~~)

src/Reflex/Query/Class.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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.
5859
instance (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.
6264
instance 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
6670
instance Query Void where
6771
type QueryResult Void = ()
6872
crop = absurd

0 commit comments

Comments
 (0)