From 0df0bd17e05be7124c2fa10a6c6e39199a101115 Mon Sep 17 00:00:00 2001 From: "Yann Esposito (Yogsototh)" Date: Sat, 7 Sep 2019 08:18:39 +0200 Subject: [PATCH] upgraded LTS, stack stopped to work for previous LTS --- .gitignore | 2 + lish.cabal | 74 +++++++++++++++++++----------------- src/Lish/Core.hs | 2 +- src/Lish/InternalCommands.hs | 14 ++----- src/Lish/Types.hs | 4 +- stack.yaml | 22 ++--------- 6 files changed, 52 insertions(+), 66 deletions(-) diff --git a/.gitignore b/.gitignore index adafdea..cff341c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ /tutorial.md /.stack-work/ .lish-history +*.tix +stack.yaml.lock diff --git a/lish.cabal b/lish.cabal index a88b282..f0deaff 100644 --- a/lish.cabal +++ b/lish.cabal @@ -1,6 +1,10 @@ --- This file has been generated from package.yaml by hpack version 0.17.0. +cabal-version: 1.12 + +-- This file has been generated from package.yaml by hpack version 0.31.2. -- -- see: https://github.com/sol/hpack +-- +-- hash: 3a261bc10b55766ddf87ee6ac6a456e51b1f7b79b7b6514d18b7dc4f51c4b8eb name: lish version: 0.1.0.0 @@ -13,8 +17,6 @@ maintainer: Yann Esposito license: PublicDomain license-file: LICENSE build-type: Simple -cabal-version: >= 1.10 - extra-source-files: README.md stack.yaml @@ -28,16 +30,16 @@ library src ghc-options: -Wall -O2 build-depends: - base >= 4.8 && < 5 + base >=4.8 && <5 , containers , data-fix , haskeline - , parsec >= 3 && < 4 + , parsec >=3 && <4 , pipes - , protolude , pretty , pretty-show , process + , protolude , text exposed-modules: Data.Stack @@ -48,74 +50,80 @@ library Lish.InternalCommands Lish.Parser Lish.Types + other-modules: + Paths_lish default-language: Haskell2010 executable lish main-is: Main.hs + other-modules: + Paths_lish hs-source-dirs: src-exe ghc-options: -Wall -O2 -threaded -rtsopts -with-rtsopts=-N build-depends: - base >= 4.8 && < 5 + base >=4.8 && <5 , containers , data-fix , haskeline - , parsec >= 3 && < 4 + , lish + , parsec >=3 && <4 , pipes - , protolude , pretty , pretty-show , process + , protolude , text - , lish default-language: Haskell2010 test-suite lish-benchmark type: exitcode-stdio-1.0 main-is: Main.hs + other-modules: + Paths_lish hs-source-dirs: src-benchmark ghc-options: -Wall -O2 -threaded -rtsopts -with-rtsopts=-N build-depends: - base >= 4.8 && < 5 + base >=4.8 && <5 , containers + , criterion >=1.1 , data-fix , haskeline - , parsec >= 3 && < 4 + , lish + , parsec >=3 && <4 , pipes - , protolude , pretty , pretty-show , process + , protolude , text - , lish - , base >= 4.8 && < 5 - , criterion >= 1.1 default-language: Haskell2010 test-suite lish-doctest type: exitcode-stdio-1.0 main-is: Main.hs + other-modules: + Paths_lish hs-source-dirs: src-doctest ghc-options: -Wall -O2 -threaded -rtsopts -with-rtsopts=-N build-depends: - base >= 4.8 && < 5 + Glob >=0.7 + , QuickCheck >=2.5 + , base >=4.8 && <5 , containers , data-fix + , doctest >=0.10 , haskeline - , parsec >= 3 && < 4 + , lish + , parsec >=3 && <4 , pipes - , protolude , pretty , pretty-show , process + , protolude , text - , lish - , base >= 4.8 && < 5 - , doctest >=0.10 - , Glob >= 0.7 - , QuickCheck >= 2.5 default-language: Haskell2010 test-suite lish-test @@ -125,24 +133,22 @@ test-suite lish-test src-test ghc-options: -Wall -O2 -threaded -rtsopts -with-rtsopts=-N build-depends: - base >= 4.8 && < 5 + base >=4.8 && <5 , containers , data-fix , haskeline - , parsec >= 3 && < 4 + , lish + , parsec >=3 && <4 , pipes - , protolude , pretty , pretty-show , process - , text - , lish - , base >= 4.8 && < 5 - , tasty >= 0.11 - , tasty-hunit >= 0.9 - , tasty-smallcheck >= 0.8 , protolude - , data-fix + , tasty >=0.11 + , tasty-hunit >=0.9 + , tasty-smallcheck >=0.8 + , text other-modules: Lish.Test.Parser + Paths_lish default-language: Haskell2010 diff --git a/src/Lish/Core.hs b/src/Lish/Core.hs index 2a2e4cc..4da8cb2 100644 --- a/src/Lish/Core.hs +++ b/src/Lish/Core.hs @@ -46,7 +46,7 @@ toEnv env = -- So if the first argument is not Nothing, it means we are in the middle -- of a multiline expression. mainLoop :: Maybe Char -- ^ Check to know if we are in the middle of the writting of a multiline expression - -> Env -- ^ The Lish environement + -> Env -- ^ The Lish environment -> Text -- ^ The previous partial input (if in the middle of a multiline expression) -> InputT IO () mainLoop mc env previousPartialnput = do diff --git a/src/Lish/InternalCommands.hs b/src/Lish/InternalCommands.hs index 55668dc..743edf6 100644 --- a/src/Lish/InternalCommands.hs +++ b/src/Lish/InternalCommands.hs @@ -11,7 +11,7 @@ import Data.Fix import qualified Data.Map.Strict as Map import qualified Data.Text as Text import GHC.IO.Handle (hGetContents) -import Protolude hiding (show) +import Protolude hiding (show,replace) import System.Environment (setEnv) import Lish.Parser (parseCmd) @@ -65,9 +65,7 @@ replace _ = evalErr "replace should take 3 String arguments" -- | create a string and concat multiple elements str :: ReduceUnawareCommand -str exprs = do - args <- catMaybes <$> mapM toArg exprs - return $ Str $ Text.concat args +str exprs = Str . Text.concat . catMaybes <$> mapM toArg exprs -- | create an atom from a string (do nothing to atoms) atom :: ReduceUnawareCommand @@ -268,12 +266,8 @@ evalStr _ _ = evalErr "evalStr error" -- | retrieve the value of a var getenv :: Command -getenv _ [Atom varname] = do - hm <- get - return $ fromMaybe Void (Map.lookup varname hm) -getenv _ [Str varname] = do - hm <- get - return $ fromMaybe Void (Map.lookup varname hm) +getenv _ [Atom varname] = fromMaybe Void . Map.lookup varname <$> get +getenv _ [Str varname] = fromMaybe Void . Map.lookup varname <$> get getenv r (expr:_) = do reduced <- r expr hm <- get diff --git a/src/Lish/Types.hs b/src/Lish/Types.hs index f12b329..f5663b0 100644 --- a/src/Lish/Types.hs +++ b/src/Lish/Types.hs @@ -25,7 +25,7 @@ import Data.Map.Strict (Map) import qualified Data.Text as Text import GHC.IO.Handle (Handle) import GHC.Show (Show (..)) -import Protolude hiding (show) +import Protolude hiding (show,repr) data ExprF a = Atom Text | Num Integer @@ -70,7 +70,7 @@ repr (Str s) = "\"" <> toS s <> "\"" repr (List sexprs) = "[" <> Text.intercalate " " sexprs <> "]" repr (Lambda sexprs) = "(" <> Text.intercalate " " sexprs <> ")" repr Void = "ε" -repr (Cmd n args) = "($ " <> n <> Text.intercalate " " args <> ")" +repr (Cmd n args) = "($ " <> n <> Text.intercalate " " args <> ")" repr (Fn p _ _ _) = "(λ" <> Text.intercalate "." p <> ". ... )" repr (Stream _) = "" repr (WaitingStream _) = "" diff --git a/stack.yaml b/stack.yaml index b285d50..0f1c71d 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,21 +1,7 @@ -# This file was automatically generated by 'stack init' -# -# Some commonly used options have been documented as comments in this file. -# For advanced use and comprehensive documentation of the format, please see: -# http://docs.haskellstack.org/en/stable/yaml_configuration/ - -# Resolver to choose a 'specific' stackage snapshot or a compiler version. -# A snapshot resolver dictates the compiler version and the set of packages -# to be used for project dependencies. For example: -# -# resolver: lts-3.5 -# resolver: nightly-2015-09-21 -# resolver: ghc-7.10.2 -# resolver: ghcjs-0.1.0_ghc-7.10.2 -# resolver: +# This file was automatically generated by 'stack init' # # Some commonly used options have been documented as comments in this file. # For advanced use and comprehensive documentation of the format, please see: # http://docs.haskellstack.org/en/stable/yaml_configuration/ # Resolver to choose a 'specific' stackage snapshot or a compiler version. # A snapshot resolver dictates the compiler version and the set of packages # to be used for project dependencies. For example: # # resolver: lts-3.5 # resolver: nightly-2015-09-21 # resolver: ghc-7.10.2 # resolver: ghcjs-0.1.0_ghc-7.10.2 # resolver: # name: custom-snapshot # location: "./custom-snapshot.yaml" -resolver: lts-8.0 +resolver: lts-14.3 # User packages to be built. # Various formats can be used as shown in the example below. @@ -39,9 +25,7 @@ packages: - '.' # Dependency packages to be pulled from upstream that are not in the resolver # (e.g., acme-missiles-0.3) -extra-deps: -- haskeline-0.7.3.1 -- data-fix-0.0.3 +extra-deps: [] # Override default flag values for local packages and extra-deps flags: {}