├── .gitignore ├── .stylish-haskell.yaml ├── .travis.yml ├── CHANGELOG.md ├── LICENSE ├── README.md ├── Setup.lhs ├── cabal-refact.cabal ├── cli └── Main.hs ├── fixtures ├── identity │ ├── Agda.cabal │ ├── JuicyPixels.cabal │ ├── QuickCheck.cabal │ ├── adjunctions.cabal │ ├── aeson.cabal │ ├── arithmoi.cabal │ ├── bound.cabal │ ├── cabal-refact.cabal │ ├── doctest.cabal │ ├── fake-deps.cabal │ ├── free.cabal │ ├── hackage-cli.cabal │ ├── haddock.cabal │ ├── hashable.cabal │ ├── haxl.cabal │ ├── lens.cabal │ ├── md2sht.cabal │ ├── recursion-schemes.cabal │ ├── scientific.cabal │ ├── servant-mock.cabal │ ├── stack.cabal │ ├── stylish-haskell.cabal │ ├── these.cabal │ ├── uniform-pair.cabal │ ├── unordered-containers.cabal │ ├── vector-algorithms.cabal │ └── vector.cabal ├── increase-revision │ ├── cabal-refact.cabal │ ├── cabal-refact.cabal.output │ ├── focus.cabal │ ├── focus.cabal.output │ ├── focus2.cabal │ └── focus2.cabal.output ├── populate-extra-source-files │ ├── cabal-refact.cabal │ ├── cabal-refact.cabal.output │ ├── cabal-refact2.cabal │ └── cabal-refact2.cabal.output └── set-version │ ├── cabal-refact.cabal │ ├── cabal-refact.cabal.output │ ├── focus.cabal │ ├── focus.cabal.output │ ├── focus2.cabal │ └── focus2.cabal.output ├── src └── Distribution │ ├── Refact.hs │ └── Refact │ ├── Annotations.hs │ ├── Internal │ └── Prelude.hs │ ├── Parser.hs │ ├── Pretty.hs │ ├── Refactoring │ ├── Identity.hs │ ├── IncreaseRevision.hs │ ├── PopulateExtraSourceFiles.hs │ └── SetVersion.hs │ ├── Tools │ ├── Edit.hs │ ├── Edit │ │ └── Algorithm.hs │ ├── Pretty.hs │ └── Trifecta.hs │ └── Types │ ├── Pos.hs │ ├── Refactoring.hs │ ├── Structure.hs │ └── Version.hs ├── stack.yaml └── tests ├── Tests.hs └── doctests.hs /.gitignore: -------------------------------------------------------------------------------- 1 | .stack-work/ 2 | dist 3 | dist-newstyle 4 | -------------------------------------------------------------------------------- /.stylish-haskell.yaml: -------------------------------------------------------------------------------- 1 | steps: 2 | - imports: 3 | align: group 4 | list_align: after_alias 5 | long_list_align: new_line 6 | empty_list_align: right_after 7 | list_padding: module_name 8 | pinned_modules: 9 | - Prelude 10 | - Prelude.Compat 11 | - language_pragmas: 12 | style: vertical 13 | remove_redundant: true 14 | - trailing_whitespace: {} 15 | columns: 80 16 | language_extensions: 17 | - MultiParamTypeClasses 18 | - FlexibleContexts 19 | - ExplicitForAll 20 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # This Travis job script has been generated by a script via 2 | # 3 | # make_travis_yml_2.hs 'cabal-refact.cabal' 4 | # 5 | # For more information, see https://github.com/hvr/multi-ghc-travis 6 | # 7 | language: c 8 | sudo: false 9 | 10 | git: 11 | submodules: false # whether to recursively clone submodules 12 | 13 | cache: 14 | directories: 15 | - $HOME/.cabal/packages 16 | - $HOME/.cabal/store 17 | 18 | before_cache: 19 | - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log 20 | # remove files that are regenerated by 'cabal update' 21 | - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.* 22 | - rm -fv $HOME/.cabal/packages/hackage.haskell.org/*.json 23 | - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.cache 24 | - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar 25 | - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar.idx 26 | 27 | matrix: 28 | include: 29 | - compiler: "ghc-8.0.1" 30 | # env: TEST=--disable-tests BENCH=--disable-benchmarks 31 | addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.0.1], sources: [hvr-ghc]}} 32 | 33 | before_install: 34 | - HC=${CC} 35 | - unset CC 36 | - PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$PATH 37 | - PKGNAME='cabal-refact' 38 | 39 | install: 40 | - cabal --version 41 | - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]" 42 | - BENCH=${BENCH---enable-benchmarks} 43 | - TEST=${TEST---enable-tests} 44 | - travis_retry cabal update -v 45 | - sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config 46 | - rm -fv cabal.project.local 47 | - "echo 'packages: .' > cabal.project" 48 | - rm -f cabal.project.freeze 49 | - cabal new-build -w ${HC} ${TEST} ${BENCH} --dep -j2 50 | - cabal new-build -w ${HC} --disable-tests --disable-benchmarks --dep -j2 51 | 52 | # Here starts the actual work to be performed for the package under test; 53 | # any command which exits with a non-zero exit code causes the build to fail. 54 | script: 55 | - if [ -f configure.ac ]; then autoreconf -i; fi 56 | - rm -rf dist/ 57 | - cabal sdist # test that a source-distribution can be generated 58 | - cd dist/ 59 | - SRCTAR=(${PKGNAME}-*.tar.gz) 60 | - SRC_BASENAME="${SRCTAR/%.tar.gz}" 61 | - tar -xvf "./$SRC_BASENAME.tar.gz" 62 | - cd "$SRC_BASENAME/" 63 | ## from here on, CWD is inside the extracted source-tarball 64 | - rm -fv cabal.project.local 65 | - "echo 'packages: .' > cabal.project" 66 | # this builds all libraries and executables (without tests/benchmarks) 67 | - rm -f cabal.project.freeze 68 | - cabal new-build -w ${HC} --disable-tests --disable-benchmarks 69 | # this builds all libraries and executables (including tests/benchmarks) 70 | # - rm -rf ./dist-newstyle 71 | - cabal new-build -w ${HC} ${TEST} ${BENCH} 72 | 73 | # there's no 'cabal new-test' yet, so let's emulate for now 74 | - TESTS=( $(awk 'tolower($0) ~ /^test-suite / { print $2 }' *.cabal) ) 75 | - if [ "$TEST" != "--enable-tests" ]; then TESTS=(); fi 76 | - shopt -s globstar; 77 | RC=true; for T in ${TESTS[@]}; do echo "== $T =="; 78 | if dist-newstyle/build/**/$SRC_BASENAME/**/build/$T/$T; then echo "= $T OK ="; 79 | else echo "= $T FAILED ="; RC=false; fi; done; $RC 80 | 81 | # EOF 82 | 83 | branches: 84 | only: 85 | - master 86 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phadej/cabal-refact/9442736429e498f95dc24866c97be587113206ab/CHANGELOG.md -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017, Oleg Grenrus 2 | 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 11 | * Redistributions in binary form must reproduce the above 12 | copyright notice, this list of conditions and the following 13 | disclaimer in the documentation and/or other materials provided 14 | with the distribution. 15 | 16 | * Neither the name of Oleg Grenrus nor the names of other 17 | contributors may be used to endorse or promote products derived 18 | from this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # cabal-refact 2 | 3 | A tool for editing `.cabal` files. 4 | 5 | ## Synopsis 6 | 7 | ``` 8 | $ grep aeson example.cabal 9 | 10 | $ cabal-refact edit-bound aeson '<1.1' '< 1.2' 11 | 12 | $ grep aeson example.cabal 13 | ``` 14 | 15 | *NOTE:* not yet implemented! 16 | 17 | ## Installing 18 | 19 | Currently `cabal-refact` isn't released on Hackage. To install, clone this repository 20 | and `cabal new-build && cp dist-newstyle/**/cabal-refact/cabal-refact ~/.local/bin` 21 | or `stack install` 22 | 23 | ## Example refactorings 24 | 25 | See haddock documentation for the rest of the refactorings. 26 | 27 | ### Identity 28 | 29 | This is refactoring is important for testing that parser and pretty-printer 30 | are able to do formatting-preserving roundtrip. 31 | 32 | ``` 33 | $ cabal-refact identity --dry fixtures/increase-revision/focus.cabal 34 | no changes 35 | ``` 36 | 37 | ### Increase revision 38 | 39 | Increase `x-revision` counter, or add `x-revision: 1` after the `name` field, if 40 | `x-revision` field doesn't exist. 41 | 42 | ``` 43 | $ cabal-refact increase-revision --dry fixtures/increase-revision/focus.cabal 44 | ======================================================================== 45 | name: 46 | focus 47 | + x-revision: 48 | + 1 49 | version: 50 | 0.1.5 51 | synopsis: 52 | ``` 53 | 54 | ### Populate extra source files 55 | 56 | Populate `extra-source-files` field using comment pragma. 57 | 58 | ``` 59 | $ cabal-refact populate-extra-source-files --dry cabal-refact.cabal 60 | ======================================================================== 61 | CHANGELOG.md 62 | README.md 63 | -- cabal-refact-populate: fixtures/**/*.* 64 | + fixtures/identity/Agda.cabal 65 | + fixtures/identity/JuicyPixels.cabal 66 | + fixtures/identity/QuickCheck.cabal 67 | ... 68 | ``` 69 | -------------------------------------------------------------------------------- /Setup.lhs: -------------------------------------------------------------------------------- 1 | \begin{code} 2 | {-# LANGUAGE CPP #-} 3 | {-# OPTIONS_GHC -Wall #-} 4 | module Main (main) where 5 | 6 | #ifndef MIN_VERSION_cabal_doctest 7 | #define MIN_VERSION_cabal_doctest(x,y,z) 0 8 | #endif 9 | 10 | #if MIN_VERSION_cabal_doctest(1,0,0) 11 | 12 | import Distribution.Extra.Doctest ( defaultMainWithDoctests ) 13 | main :: IO () 14 | main = defaultMainWithDoctests "doctests" 15 | 16 | #else 17 | 18 | #ifdef MIN_VERSION_Cabal 19 | -- If the macro is defined, we have new cabal-install, 20 | -- but for some reason we don't have cabal-doctest in package-db 21 | -- 22 | -- Probably we are running cabal sdist, when otherwise using new-build 23 | -- workflow 24 | #warning You are configuring this package without cabal-doctest installed. \ 25 | The doctests test-suite will not work as a result. \ 26 | To fix this, install cabal-doctest before configuring. 27 | #endif 28 | 29 | import Distribution.Simple 30 | 31 | main :: IO () 32 | main = defaultMain 33 | 34 | #endif 35 | 36 | \end{code} 37 | -------------------------------------------------------------------------------- /cabal-refact.cabal: -------------------------------------------------------------------------------- 1 | name: cabal-refact 2 | version: 0 3 | synopsis: Refactor tool for .cabal files 4 | description: Refactor tool for .cabal files, supporting among all things the build-depends editing. 5 | category: Web 6 | homepage: https://github.com/phadej/cabal-refact#readme 7 | bug-reports: https://github.com/phadej/cabal-refact/issues 8 | author: Oleg Grenrus 9 | maintainer: Oleg Grenrus 10 | license: BSD3 11 | license-file: LICENSE 12 | tested-with: GHC == 8.0.1 13 | build-type: Custom 14 | cabal-version: >= 1.10 15 | 16 | extra-source-files: 17 | CHANGELOG.md 18 | README.md 19 | -- cabal-refact-populate: fixtures/**/*.* 20 | fixtures/identity/Agda.cabal 21 | fixtures/identity/JuicyPixels.cabal 22 | fixtures/identity/QuickCheck.cabal 23 | fixtures/identity/adjunctions.cabal 24 | fixtures/identity/aeson.cabal 25 | fixtures/identity/arithmoi.cabal 26 | fixtures/identity/bound.cabal 27 | fixtures/identity/cabal-refact.cabal 28 | fixtures/identity/doctest.cabal 29 | fixtures/identity/fake-deps.cabal 30 | fixtures/identity/free.cabal 31 | fixtures/identity/hackage-cli.cabal 32 | fixtures/identity/haddock.cabal 33 | fixtures/identity/hashable.cabal 34 | fixtures/identity/haxl.cabal 35 | fixtures/identity/lens.cabal 36 | fixtures/identity/md2sht.cabal 37 | fixtures/identity/recursion-schemes.cabal 38 | fixtures/identity/scientific.cabal 39 | fixtures/identity/servant-mock.cabal 40 | fixtures/identity/stack.cabal 41 | fixtures/identity/stylish-haskell.cabal 42 | fixtures/identity/these.cabal 43 | fixtures/identity/uniform-pair.cabal 44 | fixtures/identity/unordered-containers.cabal 45 | fixtures/identity/vector-algorithms.cabal 46 | fixtures/identity/vector.cabal 47 | fixtures/increase-revision/cabal-refact.cabal 48 | fixtures/increase-revision/cabal-refact.cabal.output 49 | fixtures/increase-revision/focus.cabal 50 | fixtures/increase-revision/focus.cabal.output 51 | fixtures/increase-revision/focus2.cabal 52 | fixtures/increase-revision/focus2.cabal.output 53 | fixtures/populate-extra-source-files/cabal-refact.cabal 54 | fixtures/populate-extra-source-files/cabal-refact.cabal.output 55 | fixtures/populate-extra-source-files/cabal-refact2.cabal 56 | fixtures/populate-extra-source-files/cabal-refact2.cabal.output 57 | fixtures/set-version/cabal-refact.cabal 58 | fixtures/set-version/cabal-refact.cabal.output 59 | fixtures/set-version/focus.cabal 60 | fixtures/set-version/focus.cabal.output 61 | fixtures/set-version/focus2.cabal 62 | fixtures/set-version/focus2.cabal.output 63 | 64 | source-repository head 65 | type: git 66 | location: https://github.com/phadej/aeson-compat 67 | 68 | custom-setup 69 | setup-depends: 70 | base >= 4 && <5, 71 | Cabal, 72 | cabal-doctest >= 1 && <1.1 73 | 74 | -- Comment 75 | library 76 | hs-source-dirs: 77 | src 78 | ghc-options: -Wall 79 | build-depends: base >=4.9 && <4.10, 80 | ansi-wl-pprint, 81 | bytestring, 82 | composition-extra == 2.0.*, 83 | deriving-compat >= 0.3.5 && <0.4, 84 | directory, 85 | filepath, 86 | indentation-trifecta == 0.0.1, 87 | lens >=4.15.1 && <4.16, 88 | mtl >= 2.2.1 && <2.3, 89 | parsers >=0.12.4 && <0.13, 90 | Glob, 91 | regex-applicative, 92 | regex-applicative-text, 93 | semigroupoids, 94 | text, 95 | these, 96 | trifecta >=1.6.1 && <1.7, 97 | vector >=0.11 && <0.13 98 | exposed-modules: 99 | Distribution.Refact 100 | Distribution.Refact.Internal.Prelude 101 | Distribution.Refact.Annotations 102 | Distribution.Refact.Parser 103 | Distribution.Refact.Pretty 104 | Distribution.Refact.Refactoring.Identity 105 | Distribution.Refact.Refactoring.IncreaseRevision 106 | Distribution.Refact.Refactoring.PopulateExtraSourceFiles 107 | Distribution.Refact.Refactoring.SetVersion 108 | Distribution.Refact.Tools.Edit 109 | Distribution.Refact.Tools.Edit.Algorithm 110 | Distribution.Refact.Tools.Pretty 111 | Distribution.Refact.Tools.Trifecta 112 | Distribution.Refact.Types.Pos 113 | Distribution.Refact.Types.Refactoring 114 | Distribution.Refact.Types.Structure 115 | Distribution.Refact.Types.Version 116 | default-language: Haskell2010 117 | other-extensions: 118 | DeriveFunctor 119 | DeriveFoldable 120 | DeriveTraversable 121 | GeneralizedNewtypeDeriving 122 | ScopedTypeVariables 123 | TupleSections 124 | 125 | executable cabal-refact 126 | default-language: Haskell2010 127 | main-is: Main.hs 128 | hs-source-dirs : cli 129 | build-depends: 130 | base, 131 | cabal-refact, 132 | filepath, 133 | text, 134 | optparse-applicative == 0.13.* 135 | 136 | test-suite doctests 137 | default-language: Haskell2010 138 | type: exitcode-stdio-1.0 139 | main-is: doctests.hs 140 | ghc-options: -Wall -threaded 141 | hs-source-dirs: tests 142 | 143 | build-depends: 144 | base, 145 | directory, 146 | filepath, 147 | doctest >= 0.11 && <0.12 148 | 149 | test-suite tests 150 | default-language: Haskell2010 151 | type : exitcode-stdio-1.0 152 | main-is : Tests.hs 153 | hs-source-dirs : tests 154 | build-depends: 155 | base, 156 | cabal-refact, 157 | directory, 158 | filepath, 159 | text, 160 | tasty, 161 | tasty-hunit 162 | -------------------------------------------------------------------------------- /cli/Main.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE OverloadedStrings #-} 2 | module Main (main) where 3 | 4 | import Prelude () 5 | import Distribution.Refact.Internal.Prelude 6 | import Distribution.Refact 7 | 8 | import System.FilePath (takeDirectory) 9 | 10 | import qualified Data.Text as T 11 | import qualified Data.Text.IO as T 12 | import qualified Options.Applicative as O 13 | 14 | ------------------------------------------------------------------------------- 15 | -- Command line options 16 | ------------------------------------------------------------------------------- 17 | 18 | -- | Common options 19 | data Opts = Opts 20 | { optsDry :: !Bool 21 | } 22 | deriving (Show) 23 | 24 | -- TODO: use own data type(s), not 'Bool' 25 | 26 | action :: O.Parser (IO ()) 27 | action = (\o c a -> c o a) <$> opts <*> O.subparser cmds <*> args 28 | where 29 | cmds :: O.Mod O.CommandFields Action 30 | cmds = mconcat 31 | [ command "identity" "Identity refactoring, should be no-op" 32 | $ pure identityAction 33 | , command "increase-revision" "Increase the x-revision field" 34 | $ pure increaseRevisionAction 35 | , command "set-revision" "Set the x-revision field" 36 | $ setRevisionAction <$> rev 37 | , command "populate-extra-source-files" 38 | "Populate extra-source-field using specified globs" 39 | $ pure populateExtraSourceFilesAction 40 | ] 41 | 42 | command c d p = O.command c $ O.info (O.helper <*> p) $ mconcat 43 | [ O.fullDesc 44 | , O.progDesc d 45 | ] 46 | 47 | args :: O.Parser [FilePath] 48 | args = many $ O.strArgument $ mconcat 49 | [ O.metavar "pkg.cabal" 50 | ] 51 | 52 | opts :: O.Parser Opts 53 | opts = Opts 54 | <$> optsDryParser 55 | where 56 | optsDryParser = fromMaybe True . lastOf folded <$> many optsDryParser' 57 | optsDryParser' = O.flag' True flagDry <|> O.flag' False flagInplace 58 | flagDry = O.short 'd' <> O.long "dry" 59 | <> O.help "Dry run - do not modify files" 60 | flagInplace = O.short 'i' <> O.long "inplace" 61 | <> O.help "Modify files in place" 62 | 63 | rev :: O.Parser Int 64 | rev = O.argument O.auto $ mconcat 65 | [ O.metavar ":revision" 66 | ] 67 | 68 | ------------------------------------------------------------------------------- 69 | -- Refactorings 70 | ------------------------------------------------------------------------------- 71 | 72 | type Action = Opts -> [FilePath] -> IO () 73 | 74 | identityAction :: Action 75 | identityAction = refactMany identityRefactoring 76 | 77 | increaseRevisionAction :: Action 78 | increaseRevisionAction = refactMany increaseRevisionRefactoring 79 | 80 | setRevisionAction :: Int -> Action 81 | setRevisionAction = refactMany . setRevisionRefactoring 82 | 83 | populateExtraSourceFilesAction :: Action 84 | populateExtraSourceFilesAction = refactManyWith 85 | (getDirectoryContentsRecursive' notDistsStackWork . takeDirectory) 86 | populateExtraSourceFilesRefactoring 87 | 88 | ------------------------------------------------------------------------------- 89 | -- Utilities 90 | ------------------------------------------------------------------------------- 91 | 92 | refactMany :: Refactoring -> Action 93 | refactMany r opts = traverse_ (refact r opts) 94 | 95 | refact :: Refactoring -> Opts -> FilePath -> IO () 96 | refact r opts fp = do 97 | input <- (<> "\n") . T.strip <$> T.readFile fp 98 | fields <- fromResult (parseFields fp input) 99 | let fields' = posFields . r . delFields $ fields 100 | let output = prettyFields fields' 101 | displayDiff input output 102 | case () of 103 | _ | output == input -> pure () 104 | _ | optsDry opts -> putStrLn "INFO: Dry run, not modifying file" 105 | _ | otherwise -> do 106 | putStrLn $ "Writing back to " <> fp 107 | T.writeFile fp output 108 | where 109 | fromResult (Success a) = pure a 110 | fromResult (Failure xs) = do 111 | displayDoc $ _errDoc xs 112 | fail "PARSE ERROR" 113 | 114 | refactManyWith :: (FilePath -> IO b) -> (b -> Refactoring) -> Action 115 | refactManyWith f r opts = traverse_ (refactWith f r opts) 116 | 117 | refactWith :: (FilePath -> IO b) -> (b -> Refactoring) -> Opts -> FilePath -> IO () 118 | refactWith f r opts fp = do 119 | b <- f fp 120 | refact (r b) opts fp 121 | 122 | ------------------------------------------------------------------------------- 123 | -- Main 124 | ------------------------------------------------------------------------------- 125 | 126 | main :: IO () 127 | main = join (O.execParser opts) 128 | where 129 | opts = O.info (O.helper <*> action) $ mconcat 130 | [ O.fullDesc 131 | , O.progDesc "Programmatically edit cabal files" 132 | , O.header "cabal-refact - edit cabal files" 133 | ] 134 | -------------------------------------------------------------------------------- /fixtures/identity/JuicyPixels.cabal: -------------------------------------------------------------------------------- 1 | Name: JuicyPixels 2 | Version: 3.2.8 3 | Synopsis: Picture loading/serialization (in png, jpeg, bitmap, gif, tga, tiff and radiance) 4 | Description: 5 | <> 6 | . 7 | This library can load and store images in PNG,Bitmap, Jpeg, Radiance, Tiff and Gif images. 8 | 9 | homepage: https://github.com/Twinside/Juicy.Pixels 10 | License: BSD3 11 | License-file: LICENSE 12 | Author: Vincent Berthoux 13 | Maintainer: vincent.berthoux@gmail.com 14 | Category: Codec, Graphics, Image 15 | Stability: Stable 16 | Build-type: Simple 17 | 18 | -- Constraint on the version of Cabal needed to build this package. 19 | Cabal-version: >= 1.10 20 | 21 | extra-source-files: changelog, docimages/*.png, docimages/*.svg, README.md 22 | extra-doc-files: docimages/*.png, docimages/*.svg 23 | 24 | Source-Repository head 25 | Type: git 26 | Location: git://github.com/Twinside/Juicy.Pixels.git 27 | 28 | Source-Repository this 29 | Type: git 30 | Location: git://github.com/Twinside/Juicy.Pixels.git 31 | Tag: v3.2.8 32 | 33 | Flag Mmap 34 | Description: Enable the file loading via mmap (memory map) 35 | Default: False 36 | 37 | Executable toPng 38 | hs-source-dirs: test-src 39 | Default-Language: Haskell2010 40 | Main-Is: toPng.hs 41 | Ghc-options: -O3 -Wall 42 | Ghc-prof-options: -rtsopts -Wall -prof -auto-all 43 | Include-Dirs: src/Codec/Picture 44 | -- -cpp -prof -auto-all -rtsopts -caf-all -fforce-recomp 45 | Build-depends: base, 46 | bytestring, 47 | JuicyPixels, 48 | mtl, 49 | MonadRandom, 50 | vector 51 | 52 | Test-suite imageTest 53 | type: exitcode-stdio-1.0 54 | hs-source-dirs: test-src 55 | Default-Language: Haskell2010 56 | Main-Is: main.hs 57 | Ghc-options: -O3 -Wall 58 | Ghc-prof-options: -rtsopts -Wall -prof -auto-all 59 | -- -O3 -Wall 60 | -- 61 | -- -ddump-simpl 62 | -- 63 | Include-Dirs: src/Codec/Picture 64 | -- -cpp -prof -auto-all -rtsopts -caf-all -fforce-recomp 65 | Build-depends: base, 66 | bytestring, mtl, binary, zlib, transformers, 67 | vector, primitive, deepseq, 68 | filepath >= 1.3, 69 | criterion >= 1.0, 70 | JuicyPixels 71 | 72 | if flag(Mmap) 73 | Build-depends: mmap 74 | CC-Options: "-DWITH_MMAP_BYTESTRING" 75 | 76 | Benchmark imageBenchmark 77 | type: exitcode-stdio-1.0 78 | hs-source-dirs: test-src 79 | Default-Language: Haskell2010 80 | Main-Is: main.hs 81 | Ghc-options: -O3 -Wall 82 | Ghc-prof-options: -rtsopts -Wall -prof -auto-all 83 | -- -O3 -Wall 84 | -- 85 | -- -ddump-simpl 86 | -- 87 | Include-Dirs: src/Codec/Picture 88 | -- -cpp -prof -auto-all -rtsopts -caf-all -fforce-recomp 89 | Build-depends: base, 90 | bytestring, mtl, binary, zlib, transformers, 91 | vector, primitive, deepseq, 92 | filepath >= 1.3, 93 | criterion >= 1.0, 94 | JuicyPixels 95 | 96 | if flag(Mmap) 97 | Build-depends: mmap 98 | CC-Options: "-DWITH_MMAP_BYTESTRING" 99 | 100 | Library 101 | hs-source-dirs: src 102 | Default-Language: Haskell2010 103 | Exposed-modules: Codec.Picture, 104 | Codec.Picture.Bitmap, 105 | Codec.Picture.Gif, 106 | Codec.Picture.Png, 107 | Codec.Picture.Jpg, 108 | Codec.Picture.HDR, 109 | Codec.Picture.Tga, 110 | Codec.Picture.Tiff, 111 | Codec.Picture.Metadata, 112 | Codec.Picture.Metadata.Exif, 113 | Codec.Picture.Saving, 114 | Codec.Picture.Types, 115 | Codec.Picture.ColorQuant 116 | 117 | Ghc-options: -O3 -Wall 118 | Build-depends: base >= 4.5 && < 5, 119 | bytestring >= 0.9 && < 0.11, 120 | mtl >= 1.1 && < 2.3, 121 | binary >= 0.5 && < 0.9, 122 | zlib >= 0.5.3.1 && < 0.7, 123 | transformers >= 0.2, 124 | vector >= 0.10 && < 0.13, 125 | primitive >= 0.4 && < 0.7, 126 | deepseq >= 1.1 && < 1.5, 127 | containers >= 0.4.2 && < 0.6 128 | 129 | if flag(Mmap) 130 | Build-depends: mmap 131 | CC-Options: "-DWITH_MMAP_BYTESTRING" 132 | 133 | -- Modules not exported by this package. 134 | Other-modules: Codec.Picture.Jpg.DefaultTable, 135 | Codec.Picture.Jpg.Metadata, 136 | Codec.Picture.Jpg.FastIdct, 137 | Codec.Picture.Jpg.FastDct, 138 | Codec.Picture.Jpg.Types, 139 | Codec.Picture.Jpg.Common, 140 | Codec.Picture.Jpg.Progressive, 141 | Codec.Picture.Gif.LZW, 142 | Codec.Picture.Gif.LZWEncoding, 143 | Codec.Picture.Png.Export, 144 | Codec.Picture.Png.Type, 145 | Codec.Picture.Png.Metadata, 146 | Codec.Picture.Tiff.Metadata, 147 | Codec.Picture.Tiff.Types, 148 | Codec.Picture.BitWriter, 149 | Codec.Picture.InternalHelper, 150 | Codec.Picture.VectorByteConversion 151 | 152 | Install-Includes: src/Codec/Picture/ConvGraph.hs 153 | Include-Dirs: src/Codec/Picture 154 | -------------------------------------------------------------------------------- /fixtures/identity/QuickCheck.cabal: -------------------------------------------------------------------------------- 1 | Name: QuickCheck 2 | Version: 2.9.2 3 | Cabal-Version: >= 1.8 4 | Build-type: Simple 5 | License: BSD3 6 | License-file: LICENSE 7 | Extra-source-files: README changelog 8 | Copyright: 2000-2016 Koen Claessen, 2006-2008 Björn Bringert, 2009-2016 Nick Smallbone 9 | Author: Koen Claessen 10 | Maintainer: QuickCheck developers 11 | Bug-reports: mailto:quickcheck@projects.haskell.org 12 | Tested-with: GHC >= 7 13 | Homepage: https://github.com/nick8325/quickcheck 14 | Category: Testing 15 | Synopsis: Automatic testing of Haskell programs 16 | Description: 17 | QuickCheck is a library for random testing of program properties. 18 | . 19 | The programmer provides a specification of the program, in 20 | the form of properties which functions should satisfy, and 21 | QuickCheck then tests that the properties hold in a large number 22 | of randomly generated cases. 23 | . 24 | Specifications are expressed in 25 | Haskell, using combinators defined in the QuickCheck library. 26 | QuickCheck provides combinators to define properties, observe 27 | the distribution of test data, and define test 28 | data generators. 29 | . 30 | You can find a (slightly out-of-date but useful) manual at 31 | . 32 | . 33 | There are several useful QuickCheck-related packages developed by other people: 34 | . 35 | * - `Arbitrary` instances which are not included in QuickCheck itself. 36 | * - a monad transformer based on `Gen`. 37 | * - high-quality automatic `Arbitrary` instances using Template Haskell. 38 | 39 | source-repository head 40 | type: git 41 | location: https://github.com/nick8325/quickcheck 42 | 43 | source-repository this 44 | type: git 45 | location: https://github.com/nick8325/quickcheck 46 | tag: 2.9.2 47 | 48 | flag templateHaskell 49 | Description: Build Test.QuickCheck.All, which uses Template Haskell. 50 | Default: True 51 | 52 | library 53 | Build-depends: base >=4.3 && <5, random, containers, array 54 | 55 | -- Modules that are always built. 56 | Exposed-Modules: 57 | Test.QuickCheck, 58 | Test.QuickCheck.Arbitrary, 59 | Test.QuickCheck.Gen, 60 | Test.QuickCheck.Gen.Unsafe, 61 | Test.QuickCheck.Monadic, 62 | Test.QuickCheck.Modifiers, 63 | Test.QuickCheck.Property, 64 | Test.QuickCheck.Test, 65 | Test.QuickCheck.Text, 66 | Test.QuickCheck.Poly, 67 | Test.QuickCheck.State, 68 | Test.QuickCheck.Random, 69 | Test.QuickCheck.Exception 70 | 71 | -- GHC-specific modules. 72 | if impl(ghc) 73 | Exposed-Modules: Test.QuickCheck.Function 74 | Build-depends: transformers >= 0.2 75 | else 76 | cpp-options: -DNO_TRANSFORMERS 77 | 78 | if impl(ghc) && flag(templateHaskell) && !impl(haste) 79 | Build-depends: template-haskell >= 2.4 80 | Other-Extensions: TemplateHaskell 81 | Exposed-Modules: Test.QuickCheck.All 82 | else 83 | cpp-options: -DNO_TEMPLATE_HASKELL 84 | 85 | if !impl(ghc >= 7.4) 86 | cpp-options: -DNO_CTYPES 87 | 88 | -- The new generics appeared in GHC 7.2... 89 | if impl(ghc < 7.2) 90 | cpp-options: -DNO_GENERICS 91 | -- ...but in 7.2-7.4 it lives in the ghc-prim package. 92 | if impl(ghc >= 7.2) && impl(ghc < 7.6) 93 | Build-depends: ghc-prim 94 | 95 | -- Safe Haskell appeared in GHC 7.2, but GHC.Generics isn't safe until 7.4. 96 | if impl (ghc < 7.4) 97 | cpp-options: -DNO_SAFE_HASKELL 98 | 99 | -- Use tf-random on newer GHCs. 100 | if impl(ghc) && !impl(haste) 101 | Build-depends: tf-random >= 0.4 102 | else 103 | cpp-options: -DNO_TF_RANDOM 104 | 105 | if impl(ghc) 106 | -- 'Data.Proxy' is available in base only since GHC 7.8 / base-4.7 107 | if impl(ghc < 7.8) 108 | build-depends: tagged>=0.8.5 109 | else 110 | cpp-options: -DNO_PROXY 111 | 112 | if !impl(ghc >= 7.6) 113 | cpp-options: -DNO_POLYKINDS 114 | 115 | if impl(ghc) 116 | if impl(ghc < 7.10) 117 | -- `Numeric.Natural` is available in base only since GHC 7.10 / base 4.8 118 | build-depends: nats>=1 119 | else 120 | cpp-options: -DNO_NATURALS 121 | 122 | if impl(ghc) 123 | -- 'Data.List.NonEmpty' is available in base only since GHC 8.0 / base 4.9 124 | if impl(ghc < 8.0) 125 | build-depends: semigroups >=0.9 126 | else 127 | cpp-options: -DNO_NONEMPTY 128 | 129 | -- Switch off most optional features on non-GHC systems. 130 | if !impl(ghc) 131 | -- If your Haskell compiler can cope without some of these, please 132 | -- send a message to the QuickCheck mailing list! 133 | cpp-options: -DNO_TIMEOUT -DNO_NEWTYPE_DERIVING -DNO_GENERICS -DNO_TEMPLATE_HASKELL -DNO_SAFE_HASKELL 134 | if !impl(hugs) && !impl(uhc) 135 | cpp-options: -DNO_ST_MONAD -DNO_MULTI_PARAM_TYPE_CLASSES 136 | 137 | -- LANGUAGE pragmas don't have any effect in Hugs. 138 | if impl(hugs) 139 | Extensions: CPP 140 | 141 | if impl(uhc) 142 | -- Cabal under UHC needs pointing out all the dependencies of the 143 | -- random package. 144 | Build-depends: old-time, old-locale 145 | -- Plus some bits of the standard library are missing. 146 | cpp-options: -DNO_FIXED -DNO_EXCEPTIONS 147 | 148 | Test-Suite test-quickcheck 149 | type: exitcode-stdio-1.0 150 | hs-source-dirs: 151 | examples 152 | main-is: Heap.hs 153 | build-depends: base, QuickCheck 154 | if !flag(templateHaskell) || impl(haste) 155 | Buildable: False 156 | 157 | Test-Suite test-quickcheck-gcoarbitrary 158 | type: exitcode-stdio-1.0 159 | hs-source-dirs: tests 160 | main-is: GCoArbitraryExample.hs 161 | build-depends: base, QuickCheck 162 | if !impl(ghc >= 7.2) || impl(haste) 163 | buildable: False 164 | if impl(ghc >= 7.2) && impl(ghc < 7.6) 165 | build-depends: ghc-prim 166 | 167 | Test-Suite test-quickcheck-generators 168 | type: exitcode-stdio-1.0 169 | hs-source-dirs: tests 170 | main-is: Generators.hs 171 | build-depends: base, QuickCheck 172 | if !flag(templateHaskell) || impl(haste) 173 | Buildable: False 174 | 175 | Test-Suite test-quickcheck-gshrink 176 | type: exitcode-stdio-1.0 177 | hs-source-dirs: tests 178 | main-is: GShrinkExample.hs 179 | build-depends: base, QuickCheck 180 | if !impl(ghc >= 7.2) || impl(haste) 181 | buildable: False 182 | if impl(ghc >= 7.2) && impl(ghc < 7.6) 183 | build-depends: ghc-prim 184 | -------------------------------------------------------------------------------- /fixtures/identity/adjunctions.cabal: -------------------------------------------------------------------------------- 1 | name: adjunctions 2 | category: Data Structures, Adjunctions 3 | version: 4.3 4 | license: BSD3 5 | cabal-version: >= 1.8 6 | license-file: LICENSE 7 | author: Edward A. Kmett 8 | maintainer: Edward A. Kmett 9 | stability: provisional 10 | homepage: http://github.com/ekmett/adjunctions/ 11 | bug-reports: http://github.com/ekmett/adjunctions/issues 12 | copyright: Copyright (C) 2011-2014 Edward A. Kmett 13 | synopsis: Adjunctions and representable functors 14 | description: Adjunctions and representable functors 15 | build-type: Simple 16 | extra-source-files: 17 | .gitignore 18 | .travis.yml 19 | .vim.custom 20 | travis/cabal-apt-install 21 | travis/config 22 | HLint.hs 23 | CHANGELOG.markdown 24 | README.markdown 25 | 26 | source-repository head 27 | type: git 28 | location: git://github.com/ekmett/adjunctions.git 29 | 30 | library 31 | hs-source-dirs: src 32 | 33 | other-extensions: 34 | CPP 35 | FunctionalDependencies 36 | FlexibleContexts 37 | MultiParamTypeClasses 38 | Rank2Types 39 | UndecidableInstances 40 | 41 | build-depends: 42 | array >= 0.3.0.2 && < 0.7, 43 | base >= 4 && < 5, 44 | comonad >= 4 && < 6, 45 | containers >= 0.3 && < 0.6, 46 | contravariant >= 1 && < 2, 47 | distributive >= 0.5.1 && < 1, 48 | free >= 4 && < 5, 49 | mtl >= 2.0.1 && < 2.3, 50 | profunctors >= 4 && < 6, 51 | tagged >= 0.7 && < 1, 52 | semigroupoids >= 4 && < 6, 53 | semigroups >= 0.11 && < 1, 54 | transformers >= 0.2 && < 0.6, 55 | transformers-compat >= 0.3 && < 1, 56 | void >= 0.5.5.1 && < 1 57 | 58 | if impl(ghc < 7.6) 59 | build-depends: ghc-prim 60 | 61 | exposed-modules: 62 | Control.Comonad.Representable.Store 63 | Control.Comonad.Trans.Adjoint 64 | Control.Monad.Representable.Reader 65 | Control.Monad.Representable.State 66 | Control.Monad.Trans.Adjoint 67 | Control.Monad.Trans.Contravariant.Adjoint 68 | Control.Monad.Trans.Conts 69 | Data.Functor.Adjunction 70 | Data.Functor.Contravariant.Adjunction 71 | Data.Functor.Contravariant.Rep 72 | Data.Functor.Rep 73 | 74 | ghc-options: -Wall 75 | 76 | test-suite spec 77 | type: exitcode-stdio-1.0 78 | hs-source-dirs: tests 79 | 80 | build-depends: 81 | adjunctions, 82 | base >= 4 && < 5, 83 | distributive >= 0.5.1 && < 1, 84 | generic-deriving >= 1.11 && < 2, 85 | hspec >= 2 && < 3 86 | 87 | main-is: Spec.hs 88 | other-modules: GenericsSpec 89 | 90 | ghc-options: -Wall -threaded -rtsopts 91 | -------------------------------------------------------------------------------- /fixtures/identity/aeson.cabal: -------------------------------------------------------------------------------- 1 | name: aeson 2 | version: 1.1.0.0 3 | license: BSD3 4 | license-file: LICENSE 5 | category: Text, Web, JSON 6 | copyright: (c) 2011-2016 Bryan O'Sullivan 7 | (c) 2011 MailRank, Inc. 8 | author: Bryan O'Sullivan 9 | maintainer: Adam Bergmark 10 | stability: experimental 11 | tested-with: GHC == 7.4.2, GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.1 12 | synopsis: Fast JSON parsing and encoding 13 | cabal-version: >= 1.10 14 | homepage: https://github.com/bos/aeson 15 | bug-reports: https://github.com/bos/aeson/issues 16 | build-type: Simple 17 | description: 18 | A JSON parsing and encoding library optimized for ease of use 19 | and high performance. 20 | . 21 | To get started, see the documentation for the @Data.Aeson@ module 22 | below. 23 | . 24 | Parsing performance on a late 2013 MacBook Pro (2.6GHz Core i7), 25 | running 64-bit GHC 7.10.1, for mostly-English tweets from Twitter's 26 | JSON search API: 27 | . 28 | * 6.4 KB payloads, English: 7570 msg\/sec (47.6 MB\/sec) 29 | . 30 | * 14.6 KB payloads, Japanese: 3261 msg\/sec (46.6 MB\/sec) 31 | . 32 | Encoding performance on the same machine and data: 33 | . 34 | * 6.4 KB payloads, English: 22738 msg\/sec (142.9 MB\/sec) 35 | . 36 | * 14.6 KB payloads, Japanese: 15911 msg\/sec (227.4 MB\/sec) 37 | . 38 | (A note on naming: in Greek mythology, Aeson was the father of Jason.) 39 | 40 | extra-source-files: 41 | README.markdown 42 | benchmarks/*.cabal 43 | benchmarks/*.hs 44 | benchmarks/*.py 45 | benchmarks/Compare/*.hs 46 | benchmarks/Makefile 47 | benchmarks/Typed/*.hs 48 | benchmarks/json-data/*.json 49 | include/overlapping-compat.h 50 | include/incoherent-compat.h 51 | changelog.md 52 | examples/*.cabal 53 | examples/*.hs 54 | examples/Twitter/*.hs 55 | include/*.h 56 | cbits/*.c 57 | 58 | flag developer 59 | description: operate in developer mode 60 | default: False 61 | manual: True 62 | 63 | flag fast 64 | description: compile without optimizations 65 | default: False 66 | manual: True 67 | 68 | flag bytestring-builder 69 | description: Depend on the bytestring-builder package for backwards compatibility. 70 | default: False 71 | manual: False 72 | 73 | library 74 | default-language: Haskell2010 75 | 76 | exposed-modules: 77 | Data.Aeson 78 | Data.Aeson.Encoding 79 | Data.Aeson.Parser 80 | Data.Aeson.Text 81 | Data.Aeson.Types 82 | Data.Aeson.TH 83 | 84 | Data.Aeson.Encoding.Internal 85 | Data.Aeson.Internal 86 | Data.Aeson.Internal.Time 87 | 88 | -- Deprecated modules 89 | exposed-modules: 90 | Data.Aeson.Encode 91 | 92 | other-modules: 93 | Data.Aeson.Encoding.Builder 94 | Data.Aeson.Internal.Functions 95 | Data.Aeson.Parser.Internal 96 | Data.Aeson.Parser.Unescape 97 | Data.Aeson.Parser.Time 98 | Data.Aeson.Types.FromJSON 99 | Data.Aeson.Types.Generic 100 | Data.Aeson.Types.ToJSON 101 | Data.Aeson.Types.Class 102 | Data.Aeson.Types.Internal 103 | 104 | build-depends: 105 | attoparsec >= 0.13.0.1, 106 | base >= 4.5 && < 5, 107 | base-compat >= 0.9.1 && < 0.10, 108 | containers >= 0.2.4.1, 109 | deepseq >= 1.3, 110 | dlist >= 0.2, 111 | ghc-prim >= 0.2, 112 | hashable >= 1.1.2.0, 113 | scientific >= 0.3.4.7 && < 0.4, 114 | tagged >=0.8.3 && <0.9, 115 | template-haskell >= 2.7, 116 | text >= 1.1.1.0, 117 | time >= 1.1.1.4, 118 | time-locale-compat >= 0.1.1 && < 0.2, 119 | unordered-containers >= 0.2.5.0, 120 | uuid-types >= 1.0.3 && <1.1, 121 | vector >= 0.8 122 | 123 | if flag(bytestring-builder) 124 | build-depends: bytestring >= 0.9 && < 0.10.4, 125 | bytestring-builder >= 0.10.4 && < 1 126 | else 127 | build-depends: bytestring >= 0.10.4 128 | 129 | if !impl(ghc >= 8.0) 130 | -- `Data.Semigroup` and `Control.Monad.Fail` and `Control.Monad.IO.Class` are available in base only since GHC 8.0 / base 4.9 131 | build-depends: 132 | semigroups >= 0.18.2 && < 0.19, 133 | transformers >= 0.2.2.0, 134 | transformers-compat >= 0.3, 135 | fail == 4.9.* 136 | 137 | if !impl(ghc >= 7.10) 138 | -- `Numeric.Natural` is available in base only since GHC 7.10 / base 4.8 139 | build-depends: nats >= 1 && < 1.2 140 | 141 | ghc-options: -Wall 142 | 143 | if flag(developer) 144 | ghc-options: -Werror 145 | ghc-prof-options: -auto-all 146 | 147 | if flag(fast) 148 | ghc-options: -O0 149 | else 150 | ghc-options: -O2 151 | 152 | include-dirs: include 153 | c-sources: cbits/unescape_string.c 154 | 155 | test-suite tests 156 | default-language: Haskell2010 157 | type: exitcode-stdio-1.0 158 | hs-source-dirs: tests 159 | main-is: Tests.hs 160 | other-modules: 161 | DataFamilies.Properties 162 | DataFamilies.Instances 163 | DataFamilies.Encoders 164 | DataFamilies.Types 165 | Encoders 166 | ErrorMessages 167 | Functions 168 | Instances 169 | Options 170 | Properties 171 | SerializationFormatSpec 172 | Types 173 | UnitTests 174 | UnitTests.NullaryConstructors 175 | 176 | ghc-options: -Wall -threaded -rtsopts 177 | 178 | build-depends: 179 | HUnit, 180 | QuickCheck >= 2.8 && <2.9.3, 181 | aeson, 182 | integer-logarithms >= 1 && <1.1, 183 | attoparsec, 184 | base, 185 | base-compat, 186 | base-orphans >= 0.5.3 && <0.6, 187 | base16-bytestring, 188 | containers, 189 | directory, 190 | dlist, 191 | filepath, 192 | generic-deriving >= 1.10 && < 1.12, 193 | ghc-prim >= 0.2, 194 | hashable >= 1.2.4.0, 195 | scientific, 196 | tagged, 197 | template-haskell, 198 | test-framework, 199 | test-framework-hunit, 200 | test-framework-quickcheck2, 201 | text, 202 | time, 203 | time-locale-compat, 204 | unordered-containers, 205 | uuid-types, 206 | vector, 207 | quickcheck-instances >=0.3.12 208 | 209 | if flag(bytestring-builder) 210 | build-depends: bytestring >= 0.9 && < 0.10.4, 211 | bytestring-builder >= 0.10.4 && < 1 212 | else 213 | build-depends: bytestring >= 0.10.4 214 | 215 | if !impl(ghc >= 8.0) 216 | build-depends: 217 | semigroups >= 0.18.2 && < 0.19, 218 | transformers >= 0.2.2.0, 219 | transformers-compat >= 0.3 220 | 221 | if !impl(ghc >= 7.10) 222 | build-depends: nats >=1 && <1.2 223 | 224 | if impl(ghc >= 7.8) 225 | build-depends: hashable-time >= 0.2 && <0.3 226 | 227 | source-repository head 228 | type: git 229 | location: git://github.com/bos/aeson.git 230 | -------------------------------------------------------------------------------- /fixtures/identity/arithmoi.cabal: -------------------------------------------------------------------------------- 1 | name : arithmoi 2 | version : 0.4.3.0 3 | cabal-version : >= 1.10 4 | author : Daniel Fischer 5 | copyright : (c) 2011 Daniel Fischer 6 | license : MIT 7 | license-file : LICENSE 8 | maintainer : Carter Schonwald carter at wellposed dot com 9 | build-type : Simple 10 | stability : Provisional 11 | homepage : https://github.com/cartazio/arithmoi 12 | bug-reports : https://github.com/cartazio/arithmoi/issues 13 | 14 | synopsis : Efficient basic number-theoretic functions. 15 | Primes, powers, integer logarithms. 16 | description : A library of basic functionality needed for 17 | number-theoretic calculations. The aim of this library 18 | is to provide efficient implementations of the functions. 19 | 20 | Primes and related things (totients, factorisation), 21 | powers (integer roots and tests, modular exponentiation), 22 | integer logarithms. 23 | 24 | category : Math, Algorithms, Number Theory 25 | 26 | tested-with : GHC==7.8.4, GHC==7.10.3, GHC==8.0.1 27 | 28 | extra-source-files : Changes, TODO 29 | 30 | flag check-bounds 31 | description : Replace unsafe array operations with safe ones 32 | default : False 33 | manual : True 34 | 35 | library 36 | default-language: Haskell2010 37 | build-depends : base >= 4.7 && < 5 38 | , array >= 0.5 && < 0.6 39 | , ghc-prim < 0.6 40 | , integer-gmp < 1.1 41 | , containers >= 0.5 && < 0.6 42 | , random >= 1.0 && < 1.2 43 | , mtl >= 2.0 && < 2.3 44 | , exact-pi >= 0.4.1.1 45 | if impl(ghc < 7.10) 46 | build-depends : nats >= 1 && <1.2 47 | if impl(ghc < 8.0) 48 | build-depends : semigroups >= 0.8 49 | 50 | exposed-modules : Math.NumberTheory.ArithmeticFunctions 51 | Math.NumberTheory.ArithmeticFunctions.Class 52 | Math.NumberTheory.ArithmeticFunctions.Standard 53 | Math.NumberTheory.Logarithms 54 | Math.NumberTheory.Moduli 55 | Math.NumberTheory.MoebiusInversion 56 | Math.NumberTheory.MoebiusInversion.Int 57 | Math.NumberTheory.Recurrencies.Bilinear 58 | Math.NumberTheory.Recurrencies.Linear 59 | Math.NumberTheory.GaussianIntegers 60 | Math.NumberTheory.GCD 61 | Math.NumberTheory.GCD.LowLevel 62 | Math.NumberTheory.Powers 63 | Math.NumberTheory.Powers.Squares 64 | Math.NumberTheory.Powers.Squares.Internal 65 | Math.NumberTheory.Powers.Cubes 66 | Math.NumberTheory.Powers.Fourth 67 | Math.NumberTheory.Powers.General 68 | Math.NumberTheory.Powers.Integer 69 | Math.NumberTheory.Primes 70 | Math.NumberTheory.Primes.Sieve 71 | Math.NumberTheory.Primes.Factorisation 72 | Math.NumberTheory.Primes.Factorisation.Certified 73 | Math.NumberTheory.Primes.Counting 74 | Math.NumberTheory.Primes.Testing 75 | Math.NumberTheory.Primes.Testing.Certificates 76 | Math.NumberTheory.Primes.Heap 77 | Math.NumberTheory.UniqueFactorisation 78 | Math.NumberTheory.Zeta 79 | other-modules : Math.NumberTheory.Utils 80 | Math.NumberTheory.Unsafe 81 | Math.NumberTheory.Primes.Counting.Impl 82 | Math.NumberTheory.Primes.Counting.Approximate 83 | Math.NumberTheory.Primes.Factorisation.Montgomery 84 | Math.NumberTheory.Primes.Factorisation.Utils 85 | Math.NumberTheory.Primes.Factorisation.TrialDivision 86 | Math.NumberTheory.Primes.Sieve.Eratosthenes 87 | Math.NumberTheory.Primes.Sieve.Indexing 88 | Math.NumberTheory.Primes.Sieve.Misc 89 | Math.NumberTheory.Primes.Testing.Probabilistic 90 | Math.NumberTheory.Primes.Testing.Certified 91 | Math.NumberTheory.Primes.Testing.Certificates.Internal 92 | other-extensions : BangPatterns 93 | 94 | ghc-options : -O2 -Wall 95 | ghc-prof-options : -O2 -auto 96 | if flag(check-bounds) 97 | cpp-options : -DCheckBounds 98 | 99 | source-repository head 100 | type: git 101 | location: https://github.com/cartazio/arithmoi 102 | 103 | 104 | benchmark criterion 105 | build-depends: base 106 | , arithmoi 107 | , criterion 108 | , containers 109 | , random 110 | if impl(ghc < 7.10) 111 | build-depends : nats >= 1 && <1.2 112 | other-modules: Math.NumberTheory.ArithmeticFunctionsBench 113 | , Math.NumberTheory.PowersBench 114 | , Math.NumberTheory.RecurrenciesBench 115 | hs-source-dirs: benchmark 116 | main-is: Bench.hs 117 | type: exitcode-stdio-1.0 118 | default-language: Haskell2010 119 | 120 | test-suite spec 121 | type: exitcode-stdio-1.0 122 | hs-source-dirs: test-suite 123 | ghc-options: -Wall 124 | main-is: Test.hs 125 | default-language: Haskell2010 126 | build-depends: base >= 4.6 && < 5 127 | , containers >= 0.5 && < 0.6 128 | , arithmoi >= 0.4 && < 0.5 129 | , tasty >= 0.10 && < 0.12 130 | , tasty-smallcheck >= 0.8 && < 0.9 131 | , tasty-quickcheck >= 0.8 && < 0.9 132 | , tasty-hunit >= 0.9 && < 0.10 133 | , QuickCheck >= 2.7.6 && < 2.10 134 | , smallcheck >= 1.1 && < 1.2 135 | , transformers >= 0.5 136 | if impl(ghc < 7.10) 137 | build-depends : nats >= 1 && <1.2 138 | 139 | other-modules : Math.NumberTheory.ArithmeticFunctionsTests 140 | , Math.NumberTheory.GaussianIntegersTests 141 | , Math.NumberTheory.GCDTests 142 | , Math.NumberTheory.GCD.LowLevelTests 143 | , Math.NumberTheory.LogarithmsTests 144 | , Math.NumberTheory.Recurrencies.LinearTests 145 | , Math.NumberTheory.Recurrencies.BilinearTests 146 | , Math.NumberTheory.ModuliTests 147 | , Math.NumberTheory.Powers.CubesTests 148 | , Math.NumberTheory.MoebiusInversionTests 149 | , Math.NumberTheory.MoebiusInversion.IntTests 150 | , Math.NumberTheory.Powers.FourthTests 151 | , Math.NumberTheory.Powers.GeneralTests 152 | , Math.NumberTheory.Powers.IntegerTests 153 | , Math.NumberTheory.Powers.SquaresTests 154 | , Math.NumberTheory.PrimesTests 155 | , Math.NumberTheory.Primes.CountingTests 156 | , Math.NumberTheory.Primes.HeapTests 157 | , Math.NumberTheory.Primes.SieveTests 158 | , Math.NumberTheory.TestUtils 159 | , Math.NumberTheory.TestUtils.Wrappers 160 | , Math.NumberTheory.TestUtils.Compose 161 | , Math.NumberTheory.UniqueFactorisationTests 162 | , Math.NumberTheory.ZetaTests 163 | -------------------------------------------------------------------------------- /fixtures/identity/bound.cabal: -------------------------------------------------------------------------------- 1 | name: bound 2 | category: Language, Compilers/Interpreters 3 | version: 2 4 | license: BSD3 5 | cabal-version: >= 1.9.2 6 | license-file: LICENSE 7 | author: Edward A. Kmett 8 | maintainer: Edward A. Kmett 9 | stability: experimental 10 | homepage: http://github.com/ekmett/bound/ 11 | bug-reports: http://github.com/ekmett/bound/issues 12 | copyright: Copyright (C) 2012-2013 Edward A. Kmett 13 | synopsis: Making de Bruijn Succ Less 14 | build-type: Custom 15 | description: 16 | We represent the target language itself as an ideal monad supplied by the 17 | user, and provide a 'Scope' monad transformer for introducing bound variables 18 | in user supplied terms. Users supply a 'Monad' and 'Traversable' instance, 19 | and we traverse to find free variables, and use the Monad to perform 20 | substitution that avoids bound variables. 21 | . 22 | Slides describing and motivating this approach to name binding are available 23 | online at: 24 | . 25 | 26 | . 27 | The goal of this package is to make it as easy as possible to deal with name 28 | binding without forcing an awkward monadic style on the user. 29 | . 30 | With generalized de Bruijn term you can 'lift' whole trees instead of just 31 | applying 'succ' to individual variables, weakening the all variables bound 32 | by a scope and greatly speeding up instantiation. By giving binders more 33 | structure we permit easy simultaneous substitution and further speed up 34 | instantiation. 35 | 36 | extra-source-files: 37 | .travis.yml 38 | .ghci 39 | .gitignore 40 | .vim.custom 41 | examples/Simple.hs 42 | examples/Deriving.hs 43 | examples/Overkill.hs 44 | tests/doctests.hs 45 | travis/cabal-apt-install 46 | travis/config 47 | README.markdown 48 | CHANGELOG.markdown 49 | AUTHORS.markdown 50 | 51 | flag template-haskell 52 | description: 53 | You can disable the use of the `template-haskell` package using `-f-template-haskell`. 54 | . 55 | Disabling this is an unsupported configuration, but it may be useful for accelerating builds in sandboxes for expert users. 56 | default: True 57 | manual: True 58 | 59 | source-repository head 60 | type: git 61 | location: git://github.com/ekmett/bound.git 62 | 63 | library 64 | hs-source-dirs: src 65 | 66 | exposed-modules: 67 | Bound 68 | Bound.Class 69 | Bound.Name 70 | Bound.Scope 71 | Bound.Scope.Simple 72 | Bound.Term 73 | Bound.TH 74 | Bound.Var 75 | 76 | build-depends: 77 | base >= 4 && < 5, 78 | bifunctors >= 3 && < 6, 79 | binary >= 0.5 && < 0.9, 80 | bytes >= 0.4 && < 1, 81 | cereal >= 0.3.5.2 && < 0.6, 82 | comonad >= 3 && < 6, 83 | hashable >= 1.1 && < 1.3, 84 | hashable-extras >= 0.1 && < 1, 85 | profunctors >= 3.3 && < 6, 86 | template-haskell >= 2.7 && < 3, 87 | transformers >= 0.2 && < 0.6, 88 | transformers-compat >= 0.5 && < 1 89 | 90 | ghc-options: -Wall -O2 -fspec-constr -fdicts-cheap -funbox-strict-fields 91 | 92 | if impl(ghc >=7.4 && < 7.6) 93 | build-depends: ghc-prim 94 | 95 | if flag(template-haskell) && impl(ghc) 96 | build-depends: template-haskell >= 2.7 && < 3.0 97 | 98 | test-suite Simple 99 | type: exitcode-stdio-1.0 100 | main-is: Simple.hs 101 | hs-source-dirs: examples 102 | buildable: True 103 | 104 | ghc-options: -Wall -threaded 105 | build-depends: 106 | base, 107 | bound, 108 | deriving-compat >=0.3.4 && <0.4, 109 | transformers, 110 | transformers-compat 111 | 112 | test-suite Overkill 113 | type: exitcode-stdio-1.0 114 | main-is: Overkill.hs 115 | hs-source-dirs: examples 116 | ghc-options: -Wall -threaded -main-is Overkill 117 | build-depends: 118 | base, 119 | bound, 120 | transformers, 121 | transformers-compat, 122 | vector 123 | if !impl(ghc >= 7.8) 124 | buildable: False 125 | 126 | test-suite Deriving 127 | type: exitcode-stdio-1.0 128 | main-is: Deriving.hs 129 | hs-source-dirs: examples 130 | ghc-options: -Wall -threaded -main-is Deriving 131 | build-depends: 132 | base, 133 | bound, 134 | transformers, 135 | transformers-compat 136 | 137 | test-suite Imperative 138 | type: exitcode-stdio-1.0 139 | main-is: Imperative.hs 140 | hs-source-dirs: examples 141 | ghc-options: -Wall -threaded -main-is Imperative 142 | build-depends: 143 | base, 144 | bound, 145 | transformers, 146 | transformers-compat, 147 | void 148 | 149 | test-suite doctests 150 | type: exitcode-stdio-1.0 151 | main-is: doctests.hs 152 | hs-source-dirs: tests 153 | ghc-options: -Wall -threaded 154 | build-depends: 155 | base, 156 | directory >= 1.0 && < 1.3, 157 | doctest >= 0.9 && < 0.12, 158 | filepath, 159 | vector >= 0.9 && < 0.13, 160 | void 161 | -------------------------------------------------------------------------------- /fixtures/identity/cabal-refact.cabal: -------------------------------------------------------------------------------- 1 | name: cabal-refact 2 | version: 0 3 | synopsis: Refactor tool for .cabal files 4 | description: Refactor tool for .cabal files, supporting among all things the build-depends editing. 5 | category: Web 6 | homepage: https://github.com/phadej/cabal-refact#readme 7 | bug-reports: https://github.com/phadej/cabal-refact/issues 8 | author: Oleg Grenrus 9 | maintainer: Oleg Grenrus 10 | license: BSD3 11 | license-file: LICENSE 12 | tested-with: GHC == 8.0.1 13 | build-type: Custom 14 | cabal-version: >= 1.10 15 | 16 | extra-source-files: 17 | CHANGELOG.md 18 | README.md 19 | 20 | source-repository head 21 | type: git 22 | location: https://github.com/phadej/aeson-compat 23 | 24 | -- Comment 25 | library 26 | hs-source-dirs: 27 | src 28 | ghc-options: -Wall 29 | build-depends: base >=4.9 && <4.10, 30 | parsers >=0.12.4 && <0.13, 31 | trifecta >=1.6.1 && <1.7, 32 | indentation-trifecta == 0.0.1, 33 | composition-extra == 2.0.*, 34 | lens >=4.15.1 && <4.16, 35 | mtl >= 2.2.1 && <2.3, 36 | semigroupoids, 37 | ansi-wl-pprint, 38 | these, 39 | bytestring, 40 | text, 41 | vector >=0.11 && <0.13 42 | exposed-modules: 43 | Distribution.Refact 44 | Distribution.Refact.Internal.Prelude 45 | Distribution.Refact.Annotations 46 | Distribution.Refact.Parser 47 | Distribution.Refact.Pretty 48 | Distribution.Refact.Tools.Edit 49 | Distribution.Refact.Tools.Edit.Algorithm 50 | Distribution.Refact.Tools.Pretty 51 | Distribution.Refact.Tools.Trifecta 52 | Distribution.Refact.Types.Pos 53 | Distribution.Refact.Types.Structure 54 | default-language: Haskell2010 55 | other-extensions: 56 | DeriveFunctor 57 | DeriveFoldable 58 | DeriveTraversable 59 | GeneralizedNewtypeDeriving 60 | ScopedTypeVariables 61 | TupleSections 62 | 63 | executable cabal-refact 64 | default-language: Haskell2010 65 | main-is: Main.hs 66 | hs-source-dirs : cli 67 | build-depends: 68 | base, 69 | cabal-refact, 70 | optparse-applicative == 0.13.* 71 | 72 | test-suite doctests 73 | type: exitcode-stdio-1.0 74 | main-is: doctests.hs 75 | ghc-options: -Wall -threaded 76 | hs-source-dirs: tests 77 | 78 | build-tools: hsc2hs 79 | build-depends: 80 | base, 81 | directory, 82 | filepath, 83 | doctest >= 0.11 && <0.12 84 | 85 | test-suite tests 86 | default-language: Haskell2010 87 | type : exitcode-stdio-1.0 88 | main-is : Tests.hs 89 | hs-source-dirs : tests 90 | build-depends: 91 | base, 92 | cabal-refact, 93 | trifecta, 94 | composition-extra == 2.0.*, 95 | text, 96 | mtl, 97 | indentation-trifecta == 0.0.1 98 | -------------------------------------------------------------------------------- /fixtures/identity/doctest.cabal: -------------------------------------------------------------------------------- 1 | name: doctest 2 | version: 0.11.0 3 | synopsis: Test interactive Haskell examples 4 | description: The doctest program checks examples in source code comments. 5 | It is modeled after doctest for Python 6 | (). 7 | . 8 | Documentation is at 9 | . 10 | category: Testing 11 | bug-reports: https://github.com/sol/doctest/issues 12 | homepage: https://github.com/sol/doctest#readme 13 | license: MIT 14 | license-file: LICENSE 15 | copyright: (c) 2009-2015 Simon Hengel 16 | author: Simon Hengel 17 | maintainer: Simon Hengel 18 | build-type: Simple 19 | cabal-version: >= 1.8 20 | extra-source-files: example/example.cabal 21 | , example/src/Example.hs 22 | , example/test/doctests.hs 23 | 24 | source-repository head 25 | type: git 26 | location: https://github.com/sol/doctest 27 | 28 | library 29 | exposed-modules: 30 | Test.DocTest 31 | ghc-options: 32 | -Wall 33 | hs-source-dirs: 34 | src, ghci-wrapper/src 35 | other-modules: 36 | Extract 37 | , GhcUtil 38 | , Interpreter 39 | , Location 40 | , Help 41 | , PackageDBs 42 | , Parse 43 | , Paths_doctest 44 | , Property 45 | , Runner 46 | , Runner.Example 47 | , Run 48 | , Util 49 | , Sandbox 50 | , Language.Haskell.GhciWrapper 51 | build-depends: 52 | base == 4.* 53 | , base-compat >= 0.4.2 54 | , ghc >= 7.0 && < 8.2 55 | , syb >= 0.3 56 | , deepseq 57 | , directory 58 | , filepath 59 | , process 60 | , ghc-paths >= 0.1.0.9 61 | , transformers 62 | 63 | executable doctest 64 | main-is: 65 | Main.hs 66 | ghc-options: 67 | -Wall -threaded 68 | hs-source-dirs: 69 | driver 70 | build-depends: 71 | base == 4.* 72 | , doctest 73 | 74 | test-suite spec 75 | main-is: 76 | Spec.hs 77 | type: 78 | exitcode-stdio-1.0 79 | ghc-options: 80 | -Wall -threaded 81 | cpp-options: 82 | -DTEST 83 | hs-source-dirs: 84 | test, src, ghci-wrapper/src 85 | c-sources: 86 | test/integration/with-cbits/foo.c 87 | build-depends: 88 | base 89 | , ghc 90 | , syb 91 | , deepseq 92 | , directory 93 | , filepath 94 | , process 95 | , ghc-paths 96 | , transformers 97 | 98 | , base-compat 99 | , HUnit 100 | , hspec >= 1.5.1 101 | , QuickCheck >= 2.8.2 102 | , stringbuilder >= 0.4 103 | , silently >= 1.2.4 104 | , setenv 105 | , with-location 106 | 107 | test-suite doctests 108 | main-is: 109 | doctests.hs 110 | type: 111 | exitcode-stdio-1.0 112 | ghc-options: 113 | -Wall -threaded 114 | hs-source-dirs: 115 | test 116 | build-depends: 117 | base 118 | , doctest 119 | -------------------------------------------------------------------------------- /fixtures/identity/fake-deps.cabal: -------------------------------------------------------------------------------- 1 | name: fake-deps 2 | version: 0.0 3 | synopsis: Not a real package. Just dependencies to appease Travis 4 | description: None 5 | maintainer: Aleksey Kliger 6 | category: Fake 7 | build-type: Simple 8 | cabal-version: >=1.10 9 | tested-with: GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.1 10 | 11 | library 12 | hs-source-dirs: src 13 | build-depends: base >=4.6 && <4.10, 14 | mtl >=2.1, 15 | trifecta >=1.4 && <1.6, 16 | parsers >=0.10 && <0.13, 17 | parsec >=3.1.5 18 | default-language: Haskell2010 19 | ghc-options: -Wall 20 | 21 | test-suite test-indentation 22 | main-is: indentation-parsec/tests/all-tests.hs 23 | default-language: 24 | Haskell2010 25 | type: 26 | exitcode-stdio-1.0 27 | build-depends: 28 | base >= 4 && < 5 29 | , tasty >= 0.10 30 | , tasty-hunit >= 0.9 31 | , fake-deps 32 | -------------------------------------------------------------------------------- /fixtures/identity/free.cabal: -------------------------------------------------------------------------------- 1 | name: free 2 | category: Control, Monads 3 | version: 5 4 | license: BSD3 5 | cabal-version: >= 1.10 6 | license-file: LICENSE 7 | author: Edward A. Kmett 8 | maintainer: Edward A. Kmett 9 | stability: provisional 10 | homepage: http://github.com/ekmett/free/ 11 | bug-reports: http://github.com/ekmett/free/issues 12 | copyright: Copyright (C) 2008-2015 Edward A. Kmett 13 | tested-with: GHC == 7.4.2, GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.2 14 | synopsis: Monads for free 15 | description: 16 | Free monads are useful for many tree-like structures and domain specific languages. 17 | . 18 | If @f@ is a 'Functor' then the free 'Monad' on @f@ is the type 19 | of trees whose nodes are labeled with the constructors of @f@. The word 20 | \"free\" is used in the sense of \"unrestricted\" rather than \"zero-cost\": 21 | @Free f@ makes no constraining assumptions beyond those given by @f@ and the 22 | definition of 'Monad'. As used here it is a standard term from the 23 | mathematical theory of adjoint functors. 24 | . 25 | Cofree comonads are dual to free monads. They provide convenient ways to talk 26 | about branching streams and rose-trees, and can be used to annotate syntax 27 | trees. The cofree comonad can be seen as a stream parameterized by a 'Functor' 28 | that controls its branching factor. 29 | . 30 | More information on free monads, including examples, can be found in the 31 | following blog posts: 32 | 33 | 34 | 35 | build-type: Simple 36 | extra-source-files: 37 | .ghci 38 | .gitignore 39 | .travis.yml 40 | .vim.custom 41 | README.markdown 42 | CHANGELOG.markdown 43 | HLint.hs 44 | doc/proof/Control/Comonad/Cofree/*.md 45 | doc/proof/Control/Comonad/Trans/Cofree/*.md 46 | examples/*.hs 47 | examples/*.lhs 48 | include/free-common.h 49 | extra-doc-files: 50 | examples/*.hs 51 | examples/*.lhs 52 | 53 | source-repository head 54 | type: git 55 | location: git://github.com/ekmett/free.git 56 | 57 | library 58 | hs-source-dirs: src 59 | include-dirs: include 60 | includes: free-common.h 61 | 62 | default-language: Haskell2010 63 | default-extensions: CPP 64 | other-extensions: 65 | MultiParamTypeClasses 66 | FunctionalDependencies 67 | FlexibleInstances 68 | UndecidableInstances 69 | Rank2Types 70 | GADTs 71 | 72 | build-depends: 73 | base == 4.*, 74 | bifunctors >= 4 && < 6, 75 | comonad >= 4 && < 6, 76 | distributive >= 0.2.1, 77 | mtl >= 2.0.1.0 && < 2.3, 78 | profunctors >= 4 && < 6, 79 | semigroupoids >= 4 && < 6, 80 | semigroups >= 0.8.3.1 && < 1, 81 | transformers >= 0.2.0 && < 0.6, 82 | transformers-compat >= 0.3 && < 1, 83 | template-haskell >= 2.7.0.0 && < 3, 84 | exceptions >= 0.6 && < 0.9, 85 | containers < 0.6 86 | 87 | exposed-modules: 88 | Control.Applicative.Free 89 | Control.Applicative.Free.Final 90 | Control.Applicative.Trans.Free 91 | Control.Alternative.Free 92 | Control.Alternative.Free.Final 93 | Control.Comonad.Cofree 94 | Control.Comonad.Cofree.Class 95 | Control.Comonad.Trans.Cofree 96 | Control.Comonad.Trans.Coiter 97 | Control.Monad.Free 98 | Control.Monad.Free.Ap 99 | Control.Monad.Free.Church 100 | Control.Monad.Free.Class 101 | Control.Monad.Free.TH 102 | Control.Monad.Trans.Free 103 | Control.Monad.Trans.Free.Ap 104 | Control.Monad.Trans.Free.Church 105 | Control.Monad.Trans.Iter 106 | 107 | other-modules: 108 | Data.Functor.Classes.Compat 109 | 110 | ghc-options: -Wall 111 | -------------------------------------------------------------------------------- /fixtures/identity/hackage-cli.cabal: -------------------------------------------------------------------------------- 1 | name: hackage-cli 2 | version: 0.1.0.0 3 | synopsis: CLI tool for Hackage 4 | homepage: https://github.com/hvr/hackage-cli 5 | license: GPL-3 6 | license-file: LICENSE 7 | author: Herbert Valerio Riedel 8 | maintainer: hvr@gnu.org 9 | category: Development 10 | build-type: Simple 11 | cabal-version: >=1.10 12 | tested-with: GHC==8.0.1 13 | 14 | source-repository head 15 | Type: git 16 | Location: https://github.com/hvr/hackage-cli.git 17 | 18 | executable hackage-cli 19 | default-language: Haskell2010 20 | other-extensions: 21 | LambdaCase 22 | OverloadedStrings 23 | RecordWildCards 24 | TemplateHaskell 25 | 26 | hs-source-dirs: src 27 | main-is: Main.hs 28 | 29 | other-modules: 30 | IndexShaSum 31 | Distribution.Server.Util.CabalRevisions 32 | Paths_hackage_cli 33 | 34 | build-depends: 35 | Cabal >=1.24 && <1.25, 36 | HsOpenSSL >=0.11 && <0.12, 37 | aeson >=1.0 && <1.1, 38 | base >=4.8 && <4.10, 39 | blaze-builder >=0.3 && <0.5, 40 | bytestring >=0.10.4 && <0.11, 41 | containers >=0.5 && <0.6, 42 | deepseq >=1.4 && <1.5, 43 | directory >=1.2 && <1.3, 44 | filepath >=1.4 && <1.5, 45 | http-streams >=0.7 && <0.9, 46 | io-streams >=1.2 && <1.4, 47 | lens >=4.9 && <4.15, 48 | mtl >=2.2 && <2.3, 49 | netrc >=0.2 && <0.3, 50 | optparse-applicative >=0.13 && <0.14, 51 | pretty >=1.1.2 && <1.2, 52 | split >=0.2 && <0.3, 53 | stringsearch >=0.3.6 && <0.4, 54 | tagsoup >=0.14 && <0.15, 55 | tar >=0.5 && <0.6, 56 | text >=1.2 && <1.3, 57 | time >=1.5 && <1.7, 58 | unordered-containers >=0.2.7&& <0.3, 59 | zlib >=0.6.1 && <0.7 60 | 61 | ghc-options: -Wall -threaded 62 | -------------------------------------------------------------------------------- /fixtures/identity/haddock.cabal: -------------------------------------------------------------------------------- 1 | name: haddock 2 | version: 2.17.3 3 | synopsis: A documentation-generation tool for Haskell libraries 4 | description: Haddock is a documentation-generation tool for Haskell 5 | libraries 6 | license: BSD3 7 | license-file: LICENSE 8 | author: Simon Marlow, David Waern 9 | maintainer: Simon Hengel , Mateusz Kowalczyk 10 | homepage: http://www.haskell.org/haddock/ 11 | bug-reports: https://github.com/haskell/haddock/issues 12 | copyright: (c) Simon Marlow, David Waern 13 | category: Documentation 14 | build-type: Simple 15 | cabal-version: >= 1.10 16 | stability: experimental 17 | 18 | extra-source-files: 19 | CHANGES 20 | README.md 21 | doc/Makefile 22 | doc/README.md 23 | doc/*.rst 24 | doc/conf.py 25 | haddock-api/src/haddock.sh 26 | html-test/src/*.hs 27 | html-test/ref/*.html 28 | hypsrc-test/src/*.hs 29 | hypsrc-test/ref/src/*.html 30 | latex-test/src/Simple/*.hs 31 | latex-test/ref/Simple/*.tex 32 | latex-test/ref/Simple/*.sty 33 | 34 | flag in-ghc-tree 35 | description: Are we in a GHC tree? 36 | default: False 37 | manual: True 38 | 39 | executable haddock 40 | default-language: Haskell2010 41 | main-is: Main.hs 42 | hs-source-dirs: driver 43 | ghc-options: -funbox-strict-fields -Wall -fwarn-tabs -O2 -threaded 44 | 45 | build-depends: 46 | base >= 4.3 && < 4.10 47 | if flag(in-ghc-tree) 48 | hs-source-dirs: haddock-api/src, haddock-library/vendor/attoparsec-0.12.1.1, haddock-library/src 49 | cpp-options: -DIN_GHC_TREE 50 | build-depends: 51 | filepath, 52 | directory, 53 | containers, 54 | deepseq, 55 | array, 56 | xhtml >= 3000.2 && < 3000.3, 57 | Cabal >= 1.10, 58 | ghc-boot, 59 | ghc >= 7.11 && < 8.1, 60 | bytestring, 61 | transformers 62 | 63 | other-modules: 64 | ResponseFile, 65 | 66 | Documentation.Haddock.Parser 67 | Documentation.Haddock.Parser.Monad 68 | Documentation.Haddock.Types 69 | Documentation.Haddock.Doc 70 | Data.Attoparsec 71 | Data.Attoparsec.ByteString 72 | Data.Attoparsec.ByteString.Buffer 73 | Data.Attoparsec.ByteString.Char8 74 | Data.Attoparsec.ByteString.FastSet 75 | Data.Attoparsec.ByteString.Internal 76 | Data.Attoparsec.Combinator 77 | Data.Attoparsec.Internal 78 | Data.Attoparsec.Internal.Fhthagn 79 | Data.Attoparsec.Internal.Types 80 | Data.Attoparsec.Number 81 | Documentation.Haddock.Utf8 82 | Documentation.Haddock.Parser.Util 83 | 84 | Documentation.Haddock 85 | Haddock 86 | Haddock.Interface 87 | Haddock.Interface.Rename 88 | Haddock.Interface.Create 89 | Haddock.Interface.AttachInstances 90 | Haddock.Interface.LexParseRn 91 | Haddock.Interface.ParseModuleHeader 92 | Haddock.Interface.Specialize 93 | Haddock.Parser 94 | Haddock.Utils 95 | Haddock.Backends.Xhtml 96 | Haddock.Backends.Xhtml.Decl 97 | Haddock.Backends.Xhtml.DocMarkup 98 | Haddock.Backends.Xhtml.Layout 99 | Haddock.Backends.Xhtml.Names 100 | Haddock.Backends.Xhtml.Themes 101 | Haddock.Backends.Xhtml.Types 102 | Haddock.Backends.Xhtml.Utils 103 | Haddock.Backends.LaTeX 104 | Haddock.Backends.HaddockDB 105 | Haddock.Backends.Hoogle 106 | Haddock.Backends.Hyperlinker 107 | Haddock.Backends.Hyperlinker.Ast 108 | Haddock.Backends.Hyperlinker.Parser 109 | Haddock.Backends.Hyperlinker.Renderer 110 | Haddock.Backends.Hyperlinker.Types 111 | Haddock.Backends.Hyperlinker.Utils 112 | Haddock.ModuleTree 113 | Haddock.Types 114 | Haddock.Doc 115 | Haddock.Version 116 | Haddock.InterfaceFile 117 | Haddock.Options 118 | Haddock.GhcUtils 119 | Haddock.Syb 120 | Haddock.Convert 121 | else 122 | build-depends: haddock-api == 2.17.* 123 | 124 | test-suite driver-test 125 | type: exitcode-stdio-1.0 126 | default-language: Haskell2010 127 | main-is: Main.hs 128 | hs-source-dirs: driver-test, driver 129 | build-depends: base, hspec 130 | 131 | test-suite html-test 132 | type: exitcode-stdio-1.0 133 | default-language: Haskell2010 134 | main-is: Main.hs 135 | hs-source-dirs: html-test 136 | build-depends: base, filepath, haddock-test == 0.0.1 137 | 138 | test-suite hypsrc-test 139 | type: exitcode-stdio-1.0 140 | default-language: Haskell2010 141 | main-is: Main.hs 142 | hs-source-dirs: hypsrc-test 143 | build-depends: base, filepath, haddock-test == 0.0.1 144 | ghc-options: -Wall -fwarn-tabs 145 | 146 | test-suite latex-test 147 | type: exitcode-stdio-1.0 148 | default-language: Haskell2010 149 | main-is: Main.hs 150 | hs-source-dirs: latex-test 151 | build-depends: base, filepath, haddock-test == 0.0.1 152 | 153 | test-suite hoogle-test 154 | type: exitcode-stdio-1.0 155 | default-language: Haskell2010 156 | main-is: Main.hs 157 | hs-source-dirs: hoogle-test 158 | build-depends: base, filepath, haddock-test == 0.0.1 159 | 160 | source-repository head 161 | type: git 162 | location: https://github.com/haskell/haddock.git 163 | -------------------------------------------------------------------------------- /fixtures/identity/hashable.cabal: -------------------------------------------------------------------------------- 1 | Name: hashable 2 | Version: 1.2.6.0 3 | Synopsis: A class for types that can be converted to a hash value 4 | Description: This package defines a class, 'Hashable', for types that 5 | can be converted to a hash value. This class 6 | exists for the benefit of hashing-based data 7 | structures. The package provides instances for 8 | basic types and a way to combine hash values. 9 | Homepage: http://github.com/tibbe/hashable 10 | License: BSD3 11 | License-file: LICENSE 12 | Author: Milan Straka 13 | Johan Tibell 14 | Maintainer: johan.tibell@gmail.com 15 | bug-reports: https://github.com/tibbe/hashable/issues 16 | Stability: Provisional 17 | Category: Data 18 | Build-type: Simple 19 | Cabal-version: >=1.8 20 | -- tests/Properties.hs shouldn't have to go here, but the source files 21 | -- for the test-suite stanzas don't get picked up by `cabal sdist`. 22 | Extra-source-files: 23 | CHANGES.md, README.md, tests/Properties.hs, 24 | benchmarks/Benchmarks.hs, benchmarks/cbits/*.c, benchmarks/cbits/*.h 25 | 26 | Flag integer-gmp 27 | Description: Are we using integer-gmp to provide fast Integer instances? 28 | Default: True 29 | 30 | Flag sse2 31 | Description: Do we want to assume that a target supports SSE 2? 32 | Default: True 33 | Manual: True 34 | 35 | Flag sse41 36 | Description: Do we want to assume that a target supports SSE 4.1? 37 | Default: False 38 | Manual: True 39 | 40 | Flag examples 41 | Description: Build example modules 42 | Default: False 43 | Manual: True 44 | 45 | Library 46 | Exposed-modules: Data.Hashable 47 | Data.Hashable.Lifted 48 | Other-modules: Data.Hashable.Class 49 | Build-depends: base >= 4.0 && < 4.10, 50 | bytestring >= 0.9 && < 0.11 51 | if impl(ghc) 52 | Build-depends: ghc-prim, 53 | text >= 0.11.0.5 54 | if impl(ghc) && flag(integer-gmp) 55 | Build-depends: integer-gmp >= 0.2 56 | 57 | if impl(ghc >= 7.2.1) 58 | CPP-Options: -DGENERICS 59 | Other-modules: Data.Hashable.Generic 60 | 61 | C-sources: 62 | cbits/fnv.c 63 | 64 | Ghc-options: -Wall 65 | if impl(ghc >= 6.8) 66 | Ghc-options: -fwarn-tabs 67 | else 68 | c-sources: cbits/getRandomBytes.c 69 | other-modules: Data.Hashable.RandomSource 70 | if os(windows) 71 | extra-libraries: advapi32 72 | 73 | Test-suite tests 74 | Type: exitcode-stdio-1.0 75 | Hs-source-dirs: tests 76 | Main-is: Main.hs 77 | Other-modules: Properties Regress 78 | Build-depends: base >= 4.0 && < 5.0, 79 | bytestring, 80 | ghc-prim, 81 | hashable, 82 | test-framework >= 0.3.3, 83 | test-framework-hunit, 84 | test-framework-quickcheck2 >= 0.2.9, 85 | HUnit, 86 | QuickCheck >= 2.4.0.1, 87 | random >= 1.0 && < 1.2, 88 | text >= 0.11.0.5 89 | if !os(windows) 90 | Build-depends: unix 91 | CPP-options: -DHAVE_MMAP 92 | Other-modules: Regress.Mmap 93 | 94 | Ghc-options: -Wall -fno-warn-orphans 95 | if impl(ghc >= 7.2.1) 96 | CPP-Options: -DGENERICS 97 | 98 | benchmark benchmarks 99 | -- We cannot depend on the hashable library directly as that creates 100 | -- a dependency cycle. 101 | hs-source-dirs: . benchmarks 102 | 103 | main-is: Benchmarks.hs 104 | other-modules: 105 | Data.Hashable 106 | Data.Hashable.Class 107 | Data.Hashable.RandomSource 108 | Data.Hashable.SipHash 109 | type: exitcode-stdio-1.0 110 | 111 | build-depends: 112 | base, 113 | bytestring, 114 | criterion >= 1.0, 115 | ghc-prim, 116 | siphash, 117 | text 118 | 119 | if impl(ghc) 120 | Build-depends: ghc-prim, 121 | text >= 0.11.0.5 122 | if impl(ghc) && flag(integer-gmp) 123 | Build-depends: integer-gmp >= 0.2 124 | 125 | if impl(ghc >= 7.2.1) 126 | CPP-Options: -DGENERICS 127 | 128 | include-dirs: 129 | benchmarks/cbits 130 | 131 | includes: 132 | siphash.h 133 | 134 | c-sources: 135 | benchmarks/cbits/inthash.c 136 | benchmarks/cbits/siphash.c 137 | benchmarks/cbits/wang.c 138 | cbits/fnv.c 139 | 140 | if (arch(i386) || arch(x86_64)) && flag(sse2) 141 | cpp-options: -DHAVE_SSE2 142 | c-sources: 143 | benchmarks/cbits/siphash-sse2.c 144 | 145 | if flag(sse41) 146 | cpp-options: -DHAVE_SSE41 147 | c-sources: 148 | benchmarks/cbits/siphash-sse41.c 149 | 150 | Ghc-options: -Wall -O2 151 | if impl(ghc >= 6.8) 152 | Ghc-options: -fwarn-tabs 153 | else 154 | c-sources: cbits/getRandomBytes.c 155 | other-modules: Data.Hashable.RandomSource 156 | if os(windows) 157 | extra-libraries: advapi32 158 | 159 | 160 | Executable hashable-examples 161 | if flag(examples) 162 | build-depends: base, hashable 163 | else 164 | buildable: False 165 | hs-source-dirs: examples 166 | main-is: Main.hs 167 | 168 | source-repository head 169 | type: git 170 | location: https://github.com/tibbe/hashable.git 171 | -------------------------------------------------------------------------------- /fixtures/identity/haxl.cabal: -------------------------------------------------------------------------------- 1 | name: haxl 2 | version: 0.5.0.0 3 | synopsis: A Haskell library for efficient, concurrent, 4 | and concise data access. 5 | homepage: https://github.com/facebook/Haxl 6 | bug-reports: https://github.com/facebook/Haxl/issues 7 | license: BSD3 8 | license-file: LICENSE 9 | author: Facebook, Inc. 10 | maintainer: The Haxl Team 11 | copyright: Copyright (c) 2014-present, Facebook, Inc. 12 | category: Concurrency 13 | build-type: Simple 14 | stability: alpha 15 | cabal-version: >= 1.10 16 | tested-with: 17 | GHC==7.8.4, 18 | GHC==7.10.3, 19 | GHC==8.0.1 20 | 21 | description: 22 | Haxl is a library and EDSL for efficient scheduling of concurrent data 23 | accesses with a concise applicative API. 24 | . 25 | To use Haxl, you need to implement one or more /data sources/, which 26 | provide the means for accessing remote data or other I/O that you 27 | want to perform using Haxl. 28 | . 29 | Haxl provides two top-level modules: 30 | . 31 | * /Data-source implementations/ import "Haxl.Core", 32 | . 33 | * /Client code/ import your data sources and "Haxl.Prelude", or some 34 | other client-level API that you provide. 35 | 36 | extra-source-files: 37 | readme.md 38 | PATENTS 39 | tests/LoadCache.txt 40 | changelog.md 41 | 42 | library 43 | 44 | build-depends: 45 | HUnit >= 1.2 && < 1.6, 46 | aeson >= 0.6 && < 1.2, 47 | base == 4.*, 48 | binary >= 0.7 && < 0.9, 49 | bytestring >= 0.9 && < 0.11, 50 | containers == 0.5.*, 51 | deepseq, 52 | exceptions >=0.8 && <0.9, 53 | filepath >= 1.3 && < 1.5, 54 | ghc-prim, 55 | hashable == 1.2.*, 56 | pretty == 1.1.*, 57 | text >= 1.1.0.1 && < 1.3, 58 | time >= 1.4 && < 1.8, 59 | transformers, 60 | unordered-containers == 0.2.*, 61 | vector >= 0.10 && <0.13 62 | 63 | exposed-modules: 64 | Haxl.Core, 65 | Haxl.Core.DataCache, 66 | Haxl.Core.Exception, 67 | Haxl.Core.Memo, 68 | Haxl.Core.Monad, 69 | Haxl.Core.RequestStore, 70 | Haxl.Core.StateStore, 71 | Haxl.Core.ShowP, 72 | Haxl.Core.Types, 73 | Haxl.Prelude 74 | 75 | other-modules: 76 | Haxl.Core.Util 77 | 78 | default-language: Haskell2010 79 | 80 | ghc-options: 81 | -Wall 82 | 83 | 84 | test-suite test 85 | 86 | build-depends: 87 | HUnit, 88 | aeson, 89 | base == 4.*, 90 | binary, 91 | bytestring, 92 | containers, 93 | deepseq, 94 | filepath, 95 | hashable, 96 | haxl, 97 | test-framework, 98 | test-framework-hunit, 99 | text, 100 | unordered-containers 101 | 102 | ghc-options: 103 | -Wall 104 | -fno-warn-name-shadowing 105 | -fno-warn-missing-signatures 106 | 107 | hs-source-dirs: 108 | tests 109 | 110 | main-is: 111 | TestMain.hs 112 | 113 | other-modules: 114 | AdoTests 115 | AllTests 116 | BatchTests 117 | Bench 118 | CoreTests 119 | DataCacheTest 120 | ExampleDataSource 121 | LoadCache 122 | MemoizationTests 123 | MockTAO 124 | ProfileTests 125 | TestExampleDataSource 126 | TestTypes 127 | TestUtils 128 | 129 | type: 130 | exitcode-stdio-1.0 131 | 132 | default-language: Haskell2010 133 | 134 | executable monadbench 135 | default-language: 136 | Haskell2010 137 | hs-source-dirs: 138 | tests 139 | build-depends: 140 | base, 141 | haxl, 142 | hashable, 143 | time 144 | main-is: 145 | MonadBench.hs 146 | other-modules: 147 | ExampleDataSource 148 | ghc-options: 149 | -O2 -main-is MonadBench -rtsopts 150 | -------------------------------------------------------------------------------- /fixtures/identity/lens.cabal: -------------------------------------------------------------------------------- 1 | name: lens 2 | category: Data, Lenses, Generics 3 | version: 4.15.1 4 | license: BSD3 5 | cabal-version: >= 1.8 6 | license-file: LICENSE 7 | author: Edward A. Kmett 8 | maintainer: Edward A. Kmett 9 | stability: provisional 10 | homepage: http://github.com/ekmett/lens/ 11 | bug-reports: http://github.com/ekmett/lens/issues 12 | copyright: Copyright (C) 2012-2016 Edward A. Kmett 13 | build-type: Custom 14 | -- build-tools: cpphs 15 | tested-with: GHC == 7.4.2, GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.1, GHC == 7.10.2, GHC == 8.0.2 16 | synopsis: Lenses, Folds and Traversals 17 | description: 18 | This package comes \"Batteries Included\" with many useful lenses for the types 19 | commonly used from the Haskell Platform, and with tools for automatically 20 | generating lenses and isomorphisms for user-supplied data types. 21 | . 22 | The combinators in @Control.Lens@ provide a highly generic toolbox for composing 23 | families of getters, folds, isomorphisms, traversals, setters and lenses and their 24 | indexed variants. 25 | . 26 | An overview, with a large number of examples can be found in the . 27 | . 28 | An introductory video on the style of code used in this library by Simon Peyton Jones is available from . 29 | . 30 | A video on how to use lenses and how they are constructed is available on . 31 | . 32 | Slides for that second talk can be obtained from . 33 | . 34 | More information on the care and feeding of lenses, including a brief tutorial and motivation 35 | for their types can be found on the . 36 | . 37 | A small game of @pong@ and other more complex examples that manage their state using lenses can be found in the . 38 | . 39 | /Lenses, Folds and Traversals/ 40 | . 41 | With some signatures simplified, the core of the hierarchy of lens-like constructions looks like: 42 | . 43 | . 44 | <> 45 | . 46 | 47 | . 48 | You can compose any two elements of the hierarchy above using @(.)@ from the @Prelude@, and you can 49 | use any element of the hierarchy as any type it linked to above it. 50 | . 51 | The result is their lowest upper bound in the hierarchy (or an error if that bound doesn't exist). 52 | . 53 | For instance: 54 | . 55 | * You can use any 'Traversal' as a 'Fold' or as a 'Setter'. 56 | . 57 | * The composition of a 'Traversal' and a 'Getter' yields a 'Fold'. 58 | . 59 | /Minimizing Dependencies/ 60 | . 61 | If you want to provide lenses and traversals for your own types in your own libraries, then you 62 | can do so without incurring a dependency on this (or any other) lens package at all. 63 | . 64 | /e.g./ for a data type: 65 | . 66 | > data Foo a = Foo Int Int a 67 | . 68 | You can define lenses such as 69 | . 70 | > -- bar :: Lens' (Foo a) Int 71 | > bar :: Functor f => (Int -> f Int) -> Foo a -> f (Foo a) 72 | > bar f (Foo a b c) = fmap (\a' -> Foo a' b c) (f a) 73 | . 74 | > -- quux :: Lens (Foo a) (Foo b) a b 75 | > quux :: Functor f => (a -> f b) -> Foo a -> f (Foo b) 76 | > quux f (Foo a b c) = fmap (Foo a b) (f c) 77 | . 78 | without the need to use any type that isn't already defined in the @Prelude@. 79 | . 80 | And you can define a traversal of multiple fields with 'Control.Applicative.Applicative': 81 | . 82 | > -- traverseBarAndBaz :: Traversal' (Foo a) Int 83 | > traverseBarAndBaz :: Applicative f => (Int -> f Int) -> Foo a -> f (Foo a) 84 | > traverseBarAndBaz f (Foo a b c) = Foo <$> f a <*> f b <*> pure c 85 | . 86 | What is provided in this library is a number of stock lenses and traversals for 87 | common haskell types, a wide array of combinators for working them, and more 88 | exotic functionality, (/e.g./ getters, setters, indexed folds, isomorphisms). 89 | 90 | extra-source-files: 91 | .travis.yml 92 | .gitignore 93 | .vim.custom 94 | cabal.project 95 | examples/LICENSE 96 | examples/lens-examples.cabal 97 | examples/*.hs 98 | examples/*.lhs 99 | images/*.png 100 | lens-properties/CHANGELOG.markdown 101 | lens-properties/LICENSE 102 | lens-properties/Setup.hs 103 | travis/cabal-apt-install 104 | travis/config 105 | HLint.hs 106 | AUTHORS.markdown 107 | CHANGELOG.markdown 108 | README.markdown 109 | SUPPORT.markdown 110 | 111 | source-repository head 112 | type: git 113 | location: https://github.com/ekmett/lens.git 114 | 115 | -- Enable benchmarking against Neil Mitchell's uniplate library for comparative performance analysis. Defaults to being turned off to avoid 116 | -- the extra dependency. 117 | -- 118 | -- > cabal configure --enable-benchmarks -fbenchmark-uniplate && cabal build && cabal bench 119 | flag benchmark-uniplate 120 | default: False 121 | manual: True 122 | 123 | -- Generate inline pragmas when using template-haskell. This defaults to enabled, but you can 124 | -- 125 | -- > cabal install lens -f-inlining 126 | -- 127 | -- to shut it off to benchmark the relative performance impact, or as last ditch effort to address compile 128 | -- errors resulting from the myriad versions of template-haskell that all purport to be 2.8. 129 | flag inlining 130 | manual: True 131 | default: True 132 | 133 | -- Some 7.6.1-rc1 users report their TH still uses old style inline pragmas. This lets them turn on inlining. 134 | flag old-inline-pragmas 135 | default: False 136 | manual: True 137 | 138 | -- Make the test suites dump their template-haskell splices. 139 | flag dump-splices 140 | default: False 141 | manual: True 142 | 143 | -- You can disable the hlint test suite with -f-test-hlint 144 | flag test-hlint 145 | default: True 146 | manual: True 147 | 148 | -- You can disable the doctests test suite with -f-test-doctests 149 | flag test-doctests 150 | default: True 151 | manual: True 152 | 153 | -- You can disable the hunit test suite with -f-test-hunit 154 | flag test-hunit 155 | default: True 156 | manual: True 157 | 158 | -- Build the properties test if we're building tests 159 | flag test-properties 160 | default: True 161 | manual: True 162 | 163 | flag test-templates 164 | default: True 165 | manual: True 166 | 167 | -- Disallow unsafeCoerce 168 | flag safe 169 | default: False 170 | manual: True 171 | 172 | -- Assert that we are trustworthy when we can 173 | flag trustworthy 174 | default: True 175 | manual: True 176 | 177 | -- Attempt a parallel build with GHC 7.8 178 | flag j 179 | default: False 180 | manual: True 181 | 182 | library 183 | build-depends: 184 | array >= 0.3.0.2 && < 0.6, 185 | base >= 4.5 && < 5, 186 | base-orphans >= 0.5.2 && < 1, 187 | bifunctors >= 5.1 && < 6, 188 | bytestring >= 0.9.1.10 && < 0.11, 189 | comonad >= 4 && < 6, 190 | contravariant >= 1.3 && < 2, 191 | containers >= 0.4.0 && < 0.6, 192 | distributive >= 0.3 && < 1, 193 | filepath >= 1.2.0.0 && < 1.5, 194 | free >= 4 && < 5, 195 | ghc-prim, 196 | hashable >= 1.1.2.3 && < 1.3, 197 | kan-extensions >= 5 && < 6, 198 | exceptions >= 0.1.1 && < 1, 199 | mtl >= 2.0.1 && < 2.3, 200 | parallel >= 3.1.0.1 && < 3.3, 201 | profunctors >= 5 && < 6, 202 | reflection >= 2.1 && < 3, 203 | semigroupoids >= 5 && < 6, 204 | semigroups >= 0.8.4 && < 1, 205 | tagged >= 0.4.4 && < 1, 206 | template-haskell >= 2.4 && < 2.12, 207 | text >= 0.11 && < 1.3, 208 | transformers >= 0.2 && < 0.6, 209 | transformers-compat >= 0.4 && < 1, 210 | unordered-containers >= 0.2.4 && < 0.3, 211 | vector >= 0.9 && < 0.13, 212 | void >= 0.5 && < 1 213 | 214 | if impl(ghc < 8.0) 215 | build-depends: generic-deriving >= 1.10 && < 2 216 | 217 | exposed-modules: 218 | Control.Exception.Lens 219 | Control.Lens 220 | Control.Lens.At 221 | Control.Lens.Combinators 222 | Control.Lens.Cons 223 | Control.Lens.Each 224 | Control.Lens.Empty 225 | Control.Lens.Equality 226 | Control.Lens.Extras 227 | Control.Lens.Fold 228 | Control.Lens.Getter 229 | Control.Lens.Indexed 230 | Control.Lens.Internal 231 | Control.Lens.Internal.Bazaar 232 | Control.Lens.Internal.ByteString 233 | Control.Lens.Internal.Coerce 234 | Control.Lens.Internal.Context 235 | Control.Lens.Internal.Deque 236 | Control.Lens.Internal.Exception 237 | Control.Lens.Internal.FieldTH 238 | Control.Lens.Internal.PrismTH 239 | Control.Lens.Internal.Fold 240 | Control.Lens.Internal.Getter 241 | Control.Lens.Internal.Indexed 242 | Control.Lens.Internal.Instances 243 | Control.Lens.Internal.Iso 244 | Control.Lens.Internal.Level 245 | Control.Lens.Internal.List 246 | Control.Lens.Internal.Magma 247 | Control.Lens.Internal.Prism 248 | Control.Lens.Internal.Review 249 | Control.Lens.Internal.Setter 250 | Control.Lens.Internal.TH 251 | Control.Lens.Internal.Zoom 252 | Control.Lens.Iso 253 | Control.Lens.Lens 254 | Control.Lens.Level 255 | Control.Lens.Operators 256 | Control.Lens.Plated 257 | Control.Lens.Prism 258 | Control.Lens.Reified 259 | Control.Lens.Review 260 | Control.Lens.Setter 261 | Control.Lens.TH 262 | Control.Lens.Traversal 263 | Control.Lens.Tuple 264 | Control.Lens.Type 265 | Control.Lens.Wrapped 266 | Control.Lens.Zoom 267 | Control.Monad.Error.Lens 268 | Control.Parallel.Strategies.Lens 269 | Control.Seq.Lens 270 | Data.Array.Lens 271 | Data.Bits.Lens 272 | Data.ByteString.Lens 273 | Data.ByteString.Strict.Lens 274 | Data.ByteString.Lazy.Lens 275 | Data.Complex.Lens 276 | Data.Data.Lens 277 | Data.Dynamic.Lens 278 | Data.HashSet.Lens 279 | Data.IntSet.Lens 280 | Data.List.Lens 281 | Data.Map.Lens 282 | Data.Sequence.Lens 283 | Data.Set.Lens 284 | Data.Text.Lens 285 | Data.Text.Strict.Lens 286 | Data.Text.Lazy.Lens 287 | Data.Tree.Lens 288 | Data.Typeable.Lens 289 | Data.Vector.Lens 290 | Data.Vector.Generic.Lens 291 | GHC.Generics.Lens 292 | System.Exit.Lens 293 | System.FilePath.Lens 294 | System.IO.Error.Lens 295 | Language.Haskell.TH.Lens 296 | Numeric.Lens 297 | 298 | other-modules: 299 | Paths_lens 300 | 301 | cpp-options: -traditional 302 | 303 | if flag(safe) 304 | cpp-options: -DSAFE=1 305 | 306 | if flag(trustworthy) && impl(ghc>=7.2) 307 | other-extensions: Trustworthy 308 | cpp-options: -DTRUSTWORTHY=1 309 | 310 | if flag(old-inline-pragmas) && impl(ghc>=7.6.0.20120810) 311 | cpp-options: -DOLD_INLINE_PRAGMAS=1 312 | 313 | if flag(inlining) 314 | cpp-options: -DINLINING 315 | 316 | if impl(ghc<7.4) 317 | ghc-options: -fno-spec-constr-count 318 | 319 | -- hack around the buggy unused matches check for class associated types in ghc 8 rc1 320 | if impl(ghc >= 8) 321 | ghc-options: -Wno-missing-pattern-synonym-signatures -Wno-unused-matches 322 | 323 | if flag(j) && impl(ghc>=7.8) 324 | ghc-options: -j4 325 | 326 | ghc-options: -Wall -fwarn-tabs -O2 -fdicts-cheap -funbox-strict-fields -fmax-simplifier-iterations=10 327 | 328 | hs-source-dirs: src 329 | 330 | -- Verify that Template Haskell expansion works 331 | test-suite templates 332 | type: exitcode-stdio-1.0 333 | main-is: templates.hs 334 | ghc-options: -Wall -threaded 335 | hs-source-dirs: tests 336 | 337 | if flag(dump-splices) 338 | ghc-options: -ddump-splices 339 | 340 | if !flag(test-templates) 341 | buildable: False 342 | else 343 | build-depends: base, lens 344 | 345 | -- Verify the properties of lenses with QuickCheck 346 | test-suite properties 347 | type: exitcode-stdio-1.0 348 | main-is: properties.hs 349 | other-modules: 350 | Control.Lens.Properties 351 | ghc-options: -w -threaded -rtsopts -with-rtsopts=-N 352 | hs-source-dirs: 353 | tests 354 | lens-properties/src 355 | if !flag(test-properties) 356 | buildable: False 357 | else 358 | build-depends: 359 | base, 360 | lens, 361 | QuickCheck >= 2.4, 362 | test-framework >= 0.6, 363 | test-framework-quickcheck2 >= 0.2, 364 | test-framework-th >= 0.2, 365 | transformers 366 | 367 | test-suite hunit 368 | type: exitcode-stdio-1.0 369 | main-is: hunit.hs 370 | ghc-options: -w -threaded -rtsopts -with-rtsopts=-N 371 | hs-source-dirs: tests 372 | 373 | if !flag(test-hunit) 374 | buildable: False 375 | else 376 | build-depends: 377 | base, 378 | containers, 379 | HUnit >= 1.2, 380 | lens, 381 | mtl, 382 | test-framework >= 0.6, 383 | test-framework-hunit >= 0.2, 384 | test-framework-th >= 0.2 385 | 386 | -- Verify the results of the examples 387 | test-suite doctests 388 | type: exitcode-stdio-1.0 389 | main-is: doctests.hs 390 | ghc-options: -Wall -threaded 391 | hs-source-dirs: tests 392 | 393 | if flag(trustworthy) && impl(ghc>=7.2) 394 | other-extensions: Trustworthy 395 | cpp-options: -DTRUSTWORTHY=1 396 | 397 | if !flag(test-doctests) 398 | buildable: False 399 | else 400 | build-depends: 401 | base, 402 | bytestring, 403 | containers, 404 | directory >= 1.0, 405 | deepseq, 406 | doctest >= 0.9.1, 407 | filepath, 408 | generic-deriving, 409 | mtl, 410 | nats, 411 | parallel, 412 | semigroups >= 0.9, 413 | simple-reflect >= 0.3.1, 414 | text, 415 | unordered-containers, 416 | vector 417 | 418 | test-suite hlint 419 | type: exitcode-stdio-1.0 420 | main-is: hlint.hs 421 | ghc-options: -w -threaded -rtsopts -with-rtsopts=-N 422 | hs-source-dirs: tests 423 | 424 | if !flag(test-hlint) 425 | buildable: False 426 | else 427 | build-depends: 428 | base, 429 | hlint >= 1.9.27 430 | 431 | -- Basic benchmarks for the uniplate-style combinators 432 | benchmark plated 433 | type: exitcode-stdio-1.0 434 | main-is: plated.hs 435 | ghc-options: -Wall -O2 -threaded -fdicts-cheap -funbox-strict-fields 436 | hs-source-dirs: benchmarks 437 | build-depends: 438 | base, 439 | comonad, 440 | criterion, 441 | deepseq, 442 | generic-deriving, 443 | lens, 444 | transformers 445 | 446 | if flag(benchmark-uniplate) 447 | build-depends: uniplate >= 1.6.7 && < 1.7 448 | cpp-options: -DBENCHMARK_UNIPLATE 449 | 450 | -- Benchmarking alongside variants 451 | benchmark alongside 452 | type: exitcode-stdio-1.0 453 | main-is: alongside.hs 454 | ghc-options: -w -O2 -threaded -fdicts-cheap -funbox-strict-fields 455 | hs-source-dirs: benchmarks 456 | build-depends: 457 | base, 458 | comonad >= 4, 459 | criterion, 460 | deepseq, 461 | lens, 462 | transformers 463 | 464 | -- Benchmarking folds 465 | benchmark folds 466 | type: exitcode-stdio-1.0 467 | main-is: folds.hs 468 | ghc-options: -w -O2 -threaded -fdicts-cheap -funbox-strict-fields 469 | hs-source-dirs: benchmarks 470 | build-depends: 471 | base, 472 | criterion, 473 | containers, 474 | bytestring, 475 | unordered-containers, 476 | vector, 477 | lens 478 | 479 | -- Benchmarking traversals 480 | benchmark traversals 481 | type: exitcode-stdio-1.0 482 | main-is: traversals.hs 483 | ghc-options: -w -O2 -threaded -fdicts-cheap -funbox-strict-fields 484 | hs-source-dirs: benchmarks 485 | build-depends: 486 | base, 487 | criterion, 488 | containers, 489 | deepseq, 490 | bytestring, 491 | unordered-containers, 492 | vector, 493 | lens 494 | 495 | -- Benchmarking unsafe implementation strategies 496 | benchmark unsafe 497 | type: exitcode-stdio-1.0 498 | main-is: unsafe.hs 499 | ghc-options: -w -O2 -threaded -fdicts-cheap -funbox-strict-fields 500 | hs-source-dirs: benchmarks 501 | build-depends: 502 | base, 503 | comonad >= 4, 504 | criterion >= 1, 505 | deepseq, 506 | generic-deriving, 507 | lens, 508 | transformers 509 | -------------------------------------------------------------------------------- /fixtures/identity/md2sht.cabal: -------------------------------------------------------------------------------- 1 | name: md2sht 2 | version: 0.1.0.0 3 | synopsis: converts Markdown to inline-Styled HTml 4 | description: Please see README.md 5 | homepage: https://github.com/justinwoo/md2sht#readme 6 | license: MIT 7 | license-file: LICENSE 8 | author: Justin Woo 9 | maintainer: moomoowoo@gmail.com 10 | copyright: 2016 Justin Woo 11 | category: Web 12 | build-type: Simple 13 | -- extra-source-files: 14 | cabal-version: >=1.10 15 | 16 | library 17 | hs-source-dirs: src 18 | exposed-modules: MD2SHT 19 | , MD2SHT.CSSParser 20 | , MD2SHT.Types 21 | build-depends: base >= 4.7 && < 5 22 | , attoparsec 23 | , text 24 | , tagsoup 25 | default-language: Haskell2010 26 | 27 | executable md2sht 28 | hs-source-dirs: app 29 | main-is: Main.hs 30 | ghc-options: -threaded -rtsopts -with-rtsopts=-N 31 | build-depends: base 32 | , md2sht 33 | , attoparsec 34 | , containers 35 | , pandoc >= 1.3 36 | , text 37 | , tagsoup 38 | , optparse-generic 39 | default-language: Haskell2010 40 | 41 | test-suite md2sht-test 42 | type: exitcode-stdio-1.0 43 | hs-source-dirs: test 44 | main-is: Spec.hs 45 | build-depends: base 46 | , md2sht 47 | , hspec 48 | , attoparsec 49 | , text 50 | , tagsoup 51 | ghc-options: -threaded -rtsopts -with-rtsopts=-N 52 | default-language: Haskell2010 53 | 54 | source-repository head 55 | type: git 56 | location: https://github.com/justinwoo/md2sht 57 | -------------------------------------------------------------------------------- /fixtures/identity/recursion-schemes.cabal: -------------------------------------------------------------------------------- 1 | name: recursion-schemes 2 | category: Control, Recursion 3 | version: 5.0.1.1 4 | license: BSD3 5 | cabal-version: >= 1.8 6 | license-file: LICENSE 7 | author: Edward A. Kmett 8 | maintainer: Edward A. Kmett 9 | stability: provisional 10 | homepage: http://github.com/ekmett/recursion-schemes/ 11 | bug-reports: http://github.com/ekmett/recursion-schemes/issues 12 | copyright: Copyright (C) 2008-2015 Edward A. Kmett 13 | synopsis: Generalized bananas, lenses and barbed wire 14 | description: Generalized bananas, lenses and barbed wire 15 | 16 | tested-with: GHC==7.4.2, GHC==7.6.3, GHC==7.8.4, GHC==7.10.3, GHC==8.0.2 17 | 18 | build-type: Simple 19 | extra-source-files: .travis.yml CHANGELOG.markdown .gitignore README.markdown 20 | 21 | source-repository head 22 | type: git 23 | location: git://github.com/ekmett/recursion-schemes.git 24 | 25 | flag template-haskell 26 | description: About Template Haskell derivations 27 | manual: True 28 | default: True 29 | 30 | library 31 | extensions: CPP 32 | other-extensions: 33 | TypeFamilies 34 | Rank2Types 35 | FlexibleContexts 36 | FlexibleInstances 37 | GADTs 38 | StandaloneDeriving 39 | UndecidableInstances 40 | 41 | build-depends: 42 | base >= 4 && < 5, 43 | bifunctors >= 4 && < 6, 44 | comonad >= 4 && < 6, 45 | free >= 4 && < 5, 46 | semigroups >= 0.8.3.1 && < 1, 47 | transformers >= 0.2 && < 1, 48 | transformers-compat >= 0.3 && < 1 49 | 50 | if impl(ghc < 7.5) 51 | build-depends: ghc-prim 52 | 53 | exposed-modules: 54 | Data.Functor.Base 55 | Data.Functor.Foldable 56 | 57 | if flag(template-haskell) 58 | build-depends: template-haskell >= 2.5.0.0 && < 2.12, base-orphans >= 0.5.4 && <0.6 59 | exposed-modules: 60 | Data.Functor.Foldable.TH 61 | 62 | other-modules: 63 | Paths_recursion_schemes 64 | 65 | ghc-options: -Wall 66 | 67 | test-suite Expr 68 | type: exitcode-stdio-1.0 69 | main-is: Expr.hs 70 | hs-source-dirs: examples 71 | ghc-options: -Wall -threaded 72 | build-depends: 73 | base, 74 | HUnit <1.6, 75 | recursion-schemes, 76 | template-haskell >= 2.5.0.0 && < 2.12, 77 | transformers >= 0.2 && < 1 78 | -------------------------------------------------------------------------------- /fixtures/identity/scientific.cabal: -------------------------------------------------------------------------------- 1 | name: scientific 2 | version: 0.3.4.9 3 | synopsis: Numbers represented using scientific notation 4 | description: 5 | @Data.Scientific@ provides the number type 'Scientific'. Scientific numbers are 6 | arbitrary precision and space efficient. They are represented using 7 | . 8 | The implementation uses a coefficient @c :: 'Integer'@ and a base-10 exponent 9 | @e :: 'Int'@. A scientific number corresponds to the 10 | 'Fractional' number: @'fromInteger' c * 10 '^^' e@. 11 | . 12 | Note that since we're using an 'Int' to represent the exponent these numbers 13 | aren't truly arbitrary precision. I intend to change the type of the exponent 14 | to 'Integer' in a future release. 15 | . 16 | The main application of 'Scientific' is to be used as the target of parsing 17 | arbitrary precision numbers coming from an untrusted source. The advantages 18 | over using 'Rational' for this are that: 19 | . 20 | * A 'Scientific' is more efficient to construct. Rational numbers need to be 21 | constructed using '%' which has to compute the 'gcd' of the 'numerator' and 22 | 'denominator'. 23 | . 24 | * 'Scientific' is safe against numbers with huge exponents. For example: 25 | @1e1000000000 :: 'Rational'@ will fill up all space and crash your 26 | program. Scientific works as expected: 27 | . 28 | > > read "1e1000000000" :: Scientific 29 | > 1.0e1000000000 30 | . 31 | * Also, the space usage of converting scientific numbers with huge exponents to 32 | @'Integral's@ (like: 'Int') or @'RealFloat's@ (like: 'Double' or 'Float') 33 | will always be bounded by the target type. 34 | 35 | homepage: https://github.com/basvandijk/scientific 36 | bug-reports: https://github.com/basvandijk/scientific/issues 37 | license: BSD3 38 | license-file: LICENSE 39 | author: Bas van Dijk 40 | maintainer: Bas van Dijk 41 | category: Data 42 | build-type: Simple 43 | cabal-version: >=1.10 44 | 45 | extra-source-files: 46 | changelog 47 | 48 | source-repository head 49 | type: git 50 | location: git://github.com/basvandijk/scientific.git 51 | 52 | flag bytestring-builder 53 | description: Depend on the bytestring-builder package for backwards compatibility. 54 | default: False 55 | manual: False 56 | 57 | flag integer-simple 58 | description: Use the integer-simple package instead of integer-gmp 59 | default: False 60 | 61 | library 62 | exposed-modules: Data.ByteString.Builder.Scientific 63 | Data.Scientific 64 | Data.Text.Lazy.Builder.Scientific 65 | other-modules: GHC.Integer.Compat 66 | Utils 67 | other-extensions: DeriveDataTypeable, BangPatterns 68 | ghc-options: -Wall 69 | build-depends: base >= 4.3 && < 4.10 70 | , ghc-prim 71 | , integer-logarithms >= 1 && <1.1 72 | , deepseq >= 1.3 && < 1.5 73 | , text >= 0.8 && < 1.3 74 | , hashable >= 1.1.2 && < 1.3 75 | , vector >= 0.5 && < 0.13 76 | , containers >= 0.1 && < 0.6 77 | , binary >= 0.4.1 && < 0.9 78 | 79 | if flag(bytestring-builder) 80 | build-depends: bytestring >= 0.9 && < 0.10.4 81 | , bytestring-builder >= 0.10.4 && < 0.11 82 | else 83 | build-depends: bytestring >= 0.10.4 && < 0.11 84 | 85 | if flag(integer-simple) 86 | build-depends: integer-simple 87 | CPP-options: -DINTEGER_SIMPLE 88 | else 89 | build-depends: integer-gmp 90 | 91 | 92 | hs-source-dirs: src 93 | default-language: Haskell2010 94 | 95 | test-suite test-scientific 96 | type: exitcode-stdio-1.0 97 | hs-source-dirs: test 98 | main-is: test.hs 99 | default-language: Haskell2010 100 | ghc-options: -Wall 101 | 102 | build-depends: scientific 103 | , base >= 4.3 && < 4.10 104 | , binary >= 0.4.1 && < 0.9 105 | , tasty >= 0.5 && < 0.12 106 | , tasty-ant-xml >= 1.0 && < 1.1 107 | , tasty-hunit >= 0.8 && < 0.10 108 | , tasty-smallcheck >= 0.2 && < 0.9 109 | , tasty-quickcheck >= 0.8 && < 0.9 110 | , smallcheck >= 1.0 && < 1.2 111 | , QuickCheck >= 2.5 && < 2.10 112 | , text >= 0.8 && < 1.3 113 | 114 | if flag(bytestring-builder) 115 | build-depends: bytestring >= 0.9 && < 0.10.4 116 | , bytestring-builder >= 0.10.4 && < 0.11 117 | else 118 | build-depends: bytestring >= 0.10.4 && < 0.11 119 | 120 | benchmark bench-scientific 121 | type: exitcode-stdio-1.0 122 | hs-source-dirs: bench 123 | main-is: bench.hs 124 | default-language: Haskell2010 125 | ghc-options: -O2 126 | build-depends: scientific 127 | , base >= 4.3 && < 4.10 128 | , criterion >= 0.5 && < 1.2 129 | -------------------------------------------------------------------------------- /fixtures/identity/servant-mock.cabal: -------------------------------------------------------------------------------- 1 | name: servant-mock 2 | version: 0.8.1.1 3 | synopsis: Derive a mock server for free from your servant API types 4 | description: 5 | Derive a mock server for free from your servant API types 6 | . 7 | See the @Servant.Mock@ module for the documentation and an example. 8 | homepage: http://haskell-servant.readthedocs.org/ 9 | license: BSD3 10 | license-file: LICENSE 11 | author: Servant Contributors 12 | maintainer: haskell-servant-maintainers@googlegroups.com 13 | copyright: 2015-2016 Servant Contributors 14 | category: Web 15 | build-type: Simple 16 | extra-source-files: README.md CHANGELOG.md include/*.h 17 | cabal-version: >=1.10 18 | bug-reports: http://github.com/haskell-servant/servant-mock/issues 19 | 20 | source-repository head 21 | type: git 22 | location: http://github.com/haskell-servant/servant-mock.git 23 | 24 | flag example 25 | description: Build the example too 26 | default: True 27 | manual: True 28 | 29 | library 30 | exposed-modules: 31 | Servant.Mock 32 | build-depends: 33 | base >=4.7 && <5, 34 | bytestring >=0.10.4 && <0.11, 35 | http-types >=0.8 && <0.10, 36 | servant >=0.8 && <0.10, 37 | servant-server >=0.8 && <0.10, 38 | transformers >=0.3 && <0.6, 39 | QuickCheck >=2.7 && <2.10, 40 | wai >=3.0 && <3.3 41 | hs-source-dirs: src 42 | default-language: Haskell2010 43 | include-dirs: include 44 | ghc-options: -Wall 45 | 46 | executable mock-app 47 | main-is: main.hs 48 | hs-source-dirs: example 49 | default-language: Haskell2010 50 | build-depends: 51 | aeson, 52 | base, 53 | servant-mock, 54 | servant-server, 55 | QuickCheck, 56 | warp 57 | if flag(example) 58 | buildable: True 59 | else 60 | buildable: False 61 | ghc-options: -Wall 62 | 63 | test-suite spec 64 | type: exitcode-stdio-1.0 65 | ghc-options: -Wall 66 | default-language: Haskell2010 67 | hs-source-dirs: test 68 | main-is: Spec.hs 69 | other-modules: 70 | Servant.MockSpec 71 | build-depends: 72 | bytestring-conversion, 73 | base, 74 | hspec, 75 | hspec-wai, 76 | QuickCheck, 77 | servant, 78 | servant-server, 79 | servant-mock, 80 | aeson, 81 | wai 82 | -------------------------------------------------------------------------------- /fixtures/identity/stack.cabal: -------------------------------------------------------------------------------- 1 | name: stack 2 | version: 1.3.1 3 | synopsis: The Haskell Tool Stack 4 | description: Please see the README.md for usage information, and 5 | the wiki on Github for more details. Also, note that 6 | the API for the library is not currently stable, and may 7 | change significantly, even between minor releases. It is 8 | currently only intended for use by the executable. 9 | license: BSD3 10 | license-file: LICENSE 11 | author: Commercial Haskell SIG 12 | maintainer: manny@fpcomplete.com 13 | category: Development 14 | build-type: Custom 15 | cabal-version: >=1.10 16 | homepage: http://haskellstack.org 17 | extra-source-files: CONTRIBUTING.md 18 | ChangeLog.md 19 | README.md 20 | doc/*.md 21 | src/setup-shim/StackSetupShim.hs 22 | 23 | -- Glob would be nice, but apparently Cabal doesn't support it: 24 | -- cabal: filepath wildcard 'test/package-dump/*.txt' does not match any files. 25 | -- Happened during cabal sdist 26 | test/package-dump/ghc-7.8.txt 27 | test/package-dump/ghc-7.8.4-osx.txt 28 | test/package-dump/ghc-7.10.txt 29 | 30 | stack.yaml 31 | 32 | flag integration-tests 33 | manual: True 34 | default: False 35 | description: Run the integration test suite 36 | 37 | flag disable-git-info 38 | manual: True 39 | default: False 40 | description: Disable compile-time inclusion of current git info in stack 41 | -- disabling git info can lead to a quicker workflow in certain 42 | -- scenarios when you're developing on stack itself, but 43 | -- should otherwise be avoided 44 | -- see: https://github.com/commercialhaskell/stack/issues/1425 45 | 46 | flag static 47 | manual: True 48 | default: False 49 | description: Pass -static/-pthread to ghc when linking the stack binary. 50 | -- Not intended for general use. Simply makes it easier to 51 | -- build a fully static binary on Linux platforms that enable it. 52 | 53 | flag hide-dependency-versions 54 | manual: True 55 | default: False 56 | description: Hides dependency versions from "stack --version", used only by building with stack.yaml 57 | 58 | library 59 | hs-source-dirs: src/ 60 | ghc-options: -Wall -fwarn-tabs -fwarn-incomplete-uni-patterns -fwarn-incomplete-record-updates -fwarn-identities 61 | exposed-modules: Control.Concurrent.Execute 62 | Data.Aeson.Extended 63 | Data.Attoparsec.Args 64 | Data.Attoparsec.Combinators 65 | Data.Attoparsec.Interpreter 66 | Data.IORef.RunOnce 67 | Data.Maybe.Extra 68 | Data.Monoid.Extra 69 | Data.Store.VersionTagged 70 | Data.Text.Extra 71 | Distribution.Version.Extra 72 | Network.HTTP.Download 73 | Network.HTTP.Download.Verified 74 | Options.Applicative.Args 75 | Options.Applicative.Builder.Extra 76 | Options.Applicative.Complicated 77 | Path.Extra 78 | Path.Find 79 | Paths_stack 80 | Stack.Build 81 | Stack.Build.Cache 82 | Stack.Build.ConstructPlan 83 | Stack.Build.Execute 84 | Stack.Build.Haddock 85 | Stack.Build.Installed 86 | Stack.Build.Source 87 | Stack.Build.Target 88 | Stack.BuildPlan 89 | Stack.Clean 90 | Stack.Config 91 | Stack.Config.Build 92 | Stack.Config.Urls 93 | Stack.Config.Docker 94 | Stack.Config.Nix 95 | Stack.ConfigCmd 96 | Stack.Constants 97 | Stack.Coverage 98 | Stack.Docker 99 | Stack.Docker.GlobalDB 100 | Stack.Dot 101 | Stack.Exec 102 | Stack.Fetch 103 | Stack.FileWatch 104 | Stack.GhcPkg 105 | Stack.Ghci 106 | Stack.Ghci.Script 107 | Stack.Hoogle 108 | Stack.IDE 109 | Stack.Image 110 | Stack.Init 111 | Stack.New 112 | Stack.Nix 113 | Stack.Options.BenchParser 114 | Stack.Options.BuildMonoidParser 115 | Stack.Options.BuildParser 116 | Stack.Options.CleanParser 117 | Stack.Options.ConfigParser 118 | Stack.Options.DockerParser 119 | Stack.Options.DotParser 120 | Stack.Options.ExecParser 121 | Stack.Options.GhcBuildParser 122 | Stack.Options.GhciParser 123 | Stack.Options.GhcVariantParser 124 | Stack.Options.GlobalParser 125 | Stack.Options.HaddockParser 126 | Stack.Options.HpcReportParser 127 | Stack.Options.LogLevelParser 128 | Stack.Options.NewParser 129 | Stack.Options.NixParser 130 | Stack.Options.PackageParser 131 | Stack.Options.ResolverParser 132 | Stack.Options.SolverParser 133 | Stack.Options.TestParser 134 | Stack.Options.Utils 135 | Stack.Package 136 | Stack.PackageDump 137 | Stack.PackageIndex 138 | Stack.Path 139 | Stack.PrettyPrint 140 | Stack.Runners 141 | Stack.SDist 142 | Stack.Setup 143 | Stack.Setup.Installed 144 | Stack.SetupCmd 145 | Stack.Sig 146 | Stack.Sig.GPG 147 | Stack.Sig.Sign 148 | Stack.Solver 149 | Stack.Types.Build 150 | Stack.Types.BuildPlan 151 | Stack.Types.CompilerBuild 152 | Stack.Types.Urls 153 | Stack.Types.Compiler 154 | Stack.Types.Config 155 | Stack.Types.Config.Build 156 | Stack.Types.Docker 157 | Stack.Types.FlagName 158 | Stack.Types.GhcPkgId 159 | Stack.Types.Image 160 | Stack.Types.Internal 161 | Stack.Types.Nix 162 | Stack.Types.Package 163 | Stack.Types.PackageDump 164 | Stack.Types.PackageIdentifier 165 | Stack.Types.PackageIndex 166 | Stack.Types.PackageName 167 | Stack.Types.Resolver 168 | Stack.Types.Sig 169 | Stack.Types.StackT 170 | Stack.Types.TemplateName 171 | Stack.Types.Version 172 | Stack.Upgrade 173 | Stack.Upload 174 | Text.PrettyPrint.Leijen.Extended 175 | System.Process.Log 176 | System.Process.PagerEditor 177 | System.Process.Read 178 | System.Process.Run 179 | build-depends: Cabal >= 1.18.1.5 && < 1.25 180 | , aeson (>= 1.0 && < 1.1) 181 | , ansi-terminal >= 0.6.2.3 182 | , async >= 2.0.2 && < 2.2 183 | , attoparsec >= 0.12.1.5 && < 0.14 184 | , base >= 4.7 && <5 185 | , base-compat >=0.6 && <0.10 186 | , base16-bytestring 187 | , base64-bytestring 188 | , binary >= 0.7 && < 0.9 189 | , binary-tagged >= 0.1.1 190 | , blaze-builder 191 | , byteable 192 | , bytestring >= 0.10.4.0 193 | , clock >= 0.7.2 194 | , conduit >= 1.2.8 195 | , conduit-extra >= 1.1.7.1 196 | , containers >= 0.5.5.1 197 | , cryptohash >= 0.11.6 198 | , cryptohash-conduit 199 | , directory >= 1.2.1.0 200 | , either 201 | , errors < 2.2 202 | , exceptions >= 0.8.0.2 203 | , extra < 1.6 204 | , fast-logger >= 2.3.1 205 | , filelock >= 0.1.0.1 206 | , filepath >= 1.3.0.2 207 | , fsnotify >= 0.2.1 208 | , generic-deriving < 1.12 209 | , hashable >= 1.2.3.2 210 | , hit 211 | , hpc 212 | , http-client >= 0.5.3.3 213 | , http-client-tls >= 0.3.3 214 | , http-conduit >= 2.2.3 215 | , http-types >= 0.8.6 && < 0.10 216 | , lifted-async 217 | -- https://github.com/basvandijk/lifted-base/issues/31 218 | , lifted-base < 0.2.3.7 || > 0.2.3.7 219 | , microlens >= 0.3.0.0 220 | , microlens-mtl 221 | , monad-control 222 | , monad-logger >= 0.3.13.1 223 | , monad-unlift < 0.3 224 | , mtl >= 2.1.3.1 225 | , open-browser >= 0.2.1 226 | , optparse-applicative >= 0.13 && < 0.14 227 | , path >= 0.5.8 228 | , path-io >= 1.1.0 && < 2.0.0 229 | , persistent >= 2.1.2 && < 2.7 230 | -- persistent-sqlite-2.5.0.1 has a bug 231 | -- (see https://github.com/yesodweb/persistent/pull/561#issuecomment-222329087) 232 | , persistent-sqlite (>= 2.1.4 && < 2.5.0.1) || (> 2.5.0.1 && < 2.7) 233 | , persistent-template >= 2.1.1 && < 2.6 234 | , pretty >= 1.1.1.1 235 | , process >= 1.2.1.0 && < 1.5 236 | , regex-applicative-text >=0.1.0.1 && <0.2 237 | , resourcet >= 1.1.4.1 238 | , retry >= 0.6 && < 0.8 239 | , safe >= 0.3 240 | , safe-exceptions 241 | , semigroups >= 0.5 && < 0.19 242 | , split 243 | , stm >= 2.4.4 244 | , streaming-commons >= 0.1.10.0 245 | , tar >= 0.5.0.3 && < 0.6 246 | , template-haskell >= 2.9.0.0 && < 2.12 247 | , temporary >= 1.2.0.3 248 | , text >= 1.2.0.4 249 | , text-binary 250 | , text-metrics >= 0.1 && < 0.3 251 | , time >= 1.4.2 && < 1.7 252 | , tls >= 1.3.8 253 | , transformers >= 0.3.0.0 && < 0.6 254 | , transformers-base >= 0.4.4 255 | , unicode-transforms >= 0.1 && <0.3 256 | , unix-compat 257 | , unordered-containers >= 0.2.5.1 258 | , vector >= 0.10.12.3 && < 0.12 259 | , vector-binary-instances 260 | , yaml >= 0.8.20 261 | , zlib >= 0.5.4.2 && < 0.7 262 | , deepseq >= 1.4 263 | , hastache 264 | , project-template >= 0.2 265 | , zip-archive < 0.4 266 | , hpack >= 0.14.0 && < 0.16 267 | , store >= 0.2.1.0 268 | , annotated-wl-pprint 269 | , file-embed >= 0.0.10 270 | if os(windows) 271 | cpp-options: -DWINDOWS 272 | build-depends: Win32 273 | else 274 | build-depends: unix >= 2.7.0.1 275 | , pid1 >= 0.1 && < 0.2 276 | default-language: Haskell2010 277 | 278 | executable stack 279 | hs-source-dirs: src/main 280 | main-is: Main.hs 281 | ghc-options: -threaded -Wall -fwarn-tabs -fwarn-incomplete-uni-patterns -fwarn-incomplete-record-updates 282 | other-modules: Paths_stack 283 | if flag(static) 284 | ld-options: -static -pthread 285 | 286 | build-depends: Cabal >= 1.18.1.5 && < 1.25 287 | , base >=4.7 && < 5 288 | , bytestring >= 0.10.4.0 289 | , containers >= 0.5.5.1 290 | , directory >= 1.2.1.0 291 | , either 292 | , filelock >= 0.1.0.1 293 | , filepath >= 1.3.0.2 294 | , hpack >= 0.14.0 && < 0.16 295 | , http-client >= 0.5.3.3 296 | -- https://github.com/basvandijk/lifted-base/issues/31 297 | , lifted-base < 0.2.3.7 || > 0.2.3.7 298 | , microlens >= 0.3.0.0 299 | , monad-control 300 | , monad-logger >= 0.3.13.1 301 | , mtl >= 2.1.3.1 302 | , optparse-applicative >= 0.13 && < 0.14 303 | , path 304 | , path-io >= 1.1.0 && < 2.0.0 305 | , stack 306 | , text >= 1.2.0.4 307 | , transformers >= 0.3.0.0 && < 0.6 308 | default-language: Haskell2010 309 | if os(windows) 310 | build-depends: Win32 311 | cpp-options: -DWINDOWS 312 | if !flag(disable-git-info) 313 | cpp-options: -DUSE_GIT_INFO 314 | build-depends: gitrev >= 1.1 && < 1.3 315 | , optparse-simple >= 0.0.3 316 | if flag(hide-dependency-versions) 317 | cpp-options: -DHIDE_DEP_VERSIONS 318 | 319 | test-suite stack-test 320 | type: exitcode-stdio-1.0 321 | hs-source-dirs: src/test 322 | main-is: Test.hs 323 | other-modules: Spec 324 | , Stack.BuildPlanSpec 325 | , Stack.Build.ExecuteSpec 326 | , Stack.Build.TargetSpec 327 | , Stack.ConfigSpec 328 | , Stack.DotSpec 329 | , Stack.GhciSpec 330 | , Stack.Ghci.ScriptSpec 331 | , Stack.Ghci.PortableFakePaths 332 | , Stack.PackageDumpSpec 333 | , Stack.ArgsSpec 334 | , Stack.NixSpec 335 | , Stack.StoreSpec 336 | , Network.HTTP.Download.VerifiedSpec 337 | , Stack.SolverSpec 338 | , Stack.Untar.UntarSpec 339 | ghc-options: -threaded -Wall -fwarn-tabs -fwarn-incomplete-uni-patterns -fwarn-incomplete-record-updates 340 | build-depends: Cabal >= 1.18.1.5 && < 1.25 341 | , QuickCheck < 2.10 342 | , attoparsec < 0.14 343 | , base >=4.7 && <5 344 | , conduit 345 | , conduit-extra 346 | , containers >= 0.5.5.1 347 | , cryptohash 348 | , directory >= 1.2.1.0 349 | , exceptions 350 | , filepath 351 | , hspec >= 2.2 && <2.4 352 | , hashable 353 | , http-client-tls 354 | , http-conduit 355 | , monad-logger 356 | , neat-interpolation >= 0.3 357 | , path >= 0.5.7 358 | , path-io >= 1.1.0 && < 2.0.0 359 | , resourcet 360 | , retry >= 0.6 && < 0.8 361 | , stack 362 | , temporary 363 | , text 364 | , transformers >= 0.3.0.0 && < 0.6 365 | , mono-traversable 366 | , th-reify-many 367 | , smallcheck 368 | , bytestring 369 | , store >= 0.2.1.0 370 | , vector 371 | , unordered-containers 372 | , template-haskell 373 | , yaml 374 | default-language: Haskell2010 375 | if os(windows) 376 | cpp-options: -DWINDOWS 377 | 378 | test-suite stack-integration-test 379 | type: exitcode-stdio-1.0 380 | hs-source-dirs: test/integration 381 | main-is: IntegrationSpec.hs 382 | ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall -fwarn-tabs -fwarn-incomplete-uni-patterns -fwarn-incomplete-record-updates 383 | 384 | if !flag(integration-tests) 385 | buildable: False 386 | 387 | build-depends: async < 2.2 388 | , base >= 4.7 && < 5 389 | , bytestring >= 0.10.4.0 390 | , conduit >= 1.2.8 391 | , conduit-extra >= 1.1.14 392 | , containers >= 0.5.5.1 393 | , directory >= 1.2.1.0 394 | , filepath >= 1.3.0.2 395 | , hspec >= 2.2 && < 2.4 396 | , process >= 1.2.0.0 && < 1.5 397 | , resourcet 398 | , temporary 399 | , text 400 | , transformers >= 0.3.0.0 && < 0.6 401 | , unix-compat 402 | default-language: Haskell2010 403 | 404 | -- This isn't actually needed to build stack-integration-test, but it makes it 405 | -- easier to load up an individual integration test into stack ghci. It's 406 | -- still a little involved: 407 | -- 408 | -- stack exec -- stack ghci stack:stack-integration-test --flag stack:integration-tests --no-build 409 | -- 410 | -- Then, in ghci: 411 | -- 412 | -- :cd test/integration/tests/.../files 413 | -- :load ../Main.hs 414 | -- main 415 | other-modules: StackTest 416 | hs-source-dirs: test/integration/lib 417 | 418 | source-repository head 419 | type: git 420 | location: https://github.com/commercialhaskell/stack.git 421 | -------------------------------------------------------------------------------- /fixtures/identity/stylish-haskell.cabal: -------------------------------------------------------------------------------- 1 | Name: stylish-haskell 2 | Version: 0.6.4.0 3 | Synopsis: Haskell code prettifier 4 | Homepage: https://github.com/jaspervdj/stylish-haskell 5 | License: BSD3 6 | License-file: LICENSE 7 | Author: Jasper Van der Jeugt 8 | Maintainer: Jasper Van der Jeugt 9 | Copyright: 2012 Jasper Van der Jeugt 10 | Category: Language 11 | Build-type: Simple 12 | Cabal-version: >= 1.8 13 | 14 | Description: 15 | A Haskell code prettifier. For more information, see: 16 | 17 | . 18 | 19 | 20 | 21 | Data-files: 22 | data/stylish-haskell.yaml 23 | 24 | Extra-source-files: 25 | CHANGELOG 26 | 27 | Library 28 | Hs-source-dirs: lib 29 | Ghc-options: -Wall 30 | 31 | Exposed-modules: 32 | Language.Haskell.Stylish 33 | Language.Haskell.Stylish.Step.Imports 34 | Language.Haskell.Stylish.Step.LanguagePragmas 35 | Language.Haskell.Stylish.Step.SimpleAlign 36 | Language.Haskell.Stylish.Step.Tabs 37 | Language.Haskell.Stylish.Step.TrailingWhitespace 38 | Language.Haskell.Stylish.Step.UnicodeSyntax 39 | 40 | Other-modules: 41 | Language.Haskell.Stylish.Align 42 | Language.Haskell.Stylish.Block 43 | Language.Haskell.Stylish.Config 44 | Language.Haskell.Stylish.Editor 45 | Language.Haskell.Stylish.Parse 46 | Language.Haskell.Stylish.Step 47 | Language.Haskell.Stylish.Util 48 | Language.Haskell.Stylish.Verbose 49 | Paths_stylish_haskell 50 | 51 | Build-depends: 52 | aeson >= 0.6 && < 1.1, 53 | base >= 4.8 && < 5, 54 | bytestring >= 0.9 && < 0.11, 55 | containers >= 0.3 && < 0.6, 56 | directory >= 1.1 && < 1.3, 57 | filepath >= 1.1 && < 1.5, 58 | haskell-src-exts >= 1.18 && < 1.19, 59 | mtl >= 2.0 && < 2.3, 60 | syb >= 0.3 && < 0.7, 61 | yaml >= 0.7 && < 0.9 62 | 63 | Executable stylish-haskell 64 | Ghc-options: -Wall 65 | Hs-source-dirs: src 66 | Main-is: Main.hs 67 | 68 | Build-depends: 69 | stylish-haskell, 70 | strict >= 0.3 && < 0.4, 71 | optparse-applicative >= 0.12 && < 0.14, 72 | -- Copied from regular dependencies... 73 | aeson >= 0.6 && < 1.1, 74 | base >= 4.8 && < 5, 75 | bytestring >= 0.9 && < 0.11, 76 | containers >= 0.3 && < 0.6, 77 | directory >= 1.1 && < 1.3, 78 | filepath >= 1.1 && < 1.5, 79 | haskell-src-exts >= 1.18 && < 1.19, 80 | mtl >= 2.0 && < 2.3, 81 | syb >= 0.3 && < 0.7, 82 | yaml >= 0.7 && < 0.9 83 | 84 | Test-suite stylish-haskell-tests 85 | Ghc-options: -Wall 86 | Hs-source-dirs: tests lib 87 | Main-is: TestSuite.hs 88 | Type: exitcode-stdio-1.0 89 | 90 | Other-modules: 91 | Language.Haskell.Stylish.Align 92 | Language.Haskell.Stylish.Block 93 | Language.Haskell.Stylish.Config 94 | Language.Haskell.Stylish.Editor 95 | Language.Haskell.Stylish.Parse 96 | Language.Haskell.Stylish.Parse.Tests 97 | Language.Haskell.Stylish.Step 98 | Language.Haskell.Stylish.Step.SimpleAlign 99 | Language.Haskell.Stylish.Step.SimpleAlign.Tests 100 | Language.Haskell.Stylish.Step.Imports 101 | Language.Haskell.Stylish.Step.Imports.Tests 102 | Language.Haskell.Stylish.Step.LanguagePragmas 103 | Language.Haskell.Stylish.Step.LanguagePragmas.Tests 104 | Language.Haskell.Stylish.Step.Tabs 105 | Language.Haskell.Stylish.Step.Tabs.Tests 106 | Language.Haskell.Stylish.Step.TrailingWhitespace 107 | Language.Haskell.Stylish.Step.TrailingWhitespace.Tests 108 | Language.Haskell.Stylish.Step.UnicodeSyntax 109 | Language.Haskell.Stylish.Step.UnicodeSyntax.Tests 110 | Language.Haskell.Stylish.Tests.Util 111 | Language.Haskell.Stylish.Util 112 | Language.Haskell.Stylish.Verbose 113 | 114 | Build-depends: 115 | HUnit >= 1.2 && < 1.4, 116 | test-framework >= 0.4 && < 0.9, 117 | test-framework-hunit >= 0.2 && < 0.4, 118 | -- Copied from regular dependencies... 119 | aeson >= 0.6 && < 1.1, 120 | base >= 4.8 && < 5, 121 | bytestring >= 0.9 && < 0.11, 122 | containers >= 0.3 && < 0.6, 123 | directory >= 1.1 && < 1.3, 124 | filepath >= 1.1 && < 1.5, 125 | haskell-src-exts >= 1.18 && < 1.19, 126 | mtl >= 2.0 && < 2.3, 127 | syb >= 0.3 && < 0.7, 128 | yaml >= 0.7 && < 0.9 129 | 130 | Source-repository head 131 | Type: git 132 | Location: https://github.com/jaspervdj/stylish-haskell 133 | -------------------------------------------------------------------------------- /fixtures/identity/these.cabal: -------------------------------------------------------------------------------- 1 | Name: these 2 | Version: 0.7.3 3 | x-revision: 2 4 | Synopsis: An either-or-both data type & a generalized 'zip with padding' typeclass 5 | Homepage: https://github.com/isomorphism/these 6 | License: BSD3 7 | License-file: LICENSE 8 | Author: C. McCann 9 | Maintainer: cam@uptoisomorphism.net 10 | Category: Data,Control 11 | Build-type: Simple 12 | Extra-source-files: README.md, CHANGELOG.md 13 | Cabal-version: >=1.8 14 | Description: 15 | This package provides a data type @These a b@ which can hold a value of either 16 | type or values of each type. This is usually thought of as an "inclusive or" 17 | type (contrasting @Either a b@ as "exclusive or") or as an "outer join" type 18 | (contrasting @(a, b)@ as "inner join"). 19 | . 20 | The major use case of this is provided by the @Align@ class, representing a 21 | generalized notion of "zipping with padding" that combines structures without 22 | truncating to the size of the smaller input. 23 | . 24 | Also included is @ChronicleT@, a monad transformer based on the Monad instance 25 | for @These a@, along with the usual monad transformer bells and whistles. 26 | 27 | source-repository head 28 | type: git 29 | location: https://github.com/isomorphism/these.git 30 | 31 | Library 32 | Exposed-modules: Data.These, 33 | Data.Align, 34 | Data.Align.Key, 35 | Control.Monad.Chronicle, 36 | Control.Monad.Chronicle.Class, 37 | Control.Monad.Trans.Chronicle 38 | 39 | Build-depends: base >= 4.4 && < 4.10, 40 | aeson >= 0.7.0.4 && < 1.2, 41 | bifunctors >= 0.1 && < 5.5, 42 | binary >= 0.5.0.2 && < 0.9, 43 | containers >= 0.4 && < 0.6, 44 | data-default-class >= 0.0 && < 0.2, 45 | deepseq >= 1.3.0.0 && < 1.5, 46 | hashable >= 1.2.3 && < 1.3, 47 | keys >= 3.10 && < 3.12, 48 | mtl >= 2 && < 2.3, 49 | profunctors >= 3 && < 5.3, 50 | QuickCheck >= 2.8 && < 2.9.3, 51 | semigroupoids >= 1.0 && < 5.2, 52 | transformers >= 0.2 && < 0.6, 53 | transformers-compat >= 0.2 && < 0.6, 54 | unordered-containers >= 0.2 && < 0.3, 55 | vector >= 0.4 && < 0.13, 56 | vector-instances >= 3.3.1 && < 3.5 57 | if impl(ghc <7.5) 58 | build-depends: ghc-prim 59 | 60 | if !impl(ghc >= 8.0) 61 | build-depends: 62 | semigroups >= 0.8 && < 0.19 63 | 64 | ghc-options: -Wall 65 | 66 | test-suite test 67 | type: exitcode-stdio-1.0 68 | main-is: Tests.hs 69 | hs-source-dirs: test 70 | ghc-options: -Wall 71 | build-depends: these, 72 | base >= 4.5, 73 | quickcheck-instances >= 0.3.6 && < 0.3.13, 74 | tasty >= 0.10 && < 0.12, 75 | tasty-quickcheck >= 0.8 && < 0.9, 76 | aeson, 77 | bifunctors, 78 | binary, 79 | containers, 80 | hashable, 81 | QuickCheck, 82 | transformers, 83 | unordered-containers, 84 | vector 85 | -------------------------------------------------------------------------------- /fixtures/identity/uniform-pair.cabal: -------------------------------------------------------------------------------- 1 | Name: uniform-pair 2 | Version: 0.1.12 3 | Cabal-Version: >= 1.6 4 | Synopsis: Uniform pairs with class instances 5 | Category: Data 6 | Description: 7 | Uniform pairs with class instances 8 | . 9 | @ 10 | data Pair a = a :# a 11 | @ 12 | Author: Conal Elliott 13 | Maintainer: conal@conal.net 14 | Copyright: (c) 2013 by Conal Elliott 15 | Homepage: https://github.com/conal/uniform-pair/ 16 | License: BSD3 17 | License-File: COPYING 18 | Stability: experimental 19 | build-type: Simple 20 | data-files: changelog 21 | tested-with: 22 | GHC==8.0.2, 23 | GHC==7.10.3, 24 | GHC==7.8.4, 25 | GHC==7.6.3, 26 | GHC==7.4.2, 27 | GHC==7.2.2, 28 | GHC==7.0.4 29 | 30 | source-repository head 31 | type: git 32 | location: git://github.com/conal/uniform-pair.git 33 | 34 | Library 35 | hs-Source-Dirs: src 36 | Extensions: 37 | Build-Depends: base<5, prelude-extras < 0.5, deepseq 38 | Exposed-Modules: 39 | Data.UniformPair 40 | ghc-options: -Wall 41 | if !impl(ghc >= 8.0) 42 | Build-Depends: semigroups >= 0.18.2, transformers >= 0.2, transformers-compat >= 0.4 43 | -------------------------------------------------------------------------------- /fixtures/identity/unordered-containers.cabal: -------------------------------------------------------------------------------- 1 | name: unordered-containers 2 | version: 0.2.8.0 3 | synopsis: Efficient hashing-based container types 4 | description: 5 | Efficient hashing-based container types. The containers have been 6 | optimized for performance critical use, both in terms of large data 7 | quantities and high speed. 8 | . 9 | The declared cost of each operation is either worst-case or 10 | amortized, but remains valid even if structures are shared. 11 | license: BSD3 12 | license-file: LICENSE 13 | author: Johan Tibell 14 | maintainer: johan.tibell@gmail.com 15 | Homepage: https://github.com/tibbe/unordered-containers 16 | bug-reports: https://github.com/tibbe/unordered-containers/issues 17 | copyright: 2010-2014 Johan Tibell 18 | 2010 Edward Z. Yang 19 | category: Data 20 | build-type: Simple 21 | cabal-version: >=1.8 22 | extra-source-files: CHANGES.md 23 | tested-with: GHC==8.0.1, GHC==7.10.3, GHC==7.8.4, GHC==7.6.3, GHC==7.4.2 24 | 25 | flag debug 26 | description: Enable debug support 27 | default: False 28 | 29 | library 30 | exposed-modules: 31 | Data.HashMap.Lazy 32 | Data.HashMap.Strict 33 | Data.HashSet 34 | other-modules: 35 | Data.HashMap.Array 36 | Data.HashMap.Base 37 | Data.HashMap.List 38 | Data.HashMap.PopCount 39 | Data.HashMap.Unsafe 40 | Data.HashMap.UnsafeShift 41 | 42 | build-depends: 43 | base >= 4 && < 5, 44 | deepseq >= 1.1, 45 | hashable >= 1.0.1.1 && < 1.3 46 | 47 | if impl(ghc < 7.4) 48 | c-sources: cbits/popc.c 49 | 50 | ghc-options: -Wall -O2 51 | if impl(ghc >= 6.8) 52 | ghc-options: -fwarn-tabs 53 | if flag(debug) 54 | cpp-options: -DASSERTS 55 | 56 | test-suite hashmap-lazy-properties 57 | hs-source-dirs: tests 58 | main-is: HashMapProperties.hs 59 | type: exitcode-stdio-1.0 60 | 61 | build-depends: 62 | base, 63 | containers >= 0.4, 64 | hashable >= 1.0.1.1, 65 | QuickCheck >= 2.4.0.1, 66 | test-framework >= 0.3.3, 67 | test-framework-quickcheck2 >= 0.2.9, 68 | unordered-containers 69 | 70 | ghc-options: -Wall 71 | cpp-options: -DASSERTS 72 | 73 | test-suite hashmap-strict-properties 74 | hs-source-dirs: tests 75 | main-is: HashMapProperties.hs 76 | type: exitcode-stdio-1.0 77 | 78 | build-depends: 79 | base, 80 | containers >= 0.4, 81 | hashable >= 1.0.1.1, 82 | QuickCheck >= 2.4.0.1, 83 | test-framework >= 0.3.3, 84 | test-framework-quickcheck2 >= 0.2.9, 85 | unordered-containers 86 | 87 | ghc-options: -Wall 88 | cpp-options: -DASSERTS -DSTRICT 89 | 90 | test-suite hashset-properties 91 | hs-source-dirs: tests 92 | main-is: HashSetProperties.hs 93 | type: exitcode-stdio-1.0 94 | 95 | build-depends: 96 | base, 97 | containers >= 0.4, 98 | hashable >= 1.0.1.1, 99 | QuickCheck >= 2.4.0.1, 100 | test-framework >= 0.3.3, 101 | test-framework-quickcheck2 >= 0.2.9, 102 | unordered-containers 103 | 104 | ghc-options: -Wall 105 | cpp-options: -DASSERTS 106 | 107 | test-suite list-tests 108 | hs-source-dirs: tests . 109 | main-is: List.hs 110 | other-modules: 111 | Data.HashMap.List 112 | type: exitcode-stdio-1.0 113 | 114 | build-depends: 115 | base, 116 | containers >= 0.4, 117 | QuickCheck >= 2.4.0.1, 118 | test-framework >= 0.3.3, 119 | test-framework-quickcheck2 >= 0.2.9 120 | 121 | ghc-options: -Wall 122 | cpp-options: -DASSERTS 123 | 124 | test-suite regressions 125 | hs-source-dirs: tests 126 | main-is: Regressions.hs 127 | type: exitcode-stdio-1.0 128 | 129 | build-depends: 130 | base, 131 | hashable >= 1.0.1.1, 132 | HUnit, 133 | QuickCheck >= 2.4.0.1, 134 | test-framework >= 0.3.3, 135 | test-framework-hunit, 136 | test-framework-quickcheck2, 137 | unordered-containers 138 | 139 | ghc-options: -Wall 140 | cpp-options: -DASSERTS 141 | 142 | test-suite strictness-properties 143 | hs-source-dirs: tests 144 | main-is: Strictness.hs 145 | type: exitcode-stdio-1.0 146 | 147 | build-depends: 148 | base, 149 | ChasingBottoms, 150 | containers >= 0.4.2, 151 | hashable >= 1.0.1.1, 152 | QuickCheck >= 2.4.0.1, 153 | test-framework >= 0.3.3, 154 | test-framework-quickcheck2 >= 0.2.9, 155 | unordered-containers 156 | 157 | ghc-options: -Wall 158 | cpp-options: -DASSERTS 159 | 160 | benchmark benchmarks 161 | -- We cannot depend on the unordered-containers library directly as 162 | -- that creates a dependency cycle. 163 | hs-source-dirs: . benchmarks 164 | 165 | main-is: Benchmarks.hs 166 | type: exitcode-stdio-1.0 167 | 168 | other-modules: 169 | Data.HashMap.Array 170 | Data.HashMap.Base 171 | Data.HashMap.Lazy 172 | Data.HashMap.PopCount 173 | Data.HashMap.Strict 174 | Data.HashMap.Unsafe 175 | Data.HashMap.UnsafeShift 176 | Data.HashSet 177 | Util.ByteString 178 | Util.Int 179 | Util.String 180 | 181 | build-depends: 182 | base, 183 | bytestring, 184 | containers, 185 | criterion >= 1.0 && < 1.2, 186 | deepseq >= 1.1, 187 | deepseq-generics, 188 | hashable >= 1.0.1.1, 189 | hashmap, 190 | mtl, 191 | random 192 | 193 | if impl(ghc < 7.4) 194 | c-sources: cbits/popc.c 195 | 196 | ghc-options: -Wall -O2 -rtsopts 197 | if impl(ghc >= 6.8) 198 | ghc-options: -fwarn-tabs 199 | if impl(ghc > 6.10) 200 | ghc-options: -fregs-graph 201 | if flag(debug) 202 | cpp-options: -DASSERTS 203 | 204 | source-repository head 205 | type: git 206 | location: https://github.com/tibbe/unordered-containers.git 207 | -------------------------------------------------------------------------------- /fixtures/identity/vector-algorithms.cabal: -------------------------------------------------------------------------------- 1 | name: vector-algorithms 2 | version: 0.7.0.1 3 | license: BSD3 4 | license-file: LICENSE 5 | author: Dan Doel 6 | maintainer: Dan Doel 7 | copyright: (c) 2008,2009,2010,2011,2012,2013,2014,2015 Dan Doel 8 | (c) 2015 Tim Baumann 9 | homepage: http://code.haskell.org/~dolio/ 10 | category: Data 11 | synopsis: Efficient algorithms for vector arrays 12 | description: Efficient algorithms for vector arrays 13 | build-type: Simple 14 | cabal-version: >= 1.9.2 15 | 16 | flag BoundsChecks 17 | description: Enable bounds checking 18 | default: True 19 | 20 | flag UnsafeChecks 21 | description: Enable bounds checking in unsafe operations at the cost of a 22 | significant performance penalty. 23 | default: False 24 | 25 | flag InternalChecks 26 | description: Enable internal consistency checks at the cost of a 27 | significant performance penalty. 28 | default: False 29 | 30 | flag bench 31 | description: Build a benchmarking program to test vector-algorithms 32 | performance 33 | default: False 34 | 35 | flag properties 36 | description: Enable the quickcheck tests 37 | default: True 38 | 39 | flag dump-simpl 40 | description: Dumps the simplified core during compilation 41 | default: False 42 | 43 | flag llvm 44 | description: Build using llvm 45 | default: False 46 | 47 | source-repository head 48 | type: darcs 49 | location: http://hub.darcs.net/dolio/vector-algorithms 50 | 51 | library 52 | hs-source-dirs: src 53 | 54 | build-depends: base >= 4.5 && < 5, 55 | vector >= 0.6 && < 0.13, 56 | primitive >=0.3 && <0.7, 57 | bytestring >= 0.9 && < 1.0 58 | 59 | exposed-modules: 60 | Data.Vector.Algorithms.Optimal 61 | Data.Vector.Algorithms.Insertion 62 | Data.Vector.Algorithms.Intro 63 | Data.Vector.Algorithms.Merge 64 | Data.Vector.Algorithms.Radix 65 | Data.Vector.Algorithms.Search 66 | Data.Vector.Algorithms.Heap 67 | Data.Vector.Algorithms.AmericanFlag 68 | Data.Vector.Algorithms.Tim 69 | 70 | other-modules: 71 | Data.Vector.Algorithms.Common 72 | 73 | ghc-options: 74 | -Odph 75 | -funbox-strict-fields 76 | 77 | if flag(dump-simpl) 78 | ghc-options: -ddump-simpl -ddump-to-file 79 | 80 | if flag(llvm) 81 | ghc-options: -fllvm 82 | 83 | include-dirs: 84 | include 85 | 86 | install-includes: 87 | vector.h 88 | 89 | if flag(BoundsChecks) 90 | cpp-options: -DVECTOR_BOUNDS_CHECKS 91 | 92 | if flag(UnsafeChecks) 93 | cpp-options: -DVECTOR_UNSAFE_CHECKS 94 | 95 | if flag(InternalChecks) 96 | cpp-options: -DVECTOR_INTERNAL_CHECKS 97 | 98 | executable simple-bench 99 | hs-source-dirs: bench/simple 100 | 101 | if !flag(bench) 102 | buildable: False 103 | 104 | main-is: Main.hs 105 | 106 | other-modules: 107 | Blocks 108 | 109 | build-depends: base, mwc-random, vector, vector-algorithms, mtl 110 | ghc-options: -Wall -Odph 111 | 112 | if flag(dump-simpl) 113 | ghc-options: -ddump-simpl -ddump-to-file 114 | 115 | if flag(llvm) 116 | ghc-options: -fllvm 117 | 118 | test-suite properties 119 | hs-source-dirs: tests/properties 120 | type: exitcode-stdio-1.0 121 | main-is: Tests.hs 122 | 123 | other-modules: 124 | Optimal 125 | Properties 126 | Util 127 | 128 | if !flag(properties) 129 | buildable: False 130 | else 131 | build-depends: 132 | base, 133 | bytestring, 134 | containers, 135 | QuickCheck >= 2, 136 | vector, 137 | vector-algorithms 138 | 139 | if flag(llvm) 140 | ghc-options: -fllvm 141 | -------------------------------------------------------------------------------- /fixtures/identity/vector.cabal: -------------------------------------------------------------------------------- 1 | Name: vector 2 | Version: 0.12.0.0 3 | -- don't forget to update the changelog file! 4 | License: BSD3 5 | License-File: LICENSE 6 | Author: Roman Leshchinskiy 7 | Maintainer: Haskell Libraries Team 8 | Copyright: (c) Roman Leshchinskiy 2008-2012 9 | Homepage: https://github.com/haskell/vector 10 | Bug-Reports: https://github.com/haskell/vector/issues 11 | Category: Data, Data Structures 12 | Synopsis: Efficient Arrays 13 | Description: 14 | . 15 | An efficient implementation of Int-indexed arrays (both mutable 16 | and immutable), with a powerful loop optimisation framework . 17 | . 18 | It is structured as follows: 19 | . 20 | ["Data.Vector"] Boxed vectors of arbitrary types. 21 | . 22 | ["Data.Vector.Unboxed"] Unboxed vectors with an adaptive 23 | representation based on data type families. 24 | . 25 | ["Data.Vector.Storable"] Unboxed vectors of 'Storable' types. 26 | . 27 | ["Data.Vector.Primitive"] Unboxed vectors of primitive types as 28 | defined by the @primitive@ package. "Data.Vector.Unboxed" is more 29 | flexible at no performance cost. 30 | . 31 | ["Data.Vector.Generic"] Generic interface to the vector types. 32 | . 33 | There is also a (draft) tutorial on common uses of vector. 34 | . 35 | * 36 | 37 | Tested-With: 38 | GHC == 7.0.4, 39 | GHC == 7.2.2, 40 | GHC == 7.4.2, 41 | GHC == 7.6.3, 42 | GHC == 7.8.4, 43 | GHC == 7.10.3, 44 | GHC == 8.0.1 45 | 46 | Cabal-Version: >=1.10 47 | Build-Type: Simple 48 | 49 | Extra-Source-Files: 50 | changelog 51 | README.md 52 | tests/LICENSE 53 | tests/Setup.hs 54 | tests/Main.hs 55 | tests/Boilerplater.hs 56 | tests/Utilities.hs 57 | tests/Tests/Move.hs 58 | tests/Tests/Bundle.hs 59 | tests/Tests/Vector.hs 60 | benchmarks/vector-benchmarks.cabal 61 | benchmarks/LICENSE 62 | benchmarks/Setup.hs 63 | benchmarks/Main.hs 64 | benchmarks/Algo/AwShCC.hs 65 | benchmarks/Algo/HybCC.hs 66 | benchmarks/Algo/Leaffix.hs 67 | benchmarks/Algo/ListRank.hs 68 | benchmarks/Algo/Quickhull.hs 69 | benchmarks/Algo/Rootfix.hs 70 | benchmarks/Algo/Spectral.hs 71 | benchmarks/Algo/Tridiag.hs 72 | benchmarks/TestData/Graph.hs 73 | benchmarks/TestData/ParenTree.hs 74 | benchmarks/TestData/Random.hs 75 | changelog 76 | internal/GenUnboxTuple.hs 77 | internal/unbox-tuple-instances 78 | 79 | Flag BoundsChecks 80 | Description: Enable bounds checking 81 | Default: True 82 | Manual: True 83 | 84 | Flag UnsafeChecks 85 | Description: Enable bounds checking in unsafe operations at the cost of a 86 | significant performance penalty 87 | Default: False 88 | Manual: True 89 | 90 | Flag InternalChecks 91 | Description: Enable internal consistency checks at the cost of a 92 | significant performance penalty 93 | Default: False 94 | Manual: True 95 | 96 | Flag Wall 97 | Description: Enable all -Wall warnings 98 | Default: False 99 | Manual: True 100 | 101 | Library 102 | Default-Language: Haskell2010 103 | Other-Extensions: 104 | BangPatterns 105 | CPP 106 | DeriveDataTypeable 107 | ExistentialQuantification 108 | FlexibleContexts 109 | FlexibleInstances 110 | GADTs 111 | KindSignatures 112 | MagicHash 113 | MultiParamTypeClasses 114 | Rank2Types 115 | ScopedTypeVariables 116 | StandaloneDeriving 117 | TypeFamilies 118 | 119 | Exposed-Modules: 120 | Data.Vector.Internal.Check 121 | 122 | Data.Vector.Fusion.Util 123 | Data.Vector.Fusion.Stream.Monadic 124 | Data.Vector.Fusion.Bundle.Size 125 | Data.Vector.Fusion.Bundle.Monadic 126 | Data.Vector.Fusion.Bundle 127 | 128 | Data.Vector.Generic.Mutable.Base 129 | Data.Vector.Generic.Mutable 130 | Data.Vector.Generic.Base 131 | Data.Vector.Generic.New 132 | Data.Vector.Generic 133 | 134 | Data.Vector.Primitive.Mutable 135 | Data.Vector.Primitive 136 | 137 | Data.Vector.Storable.Internal 138 | Data.Vector.Storable.Mutable 139 | Data.Vector.Storable 140 | 141 | Data.Vector.Unboxed.Base 142 | Data.Vector.Unboxed.Mutable 143 | Data.Vector.Unboxed 144 | 145 | Data.Vector.Mutable 146 | Data.Vector 147 | 148 | Include-Dirs: 149 | include, internal 150 | 151 | Install-Includes: 152 | vector.h 153 | 154 | Build-Depends: base >= 4.5 && < 4.10 155 | , primitive >= 0.5.0.1 && < 0.7 156 | , ghc-prim >= 0.2 && < 0.6 157 | , deepseq >= 1.1 && < 1.5 158 | if !impl(ghc > 8.0) 159 | Build-Depends: semigroups >= 0.18 && < 0.19 160 | 161 | Ghc-Options: -O2 -Wall 162 | 163 | if !flag(Wall) 164 | Ghc-Options: -fno-warn-orphans 165 | 166 | if impl(ghc >= 8.0) && impl(ghc < 8.1) 167 | Ghc-Options: -Wno-redundant-constraints 168 | 169 | if flag(BoundsChecks) 170 | cpp-options: -DVECTOR_BOUNDS_CHECKS 171 | 172 | if flag(UnsafeChecks) 173 | cpp-options: -DVECTOR_UNSAFE_CHECKS 174 | 175 | if flag(InternalChecks) 176 | cpp-options: -DVECTOR_INTERNAL_CHECKS 177 | 178 | source-repository head 179 | type: git 180 | location: https://github.com/haskell/vector.git 181 | 182 | 183 | 184 | test-suite vector-tests-O0 185 | Default-Language: Haskell2010 186 | type: exitcode-stdio-1.0 187 | Main-Is: Main.hs 188 | hs-source-dirs: tests 189 | Build-Depends: base >= 4.5 && < 5, template-haskell, vector, 190 | random, 191 | QuickCheck >= 2.9 && < 2.10 , HUnit, test-framework, 192 | test-framework-hunit, test-framework-quickcheck2, 193 | transformers >= 0.2.0.0 194 | 195 | default-extensions: CPP, 196 | ScopedTypeVariables, 197 | PatternGuards, 198 | MultiParamTypeClasses, 199 | FlexibleContexts, 200 | Rank2Types, 201 | TypeSynonymInstances, 202 | TypeFamilies, 203 | TemplateHaskell 204 | 205 | Ghc-Options: -O0 206 | Ghc-Options: -Wall 207 | 208 | if !flag(Wall) 209 | Ghc-Options: -fno-warn-orphans -fno-warn-missing-signatures 210 | if impl(ghc >= 8.0) && impl( ghc < 8.1) 211 | Ghc-Options: -Wno-redundant-constraints 212 | 213 | 214 | test-suite vector-tests-O2 215 | Default-Language: Haskell2010 216 | type: exitcode-stdio-1.0 217 | Main-Is: Main.hs 218 | hs-source-dirs: tests 219 | Build-Depends: base >= 4.5 && < 5, template-haskell, vector, 220 | random, 221 | QuickCheck >= 2.9 && < 2.10 , HUnit, test-framework, 222 | test-framework-hunit, test-framework-quickcheck2, 223 | transformers >= 0.2.0.0 224 | 225 | default-extensions: CPP, 226 | ScopedTypeVariables, 227 | PatternGuards, 228 | MultiParamTypeClasses, 229 | FlexibleContexts, 230 | Rank2Types, 231 | TypeSynonymInstances, 232 | TypeFamilies, 233 | TemplateHaskell 234 | 235 | Ghc-Options: -O2 -Wall 236 | 237 | if !flag(Wall) 238 | Ghc-Options: -fno-warn-orphans -fno-warn-missing-signatures 239 | if impl(ghc >= 8.0) && impl(ghc < 8.1) 240 | Ghc-Options: -Wno-redundant-constraints 241 | 242 | -------------------------------------------------------------------------------- /fixtures/increase-revision/cabal-refact.cabal: -------------------------------------------------------------------------------- 1 | name: cabal-refact 2 | version: 0 3 | synopsis: Refactor tool for .cabal files 4 | description: Refactor tool for .cabal files, supporting among all things the build-depends editing. 5 | -------------------------------------------------------------------------------- /fixtures/increase-revision/cabal-refact.cabal.output: -------------------------------------------------------------------------------- 1 | name: cabal-refact 2 | version: 0 3 | x-revision: 1 4 | synopsis: Refactor tool for .cabal files 5 | description: Refactor tool for .cabal files, supporting among all things the build-depends editing. 6 | -------------------------------------------------------------------------------- /fixtures/increase-revision/focus.cabal: -------------------------------------------------------------------------------- 1 | name: 2 | focus 3 | version: 4 | 0.1.5 5 | synopsis: 6 | A general abstraction for manipulating elements of container data structures 7 | description: 8 | An API for construction of free-form strategies of access and manipulation of 9 | elements of arbitrary data structures. 10 | It allows to implement efficient composite patterns, e.g., 11 | a simultaneous update and lookup of an element, 12 | and even more complex things. 13 | . 14 | Strategies are meant to be interpreted by the host data structure libraries. 15 | Thus they allow to implement all access and modification patterns of 16 | a data structure with just a single function, 17 | which interprets strategies. 18 | . 19 | This library provides pure and monadic interfaces, 20 | so it supports both immutable and mutable data structures. 21 | -------------------------------------------------------------------------------- /fixtures/increase-revision/focus.cabal.output: -------------------------------------------------------------------------------- 1 | name: 2 | focus 3 | version: 4 | 0.1.5 5 | x-revision: 6 | 1 7 | synopsis: 8 | A general abstraction for manipulating elements of container data structures 9 | description: 10 | An API for construction of free-form strategies of access and manipulation of 11 | elements of arbitrary data structures. 12 | It allows to implement efficient composite patterns, e.g., 13 | a simultaneous update and lookup of an element, 14 | and even more complex things. 15 | . 16 | Strategies are meant to be interpreted by the host data structure libraries. 17 | Thus they allow to implement all access and modification patterns of 18 | a data structure with just a single function, 19 | which interprets strategies. 20 | . 21 | This library provides pure and monadic interfaces, 22 | so it supports both immutable and mutable data structures. 23 | -------------------------------------------------------------------------------- /fixtures/increase-revision/focus2.cabal: -------------------------------------------------------------------------------- 1 | name: 2 | focus 3 | version: 4 | 0.1.5 5 | x-revision: 6 | 2 7 | synopsis: 8 | A general abstraction for manipulating elements of container data structures 9 | description: 10 | An API for construction of free-form strategies of access and manipulation of 11 | elements of arbitrary data structures. 12 | It allows to implement efficient composite patterns, e.g., 13 | a simultaneous update and lookup of an element, 14 | and even more complex things. 15 | . 16 | Strategies are meant to be interpreted by the host data structure libraries. 17 | Thus they allow to implement all access and modification patterns of 18 | a data structure with just a single function, 19 | which interprets strategies. 20 | . 21 | This library provides pure and monadic interfaces, 22 | so it supports both immutable and mutable data structures. 23 | -------------------------------------------------------------------------------- /fixtures/increase-revision/focus2.cabal.output: -------------------------------------------------------------------------------- 1 | name: 2 | focus 3 | version: 4 | 0.1.5 5 | x-revision: 6 | 3 7 | synopsis: 8 | A general abstraction for manipulating elements of container data structures 9 | description: 10 | An API for construction of free-form strategies of access and manipulation of 11 | elements of arbitrary data structures. 12 | It allows to implement efficient composite patterns, e.g., 13 | a simultaneous update and lookup of an element, 14 | and even more complex things. 15 | . 16 | Strategies are meant to be interpreted by the host data structure libraries. 17 | Thus they allow to implement all access and modification patterns of 18 | a data structure with just a single function, 19 | which interprets strategies. 20 | . 21 | This library provides pure and monadic interfaces, 22 | so it supports both immutable and mutable data structures. 23 | -------------------------------------------------------------------------------- /fixtures/populate-extra-source-files/cabal-refact.cabal: -------------------------------------------------------------------------------- 1 | name: cabal-refact 2 | version: 0 3 | x-revision: 2 4 | synopsis: Refactor tool for .cabal files 5 | description: Refactor tool for .cabal files, supporting among all things the build-depends editing. 6 | category: Web 7 | homepage: https://github.com/phadej/cabal-refact#readme 8 | bug-reports: https://github.com/phadej/cabal-refact/issues 9 | author: Oleg Grenrus 10 | maintainer: Oleg Grenrus 11 | license: BSD3 12 | license-file: LICENSE 13 | tested-with: GHC == 8.0.1 14 | build-type: Custom 15 | cabal-version: >= 1.10 16 | 17 | extra-source-files: 18 | CHANGELOG.md 19 | README.md 20 | -- cabal-refact-populate: fixtures/**/*.* 21 | 22 | source-repository head 23 | type: git 24 | location: https://github.com/phadej/aeson-compat 25 | -------------------------------------------------------------------------------- /fixtures/populate-extra-source-files/cabal-refact.cabal.output: -------------------------------------------------------------------------------- 1 | name: cabal-refact 2 | version: 0 3 | x-revision: 2 4 | synopsis: Refactor tool for .cabal files 5 | description: Refactor tool for .cabal files, supporting among all things the build-depends editing. 6 | category: Web 7 | homepage: https://github.com/phadej/cabal-refact#readme 8 | bug-reports: https://github.com/phadej/cabal-refact/issues 9 | author: Oleg Grenrus 10 | maintainer: Oleg Grenrus 11 | license: BSD3 12 | license-file: LICENSE 13 | tested-with: GHC == 8.0.1 14 | build-type: Custom 15 | cabal-version: >= 1.10 16 | 17 | extra-source-files: 18 | CHANGELOG.md 19 | README.md 20 | -- cabal-refact-populate: fixtures/**/*.* 21 | fixtures/bar.cabal 22 | fixtures/foo.cabal 23 | 24 | source-repository head 25 | type: git 26 | location: https://github.com/phadej/aeson-compat 27 | -------------------------------------------------------------------------------- /fixtures/populate-extra-source-files/cabal-refact2.cabal: -------------------------------------------------------------------------------- 1 | name: cabal-refact 2 | version: 0 3 | x-revision: 2 4 | synopsis: Refactor tool for .cabal files 5 | description: Refactor tool for .cabal files, supporting among all things the build-depends editing. 6 | category: Web 7 | homepage: https://github.com/phadej/cabal-refact#readme 8 | bug-reports: https://github.com/phadej/cabal-refact/issues 9 | author: Oleg Grenrus 10 | maintainer: Oleg Grenrus 11 | license: BSD3 12 | license-file: LICENSE 13 | tested-with: GHC == 8.0.1 14 | build-type: Custom 15 | cabal-version: >= 1.10 16 | 17 | extra-source-files: 18 | CHANGELOG.md 19 | README.md 20 | -- cabal-refact-populate: fixtures/**/*.* 21 | fixtures/foo.cabal 22 | 23 | source-repository head 24 | type: git 25 | location: https://github.com/phadej/aeson-compat 26 | -------------------------------------------------------------------------------- /fixtures/populate-extra-source-files/cabal-refact2.cabal.output: -------------------------------------------------------------------------------- 1 | name: cabal-refact 2 | version: 0 3 | x-revision: 2 4 | synopsis: Refactor tool for .cabal files 5 | description: Refactor tool for .cabal files, supporting among all things the build-depends editing. 6 | category: Web 7 | homepage: https://github.com/phadej/cabal-refact#readme 8 | bug-reports: https://github.com/phadej/cabal-refact/issues 9 | author: Oleg Grenrus 10 | maintainer: Oleg Grenrus 11 | license: BSD3 12 | license-file: LICENSE 13 | tested-with: GHC == 8.0.1 14 | build-type: Custom 15 | cabal-version: >= 1.10 16 | 17 | extra-source-files: 18 | CHANGELOG.md 19 | README.md 20 | -- cabal-refact-populate: fixtures/**/*.* 21 | fixtures/bar.cabal 22 | fixtures/foo.cabal 23 | 24 | source-repository head 25 | type: git 26 | location: https://github.com/phadej/aeson-compat 27 | -------------------------------------------------------------------------------- /fixtures/set-version/cabal-refact.cabal: -------------------------------------------------------------------------------- 1 | name: cabal-refact 2 | synopsis: Refactor tool for .cabal files 3 | description: Refactor tool for .cabal files, supporting among all things the build-depends editing. 4 | -------------------------------------------------------------------------------- /fixtures/set-version/cabal-refact.cabal.output: -------------------------------------------------------------------------------- 1 | name: cabal-refact 2 | version: 1.2.3.4 3 | synopsis: Refactor tool for .cabal files 4 | description: Refactor tool for .cabal files, supporting among all things the build-depends editing. 5 | -------------------------------------------------------------------------------- /fixtures/set-version/focus.cabal: -------------------------------------------------------------------------------- 1 | name: 2 | focus 3 | version: 4 | 0.1.5 5 | synopsis: 6 | A general abstraction for manipulating elements of container data structures 7 | description: 8 | An API for construction of free-form strategies of access and manipulation of 9 | elements of arbitrary data structures. 10 | It allows to implement efficient composite patterns, e.g., 11 | a simultaneous update and lookup of an element, 12 | and even more complex things. 13 | . 14 | Strategies are meant to be interpreted by the host data structure libraries. 15 | Thus they allow to implement all access and modification patterns of 16 | a data structure with just a single function, 17 | which interprets strategies. 18 | . 19 | This library provides pure and monadic interfaces, 20 | so it supports both immutable and mutable data structures. 21 | -------------------------------------------------------------------------------- /fixtures/set-version/focus.cabal.output: -------------------------------------------------------------------------------- 1 | name: 2 | focus 3 | version: 4 | 1.2.3.4 5 | synopsis: 6 | A general abstraction for manipulating elements of container data structures 7 | description: 8 | An API for construction of free-form strategies of access and manipulation of 9 | elements of arbitrary data structures. 10 | It allows to implement efficient composite patterns, e.g., 11 | a simultaneous update and lookup of an element, 12 | and even more complex things. 13 | . 14 | Strategies are meant to be interpreted by the host data structure libraries. 15 | Thus they allow to implement all access and modification patterns of 16 | a data structure with just a single function, 17 | which interprets strategies. 18 | . 19 | This library provides pure and monadic interfaces, 20 | so it supports both immutable and mutable data structures. 21 | -------------------------------------------------------------------------------- /fixtures/set-version/focus2.cabal: -------------------------------------------------------------------------------- 1 | name: 2 | focus 3 | synopsis: 4 | A general abstraction for manipulating elements of container data structures 5 | description: 6 | An API for construction of free-form strategies of access and manipulation of 7 | elements of arbitrary data structures. 8 | It allows to implement efficient composite patterns, e.g., 9 | a simultaneous update and lookup of an element, 10 | and even more complex things. 11 | . 12 | Strategies are meant to be interpreted by the host data structure libraries. 13 | Thus they allow to implement all access and modification patterns of 14 | a data structure with just a single function, 15 | which interprets strategies. 16 | . 17 | This library provides pure and monadic interfaces, 18 | so it supports both immutable and mutable data structures. 19 | -------------------------------------------------------------------------------- /fixtures/set-version/focus2.cabal.output: -------------------------------------------------------------------------------- 1 | name: 2 | focus 3 | version: 4 | 1.2.3.4 5 | synopsis: 6 | A general abstraction for manipulating elements of container data structures 7 | description: 8 | An API for construction of free-form strategies of access and manipulation of 9 | elements of arbitrary data structures. 10 | It allows to implement efficient composite patterns, e.g., 11 | a simultaneous update and lookup of an element, 12 | and even more complex things. 13 | . 14 | Strategies are meant to be interpreted by the host data structure libraries. 15 | Thus they allow to implement all access and modification patterns of 16 | a data structure with just a single function, 17 | which interprets strategies. 18 | . 19 | This library provides pure and monadic interfaces, 20 | so it supports both immutable and mutable data structures. 21 | -------------------------------------------------------------------------------- /src/Distribution/Refact.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE OverloadedStrings #-} 2 | module Distribution.Refact ( 3 | -- * Types 4 | module Distribution.Refact.Types.Pos, 5 | module Distribution.Refact.Types.Structure, 6 | module Distribution.Refact.Types.Version, 7 | -- * Pretty 8 | prettyFields, 9 | -- * Parsing 10 | parseFields, 11 | -- * Annotations 12 | delFields, 13 | posFields, 14 | -- * Edit 15 | displayDiff, 16 | diffShowS, 17 | -- * Refactorings 18 | Refactoring, 19 | identityRefactoring, 20 | increaseRevisionRefactoring, 21 | setRevisionRefactoring, 22 | populateExtraSourceFilesRefactoring, 23 | setVersionRefactoring, 24 | -- * Internal helpers 25 | displayDoc, 26 | Result (..), 27 | _errDoc, 28 | getDirectoryContentsRecursive', 29 | notDistsStackWork, 30 | ) where 31 | 32 | import Prelude () 33 | 34 | import Distribution.Refact.Annotations 35 | import Distribution.Refact.Parser 36 | import Distribution.Refact.Pretty 37 | import Distribution.Refact.Refactoring.Identity 38 | import Distribution.Refact.Refactoring.IncreaseRevision 39 | import Distribution.Refact.Refactoring.PopulateExtraSourceFiles 40 | import Distribution.Refact.Refactoring.SetVersion 41 | import Distribution.Refact.Tools.Edit 42 | import Distribution.Refact.Types.Pos 43 | import Distribution.Refact.Types.Refactoring 44 | import Distribution.Refact.Types.Structure 45 | import Distribution.Refact.Types.Version 46 | 47 | import Text.Trifecta (Result (..), _errDoc) 48 | -------------------------------------------------------------------------------- /src/Distribution/Refact/Annotations.hs: -------------------------------------------------------------------------------- 1 | module Distribution.Refact.Annotations ( 2 | delFields, 3 | posFields, 4 | ) where 5 | 6 | import Prelude () 7 | import Distribution.Refact.Internal.Prelude 8 | import Distribution.Refact.Types.Pos 9 | import Distribution.Refact.Types.Structure 10 | 11 | -- TODO: use firstOf1 12 | import Data.Semigroup (First (..), Last (..)) 13 | 14 | ------------------------------------------------------------------------------- 15 | -- SrcSpan -> D 16 | ------------------------------------------------------------------------------- 17 | 18 | -- | Change fields annotations from absolute 'SrcSpan' to relative 'D'. 19 | delFields :: Fields SrcSpan -> Fields D 20 | delFields = delFields' (Pos 0 0) 21 | 22 | delSum :: Pos -> Sum Comment Field SrcSpan -> Sum Comment Field D 23 | delSum p (InR f) = InR (delField p f) 24 | delSum p (InL c) = InL (delComment p c) 25 | 26 | delField :: Pos -> Field SrcSpan -> Field D 27 | delField p f = case f of 28 | Field n ss fls -> Field 29 | (diffPos p p' <$ n) 30 | (diffPos p' $ ss ^. ssStart) 31 | (delFieldValue p' fls) 32 | where 33 | p' = n ^. nameAnn . ssStart 34 | Section n t fs -> Section 35 | (g <$> n) 36 | t 37 | (delFields' (n ^. nameAnn . ssStart) fs) 38 | where 39 | g (SS p' _) = diffPos p p' 40 | 41 | delComment :: Pos -> Comment SrcSpan -> Comment D 42 | delComment p (Comment ss t) = Comment (g ss) t 43 | where 44 | g (SS p' _) = diffPos p p' 45 | 46 | delFieldValue :: Pos -> FieldValue SrcSpan -> FieldValue D 47 | delFieldValue p (FieldLines fls) = FieldLines (delFieldLines p fls) 48 | delFieldValue p (FieldNumber ss n) = FieldNumber (diffPos p $ ss ^. ssStart) n 49 | delFieldValue p (FieldVersion ss v) = FieldVersion (diffPos p $ ss ^. ssStart) v 50 | 51 | delFieldLines :: Pos -> [FieldLine SrcSpan] -> [FieldLine D] 52 | delFieldLines _ [] = [] 53 | delFieldLines p (FieldLine ss t : fls) = 54 | let p' = ss ^. ssStart 55 | in FieldLine (diffPos p p') t : delFieldLines p' fls 56 | 57 | delFields' :: Pos -> Fields SrcSpan -> Fields D 58 | delFields' _p [] = [] 59 | delFields' p (f : fs) = 60 | let SS b e = fold1 f 61 | in delSum p f : delFields' (Pos (e ^. posLine) (b ^. posColumn)) fs 62 | 63 | ------------------------------------------------------------------------------- 64 | -- D -> Pos 65 | ------------------------------------------------------------------------------- 66 | 67 | -- | Change fields annotations from relative 'D' to absolute 'Pos'. 68 | posFields :: Fields D -> Fields Pos 69 | posFields = posFields' (Pos 0 0) 70 | 71 | posFields' :: Pos -> Fields D -> Fields Pos 72 | posFields' _p [] = [] 73 | posFields' p (f : fs) = f' : posFields' p'' fs 74 | where 75 | -- where to start current field 76 | f' = posSum p' f 77 | d = getFirst . foldMap1 First $ f 78 | p' = addPos p d 79 | 80 | -- offset of the next fields 81 | Pos l _ = getLast . foldMap1 Last $ f' 82 | p'' = Pos l $ p' ^. posColumn 83 | 84 | posSum :: Pos -> Sum Comment Field D -> Sum Comment Field Pos 85 | posSum p (InR f) = InR (posField p f) 86 | posSum p (InL c) = InL (posComment p c) 87 | 88 | posField :: Pos -> Field D -> Field Pos 89 | posField p (Field n d fls) = Field 90 | (n & nameAnn .~ p) 91 | (addPos p d) 92 | (posFieldValue p fls) 93 | posField p (Section n t fs) = Section 94 | (n & nameAnn .~ p) 95 | t 96 | (posFields' p fs) 97 | 98 | posComment :: Pos -> Comment D -> Comment Pos 99 | posComment p (Comment _ t) = Comment p t 100 | 101 | posFieldValue :: Pos -> FieldValue D -> FieldValue Pos 102 | posFieldValue p (FieldLines fls) = FieldLines (posFieldLines p fls) 103 | posFieldValue p (FieldNumber d n) = FieldNumber (addPos p d) n 104 | posFieldValue p (FieldVersion d v) = FieldVersion (addPos p d) v 105 | 106 | posFieldLines :: Pos -> [FieldLine D] -> [FieldLine Pos] 107 | posFieldLines _ [] = [] 108 | posFieldLines p (FieldLine d t : rest) = 109 | let p' = addPos p d 110 | in FieldLine p' t : posFieldLines p' rest 111 | -------------------------------------------------------------------------------- /src/Distribution/Refact/Internal/Prelude.hs: -------------------------------------------------------------------------------- 1 | module Distribution.Refact.Internal.Prelude ( 2 | module Prelude, 3 | module Control.Lens, 4 | -- * Control.Applicative 5 | Alternative (..), 6 | optional, 7 | -- * Control.Monad 8 | join, when, 9 | -- * Data.Deriving 10 | deriveEq1, deriveShow1, 11 | -- * Data.Functor 12 | void, 13 | -- * Data.Functor.Classes 14 | Eq1 (..), Show1 (..), showsBinaryWith, 15 | -- * Data.Functor.Sum 16 | Sum (..), 17 | -- * Data.Int 18 | Int64, 19 | -- * Data.Foldable 20 | traverse_, for_, 21 | -- * Data.List 22 | sortBy, sortOn, 23 | -- * Data.List.NonEmpty 24 | NonEmpty (..), some1, 25 | -- * Data.Maybe 26 | fromMaybe, listToMaybe, 27 | -- * Data.Monoid 28 | Endo (..), 29 | -- * bifunctors 30 | Bifunctor (..), 31 | -- * containers 32 | toMapOf, 33 | -- * semigroups 34 | Semigroup (..), 35 | -- * semigroupoids 36 | Foldable1 (..), 37 | Traversable1 (..), 38 | -- * transformers 39 | MonadIO (..), 40 | -- * text 41 | Text, 42 | packed, unpacked, 43 | -- * these 44 | These (..), 45 | Align (..), 46 | -- * vector 47 | Vector, 48 | vector, 49 | -- * extras 50 | asText, 51 | _InR, 52 | spanMaybe, 53 | ) where 54 | 55 | import Prelude 56 | 57 | -- We endorse lens 58 | import Control.Lens 59 | 60 | import Control.Applicative (Alternative (..), optional) 61 | import Control.Monad (join, when) 62 | import Control.Monad.IO.Class 63 | import Data.Align (Align (..)) 64 | import Data.Bifunctor (Bifunctor (..)) 65 | import Data.Deriving (deriveEq1, deriveShow1) 66 | import Data.Foldable (for_, traverse_) 67 | import Data.Functor (void) 68 | import Data.Functor.Classes (Eq1 (..), Show1 (..), showsBinaryWith) 69 | import Data.Functor.Sum (Sum (..)) 70 | import Data.Int (Int64) 71 | import Data.List (sortBy, sortOn) 72 | import Data.List.NonEmpty (NonEmpty (..), some1) 73 | import Data.Map.Lens (toMapOf) 74 | import Data.Maybe (fromMaybe, listToMaybe) 75 | import Data.Monoid (Endo (..)) 76 | import Data.Semigroup (Semigroup (..)) 77 | import Data.Semigroup.Foldable (Foldable1 (..)) 78 | import Data.Semigroup.Traversable (Traversable1 (..)) 79 | import Data.Text (Text) 80 | import Data.Text.Lens (packed, unpacked) 81 | import Data.These (These (..)) 82 | import Data.Vector (Vector) 83 | import Data.Vector.Lens (vector) 84 | 85 | asText :: Show a => Getter a Text 86 | asText = to show . packed 87 | 88 | _InR :: Prism' (Sum f g a) (g a) 89 | _InR = prism InR g 90 | where 91 | g (InR x) = Right x 92 | g x = Left x 93 | 94 | spanMaybe :: (a -> Maybe b) -> [a] -> ([b], [a]) 95 | spanMaybe _ xs@[] = ([], xs) 96 | spanMaybe p xs@(x:xs') = case p x of 97 | Nothing -> ([], xs) 98 | Just y -> let (ys, zs) = spanMaybe p xs' in (y:ys,zs) 99 | -------------------------------------------------------------------------------- /src/Distribution/Refact/Parser.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE OverloadedStrings #-} 2 | module Distribution.Refact.Parser ( 3 | parseFields, 4 | ) where 5 | 6 | import Prelude () 7 | import Distribution.Refact.Internal.Prelude 8 | import Distribution.Refact.Tools.Trifecta 9 | import Distribution.Refact.Types.Pos 10 | import Distribution.Refact.Types.Structure 11 | import Distribution.Refact.Types.Version 12 | 13 | import Data.Char (isLetter) 14 | import Text.Trifecta.Delta (Delta (..), HasDelta (..), column) 15 | 16 | -- | Parse 'Field's 17 | parseFields :: FilePath -> Text -> Result (Fields SrcSpan) 18 | parseFields = runIParser cabalFileParser 19 | 20 | cabalFileParser :: (DeltaParsing m, IndentationParsing m) => m (Fields SrcSpan) 21 | cabalFileParser = fieldsParser <* eof 22 | 23 | fieldsParser :: (DeltaParsing m, IndentationParsing m) => m (Fields SrcSpan) 24 | fieldsParser = many $ 25 | absoluteIndentation (InR <$> fieldParser) <|> localIndentation Any (InL <$> commentParser) 26 | 27 | fieldParser :: (DeltaParsing m, IndentationParsing m) => m (Field SrcSpan) 28 | fieldParser = do 29 | name <- nameParser 30 | fieldParser' name <|> sectionParser name 31 | 32 | fieldParser' 33 | :: (DeltaParsing m, IndentationParsing m) 34 | => Name SrcSpan -> m (Field SrcSpan) 35 | fieldParser' name = Field name 36 | <$> srcSpanParser const (char ':') 37 | <* spaces' 38 | <*> fieldValueParser (name ^. nameText) 39 | 40 | fieldValueParser 41 | :: (DeltaParsing m, IndentationParsing m) 42 | => Text -> m (FieldValue SrcSpan) 43 | fieldValueParser name = fromMaybe fieldLinesParser $ x ^? ix name 44 | where 45 | x = toMapOf (folded . ifolded) 46 | [ ("x-revision", fieldNumberParser) 47 | , ("version", fieldVersionParser) 48 | ] 49 | 50 | fieldLinesParser 51 | :: (DeltaParsing m, IndentationParsing m) 52 | => m (FieldValue SrcSpan) 53 | fieldLinesParser = FieldLines <$> fieldlines 54 | where 55 | -- little hacky: we parse also all-spaces lines, but later filter them out 56 | fieldlines = filter (not . fieldLineNull) <$> localIndentation Gt (many l) 57 | l = srcSpanParser (\s -> FieldLine s . view packed) (many $ satisfy (/= '\n')) <* nl 58 | 59 | fieldNumberParser 60 | :: (DeltaParsing m, IndentationParsing m) 61 | => m (FieldValue SrcSpan) 62 | fieldNumberParser = 63 | spaces' *> optional nl *> 64 | srcSpanParser FieldNumber integral <* nl 65 | 66 | fieldVersionParser 67 | :: (DeltaParsing m, IndentationParsing m) 68 | => m (FieldValue SrcSpan) 69 | fieldVersionParser = 70 | spaces' *> optional nl *> 71 | srcSpanParser FieldVersion versionParser <* nl 72 | 73 | sectionParser :: (DeltaParsing m, IndentationParsing m) => Name SrcSpan -> m (Field SrcSpan) 74 | sectionParser name = 75 | Section name <$> sectionArgs <*> localIndentation Gt fieldsParser 76 | where 77 | sectionArgs = view packed <$> manyTill (satisfy (/= ':')) nl 78 | 79 | commentParser :: (DeltaParsing m, IndentationParsing m) => m (Comment SrcSpan) 80 | commentParser = (srcSpanParser Comment $ view packed <$> p) <* nl 81 | where 82 | p = (<>) <$> string "--" <*> many (satisfy (/= '\n')) 83 | 84 | nameParser :: (DeltaParsing m) => m (Name SrcSpan) 85 | nameParser = srcSpanParser Name name' <* spaces' "name" 86 | where 87 | name' = fmap (view packed) $ (:) <$> hp <*> tp 88 | hp = satisfy isLetter 89 | tp = many $ satisfy $ \c -> isLetter c || c == '-' 90 | 91 | ------------------------------------------------------------------------------- 92 | -- SrcSpan 93 | ------------------------------------------------------------------------------- 94 | 95 | lineNum :: HasDelta t => t -> Int64 96 | lineNum t = case delta t of 97 | Columns _ _ -> 0 98 | Tab _ _ _ -> 0 99 | Lines l _ _ _ -> l 100 | Directed _ l _ _ _ -> l 101 | 102 | srcSpanParser :: DeltaParsing m => (SrcSpan -> a -> b) -> m a -> m b 103 | srcSpanParser f p = do 104 | s <- pos 105 | x <- p 106 | e <- pos 107 | spaces' 108 | pure $ f (SS s e) x 109 | where 110 | 111 | pos :: DeltaParsing m => m Pos 112 | pos = (\d -> Pos (fromIntegral $ lineNum d) (fromIntegral $ column d)) <$> position 113 | -------------------------------------------------------------------------------- /src/Distribution/Refact/Pretty.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE OverloadedStrings #-} 2 | -- | Format 'Field' back to 'Text'. 3 | module Distribution.Refact.Pretty ( 4 | prettyFields, 5 | ) where 6 | 7 | import Prelude () 8 | import Distribution.Refact.Internal.Prelude 9 | 10 | import Distribution.Refact.Tools.Pretty 11 | import Distribution.Refact.Types.Pos 12 | import Distribution.Refact.Types.Structure 13 | import Distribution.Refact.Types.Version 14 | 15 | -- | Make 'Text' from 'Field's, trying to respect 'Pos' annotations 16 | -- as well as possible. 17 | prettyFields :: Fields Pos -> Text 18 | prettyFields = view strict . (<> "\n") . execW . prettyFields' 19 | 20 | prettyFields' :: Fields Pos -> W () 21 | prettyFields' = traverse_ prettyField 22 | 23 | prettyField :: Sum Comment Field Pos -> W () 24 | prettyField (InR (Field n p fs)) = do 25 | prettyName n 26 | prettyTextAt p ":" 27 | prettyFieldValue fs 28 | prettyField (InR (Section n t fs)) = do 29 | prettyName n 30 | when (isn't _Empty t) $ do 31 | prettyText " " 32 | prettyText t 33 | prettyFields' fs 34 | prettyField (InL (Comment p t)) = do 35 | prettyTextAt p t 36 | 37 | prettyName :: Name Pos -> W () 38 | prettyName (Name p t) = prettyTextAt p t 39 | 40 | prettyFieldValue :: FieldValue Pos -> W () 41 | prettyFieldValue (FieldLines fls) = traverse_ prettyFieldLine fls 42 | prettyFieldValue (FieldNumber p n) = prettyTextAt p (n ^. re _Show . packed) 43 | prettyFieldValue (FieldVersion p v) = prettyTextAt p (versionToText v) 44 | 45 | prettyFieldLine :: FieldLine Pos -> W () 46 | prettyFieldLine (FieldLine p t) = prettyTextAt p t 47 | -------------------------------------------------------------------------------- /src/Distribution/Refact/Refactoring/Identity.hs: -------------------------------------------------------------------------------- 1 | module Distribution.Refact.Refactoring.Identity where 2 | 3 | import Distribution.Refact.Types.Refactoring 4 | 5 | identityRefactoring :: Refactoring 6 | identityRefactoring = id 7 | -------------------------------------------------------------------------------- /src/Distribution/Refact/Refactoring/IncreaseRevision.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE OverloadedStrings #-} 2 | module Distribution.Refact.Refactoring.IncreaseRevision ( 3 | increaseRevisionRefactoring, 4 | setRevisionRefactoring, 5 | ) where 6 | 7 | import Prelude () 8 | import Distribution.Refact.Internal.Prelude 9 | import Distribution.Refact.Types.Pos 10 | import Distribution.Refact.Types.Refactoring 11 | import Distribution.Refact.Types.Structure 12 | 13 | increaseRevisionRefactoring :: Refactoring 14 | increaseRevisionRefactoring = updateRevisionRefactoring $ maybe 1 (+1) 15 | 16 | setRevisionRefactoring :: Int -> Refactoring 17 | setRevisionRefactoring = updateRevisionRefactoring . const 18 | 19 | updateRevisionRefactoring :: (Maybe Int -> Int) -> Refactoring 20 | updateRevisionRefactoring upd fs = case fs ^? topLevelField fieldName of 21 | -- no revision, use zero 22 | Nothing -> (review _InRField <$> insertAfterVersion as) <> bs 23 | -- otherwise, update 24 | Just _ -> fs & topLevelField fieldName . _FieldNumber . _2 %~ upd . Just 25 | where 26 | fieldName :: Text 27 | fieldName = "x-revision" 28 | 29 | -- fields and rest 30 | (as, bs) = spanMaybe (preview _InRField) fs 31 | 32 | ver :: Int 33 | ver = upd Nothing 34 | 35 | ver' :: FieldValue D 36 | ver' = FieldNumber (D 0 $ length (fieldName ^. unpacked) + 3) ver 37 | 38 | insertAfterVersion [] = [(Name (D 1 0) fieldName, mempty, ver')] 39 | insertAfterVersion (f@(Name d n, d', fls) : rest) 40 | | n == "version" 41 | = f 42 | : (Name (d & dLine %~ max 1) fieldName, d', mimic d $ firstOf folded fls) 43 | : rest 44 | | otherwise = f : insertAfterVersion rest 45 | 46 | mimic d Nothing = FieldNumber (d <> D 0 2) ver 47 | mimic _ (Just d) = FieldNumber d ver 48 | -------------------------------------------------------------------------------- /src/Distribution/Refact/Refactoring/PopulateExtraSourceFiles.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE OverloadedStrings #-} 2 | module Distribution.Refact.Refactoring.PopulateExtraSourceFiles ( 3 | populateExtraSourceFilesRefactoring, 4 | getDirectoryContentsRecursive', 5 | notDistsStackWork, 6 | ) where 7 | 8 | import Prelude () 9 | import Distribution.Refact.Internal.Prelude 10 | import Distribution.Refact.Types.Pos 11 | import Distribution.Refact.Types.Refactoring 12 | import Distribution.Refact.Types.Structure 13 | 14 | import Data.Char (isSpace) 15 | import Data.List (nubBy, sort) 16 | import System.Directory (doesDirectoryExist, getDirectoryContents) 17 | import System.FilePath (takeFileName, ()) 18 | import System.IO.Unsafe (unsafeInterleaveIO) 19 | 20 | import qualified System.FilePath.Glob as Glob 21 | import qualified Text.Regex.Applicative.Text as RE 22 | 23 | populateExtraSourceFilesRefactoring :: [FilePath] -> Refactoring 24 | populateExtraSourceFilesRefactoring files = 25 | topLevelField "extra-source-files" . _FieldLines %~ nubBy nubber . refactor 26 | where 27 | nubber (FieldLine _ n) (FieldLine _ m) = n == m 28 | 29 | refactor :: [FieldLine D] -> [FieldLine D] 30 | refactor [] = [] 31 | refactor (f@(FieldLine _ n) : fls) = case RE.match pragmaRe n of 32 | Nothing -> f : refactor fls 33 | Just pat -> 34 | let pattern = Glob.simplify $ Glob.compile $ pat ^. unpacked 35 | files' = filter (Glob.match pattern) files 36 | in f : map mk (sort files') ++ refactor fls 37 | where 38 | mk fp = FieldLine (D 1 0) (fp ^. packed) 39 | 40 | -- We could use trifecta here as well. Shouldn't we? 41 | -- We don't need any/good error reporting though. 42 | pragmaRe :: RE.RE' String -- glob pattern 43 | pragmaRe = "--" *> spacesRe *> "cabal-refact-populate" 44 | *> optional spacesRe *> RE.sym ':' 45 | *> optional spacesRe 46 | *> filenameRe 47 | <* optional (spacesRe *> many RE.anySym) 48 | 49 | filenameRe = some $ RE.psym $ not . isSpace 50 | spacesRe = some $ RE.psym isSpace 51 | 52 | -- | Returns 'False' for: 53 | -- 54 | -- * '.git' 55 | -- 56 | -- * 'dist' 57 | -- 58 | -- * 'dist-newstyle' 59 | -- 60 | -- * '.stack-work' 61 | notDistsStackWork :: FilePath -> Bool 62 | notDistsStackWork fp = takeFileName fp `notElem` 63 | [ ".git" 64 | , "dist" 65 | , "dist-newstyle" 66 | , ".stack-work" 67 | ] 68 | 69 | -- | List all the files in a directory and all subdirectories. 70 | -- 71 | -- The order places files in sub-directories after all the files in their 72 | -- parent directories. The list is generated lazily so is not well defined if 73 | -- the source directory structure changes before the list is used. 74 | -- 75 | -- /Note:/ From @Cabal@'s "Distribution.Simple.Utils" 76 | getDirectoryContentsRecursive' 77 | :: (FilePath -> Bool) -- ^ Check, whether to recurse 78 | -> FilePath -- ^ top dir 79 | -> IO [FilePath] 80 | getDirectoryContentsRecursive' ignore' topdir = recurseDirectories [""] 81 | where 82 | recurseDirectories :: [FilePath] -> IO [FilePath] 83 | recurseDirectories [] = return [] 84 | recurseDirectories (dir:dirs) = unsafeInterleaveIO $ do 85 | (files, dirs') <- collect [] [] =<< getDirectoryContents (topdir dir) 86 | files' <- recurseDirectories (dirs' ++ dirs) 87 | return (files ++ files') 88 | 89 | where 90 | collect files dirs' [] = return (reverse files 91 | ,reverse dirs') 92 | collect files dirs' (entry:entries) | ignore entry 93 | = collect files dirs' entries 94 | collect files dirs' (entry:entries) = do 95 | let dirEntry = dir entry 96 | isDirectory <- doesDirectoryExist (topdir dirEntry) 97 | if isDirectory 98 | then collect files (dirEntry:dirs') entries 99 | else collect (dirEntry:files) dirs' entries 100 | 101 | ignore ['.'] = True 102 | ignore ['.', '.'] = True 103 | ignore x = not (ignore' x) 104 | -------------------------------------------------------------------------------- /src/Distribution/Refact/Refactoring/SetVersion.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE OverloadedStrings #-} 2 | module Distribution.Refact.Refactoring.SetVersion ( 3 | setVersionRefactoring, 4 | ) where 5 | 6 | import Prelude () 7 | import Distribution.Refact.Internal.Prelude 8 | import Distribution.Refact.Types.Pos 9 | import Distribution.Refact.Types.Refactoring 10 | import Distribution.Refact.Types.Structure 11 | import Distribution.Refact.Types.Version 12 | 13 | setVersionRefactoring :: Version -> Refactoring 14 | setVersionRefactoring = updateVersionRefactoring . const 15 | 16 | updateVersionRefactoring :: (Maybe Version -> Version) -> Refactoring 17 | updateVersionRefactoring upd fs = case fs ^? topLevelField fieldName of 18 | -- no revision, use zero 19 | Nothing -> (review _InRField <$> insertAfterName as) <> bs 20 | -- otherwise, update 21 | Just _ -> fs & topLevelField fieldName . _FieldVersion . _2 %~ upd . Just 22 | where 23 | fieldName :: Text 24 | fieldName = "version" 25 | 26 | -- fields and rest 27 | (as, bs) = spanMaybe (preview _InRField) fs 28 | 29 | ver :: Version 30 | ver = upd Nothing 31 | 32 | ver' :: FieldValue D 33 | ver' = FieldVersion (D 0 $ length (fieldName ^. unpacked) + 3) ver 34 | 35 | insertAfterName [] = [(Name (D 1 0) fieldName, mempty, ver')] 36 | insertAfterName (f@(Name d n, d', fls) : rest) 37 | | n == "name" 38 | = f 39 | : (Name (d & dLine %~ max 1) fieldName, d', mimic d $ firstOf folded fls) 40 | : rest 41 | | otherwise = f : insertAfterName rest 42 | 43 | mimic d Nothing = FieldVersion (d <> D 0 2) ver 44 | mimic _ (Just d) = FieldVersion d ver 45 | -------------------------------------------------------------------------------- /src/Distribution/Refact/Tools/Edit.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE OverloadedStrings #-} 2 | module Distribution.Refact.Tools.Edit where 3 | 4 | import Prelude () 5 | import Distribution.Refact.Internal.Prelude 6 | 7 | import Control.Monad.Writer.Strict (execWriter, tell) 8 | import Data.Monoid (Endo (..)) 9 | import System.IO (stdout) 10 | 11 | import qualified Data.Text as T 12 | import qualified Text.PrettyPrint.ANSI.Leijen as ANSI 13 | 14 | import qualified Distribution.Refact.Tools.Edit.Algorithm as Edit 15 | 16 | -- | move somewhere else 17 | displayDoc :: ANSI.Doc -> IO () 18 | displayDoc 19 | = ANSI.displayIO stdout 20 | . ANSI.renderPretty 1.8 80 21 | . (ANSI.<> ANSI.linebreak) 22 | 23 | -- | Make diff and display it. 24 | displayDiff 25 | :: Text -- ^ old 26 | -> Text -- ^ new 27 | -> IO () 28 | displayDiff a b | a == b 29 | = displayDoc $ ANSI.cyan $ ANSI.text "no changes" 30 | displayDiff b a = 31 | for_ (Edit.hunks 3 $ Edit.improve $ Edit.diff (T.lines a) (T.lines b)) $ \h -> do 32 | displayDoc $ ANSI.blue $ ANSI.text $ replicate 72 '=' 33 | for_ h $ \e -> displayDoc $ case e of 34 | Edit.Take t -> ANSI.text $ T.unpack $ " " <> t 35 | Edit.Drop t -> ANSI.red $ ANSI.text $ T.unpack $ "- " <> t 36 | Edit.Add t -> ANSI.green $ ANSI.text $ T.unpack $ "+ " <> t 37 | 38 | diffShowS 39 | :: Text -- ^ old 40 | -> Text -- ^ new 41 | -> ShowS 42 | diffShowS a b | a == b = showString "no changes" 43 | diffShowS b a = appEndo $ execWriter $ 44 | for_ (Edit.hunks 3 $ Edit.improve $ Edit.diff (T.lines a) (T.lines b)) $ \h -> do 45 | tell $ Endo $ showString $ replicate 72 '=' 46 | tell $ Endo $ showChar '\n' 47 | for_ h $ \e -> do 48 | tell . Endo . showString $ case e of 49 | Edit.Take t -> T.unpack $ " " <> t 50 | Edit.Drop t -> T.unpack $ "- " <> t 51 | Edit.Add t -> T.unpack $ "+ " <> t 52 | tell $ Endo $ showChar '\n' 53 | -------------------------------------------------------------------------------- /src/Distribution/Refact/Tools/Edit/Algorithm.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE ScopedTypeVariables #-} 2 | {-# LANGUAGE TupleSections #-} 3 | -- | Edit distance with a witness. 4 | module Distribution.Refact.Tools.Edit.Algorithm where 5 | 6 | import Prelude () 7 | import Distribution.Refact.Internal.Prelude 8 | 9 | data Edit a 10 | = Take a 11 | | Drop a 12 | | Add a 13 | deriving (Eq, Show) 14 | 15 | -- | /Reverse/ of the 'diff'. 16 | -- 17 | -- >>> patch [Take "a"] ["a"] 18 | -- Just ["a"] 19 | -- 20 | patch :: Eq a => [Edit a] -> [a] -> Maybe [a] 21 | patch [] [] = Just [] 22 | patch [] (_ : _) = Nothing 23 | patch (Add a : es) xs = (a :) <$> patch es xs 24 | patch (Take _ : _) [] = Nothing 25 | patch (Take a : es) (x : xs) | a == x = (a :) <$> patch es xs 26 | | otherwise = Nothing 27 | patch (Drop _ : _) [] = Nothing 28 | patch (Drop a : es) (x : xs) | a == x = patch es xs 29 | | otherwise = Nothing 30 | 31 | -- | Sort edits so there are 'Drop's before 'Add's. 32 | -- 33 | -- /TODO:/ should there be 'Add's before 'Take's? 34 | -- 35 | -- >>> improve $ diff "ffoo" "bbar" 36 | -- [Drop 'b',Drop 'b',Drop 'a',Drop 'r',Add 'f',Add 'f',Add 'o',Add 'o'] 37 | -- 38 | improve :: [Edit a] -> [Edit a] 39 | improve = reverse . foldl i [] 40 | where 41 | i :: [Edit a] -> Edit a -> [Edit a] 42 | i [] x = [x] 43 | i (Add y : ys) x@(Drop _) = Add y : i ys x 44 | i xs x = x : xs 45 | 46 | -- | Group edits into hunks. 47 | hunks :: Int -> [Edit a] -> [[Edit a]] 48 | hunks lim = g . reverse . f 0 . reverse . f 0 . map (False,) 49 | where 50 | f _ [] = [] 51 | f n ((b, Take t) : xs) = (b || n > 0, Take t) : f (n - 1) xs 52 | f _ ((_, Drop t) : xs) = (True, Drop t) : f lim xs 53 | f _ ((_, Add t) : xs) = (True, Add t ) : f lim xs 54 | 55 | g [] = [] 56 | g xs@((True, _) : _) = let (a, b) = span fst xs in map snd a : g b 57 | g ((False, _) : xs) = g xs 58 | 59 | -- | Diff. Calculates the minimum edit distance, returns a witness. 60 | -- 61 | -- >>> diff "ffoo" "bboo" 62 | -- [Add 'f',Drop 'b',Add 'f',Drop 'b',Take 'o',Take 'o'] 63 | -- 64 | diff :: forall a. Eq a => [a] -> [a] -> [Edit a] 65 | diff xs ys = appEndo (snd $ lev xn yn) [] 66 | where 67 | lev :: Int -> Int -> (Int, Endo [Edit a]) 68 | lev i j = memo ^?! ix i . ix j 69 | 70 | memo :: Vector (Vector (Int, Endo [Edit a])) 71 | memo = [ [ lev' i j | j <- [0..yn] ] ^. vector | i <- [0..xn] ] ^. vector 72 | 73 | lev' :: Int -> Int -> (Int, Endo [Edit a]) 74 | lev' i j | i <= 0 && j <= 0 = (0, Endo id) 75 | lev' i j | i <= 0 = (j, fromList (Drop <$> take j ys)) 76 | lev' i j | j <= 0 = (i, fromList (Add <$> take i xs)) 77 | lev' i j = head $ sortOn fst $ 78 | [ bimap (+1) (sn $ Add x) $ lev i' j 79 | , bimap (+1) (sn $ Drop y) $ lev i j' 80 | , t 81 | ] 82 | where 83 | i' = i - 1 84 | j' = j - 1 85 | x = vxs ^?! ix i' 86 | y = vys ^?! ix j' 87 | t | x == y = 88 | bimap id (sn (Take x)) $ lev i' j' 89 | | otherwise = 90 | bimap (+1) (sn (Drop y) . sn (Add x)) $ lev i' j' 91 | 92 | vxs = xs ^. vector 93 | vys = ys ^. vector 94 | 95 | xn = length vxs 96 | yn = length vys 97 | 98 | sn :: forall b. b -> Endo [b] -> Endo [b] 99 | sn b = (<> Endo (b :)) 100 | 101 | fromList :: forall b. [b] -> Endo [b] 102 | fromList bs = Endo (bs ++) 103 | 104 | -- | Trivial diff 105 | -- 106 | -- >>> length (trivialDiff "foo" "boo") 107 | -- 6 108 | -- 109 | -- >>> patch (trivialDiff "foo" "boo") "foo" 110 | -- Just "boo" 111 | -- 112 | trivialDiff :: [a] -> [a] -> [Edit a] 113 | trivialDiff xs ys = map Drop xs ++ map Add ys 114 | -------------------------------------------------------------------------------- /src/Distribution/Refact/Tools/Pretty.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE GeneralizedNewtypeDeriving #-} 2 | module Distribution.Refact.Tools.Pretty where 3 | 4 | import Prelude () 5 | import Distribution.Refact.Internal.Prelude 6 | 7 | import Distribution.Refact.Types.Pos 8 | 9 | import Control.Monad.State.Strict (State, execState) 10 | 11 | import qualified Data.Text as T 12 | import qualified Data.Text.Lazy as TL 13 | import qualified Data.Text.Lazy.Builder as B 14 | 15 | data WS = WS !Pos !B.Builder 16 | 17 | wsPos :: Lens' WS Pos 18 | wsPos f (WS p b) = flip WS b <$> f p 19 | 20 | wsBuilder :: Lens' WS B.Builder 21 | wsBuilder f (WS p b) = WS p <$> f b 22 | 23 | newtype W a = W { unW :: State WS a } 24 | deriving (Functor, Applicative, Monad) 25 | 26 | appendBuilder :: B.Builder -> State WS () 27 | appendBuilder b = wsBuilder %= (<> b) 28 | 29 | prettyNewline :: W () 30 | prettyNewline = W $ do 31 | wsPos . posLine += 1 32 | appendBuilder $ B.singleton '\n' 33 | 34 | -- | Assumes there is no over UTF16 characters, neither newlines in 'Text'. 35 | prettyTextAt :: Pos -> Text -> W () 36 | prettyTextAt p t = W $ do 37 | p'@(Pos l' c') <- use wsPos 38 | let Pos l c = max p p' 39 | 40 | let (ls, cs) = case compare l l' of 41 | EQ -> (0, c - c') 42 | LT -> (0, 0) 43 | GT -> (l - l', c) 44 | let b1 = B.fromString (replicate ls '\n') 45 | let b2 = b1 <> B.fromString (replicate cs ' ') 46 | let b3 = b2 <> B.fromText t' 47 | 48 | wsPos .= Pos l (c + T.length t') 49 | appendBuilder b3 50 | where 51 | t' = T.filter (/= '\n') t 52 | 53 | prettyText :: Text -> W () 54 | prettyText = prettyTextAt (Pos 0 0) -- abusing implementation 55 | 56 | execW :: W a -> TL.Text 57 | execW (W s) = let WS _ b = execState s (WS (Pos 0 0) mempty) in B.toLazyText b 58 | -------------------------------------------------------------------------------- /src/Distribution/Refact/Tools/Trifecta.hs: -------------------------------------------------------------------------------- 1 | module Distribution.Refact.Tools.Trifecta ( 2 | -- * Modules 3 | module Text.Trifecta, 4 | module Text.Trifecta.Indentation, 5 | -- * Types 6 | runIParser, 7 | -- * Additional parsers 8 | spaces', 9 | nl, 10 | integral, 11 | ) where 12 | 13 | import Prelude () 14 | import Distribution.Refact.Internal.Prelude 15 | 16 | import Data.Char (ord) 17 | import Data.List (foldl') 18 | import Text.Trifecta hiding (Parser) 19 | import Text.Trifecta.Delta 20 | import Text.Trifecta.Indentation hiding (IndentationParserT) 21 | 22 | import qualified Data.Text.Encoding as TE 23 | import qualified Text.Trifecta as Tri 24 | import qualified Text.Trifecta.Indentation as Tri 25 | 26 | ------------------------------------------------------------------------------- 27 | -- parser types 28 | ------------------------------------------------------------------------------- 29 | 30 | runIParser 31 | :: Tri.IndentationParserT Char Tri.Parser a -- ^ parser 32 | -> FilePath -- ^ filename 33 | -> Text -- ^ contents 34 | -> Result a 35 | runIParser p fn contents = 36 | parseByteString p' (Directed fnBS 0 0 0 0) contentsBS 37 | where 38 | contentsBS = TE.encodeUtf8 contents 39 | fnBS = TE.encodeUtf8 (fn ^. packed) 40 | s = mkIndentationState 0 infIndentation True Gt 41 | p' = evalIndentationParserT p s 42 | 43 | ------------------------------------------------------------------------------- 44 | -- Additional parsers 45 | ------------------------------------------------------------------------------- 46 | 47 | spaces' :: CharParsing m => m () 48 | spaces' = skipMany (oneOf " \t") 49 | 50 | nl :: (CharParsing m, IndentationParsing m) => m () 51 | nl = oneOf "\n\r" *> localIndentation Any spaces 52 | 53 | integral :: (Num a, CharParsing m) => m a 54 | integral = foldl' (\x y -> x * 10 + y) 0 . map toNumber <$> some digit "integer" 55 | where 56 | toNumber c = fromIntegral (ord c - ord '0') 57 | -------------------------------------------------------------------------------- /src/Distribution/Refact/Types/Pos.hs: -------------------------------------------------------------------------------- 1 | module Distribution.Refact.Types.Pos where 2 | 3 | import Prelude () 4 | import Distribution.Refact.Internal.Prelude 5 | 6 | ------------------------------------------------------------------------------- 7 | -- Pos 8 | ------------------------------------------------------------------------------- 9 | 10 | data Pos = Pos !Int Int 11 | deriving (Eq, Ord, Show) 12 | 13 | posLine :: Lens' Pos Int 14 | posLine f (Pos l c) = flip Pos c <$> f l 15 | 16 | posColumn :: Lens' Pos Int 17 | posColumn f (Pos l c) = Pos l <$> f c 18 | 19 | ------------------------------------------------------------------------------- 20 | -- SrcSpan 21 | ------------------------------------------------------------------------------- 22 | 23 | data SrcSpan = SS !Pos !Pos 24 | deriving (Eq, Show) 25 | 26 | instance Semigroup SrcSpan where 27 | SS a b <> SS c d = SS (min a c) (max b d) 28 | 29 | ssStart :: Lens' SrcSpan Pos 30 | ssStart f (SS s e) = flip SS e <$> f s 31 | 32 | ssEnd :: Lens' SrcSpan Pos 33 | ssEnd f (SS s e) = SS s <$> f e 34 | 35 | ------------------------------------------------------------------------------- 36 | -- D 37 | ------------------------------------------------------------------------------- 38 | 39 | -- | Position delta 40 | data D = D !Int !Int 41 | deriving (Eq, Show) 42 | 43 | dLine :: Lens' D Int 44 | dLine f (D l c) = flip D c <$> f l 45 | 46 | dColumn :: Lens' D Int 47 | dColumn f (D l c) = D l <$> f c 48 | 49 | diffPos :: Pos -> Pos -> D 50 | diffPos (Pos a b) (Pos c d) = D (c - a) (d - b) 51 | 52 | addPos :: Pos -> D -> Pos 53 | addPos (Pos a b) (D c d) = Pos (a + c) (b + d) 54 | 55 | -- | 'D' is naturally monoid, /Note:/ 'Pos' isn't. 56 | instance Monoid D where 57 | mempty = D 0 0 58 | mappend = (<>) 59 | 60 | instance Semigroup D where 61 | D a b <> D c d = D (a + c) (b + d) 62 | -------------------------------------------------------------------------------- /src/Distribution/Refact/Types/Refactoring.hs: -------------------------------------------------------------------------------- 1 | module Distribution.Refact.Types.Refactoring where 2 | 3 | import Prelude () 4 | import Distribution.Refact.Internal.Prelude 5 | import Distribution.Refact.Types.Pos 6 | import Distribution.Refact.Types.Structure 7 | 8 | -- | Refactoring is simply a function from a list of @'Field' 'D'@ to itself. 9 | type Refactoring = Fields D -> Fields D 10 | 11 | topLevelField :: Applicative f => Text -> LensLike' f (Fields D) (FieldValue D) 12 | topLevelField n = traverse . _InRField . filtered (\t -> t ^. _1 . nameText == n) . _3 13 | -------------------------------------------------------------------------------- /src/Distribution/Refact/Types/Structure.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE DeriveTraversable #-} 2 | {-# LANGUAGE StandaloneDeriving #-} 3 | {-# LANGUAGE TemplateHaskell #-} 4 | module Distribution.Refact.Types.Structure where 5 | 6 | import Prelude () 7 | import Distribution.Refact.Internal.Prelude 8 | import Distribution.Refact.Types.Version 9 | 10 | import qualified Data.Text as T 11 | 12 | ------------------------------------------------------------------------------- 13 | -- Field 14 | ------------------------------------------------------------------------------- 15 | 16 | -- | Field list. 17 | type Fields ann = [Sum Comment Field ann] 18 | 19 | -- | A Cabal-like file consists of a series of fields (@foo: bar@) 20 | -- and sections (@library ...@). 21 | data Field ann 22 | = Field !(Name ann) ann (FieldValue ann) 23 | | Section !(Name ann) !Text (Fields ann) 24 | deriving (Functor, Foldable, Traversable) 25 | 26 | instance Foldable1 Field 27 | 28 | _Field :: Prism' (Field a) (Name a, a, FieldValue a) 29 | _Field = prism f g 30 | where 31 | f (n, ann, fls) = Field n ann fls 32 | g (Field n ann fls) = Right (n, ann, fls) 33 | g x = Left x 34 | 35 | _InRField :: Prism' (Sum f Field a) (Name a, a, FieldValue a) 36 | _InRField = _InR . _Field 37 | 38 | ------------------------------------------------------------------------------- 39 | -- Field Values 40 | ------------------------------------------------------------------------------- 41 | 42 | -- | The value of a field from a Cabal file. 43 | -- 44 | -- We parse some fields into different formats, but by default they are 'FieldLines'. 45 | data FieldValue ann 46 | = FieldLines [FieldLine ann] -- ^ /Default:/ collection of non-empty lines 47 | | FieldNumber !ann !Int -- e.g. @x-revision@ 48 | | FieldVersion !ann !Version -- e.g. @version@ 49 | deriving (Eq, Show, Functor, Foldable, Traversable) 50 | 51 | _FieldLines :: Prism' (FieldValue a) [FieldLine a] 52 | _FieldLines = prism FieldLines $ \v -> case v of 53 | FieldLines x -> Right x 54 | _ -> Left v 55 | 56 | _FieldNumber :: Prism' (FieldValue a) (a, Int) 57 | _FieldNumber = prism (uncurry FieldNumber) $ \v -> case v of 58 | FieldNumber ann n -> Right (ann, n) 59 | _ -> Left v 60 | 61 | _FieldVersion :: Prism' (FieldValue a) (a, Version) 62 | _FieldVersion = prism (uncurry FieldVersion) $ \v -> case v of 63 | FieldVersion ann n -> Right (ann, n) 64 | 65 | _ -> Left v 66 | 67 | ------------------------------------------------------------------------------- 68 | -- FieldLine 69 | ------------------------------------------------------------------------------- 70 | 71 | -- | A line of text representing the value of a field from a Cabal file. 72 | -- A field may contain multiple lines. 73 | -- 74 | -- /Invariant:/ 'Text' has no newlines. 75 | data FieldLine ann = FieldLine !ann !Text 76 | deriving (Eq, Show, Functor, Foldable, Traversable) 77 | 78 | fieldLineNull :: FieldLine ann -> Bool 79 | fieldLineNull (FieldLine _ t) = T.null t 80 | 81 | ------------------------------------------------------------------------------- 82 | -- Name 83 | ------------------------------------------------------------------------------- 84 | 85 | -- | A field name. 86 | -- 87 | -- TODO: (CI Text) 88 | data Name ann = Name !ann !Text 89 | deriving (Eq, Show, Functor, Foldable, Traversable) 90 | 91 | nameAnn :: Lens (Name a) (Name b) a b 92 | nameAnn f (Name a n) = f a <&> \b -> Name b n 93 | 94 | nameText :: Lens (Name a) (Name a) Text Text 95 | nameText f (Name a n) = f n <&> Name a 96 | 97 | ------------------------------------------------------------------------------- 98 | -- Comment 99 | ------------------------------------------------------------------------------- 100 | 101 | -- | Comment 102 | -- 103 | -- /Invariant:/ 'Text' has no newlines. 104 | data Comment ann = Comment !ann !Text 105 | deriving (Eq, Show, Functor, Foldable, Traversable) 106 | 107 | instance Foldable1 Comment 108 | 109 | ------------------------------------------------------------------------------- 110 | -- Functor classes 111 | ------------------------------------------------------------------------------- 112 | 113 | deriveEq1 ''FieldLine 114 | deriveEq1 ''Comment 115 | deriveEq1 ''Name 116 | deriveEq1 ''Field 117 | deriveEq1 ''FieldValue 118 | 119 | deriveShow1 ''FieldLine 120 | deriveShow1 ''Comment 121 | deriveShow1 ''Name 122 | deriveShow1 ''Field 123 | deriveShow1 ''FieldValue 124 | 125 | deriving instance Eq ann => Eq (Field ann) 126 | deriving instance Show ann => Show (Field ann) 127 | -------------------------------------------------------------------------------- /src/Distribution/Refact/Types/Version.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE OverloadedStrings #-} 2 | module Distribution.Refact.Types.Version where 3 | 4 | import Prelude () 5 | import Distribution.Refact.Internal.Prelude 6 | import Distribution.Refact.Tools.Trifecta 7 | 8 | import Data.List (foldl') 9 | 10 | newtype Version = Version (NonEmpty Word) 11 | deriving (Eq, Show) 12 | 13 | versionToText :: Version -> Text 14 | versionToText (Version (x :| xs)) = foldl' f (x ^. asText) xs 15 | where 16 | f t y = t <> "." <> y ^. asText 17 | 18 | versionParser :: CharParsing m => m Version 19 | versionParser = f <$> integral <*> many (char '.' *> integral) "version" 20 | where 21 | f x xs = Version (x :| xs) 22 | 23 | -------------------------------------------------------------------------------- /stack.yaml: -------------------------------------------------------------------------------- 1 | resolver: nightly-2017-04-01 2 | packages: 3 | - . 4 | extra-deps: 5 | - indentation-trifecta-0.0.1 6 | flags: {} 7 | -------------------------------------------------------------------------------- /tests/Tests.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE OverloadedStrings #-} 2 | module Main (main) where 3 | 4 | import Prelude () 5 | import Distribution.Refact.Internal.Prelude 6 | import Distribution.Refact 7 | 8 | import Data.List (isSuffixOf) 9 | import System.Directory (listDirectory) 10 | import System.FilePath (()) 11 | import Test.Tasty 12 | import Test.Tasty.HUnit 13 | 14 | import qualified Data.Text as T 15 | import qualified Data.Text.IO as T 16 | 17 | main :: IO () 18 | main = do 19 | fixtures <- sequence 20 | [ identityFixtures 21 | , refactoringFixtures "increase-revision" increaseRevisionRefactoring 22 | , refactoringFixtures "populate-extra-source-files" $ 23 | populateExtraSourceFilesRefactoring 24 | [ "fixtures/foo.cabal" 25 | , "fixtures/bar.cabal" 26 | , "Setup.hs" 27 | ] 28 | , refactoringFixtures "set-version" $ 29 | setVersionRefactoring $ Version $ 1 :| [2,3,4] 30 | ] 31 | defaultMain $ testGroup "fixtures" fixtures 32 | 33 | ------------------------------------------------------------------------------- 34 | -- Fixtures: identity 35 | ------------------------------------------------------------------------------- 36 | 37 | identityFixtures :: IO TestTree 38 | identityFixtures = do 39 | files <- filter (".cabal" `isSuffixOf`) <$> listDirectory dir 40 | pure $ testGroup "identity" $ map mk files 41 | where 42 | dir = "fixtures" "identity" 43 | 44 | mk fn = testCase fn $ do 45 | input <- (<> "\n") . T.strip <$> T.readFile (dir fn) 46 | fields <- fromResult (parseFields fn input) 47 | let fields' = posFields . delFields $ fields 48 | let output = prettyFields fields' 49 | when (input /= output) $ do 50 | assertFailure $ diffShowS input output "" 51 | 52 | refactoringFixtures :: String -> Refactoring -> IO TestTree 53 | refactoringFixtures name refactoring = do 54 | files <- filter (".cabal" `isSuffixOf`) <$> listDirectory dir 55 | pure $ testGroup name $ map mk files 56 | where 57 | dir = "fixtures" name 58 | 59 | mk fn = testCase fn $ do 60 | input <- (<> "\n") . T.strip <$> T.readFile (dir fn) 61 | expected <- (<> "\n") . T.strip <$> T.readFile (dir (fn ++ ".output")) 62 | fields <- fromResult (parseFields fn input) 63 | let fields' = posFields . refactoring . delFields $ fields 64 | let output = prettyFields fields' 65 | when (expected /= output) $ do 66 | assertFailure $ diffShowS expected output "" 67 | 68 | ------------------------------------------------------------------------------- 69 | -- Utility 70 | ------------------------------------------------------------------------------- 71 | 72 | fromResult :: Result a -> IO a 73 | fromResult (Success a) = pure a 74 | fromResult (Failure xs) = do 75 | assertFailure $ show $ _errDoc xs 76 | fail "" -- to make it return 'a' 77 | -------------------------------------------------------------------------------- /tests/doctests.hs: -------------------------------------------------------------------------------- 1 | ----------------------------------------------------------------------------- 2 | -- | 3 | -- Module : Main (doctests) 4 | -- Copyright : (C) 2012-14 Edward Kmett 5 | -- License : BSD-style (see the file LICENSE) 6 | -- Maintainer : Edward Kmett 7 | -- Stability : provisional 8 | -- Portability : portable 9 | -- 10 | -- This module provides doctests for a project based on the actual versions 11 | -- of the packages it was built with. It requires a corresponding Setup.lhs 12 | -- to be added to the project 13 | ----------------------------------------------------------------------------- 14 | module Main where 15 | 16 | import Build_doctests (flags, pkgs, module_sources) 17 | import Data.Foldable (traverse_) 18 | import Test.DocTest 19 | 20 | main :: IO () 21 | main = do 22 | traverse_ putStrLn args 23 | doctest args 24 | where 25 | args = flags ++ pkgs ++ module_sources 26 | --------------------------------------------------------------------------------