scc 0.8.2.4 → 0.8.3
raw patch · 5 files changed
+60/−19 lines, 5 filesdep ~incremental-parserdep ~monoid-subclasses
Dependency ranges changed: incremental-parser, monoid-subclasses
Files
- Control/Concurrent/SCC/Primitives.hs +1/−1
- Control/Concurrent/SCC/XML.hs +10/−7
- README.md +38/−0
- Shell.hs +2/−2
- scc.cabal +9/−9
Control/Concurrent/SCC/Primitives.hs view
@@ -63,7 +63,7 @@ import Data.Text.IO (getLine, hGetLine, hPutStr, putStr) import Data.Monoid.Null (MonoidNull(null))-import Data.Monoid.Cancellative (LeftReductiveMonoid (stripPrefix))+import Data.Monoid.Cancellative (LeftReductiveMonoid, stripPrefix) import Data.Monoid.Factorial (FactorialMonoid(splitPrimePrefix), length) import Text.ParserCombinators.Incremental (string, takeWhile, (<<|>))
Control/Concurrent/SCC/XML.hs view
@@ -76,15 +76,18 @@ newtype XMLStream = XMLStream {chunk :: [Markup XMLToken Text]} deriving (Show) -instance Monoid XMLStream where- mempty = XMLStream []- l `mappend` XMLStream [] = l- XMLStream [] `mappend` r = r- XMLStream l `mappend` XMLStream r@((Content rc):rt) =+instance Semigroup XMLStream where+ l <> XMLStream [] = l+ XMLStream [] <> r = r+ XMLStream l <> XMLStream r@((Content rc):rt) = case last l- of Content lc -> XMLStream (init l ++ Content (mappend lc rc) : rt)+ of Content lc -> XMLStream (init l ++ Content (lc <> rc) : rt) _ -> XMLStream (l ++ r)- XMLStream l `mappend` XMLStream r = XMLStream (l ++ r)+ XMLStream l <> XMLStream r = XMLStream (l ++ r)++instance Monoid XMLStream where+ mempty = XMLStream []+ mappend = (<>) xmlParser :: LeftBiasedLocal.Parser Text XMLStream xmlParser = concatMany (xmlContent <|> xmlMarkup)
+ README.md view
@@ -0,0 +1,38 @@++## Installation++If you have Cabal-Install installed, the following two commands should install the latest SCC package on your system:++ cabal update+ cabal install scc++If everything goes well, there should be executable named `shsh`. On Unix it gets installed in your `$HOME/.cabal/bin/` directory by default.++## Command-line Shell++To see the options supported by _shsh_, type `shsh --help` and you'll get:++ Usage: shsh (-c <command> | -f <file> | -i | -s) + -c --command Execute a single command+ -h --help Show help+ -f file --file=file Execute commands from a script file+ -i --interactive Execute commands interactively+ -s --stdin Execute commands from the standard input++Here are a few simple command examples:++<table>+<tr><th> Bash + GNU tools</th><th>shsh</th></tr>+<tr><td>`echo "Hello, World!"`</td><td>`echo "Hello, World!\n"`</td></tr>+<tr><td>`wc -c`</td><td>`count | show | concatenate`</td></tr>+<tr><td>`wc -l`</td><td>`foreach line then substitute x else suppress end | count | show | concatenate`</td></tr>+<tr><td>`grep "foo"`</td><td>`foreach line having substring "foo" then append "\n" else suppress end`</td></tr>+<tr><td>`sed "s:foo:bar:"`</td><td>`foreach substring "foo" then substitute "bar" end`</td></tr>+<tr><td>`sed "s:foo:[\\&]:"`</td><td>`foreach substring "foo" then prepend "[" | append "]" end`</td></tr>+<tr><td>`sed "s:foo:[\\&, \\&]:"`</td><td>`foreach substring "foo" then id; echo ", "; id end`</td></tr>+</table>++## Using the framework from Haskell++The shell interface is basically only syntax on top of the underlying EDSL (embedded domain-specific language) in Haskell. If you require anything more than stringing together of existing components using existing combinators, you'll need to write Haskell code.+
Shell.hs view
@@ -475,8 +475,8 @@ showHelp = putStrLn (usageInfo usageSyntax flagList) interact :: Flags -> InputT IO ()-interact options = do Just command <- getInputLine "> "- finish <- lift $ interpret options command+interact options = do command <- getInputLine "> "+ finish <- maybe (pure False) (lift . interpret options) command when (not finish) (interact options) interpret :: Flags -> String -> IO Bool
scc.cabal view
@@ -1,5 +1,5 @@ Name: scc-Version: 0.8.2.4+Version: 0.8.3 Cabal-Version: >= 1.10 Build-Type: Simple Synopsis: Streaming component combinators@@ -19,12 +19,12 @@ License-file: LICENSE.txt Copyright: (c) 2008-2016 Mario Blazevic Author: Mario Blazevic-Maintainer: blamario@yahoo.com-Homepage: http://trac.haskell.org/SCC/-Extra-source-files: grammar.bnf Makefile+Maintainer: blamario@protonmail.com+Homepage: https://hub.darcs.net/blamario/SCC.wiki+Extra-source-files: grammar.bnf, Makefile, README.md Source-repository head type: darcs- location: http://code.haskell.org/SCC/+ location: https://hub.darcs.net/blamario/SCC Executable shsh Main-is: Shell.hs@@ -33,7 +33,7 @@ Control.Concurrent.Configuration, Control.Concurrent.SCC.Configurable Build-Depends: base < 5, containers, transformers >= 0.2 && < 0.6, transformers-compat >= 0.3 && < 0.6, bytestring < 1.0, text < 1.3,- monoid-subclasses >= 0.2 && < 0.5, incremental-parser >= 0.2.2 && < 0.3,+ monoid-subclasses >= 0.2 && < 1.1, incremental-parser >= 0.2.2 && < 0.4, monad-parallel, monad-coroutine == 0.9.*, process, haskeline, parsec == 3.* GHC-options: -threaded@@ -50,10 +50,10 @@ Control.Concurrent.Configuration, Control.Concurrent.SCC.Configurable Build-Depends: base < 5, containers, transformers >= 0.2 && < 0.6, transformers-compat >= 0.3 && < 0.6, bytestring < 1.0, text < 1.3,- monoid-subclasses >= 0.2 && < 0.5, incremental-parser >= 0.2.2 && < 0.3,+ monoid-subclasses >= 0.2 && < 1.1, incremental-parser >= 0.2.2 && < 0.4, monad-parallel, monad-coroutine == 0.9.*, QuickCheck >= 2 && < 3, test-framework >= 0.4.1, test-framework-quickcheck2- GHC-options: -threaded -fcontext-stack=30+ GHC-options: -threaded -freduction-depth=30 if impl(ghc >= 7.0.0) default-language: Haskell2010 @@ -66,7 +66,7 @@ Control.Concurrent.SCC.Combinators, Control.Concurrent.SCC.Primitives, Control.Concurrent.SCC.XML Build-Depends: base < 5, containers, transformers >= 0.2 && < 0.6, transformers-compat >= 0.3 && < 0.6, bytestring < 1.0, text < 1.3,- monoid-subclasses >= 0.2 && < 0.5, incremental-parser >= 0.2.2 && < 0.3,+ monoid-subclasses >= 0.2 && < 1.1, incremental-parser >= 0.2.2 && < 0.4, monad-parallel, monad-coroutine == 0.9.* if impl(ghc >= 7.0.0) default-language: Haskell2010