diff options
author | tv <tv@krebsco.de> | 2019-01-18 13:56:31 +0100 |
---|---|---|
committer | tv <tv@krebsco.de> | 2019-01-18 13:56:31 +0100 |
commit | b160288682bea77c03ef245e6fdaba6244c64f34 (patch) | |
tree | bb609b0667b043cca02900e9f10d9a46111aafcd | |
parent | 99a76f167ac7f7814284ec592ff28152b1c85acf (diff) |
Blessings: add Foldable instancev1.3.0
-rw-r--r-- | src/Blessings.hs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Blessings.hs b/src/Blessings.hs index 3c6b94f..21fe3d8 100644 --- a/src/Blessings.hs +++ b/src/Blessings.hs @@ -20,6 +20,14 @@ data Blessings a deriving (Eq, Show) +instance Foldable Blessings where + foldMap f = \case + Append t1 t2 -> foldMap f t1 <> foldMap f t2 + Plain s -> f s + SGR _ t -> foldMap f t + Empty -> mempty + + instance Functor Blessings where fmap f = \case Append t1 t2 -> Append (fmap f t1) (fmap f t2) |