on master help sign in
Merge pull request #1 from siddharthist/ghc843

Remove dependency on HList (via morphed) to fix compilation

commit993db9cce6644f408facc752e272729d1d1d451c authorPavel Christof <pawel834@gmail.com> dateTue 19 Feb 2019, 00:15 (8 years ago) parent689792e9d4488f
4 files changed+141−29
.travis.yml+132 Control/Lens/SemiIso.hs−10 Control/SIArrow.hs+2−17 semi-iso.cabal+7−2
.travis.ymlnew file+132
@@ -0,0 +1,132 @@
1+# This Travis job script has been generated by a script via
2+#
3+# runghc make_travis_yml_2.hs 'semi-iso.cabal'
4+#
5+# For more information, see https://github.com/haskell-CI/haskell-ci
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+ - rm -rfv $HOME/.cabal/packages/head.hackage
28+
29+matrix:
30+ include:
31+ - compiler: "ghc-8.6.1"
32+ env: GHCHEAD=true
33+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.6.1], sources: [hvr-ghc]}}
34+ - compiler: "ghc-8.4.3"
35+ # env: TEST=--disable-tests BENCH=--disable-benchmarks
36+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-8.4.3], sources: [hvr-ghc]}}
37+ - compiler: "ghc-8.2.2"
38+ # env: TEST=--disable-tests BENCH=--disable-benchmarks
39+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-8.2.2], sources: [hvr-ghc]}}
40+ - compiler: "ghc-8.0.2"
41+ # env: TEST=--disable-tests BENCH=--disable-benchmarks
42+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-8.0.2], sources: [hvr-ghc]}}
43+
44+ allow_failures:
45+ - compiler: "ghc-8.6.1"
46+
47+before_install:
48+ - HC=${CC}
49+ - HCPKG=${HC/ghc/ghc-pkg}
50+ - unset CC
51+ - ROOTDIR=$(pwd)
52+ - mkdir -p $HOME/.local/bin
53+ - "PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$HOME/local/bin:$PATH"
54+ - HCNUMVER=$(( $(${HC} --numeric-version|sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\1 * 10000 + \2 * 100 + \3/') ))
55+ - echo $HCNUMVER
56+
57+install:
58+ - cabal --version
59+ - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
60+ - BENCH=${BENCH---enable-benchmarks}
61+ - TEST=${TEST---enable-tests}
62+ - HADDOCK=${HADDOCK-true}
63+ - UNCONSTRAINED=${UNCONSTRAINED-true}
64+ - NOINSTALLEDCONSTRAINTS=${NOINSTALLEDCONSTRAINTS-false}
65+ - GHCHEAD=${GHCHEAD-false}
66+ - travis_retry cabal update -v
67+ - "sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config"
68+ - rm -fv cabal.project cabal.project.local
69+ # Overlay Hackage Package Index for GHC HEAD: https://github.com/hvr/head.hackage
70+ - |
71+ if $GHCHEAD; then
72+ sed -i 's/-- allow-newer: .*/allow-newer: *:base/' ${HOME}/.cabal/config
73+ for pkg in $($HCPKG list --simple-output); do pkg=$(echo $pkg | sed 's/-[^-]*$//'); sed -i "s/allow-newer: /allow-newer: *:$pkg, /" ${HOME}/.cabal/config; done
74+
75+ echo 'repository head.hackage' >> ${HOME}/.cabal/config
76+ echo ' url: http://head.hackage.haskell.org/' >> ${HOME}/.cabal/config
77+ echo ' secure: True' >> ${HOME}/.cabal/config
78+ echo ' root-keys: 07c59cb65787dedfaef5bd5f987ceb5f7e5ebf88b904bbd4c5cbdeb2ff71b740' >> ${HOME}/.cabal/config
79+ echo ' 2e8555dde16ebd8df076f1a8ef13b8f14c66bad8eafefd7d9e37d0ed711821fb' >> ${HOME}/.cabal/config
80+ echo ' 8f79fd2389ab2967354407ec852cbe73f2e8635793ac446d09461ffb99527f6e' >> ${HOME}/.cabal/config
81+ echo ' key-threshold: 3' >> ${HOME}/.cabal.config
82+
83+ grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$'
84+
85+ cabal new-update head.hackage -v
86+ fi
87+ - grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$'
88+ - "printf 'packages: \".\"\\n' > cabal.project"
89+ - touch cabal.project.local
90+ - "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg | grep -vw -- semi-iso | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi"
91+ - cat cabal.project || true
92+ - cat cabal.project.local || true
93+ - if [ -f "./configure.ac" ]; then
94+ (cd "." && autoreconf -i);
95+ fi
96+ - rm -f cabal.project.freeze
97+ - cabal new-build -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dep -j2 all
98+ - cabal new-build -w ${HC} --disable-tests --disable-benchmarks --project-file="cabal.project" --dep -j2 all
99+ - rm -rf .ghc.environment.* "."/dist
100+ - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
101+
102+# Here starts the actual work to be performed for the package under test;
103+# any command which exits with a non-zero exit code causes the build to fail.
104+script:
105+ # test that source-distributions can be generated
106+ - (cd "." && cabal sdist)
107+ - mv "."/dist/semi-iso-*.tar.gz ${DISTDIR}/
108+ - cd ${DISTDIR} || false
109+ - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;
110+ - "printf 'packages: semi-iso-*/*.cabal\\n' > cabal.project"
111+ - touch cabal.project.local
112+ - "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg | grep -vw -- semi-iso | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi"
113+ - cat cabal.project || true
114+ - cat cabal.project.local || true
115+ # this builds all libraries and executables (without tests/benchmarks)
116+ - cabal new-build -w ${HC} --disable-tests --disable-benchmarks all
117+
118+ # build & run tests, build benchmarks
119+ - cabal new-build -w ${HC} ${TEST} ${BENCH} all
120+
121+ # cabal check
122+ - (cd semi-iso-* && cabal check)
123+
124+ # haddock
125+ - rm -rf ./dist-newstyle
126+ - if $HADDOCK; then cabal new-haddock -w ${HC} ${TEST} ${BENCH} all; else echo "Skipping haddock generation";fi
127+
128+ # Build without installed constraints for packages in global-db
129+ - if $UNCONSTRAINED; then rm -f cabal.project.local; echo cabal new-build -w ${HC} --disable-tests --disable-benchmarks all; else echo "Not building without installed constraints"; fi
130+
131+# REGENDATA ["semi-iso.cabal"]
132+# EOF
Control/Lens/SemiIso.hs−10
@@ -64,7 +64,6 @@ module Control.Lens.SemiIso (
6464 unit,
6565 swapped,
6666 associated,
67− morphed,
6867 constant,
6968 exact,
7069 bifiltered,
@@ -106,7 +105,6 @@ import Data.Foldable
106105import Data.Functor.Identity
107106import Data.Profunctor.Exposed
108107import Data.Traversable
109−import Data.Tuple.Morph
110108import Prelude hiding (id, (.))
111109
112110-- | A semi-isomorphism is a partial isomorphism with weakened laws.
@@ -222,14 +220,6 @@ unit = iso (, ()) fst
222220associated :: Iso' (a, (b, c)) ((a, b), c)
223221associated = iso (\(a, (b, c)) -> ((a, b), c)) (\((a, b), c) -> (a, (b, c)))
224222
225−-- | An isomorphism between two arbitrary nested tuples, as long the contained
226−-- types (ignoring units!) read from left to right are the same.
227−--
228−-- This is implemented using 'Data.Tuple.Morph.morph' from 'tuple-morph'.
229−morphed :: (HFoldable a, HUnfoldable a, HFoldable b, HUnfoldable b, Rep a ~ Rep b)
230− => Iso' a b
231−morphed = iso morph morph
232−
233223-- | \-> Always returns the argument.
234224--
235225-- \<- Maps everything to a @()@.
Control/SIArrow.hs+2−17
@@ -21,8 +21,7 @@ module Control.SIArrow (
2121 (#>>), (>>#), (#<<), (<<#),
2222
2323 -- * Functor and applicative.
24− (/$/), (/$~),
25− (/*/), (/*), (*/),
24+ (/$/), (/*/), (/*), (*/),
2625
2726 -- * Signaling errors.
2827 sifail, (/?/),
@@ -43,12 +42,11 @@ import Control.Lens.Iso
4342import Control.Lens.SemiIso
4443import Control.Monad
4544import Data.Semigroupoid.Dual
46−import Data.Tuple.Morph
4745import Prelude hiding (id, (.))
4846
4947infixr 1 ^>>, ^<<, #>>, #<<
5048infixr 1 >>^, <<^, >>#, <<#
51−infixl 4 /$/, /$~
49+infixl 4 /$/
5250infixl 5 /*/, */, /*
5351infixl 3 /?/
5452
@@ -143,19 +141,6 @@ a <<# f = a . sipure f
143141(/$/) :: SIArrow cat => ASemiIso' b' b -> cat a b -> cat a b'
144142(/$/) = (#<<)
145143
146−-- | Convenient fmap.
147−--
148−-- > ai /$~ f = ai . morphed /$/ f
149−--
150−-- This operator handles all the hairy stuff with uncurried application:
151−-- it reassociates the argument tuple and removes unnecessary (or adds necessary)
152−-- units to match the function type. You don't have to use @/*@ and @*/@ with this
153−-- operator.
154−(/$~) :: (SIArrow cat, HFoldable b', HFoldable b,
155− HUnfoldable b', HUnfoldable b, Rep b' ~ Rep b)
156− => ASemiIso' a b' -> cat c b -> cat c a
157−ai /$~ h = cloneSemiIso ai . morphed /$/ h
158−
159144-- | The product of two arrows with duplicate units removed. Side effect are
160145-- sequenced from left to right.
161146--
semi-iso.cabal+7−2
@@ -53,7 +53,8 @@ maintainer: Paweł Nowak <pawel834@gmail.com>
5353copyright: Paweł Nowak 2014
5454category: Control, Data
5555build-type: Simple
56−cabal-version: >=1.10
56+cabal-version: >=1.11
57+Tested-with: GHC==8.0.2, GHC==8.2.2, GHC==8.4.3, GHC==8.6.1
5758
5859source-repository head
5960 type: git
@@ -66,6 +67,10 @@ library
6667 Control.Category.Reader
6768 Control.Category.Structures
6869 Data.Profunctor.Exposed
69− build-depends: base >= 4 && < 5, profunctors, transformers, lens, tuple-morph, semigroupoids
70+ build-depends: base >= 4.9 && <4.13
71+ , profunctors == 5.*
72+ , transformers
73+ , lens == 4.*
74+ , semigroupoids
7075 default-language: Haskell2010
7176 ghc-options: -Wall