turtle 1.5.0 → 1.5.1
raw patch · 7 files changed
+51/−26 lines, 7 filesdep ~Win32dep ~criterion
Dependency ranges changed: Win32, criterion
Files
- CHANGELOG.md +7/−0
- src/Turtle.hs +2/−0
- src/Turtle/Line.hs +5/−0
- src/Turtle/Pattern.hs +6/−0
- src/Turtle/Shell.hs +5/−0
- src/Turtle/Tutorial.hs +23/−23
- turtle.cabal +3/−3
CHANGELOG.md view
@@ -1,3 +1,10 @@+1.5.1++* GHC 8.4 support+* Re-export `encodeString`/`decodeString`+* Update tutorial to use `stack script`+* Increase upper bounds on dependencies+ 1.5.0 * BREAKING CHANGE: Add `MonadCatch` instance for `Shell`
src/Turtle.hs view
@@ -141,6 +141,8 @@ , splitExtension , toText , fromText+ , encodeString+ , decodeString ) import Control.Monad.Managed (Managed, managed, runManaged, with) import Control.Foldl (Fold(..), FoldM(..))
src/Turtle/Line.hs view
@@ -62,6 +62,11 @@ newtype Line = Line Text deriving (Eq, Ord, Show, Monoid) +#if __GLASGOW_HASKELL__ >= 804+instance Semigroup Line where+ (<>) = mappend+#endif+ instance IsString Line where fromString = fromMaybe (throw NewlineForbidden) . textToLine . fromString
src/Turtle/Pattern.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE TypeFamilies #-}@@ -122,6 +123,11 @@ -- | A fully backtracking pattern that parses an @\'a\'@ from some `Text` newtype Pattern a = Pattern { runPattern :: StateT Text [] a } deriving (Functor, Applicative, Monad, Alternative, MonadPlus)++#if __GLASGOW_HASKELL__ >= 804+instance Monoid a => Semigroup (Pattern a) where+ (<>) = mappend+#endif instance Monoid a => Monoid (Pattern a) where mempty = pure mempty
src/Turtle/Shell.hs view
@@ -207,6 +207,11 @@ fail = Prelude.fail #endif +#if __GLASGOW_HASKELL__ >= 804+instance Monoid a => Semigroup (Shell a) where+ (<>) = mappend+#endif+ instance Monoid a => Monoid (Shell a) where mempty = pure mempty mappend = liftA2 mappend
src/Turtle/Tutorial.hs view
@@ -47,7 +47,7 @@ can install a Haskell compiler if one is not already present. If you are curious about how these two lines work, they are described here: - <https://github.com/commercialhaskell/stack/blob/master/doc/GUIDE.md#ghcrunghc>+ <https://github.com/commercialhaskell/stack/blob/master/doc/GUIDE.md#script-interpreter> If you want to make a Windows script independently executable outside of a Git Bash environment, you can either (A) compile the script into an@@ -129,7 +129,7 @@ -- -- @ -- #!\/usr\/bin\/env stack--- \-\- stack \-\-install-ghc runghc \-\-package turtle+-- \-\- stack \-\-resolver lts-10.2 script -- \ -- -- #!\/bin\/bash -- {-\# LANGUAGE OverloadedStrings \#-} --@@ -194,7 +194,7 @@ -- difference: -- -- > #!/usr/bin/env stack--- > -- stack --install-ghc runghc --package turtle+-- > -- stack --resolver lts-10.2 script -- > -- > -- #!/bin/bash -- > {-# LANGUAGE OverloadedStrings #-} --@@ -211,7 +211,7 @@ -- program this way instead: -- -- > #!/usr/bin/env stack--- > -- stack --install-ghc runghc --package turtle+-- > -- stack --resolver lts-10.2 script -- > -- > {-# LANGUAGE OverloadedStrings #-} -- > @@ -227,7 +227,7 @@ -- permits definitions. If you were to insert a statement at the top-level: -- -- > #!/usr/bin/env stack--- > -- stack --install-ghc runghc --package turtle+-- > -- stack --resolver lts-10.2 script -- > -- > {-# LANGUAGE OverloadedStrings #-} -- > @@ -244,7 +244,7 @@ -- command: -- -- > #!/usr/bin/env stack--- > -- stack --install-ghc runghc --package turtle+-- > -- stack --resolver lts-10.2 script -- > -- > -- #!/bin/bash -- > {-# LANGUAGE OverloadedStrings #-} --@@ -270,7 +270,7 @@ -- -- @ -- #!\/usr\/bin\/env stack--- \-\- stack \-\-install-ghc runghc \-\-package turtle+-- \-\- stack \-\-resolver lts-10.2 script -- \ -- -- #!\/bin\/bash -- import Turtle --@@ -298,7 +298,7 @@ -- within a larger subroutine: -- -- > #!/usr/bin/env stack--- > -- stack --install-ghc runghc --package turtle+-- > -- stack --resolver lts-10.2 script -- > -- > -- #!/bin/bash -- > import Turtle --@@ -360,7 +360,7 @@ -- following script to find out what happens if we choose `echo` instead: -- -- > #!/usr/bin/env stack--- > -- stack --install-ghc runghc --package turtle+-- > -- stack --resolver lts-10.2 script -- > -- > import Turtle -- > @@ -567,7 +567,7 @@ -- Let's illustrate this by adding types to our original script: -- -- > #!/usr/bin/env stack--- > -- stack --install-ghc runghc --package turtle+-- > -- stack --resolver lts-10.2 script -- > -- > import Turtle -- > @@ -605,7 +605,7 @@ -- can define unadorned `Line` values at the top-level, as we saw previously: -- -- > #!/usr/bin/env stack--- > -- stack --install-ghc runghc --package turtle+-- > -- stack --resolver lts-10.2 script -- > -- > {-# LANGUAGE OverloadedStrings #-} -- > @@ -625,7 +625,7 @@ -- Let's test this out by providing an incorrect type for @\'str\'@: -- -- > #!/usr/bin/env stack--- > -- stack --install-ghc runghc --package turtle+-- > -- stack --resolver lts-10.2 script -- > -- > {-# LANGUAGE OverloadedStrings #-} -- > @@ -677,7 +677,7 @@ -- a string: -- -- > #!/usr/bin/env stack--- > -- stack --install-ghc runghc --package turtle+-- > -- stack --resolver lts-10.2 script -- > -- > {-# LANGUAGE OverloadedStrings #-} -- > @@ -713,7 +713,7 @@ -- -- @ -- #!\/usr\/bin\/env stack--- \-\- stack \-\-install-ghc runghc \-\-package turtle+-- \-\- stack \-\-resolver lts-10.2 script -- \ -- -- #!\/bin\/bash -- {-\# LANGUAGE OverloadedStrings \#-} --@@ -758,7 +758,7 @@ -- -- @ -- #!\/usr\/bin\/env stack--- \-\- stack \-\-install-ghc runghc \-\-package turtle+-- \-\- stack \-\-resolver lts-10.2 script -- -- {-\# LANGUAGE OverloadedStrings \#-} -- @@ -1031,7 +1031,7 @@ -- We can use `select` to implement loops within a `Shell`: -- -- > #!/usr/bin/env stack--- > -- stack --install-ghc runghc --package turtle+-- > -- stack --resolver lts-10.2 script -- > -- > -- #!/bin/bash -- > {-# LANGUAGE OverloadedStrings #-} --@@ -1178,7 +1178,7 @@ -- to standard output: -- -- > #!/usr/bin/env stack--- > -- stack --install-ghc runghc --package turtle+-- > -- stack --resolver lts-10.2 script -- > -- > -- #!/bin/bash -- > {-# LANGUAGE OverloadedStrings #-} --@@ -1419,7 +1419,7 @@ -- a `Shell`: -- -- > #!/usr/bin/env stack--- > -- stack --install-ghc runghc --package turtle+-- > -- stack --resolver lts-10.2 script -- > -- > {-# LANGUAGE OverloadedStrings #-} -- > @@ -1445,7 +1445,7 @@ -- file and directory are still cleaned up correctly: -- -- > #!/usr/bin/env stack--- > -- stack --install-ghc runghc --package turtle+-- > -- stack --resolver lts-10.2 script -- > -- > {-# LANGUAGE OverloadedStrings #-} -- > @@ -1509,7 +1509,7 @@ -- to: -- -- > #!/usr/bin/env stack--- > -- stack --install-ghc runghc --package turtle+-- > -- stack --resolver lts-10.2 script -- > -- > {-# LANGUAGE OverloadedStrings #-} -- > @@ -1536,7 +1536,7 @@ -- positional arguments for the source and destination file, you can write: -- -- > #!/usr/bin/env stack--- > -- stack --install-ghc runghc --package turtle+-- > -- stack --resolver lts-10.2 script -- > -- > -- cp.hs -- >@@ -1601,7 +1601,7 @@ -- -- -- > #!/usr/bin/env stack--- > -- stack --install-ghc runghc --package turtle+-- > -- stack --resolver lts-10.2 script -- > -- > {-# LANGUAGE OverloadedStrings #-} -- > @@ -1650,7 +1650,7 @@ -- as short-hands for the flags: -- -- > #!/usr/bin/env stack--- > -- stack --install-ghc runghc --package turtle+-- > -- stack --resolver lts-10.2 script -- > -- > {-# LANGUAGE OverloadedStrings #-} -- >
turtle.cabal view
@@ -1,5 +1,5 @@ Name: turtle-Version: 1.5.0+Version: 1.5.1 Cabal-Version: >=1.10 Build-Type: Simple License: BSD3@@ -73,7 +73,7 @@ optional-args >= 1.0 && < 2.0 , unix-compat >= 0.4 && < 0.6 if os(windows)- Build-Depends: Win32 >= 2.2.0.1 && < 2.4+ Build-Depends: Win32 >= 2.2.0.1 && < 2.6 else Build-Depends: unix >= 2.5.1.0 && < 2.8 Exposed-Modules:@@ -146,4 +146,4 @@ if impl(ghc < 7.8) Build-Depends: criterion >= 0.4 && < 1.1.4.0 else- Build-Depends: criterion >= 0.4 && < 1.3+ Build-Depends: criterion >= 0.4 && < 1.4