repl-toolkit 0.4.0.0 → 0.5.0.0
raw patch · 3 files changed
+10/−11 lines, 3 filesdep +filepathdep −system-filepathdep ~semigroupoidsnew-uploader
Dependencies added: filepath
Dependencies removed: system-filepath
Dependency ranges changed: semigroupoids
Files
- System/REPL/Config.hs +6/−9
- changelog.txt +2/−0
- repl-toolkit.cabal +2/−2
System/REPL/Config.hs view
@@ -10,7 +10,6 @@ ) where import Prelude hiding ((++), FilePath) -import qualified Prelude as Pr import Control.Monad.Catch import Control.Monad.IO.Class @@ -18,11 +17,10 @@ import qualified Data.ByteString.Lazy as BL import Data.Default import Data.Functor.Monadic -import Data.ListLike (ListLike(append), StringLike(fromString)) import Data.Text.Lazy.Encoding (decodeUtf8, encodeUtf8) import qualified Data.Text.Lazy as T import Data.Typeable -import qualified Filesystem.Path.CurrentOS as Fp +import qualified System.FilePath as Fp import System.Directory import Text.Read (readMaybe) @@ -33,7 +31,7 @@ -- |Creates a NoParseError out of a 'Fp.FilePath'. noParseError :: Fp.FilePath -> NoParseError -noParseError = NoParseError . T.pack . Fp.encodeString +noParseError = NoParseError . T.pack -- |Variant of 'readConfigFile' that uses 'Show' and 'Read' for (de)serialization. -- @@ -79,10 +77,9 @@ -- using this function. -> m a readConfigFile path parser writer = do - let pathT = Fp.encodeString path - liftIO $ createDirectoryIfMissing True $ Fp.encodeString $ Fp.parent path - exists <- liftIO $ doesFileExist $ Fp.encodeString path - content <- if not exists then do liftIO $ BL.writeFile pathT (writer (def :: a)) + liftIO $ createDirectoryIfMissing True $ Fp.takeDirectory path + exists <- liftIO $ doesFileExist path + content <- if not exists then do liftIO $ BL.writeFile path (writer (def :: a)) return $ Right def - else liftIO (BL.readFile pathT) >$> parser + else liftIO (BL.readFile path) >$> parser either throwM return content
changelog.txt view
@@ -1,3 +1,5 @@+0.5 Replaced system-filepath with filepath, as system-filepath has become deprecated. This is a minor, but breaking, change. + 0.4 Completely overhauled the command system. It is now possible to chain commands together and make subcommands. 0.3.1 Added functionality for reading configuration files.
repl-toolkit.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: repl-toolkit -version: 0.4.0.0 +version: 0.5.0.0 synopsis: Toolkit for quickly whipping up config files and command-line interfaces. description: A simple toolkit for quickly whipping up REPLs, input validation and sets of commands included. homepage: https://github.com/ombocomp/repl-toolkit @@ -23,6 +23,6 @@ exposed-modules: System.REPL, System.REPL.State, System.REPL.Command, System.REPL.Config other-extensions: OverloadedStrings, DeriveDataTypeable, FlexibleContexts, LambdaCase, ScopedTypeVariables - build-depends: base >=4.7 && <5, functor-monadic >=0.1, text >=1.1, ListLike >=4.1, exceptions >=0.4, parsec >=3.1, numericpeano >= 0.1, listsafe >= 0.1, monad-loops >= 0.3, mtl >= 2.2, transformers >= 0.3, directory >= 1.2.1, system-filepath >= 0.4.13, bytestring >= 0.10, data-default >= 0.5.3, aeson >=0.8.0.2, semigroupoids >= 4 && <5 + build-depends: base >=4.7 && <5, functor-monadic >=0.1, text >=1.1, ListLike >=4.1, exceptions >=0.4, parsec >=3.1, numericpeano >= 0.1, listsafe >= 0.1, monad-loops >= 0.3, mtl >= 2.2, transformers >= 0.3, directory >= 1.2.1, filepath >= 1.3 && <2, bytestring >= 0.10, data-default >= 0.5.3, aeson >=0.8.0.2, semigroupoids >= 4 && <6 default-language: Haskell2010