formatting 6.1.1 → 6.1.2
raw patch · 2 files changed
+7/−1 lines, 2 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
+ Formatting.Holey: instance Monoid (Format r (a -> r))
Files
- formatting.cabal +1/−1
- src/Formatting/Holey.hs +6/−0
formatting.cabal view
@@ -1,5 +1,5 @@ name: formatting-version: 6.1.1+version: 6.1.2 synopsis: Combinator-based type-safe formatting (like printf() or FORMAT) description: Combinator-based type-safe formatting (like printf() or FORMAT), modelled from the HoleyMonoids package. license: BSD3
src/Formatting/Holey.hs view
@@ -47,6 +47,10 @@ type Holey m r a = HoleyT r a m +instance Monoid (Format r (a -> r)) where+ mappend m n = Holey (\k a -> runHM m (\b1 -> runHM n (\b2 -> k (b1 <> b2)) a) a)+ mempty = Holey (\k a -> k mempty)+ instance Functor (HoleyT r a) where fmap g m = Holey (\k -> runHM m (k . g)) @@ -57,11 +61,13 @@ -- | Composition operator. The same as category composition. (%) :: Format b c -> Format r b -> Format r c f % g = f `bind` \a -> g `bind` \b -> now (a `mappend` b)+infixr 9 % -- | Function compose two holeys. Will feed the result of one holey -- into another. (%.) :: Format r (Builder -> b) -> Format b c -> Format r c (%.) (Holey a) (Holey b) = Holey (b . a)+infixr 8 %. -- | Insert a constant monoidal value. now :: Builder -> Format r r