Add unwords and unlines.
authorJulien Moutinho <julm+symantic@autogeree.net>
Sat, 31 Mar 2018 03:45:05 +0000 (05:45 +0200)
committerJulien Moutinho <julm+symantic@autogeree.net>
Sat, 31 Mar 2018 16:02:22 +0000 (18:02 +0200)
symantic-document/Language/Symantic/Document/Sym.hs
symantic-document/symantic-document.cabal

index b8c4970c71a0b35b4ec2ab3e9488d6a2a4e9fa60..dd004c38b509db8ffbf549eafa780213b53f4fc6 100644 (file)
@@ -87,6 +87,8 @@ class (IsString d, Semigroup d) => Textable d where
        ltext       :: TL.Text -> d
        catH        :: Foldable f => f d -> d
        catV        :: Foldable f => f d -> d
+       unwords     :: Foldable f => f d -> d
+       unlines     :: Foldable f => f d -> d
        foldrWith   :: Foldable f => (d -> d -> d) -> f d -> d
        foldWith    :: Foldable f => (d -> d) -> f d -> d
        intercalate :: Foldable f => d -> f d -> d
@@ -105,6 +107,8 @@ class (IsString d, Semigroup d) => Textable d where
        ltext   = catV . fmap ltextH  . TL.lines
        catH    = foldr (<>) empty
        catV    = foldrWith (\x y -> x<>newline<>y)
+       unwords = foldr (<>) space
+       unlines = foldr (\x y -> x<>newline<>y) empty
        foldrWith f ds  = if null ds then empty else foldr1 f ds
        foldWith  f     = foldrWith $ \a acc -> a <> f acc
        intercalate sep = foldrWith (\x y -> x<>sep<>y)
index 1f3abd290383aa1f712872a377e07916d3384ed5..162fc4d43b5f6355f37f96943a70462890b711e8 100644 (file)
@@ -2,7 +2,7 @@ name: symantic-document
 -- PVP:  +-+------- breaking API changes
 --       | | +----- non-breaking API additions
 --       | | | +--- code changes with no API change
-version: 0.1.0.20180208
+version: 0.1.1.20180331
 category: Text
 synopsis: Document symantics.
 description: Symantics for generating documents.