summoner 1.1.0 → 1.1.0.1
raw patch · 22 files changed
+43/−87 lines, 22 filesdep +base-nopreludedep −basedep ~aesondep ~ansi-terminaldep ~bytestringPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies added: base-noprelude
Dependencies removed: base
Dependency ranges changed: aeson, ansi-terminal, bytestring, directory, filepath, generic-deriving, gitrev, neat-interpolation, optparse-applicative, process, relude, text, time
API changes (from Hackage documentation)
- Summoner.Config: instance GHC.Exception.Exception Summoner.Config.LoadTomlException
- Summoner.Config: instance GHC.Show.Show Summoner.Config.LoadTomlException
+ Prelude: inverseMap :: (Bounded a, Enum a, Ord k) => a -> k -> k -> Maybe a
+ Prelude: universe :: (Bounded a, Enum a) => [a]
Files
- CHANGELOG.md +7/−0
- app/Main.hs +0/−2
- src/Prelude.hs +9/−0
- src/Summoner/Ansi.hs +0/−2
- src/Summoner/CLI.hs +0/−3
- src/Summoner/Config.hs +1/−17
- src/Summoner/Decision.hs +0/−2
- src/Summoner/Default.hs +0/−2
- src/Summoner/GhcVer.hs +1/−4
- src/Summoner/License.hs +0/−3
- src/Summoner/Process.hs +1/−3
- src/Summoner/Project.hs +0/−3
- src/Summoner/ProjectData.hs +0/−4
- src/Summoner/Question.hs +2/−5
- src/Summoner/Source.hs +1/−3
- src/Summoner/Template.hs +1/−3
- src/Summoner/Text.hs +0/−2
- src/Summoner/Tree.hs +1/−3
- src/Summoner/Validation.hs +0/−2
- summoner.cabal +19/−17
- test/Test/DecisionSpec.hs +0/−2
- test/Test/TomlSpec.hs +0/−5
CHANGELOG.md view
@@ -1,5 +1,12 @@ # Summoner +1.1.0.1+=======++* Bump up `relude` version to `0.3.0`.+* [#146](https://github.com/kowainik/summoner/issues/146):+ Migrate to `base-noprelude`.+ 1.1.0 =====
app/Main.hs view
@@ -1,7 +1,5 @@ module Main where -import Relude- import System.IO (hSetEncoding, utf8) import Summoner (summon)
+ src/Prelude.hs view
@@ -0,0 +1,9 @@+-- | Uses @relude@ as a default prelude.++module Prelude+ ( module Relude+ , module Relude.Extra+ ) where++import Relude+import Relude.Extra.Enum as Relude.Extra (inverseMap, universe)
src/Summoner/Ansi.hs view
@@ -22,8 +22,6 @@ , skipMessage ) where -import Relude- import System.Console.ANSI (Color (..), ColorIntensity (Vivid), ConsoleIntensity (BoldIntensity), ConsoleLayer (Foreground), SGR (..), setSGR, setSGRCode) import System.IO (hFlush)
src/Summoner/CLI.hs view
@@ -9,9 +9,6 @@ ( summon ) where -import Relude-import Relude.Extra.Enum (universe)- import Data.Version (showVersion) import Development.GitRev (gitCommitDate, gitDirty, gitHash) import NeatInterpolation (text)
src/Summoner/Config.hs view
@@ -23,11 +23,7 @@ , loadFileConfig ) where -import Relude--import Control.Exception (throwIO) import Data.List (lookup)-import Data.Monoid (Last (..)) import Generics.Deriving.Monoid (GMonoid, gmemptydefault) import Generics.Deriving.Semigroup (GSemigroup, gsappenddefault) import Toml (AnyValue (..), BiMap (..), BiToml, Bijection (..), Key, dimap, (.=))@@ -39,7 +35,6 @@ import Summoner.Source (Source, sourceT) import Summoner.Validation (Validation (..)) -import qualified Text.Show as Show import qualified Toml data Phase = Partial | Final@@ -234,15 +229,4 @@ -- | Read configuration from the given file and return it in data type. loadFileConfig :: MonadIO m => FilePath -> m PartialConfig-loadFileConfig filePath = (Toml.decode configT <$> readFile filePath) >>= liftIO . errorWhenLeft- where- errorWhenLeft :: Either Toml.DecodeException PartialConfig -> IO PartialConfig- errorWhenLeft (Left e) = throwIO $ LoadTomlException filePath $ Toml.prettyException e- errorWhenLeft (Right pc) = pure pc--data LoadTomlException = LoadTomlException FilePath Text--instance Show.Show LoadTomlException where- show (LoadTomlException filePath msg) = "Couldnt parse file " ++ filePath ++ ": " ++ show msg--instance Exception LoadTomlException+loadFileConfig = Toml.decodeFile configT
src/Summoner/Decision.hs view
@@ -5,8 +5,6 @@ , decisionToBool ) where -import Relude- import Generics.Deriving.Monoid (GMonoid (..)) import Generics.Deriving.Semigroup (GSemigroup (..))
src/Summoner/Default.hs view
@@ -8,8 +8,6 @@ , endLine ) where -import Relude- import Data.Time (getCurrentTime, toGregorian, utctDay) import System.Directory (getHomeDirectory) import System.FilePath ((</>))
src/Summoner/GhcVer.hs view
@@ -6,9 +6,6 @@ , baseVer ) where -import Relude-import Relude.Extra.Enum (inverseMap)- -- | Represents some selected set of GHC versions. data GhcVer = Ghc7103@@ -37,7 +34,7 @@ Ghc801 -> "7.24" Ghc802 -> "9.21" Ghc822 -> "11.22"- Ghc843 -> "12.7"+ Ghc843 -> "12.9" -- | Returns base version by 'GhcVer'. baseVer :: GhcVer -> Text
src/Summoner/License.hs view
@@ -7,9 +7,6 @@ , fetchLicense ) where -import Relude-import Relude.Extra.Enum (inverseMap)- import Data.Aeson (FromJSON (..), decodeStrict, withObject, (.:)) import Data.ByteString.Char8 (pack) import System.Process (readProcess)
src/Summoner/Process.hs view
@@ -8,9 +8,7 @@ ( deleteFile ) where -import Relude--import Control.Exception (catch, displayException)+import Control.Exception (catch) import System.Directory (removeFile) import System.Process (callCommand, showCommandForUser)
src/Summoner/Project.hs view
@@ -6,9 +6,6 @@ ( generateProject ) where -import Relude-import Relude.Extra.Enum (universe)- import NeatInterpolation (text) import System.Directory (setCurrentDirectory)
src/Summoner/ProjectData.hs view
@@ -1,11 +1,7 @@-{-# LANGUAGE ViewPatterns #-}- module Summoner.ProjectData ( ProjectData (..) , CustomPrelude (..) ) where--import Relude import Summoner.GhcVer (GhcVer) import Summoner.License (License, LicenseName)
src/Summoner/Question.hs view
@@ -20,8 +20,6 @@ , falseMessage ) where -import Relude- import System.Directory (doesPathExist, getCurrentDirectory) import System.FilePath ((</>)) @@ -30,7 +28,6 @@ import Summoner.Text (headToUpper, intercalateMap) import qualified Data.Text as T-import qualified Data.Text.IO as T import qualified Relude.Unsafe as Unsafe ----------------------------------------------------------------------------@@ -56,7 +53,7 @@ putStrFlush question boldDefault def putTextLn $ "/" <> restSlash-printQuestion question [] = T.putStrLn question+printQuestion question [] = putTextLn question choose :: Show a => (Text -> Maybe a) -> Text -> [a] -> IO a choose parser question choices = do@@ -106,7 +103,7 @@ query :: Text -> IO Text query question = do- T.putStrLn question+ putTextLn question answer <- prompt if | T.null answer -> do errorMessage "An answer is required."
src/Summoner/Source.hs view
@@ -4,8 +4,6 @@ , fetchSource ) where -import Relude- import Control.Arrow ((>>>)) import Control.Exception (catch) import System.Process (readProcess)@@ -38,7 +36,7 @@ fetchSource :: Source -> IO (Maybe Text) fetchSource = \case- File path -> catch (Just <$> readFile path) (fileError path)+ File path -> catch (Just <$> readFileText path) (fileError path) Url url -> catch (fetchUrl url) (urlError url) where fileError :: FilePath -> SomeException -> IO (Maybe Text)
src/Summoner/Template.hs view
@@ -7,8 +7,6 @@ ( createProjectTemplate ) where -import Relude- import Data.List (delete) import NeatInterpolation (text) @@ -432,7 +430,7 @@ $githubFootNote |] where- githubLine :: Text = memptyIfFalse github $ "The change log is available [on GitHub][2]."+ githubLine :: Text = memptyIfFalse github "The change log is available [on GitHub][2]." githubFootNote :: Text = memptyIfFalse github $ "[2]: https://github.com/" <> owner <> "/" <> repo <> "/releases"
src/Summoner/Text.hs view
@@ -4,8 +4,6 @@ , headToUpper ) where -import Relude- import qualified Data.Char as C import qualified Data.Text as T
src/Summoner/Tree.hs view
@@ -6,8 +6,6 @@ , showTree ) where -import Relude- import System.Directory (createDirectoryIfMissing, withCurrentDirectory) import Summoner.Ansi (boldCode, resetCode)@@ -25,7 +23,7 @@ traverseTree (Dir name children) = do createDirectoryIfMissing False name withCurrentDirectory name $ for_ children traverseTree-traverseTree (File name content) = writeFile name content+traverseTree (File name content) = writeFileText name content -- | Pretty shows the directory tree content. showTree :: TreeFs -> Text
src/Summoner/Validation.hs view
@@ -2,8 +2,6 @@ ( Validation (..) ) where -import Relude- -- | 'Validation' is 'Either' with a Left that is a 'Monoid' data Validation e a = Failure e
summoner.cabal view
@@ -1,5 +1,6 @@+cabal-version: 2.0 name: summoner-version: 1.1.0+version: 1.1.0.1 synopsis: Tool for creating completely configured production Haskell projects. description: Tool for creating completely configured production Haskell projects. See README.md for details.@@ -15,7 +16,6 @@ stability: stable extra-doc-files: README.md , CHANGELOG.md-cabal-version: 2.0 tested-with: GHC == 8.2.2 , GHC == 8.4.3 @@ -25,7 +25,8 @@ library hs-source-dirs: src- exposed-modules: Summoner+ exposed-modules: Prelude+ Summoner Summoner.Ansi Summoner.CLI Summoner.Config@@ -46,14 +47,7 @@ other-modules: Paths_summoner autogen-modules: Paths_summoner - ghc-options: -Wall- -Wincomplete-uni-patterns- -Wincomplete-record-updates- -Wcompat- -Widentities- -Wredundant-constraints- -fhide-source-paths- build-depends: base >= 4.10 && < 5+ build-depends: base-noprelude >= 4.10 && < 5 , aeson , ansi-terminal , bytestring@@ -61,19 +55,26 @@ , filepath , generic-deriving , gitrev- , neat-interpolation+ , neat-interpolation ^>= 0.3.2.2 , optparse-applicative , process , text , time , tomland ^>= 0.4.0- , relude ^>= 0.2.0+ , relude ^>= 0.3.0 + ghc-options: -Wall+ -Wincomplete-uni-patterns+ -Wincomplete-record-updates+ -Wcompat+ -Widentities+ -Wredundant-constraints+ -fhide-source-paths+ default-extensions: DeriveGeneric GeneralizedNewtypeDeriving InstanceSigs LambdaCase- NoImplicitPrelude OverloadedStrings RecordWildCards ScopedTypeVariables@@ -94,7 +95,7 @@ -Widentities -Wredundant-constraints -fhide-source-paths- build-depends: base+ build-depends: base-noprelude , relude , summoner default-language: Haskell2010@@ -108,14 +109,13 @@ Test.TomlSpec build-tool-depends: tasty-discover:tasty-discover- build-depends: base+ build-depends: base-noprelude , hedgehog , relude , tasty , tasty-hedgehog , tomland , summoner- default-extensions: NoImplicitPrelude ghc-options: -Wall -threaded@@ -127,4 +127,6 @@ -Widentities -Wredundant-constraints -fhide-source-paths++ default-extensions: RecordWildCards default-language: Haskell2010
test/Test/DecisionSpec.hs view
@@ -1,7 +1,5 @@ module Test.DecisionSpec where -import Relude- import Hedgehog (MonadGen, forAll, property, (===)) import Test.Tasty (TestTree) import Test.Tasty.Hedgehog (testProperty)
test/Test/TomlSpec.hs view
@@ -1,9 +1,4 @@-{-# LANGUAGE RecordWildCards #-}- module Test.TomlSpec where--import Relude-import Relude.Extra.Enum (universe) import Hedgehog (MonadGen, forAll, property, tripping) import Test.Tasty (TestTree)