mirror of
https://github.com/joshuaclayton/unused.git
synced 2024-07-14 16:10:28 +03:00
Update dependencies
What? ===== This updates certain dependencies to ensure it can compile both via Stack and Cabal (which impacts the ability to install via Homebrew).
This commit is contained in:
parent
e8377f5498
commit
30950ad00b
@ -4,8 +4,9 @@ import qualified Data.Bifunctor as BF
|
||||
import Data.Monoid ((<>))
|
||||
import Data.Text (Text)
|
||||
import qualified Data.Text as T
|
||||
import Data.Void (Void)
|
||||
import Text.Megaparsec
|
||||
import Text.Megaparsec.Text
|
||||
import Text.Megaparsec.Char
|
||||
import Unused.Projection.Transform
|
||||
|
||||
data ParsedTransform = ParsedTransform
|
||||
@ -14,6 +15,8 @@ data ParsedTransform = ParsedTransform
|
||||
, ptPost :: Text
|
||||
}
|
||||
|
||||
type Parser = Parsec Void Text
|
||||
|
||||
translate :: Text -> Either String (Text -> Text)
|
||||
translate template = applyTransform <$> parseTransform template
|
||||
|
||||
|
@ -11,12 +11,12 @@ import qualified Data.Either as E
|
||||
import qualified Data.FileEmbed as FE
|
||||
import qualified Data.Yaml as Y
|
||||
import qualified System.Directory as D
|
||||
import System.FilePath ((</>))
|
||||
import Unused.ResultsClassifier.Types (LanguageConfiguration, ParseConfigError(..))
|
||||
import Unused.Util (safeReadFile)
|
||||
import System.FilePath ((</>))
|
||||
import Unused.ResultsClassifier.Types (LanguageConfiguration, ParseConfigError(..))
|
||||
import Unused.Util (safeReadFile)
|
||||
|
||||
loadConfig :: Either String [LanguageConfiguration]
|
||||
loadConfig = Y.decodeEither defaultConfigFile
|
||||
loadConfig = decodeEither defaultConfigFile
|
||||
|
||||
defaultConfigFile :: BS.ByteString
|
||||
defaultConfigFile = $(FE.embedFile "data/config.yml")
|
||||
@ -24,24 +24,21 @@ defaultConfigFile = $(FE.embedFile "data/config.yml")
|
||||
loadAllConfigurations :: IO (Either [ParseConfigError] [LanguageConfiguration])
|
||||
loadAllConfigurations = do
|
||||
homeDir <- D.getHomeDirectory
|
||||
|
||||
let defaultConfig = addSourceToLeft "default config" loadConfig
|
||||
|
||||
localConfig <- loadConfigFromFile ".unused.yml"
|
||||
userConfig <- loadConfigFromFile $ homeDir </> ".unused.yml"
|
||||
|
||||
let (lefts, rights) = E.partitionEithers [defaultConfig, localConfig, userConfig]
|
||||
|
||||
return $ if not (null lefts)
|
||||
then Left lefts
|
||||
else Right $ concat rights
|
||||
return $
|
||||
if not (null lefts)
|
||||
then Left lefts
|
||||
else Right $ concat rights
|
||||
|
||||
loadConfigFromFile :: String -> IO (Either ParseConfigError [LanguageConfiguration])
|
||||
loadConfigFromFile path =
|
||||
either
|
||||
(const $ Right [])
|
||||
(addSourceToLeft path . Y.decodeEither)
|
||||
<$> safeReadFile path
|
||||
either (const $ Right []) (addSourceToLeft path . decodeEither) <$> safeReadFile path
|
||||
|
||||
addSourceToLeft :: String -> Either String c -> Either ParseConfigError c
|
||||
addSourceToLeft = BF.first . ParseConfigError
|
||||
|
||||
decodeEither :: Y.FromJSON a => BS.ByteString -> Either String a
|
||||
decodeEither = BF.first Y.prettyPrintParseException . Y.decodeEither'
|
||||
|
@ -13,4 +13,4 @@ data SearchBackend
|
||||
|
||||
newtype SearchResults = SearchResults
|
||||
{ fromResults :: [TermMatch]
|
||||
} deriving (Monoid)
|
||||
} deriving (Semigroup, Monoid)
|
||||
|
@ -2,19 +2,14 @@
|
||||
# For more information, see: http://docs.haskellstack.org/en/stable/yaml_configuration/
|
||||
|
||||
# Specifies the GHC version and set of packages available (e.g., lts-3.5, nightly-2015-09-21, ghc-7.10.2)
|
||||
resolver: lts-11.0
|
||||
resolver: lts-12.6
|
||||
|
||||
# Local packages, usually specified by relative directory name
|
||||
packages:
|
||||
- '.'
|
||||
# Packages to be pulled from upstream that are not in the resolver (e.g., acme-missiles-0.3)
|
||||
extra-deps:
|
||||
- cassava-0.4.5.1
|
||||
- hspec-2.5.0
|
||||
- hspec-core-2.5.0
|
||||
- hspec-discover-2.5.0
|
||||
- inflections-0.3.0.0
|
||||
- megaparsec-5.3.1
|
||||
- megaparsec-6.5.0
|
||||
- terminal-progress-bar-0.1.1.1
|
||||
|
||||
# Override default flag values for local packages and extra-deps
|
||||
|
@ -75,12 +75,12 @@ library
|
||||
, bytestring
|
||||
, text
|
||||
, unordered-containers
|
||||
, cassava >= 0.4.5.0 && < 0.5
|
||||
, cassava >= 0.5.1.0 && < 0.6
|
||||
, vector
|
||||
, mtl
|
||||
, transformers
|
||||
, megaparsec >= 5.1.2 && < 6
|
||||
, inflections >= 0.3.0.0 && < 0.4
|
||||
, megaparsec >= 6.5.0 && < 7
|
||||
, inflections >= 0.4.0.3 && < 0.5
|
||||
, file-embed
|
||||
ghc-options: -Wall
|
||||
default-language: Haskell2010
|
||||
|
Loading…
Reference in New Issue
Block a user