Merge branch 'master' of github.com:Gabriel439/Haskell-Turtle-Library
This commit is contained in:
commit
b824122bcf
2 changed files with 8 additions and 4 deletions
|
@ -6,14 +6,14 @@ as `coreutils` embedded within the Haskell language.
|
|||
|
||||
## Quick start
|
||||
|
||||
* Install the [Haskell Platform](http://www.haskell.org/platform/)
|
||||
* Install [Stack](https://github.com/commercialhaskell/stack)
|
||||
|
||||
* `cabal install turtle`
|
||||
* `stack setup && stack install turtle`
|
||||
|
||||
Then fire up `ghci`:
|
||||
|
||||
```
|
||||
$ ghci
|
||||
$ stack ghci
|
||||
Prelude> :set -XOverloadedStrings
|
||||
Prelude> import Turtle
|
||||
```
|
||||
|
@ -44,7 +44,7 @@ FilePath "/usr/lib/libgif.so.4.1"
|
|||
...
|
||||
```
|
||||
|
||||
To learn more, read the [turtle tutorial](http://hackage.haskell.org/package/turtle-1.0.2/docs/Turtle-Tutorial.html).
|
||||
To learn more, read the [turtle tutorial](https://hackage.haskell.org/package/turtle-1.2.1/docs/Turtle-Tutorial.html).
|
||||
|
||||
## Goals
|
||||
|
||||
|
|
|
@ -964,11 +964,15 @@ grep pattern s = do
|
|||
-}
|
||||
sed :: Pattern Text -> Shell Text -> Shell Text
|
||||
sed pattern s = do
|
||||
when (matchesEmpty pattern) (die message)
|
||||
let pattern' = fmap Text.concat
|
||||
(many (pattern <|> fmap Text.singleton anyChar))
|
||||
txt <- s
|
||||
txt':_ <- return (match pattern' txt)
|
||||
return txt'
|
||||
where
|
||||
message = "sed: the given pattern matches the empty string"
|
||||
matchesEmpty = not . null . flip match ""
|
||||
|
||||
-- | Search a directory recursively for all files matching the given `Pattern`
|
||||
find :: Pattern a -> FilePath -> Shell FilePath
|
||||
|
|
Loading…
Reference in a new issue