From git at git.haskell.org Fri Apr 1 08:06:55 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 1 Apr 2016 08:06:55 +0000 (UTC) Subject: [commit: ghc] wip/cse-code-desmelling: CSE: Code cleanup (0d532a9) Message-ID: <20160401080655.0DF533A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/cse-code-desmelling Link : http://ghc.haskell.org/trac/ghc/changeset/0d532a99c9ce82652cc1a4fcc8a391b42fc41934/ghc >--------------------------------------------------------------- commit 0d532a99c9ce82652cc1a4fcc8a391b42fc41934 Author: Simon Peyton Jones Date: Thu Mar 31 22:42:28 2016 +0200 CSE: Code cleanup Triggered by an observation by Joachim, Simon felt the urge to clean up the CSE code a bit. This is the result. (Code by Simon, Commit message and other leg-work by Joachim) >--------------------------------------------------------------- 0d532a99c9ce82652cc1a4fcc8a391b42fc41934 compiler/simplCore/CSE.hs | 257 ++++++++++++--------- .../tests/simplCore/should_compile/T8331.stderr | 7 +- 2 files changed, 153 insertions(+), 111 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 0d532a99c9ce82652cc1a4fcc8a391b42fc41934 From git at git.haskell.org Fri Apr 1 10:25:30 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 1 Apr 2016 10:25:30 +0000 (UTC) Subject: [commit: ghc] wip/cse-code-desmelling: CSE code cleanup and improvement (e05b00e) Message-ID: <20160401102530.98BF43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/cse-code-desmelling Link : http://ghc.haskell.org/trac/ghc/changeset/e05b00ef8e05e58e93e0559e4499a830bc51b9f4/ghc >--------------------------------------------------------------- commit e05b00ef8e05e58e93e0559e4499a830bc51b9f4 Author: Joachim Breitner Date: Fri Apr 1 12:24:50 2016 +0200 CSE code cleanup and improvement Triggered by an observation by Joachim, Simon felt the urge to clean up the CSE code a bit. This is the result. (Code by Simon, Commit message and other leg-work by Joachim) >--------------------------------------------------------------- e05b00ef8e05e58e93e0559e4499a830bc51b9f4 compiler/simplCore/CSE.hs | 301 +++++++++++++++++++++++++++++----------------- 1 file changed, 189 insertions(+), 112 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc e05b00ef8e05e58e93e0559e4499a830bc51b9f4 From git at git.haskell.org Fri Apr 1 11:39:11 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 1 Apr 2016 11:39:11 +0000 (UTC) Subject: [commit: ghc] wip/T11731: Add a test case for #11731. (b620558) Message-ID: <20160401113911.46E9B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T11731 Link : http://ghc.haskell.org/trac/ghc/changeset/b62055847b68088d1d084b7930a6d08002646cd4/ghc >--------------------------------------------------------------- commit b62055847b68088d1d084b7930a6d08002646cd4 Author: Joachim Breitner Date: Wed Mar 30 12:55:10 2016 +0200 Add a test case for #11731. >--------------------------------------------------------------- b62055847b68088d1d084b7930a6d08002646cd4 testsuite/.gitignore | 1 + testsuite/tests/simplCore/should_run/T11731.hs | 36 ++++++++++++++++++++++ testsuite/tests/simplCore/should_run/T11731.stderr | 1 + testsuite/tests/simplCore/should_run/all.T | 1 + 4 files changed, 39 insertions(+) diff --git a/testsuite/.gitignore b/testsuite/.gitignore index 655e3da..e1f1822 100644 --- a/testsuite/.gitignore +++ b/testsuite/.gitignore @@ -1475,6 +1475,7 @@ mk/ghcconfig*_test___spaces_ghc*.exe.mk /tests/simplCore/should_run/T5997 /tests/simplCore/should_run/T7101 /tests/simplCore/should_run/T7924 +/tests/simplCore/should_run/T11731 /tests/simplCore/should_run/T9128 /tests/simplCore/should_run/T9390 /tests/simplCore/should_run/runST diff --git a/testsuite/tests/simplCore/should_run/T11731.hs b/testsuite/tests/simplCore/should_run/T11731.hs new file mode 100644 index 0000000..e148507 --- /dev/null +++ b/testsuite/tests/simplCore/should_run/T11731.hs @@ -0,0 +1,36 @@ +module Main (main ) where + +import Debug.Trace + +foo :: (a,b) -> a +foo (x,y) = x +{-# NOINLINE foo #-} + +wwMe :: Int -> (Int,Int) -> (Int, Int) +wwMe 0 p = + let a = fst p + b = snd p + -- This ensure sharing of b, as seen by the demand analyzer + + in foo p `seq` + -- This ensures that wwMe is strict in the tuple, but that the tuple + -- is preserved. + (b + a, a + b) + +wwMe n p = wwMe (n-1) (0,0) + -- ^ Make it recursive, so that it is attractive to worker-wrapper + +go :: Int -> IO () +go seed = do + let shareMeThunk = trace "Evaluated (should only happen once)" (seed + 1) + {-# NOINLINE shareMeThunk #-} + -- ^ This is the thunk that is wrongly evaluated twice. + + let (x,y) = wwMe 0 (seed,shareMeThunk) + + (x + y) `seq` return () + -- ^ Use both components +{-# NOINLINE go #-} + +main :: IO () +main = go 42 diff --git a/testsuite/tests/simplCore/should_run/T11731.stderr b/testsuite/tests/simplCore/should_run/T11731.stderr new file mode 100644 index 0000000..8d1fc60 --- /dev/null +++ b/testsuite/tests/simplCore/should_run/T11731.stderr @@ -0,0 +1 @@ +Evaluated (should only happen once) diff --git a/testsuite/tests/simplCore/should_run/all.T b/testsuite/tests/simplCore/should_run/all.T index 9c15b0f..042c097 100644 --- a/testsuite/tests/simplCore/should_run/all.T +++ b/testsuite/tests/simplCore/should_run/all.T @@ -71,3 +71,4 @@ test('T9128', normal, compile_and_run, ['']) test('T9390', normal, compile_and_run, ['']) test('T10830', extra_run_opts('+RTS -K100k -RTS'), compile_and_run, ['']) test('T11172', normal, compile_and_run, ['']) +test('T11731', expect_broken(11731), compile_and_run, ['-fspec-constr']) From git at git.haskell.org Fri Apr 1 11:39:13 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 1 Apr 2016 11:39:13 +0000 (UTC) Subject: [commit: ghc] wip/T11731: Core pretty printer: Omit wild case binders (73659ef) Message-ID: <20160401113913.EDC563A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T11731 Link : http://ghc.haskell.org/trac/ghc/changeset/73659efef63230418a1a1d473322237171cbd33b/ghc >--------------------------------------------------------------- commit 73659efef63230418a1a1d473322237171cbd33b Author: Joachim Breitner Date: Wed Mar 30 13:22:26 2016 +0200 Core pretty printer: Omit wild case binders as they (especially their id info with absence information) clutter the output too much. They come back with debug_on. >--------------------------------------------------------------- 73659efef63230418a1a1d473322237171cbd33b compiler/coreSyn/PprCore.hs | 43 +++++++++++++++++----- compiler/hsSyn/HsBinds.hs | 2 +- compiler/stgSyn/StgSyn.hs | 2 +- compiler/utils/Outputable.hs | 7 +++- .../tests/deSugar/should_compile/T2431.stderr | 2 +- .../tests/numeric/should_compile/T7116.stdout | 16 +++----- .../tests/simplCore/should_compile/T3717.stderr | 4 +- .../tests/simplCore/should_compile/T3772.stdout | 5 +-- .../tests/simplCore/should_compile/T4908.stderr | 8 ++-- .../tests/simplCore/should_compile/T4930.stderr | 10 ++--- .../tests/simplCore/should_compile/T5366.stdout | 3 +- .../tests/simplCore/should_compile/T7360.stderr | 12 ++---- .../tests/simplCore/should_compile/T7865.stdout | 4 +- .../simplCore/should_compile/spec-inline.stderr | 28 ++++++-------- 14 files changed, 79 insertions(+), 67 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 73659efef63230418a1a1d473322237171cbd33b From git at git.haskell.org Fri Apr 1 11:39:16 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 1 Apr 2016 11:39:16 +0000 (UTC) Subject: [commit: ghc] wip/T11731: Add a final demand analyzer run right before TidyCore (2d5a600) Message-ID: <20160401113916.A0F853A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T11731 Link : http://ghc.haskell.org/trac/ghc/changeset/2d5a600560054f1338e5ae88b46aa76de83862f8/ghc >--------------------------------------------------------------- commit 2d5a600560054f1338e5ae88b46aa76de83862f8 Author: Joachim Breitner Date: Thu Mar 31 10:18:15 2016 +0200 Add a final demand analyzer run right before TidyCore in order to have precise used-once information in the exported strictness signatures, as well as precise used-once information on thunks. This avoids the bad effects of #11731. The subsequent worker-wrapper pass is responsible for removing the demand environment part of the strictness signature. It does not run after the final demand analyzer pass, so remove this also in CoreTody. >--------------------------------------------------------------- 2d5a600560054f1338e5ae88b46aa76de83862f8 compiler/basicTypes/Demand.hs | 11 +++- compiler/basicTypes/Id.hs | 7 ++- compiler/basicTypes/IdInfo.hs | 10 +++- compiler/coreSyn/CoreTidy.hs | 5 +- compiler/simplCore/SimplCore.hs | 5 ++ compiler/stranal/DmdAnal.hs | 28 ++++++++++ compiler/stranal/WorkWrap.hs | 43 +++++++++------ testsuite/tests/perf/haddock/all.T | 3 +- .../tests/simplCore/should_compile/T4908.stderr | 6 +-- .../simplCore/should_compile/spec-inline.stderr | 4 +- testsuite/tests/simplCore/should_run/all.T | 2 +- .../tests/stranal/should_compile/T10694.stderr | 61 ++++++++++++++++++++++ .../stranal/sigs/BottomFromInnerLambda.stderr | 7 +++ testsuite/tests/stranal/sigs/DmdAnalGADTs.stderr | 14 +++++ testsuite/tests/stranal/sigs/HyperStrUse.stderr | 6 +++ testsuite/tests/stranal/sigs/StrAnalExample.stderr | 6 +++ testsuite/tests/stranal/sigs/T8569.stderr | 9 ++++ testsuite/tests/stranal/sigs/T8598.stderr | 6 +++ testsuite/tests/stranal/sigs/UnsatFun.stderr | 12 +++++ 19 files changed, 216 insertions(+), 29 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 2d5a600560054f1338e5ae88b46aa76de83862f8 From git at git.haskell.org Fri Apr 1 11:39:18 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 1 Apr 2016 11:39:18 +0000 (UTC) Subject: [commit: ghc] wip/T11731's head updated: Add a final demand analyzer run right before TidyCore (2d5a600) Message-ID: <20160401113918.F31253A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/T11731' now includes: 6ea42c7 Revert "Demand Analyzer: Do not set OneShot information" 73659ef Core pretty printer: Omit wild case binders b620558 Add a test case for #11731. 2d5a600 Add a final demand analyzer run right before TidyCore From git at git.haskell.org Fri Apr 1 12:53:32 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 1 Apr 2016 12:53:32 +0000 (UTC) Subject: [commit: ghc] wip/T11731: Add a final demand analyzer run right before TidyCore (a02e702) Message-ID: <20160401125332.19C363A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T11731 Link : http://ghc.haskell.org/trac/ghc/changeset/a02e70206629bd7561526583a37ffb867673c1d1/ghc >--------------------------------------------------------------- commit a02e70206629bd7561526583a37ffb867673c1d1 Author: Joachim Breitner Date: Thu Mar 31 10:18:15 2016 +0200 Add a final demand analyzer run right before TidyCore in order to have precise used-once information in the exported strictness signatures, as well as precise used-once information on thunks. This avoids the bad effects of #11731. The subsequent worker-wrapper pass is responsible for removing the demand environment part of the strictness signature. It does not run after the final demand analyzer pass, so remove this also in CoreTody. >--------------------------------------------------------------- a02e70206629bd7561526583a37ffb867673c1d1 compiler/basicTypes/Demand.hs | 11 +++- compiler/basicTypes/Id.hs | 7 ++- compiler/basicTypes/IdInfo.hs | 10 +++- compiler/coreSyn/CoreTidy.hs | 5 +- compiler/simplCore/SimplCore.hs | 5 ++ compiler/stranal/DmdAnal.hs | 28 ++++++++++ compiler/stranal/WorkWrap.hs | 44 ++++++++++------ testsuite/tests/perf/haddock/all.T | 3 +- .../tests/simplCore/should_compile/T4908.stderr | 6 +-- .../simplCore/should_compile/spec-inline.stderr | 4 +- testsuite/tests/simplCore/should_run/all.T | 2 +- .../tests/stranal/should_compile/T10694.stderr | 61 ++++++++++++++++++++++ .../stranal/sigs/BottomFromInnerLambda.stderr | 7 +++ testsuite/tests/stranal/sigs/DmdAnalGADTs.stderr | 14 +++++ testsuite/tests/stranal/sigs/HyperStrUse.stderr | 6 +++ testsuite/tests/stranal/sigs/StrAnalExample.stderr | 6 +++ testsuite/tests/stranal/sigs/T8569.stderr | 9 ++++ testsuite/tests/stranal/sigs/T8598.stderr | 6 +++ testsuite/tests/stranal/sigs/UnsatFun.stderr | 12 +++++ 19 files changed, 216 insertions(+), 30 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc a02e70206629bd7561526583a37ffb867673c1d1 From git at git.haskell.org Fri Apr 1 15:19:32 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 1 Apr 2016 15:19:32 +0000 (UTC) Subject: [commit: ghc] wip/T11770: Demand Analyzer: Do not set OneShot information (second try) (86a5a54) Message-ID: <20160401151932.441473A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T11770 Link : http://ghc.haskell.org/trac/ghc/changeset/86a5a54cd5ccc95d45c633140008d1db12853764/ghc >--------------------------------------------------------------- commit 86a5a54cd5ccc95d45c633140008d1db12853764 Author: Joachim Breitner Date: Fri Apr 1 13:11:18 2016 +0200 Demand Analyzer: Do not set OneShot information (second try) as suggested in ticket:11770#comment:1. This code was buggy (#11770), and the occurrence analyzer does the same job anyways. This also elaborates the notes in the occurrence analyzer accordingly. Previously, the worker/wrapper code would go through lengths to transfer the oneShot annotations from the original function to both the worker and the wrapper. We now simply transfer the demand on the worker, and le the subsequent occurrence analyzer push this onto the lambda binders. This doesn't validate yet, but I'm running out of time for today, so I?m pushing this to a feature branch for now. A review of how I am transfering the demand onto the worker is appreciated, maybe I?m doing it obviously wrong. >--------------------------------------------------------------- 86a5a54cd5ccc95d45c633140008d1db12853764 compiler/basicTypes/Demand.hs | 22 ++++++++- compiler/simplCore/OccurAnal.hs | 33 +++++++++---- compiler/specialise/SpecConstr.hs | 2 +- compiler/stranal/DmdAnal.hs | 55 ++------------------- compiler/stranal/WorkWrap.hs | 29 +++++------ compiler/stranal/WwLib.hs | 72 +++++++--------------------- testsuite/tests/stranal/should_compile/all.T | 2 +- 7 files changed, 83 insertions(+), 132 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 86a5a54cd5ccc95d45c633140008d1db12853764 From git at git.haskell.org Fri Apr 1 15:19:29 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 1 Apr 2016 15:19:29 +0000 (UTC) Subject: [commit: ghc] branch 'wip/T11770' created Message-ID: <20160401151929.831423A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/T11770 Referencing: 86a5a54cd5ccc95d45c633140008d1db12853764 From git at git.haskell.org Fri Apr 1 15:36:50 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 1 Apr 2016 15:36:50 +0000 (UTC) Subject: [commit: ghc] wip/T11770: Demand Analyzer: Do not set OneShot information (second try) (6afb2bd) Message-ID: <20160401153650.E50513A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T11770 Link : http://ghc.haskell.org/trac/ghc/changeset/6afb2bdef881aec3a25f7ee1dfe012a43531564a/ghc >--------------------------------------------------------------- commit 6afb2bdef881aec3a25f7ee1dfe012a43531564a Author: Joachim Breitner Date: Fri Apr 1 13:11:18 2016 +0200 Demand Analyzer: Do not set OneShot information (second try) as suggested in ticket:11770#comment:1. This code was buggy (#11770), and the occurrence analyzer does the same job anyways. This also elaborates the notes in the occurrence analyzer accordingly. Previously, the worker/wrapper code would go through lengths to transfer the oneShot annotations from the original function to both the worker and the wrapper. We now simply transfer the demand on the worker, and le the subsequent occurrence analyzer push this onto the lambda binders. Did not validate this yet, but I'm running out of time for today, so I?m pushing this to a feature branch for now. A review of how I am transfering the demand onto the worker is appreciated, maybe I?m doing it obviously wrong. >--------------------------------------------------------------- 6afb2bdef881aec3a25f7ee1dfe012a43531564a compiler/basicTypes/Demand.hs | 22 +++++++- compiler/simplCore/OccurAnal.hs | 33 ++++++++---- compiler/specialise/SpecConstr.hs | 2 +- compiler/stranal/DmdAnal.hs | 55 ++----------------- compiler/stranal/WorkWrap.hs | 32 +++++------ compiler/stranal/WwLib.hs | 80 ++++++++-------------------- testsuite/tests/stranal/should_compile/all.T | 2 +- 7 files changed, 90 insertions(+), 136 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 6afb2bdef881aec3a25f7ee1dfe012a43531564a From git at git.haskell.org Fri Apr 1 20:58:51 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 1 Apr 2016 20:58:51 +0000 (UTC) Subject: [commit: ghc] master: Make the example for -M work (3806891) Message-ID: <20160401205851.4D2D53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/38068913c13fa64bd776fab6cf0e971c1a18b54d/ghc >--------------------------------------------------------------- commit 38068913c13fa64bd776fab6cf0e971c1a18b54d Author: Bartosz Nitka Date: Fri Apr 1 13:03:17 2016 -0700 Make the example for -M work `ghc` fails without `-dep-suffix ''`. Test Plan: visual inspection Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie, simonmar Differential Revision: https://phabricator.haskell.org/D2075 >--------------------------------------------------------------- 38068913c13fa64bd776fab6cf0e971c1a18b54d docs/users_guide/separate_compilation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/users_guide/separate_compilation.rst b/docs/users_guide/separate_compilation.rst index c0d42e9..d5fcd9c 100644 --- a/docs/users_guide/separate_compilation.rst +++ b/docs/users_guide/separate_compilation.rst @@ -846,7 +846,7 @@ following to your ``Makefile``: .. code-block:: make depend : - ghc -M $(HC_OPTS) $(SRCS) + ghc -dep-suffix '' -M $(HC_OPTS) $(SRCS) Now, before you start compiling, and any time you change the ``imports`` in your program, do ``make depend`` before you do ``make cool_pgm``. The command From git at git.haskell.org Sat Apr 2 21:38:56 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 2 Apr 2016 21:38:56 +0000 (UTC) Subject: [commit: ghc] master: Improve printing of pattern synonym types (72bd7f7) Message-ID: <20160402213856.D52523A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/72bd7f7be7809076f321a6fca90024e3e1bde3cc/ghc >--------------------------------------------------------------- commit 72bd7f7be7809076f321a6fca90024e3e1bde3cc Author: Rik Steenkamp Date: Sat Apr 2 20:39:10 2016 +0100 Improve printing of pattern synonym types Add the function `pprPatSynType :: PatSyn -> SDoc` for printing pattern synonym types, and remove the ambiguous `patSynType` function. Also, the types in a `PatSyn` are now tidy. Haddock submodule updated to reflect the removal of `patSynType` by mpickering. Fixes: #11213. Reviewers: goldfire, simonpj, austin, mpickering, bgamari Reviewed By: simonpj, mpickering Subscribers: bollmann, simonpj, thomie Differential Revision: https://phabricator.haskell.org/D1896 GHC Trac Issues: #11213 >--------------------------------------------------------------- 72bd7f7be7809076f321a6fca90024e3e1bde3cc compiler/basicTypes/PatSyn.hs | 27 ++++++----- compiler/rename/RnNames.hs | 54 ++++++++++++---------- compiler/typecheck/TcPatSyn.hs | 21 ++++++--- compiler/typecheck/TcRnTypes.hs | 4 +- testsuite/tests/patsyn/should_compile/T11213.hs | 29 ++++++++++++ .../tests/patsyn/should_compile/T11213.stderr | 46 ++++++++++++++++++ testsuite/tests/patsyn/should_compile/all.T | 1 + utils/haddock | 2 +- 8 files changed, 139 insertions(+), 45 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 72bd7f7be7809076f321a6fca90024e3e1bde3cc From git at git.haskell.org Sun Apr 3 20:31:56 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 3 Apr 2016 20:31:56 +0000 (UTC) Subject: [commit: ghc] wip/T11731: Add a final demand analyzer run right before TidyCore (1e9b330) Message-ID: <20160403203156.B77F13A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T11731 Link : http://ghc.haskell.org/trac/ghc/changeset/1e9b330146a3d49bb70100791523bf94830ea577/ghc >--------------------------------------------------------------- commit 1e9b330146a3d49bb70100791523bf94830ea577 Author: Joachim Breitner Date: Thu Mar 31 10:18:15 2016 +0200 Add a final demand analyzer run right before TidyCore in order to have precise used-once information in the exported strictness signatures, as well as precise used-once information on thunks. This avoids the bad effects of #11731. The subsequent worker-wrapper pass is responsible for removing the demand environment part of the strictness signature. It does not run after the final demand analyzer pass, so remove this also in CoreTidy. The subsequent worker-wrapper pass is also responsible for removing used-once-information from the demands and strictness signatures, as these might not be preserved by the simplifier. This is _not_ done by CoreTidy, because we _do_ want this information, as produced by the last round of the demand analyzer, to be available to the code generator. >--------------------------------------------------------------- 1e9b330146a3d49bb70100791523bf94830ea577 compiler/basicTypes/Demand.hs | 72 ++++++++++++++------ compiler/basicTypes/Id.hs | 11 ++- compiler/basicTypes/IdInfo.hs | 15 ++++- compiler/coreSyn/CoreTidy.hs | 5 +- compiler/simplCore/SimplCore.hs | 5 ++ compiler/stranal/DmdAnal.hs | 28 ++++++++ compiler/stranal/WorkWrap.hs | 78 ++++++++++++++++------ testsuite/tests/perf/haddock/all.T | 3 +- .../tests/simplCore/should_compile/T4908.stderr | 6 +- .../simplCore/should_compile/spec-inline.stderr | 4 +- testsuite/tests/simplCore/should_run/all.T | 2 +- .../tests/stranal/should_compile/T10694.stderr | 61 +++++++++++++++++ .../stranal/sigs/BottomFromInnerLambda.stderr | 7 ++ testsuite/tests/stranal/sigs/DmdAnalGADTs.stderr | 14 ++++ testsuite/tests/stranal/sigs/HyperStrUse.stderr | 6 ++ testsuite/tests/stranal/sigs/StrAnalExample.stderr | 6 ++ testsuite/tests/stranal/sigs/T8569.stderr | 9 +++ testsuite/tests/stranal/sigs/T8598.stderr | 6 ++ testsuite/tests/stranal/sigs/UnsatFun.stderr | 12 ++++ 19 files changed, 298 insertions(+), 52 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 1e9b330146a3d49bb70100791523bf94830ea577 From git at git.haskell.org Sun Apr 3 21:09:51 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 3 Apr 2016 21:09:51 +0000 (UTC) Subject: [commit: ghc] wip/T11731: Add a final demand analyzer run right before TidyCore (cf883c4) Message-ID: <20160403210951.2A7443A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T11731 Link : http://ghc.haskell.org/trac/ghc/changeset/cf883c4a5fdca91cf1487eab2787da6e62e39f7d/ghc >--------------------------------------------------------------- commit cf883c4a5fdca91cf1487eab2787da6e62e39f7d Author: Joachim Breitner Date: Thu Mar 31 10:18:15 2016 +0200 Add a final demand analyzer run right before TidyCore in order to have precise used-once information in the exported strictness signatures, as well as precise used-once information on thunks. This avoids the bad effects of #11731. The subsequent worker-wrapper pass is responsible for removing the demand environment part of the strictness signature. It does not run after the final demand analyzer pass, so remove this also in CoreTidy. The subsequent worker-wrapper pass is also responsible for removing used-once-information from the demands and strictness signatures, as these might not be preserved by the simplifier. This is _not_ done by CoreTidy, because we _do_ want this information, as produced by the last round of the demand analyzer, to be available to the code generator. >--------------------------------------------------------------- cf883c4a5fdca91cf1487eab2787da6e62e39f7d compiler/basicTypes/Demand.hs | 72 ++++++++++++++------ compiler/basicTypes/Id.hs | 11 ++- compiler/basicTypes/IdInfo.hs | 15 +++- compiler/coreSyn/CoreTidy.hs | 5 +- compiler/simplCore/SimplCore.hs | 5 ++ compiler/stranal/DmdAnal.hs | 28 ++++++++ compiler/stranal/WorkWrap.hs | 79 ++++++++++++++++------ testsuite/tests/perf/haddock/all.T | 3 +- .../tests/simplCore/should_compile/T4908.stderr | 6 +- .../simplCore/should_compile/spec-inline.stderr | 4 +- testsuite/tests/simplCore/should_run/all.T | 2 +- .../tests/stranal/should_compile/T10694.stderr | 61 +++++++++++++++++ .../stranal/sigs/BottomFromInnerLambda.stderr | 7 ++ testsuite/tests/stranal/sigs/DmdAnalGADTs.stderr | 14 ++++ testsuite/tests/stranal/sigs/HyperStrUse.stderr | 6 ++ testsuite/tests/stranal/sigs/StrAnalExample.stderr | 6 ++ testsuite/tests/stranal/sigs/T8569.stderr | 9 +++ testsuite/tests/stranal/sigs/T8598.stderr | 6 ++ testsuite/tests/stranal/sigs/UnsatFun.stderr | 12 ++++ 19 files changed, 299 insertions(+), 52 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc cf883c4a5fdca91cf1487eab2787da6e62e39f7d From git at git.haskell.org Mon Apr 4 09:22:37 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 4 Apr 2016 09:22:37 +0000 (UTC) Subject: [commit: ghc] master: Deeply instantiate in :type (f2a2b79) Message-ID: <20160404092237.983033A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f2a2b79fa8d1c702b17e195a70734b06625e0153/ghc >--------------------------------------------------------------- commit f2a2b79fa8d1c702b17e195a70734b06625e0153 Author: Simon Peyton Jones Date: Mon Apr 4 10:18:43 2016 +0100 Deeply instantiate in :type See Trac #11376 and Note [Deeply instantiate in :type] in TcRnDriver Sadly this showed up one new problem (Trac #11786) and one opportunity (Trac #11787), so test T11549 is now marked expect-broken on these two. >--------------------------------------------------------------- f2a2b79fa8d1c702b17e195a70734b06625e0153 compiler/typecheck/TcRnDriver.hs | 31 +++++++++++++++++++++---- testsuite/tests/dependent/ghci/T11549.script | 8 +++---- testsuite/tests/dependent/ghci/all.T | 3 ++- testsuite/tests/ghci/scripts/T11376.script | 6 +++++ testsuite/tests/ghci/scripts/T11376.stdout | 2 ++ testsuite/tests/ghci/scripts/TypeAppData.stdout | 28 +++++++++++----------- testsuite/tests/ghci/scripts/all.T | 1 + 7 files changed, 56 insertions(+), 23 deletions(-) diff --git a/compiler/typecheck/TcRnDriver.hs b/compiler/typecheck/TcRnDriver.hs index 550f84f..640d74d 100644 --- a/compiler/typecheck/TcRnDriver.hs +++ b/compiler/typecheck/TcRnDriver.hs @@ -33,6 +33,7 @@ import RnSplice ( rnTopSpliceDecls, traceSplice, SpliceInfo(..) ) import IfaceEnv( externaliseName ) import TcHsType import TcMatches +import Inst( deeplyInstantiate ) import RnTypes import RnExpr import MkId @@ -1977,9 +1978,16 @@ tcRnExpr hsc_env rdr_expr -- Now typecheck the expression, and generalise its type -- it might have a rank-2 type (e.g. :t runST) uniq <- newUnique ; - let { fresh_it = itName uniq (getLoc rdr_expr) } ; - (tclvl, lie, (_tc_expr, res_ty)) <- pushLevelAndCaptureConstraints $ - tcInferSigma rn_expr ; + let { fresh_it = itName uniq (getLoc rdr_expr) + ; orig = OccurrenceOf fresh_it } ; -- Not a very satisfactory origin + (tclvl, lie, res_ty) + <- pushLevelAndCaptureConstraints $ + do { (_tc_expr, expr_ty) <- tcInferSigma rn_expr + ; (_wrap, res_ty) <- deeplyInstantiate orig expr_ty + -- See [Note Deeply instantiate in :type] + ; return res_ty } ; + + -- Generalise ((qtvs, dicts, _), lie_top) <- captureConstraints $ {-# SCC "simplifyInfer" #-} simplifyInfer tclvl @@ -2055,7 +2063,22 @@ tcRnType hsc_env normalise rdr_type ; return (ty', mkInvForAllTys kvs (typeKind ty')) } -{- Note [Kind-generalise in tcRnType] +{- Note [Deeply instantiate in :type] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Suppose (Trac #11376) + bar :: forall a b. Show a => a -> b -> a +What should `:t bar @Int` show? + + 1. forall b. Show Int => Int -> b -> Int + 2. forall b. Int -> b -> Int + 3. forall {b}. Int -> b -> Int + 4. Int -> b -> Int + +We choose (3), which is the effect of deeply instantiating and +re-generalising. All the others seem deeply confusing. That is +why we deeply instantiate here. + +Note [Kind-generalise in tcRnType] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ We switch on PolyKinds when kind-checking a user type, so that we will kind-generalise the type, even when PolyKinds is not otherwise on. diff --git a/testsuite/tests/dependent/ghci/T11549.script b/testsuite/tests/dependent/ghci/T11549.script index 5f8c500..bb35589 100644 --- a/testsuite/tests/dependent/ghci/T11549.script +++ b/testsuite/tests/dependent/ghci/T11549.script @@ -3,12 +3,12 @@ import GHC.Exts putStrLn "-fno-print-explicit-runtime-reps" :set -fno-print-explicit-runtime-reps -:ty ($) +:info ($) :kind TYPE -:ty error +:info error putStrLn "\n-fprint-explicit-runtime-reps" :set -fprint-explicit-runtime-reps -:ty ($) +:info ($) :kind TYPE -:ty error +:info error diff --git a/testsuite/tests/dependent/ghci/all.T b/testsuite/tests/dependent/ghci/all.T index 6d9332a..956272f 100644 --- a/testsuite/tests/dependent/ghci/all.T +++ b/testsuite/tests/dependent/ghci/all.T @@ -1,3 +1,4 @@ test('T11549', - normal, + [ expect_broken( 11787 ), + expect_broken( 11786 ) ], ghci_script, ['T11549.script']) diff --git a/testsuite/tests/ghci/scripts/T11376.script b/testsuite/tests/ghci/scripts/T11376.script new file mode 100644 index 0000000..780db3c --- /dev/null +++ b/testsuite/tests/ghci/scripts/T11376.script @@ -0,0 +1,6 @@ +:set -XTypeApplications +let { bar :: Show a => a -> b -> a; bar = error "urk" } +:type bar @Int +:set -fprint-explicit-foralls +:type bar @Int + diff --git a/testsuite/tests/ghci/scripts/T11376.stdout b/testsuite/tests/ghci/scripts/T11376.stdout new file mode 100644 index 0000000..0b0b959 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T11376.stdout @@ -0,0 +1,2 @@ +bar @Int :: Int -> b -> Int +bar @Int :: forall {b}. Int -> b -> Int diff --git a/testsuite/tests/ghci/scripts/TypeAppData.stdout b/testsuite/tests/ghci/scripts/TypeAppData.stdout index 5a4880a..0fd5506 100644 --- a/testsuite/tests/ghci/scripts/TypeAppData.stdout +++ b/testsuite/tests/ghci/scripts/TypeAppData.stdout @@ -1,14 +1,14 @@ -P1 :: forall {k} (a :: k). P1 a -P2 :: forall k (a :: k). P2 a -P3 :: forall k (a :: k). P3 k a -P4 :: forall {k} (a :: k). P1 a -> P4 a -P5 :: forall {k} (a :: k). P1 a -> P5 -P6 :: forall k (a :: k). P1 a -> P6 -P7 :: forall {k} (a :: k). P1 a -P8 :: forall {k} (a :: k). P1 a -P9 :: forall k (a :: k). P1 a -P10 :: forall k (a :: k). P1 a -P11 :: forall {k} (a :: k). P1 a -> P5 -P12 :: forall {k} (a :: k). P1 a -> P5 -P13 :: forall k (a :: k). P1 a -> P5 -P14 :: forall k (a :: k). P1 a -> P5 +P1 :: forall {k} {a :: k}. P1 a +P2 :: forall {k} {a :: k}. P2 a +P3 :: forall {k} {a :: k}. P3 k a +P4 :: forall {k} {a :: k}. P1 a -> P4 a +P5 :: forall {k} {a :: k}. P1 a -> P5 +P6 :: forall {k} {a :: k}. P1 a -> P6 +P7 :: forall {k} {a :: k}. P1 a +P8 :: forall {k} {a :: k}. P1 a +P9 :: forall {k} {a :: k}. P1 a +P10 :: forall {k} {a :: k}. P1 a +P11 :: forall {k} {a :: k}. P1 a -> P5 +P12 :: forall {k} {a :: k}. P1 a -> P5 +P13 :: forall {k} {a :: k}. P1 a -> P5 +P14 :: forall {k} {a :: k}. P1 a -> P5 diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T index 8fab956..2d21772 100755 --- a/testsuite/tests/ghci/scripts/all.T +++ b/testsuite/tests/ghci/scripts/all.T @@ -248,3 +248,4 @@ test('T11524a', normal, ghci_script, ['T11524a.script']) test('T11456', normal, ghci_script, ['T11456.script']) test('TypeAppData', normal, ghci_script, ['TypeAppData.script']) test('T11728', normal, ghci_script, ['T11728.script']) +test('T11376', normal, ghci_script, ['T11376.script']) From git at git.haskell.org Mon Apr 4 09:30:22 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 4 Apr 2016 09:30:22 +0000 (UTC) Subject: [commit: ghc] master: rts: Make StablePtr derefs thread-safe (#10296) (90d7d60) Message-ID: <20160404093022.99ED43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/90d7d6086ed6f271a352e784c3bc1d5ecac6052c/ghc >--------------------------------------------------------------- commit 90d7d6086ed6f271a352e784c3bc1d5ecac6052c Author: Jason Eisenberg Date: Mon Apr 4 10:57:39 2016 +0200 rts: Make StablePtr derefs thread-safe (#10296) Stable pointers can now be safely dereferenced while the stable pointer table is simultaneously being enlarged. Test Plan: ./validate Reviewers: ezyang, austin, bgamari, simonmar Subscribers: carter, thomie Differential Revision: https://phabricator.haskell.org/D2031 GHC Trac Issues: #10296 >--------------------------------------------------------------- 90d7d6086ed6f271a352e784c3bc1d5ecac6052c rts/Stable.c | 76 ++++++++++++++++++++++++++++++++++++++--- testsuite/tests/rts/Makefile | 6 ++++ testsuite/tests/rts/T10296a.hs | 33 ++++++++++++++++++ testsuite/tests/rts/T10296a_c.c | 13 +++++++ testsuite/tests/rts/T10296b.hs | 19 +++++++++++ testsuite/tests/rts/all.T | 6 ++++ 6 files changed, 149 insertions(+), 4 deletions(-) diff --git a/rts/Stable.c b/rts/Stable.c index bd09a9f..695c11d 100644 --- a/rts/Stable.c +++ b/rts/Stable.c @@ -17,6 +17,8 @@ #include "Trace.h" #include "Stable.h" +#include + /* Comment from ADR's implementation in old RTS: This files (together with @ghc/runtime/storage/PerformIO.lhc@ and a @@ -96,6 +98,23 @@ static spEntry *stable_ptr_free = NULL; static unsigned int SPT_size = 0; #define INIT_SPT_SIZE 64 +/* Each time the stable pointer table is enlarged, we temporarily retain the old + * version to ensure dereferences are thread-safe (see Note [Enlarging the + * stable pointer table]). Since we double the size of the table each time, we + * can (theoretically) enlarge it at most N times on an N-bit machine. Thus, + * there will never be more than N old versions of the table. + */ +#if SIZEOF_VOID_P == 4 +#define MAX_N_OLD_SPTS 32 +#elif SIZEOF_VOID_P == 8 +#define MAX_N_OLD_SPTS 64 +#else +#error unknown SIZEOF_VOID_P +#endif + +static spEntry *old_SPTs[MAX_N_OLD_SPTS]; +static nat n_old_SPTs = 0; + #ifdef THREADED_RTS Mutex stable_mutex; #endif @@ -205,21 +224,63 @@ static void enlargeStablePtrTable(void) { nat old_SPT_size = SPT_size; + spEntry *new_stable_ptr_table; // 2nd and subsequent times SPT_size *= 2; - stable_ptr_table = - stgReallocBytes(stable_ptr_table, - SPT_size * sizeof *stable_ptr_table, - "enlargeStablePtrTable"); + + /* We temporarily retain the old version instead of freeing it; see Note + * [Enlarging the stable pointer table]. + */ + new_stable_ptr_table = + stgMallocBytes(SPT_size * sizeof *stable_ptr_table, + "enlargeStablePtrTable"); + memcpy(new_stable_ptr_table, + stable_ptr_table, + old_SPT_size * sizeof *stable_ptr_table); + ASSERT(n_old_SPTs < MAX_N_OLD_SPTS); + old_SPTs[n_old_SPTs++] = stable_ptr_table; + + /* When using the threaded RTS, the update of stable_ptr_table is assumed to + * be atomic, so that another thread simultaneously dereferencing a stable + * pointer will always read a valid address. + */ + stable_ptr_table = new_stable_ptr_table; initSpEntryFreeList(stable_ptr_table + old_SPT_size, old_SPT_size, NULL); } +/* Note [Enlarging the stable pointer table] + * + * To enlarge the stable pointer table, we allocate a new table, copy the + * existing entries, and then store the old version of the table in old_SPTs + * until we free it during GC. By not immediately freeing the old version + * (or equivalently by not growing the table using realloc()), we ensure that + * another thread simultaneously dereferencing a stable pointer using the old + * version can safely access the table without causing a segfault (see Trac + * #10296). + * + * Note that because the stable pointer table is doubled in size each time it is + * enlarged, the total memory needed to store the old versions is always less + * than that required to hold the current version. + */ + + /* ----------------------------------------------------------------------------- * Freeing entries and tables * -------------------------------------------------------------------------- */ +static void +freeOldSPTs(void) +{ + nat i; + + for (i = 0; i < n_old_SPTs; i++) { + stgFree(old_SPTs[i]); + } + n_old_SPTs = 0; +} + void exitStableTables(void) { @@ -237,6 +298,8 @@ exitStableTables(void) stable_ptr_table = NULL; SPT_size = 0; + freeOldSPTs(); + #ifdef THREADED_RTS closeMutex(&stable_mutex); #endif @@ -424,6 +487,11 @@ rememberOldStableNameAddresses(void) void markStableTables(evac_fn evac, void *user) { + /* Since no other thread can currently be dereferencing a stable pointer, it + * is safe to free the old versions of the table. + */ + freeOldSPTs(); + markStablePtrTable(evac, user); rememberOldStableNameAddresses(); } diff --git a/testsuite/tests/rts/Makefile b/testsuite/tests/rts/Makefile index 6181f87..e9cce90 100644 --- a/testsuite/tests/rts/Makefile +++ b/testsuite/tests/rts/Makefile @@ -111,6 +111,12 @@ T7037: T7040_ghci_setup : '$(TEST_HC)' $(TEST_HC_OPTS) $(ghciWayFlags) -c T7040_ghci_c.c +.PHONY: T10296a +T10296a: + $(RM) T10296a_c.o T10296a.o T10296a.hi T10296a_stub.h + '$(TEST_HC)' $(TEST_HC_OPTS) -v0 -threaded T10296a.hs T10296a_c.c -o T10296a + ./T10296a +RTS -N2 + .PHONY: linker_unload linker_unload: $(RM) Test.o Test.hi diff --git a/testsuite/tests/rts/T10296a.hs b/testsuite/tests/rts/T10296a.hs new file mode 100644 index 0000000..136508f --- /dev/null +++ b/testsuite/tests/rts/T10296a.hs @@ -0,0 +1,33 @@ +-- A reduced version of the original test case + +{-# LANGUAGE ForeignFunctionInterface #-} + + +import Control.Concurrent +import Control.Monad +import Foreign.C.Types +import Foreign.Ptr + + +main :: IO () +main = do + mv <- newEmptyMVar + -- Fork a thread to continually dereference a stable pointer... + void $ forkIO $ f 1 1000000 >> putMVar mv () + -- ...while we keep enlarging the stable pointer table + f 65536 1 + void $ takeMVar mv + where + f nWraps nApplies = replicateM_ nWraps $ do + -- Each call to wrap creates a stable pointer + wrappedPlus <- wrap (+) + c_applyFun nApplies wrappedPlus 1 2 + + +type CIntFun = CInt -> CInt -> CInt + +foreign import ccall "wrapper" + wrap :: CIntFun -> IO (FunPtr CIntFun) + +foreign import ccall "apply_fun" + c_applyFun :: CInt -> FunPtr CIntFun -> CInt -> CInt -> IO CInt diff --git a/testsuite/tests/rts/T10296a_c.c b/testsuite/tests/rts/T10296a_c.c new file mode 100644 index 0000000..6103874 --- /dev/null +++ b/testsuite/tests/rts/T10296a_c.c @@ -0,0 +1,13 @@ +typedef int (* IntFun)(int a, int b); + +int apply_fun(int n, IntFun f, int a, int b) { + int s = 0; + int i; + + for (i = 0; i < n; i++) { + // Each call back into Haskell using f dereferences a stable pointer + s += f(a, b + i); + } + + return s; +} diff --git a/testsuite/tests/rts/T10296b.hs b/testsuite/tests/rts/T10296b.hs new file mode 100644 index 0000000..e5828df --- /dev/null +++ b/testsuite/tests/rts/T10296b.hs @@ -0,0 +1,19 @@ +-- A variant of the T10296a.hs test case in which +-- - the FFI machinery has been eliminated +-- - a primop (deRefStablePtr#) is used to dereference the stable pointer +-- - the stable pointers are explicitly freed at the end + + +import Control.Concurrent +import Control.Monad +import Foreign.StablePtr + + +main :: IO () +main = do + sp <- newStablePtr () + _ <- forkIO $ forever $ deRefStablePtr sp >> threadDelay 0 + sps <- replicateM 1048576 $ newStablePtr () + ---------------------------------------------------------- + mapM_ freeStablePtr sps + freeStablePtr sp diff --git a/testsuite/tests/rts/all.T b/testsuite/tests/rts/all.T index 269bc55..720ebfb 100644 --- a/testsuite/tests/rts/all.T +++ b/testsuite/tests/rts/all.T @@ -333,3 +333,9 @@ test('T10728', [extra_run_opts('+RTS -maxN3 -RTS'), only_ways(['threaded2'])], test('T9405', [extra_clean(['T9405.ticky'])], run_command, ['$MAKE -s --no-print-directory T9405']) + +test('T10296a', [extra_clean(['T10296a.o','T10296a_c.o','T10296a'])], + run_command, + ['$MAKE -s --no-print-directory T10296a']) + +test('T10296b', [only_ways('threaded2')], compile_and_run, ['']) From git at git.haskell.org Mon Apr 4 09:41:54 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 4 Apr 2016 09:41:54 +0000 (UTC) Subject: [commit: ghc] master: Elaborate test for #11376 (b3ecd04) Message-ID: <20160404094154.3C29A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b3ecd047c432405b57b429fdeaad43f5dcd1ee24/ghc >--------------------------------------------------------------- commit b3ecd047c432405b57b429fdeaad43f5dcd1ee24 Author: Simon Peyton Jones Date: Mon Apr 4 10:34:35 2016 +0100 Elaborate test for #11376 This just adds the Prox stuff from the Description in Trac #11376 to the test case, The class stuff seems weird becuase the type is ambiguous >--------------------------------------------------------------- b3ecd047c432405b57b429fdeaad43f5dcd1ee24 testsuite/tests/ghci/scripts/T11376.script | 8 +++++++- testsuite/tests/ghci/scripts/T11376.stdout | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/ghci/scripts/T11376.script b/testsuite/tests/ghci/scripts/T11376.script index 780db3c..d359b66 100644 --- a/testsuite/tests/ghci/scripts/T11376.script +++ b/testsuite/tests/ghci/scripts/T11376.script @@ -3,4 +3,10 @@ let { bar :: Show a => a -> b -> a; bar = error "urk" } :type bar @Int :set -fprint-explicit-foralls :type bar @Int - +:set -fprint-explicit-kinds -XTypeApplications -XTypeInType +data Prox a = Prox +let { prox :: Prox a; prox = Prox } +:t prox +:t prox @Int +:t Prox +:t Prox @Int diff --git a/testsuite/tests/ghci/scripts/T11376.stdout b/testsuite/tests/ghci/scripts/T11376.stdout index 0b0b959..c945167 100644 --- a/testsuite/tests/ghci/scripts/T11376.stdout +++ b/testsuite/tests/ghci/scripts/T11376.stdout @@ -1,2 +1,6 @@ bar @Int :: Int -> b -> Int bar @Int :: forall {b}. Int -> b -> Int +prox :: forall {k} {a :: k}. Prox k a +prox @Int :: Prox * Int +Prox :: forall {k} {a :: k}. Prox k a +Prox @Int :: Prox * Int From git at git.haskell.org Mon Apr 4 11:05:21 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 4 Apr 2016 11:05:21 +0000 (UTC) Subject: [commit: packages/binary] master: Move end of {-# RULES #-} to be more forgiving for CPP (fb4ea76) Message-ID: <20160404110521.417BB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/fb4ea7609d1d47e95b14e55f5179deb4f8dcbc5f >--------------------------------------------------------------- commit fb4ea7609d1d47e95b14e55f5179deb4f8dcbc5f Author: Lennart Kolmodin Date: Mon Feb 8 22:09:16 2016 +0100 Move end of {-# RULES #-} to be more forgiving for CPP This fixes #105. Older GHC versions + clang ran into trouble, which this commit fixes. >--------------------------------------------------------------- fb4ea7609d1d47e95b14e55f5179deb4f8dcbc5f binary.cabal | 2 +- changelog.md | 5 +++++ src/Data/Binary/Get/Internal.hs | 4 +--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/binary.cabal b/binary.cabal index 5b01fba..b11a525 100644 --- a/binary.cabal +++ b/binary.cabal @@ -1,5 +1,5 @@ name: binary -version: 0.8.2.0 +version: 0.8.2.1 license: BSD3 license-file: LICENSE author: Lennart Kolmodin diff --git a/changelog.md b/changelog.md index 669b5d7..2a4debd 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,11 @@ binary ====== +binary-0.8.2.1 +-------------- + +- Fix compilation error when using older GHC versions and clang. clang barfs on some of its CPP input (#105). + binary-0.8.2.0 -------------- diff --git a/src/Data/Binary/Get/Internal.hs b/src/Data/Binary/Get/Internal.hs index 944a2ce..07d4177 100644 --- a/src/Data/Binary/Get/Internal.hs +++ b/src/Data/Binary/Get/Internal.hs @@ -398,9 +398,7 @@ readN !n f = ensureN n >> unsafeReadN n f {-# RULES "readN/readN merge" forall n m f g. - apG (readN n f) (readN m g) = readN (n+m) (\bs -> f bs $ g (B.unsafeDrop n bs)) - - #-} + apG (readN n f) (readN m g) = readN (n+m) (\bs -> f bs $ g (B.unsafeDrop n bs)) #-} -- | Ensure that there are at least @n@ bytes available. If not, the -- computation will escape with 'Partial'. From git at git.haskell.org Mon Apr 4 11:05:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 4 Apr 2016 11:05:23 +0000 (UTC) Subject: [commit: packages/binary] master: Fail rather than throw exception when decoding Bool and Ordering (2991402) Message-ID: <20160404110523.466793A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/29914028303d553f01deb5313491abebfa7f5a32 >--------------------------------------------------------------- commit 29914028303d553f01deb5313491abebfa7f5a32 Author: Lennart Kolmodin Date: Sun Mar 6 14:54:29 2016 +0100 Fail rather than throw exception when decoding Bool and Ordering Decoding Bool and Ordering was not graceful in case of invalid input. Trying to decode (2 :: Word8) to a Bool would throw an exception in GHC.Enum.toEnum as only the values 0 and 1 are defined. We work around that in this patch by not using toEnum. In case of unexpected input, we fail using 'fail'. This fixes #108. >--------------------------------------------------------------- 29914028303d553f01deb5313491abebfa7f5a32 src/Data/Binary/Class.hs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Data/Binary/Class.hs b/src/Data/Binary/Class.hs index 0eecfcb..2e8c239 100644 --- a/src/Data/Binary/Class.hs +++ b/src/Data/Binary/Class.hs @@ -177,12 +177,21 @@ instance Binary () where -- Bools are encoded as a byte in the range 0 .. 1 instance Binary Bool where put = putWord8 . fromIntegral . fromEnum - get = liftM (toEnum . fromIntegral) getWord8 + get = getWord8 >>= toBool + where + toBool 0 = return False + toBool 1 = return True + toBool c = fail ("Could not map value " ++ show c ++ " to Bool") -- Values of type 'Ordering' are encoded as a byte in the range 0 .. 2 instance Binary Ordering where put = putWord8 . fromIntegral . fromEnum - get = liftM (toEnum . fromIntegral) getWord8 + get = getWord8 >>= toOrd + where + toOrd 0 = return LT + toOrd 1 = return EQ + toOrd 2 = return GT + toOrd c = fail ("Could not map value " ++ show c ++ " to Ordering") ------------------------------------------------------------------------ -- Words and Ints From git at git.haskell.org Mon Apr 4 11:05:25 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 4 Apr 2016 11:05:25 +0000 (UTC) Subject: [commit: packages/binary] master: Add Binary instance for Complex a (5158968) Message-ID: <20160404110525.4CCC43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/5158968fb3579e55bf7356a6e8a2d617e5c10b41 >--------------------------------------------------------------- commit 5158968fb3579e55bf7356a6e8a2d617e5c10b41 Author: Sidharth Kapur Date: Tue Mar 15 10:53:52 2016 -0500 Add Binary instance for Complex a >--------------------------------------------------------------- 5158968fb3579e55bf7356a6e8a2d617e5c10b41 src/Data/Binary/Class.hs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Data/Binary/Class.hs b/src/Data/Binary/Class.hs index 2e8c239..bfb49ed 100644 --- a/src/Data/Binary/Class.hs +++ b/src/Data/Binary/Class.hs @@ -53,6 +53,7 @@ module Data.Binary.Class ( import Data.Word import Data.Bits import Data.Int +import Data.Complex (Complex(..)) #ifdef HAS_VOID import Data.Void #endif @@ -410,6 +411,12 @@ instance (Binary a,Integral a) => Binary (R.Ratio a) where put r = put (R.numerator r) >> put (R.denominator r) get = liftM2 (R.%) get get +instance Binary a => Binary (Complex a) where + {-# INLINE put #-} + put (r :+ i) = put (r, i) + {-# INLINE get #-} + get = (\(r,i) -> r :+ i) <$> get + ------------------------------------------------------------------------ -- Char is serialised as UTF-8 From git at git.haskell.org Mon Apr 4 11:05:27 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 4 Apr 2016 11:05:27 +0000 (UTC) Subject: [commit: packages/binary] master: Merge pull request #110 from sid-kap/complex_instance (e8ef93c) Message-ID: <20160404110527.533DF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/e8ef93cad98ed616a58130f0c9becfcd5040c892 >--------------------------------------------------------------- commit e8ef93cad98ed616a58130f0c9becfcd5040c892 Merge: 2991402 5158968 Author: Lennart Kolmodin Date: Sat Mar 26 08:45:31 2016 +0100 Merge pull request #110 from sid-kap/complex_instance Add Binary instance for Complex a >--------------------------------------------------------------- e8ef93cad98ed616a58130f0c9becfcd5040c892 src/Data/Binary/Class.hs | 7 +++++++ 1 file changed, 7 insertions(+) From git at git.haskell.org Mon Apr 4 11:05:29 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 4 Apr 2016 11:05:29 +0000 (UTC) Subject: [commit: packages/binary] master: Move to bytestring Builder (922592e) Message-ID: <20160404110529.5A2C33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/922592e2f4e318d69ab98ad94e7b5786f3917811 >--------------------------------------------------------------- commit 922592e2f4e318d69ab98ad94e7b5786f3917811 Author: Ben Gamari Date: Wed Jan 14 18:14:50 2015 -0500 Move to bytestring Builder >--------------------------------------------------------------- 922592e2f4e318d69ab98ad94e7b5786f3917811 benchmarks/Builder.hs | 6 - binary.cabal | 12 +- src/Data/Binary/Builder.hs | 208 +++++++++++- src/Data/Binary/Builder/Base.hs | 621 ------------------------------------ src/Data/Binary/Builder/Internal.hs | 28 -- 5 files changed, 207 insertions(+), 668 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 922592e2f4e318d69ab98ad94e7b5786f3917811 From git at git.haskell.org Mon Apr 4 11:05:31 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 4 Apr 2016 11:05:31 +0000 (UTC) Subject: [commit: packages/binary] master: Use putCharUtf8 from Builder in 'instance Binary Char'. (17decb0) Message-ID: <20160404110531.6130F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/17decb02dd242888fa506598572aef828de3cc42 >--------------------------------------------------------------- commit 17decb02dd242888fa506598572aef828de3cc42 Author: Lennart Kolmodin Date: Sat Apr 2 09:24:23 2016 +0200 Use putCharUtf8 from Builder in 'instance Binary Char'. Using `Data.ByteString.Builder` made GenericsBench.encode 10% slower. This brings it back to the same numbers as before. >--------------------------------------------------------------- 17decb02dd242888fa506598572aef828de3cc42 src/Data/Binary/Class.hs | 21 +-------------------- src/Data/Binary/Put.hs | 13 +++++++++++++ 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/src/Data/Binary/Class.hs b/src/Data/Binary/Class.hs index 2e8c239..d0cf71a 100644 --- a/src/Data/Binary/Class.hs +++ b/src/Data/Binary/Class.hs @@ -68,7 +68,6 @@ import Control.Monad import Data.ByteString.Lazy (ByteString) import qualified Data.ByteString.Lazy as L -import Data.Char (ord) import Data.List (unfoldr, foldl') -- And needed for the instances: @@ -414,25 +413,7 @@ instance (Binary a,Integral a) => Binary (R.Ratio a) where -- Char is serialised as UTF-8 instance Binary Char where - put a | c <= 0x7f = put (fromIntegral c :: Word8) - | c <= 0x7ff = do put (0xc0 .|. y) - put (0x80 .|. z) - | c <= 0xffff = do put (0xe0 .|. x) - put (0x80 .|. y) - put (0x80 .|. z) - | c <= 0x10ffff = do put (0xf0 .|. w) - put (0x80 .|. x) - put (0x80 .|. y) - put (0x80 .|. z) - | otherwise = error "Not a valid Unicode code point" - where - c = ord a - z, y, x, w :: Word8 - z = fromIntegral (c .&. 0x3f) - y = fromIntegral (shiftR c 6 .&. 0x3f) - x = fromIntegral (shiftR c 12 .&. 0x3f) - w = fromIntegral (shiftR c 18 .&. 0x7) - + put = putCharUtf8 get = do let getByte = liftM (fromIntegral :: Word8 -> Int) get shiftL6 = flip shiftL 6 :: Int -> Int diff --git a/src/Data/Binary/Put.hs b/src/Data/Binary/Put.hs index 83ec710..70501d1 100644 --- a/src/Data/Binary/Put.hs +++ b/src/Data/Binary/Put.hs @@ -65,6 +65,9 @@ module Data.Binary.Put ( , putInt32host -- :: Int32 -> Put , putInt64host -- :: Int64 -> Put + -- * Unicode + , putCharUtf8 + ) where import Data.Monoid @@ -310,3 +313,13 @@ putInt32host = tell . B.putInt32host putInt64host :: Int64 -> Put putInt64host = tell . B.putInt64host {-# INLINE putInt64host #-} + + +------------------------------------------------------------------------ +-- Unicode + +-- | Write a character using UTF-8 encoding. +putCharUtf8 :: Char -> Put +putCharUtf8 = tell . B.putCharUtf8 +{-# INLINE putCharUtf8 #-} + From git at git.haskell.org Mon Apr 4 11:05:33 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 4 Apr 2016 11:05:33 +0000 (UTC) Subject: [commit: packages/binary] master: Extend the Binary class with 'putList :: [a] -> Put' (dd1f895) Message-ID: <20160404110533.687F53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/dd1f895317db3c5bc17d04a87daaae24480985f5 >--------------------------------------------------------------- commit dd1f895317db3c5bc17d04a87daaae24480985f5 Author: Lennart Kolmodin Date: Sun Apr 3 20:09:36 2016 +0200 Extend the Binary class with 'putList :: [a] -> Put' The default implementation of the new class function is the same as 'instance Binary a => Binary [a]' used to be. 'putList' will enable users to define their own serialization for lists of types. We'll use this to give new list serialization implementations for types already defined in binary. >--------------------------------------------------------------- dd1f895317db3c5bc17d04a87daaae24480985f5 src/Data/Binary/Class.hs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Data/Binary/Class.hs b/src/Data/Binary/Class.hs index d0cf71a..071b2f0 100644 --- a/src/Data/Binary/Class.hs +++ b/src/Data/Binary/Class.hs @@ -146,6 +146,9 @@ class Binary t where -- | Decode a value in the Get monad get :: Get t + putList :: [t] -> Put + putList = defaultPutList + #ifdef GENERICS default put :: (Generic t, GBinaryPut (Rep t)) => t -> Put put = gput . from @@ -154,6 +157,10 @@ class Binary t where get = to `fmap` gget #endif +{-# INLINE defaultPutList #-} +defaultPutList :: Binary a => [a] -> Put +defaultPutList xs = put (length xs) >> mapM_ put xs + ------------------------------------------------------------------------ -- Simple instances @@ -495,9 +502,9 @@ instance (Binary a, Binary b, Binary c, Binary d, Binary e, -- Container types instance Binary a => Binary [a] where - put l = put (length l) >> mapM_ put l - get = do n <- get :: Get Int - getMany n + put = putList + get = do n <- get :: Get Int + getMany n -- | 'getMany n' get 'n' elements in order, without blowing the stack. getMany :: Binary a => Int -> Get [a] From git at git.haskell.org Mon Apr 4 11:05:35 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 4 Apr 2016 11:05:35 +0000 (UTC) Subject: [commit: packages/binary] master: Add 'putList' instance for Char. (bb74506) Message-ID: <20160404110535.6FA0D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/bb74506447397337fa3feaafdac1d714ea184358 >--------------------------------------------------------------- commit bb74506447397337fa3feaafdac1d714ea184358 Author: Lennart Kolmodin Date: Sun Apr 3 22:03:00 2016 +0200 Add 'putList' instance for Char. This speeds up the UTF8 encoding of String with about 70%. The small String benchmark; "small Strings" : 3459.04 us 1037.00 us -70.0% GenericsBench bechmark encodes a data type with many Strings; encode : 46391.59 us 13116.85 us -71.7% >--------------------------------------------------------------- bb74506447397337fa3feaafdac1d714ea184358 src/Data/Binary/Builder.hs | 6 ++++++ src/Data/Binary/Class.hs | 1 + src/Data/Binary/Put.hs | 5 +++++ 3 files changed, 12 insertions(+) diff --git a/src/Data/Binary/Builder.hs b/src/Data/Binary/Builder.hs index 976f156..9da9e0e 100644 --- a/src/Data/Binary/Builder.hs +++ b/src/Data/Binary/Builder.hs @@ -65,6 +65,7 @@ module Data.Binary.Builder ( -- ** Unicode , putCharUtf8 + , putStringUtf8 ) where import qualified Data.ByteString as S @@ -264,3 +265,8 @@ putInt64host = Prim.primFixed Prim.int64Host putCharUtf8 :: Char -> Builder putCharUtf8 = Prim.primBounded Prim.charUtf8 {-# INLINE putCharUtf8 #-} + +-- | Write a String using UTF-8 encoding. +putStringUtf8 :: String -> Builder +putStringUtf8 = Prim.primMapListBounded Prim.charUtf8 +{-# INLINE putStringUtf8 #-} diff --git a/src/Data/Binary/Class.hs b/src/Data/Binary/Class.hs index 071b2f0..8da3787 100644 --- a/src/Data/Binary/Class.hs +++ b/src/Data/Binary/Class.hs @@ -421,6 +421,7 @@ instance (Binary a,Integral a) => Binary (R.Ratio a) where -- Char is serialised as UTF-8 instance Binary Char where put = putCharUtf8 + putList str = put (length str) >> putStringUtf8 str get = do let getByte = liftM (fromIntegral :: Word8 -> Int) get shiftL6 = flip shiftL 6 :: Int -> Int diff --git a/src/Data/Binary/Put.hs b/src/Data/Binary/Put.hs index 70501d1..85ef569 100644 --- a/src/Data/Binary/Put.hs +++ b/src/Data/Binary/Put.hs @@ -67,6 +67,7 @@ module Data.Binary.Put ( -- * Unicode , putCharUtf8 + , putStringUtf8 ) where @@ -323,3 +324,7 @@ putCharUtf8 :: Char -> Put putCharUtf8 = tell . B.putCharUtf8 {-# INLINE putCharUtf8 #-} +-- | Write a String using UTF-8 encoding. +putStringUtf8 :: String -> Put +putStringUtf8 = tell . B.putStringUtf8 +{-# INLINE putStringUtf8 #-} From git at git.haskell.org Mon Apr 4 11:05:37 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 4 Apr 2016 11:05:37 +0000 (UTC) Subject: [commit: packages/binary] master: Merge branch 'pr/bytestring-builder' (6c67458) Message-ID: <20160404110537.76C103A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/6c67458baf1b9f8ca3e79d1aaab871727ad93ac2 >--------------------------------------------------------------- commit 6c67458baf1b9f8ca3e79d1aaab871727ad93ac2 Merge: e8ef93c bb74506 Author: Lennart Kolmodin Date: Sun Apr 3 22:14:42 2016 +0200 Merge branch 'pr/bytestring-builder' >--------------------------------------------------------------- 6c67458baf1b9f8ca3e79d1aaab871727ad93ac2 benchmarks/Builder.hs | 6 - binary.cabal | 12 +- src/Data/Binary/Builder.hs | 214 ++++++++++++- src/Data/Binary/Builder/Base.hs | 621 ------------------------------------ src/Data/Binary/Builder/Internal.hs | 28 -- src/Data/Binary/Class.hs | 35 +- src/Data/Binary/Put.hs | 18 ++ 7 files changed, 243 insertions(+), 691 deletions(-) From git at git.haskell.org Mon Apr 4 11:05:39 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 4 Apr 2016 11:05:39 +0000 (UTC) Subject: [commit: packages/binary] master: Add new benchmark suite for encoding. (69915d0) Message-ID: <20160404110539.7E1A73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/69915d0a26ae9eaa6b34367989ee8ed356ed13bb >--------------------------------------------------------------- commit 69915d0a26ae9eaa6b34367989ee8ed356ed13bb Author: Lennart Kolmodin Date: Sun Apr 3 22:17:05 2016 +0200 Add new benchmark suite for encoding. >--------------------------------------------------------------- 69915d0a26ae9eaa6b34367989ee8ed356ed13bb benchmarks/Put.hs | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ binary.cabal | 13 ++++++ 2 files changed, 130 insertions(+) diff --git a/benchmarks/Put.hs b/benchmarks/Put.hs new file mode 100644 index 0000000..c3cae43 --- /dev/null +++ b/benchmarks/Put.hs @@ -0,0 +1,117 @@ +{-# LANGUAGE CPP, ExistentialQuantification #-} + +module Main (main) where + +import Control.DeepSeq +import Control.Exception (evaluate) +import Criterion.Main +import qualified Data.ByteString as S +import qualified Data.ByteString.Char8 as C +import qualified Data.ByteString.Lazy as L + +import Data.Binary +import Data.Binary.Put + +main :: IO () +main = do + evaluate $ rnf + [ rnf bigIntegers + , rnf smallIntegers + , rnf smallByteStrings + , rnf smallStrings + , rnf word8s + ] + defaultMain + [ + bench "small Integers" $ whnf (run . fromIntegers) smallIntegers, + bench "big Integers" $ whnf (run . fromIntegers) bigIntegers, + + bench "[small Integer]" $ whnf (run . put) smallIntegers, + bench "[big Integer]" $ whnf (run . put) bigIntegers, + + bench "small ByteStrings" $ whnf (run . fromByteStrings) smallByteStrings, + bench "[small ByteString]" $ whnf (run . put) smallByteStrings, + + bench "small Strings" $ whnf (run . fromStrings) smallStrings, + bench "[small String]" $ whnf (run . put) smallStrings, + + bench "Word8s" $ whnf (run . fromWord8s) word8s, + bench "[Word8]" $ whnf (run . put) word8s, + bench "Word16s" $ whnf (run . fromWord16s) word16s, + bench "[Word16]" $ whnf (run . put) word16s, + bench "Word32s" $ whnf (run . fromWord32s) word32s, + bench "[Word32]" $ whnf (run . put) word32s, + bench "Word64s" $ whnf (run . fromWord64s) word64s, + bench "[Word64]" $ whnf (run . put) word64s + ] + where + run = L.length . runPut + +-- Input data + +smallIntegers :: [Integer] +smallIntegers = [0..10000] +{-# NOINLINE smallIntegers #-} + +bigIntegers :: [Integer] +bigIntegers = [max .. max + 10000] + where + max :: Integer + max = fromIntegral (maxBound :: Word64) +{-# NOINLINE bigIntegers #-} + +smallByteStrings :: [S.ByteString] +smallByteStrings = replicate 10000 $ C.pack "abcdefghi" +{-# NOINLINE smallByteStrings #-} + +smallStrings :: [String] +smallStrings = replicate 10000 "abcdefghi" +{-# NOINLINE smallStrings #-} + +word8s :: [Word8] +word8s = take 10000 $ cycle [minBound .. maxBound] +{-# NOINLINE word8s #-} + +word16s :: [Word16] +word16s = take 10000 $ cycle [minBound .. maxBound] +{-# NOINLINE word16s #-} + +word32s :: [Word32] +word32s = take 10000 $ cycle [minBound .. maxBound] +{-# NOINLINE word32s #-} + +word64s :: [Word64] +word64s = take 10000 $ cycle [minBound .. maxBound] +{-# NOINLINE word64s #-} + +------------------------------------------------------------------------ +-- Benchmarks + +fromIntegers :: [Integer] -> Put +fromIntegers [] = return () +fromIntegers (x:xs) = put x >> fromIntegers xs + +fromByteStrings :: [S.ByteString] -> Put +fromByteStrings [] = return () +fromByteStrings (x:xs) = put x >> fromByteStrings xs + +fromStrings :: [String] -> Put +fromStrings [] = return () +fromStrings (x:xs) = put x >> fromStrings xs + +fromWord8s :: [Word8] -> Put +fromWord8s [] = return () +fromWord8s (x:xs) = put x >> fromWord8s xs + +fromWord16s :: [Word16] -> Put +fromWord16s [] = return () +fromWord16s (x:xs) = put x >> fromWord16s xs + +fromWord32s :: [Word32] -> Put +fromWord32s [] = return () +fromWord32s (x:xs) = put x >> fromWord32s xs + +fromWord64s :: [Word64] -> Put +fromWord64s [] = return () +fromWord64s (x:xs) = put x >> fromWord64s xs + diff --git a/binary.cabal b/binary.cabal index 8d94aa7..f9a9aef 100644 --- a/binary.cabal +++ b/binary.cabal @@ -124,6 +124,19 @@ benchmark get build-depends: array, containers ghc-options: -O2 -Wall +benchmark put + type: exitcode-stdio-1.0 + hs-source-dirs: src benchmarks + main-is: Put.hs + build-depends: + base >= 3.0 && < 5, + bytestring, + criterion == 1.*, + deepseq + -- build dependencies from using binary source rather than depending on the library + build-depends: array, containers + ghc-options: -O2 -Wall + benchmark generics-bench type: exitcode-stdio-1.0 hs-source-dirs: src benchmarks From git at git.haskell.org Mon Apr 4 11:07:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 4 Apr 2016 11:07:03 +0000 (UTC) Subject: [commit: ghc] master: Bump binary submodule (9b6820c) Message-ID: <20160404110703.559C33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9b6820cdd6bac8b8346be48224627e3feefa9036/ghc >--------------------------------------------------------------- commit 9b6820cdd6bac8b8346be48224627e3feefa9036 Author: Ben Gamari Date: Mon Apr 4 11:52:43 2016 +0200 Bump binary submodule >--------------------------------------------------------------- 9b6820cdd6bac8b8346be48224627e3feefa9036 libraries/binary | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/binary b/libraries/binary index 2afc452..69915d0 160000 --- a/libraries/binary +++ b/libraries/binary @@ -1 +1 @@ -Subproject commit 2afc452571f8176af84c01e47da91ee371bbefbd +Subproject commit 69915d0a26ae9eaa6b34367989ee8ed356ed13bb From git at git.haskell.org Mon Apr 4 11:07:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 4 Apr 2016 11:07:06 +0000 (UTC) Subject: [commit: ghc] master: Don't infer CallStacks (7407a66) Message-ID: <20160404110706.28F803A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7407a66d5bd29aa011f5a4228c6e2b2f7f8ad3f8/ghc >--------------------------------------------------------------- commit 7407a66d5bd29aa011f5a4228c6e2b2f7f8ad3f8 Author: Eric Seidel Date: Mon Apr 4 12:05:01 2016 +0200 Don't infer CallStacks We originally wanted CallStacks to be opt-in, but dealing with let binders complicated things, forcing us to infer CallStacks. It turns out that the inference is actually unnecessary though, we can let the wanted CallStacks bubble up to the outer context by refusing to quantify over them. Eventually they'll be solved from a given CallStack or defaulted to the empty CallStack if they reach the top. So this patch prevents GHC from quantifying over CallStacks, getting us back to the original plan. There's a small ugliness to do with PartialTypeSignatures, if the partial theta contains a CallStack constraint, we *do* want to quantify over the CallStack; the user asked us to! Note that this means that foo :: _ => CallStack foo = getCallStack callStack will be an *empty* CallStack, since we won't infer a CallStack for the hole in the theta. I think this is the right move though, since we want CallStacks to be opt-in. One can always write foo :: (HasCallStack, _) => CallStack foo = getCallStack callStack to get the CallStack and still have GHC infer the rest of the theta. Test Plan: ./validate Reviewers: goldfire, simonpj, austin, hvr, bgamari Reviewed By: simonpj, bgamari Subscribers: bitemyapp, thomie Projects: #ghc Differential Revision: https://phabricator.haskell.org/D1912 GHC Trac Issues: #11573 >--------------------------------------------------------------- 7407a66d5bd29aa011f5a4228c6e2b2f7f8ad3f8 compiler/typecheck/TcBinds.hs | 4 +- compiler/typecheck/TcEvidence.hs | 3 ++ compiler/typecheck/TcInteract.hs | 2 +- compiler/typecheck/TcRnTypes.hs | 18 +------- compiler/typecheck/TcSimplify.hs | 6 +-- compiler/typecheck/TcType.hs | 43 +++++++++++++++++-- docs/users_guide/glasgow_exts.rst | 50 +++++++++++----------- libraries/base/GHC/Stack.hs | 6 +-- libraries/base/GHC/Stack/Types.hs | 16 +++---- testsuite/tests/codeGen/should_run/cgrun059.stderr | 3 +- .../tests/concurrent/should_run/conc021.stderr | 3 +- testsuite/tests/deSugar/should_run/T11601.stderr | 1 - .../tests/ghci.debugger/scripts/break017.stdout | 5 +-- .../tests/ghci.debugger/scripts/print033.stdout | 3 +- testsuite/tests/ghci/scripts/T5557.stdout | 10 ++--- testsuite/tests/ghci/scripts/ghci013.stdout | 3 +- testsuite/tests/ghci/scripts/ghci046.stdout | 4 +- testsuite/tests/ghci/scripts/ghci055.stdout | 7 ++- .../should_compile/ExtraConstraints3.stderr | 7 ++- .../tests/partial-sigs/should_fail/T10999.stderr | 8 +--- testsuite/tests/typecheck/should_run/T10845.hs | 11 +---- testsuite/tests/typecheck/should_run/T10845.stdout | 7 +-- testsuite/tests/typecheck/should_run/T8119.stdout | 3 +- 23 files changed, 111 insertions(+), 112 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 7407a66d5bd29aa011f5a4228c6e2b2f7f8ad3f8 From git at git.haskell.org Mon Apr 4 14:51:14 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 4 Apr 2016 14:51:14 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Revert accidental change to collectTyAndValBinders (036bda3) Message-ID: <20160404145114.331503A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/036bda33654e7b9ae4b8dde32bc28bb1646c7e92/ghc >--------------------------------------------------------------- commit 036bda33654e7b9ae4b8dde32bc28bb1646c7e92 Author: Simon Peyton Jones Date: Thu Mar 31 10:47:47 2016 +0100 Revert accidental change to collectTyAndValBinders Richard accidetally introduced this change in his big kind-equality patch. The code is wrong, and potentially could cause binders to be re-ordered. Worth merging to 8.0. (cherry picked from commit da260a5bddf990959f639a3551b335ee26c766f6) >--------------------------------------------------------------- 036bda33654e7b9ae4b8dde32bc28bb1646c7e92 compiler/coreSyn/CoreSyn.hs | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/compiler/coreSyn/CoreSyn.hs b/compiler/coreSyn/CoreSyn.hs index 772359f..88f88e7 100644 --- a/compiler/coreSyn/CoreSyn.hs +++ b/compiler/coreSyn/CoreSyn.hs @@ -1612,14 +1612,12 @@ flattenBinds (Rec prs1 : binds) = prs1 ++ flattenBinds binds flattenBinds [] = [] -- | We often want to strip off leading lambdas before getting down to --- business. This function is your friend. -collectBinders :: Expr b -> ([b], Expr b) --- | Collect type and value binders from nested lambdas, stopping --- right before any "forall"s within a non-forall. For example, --- forall (a :: *) (b :: Foo ~ Bar) (c :: *). Baz -> forall (d :: *). Blob --- will pull out the binders for a, b, c, and Baz, but not for d or anything --- within Blob. This is to coordinate with tcSplitSigmaTy. -collectTyAndValBinders :: CoreExpr -> ([TyVar], [Id], CoreExpr) +-- business. Variants are 'collectTyBinders', 'collectValBinders', +-- and 'collectTyAndValBinders' +collectBinders :: Expr b -> ([b], Expr b) +collectTyBinders :: CoreExpr -> ([TyVar], CoreExpr) +collectValBinders :: CoreExpr -> ([Id], CoreExpr) +collectTyAndValBinders :: CoreExpr -> ([TyVar], [Id], CoreExpr) collectBinders expr = go [] expr @@ -1627,16 +1625,23 @@ collectBinders expr go bs (Lam b e) = go (b:bs) e go bs e = (reverse bs, e) +collectTyBinders expr + = go [] expr + where + go tvs (Lam b e) | isTyVar b = go (b:tvs) e + go tvs e = (reverse tvs, e) + +collectValBinders expr + = go [] expr + where + go ids (Lam b e) | isId b = go (b:ids) e + go ids body = (reverse ids, body) + collectTyAndValBinders expr - = go_forall [] [] expr - where go_forall tvs ids (Lam b e) - | isTyVar b = go_forall (b:tvs) ids e - | isCoVar b = go_forall tvs (b:ids) e - go_forall tvs ids e = go_fun tvs ids e - - go_fun tvs ids (Lam b e) - | isId b = go_fun tvs (b:ids) e - go_fun tvs ids e = (reverse tvs, reverse ids, e) + = (tvs, ids, body) + where + (tvs, body1) = collectTyBinders expr + (ids, body) = collectValBinders body1 -- | Takes a nested application expression and returns the the function -- being applied and the arguments to which it is applied From git at git.haskell.org Mon Apr 4 14:51:16 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 4 Apr 2016 14:51:16 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Make the example for -M work (9749b8c) Message-ID: <20160404145116.D06EC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/9749b8c440181bdd6470c11a409c0e5b32152577/ghc >--------------------------------------------------------------- commit 9749b8c440181bdd6470c11a409c0e5b32152577 Author: Bartosz Nitka Date: Fri Apr 1 13:03:17 2016 -0700 Make the example for -M work `ghc` fails without `-dep-suffix ''`. Test Plan: visual inspection Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie, simonmar Differential Revision: https://phabricator.haskell.org/D2075 (cherry picked from commit 38068913c13fa64bd776fab6cf0e971c1a18b54d) >--------------------------------------------------------------- 9749b8c440181bdd6470c11a409c0e5b32152577 docs/users_guide/separate_compilation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/users_guide/separate_compilation.rst b/docs/users_guide/separate_compilation.rst index a2ce5eb..dd16f1f 100644 --- a/docs/users_guide/separate_compilation.rst +++ b/docs/users_guide/separate_compilation.rst @@ -829,7 +829,7 @@ following to your ``Makefile``: .. code-block:: make depend : - ghc -M $(HC_OPTS) $(SRCS) + ghc -dep-suffix '' -M $(HC_OPTS) $(SRCS) Now, before you start compiling, and any time you change the ``imports`` in your program, do ``make depend`` before you do ``make cool_pgm``. The command From git at git.haskell.org Mon Apr 4 14:51:20 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 4 Apr 2016 14:51:20 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Improve printing of pattern synonym types (f75e098) Message-ID: <20160404145120.1BBE63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/f75e098a0e3f7c81cad92e6b52f6c00a6491152d/ghc >--------------------------------------------------------------- commit f75e098a0e3f7c81cad92e6b52f6c00a6491152d Author: Rik Steenkamp Date: Sat Apr 2 20:39:10 2016 +0100 Improve printing of pattern synonym types Add the function `pprPatSynType :: PatSyn -> SDoc` for printing pattern synonym types, and remove the ambiguous `patSynType` function. Also, the types in a `PatSyn` are now tidy. Haddock submodule updated to reflect the removal of `patSynType` by mpickering. Fixes: #11213. Reviewers: goldfire, simonpj, austin, mpickering, bgamari Reviewed By: simonpj, mpickering Subscribers: bollmann, simonpj, thomie Differential Revision: https://phabricator.haskell.org/D1896 GHC Trac Issues: #11213 (cherry picked from commit 72bd7f7be7809076f321a6fca90024e3e1bde3cc) >--------------------------------------------------------------- f75e098a0e3f7c81cad92e6b52f6c00a6491152d compiler/basicTypes/PatSyn.hs | 27 ++--- compiler/rename/RnNames.hs | 109 ++++++++------------- compiler/typecheck/TcPatSyn.hs | 21 ++-- compiler/typecheck/TcRnTypes.hs | 4 +- testsuite/tests/patsyn/should_compile/T11213.hs | 29 ++++++ .../tests/patsyn/should_compile/T11213.stderr | 46 +++++++++ testsuite/tests/patsyn/should_compile/all.T | 1 + utils/haddock | 2 +- 8 files changed, 148 insertions(+), 91 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc f75e098a0e3f7c81cad92e6b52f6c00a6491152d From git at git.haskell.org Mon Apr 4 14:51:22 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 4 Apr 2016 14:51:22 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Bump binary submodule (0ecd69b) Message-ID: <20160404145122.BDF883A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/0ecd69bda0df73134acc4dc1fa9cc63315ebb531/ghc >--------------------------------------------------------------- commit 0ecd69bda0df73134acc4dc1fa9cc63315ebb531 Author: Ben Gamari Date: Mon Apr 4 11:52:43 2016 +0200 Bump binary submodule (cherry picked from commit 9b6820cdd6bac8b8346be48224627e3feefa9036) >--------------------------------------------------------------- 0ecd69bda0df73134acc4dc1fa9cc63315ebb531 libraries/binary | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/binary b/libraries/binary index 2afc452..69915d0 160000 --- a/libraries/binary +++ b/libraries/binary @@ -1 +1 @@ -Subproject commit 2afc452571f8176af84c01e47da91ee371bbefbd +Subproject commit 69915d0a26ae9eaa6b34367989ee8ed356ed13bb From git at git.haskell.org Mon Apr 4 14:51:25 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 4 Apr 2016 14:51:25 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Don't infer CallStacks (773e81b) Message-ID: <20160404145125.81C863A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/773e81ba563ae2839f0d61a6401e318e4bacd036/ghc >--------------------------------------------------------------- commit 773e81ba563ae2839f0d61a6401e318e4bacd036 Author: Eric Seidel Date: Mon Apr 4 12:05:01 2016 +0200 Don't infer CallStacks We originally wanted CallStacks to be opt-in, but dealing with let binders complicated things, forcing us to infer CallStacks. It turns out that the inference is actually unnecessary though, we can let the wanted CallStacks bubble up to the outer context by refusing to quantify over them. Eventually they'll be solved from a given CallStack or defaulted to the empty CallStack if they reach the top. So this patch prevents GHC from quantifying over CallStacks, getting us back to the original plan. There's a small ugliness to do with PartialTypeSignatures, if the partial theta contains a CallStack constraint, we *do* want to quantify over the CallStack; the user asked us to! Note that this means that foo :: _ => CallStack foo = getCallStack callStack will be an *empty* CallStack, since we won't infer a CallStack for the hole in the theta. I think this is the right move though, since we want CallStacks to be opt-in. One can always write foo :: (HasCallStack, _) => CallStack foo = getCallStack callStack to get the CallStack and still have GHC infer the rest of the theta. Test Plan: ./validate Reviewers: goldfire, simonpj, austin, hvr, bgamari Reviewed By: simonpj, bgamari Subscribers: bitemyapp, thomie Projects: #ghc Differential Revision: https://phabricator.haskell.org/D1912 GHC Trac Issues: #11573 (cherry picked from commit 7407a66d5bd29aa011f5a4228c6e2b2f7f8ad3f8) >--------------------------------------------------------------- 773e81ba563ae2839f0d61a6401e318e4bacd036 compiler/typecheck/TcBinds.hs | 4 +- compiler/typecheck/TcEvidence.hs | 3 ++ compiler/typecheck/TcInteract.hs | 2 +- compiler/typecheck/TcRnTypes.hs | 18 +------- compiler/typecheck/TcSimplify.hs | 6 +-- compiler/typecheck/TcType.hs | 43 +++++++++++++++++-- docs/users_guide/glasgow_exts.rst | 50 +++++++++++----------- libraries/base/GHC/Stack.hs | 6 +-- libraries/base/GHC/Stack/Types.hs | 16 +++---- testsuite/tests/codeGen/should_run/cgrun059.stderr | 3 +- .../tests/concurrent/should_run/conc021.stderr | 3 +- testsuite/tests/deSugar/should_run/T11601.stderr | 1 - .../tests/ghci.debugger/scripts/break017.stdout | 5 +-- .../tests/ghci.debugger/scripts/print033.stdout | 3 +- testsuite/tests/ghci/scripts/T5557.stdout | 10 ++--- testsuite/tests/ghci/scripts/ghci013.stdout | 3 +- testsuite/tests/ghci/scripts/ghci046.stdout | 4 +- testsuite/tests/ghci/scripts/ghci055.stdout | 7 ++- .../should_compile/ExtraConstraints3.stderr | 7 ++- .../tests/partial-sigs/should_fail/T10999.stderr | 8 +--- testsuite/tests/typecheck/should_run/T10845.hs | 11 +---- testsuite/tests/typecheck/should_run/T10845.stdout | 7 +-- testsuite/tests/typecheck/should_run/T8119.stdout | 3 +- 23 files changed, 111 insertions(+), 112 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 773e81ba563ae2839f0d61a6401e318e4bacd036 From git at git.haskell.org Tue Apr 5 12:42:47 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 5 Apr 2016 12:42:47 +0000 (UTC) Subject: [commit: ghc] master: Use exprCtOrigin in tcRnExpr (2f3b803) Message-ID: <20160405124247.0D7F63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2f3b8039e43bd1e2ce7d5af166301441e25b40c4/ghc >--------------------------------------------------------------- commit 2f3b8039e43bd1e2ce7d5af166301441e25b40c4 Author: Simon Peyton Jones Date: Tue Apr 5 13:44:21 2016 +0100 Use exprCtOrigin in tcRnExpr Richard suggested this, a good idea >--------------------------------------------------------------- 2f3b8039e43bd1e2ce7d5af166301441e25b40c4 compiler/typecheck/TcRnDriver.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/typecheck/TcRnDriver.hs b/compiler/typecheck/TcRnDriver.hs index 640d74d..952e4eb 100644 --- a/compiler/typecheck/TcRnDriver.hs +++ b/compiler/typecheck/TcRnDriver.hs @@ -1979,7 +1979,7 @@ tcRnExpr hsc_env rdr_expr -- it might have a rank-2 type (e.g. :t runST) uniq <- newUnique ; let { fresh_it = itName uniq (getLoc rdr_expr) - ; orig = OccurrenceOf fresh_it } ; -- Not a very satisfactory origin + ; orig = exprCtOrigin (unLoc rn_expr) } ; (tclvl, lie, res_ty) <- pushLevelAndCaptureConstraints $ do { (_tc_expr, expr_ty) <- tcInferSigma rn_expr From git at git.haskell.org Tue Apr 5 13:44:30 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 5 Apr 2016 13:44:30 +0000 (UTC) Subject: [commit: ghc] master: Fix misattribution of `-Wunused-local-binds` warnings (1e6ec12) Message-ID: <20160405134430.3985E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1e6ec1249b4da88fec9024598c2183e6fc0e96cd/ghc >--------------------------------------------------------------- commit 1e6ec1249b4da88fec9024598c2183e6fc0e96cd Author: Herbert Valerio Riedel Date: Tue Apr 5 15:15:47 2016 +0200 Fix misattribution of `-Wunused-local-binds` warnings This fixes a bug where warnings actually controlled by - `Opt_WarnUnusedMatches` - `Opt_WarnUnusedTypePatterns` - `Opt_WarnUnusedTopBinds` were incorrectly reported as being controlled by `Opt_WarnUnusedLocalBinds` as well This bug was introduced in bb5afd3c274011c5ea302210b4c290ec1f83209c while implementing #10752 Test Plan: ./validate still running -- testsuite output wiggles expected Reviewers: barrucadu, quchen, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2077 >--------------------------------------------------------------- 1e6ec1249b4da88fec9024598c2183e6fc0e96cd compiler/rename/RnEnv.hs | 17 +++++++++-------- testsuite/tests/deSugar/should_compile/ds053.stderr | 2 +- testsuite/tests/driver/werror.stderr | 2 +- .../should_compile/UnusedTyVarWarnings.stderr | 8 ++++---- .../should_compile/UnusedTyVarWarningsNamedWCs.stderr | 8 ++++---- .../should_fail/overloadedrecfldsfail05.stderr | 2 +- .../should_fail/overloadedrecfldsfail06.stderr | 6 +++--- testsuite/tests/parser/should_compile/read014.stderr | 4 ++-- testsuite/tests/rename/should_compile/T17a.stderr | 2 +- testsuite/tests/rename/should_compile/T17d.stderr | 2 +- testsuite/tests/rename/should_compile/T17e.stderr | 2 +- testsuite/tests/rename/should_compile/T3371.stderr | 2 +- testsuite/tests/rename/should_compile/T3449.stderr | 2 +- testsuite/tests/rename/should_compile/T7145b.stderr | 2 +- testsuite/tests/rename/should_compile/mc10.stderr | 2 +- testsuite/tests/rename/should_compile/rn040.stderr | 4 ++-- testsuite/tests/rename/should_compile/rn041.stderr | 6 +++--- testsuite/tests/rename/should_compile/rn047.stderr | 2 +- testsuite/tests/typecheck/should_compile/T2497.stderr | 2 +- 19 files changed, 39 insertions(+), 38 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 1e6ec1249b4da88fec9024598c2183e6fc0e96cd From git at git.haskell.org Tue Apr 5 14:18:46 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 5 Apr 2016 14:18:46 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: rts: Make StablePtr derefs thread-safe (#10296) (fb290f9) Message-ID: <20160405141846.167D73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/fb290f9cc6db2ac681b5a92ff9b24f4d48728f83/ghc >--------------------------------------------------------------- commit fb290f9cc6db2ac681b5a92ff9b24f4d48728f83 Author: Jason Eisenberg Date: Mon Apr 4 10:57:39 2016 +0200 rts: Make StablePtr derefs thread-safe (#10296) Stable pointers can now be safely dereferenced while the stable pointer table is simultaneously being enlarged. Test Plan: ./validate Reviewers: ezyang, austin, bgamari, simonmar Subscribers: carter, thomie Differential Revision: https://phabricator.haskell.org/D2031 GHC Trac Issues: #10296 (cherry picked from commit 90d7d6086ed6f271a352e784c3bc1d5ecac6052c) >--------------------------------------------------------------- fb290f9cc6db2ac681b5a92ff9b24f4d48728f83 rts/Stable.c | 76 ++++++++++++++++++++++++++++++++++++++--- testsuite/tests/rts/Makefile | 6 ++++ testsuite/tests/rts/T10296a.hs | 33 ++++++++++++++++++ testsuite/tests/rts/T10296a_c.c | 13 +++++++ testsuite/tests/rts/T10296b.hs | 19 +++++++++++ testsuite/tests/rts/all.T | 6 ++++ 6 files changed, 149 insertions(+), 4 deletions(-) diff --git a/rts/Stable.c b/rts/Stable.c index 431b7c6..3cebd5a 100644 --- a/rts/Stable.c +++ b/rts/Stable.c @@ -17,6 +17,8 @@ #include "Trace.h" #include "Stable.h" +#include + /* Comment from ADR's implementation in old RTS: This files (together with @ghc/runtime/storage/PerformIO.lhc@ and a @@ -96,6 +98,23 @@ static spEntry *stable_ptr_free = NULL; static unsigned int SPT_size = 0; #define INIT_SPT_SIZE 64 +/* Each time the stable pointer table is enlarged, we temporarily retain the old + * version to ensure dereferences are thread-safe (see Note [Enlarging the + * stable pointer table]). Since we double the size of the table each time, we + * can (theoretically) enlarge it at most N times on an N-bit machine. Thus, + * there will never be more than N old versions of the table. + */ +#if SIZEOF_VOID_P == 4 +#define MAX_N_OLD_SPTS 32 +#elif SIZEOF_VOID_P == 8 +#define MAX_N_OLD_SPTS 64 +#else +#error unknown SIZEOF_VOID_P +#endif + +static spEntry *old_SPTs[MAX_N_OLD_SPTS]; +static nat n_old_SPTs = 0; + #ifdef THREADED_RTS Mutex stable_mutex; #endif @@ -205,21 +224,63 @@ static void enlargeStablePtrTable(void) { nat old_SPT_size = SPT_size; + spEntry *new_stable_ptr_table; // 2nd and subsequent times SPT_size *= 2; - stable_ptr_table = - stgReallocBytes(stable_ptr_table, - SPT_size * sizeof *stable_ptr_table, - "enlargeStablePtrTable"); + + /* We temporarily retain the old version instead of freeing it; see Note + * [Enlarging the stable pointer table]. + */ + new_stable_ptr_table = + stgMallocBytes(SPT_size * sizeof *stable_ptr_table, + "enlargeStablePtrTable"); + memcpy(new_stable_ptr_table, + stable_ptr_table, + old_SPT_size * sizeof *stable_ptr_table); + ASSERT(n_old_SPTs < MAX_N_OLD_SPTS); + old_SPTs[n_old_SPTs++] = stable_ptr_table; + + /* When using the threaded RTS, the update of stable_ptr_table is assumed to + * be atomic, so that another thread simultaneously dereferencing a stable + * pointer will always read a valid address. + */ + stable_ptr_table = new_stable_ptr_table; initSpEntryFreeList(stable_ptr_table + old_SPT_size, old_SPT_size, NULL); } +/* Note [Enlarging the stable pointer table] + * + * To enlarge the stable pointer table, we allocate a new table, copy the + * existing entries, and then store the old version of the table in old_SPTs + * until we free it during GC. By not immediately freeing the old version + * (or equivalently by not growing the table using realloc()), we ensure that + * another thread simultaneously dereferencing a stable pointer using the old + * version can safely access the table without causing a segfault (see Trac + * #10296). + * + * Note that because the stable pointer table is doubled in size each time it is + * enlarged, the total memory needed to store the old versions is always less + * than that required to hold the current version. + */ + + /* ----------------------------------------------------------------------------- * Freeing entries and tables * -------------------------------------------------------------------------- */ +static void +freeOldSPTs(void) +{ + nat i; + + for (i = 0; i < n_old_SPTs; i++) { + stgFree(old_SPTs[i]); + } + n_old_SPTs = 0; +} + void exitStableTables(void) { @@ -237,6 +298,8 @@ exitStableTables(void) stable_ptr_table = NULL; SPT_size = 0; + freeOldSPTs(); + #ifdef THREADED_RTS closeMutex(&stable_mutex); #endif @@ -425,6 +488,11 @@ rememberOldStableNameAddresses(void) void markStableTables(evac_fn evac, void *user) { + /* Since no other thread can currently be dereferencing a stable pointer, it + * is safe to free the old versions of the table. + */ + freeOldSPTs(); + markStablePtrTable(evac, user); rememberOldStableNameAddresses(); } diff --git a/testsuite/tests/rts/Makefile b/testsuite/tests/rts/Makefile index 02255a6..5533fc9 100644 --- a/testsuite/tests/rts/Makefile +++ b/testsuite/tests/rts/Makefile @@ -111,6 +111,12 @@ T7037: T7040_ghci_setup : '$(TEST_HC)' $(TEST_HC_OPTS) $(ghciWayFlags) -c T7040_ghci_c.c +.PHONY: T10296a +T10296a: + $(RM) T10296a_c.o T10296a.o T10296a.hi T10296a_stub.h + '$(TEST_HC)' $(TEST_HC_OPTS) -v0 -threaded T10296a.hs T10296a_c.c -o T10296a + ./T10296a +RTS -N2 + .PHONY: linker_unload linker_unload: $(RM) Test.o Test.hi diff --git a/testsuite/tests/rts/T10296a.hs b/testsuite/tests/rts/T10296a.hs new file mode 100644 index 0000000..136508f --- /dev/null +++ b/testsuite/tests/rts/T10296a.hs @@ -0,0 +1,33 @@ +-- A reduced version of the original test case + +{-# LANGUAGE ForeignFunctionInterface #-} + + +import Control.Concurrent +import Control.Monad +import Foreign.C.Types +import Foreign.Ptr + + +main :: IO () +main = do + mv <- newEmptyMVar + -- Fork a thread to continually dereference a stable pointer... + void $ forkIO $ f 1 1000000 >> putMVar mv () + -- ...while we keep enlarging the stable pointer table + f 65536 1 + void $ takeMVar mv + where + f nWraps nApplies = replicateM_ nWraps $ do + -- Each call to wrap creates a stable pointer + wrappedPlus <- wrap (+) + c_applyFun nApplies wrappedPlus 1 2 + + +type CIntFun = CInt -> CInt -> CInt + +foreign import ccall "wrapper" + wrap :: CIntFun -> IO (FunPtr CIntFun) + +foreign import ccall "apply_fun" + c_applyFun :: CInt -> FunPtr CIntFun -> CInt -> CInt -> IO CInt diff --git a/testsuite/tests/rts/T10296a_c.c b/testsuite/tests/rts/T10296a_c.c new file mode 100644 index 0000000..6103874 --- /dev/null +++ b/testsuite/tests/rts/T10296a_c.c @@ -0,0 +1,13 @@ +typedef int (* IntFun)(int a, int b); + +int apply_fun(int n, IntFun f, int a, int b) { + int s = 0; + int i; + + for (i = 0; i < n; i++) { + // Each call back into Haskell using f dereferences a stable pointer + s += f(a, b + i); + } + + return s; +} diff --git a/testsuite/tests/rts/T10296b.hs b/testsuite/tests/rts/T10296b.hs new file mode 100644 index 0000000..e5828df --- /dev/null +++ b/testsuite/tests/rts/T10296b.hs @@ -0,0 +1,19 @@ +-- A variant of the T10296a.hs test case in which +-- - the FFI machinery has been eliminated +-- - a primop (deRefStablePtr#) is used to dereference the stable pointer +-- - the stable pointers are explicitly freed at the end + + +import Control.Concurrent +import Control.Monad +import Foreign.StablePtr + + +main :: IO () +main = do + sp <- newStablePtr () + _ <- forkIO $ forever $ deRefStablePtr sp >> threadDelay 0 + sps <- replicateM 1048576 $ newStablePtr () + ---------------------------------------------------------- + mapM_ freeStablePtr sps + freeStablePtr sp diff --git a/testsuite/tests/rts/all.T b/testsuite/tests/rts/all.T index 951acbe..df64be4 100644 --- a/testsuite/tests/rts/all.T +++ b/testsuite/tests/rts/all.T @@ -335,3 +335,9 @@ test('T10904', [ omit_ways(['ghci']), extra_run_opts('20000') ], test('T10728', [extra_run_opts('+RTS -maxN3 -RTS'), req_smp], compile_and_run, ['-threaded']) + +test('T10296a', [extra_clean(['T10296a.o','T10296a_c.o','T10296a'])], + run_command, + ['$MAKE -s --no-print-directory T10296a']) + +test('T10296b', [only_ways('threaded2')], compile_and_run, ['']) From git at git.haskell.org Tue Apr 5 14:18:48 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 5 Apr 2016 14:18:48 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Fix misattribution of `-Wunused-local-binds` warnings (0c93bc3) Message-ID: <20160405141848.EA1213A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/0c93bc3bb824ea31c21c6c7bdead9aa781e154ba/ghc >--------------------------------------------------------------- commit 0c93bc3bb824ea31c21c6c7bdead9aa781e154ba Author: Herbert Valerio Riedel Date: Tue Apr 5 15:15:47 2016 +0200 Fix misattribution of `-Wunused-local-binds` warnings This fixes a bug where warnings actually controlled by - `Opt_WarnUnusedMatches` - `Opt_WarnUnusedTypePatterns` - `Opt_WarnUnusedTopBinds` were incorrectly reported as being controlled by `Opt_WarnUnusedLocalBinds` as well This bug was introduced in bb5afd3c274011c5ea302210b4c290ec1f83209c while implementing #10752 Test Plan: ./validate still running -- testsuite output wiggles expected Reviewers: barrucadu, quchen, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2077 (cherry picked from commit 003e0802fdc2b38b2c3e96cdd387619d33c44967) >--------------------------------------------------------------- 0c93bc3bb824ea31c21c6c7bdead9aa781e154ba compiler/rename/RnEnv.hs | 17 +++++++++-------- testsuite/tests/deSugar/should_compile/ds053.stderr | 2 +- testsuite/tests/driver/werror.stderr | 2 +- .../should_compile/UnusedTyVarWarnings.stderr | 8 ++++---- .../should_compile/UnusedTyVarWarningsNamedWCs.stderr | 8 ++++---- .../should_fail/overloadedrecfldsfail05.stderr | 2 +- .../should_fail/overloadedrecfldsfail06.stderr | 6 +++--- testsuite/tests/parser/should_compile/read014.stderr | 4 ++-- testsuite/tests/rename/should_compile/T17a.stderr | 2 +- testsuite/tests/rename/should_compile/T17d.stderr | 2 +- testsuite/tests/rename/should_compile/T17e.stderr | 2 +- testsuite/tests/rename/should_compile/T3371.stderr | 2 +- testsuite/tests/rename/should_compile/T3449.stderr | 2 +- testsuite/tests/rename/should_compile/T7145b.stderr | 2 +- testsuite/tests/rename/should_compile/mc10.stderr | 2 +- testsuite/tests/rename/should_compile/rn040.stderr | 4 ++-- testsuite/tests/rename/should_compile/rn041.stderr | 6 +++--- testsuite/tests/rename/should_compile/rn047.stderr | 2 +- testsuite/tests/typecheck/should_compile/T2497.stderr | 2 +- 19 files changed, 39 insertions(+), 38 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 0c93bc3bb824ea31c21c6c7bdead9aa781e154ba From git at git.haskell.org Wed Apr 6 09:26:34 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 6 Apr 2016 09:26:34 +0000 (UTC) Subject: [commit: ghc] wip/T11770: Demand Analyzer: Do not set OneShot information (second try) (bea5d1a) Message-ID: <20160406092634.3B3663A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T11770 Link : http://ghc.haskell.org/trac/ghc/changeset/bea5d1a2a2dcc27461b719a498cce094fbb94dae/ghc >--------------------------------------------------------------- commit bea5d1a2a2dcc27461b719a498cce094fbb94dae Author: Joachim Breitner Date: Fri Apr 1 13:11:18 2016 +0200 Demand Analyzer: Do not set OneShot information (second try) as suggested in ticket:11770#comment:1. This code was buggy (#11770), and the occurrence analyzer does the same job anyways. This also elaborates the notes in the occurrence analyzer accordingly. Previously, the worker/wrapper code would go through lengths to transfer the oneShot annotations from the original function to both the worker and the wrapper. We now simply transfer the demand on the worker, and let the subsequent occurrence analyzer push this onto the lambda binders. This also requires the occurrence analyzer to do this more reliably. Previously, it would not hand out OneShot annotatoins to things that would not `certainly_inline` (and it might not have mattered, as the Demand Analysis might have handed out the annotations). Now we hand out one-shot annotations unconditionally. Pushing this to a branch to see if the latest change fixes the performance problems. >--------------------------------------------------------------- bea5d1a2a2dcc27461b719a498cce094fbb94dae compiler/basicTypes/Demand.hs | 22 +++++++- compiler/simplCore/OccurAnal.hs | 42 ++++++++++----- compiler/specialise/SpecConstr.hs | 2 +- compiler/stranal/DmdAnal.hs | 55 ++----------------- compiler/stranal/WorkWrap.hs | 32 +++++------ compiler/stranal/WwLib.hs | 80 ++++++++-------------------- testsuite/tests/stranal/should_compile/all.T | 2 +- 7 files changed, 95 insertions(+), 140 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc bea5d1a2a2dcc27461b719a498cce094fbb94dae From git at git.haskell.org Wed Apr 6 12:50:49 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 6 Apr 2016 12:50:49 +0000 (UTC) Subject: [commit: ghc] wip/cse-code-desmelling: CSE code cleanup and improvement (1e80a59) Message-ID: <20160406125049.294153A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/cse-code-desmelling Link : http://ghc.haskell.org/trac/ghc/changeset/1e80a5947a652a22a62a0d4d485104a59d0a69b0/ghc >--------------------------------------------------------------- commit 1e80a5947a652a22a62a0d4d485104a59d0a69b0 Author: Simon Peyton Jones Date: Fri Apr 1 12:24:50 2016 +0200 CSE code cleanup and improvement Triggered by an observation by Joachim, Simon felt the urge to clean up the CSE code a bit. This is the result. (Code by Simon, commit message and other leg-work by Joachim) Differential Revision: https://phabricator.haskell.org/D2074 >--------------------------------------------------------------- 1e80a5947a652a22a62a0d4d485104a59d0a69b0 compiler/simplCore/CSE.hs | 301 +++++++++++++-------- .../tests/numeric/should_compile/T7116.stdout | 16 +- testsuite/tests/perf/compiler/all.T | 9 +- 3 files changed, 207 insertions(+), 119 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 1e80a5947a652a22a62a0d4d485104a59d0a69b0 From git at git.haskell.org Wed Apr 6 13:22:21 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 6 Apr 2016 13:22:21 +0000 (UTC) Subject: [commit: ghc] wip/T11770: Demand Analyzer: Do not set OneShot information (second try) (8a377c8) Message-ID: <20160406132221.13B0F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T11770 Link : http://ghc.haskell.org/trac/ghc/changeset/8a377c82eebd3d64ae0cd443cc35a00f323ebe08/ghc >--------------------------------------------------------------- commit 8a377c82eebd3d64ae0cd443cc35a00f323ebe08 Author: Joachim Breitner Date: Fri Apr 1 13:11:18 2016 +0200 Demand Analyzer: Do not set OneShot information (second try) as suggested in ticket:11770#comment:1. This code was buggy (#11770), and the occurrence analyzer does the same job anyways. This also elaborates the notes in the occurrence analyzer accordingly. Previously, the worker/wrapper code would go through lengths to transfer the oneShot annotations from the original function to both the worker and the wrapper. We now simply transfer the demand on the worker, and let the subsequent occurrence analyzer push this onto the lambda binders. This also requires the occurrence analyzer to do this more reliably. Previously, it would not hand out OneShot annotatoins to things that would not `certainly_inline` (and it might not have mattered, as the Demand Analysis might have handed out the annotations). Now we hand out one-shot annotations unconditionally. Differential Revision: https://phabricator.haskell.org/D2085 >--------------------------------------------------------------- 8a377c82eebd3d64ae0cd443cc35a00f323ebe08 compiler/basicTypes/Demand.hs | 24 ++++++++- compiler/simplCore/OccurAnal.hs | 42 +++++++++++----- compiler/specialise/SpecConstr.hs | 2 +- compiler/stranal/DmdAnal.hs | 55 ++------------------ compiler/stranal/WorkWrap.hs | 45 +++++++++++------ compiler/stranal/WwLib.hs | 75 +++++++--------------------- testsuite/tests/stranal/should_compile/all.T | 2 +- 7 files changed, 107 insertions(+), 138 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 8a377c82eebd3d64ae0cd443cc35a00f323ebe08 From git at git.haskell.org Wed Apr 6 13:22:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 6 Apr 2016 13:22:23 +0000 (UTC) Subject: [commit: ghc] wip/T11770's head updated: Demand Analyzer: Do not set OneShot information (second try) (8a377c8) Message-ID: <20160406132223.2C3933A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/T11770' now includes: 3806891 Make the example for -M work 72bd7f7 Improve printing of pattern synonym types f2a2b79 Deeply instantiate in :type 90d7d60 rts: Make StablePtr derefs thread-safe (#10296) b3ecd04 Elaborate test for #11376 9b6820c Bump binary submodule 7407a66 Don't infer CallStacks 2f3b803 Use exprCtOrigin in tcRnExpr 1e6ec12 Fix misattribution of `-Wunused-local-binds` warnings 8a377c8 Demand Analyzer: Do not set OneShot information (second try) From git at git.haskell.org Wed Apr 6 13:54:00 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 6 Apr 2016 13:54:00 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Deeply instantiate in :type (992e675) Message-ID: <20160406135400.53F703A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/992e675261be7d9eec75114de965e09aa3035929/ghc >--------------------------------------------------------------- commit 992e675261be7d9eec75114de965e09aa3035929 Author: Simon Peyton Jones Date: Mon Apr 4 10:18:43 2016 +0100 Deeply instantiate in :type See Trac #11376 and Note [Deeply instantiate in :type] in TcRnDriver Sadly this showed up one new problem (Trac #11786) and one opportunity (Trac #11787), so test T11549 is now marked expect-broken on these two. (cherry picked from commit f2a2b79fa8d1c702b17e195a70734b06625e0153) >--------------------------------------------------------------- 992e675261be7d9eec75114de965e09aa3035929 compiler/typecheck/TcRnDriver.hs | 31 +++++++++++++++++++++---- testsuite/tests/dependent/ghci/T11549.script | 8 +++---- testsuite/tests/dependent/ghci/all.T | 3 ++- testsuite/tests/ghci/scripts/T11376.script | 6 +++++ testsuite/tests/ghci/scripts/T11376.stdout | 2 ++ testsuite/tests/ghci/scripts/TypeAppData.stdout | 28 +++++++++++----------- testsuite/tests/ghci/scripts/all.T | 3 +++ 7 files changed, 58 insertions(+), 23 deletions(-) diff --git a/compiler/typecheck/TcRnDriver.hs b/compiler/typecheck/TcRnDriver.hs index 550f84f..640d74d 100644 --- a/compiler/typecheck/TcRnDriver.hs +++ b/compiler/typecheck/TcRnDriver.hs @@ -33,6 +33,7 @@ import RnSplice ( rnTopSpliceDecls, traceSplice, SpliceInfo(..) ) import IfaceEnv( externaliseName ) import TcHsType import TcMatches +import Inst( deeplyInstantiate ) import RnTypes import RnExpr import MkId @@ -1977,9 +1978,16 @@ tcRnExpr hsc_env rdr_expr -- Now typecheck the expression, and generalise its type -- it might have a rank-2 type (e.g. :t runST) uniq <- newUnique ; - let { fresh_it = itName uniq (getLoc rdr_expr) } ; - (tclvl, lie, (_tc_expr, res_ty)) <- pushLevelAndCaptureConstraints $ - tcInferSigma rn_expr ; + let { fresh_it = itName uniq (getLoc rdr_expr) + ; orig = OccurrenceOf fresh_it } ; -- Not a very satisfactory origin + (tclvl, lie, res_ty) + <- pushLevelAndCaptureConstraints $ + do { (_tc_expr, expr_ty) <- tcInferSigma rn_expr + ; (_wrap, res_ty) <- deeplyInstantiate orig expr_ty + -- See [Note Deeply instantiate in :type] + ; return res_ty } ; + + -- Generalise ((qtvs, dicts, _), lie_top) <- captureConstraints $ {-# SCC "simplifyInfer" #-} simplifyInfer tclvl @@ -2055,7 +2063,22 @@ tcRnType hsc_env normalise rdr_type ; return (ty', mkInvForAllTys kvs (typeKind ty')) } -{- Note [Kind-generalise in tcRnType] +{- Note [Deeply instantiate in :type] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Suppose (Trac #11376) + bar :: forall a b. Show a => a -> b -> a +What should `:t bar @Int` show? + + 1. forall b. Show Int => Int -> b -> Int + 2. forall b. Int -> b -> Int + 3. forall {b}. Int -> b -> Int + 4. Int -> b -> Int + +We choose (3), which is the effect of deeply instantiating and +re-generalising. All the others seem deeply confusing. That is +why we deeply instantiate here. + +Note [Kind-generalise in tcRnType] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ We switch on PolyKinds when kind-checking a user type, so that we will kind-generalise the type, even when PolyKinds is not otherwise on. diff --git a/testsuite/tests/dependent/ghci/T11549.script b/testsuite/tests/dependent/ghci/T11549.script index 5f8c500..bb35589 100644 --- a/testsuite/tests/dependent/ghci/T11549.script +++ b/testsuite/tests/dependent/ghci/T11549.script @@ -3,12 +3,12 @@ import GHC.Exts putStrLn "-fno-print-explicit-runtime-reps" :set -fno-print-explicit-runtime-reps -:ty ($) +:info ($) :kind TYPE -:ty error +:info error putStrLn "\n-fprint-explicit-runtime-reps" :set -fprint-explicit-runtime-reps -:ty ($) +:info ($) :kind TYPE -:ty error +:info error diff --git a/testsuite/tests/dependent/ghci/all.T b/testsuite/tests/dependent/ghci/all.T index 6d9332a..956272f 100644 --- a/testsuite/tests/dependent/ghci/all.T +++ b/testsuite/tests/dependent/ghci/all.T @@ -1,3 +1,4 @@ test('T11549', - normal, + [ expect_broken( 11787 ), + expect_broken( 11786 ) ], ghci_script, ['T11549.script']) diff --git a/testsuite/tests/ghci/scripts/T11376.script b/testsuite/tests/ghci/scripts/T11376.script new file mode 100644 index 0000000..780db3c --- /dev/null +++ b/testsuite/tests/ghci/scripts/T11376.script @@ -0,0 +1,6 @@ +:set -XTypeApplications +let { bar :: Show a => a -> b -> a; bar = error "urk" } +:type bar @Int +:set -fprint-explicit-foralls +:type bar @Int + diff --git a/testsuite/tests/ghci/scripts/T11376.stdout b/testsuite/tests/ghci/scripts/T11376.stdout new file mode 100644 index 0000000..0b0b959 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T11376.stdout @@ -0,0 +1,2 @@ +bar @Int :: Int -> b -> Int +bar @Int :: forall {b}. Int -> b -> Int diff --git a/testsuite/tests/ghci/scripts/TypeAppData.stdout b/testsuite/tests/ghci/scripts/TypeAppData.stdout index 5a4880a..0fd5506 100644 --- a/testsuite/tests/ghci/scripts/TypeAppData.stdout +++ b/testsuite/tests/ghci/scripts/TypeAppData.stdout @@ -1,14 +1,14 @@ -P1 :: forall {k} (a :: k). P1 a -P2 :: forall k (a :: k). P2 a -P3 :: forall k (a :: k). P3 k a -P4 :: forall {k} (a :: k). P1 a -> P4 a -P5 :: forall {k} (a :: k). P1 a -> P5 -P6 :: forall k (a :: k). P1 a -> P6 -P7 :: forall {k} (a :: k). P1 a -P8 :: forall {k} (a :: k). P1 a -P9 :: forall k (a :: k). P1 a -P10 :: forall k (a :: k). P1 a -P11 :: forall {k} (a :: k). P1 a -> P5 -P12 :: forall {k} (a :: k). P1 a -> P5 -P13 :: forall k (a :: k). P1 a -> P5 -P14 :: forall k (a :: k). P1 a -> P5 +P1 :: forall {k} {a :: k}. P1 a +P2 :: forall {k} {a :: k}. P2 a +P3 :: forall {k} {a :: k}. P3 k a +P4 :: forall {k} {a :: k}. P1 a -> P4 a +P5 :: forall {k} {a :: k}. P1 a -> P5 +P6 :: forall {k} {a :: k}. P1 a -> P6 +P7 :: forall {k} {a :: k}. P1 a +P8 :: forall {k} {a :: k}. P1 a +P9 :: forall {k} {a :: k}. P1 a +P10 :: forall {k} {a :: k}. P1 a +P11 :: forall {k} {a :: k}. P1 a -> P5 +P12 :: forall {k} {a :: k}. P1 a -> P5 +P13 :: forall {k} {a :: k}. P1 a -> P5 +P14 :: forall {k} {a :: k}. P1 a -> P5 diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T index 868a8e3..47a775b 100755 --- a/testsuite/tests/ghci/scripts/all.T +++ b/testsuite/tests/ghci/scripts/all.T @@ -4,10 +4,12 @@ test('ghci001', combined_output, ghci_script, ['ghci001.script']) test('ghci002', combined_output, ghci_script, ['ghci002.script']) test('ghci003', combined_output, ghci_script, ['ghci003.script']) test('ghci004', [ combined_output, + when(arch('powerpc64'), expect_broken_for(11259,['ghci-ext'])), unless(opsys('mingw32'),extra_ways(['ghci-ext'])) ], ghci_script, ['ghci004.script']) test('ghci005', combined_output, ghci_script, ['ghci005.script']) test('ghci006', [ combined_output, + when(arch('powerpc64'), expect_broken_for(11259,['ghci-ext'])), unless(opsys('mingw32'),extra_ways(['ghci-ext'])) ], ghci_script, ['ghci006.script']) test('ghci007', combined_output, ghci_script, ['ghci007.script']) @@ -245,3 +247,4 @@ test('T11389', req_interp, run_command, ['$MAKE -s --no-print-directory T11389'] test('T11524a', normal, ghci_script, ['T11524a.script']) test('T11456', normal, ghci_script, ['T11456.script']) test('TypeAppData', normal, ghci_script, ['TypeAppData.script']) +test('T11376', normal, ghci_script, ['T11376.script']) From git at git.haskell.org Wed Apr 6 13:54:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 6 Apr 2016 13:54:03 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Skip TEST=TcCoercibleFail when compiler_debugged (7b18551) Message-ID: <20160406135403.0D9E93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/7b185518cc68da12abb803fe7993f6f08f686dda/ghc >--------------------------------------------------------------- commit 7b185518cc68da12abb803fe7993f6f08f686dda Author: Thomas Miedema Date: Mon Feb 29 13:59:48 2016 +0100 Skip TEST=TcCoercibleFail when compiler_debugged (cherry picked from commit 49c55e68aae9841c166430ae566b0d9bdc03c99d) >--------------------------------------------------------------- 7b185518cc68da12abb803fe7993f6f08f686dda testsuite/tests/typecheck/should_fail/all.T | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index dd0c427..f2b5331 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -327,9 +327,13 @@ test('T7989', normal, compile_fail, ['']) test('T8034', normal, compile_fail, ['']) test('T8142', normal, compile_fail, ['']) test('T8262', normal, compile_fail, ['']) -test('TcCoercibleFail', when(compiler_lt('ghc', '7.7'), skip), compile_fail, ['']) -test('TcCoercibleFail2', when(compiler_lt('ghc', '7.7'), skip), compile_fail, ['']) -test('TcCoercibleFail3', when(compiler_lt('ghc', '7.7'), skip), compile_fail, ['']) + +# TcCoercibleFail times out with the compiler is compiled with -DDEBUG. +# This is expected (see comment in source file). +test('TcCoercibleFail', [when(compiler_debugged(), skip)], compile_fail, ['']) + +test('TcCoercibleFail2', [], compile_fail, ['']) +test('TcCoercibleFail3', [], compile_fail, ['']) test('T8306', normal, compile_fail, ['']) test('T8392a', normal, compile_fail, ['']) test('T8428', normal, compile_fail, ['']) From git at git.haskell.org Wed Apr 6 14:37:29 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 6 Apr 2016 14:37:29 +0000 (UTC) Subject: [commit: ghc] wip/rae: Increase InScopeSet in mkCastTy (8719a1f) Message-ID: <20160406143729.DDF3F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rae Link : http://ghc.haskell.org/trac/ghc/changeset/8719a1fe015c241890f3f3ba1431805f1f4193d7/ghc >--------------------------------------------------------------- commit 8719a1fe015c241890f3f3ba1431805f1f4193d7 Author: Richard Eisenberg Date: Wed Apr 6 15:24:34 2016 +0200 Increase InScopeSet in mkCastTy Unfortunately, I was unable to make a small test case that tickled the bug. But it was clearly wrong the way it was. >--------------------------------------------------------------- 8719a1fe015c241890f3f3ba1431805f1f4193d7 compiler/types/Type.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/types/Type.hs b/compiler/types/Type.hs index c5561a3..8901968 100644 --- a/compiler/types/Type.hs +++ b/compiler/types/Type.hs @@ -1084,9 +1084,9 @@ mkCastTy ty co | isReflexiveCo co = ty mkCastTy (CastTy ty co1) co2 = mkCastTy ty (co1 `mkTransCo` co2) -- See Note [Weird typing rule for ForAllTy] -mkCastTy (ForAllTy (Named tv vis) inner_ty) co +mkCastTy outer_ty@(ForAllTy (Named tv vis) inner_ty) co = -- have to make sure that pushing the co in doesn't capture the bound var - let fvs = tyCoVarsOfCo co + let fvs = tyCoVarsOfCo co `unionVarSet` tyCoVarsOfType outer_ty empty_subst = mkEmptyTCvSubst (mkInScopeSet fvs) (subst, tv') = substTyVarBndr empty_subst tv in From git at git.haskell.org Wed Apr 6 14:37:32 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 6 Apr 2016 14:37:32 +0000 (UTC) Subject: [commit: ghc] wip/rae: Fix #11797. (533ff9c) Message-ID: <20160406143732.86D0E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rae Link : http://ghc.haskell.org/trac/ghc/changeset/533ff9c52d1e122ab6e86ad8cd344ecc1a43dae3/ghc >--------------------------------------------------------------- commit 533ff9c52d1e122ab6e86ad8cd344ecc1a43dae3 Author: Richard Eisenberg Date: Wed Apr 6 16:37:22 2016 +0200 Fix #11797. DsMeta curiously omitted quantified tyvars in certain circumstances. This patch means it doesn't. >--------------------------------------------------------------- 533ff9c52d1e122ab6e86ad8cd344ecc1a43dae3 compiler/deSugar/DsMeta.hs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/compiler/deSugar/DsMeta.hs b/compiler/deSugar/DsMeta.hs index 84f1a9c..3bc4ae9 100644 --- a/compiler/deSugar/DsMeta.hs +++ b/compiler/deSugar/DsMeta.hs @@ -872,12 +872,9 @@ repContext ctxt = do preds <- repList typeQTyConName repLTy ctxt repCtxt preds repHsSigType :: LHsSigType Name -> DsM (Core TH.TypeQ) -repHsSigType ty = repLTy (hsSigType ty) - -repHsSigWcType :: LHsSigWcType Name -> DsM (Core TH.TypeQ) -repHsSigWcType (HsIB { hsib_vars = vars - , hsib_body = sig1 }) - | (explicit_tvs, ctxt, ty) <- splitLHsSigmaTy (hswc_body sig1) +repHsSigType (HsIB { hsib_vars = vars + , hsib_body = body }) + | (explicit_tvs, ctxt, ty) <- splitLHsSigmaTy body = addTyVarBinds (HsQTvs { hsq_implicit = [] , hsq_explicit = map (noLoc . UserTyVar . noLoc) vars ++ explicit_tvs @@ -889,6 +886,10 @@ repHsSigWcType (HsIB { hsib_vars = vars then return th_ty else repTForall th_tvs th_ctxt th_ty } +repHsSigWcType :: LHsSigWcType Name -> DsM (Core TH.TypeQ) +repHsSigWcType ib_ty@(HsIB { hsib_body = sig1 }) + = repHsSigType (ib_ty { hsib_body = hswc_body sig1 }) + -- yield the representation of a list of types -- repLTys :: [LHsType Name] -> DsM [Core TH.TypeQ] From git at git.haskell.org Wed Apr 6 14:37:34 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 6 Apr 2016 14:37:34 +0000 (UTC) Subject: [commit: ghc] wip/rae's head updated: Fix #11797. (533ff9c) Message-ID: <20160406143734.E41343A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/rae' now includes: 4e98b4f DynFlags: Initialize unsafeGlobalDynFlags enough to be useful e8d3567 Panic: Try outputting SDocs d0787a2 testsuite: Identify framework failures in testsuite summary 1b4d120 DWARF: Add debugging information chapter to users guide 882179d RTS: Fix & refactor "portable inline" macros 4da8e73 Fix #11754 by adding an additional check. 12a76be Check for rep poly on wildcard binders. 9f73e46 Clarify Note [Kind coercions in Unify] 06cd26b Remove now obsolete LD_STAGE0 hack c7b32ad Remove now pointless INLINE_ME macro 61df7f8 Fix AIX/ppc codegen in `-prof` compilation mode 0bca3f3 Scrap IRIX support f911358 Scrap DEC OSF/1 support ffc802e Drop Xcode 4.1 hack and fix ignored CC var issue afc48f8 Autoconf: detect and set CFLAGS/CPPFLAGS needed for C99 mode 49b9d80 Do not test for existence of the executable eb25381 Update bytestring submodule to latest snapshot cd3fbff Remove obsolete --with-hc flag from ./configure 91b96e1 fix compilation failure on Solaris 11 a658ad9 Reenable external-json linters 0f0c138 base: Document caveats about Control.Concurrent.Chan 415b706 users-guide: Provide more depth in table-of-contents eb8bc4d users-guide: Wibbles aa61174 users-guide: Add references to various issues in bugs section 7393532 Use a correct substitution in tcInstType a49228e Build correct substitution in instDFunType 4a93e4f Use the correct substitution in lintCoercion 5097f38 Add Data.Functor.Classes instances for Proxy (trac issue #11756) b0ab8db base: Add comment noting import loop be2a7ba cleanup POSIX/XOPEN defines for switch to C99 85e6997 Remove all mentions of IND_OLDGEN outside of docs/rts 30b9061 Be more explicit about closure types in ticky-ticky-report 38c7714 Ticky: Do not count every entry twice 8af1d08 Typo in Note name 80d4fdf SpecConstr: Transport strictness data to specialization?s argument?s binders e6e17a0 Rename isNopSig to isTopSig c8138c8 Do not print DmdType in Core output cf768ec Tes suite output updates d5d6804 rename: Disallow type signatures in patterns in plain Haskell ae6a56e users-guide/rel-notes: Note broken-ness of ImpredicativeTypes eb6b709 base: Fix haddock typo cb9a1e6 Add testcase for #11770 a76e6f5 Typos in non-code 1757dd8 Don't recompute some free vars in lintCoercion 3d245bf Do not claim that -O2 does not do better than -O 973633a Comments only in Unify.hs 7aa4c52 rts/posix/Itimer.c: Handle EINTR when reading timerfd d1179c4 ghc-prim: Delay inlining of {gt,ge,lt,le}Int to phase 1 c0e3e63 Defer inlining of Ord methods 58bbb40 ghc-prim: Mark unpackCStringUtf8# and unpackNBytes# as NOINLINE e9c2555 Don't require -hide-all-packages for MIN_VERSION_* macros bc953fc Add -f(no-)version-macro to explicitly control macros. 24d7615 Kill the magic of Any 8f66bac Comments only 1f68da1 Minor refactoring in mkExport 2e5e822 Comments only bdd9042 Refactor in TcMatches 174d3a5 Small refactor of TcMType.tauifyExpType 0ad2021 Make SigSkol take TcType not ExpType 9fc65bb Refactor error generation for pattern synonyms 28fe0ee Demand Analyzer: Do not set OneShot information da260a5 Revert accidental change to collectTyAndValBinders 6ea42c7 Revert "Demand Analyzer: Do not set OneShot information" 3806891 Make the example for -M work 72bd7f7 Improve printing of pattern synonym types f2a2b79 Deeply instantiate in :type 90d7d60 rts: Make StablePtr derefs thread-safe (#10296) b3ecd04 Elaborate test for #11376 9b6820c Bump binary submodule 7407a66 Don't infer CallStacks 2f3b803 Use exprCtOrigin in tcRnExpr 1e6ec12 Fix misattribution of `-Wunused-local-binds` warnings 8719a1f Increase InScopeSet in mkCastTy 533ff9c Fix #11797. From git at git.haskell.org Wed Apr 6 16:18:11 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 6 Apr 2016 16:18:11 +0000 (UTC) Subject: [commit: ghc] wip/T11770: Demand Analyzer: Do not set OneShot information (second try) (6a3b74c) Message-ID: <20160406161811.4AABC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T11770 Link : http://ghc.haskell.org/trac/ghc/changeset/6a3b74cbe96f4bcd28c05648321ed979e9eb21e4/ghc >--------------------------------------------------------------- commit 6a3b74cbe96f4bcd28c05648321ed979e9eb21e4 Author: Joachim Breitner Date: Fri Apr 1 13:11:18 2016 +0200 Demand Analyzer: Do not set OneShot information (second try) as suggested in ticket:11770#comment:1. This code was buggy (#11770), and the occurrence analyzer does the same job anyways. This also elaborates the notes in the occurrence analyzer accordingly. Previously, the worker/wrapper code would go through lengths to transfer the oneShot annotations from the original function to both the worker and the wrapper. We now simply transfer the demand on the worker, and let the subsequent occurrence analyzer push this onto the lambda binders. This also requires the occurrence analyzer to do this more reliably. Previously, it would not hand out OneShot annotatoins to things that would not `certainly_inline` (and it might not have mattered, as the Demand Analysis might have handed out the annotations). Now we hand out one-shot annotations unconditionally. Differential Revision: https://phabricator.haskell.org/D2085 >--------------------------------------------------------------- 6a3b74cbe96f4bcd28c05648321ed979e9eb21e4 compiler/basicTypes/Demand.hs | 24 ++++++++- compiler/simplCore/OccurAnal.hs | 42 +++++++++++----- compiler/specialise/SpecConstr.hs | 2 +- compiler/stranal/DmdAnal.hs | 55 ++------------------- compiler/stranal/WorkWrap.hs | 60 ++++++++++++++++------ compiler/stranal/WwLib.hs | 74 +++++++--------------------- testsuite/tests/stranal/should_compile/all.T | 2 +- 7 files changed, 121 insertions(+), 138 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 6a3b74cbe96f4bcd28c05648321ed979e9eb21e4 From git at git.haskell.org Wed Apr 6 19:32:22 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 6 Apr 2016 19:32:22 +0000 (UTC) Subject: [commit: ghc] master: T10870: Skip on 32-bit architectures (726cbc2) Message-ID: <20160406193222.B253B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/726cbc20018fea1da7d0bbfd26272ca06407fab9/ghc >--------------------------------------------------------------- commit 726cbc20018fea1da7d0bbfd26272ca06407fab9 Author: Ben Gamari Date: Wed Apr 6 17:12:45 2016 +0200 T10870: Skip on 32-bit architectures Shifts by amounts greater-than-or-equal-to the word size are undefined. >--------------------------------------------------------------- 726cbc20018fea1da7d0bbfd26272ca06407fab9 testsuite/tests/codeGen/should_run/all.T | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/tests/codeGen/should_run/all.T b/testsuite/tests/codeGen/should_run/all.T index 0dca7ad..c913951 100644 --- a/testsuite/tests/codeGen/should_run/all.T +++ b/testsuite/tests/codeGen/should_run/all.T @@ -137,6 +137,6 @@ test('T10414', [only_ways(['threaded2']), extra_ways(['threaded2']), req_smp], compile_and_run, ['-feager-blackholing']) test('T10521', normal, compile_and_run, ['']) test('T10521b', normal, compile_and_run, ['']) -test('T10870', normal, compile_and_run, ['']) +test('T10870', when(wordsize(32), skip), compile_and_run, ['']) test('PopCnt', omit_ways(['ghci']), multi_compile_and_run, ['PopCnt', [('PopCnt_cmm.cmm', '')], '']) From git at git.haskell.org Wed Apr 6 19:32:25 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 6 Apr 2016 19:32:25 +0000 (UTC) Subject: [commit: ghc] master: T10272, T4340: Add 32-bit output (351f976) Message-ID: <20160406193225.72B0E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/351f976ec5db465e61b094ed281776a9a7591d2e/ghc >--------------------------------------------------------------- commit 351f976ec5db465e61b094ed281776a9a7591d2e Author: Ben Gamari Date: Wed Apr 6 16:51:56 2016 +0200 T10272, T4340: Add 32-bit output >--------------------------------------------------------------- 351f976ec5db465e61b094ed281776a9a7591d2e testsuite/tests/{boxy/T2193.stdout => hsc2hs/T10272.stdout-ws-32} | 0 testsuite/tests/hsc2hs/{T10272.stdout => T10272.stdout-ws-64} | 0 testsuite/tests/{boxy/T2193.stdout => hsc2hs/T4340.stdout-ws-32} | 0 testsuite/tests/hsc2hs/{T4340.stdout => T4340.stdout-ws-64} | 0 4 files changed, 0 insertions(+), 0 deletions(-) diff --git a/testsuite/tests/boxy/T2193.stdout b/testsuite/tests/hsc2hs/T10272.stdout-ws-32 similarity index 100% copy from testsuite/tests/boxy/T2193.stdout copy to testsuite/tests/hsc2hs/T10272.stdout-ws-32 diff --git a/testsuite/tests/hsc2hs/T10272.stdout b/testsuite/tests/hsc2hs/T10272.stdout-ws-64 similarity index 100% rename from testsuite/tests/hsc2hs/T10272.stdout rename to testsuite/tests/hsc2hs/T10272.stdout-ws-64 diff --git a/testsuite/tests/boxy/T2193.stdout b/testsuite/tests/hsc2hs/T4340.stdout-ws-32 similarity index 100% copy from testsuite/tests/boxy/T2193.stdout copy to testsuite/tests/hsc2hs/T4340.stdout-ws-32 diff --git a/testsuite/tests/hsc2hs/T4340.stdout b/testsuite/tests/hsc2hs/T4340.stdout-ws-64 similarity index 100% rename from testsuite/tests/hsc2hs/T4340.stdout rename to testsuite/tests/hsc2hs/T4340.stdout-ws-64 From git at git.haskell.org Wed Apr 6 19:32:28 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 6 Apr 2016 19:32:28 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Update 32-bit performance numbers (1a8d61c) Message-ID: <20160406193228.377413A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1a8d61ca1a54820d2bc30c6a964312faf76d0635/ghc >--------------------------------------------------------------- commit 1a8d61ca1a54820d2bc30c6a964312faf76d0635 Author: Ben Gamari Date: Wed Apr 6 18:27:52 2016 +0200 testsuite: Update 32-bit performance numbers It's been quite a while since this has happened for some of our tests. >--------------------------------------------------------------- 1a8d61ca1a54820d2bc30c6a964312faf76d0635 testsuite/tests/perf/compiler/all.T | 125 ++++++++++++++++++++------------- testsuite/tests/perf/haddock/all.T | 11 +-- testsuite/tests/perf/should_run/all.T | 14 ++-- testsuite/tests/perf/space_leaks/all.T | 3 +- 4 files changed, 92 insertions(+), 61 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 1a8d61ca1a54820d2bc30c6a964312faf76d0635 From git at git.haskell.org Wed Apr 6 19:34:40 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 6 Apr 2016 19:34:40 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: T10272, T4340: Add 32-bit output (b9f26ca) Message-ID: <20160406193440.3EC483A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/b9f26cab03e8ece93fc37827e66bd4d3372dcd3b/ghc >--------------------------------------------------------------- commit b9f26cab03e8ece93fc37827e66bd4d3372dcd3b Author: Ben Gamari Date: Wed Apr 6 16:51:56 2016 +0200 T10272, T4340: Add 32-bit output >--------------------------------------------------------------- b9f26cab03e8ece93fc37827e66bd4d3372dcd3b testsuite/tests/{boxy/T2193.stdout => hsc2hs/T10272.stdout-ws-32} | 0 testsuite/tests/hsc2hs/{T10272.stdout => T10272.stdout-ws-64} | 0 testsuite/tests/{boxy/T2193.stdout => hsc2hs/T4340.stdout-ws-32} | 0 testsuite/tests/hsc2hs/{T4340.stdout => T4340.stdout-ws-64} | 0 4 files changed, 0 insertions(+), 0 deletions(-) diff --git a/testsuite/tests/boxy/T2193.stdout b/testsuite/tests/hsc2hs/T10272.stdout-ws-32 similarity index 100% copy from testsuite/tests/boxy/T2193.stdout copy to testsuite/tests/hsc2hs/T10272.stdout-ws-32 diff --git a/testsuite/tests/hsc2hs/T10272.stdout b/testsuite/tests/hsc2hs/T10272.stdout-ws-64 similarity index 100% rename from testsuite/tests/hsc2hs/T10272.stdout rename to testsuite/tests/hsc2hs/T10272.stdout-ws-64 diff --git a/testsuite/tests/boxy/T2193.stdout b/testsuite/tests/hsc2hs/T4340.stdout-ws-32 similarity index 100% copy from testsuite/tests/boxy/T2193.stdout copy to testsuite/tests/hsc2hs/T4340.stdout-ws-32 diff --git a/testsuite/tests/hsc2hs/T4340.stdout b/testsuite/tests/hsc2hs/T4340.stdout-ws-64 similarity index 100% rename from testsuite/tests/hsc2hs/T4340.stdout rename to testsuite/tests/hsc2hs/T4340.stdout-ws-64 From git at git.haskell.org Wed Apr 6 19:34:42 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 6 Apr 2016 19:34:42 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: T10870: Skip on 32-bit architectures (2aadf81) Message-ID: <20160406193442.E55753A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/2aadf813f4b23a91e3da8e66b2ebb0adb033b6bb/ghc >--------------------------------------------------------------- commit 2aadf813f4b23a91e3da8e66b2ebb0adb033b6bb Author: Ben Gamari Date: Wed Apr 6 17:12:45 2016 +0200 T10870: Skip on 32-bit architectures Shifts by amounts greater-than-or-equal-to the word size are undefined. >--------------------------------------------------------------- 2aadf813f4b23a91e3da8e66b2ebb0adb033b6bb testsuite/tests/codeGen/should_run/all.T | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/tests/codeGen/should_run/all.T b/testsuite/tests/codeGen/should_run/all.T index 0574d01..a390a70 100644 --- a/testsuite/tests/codeGen/should_run/all.T +++ b/testsuite/tests/codeGen/should_run/all.T @@ -140,6 +140,6 @@ test('T10414', [only_ways(['threaded2']), extra_ways(['threaded2']), req_smp], compile_and_run, ['-feager-blackholing']) test('T10521', normal, compile_and_run, ['']) test('T10521b', normal, compile_and_run, ['']) -test('T10870', normal, compile_and_run, ['']) +test('T10870', when(wordsize(32), skip), compile_and_run, ['']) test('PopCnt', omit_ways(['ghci']), multi_compile_and_run, ['PopCnt', [('PopCnt_cmm.cmm', '')], '']) \ No newline at end of file From git at git.haskell.org Wed Apr 6 19:34:45 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 6 Apr 2016 19:34:45 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: testsuite: Update 32-bit performance numbers (fbc147e) Message-ID: <20160406193445.983BD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/fbc147ee0dfe2508d32f60b717170fe901884348/ghc >--------------------------------------------------------------- commit fbc147ee0dfe2508d32f60b717170fe901884348 Author: Ben Gamari Date: Wed Apr 6 18:27:52 2016 +0200 testsuite: Update 32-bit performance numbers It's been quite a while since this has happened for some of our tests. >--------------------------------------------------------------- fbc147ee0dfe2508d32f60b717170fe901884348 testsuite/tests/perf/compiler/all.T | 125 ++++++++++++++++++++------------- testsuite/tests/perf/haddock/all.T | 11 +-- testsuite/tests/perf/should_run/all.T | 14 ++-- testsuite/tests/perf/space_leaks/all.T | 3 +- 4 files changed, 92 insertions(+), 61 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc fbc147ee0dfe2508d32f60b717170fe901884348 From git at git.haskell.org Wed Apr 6 19:34:48 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 6 Apr 2016 19:34:48 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: testsuite: One more 32-bit performance slip (6d36d8e) Message-ID: <20160406193448.5AD983A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/6d36d8e19a7e9cf3d8e715b1820cb656e937e809/ghc >--------------------------------------------------------------- commit 6d36d8e19a7e9cf3d8e715b1820cb656e937e809 Author: Ben Gamari Date: Wed Apr 6 21:36:52 2016 +0200 testsuite: One more 32-bit performance slip >--------------------------------------------------------------- 6d36d8e19a7e9cf3d8e715b1820cb656e937e809 testsuite/tests/perf/compiler/all.T | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index 5a4175d..a2c1e72 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -727,13 +727,14 @@ test('T9872c', test('T9872d', [ only_ways(['normal']), compiler_stats_num_field('bytes allocated', - [(wordsize(64), 506691240, 5), + [(wordsize(64), 533359408, 5), # 2014-12-18 796071864 Initally created # 2014-12-18 739189056 Reduce type families even more eagerly # 2015-01-07 687562440 TrieMap leaf compression # 2015-03-17 726679784 tweak to solver; probably flattens more # 2016-02-08 534693648 Improved a bit by tyConRolesRepresentational # 2016-03-18 506691240 optimize Unify & zonking + # 2016-04-06 533359408 apparent regression (x86-64/Windows) (wordsize(32), 264566040, 5) # some date 328810212 # 2015-07-11 350369584 From git at git.haskell.org Wed Apr 6 20:06:02 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 6 Apr 2016 20:06:02 +0000 (UTC) Subject: [commit: ghc] master: Core pretty printer: Omit wild case binders (2265c84) Message-ID: <20160406200602.12C623A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2265c849bf39a5b0eb10972681a9586c215408b5/ghc >--------------------------------------------------------------- commit 2265c849bf39a5b0eb10972681a9586c215408b5 Author: Joachim Breitner Date: Wed Mar 30 13:22:26 2016 +0200 Core pretty printer: Omit wild case binders as they (especially their id info with absence information) clutter the output too much. They come back with debug_on. Differential Revision: https://phabricator.haskell.org/D2072 >--------------------------------------------------------------- 2265c849bf39a5b0eb10972681a9586c215408b5 compiler/coreSyn/PprCore.hs | 43 +++++++++++++++++----- compiler/hsSyn/HsBinds.hs | 2 +- compiler/stgSyn/StgSyn.hs | 2 +- compiler/utils/Outputable.hs | 7 +++- .../tests/deSugar/should_compile/T2431.stderr | 2 +- .../tests/numeric/should_compile/T7116.stdout | 16 +++----- .../tests/simplCore/should_compile/T3717.stderr | 4 +- .../tests/simplCore/should_compile/T3772.stdout | 5 +-- .../tests/simplCore/should_compile/T4908.stderr | 8 ++-- .../tests/simplCore/should_compile/T4930.stderr | 10 ++--- .../tests/simplCore/should_compile/T5366.stdout | 3 +- .../tests/simplCore/should_compile/T7360.stderr | 12 ++---- .../tests/simplCore/should_compile/T7865.stdout | 4 +- .../simplCore/should_compile/spec-inline.stderr | 28 ++++++-------- 14 files changed, 79 insertions(+), 67 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 2265c849bf39a5b0eb10972681a9586c215408b5 From git at git.haskell.org Wed Apr 6 20:06:04 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 6 Apr 2016 20:06:04 +0000 (UTC) Subject: [commit: ghc] master: CSE code cleanup and improvement (5b986a4) Message-ID: <20160406200604.BBD823A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5b986a4de288e2c703c38ee37222a7bf3260cc11/ghc >--------------------------------------------------------------- commit 5b986a4de288e2c703c38ee37222a7bf3260cc11 Author: Simon Peyton Jones Date: Fri Apr 1 12:24:50 2016 +0200 CSE code cleanup and improvement Triggered by an observation by Joachim, Simon felt the urge to clean up the CSE code a bit. This is the result. (Code by Simon, commit message and other leg-work by Joachim) Differential Revision: https://phabricator.haskell.org/D2074 >--------------------------------------------------------------- 5b986a4de288e2c703c38ee37222a7bf3260cc11 compiler/simplCore/CSE.hs | 301 +++++++++++++-------- .../tests/numeric/should_compile/T7116.stdout | 16 +- testsuite/tests/perf/compiler/all.T | 9 +- testsuite/tests/perf/haddock/all.T | 3 +- 4 files changed, 208 insertions(+), 121 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 5b986a4de288e2c703c38ee37222a7bf3260cc11 From git at git.haskell.org Wed Apr 6 20:06:07 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 6 Apr 2016 20:06:07 +0000 (UTC) Subject: [commit: ghc] master: Demand Analyzer: Do not set OneShot information (second try) (0f58d34) Message-ID: <20160406200607.7E11F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0f58d3484d6bd57fa10bf83f0d9b126884027ebf/ghc >--------------------------------------------------------------- commit 0f58d3484d6bd57fa10bf83f0d9b126884027ebf Author: Joachim Breitner Date: Fri Apr 1 13:11:18 2016 +0200 Demand Analyzer: Do not set OneShot information (second try) as suggested in ticket:11770#comment:1. This code was buggy (#11770), and the occurrence analyzer does the same job anyways. This also elaborates the notes in the occurrence analyzer accordingly. Previously, the worker/wrapper code would go through lengths to transfer the oneShot annotations from the original function to both the worker and the wrapper. We now simply transfer the demand on the worker, and let the subsequent occurrence analyzer push this onto the lambda binders. This also requires the occurrence analyzer to do this more reliably. Previously, it would not hand out OneShot annotatoins to things that would not `certainly_inline` (and it might not have mattered, as the Demand Analysis might have handed out the annotations). Now we hand out one-shot annotations unconditionally. Differential Revision: https://phabricator.haskell.org/D2085 >--------------------------------------------------------------- 0f58d3484d6bd57fa10bf83f0d9b126884027ebf compiler/basicTypes/Demand.hs | 24 ++++++++- compiler/simplCore/OccurAnal.hs | 42 +++++++++++----- compiler/specialise/SpecConstr.hs | 2 +- compiler/stranal/DmdAnal.hs | 55 ++------------------- compiler/stranal/WorkWrap.hs | 60 ++++++++++++++++------ compiler/stranal/WwLib.hs | 74 +++++++--------------------- testsuite/tests/stranal/should_compile/all.T | 2 +- 7 files changed, 121 insertions(+), 138 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 0f58d3484d6bd57fa10bf83f0d9b126884027ebf From git at git.haskell.org Wed Apr 6 20:13:37 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 6 Apr 2016 20:13:37 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Bump parallel submodule (32f2154) Message-ID: <20160406201337.AE6A73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/32f21547212a2778352b5dde1877be8003829947/ghc >--------------------------------------------------------------- commit 32f21547212a2778352b5dde1877be8003829947 Author: Ben Gamari Date: Wed Apr 6 21:40:57 2016 +0200 Bump parallel submodule >--------------------------------------------------------------- 32f21547212a2778352b5dde1877be8003829947 libraries/parallel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/parallel b/libraries/parallel index ec04d05..dbb8d9e 160000 --- a/libraries/parallel +++ b/libraries/parallel @@ -1 +1 @@ -Subproject commit ec04d059b13fc348789d87adfbabb9351f8574db +Subproject commit dbb8d9e36276f1ced95c8761ddbc3b157742bd34 From git at git.haskell.org Wed Apr 6 20:13:40 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 6 Apr 2016 20:13:40 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Update pretty submodule (fc88685) Message-ID: <20160406201340.5CC403A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/fc88685b06c5dc859e3e5a81ef12ad91aba302f3/ghc >--------------------------------------------------------------- commit fc88685b06c5dc859e3e5a81ef12ad91aba302f3 Author: Ben Gamari Date: Wed Apr 6 21:57:23 2016 +0200 Update pretty submodule >--------------------------------------------------------------- fc88685b06c5dc859e3e5a81ef12ad91aba302f3 libraries/pretty | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/pretty b/libraries/pretty index 9fd5f2b..56bc78e 160000 --- a/libraries/pretty +++ b/libraries/pretty @@ -1 +1 @@ -Subproject commit 9fd5f2b596bdfbce0414f973009b579d5d2430fa +Subproject commit 56bc78e2c2cfcc850f6fec87fe79743750d4c8b4 From git at git.haskell.org Wed Apr 6 20:13:43 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 6 Apr 2016 20:13:43 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Bump Cabal submodule (7f6a281) Message-ID: <20160406201343.06B613A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/7f6a281a19ab7346d2bab865f26c40228cd05c16/ghc >--------------------------------------------------------------- commit 7f6a281a19ab7346d2bab865f26c40228cd05c16 Author: Ben Gamari Date: Wed Apr 6 21:49:47 2016 +0200 Bump Cabal submodule >--------------------------------------------------------------- 7f6a281a19ab7346d2bab865f26c40228cd05c16 libraries/Cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/Cabal b/libraries/Cabal index 5d0c56e..cb855f3 160000 --- a/libraries/Cabal +++ b/libraries/Cabal @@ -1 +1 @@ -Subproject commit 5d0c56ec49e07516c26a62c1a261e890752bc16b +Subproject commit cb855f34676ccdc2b0967a60ffe90b60ffeb1816 From git at git.haskell.org Wed Apr 6 20:36:22 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 6 Apr 2016 20:36:22 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Elaborate test for #11376 (1b381b5) Message-ID: <20160406203622.D1A3E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/1b381b50cdd5d8ac6f0e2ed3a525e8ea1514a09f/ghc >--------------------------------------------------------------- commit 1b381b50cdd5d8ac6f0e2ed3a525e8ea1514a09f Author: Simon Peyton Jones Date: Mon Apr 4 10:34:35 2016 +0100 Elaborate test for #11376 This just adds the Prox stuff from the Description in Trac #11376 to the test case, The class stuff seems weird becuase the type is ambiguous (cherry picked from commit b3ecd047c432405b57b429fdeaad43f5dcd1ee24) >--------------------------------------------------------------- 1b381b50cdd5d8ac6f0e2ed3a525e8ea1514a09f testsuite/tests/ghci/scripts/T11376.script | 8 +++++++- testsuite/tests/ghci/scripts/T11376.stdout | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/ghci/scripts/T11376.script b/testsuite/tests/ghci/scripts/T11376.script index 780db3c..d359b66 100644 --- a/testsuite/tests/ghci/scripts/T11376.script +++ b/testsuite/tests/ghci/scripts/T11376.script @@ -3,4 +3,10 @@ let { bar :: Show a => a -> b -> a; bar = error "urk" } :type bar @Int :set -fprint-explicit-foralls :type bar @Int - +:set -fprint-explicit-kinds -XTypeApplications -XTypeInType +data Prox a = Prox +let { prox :: Prox a; prox = Prox } +:t prox +:t prox @Int +:t Prox +:t Prox @Int diff --git a/testsuite/tests/ghci/scripts/T11376.stdout b/testsuite/tests/ghci/scripts/T11376.stdout index 0b0b959..c945167 100644 --- a/testsuite/tests/ghci/scripts/T11376.stdout +++ b/testsuite/tests/ghci/scripts/T11376.stdout @@ -1,2 +1,6 @@ bar @Int :: Int -> b -> Int bar @Int :: forall {b}. Int -> b -> Int +prox :: forall {k} {a :: k}. Prox k a +prox @Int :: Prox * Int +Prox :: forall {k} {a :: k}. Prox k a +Prox @Int :: Prox * Int From git at git.haskell.org Wed Apr 6 20:40:13 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 6 Apr 2016 20:40:13 +0000 (UTC) Subject: [commit: ghc] branch 'wip/cse-code-desmelling' deleted Message-ID: <20160406204013.9D51E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Deleted branch: wip/cse-code-desmelling From git at git.haskell.org Wed Apr 6 20:40:15 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 6 Apr 2016 20:40:15 +0000 (UTC) Subject: [commit: ghc] branch 'wip/T11770' deleted Message-ID: <20160406204015.9D6DA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Deleted branch: wip/T11770 From git at git.haskell.org Thu Apr 7 01:29:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Apr 2016 01:29:06 +0000 (UTC) Subject: [commit: ghc] master: Set tct_closed to TopLevel for closed bindings. (c9e8f80) Message-ID: <20160407012906.8E22B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c9e8f801170b213b85735ed403f24b2842aedf1b/ghc >--------------------------------------------------------------- commit c9e8f801170b213b85735ed403f24b2842aedf1b Author: Facundo Dom?nguez Date: Thu Mar 17 12:21:25 2016 -0300 Set tct_closed to TopLevel for closed bindings. Summary: Till now tct_closed determined whether the type of a binding is closed. With this patch tct_closed indicates whether the binding is closed. Test Plan: ./validate Reviewers: simonpj, austin, bgamari Reviewed By: simonpj Subscribers: mboes, thomie, simonpj Differential Revision: https://phabricator.haskell.org/D2016 GHC Trac Issues: #11698 >--------------------------------------------------------------- c9e8f801170b213b85735ed403f24b2842aedf1b compiler/typecheck/TcBinds.hs | 122 +++++++++++++-------- compiler/typecheck/TcEnv.hs | 31 ++++-- compiler/typecheck/TcInstDcls.hs | 2 +- compiler/typecheck/TcRnDriver.hs | 2 +- compiler/typecheck/TcRnTypes.hs | 6 +- testsuite/tests/typecheck/should_fail/T11698.hs | 7 ++ .../tests/typecheck/should_fail/T11698.stderr | 7 ++ testsuite/tests/typecheck/should_fail/all.T | 1 + 8 files changed, 119 insertions(+), 59 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc c9e8f801170b213b85735ed403f24b2842aedf1b From git at git.haskell.org Thu Apr 7 03:45:30 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Apr 2016 03:45:30 +0000 (UTC) Subject: [commit: ghc] master: runtime: replace hw.ncpu with hw.logicalcpu for Mac OS X (eda273b) Message-ID: <20160407034530.1AC773A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/eda273bc0be4f2316758e121f5f0ed85c3460c7f/ghc >--------------------------------------------------------------- commit eda273bc0be4f2316758e121f5f0ed85c3460c7f Author: Eugene Akentyev Date: Thu Apr 7 03:44:59 2016 +0000 runtime: replace hw.ncpu with hw.logicalcpu for Mac OS X Reviewed By: erikd, austin Differential Revision: https://phabricator.haskell.org/D2082 GHC Trac Issues: #8594 >--------------------------------------------------------------- eda273bc0be4f2316758e121f5f0ed85c3460c7f rts/posix/OSThreads.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/rts/posix/OSThreads.c b/rts/posix/OSThreads.c index 91f9523..1562ee4 100644 --- a/rts/posix/OSThreads.c +++ b/rts/posix/OSThreads.c @@ -237,9 +237,15 @@ getNumberOfProcessors (void) nproc = sysconf(_SC_NPROCESSORS_ONLN); #elif defined(HAVE_SYSCONF) && defined(_SC_NPROCESSORS_CONF) nproc = sysconf(_SC_NPROCESSORS_CONF); -#elif defined(darwin_HOST_OS) || defined(freebsd_HOST_OS) +#elif defined(darwin_HOST_OS) size_t size = sizeof(nat); - if(0 != sysctlbyname("hw.ncpu",&nproc,&size,NULL,0)) + if(sysctlbyname("hw.logicalcpu",&nproc,&size,NULL,0) != 0) { + if(sysctlbyname("hw.ncpu",&nproc,&size,NULL,0) != 0) + nproc = 1; + } +#elif defined(freebsd_HOST_OS) + size_t size = sizeof(nat); + if(sysctlbyname("hw.ncpu",&nproc,&size,NULL,0) != 0) nproc = 1; #else nproc = 1; From git at git.haskell.org Thu Apr 7 07:19:15 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Apr 2016 07:19:15 +0000 (UTC) Subject: [commit: ghc] master: Adjust performance numbers (27528b3) Message-ID: <20160407071915.C163A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/27528b30d675fabd9aa5ad5556bc8071f13f99b5/ghc >--------------------------------------------------------------- commit 27528b30d675fabd9aa5ad5556bc8071f13f99b5 Author: Joachim Breitner Date: Thu Apr 7 09:21:22 2016 +0200 Adjust performance numbers to what phabricator found; not sure why my local validation yielded different numbers. >--------------------------------------------------------------- 27528b30d675fabd9aa5ad5556bc8071f13f99b5 testsuite/tests/perf/compiler/all.T | 3 ++- testsuite/tests/perf/haddock/all.T | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index c9aa537..b3ae160 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -680,11 +680,12 @@ test('T9675', test('T9872a', [ only_ways(['normal']), compiler_stats_num_field('bytes allocated', - [(wordsize(64), 3581500440, 5), + [(wordsize(64), 3352882080, 5), # 2014-12-10 5521332656 Initally created # 2014-12-16 5848657456 Flattener parameterized over roles # 2014-12-18 2680733672 Reduce type families even more eagerly # 2015-12-11 3581500440 TypeInType (see #11196) + # 2016-04-07 3352882080 CSE improvements (wordsize(32), 1740903516, 5) # was 1325592896 # 2016-04-06 1740903516 x86/Linux diff --git a/testsuite/tests/perf/haddock/all.T b/testsuite/tests/perf/haddock/all.T index 2d40dcb..cf1ad4c 100644 --- a/testsuite/tests/perf/haddock/all.T +++ b/testsuite/tests/perf/haddock/all.T @@ -51,7 +51,7 @@ test('haddock.base', test('haddock.Cabal', [unless(in_tree_compiler(), skip), req_haddock ,stats_num_field('bytes allocated', - [(wordsize(64), 11542374816, 5) + [(wordsize(64), 10963514352, 5) # 2012-08-14: 3255435248 (amd64/Linux) # 2012-08-29: 3324606664 (amd64/Linux, new codegen) # 2012-10-08: 3373401360 (amd64/Linux) @@ -78,6 +78,7 @@ test('haddock.Cabal', # 2016-03-29: 11517963232 (amd64/Linux) - not yet investigated # 2016-03-30: 10941742184 (amd64/Linux) - defer inlining of Int* Ord methods # 2016-04-06: 11542374816 (amd64/Linux) - CSE improvements and others + # 2016-04-07: 10963514352 (amd64/Linux) - Revert to what phabricator claims ,(platform('i386-unknown-mingw32'), 3293415576, 5) # 2012-10-30: 1733638168 (x86/Windows) From git at git.haskell.org Thu Apr 7 09:03:37 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Apr 2016 09:03:37 +0000 (UTC) Subject: [commit: ghc] wip/T11731: Add a test case for #11731. (f5bab40) Message-ID: <20160407090337.0EB893A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T11731 Link : http://ghc.haskell.org/trac/ghc/changeset/f5bab40a33141fec9bdc734dc086575dab84ff84/ghc >--------------------------------------------------------------- commit f5bab40a33141fec9bdc734dc086575dab84ff84 Author: Joachim Breitner Date: Wed Mar 30 12:55:10 2016 +0200 Add a test case for #11731. >--------------------------------------------------------------- f5bab40a33141fec9bdc734dc086575dab84ff84 testsuite/.gitignore | 1 + testsuite/tests/simplCore/should_run/T11731.hs | 36 ++++++++++++++++++++++ testsuite/tests/simplCore/should_run/T11731.stderr | 1 + testsuite/tests/simplCore/should_run/all.T | 1 + 4 files changed, 39 insertions(+) diff --git a/testsuite/.gitignore b/testsuite/.gitignore index 655e3da..e1f1822 100644 --- a/testsuite/.gitignore +++ b/testsuite/.gitignore @@ -1475,6 +1475,7 @@ mk/ghcconfig*_test___spaces_ghc*.exe.mk /tests/simplCore/should_run/T5997 /tests/simplCore/should_run/T7101 /tests/simplCore/should_run/T7924 +/tests/simplCore/should_run/T11731 /tests/simplCore/should_run/T9128 /tests/simplCore/should_run/T9390 /tests/simplCore/should_run/runST diff --git a/testsuite/tests/simplCore/should_run/T11731.hs b/testsuite/tests/simplCore/should_run/T11731.hs new file mode 100644 index 0000000..e148507 --- /dev/null +++ b/testsuite/tests/simplCore/should_run/T11731.hs @@ -0,0 +1,36 @@ +module Main (main ) where + +import Debug.Trace + +foo :: (a,b) -> a +foo (x,y) = x +{-# NOINLINE foo #-} + +wwMe :: Int -> (Int,Int) -> (Int, Int) +wwMe 0 p = + let a = fst p + b = snd p + -- This ensure sharing of b, as seen by the demand analyzer + + in foo p `seq` + -- This ensures that wwMe is strict in the tuple, but that the tuple + -- is preserved. + (b + a, a + b) + +wwMe n p = wwMe (n-1) (0,0) + -- ^ Make it recursive, so that it is attractive to worker-wrapper + +go :: Int -> IO () +go seed = do + let shareMeThunk = trace "Evaluated (should only happen once)" (seed + 1) + {-# NOINLINE shareMeThunk #-} + -- ^ This is the thunk that is wrongly evaluated twice. + + let (x,y) = wwMe 0 (seed,shareMeThunk) + + (x + y) `seq` return () + -- ^ Use both components +{-# NOINLINE go #-} + +main :: IO () +main = go 42 diff --git a/testsuite/tests/simplCore/should_run/T11731.stderr b/testsuite/tests/simplCore/should_run/T11731.stderr new file mode 100644 index 0000000..8d1fc60 --- /dev/null +++ b/testsuite/tests/simplCore/should_run/T11731.stderr @@ -0,0 +1 @@ +Evaluated (should only happen once) diff --git a/testsuite/tests/simplCore/should_run/all.T b/testsuite/tests/simplCore/should_run/all.T index 9c15b0f..042c097 100644 --- a/testsuite/tests/simplCore/should_run/all.T +++ b/testsuite/tests/simplCore/should_run/all.T @@ -71,3 +71,4 @@ test('T9128', normal, compile_and_run, ['']) test('T9390', normal, compile_and_run, ['']) test('T10830', extra_run_opts('+RTS -K100k -RTS'), compile_and_run, ['']) test('T11172', normal, compile_and_run, ['']) +test('T11731', expect_broken(11731), compile_and_run, ['-fspec-constr']) From git at git.haskell.org Thu Apr 7 09:03:39 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Apr 2016 09:03:39 +0000 (UTC) Subject: [commit: ghc] wip/T11731: Add a final demand analyzer run right before TidyCore (71c31ad) Message-ID: <20160407090339.CAF903A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T11731 Link : http://ghc.haskell.org/trac/ghc/changeset/71c31ad61ec6d220653dbd9eadc01378136a3260/ghc >--------------------------------------------------------------- commit 71c31ad61ec6d220653dbd9eadc01378136a3260 Author: Joachim Breitner Date: Thu Mar 31 10:18:15 2016 +0200 Add a final demand analyzer run right before TidyCore in order to have precise used-once information in the exported strictness signatures, as well as precise used-once information on thunks. This avoids the bad effects of #11731. The subsequent worker-wrapper pass is responsible for removing the demand environment part of the strictness signature. It does not run after the final demand analyzer pass, so remove this also in CoreTidy. The subsequent worker-wrapper pass is also responsible for removing used-once-information from the demands and strictness signatures, as these might not be preserved by the simplifier. This is _not_ done by CoreTidy, because we _do_ want this information, as produced by the last round of the demand analyzer, to be available to the code generator. >--------------------------------------------------------------- 71c31ad61ec6d220653dbd9eadc01378136a3260 compiler/basicTypes/Demand.hs | 72 ++++++++++++++------ compiler/basicTypes/Id.hs | 11 ++- compiler/basicTypes/IdInfo.hs | 15 +++- compiler/coreSyn/CoreTidy.hs | 5 +- compiler/simplCore/SimplCore.hs | 5 ++ compiler/stranal/DmdAnal.hs | 28 ++++++++ compiler/stranal/WorkWrap.hs | 79 ++++++++++++++++------ .../tests/simplCore/should_compile/T4908.stderr | 6 +- .../simplCore/should_compile/spec-inline.stderr | 4 +- testsuite/tests/simplCore/should_run/all.T | 2 +- .../tests/stranal/should_compile/T10694.stderr | 61 +++++++++++++++++ .../stranal/sigs/BottomFromInnerLambda.stderr | 7 ++ testsuite/tests/stranal/sigs/DmdAnalGADTs.stderr | 14 ++++ testsuite/tests/stranal/sigs/HyperStrUse.stderr | 6 ++ testsuite/tests/stranal/sigs/StrAnalExample.stderr | 6 ++ testsuite/tests/stranal/sigs/T8569.stderr | 9 +++ testsuite/tests/stranal/sigs/T8598.stderr | 6 ++ testsuite/tests/stranal/sigs/UnsatFun.stderr | 12 ++++ 18 files changed, 297 insertions(+), 51 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 71c31ad61ec6d220653dbd9eadc01378136a3260 From git at git.haskell.org Thu Apr 7 09:03:42 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Apr 2016 09:03:42 +0000 (UTC) Subject: [commit: ghc] wip/T11731's head updated: Add a final demand analyzer run right before TidyCore (71c31ad) Message-ID: <20160407090342.36D9B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/T11731' now includes: 3806891 Make the example for -M work 72bd7f7 Improve printing of pattern synonym types f2a2b79 Deeply instantiate in :type 90d7d60 rts: Make StablePtr derefs thread-safe (#10296) b3ecd04 Elaborate test for #11376 9b6820c Bump binary submodule 7407a66 Don't infer CallStacks 2f3b803 Use exprCtOrigin in tcRnExpr 1e6ec12 Fix misattribution of `-Wunused-local-binds` warnings 351f976 T10272, T4340: Add 32-bit output 726cbc2 T10870: Skip on 32-bit architectures 1a8d61c testsuite: Update 32-bit performance numbers 2265c84 Core pretty printer: Omit wild case binders 5b986a4 CSE code cleanup and improvement 0f58d34 Demand Analyzer: Do not set OneShot information (second try) c9e8f80 Set tct_closed to TopLevel for closed bindings. eda273b runtime: replace hw.ncpu with hw.logicalcpu for Mac OS X 27528b3 Adjust performance numbers f5bab40 Add a test case for #11731. 71c31ad Add a final demand analyzer run right before TidyCore From git at git.haskell.org Thu Apr 7 12:04:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Apr 2016 12:04:03 +0000 (UTC) Subject: [commit: packages/process] branch 'better-travis' created Message-ID: <20160407120403.2B0973A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/process New branch : better-travis Referencing: b50849aa2a95767a9c3080d26a8a0ad4976a3be9 From git at git.haskell.org Thu Apr 7 12:04:05 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Apr 2016 12:04:05 +0000 (UTC) Subject: [commit: packages/process] tag 'v1.4.2.0' created Message-ID: <20160407120405.2B1DD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/process New tag : v1.4.2.0 Referencing: 8afb07d7b3d213ed24d8a51c0a18cf1365ea1ed4 From git at git.haskell.org Thu Apr 7 12:04:07 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Apr 2016 12:04:07 +0000 (UTC) Subject: [commit: packages/process] master: T11100: modified pipe functions. Need some cleanup (074ba27) Message-ID: <20160407120407.357FC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/process On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/074ba275f98002d99d2c49e5380a96ae991abb86/process >--------------------------------------------------------------- commit 074ba275f98002d99d2c49e5380a96ae991abb86 Author: Tamar Christina Date: Wed Jan 20 06:47:35 2016 +0100 T11100: modified pipe functions. Need some cleanup >--------------------------------------------------------------- 074ba275f98002d99d2c49e5380a96ae991abb86 System/Process.hsc | 1 + System/Process/Internals.hs | 1 + System/Process/Windows.hsc | 21 +++++++++++++---- cbits/pipes.c | 57 +++++++++++++++++++++++++++++++++++++++++++++ include/pipes.h | 18 ++++++++++++++ process.cabal | 6 +++++ 6 files changed, 100 insertions(+), 4 deletions(-) diff --git a/System/Process.hsc b/System/Process.hsc index 6b870fd..579c197 100644 --- a/System/Process.hsc +++ b/System/Process.hsc @@ -57,6 +57,7 @@ module System.Process ( -- Interprocess communication createPipe, + createPipeInternalFd, -- * Old deprecated functions -- | These functions pre-date 'createProcess' which is much more diff --git a/System/Process/Internals.hs b/System/Process/Internals.hs index ef8ff8f..a3fb0d8 100644 --- a/System/Process/Internals.hs +++ b/System/Process/Internals.hs @@ -38,6 +38,7 @@ module System.Process.Internals ( withFilePathException, withCEnvironment, translate, createPipe, + createPipeInternalFd, interruptProcessGroupOf, ) where diff --git a/System/Process/Windows.hsc b/System/Process/Windows.hsc index a984bae..613656a 100644 --- a/System/Process/Windows.hsc +++ b/System/Process/Windows.hsc @@ -10,6 +10,7 @@ module System.Process.Windows , stopDelegateControlC , isDefaultSignal , createPipeInternal + , createPipeInternalFd , interruptProcessGroupOfInternal ) where @@ -245,20 +246,32 @@ isDefaultSignal = const False createPipeInternal :: IO (Handle, Handle) createPipeInternal = do (readfd, writefd) <- allocaArray 2 $ \ pfds -> do - throwErrnoIfMinus1_ "_pipe" $ c__pipe pfds 2 (#const _O_BINARY) - readfd <- peek pfds - writefd <- peekElemOff pfds 1 - return (readfd, writefd) + throwErrnoIfMinus1_ "_pipe" $ c__pipe pfds 2 (#const _O_BINARY) + readfd <- peek pfds + writefd <- peekElemOff pfds 1 + return (readfd, writefd) (do readh <- fdToHandle readfd writeh <- fdToHandle writefd return (readh, writeh)) `onException` (close' readfd >> close' writefd) +createPipeInternalFd :: IO (FD, FD) +createPipeInternalFd = do + allocaArray 2 $ \ pfds -> do + throwErrnoIfMinus1_ "_pipe" $ c__pipe2 pfds 2 (#const _O_BINARY) + readfd <- peek pfds + writefd <- peekElemOff pfds 1 + return (readfd, writefd) + + close' :: CInt -> IO () close' = throwErrnoIfMinus1_ "_close" . c__close foreign import ccall "io.h _pipe" c__pipe :: Ptr CInt -> CUInt -> CInt -> IO CInt +foreign import ccall "pipes.h createInheritablePipe" c__pipe2 :: + Ptr CInt -> CUInt -> CInt -> IO CInt + foreign import ccall "io.h _close" c__close :: CInt -> IO CInt diff --git a/cbits/pipes.c b/cbits/pipes.c new file mode 100644 index 0000000..2ba9265 --- /dev/null +++ b/cbits/pipes.c @@ -0,0 +1,57 @@ +/* ---------------------------------------------------------------------------- + (c) The University of Glasgow 2004 + + Support for System.Process + ------------------------------------------------------------------------- */ + +#include "pipes.h" + +BOOL createInheritablePipe(int *phandles, unsigned int psize, int textmode) { + HANDLE hTemporaryIn = NULL; + HANDLE hTemporaryOut = NULL; + + BOOL isInheritableOut = TRUE; + BOOL isInheritableIn = TRUE; + + /* Create the anon pipe with both ends inheritable */ + if (!CreatePipe(&hTemporaryIn, &hTemporaryOut, NULL, 0)) + { + maperrno(); + phandles[0] = NULL; + phandles[1] = NULL; + return FALSE; + } + + if (isInheritableIn) { + // SetHandleInformation requires at least Win2k + if (!SetHandleInformation(hTemporaryIn, + HANDLE_FLAG_INHERIT, + HANDLE_FLAG_INHERIT)) + { + maperrno(); + phandles[0] = NULL; + phandles[1] = NULL; + CloseHandle(hTemporaryIn); + CloseHandle(hTemporaryOut); + return FALSE; + } + } + phandles[0] = _open_osfhandle((int)hTemporaryIn, textmode); + + if (isInheritableOut) { + if (!SetHandleInformation(hTemporaryOut, + HANDLE_FLAG_INHERIT, + HANDLE_FLAG_INHERIT)) + { + maperrno(); + phandles[0] = NULL; + phandles[1] = NULL; + CloseHandle(hTemporaryIn); + CloseHandle(hTemporaryOut); + return FALSE; + } + } + phandles[1] = _open_osfhandle((int)hTemporaryOut, textmode); + + return TRUE; +} \ No newline at end of file diff --git a/include/pipes.h b/include/pipes.h new file mode 100644 index 0000000..36e2545 --- /dev/null +++ b/include/pipes.h @@ -0,0 +1,18 @@ +/* ---------------------------------------------------------------------------- + (c) The University of Glasgow 2004 + + Interface for code in pipes.c (providing support for System.Process) + ------------------------------------------------------------------------- */ + +#if defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32) +#define UNICODE +#include +#include +#include +#endif + +#if defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32) + +extern BOOL createInheritablePipe(int *phandles, unsigned int psize, int textmode); + +#endif diff --git a/process.cabal b/process.cabal index ee69285..c0918f2 100644 --- a/process.cabal +++ b/process.cabal @@ -51,6 +51,12 @@ library build-depends: Win32 >=2.2 && < 2.4 extra-libraries: kernel32 cpp-options: -DWINDOWS + c-sources: + cbits/pipes.c + includes: + pipes.h + install-includes: + pipes.h else other-modules: System.Process.Posix build-depends: unix >= 2.5 && < 2.8 From git at git.haskell.org Thu Apr 7 12:04:09 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Apr 2016 12:04:09 +0000 (UTC) Subject: [commit: packages/process] master: T11100: Updated the createPipe implementation (7900487) Message-ID: <20160407120409.3D5D03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/process On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7900487fe825cece73b1f9582ff6a09c3584f28b/process >--------------------------------------------------------------- commit 7900487fe825cece73b1f9582ff6a09c3584f28b Author: Tamar Christina Date: Sat Jan 23 14:09:16 2016 +0100 T11100: Updated the createPipe implementation >--------------------------------------------------------------- 7900487fe825cece73b1f9582ff6a09c3584f28b System/Process.hsc | 2 +- System/Process/Internals.hs | 14 ++++++++++- System/Process/Windows.hsc | 11 ++------- cbits/pipes.c | 57 --------------------------------------------- include/pipes.h | 18 -------------- process.cabal | 6 ----- 6 files changed, 16 insertions(+), 92 deletions(-) diff --git a/System/Process.hsc b/System/Process.hsc index 579c197..7d0219c 100644 --- a/System/Process.hsc +++ b/System/Process.hsc @@ -57,7 +57,7 @@ module System.Process ( -- Interprocess communication createPipe, - createPipeInternalFd, + createPipeFD, -- * Old deprecated functions -- | These functions pre-date 'createProcess' which is much more diff --git a/System/Process/Internals.hs b/System/Process/Internals.hs index a3fb0d8..5554a88 100644 --- a/System/Process/Internals.hs +++ b/System/Process/Internals.hs @@ -38,7 +38,7 @@ module System.Process.Internals ( withFilePathException, withCEnvironment, translate, createPipe, - createPipeInternalFd, + createPipeFD, interruptProcessGroupOf, ) where @@ -46,6 +46,7 @@ import Foreign.C import System.IO import GHC.IO.Handle.FD (fdToHandle) +import System.Posix.Internals (FD) import System.Process.Common @@ -164,6 +165,17 @@ createPipe :: IO (Handle, Handle) createPipe = createPipeInternal {-# INLINE createPipe #-} +-- --------------------------------------------------------------------------- +-- createPipeFD + +-- | Create a pipe for interprocess communication and return a +-- @(readEnd, writeEnd)@ `FD` pair. +-- +-- @since 1.2.1.0 +createPipeFD :: IO (FD, FD) +createPipeFD = createPipeInternalFd +{-# INLINE createPipeFD #-} + -- ---------------------------------------------------------------------------- -- interruptProcessGroupOf diff --git a/System/Process/Windows.hsc b/System/Process/Windows.hsc index 613656a..c2582fe 100644 --- a/System/Process/Windows.hsc +++ b/System/Process/Windows.hsc @@ -245,11 +245,7 @@ isDefaultSignal = const False createPipeInternal :: IO (Handle, Handle) createPipeInternal = do - (readfd, writefd) <- allocaArray 2 $ \ pfds -> do - throwErrnoIfMinus1_ "_pipe" $ c__pipe pfds 2 (#const _O_BINARY) - readfd <- peek pfds - writefd <- peekElemOff pfds 1 - return (readfd, writefd) + (readfd, writefd) <- createPipeInternalFd (do readh <- fdToHandle readfd writeh <- fdToHandle writefd return (readh, writeh)) `onException` (close' readfd >> close' writefd) @@ -257,7 +253,7 @@ createPipeInternal = do createPipeInternalFd :: IO (FD, FD) createPipeInternalFd = do allocaArray 2 $ \ pfds -> do - throwErrnoIfMinus1_ "_pipe" $ c__pipe2 pfds 2 (#const _O_BINARY) + throwErrnoIfMinus1_ "_pipe" $ c__pipe pfds 2 (#const _O_BINARY) readfd <- peek pfds writefd <- peekElemOff pfds 1 return (readfd, writefd) @@ -269,9 +265,6 @@ close' = throwErrnoIfMinus1_ "_close" . c__close foreign import ccall "io.h _pipe" c__pipe :: Ptr CInt -> CUInt -> CInt -> IO CInt -foreign import ccall "pipes.h createInheritablePipe" c__pipe2 :: - Ptr CInt -> CUInt -> CInt -> IO CInt - foreign import ccall "io.h _close" c__close :: CInt -> IO CInt diff --git a/cbits/pipes.c b/cbits/pipes.c deleted file mode 100644 index 2ba9265..0000000 --- a/cbits/pipes.c +++ /dev/null @@ -1,57 +0,0 @@ -/* ---------------------------------------------------------------------------- - (c) The University of Glasgow 2004 - - Support for System.Process - ------------------------------------------------------------------------- */ - -#include "pipes.h" - -BOOL createInheritablePipe(int *phandles, unsigned int psize, int textmode) { - HANDLE hTemporaryIn = NULL; - HANDLE hTemporaryOut = NULL; - - BOOL isInheritableOut = TRUE; - BOOL isInheritableIn = TRUE; - - /* Create the anon pipe with both ends inheritable */ - if (!CreatePipe(&hTemporaryIn, &hTemporaryOut, NULL, 0)) - { - maperrno(); - phandles[0] = NULL; - phandles[1] = NULL; - return FALSE; - } - - if (isInheritableIn) { - // SetHandleInformation requires at least Win2k - if (!SetHandleInformation(hTemporaryIn, - HANDLE_FLAG_INHERIT, - HANDLE_FLAG_INHERIT)) - { - maperrno(); - phandles[0] = NULL; - phandles[1] = NULL; - CloseHandle(hTemporaryIn); - CloseHandle(hTemporaryOut); - return FALSE; - } - } - phandles[0] = _open_osfhandle((int)hTemporaryIn, textmode); - - if (isInheritableOut) { - if (!SetHandleInformation(hTemporaryOut, - HANDLE_FLAG_INHERIT, - HANDLE_FLAG_INHERIT)) - { - maperrno(); - phandles[0] = NULL; - phandles[1] = NULL; - CloseHandle(hTemporaryIn); - CloseHandle(hTemporaryOut); - return FALSE; - } - } - phandles[1] = _open_osfhandle((int)hTemporaryOut, textmode); - - return TRUE; -} \ No newline at end of file diff --git a/include/pipes.h b/include/pipes.h deleted file mode 100644 index 36e2545..0000000 --- a/include/pipes.h +++ /dev/null @@ -1,18 +0,0 @@ -/* ---------------------------------------------------------------------------- - (c) The University of Glasgow 2004 - - Interface for code in pipes.c (providing support for System.Process) - ------------------------------------------------------------------------- */ - -#if defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32) -#define UNICODE -#include -#include -#include -#endif - -#if defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32) - -extern BOOL createInheritablePipe(int *phandles, unsigned int psize, int textmode); - -#endif diff --git a/process.cabal b/process.cabal index c0918f2..ee69285 100644 --- a/process.cabal +++ b/process.cabal @@ -51,12 +51,6 @@ library build-depends: Win32 >=2.2 && < 2.4 extra-libraries: kernel32 cpp-options: -DWINDOWS - c-sources: - cbits/pipes.c - includes: - pipes.h - install-includes: - pipes.h else other-modules: System.Process.Posix build-depends: unix >= 2.5 && < 2.8 From git at git.haskell.org Thu Apr 7 12:04:11 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Apr 2016 12:04:11 +0000 (UTC) Subject: [commit: packages/process] better-travis: Switch to Travis caching (0fe32ff) Message-ID: <20160407120411.430C23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/process On branch : better-travis Link : http://ghc.haskell.org/trac/ghc/changeset/0fe32ff1fa74a63086363ce111b99373d687432f/process >--------------------------------------------------------------- commit 0fe32ff1fa74a63086363ce111b99373d687432f Author: Michael Snoyman Date: Sun Jan 24 15:13:29 2016 +0200 Switch to Travis caching >--------------------------------------------------------------- 0fe32ff1fa74a63086363ce111b99373d687432f .travis.yml | 54 +++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 39 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index 911a546..96bd7d9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,23 +1,47 @@ -env: - - GHCVER=7.2.1 CABALVER=1.16 - - GHCVER=7.2.2 CABALVER=1.16 - - GHCVER=7.4.2 CABALVER=1.16 - # we have to use CABALVER=1.16 for GHC<7.6 as well, as there's - # no package for earlier cabal versions in the PPA - - GHCVER=7.6.3 CABALVER=1.16 - - GHCVER=7.8.4 CABALVER=1.18 - - GHCVER=7.10.1 CABALVER=1.22 - - GHCVER=7.10.2 CABALVER=1.22 - - GHCVER=head CABALVER=head +language: c +sudo: false + +cache: + directories: + - $HOME/.ghc + - $HOME/.cabal matrix: + include: + - env: GHCVER=7.2.1 CABALVER=1.16 + compiler: ": #GHC 7.2.1" + addons: {apt: {packages: [cabal-install-1.16,ghc-7.2.1], sources: [hvr-ghc]}} + - env: GHCVER=7.2.2 CABALVER=1.16 + compiler: ": #GHC 7.2.2" + addons: {apt: {packages: [cabal-install-1.16,ghc-7.2.2], sources: [hvr-ghc]}} + - env: GHCVER=7.4.2 CABALVER=1.16 + compiler: ": #GHC 7.4.2" + addons: {apt: {packages: [cabal-install-1.16,ghc-7.4.2], sources: [hvr-ghc]}} + # we have to use CABALVER=1.16 for GHC<7.6 as well, as there's + # no package for earlier cabal versions in the PPA + - env: GHCVER=7.6.3 CABALVER=1.16 + compiler: ": #GHC 7.6.3" + addons: {apt: {packages: [cabal-install-1.16,ghc-7.6.3], sources: [hvr-ghc]}} + - env: GHCVER=7.8.4 CABALVER=1.18 + compiler: ": #GHC 7.8.4" + addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4], sources: [hvr-ghc]}} + - env: GHCVER=7.10.1 CABALVER=1.22 + compiler: ": #GHC 7.10.1" + addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.1], sources: [hvr-ghc]}} + - env: GHCVER=7.10.2 CABALVER=1.22 + compiler: ": #GHC 7.10.2" + addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.2], sources: [hvr-ghc]}} + - env: GHCVER=7.10.3 CABALVER=1.22 + compiler: ": #GHC 7.10.3" + addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3], sources: [hvr-ghc]}} + + - env: GHCVER=head CABALVER=head + addons: {apt: {packages: [cabal-install-head,ghc-head], sources: [hvr-ghc]}} + allow_failures: - - env: GHCVER=head CABALVER=head + - env: GHCVER=head CABALVER=head before_install: - - travis_retry sudo add-apt-repository -y ppa:hvr/ghc - - travis_retry sudo apt-get update - - travis_retry sudo apt-get install cabal-install-$CABALVER ghc-$GHCVER - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH - cabal --version From git at git.haskell.org Thu Apr 7 12:04:13 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Apr 2016 12:04:13 +0000 (UTC) Subject: [commit: packages/process] better-travis: Add BUILD=cabal (c0440b5) Message-ID: <20160407120413.4A0BA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/process On branch : better-travis Link : http://ghc.haskell.org/trac/ghc/changeset/c0440b51775fddad7bd982ddbbd6b28580ce18d5/process >--------------------------------------------------------------- commit c0440b51775fddad7bd982ddbbd6b28580ce18d5 Author: Michael Snoyman Date: Sun Jan 24 15:14:03 2016 +0200 Add BUILD=cabal >--------------------------------------------------------------- c0440b51775fddad7bd982ddbbd6b28580ce18d5 .travis.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 96bd7d9..caaf607 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,38 +8,38 @@ cache: matrix: include: - - env: GHCVER=7.2.1 CABALVER=1.16 + - env: BUILD=cabal GHCVER=7.2.1 CABALVER=1.16 compiler: ": #GHC 7.2.1" addons: {apt: {packages: [cabal-install-1.16,ghc-7.2.1], sources: [hvr-ghc]}} - - env: GHCVER=7.2.2 CABALVER=1.16 + - env: BUILD=cabal GHCVER=7.2.2 CABALVER=1.16 compiler: ": #GHC 7.2.2" addons: {apt: {packages: [cabal-install-1.16,ghc-7.2.2], sources: [hvr-ghc]}} - - env: GHCVER=7.4.2 CABALVER=1.16 + - env: BUILD=cabal GHCVER=7.4.2 CABALVER=1.16 compiler: ": #GHC 7.4.2" addons: {apt: {packages: [cabal-install-1.16,ghc-7.4.2], sources: [hvr-ghc]}} # we have to use CABALVER=1.16 for GHC<7.6 as well, as there's # no package for earlier cabal versions in the PPA - - env: GHCVER=7.6.3 CABALVER=1.16 + - env: BUILD=cabal GHCVER=7.6.3 CABALVER=1.16 compiler: ": #GHC 7.6.3" addons: {apt: {packages: [cabal-install-1.16,ghc-7.6.3], sources: [hvr-ghc]}} - - env: GHCVER=7.8.4 CABALVER=1.18 + - env: BUILD=cabal GHCVER=7.8.4 CABALVER=1.18 compiler: ": #GHC 7.8.4" addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4], sources: [hvr-ghc]}} - - env: GHCVER=7.10.1 CABALVER=1.22 + - env: BUILD=cabal GHCVER=7.10.1 CABALVER=1.22 compiler: ": #GHC 7.10.1" addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.1], sources: [hvr-ghc]}} - - env: GHCVER=7.10.2 CABALVER=1.22 + - env: BUILD=cabal GHCVER=7.10.2 CABALVER=1.22 compiler: ": #GHC 7.10.2" addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.2], sources: [hvr-ghc]}} - - env: GHCVER=7.10.3 CABALVER=1.22 + - env: BUILD=cabal GHCVER=7.10.3 CABALVER=1.22 compiler: ": #GHC 7.10.3" addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3], sources: [hvr-ghc]}} - - env: GHCVER=head CABALVER=head + - env: BUILD=cabal GHCVER=head CABALVER=head addons: {apt: {packages: [cabal-install-head,ghc-head], sources: [hvr-ghc]}} allow_failures: - - env: GHCVER=head CABALVER=head + - env: BUILD=cabal GHCVER=head CABALVER=head before_install: - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH From git at git.haskell.org Thu Apr 7 12:04:15 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Apr 2016 12:04:15 +0000 (UTC) Subject: [commit: packages/process] better-travis: Add in OS X and Stack (f4ba1fa) Message-ID: <20160407120415.505103A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/process On branch : better-travis Link : http://ghc.haskell.org/trac/ghc/changeset/f4ba1fa3ab8d7529c5303ff5e9266e67eb6f7e16/process >--------------------------------------------------------------- commit f4ba1fa3ab8d7529c5303ff5e9266e67eb6f7e16 Author: Michael Snoyman Date: Sun Jan 24 15:19:17 2016 +0200 Add in OS X and Stack >--------------------------------------------------------------- f4ba1fa3ab8d7529c5303ff5e9266e67eb6f7e16 .travis.yml | 74 +++++++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 55 insertions(+), 19 deletions(-) diff --git a/.travis.yml b/.travis.yml index caaf607..c2ae0f6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ cache: directories: - $HOME/.ghc - $HOME/.cabal + - $HOME/.stack matrix: include: @@ -35,6 +36,22 @@ matrix: compiler: ": #GHC 7.10.3" addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3], sources: [hvr-ghc]}} + - env: BUILD=stack GHCVER=7.8.4 + compiler: ": #stack 7.8.4" + addons: {apt: {packages: [ghc-7.8.4], sources: [hvr-ghc]}} + + - env: BUILD=stack GHCVER=7.10.3 + compiler: ": #stack 7.10.3" + addons: {apt: {packages: [ghc-7.10.3], sources: [hvr-ghc]}} + + - env: BUILD=stack GHCVER=7.8.4 + compiler: ": #stack 7.8.4 osx" + os: osx + + - env: BUILD=stack GHCVER=7.10.3 + compiler: ": #stack 7.10.3 osx" + os: osx + - env: BUILD=cabal GHCVER=head CABALVER=head addons: {apt: {packages: [cabal-install-head,ghc-head], sources: [hvr-ghc]}} @@ -42,27 +59,46 @@ matrix: - env: BUILD=cabal GHCVER=head CABALVER=head before_install: - - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH + - unset CC + - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$HOME/.local/bin:$PATH + - mkdir -p ~/.local/bin - cabal --version + - if [ `uname` = "Darwin" ]; + then + curl --insecure -L https://www.stackage.org/stack/osx-x86_64 | tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin; + else + curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'; + fi install: - - travis_retry cabal update - - cabal install --only-dependencies - - ghc --version + - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]" + - case "$BUILD" in + stack) + stack --no-terminal test --only-dependencies;; + cabal) + cabal --version; + travis_retry cabal update; + rm -f $(stack path --dist-dir)/stack-*.tar.gz; + stack sdist --pvp-bounds=both; + tar xf $(stack path --dist-dir)/stack-*.tar.gz --wildcards --strip-components=1 '*/stack.cabal'; + cabal install --only-dependencies --enable-tests --enable-benchmarks --force-reinstalls --ghc-options=-O0;; + esac script: - - autoreconf -i - - cabal configure -v2 --enable-tests --ghc-options="-Wall -Werror" - - cabal build - - cabal check || [ "$CABALVER" == "1.16" ] - - ./dist/build/test/test # Using cabal test was giving trouble with cabal 1.22 - - cabal sdist -# The following scriptlet checks that the resulting source distribution can be built & installed - - export SRC_TGZ=$(cabal info . | awk '{print $2 ".tar.gz";exit}') ; - cd dist/; - if [ -f "$SRC_TGZ" ]; then - cabal install --force-reinstalls "$SRC_TGZ"; - else - echo "expected '$SRC_TGZ' not found"; - exit 1; - fi + - case "$BUILD" in + stack) + stack --no-terminal test --haddock --no-haddock-deps;; + cabal) + cabal configure --enable-tests --enable-benchmarks -v2 --ghc-options="-O0 -Werror"; + cabal build; + cabal test; + cabal check; + cabal sdist; + cabal copy; + cd test/integration; + true stack setup; + true stack test; + cd ../..; + SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz && + (cd dist && cabal install --force-reinstalls "$SRC_TGZ");; + esac From git at git.haskell.org Thu Apr 7 12:04:17 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Apr 2016 12:04:17 +0000 (UTC) Subject: [commit: packages/process] better-travis: More fixes to Travis (2d050ab) Message-ID: <20160407120417.568D93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/process On branch : better-travis Link : http://ghc.haskell.org/trac/ghc/changeset/2d050ab9e13b7ff0c8b938ba9033f14bb6f0e80a/process >--------------------------------------------------------------- commit 2d050ab9e13b7ff0c8b938ba9033f14bb6f0e80a Author: Michael Snoyman Date: Sun Jan 24 15:23:35 2016 +0200 More fixes to Travis >--------------------------------------------------------------- 2d050ab9e13b7ff0c8b938ba9033f14bb6f0e80a .travis.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index c2ae0f6..b26ea9e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -72,6 +72,7 @@ before_install: install: - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]" + - autoreconf -i - case "$BUILD" in stack) stack --no-terminal test --only-dependencies;; @@ -91,14 +92,10 @@ script: cabal) cabal configure --enable-tests --enable-benchmarks -v2 --ghc-options="-O0 -Werror"; cabal build; - cabal test; - cabal check; + cabal check || [ "$CABALVER" == "1.16" ]; + ./dist/build/test/test; # Using cabal test was giving trouble with cabal 1.22 cabal sdist; cabal copy; - cd test/integration; - true stack setup; - true stack test; - cd ../..; SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz && (cd dist && cabal install --force-reinstalls "$SRC_TGZ");; esac From git at git.haskell.org Thu Apr 7 12:04:19 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Apr 2016 12:04:19 +0000 (UTC) Subject: [commit: packages/process] better-travis: Fix markup? (16a1583) Message-ID: <20160407120419.5D2F33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/process On branch : better-travis Link : http://ghc.haskell.org/trac/ghc/changeset/16a1583fd6bee06781ee0f99979f918587bf4019/process >--------------------------------------------------------------- commit 16a1583fd6bee06781ee0f99979f918587bf4019 Author: Michael Snoyman Date: Sun Jan 24 15:25:02 2016 +0200 Fix markup? >--------------------------------------------------------------- 16a1583fd6bee06781ee0f99979f918587bf4019 .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b26ea9e..5304709 100644 --- a/.travis.yml +++ b/.travis.yml @@ -93,7 +93,8 @@ script: cabal configure --enable-tests --enable-benchmarks -v2 --ghc-options="-O0 -Werror"; cabal build; cabal check || [ "$CABALVER" == "1.16" ]; - ./dist/build/test/test; # Using cabal test was giving trouble with cabal 1.22 + true Using cabal test was giving trouble with cabal 1.22; + ./dist/build/test/test; cabal sdist; cabal copy; SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz && From git at git.haskell.org Thu Apr 7 12:04:21 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Apr 2016 12:04:21 +0000 (UTC) Subject: [commit: packages/process] better-travis: Remove unneeded cabal --version (99554f9) Message-ID: <20160407120421.64C153A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/process On branch : better-travis Link : http://ghc.haskell.org/trac/ghc/changeset/99554f9cafb6f923d5c36d5863c07f5fdd534677/process >--------------------------------------------------------------- commit 99554f9cafb6f923d5c36d5863c07f5fdd534677 Author: Michael Snoyman Date: Sun Jan 24 15:27:39 2016 +0200 Remove unneeded cabal --version >--------------------------------------------------------------- 99554f9cafb6f923d5c36d5863c07f5fdd534677 .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 5304709..ec41c26 100644 --- a/.travis.yml +++ b/.travis.yml @@ -62,7 +62,6 @@ before_install: - unset CC - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$HOME/.local/bin:$PATH - mkdir -p ~/.local/bin - - cabal --version - if [ `uname` = "Darwin" ]; then curl --insecure -L https://www.stackage.org/stack/osx-x86_64 | tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin; From git at git.haskell.org Thu Apr 7 12:04:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Apr 2016 12:04:23 +0000 (UTC) Subject: [commit: packages/process] better-travis: Create stack.yaml for current GHC version (8e635bb) Message-ID: <20160407120423.6BC6E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/process On branch : better-travis Link : http://ghc.haskell.org/trac/ghc/changeset/8e635bb4b6db637eb7247d9f6f79b9474d128218/process >--------------------------------------------------------------- commit 8e635bb4b6db637eb7247d9f6f79b9474d128218 Author: Michael Snoyman Date: Sun Jan 24 15:32:17 2016 +0200 Create stack.yaml for current GHC version >--------------------------------------------------------------- 8e635bb4b6db637eb7247d9f6f79b9474d128218 .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index ec41c26..6756dbf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -74,6 +74,8 @@ install: - autoreconf -i - case "$BUILD" in stack) + rm -f stack.yaml; + stack init --resolver ghc-$GHCVER; stack --no-terminal test --only-dependencies;; cabal) cabal --version; From git at git.haskell.org Thu Apr 7 12:04:25 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Apr 2016 12:04:25 +0000 (UTC) Subject: [commit: packages/process] better-travis: Simpler stack.yaml creation (839cf9f) Message-ID: <20160407120425.73BC93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/process On branch : better-travis Link : http://ghc.haskell.org/trac/ghc/changeset/839cf9fdc38d45e361fecb2ba6c1c0c07db2a23f/process >--------------------------------------------------------------- commit 839cf9fdc38d45e361fecb2ba6c1c0c07db2a23f Author: Michael Snoyman Date: Sun Jan 24 15:36:41 2016 +0200 Simpler stack.yaml creation >--------------------------------------------------------------- 839cf9fdc38d45e361fecb2ba6c1c0c07db2a23f .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6756dbf..c5ddc91 100644 --- a/.travis.yml +++ b/.travis.yml @@ -74,8 +74,7 @@ install: - autoreconf -i - case "$BUILD" in stack) - rm -f stack.yaml; - stack init --resolver ghc-$GHCVER; + echo "resolver: ghc-$GHCVER" > stack.yaml; stack --no-terminal test --only-dependencies;; cabal) cabal --version; From git at git.haskell.org Thu Apr 7 12:04:27 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Apr 2016 12:04:27 +0000 (UTC) Subject: [commit: packages/process] better-travis: Fix YAML syntax (caeb15d) Message-ID: <20160407120427.7B29B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/process On branch : better-travis Link : http://ghc.haskell.org/trac/ghc/changeset/caeb15d343027a6463d70e0525db451595a63e5c/process >--------------------------------------------------------------- commit caeb15d343027a6463d70e0525db451595a63e5c Author: Michael Snoyman Date: Sun Jan 24 16:21:31 2016 +0200 Fix YAML syntax >--------------------------------------------------------------- caeb15d343027a6463d70e0525db451595a63e5c .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c5ddc91..4c9a42e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -72,7 +72,8 @@ before_install: install: - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]" - autoreconf -i - - case "$BUILD" in + - | + case "$BUILD" in stack) echo "resolver: ghc-$GHCVER" > stack.yaml; stack --no-terminal test --only-dependencies;; From git at git.haskell.org Thu Apr 7 12:04:29 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Apr 2016 12:04:29 +0000 (UTC) Subject: [commit: packages/process] better-travis: install-ghc (b50849a) Message-ID: <20160407120429.8200A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/process On branch : better-travis Link : http://ghc.haskell.org/trac/ghc/changeset/b50849aa2a95767a9c3080d26a8a0ad4976a3be9/process >--------------------------------------------------------------- commit b50849aa2a95767a9c3080d26a8a0ad4976a3be9 Author: Michael Snoyman Date: Sun Jan 24 16:30:51 2016 +0200 install-ghc >--------------------------------------------------------------- b50849aa2a95767a9c3080d26a8a0ad4976a3be9 .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4c9a42e..0b1b95d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -57,6 +57,7 @@ matrix: allow_failures: - env: BUILD=cabal GHCVER=head CABALVER=head + - env: BUILD=stack GHCVER=7.8.4 before_install: - unset CC @@ -76,7 +77,7 @@ install: case "$BUILD" in stack) echo "resolver: ghc-$GHCVER" > stack.yaml; - stack --no-terminal test --only-dependencies;; + stack --no-terminal --install-ghc test --only-dependencies;; cabal) cabal --version; travis_retry cabal update; From git at git.haskell.org Thu Apr 7 12:04:31 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Apr 2016 12:04:31 +0000 (UTC) Subject: [commit: packages/process] master: Switch to Travis caching with Stack and OS X support (543aa1c) Message-ID: <20160407120431.898F53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/process On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/543aa1c3701d5025923a3c1769854b0afd353158/process >--------------------------------------------------------------- commit 543aa1c3701d5025923a3c1769854b0afd353158 Author: Michael Snoyman Date: Sun Jan 24 15:13:29 2016 +0200 Switch to Travis caching with Stack and OS X support >--------------------------------------------------------------- 543aa1c3701d5025923a3c1769854b0afd353158 .travis.yml | 130 ++++++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 95 insertions(+), 35 deletions(-) diff --git a/.travis.yml b/.travis.yml index 911a546..0b1b95d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,44 +1,104 @@ -env: - - GHCVER=7.2.1 CABALVER=1.16 - - GHCVER=7.2.2 CABALVER=1.16 - - GHCVER=7.4.2 CABALVER=1.16 - # we have to use CABALVER=1.16 for GHC<7.6 as well, as there's - # no package for earlier cabal versions in the PPA - - GHCVER=7.6.3 CABALVER=1.16 - - GHCVER=7.8.4 CABALVER=1.18 - - GHCVER=7.10.1 CABALVER=1.22 - - GHCVER=7.10.2 CABALVER=1.22 - - GHCVER=head CABALVER=head +language: c +sudo: false + +cache: + directories: + - $HOME/.ghc + - $HOME/.cabal + - $HOME/.stack matrix: + include: + - env: BUILD=cabal GHCVER=7.2.1 CABALVER=1.16 + compiler: ": #GHC 7.2.1" + addons: {apt: {packages: [cabal-install-1.16,ghc-7.2.1], sources: [hvr-ghc]}} + - env: BUILD=cabal GHCVER=7.2.2 CABALVER=1.16 + compiler: ": #GHC 7.2.2" + addons: {apt: {packages: [cabal-install-1.16,ghc-7.2.2], sources: [hvr-ghc]}} + - env: BUILD=cabal GHCVER=7.4.2 CABALVER=1.16 + compiler: ": #GHC 7.4.2" + addons: {apt: {packages: [cabal-install-1.16,ghc-7.4.2], sources: [hvr-ghc]}} + # we have to use CABALVER=1.16 for GHC<7.6 as well, as there's + # no package for earlier cabal versions in the PPA + - env: BUILD=cabal GHCVER=7.6.3 CABALVER=1.16 + compiler: ": #GHC 7.6.3" + addons: {apt: {packages: [cabal-install-1.16,ghc-7.6.3], sources: [hvr-ghc]}} + - env: BUILD=cabal GHCVER=7.8.4 CABALVER=1.18 + compiler: ": #GHC 7.8.4" + addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4], sources: [hvr-ghc]}} + - env: BUILD=cabal GHCVER=7.10.1 CABALVER=1.22 + compiler: ": #GHC 7.10.1" + addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.1], sources: [hvr-ghc]}} + - env: BUILD=cabal GHCVER=7.10.2 CABALVER=1.22 + compiler: ": #GHC 7.10.2" + addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.2], sources: [hvr-ghc]}} + - env: BUILD=cabal GHCVER=7.10.3 CABALVER=1.22 + compiler: ": #GHC 7.10.3" + addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3], sources: [hvr-ghc]}} + + - env: BUILD=stack GHCVER=7.8.4 + compiler: ": #stack 7.8.4" + addons: {apt: {packages: [ghc-7.8.4], sources: [hvr-ghc]}} + + - env: BUILD=stack GHCVER=7.10.3 + compiler: ": #stack 7.10.3" + addons: {apt: {packages: [ghc-7.10.3], sources: [hvr-ghc]}} + + - env: BUILD=stack GHCVER=7.8.4 + compiler: ": #stack 7.8.4 osx" + os: osx + + - env: BUILD=stack GHCVER=7.10.3 + compiler: ": #stack 7.10.3 osx" + os: osx + + - env: BUILD=cabal GHCVER=head CABALVER=head + addons: {apt: {packages: [cabal-install-head,ghc-head], sources: [hvr-ghc]}} + allow_failures: - - env: GHCVER=head CABALVER=head + - env: BUILD=cabal GHCVER=head CABALVER=head + - env: BUILD=stack GHCVER=7.8.4 before_install: - - travis_retry sudo add-apt-repository -y ppa:hvr/ghc - - travis_retry sudo apt-get update - - travis_retry sudo apt-get install cabal-install-$CABALVER ghc-$GHCVER - - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH - - cabal --version + - unset CC + - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$HOME/.local/bin:$PATH + - mkdir -p ~/.local/bin + - if [ `uname` = "Darwin" ]; + then + curl --insecure -L https://www.stackage.org/stack/osx-x86_64 | tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin; + else + curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'; + fi install: - - travis_retry cabal update - - cabal install --only-dependencies - - ghc --version + - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]" + - autoreconf -i + - | + case "$BUILD" in + stack) + echo "resolver: ghc-$GHCVER" > stack.yaml; + stack --no-terminal --install-ghc test --only-dependencies;; + cabal) + cabal --version; + travis_retry cabal update; + rm -f $(stack path --dist-dir)/stack-*.tar.gz; + stack sdist --pvp-bounds=both; + tar xf $(stack path --dist-dir)/stack-*.tar.gz --wildcards --strip-components=1 '*/stack.cabal'; + cabal install --only-dependencies --enable-tests --enable-benchmarks --force-reinstalls --ghc-options=-O0;; + esac script: - - autoreconf -i - - cabal configure -v2 --enable-tests --ghc-options="-Wall -Werror" - - cabal build - - cabal check || [ "$CABALVER" == "1.16" ] - - ./dist/build/test/test # Using cabal test was giving trouble with cabal 1.22 - - cabal sdist -# The following scriptlet checks that the resulting source distribution can be built & installed - - export SRC_TGZ=$(cabal info . | awk '{print $2 ".tar.gz";exit}') ; - cd dist/; - if [ -f "$SRC_TGZ" ]; then - cabal install --force-reinstalls "$SRC_TGZ"; - else - echo "expected '$SRC_TGZ' not found"; - exit 1; - fi + - case "$BUILD" in + stack) + stack --no-terminal test --haddock --no-haddock-deps;; + cabal) + cabal configure --enable-tests --enable-benchmarks -v2 --ghc-options="-O0 -Werror"; + cabal build; + cabal check || [ "$CABALVER" == "1.16" ]; + true Using cabal test was giving trouble with cabal 1.22; + ./dist/build/test/test; + cabal sdist; + cabal copy; + SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz && + (cd dist && cabal install --force-reinstalls "$SRC_TGZ");; + esac From git at git.haskell.org Thu Apr 7 12:04:33 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Apr 2016 12:04:33 +0000 (UTC) Subject: [commit: packages/process] master: T11100: Expose createPipeInternalFd on POSIX systems as well (d41799f) Message-ID: <20160407120433.9128D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/process On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d41799f8c64e3e4c93082fa00b34e09ccb2ec56f/process >--------------------------------------------------------------- commit d41799f8c64e3e4c93082fa00b34e09ccb2ec56f Author: Tamar Christina Date: Sun Jan 24 18:32:58 2016 +0100 T11100: Expose createPipeInternalFd on POSIX systems as well >--------------------------------------------------------------- d41799f8c64e3e4c93082fa00b34e09ccb2ec56f System/Process/Posix.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/System/Process/Posix.hs b/System/Process/Posix.hs index 6129197..0b1f3f9 100644 --- a/System/Process/Posix.hs +++ b/System/Process/Posix.hs @@ -15,6 +15,7 @@ module System.Process.Posix , c_execvpe , pPrPr_disableITimers , createPipeInternal + , createPipeInternalFd , interruptProcessGroupOfInternal ) where @@ -279,6 +280,9 @@ createPipeInternal = do writeh <- Posix.fdToHandle writefd return (readh, writeh) +createPipeInternalFd :: IO (FD, FD) +createPipeInternalFd = Posix.createPipe + interruptProcessGroupOfInternal :: ProcessHandle -- ^ A process in the process group -> IO () From git at git.haskell.org Thu Apr 7 12:04:35 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Apr 2016 12:04:35 +0000 (UTC) Subject: [commit: packages/process] master: T11100: Use the correct Fd type for POSIX. (400f1bf) Message-ID: <20160407120435.9609F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/process On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/400f1bf668bad941d6b78ae6e3f2480666395e5e/process >--------------------------------------------------------------- commit 400f1bf668bad941d6b78ae6e3f2480666395e5e Author: Tamar Christina Date: Sun Jan 24 19:54:39 2016 +0100 T11100: Use the correct Fd type for POSIX. >--------------------------------------------------------------- 400f1bf668bad941d6b78ae6e3f2480666395e5e System/Process/Posix.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/System/Process/Posix.hs b/System/Process/Posix.hs index 0b1f3f9..d11e793 100644 --- a/System/Process/Posix.hs +++ b/System/Process/Posix.hs @@ -281,7 +281,9 @@ createPipeInternal = do return (readh, writeh) createPipeInternalFd :: IO (FD, FD) -createPipeInternalFd = Posix.createPipe +createPipeInternalFd = do + (Fd readfd, Fd writefd) <- Posix.createPipe + return (readfd, writefd) interruptProcessGroupOfInternal :: ProcessHandle -- ^ A process in the process group From git at git.haskell.org Thu Apr 7 12:04:37 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Apr 2016 12:04:37 +0000 (UTC) Subject: [commit: packages/process] master: T11100: Updated version and changelog (81583c8) Message-ID: <20160407120437.9CF343A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/process On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/81583c8547b22634d814351bcf7e5842ce6360d6/process >--------------------------------------------------------------- commit 81583c8547b22634d814351bcf7e5842ce6360d6 Author: Tamar Christina Date: Mon Jan 25 08:21:33 2016 +0100 T11100: Updated version and changelog >--------------------------------------------------------------- 81583c8547b22634d814351bcf7e5842ce6360d6 System/Process/Internals.hs | 2 +- changelog.md | 6 ++++++ process.cabal | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/System/Process/Internals.hs b/System/Process/Internals.hs index 5554a88..39a7395 100644 --- a/System/Process/Internals.hs +++ b/System/Process/Internals.hs @@ -171,7 +171,7 @@ createPipe = createPipeInternal -- | Create a pipe for interprocess communication and return a -- @(readEnd, writeEnd)@ `FD` pair. -- --- @since 1.2.1.0 +-- @since 1.4.2.0 createPipeFD :: IO (FD, FD) createPipeFD = createPipeInternalFd {-# INLINE createPipeFD #-} diff --git a/changelog.md b/changelog.md index b01b324..7a220f7 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,11 @@ # Changelog for [`process` package](http://hackage.haskell.org/package/process) +## 1.4.2.0 *January 2016* + +* Added `createPipeFD` [#52](https://github.com/haskell/process/pull/52) + * New function `createPipeFD` added which returns a POSIX File Descriptor (CInt) + instead of a GHC Handle to a pipe + ## 1.4.1.0 *November 2015* * Use less CPP [#47](https://github.com/haskell/process/pull/47) diff --git a/process.cabal b/process.cabal index ee69285..15f6a65 100644 --- a/process.cabal +++ b/process.cabal @@ -1,5 +1,5 @@ name: process -version: 1.4.1.0 +version: 1.4.2.0 -- NOTE: Don't forget to update ./changelog.md license: BSD3 license-file: LICENSE From git at git.haskell.org Thu Apr 7 12:04:39 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Apr 2016 12:04:39 +0000 (UTC) Subject: [commit: packages/process] master: T11100: renamed functions (574846d) Message-ID: <20160407120439.A3F813A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/process On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/574846def157fcbaba6d5d3ce1c40db23f9d23a1/process >--------------------------------------------------------------- commit 574846def157fcbaba6d5d3ce1c40db23f9d23a1 Author: Tamar Christina Date: Tue Jan 26 08:28:57 2016 +0100 T11100: renamed functions >--------------------------------------------------------------- 574846def157fcbaba6d5d3ce1c40db23f9d23a1 System/Process.hsc | 2 +- System/Process/Internals.hs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/System/Process.hsc b/System/Process.hsc index 7d0219c..37d442f 100644 --- a/System/Process.hsc +++ b/System/Process.hsc @@ -57,7 +57,7 @@ module System.Process ( -- Interprocess communication createPipe, - createPipeFD, + createPipeFd, -- * Old deprecated functions -- | These functions pre-date 'createProcess' which is much more diff --git a/System/Process/Internals.hs b/System/Process/Internals.hs index 39a7395..c4d5be3 100644 --- a/System/Process/Internals.hs +++ b/System/Process/Internals.hs @@ -38,7 +38,7 @@ module System.Process.Internals ( withFilePathException, withCEnvironment, translate, createPipe, - createPipeFD, + createPipeFd, interruptProcessGroupOf, ) where @@ -166,15 +166,15 @@ createPipe = createPipeInternal {-# INLINE createPipe #-} -- --------------------------------------------------------------------------- --- createPipeFD +-- createPipeFd -- | Create a pipe for interprocess communication and return a -- @(readEnd, writeEnd)@ `FD` pair. -- -- @since 1.4.2.0 -createPipeFD :: IO (FD, FD) -createPipeFD = createPipeInternalFd -{-# INLINE createPipeFD #-} +createPipeFd :: IO (FD, FD) +createPipeFd = createPipeInternalFd +{-# INLINE createPipeFd #-} -- ---------------------------------------------------------------------------- From git at git.haskell.org Thu Apr 7 12:04:41 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Apr 2016 12:04:41 +0000 (UTC) Subject: [commit: packages/process] master: Merge pull request #52 from Mistuke/trac-11100-expose-part-of-create-pipe (296cbce) Message-ID: <20160407120441.ABBF53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/process On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/296cbce6294316d6534b4449fc7ab0f0d3f5775b/process >--------------------------------------------------------------- commit 296cbce6294316d6534b4449fc7ab0f0d3f5775b Merge: 543aa1c 574846d Author: Michael Snoyman Date: Tue Jan 26 13:03:26 2016 +0200 Merge pull request #52 from Mistuke/trac-11100-expose-part-of-create-pipe Trac 11100 expose part of create pipe >--------------------------------------------------------------- 296cbce6294316d6534b4449fc7ab0f0d3f5775b System/Process.hsc | 1 + System/Process/Internals.hs | 13 +++++++++++++ System/Process/Posix.hs | 6 ++++++ System/Process/Windows.hsc | 14 ++++++++++---- changelog.md | 6 ++++++ process.cabal | 2 +- 6 files changed, 37 insertions(+), 5 deletions(-) From git at git.haskell.org Thu Apr 7 13:24:33 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Apr 2016 13:24:33 +0000 (UTC) Subject: [commit: ghc] master: testsuite: One more 32-bit performance slip (06b7ce2) Message-ID: <20160407132433.D4B7D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/06b7ce21571cc6696ded6126098f0f596f4ba3ca/ghc >--------------------------------------------------------------- commit 06b7ce21571cc6696ded6126098f0f596f4ba3ca Author: Ben Gamari Date: Wed Apr 6 21:36:52 2016 +0200 testsuite: One more 32-bit performance slip (cherry picked from commit 6d36d8e19a7e9cf3d8e715b1820cb656e937e809) >--------------------------------------------------------------- 06b7ce21571cc6696ded6126098f0f596f4ba3ca testsuite/tests/perf/compiler/all.T | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index b3ae160..43aba27 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -731,13 +731,14 @@ test('T9872c', test('T9872d', [ only_ways(['normal']), compiler_stats_num_field('bytes allocated', - [(wordsize(64), 506691240, 5), + [(wordsize(64), 533359408, 5), # 2014-12-18 796071864 Initally created # 2014-12-18 739189056 Reduce type families even more eagerly # 2015-01-07 687562440 TrieMap leaf compression # 2015-03-17 726679784 tweak to solver; probably flattens more # 2016-02-08 534693648 Improved a bit by tyConRolesRepresentational # 2016-03-18 506691240 optimize Unify & zonking + # 2016-04-06 533359408 apparent regression (x86-64/Windows) (wordsize(32), 264566040, 5) # some date 328810212 # 2015-07-11 350369584 From git at git.haskell.org Thu Apr 7 13:24:36 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Apr 2016 13:24:36 +0000 (UTC) Subject: [commit: ghc] master: rts: Fix parsing of profiler selectors (535896e) Message-ID: <20160407132436.8EB833A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/535896e58f7fc8d89a5ff34629a3471eac529d93/ghc >--------------------------------------------------------------- commit 535896e58f7fc8d89a5ff34629a3471eac529d93 Author: Ben Gamari Date: Thu Apr 7 15:26:11 2016 +0200 rts: Fix parsing of profiler selectors 69822f0c5b67161b4d7558081bc94f6f3a7c5dbb broke this as it held on to a reference into the `arg` string, which is later freed. Humbug. Test Plan: Try using filtering Reviewers: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2090 GHC Trac Issues: #11810 >--------------------------------------------------------------- 535896e58f7fc8d89a5ff34629a3471eac529d93 rts/RtsFlags.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c index 3387355..7f0821a 100644 --- a/rts/RtsFlags.c +++ b/rts/RtsFlags.c @@ -1566,7 +1566,7 @@ static rtsBool read_heap_profiling_flag(const char *arg_in) // However, for sanity we want to guarantee const-correctness and parsing // really ought to be an immutable operation. To avoid rewriting the parser // we just operate on a temporary copy of the argument. - char *arg = strdup(arg_in); + const char *arg = strdup(arg_in); rtsBool error = rtsFalse; switch (arg[2]) { case '\0': @@ -1597,35 +1597,37 @@ static rtsBool read_heap_profiling_flag(const char *arg_in) if (!right) right = arg + strlen(arg); - *right = '\0'; + char *selector = strndup(left, right - left); switch (arg[2]) { case 'c': // cost centre label select - RtsFlags.ProfFlags.ccSelector = left; + RtsFlags.ProfFlags.ccSelector = selector; break; case 'C': - RtsFlags.ProfFlags.ccsSelector = left; + RtsFlags.ProfFlags.ccsSelector = selector; break; case 'M': case 'm': // cost centre module select - RtsFlags.ProfFlags.modSelector = left; + RtsFlags.ProfFlags.modSelector = selector; break; case 'D': case 'd': // closure descr select - RtsFlags.ProfFlags.descrSelector = left; + RtsFlags.ProfFlags.descrSelector = selector; break; case 'Y': case 'y': // closure type select - RtsFlags.ProfFlags.typeSelector = left; + RtsFlags.ProfFlags.typeSelector = selector; break; case 'R': case 'r': // retainer select - RtsFlags.ProfFlags.retainerSelector = left; + RtsFlags.ProfFlags.retainerSelector = selector; break; case 'B': case 'b': // biography select - RtsFlags.ProfFlags.bioSelector = left; + RtsFlags.ProfFlags.bioSelector = selector; break; + default: + free(selector); } } break; From git at git.haskell.org Thu Apr 7 13:24:39 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Apr 2016 13:24:39 +0000 (UTC) Subject: [commit: ghc] master: Fix installation of static sphinx assets (6b6beba) Message-ID: <20160407132439.3CF743A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6b6bebaf2349c51343bec2b8fa0e80b7e42593a6/ghc >--------------------------------------------------------------- commit 6b6bebaf2349c51343bec2b8fa0e80b7e42593a6 Author: Ben Gamari Date: Wed Apr 6 23:40:44 2016 +0200 Fix installation of static sphinx assets Previously the `_static` and `_sources` directories were installed in the wrong parents. See #11803 >--------------------------------------------------------------- 6b6bebaf2349c51343bec2b8fa0e80b7e42593a6 ghc.mk | 8 +------- rules/sphinx.mk | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/ghc.mk b/ghc.mk index 4034a92..a9f5b06 100644 --- a/ghc.mk +++ b/ghc.mk @@ -950,14 +950,8 @@ ifneq "$(INSTALL_LIBRARY_DOCS)" "" $(INSTALL_SCRIPT) $(INSTALL_OPTS) libraries/gen_contents_index "$(DESTDIR)$(docdir)/html/libraries/" endif ifneq "$(INSTALL_HTML_DOC_DIRS)" "" -# We need to filter out the directories so install doesn't choke on them for i in $(INSTALL_HTML_DOC_DIRS); do \ - $(INSTALL_DIR) "$(DESTDIR)$(docdir)/html/`basename $$i`"; \ - for f in $$i/*; do \ - if test -f $$f; then \ - $(INSTALL_DOC) $(INSTALL_OPTS) "$$f" "$(DESTDIR)$(docdir)/html/`basename $$i`"; \ - fi \ - done \ + $(CP) -Rp $$i "$(DESTDIR)$(docdir)/html"; \ done endif diff --git a/rules/sphinx.mk b/rules/sphinx.mk index 7337242..52fbe28 100644 --- a/rules/sphinx.mk +++ b/rules/sphinx.mk @@ -31,7 +31,7 @@ $(call all-target,$1,) ifeq "$$(phase)" "final" ifeq "$$(BUILD_SPHINX_HTML)" "YES" $(call all-target,$1,html_$1) -INSTALL_HTML_DOC_DIRS += $1/build-html/$2 $1/build-html/$2/_static $1/build-html/$2/_sources +INSTALL_HTML_DOC_DIRS += $1/build-html/$2 endif endif From git at git.haskell.org Thu Apr 7 14:50:19 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Apr 2016 14:50:19 +0000 (UTC) Subject: [commit: ghc] wip/rae: Fix #11811. (2750798) Message-ID: <20160407145019.37D163A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rae Link : http://ghc.haskell.org/trac/ghc/changeset/275079845e9bd9465cb53cf734b880f8f5e6a0ac/ghc >--------------------------------------------------------------- commit 275079845e9bd9465cb53cf734b880f8f5e6a0ac Author: Richard Eisenberg Date: Thu Apr 7 16:44:06 2016 +0200 Fix #11811. Previously, I had forgotten to omit variables already in scope from the TypeInType CUSK check. Simple enough to fix. Test case: typecheck/should_compile/T11811 >--------------------------------------------------------------- 275079845e9bd9465cb53cf734b880f8f5e6a0ac compiler/rename/RnSource.hs | 4 +++- compiler/rename/RnTypes.hs | 13 +++++++------ testsuite/tests/typecheck/should_compile/T11811.hs | 8 ++++++++ testsuite/tests/typecheck/should_compile/all.T | 1 + 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/compiler/rename/RnSource.hs b/compiler/rename/RnSource.hs index 03d65ef..989f7f0 100644 --- a/compiler/rename/RnSource.hs +++ b/compiler/rename/RnSource.hs @@ -1410,7 +1410,9 @@ rnDataDefn doc (HsDataDefn { dd_ND = new_or_data, dd_cType = cType ; (m_sig', cusk, sig_fvs) <- case m_sig of Just sig -> do { fkvs <- freeKiTyVarsAllVars <$> - extractHsTyRdrTyVars sig + extractFilteredRdrTyVars sig + -- NB: filter out scoped vars, else + -- we get #11811 ; (sig', fvs) <- rnLHsKind doc sig ; return (Just sig', null fkvs, fvs) } Nothing -> return (Nothing, True, emptyFVs) diff --git a/compiler/rename/RnTypes.hs b/compiler/rename/RnTypes.hs index 7a9f75d..972004a 100644 --- a/compiler/rename/RnTypes.hs +++ b/compiler/rename/RnTypes.hs @@ -25,6 +25,7 @@ module RnTypes ( -- Binding related stuff bindLHsTyVarBndr, bindSigTyVarsFV, bindHsQTyVars, bindLRdrNames, + extractFilteredRdrTyVars, extractHsTyRdrTyVars, extractHsTysRdrTyVars, extractHsTysRdrTyVarsDups, rmDupsInRdrTyVars, extractRdrKindSigVars, extractDataDefnKindVars, @@ -104,7 +105,7 @@ rn_hs_sig_wc_type :: Bool -- see rnImplicitBndrs rn_hs_sig_wc_type no_implicit_if_forall ctxt (HsIB { hsib_body = wc_ty }) thing_inside = do { let hs_ty = hswc_body wc_ty - ; free_vars <- extract_filtered_rdr_ty_vars hs_ty + ; free_vars <- extractFilteredRdrTyVars hs_ty ; (free_vars', nwc_rdrs) <- partition_nwcs free_vars ; rnImplicitBndrs no_implicit_if_forall free_vars' hs_ty $ \ vars -> do { rn_hs_wc_type ctxt wc_ty nwc_rdrs $ \ wc_ty' -> @@ -113,7 +114,7 @@ rn_hs_sig_wc_type no_implicit_if_forall ctxt rnHsWcType :: HsDocContext -> LHsWcType RdrName -> RnM (LHsWcType Name, FreeVars) rnHsWcType ctxt wc_ty@(HsWC { hswc_body = hs_ty }) - = do { free_vars <- extract_filtered_rdr_ty_vars hs_ty + = do { free_vars <- extractFilteredRdrTyVars hs_ty ; (_, nwc_rdrs) <- partition_nwcs free_vars ; rn_hs_wc_type ctxt wc_ty nwc_rdrs $ \ wc_ty' -> return (wc_ty', emptyFVs) } @@ -197,13 +198,13 @@ rnWcSigContext env (L loc hs_ctxt) rn_top_constraint = rnLHsTyKi (env { rtke_what = RnTopConstraint }) --- | extract_filtered finds free type and kind variables in a type, +-- | Finds free type and kind variables in a type, -- without duplicates, and -- without variables that are already in scope in LocalRdrEnv -- NB: this includes named wildcards, which look like perfectly -- ordinary type variables at this point -extract_filtered_rdr_ty_vars :: LHsType RdrName -> RnM FreeKiTyVars -extract_filtered_rdr_ty_vars hs_ty +extractFilteredRdrTyVars :: LHsType RdrName -> RnM FreeKiTyVars +extractFilteredRdrTyVars hs_ty = do { rdr_env <- getLocalRdrEnv ; filterInScope rdr_env <$> extractHsTyRdrTyVars hs_ty } @@ -248,7 +249,7 @@ rnHsSigType :: HsDocContext -> LHsSigType RdrName -- Used for source-language type signatures -- that cannot have wildcards rnHsSigType ctx (HsIB { hsib_body = hs_ty }) - = do { vars <- extract_filtered_rdr_ty_vars hs_ty + = do { vars <- extractFilteredRdrTyVars hs_ty ; rnImplicitBndrs True vars hs_ty $ \ vars -> do { (body', fvs) <- rnLHsType ctx hs_ty ; return (HsIB { hsib_vars = vars diff --git a/testsuite/tests/typecheck/should_compile/T11811.hs b/testsuite/tests/typecheck/should_compile/T11811.hs new file mode 100644 index 0000000..16a225b --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T11811.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE TypeInType, GADTs #-} + +module T11811 where + +import Data.Kind + +data Test (a :: x) (b :: x) :: x -> * + where K :: Test Int Bool Double diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index 0d99284..bd973f1 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -511,3 +511,4 @@ test('T11401', normal, compile, ['']) test('T11699', normal, compile, ['']) test('T11512', normal, compile, ['']) test('T11754', normal, compile, ['']) +test('T11811', normal, compile, ['']) From git at git.haskell.org Thu Apr 7 14:50:22 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Apr 2016 14:50:22 +0000 (UTC) Subject: [commit: ghc] wip/rae: Fix #11797. (4284193) Message-ID: <20160407145022.A65FC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rae Link : http://ghc.haskell.org/trac/ghc/changeset/4284193c5dc22c6db3d97a49658829be5fe0076d/ghc >--------------------------------------------------------------- commit 4284193c5dc22c6db3d97a49658829be5fe0076d Author: Richard Eisenberg Date: Wed Apr 6 16:37:22 2016 +0200 Fix #11797. DsMeta curiously omitted quantified tyvars in certain circumstances. This patch means it doesn't. Test case: th/T11797 >--------------------------------------------------------------- 4284193c5dc22c6db3d97a49658829be5fe0076d compiler/deSugar/DsMeta.hs | 13 +++++++------ testsuite/tests/th/T11797.hs | 14 ++++++++++++++ testsuite/tests/th/T11797.stderr | 2 ++ testsuite/tests/th/all.T | 1 + 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/compiler/deSugar/DsMeta.hs b/compiler/deSugar/DsMeta.hs index 84f1a9c..3bc4ae9 100644 --- a/compiler/deSugar/DsMeta.hs +++ b/compiler/deSugar/DsMeta.hs @@ -872,12 +872,9 @@ repContext ctxt = do preds <- repList typeQTyConName repLTy ctxt repCtxt preds repHsSigType :: LHsSigType Name -> DsM (Core TH.TypeQ) -repHsSigType ty = repLTy (hsSigType ty) - -repHsSigWcType :: LHsSigWcType Name -> DsM (Core TH.TypeQ) -repHsSigWcType (HsIB { hsib_vars = vars - , hsib_body = sig1 }) - | (explicit_tvs, ctxt, ty) <- splitLHsSigmaTy (hswc_body sig1) +repHsSigType (HsIB { hsib_vars = vars + , hsib_body = body }) + | (explicit_tvs, ctxt, ty) <- splitLHsSigmaTy body = addTyVarBinds (HsQTvs { hsq_implicit = [] , hsq_explicit = map (noLoc . UserTyVar . noLoc) vars ++ explicit_tvs @@ -889,6 +886,10 @@ repHsSigWcType (HsIB { hsib_vars = vars then return th_ty else repTForall th_tvs th_ctxt th_ty } +repHsSigWcType :: LHsSigWcType Name -> DsM (Core TH.TypeQ) +repHsSigWcType ib_ty@(HsIB { hsib_body = sig1 }) + = repHsSigType (ib_ty { hsib_body = hswc_body sig1 }) + -- yield the representation of a list of types -- repLTys :: [LHsType Name] -> DsM [Core TH.TypeQ] diff --git a/testsuite/tests/th/T11797.hs b/testsuite/tests/th/T11797.hs new file mode 100644 index 0000000..0ee0a04 --- /dev/null +++ b/testsuite/tests/th/T11797.hs @@ -0,0 +1,14 @@ +{-# LANGUAGE TemplateHaskell #-} + +module T11797 where + +import Language.Haskell.TH +import System.IO + +$(do dec <- [d| class Foo a where + meth :: a -> b -> a |] + runIO $ do putStrLn $ pprint dec + hFlush stdout + return [] ) + +-- the key bit is the forall b. in the type of the method diff --git a/testsuite/tests/th/T11797.stderr b/testsuite/tests/th/T11797.stderr new file mode 100644 index 0000000..1b43982 --- /dev/null +++ b/testsuite/tests/th/T11797.stderr @@ -0,0 +1,2 @@ +class Foo_0 a_1 + where meth_2 :: forall b_3 . a_1 -> b_3 -> a_1 diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index 3939880..c182479 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -397,3 +397,4 @@ test('T10603', normal, compile, ['-ddump-splices -dsuppress-uniques']) test('T11452', normal, compile_fail, ['-v0']) test('T9022', normal, compile_and_run, ['-v0']) test('T11145', normal, compile_fail, ['-v0 -dsuppress-uniques']) +test('T11797', normal, compile, ['-v0 -dsuppress-uniques']) From git at git.haskell.org Thu Apr 7 14:50:25 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Apr 2016 14:50:25 +0000 (UTC) Subject: [commit: ghc] wip/rae: Increase InScopeSet in mkCastTy (cdcd101) Message-ID: <20160407145025.658233A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rae Link : http://ghc.haskell.org/trac/ghc/changeset/cdcd101428fc528b03c233ed60122ce4a93bf46f/ghc >--------------------------------------------------------------- commit cdcd101428fc528b03c233ed60122ce4a93bf46f Author: Richard Eisenberg Date: Wed Apr 6 15:24:34 2016 +0200 Increase InScopeSet in mkCastTy Unfortunately, I was unable to make a small test case that tickled the bug. But it was clearly wrong the way it was. >--------------------------------------------------------------- cdcd101428fc528b03c233ed60122ce4a93bf46f compiler/types/Type.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/types/Type.hs b/compiler/types/Type.hs index c5561a3..8901968 100644 --- a/compiler/types/Type.hs +++ b/compiler/types/Type.hs @@ -1084,9 +1084,9 @@ mkCastTy ty co | isReflexiveCo co = ty mkCastTy (CastTy ty co1) co2 = mkCastTy ty (co1 `mkTransCo` co2) -- See Note [Weird typing rule for ForAllTy] -mkCastTy (ForAllTy (Named tv vis) inner_ty) co +mkCastTy outer_ty@(ForAllTy (Named tv vis) inner_ty) co = -- have to make sure that pushing the co in doesn't capture the bound var - let fvs = tyCoVarsOfCo co + let fvs = tyCoVarsOfCo co `unionVarSet` tyCoVarsOfType outer_ty empty_subst = mkEmptyTCvSubst (mkInScopeSet fvs) (subst, tv') = substTyVarBndr empty_subst tv in From git at git.haskell.org Thu Apr 7 19:16:37 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 7 Apr 2016 19:16:37 +0000 (UTC) Subject: [commit: ghc] master: Revert "testsuite: One more 32-bit performance slip" (2bcf0c3) Message-ID: <20160407191637.D0C893A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2bcf0c3a4a16f835b1f71086edb470bf2a8cd61b/ghc >--------------------------------------------------------------- commit 2bcf0c3a4a16f835b1f71086edb470bf2a8cd61b Author: Ben Gamari Date: Thu Apr 7 21:18:58 2016 +0200 Revert "testsuite: One more 32-bit performance slip" This reverts commit 06b7ce21571cc6696ded6126098f0f596f4ba3ca. >--------------------------------------------------------------- 2bcf0c3a4a16f835b1f71086edb470bf2a8cd61b testsuite/tests/perf/compiler/all.T | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index 43aba27..b3ae160 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -731,14 +731,13 @@ test('T9872c', test('T9872d', [ only_ways(['normal']), compiler_stats_num_field('bytes allocated', - [(wordsize(64), 533359408, 5), + [(wordsize(64), 506691240, 5), # 2014-12-18 796071864 Initally created # 2014-12-18 739189056 Reduce type families even more eagerly # 2015-01-07 687562440 TrieMap leaf compression # 2015-03-17 726679784 tweak to solver; probably flattens more # 2016-02-08 534693648 Improved a bit by tyConRolesRepresentational # 2016-03-18 506691240 optimize Unify & zonking - # 2016-04-06 533359408 apparent regression (x86-64/Windows) (wordsize(32), 264566040, 5) # some date 328810212 # 2015-07-11 350369584 From git at git.haskell.org Fri Apr 8 06:35:11 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 8 Apr 2016 06:35:11 +0000 (UTC) Subject: [commit: ghc] branch 'wip/D2092' created Message-ID: <20160408063511.B39043A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/D2092 Referencing: 3350f6df13470bf32b9addb45991bbb5b3ba0df4 From git at git.haskell.org Fri Apr 8 06:35:14 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 8 Apr 2016 06:35:14 +0000 (UTC) Subject: [commit: ghc] wip/D2092: GHC.Base: Use thenIO in instance Applicative IO (3350f6d) Message-ID: <20160408063514.73BF63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/D2092 Link : http://ghc.haskell.org/trac/ghc/changeset/3350f6df13470bf32b9addb45991bbb5b3ba0df4/ghc >--------------------------------------------------------------- commit 3350f6df13470bf32b9addb45991bbb5b3ba0df4 Author: Joachim Breitner Date: Fri Apr 8 08:33:35 2016 +0200 GHC.Base: Use thenIO in instance Applicative IO Since recent changes to CSE, the previous definition were no longer CSEd with thenIO, which resulted in extra steps in the simplifier and hence slightly larger compile times. See ticket:11781#comment:7. >--------------------------------------------------------------- 3350f6df13470bf32b9addb45991bbb5b3ba0df4 libraries/base/GHC/Base.hs | 6 +++--- testsuite/tests/perf/compiler/all.T | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/libraries/base/GHC/Base.hs b/libraries/base/GHC/Base.hs index 89c9f63..618fa05 100644 --- a/libraries/base/GHC/Base.hs +++ b/libraries/base/GHC/Base.hs @@ -1086,9 +1086,9 @@ instance Functor IO where instance Applicative IO where {-# INLINE pure #-} {-# INLINE (*>) #-} - pure = returnIO - m *> k = m >>= \ _ -> k - (<*>) = ap + pure = returnIO + (*>) = thenIO + (<*>) = ap instance Monad IO where {-# INLINE (>>) #-} diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index b3ae160..022ed92 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -624,7 +624,7 @@ test('T9020', [(wordsize(32), 343005716, 10), # Original: 381360728 # 2014-07-31: 343005716 (Windows) (general round of updates) - (wordsize(64), 852298336, 10)]) + (wordsize(64), 698401736, 10)]) # prev: 795469104 # 2014-07-17: 728263536 (general round of updates) # 2014-09-10: 785871680 post-AMP-cleanup @@ -632,6 +632,7 @@ test('T9020', # 2015-10-21: 786189008 Make stronglyConnCompFromEdgedVertices deterministic # 2016-01-26: 698401736 improvement from using ExpTypes instead of ReturnTvs # 2016-04-06: 852298336 Refactoring of CSE #11781 + # 2016-04-06: 698401736 Use thenIO in Applicative IO ], compile,['']) From git at git.haskell.org Fri Apr 8 06:36:01 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 8 Apr 2016 06:36:01 +0000 (UTC) Subject: [commit: ghc] wip/D2092: GHC.Base: Use thenIO in instance Applicative IO (eca8648) Message-ID: <20160408063601.41B273A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/D2092 Link : http://ghc.haskell.org/trac/ghc/changeset/eca86485cdd8441bf50f34133553b630a2baa7f3/ghc >--------------------------------------------------------------- commit eca86485cdd8441bf50f34133553b630a2baa7f3 Author: Joachim Breitner Date: Fri Apr 8 08:33:35 2016 +0200 GHC.Base: Use thenIO in instance Applicative IO Since recent changes to CSE, the previous definition were no longer CSEd with thenIO, which resulted in extra steps in the simplifier and hence slightly larger compile times. See ticket:11781#comment:7. Differential Revision: https://phabricator.haskell.org/D2092 >--------------------------------------------------------------- eca86485cdd8441bf50f34133553b630a2baa7f3 libraries/base/GHC/Base.hs | 6 +++--- testsuite/tests/perf/compiler/all.T | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/libraries/base/GHC/Base.hs b/libraries/base/GHC/Base.hs index 89c9f63..618fa05 100644 --- a/libraries/base/GHC/Base.hs +++ b/libraries/base/GHC/Base.hs @@ -1086,9 +1086,9 @@ instance Functor IO where instance Applicative IO where {-# INLINE pure #-} {-# INLINE (*>) #-} - pure = returnIO - m *> k = m >>= \ _ -> k - (<*>) = ap + pure = returnIO + (*>) = thenIO + (<*>) = ap instance Monad IO where {-# INLINE (>>) #-} diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index b3ae160..022ed92 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -624,7 +624,7 @@ test('T9020', [(wordsize(32), 343005716, 10), # Original: 381360728 # 2014-07-31: 343005716 (Windows) (general round of updates) - (wordsize(64), 852298336, 10)]) + (wordsize(64), 698401736, 10)]) # prev: 795469104 # 2014-07-17: 728263536 (general round of updates) # 2014-09-10: 785871680 post-AMP-cleanup @@ -632,6 +632,7 @@ test('T9020', # 2015-10-21: 786189008 Make stronglyConnCompFromEdgedVertices deterministic # 2016-01-26: 698401736 improvement from using ExpTypes instead of ReturnTvs # 2016-04-06: 852298336 Refactoring of CSE #11781 + # 2016-04-06: 698401736 Use thenIO in Applicative IO ], compile,['']) From git at git.haskell.org Fri Apr 8 08:21:11 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 8 Apr 2016 08:21:11 +0000 (UTC) Subject: [commit: ghc] master's head updated: GHC.Base: Use thenIO in instance Applicative IO (eca8648) Message-ID: <20160408082111.BB44D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'master' now includes: eca8648 GHC.Base: Use thenIO in instance Applicative IO From git at git.haskell.org Fri Apr 8 08:21:18 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 8 Apr 2016 08:21:18 +0000 (UTC) Subject: [commit: ghc] branch 'wip/D2092' deleted Message-ID: <20160408082118.59A4D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Deleted branch: wip/D2092 From git at git.haskell.org Fri Apr 8 09:16:32 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 8 Apr 2016 09:16:32 +0000 (UTC) Subject: [commit: ghc] master: Remove obsolete comment about the implementation of foldl (f0af351) Message-ID: <20160408091632.BB55F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f0af351d4a0760751e94f626c46c09def0675c94/ghc >--------------------------------------------------------------- commit f0af351d4a0760751e94f626c46c09def0675c94 Author: Joachim Breitner Date: Fri Apr 8 11:09:26 2016 +0200 Remove obsolete comment about the implementation of foldl >--------------------------------------------------------------- f0af351d4a0760751e94f626c46c09def0675c94 libraries/base/GHC/List.hs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/libraries/base/GHC/List.hs b/libraries/base/GHC/List.hs index 92ded0d..2ef0105 100644 --- a/libraries/base/GHC/List.hs +++ b/libraries/base/GHC/List.hs @@ -182,10 +182,6 @@ filterFB c p x r | p x = x `c` r -- -- The list must be finite. --- We write foldl as a non-recursive thing, so that it --- can be inlined, and then (often) strictness-analysed, --- and hence the classic space leak on foldl (+) 0 xs - foldl :: forall a b. (b -> a -> b) -> b -> [a] -> b {-# INLINE foldl #-} foldl k z0 xs = From git at git.haskell.org Fri Apr 8 09:38:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 8 Apr 2016 09:38:03 +0000 (UTC) Subject: [commit: ghc] wip/rae: Fix #11811. (997b940) Message-ID: <20160408093803.3DA883A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rae Link : http://ghc.haskell.org/trac/ghc/changeset/997b94035fda170734be7864dff49b4c6079f2ba/ghc >--------------------------------------------------------------- commit 997b94035fda170734be7864dff49b4c6079f2ba Author: Richard Eisenberg Date: Thu Apr 7 16:44:06 2016 +0200 Fix #11811. Previously, I had forgotten to omit variables already in scope from the TypeInType CUSK check. Simple enough to fix. Test case: typecheck/should_compile/T11811 >--------------------------------------------------------------- 997b94035fda170734be7864dff49b4c6079f2ba compiler/hsSyn/HsDecls.hs | 2 ++ compiler/rename/RnSource.hs | 37 +++++++++++----------- compiler/rename/RnTypes.hs | 29 ++++++++++------- testsuite/tests/typecheck/should_compile/T11811.hs | 8 +++++ testsuite/tests/typecheck/should_compile/all.T | 1 + 5 files changed, 46 insertions(+), 31 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 997b94035fda170734be7864dff49b4c6079f2ba From git at git.haskell.org Fri Apr 8 09:38:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 8 Apr 2016 09:38:06 +0000 (UTC) Subject: [commit: ghc] wip/rae: Fix #11797. (c9f1012) Message-ID: <20160408093806.AA9893A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rae Link : http://ghc.haskell.org/trac/ghc/changeset/c9f1012d79aabeb6a902a4f79db80eaffa6c234f/ghc >--------------------------------------------------------------- commit c9f1012d79aabeb6a902a4f79db80eaffa6c234f Author: Richard Eisenberg Date: Wed Apr 6 16:37:22 2016 +0200 Fix #11797. DsMeta curiously omitted quantified tyvars in certain circumstances. This patch means it doesn't. Test case: th/T11797 >--------------------------------------------------------------- c9f1012d79aabeb6a902a4f79db80eaffa6c234f compiler/deSugar/DsMeta.hs | 13 +++++++------ testsuite/tests/th/T11797.hs | 14 ++++++++++++++ testsuite/tests/th/T11797.stderr | 2 ++ testsuite/tests/th/all.T | 1 + 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/compiler/deSugar/DsMeta.hs b/compiler/deSugar/DsMeta.hs index 84f1a9c..3bc4ae9 100644 --- a/compiler/deSugar/DsMeta.hs +++ b/compiler/deSugar/DsMeta.hs @@ -872,12 +872,9 @@ repContext ctxt = do preds <- repList typeQTyConName repLTy ctxt repCtxt preds repHsSigType :: LHsSigType Name -> DsM (Core TH.TypeQ) -repHsSigType ty = repLTy (hsSigType ty) - -repHsSigWcType :: LHsSigWcType Name -> DsM (Core TH.TypeQ) -repHsSigWcType (HsIB { hsib_vars = vars - , hsib_body = sig1 }) - | (explicit_tvs, ctxt, ty) <- splitLHsSigmaTy (hswc_body sig1) +repHsSigType (HsIB { hsib_vars = vars + , hsib_body = body }) + | (explicit_tvs, ctxt, ty) <- splitLHsSigmaTy body = addTyVarBinds (HsQTvs { hsq_implicit = [] , hsq_explicit = map (noLoc . UserTyVar . noLoc) vars ++ explicit_tvs @@ -889,6 +886,10 @@ repHsSigWcType (HsIB { hsib_vars = vars then return th_ty else repTForall th_tvs th_ctxt th_ty } +repHsSigWcType :: LHsSigWcType Name -> DsM (Core TH.TypeQ) +repHsSigWcType ib_ty@(HsIB { hsib_body = sig1 }) + = repHsSigType (ib_ty { hsib_body = hswc_body sig1 }) + -- yield the representation of a list of types -- repLTys :: [LHsType Name] -> DsM [Core TH.TypeQ] diff --git a/testsuite/tests/th/T11797.hs b/testsuite/tests/th/T11797.hs new file mode 100644 index 0000000..0ee0a04 --- /dev/null +++ b/testsuite/tests/th/T11797.hs @@ -0,0 +1,14 @@ +{-# LANGUAGE TemplateHaskell #-} + +module T11797 where + +import Language.Haskell.TH +import System.IO + +$(do dec <- [d| class Foo a where + meth :: a -> b -> a |] + runIO $ do putStrLn $ pprint dec + hFlush stdout + return [] ) + +-- the key bit is the forall b. in the type of the method diff --git a/testsuite/tests/th/T11797.stderr b/testsuite/tests/th/T11797.stderr new file mode 100644 index 0000000..1b43982 --- /dev/null +++ b/testsuite/tests/th/T11797.stderr @@ -0,0 +1,2 @@ +class Foo_0 a_1 + where meth_2 :: forall b_3 . a_1 -> b_3 -> a_1 diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index 3939880..c182479 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -397,3 +397,4 @@ test('T10603', normal, compile, ['-ddump-splices -dsuppress-uniques']) test('T11452', normal, compile_fail, ['-v0']) test('T9022', normal, compile_and_run, ['-v0']) test('T11145', normal, compile_fail, ['-v0 -dsuppress-uniques']) +test('T11797', normal, compile, ['-v0 -dsuppress-uniques']) From git at git.haskell.org Fri Apr 8 09:38:09 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 8 Apr 2016 09:38:09 +0000 (UTC) Subject: [commit: ghc] wip/rae: Fix #11814 by throwing more stuff into InScopeSets (80d6e9c) Message-ID: <20160408093809.666973A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rae Link : http://ghc.haskell.org/trac/ghc/changeset/80d6e9c0cce56669f13f2f75bd26471d868dbd74/ghc >--------------------------------------------------------------- commit 80d6e9c0cce56669f13f2f75bd26471d868dbd74 Author: Richard Eisenberg Date: Wed Apr 6 15:24:34 2016 +0200 Fix #11814 by throwing more stuff into InScopeSets >--------------------------------------------------------------- 80d6e9c0cce56669f13f2f75bd26471d868dbd74 compiler/stranal/WwLib.hs | 5 ++++- compiler/types/Type.hs | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/compiler/stranal/WwLib.hs b/compiler/stranal/WwLib.hs index 7c85036..4ec36ba 100644 --- a/compiler/stranal/WwLib.hs +++ b/compiler/stranal/WwLib.hs @@ -22,6 +22,7 @@ import MkCore ( mkRuntimeErrorApp, aBSENT_ERROR_ID, mkCoreUbxTup ) import MkId ( voidArgId, voidPrimId ) import TysPrim ( voidPrimTy ) import TysWiredIn ( tupleDataCon ) +import VarEnv ( mkInScopeSet ) import Type import Coercion import FamInstEnv @@ -127,7 +128,9 @@ mkWwBodies :: DynFlags -- E mkWwBodies dflags fam_envs fun_ty demands res_info - = do { (wrap_args, wrap_fn_args, work_fn_args, res_ty) <- mkWWargs emptyTCvSubst fun_ty demands + = do { let empty_subst = mkEmptyTCvSubst (mkInScopeSet (tyCoVarsOfType fun_ty)) + + ; (wrap_args, wrap_fn_args, work_fn_args, res_ty) <- mkWWargs empty_subst fun_ty demands ; (useful1, work_args, wrap_fn_str, work_fn_str) <- mkWWstr dflags fam_envs wrap_args -- Do CPR w/w. See Note [Always do CPR w/w] diff --git a/compiler/types/Type.hs b/compiler/types/Type.hs index c5561a3..8901968 100644 --- a/compiler/types/Type.hs +++ b/compiler/types/Type.hs @@ -1084,9 +1084,9 @@ mkCastTy ty co | isReflexiveCo co = ty mkCastTy (CastTy ty co1) co2 = mkCastTy ty (co1 `mkTransCo` co2) -- See Note [Weird typing rule for ForAllTy] -mkCastTy (ForAllTy (Named tv vis) inner_ty) co +mkCastTy outer_ty@(ForAllTy (Named tv vis) inner_ty) co = -- have to make sure that pushing the co in doesn't capture the bound var - let fvs = tyCoVarsOfCo co + let fvs = tyCoVarsOfCo co `unionVarSet` tyCoVarsOfType outer_ty empty_subst = mkEmptyTCvSubst (mkInScopeSet fvs) (subst, tv') = substTyVarBndr empty_subst tv in From git at git.haskell.org Fri Apr 8 09:38:12 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 8 Apr 2016 09:38:12 +0000 (UTC) Subject: [commit: ghc] wip/rae: Teach lookupLocalRdrEnv about Exacts. (#11813) (254aad2) Message-ID: <20160408093812.3DB733A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rae Link : http://ghc.haskell.org/trac/ghc/changeset/254aad24b6e05928477d4d16108b0e12bcc89f4f/ghc >--------------------------------------------------------------- commit 254aad24b6e05928477d4d16108b0e12bcc89f4f Author: Richard Eisenberg Date: Fri Apr 8 08:01:34 2016 +0200 Teach lookupLocalRdrEnv about Exacts. (#11813) >--------------------------------------------------------------- 254aad24b6e05928477d4d16108b0e12bcc89f4f compiler/basicTypes/RdrName.hs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/compiler/basicTypes/RdrName.hs b/compiler/basicTypes/RdrName.hs index 62f473e..282628a 100644 --- a/compiler/basicTypes/RdrName.hs +++ b/compiler/basicTypes/RdrName.hs @@ -357,8 +357,17 @@ extendLocalRdrEnvList lre@(LRE { lre_env = env, lre_in_scope = ns }) names , lre_in_scope = extendNameSetList ns names } lookupLocalRdrEnv :: LocalRdrEnv -> RdrName -> Maybe Name -lookupLocalRdrEnv (LRE { lre_env = env }) (Unqual occ) = lookupOccEnv env occ -lookupLocalRdrEnv _ _ = Nothing +lookupLocalRdrEnv (LRE { lre_env = env, lre_in_scope = ns }) rdr + | Unqual occ <- rdr + = lookupOccEnv env occ + + -- See Note [Local bindings with Exact Names] + | Exact name <- rdr + , name `elemNameSet` ns + = Just name + + | otherwise + = Nothing lookupLocalRdrOcc :: LocalRdrEnv -> OccName -> Maybe Name lookupLocalRdrOcc (LRE { lre_env = env }) occ = lookupOccEnv env occ From git at git.haskell.org Fri Apr 8 09:38:14 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 8 Apr 2016 09:38:14 +0000 (UTC) Subject: [commit: ghc] wip/rae's head updated: Teach lookupLocalRdrEnv about Exacts. (#11813) (254aad2) Message-ID: <20160408093814.6A3573A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/rae' now includes: 351f976 T10272, T4340: Add 32-bit output 726cbc2 T10870: Skip on 32-bit architectures 1a8d61c testsuite: Update 32-bit performance numbers 2265c84 Core pretty printer: Omit wild case binders 5b986a4 CSE code cleanup and improvement 0f58d34 Demand Analyzer: Do not set OneShot information (second try) c9e8f80 Set tct_closed to TopLevel for closed bindings. eda273b runtime: replace hw.ncpu with hw.logicalcpu for Mac OS X 27528b3 Adjust performance numbers 06b7ce2 testsuite: One more 32-bit performance slip 6b6beba Fix installation of static sphinx assets 535896e rts: Fix parsing of profiler selectors 2bcf0c3 Revert "testsuite: One more 32-bit performance slip" eca8648 GHC.Base: Use thenIO in instance Applicative IO f0af351 Remove obsolete comment about the implementation of foldl 997b940 Fix #11811. c9f1012 Fix #11797. 80d6e9c Fix #11814 by throwing more stuff into InScopeSets 254aad2 Teach lookupLocalRdrEnv about Exacts. (#11813) From git at git.haskell.org Fri Apr 8 15:16:41 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 8 Apr 2016 15:16:41 +0000 (UTC) Subject: [commit: ghc] master: Fix a comment: triple -> tuple (f9d26e5) Message-ID: <20160408151641.E73B83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f9d26e58b1c31a446f46ea89b26cb7ad6b273056/ghc >--------------------------------------------------------------- commit f9d26e58b1c31a446f46ea89b26cb7ad6b273056 Author: Bartosz Nitka Date: Fri Apr 8 08:17:58 2016 -0700 Fix a comment: triple -> tuple Someone must have forgotten to change this. >--------------------------------------------------------------- f9d26e58b1c31a446f46ea89b26cb7ad6b273056 compiler/coreSyn/CoreUtils.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/coreSyn/CoreUtils.hs b/compiler/coreSyn/CoreUtils.hs index 1d9b83b..82be8d9 100644 --- a/compiler/coreSyn/CoreUtils.hs +++ b/compiler/coreSyn/CoreUtils.hs @@ -1515,7 +1515,7 @@ dataConInstPat :: [FastString] -- A long enough list of FSs to use for -> DataCon -> [Type] -- Types to instantiate the universally quantified tyvars -> ([TyVar], [Id]) -- Return instantiated variables --- dataConInstPat arg_fun fss us con inst_tys returns a triple +-- dataConInstPat arg_fun fss us con inst_tys returns a tuple -- (ex_tvs, arg_ids), -- -- ex_tvs are intended to be used as binders for existential type args From git at git.haskell.org Sun Apr 10 11:53:29 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 10 Apr 2016 11:53:29 +0000 (UTC) Subject: [commit: ghc] master: Refactor comments about shutdown (485608d) Message-ID: <20160410115329.29E2F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/485608d341d5e932fb2f69e3e2bce51a5b34b1b8/ghc >--------------------------------------------------------------- commit 485608d341d5e932fb2f69e3e2bce51a5b34b1b8 Author: Simon Marlow Date: Wed May 27 12:08:17 2015 +0100 Refactor comments about shutdown >--------------------------------------------------------------- 485608d341d5e932fb2f69e3e2bce51a5b34b1b8 rts/Schedule.c | 34 +++++++++++++++++++--------------- rts/Schedule.h | 5 ++--- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/rts/Schedule.c b/rts/Schedule.c index 89c5cde..31ee99a 100644 --- a/rts/Schedule.c +++ b/rts/Schedule.c @@ -205,7 +205,7 @@ schedule (Capability *initialCapability, Task *task) stg_exit(EXIT_FAILURE); } - // The interruption / shutdown sequence. + // Note [shutdown]: The interruption / shutdown sequence. // // In order to cleanly shut down the runtime, we want to: // * make sure that all main threads return to their callers @@ -213,21 +213,25 @@ schedule (Capability *initialCapability, Task *task) // * clean up all OS threads assocated with the runtime // * free all memory etc. // - // So the sequence for ^C goes like this: + // So the sequence goes like this: // - // * ^C handler sets sched_state := SCHED_INTERRUPTING and - // arranges for some Capability to wake up + // * The shutdown sequence is initiated by calling hs_exit(), + // interruptStgRts(), or running out of memory in the GC. // - // * all threads in the system are halted, and the zombies are - // placed on the run queue for cleaning up. We acquire all - // the capabilities in order to delete the threads, this is - // done by scheduleDoGC() for convenience (because GC already - // needs to acquire all the capabilities). We can't kill - // threads involved in foreign calls. + // * Set sched_state = SCHED_INTERRUPTING // - // * somebody calls shutdownHaskell(), which calls exitScheduler() + // * The scheduler notices sched_state = SCHED_INTERRUPTING and calls + // scheduleDoGC(), which halts the whole runtime by acquiring all the + // capabilities, does a GC and then calls deleteAllThreads() to kill all + // the remaining threads. The zombies are left on the run queue for + // cleaning up. We can't kill threads involved in foreign calls. // - // * sched_state := SCHED_SHUTTING_DOWN + // * scheduleDoGC() sets sched_state = SCHED_SHUTTING_DOWN + // + // * After this point, there can be NO MORE HASKELL EXECUTION. This is + // enforced by the scheduler, which won't run any Haskell code when + // sched_state >= SCHED_INTERRUPTING, and we already sync'd with the + // other capabilities by doing the GC earlier. // // * all workers exit when the run queue on their capability // drains. All main threads will also exit when their TSO @@ -237,7 +241,7 @@ schedule (Capability *initialCapability, Task *task) // exit. // // * We might be left with threads blocked in foreign calls, - // we should really attempt to kill these somehow (TODO); + // we should really attempt to kill these somehow (TODO). switch (sched_state) { case SCHED_RUNNING: @@ -2564,8 +2568,8 @@ performMajorGC(void) } /* --------------------------------------------------------------------------- - Interrupt execution - - usually called inside a signal handler so it mustn't do anything fancy. + Interrupt execution. + Might be called inside a signal handler so it mustn't do anything fancy. ------------------------------------------------------------------------ */ void diff --git a/rts/Schedule.h b/rts/Schedule.h index b6fbed4..03a78c9 100644 --- a/rts/Schedule.h +++ b/rts/Schedule.h @@ -51,11 +51,10 @@ StgWord findRetryFrameHelper (Capability *cap, StgTSO *tso); void scheduleWorker (Capability *cap, Task *task); /* The state of the scheduler. This is used to control the sequence - * of events during shutdown, and when the runtime is interrupted - * using ^C. + * of events during shutdown. See Note [shutdown] in Schedule.c. */ #define SCHED_RUNNING 0 /* running as normal */ -#define SCHED_INTERRUPTING 1 /* ^C detected, before threads are deleted */ +#define SCHED_INTERRUPTING 1 /* before threads are deleted */ #define SCHED_SHUTTING_DOWN 2 /* final shutdown */ extern volatile StgWord sched_state; From git at git.haskell.org Sun Apr 10 13:39:43 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 10 Apr 2016 13:39:43 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Fix installation of static sphinx assets (88e9816) Message-ID: <20160410133943.C6CCE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/88e9816f6c6d336f6fa6ef2fc7bab24537758637/ghc >--------------------------------------------------------------- commit 88e9816f6c6d336f6fa6ef2fc7bab24537758637 Author: Ben Gamari Date: Wed Apr 6 23:40:44 2016 +0200 Fix installation of static sphinx assets Previously the `_static` and `_sources` directories were installed in the wrong parents. See #11803 (cherry picked from commit 6b6bebaf2349c51343bec2b8fa0e80b7e42593a6) >--------------------------------------------------------------- 88e9816f6c6d336f6fa6ef2fc7bab24537758637 ghc.mk | 8 +------- rules/sphinx.mk | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/ghc.mk b/ghc.mk index 5e4ecc6..44e2a23 100644 --- a/ghc.mk +++ b/ghc.mk @@ -952,14 +952,8 @@ ifneq "$(INSTALL_LIBRARY_DOCS)" "" $(INSTALL_SCRIPT) $(INSTALL_OPTS) libraries/gen_contents_index "$(DESTDIR)$(docdir)/html/libraries/" endif ifneq "$(INSTALL_HTML_DOC_DIRS)" "" -# We need to filter out the directories so install doesn't choke on them for i in $(INSTALL_HTML_DOC_DIRS); do \ - $(INSTALL_DIR) "$(DESTDIR)$(docdir)/html/`basename $$i`"; \ - for f in $$i/*; do \ - if test -f $$f; then \ - $(INSTALL_DOC) $(INSTALL_OPTS) "$$f" "$(DESTDIR)$(docdir)/html/`basename $$i`"; \ - fi \ - done \ + $(CP) -Rp $$i "$(DESTDIR)$(docdir)/html"; \ done endif diff --git a/rules/sphinx.mk b/rules/sphinx.mk index 7337242..52fbe28 100644 --- a/rules/sphinx.mk +++ b/rules/sphinx.mk @@ -31,7 +31,7 @@ $(call all-target,$1,) ifeq "$$(phase)" "final" ifeq "$$(BUILD_SPHINX_HTML)" "YES" $(call all-target,$1,html_$1) -INSTALL_HTML_DOC_DIRS += $1/build-html/$2 $1/build-html/$2/_static $1/build-html/$2/_sources +INSTALL_HTML_DOC_DIRS += $1/build-html/$2 endif endif From git at git.haskell.org Sun Apr 10 13:39:46 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 10 Apr 2016 13:39:46 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: rts: Fix parsing of profiler selectors (8735569) Message-ID: <20160410133946.789353A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/8735569d17902283d696251d59d76f10a5703351/ghc >--------------------------------------------------------------- commit 8735569d17902283d696251d59d76f10a5703351 Author: Ben Gamari Date: Thu Apr 7 15:26:11 2016 +0200 rts: Fix parsing of profiler selectors 69822f0c5b67161b4d7558081bc94f6f3a7c5dbb broke this as it held on to a reference into the `arg` string, which is later freed. Humbug. Test Plan: Try using filtering Reviewers: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2090 GHC Trac Issues: #11810 (cherry picked from commit 535896e58f7fc8d89a5ff34629a3471eac529d93) >--------------------------------------------------------------- 8735569d17902283d696251d59d76f10a5703351 rts/RtsFlags.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c index b497429..ed6f43e 100644 --- a/rts/RtsFlags.c +++ b/rts/RtsFlags.c @@ -1576,7 +1576,7 @@ static rtsBool read_heap_profiling_flag(const char *arg_in) // However, for sanity we want to guarantee const-correctness and parsing // really ought to be an immutable operation. To avoid rewriting the parser // we just operate on a temporary copy of the argument. - char *arg = strdup(arg_in); + const char *arg = strdup(arg_in); rtsBool error = rtsFalse; switch (arg[2]) { case '\0': @@ -1607,35 +1607,37 @@ static rtsBool read_heap_profiling_flag(const char *arg_in) if (!right) right = arg + strlen(arg); - *right = '\0'; + char *selector = strndup(left, right - left); switch (arg[2]) { case 'c': // cost centre label select - RtsFlags.ProfFlags.ccSelector = left; + RtsFlags.ProfFlags.ccSelector = selector; break; case 'C': - RtsFlags.ProfFlags.ccsSelector = left; + RtsFlags.ProfFlags.ccsSelector = selector; break; case 'M': case 'm': // cost centre module select - RtsFlags.ProfFlags.modSelector = left; + RtsFlags.ProfFlags.modSelector = selector; break; case 'D': case 'd': // closure descr select - RtsFlags.ProfFlags.descrSelector = left; + RtsFlags.ProfFlags.descrSelector = selector; break; case 'Y': case 'y': // closure type select - RtsFlags.ProfFlags.typeSelector = left; + RtsFlags.ProfFlags.typeSelector = selector; break; case 'R': case 'r': // retainer select - RtsFlags.ProfFlags.retainerSelector = left; + RtsFlags.ProfFlags.retainerSelector = selector; break; case 'B': case 'b': // biography select - RtsFlags.ProfFlags.bioSelector = left; + RtsFlags.ProfFlags.bioSelector = selector; break; + default: + free(selector); } } break; From git at git.haskell.org Sun Apr 10 21:39:35 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 10 Apr 2016 21:39:35 +0000 (UTC) Subject: [commit: ghc] master: Provide an optimized replicateM_ implementation #11795 (c4a7520) Message-ID: <20160410213935.0E7283A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c4a7520ef3a0b5e0e33d66ae1d628af93e0d7590/ghc >--------------------------------------------------------------- commit c4a7520ef3a0b5e0e33d66ae1d628af93e0d7590 Author: Michael Snoyman Date: Sun Apr 10 18:52:47 2016 +0200 Provide an optimized replicateM_ implementation #11795 In my testing, the worker/wrapper transformation applied here significantly decreases the number of allocations performed when using replicateM_. Additionally, this version of the function behaves correctly for negative numbers (namely, it will behave the same as replicateM_ 0, which is what previous versions of base have done). Reviewers: bgamari, simonpj, hvr, austin Reviewed By: bgamari, simonpj, austin Subscribers: nomeata, simonpj, mpickering, thomie Differential Revision: https://phabricator.haskell.org/D2086 GHC Trac Issues: #11795 >--------------------------------------------------------------- c4a7520ef3a0b5e0e33d66ae1d628af93e0d7590 libraries/base/Control/Monad.hs | 43 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/libraries/base/Control/Monad.hs b/libraries/base/Control/Monad.hs index 6957ad4..9d858bd 100644 --- a/libraries/base/Control/Monad.hs +++ b/libraries/base/Control/Monad.hs @@ -80,8 +80,8 @@ import Data.Functor ( void, (<$>) ) import Data.Traversable ( forM, mapM, traverse, sequence, sequenceA ) import GHC.Base hiding ( mapM, sequence ) -import GHC.Enum ( pred ) import GHC.List ( zipWith, unzip ) +import GHC.Num ( (-) ) -- ----------------------------------------------------------------------------- -- Functions mandated by the Prelude @@ -169,22 +169,55 @@ foldM_ :: (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m () {-# SPECIALISE foldM_ :: (a -> b -> Maybe a) -> a -> [b] -> Maybe () #-} foldM_ f a xs = foldlM f a xs >> return () +{- +Note [Worker/wrapper transform on replicateM/replicateM_ +-------------------------------------------------------- + +The implementations of replicateM and replicateM_ both leverage the +worker/wrapper transform. The simpler implementation of replicateM_, as an +example, would be: + + replicateM_ 0 _ = pure () + replicateM_ n f = f *> replicateM_ (n - 1) f + +However, the self-recrusive nature of this implementation inhibits inlining, +which means we never get to specialise to the action (`f` in the code above). +By contrast, the implementation below with a local loop makes it possible to +inline the entire definition (as hapens for foldr, for example) thereby +specialising for the particular action. + +For further information, see this Trac comment, which includes side-by-side +Core. + +https://ghc.haskell.org/trac/ghc/ticket/11795#comment:6 + +-} + -- | @'replicateM' n act@ performs the action @n@ times, -- gathering the results. replicateM :: (Applicative m) => Int -> m a -> m [a] {-# INLINEABLE replicateM #-} {-# SPECIALISE replicateM :: Int -> IO a -> IO [a] #-} {-# SPECIALISE replicateM :: Int -> Maybe a -> Maybe [a] #-} -replicateM 0 _ = pure [] -replicateM n x = liftA2 (:) x (replicateM (pred n) x) +replicateM cnt0 f = + loop cnt0 + where + loop cnt + | cnt <= 0 = pure [] + | otherwise = liftA2 (:) f (loop (cnt - 1)) -- | Like 'replicateM', but discards the result. replicateM_ :: (Applicative m) => Int -> m a -> m () {-# INLINEABLE replicateM_ #-} {-# SPECIALISE replicateM_ :: Int -> IO a -> IO () #-} {-# SPECIALISE replicateM_ :: Int -> Maybe a -> Maybe () #-} -replicateM_ 0 _ = pure () -replicateM_ n x = x *> replicateM_ (pred n) x +replicateM_ cnt0 f = + loop cnt0 + where + loop cnt + | cnt <= 0 = pure () + | otherwise = f *> loop (cnt - 1) + -- | The reverse of 'when'. unless :: (Applicative f) => Bool -> f () -> f () From git at git.haskell.org Sun Apr 10 21:39:37 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 10 Apr 2016 21:39:37 +0000 (UTC) Subject: [commit: ghc] master: Add doc to (<=<) comparing its type to (.) (90d66de) Message-ID: <20160410213937.AE4523A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/90d66dedc3a2d9b03dfd3dc3314d380e2adcf2ea/ghc >--------------------------------------------------------------- commit 90d66dedc3a2d9b03dfd3dc3314d380e2adcf2ea Author: Chris Martin Date: Sun Apr 10 18:55:45 2016 +0200 Add doc to (<=<) comparing its type to (.) This is another documentation addition similar to D1989, this time comparing the type of the Kleisli composition operator (<=<) to that of plain function composition (.). Reviewers: hvr, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2100 >--------------------------------------------------------------- 90d66dedc3a2d9b03dfd3dc3314d380e2adcf2ea libraries/base/Control/Monad.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libraries/base/Control/Monad.hs b/libraries/base/Control/Monad.hs index 9d858bd..a964581 100644 --- a/libraries/base/Control/Monad.hs +++ b/libraries/base/Control/Monad.hs @@ -104,7 +104,12 @@ infixr 1 <=<, >=> (>=>) :: Monad m => (a -> m b) -> (b -> m c) -> (a -> m c) f >=> g = \x -> f x >>= g --- | Right-to-left Kleisli composition of monads. @('>=>')@, with the arguments flipped +-- | Right-to-left Kleisli composition of monads. @('>=>')@, with the arguments flipped. +-- +-- Note how this operator resembles function composition @('.')@: +-- +-- > (.) :: (b -> c) -> (a -> b) -> a -> c +-- > (<=<) :: Monad m => (b -> m c) -> (a -> m b) -> a -> m c (<=<) :: Monad m => (b -> m c) -> (a -> m b) -> (a -> m c) (<=<) = flip (>=>) From git at git.haskell.org Sun Apr 10 21:39:40 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 10 Apr 2016 21:39:40 +0000 (UTC) Subject: [commit: ghc] master: Remove left-over shell-tools.c (f3beed3) Message-ID: <20160410213940.5C7C23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f3beed35309e4e8b60aa3f11372d1e00324eb046/ghc >--------------------------------------------------------------- commit f3beed35309e4e8b60aa3f11372d1e00324eb046 Author: Herbert Valerio Riedel Date: Sun Apr 10 18:56:11 2016 +0200 Remove left-over shell-tools.c The last user of this file was the "-dynload wrapper" which was removed in 169f5972d5398e75c4cf7f831b6ce703288ec73c for addressing #4275 Reviewers: austin, erikd, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2098 GHC Trac Issues: #4275 >--------------------------------------------------------------- f3beed35309e4e8b60aa3f11372d1e00324eb046 includes/shell-tools.c | 139 ------------------------------------------------- 1 file changed, 139 deletions(-) diff --git a/includes/shell-tools.c b/includes/shell-tools.c deleted file mode 100644 index 82c22d3..0000000 --- a/includes/shell-tools.c +++ /dev/null @@ -1,139 +0,0 @@ -#include -#include -#include -#include -#include -#include - -#ifdef mingw32_HOST_OS -#include -#include -#include -#include -#include -#endif - -void error(const char *fmt, ...) { - va_list argp; - va_start(argp, fmt); - vfprintf(stderr, fmt, argp); - va_end(argp); - fflush(stderr); -} - -#ifndef mingw32_HOST_OS -int run(char *this, char *program, int argc, char** argv) { - execv(program, argv); - error("%s: Unable to start %s: ", this, program); - perror(""); - return 1; /* Not reached */ -} -#else -int run(char *this, char *program, int argc, char** argv) { - TCHAR programShort[MAX_PATH+1]; - DWORD dwSize; - DWORD dwExitCode; - int i; - char* new_cmdline; - char *ptr; - char *src; - unsigned int cmdline_len; - - STARTUPINFO si; - PROCESS_INFORMATION pi; - - ZeroMemory(&si, sizeof(STARTUPINFO)); - ZeroMemory(&pi, sizeof(PROCESS_INFORMATION)); - - si.cb = sizeof(STARTUPINFO); - - dwSize = MAX_PATH; - /* Turn the path into short form - LFN form causes problems - when passed in argv[0]. */ - if ( !(GetShortPathName(program, programShort, dwSize)) ) { - error("%s: Unable to locate %s\n", this, program); - return 1; - } - - /* Compute length of the flattened 'argv', including spaces! */ - cmdline_len = 0; - for(i = 0; i < argc; i++) { - /* Note: play it safe and quote all argv strings */ - /* In the worst case we have to escape every character with a \ */ - cmdline_len += 1 + 2 * strlen(argv[i]) + 2; - } - new_cmdline = (char*)malloc(sizeof(char) * (cmdline_len + 1)); - if (!new_cmdline) { - error("%s: failed to start up ghc.exe; insufficient memory\n", this); - return 1; - } - - ptr = new_cmdline; - for(i = 0; i < argc; i++) { - *ptr++ = ' '; - *ptr++ = '"'; - src = argv[i]; - while(*src) { - /* Escape any \ and " characters */ - if ((*src == '\\') || (*src == '"')) { - *ptr++ = '\\'; - } - *ptr++ = *src++; - } - *ptr++ = '"'; - } - *ptr = '\0'; - new_cmdline = new_cmdline + 1; /* Skip the leading space */ - - /* Note: Used to use _spawnv(_P_WAIT, ...) here, but it suffered - from the parent intercepting console events such as Ctrl-C, - which it shouldn't. Installing an ignore-all console handler - didn't do the trick either. - - Irrespective of this issue, using CreateProcess() is preferable, - as it makes this wrapper work on both mingw and cygwin. - */ -#if 0 - fprintf(stderr, "Invoking ghc: %s %s\n", programShort, new_cmdline); - fflush(stderr); -#endif - if (!CreateProcess(programShort, - new_cmdline, - NULL, - NULL, - TRUE, - 0, /* dwCreationFlags */ - NULL, /* lpEnvironment */ - NULL, /* lpCurrentDirectory */ - &si, /* lpStartupInfo */ - &pi) ) { - error("%s: Unable to start ghc.exe (error code: %lu)\n", - this, GetLastError()); - return 1; - } - /* Disable handling of console events in the parent by dropping its - * connection to the console. This has the (minor) downside of not being - * able to subsequently emit any error messages to the console. - */ - FreeConsole(); - - switch (WaitForSingleObject(pi.hProcess, INFINITE) ) { - case WAIT_OBJECT_0: - if (GetExitCodeProcess(pi.hProcess, &dwExitCode)) { - return dwExitCode; - } - else { - return 1; - } - case WAIT_ABANDONED: - case WAIT_FAILED: - /* in the event we get any hard errors, bring the child - to a halt. */ - TerminateProcess(pi.hProcess, 1); - return 1; - default: - return 1; - } -} -#endif - From git at git.haskell.org Sun Apr 10 21:39:43 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 10 Apr 2016 21:39:43 +0000 (UTC) Subject: [commit: ghc] master: Fix Template Haskell bug reported in #11809. (2f82da7) Message-ID: <20160410213943.7F86F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2f82da761defba2cfdc55ca08d774ca7e1240463/ghc >--------------------------------------------------------------- commit 2f82da761defba2cfdc55ca08d774ca7e1240463 Author: Dominik Bollmann Date: Sun Apr 10 18:57:38 2016 +0200 Fix Template Haskell bug reported in #11809. Record selectors of data types spliced in with Template Haskell are not renamer-resolved correctly in GHC HEAD. The culprit is `newRecordSelector` which violates notes `Note [Binders in Template Haskell] in Convert.hs` and `Note [Looking up Exact RdrNames] in RnEnv.hs`. This commit fixes `newRecordSelector` accordingly. Test Plan: ./validate Reviewers: thomie, mpickering, bgamari, austin, simonpj, goldfire Reviewed By: goldfire Differential Revision: https://phabricator.haskell.org/D2091 GHC Trac Issues: #11809 >--------------------------------------------------------------- 2f82da761defba2cfdc55ca08d774ca7e1240463 compiler/rename/RnNames.hs | 19 +++++++++++++------ testsuite/tests/th/T11809.hs | 13 +++++++++++++ testsuite/tests/th/all.T | 2 +- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/compiler/rename/RnNames.hs b/compiler/rename/RnNames.hs index 1659191..0bc6386 100644 --- a/compiler/rename/RnNames.hs +++ b/compiler/rename/RnNames.hs @@ -685,13 +685,20 @@ getLocalNonValBinders fixity_env newRecordSelector :: Bool -> [Name] -> LFieldOcc RdrName -> RnM FieldLabel newRecordSelector _ [] _ = error "newRecordSelector: datatype has no constructors!" -newRecordSelector overload_ok (dc:_) (L loc (FieldOcc (L _ fld) _)) = - do { sel_name <- newTopSrcBinder $ L loc $ mkRdrUnqual sel_occ - ; return $ fl { flSelector = sel_name } } +newRecordSelector overload_ok (dc:_) (L loc (FieldOcc (L _ fld) _)) + = do { selName <- newTopSrcBinder $ L loc $ field + ; return $ qualFieldLbl { flSelector = selName } } where - lbl = occNameFS $ rdrNameOcc fld - fl = mkFieldLabelOccs lbl (nameOccName dc) overload_ok - sel_occ = flSelector fl + fieldOccName = occNameFS $ rdrNameOcc fld + qualFieldLbl = mkFieldLabelOccs fieldOccName (nameOccName dc) overload_ok + field | isExact fld = fld + -- use an Exact RdrName as is to preserve the bindings + -- of an already renamer-resolved field and its use + -- sites. This is needed to correctly support record + -- selectors in Template Haskell. See Note [Binders in + -- Template Haskell] in Convert.hs and Note [Looking up + -- Exact RdrNames] in RnEnv.hs. + | otherwise = mkRdrUnqual (flSelector qualFieldLbl) {- Note [Looking up family names in family instances] diff --git a/testsuite/tests/th/T11809.hs b/testsuite/tests/th/T11809.hs new file mode 100644 index 0000000..bbb65fa --- /dev/null +++ b/testsuite/tests/th/T11809.hs @@ -0,0 +1,13 @@ +{-# LANGUAGE TemplateHaskell #-} +module T11809 where + +{- Test splicing in a data type with records -} + +[d| + data D a = MkD { unD :: a } + + someD = MkD "Hello" + getD = unD someD -- unD should resolve to the record selector above! + |] + +getD' = unD someD -- dito here outside of the splice! diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index 3939880..621e2f8 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -391,9 +391,9 @@ test('T10819', test('T10820', normal, compile_and_run, ['-v0']) test('T11341', normal, compile, ['-v0 -dsuppress-uniques']) test('T11345', normal, compile_and_run, ['-v0 -dsuppress-uniques']) - test('TH_finalizer', normal, compile, ['-v0']) test('T10603', normal, compile, ['-ddump-splices -dsuppress-uniques']) test('T11452', normal, compile_fail, ['-v0']) test('T9022', normal, compile_and_run, ['-v0']) test('T11145', normal, compile_fail, ['-v0 -dsuppress-uniques']) +test('T11809', normal, compile, ['-v0']) From git at git.haskell.org Sun Apr 10 21:39:46 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 10 Apr 2016 21:39:46 +0000 (UTC) Subject: [commit: ghc] master: Remove spurious STG_UNUSED annotation (6d7fda5) Message-ID: <20160410213946.365513A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6d7fda5eebbb2f79d19953947ba7da5fb9c96db4/ghc >--------------------------------------------------------------- commit 6d7fda5eebbb2f79d19953947ba7da5fb9c96db4 Author: Tomas Carnecky Date: Sun Apr 10 18:56:35 2016 +0200 Remove spurious STG_UNUSED annotation Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2096 >--------------------------------------------------------------- 6d7fda5eebbb2f79d19953947ba7da5fb9c96db4 rts/Task.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/rts/Task.h b/rts/Task.h index 817a99a..37832a3 100644 --- a/rts/Task.h +++ b/rts/Task.h @@ -324,11 +324,7 @@ INLINE_HEADER TaskId serialiseTaskId (OSThreadId taskID) { // Get a serialisable Id for the Task's OS thread // Needed mainly for logging since the OSThreadId is an opaque type INLINE_HEADER TaskId -serialisableTaskId (Task *task -#if !defined(THREADED_RTS) - STG_UNUSED -#endif - ) +serialisableTaskId (Task *task) { #if defined(THREADED_RTS) return serialiseTaskId(task->id); From git at git.haskell.org Sun Apr 10 21:39:48 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 10 Apr 2016 21:39:48 +0000 (UTC) Subject: [commit: ghc] master: Export zonkEvBinds from TcHsSyn. (5a1add1) Message-ID: <20160410213948.E4D3E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5a1add134fdb2ab4d91b0f66de1dc89f0cd69354/ghc >--------------------------------------------------------------- commit 5a1add134fdb2ab4d91b0f66de1dc89f0cd69354 Author: Conal Elliott Date: Sun Apr 10 19:13:44 2016 +0200 Export zonkEvBinds from TcHsSyn. Needed for constructing correct constraint-satisfying code (particularly type class instances) in a Core-to-Core transformation. Reviewers: simonpj, austin, bgamari Reviewed By: austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2088 GHC Trac Issues: #11804 >--------------------------------------------------------------- 5a1add134fdb2ab4d91b0f66de1dc89f0cd69354 compiler/typecheck/TcHsSyn.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/typecheck/TcHsSyn.hs b/compiler/typecheck/TcHsSyn.hs index 502842d..5d78adb 100644 --- a/compiler/typecheck/TcHsSyn.hs +++ b/compiler/typecheck/TcHsSyn.hs @@ -30,6 +30,7 @@ module TcHsSyn ( emptyZonkEnv, mkEmptyZonkEnv, zonkTcTypeToType, zonkTcTypeToTypes, zonkTyVarOcc, zonkCoToCo, zonkTcKindToKind, + zonkEvBinds, -- * Validity checking checkForRepresentationPolymorphism From git at git.haskell.org Sun Apr 10 21:39:51 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 10 Apr 2016 21:39:51 +0000 (UTC) Subject: [commit: ghc] master: Reduce default for -fmax-pmcheck-iterations from 1e7 to 2e6 (d2e05c6) Message-ID: <20160410213951.A58E53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d2e05c6bd0834421b0c48b3c4287fbe6ee889966/ghc >--------------------------------------------------------------- commit d2e05c6bd0834421b0c48b3c4287fbe6ee889966 Author: Herbert Valerio Riedel Date: Sun Apr 10 19:13:16 2016 +0200 Reduce default for -fmax-pmcheck-iterations from 1e7 to 2e6 The commit 28f951edfe50ea5182065144340061ec326781f5 introduced the `-fmax-pmcheck-iterations` flag and set the default limit to 1e7 iterations. However, this value is still high enough that it can result GHC to exhibit memory spikes beyond 1 GiB of RAM usage (heap profile showed several `(:)`s, as well as `THUNK_2_0`, and `PmCon` during the memory spikes) A value of 2e6 seems to be a safer upper bound which still manages to let the checker not run into the limit in most cases. Test Plan: Validate, try building a few Hackage packages Reviewers: austin, gkaracha, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2095 >--------------------------------------------------------------- d2e05c6bd0834421b0c48b3c4287fbe6ee889966 compiler/cmm/CmmOpt.hs | 6 ++++++ compiler/main/DynFlags.hs | 2 +- compiler/nativeGen/X86/CodeGen.hs | 6 ++++++ compiler/prelude/PrimOp.hs | 5 +++++ compiler/types/OptCoercion.hs | 8 ++++++-- testsuite/tests/pmcheck/should_compile/T11195.hs | 1 + 6 files changed, 25 insertions(+), 3 deletions(-) diff --git a/compiler/cmm/CmmOpt.hs b/compiler/cmm/CmmOpt.hs index 7c634c2..de3061d 100644 --- a/compiler/cmm/CmmOpt.hs +++ b/compiler/cmm/CmmOpt.hs @@ -1,5 +1,11 @@ {-# LANGUAGE CPP #-} +-- The default iteration limit is a bit too low for the definitions +-- in this module. +#if __GLASGOW_HASKELL__ >= 800 +{-# OPTIONS_GHC -fmax-pmcheck-iterations=10000000 #-} +#endif + ----------------------------------------------------------------------------- -- -- Cmm optimisation diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 9e06445..a79bb3a 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -1445,7 +1445,7 @@ defaultDynFlags mySettings = debugLevel = 0, simplPhases = 2, maxSimplIterations = 4, - maxPmCheckIterations = 10000000, + maxPmCheckIterations = 2000000, ruleCheck = Nothing, maxRelevantBinds = Just 6, simplTickFactor = 100, diff --git a/compiler/nativeGen/X86/CodeGen.hs b/compiler/nativeGen/X86/CodeGen.hs index 2d22734..cd45d92 100644 --- a/compiler/nativeGen/X86/CodeGen.hs +++ b/compiler/nativeGen/X86/CodeGen.hs @@ -1,5 +1,11 @@ {-# LANGUAGE CPP, GADTs, NondecreasingIndentation #-} +-- The default iteration limit is a bit too low for the definitions +-- in this module. +#if __GLASGOW_HASKELL__ >= 800 +{-# OPTIONS_GHC -fmax-pmcheck-iterations=10000000 #-} +#endif + ----------------------------------------------------------------------------- -- -- Generating machine code (instruction selection) diff --git a/compiler/prelude/PrimOp.hs b/compiler/prelude/PrimOp.hs index 7b37062..be91ae6 100644 --- a/compiler/prelude/PrimOp.hs +++ b/compiler/prelude/PrimOp.hs @@ -6,6 +6,11 @@ {-# LANGUAGE CPP #-} +-- The default is a bit too low for the quite large primOpInfo definition +#if __GLASGOW_HASKELL__ >= 801 +{-# OPTIONS_GHC -fmax-pmcheck-iterations=10000000 #-} +#endif + module PrimOp ( PrimOp(..), PrimOpVecCat(..), allThePrimOps, primOpType, primOpSig, diff --git a/compiler/types/OptCoercion.hs b/compiler/types/OptCoercion.hs index e39f0aa..ca67bc7 100644 --- a/compiler/types/OptCoercion.hs +++ b/compiler/types/OptCoercion.hs @@ -1,8 +1,12 @@ -- (c) The University of Glasgow 2006 {-# LANGUAGE CPP #-} - -- This module used to take 10GB of memory to compile with the new - -- (Nov '15) pattern-match checker. + +-- The default iteration limit is a bit too low for the definitions +-- in this module. +#if __GLASGOW_HASKELL__ >= 800 +{-# OPTIONS_GHC -fmax-pmcheck-iterations=10000000 #-} +#endif module OptCoercion ( optCoercion, checkAxInstCo ) where diff --git a/testsuite/tests/pmcheck/should_compile/T11195.hs b/testsuite/tests/pmcheck/should_compile/T11195.hs index 593223f..236932e 100644 --- a/testsuite/tests/pmcheck/should_compile/T11195.hs +++ b/testsuite/tests/pmcheck/should_compile/T11195.hs @@ -1,4 +1,5 @@ {-# OPTIONS_GHC -Woverlapping-patterns -Wincomplete-patterns #-} +{-# OPTIONS_GHC -fmax-pmcheck-iterations=10000000 #-} module T11195 where From git at git.haskell.org Sun Apr 10 21:39:55 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 10 Apr 2016 21:39:55 +0000 (UTC) Subject: [commit: ghc] master: Fix suggestions for unbound variables (#11680) (470d4d5) Message-ID: <20160410213955.083573A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/470d4d5b8e7cbcc176b1f3ac26ce0d95acd35a78/ghc >--------------------------------------------------------------- commit 470d4d5b8e7cbcc176b1f3ac26ce0d95acd35a78 Author: Jason Eisenberg Date: Sun Apr 10 19:17:46 2016 +0200 Fix suggestions for unbound variables (#11680) When the typechecker generates the error message for an out-of-scope variable, it now uses the GlobalRdrEnv with respect to which the variable is unbound, not the GlobalRdrEnv which is available at the time the error is reported. Doing so ensures we do not provide suggestions which themselves are out-of-scope (because they are bound in a later inter-splice group). Nonetheless, we do note in the error message if an unambiguous, exact match to the out-of-scope variable is found in a later inter-splice group, and we specify where that match is not in scope. Test Plan: ./validate Reviewers: goldfire, austin, bgamari Reviewed By: goldfire Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2000 GHC Trac Issues: #11680 >--------------------------------------------------------------- 470d4d5b8e7cbcc176b1f3ac26ce0d95acd35a78 compiler/basicTypes/OccName.hs | 1 + compiler/basicTypes/RdrName.hs | 10 +- compiler/deSugar/DsMeta.hs | 4 +- compiler/hsSyn/HsExpr.hs | 105 +++++++++++++++++-- compiler/rename/RnExpr.hs | 8 +- compiler/rename/RnSource.hs | 2 +- compiler/rename/RnTypes.hs | 6 +- compiler/typecheck/TcCanonical.hs | 12 +-- compiler/typecheck/TcErrors.hs | 209 +++++++++++++++++++++++++++++++++----- compiler/typecheck/TcExpr.hs | 10 +- compiler/typecheck/TcHsSyn.hs | 3 +- compiler/typecheck/TcRnDriver.hs | 9 +- compiler/typecheck/TcRnMonad.hs | 24 ++++- compiler/typecheck/TcRnTypes.hs | 56 ++++++---- testsuite/tests/th/T11680.hs | 122 ++++++++++++++++++++++ testsuite/tests/th/T11680.stderr | 49 +++++++++ testsuite/tests/th/all.T | 2 + 17 files changed, 547 insertions(+), 85 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 470d4d5b8e7cbcc176b1f3ac26ce0d95acd35a78 From git at git.haskell.org Sun Apr 10 21:39:57 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 10 Apr 2016 21:39:57 +0000 (UTC) Subject: [commit: ghc] master: Bump haddock submodule (cf5ff08) Message-ID: <20160410213957.AF6133A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cf5ff08fdb2e730d74037c6ea7dcac1dbfb7a4be/ghc >--------------------------------------------------------------- commit cf5ff08fdb2e730d74037c6ea7dcac1dbfb7a4be Author: Ben Gamari Date: Sun Apr 10 19:34:59 2016 +0200 Bump haddock submodule Fixes #11818, where haddock's documentation broke `make install` when Sphinx is not available. >--------------------------------------------------------------- cf5ff08fdb2e730d74037c6ea7dcac1dbfb7a4be utils/haddock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/haddock b/utils/haddock index 3ddcbd6..c6d6a18 160000 --- a/utils/haddock +++ b/utils/haddock @@ -1 +1 @@ -Subproject commit 3ddcbd6b8e6884bd95028381176eb33bee6896fb +Subproject commit c6d6a18d85e5e2d9bb5904e6919e8a8d7e31c4c5 From git at git.haskell.org Sun Apr 10 21:40:01 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 10 Apr 2016 21:40:01 +0000 (UTC) Subject: [commit: ghc] master: Remove the instantiation check when deriving Generic(1) (7443e5c) Message-ID: <20160410214001.3DA5A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7443e5c8dae24b83f5f4975c7accce02b819029c/ghc >--------------------------------------------------------------- commit 7443e5c8dae24b83f5f4975c7accce02b819029c Author: RyanGlScott Date: Sun Apr 10 22:59:37 2016 +0200 Remove the instantiation check when deriving Generic(1) Previously, deriving `Generic(1)` bailed out when attempting to instantiate visible type parameters (#5939), but this instantiation check was quite fragile and doesn't interact well with `-XTypeInType`. It has been decided that `Generic(1)` shouldn't be subjected to this check anyway, so it has been removed, and `gen_Generic_binds`'s machinery has been updated to substitute the type variables in a generated `Rep`/`Rep1` instance with the user-supplied type arguments. In addition, this also refactors `Condition` in `TcDeriv` a bit. Namely, since we no longer need `tc_args` to check any conditions, the `[Type]` component of `Condition` has been removed. Fixes #11732. Test Plan: ./validate Reviewers: goldfire, kosmikus, simonpj, bgamari, austin Reviewed By: simonpj, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2061 GHC Trac Issues: #5939, #11732 >--------------------------------------------------------------- 7443e5c8dae24b83f5f4975c7accce02b819029c compiler/typecheck/TcDeriv.hs | 86 +++++++--- compiler/typecheck/TcGenGenerics.hs | 178 ++++++++++++--------- docs/users_guide/8.0.1-notes.rst | 7 + testsuite/tests/deriving/should_compile/T11732a.hs | 11 ++ testsuite/tests/deriving/should_compile/T11732b.hs | 12 ++ testsuite/tests/deriving/should_compile/T11732c.hs | 18 +++ testsuite/tests/deriving/should_compile/T5939.hs | 14 ++ testsuite/tests/deriving/should_compile/all.T | 4 + testsuite/tests/generics/GenCannotDoRep0_0.stderr | 30 ++-- 9 files changed, 248 insertions(+), 112 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 7443e5c8dae24b83f5f4975c7accce02b819029c From git at git.haskell.org Sun Apr 10 21:40:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 10 Apr 2016 21:40:03 +0000 (UTC) Subject: [commit: ghc] master: RtsFlags: Un-constify temporary buffer (378091c) Message-ID: <20160410214003.E64D03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/378091c9ef6d25a076125f0b82dce1a155c0e8f0/ghc >--------------------------------------------------------------- commit 378091c9ef6d25a076125f0b82dce1a155c0e8f0 Author: Ben Gamari Date: Sun Apr 10 23:28:46 2016 +0200 RtsFlags: Un-constify temporary buffer Otherwise we get a const-ness mismatch when we free the buffer, which for some reason gcc 5.3 didn't notice. >--------------------------------------------------------------- 378091c9ef6d25a076125f0b82dce1a155c0e8f0 rts/RtsFlags.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c index 7f0821a..9db3cd4 100644 --- a/rts/RtsFlags.c +++ b/rts/RtsFlags.c @@ -1566,7 +1566,7 @@ static rtsBool read_heap_profiling_flag(const char *arg_in) // However, for sanity we want to guarantee const-correctness and parsing // really ought to be an immutable operation. To avoid rewriting the parser // we just operate on a temporary copy of the argument. - const char *arg = strdup(arg_in); + char *arg = strdup(arg_in); rtsBool error = rtsFalse; switch (arg[2]) { case '\0': From git at git.haskell.org Sun Apr 10 21:40:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 10 Apr 2016 21:40:06 +0000 (UTC) Subject: [commit: ghc] master: base: Fix "since" annotation on GHC.ExecutionStack (ad532de) Message-ID: <20160410214006.9494D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ad532ded871a9a5180388a2b7cdbdc26e053284c/ghc >--------------------------------------------------------------- commit ad532ded871a9a5180388a2b7cdbdc26e053284c Author: Ben Gamari Date: Sun Apr 10 20:00:48 2016 +0200 base: Fix "since" annotation on GHC.ExecutionStack I have no idea where "4.11" came from. >--------------------------------------------------------------- ad532ded871a9a5180388a2b7cdbdc26e053284c libraries/base/GHC/ExecutionStack.hs | 2 +- libraries/base/GHC/ExecutionStack/Internal.hsc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/base/GHC/ExecutionStack.hs b/libraries/base/GHC/ExecutionStack.hs index 22be903..966ba29 100644 --- a/libraries/base/GHC/ExecutionStack.hs +++ b/libraries/base/GHC/ExecutionStack.hs @@ -26,7 +26,7 @@ -- ,("RTS expects libdw","YES") -- @ -- --- /Since: 4.11.0.0/ +-- /Since: 4.9.0.0/ ----------------------------------------------------------------------------- module GHC.ExecutionStack ( diff --git a/libraries/base/GHC/ExecutionStack/Internal.hsc b/libraries/base/GHC/ExecutionStack/Internal.hsc index e966e17..340cdc4 100644 --- a/libraries/base/GHC/ExecutionStack/Internal.hsc +++ b/libraries/base/GHC/ExecutionStack/Internal.hsc @@ -10,7 +10,7 @@ -- -- Internals of the `GHC.ExecutionStack` module -- --- /Since: 4.11.0.0/ +-- /Since: 4.9.0.0/ ----------------------------------------------------------------------------- #include "HsFFI.h" From git at git.haskell.org Sun Apr 10 21:44:45 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 10 Apr 2016 21:44:45 +0000 (UTC) Subject: [commit: ghc] master: Typos in Note (8987ce0) Message-ID: <20160410214445.B025D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8987ce067d187878f82005293f6b215dec66df48/ghc >--------------------------------------------------------------- commit 8987ce067d187878f82005293f6b215dec66df48 Author: Joachim Breitner Date: Sun Apr 10 23:47:25 2016 +0200 Typos in Note >--------------------------------------------------------------- 8987ce067d187878f82005293f6b215dec66df48 libraries/base/Control/Monad.hs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/libraries/base/Control/Monad.hs b/libraries/base/Control/Monad.hs index a964581..255f80c 100644 --- a/libraries/base/Control/Monad.hs +++ b/libraries/base/Control/Monad.hs @@ -175,8 +175,8 @@ foldM_ :: (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m () foldM_ f a xs = foldlM f a xs >> return () {- -Note [Worker/wrapper transform on replicateM/replicateM_ --------------------------------------------------------- +Note [Worker/wrapper transform on replicateM/replicateM_] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The implementations of replicateM and replicateM_ both leverage the worker/wrapper transform. The simpler implementation of replicateM_, as an @@ -185,17 +185,14 @@ example, would be: replicateM_ 0 _ = pure () replicateM_ n f = f *> replicateM_ (n - 1) f -However, the self-recrusive nature of this implementation inhibits inlining, +However, the self-recursive nature of this implementation inhibits inlining, which means we never get to specialise to the action (`f` in the code above). By contrast, the implementation below with a local loop makes it possible to -inline the entire definition (as hapens for foldr, for example) thereby +inline the entire definition (as happens for foldr, for example) thereby specialising for the particular action. For further information, see this Trac comment, which includes side-by-side -Core. - -https://ghc.haskell.org/trac/ghc/ticket/11795#comment:6 - +Core: https://ghc.haskell.org/trac/ghc/ticket/11795#comment:6 -} -- | @'replicateM' n act@ performs the action @n@ times, From git at git.haskell.org Sun Apr 10 22:16:52 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 10 Apr 2016 22:16:52 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Provide an optimized replicateM_ implementation #11795 (7c6bc78) Message-ID: <20160410221652.606773A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/7c6bc78fe1110be426de0bf95157f114d216b3aa/ghc >--------------------------------------------------------------- commit 7c6bc78fe1110be426de0bf95157f114d216b3aa Author: Michael Snoyman Date: Sun Apr 10 18:52:47 2016 +0200 Provide an optimized replicateM_ implementation #11795 In my testing, the worker/wrapper transformation applied here significantly decreases the number of allocations performed when using replicateM_. Additionally, this version of the function behaves correctly for negative numbers (namely, it will behave the same as replicateM_ 0, which is what previous versions of base have done). Reviewers: bgamari, simonpj, hvr, austin Reviewed By: bgamari, simonpj, austin Subscribers: nomeata, simonpj, mpickering, thomie Differential Revision: https://phabricator.haskell.org/D2086 GHC Trac Issues: #11795 (cherry picked from commit c4a7520ef3a0b5e0e33d66ae1d628af93e0d7590) >--------------------------------------------------------------- 7c6bc78fe1110be426de0bf95157f114d216b3aa libraries/base/Control/Monad.hs | 43 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/libraries/base/Control/Monad.hs b/libraries/base/Control/Monad.hs index 6957ad4..9d858bd 100644 --- a/libraries/base/Control/Monad.hs +++ b/libraries/base/Control/Monad.hs @@ -80,8 +80,8 @@ import Data.Functor ( void, (<$>) ) import Data.Traversable ( forM, mapM, traverse, sequence, sequenceA ) import GHC.Base hiding ( mapM, sequence ) -import GHC.Enum ( pred ) import GHC.List ( zipWith, unzip ) +import GHC.Num ( (-) ) -- ----------------------------------------------------------------------------- -- Functions mandated by the Prelude @@ -169,22 +169,55 @@ foldM_ :: (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m () {-# SPECIALISE foldM_ :: (a -> b -> Maybe a) -> a -> [b] -> Maybe () #-} foldM_ f a xs = foldlM f a xs >> return () +{- +Note [Worker/wrapper transform on replicateM/replicateM_ +-------------------------------------------------------- + +The implementations of replicateM and replicateM_ both leverage the +worker/wrapper transform. The simpler implementation of replicateM_, as an +example, would be: + + replicateM_ 0 _ = pure () + replicateM_ n f = f *> replicateM_ (n - 1) f + +However, the self-recrusive nature of this implementation inhibits inlining, +which means we never get to specialise to the action (`f` in the code above). +By contrast, the implementation below with a local loop makes it possible to +inline the entire definition (as hapens for foldr, for example) thereby +specialising for the particular action. + +For further information, see this Trac comment, which includes side-by-side +Core. + +https://ghc.haskell.org/trac/ghc/ticket/11795#comment:6 + +-} + -- | @'replicateM' n act@ performs the action @n@ times, -- gathering the results. replicateM :: (Applicative m) => Int -> m a -> m [a] {-# INLINEABLE replicateM #-} {-# SPECIALISE replicateM :: Int -> IO a -> IO [a] #-} {-# SPECIALISE replicateM :: Int -> Maybe a -> Maybe [a] #-} -replicateM 0 _ = pure [] -replicateM n x = liftA2 (:) x (replicateM (pred n) x) +replicateM cnt0 f = + loop cnt0 + where + loop cnt + | cnt <= 0 = pure [] + | otherwise = liftA2 (:) f (loop (cnt - 1)) -- | Like 'replicateM', but discards the result. replicateM_ :: (Applicative m) => Int -> m a -> m () {-# INLINEABLE replicateM_ #-} {-# SPECIALISE replicateM_ :: Int -> IO a -> IO () #-} {-# SPECIALISE replicateM_ :: Int -> Maybe a -> Maybe () #-} -replicateM_ 0 _ = pure () -replicateM_ n x = x *> replicateM_ (pred n) x +replicateM_ cnt0 f = + loop cnt0 + where + loop cnt + | cnt <= 0 = pure () + | otherwise = f *> loop (cnt - 1) + -- | The reverse of 'when'. unless :: (Applicative f) => Bool -> f () -> f () From git at git.haskell.org Sun Apr 10 22:16:55 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 10 Apr 2016 22:16:55 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Fix Template Haskell bug reported in #11809. (e465093) Message-ID: <20160410221655.800BD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/e4650932ce18e04a24aba2c8de71fe19d691f5fe/ghc >--------------------------------------------------------------- commit e4650932ce18e04a24aba2c8de71fe19d691f5fe Author: Dominik Bollmann Date: Sun Apr 10 18:57:38 2016 +0200 Fix Template Haskell bug reported in #11809. Record selectors of data types spliced in with Template Haskell are not renamer-resolved correctly in GHC HEAD. The culprit is `newRecordSelector` which violates notes `Note [Binders in Template Haskell] in Convert.hs` and `Note [Looking up Exact RdrNames] in RnEnv.hs`. This commit fixes `newRecordSelector` accordingly. Test Plan: ./validate Reviewers: thomie, mpickering, bgamari, austin, simonpj, goldfire Reviewed By: goldfire Differential Revision: https://phabricator.haskell.org/D2091 GHC Trac Issues: #11809 (cherry picked from commit 2f82da761defba2cfdc55ca08d774ca7e1240463) >--------------------------------------------------------------- e4650932ce18e04a24aba2c8de71fe19d691f5fe compiler/rename/RnNames.hs | 19 +++++++++++++------ testsuite/tests/th/T11809.hs | 13 +++++++++++++ testsuite/tests/th/all.T | 2 +- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/compiler/rename/RnNames.hs b/compiler/rename/RnNames.hs index 1659191..0bc6386 100644 --- a/compiler/rename/RnNames.hs +++ b/compiler/rename/RnNames.hs @@ -685,13 +685,20 @@ getLocalNonValBinders fixity_env newRecordSelector :: Bool -> [Name] -> LFieldOcc RdrName -> RnM FieldLabel newRecordSelector _ [] _ = error "newRecordSelector: datatype has no constructors!" -newRecordSelector overload_ok (dc:_) (L loc (FieldOcc (L _ fld) _)) = - do { sel_name <- newTopSrcBinder $ L loc $ mkRdrUnqual sel_occ - ; return $ fl { flSelector = sel_name } } +newRecordSelector overload_ok (dc:_) (L loc (FieldOcc (L _ fld) _)) + = do { selName <- newTopSrcBinder $ L loc $ field + ; return $ qualFieldLbl { flSelector = selName } } where - lbl = occNameFS $ rdrNameOcc fld - fl = mkFieldLabelOccs lbl (nameOccName dc) overload_ok - sel_occ = flSelector fl + fieldOccName = occNameFS $ rdrNameOcc fld + qualFieldLbl = mkFieldLabelOccs fieldOccName (nameOccName dc) overload_ok + field | isExact fld = fld + -- use an Exact RdrName as is to preserve the bindings + -- of an already renamer-resolved field and its use + -- sites. This is needed to correctly support record + -- selectors in Template Haskell. See Note [Binders in + -- Template Haskell] in Convert.hs and Note [Looking up + -- Exact RdrNames] in RnEnv.hs. + | otherwise = mkRdrUnqual (flSelector qualFieldLbl) {- Note [Looking up family names in family instances] diff --git a/testsuite/tests/th/T11809.hs b/testsuite/tests/th/T11809.hs new file mode 100644 index 0000000..bbb65fa --- /dev/null +++ b/testsuite/tests/th/T11809.hs @@ -0,0 +1,13 @@ +{-# LANGUAGE TemplateHaskell #-} +module T11809 where + +{- Test splicing in a data type with records -} + +[d| + data D a = MkD { unD :: a } + + someD = MkD "Hello" + getD = unD someD -- unD should resolve to the record selector above! + |] + +getD' = unD someD -- dito here outside of the splice! diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index d5124fe..fb0c9f8 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -395,8 +395,8 @@ test('T10819', test('T10820', normal, compile_and_run, ['-v0']) test('T11341', normal, compile, ['-v0 -dsuppress-uniques']) test('T11345', normal, compile_and_run, ['-v0 -dsuppress-uniques']) - test('TH_finalizer', normal, compile, ['-v0']) test('T10603', normal, compile, ['-ddump-splices -dsuppress-uniques']) test('T11452', normal, compile_fail, ['-v0']) test('T11145', normal, compile_fail, ['-v0 -dsuppress-uniques']) +test('T11809', normal, compile, ['-v0']) From git at git.haskell.org Sun Apr 10 22:16:58 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 10 Apr 2016 22:16:58 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Add doc to (<=<) comparing its type to (.) (a7cb9cf) Message-ID: <20160410221658.2DCC03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/a7cb9cf72ee1501b2a0558fd769d85db283dc08b/ghc >--------------------------------------------------------------- commit a7cb9cf72ee1501b2a0558fd769d85db283dc08b Author: Chris Martin Date: Sun Apr 10 18:55:45 2016 +0200 Add doc to (<=<) comparing its type to (.) This is another documentation addition similar to D1989, this time comparing the type of the Kleisli composition operator (<=<) to that of plain function composition (.). Reviewers: hvr, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2100 (cherry picked from commit 90d66dedc3a2d9b03dfd3dc3314d380e2adcf2ea) >--------------------------------------------------------------- a7cb9cf72ee1501b2a0558fd769d85db283dc08b libraries/base/Control/Monad.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libraries/base/Control/Monad.hs b/libraries/base/Control/Monad.hs index 9d858bd..a964581 100644 --- a/libraries/base/Control/Monad.hs +++ b/libraries/base/Control/Monad.hs @@ -104,7 +104,12 @@ infixr 1 <=<, >=> (>=>) :: Monad m => (a -> m b) -> (b -> m c) -> (a -> m c) f >=> g = \x -> f x >>= g --- | Right-to-left Kleisli composition of monads. @('>=>')@, with the arguments flipped +-- | Right-to-left Kleisli composition of monads. @('>=>')@, with the arguments flipped. +-- +-- Note how this operator resembles function composition @('.')@: +-- +-- > (.) :: (b -> c) -> (a -> b) -> a -> c +-- > (<=<) :: Monad m => (b -> m c) -> (a -> m b) -> a -> m c (<=<) :: Monad m => (b -> m c) -> (a -> m b) -> (a -> m c) (<=<) = flip (>=>) From git at git.haskell.org Sun Apr 10 22:17:00 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 10 Apr 2016 22:17:00 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Export zonkEvBinds from TcHsSyn. (ea17363) Message-ID: <20160410221700.CAACF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/ea173634a219e1191144a8c924d88fc6579d4274/ghc >--------------------------------------------------------------- commit ea173634a219e1191144a8c924d88fc6579d4274 Author: Conal Elliott Date: Sun Apr 10 19:13:44 2016 +0200 Export zonkEvBinds from TcHsSyn. Needed for constructing correct constraint-satisfying code (particularly type class instances) in a Core-to-Core transformation. Reviewers: simonpj, austin, bgamari Reviewed By: austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2088 GHC Trac Issues: #11804 (cherry picked from commit 5a1add134fdb2ab4d91b0f66de1dc89f0cd69354) >--------------------------------------------------------------- ea173634a219e1191144a8c924d88fc6579d4274 compiler/typecheck/TcHsSyn.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/typecheck/TcHsSyn.hs b/compiler/typecheck/TcHsSyn.hs index 5a5a3a7..dedcbbc 100644 --- a/compiler/typecheck/TcHsSyn.hs +++ b/compiler/typecheck/TcHsSyn.hs @@ -27,6 +27,7 @@ module TcHsSyn ( emptyZonkEnv, mkEmptyZonkEnv, zonkTcTypeToType, zonkTcTypeToTypes, zonkTyVarOcc, zonkCoToCo, zonkTcKindToKind, + zonkEvBinds, -- * Validity checking checkForRepresentationPolymorphism From git at git.haskell.org Sun Apr 10 22:17:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 10 Apr 2016 22:17:03 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Reduce default for -fmax-pmcheck-iterations from 1e7 to 2e6 (f96ef25) Message-ID: <20160410221703.7B4CC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/f96ef2540d86797802fd699f3267c6aeb07a2e71/ghc >--------------------------------------------------------------- commit f96ef2540d86797802fd699f3267c6aeb07a2e71 Author: Herbert Valerio Riedel Date: Sun Apr 10 19:13:16 2016 +0200 Reduce default for -fmax-pmcheck-iterations from 1e7 to 2e6 The commit 28f951edfe50ea5182065144340061ec326781f5 introduced the `-fmax-pmcheck-iterations` flag and set the default limit to 1e7 iterations. However, this value is still high enough that it can result GHC to exhibit memory spikes beyond 1 GiB of RAM usage (heap profile showed several `(:)`s, as well as `THUNK_2_0`, and `PmCon` during the memory spikes) A value of 2e6 seems to be a safer upper bound which still manages to let the checker not run into the limit in most cases. Test Plan: Validate, try building a few Hackage packages Reviewers: austin, gkaracha, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2095 (cherry picked from commit d2e05c6bd0834421b0c48b3c4287fbe6ee889966) >--------------------------------------------------------------- f96ef2540d86797802fd699f3267c6aeb07a2e71 compiler/cmm/CmmOpt.hs | 6 ++++++ compiler/main/DynFlags.hs | 2 +- compiler/nativeGen/X86/CodeGen.hs | 6 ++++++ compiler/prelude/PrimOp.hs | 5 +++++ compiler/types/OptCoercion.hs | 8 ++++++-- testsuite/tests/pmcheck/should_compile/T11195.hs | 1 + 6 files changed, 25 insertions(+), 3 deletions(-) diff --git a/compiler/cmm/CmmOpt.hs b/compiler/cmm/CmmOpt.hs index 7c634c2..de3061d 100644 --- a/compiler/cmm/CmmOpt.hs +++ b/compiler/cmm/CmmOpt.hs @@ -1,5 +1,11 @@ {-# LANGUAGE CPP #-} +-- The default iteration limit is a bit too low for the definitions +-- in this module. +#if __GLASGOW_HASKELL__ >= 800 +{-# OPTIONS_GHC -fmax-pmcheck-iterations=10000000 #-} +#endif + ----------------------------------------------------------------------------- -- -- Cmm optimisation diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 959a68d..71ad14a 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -1443,7 +1443,7 @@ defaultDynFlags mySettings = debugLevel = 0, simplPhases = 2, maxSimplIterations = 4, - maxPmCheckIterations = 10000000, + maxPmCheckIterations = 2000000, ruleCheck = Nothing, maxRelevantBinds = Just 6, simplTickFactor = 100, diff --git a/compiler/nativeGen/X86/CodeGen.hs b/compiler/nativeGen/X86/CodeGen.hs index 2d22734..cd45d92 100644 --- a/compiler/nativeGen/X86/CodeGen.hs +++ b/compiler/nativeGen/X86/CodeGen.hs @@ -1,5 +1,11 @@ {-# LANGUAGE CPP, GADTs, NondecreasingIndentation #-} +-- The default iteration limit is a bit too low for the definitions +-- in this module. +#if __GLASGOW_HASKELL__ >= 800 +{-# OPTIONS_GHC -fmax-pmcheck-iterations=10000000 #-} +#endif + ----------------------------------------------------------------------------- -- -- Generating machine code (instruction selection) diff --git a/compiler/prelude/PrimOp.hs b/compiler/prelude/PrimOp.hs index 7b37062..be91ae6 100644 --- a/compiler/prelude/PrimOp.hs +++ b/compiler/prelude/PrimOp.hs @@ -6,6 +6,11 @@ {-# LANGUAGE CPP #-} +-- The default is a bit too low for the quite large primOpInfo definition +#if __GLASGOW_HASKELL__ >= 801 +{-# OPTIONS_GHC -fmax-pmcheck-iterations=10000000 #-} +#endif + module PrimOp ( PrimOp(..), PrimOpVecCat(..), allThePrimOps, primOpType, primOpSig, diff --git a/compiler/types/OptCoercion.hs b/compiler/types/OptCoercion.hs index e39f0aa..ca67bc7 100644 --- a/compiler/types/OptCoercion.hs +++ b/compiler/types/OptCoercion.hs @@ -1,8 +1,12 @@ -- (c) The University of Glasgow 2006 {-# LANGUAGE CPP #-} - -- This module used to take 10GB of memory to compile with the new - -- (Nov '15) pattern-match checker. + +-- The default iteration limit is a bit too low for the definitions +-- in this module. +#if __GLASGOW_HASKELL__ >= 800 +{-# OPTIONS_GHC -fmax-pmcheck-iterations=10000000 #-} +#endif module OptCoercion ( optCoercion, checkAxInstCo ) where diff --git a/testsuite/tests/pmcheck/should_compile/T11195.hs b/testsuite/tests/pmcheck/should_compile/T11195.hs index 593223f..236932e 100644 --- a/testsuite/tests/pmcheck/should_compile/T11195.hs +++ b/testsuite/tests/pmcheck/should_compile/T11195.hs @@ -1,4 +1,5 @@ {-# OPTIONS_GHC -Woverlapping-patterns -Wincomplete-patterns #-} +{-# OPTIONS_GHC -fmax-pmcheck-iterations=10000000 #-} module T11195 where From git at git.haskell.org Sun Apr 10 22:17:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 10 Apr 2016 22:17:06 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: RtsFlags: Un-constify temporary buffer (b18d17d) Message-ID: <20160410221706.21D243A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/b18d17d6f2413d7eb88b4ced46d6a8e6623e7b18/ghc >--------------------------------------------------------------- commit b18d17d6f2413d7eb88b4ced46d6a8e6623e7b18 Author: Ben Gamari Date: Sun Apr 10 23:28:46 2016 +0200 RtsFlags: Un-constify temporary buffer Otherwise we get a const-ness mismatch when we free the buffer, which for some reason gcc 5.3 didn't notice. (cherry picked from commit 378091c9ef6d25a076125f0b82dce1a155c0e8f0) >--------------------------------------------------------------- b18d17d6f2413d7eb88b4ced46d6a8e6623e7b18 rts/RtsFlags.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c index ed6f43e..5ecb5e0 100644 --- a/rts/RtsFlags.c +++ b/rts/RtsFlags.c @@ -1576,7 +1576,7 @@ static rtsBool read_heap_profiling_flag(const char *arg_in) // However, for sanity we want to guarantee const-correctness and parsing // really ought to be an immutable operation. To avoid rewriting the parser // we just operate on a temporary copy of the argument. - const char *arg = strdup(arg_in); + char *arg = strdup(arg_in); rtsBool error = rtsFalse; switch (arg[2]) { case '\0': From git at git.haskell.org Sun Apr 10 22:17:09 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 10 Apr 2016 22:17:09 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Fix suggestions for unbound variables (#11680) (f93c951) Message-ID: <20160410221709.9218F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/f93c9517a2c6e158e4a5c5bc7a3d3f88cb4ed119/ghc >--------------------------------------------------------------- commit f93c9517a2c6e158e4a5c5bc7a3d3f88cb4ed119 Author: Jason Eisenberg Date: Sun Apr 10 19:17:46 2016 +0200 Fix suggestions for unbound variables (#11680) When the typechecker generates the error message for an out-of-scope variable, it now uses the GlobalRdrEnv with respect to which the variable is unbound, not the GlobalRdrEnv which is available at the time the error is reported. Doing so ensures we do not provide suggestions which themselves are out-of-scope (because they are bound in a later inter-splice group). Nonetheless, we do note in the error message if an unambiguous, exact match to the out-of-scope variable is found in a later inter-splice group, and we specify where that match is not in scope. Test Plan: ./validate Reviewers: goldfire, austin, bgamari Reviewed By: goldfire Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2000 GHC Trac Issues: #11680 (cherry picked from commit 470d4d5b8e7cbcc176b1f3ac26ce0d95acd35a78) >--------------------------------------------------------------- f93c9517a2c6e158e4a5c5bc7a3d3f88cb4ed119 compiler/basicTypes/OccName.hs | 1 + compiler/basicTypes/RdrName.hs | 10 +- compiler/deSugar/DsMeta.hs | 4 +- compiler/hsSyn/HsExpr.hs | 105 +++++++++++++++++-- compiler/rename/RnExpr.hs | 8 +- compiler/rename/RnSource.hs | 2 +- compiler/rename/RnTypes.hs | 6 +- compiler/typecheck/TcCanonical.hs | 12 +-- compiler/typecheck/TcErrors.hs | 209 +++++++++++++++++++++++++++++++++----- compiler/typecheck/TcExpr.hs | 10 +- compiler/typecheck/TcHsSyn.hs | 3 +- compiler/typecheck/TcRnDriver.hs | 9 +- compiler/typecheck/TcRnMonad.hs | 24 ++++- compiler/typecheck/TcRnTypes.hs | 56 ++++++---- testsuite/tests/th/T11680.hs | 122 ++++++++++++++++++++++ testsuite/tests/th/T11680.stderr | 49 +++++++++ testsuite/tests/th/all.T | 2 + 17 files changed, 547 insertions(+), 85 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc f93c9517a2c6e158e4a5c5bc7a3d3f88cb4ed119 From git at git.haskell.org Sun Apr 10 22:17:13 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 10 Apr 2016 22:17:13 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Remove the instantiation check when deriving Generic(1) (a2b9c53) Message-ID: <20160410221713.26C4F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/a2b9c53e5e4756c23fe3d4f6f3face7ae2efafc6/ghc >--------------------------------------------------------------- commit a2b9c53e5e4756c23fe3d4f6f3face7ae2efafc6 Author: RyanGlScott Date: Sun Apr 10 22:59:37 2016 +0200 Remove the instantiation check when deriving Generic(1) Previously, deriving `Generic(1)` bailed out when attempting to instantiate visible type parameters (#5939), but this instantiation check was quite fragile and doesn't interact well with `-XTypeInType`. It has been decided that `Generic(1)` shouldn't be subjected to this check anyway, so it has been removed, and `gen_Generic_binds`'s machinery has been updated to substitute the type variables in a generated `Rep`/`Rep1` instance with the user-supplied type arguments. In addition, this also refactors `Condition` in `TcDeriv` a bit. Namely, since we no longer need `tc_args` to check any conditions, the `[Type]` component of `Condition` has been removed. Fixes #11732. Test Plan: ./validate Reviewers: goldfire, kosmikus, simonpj, bgamari, austin Reviewed By: simonpj, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2061 GHC Trac Issues: #5939, #11732 (cherry picked from commit 7443e5c8dae24b83f5f4975c7accce02b819029c) >--------------------------------------------------------------- a2b9c53e5e4756c23fe3d4f6f3face7ae2efafc6 compiler/typecheck/TcDeriv.hs | 86 +++++++--- compiler/typecheck/TcGenGenerics.hs | 178 ++++++++++++--------- docs/users_guide/8.0.1-notes.rst | 7 + testsuite/tests/deriving/should_compile/T11732a.hs | 11 ++ testsuite/tests/deriving/should_compile/T11732b.hs | 12 ++ testsuite/tests/deriving/should_compile/T11732c.hs | 18 +++ testsuite/tests/deriving/should_compile/T5939.hs | 14 ++ testsuite/tests/deriving/should_compile/all.T | 4 + testsuite/tests/generics/GenCannotDoRep0_0.stderr | 30 ++-- 9 files changed, 248 insertions(+), 112 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc a2b9c53e5e4756c23fe3d4f6f3face7ae2efafc6 From git at git.haskell.org Sun Apr 10 22:17:15 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 10 Apr 2016 22:17:15 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: base: Fix "since" annotation on GHC.ExecutionStack (7f27f7a) Message-ID: <20160410221715.D2D903A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/7f27f7a2463bd0e7f8ebc28881c6441476a7cb3a/ghc >--------------------------------------------------------------- commit 7f27f7a2463bd0e7f8ebc28881c6441476a7cb3a Author: Ben Gamari Date: Sun Apr 10 20:00:48 2016 +0200 base: Fix "since" annotation on GHC.ExecutionStack I have no idea where "4.11" came from. (cherry picked from commit ad532ded871a9a5180388a2b7cdbdc26e053284c) >--------------------------------------------------------------- 7f27f7a2463bd0e7f8ebc28881c6441476a7cb3a libraries/base/GHC/ExecutionStack.hs | 2 +- libraries/base/GHC/ExecutionStack/Internal.hsc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/base/GHC/ExecutionStack.hs b/libraries/base/GHC/ExecutionStack.hs index 22be903..966ba29 100644 --- a/libraries/base/GHC/ExecutionStack.hs +++ b/libraries/base/GHC/ExecutionStack.hs @@ -26,7 +26,7 @@ -- ,("RTS expects libdw","YES") -- @ -- --- /Since: 4.11.0.0/ +-- /Since: 4.9.0.0/ ----------------------------------------------------------------------------- module GHC.ExecutionStack ( diff --git a/libraries/base/GHC/ExecutionStack/Internal.hsc b/libraries/base/GHC/ExecutionStack/Internal.hsc index e966e17..340cdc4 100644 --- a/libraries/base/GHC/ExecutionStack/Internal.hsc +++ b/libraries/base/GHC/ExecutionStack/Internal.hsc @@ -10,7 +10,7 @@ -- -- Internals of the `GHC.ExecutionStack` module -- --- /Since: 4.11.0.0/ +-- /Since: 4.9.0.0/ ----------------------------------------------------------------------------- #include "HsFFI.h" From git at git.haskell.org Sun Apr 10 22:17:18 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 10 Apr 2016 22:17:18 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Bump haddock submodule (1321c62) Message-ID: <20160410221718.85E953A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/1321c62c4fabc4c9f2ad372dd80acd756ca78ff9/ghc >--------------------------------------------------------------- commit 1321c62c4fabc4c9f2ad372dd80acd756ca78ff9 Author: Ben Gamari Date: Sun Apr 10 23:47:42 2016 +0200 Bump haddock submodule Fixes #11818, where haddock's documentation broke `make install` when Sphinx is not available. >--------------------------------------------------------------- 1321c62c4fabc4c9f2ad372dd80acd756ca78ff9 utils/haddock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/haddock b/utils/haddock index 1308be3..7699b27 160000 --- a/utils/haddock +++ b/utils/haddock @@ -1 +1 @@ -Subproject commit 1308be34399d1819e39f6ad1ea41928681110a4a +Subproject commit 7699b27c5766473709bc84bc69269a409dfad9a2 From git at git.haskell.org Sun Apr 10 23:42:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 10 Apr 2016 23:42:03 +0000 (UTC) Subject: [commit: ghc] master: Change runtime linker to perform lazy loading of symbols/sections (90538d8) Message-ID: <20160410234203.1A6ED3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/90538d86af579595987826cd893828d6f379f35a/ghc >--------------------------------------------------------------- commit 90538d86af579595987826cd893828d6f379f35a Author: Tamar Christina Date: Mon Apr 11 00:38:42 2016 +0200 Change runtime linker to perform lazy loading of symbols/sections The Runtime Linker is currently eagerly loading all object files on all platforms which do not use the system linker for `GHCi`. The problem with this approach is that it requires all symbols to be found. Even those of functions never used/called. This makes the number of libraries required to link things like `mingwex` quite high. To work around this the `rts` was relying on a trick. It itself was compiled with `MingW64-w`'s `GCC`. So it was already linked against `mingwex`. As such, it re-exported the symbols from itself. While this worked it made it impossible to link against `mingwex` in user libraries. And with this means no `C99` code could ever run in `GHCi` on Windows without having the required symbols re-exported from the rts. Consequently this rules out a large number of packages on Windows. SDL2, HMatrix etc. After talking with @rwbarton I have taken the approach of loading entire object files when a symbol is needed instead of doing the dependency tracking on a per symbol basis. This is a lot less fragile and a lot less complicated to implement. The changes come down to the following steps: 1) modify the linker to and introduce a new state for ObjectCode: `Needed`. A Needed object is one that is required for the linking to succeed. The initial set consists of all Object files passed as arguments to the link. 2) Change `ObjectCode`'s to be indexed but not initialized or resolved. This means we know where we would load the symbols, but haven't actually done so. 3) Mark any `ObjectCode` belonging to `.o` passed as argument as required: ObjectState `NEEDED`. 4) During `Resolve` object calls, mark all `ObjectCode` containing the required symbols as `NEEDED` 5) During `lookupSymbol` lookups, (which is called from `linkExpr` and `linkDecl` in `GHCI.hs`) is the symbol is in a not-yet-loaded `ObjectCode` then load the `ObjectCode` on demand and return the address of the symbol. Otherwise produce an unresolved symbols error as expected. 6) On `unloadObj` we then change the state of the object and remove it's symbols from the `reqSymHash` table so it can be reloaded. This change affects all platforms and OSes which use the runtime linker. It seems there are no real perf tests for `GHCi`, but performance shouldn't be impacted much. We gain a lot of time not loading all `obj` files, and we lose some time in `lookupSymbol` when we're finding sections that have to be loaded. The actual finding itself is O(1) (Assuming the hashtnl is perfect) It also consumes slighly more memory as instead of storing just the address of a symbol I also store some other information, like if the symbol is weak or not. This change will break any packages relying on renamed POSIX functions that were re-named and re-exported by the rts. Any packages following the proper naming for functions as found on MSDN will work fine. Test Plan: ./validate on all platforms which use the Runtime linker. Reviewers: thomie, rwbarton, simonmar, erikd, bgamari, austin, hvr Reviewed By: erikd Subscribers: kgardas, gridaphobe, RyanGlScott, simonmar, rwbarton, #ghc_windows_task_force Differential Revision: https://phabricator.haskell.org/D1805 GHC Trac Issues: #11223 >--------------------------------------------------------------- 90538d86af579595987826cd893828d6f379f35a compiler/main/SysTools.hs | 19 +- configure.ac | 3 - docs/users_guide/8.0.1-notes.rst | 9 + libraries/base/System/Posix/Internals.hs | 131 ++++-- libraries/base/base.cabal | 10 +- libraries/base/include/HsBase.h | 2 +- libraries/ghc-prim/ghc-prim.cabal | 14 + rts/Linker.c | 445 ++++++++++++++++----- rts/LinkerInternals.h | 23 +- rts/RtsSymbols.c | 319 +-------------- testsuite/tests/ghci/linking/dyn/all.T | 2 +- testsuite/tests/rts/T11223/Makefile | 126 ++++++ .../rts/T11223/T11223_link_order_a_b_2_fail.stderr | 25 ++ .../T11223_link_order_a_b_2_fail.stderr-mingw32 | 25 ++ .../T11223/T11223_link_order_a_b_succeed.stdout | 1 + .../T11223/T11223_link_order_b_a_2_succeed.stdout | 1 + .../T11223/T11223_link_order_b_a_succeed.stdout | 1 + .../rts/T11223/T11223_simple_duplicate_lib.stderr | 25 ++ .../T11223_simple_duplicate_lib.stderr-mingw32 | 25 ++ ..._simple_duplicate_lib.stderr.normalised-mingw32 | 24 ++ .../tests/rts/T11223/T11223_simple_link.stdout | 1 + .../tests/rts/T11223/T11223_simple_link_lib.stdout | 1 + .../T11223_simple_unused_duplicate_lib.stdout | 1 + testsuite/tests/rts/T11223/all.T | 93 +++++ testsuite/tests/rts/T11223/bar.c | 4 + testsuite/tests/rts/T11223/foo.c | 14 + testsuite/tests/rts/T11223/foo.hs | 5 + testsuite/tests/rts/T11223/foo2.hs | 5 + testsuite/tests/rts/T11223/foo3.hs | 6 + testsuite/tests/rts/T11223/power.c | 10 + testsuite/tests/rts/T11223/power.hs | 5 + testsuite/tests/rts/T11223/power3.hs | 5 + testsuite/tests/rts/T11223/power_slow.c | 14 + 33 files changed, 943 insertions(+), 451 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 90538d86af579595987826cd893828d6f379f35a From git at git.haskell.org Mon Apr 11 00:05:16 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 11 Apr 2016 00:05:16 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: When encountering a duplicate symbol, show source of the first symbol (02f3c8f) Message-ID: <20160411000516.09A6D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/02f3c8fdb71f5e1a190061bd2a687963cf10141f/ghc >--------------------------------------------------------------- commit 02f3c8fdb71f5e1a190061bd2a687963cf10141f Author: Reid Barton Date: Sun Jan 31 19:10:29 2016 -0500 When encountering a duplicate symbol, show source of the first symbol Test Plan: Used this to track down an issue I was having. Reviewers: simonmar, austin, erikd, bgamari Reviewed By: erikd, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1863 (cherry picked from commit 34519f0811c58cb1fd073fae3f83b6543c69a634) >--------------------------------------------------------------- 02f3c8fdb71f5e1a190061bd2a687963cf10141f rts/Linker.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rts/Linker.c b/rts/Linker.c index b9a1d34..29bd5d8 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -430,13 +430,17 @@ static int ghciInsertSymbolTable( " %s\n" "whilst processing object file\n" " %" PATH_FMT "\n" + "The symbol was previously defined in\n" + " %" PATH_FMT "\n" "This could be caused by:\n" " * Loading two different object files which export the same symbol\n" " * Specifying the same object file twice on the GHCi command line\n" " * An incorrect `package.conf' entry, causing some object to be\n" " loaded twice.\n", (char*)key, - obj_name + obj_name, + pinfo->owner->archiveMemberName ? pinfo->owner->archiveMemberName + : pinfo->owner->fileName ); return 0; } From git at git.haskell.org Mon Apr 11 00:05:18 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 11 Apr 2016 00:05:18 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Fix runtime linker error message when old symbol had no owner (38230e2) Message-ID: <20160411000518.A7F573A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/38230e2d4877e9eafcf0c1f8b5dc8bb531dfa348/ghc >--------------------------------------------------------------- commit 38230e2d4877e9eafcf0c1f8b5dc8bb531dfa348 Author: Reid Barton Date: Mon Feb 1 09:43:48 2016 -0500 Fix runtime linker error message when old symbol had no owner Test Plan: Actually run validate. This fixes test linker_error3. Reviewers: austin, erikd, bgamari Reviewed By: erikd, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1874 (cherry picked from commit 73293109645efe42bf3fdf3335f4ab7cef39001b) >--------------------------------------------------------------- 38230e2d4877e9eafcf0c1f8b5dc8bb531dfa348 rts/Linker.c | 1 + 1 file changed, 1 insertion(+) diff --git a/rts/Linker.c b/rts/Linker.c index 29bd5d8..c225ab6 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -439,6 +439,7 @@ static int ghciInsertSymbolTable( " loaded twice.\n", (char*)key, obj_name, + pinfo->owner == NULL ? "(GHCi built-in symbols)" : pinfo->owner->archiveMemberName ? pinfo->owner->archiveMemberName : pinfo->owner->fileName ); From git at git.haskell.org Mon Apr 11 00:05:21 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 11 Apr 2016 00:05:21 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Fix Windows build after D1874 (88a370d) Message-ID: <20160411000521.5B3E43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/88a370ddbe28ca070ac69262cbff451b263e7f44/ghc >--------------------------------------------------------------- commit 88a370ddbe28ca070ac69262cbff451b263e7f44 Author: Tamar Christina Date: Tue Feb 2 12:36:52 2016 +0100 Fix Windows build after D1874 Windows uses wchar_t* for paths. The code committed won't compile for Windows as the types are incorrect and the types in the branches of the ternary operator aren't consistent. Test Plan: ./validate --fast Reviewers: austin, rwbarton, erikd, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1878 (cherry picked from commit 01c587c03764de52cd01a3464c1a4a5c5bce7c00) >--------------------------------------------------------------- 88a370ddbe28ca070ac69262cbff451b263e7f44 rts/Linker.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/rts/Linker.c b/rts/Linker.c index c225ab6..c7c61cf 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -199,6 +199,21 @@ static pathchar* pathdup(pathchar *path) return ret; } +static pathchar* mkPath(char* path) +{ +#if defined(mingw32_HOST_OS) + size_t required = mbstowcs(NULL, path, 0); + pathchar *ret = stgMallocBytes(sizeof(pathchar) * (required + 1), "mkPath"); + if (mbstowcs(ret, path, required) == (size_t)-1) + { + barf("mkPath failed converting char* to wchar_t*"); + } + + return ret; +#else + return pathdup(path); +#endif +} #if defined(OBJFORMAT_ELF) static int ocVerifyImage_ELF ( ObjectCode* oc ); @@ -425,6 +440,7 @@ static int ghciInsertSymbolTable( pinfo->weak = HS_BOOL_FALSE; return 1; } + pathchar* archiveName = NULL; debugBelch( "GHC runtime linker: fatal error: I found a duplicate definition for symbol\n" " %s\n" @@ -439,10 +455,16 @@ static int ghciInsertSymbolTable( " loaded twice.\n", (char*)key, obj_name, - pinfo->owner == NULL ? "(GHCi built-in symbols)" : - pinfo->owner->archiveMemberName ? pinfo->owner->archiveMemberName + pinfo->owner == NULL ? WSTR("(GHCi built-in symbols)") : + pinfo->owner->archiveMemberName ? archiveName = mkPath(pinfo->owner->archiveMemberName) : pinfo->owner->fileName ); + + if (archiveName) + { + stgFree(archiveName); + archiveName = NULL; + } return 0; } From git at git.haskell.org Mon Apr 11 00:05:24 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 11 Apr 2016 00:05:24 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Reduce fragmentation from m32_allocator (5a361d8) Message-ID: <20160411000524.033863A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/5a361d89cc457c798e0992cb8fddd16a3ecb9218/ghc >--------------------------------------------------------------- commit 5a361d89cc457c798e0992cb8fddd16a3ecb9218 Author: Bartosz Nitka Date: Sun Mar 6 13:18:12 2016 -0800 Reduce fragmentation from m32_allocator This patch brings in two improvements: a) m32_allocator will now reuse the pages that are no longer used by anyone else. b) m32_allocator will preallocate the "filling" area, so that the pages it allocates end up as a big chunk instead of being allocated on demand in random places, fragmenting the precious lower 2G address space. Test Plan: testsuite - 3 tests failing with substTy asserts Reviewers: ezyang, austin, bgamari, erikd, hsyl20, simonmar Reviewed By: hsyl20, simonmar Subscribers: hvr, thomie Differential Revision: https://phabricator.haskell.org/D1976 (cherry picked from commit 82e36edcbd831e9b7c05e1c2cb918ad5de56cd3a) >--------------------------------------------------------------- 5a361d89cc457c798e0992cb8fddd16a3ecb9218 rts/Linker.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/rts/Linker.c b/rts/Linker.c index c7c61cf..be48484 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -281,6 +281,7 @@ struct m32_alloc_t { }; #define M32_MAX_PAGES 32 +#define M32_REFCOUNT_BYTES 8 /** * Allocator @@ -1460,6 +1461,16 @@ static void munmapForLinker (void * addr, size_t size) */ static void m32_allocator_init(m32_allocator m32) { memset(m32, 0, sizeof(struct m32_allocator_t)); + // Preallocate the initial M32_MAX_PAGES to ensure that they don't + // fragment the memory. + unsigned int pgsz = (unsigned int)getPageSize(); + char* bigchunk = mmapForLinker(pgsz * M32_MAX_PAGES,MAP_ANONYMOUS,-1,0); + int i; + for (i=0; ipages[i].base_addr = bigchunk + i*pgsz; + *((uintptr_t*)m32->pages[i].base_addr) = 1; + m32->pages[i].current_size = M32_REFCOUNT_BYTES; + } } /** @@ -1493,7 +1504,7 @@ static void m32_allocator_flush(m32_allocator m32) { // Return true if the object has its own dedicated set of pages #define m32_is_large_object(size,alignment) \ - (size >= getPageSize() - ROUND_UP(8,alignment)) + (size >= getPageSize() - ROUND_UP(M32_REFCOUNT_BYTES,alignment)) // Return true if the object has its own dedicated set of pages #define m32_is_large_object_addr(addr) \ @@ -1544,6 +1555,14 @@ m32_alloc(m32_allocator m32, unsigned int size, empty = empty == -1 ? i : empty; continue; } + // If the page is referenced only by the allocator, we can reuse it. + // If we don't then we'll be left with a bunch of pages that have a + // few bytes left to allocate and we don't get to use or free them + // until we use up all the "filling" pages. This will unnecessarily + // allocate new pages and fragment the address space. + if (*((uintptr_t*)(m32->pages[i].base_addr)) == 1) { + m32->pages[i].current_size = M32_REFCOUNT_BYTES; + } // page can contain the buffer? unsigned int alsize = ROUND_UP(m32->pages[i].current_size, alignment); if (size <= pgsz - alsize) { @@ -1575,12 +1594,13 @@ m32_alloc(m32_allocator m32, unsigned int size, return NULL; } m32->pages[empty].base_addr = addr; - // Add 8 bytes for the counter + padding - m32->pages[empty].current_size = size+ROUND_UP(8,alignment); + // Add M32_REFCOUNT_BYTES bytes for the counter + padding + m32->pages[empty].current_size = + size+ROUND_UP(M32_REFCOUNT_BYTES,alignment); // Initialize the counter: // 1 for the allocator + 1 for the returned allocated memory *((uintptr_t*)addr) = 2; - return (char*)addr + ROUND_UP(8,alignment); + return (char*)addr + ROUND_UP(M32_REFCOUNT_BYTES,alignment); } } From git at git.haskell.org Mon Apr 11 00:05:26 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 11 Apr 2016 00:05:26 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Change runtime linker to perform lazy loading of symbols/sections (068d927) Message-ID: <20160411000526.CEF123A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/068d9273f0a427cbab4ea95cfca211ec127dc785/ghc >--------------------------------------------------------------- commit 068d9273f0a427cbab4ea95cfca211ec127dc785 Author: Tamar Christina Date: Mon Apr 11 00:38:42 2016 +0200 Change runtime linker to perform lazy loading of symbols/sections The Runtime Linker is currently eagerly loading all object files on all platforms which do not use the system linker for `GHCi`. The problem with this approach is that it requires all symbols to be found. Even those of functions never used/called. This makes the number of libraries required to link things like `mingwex` quite high. To work around this the `rts` was relying on a trick. It itself was compiled with `MingW64-w`'s `GCC`. So it was already linked against `mingwex`. As such, it re-exported the symbols from itself. While this worked it made it impossible to link against `mingwex` in user libraries. And with this means no `C99` code could ever run in `GHCi` on Windows without having the required symbols re-exported from the rts. Consequently this rules out a large number of packages on Windows. SDL2, HMatrix etc. After talking with @rwbarton I have taken the approach of loading entire object files when a symbol is needed instead of doing the dependency tracking on a per symbol basis. This is a lot less fragile and a lot less complicated to implement. The changes come down to the following steps: 1) modify the linker to and introduce a new state for ObjectCode: `Needed`. A Needed object is one that is required for the linking to succeed. The initial set consists of all Object files passed as arguments to the link. 2) Change `ObjectCode`'s to be indexed but not initialized or resolved. This means we know where we would load the symbols, but haven't actually done so. 3) Mark any `ObjectCode` belonging to `.o` passed as argument as required: ObjectState `NEEDED`. 4) During `Resolve` object calls, mark all `ObjectCode` containing the required symbols as `NEEDED` 5) During `lookupSymbol` lookups, (which is called from `linkExpr` and `linkDecl` in `GHCI.hs`) is the symbol is in a not-yet-loaded `ObjectCode` then load the `ObjectCode` on demand and return the address of the symbol. Otherwise produce an unresolved symbols error as expected. 6) On `unloadObj` we then change the state of the object and remove it's symbols from the `reqSymHash` table so it can be reloaded. This change affects all platforms and OSes which use the runtime linker. It seems there are no real perf tests for `GHCi`, but performance shouldn't be impacted much. We gain a lot of time not loading all `obj` files, and we lose some time in `lookupSymbol` when we're finding sections that have to be loaded. The actual finding itself is O(1) (Assuming the hashtnl is perfect) It also consumes slighly more memory as instead of storing just the address of a symbol I also store some other information, like if the symbol is weak or not. This change will break any packages relying on renamed POSIX functions that were re-named and re-exported by the rts. Any packages following the proper naming for functions as found on MSDN will work fine. Test Plan: ./validate on all platforms which use the Runtime linker. Reviewers: thomie, rwbarton, simonmar, erikd, bgamari, austin, hvr Reviewed By: erikd Subscribers: kgardas, gridaphobe, RyanGlScott, simonmar, rwbarton, #ghc_windows_task_force Differential Revision: https://phabricator.haskell.org/D1805 GHC Trac Issues: #11223 (cherry picked from commit 90538d86af579595987826cd893828d6f379f35a) >--------------------------------------------------------------- 068d9273f0a427cbab4ea95cfca211ec127dc785 compiler/main/SysTools.hs | 19 +- configure.ac | 3 - docs/users_guide/8.0.1-notes.rst | 9 + libraries/base/System/Posix/Internals.hs | 131 ++++-- libraries/base/base.cabal | 10 +- libraries/base/include/HsBase.h | 2 +- libraries/ghc-prim/ghc-prim.cabal | 14 + rts/Linker.c | 445 ++++++++++++++++----- rts/LinkerInternals.h | 23 +- rts/RtsSymbols.c | 319 +-------------- testsuite/tests/ghci/linking/dyn/all.T | 2 +- testsuite/tests/rts/T11223/Makefile | 126 ++++++ .../rts/T11223/T11223_link_order_a_b_2_fail.stderr | 25 ++ .../T11223_link_order_a_b_2_fail.stderr-mingw32 | 25 ++ .../T11223/T11223_link_order_a_b_succeed.stdout | 1 + .../T11223/T11223_link_order_b_a_2_succeed.stdout | 1 + .../T11223/T11223_link_order_b_a_succeed.stdout | 1 + .../rts/T11223/T11223_simple_duplicate_lib.stderr | 25 ++ .../T11223_simple_duplicate_lib.stderr-mingw32 | 25 ++ ..._simple_duplicate_lib.stderr.normalised-mingw32 | 24 ++ .../tests/rts/T11223/T11223_simple_link.stdout | 1 + .../tests/rts/T11223/T11223_simple_link_lib.stdout | 1 + .../T11223_simple_unused_duplicate_lib.stdout | 1 + testsuite/tests/rts/T11223/all.T | 93 +++++ testsuite/tests/rts/T11223/bar.c | 4 + testsuite/tests/rts/T11223/foo.c | 14 + testsuite/tests/rts/T11223/foo.hs | 5 + testsuite/tests/rts/T11223/foo2.hs | 5 + testsuite/tests/rts/T11223/foo3.hs | 6 + testsuite/tests/rts/T11223/power.c | 10 + testsuite/tests/rts/T11223/power.hs | 5 + testsuite/tests/rts/T11223/power3.hs | 5 + testsuite/tests/rts/T11223/power_slow.c | 14 + 33 files changed, 943 insertions(+), 451 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 068d9273f0a427cbab4ea95cfca211ec127dc785 From git at git.haskell.org Mon Apr 11 00:05:29 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 11 Apr 2016 00:05:29 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Omit TEST=T10697_decided_3 WAY=ghci (a4dcdfa) Message-ID: <20160411000529.7D1703A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/a4dcdfa560f645bf96496235a5d94d2fff728862/ghc >--------------------------------------------------------------- commit a4dcdfa560f645bf96496235a5d94d2fff728862 Author: Thomas Miedema Date: Fri Jan 1 12:46:37 2016 +0100 Omit TEST=T10697_decided_3 WAY=ghci (cherry picked from commit d935d20988af7f3109b73d7c51a0e4a6b12b926c) >--------------------------------------------------------------- a4dcdfa560f645bf96496235a5d94d2fff728862 testsuite/tests/th/all.T | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index d9536c7..c398a31 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -363,7 +363,7 @@ test('T10620', normal, compile_and_run, ['-v0']) test('T10638', normal, compile_fail, ['-v0']) test('T10697_decided_1', normal, compile_and_run, ['-v0']) test('T10697_decided_2', normal, compile_and_run, ['-XStrictData -v0']) -test('T10697_decided_3', normal, +test('T10697_decided_3', omit_ways(['ghci']), # ghci doesn't support -O(2) compile_and_run, ['-XStrictData -funbox-strict-fields -O2 -v0']) test('T10697_source', From git at git.haskell.org Mon Apr 11 01:16:21 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 11 Apr 2016 01:16:21 +0000 (UTC) Subject: [commit: ghc] master: Fix a closed type family error message (46e8f19) Message-ID: <20160411011621.AFB9E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/46e8f199e4d3baffa306a40082fbc2fce67f779f/ghc >--------------------------------------------------------------- commit 46e8f199e4d3baffa306a40082fbc2fce67f779f Author: Rik Steenkamp Date: Mon Apr 11 02:26:06 2016 +0200 Fix a closed type family error message Now we check whether a closed type family's equation is headed with the correct type before we kind-check the equation. Also, instead of "expected only no parameters" we now generate the message "expected no parameters". Fixes #11623. Reviewers: simonpj, austin, bgamari Reviewed By: simonpj, bgamari Subscribers: simonpj, goldfire, thomie Differential Revision: https://phabricator.haskell.org/D2089 GHC Trac Issues: #11623 >--------------------------------------------------------------- 46e8f199e4d3baffa306a40082fbc2fce67f779f compiler/typecheck/TcTyClsDecls.hs | 23 ++++++++++++---------- testsuite/tests/typecheck/should_fail/T11623.hs | 5 +++++ .../tests/typecheck/should_fail/T11623.stderr | 6 ++++++ testsuite/tests/typecheck/should_fail/all.T | 1 + 4 files changed, 25 insertions(+), 10 deletions(-) diff --git a/compiler/typecheck/TcTyClsDecls.hs b/compiler/typecheck/TcTyClsDecls.hs index 6fff74e..7ad7bb4 100644 --- a/compiler/typecheck/TcTyClsDecls.hs +++ b/compiler/typecheck/TcTyClsDecls.hs @@ -1070,12 +1070,16 @@ proper tcMatchTys here.) -} ------------------------- kcTyFamInstEqn :: FamTyConShape -> LTyFamInstEqn Name -> TcM () -kcTyFamInstEqn fam_tc_shape - (L loc (TyFamEqn { tfe_pats = pats, tfe_rhs = hs_ty })) +kcTyFamInstEqn fam_tc_shape@(fam_tc_name,_,_,_) + (L loc (TyFamEqn { tfe_tycon = L _ eqn_tc_name + , tfe_pats = pats + , tfe_rhs = hs_ty })) = setSrcSpan loc $ - discardResult $ - tc_fam_ty_pats fam_tc_shape Nothing -- not an associated type - pats (discardResult . (tcCheckLHsType hs_ty)) + do { checkTc (fam_tc_name == eqn_tc_name) + (wrongTyFamName fam_tc_name eqn_tc_name) + ; discardResult $ + tc_fam_ty_pats fam_tc_shape Nothing -- not an associated type + pats (discardResult . (tcCheckLHsType hs_ty)) } tcTyFamInstEqn :: FamTyConShape -> Maybe ClsInfo -> LTyFamInstEqn Name -> TcM CoAxBranch -- Needs to be here, not in TcInstDcls, because closed families @@ -1084,12 +1088,11 @@ tcTyFamInstEqn fam_tc_shape@(fam_tc_name,_,_,_) mb_clsinfo (L loc (TyFamEqn { tfe_tycon = L _ eqn_tc_name , tfe_pats = pats , tfe_rhs = hs_ty })) - = setSrcSpan loc $ + = ASSERT( fam_tc_name == eqn_tc_name ) + setSrcSpan loc $ tcFamTyPats fam_tc_shape mb_clsinfo pats (discardResult . (tcCheckLHsType hs_ty)) $ \tvs' pats' res_kind -> - do { checkTc (fam_tc_name == eqn_tc_name) - (wrongTyFamName fam_tc_name eqn_tc_name) - ; rhs_ty <- solveEqualities $ tcCheckLHsType hs_ty res_kind + do { rhs_ty <- solveEqualities $ tcCheckLHsType hs_ty res_kind ; rhs_ty <- zonkTcTypeToType emptyZonkEnv rhs_ty ; traceTc "tcTyFamInstEqn" (ppr fam_tc_name <+> pprTvBndrs tvs') -- don't print out the pats here, as they might be zonked inside the knot @@ -1206,7 +1209,7 @@ tc_fam_ty_pats (name, _, binders, res_kind) mb_clsinfo too_many_args hs_ty n = hang (text "Too many parameters to" <+> ppr name <> colon) 2 (vcat [ ppr hs_ty <+> text "is unexpected;" - , text "expected only" <+> + , text (if n == 1 then "expected" else "expected only") <+> speakNOf (n-1) (text "parameter") ]) -- See Note [tc_fam_ty_pats vs tcFamTyPats] diff --git a/testsuite/tests/typecheck/should_fail/T11623.hs b/testsuite/tests/typecheck/should_fail/T11623.hs new file mode 100644 index 0000000..d55ca47 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T11623.hs @@ -0,0 +1,5 @@ +{-# LANGUAGE TypeFamilies #-} + +module T11623 where + +type family T where { Maybe T = Int } diff --git a/testsuite/tests/typecheck/should_fail/T11623.stderr b/testsuite/tests/typecheck/should_fail/T11623.stderr new file mode 100644 index 0000000..0f6253f --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T11623.stderr @@ -0,0 +1,6 @@ + +T11623.hs:5:23: error: + ? Mismatched type name in type family instance. + Expected: T + Actual: Maybe + ? In the type family declaration for ?T? diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index c1c7818..fe40ca2 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -409,6 +409,7 @@ test('T11464', normal, compile_fail, ['']) test('T11563', normal, compile_fail, ['']) test('T11541', normal, compile_fail, ['']) test('T11313', normal, compile_fail, ['']) +test('T11623', normal, compile_fail, ['']) test('T11723', normal, compile_fail, ['']) test('T11724', normal, compile_fail, ['']) test('BadUnboxedTuple', normal, compile_fail, ['']) From git at git.haskell.org Mon Apr 11 01:16:25 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 11 Apr 2016 01:16:25 +0000 (UTC) Subject: [commit: ghc] master: Filter out invisible kind arguments during TH reification (02a5c58) Message-ID: <20160411011625.171043A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/02a5c580b6078630842f4c3db5d92631fada21e9/ghc >--------------------------------------------------------------- commit 02a5c580b6078630842f4c3db5d92631fada21e9 Author: RyanGlScott Date: Mon Apr 11 02:34:55 2016 +0200 Filter out invisible kind arguments during TH reification Previously, all kind arguments were being reified, which would cause something like this: ``` type Id a = a data Proxy (a :: Id k) = Proxy ``` to output ``` data Proxy (a :: Id * k) = Proxy ``` when `Proxy`'s `Info` is reified. The fix is simple: simply call `filterOutInvisibleTypes` on the kind arguments of a kind synonym application. Fixes #11463. Test Plan: ./validate Reviewers: austin, bgamari, goldfire Reviewed By: goldfire Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2081 GHC Trac Issues: #11463 >--------------------------------------------------------------- 02a5c580b6078630842f4c3db5d92631fada21e9 compiler/typecheck/TcSplice.hs | 4 +++- testsuite/tests/th/T11463.hs | 18 ++++++++++++++++++ testsuite/tests/th/T11463.stdout | 2 ++ testsuite/tests/th/all.T | 1 + 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/compiler/typecheck/TcSplice.hs b/compiler/typecheck/TcSplice.hs index cabe75e..6183c59 100644 --- a/compiler/typecheck/TcSplice.hs +++ b/compiler/typecheck/TcSplice.hs @@ -1650,12 +1650,14 @@ reifyKind ki reify_kc_app :: TyCon -> [TyCoRep.Kind] -> TcM TH.Kind reify_kc_app kc kis - = fmap (mkThAppTs r_kc) (mapM reifyKind kis) + = fmap (mkThAppTs r_kc) (mapM reifyKind vis_kis) where r_kc | isTupleTyCon kc = TH.TupleT (tyConArity kc) | kc `hasKey` listTyConKey = TH.ListT | otherwise = TH.ConT (reifyName kc) + vis_kis = filterOutInvisibleTypes kc kis + reifyCxt :: [PredType] -> TcM [TH.Pred] reifyCxt = mapM reifyPred diff --git a/testsuite/tests/th/T11463.hs b/testsuite/tests/th/T11463.hs new file mode 100644 index 0000000..1faf596 --- /dev/null +++ b/testsuite/tests/th/T11463.hs @@ -0,0 +1,18 @@ +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE TypeInType #-} +module Main where + +import Data.Kind +import Language.Haskell.TH + +type Id1 a = a +type Id2 k (a :: k) = a +data Proxy1 (a :: Id1 k) = Proxy1 +data Proxy2 (a :: Id2 * k) = Proxy2 + +$(return []) + +main :: IO () +main = do + putStrLn $(reify ''Proxy1 >>= stringE . pprint) + putStrLn $(reify ''Proxy2 >>= stringE . pprint) diff --git a/testsuite/tests/th/T11463.stdout b/testsuite/tests/th/T11463.stdout new file mode 100644 index 0000000..d33038a --- /dev/null +++ b/testsuite/tests/th/T11463.stdout @@ -0,0 +1,2 @@ +data Main.Proxy1 (a_0 :: Main.Id1 k_1) = Main.Proxy1 +data Main.Proxy2 (a_0 :: Main.Id2 * k_1) = Main.Proxy2 diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index f6d9138..2ff11fb 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -397,5 +397,6 @@ test('T10603', normal, compile, ['-ddump-splices -dsuppress-uniques']) test('T11452', normal, compile_fail, ['-v0']) test('T9022', normal, compile_and_run, ['-v0']) test('T11145', normal, compile_fail, ['-v0 -dsuppress-uniques']) +test('T11463', normal, compile_and_run, ['-v0 -dsuppress-uniques']) test('T11680', normal, compile_fail, ['-v0']) test('T11809', normal, compile, ['-v0']) From git at git.haskell.org Mon Apr 11 01:16:27 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 11 Apr 2016 01:16:27 +0000 (UTC) Subject: [commit: ghc] master: Added (more) missing instances for Identity and Const (8b57cac) Message-ID: <20160411011627.B743A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8b57cac5974c9fffccbcae3104b5b5d18760749e/ghc >--------------------------------------------------------------- commit 8b57cac5974c9fffccbcae3104b5b5d18760749e Author: Shane O'Brien Date: Mon Apr 11 02:53:00 2016 +0200 Added (more) missing instances for Identity and Const * `Identity` and `Const` now have `Num`, `Real`, `Integral`, `Fractional`, `Floating`, `RealFrac` and `RealFloat` instances * `Identity` and `Const` now have `Bits` and `FiniteBits` instances * `Identity` and `Const` now have `IsString` instances Reviewers: RyanGlScott, austin, hvr, bgamari, ekmett Reviewed By: ekmett Subscribers: nomeata, ekmett, RyanGlScott, thomie Differential Revision: https://phabricator.haskell.org/D2079 GHC Trac Issues: #11790 >--------------------------------------------------------------- 8b57cac5974c9fffccbcae3104b5b5d18760749e libraries/base/Data/Functor/Const.hs | 11 ++++++++--- libraries/base/Data/Functor/Identity.hs | 7 +++++-- libraries/base/Data/String.hs | 3 +++ libraries/base/changelog.md | 6 +++--- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/libraries/base/Data/Functor/Const.hs b/libraries/base/Data/Functor/Const.hs index 7457951..9f2db7f 100644 --- a/libraries/base/Data/Functor/Const.hs +++ b/libraries/base/Data/Functor/Const.hs @@ -1,9 +1,9 @@ -{-# LANGUAGE Trustworthy #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE PolyKinds #-} {-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE Trustworthy #-} ----------------------------------------------------------------------------- -- | @@ -21,20 +21,25 @@ module Data.Functor.Const (Const(..)) where +import Data.Bits (Bits, FiniteBits) import Data.Foldable (Foldable(foldMap)) import Foreign.Storable (Storable) import GHC.Arr (Ix) import GHC.Base import GHC.Enum (Bounded, Enum) +import GHC.Float (Floating, RealFloat) import GHC.Generics (Generic, Generic1) +import GHC.Num (Num) +import GHC.Real (Fractional, Integral, Real, RealFrac) import GHC.Read (Read(readsPrec), readParen, lex) import GHC.Show (Show(showsPrec), showParen, showString) -- | The 'Const' functor. newtype Const a b = Const { getConst :: a } - deriving ( Generic, Generic1, Bounded, Enum, Eq, Ix, Ord - , Monoid, Storable) + deriving ( Bits, Bounded, Enum, Eq, FiniteBits, Floating, Fractional + , Generic, Generic1, Integral, Ix, Monoid, Num, Ord, Real + , RealFrac, RealFloat , Storable) -- | This instance would be equivalent to the derived instances of the -- 'Const' newtype if the 'runConst' field were removed diff --git a/libraries/base/Data/Functor/Identity.hs b/libraries/base/Data/Functor/Identity.hs index df424f2..4e6646a 100644 --- a/libraries/base/Data/Functor/Identity.hs +++ b/libraries/base/Data/Functor/Identity.hs @@ -36,11 +36,13 @@ module Data.Functor.Identity ( import Control.Monad.Fix import Control.Monad.Zip +import Data.Bits (Bits, FiniteBits) import Data.Coerce import Data.Data (Data) import Data.Foldable import Data.Ix (Ix) import Data.Semigroup (Semigroup) +import Data.String (IsString) import Foreign.Storable (Storable) import GHC.Generics (Generic, Generic1) @@ -48,8 +50,9 @@ import GHC.Generics (Generic, Generic1) -- -- @since 4.8.0.0 newtype Identity a = Identity { runIdentity :: a } - deriving ( Bounded, Enum, Eq, Ix, Ord, Data, Monoid, Semigroup - , Storable, Traversable, Generic, Generic1) + deriving ( Bits, Bounded, Data, Enum, Eq, FiniteBits, Floating, Fractional + , Generic, Generic1, Integral, IsString, Ix, Monoid, Num, Ord + , Real, RealFrac, RealFloat , Semigroup, Storable, Traversable) -- | This instance would be equivalent to the derived instances of the -- 'Identity' newtype if the 'runIdentity' field were removed diff --git a/libraries/base/Data/String.hs b/libraries/base/Data/String.hs index 9e1f5f3..f341ff2 100644 --- a/libraries/base/Data/String.hs +++ b/libraries/base/Data/String.hs @@ -28,6 +28,7 @@ module Data.String ( ) where import GHC.Base +import Data.Functor.Const (Const (Const)) import Data.List (lines, words, unlines, unwords) -- | Class for string-like datastructures; used by the overloaded string @@ -78,3 +79,5 @@ instance (a ~ Char) => IsString [a] where -- See Note [IsString String] fromString xs = xs +instance IsString a => IsString (Const a b) where + fromString = Const . fromString diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index cb3eced..f935c59 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -131,9 +131,9 @@ * `Identity` now has `Semigroup` and `Monoid` instances - * `Identity` and `Const` now have `Bounded`, `Enum` and `Ix` instances - - * `Identity` and `Const` now have `Storable` instances + * `Identity` and `Const` now have `Bits`, `Bounded`, `Enum`, `FiniteBits`, + `Floating`, `Fractional`, `Integral`, `IsString`, `Ix`, `Num`, `Real`, + `RealFloat`, `RealFrac` and `Storable` instances. (#11210, #11790) * `()` now has a `Storable` instance From git at git.haskell.org Mon Apr 11 01:16:30 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 11 Apr 2016 01:16:30 +0000 (UTC) Subject: [commit: ghc] master: Deriving Functor-like classes should unify kind variables (aadde2b) Message-ID: <20160411011630.67D053A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/aadde2b90817c577336da0d4a10ea47551d60c7e/ghc >--------------------------------------------------------------- commit aadde2b90817c577336da0d4a10ea47551d60c7e Author: RyanGlScott Date: Mon Apr 11 02:53:23 2016 +0200 Deriving Functor-like classes should unify kind variables While the deriving machinery always unifies the kind of the typeclass argument with the kind of the datatype, this proves not to be sufficient to produce well kinded instances for some poly-kinded datatypes. For example: ``` newtype Compose (f :: k2 -> *) (g :: k1 -> k2) (a :: k1) = Compose (f (g a)) deriving Functor ``` would fail because only `k1` would get unified with `*`, causing the following ill kinded instance to be generated: ``` instance (Functor (f :: k2 -> *), Functor (g :: * -> k2)) => Functor (Compose f g) where ... ``` To prevent this, we need to take the subtypes and unify their kinds with `* -> *`. Fixes #10524 for good. Test Plan: ./validate Reviewers: simonpj, hvr, austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2097 GHC Trac Issues: #10524, #10561 >--------------------------------------------------------------- aadde2b90817c577336da0d4a10ea47551d60c7e compiler/typecheck/TcDeriv.hs | 156 +++++++++++++++------ libraries/base/Data/Functor/Compose.hs | 7 +- testsuite/tests/deriving/should_compile/T10561.hs | 14 -- .../tests/deriving/should_compile/T10561.stderr | 7 - testsuite/tests/deriving/should_compile/all.T | 2 +- 5 files changed, 117 insertions(+), 69 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc aadde2b90817c577336da0d4a10ea47551d60c7e From git at git.haskell.org Mon Apr 11 01:44:32 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 11 Apr 2016 01:44:32 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Fix a closed type family error message (cd35e86) Message-ID: <20160411014432.4C8083A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/cd35e860d1e709868c6005c8280fca95fe3dd431/ghc >--------------------------------------------------------------- commit cd35e860d1e709868c6005c8280fca95fe3dd431 Author: Rik Steenkamp Date: Mon Apr 11 02:26:06 2016 +0200 Fix a closed type family error message Now we check whether a closed type family's equation is headed with the correct type before we kind-check the equation. Also, instead of "expected only no parameters" we now generate the message "expected no parameters". Fixes #11623. Reviewers: simonpj, austin, bgamari Reviewed By: simonpj, bgamari Subscribers: simonpj, goldfire, thomie Differential Revision: https://phabricator.haskell.org/D2089 GHC Trac Issues: #11623 (cherry picked from commit 46e8f199e4d3baffa306a40082fbc2fce67f779f) >--------------------------------------------------------------- cd35e860d1e709868c6005c8280fca95fe3dd431 compiler/typecheck/TcTyClsDecls.hs | 23 ++++++++++++---------- testsuite/tests/typecheck/should_fail/T11623.hs | 5 +++++ .../tests/typecheck/should_fail/T11623.stderr | 6 ++++++ testsuite/tests/typecheck/should_fail/all.T | 1 + 4 files changed, 25 insertions(+), 10 deletions(-) diff --git a/compiler/typecheck/TcTyClsDecls.hs b/compiler/typecheck/TcTyClsDecls.hs index 7b47e51..f7c03dd 100644 --- a/compiler/typecheck/TcTyClsDecls.hs +++ b/compiler/typecheck/TcTyClsDecls.hs @@ -1073,12 +1073,16 @@ proper tcMatchTys here.) -} ------------------------- kcTyFamInstEqn :: FamTyConShape -> LTyFamInstEqn Name -> TcM () -kcTyFamInstEqn fam_tc_shape - (L loc (TyFamEqn { tfe_pats = pats, tfe_rhs = hs_ty })) +kcTyFamInstEqn fam_tc_shape@(fam_tc_name,_,_,_) + (L loc (TyFamEqn { tfe_tycon = L _ eqn_tc_name + , tfe_pats = pats + , tfe_rhs = hs_ty })) = setSrcSpan loc $ - discardResult $ - tc_fam_ty_pats fam_tc_shape Nothing -- not an associated type - pats (discardResult . (tcCheckLHsType hs_ty)) + do { checkTc (fam_tc_name == eqn_tc_name) + (wrongTyFamName fam_tc_name eqn_tc_name) + ; discardResult $ + tc_fam_ty_pats fam_tc_shape Nothing -- not an associated type + pats (discardResult . (tcCheckLHsType hs_ty)) } tcTyFamInstEqn :: FamTyConShape -> Maybe ClsInfo -> LTyFamInstEqn Name -> TcM CoAxBranch -- Needs to be here, not in TcInstDcls, because closed families @@ -1087,12 +1091,11 @@ tcTyFamInstEqn fam_tc_shape@(fam_tc_name,_,_,_) mb_clsinfo (L loc (TyFamEqn { tfe_tycon = L _ eqn_tc_name , tfe_pats = pats , tfe_rhs = hs_ty })) - = setSrcSpan loc $ + = ASSERT( fam_tc_name == eqn_tc_name ) + setSrcSpan loc $ tcFamTyPats fam_tc_shape mb_clsinfo pats (discardResult . (tcCheckLHsType hs_ty)) $ \tvs' pats' res_kind -> - do { checkTc (fam_tc_name == eqn_tc_name) - (wrongTyFamName fam_tc_name eqn_tc_name) - ; rhs_ty <- solveEqualities $ tcCheckLHsType hs_ty res_kind + do { rhs_ty <- solveEqualities $ tcCheckLHsType hs_ty res_kind ; rhs_ty <- zonkTcTypeToType emptyZonkEnv rhs_ty ; traceTc "tcTyFamInstEqn" (ppr fam_tc_name <+> pprTvBndrs tvs') -- don't print out the pats here, as they might be zonked inside the knot @@ -1209,7 +1212,7 @@ tc_fam_ty_pats (name, _, binders, res_kind) mb_clsinfo too_many_args hs_ty n = hang (text "Too many parameters to" <+> ppr name <> colon) 2 (vcat [ ppr hs_ty <+> text "is unexpected;" - , text "expected only" <+> + , text (if n == 1 then "expected" else "expected only") <+> speakNOf (n-1) (text "parameter") ]) -- See Note [tc_fam_ty_pats vs tcFamTyPats] diff --git a/testsuite/tests/typecheck/should_fail/T11623.hs b/testsuite/tests/typecheck/should_fail/T11623.hs new file mode 100644 index 0000000..d55ca47 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T11623.hs @@ -0,0 +1,5 @@ +{-# LANGUAGE TypeFamilies #-} + +module T11623 where + +type family T where { Maybe T = Int } diff --git a/testsuite/tests/typecheck/should_fail/T11623.stderr b/testsuite/tests/typecheck/should_fail/T11623.stderr new file mode 100644 index 0000000..0f6253f --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T11623.stderr @@ -0,0 +1,6 @@ + +T11623.hs:5:23: error: + ? Mismatched type name in type family instance. + Expected: T + Actual: Maybe + ? In the type family declaration for ?T? diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index f2b5331..a74512c 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -411,6 +411,7 @@ test('T11355', normal, compile_fail, ['']) test('T11464', normal, compile_fail, ['']) test('T11563', normal, compile_fail, ['']) test('T11313', normal, compile_fail, ['']) +test('T11623', normal, compile_fail, ['']) test('T11723', normal, compile_fail, ['']) test('T11724', normal, compile_fail, ['']) test('BadUnboxedTuple', normal, compile_fail, ['']) From git at git.haskell.org Mon Apr 11 01:44:35 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 11 Apr 2016 01:44:35 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Filter out invisible kind arguments during TH reification (a1fa34c) Message-ID: <20160411014435.B12613A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/a1fa34ced8f317dcaa63babaf50040a7d8c68827/ghc >--------------------------------------------------------------- commit a1fa34ced8f317dcaa63babaf50040a7d8c68827 Author: RyanGlScott Date: Mon Apr 11 02:34:55 2016 +0200 Filter out invisible kind arguments during TH reification Previously, all kind arguments were being reified, which would cause something like this: ``` type Id a = a data Proxy (a :: Id k) = Proxy ``` to output ``` data Proxy (a :: Id * k) = Proxy ``` when `Proxy`'s `Info` is reified. The fix is simple: simply call `filterOutInvisibleTypes` on the kind arguments of a kind synonym application. Fixes #11463. Test Plan: ./validate Reviewers: austin, bgamari, goldfire Reviewed By: goldfire Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2081 GHC Trac Issues: #11463 (cherry picked from commit 02a5c580b6078630842f4c3db5d92631fada21e9) >--------------------------------------------------------------- a1fa34ced8f317dcaa63babaf50040a7d8c68827 compiler/typecheck/TcSplice.hs | 4 +++- testsuite/tests/th/T11463.hs | 18 ++++++++++++++++++ testsuite/tests/th/T11463.stdout | 2 ++ testsuite/tests/th/all.T | 1 + 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/compiler/typecheck/TcSplice.hs b/compiler/typecheck/TcSplice.hs index fc13b3f..5b9fbad 100644 --- a/compiler/typecheck/TcSplice.hs +++ b/compiler/typecheck/TcSplice.hs @@ -1649,12 +1649,14 @@ reifyKind ki reify_kc_app :: TyCon -> [TyCoRep.Kind] -> TcM TH.Kind reify_kc_app kc kis - = fmap (mkThAppTs r_kc) (mapM reifyKind kis) + = fmap (mkThAppTs r_kc) (mapM reifyKind vis_kis) where r_kc | isTupleTyCon kc = TH.TupleT (tyConArity kc) | kc `hasKey` listTyConKey = TH.ListT | otherwise = TH.ConT (reifyName kc) + vis_kis = filterOutInvisibleTypes kc kis + reifyCxt :: [PredType] -> TcM [TH.Pred] reifyCxt = mapM reifyPred diff --git a/testsuite/tests/th/T11463.hs b/testsuite/tests/th/T11463.hs new file mode 100644 index 0000000..1faf596 --- /dev/null +++ b/testsuite/tests/th/T11463.hs @@ -0,0 +1,18 @@ +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE TypeInType #-} +module Main where + +import Data.Kind +import Language.Haskell.TH + +type Id1 a = a +type Id2 k (a :: k) = a +data Proxy1 (a :: Id1 k) = Proxy1 +data Proxy2 (a :: Id2 * k) = Proxy2 + +$(return []) + +main :: IO () +main = do + putStrLn $(reify ''Proxy1 >>= stringE . pprint) + putStrLn $(reify ''Proxy2 >>= stringE . pprint) diff --git a/testsuite/tests/th/T11463.stdout b/testsuite/tests/th/T11463.stdout new file mode 100644 index 0000000..d33038a --- /dev/null +++ b/testsuite/tests/th/T11463.stdout @@ -0,0 +1,2 @@ +data Main.Proxy1 (a_0 :: Main.Id1 k_1) = Main.Proxy1 +data Main.Proxy2 (a_0 :: Main.Id2 * k_1) = Main.Proxy2 diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index c398a31..9055430 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -400,5 +400,6 @@ test('TH_finalizer', normal, compile, ['-v0']) test('T10603', normal, compile, ['-ddump-splices -dsuppress-uniques']) test('T11452', normal, compile_fail, ['-v0']) test('T11145', normal, compile_fail, ['-v0 -dsuppress-uniques']) +test('T11463', normal, compile_and_run, ['-v0 -dsuppress-uniques']) test('T11680', normal, compile_fail, ['-v0']) test('T11809', normal, compile, ['-v0']) From git at git.haskell.org Mon Apr 11 01:44:38 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 11 Apr 2016 01:44:38 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Added (more) missing instances for Identity and Const (7b8beba) Message-ID: <20160411014438.5F24B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/7b8beba76a31b3184413e033c6f86a5dd6c70ac7/ghc >--------------------------------------------------------------- commit 7b8beba76a31b3184413e033c6f86a5dd6c70ac7 Author: Shane O'Brien Date: Mon Apr 11 02:53:00 2016 +0200 Added (more) missing instances for Identity and Const * `Identity` and `Const` now have `Num`, `Real`, `Integral`, `Fractional`, `Floating`, `RealFrac` and `RealFloat` instances * `Identity` and `Const` now have `Bits` and `FiniteBits` instances * `Identity` and `Const` now have `IsString` instances Reviewers: RyanGlScott, austin, hvr, bgamari, ekmett Reviewed By: ekmett Subscribers: nomeata, ekmett, RyanGlScott, thomie Differential Revision: https://phabricator.haskell.org/D2079 GHC Trac Issues: #11790 (cherry picked from commit 8b57cac5974c9fffccbcae3104b5b5d18760749e) >--------------------------------------------------------------- 7b8beba76a31b3184413e033c6f86a5dd6c70ac7 libraries/base/Data/Functor/Const.hs | 11 ++++++++--- libraries/base/Data/Functor/Identity.hs | 7 +++++-- libraries/base/Data/String.hs | 3 +++ libraries/base/changelog.md | 6 +++--- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/libraries/base/Data/Functor/Const.hs b/libraries/base/Data/Functor/Const.hs index 7457951..9f2db7f 100644 --- a/libraries/base/Data/Functor/Const.hs +++ b/libraries/base/Data/Functor/Const.hs @@ -1,9 +1,9 @@ -{-# LANGUAGE Trustworthy #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE PolyKinds #-} {-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE Trustworthy #-} ----------------------------------------------------------------------------- -- | @@ -21,20 +21,25 @@ module Data.Functor.Const (Const(..)) where +import Data.Bits (Bits, FiniteBits) import Data.Foldable (Foldable(foldMap)) import Foreign.Storable (Storable) import GHC.Arr (Ix) import GHC.Base import GHC.Enum (Bounded, Enum) +import GHC.Float (Floating, RealFloat) import GHC.Generics (Generic, Generic1) +import GHC.Num (Num) +import GHC.Real (Fractional, Integral, Real, RealFrac) import GHC.Read (Read(readsPrec), readParen, lex) import GHC.Show (Show(showsPrec), showParen, showString) -- | The 'Const' functor. newtype Const a b = Const { getConst :: a } - deriving ( Generic, Generic1, Bounded, Enum, Eq, Ix, Ord - , Monoid, Storable) + deriving ( Bits, Bounded, Enum, Eq, FiniteBits, Floating, Fractional + , Generic, Generic1, Integral, Ix, Monoid, Num, Ord, Real + , RealFrac, RealFloat , Storable) -- | This instance would be equivalent to the derived instances of the -- 'Const' newtype if the 'runConst' field were removed diff --git a/libraries/base/Data/Functor/Identity.hs b/libraries/base/Data/Functor/Identity.hs index df424f2..4e6646a 100644 --- a/libraries/base/Data/Functor/Identity.hs +++ b/libraries/base/Data/Functor/Identity.hs @@ -36,11 +36,13 @@ module Data.Functor.Identity ( import Control.Monad.Fix import Control.Monad.Zip +import Data.Bits (Bits, FiniteBits) import Data.Coerce import Data.Data (Data) import Data.Foldable import Data.Ix (Ix) import Data.Semigroup (Semigroup) +import Data.String (IsString) import Foreign.Storable (Storable) import GHC.Generics (Generic, Generic1) @@ -48,8 +50,9 @@ import GHC.Generics (Generic, Generic1) -- -- @since 4.8.0.0 newtype Identity a = Identity { runIdentity :: a } - deriving ( Bounded, Enum, Eq, Ix, Ord, Data, Monoid, Semigroup - , Storable, Traversable, Generic, Generic1) + deriving ( Bits, Bounded, Data, Enum, Eq, FiniteBits, Floating, Fractional + , Generic, Generic1, Integral, IsString, Ix, Monoid, Num, Ord + , Real, RealFrac, RealFloat , Semigroup, Storable, Traversable) -- | This instance would be equivalent to the derived instances of the -- 'Identity' newtype if the 'runIdentity' field were removed diff --git a/libraries/base/Data/String.hs b/libraries/base/Data/String.hs index 9e1f5f3..f341ff2 100644 --- a/libraries/base/Data/String.hs +++ b/libraries/base/Data/String.hs @@ -28,6 +28,7 @@ module Data.String ( ) where import GHC.Base +import Data.Functor.Const (Const (Const)) import Data.List (lines, words, unlines, unwords) -- | Class for string-like datastructures; used by the overloaded string @@ -78,3 +79,5 @@ instance (a ~ Char) => IsString [a] where -- See Note [IsString String] fromString xs = xs +instance IsString a => IsString (Const a b) where + fromString = Const . fromString diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index cb3eced..f935c59 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -131,9 +131,9 @@ * `Identity` now has `Semigroup` and `Monoid` instances - * `Identity` and `Const` now have `Bounded`, `Enum` and `Ix` instances - - * `Identity` and `Const` now have `Storable` instances + * `Identity` and `Const` now have `Bits`, `Bounded`, `Enum`, `FiniteBits`, + `Floating`, `Fractional`, `Integral`, `IsString`, `Ix`, `Num`, `Real`, + `RealFloat`, `RealFrac` and `Storable` instances. (#11210, #11790) * `()` now has a `Storable` instance From git at git.haskell.org Mon Apr 11 01:44:41 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 11 Apr 2016 01:44:41 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Deriving Functor-like classes should unify kind variables (9c48d8a) Message-ID: <20160411014441.1DF6A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/9c48d8a02dd80bba3bd313bc52add841530e28dc/ghc >--------------------------------------------------------------- commit 9c48d8a02dd80bba3bd313bc52add841530e28dc Author: RyanGlScott Date: Mon Apr 11 02:53:23 2016 +0200 Deriving Functor-like classes should unify kind variables While the deriving machinery always unifies the kind of the typeclass argument with the kind of the datatype, this proves not to be sufficient to produce well kinded instances for some poly-kinded datatypes. For example: ``` newtype Compose (f :: k2 -> *) (g :: k1 -> k2) (a :: k1) = Compose (f (g a)) deriving Functor ``` would fail because only `k1` would get unified with `*`, causing the following ill kinded instance to be generated: ``` instance (Functor (f :: k2 -> *), Functor (g :: * -> k2)) => Functor (Compose f g) where ... ``` To prevent this, we need to take the subtypes and unify their kinds with `* -> *`. Fixes #10524 for good. Test Plan: ./validate Reviewers: simonpj, hvr, austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2097 GHC Trac Issues: #10524, #10561 (cherry picked from commit aadde2b90817c577336da0d4a10ea47551d60c7e) >--------------------------------------------------------------- 9c48d8a02dd80bba3bd313bc52add841530e28dc compiler/typecheck/TcDeriv.hs | 156 +++++++++++++++------ libraries/base/Data/Functor/Compose.hs | 7 +- testsuite/tests/deriving/should_compile/T10561.hs | 14 -- .../tests/deriving/should_compile/T10561.stderr | 7 - testsuite/tests/deriving/should_compile/all.T | 2 +- 5 files changed, 117 insertions(+), 69 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 9c48d8a02dd80bba3bd313bc52add841530e28dc From git at git.haskell.org Mon Apr 11 05:26:50 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 11 Apr 2016 05:26:50 +0000 (UTC) Subject: [commit: ghc] master: Use `@since` annotation in GHC.ExecutionStack (2ef35d8) Message-ID: <20160411052650.402963A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2ef35d8fed58cb9f33190c6d9908262535b26f90/ghc >--------------------------------------------------------------- commit 2ef35d8fed58cb9f33190c6d9908262535b26f90 Author: Herbert Valerio Riedel Date: Mon Apr 11 07:28:15 2016 +0200 Use `@since` annotation in GHC.ExecutionStack While ad532ded871a9a5180388a2b7cdbdc26e053284c fixed the version number, this fixes the markup... >--------------------------------------------------------------- 2ef35d8fed58cb9f33190c6d9908262535b26f90 libraries/base/GHC/ExecutionStack.hs | 2 +- libraries/base/GHC/ExecutionStack/Internal.hsc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/base/GHC/ExecutionStack.hs b/libraries/base/GHC/ExecutionStack.hs index 966ba29..3a32deb 100644 --- a/libraries/base/GHC/ExecutionStack.hs +++ b/libraries/base/GHC/ExecutionStack.hs @@ -26,7 +26,7 @@ -- ,("RTS expects libdw","YES") -- @ -- --- /Since: 4.9.0.0/ +-- @since 4.9.0.0 ----------------------------------------------------------------------------- module GHC.ExecutionStack ( diff --git a/libraries/base/GHC/ExecutionStack/Internal.hsc b/libraries/base/GHC/ExecutionStack/Internal.hsc index 340cdc4..54962ff 100644 --- a/libraries/base/GHC/ExecutionStack/Internal.hsc +++ b/libraries/base/GHC/ExecutionStack/Internal.hsc @@ -10,7 +10,7 @@ -- -- Internals of the `GHC.ExecutionStack` module -- --- /Since: 4.9.0.0/ +-- @since 4.9.0.0 ----------------------------------------------------------------------------- #include "HsFFI.h" From git at git.haskell.org Mon Apr 11 05:29:16 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 11 Apr 2016 05:29:16 +0000 (UTC) Subject: [commit: ghc] master: Add linker notes (c6e579b) Message-ID: <20160411052916.2A4CA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c6e579bc3820afe71e51b711ee579a4d658ffbf9/ghc >--------------------------------------------------------------- commit c6e579bc3820afe71e51b711ee579a4d658ffbf9 Author: Tamar Christina Date: Mon Apr 11 06:51:44 2016 +0200 Add linker notes Summary: Add linker notes following #11223 and D1805 Reviewers: austin, bgamari, erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2102 GHC Trac Issues: #11223 >--------------------------------------------------------------- c6e579bc3820afe71e51b711ee579a4d658ffbf9 rts/Linker.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/rts/Linker.c b/rts/Linker.c index a296afe..782444a 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -208,6 +208,16 @@ typedef struct _RtsSymbolInfo { When a new declaration or statement is performed ultimately lookupSymbol is called without doing a re-link. + The goal of these different phases is to allow the linker to be able to perform + "lazy loading" of ObjectCode. The reason for this is that we want to only link + in symbols that are actually required for the link. This reduces: + + 1) Dependency chains, if A.o required a .o in libB but A.o isn't required to link + then we don't need to load libB. This means the dependency chain for libraries + such as mingw32 and mingwex can be broken down. + + 2) The number of duplicate symbols, since now only symbols that are + true duplicates will display the error. */ static /*Str*/HashTable *symhash; @@ -2711,6 +2721,9 @@ int ocTryLoad (ObjectCode* oc) { This call is intended to have no side-effects when a non-duplicate symbol is re-inserted. + + TODO: SymbolInfo can be moved into ObjectCode in order to be more + memory efficient. See Trac #11816 */ int x; SymbolInfo symbol; From git at git.haskell.org Mon Apr 11 19:45:43 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 11 Apr 2016 19:45:43 +0000 (UTC) Subject: [commit: ghc] wip/rae: Fix #11811. (68f3b3c) Message-ID: <20160411194543.2A0CE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rae Link : http://ghc.haskell.org/trac/ghc/changeset/68f3b3cf5edd85f26c0f7b27c93ce916db9f0570/ghc >--------------------------------------------------------------- commit 68f3b3cf5edd85f26c0f7b27c93ce916db9f0570 Author: Richard Eisenberg Date: Thu Apr 7 16:44:06 2016 +0200 Fix #11811. Previously, I had forgotten to omit variables already in scope from the TypeInType CUSK check. Simple enough to fix. Test case: typecheck/should_compile/T11811 >--------------------------------------------------------------- 68f3b3cf5edd85f26c0f7b27c93ce916db9f0570 compiler/hsSyn/HsDecls.hs | 2 ++ compiler/rename/RnSource.hs | 37 +++++++++++----------- compiler/rename/RnTypes.hs | 29 ++++++++++------- testsuite/tests/typecheck/should_compile/T11811.hs | 8 +++++ testsuite/tests/typecheck/should_compile/all.T | 1 + 5 files changed, 46 insertions(+), 31 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 68f3b3cf5edd85f26c0f7b27c93ce916db9f0570 From git at git.haskell.org Mon Apr 11 19:45:45 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 11 Apr 2016 19:45:45 +0000 (UTC) Subject: [commit: ghc] wip/rae: Fix #11814 by throwing more stuff into InScopeSets (35d882a) Message-ID: <20160411194545.CDCA93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rae Link : http://ghc.haskell.org/trac/ghc/changeset/35d882a416d1f172b32ea9c6fed1074d5c48b4b9/ghc >--------------------------------------------------------------- commit 35d882a416d1f172b32ea9c6fed1074d5c48b4b9 Author: Richard Eisenberg Date: Wed Apr 6 15:24:34 2016 +0200 Fix #11814 by throwing more stuff into InScopeSets >--------------------------------------------------------------- 35d882a416d1f172b32ea9c6fed1074d5c48b4b9 compiler/stranal/WwLib.hs | 5 ++++- compiler/types/Type.hs | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/compiler/stranal/WwLib.hs b/compiler/stranal/WwLib.hs index 7c85036..4ec36ba 100644 --- a/compiler/stranal/WwLib.hs +++ b/compiler/stranal/WwLib.hs @@ -22,6 +22,7 @@ import MkCore ( mkRuntimeErrorApp, aBSENT_ERROR_ID, mkCoreUbxTup ) import MkId ( voidArgId, voidPrimId ) import TysPrim ( voidPrimTy ) import TysWiredIn ( tupleDataCon ) +import VarEnv ( mkInScopeSet ) import Type import Coercion import FamInstEnv @@ -127,7 +128,9 @@ mkWwBodies :: DynFlags -- E mkWwBodies dflags fam_envs fun_ty demands res_info - = do { (wrap_args, wrap_fn_args, work_fn_args, res_ty) <- mkWWargs emptyTCvSubst fun_ty demands + = do { let empty_subst = mkEmptyTCvSubst (mkInScopeSet (tyCoVarsOfType fun_ty)) + + ; (wrap_args, wrap_fn_args, work_fn_args, res_ty) <- mkWWargs empty_subst fun_ty demands ; (useful1, work_args, wrap_fn_str, work_fn_str) <- mkWWstr dflags fam_envs wrap_args -- Do CPR w/w. See Note [Always do CPR w/w] diff --git a/compiler/types/Type.hs b/compiler/types/Type.hs index c5561a3..8901968 100644 --- a/compiler/types/Type.hs +++ b/compiler/types/Type.hs @@ -1084,9 +1084,9 @@ mkCastTy ty co | isReflexiveCo co = ty mkCastTy (CastTy ty co1) co2 = mkCastTy ty (co1 `mkTransCo` co2) -- See Note [Weird typing rule for ForAllTy] -mkCastTy (ForAllTy (Named tv vis) inner_ty) co +mkCastTy outer_ty@(ForAllTy (Named tv vis) inner_ty) co = -- have to make sure that pushing the co in doesn't capture the bound var - let fvs = tyCoVarsOfCo co + let fvs = tyCoVarsOfCo co `unionVarSet` tyCoVarsOfType outer_ty empty_subst = mkEmptyTCvSubst (mkInScopeSet fvs) (subst, tv') = substTyVarBndr empty_subst tv in From git at git.haskell.org Mon Apr 11 19:45:48 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 11 Apr 2016 19:45:48 +0000 (UTC) Subject: [commit: ghc] wip/rae: Teach lookupLocalRdrEnv about Exacts. (#11813) (be7b3f0) Message-ID: <20160411194548.89C953A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rae Link : http://ghc.haskell.org/trac/ghc/changeset/be7b3f059c9acf864fac867fe4de5f7f1e159998/ghc >--------------------------------------------------------------- commit be7b3f059c9acf864fac867fe4de5f7f1e159998 Author: Richard Eisenberg Date: Fri Apr 8 08:01:34 2016 +0200 Teach lookupLocalRdrEnv about Exacts. (#11813) >--------------------------------------------------------------- be7b3f059c9acf864fac867fe4de5f7f1e159998 compiler/basicTypes/RdrName.hs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/compiler/basicTypes/RdrName.hs b/compiler/basicTypes/RdrName.hs index fec5411..d259726 100644 --- a/compiler/basicTypes/RdrName.hs +++ b/compiler/basicTypes/RdrName.hs @@ -357,8 +357,17 @@ extendLocalRdrEnvList lre@(LRE { lre_env = env, lre_in_scope = ns }) names , lre_in_scope = extendNameSetList ns names } lookupLocalRdrEnv :: LocalRdrEnv -> RdrName -> Maybe Name -lookupLocalRdrEnv (LRE { lre_env = env }) (Unqual occ) = lookupOccEnv env occ -lookupLocalRdrEnv _ _ = Nothing +lookupLocalRdrEnv (LRE { lre_env = env, lre_in_scope = ns }) rdr + | Unqual occ <- rdr + = lookupOccEnv env occ + + -- See Note [Local bindings with Exact Names] + | Exact name <- rdr + , name `elemNameSet` ns + = Just name + + | otherwise + = Nothing lookupLocalRdrOcc :: LocalRdrEnv -> OccName -> Maybe Name lookupLocalRdrOcc (LRE { lre_env = env }) occ = lookupOccEnv env occ From git at git.haskell.org Mon Apr 11 19:45:51 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 11 Apr 2016 19:45:51 +0000 (UTC) Subject: [commit: ghc] wip/rae: Fix #11797. (6121bba) Message-ID: <20160411194551.DE1663A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rae Link : http://ghc.haskell.org/trac/ghc/changeset/6121bba7eadae6f28bed5888ef86ae5c20d241ad/ghc >--------------------------------------------------------------- commit 6121bba7eadae6f28bed5888ef86ae5c20d241ad Author: Richard Eisenberg Date: Wed Apr 6 16:37:22 2016 +0200 Fix #11797. DsMeta curiously omitted quantified tyvars in certain circumstances. This patch means it doesn't. Test case: th/T11797 >--------------------------------------------------------------- 6121bba7eadae6f28bed5888ef86ae5c20d241ad compiler/deSugar/DsMeta.hs | 13 +++++++------ docs/users_guide/8.0.1-notes.rst | 8 ++++++++ testsuite/tests/th/T11797.hs | 14 ++++++++++++++ testsuite/tests/th/T11797.stderr | 2 ++ testsuite/tests/th/T8031.hs | 3 ++- testsuite/tests/th/all.T | 1 + 6 files changed, 34 insertions(+), 7 deletions(-) diff --git a/compiler/deSugar/DsMeta.hs b/compiler/deSugar/DsMeta.hs index b14c0a4..7ed96b4 100644 --- a/compiler/deSugar/DsMeta.hs +++ b/compiler/deSugar/DsMeta.hs @@ -872,12 +872,9 @@ repContext ctxt = do preds <- repList typeQTyConName repLTy ctxt repCtxt preds repHsSigType :: LHsSigType Name -> DsM (Core TH.TypeQ) -repHsSigType ty = repLTy (hsSigType ty) - -repHsSigWcType :: LHsSigWcType Name -> DsM (Core TH.TypeQ) -repHsSigWcType (HsIB { hsib_vars = vars - , hsib_body = sig1 }) - | (explicit_tvs, ctxt, ty) <- splitLHsSigmaTy (hswc_body sig1) +repHsSigType (HsIB { hsib_vars = vars + , hsib_body = body }) + | (explicit_tvs, ctxt, ty) <- splitLHsSigmaTy body = addTyVarBinds (HsQTvs { hsq_implicit = [] , hsq_explicit = map (noLoc . UserTyVar . noLoc) vars ++ explicit_tvs @@ -889,6 +886,10 @@ repHsSigWcType (HsIB { hsib_vars = vars then return th_ty else repTForall th_tvs th_ctxt th_ty } +repHsSigWcType :: LHsSigWcType Name -> DsM (Core TH.TypeQ) +repHsSigWcType ib_ty@(HsIB { hsib_body = sig1 }) + = repHsSigType (ib_ty { hsib_body = hswc_body sig1 }) + -- yield the representation of a list of types -- repLTys :: [LHsType Name] -> DsM [Core TH.TypeQ] diff --git a/docs/users_guide/8.0.1-notes.rst b/docs/users_guide/8.0.1-notes.rst index d79fdf2..2f011c4 100644 --- a/docs/users_guide/8.0.1-notes.rst +++ b/docs/users_guide/8.0.1-notes.rst @@ -445,6 +445,14 @@ Template Haskell whether flags such as :ghc-flag:`-XStrictData` or :ghc-flag:`-funbox-strict-fields` are enabled. +- Previously, quoting a type signature like ``a -> a`` would produce the + abstract syntax for ``forall a. a -> a``. This behavior remains, but it + is extended to kinds, too, meaning that ``Proxy a -> Proxy a`` becomes + ``forall k (a :: k). Proxy a -> Proxy a``. This change is not intentional, + but is forced by the fact that GHC has a hard time telling kinds apart + from types. The effect of this change is that round-tripping kind- + polymorphic types will now require :ghc-flag:`-XTypeInType`. + Runtime system ~~~~~~~~~~~~~~ diff --git a/testsuite/tests/th/T11797.hs b/testsuite/tests/th/T11797.hs new file mode 100644 index 0000000..0ee0a04 --- /dev/null +++ b/testsuite/tests/th/T11797.hs @@ -0,0 +1,14 @@ +{-# LANGUAGE TemplateHaskell #-} + +module T11797 where + +import Language.Haskell.TH +import System.IO + +$(do dec <- [d| class Foo a where + meth :: a -> b -> a |] + runIO $ do putStrLn $ pprint dec + hFlush stdout + return [] ) + +-- the key bit is the forall b. in the type of the method diff --git a/testsuite/tests/th/T11797.stderr b/testsuite/tests/th/T11797.stderr new file mode 100644 index 0000000..1b43982 --- /dev/null +++ b/testsuite/tests/th/T11797.stderr @@ -0,0 +1,2 @@ +class Foo_0 a_1 + where meth_2 :: forall b_3 . a_1 -> b_3 -> a_1 diff --git a/testsuite/tests/th/T8031.hs b/testsuite/tests/th/T8031.hs index e71f347..9f06c06 100644 --- a/testsuite/tests/th/T8031.hs +++ b/testsuite/tests/th/T8031.hs @@ -1,9 +1,10 @@ -{-# LANGUAGE TemplateHaskell, RankNTypes, DataKinds, TypeOperators, PolyKinds, +{-# LANGUAGE TemplateHaskell, RankNTypes, TypeOperators, TypeInType, GADTs #-} module T8031 where import Data.Proxy +import Data.Kind data SList :: [k] -> * where SCons :: Proxy h -> Proxy t -> SList (h ': t) diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index 2ff11fb..d562836 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -400,3 +400,4 @@ test('T11145', normal, compile_fail, ['-v0 -dsuppress-uniques']) test('T11463', normal, compile_and_run, ['-v0 -dsuppress-uniques']) test('T11680', normal, compile_fail, ['-v0']) test('T11809', normal, compile, ['-v0']) +test('T11797', normal, compile, ['-v0 -dsuppress-uniques']) From git at git.haskell.org Mon Apr 11 19:45:54 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 11 Apr 2016 19:45:54 +0000 (UTC) Subject: [commit: ghc] wip/rae's head updated: Teach lookupLocalRdrEnv about Exacts. (#11813) (be7b3f0) Message-ID: <20160411194554.1E9143A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/rae' now includes: f9d26e5 Fix a comment: triple -> tuple 485608d Refactor comments about shutdown c4a7520 Provide an optimized replicateM_ implementation #11795 90d66de Add doc to (<=<) comparing its type to (.) f3beed3 Remove left-over shell-tools.c 6d7fda5 Remove spurious STG_UNUSED annotation 2f82da7 Fix Template Haskell bug reported in #11809. d2e05c6 Reduce default for -fmax-pmcheck-iterations from 1e7 to 2e6 5a1add1 Export zonkEvBinds from TcHsSyn. 470d4d5 Fix suggestions for unbound variables (#11680) cf5ff08 Bump haddock submodule ad532de base: Fix "since" annotation on GHC.ExecutionStack 7443e5c Remove the instantiation check when deriving Generic(1) 378091c RtsFlags: Un-constify temporary buffer 8987ce0 Typos in Note 90538d8 Change runtime linker to perform lazy loading of symbols/sections 46e8f19 Fix a closed type family error message 02a5c58 Filter out invisible kind arguments during TH reification 8b57cac Added (more) missing instances for Identity and Const aadde2b Deriving Functor-like classes should unify kind variables 2ef35d8 Use `@since` annotation in GHC.ExecutionStack c6e579b Add linker notes 68f3b3c Fix #11811. 6121bba Fix #11797. 35d882a Fix #11814 by throwing more stuff into InScopeSets be7b3f0 Teach lookupLocalRdrEnv about Exacts. (#11813) From git at git.haskell.org Tue Apr 12 10:11:28 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 12 Apr 2016 10:11:28 +0000 (UTC) Subject: [commit: ghc] master: Small simplification (#11777) (83eb4fd) Message-ID: <20160412101128.48B453A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/83eb4fd97a74a71e9b23b13ed656224a960fd43d/ghc >--------------------------------------------------------------- commit 83eb4fd97a74a71e9b23b13ed656224a960fd43d Author: Simon Marlow Date: Mon Apr 11 04:59:36 2016 -0700 Small simplification (#11777) DEAD_WEAK used to have a different layout, see d61c623ed6b2d352474a7497a65015dbf6a72e12 >--------------------------------------------------------------- 83eb4fd97a74a71e9b23b13ed656224a960fd43d rts/sm/MarkWeak.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/rts/sm/MarkWeak.c b/rts/sm/MarkWeak.c index 9a32198..d9f1733 100644 --- a/rts/sm/MarkWeak.c +++ b/rts/sm/MarkWeak.c @@ -413,11 +413,7 @@ markWeakPtrList ( void ) evacuate((StgClosure **)last_w); w = *last_w; - if (w->header.info == &stg_DEAD_WEAK_info) { - last_w = &(w->link); - } else { - last_w = &(w->link); - } + last_w = &(w->link); } } } From git at git.haskell.org Tue Apr 12 10:11:30 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 12 Apr 2016 10:11:30 +0000 (UTC) Subject: [commit: ghc] master: Cache the size of part_list/scavd_list (#11783) (5c4cd0e) Message-ID: <20160412101130.ECCAF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5c4cd0e44657d52f7ca5fee63f8765d17f1fbe85/ghc >--------------------------------------------------------------- commit 5c4cd0e44657d52f7ca5fee63f8765d17f1fbe85 Author: Simon Marlow Date: Mon Apr 11 19:29:14 2016 -0700 Cache the size of part_list/scavd_list (#11783) After a parallel GC, it is possible to have a long list of blocks in ws->part_list, if we did a lot of work stealing but didn't fill up the blocks we stole. These blocks persist until the next load-balanced GC, which might be a long time, and during every GC we were traversing this list to find its size. The fix is to maintain the size all the time, so we don't have to compute it. >--------------------------------------------------------------- 5c4cd0e44657d52f7ca5fee63f8765d17f1fbe85 rts/sm/GC.c | 7 ++++++- rts/sm/GCThread.h | 8 +++++--- rts/sm/GCUtils.c | 3 +++ rts/sm/Storage.c | 11 ++++++----- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/rts/sm/GC.c b/rts/sm/GC.c index d861db9..02bb3bb 100644 --- a/rts/sm/GC.c +++ b/rts/sm/GC.c @@ -820,9 +820,11 @@ new_gc_thread (nat n, gc_thread *t) ws->part_list = NULL; ws->n_part_blocks = 0; + ws->n_part_words = 0; ws->scavd_list = NULL; ws->n_scavd_blocks = 0; + ws->n_scavd_words = 0; } } @@ -1219,9 +1221,11 @@ prepare_collected_gen (generation *gen) } ws->part_list = NULL; ws->n_part_blocks = 0; + ws->n_part_words = 0; ASSERT(ws->scavd_list == NULL); ASSERT(ws->n_scavd_blocks == 0); + ASSERT(ws->n_scavd_words == 0); if (ws->todo_free != ws->todo_bd->start) { ws->todo_bd->free = ws->todo_free; @@ -1346,7 +1350,6 @@ collect_gct_blocks (void) prev = NULL; for (bd = ws->scavd_list; bd != NULL; bd = bd->link) { - ws->gen->n_words += bd->free - bd->start; prev = bd; } if (prev != NULL) { @@ -1354,9 +1357,11 @@ collect_gct_blocks (void) ws->gen->blocks = ws->scavd_list; } ws->gen->n_blocks += ws->n_scavd_blocks; + ws->gen->n_words += ws->n_scavd_words; ws->scavd_list = NULL; ws->n_scavd_blocks = 0; + ws->n_scavd_words = 0; RELEASE_SPIN_LOCK(&ws->gen->sync); } diff --git a/rts/sm/GCThread.h b/rts/sm/GCThread.h index ca90717..1fee7a6 100644 --- a/rts/sm/GCThread.h +++ b/rts/sm/GCThread.h @@ -94,13 +94,15 @@ typedef struct gen_workspace_ { // Objects that have already been scavenged. bdescr * scavd_list; - nat n_scavd_blocks; // count of blocks in this list + StgWord n_scavd_blocks; // count of blocks in this list + StgWord n_scavd_words; // Partially-full, scavenged, blocks bdescr * part_list; - unsigned int n_part_blocks; // count of above + StgWord n_part_blocks; // count of above + StgWord n_part_words; - StgWord pad[3]; + StgWord pad[1]; } gen_workspace ATTRIBUTE_ALIGNED(64); // align so that computing gct->gens[n] is a shift, not a multiply diff --git a/rts/sm/GCUtils.c b/rts/sm/GCUtils.c index 1c6a93c..364a10a 100644 --- a/rts/sm/GCUtils.c +++ b/rts/sm/GCUtils.c @@ -146,6 +146,7 @@ push_scanned_block (bdescr *bd, gen_workspace *ws) bd->link = ws->part_list; ws->part_list = bd; ws->n_part_blocks += bd->blocks; + ws->n_part_words += bd->free - bd->start; IF_DEBUG(sanity, ASSERT(countBlocks(ws->part_list) == ws->n_part_blocks)); } @@ -155,6 +156,7 @@ push_scanned_block (bdescr *bd, gen_workspace *ws) bd->link = ws->scavd_list; ws->scavd_list = bd; ws->n_scavd_blocks += bd->blocks; + ws->n_scavd_words += bd->free - bd->start; IF_DEBUG(sanity, ASSERT(countBlocks(ws->scavd_list) == ws->n_scavd_blocks)); } @@ -306,6 +308,7 @@ alloc_todo_block (gen_workspace *ws, nat size) { ws->part_list = bd->link; ws->n_part_blocks -= bd->blocks; + ws->n_part_words -= bd->free - bd->start; } else { diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c index 45bb54c..18ae796 100644 --- a/rts/sm/Storage.c +++ b/rts/sm/Storage.c @@ -1183,13 +1183,14 @@ W_ genLiveBlocks (generation *gen) W_ gcThreadLiveWords (nat i, nat g) { - W_ words; + W_ a, b, c; - words = countOccupied(gc_threads[i]->gens[g].todo_bd); - words += countOccupied(gc_threads[i]->gens[g].part_list); - words += countOccupied(gc_threads[i]->gens[g].scavd_list); + a = countOccupied(gc_threads[i]->gens[g].todo_bd); + b = gc_threads[i]->gens[g].n_part_words; + c = gc_threads[i]->gens[g].n_scavd_words; - return words; +// debugBelch("cap %d, g%d, %ld %ld %ld\n", i, g, a, b, c); + return a + b + c; } W_ gcThreadLiveBlocks (nat i, nat g) From git at git.haskell.org Tue Apr 12 10:11:33 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 12 Apr 2016 10:11:33 +0000 (UTC) Subject: [commit: ghc] master: Allocate blocks in the GC in batches (f4446c5) Message-ID: <20160412101133.BF0DA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f4446c5b963af8f3cc1693e2feab91dbe43d5237/ghc >--------------------------------------------------------------- commit f4446c5b963af8f3cc1693e2feab91dbe43d5237 Author: Simon Marlow Date: Sat Apr 9 20:49:52 2016 +0100 Allocate blocks in the GC in batches Avoids contention for the block allocator lock in the GC; this can be seen in the gc_alloc_block_sync counter emitted by +RTS -s. I experimented with this a while ago, and there was already commented-out code for it in GCUtils.c, but I've now improved it so that it doesn't result in significantly worse memory usage. * The old method of putting spare blocks on ws->part_list was wasteful, the spare blocks are now shared between all generations and retained between GCs. * repeated allocGroup() results in fragmentation, so I switched to using allocLargeChunk() instead which is fragmentation-friendly; we already use it for the same reason in nursery allocation. >--------------------------------------------------------------- f4446c5b963af8f3cc1693e2feab91dbe43d5237 includes/rts/storage/Block.h | 3 ++- rts/sm/GC.c | 2 +- rts/sm/GCUtils.c | 49 ++++++++++++++++++++------------------------ rts/sm/Sanity.c | 8 ++++++-- 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/includes/rts/storage/Block.h b/includes/rts/storage/Block.h index 755c817..024f78c 100644 --- a/includes/rts/storage/Block.h +++ b/includes/rts/storage/Block.h @@ -89,7 +89,8 @@ typedef struct bdescr_ { StgPtr start; // [READ ONLY] start addr of memory - StgPtr free; // first free byte of memory. + StgPtr free; // First free byte of memory. + // allocGroup() sets this to the value of start. // NB. during use this value should lie // between start and start + blocks * // BLOCK_SIZE. Values outside this diff --git a/rts/sm/GC.c b/rts/sm/GC.c index 02bb3bb..df73ab8 100644 --- a/rts/sm/GC.c +++ b/rts/sm/GC.c @@ -922,7 +922,7 @@ any_work (void) return rtsTrue; } - // Check for global work in any step. We don't need to check for + // Check for global work in any gen. We don't need to check for // local work, because we have already exited scavenge_loop(), // which means there is no local work for this thread. for (g = 0; g < (int)RtsFlags.GcFlags.generations; g++) { diff --git a/rts/sm/GCUtils.c b/rts/sm/GCUtils.c index 364a10a..9ecb674 100644 --- a/rts/sm/GCUtils.c +++ b/rts/sm/GCUtils.c @@ -51,29 +51,28 @@ allocGroup_sync(nat n) } -#if 0 -static void -allocBlocks_sync(nat n, bdescr **hd, bdescr **tl, - nat gen_no, step *stp, - StgWord32 flags) +static nat +allocBlocks_sync(nat n, bdescr **hd) { bdescr *bd; nat i; ACQUIRE_SPIN_LOCK(&gc_alloc_block_sync); - bd = allocGroup(n); + bd = allocLargeChunk(1,n); + // NB. allocLargeChunk, rather than allocGroup(n), to allocate in a + // fragmentation-friendly way. + n = bd->blocks; for (i = 0; i < n; i++) { bd[i].blocks = 1; - bd[i].gen_no = gen_no; - bd[i].step = stp; - bd[i].flags = flags; bd[i].link = &bd[i+1]; - bd[i].u.scan = bd[i].free = bd[i].start; + bd[i].free = bd[i].start; } - *hd = bd; - *tl = &bd[n-1]; + bd[n-1].link = NULL; + // We have to hold the lock until we've finished fiddling with the metadata, + // otherwise the block allocator can get confused. RELEASE_SPIN_LOCK(&gc_alloc_block_sync); + *hd = bd; + return n; } -#endif void freeChain_sync(bdescr *bd) @@ -312,26 +311,22 @@ alloc_todo_block (gen_workspace *ws, nat size) } else { - // blocks in to-space get the BF_EVACUATED flag. - -// allocBlocks_sync(16, &hd, &tl, -// ws->step->gen_no, ws->step, BF_EVACUATED); -// -// tl->link = ws->part_list; -// ws->part_list = hd->link; -// ws->n_part_blocks += 15; -// -// bd = hd; - if (size > BLOCK_SIZE_W) { bd = allocGroup_sync((W_)BLOCK_ROUND_UP(size*sizeof(W_)) / BLOCK_SIZE); } else { - bd = allocBlock_sync(); + if (gct->free_blocks) { + bd = gct->free_blocks; + gct->free_blocks = bd->link; + } else { + allocBlocks_sync(16, &bd); + gct->free_blocks = bd->link; + } } - initBdescr(bd, ws->gen, ws->gen->to); + // blocks in to-space get the BF_EVACUATED flag. bd->flags = BF_EVACUATED; - bd->u.scan = bd->free = bd->start; + bd->u.scan = bd->start; + initBdescr(bd, ws->gen, ws->gen->to); } bd->link = NULL; diff --git a/rts/sm/Sanity.c b/rts/sm/Sanity.c index 7ce1183..1f4c492 100644 --- a/rts/sm/Sanity.c +++ b/rts/sm/Sanity.c @@ -770,6 +770,7 @@ findMemoryLeak (void) } for (i = 0; i < n_capabilities; i++) { + markBlocks(gc_threads[i]->free_blocks); markBlocks(capabilities[i]->pinned_object_block); } @@ -841,7 +842,7 @@ memInventory (rtsBool show) nat g, i; W_ gen_blocks[RtsFlags.GcFlags.generations]; W_ nursery_blocks, retainer_blocks, - arena_blocks, exec_blocks; + arena_blocks, exec_blocks, gc_free_blocks = 0; W_ live_blocks = 0, free_blocks = 0; rtsBool leak; @@ -864,6 +865,7 @@ memInventory (rtsBool show) nursery_blocks += nurseries[i].n_blocks; } for (i = 0; i < n_capabilities; i++) { + gc_free_blocks += countBlocks(gc_threads[i]->free_blocks); if (capabilities[i]->pinned_object_block != NULL) { nursery_blocks += capabilities[i]->pinned_object_block->blocks; } @@ -891,7 +893,7 @@ memInventory (rtsBool show) live_blocks += gen_blocks[g]; } live_blocks += nursery_blocks + - + retainer_blocks + arena_blocks + exec_blocks; + + retainer_blocks + arena_blocks + exec_blocks + gc_free_blocks; #define MB(n) (((double)(n) * BLOCK_SIZE_W) / ((1024*1024)/sizeof(W_))) @@ -916,6 +918,8 @@ memInventory (rtsBool show) arena_blocks, MB(arena_blocks)); debugBelch(" exec : %5" FMT_Word " blocks (%6.1lf MB)\n", exec_blocks, MB(exec_blocks)); + debugBelch(" GC free pool : %5" FMT_Word " blocks (%6.1lf MB)\n", + gc_free_blocks, MB(gc_free_blocks)); debugBelch(" free : %5" FMT_Word " blocks (%6.1lf MB)\n", free_blocks, MB(free_blocks)); debugBelch(" total : %5" FMT_Word " blocks (%6.1lf MB)\n", From git at git.haskell.org Tue Apr 12 12:11:55 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 12 Apr 2016 12:11:55 +0000 (UTC) Subject: [commit: ghc] master: Fix #11811. (b1084fd) Message-ID: <20160412121155.185EA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b1084fd700e6bbe9d0d787046a6aabdb193982c4/ghc >--------------------------------------------------------------- commit b1084fd700e6bbe9d0d787046a6aabdb193982c4 Author: Richard Eisenberg Date: Thu Apr 7 16:44:06 2016 +0200 Fix #11811. Previously, I had forgotten to omit variables already in scope from the TypeInType CUSK check. Simple enough to fix. Test case: typecheck/should_compile/T11811 >--------------------------------------------------------------- b1084fd700e6bbe9d0d787046a6aabdb193982c4 compiler/hsSyn/HsDecls.hs | 2 ++ compiler/rename/RnSource.hs | 37 +++++++++++----------- compiler/rename/RnTypes.hs | 29 ++++++++++------- testsuite/tests/typecheck/should_compile/T11811.hs | 8 +++++ testsuite/tests/typecheck/should_compile/all.T | 1 + 5 files changed, 46 insertions(+), 31 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc b1084fd700e6bbe9d0d787046a6aabdb193982c4 From git at git.haskell.org Tue Apr 12 12:12:01 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 12 Apr 2016 12:12:01 +0000 (UTC) Subject: [commit: ghc] master: Teach lookupLocalRdrEnv about Exacts. (#11813) (d81cdc2) Message-ID: <20160412121201.218DD3A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d81cdc227cd487659995ddea577214314c9b4b97/ghc >--------------------------------------------------------------- commit d81cdc227cd487659995ddea577214314c9b4b97 Author: Richard Eisenberg Date: Fri Apr 8 08:01:34 2016 +0200 Teach lookupLocalRdrEnv about Exacts. (#11813) >--------------------------------------------------------------- d81cdc227cd487659995ddea577214314c9b4b97 compiler/basicTypes/RdrName.hs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/compiler/basicTypes/RdrName.hs b/compiler/basicTypes/RdrName.hs index fec5411..d259726 100644 --- a/compiler/basicTypes/RdrName.hs +++ b/compiler/basicTypes/RdrName.hs @@ -357,8 +357,17 @@ extendLocalRdrEnvList lre@(LRE { lre_env = env, lre_in_scope = ns }) names , lre_in_scope = extendNameSetList ns names } lookupLocalRdrEnv :: LocalRdrEnv -> RdrName -> Maybe Name -lookupLocalRdrEnv (LRE { lre_env = env }) (Unqual occ) = lookupOccEnv env occ -lookupLocalRdrEnv _ _ = Nothing +lookupLocalRdrEnv (LRE { lre_env = env, lre_in_scope = ns }) rdr + | Unqual occ <- rdr + = lookupOccEnv env occ + + -- See Note [Local bindings with Exact Names] + | Exact name <- rdr + , name `elemNameSet` ns + = Just name + + | otherwise + = Nothing lookupLocalRdrOcc :: LocalRdrEnv -> OccName -> Maybe Name lookupLocalRdrOcc (LRE { lre_env = env }) occ = lookupOccEnv env occ From git at git.haskell.org Tue Apr 12 12:11:58 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 12 Apr 2016 12:11:58 +0000 (UTC) Subject: [commit: ghc] master: Fix #11797. (dd99f2e) Message-ID: <20160412121158.751BF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/dd99f2ece1bd139be02beddc6dc672862ee5ae34/ghc >--------------------------------------------------------------- commit dd99f2ece1bd139be02beddc6dc672862ee5ae34 Author: Richard Eisenberg Date: Wed Apr 6 16:37:22 2016 +0200 Fix #11797. DsMeta curiously omitted quantified tyvars in certain circumstances. This patch means it doesn't. Test case: th/T11797 >--------------------------------------------------------------- dd99f2ece1bd139be02beddc6dc672862ee5ae34 compiler/deSugar/DsMeta.hs | 13 +++++++------ docs/users_guide/8.0.1-notes.rst | 8 ++++++++ testsuite/tests/th/T11797.hs | 14 ++++++++++++++ testsuite/tests/th/T11797.stderr | 2 ++ testsuite/tests/th/T8031.hs | 3 ++- testsuite/tests/th/all.T | 1 + 6 files changed, 34 insertions(+), 7 deletions(-) diff --git a/compiler/deSugar/DsMeta.hs b/compiler/deSugar/DsMeta.hs index b14c0a4..7ed96b4 100644 --- a/compiler/deSugar/DsMeta.hs +++ b/compiler/deSugar/DsMeta.hs @@ -872,12 +872,9 @@ repContext ctxt = do preds <- repList typeQTyConName repLTy ctxt repCtxt preds repHsSigType :: LHsSigType Name -> DsM (Core TH.TypeQ) -repHsSigType ty = repLTy (hsSigType ty) - -repHsSigWcType :: LHsSigWcType Name -> DsM (Core TH.TypeQ) -repHsSigWcType (HsIB { hsib_vars = vars - , hsib_body = sig1 }) - | (explicit_tvs, ctxt, ty) <- splitLHsSigmaTy (hswc_body sig1) +repHsSigType (HsIB { hsib_vars = vars + , hsib_body = body }) + | (explicit_tvs, ctxt, ty) <- splitLHsSigmaTy body = addTyVarBinds (HsQTvs { hsq_implicit = [] , hsq_explicit = map (noLoc . UserTyVar . noLoc) vars ++ explicit_tvs @@ -889,6 +886,10 @@ repHsSigWcType (HsIB { hsib_vars = vars then return th_ty else repTForall th_tvs th_ctxt th_ty } +repHsSigWcType :: LHsSigWcType Name -> DsM (Core TH.TypeQ) +repHsSigWcType ib_ty@(HsIB { hsib_body = sig1 }) + = repHsSigType (ib_ty { hsib_body = hswc_body sig1 }) + -- yield the representation of a list of types -- repLTys :: [LHsType Name] -> DsM [Core TH.TypeQ] diff --git a/docs/users_guide/8.0.1-notes.rst b/docs/users_guide/8.0.1-notes.rst index d79fdf2..2f011c4 100644 --- a/docs/users_guide/8.0.1-notes.rst +++ b/docs/users_guide/8.0.1-notes.rst @@ -445,6 +445,14 @@ Template Haskell whether flags such as :ghc-flag:`-XStrictData` or :ghc-flag:`-funbox-strict-fields` are enabled. +- Previously, quoting a type signature like ``a -> a`` would produce the + abstract syntax for ``forall a. a -> a``. This behavior remains, but it + is extended to kinds, too, meaning that ``Proxy a -> Proxy a`` becomes + ``forall k (a :: k). Proxy a -> Proxy a``. This change is not intentional, + but is forced by the fact that GHC has a hard time telling kinds apart + from types. The effect of this change is that round-tripping kind- + polymorphic types will now require :ghc-flag:`-XTypeInType`. + Runtime system ~~~~~~~~~~~~~~ diff --git a/testsuite/tests/th/T11797.hs b/testsuite/tests/th/T11797.hs new file mode 100644 index 0000000..0ee0a04 --- /dev/null +++ b/testsuite/tests/th/T11797.hs @@ -0,0 +1,14 @@ +{-# LANGUAGE TemplateHaskell #-} + +module T11797 where + +import Language.Haskell.TH +import System.IO + +$(do dec <- [d| class Foo a where + meth :: a -> b -> a |] + runIO $ do putStrLn $ pprint dec + hFlush stdout + return [] ) + +-- the key bit is the forall b. in the type of the method diff --git a/testsuite/tests/th/T11797.stderr b/testsuite/tests/th/T11797.stderr new file mode 100644 index 0000000..1b43982 --- /dev/null +++ b/testsuite/tests/th/T11797.stderr @@ -0,0 +1,2 @@ +class Foo_0 a_1 + where meth_2 :: forall b_3 . a_1 -> b_3 -> a_1 diff --git a/testsuite/tests/th/T8031.hs b/testsuite/tests/th/T8031.hs index e71f347..9f06c06 100644 --- a/testsuite/tests/th/T8031.hs +++ b/testsuite/tests/th/T8031.hs @@ -1,9 +1,10 @@ -{-# LANGUAGE TemplateHaskell, RankNTypes, DataKinds, TypeOperators, PolyKinds, +{-# LANGUAGE TemplateHaskell, RankNTypes, TypeOperators, TypeInType, GADTs #-} module T8031 where import Data.Proxy +import Data.Kind data SList :: [k] -> * where SCons :: Proxy h -> Proxy t -> SList (h ': t) diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index 2ff11fb..d562836 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -400,3 +400,4 @@ test('T11145', normal, compile_fail, ['-v0 -dsuppress-uniques']) test('T11463', normal, compile_and_run, ['-v0 -dsuppress-uniques']) test('T11680', normal, compile_fail, ['-v0']) test('T11809', normal, compile, ['-v0']) +test('T11797', normal, compile, ['-v0 -dsuppress-uniques']) From git at git.haskell.org Tue Apr 12 12:12:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 12 Apr 2016 12:12:03 +0000 (UTC) Subject: [commit: ghc] master: Fix #11814 by throwing more stuff into InScopeSets (0b6dcf6) Message-ID: <20160412121203.BE8F63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0b6dcf6d2ccac3b43037650279256022a352de53/ghc >--------------------------------------------------------------- commit 0b6dcf6d2ccac3b43037650279256022a352de53 Author: Richard Eisenberg Date: Wed Apr 6 15:24:34 2016 +0200 Fix #11814 by throwing more stuff into InScopeSets >--------------------------------------------------------------- 0b6dcf6d2ccac3b43037650279256022a352de53 compiler/stranal/WwLib.hs | 5 ++++- compiler/types/Type.hs | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/compiler/stranal/WwLib.hs b/compiler/stranal/WwLib.hs index 7c85036..4ec36ba 100644 --- a/compiler/stranal/WwLib.hs +++ b/compiler/stranal/WwLib.hs @@ -22,6 +22,7 @@ import MkCore ( mkRuntimeErrorApp, aBSENT_ERROR_ID, mkCoreUbxTup ) import MkId ( voidArgId, voidPrimId ) import TysPrim ( voidPrimTy ) import TysWiredIn ( tupleDataCon ) +import VarEnv ( mkInScopeSet ) import Type import Coercion import FamInstEnv @@ -127,7 +128,9 @@ mkWwBodies :: DynFlags -- E mkWwBodies dflags fam_envs fun_ty demands res_info - = do { (wrap_args, wrap_fn_args, work_fn_args, res_ty) <- mkWWargs emptyTCvSubst fun_ty demands + = do { let empty_subst = mkEmptyTCvSubst (mkInScopeSet (tyCoVarsOfType fun_ty)) + + ; (wrap_args, wrap_fn_args, work_fn_args, res_ty) <- mkWWargs empty_subst fun_ty demands ; (useful1, work_args, wrap_fn_str, work_fn_str) <- mkWWstr dflags fam_envs wrap_args -- Do CPR w/w. See Note [Always do CPR w/w] diff --git a/compiler/types/Type.hs b/compiler/types/Type.hs index c5561a3..8901968 100644 --- a/compiler/types/Type.hs +++ b/compiler/types/Type.hs @@ -1084,9 +1084,9 @@ mkCastTy ty co | isReflexiveCo co = ty mkCastTy (CastTy ty co1) co2 = mkCastTy ty (co1 `mkTransCo` co2) -- See Note [Weird typing rule for ForAllTy] -mkCastTy (ForAllTy (Named tv vis) inner_ty) co +mkCastTy outer_ty@(ForAllTy (Named tv vis) inner_ty) co = -- have to make sure that pushing the co in doesn't capture the bound var - let fvs = tyCoVarsOfCo co + let fvs = tyCoVarsOfCo co `unionVarSet` tyCoVarsOfType outer_ty empty_subst = mkEmptyTCvSubst (mkInScopeSet fvs) (subst, tv') = substTyVarBndr empty_subst tv in From git at git.haskell.org Tue Apr 12 15:59:43 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 12 Apr 2016 15:59:43 +0000 (UTC) Subject: [commit: ghc] wip/rae: Increase an InScopeSet for a substitution (6e2e5e3) Message-ID: <20160412155943.22AB13A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rae Link : http://ghc.haskell.org/trac/ghc/changeset/6e2e5e3b22bb7534162060daded95eb02f236199/ghc >--------------------------------------------------------------- commit 6e2e5e3b22bb7534162060daded95eb02f236199 Author: Richard Eisenberg Date: Tue Apr 12 12:00:55 2016 -0400 Increase an InScopeSet for a substitution This is a further fix for #11814 >--------------------------------------------------------------- 6e2e5e3b22bb7534162060daded95eb02f236199 compiler/types/FamInstEnv.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/types/FamInstEnv.hs b/compiler/types/FamInstEnv.hs index 020dd78..62906dd 100644 --- a/compiler/types/FamInstEnv.hs +++ b/compiler/types/FamInstEnv.hs @@ -515,7 +515,8 @@ compatibleBranches (CoAxBranch { cab_lhs = lhs1, cab_rhs = rhs1 }) = case tcUnifyTysFG (const BindMe) lhs1 lhs2 of SurelyApart -> True Unifiable subst - | Type.substTy subst rhs1 `eqType` Type.substTy subst rhs2 + | Type.substTyAddInScope subst rhs1 `eqType` + Type.substTyAddInScope subst rhs2 -> True _ -> False From git at git.haskell.org Tue Apr 12 15:59:45 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 12 Apr 2016 15:59:45 +0000 (UTC) Subject: [commit: ghc] wip/rae's head updated: Increase an InScopeSet for a substitution (6e2e5e3) Message-ID: <20160412155945.42C563A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/rae' now includes: 83eb4fd Small simplification (#11777) 5c4cd0e Cache the size of part_list/scavd_list (#11783) f4446c5 Allocate blocks in the GC in batches b1084fd Fix #11811. dd99f2e Fix #11797. 0b6dcf6 Fix #11814 by throwing more stuff into InScopeSets d81cdc2 Teach lookupLocalRdrEnv about Exacts. (#11813) 6e2e5e3 Increase an InScopeSet for a substitution From git at git.haskell.org Wed Apr 13 17:54:15 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Apr 2016 17:54:15 +0000 (UTC) Subject: [commit: ghc] branch 'wip/ttypeable' created Message-ID: <20160413175415.0FB5C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/ttypeable Referencing: bbc852581a4e7fddb5efdfe86e6f109121bb2366 From git at git.haskell.org Wed Apr 13 17:54:17 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Apr 2016 17:54:17 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Fix warnings (dd91807) Message-ID: <20160413175417.ACDAC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/dd9180748695f84d941472ecccaf19781dd0e6ea/ghc >--------------------------------------------------------------- commit dd9180748695f84d941472ecccaf19781dd0e6ea Author: Ben Gamari Date: Fri Mar 11 17:51:26 2016 +0100 Fix warnings >--------------------------------------------------------------- dd9180748695f84d941472ecccaf19781dd0e6ea libraries/base/Data/Typeable/Internal.hs | 17 ++++++++++++----- libraries/ghc-boot/GHC/Serialized.hs | 1 - 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/libraries/base/Data/Typeable/Internal.hs b/libraries/base/Data/Typeable/Internal.hs index 6704154..7a3344e 100644 --- a/libraries/base/Data/Typeable/Internal.hs +++ b/libraries/base/Data/Typeable/Internal.hs @@ -68,7 +68,7 @@ module Data.Typeable.Internal ( -- * Construction -- | These are for internal use only - mkTrCon, mkTrApp, mkTyCon, + mkTrCon, mkTrApp, mkTyCon, mkTyCon#, typeSymbolTypeRep, typeNatTypeRep, -- * Representations for primitive types @@ -220,6 +220,7 @@ mkTrCon tc kind = TrTyCon fpr tc kind fpr = fingerprintFingerprints [fpr_tc, fpr_k] -- | Construct a representation for a type application. +-- TODO: Is this necessary? mkTrApp :: forall k1 k2 (a :: k1 -> k2) (b :: k1). TypeRep (a :: k1 -> k2) -> TypeRep (b :: k1) @@ -250,7 +251,7 @@ pattern TRCon con <- TrTyCon _ con _ -- | Splits a type application. splitApp :: TypeRep a -> Maybe (AppResult a) -splitApp (TrTyCon _ a _) = Nothing +splitApp (TrTyCon _ _ _) = Nothing splitApp (TrApp _ f x) = Just $ App f x ----------------- Observation --------------------- @@ -259,7 +260,9 @@ typeRepKind :: forall k (a :: k). TypeRep a -> TypeRep k typeRepKind (TrTyCon _ _ k) = k typeRepKind (TrApp _ f _) = case typeRepKind f of - TRFun arg res -> res + TRFun _arg res -> res + -- TODO: why is this case needed? + _ -> error "typeRepKind: impossible" -- | Observe the type constructor of a quantified type representation. typeRepXTyCon :: TypeRepX -> TyCon @@ -316,13 +319,16 @@ typeRepXFingerprint (TypeRepX t) = typeRepFingerprint t ----------------- Showing TypeReps -------------------- instance Show (TypeRep a) where - showsPrec p (TrTyCon _ tycon _) = shows tycon - showsPrec p (TrApp _ f x) = shows f . showString " " . shows x + showsPrec p (TrTyCon _ tycon _) = showsPrec p tycon + showsPrec p (TrApp _ f x) = showsPrec p f . showString " " . showsPrec p x + -- TODO: Reconsider precedence instance Show TypeRepX where showsPrec p (TypeRepX ty) = showsPrec p ty -- Some (Show.TypeRepX) helpers: +{- +-- FIXME: Handle tuples, etc. showArgs :: Show a => ShowS -> [a] -> ShowS showArgs _ [] = id showArgs _ [a] = showsPrec 10 a @@ -332,6 +338,7 @@ showTuple :: [TypeRepX] -> ShowS showTuple args = showChar '(' . showArgs (showChar ',') args . showChar ')' +-} -- | Helper to fully evaluate 'TypeRep' for use as @NFData(rnf)@ implementation -- diff --git a/libraries/ghc-boot/GHC/Serialized.hs b/libraries/ghc-boot/GHC/Serialized.hs index 7f86df9..8653049 100644 --- a/libraries/ghc-boot/GHC/Serialized.hs +++ b/libraries/ghc-boot/GHC/Serialized.hs @@ -22,7 +22,6 @@ module GHC.Serialized ( import Data.Bits import Data.Word ( Word8 ) import Data.Data -import Data.Typeable -- | Represents a serialized value of a particular type. Attempts can be made to deserialize it at certain types From git at git.haskell.org Wed Apr 13 17:54:20 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Apr 2016 17:54:20 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Outputable: Refactor handling of CallStacks (a901d98) Message-ID: <20160413175420.5B2B43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/a901d98a3b7d3625cfed98a0fdab0309400ee350/ghc >--------------------------------------------------------------- commit a901d98a3b7d3625cfed98a0fdab0309400ee350 Author: Ben Gamari Date: Sun Jan 31 20:29:18 2016 +0100 Outputable: Refactor handling of CallStacks Provide callstacks in more places and consolidate handling >--------------------------------------------------------------- a901d98a3b7d3625cfed98a0fdab0309400ee350 compiler/utils/Outputable.hs | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/compiler/utils/Outputable.hs b/compiler/utils/Outputable.hs index 259b554..78ef28d 100644 --- a/compiler/utils/Outputable.hs +++ b/compiler/utils/Outputable.hs @@ -1,4 +1,7 @@ -{-# LANGUAGE CPP, ImplicitParams #-} +{-# LANGUAGE CPP #-} +{-# LANGUAGE ImplicitParams #-} +{-# LANGUAGE KindSignatures #-} +{-# LANGUAGE ConstraintKinds #-} {- (c) The University of Glasgow 2006-2012 (c) The GRASP Project, Glasgow University, 1992-1998 @@ -79,6 +82,9 @@ module Outputable ( pprTrace, pprTraceIt, warnPprTrace, pprSTrace, trace, pgmError, panic, sorry, assertPanic, pprDebugAndThen, + + -- * Re-exported + HasCallStack, ) where import {-# SOURCE #-} DynFlags( DynFlags, @@ -115,8 +121,9 @@ import Data.Graph (SCC(..)) import GHC.Fingerprint import GHC.Show ( showMultiLineString ) +import GHC.Exts (Constraint) #if __GLASGOW_HASKELL__ > 710 -import GHC.Stack +import GHC.Exception (CallStack, prettyCallStackLines) #endif {- @@ -1055,9 +1062,21 @@ doOrDoes _ = text "do" ************************************************************************ -} -pprPanic :: String -> SDoc -> a +#if __GLASGOW_HASKELL__ > 710 +type HasCallStack = ((?callStack :: CallStack) :: Constraint) + +pprCallStack :: (?callStack :: CallStack) => SDoc +pprCallStack = vcat $ map text $ prettyCallStackLines ?callStack +#else +type HasCallStack = (() :: Constraint) + +pprCallStack :: SDoc +pprCallStack = empty +#endif + +pprPanic :: HasCallStack => String -> SDoc -> a -- ^ Throw an exception saying "bug in GHC" -pprPanic = panicDoc +pprPanic msg doc = panicDoc msg (pprCallStack $$ doc) pprSorry :: String -> SDoc -> a -- ^ Throw an exception saying "this isn't finished yet" @@ -1083,11 +1102,11 @@ pprTraceIt desc x = pprTrace desc (ppr x) x -- | If debug output is on, show some 'SDoc' on the screen along -- with a call stack when available. #if __GLASGOW_HASKELL__ > 710 -pprSTrace :: (?callStack :: CallStack) => SDoc -> a -> a -pprSTrace = pprTrace (prettyCallStack ?callStack) +pprSTrace :: HasCallStack => String -> SDoc -> a -> a +pprSTrace msg doc = pprTrace msg (pprCallStack $$ doc) #else -pprSTrace :: SDoc -> a -> a -pprSTrace = pprTrace "no callstack info" +pprSTrace :: String -> SDoc -> a -> a +pprSTrace msg doc = pprTrace msg (text "no callstack info" $$ doc) #endif warnPprTrace :: Bool -> String -> Int -> SDoc -> a -> a @@ -1104,11 +1123,11 @@ warnPprTrace True file line msg x -- | Panic with an assertation failure, recording the given file and -- line number. Should typically be accessed with the ASSERT family of macros #if __GLASGOW_HASKELL__ > 710 -assertPprPanic :: (?callStack :: CallStack) => String -> Int -> SDoc -> a +assertPprPanic :: HasCallStack => String -> Int -> SDoc -> a assertPprPanic _file _line msg = pprPanic "ASSERT failed!" doc where - doc = sep [ text (prettyCallStack ?callStack) + doc = sep [ pprCallStack , msg ] #else assertPprPanic :: String -> Int -> SDoc -> a From git at git.haskell.org Wed Apr 13 17:54:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Apr 2016 17:54:23 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Start implementing library side of TTypeable (5f08b98) Message-ID: <20160413175423.982833A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/5f08b9821980dd42a7f9f9a9a62acacbdb539e7c/ghc >--------------------------------------------------------------- commit 5f08b9821980dd42a7f9f9a9a62acacbdb539e7c Author: Ben Gamari Date: Sat Jan 30 00:04:54 2016 +0100 Start implementing library side of TTypeable >--------------------------------------------------------------- 5f08b9821980dd42a7f9f9a9a62acacbdb539e7c compiler/deSugar/DsBinds.hs | 79 +++-- compiler/prelude/PrelNames.hs | 72 +++-- compiler/typecheck/TcEvidence.hs | 20 +- compiler/typecheck/TcHsSyn.hs | 8 +- compiler/typecheck/TcInteract.hs | 58 +++- compiler/utils/Binary.hs | 55 +++- libraries/base/Data/Dynamic.hs | 51 +-- libraries/base/Data/Type/Equality.hs | 6 + libraries/base/Data/Typeable.hs | 192 ++++++++---- libraries/base/Data/Typeable/Internal.hs | 518 +++++++++++++++++-------------- libraries/base/GHC/Conc/Sync.hs | 4 - libraries/base/GHC/Show.hs | 2 +- libraries/base/Type/Reflection.hs | 43 +++ libraries/base/Type/Reflection/Unsafe.hs | 20 ++ libraries/base/base.cabal | 4 +- libraries/ghc-boot/GHC/Serialized.hs | 16 +- libraries/ghc-prim/GHC/Types.hs | 18 +- libraries/ghci/GHCi/TH/Binary.hs | 57 ++++ nofib | 2 +- 19 files changed, 795 insertions(+), 430 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 5f08b9821980dd42a7f9f9a9a62acacbdb539e7c From git at git.haskell.org Wed Apr 13 17:54:26 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Apr 2016 17:54:26 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: TcSMonad: Introduce tcLookupId (7b90d64) Message-ID: <20160413175426.460D53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/7b90d649a1921c251eab437fc1a34d3ed4d0e47f/ghc >--------------------------------------------------------------- commit 7b90d649a1921c251eab437fc1a34d3ed4d0e47f Author: Ben Gamari Date: Sun Jan 31 17:42:57 2016 +0100 TcSMonad: Introduce tcLookupId >--------------------------------------------------------------- 7b90d649a1921c251eab437fc1a34d3ed4d0e47f compiler/typecheck/TcSMonad.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/compiler/typecheck/TcSMonad.hs b/compiler/typecheck/TcSMonad.hs index 303fee8..d935d72 100644 --- a/compiler/typecheck/TcSMonad.hs +++ b/compiler/typecheck/TcSMonad.hs @@ -43,7 +43,7 @@ module TcSMonad ( getTopEnv, getGblEnv, getLclEnv, getTcEvBinds, getTcEvBindsFromVar, getTcLevel, getTcEvBindsMap, - tcLookupClass, + tcLookupClass, tcLookupId, -- Inerts InertSet(..), InertCans(..), @@ -121,7 +121,7 @@ import FamInstEnv import qualified TcRnMonad as TcM import qualified TcMType as TcM import qualified TcEnv as TcM - ( checkWellStaged, topIdLvl, tcGetDefaultTys, tcLookupClass ) + ( checkWellStaged, topIdLvl, tcGetDefaultTys, tcLookupClass, tcLookupId ) import Kind import TcType import DynFlags @@ -2720,6 +2720,9 @@ getLclEnv = wrapTcS $ TcM.getLclEnv tcLookupClass :: Name -> TcS Class tcLookupClass c = wrapTcS $ TcM.tcLookupClass c +tcLookupId :: Name -> TcS Id +tcLookupId n = wrapTcS $ TcM.tcLookupId n + -- Setting names as used (used in the deriving of Coercible evidence) -- Too hackish to expose it to TcS? In that case somehow extract the used -- constructors from the result of solveInteract From git at git.haskell.org Wed Apr 13 17:54:28 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Apr 2016 17:54:28 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: HACK: CoreLint: Kill unsaturated unlifted types check (a7c39f9) Message-ID: <20160413175428.EE5133A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/a7c39f98af585ebe0119a147520006af1549c41e/ghc >--------------------------------------------------------------- commit a7c39f98af585ebe0119a147520006af1549c41e Author: Ben Gamari Date: Sat Jan 30 19:53:05 2016 +0100 HACK: CoreLint: Kill unsaturated unlifted types check >--------------------------------------------------------------- a7c39f98af585ebe0119a147520006af1549c41e compiler/coreSyn/CoreLint.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/coreSyn/CoreLint.hs b/compiler/coreSyn/CoreLint.hs index 99625c9..2c401de 100644 --- a/compiler/coreSyn/CoreLint.hs +++ b/compiler/coreSyn/CoreLint.hs @@ -1040,7 +1040,7 @@ lintType ty@(TyConApp tc tys) = lintType ty' -- Expand type synonyms, so that we do not bogusly complain -- about un-saturated type synonyms - | isUnliftedTyCon tc || isTypeSynonymTyCon tc || isTypeFamilyTyCon tc + | isTypeSynonymTyCon tc || isTypeFamilyTyCon tc -- Also type synonyms and type families , length tys < tyConArity tc = failWithL (hang (text "Un-saturated type application") 2 (ppr ty)) From git at git.haskell.org Wed Apr 13 17:54:31 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Apr 2016 17:54:31 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Fix rebase (1099a96) Message-ID: <20160413175431.A6E313A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/1099a960764ce1e67e6955c2e06be71ba9a6381b/ghc >--------------------------------------------------------------- commit 1099a960764ce1e67e6955c2e06be71ba9a6381b Author: Ben Gamari Date: Fri Mar 11 17:23:30 2016 +0100 Fix rebase >--------------------------------------------------------------- 1099a960764ce1e67e6955c2e06be71ba9a6381b compiler/prelude/PrelNames.hs | 38 +++++++++++++-------------- compiler/typecheck/TcInteract.hs | 14 +++++----- libraries/base/Data/Typeable/Internal.hs | 44 ++++++++++++++++---------------- 3 files changed, 48 insertions(+), 48 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 1099a960764ce1e67e6955c2e06be71ba9a6381b From git at git.haskell.org Wed Apr 13 17:54:34 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Apr 2016 17:54:34 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Fix serialization (4f3c051) Message-ID: <20160413175434.50CE83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/4f3c05163b39337180df62b990a3e1c4f36c6a7a/ghc >--------------------------------------------------------------- commit 4f3c05163b39337180df62b990a3e1c4f36c6a7a Author: Ben Gamari Date: Fri Mar 11 19:23:16 2016 +0100 Fix serialization >--------------------------------------------------------------- 4f3c05163b39337180df62b990a3e1c4f36c6a7a compiler/utils/Binary.hs | 12 +++++++----- libraries/ghci/GHCi/TH/Binary.hs | 14 ++++++++------ 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/compiler/utils/Binary.hs b/compiler/utils/Binary.hs index c8f1d44..fcf9ce7 100644 --- a/compiler/utils/Binary.hs +++ b/compiler/utils/Binary.hs @@ -594,14 +594,16 @@ getTypeRepX bh = do case tag of 0 -> do con <- get bh TypeRepX rep_k <- getTypeRepX bh - Just HRefl <- pure $ eqTypeRep rep_k (typeRep :: TypeRep Type) - pure $ TypeRepX $ mkTrCon con rep_k + case rep_k `eqTypeRep` (typeRep :: TypeRep Type) of + Just HRefl -> pure $ TypeRepX $ mkTrCon con rep_k + Nothing -> fail "getTypeRepX: Kind mismatch" + 1 -> do TypeRepX f <- getTypeRepX bh TypeRepX x <- getTypeRepX bh case typeRepKind f of - TRFun arg _ -> do - Just HRefl <- pure $ eqTypeRep arg x - pure $ TypeRepX $ mkTrApp f x + TRFun arg _ | Just HRefl <- arg `eqTypeRep` x -> + pure $ TypeRepX $ mkTrApp f x + _ -> fail "getTypeRepX: Kind mismatch" _ -> fail "Binary: Invalid TypeRepX" instance Typeable a => Binary (TypeRep (a :: k)) where diff --git a/libraries/ghci/GHCi/TH/Binary.hs b/libraries/ghci/GHCi/TH/Binary.hs index d067e54..2433057 100644 --- a/libraries/ghci/GHCi/TH/Binary.hs +++ b/libraries/ghci/GHCi/TH/Binary.hs @@ -95,15 +95,17 @@ getTypeRepX = do case tag of 0 -> do con <- get :: Get TyCon TypeRepX rep_k <- getTypeRepX - Just HRefl <- pure $ eqTypeRep rep_k (typeRep :: TypeRep Type) - pure $ TypeRepX $ mkTrCon con rep_k + case rep_k `eqTypeRep` (typeRep :: TypeRep Type) of + Just HRefl -> pure $ TypeRepX $ mkTrCon con rep_k + Nothing -> fail "getTypeRepX: Kind mismatch" + 1 -> do TypeRepX f <- getTypeRepX TypeRepX x <- getTypeRepX case typeRepKind f of - TRFun arg _ -> do - Just HRefl <- pure $ eqTypeRep arg x - pure $ TypeRepX $ mkTrApp f x - _ -> fail "Binary: Invalid TTypeRep" + TRFun arg _ | Just HRefl <- arg `eqTypeRep` x -> + pure $ TypeRepX $ mkTrApp f x + _ -> fail "getTypeRepX: Kind mismatch" + _ -> fail "getTypeRepX: Invalid TypeRepX" instance Typeable a => Binary (TypeRep (a :: k)) where put = putTypeRep From git at git.haskell.org Wed Apr 13 17:54:36 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Apr 2016 17:54:36 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Various fixes (4034bdf) Message-ID: <20160413175436.F13163A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/4034bdfc5ed517b2bc6d98b1266450ac25ac7cb3/ghc >--------------------------------------------------------------- commit 4034bdfc5ed517b2bc6d98b1266450ac25ac7cb3 Author: Ben Gamari Date: Fri Mar 11 19:16:55 2016 +0100 Various fixes >--------------------------------------------------------------- 4034bdfc5ed517b2bc6d98b1266450ac25ac7cb3 compiler/utils/Binary.hs | 6 +++--- libraries/ghci/GHCi/TH/Binary.hs | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/compiler/utils/Binary.hs b/compiler/utils/Binary.hs index bd9b585..c8f1d44 100644 --- a/compiler/utils/Binary.hs +++ b/compiler/utils/Binary.hs @@ -81,7 +81,7 @@ import Data.Time #if MIN_VERSION_base(4,9,0) import Type.Reflection import Type.Reflection.Unsafe -import GHC.Exts ( TYPE, Levity(..) ) +import Data.Kind (Type) #else import Data.Typeable #endif @@ -594,7 +594,7 @@ getTypeRepX bh = do case tag of 0 -> do con <- get bh TypeRepX rep_k <- getTypeRepX bh - Just HRefl <- pure $ eqTypeRep rep_k (typeRep :: TypeRep (TYPE 'Lifted)) + Just HRefl <- pure $ eqTypeRep rep_k (typeRep :: TypeRep Type) pure $ TypeRepX $ mkTrCon con rep_k 1 -> do TypeRepX f <- getTypeRepX bh TypeRepX x <- getTypeRepX bh @@ -608,7 +608,7 @@ instance Typeable a => Binary (TypeRep (a :: k)) where put_ = putTypeRep get bh = do TypeRepX rep <- getTypeRepX bh - case rep `eqTypeRep` typeRep of + case rep `eqTypeRep` (typeRep :: TypeRep a) of Just HRefl -> pure rep Nothing -> fail "Binary: Type mismatch" diff --git a/libraries/ghci/GHCi/TH/Binary.hs b/libraries/ghci/GHCi/TH/Binary.hs index b1eaf72..d067e54 100644 --- a/libraries/ghci/GHCi/TH/Binary.hs +++ b/libraries/ghci/GHCi/TH/Binary.hs @@ -14,10 +14,10 @@ import qualified Data.ByteString as B import Control.Monad (when) import Type.Reflection import Type.Reflection.Unsafe +import Data.Kind (Type) #else import Data.Typeable #endif -import GHC.Exts (TYPE, Levity(..)) import GHC.Serialized import qualified Language.Haskell.TH as TH import qualified Language.Haskell.TH.Syntax as TH @@ -94,11 +94,11 @@ getTypeRepX = do tag <- get :: Get Word8 case tag of 0 -> do con <- get :: Get TyCon - TypeRep rep_k <- getTypeRepX - Just HRefl <- pure $ eqTypeRep rep_k (typeRep :: TypeRep (TYPE 'Lifted)) + TypeRepX rep_k <- getTypeRepX + Just HRefl <- pure $ eqTypeRep rep_k (typeRep :: TypeRep Type) pure $ TypeRepX $ mkTrCon con rep_k - 1 -> do TypeRep f <- getTypeRepX - TypeRep x <- getTypeRepX + 1 -> do TypeRepX f <- getTypeRepX + TypeRepX x <- getTypeRepX case typeRepKind f of TRFun arg _ -> do Just HRefl <- pure $ eqTypeRep arg x @@ -109,13 +109,13 @@ instance Typeable a => Binary (TypeRep (a :: k)) where put = putTypeRep get = do TypeRepX rep <- getTypeRepX - case rep `eqTypeRep` typeRef of + case rep `eqTypeRep` (typeRep :: TypeRep a) of Just HRefl -> pure rep Nothing -> fail "Binary: Type mismatch" instance Binary TypeRepX where put (TypeRepX rep) = putTypeRep rep - get = getTypeRep + get = getTypeRepX #else instance Binary TyCon where put tc = put (tyConPackage tc) >> put (tyConModule tc) >> put (tyConName tc) From git at git.haskell.org Wed Apr 13 17:54:39 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Apr 2016 17:54:39 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Implement Data.Typeable.funResultTy (79d404c) Message-ID: <20160413175439.9B72D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/79d404c7934c44b183466d898cb3693eea2df7da/ghc >--------------------------------------------------------------- commit 79d404c7934c44b183466d898cb3693eea2df7da Author: Ben Gamari Date: Tue Mar 15 16:21:58 2016 +0100 Implement Data.Typeable.funResultTy >--------------------------------------------------------------- 79d404c7934c44b183466d898cb3693eea2df7da libraries/base/Data/Typeable.hs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libraries/base/Data/Typeable.hs b/libraries/base/Data/Typeable.hs index 486c5b8..7718cf3 100644 --- a/libraries/base/Data/Typeable.hs +++ b/libraries/base/Data/Typeable.hs @@ -69,6 +69,9 @@ module Data.Typeable , rnfTypeRep , showsTypeRep + -- * Observing type representations + , funResultTy + -- * Type constructors , I.TyCon -- abstract, instance of: Eq, Show, Typeable -- For now don't export Module to avoid name clashes @@ -147,6 +150,18 @@ gcast2 x = fmap (\Refl -> x) (eqT :: Maybe (t :~: t')) typeRepTyCon :: TypeRep -> TyCon typeRepTyCon = I.typeRepXTyCon +-- | Applies a type to a function type. Returns: @Just u@ if the first argument +-- represents a function of type @t -> u@ and the second argument represents a +-- function of type @t at . Otherwise, returns @Nothing at . +funResultTy :: TypeRep -> TypeRep -> Maybe TypeRep +funResultTy (I.TypeRepX f) (I.TypeRepX x) + | Just HRefl <- (I.typeRep :: I.TypeRep Type) `I.eqTypeRep` I.typeRepKind f + , I.TRFun arg res <- f + , Just HRefl <- arg `I.eqTypeRep` x + = Just (I.TypeRepX res) + | otherwise + = Nothing + -- | Force a 'TypeRep' to normal form. rnfTypeRep :: TypeRep -> () rnfTypeRep = I.rnfTypeRepX From git at git.haskell.org Wed Apr 13 17:54:42 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Apr 2016 17:54:42 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Add quick compatibility note (49f625d) Message-ID: <20160413175442.4C18A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/49f625d2f7defcecf6db0a77373e4a6629bc3a08/ghc >--------------------------------------------------------------- commit 49f625d2f7defcecf6db0a77373e4a6629bc3a08 Author: Ben Gamari Date: Fri Mar 11 17:32:13 2016 +0100 Add quick compatibility note >--------------------------------------------------------------- 49f625d2f7defcecf6db0a77373e4a6629bc3a08 libraries/base/Data/Typeable.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libraries/base/Data/Typeable.hs b/libraries/base/Data/Typeable.hs index f33ac48..486c5b8 100644 --- a/libraries/base/Data/Typeable.hs +++ b/libraries/base/Data/Typeable.hs @@ -28,6 +28,11 @@ -- -- == Compatibility Notes -- +-- Since GHC 8.2, GHC has supported type-indexed type representations. +-- "Data.Typeable" provides type representations which are qualified over this +-- index, providing an interface very similar to the "Typeable" notion seen in +-- previous releases. For the type-indexed interface, see "Data.Reflection". +-- -- Since GHC 7.8, 'Typeable' is poly-kinded. The changes required for this might -- break some old programs involving 'Typeable'. More details on this, including -- how to fix your code, can be found on the From git at git.haskell.org Wed Apr 13 17:54:45 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Apr 2016 17:54:45 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: CoreLint: Improve debug output (7db1b47) Message-ID: <20160413175445.039FF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/7db1b4784109a93a8256b3434a3a13148855b123/ghc >--------------------------------------------------------------- commit 7db1b4784109a93a8256b3434a3a13148855b123 Author: Ben Gamari Date: Sun Jan 31 21:35:20 2016 +0100 CoreLint: Improve debug output >--------------------------------------------------------------- 7db1b4784109a93a8256b3434a3a13148855b123 compiler/coreSyn/CoreLint.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/coreSyn/CoreLint.hs b/compiler/coreSyn/CoreLint.hs index 2c401de..472f29f 100644 --- a/compiler/coreSyn/CoreLint.hs +++ b/compiler/coreSyn/CoreLint.hs @@ -816,7 +816,7 @@ lintTyKind tyvar arg_ty -- and then apply it to both boxed and unboxed types. = do { arg_kind <- lintType arg_ty ; unless (arg_kind `eqType` tyvar_kind) - (addErrL (mkKindErrMsg tyvar arg_ty $$ (text "xx" <+> ppr arg_kind))) } + (addErrL (mkKindErrMsg tyvar arg_ty $$ (text "Linted Arg kind:" <+> ppr arg_kind))) } where tyvar_kind = tyVarKind tyvar From git at git.haskell.org Wed Apr 13 17:54:47 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Apr 2016 17:54:47 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Binary: More explicit pattern matching (2f88acc) Message-ID: <20160413175447.DCBED3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/2f88acc723502c0fd858b166ff9f59102bed7171/ghc >--------------------------------------------------------------- commit 2f88acc723502c0fd858b166ff9f59102bed7171 Author: Ben Gamari Date: Wed Mar 16 09:40:54 2016 +0100 Binary: More explicit pattern matching >--------------------------------------------------------------- 2f88acc723502c0fd858b166ff9f59102bed7171 compiler/utils/Binary.hs | 9 ++++++--- libraries/ghci/GHCi/TH/Binary.hs | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/compiler/utils/Binary.hs b/compiler/utils/Binary.hs index fcf9ce7..431b187 100644 --- a/compiler/utils/Binary.hs +++ b/compiler/utils/Binary.hs @@ -601,9 +601,12 @@ getTypeRepX bh = do 1 -> do TypeRepX f <- getTypeRepX bh TypeRepX x <- getTypeRepX bh case typeRepKind f of - TRFun arg _ | Just HRefl <- arg `eqTypeRep` x -> - pure $ TypeRepX $ mkTrApp f x - _ -> fail "getTypeRepX: Kind mismatch" + TRFun arg _ -> + case arg `eqTypeRep` x of + Just HRefl -> + pure $ TypeRepX $ mkTrApp f x + _ -> fail "getTypeRepX: Kind mismatch" + _ -> fail "getTypeRepX: Applied non-arrow type" _ -> fail "Binary: Invalid TypeRepX" instance Typeable a => Binary (TypeRep (a :: k)) where diff --git a/libraries/ghci/GHCi/TH/Binary.hs b/libraries/ghci/GHCi/TH/Binary.hs index 2433057..522cc80 100644 --- a/libraries/ghci/GHCi/TH/Binary.hs +++ b/libraries/ghci/GHCi/TH/Binary.hs @@ -102,9 +102,12 @@ getTypeRepX = do 1 -> do TypeRepX f <- getTypeRepX TypeRepX x <- getTypeRepX case typeRepKind f of - TRFun arg _ | Just HRefl <- arg `eqTypeRep` x -> - pure $ TypeRepX $ mkTrApp f x - _ -> fail "getTypeRepX: Kind mismatch" + TRFun arg _ -> + case arg `eqTypeRep` x of + Just HRefl -> + pure $ TypeRepX $ mkTrApp f x + _ -> fail "getTypeRepX: Kind mismatch" + _ -> fail "getTypeRepX: Applied non-arrow type" _ -> fail "getTypeRepX: Invalid TypeRepX" instance Typeable a => Binary (TypeRep (a :: k)) where From git at git.haskell.org Wed Apr 13 17:54:50 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Apr 2016 17:54:50 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: More serialization (660b13e) Message-ID: <20160413175450.8CB603A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/660b13e29b2f8f668a2e62e4b3c996c12e1e7b29/ghc >--------------------------------------------------------------- commit 660b13e29b2f8f668a2e62e4b3c996c12e1e7b29 Author: Ben Gamari Date: Wed Mar 16 10:33:37 2016 +0100 More serialization >--------------------------------------------------------------- 660b13e29b2f8f668a2e62e4b3c996c12e1e7b29 compiler/utils/Binary.hs | 14 +++++++++----- libraries/base/Data/Typeable.hs | 20 +++++++++++++------- libraries/ghci/GHCi/TH/Binary.hs | 13 ++++++++----- 3 files changed, 30 insertions(+), 17 deletions(-) diff --git a/compiler/utils/Binary.hs b/compiler/utils/Binary.hs index 431b187..2dd2182 100644 --- a/compiler/utils/Binary.hs +++ b/compiler/utils/Binary.hs @@ -587,12 +587,13 @@ putTypeRep bh (TRApp f x) = do put_ bh (1 :: Word8) putTypeRep bh f putTypeRep bh x +putTypeRep _ _ = fail "putTypeRep: Impossible" getTypeRepX :: BinHandle -> IO TypeRepX getTypeRepX bh = do tag <- get bh :: IO Word8 case tag of - 0 -> do con <- get bh + 0 -> do con <- get bh :: IO TyCon TypeRepX rep_k <- getTypeRepX bh case rep_k `eqTypeRep` (typeRep :: TypeRep Type) of Just HRefl -> pure $ TypeRepX $ mkTrCon con rep_k @@ -602,10 +603,13 @@ getTypeRepX bh = do TypeRepX x <- getTypeRepX bh case typeRepKind f of TRFun arg _ -> - case arg `eqTypeRep` x of - Just HRefl -> - pure $ TypeRepX $ mkTrApp f x - _ -> fail "getTypeRepX: Kind mismatch" + case (typeRep :: TypeRep Type) `eqTypeRep` arg of + Just HRefl -> -- FIXME: Generalize (->) + case x `eqTypeRep` arg of + Just HRefl -> + pure $ TypeRepX $ mkTrApp f x + _ -> fail "getTypeRepX: Kind mismatch" + Nothing -> fail "getTypeRepX: Arrow of non-Type argument" _ -> fail "getTypeRepX: Applied non-arrow type" _ -> fail "Binary: Invalid TypeRepX" diff --git a/libraries/base/Data/Typeable.hs b/libraries/base/Data/Typeable.hs index 7718cf3..21f93d2 100644 --- a/libraries/base/Data/Typeable.hs +++ b/libraries/base/Data/Typeable.hs @@ -154,13 +154,19 @@ typeRepTyCon = I.typeRepXTyCon -- represents a function of type @t -> u@ and the second argument represents a -- function of type @t at . Otherwise, returns @Nothing at . funResultTy :: TypeRep -> TypeRep -> Maybe TypeRep -funResultTy (I.TypeRepX f) (I.TypeRepX x) - | Just HRefl <- (I.typeRep :: I.TypeRep Type) `I.eqTypeRep` I.typeRepKind f - , I.TRFun arg res <- f - , Just HRefl <- arg `I.eqTypeRep` x - = Just (I.TypeRepX res) - | otherwise - = Nothing +{- +funResultTy (I.TypeRepX f) (I.TypeRepX x) = + case (I.typeRep :: I.TypeRep Type) `I.eqTypeRep` I.typeRepKind f of + Just HRefl -> + case f of + I.TRFun arg res -> + case arg `I.eqTypeRep` x of + Just HRefl -> Just (I.TypeRepX res) + Nothing -> Nothing + _ -> Nothing + Nothing -> Nothing +-} +funResultTy _ _ = Nothing -- | Force a 'TypeRep' to normal form. rnfTypeRep :: TypeRep -> () diff --git a/libraries/ghci/GHCi/TH/Binary.hs b/libraries/ghci/GHCi/TH/Binary.hs index 522cc80..e0f0ba2 100644 --- a/libraries/ghci/GHCi/TH/Binary.hs +++ b/libraries/ghci/GHCi/TH/Binary.hs @@ -11,7 +11,6 @@ module GHCi.TH.Binary () where import Data.Binary import qualified Data.ByteString as B #if MIN_VERSION_base(4,9,0) -import Control.Monad (when) import Type.Reflection import Type.Reflection.Unsafe import Data.Kind (Type) @@ -88,6 +87,7 @@ putTypeRep (TRApp f x) = do put (1 :: Word8) putTypeRep f putTypeRep x +putTypeRep _ = fail "putTypeRep: Impossible" getTypeRepX :: Get TypeRepX getTypeRepX = do @@ -103,10 +103,13 @@ getTypeRepX = do TypeRepX x <- getTypeRepX case typeRepKind f of TRFun arg _ -> - case arg `eqTypeRep` x of - Just HRefl -> - pure $ TypeRepX $ mkTrApp f x - _ -> fail "getTypeRepX: Kind mismatch" + case (typeRep :: TypeRep Type) `eqTypeRep` arg of + Just HRefl -> -- FIXME: Generalize (->) + case arg `eqTypeRep` x of + Just HRefl -> + pure $ TypeRepX $ mkTrApp f x + _ -> fail "getTypeRepX: Kind mismatch" + _ -> fail "getTypeRepX: Arrow of non-Type argument" _ -> fail "getTypeRepX: Applied non-arrow type" _ -> fail "getTypeRepX: Invalid TypeRepX" From git at git.haskell.org Wed Apr 13 17:54:53 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Apr 2016 17:54:53 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Message: Import Data.Typeable.TypeRep (6e9eaff) Message-ID: <20160413175453.375823A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/6e9eaffe919ea16c1be2685f499994c2e5c354ce/ghc >--------------------------------------------------------------- commit 6e9eaffe919ea16c1be2685f499994c2e5c354ce Author: Ben Gamari Date: Wed Mar 16 10:35:59 2016 +0100 Message: Import Data.Typeable.TypeRep >--------------------------------------------------------------- 6e9eaffe919ea16c1be2685f499994c2e5c354ce libraries/ghci/GHCi/Message.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libraries/ghci/GHCi/Message.hs b/libraries/ghci/GHCi/Message.hs index b8f9fcc..4bc8d2c 100644 --- a/libraries/ghci/GHCi/Message.hs +++ b/libraries/ghci/GHCi/Message.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE GADTs, DeriveGeneric, StandaloneDeriving, +{-# LANGUAGE GADTs, DeriveGeneric, StandaloneDeriving, CPP, GeneralizedNewtypeDeriving, ExistentialQuantification, RecordWildCards #-} {-# OPTIONS_GHC -fno-warn-name-shadowing -fno-warn-orphans #-} @@ -29,6 +29,10 @@ import Data.ByteString (ByteString) import qualified Data.ByteString as B import qualified Data.ByteString.Lazy as LB import Data.Dynamic +#if MIN_VERSION_base(4,9,0) +-- Previously this was re-exported by Data.Dynamic +import Data.Typeable (TypeRep) +#endif import Data.IORef import Data.Map (Map) import GHC.Generics From git at git.haskell.org Wed Apr 13 17:54:55 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Apr 2016 17:54:55 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: TcInteract: Unused parameter (d3cc620) Message-ID: <20160413175455.E01043A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/d3cc6209358aa1dfe1b5cc0e5f9f36662279e459/ghc >--------------------------------------------------------------- commit d3cc6209358aa1dfe1b5cc0e5f9f36662279e459 Author: Ben Gamari Date: Wed Mar 16 11:04:54 2016 +0100 TcInteract: Unused parameter >--------------------------------------------------------------- d3cc6209358aa1dfe1b5cc0e5f9f36662279e459 compiler/typecheck/TcInteract.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/typecheck/TcInteract.hs b/compiler/typecheck/TcInteract.hs index d98a748..e93f303 100644 --- a/compiler/typecheck/TcInteract.hs +++ b/compiler/typecheck/TcInteract.hs @@ -2002,7 +2002,7 @@ matchTypeable clas [k,t] -- clas = Typeable | t `eqType` liftedTypeKind = doPrimRep trTYPE'PtrRepLiftedName t | t `eqType` runtimeRepTy = doPrimRep trRuntimeRepName t | Just (tc, ks) <- splitTyConApp_maybe t -- See Note [Typeable (T a b c)] - , onlyNamedBndrsApplied tc ks = doTyConApp clas t tc ks + , onlyNamedBndrsApplied tc ks = doTyConApp clas t tc | Just (arg,ret) <- splitFunTy_maybe t = doFunTy clas t arg ret | Just (f,kt) <- splitAppTy_maybe t = doTyApp clas t f kt @@ -2037,8 +2037,8 @@ doPrimRep rep_name ty -- kind variables have been instantiated). -- -- TODO: Do we want to encode the applied kinds in the representation? -doTyConApp :: Class -> Type -> TyCon -> [Kind] -> TcS LookupInstResult -doTyConApp clas ty tc ks +doTyConApp :: Class -> Type -> TyCon -> TcS LookupInstResult +doTyConApp clas ty tc = return $ GenInst [mk_typeable_pred clas $ typeKind ty] (\[ev] -> EvTypeable ty $ EvTypeableTyCon tc ev) True From git at git.haskell.org Wed Apr 13 17:54:58 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Apr 2016 17:54:58 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Fix nofib submodule (fda1534) Message-ID: <20160413175458.8C9753A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/fda1534def248e9ab6c831133e727ce634c23205/ghc >--------------------------------------------------------------- commit fda1534def248e9ab6c831133e727ce634c23205 Author: Ben Gamari Date: Wed Mar 16 11:07:27 2016 +0100 Fix nofib submodule >--------------------------------------------------------------- fda1534def248e9ab6c831133e727ce634c23205 nofib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nofib b/nofib index ebec858..a82ea5f 160000 --- a/nofib +++ b/nofib @@ -1 +1 @@ -Subproject commit ebec858a920200692bda55fa5fc4a266c2661f68 +Subproject commit a82ea5f29607275b56bc03fc1747734af1cae575 From git at git.haskell.org Wed Apr 13 17:55:01 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Apr 2016 17:55:01 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Update deepseq submodule (be0471d) Message-ID: <20160413175501.3EC693A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/be0471d07cd02cac06793043163e73f2d9bc88d1/ghc >--------------------------------------------------------------- commit be0471d07cd02cac06793043163e73f2d9bc88d1 Author: Ben Gamari Date: Wed Mar 16 11:26:25 2016 +0100 Update deepseq submodule >--------------------------------------------------------------- be0471d07cd02cac06793043163e73f2d9bc88d1 libraries/deepseq | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/deepseq b/libraries/deepseq index 40d4db0..c3a0a16 160000 --- a/libraries/deepseq +++ b/libraries/deepseq @@ -1 +1 @@ -Subproject commit 40d4db0a4e81a07ecd0f1bc77b8772088e75e478 +Subproject commit c3a0a16f17e593cb6a64b01a22015497738bfed6 From git at git.haskell.org Wed Apr 13 17:55:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Apr 2016 17:55:03 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Render type equality more readably (90ad65d) Message-ID: <20160413175503.DE6C33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/90ad65d3c487d6e7c6f6303b0487ce4caa8eae9b/ghc >--------------------------------------------------------------- commit 90ad65d3c487d6e7c6f6303b0487ce4caa8eae9b Author: Ben Gamari Date: Wed Mar 16 11:37:27 2016 +0100 Render type equality more readably >--------------------------------------------------------------- 90ad65d3c487d6e7c6f6303b0487ce4caa8eae9b compiler/types/TyCoRep.hs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/compiler/types/TyCoRep.hs b/compiler/types/TyCoRep.hs index fa123a0..86d236c 100644 --- a/compiler/types/TyCoRep.hs +++ b/compiler/types/TyCoRep.hs @@ -2801,6 +2801,19 @@ pprTcApp_help to_type p pp tc tys dflags style -- we know nothing of precedence though = pprInfixApp p pp pp_tc ty1 ty2 + -- Handle equalities specifically + | is_het_equality + , [k1,k2,ty1,ty2] <- map to_type tys_wo_kinds + = parens (pprType ty1 <+> dcolon <+> pprKind k1) + <+> text "~~" + <+> parens (pprType ty2 <+> dcolon <+> pprKind k2) + + | is_equality + , [k,ty1,ty2] <- map to_type tys_wo_kinds + = parens (pprType ty1 <+> dcolon <+> pprKind k) + <+> text "~" + <+> parens (pprType ty2 <+> dcolon <+> pprKind k) + | tc_name `hasKey` starKindTyConKey || tc_name `hasKey` unicodeStarKindTyConKey || tc_name `hasKey` unliftedTypeKindTyConKey @@ -2810,12 +2823,14 @@ pprTcApp_help to_type p pp tc tys dflags style = pprPrefixApp p (parens pp_tc) (map (pp TyConPrec) tys_wo_kinds) where tc_name = tyConName tc + is_het_equality = tc `hasKey` heqTyConKey + is_equality = tc `hasKey` eqPrimTyConKey || is_het_equality -- With the solver working in unlifted equality, it will want to -- to print unlifted equality constraints sometimes. But these are -- confusing to users. So fix them up here. (print_prefix, pp_tc) - | (tc `hasKey` eqPrimTyConKey || tc `hasKey` heqTyConKey) && not print_eqs + | is_equality && not print_eqs = (False, text "~") | tc `hasKey` eqReprPrimTyConKey && not print_eqs = (True, text "Coercible") From git at git.haskell.org Wed Apr 13 17:55:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Apr 2016 17:55:06 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Fix a few TTypeRep references (f508c88) Message-ID: <20160413175506.A349A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/f508c8821c4997a8dda2460c07a23e8c5efc9504/ghc >--------------------------------------------------------------- commit f508c8821c4997a8dda2460c07a23e8c5efc9504 Author: Ben Gamari Date: Wed Mar 16 11:51:00 2016 +0100 Fix a few TTypeRep references >--------------------------------------------------------------- f508c8821c4997a8dda2460c07a23e8c5efc9504 compiler/deSugar/DsBinds.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/compiler/deSugar/DsBinds.hs b/compiler/deSugar/DsBinds.hs index 2943b2b..a41bb27 100644 --- a/compiler/deSugar/DsBinds.hs +++ b/compiler/deSugar/DsBinds.hs @@ -1119,10 +1119,10 @@ type TypeRepExpr = CoreExpr ds_ev_typeable :: Type -> EvTypeable -> DsM CoreExpr ds_ev_typeable ty (EvTypeableTyCon tc kind_ev) = do { mkTrCon <- dsLookupGlobalId mkTrConName - -- mkTrCon :: forall k (a :: k). TyCon -> TTypeRep k -> TTypeRep a + -- mkTrCon :: forall k (a :: k). TyCon -> TypeRep k -> TypeRep a ; tc_rep <- tyConRep tc -- :: TyCon - ; kind_rep <- getRep kind_ev (typeKind ty) -- :: TTypeRep k + ; kind_rep <- getRep kind_ev (typeKind ty) -- :: TypeRep k -- Note that we use the kind of the type, not the TyCon from which it is -- constructed since the latter may be kind polymorphic whereas the @@ -1153,8 +1153,8 @@ ds_ev_typeable ty (EvTypeableTyLit ev) ty_kind = typeKind ty -- tr_fun is the Name of - -- typeNatTypeRep :: KnownNat a => Proxy# a -> TTypeRep a - -- of typeSymbolTypeRep :: KnownSymbol a => Proxy# a -> TTypeRep a + -- typeNatTypeRep :: KnownNat a => Proxy# a -> TypeRep a + -- of typeSymbolTypeRep :: KnownSymbol a => Proxy# a -> TypeRep a tr_fun | ty_kind `eqType` typeNatKind = typeNatTypeRepName | ty_kind `eqType` typeSymbolKind = typeSymbolTypeRepName | otherwise = panic "dsEvTypeable: unknown type lit kind" @@ -1168,10 +1168,10 @@ ds_ev_typeable ty ev getRep :: EvTerm -- ^ EvTerm for @Typeable ty@ -> Type -- ^ The type @ty@ - -> DsM TypeRepExpr -- ^ Return @CoreExpr :: TTypeRep ty@ + -> DsM TypeRepExpr -- ^ Return @CoreExpr :: TypeRep ty@ -- namely @typeRep# dict@ -- Remember that --- typeRep# :: forall k (a::k). Typeable k a -> TTypeRep a +-- typeRep# :: forall k (a::k). Typeable k a -> TypeRep a getRep ev ty = do { typeable_expr <- dsEvTerm ev ; typeRepId <- dsLookupGlobalId typeRepIdName From git at git.haskell.org Wed Apr 13 17:55:09 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Apr 2016 17:55:09 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Bump haskeline submodule (b848d6d) Message-ID: <20160413175509.520BB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/b848d6d9dce6e0dc438ba077b9f1b15af0dfd069/ghc >--------------------------------------------------------------- commit b848d6d9dce6e0dc438ba077b9f1b15af0dfd069 Author: Ben Gamari Date: Wed Mar 16 11:51:10 2016 +0100 Bump haskeline submodule >--------------------------------------------------------------- b848d6d9dce6e0dc438ba077b9f1b15af0dfd069 libraries/haskeline | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/haskeline b/libraries/haskeline index 5e53651..8dd9e8b 160000 --- a/libraries/haskeline +++ b/libraries/haskeline @@ -1 +1 @@ -Subproject commit 5e53651b2683f31bf5efc842c33f07afc05ec287 +Subproject commit 8dd9e8be13b364048f57cc276be6ad5fb66fad21 From git at git.haskell.org Wed Apr 13 17:55:11 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Apr 2016 17:55:11 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Finally serialization is both general and correct (485cd9e) Message-ID: <20160413175511.F1EFB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/485cd9ea33d449ee16afea3ec986c2188b263532/ghc >--------------------------------------------------------------- commit 485cd9ea33d449ee16afea3ec986c2188b263532 Author: Ben Gamari Date: Wed Mar 16 12:16:20 2016 +0100 Finally serialization is both general and correct >--------------------------------------------------------------- 485cd9ea33d449ee16afea3ec986c2188b263532 compiler/utils/Binary.hs | 13 +++++-------- libraries/ghci/GHCi/TH/Binary.hs | 11 ++++------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/compiler/utils/Binary.hs b/compiler/utils/Binary.hs index 2dd2182..a346e0d 100644 --- a/compiler/utils/Binary.hs +++ b/compiler/utils/Binary.hs @@ -603,15 +603,12 @@ getTypeRepX bh = do TypeRepX x <- getTypeRepX bh case typeRepKind f of TRFun arg _ -> - case (typeRep :: TypeRep Type) `eqTypeRep` arg of - Just HRefl -> -- FIXME: Generalize (->) - case x `eqTypeRep` arg of - Just HRefl -> - pure $ TypeRepX $ mkTrApp f x - _ -> fail "getTypeRepX: Kind mismatch" - Nothing -> fail "getTypeRepX: Arrow of non-Type argument" + case arg `eqTypeRep` typeRepKind x of + Just HRefl -> + pure $ TypeRepX $ mkTrApp f x + _ -> fail "getTypeRepX: Kind mismatch" _ -> fail "getTypeRepX: Applied non-arrow type" - _ -> fail "Binary: Invalid TypeRepX" + _ -> fail "getTypeRepX: Invalid TypeRepX" instance Typeable a => Binary (TypeRep (a :: k)) where put_ = putTypeRep diff --git a/libraries/ghci/GHCi/TH/Binary.hs b/libraries/ghci/GHCi/TH/Binary.hs index e0f0ba2..2f41645 100644 --- a/libraries/ghci/GHCi/TH/Binary.hs +++ b/libraries/ghci/GHCi/TH/Binary.hs @@ -103,13 +103,10 @@ getTypeRepX = do TypeRepX x <- getTypeRepX case typeRepKind f of TRFun arg _ -> - case (typeRep :: TypeRep Type) `eqTypeRep` arg of - Just HRefl -> -- FIXME: Generalize (->) - case arg `eqTypeRep` x of - Just HRefl -> - pure $ TypeRepX $ mkTrApp f x - _ -> fail "getTypeRepX: Kind mismatch" - _ -> fail "getTypeRepX: Arrow of non-Type argument" + case arg `eqTypeRep` typeRepKind x of + Just HRefl -> + pure $ TypeRepX $ mkTrApp f x + _ -> fail "getTypeRepX: Kind mismatch" _ -> fail "getTypeRepX: Applied non-arrow type" _ -> fail "getTypeRepX: Invalid TypeRepX" From git at git.haskell.org Wed Apr 13 17:55:14 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Apr 2016 17:55:14 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Fix recursive fingerprints (06ede7f) Message-ID: <20160413175514.99D1F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/06ede7f4ce148fdda5ec5f8a24f8f7f5ca3fa7cd/ghc >--------------------------------------------------------------- commit 06ede7f4ce148fdda5ec5f8a24f8f7f5ca3fa7cd Author: Ben Gamari Date: Wed Mar 16 11:53:01 2016 +0100 Fix recursive fingerprints >--------------------------------------------------------------- 06ede7f4ce148fdda5ec5f8a24f8f7f5ca3fa7cd libraries/base/Data/Typeable/Internal.hs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/libraries/base/Data/Typeable/Internal.hs b/libraries/base/Data/Typeable/Internal.hs index 7a3344e..bb2bcc2 100644 --- a/libraries/base/Data/Typeable/Internal.hs +++ b/libraries/base/Data/Typeable/Internal.hs @@ -429,11 +429,20 @@ For this reason we are forced to define their representations manually. -} +-- | We can't use 'mkTrCon' here as it requires the fingerprint of the kind +-- which is knot-tied. +mkPrimTrCon :: forall k (a :: k). TyCon -> TypeRep k -> TypeRep a +mkPrimTrCon tc kind = TrTyCon fpr tc kind + where + fpr_tc = tyConFingerprint tc + fpr_tag = fingerprintString "prim" + fpr = fingerprintFingerprints [fpr_tag, fpr_tc] + mkPrimTyCon :: String -> TyCon mkPrimTyCon = mkTyCon "ghc-prim" "GHC.Prim" trTYPE :: TypeRep TYPE -trTYPE = mkTrCon (mkPrimTyCon "TYPE") runtimeRep_arr_type +trTYPE = mkPrimTrCon (mkPrimTyCon "TYPE") runtimeRep_arr_type where runtimeRep_arr :: TypeRep ((->) RuntimeRep) runtimeRep_arr = mkTrApp trArrow trRuntimeRep @@ -442,10 +451,10 @@ trTYPE = mkTrCon (mkPrimTyCon "TYPE") runtimeRep_arr_type runtimeRep_arr_type = mkTrApp runtimeRep_arr star trRuntimeRep :: TypeRep RuntimeRep -trRuntimeRep = mkTrCon (mkPrimTyCon "RuntimeRep") star +trRuntimeRep = mkPrimTrCon (mkPrimTyCon "RuntimeRep") star tr'PtrRepLifted :: TypeRep 'PtrRepLifted -tr'PtrRepLifted = mkTrCon (mkPrimTyCon "'PtrRepLifted") trRuntimeRep +tr'PtrRepLifted = mkPrimTrCon (mkPrimTyCon "'PtrRepLifted") trRuntimeRep trTYPE'PtrRepLifted :: TypeRep (TYPE 'PtrRepLifted) trTYPE'PtrRepLifted = mkTrApp trTYPE tr'PtrRepLifted @@ -454,7 +463,7 @@ trArrowTyCon :: TyCon trArrowTyCon = mkPrimTyCon "->" trArrow :: TypeRep (->) -trArrow = mkTrCon trArrowTyCon star_arr_star_arr_star +trArrow = mkPrimTrCon trArrowTyCon star_arr_star_arr_star -- Some useful aliases star :: TypeRep (TYPE 'PtrRepLifted) From git at git.haskell.org Wed Apr 13 17:55:17 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Apr 2016 17:55:17 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Break recursive loop in serialization (228dbdb) Message-ID: <20160413175517.3FC7A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/228dbdb9a7b6d454fe92d4861299c936f265f0ef/ghc >--------------------------------------------------------------- commit 228dbdb9a7b6d454fe92d4861299c936f265f0ef Author: Ben Gamari Date: Wed Mar 16 13:01:45 2016 +0100 Break recursive loop in serialization >--------------------------------------------------------------- 228dbdb9a7b6d454fe92d4861299c936f265f0ef compiler/utils/Binary.hs | 18 ++++++++++++++---- libraries/ghci/GHCi/TH/Binary.hs | 18 ++++++++++++++---- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/compiler/utils/Binary.hs b/compiler/utils/Binary.hs index a346e0d..b26778e 100644 --- a/compiler/utils/Binary.hs +++ b/compiler/utils/Binary.hs @@ -82,6 +82,7 @@ import Data.Time import Type.Reflection import Type.Reflection.Unsafe import Data.Kind (Type) +import GHC.Exts (RuntimeRep) #else import Data.Typeable #endif @@ -579,12 +580,19 @@ instance Binary TyCon where #if MIN_VERSION_base(4,9,0) putTypeRep :: BinHandle -> TypeRep a -> IO () +-- Special handling for Type and RuntimeRep due to recursive kind relations. +-- See Note [Mutually recursive representations of primitive types] +putTypeRep bh rep + | Just HRefl <- rep `eqTypeRep` (typeRep :: TypeRep Type) + = put_ bh (0 :: Word8) + | Just HRefl <- rep `eqTypeRep` (typeRep :: TypeRep RuntimeRep) + = put_ bh (1 :: Word8) putTypeRep bh rep@(TRCon con) = do - put_ bh (0 :: Word8) + put_ bh (2 :: Word8) put_ bh con putTypeRep bh (typeRepKind rep) putTypeRep bh (TRApp f x) = do - put_ bh (1 :: Word8) + put_ bh (3 :: Word8) putTypeRep bh f putTypeRep bh x putTypeRep _ _ = fail "putTypeRep: Impossible" @@ -593,13 +601,15 @@ getTypeRepX :: BinHandle -> IO TypeRepX getTypeRepX bh = do tag <- get bh :: IO Word8 case tag of - 0 -> do con <- get bh :: IO TyCon + 0 -> return $ TypeRepX (typeRep :: TypeRep Type) + 1 -> return $ TypeRepX (typeRep :: TypeRep RuntimeRep) + 2 -> do con <- get bh :: IO TyCon TypeRepX rep_k <- getTypeRepX bh case rep_k `eqTypeRep` (typeRep :: TypeRep Type) of Just HRefl -> pure $ TypeRepX $ mkTrCon con rep_k Nothing -> fail "getTypeRepX: Kind mismatch" - 1 -> do TypeRepX f <- getTypeRepX bh + 3 -> do TypeRepX f <- getTypeRepX bh TypeRepX x <- getTypeRepX bh case typeRepKind f of TRFun arg _ -> diff --git a/libraries/ghci/GHCi/TH/Binary.hs b/libraries/ghci/GHCi/TH/Binary.hs index 2f41645..fcd81d3 100644 --- a/libraries/ghci/GHCi/TH/Binary.hs +++ b/libraries/ghci/GHCi/TH/Binary.hs @@ -14,6 +14,7 @@ import qualified Data.ByteString as B import Type.Reflection import Type.Reflection.Unsafe import Data.Kind (Type) +import GHC.Exts (RuntimeRep) #else import Data.Typeable #endif @@ -79,12 +80,19 @@ instance Binary TyCon where get = mkTyCon <$> get <*> get <*> get putTypeRep :: TypeRep a -> Put +-- Special handling for Type and RuntimeRep due to recursive kind relations. +-- See Note [Mutually recursive representations of primitive types] +putTypeRep rep + | Just HRefl <- rep `eqTypeRep` (typeRep :: TypeRep Type) + = put (0 :: Word8) + | Just HRefl <- rep `eqTypeRep` (typeRep :: TypeRep RuntimeRep) + = put (1 :: Word8) putTypeRep rep@(TRCon con) = do - put (0 :: Word8) + put (2 :: Word8) put con putTypeRep (typeRepKind rep) putTypeRep (TRApp f x) = do - put (1 :: Word8) + put (3 :: Word8) putTypeRep f putTypeRep x putTypeRep _ = fail "putTypeRep: Impossible" @@ -93,13 +101,15 @@ getTypeRepX :: Get TypeRepX getTypeRepX = do tag <- get :: Get Word8 case tag of - 0 -> do con <- get :: Get TyCon + 0 -> return $ TypeRepX (typeRep :: TypeRep Type) + 1 -> return $ TypeRepX (typeRep :: TypeRep RuntimeRep) + 2 -> do con <- get :: Get TyCon TypeRepX rep_k <- getTypeRepX case rep_k `eqTypeRep` (typeRep :: TypeRep Type) of Just HRefl -> pure $ TypeRepX $ mkTrCon con rep_k Nothing -> fail "getTypeRepX: Kind mismatch" - 1 -> do TypeRepX f <- getTypeRepX + 3 -> do TypeRepX f <- getTypeRepX TypeRepX x <- getTypeRepX case typeRepKind f of TRFun arg _ -> From git at git.haskell.org Wed Apr 13 17:55:19 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Apr 2016 17:55:19 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Kill todo (8700769) Message-ID: <20160413175519.D80333A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/8700769c923c5fdde510b4598c4751b1b0cd9cd0/ghc >--------------------------------------------------------------- commit 8700769c923c5fdde510b4598c4751b1b0cd9cd0 Author: Ben Gamari Date: Wed Mar 16 13:36:24 2016 +0100 Kill todo >--------------------------------------------------------------- 8700769c923c5fdde510b4598c4751b1b0cd9cd0 libraries/base/Data/Typeable/Internal.hs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libraries/base/Data/Typeable/Internal.hs b/libraries/base/Data/Typeable/Internal.hs index bb2bcc2..2252634 100644 --- a/libraries/base/Data/Typeable/Internal.hs +++ b/libraries/base/Data/Typeable/Internal.hs @@ -261,8 +261,7 @@ typeRepKind (TrTyCon _ _ k) = k typeRepKind (TrApp _ f _) = case typeRepKind f of TRFun _arg res -> res - -- TODO: why is this case needed? - _ -> error "typeRepKind: impossible" + _ -> error "typeRepKind: impossible" -- | Observe the type constructor of a quantified type representation. typeRepXTyCon :: TypeRepX -> TyCon From git at git.haskell.org Wed Apr 13 17:55:22 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Apr 2016 17:55:22 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Fix up representation pretty-printer (a604ce9) Message-ID: <20160413175522.7D8CB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/a604ce9471cec93050929fa0a34df10cb936fe29/ghc >--------------------------------------------------------------- commit a604ce9471cec93050929fa0a34df10cb936fe29 Author: Ben Gamari Date: Wed Mar 16 13:36:30 2016 +0100 Fix up representation pretty-printer >--------------------------------------------------------------- a604ce9471cec93050929fa0a34df10cb936fe29 libraries/base/Data/Typeable/Internal.hs | 44 +++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/libraries/base/Data/Typeable/Internal.hs b/libraries/base/Data/Typeable/Internal.hs index 2252634..3b84aba 100644 --- a/libraries/base/Data/Typeable/Internal.hs +++ b/libraries/base/Data/Typeable/Internal.hs @@ -317,28 +317,48 @@ typeRepXFingerprint (TypeRepX t) = typeRepFingerprint t ----------------- Showing TypeReps -------------------- -instance Show (TypeRep a) where +instance Show (TypeRep (a :: k)) where + showsPrec _ rep + | isListTyCon tc, [ty] <- tys = + showChar '[' . shows ty . showChar ']' + | isTupleTyCon tc = + showChar '(' . showArgs (showChar ',') tys . showChar ')' + where (tc, tys) = splitApps rep showsPrec p (TrTyCon _ tycon _) = showsPrec p tycon - showsPrec p (TrApp _ f x) = showsPrec p f . showString " " . showsPrec p x - -- TODO: Reconsider precedence + showsPrec p (TrApp _ f x) + | Just HRefl <- f `eqTypeRep` (typeRep :: TypeRep (->)) = + shows x . showString " -> " + | otherwise = + showsPrec p f . space . showParen need_parens (showsPrec 10 x) + where + space = showChar ' ' + need_parens = case x of + TrApp {} -> True + TrTyCon {} -> False instance Show TypeRepX where showsPrec p (TypeRepX ty) = showsPrec p ty --- Some (Show.TypeRepX) helpers: -{- --- FIXME: Handle tuples, etc. +splitApps :: TypeRep a -> (TyCon, [TypeRepX]) +splitApps = go [] + where + go :: [TypeRepX] -> TypeRep a -> (TyCon, [TypeRepX]) + go xs (TrTyCon _ tc _) = (tc, xs) + go xs (TrApp _ f x) = go (TypeRepX x : xs) f + +isListTyCon :: TyCon -> Bool +isListTyCon tc = tc == typeRepTyCon (typeRep :: TypeRep [Int]) + +isTupleTyCon :: TyCon -> Bool +isTupleTyCon tc + | ('(':',':_) <- tyConName tc = True + | otherwise = False + showArgs :: Show a => ShowS -> [a] -> ShowS showArgs _ [] = id showArgs _ [a] = showsPrec 10 a showArgs sep (a:as) = showsPrec 10 a . sep . showArgs sep as -showTuple :: [TypeRepX] -> ShowS -showTuple args = showChar '(' - . showArgs (showChar ',') args - . showChar ')' --} - -- | Helper to fully evaluate 'TypeRep' for use as @NFData(rnf)@ implementation -- -- @since TODO From git at git.haskell.org Wed Apr 13 17:55:25 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Apr 2016 17:55:25 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Another recursive serialization case (9453c38) Message-ID: <20160413175525.2DE143A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/9453c38a9b71312190d4c63baf95c7d08e124042/ghc >--------------------------------------------------------------- commit 9453c38a9b71312190d4c63baf95c7d08e124042 Author: Ben Gamari Date: Wed Mar 16 14:05:43 2016 +0100 Another recursive serialization case >--------------------------------------------------------------- 9453c38a9b71312190d4c63baf95c7d08e124042 compiler/utils/Binary.hs | 14 +++++++++----- libraries/ghci/GHCi/TH/Binary.hs | 14 +++++++++----- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/compiler/utils/Binary.hs b/compiler/utils/Binary.hs index b26778e..879a67f 100644 --- a/compiler/utils/Binary.hs +++ b/compiler/utils/Binary.hs @@ -580,19 +580,22 @@ instance Binary TyCon where #if MIN_VERSION_base(4,9,0) putTypeRep :: BinHandle -> TypeRep a -> IO () --- Special handling for Type and RuntimeRep due to recursive kind relations. +-- Special handling for Type, (->), and RuntimeRep due to recursive kind +-- relations. -- See Note [Mutually recursive representations of primitive types] putTypeRep bh rep | Just HRefl <- rep `eqTypeRep` (typeRep :: TypeRep Type) = put_ bh (0 :: Word8) | Just HRefl <- rep `eqTypeRep` (typeRep :: TypeRep RuntimeRep) = put_ bh (1 :: Word8) + | Just HRefl <- rep `eqTypeRep` (typeRep :: TypeRep (->)) + = put_ bh (2 :: Word8) putTypeRep bh rep@(TRCon con) = do - put_ bh (2 :: Word8) + put_ bh (3 :: Word8) put_ bh con putTypeRep bh (typeRepKind rep) putTypeRep bh (TRApp f x) = do - put_ bh (3 :: Word8) + put_ bh (4 :: Word8) putTypeRep bh f putTypeRep bh x putTypeRep _ _ = fail "putTypeRep: Impossible" @@ -603,13 +606,14 @@ getTypeRepX bh = do case tag of 0 -> return $ TypeRepX (typeRep :: TypeRep Type) 1 -> return $ TypeRepX (typeRep :: TypeRep RuntimeRep) - 2 -> do con <- get bh :: IO TyCon + 2 -> return $ TypeRepX (typeRep :: TypeRep (->)) + 3 -> do con <- get bh :: IO TyCon TypeRepX rep_k <- getTypeRepX bh case rep_k `eqTypeRep` (typeRep :: TypeRep Type) of Just HRefl -> pure $ TypeRepX $ mkTrCon con rep_k Nothing -> fail "getTypeRepX: Kind mismatch" - 3 -> do TypeRepX f <- getTypeRepX bh + 4 -> do TypeRepX f <- getTypeRepX bh TypeRepX x <- getTypeRepX bh case typeRepKind f of TRFun arg _ -> diff --git a/libraries/ghci/GHCi/TH/Binary.hs b/libraries/ghci/GHCi/TH/Binary.hs index fcd81d3..e1782f9 100644 --- a/libraries/ghci/GHCi/TH/Binary.hs +++ b/libraries/ghci/GHCi/TH/Binary.hs @@ -80,19 +80,22 @@ instance Binary TyCon where get = mkTyCon <$> get <*> get <*> get putTypeRep :: TypeRep a -> Put --- Special handling for Type and RuntimeRep due to recursive kind relations. +-- Special handling for Type, (->), and RuntimeRep due to recursive kind +-- relations. -- See Note [Mutually recursive representations of primitive types] putTypeRep rep | Just HRefl <- rep `eqTypeRep` (typeRep :: TypeRep Type) = put (0 :: Word8) | Just HRefl <- rep `eqTypeRep` (typeRep :: TypeRep RuntimeRep) = put (1 :: Word8) + | Just HRefl <- rep `eqTypeRep` (typeRep :: TypeRep (->)) + = put (2 :: Word8) putTypeRep rep@(TRCon con) = do - put (2 :: Word8) + put (3 :: Word8) put con putTypeRep (typeRepKind rep) putTypeRep (TRApp f x) = do - put (3 :: Word8) + put (4 :: Word8) putTypeRep f putTypeRep x putTypeRep _ = fail "putTypeRep: Impossible" @@ -103,13 +106,14 @@ getTypeRepX = do case tag of 0 -> return $ TypeRepX (typeRep :: TypeRep Type) 1 -> return $ TypeRepX (typeRep :: TypeRep RuntimeRep) - 2 -> do con <- get :: Get TyCon + 2 -> return $ TypeRepX (typeRep :: TypeRep (->)) + 3 -> do con <- get :: Get TyCon TypeRepX rep_k <- getTypeRepX case rep_k `eqTypeRep` (typeRep :: TypeRep Type) of Just HRefl -> pure $ TypeRepX $ mkTrCon con rep_k Nothing -> fail "getTypeRepX: Kind mismatch" - 3 -> do TypeRepX f <- getTypeRepX + 4 -> do TypeRepX f <- getTypeRepX TypeRepX x <- getTypeRepX case typeRepKind f of TRFun arg _ -> From git at git.haskell.org Wed Apr 13 17:55:27 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Apr 2016 17:55:27 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: TcTypeable: Don't generate bindings for special primitive tycons (5812687) Message-ID: <20160413175527.CC42C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/5812687c24fe95ed524ab53f750e9af9189c6ad6/ghc >--------------------------------------------------------------- commit 5812687c24fe95ed524ab53f750e9af9189c6ad6 Author: Ben Gamari Date: Wed Mar 16 15:34:03 2016 +0100 TcTypeable: Don't generate bindings for special primitive tycons >--------------------------------------------------------------- 5812687c24fe95ed524ab53f750e9af9189c6ad6 compiler/typecheck/TcTypeable.hs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/compiler/typecheck/TcTypeable.hs b/compiler/typecheck/TcTypeable.hs index 3b380f7..b59489d 100644 --- a/compiler/typecheck/TcTypeable.hs +++ b/compiler/typecheck/TcTypeable.hs @@ -13,7 +13,8 @@ import IfaceEnv( newGlobalBinder ) import TcEnv import TcRnMonad import PrelNames -import TysPrim ( primTyCons ) +import TysPrim ( primTyCons, tYPETyConName, funTyConName ) +import TysWiredIn ( runtimeRepTyCon ) import Id import Type import TyCon @@ -21,6 +22,7 @@ import DataCon import Name( getOccName ) import OccName import Module +import NameSet import HsSyn import DynFlags import Bag @@ -164,6 +166,17 @@ mkTypeableTyConBinds tycons ; gbl_env <- tcExtendGlobalValEnv tycon_rep_ids getGblEnv ; return (gbl_env `addTypecheckedBinds` tc_binds) } +-- | The names of the 'TyCon's which we handle explicitly in "Data.Typeable.Internal" +-- and should not generate bindings for in "GHC.Types". +-- +-- See Note [Mutually recursive representations of primitive types] +specialPrimTyCons :: NameSet +specialPrimTyCons = mkNameSet + [ tYPETyConName + , tyConName runtimeRepTyCon + , funTyConName + ] + -- | Generate bindings for the type representation of a wired-in TyCon defined -- by the virtual "GHC.Prim" module. This is where we inject the representation -- bindings for primitive types into "GHC.Types" @@ -207,7 +220,9 @@ ghcPrimTypeableBinds stuff where all_prim_tys :: [TyCon] all_prim_tys = [ tc' | tc <- funTyCon : primTyCons - , tc' <- tc : tyConATs tc ] + , tc' <- tc : tyConATs tc + , not $ tyConName tc' `elemNameSet` specialPrimTyCons + ] mkBind :: TyCon -> LHsBinds Id mkBind = mk_typeable_binds stuff From git at git.haskell.org Wed Apr 13 17:55:30 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Apr 2016 17:55:30 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Move special tycons (0a6cd5b) Message-ID: <20160413175530.7CB513A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/0a6cd5b1a58c8222b970d3efc222f97ce748be09/ghc >--------------------------------------------------------------- commit 0a6cd5b1a58c8222b970d3efc222f97ce748be09 Author: Ben Gamari Date: Wed Mar 16 17:51:01 2016 +0100 Move special tycons >--------------------------------------------------------------- 0a6cd5b1a58c8222b970d3efc222f97ce748be09 compiler/prelude/TysPrim.hs | 16 +++++++++++++++- compiler/typecheck/TcTypeable.hs | 18 +++--------------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/compiler/prelude/TysPrim.hs b/compiler/prelude/TysPrim.hs index ce25c30..34f020c 100644 --- a/compiler/prelude/TysPrim.hs +++ b/compiler/prelude/TysPrim.hs @@ -27,6 +27,7 @@ module TysPrim( funTyCon, funTyConName, primTyCons, + primTypeableTyCons, charPrimTyCon, charPrimTy, intPrimTyCon, intPrimTy, @@ -79,7 +80,7 @@ module TysPrim( #include "HsVersions.h" import {-# SOURCE #-} TysWiredIn - ( runtimeRepTy, liftedTypeKind + ( runtimeRepTyCon, runtimeRepTy, liftedTypeKind , vecRepDataConTyCon, ptrRepUnliftedDataConTyCon , voidRepDataConTy, intRepDataConTy , wordRepDataConTy, int64RepDataConTy, word64RepDataConTy, addrRepDataConTy @@ -93,6 +94,7 @@ import {-# SOURCE #-} TysWiredIn import Var ( TyVar, KindVar, mkTyVar ) import Name +import NameEnv import TyCon import SrcLoc import Unique @@ -155,6 +157,18 @@ primTyCons #include "primop-vector-tycons.hs-incl" ] +-- | The names of the 'TyCon's which we define 'Typeable' bindings for +-- explicitly in "Data.Typeable.Internal" +-- and should not generate bindings for in "GHC.Types". +-- +-- See Note [Mutually recursive representations of primitive types] +primTypeableTyCons :: NameEnv TyConRepName +primTypeableTyCons = mkNameEnv + [ (tYPETyConName, trTYPEName) + , (tyConName runtimeRepTyCon, trRuntimeRepName) + , (funTyConName, trArrowName) + ] + mkPrimTc :: FastString -> Unique -> TyCon -> Name mkPrimTc fs unique tycon = mkWiredInName gHC_PRIM (mkTcOccFS fs) diff --git a/compiler/typecheck/TcTypeable.hs b/compiler/typecheck/TcTypeable.hs index b59489d..d0360f5 100644 --- a/compiler/typecheck/TcTypeable.hs +++ b/compiler/typecheck/TcTypeable.hs @@ -13,8 +13,7 @@ import IfaceEnv( newGlobalBinder ) import TcEnv import TcRnMonad import PrelNames -import TysPrim ( primTyCons, tYPETyConName, funTyConName ) -import TysWiredIn ( runtimeRepTyCon ) +import TysPrim ( primTyCons, primTypeableTyCons ) import Id import Type import TyCon @@ -22,7 +21,7 @@ import DataCon import Name( getOccName ) import OccName import Module -import NameSet +import NameEnv import HsSyn import DynFlags import Bag @@ -166,17 +165,6 @@ mkTypeableTyConBinds tycons ; gbl_env <- tcExtendGlobalValEnv tycon_rep_ids getGblEnv ; return (gbl_env `addTypecheckedBinds` tc_binds) } --- | The names of the 'TyCon's which we handle explicitly in "Data.Typeable.Internal" --- and should not generate bindings for in "GHC.Types". --- --- See Note [Mutually recursive representations of primitive types] -specialPrimTyCons :: NameSet -specialPrimTyCons = mkNameSet - [ tYPETyConName - , tyConName runtimeRepTyCon - , funTyConName - ] - -- | Generate bindings for the type representation of a wired-in TyCon defined -- by the virtual "GHC.Prim" module. This is where we inject the representation -- bindings for primitive types into "GHC.Types" @@ -221,7 +209,7 @@ ghcPrimTypeableBinds stuff all_prim_tys :: [TyCon] all_prim_tys = [ tc' | tc <- funTyCon : primTyCons , tc' <- tc : tyConATs tc - , not $ tyConName tc' `elemNameSet` specialPrimTyCons + , not $ tyConName tc' `elemNameEnv` primTypeableTyCons ] mkBind :: TyCon -> LHsBinds Id From git at git.haskell.org Wed Apr 13 17:55:33 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Apr 2016 17:55:33 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Fix pretty-printer (f4a82ef) Message-ID: <20160413175533.353093A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/f4a82ef1647378634d87cff2b3b7eab8d0954cc2/ghc >--------------------------------------------------------------- commit f4a82ef1647378634d87cff2b3b7eab8d0954cc2 Author: Ben Gamari Date: Wed Mar 16 22:07:23 2016 +0100 Fix pretty-printer >--------------------------------------------------------------- f4a82ef1647378634d87cff2b3b7eab8d0954cc2 libraries/base/Data/Typeable/Internal.hs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libraries/base/Data/Typeable/Internal.hs b/libraries/base/Data/Typeable/Internal.hs index dd66283..7a2e914 100644 --- a/libraries/base/Data/Typeable/Internal.hs +++ b/libraries/base/Data/Typeable/Internal.hs @@ -343,14 +343,18 @@ instance Show (TypeRep (a :: k)) where showChar '(' . showArgs (showChar ',') tys . showChar ')' where (tc, tys) = splitApps rep showsPrec p (TrTyCon _ tycon _) = showsPrec p tycon - showsPrec _ (TrApp _ (TrTyCon _ tycon _) x) + --showsPrec p (TRFun x r) = + -- showParen (p > 8) $ + -- showsPrec 9 x . showString " -> " . showsPrec 8 r + showsPrec p (TrApp _ (TrApp _ (TrTyCon _ tycon _) x) r) | isArrowTyCon tycon = - shows x . showString " ->" + showParen (p > 8) $ + showsPrec 9 x . showString " -> " . showsPrec p r showsPrec p (TrApp _ f x) | otherwise = showParen (p > 9) $ - showsPrec p f . + showsPrec 8 f . space . showsPrec 9 x where From git at git.haskell.org Wed Apr 13 17:55:35 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Apr 2016 17:55:35 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Kill debugShow (13e8b88) Message-ID: <20160413175535.D03123A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/13e8b88fa7d6b15e7ebd771b0d44c615c597cd87/ghc >--------------------------------------------------------------- commit 13e8b88fa7d6b15e7ebd771b0d44c615c597cd87 Author: Ben Gamari Date: Wed Mar 16 22:08:49 2016 +0100 Kill debugShow >--------------------------------------------------------------- 13e8b88fa7d6b15e7ebd771b0d44c615c597cd87 libraries/base/Data/Typeable/Internal.hs | 18 ------------------ libraries/base/Type/Reflection.hs | 1 - 2 files changed, 19 deletions(-) diff --git a/libraries/base/Data/Typeable/Internal.hs b/libraries/base/Data/Typeable/Internal.hs index 7a2e914..09db187 100644 --- a/libraries/base/Data/Typeable/Internal.hs +++ b/libraries/base/Data/Typeable/Internal.hs @@ -71,8 +71,6 @@ module Data.Typeable.Internal ( mkTrCon, mkTrApp, mkTyCon, mkTyCon#, typeSymbolTypeRep, typeNatTypeRep, - debugShow, - -- * Representations for primitive types trTYPE, trTYPE'PtrRepLifted, @@ -319,22 +317,6 @@ typeRepXFingerprint (TypeRepX t) = typeRepFingerprint t ----------------- Showing TypeReps -------------------- -debugShow :: TypeRep a -> String -debugShow rep - | Just HRefl <- rep `eqTypeRep` (typeRep :: TypeRep Type) = "Type" - | Just HRefl <- rep `eqTypeRep` (typeRep :: TypeRep RuntimeRep) = "RuntimeRep" - | (tc, _) <- splitApps rep - , isArrowTyCon tc = "Arrow" -debugShow (TrApp _ f x) = "App ("++debugShow f++") ("++debugShow x++")" -debugShow (TrTyCon _ x k) - | isArrowTyCon x = "Arrow" - | "->" <- show x = "Arrow #" ++ show ( tyConFingerprint x - , tyConFingerprint trArrowTyCon - , tyConFingerprint $ typeRepTyCon (typeRep :: TypeRep (->)) - , typeRepTyCon (typeRep :: TypeRep (->)) - ) - | otherwise = show x++" :: "++debugShow k - instance Show (TypeRep (a :: k)) where showsPrec _ rep | isListTyCon tc, [ty] <- tys = diff --git a/libraries/base/Type/Reflection.hs b/libraries/base/Type/Reflection.hs index 480e148..8057a2e 100644 --- a/libraries/base/Type/Reflection.hs +++ b/libraries/base/Type/Reflection.hs @@ -37,7 +37,6 @@ module Type.Reflection , I.tyConModule , I.tyConName , I.rnfTyCon - , I.debugShow ) where import qualified Data.Typeable.Internal as I From git at git.haskell.org Wed Apr 13 17:55:38 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Apr 2016 17:55:38 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Fix primitive types (e19c41e) Message-ID: <20160413175538.7C6BA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/e19c41e95b087992debda468cf79e23854a9808e/ghc >--------------------------------------------------------------- commit e19c41e95b087992debda468cf79e23854a9808e Author: Ben Gamari Date: Wed Mar 16 19:52:17 2016 +0100 Fix primitive types >--------------------------------------------------------------- e19c41e95b087992debda468cf79e23854a9808e compiler/prelude/TysPrim.hs | 2 +- compiler/typecheck/TcInteract.hs | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/compiler/prelude/TysPrim.hs b/compiler/prelude/TysPrim.hs index 34f020c..81fc3f9 100644 --- a/compiler/prelude/TysPrim.hs +++ b/compiler/prelude/TysPrim.hs @@ -20,7 +20,7 @@ module TysPrim( kKiVar, -- Kind constructors... - tYPETyConName, unliftedTypeKindTyConName, + tYPETyCon, tYPETyConName, unliftedTypeKindTyConName, -- Kinds tYPE, diff --git a/compiler/typecheck/TcInteract.hs b/compiler/typecheck/TcInteract.hs index e93f303..b1f138f 100644 --- a/compiler/typecheck/TcInteract.hs +++ b/compiler/typecheck/TcInteract.hs @@ -24,10 +24,10 @@ import Name import PrelNames ( knownNatClassName, knownSymbolClassName, typeableClassName, coercibleTyConKey, heqTyConKey, ipClassKey, - trTYPE'PtrRepLiftedName, trRuntimeRepName, trArrowName ) + trTYPEName, trTYPE'PtrRepLiftedName, trRuntimeRepName, trArrowName ) import TysWiredIn ( typeNatKind, typeSymbolKind, heqDataCon, coercibleDataCon, runtimeRepTy ) -import TysPrim ( eqPrimTyCon, eqReprPrimTyCon ) +import TysPrim ( eqPrimTyCon, eqReprPrimTyCon, tYPETyCon ) import Id( idType ) import CoAxiom ( Eqn, CoAxiom(..), CoAxBranch(..), fromBranches ) import Class @@ -2000,7 +2000,9 @@ matchTypeable clas [k,t] -- clas = Typeable | k `eqType` typeNatKind = doTyLit knownNatClassName t | k `eqType` typeSymbolKind = doTyLit knownSymbolClassName t | t `eqType` liftedTypeKind = doPrimRep trTYPE'PtrRepLiftedName t + | t `eqType` mkTyConTy tYPETyCon = doPrimRep trTYPEName t | t `eqType` runtimeRepTy = doPrimRep trRuntimeRepName t + | t `eqType` mkTyConTy funTyCon = doPrimRep trArrowName t | Just (tc, ks) <- splitTyConApp_maybe t -- See Note [Typeable (T a b c)] , onlyNamedBndrsApplied tc ks = doTyConApp clas t tc | Just (arg,ret) <- splitFunTy_maybe t = doFunTy clas t arg ret From git at git.haskell.org Wed Apr 13 17:55:41 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Apr 2016 17:55:41 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Internal things (1f0ffda) Message-ID: <20160413175541.254643A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/1f0ffda9e636bd78628619b81a59683cdf3ef20c/ghc >--------------------------------------------------------------- commit 1f0ffda9e636bd78628619b81a59683cdf3ef20c Author: Ben Gamari Date: Wed Mar 16 17:51:27 2016 +0100 Internal things >--------------------------------------------------------------- 1f0ffda9e636bd78628619b81a59683cdf3ef20c libraries/base/Data/Typeable/Internal.hs | 35 ++++++++++++++++++++++++++------ libraries/base/Type/Reflection.hs | 1 + 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/libraries/base/Data/Typeable/Internal.hs b/libraries/base/Data/Typeable/Internal.hs index 3b84aba..dd66283 100644 --- a/libraries/base/Data/Typeable/Internal.hs +++ b/libraries/base/Data/Typeable/Internal.hs @@ -71,6 +71,8 @@ module Data.Typeable.Internal ( mkTrCon, mkTrApp, mkTyCon, mkTyCon#, typeSymbolTypeRep, typeNatTypeRep, + debugShow, + -- * Representations for primitive types trTYPE, trTYPE'PtrRepLifted, @@ -317,6 +319,22 @@ typeRepXFingerprint (TypeRepX t) = typeRepFingerprint t ----------------- Showing TypeReps -------------------- +debugShow :: TypeRep a -> String +debugShow rep + | Just HRefl <- rep `eqTypeRep` (typeRep :: TypeRep Type) = "Type" + | Just HRefl <- rep `eqTypeRep` (typeRep :: TypeRep RuntimeRep) = "RuntimeRep" + | (tc, _) <- splitApps rep + , isArrowTyCon tc = "Arrow" +debugShow (TrApp _ f x) = "App ("++debugShow f++") ("++debugShow x++")" +debugShow (TrTyCon _ x k) + | isArrowTyCon x = "Arrow" + | "->" <- show x = "Arrow #" ++ show ( tyConFingerprint x + , tyConFingerprint trArrowTyCon + , tyConFingerprint $ typeRepTyCon (typeRep :: TypeRep (->)) + , typeRepTyCon (typeRep :: TypeRep (->)) + ) + | otherwise = show x++" :: "++debugShow k + instance Show (TypeRep (a :: k)) where showsPrec _ rep | isListTyCon tc, [ty] <- tys = @@ -325,16 +343,18 @@ instance Show (TypeRep (a :: k)) where showChar '(' . showArgs (showChar ',') tys . showChar ')' where (tc, tys) = splitApps rep showsPrec p (TrTyCon _ tycon _) = showsPrec p tycon + showsPrec _ (TrApp _ (TrTyCon _ tycon _) x) + | isArrowTyCon tycon = + shows x . showString " ->" + showsPrec p (TrApp _ f x) - | Just HRefl <- f `eqTypeRep` (typeRep :: TypeRep (->)) = - shows x . showString " -> " | otherwise = - showsPrec p f . space . showParen need_parens (showsPrec 10 x) + showParen (p > 9) $ + showsPrec p f . + space . + showsPrec 9 x where space = showChar ' ' - need_parens = case x of - TrApp {} -> True - TrTyCon {} -> False instance Show TypeRepX where showsPrec p (TypeRepX ty) = showsPrec p ty @@ -346,6 +366,9 @@ splitApps = go [] go xs (TrTyCon _ tc _) = (tc, xs) go xs (TrApp _ f x) = go (TypeRepX x : xs) f +isArrowTyCon :: TyCon -> Bool +isArrowTyCon tc = tc == typeRepTyCon (typeRep :: TypeRep (->)) + isListTyCon :: TyCon -> Bool isListTyCon tc = tc == typeRepTyCon (typeRep :: TypeRep [Int]) diff --git a/libraries/base/Type/Reflection.hs b/libraries/base/Type/Reflection.hs index 8057a2e..480e148 100644 --- a/libraries/base/Type/Reflection.hs +++ b/libraries/base/Type/Reflection.hs @@ -37,6 +37,7 @@ module Type.Reflection , I.tyConModule , I.tyConName , I.rnfTyCon + , I.debugShow ) where import qualified Data.Typeable.Internal as I From git at git.haskell.org Wed Apr 13 17:55:43 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Apr 2016 17:55:43 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Inline space (947b310) Message-ID: <20160413175543.C15CD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/947b310cd2011177ec12ea3ae6c3a6e2ffcde79f/ghc >--------------------------------------------------------------- commit 947b310cd2011177ec12ea3ae6c3a6e2ffcde79f Author: Ben Gamari Date: Wed Mar 16 22:10:16 2016 +0100 Inline space >--------------------------------------------------------------- 947b310cd2011177ec12ea3ae6c3a6e2ffcde79f libraries/base/Data/Typeable/Internal.hs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libraries/base/Data/Typeable/Internal.hs b/libraries/base/Data/Typeable/Internal.hs index 09db187..c145773 100644 --- a/libraries/base/Data/Typeable/Internal.hs +++ b/libraries/base/Data/Typeable/Internal.hs @@ -337,10 +337,8 @@ instance Show (TypeRep (a :: k)) where | otherwise = showParen (p > 9) $ showsPrec 8 f . - space . + showChar ' ' . showsPrec 9 x - where - space = showChar ' ' instance Show TypeRepX where showsPrec p (TypeRepX ty) = showsPrec p ty From git at git.haskell.org Wed Apr 13 17:55:46 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Apr 2016 17:55:46 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Accept easy test output (c92c1dc) Message-ID: <20160413175546.6CB433A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/c92c1dc498d734844b2124dc957365ea53cd8b9f/ghc >--------------------------------------------------------------- commit c92c1dc498d734844b2124dc957365ea53cd8b9f Author: Ben Gamari Date: Wed Mar 16 22:58:53 2016 +0100 Accept easy test output >--------------------------------------------------------------- c92c1dc498d734844b2124dc957365ea53cd8b9f testsuite/tests/ghci.debugger/scripts/print019.stderr | 6 +++--- testsuite/tests/typecheck/should_fail/TcStaticPointersFail02.stderr | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/testsuite/tests/ghci.debugger/scripts/print019.stderr b/testsuite/tests/ghci.debugger/scripts/print019.stderr index cc62fa1..c266bc8 100644 --- a/testsuite/tests/ghci.debugger/scripts/print019.stderr +++ b/testsuite/tests/ghci.debugger/scripts/print019.stderr @@ -5,10 +5,10 @@ Use :print or :force to determine these types Relevant bindings include it :: a1 (bound at :10:1) These potential instances exist: - instance Show TypeRep -- Defined in ?Data.Typeable.Internal? instance Show Ordering -- Defined in ?GHC.Show? instance Show TyCon -- Defined in ?GHC.Show? - ...plus 30 others - ...plus 10 instances involving out-of-scope types + instance Show Integer -- Defined in ?GHC.Show? + ...plus 29 others + ...plus 12 instances involving out-of-scope types (use -fprint-potential-instances to see them all) ? In a stmt of an interactive GHCi command: print it diff --git a/testsuite/tests/typecheck/should_fail/TcStaticPointersFail02.stderr b/testsuite/tests/typecheck/should_fail/TcStaticPointersFail02.stderr index e6e637c..b48d63f 100644 --- a/testsuite/tests/typecheck/should_fail/TcStaticPointersFail02.stderr +++ b/testsuite/tests/typecheck/should_fail/TcStaticPointersFail02.stderr @@ -1,13 +1,13 @@ TcStaticPointersFail02.hs:9:6: error: - ? No instance for (Data.Typeable.Internal.Typeable b) + ? No instance for (base-4.9.0.0:Data.Typeable.Internal.Typeable b) arising from a static form ? In the expression: static (undefined :: (forall a. a -> a) -> b) In an equation for ?f1?: f1 = static (undefined :: (forall a. a -> a) -> b) TcStaticPointersFail02.hs:12:6: error: - ? No instance for (Data.Typeable.Internal.Typeable + ? No instance for (base-4.9.0.0:Data.Typeable.Internal.Typeable (Monad m => a -> m a)) arising from a static form (maybe you haven't applied a function to enough arguments?) From git at git.haskell.org Wed Apr 13 17:55:49 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Apr 2016 17:55:49 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Add mkFunTy (e3242bd) Message-ID: <20160413175549.259293A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/e3242bd82331b1afd225c154ca44e0482db103d9/ghc >--------------------------------------------------------------- commit e3242bd82331b1afd225c154ca44e0482db103d9 Author: Ben Gamari Date: Wed Mar 16 23:15:36 2016 +0100 Add mkFunTy >--------------------------------------------------------------- e3242bd82331b1afd225c154ca44e0482db103d9 libraries/base/Data/Typeable.hs | 14 ++++++++++++++ libraries/base/Data/Typeable/Internal.hs | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/libraries/base/Data/Typeable.hs b/libraries/base/Data/Typeable.hs index 21f93d2..3eb53c5 100644 --- a/libraries/base/Data/Typeable.hs +++ b/libraries/base/Data/Typeable.hs @@ -68,6 +68,7 @@ module Data.Typeable , typeRepTyCon , rnfTypeRep , showsTypeRep + , mkFunTy -- * Observing type representations , funResultTy @@ -168,6 +169,19 @@ funResultTy (I.TypeRepX f) (I.TypeRepX x) = -} funResultTy _ _ = Nothing +-- | Build a function type. +mkFunTy :: TypeRep -> TypeRep -> TypeRep +mkFunTy (I.TypeRepX arg) (I.TypeRepX res) + | Just HRefl <- arg `I.eqTypeRep` liftedTy + , Just HRefl <- res `I.eqTypeRep` liftedTy + = I.TypeRepX (I.TRFun arg res) + | otherwise + = error $ "mkFunTy: Attempted to construct function type from non-lifted "++ + "type: arg="++show arg++", res="++show res + where liftedTy = I.typeRep :: I.TypeRep * + -- TODO: We should be able to support this but the kind of (->) must be + -- generalized + -- | Force a 'TypeRep' to normal form. rnfTypeRep :: TypeRep -> () rnfTypeRep = I.rnfTypeRepX diff --git a/libraries/base/Data/Typeable/Internal.hs b/libraries/base/Data/Typeable/Internal.hs index c145773..2053adb 100644 --- a/libraries/base/Data/Typeable/Internal.hs +++ b/libraries/base/Data/Typeable/Internal.hs @@ -187,7 +187,8 @@ pattern TRFun :: forall fun. () => TypeRep arg -> TypeRep res -> TypeRep fun -pattern TRFun arg res <- TrApp _ (TrApp _ (eqTypeRep trArrow -> Just HRefl) arg) res +pattern TRFun arg res <- TrApp _ (TrApp _ (eqTypeRep trArrow -> Just HRefl) arg) res where + TRFun arg res = mkTrApp (mkTrApp trArrow arg) res decomposeFun :: forall fun r. TypeRep fun From git at git.haskell.org Wed Apr 13 17:55:51 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Apr 2016 17:55:51 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: More test fixes (40b7367) Message-ID: <20160413175551.C9F843A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/40b7367003948074b04666d886b4c1adb53f5990/ghc >--------------------------------------------------------------- commit 40b7367003948074b04666d886b4c1adb53f5990 Author: Ben Gamari Date: Wed Mar 16 23:15:48 2016 +0100 More test fixes >--------------------------------------------------------------- 40b7367003948074b04666d886b4c1adb53f5990 libraries/base/tests/dynamic002.hs | 5 +++++ libraries/base/tests/dynamic004.hs | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libraries/base/tests/dynamic002.hs b/libraries/base/tests/dynamic002.hs index 6d53d2e..fff14ec 100644 --- a/libraries/base/tests/dynamic002.hs +++ b/libraries/base/tests/dynamic002.hs @@ -1,7 +1,12 @@ +{-# LANGUAGE CPP #-} + -- !!! Testing Typeable instances module Main(main) where import Data.Dynamic +#if MIN_VERSION_base(4,9,0) +import Data.Typeable (TypeCon, TypeRep) +#endif import Data.Array import Data.Array.MArray import Data.Array.ST diff --git a/libraries/base/tests/dynamic004.hs b/libraries/base/tests/dynamic004.hs index e6b7a82..2091646 100644 --- a/libraries/base/tests/dynamic004.hs +++ b/libraries/base/tests/dynamic004.hs @@ -1,7 +1,6 @@ module Main where import Data.Typeable -import Data.Typeable.Internal import GHC.Fingerprint import Text.Printf From git at git.haskell.org Wed Apr 13 17:55:54 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Apr 2016 17:55:54 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Fix T8132 (8833f38) Message-ID: <20160413175554.705173A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/8833f38d31f6a390cd663cadbcdcdc689a69be84/ghc >--------------------------------------------------------------- commit 8833f38d31f6a390cd663cadbcdcdc689a69be84 Author: Ben Gamari Date: Wed Mar 16 23:22:32 2016 +0100 Fix T8132 >--------------------------------------------------------------- 8833f38d31f6a390cd663cadbcdcdc689a69be84 testsuite/tests/polykinds/T8132.hs | 5 +++-- testsuite/tests/polykinds/T8132.stderr | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/testsuite/tests/polykinds/T8132.hs b/testsuite/tests/polykinds/T8132.hs index 337e288..cdbfd7f 100644 --- a/testsuite/tests/polykinds/T8132.hs +++ b/testsuite/tests/polykinds/T8132.hs @@ -1,6 +1,7 @@ {-# LANGUAGE MagicHash #-} -import Data.Typeable.Internal +import Data.Typeable data K = K -instance Typeable K where typeRep# _ = undefined +-- This used to have a RHS but now we hide typeRep# +instance Typeable K -- where typeRep# _ = undefined diff --git a/testsuite/tests/polykinds/T8132.stderr b/testsuite/tests/polykinds/T8132.stderr index 4a1ca2b..b6b60c9 100644 --- a/testsuite/tests/polykinds/T8132.stderr +++ b/testsuite/tests/polykinds/T8132.stderr @@ -1,3 +1,3 @@ -T8132.hs:6:10: error: +T8132.hs:7:10: error: Class ?Typeable? does not support user-specified instances From git at git.haskell.org Wed Apr 13 17:55:57 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Apr 2016 17:55:57 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Render TYPE 'PtrRepLifted as * (349481a) Message-ID: <20160413175557.20AA63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/349481a4446922cfac24ab83c64a0aef3c450dc9/ghc >--------------------------------------------------------------- commit 349481a4446922cfac24ab83c64a0aef3c450dc9 Author: Ben Gamari Date: Thu Mar 17 01:02:39 2016 +0100 Render TYPE 'PtrRepLifted as * >--------------------------------------------------------------- 349481a4446922cfac24ab83c64a0aef3c450dc9 libraries/base/Data/Typeable/Internal.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libraries/base/Data/Typeable/Internal.hs b/libraries/base/Data/Typeable/Internal.hs index 2053adb..baedc64 100644 --- a/libraries/base/Data/Typeable/Internal.hs +++ b/libraries/base/Data/Typeable/Internal.hs @@ -320,6 +320,8 @@ typeRepXFingerprint (TypeRepX t) = typeRepFingerprint t instance Show (TypeRep (a :: k)) where showsPrec _ rep + | Just HRefl <- rep `eqTypeRep` (typeRep :: TypeRep *) = + showChar '*' | isListTyCon tc, [ty] <- tys = showChar '[' . shows ty . showChar ']' | isTupleTyCon tc = From git at git.haskell.org Wed Apr 13 17:55:59 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Apr 2016 17:55:59 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Internal: Rename type variable (f72e560) Message-ID: <20160413175559.BDC9C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/f72e5609a5abd2d7b7be8b266a7fc45fe1774276/ghc >--------------------------------------------------------------- commit f72e5609a5abd2d7b7be8b266a7fc45fe1774276 Author: Ben Gamari Date: Fri Mar 18 11:49:43 2016 +0100 Internal: Rename type variable >--------------------------------------------------------------- f72e5609a5abd2d7b7be8b266a7fc45fe1774276 libraries/base/Data/Typeable/Internal.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/base/Data/Typeable/Internal.hs b/libraries/base/Data/Typeable/Internal.hs index baedc64..6d8b181 100644 --- a/libraries/base/Data/Typeable/Internal.hs +++ b/libraries/base/Data/Typeable/Internal.hs @@ -237,9 +237,9 @@ data AppResult (t :: k) where App :: TypeRep a -> TypeRep b -> AppResult (a b) -- | Pattern match on a type application -pattern TRApp :: forall k2 (fun :: k2). () - => forall k1 (a :: k1 -> k2) (b :: k1). (fun ~ a b) - => TypeRep a -> TypeRep b -> TypeRep fun +pattern TRApp :: forall k2 (t :: k2). () + => forall k1 (a :: k1 -> k2) (b :: k1). (t ~ a b) + => TypeRep a -> TypeRep b -> TypeRep t pattern TRApp f x <- TrApp _ f x withTypeable :: TypeRep a -> (Typeable a => b) -> b From git at git.haskell.org Wed Apr 13 17:56:02 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 13 Apr 2016 17:56:02 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Implement withTypeable (bbc8525) Message-ID: <20160413175602.76F8C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/bbc852581a4e7fddb5efdfe86e6f109121bb2366/ghc >--------------------------------------------------------------- commit bbc852581a4e7fddb5efdfe86e6f109121bb2366 Author: Ben Gamari Date: Wed Apr 13 00:02:51 2016 +0200 Implement withTypeable >--------------------------------------------------------------- bbc852581a4e7fddb5efdfe86e6f109121bb2366 libraries/base/Data/Typeable/Internal.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libraries/base/Data/Typeable/Internal.hs b/libraries/base/Data/Typeable/Internal.hs index 6d8b181..e38607f 100644 --- a/libraries/base/Data/Typeable/Internal.hs +++ b/libraries/base/Data/Typeable/Internal.hs @@ -85,6 +85,7 @@ import Data.Type.Equality import GHC.Word import GHC.Show import GHC.TypeLits( KnownNat, KnownSymbol, natVal', symbolVal' ) +import Unsafe.Coerce import GHC.Fingerprint.Type import {-# SOURCE #-} GHC.Fingerprint @@ -242,8 +243,11 @@ pattern TRApp :: forall k2 (t :: k2). () => TypeRep a -> TypeRep b -> TypeRep t pattern TRApp f x <- TrApp _ f x +-- | Use a 'TypeRep' as 'Typeable' evidence. withTypeable :: TypeRep a -> (Typeable a => b) -> b -withTypeable = undefined +withTypeable rep f = f' rep + where f' :: TypeRep a -> b + f' = unsafeCoerce rep -- | Pattern match on a type constructor -- TODO: do we want to expose kinds in these patterns? From git at git.haskell.org Thu Apr 14 12:15:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 14 Apr 2016 12:15:03 +0000 (UTC) Subject: [commit: ghc] master: Fix commented out debugging code in ByteCodeGen (49560ba) Message-ID: <20160414121503.0B6E53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/49560ba78c8ac7319665735eb33bfa37cc04d849/ghc >--------------------------------------------------------------- commit 49560ba78c8ac7319665735eb33bfa37cc04d849 Author: Bartosz Nitka Date: Thu Apr 14 05:16:52 2016 -0700 Fix commented out debugging code in ByteCodeGen It changed from VarSet to DVarSet some time ago. >--------------------------------------------------------------- 49560ba78c8ac7319665735eb33bfa37cc04d849 compiler/ghci/ByteCodeGen.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/ghci/ByteCodeGen.hs b/compiler/ghci/ByteCodeGen.hs index fd186c7..f1d0670 100644 --- a/compiler/ghci/ByteCodeGen.hs +++ b/compiler/ghci/ByteCodeGen.hs @@ -288,7 +288,7 @@ schemeR fvs (nm, rhs) {- | trace (showSDoc ( (char ' ' - $$ (ppr.filter (not.isTyVar).varSetElems.fst) rhs + $$ (ppr.filter (not.isTyVar).dVarSetElems.fst) rhs $$ pprCoreExpr (deAnnotate rhs) $$ char ' ' ))) False From git at git.haskell.org Thu Apr 14 12:20:50 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 14 Apr 2016 12:20:50 +0000 (UTC) Subject: [commit: ghc] master: Fix typos: tyars -> tyvars (227a29d) Message-ID: <20160414122050.7DADD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/227a29d1cc1d4cf875ea5c7997493907137c0805/ghc >--------------------------------------------------------------- commit 227a29d1cc1d4cf875ea5c7997493907137c0805 Author: Bartosz Nitka Date: Thu Apr 14 05:23:18 2016 -0700 Fix typos: tyars -> tyvars >--------------------------------------------------------------- 227a29d1cc1d4cf875ea5c7997493907137c0805 compiler/main/InteractiveEval.hs | 2 +- compiler/typecheck/TcDeriv.hs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/main/InteractiveEval.hs b/compiler/main/InteractiveEval.hs index b609f8d..9e5f3b1 100644 --- a/compiler/main/InteractiveEval.hs +++ b/compiler/main/InteractiveEval.hs @@ -575,7 +575,7 @@ bindLocalsAtBreakpoint hsc_env apStack_fhv (Just BreakInfo{..}) = do newTyVars :: UniqSupply -> TcTyVarSet -> TCvSubst -- Similarly, clone the type variables mentioned in the types - -- we have here, *and* make them all RuntimeUnk tyars + -- we have here, *and* make them all RuntimeUnk tyvars newTyVars us tvs = mkTvSubstPrs [ (tv, mkTyVarTy (mkRuntimeUnkTyVar name (tyVarKind tv))) | (tv, uniq) <- varSetElems tvs `zip` uniqsFromSupply us diff --git a/compiler/typecheck/TcDeriv.hs b/compiler/typecheck/TcDeriv.hs index bc194df..d3c9295 100644 --- a/compiler/typecheck/TcDeriv.hs +++ b/compiler/typecheck/TcDeriv.hs @@ -1636,7 +1636,7 @@ mkNewTypeEqn dflags overlap_mode tvs -- Here is the plan for newtype derivings. We see -- newtype T a1...an = MkT (t ak+1...an) deriving (.., C s1 .. sm, ...) -- where t is a type, - -- ak+1...an is a suffix of a1..an, and are all tyars + -- ak+1...an is a suffix of a1..an, and are all tyvars -- ak+1...an do not occur free in t, nor in the s1..sm -- (C s1 ... sm) is a *partial applications* of class C -- with the last parameter missing From git at git.haskell.org Thu Apr 14 14:18:11 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 14 Apr 2016 14:18:11 +0000 (UTC) Subject: [commit: ghc] master: Remove some old commented out code in StgLint (20f9056) Message-ID: <20160414141811.ECC763A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/20f905609aaab29b80247e85c96d50e8d697dae0/ghc >--------------------------------------------------------------- commit 20f905609aaab29b80247e85c96d50e8d697dae0 Author: Bartosz Nitka Date: Thu Apr 14 06:09:17 2016 -0700 Remove some old commented out code in StgLint This looks like some traces of an experiment to check if shadowing is good for STG. The code refers to things that don't exist anymore and this part of code hasn't been touched for ages, so I think this should be safe to remove. Test Plan: just comments Reviewers: austin, bgamari, simonpj Reviewed By: simonpj Subscribers: thomie, simonmar Differential Revision: https://phabricator.haskell.org/D2114 >--------------------------------------------------------------- 20f905609aaab29b80247e85c96d50e8d697dae0 compiler/stgSyn/StgLint.hs | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/compiler/stgSyn/StgLint.hs b/compiler/stgSyn/StgLint.hs index dd206d9..b3f7182 100644 --- a/compiler/stgSyn/StgLint.hs +++ b/compiler/stgSyn/StgLint.hs @@ -348,19 +348,9 @@ addLoc extra_loc m = LintM $ \loc scope errs addInScopeVars :: [Id] -> LintM a -> LintM a addInScopeVars ids m = LintM $ \loc scope errs - -> -- We check if these "new" ids are already - -- in scope, i.e., we have *shadowing* going on. - -- For now, it's just a "trace"; we may make - -- a real error out of it... - let + -> let new_set = mkVarSet ids - in --- After adding -fliberate-case, Simon decided he likes shadowed --- names after all. WDP 94/07 --- (if isEmptyVarSet shadowed --- then id --- else pprTrace "Shadowed vars:" (ppr (varSetElems shadowed))) $ - unLintM m loc (scope `unionVarSet` new_set) errs + in unLintM m loc (scope `unionVarSet` new_set) errs {- Checking function applications: we only check that the type has the From git at git.haskell.org Thu Apr 14 15:16:18 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 14 Apr 2016 15:16:18 +0000 (UTC) Subject: [commit: ghc] wip/T11731: Add a test case for #11731. (3a34b5c) Message-ID: <20160414151618.12D173A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T11731 Link : http://ghc.haskell.org/trac/ghc/changeset/3a34b5c32303734c794f27728025e8a9fb410fb3/ghc >--------------------------------------------------------------- commit 3a34b5c32303734c794f27728025e8a9fb410fb3 Author: Joachim Breitner Date: Wed Mar 30 12:55:10 2016 +0200 Add a test case for #11731. >--------------------------------------------------------------- 3a34b5c32303734c794f27728025e8a9fb410fb3 testsuite/.gitignore | 1 + testsuite/tests/simplCore/should_run/T11731.hs | 36 ++++++++++++++++++++++ testsuite/tests/simplCore/should_run/T11731.stderr | 1 + testsuite/tests/simplCore/should_run/all.T | 1 + 4 files changed, 39 insertions(+) diff --git a/testsuite/.gitignore b/testsuite/.gitignore index 655e3da..e1f1822 100644 --- a/testsuite/.gitignore +++ b/testsuite/.gitignore @@ -1475,6 +1475,7 @@ mk/ghcconfig*_test___spaces_ghc*.exe.mk /tests/simplCore/should_run/T5997 /tests/simplCore/should_run/T7101 /tests/simplCore/should_run/T7924 +/tests/simplCore/should_run/T11731 /tests/simplCore/should_run/T9128 /tests/simplCore/should_run/T9390 /tests/simplCore/should_run/runST diff --git a/testsuite/tests/simplCore/should_run/T11731.hs b/testsuite/tests/simplCore/should_run/T11731.hs new file mode 100644 index 0000000..e148507 --- /dev/null +++ b/testsuite/tests/simplCore/should_run/T11731.hs @@ -0,0 +1,36 @@ +module Main (main ) where + +import Debug.Trace + +foo :: (a,b) -> a +foo (x,y) = x +{-# NOINLINE foo #-} + +wwMe :: Int -> (Int,Int) -> (Int, Int) +wwMe 0 p = + let a = fst p + b = snd p + -- This ensure sharing of b, as seen by the demand analyzer + + in foo p `seq` + -- This ensures that wwMe is strict in the tuple, but that the tuple + -- is preserved. + (b + a, a + b) + +wwMe n p = wwMe (n-1) (0,0) + -- ^ Make it recursive, so that it is attractive to worker-wrapper + +go :: Int -> IO () +go seed = do + let shareMeThunk = trace "Evaluated (should only happen once)" (seed + 1) + {-# NOINLINE shareMeThunk #-} + -- ^ This is the thunk that is wrongly evaluated twice. + + let (x,y) = wwMe 0 (seed,shareMeThunk) + + (x + y) `seq` return () + -- ^ Use both components +{-# NOINLINE go #-} + +main :: IO () +main = go 42 diff --git a/testsuite/tests/simplCore/should_run/T11731.stderr b/testsuite/tests/simplCore/should_run/T11731.stderr new file mode 100644 index 0000000..8d1fc60 --- /dev/null +++ b/testsuite/tests/simplCore/should_run/T11731.stderr @@ -0,0 +1 @@ +Evaluated (should only happen once) diff --git a/testsuite/tests/simplCore/should_run/all.T b/testsuite/tests/simplCore/should_run/all.T index 9c15b0f..042c097 100644 --- a/testsuite/tests/simplCore/should_run/all.T +++ b/testsuite/tests/simplCore/should_run/all.T @@ -71,3 +71,4 @@ test('T9128', normal, compile_and_run, ['']) test('T9390', normal, compile_and_run, ['']) test('T10830', extra_run_opts('+RTS -K100k -RTS'), compile_and_run, ['']) test('T11172', normal, compile_and_run, ['']) +test('T11731', expect_broken(11731), compile_and_run, ['-fspec-constr']) From git at git.haskell.org Thu Apr 14 15:16:21 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 14 Apr 2016 15:16:21 +0000 (UTC) Subject: [commit: ghc] wip/T11731: Add a final demand analyzer run right before TidyCore (2f56242) Message-ID: <20160414151621.014733A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T11731 Link : http://ghc.haskell.org/trac/ghc/changeset/2f56242b2fb9249420fce132bbded49c289b23a3/ghc >--------------------------------------------------------------- commit 2f56242b2fb9249420fce132bbded49c289b23a3 Author: Joachim Breitner Date: Thu Mar 31 10:18:15 2016 +0200 Add a final demand analyzer run right before TidyCore in order to have precise used-once information in the exported strictness signatures, as well as precise used-once information on thunks. This avoids the bad effects of #11731. The subsequent worker-wrapper pass is responsible for removing the demand environment part of the strictness signature. It does not run after the final demand analyzer pass, so remove this also in CoreTidy. The subsequent worker-wrapper pass is also responsible for removing used-once-information from the demands and strictness signatures, as these might not be preserved by the simplifier. This is _not_ done by CoreTidy, because we _do_ want this information, as produced by the last round of the demand analyzer, to be available to the code generator. >--------------------------------------------------------------- 2f56242b2fb9249420fce132bbded49c289b23a3 compiler/basicTypes/Demand.hs | 72 ++++++++++++++------ compiler/basicTypes/Id.hs | 11 ++- compiler/basicTypes/IdInfo.hs | 15 +++- compiler/coreSyn/CoreTidy.hs | 5 +- compiler/simplCore/SimplCore.hs | 5 ++ compiler/stranal/DmdAnal.hs | 28 ++++++++ compiler/stranal/WorkWrap.hs | 79 ++++++++++++++++------ testsuite/tests/perf/compiler/all.T | 27 +++++--- .../tests/simplCore/should_compile/T4908.stderr | 6 +- .../simplCore/should_compile/spec-inline.stderr | 4 +- testsuite/tests/simplCore/should_run/all.T | 2 +- .../tests/stranal/should_compile/T10694.stderr | 61 +++++++++++++++++ .../stranal/sigs/BottomFromInnerLambda.stderr | 7 ++ testsuite/tests/stranal/sigs/DmdAnalGADTs.stderr | 14 ++++ testsuite/tests/stranal/sigs/HyperStrUse.stderr | 6 ++ testsuite/tests/stranal/sigs/StrAnalExample.stderr | 6 ++ testsuite/tests/stranal/sigs/T8569.stderr | 9 +++ testsuite/tests/stranal/sigs/T8598.stderr | 6 ++ testsuite/tests/stranal/sigs/UnsatFun.stderr | 12 ++++ 19 files changed, 313 insertions(+), 62 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 2f56242b2fb9249420fce132bbded49c289b23a3 From git at git.haskell.org Thu Apr 14 15:16:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 14 Apr 2016 15:16:23 +0000 (UTC) Subject: [commit: ghc] wip/T11731's head updated: Add a final demand analyzer run right before TidyCore (2f56242) Message-ID: <20160414151623.7C01F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/T11731' now includes: 06b7ce2 testsuite: One more 32-bit performance slip 6b6beba Fix installation of static sphinx assets 535896e rts: Fix parsing of profiler selectors 2bcf0c3 Revert "testsuite: One more 32-bit performance slip" eca8648 GHC.Base: Use thenIO in instance Applicative IO f0af351 Remove obsolete comment about the implementation of foldl f9d26e5 Fix a comment: triple -> tuple 485608d Refactor comments about shutdown c4a7520 Provide an optimized replicateM_ implementation #11795 90d66de Add doc to (<=<) comparing its type to (.) f3beed3 Remove left-over shell-tools.c 6d7fda5 Remove spurious STG_UNUSED annotation 2f82da7 Fix Template Haskell bug reported in #11809. d2e05c6 Reduce default for -fmax-pmcheck-iterations from 1e7 to 2e6 5a1add1 Export zonkEvBinds from TcHsSyn. 470d4d5 Fix suggestions for unbound variables (#11680) cf5ff08 Bump haddock submodule ad532de base: Fix "since" annotation on GHC.ExecutionStack 7443e5c Remove the instantiation check when deriving Generic(1) 378091c RtsFlags: Un-constify temporary buffer 8987ce0 Typos in Note 90538d8 Change runtime linker to perform lazy loading of symbols/sections 46e8f19 Fix a closed type family error message 02a5c58 Filter out invisible kind arguments during TH reification 8b57cac Added (more) missing instances for Identity and Const aadde2b Deriving Functor-like classes should unify kind variables 2ef35d8 Use `@since` annotation in GHC.ExecutionStack c6e579b Add linker notes 83eb4fd Small simplification (#11777) 5c4cd0e Cache the size of part_list/scavd_list (#11783) f4446c5 Allocate blocks in the GC in batches b1084fd Fix #11811. dd99f2e Fix #11797. 0b6dcf6 Fix #11814 by throwing more stuff into InScopeSets d81cdc2 Teach lookupLocalRdrEnv about Exacts. (#11813) 49560ba Fix commented out debugging code in ByteCodeGen 227a29d Fix typos: tyars -> tyvars 20f9056 Remove some old commented out code in StgLint 3a34b5c Add a test case for #11731. 2f56242 Add a final demand analyzer run right before TidyCore From git at git.haskell.org Thu Apr 14 20:21:51 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 14 Apr 2016 20:21:51 +0000 (UTC) Subject: [commit: ghc] branch 'wip/T11731' deleted Message-ID: <20160414202151.1F5A53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Deleted branch: wip/T11731 From git at git.haskell.org Thu Apr 14 20:21:53 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 14 Apr 2016 20:21:53 +0000 (UTC) Subject: [commit: ghc] master: Add a final demand analyzer run right before TidyCore (f4fd98c) Message-ID: <20160414202153.D37DA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f4fd98c717a7f68d76a3054021b3be65d1ebad82/ghc >--------------------------------------------------------------- commit f4fd98c717a7f68d76a3054021b3be65d1ebad82 Author: Joachim Breitner Date: Thu Mar 31 10:18:15 2016 +0200 Add a final demand analyzer run right before TidyCore in order to have precise used-once information in the exported strictness signatures, as well as precise used-once information on thunks. This avoids the bad effects of #11731. The subsequent worker-wrapper pass is responsible for removing the demand environment part of the strictness signature. It does not run after the final demand analyzer pass, so remove this also in CoreTidy. The subsequent worker-wrapper pass is also responsible for removing used-once-information from the demands and strictness signatures, as these might not be preserved by the simplifier. This is _not_ done by CoreTidy, because we _do_ want this information, as produced by the last round of the demand analyzer, to be available to the code generator. Differential Revision: https://phabricator.haskell.org/D2073 >--------------------------------------------------------------- f4fd98c717a7f68d76a3054021b3be65d1ebad82 compiler/basicTypes/Demand.hs | 72 ++++++++++++++------ compiler/basicTypes/Id.hs | 11 ++- compiler/basicTypes/IdInfo.hs | 15 +++- compiler/coreSyn/CoreTidy.hs | 5 +- compiler/simplCore/SimplCore.hs | 5 ++ compiler/stranal/DmdAnal.hs | 28 ++++++++ compiler/stranal/WorkWrap.hs | 79 ++++++++++++++++------ testsuite/tests/perf/compiler/all.T | 27 +++++--- .../tests/simplCore/should_compile/T4908.stderr | 6 +- .../simplCore/should_compile/spec-inline.stderr | 4 +- testsuite/tests/simplCore/should_run/all.T | 2 +- .../tests/stranal/should_compile/T10694.stderr | 61 +++++++++++++++++ .../stranal/sigs/BottomFromInnerLambda.stderr | 7 ++ testsuite/tests/stranal/sigs/DmdAnalGADTs.stderr | 14 ++++ testsuite/tests/stranal/sigs/HyperStrUse.stderr | 6 ++ testsuite/tests/stranal/sigs/StrAnalExample.stderr | 6 ++ testsuite/tests/stranal/sigs/T8569.stderr | 9 +++ testsuite/tests/stranal/sigs/T8598.stderr | 6 ++ testsuite/tests/stranal/sigs/UnsatFun.stderr | 12 ++++ 19 files changed, 313 insertions(+), 62 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc f4fd98c717a7f68d76a3054021b3be65d1ebad82 From git at git.haskell.org Thu Apr 14 20:21:56 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 14 Apr 2016 20:21:56 +0000 (UTC) Subject: [commit: ghc] master's head updated: Add a final demand analyzer run right before TidyCore (f4fd98c) Message-ID: <20160414202156.2656A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'master' now includes: 3a34b5c Add a test case for #11731. f4fd98c Add a final demand analyzer run right before TidyCore From git at git.haskell.org Thu Apr 14 20:34:35 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 14 Apr 2016 20:34:35 +0000 (UTC) Subject: [commit: ghc] wip/T10613: State hack hack in ticky report (02493dc) Message-ID: <20160414203435.6A44C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T10613 Link : http://ghc.haskell.org/trac/ghc/changeset/02493dcf580141110e90fa943ec70640115de0ed/ghc >--------------------------------------------------------------- commit 02493dcf580141110e90fa943ec70640115de0ed Author: Joachim Breitner Date: Wed Mar 23 11:10:25 2016 +0100 State hack hack in ticky report In the ticky report, do not mark a function with a State# argument as its first argument as single-entry. >--------------------------------------------------------------- 02493dcf580141110e90fa943ec70640115de0ed compiler/codeGen/StgCmmClosure.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/codeGen/StgCmmClosure.hs b/compiler/codeGen/StgCmmClosure.hs index b467048..3b83b8e 100644 --- a/compiler/codeGen/StgCmmClosure.hs +++ b/compiler/codeGen/StgCmmClosure.hs @@ -234,7 +234,10 @@ mkLFReEntrant _ _ [] _ = pprPanic "mkLFReEntrant" empty mkLFReEntrant top fvs args arg_descr = LFReEntrant top os_info (length args) (null fvs) arg_descr - where os_info = idOneShotInfo (head args) + where + state_hack_hack = isStateHackType (idType (head args)) + os_info | state_hack_hack = noOneShotInfo + | otherwise = idOneShotInfo (head args) ------------- mkLFThunk :: Type -> TopLevelFlag -> [Id] -> UpdateFlag -> LambdaFormInfo From git at git.haskell.org Thu Apr 14 20:34:38 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 14 Apr 2016 20:34:38 +0000 (UTC) Subject: [commit: ghc] wip/T10613: Rough working implementation of #10613 (f51fda7) Message-ID: <20160414203438.2F96C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T10613 Link : http://ghc.haskell.org/trac/ghc/changeset/f51fda77a22228d8f1fc7a5607ac477e7c040116/ghc >--------------------------------------------------------------- commit f51fda77a22228d8f1fc7a5607ac477e7c040116 Author: Joachim Breitner Date: Thu Mar 17 16:33:18 2016 +0100 Rough working implementation of #10613 The COUNTING_IND closure type is based on the (since removed) IND_PERM. Some of the code is rather ad-hoc and likely in need of some refactoring and clean-up before entering master (if it ever should), but it should be good enough to play around with it and obtain some numbers. >--------------------------------------------------------------- f51fda77a22228d8f1fc7a5607ac477e7c040116 compiler/cmm/CLabel.hs | 5 ++- compiler/cmm/CmmType.hs | 6 +++ compiler/cmm/SMRep.hs | 11 +++++- compiler/codeGen/StgCmmBind.hs | 76 +++++++++++++++++++++++++++--------- compiler/codeGen/StgCmmClosure.hs | 8 ++++ compiler/codeGen/StgCmmHeap.hs | 20 ++++++++-- compiler/codeGen/StgCmmLayout.hs | 23 ++++++++--- compiler/codeGen/StgCmmTicky.hs | 37 ++++++++++++++++-- compiler/codeGen/StgCmmUtils.hs | 12 +++--- compiler/coreSyn/PprCore.hs | 2 +- compiler/ghci/ByteCodeItbls.hs | 4 +- includes/Cmm.h | 1 + includes/rts/Ticky.h | 9 ++++- includes/rts/storage/ClosureMacros.h | 1 + includes/rts/storage/ClosureTypes.h | 73 +++++++++++++++++----------------- includes/rts/storage/Closures.h | 7 ++++ includes/stg/MiscClosures.h | 1 + rts/CheckUnload.c | 1 + rts/ClosureFlags.c | 3 +- rts/Interpreter.c | 1 + rts/LdvProfile.c | 1 + rts/Printer.c | 10 ++++- rts/ProfHeap.c | 1 + rts/RetainerProfile.c | 6 +-- rts/RtsSymbols.c | 1 + rts/Stable.c | 1 + rts/StgMiscClosures.cmm | 43 ++++++++++++++++++++ rts/Ticky.c | 21 +++++++--- rts/sm/Compact.c | 1 + rts/sm/Evac.c | 3 ++ rts/sm/GCAux.c | 1 + rts/sm/Sanity.c | 1 + rts/sm/Scav.c | 12 ++++++ utils/deriveConstants/Main.hs | 7 ++++ utils/genapply/Main.hs | 4 +- 35 files changed, 325 insertions(+), 89 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc f51fda77a22228d8f1fc7a5607ac477e7c040116 From git at git.haskell.org Thu Apr 14 20:34:40 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 14 Apr 2016 20:34:40 +0000 (UTC) Subject: [commit: ghc] wip/T10613: Evac: Do not evaluate selector thunks pointing to counting indirections (0a1f2f6) Message-ID: <20160414203440.D621F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T10613 Link : http://ghc.haskell.org/trac/ghc/changeset/0a1f2f68f7e1e8b1ad6e696b632e2104f172bb9c/ghc >--------------------------------------------------------------- commit 0a1f2f68f7e1e8b1ad6e696b632e2104f172bb9c Author: Joachim Breitner Date: Wed Mar 23 13:50:00 2016 +0100 Evac: Do not evaluate selector thunks pointing to counting indirections >--------------------------------------------------------------- 0a1f2f68f7e1e8b1ad6e696b632e2104f172bb9c rts/sm/Evac.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rts/sm/Evac.c b/rts/sm/Evac.c index 3b4314b..9369543 100644 --- a/rts/sm/Evac.c +++ b/rts/sm/Evac.c @@ -998,12 +998,17 @@ selector_loop: } case IND: - case COUNTING_IND: case IND_STATIC: // Again, we might need to untag a constructor. selectee = UNTAG_CLOSURE( ((StgInd *)selectee)->indirectee ); goto selector_loop; + case COUNTING_IND: + // do not short cut a COUNTING_IND, as we would miss a the count + // Can we simply tick the counter here? Not really: If this selector + // thunk is not going to be used, we counted more than we wanted! + goto bale_out; + case BLACKHOLE: { StgClosure *r; From git at git.haskell.org Thu Apr 14 20:34:43 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 14 Apr 2016 20:34:43 +0000 (UTC) Subject: [commit: ghc] wip/T10613: Temporarily move regular entry counting to the COUNTING_IND (4ae80f3) Message-ID: <20160414203443.844033A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T10613 Link : http://ghc.haskell.org/trac/ghc/changeset/4ae80f362279c9cd4433ce621cb8740e3916dbee/ghc >--------------------------------------------------------------- commit 4ae80f362279c9cd4433ce621cb8740e3916dbee Author: Joachim Breitner Date: Wed Mar 23 14:28:34 2016 +0100 Temporarily move regular entry counting to the COUNTING_IND >--------------------------------------------------------------- 4ae80f362279c9cd4433ce621cb8740e3916dbee compiler/codeGen/StgCmmBind.hs | 8 ++++++-- rts/StgMiscClosures.cmm | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/compiler/codeGen/StgCmmBind.hs b/compiler/codeGen/StgCmmBind.hs index 5951175..8672273 100644 --- a/compiler/codeGen/StgCmmBind.hs +++ b/compiler/codeGen/StgCmmBind.hs @@ -609,9 +609,13 @@ thunkCode cl_info fv_details _cc node arity body -- Heap overflow check ; entryHeapCheck cl_info node' arity [] $ do - { -- Overwrite with black hole if necessary + { + -- Disabled for now, as we (temporarily unconditionally) move the + -- counting to the counting indirection + -- tickyEnterThunk cl_info + + -- Overwrite with black hole if necessary -- but *after* the heap-overflow check - ; tickyEnterThunk cl_info ; when (blackHoleOnEntry cl_info && node_points) (blackHoleIt node) diff --git a/rts/StgMiscClosures.cmm b/rts/StgMiscClosures.cmm index 96b95aa..0f27fdb 100644 --- a/rts/StgMiscClosures.cmm +++ b/rts/StgMiscClosures.cmm @@ -283,6 +283,7 @@ INFO_TABLE(stg_COUNTING_IND,1,2,COUNTING_IND,"COUNTING_IND","COUNTING_IND") StgEntCounter_multi_entry_count(ent_ctr) = StgEntCounter_multi_entry_count(ent_ctr) + 1; } StgCountingInd_entries(clos) = entries + 1; + StgEntCounter_entry_count(ent_ctr) = StgEntCounter_entry_count(ent_ctr) + 1; #if defined(TICKY_TICKY) && !defined(PROFILING) /* TICKY_TICKY && !PROFILING means PERM_IND *replaces* an IND, rather than From git at git.haskell.org Thu Apr 14 20:34:46 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 14 Apr 2016 20:34:46 +0000 (UTC) Subject: [commit: ghc] wip/T10613's head updated: Temporarily move regular entry counting to the COUNTING_IND (4ae80f3) Message-ID: <20160414203446.0822E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/T10613' now includes: 6ea42c7 Revert "Demand Analyzer: Do not set OneShot information" 3806891 Make the example for -M work 72bd7f7 Improve printing of pattern synonym types f2a2b79 Deeply instantiate in :type 90d7d60 rts: Make StablePtr derefs thread-safe (#10296) b3ecd04 Elaborate test for #11376 9b6820c Bump binary submodule 7407a66 Don't infer CallStacks 2f3b803 Use exprCtOrigin in tcRnExpr 1e6ec12 Fix misattribution of `-Wunused-local-binds` warnings 351f976 T10272, T4340: Add 32-bit output 726cbc2 T10870: Skip on 32-bit architectures 1a8d61c testsuite: Update 32-bit performance numbers 2265c84 Core pretty printer: Omit wild case binders 5b986a4 CSE code cleanup and improvement 0f58d34 Demand Analyzer: Do not set OneShot information (second try) c9e8f80 Set tct_closed to TopLevel for closed bindings. eda273b runtime: replace hw.ncpu with hw.logicalcpu for Mac OS X 27528b3 Adjust performance numbers 06b7ce2 testsuite: One more 32-bit performance slip 6b6beba Fix installation of static sphinx assets 535896e rts: Fix parsing of profiler selectors 2bcf0c3 Revert "testsuite: One more 32-bit performance slip" eca8648 GHC.Base: Use thenIO in instance Applicative IO f0af351 Remove obsolete comment about the implementation of foldl f9d26e5 Fix a comment: triple -> tuple 485608d Refactor comments about shutdown c4a7520 Provide an optimized replicateM_ implementation #11795 90d66de Add doc to (<=<) comparing its type to (.) f3beed3 Remove left-over shell-tools.c 6d7fda5 Remove spurious STG_UNUSED annotation 2f82da7 Fix Template Haskell bug reported in #11809. d2e05c6 Reduce default for -fmax-pmcheck-iterations from 1e7 to 2e6 5a1add1 Export zonkEvBinds from TcHsSyn. 470d4d5 Fix suggestions for unbound variables (#11680) cf5ff08 Bump haddock submodule ad532de base: Fix "since" annotation on GHC.ExecutionStack 7443e5c Remove the instantiation check when deriving Generic(1) 378091c RtsFlags: Un-constify temporary buffer 8987ce0 Typos in Note 90538d8 Change runtime linker to perform lazy loading of symbols/sections 46e8f19 Fix a closed type family error message 02a5c58 Filter out invisible kind arguments during TH reification 8b57cac Added (more) missing instances for Identity and Const aadde2b Deriving Functor-like classes should unify kind variables 2ef35d8 Use `@since` annotation in GHC.ExecutionStack c6e579b Add linker notes 83eb4fd Small simplification (#11777) 5c4cd0e Cache the size of part_list/scavd_list (#11783) f4446c5 Allocate blocks in the GC in batches b1084fd Fix #11811. dd99f2e Fix #11797. 0b6dcf6 Fix #11814 by throwing more stuff into InScopeSets d81cdc2 Teach lookupLocalRdrEnv about Exacts. (#11813) 49560ba Fix commented out debugging code in ByteCodeGen 227a29d Fix typos: tyars -> tyvars 20f9056 Remove some old commented out code in StgLint 3a34b5c Add a test case for #11731. f4fd98c Add a final demand analyzer run right before TidyCore f51fda7 Rough working implementation of #10613 02493dc State hack hack in ticky report 0a1f2f6 Evac: Do not evaluate selector thunks pointing to counting indirections 4ae80f3 Temporarily move regular entry counting to the COUNTING_IND From git at git.haskell.org Fri Apr 15 09:57:41 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 15 Apr 2016 09:57:41 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Use `@since` annotation in GHC.ExecutionStack (ef7160c) Message-ID: <20160415095741.2E57B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/ef7160c5e1e2fdab975b96f7709dcd11beceb308/ghc >--------------------------------------------------------------- commit ef7160c5e1e2fdab975b96f7709dcd11beceb308 Author: Herbert Valerio Riedel Date: Mon Apr 11 07:28:15 2016 +0200 Use `@since` annotation in GHC.ExecutionStack While ad532ded871a9a5180388a2b7cdbdc26e053284c fixed the version number, this fixes the markup... (cherry picked from commit 2ef35d8fed58cb9f33190c6d9908262535b26f90) >--------------------------------------------------------------- ef7160c5e1e2fdab975b96f7709dcd11beceb308 libraries/base/GHC/ExecutionStack.hs | 2 +- libraries/base/GHC/ExecutionStack/Internal.hsc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/base/GHC/ExecutionStack.hs b/libraries/base/GHC/ExecutionStack.hs index 966ba29..3a32deb 100644 --- a/libraries/base/GHC/ExecutionStack.hs +++ b/libraries/base/GHC/ExecutionStack.hs @@ -26,7 +26,7 @@ -- ,("RTS expects libdw","YES") -- @ -- --- /Since: 4.9.0.0/ +-- @since 4.9.0.0 ----------------------------------------------------------------------------- module GHC.ExecutionStack ( diff --git a/libraries/base/GHC/ExecutionStack/Internal.hsc b/libraries/base/GHC/ExecutionStack/Internal.hsc index 340cdc4..54962ff 100644 --- a/libraries/base/GHC/ExecutionStack/Internal.hsc +++ b/libraries/base/GHC/ExecutionStack/Internal.hsc @@ -10,7 +10,7 @@ -- -- Internals of the `GHC.ExecutionStack` module -- --- /Since: 4.9.0.0/ +-- @since 4.9.0.0 ----------------------------------------------------------------------------- #include "HsFFI.h" From git at git.haskell.org Fri Apr 15 09:57:47 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 15 Apr 2016 09:57:47 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Fix #11811. (b1d92b5) Message-ID: <20160415095747.2A8E83A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/b1d92b5d6444ac7920c568086c5dc66e571c3438/ghc >--------------------------------------------------------------- commit b1d92b5d6444ac7920c568086c5dc66e571c3438 Author: Richard Eisenberg Date: Thu Apr 7 16:44:06 2016 +0200 Fix #11811. Previously, I had forgotten to omit variables already in scope from the TypeInType CUSK check. Simple enough to fix. Test case: typecheck/should_compile/T11811 (cherry picked from commit b1084fd700e6bbe9d0d787046a6aabdb193982c4) >--------------------------------------------------------------- b1d92b5d6444ac7920c568086c5dc66e571c3438 compiler/hsSyn/HsDecls.hs | 2 ++ compiler/rename/RnSource.hs | 37 +++++++++++----------- compiler/rename/RnTypes.hs | 29 ++++++++++------- testsuite/tests/typecheck/should_compile/T11811.hs | 8 +++++ testsuite/tests/typecheck/should_compile/all.T | 1 + 5 files changed, 46 insertions(+), 31 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc b1d92b5d6444ac7920c568086c5dc66e571c3438 From git at git.haskell.org Fri Apr 15 09:57:43 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 15 Apr 2016 09:57:43 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Add linker notes (05aab19) Message-ID: <20160415095743.CFE2B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/05aab1954b619a7bb0bcf7be401d621d200aa004/ghc >--------------------------------------------------------------- commit 05aab1954b619a7bb0bcf7be401d621d200aa004 Author: Tamar Christina Date: Mon Apr 11 06:51:44 2016 +0200 Add linker notes Summary: Add linker notes following #11223 and D1805 Reviewers: austin, bgamari, erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2102 GHC Trac Issues: #11223 (cherry picked from commit c6e579bc3820afe71e51b711ee579a4d658ffbf9) >--------------------------------------------------------------- 05aab1954b619a7bb0bcf7be401d621d200aa004 rts/Linker.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/rts/Linker.c b/rts/Linker.c index a296afe..782444a 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -208,6 +208,16 @@ typedef struct _RtsSymbolInfo { When a new declaration or statement is performed ultimately lookupSymbol is called without doing a re-link. + The goal of these different phases is to allow the linker to be able to perform + "lazy loading" of ObjectCode. The reason for this is that we want to only link + in symbols that are actually required for the link. This reduces: + + 1) Dependency chains, if A.o required a .o in libB but A.o isn't required to link + then we don't need to load libB. This means the dependency chain for libraries + such as mingw32 and mingwex can be broken down. + + 2) The number of duplicate symbols, since now only symbols that are + true duplicates will display the error. */ static /*Str*/HashTable *symhash; @@ -2711,6 +2721,9 @@ int ocTryLoad (ObjectCode* oc) { This call is intended to have no side-effects when a non-duplicate symbol is re-inserted. + + TODO: SymbolInfo can be moved into ObjectCode in order to be more + memory efficient. See Trac #11816 */ int x; SymbolInfo symbol; From git at git.haskell.org Fri Apr 15 09:57:50 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 15 Apr 2016 09:57:50 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Fix #11797. (3f7832b) Message-ID: <20160415095750.7FE993A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/3f7832bc36f6cca42a33ec274fc5e7808af74a38/ghc >--------------------------------------------------------------- commit 3f7832bc36f6cca42a33ec274fc5e7808af74a38 Author: Richard Eisenberg Date: Wed Apr 6 16:37:22 2016 +0200 Fix #11797. DsMeta curiously omitted quantified tyvars in certain circumstances. This patch means it doesn't. Test case: th/T11797 (cherry picked from commit dd99f2ece1bd139be02beddc6dc672862ee5ae34) >--------------------------------------------------------------- 3f7832bc36f6cca42a33ec274fc5e7808af74a38 compiler/deSugar/DsMeta.hs | 13 +++++++------ docs/users_guide/8.0.1-notes.rst | 8 ++++++++ testsuite/tests/th/T11797.hs | 14 ++++++++++++++ testsuite/tests/th/T11797.stderr | 2 ++ testsuite/tests/th/T8031.hs | 3 ++- testsuite/tests/th/all.T | 1 + 6 files changed, 34 insertions(+), 7 deletions(-) diff --git a/compiler/deSugar/DsMeta.hs b/compiler/deSugar/DsMeta.hs index d221979..a24bbeb 100644 --- a/compiler/deSugar/DsMeta.hs +++ b/compiler/deSugar/DsMeta.hs @@ -872,12 +872,9 @@ repContext ctxt = do preds <- repList typeQTyConName repLTy ctxt repCtxt preds repHsSigType :: LHsSigType Name -> DsM (Core TH.TypeQ) -repHsSigType ty = repLTy (hsSigType ty) - -repHsSigWcType :: LHsSigWcType Name -> DsM (Core TH.TypeQ) -repHsSigWcType (HsIB { hsib_vars = vars - , hsib_body = sig1 }) - | (explicit_tvs, ctxt, ty) <- splitLHsSigmaTy (hswc_body sig1) +repHsSigType (HsIB { hsib_vars = vars + , hsib_body = body }) + | (explicit_tvs, ctxt, ty) <- splitLHsSigmaTy body = addTyVarBinds (HsQTvs { hsq_implicit = [] , hsq_explicit = map (noLoc . UserTyVar . noLoc) vars ++ explicit_tvs @@ -889,6 +886,10 @@ repHsSigWcType (HsIB { hsib_vars = vars then return th_ty else repTForall th_tvs th_ctxt th_ty } +repHsSigWcType :: LHsSigWcType Name -> DsM (Core TH.TypeQ) +repHsSigWcType ib_ty@(HsIB { hsib_body = sig1 }) + = repHsSigType (ib_ty { hsib_body = hswc_body sig1 }) + -- yield the representation of a list of types -- repLTys :: [LHsType Name] -> DsM [Core TH.TypeQ] diff --git a/docs/users_guide/8.0.1-notes.rst b/docs/users_guide/8.0.1-notes.rst index 87aeda5..1d1553c 100644 --- a/docs/users_guide/8.0.1-notes.rst +++ b/docs/users_guide/8.0.1-notes.rst @@ -432,6 +432,14 @@ Template Haskell whether flags such as :ghc-flag:`-XStrictData` or :ghc-flag:`-funbox-strict-fields` are enabled. +- Previously, quoting a type signature like ``a -> a`` would produce the + abstract syntax for ``forall a. a -> a``. This behavior remains, but it + is extended to kinds, too, meaning that ``Proxy a -> Proxy a`` becomes + ``forall k (a :: k). Proxy a -> Proxy a``. This change is not intentional, + but is forced by the fact that GHC has a hard time telling kinds apart + from types. The effect of this change is that round-tripping kind- + polymorphic types will now require :ghc-flag:`-XTypeInType`. + Runtime system ~~~~~~~~~~~~~~ diff --git a/testsuite/tests/th/T11797.hs b/testsuite/tests/th/T11797.hs new file mode 100644 index 0000000..0ee0a04 --- /dev/null +++ b/testsuite/tests/th/T11797.hs @@ -0,0 +1,14 @@ +{-# LANGUAGE TemplateHaskell #-} + +module T11797 where + +import Language.Haskell.TH +import System.IO + +$(do dec <- [d| class Foo a where + meth :: a -> b -> a |] + runIO $ do putStrLn $ pprint dec + hFlush stdout + return [] ) + +-- the key bit is the forall b. in the type of the method diff --git a/testsuite/tests/th/T11797.stderr b/testsuite/tests/th/T11797.stderr new file mode 100644 index 0000000..1b43982 --- /dev/null +++ b/testsuite/tests/th/T11797.stderr @@ -0,0 +1,2 @@ +class Foo_0 a_1 + where meth_2 :: forall b_3 . a_1 -> b_3 -> a_1 diff --git a/testsuite/tests/th/T8031.hs b/testsuite/tests/th/T8031.hs index e71f347..9f06c06 100644 --- a/testsuite/tests/th/T8031.hs +++ b/testsuite/tests/th/T8031.hs @@ -1,9 +1,10 @@ -{-# LANGUAGE TemplateHaskell, RankNTypes, DataKinds, TypeOperators, PolyKinds, +{-# LANGUAGE TemplateHaskell, RankNTypes, TypeOperators, TypeInType, GADTs #-} module T8031 where import Data.Proxy +import Data.Kind data SList :: [k] -> * where SCons :: Proxy h -> Proxy t -> SList (h ': t) diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index 9055430..ccf6e48 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -403,3 +403,4 @@ test('T11145', normal, compile_fail, ['-v0 -dsuppress-uniques']) test('T11463', normal, compile_and_run, ['-v0 -dsuppress-uniques']) test('T11680', normal, compile_fail, ['-v0']) test('T11809', normal, compile, ['-v0']) +test('T11797', normal, compile, ['-v0 -dsuppress-uniques']) From git at git.haskell.org Fri Apr 15 09:57:53 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 15 Apr 2016 09:57:53 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Fix #11814 by throwing more stuff into InScopeSets (6d1d979) Message-ID: <20160415095753.3289D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/6d1d979281c3b2b7e32f6bc50935f5925f89df8b/ghc >--------------------------------------------------------------- commit 6d1d979281c3b2b7e32f6bc50935f5925f89df8b Author: Richard Eisenberg Date: Wed Apr 6 15:24:34 2016 +0200 Fix #11814 by throwing more stuff into InScopeSets (cherry picked from commit 0b6dcf6d2ccac3b43037650279256022a352de53) >--------------------------------------------------------------- 6d1d979281c3b2b7e32f6bc50935f5925f89df8b compiler/stranal/WwLib.hs | 4 +++- compiler/types/Type.hs | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/compiler/stranal/WwLib.hs b/compiler/stranal/WwLib.hs index 3d9ab83..1472ead 100644 --- a/compiler/stranal/WwLib.hs +++ b/compiler/stranal/WwLib.hs @@ -22,6 +22,7 @@ import MkCore ( mkRuntimeErrorApp, aBSENT_ERROR_ID, mkCoreUbxTup ) import MkId ( voidArgId, voidPrimId ) import TysPrim ( voidPrimTy ) import TysWiredIn ( tupleDataCon ) +import VarEnv ( mkInScopeSet ) import Type import Coercion import FamInstEnv @@ -130,7 +131,8 @@ mkWwBodies :: DynFlags mkWwBodies dflags fam_envs fun_ty demands res_info one_shots = do { let arg_info = demands `zip` (one_shots ++ repeat NoOneShotInfo) all_one_shots = foldr (worstOneShot . snd) OneShotLam arg_info - ; (wrap_args, wrap_fn_args, work_fn_args, res_ty) <- mkWWargs emptyTCvSubst fun_ty arg_info + empty_subst = mkEmptyTCvSubst (mkInScopeSet (tyCoVarsOfType fun_ty)) + ; (wrap_args, wrap_fn_args, work_fn_args, res_ty) <- mkWWargs empty_subst fun_ty arg_info ; (useful1, work_args, wrap_fn_str, work_fn_str) <- mkWWstr dflags fam_envs wrap_args -- Do CPR w/w. See Note [Always do CPR w/w] diff --git a/compiler/types/Type.hs b/compiler/types/Type.hs index 7b5922f..7cf13e3 100644 --- a/compiler/types/Type.hs +++ b/compiler/types/Type.hs @@ -1079,9 +1079,9 @@ mkCastTy ty co | isReflexiveCo co = ty mkCastTy (CastTy ty co1) co2 = mkCastTy ty (co1 `mkTransCo` co2) -- See Note [Weird typing rule for ForAllTy] -mkCastTy (ForAllTy (Named tv vis) inner_ty) co +mkCastTy outer_ty@(ForAllTy (Named tv vis) inner_ty) co = -- have to make sure that pushing the co in doesn't capture the bound var - let fvs = tyCoVarsOfCo co + let fvs = tyCoVarsOfCo co `unionVarSet` tyCoVarsOfType outer_ty empty_subst = mkEmptyTCvSubst (mkInScopeSet fvs) (subst, tv') = substTyVarBndr empty_subst tv in From git at git.haskell.org Fri Apr 15 11:45:07 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 15 Apr 2016 11:45:07 +0000 (UTC) Subject: [commit: ghc] master: Kill some unnecessary varSetElems (928d747) Message-ID: <20160415114507.DC3653A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/928d74733975fe4677e2b558d031779f58a0883c/ghc >--------------------------------------------------------------- commit 928d74733975fe4677e2b558d031779f58a0883c Author: Bartosz Nitka Date: Fri Apr 15 04:46:21 2016 -0700 Kill some unnecessary varSetElems When you do `varSetElems (tyCoVarsOfType x)` it's equivalent to `tyCoVarsOfTypeList x`. Why? If you look at the implementation: ``` tyCoVarsOfTypeList ty = runFVList $ tyCoVarsOfTypeAcc ty tyCoVarsOfType ty = runFVSet $ tyCoVarsOfTypeAcc ty ``` they use the same helper function. The helper function returns a deterministically ordered list and a set. The only difference between the two is which part of the result they take. It is redundant to take the set and then immediately convert it to a list. This helps with determinism and we eventually want to replace the uses of `varSetElems` with functions that don't leak the values of uniques. This change gets rid of some instances that are easy to kill. I chose not to annotate every place where I got rid of `varSetElems` with a comment about non-determinism, because once we get rid of `varSetElems` it will not be possible to do the wrong thing. Test Plan: ./validate Reviewers: goldfire, austin, simonmar, bgamari, simonpj Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2115 GHC Trac Issues: #4012 >--------------------------------------------------------------- 928d74733975fe4677e2b558d031779f58a0883c compiler/coreSyn/CoreFVs.hs | 40 ++++++++++++++++++++++++++++++++++++---- compiler/coreSyn/CoreLint.hs | 4 ++-- compiler/deSugar/Desugar.hs | 6 ++++-- compiler/deSugar/DsArrows.hs | 2 +- compiler/deSugar/DsBinds.hs | 4 +++- compiler/main/InteractiveEval.hs | 7 +++---- compiler/main/TidyPgm.hs | 2 +- compiler/specialise/Rules.hs | 4 ++-- compiler/typecheck/TcErrors.hs | 2 +- compiler/typecheck/TcInteract.hs | 2 +- compiler/typecheck/TcSimplify.hs | 5 +++-- compiler/typecheck/TcTyDecls.hs | 4 ++-- compiler/typecheck/TcValidity.hs | 5 +++-- 13 files changed, 62 insertions(+), 25 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 928d74733975fe4677e2b558d031779f58a0883c From git at git.haskell.org Fri Apr 15 11:45:54 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 15 Apr 2016 11:45:54 +0000 (UTC) Subject: [commit: ghc] master: Adjust error check for class method types (e24b3b1) Message-ID: <20160415114554.F2F253A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e24b3b1eeba91bd5b127261652b48eae2d4751b1/ghc >--------------------------------------------------------------- commit e24b3b1eeba91bd5b127261652b48eae2d4751b1 Author: Simon Peyton Jones Date: Fri Apr 15 11:49:23 2016 +0100 Adjust error check for class method types Fixes Trac #11793. Nothing deep here. >--------------------------------------------------------------- e24b3b1eeba91bd5b127261652b48eae2d4751b1 compiler/typecheck/TcTyClsDecls.hs | 23 +++++++++++++++++++--- testsuite/tests/typecheck/should_compile/T11793.hs | 8 ++++++++ testsuite/tests/typecheck/should_compile/all.T | 1 + 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/compiler/typecheck/TcTyClsDecls.hs b/compiler/typecheck/TcTyClsDecls.hs index 7ad7bb4..1325966 100644 --- a/compiler/typecheck/TcTyClsDecls.hs +++ b/compiler/typecheck/TcTyClsDecls.hs @@ -2377,9 +2377,12 @@ checkValidClass cls (_,theta2,_) = tcSplitSigmaTy tau1 check_constraint :: TcPredType -> TcM () - check_constraint pred - = when (tyCoVarsOfType pred `subVarSet` cls_tv_set) + check_constraint pred -- See Note [Class method constraints] + = when (not (isEmptyVarSet pred_tvs) && + pred_tvs `subVarSet` cls_tv_set) (addErrTc (badMethPred sel_id pred)) + where + pred_tvs = tyCoVarsOfType pred check_at (ATI fam_tc m_dflt_rhs) = do { checkTc (cls_arity == 0 || any (`elemVarSet` cls_tv_set) fam_tvs) @@ -2420,7 +2423,21 @@ checkFamFlag tc_name err_msg = hang (text "Illegal family declaration for" <+> quotes (ppr tc_name)) 2 (text "Use TypeFamilies to allow indexed type families") -{- +{- Note [Class method constraints] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Haskell 2010 is supposed to reject + class C a where + op :: Eq a => a -> a +where the method type costrains only the class variable(s). (The extension +-XConstrainedClassMethods switches off this check.) But regardless +we should not reject + class C a where + op :: (?x::Int) => a -> a +as pointed out in Trac #11793. So the test here rejects the program if + * -XConstrainedClassMethods is off + * the tyvars of the constraint are non-empty + * all the tyvars are class tyvars, none are locally quantified + Note [Abort when superclass cycle is detected] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ We must avoid doing the ambiguity check for the methods (in diff --git a/testsuite/tests/typecheck/should_compile/T11793.hs b/testsuite/tests/typecheck/should_compile/T11793.hs new file mode 100644 index 0000000..f42a623 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T11793.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE ImplicitParams #-} + +module T11793 where + +class C a where + op :: (?x::Int) => a -> a + +-- Should be OK even without ConstrainedClassMethods diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index bd973f1..8046fa3 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -512,3 +512,4 @@ test('T11699', normal, compile, ['']) test('T11512', normal, compile, ['']) test('T11754', normal, compile, ['']) test('T11811', normal, compile, ['']) +test('T11793', normal, compile, ['']) From git at git.haskell.org Fri Apr 15 11:45:57 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 15 Apr 2016 11:45:57 +0000 (UTC) Subject: [commit: ghc] master: Comments only (2acfaae) Message-ID: <20160415114557.A4D0B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2acfaae9a99da6b7347cf21b38587f7fd251091c/ghc >--------------------------------------------------------------- commit 2acfaae9a99da6b7347cf21b38587f7fd251091c Author: Simon Peyton Jones Date: Fri Apr 15 11:48:47 2016 +0100 Comments only >--------------------------------------------------------------- 2acfaae9a99da6b7347cf21b38587f7fd251091c compiler/stranal/DmdAnal.hs | 30 ++++++++++++++++-------------- compiler/stranal/WorkWrap.hs | 13 +++++-------- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/compiler/stranal/DmdAnal.hs b/compiler/stranal/DmdAnal.hs index 4d3fd09..9a8999a 100644 --- a/compiler/stranal/DmdAnal.hs +++ b/compiler/stranal/DmdAnal.hs @@ -1335,28 +1335,30 @@ field of the AnalEnv. Note [Final Demand Analyser run] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Some of the information that the demand analyser determines is not always -preserved by the simplifier, for example, the simplifier will happily rewrite +preserved by the simplifier. For example, the simplifier will happily rewrite \y [Demand=1*U] let x = y in x + x to \y [Demand=1*U] y + y which is quite a lie. -The once-used information is (currently) only used by the code generator, though. So we - * do not bother keeping this information up-to-date in the simplifier, or - removing it after the demand analyser is done (keeping in mind not to - critically rely on this information in, say, the simplifier). - It should still be fine to use this as in heuristics, e.g. when deciding to - inline things, as the data will usually be correct. - * Just before TidyCore, we add a pass of the demand analyse, without - subsequent worker/wrapper and simplifier, right before TidyCore. - This way, correct information finds its way into the module interface +The once-used information is (currently) only used by the code +generator, though. So: + + * We zap the used-once info in the woker-wrapper; + see Note [Zapping Used Once info in WorkWrap] in WorkWrap. If it's + not reliable, it's better not to have it at all. + + * Just before TidyCore, we add a pass of the demand analyser, + but WITHOUT subsequent worker/wrapper and simplifier, + right before TidyCore. See SimplCore.getCoreToDo. + + This way, correct information finds its way into the module interface (strictness signatures!) and the code generator (single-entry thunks!) -Note that the single-call information (C1(..)) can be relied upon, as the -simplifier tends to be very careful about not duplicating actual function -calls. +Note that, in contrast, the single-call information (C1(..)) /can/ be +relied upon, as the simplifier tends to be very careful about not +duplicating actual function calls. Also see #11731. -} diff --git a/compiler/stranal/WorkWrap.hs b/compiler/stranal/WorkWrap.hs index e557f44..80d966b 100644 --- a/compiler/stranal/WorkWrap.hs +++ b/compiler/stranal/WorkWrap.hs @@ -321,10 +321,7 @@ tryWW dflags fam_envs is_rec fn_id rhs {- Note [Zapping DmdEnv after Demand Analyzer] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -In the worker-wrapper pass we zap the DmdEnv. - -Why? +In the worker-wrapper pass we zap the DmdEnv. Why? (a) it is never used again (b) it wastes space (c) it becomes incorrect as things are cloned, because @@ -336,14 +333,14 @@ Why here? * We want them to be still there at the end of DmdAnal, so that -ddump-str-anal contains them. * We don?t want a second pass just for that. - * WorkWrap looks at all bindings anyways. + * WorkWrap looks at all bindings anyway. -We also need to do it in TidyCore to clean up after the final, -worker/wrapper-less run of the demand analyser. +We also need to do it in TidyCore.tidyLetBndr to clean up after the +final, worker/wrapper-less run of the demand analyser (see +Note [Final Demand Analyser run] in DmdAnal). Note [Zapping Used Once info in WorkWrap] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - In the worker-wrapper pass we zap the used once info in demands and in strictness signatures. From git at git.haskell.org Fri Apr 15 13:27:50 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 15 Apr 2016 13:27:50 +0000 (UTC) Subject: [commit: ghc] master: Remove some gratitious varSetElemsWellScoped (31e4974) Message-ID: <20160415132750.0350F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/31e49746a5f2193e3a2161ea6e279e95b9068048/ghc >--------------------------------------------------------------- commit 31e49746a5f2193e3a2161ea6e279e95b9068048 Author: Bartosz Nitka Date: Fri Apr 15 04:48:45 2016 -0700 Remove some gratitious varSetElemsWellScoped Summary: `varSetElemsWellScoped` uses `varSetElems` under the hood which introduces unnecessary nondeterminism. This does the same thing, possibly cheaper, while preserving determinism. Test Plan: ./validate Reviewers: simonmar, goldfire, austin, bgamari, simonpj Reviewed By: simonpj Subscribers: thomie, RyanGlScott Differential Revision: https://phabricator.haskell.org/D2116 GHC Trac Issues: #4012 >--------------------------------------------------------------- 31e49746a5f2193e3a2161ea6e279e95b9068048 compiler/typecheck/TcClassDcl.hs | 13 ++++++------- compiler/typecheck/TcDeriv.hs | 8 ++++---- compiler/typecheck/TcGenGenerics.hs | 12 ++++++------ 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/compiler/typecheck/TcClassDcl.hs b/compiler/typecheck/TcClassDcl.hs index 602ef64..48b0e56 100644 --- a/compiler/typecheck/TcClassDcl.hs +++ b/compiler/typecheck/TcClassDcl.hs @@ -26,7 +26,7 @@ import TcBinds import TcUnify import TcHsType import TcMType -import Type ( getClassPredTys_maybe, varSetElemsWellScoped, piResultTys ) +import Type ( getClassPredTys_maybe, piResultTys ) import TcType import TcRnMonad import BuildTyCl( TcMethInfo ) @@ -41,7 +41,6 @@ import NameEnv import NameSet import Var import VarEnv -import VarSet import Outputable import SrcLoc import TyCon @@ -53,7 +52,7 @@ import BooleanFormula import Util import Control.Monad -import Data.List ( mapAccumL ) +import Data.List ( mapAccumL, partition ) {- Dictionary handling @@ -454,10 +453,10 @@ tcATDefault emit_warn loc inst_subst defined_ats (ATI fam_tc defs) = do { let (subst', pat_tys') = mapAccumL subst_tv inst_subst (tyConTyVars fam_tc) rhs' = substTyUnchecked subst' rhs_ty - tcv_set' = tyCoVarsOfTypes pat_tys' - (tv_set', cv_set') = partitionVarSet isTyVar tcv_set' - tvs' = varSetElemsWellScoped tv_set' - cvs' = varSetElemsWellScoped cv_set' + tcv' = tyCoVarsOfTypesList pat_tys' + (tv', cv') = partition isTyVar tcv' + tvs' = toposortTyVars tv' + cvs' = toposortTyVars cv' ; rep_tc_name <- newFamInstTyConName (L loc (tyConName fam_tc)) pat_tys' ; let axiom = mkSingleCoAxiom Nominal rep_tc_name tvs' cvs' fam_tc pat_tys' rhs' diff --git a/compiler/typecheck/TcDeriv.hs b/compiler/typecheck/TcDeriv.hs index d3c9295..d88686f 100644 --- a/compiler/typecheck/TcDeriv.hs +++ b/compiler/typecheck/TcDeriv.hs @@ -1586,7 +1586,7 @@ mkNewTypeEqn dflags overlap_mode tvs case mtheta of Just theta -> return $ GivenTheta $ DS { ds_loc = loc - , ds_name = dfun_name, ds_tvs = varSetElemsWellScoped dfun_tvs + , ds_name = dfun_name, ds_tvs = dfun_tvs , ds_cls = cls, ds_tys = inst_tys , ds_tc = rep_tycon , ds_theta = theta @@ -1594,7 +1594,7 @@ mkNewTypeEqn dflags overlap_mode tvs , ds_newtype = Just rep_inst_ty } Nothing -> return $ InferTheta $ DS { ds_loc = loc - , ds_name = dfun_name, ds_tvs = varSetElemsWellScoped dfun_tvs + , ds_name = dfun_name, ds_tvs = dfun_tvs , ds_cls = cls, ds_tys = inst_tys , ds_tc = rep_tycon , ds_theta = all_preds @@ -1689,7 +1689,7 @@ mkNewTypeEqn dflags overlap_mode tvs -- Next we figure out what superclass dictionaries to use -- See Note [Newtype deriving superclasses] above cls_tyvars = classTyVars cls - dfun_tvs = tyCoVarsOfTypes inst_tys + dfun_tvs = tyCoVarsOfTypesWellScoped inst_tys inst_ty = mkTyConApp tycon tc_args inst_tys = cls_tys ++ [inst_ty] sc_theta = mkThetaOrigin DerivOrigin TypeLevel $ @@ -1701,7 +1701,7 @@ mkNewTypeEqn dflags overlap_mode tvs -- newtype type; precisely the constraints required for the -- calls to coercible that we are going to generate. coercible_constraints = - [ let (Pair t1 t2) = mkCoerceClassMethEqn cls (varSetElemsWellScoped dfun_tvs) inst_tys rep_inst_ty meth + [ let (Pair t1 t2) = mkCoerceClassMethEqn cls dfun_tvs inst_tys rep_inst_ty meth in mkPredOrigin (DerivOriginCoerce meth t1 t2) TypeLevel (mkReprPrimEqPred t1 t2) | meth <- classMethods cls ] diff --git a/compiler/typecheck/TcGenGenerics.hs b/compiler/typecheck/TcGenGenerics.hs index 03b4d65..ebe9303 100644 --- a/compiler/typecheck/TcGenGenerics.hs +++ b/compiler/typecheck/TcGenGenerics.hs @@ -37,13 +37,13 @@ import ErrUtils( Validity(..), andValid ) import SrcLoc import Bag import VarEnv -import VarSet (elemVarSet, partitionVarSet) +import VarSet (elemVarSet) import Outputable import FastString import Util import Control.Monad (mplus) -import Data.List (zip4) +import Data.List (zip4, partition) import Data.Maybe (isJust) #include "HsVersions.h" @@ -395,10 +395,10 @@ tc_mkRepFamInsts gk tycon inst_ty mod = in_scope = mkInScopeSet (tyCoVarsOfType inst_ty) subst = mkTvSubst in_scope env repTy' = substTy subst repTy - tcv_set' = tyCoVarsOfType inst_ty - (tv_set', cv_set') = partitionVarSet isTyVar tcv_set' - tvs' = varSetElemsWellScoped tv_set' - cvs' = varSetElemsWellScoped cv_set' + tcv' = tyCoVarsOfTypeList inst_ty + (tv', cv') = partition isTyVar tcv' + tvs' = toposortTyVars tv' + cvs' = toposortTyVars cv' axiom = mkSingleCoAxiom Nominal rep_name tvs' cvs' fam_tc [inst_ty] repTy' From git at git.haskell.org Fri Apr 15 13:27:52 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 15 Apr 2016 13:27:52 +0000 (UTC) Subject: [commit: ghc] master: Increase an InScopeSet for a substitution (8d66765) Message-ID: <20160415132752.A11093A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8d66765c4de22c01b8ae97570ed6c5f5c1a16a35/ghc >--------------------------------------------------------------- commit 8d66765c4de22c01b8ae97570ed6c5f5c1a16a35 Author: Richard Eisenberg Date: Tue Apr 12 12:00:55 2016 -0400 Increase an InScopeSet for a substitution This is a further fix for #11814 >--------------------------------------------------------------- 8d66765c4de22c01b8ae97570ed6c5f5c1a16a35 compiler/types/FamInstEnv.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/types/FamInstEnv.hs b/compiler/types/FamInstEnv.hs index 020dd78..62906dd 100644 --- a/compiler/types/FamInstEnv.hs +++ b/compiler/types/FamInstEnv.hs @@ -515,7 +515,8 @@ compatibleBranches (CoAxBranch { cab_lhs = lhs1, cab_rhs = rhs1 }) = case tcUnifyTysFG (const BindMe) lhs1 lhs2 of SurelyApart -> True Unifiable subst - | Type.substTy subst rhs1 `eqType` Type.substTy subst rhs2 + | Type.substTyAddInScope subst rhs1 `eqType` + Type.substTyAddInScope subst rhs2 -> True _ -> False From git at git.haskell.org Fri Apr 15 14:22:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 15 Apr 2016 14:22:03 +0000 (UTC) Subject: [commit: ghc] master: rel-notes: Add note about UndecidableSuperClasses and #11762 (933abfa) Message-ID: <20160415142203.697C33A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/933abfa7ec88bd91e60a62e51bb2f9a068d379f1/ghc >--------------------------------------------------------------- commit 933abfa7ec88bd91e60a62e51bb2f9a068d379f1 Author: Ben Gamari Date: Fri Apr 15 11:41:45 2016 +0200 rel-notes: Add note about UndecidableSuperClasses and #11762 Test Plan: Read it Reviewers: austin, kosmikus Reviewed By: kosmikus Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2111 GHC Trac Issues: #11318, #11762 >--------------------------------------------------------------- 933abfa7ec88bd91e60a62e51bb2f9a068d379f1 docs/users_guide/8.0.1-notes.rst | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/docs/users_guide/8.0.1-notes.rst b/docs/users_guide/8.0.1-notes.rst index dcbd104..93c9ec3 100644 --- a/docs/users_guide/8.0.1-notes.rst +++ b/docs/users_guide/8.0.1-notes.rst @@ -203,6 +203,31 @@ Language In previous versions of GHC, this required a workaround via an explicit export list in ``Bar``. +- GHC has grown a :ghc-flag:`-XUndecidableSuperClasses` language extension, + which relaxes GHC's recursive superclass check (see :ghc-ticket:`11318`). + This allows class definitions which have mutually recursive superclass + constraints at the expense of potential non-termination in the solver. + +- The compiler is now a bit more conservative in solving constraints previously + provided by superclasses (see :ghc-ticket:`11762`). For instance, consider + this program,:: + + {-# LANGUAGE FlexibleInstances #-} + {-# LANGUAGE UndecidableInstances #-} + + class Super a + class (Super a) => Left a + class (Super a) => Right a + instance (Left a) => Right a -- this is now an error + + GHC now rejects this instance, claiming it cannot deduce the ``Super a`` + superclass constraint of the ``Right`` typeclass. This stands in contrast to + previous releases, which would accept this declaration, using the ``Super a`` + constraint implied by the ``Left a`` constraint. To fix this simply add the + needed superclass constraint explicitly, :: + + instance (Left a, Super a) => Right a + - :ghc-flag:`-XDeriveFoldable` and :ghc-flag:`-XDeriveTraversable` now generate code without superfluous ``mempty`` or ``pure`` expressions. As a result, :ghc-flag:`-XDeriveTraversable` now works on datatypes that contain From git at git.haskell.org Fri Apr 15 14:22:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 15 Apr 2016 14:22:06 +0000 (UTC) Subject: [commit: ghc] master: utils: Provide CallStack to expectJust (10c6df0) Message-ID: <20160415142206.197343A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/10c6df007cd85f3ad1c0ab67c177c23781b579bb/ghc >--------------------------------------------------------------- commit 10c6df007cd85f3ad1c0ab67c177c23781b579bb Author: Ben Gamari Date: Fri Apr 15 11:41:00 2016 +0200 utils: Provide CallStack to expectJust Test Plan: Validate Reviewers: gridaphobe, austin Reviewed By: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2106 >--------------------------------------------------------------- 10c6df007cd85f3ad1c0ab67c177c23781b579bb compiler/utils/Maybes.hs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/compiler/utils/Maybes.hs b/compiler/utils/Maybes.hs index a736e3d..b400fa6 100644 --- a/compiler/utils/Maybes.hs +++ b/compiler/utils/Maybes.hs @@ -1,3 +1,7 @@ +{-# LANGUAGE CPP #-} +{-# LANGUAGE ConstraintKinds #-} +{-# LANGUAGE KindSignatures #-} + {- (c) The University of Glasgow 2006 (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 @@ -22,6 +26,12 @@ import Control.Monad import Control.Monad.Trans.Maybe import Control.Exception (catch, SomeException(..)) import Data.Maybe +#if __GLASGOW_HASKELL__ >= 800 +import GHC.Stack +#else +import GHC.Exts (Constraint) +type HasCallStack = (() :: Constraint) +#endif infixr 4 `orElse` @@ -41,7 +51,7 @@ firstJust a b = firstJusts [a, b] firstJusts :: [Maybe a] -> Maybe a firstJusts = msum -expectJust :: String -> Maybe a -> a +expectJust :: HasCallStack => String -> Maybe a -> a {-# INLINE expectJust #-} expectJust _ (Just x) = x expectJust err Nothing = error ("expectJust " ++ err) From git at git.haskell.org Fri Apr 15 14:22:12 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 15 Apr 2016 14:22:12 +0000 (UTC) Subject: [commit: ghc] master: users-guide: Note change in LLVM support policy (aaaa61c) Message-ID: <20160415142212.2135C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/aaaa61c8b712cc313c140ec15f6044e13a036d1f/ghc >--------------------------------------------------------------- commit aaaa61c8b712cc313c140ec15f6044e13a036d1f Author: Ben Gamari Date: Wed Apr 13 13:41:09 2016 +0200 users-guide: Note change in LLVM support policy >--------------------------------------------------------------- aaaa61c8b712cc313c140ec15f6044e13a036d1f docs/users_guide/8.0.1-notes.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/users_guide/8.0.1-notes.rst b/docs/users_guide/8.0.1-notes.rst index 2f011c4..dcbd104 100644 --- a/docs/users_guide/8.0.1-notes.rst +++ b/docs/users_guide/8.0.1-notes.rst @@ -219,6 +219,11 @@ Language Compiler ~~~~~~~~ +- The LLVM code generator now supports only LLVM 3.7. This is in contrast to our + previous policy where GHC would try to support a range of LLVM versions + concurrently. We hope that by supporting a narrower range of versions we can + provide more reliable support for each. + - Warnings can now be controlled with ``-W(no-)...`` flags in addition to the old ``-f(no-)warn...`` ones. This was done as the first part of a rewrite of the warning system to provide better control over warnings, From git at git.haskell.org Fri Apr 15 14:22:09 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 15 Apr 2016 14:22:09 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Add T11824 (116088d) Message-ID: <20160415142209.767DA3A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/116088de1dc3188e82f3f79b39f8e92f30ab88d7/ghc >--------------------------------------------------------------- commit 116088de1dc3188e82f3f79b39f8e92f30ab88d7 Author: Ben Gamari Date: Fri Apr 15 11:41:12 2016 +0200 testsuite: Add T11824 Test Plan: Validate Reviewers: goldfire, austin Reviewed By: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2107 GHC Trac Issues: #11824 >--------------------------------------------------------------- 116088de1dc3188e82f3f79b39f8e92f30ab88d7 .../tests/{driver/rtsOpts.hs => typecheck/T11824/T11824.hs} | 1 + testsuite/tests/typecheck/T11824/TyCon.hs | 10 ++++++++++ testsuite/tests/typecheck/T11824/Type.hs | 11 +++++++++++ testsuite/tests/typecheck/T11824/Type.hs-boot | 10 ++++++++++ .../typecheck/T11824/Unbound/Generics/LocallyNameless.hs | 11 +++++++++++ testsuite/tests/typecheck/T11824/all.T | 1 + 6 files changed, 44 insertions(+) diff --git a/testsuite/tests/driver/rtsOpts.hs b/testsuite/tests/typecheck/T11824/T11824.hs similarity index 72% copy from testsuite/tests/driver/rtsOpts.hs copy to testsuite/tests/typecheck/T11824/T11824.hs index 0634af0..ee80e4e 100644 --- a/testsuite/tests/driver/rtsOpts.hs +++ b/testsuite/tests/typecheck/T11824/T11824.hs @@ -1,3 +1,4 @@ +import Type main :: IO () main = return () diff --git a/testsuite/tests/typecheck/T11824/TyCon.hs b/testsuite/tests/typecheck/T11824/TyCon.hs new file mode 100644 index 0000000..1d74337 --- /dev/null +++ b/testsuite/tests/typecheck/T11824/TyCon.hs @@ -0,0 +1,10 @@ +module TyCon where + +import Unbound.Generics.LocallyNameless (Alpha (..)) +import {-# SOURCE #-} Type (TyName) + +data AlgTyConRhs + = NewTyCon TyName + +instance Alpha AlgTyConRhs where + isTerm (NewTyCon nm) = isTerm nm diff --git a/testsuite/tests/typecheck/T11824/Type.hs b/testsuite/tests/typecheck/T11824/Type.hs new file mode 100644 index 0000000..7b0a399 --- /dev/null +++ b/testsuite/tests/typecheck/T11824/Type.hs @@ -0,0 +1,11 @@ +module Type where + +import Unbound.Generics.LocallyNameless (Alpha (..),Name) +import TyCon + +data TType = VarTy + +type TyName = Name TType + +instance Alpha TType where + isTerm VarTy = False diff --git a/testsuite/tests/typecheck/T11824/Type.hs-boot b/testsuite/tests/typecheck/T11824/Type.hs-boot new file mode 100644 index 0000000..3a847b9 --- /dev/null +++ b/testsuite/tests/typecheck/T11824/Type.hs-boot @@ -0,0 +1,10 @@ +module Type where + +import Unbound.Generics.LocallyNameless (Name) +import Data.Typeable + +data TType + +type TyName = Name TType + +instance Typeable TType diff --git a/testsuite/tests/typecheck/T11824/Unbound/Generics/LocallyNameless.hs b/testsuite/tests/typecheck/T11824/Unbound/Generics/LocallyNameless.hs new file mode 100644 index 0000000..e2c63da --- /dev/null +++ b/testsuite/tests/typecheck/T11824/Unbound/Generics/LocallyNameless.hs @@ -0,0 +1,11 @@ +module Unbound.Generics.LocallyNameless where + +import Data.Typeable (Typeable) + +data Name a = Name + +class Alpha a where + isTerm :: a -> Bool + +instance Typeable a => Alpha (Name a) where + isTerm _ = False diff --git a/testsuite/tests/typecheck/T11824/all.T b/testsuite/tests/typecheck/T11824/all.T new file mode 100644 index 0000000..90aaa1e --- /dev/null +++ b/testsuite/tests/typecheck/T11824/all.T @@ -0,0 +1 @@ +test('T11824', expect_broken(11824), compile_and_run, ['']) \ No newline at end of file From git at git.haskell.org Fri Apr 15 14:22:15 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 15 Apr 2016 14:22:15 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Add test for #11827 (cb0d29b) Message-ID: <20160415142215.7B57B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cb0d29b21ccadde681f80f9e414f78ab42a203c7/ghc >--------------------------------------------------------------- commit cb0d29b21ccadde681f80f9e414f78ab42a203c7 Author: Ben Gamari Date: Fri Apr 15 11:41:24 2016 +0200 testsuite: Add test for #11827 Test Plan: Validate Reviewers: austin Reviewed By: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2109 GHC Trac Issues: #11827 >--------------------------------------------------------------- cb0d29b21ccadde681f80f9e414f78ab42a203c7 testsuite/tests/ghci/T11827/A.hs | 6 ++++++ testsuite/tests/ghci/T11827/A.hs-boot | 5 +++++ testsuite/tests/ghci/T11827/B.hs | 8 ++++++++ testsuite/tests/ghci/T11827/T11827.script | 1 + testsuite/tests/ghci/T11827/T11827.stderr | 2 ++ testsuite/tests/ghci/T11827/all.T | 4 ++++ 6 files changed, 26 insertions(+) diff --git a/testsuite/tests/ghci/T11827/A.hs b/testsuite/tests/ghci/T11827/A.hs new file mode 100644 index 0000000..04e4a65 --- /dev/null +++ b/testsuite/tests/ghci/T11827/A.hs @@ -0,0 +1,6 @@ +module A where + +data A = A + +f :: A -> Bool +f C = False diff --git a/testsuite/tests/ghci/T11827/A.hs-boot b/testsuite/tests/ghci/T11827/A.hs-boot new file mode 100644 index 0000000..a863a13 --- /dev/null +++ b/testsuite/tests/ghci/T11827/A.hs-boot @@ -0,0 +1,5 @@ +module A where + +data A + +f :: A -> Bool diff --git a/testsuite/tests/ghci/T11827/B.hs b/testsuite/tests/ghci/T11827/B.hs new file mode 100644 index 0000000..0beccbd --- /dev/null +++ b/testsuite/tests/ghci/T11827/B.hs @@ -0,0 +1,8 @@ +module B where + +import {-# SOURCE #-} A + +data B = B A + +g :: B -> Bool +g (B a) = f a diff --git a/testsuite/tests/ghci/T11827/T11827.script b/testsuite/tests/ghci/T11827/T11827.script new file mode 100644 index 0000000..fa13992 --- /dev/null +++ b/testsuite/tests/ghci/T11827/T11827.script @@ -0,0 +1 @@ +:load B.hs \ No newline at end of file diff --git a/testsuite/tests/ghci/T11827/T11827.stderr b/testsuite/tests/ghci/T11827/T11827.stderr new file mode 100644 index 0000000..84f3cea --- /dev/null +++ b/testsuite/tests/ghci/T11827/T11827.stderr @@ -0,0 +1,2 @@ + +A.hs:6:3: error: Not in scope: data constructor ?C? diff --git a/testsuite/tests/ghci/T11827/all.T b/testsuite/tests/ghci/T11827/all.T new file mode 100644 index 0000000..d31f6af --- /dev/null +++ b/testsuite/tests/ghci/T11827/all.T @@ -0,0 +1,4 @@ +test('T11827', + [extra_clean(['A.hi', 'A.hi-boot', 'A.o', 'B.hi', 'B.o']), + exit_code(1), expect_broken(11827)], + ghci_script, ['T11827.script']) From git at git.haskell.org Fri Apr 15 14:22:18 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 15 Apr 2016 14:22:18 +0000 (UTC) Subject: [commit: ghc] master: Linker: Fix signedness mismatch (9d063b6) Message-ID: <20160415142218.297D23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9d063b690766af7d805ff015c0a0f69326ea3db7/ghc >--------------------------------------------------------------- commit 9d063b690766af7d805ff015c0a0f69326ea3db7 Author: Ben Gamari Date: Fri Apr 15 11:41:34 2016 +0200 Linker: Fix signedness mismatch Test Plan: Validate on OS X Reviewers: erikd, austin, Phyx Reviewed By: austin, Phyx Subscribers: Phyx, thomie Differential Revision: https://phabricator.haskell.org/D2110 GHC Trac Issues: #11828 >--------------------------------------------------------------- 9d063b690766af7d805ff015c0a0f69326ea3db7 rts/Linker.c | 4 ++-- rts/LinkerInternals.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rts/Linker.c b/rts/Linker.c index 782444a..50f438a 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -6975,7 +6975,7 @@ ocGetNames_MachO(ObjectCode* oc) else { IF_DEBUG(linker, debugBelch("ocGetNames_MachO: inserting %s\n", nm)); - char* addr = image + void* addr = image + sections[nlist[i].n_sect - 1].offset - sections[nlist[i].n_sect - 1].addr + nlist[i].n_value; @@ -6987,7 +6987,7 @@ ocGetNames_MachO(ObjectCode* oc) , HS_BOOL_FALSE , oc); - oc->symbols[curSymbol].name = nm; + oc->symbols[curSymbol].name = nm; oc->symbols[curSymbol].addr = addr; oc->symbols[curSymbol].isWeak = HS_BOOL_FALSE; curSymbol++; diff --git a/rts/LinkerInternals.h b/rts/LinkerInternals.h index 4ff6e99..a34e6f3 100644 --- a/rts/LinkerInternals.h +++ b/rts/LinkerInternals.h @@ -106,7 +106,7 @@ typedef struct _SymbolInfo { char* name; /* The address of the symbol. */ - unsigned char* addr; + void* addr; /* Indicates if the symbol is weak */ HsBool isWeak; From git at git.haskell.org Fri Apr 15 15:31:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 15 Apr 2016 15:31:03 +0000 (UTC) Subject: [commit: ghc] master: Remove dead function SimplUtils.countValArgs (54e67c1) Message-ID: <20160415153103.E4F183A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/54e67c1edf8342f5f82e09ae55152fb4cbb7b64c/ghc >--------------------------------------------------------------- commit 54e67c1edf8342f5f82e09ae55152fb4cbb7b64c Author: Simon Peyton Jones Date: Fri Apr 8 17:28:44 2016 +0100 Remove dead function SimplUtils.countValArgs >--------------------------------------------------------------- 54e67c1edf8342f5f82e09ae55152fb4cbb7b64c compiler/simplCore/SimplUtils.hs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/compiler/simplCore/SimplUtils.hs b/compiler/simplCore/SimplUtils.hs index 48650c3..0e40343 100644 --- a/compiler/simplCore/SimplUtils.hs +++ b/compiler/simplCore/SimplUtils.hs @@ -21,7 +21,7 @@ module SimplUtils ( isSimplified, contIsDupable, contResultType, contHoleType, contIsTrivial, contArgs, - countValArgs, countArgs, + countArgs, mkBoringStop, mkRhsStop, mkLazyArgStop, contIsRhsOrArg, interestingCallContext, @@ -359,13 +359,6 @@ contHoleType (Select { sc_dup = d, sc_bndr = b, sc_env = se }) = perhapsSubstTy d se (idType b) ------------------- -countValArgs :: SimplCont -> Int --- Count value arguments excluding coercions -countValArgs (ApplyToVal { sc_arg = arg, sc_cont = cont }) - | Coercion {} <- arg = countValArgs cont - | otherwise = 1 + countValArgs cont -countValArgs _ = 0 - countArgs :: SimplCont -> Int -- Count all arguments, including types, coercions, and other values countArgs (ApplyToTy { sc_cont = cont }) = 1 + countArgs cont From git at git.haskell.org Fri Apr 15 15:31:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 15 Apr 2016 15:31:06 +0000 (UTC) Subject: [commit: ghc] master: Comments only, on Type.topSortTyVars (f0e331b) Message-ID: <20160415153106.A0F713A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f0e331bd9233669ef615f67e0b9e886b2ff13850/ghc >--------------------------------------------------------------- commit f0e331bd9233669ef615f67e0b9e886b2ff13850 Author: Simon Peyton Jones Date: Fri Apr 8 17:29:41 2016 +0100 Comments only, on Type.topSortTyVars >--------------------------------------------------------------- f0e331bd9233669ef615f67e0b9e886b2ff13850 compiler/types/Type.hs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/compiler/types/Type.hs b/compiler/types/Type.hs index 8901968..57cd64a 100644 --- a/compiler/types/Type.hs +++ b/compiler/types/Type.hs @@ -1857,8 +1857,13 @@ typeSize (CoercionTy co) = coercionSize co ************************************************************************ -} --- | Do a topological sort on a list of tyvars. This is a deterministic --- sorting operation (that is, doesn't depend on Uniques). +-- | Do a topological sort on a list of tyvars, +-- so that binders occur before occurrences +-- E.g. given [ a::k, k::*, b::k ] +-- it'll return a well-scoped list [ k::*, a::k, b::k ] +-- +-- This is a deterministic sorting operation +-- (that is, doesn't depend on Uniques). toposortTyVars :: [TyVar] -> [TyVar] toposortTyVars tvs = reverse $ [ tv | (tv, _, _) <- topologicalSortG $ From git at git.haskell.org Fri Apr 15 15:31:09 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 15 Apr 2016 15:31:09 +0000 (UTC) Subject: [commit: ghc] master: Improve TcFlatten.flattenTyVar (a7ee2d4) Message-ID: <20160415153109.624143A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a7ee2d4c4229b27af324ebac93081f692835365d/ghc >--------------------------------------------------------------- commit a7ee2d4c4229b27af324ebac93081f692835365d Author: Simon Peyton Jones Date: Fri Apr 15 16:17:54 2016 +0100 Improve TcFlatten.flattenTyVar This patch tides up the structure, simplifying FlattenTvResult. It also replaces a use of zonkTcType (which I hated) with coercionKind, in that same function. Happily, the result is little faster, maybe even a percentage point or two, which is a lot for a compiler. This also removes the line || not (map binderVisibility bndrs1 == map binderVisibility bndrs2) from TcCanonical.can_eq_nc', in the ForAllTy/ForAllTy case. Why? Becuase I can't see why binder-visiblity should matter, and when we use coercionKind instead of zonkTcType in flattenTyVar, this case pops up and rejects a program that should pass. I did discuss this with Richard. >--------------------------------------------------------------- a7ee2d4c4229b27af324ebac93081f692835365d compiler/typecheck/TcCanonical.hs | 7 ++- compiler/typecheck/TcFlatten.hs | 90 +++++++++++++++++-------------------- testsuite/tests/perf/compiler/all.T | 4 +- 3 files changed, 50 insertions(+), 51 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc a7ee2d4c4229b27af324ebac93081f692835365d From git at git.haskell.org Sat Apr 16 16:20:31 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 16 Apr 2016 16:20:31 +0000 (UTC) Subject: [commit: ghc] master: libdw: More precise version check (e9ad489) Message-ID: <20160416162031.7622C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e9ad48935fa48aa32dc39a55512168ba5f5bdbd2/ghc >--------------------------------------------------------------- commit e9ad48935fa48aa32dc39a55512168ba5f5bdbd2 Author: Ben Gamari Date: Fri Apr 15 11:43:41 2016 +0200 libdw: More precise version check Test Plan: Try configure in an environment with older `libdw` Reviewers: hvr, austin Subscribers: thomie, erikd Differential Revision: https://phabricator.haskell.org/D2103 GHC Trac Issues: #11820 >--------------------------------------------------------------- e9ad48935fa48aa32dc39a55512168ba5f5bdbd2 configure.ac | 9 ++++++++- distrib/configure.ac.in | 10 ++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index ff717a1..dd3236c 100644 --- a/configure.ac +++ b/configure.ac @@ -1052,7 +1052,14 @@ if test "$use_large_address_space" = "yes" ; then AC_DEFINE([USE_LARGE_ADDRESS_SPACE], [1], [Enable single heap address space support]) fi -AC_CHECK_LIB(dw, dwfl_begin, [HaveLibdw=YES], [HaveLibdw=NO]) +dnl ** Have libdw? +dnl -------------------------------------------------------------- +AC_ARG_ENABLE(libdw, + [AC_HELP_STRING([--enable-dwarf-unwind], + [Enable DWARF unwinding support in the runtime system via elfutils' libdw [default=no]])], + [AC_CHECK_LIB(dw, dwfl_attach_state, [HaveLibdw=YES], [HaveLibdw=NO])], + [HaveLibdw=NO] +) AC_SUBST(HaveLibdw) if test -n "$SPHINXBUILD"; then diff --git a/distrib/configure.ac.in b/distrib/configure.ac.in index 1df58d5..c0610c6 100644 --- a/distrib/configure.ac.in +++ b/distrib/configure.ac.in @@ -93,8 +93,14 @@ AC_SUBST([LdCmd]) dnl ** Have libdw? dnl -------------------------------------------------------------- -AC_CHECK_LIB(dw, dwfl_begin, [HaveLibdw=YES], [HaveLibdw=NO]) -AC_SUBST(HaveLibdw) +dnl Check for a usable version of libdw/elfutils +dnl Currently we need 0.158 or newer. +BinDistNeedsLibdw=@HaveLibdw@ +if test "x$BinDistNeedsLibdw" = "xyes" ; then + AC_CHECK_LIB(dw, dwfl_attach_state, [HaveLibdw=YES], + [AC_MSG_ERROR([Binary distribution was built with libdw support but target system doesn't have supported libdw version (needs at least 0.158)])] + )]; +fi FP_GCC_VERSION AC_PROG_CPP From git at git.haskell.org Sat Apr 16 16:20:34 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 16 Apr 2016 16:20:34 +0000 (UTC) Subject: [commit: ghc] master: rts/RetainerProfile: Remove unused local (d77981e) Message-ID: <20160416162034.2F9AE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d77981ed4347e5feb0497d8161af72f8f5e10b65/ghc >--------------------------------------------------------------- commit d77981ed4347e5feb0497d8161af72f8f5e10b65 Author: Ben Gamari Date: Fri Apr 15 11:54:54 2016 +0200 rts/RetainerProfile: Remove unused local Reported in #11777. >--------------------------------------------------------------- d77981ed4347e5feb0497d8161af72f8f5e10b65 rts/RetainerProfile.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/rts/RetainerProfile.c b/rts/RetainerProfile.c index 6a6a542..42d5f29 100644 --- a/rts/RetainerProfile.c +++ b/rts/RetainerProfile.c @@ -2068,8 +2068,6 @@ retainerProfile(void) static nat sanityCheckHeapClosure( StgClosure *c ) { - StgInfoTable *info; - ASSERT(LOOKS_LIKE_GHC_INFO(c->header.info)); ASSERT(!closure_STATIC(c)); ASSERT(LOOKS_LIKE_PTR(c)); From git at git.haskell.org Sat Apr 16 16:20:36 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 16 Apr 2016 16:20:36 +0000 (UTC) Subject: [commit: ghc] master: deriveConstants: Verify sanity of nm (bf17fd0) Message-ID: <20160416162036.D06543A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/bf17fd0e5b5442a87f507b26e64a30c79732838a/ghc >--------------------------------------------------------------- commit bf17fd0e5b5442a87f507b26e64a30c79732838a Author: Herbert Valerio Riedel Date: Sat Apr 16 15:25:07 2016 +0200 deriveConstants: Verify sanity of nm Add a sanity check ensuring that nm emits valid hexadecimal output, as required by POSIX. See #11744 for motivation. Reviewers: austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2113 GHC Trac Issues: #11744 >--------------------------------------------------------------- bf17fd0e5b5442a87f507b26e64a30c79732838a utils/deriveConstants/Main.hs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/utils/deriveConstants/Main.hs b/utils/deriveConstants/Main.hs index 6a88ac2..96da166 100644 --- a/utils/deriveConstants/Main.hs +++ b/utils/deriveConstants/Main.hs @@ -296,8 +296,12 @@ haskellise "" = "" wanteds :: String -> Wanteds wanteds os = concat - [-- Closure header sizes. - constantWord Both "STD_HDR_SIZE" + [-- Control group constant for integrity check; this + -- round-tripped constant is used for testing that + -- derivedConstant works as expected + constantWord Both "CONTROL_GROUP_CONST_291" "0x123" + -- Closure header sizes. + ,constantWord Both "STD_HDR_SIZE" -- grrr.. PROFILING is on so we need to -- subtract sizeofW(StgProfHeader) "sizeofW(StgHeader) - sizeofW(StgProfHeader)" @@ -682,6 +686,14 @@ getWanted verbose os tmpdir gccProgram gccFlags nmProgram mobjdumpProgram m = Map.fromList $ case os of "aix" -> parseAixObjdump ls _ -> catMaybes $ map parseNmLine ls + + case Map.lookup "CONTROL_GROUP_CONST_291" m of + Just 292 -> return () -- OK + Nothing -> die "CONTROL_GROUP_CONST_291 missing!" + Just 0x292 -> die $ "broken 'nm' detected, see https://ghc.haskell.org/ticket/11744.\n" + ++ "Workaround: You may want to pass '--with-nm=nm-classic' to 'configure'." + Just x -> die ("unexpected value round-tripped for CONTROL_GROUP_CONST_291: " ++ show x) + rs <- mapM (lookupResult m) (wanteds os) return rs where headers = ["#define IN_STG_CODE 0", From git at git.haskell.org Sat Apr 16 16:20:39 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 16 Apr 2016 16:20:39 +0000 (UTC) Subject: [commit: ghc] master: Bump haddock submodule (f4e6591) Message-ID: <20160416162039.863AE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f4e659121960eb81d5478f0b20d4cf6f4c0ed0d9/ghc >--------------------------------------------------------------- commit f4e659121960eb81d5478f0b20d4cf6f4c0ed0d9 Author: Ben Gamari Date: Sat Apr 16 17:53:08 2016 +0200 Bump haddock submodule >--------------------------------------------------------------- f4e659121960eb81d5478f0b20d4cf6f4c0ed0d9 utils/haddock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/haddock b/utils/haddock index c6d6a18..a77728c 160000 --- a/utils/haddock +++ b/utils/haddock @@ -1 +1 @@ -Subproject commit c6d6a18d85e5e2d9bb5904e6919e8a8d7e31c4c5 +Subproject commit a77728cc274751e8b8077b3ccc8aacc7d00bf36d From git at git.haskell.org Sat Apr 16 16:20:42 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 16 Apr 2016 16:20:42 +0000 (UTC) Subject: [commit: ghc] master: Rework CC/CC_STAGE0 handling in `configure.ac` (865602e) Message-ID: <20160416162042.436763A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/865602e0beb8e30ea1e1edf7db90f24088badb9e/ghc >--------------------------------------------------------------- commit 865602e0beb8e30ea1e1edf7db90f24088badb9e Author: Herbert Valerio Riedel Date: Sat Apr 16 18:12:09 2016 +0200 Rework CC/CC_STAGE0 handling in `configure.ac` Rather than using the non-standard/idiomatic `--with-{gcc,clang}=...` scheme use the `CC=...` style scheme. The basic idea is to have Autoconf's CC/CFLAG/CPPFLAG apply to stage{1,2,3}, while having a separate _STAGE0 set of env-vars denote the bootstrap-toolchain flags/programs. This should be simpler, less confusing, and somewhat more in line with Autoconf's idioms (allowing us to reuse more of Autoconf rather than (re)inventing our own confusing non-standard m4 macros to do stuff that Autoconf could almost do already for us) Morever, expose CC_STAGE0 as a so-called "precious" variable. So now we can better control which bootstrapping gcc is used (by default the one used by the stage0 ghc, unless CC_STAGE0 is overriden) ``` Some influential environment variables: CC_STAGE0 C compiler command (bootstrap) CC C compiler command CFLAGS C compiler flags ... Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. ``` Test Plan: I've tested that cross-compiling with `--target=powerpc-linux-gnu` still works, and tried a few variants of settting `CC=` and `CC_STAGE0=`; `./validate` passed as well Reviewers: erikd, austin, bgamari, simonmar Reviewed By: simonmar Subscribers: Phyx, thomie Differential Revision: https://phabricator.haskell.org/D2078 >--------------------------------------------------------------- 865602e0beb8e30ea1e1edf7db90f24088badb9e aclocal.m4 | 38 +++----------------------------------- bindisttest/ghc.mk | 2 +- configure.ac | 37 +++++++++++++++++++++++++++++-------- distrib/configure.ac.in | 4 +--- includes/ghc.mk | 2 +- mk/config.mk.in | 10 +++++----- rts/ghc.mk | 2 +- rules/shell-wrapper.mk | 2 +- 8 files changed, 42 insertions(+), 55 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 865602e0beb8e30ea1e1edf7db90f24088badb9e From git at git.haskell.org Sat Apr 16 17:29:13 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 16 Apr 2016 17:29:13 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: users-guide: Note change in LLVM support policy (e9e100f) Message-ID: <20160416172913.A06013A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/e9e100f3daac94034c1a14b3a35bd49093a535f4/ghc >--------------------------------------------------------------- commit e9e100f3daac94034c1a14b3a35bd49093a535f4 Author: Ben Gamari Date: Wed Apr 13 13:41:09 2016 +0200 users-guide: Note change in LLVM support policy (cherry picked from commit aaaa61c8b712cc313c140ec15f6044e13a036d1f) >--------------------------------------------------------------- e9e100f3daac94034c1a14b3a35bd49093a535f4 docs/users_guide/8.0.1-notes.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/users_guide/8.0.1-notes.rst b/docs/users_guide/8.0.1-notes.rst index 1d1553c..9b4824cd 100644 --- a/docs/users_guide/8.0.1-notes.rst +++ b/docs/users_guide/8.0.1-notes.rst @@ -211,6 +211,11 @@ Language Compiler ~~~~~~~~ +- The LLVM code generator now supports only LLVM 3.7. This is in contrast to our + previous policy where GHC would try to support a range of LLVM versions + concurrently. We hope that by supporting a narrower range of versions we can + provide more reliable support for each. + - Warnings can now be controlled with ``-W(no-)...`` flags in addition to the old ``-f(no-)warn...`` ones. This was done as the first part of a rewrite of the warning system to provide better control over warnings, From git at git.haskell.org Sat Apr 16 17:29:16 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 16 Apr 2016 17:29:16 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: rel-notes: Add note about UndecidableSuperClasses and #11762 (92f598b) Message-ID: <20160416172916.4EBE83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/92f598b6d89aa3bd3c551e59f63d0f24605b700b/ghc >--------------------------------------------------------------- commit 92f598b6d89aa3bd3c551e59f63d0f24605b700b Author: Ben Gamari Date: Fri Apr 15 11:41:45 2016 +0200 rel-notes: Add note about UndecidableSuperClasses and #11762 Test Plan: Read it Reviewers: austin, kosmikus Reviewed By: kosmikus Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2111 GHC Trac Issues: #11318, #11762 (cherry picked from commit 933abfa7ec88bd91e60a62e51bb2f9a068d379f1) >--------------------------------------------------------------- 92f598b6d89aa3bd3c551e59f63d0f24605b700b docs/users_guide/8.0.1-notes.rst | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/docs/users_guide/8.0.1-notes.rst b/docs/users_guide/8.0.1-notes.rst index 9b4824cd..fe76b3a 100644 --- a/docs/users_guide/8.0.1-notes.rst +++ b/docs/users_guide/8.0.1-notes.rst @@ -195,6 +195,31 @@ Language In previous versions of GHC, this required a workaround via an explicit export list in ``Bar``. +- GHC has grown a :ghc-flag:`-XUndecidableSuperClasses` language extension, + which relaxes GHC's recursive superclass check (see :ghc-ticket:`11318`). + This allows class definitions which have mutually recursive superclass + constraints at the expense of potential non-termination in the solver. + +- The compiler is now a bit more conservative in solving constraints previously + provided by superclasses (see :ghc-ticket:`11762`). For instance, consider + this program,:: + + {-# LANGUAGE FlexibleInstances #-} + {-# LANGUAGE UndecidableInstances #-} + + class Super a + class (Super a) => Left a + class (Super a) => Right a + instance (Left a) => Right a -- this is now an error + + GHC now rejects this instance, claiming it cannot deduce the ``Super a`` + superclass constraint of the ``Right`` typeclass. This stands in contrast to + previous releases, which would accept this declaration, using the ``Super a`` + constraint implied by the ``Left a`` constraint. To fix this simply add the + needed superclass constraint explicitly, :: + + instance (Left a, Super a) => Right a + - :ghc-flag:`-XDeriveFoldable` and :ghc-flag:`-XDeriveTraversable` now generate code without superfluous ``mempty`` or ``pure`` expressions. As a result, :ghc-flag:`-XDeriveTraversable` now works on datatypes that contain From git at git.haskell.org Sat Apr 16 17:29:19 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 16 Apr 2016 17:29:19 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Linker: Fix signedness mismatch (7364105) Message-ID: <20160416172919.016CB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/736410552e6ba723f7967ad2b5a869f03b118df6/ghc >--------------------------------------------------------------- commit 736410552e6ba723f7967ad2b5a869f03b118df6 Author: Ben Gamari Date: Fri Apr 15 11:41:34 2016 +0200 Linker: Fix signedness mismatch Test Plan: Validate on OS X Reviewers: erikd, austin, Phyx Reviewed By: austin, Phyx Subscribers: Phyx, thomie Differential Revision: https://phabricator.haskell.org/D2110 GHC Trac Issues: #11828 (cherry picked from commit 9d063b690766af7d805ff015c0a0f69326ea3db7) >--------------------------------------------------------------- 736410552e6ba723f7967ad2b5a869f03b118df6 rts/Linker.c | 4 ++-- rts/LinkerInternals.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rts/Linker.c b/rts/Linker.c index 782444a..50f438a 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -6975,7 +6975,7 @@ ocGetNames_MachO(ObjectCode* oc) else { IF_DEBUG(linker, debugBelch("ocGetNames_MachO: inserting %s\n", nm)); - char* addr = image + void* addr = image + sections[nlist[i].n_sect - 1].offset - sections[nlist[i].n_sect - 1].addr + nlist[i].n_value; @@ -6987,7 +6987,7 @@ ocGetNames_MachO(ObjectCode* oc) , HS_BOOL_FALSE , oc); - oc->symbols[curSymbol].name = nm; + oc->symbols[curSymbol].name = nm; oc->symbols[curSymbol].addr = addr; oc->symbols[curSymbol].isWeak = HS_BOOL_FALSE; curSymbol++; diff --git a/rts/LinkerInternals.h b/rts/LinkerInternals.h index 4ff6e99..a34e6f3 100644 --- a/rts/LinkerInternals.h +++ b/rts/LinkerInternals.h @@ -106,7 +106,7 @@ typedef struct _SymbolInfo { char* name; /* The address of the symbol. */ - unsigned char* addr; + void* addr; /* Indicates if the symbol is weak */ HsBool isWeak; From git at git.haskell.org Sat Apr 16 17:29:22 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 16 Apr 2016 17:29:22 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: testsuite: Add T11824 (73bd0a3) Message-ID: <20160416172922.5567A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/73bd0a38703b5081b14c1d01d2c6b880af125225/ghc >--------------------------------------------------------------- commit 73bd0a38703b5081b14c1d01d2c6b880af125225 Author: Ben Gamari Date: Fri Apr 15 11:41:12 2016 +0200 testsuite: Add T11824 Test Plan: Validate Reviewers: goldfire, austin Reviewed By: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2107 GHC Trac Issues: #11824 (cherry picked from commit 116088de1dc3188e82f3f79b39f8e92f30ab88d7) >--------------------------------------------------------------- 73bd0a38703b5081b14c1d01d2c6b880af125225 .../tests/{driver/rtsOpts.hs => typecheck/T11824/T11824.hs} | 1 + testsuite/tests/typecheck/T11824/TyCon.hs | 10 ++++++++++ testsuite/tests/typecheck/T11824/Type.hs | 11 +++++++++++ testsuite/tests/typecheck/T11824/Type.hs-boot | 10 ++++++++++ .../typecheck/T11824/Unbound/Generics/LocallyNameless.hs | 11 +++++++++++ testsuite/tests/typecheck/T11824/all.T | 1 + 6 files changed, 44 insertions(+) diff --git a/testsuite/tests/driver/rtsOpts.hs b/testsuite/tests/typecheck/T11824/T11824.hs similarity index 72% copy from testsuite/tests/driver/rtsOpts.hs copy to testsuite/tests/typecheck/T11824/T11824.hs index 0634af0..ee80e4e 100644 --- a/testsuite/tests/driver/rtsOpts.hs +++ b/testsuite/tests/typecheck/T11824/T11824.hs @@ -1,3 +1,4 @@ +import Type main :: IO () main = return () diff --git a/testsuite/tests/typecheck/T11824/TyCon.hs b/testsuite/tests/typecheck/T11824/TyCon.hs new file mode 100644 index 0000000..1d74337 --- /dev/null +++ b/testsuite/tests/typecheck/T11824/TyCon.hs @@ -0,0 +1,10 @@ +module TyCon where + +import Unbound.Generics.LocallyNameless (Alpha (..)) +import {-# SOURCE #-} Type (TyName) + +data AlgTyConRhs + = NewTyCon TyName + +instance Alpha AlgTyConRhs where + isTerm (NewTyCon nm) = isTerm nm diff --git a/testsuite/tests/typecheck/T11824/Type.hs b/testsuite/tests/typecheck/T11824/Type.hs new file mode 100644 index 0000000..7b0a399 --- /dev/null +++ b/testsuite/tests/typecheck/T11824/Type.hs @@ -0,0 +1,11 @@ +module Type where + +import Unbound.Generics.LocallyNameless (Alpha (..),Name) +import TyCon + +data TType = VarTy + +type TyName = Name TType + +instance Alpha TType where + isTerm VarTy = False diff --git a/testsuite/tests/typecheck/T11824/Type.hs-boot b/testsuite/tests/typecheck/T11824/Type.hs-boot new file mode 100644 index 0000000..3a847b9 --- /dev/null +++ b/testsuite/tests/typecheck/T11824/Type.hs-boot @@ -0,0 +1,10 @@ +module Type where + +import Unbound.Generics.LocallyNameless (Name) +import Data.Typeable + +data TType + +type TyName = Name TType + +instance Typeable TType diff --git a/testsuite/tests/typecheck/T11824/Unbound/Generics/LocallyNameless.hs b/testsuite/tests/typecheck/T11824/Unbound/Generics/LocallyNameless.hs new file mode 100644 index 0000000..e2c63da --- /dev/null +++ b/testsuite/tests/typecheck/T11824/Unbound/Generics/LocallyNameless.hs @@ -0,0 +1,11 @@ +module Unbound.Generics.LocallyNameless where + +import Data.Typeable (Typeable) + +data Name a = Name + +class Alpha a where + isTerm :: a -> Bool + +instance Typeable a => Alpha (Name a) where + isTerm _ = False diff --git a/testsuite/tests/typecheck/T11824/all.T b/testsuite/tests/typecheck/T11824/all.T new file mode 100644 index 0000000..90aaa1e --- /dev/null +++ b/testsuite/tests/typecheck/T11824/all.T @@ -0,0 +1 @@ +test('T11824', expect_broken(11824), compile_and_run, ['']) \ No newline at end of file From git at git.haskell.org Sat Apr 16 17:29:25 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 16 Apr 2016 17:29:25 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: testsuite: Add test for #11827 (d56bb43) Message-ID: <20160416172925.A7A0E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/d56bb43ea7395d18d253e0b2f31586e41647d0d9/ghc >--------------------------------------------------------------- commit d56bb43ea7395d18d253e0b2f31586e41647d0d9 Author: Ben Gamari Date: Fri Apr 15 11:41:24 2016 +0200 testsuite: Add test for #11827 Test Plan: Validate Reviewers: austin Reviewed By: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2109 GHC Trac Issues: #11827 (cherry picked from commit cb0d29b21ccadde681f80f9e414f78ab42a203c7) >--------------------------------------------------------------- d56bb43ea7395d18d253e0b2f31586e41647d0d9 testsuite/tests/ghci/T11827/A.hs | 6 ++++++ testsuite/tests/ghci/T11827/A.hs-boot | 5 +++++ testsuite/tests/ghci/T11827/B.hs | 8 ++++++++ testsuite/tests/ghci/T11827/T11827.script | 1 + testsuite/tests/ghci/T11827/T11827.stderr | 2 ++ testsuite/tests/ghci/T11827/all.T | 4 ++++ 6 files changed, 26 insertions(+) diff --git a/testsuite/tests/ghci/T11827/A.hs b/testsuite/tests/ghci/T11827/A.hs new file mode 100644 index 0000000..04e4a65 --- /dev/null +++ b/testsuite/tests/ghci/T11827/A.hs @@ -0,0 +1,6 @@ +module A where + +data A = A + +f :: A -> Bool +f C = False diff --git a/testsuite/tests/ghci/T11827/A.hs-boot b/testsuite/tests/ghci/T11827/A.hs-boot new file mode 100644 index 0000000..a863a13 --- /dev/null +++ b/testsuite/tests/ghci/T11827/A.hs-boot @@ -0,0 +1,5 @@ +module A where + +data A + +f :: A -> Bool diff --git a/testsuite/tests/ghci/T11827/B.hs b/testsuite/tests/ghci/T11827/B.hs new file mode 100644 index 0000000..0beccbd --- /dev/null +++ b/testsuite/tests/ghci/T11827/B.hs @@ -0,0 +1,8 @@ +module B where + +import {-# SOURCE #-} A + +data B = B A + +g :: B -> Bool +g (B a) = f a diff --git a/testsuite/tests/ghci/T11827/T11827.script b/testsuite/tests/ghci/T11827/T11827.script new file mode 100644 index 0000000..fa13992 --- /dev/null +++ b/testsuite/tests/ghci/T11827/T11827.script @@ -0,0 +1 @@ +:load B.hs \ No newline at end of file diff --git a/testsuite/tests/ghci/T11827/T11827.stderr b/testsuite/tests/ghci/T11827/T11827.stderr new file mode 100644 index 0000000..84f3cea --- /dev/null +++ b/testsuite/tests/ghci/T11827/T11827.stderr @@ -0,0 +1,2 @@ + +A.hs:6:3: error: Not in scope: data constructor ?C? diff --git a/testsuite/tests/ghci/T11827/all.T b/testsuite/tests/ghci/T11827/all.T new file mode 100644 index 0000000..d31f6af --- /dev/null +++ b/testsuite/tests/ghci/T11827/all.T @@ -0,0 +1,4 @@ +test('T11827', + [extra_clean(['A.hi', 'A.hi-boot', 'A.o', 'B.hi', 'B.o']), + exit_code(1), expect_broken(11827)], + ghci_script, ['T11827.script']) From git at git.haskell.org Sat Apr 16 17:29:28 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 16 Apr 2016 17:29:28 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Bump haddock submodule (c66f756) Message-ID: <20160416172928.539523A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/c66f756cd47ff988d2a99dceabef337bb2067fdf/ghc >--------------------------------------------------------------- commit c66f756cd47ff988d2a99dceabef337bb2067fdf Author: Ben Gamari Date: Sat Apr 16 17:59:15 2016 +0200 Bump haddock submodule >--------------------------------------------------------------- c66f756cd47ff988d2a99dceabef337bb2067fdf utils/haddock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/haddock b/utils/haddock index 7699b27..03b02a0 160000 --- a/utils/haddock +++ b/utils/haddock @@ -1 +1 @@ -Subproject commit 7699b27c5766473709bc84bc69269a409dfad9a2 +Subproject commit 03b02a0faa5381d3a614e3f39b36923b0e988051 From git at git.haskell.org Sat Apr 16 18:40:01 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 16 Apr 2016 18:40:01 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Teach lookupLocalRdrEnv about Exacts. (#11813) (ead6998) Message-ID: <20160416184001.70E573A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/ead6998f9944112879b2ab322a25495bbc557a42/ghc >--------------------------------------------------------------- commit ead6998f9944112879b2ab322a25495bbc557a42 Author: Richard Eisenberg Date: Fri Apr 8 08:01:34 2016 +0200 Teach lookupLocalRdrEnv about Exacts. (#11813) (cherry picked from commit d81cdc227cd487659995ddea577214314c9b4b97) >--------------------------------------------------------------- ead6998f9944112879b2ab322a25495bbc557a42 compiler/basicTypes/RdrName.hs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/compiler/basicTypes/RdrName.hs b/compiler/basicTypes/RdrName.hs index febd718..50049ab 100644 --- a/compiler/basicTypes/RdrName.hs +++ b/compiler/basicTypes/RdrName.hs @@ -357,8 +357,17 @@ extendLocalRdrEnvList lre@(LRE { lre_env = env, lre_in_scope = ns }) names , lre_in_scope = extendNameSetList ns names } lookupLocalRdrEnv :: LocalRdrEnv -> RdrName -> Maybe Name -lookupLocalRdrEnv (LRE { lre_env = env }) (Unqual occ) = lookupOccEnv env occ -lookupLocalRdrEnv _ _ = Nothing +lookupLocalRdrEnv (LRE { lre_env = env, lre_in_scope = ns }) rdr + | Unqual occ <- rdr + = lookupOccEnv env occ + + -- See Note [Local bindings with Exact Names] + | Exact name <- rdr + , name `elemNameSet` ns + = Just name + + | otherwise + = Nothing lookupLocalRdrOcc :: LocalRdrEnv -> OccName -> Maybe Name lookupLocalRdrOcc (LRE { lre_env = env }) occ = lookupOccEnv env occ From git at git.haskell.org Sat Apr 16 18:40:04 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 16 Apr 2016 18:40:04 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Increase an InScopeSet for a substitution (b3321ca) Message-ID: <20160416184004.596DA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/b3321ca73f9d8ae4a44e228ff77ecbe14e291440/ghc >--------------------------------------------------------------- commit b3321ca73f9d8ae4a44e228ff77ecbe14e291440 Author: Richard Eisenberg Date: Tue Apr 12 12:00:55 2016 -0400 Increase an InScopeSet for a substitution This is a further fix for #11814 (cherry picked from commit 8d66765c4de22c01b8ae97570ed6c5f5c1a16a35) >--------------------------------------------------------------- b3321ca73f9d8ae4a44e228ff77ecbe14e291440 compiler/types/FamInstEnv.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/types/FamInstEnv.hs b/compiler/types/FamInstEnv.hs index 3ad2801..52fa965 100644 --- a/compiler/types/FamInstEnv.hs +++ b/compiler/types/FamInstEnv.hs @@ -515,7 +515,8 @@ compatibleBranches (CoAxBranch { cab_lhs = lhs1, cab_rhs = rhs1 }) = case tcUnifyTysFG (const BindMe) lhs1 lhs2 of SurelyApart -> True Unifiable subst - | Type.substTy subst rhs1 `eqType` Type.substTy subst rhs2 + | Type.substTyAddInScope subst rhs1 `eqType` + Type.substTyAddInScope subst rhs2 -> True _ -> False From git at git.haskell.org Sat Apr 16 19:13:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 16 Apr 2016 19:13:06 +0000 (UTC) Subject: [commit: packages/directory] branch 'master-1.2.6' created Message-ID: <20160416191306.2FCC93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory New branch : master-1.2.6 Referencing: 2e6f113133ffa7df39011f3a3f28b4725e6807e3 From git at git.haskell.org Sat Apr 16 19:13:08 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 16 Apr 2016 19:13:08 +0000 (UTC) Subject: [commit: packages/directory] tag 'v1.2.6.0' created Message-ID: <20160416191308.300803A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory New tag : v1.2.6.0 Referencing: 6a37327a71d4375673bbc8dc768b8dfd4407fc75 From git at git.haskell.org Sat Apr 16 19:13:10 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 16 Apr 2016 19:13:10 +0000 (UTC) Subject: [commit: packages/directory] master, master-1.2.6: Fix laziness issue in findExecutable and findFile, add findFileWith (5299a20) Message-ID: <20160416191310.393713A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: master,master-1.2.6 Link : http://ghc.haskell.org/trac/ghc/changeset/5299a20ee315fd4dd9ac15fcdbe683c121dbeca4/directory >--------------------------------------------------------------- commit 5299a20ee315fd4dd9ac15fcdbe683c121dbeca4 Author: Simon Jakobi Date: Wed Feb 24 19:41:27 2016 +0100 Fix laziness issue in findExecutable and findFile, add findFileWith Fixes https://github.com/haskell/directory/issues/43 >--------------------------------------------------------------- 5299a20ee315fd4dd9ac15fcdbe683c121dbeca4 System/Directory.hs | 83 +++++++++++++++++++++++++++++++++++++++------------- tests/FindFile001.hs | 11 +++++++ tests/Main.hs | 2 ++ 3 files changed, 75 insertions(+), 21 deletions(-) diff --git a/System/Directory.hs b/System/Directory.hs index 18b04ff..d755b61 100644 --- a/System/Directory.hs +++ b/System/Directory.hs @@ -57,6 +57,7 @@ module System.Directory , findExecutablesInDirectories , findFile , findFiles + , findFileWith , findFilesWith , exeExtension @@ -97,7 +98,7 @@ import Control.Monad ( when, unless ) import Data.Functor ((<$>)) #endif import Data.Maybe - ( listToMaybe + ( catMaybes #ifdef mingw32_HOST_OS , maybeToList #endif @@ -932,9 +933,13 @@ makeRelativeToCurrentDirectory x = do -- details. -- findExecutable :: String -> IO (Maybe FilePath) -findExecutable fileName = do - files <- findExecutables fileName - return $ listToMaybe files +findExecutable binary = do +#if defined(mingw32_HOST_OS) + Win32.searchPath Nothing binary exeExtension +#else + path <- getPath + findFileWith isExecutable path (binary <.> exeExtension) +#endif -- | Given a file name, searches for the file and returns a list of all -- occurences that are executable. @@ -947,11 +952,19 @@ findExecutable fileName = do findExecutables :: String -> IO [FilePath] findExecutables binary = do #if defined(mingw32_HOST_OS) - file <- Win32.searchPath Nothing binary exeExtension + file <- findExecutable binary return $ maybeToList file #else + path <- getPath + findExecutablesInDirectories path binary +#endif + +#ifndef mingw32_HOST_OS +-- | Get the contents of the @PATH@ environment variable. +getPath :: IO [FilePath] +getPath = do path <- getEnv "PATH" - findExecutablesInDirectories (splitSearchPath path) binary + return (splitSearchPath path) #endif -- | Given a file name, searches for the file on the given paths and returns a @@ -961,15 +974,16 @@ findExecutables binary = do findExecutablesInDirectories :: [FilePath] -> String -> IO [FilePath] findExecutablesInDirectories path binary = findFilesWith isExecutable path (binary <.> exeExtension) - where isExecutable file = do - perms <- getPermissions file - return $ executable perms + +-- | Test whether a file is executable. +isExecutable :: FilePath -> IO Bool +isExecutable file = do + perms <- getPermissions file + return (executable perms) -- | Search through the given set of directories for the given file. findFile :: [FilePath] -> String -> IO (Maybe FilePath) -findFile path fileName = do - files <- findFiles path fileName - return $ listToMaybe files +findFile = findFileWith (\_ -> return True) -- | Search through the given set of directories for the given file and -- returns a list of paths where the given file exists. @@ -979,20 +993,47 @@ findFiles :: [FilePath] -> String -> IO [FilePath] findFiles = findFilesWith (\_ -> return True) -- | Search through the given set of directories for the given file and +-- with the given property (usually permissions) and returns the file path +-- where the given file exists and has the property. +-- +-- @since 1.2.6.0 +findFileWith :: (FilePath -> IO Bool) -> [FilePath] -> String -> IO (Maybe FilePath) +findFileWith f ds name = asumMaybeT (map (findFileWithIn f name) ds) + +-- | 'Data.Foldable.asum' for 'Control.Monad.Trans.Maybe.MaybeT', essentially. +-- +-- Returns the first 'Just' in the list or 'Nothing' if there aren't any. +asumMaybeT :: Monad m => [m (Maybe a)] -> m (Maybe a) +asumMaybeT = foldr attempt (return Nothing) + where + attempt mmx mx' = do + mx <- mmx + case mx of + Nothing -> mx' + Just _ -> return mx + +-- | Search through the given set of directories for the given file and -- with the given property (usually permissions) and returns a list of -- paths where the given file exists and has the property. -- -- @since 1.2.1.0 findFilesWith :: (FilePath -> IO Bool) -> [FilePath] -> String -> IO [FilePath] -findFilesWith _ [] _ = return [] -findFilesWith f (d:ds) fileName = do - let file = d fileName - exist <- doesFileExist file - b <- if exist then f file else return False - if b then do - files <- findFilesWith f ds fileName - return $ file : files - else findFilesWith f ds fileName +findFilesWith f ds name = do + mfiles <- mapM (findFileWithIn f name) ds + return (catMaybes mfiles) + +-- | Like 'findFileWith', but searches only a single directory. +findFileWithIn :: (FilePath -> IO Bool) -> String -> FilePath -> IO (Maybe FilePath) +findFileWithIn f name d = do + let path = d name + exist <- doesFileExist path + if exist + then do + ok <- f path + if ok + then return (Just path) + else return Nothing + else return Nothing #ifdef __GLASGOW_HASKELL__ -- | Similar to 'listDirectory', but always includes the special entries (@.@ diff --git a/tests/FindFile001.hs b/tests/FindFile001.hs new file mode 100644 index 0000000..b4facea --- /dev/null +++ b/tests/FindFile001.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE CPP #-} +module FindFile001 where +#include "util.inl" +import System.Directory +import System.FilePath + +main :: TestEnv -> IO () +main _t = do + writeFile "foo" "" + found <- findFile ("." : undefined) "foo" + T(expectEq) () found (Just ("." "foo")) diff --git a/tests/Main.hs b/tests/Main.hs index 91f0065..678284e 100644 --- a/tests/Main.hs +++ b/tests/Main.hs @@ -9,6 +9,7 @@ import qualified CurrentDirectory001 import qualified Directory001 import qualified DoesDirectoryExist001 import qualified FileTime +import qualified FindFile001 import qualified GetDirContents001 import qualified GetDirContents002 import qualified GetHomeDirectory001 @@ -30,6 +31,7 @@ main = T.testMain $ \ _t -> do T.isolatedRun _t "Directory001" Directory001.main T.isolatedRun _t "DoesDirectoryExist001" DoesDirectoryExist001.main T.isolatedRun _t "FileTime" FileTime.main + T.isolatedRun _t "FindFile001" FindFile001.main T.isolatedRun _t "GetDirContents001" GetDirContents001.main T.isolatedRun _t "GetDirContents002" GetDirContents002.main T.isolatedRun _t "GetHomeDirectory001" GetHomeDirectory001.main From git at git.haskell.org Sat Apr 16 19:13:12 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 16 Apr 2016 19:13:12 +0000 (UTC) Subject: [commit: packages/directory] master-1.2.6: Update changelog (findFile et al are lazier) (2e6f113) Message-ID: <20160416191312.3F5523A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master-1.2.6 Link : http://ghc.haskell.org/trac/ghc/changeset/2e6f113133ffa7df39011f3a3f28b4725e6807e3/directory >--------------------------------------------------------------- commit 2e6f113133ffa7df39011f3a3f28b4725e6807e3 Author: Phil Ruffwind Date: Wed Mar 2 23:44:08 2016 -0500 Update changelog (findFile et al are lazier) >--------------------------------------------------------------- 2e6f113133ffa7df39011f3a3f28b4725e6807e3 changelog.md | 8 ++++++++ directory.cabal | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 4a09653..665d03c 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,14 @@ Changelog for the [`directory`][1] package ========================================== +## 1.2.6.0 (April 2015) + + * Make `findExecutable`, `findExecutables`, `findExecutablesInDirectories`, + `findFile`, and `findFilesWith` lazier + ([#43](https://github.com/haskell/directory/issues/43)) + + * Add `findFileWith` + ## 1.2.5.1 (February 2015) * Improve error message of `getCurrentDirectory` when the current working diff --git a/directory.cabal b/directory.cabal index 5a58dcf..05c91c5 100644 --- a/directory.cabal +++ b/directory.cabal @@ -1,5 +1,5 @@ name: directory -version: 1.2.5.1 +version: 1.2.6.0 -- NOTE: Don't forget to update ./changelog.md license: BSD3 license-file: LICENSE From git at git.haskell.org Sat Apr 16 19:13:14 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 16 Apr 2016 19:13:14 +0000 (UTC) Subject: [commit: packages/directory] master: Add support for continuous integration on Windows using AppVeyor (5499634) Message-ID: <20160416191314.46BB43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/54996346add62115cf887652a37a9e751a563a4a/directory >--------------------------------------------------------------- commit 54996346add62115cf887652a37a9e751a563a4a Author: Phil Ruffwind Date: Mon Oct 12 05:58:21 2015 -0400 Add support for continuous integration on Windows using AppVeyor Since AppVeyor does not support Haskell natively, we need our own way of obtaining the build tools. Of the few options available on Windows, Stack seems to be easiest, thus we use Stack to install GHC. Inspired by: https://github.com/commercialhaskell/stack/blob/df3255d9cabf586a4b6929caf164ff323a8f0cff/appveyor.yml >--------------------------------------------------------------- 54996346add62115cf887652a37a9e751a563a4a README.md | 22 ++++++++++++++-------- appveyor.yml | 28 ++++++++++++++++++++++++++++ tools/retry | 12 ++++++++++++ 3 files changed, 54 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 5eb5566..be7440b 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,18 @@ -`directory` [![Hackage][1]][2] [![Build Status][3]][4] +`directory` =========== -Documentation can be found on [Hackage][2]. +[![Hackage][hi]][hl] +[![Build status][bi]][bl] +[![Windows build status][wi]][wl] + +Documentation can be found on [Hackage][hl]. Building from Git repository ---------------------------- When building this package directly from the Git repository, one must run `autoreconf -i` to generate the `configure` script needed by `cabal -configure`. This requires [Autoconf][5] to be installed. +configure`. This requires [Autoconf][ac] to be installed. autoreconf -i cabal install @@ -16,8 +20,10 @@ configure`. This requires [Autoconf][5] to be installed. There is no need to run the `configure` script manually however, as `cabal configure` does that automatically. -[1]: https://img.shields.io/hackage/v/directory.svg -[2]: https://hackage.haskell.org/package/directory -[3]: https://travis-ci.org/haskell/directory.svg?branch=master -[4]: https://travis-ci.org/haskell/directory -[5]: https://gnu.org/software/autoconf +[hi]: https://img.shields.io/hackage/v/directory.svg +[hl]: https://hackage.haskell.org/package/directory +[bi]: https://travis-ci.org/haskell/directory.svg?branch=master +[bl]: https://travis-ci.org/haskell/directory +[wi]: https://ci.appveyor.com/api/projects/status/github/haskell/directory +[wl]: https://ci.appveyor.com/project/Rufflewind/directory +[ac]: https://gnu.org/software/autoconf diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..d7c371f --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,28 @@ +version: "{build}-{branch}" +skip_tags: true +shallow_clone: true +environment: + global: + # use a short path prefix to avoid running into path-length limitations + STACK_ROOT: C:\sr + STACK_VER: 1.0.4 +install: + - set PATH=C:\msys64\usr\bin;%PATH% + # might have to retry due to reliability issues with SourceForge + - sh tools/retry 32 pacman -S --needed --noconfirm autoconf automake tar + - curl -fsLS -o stack.zip https://github.com/commercialhaskell/stack/releases/download/v%STACK_VER%/stack-%STACK_VER%-windows-x86_64.zip + - 7z x stack.zip stack.exe + # silence it because it's far too verbose + - stack --skip-msys setup >NUL + - stack --version + - stack ghc -- --version +build_script: + - stack init + - stack exec -- sh -c "autoreconf -fi" +test_script: + - stack test + --ghc-options -rtsopts + --ghc-options -threaded + --test-arguments + "CreateDirectoryIfMissing001.num-repeats=100000 +RTS -N2" + - stack sdist diff --git a/tools/retry b/tools/retry new file mode 100755 index 0000000..0870dba --- /dev/null +++ b/tools/retry @@ -0,0 +1,12 @@ +#!/bin/sh +set -eu +n=$1 +shift +i=0 +while [ $i -lt $n ] +do + if "$@" + then break + fi + i=`expr "$i" + 1` +done From git at git.haskell.org Sat Apr 16 19:13:16 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 16 Apr 2016 19:13:16 +0000 (UTC) Subject: [commit: packages/directory] master: Update changelog (findFile et al are lazier) (1f3e013) Message-ID: <20160416191316.4D4673A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1f3e013cd0319ae501fa2c337cb4b0135f793e2a/directory >--------------------------------------------------------------- commit 1f3e013cd0319ae501fa2c337cb4b0135f793e2a Author: Phil Ruffwind Date: Wed Mar 2 23:44:08 2016 -0500 Update changelog (findFile et al are lazier) >--------------------------------------------------------------- 1f3e013cd0319ae501fa2c337cb4b0135f793e2a changelog.md | 8 ++++++++ directory.cabal | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 4a09653..665d03c 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,14 @@ Changelog for the [`directory`][1] package ========================================== +## 1.2.6.0 (April 2015) + + * Make `findExecutable`, `findExecutables`, `findExecutablesInDirectories`, + `findFile`, and `findFilesWith` lazier + ([#43](https://github.com/haskell/directory/issues/43)) + + * Add `findFileWith` + ## 1.2.5.1 (February 2015) * Improve error message of `getCurrentDirectory` when the current working diff --git a/directory.cabal b/directory.cabal index 5a58dcf..05c91c5 100644 --- a/directory.cabal +++ b/directory.cabal @@ -1,5 +1,5 @@ name: directory -version: 1.2.5.1 +version: 1.2.6.0 -- NOTE: Don't forget to update ./changelog.md license: BSD3 license-file: LICENSE From git at git.haskell.org Sat Apr 16 19:13:18 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 16 Apr 2016 19:13:18 +0000 (UTC) Subject: [commit: packages/directory] master: Modify testctl to also update the other-modules section of .cabal (4de4e8b) Message-ID: <20160416191318.52E483A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4de4e8ba0226e95714fc8ff606ca3a8dd0fae545/directory >--------------------------------------------------------------- commit 4de4e8ba0226e95714fc8ff606ca3a8dd0fae545 Author: Phil Ruffwind Date: Sat Mar 19 03:55:39 2016 -0400 Modify testctl to also update the other-modules section of .cabal >--------------------------------------------------------------- 4de4e8ba0226e95714fc8ff606ca3a8dd0fae545 directory.cabal | 24 ++++++++++++++++++++++++ tools/testctl | 39 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 62 insertions(+), 1 deletion(-) diff --git a/directory.cabal b/directory.cabal index 05c91c5..acc57cf 100644 --- a/directory.cabal +++ b/directory.cabal @@ -81,3 +81,27 @@ test-suite test build-depends: Win32 else build-depends: unix + other-modules: + TestUtils + Util + -- test-modules-begin + CanonicalizePath + CopyFile001 + CopyFile002 + CreateDirectory001 + CreateDirectoryIfMissing001 + CurrentDirectory001 + Directory001 + DoesDirectoryExist001 + FileTime + FindFile001 + GetDirContents001 + GetDirContents002 + GetHomeDirectory001 + GetPermissions001 + RemoveDirectoryRecursive001 + RenameFile001 + Safe + T8482 + WithCurrentDirectory + -- test-modules-end diff --git a/tools/testctl b/tools/testctl index d0a36c1..18c3d82 100755 --- a/tools/testctl +++ b/tools/testctl @@ -1,5 +1,5 @@ #!/usr/bin/env python -import os, re, sys +import glob, os, re, sys USAGE = """ Usage: @@ -41,8 +41,34 @@ MAIN_IMPORT_TEMPLATE = "import qualified {name}\n" MAIN_RUN_TEMPLATE = ' T.isolatedRun _t "{name}" {name}.main\n' BLACKLIST = "^(Main|.*Util.*)$" +CABAL_FILE = glob.glob("*.cabal")[0] +CABAL_SECTION_PATTERN = """(?s) +( *)-- test-modules-begin +.*?-- test-modules-end +""" +CABAL_SECTION_TEMPLATE = """ +{0}-- test-modules-begin +{1}{0}-- test-modules-end +""" + program = os.path.basename(sys.argv[0]) +def rename(src, dest): + '''Rename a file (allows overwrites on Windows).''' + import os + if os.name == "nt": + import ctypes, ctypes.wintypes + MoveFileExW = ctypes.windll.kernel32.MoveFileExW + MoveFileExW.restype = ctypes.wintypes.BOOL + MOVEFILE_REPLACE_EXISTING = ctypes.wintypes.DWORD(0x1) + success = MoveFileExW(ctypes.wintypes.LPCWSTR(src), + ctypes.wintypes.LPCWSTR(dest), + MOVEFILE_REPLACE_EXISTING) + if not success: + raise ctypes.WinError() + else: + os.rename(src, dest) + def usage(): sys.stderr.write(USAGE.format(program=program)) sys.exit(2) @@ -80,6 +106,17 @@ def update(): runs="".join(MAIN_RUN_TEMPLATE.format(name=name) for name in tests), ).encode("utf8")) + with open(CABAL_FILE, "rb") as file: + cabal_file = file.read().decode("utf8") + with open(CABAL_FILE + ".tmp", "wb") as file: + indent, = re.search(CABAL_SECTION_PATTERN, cabal_file).groups() + repl = CABAL_SECTION_TEMPLATE.format( + indent, + "".join("{0}{1}\n".format(indent, name) for name in tests) + ) + file.write(re.sub(CABAL_SECTION_PATTERN, repl, cabal_file) + .encode("utf8")) + rename(CABAL_FILE + ".tmp", CABAL_FILE) if len(sys.argv) < 2: usage() From git at git.haskell.org Sat Apr 16 19:13:20 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 16 Apr 2016 19:13:20 +0000 (UTC) Subject: [commit: packages/directory] master: README: -f is sometimes needed in autoreconf to avoid errors (db130de) Message-ID: <20160416191320.589243A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/db130de212a7a2869697d67ac59654017696b294/directory >--------------------------------------------------------------- commit db130de212a7a2869697d67ac59654017696b294 Author: Phil Ruffwind Date: Thu Mar 31 07:08:39 2016 -0400 README: -f is sometimes needed in autoreconf to avoid errors >--------------------------------------------------------------- db130de212a7a2869697d67ac59654017696b294 README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index be7440b..060337d 100644 --- a/README.md +++ b/README.md @@ -11,10 +11,10 @@ Building from Git repository ---------------------------- When building this package directly from the Git repository, one must run -`autoreconf -i` to generate the `configure` script needed by `cabal +`autoreconf -fi` to generate the `configure` script needed by `cabal configure`. This requires [Autoconf][ac] to be installed. - autoreconf -i + autoreconf -fi cabal install There is no need to run the `configure` script manually however, as `cabal From git at git.haskell.org Sat Apr 16 19:13:22 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 16 Apr 2016 19:13:22 +0000 (UTC) Subject: [commit: packages/directory] master: Fix broken cabal_install_run_tests (525cc27) Message-ID: <20160416191322.5EF383A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/525cc271522d9e8c274c7b16100aa11963b6008b/directory >--------------------------------------------------------------- commit 525cc271522d9e8c274c7b16100aa11963b6008b Author: Phil Ruffwind Date: Thu Mar 31 12:48:21 2016 -0400 Fix broken cabal_install_run_tests Turns out the fallback version never worked properly to begin with. >--------------------------------------------------------------- 525cc271522d9e8c274c7b16100aa11963b6008b .travis.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9a98189..5ffbc7b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -46,19 +46,19 @@ before_script: if cabal 2>&1 install --run-tests __dummy | grep >/dev/null 2>&1 "cabal: unrecognized option" then def_cabal_install_run_tests='cabal_install_run_tests() { - tgz=$1 - shift - tmp=cabal-install-run-tests.tmp - mkdir -p "$tmp" - ( cd "$tmp" && tar xzf - ) <"$tgz" + tgz=$1 && + shift && + tmp=cabal-install-run-tests.tmp && + mkdir -p "$tmp" && + ( cd "$tmp" && tar xzf - ) <"$tgz" && ( cd "$tmp"/* && cabal configure --enable-tests && cabal build && - cabal test ) + cabal test ) && cabal install "$@" "$tgz" }' else def_cabal_install_run_tests='cabal_install_run_tests() { - cabal install --run-tests "$@" "$1" + cabal install --run-tests "$@" }' fi export def_cabal_install_run_tests @@ -73,4 +73,4 @@ script: --test-option=CreateDirectoryIfMissing001.num-repeats=100000 --test-option=+RTS --test-option=-N2 - eval "$def_cabal_install_run_tests" && - cabal_install_run_tests --force-reinstalls dist/*-*.tar.gz + cabal_install_run_tests dist/*-*.tar.gz --force-reinstalls From git at git.haskell.org Sat Apr 16 19:13:24 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 16 Apr 2016 19:13:24 +0000 (UTC) Subject: [commit: packages/directory] master: Refactor file time functions (62ff034) Message-ID: <20160416191324.660E63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/62ff034a2a80d9ebb89801afea2321be68362420/directory >--------------------------------------------------------------- commit 62ff034a2a80d9ebb89801afea2321be68362420 Author: Phil Ruffwind Date: Thu Mar 31 13:16:50 2016 -0400 Refactor file time functions >--------------------------------------------------------------- 62ff034a2a80d9ebb89801afea2321be68362420 System/Directory.hs | 115 ++++++++++++++++++++++++++++------------------------ 1 file changed, 61 insertions(+), 54 deletions(-) diff --git a/System/Directory.hs b/System/Directory.hs index d755b61..34a9fd5 100644 --- a/System/Directory.hs +++ b/System/Directory.hs @@ -94,6 +94,9 @@ module System.Directory ) where import Control.Exception ( bracket, bracketOnError ) import Control.Monad ( when, unless ) +#ifdef mingw32_HOST_OS +import Data.Function (on) +#endif #if !MIN_VERSION_base(4, 8, 0) import Data.Functor ((<$>)) #endif @@ -103,7 +106,6 @@ import Data.Maybe , maybeToList #endif ) -import Data.Tuple (swap) import System.FilePath import System.IO @@ -1273,7 +1275,7 @@ openFileHandle path mode = Win32.createFile path mode share Nothing -- getAccessTime :: FilePath -> IO UTCTime getAccessTime = modifyIOError (`ioeSetLocation` "getAccessTime") . - getFileTime False + (fst <$>) . getFileTimes -- | Obtain the time at which the file or directory was last modified. -- @@ -1290,30 +1292,39 @@ getAccessTime = modifyIOError (`ioeSetLocation` "getAccessTime") . -- getModificationTime :: FilePath -> IO UTCTime getModificationTime = modifyIOError (`ioeSetLocation` "getModificationTime") . - getFileTime True + (snd <$>) . getFileTimes -getFileTime :: Bool -> FilePath -> IO UTCTime -getFileTime isMtime path = modifyIOError (`ioeSetFileName` path) $ - posixSecondsToUTCTime <$> getTime +getFileTimes :: FilePath -> IO (UTCTime, UTCTime) +getFileTimes path = + modifyIOError (`ioeSetLocation` "getFileTimes") . + modifyIOError (`ioeSetFileName` path) $ + getTimes where path' = normalise path -- handle empty paths #ifdef mingw32_HOST_OS - getTime = + getTimes = bracket (openFileHandle path' Win32.gENERIC_READ) Win32.closeHandle $ \ handle -> - alloca $ \ time -> do - Win32.failIf_ not "" . - uncurry (Win32.c_GetFileTime handle nullPtr) $ - swapIf isMtime (time, nullPtr) - windowsToPosixTime <$> peek time + alloca $ \ atime -> + alloca $ \ mtime -> do + Win32.failIf_ not "" $ + Win32.c_GetFileTime handle nullPtr atime mtime + ((,) `on` posixSecondsToUTCTime . windowsToPosixTime) + <$> peek atime + <*> peek mtime #else - getTime = convertTime <$> Posix.getFileStatus path' + getTimes = fileTimesFromStatus <$> Posix.getFileStatus path' +#endif + +#ifndef mingw32_HOST_OS +fileTimesFromStatus :: Posix.FileStatus -> (UTCTime, UTCTime) +fileTimesFromStatus st = # if MIN_VERSION_unix(2, 6, 0) - convertTime = if isMtime then Posix.modificationTimeHiRes - else Posix.accessTimeHiRes + ( posixSecondsToUTCTime (Posix.accessTimeHiRes st) + , posixSecondsToUTCTime (Posix.modificationTimeHiRes st) ) # else - convertTime = realToFrac . if isMtime then Posix.modificationTime - else Posix.accessTime + ( posixSecondsToUTCTime (realToFrac (Posix.accessTime st)) + , posixSecondsToUTCTime (realToFrac (Posix.modificationTime st)) ) # endif #endif @@ -1341,9 +1352,9 @@ getFileTime isMtime path = modifyIOError (`ioeSetFileName` path) $ -- @since 1.2.3.0 -- setAccessTime :: FilePath -> UTCTime -> IO () -setAccessTime path = - modifyIOError (`ioeSetLocation` "setAccessTime") . - setFileTime False path +setAccessTime path atime = + modifyIOError (`ioeSetLocation` "setAccessTime") $ + setFileTimes path (Just atime, Nothing) -- | Change the time at which the file or directory was last modified. -- @@ -1369,54 +1380,50 @@ setAccessTime path = -- @since 1.2.3.0 -- setModificationTime :: FilePath -> UTCTime -> IO () -setModificationTime path = - modifyIOError (`ioeSetLocation` "setModificationTime") . - setFileTime True path - -setFileTime :: Bool -> FilePath -> UTCTime -> IO () -setFileTime isMtime path = modifyIOError (`ioeSetFileName` path) . - setTime . utcTimeToPOSIXSeconds +setModificationTime path mtime = + modifyIOError (`ioeSetLocation` "setModificationTime") $ + setFileTimes path (Nothing, Just mtime) + +setFileTimes :: FilePath -> (Maybe UTCTime, Maybe UTCTime) -> IO () +setFileTimes _ (Nothing, Nothing) = return () +setFileTimes path (atime, mtime) = + modifyIOError (`ioeSetLocation` "setFileTimes") . + modifyIOError (`ioeSetFileName` path) $ + setTimes (utcTimeToPOSIXSeconds <$> atime, utcTimeToPOSIXSeconds <$> mtime) where - path' = normalise path -- handle empty paths + path' = normalise path -- handle empty paths #ifdef mingw32_HOST_OS - setTime time = + setTimes (atime', mtime') = bracket (openFileHandle path' Win32.gENERIC_WRITE) Win32.closeHandle $ \ handle -> - with (posixToWindowsTime time) $ \ time' -> - Win32.failIf_ not "" . - uncurry (Win32.c_SetFileTime handle nullPtr) $ - swapIf isMtime (time', nullPtr) + maybeWith with (posixToWindowsTime <$> atime') $ \ atime'' -> + maybeWith with (posixToWindowsTime <$> mtime') $ \ mtime'' -> + Win32.failIf_ not "" $ + Win32.c_SetFileTime handle nullPtr atime'' mtime'' #elif defined HAVE_UTIMENSAT - setTime time = + setTimes (atime', mtime') = withFilePath path' $ \ path'' -> - withArray [atime, mtime] $ \ times -> + withArray [ maybe utimeOmit toCTimeSpec atime' + , maybe utimeOmit toCTimeSpec mtime' ] $ \ times -> throwErrnoPathIfMinus1_ "" path' $ - c_utimensat c_AT_FDCWD path'' times 0 - where (atime, mtime) = swapIf isMtime (toCTimeSpec time, utimeOmit) + c_utimensat c_AT_FDCWD path'' times 0 #else - setTime time = do - stat <- Posix.getFileStatus path' - uncurry (setFileTimes path') $ - swapIf isMtime (convertTime time, otherTime stat) + setTimes (Just atime', Just mtime') = setFileTimes path' atime' mtime' + setTimes (atime', mtime') = do + (atimeOld, mtimeOld) <- fileTimesFromStatus <$> Posix.getFileStatus path' + setFileTimes path' + (fromMaybe atimeOld atime') + (fromMaybe mtimeOld mtime') # if MIN_VERSION_unix(2, 7, 0) setFileTimes = Posix.setFileTimesHiRes - convertTime = id - otherTime = if isMtime - then Posix.accessTimeHiRes - else Posix.modificationTimeHiRes # else - setFileTimes = Posix.setFileTimes - convertTime = fromInteger . truncate - otherTime = if isMtime - then Posix.accessTime - else Posix.modificationTime + setFileTimes pth atim mtime = + Posix.setFileTimes pth + (fromInteger (truncate atime)) + (fromInteger (truncate mtime)) # endif #endif -swapIf :: Bool -> (a, a) -> (a, a) -swapIf True = swap -swapIf False = id - #ifdef mingw32_HOST_OS -- | Difference between the Windows and POSIX epochs in units of 100ns. windowsPosixEpochDifference :: Num a => a From git at git.haskell.org Sat Apr 16 19:13:26 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 16 Apr 2016 19:13:26 +0000 (UTC) Subject: [commit: packages/directory] master: Add isSymbolicLink (28b981d) Message-ID: <20160416191326.6DFB53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/28b981db6354e575e342477fd8ecd1ce1ea6cacd/directory >--------------------------------------------------------------- commit 28b981db6354e575e342477fd8ecd1ce1ea6cacd Author: Phil Ruffwind Date: Thu Apr 14 05:33:58 2016 -0400 Add isSymbolicLink >--------------------------------------------------------------- 28b981db6354e575e342477fd8ecd1ce1ea6cacd System/Directory.hs | 34 ++++++++++++++++++++++++++++------ changelog.md | 2 ++ directory.cabal | 1 + tests/IsSymbolicLink.hs | 23 +++++++++++++++++++++++ tests/Main.hs | 2 ++ 5 files changed, 56 insertions(+), 6 deletions(-) diff --git a/System/Directory.hs b/System/Directory.hs index 7e5edb1..ef97bcd 100644 --- a/System/Directory.hs +++ b/System/Directory.hs @@ -66,6 +66,9 @@ module System.Directory , doesFileExist , doesDirectoryExist + -- * Symbolic links + , isSymbolicLink + -- * Permissions -- $permissions @@ -487,12 +490,15 @@ getDirectoryType :: FilePath -> IO DirectoryType getDirectoryType path = (`ioeSetLocation` "getDirectoryType") `modifyIOError` do #ifdef mingw32_HOST_OS - classify <$> Win32.getFileAttributes path - where fILE_ATTRIBUTE_REPARSE_POINT = 0x400 - classify attr - | attr .&. Win32.fILE_ATTRIBUTE_DIRECTORY == 0 = NotDirectory - | attr .&. fILE_ATTRIBUTE_REPARSE_POINT == 0 = Directory - | otherwise = DirectoryLink + isDir <- withFileStatus "getDirectoryType" name isDirectory + if isDir + then do + isLink <- isSymbolicLink path + if isLink + then return DirectoryLink + else return Directory + else do + return NotDirectory #else stat <- Posix.getSymbolicLinkStatus path return $ if Posix.isDirectory stat @@ -1386,6 +1392,22 @@ doesFileExist name = #endif `catchIOError` \ _ -> return False +-- | Check whether the path refers to a symbolic link. On Windows, this tests +-- for @FILE_ATTRIBUTE_REPARSE_POINT at . +-- +-- @since 1.2.6.0 +isSymbolicLink :: FilePath -> IO Bool +isSymbolicLink path = + (`ioeSetLocation` "getDirectoryType") `modifyIOError` do +#ifdef mingw32_HOST_OS + isReparsePoint <$> Win32.getFileAttributes path + where + fILE_ATTRIBUTE_REPARSE_POINT = 0x400 + isReparsePoint attr = attr .&. fILE_ATTRIBUTE_REPARSE_POINT /= 0 +#else + Posix.isSymbolicLink <$> Posix.getSymbolicLinkStatus path +#endif + #ifdef mingw32_HOST_OS -- | Open the handle of an existing file or directory. openFileHandle :: String -> Win32.AccessMode -> IO Win32.HANDLE diff --git a/changelog.md b/changelog.md index f917252..d047bd4 100644 --- a/changelog.md +++ b/changelog.md @@ -15,6 +15,8 @@ Changelog for the [`directory`][1] package * Improve error message of `removeDirectoryRecursive` when used on a directory symbolic link on Windows. + * Add `isSymbolicLink` + ## 1.2.5.1 (February 2015) * Improve error message of `getCurrentDirectory` when the current working diff --git a/directory.cabal b/directory.cabal index 3af7a70..8fc1a40 100644 --- a/directory.cabal +++ b/directory.cabal @@ -100,6 +100,7 @@ test-suite test GetDirContents002 GetHomeDirectory001 GetPermissions001 + IsSymbolicLink RemoveDirectoryRecursive001 RenameFile001 Safe diff --git a/tests/IsSymbolicLink.hs b/tests/IsSymbolicLink.hs new file mode 100644 index 0000000..3f39e55 --- /dev/null +++ b/tests/IsSymbolicLink.hs @@ -0,0 +1,23 @@ +{-# LANGUAGE CPP #-} +module IsSymbolicLink where +#include "util.inl" +import System.Directory +import Control.Monad (when) +#ifdef mingw32_HOST_OS +import System.IO.Error (catchIOError, isPermissionError) +#endif +import TestUtils + +main :: TestEnv -> IO () +main _t = do + success <- (createSymbolicLink "x" "y" >> return True) +#ifdef mingw32_HOST_OS + -- only test if symbolic links can be created + -- (usually disabled on Windows by group policy) + `catchIOError` \ e -> + if isPermissionError e + then return False + else ioError e +#endif + when success $ + T(expect) () =<< isSymbolicLink "y" diff --git a/tests/Main.hs b/tests/Main.hs index 19c6c28..65127f6 100644 --- a/tests/Main.hs +++ b/tests/Main.hs @@ -15,6 +15,7 @@ import qualified GetDirContents001 import qualified GetDirContents002 import qualified GetHomeDirectory001 import qualified GetPermissions001 +import qualified IsSymbolicLink import qualified RemoveDirectoryRecursive001 import qualified RenameFile001 import qualified Safe @@ -38,6 +39,7 @@ main = T.testMain $ \ _t -> do T.isolatedRun _t "GetDirContents002" GetDirContents002.main T.isolatedRun _t "GetHomeDirectory001" GetHomeDirectory001.main T.isolatedRun _t "GetPermissions001" GetPermissions001.main + T.isolatedRun _t "IsSymbolicLink" IsSymbolicLink.main T.isolatedRun _t "RemoveDirectoryRecursive001" RemoveDirectoryRecursive001.main T.isolatedRun _t "RenameFile001" RenameFile001.main T.isolatedRun _t "Safe" Safe.main From git at git.haskell.org Sat Apr 16 19:13:30 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 16 Apr 2016 19:13:30 +0000 (UTC) Subject: [commit: packages/directory] master: Update test runner to fix permissions before clearing the directory (60fcdd2) Message-ID: <20160416191330.7FB583A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/60fcdd2a26e2dbd603d515ae81d0d7d51db7a6be/directory >--------------------------------------------------------------- commit 60fcdd2a26e2dbd603d515ae81d0d7d51db7a6be Author: Phil Ruffwind Date: Thu Apr 14 05:34:15 2016 -0400 Update test runner to fix permissions before clearing the directory Otherwise, tests that alter the permission of files could break the test runner. For example, this can happen if RemoveDirectoryRecursive001 is interrupted at an unfortunate moment. >--------------------------------------------------------------- 60fcdd2a26e2dbd603d515ae81d0d7d51db7a6be System/Directory.hs | 2 +- tests/Util.hs | 33 +++++++++++++++++++++++++++++---- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/System/Directory.hs b/System/Directory.hs index ef97bcd..44012d6 100644 --- a/System/Directory.hs +++ b/System/Directory.hs @@ -490,7 +490,7 @@ getDirectoryType :: FilePath -> IO DirectoryType getDirectoryType path = (`ioeSetLocation` "getDirectoryType") `modifyIOError` do #ifdef mingw32_HOST_OS - isDir <- withFileStatus "getDirectoryType" name isDirectory + isDir <- withFileStatus "getDirectoryType" path isDirectory if isDir then do isLink <- isSymbolicLink path diff --git a/tests/Util.hs b/tests/Util.hs index ca4a448..12a0f42 100644 --- a/tests/Util.hs +++ b/tests/Util.hs @@ -2,8 +2,9 @@ module Util where import Prelude (Eq(..), Num(..), Ord(..), RealFrac(..), Show(..), Bool(..), Double, Either(..), Int, Integer, Maybe(..), String, - ($), (.), otherwise) + ($), (.), not, otherwise) import Data.Char (toLower) +import Data.Foldable (traverse_) import Data.Functor ((<$>)) import Data.IORef (IORef, newIORef, readIORef, writeIORef) import Data.List (drop, elem, intercalate, lookup, reverse, span) @@ -16,11 +17,14 @@ import Control.Concurrent.MVar (newEmptyMVar, putMVar, readMVar) import Control.Exception (SomeException, bracket_, catch, mask, onException, try) import Control.Monad (Monad(..), unless, when) -import System.Directory (createDirectoryIfMissing, makeAbsolute, - removeDirectoryRecursive, withCurrentDirectory) +import System.Directory (createDirectoryIfMissing, emptyPermissions, + doesDirectoryExist, isSymbolicLink, listDirectory, + makeAbsolute, removeDirectoryRecursive, readable, + searchable, setPermissions, withCurrentDirectory, + writable) import System.Environment (getArgs) import System.Exit (exitFailure) -import System.FilePath (FilePath, normalise) +import System.FilePath (FilePath, (), normalise) import System.IO (IO, hFlush, hPutStrLn, putStrLn, stderr, stdout) import System.IO.Error (IOError, isDoesNotExistError, ioError, tryIOError, userError) @@ -131,6 +135,20 @@ expectIOErrorType t file line context which action = do | otherwise -> Left ["got wrong exception: ", show e] Right _ -> Left ["did not throw an exception"] +-- | Traverse the directory tree in preorder. +preprocessPathRecursive :: (FilePath -> IO ()) -> FilePath -> IO () +preprocessPathRecursive f path = do + dirExists <- doesDirectoryExist path + if dirExists + then do + isLink <- isSymbolicLink path + f path + when (not isLink) $ do + names <- listDirectory path + traverse_ (preprocessPathRecursive f) ((path ) <$> names) + else do + f path + withNewDirectory :: Bool -> FilePath -> IO a -> IO a withNewDirectory keep dir action = do dir' <- makeAbsolute dir @@ -144,6 +162,13 @@ isolateWorkingDirectory keep dir action = do ioError (userError ("isolateWorkingDirectory cannot be used " <> "with current directory")) dir' <- makeAbsolute dir + (`preprocessPathRecursive` dir') $ \ f -> do + setPermissions f emptyPermissions{ readable = True + , searchable = True + , writable = True } + `catch` \ e -> + unless (isDoesNotExistError e) $ + ioError e removeDirectoryRecursive dir' `catch` \ e -> unless (isDoesNotExistError e) $ ioError e From git at git.haskell.org Sat Apr 16 19:13:32 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 16 Apr 2016 19:13:32 +0000 (UTC) Subject: [commit: packages/directory] master: Improve error of removeDirectoryRecursive on dir symlinks (4490526) Message-ID: <20160416191332.863753A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4490526d4065ac4b2d1f09aa6fefc54cde62888b/directory >--------------------------------------------------------------- commit 4490526d4065ac4b2d1f09aa6fefc54cde62888b Author: Phil Ruffwind Date: Thu Apr 14 02:30:27 2016 -0400 Improve error of removeDirectoryRecursive on dir symlinks >--------------------------------------------------------------- 4490526d4065ac4b2d1f09aa6fefc54cde62888b System/Directory.hs | 14 ++++++++++---- changelog.md | 3 +++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/System/Directory.hs b/System/Directory.hs index 5e709fd..7e5edb1 100644 --- a/System/Directory.hs +++ b/System/Directory.hs @@ -553,15 +553,21 @@ removeDirectory path = -- | @'removeDirectoryRecursive' dir@ removes an existing directory /dir/ -- together with its contents and subdirectories. Within this directory, --- symbolic links are removed without affecting their the targets. +-- symbolic links are removed without affecting their targets. +-- +-- On Windows, the operation fails if /dir/ is a directory symbolic link. removeDirectoryRecursive :: FilePath -> IO () removeDirectoryRecursive path = (`ioeSetLocation` "removeDirectoryRecursive") `modifyIOError` do dirType <- getDirectoryType path case dirType of - Directory -> removeContentsRecursive path - _ -> ioError . (`ioeSetErrorString` "not a directory") $ - mkIOError InappropriateType "" Nothing (Just path) + Directory -> + removeContentsRecursive path + DirectoryLink -> + ioError (err `ioeSetErrorString` "is a directory symbolic link") + NotDirectory -> + ioError (err `ioeSetErrorString` "not a directory") + where err = mkIOError InappropriateType "" Nothing (Just path) -- | @'removePathRecursive' path@ removes an existing file or directory at -- /path/ together with its contents and subdirectories. Symbolic links are diff --git a/changelog.md b/changelog.md index bf0d660..f917252 100644 --- a/changelog.md +++ b/changelog.md @@ -12,6 +12,9 @@ Changelog for the [`directory`][1] package * Add `copyFileWithAttrs`, which copies additional metadata ([#40](https://github.com/haskell/directory/issues/40)) + * Improve error message of `removeDirectoryRecursive` when used on a + directory symbolic link on Windows. + ## 1.2.5.1 (February 2015) * Improve error message of `getCurrentDirectory` when the current working From git at git.haskell.org Sat Apr 16 19:13:28 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 16 Apr 2016 19:13:28 +0000 (UTC) Subject: [commit: packages/directory] master: Add copyFileWithMetadata which also copies metadata (3af6da3) Message-ID: <20160416191328.791683A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3af6da320de757fa5f4b02b9bab09f4df5b5e486/directory >--------------------------------------------------------------- commit 3af6da320de757fa5f4b02b9bab09f4df5b5e486 Author: Phil Ruffwind Date: Thu Apr 14 02:30:21 2016 -0400 Add copyFileWithMetadata which also copies metadata Fixes #40. >--------------------------------------------------------------- 3af6da320de757fa5f4b02b9bab09f4df5b5e486 System/Directory.hs | 194 +++++++++++++++++++++++++++++++++++------- changelog.md | 3 + directory.cabal | 1 + tests/CopyFileWithMetadata.hs | 46 ++++++++++ tests/Main.hs | 2 + 5 files changed, 216 insertions(+), 30 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 3af6da320de757fa5f4b02b9bab09f4df5b5e486 From git at git.haskell.org Sat Apr 16 19:13:34 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 16 Apr 2016 19:13:34 +0000 (UTC) Subject: [commit: packages/directory] master: Drop support for Hugs (1df36f9) Message-ID: <20160416191334.8E1F83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1df36f9b6b82d246bf62631ff4555a82a34fc2c2/directory >--------------------------------------------------------------- commit 1df36f9b6b82d246bf62631ff4555a82a34fc2c2 Author: Phil Ruffwind Date: Thu Apr 14 05:34:46 2016 -0400 Drop support for Hugs It is highly probable that the library has not actually worked on Hugs for a long time due to bit rot and lack of testing, so no-one should miss it, really. >--------------------------------------------------------------- 1df36f9b6b82d246bf62631ff4555a82a34fc2c2 System/Directory.hs | 32 -------------------------------- cbits/directory.c | 4 ---- changelog.md | 2 ++ 3 files changed, 2 insertions(+), 36 deletions(-) diff --git a/System/Directory.hs b/System/Directory.hs index 44012d6..744a1a9 100644 --- a/System/Directory.hs +++ b/System/Directory.hs @@ -125,10 +125,6 @@ import System.IO.Error , modifyIOError , tryIOError ) -#ifdef __HUGS__ -import Hugs.Directory -#endif /* __HUGS__ */ - import Foreign {-# CFILES cbits/directory.c #-} @@ -142,8 +138,6 @@ import Data.Time.Clock.POSIX #endif ) -#ifdef __GLASGOW_HASKELL__ - import GHC.IO.Exception ( IOErrorType(InappropriateType) ) #ifdef mingw32_HOST_OS @@ -164,8 +158,6 @@ import Foreign.C (throwErrnoPathIfMinus1_) import System.Posix.Internals ( withFilePath ) #endif -#endif /* __GLASGOW_HASKELL__ */ - import System.Directory.Internal #ifdef mingw32_HOST_OS @@ -256,8 +248,6 @@ The operation may fail with: -} -#ifdef __GLASGOW_HASKELL__ - getPermissions :: FilePath -> IO Permissions getPermissions name = do #ifdef mingw32_HOST_OS @@ -416,14 +406,6 @@ createDirectory path = do Posix.createDirectory path 0o777 #endif -#else /* !__GLASGOW_HASKELL__ */ - -copyPermissions :: FilePath -> FilePath -> IO () -copyPermissions fromFPath toFPath - = getPermissions fromFPath >>= setPermissions toFPath - -#endif - -- | @'createDirectoryIfMissing' parents dir@ creates a new directory -- @dir@ if it doesn\'t exist. If the first argument is 'True' -- the function will also create all parent directories if they are missing. @@ -475,8 +457,6 @@ createDirectoryIfMissing create_parents path0 isDir = (Posix.isDirectory <$> Posix.getFileStatus dir) #endif -#if __GLASGOW_HASKELL__ - -- | * @'NotDirectory'@: not a directory. -- * @'Directory'@: a true directory (not a symbolic link). -- * @'DirectoryLink'@: a directory symbolic link (only exists on Windows). @@ -555,8 +535,6 @@ removeDirectory path = Posix.removeDirectory path #endif -#endif - -- | @'removeDirectoryRecursive' dir@ removes an existing directory /dir/ -- together with its contents and subdirectories. Within this directory, -- symbolic links are removed without affecting their targets. @@ -597,7 +575,6 @@ removeContentsRecursive path = mapM_ removePathRecursive [path x | x <- cont] removeDirectory path -#if __GLASGOW_HASKELL__ {- |'removeFile' /file/ removes the directory entry for an existing file /file/, where /file/ is not itself a directory. The implementation may specify additional constraints which must be @@ -783,8 +760,6 @@ renameFile opath npath = (`ioeSetLocation` "renameFile") `modifyIOError` do errIsDir path = ioError . (`ioeSetErrorString` "is a directory") $ mkIOError InappropriateType "" Nothing (Just path) -#endif /* __GLASGOW_HASKELL__ */ - -- | Copy a file with its permissions. If the destination file already exists, -- it is replaced atomically. Neither path may refer to an existing -- directory. No exceptions are thrown if the permissions could not be @@ -1183,7 +1158,6 @@ findFileWithIn f name d = do else return Nothing else return Nothing -#ifdef __GLASGOW_HASKELL__ -- | Similar to 'listDirectory', but always includes the special entries (@.@ -- and @..@). (This applies to Windows as well.) -- @@ -1260,9 +1234,6 @@ listDirectory path = (filter f) <$> (getDirectoryContents path) where f filename = filename /= "." && filename /= ".." -#endif /* __GLASGOW_HASKELL__ */ - - -- | Obtain the current working directory as an absolute path. -- -- In a multithreaded program, the current working directory is a global state @@ -1290,7 +1261,6 @@ listDirectory path = -- * 'UnsupportedOperation' -- The operating system has no notion of current working directory. -- -#ifdef __GLASGOW_HASKELL__ getCurrentDirectory :: IO FilePath getCurrentDirectory = modifyIOError (`ioeSetLocation` "getCurrentDirectory") $ @@ -1603,8 +1573,6 @@ posixToWindowsTime t = Win32.FILETIME $ truncate (t * 10000000 + windowsPosixEpochDifference) #endif -#endif /* __GLASGOW_HASKELL__ */ - #ifdef mingw32_HOST_OS withFileStatus :: String -> FilePath -> (Ptr CStat -> IO a) -> IO a withFileStatus loc name f = do diff --git a/cbits/directory.c b/cbits/directory.c index 55cece2..7f853f1 100644 --- a/cbits/directory.c +++ b/cbits/directory.c @@ -1,4 +1,3 @@ -#if defined(__GLASGOW_HASKELL__) || defined(__HUGS__) /* * (c) The University of Glasgow 2002 * @@ -8,6 +7,3 @@ #define INLINE #include "HsDirectory.h" - -#endif - diff --git a/changelog.md b/changelog.md index d047bd4..26fa808 100644 --- a/changelog.md +++ b/changelog.md @@ -17,6 +17,8 @@ Changelog for the [`directory`][1] package * Add `isSymbolicLink` + * Drop support for Hugs. + ## 1.2.5.1 (February 2015) * Improve error message of `getCurrentDirectory` when the current working From git at git.haskell.org Sat Apr 16 19:13:36 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 16 Apr 2016 19:13:36 +0000 (UTC) Subject: [commit: packages/directory] master: Add "Bundled with 8.0.1" to changelog.md (74e5058) Message-ID: <20160416191336.93E943A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/74e5058282c1fefa09b332c4a5c55fbf57907777/directory >--------------------------------------------------------------- commit 74e5058282c1fefa09b332c4a5c55fbf57907777 Author: Phil Ruffwind Date: Thu Apr 14 07:03:17 2016 -0400 Add "Bundled with 8.0.1" to changelog.md >--------------------------------------------------------------- 74e5058282c1fefa09b332c4a5c55fbf57907777 changelog.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/changelog.md b/changelog.md index 26fa808..562ed68 100644 --- a/changelog.md +++ b/changelog.md @@ -3,6 +3,8 @@ Changelog for the [`directory`][1] package ## 1.2.6.0 (April 2015) + * Bundled with GHC 8.0.1 + * Make `findExecutable`, `findExecutables`, `findExecutablesInDirectories`, `findFile`, and `findFilesWith` lazier ([#43](https://github.com/haskell/directory/issues/43)) From git at git.haskell.org Sat Apr 16 19:16:11 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 16 Apr 2016 19:16:11 +0000 (UTC) Subject: [commit: ghc] master: Update `directory` submodule to v1.2.6.0 release (3f3ad75) Message-ID: <20160416191611.803653A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3f3ad75e7b9127dac72cca56623879fbec0b88c8/ghc >--------------------------------------------------------------- commit 3f3ad75e7b9127dac72cca56623879fbec0b88c8 Author: Herbert Valerio Riedel Date: Sat Apr 16 21:17:03 2016 +0200 Update `directory` submodule to v1.2.6.0 release >--------------------------------------------------------------- 3f3ad75e7b9127dac72cca56623879fbec0b88c8 libraries/directory | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/directory b/libraries/directory index 33ce1ca..74e5058 160000 --- a/libraries/directory +++ b/libraries/directory @@ -1 +1 @@ -Subproject commit 33ce1ca6bef97b60957e4763b046eac9a982ead0 +Subproject commit 74e5058282c1fefa09b332c4a5c55fbf57907777 From git at git.haskell.org Sun Apr 17 09:06:50 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 17 Apr 2016 09:06:50 +0000 (UTC) Subject: [commit: packages/array] master: Migrate to @since markup syntax (21b098c) Message-ID: <20160417090650.E2C053A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/array On branch : master Link : http://git.haskell.org/packages/array.git/commitdiff/21b098c14a7d138365484f88e2b7c88c13b21a2b >--------------------------------------------------------------- commit 21b098c14a7d138365484f88e2b7c88c13b21a2b Author: Herbert Valerio Riedel Date: Sun Apr 17 11:07:22 2016 +0200 Migrate to @since markup syntax >--------------------------------------------------------------- 21b098c14a7d138365484f88e2b7c88c13b21a2b Data/Array/IO/Safe.hs | 2 +- Data/Array/MArray/Safe.hs | 2 +- Data/Array/ST/Safe.hs | 2 +- Data/Array/Storable/Internals.hs | 2 +- Data/Array/Storable/Safe.hs | 2 +- Data/Array/Unsafe.hs | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Data/Array/IO/Safe.hs b/Data/Array/IO/Safe.hs index 84ae956..c014d5a 100644 --- a/Data/Array/IO/Safe.hs +++ b/Data/Array/IO/Safe.hs @@ -14,7 +14,7 @@ -- . -- Safe API only of "Data.Array.IO". -- --- /Since: 0.4.0.0/ +-- @since 0.4.0.0 ----------------------------------------------------------------------------- module Data.Array.IO.Safe ( diff --git a/Data/Array/MArray/Safe.hs b/Data/Array/MArray/Safe.hs index 0af84ec..fcbf768 100644 --- a/Data/Array/MArray/Safe.hs +++ b/Data/Array/MArray/Safe.hs @@ -15,7 +15,7 @@ -- . -- Safe API only of "Data.Array.MArray". -- --- /Since: 0.4.0.0/ +-- @since 0.4.0.0 ----------------------------------------------------------------------------- module Data.Array.MArray.Safe ( diff --git a/Data/Array/ST/Safe.hs b/Data/Array/ST/Safe.hs index d856ff8..b3cc9a4 100644 --- a/Data/Array/ST/Safe.hs +++ b/Data/Array/ST/Safe.hs @@ -13,7 +13,7 @@ -- -- Safe API only of "Data.Array.ST". -- --- /Since: 0.4.0.0/ +-- @since 0.4.0.0 ----------------------------------------------------------------------------- module Data.Array.ST.Safe ( diff --git a/Data/Array/Storable/Internals.hs b/Data/Array/Storable/Internals.hs index 2e44fc1..6741bb1 100644 --- a/Data/Array/Storable/Internals.hs +++ b/Data/Array/Storable/Internals.hs @@ -15,7 +15,7 @@ -- -- Actual implementation of "Data.Array.Storable". -- --- /Since: 0.4.0.0/ +-- @since 0.4.0.0 ----------------------------------------------------------------------------- module Data.Array.Storable.Internals ( diff --git a/Data/Array/Storable/Safe.hs b/Data/Array/Storable/Safe.hs index 5c1f69b..467bca2 100644 --- a/Data/Array/Storable/Safe.hs +++ b/Data/Array/Storable/Safe.hs @@ -20,7 +20,7 @@ -- -- Safe API only of "Data.Array.Storable". -- --- /Since: 0.4.0.0/ +-- @since 0.4.0.0 ----------------------------------------------------------------------------- module Data.Array.Storable.Safe ( diff --git a/Data/Array/Unsafe.hs b/Data/Array/Unsafe.hs index 2eff6ef..7702269 100644 --- a/Data/Array/Unsafe.hs +++ b/Data/Array/Unsafe.hs @@ -11,7 +11,7 @@ -- Contains the various unsafe operations that can be performed -- on arrays. -- --- /Since: 0.4.0.0/ +-- @since 0.4.0.0 ----------------------------------------------------------------------------- module Data.Array.Unsafe ( From git at git.haskell.org Sun Apr 17 09:06:52 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 17 Apr 2016 09:06:52 +0000 (UTC) Subject: [commit: packages/array] master: Bump version to 0.5.1.1 and update changelog (6026ba0) Message-ID: <20160417090652.E629F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/array On branch : master Link : http://git.haskell.org/packages/array.git/commitdiff/6026ba0e6e94e5199e6c678a8e2110ed43fc1a50 >--------------------------------------------------------------- commit 6026ba0e6e94e5199e6c678a8e2110ed43fc1a50 Author: Herbert Valerio Riedel Date: Sun Apr 17 11:08:15 2016 +0200 Bump version to 0.5.1.1 and update changelog >--------------------------------------------------------------- 6026ba0e6e94e5199e6c678a8e2110ed43fc1a50 array.cabal | 2 +- changelog.md | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/array.cabal b/array.cabal index 566a11c..d5dd036 100644 --- a/array.cabal +++ b/array.cabal @@ -1,5 +1,5 @@ name: array -version: 0.5.1.0 +version: 0.5.1.1 -- NOTE: Don't forget to update ./changelog.md license: BSD3 license-file: LICENSE diff --git a/changelog.md b/changelog.md index 1134a32..a0c41eb 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,11 @@ # Changelog for [`array` package](http://hackage.haskell.org/package/array) +## 0.5.1.1 *Apr 2016* + + * Bundled with GHC 8.0.1 + * Use `@since` syntax in Haddock comments + * Don't needlessly call `bounds` in `Data.Array.Base.elems` (#10014) + ## 0.5.1.0 *Mar 2015* * Bundled with GHC 7.10.1 From git at git.haskell.org Sun Apr 17 09:55:54 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 17 Apr 2016 09:55:54 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: libdw: More precise version check (6554dc6) Message-ID: <20160417095554.E15CD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/6554dc60304bbd4b2edb93be7e1658bff237e067/ghc >--------------------------------------------------------------- commit 6554dc60304bbd4b2edb93be7e1658bff237e067 Author: Ben Gamari Date: Fri Apr 15 11:43:41 2016 +0200 libdw: More precise version check Test Plan: Try configure in an environment with older `libdw` Reviewers: hvr, austin Subscribers: thomie, erikd Differential Revision: https://phabricator.haskell.org/D2103 GHC Trac Issues: #11820 (cherry picked from commit e9ad48935fa48aa32dc39a55512168ba5f5bdbd2) >--------------------------------------------------------------- 6554dc60304bbd4b2edb93be7e1658bff237e067 configure.ac | 9 ++++++++- distrib/configure.ac.in | 10 ++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 8536d93..f7c2f33 100644 --- a/configure.ac +++ b/configure.ac @@ -1068,7 +1068,14 @@ if test "$use_large_address_space" = "yes" ; then AC_DEFINE([USE_LARGE_ADDRESS_SPACE], [1], [Enable single heap address space support]) fi -AC_CHECK_LIB(dw, dwfl_begin, [HaveLibdw=YES], [HaveLibdw=NO]) +dnl ** Have libdw? +dnl -------------------------------------------------------------- +AC_ARG_ENABLE(libdw, + [AC_HELP_STRING([--enable-dwarf-unwind], + [Enable DWARF unwinding support in the runtime system via elfutils' libdw [default=no]])], + [AC_CHECK_LIB(dw, dwfl_attach_state, [HaveLibdw=YES], [HaveLibdw=NO])], + [HaveLibdw=NO] +) AC_SUBST(HaveLibdw) if test -n "$SPHINXBUILD"; then diff --git a/distrib/configure.ac.in b/distrib/configure.ac.in index 0f68a52..c399352 100644 --- a/distrib/configure.ac.in +++ b/distrib/configure.ac.in @@ -93,8 +93,14 @@ AC_SUBST([LdCmd]) dnl ** Have libdw? dnl -------------------------------------------------------------- -AC_CHECK_LIB(dw, dwfl_begin, [HaveLibdw=YES], [HaveLibdw=NO]) -AC_SUBST(HaveLibdw) +dnl Check for a usable version of libdw/elfutils +dnl Currently we need 0.158 or newer. +BinDistNeedsLibdw=@HaveLibdw@ +if test "x$BinDistNeedsLibdw" = "xyes" ; then + AC_CHECK_LIB(dw, dwfl_attach_state, [HaveLibdw=YES], + [AC_MSG_ERROR([Binary distribution was built with libdw support but target system doesn't have supported libdw version (needs at least 0.158)])] + )]; +fi FP_GCC_VERSION AC_PROG_CPP From git at git.haskell.org Sun Apr 17 10:07:09 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 17 Apr 2016 10:07:09 +0000 (UTC) Subject: [commit: ghc] master: Update array submodule to v0.5.1.1 release tag (4cbae1b) Message-ID: <20160417100709.C272C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4cbae1bd70097a2d365ce0644145a8203956d59a/ghc >--------------------------------------------------------------- commit 4cbae1bd70097a2d365ce0644145a8203956d59a Author: Herbert Valerio Riedel Date: Sun Apr 17 11:10:24 2016 +0200 Update array submodule to v0.5.1.1 release tag >--------------------------------------------------------------- 4cbae1bd70097a2d365ce0644145a8203956d59a libraries/array | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/array b/libraries/array index 6551ad9..6026ba0 160000 --- a/libraries/array +++ b/libraries/array @@ -1 +1 @@ -Subproject commit 6551ad9edaca1634a8149ad9c27a72feb456d4e1 +Subproject commit 6026ba0e6e94e5199e6c678a8e2110ed43fc1a50 From git at git.haskell.org Sun Apr 17 10:08:38 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 17 Apr 2016 10:08:38 +0000 (UTC) Subject: [commit: packages/array] tag 'v0.5.1.1' created Message-ID: <20160417100838.DB81D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/array New tag : v0.5.1.1 Referencing: c8ebe15caefa494ebde321036dce6731d6c95585 From git at git.haskell.org Sun Apr 17 10:09:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 17 Apr 2016 10:09:23 +0000 (UTC) Subject: [commit: packages/array] branch 'D1426' deleted Message-ID: <20160417100923.325E93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/array Deleted branch: D1426 From git at git.haskell.org Sun Apr 17 10:09:40 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 17 Apr 2016 10:09:40 +0000 (UTC) Subject: [commit: packages/array] branch 'wip/rae' deleted Message-ID: <20160417100940.E68B13A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/array Deleted branch: wip/rae From git at git.haskell.org Sun Apr 17 11:04:28 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 17 Apr 2016 11:04:28 +0000 (UTC) Subject: [commit: ghc] master: Add Windows import library support to the Runtime Linker (97f2b16) Message-ID: <20160417110428.4FB593A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/97f2b16483aae28dc8fd60b6d2e1e283618f2390/ghc >--------------------------------------------------------------- commit 97f2b16483aae28dc8fd60b6d2e1e283618f2390 Author: Tamar Christina Date: Sun Apr 17 13:03:17 2016 +0200 Add Windows import library support to the Runtime Linker Summary: Import libraries are files ending in `.dll.a` and `.lib` depending on which compiler creates them (GCC, vs MSVC). Import Libraries are standard `archive` files that contain object files. These object files can have two different formats: 1) The normal COFF Object format for object files (contains all ascii data and very little program code, so do not try to execute.) 2) "short import" format which just contains a symbol name and the dll in which the symbol can be found. Import Libraries are useful for two things: 1) Allowing applications that don't support dynamic linking to link against the import lib (non-short format) which then makes calls into the DLL by loading it at runtime. 2) Allow linking of mutually recursive dlls. if `A.DLL` requires `B.DLL` and vice versa, import libs can be used to break the cycle as they can be created from the expected exports of the DLLs. A side effect of having these two capabilities is that Import libs are often used to hide specific versions of DLLs behind a non-versioned import lib. e.g. GCC_S.a (non-conventional import lib) will point to the correct `libGCC` DLL. With this support Windows Haskell files can now just link to `-lGCC_S` and not have to worry about what the actual name of libGCC is. Also third party libraries such as `icuuc` use import libs to forward to versioned DLLs. e.g. `icuuc.lib` points to `icuuc51.dll` etc. Test Plan: ./validate Two new tests added T11072gcc T11072msvc Two binary files have been added to the test folder because the "short" import library format doesn't seem to be creatable via `dlltool` and requires Microsoft's `lib.exe`. Reviewers: bgamari, RyanGlScott, erikd, goldfire, austin, hvr Reviewed By: RyanGlScott, erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1696 GHC Trac Issues: #11072 >--------------------------------------------------------------- 97f2b16483aae28dc8fd60b6d2e1e283618f2390 compiler/ghci/Linker.hs | 50 ++- rts/Linker.c | 385 +++++++++++++-------- rts/LinkerInternals.h | 125 ++++++- testsuite/tests/ghci/linking/dyn/Makefile | 16 + .../ghci/linking/dyn/{T1407.script => T11072.hs} | 5 +- .../linking/dyn/T11072gcc.stdout} | 0 .../linking/dyn/T11072msvc.stdout} | 0 testsuite/tests/ghci/linking/dyn/all.T | 10 + testsuite/tests/ghci/linking/dyn/i686/libAS.lib | Bin 0 -> 1698 bytes testsuite/tests/ghci/linking/dyn/libAS.def | 3 + testsuite/tests/ghci/linking/dyn/x86_64/libAS.lib | Bin 0 -> 1700 bytes 11 files changed, 440 insertions(+), 154 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 97f2b16483aae28dc8fd60b6d2e1e283618f2390 From git at git.haskell.org Sun Apr 17 12:23:21 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 17 Apr 2016 12:23:21 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Update `directory` submodule to v1.2.6.0 release (3be02f4) Message-ID: <20160417122321.23A3C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/3be02f4f85ab372dbbef7461a87c45cbe34250a0/ghc >--------------------------------------------------------------- commit 3be02f4f85ab372dbbef7461a87c45cbe34250a0 Author: Herbert Valerio Riedel Date: Sat Apr 16 21:17:03 2016 +0200 Update `directory` submodule to v1.2.6.0 release (cherry picked from commit 3f3ad75e7b9127dac72cca56623879fbec0b88c8) >--------------------------------------------------------------- 3be02f4f85ab372dbbef7461a87c45cbe34250a0 libraries/directory | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/directory b/libraries/directory index 33ce1ca..74e5058 160000 --- a/libraries/directory +++ b/libraries/directory @@ -1 +1 @@ -Subproject commit 33ce1ca6bef97b60957e4763b046eac9a982ead0 +Subproject commit 74e5058282c1fefa09b332c4a5c55fbf57907777 From git at git.haskell.org Sun Apr 17 12:23:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 17 Apr 2016 12:23:23 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Update array submodule to v0.5.1.1 release tag (26561f2) Message-ID: <20160417122323.C7D453A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/26561f2f8b3e6c7f91c3bd23edde02f0543f8d4c/ghc >--------------------------------------------------------------- commit 26561f2f8b3e6c7f91c3bd23edde02f0543f8d4c Author: Herbert Valerio Riedel Date: Sun Apr 17 11:10:24 2016 +0200 Update array submodule to v0.5.1.1 release tag (cherry picked from commit 4cbae1bd70097a2d365ce0644145a8203956d59a) >--------------------------------------------------------------- 26561f2f8b3e6c7f91c3bd23edde02f0543f8d4c libraries/array | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/array b/libraries/array index 6551ad9..6026ba0 160000 --- a/libraries/array +++ b/libraries/array @@ -1 +1 @@ -Subproject commit 6551ad9edaca1634a8149ad9c27a72feb456d4e1 +Subproject commit 6026ba0e6e94e5199e6c678a8e2110ed43fc1a50 From git at git.haskell.org Sun Apr 17 12:23:26 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 17 Apr 2016 12:23:26 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: deriveConstants: Verify sanity of nm (6810de7) Message-ID: <20160417122326.80DCA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/6810de7c1c1955819b12ba60a033e6af35a07ffb/ghc >--------------------------------------------------------------- commit 6810de7c1c1955819b12ba60a033e6af35a07ffb Author: Herbert Valerio Riedel Date: Sat Apr 16 15:25:07 2016 +0200 deriveConstants: Verify sanity of nm Add a sanity check ensuring that nm emits valid hexadecimal output, as required by POSIX. See #11744 for motivation. Reviewers: austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2113 GHC Trac Issues: #11744 (cherry picked from commit bf17fd0e5b5442a87f507b26e64a30c79732838a) >--------------------------------------------------------------- 6810de7c1c1955819b12ba60a033e6af35a07ffb utils/deriveConstants/Main.hs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/utils/deriveConstants/Main.hs b/utils/deriveConstants/Main.hs index 6a88ac2..96da166 100644 --- a/utils/deriveConstants/Main.hs +++ b/utils/deriveConstants/Main.hs @@ -296,8 +296,12 @@ haskellise "" = "" wanteds :: String -> Wanteds wanteds os = concat - [-- Closure header sizes. - constantWord Both "STD_HDR_SIZE" + [-- Control group constant for integrity check; this + -- round-tripped constant is used for testing that + -- derivedConstant works as expected + constantWord Both "CONTROL_GROUP_CONST_291" "0x123" + -- Closure header sizes. + ,constantWord Both "STD_HDR_SIZE" -- grrr.. PROFILING is on so we need to -- subtract sizeofW(StgProfHeader) "sizeofW(StgHeader) - sizeofW(StgProfHeader)" @@ -682,6 +686,14 @@ getWanted verbose os tmpdir gccProgram gccFlags nmProgram mobjdumpProgram m = Map.fromList $ case os of "aix" -> parseAixObjdump ls _ -> catMaybes $ map parseNmLine ls + + case Map.lookup "CONTROL_GROUP_CONST_291" m of + Just 292 -> return () -- OK + Nothing -> die "CONTROL_GROUP_CONST_291 missing!" + Just 0x292 -> die $ "broken 'nm' detected, see https://ghc.haskell.org/ticket/11744.\n" + ++ "Workaround: You may want to pass '--with-nm=nm-classic' to 'configure'." + Just x -> die ("unexpected value round-tripped for CONTROL_GROUP_CONST_291: " ++ show x) + rs <- mapM (lookupResult m) (wanteds os) return rs where headers = ["#define IN_STG_CODE 0", From git at git.haskell.org Sun Apr 17 14:10:37 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 17 Apr 2016 14:10:37 +0000 (UTC) Subject: [commit: ghc] master: Add flag to control number of missing patterns in warnings (7005b9f) Message-ID: <20160417141037.31A063A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7005b9f7b0f4db0c0401156557bd4988d0efd569/ghc >--------------------------------------------------------------- commit 7005b9f7b0f4db0c0401156557bd4988d0efd569 Author: David Luposchainsky Date: Sun Apr 17 14:41:33 2016 +0200 Add flag to control number of missing patterns in warnings Non-exhaustive pattern warnings had their number of patterns to show hardcoded in the past. This patch implements the TODO remark that this should be made a command line flag. -fmax-uncovered-patterns= can now be used to influence the number of patterns to be shown. Reviewers: hvr, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2076 >--------------------------------------------------------------- 7005b9f7b0f4db0c0401156557bd4988d0efd569 compiler/deSugar/Check.hs | 18 ++++++++---------- compiler/main/DynFlags.hs | 5 +++++ docs/users_guide/using-optimisation.rst | 7 +++++++ utils/mkUserGuidePart/Options/Optimizations.hs | 6 ++++++ 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/compiler/deSugar/Check.hs b/compiler/deSugar/Check.hs index fe1b4bc..02074e5 100644 --- a/compiler/deSugar/Check.hs +++ b/compiler/deSugar/Check.hs @@ -1256,6 +1256,8 @@ dsPmWarn dflags ctx@(DsMatchContext kind loc) pm_result flag_u = exhaustive dflags kind flag_u_reason = maybe NoReason Reason (exhaustiveWarningFlag kind) + maxPatterns = maxUncoveredPatterns dflags + -- Print a single clause (for redundant/with-inaccessible-rhs) pprEqn q txt = pp_context True ctx (text txt) $ \f -> ppr_eqn f kind q @@ -1266,7 +1268,8 @@ dsPmWarn dflags ctx@(DsMatchContext kind loc) pm_result -> text "Guards do not cover entire pattern space" _missing -> let us = map ppr qs in hang (text "Patterns not matched:") 4 - (vcat (take maximum_output us) $$ dots us) + (vcat (take maxPatterns us) + $$ dots maxPatterns us) -- | Issue a warning when the predefined number of iterations is exceeded -- for the pattern match checker @@ -1285,9 +1288,10 @@ warnPmIters dflags (DsMatchContext kind loc) flag_i = wopt Opt_WarnOverlappingPatterns dflags flag_u = exhaustive dflags kind -dots :: [a] -> SDoc -dots qs | qs `lengthExceeds` maximum_output = text "..." - | otherwise = empty +dots :: Int -> [a] -> SDoc +dots maxPatterns qs + | qs `lengthExceeds` maxPatterns = text "..." + | otherwise = empty -- | Check whether the exhaustiveness checker should run (exhaustiveness only) exhaustive :: DynFlags -> HsMatchContext id -> Bool @@ -1347,12 +1351,6 @@ ppr_uncovered (expr_vec, complex) sdoc_vec = mapM pprPmExprWithParens expr_vec (vec,cs) = runPmPprM sdoc_vec (filterComplex complex) --- | This variable shows the maximum number of lines of output generated for --- warnings. It will limit the number of patterns/equations displayed to --- maximum_output. (TODO: add command-line option?) -maximum_output :: Int -maximum_output = 4 - {- Note [Representation of Term Equalities] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In the paper, term constraints always take the form (x ~ e). Of course, a more diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index a79bb3a..e43869e 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -664,6 +664,8 @@ data DynFlags = DynFlags { maxRelevantBinds :: Maybe Int, -- ^ Maximum number of bindings from the type envt -- to show in type error messages + maxUncoveredPatterns :: Int, -- ^ Maximum number of unmatched patterns to show + -- in non-exhaustiveness warnings simplTickFactor :: Int, -- ^ Multiplier for simplifier ticks specConstrThreshold :: Maybe Int, -- ^ Threshold for SpecConstr specConstrCount :: Maybe Int, -- ^ Max number of specialisations for any one function @@ -1448,6 +1450,7 @@ defaultDynFlags mySettings = maxPmCheckIterations = 2000000, ruleCheck = Nothing, maxRelevantBinds = Just 6, + maxUncoveredPatterns = 4, simplTickFactor = 100, specConstrThreshold = Just 2000, specConstrCount = Just 3, @@ -2837,6 +2840,8 @@ dynamic_flags_deps = [ (intSuffix (\n d -> d { maxRelevantBinds = Just n })) , make_ord_flag defFlag "fno-max-relevant-binds" (noArg (\d -> d { maxRelevantBinds = Nothing })) + , make_ord_flag defFlag "fmax-uncovered-patterns" + (intSuffix (\n d -> d { maxUncoveredPatterns = n })) , make_ord_flag defFlag "fsimplifier-phases" (intSuffix (\n d -> d { simplPhases = n })) , make_ord_flag defFlag "fmax-simplifier-iterations" diff --git a/docs/users_guide/using-optimisation.rst b/docs/users_guide/using-optimisation.rst index 5e4995d..9436510 100644 --- a/docs/users_guide/using-optimisation.rst +++ b/docs/users_guide/using-optimisation.rst @@ -353,6 +353,13 @@ list. they may be numerous), but ``-fno-max-relevant-bindings`` includes them too. +.. ghc-flag:: -fmax-uncovered-patterns= + + :default: 4 + + Maximum number of unmatched patterns to be shown in warnings generated by + :ghc-flag:`-Wincomplete-patterns` and :ghc-flag:`-Wincomplete-uni-patterns`. + .. ghc-flag:: -fmax-simplifier-iterations= :default: 4 diff --git a/utils/mkUserGuidePart/Options/Optimizations.hs b/utils/mkUserGuidePart/Options/Optimizations.hs index dd9ffd9..5f46a06 100644 --- a/utils/mkUserGuidePart/Options/Optimizations.hs +++ b/utils/mkUserGuidePart/Options/Optimizations.hs @@ -178,6 +178,12 @@ optimizationsOptions = , flagType = DynamicFlag , flagReverse = "-fno-max-relevant-bindings" } + , flag { flagName = "-fmax-uncovered-patterns=?n?" + , flagDescription = + "*default: 4.* Set the maximum number of patterns to display in "++ + "warnings about non-exhaustive ones." + , flagType = DynamicFlag + } , flag { flagName = "-fmax-simplifier-iterations=?n?" , flagDescription = "*default: 4.* Set the max iterations for the simplifier." From git at git.haskell.org Sun Apr 17 14:10:39 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 17 Apr 2016 14:10:39 +0000 (UTC) Subject: [commit: ghc] master: users-guide: Fix typo (7a1c073) Message-ID: <20160417141039.DA9423A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7a1c07314c0955db822b84108aba0670adb0f9a5/ghc >--------------------------------------------------------------- commit 7a1c07314c0955db822b84108aba0670adb0f9a5 Author: Ben Gamari Date: Sun Apr 17 13:21:07 2016 +0200 users-guide: Fix typo >--------------------------------------------------------------- 7a1c07314c0955db822b84108aba0670adb0f9a5 docs/users_guide/glasgow_exts.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index 0bd48d3..4d238a5 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -5545,7 +5545,7 @@ This means that the usual string syntax can be used, e.g., for ``ByteString``, ``Text``, and other variations of string like types. String literals behave very much like integer literals, i.e., they can be used in both expressions and patterns. If used in a pattern the -literal with be replaced by an equality test, in the same way as an +literal will be replaced by an equality test, in the same way as an integer literal is. The class ``IsString`` is defined as: :: From git at git.haskell.org Sun Apr 17 14:10:42 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 17 Apr 2016 14:10:42 +0000 (UTC) Subject: [commit: ghc] master: validate: Note existence of config_args variable (07dc330) Message-ID: <20160417141042.8CD263A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/07dc330736103eee4b94607ef488b3578155f82b/ghc >--------------------------------------------------------------- commit 07dc330736103eee4b94607ef488b3578155f82b Author: Ben Gamari Date: Sun Apr 17 13:25:05 2016 +0200 validate: Note existence of config_args variable >--------------------------------------------------------------- 07dc330736103eee4b94607ef488b3578155f82b validate | 3 +++ 1 file changed, 3 insertions(+) diff --git a/validate b/validate index 1735065..ff51564 100755 --- a/validate +++ b/validate @@ -33,6 +33,9 @@ Flags: THREADS=1 ./validate + You can set the 'config_args' environment variable to pass flags to + 'configure'. + You can also use environment variables to pass extra options to the testsuite. For example: From git at git.haskell.org Sun Apr 17 14:10:45 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 17 Apr 2016 14:10:45 +0000 (UTC) Subject: [commit: ghc] master: Add TemplateHaskell support for Overlapping pragmas (04b70cd) Message-ID: <20160417141045.C68E93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/04b70cda4ed006c7e3df40e169550a00aba79524/ghc >--------------------------------------------------------------- commit 04b70cda4ed006c7e3df40e169550a00aba79524 Author: Iavor S. Diatchki Date: Sun Apr 17 12:56:31 2016 +0200 Add TemplateHaskell support for Overlapping pragmas Reviewers: hvr, goldfire, austin, RyanGlScott, bgamari Reviewed By: RyanGlScott, bgamari Subscribers: RyanGlScott, thomie Differential Revision: https://phabricator.haskell.org/D2118 >--------------------------------------------------------------- 04b70cda4ed006c7e3df40e169550a00aba79524 compiler/deSugar/DsMeta.hs | 29 +++++++++++-- compiler/hsSyn/Convert.hs | 14 +++++- compiler/prelude/THNames.hs | 50 ++++++++++++++++++---- compiler/typecheck/TcSplice.hs | 8 +++- libraries/ghci/GHCi/TH/Binary.hs | 1 + libraries/template-haskell/Language/Haskell/TH.hs | 4 +- .../template-haskell/Language/Haskell/TH/Lib.hs | 9 +++- .../template-haskell/Language/Haskell/TH/Ppr.hs | 12 +++++- .../template-haskell/Language/Haskell/TH/Syntax.hs | 14 +++++- libraries/template-haskell/changelog.md | 2 + testsuite/tests/ghci/scripts/T4127.stdout | 2 +- .../tests/safeHaskell/safeLanguage/SafeLang11_B.hs | 2 +- .../tests/safeHaskell/safeLanguage/SafeLang12_B.hs | 2 +- testsuite/tests/th/T5452.hs | 4 +- testsuite/tests/th/T5700a.hs | 2 +- testsuite/tests/th/T5886a.hs | 2 +- testsuite/tests/th/T7532a.hs | 2 +- testsuite/tests/th/T8625.stdout | 2 +- testsuite/tests/th/TH_overlaps.hs | 29 +++++++++++++ testsuite/tests/th/all.T | 2 + 20 files changed, 162 insertions(+), 30 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 04b70cda4ed006c7e3df40e169550a00aba79524 From git at git.haskell.org Sun Apr 17 14:10:48 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 17 Apr 2016 14:10:48 +0000 (UTC) Subject: [commit: ghc] master: TH: Tweak Haddock language (89b6674) Message-ID: <20160417141048.8CD513A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/89b66742b770311255a441f7fe641b9e212d87aa/ghc >--------------------------------------------------------------- commit 89b66742b770311255a441f7fe641b9e212d87aa Author: Ben Gamari Date: Sun Apr 17 12:58:24 2016 +0200 TH: Tweak Haddock language >--------------------------------------------------------------- 89b66742b770311255a441f7fe641b9e212d87aa libraries/template-haskell/Language/Haskell/TH/Syntax.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs index c8d9d75..8022f94 100644 --- a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs +++ b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs @@ -1550,13 +1550,13 @@ data Dec | DefaultSigD Name Type -- ^ @{ default size :: Data a => a -> Int }@ deriving( Show, Eq, Ord, Data, Typeable, Generic ) --- | Properties for overlapping instances. +-- | Varieties of allowed instance overlap. data Overlap = Overlappable -- ^ May be overlapped by more specific instances | Overlapping -- ^ May overlap a more general instance | Overlaps -- ^ Both 'Overlapping' and 'Overlappable' | Incoherent -- ^ Both 'Overlappable' and 'Overlappable', and -- pick an arbitrary one if multiple choices are - -- avaialble. + -- available. deriving( Show, Eq, Ord, Data, Typeable, Generic ) -- | Common elements of 'OpenTypeFamilyD' and 'ClosedTypeFamilyD'. From git at git.haskell.org Sun Apr 17 14:10:51 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 17 Apr 2016 14:10:51 +0000 (UTC) Subject: [commit: ghc] master: Check CCS tree for pointers into shared object during checkUnload (36a0b6d) Message-ID: <20160417141051.5CA733A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/36a0b6dc27ae0ee2022afbef5d3cd49dfde9e82b/ghc >--------------------------------------------------------------- commit 36a0b6dc27ae0ee2022afbef5d3cd49dfde9e82b Author: Andrew Farmer Date: Sun Apr 17 14:43:24 2016 +0200 Check CCS tree for pointers into shared object during checkUnload Prevent shared objects from being unloaded if cost centre stacks point at the object. This will prevent segfault in #11776, but also prevents objects from ever being unloaded when profiling. Pruning CCS tree will enable that in another diff. Test Plan: make TEST=linker_profiled, examine linker_profiled.run.stderr Reviewers: austin, simonmar, bgamari Reviewed By: simonmar, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2069 GHC Trac Issues: #11776 >--------------------------------------------------------------- 36a0b6dc27ae0ee2022afbef5d3cd49dfde9e82b rts/CheckUnload.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/rts/CheckUnload.c b/rts/CheckUnload.c index b8014a6..7dc2c9c 100644 --- a/rts/CheckUnload.c +++ b/rts/CheckUnload.c @@ -23,6 +23,7 @@ // - info pointers in heap objects and stack frames // - pointers to static objects from the heap // - StablePtrs to static objects +// - pointers to cost centres from the cost centre tree // // We can find live static objects after a major GC, so we don't have // to look at every closure pointer in the heap. However, we do have @@ -244,6 +245,25 @@ static void searchHeapBlocks (HashTable *addrs, bdescr *bd) } } +#ifdef PROFILING +// +// Do not unload the object if the CCS tree refers to a CCS or CC which +// originates in the object. +// +static void searchCostCentres (HashTable *addrs, CostCentreStack *ccs) +{ + IndexTable *i; + + checkAddress(addrs, ccs); + checkAddress(addrs, ccs->cc); + for (i = ccs->indexTable; i != NULL; i = i->next) { + if (!i->back_edge) { + searchCostCentres(addrs, i->ccs); + } + } +} +#endif + // // Check whether we can unload any object code. This is called at the // appropriate point during a GC, where all the heap data is nice and @@ -303,6 +323,17 @@ void checkUnload (StgClosure *static_objects) } } +#ifdef PROFILING + /* Traverse the cost centre tree, calling checkAddress on each CCS/CC */ + searchCostCentres(addrs, CCS_MAIN); + + /* Also check each cost centre in the CC_LIST */ + CostCentre *cc; + for (cc = CC_LIST; cc != NULL; cc = cc->link) { + checkAddress(addrs, cc); + } +#endif /* PROFILING */ + // Look through the unloadable objects, and any object that is still // marked as unreferenced can be physically unloaded, because we // have no references to it. From git at git.haskell.org Sun Apr 17 14:10:54 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 17 Apr 2016 14:10:54 +0000 (UTC) Subject: [commit: ghc] master: Linker: Clean up #if USE_MMAP usage (177aec6) Message-ID: <20160417141054.1798E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/177aec697b3d7eedcc4905d9ef783feafb4ba2a1/ghc >--------------------------------------------------------------- commit 177aec697b3d7eedcc4905d9ef783feafb4ba2a1 Author: Erik de Castro Lopo Date: Sun Apr 17 14:44:38 2016 +0200 Linker: Clean up #if USE_MMAP usage Test Plan: - Run tests on x86_64/linux, x86_64/darwin and powerpc/linux - Cross compile rts/Linker.c with the i686-w64-mingw32-gcc and x86_64-w64-mingw32-gcc Linux to Windows cross-compilers. Reviewers: hvr, austin, thomie, bgamari, simonmar, Phyx Reviewed By: Phyx Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1437 >--------------------------------------------------------------- 177aec697b3d7eedcc4905d9ef783feafb4ba2a1 rts/Linker.c | 110 ++++++++++++++++++++++++++++------------------------------- 1 file changed, 52 insertions(+), 58 deletions(-) diff --git a/rts/Linker.c b/rts/Linker.c index d670f1d..ef7baf9 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -1880,15 +1880,7 @@ static void freeOcStablePtrs (ObjectCode *oc) static void freePreloadObjectFile (ObjectCode *oc) { -#if USE_MMAP - - if (oc->imageMapped) { - munmap(oc->image, oc->fileSize); - } else { - stgFree(oc->image); - } - -#elif defined(mingw32_HOST_OS) +#if defined(mingw32_HOST_OS) VirtualFree(oc->image - PEi386_IMAGE_OFFSET, 0, MEM_RELEASE); @@ -1903,7 +1895,12 @@ freePreloadObjectFile (ObjectCode *oc) #else - stgFree(oc->image); + if (USE_MMAP && oc->imageMapped) { + munmap(oc->image, oc->fileSize); + } + else { + stgFree(oc->image); + } #endif @@ -1956,14 +1953,15 @@ void freeObjectCode (ObjectCode *oc) /* Free symbol_extras. On x86_64 Windows, symbol_extras are allocated * alongside the image, so we don't need to free. */ #if NEED_SYMBOL_EXTRAS && (!defined(x86_64_HOST_ARCH) || !defined(mingw32_HOST_OS)) -#if USE_MMAP - if (!USE_CONTIGUOUS_MMAP && oc->symbol_extras != NULL) - { - m32_free(oc->symbol_extras, sizeof(SymbolExtra) * oc->n_symbol_extras); + if (USE_MMAP) { + if (!USE_CONTIGUOUS_MMAP && oc->symbol_extras != NULL) { + m32_free(oc->symbol_extras, + sizeof(SymbolExtra) * oc->n_symbol_extras); + } + } + else { + stgFree(oc->symbol_extras); } -#else // !USE_MMAP - stgFree(oc->symbol_extras); -#endif #endif stgFree(oc->fileName); @@ -2391,14 +2389,15 @@ static HsInt loadArchive_ (pathchar *path) #endif memberSize); #elif defined(darwin_HOST_OS) -#if USE_MMAP - image = mmapForLinker(memberSize, MAP_ANONYMOUS, -1, 0); -#else - /* See loadObj() */ - misalignment = machoGetMisalignment(f); - image = stgMallocBytes(memberSize + misalignment, "loadArchive(image)"); - image += misalignment; -#endif // USE_MMAP + if (USE_MMAP) + image = mmapForLinker(memberSize, MAP_ANONYMOUS, -1, 0); + else { + /* See loadObj() */ + misalignment = machoGetMisalignment(f); + image = stgMallocBytes(memberSize + misalignment, + "loadArchive(image)"); + image += misalignment; + } #else // not windows or darwin image = stgMallocBytes(memberSize, "loadArchive(image)"); @@ -3060,16 +3059,13 @@ static int ocAllocateSymbolExtras( ObjectCode* oc, int count, int first ) { StgWord n; -#if USE_MMAP - if (USE_CONTIGUOUS_MMAP) - { + if (USE_MMAP && USE_CONTIGUOUS_MMAP) { n = roundUpToPage(oc->fileSize); /* Keep image and symbol_extras contiguous */ void *new = mmapForLinker(n + (sizeof(SymbolExtra) * count), MAP_ANONYMOUS, -1, 0); - if (new) - { + if (new) { memcpy(new, oc->image, oc->fileSize); if (oc->imageMapped) { munmap(oc->image, n); @@ -3084,32 +3080,28 @@ static int ocAllocateSymbolExtras( ObjectCode* oc, int count, int first ) return 0; } } - else -#endif + else if( count > 0 ) { + if (USE_MMAP) { + n = roundUpToPage(oc->fileSize); - if( count > 0 ) - { -#if USE_MMAP - n = roundUpToPage(oc->fileSize); - - oc->symbol_extras = m32_alloc(&allocator, + oc->symbol_extras = m32_alloc(&allocator, sizeof(SymbolExtra) * count, 8); - if (oc->symbol_extras == NULL) return 0; -#else - // round up to the nearest 4 - int aligned = (oc->fileSize + 3) & ~3; - - int misalignment = oc->misalignment; + if (oc->symbol_extras == NULL) return 0; + } + else { + // round up to the nearest 4 + int aligned = (oc->fileSize + 3) & ~3; + int misalignment = oc->misalignment; - oc->image -= misalignment; - oc->image = stgReallocBytes( oc->image, + oc->image -= misalignment; + oc->image = stgReallocBytes( oc->image, misalignment + aligned + sizeof (SymbolExtra) * count, "ocAllocateSymbolExtras" ); - oc->image += misalignment; + oc->image += misalignment; - oc->symbol_extras = (SymbolExtra *) (oc->image + aligned); -#endif /* USE_MMAP */ + oc->symbol_extras = (SymbolExtra *) (oc->image + aligned); + } } if (oc->symbol_extras != NULL) { @@ -7010,16 +7002,18 @@ ocGetNames_MachO(ObjectCode* oc) continue; } - if((sections[i].flags & SECTION_TYPE) == S_ZEROFILL) - { -#if USE_MMAP - char * zeroFillArea = mmapForLinker(sections[i].size, MAP_ANONYMOUS, -1, 0); - if (zeroFillArea == NULL) return 0; - memset(zeroFillArea, 0, sections[i].size); -#else - char * zeroFillArea = stgCallocBytes(1,sections[i].size, + if((sections[i].flags & SECTION_TYPE) == S_ZEROFILL) { + char * zeroFillArea; + if (USE_MMAP) { + zeroFillArea = mmapForLinker(sections[i].size, MAP_ANONYMOUS, + -1, 0); + if (zeroFillArea == NULL) return 0; + memset(zeroFillArea, 0, sections[i].size); + } + else { + zeroFillArea = stgCallocBytes(1,sections[i].size, "ocGetNames_MachO(common symbols)"); -#endif + } sections[i].offset = zeroFillArea - image; } From git at git.haskell.org Sun Apr 17 14:45:09 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 17 Apr 2016 14:45:09 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Add TemplateHaskell support for Overlapping pragmas (c3dafd9) Message-ID: <20160417144509.02B983A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/c3dafd9168827d0c32d7d9483aa223157f925026/ghc >--------------------------------------------------------------- commit c3dafd9168827d0c32d7d9483aa223157f925026 Author: Iavor S. Diatchki Date: Sun Apr 17 12:56:31 2016 +0200 Add TemplateHaskell support for Overlapping pragmas Reviewers: hvr, goldfire, austin, RyanGlScott, bgamari Reviewed By: RyanGlScott, bgamari Subscribers: RyanGlScott, thomie Differential Revision: https://phabricator.haskell.org/D2118 (cherry picked from commit 04b70cda4ed006c7e3df40e169550a00aba79524) >--------------------------------------------------------------- c3dafd9168827d0c32d7d9483aa223157f925026 compiler/deSugar/DsMeta.hs | 29 +++++++++++-- compiler/hsSyn/Convert.hs | 14 +++++- compiler/prelude/THNames.hs | 50 ++++++++++++++++++---- compiler/typecheck/TcSplice.hs | 8 +++- libraries/ghci/GHCi/TH/Binary.hs | 1 + libraries/template-haskell/Language/Haskell/TH.hs | 4 +- .../template-haskell/Language/Haskell/TH/Lib.hs | 9 +++- .../template-haskell/Language/Haskell/TH/Ppr.hs | 12 +++++- .../template-haskell/Language/Haskell/TH/Syntax.hs | 14 +++++- libraries/template-haskell/changelog.md | 2 + testsuite/tests/ghci/scripts/T4127.stdout | 2 +- .../tests/safeHaskell/safeLanguage/SafeLang11_B.hs | 2 +- .../tests/safeHaskell/safeLanguage/SafeLang12_B.hs | 2 +- testsuite/tests/th/T5452.hs | 4 +- testsuite/tests/th/T5700a.hs | 2 +- testsuite/tests/th/T5886a.hs | 2 +- testsuite/tests/th/T7532a.hs | 2 +- testsuite/tests/th/T8625.stdout | 2 +- testsuite/tests/th/TH_overlaps.hs | 29 +++++++++++++ testsuite/tests/th/all.T | 2 + 20 files changed, 162 insertions(+), 30 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc c3dafd9168827d0c32d7d9483aa223157f925026 From git at git.haskell.org Sun Apr 17 14:45:11 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 17 Apr 2016 14:45:11 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: TH: Tweak Haddock language (1c3b1cb) Message-ID: <20160417144511.A32DB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/1c3b1cbddf3cab12348a20baa8fa8cde486c80e2/ghc >--------------------------------------------------------------- commit 1c3b1cbddf3cab12348a20baa8fa8cde486c80e2 Author: Ben Gamari Date: Sun Apr 17 12:58:24 2016 +0200 TH: Tweak Haddock language (cherry picked from commit 89b66742b770311255a441f7fe641b9e212d87aa) >--------------------------------------------------------------- 1c3b1cbddf3cab12348a20baa8fa8cde486c80e2 libraries/template-haskell/Language/Haskell/TH/Syntax.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs index b76a5fe..9a7e019 100644 --- a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs +++ b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs @@ -1565,13 +1565,13 @@ data Dec | DefaultSigD Name Type -- ^ @{ default size :: Data a => a -> Int }@ deriving( Show, Eq, Ord, Data, Typeable, Generic ) --- | Properties for overlapping instances. +-- | Varieties of allowed instance overlap. data Overlap = Overlappable -- ^ May be overlapped by more specific instances | Overlapping -- ^ May overlap a more general instance | Overlaps -- ^ Both 'Overlapping' and 'Overlappable' | Incoherent -- ^ Both 'Overlappable' and 'Overlappable', and -- pick an arbitrary one if multiple choices are - -- avaialble. + -- available. deriving( Show, Eq, Ord, Data, Typeable, Generic ) -- | Common elements of 'OpenTypeFamilyD' and 'ClosedTypeFamilyD'. From git at git.haskell.org Sun Apr 17 14:45:14 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 17 Apr 2016 14:45:14 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: users-guide: Fix typo (89d5f45) Message-ID: <20160417144514.5E9B63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/89d5f453e2d48d148ffa61c06e41465ea6836f91/ghc >--------------------------------------------------------------- commit 89d5f453e2d48d148ffa61c06e41465ea6836f91 Author: Ben Gamari Date: Sun Apr 17 13:21:07 2016 +0200 users-guide: Fix typo (cherry picked from commit 7a1c07314c0955db822b84108aba0670adb0f9a5) >--------------------------------------------------------------- 89d5f453e2d48d148ffa61c06e41465ea6836f91 docs/users_guide/glasgow_exts.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index 9404600..408f63f 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -5524,7 +5524,7 @@ This means that the usual string syntax can be used, e.g., for ``ByteString``, ``Text``, and other variations of string like types. String literals behave very much like integer literals, i.e., they can be used in both expressions and patterns. If used in a pattern the -literal with be replaced by an equality test, in the same way as an +literal will be replaced by an equality test, in the same way as an integer literal is. The class ``IsString`` is defined as: :: From git at git.haskell.org Sun Apr 17 14:45:17 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 17 Apr 2016 14:45:17 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: validate: Note existence of config_args variable (fcbc21b) Message-ID: <20160417144517.0B9AF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/fcbc21bacb44001a4bd79d7766dd5e819a67bc9a/ghc >--------------------------------------------------------------- commit fcbc21bacb44001a4bd79d7766dd5e819a67bc9a Author: Ben Gamari Date: Sun Apr 17 13:25:05 2016 +0200 validate: Note existence of config_args variable (cherry picked from commit 07dc330736103eee4b94607ef488b3578155f82b) >--------------------------------------------------------------- fcbc21bacb44001a4bd79d7766dd5e819a67bc9a validate | 3 +++ 1 file changed, 3 insertions(+) diff --git a/validate b/validate index dadd556..c386523 100755 --- a/validate +++ b/validate @@ -33,6 +33,9 @@ Flags: THREADS=1 ./validate + You can set the 'config_args' environment variable to pass flags to + 'configure'. + You can also use environment variables to pass extra options to the testsuite. For example: From git at git.haskell.org Sun Apr 17 14:45:19 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 17 Apr 2016 14:45:19 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Check CCS tree for pointers into shared object during checkUnload (da6d720) Message-ID: <20160417144519.A7B453A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/da6d72057e20389c621eb7dd8d7018206eda5900/ghc >--------------------------------------------------------------- commit da6d72057e20389c621eb7dd8d7018206eda5900 Author: Andrew Farmer Date: Sun Apr 17 14:43:24 2016 +0200 Check CCS tree for pointers into shared object during checkUnload Prevent shared objects from being unloaded if cost centre stacks point at the object. This will prevent segfault in #11776, but also prevents objects from ever being unloaded when profiling. Pruning CCS tree will enable that in another diff. Test Plan: make TEST=linker_profiled, examine linker_profiled.run.stderr Reviewers: austin, simonmar, bgamari Reviewed By: simonmar, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2069 GHC Trac Issues: #11776 (cherry picked from commit 36a0b6dc27ae0ee2022afbef5d3cd49dfde9e82b) >--------------------------------------------------------------- da6d72057e20389c621eb7dd8d7018206eda5900 rts/CheckUnload.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/rts/CheckUnload.c b/rts/CheckUnload.c index c756738..8d0846c 100644 --- a/rts/CheckUnload.c +++ b/rts/CheckUnload.c @@ -23,6 +23,7 @@ // - info pointers in heap objects and stack frames // - pointers to static objects from the heap // - StablePtrs to static objects +// - pointers to cost centres from the cost centre tree // // We can find live static objects after a major GC, so we don't have // to look at every closure pointer in the heap. However, we do have @@ -245,6 +246,25 @@ static void searchHeapBlocks (HashTable *addrs, bdescr *bd) } } +#ifdef PROFILING +// +// Do not unload the object if the CCS tree refers to a CCS or CC which +// originates in the object. +// +static void searchCostCentres (HashTable *addrs, CostCentreStack *ccs) +{ + IndexTable *i; + + checkAddress(addrs, ccs); + checkAddress(addrs, ccs->cc); + for (i = ccs->indexTable; i != NULL; i = i->next) { + if (!i->back_edge) { + searchCostCentres(addrs, i->ccs); + } + } +} +#endif + // // Check whether we can unload any object code. This is called at the // appropriate point during a GC, where all the heap data is nice and @@ -304,6 +324,17 @@ void checkUnload (StgClosure *static_objects) } } +#ifdef PROFILING + /* Traverse the cost centre tree, calling checkAddress on each CCS/CC */ + searchCostCentres(addrs, CCS_MAIN); + + /* Also check each cost centre in the CC_LIST */ + CostCentre *cc; + for (cc = CC_LIST; cc != NULL; cc = cc->link) { + checkAddress(addrs, cc); + } +#endif /* PROFILING */ + // Look through the unloadable objects, and any object that is still // marked as unreferenced can be physically unloaded, because we // have no references to it. From git at git.haskell.org Sun Apr 17 15:20:44 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 17 Apr 2016 15:20:44 +0000 (UTC) Subject: [commit: ghc] master: Resolve symlinks when attempting to find GHC's lib folder on Windows (a392208) Message-ID: <20160417152044.4682A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a3922083e8f41fc236972564dc2978f2a2d4ec13/ghc >--------------------------------------------------------------- commit a3922083e8f41fc236972564dc2978f2a2d4ec13 Author: Tamar Christina Date: Sun Apr 17 17:11:02 2016 +0200 Resolve symlinks when attempting to find GHC's lib folder on Windows Summary: Systools makes some pretty hard assumptions about where GHC is on Windows. One of these is that ghc be in a folder named `bin` and that `../lib` exists. This pattern doesn't hold for symlinks as a link `C:\ghc-bin\` pointing to `C:\ghc\ghc-7.10.3\bin` will break this assumption. This patch resolves symlinks by finding where they point to and uses that location as the base for GHC. This uses an API that's been introduced in Vista. For older systems it falls back to the current behavior of not resolving symlinks. Test Plan: 1) Create symlink to GHC's bin folder. 2) Run GHC from that folder. Reviewers: austin, bgamari Reviewed By: austin Subscribers: #ghc_windows_task_force, thomie Differential Revision: https://phabricator.haskell.org/D2101 GHC Trac Issues: #11759 >--------------------------------------------------------------- a3922083e8f41fc236972564dc2978f2a2d4ec13 compiler/main/SysTools.hs | 52 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/compiler/main/SysTools.hs b/compiler/main/SysTools.hs index 4afb199..9423b00 100644 --- a/compiler/main/SysTools.hs +++ b/compiler/main/SysTools.hs @@ -85,6 +85,14 @@ import qualified System.Posix.Internals #else /* Must be Win32 */ import Foreign import Foreign.C.String +import qualified System.Win32.Info as Info +import Control.Exception (finally) +import Foreign.Ptr (FunPtr, castPtrToFunPtr) +import System.Win32.Types (DWORD, LPTSTR, HANDLE) +import System.Win32.Types (failIfNull, failIf, iNVALID_HANDLE_VALUE) +import System.Win32.File (createFile,closeHandle, gENERIC_READ, fILE_SHARE_READ, oPEN_EXISTING, fILE_ATTRIBUTE_NORMAL, fILE_FLAG_BACKUP_SEMANTICS ) +import System.Win32.DLL (loadLibrary, getProcAddress) +import Data.Bits((.|.)) #endif import System.Process @@ -1495,9 +1503,19 @@ getBaseDir = try_size 2048 -- plenty, PATH_MAX is 512 under Win32. ret <- c_GetModuleFileName nullPtr buf size case ret of 0 -> return Nothing - _ | ret < size -> fmap (Just . rootDir) $ peekCWString buf + _ | ret < size -> do path <- peekCWString buf + real <- getFinalPath path -- try to resolve symlinks paths + return $ (Just . rootDir . sanitize . maybe path id) real | otherwise -> try_size (size * 2) + -- getFinalPath returns paths in full raw form. + -- Unfortunately GHC isn't set up to handle these + -- So if the call succeeded, we need to drop the + -- \\?\ prefix. + sanitize s = if "\\\\?\\" `isPrefixOf` s + then drop 4 s + else s + rootDir s = case splitFileName $ normalise s of (d, ghc_exe) | lower ghc_exe `elem` ["ghc.exe", @@ -1514,6 +1532,38 @@ getBaseDir = try_size 2048 -- plenty, PATH_MAX is 512 under Win32. foreign import WINDOWS_CCONV unsafe "windows.h GetModuleFileNameW" c_GetModuleFileName :: Ptr () -> CWString -> Word32 -> IO Word32 + +-- Attempt to resolve symlinks in order to find the actual location GHC +-- is located at. See Trac #11759. +getFinalPath :: FilePath -> IO (Maybe FilePath) +getFinalPath name = do + dllHwnd <- failIfNull "LoadLibray" $ loadLibrary "kernel32.dll" + -- Note: The API GetFinalPathNameByHandleW is only available starting from Windows Vista. + -- This means that we can't bind directly to it since it may be missing. + -- Instead try to find it's address at runtime and if we don't succeed consider the + -- function failed. + addr_m <- (fmap Just $ failIfNull "getProcAddress" $ getProcAddress dllHwnd "GetFinalPathNameByHandleW") + `catch` (\(_ :: SomeException) -> return Nothing) + case addr_m of + Nothing -> return Nothing + Just addr -> do handle <- failIf (==iNVALID_HANDLE_VALUE) "CreateFile" + $ createFile name + gENERIC_READ + fILE_SHARE_READ + Nothing + oPEN_EXISTING + (fILE_ATTRIBUTE_NORMAL .|. fILE_FLAG_BACKUP_SEMANTICS) + Nothing + let fnPtr = makeGetFinalPathNameByHandle $ castPtrToFunPtr addr + path <- Info.try "GetFinalPathName" + (\buf len -> fnPtr handle buf len 0) 512 + `finally` closeHandle handle + return $ Just path + +type GetFinalPath = HANDLE -> LPTSTR -> DWORD -> DWORD -> IO DWORD + +foreign import WINDOWS_CCONV unsafe "dynamic" + makeGetFinalPathNameByHandle :: FunPtr GetFinalPath -> GetFinalPath #else getBaseDir = return Nothing #endif From git at git.haskell.org Sun Apr 17 15:35:28 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 17 Apr 2016 15:35:28 +0000 (UTC) Subject: [commit: packages/directory] tag 'v1.2.6.1' created Message-ID: <20160417153528.B143F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory New tag : v1.2.6.1 Referencing: dcf477a1f843e7bc2e0f6f4748d87d0d6545af8e From git at git.haskell.org Sun Apr 17 15:35:30 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 17 Apr 2016 15:35:30 +0000 (UTC) Subject: [commit: packages/directory] master: Fix build on Darwin (e16b2c1) Message-ID: <20160417153530.B95963A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e16b2c1e125177085b7a89ce4c1818d255122d86/directory >--------------------------------------------------------------- commit e16b2c1e125177085b7a89ce4c1818d255122d86 Author: Ben Gamari Date: Sun Apr 17 14:35:08 2016 +0200 Fix build on Darwin There were a number of issues there, largely due to the fact that this codepath is CPP-guarded. >--------------------------------------------------------------- e16b2c1e125177085b7a89ce4c1818d255122d86 System/Directory.hs | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/System/Directory.hs b/System/Directory.hs index 744a1a9..469ed2b 100644 --- a/System/Directory.hs +++ b/System/Directory.hs @@ -109,6 +109,9 @@ import Data.Maybe #ifdef mingw32_HOST_OS , maybeToList #endif +#if !defined(mingw32_HOST_OS) && ! defined(HAVE_UTIMENSAT) + , fromMaybe +#endif ) import System.FilePath @@ -133,9 +136,7 @@ import Data.Time ( UTCTime ) import Data.Time.Clock.POSIX ( posixSecondsToUTCTime , utcTimeToPOSIXSeconds -#ifdef mingw32_HOST_OS , POSIXTime -#endif ) import GHC.IO.Exception ( IOErrorType(InappropriateType) ) @@ -1524,6 +1525,8 @@ setFileTimes path (atime, mtime) = setTimes (utcTimeToPOSIXSeconds <$> atime, utcTimeToPOSIXSeconds <$> mtime) where path' = normalise path -- handle empty paths + + setTimes :: (Maybe POSIXTime, Maybe POSIXTime) -> IO () #ifdef mingw32_HOST_OS setTimes (atime', mtime') = bracket (openFileHandle path' Win32.gENERIC_WRITE) @@ -1540,16 +1543,18 @@ setFileTimes path (atime, mtime) = throwErrnoPathIfMinus1_ "" path' $ c_utimensat c_AT_FDCWD path'' times 0 #else - setTimes (Just atime', Just mtime') = setFileTimes path' atime' mtime' + setTimes (Just atime', Just mtime') = setFileTimes' path' atime' mtime' setTimes (atime', mtime') = do (atimeOld, mtimeOld) <- fileTimesFromStatus <$> Posix.getFileStatus path' - setFileTimes path' - (fromMaybe atimeOld atime') - (fromMaybe mtimeOld mtime') + setFileTimes' path' + (fromMaybe (utcTimeToPOSIXSeconds atimeOld) atime') + (fromMaybe (utcTimeToPOSIXSeconds mtimeOld) mtime') + + setFileTimes' :: FilePath -> POSIXTime -> POSIXTime -> IO () # if MIN_VERSION_unix(2, 7, 0) - setFileTimes = Posix.setFileTimesHiRes + setFileTimes' = Posix.setFileTimesHiRes # else - setFileTimes pth atim mtime = + setFileTimes' pth atim mtime = Posix.setFileTimes pth (fromInteger (truncate atime)) (fromInteger (truncate mtime)) From git at git.haskell.org Sun Apr 17 15:35:32 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 17 Apr 2016 15:35:32 +0000 (UTC) Subject: [commit: packages/directory] master: Bump version to 1.2.6.1 (8bb9760) Message-ID: <20160417153532.BF7B43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8bb9760d3c260ac7a4b5b85092adcecc5709b865/directory >--------------------------------------------------------------- commit 8bb9760d3c260ac7a4b5b85092adcecc5709b865 Author: Phil Ruffwind Date: Sun Apr 17 11:12:05 2016 -0400 Bump version to 1.2.6.1 >--------------------------------------------------------------- 8bb9760d3c260ac7a4b5b85092adcecc5709b865 changelog.md | 7 ++++++- directory.cabal | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 562ed68..df20611 100644 --- a/changelog.md +++ b/changelog.md @@ -1,10 +1,15 @@ Changelog for the [`directory`][1] package ========================================== -## 1.2.6.0 (April 2015) +## 1.2.6.1 (April 2015) * Bundled with GHC 8.0.1 + * Fix mistake in file time functions when `utimensat` is not available + ([#47](https://github.com/haskell/directory/pull/47)) + +## 1.2.6.0 (April 2015) + * Make `findExecutable`, `findExecutables`, `findExecutablesInDirectories`, `findFile`, and `findFilesWith` lazier ([#43](https://github.com/haskell/directory/issues/43)) diff --git a/directory.cabal b/directory.cabal index 8fc1a40..499ebbe 100644 --- a/directory.cabal +++ b/directory.cabal @@ -1,5 +1,5 @@ name: directory -version: 1.2.6.0 +version: 1.2.6.1 -- NOTE: Don't forget to update ./changelog.md license: BSD3 license-file: LICENSE From git at git.haskell.org Sun Apr 17 15:37:09 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 17 Apr 2016 15:37:09 +0000 (UTC) Subject: [commit: ghc] master: Update `directory` submodule to v1.2.6.1 release (93d85af) Message-ID: <20160417153709.5DF023A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/93d85af9fec968b43452891ec7b10382a4a99a38/ghc >--------------------------------------------------------------- commit 93d85af9fec968b43452891ec7b10382a4a99a38 Author: Herbert Valerio Riedel Date: Sun Apr 17 17:39:13 2016 +0200 Update `directory` submodule to v1.2.6.1 release This fixes a build-failure on OSX >--------------------------------------------------------------- 93d85af9fec968b43452891ec7b10382a4a99a38 libraries/directory | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/directory b/libraries/directory index 74e5058..8bb9760 160000 --- a/libraries/directory +++ b/libraries/directory @@ -1 +1 @@ -Subproject commit 74e5058282c1fefa09b332c4a5c55fbf57907777 +Subproject commit 8bb9760d3c260ac7a4b5b85092adcecc5709b865 From git at git.haskell.org Sun Apr 17 16:37:43 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 17 Apr 2016 16:37:43 +0000 (UTC) Subject: [commit: ghc] master: Silence unused-import warning introduced by 93d85af9fec968b (dd920e4) Message-ID: <20160417163743.B8FFE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/dd920e43b887bf5288ec364fd416f5e593c693e6/ghc >--------------------------------------------------------------- commit dd920e43b887bf5288ec364fd416f5e593c693e6 Author: Herbert Valerio Riedel Date: Sun Apr 17 18:39:36 2016 +0200 Silence unused-import warning introduced by 93d85af9fec968b >--------------------------------------------------------------- dd920e43b887bf5288ec364fd416f5e593c693e6 mk/warnings.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/mk/warnings.mk b/mk/warnings.mk index 63388fb..c9b2925 100644 --- a/mk/warnings.mk +++ b/mk/warnings.mk @@ -50,6 +50,7 @@ libraries/bytestring_dist-install_EXTRA_HC_OPTS += -Wno-inline-rule-shadowing # Turn off import warnings for bad unused imports utils/haddock_dist_EXTRA_HC_OPTS += -Wno-unused-imports libraries/vector_dist-install_EXTRA_HC_OPTS += -Wno-unused-imports +libraries/directory_dist-install_EXTRA_HC_OPTS += -Wno-unused-imports # haddock's attoparsec uses deprecated `inlinePerformIO` utils/haddock_dist_EXTRA_HC_OPTS += -Wno-deprecations From git at git.haskell.org Sun Apr 17 18:38:44 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 17 Apr 2016 18:38:44 +0000 (UTC) Subject: [commit: packages/haskeline] branch 'release-0.7.2.3' created Message-ID: <20160417183844.C24C03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/haskeline New branch : release-0.7.2.3 Referencing: 8addaa2f6f4256da76bac4075316597d0b1d8f67 From git at git.haskell.org Sun Apr 17 18:38:46 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 17 Apr 2016 18:38:46 +0000 (UTC) Subject: [commit: packages/haskeline] release-0.7.2.3: Fix the behavior of unix-word-rubout (C-w) for emacs bindings (cherry picked from commit 0a5c8b05104ce109508bd24f733440a674fb8840) (da39fac) Message-ID: <20160417183846.C765E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/haskeline On branch : release-0.7.2.3 Link : http://git.haskell.org/packages/haskeline.git/commitdiff/da39fac5060f388145d90e3926a04fcf104bdfff >--------------------------------------------------------------- commit da39fac5060f388145d90e3926a04fcf104bdfff Author: Zejun Wu Date: Thu Mar 10 18:00:18 2016 -0800 Fix the behavior of unix-word-rubout (C-w) for emacs bindings (cherry picked from commit 0a5c8b05104ce109508bd24f733440a674fb8840) >--------------------------------------------------------------- da39fac5060f388145d90e3926a04fcf104bdfff System/Console/Haskeline/Emacs.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/System/Console/Haskeline/Emacs.hs b/System/Console/Haskeline/Emacs.hs index d5e0622..66d3297 100644 --- a/System/Console/Haskeline/Emacs.hs +++ b/System/Console/Haskeline/Emacs.hs @@ -89,7 +89,7 @@ rotatePaste im = get >>= loop wordRight, wordLeft, bigWordLeft :: InsertMode -> InsertMode wordRight = goRightUntil (atStart (not . isAlphaNum)) wordLeft = goLeftUntil (atStart isAlphaNum) -bigWordLeft = goLeftUntil (atStart isSpace) +bigWordLeft = goLeftUntil (atStart (not . isSpace)) modifyWord :: ([Grapheme] -> [Grapheme]) -> InsertMode -> InsertMode modifyWord f im = IMode (reverse (f ys1) ++ xs) ys2 From git at git.haskell.org Sun Apr 17 18:38:48 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 17 Apr 2016 18:38:48 +0000 (UTC) Subject: [commit: packages/haskeline] release-0.7.2.3: Point to github instead of trac. (c5915d2) Message-ID: <20160417183848.CEB933A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/haskeline On branch : release-0.7.2.3 Link : http://git.haskell.org/packages/haskeline.git/commitdiff/c5915d2af9bbc6a8eb7bba2cff5c11e92ed12171 >--------------------------------------------------------------- commit c5915d2af9bbc6a8eb7bba2cff5c11e92ed12171 Author: Judah Jacobson Date: Sun Apr 17 10:57:44 2016 -0700 Point to github instead of trac. >--------------------------------------------------------------- c5915d2af9bbc6a8eb7bba2cff5c11e92ed12171 README.md | 2 +- haskeline.cabal | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2159507..8724ec3 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ The most recent development source code can be downloaded with: git clone https://github.com/judah/haskeline Further documentation is also available at -[http://trac.haskell.org/haskeline/wiki/WikiDocumentation](http://trac.haskell.org/haskeline/wiki/WikiDocumentation) +[https://github.com/judah/haskeline/wiki](https://github.com/judah/haskeline/wiki) ##Features: diff --git a/haskeline.cabal b/haskeline.cabal index 7402b6d..a32f414 100644 --- a/haskeline.cabal +++ b/haskeline.cabal @@ -16,7 +16,8 @@ Description: Haskell programs. . Haskeline runs both on POSIX-compatible systems and on Windows. -Homepage: http://trac.haskell.org/haskeline +Homepage: https://github.com/judah/haskeline +Bug-Reports: https://github.com/judah/haskeline/issues Stability: Experimental Build-Type: Custom extra-source-files: examples/Test.hs Changelog From git at git.haskell.org Sun Apr 17 18:38:50 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 17 Apr 2016 18:38:50 +0000 (UTC) Subject: [commit: packages/haskeline] release-0.7.2.3: Merge branch 'issue-reporter' into release-0.7.2.3 (e5772f4) Message-ID: <20160417183850.D4F653A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/haskeline On branch : release-0.7.2.3 Link : http://git.haskell.org/packages/haskeline.git/commitdiff/e5772f4f83200f7f215a14343b8ef29e35220bfc >--------------------------------------------------------------- commit e5772f4f83200f7f215a14343b8ef29e35220bfc Merge: da39fac c5915d2 Author: Judah Jacobson Date: Sun Apr 17 10:59:19 2016 -0700 Merge branch 'issue-reporter' into release-0.7.2.3 >--------------------------------------------------------------- e5772f4f83200f7f215a14343b8ef29e35220bfc README.md | 2 +- haskeline.cabal | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) From git at git.haskell.org Sun Apr 17 18:38:52 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 17 Apr 2016 18:38:52 +0000 (UTC) Subject: [commit: packages/haskeline] release-0.7.2.3: Bump version to 0.7.2.3. (8addaa2) Message-ID: <20160417183852.DAF133A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/haskeline On branch : release-0.7.2.3 Link : http://git.haskell.org/packages/haskeline.git/commitdiff/8addaa2f6f4256da76bac4075316597d0b1d8f67 >--------------------------------------------------------------- commit 8addaa2f6f4256da76bac4075316597d0b1d8f67 Author: Judah Jacobson Date: Sun Apr 17 11:05:11 2016 -0700 Bump version to 0.7.2.3. >--------------------------------------------------------------- 8addaa2f6f4256da76bac4075316597d0b1d8f67 Changelog | 5 +++++ haskeline.cabal | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Changelog b/Changelog index e559185..7b1f5e2 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,8 @@ +Changed in version 0.7.2.3: + * Fix hsc2hs-related warning on ghc-8 + * Fix the behavior of ctrl-W in the emacs bindings + * Point to github instead of trac + Changed in version 0.7.2.2: * Fix Linux to Windows cross-compile * Canonicalize AMP instances to make the code more future proof diff --git a/haskeline.cabal b/haskeline.cabal index a32f414..35ecb26 100644 --- a/haskeline.cabal +++ b/haskeline.cabal @@ -1,6 +1,6 @@ Name: haskeline Cabal-Version: >=1.10 -Version: 0.7.2.2 +Version: 0.7.2.3 Category: User Interfaces License: BSD3 License-File: LICENSE From git at git.haskell.org Sun Apr 17 18:39:13 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 17 Apr 2016 18:39:13 +0000 (UTC) Subject: [commit: packages/haskeline] tag '0.7.2.3' created Message-ID: <20160417183913.8A7133A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/haskeline New tag : 0.7.2.3 Referencing: 1f49f042f54c82553f136367f1e653e7a9dc046a From git at git.haskell.org Sun Apr 17 20:15:32 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 17 Apr 2016 20:15:32 +0000 (UTC) Subject: [commit: ghc] master: Update haskeline submodule to 0.7.2.3 release (8a75bb5) Message-ID: <20160417201532.157593A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8a75bb5874070bc879818bba572a94632cf079d5/ghc >--------------------------------------------------------------- commit 8a75bb5874070bc879818bba572a94632cf079d5 Author: Herbert Valerio Riedel Date: Sun Apr 17 20:42:43 2016 +0200 Update haskeline submodule to 0.7.2.3 release >--------------------------------------------------------------- 8a75bb5874070bc879818bba572a94632cf079d5 libraries/haskeline | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/haskeline b/libraries/haskeline index 5e53651..8addaa2 160000 --- a/libraries/haskeline +++ b/libraries/haskeline @@ -1 +1 @@ -Subproject commit 5e53651b2683f31bf5efc842c33f07afc05ec287 +Subproject commit 8addaa2f6f4256da76bac4075316597d0b1d8f67 From git at git.haskell.org Mon Apr 18 08:06:31 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 18 Apr 2016 08:06:31 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Resolve symlinks when attempting to find GHC's lib folder on Windows (6c840d9) Message-ID: <20160418080631.0914B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/6c840d97b7997f08ca15cc9b31a6ad0f08cd3fbc/ghc >--------------------------------------------------------------- commit 6c840d97b7997f08ca15cc9b31a6ad0f08cd3fbc Author: Tamar Christina Date: Sun Apr 17 17:11:02 2016 +0200 Resolve symlinks when attempting to find GHC's lib folder on Windows Summary: Systools makes some pretty hard assumptions about where GHC is on Windows. One of these is that ghc be in a folder named `bin` and that `../lib` exists. This pattern doesn't hold for symlinks as a link `C:\ghc-bin\` pointing to `C:\ghc\ghc-7.10.3\bin` will break this assumption. This patch resolves symlinks by finding where they point to and uses that location as the base for GHC. This uses an API that's been introduced in Vista. For older systems it falls back to the current behavior of not resolving symlinks. Test Plan: 1) Create symlink to GHC's bin folder. 2) Run GHC from that folder. Reviewers: austin, bgamari Reviewed By: austin Subscribers: #ghc_windows_task_force, thomie Differential Revision: https://phabricator.haskell.org/D2101 GHC Trac Issues: #11759 (cherry picked from commit a3922083e8f41fc236972564dc2978f2a2d4ec13) >--------------------------------------------------------------- 6c840d97b7997f08ca15cc9b31a6ad0f08cd3fbc compiler/main/SysTools.hs | 52 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/compiler/main/SysTools.hs b/compiler/main/SysTools.hs index 4afb199..9423b00 100644 --- a/compiler/main/SysTools.hs +++ b/compiler/main/SysTools.hs @@ -85,6 +85,14 @@ import qualified System.Posix.Internals #else /* Must be Win32 */ import Foreign import Foreign.C.String +import qualified System.Win32.Info as Info +import Control.Exception (finally) +import Foreign.Ptr (FunPtr, castPtrToFunPtr) +import System.Win32.Types (DWORD, LPTSTR, HANDLE) +import System.Win32.Types (failIfNull, failIf, iNVALID_HANDLE_VALUE) +import System.Win32.File (createFile,closeHandle, gENERIC_READ, fILE_SHARE_READ, oPEN_EXISTING, fILE_ATTRIBUTE_NORMAL, fILE_FLAG_BACKUP_SEMANTICS ) +import System.Win32.DLL (loadLibrary, getProcAddress) +import Data.Bits((.|.)) #endif import System.Process @@ -1495,9 +1503,19 @@ getBaseDir = try_size 2048 -- plenty, PATH_MAX is 512 under Win32. ret <- c_GetModuleFileName nullPtr buf size case ret of 0 -> return Nothing - _ | ret < size -> fmap (Just . rootDir) $ peekCWString buf + _ | ret < size -> do path <- peekCWString buf + real <- getFinalPath path -- try to resolve symlinks paths + return $ (Just . rootDir . sanitize . maybe path id) real | otherwise -> try_size (size * 2) + -- getFinalPath returns paths in full raw form. + -- Unfortunately GHC isn't set up to handle these + -- So if the call succeeded, we need to drop the + -- \\?\ prefix. + sanitize s = if "\\\\?\\" `isPrefixOf` s + then drop 4 s + else s + rootDir s = case splitFileName $ normalise s of (d, ghc_exe) | lower ghc_exe `elem` ["ghc.exe", @@ -1514,6 +1532,38 @@ getBaseDir = try_size 2048 -- plenty, PATH_MAX is 512 under Win32. foreign import WINDOWS_CCONV unsafe "windows.h GetModuleFileNameW" c_GetModuleFileName :: Ptr () -> CWString -> Word32 -> IO Word32 + +-- Attempt to resolve symlinks in order to find the actual location GHC +-- is located at. See Trac #11759. +getFinalPath :: FilePath -> IO (Maybe FilePath) +getFinalPath name = do + dllHwnd <- failIfNull "LoadLibray" $ loadLibrary "kernel32.dll" + -- Note: The API GetFinalPathNameByHandleW is only available starting from Windows Vista. + -- This means that we can't bind directly to it since it may be missing. + -- Instead try to find it's address at runtime and if we don't succeed consider the + -- function failed. + addr_m <- (fmap Just $ failIfNull "getProcAddress" $ getProcAddress dllHwnd "GetFinalPathNameByHandleW") + `catch` (\(_ :: SomeException) -> return Nothing) + case addr_m of + Nothing -> return Nothing + Just addr -> do handle <- failIf (==iNVALID_HANDLE_VALUE) "CreateFile" + $ createFile name + gENERIC_READ + fILE_SHARE_READ + Nothing + oPEN_EXISTING + (fILE_ATTRIBUTE_NORMAL .|. fILE_FLAG_BACKUP_SEMANTICS) + Nothing + let fnPtr = makeGetFinalPathNameByHandle $ castPtrToFunPtr addr + path <- Info.try "GetFinalPathName" + (\buf len -> fnPtr handle buf len 0) 512 + `finally` closeHandle handle + return $ Just path + +type GetFinalPath = HANDLE -> LPTSTR -> DWORD -> DWORD -> IO DWORD + +foreign import WINDOWS_CCONV unsafe "dynamic" + makeGetFinalPathNameByHandle :: FunPtr GetFinalPath -> GetFinalPath #else getBaseDir = return Nothing #endif From git at git.haskell.org Mon Apr 18 08:06:33 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 18 Apr 2016 08:06:33 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Update `directory` submodule to v1.2.6.1 release (80894f2) Message-ID: <20160418080633.BF24F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/80894f2b83390de9c57f3711506a1a810bb86b30/ghc >--------------------------------------------------------------- commit 80894f2b83390de9c57f3711506a1a810bb86b30 Author: Herbert Valerio Riedel Date: Sun Apr 17 17:39:13 2016 +0200 Update `directory` submodule to v1.2.6.1 release This fixes a build-failure on OSX (cherry picked from commit 93d85af9fec968b43452891ec7b10382a4a99a38) >--------------------------------------------------------------- 80894f2b83390de9c57f3711506a1a810bb86b30 libraries/directory | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/directory b/libraries/directory index 74e5058..8bb9760 160000 --- a/libraries/directory +++ b/libraries/directory @@ -1 +1 @@ -Subproject commit 74e5058282c1fefa09b332c4a5c55fbf57907777 +Subproject commit 8bb9760d3c260ac7a4b5b85092adcecc5709b865 From git at git.haskell.org Mon Apr 18 08:06:36 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 18 Apr 2016 08:06:36 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Update haskeline submodule to 0.7.2.3 release (c1a6b98) Message-ID: <20160418080636.7CC0E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/c1a6b9861628304d1f57925385798e3d16a89584/ghc >--------------------------------------------------------------- commit c1a6b9861628304d1f57925385798e3d16a89584 Author: Herbert Valerio Riedel Date: Sun Apr 17 20:42:43 2016 +0200 Update haskeline submodule to 0.7.2.3 release (cherry picked from commit 8a75bb5874070bc879818bba572a94632cf079d5) >--------------------------------------------------------------- c1a6b9861628304d1f57925385798e3d16a89584 libraries/haskeline | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/haskeline b/libraries/haskeline index 5e53651..8addaa2 160000 --- a/libraries/haskeline +++ b/libraries/haskeline @@ -1 +1 @@ -Subproject commit 5e53651b2683f31bf5efc842c33f07afc05ec287 +Subproject commit 8addaa2f6f4256da76bac4075316597d0b1d8f67 From git at git.haskell.org Mon Apr 18 08:06:39 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 18 Apr 2016 08:06:39 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Silence unused-import warning introduced by 93d85af9fec968b (08b3e5a) Message-ID: <20160418080639.3A87A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/08b3e5ab72d55941f7f35e877684f92dc446bbe8/ghc >--------------------------------------------------------------- commit 08b3e5ab72d55941f7f35e877684f92dc446bbe8 Author: Herbert Valerio Riedel Date: Sun Apr 17 18:39:36 2016 +0200 Silence unused-import warning introduced by 93d85af9fec968b (cherry picked from commit dd920e43b887bf5288ec364fd416f5e593c693e6) >--------------------------------------------------------------- 08b3e5ab72d55941f7f35e877684f92dc446bbe8 mk/warnings.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/mk/warnings.mk b/mk/warnings.mk index be32e3f..5db3477 100644 --- a/mk/warnings.mk +++ b/mk/warnings.mk @@ -50,6 +50,7 @@ libraries/bytestring_dist-install_EXTRA_HC_OPTS += -Wno-inline-rule-shadowing # Turn off import warnings for bad unused imports utils/haddock_dist_EXTRA_HC_OPTS += -Wno-unused-imports libraries/vector_dist-install_EXTRA_HC_OPTS += -Wno-unused-imports +libraries/directory_dist-install_EXTRA_HC_OPTS += -Wno-unused-imports # haddock's attoparsec uses deprecated `inlinePerformIO` utils/haddock_dist_EXTRA_HC_OPTS += -Wno-deprecations From git at git.haskell.org Mon Apr 18 13:27:40 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 18 Apr 2016 13:27:40 +0000 (UTC) Subject: [commit: ghc] master: Make it easy to get hyperlinked sources (3dac53f) Message-ID: <20160418132740.0C9803A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3dac53fa3ede70e86ddb6f40e1e96feb61301754/ghc >--------------------------------------------------------------- commit 3dac53fa3ede70e86ddb6f40e1e96feb61301754 Author: Bartosz Nitka Date: Mon Apr 18 06:29:37 2016 -0700 Make it easy to get hyperlinked sources The version of `haddock` that ghc has as a submodule has an option for generating linkified sources. I don't think it hurts to have this and they are great for exploring the codebase. I'd be nice if harbormaster or travis published them somewhere, but I don't know how to do that yet. Test Plan: uncomment, run `make` and look at the nicely linkified sources in `compiler/stage2/doc/html/ghc/` Reviewers: hvr, austin, bgamari Reviewed By: bgamari Subscribers: thomie, simonmar Differential Revision: https://phabricator.haskell.org/D2119 >--------------------------------------------------------------- 3dac53fa3ede70e86ddb6f40e1e96feb61301754 mk/build.mk.sample | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mk/build.mk.sample b/mk/build.mk.sample index 196becb..eed749c 100644 --- a/mk/build.mk.sample +++ b/mk/build.mk.sample @@ -86,5 +86,9 @@ endif # (other sometimes useful configure-options: `--with-gmp-{includes,libraries}`) #libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-intree-gmp +# Enable pretty hyperlinked sources +#HADDOCK_DOCS = YES +#EXTRA_HADDOCK_OPTS += --hyperlinked-source + # Don't strip debug and other unneeded symbols from libraries and executables. STRIP_CMD = : From git at git.haskell.org Mon Apr 18 22:01:01 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 18 Apr 2016 22:01:01 +0000 (UTC) Subject: [commit: ghc] master: relnotes: Add note about #11744 and workaround (10d808c) Message-ID: <20160418220101.AF3273A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/10d808c59307c5c0b1cb40a9ce0eb6e3efc068c9/ghc >--------------------------------------------------------------- commit 10d808c59307c5c0b1cb40a9ce0eb6e3efc068c9 Author: Ben Gamari Date: Mon Apr 18 15:13:41 2016 +0200 relnotes: Add note about #11744 and workaround Test Plan: Read it Reviewers: hvr, austin Subscribers: carter, thomie Differential Revision: https://phabricator.haskell.org/D2120 GHC Trac Issues: #11744 >--------------------------------------------------------------- 10d808c59307c5c0b1cb40a9ce0eb6e3efc068c9 docs/users_guide/8.0.1-notes.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/users_guide/8.0.1-notes.rst b/docs/users_guide/8.0.1-notes.rst index 93c9ec3..51a9602 100644 --- a/docs/users_guide/8.0.1-notes.rst +++ b/docs/users_guide/8.0.1-notes.rst @@ -18,6 +18,14 @@ performance improvements over the 7.10 branch. package key (with GHC's :ghc-flag:`-this-package-key` argument), GHC 8.0 and later uses installed package IDs in place of package keys. +.. note:: + + Users compiling GHC on Mac OS X with XCode 7.3 will need to tell the build + system to use the ``nm-classic`` command instead of Apple's new ``nm`` + implementation as the latter breaks POSIX compliance (see + :ghc-ticket:`11744`). This can be done by passing something like + ``--with-nm=/Library/Developer/CommandLineTools/usr/bin/nm-classic`` to + ``configure``. Highlights ---------- From git at git.haskell.org Mon Apr 18 22:01:04 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 18 Apr 2016 22:01:04 +0000 (UTC) Subject: [commit: ghc] master: Use stdint types to define SIZEOF and ALIGNMENT of INTx/WORDx (87114ae) Message-ID: <20160418220104.627473A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/87114ae13fd1f10dc00a6b4e64898da3e92d0266/ghc >--------------------------------------------------------------- commit 87114ae13fd1f10dc00a6b4e64898da3e92d0266 Author: Tomas Carnecky Date: Mon Apr 18 22:11:53 2016 +0200 Use stdint types to define SIZEOF and ALIGNMENT of INTx/WORDx Saves us a CPP #if in MachDeps.h since we now can always rely on a 64-bit type being available. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie, erikd Differential Revision: https://phabricator.haskell.org/D2099 >--------------------------------------------------------------- 87114ae13fd1f10dc00a6b4e64898da3e92d0266 aclocal.m4 | 10 ++++++++++ configure.ac | 56 ++++++++++++++++++++++------------------------------- includes/MachDeps.h | 55 ++++++++++++++++------------------------------------ 3 files changed, 50 insertions(+), 71 deletions(-) diff --git a/aclocal.m4 b/aclocal.m4 index 477da3f..1c9c49f 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -831,6 +831,16 @@ m4_popdef([fp_Cache])[]dnl ])# FP_CHECK_ALIGNMENT + +# FP_CHECK_SIZEOF_AND_ALIGNMENT(TYPE) +# ------------------------------------------------------------------ +# Combines AC_CHECK_SIZEOF and FP_CHECK_ALIGNMENT. +AC_DEFUN([FP_CHECK_SIZEOF_AND_ALIGNMENT], +[AC_CHECK_SIZEOF([$1]) +FP_CHECK_ALIGNMENT([$1]) +])# FP_CHECK_SIZEOF_AND_ALIGNMENT + + # FP_LEADING_UNDERSCORE # --------------------- # Test for determining whether symbol names have a leading underscore. We assume diff --git a/configure.ac b/configure.ac index c5260ce..a5ee3bc 100644 --- a/configure.ac +++ b/configure.ac @@ -796,47 +796,37 @@ dnl ** do we have long longs? AC_CHECK_TYPES([long long]) dnl ** what are the sizes of various types -AC_CHECK_SIZEOF(char, 1) -AC_CHECK_SIZEOF(double, 8) -AC_CHECK_SIZEOF(float, 4) -AC_CHECK_SIZEOF(int, 4) -AC_CHECK_SIZEOF(long, 4) +FP_CHECK_SIZEOF_AND_ALIGNMENT(char) +FP_CHECK_SIZEOF_AND_ALIGNMENT(double) +FP_CHECK_SIZEOF_AND_ALIGNMENT(float) +FP_CHECK_SIZEOF_AND_ALIGNMENT(int) +FP_CHECK_SIZEOF_AND_ALIGNMENT(long) if test "$ac_cv_type_long_long" = yes; then -AC_CHECK_SIZEOF(long long, 8) +FP_CHECK_SIZEOF_AND_ALIGNMENT(long long) fi -AC_CHECK_SIZEOF(short, 2) -AC_CHECK_SIZEOF(unsigned char, 1) -AC_CHECK_SIZEOF(unsigned int, 4) -AC_CHECK_SIZEOF(unsigned long, 4) +FP_CHECK_SIZEOF_AND_ALIGNMENT(short) +FP_CHECK_SIZEOF_AND_ALIGNMENT(unsigned char) +FP_CHECK_SIZEOF_AND_ALIGNMENT(unsigned int) +FP_CHECK_SIZEOF_AND_ALIGNMENT(unsigned long) if test "$ac_cv_type_long_long" = yes; then -AC_CHECK_SIZEOF(unsigned long long, 8) +FP_CHECK_SIZEOF_AND_ALIGNMENT(unsigned long long) fi -AC_CHECK_SIZEOF(unsigned short, 2) -AC_CHECK_SIZEOF(void *, 4) +FP_CHECK_SIZEOF_AND_ALIGNMENT(unsigned short) +FP_CHECK_SIZEOF_AND_ALIGNMENT(void *) + +FP_CHECK_SIZEOF_AND_ALIGNMENT(int8_t) +FP_CHECK_SIZEOF_AND_ALIGNMENT(uint8_t) +FP_CHECK_SIZEOF_AND_ALIGNMENT(int16_t) +FP_CHECK_SIZEOF_AND_ALIGNMENT(uint16_t) +FP_CHECK_SIZEOF_AND_ALIGNMENT(int32_t) +FP_CHECK_SIZEOF_AND_ALIGNMENT(uint32_t) +FP_CHECK_SIZEOF_AND_ALIGNMENT(int64_t) +FP_CHECK_SIZEOF_AND_ALIGNMENT(uint64_t) + dnl for use in settings.in WordSize=$ac_cv_sizeof_void_p AC_SUBST(WordSize) - -dnl ** what are alignment constraints on various types -FP_CHECK_ALIGNMENT(char) -FP_CHECK_ALIGNMENT(double) -FP_CHECK_ALIGNMENT(float) -FP_CHECK_ALIGNMENT(int) -FP_CHECK_ALIGNMENT(long) -if test "$ac_cv_type_long_long" = yes; then -FP_CHECK_ALIGNMENT(long long) -fi -FP_CHECK_ALIGNMENT(short) -FP_CHECK_ALIGNMENT(unsigned char) -FP_CHECK_ALIGNMENT(unsigned int) -FP_CHECK_ALIGNMENT(unsigned long) -if test "$ac_cv_type_long_long" = yes; then -FP_CHECK_ALIGNMENT(unsigned long long) -fi -FP_CHECK_ALIGNMENT(unsigned short) -FP_CHECK_ALIGNMENT(void *) - FP_CHECK_FUNC([WinExec], [@%:@include ], [WinExec("",0)]) diff --git a/includes/MachDeps.h b/includes/MachDeps.h index f176ef8..3a8371b 100644 --- a/includes/MachDeps.h +++ b/includes/MachDeps.h @@ -28,19 +28,6 @@ * but it takes up SIZEOF_HSWORD (4 or 8) bytes in the heap. */ -/* First, check some assumptions.. */ -#if SIZEOF_CHAR != 1 -#error GHC untested on this architecture: sizeof(char) != 1 -#endif - -#if SIZEOF_SHORT != 2 -#error GHC untested on this architecture: sizeof(short) != 2 -#endif - -#if SIZEOF_UNSIGNED_INT != 4 -#error GHC untested on this architecture: sizeof(unsigned int) != 4 -#endif - #define SIZEOF_HSCHAR SIZEOF_WORD32 #define ALIGNMENT_HSCHAR ALIGNMENT_WORD32 @@ -65,37 +52,29 @@ #define SIZEOF_HSSTABLEPTR SIZEOF_VOID_P #define ALIGNMENT_HSSTABLEPTR ALIGNMENT_VOID_P -#define SIZEOF_INT8 SIZEOF_CHAR -#define ALIGNMENT_INT8 ALIGNMENT_CHAR +#define SIZEOF_INT8 SIZEOF_INT8_T +#define ALIGNMENT_INT8 ALIGNMENT_INT8_T -#define SIZEOF_WORD8 SIZEOF_UNSIGNED_CHAR -#define ALIGNMENT_WORD8 ALIGNMENT_UNSIGNED_CHAR +#define SIZEOF_WORD8 SIZEOF_UINT8_T +#define ALIGNMENT_WORD8 ALIGNMENT_UINT8_T -#define SIZEOF_INT16 SIZEOF_SHORT -#define ALIGNMENT_INT16 ALIGNMENT_SHORT +#define SIZEOF_INT16 SIZEOF_INT16_T +#define ALIGNMENT_INT16 ALIGNMENT_INT16_T -#define SIZEOF_WORD16 SIZEOF_UNSIGNED_SHORT -#define ALIGNMENT_WORD16 ALIGNMENT_UNSIGNED_SHORT +#define SIZEOF_WORD16 SIZEOF_UINT16_T +#define ALIGNMENT_WORD16 ALIGNMENT_UINT16_T -#define SIZEOF_INT32 SIZEOF_INT -#define ALIGNMENT_INT32 ALIGNMENT_INT +#define SIZEOF_INT32 SIZEOF_INT32_T +#define ALIGNMENT_INT32 ALIGNMENT_INT32_T -#define SIZEOF_WORD32 SIZEOF_UNSIGNED_INT -#define ALIGNMENT_WORD32 ALIGNMENT_UNSIGNED_INT +#define SIZEOF_WORD32 SIZEOF_UINT32_T +#define ALIGNMENT_WORD32 ALIGNMENT_UINT32_T -#if SIZEOF_LONG == 8 -#define SIZEOF_INT64 SIZEOF_LONG -#define ALIGNMENT_INT64 ALIGNMENT_LONG -#define SIZEOF_WORD64 SIZEOF_UNSIGNED_LONG -#define ALIGNMENT_WORD64 ALIGNMENT_UNSIGNED_LONG -#elif HAVE_LONG_LONG && SIZEOF_LONG_LONG == 8 -#define SIZEOF_INT64 SIZEOF_LONG_LONG -#define ALIGNMENT_INT64 ALIGNMENT_LONG_LONG -#define SIZEOF_WORD64 SIZEOF_UNSIGNED_LONG_LONG -#define ALIGNMENT_WORD64 ALIGNMENT_UNSIGNED_LONG_LONG -#else -#error Cannot find a 64bit type. -#endif +#define SIZEOF_INT64 SIZEOF_INT64_T +#define ALIGNMENT_INT64 ALIGNMENT_INT64_T + +#define SIZEOF_WORD64 SIZEOF_UINT64_T +#define ALIGNMENT_WORD64 ALIGNMENT_UINT64_T #ifndef WORD_SIZE_IN_BITS #if SIZEOF_HSWORD == 4 From git at git.haskell.org Mon Apr 18 22:01:07 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 18 Apr 2016 22:01:07 +0000 (UTC) Subject: [commit: ghc] master: Remove obsolete/redundant FLEXIBLE_ARRAY macro (32ddd96) Message-ID: <20160418220107.1347E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/32ddd96972301a03dc0d594bda76da426785e722/ghc >--------------------------------------------------------------- commit 32ddd96972301a03dc0d594bda76da426785e722 Author: Herbert Valerio Riedel Date: Mon Apr 18 22:26:02 2016 +0200 Remove obsolete/redundant FLEXIBLE_ARRAY macro This macro is doubly redundant, first off all, ancient GCCs prior to version 3.0 are not supported anymore, but more importantly, we require a ISO C99 compliant compiler, so we can use the proper ISO C syntax without worrying about compatibility. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: carter, thomie Differential Revision: https://phabricator.haskell.org/D2121 >--------------------------------------------------------------- 32ddd96972301a03dc0d594bda76da426785e722 includes/Rts.h | 9 --------- includes/rts/storage/Closures.h | 20 ++++++++++---------- includes/rts/storage/InfoTables.h | 4 ++-- includes/rts/storage/TSO.h | 2 +- 4 files changed, 13 insertions(+), 22 deletions(-) diff --git a/includes/Rts.h b/includes/Rts.h index 6f4f33e..1ad1bba 100644 --- a/includes/Rts.h +++ b/includes/Rts.h @@ -41,15 +41,6 @@ extern "C" { #include "rts/Types.h" #if __GNUC__ >= 3 -/* Assume that a flexible array member at the end of a struct - * can be defined thus: T arr[]; */ -#define FLEXIBLE_ARRAY -#else -/* Assume that it must be defined thus: T arr[0]; */ -#define FLEXIBLE_ARRAY 0 -#endif - -#if __GNUC__ >= 3 #define ATTRIBUTE_ALIGNED(n) __attribute__((aligned(n))) #else #define ATTRIBUTE_ALIGNED(n) /*nothing*/ diff --git a/includes/rts/storage/Closures.h b/includes/rts/storage/Closures.h index 2ce1a27..f880b5c 100644 --- a/includes/rts/storage/Closures.h +++ b/includes/rts/storage/Closures.h @@ -79,12 +79,12 @@ typedef struct { typedef struct StgClosure_ { StgHeader header; - struct StgClosure_ *payload[FLEXIBLE_ARRAY]; + struct StgClosure_ *payload[]; } *StgClosurePtr; // StgClosure defined in rts/Types.h typedef struct { StgThunkHeader header; - struct StgClosure_ *payload[FLEXIBLE_ARRAY]; + struct StgClosure_ *payload[]; } StgThunk; typedef struct { @@ -97,7 +97,7 @@ typedef struct { StgHalfWord arity; /* zero if it is an AP */ StgHalfWord n_args; StgClosure *fun; /* really points to a fun */ - StgClosure *payload[FLEXIBLE_ARRAY]; + StgClosure *payload[]; } StgPAP; typedef struct { @@ -105,14 +105,14 @@ typedef struct { StgHalfWord arity; /* zero if it is an AP */ StgHalfWord n_args; StgClosure *fun; /* really points to a fun */ - StgClosure *payload[FLEXIBLE_ARRAY]; + StgClosure *payload[]; } StgAP; typedef struct { StgThunkHeader header; StgWord size; /* number of words in payload */ StgClosure *fun; - StgClosure *payload[FLEXIBLE_ARRAY]; /* contains a chunk of *stack* */ + StgClosure *payload[]; /* contains a chunk of *stack* */ } StgAP_STACK; typedef struct { @@ -138,21 +138,21 @@ typedef struct StgBlockingQueue_ { typedef struct { StgHeader header; StgWord bytes; - StgWord payload[FLEXIBLE_ARRAY]; + StgWord payload[]; } StgArrBytes; typedef struct { StgHeader header; StgWord ptrs; StgWord size; // ptrs plus card table - StgClosure *payload[FLEXIBLE_ARRAY]; + StgClosure *payload[]; // see also: StgMutArrPtrs macros in ClosureMacros.h } StgMutArrPtrs; typedef struct { StgHeader header; StgWord ptrs; - StgClosure *payload[FLEXIBLE_ARRAY]; + StgClosure *payload[]; } StgSmallMutArrPtrs; typedef struct { @@ -241,7 +241,7 @@ typedef struct { StgMutArrPtrs *ptrs; /* a pointer to a MutArrPtrs */ StgHalfWord arity; /* arity of this BCO */ StgHalfWord size; /* size of this BCO (in words) */ - StgWord bitmap[FLEXIBLE_ARRAY]; /* an StgLargeBitmap */ + StgWord bitmap[]; /* an StgLargeBitmap */ } StgBCO; #define BCO_BITMAP(bco) ((StgLargeBitmap *)((StgBCO *)(bco))->bitmap) @@ -261,7 +261,7 @@ typedef struct { const StgInfoTable* info; StgWord size; StgClosure * fun; - StgClosure * payload[FLEXIBLE_ARRAY]; + StgClosure * payload[]; } StgRetFun; /* Concurrent communication objects */ diff --git a/includes/rts/storage/InfoTables.h b/includes/rts/storage/InfoTables.h index 228369b..3de63c8 100644 --- a/includes/rts/storage/InfoTables.h +++ b/includes/rts/storage/InfoTables.h @@ -125,7 +125,7 @@ extern StgWord16 closure_flags[]; */ typedef struct { StgWord size; - StgWord bitmap[FLEXIBLE_ARRAY]; + StgWord bitmap[]; } StgLargeBitmap; /* ----------------------------------------------------------------------------- @@ -206,7 +206,7 @@ typedef struct StgInfoTable_ { */ #ifdef TABLES_NEXT_TO_CODE - StgCode code[FLEXIBLE_ARRAY]; + StgCode code[]; #endif } *StgInfoTablePtr; diff --git a/includes/rts/storage/TSO.h b/includes/rts/storage/TSO.h index 9bddfca..aa3d057 100644 --- a/includes/rts/storage/TSO.h +++ b/includes/rts/storage/TSO.h @@ -191,7 +191,7 @@ typedef struct StgStack_ { StgWord32 stack_size; // stack size in *words* StgWord32 dirty; // non-zero => dirty StgPtr sp; // current stack pointer - StgWord stack[FLEXIBLE_ARRAY]; + StgWord stack[]; } StgStack; // Calculate SpLim from a TSO (reads tso->stackobj, but no fields from From git at git.haskell.org Mon Apr 18 22:01:09 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 18 Apr 2016 22:01:09 +0000 (UTC) Subject: [commit: ghc] master: rts: Limit maximum backtrace depth (350ffc3) Message-ID: <20160418220109.C01D73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/350ffc3e4c6b3aefd6ae621991564cc28f585d46/ghc >--------------------------------------------------------------- commit 350ffc3e4c6b3aefd6ae621991564cc28f585d46 Author: Ben Gamari Date: Mon Apr 11 00:49:06 2016 +0200 rts: Limit maximum backtrace depth This prevents us from entering an infinite loop in the event of a hitting bad unwinding information. >--------------------------------------------------------------- 350ffc3e4c6b3aefd6ae621991564cc28f585d46 rts/Libdw.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/rts/Libdw.c b/rts/Libdw.c index 8c3c581..e796840 100644 --- a/rts/Libdw.c +++ b/rts/Libdw.c @@ -16,6 +16,8 @@ #include #include +const int max_backtrace_depth = 5000; + static BacktraceChunk *backtraceAllocChunk(BacktraceChunk *next) { BacktraceChunk *chunk = stgMallocBytes(sizeof(BacktraceChunk), "backtraceAllocChunk"); @@ -57,7 +59,10 @@ void backtraceFree(Backtrace *bt) { struct LibdwSession_ { Dwfl *dwfl; - Backtrace *cur_bt; // The current backtrace we are collecting (if any) + + // The current backtrace we are collecting (if any) + Backtrace *cur_bt; + int max_depth; }; static const Dwfl_Thread_Callbacks thread_cbs; @@ -230,8 +235,12 @@ static int getBacktraceFrameCb(Dwfl_Frame *frame, void *arg) { pc -= 1; // TODO: is this right? backtracePush(session->cur_bt, (StgPtr) (uintptr_t) pc); } - - return DWARF_CB_OK; + session->max_depth--; + if (session->max_depth == 0) { + return DWARF_CB_ABORT; + } else { + return DWARF_CB_OK; + } } Backtrace *libdwGetBacktrace(LibdwSession *session) { @@ -242,6 +251,7 @@ Backtrace *libdwGetBacktrace(LibdwSession *session) { Backtrace *bt = backtraceAlloc(); session->cur_bt = bt; + session->max_depth = max_backtrace_depth; int pid = getpid(); int ret = dwfl_getthread_frames(session->dwfl, pid, From git at git.haskell.org Mon Apr 18 22:01:12 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 18 Apr 2016 22:01:12 +0000 (UTC) Subject: [commit: ghc] master: rts: Don't use strndup (d1ce35d) Message-ID: <20160418220112.7C46F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d1ce35d2271ac8b79cb5e37677b1a989749e611c/ghc >--------------------------------------------------------------- commit d1ce35d2271ac8b79cb5e37677b1a989749e611c Author: Ben Gamari Date: Mon Apr 18 22:32:59 2016 +0200 rts: Don't use strndup Reviewers: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2125 >--------------------------------------------------------------- d1ce35d2271ac8b79cb5e37677b1a989749e611c rts/RtsFlags.c | 2 +- rts/RtsUtils.c | 12 ++++++++++++ rts/RtsUtils.h | 2 ++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c index 9db3cd4..bffb128 100644 --- a/rts/RtsFlags.c +++ b/rts/RtsFlags.c @@ -1597,7 +1597,7 @@ static rtsBool read_heap_profiling_flag(const char *arg_in) if (!right) right = arg + strlen(arg); - char *selector = strndup(left, right - left); + char *selector = stgStrndup(left, right - left + 1); switch (arg[2]) { case 'c': // cost centre label select diff --git a/rts/RtsUtils.c b/rts/RtsUtils.c index a36532c..c837143 100644 --- a/rts/RtsUtils.c +++ b/rts/RtsUtils.c @@ -112,6 +112,18 @@ stgCallocBytes (int n, int m, char *msg) return space; } +/* borrowed from the MUSL libc project */ +char *stgStrndup(const char *s, size_t n) +{ + size_t l = strnlen(s, n); + char *d = stgMallocBytes(l+1, "stgStrndup"); + if (!d) return NULL; + memcpy(d, s, l); + d[l] = 0; + return d; +} + + /* To simplify changing the underlying allocator used * by stgMallocBytes(), provide stgFree() as well. */ diff --git a/rts/RtsUtils.h b/rts/RtsUtils.h index 5d825a2..d76c921 100644 --- a/rts/RtsUtils.h +++ b/rts/RtsUtils.h @@ -26,6 +26,8 @@ void *stgReallocBytes(void *p, int n, char *msg); void *stgCallocBytes(int n, int m, char *msg) GNUC3_ATTRIBUTE(__malloc__); +char *stgStrndup(const char *s, size_t n); + void stgFree(void* p); /* ----------------------------------------------------------------------------- From git at git.haskell.org Tue Apr 19 06:57:48 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 06:57:48 +0000 (UTC) Subject: [commit: packages/directory] tag 'v1.2.6.2' created Message-ID: <20160419065748.AE8B93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory New tag : v1.2.6.2 Referencing: 75fcf4275bf11359a80ba631ebffe77441d4ebcc From git at git.haskell.org Tue Apr 19 06:57:50 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 06:57:50 +0000 (UTC) Subject: [commit: packages/directory] master: Fix typo in setFileTimes (4beb371) Message-ID: <20160419065750.B5A253A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4beb37153d837b0215851752bcc42ba1e8784194/directory >--------------------------------------------------------------- commit 4beb37153d837b0215851752bcc42ba1e8784194 Author: Phil Ruffwind Date: Sun Apr 17 11:50:24 2016 -0400 Fix typo in setFileTimes >--------------------------------------------------------------- 4beb37153d837b0215851752bcc42ba1e8784194 System/Directory.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/System/Directory.hs b/System/Directory.hs index 469ed2b..0e08f5f 100644 --- a/System/Directory.hs +++ b/System/Directory.hs @@ -1554,10 +1554,10 @@ setFileTimes path (atime, mtime) = # if MIN_VERSION_unix(2, 7, 0) setFileTimes' = Posix.setFileTimesHiRes # else - setFileTimes' pth atim mtime = + setFileTimes' pth atime' mtime' = Posix.setFileTimes pth - (fromInteger (truncate atime)) - (fromInteger (truncate mtime)) + (fromInteger (truncate atime')) + (fromInteger (truncate mtime')) # endif #endif From git at git.haskell.org Tue Apr 19 06:57:52 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 06:57:52 +0000 (UTC) Subject: [commit: packages/directory] master: Bump to 1.2.6.2 (f2f192d) Message-ID: <20160419065752.BB5B93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f2f192d50e0c803412880da3403803aa8e8cc0a3/directory >--------------------------------------------------------------- commit f2f192d50e0c803412880da3403803aa8e8cc0a3 Author: Phil Ruffwind Date: Mon Apr 18 09:36:13 2016 -0400 Bump to 1.2.6.2 >--------------------------------------------------------------- f2f192d50e0c803412880da3403803aa8e8cc0a3 changelog.md | 5 +++++ directory.cabal | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index df20611..83e1a4a 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,11 @@ Changelog for the [`directory`][1] package ========================================== +## 1.2.6.2 (April 2015) + + * Fix typo in file time functions when `utimensat` is not available and + version of `unix` package is lower than 2.7.0.0 + ## 1.2.6.1 (April 2015) * Bundled with GHC 8.0.1 diff --git a/directory.cabal b/directory.cabal index 499ebbe..2c38c12 100644 --- a/directory.cabal +++ b/directory.cabal @@ -1,5 +1,5 @@ name: directory -version: 1.2.6.1 +version: 1.2.6.2 -- NOTE: Don't forget to update ./changelog.md license: BSD3 license-file: LICENSE From git at git.haskell.org Tue Apr 19 06:57:54 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 06:57:54 +0000 (UTC) Subject: [commit: packages/directory] master: Remove unnecessary /**/ hack in T macro (8a3be8a) Message-ID: <20160419065754.C19823A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8a3be8aef7a73efd4ca566d5ade7939eb8b010be/directory >--------------------------------------------------------------- commit 8a3be8aef7a73efd4ca566d5ade7939eb8b010be Author: Phil Ruffwind Date: Mon Apr 18 08:27:04 2016 -0400 Remove unnecessary /**/ hack in T macro It seems to cause problems with certain CPP implementations. >--------------------------------------------------------------- 8a3be8aef7a73efd4ca566d5ade7939eb8b010be tests/util.inl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/util.inl b/tests/util.inl index 92fc89b..a0c1506 100644 --- a/tests/util.inl +++ b/tests/util.inl @@ -1,4 +1,4 @@ -#define T(f) (T./**/f _t __FILE__ __LINE__) +#define T(f) (T.f _t __FILE__ __LINE__) import Util (TestEnv) import qualified Util as T From git at git.haskell.org Tue Apr 19 06:57:56 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 06:57:56 +0000 (UTC) Subject: [commit: packages/directory] master: Fix unused import of fromMaybe (2157f57) Message-ID: <20160419065756.C8CF33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2157f57972eb8cf37c024e255cce6e1c3af948b8/directory >--------------------------------------------------------------- commit 2157f57972eb8cf37c024e255cce6e1c3af948b8 Author: Phil Ruffwind Date: Mon Apr 18 08:25:37 2016 -0400 Fix unused import of fromMaybe >--------------------------------------------------------------- 2157f57972eb8cf37c024e255cce6e1c3af948b8 System/Directory.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/System/Directory.hs b/System/Directory.hs index 0e08f5f..ba09247 100644 --- a/System/Directory.hs +++ b/System/Directory.hs @@ -19,6 +19,7 @@ -- ----------------------------------------------------------------------------- +#include module System.Directory ( -- $intro @@ -153,7 +154,6 @@ import System.Environment ( getEnv ) import qualified System.Posix as Posix #endif -#include #ifdef HAVE_UTIMENSAT import Foreign.C (throwErrnoPathIfMinus1_) import System.Posix.Internals ( withFilePath ) From git at git.haskell.org Tue Apr 19 06:57:58 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 06:57:58 +0000 (UTC) Subject: [commit: packages/directory] master: Add support for OS X testing on Travis (ae7cc52) Message-ID: <20160419065758.D2F2E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ae7cc5230d9b14a0dd182eda7de29dcac17b2ac2/directory >--------------------------------------------------------------- commit ae7cc5230d9b14a0dd182eda7de29dcac17b2ac2 Author: Phil Ruffwind Date: Mon Apr 18 08:28:50 2016 -0400 Add support for OS X testing on Travis and also refactor testing code into a separate script. >--------------------------------------------------------------- ae7cc5230d9b14a0dd182eda7de29dcac17b2ac2 .travis.yml | 107 ++++++++++++++++++-------------------------------- appveyor.yml | 31 ++++++--------- tools/retry | 55 +++++++++++++++++++++----- tools/testscript | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 213 insertions(+), 97 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc ae7cc5230d9b14a0dd182eda7de29dcac17b2ac2 From git at git.haskell.org Tue Apr 19 06:58:00 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 06:58:00 +0000 (UTC) Subject: [commit: packages/directory] master: Add test: RenameDirectory (416ec19) Message-ID: <20160419065800.D94D33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/416ec19c55492bdb4dc3f1a729d7e4286a61a663/directory >--------------------------------------------------------------- commit 416ec19c55492bdb4dc3f1a729d7e4286a61a663 Author: Phil Ruffwind Date: Mon Apr 18 11:57:13 2016 -0400 Add test: RenameDirectory >--------------------------------------------------------------- 416ec19c55492bdb4dc3f1a729d7e4286a61a663 directory.cabal | 1 + tests/Main.hs | 2 ++ tests/RenameDirectory.hs | 11 +++++++++++ 3 files changed, 14 insertions(+) diff --git a/directory.cabal b/directory.cabal index 2c38c12..d4d56da 100644 --- a/directory.cabal +++ b/directory.cabal @@ -102,6 +102,7 @@ test-suite test GetPermissions001 IsSymbolicLink RemoveDirectoryRecursive001 + RenameDirectory RenameFile001 Safe T8482 diff --git a/tests/Main.hs b/tests/Main.hs index 65127f6..3a5a02d 100644 --- a/tests/Main.hs +++ b/tests/Main.hs @@ -17,6 +17,7 @@ import qualified GetHomeDirectory001 import qualified GetPermissions001 import qualified IsSymbolicLink import qualified RemoveDirectoryRecursive001 +import qualified RenameDirectory import qualified RenameFile001 import qualified Safe import qualified T8482 @@ -41,6 +42,7 @@ main = T.testMain $ \ _t -> do T.isolatedRun _t "GetPermissions001" GetPermissions001.main T.isolatedRun _t "IsSymbolicLink" IsSymbolicLink.main T.isolatedRun _t "RemoveDirectoryRecursive001" RemoveDirectoryRecursive001.main + T.isolatedRun _t "RenameDirectory" RenameDirectory.main T.isolatedRun _t "RenameFile001" RenameFile001.main T.isolatedRun _t "Safe" Safe.main T.isolatedRun _t "T8482" T8482.main diff --git a/tests/RenameDirectory.hs b/tests/RenameDirectory.hs new file mode 100644 index 0000000..90881a8 --- /dev/null +++ b/tests/RenameDirectory.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE CPP #-} +module RenameDirectory where +#include "util.inl" +import System.Directory + +main :: TestEnv -> IO () +main _t = do + createDirectory "a" + T(expectEq) () ["a"] =<< listDirectory "." + renameDirectory "a" "b" + T(expectEq) () ["b"] =<< listDirectory "." From git at git.haskell.org Tue Apr 19 06:58:02 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 06:58:02 +0000 (UTC) Subject: [commit: packages/directory] master: Remove use of NondecreasingIndentation (ad2e0a1) Message-ID: <20160419065802.E06B03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ad2e0a110bf2ee2e2a3bd87963fa55505ca58b28/directory >--------------------------------------------------------------- commit ad2e0a110bf2ee2e2a3bd87963fa55505ca58b28 Author: Phil Ruffwind Date: Mon Apr 18 12:08:04 2016 -0400 Remove use of NondecreasingIndentation >--------------------------------------------------------------- ad2e0a110bf2ee2e2a3bd87963fa55505ca58b28 System/Directory.hs | 30 ++++++++++++++++-------------- directory.cabal | 1 - 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/System/Directory.hs b/System/Directory.hs index ba09247..4e41e14 100644 --- a/System/Directory.hs +++ b/System/Directory.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE CPP, NondecreasingIndentation #-} +{-# LANGUAGE CPP #-} #if !(MIN_VERSION_base(4,8,0)) -- In base-4.8.0 the Foreign module became Safe @@ -250,10 +250,10 @@ The operation may fail with: -} getPermissions :: FilePath -> IO Permissions -getPermissions name = do +getPermissions name = #ifdef mingw32_HOST_OS -- issue #9: Windows doesn't like trailing path separators - withFilePath (dropTrailingPathSeparator name) $ \s -> do + withFilePath (dropTrailingPathSeparator name) $ \s -> -- stat() does a better job of guessing the permissions on Windows -- than access() does. e.g. for execute permission, it looks at the -- filename extension :-) @@ -276,6 +276,7 @@ getPermissions name = do } ) #else + do read_ok <- Posix.fileAccess name True False False write_ok <- Posix.fileAccess name False True False exec_ok <- Posix.fileAccess name False False True @@ -304,9 +305,9 @@ The operation may fail with: -} setPermissions :: FilePath -> Permissions -> IO () -setPermissions name (Permissions r w e s) = do +setPermissions name (Permissions r w e s) = #ifdef mingw32_HOST_OS - allocaBytes sizeof_stat $ \ p_stat -> do + allocaBytes sizeof_stat $ \ p_stat -> withFilePath name $ \p_name -> do throwErrnoIfMinus1_ "setPermissions" $ c_stat p_name p_stat @@ -322,6 +323,7 @@ setPermissions name (Permissions r w e s) = do modifyBit False m b = m .&. (complement b) modifyBit True m b = m .|. b #else + do stat <- Posix.getFileStatus name let mode = Posix.fileMode stat let mode1 = modifyBit r mode Posix.ownerReadMode @@ -340,15 +342,16 @@ foreign import ccall unsafe "_wchmod" #endif copyPermissions :: FilePath -> FilePath -> IO () -copyPermissions source dest = do +copyPermissions source dest = #ifdef mingw32_HOST_OS - allocaBytes sizeof_stat $ \ p_stat -> do - withFilePath source $ \p_source -> do + allocaBytes sizeof_stat $ \ p_stat -> + withFilePath source $ \p_source -> withFilePath dest $ \p_dest -> do throwErrnoIfMinus1_ "copyPermissions" $ c_stat p_source p_stat mode <- st_mode p_stat throwErrnoIfMinus1_ "copyPermissions" $ c_wchmod p_dest mode #else + do stat <- Posix.getFileStatus source copyPermissionsFromStatus stat dest #endif @@ -668,21 +671,20 @@ Either path refers to an existing non-directory object. -} renameDirectory :: FilePath -> FilePath -> IO () -renameDirectory opath npath = do +renameDirectory opath npath = -- XXX this test isn't performed atomically with the following rename #ifdef mingw32_HOST_OS -- ToDo: use Win32 API withFileStatus "renameDirectory" opath $ \st -> do is_dir <- isDirectory st #else + do stat <- Posix.getFileStatus opath let is_dir = Posix.fileMode stat .&. Posix.directoryMode /= 0 #endif - if (not is_dir) - then ioError (ioeSetErrorString - (mkIOError InappropriateType "renameDirectory" Nothing (Just opath)) - "not a directory") - else do + when (not is_dir) $ do + ioError . (`ioeSetErrorString` "not a directory") $ + (mkIOError InappropriateType "renameDirectory" Nothing (Just opath)) #ifdef mingw32_HOST_OS Win32.moveFileEx opath npath Win32.mOVEFILE_REPLACE_EXISTING #else diff --git a/directory.cabal b/directory.cabal index d4d56da..a03cb67 100644 --- a/directory.cabal +++ b/directory.cabal @@ -38,7 +38,6 @@ Library default-language: Haskell2010 other-extensions: CPP - NondecreasingIndentation Trustworthy exposed-modules: From git at git.haskell.org Tue Apr 19 06:59:24 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 06:59:24 +0000 (UTC) Subject: [commit: ghc] master: Update `directory` submodule to v1.2.6.2 release (8556f56) Message-ID: <20160419065924.9CAC23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8556f56b71f979f70f503e1d23a822b21947f7ab/ghc >--------------------------------------------------------------- commit 8556f56b71f979f70f503e1d23a822b21947f7ab Author: Herbert Valerio Riedel Date: Tue Apr 19 09:00:54 2016 +0200 Update `directory` submodule to v1.2.6.2 release The v1.2.6.1 release uploaded to Hackage is broken, we don't want to bundle a release that's non-installable from Hackage >--------------------------------------------------------------- 8556f56b71f979f70f503e1d23a822b21947f7ab libraries/directory | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/directory b/libraries/directory index 8bb9760..ad2e0a1 160000 --- a/libraries/directory +++ b/libraries/directory @@ -1 +1 @@ -Subproject commit 8bb9760d3c260ac7a4b5b85092adcecc5709b865 +Subproject commit ad2e0a110bf2ee2e2a3bd87963fa55505ca58b28 From git at git.haskell.org Tue Apr 19 07:39:24 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 07:39:24 +0000 (UTC) Subject: [commit: ghc] master: Define TyCoRep.ppSuggestExplicitKinds, and use it (d59939a) Message-ID: <20160419073924.7919A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d59939a4efeaca297cd2ad70a86ad589d1872003/ghc >--------------------------------------------------------------- commit d59939a4efeaca297cd2ad70a86ad589d1872003 Author: Simon Peyton Jones Date: Mon Apr 18 14:54:03 2016 +0100 Define TyCoRep.ppSuggestExplicitKinds, and use it This just defines a useful helper function that was being duplicated in several places >--------------------------------------------------------------- d59939a4efeaca297cd2ad70a86ad589d1872003 compiler/typecheck/FamInst.hs | 5 +---- compiler/typecheck/FunDeps.hs | 2 +- compiler/typecheck/TcErrors.hs | 13 +++---------- compiler/types/TyCoRep.hs | 10 +++++++++- compiler/types/Type.hs | 2 +- testsuite/tests/ghci/scripts/T6018ghcifail.stderr | 6 +++--- testsuite/tests/typecheck/should_fail/T6018fail.stderr | 8 ++++---- 7 files changed, 22 insertions(+), 24 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc d59939a4efeaca297cd2ad70a86ad589d1872003 From git at git.haskell.org Tue Apr 19 07:39:27 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 07:39:27 +0000 (UTC) Subject: [commit: ghc] master: Refactor computing dependent type vars (17eb241) Message-ID: <20160419073927.3C4DF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/17eb2419c42c70d7436b6b8cff0cef705353bb4e/ghc >--------------------------------------------------------------- commit 17eb2419c42c70d7436b6b8cff0cef705353bb4e Author: Simon Peyton Jones Date: Mon Apr 18 15:01:13 2016 +0100 Refactor computing dependent type vars There should be no change in behaviour here * Move splitDepVarsOfType(s) from Type to TcType * Define data type TcType.TcDepVars, document what it means, and use it where appropriate, notably in splitDepVarsOfType(s) * Use it in TcMType.quantifyTyVars and friends >--------------------------------------------------------------- 17eb2419c42c70d7436b6b8cff0cef705353bb4e compiler/typecheck/TcHsType.hs | 29 +++++++------ compiler/typecheck/TcMType.hs | 56 +++++++++++++----------- compiler/typecheck/TcPatSyn.hs | 22 ++++------ compiler/typecheck/TcSimplify.hs | 33 +++++++------- compiler/typecheck/TcType.hs | 94 ++++++++++++++++++++++++++++++++++++++++ compiler/types/Type.hs | 41 ------------------ 6 files changed, 163 insertions(+), 112 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 17eb2419c42c70d7436b6b8cff0cef705353bb4e From git at git.haskell.org Tue Apr 19 07:39:29 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 07:39:29 +0000 (UTC) Subject: [commit: ghc] master: Remove unused import of emptyNameEnv (a3c37c3) Message-ID: <20160419073929.E169D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a3c37c3f56759882c6ac8784b8b9ef55c8f8923c/ghc >--------------------------------------------------------------- commit a3c37c3f56759882c6ac8784b8b9ef55c8f8923c Author: Simon Peyton Jones Date: Mon Apr 18 14:51:30 2016 +0100 Remove unused import of emptyNameEnv >--------------------------------------------------------------- a3c37c3f56759882c6ac8784b8b9ef55c8f8923c compiler/main/HscMain.hs | 1 - 1 file changed, 1 deletion(-) diff --git a/compiler/main/HscMain.hs b/compiler/main/HscMain.hs index 385c9f2..d778b1d 100644 --- a/compiler/main/HscMain.hs +++ b/compiler/main/HscMain.hs @@ -130,7 +130,6 @@ import CmmBuildInfoTables import CmmPipeline import CmmInfo import CodeOutput -import NameEnv ( emptyNameEnv ) import InstEnv import FamInstEnv import Fingerprint ( Fingerprint ) From git at git.haskell.org Tue Apr 19 07:39:33 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 07:39:33 +0000 (UTC) Subject: [commit: ghc] master: Tighten checking for associated type instances (8136a5c) Message-ID: <20160419073933.BA8C53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8136a5cbfcd24647f897a2fae9fcbda0b1624035/ghc >--------------------------------------------------------------- commit 8136a5cbfcd24647f897a2fae9fcbda0b1624035 Author: Simon Peyton Jones Date: Mon Apr 18 15:14:40 2016 +0100 Tighten checking for associated type instances This patch finishes off Trac #11450. Following debate on that ticket, the patch tightens up the rules for what the instances of an associated type can look like. Now they must match the instance header exactly. Eg class C a b where type T a x b With this class decl, if we have an instance decl instance C ty1 ty2 where ... then the type instance must look like type T ty1 v ty2 = ... with exactly - 'ty1' for 'a' - 'ty2' for 'b', and - a variable for 'x' For example: instance C [p] Int type T [p] y Int = (p,y,y) Previously we allowed multiple instance equations and now, in effect, we don't since they would all overlap. If you want multiple cases, use an auxiliary type family. This is consistent with the treatment of generic-default instances, and the user manual always said "WARNING: this facility (multiple instance equations may be withdrawn in the future". I also improved error messages, and did other minor refactoring. >--------------------------------------------------------------- 8136a5cbfcd24647f897a2fae9fcbda0b1624035 compiler/rename/RnSource.hs | 40 +++- compiler/typecheck/TcDeriv.hs | 16 +- compiler/typecheck/TcInstDcls.hs | 8 +- compiler/typecheck/TcTyClsDecls.hs | 13 +- compiler/typecheck/TcValidity.hs | 251 ++++++++++++--------- compiler/types/Type.hs | 12 - docs/users_guide/glasgow_exts.rst | 66 ++++-- testsuite/tests/ghci/scripts/T4175.hs | 4 +- testsuite/tests/ghci/scripts/T4175.stdout | 9 +- testsuite/tests/ghci/scripts/T6018ghcifail.stderr | 13 +- .../tests/indexed-types/should_compile/T10931.hs | 2 +- .../indexed-types/should_fail/SimpleFail10.hs | 3 +- .../indexed-types/should_fail/SimpleFail10.stderr | 11 + .../tests/indexed-types/should_fail/SimpleFail9.hs | 5 +- .../indexed-types/should_fail/SimpleFail9.stderr | 7 + .../tests/indexed-types/should_fail/T11450.hs | 9 + .../tests/indexed-types/should_fail/T11450.stderr | 7 + testsuite/tests/indexed-types/should_fail/all.T | 5 +- testsuite/tests/polykinds/T10570.stderr | 14 +- testsuite/tests/th/T9692.hs | 2 +- testsuite/tests/th/T9692.stderr | 4 +- testsuite/tests/typecheck/should_fail/T6018fail.hs | 4 +- .../tests/typecheck/should_fail/T6018fail.stderr | 13 +- .../typecheck/should_fail/T6018failclosed.stderr | 144 ++++++------ 24 files changed, 394 insertions(+), 268 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 8136a5cbfcd24647f897a2fae9fcbda0b1624035 From git at git.haskell.org Tue Apr 19 07:39:36 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 07:39:36 +0000 (UTC) Subject: [commit: ghc] master: Kill dead TauTvFlavour, and move code around (9de405d) Message-ID: <20160419073936.73C783A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9de405d7a7e746213238375dbbc69e9b5ea8c394/ghc >--------------------------------------------------------------- commit 9de405d7a7e746213238375dbbc69e9b5ea8c394 Author: Simon Peyton Jones Date: Mon Apr 18 15:20:00 2016 +0100 Kill dead TauTvFlavour, and move code around This is just tidying up. >--------------------------------------------------------------- 9de405d7a7e746213238375dbbc69e9b5ea8c394 compiler/typecheck/TcType.hs | 200 ++++++++++++++++++++++--------------------- 1 file changed, 104 insertions(+), 96 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 9de405d7a7e746213238375dbbc69e9b5ea8c394 From git at git.haskell.org Tue Apr 19 08:27:43 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 08:27:43 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: relnotes: Add note about #11744 and workaround (bcff328) Message-ID: <20160419082743.B6FA43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/bcff328889200dd935997ff1438736a81a78c528/ghc >--------------------------------------------------------------- commit bcff328889200dd935997ff1438736a81a78c528 Author: Ben Gamari Date: Mon Apr 18 15:13:41 2016 +0200 relnotes: Add note about #11744 and workaround Test Plan: Read it Reviewers: hvr, austin Subscribers: carter, thomie Differential Revision: https://phabricator.haskell.org/D2120 GHC Trac Issues: #11744 (cherry picked from commit 03d1fd63914bd0c769fa0444d3ef1a5ddfee220d) >--------------------------------------------------------------- bcff328889200dd935997ff1438736a81a78c528 docs/users_guide/8.0.1-notes.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/users_guide/8.0.1-notes.rst b/docs/users_guide/8.0.1-notes.rst index fe76b3a..f627a6f 100644 --- a/docs/users_guide/8.0.1-notes.rst +++ b/docs/users_guide/8.0.1-notes.rst @@ -18,6 +18,14 @@ performance improvements over the 7.10 branch. package key (with GHC's :ghc-flag:`-this-package-key` argument), GHC 8.0 and later uses installed package IDs in place of package keys. +.. note:: + + Users compiling GHC on Mac OS X with XCode 7.3 will need to tell the build + system to use the ``nm-classic`` command instead of Apple's new ``nm`` + implementation as the latter breaks POSIX compliance (see + :ghc-ticket:`11744`). This can be done by passing something like + ``--with-nm=/Library/Developer/CommandLineTools/usr/bin/nm-classic`` to + ``configure``. Highlights ---------- From git at git.haskell.org Tue Apr 19 08:27:46 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 08:27:46 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Make it easy to get hyperlinked sources (efafad0) Message-ID: <20160419082746.6E4363A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/efafad0112f128d0c03472356b48dea39322293a/ghc >--------------------------------------------------------------- commit efafad0112f128d0c03472356b48dea39322293a Author: Bartosz Nitka Date: Mon Apr 18 06:29:37 2016 -0700 Make it easy to get hyperlinked sources The version of `haddock` that ghc has as a submodule has an option for generating linkified sources. I don't think it hurts to have this and they are great for exploring the codebase. I'd be nice if harbormaster or travis published them somewhere, but I don't know how to do that yet. Test Plan: uncomment, run `make` and look at the nicely linkified sources in `compiler/stage2/doc/html/ghc/` Reviewers: hvr, austin, bgamari Reviewed By: bgamari Subscribers: thomie, simonmar Differential Revision: https://phabricator.haskell.org/D2119 (cherry picked from commit 3dac53fa3ede70e86ddb6f40e1e96feb61301754) >--------------------------------------------------------------- efafad0112f128d0c03472356b48dea39322293a mk/build.mk.sample | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mk/build.mk.sample b/mk/build.mk.sample index 196becb..eed749c 100644 --- a/mk/build.mk.sample +++ b/mk/build.mk.sample @@ -86,5 +86,9 @@ endif # (other sometimes useful configure-options: `--with-gmp-{includes,libraries}`) #libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-intree-gmp +# Enable pretty hyperlinked sources +#HADDOCK_DOCS = YES +#EXTRA_HADDOCK_OPTS += --hyperlinked-source + # Don't strip debug and other unneeded symbols from libraries and executables. STRIP_CMD = : From git at git.haskell.org Tue Apr 19 08:27:49 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 08:27:49 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: rts: Limit maximum backtrace depth (b963f07) Message-ID: <20160419082749.282763A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/b963f07f2ab6ca2209e0e295a3f570e2c25ff440/ghc >--------------------------------------------------------------- commit b963f07f2ab6ca2209e0e295a3f570e2c25ff440 Author: Ben Gamari Date: Mon Apr 11 00:49:06 2016 +0200 rts: Limit maximum backtrace depth This prevents us from entering an infinite loop in the event of a hitting bad unwinding information. (cherry picked from commit 350ffc3e4c6b3aefd6ae621991564cc28f585d46) >--------------------------------------------------------------- b963f07f2ab6ca2209e0e295a3f570e2c25ff440 rts/Libdw.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/rts/Libdw.c b/rts/Libdw.c index 8c3c581..e796840 100644 --- a/rts/Libdw.c +++ b/rts/Libdw.c @@ -16,6 +16,8 @@ #include #include +const int max_backtrace_depth = 5000; + static BacktraceChunk *backtraceAllocChunk(BacktraceChunk *next) { BacktraceChunk *chunk = stgMallocBytes(sizeof(BacktraceChunk), "backtraceAllocChunk"); @@ -57,7 +59,10 @@ void backtraceFree(Backtrace *bt) { struct LibdwSession_ { Dwfl *dwfl; - Backtrace *cur_bt; // The current backtrace we are collecting (if any) + + // The current backtrace we are collecting (if any) + Backtrace *cur_bt; + int max_depth; }; static const Dwfl_Thread_Callbacks thread_cbs; @@ -230,8 +235,12 @@ static int getBacktraceFrameCb(Dwfl_Frame *frame, void *arg) { pc -= 1; // TODO: is this right? backtracePush(session->cur_bt, (StgPtr) (uintptr_t) pc); } - - return DWARF_CB_OK; + session->max_depth--; + if (session->max_depth == 0) { + return DWARF_CB_ABORT; + } else { + return DWARF_CB_OK; + } } Backtrace *libdwGetBacktrace(LibdwSession *session) { @@ -242,6 +251,7 @@ Backtrace *libdwGetBacktrace(LibdwSession *session) { Backtrace *bt = backtraceAlloc(); session->cur_bt = bt; + session->max_depth = max_backtrace_depth; int pid = getpid(); int ret = dwfl_getthread_frames(session->dwfl, pid, From git at git.haskell.org Tue Apr 19 08:27:54 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 08:27:54 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Update `directory` submodule to v1.2.6.2 release (23f83b5) Message-ID: <20160419082754.7ADEC3A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/23f83b5cc8d95339ff6f8125fff97d37fccd2d8d/ghc >--------------------------------------------------------------- commit 23f83b5cc8d95339ff6f8125fff97d37fccd2d8d Author: Herbert Valerio Riedel Date: Tue Apr 19 09:00:54 2016 +0200 Update `directory` submodule to v1.2.6.2 release The v1.2.6.1 release uploaded to Hackage is broken, we don't want to bundle a release that's non-installable from Hackage (cherry picked from commit 8556f56b71f979f70f503e1d23a822b21947f7ab) >--------------------------------------------------------------- 23f83b5cc8d95339ff6f8125fff97d37fccd2d8d libraries/directory | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/directory b/libraries/directory index 8bb9760..ad2e0a1 160000 --- a/libraries/directory +++ b/libraries/directory @@ -1 +1 @@ -Subproject commit 8bb9760d3c260ac7a4b5b85092adcecc5709b865 +Subproject commit ad2e0a110bf2ee2e2a3bd87963fa55505ca58b28 From git at git.haskell.org Tue Apr 19 08:27:51 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 08:27:51 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: rts: Don't use strndup (7f19aed) Message-ID: <20160419082751.CBD993A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/7f19aed499744ed3595fef9f189f03925393a6b7/ghc >--------------------------------------------------------------- commit 7f19aed499744ed3595fef9f189f03925393a6b7 Author: Ben Gamari Date: Mon Apr 18 22:32:59 2016 +0200 rts: Don't use strndup Reviewers: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2125 (cherry picked from commit d1ce35d2271ac8b79cb5e37677b1a989749e611c) >--------------------------------------------------------------- 7f19aed499744ed3595fef9f189f03925393a6b7 rts/RtsFlags.c | 2 +- rts/RtsUtils.c | 12 ++++++++++++ rts/RtsUtils.h | 2 ++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c index 5ecb5e0..46a7de1 100644 --- a/rts/RtsFlags.c +++ b/rts/RtsFlags.c @@ -1607,7 +1607,7 @@ static rtsBool read_heap_profiling_flag(const char *arg_in) if (!right) right = arg + strlen(arg); - char *selector = strndup(left, right - left); + char *selector = stgStrndup(left, right - left + 1); switch (arg[2]) { case 'c': // cost centre label select diff --git a/rts/RtsUtils.c b/rts/RtsUtils.c index a36532c..c837143 100644 --- a/rts/RtsUtils.c +++ b/rts/RtsUtils.c @@ -112,6 +112,18 @@ stgCallocBytes (int n, int m, char *msg) return space; } +/* borrowed from the MUSL libc project */ +char *stgStrndup(const char *s, size_t n) +{ + size_t l = strnlen(s, n); + char *d = stgMallocBytes(l+1, "stgStrndup"); + if (!d) return NULL; + memcpy(d, s, l); + d[l] = 0; + return d; +} + + /* To simplify changing the underlying allocator used * by stgMallocBytes(), provide stgFree() as well. */ diff --git a/rts/RtsUtils.h b/rts/RtsUtils.h index 5d825a2..d76c921 100644 --- a/rts/RtsUtils.h +++ b/rts/RtsUtils.h @@ -26,6 +26,8 @@ void *stgReallocBytes(void *p, int n, char *msg); void *stgCallocBytes(int n, int m, char *msg) GNUC3_ATTRIBUTE(__malloc__); +char *stgStrndup(const char *s, size_t n); + void stgFree(void* p); /* ----------------------------------------------------------------------------- From git at git.haskell.org Tue Apr 19 11:52:12 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 11:52:12 +0000 (UTC) Subject: [commit: hsc2hs] master: Bump hsc2hs version to 0.68 (5119aeb) Message-ID: <20160419115212.CEBBB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hsc2hs On branch : master Link : http://git.haskell.org/hsc2hs.git/commitdiff/5119aebacaca75d983b4d7db32a6305b7f8651dd >--------------------------------------------------------------- commit 5119aebacaca75d983b4d7db32a6305b7f8651dd Author: Herbert Valerio Riedel Date: Tue Apr 19 13:39:56 2016 +0200 Bump hsc2hs version to 0.68 This is to make sure that GHC's hsc2hs has a higher version than the versions available on Hackage. >--------------------------------------------------------------- 5119aebacaca75d983b4d7db32a6305b7f8651dd hsc2hs.cabal | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hsc2hs.cabal b/hsc2hs.cabal index a6c74f3..9d0718e 100644 --- a/hsc2hs.cabal +++ b/hsc2hs.cabal @@ -1,11 +1,12 @@ Name: hsc2hs -Version: 0.67 +Version: 0.68 Copyright: 2000, Marcin Kowalczyk License: BSD3 License-File: LICENSE Author: Marcin Kowalczyk Maintainer: ghc-devs at haskell.org Synopsis: A preprocessor that helps with writing Haskell bindings to C code +Bug-Reports: https://ghc.haskell.org/trac/ghc/newticket?component=hsc2hs Description: The hsc2hs program can be used to automate some parts of the process of writing Haskell bindings to C code. It reads an From git at git.haskell.org Tue Apr 19 11:55:32 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 11:55:32 +0000 (UTC) Subject: [commit: ghc] master: Update hsc2hs submodule (81e2279) Message-ID: <20160419115532.912CB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/81e227929c15ad82f6f67a7390ee140da85eefdb/ghc >--------------------------------------------------------------- commit 81e227929c15ad82f6f67a7390ee140da85eefdb Author: Herbert Valerio Riedel Date: Tue Apr 19 13:56:54 2016 +0200 Update hsc2hs submodule This bumps the hsc2hs version to 0.68 >--------------------------------------------------------------- 81e227929c15ad82f6f67a7390ee140da85eefdb utils/hsc2hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/hsc2hs b/utils/hsc2hs index d9c13cb..5119aeb 160000 --- a/utils/hsc2hs +++ b/utils/hsc2hs @@ -1 +1 @@ -Subproject commit d9c13cb8f5be89a030783d758fcf7c077351c6a9 +Subproject commit 5119aebacaca75d983b4d7db32a6305b7f8651dd From git at git.haskell.org Tue Apr 19 14:51:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 14:51:03 +0000 (UTC) Subject: [commit: hsc2hs] tag 'v0.68' created Message-ID: <20160419145103.443AB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hsc2hs New tag : v0.68 Referencing: b729f720e0f5e23e44fe736a119b1e73cfe70bc4 From git at git.haskell.org Tue Apr 19 17:11:42 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 17:11:42 +0000 (UTC) Subject: [commit: ghc] master: Mark GHC.Stack.Types Trustworthy (91ee509) Message-ID: <20160419171142.1C7F93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/91ee5090f1e3f43e9e803cf7005a7f3357e58377/ghc >--------------------------------------------------------------- commit 91ee5090f1e3f43e9e803cf7005a7f3357e58377 Author: Herbert Valerio Riedel Date: Tue Apr 19 18:32:29 2016 +0200 Mark GHC.Stack.Types Trustworthy GHC can't infer this module safe due to the `GHC.Types (Char, Int)` and the (dummy) `GHC.Integer ()` import. If only `GHC.Types` was marked Trustworthy or Safe... >--------------------------------------------------------------- 91ee5090f1e3f43e9e803cf7005a7f3357e58377 libraries/base/GHC/Stack/Types.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries/base/GHC/Stack/Types.hs b/libraries/base/GHC/Stack/Types.hs index 33b24a4..29be6d6 100644 --- a/libraries/base/GHC/Stack/Types.hs +++ b/libraries/base/GHC/Stack/Types.hs @@ -4,6 +4,7 @@ {-# LANGUAGE KindSignatures #-} {-# LANGUAGE PolyKinds #-} {-# LANGUAGE RankNTypes #-} +{-# LANGUAGE Trustworthy #-} {-# OPTIONS_HADDOCK hide #-} -- we hide this module from haddock to enforce GHC.Stack as the main @@ -49,7 +50,7 @@ import cycle, -} import GHC.Classes (Eq) -import GHC.Types +import GHC.Types (Char, Int) -- Make implicit dependency known to build system import GHC.Tuple () From git at git.haskell.org Tue Apr 19 17:14:15 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 17:14:15 +0000 (UTC) Subject: [commit: ghc] master: Update deepseq submodule to latest 1.4.2.0 snapshot (96e1bb4) Message-ID: <20160419171415.908D23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/96e1bb4536a6f130c9242e3c25566c7d2e71ee97/ghc >--------------------------------------------------------------- commit 96e1bb4536a6f130c9242e3c25566c7d2e71ee97 Author: Herbert Valerio Riedel Date: Tue Apr 19 19:16:01 2016 +0200 Update deepseq submodule to latest 1.4.2.0 snapshot NB: this needs 91ee5090f1e3f43e9e803cf7005a7f3357e58377 >--------------------------------------------------------------- 96e1bb4536a6f130c9242e3c25566c7d2e71ee97 libraries/deepseq | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/deepseq b/libraries/deepseq index 40d4db0..cb66aa8 160000 --- a/libraries/deepseq +++ b/libraries/deepseq @@ -1 +1 @@ -Subproject commit 40d4db0a4e81a07ecd0f1bc77b8772088e75e478 +Subproject commit cb66aa890b0972375e31deaee3bc424f46beb68a From git at git.haskell.org Tue Apr 19 20:30:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:03 +0000 (UTC) Subject: [commit: packages/binary] master: Document 'putList'. (fbef3cb) Message-ID: <20160419203003.7F20F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/fbef3cb8985e54f5e638f63b6153b931668f7f00 >--------------------------------------------------------------- commit fbef3cb8985e54f5e638f63b6153b931668f7f00 Author: Lennart Kolmodin Date: Sun Apr 3 22:23:55 2016 +0200 Document 'putList'. >--------------------------------------------------------------- fbef3cb8985e54f5e638f63b6153b931668f7f00 src/Data/Binary/Class.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Data/Binary/Class.hs b/src/Data/Binary/Class.hs index 5965ca0..161f2a7 100644 --- a/src/Data/Binary/Class.hs +++ b/src/Data/Binary/Class.hs @@ -147,6 +147,9 @@ class Binary t where -- | Decode a value in the Get monad get :: Get t + -- | Encode a list of values in the Put monad. + -- The default implementation may be overridden to be more efficient + -- but must still have the same encoding format. putList :: [t] -> Put putList = defaultPutList From git at git.haskell.org Tue Apr 19 20:30:05 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:05 +0000 (UTC) Subject: [commit: packages/binary] master: Add 'putList' instance for Word8. (d87fd41) Message-ID: <20160419203005.847873A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/d87fd415ceaf318bf37c3bd0940aedd5303b053f >--------------------------------------------------------------- commit d87fd415ceaf318bf37c3bd0940aedd5303b053f Author: Lennart Kolmodin Date: Mon Apr 4 22:31:03 2016 +0200 Add 'putList' instance for Word8. Highlights from the benchmarks; "big Integers" : 5850.12 us 3841.54 us -34.3% "[big Integer]" : 6074.67 us 3959.01 us -34.8% Word8s : 256.19 us 266.92 us +4.2% [Word8] : 283.39 us 67.59 us -76.2% >--------------------------------------------------------------- d87fd415ceaf318bf37c3bd0940aedd5303b053f src/Data/Binary/Class.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Data/Binary/Class.hs b/src/Data/Binary/Class.hs index 161f2a7..36fc681 100644 --- a/src/Data/Binary/Class.hs +++ b/src/Data/Binary/Class.hs @@ -68,6 +68,7 @@ import Control.Monad import Data.ByteString.Lazy (ByteString) import qualified Data.ByteString.Lazy as L +import qualified Data.ByteString.Builder.Prim as Prim import Data.List (unfoldr, foldl') @@ -209,6 +210,9 @@ instance Binary Ordering where -- Words8s are written as bytes instance Binary Word8 where put = putWord8 + putList xs = do + put (length xs) + putBuilder (Prim.primMapListFixed Prim.word8 xs) get = getWord8 -- Words16s are written as 2 bytes in big-endian (network) order From git at git.haskell.org Tue Apr 19 20:30:07 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:07 +0000 (UTC) Subject: [commit: packages/binary] master: Add 'putList' for all IntXX and WordXX. (c287643) Message-ID: <20160419203007.8B8853A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/c2876434df5e749a25ab7543410d8f1dcf86fd92 >--------------------------------------------------------------- commit c2876434df5e749a25ab7543410d8f1dcf86fd92 Author: Lennart Kolmodin Date: Thu Apr 7 21:27:38 2016 +0200 Add 'putList' for all IntXX and WordXX. >--------------------------------------------------------------- c2876434df5e749a25ab7543410d8f1dcf86fd92 src/Data/Binary/Class.hs | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/Data/Binary/Class.hs b/src/Data/Binary/Class.hs index 36fc681..493dee4 100644 --- a/src/Data/Binary/Class.hs +++ b/src/Data/Binary/Class.hs @@ -210,6 +210,7 @@ instance Binary Ordering where -- Words8s are written as bytes instance Binary Word8 where put = putWord8 + {-# INLINE putList #-} putList xs = do put (length xs) putBuilder (Prim.primMapListFixed Prim.word8 xs) @@ -218,36 +219,64 @@ instance Binary Word8 where -- Words16s are written as 2 bytes in big-endian (network) order instance Binary Word16 where put = putWord16be + {-# INLINE putList #-} + putList xs = do + put (length xs) + putBuilder (Prim.primMapListFixed Prim.word16BE xs) get = getWord16be -- Words32s are written as 4 bytes in big-endian (network) order instance Binary Word32 where put = putWord32be + {-# INLINE putList #-} + putList xs = do + put (length xs) + putBuilder (Prim.primMapListFixed Prim.word32BE xs) get = getWord32be -- Words64s are written as 8 bytes in big-endian (network) order instance Binary Word64 where put = putWord64be + {-# INLINE putList #-} + putList xs = do + put (length xs) + putBuilder (Prim.primMapListFixed Prim.word64BE xs) get = getWord64be -- Int8s are written as a single byte. instance Binary Int8 where put = putInt8 + {-# INLINE putList #-} + putList xs = do + put (length xs) + putBuilder (Prim.primMapListFixed Prim.int8 xs) get = getInt8 -- Int16s are written as a 2 bytes in big endian format instance Binary Int16 where put = putInt16be + {-# INLINE putList #-} + putList xs = do + put (length xs) + putBuilder (Prim.primMapListFixed Prim.int16BE xs) get = getInt16be -- Int32s are written as a 4 bytes in big endian format instance Binary Int32 where put = putInt32be + {-# INLINE putList #-} + putList xs = do + put (length xs) + putBuilder (Prim.primMapListFixed Prim.int32BE xs) get = getInt32be -- Int64s are written as a 8 bytes in big endian format instance Binary Int64 where put = putInt64be + {-# INLINE putList #-} + putList xs = do + put (length xs) + putBuilder (Prim.primMapListFixed Prim.int64BE xs) get = getInt64be ------------------------------------------------------------------------ @@ -255,11 +284,19 @@ instance Binary Int64 where -- Words are are written as Word64s, that is, 8 bytes in big endian format instance Binary Word where put = putWord64be . fromIntegral + {-# INLINE putList #-} + putList xs = do + put (length xs) + putBuilder (Prim.primMapListFixed Prim.word64BE (map fromIntegral xs)) get = liftM fromIntegral getWord64be -- Ints are are written as Int64s, that is, 8 bytes in big endian format instance Binary Int where put = putInt64be . fromIntegral + {-# INLINE putList #-} + putList xs = do + put (length xs) + putBuilder (Prim.primMapListFixed Prim.int64BE (map fromIntegral xs)) get = liftM fromIntegral getInt64be ------------------------------------------------------------------------ @@ -279,6 +316,7 @@ instance Binary Integer where {-# INLINE put #-} put n | n >= lo && n <= hi = do + -- putBuilder (Prim.primFixed (Prim.word8 Prim.>*< Prim.int32BE) (0, fromIntegral n)) putWord8 0 put (fromIntegral n :: SmallInt) -- fast path where From git at git.haskell.org Tue Apr 19 20:30:09 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:09 +0000 (UTC) Subject: [commit: packages/binary] master: When QCing the Binary class, also test a list of values. (23adb9b) Message-ID: <20160419203009.92CE03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/23adb9bcaf62e840e6c4cbfac12844ad0ac0e00b >--------------------------------------------------------------- commit 23adb9bcaf62e840e6c4cbfac12844ad0ac0e00b Author: Lennart Kolmodin Date: Thu Apr 7 21:34:58 2016 +0200 When QCing the Binary class, also test a list of values. Now that we have 'putList' in Binary we must take care that we test reading/writing with lists too. This patch makes sure that we always test reading/writing list values when we test single values. >--------------------------------------------------------------- 23adb9bcaf62e840e6c4cbfac12844ad0ac0e00b tests/QC.hs | 136 +++++++++++++++++++++++++++++------------------------------- 1 file changed, 66 insertions(+), 70 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 23adb9bcaf62e840e6c4cbfac12844ad0ac0e00b From git at git.haskell.org Tue Apr 19 20:30:11 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:11 +0000 (UTC) Subject: [commit: packages/binary] master: Test list of values for Natural and GHC.Fingerprint. (8e28858) Message-ID: <20160419203011.98E9C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/8e2885862c2c60282b50d5d7dd7427d6980c2e7e >--------------------------------------------------------------- commit 8e2885862c2c60282b50d5d7dd7427d6980c2e7e Author: Lennart Kolmodin Date: Fri Apr 8 23:10:42 2016 +0200 Test list of values for Natural and GHC.Fingerprint. >--------------------------------------------------------------- 8e2885862c2c60282b50d5d7dd7427d6980c2e7e tests/QC.hs | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/tests/QC.hs b/tests/QC.hs index a3e069d..78dda8c 100644 --- a/tests/QC.hs +++ b/tests/QC.hs @@ -415,30 +415,24 @@ main = defaultMain tests ------------------------------------------------------------------------ #ifdef HAS_NATURAL -prop_test_Natural :: Property -prop_test_Natural = forAll (gen :: Gen Natural) test - where - gen :: Gen Natural - gen = do - b <- arbitrary - if b - then do - x <- arbitrarySizedNatural :: Gen Natural - -- arbitrarySizedNatural generates numbers smaller than - -- (maxBound :: Word64), so let's make them bigger to better test - -- the Binary instance. - return (x + fromIntegral (maxBound :: Word64)) - else arbitrarySizedNatural +genNatural :: Gen Natural +genNatural = do + b <- arbitrary + if b + then do + x <- arbitrarySizedNatural :: Gen Natural + -- arbitrarySizedNatural generates numbers smaller than + -- (maxBound :: Word64), so let's make them bigger to better test + -- the Binary instance. + return (x + fromIntegral (maxBound :: Word64)) + else arbitrarySizedNatural #endif ------------------------------------------------------------------------ #ifdef HAS_GHC_FINGERPRINT -prop_test_GHC_Fingerprint :: Property -prop_test_GHC_Fingerprint = forAll gen test - where - gen :: Gen Fingerprint - gen = liftM2 Fingerprint arbitrary arbitrary +genFingerprint :: Gen Fingerprint +genFingerprint = liftM2 Fingerprint arbitrary arbitrary #if !MIN_VERSION_base(4,7,0) instance Show Fingerprint where show (Fingerprint x1 x2) = show (x1,x2) @@ -487,6 +481,13 @@ test' desc prop propList = testProperty ("[" ++ desc ++ "]") propList ] +testWithGen :: (Show a, Eq a, Binary a) => String -> Gen a -> Test +testWithGen desc gen = + testGroup desc [ + testProperty desc (forAll gen test), + testProperty ("[" ++ desc ++ "]") (forAll (listOf gen) test) + ] + positiveList :: Gen [Int] positiveList = fmap (filter (/=0) . map abs) $ arbitrary @@ -570,10 +571,10 @@ tests = , test' "Integer" (test :: T Integer) test , test' "Fixed" (test :: T (Fixed.Fixed Fixed.E3) ) test #ifdef HAS_NATURAL - , testProperty "Natural" prop_test_Natural + , testWithGen "Natural" genNatural #endif #ifdef HAS_GHC_FINGERPRINT - , testProperty "GHC.Fingerprint" prop_test_GHC_Fingerprint + , testWithGen "GHC.Fingerprint" genFingerprint #endif , test' "Float" (test :: T Float ) test From git at git.haskell.org Tue Apr 19 20:30:13 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:13 +0000 (UTC) Subject: [commit: packages/binary] master: Add Monoid instance for Put (bec884f) Message-ID: <20160419203013.9F5323A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/bec884f96cfbd40d4842c20ef4688df9ef4f16f2 >--------------------------------------------------------------- commit bec884f96cfbd40d4842c20ef4688df9ef4f16f2 Author: Jacob Stanley Date: Sat Apr 9 16:45:56 2016 +1000 Add Monoid instance for Put >--------------------------------------------------------------- bec884f96cfbd40d4842c20ef4688df9ef4f16f2 src/Data/Binary/Put.hs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Data/Binary/Put.hs b/src/Data/Binary/Put.hs index 85ef569..07a86c0 100644 --- a/src/Data/Binary/Put.hs +++ b/src/Data/Binary/Put.hs @@ -1,4 +1,5 @@ {-# LANGUAGE CPP #-} +{-# LANGUAGE FlexibleInstances #-} #if __GLASGOW_HASKELL__ >= 701 && __GLASGOW_HASKELL__ != 702 {-# LANGUAGE Safe #-} #endif @@ -134,6 +135,13 @@ instance Monad PutM where (>>) = (*>) {-# INLINE (>>) #-} +instance Monoid (PutM ()) where + mempty = pure () + {-# INLINE mempty #-} + + mappend = (>>) + {-# INLINE mappend #-} + tell :: Builder -> Put tell b = Put $ PairS () b {-# INLINE tell #-} From git at git.haskell.org Tue Apr 19 20:30:15 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:15 +0000 (UTC) Subject: [commit: packages/binary] master: Merge pull request #112 from jystic/topic/put-monoid (e74d243) Message-ID: <20160419203015.A4ABF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/e74d2432941831ef4fd1155754239fd6573a4f8e >--------------------------------------------------------------- commit e74d2432941831ef4fd1155754239fd6573a4f8e Merge: 8e28858 bec884f Author: Lennart Kolmodin Date: Sat Apr 9 10:41:19 2016 +0200 Merge pull request #112 from jystic/topic/put-monoid Add Monoid instance for Put >--------------------------------------------------------------- e74d2432941831ef4fd1155754239fd6573a4f8e src/Data/Binary/Put.hs | 8 ++++++++ 1 file changed, 8 insertions(+) From git at git.haskell.org Tue Apr 19 20:30:16 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:16 +0000 (UTC) Subject: [commit: packages/binary] tag '0.8.3.0' created Message-ID: <20160419203016.07EFE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary New tag : 0.8.3.0 Referencing: be48ec35fb3ebd38cb9f8be2fb961e56c175dc69 From git at git.haskell.org Tue Apr 19 20:30:17 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:17 +0000 (UTC) Subject: [commit: packages/binary] master: Compare Put with Data.ByteString.Builder in put benchmark. (31d91b4) Message-ID: <20160419203017.AB08B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/31d91b407bf3fa554a502981df88b31dafa98184 >--------------------------------------------------------------- commit 31d91b407bf3fa554a502981df88b31dafa98184 Author: Lennart Kolmodin Date: Sat Apr 9 13:41:57 2016 +0200 Compare Put with Data.ByteString.Builder in put benchmark. >--------------------------------------------------------------- 31d91b407bf3fa554a502981df88b31dafa98184 benchmarks/Put.hs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/benchmarks/Put.hs b/benchmarks/Put.hs index c3cae43..6f317c0 100644 --- a/benchmarks/Put.hs +++ b/benchmarks/Put.hs @@ -11,6 +11,7 @@ import qualified Data.ByteString.Lazy as L import Data.Binary import Data.Binary.Put +import Data.ByteString.Builder as BB main :: IO () main = do @@ -36,12 +37,16 @@ main = do bench "[small String]" $ whnf (run . put) smallStrings, bench "Word8s" $ whnf (run . fromWord8s) word8s, + bench "Word8s builder" $ whnf (L.length . toLazyByteString . fromWord8sBuilder) word8s, bench "[Word8]" $ whnf (run . put) word8s, bench "Word16s" $ whnf (run . fromWord16s) word16s, + bench "Word16s builder" $ whnf (L.length . toLazyByteString . fromWord16sBuilder) word16s, bench "[Word16]" $ whnf (run . put) word16s, bench "Word32s" $ whnf (run . fromWord32s) word32s, + bench "Word32s builder" $ whnf (L.length . toLazyByteString . fromWord32sBuilder) word32s, bench "[Word32]" $ whnf (run . put) word32s, bench "Word64s" $ whnf (run . fromWord64s) word64s, + bench "Word64s builder" $ whnf (L.length . toLazyByteString . fromWord64sBuilder) word64s, bench "[Word64]" $ whnf (run . put) word64s ] where @@ -103,15 +108,30 @@ fromWord8s :: [Word8] -> Put fromWord8s [] = return () fromWord8s (x:xs) = put x >> fromWord8s xs +fromWord8sBuilder :: [Word8] -> BB.Builder +fromWord8sBuilder [] = mempty +fromWord8sBuilder (x:xs) = BB.word8 x `mappend` fromWord8sBuilder xs + fromWord16s :: [Word16] -> Put fromWord16s [] = return () fromWord16s (x:xs) = put x >> fromWord16s xs +fromWord16sBuilder :: [Word16] -> BB.Builder +fromWord16sBuilder [] = mempty +fromWord16sBuilder (x:xs) = BB.word16BE x `mappend` fromWord16sBuilder xs + fromWord32s :: [Word32] -> Put fromWord32s [] = return () fromWord32s (x:xs) = put x >> fromWord32s xs +fromWord32sBuilder :: [Word32] -> BB.Builder +fromWord32sBuilder [] = mempty +fromWord32sBuilder (x:xs) = BB.word32BE x `mappend` fromWord32sBuilder xs + fromWord64s :: [Word64] -> Put fromWord64s [] = return () fromWord64s (x:xs) = put x >> fromWord64s xs +fromWord64sBuilder :: [Word64] -> BB.Builder +fromWord64sBuilder [] = mempty +fromWord64sBuilder (x:xs) = BB.word64BE x `mappend` fromWord64sBuilder xs From git at git.haskell.org Tue Apr 19 20:30:18 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:18 +0000 (UTC) Subject: [commit: packages/binary] master: Document 'putList'. (fbef3cb) Message-ID: <20160419203018.0FF2C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/fbef3cb8985e54f5e638f63b6153b931668f7f00 >--------------------------------------------------------------- commit fbef3cb8985e54f5e638f63b6153b931668f7f00 Author: Lennart Kolmodin Date: Sun Apr 3 22:23:55 2016 +0200 Document 'putList'. >--------------------------------------------------------------- fbef3cb8985e54f5e638f63b6153b931668f7f00 src/Data/Binary/Class.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Data/Binary/Class.hs b/src/Data/Binary/Class.hs index 5965ca0..161f2a7 100644 --- a/src/Data/Binary/Class.hs +++ b/src/Data/Binary/Class.hs @@ -147,6 +147,9 @@ class Binary t where -- | Decode a value in the Get monad get :: Get t + -- | Encode a list of values in the Put monad. + -- The default implementation may be overridden to be more efficient + -- but must still have the same encoding format. putList :: [t] -> Put putList = defaultPutList From git at git.haskell.org Tue Apr 19 20:30:19 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:19 +0000 (UTC) Subject: [commit: packages/binary] master: Explicitly test small and big Integers and Naturals. (b768640) Message-ID: <20160419203019.B108C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/b768640e0034211ef9b079e998297aef4a1b1ae0 >--------------------------------------------------------------- commit b768640e0034211ef9b079e998297aef4a1b1ae0 Author: Lennart Kolmodin Date: Sun Apr 10 12:14:55 2016 +0200 Explicitly test small and big Integers and Naturals. >--------------------------------------------------------------- b768640e0034211ef9b079e998297aef4a1b1ae0 tests/QC.hs | 45 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/tests/QC.hs b/tests/QC.hs index 78dda8c..eeb04da 100644 --- a/tests/QC.hs +++ b/tests/QC.hs @@ -414,18 +414,38 @@ main = defaultMain tests ------------------------------------------------------------------------ +genInteger :: Gen Integer +genInteger = do + b <- arbitrary + if b then genIntegerSmall else genIntegerSmall + +genIntegerSmall :: Gen Integer +genIntegerSmall = arbitrary + +genIntegerBig :: Gen Integer +genIntegerBig = do + x <- arbitrarySizedIntegral :: Gen Integer + -- arbitrarySizedIntegral generates numbers smaller than + -- (maxBound :: Word32), so let's make them bigger to better test + -- the Binary instance. + return (x + fromIntegral (maxBound :: Word32)) + #ifdef HAS_NATURAL genNatural :: Gen Natural genNatural = do b <- arbitrary - if b - then do - x <- arbitrarySizedNatural :: Gen Natural - -- arbitrarySizedNatural generates numbers smaller than - -- (maxBound :: Word64), so let's make them bigger to better test - -- the Binary instance. - return (x + fromIntegral (maxBound :: Word64)) - else arbitrarySizedNatural + if b then genNaturalSmall else genNaturalBig + +genNaturalSmall :: Gen Natural +genNaturalSmall = arbitrarySizedNatural + +genNaturalBig :: Gen Natural +genNaturalBig = do + x <- arbitrarySizedNatural :: Gen Natural + -- arbitrarySizedNatural generates numbers smaller than + -- (maxBound :: Word64), so let's make them bigger to better test + -- the Binary instance. + return (x + fromIntegral (maxBound :: Word64)) #endif ------------------------------------------------------------------------ @@ -568,10 +588,15 @@ tests = , test' "Int32" (test :: T Int32) test , test' "Int64" (test :: T Int64) test - , test' "Integer" (test :: T Integer) test + , testWithGen "Integer mixed" genInteger + , testWithGen "Integer small" genIntegerSmall + , testWithGen "Integer big" genIntegerBig + , test' "Fixed" (test :: T (Fixed.Fixed Fixed.E3) ) test #ifdef HAS_NATURAL - , testWithGen "Natural" genNatural + , testWithGen "Natural mixed" genNatural + , testWithGen "Natural small" genNaturalSmall + , testWithGen "Natural big" genNaturalBig #endif #ifdef HAS_GHC_FINGERPRINT , testWithGen "GHC.Fingerprint" genFingerprint From git at git.haskell.org Tue Apr 19 20:30:20 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:20 +0000 (UTC) Subject: [commit: packages/binary] master: Add 'putList' instance for Word8. (d87fd41) Message-ID: <20160419203020.15BB53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/d87fd415ceaf318bf37c3bd0940aedd5303b053f >--------------------------------------------------------------- commit d87fd415ceaf318bf37c3bd0940aedd5303b053f Author: Lennart Kolmodin Date: Mon Apr 4 22:31:03 2016 +0200 Add 'putList' instance for Word8. Highlights from the benchmarks; "big Integers" : 5850.12 us 3841.54 us -34.3% "[big Integer]" : 6074.67 us 3959.01 us -34.8% Word8s : 256.19 us 266.92 us +4.2% [Word8] : 283.39 us 67.59 us -76.2% >--------------------------------------------------------------- d87fd415ceaf318bf37c3bd0940aedd5303b053f src/Data/Binary/Class.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Data/Binary/Class.hs b/src/Data/Binary/Class.hs index 161f2a7..36fc681 100644 --- a/src/Data/Binary/Class.hs +++ b/src/Data/Binary/Class.hs @@ -68,6 +68,7 @@ import Control.Monad import Data.ByteString.Lazy (ByteString) import qualified Data.ByteString.Lazy as L +import qualified Data.ByteString.Builder.Prim as Prim import Data.List (unfoldr, foldl') @@ -209,6 +210,9 @@ instance Binary Ordering where -- Words8s are written as bytes instance Binary Word8 where put = putWord8 + putList xs = do + put (length xs) + putBuilder (Prim.primMapListFixed Prim.word8 xs) get = getWord8 -- Words16s are written as 2 bytes in big-endian (network) order From git at git.haskell.org Tue Apr 19 20:30:21 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:21 +0000 (UTC) Subject: [commit: packages/binary] master: Add small Generics bench to the Put benchmark suite. (fb41919) Message-ID: <20160419203021.B82F03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/fb41919966edc56a6c7052563f48c435a13d8413 >--------------------------------------------------------------- commit fb41919966edc56a6c7052563f48c435a13d8413 Author: Lennart Kolmodin Date: Mon Apr 11 22:03:58 2016 +0200 Add small Generics bench to the Put benchmark suite. >--------------------------------------------------------------- fb41919966edc56a6c7052563f48c435a13d8413 benchmarks/Put.hs | 40 ++++++++++++++++++++++++++++++++++++++++ binary.cabal | 6 ++++++ 2 files changed, 46 insertions(+) diff --git a/benchmarks/Put.hs b/benchmarks/Put.hs index 6f317c0..c713a0e 100644 --- a/benchmarks/Put.hs +++ b/benchmarks/Put.hs @@ -1,4 +1,7 @@ {-# LANGUAGE CPP, ExistentialQuantification #-} +#ifdef GENERICS +{-# LANGUAGE DeriveGeneric #-} +#endif module Main (main) where @@ -9,6 +12,10 @@ import qualified Data.ByteString as S import qualified Data.ByteString.Char8 as C import qualified Data.ByteString.Lazy as L +#ifdef GENERICS +import GHC.Generics +#endif + import Data.Binary import Data.Binary.Put import Data.ByteString.Builder as BB @@ -48,10 +55,33 @@ main = do bench "Word64s" $ whnf (run . fromWord64s) word64s, bench "Word64s builder" $ whnf (L.length . toLazyByteString . fromWord64sBuilder) word64s, bench "[Word64]" $ whnf (run . put) word64s + +#ifdef GENERICS + , bgroup "Generics" [ + bench "Struct monoid put" $ whnf (run . fromStructs) structs, + bench "Struct put as list" $ whnf (run . put) structs, + bench "StructList monoid put" $ whnf (run . fromStructLists) structLists, + bench "StructList put as list" $ whnf (run . put) structLists + ] +#endif ] where run = L.length . runPut +#ifdef GENERICS +data Struct = Struct Word8 Word16 Word32 Word64 deriving Generic +instance Binary Struct + +data StructList = StructList [Struct] deriving Generic +instance Binary StructList + +structs :: [Struct] +structs = take 10000 $ [ Struct a b 0 0 | a <- [0 .. maxBound], b <- [0 .. maxBound] ] + +structLists :: [StructList] +structLists = replicate 1000 (StructList (take 10 structs)) +#endif + -- Input data smallIntegers :: [Integer] @@ -135,3 +165,13 @@ fromWord64s (x:xs) = put x >> fromWord64s xs fromWord64sBuilder :: [Word64] -> BB.Builder fromWord64sBuilder [] = mempty fromWord64sBuilder (x:xs) = BB.word64BE x `mappend` fromWord64sBuilder xs + +#ifdef GENERICS +fromStructs :: [Struct] -> Put +fromStructs [] = return () +fromStructs (x:xs) = put x >> fromStructs xs + +fromStructLists :: [StructList] -> Put +fromStructLists [] = return () +fromStructLists (x:xs) = put x >> fromStructLists xs +#endif diff --git a/binary.cabal b/binary.cabal index f9a9aef..76428bf 100644 --- a/binary.cabal +++ b/binary.cabal @@ -136,6 +136,12 @@ benchmark put -- build dependencies from using binary source rather than depending on the library build-depends: array, containers ghc-options: -O2 -Wall + if impl(ghc >= 7.2.1) + cpp-options: -DGENERICS + other-modules: Data.Binary.Generic + if impl(ghc <= 7.6) + -- prior to ghc-7.4 generics lived in ghc-prim + build-depends: ghc-prim benchmark generics-bench type: exitcode-stdio-1.0 From git at git.haskell.org Tue Apr 19 20:30:22 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:22 +0000 (UTC) Subject: [commit: packages/binary] master: Add 'putList' for all IntXX and WordXX. (c287643) Message-ID: <20160419203022.1B5683A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/c2876434df5e749a25ab7543410d8f1dcf86fd92 >--------------------------------------------------------------- commit c2876434df5e749a25ab7543410d8f1dcf86fd92 Author: Lennart Kolmodin Date: Thu Apr 7 21:27:38 2016 +0200 Add 'putList' for all IntXX and WordXX. >--------------------------------------------------------------- c2876434df5e749a25ab7543410d8f1dcf86fd92 src/Data/Binary/Class.hs | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/Data/Binary/Class.hs b/src/Data/Binary/Class.hs index 36fc681..493dee4 100644 --- a/src/Data/Binary/Class.hs +++ b/src/Data/Binary/Class.hs @@ -210,6 +210,7 @@ instance Binary Ordering where -- Words8s are written as bytes instance Binary Word8 where put = putWord8 + {-# INLINE putList #-} putList xs = do put (length xs) putBuilder (Prim.primMapListFixed Prim.word8 xs) @@ -218,36 +219,64 @@ instance Binary Word8 where -- Words16s are written as 2 bytes in big-endian (network) order instance Binary Word16 where put = putWord16be + {-# INLINE putList #-} + putList xs = do + put (length xs) + putBuilder (Prim.primMapListFixed Prim.word16BE xs) get = getWord16be -- Words32s are written as 4 bytes in big-endian (network) order instance Binary Word32 where put = putWord32be + {-# INLINE putList #-} + putList xs = do + put (length xs) + putBuilder (Prim.primMapListFixed Prim.word32BE xs) get = getWord32be -- Words64s are written as 8 bytes in big-endian (network) order instance Binary Word64 where put = putWord64be + {-# INLINE putList #-} + putList xs = do + put (length xs) + putBuilder (Prim.primMapListFixed Prim.word64BE xs) get = getWord64be -- Int8s are written as a single byte. instance Binary Int8 where put = putInt8 + {-# INLINE putList #-} + putList xs = do + put (length xs) + putBuilder (Prim.primMapListFixed Prim.int8 xs) get = getInt8 -- Int16s are written as a 2 bytes in big endian format instance Binary Int16 where put = putInt16be + {-# INLINE putList #-} + putList xs = do + put (length xs) + putBuilder (Prim.primMapListFixed Prim.int16BE xs) get = getInt16be -- Int32s are written as a 4 bytes in big endian format instance Binary Int32 where put = putInt32be + {-# INLINE putList #-} + putList xs = do + put (length xs) + putBuilder (Prim.primMapListFixed Prim.int32BE xs) get = getInt32be -- Int64s are written as a 8 bytes in big endian format instance Binary Int64 where put = putInt64be + {-# INLINE putList #-} + putList xs = do + put (length xs) + putBuilder (Prim.primMapListFixed Prim.int64BE xs) get = getInt64be ------------------------------------------------------------------------ @@ -255,11 +284,19 @@ instance Binary Int64 where -- Words are are written as Word64s, that is, 8 bytes in big endian format instance Binary Word where put = putWord64be . fromIntegral + {-# INLINE putList #-} + putList xs = do + put (length xs) + putBuilder (Prim.primMapListFixed Prim.word64BE (map fromIntegral xs)) get = liftM fromIntegral getWord64be -- Ints are are written as Int64s, that is, 8 bytes in big endian format instance Binary Int where put = putInt64be . fromIntegral + {-# INLINE putList #-} + putList xs = do + put (length xs) + putBuilder (Prim.primMapListFixed Prim.int64BE (map fromIntegral xs)) get = liftM fromIntegral getInt64be ------------------------------------------------------------------------ @@ -279,6 +316,7 @@ instance Binary Integer where {-# INLINE put #-} put n | n >= lo && n <= hi = do + -- putBuilder (Prim.primFixed (Prim.word8 Prim.>*< Prim.int32BE) (0, fromIntegral n)) putWord8 0 put (fromIntegral n :: SmallInt) -- fast path where From git at git.haskell.org Tue Apr 19 20:30:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:23 +0000 (UTC) Subject: [commit: packages/binary] master: Silence warning. (bfa4123) Message-ID: <20160419203023.BE59B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/bfa4123b4940d5a51743f6d03f15058be952f72a >--------------------------------------------------------------- commit bfa4123b4940d5a51743f6d03f15058be952f72a Author: Lennart Kolmodin Date: Mon Apr 11 22:14:45 2016 +0200 Silence warning. >--------------------------------------------------------------- bfa4123b4940d5a51743f6d03f15058be952f72a benchmarks/Put.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/benchmarks/Put.hs b/benchmarks/Put.hs index c713a0e..52b5ca1 100644 --- a/benchmarks/Put.hs +++ b/benchmarks/Put.hs @@ -89,10 +89,10 @@ smallIntegers = [0..10000] {-# NOINLINE smallIntegers #-} bigIntegers :: [Integer] -bigIntegers = [max .. max + 10000] +bigIntegers = [m .. m + 10000] where - max :: Integer - max = fromIntegral (maxBound :: Word64) + m :: Integer + m = fromIntegral (maxBound :: Word64) {-# NOINLINE bigIntegers #-} smallByteStrings :: [S.ByteString] From git at git.haskell.org Tue Apr 19 20:30:24 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:24 +0000 (UTC) Subject: [commit: packages/binary] master: When QCing the Binary class, also test a list of values. (23adb9b) Message-ID: <20160419203024.230D63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/23adb9bcaf62e840e6c4cbfac12844ad0ac0e00b >--------------------------------------------------------------- commit 23adb9bcaf62e840e6c4cbfac12844ad0ac0e00b Author: Lennart Kolmodin Date: Thu Apr 7 21:34:58 2016 +0200 When QCing the Binary class, also test a list of values. Now that we have 'putList' in Binary we must take care that we test reading/writing with lists too. This patch makes sure that we always test reading/writing list values when we test single values. >--------------------------------------------------------------- 23adb9bcaf62e840e6c4cbfac12844ad0ac0e00b tests/QC.hs | 136 +++++++++++++++++++++++++++++------------------------------- 1 file changed, 66 insertions(+), 70 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 23adb9bcaf62e840e6c4cbfac12844ad0ac0e00b From git at git.haskell.org Tue Apr 19 20:30:25 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:25 +0000 (UTC) Subject: [commit: packages/binary] master: Fix compilation error for GHC < 7.10. (f040b5d) Message-ID: <20160419203025.C37803A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/f040b5d91e095b4d4772b8fc2a9ba4798ac5bd23 >--------------------------------------------------------------- commit f040b5d91e095b4d4772b8fc2a9ba4798ac5bd23 Author: Lennart Kolmodin Date: Tue Apr 12 22:03:34 2016 +0200 Fix compilation error for GHC < 7.10. >--------------------------------------------------------------- f040b5d91e095b4d4772b8fc2a9ba4798ac5bd23 benchmarks/Put.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/benchmarks/Put.hs b/benchmarks/Put.hs index 52b5ca1..12b7dbf 100644 --- a/benchmarks/Put.hs +++ b/benchmarks/Put.hs @@ -11,6 +11,7 @@ import Criterion.Main import qualified Data.ByteString as S import qualified Data.ByteString.Char8 as C import qualified Data.ByteString.Lazy as L +import Data.Monoid #ifdef GENERICS import GHC.Generics @@ -19,6 +20,7 @@ import GHC.Generics import Data.Binary import Data.Binary.Put import Data.ByteString.Builder as BB +import Prelude -- Silence Monoid import warning. main :: IO () main = do From git at git.haskell.org Tue Apr 19 20:30:26 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:26 +0000 (UTC) Subject: [commit: packages/binary] master: Test list of values for Natural and GHC.Fingerprint. (8e28858) Message-ID: <20160419203026.295F83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/8e2885862c2c60282b50d5d7dd7427d6980c2e7e >--------------------------------------------------------------- commit 8e2885862c2c60282b50d5d7dd7427d6980c2e7e Author: Lennart Kolmodin Date: Fri Apr 8 23:10:42 2016 +0200 Test list of values for Natural and GHC.Fingerprint. >--------------------------------------------------------------- 8e2885862c2c60282b50d5d7dd7427d6980c2e7e tests/QC.hs | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/tests/QC.hs b/tests/QC.hs index a3e069d..78dda8c 100644 --- a/tests/QC.hs +++ b/tests/QC.hs @@ -415,30 +415,24 @@ main = defaultMain tests ------------------------------------------------------------------------ #ifdef HAS_NATURAL -prop_test_Natural :: Property -prop_test_Natural = forAll (gen :: Gen Natural) test - where - gen :: Gen Natural - gen = do - b <- arbitrary - if b - then do - x <- arbitrarySizedNatural :: Gen Natural - -- arbitrarySizedNatural generates numbers smaller than - -- (maxBound :: Word64), so let's make them bigger to better test - -- the Binary instance. - return (x + fromIntegral (maxBound :: Word64)) - else arbitrarySizedNatural +genNatural :: Gen Natural +genNatural = do + b <- arbitrary + if b + then do + x <- arbitrarySizedNatural :: Gen Natural + -- arbitrarySizedNatural generates numbers smaller than + -- (maxBound :: Word64), so let's make them bigger to better test + -- the Binary instance. + return (x + fromIntegral (maxBound :: Word64)) + else arbitrarySizedNatural #endif ------------------------------------------------------------------------ #ifdef HAS_GHC_FINGERPRINT -prop_test_GHC_Fingerprint :: Property -prop_test_GHC_Fingerprint = forAll gen test - where - gen :: Gen Fingerprint - gen = liftM2 Fingerprint arbitrary arbitrary +genFingerprint :: Gen Fingerprint +genFingerprint = liftM2 Fingerprint arbitrary arbitrary #if !MIN_VERSION_base(4,7,0) instance Show Fingerprint where show (Fingerprint x1 x2) = show (x1,x2) @@ -487,6 +481,13 @@ test' desc prop propList = testProperty ("[" ++ desc ++ "]") propList ] +testWithGen :: (Show a, Eq a, Binary a) => String -> Gen a -> Test +testWithGen desc gen = + testGroup desc [ + testProperty desc (forAll gen test), + testProperty ("[" ++ desc ++ "]") (forAll (listOf gen) test) + ] + positiveList :: Gen [Int] positiveList = fmap (filter (/=0) . map abs) $ arbitrary @@ -570,10 +571,10 @@ tests = , test' "Integer" (test :: T Integer) test , test' "Fixed" (test :: T (Fixed.Fixed Fixed.E3) ) test #ifdef HAS_NATURAL - , testProperty "Natural" prop_test_Natural + , testWithGen "Natural" genNatural #endif #ifdef HAS_GHC_FINGERPRINT - , testProperty "GHC.Fingerprint" prop_test_GHC_Fingerprint + , testWithGen "GHC.Fingerprint" genFingerprint #endif , test' "Float" (test :: T Float ) test From git at git.haskell.org Tue Apr 19 20:30:27 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:27 +0000 (UTC) Subject: [commit: packages/binary] master: Update changelog for version 0.9.0.0. (bc88778) Message-ID: <20160419203027.CA3CC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/bc88778959f0608ae7e848227e45e836e0cdec85 >--------------------------------------------------------------- commit bc88778959f0608ae7e848227e45e836e0cdec85 Author: Lennart Kolmodin Date: Wed Apr 13 20:31:26 2016 +0200 Update changelog for version 0.9.0.0. >--------------------------------------------------------------- bc88778959f0608ae7e848227e45e836e0cdec85 changelog.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/changelog.md b/changelog.md index 2a4debd..75514af 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,20 @@ binary ====== +binary-0.9.0.0 +-------------- + +- Replace binary's home grown `Builder` with `Data.ByteString.Builder`. + `Data.Binary.Builder` now exports `Data.ByteString.Builder.Builder`. +- Add `putList :: [a] -> Put` to the `Binary` class. This is used to be able to + use the list writing primitives of the new Builder. This brought a number of speedups; + Encoding a String is now 70% faster. [Word8] is 76% faster, which also makes + Integer 34% faster. Similar numbers for all [IntXX] and [WordXX]. +- Fail gracefully within `Get` when decoding `Bool` and `Ordering`. Previously + when decoding invalid data these instances would fail with `error`. +- Add Binary instance for `Complex a`. +- Add Monoid instance for `Put`. + binary-0.8.2.1 -------------- From git at git.haskell.org Tue Apr 19 20:30:28 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:28 +0000 (UTC) Subject: [commit: packages/binary] master: Add Monoid instance for Put (bec884f) Message-ID: <20160419203028.2F1993A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/bec884f96cfbd40d4842c20ef4688df9ef4f16f2 >--------------------------------------------------------------- commit bec884f96cfbd40d4842c20ef4688df9ef4f16f2 Author: Jacob Stanley Date: Sat Apr 9 16:45:56 2016 +1000 Add Monoid instance for Put >--------------------------------------------------------------- bec884f96cfbd40d4842c20ef4688df9ef4f16f2 src/Data/Binary/Put.hs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Data/Binary/Put.hs b/src/Data/Binary/Put.hs index 85ef569..07a86c0 100644 --- a/src/Data/Binary/Put.hs +++ b/src/Data/Binary/Put.hs @@ -1,4 +1,5 @@ {-# LANGUAGE CPP #-} +{-# LANGUAGE FlexibleInstances #-} #if __GLASGOW_HASKELL__ >= 701 && __GLASGOW_HASKELL__ != 702 {-# LANGUAGE Safe #-} #endif @@ -134,6 +135,13 @@ instance Monad PutM where (>>) = (*>) {-# INLINE (>>) #-} +instance Monoid (PutM ()) where + mempty = pure () + {-# INLINE mempty #-} + + mappend = (>>) + {-# INLINE mappend #-} + tell :: Builder -> Put tell b = Put $ PairS () b {-# INLINE tell #-} From git at git.haskell.org Tue Apr 19 20:30:29 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:29 +0000 (UTC) Subject: [commit: packages/binary] master: Remove ghc 7.4.2 from travis CI. (105bc07) Message-ID: <20160419203029.CEF393A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/105bc0782bb65354bc1da1a30941ef43885c9d0f >--------------------------------------------------------------- commit 105bc0782bb65354bc1da1a30941ef43885c9d0f Author: Lennart Kolmodin Date: Fri Apr 15 22:24:13 2016 +0200 Remove ghc 7.4.2 from travis CI. It's been failing on travis for 3 months due to failing dependencies. >--------------------------------------------------------------- 105bc0782bb65354bc1da1a30941ef43885c9d0f .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index cf16df1..7f6fd4f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,8 +6,6 @@ sudo: false matrix: include: - - env: CABALVER=1.18 GHCVER=7.4.2 - addons: {apt: {packages: [cabal-install-1.18,ghc-7.4.2], sources: [hvr-ghc]}} - env: CABALVER=1.18 GHCVER=7.6.3 addons: {apt: {packages: [cabal-install-1.18,ghc-7.6.3], sources: [hvr-ghc]}} - env: CABALVER=1.18 GHCVER=7.8.4 From git at git.haskell.org Tue Apr 19 20:30:30 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:30 +0000 (UTC) Subject: [commit: packages/binary] master: Merge pull request #112 from jystic/topic/put-monoid (e74d243) Message-ID: <20160419203030.347273A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/e74d2432941831ef4fd1155754239fd6573a4f8e >--------------------------------------------------------------- commit e74d2432941831ef4fd1155754239fd6573a4f8e Merge: 8e28858 bec884f Author: Lennart Kolmodin Date: Sat Apr 9 10:41:19 2016 +0200 Merge pull request #112 from jystic/topic/put-monoid Add Monoid instance for Put >--------------------------------------------------------------- e74d2432941831ef4fd1155754239fd6573a4f8e src/Data/Binary/Put.hs | 8 ++++++++ 1 file changed, 8 insertions(+) From git at git.haskell.org Tue Apr 19 20:30:31 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:31 +0000 (UTC) Subject: [commit: packages/binary] master: Use ghc 7.10.3 on travis CI instead of ghc 7.10.2. (b005bcf) Message-ID: <20160419203031.D535A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/b005bcfce106d684199a009fae8f3c0d38032deb >--------------------------------------------------------------- commit b005bcfce106d684199a009fae8f3c0d38032deb Author: Lennart Kolmodin Date: Fri Apr 15 22:27:07 2016 +0200 Use ghc 7.10.3 on travis CI instead of ghc 7.10.2. >--------------------------------------------------------------- b005bcfce106d684199a009fae8f3c0d38032deb .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7f6fd4f..d3483af 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,8 +10,8 @@ matrix: addons: {apt: {packages: [cabal-install-1.18,ghc-7.6.3], sources: [hvr-ghc]}} - env: CABALVER=1.18 GHCVER=7.8.4 addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4], sources: [hvr-ghc]}} - - env: CABALVER=1.22 GHCVER=7.10.2 - addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.2], sources: [hvr-ghc]}} + - env: CABALVER=1.22 GHCVER=7.10.3 + addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3], sources: [hvr-ghc]}} - env: CABALVER=head GHCVER=head addons: {apt: {packages: [cabal-install-head,ghc-head], sources: [hvr-ghc]}} From git at git.haskell.org Tue Apr 19 20:30:32 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:32 +0000 (UTC) Subject: [commit: packages/binary] master: Compare Put with Data.ByteString.Builder in put benchmark. (31d91b4) Message-ID: <20160419203032.3A4303A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/31d91b407bf3fa554a502981df88b31dafa98184 >--------------------------------------------------------------- commit 31d91b407bf3fa554a502981df88b31dafa98184 Author: Lennart Kolmodin Date: Sat Apr 9 13:41:57 2016 +0200 Compare Put with Data.ByteString.Builder in put benchmark. >--------------------------------------------------------------- 31d91b407bf3fa554a502981df88b31dafa98184 benchmarks/Put.hs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/benchmarks/Put.hs b/benchmarks/Put.hs index c3cae43..6f317c0 100644 --- a/benchmarks/Put.hs +++ b/benchmarks/Put.hs @@ -11,6 +11,7 @@ import qualified Data.ByteString.Lazy as L import Data.Binary import Data.Binary.Put +import Data.ByteString.Builder as BB main :: IO () main = do @@ -36,12 +37,16 @@ main = do bench "[small String]" $ whnf (run . put) smallStrings, bench "Word8s" $ whnf (run . fromWord8s) word8s, + bench "Word8s builder" $ whnf (L.length . toLazyByteString . fromWord8sBuilder) word8s, bench "[Word8]" $ whnf (run . put) word8s, bench "Word16s" $ whnf (run . fromWord16s) word16s, + bench "Word16s builder" $ whnf (L.length . toLazyByteString . fromWord16sBuilder) word16s, bench "[Word16]" $ whnf (run . put) word16s, bench "Word32s" $ whnf (run . fromWord32s) word32s, + bench "Word32s builder" $ whnf (L.length . toLazyByteString . fromWord32sBuilder) word32s, bench "[Word32]" $ whnf (run . put) word32s, bench "Word64s" $ whnf (run . fromWord64s) word64s, + bench "Word64s builder" $ whnf (L.length . toLazyByteString . fromWord64sBuilder) word64s, bench "[Word64]" $ whnf (run . put) word64s ] where @@ -103,15 +108,30 @@ fromWord8s :: [Word8] -> Put fromWord8s [] = return () fromWord8s (x:xs) = put x >> fromWord8s xs +fromWord8sBuilder :: [Word8] -> BB.Builder +fromWord8sBuilder [] = mempty +fromWord8sBuilder (x:xs) = BB.word8 x `mappend` fromWord8sBuilder xs + fromWord16s :: [Word16] -> Put fromWord16s [] = return () fromWord16s (x:xs) = put x >> fromWord16s xs +fromWord16sBuilder :: [Word16] -> BB.Builder +fromWord16sBuilder [] = mempty +fromWord16sBuilder (x:xs) = BB.word16BE x `mappend` fromWord16sBuilder xs + fromWord32s :: [Word32] -> Put fromWord32s [] = return () fromWord32s (x:xs) = put x >> fromWord32s xs +fromWord32sBuilder :: [Word32] -> BB.Builder +fromWord32sBuilder [] = mempty +fromWord32sBuilder (x:xs) = BB.word32BE x `mappend` fromWord32sBuilder xs + fromWord64s :: [Word64] -> Put fromWord64s [] = return () fromWord64s (x:xs) = put x >> fromWord64s xs +fromWord64sBuilder :: [Word64] -> BB.Builder +fromWord64sBuilder [] = mempty +fromWord64sBuilder (x:xs) = BB.word64BE x `mappend` fromWord64sBuilder xs From git at git.haskell.org Tue Apr 19 20:30:33 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:33 +0000 (UTC) Subject: [commit: packages/binary] master: Rewrite mappend to only depend on the Builders. (6ca5897) Message-ID: <20160419203033.DB1BA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/6ca5897ce22b6bf9cf9b4a0e8ce72994928d413f >--------------------------------------------------------------- commit 6ca5897ce22b6bf9cf9b4a0e8ce72994928d413f Author: Lennart Kolmodin Date: Sat Apr 16 10:04:47 2016 +0200 Rewrite mappend to only depend on the Builders. This gives a 5% speedup in the generics-bench benchmark. >--------------------------------------------------------------- 6ca5897ce22b6bf9cf9b4a0e8ce72994928d413f src/Data/Binary/Generic.hs | 9 +++++---- src/Data/Binary/Put.hs | 5 ++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Data/Binary/Generic.hs b/src/Data/Binary/Generic.hs index 9967f95..bcf8e46 100644 --- a/src/Data/Binary/Generic.hs +++ b/src/Data/Binary/Generic.hs @@ -28,26 +28,27 @@ import Data.Binary.Get import Data.Binary.Put import Data.Bits import Data.Word +import Data.Monoid ((<>)) import GHC.Generics import Prelude -- Silence AMP warning. -- Type without constructors instance GBinaryPut V1 where - gput _ = return () + gput _ = pure () instance GBinaryGet V1 where gget = return undefined -- Constructor without arguments instance GBinaryPut U1 where - gput U1 = return () + gput U1 = pure () instance GBinaryGet U1 where gget = return U1 -- Product: constructor with parameters instance (GBinaryPut a, GBinaryPut b) => GBinaryPut (a :*: b) where - gput (x :*: y) = gput x >> gput y + gput (x :*: y) = gput x <> gput y instance (GBinaryGet a, GBinaryGet b) => GBinaryGet (a :*: b) where gget = (:*:) <$> gget <*> gget @@ -130,7 +131,7 @@ instance GBinaryGet a => GSumGet (C1 c a) where getSum _ _ = gget instance GBinaryPut a => GSumPut (C1 c a) where - putSum !code _ x = put code *> gput x + putSum !code _ x = put code <> gput x ------------------------------------------------------------------------ diff --git a/src/Data/Binary/Put.hs b/src/Data/Binary/Put.hs index 07a86c0..23db39f 100644 --- a/src/Data/Binary/Put.hs +++ b/src/Data/Binary/Put.hs @@ -139,7 +139,10 @@ instance Monoid (PutM ()) where mempty = pure () {-# INLINE mempty #-} - mappend = (>>) + mappend m k = Put $ + let PairS _ w = unPut m + PairS _ w' = unPut k + in PairS () (w `mappend` w') {-# INLINE mappend #-} tell :: Builder -> Put From git at git.haskell.org Tue Apr 19 20:30:34 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:34 +0000 (UTC) Subject: [commit: packages/binary] master: Explicitly test small and big Integers and Naturals. (b768640) Message-ID: <20160419203034.404323A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/b768640e0034211ef9b079e998297aef4a1b1ae0 >--------------------------------------------------------------- commit b768640e0034211ef9b079e998297aef4a1b1ae0 Author: Lennart Kolmodin Date: Sun Apr 10 12:14:55 2016 +0200 Explicitly test small and big Integers and Naturals. >--------------------------------------------------------------- b768640e0034211ef9b079e998297aef4a1b1ae0 tests/QC.hs | 45 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/tests/QC.hs b/tests/QC.hs index 78dda8c..eeb04da 100644 --- a/tests/QC.hs +++ b/tests/QC.hs @@ -414,18 +414,38 @@ main = defaultMain tests ------------------------------------------------------------------------ +genInteger :: Gen Integer +genInteger = do + b <- arbitrary + if b then genIntegerSmall else genIntegerSmall + +genIntegerSmall :: Gen Integer +genIntegerSmall = arbitrary + +genIntegerBig :: Gen Integer +genIntegerBig = do + x <- arbitrarySizedIntegral :: Gen Integer + -- arbitrarySizedIntegral generates numbers smaller than + -- (maxBound :: Word32), so let's make them bigger to better test + -- the Binary instance. + return (x + fromIntegral (maxBound :: Word32)) + #ifdef HAS_NATURAL genNatural :: Gen Natural genNatural = do b <- arbitrary - if b - then do - x <- arbitrarySizedNatural :: Gen Natural - -- arbitrarySizedNatural generates numbers smaller than - -- (maxBound :: Word64), so let's make them bigger to better test - -- the Binary instance. - return (x + fromIntegral (maxBound :: Word64)) - else arbitrarySizedNatural + if b then genNaturalSmall else genNaturalBig + +genNaturalSmall :: Gen Natural +genNaturalSmall = arbitrarySizedNatural + +genNaturalBig :: Gen Natural +genNaturalBig = do + x <- arbitrarySizedNatural :: Gen Natural + -- arbitrarySizedNatural generates numbers smaller than + -- (maxBound :: Word64), so let's make them bigger to better test + -- the Binary instance. + return (x + fromIntegral (maxBound :: Word64)) #endif ------------------------------------------------------------------------ @@ -568,10 +588,15 @@ tests = , test' "Int32" (test :: T Int32) test , test' "Int64" (test :: T Int64) test - , test' "Integer" (test :: T Integer) test + , testWithGen "Integer mixed" genInteger + , testWithGen "Integer small" genIntegerSmall + , testWithGen "Integer big" genIntegerBig + , test' "Fixed" (test :: T (Fixed.Fixed Fixed.E3) ) test #ifdef HAS_NATURAL - , testWithGen "Natural" genNatural + , testWithGen "Natural mixed" genNatural + , testWithGen "Natural small" genNaturalSmall + , testWithGen "Natural big" genNaturalBig #endif #ifdef HAS_GHC_FINGERPRINT , testWithGen "GHC.Fingerprint" genFingerprint From git at git.haskell.org Tue Apr 19 20:30:35 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:35 +0000 (UTC) Subject: [commit: packages/binary] master: Implement put in Binary instances only using monoid. (a3f369e) Message-ID: <20160419203035.E2C113A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/a3f369e55e9ea1404ca2f7b69a15cff92c5b3978 >--------------------------------------------------------------- commit a3f369e55e9ea1404ca2f7b69a15cff92c5b3978 Author: Lennart Kolmodin Date: Sat Apr 16 12:17:56 2016 +0200 Implement put in Binary instances only using monoid. >--------------------------------------------------------------- a3f369e55e9ea1404ca2f7b69a15cff92c5b3978 src/Data/Binary/Class.hs | 126 +++++++++++++++++++++++------------------------ 1 file changed, 62 insertions(+), 64 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc a3f369e55e9ea1404ca2f7b69a15cff92c5b3978 From git at git.haskell.org Tue Apr 19 20:30:37 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:37 +0000 (UTC) Subject: [commit: packages/binary] master: Use monoid in Put benchmark. (1ecfd22) Message-ID: <20160419203037.E9B733A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/1ecfd2272e96ca58a4f7f672b5ff3a7ee9f0ccb0 >--------------------------------------------------------------- commit 1ecfd2272e96ca58a4f7f672b5ff3a7ee9f0ccb0 Author: Lennart Kolmodin Date: Sat Apr 16 12:41:05 2016 +0200 Use monoid in Put benchmark. >--------------------------------------------------------------- 1ecfd2272e96ca58a4f7f672b5ff3a7ee9f0ccb0 benchmarks/Put.hs | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/benchmarks/Put.hs b/benchmarks/Put.hs index 12b7dbf..3d482eb 100644 --- a/benchmarks/Put.hs +++ b/benchmarks/Put.hs @@ -45,16 +45,16 @@ main = do bench "small Strings" $ whnf (run . fromStrings) smallStrings, bench "[small String]" $ whnf (run . put) smallStrings, - bench "Word8s" $ whnf (run . fromWord8s) word8s, + bench "Word8s monoid put" $ whnf (run . fromWord8s) word8s, bench "Word8s builder" $ whnf (L.length . toLazyByteString . fromWord8sBuilder) word8s, bench "[Word8]" $ whnf (run . put) word8s, - bench "Word16s" $ whnf (run . fromWord16s) word16s, + bench "Word16s monoid put" $ whnf (run . fromWord16s) word16s, bench "Word16s builder" $ whnf (L.length . toLazyByteString . fromWord16sBuilder) word16s, bench "[Word16]" $ whnf (run . put) word16s, - bench "Word32s" $ whnf (run . fromWord32s) word32s, + bench "Word32s monoid put" $ whnf (run . fromWord32s) word32s, bench "Word32s builder" $ whnf (L.length . toLazyByteString . fromWord32sBuilder) word32s, bench "[Word32]" $ whnf (run . put) word32s, - bench "Word64s" $ whnf (run . fromWord64s) word64s, + bench "Word64s monoid put" $ whnf (run . fromWord64s) word64s, bench "Word64s builder" $ whnf (L.length . toLazyByteString . fromWord64sBuilder) word64s, bench "[Word64]" $ whnf (run . put) word64s @@ -125,44 +125,44 @@ word64s = take 10000 $ cycle [minBound .. maxBound] -- Benchmarks fromIntegers :: [Integer] -> Put -fromIntegers [] = return () -fromIntegers (x:xs) = put x >> fromIntegers xs +fromIntegers [] = mempty +fromIntegers (x:xs) = put x `mappend` fromIntegers xs fromByteStrings :: [S.ByteString] -> Put -fromByteStrings [] = return () -fromByteStrings (x:xs) = put x >> fromByteStrings xs +fromByteStrings [] = mempty +fromByteStrings (x:xs) = put x `mappend` fromByteStrings xs fromStrings :: [String] -> Put -fromStrings [] = return () -fromStrings (x:xs) = put x >> fromStrings xs +fromStrings [] = mempty +fromStrings (x:xs) = put x `mappend` fromStrings xs fromWord8s :: [Word8] -> Put -fromWord8s [] = return () -fromWord8s (x:xs) = put x >> fromWord8s xs +fromWord8s [] = mempty +fromWord8s (x:xs) = put x `mappend` fromWord8s xs fromWord8sBuilder :: [Word8] -> BB.Builder fromWord8sBuilder [] = mempty fromWord8sBuilder (x:xs) = BB.word8 x `mappend` fromWord8sBuilder xs fromWord16s :: [Word16] -> Put -fromWord16s [] = return () -fromWord16s (x:xs) = put x >> fromWord16s xs +fromWord16s [] = mempty +fromWord16s (x:xs) = put x `mappend` fromWord16s xs fromWord16sBuilder :: [Word16] -> BB.Builder fromWord16sBuilder [] = mempty fromWord16sBuilder (x:xs) = BB.word16BE x `mappend` fromWord16sBuilder xs fromWord32s :: [Word32] -> Put -fromWord32s [] = return () -fromWord32s (x:xs) = put x >> fromWord32s xs +fromWord32s [] = mempty +fromWord32s (x:xs) = put x `mappend` fromWord32s xs fromWord32sBuilder :: [Word32] -> BB.Builder fromWord32sBuilder [] = mempty fromWord32sBuilder (x:xs) = BB.word32BE x `mappend` fromWord32sBuilder xs fromWord64s :: [Word64] -> Put -fromWord64s [] = return () -fromWord64s (x:xs) = put x >> fromWord64s xs +fromWord64s [] = mempty +fromWord64s (x:xs) = put x `mappend` fromWord64s xs fromWord64sBuilder :: [Word64] -> BB.Builder fromWord64sBuilder [] = mempty @@ -170,10 +170,10 @@ fromWord64sBuilder (x:xs) = BB.word64BE x `mappend` fromWord64sBuilder xs #ifdef GENERICS fromStructs :: [Struct] -> Put -fromStructs [] = return () -fromStructs (x:xs) = put x >> fromStructs xs +fromStructs [] = mempty +fromStructs (x:xs) = put x `mappend` fromStructs xs fromStructLists :: [StructList] -> Put -fromStructLists [] = return () -fromStructLists (x:xs) = put x >> fromStructLists xs +fromStructLists [] = mempty +fromStructLists (x:xs) = put x `mappend` fromStructLists xs #endif From git at git.haskell.org Tue Apr 19 20:30:38 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:38 +0000 (UTC) Subject: [commit: packages/binary] master: Silence warning. (bfa4123) Message-ID: <20160419203038.4C8093A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/bfa4123b4940d5a51743f6d03f15058be952f72a >--------------------------------------------------------------- commit bfa4123b4940d5a51743f6d03f15058be952f72a Author: Lennart Kolmodin Date: Mon Apr 11 22:14:45 2016 +0200 Silence warning. >--------------------------------------------------------------- bfa4123b4940d5a51743f6d03f15058be952f72a benchmarks/Put.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/benchmarks/Put.hs b/benchmarks/Put.hs index c713a0e..52b5ca1 100644 --- a/benchmarks/Put.hs +++ b/benchmarks/Put.hs @@ -89,10 +89,10 @@ smallIntegers = [0..10000] {-# NOINLINE smallIntegers #-} bigIntegers :: [Integer] -bigIntegers = [max .. max + 10000] +bigIntegers = [m .. m + 10000] where - max :: Integer - max = fromIntegral (maxBound :: Word64) + m :: Integer + m = fromIntegral (maxBound :: Word64) {-# NOINLINE bigIntegers #-} smallByteStrings :: [S.ByteString] From git at git.haskell.org Tue Apr 19 20:30:39 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:39 +0000 (UTC) Subject: [commit: packages/binary] master: Add Double to Put benchmark. (69d6ebf) Message-ID: <20160419203039.F02A33A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/69d6ebf0ead131fad0f22d441c0eac4989e45b84 >--------------------------------------------------------------- commit 69d6ebf0ead131fad0f22d441c0eac4989e45b84 Author: Lennart Kolmodin Date: Sat Apr 16 23:44:53 2016 +0200 Add Double to Put benchmark. >--------------------------------------------------------------- 69d6ebf0ead131fad0f22d441c0eac4989e45b84 benchmarks/Put.hs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/benchmarks/Put.hs b/benchmarks/Put.hs index 3d482eb..55ee5bd 100644 --- a/benchmarks/Put.hs +++ b/benchmarks/Put.hs @@ -29,7 +29,11 @@ main = do , rnf smallIntegers , rnf smallByteStrings , rnf smallStrings + , rnf doubles , rnf word8s + , rnf word16s + , rnf word32s + , rnf word64s ] defaultMain [ @@ -45,6 +49,8 @@ main = do bench "small Strings" $ whnf (run . fromStrings) smallStrings, bench "[small String]" $ whnf (run . put) smallStrings, + bench "Double" $ whnf (run . put) doubles, + bench "Word8s monoid put" $ whnf (run . fromWord8s) word8s, bench "Word8s builder" $ whnf (L.length . toLazyByteString . fromWord8sBuilder) word8s, bench "[Word8]" $ whnf (run . put) word8s, @@ -105,6 +111,9 @@ smallStrings :: [String] smallStrings = replicate 10000 "abcdefghi" {-# NOINLINE smallStrings #-} +doubles :: [Double] +doubles = take 10000 $ [ sign * 2 ** n | sign <- [-1, 1], n <- [ 0, 0.2 .. 1023 ]] + word8s :: [Word8] word8s = take 10000 $ cycle [minBound .. maxBound] {-# NOINLINE word8s #-} From git at git.haskell.org Tue Apr 19 20:30:40 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:40 +0000 (UTC) Subject: [commit: packages/binary] master: Fix compilation error for GHC < 7.10. (f040b5d) Message-ID: <20160419203040.52DA83A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/f040b5d91e095b4d4772b8fc2a9ba4798ac5bd23 >--------------------------------------------------------------- commit f040b5d91e095b4d4772b8fc2a9ba4798ac5bd23 Author: Lennart Kolmodin Date: Tue Apr 12 22:03:34 2016 +0200 Fix compilation error for GHC < 7.10. >--------------------------------------------------------------- f040b5d91e095b4d4772b8fc2a9ba4798ac5bd23 benchmarks/Put.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/benchmarks/Put.hs b/benchmarks/Put.hs index 52b5ca1..12b7dbf 100644 --- a/benchmarks/Put.hs +++ b/benchmarks/Put.hs @@ -11,6 +11,7 @@ import Criterion.Main import qualified Data.ByteString as S import qualified Data.ByteString.Char8 as C import qualified Data.ByteString.Lazy as L +import Data.Monoid #ifdef GENERICS import GHC.Generics @@ -19,6 +20,7 @@ import GHC.Generics import Data.Binary import Data.Binary.Put import Data.ByteString.Builder as BB +import Prelude -- Silence Monoid import warning. main :: IO () main = do From git at git.haskell.org Tue Apr 19 20:30:36 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:36 +0000 (UTC) Subject: [commit: packages/binary] master: Add small Generics bench to the Put benchmark suite. (fb41919) Message-ID: <20160419203036.46D543A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/fb41919966edc56a6c7052563f48c435a13d8413 >--------------------------------------------------------------- commit fb41919966edc56a6c7052563f48c435a13d8413 Author: Lennart Kolmodin Date: Mon Apr 11 22:03:58 2016 +0200 Add small Generics bench to the Put benchmark suite. >--------------------------------------------------------------- fb41919966edc56a6c7052563f48c435a13d8413 benchmarks/Put.hs | 40 ++++++++++++++++++++++++++++++++++++++++ binary.cabal | 6 ++++++ 2 files changed, 46 insertions(+) diff --git a/benchmarks/Put.hs b/benchmarks/Put.hs index 6f317c0..c713a0e 100644 --- a/benchmarks/Put.hs +++ b/benchmarks/Put.hs @@ -1,4 +1,7 @@ {-# LANGUAGE CPP, ExistentialQuantification #-} +#ifdef GENERICS +{-# LANGUAGE DeriveGeneric #-} +#endif module Main (main) where @@ -9,6 +12,10 @@ import qualified Data.ByteString as S import qualified Data.ByteString.Char8 as C import qualified Data.ByteString.Lazy as L +#ifdef GENERICS +import GHC.Generics +#endif + import Data.Binary import Data.Binary.Put import Data.ByteString.Builder as BB @@ -48,10 +55,33 @@ main = do bench "Word64s" $ whnf (run . fromWord64s) word64s, bench "Word64s builder" $ whnf (L.length . toLazyByteString . fromWord64sBuilder) word64s, bench "[Word64]" $ whnf (run . put) word64s + +#ifdef GENERICS + , bgroup "Generics" [ + bench "Struct monoid put" $ whnf (run . fromStructs) structs, + bench "Struct put as list" $ whnf (run . put) structs, + bench "StructList monoid put" $ whnf (run . fromStructLists) structLists, + bench "StructList put as list" $ whnf (run . put) structLists + ] +#endif ] where run = L.length . runPut +#ifdef GENERICS +data Struct = Struct Word8 Word16 Word32 Word64 deriving Generic +instance Binary Struct + +data StructList = StructList [Struct] deriving Generic +instance Binary StructList + +structs :: [Struct] +structs = take 10000 $ [ Struct a b 0 0 | a <- [0 .. maxBound], b <- [0 .. maxBound] ] + +structLists :: [StructList] +structLists = replicate 1000 (StructList (take 10 structs)) +#endif + -- Input data smallIntegers :: [Integer] @@ -135,3 +165,13 @@ fromWord64s (x:xs) = put x >> fromWord64s xs fromWord64sBuilder :: [Word64] -> BB.Builder fromWord64sBuilder [] = mempty fromWord64sBuilder (x:xs) = BB.word64BE x `mappend` fromWord64sBuilder xs + +#ifdef GENERICS +fromStructs :: [Struct] -> Put +fromStructs [] = return () +fromStructs (x:xs) = put x >> fromStructs xs + +fromStructLists :: [StructList] -> Put +fromStructLists [] = return () +fromStructLists (x:xs) = put x >> fromStructLists xs +#endif diff --git a/binary.cabal b/binary.cabal index f9a9aef..76428bf 100644 --- a/binary.cabal +++ b/binary.cabal @@ -136,6 +136,12 @@ benchmark put -- build dependencies from using binary source rather than depending on the library build-depends: array, containers ghc-options: -O2 -Wall + if impl(ghc >= 7.2.1) + cpp-options: -DGENERICS + other-modules: Data.Binary.Generic + if impl(ghc <= 7.6) + -- prior to ghc-7.4 generics lived in ghc-prim + build-depends: ghc-prim benchmark generics-bench type: exitcode-stdio-1.0 From git at git.haskell.org Tue Apr 19 20:30:42 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:42 +0000 (UTC) Subject: [commit: packages/binary] master: Update changelog for version 0.9.0.0. (bc88778) Message-ID: <20160419203042.57FBF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/bc88778959f0608ae7e848227e45e836e0cdec85 >--------------------------------------------------------------- commit bc88778959f0608ae7e848227e45e836e0cdec85 Author: Lennart Kolmodin Date: Wed Apr 13 20:31:26 2016 +0200 Update changelog for version 0.9.0.0. >--------------------------------------------------------------- bc88778959f0608ae7e848227e45e836e0cdec85 changelog.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/changelog.md b/changelog.md index 2a4debd..75514af 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,20 @@ binary ====== +binary-0.9.0.0 +-------------- + +- Replace binary's home grown `Builder` with `Data.ByteString.Builder`. + `Data.Binary.Builder` now exports `Data.ByteString.Builder.Builder`. +- Add `putList :: [a] -> Put` to the `Binary` class. This is used to be able to + use the list writing primitives of the new Builder. This brought a number of speedups; + Encoding a String is now 70% faster. [Word8] is 76% faster, which also makes + Integer 34% faster. Similar numbers for all [IntXX] and [WordXX]. +- Fail gracefully within `Get` when decoding `Bool` and `Ordering`. Previously + when decoding invalid data these instances would fail with `error`. +- Add Binary instance for `Complex a`. +- Add Monoid instance for `Put`. + binary-0.8.2.1 -------------- From git at git.haskell.org Tue Apr 19 20:30:42 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:42 +0000 (UTC) Subject: [commit: packages/binary] master: Add Semigroup for Put for GHC 8. (aefa0c5) Message-ID: <20160419203042.01B373A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/aefa0c5407daf15e95d5788df8dd0ab059f35f56 >--------------------------------------------------------------- commit aefa0c5407daf15e95d5788df8dd0ab059f35f56 Author: Lennart Kolmodin Date: Tue Apr 19 07:37:05 2016 +0200 Add Semigroup for Put for GHC 8. base-4.9.0.0 has Data.Semigroup. >--------------------------------------------------------------- aefa0c5407daf15e95d5788df8dd0ab059f35f56 src/Data/Binary/Put.hs | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/src/Data/Binary/Put.hs b/src/Data/Binary/Put.hs index 23db39f..b476694 100644 --- a/src/Data/Binary/Put.hs +++ b/src/Data/Binary/Put.hs @@ -4,6 +4,10 @@ {-# LANGUAGE Safe #-} #endif +#if MIN_VERSION_base(4,9,0) +#define HAS_SEMIGROUP +#endif + ----------------------------------------------------------------------------- -- | -- Module : Data.Binary.Put @@ -72,7 +76,7 @@ module Data.Binary.Put ( ) where -import Data.Monoid +import qualified Data.Monoid as Monoid import Data.Binary.Builder (Builder, toLazyByteString) import qualified Data.Binary.Builder as B @@ -84,6 +88,10 @@ import qualified Data.ByteString.Lazy as L import Data.ByteString.Short #endif +#ifdef HAS_SEMIGROUP +import Data.Semigroup +#endif + import Control.Applicative import Prelude -- Silence AMP warning. @@ -135,16 +143,30 @@ instance Monad PutM where (>>) = (*>) {-# INLINE (>>) #-} -instance Monoid (PutM ()) where +instance Monoid.Monoid (PutM ()) where mempty = pure () {-# INLINE mempty #-} - mappend m k = Put $ - let PairS _ w = unPut m - PairS _ w' = unPut k - in PairS () (w `mappend` w') +#ifdef HAS_SEMIGROUP + mappend = (<>) +#else + mappend = mappend' +#endif {-# INLINE mappend #-} +mappend' :: Put -> Put -> Put +mappend' m k = Put $ + let PairS _ w = unPut m + PairS _ w' = unPut k + in PairS () (w `mappend` w') +{-# INLINE mappend' #-} + +#ifdef HAS_SEMIGROUP +instance Semigroup (PutM ()) where + (<>) = mappend' + {-# INLINE (<>) #-} +#endif + tell :: Builder -> Put tell b = Put $ PairS () b {-# INLINE tell #-} From git at git.haskell.org Tue Apr 19 20:30:44 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:44 +0000 (UTC) Subject: [commit: packages/binary] master: Remove Eq constraint. (3f98a98) Message-ID: <20160419203044.08A5B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/3f98a98f094df16e59f27430c7e66e093fb22ca5 >--------------------------------------------------------------- commit 3f98a98f094df16e59f27430c7e66e093fb22ca5 Author: Lennart Kolmodin Date: Tue Apr 19 07:39:14 2016 +0200 Remove Eq constraint. It wasn't required. >--------------------------------------------------------------- 3f98a98f094df16e59f27430c7e66e093fb22ca5 tests/QC.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/QC.hs b/tests/QC.hs index eeb04da..0bad454 100644 --- a/tests/QC.hs +++ b/tests/QC.hs @@ -494,7 +494,7 @@ p = property test :: (Eq a, Binary a) => a -> Property test a = forAll positiveList (roundTrip a . refragment) -test' :: (Show a, Arbitrary a, Eq a) => String -> (a -> Property) -> ([a] -> Property) -> Test +test' :: (Show a, Arbitrary a) => String -> (a -> Property) -> ([a] -> Property) -> Test test' desc prop propList = testGroup desc [ testProperty desc prop, From git at git.haskell.org Tue Apr 19 20:30:44 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:44 +0000 (UTC) Subject: [commit: packages/binary] master: Remove ghc 7.4.2 from travis CI. (105bc07) Message-ID: <20160419203044.5F1E23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/105bc0782bb65354bc1da1a30941ef43885c9d0f >--------------------------------------------------------------- commit 105bc0782bb65354bc1da1a30941ef43885c9d0f Author: Lennart Kolmodin Date: Fri Apr 15 22:24:13 2016 +0200 Remove ghc 7.4.2 from travis CI. It's been failing on travis for 3 months due to failing dependencies. >--------------------------------------------------------------- 105bc0782bb65354bc1da1a30941ef43885c9d0f .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index cf16df1..7f6fd4f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,8 +6,6 @@ sudo: false matrix: include: - - env: CABALVER=1.18 GHCVER=7.4.2 - addons: {apt: {packages: [cabal-install-1.18,ghc-7.4.2], sources: [hvr-ghc]}} - env: CABALVER=1.18 GHCVER=7.6.3 addons: {apt: {packages: [cabal-install-1.18,ghc-7.6.3], sources: [hvr-ghc]}} - env: CABALVER=1.18 GHCVER=7.8.4 From git at git.haskell.org Tue Apr 19 20:30:46 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:46 +0000 (UTC) Subject: [commit: packages/binary] master: Fix compilation error on GHC < 8. (df9f3b7) Message-ID: <20160419203046.104D83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/df9f3b7e7fb533a41c569126ddfbb65530e83835 >--------------------------------------------------------------- commit df9f3b7e7fb533a41c569126ddfbb65530e83835 Author: Lennart Kolmodin Date: Tue Apr 19 17:28:56 2016 +0200 Fix compilation error on GHC < 8. >--------------------------------------------------------------- df9f3b7e7fb533a41c569126ddfbb65530e83835 src/Data/Binary/Put.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Data/Binary/Put.hs b/src/Data/Binary/Put.hs index b476694..cc6e414 100644 --- a/src/Data/Binary/Put.hs +++ b/src/Data/Binary/Put.hs @@ -115,18 +115,18 @@ instance Functor PutM where {-# INLINE fmap #-} instance Applicative PutM where - pure a = Put $ PairS a mempty + pure a = Put $ PairS a Monoid.mempty {-# INLINE pure #-} m <*> k = Put $ let PairS f w = unPut m PairS x w' = unPut k - in PairS (f x) (w `mappend` w') + in PairS (f x) (w `Monoid.mappend` w') m *> k = Put $ let PairS _ w = unPut m PairS b w' = unPut k - in PairS b (w `mappend` w') + in PairS b (w `Monoid.mappend` w') {-# INLINE (*>) #-} -- Standard Writer monad, with aggressive inlining @@ -134,7 +134,7 @@ instance Monad PutM where m >>= k = Put $ let PairS a w = unPut m PairS b w' = unPut (k a) - in PairS b (w `mappend` w') + in PairS b (w `Monoid.mappend` w') {-# INLINE (>>=) #-} return = pure @@ -158,7 +158,7 @@ mappend' :: Put -> Put -> Put mappend' m k = Put $ let PairS _ w = unPut m PairS _ w' = unPut k - in PairS () (w `mappend` w') + in PairS () (w `Monodid.mappend` w') {-# INLINE mappend' #-} #ifdef HAS_SEMIGROUP From git at git.haskell.org Tue Apr 19 20:30:46 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:46 +0000 (UTC) Subject: [commit: packages/binary] master: Use ghc 7.10.3 on travis CI instead of ghc 7.10.2. (b005bcf) Message-ID: <20160419203046.652763A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/b005bcfce106d684199a009fae8f3c0d38032deb >--------------------------------------------------------------- commit b005bcfce106d684199a009fae8f3c0d38032deb Author: Lennart Kolmodin Date: Fri Apr 15 22:27:07 2016 +0200 Use ghc 7.10.3 on travis CI instead of ghc 7.10.2. >--------------------------------------------------------------- b005bcfce106d684199a009fae8f3c0d38032deb .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7f6fd4f..d3483af 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,8 +10,8 @@ matrix: addons: {apt: {packages: [cabal-install-1.18,ghc-7.6.3], sources: [hvr-ghc]}} - env: CABALVER=1.18 GHCVER=7.8.4 addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4], sources: [hvr-ghc]}} - - env: CABALVER=1.22 GHCVER=7.10.2 - addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.2], sources: [hvr-ghc]}} + - env: CABALVER=1.22 GHCVER=7.10.3 + addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3], sources: [hvr-ghc]}} - env: CABALVER=head GHCVER=head addons: {apt: {packages: [cabal-install-head,ghc-head], sources: [hvr-ghc]}} From git at git.haskell.org Tue Apr 19 20:30:48 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:48 +0000 (UTC) Subject: [commit: packages/binary] master: Fix typo. (c895607) Message-ID: <20160419203048.155FD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/c895607a2c0c3186d757028161621aca02b93fb4 >--------------------------------------------------------------- commit c895607a2c0c3186d757028161621aca02b93fb4 Author: Lennart Kolmodin Date: Tue Apr 19 17:42:34 2016 +0200 Fix typo. >--------------------------------------------------------------- c895607a2c0c3186d757028161621aca02b93fb4 src/Data/Binary/Put.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Data/Binary/Put.hs b/src/Data/Binary/Put.hs index cc6e414..36aa6a5 100644 --- a/src/Data/Binary/Put.hs +++ b/src/Data/Binary/Put.hs @@ -158,7 +158,7 @@ mappend' :: Put -> Put -> Put mappend' m k = Put $ let PairS _ w = unPut m PairS _ w' = unPut k - in PairS () (w `Monodid.mappend` w') + in PairS () (w `Monoid.mappend` w') {-# INLINE mappend' #-} #ifdef HAS_SEMIGROUP From git at git.haskell.org Tue Apr 19 20:30:48 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:48 +0000 (UTC) Subject: [commit: packages/binary] master: Rewrite mappend to only depend on the Builders. (6ca5897) Message-ID: <20160419203048.6BC223A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/6ca5897ce22b6bf9cf9b4a0e8ce72994928d413f >--------------------------------------------------------------- commit 6ca5897ce22b6bf9cf9b4a0e8ce72994928d413f Author: Lennart Kolmodin Date: Sat Apr 16 10:04:47 2016 +0200 Rewrite mappend to only depend on the Builders. This gives a 5% speedup in the generics-bench benchmark. >--------------------------------------------------------------- 6ca5897ce22b6bf9cf9b4a0e8ce72994928d413f src/Data/Binary/Generic.hs | 9 +++++---- src/Data/Binary/Put.hs | 5 ++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Data/Binary/Generic.hs b/src/Data/Binary/Generic.hs index 9967f95..bcf8e46 100644 --- a/src/Data/Binary/Generic.hs +++ b/src/Data/Binary/Generic.hs @@ -28,26 +28,27 @@ import Data.Binary.Get import Data.Binary.Put import Data.Bits import Data.Word +import Data.Monoid ((<>)) import GHC.Generics import Prelude -- Silence AMP warning. -- Type without constructors instance GBinaryPut V1 where - gput _ = return () + gput _ = pure () instance GBinaryGet V1 where gget = return undefined -- Constructor without arguments instance GBinaryPut U1 where - gput U1 = return () + gput U1 = pure () instance GBinaryGet U1 where gget = return U1 -- Product: constructor with parameters instance (GBinaryPut a, GBinaryPut b) => GBinaryPut (a :*: b) where - gput (x :*: y) = gput x >> gput y + gput (x :*: y) = gput x <> gput y instance (GBinaryGet a, GBinaryGet b) => GBinaryGet (a :*: b) where gget = (:*:) <$> gget <*> gget @@ -130,7 +131,7 @@ instance GBinaryGet a => GSumGet (C1 c a) where getSum _ _ = gget instance GBinaryPut a => GSumPut (C1 c a) where - putSum !code _ x = put code *> gput x + putSum !code _ x = put code <> gput x ------------------------------------------------------------------------ diff --git a/src/Data/Binary/Put.hs b/src/Data/Binary/Put.hs index 07a86c0..23db39f 100644 --- a/src/Data/Binary/Put.hs +++ b/src/Data/Binary/Put.hs @@ -139,7 +139,10 @@ instance Monoid (PutM ()) where mempty = pure () {-# INLINE mempty #-} - mappend = (>>) + mappend m k = Put $ + let PairS _ w = unPut m + PairS _ w' = unPut k + in PairS () (w `mappend` w') {-# INLINE mappend #-} tell :: Builder -> Put From git at git.haskell.org Tue Apr 19 20:30:50 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:50 +0000 (UTC) Subject: [commit: packages/binary] master: Remove Num constraint. (4d9f7b5) Message-ID: <20160419203050.1C9513A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/4d9f7b56e7d099ec1ab54e322e1c9f64dfedfeb4 >--------------------------------------------------------------- commit 4d9f7b56e7d099ec1ab54e322e1c9f64dfedfeb4 Author: Lennart Kolmodin Date: Tue Apr 19 18:12:09 2016 +0200 Remove Num constraint. It wasn't required. >--------------------------------------------------------------- 4d9f7b56e7d099ec1ab54e322e1c9f64dfedfeb4 benchmarks/Get.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/benchmarks/Get.hs b/benchmarks/Get.hs index 191f585..85bb55b 100644 --- a/benchmarks/Get.hs +++ b/benchmarks/Get.hs @@ -370,12 +370,12 @@ bigInteger = roll_foldl' manyBytes encodedBigInteger :: L.ByteString encodedBigInteger = encode bigInteger -roll_foldr :: (Integral a, Num a, Bits a) => [Word8] -> a +roll_foldr :: (Integral a, Bits a) => [Word8] -> a roll_foldr = foldr unstep 0 where unstep b a = a `shiftL` 8 .|. fromIntegral b -roll_foldl' :: (Integral a, Num a, Bits a) => [Word8] -> a +roll_foldl' :: (Integral a, Bits a) => [Word8] -> a roll_foldl' = foldl' unstep 0 . reverse where unstep a b = a `shiftL` 8 .|. fromIntegral b From git at git.haskell.org Tue Apr 19 20:30:50 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:50 +0000 (UTC) Subject: [commit: packages/binary] master: Implement put in Binary instances only using monoid. (a3f369e) Message-ID: <20160419203050.738D13A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/a3f369e55e9ea1404ca2f7b69a15cff92c5b3978 >--------------------------------------------------------------- commit a3f369e55e9ea1404ca2f7b69a15cff92c5b3978 Author: Lennart Kolmodin Date: Sat Apr 16 12:17:56 2016 +0200 Implement put in Binary instances only using monoid. >--------------------------------------------------------------- a3f369e55e9ea1404ca2f7b69a15cff92c5b3978 src/Data/Binary/Class.hs | 126 +++++++++++++++++++++++------------------------ 1 file changed, 62 insertions(+), 64 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc a3f369e55e9ea1404ca2f7b69a15cff92c5b3978 From git at git.haskell.org Tue Apr 19 20:30:52 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:52 +0000 (UTC) Subject: [commit: packages/binary] master: Bump version to 0.8.3.0. (38aef85) Message-ID: <20160419203052.22ACE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/38aef85a759c9a0f64e8c40042e9fa1f675a2f1a >--------------------------------------------------------------- commit 38aef85a759c9a0f64e8c40042e9fa1f675a2f1a Author: Lennart Kolmodin Date: Tue Apr 19 21:00:14 2016 +0200 Bump version to 0.8.3.0. Next version won't be 0.9.0.0 as previously stated. Looks like no changes should be breaking, except for the semi public API in Data.Binary.Builder.Internal which now has been removed. Also remove GHC 7.6.3 from 'tested-with'. It was removed from Travis CI since its dependencies doesn't build. >--------------------------------------------------------------- 38aef85a759c9a0f64e8c40042e9fa1f675a2f1a binary.cabal | 4 ++-- changelog.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/binary.cabal b/binary.cabal index 76428bf..e69b3cd 100644 --- a/binary.cabal +++ b/binary.cabal @@ -1,5 +1,5 @@ name: binary -version: 0.8.2.1 +version: 0.8.3.0 license: BSD3 license-file: LICENSE author: Lennart Kolmodin @@ -18,7 +18,7 @@ category: Data, Parsing stability: provisional build-type: Simple cabal-version: >= 1.8 -tested-with: GHC == 7.4.2, GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.2 +tested-with: GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.3 extra-source-files: README.md changelog.md docs/hcar/binary-Lb.tex tools/derive/*.hs diff --git a/changelog.md b/changelog.md index 75514af..cde0eb1 100644 --- a/changelog.md +++ b/changelog.md @@ -1,7 +1,7 @@ binary ====== -binary-0.9.0.0 +binary-0.8.3.0 -------------- - Replace binary's home grown `Builder` with `Data.ByteString.Builder`. @@ -13,7 +13,7 @@ binary-0.9.0.0 - Fail gracefully within `Get` when decoding `Bool` and `Ordering`. Previously when decoding invalid data these instances would fail with `error`. - Add Binary instance for `Complex a`. -- Add Monoid instance for `Put`. +- Add Monoid and Semigroup instance for `Put`. binary-0.8.2.1 -------------- From git at git.haskell.org Tue Apr 19 20:30:52 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:52 +0000 (UTC) Subject: [commit: packages/binary] master: Use monoid in Put benchmark. (1ecfd22) Message-ID: <20160419203052.7A57E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/1ecfd2272e96ca58a4f7f672b5ff3a7ee9f0ccb0 >--------------------------------------------------------------- commit 1ecfd2272e96ca58a4f7f672b5ff3a7ee9f0ccb0 Author: Lennart Kolmodin Date: Sat Apr 16 12:41:05 2016 +0200 Use monoid in Put benchmark. >--------------------------------------------------------------- 1ecfd2272e96ca58a4f7f672b5ff3a7ee9f0ccb0 benchmarks/Put.hs | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/benchmarks/Put.hs b/benchmarks/Put.hs index 12b7dbf..3d482eb 100644 --- a/benchmarks/Put.hs +++ b/benchmarks/Put.hs @@ -45,16 +45,16 @@ main = do bench "small Strings" $ whnf (run . fromStrings) smallStrings, bench "[small String]" $ whnf (run . put) smallStrings, - bench "Word8s" $ whnf (run . fromWord8s) word8s, + bench "Word8s monoid put" $ whnf (run . fromWord8s) word8s, bench "Word8s builder" $ whnf (L.length . toLazyByteString . fromWord8sBuilder) word8s, bench "[Word8]" $ whnf (run . put) word8s, - bench "Word16s" $ whnf (run . fromWord16s) word16s, + bench "Word16s monoid put" $ whnf (run . fromWord16s) word16s, bench "Word16s builder" $ whnf (L.length . toLazyByteString . fromWord16sBuilder) word16s, bench "[Word16]" $ whnf (run . put) word16s, - bench "Word32s" $ whnf (run . fromWord32s) word32s, + bench "Word32s monoid put" $ whnf (run . fromWord32s) word32s, bench "Word32s builder" $ whnf (L.length . toLazyByteString . fromWord32sBuilder) word32s, bench "[Word32]" $ whnf (run . put) word32s, - bench "Word64s" $ whnf (run . fromWord64s) word64s, + bench "Word64s monoid put" $ whnf (run . fromWord64s) word64s, bench "Word64s builder" $ whnf (L.length . toLazyByteString . fromWord64sBuilder) word64s, bench "[Word64]" $ whnf (run . put) word64s @@ -125,44 +125,44 @@ word64s = take 10000 $ cycle [minBound .. maxBound] -- Benchmarks fromIntegers :: [Integer] -> Put -fromIntegers [] = return () -fromIntegers (x:xs) = put x >> fromIntegers xs +fromIntegers [] = mempty +fromIntegers (x:xs) = put x `mappend` fromIntegers xs fromByteStrings :: [S.ByteString] -> Put -fromByteStrings [] = return () -fromByteStrings (x:xs) = put x >> fromByteStrings xs +fromByteStrings [] = mempty +fromByteStrings (x:xs) = put x `mappend` fromByteStrings xs fromStrings :: [String] -> Put -fromStrings [] = return () -fromStrings (x:xs) = put x >> fromStrings xs +fromStrings [] = mempty +fromStrings (x:xs) = put x `mappend` fromStrings xs fromWord8s :: [Word8] -> Put -fromWord8s [] = return () -fromWord8s (x:xs) = put x >> fromWord8s xs +fromWord8s [] = mempty +fromWord8s (x:xs) = put x `mappend` fromWord8s xs fromWord8sBuilder :: [Word8] -> BB.Builder fromWord8sBuilder [] = mempty fromWord8sBuilder (x:xs) = BB.word8 x `mappend` fromWord8sBuilder xs fromWord16s :: [Word16] -> Put -fromWord16s [] = return () -fromWord16s (x:xs) = put x >> fromWord16s xs +fromWord16s [] = mempty +fromWord16s (x:xs) = put x `mappend` fromWord16s xs fromWord16sBuilder :: [Word16] -> BB.Builder fromWord16sBuilder [] = mempty fromWord16sBuilder (x:xs) = BB.word16BE x `mappend` fromWord16sBuilder xs fromWord32s :: [Word32] -> Put -fromWord32s [] = return () -fromWord32s (x:xs) = put x >> fromWord32s xs +fromWord32s [] = mempty +fromWord32s (x:xs) = put x `mappend` fromWord32s xs fromWord32sBuilder :: [Word32] -> BB.Builder fromWord32sBuilder [] = mempty fromWord32sBuilder (x:xs) = BB.word32BE x `mappend` fromWord32sBuilder xs fromWord64s :: [Word64] -> Put -fromWord64s [] = return () -fromWord64s (x:xs) = put x >> fromWord64s xs +fromWord64s [] = mempty +fromWord64s (x:xs) = put x `mappend` fromWord64s xs fromWord64sBuilder :: [Word64] -> BB.Builder fromWord64sBuilder [] = mempty @@ -170,10 +170,10 @@ fromWord64sBuilder (x:xs) = BB.word64BE x `mappend` fromWord64sBuilder xs #ifdef GENERICS fromStructs :: [Struct] -> Put -fromStructs [] = return () -fromStructs (x:xs) = put x >> fromStructs xs +fromStructs [] = mempty +fromStructs (x:xs) = put x `mappend` fromStructs xs fromStructLists :: [StructList] -> Put -fromStructLists [] = return () -fromStructLists (x:xs) = put x >> fromStructLists xs +fromStructLists [] = mempty +fromStructLists (x:xs) = put x `mappend` fromStructLists xs #endif From git at git.haskell.org Tue Apr 19 20:30:54 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:54 +0000 (UTC) Subject: [commit: packages/binary] master: Add Double to Put benchmark. (69d6ebf) Message-ID: <20160419203054.818CF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/69d6ebf0ead131fad0f22d441c0eac4989e45b84 >--------------------------------------------------------------- commit 69d6ebf0ead131fad0f22d441c0eac4989e45b84 Author: Lennart Kolmodin Date: Sat Apr 16 23:44:53 2016 +0200 Add Double to Put benchmark. >--------------------------------------------------------------- 69d6ebf0ead131fad0f22d441c0eac4989e45b84 benchmarks/Put.hs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/benchmarks/Put.hs b/benchmarks/Put.hs index 3d482eb..55ee5bd 100644 --- a/benchmarks/Put.hs +++ b/benchmarks/Put.hs @@ -29,7 +29,11 @@ main = do , rnf smallIntegers , rnf smallByteStrings , rnf smallStrings + , rnf doubles , rnf word8s + , rnf word16s + , rnf word32s + , rnf word64s ] defaultMain [ @@ -45,6 +49,8 @@ main = do bench "small Strings" $ whnf (run . fromStrings) smallStrings, bench "[small String]" $ whnf (run . put) smallStrings, + bench "Double" $ whnf (run . put) doubles, + bench "Word8s monoid put" $ whnf (run . fromWord8s) word8s, bench "Word8s builder" $ whnf (L.length . toLazyByteString . fromWord8sBuilder) word8s, bench "[Word8]" $ whnf (run . put) word8s, @@ -105,6 +111,9 @@ smallStrings :: [String] smallStrings = replicate 10000 "abcdefghi" {-# NOINLINE smallStrings #-} +doubles :: [Double] +doubles = take 10000 $ [ sign * 2 ** n | sign <- [-1, 1], n <- [ 0, 0.2 .. 1023 ]] + word8s :: [Word8] word8s = take 10000 $ cycle [minBound .. maxBound] {-# NOINLINE word8s #-} From git at git.haskell.org Tue Apr 19 20:30:56 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:56 +0000 (UTC) Subject: [commit: packages/binary] master: Add Semigroup for Put for GHC 8. (aefa0c5) Message-ID: <20160419203056.87FD53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/aefa0c5407daf15e95d5788df8dd0ab059f35f56 >--------------------------------------------------------------- commit aefa0c5407daf15e95d5788df8dd0ab059f35f56 Author: Lennart Kolmodin Date: Tue Apr 19 07:37:05 2016 +0200 Add Semigroup for Put for GHC 8. base-4.9.0.0 has Data.Semigroup. >--------------------------------------------------------------- aefa0c5407daf15e95d5788df8dd0ab059f35f56 src/Data/Binary/Put.hs | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/src/Data/Binary/Put.hs b/src/Data/Binary/Put.hs index 23db39f..b476694 100644 --- a/src/Data/Binary/Put.hs +++ b/src/Data/Binary/Put.hs @@ -4,6 +4,10 @@ {-# LANGUAGE Safe #-} #endif +#if MIN_VERSION_base(4,9,0) +#define HAS_SEMIGROUP +#endif + ----------------------------------------------------------------------------- -- | -- Module : Data.Binary.Put @@ -72,7 +76,7 @@ module Data.Binary.Put ( ) where -import Data.Monoid +import qualified Data.Monoid as Monoid import Data.Binary.Builder (Builder, toLazyByteString) import qualified Data.Binary.Builder as B @@ -84,6 +88,10 @@ import qualified Data.ByteString.Lazy as L import Data.ByteString.Short #endif +#ifdef HAS_SEMIGROUP +import Data.Semigroup +#endif + import Control.Applicative import Prelude -- Silence AMP warning. @@ -135,16 +143,30 @@ instance Monad PutM where (>>) = (*>) {-# INLINE (>>) #-} -instance Monoid (PutM ()) where +instance Monoid.Monoid (PutM ()) where mempty = pure () {-# INLINE mempty #-} - mappend m k = Put $ - let PairS _ w = unPut m - PairS _ w' = unPut k - in PairS () (w `mappend` w') +#ifdef HAS_SEMIGROUP + mappend = (<>) +#else + mappend = mappend' +#endif {-# INLINE mappend #-} +mappend' :: Put -> Put -> Put +mappend' m k = Put $ + let PairS _ w = unPut m + PairS _ w' = unPut k + in PairS () (w `mappend` w') +{-# INLINE mappend' #-} + +#ifdef HAS_SEMIGROUP +instance Semigroup (PutM ()) where + (<>) = mappend' + {-# INLINE (<>) #-} +#endif + tell :: Builder -> Put tell b = Put $ PairS () b {-# INLINE tell #-} From git at git.haskell.org Tue Apr 19 20:30:58 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:30:58 +0000 (UTC) Subject: [commit: packages/binary] master: Remove Eq constraint. (3f98a98) Message-ID: <20160419203058.8DAEA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/3f98a98f094df16e59f27430c7e66e093fb22ca5 >--------------------------------------------------------------- commit 3f98a98f094df16e59f27430c7e66e093fb22ca5 Author: Lennart Kolmodin Date: Tue Apr 19 07:39:14 2016 +0200 Remove Eq constraint. It wasn't required. >--------------------------------------------------------------- 3f98a98f094df16e59f27430c7e66e093fb22ca5 tests/QC.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/QC.hs b/tests/QC.hs index eeb04da..0bad454 100644 --- a/tests/QC.hs +++ b/tests/QC.hs @@ -494,7 +494,7 @@ p = property test :: (Eq a, Binary a) => a -> Property test a = forAll positiveList (roundTrip a . refragment) -test' :: (Show a, Arbitrary a, Eq a) => String -> (a -> Property) -> ([a] -> Property) -> Test +test' :: (Show a, Arbitrary a) => String -> (a -> Property) -> ([a] -> Property) -> Test test' desc prop propList = testGroup desc [ testProperty desc prop, From git at git.haskell.org Tue Apr 19 20:31:00 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:31:00 +0000 (UTC) Subject: [commit: packages/binary] master: Fix compilation error on GHC < 8. (df9f3b7) Message-ID: <20160419203100.93F9B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/df9f3b7e7fb533a41c569126ddfbb65530e83835 >--------------------------------------------------------------- commit df9f3b7e7fb533a41c569126ddfbb65530e83835 Author: Lennart Kolmodin Date: Tue Apr 19 17:28:56 2016 +0200 Fix compilation error on GHC < 8. >--------------------------------------------------------------- df9f3b7e7fb533a41c569126ddfbb65530e83835 src/Data/Binary/Put.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Data/Binary/Put.hs b/src/Data/Binary/Put.hs index b476694..cc6e414 100644 --- a/src/Data/Binary/Put.hs +++ b/src/Data/Binary/Put.hs @@ -115,18 +115,18 @@ instance Functor PutM where {-# INLINE fmap #-} instance Applicative PutM where - pure a = Put $ PairS a mempty + pure a = Put $ PairS a Monoid.mempty {-# INLINE pure #-} m <*> k = Put $ let PairS f w = unPut m PairS x w' = unPut k - in PairS (f x) (w `mappend` w') + in PairS (f x) (w `Monoid.mappend` w') m *> k = Put $ let PairS _ w = unPut m PairS b w' = unPut k - in PairS b (w `mappend` w') + in PairS b (w `Monoid.mappend` w') {-# INLINE (*>) #-} -- Standard Writer monad, with aggressive inlining @@ -134,7 +134,7 @@ instance Monad PutM where m >>= k = Put $ let PairS a w = unPut m PairS b w' = unPut (k a) - in PairS b (w `mappend` w') + in PairS b (w `Monoid.mappend` w') {-# INLINE (>>=) #-} return = pure @@ -158,7 +158,7 @@ mappend' :: Put -> Put -> Put mappend' m k = Put $ let PairS _ w = unPut m PairS _ w' = unPut k - in PairS () (w `mappend` w') + in PairS () (w `Monodid.mappend` w') {-# INLINE mappend' #-} #ifdef HAS_SEMIGROUP From git at git.haskell.org Tue Apr 19 20:31:02 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:31:02 +0000 (UTC) Subject: [commit: packages/binary] master: Fix typo. (c895607) Message-ID: <20160419203102.9B37F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/c895607a2c0c3186d757028161621aca02b93fb4 >--------------------------------------------------------------- commit c895607a2c0c3186d757028161621aca02b93fb4 Author: Lennart Kolmodin Date: Tue Apr 19 17:42:34 2016 +0200 Fix typo. >--------------------------------------------------------------- c895607a2c0c3186d757028161621aca02b93fb4 src/Data/Binary/Put.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Data/Binary/Put.hs b/src/Data/Binary/Put.hs index cc6e414..36aa6a5 100644 --- a/src/Data/Binary/Put.hs +++ b/src/Data/Binary/Put.hs @@ -158,7 +158,7 @@ mappend' :: Put -> Put -> Put mappend' m k = Put $ let PairS _ w = unPut m PairS _ w' = unPut k - in PairS () (w `Monodid.mappend` w') + in PairS () (w `Monoid.mappend` w') {-# INLINE mappend' #-} #ifdef HAS_SEMIGROUP From git at git.haskell.org Tue Apr 19 20:31:04 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:31:04 +0000 (UTC) Subject: [commit: packages/binary] master: Remove Num constraint. (4d9f7b5) Message-ID: <20160419203104.A1AEB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/4d9f7b56e7d099ec1ab54e322e1c9f64dfedfeb4 >--------------------------------------------------------------- commit 4d9f7b56e7d099ec1ab54e322e1c9f64dfedfeb4 Author: Lennart Kolmodin Date: Tue Apr 19 18:12:09 2016 +0200 Remove Num constraint. It wasn't required. >--------------------------------------------------------------- 4d9f7b56e7d099ec1ab54e322e1c9f64dfedfeb4 benchmarks/Get.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/benchmarks/Get.hs b/benchmarks/Get.hs index 191f585..85bb55b 100644 --- a/benchmarks/Get.hs +++ b/benchmarks/Get.hs @@ -370,12 +370,12 @@ bigInteger = roll_foldl' manyBytes encodedBigInteger :: L.ByteString encodedBigInteger = encode bigInteger -roll_foldr :: (Integral a, Num a, Bits a) => [Word8] -> a +roll_foldr :: (Integral a, Bits a) => [Word8] -> a roll_foldr = foldr unstep 0 where unstep b a = a `shiftL` 8 .|. fromIntegral b -roll_foldl' :: (Integral a, Num a, Bits a) => [Word8] -> a +roll_foldl' :: (Integral a, Bits a) => [Word8] -> a roll_foldl' = foldl' unstep 0 . reverse where unstep a b = a `shiftL` 8 .|. fromIntegral b From git at git.haskell.org Tue Apr 19 20:31:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:31:06 +0000 (UTC) Subject: [commit: packages/binary] master: Bump version to 0.8.3.0. (38aef85) Message-ID: <20160419203106.A93893A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/38aef85a759c9a0f64e8c40042e9fa1f675a2f1a >--------------------------------------------------------------- commit 38aef85a759c9a0f64e8c40042e9fa1f675a2f1a Author: Lennart Kolmodin Date: Tue Apr 19 21:00:14 2016 +0200 Bump version to 0.8.3.0. Next version won't be 0.9.0.0 as previously stated. Looks like no changes should be breaking, except for the semi public API in Data.Binary.Builder.Internal which now has been removed. Also remove GHC 7.6.3 from 'tested-with'. It was removed from Travis CI since its dependencies doesn't build. >--------------------------------------------------------------- 38aef85a759c9a0f64e8c40042e9fa1f675a2f1a binary.cabal | 4 ++-- changelog.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/binary.cabal b/binary.cabal index 76428bf..e69b3cd 100644 --- a/binary.cabal +++ b/binary.cabal @@ -1,5 +1,5 @@ name: binary -version: 0.8.2.1 +version: 0.8.3.0 license: BSD3 license-file: LICENSE author: Lennart Kolmodin @@ -18,7 +18,7 @@ category: Data, Parsing stability: provisional build-type: Simple cabal-version: >= 1.8 -tested-with: GHC == 7.4.2, GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.2 +tested-with: GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.3 extra-source-files: README.md changelog.md docs/hcar/binary-Lb.tex tools/derive/*.hs diff --git a/changelog.md b/changelog.md index 75514af..cde0eb1 100644 --- a/changelog.md +++ b/changelog.md @@ -1,7 +1,7 @@ binary ====== -binary-0.9.0.0 +binary-0.8.3.0 -------------- - Replace binary's home grown `Builder` with `Data.ByteString.Builder`. @@ -13,7 +13,7 @@ binary-0.9.0.0 - Fail gracefully within `Get` when decoding `Bool` and `Ordering`. Previously when decoding invalid data these instances would fail with `error`. - Add Binary instance for `Complex a`. -- Add Monoid instance for `Put`. +- Add Monoid and Semigroup instance for `Put`. binary-0.8.2.1 -------------- From git at git.haskell.org Tue Apr 19 20:58:24 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:58:24 +0000 (UTC) Subject: [commit: packages/pretty] tag 'v1.1.3.3' created Message-ID: <20160419205824.942F33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/pretty New tag : v1.1.3.3 Referencing: 94c2a75c407fe78b53417848a68639479647b67f From git at git.haskell.org Tue Apr 19 20:58:26 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:58:26 +0000 (UTC) Subject: [commit: packages/pretty] master: Define Semigroup instances for base>=4.9 (d0ab406) Message-ID: <20160419205826.9B5693A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/pretty On branch : master Link : http://git.haskell.org/packages/pretty.git/commitdiff/d0ab406b82bb8d04bcdaac3672c2539d459f13a9 >--------------------------------------------------------------- commit d0ab406b82bb8d04bcdaac3672c2539d459f13a9 Author: Herbert Valerio Riedel Date: Fri Jan 1 10:39:59 2016 +0100 Define Semigroup instances for base>=4.9 This makes `pretty` almost `-Wcompat`-clean. The only remaining warning is about the local `<>` definitions clashing with a future Prelude exporting `(<>)`. >--------------------------------------------------------------- d0ab406b82bb8d04bcdaac3672c2539d459f13a9 src/Text/PrettyPrint/Annotated/HughesPJ.hs | 13 ++++++++++++- src/Text/PrettyPrint/HughesPJ.hs | 13 ++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/Text/PrettyPrint/Annotated/HughesPJ.hs b/src/Text/PrettyPrint/Annotated/HughesPJ.hs index 02fe34c..674122c 100644 --- a/src/Text/PrettyPrint/Annotated/HughesPJ.hs +++ b/src/Text/PrettyPrint/Annotated/HughesPJ.hs @@ -84,7 +84,9 @@ module Text.PrettyPrint.Annotated.HughesPJ ( import Control.DeepSeq ( NFData(rnf) ) import Data.Function ( on ) -#if __GLASGOW_HASKELL__ < 709 +#if __GLASGOW_HASKELL__ >= 800 +import qualified Data.Semigroup as Semi ( Semigroup((<>)) ) +#elif __GLASGOW_HASKELL__ < 709 import Data.Monoid ( Monoid(mempty, mappend) ) #endif import Data.String ( IsString(fromString) ) @@ -258,9 +260,18 @@ data TextDetails = Chr {-# UNPACK #-} !Char -- ^ A single Char fragment #endif -- Combining @Doc@ values +#if __GLASGOW_HASKELL__ >= 800 +instance Semi.Semigroup (Doc a) where + (<>) = (Text.PrettyPrint.Annotated.HughesPJ.<>) + +instance Monoid (Doc a) where + mempty = empty + mappend = (Semi.<>) +#else instance Monoid (Doc a) where mempty = empty mappend = (<>) +#endif instance IsString (Doc a) where fromString = text diff --git a/src/Text/PrettyPrint/HughesPJ.hs b/src/Text/PrettyPrint/HughesPJ.hs index 090b222..5aa5018 100644 --- a/src/Text/PrettyPrint/HughesPJ.hs +++ b/src/Text/PrettyPrint/HughesPJ.hs @@ -87,7 +87,9 @@ import qualified Text.PrettyPrint.Annotated.HughesPJ as Ann import Control.DeepSeq ( NFData(rnf) ) import Data.Function ( on ) -#if __GLASGOW_HASKELL__ < 709 +#if __GLASGOW_HASKELL__ >= 800 +import qualified Data.Semigroup as Semi ( Semigroup((<>)) ) +#elif __GLASGOW_HASKELL__ < 709 import Data.Monoid ( Monoid(mempty, mappend) ) #endif import Data.String ( IsString(fromString) ) @@ -127,9 +129,18 @@ liftBinary f (Doc a) (Doc b) = Doc (f a b) type RDoc = Doc -- Combining @Doc@ values +#if __GLASGOW_HASKELL__ >= 800 +instance Semi.Semigroup Doc where + (<>) = (Text.PrettyPrint.HughesPJ.<>) + +instance Monoid Doc where + mempty = empty + mappend = (Semi.<>) +#else instance Monoid Doc where mempty = empty mappend = (<>) +#endif instance IsString Doc where fromString = text From git at git.haskell.org Tue Apr 19 20:58:28 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:58:28 +0000 (UTC) Subject: [commit: packages/pretty] master: Add more badges to readme (6e89a12) Message-ID: <20160419205828.A07A83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/pretty On branch : master Link : http://git.haskell.org/packages/pretty.git/commitdiff/6e89a129fe02af3a325579a2ed8017899a2a35cb >--------------------------------------------------------------- commit 6e89a129fe02af3a325579a2ed8017899a2a35cb Author: David Terei Date: Mon Jan 11 11:00:05 2016 -0800 Add more badges to readme >--------------------------------------------------------------- 6e89a129fe02af3a325579a2ed8017899a2a35cb README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6b24d8c..22b6ab0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,13 @@ # Pretty : A Haskell Pretty-printer library -[![Hackage version](https://img.shields.io/hackage/v/pretty.svg?style=flat)](https://hackage.haskell.org/package/pretty) [![Build Status](https://img.shields.io/travis/haskell/pretty.svg?style=flat)](https://travis-ci.org/haskell/pretty) +[![Hackage](https://img.shields.io/hackage/v/pretty.svg?style=flat)](https://hackage.haskell.org/package/pretty) +[![Hackage Dependencies](https://img.shields.io/hackage-deps/v/pretty.svg?style=flat)](http://packdeps.haskellers.com/reverse/pretty) +[![BSD3 License](http://img.shields.io/badge/license-MIT-brightgreen.svg)][tl;dr Legal: BSD3] +[![Build](https://img.shields.io/travis/haskell/pretty.svg?style=flat)](https://travis-ci.org/haskell/pretty) + +[tl;dr Legal: BSD3]: + https://tldrlegal.com/license/bsd-3-clause-license-(revised) + "BSD3 License" Pretty is a pretty-printing library, a set of API's that provides a way to easily print out text in a consistent format of your choosing. From git at git.haskell.org Tue Apr 19 20:58:30 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:58:30 +0000 (UTC) Subject: [commit: packages/pretty] master: Fix license badge (c7d67f7) Message-ID: <20160419205830.A58D13A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/pretty On branch : master Link : http://git.haskell.org/packages/pretty.git/commitdiff/c7d67f7b316221b48e0a6342f93474172a322910 >--------------------------------------------------------------- commit c7d67f7b316221b48e0a6342f93474172a322910 Author: David Terei Date: Mon Jan 11 11:02:29 2016 -0800 Fix license badge >--------------------------------------------------------------- c7d67f7b316221b48e0a6342f93474172a322910 README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 22b6ab0..0c84c8a 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Hackage](https://img.shields.io/hackage/v/pretty.svg?style=flat)](https://hackage.haskell.org/package/pretty) [![Hackage Dependencies](https://img.shields.io/hackage-deps/v/pretty.svg?style=flat)](http://packdeps.haskellers.com/reverse/pretty) -[![BSD3 License](http://img.shields.io/badge/license-MIT-brightgreen.svg)][tl;dr Legal: BSD3] +[![BSD3 License](http://img.shields.io/badge/license-BSD3-brightgreen.svg?style=flat)][tl;dr Legal: BSD3] [![Build](https://img.shields.io/travis/haskell/pretty.svg?style=flat)](https://travis-ci.org/haskell/pretty) [tl;dr Legal: BSD3]: From git at git.haskell.org Tue Apr 19 20:58:32 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:58:32 +0000 (UTC) Subject: [commit: packages/pretty] master: Merge pull request #31 from hvr/pr/semigroup (606c57b) Message-ID: <20160419205832.AB7E93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/pretty On branch : master Link : http://git.haskell.org/packages/pretty.git/commitdiff/606c57b95a30450c029fde3b3e27ebb857d4f45d >--------------------------------------------------------------- commit 606c57b95a30450c029fde3b3e27ebb857d4f45d Merge: c7d67f7 d0ab406 Author: David Terei Date: Sat Feb 6 13:02:12 2016 -0800 Merge pull request #31 from hvr/pr/semigroup Define Semigroup instances for base>=4.9 >--------------------------------------------------------------- 606c57b95a30450c029fde3b3e27ebb857d4f45d src/Text/PrettyPrint/Annotated/HughesPJ.hs | 13 ++++++++++++- src/Text/PrettyPrint/HughesPJ.hs | 13 ++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) From git at git.haskell.org Tue Apr 19 20:58:34 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:58:34 +0000 (UTC) Subject: [commit: packages/pretty] master: Improve documentation (fixes #33). (1228405) Message-ID: <20160419205834.B2D003A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/pretty On branch : master Link : http://git.haskell.org/packages/pretty.git/commitdiff/1228405cd4bda262144e6b1eaf150fb4f4e18496 >--------------------------------------------------------------- commit 1228405cd4bda262144e6b1eaf150fb4f4e18496 Author: David Terei Date: Mon Feb 29 10:49:04 2016 -0800 Improve documentation (fixes #33). >--------------------------------------------------------------- 1228405cd4bda262144e6b1eaf150fb4f4e18496 src/Text/PrettyPrint/Annotated/HughesPJ.hs | 174 ++++++++++++++---------- src/Text/PrettyPrint/Annotated/HughesPJClass.hs | 4 +- src/Text/PrettyPrint/HughesPJ.hs | 39 +++--- src/Text/PrettyPrint/HughesPJClass.hs | 4 +- 4 files changed, 123 insertions(+), 98 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 1228405cd4bda262144e6b1eaf150fb4f4e18496 From git at git.haskell.org Tue Apr 19 20:58:36 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:58:36 +0000 (UTC) Subject: [commit: packages/pretty] master: Bump to version 1.1.3.3. (56bc78e) Message-ID: <20160419205836.B8A1F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/pretty On branch : master Link : http://git.haskell.org/packages/pretty.git/commitdiff/56bc78e2c2cfcc850f6fec87fe79743750d4c8b4 >--------------------------------------------------------------- commit 56bc78e2c2cfcc850f6fec87fe79743750d4c8b4 Author: David Terei Date: Mon Feb 29 10:51:14 2016 -0800 Bump to version 1.1.3.3. >--------------------------------------------------------------- 56bc78e2c2cfcc850f6fec87fe79743750d4c8b4 CHANGELOG.md | 4 ++++ pretty.cabal | 14 ++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8524efe..41243c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Pretty library change log +## 1.1.3.3 -- 29th February, 2016 + +* Improve documentation. + ## 1.1.3.2 -- 19th March, 2015 * Fix bug with haddock documentation. diff --git a/pretty.cabal b/pretty.cabal index d336635..0786a2f 100644 --- a/pretty.cabal +++ b/pretty.cabal @@ -1,5 +1,5 @@ name: pretty -version: 1.1.3.2 +version: 1.1.3.3 synopsis: Pretty-printing library description: This package contains a pretty-printing library, a set of API's @@ -21,6 +21,11 @@ build-type: Simple Extra-Source-Files: README.md CHANGELOG.md Cabal-Version: >= 1.8 +source-repository this + type: git + location: http://github.com/haskell/pretty.git + tag: 1.1.3.3 + source-repository head type: git location: http://github.com/haskell/pretty.git @@ -60,10 +65,3 @@ Test-Suite test-pretty extensions: CPP, BangPatterns, DeriveGeneric include-dirs: src/Text/PrettyPrint/Annotated --- Executable Bench1 --- main-is: Bench1.hs --- build-depends: base >= 3 && < 5, --- pretty --- hs-source-dirs: tests --- ghc-options: -O -fwarn-tabs - From git at git.haskell.org Tue Apr 19 20:58:38 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 20:58:38 +0000 (UTC) Subject: [commit: packages/pretty] master: Add stack build system support. (3b84566) Message-ID: <20160419205838.BF73A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/pretty On branch : master Link : http://git.haskell.org/packages/pretty.git/commitdiff/3b84566e567b016d6cd175dd8edcb293cacb9daa >--------------------------------------------------------------- commit 3b84566e567b016d6cd175dd8edcb293cacb9daa Author: David Terei Date: Mon Feb 29 10:59:10 2016 -0800 Add stack build system support. >--------------------------------------------------------------- 3b84566e567b016d6cd175dd8edcb293cacb9daa .gitignore | 1 + stack.yaml | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/.gitignore b/.gitignore index 0477e90..56911da 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ dist-install ghc.mk cabal.sandbox.config .cabal-sandbox +.stack-work diff --git a/stack.yaml b/stack.yaml new file mode 100644 index 0000000..ea88d8a --- /dev/null +++ b/stack.yaml @@ -0,0 +1,32 @@ +# For more information, see: https://github.com/commercialhaskell/stack/blob/release/doc/yaml_configuration.md + +# Specifies the GHC version and set of packages available (e.g., lts-3.5, nightly-2015-09-21, ghc-7.10.2) +resolver: lts-5.5 + +# Local packages, usually specified by relative directory name +packages: +- '.' + +# Packages to be pulled from upstream that are not in the resolver (e.g., acme-missiles-0.3) +extra-deps: [] + +# Override default flag values for local packages and extra-deps +flags: {} + +# Extra package databases containing global packages +extra-package-dbs: [] + +# Control whether we use the GHC we find on the path +# system-ghc: true + +# Require a specific version of stack, using version ranges +# require-stack-version: -any # Default +# require-stack-version: >= 0.1.4.0 + +# Override the architecture used by stack, especially useful on Windows +# arch: i386 +# arch: x86_64 + +# Extra directories used by stack for building +# extra-include-dirs: [/path/to/dir] +# extra-lib-dirs: [/path/to/dir] From git at git.haskell.org Tue Apr 19 21:04:42 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:04:42 +0000 (UTC) Subject: [commit: ghc] master: Update binary submodule to 0.8.3.0 release (ff290b8) Message-ID: <20160419210442.E1F6F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ff290b86ad237d1a5517ad9414a22840f6e749da/ghc >--------------------------------------------------------------- commit ff290b86ad237d1a5517ad9414a22840f6e749da Author: Herbert Valerio Riedel Date: Tue Apr 19 22:33:58 2016 +0200 Update binary submodule to 0.8.3.0 release >--------------------------------------------------------------- ff290b86ad237d1a5517ad9414a22840f6e749da libraries/binary | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/binary b/libraries/binary index 69915d0..38aef85 160000 --- a/libraries/binary +++ b/libraries/binary @@ -1 +1 @@ -Subproject commit 69915d0a26ae9eaa6b34367989ee8ed356ed13bb +Subproject commit 38aef85a759c9a0f64e8c40042e9fa1f675a2f1a From git at git.haskell.org Tue Apr 19 21:07:37 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:07:37 +0000 (UTC) Subject: [commit: ghc] master: Update `pretty` submodule to v1.1.3.3 release (15b7e87) Message-ID: <20160419210737.01A303A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/15b7e87702e4407d006a64c906a7c03f3fdf164e/ghc >--------------------------------------------------------------- commit 15b7e87702e4407d006a64c906a7c03f3fdf164e Author: Herbert Valerio Riedel Date: Tue Apr 19 23:09:15 2016 +0200 Update `pretty` submodule to v1.1.3.3 release >--------------------------------------------------------------- 15b7e87702e4407d006a64c906a7c03f3fdf164e libraries/pretty | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/pretty b/libraries/pretty index 9fd5f2b..56bc78e 160000 --- a/libraries/pretty +++ b/libraries/pretty @@ -1 +1 @@ -Subproject commit 9fd5f2b596bdfbce0414f973009b579d5d2430fa +Subproject commit 56bc78e2c2cfcc850f6fec87fe79743750d4c8b4 From git at git.haskell.org Tue Apr 19 21:37:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:37:06 +0000 (UTC) Subject: [commit: packages/unix] tag 'v2.7.2.0' created Message-ID: <20160419213706.CD42D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix New tag : v2.7.2.0 Referencing: 6a3d6d99bc8ba47af77c365e236bf858f749d78a From git at git.haskell.org Tue Apr 19 21:37:08 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:37:08 +0000 (UTC) Subject: [commit: packages/unix] master: Relax upper bound on `base` for base-4.9 (137fa1b) Message-ID: <20160419213708.D38EF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/137fa1b06a79a9baa0d5fcf2ec11f964c3423f6a/unix >--------------------------------------------------------------- commit 137fa1b06a79a9baa0d5fcf2ec11f964c3423f6a Author: Herbert Valerio Riedel Date: Wed Oct 28 22:34:34 2015 +0100 Relax upper bound on `base` for base-4.9 >--------------------------------------------------------------- 137fa1b06a79a9baa0d5fcf2ec11f964c3423f6a unix.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unix.cabal b/unix.cabal index cde94db..c54e275 100644 --- a/unix.cabal +++ b/unix.cabal @@ -59,7 +59,7 @@ library Trustworthy build-depends: - base >= 4.5 && < 4.9, + base >= 4.5 && < 4.10, bytestring >= 0.9.2 && < 0.11, time >= 1.2 && < 1.6 From git at git.haskell.org Tue Apr 19 21:37:10 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:37:10 +0000 (UTC) Subject: [commit: packages/unix] master: Don't assume non-POSIX `WCOREDUMP(x)` macro exists (cd061c0) Message-ID: <20160419213710.DB6833A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cd061c04b9239fcc68c43ed439331e1a41e5e22a/unix >--------------------------------------------------------------- commit cd061c04b9239fcc68c43ed439331e1a41e5e22a Author: Herbert Valerio Riedel Date: Mon Nov 16 18:49:46 2015 +0100 Don't assume non-POSIX `WCOREDUMP(x)` macro exists This fixes #50 >--------------------------------------------------------------- cd061c04b9239fcc68c43ed439331e1a41e5e22a cbits/HsUnix.c | 6 ++++++ changelog.md | 4 ++++ unix.cabal | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/cbits/HsUnix.c b/cbits/HsUnix.c index 60f19bc..13ca64b 100644 --- a/cbits/HsUnix.c +++ b/cbits/HsUnix.c @@ -14,6 +14,12 @@ int __hsunix_wifsignaled (int stat) { return WIFSIGNALED(stat); } int __hsunix_wtermsig (int stat) { return WTERMSIG(stat); } int __hsunix_wifstopped (int stat) { return WIFSTOPPED(stat); } int __hsunix_wstopsig (int stat) { return WSTOPSIG(stat); } + +// not part of POSIX, hence may not be always defined +#ifndef WCOREDUMP +# define WCOREDUMP(s) 0 +#endif + int __hsunix_wcoredump (int stat) { return WCOREDUMP(stat); } #ifdef HAVE_RTLDNEXT diff --git a/changelog.md b/changelog.md index a2ce61f..c3d43df 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ # Changelog for [`unix` package](http://hackage.haskell.org/package/unix) +## **TBA** + + * Don't assume non-POSIX `WCOREDUMP(x)` macro exists + ## 2.7.1.0 *Dec 2014* * Bundled with GHC 7.10.1 diff --git a/unix.cabal b/unix.cabal index c54e275..e920712 100644 --- a/unix.cabal +++ b/unix.cabal @@ -1,5 +1,5 @@ name: unix -version: 2.7.1.0 +version: 2.7.1.1 -- NOTE: Don't forget to update ./changelog.md license: BSD3 license-file: LICENSE From git at git.haskell.org Tue Apr 19 21:37:12 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:37:12 +0000 (UTC) Subject: [commit: packages/unix] master: Don't assume existence of termios constants beyond `B38400` (33920fe) Message-ID: <20160419213712.E2A363A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/33920fe3e0477cef1beda59d0ea47f4344be8d26/unix >--------------------------------------------------------------- commit 33920fe3e0477cef1beda59d0ea47f4344be8d26 Author: Herbert Valerio Riedel Date: Mon Nov 16 19:03:12 2015 +0100 Don't assume existence of termios constants beyond `B38400` This patch does not modify the `BaudRate` structure but rather causes some functions taking a `BaudRate` to throw exceptions on systems which don't provide `B57600` and/or `B115200`. I'm not totally happy with this patch yet, but this unbreaks compilation on platforms which don't define at least of these constants. This fixes #51 >--------------------------------------------------------------- 33920fe3e0477cef1beda59d0ea47f4344be8d26 System/Posix/Terminal/Common.hsc | 12 ++++++++++++ changelog.md | 2 ++ 2 files changed, 14 insertions(+) diff --git a/System/Posix/Terminal/Common.hsc b/System/Posix/Terminal/Common.hsc index 2f6327a..49418f5 100644 --- a/System/Posix/Terminal/Common.hsc +++ b/System/Posix/Terminal/Common.hsc @@ -527,8 +527,16 @@ baud2Word B4800 = (#const B4800) baud2Word B9600 = (#const B9600) baud2Word B19200 = (#const B19200) baud2Word B38400 = (#const B38400) +#ifdef B57600 baud2Word B57600 = (#const B57600) +#else +baud2Word B57600 = error "B57600 not available on this system" +#endif +#ifdef B115200 baud2Word B115200 = (#const B115200) +#else +baud2Word B115200 = error "B115200 not available on this system" +#endif -- And convert a word back to a baud rate -- We really need some cpp macros here. @@ -551,8 +559,12 @@ word2Baud x = else if x == (#const B9600) then B9600 else if x == (#const B19200) then B19200 else if x == (#const B38400) then B38400 +#ifdef B57600 else if x == (#const B57600) then B57600 +#endif +#ifdef B115200 else if x == (#const B115200) then B115200 +#endif else error "unknown baud rate" -- Clear termios i_flag diff --git a/changelog.md b/changelog.md index c3d43df..0f69383 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,8 @@ * Don't assume non-POSIX `WCOREDUMP(x)` macro exists + * Don't assume existence of termios constants beyond `B38400` + ## 2.7.1.0 *Dec 2014* * Bundled with GHC 7.10.1 From git at git.haskell.org Tue Apr 19 21:37:14 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:37:14 +0000 (UTC) Subject: [commit: packages/unix] master: Kill `-fwarn-unused-imports`-induced silliness (03632e3) Message-ID: <20160419213714.E89FA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/03632e32eb1d2e8f5d41ddc0f81bc6eff6a343c9/unix >--------------------------------------------------------------- commit 03632e32eb1d2e8f5d41ddc0f81bc6eff6a343c9 Author: Herbert Valerio Riedel Date: Mon Nov 16 19:37:56 2015 +0100 Kill `-fwarn-unused-imports`-induced silliness This all started in e968172cb0c9f4fc653c775faf3ecb661f5b1948 which tried to get rid of redundant import warnings. But we should rather err on having to tolerate a few warnings on exotic configurations rather than breaking a build... This hopefully fixes #36 >--------------------------------------------------------------- 03632e32eb1d2e8f5d41ddc0f81bc6eff6a343c9 System/Posix/Files/Common.hsc | 7 ------- changelog.md | 3 +++ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/System/Posix/Files/Common.hsc b/System/Posix/Files/Common.hsc index 586b417..963008f 100644 --- a/System/Posix/Files/Common.hsc +++ b/System/Posix/Files/Common.hsc @@ -83,15 +83,8 @@ module System.Posix.Files.Common ( import System.Posix.Types import System.IO.Unsafe import Data.Bits -#if defined(HAVE_STRUCT_STAT_ST_CTIM) || \ - defined(HAVE_STRUCT_STAT_ST_MTIM) || \ - defined(HAVE_STRUCT_STAT_ST_ATIM) || \ - defined(HAVE_STRUCT_STAT_ST_ATIMESPEC) || \ - defined(HAVE_STRUCT_STAT_ST_MTIMESPEC) || \ - defined(HAVE_STRUCT_STAT_ST_CTIMESPEC) import Data.Int import Data.Ratio -#endif import Data.Time.Clock.POSIX (POSIXTime) import System.Posix.Internals import Foreign.C diff --git a/changelog.md b/changelog.md index 0f69383..e5733c2 100644 --- a/changelog.md +++ b/changelog.md @@ -6,6 +6,9 @@ * Don't assume existence of termios constants beyond `B38400` + * Turn build error into compile warnings for exotic `struct stat` + configurations (GHC #8859). + ## 2.7.1.0 *Dec 2014* * Bundled with GHC 7.10.1 From git at git.haskell.org Tue Apr 19 21:37:16 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:37:16 +0000 (UTC) Subject: [commit: packages/unix] master: Simplify code via AC_USE_SYSTEM_EXTENSIONS (5740003) Message-ID: <20160419213716.EEC613A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5740003e06f0c585460501514f3352f5e105c98c/unix >--------------------------------------------------------------- commit 5740003e06f0c585460501514f3352f5e105c98c Author: Herbert Valerio Riedel Date: Thu Dec 3 22:25:13 2015 +0100 Simplify code via AC_USE_SYSTEM_EXTENSIONS `AC_USE_SYSTEM_EXTENSIONS` takes care of defining feature_test_macros(7) thereby allowing us to remove a few manual `#define`s >--------------------------------------------------------------- 5740003e06f0c585460501514f3352f5e105c98c cbits/dirUtils.c | 11 ----------- cbits/execvpe.c | 4 ---- configure.ac | 3 +++ include/HsUnix.h | 4 ---- include/execvpe.h | 1 - 5 files changed, 3 insertions(+), 20 deletions(-) diff --git a/cbits/dirUtils.c b/cbits/dirUtils.c index 6fc0830..0a645eb 100644 --- a/cbits/dirUtils.c +++ b/cbits/dirUtils.c @@ -4,17 +4,6 @@ * Directory Runtime Support */ -/* needed only for solaris2_HOST_OS */ -#ifdef __GLASGOW_HASKELL__ -#include "ghcconfig.h" -#endif - -// The following is required on Solaris to force the POSIX versions of -// the various _r functions instead of the Solaris versions. -#ifdef solaris2_HOST_OS -#define _POSIX_PTHREAD_SEMANTICS -#endif - #include "HsUnix.h" /* diff --git a/cbits/execvpe.c b/cbits/execvpe.c index c27bca9..82e1bdc 100644 --- a/cbits/execvpe.c +++ b/cbits/execvpe.c @@ -11,10 +11,6 @@ #include "HsUnixConfig.h" -#if HAVE_EXECVPE -# define _GNU_SOURCE -#endif - #include #include #if HAVE_SYS_WAIT_H diff --git a/configure.ac b/configure.ac index c63b45b..8738680 100644 --- a/configure.ac +++ b/configure.ac @@ -1,8 +1,11 @@ AC_INIT([Haskell unix package], [2.0], [libraries at haskell.org], [unix]) +AC_PREREQ([2.60]) # Safety check: Ensure that we are in the correct source directory. AC_CONFIG_SRCDIR([include/HsUnix.h]) +AC_USE_SYSTEM_EXTENSIONS + AC_ARG_WITH([cc], [C compiler], [CC=$withval]) diff --git a/include/HsUnix.h b/include/HsUnix.h index ba3e053..cfdddb4 100644 --- a/include/HsUnix.h +++ b/include/HsUnix.h @@ -19,10 +19,6 @@ #undef PACKAGE_TARNAME #undef PACKAGE_VERSION -#ifdef solaris2_HOST_OS -#define _POSIX_PTHREAD_SEMANTICS -#endif - #include #include diff --git a/include/execvpe.h b/include/execvpe.h index 1fd2fbb..63cd042 100644 --- a/include/execvpe.h +++ b/include/execvpe.h @@ -14,7 +14,6 @@ __hsunix_execvpe(const char *name, char *const argv[], char *const envp[]); #ifndef HSUNIX_EXECVPE_H_NO_COMPAT #include "HsUnixConfig.h" #if HAVE_EXECVPE -# define _GNU_SOURCE # include extern int execvpe(const char *name, char *const argv[], char *const envp[]); From git at git.haskell.org Tue Apr 19 21:37:19 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:37:19 +0000 (UTC) Subject: [commit: packages/unix] master: Tweak use of AC_USE_SYSTEM_EXTENSIONS (147630c) Message-ID: <20160419213719.01A433A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/147630c7c76bd9b947524ef140d21b9e81967c6e/unix >--------------------------------------------------------------- commit 147630c7c76bd9b947524ef140d21b9e81967c6e Author: Herbert Valerio Riedel Date: Sun Dec 6 17:06:41 2015 +0100 Tweak use of AC_USE_SYSTEM_EXTENSIONS This is a follow-up tweak to 5740003e06f0c585460501514f3352f5e105c98c It's better to move AC_USE_SYSTEM_EXTENSIONS after `AC_PROG_CC` as this avoids triggering edundant tests >--------------------------------------------------------------- 147630c7c76bd9b947524ef140d21b9e81967c6e configure.ac | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 8738680..2c1b1ab 100644 --- a/configure.ac +++ b/configure.ac @@ -1,16 +1,17 @@ -AC_INIT([Haskell unix package], [2.0], [libraries at haskell.org], [unix]) AC_PREREQ([2.60]) +AC_INIT([Haskell unix package], [2.0], [libraries at haskell.org], [unix]) # Safety check: Ensure that we are in the correct source directory. AC_CONFIG_SRCDIR([include/HsUnix.h]) -AC_USE_SYSTEM_EXTENSIONS - AC_ARG_WITH([cc], [C compiler], [CC=$withval]) AC_PROG_CC() +dnl make extensions visible to allow feature-tests to detect them lateron +AC_USE_SYSTEM_EXTENSIONS + AC_CONFIG_HEADERS([include/HsUnixConfig.h]) # Is this a Unix system? From git at git.haskell.org Tue Apr 19 21:37:21 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:37:21 +0000 (UTC) Subject: [commit: packages/unix] master: Remove obsolete `--with-cc` flag from configure.ac (59edb0a) Message-ID: <20160419213721.082553A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/59edb0a0a0d91ecfe938029b3b00a0c99dcb8481/unix >--------------------------------------------------------------- commit 59edb0a0a0d91ecfe938029b3b00a0c99dcb8481 Author: Herbert Valerio Riedel Date: Mon Dec 14 08:01:31 2015 +0100 Remove obsolete `--with-cc` flag from configure.ac This non-standard flag was used previously by GHC's build-system to set the `CC` variable. See https://phabricator.haskell.org/D1608 for more details >--------------------------------------------------------------- 59edb0a0a0d91ecfe938029b3b00a0c99dcb8481 configure.ac | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 2c1b1ab..c363e10 100644 --- a/configure.ac +++ b/configure.ac @@ -4,10 +4,7 @@ AC_INIT([Haskell unix package], [2.0], [libraries at haskell.org], [unix]) # Safety check: Ensure that we are in the correct source directory. AC_CONFIG_SRCDIR([include/HsUnix.h]) -AC_ARG_WITH([cc], - [C compiler], - [CC=$withval]) -AC_PROG_CC() +AC_PROG_CC dnl make extensions visible to allow feature-tests to detect them lateron AC_USE_SYSTEM_EXTENSIONS From git at git.haskell.org Tue Apr 19 21:37:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:37:23 +0000 (UTC) Subject: [commit: packages/unix] master: Improve detection of `fdatasync(2)` (5d5b747) Message-ID: <20160419213723.0E6FF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5d5b74716b696b0f22c37a88ccc5c114b13f0398/unix >--------------------------------------------------------------- commit 5d5b74716b696b0f22c37a88ccc5c114b13f0398 Author: Herbert Valerio Riedel Date: Wed Dec 16 17:28:40 2015 +0100 Improve detection of `fdatasync(2)` This attempts a simpler and hopefully more robust test for `fdatasync(2)` See 94d8824bae10c9d91f56c1aee9c45a90136a1770 / #42 for the previous attempt. This hopefully addresses #52 in a better way than #53 >--------------------------------------------------------------- 5d5b74716b696b0f22c37a88ccc5c114b13f0398 changelog.md | 2 ++ configure.ac | 23 ++++++----------------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/changelog.md b/changelog.md index e5733c2..e9c4ece 100644 --- a/changelog.md +++ b/changelog.md @@ -9,6 +9,8 @@ * Turn build error into compile warnings for exotic `struct stat` configurations (GHC #8859). + * Improve detection of `fdatasync(2)` (GHC #11137) + ## 2.7.1.0 *Dec 2014* * Bundled with GHC 7.10.1 diff --git a/configure.ac b/configure.ac index c363e10..24ea3a5 100644 --- a/configure.ac +++ b/configure.ac @@ -71,23 +71,12 @@ AC_CHECK_FUNCS([mkstemps mkdtemp]) # Functions for file synchronization and allocation control AC_CHECK_FUNCS([fsync]) -# A more comprehensive check that fdatasync exits -# Necessary for platforms that have fdatasync in headers but have no -# implementation -dnl Originally provided by user copiousfreetime for the beanstalkd project -dnl {{{ make sure that fdatasync exits -AC_CACHE_CHECK([for fdatasync],[ac_cv_func_fdatasync],[ - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#include -]],[[ -fdatasync(4); -]])], -[ac_cv_func_fdatasync=yes], -[ac_cv_func_fdatasync=no]) -]) -AS_IF([test "x${ac_cv_func_fdatasync}" = "xyes"], - [AC_DEFINE([HAVE_FDATASYNC],[1],[If the system defines fdatasync])]) -dnl }}} +# On OSX linking against 'fdatasync' succeeds, but that doesn't pick +# the expected the POSIX 'fdatasync' function. So make sure that we +# also have a function declaration in scope, in addition to being able +# to link against 'fdatasync'. +AC_CHECK_DECLS([fdatasync],[AC_CHECK_FUNCS([fdatasync])]) + AC_CHECK_FUNCS([posix_fadvise posix_fallocate]) From git at git.haskell.org Tue Apr 19 21:37:25 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:37:25 +0000 (UTC) Subject: [commit: packages/unix] master: Relax upper bound to allow time-1.6 release (4f3b5d8) Message-ID: <20160419213725.1425F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4f3b5d8b87eef07d8df62a8d7240830bb81a8a6b/unix >--------------------------------------------------------------- commit 4f3b5d8b87eef07d8df62a8d7240830bb81a8a6b Author: Herbert Valerio Riedel Date: Sun Dec 20 10:17:48 2015 +0100 Relax upper bound to allow time-1.6 release >--------------------------------------------------------------- 4f3b5d8b87eef07d8df62a8d7240830bb81a8a6b unix.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unix.cabal b/unix.cabal index e920712..e4a2aee 100644 --- a/unix.cabal +++ b/unix.cabal @@ -61,7 +61,7 @@ library build-depends: base >= 4.5 && < 4.10, bytestring >= 0.9.2 && < 0.11, - time >= 1.2 && < 1.6 + time >= 1.2 && < 1.7 exposed-modules: System.Posix From git at git.haskell.org Tue Apr 19 21:37:27 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:37:27 +0000 (UTC) Subject: [commit: packages/unix] master: Don't assume `tcdrain` and `ctermid` exist always (d17b03d) Message-ID: <20160419213727.1B18E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d17b03d4d4525103f1995441045eae4c2c73355d/unix >--------------------------------------------------------------- commit d17b03d4d4525103f1995441045eae4c2c73355d Author: Herbert Valerio Riedel Date: Sat Jan 30 16:46:56 2016 +0100 Don't assume `tcdrain` and `ctermid` exist always This follows the scheme suggested in #24 This fixes #55 >--------------------------------------------------------------- d17b03d4d4525103f1995441045eae4c2c73355d System/Posix/Terminal.hsc | 18 +++++++++++++++++- System/Posix/Terminal/ByteString.hsc | 17 ++++++++++++++++- System/Posix/Terminal/Common.hsc | 16 +++++++++++++++- changelog.md | 4 +++- configure.ac | 13 +++++++++++++ 5 files changed, 64 insertions(+), 4 deletions(-) diff --git a/System/Posix/Terminal.hsc b/System/Posix/Terminal.hsc index c8335a6..88bd93f 100644 --- a/System/Posix/Terminal.hsc +++ b/System/Posix/Terminal.hsc @@ -1,3 +1,4 @@ +{-# LANGUAGE CApiFFI #-} #if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-} #elif __GLASGOW_HASKELL__ >= 703 @@ -83,6 +84,11 @@ import System.Posix.IO import System.Posix.Internals (peekFilePath) +#if !HAVE_CTERMID +import System.IO.Error ( ioeSetLocation ) +import GHC.IO.Exception ( unsupportedOperation ) +#endif + -- | @getTerminalName fd@ calls @ttyname@ to obtain a name associated -- with the terminal for @Fd@ @fd at . If @fd@ is associated -- with a terminal, @getTerminalName@ returns the name of the @@ -100,13 +106,23 @@ foreign import ccall unsafe "ttyname" -- controlling terminal exists, -- @getControllingTerminalName@ returns the name of the -- controlling terminal. +-- +-- Throws 'IOError' (\"unsupported operation\") if platform does not +-- provide @ctermid(3)@ (use @#if HAVE_CTERMID@ CPP guard to +-- detect availability). getControllingTerminalName :: IO FilePath +#if HAVE_CTERMID getControllingTerminalName = do s <- throwErrnoIfNull "getControllingTerminalName" (c_ctermid nullPtr) peekFilePath s -foreign import ccall unsafe "ctermid" +foreign import capi unsafe "termios.h ctermid" c_ctermid :: CString -> IO CString +#else +{-# WARNING getControllingTerminalName + "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_CTERMID@)" #-} +getControllingTerminalName = ioError (ioeSetLocation unsupportedOperation "getControllingTerminalName") +#endif -- | @getSlaveTerminalName@ calls @ptsname@ to obtain the name of the -- slave terminal associated with a pseudoterminal pair. The file diff --git a/System/Posix/Terminal/ByteString.hsc b/System/Posix/Terminal/ByteString.hsc index fd44c85..3c7abfb 100644 --- a/System/Posix/Terminal/ByteString.hsc +++ b/System/Posix/Terminal/ByteString.hsc @@ -1,3 +1,4 @@ +{-# LANGUAGE CApiFFI #-} #if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-} #elif __GLASGOW_HASKELL__ >= 703 @@ -91,6 +92,10 @@ import Foreign.C hiding ( import System.Posix.ByteString.FilePath +#if !HAVE_CTERMID +import System.IO.Error ( ioeSetLocation ) +import GHC.IO.Exception ( unsupportedOperation ) +#endif -- | @getTerminalName fd@ calls @ttyname@ to obtain a name associated -- with the terminal for @Fd@ @fd at . If @fd@ is associated @@ -109,13 +114,23 @@ foreign import ccall unsafe "ttyname" -- controlling terminal exists, -- @getControllingTerminalName@ returns the name of the -- controlling terminal. +-- +-- Throws 'IOError' (\"unsupported operation\") if platform does not +-- provide @ctermid(3)@ (use @#if HAVE_CTERMID@ CPP guard to +-- detect availability). getControllingTerminalName :: IO RawFilePath +#if HAVE_CTERMID getControllingTerminalName = do s <- throwErrnoIfNull "getControllingTerminalName" (c_ctermid nullPtr) peekFilePath s -foreign import ccall unsafe "ctermid" +foreign import capi unsafe "termios.h ctermid" c_ctermid :: CString -> IO CString +#else +{-# WARNING getControllingTerminalName + "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_CTERMID@)" #-} +getControllingTerminalName = ioError (ioeSetLocation unsupportedOperation "getControllingTerminalName") +#endif -- | @getSlaveTerminalName@ calls @ptsname@ to obtain the name of the -- slave terminal associated with a pseudoterminal pair. The file diff --git a/System/Posix/Terminal/Common.hsc b/System/Posix/Terminal/Common.hsc index 49418f5..4825b10 100644 --- a/System/Posix/Terminal/Common.hsc +++ b/System/Posix/Terminal/Common.hsc @@ -78,6 +78,11 @@ import Foreign.Storable ( Storable(..) ) import System.IO.Unsafe ( unsafePerformIO ) import System.Posix.Types +#if !HAVE_TCDRAIN +import System.IO.Error ( ioeSetLocation ) +import GHC.IO.Exception ( unsupportedOperation ) +#endif + -- ----------------------------------------------------------------------------- -- Terminal attributes @@ -408,12 +413,21 @@ foreign import capi unsafe "termios.h tcsendbreak" -- | @drainOutput fd@ calls @tcdrain@ to block until all output -- written to @Fd@ @fd@ has been transmitted. +-- +-- Throws 'IOError' (\"unsupported operation\") if platform does not +-- provide @tcdrain(3)@ (use @#if HAVE_TCDRAIN@ CPP guard to +-- detect availability). drainOutput :: Fd -> IO () +#if HAVE_TCDRAIN drainOutput (Fd fd) = throwErrnoIfMinus1_ "drainOutput" (c_tcdrain fd) foreign import capi unsafe "termios.h tcdrain" c_tcdrain :: CInt -> IO CInt - +#else +{-# WARNING drainOutput + "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_TCDRAIN@)" #-} +drainOutput _ = ioError (ioeSetLocation unsupportedOperation "drainOutput") +#endif data QueueSelector = InputQueue -- TCIFLUSH diff --git a/changelog.md b/changelog.md index e9c4ece..c6d6b69 100644 --- a/changelog.md +++ b/changelog.md @@ -4,7 +4,9 @@ * Don't assume non-POSIX `WCOREDUMP(x)` macro exists - * Don't assume existence of termios constants beyond `B38400` + * Don't assume existence of `termios(3)` constants beyond `B38400` + + * Don't assume existence of `ctermid(3)`/`tcdrain(3)` * Turn build error into compile warnings for exotic `struct stat` configurations (GHC #8859). diff --git a/configure.ac b/configure.ac index 24ea3a5..f883624 100644 --- a/configure.ac +++ b/configure.ac @@ -80,6 +80,19 @@ AC_CHECK_DECLS([fdatasync],[AC_CHECK_FUNCS([fdatasync])]) AC_CHECK_FUNCS([posix_fadvise posix_fallocate]) +# Some termios(3) functions known to be missing sometimes (see also #55) +AC_CHECK_DECLS([tcdrain],[AC_DEFINE([HAVE_TCDRAIN],[1],[Define to 1 if you have the `tcdrain' function.])],[],[AC_INCLUDES_DEFAULT +#ifdef HAVE_TERMIOS_H +#include +#endif +]) + +AC_CHECK_DECLS([ctermid],[AC_DEFINE([HAVE_CTERMID],[1],[Define to 1 if you have the `ctermid' function.])],[],[AC_INCLUDES_DEFAULT +#ifdef HAVE_TERMIOS_H +#include +#endif +]) + # Avoid adding rt if absent or unneeded # shm_open needs -lrt on linux AC_SEARCH_LIBS(shm_open, rt, [AC_CHECK_FUNCS([shm_open shm_unlink])]) From git at git.haskell.org Tue Apr 19 21:37:29 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:37:29 +0000 (UTC) Subject: [commit: packages/unix] master: Change `drainOutput`'s `tcdrain(3)` into a `safe` FFI call (5db88aa) Message-ID: <20160419213729.21B633A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5db88aa16bdda504f4bc00fadcd2e27d55c2f63e/unix >--------------------------------------------------------------- commit 5db88aa16bdda504f4bc00fadcd2e27d55c2f63e Author: Herbert Valerio Riedel Date: Sat Jan 30 16:58:31 2016 +0100 Change `drainOutput`'s `tcdrain(3)` into a `safe` FFI call Since the primary purpose of `tcdrain(3)` is to block it makes much more sense to use a `safe` FFI import. >--------------------------------------------------------------- 5db88aa16bdda504f4bc00fadcd2e27d55c2f63e System/Posix/Terminal/Common.hsc | 2 +- changelog.md | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/System/Posix/Terminal/Common.hsc b/System/Posix/Terminal/Common.hsc index 4825b10..68ce321 100644 --- a/System/Posix/Terminal/Common.hsc +++ b/System/Posix/Terminal/Common.hsc @@ -421,7 +421,7 @@ drainOutput :: Fd -> IO () #if HAVE_TCDRAIN drainOutput (Fd fd) = throwErrnoIfMinus1_ "drainOutput" (c_tcdrain fd) -foreign import capi unsafe "termios.h tcdrain" +foreign import capi safe "termios.h tcdrain" c_tcdrain :: CInt -> IO CInt #else {-# WARNING drainOutput diff --git a/changelog.md b/changelog.md index c6d6b69..1105cba 100644 --- a/changelog.md +++ b/changelog.md @@ -8,8 +8,10 @@ * Don't assume existence of `ctermid(3)`/`tcdrain(3)` + * Change `drainOutput`'s `tcdrain(3)` into a `safe` FFI call + * Turn build error into compile warnings for exotic `struct stat` - configurations (GHC #8859). + configurations (GHC #8859) * Improve detection of `fdatasync(2)` (GHC #11137) From git at git.haskell.org Tue Apr 19 21:37:31 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:37:31 +0000 (UTC) Subject: [commit: packages/unix] master: Replace `__hsunix_opendir` wrapper with CApiFFI (c41080e) Message-ID: <20160419213731.27E8D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c41080e2f7802e269a12f6511f1846f4740e5300/unix >--------------------------------------------------------------- commit c41080e2f7802e269a12f6511f1846f4740e5300 Author: Herbert Valerio Riedel Date: Sat Jan 30 17:16:28 2016 +0100 Replace `__hsunix_opendir` wrapper with CApiFFI >--------------------------------------------------------------- c41080e2f7802e269a12f6511f1846f4740e5300 System/Posix/Directory.hsc | 3 ++- System/Posix/Directory/ByteString.hsc | 3 ++- cbits/HsUnix.c | 6 ------ include/HsUnix.h | 3 --- 4 files changed, 4 insertions(+), 11 deletions(-) diff --git a/System/Posix/Directory.hsc b/System/Posix/Directory.hsc index 7518b4b..7a3d52a 100644 --- a/System/Posix/Directory.hsc +++ b/System/Posix/Directory.hsc @@ -1,3 +1,4 @@ +{-# LANGUAGE CApiFFI #-} {-# LANGUAGE NondecreasingIndentation #-} #ifdef __GLASGOW_HASKELL__ {-# LANGUAGE Trustworthy #-} @@ -73,7 +74,7 @@ openDirStream name = dirp <- throwErrnoPathIfNullRetry "openDirStream" name $ c_opendir s return (DirStream dirp) -foreign import ccall unsafe "__hsunix_opendir" +foreign import capi unsafe "HsUnix.h opendir" c_opendir :: CString -> IO (Ptr CDir) -- | @readDirStream dp@ calls @readdir@ to obtain the diff --git a/System/Posix/Directory/ByteString.hsc b/System/Posix/Directory/ByteString.hsc index b1db079..b67ad46 100644 --- a/System/Posix/Directory/ByteString.hsc +++ b/System/Posix/Directory/ByteString.hsc @@ -1,3 +1,4 @@ +{-# LANGUAGE CApiFFI #-} {-# LANGUAGE NondecreasingIndentation #-} #ifdef __GLASGOW_HASKELL__ {-# LANGUAGE Trustworthy #-} @@ -74,7 +75,7 @@ openDirStream name = dirp <- throwErrnoPathIfNullRetry "openDirStream" name $ c_opendir s return (DirStream dirp) -foreign import ccall unsafe "__hsunix_opendir" +foreign import capi unsafe "HsUnix.h opendir" c_opendir :: CString -> IO (Ptr CDir) -- | @readDirStream dp@ calls @readdir@ to obtain the diff --git a/cbits/HsUnix.c b/cbits/HsUnix.c index 13ca64b..039203e 100644 --- a/cbits/HsUnix.c +++ b/cbits/HsUnix.c @@ -76,12 +76,6 @@ int __hsunix_nanosleep(const struct timespec *rqtp, struct timespec *rmtp) } #endif -// opendir is a macro on some platforms, so we need a wrapper: -DIR *__hsunix_opendir(const char *filename) -{ - return opendir(filename); -} - // time is a macro on some platforms, so we need a wrapper: time_t __hsunix_time(time_t *tloc) { diff --git a/include/HsUnix.h b/include/HsUnix.h index cfdddb4..72613b6 100644 --- a/include/HsUnix.h +++ b/include/HsUnix.h @@ -143,9 +143,6 @@ int __hsunix_getpwuid_r(uid_t, struct passwd *, char *, size_t, int __hsunix_nanosleep(const struct timespec *, struct timespec *); #endif -// opendir is a macro on some platforms, so we need a wrapper: -DIR *__hsunix_opendir(const char *); - // time is a macro on some platforms, so we need a wrapper: time_t __hsunix_time(time_t *); From git at git.haskell.org Tue Apr 19 21:37:33 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:37:33 +0000 (UTC) Subject: [commit: packages/unix] master: Replace `__hsunix_time` wrapper with CApiFFI (44a8b52) Message-ID: <20160419213733.2EFC53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/44a8b5240a8766f2561f36400713ea524dd745b0/unix >--------------------------------------------------------------- commit 44a8b5240a8766f2561f36400713ea524dd745b0 Author: Herbert Valerio Riedel Date: Sat Jan 30 17:25:01 2016 +0100 Replace `__hsunix_time` wrapper with CApiFFI >--------------------------------------------------------------- 44a8b5240a8766f2561f36400713ea524dd745b0 System/Posix/{Time.hsc => Time.hs} | 6 +++--- cbits/HsUnix.c | 6 ------ include/HsUnix.h | 3 --- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/System/Posix/Time.hsc b/System/Posix/Time.hs similarity index 92% rename from System/Posix/Time.hsc rename to System/Posix/Time.hs index a28050d..7a2232f 100644 --- a/System/Posix/Time.hsc +++ b/System/Posix/Time.hs @@ -1,3 +1,5 @@ +{-# LANGUAGE CApiFFI #-} +{-# LANGUAGE CPP #-} #if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-} #elif __GLASGOW_HASKELL__ >= 703 @@ -23,8 +25,6 @@ module System.Posix.Time ( -- how much already supported by System.Time? ) where -#include "HsUnix.h" - import System.Posix.Types import Foreign import Foreign.C @@ -37,5 +37,5 @@ import Foreign.C epochTime :: IO EpochTime epochTime = throwErrnoIfMinus1 "epochTime" (c_time nullPtr) -foreign import ccall unsafe "__hsunix_time" +foreign import capi unsafe "HsUnix.h time" c_time :: Ptr CTime -> IO CTime diff --git a/cbits/HsUnix.c b/cbits/HsUnix.c index 039203e..e61f835 100644 --- a/cbits/HsUnix.c +++ b/cbits/HsUnix.c @@ -76,12 +76,6 @@ int __hsunix_nanosleep(const struct timespec *rqtp, struct timespec *rmtp) } #endif -// time is a macro on some platforms, so we need a wrapper: -time_t __hsunix_time(time_t *tloc) -{ - return time(tloc); -} - // times is a macro on some platforms, so we need a wrapper: clock_t __hsunix_times(struct tms *tp) { diff --git a/include/HsUnix.h b/include/HsUnix.h index 72613b6..62d0f31 100644 --- a/include/HsUnix.h +++ b/include/HsUnix.h @@ -143,9 +143,6 @@ int __hsunix_getpwuid_r(uid_t, struct passwd *, char *, size_t, int __hsunix_nanosleep(const struct timespec *, struct timespec *); #endif -// time is a macro on some platforms, so we need a wrapper: -time_t __hsunix_time(time_t *); - // times is a macro on some platforms, so we need a wrapper: clock_t __hsunix_times(struct tms *); From git at git.haskell.org Tue Apr 19 21:37:35 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:37:35 +0000 (UTC) Subject: [commit: packages/unix] master: Replace `__hsunix_times` wrapper with CApiFFI (7fdf4cd) Message-ID: <20160419213735.35F213A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7fdf4cda3b229e2873a46e0482c83f52b714c5fe/unix >--------------------------------------------------------------- commit 7fdf4cda3b229e2873a46e0482c83f52b714c5fe Author: Herbert Valerio Riedel Date: Sat Jan 30 17:31:48 2016 +0100 Replace `__hsunix_times` wrapper with CApiFFI >--------------------------------------------------------------- 7fdf4cda3b229e2873a46e0482c83f52b714c5fe System/Posix/Process/Common.hsc | 3 ++- cbits/HsUnix.c | 6 ------ include/HsUnix.h | 3 --- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/System/Posix/Process/Common.hsc b/System/Posix/Process/Common.hsc index 66e0d20..c13bf5e 100644 --- a/System/Posix/Process/Common.hsc +++ b/System/Posix/Process/Common.hsc @@ -1,3 +1,4 @@ +{-# LANGUAGE CApiFFI #-} {-# LANGUAGE InterruptibleFFI, RankNTypes #-} #ifdef __GLASGOW_HASKELL__ {-# LANGUAGE Trustworthy #-} @@ -213,7 +214,7 @@ getProcessTimes = do type CTms = () -foreign import ccall unsafe "__hsunix_times" +foreign import capi unsafe "HsUnix.h times" c_times :: Ptr CTms -> IO CClock -- ----------------------------------------------------------------------------- diff --git a/cbits/HsUnix.c b/cbits/HsUnix.c index e61f835..66d951d 100644 --- a/cbits/HsUnix.c +++ b/cbits/HsUnix.c @@ -76,12 +76,6 @@ int __hsunix_nanosleep(const struct timespec *rqtp, struct timespec *rmtp) } #endif -// times is a macro on some platforms, so we need a wrapper: -clock_t __hsunix_times(struct tms *tp) -{ - return times(tp); -} - #ifdef HAVE_PTSNAME // I cannot figure out how to make the definitions of the following // functions visible in on Linux. But these definitions diff --git a/include/HsUnix.h b/include/HsUnix.h index 62d0f31..389d877 100644 --- a/include/HsUnix.h +++ b/include/HsUnix.h @@ -143,9 +143,6 @@ int __hsunix_getpwuid_r(uid_t, struct passwd *, char *, size_t, int __hsunix_nanosleep(const struct timespec *, struct timespec *); #endif -// times is a macro on some platforms, so we need a wrapper: -clock_t __hsunix_times(struct tms *); - #ifdef HAVE_PTSNAME // I cannot figure out how to make the definitions of the following // functions visible in on Linux. But these definitions From git at git.haskell.org Tue Apr 19 21:37:37 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:37:37 +0000 (UTC) Subject: [commit: packages/unix] master: Replace `` macro wrappers with CApiFFI (11eb5aa) Message-ID: <20160419213737.3D0233A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/11eb5aabcc3c98eddf1b375c4184fe0df58d7eab/unix >--------------------------------------------------------------- commit 11eb5aabcc3c98eddf1b375c4184fe0df58d7eab Author: Herbert Valerio Riedel Date: Sat Jan 30 17:47:32 2016 +0100 Replace `` macro wrappers with CApiFFI >--------------------------------------------------------------- 11eb5aabcc3c98eddf1b375c4184fe0df58d7eab System/Posix/Process/Internals.hs | 16 +++++++++------- cbits/HsUnix.c | 9 --------- include/HsUnix.h | 7 ------- 3 files changed, 9 insertions(+), 23 deletions(-) diff --git a/System/Posix/Process/Internals.hs b/System/Posix/Process/Internals.hs index 19dc1c1..970bc9f 100644 --- a/System/Posix/Process/Internals.hs +++ b/System/Posix/Process/Internals.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CApiFFI #-} {-# LANGUAGE CPP #-} #ifdef __GLASGOW_HASKELL__ {-# LANGUAGE Trustworthy #-} @@ -56,24 +57,25 @@ decipherWaitStatus wstat = ioError (mkIOError illegalOperationErrorType "waitStatus" Nothing Nothing) -foreign import ccall unsafe "__hsunix_wifexited" + +foreign import capi unsafe "HsUnix.h WIFEXITED" c_WIFEXITED :: CInt -> CInt -foreign import ccall unsafe "__hsunix_wexitstatus" +foreign import capi unsafe "HsUnix.h WEXITSTATUS" c_WEXITSTATUS :: CInt -> CInt -foreign import ccall unsafe "__hsunix_wifsignaled" +foreign import capi unsafe "HsUnix.h WIFSIGNALED" c_WIFSIGNALED :: CInt -> CInt -foreign import ccall unsafe "__hsunix_wtermsig" +foreign import capi unsafe "HsUnix.h WTERMSIG" c_WTERMSIG :: CInt -> CInt -foreign import ccall unsafe "__hsunix_wifstopped" +foreign import capi unsafe "HsUnix.h WIFSTOPPED" c_WIFSTOPPED :: CInt -> CInt -foreign import ccall unsafe "__hsunix_wstopsig" +foreign import capi unsafe "HsUnix.h WSTOPSIG" c_WSTOPSIG :: CInt -> CInt -foreign import ccall unsafe "__hsunix_wcoredump" +foreign import capi unsafe "HsUnix.h WCOREDUMP" c_WCOREDUMP :: CInt -> CInt diff --git a/cbits/HsUnix.c b/cbits/HsUnix.c index 66d951d..8300949 100644 --- a/cbits/HsUnix.c +++ b/cbits/HsUnix.c @@ -8,20 +8,11 @@ #include "HsUnix.h" -int __hsunix_wifexited (int stat) { return WIFEXITED(stat); } -int __hsunix_wexitstatus (int stat) { return WEXITSTATUS(stat); } -int __hsunix_wifsignaled (int stat) { return WIFSIGNALED(stat); } -int __hsunix_wtermsig (int stat) { return WTERMSIG(stat); } -int __hsunix_wifstopped (int stat) { return WIFSTOPPED(stat); } -int __hsunix_wstopsig (int stat) { return WSTOPSIG(stat); } - // not part of POSIX, hence may not be always defined #ifndef WCOREDUMP # define WCOREDUMP(s) 0 #endif -int __hsunix_wcoredump (int stat) { return WCOREDUMP(stat); } - #ifdef HAVE_RTLDNEXT void *__hsunix_rtldNext (void) {return RTLD_NEXT;} #endif diff --git a/include/HsUnix.h b/include/HsUnix.h index 389d877..cfc221f 100644 --- a/include/HsUnix.h +++ b/include/HsUnix.h @@ -94,13 +94,6 @@ extern HsInt nocldstop; extern char **environ; -int __hsunix_wifexited (int stat); -int __hsunix_wexitstatus (int stat); -int __hsunix_wifsignaled (int stat); -int __hsunix_wtermsig (int stat); -int __hsunix_wifstopped (int stat); -int __hsunix_wstopsig (int stat); - #ifdef HAVE_RTLDNEXT void *__hsunix_rtldNext (void); #endif From git at git.haskell.org Tue Apr 19 21:37:39 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:37:39 +0000 (UTC) Subject: [commit: packages/unix] master: Move WCOREDUMP(s) compat `#define` to `HsUnix.h` (2b47647) Message-ID: <20160419213739.42A5F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2b47647ebef1499ceb5e77d7e19c4c8745b473c7/unix >--------------------------------------------------------------- commit 2b47647ebef1499ceb5e77d7e19c4c8745b473c7 Author: Herbert Valerio Riedel Date: Sat Jan 30 18:02:43 2016 +0100 Move WCOREDUMP(s) compat `#define` to `HsUnix.h` Follow-up to 11eb5aabcc3c98eddf1b375c4184fe0df58d7eab >--------------------------------------------------------------- 2b47647ebef1499ceb5e77d7e19c4c8745b473c7 cbits/HsUnix.c | 5 ----- include/HsUnix.h | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cbits/HsUnix.c b/cbits/HsUnix.c index 8300949..a0b15e9 100644 --- a/cbits/HsUnix.c +++ b/cbits/HsUnix.c @@ -8,11 +8,6 @@ #include "HsUnix.h" -// not part of POSIX, hence may not be always defined -#ifndef WCOREDUMP -# define WCOREDUMP(s) 0 -#endif - #ifdef HAVE_RTLDNEXT void *__hsunix_rtldNext (void) {return RTLD_NEXT;} #endif diff --git a/include/HsUnix.h b/include/HsUnix.h index cfc221f..a6bba9a 100644 --- a/include/HsUnix.h +++ b/include/HsUnix.h @@ -108,6 +108,11 @@ fall back to O_FSYNC, which should be the same */ #define O_SYNC O_FSYNC #endif +// not part of POSIX, hence may not be always defined +#ifndef WCOREDUMP +# define WCOREDUMP(s) 0 +#endif + // lstat is a macro on some platforms, so we need a wrapper: int __hsunix_lstat(const char *path, struct stat *buf); From git at git.haskell.org Tue Apr 19 21:37:41 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:37:41 +0000 (UTC) Subject: [commit: packages/unix] master: Replace `__hsunix_lstat` wrapper with CApiFFI (7a2f3f4) Message-ID: <20160419213741.49DAD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7a2f3f41b4492c9d2e846ebd832ba7ddbaf063ac/unix >--------------------------------------------------------------- commit 7a2f3f41b4492c9d2e846ebd832ba7ddbaf063ac Author: Herbert Valerio Riedel Date: Sat Jan 30 18:13:39 2016 +0100 Replace `__hsunix_lstat` wrapper with CApiFFI >--------------------------------------------------------------- 7a2f3f41b4492c9d2e846ebd832ba7ddbaf063ac System/Posix/Files.hsc | 2 +- System/Posix/Files/ByteString.hsc | 2 +- cbits/HsUnix.c | 6 ------ include/HsUnix.h | 5 +---- 4 files changed, 3 insertions(+), 12 deletions(-) diff --git a/System/Posix/Files.hsc b/System/Posix/Files.hsc index b18a8df..2df973d 100644 --- a/System/Posix/Files.hsc +++ b/System/Posix/Files.hsc @@ -187,7 +187,7 @@ getSymbolicLinkStatus path = do throwErrnoPathIfMinus1_ "getSymbolicLinkStatus" path (c_lstat s p) return (FileStatus fp) -foreign import ccall unsafe "__hsunix_lstat" +foreign import capi unsafe "HsUnix.h lstat" c_lstat :: CString -> Ptr CStat -> IO CInt -- | @createNamedPipe fifo mode@ diff --git a/System/Posix/Files/ByteString.hsc b/System/Posix/Files/ByteString.hsc index 3f26f73..e560500 100644 --- a/System/Posix/Files/ByteString.hsc +++ b/System/Posix/Files/ByteString.hsc @@ -193,7 +193,7 @@ getSymbolicLinkStatus path = do throwErrnoPathIfMinus1_ "getSymbolicLinkStatus" path (c_lstat s p) return (FileStatus fp) -foreign import ccall unsafe "__hsunix_lstat" +foreign import capi unsafe "HsUnix.h lstat" c_lstat :: CString -> Ptr CStat -> IO CInt -- | @createNamedPipe fifo mode@ diff --git a/cbits/HsUnix.c b/cbits/HsUnix.c index a0b15e9..74112c0 100644 --- a/cbits/HsUnix.c +++ b/cbits/HsUnix.c @@ -16,12 +16,6 @@ void *__hsunix_rtldNext (void) {return RTLD_NEXT;} void *__hsunix_rtldDefault (void) {return RTLD_DEFAULT;} #endif -// lstat is a macro on some platforms, so we need a wrapper: -int __hsunix_lstat(const char *path, struct stat *buf) -{ - return lstat(path,buf); -} - // mknod is a macro on some platforms, so we need a wrapper: int __hsunix_mknod(const char *pathname, mode_t mode, dev_t dev) { diff --git a/include/HsUnix.h b/include/HsUnix.h index a6bba9a..def34ca 100644 --- a/include/HsUnix.h +++ b/include/HsUnix.h @@ -113,10 +113,7 @@ fall back to O_FSYNC, which should be the same */ # define WCOREDUMP(s) 0 #endif -// lstat is a macro on some platforms, so we need a wrapper: -int __hsunix_lstat(const char *path, struct stat *buf); - -// lstat is a macro on some platforms, so we need a wrapper: +// mknod is a macro on some platforms, so we need a wrapper: int __hsunix_mknod(const char *pathname, mode_t mode, dev_t dev); #ifdef HAVE_GETPWENT From git at git.haskell.org Tue Apr 19 21:37:43 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:37:43 +0000 (UTC) Subject: [commit: packages/unix] master: Replace `__hsunix_mknod` wrapper with CApiFFI (cca358b) Message-ID: <20160419213743.50C723A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cca358b86edc72bcb641fca362960917783b599e/unix >--------------------------------------------------------------- commit cca358b86edc72bcb641fca362960917783b599e Author: Herbert Valerio Riedel Date: Sat Jan 30 18:17:00 2016 +0100 Replace `__hsunix_mknod` wrapper with CApiFFI >--------------------------------------------------------------- cca358b86edc72bcb641fca362960917783b599e System/Posix/Files.hsc | 2 +- System/Posix/Files/ByteString.hsc | 2 +- cbits/HsUnix.c | 6 ------ include/HsUnix.h | 3 --- 4 files changed, 2 insertions(+), 11 deletions(-) diff --git a/System/Posix/Files.hsc b/System/Posix/Files.hsc index 2df973d..d0ff4bf 100644 --- a/System/Posix/Files.hsc +++ b/System/Posix/Files.hsc @@ -215,7 +215,7 @@ createDevice path mode dev = withFilePath path $ \s -> throwErrnoPathIfMinus1_ "createDevice" path (c_mknod s mode dev) -foreign import ccall unsafe "__hsunix_mknod" +foreign import capi unsafe "HsUnix.h mknod" c_mknod :: CString -> CMode -> CDev -> IO CInt -- ----------------------------------------------------------------------------- diff --git a/System/Posix/Files/ByteString.hsc b/System/Posix/Files/ByteString.hsc index e560500..12bd39a 100644 --- a/System/Posix/Files/ByteString.hsc +++ b/System/Posix/Files/ByteString.hsc @@ -221,7 +221,7 @@ createDevice path mode dev = withFilePath path $ \s -> throwErrnoPathIfMinus1_ "createDevice" path (c_mknod s mode dev) -foreign import ccall unsafe "__hsunix_mknod" +foreign import capi unsafe "HsUnix.h mknod" c_mknod :: CString -> CMode -> CDev -> IO CInt -- ----------------------------------------------------------------------------- diff --git a/cbits/HsUnix.c b/cbits/HsUnix.c index 74112c0..dc42098 100644 --- a/cbits/HsUnix.c +++ b/cbits/HsUnix.c @@ -16,12 +16,6 @@ void *__hsunix_rtldNext (void) {return RTLD_NEXT;} void *__hsunix_rtldDefault (void) {return RTLD_DEFAULT;} #endif -// mknod is a macro on some platforms, so we need a wrapper: -int __hsunix_mknod(const char *pathname, mode_t mode, dev_t dev) -{ - return mknod(pathname,mode,dev); -} - #ifdef HAVE_GETPWENT // getpwent is a macro on some platforms, so we need a wrapper: struct passwd *__hsunix_getpwent(void) diff --git a/include/HsUnix.h b/include/HsUnix.h index def34ca..87ac3e6 100644 --- a/include/HsUnix.h +++ b/include/HsUnix.h @@ -113,9 +113,6 @@ fall back to O_FSYNC, which should be the same */ # define WCOREDUMP(s) 0 #endif -// mknod is a macro on some platforms, so we need a wrapper: -int __hsunix_mknod(const char *pathname, mode_t mode, dev_t dev); - #ifdef HAVE_GETPWENT // getpwent is a macro on some platforms, so we need a wrapper: struct passwd *__hsunix_getpwent(void); From git at git.haskell.org Tue Apr 19 21:37:45 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:37:45 +0000 (UTC) Subject: [commit: packages/unix] master: Replace `__hsunix_getpwent` wrapper with CApiFFI (03783d2) Message-ID: <20160419213745.5774B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/03783d2758d2f35c01a8570da30f508c3b9e019b/unix >--------------------------------------------------------------- commit 03783d2758d2f35c01a8570da30f508c3b9e019b Author: Herbert Valerio Riedel Date: Sat Jan 30 18:23:15 2016 +0100 Replace `__hsunix_getpwent` wrapper with CApiFFI >--------------------------------------------------------------- 03783d2758d2f35c01a8570da30f508c3b9e019b System/Posix/User.hsc | 6 +++--- cbits/HsUnix.c | 8 -------- include/HsUnix.h | 5 ----- 3 files changed, 3 insertions(+), 16 deletions(-) diff --git a/System/Posix/User.hsc b/System/Posix/User.hsc index d1a794a..3e11389 100644 --- a/System/Posix/User.hsc +++ b/System/Posix/User.hsc @@ -378,11 +378,11 @@ getAllUserEntries = else do thisentry <- unpackUserEntry ppw worker (thisentry : accum) -foreign import ccall unsafe "__hsunix_getpwent" +foreign import capi unsafe "HsUnix.h getpwent" c_getpwent :: IO (Ptr CPasswd) -foreign import ccall unsafe "setpwent" +foreign import capi unsafe "HsUnix.h setpwent" c_setpwent :: IO () -foreign import ccall unsafe "endpwent" +foreign import capi unsafe "HsUnix.h endpwent" c_endpwent :: IO () #else getAllUserEntries = error "System.Posix.User.getAllUserEntries: not supported" diff --git a/cbits/HsUnix.c b/cbits/HsUnix.c index dc42098..fb63b45 100644 --- a/cbits/HsUnix.c +++ b/cbits/HsUnix.c @@ -16,14 +16,6 @@ void *__hsunix_rtldNext (void) {return RTLD_NEXT;} void *__hsunix_rtldDefault (void) {return RTLD_DEFAULT;} #endif -#ifdef HAVE_GETPWENT -// getpwent is a macro on some platforms, so we need a wrapper: -struct passwd *__hsunix_getpwent(void) -{ - return getpwent(); -} -#endif - #if HAVE_GETPWNAM_R // getpwnam_r is a macro on some platforms, so we need a wrapper: int __hsunix_getpwnam_r(const char *name, struct passwd *pw, char *buffer, diff --git a/include/HsUnix.h b/include/HsUnix.h index 87ac3e6..8b468b7 100644 --- a/include/HsUnix.h +++ b/include/HsUnix.h @@ -113,11 +113,6 @@ fall back to O_FSYNC, which should be the same */ # define WCOREDUMP(s) 0 #endif -#ifdef HAVE_GETPWENT -// getpwent is a macro on some platforms, so we need a wrapper: -struct passwd *__hsunix_getpwent(void); -#endif - #if HAVE_GETPWNAM_R // getpwnam_r is a macro on some platforms, so we need a wrapper: int __hsunix_getpwnam_r(const char *, struct passwd *, char *, size_t, From git at git.haskell.org Tue Apr 19 21:37:47 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:37:47 +0000 (UTC) Subject: [commit: packages/unix] master: Add CTYPE annotations to ptr types used for FFI (731f7dd) Message-ID: <20160419213747.602603A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/731f7dddcbae3c4332beac742605dade2d4a80ad/unix >--------------------------------------------------------------- commit 731f7dddcbae3c4332beac742605dade2d4a80ad Author: Herbert Valerio Riedel Date: Sat Jan 30 19:44:58 2016 +0100 Add CTYPE annotations to ptr types used for FFI This avoids incompatible-pointer warnings from the c-compiler when using `CApiFFI` >--------------------------------------------------------------- 731f7dddcbae3c4332beac742605dade2d4a80ad System/Posix/Directory/Common.hsc | 4 ++-- System/Posix/IO/Common.hsc | 6 ++---- System/Posix/Process/Common.hsc | 2 +- System/Posix/Resource.hsc | 2 +- System/Posix/Terminal/Common.hsc | 2 +- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/System/Posix/Directory/Common.hsc b/System/Posix/Directory/Common.hsc index 4ea8f78..9fb5ac4 100644 --- a/System/Posix/Directory/Common.hsc +++ b/System/Posix/Directory/Common.hsc @@ -39,8 +39,8 @@ import Foreign.C newtype DirStream = DirStream (Ptr CDir) -type CDir = () -type CDirent = () +data {-# CTYPE "DIR" #-} CDir +data {-# CTYPE "struct dirent" #-} CDirent -- | @rewindDirStream dp@ calls @rewinddir@ to reposition -- the directory stream @dp@ at the beginning of the directory. diff --git a/System/Posix/IO/Common.hsc b/System/Posix/IO/Common.hsc index 198b3f1..eb4a721 100644 --- a/System/Posix/IO/Common.hsc +++ b/System/Posix/IO/Common.hsc @@ -320,9 +320,7 @@ getLock (Fd fd) lock = maybeResult (_, (Unlock, _, _, _)) = Nothing maybeResult x = Just x -type CFLock = () - -allocaLock :: FileLock -> (Ptr CFLock -> IO a) -> IO a +allocaLock :: FileLock -> (Ptr Base.CFLock -> IO a) -> IO a allocaLock (lockreq, mode, start, len) io = allocaBytes (#const sizeof(struct flock)) $ \p -> do (#poke struct flock, l_type) p (lockReq2Int lockreq :: CShort) @@ -336,7 +334,7 @@ lockReq2Int ReadLock = (#const F_RDLCK) lockReq2Int WriteLock = (#const F_WRLCK) lockReq2Int Unlock = (#const F_UNLCK) -bytes2ProcessIDAndLock :: Ptr CFLock -> IO (ProcessID, FileLock) +bytes2ProcessIDAndLock :: Ptr Base.CFLock -> IO (ProcessID, FileLock) bytes2ProcessIDAndLock p = do req <- (#peek struct flock, l_type) p mode <- (#peek struct flock, l_whence) p diff --git a/System/Posix/Process/Common.hsc b/System/Posix/Process/Common.hsc index c13bf5e..ee7310e 100644 --- a/System/Posix/Process/Common.hsc +++ b/System/Posix/Process/Common.hsc @@ -212,7 +212,7 @@ getProcessTimes = do childSystemTime = cst }) -type CTms = () +data {-# CTYPE "struct tms" #-} CTms foreign import capi unsafe "HsUnix.h times" c_times :: Ptr CTms -> IO CClock diff --git a/System/Posix/Resource.hsc b/System/Posix/Resource.hsc index 4c5ca48..280c25f 100644 --- a/System/Posix/Resource.hsc +++ b/System/Posix/Resource.hsc @@ -55,7 +55,7 @@ data ResourceLimit | ResourceLimit Integer deriving Eq -type RLimit = () +data {-# CTYPE "struct rlimit" #-} RLimit foreign import ccall unsafe "HsUnix.h __hscore_getrlimit" c_getrlimit :: CInt -> Ptr RLimit -> IO CInt diff --git a/System/Posix/Terminal/Common.hsc b/System/Posix/Terminal/Common.hsc index 68ce321..5d81ec5 100644 --- a/System/Posix/Terminal/Common.hsc +++ b/System/Posix/Terminal/Common.hsc @@ -77,6 +77,7 @@ import Foreign.Ptr ( Ptr, plusPtr ) import Foreign.Storable ( Storable(..) ) import System.IO.Unsafe ( unsafePerformIO ) import System.Posix.Types +import System.Posix.Internals ( CTermios ) #if !HAVE_TCDRAIN import System.IO.Error ( ioeSetLocation ) @@ -86,7 +87,6 @@ import GHC.IO.Exception ( unsupportedOperation ) -- ----------------------------------------------------------------------------- -- Terminal attributes -type CTermios = () newtype TerminalAttributes = TerminalAttributes (ForeignPtr CTermios) makeTerminalAttributes :: ForeignPtr CTermios -> TerminalAttributes From git at git.haskell.org Tue Apr 19 21:37:49 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:37:49 +0000 (UTC) Subject: [commit: packages/unix] master: Remove obsolete windows-related #ifdefs (944b05c) Message-ID: <20160419213749.681FA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/944b05c4aa35378db18cee4fcd4e1f02e67ce645/unix >--------------------------------------------------------------- commit 944b05c4aa35378db18cee4fcd4e1f02e67ce645 Author: Herbert Valerio Riedel Date: Sat Jan 30 22:38:28 2016 +0100 Remove obsolete windows-related #ifdefs We haven't properly supported Windows for some time now, and we wouldn't have any way to test anyway, since GHC doesn't support Cygwin anymore either. >--------------------------------------------------------------- 944b05c4aa35378db18cee4fcd4e1f02e67ce645 System/Posix/Signals.hsc | 5 ----- cbits/HsUnix.c | 6 ++---- include/HsUnix.h | 4 +--- unix.cabal | 2 +- 4 files changed, 4 insertions(+), 13 deletions(-) diff --git a/System/Posix/Signals.hsc b/System/Posix/Signals.hsc index d4c6d51..9119190 100644 --- a/System/Posix/Signals.hsc +++ b/System/Posix/Signals.hsc @@ -86,9 +86,7 @@ module System.Posix.Signals ( -- * Waiting for signals getPendingSignals, -#ifndef cygwin32_HOST_OS awaitSignal, -#endif #ifdef __GLASGOW_HASKELL__ -- * The @NOCLDSTOP@ flag @@ -575,8 +573,6 @@ getPendingSignals = do throwErrnoIfMinus1_ "getPendingSignals" (c_sigpending p) return (SignalSet fp) -#ifndef cygwin32_HOST_OS - -- | @awaitSignal iset@ suspends execution until an interrupt is received. -- If @iset@ is @Just s@, @awaitSignal@ calls @sigsuspend@, installing -- @s@ as the new signal mask before suspending execution; otherwise, it @@ -605,7 +601,6 @@ awaitSignal maybe_sigset = do foreign import ccall unsafe "sigsuspend" c_sigsuspend :: Ptr CSigset -> IO CInt -#endif #ifdef __HUGS__ foreign import ccall unsafe "sigdelset" diff --git a/cbits/HsUnix.c b/cbits/HsUnix.c index fb63b45..49f90e8 100644 --- a/cbits/HsUnix.c +++ b/cbits/HsUnix.c @@ -69,18 +69,16 @@ int __hsunix_unlockpt(int fd) // push a SVR4 STREAMS module; do nothing if STREAMS not available int __hsunix_push_module(int fd, const char *module) { -#if defined(I_PUSH) && !defined(__CYGWIN__) && !defined(HAVE_DEV_PTC) +#if defined(I_PUSH) && !defined(HAVE_DEV_PTC) return ioctl(fd, I_PUSH, module); #else return 0; #endif } -#if !defined(__MINGW32__) int __hscore_mkstemp(char *filetemplate) { return (mkstemp(filetemplate)); } -#endif #if HAVE_MKSTEMPS int __hscore_mkstemps(char *filetemplate, int suffixlen) { @@ -95,7 +93,7 @@ char *__hscore_mkdtemp(char *filetemplate) { #endif -#if !defined(__MINGW32__) && !defined(irix_HOST_OS) +#if !defined(irix_HOST_OS) int __hscore_getrlimit(int resource, struct rlimit *rlim) { return (getrlimit(resource, rlim)); } diff --git a/include/HsUnix.h b/include/HsUnix.h index 8b468b7..e276726 100644 --- a/include/HsUnix.h +++ b/include/HsUnix.h @@ -143,9 +143,7 @@ int __hsunix_unlockpt(int fd); // push a SVR4 STREAMS module; do nothing if STREAMS not available int __hsunix_push_module(int fd, const char *module); -#if !defined(__MINGW32__) int __hscore_mkstemp(char *filetemplate); -#endif #if HAVE_MKSTEMPS int __hscore_mkstemps(char *filetemplate, int suffixlen); @@ -155,7 +153,7 @@ int __hscore_mkstemps(char *filetemplate, int suffixlen); char *__hscore_mkdtemp(char *filetemplate); #endif -#if !defined(__MINGW32__) && !defined(irix_HOST_OS) +#if !defined(irix_HOST_OS) int __hscore_getrlimit(int resource, struct rlimit *rlim); int __hscore_setrlimit(int resource, struct rlimit *rlim); #endif diff --git a/unix.cabal b/unix.cabal index e4a2aee..0ae2772 100644 --- a/unix.cabal +++ b/unix.cabal @@ -17,7 +17,7 @@ description: Operating System Interface for Computing Environments - IEEE Std. 1003.1). . - The package is not supported under Windows (except under Cygwin). + The package is not supported under Windows. extra-source-files: changelog.md From git at git.haskell.org Tue Apr 19 21:37:51 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:37:51 +0000 (UTC) Subject: [commit: packages/unix] master: Drop redundant __GLASGOW_HASKELL__ conditionals for GHC>=7.4 (2a49ad8) Message-ID: <20160419213751.73E643A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2a49ad87b7b5d92bf62035d410c4bcde817d30a6/unix >--------------------------------------------------------------- commit 2a49ad87b7b5d92bf62035d410c4bcde817d30a6 Author: Herbert Valerio Riedel Date: Sat Jan 30 23:14:23 2016 +0100 Drop redundant __GLASGOW_HASKELL__ conditionals for GHC>=7.4 >--------------------------------------------------------------- 2a49ad87b7b5d92bf62035d410c4bcde817d30a6 System/Posix.hs | 2 -- System/Posix/ByteString.hs | 2 -- System/Posix/ByteString/FilePath.hsc | 2 +- System/Posix/Directory.hsc | 2 -- System/Posix/Directory/ByteString.hsc | 2 -- System/Posix/Directory/Common.hsc | 2 +- System/Posix/DynamicLinker.hsc | 2 +- System/Posix/DynamicLinker/ByteString.hsc | 2 +- System/Posix/DynamicLinker/Common.hsc | 2 +- System/Posix/DynamicLinker/Module.hsc | 2 +- System/Posix/DynamicLinker/Module/ByteString.hsc | 2 +- System/Posix/DynamicLinker/Prim.hsc | 3 +-- System/Posix/Env.hsc | 2 +- System/Posix/Env/ByteString.hsc | 2 -- System/Posix/Error.hs | 2 +- System/Posix/Fcntl.hsc | 2 +- System/Posix/Files.hsc | 2 +- System/Posix/Files/ByteString.hsc | 2 +- System/Posix/Files/Common.hsc | 3 +-- System/Posix/IO.hsc | 2 +- System/Posix/IO/ByteString.hsc | 2 +- System/Posix/IO/Common.hsc | 8 ++------ System/Posix/Process.hsc | 4 +--- System/Posix/Process/ByteString.hsc | 4 +--- System/Posix/Process/Common.hsc | 10 +--------- System/Posix/Process/Internals.hs | 2 -- System/Posix/Resource.hsc | 2 +- System/Posix/Semaphore.hsc | 2 +- System/Posix/SharedMem.hsc | 2 +- System/Posix/Signals.hsc | 16 ++-------------- System/Posix/Signals/Exts.hsc | 2 -- System/Posix/Temp.hsc | 12 ++---------- System/Posix/Temp/ByteString.hsc | 12 ++---------- System/Posix/Terminal.hsc | 2 +- System/Posix/Terminal/ByteString.hsc | 2 +- System/Posix/Terminal/Common.hsc | 3 +-- System/Posix/Time.hs | 2 +- System/Posix/Unistd.hsc | 4 +--- System/Posix/User.hsc | 2 -- 39 files changed, 35 insertions(+), 100 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 2a49ad87b7b5d92bf62035d410c4bcde817d30a6 From git at git.haskell.org Tue Apr 19 21:37:53 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:37:53 +0000 (UTC) Subject: [commit: packages/unix] master: Replace `__hscore_{set, get}rlimit` wrappers with CApiFFI (3646040) Message-ID: <20160419213753.79EEF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/364604035c60fe5c21cda2e2f37027ebadc81ebd/unix >--------------------------------------------------------------- commit 364604035c60fe5c21cda2e2f37027ebadc81ebd Author: Herbert Valerio Riedel Date: Sun Jan 31 00:09:09 2016 +0100 Replace `__hscore_{set,get}rlimit` wrappers with CApiFFI >--------------------------------------------------------------- 364604035c60fe5c21cda2e2f37027ebadc81ebd System/Posix/Resource.hsc | 5 +++-- cbits/HsUnix.c | 11 ----------- include/HsUnix.h | 5 ----- 3 files changed, 3 insertions(+), 18 deletions(-) diff --git a/System/Posix/Resource.hsc b/System/Posix/Resource.hsc index 3418ecf..309d394 100644 --- a/System/Posix/Resource.hsc +++ b/System/Posix/Resource.hsc @@ -1,3 +1,4 @@ +{-# LANGUAGE CApiFFI #-} #if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-} #else @@ -57,10 +58,10 @@ data ResourceLimit data {-# CTYPE "struct rlimit" #-} RLimit -foreign import ccall unsafe "HsUnix.h __hscore_getrlimit" +foreign import capi unsafe "HsUnix.h getrlimit" c_getrlimit :: CInt -> Ptr RLimit -> IO CInt -foreign import ccall unsafe "HsUnix.h __hscore_setrlimit" +foreign import capi unsafe "HsUnix.h setrlimit" c_setrlimit :: CInt -> Ptr RLimit -> IO CInt getResourceLimit :: Resource -> IO ResourceLimits diff --git a/cbits/HsUnix.c b/cbits/HsUnix.c index 09cfc9c..55f9679 100644 --- a/cbits/HsUnix.c +++ b/cbits/HsUnix.c @@ -81,17 +81,6 @@ char *__hscore_mkdtemp(char *filetemplate) { } #endif - -#if !defined(irix_HOST_OS) -int __hscore_getrlimit(int resource, struct rlimit *rlim) { - return (getrlimit(resource, rlim)); -} - -int __hscore_setrlimit(int resource, struct rlimit *rlim) { - return (setrlimit(resource, rlim)); -} -#endif - #ifdef HAVE_UNSETENV int __hsunix_unsetenv(const char *name) { diff --git a/include/HsUnix.h b/include/HsUnix.h index 98990b2..093c9e3 100644 --- a/include/HsUnix.h +++ b/include/HsUnix.h @@ -144,11 +144,6 @@ int __hscore_mkstemps(char *filetemplate, int suffixlen); char *__hscore_mkdtemp(char *filetemplate); #endif -#if !defined(irix_HOST_OS) -int __hscore_getrlimit(int resource, struct rlimit *rlim); -int __hscore_setrlimit(int resource, struct rlimit *rlim); -#endif - int __hsunix_unsetenv(const char *name); /* A size that will contain many path names, but not necessarily all From git at git.haskell.org Tue Apr 19 21:37:55 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:37:55 +0000 (UTC) Subject: [commit: packages/unix] master: Drop bitrotting HUGS support (716eccb) Message-ID: <20160419213755.808C13A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/716eccb11f324abc120c24ce0344b7094f1aa435/unix >--------------------------------------------------------------- commit 716eccb11f324abc120c24ce0344b7094f1aa435 Author: Herbert Valerio Riedel Date: Sat Jan 30 22:55:06 2016 +0100 Drop bitrotting HUGS support It's very unlikely the current `unix` code stands any chance of even remotely work with Hugs... >--------------------------------------------------------------- 716eccb11f324abc120c24ce0344b7094f1aa435 System/Posix/IO/Common.hsc | 15 --------------- System/Posix/Process.hsc | 4 ---- System/Posix/Process/ByteString.hsc | 4 ---- System/Posix/Process/Common.hsc | 4 ---- System/Posix/Signals.hsc | 13 ++----------- System/Posix/Temp.hsc | 6 +++--- System/Posix/Temp/ByteString.hsc | 6 +++--- 7 files changed, 8 insertions(+), 44 deletions(-) diff --git a/System/Posix/IO/Common.hsc b/System/Posix/IO/Common.hsc index eb4a721..abcd19b 100644 --- a/System/Posix/IO/Common.hsc +++ b/System/Posix/IO/Common.hsc @@ -79,11 +79,6 @@ import GHC.IO.Exception import Data.Typeable (cast) #endif -#ifdef __HUGS__ -import Hugs.Prelude (IOException(..), IOErrorType(..)) -import qualified Hugs.IO (handleToFd, openFd) -#endif - #include "HsUnix.h" -- ----------------------------------------------------------------------------- @@ -239,16 +234,6 @@ handleToFd' h h_ at Handle__{haType=_,..} = do fdToHandle fd = FD.fdToHandle (fromIntegral fd) #endif -#ifdef __HUGS__ -handleToFd h = do - fd <- Hugs.IO.handleToFd h - return (fromIntegral fd) - -fdToHandle fd = do - mode <- fdGetMode (fromIntegral fd) - Hugs.IO.openFd (fromIntegral fd) False mode True -#endif - -- ----------------------------------------------------------------------------- -- Fd options diff --git a/System/Posix/Process.hsc b/System/Posix/Process.hsc index 42426a3..72da1c6 100644 --- a/System/Posix/Process.hsc +++ b/System/Posix/Process.hsc @@ -78,10 +78,6 @@ import System.Posix.Process.Internals import System.Posix.Process.Common import System.Posix.Internals ( withFilePath ) -#ifdef __HUGS__ -{-# CFILES cbits/HsUnix.c #-} -#endif - -- | @'executeFile' cmd args env@ calls one of the -- @execv*@ family, depending on whether or not the current -- PATH is to be searched for the command, and whether or not an diff --git a/System/Posix/Process/ByteString.hsc b/System/Posix/Process/ByteString.hsc index ee2c9cf..64fc71e 100644 --- a/System/Posix/Process/ByteString.hsc +++ b/System/Posix/Process/ByteString.hsc @@ -90,10 +90,6 @@ import qualified Data.ByteString.Char8 as BC import System.Posix.ByteString.FilePath -#ifdef __HUGS__ -{-# CFILES cbits/HsUnix.c #-} -#endif - -- | @'executeFile' cmd args env@ calls one of the -- @execv*@ family, depending on whether or not the current -- PATH is to be searched for the command, and whether or not an diff --git a/System/Posix/Process/Common.hsc b/System/Posix/Process/Common.hsc index ee7310e..d0d2b09 100644 --- a/System/Posix/Process/Common.hsc +++ b/System/Posix/Process/Common.hsc @@ -88,10 +88,6 @@ import GHC.TopHandler ( runIO ) import GHC.IO ( unsafeUnmask, uninterruptibleMask_ ) #endif -#ifdef __HUGS__ -{-# CFILES cbits/HsUnix.c #-} -#endif - -- ----------------------------------------------------------------------------- -- Process environment diff --git a/System/Posix/Signals.hsc b/System/Posix/Signals.hsc index 9119190..e8fc1c5 100644 --- a/System/Posix/Signals.hsc +++ b/System/Posix/Signals.hsc @@ -602,16 +602,7 @@ awaitSignal maybe_sigset = do foreign import ccall unsafe "sigsuspend" c_sigsuspend :: Ptr CSigset -> IO CInt -#ifdef __HUGS__ -foreign import ccall unsafe "sigdelset" - c_sigdelset :: Ptr CSigset -> CInt -> IO CInt - -foreign import ccall unsafe "sigfillset" - c_sigfillset :: Ptr CSigset -> IO CInt - -foreign import ccall unsafe "sigismember" - c_sigismember :: Ptr CSigset -> CInt -> IO CInt -#elif defined(darwin_HOST_OS) && __GLASGOW_HASKELL__ < 706 +#if defined(darwin_HOST_OS) && __GLASGOW_HASKELL__ < 706 -- see http://ghc.haskell.org/trac/ghc/ticket/7359#comment:3 -- To be removed when support for GHC 7.4.x is dropped foreign import ccall unsafe "__hscore_sigdelset" @@ -631,7 +622,7 @@ foreign import capi unsafe "signal.h sigfillset" foreign import capi unsafe "signal.h sigismember" c_sigismember :: Ptr CSigset -> CInt -> IO CInt -#endif /* __HUGS__ */ +#endif foreign import ccall unsafe "sigpending" c_sigpending :: Ptr CSigset -> IO CInt diff --git a/System/Posix/Temp.hsc b/System/Posix/Temp.hsc index 349030b..2d7ca52 100644 --- a/System/Posix/Temp.hsc +++ b/System/Posix/Temp.hsc @@ -33,7 +33,7 @@ import System.Posix.IO import System.Posix.Types import System.Posix.Internals (withFilePath, peekFilePath) -#if defined(__GLASGOW_HASKELL__) || defined(__HUGS__) +#if defined(__GLASGOW_HASKELL__) foreign import ccall unsafe "HsUnix.h __hscore_mkstemp" c_mkstemp :: CString -> IO CInt #endif @@ -48,7 +48,7 @@ foreign import ccall unsafe "HsUnix.h __hscore_mkstemp" mkstemp :: String -> IO (FilePath, Handle) mkstemp template' = do let template = template' ++ "XXXXXX" -#if defined(__GLASGOW_HASKELL__) || defined(__HUGS__) +#if defined(__GLASGOW_HASKELL__) withFilePath template $ \ ptr -> do fd <- throwErrnoIfMinus1 "mkstemp" (c_mkstemp ptr) name <- peekFilePath ptr @@ -114,7 +114,7 @@ mkdtemp template' = do return name #endif -#if (!defined(__GLASGOW_HASKELL__) && !defined(__HUGS__)) || !HAVE_MKDTEMP +#if !defined(__GLASGOW_HASKELL__) || !HAVE_MKDTEMP foreign import ccall unsafe "mktemp" c_mktemp :: CString -> IO CString diff --git a/System/Posix/Temp/ByteString.hsc b/System/Posix/Temp/ByteString.hsc index 61bd7e9..84ad49e 100644 --- a/System/Posix/Temp/ByteString.hsc +++ b/System/Posix/Temp/ByteString.hsc @@ -38,7 +38,7 @@ import System.Posix.Directory (createDirectory) import System.Posix.IO import System.Posix.Types -#if defined(__GLASGOW_HASKELL__) || defined(__HUGS__) +#if defined(__GLASGOW_HASKELL__) foreign import ccall unsafe "HsUnix.h __hscore_mkstemp" c_mkstemp :: CString -> IO CInt #endif @@ -53,7 +53,7 @@ foreign import ccall unsafe "HsUnix.h __hscore_mkstemp" mkstemp :: ByteString -> IO (RawFilePath, Handle) mkstemp template' = do let template = template' `B.append` (BC.pack "XXXXXX") -#if defined(__GLASGOW_HASKELL__) || defined(__HUGS__) +#if defined(__GLASGOW_HASKELL__) withFilePath template $ \ ptr -> do fd <- throwErrnoIfMinus1 "mkstemp" (c_mkstemp ptr) name <- peekFilePath ptr @@ -114,7 +114,7 @@ mkdtemp template' = do return name #endif -#if (!defined(__GLASGOW_HASKELL__) && !defined(__HUGS__)) || !HAVE_MKDTEMP +#if !defined(__GLASGOW_HASKELL__) || !HAVE_MKDTEMP foreign import ccall unsafe "mktemp" c_mktemp :: CString -> IO CString From git at git.haskell.org Tue Apr 19 21:37:57 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:37:57 +0000 (UTC) Subject: [commit: packages/unix] master: Replace `__hsunix_nanosleep` wrapper with CApiFFI (4c25a0d) Message-ID: <20160419213757.86FE93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4c25a0d4af899b43d557a6d2dc1b4291e5f75659/unix >--------------------------------------------------------------- commit 4c25a0d4af899b43d557a6d2dc1b4291e5f75659 Author: Herbert Valerio Riedel Date: Sat Jan 30 22:42:23 2016 +0100 Replace `__hsunix_nanosleep` wrapper with CApiFFI >--------------------------------------------------------------- 4c25a0d4af899b43d557a6d2dc1b4291e5f75659 System/Posix/Unistd.hsc | 4 ++-- cbits/HsUnix.c | 8 -------- include/HsUnix.h | 5 ----- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/System/Posix/Unistd.hsc b/System/Posix/Unistd.hsc index 3f2d115..7f79113 100644 --- a/System/Posix/Unistd.hsc +++ b/System/Posix/Unistd.hsc @@ -181,9 +181,9 @@ nanosleep nsecs = do else throwErrno "nanosleep" loop (fromIntegral tv_sec0 :: CTime) (fromIntegral tv_nsec0 :: CTime) -data CTimeSpec +data {-# CTYPE "struct timespec" #-} CTimeSpec -foreign import ccall safe "__hsunix_nanosleep" +foreign import capi safe "HsUnix.h nanosleep" c_nanosleep :: Ptr CTimeSpec -> Ptr CTimeSpec -> IO CInt #endif diff --git a/cbits/HsUnix.c b/cbits/HsUnix.c index 49f90e8..e54bccf 100644 --- a/cbits/HsUnix.c +++ b/cbits/HsUnix.c @@ -34,14 +34,6 @@ int __hsunix_getpwuid_r(uid_t uid, struct passwd *pw, char *buffer, } #endif -#ifdef HAVE_NANOSLEEP -// nanosleep is a macro on some platforms, so we need a wrapper: -int __hsunix_nanosleep(const struct timespec *rqtp, struct timespec *rmtp) -{ - return nanosleep(rqtp, rmtp); -} -#endif - #ifdef HAVE_PTSNAME // I cannot figure out how to make the definitions of the following // functions visible in on Linux. But these definitions diff --git a/include/HsUnix.h b/include/HsUnix.h index e276726..7b404fc 100644 --- a/include/HsUnix.h +++ b/include/HsUnix.h @@ -125,11 +125,6 @@ int __hsunix_getpwuid_r(uid_t, struct passwd *, char *, size_t, struct passwd **); #endif -#ifdef HAVE_NANOSLEEP -// nanosleep is a macro on some platforms, so we need a wrapper: -int __hsunix_nanosleep(const struct timespec *, struct timespec *); -#endif - #ifdef HAVE_PTSNAME // I cannot figure out how to make the definitions of the following // functions visible in on Linux. But these definitions From git at git.haskell.org Tue Apr 19 21:37:59 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:37:59 +0000 (UTC) Subject: [commit: packages/unix] master: Avoid redundant prototypes for ptsname(3) et al (2ddf4b2) Message-ID: <20160419213759.8D9133A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2ddf4b2b7bf41f878bc7d8a1afa49126710f524c/unix >--------------------------------------------------------------- commit 2ddf4b2b7bf41f878bc7d8a1afa49126710f524c Author: Herbert Valerio Riedel Date: Sun Jan 31 00:01:18 2016 +0100 Avoid redundant prototypes for ptsname(3) et al This is now possible since we now use `AC_USE_SYSTEM_EXTENSIONS`, which indirectly enables _XOPEN_SOURCE >--------------------------------------------------------------- 2ddf4b2b7bf41f878bc7d8a1afa49126710f524c cbits/HsUnix.c | 9 +++------ include/HsUnix.h | 4 ---- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/cbits/HsUnix.c b/cbits/HsUnix.c index e54bccf..09cfc9c 100644 --- a/cbits/HsUnix.c +++ b/cbits/HsUnix.c @@ -35,25 +35,22 @@ int __hsunix_getpwuid_r(uid_t uid, struct passwd *pw, char *buffer, #endif #ifdef HAVE_PTSNAME -// I cannot figure out how to make the definitions of the following -// functions visible in on Linux. But these definitions -// follow the POSIX specs, and everything links and runs. +// On Linux (and others), needs to be included while +// `_XOPEN_SOURCE` is already defined. However, GHCs before GHC 8.0 +// didn't do that yet for CApiFFI, so we need this workaround here. char *__hsunix_ptsname(int fd) { - extern char *ptsname(int); return ptsname(fd); } int __hsunix_grantpt(int fd) { - extern int grantpt(int); return grantpt(fd); } int __hsunix_unlockpt(int fd) { - extern int unlockpt(int); return unlockpt(fd); } #endif diff --git a/include/HsUnix.h b/include/HsUnix.h index 7b404fc..98990b2 100644 --- a/include/HsUnix.h +++ b/include/HsUnix.h @@ -126,10 +126,6 @@ int __hsunix_getpwuid_r(uid_t, struct passwd *, char *, size_t, #endif #ifdef HAVE_PTSNAME -// I cannot figure out how to make the definitions of the following -// functions visible in on Linux. But these definitions -// follow the POSIX specs, and everything links and runs. - char *__hsunix_ptsname(int fd); int __hsunix_grantpt(int fd); int __hsunix_unlockpt(int fd); From git at git.haskell.org Tue Apr 19 21:38:01 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:38:01 +0000 (UTC) Subject: [commit: packages/unix] master: Replace `__hscore_mk{dtemp, stemp, stemps}` wrappers with CApiFFI (3e32e39) Message-ID: <20160419213801.938DE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3e32e3912254b5b13ce27715cbd369e5e4b33241/unix >--------------------------------------------------------------- commit 3e32e3912254b5b13ce27715cbd369e5e4b33241 Author: Herbert Valerio Riedel Date: Sun Jan 31 00:15:23 2016 +0100 Replace `__hscore_mk{dtemp,stemp,stemps}` wrappers with CApiFFI >--------------------------------------------------------------- 3e32e3912254b5b13ce27715cbd369e5e4b33241 System/Posix/Temp.hsc | 7 ++++--- System/Posix/Temp/ByteString.hsc | 7 ++++--- cbits/HsUnix.c | 16 ---------------- include/HsUnix.h | 10 ---------- 4 files changed, 8 insertions(+), 32 deletions(-) diff --git a/System/Posix/Temp.hsc b/System/Posix/Temp.hsc index 473364c..3984144 100644 --- a/System/Posix/Temp.hsc +++ b/System/Posix/Temp.hsc @@ -1,3 +1,4 @@ +{-# LANGUAGE CApiFFI #-} #if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-} #else @@ -33,7 +34,7 @@ import System.Posix.IO import System.Posix.Types import System.Posix.Internals (withFilePath, peekFilePath) -foreign import ccall unsafe "HsUnix.h __hscore_mkstemp" +foreign import capi unsafe "HsUnix.h mkstemp" c_mkstemp :: CString -> IO CInt -- | Make a unique filename and open it for reading\/writing. The returned @@ -53,7 +54,7 @@ mkstemp template' = do return (name, h) #if HAVE_MKSTEMPS -foreign import ccall unsafe "HsUnix.h __hscore_mkstemps" +foreign import capi unsafe "HsUnix.h mkstemps" c_mkstemps :: CString -> CInt -> IO CInt #endif @@ -81,7 +82,7 @@ mkstemps = error "System.Posix.Temp.mkstemps: not available on this platform" #endif #if HAVE_MKDTEMP -foreign import ccall unsafe "HsUnix.h __hscore_mkdtemp" +foreign import capi unsafe "HsUnix.h mkdtemp" c_mkdtemp :: CString -> IO CString #endif diff --git a/System/Posix/Temp/ByteString.hsc b/System/Posix/Temp/ByteString.hsc index 67442fc..0e30c6f 100644 --- a/System/Posix/Temp/ByteString.hsc +++ b/System/Posix/Temp/ByteString.hsc @@ -1,3 +1,4 @@ +{-# LANGUAGE CApiFFI #-} #if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-} #else @@ -38,7 +39,7 @@ import System.Posix.Directory (createDirectory) import System.Posix.IO import System.Posix.Types -foreign import ccall unsafe "HsUnix.h __hscore_mkstemp" +foreign import capi unsafe "HsUnix.h mkstemp" c_mkstemp :: CString -> IO CInt -- | Make a unique filename and open it for reading\/writing. The returned @@ -58,7 +59,7 @@ mkstemp template' = do return (name, h) #if HAVE_MKSTEMPS -foreign import ccall unsafe "HsUnix.h __hscore_mkstemps" +foreign import capi unsafe "HsUnix.h mkstemps" c_mkstemps :: CString -> CInt -> IO CInt #endif @@ -82,7 +83,7 @@ mkstemps = error "System.Posix.Temp.mkstemps: not available on this platform" #endif #if HAVE_MKDTEMP -foreign import ccall unsafe "HsUnix.h __hscore_mkdtemp" +foreign import capi unsafe "HsUnix.h mkdtemp" c_mkdtemp :: CString -> IO CString #endif diff --git a/cbits/HsUnix.c b/cbits/HsUnix.c index 55f9679..aec5368 100644 --- a/cbits/HsUnix.c +++ b/cbits/HsUnix.c @@ -65,22 +65,6 @@ int __hsunix_push_module(int fd, const char *module) #endif } -int __hscore_mkstemp(char *filetemplate) { - return (mkstemp(filetemplate)); -} - -#if HAVE_MKSTEMPS -int __hscore_mkstemps(char *filetemplate, int suffixlen) { - return (mkstemps(filetemplate, suffixlen)); -} -#endif - -#if HAVE_MKDTEMP -char *__hscore_mkdtemp(char *filetemplate) { - return (mkdtemp(filetemplate)); -} -#endif - #ifdef HAVE_UNSETENV int __hsunix_unsetenv(const char *name) { diff --git a/include/HsUnix.h b/include/HsUnix.h index 093c9e3..5daff0c 100644 --- a/include/HsUnix.h +++ b/include/HsUnix.h @@ -134,16 +134,6 @@ int __hsunix_unlockpt(int fd); // push a SVR4 STREAMS module; do nothing if STREAMS not available int __hsunix_push_module(int fd, const char *module); -int __hscore_mkstemp(char *filetemplate); - -#if HAVE_MKSTEMPS -int __hscore_mkstemps(char *filetemplate, int suffixlen); -#endif - -#if HAVE_MKDTEMP -char *__hscore_mkdtemp(char *filetemplate); -#endif - int __hsunix_unsetenv(const char *name); /* A size that will contain many path names, but not necessarily all From git at git.haskell.org Tue Apr 19 21:38:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:38:03 +0000 (UTC) Subject: [commit: packages/unix] master: Replace `__hsunix_getpw{nam, uid_r}` wrappers with CApiFFI (91b8238) Message-ID: <20160419213803.9A4B23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/91b82383873b46385d239f2b059f353b11f07e0f/unix >--------------------------------------------------------------- commit 91b82383873b46385d239f2b059f353b11f07e0f Author: Herbert Valerio Riedel Date: Sun Jan 31 00:43:21 2016 +0100 Replace `__hsunix_getpw{nam,uid_r}` wrappers with CApiFFI >--------------------------------------------------------------- 91b82383873b46385d239f2b059f353b11f07e0f System/Posix/User.hsc | 9 ++++++--- cbits/HsUnix.c | 18 ------------------ include/HsUnix.h | 12 ------------ 3 files changed, 6 insertions(+), 33 deletions(-) diff --git a/System/Posix/User.hsc b/System/Posix/User.hsc index 01a417d..63bf466 100644 --- a/System/Posix/User.hsc +++ b/System/Posix/User.hsc @@ -53,7 +53,6 @@ import Foreign.C import Foreign.Ptr import Foreign.Marshal import Foreign.Storable -import System.Posix.Internals ( CGroup, CPasswd ) #if !defined(HAVE_GETPWNAM_R) || !defined(HAVE_GETPWUID_R) || defined(HAVE_GETPWENT) || defined(HAVE_GETGRENT) import Control.Concurrent.MVar ( MVar, newMVar, withMVar ) @@ -64,6 +63,10 @@ import Control.Exception import Control.Monad import System.IO.Error +-- internal types +data {-# CTYPE "struct passwd" #-} CPasswd +data {-# CTYPE "struct group" #-} CGroup + -- ----------------------------------------------------------------------------- -- user environemnt @@ -318,7 +321,7 @@ getUserEntryForID uid = doubleAllocWhileERANGE "getUserEntryForID" "user" pwBufSize unpackUserEntry $ c_getpwuid_r uid ppw -foreign import ccall unsafe "__hsunix_getpwuid_r" +foreign import capi unsafe "HsUnix.h getpwuid_r" c_getpwuid_r :: CUid -> Ptr CPasswd -> CString -> CSize -> Ptr (Ptr CPasswd) -> IO CInt #elif HAVE_GETPWUID @@ -345,7 +348,7 @@ getUserEntryForName name = doubleAllocWhileERANGE "getUserEntryForName" "user" pwBufSize unpackUserEntry $ c_getpwnam_r pstr ppw -foreign import ccall unsafe "__hsunix_getpwnam_r" +foreign import capi unsafe "HsUnix.h getpwnam_r" c_getpwnam_r :: CString -> Ptr CPasswd -> CString -> CSize -> Ptr (Ptr CPasswd) -> IO CInt #elif HAVE_GETPWNAM diff --git a/cbits/HsUnix.c b/cbits/HsUnix.c index aec5368..d689a6e 100644 --- a/cbits/HsUnix.c +++ b/cbits/HsUnix.c @@ -16,24 +16,6 @@ void *__hsunix_rtldNext (void) {return RTLD_NEXT;} void *__hsunix_rtldDefault (void) {return RTLD_DEFAULT;} #endif -#if HAVE_GETPWNAM_R -// getpwnam_r is a macro on some platforms, so we need a wrapper: -int __hsunix_getpwnam_r(const char *name, struct passwd *pw, char *buffer, - size_t buflen, struct passwd **result) -{ - return getpwnam_r(name, pw, buffer, buflen, result); -} -#endif - -#ifdef HAVE_GETPWUID_R -// getpwuid_r is a macro on some platforms, so we need a wrapper: -int __hsunix_getpwuid_r(uid_t uid, struct passwd *pw, char *buffer, - size_t buflen, struct passwd **result) -{ - return getpwuid_r(uid, pw, buffer, buflen, result); -} -#endif - #ifdef HAVE_PTSNAME // On Linux (and others), needs to be included while // `_XOPEN_SOURCE` is already defined. However, GHCs before GHC 8.0 diff --git a/include/HsUnix.h b/include/HsUnix.h index 5daff0c..2f77d28 100644 --- a/include/HsUnix.h +++ b/include/HsUnix.h @@ -113,18 +113,6 @@ fall back to O_FSYNC, which should be the same */ # define WCOREDUMP(s) 0 #endif -#if HAVE_GETPWNAM_R -// getpwnam_r is a macro on some platforms, so we need a wrapper: -int __hsunix_getpwnam_r(const char *, struct passwd *, char *, size_t, - struct passwd **); -#endif - -#ifdef HAVE_GETPWUID_R -// getpwuid_r is a macro on some platforms, so we need a wrapper: -int __hsunix_getpwuid_r(uid_t, struct passwd *, char *, size_t, - struct passwd **); -#endif - #ifdef HAVE_PTSNAME char *__hsunix_ptsname(int fd); int __hsunix_grantpt(int fd); From git at git.haskell.org Tue Apr 19 21:38:05 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:38:05 +0000 (UTC) Subject: [commit: packages/unix] master: Minor cleanups to unix.cabal file (e745f0c) Message-ID: <20160419213805.9F9D33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e745f0c47a01bad4ed575cfa84bd7c753b2355dd/unix >--------------------------------------------------------------- commit e745f0c47a01bad4ed575cfa84bd7c753b2355dd Author: Herbert Valerio Riedel Date: Sun Jan 31 09:21:10 2016 +0100 Minor cleanups to unix.cabal file >--------------------------------------------------------------- e745f0c47a01bad4ed575cfa84bd7c753b2355dd unix.cabal | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/unix.cabal b/unix.cabal index 0ae2772..cbe3716 100644 --- a/unix.cabal +++ b/unix.cabal @@ -49,14 +49,16 @@ library DeriveDataTypeable InterruptibleFFI NondecreasingIndentation - OverloadedStrings RankNTypes RecordWildCards - - if impl(ghc) - other-extensions: - Safe - Trustworthy + Safe + Trustworthy + + if os(windows) + -- This package currently supports neither Cygwin nor MinGW, + -- therefore os(windows) is effectively not supported. + build-depends: unbuildable<0 + buildable: False build-depends: base >= 4.5 && < 4.10, From git at git.haskell.org Tue Apr 19 21:38:07 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:38:07 +0000 (UTC) Subject: [commit: packages/unix] master: Bump to 2.7.2.0 (d958007) Message-ID: <20160419213807.A51753A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d958007b55221ea0fd508add447f466b342a263b/unix >--------------------------------------------------------------- commit d958007b55221ea0fd508add447f466b342a263b Author: Herbert Valerio Riedel Date: Sun Jan 31 09:26:26 2016 +0100 Bump to 2.7.2.0 There's been some subtle API changes that may be useful to detect via `MIN_VERSION_unix(2,7,2)`, consequently perform a minor version bump relative to the last release. >--------------------------------------------------------------- d958007b55221ea0fd508add447f466b342a263b changelog.md | 6 +++++- unix.cabal | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 1105cba..000c006 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,6 @@ # Changelog for [`unix` package](http://hackage.haskell.org/package/unix) -## **TBA** +## 2.7.2.0 *Feb 2016* * Don't assume non-POSIX `WCOREDUMP(x)` macro exists @@ -15,6 +15,10 @@ * Improve detection of `fdatasync(2)` (GHC #11137) + * Drop support for Hugs + + * Drop support for Cygwin (and Windows in general) + ## 2.7.1.0 *Dec 2014* * Bundled with GHC 7.10.1 diff --git a/unix.cabal b/unix.cabal index cbe3716..e7300d6 100644 --- a/unix.cabal +++ b/unix.cabal @@ -1,5 +1,5 @@ name: unix -version: 2.7.1.1 +version: 2.7.2.0 -- NOTE: Don't forget to update ./changelog.md license: BSD3 license-file: LICENSE From git at git.haskell.org Tue Apr 19 21:38:09 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:38:09 +0000 (UTC) Subject: [commit: packages/unix] master: Delete some trailing whitespaces (38d445e) Message-ID: <20160419213809.AB2103A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/38d445e5830fb53efd7133f688b37d85e639d23e/unix >--------------------------------------------------------------- commit 38d445e5830fb53efd7133f688b37d85e639d23e Author: Herbert Valerio Riedel Date: Sun Jan 31 09:31:09 2016 +0100 Delete some trailing whitespaces >--------------------------------------------------------------- 38d445e5830fb53efd7133f688b37d85e639d23e System/Posix.hs | 0 System/Posix/ByteString.hs | 0 System/Posix/Env.hsc | 0 System/Posix/IO.hsc | 0 System/Posix/IO/ByteString.hsc | 0 System/Posix/SharedMem.hsc | 0 System/Posix/Temp.hsc | 0 System/Posix/Temp/ByteString.hsc | 0 8 files changed, 0 insertions(+), 0 deletions(-) From git at git.haskell.org Tue Apr 19 21:38:11 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:38:11 +0000 (UTC) Subject: [commit: packages/unix] master: gitignore (8a5db15) Message-ID: <20160419213811.B12483A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8a5db15f1317772db65f29c168a987077340aa05/unix >--------------------------------------------------------------- commit 8a5db15f1317772db65f29c168a987077340aa05 Author: Herbert Valerio Riedel Date: Sun Jan 31 09:34:03 2016 +0100 gitignore >--------------------------------------------------------------- 8a5db15f1317772db65f29c168a987077340aa05 .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index b67c37a..6879b90 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ config.status configure dist/ dist-install/ +dist-newstyle/ ghc.mk include/HsUnixConfig.h include/HsUnixConfig.h.in From git at git.haskell.org Tue Apr 19 21:38:13 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:38:13 +0000 (UTC) Subject: [commit: packages/unix] master: Add links to Opengroup's latest POSIX.1-2008 spec (d821f65) Message-ID: <20160419213813.B78B13A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d821f65105b1f618627ccdd743682b248dfdfa5a/unix >--------------------------------------------------------------- commit d821f65105b1f618627ccdd743682b248dfdfa5a Author: Herbert Valerio Riedel Date: Sun Jan 31 09:44:47 2016 +0100 Add links to Opengroup's latest POSIX.1-2008 spec >--------------------------------------------------------------- d821f65105b1f618627ccdd743682b248dfdfa5a System/Posix.hs | 2 +- System/Posix/ByteString.hs | 3 ++- unix.cabal | 7 ++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/System/Posix.hs b/System/Posix.hs index de7d08c..c31bb05 100644 --- a/System/Posix.hs +++ b/System/Posix.hs @@ -10,7 +10,7 @@ -- Stability : provisional -- Portability : non-portable (requires POSIX) -- --- POSIX support +-- support -- ----------------------------------------------------------------------------- diff --git a/System/Posix/ByteString.hs b/System/Posix/ByteString.hs index 22df910..7fea0ef 100644 --- a/System/Posix/ByteString.hs +++ b/System/Posix/ByteString.hs @@ -10,7 +10,8 @@ -- Stability : provisional -- Portability : non-portable (requires POSIX) -- --- POSIX support with ByteString file paths and environment strings. +-- +-- support with 'ByteString' file paths and environment strings. -- -- This module exports exactly the same API as "System.Posix", except -- that all file paths and environment strings are represented by diff --git a/unix.cabal b/unix.cabal index e7300d6..5f61736 100644 --- a/unix.cabal +++ b/unix.cabal @@ -13,9 +13,10 @@ cabal-version: >= 1.10 tested-with: GHC>=7.4.1 description: This package gives you access to the set of operating system - services standardised by POSIX 1003.1b (or the IEEE Portable - Operating System Interface for Computing Environments - - IEEE Std. 1003.1). + services standardised by + + (or the IEEE Portable Operating System Interface for Computing + Environments - IEEE Std. 1003.1). . The package is not supported under Windows. From git at git.haskell.org Tue Apr 19 21:38:15 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:38:15 +0000 (UTC) Subject: [commit: packages/unix] master: Provide execvpe prototype if missing (2796361) Message-ID: <20160419213815.BD9D23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2796361516ebf60825189018cea24d2c5c24ea34/unix >--------------------------------------------------------------- commit 2796361516ebf60825189018cea24d2c5c24ea34 Author: Herbert Valerio Riedel Date: Sun Jan 31 10:03:46 2016 +0100 Provide execvpe prototype if missing >--------------------------------------------------------------- 2796361516ebf60825189018cea24d2c5c24ea34 cbits/execvpe.c | 5 +++++ configure.ac | 1 + 2 files changed, 6 insertions(+) diff --git a/cbits/execvpe.c b/cbits/execvpe.c index 82e1bdc..708b8b2 100644 --- a/cbits/execvpe.c +++ b/cbits/execvpe.c @@ -25,6 +25,11 @@ #define HSUNIX_EXECVPE_H_NO_COMPAT #include "execvpe.h" +#if !defined(execvpe) && !HAVE_DECL_EXECVPE +// On some archs such as AIX, the prototype may be missing +int execvpe(const char *file, char *const argv[], char *const envp[]); +#endif + /* * We want the search semantics of execvp, but we want to provide our * own environment, like execve. The following copyright applies to diff --git a/configure.ac b/configure.ac index f883624..5b6eb7c 100644 --- a/configure.ac +++ b/configure.ac @@ -41,6 +41,7 @@ dnl not available on android so check for it AC_CHECK_FUNCS([telldir seekdir]) dnl This is e.g. available as a GNU extension in glibc 2.11+ +AC_CHECK_DECLS([execvpe]) AC_CHECK_FUNCS([execvpe]) AC_CHECK_MEMBERS([struct stat.st_atim]) From git at git.haskell.org Tue Apr 19 21:38:17 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:38:17 +0000 (UTC) Subject: [commit: packages/unix] master: Use more direct CApiFFI for pPrPr_disableITimers (72774b0) Message-ID: <20160419213817.C34623A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/72774b031084e5260cf0c0df5239ed63d136ba6c/unix >--------------------------------------------------------------- commit 72774b031084e5260cf0c0df5239ed63d136ba6c Author: Herbert Valerio Riedel Date: Sun Jan 31 10:51:58 2016 +0100 Use more direct CApiFFI for pPrPr_disableITimers >--------------------------------------------------------------- 72774b031084e5260cf0c0df5239ed63d136ba6c System/Posix/Process/Internals.hs | 3 +-- cbits/ghcrts.c | 15 --------------- include/execvpe.h | 3 --- unix.cabal | 1 - 4 files changed, 1 insertion(+), 21 deletions(-) diff --git a/System/Posix/Process/Internals.hs b/System/Posix/Process/Internals.hs index fd0e68d..0bd99ae 100644 --- a/System/Posix/Process/Internals.hs +++ b/System/Posix/Process/Internals.hs @@ -1,5 +1,4 @@ {-# LANGUAGE CApiFFI #-} -{-# LANGUAGE CPP #-} {-# LANGUAGE Trustworthy #-} module System.Posix.Process.Internals ( @@ -26,7 +25,7 @@ data ProcessStatus -- this function disables the itimer, which would otherwise cause confusing -- signals to be sent to the new process. -foreign import ccall unsafe "pPrPr_disableITimers" +foreign import capi unsafe "Rts.h stopTimer" pPrPr_disableITimers :: IO () foreign import ccall unsafe "__hsunix_execvpe" diff --git a/cbits/ghcrts.c b/cbits/ghcrts.c deleted file mode 100644 index 9003675..0000000 --- a/cbits/ghcrts.c +++ /dev/null @@ -1,15 +0,0 @@ -#ifdef __GLASGOW_HASKELL__ -// for 'void StopTimer(void)' prototype -# include "Rts.h" -#endif - -#define HSUNIX_EXECVPE_H_NO_COMPAT -#include "execvpe.h" - -/* Copied verbatim from ghc/lib/std/cbits/system.c. */ -void pPrPr_disableITimers (void) -{ -#ifdef __GLASGOW_HASKELL__ - stopTimer(); -#endif -} diff --git a/include/execvpe.h b/include/execvpe.h index 63cd042..8db9495 100644 --- a/include/execvpe.h +++ b/include/execvpe.h @@ -22,7 +22,4 @@ execvpe(const char *name, char *const argv[], char *const envp[]); #endif #endif -// implemented in cbits/ghcrts.c -extern void pPrPr_disableITimers (void); - #endif diff --git a/unix.cabal b/unix.cabal index 5f61736..2027559 100644 --- a/unix.cabal +++ b/unix.cabal @@ -133,4 +133,3 @@ library cbits/HsUnix.c cbits/dirUtils.c cbits/execvpe.c - cbits/ghcrts.c From git at git.haskell.org Tue Apr 19 21:38:19 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:38:19 +0000 (UTC) Subject: [commit: packages/unix] master: Merge dirUtils.c into HsUnix.c (b54bd5f) Message-ID: <20160419213819.CA41C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b54bd5fc4355af6104b80a48353889bbd867ba10/unix >--------------------------------------------------------------- commit b54bd5fc4355af6104b80a48353889bbd867ba10 Author: Herbert Valerio Riedel Date: Sun Jan 31 11:31:14 2016 +0100 Merge dirUtils.c into HsUnix.c >--------------------------------------------------------------- b54bd5fc4355af6104b80a48353889bbd867ba10 cbits/HsUnix.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++ cbits/dirUtils.c | 72 -------------------------------------------------------- unix.cabal | 1 - 3 files changed, 62 insertions(+), 73 deletions(-) diff --git a/cbits/HsUnix.c b/cbits/HsUnix.c index d689a6e..25fd8ad 100644 --- a/cbits/HsUnix.c +++ b/cbits/HsUnix.c @@ -71,3 +71,65 @@ HsInt __hsunix_long_path_size(void) { #endif } + +/* + * read an entry from the directory stream; opt for the + * re-entrant friendly way of doing this, if available. + */ +int __hscore_readdir( DIR *dirPtr, struct dirent **pDirEnt ) +{ +#if HAVE_READDIR_R + struct dirent* p; + int res; + static unsigned int nm_max = (unsigned int)-1; + + if (pDirEnt == NULL) { + return -1; + } + if (nm_max == (unsigned int)-1) { +#ifdef NAME_MAX + nm_max = NAME_MAX + 1; +#else + nm_max = pathconf(".", _PC_NAME_MAX); + if (nm_max == -1) { nm_max = 255; } + nm_max++; +#endif + } + p = (struct dirent*)malloc(sizeof(struct dirent) + nm_max); + if (p == NULL) return -1; + res = readdir_r(dirPtr, p, pDirEnt); + if (res != 0) { + *pDirEnt = NULL; + free(p); + } + else if (*pDirEnt == NULL) { + // end of stream + free(p); + } + return res; +#else + + if (pDirEnt == NULL) { + return -1; + } + + *pDirEnt = readdir(dirPtr); + if (*pDirEnt == NULL) { + return -1; + } else { + return 0; + } +#endif +} + +char *__hscore_d_name( struct dirent* d ) +{ + return (d->d_name); +} + +void __hscore_free_dirent(struct dirent *dEnt) +{ +#if HAVE_READDIR_R + free(dEnt); +#endif +} diff --git a/cbits/dirUtils.c b/cbits/dirUtils.c deleted file mode 100644 index 0a645eb..0000000 --- a/cbits/dirUtils.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * (c) The University of Glasgow 2002 - * - * Directory Runtime Support - */ - -#include "HsUnix.h" - -/* - * read an entry from the directory stream; opt for the - * re-entrant friendly way of doing this, if available. - */ -int -__hscore_readdir( DIR *dirPtr, struct dirent **pDirEnt ) -{ -#if HAVE_READDIR_R - struct dirent* p; - int res; - static unsigned int nm_max = (unsigned int)-1; - - if (pDirEnt == NULL) { - return -1; - } - if (nm_max == (unsigned int)-1) { -#ifdef NAME_MAX - nm_max = NAME_MAX + 1; -#else - nm_max = pathconf(".", _PC_NAME_MAX); - if (nm_max == -1) { nm_max = 255; } - nm_max++; -#endif - } - p = (struct dirent*)malloc(sizeof(struct dirent) + nm_max); - if (p == NULL) return -1; - res = readdir_r(dirPtr, p, pDirEnt); - if (res != 0) { - *pDirEnt = NULL; - free(p); - } - else if (*pDirEnt == NULL) { - // end of stream - free(p); - } - return res; -#else - - if (pDirEnt == NULL) { - return -1; - } - - *pDirEnt = readdir(dirPtr); - if (*pDirEnt == NULL) { - return -1; - } else { - return 0; - } -#endif -} - -char * -__hscore_d_name( struct dirent* d ) -{ - return (d->d_name); -} - -void -__hscore_free_dirent(struct dirent *dEnt) -{ -#if HAVE_READDIR_R - free(dEnt); -#endif -} diff --git a/unix.cabal b/unix.cabal index 2027559..02d583e 100644 --- a/unix.cabal +++ b/unix.cabal @@ -131,5 +131,4 @@ library execvpe.h c-sources: cbits/HsUnix.c - cbits/dirUtils.c cbits/execvpe.c From git at git.haskell.org Tue Apr 19 21:38:21 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:38:21 +0000 (UTC) Subject: [commit: packages/unix] master: Use `open(2)` directly rather than via `__hscore_open()` (176d73e) Message-ID: <20160419213821.D0AD03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/176d73e4240bb9d048d6c2d411ff839e379d1245/unix >--------------------------------------------------------------- commit 176d73e4240bb9d048d6c2d411ff839e379d1245 Author: Herbert Valerio Riedel Date: Sun Jan 31 11:32:01 2016 +0100 Use `open(2)` directly rather than via `__hscore_open()` As we don't support Windows, there's no benefit in going via `__hscore_open()` >--------------------------------------------------------------- 176d73e4240bb9d048d6c2d411ff839e379d1245 System/Posix/IO/Common.hsc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/System/Posix/IO/Common.hsc b/System/Posix/IO/Common.hsc index 8f8ddb9..a838352 100644 --- a/System/Posix/IO/Common.hsc +++ b/System/Posix/IO/Common.hsc @@ -1,4 +1,6 @@ -{-# LANGUAGE NondecreasingIndentation, RecordWildCards #-} +{-# LANGUAGE CApiFFI #-} +{-# LANGUAGE NondecreasingIndentation #-} +{-# LANGUAGE RecordWildCards #-} #if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-} #else @@ -182,7 +184,7 @@ open_ str how maybe_mode (OpenFileFlags appendFlag exclusiveFlag nocttyFlag WriteOnly -> (#const O_WRONLY) ReadWrite -> (#const O_RDWR) -foreign import ccall unsafe "__hscore_open" +foreign import capi unsafe "HsUnix.h open" c_open :: CString -> CInt -> CMode -> IO CInt -- |Close this file descriptor. May throw an exception if this is an From git at git.haskell.org Tue Apr 19 21:38:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:38:23 +0000 (UTC) Subject: [commit: packages/unix] master: Use CApiFFI for `ptsname(3)` et al for GHC>=8.0 (fb9b3eb) Message-ID: <20160419213823.D6A973A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fb9b3eb74be56579deaa6e653686405e2e0463dd/unix >--------------------------------------------------------------- commit fb9b3eb74be56579deaa6e653686405e2e0463dd Author: Herbert Valerio Riedel Date: Sun Jan 31 12:34:59 2016 +0100 Use CApiFFI for `ptsname(3)` et al for GHC>=8.0 This improves on 2ddf4b2b7bf41f878bc7d8a1afa49126710f524c >--------------------------------------------------------------- fb9b3eb74be56579deaa6e653686405e2e0463dd System/Posix/Terminal.hsc | 15 +++++++++++++++ System/Posix/Terminal/ByteString.hsc | 17 ++++++++++++++++- cbits/HsUnix.c | 20 ++++---------------- include/HsUnix.h | 6 ------ 4 files changed, 35 insertions(+), 23 deletions(-) diff --git a/System/Posix/Terminal.hsc b/System/Posix/Terminal.hsc index c1b3ff8..0545f40 100644 --- a/System/Posix/Terminal.hsc +++ b/System/Posix/Terminal.hsc @@ -134,8 +134,14 @@ getSlaveTerminalName (Fd fd) = do s <- throwErrnoIfNull "getSlaveTerminalName" (c_ptsname fd) peekFilePath s +# if __GLASGOW_HASKELL__ < 800 +-- see comment in cbits/HsUnix.c foreign import ccall unsafe "__hsunix_ptsname" c_ptsname :: CInt -> IO CString +# else +foreign import capi unsafe "HsUnix.h ptsname" + c_ptsname :: CInt -> IO CString +# endif #else getSlaveTerminalName _ = ioError (errnoToIOError "getSlaveTerminalName" eNOSYS Nothing Nothing) @@ -188,11 +194,20 @@ foreign import ccall unsafe "__hsunix_push_module" c_push_module :: CInt -> CString -> IO CInt #ifdef HAVE_PTSNAME +# if __GLASGOW_HASKELL__ < 800 +-- see comment in cbits/HsUnix.c foreign import ccall unsafe "__hsunix_grantpt" c_grantpt :: CInt -> IO CInt foreign import ccall unsafe "__hsunix_unlockpt" c_unlockpt :: CInt -> IO CInt +# else +foreign import capi unsafe "HsUnix.h grantpt" + c_grantpt :: CInt -> IO CInt + +foreign import capi unsafe "HsUnix.h unlockpt" + c_unlockpt :: CInt -> IO CInt +# endif #else c_grantpt :: CInt -> IO CInt c_grantpt _ = return (fromIntegral 0) diff --git a/System/Posix/Terminal/ByteString.hsc b/System/Posix/Terminal/ByteString.hsc index d98a9c0..cd6e200 100644 --- a/System/Posix/Terminal/ByteString.hsc +++ b/System/Posix/Terminal/ByteString.hsc @@ -142,8 +142,14 @@ getSlaveTerminalName (Fd fd) = do s <- throwErrnoIfNull "getSlaveTerminalName" (c_ptsname fd) peekFilePath s +# if __GLASGOW_HASKELL__ < 800 +-- see comment in cbits/HsUnix.c foreign import ccall unsafe "__hsunix_ptsname" c_ptsname :: CInt -> IO CString +# else +foreign import capi unsafe "HsUnix.h ptsname" + c_ptsname :: CInt -> IO CString +# endif #else getSlaveTerminalName _ = ioError (errnoToIOError "getSlaveTerminalName" eNOSYS Nothing Nothing) @@ -195,12 +201,21 @@ pushModule (Fd fd) name = foreign import ccall unsafe "__hsunix_push_module" c_push_module :: CInt -> CString -> IO CInt -#ifdef HAVE_PTSNAME +#if HAVE_PTSNAME +# if __GLASGOW_HASKELL__ < 800 +-- see comment in cbits/HsUnix.c foreign import ccall unsafe "__hsunix_grantpt" c_grantpt :: CInt -> IO CInt foreign import ccall unsafe "__hsunix_unlockpt" c_unlockpt :: CInt -> IO CInt +# else +foreign import capi unsafe "HsUnix.h grantpt" + c_grantpt :: CInt -> IO CInt + +foreign import capi unsafe "HsUnix.h unlockpt" + c_unlockpt :: CInt -> IO CInt +# endif #else c_grantpt :: CInt -> IO CInt c_grantpt _ = return (fromIntegral (0::Int)) diff --git a/cbits/HsUnix.c b/cbits/HsUnix.c index 25fd8ad..5742b49 100644 --- a/cbits/HsUnix.c +++ b/cbits/HsUnix.c @@ -16,25 +16,14 @@ void *__hsunix_rtldNext (void) {return RTLD_NEXT;} void *__hsunix_rtldDefault (void) {return RTLD_DEFAULT;} #endif -#ifdef HAVE_PTSNAME +#if HAVE_PTSNAME && (__GLASGOW_HASKELL__ < 800) // On Linux (and others), needs to be included while // `_XOPEN_SOURCE` is already defined. However, GHCs before GHC 8.0 // didn't do that yet for CApiFFI, so we need this workaround here. -char *__hsunix_ptsname(int fd) -{ - return ptsname(fd); -} - -int __hsunix_grantpt(int fd) -{ - return grantpt(fd); -} - -int __hsunix_unlockpt(int fd) -{ - return unlockpt(fd); -} +char *__hsunix_ptsname(int fd) { return ptsname(fd); } +int __hsunix_grantpt(int fd) { return grantpt(fd); } +int __hsunix_unlockpt(int fd) { return unlockpt(fd); } #endif // push a SVR4 STREAMS module; do nothing if STREAMS not available @@ -71,7 +60,6 @@ HsInt __hsunix_long_path_size(void) { #endif } - /* * read an entry from the directory stream; opt for the * re-entrant friendly way of doing this, if available. diff --git a/include/HsUnix.h b/include/HsUnix.h index 2f77d28..fb19f99 100644 --- a/include/HsUnix.h +++ b/include/HsUnix.h @@ -113,12 +113,6 @@ fall back to O_FSYNC, which should be the same */ # define WCOREDUMP(s) 0 #endif -#ifdef HAVE_PTSNAME -char *__hsunix_ptsname(int fd); -int __hsunix_grantpt(int fd); -int __hsunix_unlockpt(int fd); -#endif - // push a SVR4 STREAMS module; do nothing if STREAMS not available int __hsunix_push_module(int fd, const char *module); From git at git.haskell.org Tue Apr 19 21:38:25 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:38:25 +0000 (UTC) Subject: [commit: packages/unix] master: Replace `__hsunix_unsetenv` wrapper with CApiFFI (57d2cb2) Message-ID: <20160419213825.DD6483A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/57d2cb2a613e909829f22be6218e840b2b4602b5/unix >--------------------------------------------------------------- commit 57d2cb2a613e909829f22be6218e840b2b4602b5 Author: Herbert Valerio Riedel Date: Sun Jan 31 12:57:23 2016 +0100 Replace `__hsunix_unsetenv` wrapper with CApiFFI >--------------------------------------------------------------- 57d2cb2a613e909829f22be6218e840b2b4602b5 System/Posix/Env.hsc | 15 ++++++++++++--- System/Posix/Env/ByteString.hsc | 15 ++++++++++++--- cbits/HsUnix.c | 12 ------------ include/HsUnix.h | 2 -- 4 files changed, 24 insertions(+), 20 deletions(-) diff --git a/System/Posix/Env.hsc b/System/Posix/Env.hsc index 999daec..6412bae 100644 --- a/System/Posix/Env.hsc +++ b/System/Posix/Env.hsc @@ -1,3 +1,4 @@ +{-# LANGUAGE CApiFFI #-} #if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-} #else @@ -116,13 +117,21 @@ setEnvironment env = do -- from the environment. unsetEnv :: String -> IO () -#ifdef HAVE_UNSETENV - +#if HAVE_UNSETENV +# if !UNSETENV_RETURNS_VOID unsetEnv name = withFilePath name $ \ s -> throwErrnoIfMinus1_ "unsetenv" (c_unsetenv s) -foreign import ccall unsafe "__hsunix_unsetenv" +-- POSIX.1-2001 compliant unsetenv(3) +foreign import capi unsafe "HsUnix.h unsetenv" c_unsetenv :: CString -> IO CInt +# else +unsetEnv name = withFilePath name c_unsetenv + +-- pre-POSIX unsetenv(3) returning @void@ +foreign import capi unsafe "HsUnix.h unsetenv" + c_unsetenv :: CString -> IO () +# endif #else unsetEnv name = putEnv (name ++ "=") #endif diff --git a/System/Posix/Env/ByteString.hsc b/System/Posix/Env/ByteString.hsc index 0bbcfd8..57b03aa 100644 --- a/System/Posix/Env/ByteString.hsc +++ b/System/Posix/Env/ByteString.hsc @@ -1,3 +1,4 @@ +{-# LANGUAGE CApiFFI #-} {-# LANGUAGE Trustworthy #-} #if __GLASGOW_HASKELL__ >= 709 {-# OPTIONS_GHC -fno-warn-trustworthy-safe #-} @@ -98,13 +99,21 @@ getEnvironment = do -- from the environment. unsetEnv :: ByteString -> IO () -#ifdef HAVE_UNSETENV - +#if HAVE_UNSETENV +# if !UNSETENV_RETURNS_VOID unsetEnv name = B.useAsCString name $ \ s -> throwErrnoIfMinus1_ "unsetenv" (c_unsetenv s) -foreign import ccall unsafe "__hsunix_unsetenv" +-- POSIX.1-2001 compliant unsetenv(3) +foreign import capi unsafe "HsUnix.h unsetenv" c_unsetenv :: CString -> IO CInt +# else +unsetEnv name = B.useAsCString name c_unsetenv + +-- pre-POSIX unsetenv(3) returning @void@ +foreign import capi unsafe "HsUnix.h unsetenv" + c_unsetenv :: CString -> IO () +# endif #else unsetEnv name = putEnv (name ++ "=") #endif diff --git a/cbits/HsUnix.c b/cbits/HsUnix.c index 5742b49..8e16803 100644 --- a/cbits/HsUnix.c +++ b/cbits/HsUnix.c @@ -36,18 +36,6 @@ int __hsunix_push_module(int fd, const char *module) #endif } -#ifdef HAVE_UNSETENV -int __hsunix_unsetenv(const char *name) -{ -#ifdef UNSETENV_RETURNS_VOID - unsetenv(name); - return 0; -#else - return unsetenv(name); -#endif -} -#endif - /* A size that will contain many path names, but not necessarily all * (PATH_MAX is not defined on systems with unlimited path length, * e.g. the Hurd). diff --git a/include/HsUnix.h b/include/HsUnix.h index fb19f99..dcd0c4a 100644 --- a/include/HsUnix.h +++ b/include/HsUnix.h @@ -116,8 +116,6 @@ fall back to O_FSYNC, which should be the same */ // push a SVR4 STREAMS module; do nothing if STREAMS not available int __hsunix_push_module(int fd, const char *module); -int __hsunix_unsetenv(const char *name); - /* A size that will contain many path names, but not necessarily all * (PATH_MAX is not defined on systems with unlimited path length, * e.g. the Hurd). From git at git.haskell.org Tue Apr 19 21:38:27 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:38:27 +0000 (UTC) Subject: [commit: packages/unix] master: Use `#const` rather than FFI wrapper for PATH_MAX (b495e1d) Message-ID: <20160419213827.E37403A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b495e1d862411c731bf9374e2db949dfb3442fd4/unix >--------------------------------------------------------------- commit b495e1d862411c731bf9374e2db949dfb3442fd4 Author: Herbert Valerio Riedel Date: Sun Jan 31 13:30:15 2016 +0100 Use `#const` rather than FFI wrapper for PATH_MAX This has the side-effect of making two more modules `Safe`-inferred >--------------------------------------------------------------- b495e1d862411c731bf9374e2db949dfb3442fd4 System/Posix/Directory.hsc | 14 ++++++++++---- System/Posix/Directory/ByteString.hsc | 14 ++++++++++---- cbits/HsUnix.c | 12 ------------ include/HsUnix.h | 6 ------ 4 files changed, 20 insertions(+), 26 deletions(-) diff --git a/System/Posix/Directory.hsc b/System/Posix/Directory.hsc index f1caaaf..10dcbb4 100644 --- a/System/Posix/Directory.hsc +++ b/System/Posix/Directory.hsc @@ -1,6 +1,10 @@ {-# LANGUAGE CApiFFI #-} {-# LANGUAGE NondecreasingIndentation #-} +#if __GLASGOW_HASKELL__ >= 709 +{-# LANGUAGE Safe #-} +#else {-# LANGUAGE Trustworthy #-} +#endif ----------------------------------------------------------------------------- -- | @@ -18,6 +22,11 @@ #include "HsUnix.h" +-- hack copied from System.Posix.Files +#if !defined(PATH_MAX) +# define PATH_MAX 4096 +#endif + module System.Posix.Directory ( -- * Creating and removing directories createDirectory, removeDirectory, @@ -115,7 +124,7 @@ foreign import ccall unsafe "__hscore_d_name" -- | @getWorkingDirectory@ calls @getcwd@ to obtain the name -- of the current working directory. getWorkingDirectory :: IO FilePath -getWorkingDirectory = go long_path_size +getWorkingDirectory = go (#const PATH_MAX) where go bytes = do r <- allocaBytes bytes $ \buf -> do @@ -134,9 +143,6 @@ getWorkingDirectory = go long_path_size foreign import ccall unsafe "getcwd" c_getcwd :: Ptr CChar -> CSize -> IO (Ptr CChar) -foreign import ccall unsafe "__hsunix_long_path_size" - long_path_size :: Int - -- | @changeWorkingDirectory dir@ calls @chdir@ to change -- the current working directory to @dir at . changeWorkingDirectory :: FilePath -> IO () diff --git a/System/Posix/Directory/ByteString.hsc b/System/Posix/Directory/ByteString.hsc index 3f96831..b5ea462 100644 --- a/System/Posix/Directory/ByteString.hsc +++ b/System/Posix/Directory/ByteString.hsc @@ -1,6 +1,10 @@ {-# LANGUAGE CApiFFI #-} {-# LANGUAGE NondecreasingIndentation #-} +#if __GLASGOW_HASKELL__ >= 709 +{-# LANGUAGE Safe #-} +#else {-# LANGUAGE Trustworthy #-} +#endif ----------------------------------------------------------------------------- -- | @@ -18,6 +22,11 @@ #include "HsUnix.h" +-- hack copied from System.Posix.Files +#if !defined(PATH_MAX) +# define PATH_MAX 4096 +#endif + module System.Posix.Directory.ByteString ( -- * Creating and removing directories createDirectory, removeDirectory, @@ -116,7 +125,7 @@ foreign import ccall unsafe "__hscore_d_name" -- | @getWorkingDirectory@ calls @getcwd@ to obtain the name -- of the current working directory. getWorkingDirectory :: IO RawFilePath -getWorkingDirectory = go long_path_size +getWorkingDirectory = go (#const PATH_MAX) where go bytes = do r <- allocaBytes bytes $ \buf -> do @@ -135,9 +144,6 @@ getWorkingDirectory = go long_path_size foreign import ccall unsafe "getcwd" c_getcwd :: Ptr CChar -> CSize -> IO (Ptr CChar) -foreign import ccall unsafe "__hsunix_long_path_size" - long_path_size :: Int - -- | @changeWorkingDirectory dir@ calls @chdir@ to change -- the current working directory to @dir at . changeWorkingDirectory :: RawFilePath -> IO () diff --git a/cbits/HsUnix.c b/cbits/HsUnix.c index 8e16803..bdd1e80 100644 --- a/cbits/HsUnix.c +++ b/cbits/HsUnix.c @@ -36,18 +36,6 @@ int __hsunix_push_module(int fd, const char *module) #endif } -/* A size that will contain many path names, but not necessarily all - * (PATH_MAX is not defined on systems with unlimited path length, - * e.g. the Hurd). - */ -HsInt __hsunix_long_path_size(void) { -#ifdef PATH_MAX - return PATH_MAX; -#else - return 4096; -#endif -} - /* * read an entry from the directory stream; opt for the * re-entrant friendly way of doing this, if available. diff --git a/include/HsUnix.h b/include/HsUnix.h index dcd0c4a..1273452 100644 --- a/include/HsUnix.h +++ b/include/HsUnix.h @@ -116,10 +116,4 @@ fall back to O_FSYNC, which should be the same */ // push a SVR4 STREAMS module; do nothing if STREAMS not available int __hsunix_push_module(int fd, const char *module); -/* A size that will contain many path names, but not necessarily all - * (PATH_MAX is not defined on systems with unlimited path length, - * e.g. the Hurd). - */ -HsInt __hsunix_long_path_size(); - #endif From git at git.haskell.org Tue Apr 19 21:38:29 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:38:29 +0000 (UTC) Subject: [commit: packages/unix] master: Minor tweaks to HsUnix.h (8a40424) Message-ID: <20160419213829.EBF6B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8a40424aa0099a3c23c66df6486801815a6fe151/unix >--------------------------------------------------------------- commit 8a40424aa0099a3c23c66df6486801815a6fe151 Author: Herbert Valerio Riedel Date: Sun Jan 31 13:36:47 2016 +0100 Minor tweaks to HsUnix.h >--------------------------------------------------------------- 8a40424aa0099a3c23c66df6486801815a6fe151 include/HsUnix.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/HsUnix.h b/include/HsUnix.h index 1273452..1cbbeb3 100644 --- a/include/HsUnix.h +++ b/include/HsUnix.h @@ -89,9 +89,10 @@ #include #endif -/* in Signals.c */ +/* defined in rts/posix/Signals.c */ extern HsInt nocldstop; +/* defined in libc */ extern char **environ; #ifdef HAVE_RTLDNEXT @@ -105,7 +106,7 @@ void *__hsunix_rtldDefault (void); /* O_SYNC doesn't exist on Mac OS X and (at least some versions of) FreeBSD, fall back to O_FSYNC, which should be the same */ #ifndef O_SYNC -#define O_SYNC O_FSYNC +# define O_SYNC O_FSYNC #endif // not part of POSIX, hence may not be always defined From git at git.haskell.org Tue Apr 19 21:38:31 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:38:31 +0000 (UTC) Subject: [commit: packages/unix] master: Fix Haddock markup (081376c) Message-ID: <20160419213831.F14583A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/081376c3de398d21a6600b8615d189895d03d8ac/unix >--------------------------------------------------------------- commit 081376c3de398d21a6600b8615d189895d03d8ac Author: Herbert Valerio Riedel Date: Sun Jan 31 14:10:59 2016 +0100 Fix Haddock markup >--------------------------------------------------------------- 081376c3de398d21a6600b8615d189895d03d8ac System/Posix/DynamicLinker/Prim.hsc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/System/Posix/DynamicLinker/Prim.hsc b/System/Posix/DynamicLinker/Prim.hsc index 67d4aa8..f014bb6 100644 --- a/System/Posix/DynamicLinker/Prim.hsc +++ b/System/Posix/DynamicLinker/Prim.hsc @@ -13,8 +13,8 @@ -- Stability : provisional -- Portability : non-portable (requires POSIX) -- --- DLOpen and friend --- Derived from GModule.chs by M.Weber & M.Chakravarty which is part of c2hs +-- @dlopen(3)@ and friends +-- Derived from @GModule.chs@ by M.Weber & M.Chakravarty which is part of c2hs. -- I left the API more or less the same, mostly the flags are different. -- ----------------------------------------------------------------------------- @@ -44,12 +44,12 @@ import Foreign.C.Types import Foreign.C.String ( CString ) --- |On some hosts (e.g. SuSe and Ubuntu Linux) 'RTLD_NEXT' (and --- 'RTLD_DEFAULT') are not visible without setting the macro --- '_GNU_SOURCE'. Since we don't want to define this macro, you can use +-- |On some hosts (e.g. SuSe and Ubuntu Linux) @RTLD_NEXT@ (and +-- @RTLD_DEFAULT@) are not visible without setting the macro +-- @_GNU_SOURCE at . Since we don\'t want to define this macro, you can use -- the function 'haveRtldNext' to check wether the flag `Next` is -- available. Ideally, this will be optimized by the compiler so that it --- should be as efficient as an #ifdef. +-- should be as efficient as an @#ifdef at . -- -- If you fail to test the flag and use it although it is undefined, -- 'packDL' will throw an error. @@ -98,9 +98,9 @@ packRTLDFlag RTLD_LOCAL = #const RTLD_LOCAL -- |Flags for 'System.Posix.DynamicLinker.dlsym'. Notice that 'Next' -- might not be available on your particular platform! Use --- `haveRtldNext`. +-- 'haveRtldNext'. -- --- If 'RTLD_DEFAULT' is not defined on your platform, `packDL` `Default` +-- If 'RTLD_DEFAULT' is not defined on your platform, 'packDL' 'Default' -- reduces to 'nullPtr'. data DL = Null | Next | Default | DLHandle (Ptr ()) deriving (Show) From git at git.haskell.org Tue Apr 19 21:38:34 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:38:34 +0000 (UTC) Subject: [commit: packages/unix] master: Have Autoconf test for _NSGetEnviron presence (12799d0) Message-ID: <20160419213834.038B13A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/12799d0fc7dcff0dc95640b1efad0637ad011144/unix >--------------------------------------------------------------- commit 12799d0fc7dcff0dc95640b1efad0637ad011144 Author: Herbert Valerio Riedel Date: Sun Jan 31 16:54:04 2016 +0100 Have Autoconf test for _NSGetEnviron presence >--------------------------------------------------------------- 12799d0fc7dcff0dc95640b1efad0637ad011144 System/Posix/Env.hsc | 6 ++---- System/Posix/Env/ByteString.hsc | 4 ++-- configure.ac | 4 ++++ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/System/Posix/Env.hsc b/System/Posix/Env.hsc index 6412bae..7d5f04c 100644 --- a/System/Posix/Env.hsc +++ b/System/Posix/Env.hsc @@ -78,9 +78,8 @@ getEnvironmentPrim = do mapM peekFilePath arr getCEnviron :: IO (Ptr CString) - -#if darwin_HOST_OS --- You should not access _environ directly on Darwin in a bundle/shared library. +#if HAVE__NSGETENVIRON +-- You should not access @char **environ@ directly on Darwin in a bundle/shared library. -- See #2458 and http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man7/environ.7.html getCEnviron = nsGetEnviron >>= peek @@ -88,7 +87,6 @@ foreign import ccall unsafe "_NSGetEnviron" nsGetEnviron :: IO (Ptr (Ptr CString)) #else getCEnviron = peek c_environ_p - foreign import ccall unsafe "&environ" c_environ_p :: Ptr (Ptr CString) #endif diff --git a/System/Posix/Env/ByteString.hsc b/System/Posix/Env/ByteString.hsc index 57b03aa..c6c374c 100644 --- a/System/Posix/Env/ByteString.hsc +++ b/System/Posix/Env/ByteString.hsc @@ -69,8 +69,8 @@ getEnvironmentPrim = do mapM B.packCString arr getCEnviron :: IO (Ptr CString) -#if darwin_HOST_OS --- You should not access _environ directly on Darwin in a bundle/shared library. +#if HAVE__NSGETENVIRON +-- You should not access @char **environ@ directly on Darwin in a bundle/shared library. -- See #2458 and http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man7/environ.7.html getCEnviron = nsGetEnviron >>= peek diff --git a/configure.ac b/configure.ac index 5b6eb7c..fdc27e4 100644 --- a/configure.ac +++ b/configure.ac @@ -40,6 +40,10 @@ AC_CHECK_FUNCS([readdir_r]) dnl not available on android so check for it AC_CHECK_FUNCS([telldir seekdir]) +dnl When available, _NSGetEnviron() (defined in ) is +dnl the preferred way to access environ(7) +AC_CHECK_FUNCS([_NSGetEnviron]) + dnl This is e.g. available as a GNU extension in glibc 2.11+ AC_CHECK_DECLS([execvpe]) AC_CHECK_FUNCS([execvpe]) From git at git.haskell.org Tue Apr 19 21:38:36 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:38:36 +0000 (UTC) Subject: [commit: packages/unix] master: Add comment regarding genericRaise use (ff1c16d) Message-ID: <20160419213836.0A7553A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ff1c16d4ee0c4ca043bd99a5d6741ea2d53e7000/unix >--------------------------------------------------------------- commit ff1c16d4ee0c4ca043bd99a5d6741ea2d53e7000 Author: Herbert Valerio Riedel Date: Sun Jan 31 17:04:25 2016 +0100 Add comment regarding genericRaise use >--------------------------------------------------------------- ff1c16d4ee0c4ca043bd99a5d6741ea2d53e7000 System/Posix/Signals.hsc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/System/Posix/Signals.hsc b/System/Posix/Signals.hsc index 222911a..971973e 100644 --- a/System/Posix/Signals.hsc +++ b/System/Posix/Signals.hsc @@ -290,6 +290,9 @@ foreign import ccall unsafe "killpg" raiseSignal :: Signal -> IO () raiseSignal sig = throwErrnoIfMinus1_ "raiseSignal" (c_raise sig) +-- See also note in GHC's rts/RtsUtils.c +-- This is somewhat fragile because we need to keep the +-- `#if`-conditional in sync with GHC's runtime. #if (defined(openbsd_HOST_OS) || defined(freebsd_HOST_OS) || defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS) || defined(darwin_HOST_OS)) foreign import ccall unsafe "genericRaise" c_raise :: CInt -> IO CInt From git at git.haskell.org Tue Apr 19 21:38:38 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:38:38 +0000 (UTC) Subject: [commit: packages/unix] master: Testsuite: don't use only_compiler_types, assume ghc (4744303) Message-ID: <20160419213838.10E943A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/474430388a2a0dcfeef59510c23c2e1e35c5431b/unix >--------------------------------------------------------------- commit 474430388a2a0dcfeef59510c23c2e1e35c5431b Author: Thomas Miedema Date: Tue Feb 16 11:59:02 2016 +0100 Testsuite: don't use only_compiler_types, assume ghc >--------------------------------------------------------------- 474430388a2a0dcfeef59510c23c2e1e35c5431b tests/all.T | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/all.T b/tests/all.T index b6bd433..61deab9 100644 --- a/tests/all.T +++ b/tests/all.T @@ -1,7 +1,6 @@ test('signals001', normal, compile_and_run, ['-package unix -cpp']) -test('signals002', only_compiler_types(['ghc']), - compile_and_run, ['-package unix']) +test('signals002', [], compile_and_run, ['-package unix']) test('fileexist01', normal, compile_and_run, ['-package unix']) test('forkprocess01', [ only_compiler_types(['ghc']), extra_ways(['threaded1_ls']) ], # test #4512 @@ -28,9 +27,8 @@ test('resourceLimit', normal, compile_and_run, ['-package unix']) x86FreeBsdFail = when(platform('i386-unknown-freebsd'), expect_fail) -test('queryfdoption01', - [omit_ways(['ghci']), only_compiler_types(['ghc']), x86FreeBsdFail], - compile_and_run, ['-package unix']) +test('queryfdoption01', [omit_ways(['ghci']), x86FreeBsdFail], compile_and_run, + ['-package unix']) test('getEnvironment01', x86FreeBsdFail, compile_and_run, ['-package unix']) test('getEnvironment02', x86FreeBsdFail, compile_and_run, ['-package unix']) test('getGroupEntryForName', [x86FreeBsdFail, exit_code(1)], compile_and_run, From git at git.haskell.org Tue Apr 19 21:38:40 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:38:40 +0000 (UTC) Subject: [commit: packages/unix] master: Cleanup one more test (861ad25) Message-ID: <20160419213840.171953A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/861ad256e0a5337a1a685b1cd50ae91ee9374cab/unix >--------------------------------------------------------------- commit 861ad256e0a5337a1a685b1cd50ae91ee9374cab Author: Thomas Miedema Date: Tue Feb 16 13:17:13 2016 +0100 Cleanup one more test >--------------------------------------------------------------- 861ad256e0a5337a1a685b1cd50ae91ee9374cab tests/all.T | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/all.T b/tests/all.T index 61deab9..d878292 100644 --- a/tests/all.T +++ b/tests/all.T @@ -2,9 +2,10 @@ test('signals001', normal, compile_and_run, ['-package unix -cpp']) test('signals002', [], compile_and_run, ['-package unix']) test('fileexist01', normal, compile_and_run, ['-package unix']) -test('forkprocess01', [ only_compiler_types(['ghc']), - extra_ways(['threaded1_ls']) ], # test #4512 - compile_and_run, ['-package unix']) + +# test #4512 +test('forkprocess01', extra_ways(['threaded1_ls']), compile_and_run, + ['-package unix']) # # user001 may fail due to this bug in glibc: From git at git.haskell.org Tue Apr 19 21:38:42 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:38:42 +0000 (UTC) Subject: [commit: packages/unix] master: Convert /since/ to @since syntax (b7fa405) Message-ID: <20160419213842.1E7FE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b7fa405365c43fc2d45e37385ffd0111a4008eed/unix >--------------------------------------------------------------- commit b7fa405365c43fc2d45e37385ffd0111a4008eed Author: Herbert Valerio Riedel Date: Tue Apr 19 19:37:41 2016 +0200 Convert /since/ to @since syntax >--------------------------------------------------------------- b7fa405365c43fc2d45e37385ffd0111a4008eed System/Posix/Fcntl.hsc | 8 ++++---- System/Posix/Files.hsc | 6 +++--- System/Posix/Files/Common.hsc | 4 ++-- System/Posix/Process/Common.hsc | 2 +- System/Posix/Process/Internals.hs | 2 +- System/Posix/Signals.hsc | 8 ++++---- System/Posix/Unistd.hsc | 4 ++-- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/System/Posix/Fcntl.hsc b/System/Posix/Fcntl.hsc index 2d8ef12..c78f361 100644 --- a/System/Posix/Fcntl.hsc +++ b/System/Posix/Fcntl.hsc @@ -16,7 +16,7 @@ -- -- POSIX file control support -- --- /Since: 2.7.1.0/ +-- @since 2.7.1.0 ----------------------------------------------------------------------------- #include "HsUnix.h" @@ -44,7 +44,7 @@ import GHC.IO.Exception ( unsupportedOperation ) -- -- For more details, see documentation of @posix_fadvise(2)@. -- --- /Since: 2.7.1.0/ +-- @since 2.7.1.0 data Advice = AdviceNormal | AdviceRandom @@ -61,7 +61,7 @@ data Advice -- -- (use @#if HAVE_POSIX_FADVISE@ CPP guard to detect availability) -- --- /Since: 2.7.1.0/ +-- @since 2.7.1.0 fileAdvise :: Fd -> FileOffset -> FileOffset -> Advice -> IO () #if HAVE_POSIX_FADVISE fileAdvise fd off len adv = do @@ -88,7 +88,7 @@ fileAdvise _ _ _ _ = return () -- -- (use @#if HAVE_POSIX_FALLOCATE@ CPP guard to detect availability). -- --- /Since: 2.7.1.0/ +-- @since 2.7.1.0 fileAllocate :: Fd -> FileOffset -> FileOffset -> IO () #if HAVE_POSIX_FALLOCATE fileAllocate fd off len = do diff --git a/System/Posix/Files.hsc b/System/Posix/Files.hsc index 7c637cc..bbda084 100644 --- a/System/Posix/Files.hsc +++ b/System/Posix/Files.hsc @@ -347,7 +347,7 @@ setFileTimes name atime mtime = do -- -- Note: calls @utimensat@ or @utimes at . -- --- /Since: 2.7.0.0/ +-- @since 2.7.0.0 setFileTimesHiRes :: FilePath -> POSIXTime -> POSIXTime -> IO () #ifdef HAVE_UTIMENSAT setFileTimesHiRes name atime mtime = @@ -368,7 +368,7 @@ setFileTimesHiRes name atime mtime = -- -- Note: calls @utimensat@ or @lutimes at . -- --- /Since: 2.7.0.0/ +-- @since 2.7.0.0 setSymbolicLinkTimesHiRes :: FilePath -> POSIXTime -> POSIXTime -> IO () #if HAVE_UTIMENSAT setSymbolicLinkTimesHiRes name atime mtime = @@ -402,7 +402,7 @@ touchFile name = do -- -- Note: calls @lutimes at . -- --- /Since: 2.7.0.0/ +-- @since 2.7.0.0 touchSymbolicLink :: FilePath -> IO () #if HAVE_LUTIMES touchSymbolicLink name = diff --git a/System/Posix/Files/Common.hsc b/System/Posix/Files/Common.hsc index a1a4278..cc594cc 100644 --- a/System/Posix/Files/Common.hsc +++ b/System/Posix/Files/Common.hsc @@ -467,7 +467,7 @@ foreign import ccall unsafe "futimes" -- -- Note: calls @futimens@ or @futimes at . -- --- /Since: 2.7.0.0/ +-- @since 2.7.0.0 setFdTimesHiRes :: Fd -> POSIXTime -> POSIXTime -> IO () #if HAVE_FUTIMENS setFdTimesHiRes (Fd fd) atime mtime = @@ -488,7 +488,7 @@ setFdTimesHiRes = -- -- Note: calls @futimes at . -- --- /Since: 2.7.0.0/ +-- @since 2.7.0.0 touchFd :: Fd -> IO () #if HAVE_FUTIMES touchFd (Fd fd) = diff --git a/System/Posix/Process/Common.hsc b/System/Posix/Process/Common.hsc index 59212e4..7fb0823 100644 --- a/System/Posix/Process/Common.hsc +++ b/System/Posix/Process/Common.hsc @@ -301,7 +301,7 @@ foreign import ccall "forkProcess" forkProcessPrim :: StablePtr (IO ()) -> IO CP -- | Variant of 'forkProcess' in the style of 'forkIOWithUnmask'. -- --- /Since: 2.7.0.0/ +-- @since 2.7.0.0 forkProcessWithUnmask :: ((forall a . IO a -> IO a) -> IO ()) -> IO ProcessID forkProcessWithUnmask action = forkProcess (action unsafeUnmask) diff --git a/System/Posix/Process/Internals.hs b/System/Posix/Process/Internals.hs index 0bd99ae..ddafa10 100644 --- a/System/Posix/Process/Internals.hs +++ b/System/Posix/Process/Internals.hs @@ -19,7 +19,7 @@ data ProcessStatus -- signal, the @Bool@ is @True@ if a core -- dump was produced -- - -- /Since: 2.7.0.0/ + -- @since 2.7.0.0 | Stopped Signal -- ^ the process was stopped by a signal deriving (Eq, Ord, Show) diff --git a/System/Posix/Signals.hsc b/System/Posix/Signals.hsc index 971973e..f26765d 100644 --- a/System/Posix/Signals.hsc +++ b/System/Posix/Signals.hsc @@ -310,13 +310,13 @@ data Handler = Default -- not yet: | Hold | Catch (IO ()) | CatchOnce (IO ()) - | CatchInfo (SignalInfo -> IO ()) -- ^ /Since: 2.7.0.0/ - | CatchInfoOnce (SignalInfo -> IO ()) -- ^ /Since: 2.7.0.0/ + | CatchInfo (SignalInfo -> IO ()) -- ^ @since 2.7.0.0 + | CatchInfoOnce (SignalInfo -> IO ()) -- ^ @since 2.7.0.0 deriving (Typeable) -- | Information about a received signal (derived from @siginfo_t@). -- --- /Since: 2.7.0.0/ +-- @since 2.7.0.0 data SignalInfo = SignalInfo { siginfoSignal :: Signal, siginfoError :: Errno, @@ -326,7 +326,7 @@ data SignalInfo = SignalInfo { -- | Information specific to a particular type of signal -- (derived from @siginfo_t@). -- --- /Since: 2.7.0.0/ +-- @since 2.7.0.0 data SignalSpecificInfo = NoSignalSpecificInfo | SigChldInfo { diff --git a/System/Posix/Unistd.hsc b/System/Posix/Unistd.hsc index 84bd472..ec02216 100644 --- a/System/Posix/Unistd.hsc +++ b/System/Posix/Unistd.hsc @@ -227,7 +227,7 @@ foreign import ccall unsafe "sysconf" -- provide @fsync(2)@ (use @#if HAVE_FSYNC@ CPP guard to -- detect availability). -- --- /Since: 2.7.1.0/ +-- @since 2.7.1.0 fileSynchronise :: Fd -> IO () #if HAVE_FSYNC fileSynchronise fd = do @@ -248,7 +248,7 @@ fileSynchronise _ = ioError (ioeSetLocation unsupportedOperation -- provide @fdatasync(2)@ (use @#if HAVE_FDATASYNC@ CPP guard to -- detect availability). -- --- /Since: 2.7.1.0/ +-- @since 2.7.1.0 fileSynchroniseDataOnly :: Fd -> IO () #if HAVE_FDATASYNC fileSynchroniseDataOnly fd = do From git at git.haskell.org Tue Apr 19 21:38:44 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:38:44 +0000 (UTC) Subject: [commit: packages/unix] master: Update changelog for 2.7.2.0 release (5b2e91a) Message-ID: <20160419213844.23AA63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/unix On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5b2e91a09190f1686ea195d25183abda1757d771/unix >--------------------------------------------------------------- commit 5b2e91a09190f1686ea195d25183abda1757d771 Author: Herbert Valerio Riedel Date: Tue Apr 19 19:32:05 2016 +0200 Update changelog for 2.7.2.0 release >--------------------------------------------------------------- 5b2e91a09190f1686ea195d25183abda1757d771 changelog.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 000c006..eb429cb 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,8 @@ # Changelog for [`unix` package](http://hackage.haskell.org/package/unix) -## 2.7.2.0 *Feb 2016* +## 2.7.2.0 *Apr 2016* + + * Bundled with GHC 8.0.1 * Don't assume non-POSIX `WCOREDUMP(x)` macro exists From git at git.haskell.org Tue Apr 19 21:38:45 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 19 Apr 2016 21:38:45 +0000 (UTC) Subject: [commit: ghc] master: Update unix submodule to v2.7.2.0 release (81b14c1) Message-ID: <20160419213845.80DE13A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/81b14c141dc385dbb0de00ea72217185cfa22a09/ghc >--------------------------------------------------------------- commit 81b14c141dc385dbb0de00ea72217185cfa22a09 Author: Herbert Valerio Riedel Date: Tue Apr 19 23:40:52 2016 +0200 Update unix submodule to v2.7.2.0 release >--------------------------------------------------------------- 81b14c141dc385dbb0de00ea72217185cfa22a09 libraries/unix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/unix b/libraries/unix index 861ad25..5b2e91a 160000 --- a/libraries/unix +++ b/libraries/unix @@ -1 +1 @@ -Subproject commit 861ad256e0a5337a1a685b1cd50ae91ee9374cab +Subproject commit 5b2e91a09190f1686ea195d25183abda1757d771 From git at git.haskell.org Wed Apr 20 09:51:31 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 09:51:31 +0000 (UTC) Subject: [commit: ghc] master: Bump haddock submodule (7f71dbe) Message-ID: <20160420095131.3995D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7f71dbe3a17d6914f874488ef76d80c946db370c/ghc >--------------------------------------------------------------- commit 7f71dbe3a17d6914f874488ef76d80c946db370c Author: Ben Gamari Date: Wed Apr 20 10:59:32 2016 +0200 Bump haddock submodule Install files necessary for --hyperlinked-source. Fixes #11949. >--------------------------------------------------------------- 7f71dbe3a17d6914f874488ef76d80c946db370c utils/haddock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/haddock b/utils/haddock index a77728c..5c82c9f 160000 --- a/utils/haddock +++ b/utils/haddock @@ -1 +1 @@ -Subproject commit a77728cc274751e8b8077b3ccc8aacc7d00bf36d +Subproject commit 5c82c9fc2d21ddaae4a2470f1c375426968f19c6 From git at git.haskell.org Wed Apr 20 10:50:07 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 10:50:07 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Update hsc2hs submodule (d070ac4) Message-ID: <20160420105007.53AD93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/d070ac427bc51c5ca97b775587b048f05d351d67/ghc >--------------------------------------------------------------- commit d070ac427bc51c5ca97b775587b048f05d351d67 Author: Herbert Valerio Riedel Date: Tue Apr 19 13:56:54 2016 +0200 Update hsc2hs submodule This bumps the hsc2hs version to 0.68 (cherry picked from commit 81e227929c15ad82f6f67a7390ee140da85eefdb) >--------------------------------------------------------------- d070ac427bc51c5ca97b775587b048f05d351d67 utils/hsc2hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/hsc2hs b/utils/hsc2hs index d9c13cb..5119aeb 160000 --- a/utils/hsc2hs +++ b/utils/hsc2hs @@ -1 +1 @@ -Subproject commit d9c13cb8f5be89a030783d758fcf7c077351c6a9 +Subproject commit 5119aebacaca75d983b4d7db32a6305b7f8651dd From git at git.haskell.org Wed Apr 20 10:50:10 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 10:50:10 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Update binary submodule to 0.8.3.0 release (2c8b5df) Message-ID: <20160420105010.1EF013A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/2c8b5dff948e8d516412c92fd337ca9b10f6f414/ghc >--------------------------------------------------------------- commit 2c8b5dff948e8d516412c92fd337ca9b10f6f414 Author: Herbert Valerio Riedel Date: Tue Apr 19 22:33:58 2016 +0200 Update binary submodule to 0.8.3.0 release (cherry picked from commit ff290b86ad237d1a5517ad9414a22840f6e749da) >--------------------------------------------------------------- 2c8b5dff948e8d516412c92fd337ca9b10f6f414 libraries/binary | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/binary b/libraries/binary index 69915d0..38aef85 160000 --- a/libraries/binary +++ b/libraries/binary @@ -1 +1 @@ -Subproject commit 69915d0a26ae9eaa6b34367989ee8ed356ed13bb +Subproject commit 38aef85a759c9a0f64e8c40042e9fa1f675a2f1a From git at git.haskell.org Wed Apr 20 10:50:12 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 10:50:12 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Update deepseq submodule to latest 1.4.2.0 snapshot (6af2366) Message-ID: <20160420105012.C59713A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/6af236618b1d7e81a1191a89d5e1067cfc86550d/ghc >--------------------------------------------------------------- commit 6af236618b1d7e81a1191a89d5e1067cfc86550d Author: Herbert Valerio Riedel Date: Tue Apr 19 19:16:01 2016 +0200 Update deepseq submodule to latest 1.4.2.0 snapshot NB: this needs 91ee5090f1e3f43e9e803cf7005a7f3357e58377 (cherry picked from commit 96e1bb4536a6f130c9242e3c25566c7d2e71ee97) >--------------------------------------------------------------- 6af236618b1d7e81a1191a89d5e1067cfc86550d libraries/deepseq | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/deepseq b/libraries/deepseq index 40d4db0..cb66aa8 160000 --- a/libraries/deepseq +++ b/libraries/deepseq @@ -1 +1 @@ -Subproject commit 40d4db0a4e81a07ecd0f1bc77b8772088e75e478 +Subproject commit cb66aa890b0972375e31deaee3bc424f46beb68a From git at git.haskell.org Wed Apr 20 10:50:15 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 10:50:15 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Mark GHC.Stack.Types Trustworthy (d3fd3fe) Message-ID: <20160420105015.7945E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/d3fd3fea52458793122adc8ef580ddeca2d4dfe5/ghc >--------------------------------------------------------------- commit d3fd3fea52458793122adc8ef580ddeca2d4dfe5 Author: Herbert Valerio Riedel Date: Tue Apr 19 18:32:29 2016 +0200 Mark GHC.Stack.Types Trustworthy GHC can't infer this module safe due to the `GHC.Types (Char, Int)` and the (dummy) `GHC.Integer ()` import. If only `GHC.Types` was marked Trustworthy or Safe... (cherry picked from commit 91ee5090f1e3f43e9e803cf7005a7f3357e58377) >--------------------------------------------------------------- d3fd3fea52458793122adc8ef580ddeca2d4dfe5 libraries/base/GHC/Stack/Types.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries/base/GHC/Stack/Types.hs b/libraries/base/GHC/Stack/Types.hs index 33b24a4..29be6d6 100644 --- a/libraries/base/GHC/Stack/Types.hs +++ b/libraries/base/GHC/Stack/Types.hs @@ -4,6 +4,7 @@ {-# LANGUAGE KindSignatures #-} {-# LANGUAGE PolyKinds #-} {-# LANGUAGE RankNTypes #-} +{-# LANGUAGE Trustworthy #-} {-# OPTIONS_HADDOCK hide #-} -- we hide this module from haddock to enforce GHC.Stack as the main @@ -49,7 +50,7 @@ import cycle, -} import GHC.Classes (Eq) -import GHC.Types +import GHC.Types (Char, Int) -- Make implicit dependency known to build system import GHC.Tuple () From git at git.haskell.org Wed Apr 20 10:50:18 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 10:50:18 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Update unix submodule to v2.7.2.0 release (dbd9de3) Message-ID: <20160420105018.2F2623A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/dbd9de31754b5de0c55ab5686108b9dbb5ddefe8/ghc >--------------------------------------------------------------- commit dbd9de31754b5de0c55ab5686108b9dbb5ddefe8 Author: Herbert Valerio Riedel Date: Tue Apr 19 23:40:52 2016 +0200 Update unix submodule to v2.7.2.0 release (cherry picked from commit 81b14c141dc385dbb0de00ea72217185cfa22a09) >--------------------------------------------------------------- dbd9de31754b5de0c55ab5686108b9dbb5ddefe8 libraries/unix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/unix b/libraries/unix index ff1c16d..5b2e91a 160000 --- a/libraries/unix +++ b/libraries/unix @@ -1 +1 @@ -Subproject commit ff1c16d4ee0c4ca043bd99a5d6741ea2d53e7000 +Subproject commit 5b2e91a09190f1686ea195d25183abda1757d771 From git at git.haskell.org Wed Apr 20 10:50:20 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 10:50:20 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Bump haddock submodule (d4980e5) Message-ID: <20160420105020.DAE623A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/d4980e5170f83f2b2d319552b6f33daf70713b6a/ghc >--------------------------------------------------------------- commit d4980e5170f83f2b2d319552b6f33daf70713b6a Author: Ben Gamari Date: Wed Apr 20 11:47:31 2016 +0200 Bump haddock submodule Install files needed for --hyperlinked-source. Fixes #11949. >--------------------------------------------------------------- d4980e5170f83f2b2d319552b6f33daf70713b6a utils/haddock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/haddock b/utils/haddock index 03b02a0..3b980e7 160000 --- a/utils/haddock +++ b/utils/haddock @@ -1 +1 @@ -Subproject commit 03b02a0faa5381d3a614e3f39b36923b0e988051 +Subproject commit 3b980e7fc47bb898b00c7d37d442e0fd5716cb7c From git at git.haskell.org Wed Apr 20 11:08:54 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 11:08:54 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Ensure Typeable declarations end up in boot interface files (09665a7) Message-ID: <20160420110854.541FF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/09665a7e678691ca03702854d0a1f76812a11c1a/ghc >--------------------------------------------------------------- commit 09665a7e678691ca03702854d0a1f76812a11c1a Author: Ben Gamari Date: Wed Apr 20 12:05:13 2016 +0200 Ensure Typeable declarations end up in boot interface files Previously we neglected to emit Typeable TyCon and Module declarations when typechecking boot interface files. This resulted in #11824. Ultimately we'll likely want to do a bit of cleaning in this area but in the interest of getting some sort of fix in I'm merging this. Further clean-ups to come. Test Plan: Validate Reviewers: simonpj, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2108 GHC Trac Issues: #11824 (cherry picked from commit 048d6187b5892502e9bc75abfb21f9bd848a29cb) >--------------------------------------------------------------- 09665a7e678691ca03702854d0a1f76812a11c1a compiler/typecheck/TcRnDriver.hs | 7 +++++-- testsuite/tests/typecheck/T11824/all.T | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/compiler/typecheck/TcRnDriver.hs b/compiler/typecheck/TcRnDriver.hs index 42d810f..e7328b9 100644 --- a/compiler/typecheck/TcRnDriver.hs +++ b/compiler/typecheck/TcRnDriver.hs @@ -653,7 +653,6 @@ tcRnHsBootDecls hsc_src decls -- See Note [Extra dependencies from .hs-boot files] in RnSource ; (gbl_env, lie) <- captureConstraints $ setGblEnv tcg_env $ do { - -- Check for illegal declarations ; case group_tail of Just (SpliceDecl d _, _) -> badBootDecl hsc_src "splice" d @@ -669,6 +668,10 @@ tcRnHsBootDecls hsc_src decls <- tcTyClsInstDecls tycl_decls inst_decls deriv_decls val_binds ; setGblEnv tcg_env $ do { + -- Emit Typeable declarations + ; tcg_env <- setGblEnv tcg_env mkTypeableBinds + ; setGblEnv tcg_env $ do { + -- Typecheck value declarations ; traceTc "Tc5" empty ; val_ids <- tcHsBootSigs val_binds val_sigs @@ -691,7 +694,7 @@ tcRnHsBootDecls hsc_src decls } ; setGlobalTypeEnv gbl_env type_env2 - }} + }}} ; traceTc "boot" (ppr lie); return gbl_env } badBootDecl :: HscSource -> String -> Located decl -> TcM () diff --git a/testsuite/tests/typecheck/T11824/all.T b/testsuite/tests/typecheck/T11824/all.T index 90aaa1e..9a435ab 100644 --- a/testsuite/tests/typecheck/T11824/all.T +++ b/testsuite/tests/typecheck/T11824/all.T @@ -1 +1 @@ -test('T11824', expect_broken(11824), compile_and_run, ['']) \ No newline at end of file +test('T11824', normal, compile_and_run, ['']) \ No newline at end of file From git at git.haskell.org Wed Apr 20 12:42:20 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 12:42:20 +0000 (UTC) Subject: [commit: ghc] branch 'wip/D2128' created Message-ID: <20160420124220.95E0C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/D2128 Referencing: d3d7d01b591163b4f7e08e23b01b258b3b67e9ab From git at git.haskell.org Wed Apr 20 12:42:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 12:42:23 +0000 (UTC) Subject: [commit: ghc] wip/D2128: Implement the state hack without modifiyng OneShotInfo (d3d7d01) Message-ID: <20160420124223.4F5B53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/D2128 Link : http://ghc.haskell.org/trac/ghc/changeset/d3d7d01b591163b4f7e08e23b01b258b3b67e9ab/ghc >--------------------------------------------------------------- commit d3d7d01b591163b4f7e08e23b01b258b3b67e9ab Author: Joachim Breitner Date: Wed Apr 20 10:46:41 2016 +0200 Implement the state hack without modifiyng OneShotInfo Previously, the state hack would be implemented in mkLocalId, by looking at the type, and setting the OneShot flag accordingly. This patch changes this so that the OneShot flag faithfully represents what our various analyses found out, and the State Hack is implemented by adjusting the accessors, in particular isOneShotBndr and idStateHackOneShotInfo. This makes it easier to understand what's going on in the analyses, and de-clutters core dumps and interface files. I don?t expect any change in behaviour, at least not in non-fringe cases. >--------------------------------------------------------------- d3d7d01b591163b4f7e08e23b01b258b3b67e9ab compiler/basicTypes/Id.hs | 32 ++++++++++++++++---------------- compiler/coreSyn/CoreArity.hs | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/compiler/basicTypes/Id.hs b/compiler/basicTypes/Id.hs index d5b7898..b589809 100644 --- a/compiler/basicTypes/Id.hs +++ b/compiler/basicTypes/Id.hs @@ -74,7 +74,7 @@ module Id ( idInlineActivation, setInlineActivation, idRuleMatchInfo, -- ** One-shot lambdas - isOneShotBndr, isOneShotLambda, isProbablyOneShotLambda, + isOneShotBndr, isProbablyOneShotLambda, setOneShotLambda, clearOneShotLambda, updOneShotInfo, setIdOneShotInfo, isStateHackType, stateHackOneShot, typeOneShot, @@ -85,7 +85,7 @@ module Id ( idUnfolding, realIdUnfolding, idSpecialisation, idCoreRules, idHasRules, idCafInfo, - idOneShotInfo, + idOneShotInfo, idStateHackOneShotInfo, idOccInfo, -- ** Writing 'IdInfo' fields @@ -250,8 +250,7 @@ mkVanillaGlobalWithInfo = mkGlobalId VanillaId -- | For an explanation of global vs. local 'Id's, see "Var#globalvslocal" mkLocalId :: Name -> Type -> Id -mkLocalId name ty = mkLocalIdWithInfo name ty - (vanillaIdInfo `setOneShotInfo` typeOneShot ty) +mkLocalId name ty = mkLocalIdWithInfo name ty vanillaIdInfo -- It's tempting to ASSERT( not (isCoercionType ty) ), but don't. Sometimes, -- the type is a panic. (Search invented_id) @@ -259,7 +258,7 @@ mkLocalId name ty = mkLocalIdWithInfo name ty mkLocalCoVar :: Name -> Type -> CoVar mkLocalCoVar name ty = ASSERT( isCoercionType ty ) - Var.mkLocalVar CoVarId name ty (vanillaIdInfo `setOneShotInfo` typeOneShot ty) + Var.mkLocalVar CoVarId name ty vanillaIdInfo -- | Like 'mkLocalId', but checks the type to see if it should make a covar mkLocalIdOrCoVar :: Name -> Type -> Id @@ -687,14 +686,23 @@ isConLikeId id = isDataConWorkId id || isConLike (idRuleMatchInfo id) idOneShotInfo :: Id -> OneShotInfo idOneShotInfo id = oneShotInfo (idInfo id) +-- | Like 'idOneShotInfo', but taking the Horrible State Hack in to account +-- See Note [The state-transformer hack] in CoreArity +idStateHackOneShotInfo :: Id -> OneShotInfo +idStateHackOneShotInfo id + | isStateHackType (idType id) = stateHackOneShot + | otherwise = idOneShotInfo id + -- | Returns whether the lambda associated with the 'Id' is certainly applied at most once -- This one is the "business end", called externally. -- It works on type variables as well as Ids, returning True -- Its main purpose is to encapsulate the Horrible State Hack +-- See Note [The state-transformer hack] in CoreArity isOneShotBndr :: Var -> Bool isOneShotBndr var - | isTyVar var = True - | otherwise = isOneShotLambda var + | isTyVar var = True + | OneShotLam <- idStateHackOneShotInfo var = True + | otherwise = False -- | Should we apply the state hack to values of this 'Type'? stateHackOneShot :: OneShotInfo @@ -731,16 +739,8 @@ isStateHackType ty -- Another good example is in fill_in in PrelPack.hs. We should be able to -- spot that fill_in has arity 2 (and when Keith is done, we will) but we can't yet. - --- | Returns whether the lambda associated with the 'Id' is certainly applied at most once. --- You probably want to use 'isOneShotBndr' instead -isOneShotLambda :: Id -> Bool -isOneShotLambda id = case idOneShotInfo id of - OneShotLam -> True - _ -> False - isProbablyOneShotLambda :: Id -> Bool -isProbablyOneShotLambda id = case idOneShotInfo id of +isProbablyOneShotLambda id = case idStateHackOneShotInfo id of OneShotLam -> True ProbOneShot -> True NoOneShotInfo -> False diff --git a/compiler/coreSyn/CoreArity.hs b/compiler/coreSyn/CoreArity.hs index cf6cd98..59c261b 100644 --- a/compiler/coreSyn/CoreArity.hs +++ b/compiler/coreSyn/CoreArity.hs @@ -633,7 +633,7 @@ when saturated" so we don't want to be too gung-ho about saturating! -} arityLam :: Id -> ArityType -> ArityType -arityLam id (ATop as) = ATop (idOneShotInfo id : as) +arityLam id (ATop as) = ATop (idStateHackOneShotInfo id : as) arityLam _ (ABot n) = ABot (n+1) floatIn :: Bool -> ArityType -> ArityType From git at git.haskell.org Wed Apr 20 13:04:42 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 13:04:42 +0000 (UTC) Subject: [commit: packages/deepseq] branch 'wip/container-travis' created Message-ID: <20160420130442.8BBBB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/deepseq New branch : wip/container-travis Referencing: 8132f4883397dfea08eb57c77cf795b2221473f4 From git at git.haskell.org Wed Apr 20 13:04:44 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 13:04:44 +0000 (UTC) Subject: [commit: packages/deepseq] tag 'v1.4.2.0' created Message-ID: <20160420130444.8BC0D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/deepseq New tag : v1.4.2.0 Referencing: c394761ad556a7e7b3a316e650f013d274f7b3cf From git at git.haskell.org Wed Apr 20 13:04:46 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 13:04:46 +0000 (UTC) Subject: [commit: packages/deepseq] master, wip/container-travis: Disallow building with GHC-7.2 + array-0.4 (3c348a8) Message-ID: <20160420130446.91C6C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/deepseq On branches: master,wip/container-travis Link : http://git.haskell.org/packages/deepseq.git/commitdiff/3c348a8348f8ada85a8ee349a13456cd86d85790 >--------------------------------------------------------------- commit 3c348a8348f8ada85a8ee349a13456cd86d85790 Author: Adam Bergmark Date: Sun May 10 20:56:18 2015 +0200 Disallow building with GHC-7.2 + array-0.4 ``` [1 of 1] Compiling Control.DeepSeq ( Control/DeepSeq.hs, dist/dist-sandbox-c66cf055/build/Control/DeepSeq.o ) Control/DeepSeq.hs:91:1: ghc-prim:GHC.Generics can't be safely imported! The module itself isn't safe. ``` >--------------------------------------------------------------- 3c348a8348f8ada85a8ee349a13456cd86d85790 deepseq.cabal | 3 +++ 1 file changed, 3 insertions(+) diff --git a/deepseq.cabal b/deepseq.cabal index 7435b25..a6bb955 100644 --- a/deepseq.cabal +++ b/deepseq.cabal @@ -48,6 +48,9 @@ library if impl(ghc < 7.6) build-depends: ghc-prim == 0.2.* + if impl(ghc < 7.4) + build-depends: array < 0.4 + build-depends: base >= 4.3 && < 4.9, array >= 0.3 && < 0.6 ghc-options: -Wall From git at git.haskell.org Wed Apr 20 13:04:48 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 13:04:48 +0000 (UTC) Subject: [commit: packages/deepseq] master, wip/container-travis: Merge pull request #7 from bergmark/patch-1 (914a8a1) Message-ID: <20160420130448.988853A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/deepseq On branches: master,wip/container-travis Link : http://git.haskell.org/packages/deepseq.git/commitdiff/914a8a1067701d61619d40a02e7416e6cada96f8 >--------------------------------------------------------------- commit 914a8a1067701d61619d40a02e7416e6cada96f8 Merge: c6cb196 3c348a8 Author: Herbert Valerio Riedel Date: Tue Jun 23 12:33:45 2015 +0200 Merge pull request #7 from bergmark/patch-1 Disallow building with GHC-7.2 + array-0.4 >--------------------------------------------------------------- 914a8a1067701d61619d40a02e7416e6cada96f8 deepseq.cabal | 3 +++ 1 file changed, 3 insertions(+) From git at git.haskell.org Wed Apr 20 13:04:50 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 13:04:50 +0000 (UTC) Subject: [commit: packages/deepseq] master, wip/container-travis: Preparation for 1.4.1.1 point-release (0ffb686) Message-ID: <20160420130450.9D0043A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/deepseq On branches: master,wip/container-travis Link : http://git.haskell.org/packages/deepseq.git/commitdiff/0ffb686ecb063a90a76bc64c387de1ca7dcaf2bb >--------------------------------------------------------------- commit 0ffb686ecb063a90a76bc64c387de1ca7dcaf2bb Author: Herbert Valerio Riedel Date: Sat Aug 22 10:00:40 2015 +0200 Preparation for 1.4.1.1 point-release >--------------------------------------------------------------- 0ffb686ecb063a90a76bc64c387de1ca7dcaf2bb changelog.md | 5 +++++ deepseq.cabal | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 0f8a14d..977a4d7 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,10 @@ # Changelog for [`deepseq` package](http://hackage.haskell.org/package/deepseq) +## 1.4.1.2 *Aug 2015* + + * Avoid the broken combination of GHC-7.2 with `array>=0.4` + ([#7](https://github.com/haskell/deepseq/pull/7)) + ## 1.4.1.1 *Mar 2015* * Bundled with GHC 7.10.1 diff --git a/deepseq.cabal b/deepseq.cabal index a6bb955..7df56e1 100644 --- a/deepseq.cabal +++ b/deepseq.cabal @@ -1,5 +1,5 @@ name: deepseq -version: 1.4.1.1 +version: 1.4.1.2 -- NOTE: Don't forget to update ./changelog.md license: BSD3 license-file: LICENSE From git at git.haskell.org Wed Apr 20 13:04:52 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 13:04:52 +0000 (UTC) Subject: [commit: packages/deepseq] wip/container-travis: Convert to containerized Travis-CI config (4dfca32) Message-ID: <20160420130452.A20A43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/deepseq On branch : wip/container-travis Link : http://git.haskell.org/packages/deepseq.git/commitdiff/4dfca32fcabc5749b299c9b3456e2030e7083e6c >--------------------------------------------------------------- commit 4dfca32fcabc5749b299c9b3456e2030e7083e6c Author: Herbert Valerio Riedel Date: Sat Aug 22 10:08:04 2015 +0200 Convert to containerized Travis-CI config >--------------------------------------------------------------- 4dfca32fcabc5749b299c9b3456e2030e7083e6c .travis.yml | 146 +++++++++++++++++++++++++++++++++++++++++++--------------- deepseq.cabal | 2 +- 2 files changed, 110 insertions(+), 38 deletions(-) diff --git a/.travis.yml b/.travis.yml index 82be4d5..7e02065 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,47 +1,119 @@ -env: - - CABALVER=1.16 GHCVER=7.0.1 - - CABALVER=1.16 GHCVER=7.0.2 - - CABALVER=1.16 GHCVER=7.0.3 - - CABALVER=1.16 GHCVER=7.0.4 - - CABALVER=1.16 GHCVER=7.2.1 - - CABALVER=1.16 GHCVER=7.2.2 - - CABALVER=1.16 GHCVER=7.4.1 - - CABALVER=1.16 GHCVER=7.4.2 - - CABALVER=1.16 GHCVER=7.6.1 - - CABALVER=1.16 GHCVER=7.6.2 - - CABALVER=1.16 GHCVER=7.6.3 - - CABALVER=1.18 GHCVER=7.8.1 - - CABALVER=1.18 GHCVER=7.8.2 - - CABALVER=1.18 GHCVER=7.8.3 - - CABALVER=1.18 GHCVER=7.8.4 - - CABALVER=1.22 GHCVER=7.10.1 - - CABALVER=head GHCVER=head +# This file has been generated -- see https://github.com/hvr/multi-ghc-travis +language: c +sudo: false + +cache: + directories: + - $HOME/.cabsnap + - $HOME/.cabal/packages + +before_cache: + - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log + - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.tar matrix: - allow_failures: - - env: CABALVER=head GHCVER=head + include: + - env: CABALVER=1.16 GHCVER=7.0.1 + compiler: ": #GHC 7.0.1" + addons: {apt: {packages: [cabal-install-1.16,ghc-7.0.1], sources: [hvr-ghc]}} + - env: CABALVER=1.16 GHCVER=7.0.2 + compiler: ": #GHC 7.0.2" + addons: {apt: {packages: [cabal-install-1.16,ghc-7.0.2], sources: [hvr-ghc]}} + - env: CABALVER=1.16 GHCVER=7.0.3 + compiler: ": #GHC 7.0.3" + addons: {apt: {packages: [cabal-install-1.16,ghc-7.0.3], sources: [hvr-ghc]}} + - env: CABALVER=1.16 GHCVER=7.0.4 + compiler: ": #GHC 7.0.4" + addons: {apt: {packages: [cabal-install-1.16,ghc-7.0.4], sources: [hvr-ghc]}} + - env: CABALVER=1.16 GHCVER=7.2.1 + compiler: ": #GHC 7.2.1" + addons: {apt: {packages: [cabal-install-1.16,ghc-7.2.1], sources: [hvr-ghc]}} + - env: CABALVER=1.16 GHCVER=7.2.2 + compiler: ": #GHC 7.2.2" + addons: {apt: {packages: [cabal-install-1.16,ghc-7.2.2], sources: [hvr-ghc]}} + - env: CABALVER=1.16 GHCVER=7.4.1 + compiler: ": #GHC 7.4.1" + addons: {apt: {packages: [cabal-install-1.16,ghc-7.4.1], sources: [hvr-ghc]}} + - env: CABALVER=1.16 GHCVER=7.4.2 + compiler: ": #GHC 7.4.2" + addons: {apt: {packages: [cabal-install-1.16,ghc-7.4.2], sources: [hvr-ghc]}} + - env: CABALVER=1.16 GHCVER=7.6.1 + compiler: ": #GHC 7.6.1" + addons: {apt: {packages: [cabal-install-1.16,ghc-7.6.1], sources: [hvr-ghc]}} + - env: CABALVER=1.16 GHCVER=7.6.2 + compiler: ": #GHC 7.6.2" + addons: {apt: {packages: [cabal-install-1.16,ghc-7.6.2], sources: [hvr-ghc]}} + - env: CABALVER=1.16 GHCVER=7.6.3 + compiler: ": #GHC 7.6.3" + addons: {apt: {packages: [cabal-install-1.16,ghc-7.6.3], sources: [hvr-ghc]}} + - env: CABALVER=1.18 GHCVER=7.8.1 + compiler: ": #GHC 7.8.1" + addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.1], sources: [hvr-ghc]}} + - env: CABALVER=1.18 GHCVER=7.8.2 + compiler: ": #GHC 7.8.2" + addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.2], sources: [hvr-ghc]}} + - env: CABALVER=1.18 GHCVER=7.8.3 + compiler: ": #GHC 7.8.3" + addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.3], sources: [hvr-ghc]}} + - env: CABALVER=1.18 GHCVER=7.8.4 + compiler: ": #GHC 7.8.4" + addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4], sources: [hvr-ghc]}} + - env: CABALVER=1.22 GHCVER=7.10.1 + compiler: ": #GHC 7.10.1" + addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.1], sources: [hvr-ghc]}} before_install: - - travis_retry sudo add-apt-repository -y ppa:hvr/ghc - - travis_retry sudo apt-get update - - travis_retry sudo apt-get install cabal-install-$CABALVER ghc-$GHCVER + - unset CC - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH install: - - cabal update - - ghc --version + - cabal --version + - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]" + - if [ -f $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz ]; + then + zcat $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz > + $HOME/.cabal/packages/hackage.haskell.org/00-index.tar; + fi + - travis_retry cabal update -v + - sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config + - cabal install --only-dependencies --dry -v > installplan.txt + - sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt -script: - - cabal configure -v2 - - cabal build -v2 - - if [ "$CABALVER" != "1.16" ]; then cabal check; fi - - cabal sdist -# The following scriptlet checks that the resulting source distribution can be built & installed - - export SRC_TGZ=$(cabal info . | awk '{print $2 ".tar.gz";exit}') ; - cd dist/; - if [ -f "$SRC_TGZ" ]; then - cabal install --force-reinstalls "$SRC_TGZ"; +# check whether current requested install-plan matches cached package-db snapshot + - if diff -u installplan.txt $HOME/.cabsnap/installplan.txt; + then + echo "cabal build-cache HIT"; + rm -rfv .ghc; + cp -a $HOME/.cabsnap/ghc $HOME/.ghc; + cp -a $HOME/.cabsnap/lib $HOME/.cabsnap/share $HOME/.cabsnap/bin $HOME/.cabal/; else - echo "expected '$SRC_TGZ' not found"; - exit 1; + echo "cabal build-cache MISS"; + rm -rf $HOME/.cabsnap; + mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin; + cabal install --only-dependencies; + fi + +# snapshot package-db on cache miss + - if [ ! -d $HOME/.cabsnap ]; + then + echo "snapshotting package-db to build-cache"; + mkdir $HOME/.cabsnap; + cp -a $HOME/.ghc $HOME/.cabsnap/ghc; + cp -a $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin installplan.txt $HOME/.cabsnap/; fi + +# Here starts the actual work to be performed for the package under test; +# any command which exits with a non-zero exit code causes the build to fail. +script: + - if [ -f configure.ac ]; then autoreconf -i; fi + - cabal configure -v2 # -v2 provides useful information for debugging + - cabal build # this builds all libraries and executables (including tests/benchmarks) + - cabal sdist # tests that a source-distribution can be generated + +# Check that the resulting source distribution can be built & installed. +# If there are no other `.tar.gz` files in `dist`, this can be even simpler: +# `cabal install --force-reinstalls dist/*-*.tar.gz` + - SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz && + (cd dist && cabal install --force-reinstalls "$SRC_TGZ") + +# EOF diff --git a/deepseq.cabal b/deepseq.cabal index 7df56e1..6e798a3 100644 --- a/deepseq.cabal +++ b/deepseq.cabal @@ -22,7 +22,7 @@ description: data types. build-type: Simple cabal-version: >=1.10 -tested-with: GHC==7.8.3, GHC==7.8.2, GHC==7.8.1, GHC==7.6.3, GHC==7.6.2, GHC==7.6.1, GHC==7.4.2, GHC==7.4.1, GHC==7.2.2, GHC==7.2.1, GHC==7.0.4, GHC==7.0.3, GHC==7.0.2, GHC==7.0.1 +tested-with: GHC==7.10.1, GHC==7.8.4, GHC==7.8.3, GHC==7.8.2, GHC==7.8.1, GHC==7.6.3, GHC==7.6.2, GHC==7.6.1, GHC==7.4.2, GHC==7.4.1, GHC==7.2.2, GHC==7.2.1, GHC==7.0.4, GHC==7.0.3, GHC==7.0.2, GHC==7.0.1 extra-source-files: changelog.md From git at git.haskell.org Wed Apr 20 13:04:54 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 13:04:54 +0000 (UTC) Subject: [commit: packages/deepseq] wip/container-travis: Fixup (8132f48) Message-ID: <20160420130454.A74213A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/deepseq On branch : wip/container-travis Link : http://git.haskell.org/packages/deepseq.git/commitdiff/8132f4883397dfea08eb57c77cf795b2221473f4 >--------------------------------------------------------------- commit 8132f4883397dfea08eb57c77cf795b2221473f4 Author: Herbert Valerio Riedel Date: Sat Aug 22 10:29:49 2015 +0200 Fixup >--------------------------------------------------------------- 8132f4883397dfea08eb57c77cf795b2221473f4 .travis.yml | 6 ++++++ deepseq.cabal | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7e02065..2a1f27c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -61,6 +61,12 @@ matrix: - env: CABALVER=1.22 GHCVER=7.10.1 compiler: ": #GHC 7.10.1" addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.1], sources: [hvr-ghc]}} + - env: CABALVER=head GHCVER=head + compiler: ": #GHC head" + addons: {apt: {packages: [cabal-install-head,ghc-head], sources: [hvr-ghc]}} + + allow_failures: + - env: CABALVER=head GHCVER=head before_install: - unset CC diff --git a/deepseq.cabal b/deepseq.cabal index 6e798a3..79dbd8d 100644 --- a/deepseq.cabal +++ b/deepseq.cabal @@ -22,7 +22,7 @@ description: data types. build-type: Simple cabal-version: >=1.10 -tested-with: GHC==7.10.1, GHC==7.8.4, GHC==7.8.3, GHC==7.8.2, GHC==7.8.1, GHC==7.6.3, GHC==7.6.2, GHC==7.6.1, GHC==7.4.2, GHC==7.4.1, GHC==7.2.2, GHC==7.2.1, GHC==7.0.4, GHC==7.0.3, GHC==7.0.2, GHC==7.0.1 +tested-with: GHC==7.11.*, GHC==7.10.1, GHC==7.8.4, GHC==7.8.3, GHC==7.8.2, GHC==7.8.1, GHC==7.6.3, GHC==7.6.2, GHC==7.6.1, GHC==7.4.2, GHC==7.4.1, GHC==7.2.2, GHC==7.2.1, GHC==7.0.4, GHC==7.0.3, GHC==7.0.2, GHC==7.0.1 extra-source-files: changelog.md From git at git.haskell.org Wed Apr 20 13:04:56 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 13:04:56 +0000 (UTC) Subject: [commit: packages/deepseq] master: Convert to containerized Travis-CI config (28ce6c5) Message-ID: <20160420130456.AE2C03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/deepseq On branch : master Link : http://git.haskell.org/packages/deepseq.git/commitdiff/28ce6c5bfae207cfa4acde5a7e25a70840f8c27d >--------------------------------------------------------------- commit 28ce6c5bfae207cfa4acde5a7e25a70840f8c27d Author: Herbert Valerio Riedel Date: Sat Aug 22 10:08:04 2015 +0200 Convert to containerized Travis-CI config >--------------------------------------------------------------- 28ce6c5bfae207cfa4acde5a7e25a70840f8c27d .travis.yml | 150 ++++++++++++++++++++++++++++++++++++++++++++-------------- deepseq.cabal | 2 +- 2 files changed, 115 insertions(+), 37 deletions(-) diff --git a/.travis.yml b/.travis.yml index 82be4d5..2a1f27c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,47 +1,125 @@ -env: - - CABALVER=1.16 GHCVER=7.0.1 - - CABALVER=1.16 GHCVER=7.0.2 - - CABALVER=1.16 GHCVER=7.0.3 - - CABALVER=1.16 GHCVER=7.0.4 - - CABALVER=1.16 GHCVER=7.2.1 - - CABALVER=1.16 GHCVER=7.2.2 - - CABALVER=1.16 GHCVER=7.4.1 - - CABALVER=1.16 GHCVER=7.4.2 - - CABALVER=1.16 GHCVER=7.6.1 - - CABALVER=1.16 GHCVER=7.6.2 - - CABALVER=1.16 GHCVER=7.6.3 - - CABALVER=1.18 GHCVER=7.8.1 - - CABALVER=1.18 GHCVER=7.8.2 - - CABALVER=1.18 GHCVER=7.8.3 - - CABALVER=1.18 GHCVER=7.8.4 - - CABALVER=1.22 GHCVER=7.10.1 - - CABALVER=head GHCVER=head +# This file has been generated -- see https://github.com/hvr/multi-ghc-travis +language: c +sudo: false + +cache: + directories: + - $HOME/.cabsnap + - $HOME/.cabal/packages + +before_cache: + - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log + - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.tar matrix: + include: + - env: CABALVER=1.16 GHCVER=7.0.1 + compiler: ": #GHC 7.0.1" + addons: {apt: {packages: [cabal-install-1.16,ghc-7.0.1], sources: [hvr-ghc]}} + - env: CABALVER=1.16 GHCVER=7.0.2 + compiler: ": #GHC 7.0.2" + addons: {apt: {packages: [cabal-install-1.16,ghc-7.0.2], sources: [hvr-ghc]}} + - env: CABALVER=1.16 GHCVER=7.0.3 + compiler: ": #GHC 7.0.3" + addons: {apt: {packages: [cabal-install-1.16,ghc-7.0.3], sources: [hvr-ghc]}} + - env: CABALVER=1.16 GHCVER=7.0.4 + compiler: ": #GHC 7.0.4" + addons: {apt: {packages: [cabal-install-1.16,ghc-7.0.4], sources: [hvr-ghc]}} + - env: CABALVER=1.16 GHCVER=7.2.1 + compiler: ": #GHC 7.2.1" + addons: {apt: {packages: [cabal-install-1.16,ghc-7.2.1], sources: [hvr-ghc]}} + - env: CABALVER=1.16 GHCVER=7.2.2 + compiler: ": #GHC 7.2.2" + addons: {apt: {packages: [cabal-install-1.16,ghc-7.2.2], sources: [hvr-ghc]}} + - env: CABALVER=1.16 GHCVER=7.4.1 + compiler: ": #GHC 7.4.1" + addons: {apt: {packages: [cabal-install-1.16,ghc-7.4.1], sources: [hvr-ghc]}} + - env: CABALVER=1.16 GHCVER=7.4.2 + compiler: ": #GHC 7.4.2" + addons: {apt: {packages: [cabal-install-1.16,ghc-7.4.2], sources: [hvr-ghc]}} + - env: CABALVER=1.16 GHCVER=7.6.1 + compiler: ": #GHC 7.6.1" + addons: {apt: {packages: [cabal-install-1.16,ghc-7.6.1], sources: [hvr-ghc]}} + - env: CABALVER=1.16 GHCVER=7.6.2 + compiler: ": #GHC 7.6.2" + addons: {apt: {packages: [cabal-install-1.16,ghc-7.6.2], sources: [hvr-ghc]}} + - env: CABALVER=1.16 GHCVER=7.6.3 + compiler: ": #GHC 7.6.3" + addons: {apt: {packages: [cabal-install-1.16,ghc-7.6.3], sources: [hvr-ghc]}} + - env: CABALVER=1.18 GHCVER=7.8.1 + compiler: ": #GHC 7.8.1" + addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.1], sources: [hvr-ghc]}} + - env: CABALVER=1.18 GHCVER=7.8.2 + compiler: ": #GHC 7.8.2" + addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.2], sources: [hvr-ghc]}} + - env: CABALVER=1.18 GHCVER=7.8.3 + compiler: ": #GHC 7.8.3" + addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.3], sources: [hvr-ghc]}} + - env: CABALVER=1.18 GHCVER=7.8.4 + compiler: ": #GHC 7.8.4" + addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4], sources: [hvr-ghc]}} + - env: CABALVER=1.22 GHCVER=7.10.1 + compiler: ": #GHC 7.10.1" + addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.1], sources: [hvr-ghc]}} + - env: CABALVER=head GHCVER=head + compiler: ": #GHC head" + addons: {apt: {packages: [cabal-install-head,ghc-head], sources: [hvr-ghc]}} + allow_failures: - - env: CABALVER=head GHCVER=head + - env: CABALVER=head GHCVER=head before_install: - - travis_retry sudo add-apt-repository -y ppa:hvr/ghc - - travis_retry sudo apt-get update - - travis_retry sudo apt-get install cabal-install-$CABALVER ghc-$GHCVER + - unset CC - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH install: - - cabal update - - ghc --version + - cabal --version + - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]" + - if [ -f $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz ]; + then + zcat $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz > + $HOME/.cabal/packages/hackage.haskell.org/00-index.tar; + fi + - travis_retry cabal update -v + - sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config + - cabal install --only-dependencies --dry -v > installplan.txt + - sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt -script: - - cabal configure -v2 - - cabal build -v2 - - if [ "$CABALVER" != "1.16" ]; then cabal check; fi - - cabal sdist -# The following scriptlet checks that the resulting source distribution can be built & installed - - export SRC_TGZ=$(cabal info . | awk '{print $2 ".tar.gz";exit}') ; - cd dist/; - if [ -f "$SRC_TGZ" ]; then - cabal install --force-reinstalls "$SRC_TGZ"; +# check whether current requested install-plan matches cached package-db snapshot + - if diff -u installplan.txt $HOME/.cabsnap/installplan.txt; + then + echo "cabal build-cache HIT"; + rm -rfv .ghc; + cp -a $HOME/.cabsnap/ghc $HOME/.ghc; + cp -a $HOME/.cabsnap/lib $HOME/.cabsnap/share $HOME/.cabsnap/bin $HOME/.cabal/; else - echo "expected '$SRC_TGZ' not found"; - exit 1; + echo "cabal build-cache MISS"; + rm -rf $HOME/.cabsnap; + mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin; + cabal install --only-dependencies; fi + +# snapshot package-db on cache miss + - if [ ! -d $HOME/.cabsnap ]; + then + echo "snapshotting package-db to build-cache"; + mkdir $HOME/.cabsnap; + cp -a $HOME/.ghc $HOME/.cabsnap/ghc; + cp -a $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin installplan.txt $HOME/.cabsnap/; + fi + +# Here starts the actual work to be performed for the package under test; +# any command which exits with a non-zero exit code causes the build to fail. +script: + - if [ -f configure.ac ]; then autoreconf -i; fi + - cabal configure -v2 # -v2 provides useful information for debugging + - cabal build # this builds all libraries and executables (including tests/benchmarks) + - cabal sdist # tests that a source-distribution can be generated + +# Check that the resulting source distribution can be built & installed. +# If there are no other `.tar.gz` files in `dist`, this can be even simpler: +# `cabal install --force-reinstalls dist/*-*.tar.gz` + - SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz && + (cd dist && cabal install --force-reinstalls "$SRC_TGZ") + +# EOF diff --git a/deepseq.cabal b/deepseq.cabal index 7df56e1..79dbd8d 100644 --- a/deepseq.cabal +++ b/deepseq.cabal @@ -22,7 +22,7 @@ description: data types. build-type: Simple cabal-version: >=1.10 -tested-with: GHC==7.8.3, GHC==7.8.2, GHC==7.8.1, GHC==7.6.3, GHC==7.6.2, GHC==7.6.1, GHC==7.4.2, GHC==7.4.1, GHC==7.2.2, GHC==7.2.1, GHC==7.0.4, GHC==7.0.3, GHC==7.0.2, GHC==7.0.1 +tested-with: GHC==7.11.*, GHC==7.10.1, GHC==7.8.4, GHC==7.8.3, GHC==7.8.2, GHC==7.8.1, GHC==7.6.3, GHC==7.6.2, GHC==7.6.1, GHC==7.4.2, GHC==7.4.1, GHC==7.2.2, GHC==7.2.1, GHC==7.0.4, GHC==7.0.3, GHC==7.0.2, GHC==7.0.1 extra-source-files: changelog.md From git at git.haskell.org Wed Apr 20 13:04:58 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 13:04:58 +0000 (UTC) Subject: [commit: packages/deepseq] master: Make NFData (Proxy a) instance poly-kinded (0ada5dd) Message-ID: <20160420130458.B3CA93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/deepseq On branch : master Link : http://git.haskell.org/packages/deepseq.git/commitdiff/0ada5ddd6d97624a2c1417f8f85ad1c0257b78bd >--------------------------------------------------------------- commit 0ada5ddd6d97624a2c1417f8f85ad1c0257b78bd Author: RyanGlScott Date: Sat Aug 22 12:16:39 2015 -0400 Make NFData (Proxy a) instance poly-kinded >--------------------------------------------------------------- 0ada5ddd6d97624a2c1417f8f85ad1c0257b78bd Control/DeepSeq.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Control/DeepSeq.hs b/Control/DeepSeq.hs index c39906e..419d479 100644 --- a/Control/DeepSeq.hs +++ b/Control/DeepSeq.hs @@ -8,6 +8,9 @@ {-# LANGUAGE Safe #-} # endif #endif +#if __GLASGOW_HASKELL__ >= 706 +{-# LANGUAGE PolyKinds #-} +#endif ----------------------------------------------------------------------------- -- | -- Module : Control.DeepSeq From git at git.haskell.org Wed Apr 20 13:05:00 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 13:05:00 +0000 (UTC) Subject: [commit: packages/deepseq] master: Merge pull request #9 from RyanGlScott/polykinds (2d73418) Message-ID: <20160420130500.B8A3B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/deepseq On branch : master Link : http://git.haskell.org/packages/deepseq.git/commitdiff/2d7341833912cbfad6796341dcb6e93ff18c54fb >--------------------------------------------------------------- commit 2d7341833912cbfad6796341dcb6e93ff18c54fb Merge: 28ce6c5 0ada5dd Author: Herbert Valerio Riedel Date: Thu Sep 3 17:56:26 2015 +0200 Merge pull request #9 from RyanGlScott/polykinds Make NFData (Proxy a) instance poly-kinded >--------------------------------------------------------------- 2d7341833912cbfad6796341dcb6e93ff18c54fb Control/DeepSeq.hs | 3 +++ 1 file changed, 3 insertions(+) From git at git.haskell.org Wed Apr 20 13:05:02 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 13:05:02 +0000 (UTC) Subject: [commit: packages/deepseq] master: Minor version bump (635a8ce) Message-ID: <20160420130502.BE8353A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/deepseq On branch : master Link : http://git.haskell.org/packages/deepseq.git/commitdiff/635a8ceae4972c40a5ba6ec70846b1528797da5d >--------------------------------------------------------------- commit 635a8ceae4972c40a5ba6ec70846b1528797da5d Author: Herbert Valerio Riedel Date: Thu Sep 3 17:59:13 2015 +0200 Minor version bump >--------------------------------------------------------------- 635a8ceae4972c40a5ba6ec70846b1528797da5d deepseq.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deepseq.cabal b/deepseq.cabal index 79dbd8d..724801b 100644 --- a/deepseq.cabal +++ b/deepseq.cabal @@ -1,5 +1,5 @@ name: deepseq -version: 1.4.1.2 +version: 1.4.2.0 -- NOTE: Don't forget to update ./changelog.md license: BSD3 license-file: LICENSE From git at git.haskell.org Wed Apr 20 13:05:04 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 13:05:04 +0000 (UTC) Subject: [commit: packages/deepseq] master: Foreign.Ptr instances. (b88c2ed) Message-ID: <20160420130504.C3C863A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/deepseq On branch : master Link : http://git.haskell.org/packages/deepseq.git/commitdiff/b88c2ed2a33caac4dc304d8bccdd39fc91e96735 >--------------------------------------------------------------- commit b88c2ed2a33caac4dc304d8bccdd39fc91e96735 Author: Mathieu Boespflug Date: Sun Oct 4 20:15:59 2015 +0200 Foreign.Ptr instances. >--------------------------------------------------------------- b88c2ed2a33caac4dc304d8bccdd39fc91e96735 Control/DeepSeq.hs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Control/DeepSeq.hs b/Control/DeepSeq.hs index 419d479..0b87c2e 100644 --- a/Control/DeepSeq.hs +++ b/Control/DeepSeq.hs @@ -71,6 +71,7 @@ import Data.Fixed import Data.Version import Data.Monoid import Data.Unique ( Unique ) +import Foreign.Ptr import Foreign.C.Types import System.Mem.StableName ( StableName ) @@ -421,6 +422,15 @@ instance NFData Fingerprint where #endif ---------------------------------------------------------------------------- +-- Foreign.Ptr + +-- |/Since: 1.4.3.0/ +instance NFData (Ptr a) where rnf !_ = () + +-- |/Since: 1.4.3.0/ +instance NFData (FunPtr a) where rnf !_ = () + +---------------------------------------------------------------------------- -- Foreign.C.Types -- |/Since: 1.4.0.0/ From git at git.haskell.org Wed Apr 20 13:05:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 13:05:06 +0000 (UTC) Subject: [commit: packages/deepseq] master: Changelog for #10 (e153c1e) Message-ID: <20160420130506.C93343A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/deepseq On branch : master Link : http://git.haskell.org/packages/deepseq.git/commitdiff/e153c1eeb7499f378a5e762b90bb635d89283abb >--------------------------------------------------------------- commit e153c1eeb7499f378a5e762b90bb635d89283abb Author: Eric Mertens Date: Mon Oct 12 23:20:08 2015 -0700 Changelog for #10 >--------------------------------------------------------------- e153c1eeb7499f378a5e762b90bb635d89283abb Control/DeepSeq.hs | 4 ++-- changelog.md | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Control/DeepSeq.hs b/Control/DeepSeq.hs index 0b87c2e..bcd5efc 100644 --- a/Control/DeepSeq.hs +++ b/Control/DeepSeq.hs @@ -424,10 +424,10 @@ instance NFData Fingerprint where ---------------------------------------------------------------------------- -- Foreign.Ptr --- |/Since: 1.4.3.0/ +-- |/Since: 1.4.2.0/ instance NFData (Ptr a) where rnf !_ = () --- |/Since: 1.4.3.0/ +-- |/Since: 1.4.2.0/ instance NFData (FunPtr a) where rnf !_ = () ---------------------------------------------------------------------------- diff --git a/changelog.md b/changelog.md index 977a4d7..a700165 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,10 @@ # Changelog for [`deepseq` package](http://hackage.haskell.org/package/deepseq) +## 1.4.2.0 *Oct 2015* + + * Added instances for `Ptr` and `FunPtr` + ([#10](https://github.com/haskell/deepseq/pull/10)) + ## 1.4.1.2 *Aug 2015* * Avoid the broken combination of GHC-7.2 with `array>=0.4` From git at git.haskell.org Wed Apr 20 13:05:08 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 13:05:08 +0000 (UTC) Subject: [commit: packages/deepseq] master: Add instance for IORef and MVar (7367507) Message-ID: <20160420130508.D015F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/deepseq On branch : master Link : http://git.haskell.org/packages/deepseq.git/commitdiff/7367507ea499a05bd8976f3bd694ac014d2b27d9 >--------------------------------------------------------------- commit 7367507ea499a05bd8976f3bd694ac014d2b27d9 Author: Eric Mertens Date: Mon Oct 12 23:33:01 2015 -0700 Add instance for IORef and MVar Advances #6 >--------------------------------------------------------------- 7367507ea499a05bd8976f3bd694ac014d2b27d9 Control/DeepSeq.hs | 15 ++++++++++++++- changelog.md | 3 +++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Control/DeepSeq.hs b/Control/DeepSeq.hs index bcd5efc..cec8207 100644 --- a/Control/DeepSeq.hs +++ b/Control/DeepSeq.hs @@ -61,7 +61,8 @@ module Control.DeepSeq ( ) where import Control.Applicative -import Control.Concurrent ( ThreadId ) +import Control.Concurrent ( ThreadId, MVar ) +import Data.IORef import Data.Int import Data.Word import Data.Ratio @@ -412,6 +413,18 @@ instance NFData TyCon where rnf tycon = rnfTyCon tycon #endif +-- | __NOTE__: Only strict in the reference and not the referenced value. +-- +-- /Since: 1.4.2.0/ +instance NFData (IORef a) where + rnf !_ = () + +-- | __NOTE__: Only strict in the reference and not the referenced value. +-- +-- /Since: 1.4.2.0/ +instance NFData (MVar a) where + rnf !_ = () + ---------------------------------------------------------------------------- -- GHC Specifics diff --git a/changelog.md b/changelog.md index a700165..794d5ee 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,9 @@ * Added instances for `Ptr` and `FunPtr` ([#10](https://github.com/haskell/deepseq/pull/10)) + * Added instance for `IORef` and `MVar` + ([#6](https://github.com/haskell/deepseq/issues/6)) + ## 1.4.1.2 *Aug 2015* * Avoid the broken combination of GHC-7.2 with `array>=0.4` From git at git.haskell.org Wed Apr 20 13:05:10 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 13:05:10 +0000 (UTC) Subject: [commit: packages/deepseq] master: Add instance for System.Exit.ExitCode (6c0bfd5) Message-ID: <20160420130510.D4A543A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/deepseq On branch : master Link : http://git.haskell.org/packages/deepseq.git/commitdiff/6c0bfd5ad979ac060f95fe9edd414889f55ddb7b >--------------------------------------------------------------- commit 6c0bfd5ad979ac060f95fe9edd414889f55ddb7b Author: Eric Mertens Date: Mon Oct 12 23:38:46 2015 -0700 Add instance for System.Exit.ExitCode Fixes #4 >--------------------------------------------------------------- 6c0bfd5ad979ac060f95fe9edd414889f55ddb7b Control/DeepSeq.hs | 9 +++++++++ changelog.md | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Control/DeepSeq.hs b/Control/DeepSeq.hs index cec8207..ff3252d 100644 --- a/Control/DeepSeq.hs +++ b/Control/DeepSeq.hs @@ -74,6 +74,7 @@ import Data.Monoid import Data.Unique ( Unique ) import Foreign.Ptr import Foreign.C.Types +import System.Exit ( ExitCode(..) ) import System.Mem.StableName ( StableName ) #if MIN_VERSION_base(4,6,0) @@ -537,6 +538,14 @@ instance NFData CFpos where rnf !_ = () instance NFData CJmpBuf where rnf !_ = () ---------------------------------------------------------------------------- +-- System.Exit + +-- |/Since: 1.4.2.0/ +instance NFData ExitCode where + rnf (ExitFailure n) = rnf n + rnf ExitSuccess = () + +---------------------------------------------------------------------------- -- Tuples instance (NFData a, NFData b) => NFData (a,b) where diff --git a/changelog.md b/changelog.md index 794d5ee..29a222d 100644 --- a/changelog.md +++ b/changelog.md @@ -5,9 +5,12 @@ * Added instances for `Ptr` and `FunPtr` ([#10](https://github.com/haskell/deepseq/pull/10)) - * Added instance for `IORef` and `MVar` + * Added instances for `IORef` and `MVar` ([#6](https://github.com/haskell/deepseq/issues/6)) + * Added instance for `ExitCode` + ([#4](https://github.com/haskell/deepseq/issues/4)) + ## 1.4.1.2 *Aug 2015* * Avoid the broken combination of GHC-7.2 with `array>=0.4` From git at git.haskell.org Wed Apr 20 13:05:12 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 13:05:12 +0000 (UTC) Subject: [commit: packages/deepseq] master: Add instance NFData (STRef s a) (33913fb) Message-ID: <20160420130512.D9F493A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/deepseq On branch : master Link : http://git.haskell.org/packages/deepseq.git/commitdiff/33913fbccd67c8edf61ce6048152858aef2e399a >--------------------------------------------------------------- commit 33913fbccd67c8edf61ce6048152858aef2e399a Author: Eric Mertens Date: Mon Oct 12 23:49:34 2015 -0700 Add instance NFData (STRef s a) Advances #10 >--------------------------------------------------------------- 33913fbccd67c8edf61ce6048152858aef2e399a Control/DeepSeq.hs | 7 +++++++ changelog.md | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Control/DeepSeq.hs b/Control/DeepSeq.hs index ff3252d..d6481d6 100644 --- a/Control/DeepSeq.hs +++ b/Control/DeepSeq.hs @@ -63,6 +63,7 @@ module Control.DeepSeq ( import Control.Applicative import Control.Concurrent ( ThreadId, MVar ) import Data.IORef +import Data.STRef import Data.Int import Data.Word import Data.Ratio @@ -423,6 +424,12 @@ instance NFData (IORef a) where -- | __NOTE__: Only strict in the reference and not the referenced value. -- -- /Since: 1.4.2.0/ +instance NFData (STRef s a) where + rnf !_ = () + +-- | __NOTE__: Only strict in the reference and not the referenced value. +-- +-- /Since: 1.4.2.0/ instance NFData (MVar a) where rnf !_ = () diff --git a/changelog.md b/changelog.md index 29a222d..5c6abe1 100644 --- a/changelog.md +++ b/changelog.md @@ -5,7 +5,7 @@ * Added instances for `Ptr` and `FunPtr` ([#10](https://github.com/haskell/deepseq/pull/10)) - * Added instances for `IORef` and `MVar` + * Added instances for `IORef`, `STRef`, and `MVar` ([#6](https://github.com/haskell/deepseq/issues/6)) * Added instance for `ExitCode` From git at git.haskell.org Wed Apr 20 13:05:14 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 13:05:14 +0000 (UTC) Subject: [commit: packages/deepseq] master: Convert `/since: .../` to new `@since`-style annotations (0398cd7) Message-ID: <20160420130514.E1BE03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/deepseq On branch : master Link : http://git.haskell.org/packages/deepseq.git/commitdiff/0398cd7b6a530f6f2758d9eddb3431560ec21b07 >--------------------------------------------------------------- commit 0398cd7b6a530f6f2758d9eddb3431560ec21b07 Author: Herbert Valerio Riedel Date: Wed Oct 28 21:34:40 2015 +0100 Convert `/since: .../` to new `@since`-style annotations >--------------------------------------------------------------- 0398cd7b6a530f6f2758d9eddb3431560ec21b07 Control/DeepSeq.hs | 124 ++++++++++++++++++++++++++--------------------------- 1 file changed, 62 insertions(+), 62 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 0398cd7b6a530f6f2758d9eddb3431560ec21b07 From git at git.haskell.org Wed Apr 20 13:05:16 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 13:05:16 +0000 (UTC) Subject: [commit: packages/deepseq] master: Relax upper bound on `base` to allow GHC8/`base-4.9` (36bfcd2) Message-ID: <20160420130516.E7DD03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/deepseq On branch : master Link : http://git.haskell.org/packages/deepseq.git/commitdiff/36bfcd2a6236f2e019de76c256b05ee670492373 >--------------------------------------------------------------- commit 36bfcd2a6236f2e019de76c256b05ee670492373 Author: Herbert Valerio Riedel Date: Wed Oct 28 21:35:19 2015 +0100 Relax upper bound on `base` to allow GHC8/`base-4.9` >--------------------------------------------------------------- 36bfcd2a6236f2e019de76c256b05ee670492373 deepseq.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deepseq.cabal b/deepseq.cabal index 724801b..0be26e7 100644 --- a/deepseq.cabal +++ b/deepseq.cabal @@ -51,7 +51,7 @@ library if impl(ghc < 7.4) build-depends: array < 0.4 - build-depends: base >= 4.3 && < 4.9, + build-depends: base >= 4.3 && < 4.10, array >= 0.3 && < 0.6 ghc-options: -Wall From git at git.haskell.org Wed Apr 20 13:05:18 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 13:05:18 +0000 (UTC) Subject: [commit: packages/deepseq] master: Add instances for types formerly provided by `semigroups` (40d4db0) Message-ID: <20160420130518.EDF8F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/deepseq On branch : master Link : http://git.haskell.org/packages/deepseq.git/commitdiff/40d4db0a4e81a07ecd0f1bc77b8772088e75e478 >--------------------------------------------------------------- commit 40d4db0a4e81a07ecd0f1bc77b8772088e75e478 Author: Herbert Valerio Riedel Date: Sun Nov 29 09:16:14 2015 +0100 Add instances for types formerly provided by `semigroups` which have moved into `base-4.9`. Specifically these are for the (new)types: - `Data.List.NonEmpty` - `Data.Semigroup.Arg` - `Data.Semigroup.First` - `Data.Semigroup.Last` - `Data.Semigroup.Max` - `Data.Semigroup.Min` - `Data.Semigroup.Option` - `Data.Semigroup.WrappedMonoid` Fixes #11 >--------------------------------------------------------------- 40d4db0a4e81a07ecd0f1bc77b8772088e75e478 Control/DeepSeq.hs | 52 +++++++++++++++++++++++++++++++++++++++++++++++----- changelog.md | 7 ++++++- 2 files changed, 53 insertions(+), 6 deletions(-) diff --git a/Control/DeepSeq.hs b/Control/DeepSeq.hs index 22221e4..49bac36 100644 --- a/Control/DeepSeq.hs +++ b/Control/DeepSeq.hs @@ -71,7 +71,7 @@ import Data.Complex import Data.Array import Data.Fixed import Data.Version -import Data.Monoid +import Data.Monoid as Mon import Data.Unique ( Unique ) import Foreign.Ptr import Foreign.C.Types @@ -93,6 +93,11 @@ import Data.Void ( Void, absurd ) import Numeric.Natural ( Natural ) #endif +#if MIN_VERSION_base(4,9,0) +import Data.List.NonEmpty ( NonEmpty (..) ) +import Data.Semigroup as Semi +#endif + #if __GLASGOW_HASKELL__ >= 702 import GHC.Fingerprint.Type ( Fingerprint(..) ) import GHC.Generics @@ -368,12 +373,12 @@ instance NFData a => NFData (Dual a) where rnf = rnf . getDual -- |@since 1.4.0.0 -instance NFData a => NFData (First a) where - rnf = rnf . getFirst +instance NFData a => NFData (Mon.First a) where + rnf = rnf . Mon.getFirst -- |@since 1.4.0.0 -instance NFData a => NFData (Last a) where - rnf = rnf . getLast +instance NFData a => NFData (Mon.Last a) where + rnf = rnf . Mon.getLast -- |@since 1.4.0.0 instance NFData Any where rnf = rnf . getAny @@ -553,6 +558,43 @@ instance NFData ExitCode where rnf ExitSuccess = () ---------------------------------------------------------------------------- +-- instances previously provided by semigroups package + +#if MIN_VERSION_base(4,9,0) +-- |@since 1.4.2.0 +instance NFData a => NFData (NonEmpty a) where + rnf (x :| xs) = rnf x `seq` rnf xs + +-- |@since 1.4.2.0 +instance NFData a => NFData (Min a) where + rnf (Min a) = rnf a + +-- |@since 1.4.2.0 +instance NFData a => NFData (Max a) where + rnf (Max a) = rnf a + +-- |@since 1.4.2.0 +instance (NFData a, NFData b) => NFData (Arg a b) where + rnf (Arg a b) = rnf a `seq` rnf b `seq` () + +-- |@since 1.4.2.0 +instance NFData a => NFData (Semi.First a) where + rnf (Semi.First a) = rnf a + +-- |@since 1.4.2.0 +instance NFData a => NFData (Semi.Last a) where + rnf (Semi.Last a) = rnf a + +-- |@since 1.4.2.0 +instance NFData m => NFData (WrappedMonoid m) where + rnf (WrapMonoid a) = rnf a + +-- |@since 1.4.2.0 +instance NFData a => NFData (Option a) where + rnf (Option a) = rnf a +#endif + +---------------------------------------------------------------------------- -- Tuples instance (NFData a, NFData b) => NFData (a,b) where diff --git a/changelog.md b/changelog.md index 5c6abe1..464bdba 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,11 @@ # Changelog for [`deepseq` package](http://hackage.haskell.org/package/deepseq) -## 1.4.2.0 *Oct 2015* +## 1.4.2.0 *Dec 2015* + + * Added instances for types provided by `semigroups` prior to + `base-4.9` (i.e. `NonEmpty`, `Min`, `Max`, `Arg`, + `Semigroup.First`, `Semigroup.Last`, `WrappedMonoid`, and + `Option`) ([#11](https://github.com/haskell/deepseq/issues/11)) * Added instances for `Ptr` and `FunPtr` ([#10](https://github.com/haskell/deepseq/pull/10)) From git at git.haskell.org Wed Apr 20 13:05:20 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 13:05:20 +0000 (UTC) Subject: [commit: packages/deepseq] master: Bump HUnit upper bound (#12) (534e6ae) Message-ID: <20160420130520.F36963A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/deepseq On branch : master Link : http://git.haskell.org/packages/deepseq.git/commitdiff/534e6aef80ce8c6d2aed975b41d8333275be3db5 >--------------------------------------------------------------- commit 534e6aef80ce8c6d2aed975b41d8333275be3db5 Author: Moritz Kiefer Date: Sun Apr 17 11:54:53 2016 +0200 Bump HUnit upper bound (#12) >--------------------------------------------------------------- 534e6aef80ce8c6d2aed975b41d8333275be3db5 deepseq.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deepseq.cabal b/deepseq.cabal index 0be26e7..c617f5c 100644 --- a/deepseq.cabal +++ b/deepseq.cabal @@ -84,4 +84,4 @@ test-suite deepseq-generics-tests -- end of packages with inherited version constraints test-framework == 0.8.*, test-framework-hunit == 0.3.*, - HUnit == 1.2.* + HUnit >= 1.2 && < 1.4 From git at git.haskell.org Wed Apr 20 13:05:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 13:05:23 +0000 (UTC) Subject: [commit: packages/deepseq] master: Update changelog for 1.4.2.0 release (9031674) Message-ID: <20160420130523.04C3B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/deepseq On branch : master Link : http://git.haskell.org/packages/deepseq.git/commitdiff/90316747054895c85c01c654efe00ac56ce1993a >--------------------------------------------------------------- commit 90316747054895c85c01c654efe00ac56ce1993a Author: Herbert Valerio Riedel Date: Tue Apr 19 17:52:19 2016 +0200 Update changelog for 1.4.2.0 release >--------------------------------------------------------------- 90316747054895c85c01c654efe00ac56ce1993a changelog.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 464bdba..c412fe0 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,8 @@ # Changelog for [`deepseq` package](http://hackage.haskell.org/package/deepseq) -## 1.4.2.0 *Dec 2015* +## 1.4.2.0 *Apr 2016* + + * Bundled with GHC 8.0.1 * Added instances for types provided by `semigroups` prior to `base-4.9` (i.e. `NonEmpty`, `Min`, `Max`, `Arg`, @@ -16,6 +18,8 @@ * Added instance for `ExitCode` ([#4](https://github.com/haskell/deepseq/issues/4)) + * Make `NFData (Proxy a)` instance poly-kinded + ## 1.4.1.2 *Aug 2015* * Avoid the broken combination of GHC-7.2 with `array>=0.4` From git at git.haskell.org Wed Apr 20 13:05:25 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 13:05:25 +0000 (UTC) Subject: [commit: packages/deepseq] master: Add instances for SrcLoc and CallStack (9454c1b) Message-ID: <20160420130525.0A5443A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/deepseq On branch : master Link : http://git.haskell.org/packages/deepseq.git/commitdiff/9454c1b4fb0ead5904858d675c2cdafa62a3ebab >--------------------------------------------------------------- commit 9454c1b4fb0ead5904858d675c2cdafa62a3ebab Author: Herbert Valerio Riedel Date: Tue Apr 19 18:40:53 2016 +0200 Add instances for SrcLoc and CallStack >--------------------------------------------------------------- 9454c1b4fb0ead5904858d675c2cdafa62a3ebab Control/DeepSeq.hs | 39 +++++++++++++++++++++++++++++++++++++++ changelog.md | 2 ++ 2 files changed, 41 insertions(+) diff --git a/Control/DeepSeq.hs b/Control/DeepSeq.hs index 49bac36..314d0a9 100644 --- a/Control/DeepSeq.hs +++ b/Control/DeepSeq.hs @@ -98,6 +98,13 @@ import Data.List.NonEmpty ( NonEmpty (..) ) import Data.Semigroup as Semi #endif +#if MIN_VERSION_base(4,9,0) +import GHC.Stack.Types ( CallStack(..), SrcLoc(..) ) +#elif MIN_VERSION_base(4,8,1) +import GHC.Stack ( CallStack(..) ) +import GHC.SrcLoc ( SrcLoc(..) ) +#endif + #if __GLASGOW_HASKELL__ >= 702 import GHC.Fingerprint.Type ( Fingerprint(..) ) import GHC.Generics @@ -595,6 +602,38 @@ instance NFData a => NFData (Option a) where #endif ---------------------------------------------------------------------------- +-- GHC.Stack + +#if MIN_VERSION_base(4,9,0) +-- |@since 1.4.2.0 +instance NFData SrcLoc where + rnf (SrcLoc a b c d e f g) = rnf a `seq` rnf b `seq` rnf c `seq` + rnf d `seq` rnf e `seq` rnf f `seq` rnf g + +-- |@since 1.4.2.0 +instance NFData CallStack where + rnf EmptyCallStack = () + rnf (PushCallStack a b c) = rnf a `seq` rnf b `seq` rnf c + rnf (FreezeCallStack a) = rnf a + +#elif MIN_VERSION_base(4,8,1) +-- |@since 1.4.2.0 +instance NFData SrcLoc where + -- base-4.8 didn't expose the 'SrcLoc' constructor + rnf sl = rnf (srcLocPackage sl) `seq` + rnf (srcLocModule sl) `seq` + rnf (srcLocFile sl) `seq` + rnf (srcLocStartLine sl) `seq` + rnf (srcLocStartCol sl) `seq` + rnf (srcLocEndLine sl) `seq` + rnf (srcLocEndCol sl) + +-- |@since 1.4.2.0 +instance NFData CallStack where + rnf = rnf . getCallStack +#endif + +---------------------------------------------------------------------------- -- Tuples instance (NFData a, NFData b) => NFData (a,b) where diff --git a/changelog.md b/changelog.md index c412fe0..1403152 100644 --- a/changelog.md +++ b/changelog.md @@ -18,6 +18,8 @@ * Added instance for `ExitCode` ([#4](https://github.com/haskell/deepseq/issues/4)) + * Added instances for `CallStack` and `SrcLoc` + * Make `NFData (Proxy a)` instance poly-kinded ## 1.4.1.2 *Aug 2015* From git at git.haskell.org Wed Apr 20 13:05:27 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 13:05:27 +0000 (UTC) Subject: [commit: packages/deepseq] master: Update tested GHC versions (cebb784) Message-ID: <20160420130527.0F6493A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/deepseq On branch : master Link : http://git.haskell.org/packages/deepseq.git/commitdiff/cebb784a6c8e081a7bcd919f6fa9a693b07950e7 >--------------------------------------------------------------- commit cebb784a6c8e081a7bcd919f6fa9a693b07950e7 Author: Herbert Valerio Riedel Date: Tue Apr 19 19:10:20 2016 +0200 Update tested GHC versions >--------------------------------------------------------------- cebb784a6c8e081a7bcd919f6fa9a693b07950e7 .travis.yml | 15 +++++++++------ deepseq.cabal | 7 ++++++- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2a1f27c..1ff0ad3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -61,12 +61,15 @@ matrix: - env: CABALVER=1.22 GHCVER=7.10.1 compiler: ": #GHC 7.10.1" addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.1], sources: [hvr-ghc]}} - - env: CABALVER=head GHCVER=head - compiler: ": #GHC head" - addons: {apt: {packages: [cabal-install-head,ghc-head], sources: [hvr-ghc]}} - - allow_failures: - - env: CABALVER=head GHCVER=head + - env: CABALVER=1.22 GHCVER=7.10.2 + compiler: ": #GHC 7.10.2" + addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.2], sources: [hvr-ghc]}} + - env: CABALVER=1.22 GHCVER=7.10.3 + compiler: ": #GHC 7.10.3" + addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3], sources: [hvr-ghc]}} + - env: CABALVER=1.24 GHCVER=8.0.1 + compiler: ": #GHC 8.0.1" + addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.1], sources: [hvr-ghc]}} before_install: - unset CC diff --git a/deepseq.cabal b/deepseq.cabal index c617f5c..0bd8aa9 100644 --- a/deepseq.cabal +++ b/deepseq.cabal @@ -22,7 +22,12 @@ description: data types. build-type: Simple cabal-version: >=1.10 -tested-with: GHC==7.11.*, GHC==7.10.1, GHC==7.8.4, GHC==7.8.3, GHC==7.8.2, GHC==7.8.1, GHC==7.6.3, GHC==7.6.2, GHC==7.6.1, GHC==7.4.2, GHC==7.4.1, GHC==7.2.2, GHC==7.2.1, GHC==7.0.4, GHC==7.0.3, GHC==7.0.2, GHC==7.0.1 +tested-with: GHC==8.0.1, + GHC==7.10.3, GHC==7.10.2, GHC==7.10.1, + GHC==7.8.4, GHC==7.8.3, GHC==7.8.2, GHC==7.8.1, + GHC==7.6.3, GHC==7.6.2, GHC==7.6.1, + GHC==7.4.2, GHC==7.4.1, GHC==7.2.2, GHC==7.2.1, + GHC==7.0.4, GHC==7.0.3, GHC==7.0.2, GHC==7.0.1 extra-source-files: changelog.md From git at git.haskell.org Wed Apr 20 13:05:29 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 13:05:29 +0000 (UTC) Subject: [commit: packages/deepseq] master: Avoid past-tense in changelog for consistency (cb66aa8) Message-ID: <20160420130529.13A823A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/deepseq On branch : master Link : http://git.haskell.org/packages/deepseq.git/commitdiff/cb66aa890b0972375e31deaee3bc424f46beb68a >--------------------------------------------------------------- commit cb66aa890b0972375e31deaee3bc424f46beb68a Author: Herbert Valerio Riedel Date: Tue Apr 19 19:11:10 2016 +0200 Avoid past-tense in changelog for consistency >--------------------------------------------------------------- cb66aa890b0972375e31deaee3bc424f46beb68a changelog.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/changelog.md b/changelog.md index 1403152..eb53420 100644 --- a/changelog.md +++ b/changelog.md @@ -4,21 +4,21 @@ * Bundled with GHC 8.0.1 - * Added instances for types provided by `semigroups` prior to + * New instances for types provided by `semigroups` prior to `base-4.9` (i.e. `NonEmpty`, `Min`, `Max`, `Arg`, `Semigroup.First`, `Semigroup.Last`, `WrappedMonoid`, and `Option`) ([#11](https://github.com/haskell/deepseq/issues/11)) - * Added instances for `Ptr` and `FunPtr` + * New instances for `Ptr` and `FunPtr` ([#10](https://github.com/haskell/deepseq/pull/10)) - * Added instances for `IORef`, `STRef`, and `MVar` + * New instances for `IORef`, `STRef`, and `MVar` ([#6](https://github.com/haskell/deepseq/issues/6)) - * Added instance for `ExitCode` + * New instance for `ExitCode` ([#4](https://github.com/haskell/deepseq/issues/4)) - * Added instances for `CallStack` and `SrcLoc` + * New instances for `CallStack` and `SrcLoc` * Make `NFData (Proxy a)` instance poly-kinded From git at git.haskell.org Wed Apr 20 13:26:16 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 13:26:16 +0000 (UTC) Subject: [commit: ghc] master: Define NameSet.intersectFVs (871f684) Message-ID: <20160420132616.8FCDF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/871f684dbe5fd13c6019f96d72023f80e67867c5/ghc >--------------------------------------------------------------- commit 871f684dbe5fd13c6019f96d72023f80e67867c5 Author: Simon Peyton Jones Date: Wed Apr 20 12:31:01 2016 +0100 Define NameSet.intersectFVs I want it for subsequent commits >--------------------------------------------------------------- 871f684dbe5fd13c6019f96d72023f80e67867c5 compiler/basicTypes/NameSet.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compiler/basicTypes/NameSet.hs b/compiler/basicTypes/NameSet.hs index 7bca479..574c3a4 100644 --- a/compiler/basicTypes/NameSet.hs +++ b/compiler/basicTypes/NameSet.hs @@ -20,6 +20,7 @@ module NameSet ( -- ** Manipulating sets of free variables isEmptyFVs, emptyFVs, plusFVs, plusFV, mkFVs, addOneFV, unitFV, delFV, delFVs, + intersectFVs, -- * Defs and uses Defs, Uses, DefUse, DefUses, @@ -104,6 +105,7 @@ plusFVs :: [FreeVars] -> FreeVars mkFVs :: [Name] -> FreeVars delFV :: Name -> FreeVars -> FreeVars delFVs :: [Name] -> FreeVars -> FreeVars +intersectFVs :: FreeVars -> FreeVars -> FreeVars isEmptyFVs :: NameSet -> Bool isEmptyFVs = isEmptyNameSet @@ -115,6 +117,7 @@ addOneFV = extendNameSet unitFV = unitNameSet delFV n s = delFromNameSet s n delFVs ns s = delListFromNameSet s ns +intersectFVs = intersectNameSet {- ************************************************************************ From git at git.haskell.org Wed Apr 20 13:26:19 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 13:26:19 +0000 (UTC) Subject: [commit: ghc] master: Tighten up imports, white space (7319b80) Message-ID: <20160420132619.3B88B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7319b80a2cdffdfac8586946d0c7b0fdc8d77dae/ghc >--------------------------------------------------------------- commit 7319b80a2cdffdfac8586946d0c7b0fdc8d77dae Author: Simon Peyton Jones Date: Wed Apr 20 12:39:19 2016 +0100 Tighten up imports, white space >--------------------------------------------------------------- 7319b80a2cdffdfac8586946d0c7b0fdc8d77dae compiler/typecheck/TcPatSyn.hs | 3 ++- compiler/typecheck/TcType.hs | 3 ++- compiler/typecheck/TcTypeable.hs | 8 +++++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/compiler/typecheck/TcPatSyn.hs b/compiler/typecheck/TcPatSyn.hs index 0983be5..839cce4 100644 --- a/compiler/typecheck/TcPatSyn.hs +++ b/compiler/typecheck/TcPatSyn.hs @@ -15,6 +15,8 @@ import HsSyn import TcPat import TcHsType( tcImplicitTKBndrs, tcExplicitTKBndrs , tcHsContext, tcHsLiftedType, tcHsOpenType, kindGeneralize ) +import Type( binderVar, mkNamedBinders, binderVisibility + , tidyTyCoVarBndrs, tidyTypes, tidyType ) import TcRnMonad import TcEnv import TcMType @@ -36,7 +38,6 @@ import BasicTypes import TcSimplify import TcUnify import TcType -import Type import TcEvidence import BuildTyCl import VarSet diff --git a/compiler/typecheck/TcType.hs b/compiler/typecheck/TcType.hs index d30833a..b251f29 100644 --- a/compiler/typecheck/TcType.hs +++ b/compiler/typecheck/TcType.hs @@ -209,7 +209,8 @@ import Name -- hiding (varName) import NameSet import VarEnv import PrelNames -import TysWiredIn +import TysWiredIn( coercibleClass, unitTyCon, unitTyConKey + , listTyCon, constraintKind ) import BasicTypes import Util import Bag diff --git a/compiler/typecheck/TcTypeable.hs b/compiler/typecheck/TcTypeable.hs index 3b380f7..04d07d1 100644 --- a/compiler/typecheck/TcTypeable.hs +++ b/compiler/typecheck/TcTypeable.hs @@ -103,9 +103,11 @@ mkTypeableBinds ; tcg_env <- setGblEnv tcg_env mkPrimTypeableBinds -- Then we produce bindings for the user-defined types in this module. ; setGblEnv tcg_env $ - let tycons = filter needs_typeable_binds (tcg_tcs tcg_env) - in mkTypeableTyConBinds tycons - } + + do { let tycons = filter needs_typeable_binds (tcg_tcs tcg_env) + ; traceTc "mkTypeableBinds" (ppr tycons) + ; mkTypeableTyConBinds tycons + } } where needs_typeable_binds tc = (not (isFamInstTyCon tc) && isAlgTyCon tc) From git at git.haskell.org Wed Apr 20 13:26:22 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 13:26:22 +0000 (UTC) Subject: [commit: ghc] master: Reduce use of instances in hs-boot files (81aa3d1) Message-ID: <20160420132622.01E833A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/81aa3d1cd0703b4437eb09d761b0a868c72ddc0e/ghc >--------------------------------------------------------------- commit 81aa3d1cd0703b4437eb09d761b0a868c72ddc0e Author: Simon Peyton Jones Date: Wed Apr 20 12:26:03 2016 +0100 Reduce use of instances in hs-boot files Several things here * GHC no longer allows user-written Typeable instances, so remove them from hs-boot files. * Generally, reduce the use of instances in hs-boot files. They are hard to track. Mainly this involves using pprType, pprKind etc instead of just ppr. There were a lot of instances in hs-boot files that weren't needed at all. * Take TyThing out of Eq; it was used in exactly one place (in InteractiveEval), and equality is too big a hammer for that. >--------------------------------------------------------------- 81aa3d1cd0703b4437eb09d761b0a868c72ddc0e compiler/basicTypes/ConLike.hs | 7 ++++--- compiler/basicTypes/ConLike.hs-boot | 12 ++---------- compiler/basicTypes/IdInfo.hs | 2 +- compiler/basicTypes/PatSyn.hs | 5 +++-- compiler/basicTypes/PatSyn.hs-boot | 17 +---------------- compiler/basicTypes/Var.hs | 6 +++--- compiler/hsSyn/HsExpr.hs-boot | 6 ------ compiler/hsSyn/HsPat.hs-boot | 2 -- compiler/main/InteractiveEval.hs | 6 ++++-- compiler/types/Class.hs | 4 ++-- compiler/types/CoAxiom.hs | 7 ++++--- compiler/types/TyCoRep.hs | 5 ++--- compiler/types/TyCoRep.hs-boot | 11 +++++++---- compiler/types/TyCon.hs | 6 +++--- 14 files changed, 36 insertions(+), 60 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 81aa3d1cd0703b4437eb09d761b0a868c72ddc0e From git at git.haskell.org Wed Apr 20 13:26:25 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 13:26:25 +0000 (UTC) Subject: [commit: ghc] master: SCC analysis for instances as well as types/classes (353d8ae) Message-ID: <20160420132625.642733A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/353d8ae6fafe117a1cac4adf6f029a5baccc2780/ghc >--------------------------------------------------------------- commit 353d8ae6fafe117a1cac4adf6f029a5baccc2780 Author: Simon Peyton Jones Date: Wed Apr 20 12:56:40 2016 +0100 SCC analysis for instances as well as types/classes This big patch is in pursuit of Trac #11348. It is largely the work of Alex Veith (thank you!), with some follow-up simplification and refactoring from Simon PJ. The main payload is described in RnSource Note [Dependency analysis of type, class, and instance decls] which is pretty detailed. * There is a new data type HsDecls.TyClGroup, for a strongly connected component of type/class/instance/role decls. The hs_instds field of HsGroup disappears, in consequence This forces some knock-on changes, including a minor haddock submodule update Smaller, weakly-related things * I found that both the renamer and typechecker were building an identical env for RoleAnnots, so I put common code for RoleAnnotEnv in RnEnv. * I found that tcInstDecls1 had very clumsy error handling, so I put it together into TcInstDcls.doClsInstErrorChecks >--------------------------------------------------------------- 353d8ae6fafe117a1cac4adf6f029a5baccc2780 compiler/deSugar/DsMeta.hs | 6 +- compiler/hsSyn/HsDecls.hs | 302 ++++++----- compiler/hsSyn/HsUtils.hs | 21 +- compiler/parser/RdrHsSyn.hs | 2 +- compiler/rename/RnEnv.hs | 33 ++ compiler/rename/RnNames.hs | 9 +- compiler/rename/RnSource.hs | 592 ++++++++++++++------- compiler/typecheck/TcDeriv.hs | 7 +- compiler/typecheck/TcInstDcls.hs | 171 +++--- compiler/typecheck/TcInstDcls.hs-boot | 16 + compiler/typecheck/TcRnDriver.hs | 52 +- compiler/typecheck/TcTyClsDecls.hs | 158 ++++-- compiler/typecheck/TcTyDecls.hs | 37 +- testsuite/tests/deriving/should_fail/T9687.stderr | 6 +- testsuite/tests/driver/sigof02/Map.hsig | 1 - testsuite/tests/ghci/scripts/T4175.stdout | 2 +- .../tests/indexed-types/should_fail/T8550.stderr | 21 +- testsuite/tests/polykinds/T8132.stderr | 5 +- .../tests/rename/should_compile/T4003A.hs-boot | 1 - testsuite/tests/roles/should_compile/T8958.stderr | 2 +- testsuite/tests/th/T1835.stdout | 6 +- testsuite/tests/typecheck/should_compile/T11348.hs | 18 + testsuite/tests/typecheck/should_compile/all.T | 1 + .../tests/typecheck/should_fail/T6018fail.stderr | 6 +- .../tests/typecheck/should_fail/tcfail211.stderr | 16 +- utils/ghctags/Main.hs | 3 +- utils/haddock | 2 +- 27 files changed, 914 insertions(+), 582 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 353d8ae6fafe117a1cac4adf6f029a5baccc2780 From git at git.haskell.org Wed Apr 20 14:59:35 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 14:59:35 +0000 (UTC) Subject: [commit: ghc] master: Fix two buglets in 17eb241 noticed by Richard (61191de) Message-ID: <20160420145935.2E1933A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/61191deee82d315a9279f11615e379d7c231dc51/ghc >--------------------------------------------------------------- commit 61191deee82d315a9279f11615e379d7c231dc51 Author: Simon Peyton Jones Date: Wed Apr 20 15:56:44 2016 +0100 Fix two buglets in 17eb241 noticed by Richard These are corner cases in 17eb241 Refactor computing dependent type vars and I couldn't even come up with a test case * In TcSimplify.simplifyInfer, in the promotion step, be sure to promote kind variables as well as type variables. * In TcType.spiltDepVarsOfTypes, the CoercionTy case, be sure to get the free coercion variables too. >--------------------------------------------------------------- 61191deee82d315a9279f11615e379d7c231dc51 compiler/typecheck/TcSimplify.hs | 29 +++++++++++++++-------------- compiler/typecheck/TcType.hs | 7 +------ 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/compiler/typecheck/TcSimplify.hs b/compiler/typecheck/TcSimplify.hs index 16fe22e..1f7c984 100644 --- a/compiler/typecheck/TcSimplify.hs +++ b/compiler/typecheck/TcSimplify.hs @@ -594,10 +594,10 @@ simplifyInfer rhs_tclvl apply_mr sigs name_taus wanteds -- Decide what type variables and constraints to quantify ; zonked_taus <- mapM (TcM.zonkTcType . snd) name_taus - ; let zonked_tau_tkvs = splitDepVarsOfTypes zonked_taus + ; let zonked_tau_dvs = splitDepVarsOfTypes zonked_taus ; (qtvs, bound_theta) <- decideQuantification apply_mr sigs name_taus - quant_pred_candidates zonked_tau_tkvs + quant_pred_candidates zonked_tau_dvs -- Promote any type variables that are free in the inferred type -- of the function: @@ -611,24 +611,25 @@ simplifyInfer rhs_tclvl apply_mr sigs name_taus wanteds -- we don't quantify over beta (since it is fixed by envt) -- so we must promote it! The inferred type is just -- f :: beta -> beta - ; zonked_tau_tvs <- TcM.zonkTyCoVarsAndFV (dv_tvs zonked_tau_tkvs) + ; zonked_tau_tkvs <- TcM.zonkTyCoVarsAndFV $ + dv_kvs zonked_tau_dvs `unionVarSet` dv_tvs zonked_tau_dvs -- decideQuantification turned some meta tyvars into -- quantified skolems, so we have to zonk again - ; let phi_tvs = tyCoVarsOfTypes bound_theta - `unionVarSet` zonked_tau_tvs + ; let phi_tkvs = tyCoVarsOfTypes bound_theta -- Already zonked + `unionVarSet` zonked_tau_tkvs + promote_tkvs = closeOverKinds phi_tkvs `delVarSetList` qtvs - promote_tvs = closeOverKinds phi_tvs `delVarSetList` qtvs - ; MASSERT2( closeOverKinds promote_tvs `subVarSet` promote_tvs - , ppr phi_tvs $$ - ppr (closeOverKinds phi_tvs) $$ - ppr promote_tvs $$ - ppr (closeOverKinds promote_tvs) ) + ; MASSERT2( closeOverKinds promote_tkvs `subVarSet` promote_tkvs + , ppr phi_tkvs $$ + ppr (closeOverKinds phi_tkvs) $$ + ppr promote_tkvs $$ + ppr (closeOverKinds promote_tkvs) ) -- we really don't want a type to be promoted when its kind isn't! -- promoteTyVar ignores coercion variables ; outer_tclvl <- TcM.getTcLevel - ; mapM_ (promoteTyVar outer_tclvl) (varSetElems promote_tvs) + ; mapM_ (promoteTyVar outer_tclvl) (varSetElems promote_tkvs) -- Emit an implication constraint for the -- remaining constraints from the RHS @@ -654,8 +655,8 @@ simplifyInfer rhs_tclvl apply_mr sigs name_taus wanteds ; traceTc "} simplifyInfer/produced residual implication for quantification" $ vcat [ text "quant_pred_candidates =" <+> ppr quant_pred_candidates , text "zonked_taus" <+> ppr zonked_taus - , text "zonked_tau_tvs=" <+> ppr zonked_tau_tvs - , text "promote_tvs=" <+> ppr promote_tvs + , text "zonked_tau_dvs=" <+> ppr zonked_tau_dvs + , text "promote_tvs=" <+> ppr promote_tkvs , text "bound_theta =" <+> ppr bound_theta , text "qtvs =" <+> ppr qtvs , text "implic =" <+> ppr implic ] diff --git a/compiler/typecheck/TcType.hs b/compiler/typecheck/TcType.hs index b251f29..b4a02de 100644 --- a/compiler/typecheck/TcType.hs +++ b/compiler/typecheck/TcType.hs @@ -932,12 +932,7 @@ split_dep_vars = go go (LitTy {}) = mempty go (CastTy ty co) = go ty `mappend` Pair (tyCoVarsOfCo co) emptyVarSet - go (CoercionTy co) = go_co co - - go_co co = let Pair ty1 ty2 = coercionKind co in - -- co :: ty1 ~ ty2 - go ty1 `mappend` go ty2 - + go (CoercionTy co) = Pair (tyCoVarsOfCo co) emptyVarSet {- ************************************************************************ From git at git.haskell.org Wed Apr 20 14:59:37 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 14:59:37 +0000 (UTC) Subject: [commit: ghc] master: Tighten up imports on TcTyClsDecls (cdcf014) Message-ID: <20160420145937.D62273A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cdcf014d210fa2150a9a41c589c8bb41969bd8d7/ghc >--------------------------------------------------------------- commit cdcf014d210fa2150a9a41c589c8bb41969bd8d7 Author: Simon Peyton Jones Date: Wed Apr 20 16:02:10 2016 +0100 Tighten up imports on TcTyClsDecls >--------------------------------------------------------------- cdcf014d210fa2150a9a41c589c8bb41969bd8d7 compiler/typecheck/TcTyClsDecls.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/typecheck/TcTyClsDecls.hs b/compiler/typecheck/TcTyClsDecls.hs index afb7b64..6cd8bbb 100644 --- a/compiler/typecheck/TcTyClsDecls.hs +++ b/compiler/typecheck/TcTyClsDecls.hs @@ -30,14 +30,15 @@ import TcValidity import TcHsSyn import TcTyDecls import TcClassDcl -import {-# SOURCE #-} TcInstDcls +import {-# SOURCE #-} TcInstDcls( tcInstDecls1 ) import TcDeriv (DerivInfo) import TcUnify import TcHsType import TcMType import TysWiredIn ( unitTy ) import TcType -import RnEnv( RoleAnnotEnv, mkRoleAnnotEnv, lookupRoleAnnot ) +import RnEnv( RoleAnnotEnv, mkRoleAnnotEnv, lookupRoleAnnot + , lookupConstructorFields ) import FamInst import FamInstEnv import Coercion @@ -56,7 +57,6 @@ import Module import Name import NameSet import NameEnv -import RnEnv import Outputable import Maybes import Unify From git at git.haskell.org Wed Apr 20 15:52:54 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 15:52:54 +0000 (UTC) Subject: [commit: ghc] master: Kill unnecessary varSetElemsWellScoped in deriveTyData (687c778) Message-ID: <20160420155254.48A913A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/687c77808b82e8cf8c77fba2c0ed2fe003c907cf/ghc >--------------------------------------------------------------- commit 687c77808b82e8cf8c77fba2c0ed2fe003c907cf Author: Bartosz Nitka Date: Wed Apr 20 08:54:10 2016 -0700 Kill unnecessary varSetElemsWellScoped in deriveTyData varSetElemsWellScoped introduces unnecessary non-determinism and it's possible to do the same thing deterministically for the same price. Test Plan: ./validate Reviewers: austin, simonmar, bgamari, simonpj Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2124 GHC Trac Issues: #4012 >--------------------------------------------------------------- 687c77808b82e8cf8c77fba2c0ed2fe003c907cf compiler/typecheck/TcDeriv.hs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/compiler/typecheck/TcDeriv.hs b/compiler/typecheck/TcDeriv.hs index f46fc46..4f45e41 100644 --- a/compiler/typecheck/TcDeriv.hs +++ b/compiler/typecheck/TcDeriv.hs @@ -63,6 +63,7 @@ import Outputable import FastString import Bag import Pair +import FV (runFVList, unionFV, someVars) import qualified GHC.LanguageExtensions as LangExt import Control.Monad @@ -644,9 +645,11 @@ deriveTyData tvs tc tc_args deriv_pred mb_match = tcUnifyTy inst_ty_kind cls_arg_kind Just kind_subst = mb_match - all_tkvs = varSetElemsWellScoped $ - mkVarSet deriv_tvs `unionVarSet` - tyCoVarsOfTypes tc_args_to_keep + all_tkvs = toposortTyVars $ + runFVList $ unionFV + (tyCoVarsOfTypesAcc tc_args_to_keep) + (someVars deriv_tvs) + unmapped_tkvs = filter (`notElemTCvSubst` kind_subst) all_tkvs (subst, tkvs) = mapAccumL substTyVarBndr kind_subst unmapped_tkvs From git at git.haskell.org Wed Apr 20 16:33:45 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 16:33:45 +0000 (UTC) Subject: [commit: ghc] master: Build a correct substitution in dataConInstPat (62943d2) Message-ID: <20160420163345.E1A6F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/62943d2adc51c4a7a61bb1f48fd245791acfffe9/ghc >--------------------------------------------------------------- commit 62943d2adc51c4a7a61bb1f48fd245791acfffe9 Author: Bartosz Nitka Date: Wed Apr 20 09:35:47 2016 -0700 Build a correct substitution in dataConInstPat This adds the tyvars of the domain of the substitution into the in-scope set as well. What I'm not sure here is if the kinds can have any free vars that should be in the in-scope set as well. Test Plan: ./validate Reviewers: goldfire, austin, bgamari, simonpj Reviewed By: simonpj Subscribers: thomie, simonmar Differential Revision: https://phabricator.haskell.org/D2094 GHC Trac Issues: #11371 >--------------------------------------------------------------- 62943d2adc51c4a7a61bb1f48fd245791acfffe9 compiler/coreSyn/CoreUtils.hs | 6 +++--- compiler/types/Type.hs | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/compiler/coreSyn/CoreUtils.hs b/compiler/coreSyn/CoreUtils.hs index 82be8d9..887c313 100644 --- a/compiler/coreSyn/CoreUtils.hs +++ b/compiler/coreSyn/CoreUtils.hs @@ -1564,8 +1564,8 @@ dataConInstPat fss uniqs con inst_tys (zip3 ex_tvs ex_fss ex_uniqs) mk_ex_var :: TCvSubst -> (TyVar, FastString, Unique) -> (TCvSubst, TyVar) - mk_ex_var subst (tv, fs, uniq) = (Type.extendTvSubst subst tv - (mkTyVarTy new_tv) + mk_ex_var subst (tv, fs, uniq) = (Type.extendTvSubstWithClone subst tv + new_tv , new_tv) where new_tv = mkTyVar (mkSysTvName uniq fs) kind @@ -1574,7 +1574,7 @@ dataConInstPat fss uniqs con inst_tys -- Make value vars, instantiating types arg_ids = zipWith4 mk_id_var id_uniqs id_fss arg_tys arg_strs mk_id_var uniq fs ty str - = mkLocalIdOrCoVarWithInfo name (Type.substTyUnchecked full_subst ty) info + = mkLocalIdOrCoVarWithInfo name (Type.substTy full_subst ty) info where name = mkInternalName uniq (mkVarOccFS fs) noSrcSpan info | isMarkedStrict str = vanillaIdInfo `setUnfoldingInfo` evaldUnfolding diff --git a/compiler/types/Type.hs b/compiler/types/Type.hs index 9559123..93f4df2 100644 --- a/compiler/types/Type.hs +++ b/compiler/types/Type.hs @@ -158,6 +158,7 @@ module Type ( extendTCvInScope, extendTCvInScopeList, extendTCvInScopeSet, extendTCvSubst, extendCvSubst, extendTvSubst, extendTvSubstList, extendTvSubstAndInScope, + extendTvSubstWithClone, isInScope, composeTCvSubstEnv, composeTCvSubst, zipTyEnv, zipCoEnv, isEmptyTCvSubst, unionTCvSubst, From git at git.haskell.org Wed Apr 20 16:44:33 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 16:44:33 +0000 (UTC) Subject: [commit: ghc] master: Accept tcrun045 output (55b1b85) Message-ID: <20160420164433.AB0673A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/55b1b85df424747b8ef3b7301c1cdec36c4bbe62/ghc >--------------------------------------------------------------- commit 55b1b85df424747b8ef3b7301c1cdec36c4bbe62 Author: Simon Peyton Jones Date: Wed Apr 20 16:22:30 2016 +0100 Accept tcrun045 output My validate didn't catch this one; it is fallout (actually an improvement) from 353d8a SCC analysis for instances as well as types/classes >--------------------------------------------------------------- 55b1b85df424747b8ef3b7301c1cdec36c4bbe62 .../tests/typecheck/should_run/tcrun045.stderr | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/testsuite/tests/typecheck/should_run/tcrun045.stderr b/testsuite/tests/typecheck/should_run/tcrun045.stderr index c7a6616..f6b1652 100644 --- a/testsuite/tests/typecheck/should_run/tcrun045.stderr +++ b/testsuite/tests/typecheck/should_run/tcrun045.stderr @@ -1,6 +1,18 @@ -tcrun045.hs:24:1: - Illegal implicit parameter ??imp::Int? - In the context: ?imp::Int - While checking the super-classes of class ?D? - In the class declaration for ?D? +tcrun045.hs:11:10: error: + ? Illegal implicit parameter ??imp::Int? + ? In the context: ?imp::Int + While checking an instance declaration + In the instance declaration for ?C Int? + +tcrun045.hs:24:1: error: + ? Illegal implicit parameter ??imp::Int? + ? In the context: ?imp::Int + While checking the super-classes of class ?D? + In the class declaration for ?D? + +tcrun045.hs:27:10: error: + ? Illegal implicit parameter ??imp::Int? + ? In the context: ?imp::Int + While checking an instance declaration + In the instance declaration for ?D Int? From git at git.haskell.org Wed Apr 20 21:34:55 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 21:34:55 +0000 (UTC) Subject: [commit: ghc] master: Rename FV related functions (2e33320) Message-ID: <20160420213455.E92A23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2e33320a24e5a7b837b4c217f95ca428cd6e5482/ghc >--------------------------------------------------------------- commit 2e33320a24e5a7b837b4c217f95ca428cd6e5482 Author: Bartosz Nitka Date: Wed Apr 20 09:51:05 2016 -0700 Rename FV related functions This is from Simon's suggestion: * `tyCoVarsOfTypesAcc` is a terrible name for a function with a perfectly decent type `[Type] -> FV`. Maybe `tyCoFVsOfTypes`? Similarly others * `runFVList` is also terrible, but also has a decent type. Maybe just `fvVarList` (and `fvVarSet` for `runFVSet`). * `someVars` could be `mkFVs :: [Var] -> FV`. >--------------------------------------------------------------- 2e33320a24e5a7b837b4c217f95ca428cd6e5482 compiler/coreSyn/CoreFVs.hs | 150 ++++++++++++++++++++-------------------- compiler/coreSyn/CoreSubst.hs | 2 +- compiler/simplCore/SetLevels.hs | 4 +- compiler/typecheck/TcDeriv.hs | 10 +-- compiler/typecheck/TcRnTypes.hs | 32 +++++---- compiler/typecheck/TcType.hs | 10 +-- compiler/types/Coercion.hs | 2 +- compiler/types/TyCoRep.hs | 132 +++++++++++++++++------------------ compiler/types/Type.hs | 2 +- compiler/utils/FV.hs | 69 +++++++++--------- 10 files changed, 208 insertions(+), 205 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 2e33320a24e5a7b837b4c217f95ca428cd6e5482 From git at git.haskell.org Wed Apr 20 22:29:29 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 20 Apr 2016 22:29:29 +0000 (UTC) Subject: [commit: ghc] master: Point to note about FV eta-expansion performance (98a14ff) Message-ID: <20160420222929.D63CF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/98a14ff0560d90eae74f42c33ee0811a15fca50f/ghc >--------------------------------------------------------------- commit 98a14ff0560d90eae74f42c33ee0811a15fca50f Author: Bartosz Nitka Date: Wed Apr 20 15:31:14 2016 -0700 Point to note about FV eta-expansion performance >--------------------------------------------------------------- 98a14ff0560d90eae74f42c33ee0811a15fca50f compiler/types/TyCoRep.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/types/TyCoRep.hs b/compiler/types/TyCoRep.hs index 3eb431d..e1f8534 100644 --- a/compiler/types/TyCoRep.hs +++ b/compiler/types/TyCoRep.hs @@ -1370,6 +1370,7 @@ tyCoVarsOfTypeList ty = fvVarList $ tyCoFVsOfType ty -- See Note [FV naming conventions] in FV. -- -- Eta-expanded because that makes it run faster (apparently) +-- See Note [FV eta expansion] in FV for explanation. tyCoFVsOfType :: Type -> FV -- See Note [Free variables of types] tyCoFVsOfType (TyVarTy v) a b c = (unitFV v `unionFV` tyCoFVsOfType (tyVarKind v)) a b c From git at git.haskell.org Thu Apr 21 10:48:35 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 21 Apr 2016 10:48:35 +0000 (UTC) Subject: [commit: ghc] master: Remove mysterious varSetElemsWellScoped in tidyFreeTyCoVars (7c6585a) Message-ID: <20160421104835.042BD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7c6585af9e9c83f2d87cb9728d9b8cb456e3d543/ghc >--------------------------------------------------------------- commit 7c6585af9e9c83f2d87cb9728d9b8cb456e3d543 Author: Bartosz Nitka Date: Thu Apr 21 03:49:30 2016 -0700 Remove mysterious varSetElemsWellScoped in tidyFreeTyCoVars Richard isn't sure why it's there and removing it didn't change anything. >--------------------------------------------------------------- 7c6585af9e9c83f2d87cb9728d9b8cb456e3d543 compiler/types/TyCoRep.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/types/TyCoRep.hs b/compiler/types/TyCoRep.hs index e1f8534..194df7d 100644 --- a/compiler/types/TyCoRep.hs +++ b/compiler/types/TyCoRep.hs @@ -128,7 +128,7 @@ import {-# SOURCE #-} DataCon( dataConTyCon, dataConFullSig , dataConUnivTyBinders, dataConExTyBinders , DataCon, filterEqSpec ) import {-# SOURCE #-} Type( isPredTy, isCoercionTy, mkAppTy - , tyCoVarsOfTypesWellScoped, varSetElemsWellScoped + , tyCoVarsOfTypesWellScoped , partitionInvisibles, coreView, typeKind , eqType ) -- Transitively pulls in a LOT of stuff, better to break the loop @@ -3150,7 +3150,7 @@ tidyFreeTyCoVars :: TidyEnv -> TyCoVarSet -> TidyEnv -- ^ Add the free 'TyVar's to the env in tidy form, -- so that we can tidy the type they are free in tidyFreeTyCoVars (full_occ_env, var_env) tyvars - = fst (tidyOpenTyCoVars (full_occ_env, var_env) (varSetElemsWellScoped tyvars)) + = fst (tidyOpenTyCoVars (full_occ_env, var_env) (varSetElems tyvars)) --------------- tidyOpenTyCoVars :: TidyEnv -> [TyCoVar] -> (TidyEnv, [TyCoVar]) From git at git.haskell.org Thu Apr 21 15:05:42 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 21 Apr 2016 15:05:42 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Bump max bytes used of T4029 (8c33cd4) Message-ID: <20160421150542.C75D83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8c33cd4fde89a367e427116b7c5dda019b5bf813/ghc >--------------------------------------------------------------- commit 8c33cd4fde89a367e427116b7c5dda019b5bf813 Author: Ben Gamari Date: Thu Apr 21 17:07:20 2016 +0200 testsuite: Bump max bytes used of T4029 >--------------------------------------------------------------- 8c33cd4fde89a367e427116b7c5dda019b5bf813 testsuite/tests/perf/space_leaks/all.T | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/perf/space_leaks/all.T b/testsuite/tests/perf/space_leaks/all.T index 0beb55a..4904289 100644 --- a/testsuite/tests/perf/space_leaks/all.T +++ b/testsuite/tests/perf/space_leaks/all.T @@ -60,8 +60,9 @@ test('T4029', [(wordsize(64), 66, 10)]), # 2016-02-26: 66 (amd64/Linux) INITIAL stats_num_field('max_bytes_used', - [(wordsize(64), 24071720, 5)]) + [(wordsize(64), 25542832, 5)]) # 2016-02-26: 24071720 (amd64/Linux) INITIAL + # 2016-04-21: 25542832 (amd64/Linux) ], ghci_script, ['T4029.script']) From git at git.haskell.org Thu Apr 21 15:22:20 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 21 Apr 2016 15:22:20 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Bump Cabal submodule (4b43a96) Message-ID: <20160421152220.57FB63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/4b43a962e1d11c7758d990bf6ed9affe2ab38ba4/ghc >--------------------------------------------------------------- commit 4b43a962e1d11c7758d990bf6ed9affe2ab38ba4 Author: Ben Gamari Date: Wed Apr 20 23:06:19 2016 +0200 Bump Cabal submodule >--------------------------------------------------------------- 4b43a962e1d11c7758d990bf6ed9affe2ab38ba4 libraries/Cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/Cabal b/libraries/Cabal index cb855f3..f99f91e 160000 --- a/libraries/Cabal +++ b/libraries/Cabal @@ -1 +1 @@ -Subproject commit cb855f34676ccdc2b0967a60ffe90b60ffeb1816 +Subproject commit f99f91eb570c11ea36e64bc451054bf7a3116a79 From git at git.haskell.org Thu Apr 21 15:22:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 21 Apr 2016 15:22:23 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Move DFunUnfolding generation to TcInstDcls (5f29b77) Message-ID: <20160421152223.9894D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/5f29b77af4c96e0e7002fa8ad6a4446960ea6592/ghc >--------------------------------------------------------------- commit 5f29b77af4c96e0e7002fa8ad6a4446960ea6592 Author: Simon Peyton Jones Date: Wed Mar 23 15:37:50 2016 +0000 Move DFunUnfolding generation to TcInstDcls The desugarer had a fragile case to generate the Unfolding for a DFun. This patch moves the unfolding generation to TcInstDcls, where all the pieces are to hand. Fixes Trac #11742 (cherry picked from commit db9e4eb4e3fe916df7a69da1b211083ad6068aff) >--------------------------------------------------------------- 5f29b77af4c96e0e7002fa8ad6a4446960ea6592 compiler/deSugar/DsBinds.hs | 21 ----------- compiler/typecheck/TcInstDcls.hs | 42 +++++++++++++++++----- testsuite/tests/roles/should_compile/T8958.stderr | 13 ++++--- testsuite/tests/simplCore/should_compile/T11742.hs | 8 +++++ testsuite/tests/simplCore/should_compile/all.T | 1 + 5 files changed, 52 insertions(+), 33 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 5f29b77af4c96e0e7002fa8ad6a4446960ea6592 From git at git.haskell.org Thu Apr 21 15:22:26 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 21 Apr 2016 15:22:26 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Revert "rts/posix/Itimer.c: Handle EINTR when reading timerfd" (aabd44c) Message-ID: <20160421152226.4892A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/aabd44cbd59dc3018890b3174ac8c181bbc4d19f/ghc >--------------------------------------------------------------- commit aabd44cbd59dc3018890b3174ac8c181bbc4d19f Author: Ben Gamari Date: Thu Apr 21 13:30:41 2016 +0200 Revert "rts/posix/Itimer.c: Handle EINTR when reading timerfd" This reverts commit 37936e2b23e58b8a855b7ece5a375b930d1a29bc. >--------------------------------------------------------------- aabd44cbd59dc3018890b3174ac8c181bbc4d19f rts/posix/Itimer.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/rts/posix/Itimer.c b/rts/posix/Itimer.c index 8915446..b833295 100644 --- a/rts/posix/Itimer.c +++ b/rts/posix/Itimer.c @@ -202,15 +202,10 @@ static void *itimer_thread_func(void *_handle_tick) while (1) { if (USE_TIMERFD_FOR_ITIMER) { - if (read(timerfd, &nticks, sizeof(nticks)) != sizeof(nticks)) { - if (errno != EINTR) { - sysErrorBelch("Itimer: read(timerfd) failed"); - } - } + if (read(timerfd, &nticks, sizeof(nticks)) != sizeof(nticks)) + sysErrorBelch("Itimer: read(timer_fd) failed"); } else { - if (usleep(TimeToUS(itimer_interval)) != 0 && errno != EINTR) { - sysErrorBelch("usleep(TimeToUS(itimer_interval) failed"); - } + usleep(TimeToUS(itimer_interval)); } switch (itimer_state) { case RUNNING: @@ -227,7 +222,7 @@ static void *itimer_thread_func(void *_handle_tick) return NULL; } } - return NULL; // Never reached. + return NULL; } #endif From git at git.haskell.org Thu Apr 21 15:22:29 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 21 Apr 2016 15:22:29 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Revert "rtx/posix/Itimer.c: Handle return value of `read`" (eed126e) Message-ID: <20160421152229.2B43B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/eed126e17865fd2564f66800c1c19b651535bb24/ghc >--------------------------------------------------------------- commit eed126e17865fd2564f66800c1c19b651535bb24 Author: Ben Gamari Date: Thu Apr 21 13:30:43 2016 +0200 Revert "rtx/posix/Itimer.c: Handle return value of `read`" This reverts commit fd3e581b7c9142247601774afc98e49f63b8af45. >--------------------------------------------------------------- eed126e17865fd2564f66800c1c19b651535bb24 rts/posix/Itimer.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rts/posix/Itimer.c b/rts/posix/Itimer.c index b833295..f6c00a6 100644 --- a/rts/posix/Itimer.c +++ b/rts/posix/Itimer.c @@ -202,8 +202,7 @@ static void *itimer_thread_func(void *_handle_tick) while (1) { if (USE_TIMERFD_FOR_ITIMER) { - if (read(timerfd, &nticks, sizeof(nticks)) != sizeof(nticks)) - sysErrorBelch("Itimer: read(timer_fd) failed"); + read(timerfd, &nticks, sizeof(nticks)); } else { usleep(TimeToUS(itimer_interval)); } From git at git.haskell.org Thu Apr 21 15:22:31 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 21 Apr 2016 15:22:31 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Revert "rts/timer: use timerfd_* on Linux instead of alarm signals" (dcece19) Message-ID: <20160421152231.D31C93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/dcece1930d80f94e8fb3e56962c1d13055b30bd9/ghc >--------------------------------------------------------------- commit dcece1930d80f94e8fb3e56962c1d13055b30bd9 Author: Ben Gamari Date: Thu Apr 21 13:30:45 2016 +0200 Revert "rts/timer: use timerfd_* on Linux instead of alarm signals" This reverts commit bbdc52f3a6e6a28e209fb8f65699121d4ef3a4e3. >--------------------------------------------------------------- dcece1930d80f94e8fb3e56962c1d13055b30bd9 configure.ac | 2 +- rts/posix/Itimer.c | 91 +++++++----------------------------------------------- 2 files changed, 12 insertions(+), 81 deletions(-) diff --git a/configure.ac b/configure.ac index f7c2f33..271c216 100644 --- a/configure.ac +++ b/configure.ac @@ -776,7 +776,7 @@ dnl off_t, because it will affect the result of that test. AC_SYS_LARGEFILE dnl ** check for specific header (.h) files that we are interested in -AC_CHECK_HEADERS([ctype.h dirent.h dlfcn.h errno.h fcntl.h grp.h limits.h locale.h nlist.h pthread.h pwd.h signal.h sys/param.h sys/mman.h sys/resource.h sys/select.h sys/time.h sys/timeb.h sys/timerfd.h sys/timers.h sys/times.h sys/utsname.h sys/wait.h termios.h time.h utime.h windows.h winsock.h sched.h]) +AC_CHECK_HEADERS([ctype.h dirent.h dlfcn.h errno.h fcntl.h grp.h limits.h locale.h nlist.h pthread.h pwd.h signal.h sys/param.h sys/mman.h sys/resource.h sys/select.h sys/time.h sys/timeb.h sys/timers.h sys/times.h sys/utsname.h sys/wait.h termios.h time.h utime.h windows.h winsock.h sched.h]) dnl sys/cpuset.h needs sys/param.h to be included first on FreeBSD 9.1; #7708 AC_CHECK_HEADERS([sys/cpuset.h], [], [], diff --git a/rts/posix/Itimer.c b/rts/posix/Itimer.c index f6c00a6..57c7741 100644 --- a/rts/posix/Itimer.c +++ b/rts/posix/Itimer.c @@ -53,31 +53,6 @@ #define USE_PTHREAD_FOR_ITIMER #endif -/* - * On Linux in the threaded RTS we can use timerfd_* (introduced in Linux - * 2.6.25) and a thread instead of alarm signals. It avoids the risk of - * interrupting syscalls (see #10840) and the risk of being accidentally - * modified in user code using signals. - */ -#if defined(linux_HOST_OS) && defined(THREADED_RTS) && HAVE_SYS_TIMERFD_H -#include -#include -#define USE_PTHREAD_FOR_ITIMER -#define USE_TIMERFD_FOR_ITIMER 1 -#undef USE_TIMER_CREATE -#else -#define USE_TIMERFD_FOR_ITIMER 0 -#endif - -/* - * TFD_CLOEXEC has been added in Linux 2.6.26. - * If it is not available, we use fcntl(F_SETFD). - */ -#ifndef TFD_CLOEXEC -#define TFD_CLOEXEC 0 -#endif - - #if defined(USE_PTHREAD_FOR_ITIMER) #include #include @@ -175,50 +150,15 @@ static void install_vtalrm_handler(TickProc handle_tick) #endif #if defined(USE_PTHREAD_FOR_ITIMER) -enum ItimerState {STOPPED, RUNNING, STOPPING, EXITED}; -static volatile enum ItimerState itimer_state = STOPPED; +static volatile int itimer_enabled; static void *itimer_thread_func(void *_handle_tick) { TickProc handle_tick = _handle_tick; - uint64_t nticks; - int timerfd = -1; - -#if USE_TIMERFD_FOR_ITIMER - struct itimerspec it; - it.it_value.tv_sec = TimeToSeconds(itimer_interval); - it.it_value.tv_nsec = TimeToNS(itimer_interval) % 1000000000; - it.it_interval = it.it_value; - - timerfd = timerfd_create(CLOCK_MONOTONIC,TFD_CLOEXEC); - if (timerfd == -1) { - sysErrorBelch("timerfd_create"); - stg_exit(EXIT_FAILURE); - } - if (!TFD_CLOEXEC) { - fcntl(timerfd, F_SETFD, FD_CLOEXEC); - } - timerfd_settime(timerfd,0,&it,NULL); -#endif - while (1) { - if (USE_TIMERFD_FOR_ITIMER) { - read(timerfd, &nticks, sizeof(nticks)); - } else { - usleep(TimeToUS(itimer_interval)); - } - switch (itimer_state) { - case RUNNING: - handle_tick(0); - break; - case STOPPED: - break; - case STOPPING: - itimer_state = STOPPED; - break; - case EXITED: - if (USE_TIMERFD_FOR_ITIMER) - close(timerfd); - return NULL; + usleep(TimeToUS(itimer_interval)); + switch (itimer_enabled) { + case 1: handle_tick(0); break; + case 2: itimer_enabled = 0; } } return NULL; @@ -232,13 +172,7 @@ initTicker (Time interval, TickProc handle_tick) #if defined(USE_PTHREAD_FOR_ITIMER) pthread_t tid; - int r = pthread_create(&tid, NULL, itimer_thread_func, (void*)handle_tick); - if (!r) { - pthread_detach(tid); -#if HAVE_PTHREAD_SETNAME_NP - pthread_setname_np(tid, "ghc_ticker"); -#endif - } + pthread_create(&tid, NULL, itimer_thread_func, (void*)handle_tick); #elif defined(USE_TIMER_CREATE) { struct sigevent ev; @@ -264,7 +198,7 @@ void startTicker(void) { #if defined(USE_PTHREAD_FOR_ITIMER) - itimer_state = RUNNING; + itimer_enabled = 1; #elif defined(USE_TIMER_CREATE) { struct itimerspec it; @@ -298,11 +232,10 @@ void stopTicker(void) { #if defined(USE_PTHREAD_FOR_ITIMER) - if (itimer_state == RUNNING) { - itimer_state = STOPPING; + if (itimer_enabled == 1) { + itimer_enabled = 2; /* Wait for the thread to confirm it won't generate another tick. */ - write_barrier(); - while (itimer_state != STOPPED) + while (itimer_enabled != 0) sched_yield(); } #elif defined(USE_TIMER_CREATE) @@ -333,9 +266,7 @@ stopTicker(void) void exitTicker (rtsBool wait STG_UNUSED) { -#if defined(USE_PTHREAD_FOR_ITIMER) - itimer_state = EXITED; -#elif defined(USE_TIMER_CREATE) +#if defined(USE_TIMER_CREATE) // Before deleting the timer set the signal to ignore to avoid the // possibility of the signal being delivered after the timer is deleted. signal(ITIMER_SIGNAL, SIG_IGN); From git at git.haskell.org Fri Apr 22 10:29:53 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 22 Apr 2016 10:29:53 +0000 (UTC) Subject: [commit: ghc] master: Improve the behaviour of warnIf (f02af79) Message-ID: <20160422102953.7C76A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f02af79e71f0383cf16b9d7c89691578ab77fa1c/ghc >--------------------------------------------------------------- commit f02af79e71f0383cf16b9d7c89691578ab77fa1c Author: Simon Peyton Jones Date: Thu Apr 21 12:58:52 2016 +0100 Improve the behaviour of warnIf Now that warnIf takes a "reason", we can test the reason in warnIf rather than in the caller. Less code, and less risk of getting the test and the reason out of sync. >--------------------------------------------------------------- f02af79e71f0383cf16b9d7c89691578ab77fa1c compiler/rename/RnNames.hs | 17 +++++++---------- compiler/typecheck/Inst.hs | 5 ++--- compiler/typecheck/TcRnMonad.hs | 15 ++++++++++----- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/compiler/rename/RnNames.hs b/compiler/rename/RnNames.hs index 24e6bca..e3bdaab 100644 --- a/compiler/rename/RnNames.hs +++ b/compiler/rename/RnNames.hs @@ -1272,14 +1272,12 @@ exports_from_avail (Just (L _ rdr_items)) rdr_env imports this_mod | let earlier_mods = [ mod | (L _ (IEModuleContents (L _ mod))) <- ie_names ] , mod `elem` earlier_mods -- Duplicate export of M - = do { warn_dup_exports <- woptM Opt_WarnDuplicateExports ; - warnIf (Reason Opt_WarnDuplicateExports) warn_dup_exports + = do { warnIf (Reason Opt_WarnDuplicateExports) True (dupModuleExport mod) ; return acc } | otherwise - = do { warnDodgyExports <- woptM Opt_WarnDodgyExports - ; let { exportValid = (mod `elem` imported_modules) + = do { let { exportValid = (mod `elem` imported_modules) || (moduleName this_mod == mod) ; gre_prs = pickGREsModExp mod (globalRdrEnvElts rdr_env) ; new_exports = map (availFromGRE . fst) gre_prs @@ -1289,7 +1287,7 @@ exports_from_avail (Just (L _ rdr_items)) rdr_env imports this_mod ; checkErr exportValid (moduleNotImported mod) ; warnIf (Reason Opt_WarnDodgyExports) - (warnDodgyExports && exportValid && null gre_prs) + (exportValid && null gre_prs) (nullModuleExport mod) ; traceRn (text "efa" <+> (ppr mod $$ ppr all_gres)) @@ -1429,11 +1427,10 @@ check_occs ie occs names -- 'names' are the entities specifed by 'ie' | name == name' -- Duplicate export -- But we don't want to warn if the same thing is exported -- by two different module exports. See ticket #4478. - -> do unless (dupExport_ok name ie ie') $ do - warn_dup_exports <- woptM Opt_WarnDuplicateExports - warnIf (Reason Opt_WarnDuplicateExports) warn_dup_exports - (dupExportWarn name_occ ie ie') - return occs + -> do { warnIf (Reason Opt_WarnDuplicateExports) + (not (dupExport_ok name ie ie')) + (dupExportWarn name_occ ie ie') + ; return occs } | otherwise -- Same occ name but different names: an error -> do { global_env <- getGlobalRdrEnv ; diff --git a/compiler/typecheck/Inst.hs b/compiler/typecheck/Inst.hs index 49f57a5..25aa3cc 100644 --- a/compiler/typecheck/Inst.hs +++ b/compiler/typecheck/Inst.hs @@ -640,10 +640,9 @@ newClsInst overlap_mode dfun_name tvs theta clas tys -- but it'll do fine ; oflag <- getOverlapFlag overlap_mode ; let inst = mkLocalInstance dfun oflag tvs' clas tys' - ; dflags <- getDynFlags ; warnIf (Reason Opt_WarnOrphans) - (isOrphan (is_orphan inst) && wopt Opt_WarnOrphans dflags) - (instOrphWarn inst) + (isOrphan (is_orphan inst)) + (instOrphWarn inst) ; return inst } instOrphWarn :: ClsInst -> SDoc diff --git a/compiler/typecheck/TcRnMonad.hs b/compiler/typecheck/TcRnMonad.hs index 5a6ff43..91a6a57 100644 --- a/compiler/typecheck/TcRnMonad.hs +++ b/compiler/typecheck/TcRnMonad.hs @@ -724,11 +724,6 @@ checkErr :: Bool -> MsgDoc -> TcRn () -- Add the error if the bool is False checkErr ok msg = unless ok (addErr msg) --- | Display a warning if a condition is met. -warnIf :: WarnReason -> Bool -> MsgDoc -> TcRn () -warnIf reason True msg = addWarn reason msg -warnIf _ False _ = return () - addMessages :: Messages -> TcRn () addMessages msgs1 = do { errs_var <- getErrsVar ; @@ -1088,6 +1083,16 @@ failIfTcM True err = failWithTcM err -- Warnings have no 'M' variant, nor failure -- | Display a warning if a condition is met. +-- and the warning is enabled +warnIf :: WarnReason -> Bool -> MsgDoc -> TcRn () +warnIf reason is_bad msg + = do { warn_on <- case reason of + NoReason -> return True + Reason warn_flag -> woptM warn_flag + ; when (warn_on && is_bad) $ + addWarn reason msg } + +-- | Display a warning if a condition is met. warnTc :: WarnReason -> Bool -> MsgDoc -> TcM () warnTc reason warn_if_true warn_msg | warn_if_true = addWarnTc reason warn_msg From git at git.haskell.org Fri Apr 22 10:29:56 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 22 Apr 2016 10:29:56 +0000 (UTC) Subject: [commit: ghc] master: Do not use defaulting in ambiguity check (edf54d7) Message-ID: <20160422102956.DAFDF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/edf54d72b5b8a6dd0deafa036dc16dcfc3fcb29f/ghc >--------------------------------------------------------------- commit edf54d72b5b8a6dd0deafa036dc16dcfc3fcb29f Author: Simon Peyton Jones Date: Thu Apr 21 13:03:29 2016 +0100 Do not use defaulting in ambiguity check This fixes Trac #11947. See TcSimplify Note [No defaulting in the ambiguity check] >--------------------------------------------------------------- edf54d72b5b8a6dd0deafa036dc16dcfc3fcb29f compiler/typecheck/TcSimplify.hs | 14 +++++++++++++- testsuite/tests/typecheck/should_compile/T11947.hs | 10 ++++++++++ testsuite/tests/typecheck/should_compile/all.T | 1 + testsuite/tests/typecheck/should_fail/T11947a.hs | 6 ++++++ testsuite/tests/typecheck/should_fail/T11947a.stderr | 12 ++++++++++++ testsuite/tests/typecheck/should_fail/all.T | 1 + 6 files changed, 43 insertions(+), 1 deletion(-) diff --git a/compiler/typecheck/TcSimplify.hs b/compiler/typecheck/TcSimplify.hs index 1f7c984..8cd7bf4 100644 --- a/compiler/typecheck/TcSimplify.hs +++ b/compiler/typecheck/TcSimplify.hs @@ -384,13 +384,25 @@ How is this implemented? It's complicated! So we'll step through it all: 7) `HscMain.tcRnModule'` -- Reads `tcg_safeInfer` after type-checking, calling `HscMain.markUnsafeInfer` (passing the reason along) when safe-inferrence failed. + +Note [No defaulting in the ambiguity check] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +When simplifying constraints for the ambiguity check, we use +solveWantedsAndDrop, not simpl_top, so that we do no defaulting. +Trac #11947 was an example: + f :: Num a => Int -> Int +This is ambiguous of course, but we don't want to default the +(Num alpha) constraint to (Num Int)! Doing so gives a defaulting +warning, but no error. -} ------------------ simplifyAmbiguityCheck :: Type -> WantedConstraints -> TcM () simplifyAmbiguityCheck ty wanteds = do { traceTc "simplifyAmbiguityCheck {" (text "type = " <+> ppr ty $$ text "wanted = " <+> ppr wanteds) - ; (final_wc, _) <- runTcS $ simpl_top wanteds + ; (final_wc, _) <- runTcS $ solveWantedsAndDrop wanteds + -- NB: no defaulting! See Note [No defaulting in the ambiguity check] + ; traceTc "End simplifyAmbiguityCheck }" empty -- Normally report all errors; but with -XAllowAmbiguousTypes diff --git a/testsuite/tests/typecheck/should_compile/T11947.hs b/testsuite/tests/typecheck/should_compile/T11947.hs new file mode 100644 index 0000000..75817c8 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T11947.hs @@ -0,0 +1,10 @@ +{-# LANGUAGE TypeApplications, ScopedTypeVariables, AllowAmbiguousTypes #-} +module T11947 where + +theFloatDigits :: forall a. RealFloat a => Int +-- The type is ambiguous +theFloatDigits = floatDigits (undefined @_ @a) + +foo :: IO () +foo = print (theFloatDigits @Double, theFloatDigits @Float) +-- But the applications are not diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index ebc68eb..e58feae 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -514,3 +514,4 @@ test('T11754', normal, compile, ['']) test('T11811', normal, compile, ['']) test('T11793', normal, compile, ['']) test('T11348', normal, compile, ['']) +test('T11947', normal, compile, ['']) diff --git a/testsuite/tests/typecheck/should_fail/T11947a.hs b/testsuite/tests/typecheck/should_fail/T11947a.hs new file mode 100644 index 0000000..0d8a0d9 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T11947a.hs @@ -0,0 +1,6 @@ +{-# LANGUAGE TypeApplications, ScopedTypeVariables #-} +module T11947 where + +theFloatDigits :: forall a. RealFloat a => Int +-- The type is ambiguous, despite potential defaulting +theFloatDigits = floatDigits (undefined @_ @a) diff --git a/testsuite/tests/typecheck/should_fail/T11947a.stderr b/testsuite/tests/typecheck/should_fail/T11947a.stderr new file mode 100644 index 0000000..4f6a4a7 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T11947a.stderr @@ -0,0 +1,12 @@ + +T11947a.hs:4:19: error: + ? Could not deduce (RealFloat a0) + from the context: RealFloat a + bound by the type signature for: + theFloatDigits :: RealFloat a => Int + at T11947a.hs:4:19-46 + The type variable ?a0? is ambiguous + ? In the ambiguity check for ?theFloatDigits? + To defer the ambiguity check to use sites, enable AllowAmbiguousTypes + In the type signature: + theFloatDigits :: forall a. RealFloat a => Int diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index fe40ca2..3903f4b 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -414,3 +414,4 @@ test('T11723', normal, compile_fail, ['']) test('T11724', normal, compile_fail, ['']) test('BadUnboxedTuple', normal, compile_fail, ['']) test('T11698', normal, compile_fail, ['']) +test('T11947a', normal, compile_fail, ['']) From git at git.haskell.org Fri Apr 22 10:30:00 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 22 Apr 2016 10:30:00 +0000 (UTC) Subject: [commit: ghc] master: Warn about simplifiable class constraints (9421b0c) Message-ID: <20160422103000.40D183A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9421b0c77122d40bf72665ea9f90dca64a0a0ae2/ghc >--------------------------------------------------------------- commit 9421b0c77122d40bf72665ea9f90dca64a0a0ae2 Author: Simon Peyton Jones Date: Thu Apr 21 13:06:54 2016 +0100 Warn about simplifiable class constraints Provoked by Trac #11948, this patch adds a new warning to GHC -Wsimplifiable-class-constraints It warns if you write a class constraint in a type signature that can be simplified by an existing instance declaration. Almost always this means you should simplify it right now; type inference is very fragile without it, as #11948 shows. I've put the warning as on-by-default, but I suppose that if there are howls of protest we can move it out (as happened for -Wredundant-constraints. It actually found an example of an over-complicated context in CmmNode. Quite a few tests use these weird contexts to trigger something else, so I had to suppress the warning in those. The 'haskeline' library has a few occurrences of the warning (which I think should be fixed), so I switched it off for that library in warnings.mk. The warning itself is done in TcValidity.check_class_pred. HOWEVER, when type inference fails we get a type error; and the error suppresses the (informative) warning. So as things stand, the warning only happens when it doesn't cause a problem. Not sure what to do about this, but this patch takes us forward, I think. >--------------------------------------------------------------- 9421b0c77122d40bf72665ea9f90dca64a0a0ae2 compiler/basicTypes/BasicTypes.hs | 8 ++- compiler/cmm/CmmNode.hs | 2 +- compiler/main/DynFlags.hs | 5 +- compiler/typecheck/TcInteract.hs | 15 +++++- compiler/typecheck/TcType.hs | 2 +- compiler/typecheck/TcValidity.hs | 63 +++++++++++++++++----- compiler/types/InstEnv.hs | 45 ++++++++-------- docs/users_guide/using-warnings.rst | 22 ++++++++ mk/warnings.mk | 1 + .../dependent/should_compile/dynamic-paper.hs | 5 +- testsuite/tests/ghci/scripts/ghci047.script | 4 +- testsuite/tests/ghci/scripts/ghci047.stderr | 4 +- .../tests/indexed-types/should_compile/Gentle.hs | 3 +- .../indexed-types/should_compile/NonLinearLHS.hs | 4 +- .../tests/indexed-types/should_compile/T11067.hs | 5 ++ .../tests/indexed-types/should_compile/T5002.hs | 6 ++- .../should_compile/SomethingShowable.stderr | 6 ++- testsuite/tests/polykinds/T6020a.hs | 4 +- .../tests/simplCore/should_compile/simpl014.hs | 5 +- testsuite/tests/th/T3100.hs | 3 +- .../typecheck/should_compile/GivenOverlapping.hs | 3 +- testsuite/tests/typecheck/should_compile/T10195.hs | 4 +- testsuite/tests/typecheck/should_compile/T3108.hs | 3 +- testsuite/tests/typecheck/should_compile/T4361.hs | 2 +- testsuite/tests/typecheck/should_compile/T6055.hs | 4 +- testsuite/tests/typecheck/should_compile/T7541.hs | 3 +- testsuite/tests/typecheck/should_compile/T7875.hs | 3 +- testsuite/tests/typecheck/should_compile/tc229.hs | 4 +- testsuite/tests/typecheck/should_fail/T11948.hs | 22 ++++++++ .../tests/typecheck/should_fail/T11948.stderr | 10 ++++ testsuite/tests/typecheck/should_fail/all.T | 1 + 31 files changed, 209 insertions(+), 62 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 9421b0c77122d40bf72665ea9f90dca64a0a0ae2 From git at git.haskell.org Fri Apr 22 10:30:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 22 Apr 2016 10:30:03 +0000 (UTC) Subject: [commit: ghc] master: Test Trac #3990 (251a376) Message-ID: <20160422103003.8A98D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/251a376baf9b3824a67fba3bfb9a72bc31cf8e33/ghc >--------------------------------------------------------------- commit 251a376baf9b3824a67fba3bfb9a72bc31cf8e33 Author: Simon Peyton Jones Date: Thu Apr 21 13:29:37 2016 +0100 Test Trac #3990 >--------------------------------------------------------------- 251a376baf9b3824a67fba3bfb9a72bc31cf8e33 testsuite/tests/simplCore/should_compile/Makefile | 5 +++++ testsuite/tests/simplCore/should_compile/T3990.hs | 12 ++++++++++++ testsuite/tests/simplCore/should_compile/T3990.stdout | 2 ++ testsuite/tests/simplCore/should_compile/all.T | 4 ++++ 4 files changed, 23 insertions(+) diff --git a/testsuite/tests/simplCore/should_compile/Makefile b/testsuite/tests/simplCore/should_compile/Makefile index 87b1d95..8b7da66 100644 --- a/testsuite/tests/simplCore/should_compile/Makefile +++ b/testsuite/tests/simplCore/should_compile/Makefile @@ -2,6 +2,11 @@ TOP=../../.. include $(TOP)/mk/boilerplate.mk include $(TOP)/mk/test.mk +T3990: + $(RM) -f T3990.o T3990.hi + '$(TEST_HC)' $(TEST_HC_OPTS) -O -c -ddump-simpl T3990.hs | grep 'test_case' + # Grep output should show an unpacked constructor + T8832: $(RM) -f T8832.o T8832.hi '$(TEST_HC)' $(TEST_HC_OPTS) $(T8832_WORDSIZE_OPTS) -O -c -ddump-simpl T8832.hs | grep '^[a-zA-Z0-9]\+ =' diff --git a/testsuite/tests/simplCore/should_compile/T3990.hs b/testsuite/tests/simplCore/should_compile/T3990.hs new file mode 100644 index 0000000..9877175 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T3990.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE TypeFamilies #-} +module T3990 where + +data family Complex a +data instance Complex Double = CD {-# UNPACK #-} !Double + {-# UNPACK #-} !Double + +data T = T {-# UNPACK #-} !(Complex Double) +-- This shouuld actually get unpacked! + +test_case :: T +test_case = T (CD 1 1) diff --git a/testsuite/tests/simplCore/should_compile/T3990.stdout b/testsuite/tests/simplCore/should_compile/T3990.stdout new file mode 100644 index 0000000..20d0871 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T3990.stdout @@ -0,0 +1,2 @@ +test_case :: T +test_case = T3990.T 1.0## 1.0## diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index 9f3af8b..7aba485 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -232,3 +232,7 @@ test('T11232', normal, compile, ['-O2']) test('T11562', normal, compile, ['-O2']) test('T11742', normal, compile, ['-O2']) test('T11644', normal, compile, ['-O2']) +test('T3990', + normal, + run_command, + ['$MAKE -s --no-print-directory T3990']) From git at git.haskell.org Fri Apr 22 10:30:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 22 Apr 2016 10:30:06 +0000 (UTC) Subject: [commit: ghc] master: wibble to simplifiable (26a1804) Message-ID: <20160422103006.361D03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/26a1804182a1cf8d83aceca6cfef9d2c0221a28f/ghc >--------------------------------------------------------------- commit 26a1804182a1cf8d83aceca6cfef9d2c0221a28f Author: Simon Peyton Jones Date: Thu Apr 21 14:29:39 2016 +0100 wibble to simplifiable >--------------------------------------------------------------- 26a1804182a1cf8d83aceca6cfef9d2c0221a28f testsuite/tests/partial-sigs/should_compile/SomethingShowable.stderr | 1 + 1 file changed, 1 insertion(+) diff --git a/testsuite/tests/partial-sigs/should_compile/SomethingShowable.stderr b/testsuite/tests/partial-sigs/should_compile/SomethingShowable.stderr index 5f761f7..40f15bf 100644 --- a/testsuite/tests/partial-sigs/should_compile/SomethingShowable.stderr +++ b/testsuite/tests/partial-sigs/should_compile/SomethingShowable.stderr @@ -8,5 +8,6 @@ Dependent packages: [base-4.9.0.0, ghc-prim-0.5.0.0, SomethingShowable.hs:5:1: warning: [-Wsimplifiable-class-constraints (in -Wdefault)] The constraint ?Show Bool? matches an instance declaration + instance Show Bool -- Defined in ?GHC.Show? This makes type inference very fragile; try simplifying it using the instance From git at git.haskell.org Fri Apr 22 10:30:08 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 22 Apr 2016 10:30:08 +0000 (UTC) Subject: [commit: ghc] master: A little more debug tracing (24d3276) Message-ID: <20160422103008.E46E23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/24d3276df62b52bdf720f4789ff9ddbbb7c02cec/ghc >--------------------------------------------------------------- commit 24d3276df62b52bdf720f4789ff9ddbbb7c02cec Author: Simon Peyton Jones Date: Thu Apr 21 14:30:36 2016 +0100 A little more debug tracing >--------------------------------------------------------------- 24d3276df62b52bdf720f4789ff9ddbbb7c02cec compiler/typecheck/TcCanonical.hs | 2 +- compiler/typecheck/TcFlatten.hs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/typecheck/TcCanonical.hs b/compiler/typecheck/TcCanonical.hs index 4ff046f..cde6478 100644 --- a/compiler/typecheck/TcCanonical.hs +++ b/compiler/typecheck/TcCanonical.hs @@ -532,7 +532,7 @@ can_eq_nc -> TcS (StopOrContinue Ct) can_eq_nc flat ev eq_rel ty1 ps_ty1 ty2 ps_ty2 = do { traceTcS "can_eq_nc" $ - vcat [ ppr ev, ppr eq_rel, ppr ty1, ppr ps_ty1, ppr ty2, ppr ps_ty2 ] + vcat [ ppr flat, ppr ev, ppr eq_rel, ppr ty1, ppr ps_ty1, ppr ty2, ppr ps_ty2 ] ; rdr_env <- getGlobalRdrEnvTcS ; fam_insts <- getFamInstEnvs ; can_eq_nc' flat rdr_env fam_insts ev eq_rel ty1 ps_ty1 ty2 ps_ty2 } diff --git a/compiler/typecheck/TcFlatten.hs b/compiler/typecheck/TcFlatten.hs index 6737106..6bac122 100644 --- a/compiler/typecheck/TcFlatten.hs +++ b/compiler/typecheck/TcFlatten.hs @@ -1312,7 +1312,8 @@ flatten_tyvar1 tv ; case mb_ty of Just ty -> do { traceFlat "Following filled tyvar" (ppr tv <+> equals <+> ppr ty) ; return (FTRFollowed ty (mkReflCo role ty)) } ; - Nothing -> do { fr <- getFlavourRole + Nothing -> do { traceFlat "Unfilled tyvar" (ppr tv) + ; fr <- getFlavourRole ; flatten_tyvar2 tv fr } } flatten_tyvar2 :: TcTyVar -> CtFlavourRole -> FlatM FlattenTvResult From git at git.haskell.org Fri Apr 22 10:30:12 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 22 Apr 2016 10:30:12 +0000 (UTC) Subject: [commit: ghc] master: Avoid double error on out-of-scope identifier (c2b7a3d) Message-ID: <20160422103012.2790C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c2b7a3d9f6ad946a2cb2773e96a377cc2216cb5b/ghc >--------------------------------------------------------------- commit c2b7a3d9f6ad946a2cb2773e96a377cc2216cb5b Author: Simon Peyton Jones Date: Thu Apr 21 14:34:07 2016 +0100 Avoid double error on out-of-scope identifier Trac #11941 demonstrated a case where an out-of-scope error also gave rise to a (bogus and confusing) stage restriction message. It's caused by the fact that out-of-scope errors do not stop renaming, but rather return an "unbound name". We need to detect this in the stage-restriction test to avoid the double error. Easy fix. >--------------------------------------------------------------- c2b7a3d9f6ad946a2cb2773e96a377cc2216cb5b compiler/typecheck/TcEnv.hs | 12 ++++++++---- testsuite/tests/th/T11941.hs | 7 +++++++ testsuite/tests/th/T11941.stderr | 6 ++++++ testsuite/tests/th/all.T | 1 + 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/compiler/typecheck/TcEnv.hs b/compiler/typecheck/TcEnv.hs index b2a31b1..5bc3d00 100644 --- a/compiler/typecheck/TcEnv.hs +++ b/compiler/typecheck/TcEnv.hs @@ -966,7 +966,10 @@ notFound name = do { lcl_env <- getLclEnv ; let stage = tcl_th_ctxt lcl_env ; case stage of -- See Note [Out of scope might be a staging error] - Splice {} -> stageRestrictionError (quotes (ppr name)) + Splice {} + | isUnboundName name -> failM -- If the name really isn't in scope + -- don't report it again (Trac #11941) + | otherwise -> stageRestrictionError (quotes (ppr name)) _ -> failWithTc $ vcat[text "GHC internal error:" <+> quotes (ppr name) <+> text "is not in scope during type checking, but it passed the renamer", @@ -986,13 +989,14 @@ wrongThingErr expected thing name = failWithTc (pprTcTyThingCategory thing <+> quotes (ppr name) <+> text "used as a" <+> text expected) -{- -Note [Out of scope might be a staging error] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +{- Note [Out of scope might be a staging error] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Consider x = 3 data T = MkT $(foo x) +where 'foo' is is imported from somewhere. + This is really a staging error, because we can't run code involving 'x'. But in fact the type checker processes types first, so 'x' won't even be in the type envt when we look for it in $(foo x). So inside splices we diff --git a/testsuite/tests/th/T11941.hs b/testsuite/tests/th/T11941.hs new file mode 100644 index 0000000..ed7e746 --- /dev/null +++ b/testsuite/tests/th/T11941.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE TemplateHaskell #-} + +module T11941 where + +import Data.Monoid + +const (return []) $ mempty { getFrst = Just () } diff --git a/testsuite/tests/th/T11941.stderr b/testsuite/tests/th/T11941.stderr new file mode 100644 index 0000000..4508ed3 --- /dev/null +++ b/testsuite/tests/th/T11941.stderr @@ -0,0 +1,6 @@ + +T11941.hs:7:30: error: + Not in scope: ?getFrst? + Perhaps you meant one of these: + ?getFirst? (imported from Data.Monoid), + ?getLast? (imported from Data.Monoid) diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index 648f7c9..09960d1 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -403,3 +403,4 @@ test('T11463', normal, compile_and_run, ['-v0 -dsuppress-uniques']) test('T11680', normal, compile_fail, ['-v0']) test('T11809', normal, compile, ['-v0']) test('T11797', normal, compile, ['-v0 -dsuppress-uniques']) +test('T11941', normal, compile_fail, ['-v0']) From git at git.haskell.org Fri Apr 22 10:30:14 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 22 Apr 2016 10:30:14 +0000 (UTC) Subject: [commit: ghc] master: Simplify defaultKindVar and friends (970ff58) Message-ID: <20160422103014.CB9AA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/970ff585489285f527a098983538cd48f93ab245/ghc >--------------------------------------------------------------- commit 970ff585489285f527a098983538cd48f93ab245 Author: Simon Peyton Jones Date: Thu Apr 21 14:52:16 2016 +0100 Simplify defaultKindVar and friends I found zonkQuantifiedTyVar rather complicated, especially the two places where we defaulted RuntimeRep variables. This simplifies and modularises the story. Refactoring only. >--------------------------------------------------------------- 970ff585489285f527a098983538cd48f93ab245 compiler/typecheck/TcHsSyn.hs | 6 +- compiler/typecheck/TcMType.hs | 139 ++++++++++++++++++++++------------------- compiler/typecheck/TcPatSyn.hs | 4 +- 3 files changed, 81 insertions(+), 68 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 970ff585489285f527a098983538cd48f93ab245 From git at git.haskell.org Fri Apr 22 10:30:17 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 22 Apr 2016 10:30:17 +0000 (UTC) Subject: [commit: ghc] master: Refactor free tyvars on LHS of rules (6ad2b42) Message-ID: <20160422103017.7A3F83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6ad2b42f866fa718855cc5c850e3549bc1428b3c/ghc >--------------------------------------------------------------- commit 6ad2b42f866fa718855cc5c850e3549bc1428b3c Author: Simon Peyton Jones Date: Fri Apr 22 10:47:14 2016 +0100 Refactor free tyvars on LHS of rules A RULE can have unbound meta-tyvars on the LHS. Consider data T a = C foo :: T a -> Int foo C = 1 {-# RULES "myrule" foo C = 1 #-} After type checking the LHS becomes (foo alpha (C alpah)) and we do not want to zap the unbound meta-tyvar 'alpha' to Any, because that limits the applicability of the rule. Instead, we want to quantify over it! Previously there was a rather clunky implementation of this quantification, buried in the zonker in TcHsSyn (zonkTvCollecting). This patch refactors it so that the zonker just turns the meta-tyvar into a skolem, and the desugarer adds the quantification. See DsBinds Note [Free tyvars on rule LHS]. As it happened, the desugarer was already doing something similar for dictionaries. See DsBinds Note [Free dictionaries on rule LHS] No change in functionality, but less cruft. >--------------------------------------------------------------- 6ad2b42f866fa718855cc5c850e3549bc1428b3c compiler/deSugar/DsBinds.hs | 99 +++++++++++++++++++------------ compiler/typecheck/TcHsSyn.hs | 132 ++++++++++++++++++------------------------ 2 files changed, 119 insertions(+), 112 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 6ad2b42f866fa718855cc5c850e3549bc1428b3c From git at git.haskell.org Fri Apr 22 10:59:44 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 22 Apr 2016 10:59:44 +0000 (UTC) Subject: [commit: ghc] master: Fix typos: alpah -> alpha (ed4a228) Message-ID: <20160422105944.D9D273A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ed4a2289825e2696ffd001b9b1b7e241676ab02f/ghc >--------------------------------------------------------------- commit ed4a2289825e2696ffd001b9b1b7e241676ab02f Author: Bartosz Nitka Date: Fri Apr 22 04:02:08 2016 -0700 Fix typos: alpah -> alpha >--------------------------------------------------------------- ed4a2289825e2696ffd001b9b1b7e241676ab02f compiler/typecheck/TcHsSyn.hs | 2 +- compiler/typecheck/TcSimplify.hs | 2 +- testsuite/tests/indexed-types/should_compile/IndTypesPerfMerge.hs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/typecheck/TcHsSyn.hs b/compiler/typecheck/TcHsSyn.hs index 2db69e5..c4c4b65 100644 --- a/compiler/typecheck/TcHsSyn.hs +++ b/compiler/typecheck/TcHsSyn.hs @@ -1618,7 +1618,7 @@ quantify over them. Example: {-# RULES "myrule" foo C = 1 #-} -After type checking the LHS becomes (foo alpha (C alpah)) and we do +After type checking the LHS becomes (foo alpha (C alpha)) and we do not want to zap the unbound meta-tyvar 'alpha' to Any, because that limits the applicability of the rule. Instead, we want to quantify over it! diff --git a/compiler/typecheck/TcSimplify.hs b/compiler/typecheck/TcSimplify.hs index 8cd7bf4..f7344af 100644 --- a/compiler/typecheck/TcSimplify.hs +++ b/compiler/typecheck/TcSimplify.hs @@ -1850,7 +1850,7 @@ Which equalities should we float? We want to float ones where there is a decent chance that floating outwards will allow unification to happen. In particular: - Float out equalities of form (alpaha ~ ty) or (ty ~ alpha), where + Float out equalities of form (alpha ~ ty) or (ty ~ alpha), where * alpha is a meta-tyvar. diff --git a/testsuite/tests/indexed-types/should_compile/IndTypesPerfMerge.hs b/testsuite/tests/indexed-types/should_compile/IndTypesPerfMerge.hs index 7cfd19f..743a411 100644 --- a/testsuite/tests/indexed-types/should_compile/IndTypesPerfMerge.hs +++ b/testsuite/tests/indexed-types/should_compile/IndTypesPerfMerge.hs @@ -86,8 +86,8 @@ Another solve path: ty := beta gamma := MergerType alpha beta - UnmergedLeft (MergerType alpah beta) ~ alpha - UnmergedRight (MergerType alpah beta) ~ beta + UnmergedLeft (MergerType alpha beta) ~ alpha + UnmergedRight (MergerType alpha beta) ~ beta Merger (MergerType alpha beta) Mergeable alpha beta From git at git.haskell.org Fri Apr 22 12:18:18 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 22 Apr 2016 12:18:18 +0000 (UTC) Subject: [commit: ghc] master: Typo: veraibles -> variables (4221cc2) Message-ID: <20160422121818.86BA43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4221cc28d5e7bde8c52d54a050e477c1afaa62c5/ghc >--------------------------------------------------------------- commit 4221cc28d5e7bde8c52d54a050e477c1afaa62c5 Author: Bartosz Nitka Date: Fri Apr 22 05:20:54 2016 -0700 Typo: veraibles -> variables >--------------------------------------------------------------- 4221cc28d5e7bde8c52d54a050e477c1afaa62c5 compiler/typecheck/TcType.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/typecheck/TcType.hs b/compiler/typecheck/TcType.hs index 40a5a6f..bff6450 100644 --- a/compiler/typecheck/TcType.hs +++ b/compiler/typecheck/TcType.hs @@ -871,7 +871,7 @@ instance Outputable TcDepVars where In Haskell type inference we quantify over type variables; but we only quantify over /kind/ variables when -XPolyKinds is on. So when collecting the free vars of a type, prior to quantifying, we must keep -the type and kind veraibles separate. But what does that mean in a +the type and kind variables separate. But what does that mean in a system where kind variables /are/ type variables? It's a fairly arbitrary distinction based on how the variables appear: From git at git.haskell.org Fri Apr 22 12:48:55 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 22 Apr 2016 12:48:55 +0000 (UTC) Subject: [commit: ghc] master: Remove unused tyCoVarsOfTelescope (a9076fc) Message-ID: <20160422124855.96EB83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a9076fc2685b296bf5a32ff978c5eec91f67fd6a/ghc >--------------------------------------------------------------- commit a9076fc2685b296bf5a32ff978c5eec91f67fd6a Author: Bartosz Nitka Date: Fri Apr 22 05:51:36 2016 -0700 Remove unused tyCoVarsOfTelescope Grepping reveals that it's not used. I suspect that it isn't useful anymore. Test Plan: grep Reviewers: goldfire, austin, bgamari, simonpj Reviewed By: simonpj Subscribers: thomie, simonmar Differential Revision: https://phabricator.haskell.org/D2134 >--------------------------------------------------------------- a9076fc2685b296bf5a32ff978c5eec91f67fd6a compiler/typecheck/TcType.hs | 1 - compiler/types/TyCoRep.hs | 8 -------- 2 files changed, 9 deletions(-) diff --git a/compiler/typecheck/TcType.hs b/compiler/typecheck/TcType.hs index bff6450..83d491f 100644 --- a/compiler/typecheck/TcType.hs +++ b/compiler/typecheck/TcType.hs @@ -168,7 +168,6 @@ module TcType ( coreView, tyCoVarsOfType, tyCoVarsOfTypes, closeOverKinds, - tyCoVarsOfTelescope, tyCoFVsOfType, tyCoFVsOfTypes, tyCoVarsOfTypeDSet, tyCoVarsOfTypesDSet, closeOverKindsDSet, tyCoVarsOfTypeList, tyCoVarsOfTypesList, diff --git a/compiler/types/TyCoRep.hs b/compiler/types/TyCoRep.hs index 194df7d..1ca1efb 100644 --- a/compiler/types/TyCoRep.hs +++ b/compiler/types/TyCoRep.hs @@ -72,7 +72,6 @@ module TyCoRep ( tyCoFVsOfCo, tyCoFVsOfCos, tyCoVarsOfCoList, tyCoVarsOfProv, closeOverKinds, - tyCoVarsOfTelescope, -- * Substitutions TCvSubst(..), TvSubstEnv, CvSubstEnv, @@ -1528,13 +1527,6 @@ closeOverKindsFV tvs = closeOverKindsDSet :: DTyVarSet -> DTyVarSet closeOverKindsDSet = fvDVarSet . closeOverKindsFV . dVarSetElems --- | Gets the free vars of a telescope, scoped over a given free var set. -tyCoVarsOfTelescope :: [Var] -> TyCoVarSet -> TyCoVarSet -tyCoVarsOfTelescope [] fvs = fvs -tyCoVarsOfTelescope (v:vs) fvs = tyCoVarsOfTelescope vs fvs - `delVarSet` v - `unionVarSet` tyCoVarsOfType (varType v) - {- %************************************************************************ %* * From git at git.haskell.org Fri Apr 22 16:06:34 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 22 Apr 2016 16:06:34 +0000 (UTC) Subject: [commit: ghc] master: Make benign non-determinism in pretty-printing more obvious (0f96686) Message-ID: <20160422160634.0B0E93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0f96686b10fd36d479a54c71a6e1753193e85347/ghc >--------------------------------------------------------------- commit 0f96686b10fd36d479a54c71a6e1753193e85347 Author: Bartosz Nitka Date: Mon Apr 18 07:32:03 2016 -0700 Make benign non-determinism in pretty-printing more obvious This change takes us one step closer to being able to remove `varSetElemsWellScoped`. The end goal is to make every source of non-determinism obvious at the source level, so that when we achieve determinism it doesn't get broken accidentally. Test Plan: compile GHC Reviewers: simonmar, goldfire, simonpj, austin, bgamari Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2123 GHC Trac Issues: #4012 >--------------------------------------------------------------- 0f96686b10fd36d479a54c71a6e1753193e85347 compiler/basicTypes/VarSet.hs | 21 ++++++++++++++++++++- compiler/typecheck/FamInst.hs | 4 ++-- compiler/typecheck/FunDeps.hs | 6 +++--- compiler/utils/UniqFM.hs | 20 +++++++++++++++++++- 4 files changed, 44 insertions(+), 7 deletions(-) diff --git a/compiler/basicTypes/VarSet.hs b/compiler/basicTypes/VarSet.hs index 1cd9e21..8ece555 100644 --- a/compiler/basicTypes/VarSet.hs +++ b/compiler/basicTypes/VarSet.hs @@ -21,6 +21,7 @@ module VarSet ( lookupVarSet, lookupVarSetByName, mapVarSet, sizeVarSet, seqVarSet, elemVarSetByKey, partitionVarSet, + pluralVarSet, pprVarSet, -- * Deterministic Var set types DVarSet, DIdSet, DTyVarSet, DTyCoVarSet, @@ -45,8 +46,9 @@ import Unique import Name ( Name ) import UniqSet import UniqDSet -import UniqFM( disjointUFM ) +import UniqFM( disjointUFM, pluralUFM, pprUFM ) import UniqDFM( disjointUDFM ) +import Outputable (SDoc) -- | A non-deterministic set of variables. -- See Note [Deterministic UniqFM] in UniqDFM for explanation why it's not @@ -169,6 +171,23 @@ transCloVarSet fn seeds seqVarSet :: VarSet -> () seqVarSet s = sizeVarSet s `seq` () +-- | Determines the pluralisation suffix appropriate for the length of a set +-- in the same way that plural from Outputable does for lists. +pluralVarSet :: VarSet -> SDoc +pluralVarSet = pluralUFM + +-- | Pretty-print a non-deterministic set. +-- The order of variables is non-deterministic and for pretty-printing that +-- shouldn't be a problem. +-- Having this function helps contain the non-determinism created with +-- varSetElems. +pprVarSet :: ([Var] -> SDoc) -- ^ The pretty printing function to use on the + -- elements + -> VarSet -- ^ The things to be pretty printed + -> SDoc -- ^ 'SDoc' where the things have been pretty + -- printed +pprVarSet = pprUFM + -- Deterministic VarSet -- See Note [Deterministic UniqFM] in UniqDFM for explanation why we need -- DVarSet. diff --git a/compiler/typecheck/FamInst.hs b/compiler/typecheck/FamInst.hs index 5ac8b68..a7fad31 100644 --- a/compiler/typecheck/FamInst.hs +++ b/compiler/typecheck/FamInst.hs @@ -557,12 +557,12 @@ unusedInjectiveVarsErr (Pair invis_vars vis_vars) errorBuilder tyfamEqn = errorBuilder (injectivityErrorHerald True $$ msg) [tyfamEqn] where - tvs = varSetElemsWellScoped (invis_vars `unionVarSet` vis_vars) + tvs = invis_vars `unionVarSet` vis_vars has_types = not $ isEmptyVarSet vis_vars has_kinds = not $ isEmptyVarSet invis_vars doc = sep [ what <+> text "variable" <> - plural tvs <+> pprQuotedList tvs + pluralVarSet tvs <+> pprVarSet (pprQuotedList . toposortTyVars) tvs , text "cannot be inferred from the right-hand side." ] what = case (has_types, has_kinds) of (True, True) -> text "Type and kind" diff --git a/compiler/typecheck/FunDeps.hs b/compiler/typecheck/FunDeps.hs index 4aa7132..4f213b2 100644 --- a/compiler/typecheck/FunDeps.hs +++ b/compiler/typecheck/FunDeps.hs @@ -381,7 +381,7 @@ checkInstCoverage be_liberal clas theta inst_taus liberal_undet_tvs = (`minusVarSet` closed_ls_tvs) <$> rs_tvs conserv_undet_tvs = (`minusVarSet` ls_tvs) <$> rs_tvs - undet_list = varSetElemsWellScoped (fold undetermined_tvs) + undet_set = fold undetermined_tvs msg = vcat [ -- text "ls_tvs" <+> ppr ls_tvs -- , text "closed ls_tvs" <+> ppr (closeOverKinds ls_tvs) @@ -401,8 +401,8 @@ checkInstCoverage be_liberal clas theta inst_taus else text "do not jointly") <+> text "determine rhs type"<>plural rs <+> pprQuotedList rs ] - , text "Un-determined variable" <> plural undet_list <> colon - <+> pprWithCommas ppr undet_list + , text "Un-determined variable" <> pluralVarSet undet_set <> colon + <+> pprVarSet (pprWithCommas ppr) undet_set , ppWhen (isEmptyVarSet $ pSnd undetermined_tvs) $ ppSuggestExplicitKinds , ppWhen (not be_liberal && diff --git a/compiler/utils/UniqFM.hs b/compiler/utils/UniqFM.hs index 969e1dc..3632926 100644 --- a/compiler/utils/UniqFM.hs +++ b/compiler/utils/UniqFM.hs @@ -67,7 +67,7 @@ module UniqFM ( eltsUFM, keysUFM, splitUFM, ufmToSet_Directly, ufmToList, - joinUFM, pprUniqFM + joinUFM, pprUniqFM, pprUFM, pluralUFM ) where import Unique ( Uniquable(..), Unique, getKey ) @@ -324,3 +324,21 @@ pprUniqFM ppr_elt ufm = brackets $ fsep $ punctuate comma $ [ ppr uq <+> text ":->" <+> ppr_elt elt | (uq, elt) <- ufmToList ufm ] + +-- | Pretty-print a non-deterministic set. +-- The order of variables is non-deterministic and for pretty-printing that +-- shouldn't be a problem. +-- Having this function helps contain the non-determinism created with +-- eltsUFM. +pprUFM :: ([a] -> SDoc) -- ^ The pretty printing function to use on the elements + -> UniqFM a -- ^ The things to be pretty printed + -> SDoc -- ^ 'SDoc' where the things have been pretty + -- printed +pprUFM pp ufm = pp (eltsUFM ufm) + +-- | Determines the pluralisation suffix appropriate for the length of a set +-- in the same way that plural from Outputable does for lists. +pluralUFM :: UniqFM a -> SDoc +pluralUFM ufm + | sizeUFM ufm == 1 = empty + | otherwise = char 's' From git at git.haskell.org Fri Apr 22 16:46:54 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 22 Apr 2016 16:46:54 +0000 (UTC) Subject: [commit: ghc] master: Get rid of varSetElemsWellScoped in abstractFloats (03006f5) Message-ID: <20160422164654.7DB803A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/03006f5ef2daedbbb7b0932b2c0e265f097cf2bf/ghc >--------------------------------------------------------------- commit 03006f5ef2daedbbb7b0932b2c0e265f097cf2bf Author: Bartosz Nitka Date: Fri Apr 22 09:47:30 2016 -0700 Get rid of varSetElemsWellScoped in abstractFloats It's possible to get rid of this use site in a local way and it introduces unneccessary nondeterminism. Test Plan: ./validate Reviewers: simonmar, goldfire, austin, bgamari, simonpj Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2122 GHC Trac Issues: #4012 >--------------------------------------------------------------- 03006f5ef2daedbbb7b0932b2c0e265f097cf2bf compiler/coreSyn/CoreFVs.hs | 9 ++++++++- compiler/simplCore/SimplUtils.hs | 8 ++++---- compiler/types/TyCoRep.hs | 7 ++++++- compiler/types/Type.hs | 2 +- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/compiler/coreSyn/CoreFVs.hs b/compiler/coreSyn/CoreFVs.hs index 660538c..084ed65 100644 --- a/compiler/coreSyn/CoreFVs.hs +++ b/compiler/coreSyn/CoreFVs.hs @@ -22,7 +22,7 @@ module CoreFVs ( -- * Selective free variables of expressions InterestingVarFun, exprSomeFreeVars, exprsSomeFreeVars, - exprsSomeFreeVarsList, + exprSomeFreeVarsList, exprsSomeFreeVarsList, -- * Free variables of Rules, Vars and Ids varTypeTyCoVars, @@ -155,6 +155,13 @@ exprSomeFreeVars :: InterestingVarFun -- ^ Says which 'Var's are interesting -> VarSet exprSomeFreeVars fv_cand e = fvVarSet $ filterFV fv_cand $ expr_fvs e +-- | Finds free variables in an expression selected by a predicate +-- returning a deterministically ordered list. +exprSomeFreeVarsList :: InterestingVarFun -- ^ Says which 'Var's are interesting + -> CoreExpr + -> [Var] +exprSomeFreeVarsList fv_cand e = fvVarList $ filterFV fv_cand $ expr_fvs e + -- | Finds free variables in several expressions selected by a predicate exprsSomeFreeVars :: InterestingVarFun -- Says which 'Var's are interesting -> [CoreExpr] diff --git a/compiler/simplCore/SimplUtils.hs b/compiler/simplCore/SimplUtils.hs index 0e40343..48dce1d 100644 --- a/compiler/simplCore/SimplUtils.hs +++ b/compiler/simplCore/SimplUtils.hs @@ -1566,10 +1566,10 @@ abstractFloats main_tvs body_env body rhs' = CoreSubst.substExpr (text "abstract_floats2") subst rhs -- tvs_here: see Note [Which type variables to abstract over] - tvs_here = varSetElemsWellScoped $ - intersectVarSet main_tv_set $ - closeOverKinds $ - exprSomeFreeVars isTyVar rhs' + tvs_here = toposortTyVars $ + filter (`elemVarSet` main_tv_set) $ + closeOverKindsList $ + exprSomeFreeVarsList isTyVar rhs' abstract subst (Rec prs) = do { (poly_ids, poly_apps) <- mapAndUnzipM (mk_poly tvs_here) ids diff --git a/compiler/types/TyCoRep.hs b/compiler/types/TyCoRep.hs index 1ca1efb..b1aad56 100644 --- a/compiler/types/TyCoRep.hs +++ b/compiler/types/TyCoRep.hs @@ -64,7 +64,7 @@ module TyCoRep ( tyCoVarsOfType, tyCoVarsOfTypeDSet, tyCoVarsOfTypes, tyCoVarsOfTypesDSet, tyCoFVsBndr, tyCoFVsOfType, tyCoVarsOfTypeList, tyCoFVsOfTypes, tyCoVarsOfTypesList, - closeOverKindsDSet, closeOverKindsFV, + closeOverKindsDSet, closeOverKindsFV, closeOverKindsList, coVarsOfType, coVarsOfTypes, coVarsOfCo, coVarsOfCos, tyCoVarsOfCo, tyCoVarsOfCos, @@ -1523,6 +1523,11 @@ closeOverKindsFV tvs = mapUnionFV (tyCoFVsOfType . tyVarKind) tvs `unionFV` mkFVs tvs -- | Add the kind variables free in the kinds of the tyvars in the given set. +-- Returns a deterministically ordered list. +closeOverKindsList :: [TyVar] -> [TyVar] +closeOverKindsList tvs = fvVarList $ closeOverKindsFV tvs + +-- | Add the kind variables free in the kinds of the tyvars in the given set. -- Returns a deterministic set. closeOverKindsDSet :: DTyVarSet -> DTyVarSet closeOverKindsDSet = fvDVarSet . closeOverKindsFV . dVarSetElems diff --git a/compiler/types/Type.hs b/compiler/types/Type.hs index 321797b..42f9110 100644 --- a/compiler/types/Type.hs +++ b/compiler/types/Type.hs @@ -119,7 +119,7 @@ module Type ( tyCoVarsOfType, tyCoVarsOfTypes, tyCoFVsOfType, tyCoVarsOfTypeDSet, coVarsOfType, - coVarsOfTypes, closeOverKinds, + coVarsOfTypes, closeOverKinds, closeOverKindsList, splitVisVarsOfType, splitVisVarsOfTypes, expandTypeSynonyms, typeSize, From git at git.haskell.org Fri Apr 22 17:44:29 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 22 Apr 2016 17:44:29 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Bump bytestring submodule (f8b467d) Message-ID: <20160422174429.370DC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/f8b467d67c7dd36205eb6c185cd52be7b1626166/ghc >--------------------------------------------------------------- commit f8b467d67c7dd36205eb6c185cd52be7b1626166 Author: Ben Gamari Date: Thu Apr 21 23:17:18 2016 +0200 Bump bytestring submodule >--------------------------------------------------------------- f8b467d67c7dd36205eb6c185cd52be7b1626166 libraries/bytestring | 2 +- testsuite/tests/safeHaskell/check/pkg01/ImpSafe03.stderr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/bytestring b/libraries/bytestring index 3d6d0f6..717f115 160000 --- a/libraries/bytestring +++ b/libraries/bytestring @@ -1 +1 @@ -Subproject commit 3d6d0f60ac25736cc87a6f598886fe77e7b6ad90 +Subproject commit 717f1151751fceb4e49874737dd0f15839ffd541 diff --git a/testsuite/tests/safeHaskell/check/pkg01/ImpSafe03.stderr b/testsuite/tests/safeHaskell/check/pkg01/ImpSafe03.stderr index d8c8d67..cc3588f 100644 --- a/testsuite/tests/safeHaskell/check/pkg01/ImpSafe03.stderr +++ b/testsuite/tests/safeHaskell/check/pkg01/ImpSafe03.stderr @@ -1,4 +1,4 @@ [2 of 2] Compiling Main ( ImpSafe03.hs, ImpSafe03.o ) : - The package (bytestring-0.10.7.0) is required to be trusted but it isn't! + The package (bytestring-0.10.8.0) is required to be trusted but it isn't! From git at git.haskell.org Fri Apr 22 17:44:32 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 22 Apr 2016 17:44:32 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Adjust error check for class method types (aab9241) Message-ID: <20160422174432.632973A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/aab92412cf4cb77d988d36fb013018695c271ccd/ghc >--------------------------------------------------------------- commit aab92412cf4cb77d988d36fb013018695c271ccd Author: Simon Peyton Jones Date: Fri Apr 15 11:49:23 2016 +0100 Adjust error check for class method types Fixes Trac #11793. Nothing deep here. (cherry picked from commit e24b3b1eeba91bd5b127261652b48eae2d4751b1) >--------------------------------------------------------------- aab92412cf4cb77d988d36fb013018695c271ccd compiler/typecheck/TcTyClsDecls.hs | 23 +++++++++++++++++++--- testsuite/tests/typecheck/should_compile/T11793.hs | 8 ++++++++ testsuite/tests/typecheck/should_compile/all.T | 1 + 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/compiler/typecheck/TcTyClsDecls.hs b/compiler/typecheck/TcTyClsDecls.hs index f7c03dd..63a6330 100644 --- a/compiler/typecheck/TcTyClsDecls.hs +++ b/compiler/typecheck/TcTyClsDecls.hs @@ -2380,9 +2380,12 @@ checkValidClass cls (_,theta2,_) = tcSplitSigmaTy tau1 check_constraint :: TcPredType -> TcM () - check_constraint pred - = when (tyCoVarsOfType pred `subVarSet` cls_tv_set) + check_constraint pred -- See Note [Class method constraints] + = when (not (isEmptyVarSet pred_tvs) && + pred_tvs `subVarSet` cls_tv_set) (addErrTc (badMethPred sel_id pred)) + where + pred_tvs = tyCoVarsOfType pred check_at (ATI fam_tc m_dflt_rhs) = do { checkTc (cls_arity == 0 || any (`elemVarSet` cls_tv_set) fam_tvs) @@ -2421,7 +2424,21 @@ checkFamFlag tc_name err_msg = hang (text "Illegal family declaration for" <+> quotes (ppr tc_name)) 2 (text "Use TypeFamilies to allow indexed type families") -{- +{- Note [Class method constraints] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Haskell 2010 is supposed to reject + class C a where + op :: Eq a => a -> a +where the method type costrains only the class variable(s). (The extension +-XConstrainedClassMethods switches off this check.) But regardless +we should not reject + class C a where + op :: (?x::Int) => a -> a +as pointed out in Trac #11793. So the test here rejects the program if + * -XConstrainedClassMethods is off + * the tyvars of the constraint are non-empty + * all the tyvars are class tyvars, none are locally quantified + Note [Abort when superclass cycle is detected] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ We must avoid doing the ambiguity check for the methods (in diff --git a/testsuite/tests/typecheck/should_compile/T11793.hs b/testsuite/tests/typecheck/should_compile/T11793.hs new file mode 100644 index 0000000..f42a623 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T11793.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE ImplicitParams #-} + +module T11793 where + +class C a where + op :: (?x::Int) => a -> a + +-- Should be OK even without ConstrainedClassMethods diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index c03773a..f6c9d2e 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -510,3 +510,4 @@ test('T11699', normal, compile, ['']) test('T11512', normal, compile, ['']) test('T11754', normal, compile, ['']) test('T11811', normal, compile, ['']) +test('T11793', normal, compile, ['']) From git at git.haskell.org Sat Apr 23 14:29:59 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 23 Apr 2016 14:29:59 +0000 (UTC) Subject: [commit: ghc] wip/rae: Fix #11974 by adding a more smarts to TcDefaults. (4526940) Message-ID: <20160423142959.6B44E3A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rae Link : http://ghc.haskell.org/trac/ghc/changeset/4526940a5397d608a95307797ae4251b5e87171b/ghc >--------------------------------------------------------------- commit 4526940a5397d608a95307797ae4251b5e87171b Author: Richard Eisenberg Date: Fri Apr 22 22:28:35 2016 -0400 Fix #11974 by adding a more smarts to TcDefaults. Test case: typecheck/should_compile/T11974 >--------------------------------------------------------------- 4526940a5397d608a95307797ae4251b5e87171b compiler/prelude/PrelNames.hs | 12 ++++++++++ compiler/typecheck/TcDefaults.hs | 28 ++++++++++++---------- testsuite/tests/typecheck/should_compile/T11974.hs | 5 ++++ testsuite/tests/typecheck/should_compile/all.T | 1 + 4 files changed, 33 insertions(+), 13 deletions(-) diff --git a/compiler/prelude/PrelNames.hs b/compiler/prelude/PrelNames.hs index 1480851..5ed3151 100644 --- a/compiler/prelude/PrelNames.hs +++ b/compiler/prelude/PrelNames.hs @@ -2245,6 +2245,18 @@ derivableClassKeys = [ eqClassKey, ordClassKey, enumClassKey, ixClassKey, boundedClassKey, showClassKey, readClassKey ] + +-- These are the "interactive classes" that are consulted when doing +-- defaulting. Does not include Num or IsString, which have special +-- handling. +interactiveClassNames :: [Name] +interactiveClassNames + = [ showClassName, eqClassName, ordClassName, foldableClassName + , traversableClassName ] + +interactiveClassKeys :: [Unique] +interactiveClassKeys = map getUnique interactiveClassNames + {- ************************************************************************ * * diff --git a/compiler/typecheck/TcDefaults.hs b/compiler/typecheck/TcDefaults.hs index f45dd63..477e10b 100644 --- a/compiler/typecheck/TcDefaults.hs +++ b/compiler/typecheck/TcDefaults.hs @@ -13,8 +13,9 @@ import Class import TcRnMonad import TcEnv import TcHsType +import TcHsSyn import TcSimplify -import TcMType +import TcValidity import TcType import PrelNames import SrcLoc @@ -46,11 +47,16 @@ tcDefaults [L _ (DefaultDecl [])] tcDefaults [L locn (DefaultDecl mono_tys)] = setSrcSpan locn $ addErrCtxt defaultDeclCtxt $ - do { ovl_str <- xoptM LangExt.OverloadedStrings + do { ovl_str <- xoptM LangExt.OverloadedStrings + ; ext_deflt <- xoptM LangExt.ExtendedDefaultRules ; num_class <- tcLookupClass numClassName - ; is_str_class <- tcLookupClass isStringClassName - ; let deflt_clss | ovl_str = [num_class, is_str_class] - | otherwise = [num_class] + ; deflt_str <- if ovl_str + then mapM tcLookupClass [isStringClassName] + else return [] + ; deflt_interactive <- if ext_deflt + then mapM tcLookupClass interactiveClassNames + else return [] + ; let deflt_clss = num_class : deflt_str ++ deflt_interactive ; tau_tys <- mapM (tc_default_ty deflt_clss) mono_tys @@ -63,10 +69,10 @@ tcDefaults decls@(L locn (DefaultDecl _) : _) tc_default_ty :: [Class] -> LHsType Name -> TcM Type tc_default_ty deflt_clss hs_ty - = do { ty <- solveEqualities $ - tcHsLiftedType hs_ty - ; ty <- zonkTcType ty -- establish Type invariants - ; checkTc (isTauTy ty) (polyDefErr hs_ty) + = do { (ty, _kind) <- solveEqualities $ + tcLHsType hs_ty + ; ty <- zonkTcTypeToType emptyZonkEnv ty -- establish Type invariants + ; checkValidType DefaultDeclCtxt ty -- Check that the type is an instance of at least one of the deflt_clss ; oks <- mapM (check_instance ty) deflt_clss @@ -91,10 +97,6 @@ dupDefaultDeclErr (L _ (DefaultDecl _) : dup_things) pp (L locn (DefaultDecl _)) = text "here was another default declaration" <+> ppr locn dupDefaultDeclErr [] = panic "dupDefaultDeclErr []" -polyDefErr :: LHsType Name -> SDoc -polyDefErr ty - = hang (text "Illegal polymorphic type in default declaration" <> colon) 2 (ppr ty) - badDefaultTy :: Type -> [Class] -> SDoc badDefaultTy ty deflt_clss = hang (text "The default type" <+> quotes (ppr ty) <+> ptext (sLit "is not an instance of")) diff --git a/testsuite/tests/typecheck/should_compile/T11974.hs b/testsuite/tests/typecheck/should_compile/T11974.hs new file mode 100644 index 0000000..dc157cf --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T11974.hs @@ -0,0 +1,5 @@ +{-# LANGUAGE ExtendedDefaultRules #-} + +module T11974 where + +default (Maybe, []) diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index e58feae..bf03c22 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -515,3 +515,4 @@ test('T11811', normal, compile, ['']) test('T11793', normal, compile, ['']) test('T11348', normal, compile, ['']) test('T11947', normal, compile, ['']) +test('T11974', normal, compile, ['']) From git at git.haskell.org Sat Apr 23 14:29:56 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 23 Apr 2016 14:29:56 +0000 (UTC) Subject: [commit: ghc] wip/rae: Very confusing typo in error message. (f834917) Message-ID: <20160423142956.5E6ED3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rae Link : http://ghc.haskell.org/trac/ghc/changeset/f8349174c95bedde9c8557d1a156a788adc1dd57/ghc >--------------------------------------------------------------- commit f8349174c95bedde9c8557d1a156a788adc1dd57 Author: Richard Eisenberg Date: Fri Apr 22 15:29:10 2016 -0400 Very confusing typo in error message. >--------------------------------------------------------------- f8349174c95bedde9c8557d1a156a788adc1dd57 compiler/typecheck/TcInteract.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/typecheck/TcInteract.hs b/compiler/typecheck/TcInteract.hs index f451af9..2bc4184 100644 --- a/compiler/typecheck/TcInteract.hs +++ b/compiler/typecheck/TcInteract.hs @@ -165,7 +165,7 @@ solveSimpleWanteds simples | n `intGtLimit` limit = failTcS (hang (text "solveSimpleWanteds: too many iterations" <+> parens (text "limit =" <+> ppr limit)) - 2 (vcat [ text "Set limit with -fsolver-iterations=n; n=0 for no limit" + 2 (vcat [ text "Set limit with -fconstraint-solver-iterations=n; n=0 for no limit" , text "Simples =" <+> ppr simples , text "WC =" <+> ppr wc ])) From git at git.haskell.org Sat Apr 23 14:30:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 23 Apr 2016 14:30:03 +0000 (UTC) Subject: [commit: ghc] wip/rae: Fix #10963 and #11975 by adding new cmds to GHCi. (cb3d01e) Message-ID: <20160423143003.67ACD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rae Link : http://ghc.haskell.org/trac/ghc/changeset/cb3d01e7d945f2507f6da857855c2fd25d87f911/ghc >--------------------------------------------------------------- commit cb3d01e7d945f2507f6da857855c2fd25d87f911 Author: Richard Eisenberg Date: Fri Apr 22 22:39:17 2016 -0400 Fix #10963 and #11975 by adding new cmds to GHCi. See the user's guide entry or the Note [TcRnExprMode] in TcRnDriver. Test cases: ghci/scripts/T{10963,11975} >--------------------------------------------------------------- cb3d01e7d945f2507f6da857855c2fd25d87f911 compiler/main/GHC.hs | 2 +- compiler/main/HscMain.hs | 8 +-- compiler/main/InteractiveEval.hs | 8 +-- compiler/typecheck/TcBinds.hs | 9 +-- compiler/typecheck/TcExpr.hs | 4 +- compiler/typecheck/TcPatSyn.hs | 3 +- compiler/typecheck/TcRnDriver.hs | 101 ++++++++++++++++++++++------- compiler/typecheck/TcSimplify.hs | 83 ++++++++++++++++-------- docs/users_guide/ghci.rst | 62 ++++++++++++++++-- ghc/GHCi/UI.hs | 16 +++-- ghc/GHCi/UI/Info.hs | 2 +- testsuite/tests/ghci/scripts/T10963.script | 8 +++ testsuite/tests/ghci/scripts/T10963.stderr | 12 ++++ testsuite/tests/ghci/scripts/T10963.stdout | 5 ++ testsuite/tests/ghci/scripts/T11975.script | 9 +++ testsuite/tests/ghci/scripts/T11975.stdout | 15 +++++ testsuite/tests/ghci/scripts/all.T | 2 + 17 files changed, 272 insertions(+), 77 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc cb3d01e7d945f2507f6da857855c2fd25d87f911 From git at git.haskell.org Sat Apr 23 14:30:05 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 23 Apr 2016 14:30:05 +0000 (UTC) Subject: [commit: ghc] wip/rae's head updated: Fix #10963 and #11975 by adding new cmds to GHCi. (cb3d01e) Message-ID: <20160423143005.E26E93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/rae' now includes: 49560ba Fix commented out debugging code in ByteCodeGen 227a29d Fix typos: tyars -> tyvars 20f9056 Remove some old commented out code in StgLint 3a34b5c Add a test case for #11731. f4fd98c Add a final demand analyzer run right before TidyCore 928d747 Kill some unnecessary varSetElems 2acfaae Comments only e24b3b1 Adjust error check for class method types 31e4974 Remove some gratitious varSetElemsWellScoped 8d66765 Increase an InScopeSet for a substitution aaaa61c users-guide: Note change in LLVM support policy 10c6df0 utils: Provide CallStack to expectJust 116088d testsuite: Add T11824 cb0d29b testsuite: Add test for #11827 9d063b6 Linker: Fix signedness mismatch 933abfa rel-notes: Add note about UndecidableSuperClasses and #11762 54e67c1 Remove dead function SimplUtils.countValArgs f0e331b Comments only, on Type.topSortTyVars a7ee2d4 Improve TcFlatten.flattenTyVar e9ad489 libdw: More precise version check d77981e rts/RetainerProfile: Remove unused local bf17fd0 deriveConstants: Verify sanity of nm f4e6591 Bump haddock submodule 865602e Rework CC/CC_STAGE0 handling in `configure.ac` 3f3ad75 Update `directory` submodule to v1.2.6.0 release 4cbae1b Update array submodule to v0.5.1.1 release tag 97f2b16 Add Windows import library support to the Runtime Linker 04b70cd Add TemplateHaskell support for Overlapping pragmas 89b6674 TH: Tweak Haddock language 7a1c073 users-guide: Fix typo 07dc330 validate: Note existence of config_args variable 7005b9f Add flag to control number of missing patterns in warnings 36a0b6d Check CCS tree for pointers into shared object during checkUnload 177aec6 Linker: Clean up #if USE_MMAP usage a392208 Resolve symlinks when attempting to find GHC's lib folder on Windows 93d85af Update `directory` submodule to v1.2.6.1 release dd920e4 Silence unused-import warning introduced by 93d85af9fec968b 8a75bb5 Update haskeline submodule to 0.7.2.3 release 3dac53f Make it easy to get hyperlinked sources 10d808c relnotes: Add note about #11744 and workaround 87114ae Use stdint types to define SIZEOF and ALIGNMENT of INTx/WORDx 32ddd96 Remove obsolete/redundant FLEXIBLE_ARRAY macro 350ffc3 rts: Limit maximum backtrace depth d1ce35d rts: Don't use strndup 8556f56 Update `directory` submodule to v1.2.6.2 release a3c37c3 Remove unused import of emptyNameEnv d59939a Define TyCoRep.ppSuggestExplicitKinds, and use it 17eb241 Refactor computing dependent type vars 8136a5c Tighten checking for associated type instances 9de405d Kill dead TauTvFlavour, and move code around 81e2279 Update hsc2hs submodule 91ee509 Mark GHC.Stack.Types Trustworthy 96e1bb4 Update deepseq submodule to latest 1.4.2.0 snapshot ff290b8 Update binary submodule to 0.8.3.0 release 15b7e87 Update `pretty` submodule to v1.1.3.3 release 81b14c1 Update unix submodule to v2.7.2.0 release 7f71dbe Bump haddock submodule 81aa3d1 Reduce use of instances in hs-boot files 871f684 Define NameSet.intersectFVs 7319b80 Tighten up imports, white space 353d8ae SCC analysis for instances as well as types/classes 61191de Fix two buglets in 17eb241 noticed by Richard cdcf014 Tighten up imports on TcTyClsDecls 687c778 Kill unnecessary varSetElemsWellScoped in deriveTyData 62943d2 Build a correct substitution in dataConInstPat 55b1b85 Accept tcrun045 output 2e33320 Rename FV related functions 98a14ff Point to note about FV eta-expansion performance 7c6585a Remove mysterious varSetElemsWellScoped in tidyFreeTyCoVars 8c33cd4 testsuite: Bump max bytes used of T4029 f02af79 Improve the behaviour of warnIf edf54d7 Do not use defaulting in ambiguity check 9421b0c Warn about simplifiable class constraints 251a376 Test Trac #3990 26a1804 wibble to simplifiable 24d3276 A little more debug tracing c2b7a3d Avoid double error on out-of-scope identifier 970ff58 Simplify defaultKindVar and friends 6ad2b42 Refactor free tyvars on LHS of rules ed4a228 Fix typos: alpah -> alpha 4221cc2 Typo: veraibles -> variables a9076fc Remove unused tyCoVarsOfTelescope 0f96686 Make benign non-determinism in pretty-printing more obvious 03006f5 Get rid of varSetElemsWellScoped in abstractFloats f834917 Very confusing typo in error message. 4526940 Fix #11974 by adding a more smarts to TcDefaults. cb3d01e Fix #10963 and #11975 by adding new cmds to GHCi. From git at git.haskell.org Sun Apr 24 09:34:50 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 24 Apr 2016 09:34:50 +0000 (UTC) Subject: [commit: ghc] master: deriveConstants: Fix nm-classic error message (28503fe) Message-ID: <20160424093450.8D1123A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/28503fe984dbc00f687f0579967d583eebb9afcb/ghc >--------------------------------------------------------------- commit 28503fe984dbc00f687f0579967d583eebb9afcb Author: Ben Gamari Date: Sun Apr 24 11:31:51 2016 +0200 deriveConstants: Fix nm-classic error message Thanks to George Colpitts for the suggestion. >--------------------------------------------------------------- 28503fe984dbc00f687f0579967d583eebb9afcb utils/deriveConstants/Main.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/utils/deriveConstants/Main.hs b/utils/deriveConstants/Main.hs index 96da166..6a050d3 100644 --- a/utils/deriveConstants/Main.hs +++ b/utils/deriveConstants/Main.hs @@ -691,7 +691,10 @@ getWanted verbose os tmpdir gccProgram gccFlags nmProgram mobjdumpProgram Just 292 -> return () -- OK Nothing -> die "CONTROL_GROUP_CONST_291 missing!" Just 0x292 -> die $ "broken 'nm' detected, see https://ghc.haskell.org/ticket/11744.\n" - ++ "Workaround: You may want to pass '--with-nm=nm-classic' to 'configure'." + ++ "\n" + ++ "Workaround: You may want to pass\n" + ++ " --with-nm=$(xcode-select -p)/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm-classic\n" + ++ "to 'configure'.\n" Just x -> die ("unexpected value round-tripped for CONTROL_GROUP_CONST_291: " ++ show x) rs <- mapM (lookupResult m) (wanteds os) From git at git.haskell.org Tue Apr 26 08:49:50 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Apr 2016 08:49:50 +0000 (UTC) Subject: [commit: packages/hpc] master: Testsuite: AMPify tests/raytrace/Eval.hs (a3882aa) Message-ID: <20160426084950.D81CC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hpc On branch : master Link : http://git.haskell.org/packages/hpc.git/commitdiff/a3882aa98eb801278adc1f063e6724c035e1adfa >--------------------------------------------------------------- commit a3882aa98eb801278adc1f063e6724c035e1adfa Author: Thomas Miedema Date: Mon Apr 25 18:13:36 2016 +0200 Testsuite: AMPify tests/raytrace/Eval.hs >--------------------------------------------------------------- a3882aa98eb801278adc1f063e6724c035e1adfa tests/raytrace/Eval.hs | 23 +++++++++++++++++++---- tests/raytrace/test.T | 15 +++++++++++---- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/tests/raytrace/Eval.hs b/tests/raytrace/Eval.hs index 3ce24e4..bd9d419 100644 --- a/tests/raytrace/Eval.hs +++ b/tests/raytrace/Eval.hs @@ -5,6 +5,7 @@ module Eval where +import Control.Monad import Data.Array import Geometry @@ -22,9 +23,16 @@ class Monad m => MonadEval m where newtype Pure a = Pure a deriving Show +instance Functor Pure where + fmap = liftM + +instance Applicative Pure where + pure = Pure + (<*>) = ap + instance Monad Pure where Pure x >>= k = k x - return = Pure + return = pure fail s = error s instance MonadEval Pure where @@ -248,7 +256,7 @@ doPrimOp primOp op args types = getPrimOpType primOp --- Render is somewhat funny, becauase it can only get called at top level. +-- Render is somewhat funny, because it can only get called at top level. -- All other operations are purely functional. doAllOp :: PrimOp -> GMLOp -> Stack -> IO Stack @@ -286,11 +294,18 @@ newtype Abs a = Abs { runAbs :: Int -> AbsState a } data AbsState a = AbsState a !Int | AbsFail String +instance Functor Abs where + fmap = liftM + +instance Applicative Abs where + pure x = Abs (\ n -> AbsState x n) + (<*>) = ap + instance Monad Abs where (Abs fn) >>= k = Abs (\ s -> case fn s of AbsState r s' -> runAbs (k r) s' AbsFail m -> AbsFail m) - return x = Abs (\ n -> AbsState x n) + return = pure fail s = Abs (\ n -> AbsFail s) instance MonadEval Abs where @@ -325,7 +340,7 @@ mainEval prog = do { stk <- eval (State emptyEnv [] prog) } -} -done = "Items still on stack at (successfull) termination of program" +done = "Items still on stack at (successful) termination of program" ------------------------------------------------------------------------------ -- testing diff --git a/tests/raytrace/test.T b/tests/raytrace/test.T index 882fce2..a65423c 100644 --- a/tests/raytrace/test.T +++ b/tests/raytrace/test.T @@ -2,8 +2,15 @@ setTestOpts([omit_ways(['ghci']), when(fast(), skip)]) hpc_prefix = "perl ../hpcrun.pl --clear --exeext={exeext} --hpc={hpc}" -test('hpc_raytrace', \ - [ when(fast(), skip), cmd_prefix(hpc_prefix), reqlib('parsec') ], \ - multimod_compile_and_run, \ - ['Main','-fhpc -package parsec']) +# TODO. It is unclear what the purpose of this test is. It produces lots of +# output, but the expected output file is missing. I (thomie) added +# the ignore_output setup function, just to make the test pass for the +# moment. +# Note that the subdirectory tixs also has a test.T file, and those tests +# depend on some of the files in this directory. +# Also note that testsuite/tests/programs/galois_raytrace has a similar (but +# not the same) copy of this program. +test('hpc_raytrace', + [cmd_prefix(hpc_prefix), reqlib('parsec'), ignore_output], + multimod_compile_and_run, ['Main','-fhpc -package parsec']) From git at git.haskell.org Tue Apr 26 08:49:52 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Apr 2016 08:49:52 +0000 (UTC) Subject: [commit: packages/hpc] master: Testsuite: fixes to run tests in /tmp (#11980) (fbe2b7b) Message-ID: <20160426084952.DB9D43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hpc On branch : master Link : http://git.haskell.org/packages/hpc.git/commitdiff/fbe2b7b9e163daa8fbe3c8f2dddc1132aa4e735f >--------------------------------------------------------------- commit fbe2b7b9e163daa8fbe3c8f2dddc1132aa4e735f Author: Thomas Miedema Date: Mon Apr 25 23:44:53 2016 +0200 Testsuite: fixes to run tests in /tmp (#11980) >--------------------------------------------------------------- fbe2b7b9e163daa8fbe3c8f2dddc1132aa4e735f tests/raytrace/tixs/test.T | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/raytrace/tixs/test.T b/tests/raytrace/tixs/test.T index 4d4a6f0..542734d 100644 --- a/tests/raytrace/tixs/test.T +++ b/tests/raytrace/tixs/test.T @@ -8,13 +8,13 @@ test('hpc_report_multi_003', normal, run_command, ["{hpc} report hpc_sample --include=Geometry --per-module --decl-list"]) test('hpc_markup_multi_001', extra_clean(['markup_multi_001/*']), run_command, - ["{hpc} markup --srcdir=.. --hpcdir=tixs/.hpc --destdir=markup_multi_001" + ["{hpc} markup --srcdir=.. --hpcdir=tixs/.hpc --hpcdir=hpc_markup_multi_001/.hpc --destdir=markup_multi_001" " hpc_sample --include=Geometry"]) test('hpc_markup_multi_002', extra_clean(['markup_multi_002/*']), run_command, - ["{hpc} markup --srcdir=.. --hpcdir=tixs/.hpc --destdir=markup_multi_002" + ["{hpc} markup --srcdir=.. --hpcdir=tixs/.hpc --hpcdir=hpc_markup_multi_002/.hpc --destdir=markup_multi_002" " hpc_sample --exclude=Geometry"]) test('hpc_markup_multi_003', extra_clean(['markup_multi_003/*']), run_command, - ["{hpc} markup --srcdir=.. --hpcdir=tixs/.hpc --destdir=markup_multi_003" + ["{hpc} markup --srcdir=.. --hpcdir=tixs/.hpc --hpcdir=hpc_markup_multi_003/.hpc --destdir=markup_multi_003" " hpc_sample --fun-entry-count"]) test('hpc_show_multi_001', normal, run_command, From git at git.haskell.org Tue Apr 26 08:50:10 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Apr 2016 08:50:10 +0000 (UTC) Subject: [commit: ghc] master: Testsuite: Delete test for deprecated "packedstring" (e8c04d4) Message-ID: <20160426085010.027053A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e8c04d4ca5c78c6b68dab840ea53af42eee99364/ghc >--------------------------------------------------------------- commit e8c04d4ca5c78c6b68dab840ea53af42eee99364 Author: Thomas Miedema Date: Mon Apr 25 14:55:38 2016 +0200 Testsuite: Delete test for deprecated "packedstring" >--------------------------------------------------------------- e8c04d4ca5c78c6b68dab840ea53af42eee99364 libraries/base/tests/all.T | 2 -- libraries/base/tests/packedstring001.hs | 11 ----------- libraries/base/tests/packedstring001.stdout | 1 - 3 files changed, 14 deletions(-) diff --git a/libraries/base/tests/all.T b/libraries/base/tests/all.T index 4ca3cda..fc97666 100644 --- a/libraries/base/tests/all.T +++ b/libraries/base/tests/all.T @@ -103,8 +103,6 @@ test('memo002', extra_clean(['Memo2.hi', 'Memo2.o'])], multimod_compile_and_run, ['memo002','']) -test('packedstring001', reqlib('packedstring'), compile_and_run, ['-package packedstring']) - test('stableptr001', [when(fast(), skip), extra_run_opts('+RTS -K8m -RTS')], compile_and_run, ['']) diff --git a/libraries/base/tests/packedstring001.hs b/libraries/base/tests/packedstring001.hs deleted file mode 100644 index 9ee24e2..0000000 --- a/libraries/base/tests/packedstring001.hs +++ /dev/null @@ -1,11 +0,0 @@ - -module Main (main) where - -import Char (isSpace) -import Data.PackedString - --- Bug in PackedString.lhs (fixed in rev 1.5) - -foo = packString "this is a test" -main = print (filterPS (not.isSpace) foo) - diff --git a/libraries/base/tests/packedstring001.stdout b/libraries/base/tests/packedstring001.stdout deleted file mode 100644 index fbd5abc..0000000 --- a/libraries/base/tests/packedstring001.stdout +++ /dev/null @@ -1 +0,0 @@ -"thisisatest" From git at git.haskell.org Tue Apr 26 08:50:13 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Apr 2016 08:50:13 +0000 (UTC) Subject: [commit: ghc] master: Testsuite: fixup lots of tests (dadf82d) Message-ID: <20160426085013.516DE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/dadf82d61f3cced61e9ccc35a5219e0b32cfee9e/ghc >--------------------------------------------------------------- commit dadf82d61f3cced61e9ccc35a5219e0b32cfee9e Author: Thomas Miedema Date: Mon Apr 25 16:58:34 2016 +0200 Testsuite: fixup lots of tests These aren't run very often, because they require external libraries. https://ghc.haskell.org/trac/ghc/wiki/Building/RunningTests/Running#AdditionalPackages maessen-hashtab still doesn't compile, QuickCheck api changed. Update submodule hpc. >--------------------------------------------------------------- dadf82d61f3cced61e9ccc35a5219e0b32cfee9e libraries/base/tests/Concurrent/Chan001.hs | 2 +- libraries/base/tests/Concurrent/Chan001.stdout | 6 +-- libraries/base/tests/Concurrent/MVar001.hs | 2 +- libraries/base/tests/Concurrent/MVar001.stdout | 12 ++--- libraries/hpc | 2 +- testsuite/tests/codeGen/should_run/all.T | 2 +- testsuite/tests/codeGen/should_run/cgrun025.hs | 12 +++-- testsuite/tests/codeGen/should_run/cgrun025.stderr | 12 +++-- testsuite/tests/deriving/should_run/T3087.hs | 2 +- .../tests/indexed-types/should_compile/T3787.hs | 11 +++- .../should_compile/T3787.stderr} | 2 +- testsuite/tests/module/T1074.hs | 1 + testsuite/tests/module/T1074.stderr | 6 +-- testsuite/tests/module/mod133.hs | 14 +++-- testsuite/tests/programs/galois_raytrace/Eval.hs | 19 ++++++- .../tests/programs/maessen-hashtab/HashTest.hs | 9 +--- testsuite/tests/rebindable/DoParamM.stderr | 62 +++++++++++----------- testsuite/tests/typecheck/should_compile/tc232.hs | 2 +- 18 files changed, 104 insertions(+), 74 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc dadf82d61f3cced61e9ccc35a5219e0b32cfee9e From git at git.haskell.org Tue Apr 26 08:50:15 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Apr 2016 08:50:15 +0000 (UTC) Subject: [commit: ghc] master: Testsuite: delete Roles9.stderr (2a83713) Message-ID: <20160426085015.F08E93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2a8371352cbd96d511e73b7a0e6f0e03c4ce7b07/ghc >--------------------------------------------------------------- commit 2a8371352cbd96d511e73b7a0e6f0e03c4ce7b07 Author: Thomas Miedema Date: Mon Apr 25 17:03:20 2016 +0200 Testsuite: delete Roles9.stderr In 99cd277c181dfb346d5f2d5fc9475379229037d0, goldfire deleted the Roles9 test, but not its stderr file. >--------------------------------------------------------------- 2a8371352cbd96d511e73b7a0e6f0e03c4ce7b07 testsuite/tests/roles/should_fail/Roles9.stderr | 7 ------- 1 file changed, 7 deletions(-) diff --git a/testsuite/tests/roles/should_fail/Roles9.stderr b/testsuite/tests/roles/should_fail/Roles9.stderr deleted file mode 100644 index e9f824b..0000000 --- a/testsuite/tests/roles/should_fail/Roles9.stderr +++ /dev/null @@ -1,7 +0,0 @@ - -Roles9.hs:13:12: - Can't make a derived instance of ?C Age? - (even with cunning newtype deriving): - it is not type-safe to use GeneralizedNewtypeDeriving on this class; - the last parameter of ?C? is at role Nominal - In the newtype declaration for ?Age? From git at git.haskell.org Tue Apr 26 08:50:18 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Apr 2016 08:50:18 +0000 (UTC) Subject: [commit: ghc] master: Testsuite: delete unused concurrent/prog002/FileIO.hs (fd5212f) Message-ID: <20160426085018.A4D683A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fd5212fdc26686a85085333af57903a59be809c6/ghc >--------------------------------------------------------------- commit fd5212fdc26686a85085333af57903a59be809c6 Author: Thomas Miedema Date: Mon Apr 25 17:54:51 2016 +0200 Testsuite: delete unused concurrent/prog002/FileIO.hs >--------------------------------------------------------------- fd5212fdc26686a85085333af57903a59be809c6 testsuite/tests/concurrent/prog002/FileIO.hs | 9 --------- 1 file changed, 9 deletions(-) diff --git a/testsuite/tests/concurrent/prog002/FileIO.hs b/testsuite/tests/concurrent/prog002/FileIO.hs deleted file mode 100644 index bf97712..0000000 --- a/testsuite/tests/concurrent/prog002/FileIO.hs +++ /dev/null @@ -1,9 +0,0 @@ -module FileIO where -import System.IO -import Foreign -import Foreign.C - - -foreign import ccall safe "fileio.h c_file_getresult" - c_file_getresult :: CInt -> IO CInt - From git at git.haskell.org Tue Apr 26 13:37:42 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Apr 2016 13:37:42 +0000 (UTC) Subject: [commit: ghc] master: Kill varSetElemsWellScoped in quantifyTyVars (c9bcaf3) Message-ID: <20160426133742.131613A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c9bcaf3165586ac214fa694e61c55eb45eb131ab/ghc >--------------------------------------------------------------- commit c9bcaf3165586ac214fa694e61c55eb45eb131ab Author: Bartosz Nitka Date: Tue Apr 26 05:58:24 2016 -0700 Kill varSetElemsWellScoped in quantifyTyVars varSetElemsWellScoped introduces unnecessary non-determinism in inferred type signatures. Removing this instance required changing the representation of TcDepVars to use deterministic sets. This is the last occurence of varSetElemsWellScoped, allowing me to finally remove it. Test Plan: ./validate I will update the expected outputs when commiting, some reordering of type variables in types is expected. Reviewers: goldfire, simonpj, austin, bgamari Reviewed By: simonpj Subscribers: thomie, simonmar Differential Revision: https://phabricator.haskell.org/D2135 GHC Trac Issues: #4012 >--------------------------------------------------------------- c9bcaf3165586ac214fa694e61c55eb45eb131ab compiler/basicTypes/VarSet.hs | 11 +++- compiler/typecheck/TcHsType.hs | 2 +- compiler/typecheck/TcMType.hs | 44 +++++++++---- compiler/typecheck/TcSimplify.hs | 39 ++++++++++-- compiler/typecheck/TcType.hs | 46 +++++++++----- compiler/types/Type.hs | 13 ++-- compiler/types/Type.hs-boot | 4 +- compiler/utils/UniqDFM.hs | 12 +++- compiler/utils/UniqDSet.hs | 8 ++- compiler/utils/UniqFM.hs | 5 +- testsuite/tests/ado/ado004.stderr | 16 ++--- .../tests/dependent/should_fail/T11334b.stderr | 6 +- testsuite/tests/driver/werror.stderr | 2 +- testsuite/tests/gadt/gadt13.stderr | 12 ++-- testsuite/tests/gadt/gadt7.stderr | 18 +++--- .../tests/ghci.debugger/scripts/break026.stdout | 20 +++--- testsuite/tests/ghci/scripts/T11524a.stdout | 2 +- testsuite/tests/ghci/scripts/T6018ghcifail.stderr | 6 +- testsuite/tests/ghci/scripts/T7587.stdout | 2 +- testsuite/tests/ghci/scripts/T7730.stdout | 4 +- testsuite/tests/ghci/scripts/T7939.stdout | 4 +- testsuite/tests/ghci/scripts/T8776.stdout | 2 +- .../indexed-types/should_compile/T3017.stderr | 2 +- .../indexed-types/should_compile/T8889.stderr | 2 +- .../tests/indexed-types/should_fail/T7354.stderr | 8 +-- .../tests/indexed-types/should_fail/T8518.stderr | 8 +-- testsuite/tests/module/mod71.stderr | 10 +-- testsuite/tests/module/mod72.stderr | 2 +- .../tests/parser/should_compile/read014.stderr | 2 +- .../tests/parser/should_fail/readFail003.stderr | 6 +- .../should_compile/ExtraConstraints3.stderr | 72 +++++++++++----------- .../partial-sigs/should_compile/NamedTyVar.stderr | 4 +- .../partial-sigs/should_compile/SkipMany.stderr | 2 +- .../partial-sigs/should_compile/T10438.stderr | 4 +- .../should_compile/UncurryNamed.stderr | 2 +- .../WarningWildcardInstantiations.stderr | 30 ++++----- .../tests/partial-sigs/should_fail/T10045.stderr | 12 ++-- .../should_fail/WildcardInstantiations.stderr | 28 ++++----- .../tests/patsyn/should_compile/T11213.stderr | 2 +- testsuite/tests/polykinds/T7438.stderr | 16 ++--- testsuite/tests/polykinds/T7524.stderr | 2 +- testsuite/tests/rename/should_fail/T2993.stderr | 2 +- .../tests/typecheck/should_compile/T10971a.stderr | 2 +- .../tests/typecheck/should_compile/tc141.stderr | 6 +- .../tests/typecheck/should_compile/tc168.stderr | 2 +- .../tests/typecheck/should_compile/tc231.stderr | 2 +- testsuite/tests/typecheck/should_fail/T5853.stderr | 24 ++++---- .../tests/typecheck/should_fail/T6018fail.stderr | 6 +- .../typecheck/should_fail/T6018failclosed.stderr | 6 +- testsuite/tests/typecheck/should_fail/T7453.stderr | 18 +++--- testsuite/tests/typecheck/should_fail/T7734.stderr | 12 ++-- testsuite/tests/typecheck/should_fail/T8142.stderr | 2 +- testsuite/tests/typecheck/should_fail/T9109.stderr | 12 ++-- .../tests/typecheck/should_fail/tcfail004.stderr | 6 +- .../tests/typecheck/should_fail/tcfail033.stderr | 8 +-- .../tests/typecheck/should_fail/tcfail049.stderr | 2 +- .../tests/typecheck/should_fail/tcfail050.stderr | 2 +- .../tests/typecheck/should_fail/tcfail140.stderr | 4 +- .../tests/typecheck/should_fail/tcfail198.stderr | 8 +-- 59 files changed, 355 insertions(+), 261 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc c9bcaf3165586ac214fa694e61c55eb45eb131ab From git at git.haskell.org Tue Apr 26 14:48:35 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Apr 2016 14:48:35 +0000 (UTC) Subject: [commit: ghc] branch 'wip/no-telescope-tvs' created Message-ID: <20160426144835.89E5A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/no-telescope-tvs Referencing: ea7d650633f73a97b6fa1206a59120a29aa88bbe From git at git.haskell.org Tue Apr 26 14:48:38 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Apr 2016 14:48:38 +0000 (UTC) Subject: [commit: ghc] wip/no-telescope-tvs: Remove the incredibly hairy splitTelescopeTvs. (ea7d650) Message-ID: <20160426144838.7B22D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/no-telescope-tvs Link : http://ghc.haskell.org/trac/ghc/changeset/ea7d650633f73a97b6fa1206a59120a29aa88bbe/ghc >--------------------------------------------------------------- commit ea7d650633f73a97b6fa1206a59120a29aa88bbe Author: Richard Eisenberg Date: Tue Apr 26 10:50:33 2016 -0400 Remove the incredibly hairy splitTelescopeTvs. This patch removes splitTelescopeTvs by adding information about scoped type variables to TcTyCon. Vast simplification! >--------------------------------------------------------------- ea7d650633f73a97b6fa1206a59120a29aa88bbe compiler/typecheck/TcHsType.hs | 343 ++++++------------------------------- compiler/typecheck/TcMType.hs | 10 +- compiler/typecheck/TcTyClsDecls.hs | 92 +++++----- compiler/types/TyCon.hs | 55 +++++- 4 files changed, 155 insertions(+), 345 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc ea7d650633f73a97b6fa1206a59120a29aa88bbe From git at git.haskell.org Tue Apr 26 14:58:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Apr 2016 14:58:03 +0000 (UTC) Subject: [commit: ghc] master: GHCi: use real time instead of CPU time for :set -s (95f9334) Message-ID: <20160426145803.4E3CB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/95f9334aeeebc8708ed89a5d985b6be3e8a3f1da/ghc >--------------------------------------------------------------- commit 95f9334aeeebc8708ed89a5d985b6be3e8a3f1da Author: Simon Marlow Date: Fri Apr 15 16:21:56 2016 -0700 GHCi: use real time instead of CPU time for :set -s CPU time is never very accurate, and it broke completely with -fexternal-interpreter which runs the interpreted computations in a separate process. >--------------------------------------------------------------- 95f9334aeeebc8708ed89a5d985b6be3e8a3f1da ghc/GHCi/UI/Monad.hs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ghc/GHCi/UI/Monad.hs b/ghc/GHCi/UI/Monad.hs index 824bba1..306fa21 100644 --- a/ghc/GHCi/UI/Monad.hs +++ b/ghc/GHCi/UI/Monad.hs @@ -48,7 +48,7 @@ import Exception import Numeric import Data.Array import Data.IORef -import System.CPUTime +import Data.Time import System.Environment import System.IO import Control.Monad @@ -348,18 +348,18 @@ timeIt getAllocs action = do b <- lift $ isOptionSet ShowTiming if not b then action - else do time1 <- liftIO $ getCPUTime + else do time1 <- liftIO $ getCurrentTime a <- action let allocs = getAllocs a - time2 <- liftIO $ getCPUTime + time2 <- liftIO $ getCurrentTime dflags <- getDynFlags - liftIO $ printTimes dflags allocs (time2 - time1) + let period = time2 `diffUTCTime` time1 + liftIO $ printTimes dflags allocs (realToFrac period) return a -printTimes :: DynFlags -> Maybe Integer -> Integer -> IO () -printTimes dflags mallocs psecs - = do let secs = (fromIntegral psecs / (10^(12::Integer))) :: Float - secs_str = showFFloat (Just 2) secs +printTimes :: DynFlags -> Maybe Integer -> Double -> IO () +printTimes dflags mallocs secs + = do let secs_str = showFFloat (Just 2) secs putStrLn (showSDoc dflags ( parens (text (secs_str "") <+> text "secs" <> comma <+> case mallocs of From git at git.haskell.org Tue Apr 26 14:58:05 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Apr 2016 14:58:05 +0000 (UTC) Subject: [commit: ghc] master: Use __builtin_clz() to implement log_2() (24864ba) Message-ID: <20160426145805.ED0193A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/24864ba5587c1a0447beabae90529e8bb4fa117a/ghc >--------------------------------------------------------------- commit 24864ba5587c1a0447beabae90529e8bb4fa117a Author: Simon Marlow Date: Sat Apr 23 22:14:43 2016 +0100 Use __builtin_clz() to implement log_2() A microoptimisation in the block allocator. >--------------------------------------------------------------- 24864ba5587c1a0447beabae90529e8bb4fa117a rts/sm/BlockAlloc.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/rts/sm/BlockAlloc.c b/rts/sm/BlockAlloc.c index a633726..1c83de9 100644 --- a/rts/sm/BlockAlloc.c +++ b/rts/sm/BlockAlloc.c @@ -199,31 +199,41 @@ initGroup(bdescr *head) } } -// There are quicker non-loopy ways to do log_2, but we expect n to be -// usually small, and MAX_FREE_LIST is also small, so the loop version -// might well be the best choice here. +// log base 2 (floor), needs to support up to 2^MAX_FREE_LIST STATIC_INLINE nat -log_2_ceil(W_ n) +log_2(W_ n) { +#if defined(__GNUC__) + return __builtin_clzl(n) ^ (sizeof(StgWord)*8 - 1); + // generates good code on x86. __builtin_clz() compiles to bsr+xor, but + // we want just bsr, so the xor here cancels out gcc's xor. +#else W_ i, x; - x = 1; + x = n; for (i=0; i < MAX_FREE_LIST; i++) { - if (x >= n) return i; - x = x << 1; + x = x >> 1; + if (x == 0) return i; } return MAX_FREE_LIST; +#endif } +// log base 2 (ceiling), needs to support up to 2^MAX_FREE_LIST STATIC_INLINE nat -log_2(W_ n) +log_2_ceil(W_ n) { +#if defined(__GNUC__) + nat r = log_2(n); + return (n & (n-1)) ? r+1 : r; +#else W_ i, x; - x = n; + x = 1; for (i=0; i < MAX_FREE_LIST; i++) { - x = x >> 1; - if (x == 0) return i; + if (x >= n) return i; + x = x << 1; } return MAX_FREE_LIST; +#endif } STATIC_INLINE void From git at git.haskell.org Tue Apr 26 14:58:08 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Apr 2016 14:58:08 +0000 (UTC) Subject: [commit: ghc] master: RTS: Add setInCallCapability() (e68195a) Message-ID: <20160426145808.9E3963A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e68195a96529cf1cc2d9cc6a9bc05183fce5ecea/ghc >--------------------------------------------------------------- commit e68195a96529cf1cc2d9cc6a9bc05183fce5ecea Author: Simon Marlow Date: Tue Nov 18 15:44:14 2014 +0000 RTS: Add setInCallCapability() This allows an OS thread to specify which capability it should run on when it makes a call into Haskell. It is intended for a fairly specialised use case, when the client wants to have tighter control over the mapping between OS threads and Capabilities - perhaps 1:1 correspondence, for example. >--------------------------------------------------------------- e68195a96529cf1cc2d9cc6a9bc05183fce5ecea includes/RtsAPI.h | 9 +++++++++ rts/Capability.c | 33 +++++++++++++++++++-------------- rts/Task.c | 9 +++++++++ rts/Task.h | 3 +++ 4 files changed, 40 insertions(+), 14 deletions(-) diff --git a/includes/RtsAPI.h b/includes/RtsAPI.h index 4748060..16b8486 100644 --- a/includes/RtsAPI.h +++ b/includes/RtsAPI.h @@ -172,6 +172,15 @@ void rts_unlock (Capability *token); // when there is no current capability. Capability *rts_unsafeGetMyCapability (void); +// Specify the Capability that the current OS thread should run on when it calls +// into Haskell. The actual capability will be calculated as the supplied +// value modulo the number of enabled Capabilities. +// +// Note that the thread may still be migrated by the RTS scheduler, but that +// will only happen if there are multiple threads running on one Capability and +// another Capability is free. +void setInCallCapability (int preferred_capability); + /* ---------------------------------------------------------------------------- Building Haskell objects from C datatypes. ------------------------------------------------------------------------- */ diff --git a/rts/Capability.c b/rts/Capability.c index a2078e5..355f36d 100644 --- a/rts/Capability.c +++ b/rts/Capability.c @@ -709,21 +709,26 @@ void waitForCapability (Capability **pCap, Task *task) Capability *cap = *pCap; if (cap == NULL) { - // Try last_free_capability first - cap = last_free_capability; - if (cap->running_task) { - nat i; - // otherwise, search for a free capability - cap = NULL; - for (i = 0; i < n_capabilities; i++) { - if (!capabilities[i]->running_task) { - cap = capabilities[i]; - break; + if (task->preferred_capability != -1) { + cap = capabilities[task->preferred_capability % + enabled_capabilities]; + } else { + // Try last_free_capability first + cap = last_free_capability; + if (cap->running_task) { + nat i; + // otherwise, search for a free capability + cap = NULL; + for (i = 0; i < n_capabilities; i++) { + if (!capabilities[i]->running_task) { + cap = capabilities[i]; + break; + } + } + if (cap == NULL) { + // Can't find a free one, use last_free_capability. + cap = last_free_capability; } - } - if (cap == NULL) { - // Can't find a free one, use last_free_capability. - cap = last_free_capability; } } diff --git a/rts/Task.c b/rts/Task.c index 82f7780..c30bcf1 100644 --- a/rts/Task.c +++ b/rts/Task.c @@ -213,6 +213,7 @@ newTask (rtsBool worker) task->n_spare_incalls = 0; task->spare_incalls = NULL; task->incall = NULL; + task->preferred_capability = -1; #if defined(THREADED_RTS) initCondition(&task->cond); @@ -488,6 +489,14 @@ interruptWorkerTask (Task *task) #endif /* THREADED_RTS */ +void +setInCallCapability (int preferred_capability) +{ + Task *task = allocTask(); + task->preferred_capability = preferred_capability; +} + + #ifdef DEBUG void printAllTasks(void); diff --git a/rts/Task.h b/rts/Task.h index 37832a3..bcf456d 100644 --- a/rts/Task.h +++ b/rts/Task.h @@ -151,6 +151,9 @@ typedef struct Task_ { // So that we can detect when a finalizer illegally calls back into Haskell rtsBool running_finalizers; + // if >= 0, this Capability will be used for in-calls + int preferred_capability; + // Links tasks on the returning_tasks queue of a Capability, and // on spare_workers. struct Task_ *next; From git at git.haskell.org Tue Apr 26 14:58:11 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Apr 2016 14:58:11 +0000 (UTC) Subject: [commit: ghc] master: Just comments & reformatting (0712f55) Message-ID: <20160426145811.4F4C83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0712f55628f22c61b0c7cedf71588d14156e6635/ghc >--------------------------------------------------------------- commit 0712f55628f22c61b0c7cedf71588d14156e6635 Author: Simon Marlow Date: Sun Apr 24 21:14:43 2016 +0100 Just comments & reformatting >--------------------------------------------------------------- 0712f55628f22c61b0c7cedf71588d14156e6635 rts/sm/Storage.h | 56 +++++++++++++++++++++----------------------------------- 1 file changed, 21 insertions(+), 35 deletions(-) diff --git a/rts/sm/Storage.h b/rts/sm/Storage.h index 3dd3ec0..6c6daab 100644 --- a/rts/sm/Storage.h +++ b/rts/sm/Storage.h @@ -2,7 +2,7 @@ * * (c) The GHC Team, 1998-2009 * - * External Storage Manger Interface + * Storage Manger Interface * * ---------------------------------------------------------------------------*/ @@ -26,34 +26,20 @@ void freeStorage(rtsBool free_heap); void storageAddCapabilities (nat from, nat to); /* ----------------------------------------------------------------------------- - Storage manager state + Should we GC? -------------------------------------------------------------------------- */ -INLINE_HEADER rtsBool -doYouWantToGC( Capability *cap ) +INLINE_HEADER +rtsBool doYouWantToGC(Capability *cap) { - return (cap->r.rCurrentNursery->link == NULL || - g0->n_new_large_words >= large_alloc_lim); + return (cap->r.rCurrentNursery->link == NULL || + g0->n_new_large_words >= large_alloc_lim); } -/* for splitting blocks groups in two */ -bdescr * splitLargeBlock (bdescr *bd, W_ blocks); - /* ----------------------------------------------------------------------------- - Generational garbage collection support - - updateWithIndirection(p1,p2) Updates the object at p1 with an - indirection pointing to p2. This is - normally called for objects in an old - generation (>0) when they are updated. - - updateWithPermIndirection(p1,p2) As above but uses a permanent indir. - + The storage manager mutex -------------------------------------------------------------------------- */ -/* - * Storage manager mutex - */ #if defined(THREADED_RTS) extern Mutex sm_mutex; #endif @@ -82,12 +68,12 @@ void dirty_TVAR(Capability *cap, StgTVar *p); extern nursery *nurseries; extern nat n_nurseries; -void resetNurseries ( void ); -void clearNursery ( Capability *cap ); -void resizeNurseries ( W_ blocks ); -void resizeNurseriesFixed ( void ); -W_ countNurseryBlocks ( void ); -rtsBool getNewNursery ( Capability *cap ); +void resetNurseries (void); +void clearNursery (Capability *cap); +void resizeNurseries (StgWord blocks); +void resizeNurseriesFixed (void); +StgWord countNurseryBlocks (void); +rtsBool getNewNursery (Capability *cap); /* ----------------------------------------------------------------------------- Allocation accounting @@ -114,15 +100,15 @@ StgWord calcTotalAllocated (void); Stats 'n' DEBUG stuff -------------------------------------------------------------------------- */ -W_ countLargeAllocated (void); -W_ countOccupied (bdescr *bd); -W_ calcNeeded (rtsBool force_major, W_ *blocks_needed); +StgWord countLargeAllocated (void); +StgWord countOccupied (bdescr *bd); +StgWord calcNeeded (rtsBool force_major, StgWord *blocks_needed); -W_ gcThreadLiveWords (nat i, nat g); -W_ gcThreadLiveBlocks (nat i, nat g); +StgWord gcThreadLiveWords (nat i, nat g); +StgWord gcThreadLiveBlocks (nat i, nat g); -W_ genLiveWords (generation *gen); -W_ genLiveBlocks (generation *gen); +StgWord genLiveWords (generation *gen); +StgWord genLiveBlocks (generation *gen); /* ---------------------------------------------------------------------------- Storage manager internal APIs and globals @@ -130,7 +116,7 @@ W_ genLiveBlocks (generation *gen); extern bdescr *exec_block; -void move_STACK (StgStack *src, StgStack *dest); +void move_STACK (StgStack *src, StgStack *dest); /* ----------------------------------------------------------------------------- Note [STATIC_LINK fields] From git at git.haskell.org Tue Apr 26 14:58:14 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Apr 2016 14:58:14 +0000 (UTC) Subject: [commit: ghc] master: Doc improvement for ApplicativeDo (d396996) Message-ID: <20160426145814.08CAF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d396996298939f647c22b547bc01f1b00e6e2fd9/ghc >--------------------------------------------------------------- commit d396996298939f647c22b547bc01f1b00e6e2fd9 Author: Simon Marlow Date: Fri Apr 15 16:24:59 2016 -0700 Doc improvement for ApplicativeDo Make it clearer that the final statement should be exactly "(return|pure) E". >--------------------------------------------------------------- d396996298939f647c22b547bc01f1b00e6e2fd9 docs/users_guide/glasgow_exts.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index b88cf44..ef66140 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -943,6 +943,11 @@ then the expression will only require ``Applicative``. Otherwise, the expression will require ``Monad``. The block may return a pure expression ``E`` depending upon the results ``p1...pn`` with either ``return`` or ``pure``. +Note: the final statement really must be of the form ``return E`` or +``pure E``, otherwise you get a ``Monad`` constraint. In particular, +``return $ E`` is not of the form ``return E``, and will therefore +incur a ``Monad`` constraint. + When the statements of a ``do`` expression have dependencies between them, and ``ApplicativeDo`` cannot infer an ``Applicative`` type, it uses a heuristic algorithm to try to use ``<*>`` as much as possible. From git at git.haskell.org Tue Apr 26 15:45:29 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Apr 2016 15:45:29 +0000 (UTC) Subject: [commit: ghc] master: Kill varSetElems in TcErrors (2dc5b92) Message-ID: <20160426154529.DB8183A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2dc5b92e070132114ea1a37f5bd82ab905ff7889/ghc >--------------------------------------------------------------- commit 2dc5b92e070132114ea1a37f5bd82ab905ff7889 Author: Bartosz Nitka Date: Tue Apr 26 08:47:21 2016 -0700 Kill varSetElems in TcErrors The uses of varSetElems in these places are unnecessary and while it doesn't intruduce non-determinism in the ABI the plan is to get rid of all varSetElems to get some compile time guarantees. Test Plan: ./validate Reviewers: austin, simonmar, bgamari, goldfire, simonpj Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2141 GHC Trac Issues: #4012 >--------------------------------------------------------------- 2dc5b92e070132114ea1a37f5bd82ab905ff7889 compiler/typecheck/TcErrors.hs | 14 ++++----- .../tests/dependent/should_fail/T11407.stderr | 2 +- .../tests/indexed-types/should_fail/T2693.stderr | 8 ++--- testsuite/tests/typecheck/should_fail/T4921.stderr | 34 +++++++++++----------- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/compiler/typecheck/TcErrors.hs b/compiler/typecheck/TcErrors.hs index 7d64d7e..f23a75b 100644 --- a/compiler/typecheck/TcErrors.hs +++ b/compiler/typecheck/TcErrors.hs @@ -52,6 +52,7 @@ import StaticFlags ( opt_PprStyle_Debug ) import ListSetOps ( equivClasses ) import Maybes import qualified GHC.LanguageExtensions as LangExt +import FV ( fvVarList, unionFV ) import Control.Monad ( when ) import Data.List ( partition, mapAccumL, nub, sortBy ) @@ -177,7 +178,7 @@ report_unsolved mb_binds_var err_as_warn type_errors expr_holes type_holes wante free_tvs = tyCoVarsOfWC wanted ; traceTc "reportUnsolved (after zonking and tidying):" $ - vcat [ pprTvBndrs (varSetElems free_tvs) + vcat [ pprVarSet pprTvBndrs free_tvs , ppr wanted ] ; warn_redundant <- woptM Opt_WarnRedundantConstraints @@ -1337,8 +1338,8 @@ mkTyVarEqErr dflags ctxt report ct oriented tv1 ty2 interesting_tyvars = filter (not . isEmptyVarSet . tyCoVarsOfType . tyVarKind) $ filter isTyVar $ - varSetElems $ - tyCoVarsOfType ty1 `unionVarSet` tyCoVarsOfType ty2 + fvVarList $ + tyCoFVsOfType ty1 `unionFV` tyCoFVsOfType ty2 extra3 = relevant_bindings $ ppWhen (not (null interesting_tyvars)) $ hang (text "Type variable kinds:") 2 $ @@ -2457,10 +2458,9 @@ getAmbigTkvs :: Ct -> ([Var],[Var]) getAmbigTkvs ct = partition (`elemVarSet` dep_tkv_set) ambig_tkvs where - tkv_set = tyCoVarsOfCt ct - ambig_tkv_set = filterVarSet isAmbiguousTyVar tkv_set - dep_tkv_set = tyCoVarsOfTypes (map tyVarKind (varSetElems tkv_set)) - ambig_tkvs = varSetElems ambig_tkv_set + tkvs = tyCoVarsOfCtList ct + ambig_tkvs = filter isAmbiguousTyVar tkvs + dep_tkv_set = tyCoVarsOfTypes (map tyVarKind tkvs) getSkolemInfo :: [Implication] -> TcTyVar -> ([TcTyVar], SkolemInfo) -- Get the skolem info for a type variable diff --git a/testsuite/tests/dependent/should_fail/T11407.stderr b/testsuite/tests/dependent/should_fail/T11407.stderr index b5d95bf..b07aa2b 100644 --- a/testsuite/tests/dependent/should_fail/T11407.stderr +++ b/testsuite/tests/dependent/should_fail/T11407.stderr @@ -4,5 +4,5 @@ T11407.hs:10:40: error: ? In the second argument of ?UhOh?, namely ?(a :: x a)? In the data instance declaration for ?UhOh? ? Type variable kinds: - a :: k0 x :: k0 -> * + a :: k0 diff --git a/testsuite/tests/indexed-types/should_fail/T2693.stderr b/testsuite/tests/indexed-types/should_fail/T2693.stderr index 0c00711..a0ac4ea 100644 --- a/testsuite/tests/indexed-types/should_fail/T2693.stderr +++ b/testsuite/tests/indexed-types/should_fail/T2693.stderr @@ -1,7 +1,7 @@ T2693.hs:12:15: error: ? Couldn't match expected type ?(a8, b1)? with actual type ?TFn a6? - The type variables ?b1?, ?a6?, ?a8? are ambiguous + The type variables ?a6?, ?a8?, ?b1? are ambiguous ? In the first argument of ?fst?, namely ?x? In the first argument of ?(+)?, namely ?fst x? In the expression: fst x + fst x @@ -9,7 +9,7 @@ T2693.hs:12:15: error: T2693.hs:12:23: error: ? Couldn't match expected type ?(a8, b2)? with actual type ?TFn a7? - The type variables ?b2?, ?a7?, ?a8? are ambiguous + The type variables ?a7?, ?a8?, ?b2? are ambiguous ? In the first argument of ?fst?, namely ?x? In the second argument of ?(+)?, namely ?fst x? In the expression: fst x + fst x @@ -17,7 +17,7 @@ T2693.hs:12:23: error: T2693.hs:19:15: error: ? Couldn't match expected type ?(a5, b0)? with actual type ?TFn a2? - The type variables ?b0?, ?a2?, ?a5? are ambiguous + The type variables ?a2?, ?a5?, ?b0? are ambiguous ? In the first argument of ?fst?, namely ?x? In the first argument of ?(+)?, namely ?fst x? In the expression: fst x + snd x @@ -25,7 +25,7 @@ T2693.hs:19:15: error: T2693.hs:19:23: error: ? Couldn't match expected type ?(a3, a5)? with actual type ?TFn a4? - The type variables ?a3?, ?a4?, ?a5? are ambiguous + The type variables ?a4?, ?a3?, ?a5? are ambiguous ? In the first argument of ?snd?, namely ?x? In the second argument of ?(+)?, namely ?snd x? In the expression: fst x + snd x diff --git a/testsuite/tests/typecheck/should_fail/T4921.stderr b/testsuite/tests/typecheck/should_fail/T4921.stderr index 42d5a8a..8eff919 100644 --- a/testsuite/tests/typecheck/should_fail/T4921.stderr +++ b/testsuite/tests/typecheck/should_fail/T4921.stderr @@ -1,21 +1,21 @@ T4921.hs:10:9: error: - Ambiguous type variables ?b1?, ?a0? arising from a use of ?f? - prevents the constraint ?(C a0 b1)? from being solved. - Relevant bindings include x :: a0 (bound at T4921.hs:10:1) - Probable fix: use a type annotation to specify what ?b1?, ?a0? should be. - These potential instance exist: - instance C Int Char -- Defined at T4921.hs:7:10 - In the first argument of ?fst?, namely ?f? - In the expression: fst f - In an equation for ?x?: x = fst f + ? Ambiguous type variables ?a0?, ?b1? arising from a use of ?f? + prevents the constraint ?(C a0 b1)? from being solved. + Relevant bindings include x :: a0 (bound at T4921.hs:10:1) + Probable fix: use a type annotation to specify what ?a0?, ?b1? should be. + These potential instance exist: + instance C Int Char -- Defined at T4921.hs:7:10 + ? In the first argument of ?fst?, namely ?f? + In the expression: fst f + In an equation for ?x?: x = fst f T4921.hs:12:9: error: - Ambiguous type variable ?b0? arising from a use of ?f? - prevents the constraint ?(C Int b0)? from being solved. - Probable fix: use a type annotation to specify what ?b0? should be. - These potential instance exist: - instance C Int Char -- Defined at T4921.hs:7:10 - In the first argument of ?fst?, namely ?f? - In the expression: fst f :: Int - In an equation for ?y?: y = fst f :: Int + ? Ambiguous type variable ?b0? arising from a use of ?f? + prevents the constraint ?(C Int b0)? from being solved. + Probable fix: use a type annotation to specify what ?b0? should be. + These potential instance exist: + instance C Int Char -- Defined at T4921.hs:7:10 + ? In the first argument of ?fst?, namely ?f? + In the expression: fst f :: Int + In an equation for ?y?: y = fst f :: Int From git at git.haskell.org Tue Apr 26 16:02:59 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Apr 2016 16:02:59 +0000 (UTC) Subject: [commit: ghc] wip/no-telescope-tvs: Fix #11821 by bringing only unzonked vars into scope. (93b9a7d) Message-ID: <20160426160259.C7F763A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/no-telescope-tvs Link : http://ghc.haskell.org/trac/ghc/changeset/93b9a7ddd4156168b46f4b83d3d6469c5d246da5/ghc >--------------------------------------------------------------- commit 93b9a7ddd4156168b46f4b83d3d6469c5d246da5 Author: Richard Eisenberg Date: Tue Apr 26 12:05:13 2016 -0400 Fix #11821 by bringing only unzonked vars into scope. >--------------------------------------------------------------- 93b9a7ddd4156168b46f4b83d3d6469c5d246da5 compiler/typecheck/TcHsType.hs | 13 ++++++++----- compiler/typecheck/TcTyClsDecls.hs | 3 ++- testsuite/tests/polykinds/T11821.hs | 31 +++++++++++++++++++++++++++++++ testsuite/tests/polykinds/all.T | 1 + 4 files changed, 42 insertions(+), 6 deletions(-) diff --git a/compiler/typecheck/TcHsType.hs b/compiler/typecheck/TcHsType.hs index e27872f..a9d6efe 100644 --- a/compiler/typecheck/TcHsType.hs +++ b/compiler/typecheck/TcHsType.hs @@ -1572,15 +1572,18 @@ tcTyClTyVars tycon_name thing_inside = do { tycon <- kcLookupTcTyCon tycon_name -- See Note [Free-floating kind vars] - ; all_scoped_tvs <- mapM zonkTcTyVarToTyVar $ - tcTyConScopedTyVars tycon - ; let (still_sig_tvs, good_tvs) = partition isSigTyVar all_scoped_tvs - ; checkNoErrs $ mapM_ (report_floating_kv all_scoped_tvs) still_sig_tvs + ; let scoped_tvs = tcTyConScopedTyVars tycon + ; zonked_scoped_tvs <- mapM zonkTcTyVarToTyVar scoped_tvs + ; let still_sig_tvs = filter isSigTyVar zonked_scoped_tvs + ; checkNoErrs $ mapM_ (report_floating_kv scoped_tvs) still_sig_tvs ; let tkvs = tyConTyVars tycon binders = tyConBinders tycon res_kind = tyConResKind tycon - ; tcExtendTyVarEnv good_tvs $ + + -- Add the *unzonked* tyvars to the env't, because those + -- are the ones mentioned in the source. + ; tcExtendTyVarEnv scoped_tvs $ thing_inside tkvs binders res_kind } where report_floating_kv all_tvs kv diff --git a/compiler/typecheck/TcTyClsDecls.hs b/compiler/typecheck/TcTyClsDecls.hs index 1ea8d41..c7b26f4 100644 --- a/compiler/typecheck/TcTyClsDecls.hs +++ b/compiler/typecheck/TcTyClsDecls.hs @@ -357,7 +357,8 @@ kcTyClGroup decls -- Make sure kc_kind' has the final, zonked kind variables ; traceTc "Generalise kind" $ vcat [ ppr name, ppr kc_binders, ppr kc_res_kind - , ppr kvs, ppr kc_binders', ppr kc_res_kind' ] + , ppr kvs, ppr kc_binders', ppr kc_res_kind' + , ppr (tcTyConScopedTyVars tc)] ; return (mkTcTyCon name (kvs ++ kc_tyvars) (mkNamedBinders Invisible kvs ++ kc_binders') diff --git a/testsuite/tests/polykinds/T11821.hs b/testsuite/tests/polykinds/T11821.hs new file mode 100644 index 0000000..82efeb5 --- /dev/null +++ b/testsuite/tests/polykinds/T11821.hs @@ -0,0 +1,31 @@ +{-# LANGUAGE RankNTypes, DataKinds, PolyKinds, GADTs, TypeFamilies, UndecidableInstances #-} +module NotInScope where + +import Data.Proxy + +type KindOf (a :: k) = ('KProxy :: KProxy k) +data TyFun :: * -> * -> * +type family Apply (f :: TyFun k1 k2 -> *) (x :: k1) :: k2 + +data Lgo2 l1 + l2 + l3 + (l4 :: b) + (l5 :: TyFun [a] b) + = forall (arg :: [a]) . KindOf (Apply (Lgo2 l1 l2 l3 l4) arg) ~ KindOf (Lgo l1 l2 l3 l4 arg) => + Lgo2KindInference + +data Lgo1 l1 + l2 + l3 + (l4 :: TyFun b (TyFun [a] b -> *)) + = forall (arg :: b) . KindOf (Apply (Lgo1 l1 l2 l3) arg) ~ KindOf (Lgo2 l1 l2 l3 arg) => + Lgo1KindInference + +type family Lgo f + z0 + xs0 + (a1 :: b) + (a2 :: [a]) :: b where + Lgo f z0 xs0 z '[] = z + Lgo f z0 xs0 z ('(:) x xs) = Apply (Apply (Lgo1 f z0 xs0) (Apply (Apply f z) x)) xs diff --git a/testsuite/tests/polykinds/all.T b/testsuite/tests/polykinds/all.T index 17d0211..f2e274b 100644 --- a/testsuite/tests/polykinds/all.T +++ b/testsuite/tests/polykinds/all.T @@ -146,3 +146,4 @@ test('T11611', normal, compile_fail, ['']) test('T11648', normal, compile, ['']) test('T11648b', normal, compile_fail, ['']) test('KindVType', normal, compile_fail, ['']) +test('T11821', normal, compile, ['']) From git at git.haskell.org Tue Apr 26 16:30:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Apr 2016 16:30:23 +0000 (UTC) Subject: [commit: ghc] wip/no-telescope-tvs: Remove the incredibly hairy splitTelescopeTvs. (c41cf12) Message-ID: <20160426163023.AA5793A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/no-telescope-tvs Link : http://ghc.haskell.org/trac/ghc/changeset/c41cf12341c55706adf72d377193a08a54f09885/ghc >--------------------------------------------------------------- commit c41cf12341c55706adf72d377193a08a54f09885 Author: Richard Eisenberg Date: Tue Apr 26 10:50:33 2016 -0400 Remove the incredibly hairy splitTelescopeTvs. This patch removes splitTelescopeTvs by adding information about scoped type variables to TcTyCon. Vast simplification! This also fixes #11821 by bringing only unzonked vars into scope. >--------------------------------------------------------------- c41cf12341c55706adf72d377193a08a54f09885 compiler/typecheck/TcHsType.hs | 363 +++++++----------------------- compiler/typecheck/TcMType.hs | 10 +- compiler/typecheck/TcTyClsDecls.hs | 95 ++++---- compiler/types/TyCon.hs | 63 +++++- testsuite/tests/ghci/scripts/T7873.stderr | 1 + testsuite/tests/polykinds/T11821.hs | 31 +++ testsuite/tests/polykinds/all.T | 1 + 7 files changed, 217 insertions(+), 347 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc c41cf12341c55706adf72d377193a08a54f09885 From git at git.haskell.org Tue Apr 26 16:49:32 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Apr 2016 16:49:32 +0000 (UTC) Subject: [commit: ghc] master: Kill varSetElems try_tyvar_defaulting (94320e1) Message-ID: <20160426164932.2CB7B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/94320e1d34d14017cc9b38226ea78205a0a76a2b/ghc >--------------------------------------------------------------- commit 94320e1d34d14017cc9b38226ea78205a0a76a2b Author: Bartosz Nitka Date: Tue Apr 26 09:51:26 2016 -0700 Kill varSetElems try_tyvar_defaulting `varSetElems` introduces unnecessary nondeterminism and we can do the same thing deterministically for the same price. Test Plan: ./validate Reviewers: goldfire, austin, simonmar, bgamari, simonpj Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2143 GHC Trac Issues: #4012 >--------------------------------------------------------------- 94320e1d34d14017cc9b38226ea78205a0a76a2b compiler/typecheck/TcMType.hs | 7 +++++++ compiler/typecheck/TcRnTypes.hs | 37 +++++++++++++++++++++++++++---------- compiler/typecheck/TcSMonad.hs | 4 ++++ compiler/typecheck/TcSimplify.hs | 5 ++--- 4 files changed, 40 insertions(+), 13 deletions(-) diff --git a/compiler/typecheck/TcMType.hs b/compiler/typecheck/TcMType.hs index 222a2e2..c2b3f02 100644 --- a/compiler/typecheck/TcMType.hs +++ b/compiler/typecheck/TcMType.hs @@ -68,6 +68,7 @@ module TcMType ( tidyEvVar, tidyCt, tidySkolemInfo, skolemiseUnboundMetaTyVar, zonkTcTyVar, zonkTcTyVars, zonkTyCoVarsAndFV, zonkTcTypeAndFV, + zonkTyCoVarsAndFVList, zonkTcTypeAndSplitDepVars, zonkTcTypesAndSplitDepVars, zonkQuantifiedTyVar, zonkQuantifiedTyVarOrType, quantifyTyVars, quantifyZonkedTyVars, @@ -1219,6 +1220,12 @@ zonkTyCoVar tv | isTcTyVar tv = zonkTcTyVar tv zonkTyCoVarsAndFV :: TyCoVarSet -> TcM TyCoVarSet zonkTyCoVarsAndFV tycovars = tyCoVarsOfTypes <$> mapM zonkTyCoVar (varSetElems tycovars) +-- Takes a list of TyCoVars, zonks them and returns a +-- deterministically ordered list of their free variables. +zonkTyCoVarsAndFVList :: [TyCoVar] -> TcM [TyCoVar] +zonkTyCoVarsAndFVList tycovars = + tyCoVarsOfTypesList <$> mapM zonkTyCoVar tycovars + -- Takes a deterministic set of TyCoVars, zonks them and returns a -- deterministic set of their free variables. -- See Note [quantifyTyVars determinism]. diff --git a/compiler/typecheck/TcRnTypes.hs b/compiler/typecheck/TcRnTypes.hs index 4887626..f3aef11 100644 --- a/compiler/typecheck/TcRnTypes.hs +++ b/compiler/typecheck/TcRnTypes.hs @@ -85,6 +85,7 @@ module TcRnTypes( andWC, unionsWC, mkSimpleWC, mkImplicWC, addInsols, addSimples, addImplics, tyCoVarsOfWC, dropDerivedWC, dropDerivedSimples, dropDerivedInsols, + tyCoVarsOfWCList, isDroppableDerivedLoc, insolubleImplic, arisesFromGivens, @@ -1612,22 +1613,38 @@ tyCoVarsOfCtsList = fvVarList . tyCoFVsOfCts tyCoFVsOfCts :: Cts -> FV tyCoFVsOfCts = foldrBag (unionFV . tyCoFVsOfCt) emptyFV +-- | Returns free variables of WantedConstraints as a non-deterministic +-- set. See Note [Deterministic FV] in FV. tyCoVarsOfWC :: WantedConstraints -> TyCoVarSet -- Only called on *zonked* things, hence no need to worry about flatten-skolems -tyCoVarsOfWC (WC { wc_simple = simple, wc_impl = implic, wc_insol = insol }) - = tyCoVarsOfCts simple `unionVarSet` - tyCoVarsOfBag tyCoVarsOfImplic implic `unionVarSet` - tyCoVarsOfCts insol +tyCoVarsOfWC = fvVarSet . tyCoFVsOfWC + +-- | Returns free variables of WantedConstraints as a deterministically +-- ordered list. See Note [Deterministic FV] in FV. +tyCoVarsOfWCList :: WantedConstraints -> [TyCoVar] +-- Only called on *zonked* things, hence no need to worry about flatten-skolems +tyCoVarsOfWCList = fvVarList . tyCoFVsOfWC -tyCoVarsOfImplic :: Implication -> TyCoVarSet +-- | Returns free variables of WantedConstraints as a composable FV +-- computation. See Note [Deterministic FV] in FV. +tyCoFVsOfWC :: WantedConstraints -> FV +-- Only called on *zonked* things, hence no need to worry about flatten-skolems +tyCoFVsOfWC (WC { wc_simple = simple, wc_impl = implic, wc_insol = insol }) + = tyCoFVsOfCts simple `unionFV` + tyCoFVsOfBag tyCoFVsOfImplic implic `unionFV` + tyCoFVsOfCts insol + +-- | Returns free variables of Implication as a composable FV computation. +-- See Note [Deterministic FV] in FV. +tyCoFVsOfImplic :: Implication -> FV -- Only called on *zonked* things, hence no need to worry about flatten-skolems -tyCoVarsOfImplic (Implic { ic_skols = skols +tyCoFVsOfImplic (Implic { ic_skols = skols , ic_given = givens, ic_wanted = wanted }) - = (tyCoVarsOfWC wanted `unionVarSet` tyCoVarsOfTypes (map evVarPred givens)) - `delVarSetList` skols + = FV.delFVs (mkVarSet skols) + (tyCoFVsOfWC wanted `unionFV` tyCoFVsOfTypes (map evVarPred givens)) -tyCoVarsOfBag :: (a -> TyCoVarSet) -> Bag a -> TyCoVarSet -tyCoVarsOfBag tvs_of = foldrBag (unionVarSet . tvs_of) emptyVarSet +tyCoFVsOfBag :: (a -> FV) -> Bag a -> FV +tyCoFVsOfBag tvs_of = foldrBag (unionFV . tvs_of) emptyFV -------------------------- dropDerivedSimples :: Cts -> Cts diff --git a/compiler/typecheck/TcSMonad.hs b/compiler/typecheck/TcSMonad.hs index 303fee8..65595c6 100644 --- a/compiler/typecheck/TcSMonad.hs +++ b/compiler/typecheck/TcSMonad.hs @@ -93,6 +93,7 @@ module TcSMonad ( TcLevel, isTouchableMetaTyVarTcS, isFilledMetaTyVar_maybe, isFilledMetaTyVar, zonkTyCoVarsAndFV, zonkTcType, zonkTcTypes, zonkTcTyVar, zonkCo, + zonkTyCoVarsAndFVList, zonkSimples, zonkWC, -- References @@ -2762,6 +2763,9 @@ isFilledMetaTyVar tv = wrapTcS (TcM.isFilledMetaTyVar tv) zonkTyCoVarsAndFV :: TcTyCoVarSet -> TcS TcTyCoVarSet zonkTyCoVarsAndFV tvs = wrapTcS (TcM.zonkTyCoVarsAndFV tvs) +zonkTyCoVarsAndFVList :: [TcTyCoVar] -> TcS [TcTyCoVar] +zonkTyCoVarsAndFVList tvs = wrapTcS (TcM.zonkTyCoVarsAndFVList tvs) + zonkCo :: Coercion -> TcS Coercion zonkCo = wrapTcS . TcM.zonkCo diff --git a/compiler/typecheck/TcSimplify.hs b/compiler/typecheck/TcSimplify.hs index 4fce9de..58ed3ca 100644 --- a/compiler/typecheck/TcSimplify.hs +++ b/compiler/typecheck/TcSimplify.hs @@ -122,9 +122,8 @@ simpl_top wanteds | isEmptyWC wc = return wc | otherwise - = do { free_tvs <- TcS.zonkTyCoVarsAndFV (tyCoVarsOfWC wc) - ; let meta_tvs = varSetElems $ - filterVarSet (isTyVar <&&> isMetaTyVar) free_tvs + = do { free_tvs <- TcS.zonkTyCoVarsAndFVList (tyCoVarsOfWCList wc) + ; let meta_tvs = filter (isTyVar <&&> isMetaTyVar) free_tvs -- zonkTyCoVarsAndFV: the wc_first_go is not yet zonked -- filter isMetaTyVar: we might have runtime-skolems in GHCi, -- and we definitely don't want to try to assign to those! From git at git.haskell.org Tue Apr 26 19:59:27 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Apr 2016 19:59:27 +0000 (UTC) Subject: [commit: ghc] wip/no-telescope-tvs: Remove the incredibly hairy splitTelescopeTvs. (4713a2b) Message-ID: <20160426195927.1DE723A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/no-telescope-tvs Link : http://ghc.haskell.org/trac/ghc/changeset/4713a2b04571cec8518986adc354360e77bdb257/ghc >--------------------------------------------------------------- commit 4713a2b04571cec8518986adc354360e77bdb257 Author: Richard Eisenberg Date: Tue Apr 26 10:50:33 2016 -0400 Remove the incredibly hairy splitTelescopeTvs. This patch removes splitTelescopeTvs by adding information about scoped type variables to TcTyCon. Vast simplification! This also fixes #11821 by bringing only unzonked vars into scope. Test case: polykinds/T11821 >--------------------------------------------------------------- 4713a2b04571cec8518986adc354360e77bdb257 compiler/typecheck/TcHsType.hs | 411 ++++++++---------------------- compiler/typecheck/TcMType.hs | 10 +- compiler/typecheck/TcTyClsDecls.hs | 106 ++++---- compiler/typecheck/TcValidity.hs | 1 - compiler/types/TyCon.hs | 63 ++++- testsuite/tests/ghci/scripts/T7873.stderr | 9 +- testsuite/tests/polykinds/T11821.hs | 31 +++ testsuite/tests/polykinds/all.T | 1 + 8 files changed, 263 insertions(+), 369 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 4713a2b04571cec8518986adc354360e77bdb257 From git at git.haskell.org Tue Apr 26 19:59:30 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Apr 2016 19:59:30 +0000 (UTC) Subject: [commit: ghc] wip/no-telescope-tvs: Test #11484 in th/T11484 (ebf0d27) Message-ID: <20160426195930.3DEB13A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/no-telescope-tvs Link : http://ghc.haskell.org/trac/ghc/changeset/ebf0d2768da96b85db0ca1f377d992887522cab0/ghc >--------------------------------------------------------------- commit ebf0d2768da96b85db0ca1f377d992887522cab0 Author: Richard Eisenberg Date: Tue Apr 26 14:07:08 2016 -0400 Test #11484 in th/T11484 >--------------------------------------------------------------- ebf0d2768da96b85db0ca1f377d992887522cab0 testsuite/tests/th/T11484.hs | 9 +++++++++ testsuite/tests/th/all.T | 1 + 2 files changed, 10 insertions(+) diff --git a/testsuite/tests/th/T11484.hs b/testsuite/tests/th/T11484.hs new file mode 100644 index 0000000..d8c0708 --- /dev/null +++ b/testsuite/tests/th/T11484.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE TypeInType #-} + +module T11484 where + +import Data.Kind + +type TySyn (k :: *) (a :: k) = () + +$([d| type TySyn2 (k :: *) (a :: k) = () |]) diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index 09960d1..a69f8a7 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -404,3 +404,4 @@ test('T11680', normal, compile_fail, ['-v0']) test('T11809', normal, compile, ['-v0']) test('T11797', normal, compile, ['-v0 -dsuppress-uniques']) test('T11941', normal, compile_fail, ['-v0']) +test('T11484', normal, compile, ['-v0']) From git at git.haskell.org Tue Apr 26 20:01:36 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 26 Apr 2016 20:01:36 +0000 (UTC) Subject: [commit: ghc] master: Kill varSetElems in markNominal (f13a8d2) Message-ID: <20160426200136.6871A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f13a8d219fbb16ece2bede66ac47f8599a86d3e2/ghc >--------------------------------------------------------------- commit f13a8d219fbb16ece2bede66ac47f8599a86d3e2 Author: Bartosz Nitka Date: Tue Apr 26 13:04:08 2016 -0700 Kill varSetElems in markNominal varSetElems introduces unnecessary nondeterminism and it was straighforward to just get a deterministic list. Test Plan: ./validate Reviewers: austin, goldfire, bgamari, simonmar, simonpj Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2145 GHC Trac Issues: #4012 >--------------------------------------------------------------- f13a8d219fbb16ece2bede66ac47f8599a86d3e2 compiler/typecheck/TcTyDecls.hs | 21 +++++++++++---------- compiler/types/TyCoRep.hs | 2 +- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/compiler/typecheck/TcTyDecls.hs b/compiler/typecheck/TcTyDecls.hs index 6579b5f..bbfccc5 100644 --- a/compiler/typecheck/TcTyDecls.hs +++ b/compiler/typecheck/TcTyDecls.hs @@ -29,7 +29,7 @@ import TcRnMonad import TcEnv import TcBinds( tcRecSelBinds ) import RnEnv( RoleAnnotEnv, lookupRoleAnnot ) -import TyCoRep( Type(..), TyBinder(..), delBinderVar ) +import TyCoRep( Type(..), TyBinder(..), delBinderVarFV ) import TcType import TysWiredIn( unitTy ) import MkCore( rEC_SEL_ERROR_ID ) @@ -59,6 +59,7 @@ import Maybes import Data.List import Bag import FastString +import FV import Control.Monad @@ -703,21 +704,21 @@ irExTyVars orig_tvs thing = go emptyVarSet orig_tvs markNominal :: TyVarSet -- local variables -> Type -> RoleM () -markNominal lcls ty = let nvars = get_ty_vars ty `minusVarSet` lcls in - mapM_ (updateRole Nominal) (varSetElems nvars) +markNominal lcls ty = let nvars = fvVarList (FV.delFVs lcls $ get_ty_vars ty) in + mapM_ (updateRole Nominal) nvars where -- get_ty_vars gets all the tyvars (no covars!) from a type *without* -- recurring into coercions. Recall: coercions are totally ignored during -- role inference. See [Coercions in role inference] - get_ty_vars (TyVarTy tv) = unitVarSet tv - get_ty_vars (AppTy t1 t2) = get_ty_vars t1 `unionVarSet` get_ty_vars t2 - get_ty_vars (TyConApp _ tys) = foldr (unionVarSet . get_ty_vars) emptyVarSet tys + get_ty_vars (TyVarTy tv) = FV.unitFV tv + get_ty_vars (AppTy t1 t2) = get_ty_vars t1 `unionFV` get_ty_vars t2 + get_ty_vars (TyConApp _ tys) = mapUnionFV get_ty_vars tys get_ty_vars (ForAllTy bndr ty) - = get_ty_vars ty `delBinderVar` bndr - `unionVarSet` (tyCoVarsOfType $ binderType bndr) - get_ty_vars (LitTy {}) = emptyVarSet + = delBinderVarFV bndr (get_ty_vars ty) + `unionFV` (tyCoFVsOfType $ binderType bndr) + get_ty_vars (LitTy {}) = emptyFV get_ty_vars (CastTy ty _) = get_ty_vars ty - get_ty_vars (CoercionTy _) = emptyVarSet + get_ty_vars (CoercionTy _) = emptyFV -- like lookupRoles, but with Nominal tags at the end for oversaturated TyConApps lookupRolesX :: TyCon -> RoleM [Role] diff --git a/compiler/types/TyCoRep.hs b/compiler/types/TyCoRep.hs index b1aad56..118fd95 100644 --- a/compiler/types/TyCoRep.hs +++ b/compiler/types/TyCoRep.hs @@ -45,7 +45,7 @@ module TyCoRep ( -- * Functions over binders binderType, delBinderVar, isInvisibleBinder, isVisibleBinder, - isNamedBinder, isAnonBinder, + isNamedBinder, isAnonBinder, delBinderVarFV, -- * Functions over coercions pickLR, From git at git.haskell.org Wed Apr 27 13:40:55 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 27 Apr 2016 13:40:55 +0000 (UTC) Subject: [commit: ghc] wip/D2128: Implement the state hack without modifiyng OneShotInfo (a48ebcc) Message-ID: <20160427134055.39ABA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/D2128 Link : http://ghc.haskell.org/trac/ghc/changeset/a48ebcc42ad0b9ef69a295495c4f631fe9d55922/ghc >--------------------------------------------------------------- commit a48ebcc42ad0b9ef69a295495c4f631fe9d55922 Author: Joachim Breitner Date: Wed Apr 20 10:46:41 2016 +0200 Implement the state hack without modifiyng OneShotInfo Previously, the state hack would be implemented in mkLocalId, by looking at the type, and setting the OneShot flag accordingly. This patch changes this so that the OneShot flag faithfully represents what our various analyses found out, and the State Hack is implemented by adjusting the accessors, in particular isOneShotBndr and idStateHackOneShotInfo. This makes it easier to understand what's going on in the analyses, and de-clutters core dumps and interface files. I don?t expect any change in behaviour, at least not in non-fringe cases. >--------------------------------------------------------------- a48ebcc42ad0b9ef69a295495c4f631fe9d55922 compiler/basicTypes/Id.hs | 32 ++++++++++++++++---------------- compiler/coreSyn/CoreArity.hs | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/compiler/basicTypes/Id.hs b/compiler/basicTypes/Id.hs index d5b7898..b589809 100644 --- a/compiler/basicTypes/Id.hs +++ b/compiler/basicTypes/Id.hs @@ -74,7 +74,7 @@ module Id ( idInlineActivation, setInlineActivation, idRuleMatchInfo, -- ** One-shot lambdas - isOneShotBndr, isOneShotLambda, isProbablyOneShotLambda, + isOneShotBndr, isProbablyOneShotLambda, setOneShotLambda, clearOneShotLambda, updOneShotInfo, setIdOneShotInfo, isStateHackType, stateHackOneShot, typeOneShot, @@ -85,7 +85,7 @@ module Id ( idUnfolding, realIdUnfolding, idSpecialisation, idCoreRules, idHasRules, idCafInfo, - idOneShotInfo, + idOneShotInfo, idStateHackOneShotInfo, idOccInfo, -- ** Writing 'IdInfo' fields @@ -250,8 +250,7 @@ mkVanillaGlobalWithInfo = mkGlobalId VanillaId -- | For an explanation of global vs. local 'Id's, see "Var#globalvslocal" mkLocalId :: Name -> Type -> Id -mkLocalId name ty = mkLocalIdWithInfo name ty - (vanillaIdInfo `setOneShotInfo` typeOneShot ty) +mkLocalId name ty = mkLocalIdWithInfo name ty vanillaIdInfo -- It's tempting to ASSERT( not (isCoercionType ty) ), but don't. Sometimes, -- the type is a panic. (Search invented_id) @@ -259,7 +258,7 @@ mkLocalId name ty = mkLocalIdWithInfo name ty mkLocalCoVar :: Name -> Type -> CoVar mkLocalCoVar name ty = ASSERT( isCoercionType ty ) - Var.mkLocalVar CoVarId name ty (vanillaIdInfo `setOneShotInfo` typeOneShot ty) + Var.mkLocalVar CoVarId name ty vanillaIdInfo -- | Like 'mkLocalId', but checks the type to see if it should make a covar mkLocalIdOrCoVar :: Name -> Type -> Id @@ -687,14 +686,23 @@ isConLikeId id = isDataConWorkId id || isConLike (idRuleMatchInfo id) idOneShotInfo :: Id -> OneShotInfo idOneShotInfo id = oneShotInfo (idInfo id) +-- | Like 'idOneShotInfo', but taking the Horrible State Hack in to account +-- See Note [The state-transformer hack] in CoreArity +idStateHackOneShotInfo :: Id -> OneShotInfo +idStateHackOneShotInfo id + | isStateHackType (idType id) = stateHackOneShot + | otherwise = idOneShotInfo id + -- | Returns whether the lambda associated with the 'Id' is certainly applied at most once -- This one is the "business end", called externally. -- It works on type variables as well as Ids, returning True -- Its main purpose is to encapsulate the Horrible State Hack +-- See Note [The state-transformer hack] in CoreArity isOneShotBndr :: Var -> Bool isOneShotBndr var - | isTyVar var = True - | otherwise = isOneShotLambda var + | isTyVar var = True + | OneShotLam <- idStateHackOneShotInfo var = True + | otherwise = False -- | Should we apply the state hack to values of this 'Type'? stateHackOneShot :: OneShotInfo @@ -731,16 +739,8 @@ isStateHackType ty -- Another good example is in fill_in in PrelPack.hs. We should be able to -- spot that fill_in has arity 2 (and when Keith is done, we will) but we can't yet. - --- | Returns whether the lambda associated with the 'Id' is certainly applied at most once. --- You probably want to use 'isOneShotBndr' instead -isOneShotLambda :: Id -> Bool -isOneShotLambda id = case idOneShotInfo id of - OneShotLam -> True - _ -> False - isProbablyOneShotLambda :: Id -> Bool -isProbablyOneShotLambda id = case idOneShotInfo id of +isProbablyOneShotLambda id = case idStateHackOneShotInfo id of OneShotLam -> True ProbOneShot -> True NoOneShotInfo -> False diff --git a/compiler/coreSyn/CoreArity.hs b/compiler/coreSyn/CoreArity.hs index cf6cd98..59c261b 100644 --- a/compiler/coreSyn/CoreArity.hs +++ b/compiler/coreSyn/CoreArity.hs @@ -633,7 +633,7 @@ when saturated" so we don't want to be too gung-ho about saturating! -} arityLam :: Id -> ArityType -> ArityType -arityLam id (ATop as) = ATop (idOneShotInfo id : as) +arityLam id (ATop as) = ATop (idStateHackOneShotInfo id : as) arityLam _ (ABot n) = ABot (n+1) floatIn :: Bool -> ArityType -> ArityType From git at git.haskell.org Wed Apr 27 13:40:57 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 27 Apr 2016 13:40:57 +0000 (UTC) Subject: [commit: ghc] wip/D2128's head updated: Implement the state hack without modifiyng OneShotInfo (a48ebcc) Message-ID: <20160427134057.B455B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/D2128' now includes: 7f71dbe Bump haddock submodule 81aa3d1 Reduce use of instances in hs-boot files 871f684 Define NameSet.intersectFVs 7319b80 Tighten up imports, white space 353d8ae SCC analysis for instances as well as types/classes 61191de Fix two buglets in 17eb241 noticed by Richard cdcf014 Tighten up imports on TcTyClsDecls 687c778 Kill unnecessary varSetElemsWellScoped in deriveTyData 62943d2 Build a correct substitution in dataConInstPat 55b1b85 Accept tcrun045 output 2e33320 Rename FV related functions 98a14ff Point to note about FV eta-expansion performance 7c6585a Remove mysterious varSetElemsWellScoped in tidyFreeTyCoVars 8c33cd4 testsuite: Bump max bytes used of T4029 f02af79 Improve the behaviour of warnIf edf54d7 Do not use defaulting in ambiguity check 9421b0c Warn about simplifiable class constraints 251a376 Test Trac #3990 26a1804 wibble to simplifiable 24d3276 A little more debug tracing c2b7a3d Avoid double error on out-of-scope identifier 970ff58 Simplify defaultKindVar and friends 6ad2b42 Refactor free tyvars on LHS of rules ed4a228 Fix typos: alpah -> alpha 4221cc2 Typo: veraibles -> variables a9076fc Remove unused tyCoVarsOfTelescope 0f96686 Make benign non-determinism in pretty-printing more obvious 03006f5 Get rid of varSetElemsWellScoped in abstractFloats 28503fe deriveConstants: Fix nm-classic error message e8c04d4 Testsuite: Delete test for deprecated "packedstring" dadf82d Testsuite: fixup lots of tests 2a83713 Testsuite: delete Roles9.stderr fd5212f Testsuite: delete unused concurrent/prog002/FileIO.hs c9bcaf3 Kill varSetElemsWellScoped in quantifyTyVars e68195a RTS: Add setInCallCapability() 95f9334 GHCi: use real time instead of CPU time for :set -s d396996 Doc improvement for ApplicativeDo 24864ba Use __builtin_clz() to implement log_2() 0712f55 Just comments & reformatting 2dc5b92 Kill varSetElems in TcErrors 94320e1 Kill varSetElems try_tyvar_defaulting f13a8d2 Kill varSetElems in markNominal a48ebcc Implement the state hack without modifiyng OneShotInfo From git at git.haskell.org Wed Apr 27 15:28:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 27 Apr 2016 15:28:03 +0000 (UTC) Subject: [commit: ghc] branch 'wip/D2128' deleted Message-ID: <20160427152803.EEDBE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Deleted branch: wip/D2128 From git at git.haskell.org Wed Apr 27 15:28:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 27 Apr 2016 15:28:06 +0000 (UTC) Subject: [commit: ghc] master's head updated: Implement the state hack without modifiyng OneShotInfo (a48ebcc) Message-ID: <20160427152806.481853A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'master' now includes: a48ebcc Implement the state hack without modifiyng OneShotInfo From git at git.haskell.org Wed Apr 27 15:33:57 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 27 Apr 2016 15:33:57 +0000 (UTC) Subject: [commit: ghc] wip/T10613: Rough working implementation of #10613 (b3b95bc) Message-ID: <20160427153357.D69E33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T10613 Link : http://ghc.haskell.org/trac/ghc/changeset/b3b95bcdfa1e71fe4ea094e385d9b0adbcf23e26/ghc >--------------------------------------------------------------- commit b3b95bcdfa1e71fe4ea094e385d9b0adbcf23e26 Author: Joachim Breitner Date: Thu Mar 17 16:33:18 2016 +0100 Rough working implementation of #10613 The COUNTING_IND closure type is based on the (since removed) IND_PERM. Some of the code is rather ad-hoc and likely in need of some refactoring and clean-up before entering master (if it ever should), but it should be good enough to play around with it and obtain some numbers. >--------------------------------------------------------------- b3b95bcdfa1e71fe4ea094e385d9b0adbcf23e26 compiler/cmm/CLabel.hs | 5 ++- compiler/cmm/CmmType.hs | 6 +++ compiler/cmm/SMRep.hs | 11 +++++- compiler/codeGen/StgCmmBind.hs | 76 +++++++++++++++++++++++++++--------- compiler/codeGen/StgCmmClosure.hs | 8 ++++ compiler/codeGen/StgCmmHeap.hs | 20 ++++++++-- compiler/codeGen/StgCmmLayout.hs | 23 ++++++++--- compiler/codeGen/StgCmmTicky.hs | 37 ++++++++++++++++-- compiler/codeGen/StgCmmUtils.hs | 12 +++--- compiler/coreSyn/PprCore.hs | 2 +- compiler/ghci/ByteCodeItbls.hs | 4 +- includes/Cmm.h | 1 + includes/rts/Ticky.h | 9 ++++- includes/rts/storage/ClosureMacros.h | 1 + includes/rts/storage/ClosureTypes.h | 73 +++++++++++++++++----------------- includes/rts/storage/Closures.h | 7 ++++ includes/stg/MiscClosures.h | 1 + rts/CheckUnload.c | 1 + rts/ClosureFlags.c | 3 +- rts/Interpreter.c | 1 + rts/LdvProfile.c | 1 + rts/Printer.c | 10 ++++- rts/ProfHeap.c | 1 + rts/RetainerProfile.c | 6 +-- rts/RtsSymbols.c | 1 + rts/Stable.c | 1 + rts/StgMiscClosures.cmm | 43 ++++++++++++++++++++ rts/Ticky.c | 21 +++++++--- rts/sm/Compact.c | 1 + rts/sm/Evac.c | 8 ++++ rts/sm/GCAux.c | 1 + rts/sm/Sanity.c | 1 + rts/sm/Scav.c | 12 ++++++ utils/deriveConstants/Main.hs | 7 ++++ utils/genapply/Main.hs | 4 +- 35 files changed, 330 insertions(+), 89 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc b3b95bcdfa1e71fe4ea094e385d9b0adbcf23e26 From git at git.haskell.org Wed Apr 27 15:34:00 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 27 Apr 2016 15:34:00 +0000 (UTC) Subject: [commit: ghc] wip/T10613: Temporarily move regular entry counting to the COUNTING_IND (7564755) Message-ID: <20160427153400.84E633A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T10613 Link : http://ghc.haskell.org/trac/ghc/changeset/7564755400092321cc6386defe83d9a1db74823e/ghc >--------------------------------------------------------------- commit 7564755400092321cc6386defe83d9a1db74823e Author: Joachim Breitner Date: Wed Mar 23 14:28:34 2016 +0100 Temporarily move regular entry counting to the COUNTING_IND >--------------------------------------------------------------- 7564755400092321cc6386defe83d9a1db74823e compiler/codeGen/StgCmmBind.hs | 8 ++++++-- rts/StgMiscClosures.cmm | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/compiler/codeGen/StgCmmBind.hs b/compiler/codeGen/StgCmmBind.hs index 5951175..8672273 100644 --- a/compiler/codeGen/StgCmmBind.hs +++ b/compiler/codeGen/StgCmmBind.hs @@ -609,9 +609,13 @@ thunkCode cl_info fv_details _cc node arity body -- Heap overflow check ; entryHeapCheck cl_info node' arity [] $ do - { -- Overwrite with black hole if necessary + { + -- Disabled for now, as we (temporarily unconditionally) move the + -- counting to the counting indirection + -- tickyEnterThunk cl_info + + -- Overwrite with black hole if necessary -- but *after* the heap-overflow check - ; tickyEnterThunk cl_info ; when (blackHoleOnEntry cl_info && node_points) (blackHoleIt node) diff --git a/rts/StgMiscClosures.cmm b/rts/StgMiscClosures.cmm index 96b95aa..0f27fdb 100644 --- a/rts/StgMiscClosures.cmm +++ b/rts/StgMiscClosures.cmm @@ -283,6 +283,7 @@ INFO_TABLE(stg_COUNTING_IND,1,2,COUNTING_IND,"COUNTING_IND","COUNTING_IND") StgEntCounter_multi_entry_count(ent_ctr) = StgEntCounter_multi_entry_count(ent_ctr) + 1; } StgCountingInd_entries(clos) = entries + 1; + StgEntCounter_entry_count(ent_ctr) = StgEntCounter_entry_count(ent_ctr) + 1; #if defined(TICKY_TICKY) && !defined(PROFILING) /* TICKY_TICKY && !PROFILING means PERM_IND *replaces* an IND, rather than From git at git.haskell.org Wed Apr 27 15:34:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 27 Apr 2016 15:34:03 +0000 (UTC) Subject: [commit: ghc] wip/T10613's head updated: Temporarily move regular entry counting to the COUNTING_IND (7564755) Message-ID: <20160427153403.2D85B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/T10613' now includes: 928d747 Kill some unnecessary varSetElems 2acfaae Comments only e24b3b1 Adjust error check for class method types 31e4974 Remove some gratitious varSetElemsWellScoped 8d66765 Increase an InScopeSet for a substitution aaaa61c users-guide: Note change in LLVM support policy 10c6df0 utils: Provide CallStack to expectJust 116088d testsuite: Add T11824 cb0d29b testsuite: Add test for #11827 9d063b6 Linker: Fix signedness mismatch 933abfa rel-notes: Add note about UndecidableSuperClasses and #11762 54e67c1 Remove dead function SimplUtils.countValArgs f0e331b Comments only, on Type.topSortTyVars a7ee2d4 Improve TcFlatten.flattenTyVar e9ad489 libdw: More precise version check d77981e rts/RetainerProfile: Remove unused local bf17fd0 deriveConstants: Verify sanity of nm f4e6591 Bump haddock submodule 865602e Rework CC/CC_STAGE0 handling in `configure.ac` 3f3ad75 Update `directory` submodule to v1.2.6.0 release 4cbae1b Update array submodule to v0.5.1.1 release tag 97f2b16 Add Windows import library support to the Runtime Linker 04b70cd Add TemplateHaskell support for Overlapping pragmas 89b6674 TH: Tweak Haddock language 7a1c073 users-guide: Fix typo 07dc330 validate: Note existence of config_args variable 7005b9f Add flag to control number of missing patterns in warnings 36a0b6d Check CCS tree for pointers into shared object during checkUnload 177aec6 Linker: Clean up #if USE_MMAP usage a392208 Resolve symlinks when attempting to find GHC's lib folder on Windows 93d85af Update `directory` submodule to v1.2.6.1 release dd920e4 Silence unused-import warning introduced by 93d85af9fec968b 8a75bb5 Update haskeline submodule to 0.7.2.3 release 3dac53f Make it easy to get hyperlinked sources 10d808c relnotes: Add note about #11744 and workaround 87114ae Use stdint types to define SIZEOF and ALIGNMENT of INTx/WORDx 32ddd96 Remove obsolete/redundant FLEXIBLE_ARRAY macro 350ffc3 rts: Limit maximum backtrace depth d1ce35d rts: Don't use strndup 8556f56 Update `directory` submodule to v1.2.6.2 release a3c37c3 Remove unused import of emptyNameEnv d59939a Define TyCoRep.ppSuggestExplicitKinds, and use it 17eb241 Refactor computing dependent type vars 8136a5c Tighten checking for associated type instances 9de405d Kill dead TauTvFlavour, and move code around 81e2279 Update hsc2hs submodule 91ee509 Mark GHC.Stack.Types Trustworthy 96e1bb4 Update deepseq submodule to latest 1.4.2.0 snapshot ff290b8 Update binary submodule to 0.8.3.0 release 15b7e87 Update `pretty` submodule to v1.1.3.3 release 81b14c1 Update unix submodule to v2.7.2.0 release 7f71dbe Bump haddock submodule 81aa3d1 Reduce use of instances in hs-boot files 871f684 Define NameSet.intersectFVs 7319b80 Tighten up imports, white space 353d8ae SCC analysis for instances as well as types/classes 61191de Fix two buglets in 17eb241 noticed by Richard cdcf014 Tighten up imports on TcTyClsDecls 687c778 Kill unnecessary varSetElemsWellScoped in deriveTyData 62943d2 Build a correct substitution in dataConInstPat 55b1b85 Accept tcrun045 output 2e33320 Rename FV related functions 98a14ff Point to note about FV eta-expansion performance 7c6585a Remove mysterious varSetElemsWellScoped in tidyFreeTyCoVars 8c33cd4 testsuite: Bump max bytes used of T4029 f02af79 Improve the behaviour of warnIf edf54d7 Do not use defaulting in ambiguity check 9421b0c Warn about simplifiable class constraints 251a376 Test Trac #3990 26a1804 wibble to simplifiable 24d3276 A little more debug tracing c2b7a3d Avoid double error on out-of-scope identifier 970ff58 Simplify defaultKindVar and friends 6ad2b42 Refactor free tyvars on LHS of rules ed4a228 Fix typos: alpah -> alpha 4221cc2 Typo: veraibles -> variables a9076fc Remove unused tyCoVarsOfTelescope 0f96686 Make benign non-determinism in pretty-printing more obvious 03006f5 Get rid of varSetElemsWellScoped in abstractFloats 28503fe deriveConstants: Fix nm-classic error message e8c04d4 Testsuite: Delete test for deprecated "packedstring" dadf82d Testsuite: fixup lots of tests 2a83713 Testsuite: delete Roles9.stderr fd5212f Testsuite: delete unused concurrent/prog002/FileIO.hs c9bcaf3 Kill varSetElemsWellScoped in quantifyTyVars e68195a RTS: Add setInCallCapability() 95f9334 GHCi: use real time instead of CPU time for :set -s d396996 Doc improvement for ApplicativeDo 24864ba Use __builtin_clz() to implement log_2() 0712f55 Just comments & reformatting 2dc5b92 Kill varSetElems in TcErrors 94320e1 Kill varSetElems try_tyvar_defaulting f13a8d2 Kill varSetElems in markNominal a48ebcc Implement the state hack without modifiyng OneShotInfo b3b95bc Rough working implementation of #10613 7564755 Temporarily move regular entry counting to the COUNTING_IND From git at git.haskell.org Thu Apr 28 08:12:01 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Apr 2016 08:12:01 +0000 (UTC) Subject: [commit: ghc] master: Recommend more reliable recourse for broken nm (a0e1051) Message-ID: <20160428081201.8FDBE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a0e10510c64182c7126ff426127ea8fd78c07d00/ghc >--------------------------------------------------------------- commit a0e10510c64182c7126ff426127ea8fd78c07d00 Author: Ben Gamari Date: Thu Apr 28 10:11:13 2016 +0200 Recommend more reliable recourse for broken nm xcrun --find seems like the appropriate choice here. Thanks to Brandon Allbery for suggesting this. >--------------------------------------------------------------- a0e10510c64182c7126ff426127ea8fd78c07d00 docs/users_guide/8.0.1-notes.rst | 3 +-- utils/deriveConstants/Main.hs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/users_guide/8.0.1-notes.rst b/docs/users_guide/8.0.1-notes.rst index 4db68d2..5b10a32 100644 --- a/docs/users_guide/8.0.1-notes.rst +++ b/docs/users_guide/8.0.1-notes.rst @@ -24,8 +24,7 @@ performance improvements over the 7.10 branch. system to use the ``nm-classic`` command instead of Apple's new ``nm`` implementation as the latter breaks POSIX compliance (see :ghc-ticket:`11744`). This can be done by passing something like - ``--with-nm=/Library/Developer/CommandLineTools/usr/bin/nm-classic`` to - ``configure``. + ``--with-nm=$(xcrun --find nm-classic)`` to ``configure``. Highlights ---------- diff --git a/utils/deriveConstants/Main.hs b/utils/deriveConstants/Main.hs index 6a050d3..6cd48d4 100644 --- a/utils/deriveConstants/Main.hs +++ b/utils/deriveConstants/Main.hs @@ -693,7 +693,7 @@ getWanted verbose os tmpdir gccProgram gccFlags nmProgram mobjdumpProgram Just 0x292 -> die $ "broken 'nm' detected, see https://ghc.haskell.org/ticket/11744.\n" ++ "\n" ++ "Workaround: You may want to pass\n" - ++ " --with-nm=$(xcode-select -p)/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm-classic\n" + ++ " --with-nm=$(xcrun --find nm-classic\n" ++ "to 'configure'.\n" Just x -> die ("unexpected value round-tripped for CONTROL_GROUP_CONST_291: " ++ show x) From git at git.haskell.org Thu Apr 28 08:12:04 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Apr 2016 08:12:04 +0000 (UTC) Subject: [commit: ghc] master: Document -fmax-pmcheck-iterations a bit better (5adf8f3) Message-ID: <20160428081204.370883A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5adf8f3b74a4ee11d594b9993493bed4e3521ce2/ghc >--------------------------------------------------------------- commit 5adf8f3b74a4ee11d594b9993493bed4e3521ce2 Author: Ben Gamari Date: Wed Apr 27 09:57:41 2016 +0200 Document -fmax-pmcheck-iterations a bit better >--------------------------------------------------------------- 5adf8f3b74a4ee11d594b9993493bed4e3521ce2 docs/users_guide/8.0.1-notes.rst | 2 +- docs/users_guide/using-warnings.rst | 12 ++++++++++++ utils/mkUserGuidePart/Options/Warnings.hs | 5 +++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/docs/users_guide/8.0.1-notes.rst b/docs/users_guide/8.0.1-notes.rst index 51a9602..4db68d2 100644 --- a/docs/users_guide/8.0.1-notes.rst +++ b/docs/users_guide/8.0.1-notes.rst @@ -352,7 +352,7 @@ Compiler the pattern match checker iterates. Since coverage checking is exponential in the general case, setting a default number of iterations prevents memory and performance blowups. By default, the number of iterations is set to - 10000000 but it can be set to ``n`` with: ``-fmax-pmcheck-iterations=n``. + 2000000 but it can be set with: ``-fmax-pmcheck-iterations=``. If the set number of iterations is exceeded, an informative warning is issued. diff --git a/docs/users_guide/using-warnings.rst b/docs/users_guide/using-warnings.rst index 72e7748..46b6984 100644 --- a/docs/users_guide/using-warnings.rst +++ b/docs/users_guide/using-warnings.rst @@ -516,6 +516,18 @@ of ``-W(no-)*``. h = \[] -> 2 Just k = f y +.. ghc-flag:: -fmax-pmcheck-iterations= + + :default: 2000000 + + Sets how many iterations of the pattern-match checker will perform before + giving up. This limit is to catch cases where pattern-match checking might + be excessively costly (due to the exponential complexity of coverage + checking in the general case). It typically shouldn't be necessary to set + this unless GHC informs you that it has exceeded the pattern match checker's + iteration limit (in which case you may want to consider refactoring your + pattern match, for the sake of future readers of your code. + .. ghc-flag:: -Wincomplete-record-updates .. index:: diff --git a/utils/mkUserGuidePart/Options/Warnings.hs b/utils/mkUserGuidePart/Options/Warnings.hs index 3552172..31513d9 100644 --- a/utils/mkUserGuidePart/Options/Warnings.hs +++ b/utils/mkUserGuidePart/Options/Warnings.hs @@ -117,6 +117,11 @@ warningsOptions = , flagType = DynamicFlag , flagReverse = "-Wno-incomplete-uni-patterns" } + , flag { flagName = "-Wmax-pmcheck-iterations=" + , flagDescription = + "the iteration limit for the pattern match checker" + , flagType = DynamicFlag + } , flag { flagName = "-Wincomplete-record-updates" , flagDescription = "warn when a record update could fail" , flagType = DynamicFlag From git at git.haskell.org Thu Apr 28 10:58:25 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Apr 2016 10:58:25 +0000 (UTC) Subject: [commit: nofib] master: De-tab CmdLine.hs (dfa9f91) Message-ID: <20160428105825.E859A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/nofib On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/dfa9f9158943d2c441add8ccd4309c1b93fb347a/nofib >--------------------------------------------------------------- commit dfa9f9158943d2c441add8ccd4309c1b93fb347a Author: Joachim Breitner Date: Thu Apr 28 13:01:27 2016 +0200 De-tab CmdLine.hs >--------------------------------------------------------------- dfa9f9158943d2c441add8ccd4309c1b93fb347a nofib-analyse/CmdLine.hs | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/nofib-analyse/CmdLine.hs b/nofib-analyse/CmdLine.hs index d65d6ac..415ce4b 100644 --- a/nofib-analyse/CmdLine.hs +++ b/nofib-analyse/CmdLine.hs @@ -13,8 +13,8 @@ module CmdLine where import System.Console.GetOpt -import System.Environment ( getArgs ) -import System.IO.Unsafe ( unsafePerformIO ) +import System.Environment ( getArgs ) +import System.IO.Unsafe ( unsafePerformIO ) ----------------------------------------------------------------------------- -- Command line arguments @@ -31,8 +31,8 @@ default_tooquick_threshold, tooquick_threshold :: Float default_tooquick_threshold = 0.2 {- secs -} tooquick_threshold = case [ i | OptIgnoreSmallTimes i <- flags ] of - [] -> default_tooquick_threshold - (i:_) -> i + [] -> default_tooquick_threshold + (i:_) -> i devs, nodevs :: Bool devs = OptDeviations `elem` flags @@ -69,29 +69,29 @@ usage = usageInfo usageHeader argInfo argInfo :: [ OptDescr CLIFlags ] argInfo = [ Option ['?'] ["help"] (NoArg OptHelp) - "Display this message" + "Display this message" , Option ['a'] ["ascii"] (NoArg OptASCIIOutput) - "Produce ASCII output (default)" + "Produce ASCII output (default)" , Option ['i'] ["ignore"] (ReqArg (OptIgnoreSmallTimes . read) "secs") - "Ignore runtimes smaller than " + "Ignore runtimes smaller than " , Option ['d'] ["deviations"] (NoArg OptDeviations) - "Display deviations (default)" + "Display deviations (default)" , Option ['l'] ["latex"] (OptArg OptLaTeXOutput "TABLE") - "Produce LaTeX output" + "Produce LaTeX output" , Option [] ["columns"] (ReqArg OptColumns "COLUMNS") - "Specify columns for summary table (comma separates)" + "Specify columns for summary table (comma separates)" , Option [] ["rows"] (ReqArg OptRows "ROWS") - "Specify rows for summary table (comma separates)" + "Specify rows for summary table (comma separates)" , Option [] ["csv"] (ReqArg OptCSV "TABLE") - "Output a single table in CSV format" + "Output a single table in CSV format" , Option [] ["normalise"] (ReqArg OptNormalise "percent|ratio|none") - "normalise to the baseline" + "normalise to the baseline" , Option [] ["stddev"] (NoArg OptStdDev) "include standard deviations in CSV output" , Option ['n'] ["nodeviations"] (NoArg OptNoDeviations) - "Hide deviations" + "Hide deviations" , Option ['t'] ["title"] (ReqArg OptTitle "title") - "Specify report title" + "Specify report title" , Option ['b'] ["include-baseline"] (NoArg OptShowBaseline) "Include the baseline column (LaTeX)" ] From git at git.haskell.org Thu Apr 28 10:59:28 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Apr 2016 10:59:28 +0000 (UTC) Subject: [commit: ghc] master: Update nofib submodule to nofib master (57c636f) Message-ID: <20160428105928.69DF33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/57c636fcd9178f7c972f6f0c21233f7e262c8529/ghc >--------------------------------------------------------------- commit 57c636fcd9178f7c972f6f0c21233f7e262c8529 Author: Joachim Breitner Date: Thu Apr 28 12:59:12 2016 +0200 Update nofib submodule to nofib master with changes to nofib-analyse: * up-to-date parsing of output lines with recent GHC under * a few reporting improvements. >--------------------------------------------------------------- 57c636fcd9178f7c972f6f0c21233f7e262c8529 nofib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nofib b/nofib index a599585..dfa9f91 160000 --- a/nofib +++ b/nofib @@ -1 +1 @@ -Subproject commit a5995850221d2808cf3f71965f0e8df0f2908ca1 +Subproject commit dfa9f9158943d2c441add8ccd4309c1b93fb347a From git at git.haskell.org Thu Apr 28 12:34:02 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Apr 2016 12:34:02 +0000 (UTC) Subject: [commit: ghc] master: Expand the comment on pprVarSet (fa3ba06) Message-ID: <20160428123402.433BA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fa3ba060cdc7f469e7f5c4f7503fadfe99937c90/ghc >--------------------------------------------------------------- commit fa3ba060cdc7f469e7f5c4f7503fadfe99937c90 Author: Bartosz Nitka Date: Thu Apr 28 05:35:31 2016 -0700 Expand the comment on pprVarSet >--------------------------------------------------------------- fa3ba060cdc7f469e7f5c4f7503fadfe99937c90 compiler/basicTypes/VarSet.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/compiler/basicTypes/VarSet.hs b/compiler/basicTypes/VarSet.hs index 6021fdf..f61bbbe 100644 --- a/compiler/basicTypes/VarSet.hs +++ b/compiler/basicTypes/VarSet.hs @@ -183,6 +183,11 @@ pluralVarSet = pluralUFM -- shouldn't be a problem. -- Having this function helps contain the non-determinism created with -- varSetElems. +-- Passing a list to the pretty-printing function allows the caller +-- to decide on the order of Vars (eg. toposort them) without them having +-- to use varSetElems at the call site. This prevents from let-binding +-- non-deterministically ordered lists and reusing them where determinism +-- matters. pprVarSet :: ([Var] -> SDoc) -- ^ The pretty printing function to use on the -- elements -> VarSet -- ^ The things to be pretty printed From git at git.haskell.org Thu Apr 28 12:48:08 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Apr 2016 12:48:08 +0000 (UTC) Subject: [commit: ghc] master: Kill varSetElems in injImproveEqns (82538f6) Message-ID: <20160428124808.4C4493A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/82538f65f48f370764691264c3c71b975fd43e16/ghc >--------------------------------------------------------------- commit 82538f65f48f370764691264c3c71b975fd43e16 Author: Bartosz Nitka Date: Thu Apr 28 05:40:39 2016 -0700 Kill varSetElems in injImproveEqns We want to remove varSetElems at the source level because it might be a source of nondeterminism. I don't think it introduces nondeterminism here, but it's easy to do the same thing deterministically for the same price. instFlexiTcS :: [TKVar] -> TcS (TCvSubst, [TcType]) instFlexiTcS currently gives the range of the produced substitution as the second element of the tuple, but it's not used anywhere right now. If it started to be used in the code I'm modifying it would cause nondeterminism problems. Test Plan: ./validate Reviewers: austin, goldfire, bgamari, simonmar, simonpj Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2149 GHC Trac Issues: #4012 >--------------------------------------------------------------- 82538f65f48f370764691264c3c71b975fd43e16 compiler/typecheck/TcInteract.hs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/compiler/typecheck/TcInteract.hs b/compiler/typecheck/TcInteract.hs index f451af9..6205844 100644 --- a/compiler/typecheck/TcInteract.hs +++ b/compiler/typecheck/TcInteract.hs @@ -1494,7 +1494,7 @@ improve_top_fun_eqs fam_envs fam_tc args rhs_ty -> (a -> [Type]) -- get LHS of an axiom -> (a -> Type) -- get RHS of an axiom -> (a -> Maybe CoAxBranch) -- Just => apartness check required - -> [( [Type], TCvSubst, TyVarSet, Maybe CoAxBranch )] + -> [( [Type], TCvSubst, [TyVar], Maybe CoAxBranch )] -- Result: -- ( [arguments of a matching axiom] -- , RHS-unifying substitution @@ -1506,15 +1506,20 @@ improve_top_fun_eqs fam_envs fam_tc args rhs_ty , let ax_args = axiomLHS axiom , let ax_rhs = axiomRHS axiom , Just subst <- [tcUnifyTyWithTFs False ax_rhs rhs_ty] - , let tvs = tyCoVarsOfTypes ax_args + , let tvs = tyCoVarsOfTypesList ax_args notInSubst tv = not (tv `elemVarEnv` getTvSubstEnv subst) - unsubstTvs = filterVarSet (notInSubst <&&> isTyVar) tvs ] + unsubstTvs = filter (notInSubst <&&> isTyVar) tvs ] injImproveEqns :: [Bool] - -> ([Type], TCvSubst, TyCoVarSet, Maybe CoAxBranch) + -> ([Type], TCvSubst, [TyCoVar], Maybe CoAxBranch) -> TcS [Eqn] injImproveEqns inj_args (ax_args, theta, unsubstTvs, cabr) = do - (theta', _) <- instFlexiTcS (varSetElems unsubstTvs) + (theta', _) <- instFlexiTcS unsubstTvs + -- The use of deterministically ordered list for `unsubstTvs` + -- is not strictly necessary here, we only use the substitution + -- part of the result of instFlexiTcS. If we used the second + -- part of the tuple, which is the range of the substitution then + -- the order could be important. let subst = theta `unionTCvSubst` theta' return [ Pair arg (substTyUnchecked subst ax_arg) | case cabr of From git at git.haskell.org Thu Apr 28 16:32:20 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Apr 2016 16:32:20 +0000 (UTC) Subject: [commit: ghc] master: Comments only (af6dced) Message-ID: <20160428163220.5C48A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/af6dced902ba158f0b05b224ff4afb5a3f9c9e5a/ghc >--------------------------------------------------------------- commit af6dced902ba158f0b05b224ff4afb5a3f9c9e5a Author: Simon Peyton Jones Date: Mon Apr 25 16:13:38 2016 +0100 Comments only >--------------------------------------------------------------- af6dced902ba158f0b05b224ff4afb5a3f9c9e5a compiler/rename/RnNames.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/rename/RnNames.hs b/compiler/rename/RnNames.hs index e3bdaab..1e704bf 100644 --- a/compiler/rename/RnNames.hs +++ b/compiler/rename/RnNames.hs @@ -733,8 +733,8 @@ Note [Dealing with imports] ~~~~~~~~~~~~~~~~~~~~~~~~~~~ For import M( ies ), we take the mi_exports of M, and make imp_occ_env :: OccEnv (Name, AvailInfo, Maybe Name) -One entry for each Name that M exports; the AvailInfo describes just -that Name. +One entry for each Name that M exports; the AvailInfo is the +AvailInfo exported from M that exports that Name. The situation is made more complicated by associated types. E.g. module M where @@ -747,7 +747,7 @@ Notice that T appears *twice*, once as a child and once as a parent. From this we construct the imp_occ_env C -> (C, C(C,T), Nothing) T -> (T, T(T,T1,T2,T3), Just C) - T1 -> (T1, T(T1,T2,T3), Nothing) -- similarly T2,T3 + T1 -> (T1, T(T,T1,T2,T3), Nothing) -- similarly T2,T3 If we say import M( T(T1,T2) ) From git at git.haskell.org Thu Apr 28 16:32:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Apr 2016 16:32:23 +0000 (UTC) Subject: [commit: ghc] master: Minor improvement to error message (a2abcf6) Message-ID: <20160428163223.188593A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a2abcf6e9c91532311235b8fece1d187e3980c72/ghc >--------------------------------------------------------------- commit a2abcf6e9c91532311235b8fece1d187e3980c72 Author: Simon Peyton Jones Date: Mon Apr 25 16:16:04 2016 +0100 Minor improvement to error message "One fewer arguments to ..." rather than "One fewer argument to ..." >--------------------------------------------------------------- a2abcf6e9c91532311235b8fece1d187e3980c72 compiler/typecheck/TcErrors.hs | 13 +++++-------- .../tests/deriving/should_fail/drvfail005.stderr | 2 +- testsuite/tests/polykinds/T6039.stderr | 2 +- testsuite/tests/th/T3177a.stderr | 4 ++-- .../tests/typecheck/should_fail/T11356.stderr | 2 +- testsuite/tests/typecheck/should_fail/T2994.stderr | 2 +- testsuite/tests/typecheck/should_fail/T4875.stderr | 2 +- testsuite/tests/typecheck/should_fail/T7778.stderr | 2 +- .../tests/typecheck/should_fail/tcfail070.stderr | 10 +++++----- .../tests/typecheck/should_fail/tcfail078.stderr | 2 +- .../tests/typecheck/should_fail/tcfail113.stderr | 2 +- .../tests/typecheck/should_fail/tcfail132.stderr | 22 +++++++++++----------- 12 files changed, 31 insertions(+), 34 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc a2abcf6e9c91532311235b8fece1d187e3980c72 From git at git.haskell.org Thu Apr 28 16:32:25 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Apr 2016 16:32:25 +0000 (UTC) Subject: [commit: ghc] master: Comments only (1e86cab) Message-ID: <20160428163225.C186C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1e86cab459b93274f1b9a2ef08f3b89f4de1b86d/ghc >--------------------------------------------------------------- commit 1e86cab459b93274f1b9a2ef08f3b89f4de1b86d Author: Simon Peyton Jones Date: Mon Apr 25 16:16:49 2016 +0100 Comments only >--------------------------------------------------------------- 1e86cab459b93274f1b9a2ef08f3b89f4de1b86d compiler/typecheck/TcPatSyn.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compiler/typecheck/TcPatSyn.hs b/compiler/typecheck/TcPatSyn.hs index 009e305..df4e456 100644 --- a/compiler/typecheck/TcPatSyn.hs +++ b/compiler/typecheck/TcPatSyn.hs @@ -412,6 +412,8 @@ tc_patsyn_finish lname dir is_infix lpat' -- so there had better be no unification variables in there univ_tvs' <- mapMaybeM (zonkQuantifiedTyVar False) univ_tvs ; ex_tvs' <- mapMaybeM (zonkQuantifiedTyVar False) ex_tvs + -- ToDo: The False means that we behave here as if + -- -XPolyKinds was always on, which isn't right. ; prov_theta' <- zonkTcTypes prov_theta ; req_theta' <- zonkTcTypes req_theta ; pat_ty' <- zonkTcType pat_ty From git at git.haskell.org Thu Apr 28 16:32:28 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Apr 2016 16:32:28 +0000 (UTC) Subject: [commit: ghc] master: Remove unused unifyType_ (9ed57d6) Message-ID: <20160428163228.704F03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9ed57d66e95e0f27085497dcf51ea9d7db2bde79/ghc >--------------------------------------------------------------- commit 9ed57d66e95e0f27085497dcf51ea9d7db2bde79 Author: Simon Peyton Jones Date: Mon Apr 25 16:17:07 2016 +0100 Remove unused unifyType_ >--------------------------------------------------------------- 9ed57d66e95e0f27085497dcf51ea9d7db2bde79 compiler/typecheck/TcUnify.hs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/compiler/typecheck/TcUnify.hs b/compiler/typecheck/TcUnify.hs index b18671b..5d84a46 100644 --- a/compiler/typecheck/TcUnify.hs +++ b/compiler/typecheck/TcUnify.hs @@ -16,7 +16,7 @@ module TcUnify ( checkConstraints, buildImplicationFor, -- Various unifications - unifyType_, unifyType, unifyTheta, unifyKind, noThing, + unifyType, unifyTheta, unifyKind, noThing, uType, unifyExpType, -------------------------------- @@ -976,12 +976,6 @@ The exported functions are all defined as versions of some non-exported generic functions. -} --- | Unify two types, discarding a resultant coercion. Any constraints --- generated will still need to be solved, however. -unifyType_ :: Outputable a => Maybe a -- ^ If present, has type 'ty1' - -> TcTauType -> TcTauType -> TcM () -unifyType_ thing ty1 ty2 = void $ unifyType thing ty1 ty2 - unifyType :: Outputable a => Maybe a -- ^ If present, has type 'ty1' -> TcTauType -> TcTauType -> TcM TcCoercionN -- Actual and expected types From git at git.haskell.org Thu Apr 28 16:32:31 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Apr 2016 16:32:31 +0000 (UTC) Subject: [commit: ghc] master: Add missing solveEqualities (4c746cb) Message-ID: <20160428163231.C700F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4c746cb2886b06ca53a2edb62188827c3dbccce0/ghc >--------------------------------------------------------------- commit 4c746cb2886b06ca53a2edb62188827c3dbccce0 Author: Simon Peyton Jones Date: Mon Apr 25 16:17:34 2016 +0100 Add missing solveEqualities I'd missed a call to solveEqualities in the partial-type-sig case of TcBinds.tcUserTypeSig. Also the checkValidType test done there best done after inference, in checkInferredPolyId (and is already done there). Fixes Trac #11976 >--------------------------------------------------------------- 4c746cb2886b06ca53a2edb62188827c3dbccce0 compiler/typecheck/TcBinds.hs | 15 +++++---------- testsuite/tests/partial-sigs/should_fail/T11976.hs | 7 +++++++ testsuite/tests/partial-sigs/should_fail/T11976.stderr | 7 +++++++ testsuite/tests/partial-sigs/should_fail/all.T | 1 + 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/compiler/typecheck/TcBinds.hs b/compiler/typecheck/TcBinds.hs index 1a58719..ac19061 100644 --- a/compiler/typecheck/TcBinds.hs +++ b/compiler/typecheck/TcBinds.hs @@ -1797,8 +1797,9 @@ tcUserTypeSig hs_sig_ty mb_name <- pushTcLevelM_ $ -- When instantiating the signature, do so "one level in" -- so that they can be unified under the forall - tcImplicitTKBndrs vars $ - tcWildCardBinders wcs $ \ wcs -> + solveEqualities $ + tcImplicitTKBndrs vars $ + tcWildCardBinders wcs $ \ wcs -> tcExplicitTKBndrs hs_tvs $ \ tvs2 -> do { -- Instantiate the type-class context; but if there -- is an extra-constraints wildcard, just discard it here @@ -1815,20 +1816,14 @@ tcUserTypeSig hs_sig_ty mb_name ; theta <- zonkTcTypes theta ; tau <- zonkTcType tau - -- Check for validity (eg rankN etc) - -- The ambiguity check will happen (from checkValidType), - -- but unnecessarily; it will always succeed because there - -- is no quantification - ; checkValidType ctxt_F (mkPhiTy theta tau) - -- NB: Do this in the context of the pushTcLevel so that - -- the TcLevel invariant is respected - ; let bound_tvs = unionVarSets [ allBoundVariabless theta , allBoundVariables tau , mkVarSet (map snd wcs) ] ; return ((wcs, tvs2, theta, tau), bound_tvs) } + -- NB: checkValidType on the final inferred type will + -- be done later by checkInferredPolyId ; loc <- getSrcSpanM ; return $ TISI { sig_bndr = PartialSig { sig_name = name, sig_hs_ty = hs_ty diff --git a/testsuite/tests/partial-sigs/should_fail/T11976.hs b/testsuite/tests/partial-sigs/should_fail/T11976.hs new file mode 100644 index 0000000..ce6e904 --- /dev/null +++ b/testsuite/tests/partial-sigs/should_fail/T11976.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE PartialTypeSignatures, RankNTypes #-} + +module T11976 where + +type Lens s a = forall f. Functor f => (a -> f a) -> (s -> f s) + +foo = undefined :: Lens _ _ _ diff --git a/testsuite/tests/partial-sigs/should_fail/T11976.stderr b/testsuite/tests/partial-sigs/should_fail/T11976.stderr new file mode 100644 index 0000000..06320d9 --- /dev/null +++ b/testsuite/tests/partial-sigs/should_fail/T11976.stderr @@ -0,0 +1,7 @@ + +T11976.hs:7:20: error: + ? Expecting one fewer arguments to ?Lens t0 t1? + Expected kind ?k0 -> *?, but ?Lens t0 t1? has kind ?*? + ? In the type ?Lens _ _ _? + In the expression: undefined :: Lens _ _ _ + In an equation for ?foo?: foo = undefined :: Lens _ _ _ diff --git a/testsuite/tests/partial-sigs/should_fail/all.T b/testsuite/tests/partial-sigs/should_fail/all.T index c62dd9c..a676a02 100644 --- a/testsuite/tests/partial-sigs/should_fail/all.T +++ b/testsuite/tests/partial-sigs/should_fail/all.T @@ -60,3 +60,4 @@ test('T10615', normal, compile_fail, ['']) test('T10045', normal, compile_fail, ['']) test('T10999', normal, compile_fail, ['']) test('T11122', normal, compile, ['']) +test('T11976', normal, compile_fail, ['']) From git at git.haskell.org Thu Apr 28 16:32:34 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Apr 2016 16:32:34 +0000 (UTC) Subject: [commit: ghc] master: Refactor RecordPatSynField, FieldLabel (3dce4f2) Message-ID: <20160428163234.8C7793A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3dce4f2db4058cc097156fc0c0afe1a5b66b9409/ghc >--------------------------------------------------------------- commit 3dce4f2db4058cc097156fc0c0afe1a5b66b9409 Author: Simon Peyton Jones Date: Thu Apr 28 15:52:29 2016 +0100 Refactor RecordPatSynField, FieldLabel This patch uses the named fields of * FieldLabel * RecordPatSynField in construction and pattern matching. The fields existed before, but we were often using positional notation. Also a minor refactor of the API of mkPatSynRecSelBinds No change in functionality >--------------------------------------------------------------- 3dce4f2db4058cc097156fc0c0afe1a5b66b9409 compiler/basicTypes/FieldLabel.hs | 3 ++- compiler/basicTypes/RdrName.hs | 16 ++++++++++++---- compiler/hsSyn/HsBinds.hs | 20 +++++++++++++------- compiler/rename/RnBinds.hs | 10 ++++++---- compiler/rename/RnSource.hs | 8 +++----- compiler/typecheck/TcPatSyn.hs | 30 ++++++++++++++---------------- compiler/typecheck/TcTyDecls.hs | 2 +- 7 files changed, 51 insertions(+), 38 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 3dce4f2db4058cc097156fc0c0afe1a5b66b9409 From git at git.haskell.org Thu Apr 28 16:32:37 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Apr 2016 16:32:37 +0000 (UTC) Subject: [commit: ghc] master: Better documentation of -XConstrainedClassMethods (c4dd4ae) Message-ID: <20160428163237.4B3D13A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c4dd4ae71549d9275b8b827af0bfaac85ef7ed4a/ghc >--------------------------------------------------------------- commit c4dd4ae71549d9275b8b827af0bfaac85ef7ed4a Author: Simon Peyton Jones Date: Thu Apr 28 15:56:09 2016 +0100 Better documentation of -XConstrainedClassMethods >--------------------------------------------------------------- c4dd4ae71549d9275b8b827af0bfaac85ef7ed4a docs/users_guide/glasgow_exts.rst | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index ef66140..fe12568 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -4551,23 +4551,31 @@ context. .. _class-method-types: -Class method types -~~~~~~~~~~~~~~~~~~ +Constrained class method types +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. ghc-flag:: -XConstrainedClassMethods - Allows the definition of further constraints on individual class methods. - -Haskell 98 prohibits class method types to mention constraints on the -class type variable, thus: :: - - class Seq s a where - fromList :: [a] -> s a - elem :: Eq a => a -> s a -> Bool +@ -4562,7 +4562,20 @@ class type variable, thus: :: The type of ``elem`` is illegal in Haskell 98, because it contains the constraint ``Eq a``, which constrains only the class type variable (in this case ``a``). +this case ``a``). More precisely, a constraint in a class method signature is rejected if + +- The constraint mentions at least one type variable. So this is allowed: :: + + class C a where + op1 :: HasCallStack => a -> a + op2 :: (?x::Int) => Int -> a + +- All of the type variables mentioned are bound by the class declaration, and none is locally quantified. Examples: :: + + class C a where + op3 :: Eq a => a -> a -- Rejected: constrains class variable only + op4 :: D b => a -> b -- Accepted: constrains a locally-quantified varible `b` + op5 :: D (a,b) => a -> b -- Accepted: constrains a locally-quantified varible `b` + GHC lifts this restriction with language extension :ghc-flag:`-XConstrainedClassMethods`. The restriction is a pretty stupid one in From git at git.haskell.org Thu Apr 28 16:32:39 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Apr 2016 16:32:39 +0000 (UTC) Subject: [commit: ghc] master: Fix debug-only check in CoreLint (c5b1014) Message-ID: <20160428163239.EFB663A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c5b1014eb0a477aa32691841dcc2739dbcd2bc85/ghc >--------------------------------------------------------------- commit c5b1014eb0a477aa32691841dcc2739dbcd2bc85 Author: Simon Peyton Jones Date: Thu Apr 28 17:27:02 2016 +0100 Fix debug-only check in CoreLint >--------------------------------------------------------------- c5b1014eb0a477aa32691841dcc2739dbcd2bc85 compiler/coreSyn/CoreLint.hs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/compiler/coreSyn/CoreLint.hs b/compiler/coreSyn/CoreLint.hs index aaed959..26383af 100644 --- a/compiler/coreSyn/CoreLint.hs +++ b/compiler/coreSyn/CoreLint.hs @@ -657,7 +657,8 @@ lintCoreExpr (Lam var expr) lintCoreExpr e@(Case scrut var alt_ty alts) = -- Check the scrutinee - do { scrut_ty <- lintCoreExpr scrut + do { let scrut_diverges = exprIsBottom scrut + ; scrut_ty <- lintCoreExpr scrut ; (alt_ty, _) <- lintInTy alt_ty ; (var_ty, _) <- lintInTy (idType var) @@ -665,7 +666,7 @@ lintCoreExpr e@(Case scrut var alt_ty alts) = ; when (null alts) $ do { checkL (not (exprIsHNF scrut)) (text "No alternatives for a case scrutinee in head-normal form:" <+> ppr scrut) - ; checkL (exprIsBottom scrut) + ; checkL scrut_diverges (text "No alternatives for a case scrutinee not known to diverge for sure:" <+> ppr scrut) } @@ -680,11 +681,12 @@ lintCoreExpr e@(Case scrut var alt_ty alts) = ; case tyConAppTyCon_maybe (idType var) of Just tycon - | debugIsOn && - isAlgTyCon tycon && - not (isFamilyTyCon tycon || isAbstractTyCon tycon) && - null (tyConDataCons tycon) -> - pprTrace "Lint warning: case binder's type has no constructors" (ppr var <+> ppr (idType var)) + | debugIsOn + , isAlgTyCon tycon + , not (isAbstractTyCon tycon) + , null (tyConDataCons tycon) + , not scrut_diverges + -> pprTrace "Lint warning: case binder's type has no constructors" (ppr var <+> ppr (idType var)) -- This can legitimately happen for type families $ return () _otherwise -> return () From git at git.haskell.org Thu Apr 28 16:33:57 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Apr 2016 16:33:57 +0000 (UTC) Subject: [commit: ghc] master: Revert "Use __builtin_clz() to implement log_2()" (546f24e) Message-ID: <20160428163357.8E4B53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/546f24e4f8a7c086b1e5afcdda624176610cbcf8/ghc >--------------------------------------------------------------- commit 546f24e4f8a7c086b1e5afcdda624176610cbcf8 Author: Simon Peyton Jones Date: Thu Apr 28 15:20:43 2016 +0100 Revert "Use __builtin_clz() to implement log_2()" This reverts commit 24864ba5587c1a0447beabae90529e8bb4fa117a. >--------------------------------------------------------------- 546f24e4f8a7c086b1e5afcdda624176610cbcf8 rts/sm/BlockAlloc.c | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/rts/sm/BlockAlloc.c b/rts/sm/BlockAlloc.c index 1c83de9..a633726 100644 --- a/rts/sm/BlockAlloc.c +++ b/rts/sm/BlockAlloc.c @@ -199,41 +199,31 @@ initGroup(bdescr *head) } } -// log base 2 (floor), needs to support up to 2^MAX_FREE_LIST +// There are quicker non-loopy ways to do log_2, but we expect n to be +// usually small, and MAX_FREE_LIST is also small, so the loop version +// might well be the best choice here. STATIC_INLINE nat -log_2(W_ n) +log_2_ceil(W_ n) { -#if defined(__GNUC__) - return __builtin_clzl(n) ^ (sizeof(StgWord)*8 - 1); - // generates good code on x86. __builtin_clz() compiles to bsr+xor, but - // we want just bsr, so the xor here cancels out gcc's xor. -#else W_ i, x; - x = n; + x = 1; for (i=0; i < MAX_FREE_LIST; i++) { - x = x >> 1; - if (x == 0) return i; + if (x >= n) return i; + x = x << 1; } return MAX_FREE_LIST; -#endif } -// log base 2 (ceiling), needs to support up to 2^MAX_FREE_LIST STATIC_INLINE nat -log_2_ceil(W_ n) +log_2(W_ n) { -#if defined(__GNUC__) - nat r = log_2(n); - return (n & (n-1)) ? r+1 : r; -#else W_ i, x; - x = 1; + x = n; for (i=0; i < MAX_FREE_LIST; i++) { - if (x >= n) return i; - x = x << 1; + x = x >> 1; + if (x == 0) return i; } return MAX_FREE_LIST; -#endif } STATIC_INLINE void From git at git.haskell.org Thu Apr 28 16:49:45 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Apr 2016 16:49:45 +0000 (UTC) Subject: [commit: ghc] master: Kill unused foldOccSet (3a53380) Message-ID: <20160428164945.978E43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3a53380d40a1f9465075b46fba36451116c12ff1/ghc >--------------------------------------------------------------- commit 3a53380d40a1f9465075b46fba36451116c12ff1 Author: Bartosz Nitka Date: Thu Apr 28 09:51:56 2016 -0700 Kill unused foldOccSet foldOccSet if used would be a potential source of nondeterminism. Since it's not used we can just remove it. >--------------------------------------------------------------- 3a53380d40a1f9465075b46fba36451116c12ff1 compiler/basicTypes/OccName.hs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/compiler/basicTypes/OccName.hs b/compiler/basicTypes/OccName.hs index 74bd96b..e15cfbb 100644 --- a/compiler/basicTypes/OccName.hs +++ b/compiler/basicTypes/OccName.hs @@ -92,7 +92,7 @@ module OccName ( OccSet, emptyOccSet, unitOccSet, mkOccSet, extendOccSet, extendOccSetList, unionOccSets, unionManyOccSets, minusOccSet, elemOccSet, occSetElts, - foldOccSet, isEmptyOccSet, intersectOccSet, intersectsOccSet, + isEmptyOccSet, intersectOccSet, intersectsOccSet, filterOccSet, -- * Tidying up @@ -446,7 +446,6 @@ unionManyOccSets :: [OccSet] -> OccSet minusOccSet :: OccSet -> OccSet -> OccSet elemOccSet :: OccName -> OccSet -> Bool occSetElts :: OccSet -> [OccName] -foldOccSet :: (OccName -> b -> b) -> b -> OccSet -> b isEmptyOccSet :: OccSet -> Bool intersectOccSet :: OccSet -> OccSet -> OccSet intersectsOccSet :: OccSet -> OccSet -> Bool @@ -462,7 +461,6 @@ unionManyOccSets = unionManyUniqSets minusOccSet = minusUniqSet elemOccSet = elementOfUniqSet occSetElts = uniqSetToList -foldOccSet = foldUniqSet isEmptyOccSet = isEmptyUniqSet intersectOccSet = intersectUniqSets intersectsOccSet s1 s2 = not (isEmptyOccSet (s1 `intersectOccSet` s2)) From git at git.haskell.org Thu Apr 28 18:14:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Apr 2016 18:14:03 +0000 (UTC) Subject: [commit: ghc] master: Testsuite: delete accidentally committed .stderr.normalised file (196ce62) Message-ID: <20160428181403.83E193A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/196ce6225f6eae11d49fe013940db1a89b472a2b/ghc >--------------------------------------------------------------- commit 196ce6225f6eae11d49fe013940db1a89b472a2b Author: Thomas Miedema Date: Wed Apr 27 17:11:31 2016 +0200 Testsuite: delete accidentally committed .stderr.normalised file [skip ci] >--------------------------------------------------------------- 196ce6225f6eae11d49fe013940db1a89b472a2b ..._simple_duplicate_lib.stderr.normalised-mingw32 | 24 ---------------------- 1 file changed, 24 deletions(-) diff --git a/testsuite/tests/rts/T11223/T11223_simple_duplicate_lib.stderr.normalised-mingw32 b/testsuite/tests/rts/T11223/T11223_simple_duplicate_lib.stderr.normalised-mingw32 deleted file mode 100644 index 69fc0d4..0000000 --- a/testsuite/tests/rts/T11223/T11223_simple_duplicate_lib.stderr.normalised-mingw32 +++ /dev/null @@ -1,24 +0,0 @@ -GHC runtime linker: fatal I found a duplicate definition for symbol - a -whilst processing object file - libfoo_dup_lib.a -The symbol was previously defined in - bar_dup.o -This could be caused by: - * Loading two different object files which export the same symbol - * Specifying the same object file twice on the GHCi command line - * An incorrect `package.conf' entry, causing some object to be - loaded twice. - -ByteCodeLink: can't find label -During interactive linking, GHCi couldn't find the following symbol: - c -This may be due to you not asking GHCi to load extra object files, -archives or DLLs needed by your current session. Restart GHCi, specifying -the missing library using the -L dir and -lmissinglibname -flags, or simply by naming the relevant files on the GHCi command line. -Alternatively, this link failure might indicate a bug in GHCi. -If you suspect the latter, please send a bug report to: - glasgow-haskell-bugs at haskell.org - -ghc: Could not on-demand load symbol 'c' \ No newline at end of file From git at git.haskell.org Thu Apr 28 18:14:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Apr 2016 18:14:06 +0000 (UTC) Subject: [commit: ghc] master: Testsuite: fix T11223_simple_(unused_)duplicate_lib (9dc34d3) Message-ID: <20160428181406.3632B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9dc34d31eb50d5aeb93d24cf9a3197f27ecb1687/ghc >--------------------------------------------------------------- commit 9dc34d31eb50d5aeb93d24cf9a3197f27ecb1687 Author: Thomas Miedema Date: Thu Apr 28 11:55:40 2016 +0200 Testsuite: fix T11223_simple_(unused_)duplicate_lib These tests were failing on Travis when run independently from eachother. >--------------------------------------------------------------- 9dc34d31eb50d5aeb93d24cf9a3197f27ecb1687 testsuite/tests/rts/T11223/Makefile | 4 ++-- testsuite/tests/rts/T11223/T11223_simple_duplicate_lib.stderr | 2 +- testsuite/tests/rts/T11223/foo2.hs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/testsuite/tests/rts/T11223/Makefile b/testsuite/tests/rts/T11223/Makefile index 6ffe7cb..6bcb9a5 100644 --- a/testsuite/tests/rts/T11223/Makefile +++ b/testsuite/tests/rts/T11223/Makefile @@ -34,7 +34,7 @@ t_11223_simple_duplicate_lib: "$(CC)" -c foo.c -o foo_dup_lib.o "$(CC)" -c bar.c -o bar_dup_lib.o "$(AR)" rs libfoo_dup_lib.a foo_dup_lib.o 2> /dev/null - echo main | "$(TEST_HC)" --interactive -v0 $(filter-out -rtsopts, $(TEST_HC_OPTS)) -ignore-dot-ghci bar_dup.o foo.hs -lfoo_dup_lib -L"$(PWD)" + echo main | "$(TEST_HC)" --interactive -v0 $(filter-out -rtsopts, $(TEST_HC_OPTS)) -ignore-dot-ghci bar_dup_lib.o foo.hs -lfoo_dup_lib -L"$(PWD)" .PHONY: t_11223_simple_unused_duplicate_lib t_11223_simple_unused_duplicate_lib: @@ -42,7 +42,7 @@ t_11223_simple_unused_duplicate_lib: "$(CC)" -c foo.c -o foo_dup_lib.o "$(CC)" -c bar.c -o bar_dup_lib.o "$(AR)" rs libbar_dup_lib.a bar_dup_lib.o 2> /dev/null - echo main | "$(TEST_HC)" --interactive -v0 $(filter-out -rtsopts, $(TEST_HC_OPTS)) -ignore-dot-ghci foo_dup.o foo.hs -lbar_dup_lib -L"$(PWD)" + echo main | "$(TEST_HC)" --interactive -v0 $(filter-out -rtsopts, $(TEST_HC_OPTS)) -ignore-dot-ghci foo_dup_lib.o foo.hs -lbar_dup_lib -L"$(PWD)" .PHONY: t_11223_link_order_a_b_succeed t_11223_link_order_a_b_succeed: diff --git a/testsuite/tests/rts/T11223/T11223_simple_duplicate_lib.stderr b/testsuite/tests/rts/T11223/T11223_simple_duplicate_lib.stderr index 06da96f..0785cdc 100644 --- a/testsuite/tests/rts/T11223/T11223_simple_duplicate_lib.stderr +++ b/testsuite/tests/rts/T11223/T11223_simple_duplicate_lib.stderr @@ -3,7 +3,7 @@ GHC runtime linker: fatal error: I found a duplicate definition for symbol whilst processing object file /home/phyx/Documents/ghc/testsuite/tests/rts/T11223/libfoo_dup_lib.a The symbol was previously defined in - bar_dup.o + bar_dup_lib.o This could be caused by: * Loading two different object files which export the same symbol * Specifying the same object file twice on the GHCi command line diff --git a/testsuite/tests/rts/T11223/foo2.hs b/testsuite/tests/rts/T11223/foo2.hs index ecaed41..1c9ebce 100644 --- a/testsuite/tests/rts/T11223/foo2.hs +++ b/testsuite/tests/rts/T11223/foo2.hs @@ -1,5 +1,5 @@ module Main where -foreign import ccall "a" c_exp :: Int +foreign import ccall "a" a_exp :: Int -main = print c_exp +main = print a_exp From git at git.haskell.org Thu Apr 28 18:14:08 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Apr 2016 18:14:08 +0000 (UTC) Subject: [commit: ghc] master: Testsuite: add -ignore-dot-ghci to some ghci tests [skip ci] (89c6d07) Message-ID: <20160428181408.D58603A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/89c6d074bafb7cdc5ed019d4587928130441daa4/ghc >--------------------------------------------------------------- commit 89c6d074bafb7cdc5ed019d4587928130441daa4 Author: Thomas Miedema Date: Thu Apr 28 11:49:02 2016 +0200 Testsuite: add -ignore-dot-ghci to some ghci tests [skip ci] >--------------------------------------------------------------- 89c6d074bafb7cdc5ed019d4587928130441daa4 testsuite/tests/rts/T11223/Makefile | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/testsuite/tests/rts/T11223/Makefile b/testsuite/tests/rts/T11223/Makefile index af07c32..6ffe7cb 100644 --- a/testsuite/tests/rts/T11223/Makefile +++ b/testsuite/tests/rts/T11223/Makefile @@ -12,21 +12,21 @@ GCC=gcc t_11223_simple_link: $(RM) -f foo_simple.o foo.hi foo.o "$(CC)" -c foo.c -o foo_simple.o - echo main | "$(TEST_HC)" --interactive -v0 $(filter-out -rtsopts, $(TEST_HC_OPTS)) foo_simple.o foo.hs + echo main | "$(TEST_HC)" --interactive -v0 $(filter-out -rtsopts, $(TEST_HC_OPTS)) -ignore-dot-ghci foo_simple.o foo.hs .PHONY: t_11223_simple_link_lib t_11223_simple_link_lib: $(RM) -f foo_lib.o foo.hi foo.o libfoo_lib.a "$(CC)" -c foo.c -o foo_lib.o "$(AR)" rs libfoo_lib.a foo_lib.o 2> /dev/null - echo main | "$(TEST_HC)" --interactive -v0 $(filter-out -rtsopts, $(TEST_HC_OPTS)) foo.hs -lfoo_lib -L"$(PWD)" + echo main | "$(TEST_HC)" --interactive -v0 $(filter-out -rtsopts, $(TEST_HC_OPTS)) -ignore-dot-ghci foo.hs -lfoo_lib -L"$(PWD)" .PHONY: t_11223_simple_duplicate t_11223_simple_duplicate: $(RM) -f foo_dup.o bar_dup.o foo.hi foo.o "$(CC)" -c foo.c -o foo_dup.o "$(CC)" -c bar.c -o bar_dup.o - echo main | "$(TEST_HC)" --interactive -v0 $(filter-out -rtsopts, $(TEST_HC_OPTS)) foo_dup.o bar_dup.o foo.hs + echo main | "$(TEST_HC)" --interactive -v0 $(filter-out -rtsopts, $(TEST_HC_OPTS)) -ignore-dot-ghci foo_dup.o bar_dup.o foo.hs .PHONY: t_11223_simple_duplicate_lib t_11223_simple_duplicate_lib: @@ -34,7 +34,7 @@ t_11223_simple_duplicate_lib: "$(CC)" -c foo.c -o foo_dup_lib.o "$(CC)" -c bar.c -o bar_dup_lib.o "$(AR)" rs libfoo_dup_lib.a foo_dup_lib.o 2> /dev/null - echo main | "$(TEST_HC)" --interactive -v0 $(filter-out -rtsopts, $(TEST_HC_OPTS)) bar_dup.o foo.hs -lfoo_dup_lib -L"$(PWD)" + echo main | "$(TEST_HC)" --interactive -v0 $(filter-out -rtsopts, $(TEST_HC_OPTS)) -ignore-dot-ghci bar_dup.o foo.hs -lfoo_dup_lib -L"$(PWD)" .PHONY: t_11223_simple_unused_duplicate_lib t_11223_simple_unused_duplicate_lib: @@ -42,7 +42,7 @@ t_11223_simple_unused_duplicate_lib: "$(CC)" -c foo.c -o foo_dup_lib.o "$(CC)" -c bar.c -o bar_dup_lib.o "$(AR)" rs libbar_dup_lib.a bar_dup_lib.o 2> /dev/null - echo main | "$(TEST_HC)" --interactive -v0 $(filter-out -rtsopts, $(TEST_HC_OPTS)) foo_dup.o foo.hs -lbar_dup_lib -L"$(PWD)" + echo main | "$(TEST_HC)" --interactive -v0 $(filter-out -rtsopts, $(TEST_HC_OPTS)) -ignore-dot-ghci foo_dup.o foo.hs -lbar_dup_lib -L"$(PWD)" .PHONY: t_11223_link_order_a_b_succeed t_11223_link_order_a_b_succeed: @@ -51,7 +51,7 @@ t_11223_link_order_a_b_succeed: "$(CC)" -c bar.c -o bar_link_lib_1.o "$(AR)" rs libbar_link_lib_1.a bar_link_lib_1.o 2> /dev/null "$(AR)" rs libfoo_link_lib_1.a foo_link_lib_1.o 2> /dev/null - echo main | "$(TEST_HC)" --interactive -v0 $(filter-out -rtsopts, $(TEST_HC_OPTS)) foo2.hs -lbar_link_lib_1 -lfoo_link_lib_1 -L"$(PWD)" + echo main | "$(TEST_HC)" --interactive -v0 $(filter-out -rtsopts, $(TEST_HC_OPTS)) -ignore-dot-ghci foo2.hs -lbar_link_lib_1 -lfoo_link_lib_1 -L"$(PWD)" .PHONY: t_11223_link_order_b_a_succeed t_11223_link_order_b_a_succeed: @@ -60,7 +60,7 @@ t_11223_link_order_b_a_succeed: "$(CC)" -c bar.c -o bar_link_lib_2.o "$(AR)" rs libbar_link_lib_2.a bar_link_lib_2.o 2> /dev/null "$(AR)" rs libfoo_link_lib_2.a foo_link_lib_2.o 2> /dev/null - echo main | "$(TEST_HC)" --interactive -v0 $(filter-out -rtsopts, $(TEST_HC_OPTS)) foo2.hs -lfoo_link_lib_2 -lbar_link_lib_2 -L"$(PWD)" + echo main | "$(TEST_HC)" --interactive -v0 $(filter-out -rtsopts, $(TEST_HC_OPTS)) -ignore-dot-ghci foo2.hs -lfoo_link_lib_2 -lbar_link_lib_2 -L"$(PWD)" .PHONY: t_11223_link_order_a_b_2_fail t_11223_link_order_a_b_2_fail: @@ -69,7 +69,7 @@ t_11223_link_order_a_b_2_fail: "$(CC)" -c bar.c -o bar_link_lib_3.o "$(AR)" rs libbar_link_lib_3.a bar_link_lib_3.o 2> /dev/null "$(AR)" rs libfoo_link_lib_3.a foo_link_lib_3.o 2> /dev/null - echo main | "$(TEST_HC)" --interactive -v0 $(filter-out -rtsopts, $(TEST_HC_OPTS)) foo3.hs -lbar_link_lib_3 -lfoo_link_lib_3 -L"$(PWD)" + echo main | "$(TEST_HC)" --interactive -v0 $(filter-out -rtsopts, $(TEST_HC_OPTS)) -ignore-dot-ghci foo3.hs -lbar_link_lib_3 -lfoo_link_lib_3 -L"$(PWD)" .PHONY: t_11223_link_order_b_a_2_succeed t_11223_link_order_b_a_2_succeed: @@ -78,7 +78,7 @@ t_11223_link_order_b_a_2_succeed: "$(CC)" -c bar.c -o bar_link_lib_4.o "$(AR)" rs libbar_link_lib_4.a bar_link_lib_4.o 2> /dev/null "$(AR)" rs libfoo_link_lib_4.a foo_link_lib_4.o 2> /dev/null - echo main | "$(TEST_HC)" --interactive -v0 $(filter-out -rtsopts, $(TEST_HC_OPTS)) foo3.hs -lfoo_link_lib_4 -lbar_link_lib_4 -L"$(PWD)" + echo main | "$(TEST_HC)" --interactive -v0 $(filter-out -rtsopts, $(TEST_HC_OPTS)) -ignore-dot-ghci foo3.hs -lfoo_link_lib_4 -lbar_link_lib_4 -L"$(PWD)" # ----------------------------------------------------------------------------- # Testing RTS weak symbols resolution @@ -88,39 +88,39 @@ t_11223_link_order_b_a_2_succeed: t_11223_weak_only_link_fail: $(RM) -f power_w1.o power.hi power.o "$(GCC)" -c power.c -DWEAK -o power_w1.o - echo main | "$(TEST_HC)" --interactive -v0 $(filter-out -rtsopts, $(TEST_HC_OPTS)) power.hs power_w1.o + echo main | "$(TEST_HC)" --interactive -v0 $(filter-out -rtsopts, $(TEST_HC_OPTS)) -ignore-dot-ghci power.hs power_w1.o .PHONY: t_11223_weak_only_link_succeed t_11223_weak_only_link_succeed: $(RM) -f power_w2.o power3.hi power3.o "$(GCC)" -c power_slow.c -DWEAK -o power_w2.o - echo main | "$(TEST_HC)" --interactive -v0 $(filter-out -rtsopts, $(TEST_HC_OPTS)) power3.hs power_w2.o + echo main | "$(TEST_HC)" --interactive -v0 $(filter-out -rtsopts, $(TEST_HC_OPTS)) -ignore-dot-ghci power3.hs power_w2.o .PHONY: t_11223_weak_both_link_order_a_b_succeed t_11223_weak_both_link_order_a_b_succeed: $(RM) -f fast_power_w3.o slow_power_w3.o power3.hi power3.o "$(GCC)" -c power_slow.c -DWEAK -o slow_power_w3.o "$(GCC)" -c power.c -DWEAK -o fast_power_w3.o - echo main | "$(TEST_HC)" --interactive -v0 $(filter-out -rtsopts, $(TEST_HC_OPTS)) power3.hs fast_power_w3.o slow_power_w3.o + echo main | "$(TEST_HC)" --interactive -v0 $(filter-out -rtsopts, $(TEST_HC_OPTS)) -ignore-dot-ghci power3.hs fast_power_w3.o slow_power_w3.o .PHONY: t_11223_weak_both_link_order_b_a_succeed t_11223_weak_both_link_order_b_a_succeed: $(RM) -f fast_power_w4.o slow_power_w4.o power3.hi power3.o "$(GCC)" -c power_slow.c -DWEAK -o slow_power_w4.o "$(GCC)" -c power.c -DWEAK -o fast_power_w4.o - echo main | "$(TEST_HC)" --interactive -v0 $(filter-out -rtsopts, $(TEST_HC_OPTS)) power3.hs slow_power_w4.o fast_power_w4.o + echo main | "$(TEST_HC)" --interactive -v0 $(filter-out -rtsopts, $(TEST_HC_OPTS)) -ignore-dot-ghci power3.hs slow_power_w4.o fast_power_w4.o .PHONY: t_11223_weak_single_link_order_a_b_succeed t_11223_weak_single_link_order_a_b_succeed: $(RM) -f fast_power_w5.o slow_power_w5.o power3.hi power3.o "$(GCC)" -c power_slow.c -o slow_power_w5.o "$(GCC)" -c power.c -DWEAK -o fast_power_w5.o - echo main | "$(TEST_HC)" --interactive -v0 $(filter-out -rtsopts, $(TEST_HC_OPTS)) power3.hs fast_power_w5.o slow_power_w5.o + echo main | "$(TEST_HC)" --interactive -v0 $(filter-out -rtsopts, $(TEST_HC_OPTS)) -ignore-dot-ghci power3.hs fast_power_w5.o slow_power_w5.o .PHONY: t_11223_weak_single_link_order_b_a_succeed t_11223_weak_single_link_order_b_a_succeed: $(RM) -f fast_power_w6.o slow_power_w6.o power3.hi power3.o "$(GCC)" -c power_slow.c -DWEAK -o slow_power_w6.o "$(GCC)" -c power.c -o fast_power_w6.o - echo main | "$(TEST_HC)" --interactive -v0 $(filter-out -rtsopts, $(TEST_HC_OPTS)) power3.hs slow_power_w6.o fast_power_w6.o + echo main | "$(TEST_HC)" --interactive -v0 $(filter-out -rtsopts, $(TEST_HC_OPTS)) -ignore-dot-ghci power3.hs slow_power_w6.o fast_power_w6.o From git at git.haskell.org Thu Apr 28 18:14:11 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Apr 2016 18:14:11 +0000 (UTC) Subject: [commit: ghc] master: Testsuite: benign test fixes (b0569e8) Message-ID: <20160428181411.80E0F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b0569e881f66c3e987bc1108ad771a706399f5ff/ghc >--------------------------------------------------------------- commit b0569e881f66c3e987bc1108ad771a706399f5ff Author: Thomas Miedema Date: Thu Apr 28 17:08:53 2016 +0200 Testsuite: benign test fixes >--------------------------------------------------------------- b0569e881f66c3e987bc1108ad771a706399f5ff testsuite/tests/deSugar/should_fail/all.T | 2 +- testsuite/tests/gadt/gadt-fd.hs | 5 +++++ testsuite/tests/gadt/lazypatok.hs | 2 +- testsuite/tests/parser/unicode/all.T | 0 testsuite/tests/partial-sigs/should_compile/all.T | 1 - testsuite/tests/programs/okeefe_neural/test.T | 8 +++++++- testsuite/tests/rename/should_fail/all.T | 0 testsuite/tests/typecheck/T11824/all.T | 0 8 files changed, 14 insertions(+), 4 deletions(-) diff --git a/testsuite/tests/deSugar/should_fail/all.T b/testsuite/tests/deSugar/should_fail/all.T index 1a501ba..f403c74 100644 --- a/testsuite/tests/deSugar/should_fail/all.T +++ b/testsuite/tests/deSugar/should_fail/all.T @@ -3,4 +3,4 @@ # extra run flags # expected process return value, if not zero -test('DsStrictFail', expect_fail, compile_and_run, ['']) +test('DsStrictFail', exit_code(1), compile_and_run, ['']) diff --git a/testsuite/tests/gadt/gadt-fd.hs b/testsuite/tests/gadt/gadt-fd.hs index 7efac22..7d966c3 100644 --- a/testsuite/tests/gadt/gadt-fd.hs +++ b/testsuite/tests/gadt/gadt-fd.hs @@ -1,4 +1,9 @@ {-# LANGUAGE GADTs #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE KindSignatures #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE FunctionalDependencies #-} +{-# LANGUAGE UndecidableInstances #-} -- Trac #345 diff --git a/testsuite/tests/gadt/lazypatok.hs b/testsuite/tests/gadt/lazypatok.hs index 9903a66..44fae2f 100644 --- a/testsuite/tests/gadt/lazypatok.hs +++ b/testsuite/tests/gadt/lazypatok.hs @@ -1,6 +1,6 @@ {-# LANGUAGE GADTs #-} --- It's not clear whether this one should succed or fail, +-- It's not clear whether this one should succeed or fail, -- Arguably it should succeed because the type refinement on -- T1 should make (y::Int). Currently, though, it fails. diff --git a/testsuite/tests/partial-sigs/should_compile/all.T b/testsuite/tests/partial-sigs/should_compile/all.T index ba25a11..cc8f478 100644 --- a/testsuite/tests/partial-sigs/should_compile/all.T +++ b/testsuite/tests/partial-sigs/should_compile/all.T @@ -29,7 +29,6 @@ test('HigherRank1', normal, compile, ['-ddump-types -fno-warn-partial-type-signa test('HigherRank2', normal, compile, ['-ddump-types -fno-warn-partial-type-signatures']) test('LocalDefinitionBug', normal, compile, ['-ddump-types -fno-warn-partial-type-signatures']) test('Meltdown', normal, compile, ['-ddump-types -fno-warn-partial-type-signatures']) -# Bug test('MonoLocalBinds', normal, compile, ['-ddump-types -fno-warn-partial-type-signatures']) test('NamedTyVar', normal, compile, ['-ddump-types -fno-warn-partial-type-signatures']) test('NamedWildcardInDataFamilyInstanceLHS', normal, compile, ['-ddump-types -fno-warn-partial-type-signatures']) diff --git a/testsuite/tests/programs/okeefe_neural/test.T b/testsuite/tests/programs/okeefe_neural/test.T index e905ec0..e7e1f78 100644 --- a/testsuite/tests/programs/okeefe_neural/test.T +++ b/testsuite/tests/programs/okeefe_neural/test.T @@ -1,6 +1,12 @@ # this one causes the compiler to run out of heap in the simplifier +# TODO. What's the purpose of this test? If you give it 100Mb of heap, it +# compiles fine (though it takes a while). Is that too much? +# Does the fact that this test is marked expect_fail (instead of expect_broken) +# mean anything? +# Is it necessary to also run the resulting program? It doesn't seem to ever +# complete, at least not in a few minutes. What is the expected output? def set_opts( name, opts ): opts.expect = 'fail' @@ -9,4 +15,4 @@ test('okeefe_neural', set_opts, extra_clean(['Main.hi'])], multimod_compile_and_run, - ['Main', '-package lang +RTS -M64m -RTS']) + ['Main', '+RTS -M64m -RTS']) From git at git.haskell.org Thu Apr 28 19:15:51 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Apr 2016 19:15:51 +0000 (UTC) Subject: [commit: ghc] wip/no-telescope-tvs: Remove the incredibly hairy splitTelescopeTvs. (19b7ac2) Message-ID: <20160428191551.1D4883A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/no-telescope-tvs Link : http://ghc.haskell.org/trac/ghc/changeset/19b7ac29b5fce20c67474407144281a10940b44f/ghc >--------------------------------------------------------------- commit 19b7ac29b5fce20c67474407144281a10940b44f Author: Richard Eisenberg Date: Tue Apr 26 10:50:33 2016 -0400 Remove the incredibly hairy splitTelescopeTvs. This patch removes splitTelescopeTvs by adding information about scoped type variables to TcTyCon. Vast simplification! This also fixes #11821 by bringing only unzonked vars into scope. Test case: polykinds/T11821 >--------------------------------------------------------------- 19b7ac29b5fce20c67474407144281a10940b44f compiler/typecheck/TcHsType.hs | 411 ++++++++---------------------- compiler/typecheck/TcMType.hs | 10 +- compiler/typecheck/TcTyClsDecls.hs | 107 ++++---- compiler/typecheck/TcValidity.hs | 1 - compiler/types/TyCon.hs | 63 ++++- testsuite/tests/ghci/scripts/T7873.stderr | 9 +- testsuite/tests/polykinds/T11821.hs | 31 +++ testsuite/tests/polykinds/all.T | 1 + 8 files changed, 264 insertions(+), 369 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 19b7ac29b5fce20c67474407144281a10940b44f From git at git.haskell.org Thu Apr 28 19:15:54 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Apr 2016 19:15:54 +0000 (UTC) Subject: [commit: ghc] wip/no-telescope-tvs: Test #11484 in th/T11484 (b28d61d) Message-ID: <20160428191554.435E93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/no-telescope-tvs Link : http://ghc.haskell.org/trac/ghc/changeset/b28d61d9f97144c63d5adf3def4bf39e554476f6/ghc >--------------------------------------------------------------- commit b28d61d9f97144c63d5adf3def4bf39e554476f6 Author: Richard Eisenberg Date: Tue Apr 26 14:07:08 2016 -0400 Test #11484 in th/T11484 >--------------------------------------------------------------- b28d61d9f97144c63d5adf3def4bf39e554476f6 testsuite/tests/th/T11484.hs | 9 +++++++++ testsuite/tests/th/all.T | 1 + 2 files changed, 10 insertions(+) diff --git a/testsuite/tests/th/T11484.hs b/testsuite/tests/th/T11484.hs new file mode 100644 index 0000000..d8c0708 --- /dev/null +++ b/testsuite/tests/th/T11484.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE TypeInType #-} + +module T11484 where + +import Data.Kind + +type TySyn (k :: *) (a :: k) = () + +$([d| type TySyn2 (k :: *) (a :: k) = () |]) diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index 09960d1..a69f8a7 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -404,3 +404,4 @@ test('T11680', normal, compile_fail, ['-v0']) test('T11809', normal, compile, ['-v0']) test('T11797', normal, compile, ['-v0 -dsuppress-uniques']) test('T11941', normal, compile_fail, ['-v0']) +test('T11484', normal, compile, ['-v0']) From git at git.haskell.org Thu Apr 28 19:15:56 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Apr 2016 19:15:56 +0000 (UTC) Subject: [commit: ghc] wip/no-telescope-tvs's head updated: Test #11484 in th/T11484 (b28d61d) Message-ID: <20160428191556.E3C9E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/no-telescope-tvs' now includes: e8c04d4 Testsuite: Delete test for deprecated "packedstring" dadf82d Testsuite: fixup lots of tests 2a83713 Testsuite: delete Roles9.stderr fd5212f Testsuite: delete unused concurrent/prog002/FileIO.hs c9bcaf3 Kill varSetElemsWellScoped in quantifyTyVars e68195a RTS: Add setInCallCapability() 95f9334 GHCi: use real time instead of CPU time for :set -s d396996 Doc improvement for ApplicativeDo 24864ba Use __builtin_clz() to implement log_2() 0712f55 Just comments & reformatting 2dc5b92 Kill varSetElems in TcErrors 94320e1 Kill varSetElems try_tyvar_defaulting f13a8d2 Kill varSetElems in markNominal a48ebcc Implement the state hack without modifiyng OneShotInfo 5adf8f3 Document -fmax-pmcheck-iterations a bit better a0e1051 Recommend more reliable recourse for broken nm 57c636f Update nofib submodule to nofib master fa3ba06 Expand the comment on pprVarSet 82538f6 Kill varSetElems in injImproveEqns af6dced Comments only a2abcf6 Minor improvement to error message 1e86cab Comments only 9ed57d6 Remove unused unifyType_ 4c746cb Add missing solveEqualities 3dce4f2 Refactor RecordPatSynField, FieldLabel c4dd4ae Better documentation of -XConstrainedClassMethods c5b1014 Fix debug-only check in CoreLint 546f24e Revert "Use __builtin_clz() to implement log_2()" 3a53380 Kill unused foldOccSet 196ce62 Testsuite: delete accidentally committed .stderr.normalised file 89c6d07 Testsuite: add -ignore-dot-ghci to some ghci tests [skip ci] 9dc34d3 Testsuite: fix T11223_simple_(unused_)duplicate_lib b0569e8 Testsuite: benign test fixes 19b7ac2 Remove the incredibly hairy splitTelescopeTvs. b28d61d Test #11484 in th/T11484 From git at git.haskell.org Thu Apr 28 20:30:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Apr 2016 20:30:03 +0000 (UTC) Subject: [commit: ghc] master: Add uniqSetAny and uniqSetAll and use them (3c426b0) Message-ID: <20160428203003.ED9763A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3c426b0552dffa82f1663f2eca19188afe247865/ghc >--------------------------------------------------------------- commit 3c426b0552dffa82f1663f2eca19188afe247865 Author: Bartosz Nitka Date: Thu Apr 28 13:32:39 2016 -0700 Add uniqSetAny and uniqSetAll and use them There are couple of places where we do `foldUniqSet` just to compute `any` or `all`. `foldUniqSet` is non-deterministic in the general case and `any` and `all` also read nicer. Test Plan: ./validate Reviewers: simonmar, goldfire, simonpj, bgamari, austin Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2156 GHC Trac Issues: #4012 >--------------------------------------------------------------- 3c426b0552dffa82f1663f2eca19188afe247865 compiler/basicTypes/NameSet.hs | 7 +++++++ compiler/basicTypes/VarSet.hs | 7 +++++++ compiler/rename/RnSource.hs | 3 +-- compiler/specialise/Rules.hs | 2 +- compiler/typecheck/TcBinds.hs | 2 +- compiler/typecheck/TcErrors.hs | 2 +- compiler/types/Unify.hs | 4 ++-- compiler/utils/UniqFM.hs | 10 +++++++++- compiler/utils/UniqSet.hs | 8 +++++++- 9 files changed, 36 insertions(+), 9 deletions(-) diff --git a/compiler/basicTypes/NameSet.hs b/compiler/basicTypes/NameSet.hs index 574c3a4..b332fe2 100644 --- a/compiler/basicTypes/NameSet.hs +++ b/compiler/basicTypes/NameSet.hs @@ -13,6 +13,7 @@ module NameSet ( minusNameSet, elemNameSet, nameSetElems, extendNameSet, extendNameSetList, delFromNameSet, delListFromNameSet, isEmptyNameSet, foldNameSet, filterNameSet, intersectsNameSet, intersectNameSet, + nameSetAny, nameSetAll, -- * Free variables FreeVars, @@ -85,6 +86,12 @@ delListFromNameSet set ns = foldl delFromNameSet set ns intersectsNameSet s1 s2 = not (isEmptyNameSet (s1 `intersectNameSet` s2)) +nameSetAny :: (Name -> Bool) -> NameSet -> Bool +nameSetAny = uniqSetAny + +nameSetAll :: (Name -> Bool) -> NameSet -> Bool +nameSetAll = uniqSetAll + {- ************************************************************************ * * diff --git a/compiler/basicTypes/VarSet.hs b/compiler/basicTypes/VarSet.hs index f61bbbe..57369f3 100644 --- a/compiler/basicTypes/VarSet.hs +++ b/compiler/basicTypes/VarSet.hs @@ -17,6 +17,7 @@ module VarSet ( intersectVarSet, intersectsVarSet, disjointVarSet, isEmptyVarSet, delVarSet, delVarSetList, delVarSetByKey, minusVarSet, foldVarSet, filterVarSet, + varSetAny, varSetAll, transCloVarSet, fixVarSet, lookupVarSet, lookupVarSetByName, mapVarSet, sizeVarSet, seqVarSet, @@ -134,6 +135,12 @@ intersectsVarSet s1 s2 = not (s1 `disjointVarSet` s2) disjointVarSet s1 s2 = disjointUFM s1 s2 subVarSet s1 s2 = isEmptyVarSet (s1 `minusVarSet` s2) +varSetAny :: (Var -> Bool) -> VarSet -> Bool +varSetAny = uniqSetAny + +varSetAll :: (Var -> Bool) -> VarSet -> Bool +varSetAll = uniqSetAll + fixVarSet :: (VarSet -> VarSet) -- Map the current set to a new set -> VarSet -> VarSet -- (fixVarSet f s) repeatedly applies f to the set s, diff --git a/compiler/rename/RnSource.hs b/compiler/rename/RnSource.hs index eb1494f..f92bae9 100644 --- a/compiler/rename/RnSource.hs +++ b/compiler/rename/RnSource.hs @@ -1420,8 +1420,7 @@ addBootDeps ds_w_fvs | otherwise = pr has_local_imports fvs - = foldNameSet ((||) . nameIsHomePackageImport this_mod) - False fvs + = nameSetAny (nameIsHomePackageImport this_mod) fvs ; return (add_boot_deps ds_w_fvs) } diff --git a/compiler/specialise/Rules.hs b/compiler/specialise/Rules.hs index 3adad1c..f9f195f 100644 --- a/compiler/specialise/Rules.hs +++ b/compiler/specialise/Rules.hs @@ -855,7 +855,7 @@ match_alts _ _ _ _ ------------------------------------------ okToFloat :: RnEnv2 -> VarSet -> Bool okToFloat rn_env bind_fvs - = foldVarSet ((&&) . not_captured) True bind_fvs + = varSetAll not_captured bind_fvs where not_captured fv = not (inRnEnvR rn_env fv) diff --git a/compiler/typecheck/TcBinds.hs b/compiler/typecheck/TcBinds.hs index ac19061..aef80a8 100644 --- a/compiler/typecheck/TcBinds.hs +++ b/compiler/typecheck/TcBinds.hs @@ -1973,7 +1973,7 @@ isClosedBndrGroup binds = do fvs _ = emptyNameSet is_closed_ns :: TcTypeEnv -> NameSet -> Bool -> Bool - is_closed_ns type_env ns b = foldNameSet ((&&) . is_closed_id type_env) b ns + is_closed_ns type_env ns b = b && nameSetAll (is_closed_id type_env) ns -- ns are the Names referred to from the RHS of this bind is_closed_id :: TcTypeEnv -> Name -> Bool diff --git a/compiler/typecheck/TcErrors.hs b/compiler/typecheck/TcErrors.hs index b51a267..78320c4 100644 --- a/compiler/typecheck/TcErrors.hs +++ b/compiler/typecheck/TcErrors.hs @@ -2328,7 +2328,7 @@ pprPotentials dflags sty herald insts -- are lexically in scope; these instances are likely -- to be more useful inst_in_scope :: ClsInst -> Bool - inst_in_scope cls_inst = foldNameSet ((&&) . name_in_scope) True $ + inst_in_scope cls_inst = nameSetAll name_in_scope $ orphNamesOfTypes (is_tys cls_inst) name_in_scope name diff --git a/compiler/types/Unify.hs b/compiler/types/Unify.hs index dadb8e3..381f948 100644 --- a/compiler/types/Unify.hs +++ b/compiler/types/Unify.hs @@ -454,7 +454,7 @@ niFixTCvSubst tenv = f tenv | not_fixpoint = f (mapVarEnv (substTy subst') tenv) | otherwise = subst where - not_fixpoint = foldVarSet ((||) . in_domain) False range_tvs + not_fixpoint = varSetAny in_domain range_tvs in_domain tv = tv `elemVarEnv` tenv range_tvs = foldVarEnv (unionVarSet . tyCoVarsOfType) emptyVarSet tenv @@ -1140,7 +1140,7 @@ ty_co_match menv subst ty co lkco rkco = noneSet (\v -> elemVarEnv v env) set noneSet :: (Var -> Bool) -> VarSet -> Bool - noneSet f = foldVarSet (\v rest -> rest && (not $ f v)) True + noneSet f = varSetAll (not . f) ty_co_match menv subst ty co lkco rkco | CastTy ty' co' <- ty diff --git a/compiler/utils/UniqFM.hs b/compiler/utils/UniqFM.hs index 10cc179..ed82fee 100644 --- a/compiler/utils/UniqFM.hs +++ b/compiler/utils/UniqFM.hs @@ -56,7 +56,7 @@ module UniqFM ( intersectUFM, intersectUFM_C, disjointUFM, - foldUFM, foldUFM_Directly, + foldUFM, foldUFM_Directly, anyUFM, allUFM, mapUFM, mapUFM_Directly, elemUFM, elemUFM_Directly, filterUFM, filterUFM_Directly, partitionUFM, @@ -275,6 +275,8 @@ intersectUFM_C f (UFM x) (UFM y) = UFM (M.intersectionWith f x y) disjointUFM (UFM x) (UFM y) = M.null (M.intersection x y) foldUFM k z (UFM m) = M.fold k z m + + foldUFM_Directly k z (UFM m) = M.foldWithKey (k . getUnique) z m mapUFM f (UFM m) = UFM (M.map f m) mapUFM_Directly f (UFM m) = UFM (M.mapWithKey (f . getUnique) m) @@ -298,6 +300,12 @@ eltsUFM (UFM m) = M.elems m ufmToSet_Directly (UFM m) = M.keysSet m ufmToList (UFM m) = map (\(k, v) -> (getUnique k, v)) $ M.toList m +anyUFM :: (elt -> Bool) -> UniqFM elt -> Bool +anyUFM p (UFM m) = M.fold ((||) . p) False m + +allUFM :: (elt -> Bool) -> UniqFM elt -> Bool +allUFM p (UFM m) = M.fold ((&&) . p) True m + ufmToIntMap :: UniqFM elt -> M.IntMap elt ufmToIntMap (UFM m) = m diff --git a/compiler/utils/UniqSet.hs b/compiler/utils/UniqSet.hs index a3d503f..c1d19b3 100644 --- a/compiler/utils/UniqSet.hs +++ b/compiler/utils/UniqSet.hs @@ -22,7 +22,7 @@ module UniqSet ( unionUniqSets, unionManyUniqSets, minusUniqSet, intersectUniqSets, - foldUniqSet, + foldUniqSet, uniqSetAny, uniqSetAll, mapUniqSet, elementOfUniqSet, elemUniqSet_Directly, @@ -113,3 +113,9 @@ sizeUniqSet = sizeUFM isEmptyUniqSet = isNullUFM lookupUniqSet = lookupUFM uniqSetToList = eltsUFM + +uniqSetAny :: (a -> Bool) -> UniqSet a -> Bool +uniqSetAny = anyUFM + +uniqSetAll :: (a -> Bool) -> UniqSet a -> Bool +uniqSetAll = allUFM From git at git.haskell.org Thu Apr 28 20:35:20 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Apr 2016 20:35:20 +0000 (UTC) Subject: [commit: ghc] master: Kill mapUniqSet (7312923) Message-ID: <20160428203520.B7E253A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/731292317a928e397478377d4273f22213658cbe/ghc >--------------------------------------------------------------- commit 731292317a928e397478377d4273f22213658cbe Author: Bartosz Nitka Date: Thu Apr 28 13:35:14 2016 -0700 Kill mapUniqSet Note [Unsound mapUniqSet] explains why it got removed. Test Plan: build ghc Reviewers: simonpj, austin, bgamari Reviewed By: bgamari Subscribers: thomie, simonmar Differential Revision: https://phabricator.haskell.org/D2152 >--------------------------------------------------------------- 731292317a928e397478377d4273f22213658cbe compiler/basicTypes/VarSet.hs | 7 ++++--- compiler/nativeGen/RegAlloc/Graph/SpillCost.hs | 8 ++------ compiler/utils/UniqSet.hs | 12 +++++++++--- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/compiler/basicTypes/VarSet.hs b/compiler/basicTypes/VarSet.hs index 57369f3..31718f6 100644 --- a/compiler/basicTypes/VarSet.hs +++ b/compiler/basicTypes/VarSet.hs @@ -20,7 +20,7 @@ module VarSet ( varSetAny, varSetAll, transCloVarSet, fixVarSet, lookupVarSet, lookupVarSetByName, - mapVarSet, sizeVarSet, seqVarSet, + sizeVarSet, seqVarSet, elemVarSetByKey, partitionVarSet, pluralVarSet, pprVarSet, @@ -87,7 +87,6 @@ lookupVarSet :: VarSet -> Var -> Maybe Var -- Returns the set element, which may be -- (==) to the argument, but not the same as lookupVarSetByName :: VarSet -> Name -> Maybe Var -mapVarSet :: (Var -> Var) -> VarSet -> VarSet sizeVarSet :: VarSet -> Int filterVarSet :: (Var -> Bool) -> VarSet -> VarSet extendVarSet_C :: (Var->Var->Var) -> VarSet -> Var -> VarSet @@ -120,7 +119,6 @@ mkVarSet = mkUniqSet foldVarSet = foldUniqSet lookupVarSet = lookupUniqSet lookupVarSetByName = lookupUniqSet -mapVarSet = mapUniqSet sizeVarSet = sizeUniqSet filterVarSet = filterUniqSet extendVarSet_C = addOneToUniqSet_C @@ -141,6 +139,9 @@ varSetAny = uniqSetAny varSetAll :: (Var -> Bool) -> VarSet -> Bool varSetAll = uniqSetAll +-- There used to exist mapVarSet, see Note [Unsound mapUniqSet] in UniqSet for +-- why it got removed. + fixVarSet :: (VarSet -> VarSet) -- Map the current set to a new set -> VarSet -> VarSet -- (fixVarSet f s) repeatedly applies f to the set s, diff --git a/compiler/nativeGen/RegAlloc/Graph/SpillCost.hs b/compiler/nativeGen/RegAlloc/Graph/SpillCost.hs index a797514..8860ebc 100644 --- a/compiler/nativeGen/RegAlloc/Graph/SpillCost.hs +++ b/compiler/nativeGen/RegAlloc/Graph/SpillCost.hs @@ -136,12 +136,8 @@ slurpSpillCostInfo platform cmm -- | Take all the virtual registers from this set. takeVirtuals :: UniqSet Reg -> UniqSet VirtualReg -takeVirtuals set - = mapUniqSet get_virtual - $ filterUniqSet isVirtualReg set - where - get_virtual (RegVirtual vr) = vr - get_virtual _ = panic "getVirt" +takeVirtuals set = mkUniqSet + [ vr | RegVirtual vr <- uniqSetToList set ] -- | Choose a node to spill from this graph diff --git a/compiler/utils/UniqSet.hs b/compiler/utils/UniqSet.hs index c1d19b3..a316f53 100644 --- a/compiler/utils/UniqSet.hs +++ b/compiler/utils/UniqSet.hs @@ -23,7 +23,6 @@ module UniqSet ( minusUniqSet, intersectUniqSets, foldUniqSet, uniqSetAny, uniqSetAll, - mapUniqSet, elementOfUniqSet, elemUniqSet_Directly, filterUniqSet, @@ -63,7 +62,6 @@ minusUniqSet :: UniqSet a -> UniqSet a -> UniqSet a intersectUniqSets :: UniqSet a -> UniqSet a -> UniqSet a foldUniqSet :: (a -> b -> b) -> b -> UniqSet a -> b -mapUniqSet :: (a -> b) -> UniqSet a -> UniqSet b elementOfUniqSet :: Uniquable a => a -> UniqSet a -> Bool elemUniqSet_Directly :: Unique -> UniqSet a -> Bool filterUniqSet :: (a -> Bool) -> UniqSet a -> UniqSet a @@ -82,6 +80,15 @@ uniqSetToList :: UniqSet a -> [a] ************************************************************************ -} +-- Note [Unsound mapUniqSet] +-- ~~~~~~~~~~~~~~~~~~~~~~~~~ +-- UniqSet has the following invariant: +-- The keys in the map are the uniques of the values +-- It means that to implement mapUniqSet you'd have to update +-- both the keys and the values. There used to be an implementation +-- that only updated the values and it's been removed, because it broke +-- the invariant. + type UniqSet a = UniqFM a emptyUniqSet = emptyUFM @@ -103,7 +110,6 @@ minusUniqSet = minusUFM intersectUniqSets = intersectUFM foldUniqSet = foldUFM -mapUniqSet = mapUFM elementOfUniqSet = elemUFM elemUniqSet_Directly = elemUFM_Directly filterUniqSet = filterUFM From git at git.haskell.org Thu Apr 28 21:09:32 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Apr 2016 21:09:32 +0000 (UTC) Subject: [commit: ghc] master: Testsuite: delete -fesc tests (32c0aba) Message-ID: <20160428210932.918513A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/32c0aba19d2b482e6ac2dffdb54d50a1472f7d07/ghc >--------------------------------------------------------------- commit 32c0aba19d2b482e6ac2dffdb54d50a1472f7d07 Author: Thomas Miedema Date: Mon Apr 25 20:28:23 2016 +0200 Testsuite: delete -fesc tests The -fesc flag does not exist, and has never existed. Also delete now unused config.compiler_tags, and 'Project version' never contains a '-'. Reviewed by: bgamari Differential Revision: https://phabricator.haskell.org/D2138 >--------------------------------------------------------------- 32c0aba19d2b482e6ac2dffdb54d50a1472f7d07 testsuite/config/ghc | 7 +++---- testsuite/driver/testglobals.py | 1 - testsuite/driver/testlib.py | 3 --- testsuite/tests/esc/F123.hs | 28 ---------------------------- testsuite/tests/esc/Makefile | 3 --- testsuite/tests/esc/Sum.hs | 22 ---------------------- testsuite/tests/esc/TestData.hs | 37 ------------------------------------- testsuite/tests/esc/TestDataCon.hs | 25 ------------------------- testsuite/tests/esc/TestImport.hs | 27 --------------------------- testsuite/tests/esc/TestList.hs | 24 ------------------------ testsuite/tests/esc/all.T | 5 ----- testsuite/tests/esc/synonym.hs | 10 ---------- 12 files changed, 3 insertions(+), 189 deletions(-) diff --git a/testsuite/config/ghc b/testsuite/config/ghc index 7d32e35..26ce3bd 100644 --- a/testsuite/config/ghc +++ b/testsuite/config/ghc @@ -172,10 +172,9 @@ def get_compiler_info(): config.libdir = compilerInfoDict['LibDir'] - v = compilerInfoDict["Project version"].split('-') - config.compiler_version = v[0] - config.compiler_maj_version = re.sub('^([0-9]+\.[0-9]+).*',r'\1', v[0]) - config.compiler_tags = v[1:] + v = compilerInfoDict["Project version"] + config.compiler_version = v + config.compiler_maj_version = re.sub('^([0-9]+\.[0-9]+).*',r'\1', v) # -fno-ghci-history was added in 7.3 if version_ge(config.compiler_version, '7.3'): diff --git a/testsuite/driver/testglobals.py b/testsuite/driver/testglobals.py index 6f8dd64..2c7f551 100644 --- a/testsuite/driver/testglobals.py +++ b/testsuite/driver/testglobals.py @@ -68,7 +68,6 @@ class TestConfig: # Compiler version info self.compiler_version = '' self.compiler_maj_version = '' - self.compiler_tags = [] # Flags we always give to this compiler self.compiler_always_flags = [] diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index bba3516..c69c874 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -375,9 +375,6 @@ def compiler_profiled( ): def compiler_debugged( ): return config.compiler_debugged -def tag( t ): - return t in config.compiler_tags - # --- def high_memory_usage(name, opts): diff --git a/testsuite/tests/esc/F123.hs b/testsuite/tests/esc/F123.hs deleted file mode 100644 index 6aaad16..0000000 --- a/testsuite/tests/esc/F123.hs +++ /dev/null @@ -1,28 +0,0 @@ -module F123 where - - - -data A = A1 | A2 -data B = B1 | B2 - -{-# CONTRACT h1 :: {x | noA2 x} -> {r | yesA2 r} #-} -h1 :: A -> A -h1 A1 = A2 - - -noA2 A1 = True -noA2 A2 = False - -yesA2 A1 = False -yesA2 A2 = True - -f3 x y = case y of - B1 -> f2 x y - -f2 x y = case y of - B1 -> f1 x - -f1 x = h1 A2 - - - diff --git a/testsuite/tests/esc/Makefile b/testsuite/tests/esc/Makefile deleted file mode 100644 index 9a36a1c..0000000 --- a/testsuite/tests/esc/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -TOP=../.. -include $(TOP)/mk/boilerplate.mk -include $(TOP)/mk/test.mk diff --git a/testsuite/tests/esc/Sum.hs b/testsuite/tests/esc/Sum.hs deleted file mode 100644 index 2b9ee29..0000000 --- a/testsuite/tests/esc/Sum.hs +++ /dev/null @@ -1,22 +0,0 @@ -module Sum where - -{-- {-# SPECIALISE f :: Int -> Int #-} --- {-# CONTRACT f :: x:{y | y > 0} -> {r | r == x + 1} #-} --- {-# CONTRACT f :: x:{y | y > 0} -> {y | y > 0} -> {r | r == x + 1} #-} --- {-# CONTRACT f :: any -> {y | y > 0} #-} --- {-# CONTRACT f :: {y | y > 0} -> _ #-} -{-# CONTRACT inc :: {y | y > 0} -> {r | r > 1} #-} -inc :: Int -> Int -inc x = x + 1 - --} --- {-# CONTRACT sum2 :: x:{y | y > 0} -> {y | y > x} -> {r | r > 0} #-} --- {-# CONTRACT sum2 :: x:{y | y > 0} -> {y | y > x} -> _ #-} -sum2 :: Int -> Int -> Int -sum2 x y = x + y - -{- -t1 = inc 5 -t2a = sum2 (inc 5) 2 -t2b = sum2 (inc 5) 6 --} diff --git a/testsuite/tests/esc/TestData.hs b/testsuite/tests/esc/TestData.hs deleted file mode 100644 index 045f3c9..0000000 --- a/testsuite/tests/esc/TestData.hs +++ /dev/null @@ -1,37 +0,0 @@ -module TestData where - -data A = A1 | A2 - - --- If we put noA2 and yesA2 here, they are out of scope --- in ESC's eyes. i.e. they are not in EscEnv.vals -{- -noA2 A1 = True -noA2 A2 = False - -yesA2 A1 = False -yesA2 A2 = True --} - -{-# CONTRACT h1 :: {x | noA2 x} -> {r | yesA2 r} #-} -h1 :: A -> A -h1 A1 = A2 - -g1 :: A -> A -g1 A1 = A1 -g1 A2 = A1 - -{-# CONTRACT h2 :: {x | not1 (noA2 x)} -> {r | not1 (yesA2 r)} #-} -h2 :: A -> A -h2 A2 = A1 - -noA2 A1 = True -noA2 A2 = False - -yesA2 A1 = False -yesA2 A2 = True - -not1 True = False -not1 False = True - -test = h1 (g1 A2) diff --git a/testsuite/tests/esc/TestDataCon.hs b/testsuite/tests/esc/TestDataCon.hs deleted file mode 100644 index e5b66eb..0000000 --- a/testsuite/tests/esc/TestDataCon.hs +++ /dev/null @@ -1,25 +0,0 @@ -module TestDataCon where - -{-# CONTRACT g1 :: ({x | x>0}, any) -> {r | r>0} #-} -g1 :: (Int, Int) -> Int -g1 (x,y) = x -{-# CONTRACT g2 :: (any, {y | y>0}) -> {r | r>0} #-} -g2 :: (Int, Int) -> Int -g2 (x,y) = y - -bad = error "bad!" - -t1 = g1 (5, bad) -t2 = g2 (bad, 6) -t3 = g1 (bad, 7) -t4 = g1 (-1, 6) -- seems inlining is done. - -{- -data A a = B a | C a Int - -{-# CONTRACT g :: B {x | x>0} -> any #-} -g :: B Int -> Int -g (B x) = x - - --} diff --git a/testsuite/tests/esc/TestImport.hs b/testsuite/tests/esc/TestImport.hs deleted file mode 100644 index bf91eaf..0000000 --- a/testsuite/tests/esc/TestImport.hs +++ /dev/null @@ -1,27 +0,0 @@ -module TestImport where - -import TestList - -{-# CONTRACT t2 :: _ #-} -t2 = head1 [True] -- same as TestList res2 - -{-# CONTRACT t3 :: {x | True} #-} -t3 = head1 [True] -- same as TestList.res3 - -t4 = head1 [] -- same as TestList.res4 - -t5 = head1 [True] -- same as TestList.res5 - -t2a = res2 -t3a = res3 -t4a = res4 -t5a = res5 - -{-# CONTRACT tail1 :: {xs | not1 (null1 xs)} -> {r | True} #-} -tail1 :: [Int] -> [Int] -tail1 (x:xs) = xs - -{-# CONTRACT tail2 :: {xs | not (null xs)} -> {r | True} #-} -tail2 :: [Int] -> [Int] -tail2 (x:xs) = xs - diff --git a/testsuite/tests/esc/TestList.hs b/testsuite/tests/esc/TestList.hs deleted file mode 100644 index 66f9df2..0000000 --- a/testsuite/tests/esc/TestList.hs +++ /dev/null @@ -1,24 +0,0 @@ -module TestList where - -{-# CONTRACT head1 :: {ys | not1 (null1 ys)} -> {r | True} #-} --- {-# CONTRACT head1 :: {xs | not (null xs)} -> {r | True} #-} -head1 :: [Bool] -> Bool -head1 (x:xs) = x - -not1 True = False -not1 False = True - -null1 [] = True -null1 xs = False - -{-# CONTRACT res2 :: _ #-} -res2 = head1 [True] - -{-# CONTRACT res3 :: {x | True} #-} -res3 = head1 [True] - -res4 = head1 [] - -res5 = head1 [True] - - diff --git a/testsuite/tests/esc/all.T b/testsuite/tests/esc/all.T deleted file mode 100644 index 31a4ba5..0000000 --- a/testsuite/tests/esc/all.T +++ /dev/null @@ -1,5 +0,0 @@ -esc = unless(tag('esc'), skip) - -test('TestList', esc, compile, ['-fesc']) -test('TestImport', esc, compile, ['-fesc']) -test('TestData', esc, compile, ['-fesc']) diff --git a/testsuite/tests/esc/synonym.hs b/testsuite/tests/esc/synonym.hs deleted file mode 100644 index 24b035c..0000000 --- a/testsuite/tests/esc/synonym.hs +++ /dev/null @@ -1,10 +0,0 @@ -{-# TYPE nat = {x | x > 0} #-} -{-# TYPE notNull = {xs | not (null xs)} #-} - -{-# CONTRACT f :: nat -> nat #-} -f :: Int -> Int -f x = x - -{-# CONTRACT g :: notNull -> any #-} -g :: [Int] -> Int -g (x:xs) = x From git at git.haskell.org Thu Apr 28 21:09:35 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Apr 2016 21:09:35 +0000 (UTC) Subject: [commit: ghc] master: Testsuite: delete T5054 and T5054_2 (#5054) (e20b3ed) Message-ID: <20160428210935.416F53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e20b3ed0d0a3eda9b52544f06694667ddc2dd3a1/ghc >--------------------------------------------------------------- commit e20b3ed0d0a3eda9b52544f06694667ddc2dd3a1 Author: Thomas Miedema Date: Mon Apr 25 17:22:55 2016 +0200 Testsuite: delete T5054 and T5054_2 (#5054) These tests no longer compile, because the hmatrix api has completely changed. Even if we managed to fix the tests, I don't think they would provided much value, since the ghc/llvm bug from #5054 was not reproducible in the first place. Reviewed by: bgamari Differential Revision: https://phabricator.haskell.org/D2139 >--------------------------------------------------------------- e20b3ed0d0a3eda9b52544f06694667ddc2dd3a1 testsuite/tests/llvm/should_compile/T5054.hs | 55 --------- testsuite/tests/llvm/should_compile/T5054_2.hs | 157 ------------------------- testsuite/tests/llvm/should_compile/all.T | 2 - 3 files changed, 214 deletions(-) diff --git a/testsuite/tests/llvm/should_compile/T5054.hs b/testsuite/tests/llvm/should_compile/T5054.hs deleted file mode 100644 index 79b01f6..0000000 --- a/testsuite/tests/llvm/should_compile/T5054.hs +++ /dev/null @@ -1,55 +0,0 @@ -{-# OPTIONS_GHC -W #-} - -import Data.Int -import Data.Packed -import Data.Packed.ST -import Control.Monad.ST -import Foreign.Storable -import Foreign.Ptr -import Foreign.Marshal.Utils - -main :: IO () -main = print $ arst (zeroMatrix 10 10) (Constant 9) - -data ComputeElement - = Constant !Double - | Value !Double - deriving (Eq) - -isConstant (Constant _) = True -isConstant _ = False - -instance Element ComputeElement - -fromComputeElement (Constant v) = v -fromComputeElement (Value v) = v - -sizeofDouble = sizeOf (undefined :: Double) -sizeofInt64 = sizeOf (undefined :: Int64) - -instance Storable ComputeElement where - sizeOf _ = sizeofDouble + sizeofInt64 - alignment _ = 16 - - peek p = do - v <- peek (castPtr p) - c <- peek (castPtr (p `plusPtr` sizeofDouble)) - return $ if toBool (c :: Int64) - then Constant v - else Value v - - poke p v = do - let c :: Int64 - c = fromBool (isConstant v) - poke (castPtr p) (fromComputeElement v) - poke (castPtr p `plusPtr` sizeofDouble) c - - -arst mat v = runST $ do - mat' <- thawMatrix mat - writeMatrix mat' 1 2 v - x <- fromComputeElement `fmap` readMatrix mat' 1 9 - return (x > 0) - -zeroMatrix m n = buildMatrix m n (const (Value 0)) - diff --git a/testsuite/tests/llvm/should_compile/T5054_2.hs b/testsuite/tests/llvm/should_compile/T5054_2.hs deleted file mode 100644 index 29a7ed8..0000000 --- a/testsuite/tests/llvm/should_compile/T5054_2.hs +++ /dev/null @@ -1,157 +0,0 @@ -{-# LANGUAGE NoMonomorphismRestriction #-} -{-# OPTIONS_GHC -W #-} - -import Data.Int -import Data.Packed -import Data.Packed.ST -import Control.Applicative -import Control.Monad -import Control.Monad.ST -import Foreign.Storable -import Foreign.Ptr -import Foreign.Marshal.Utils - -import Control.Parallel.Strategies - -import Graphics.Plot - - -main :: IO () -main = let whee = jacobiST zeroRho (0, 1) (constLeftBorder 100 128) - in writeFile "Something.pgm" $ matrixToPGM (computeElementMatrixToDouble whee) - -inParallel = parMap rwhnf id - -zeroMatrix m n = buildMatrix m n (const 0) - -twoMatrix m n = buildMatrix m n (const (Value 2)) - -data ComputeElement = Constant !Double - | Value !Double - deriving (Eq) - --- We don't care about showing if it's constant or not -instance Show ComputeElement where - show (Constant v) = show v - show (Value v) = show v - -instance Element ComputeElement - -isConstant (Constant _) = True -isConstant _ = False - -fromComputeElement (Constant v) = v -fromComputeElement (Value v) = v - -sizeofDouble = sizeOf (undefined :: Double) -sizeofInt64 = sizeOf (undefined :: Int64) - -instance Storable ComputeElement where - sizeOf _ = sizeofDouble + sizeofInt64 - alignment _ = 16 - - peek p = do v <- peek (castPtr p) - c <- peek (castPtr (p `plusPtr` sizeofDouble)) - return $ if toBool (c :: Int64) - then Constant v - else Value v - - poke p v = do let c :: Int64 - c = fromBool (isConstant v) - poke (castPtr p) (fromComputeElement v) - poke (castPtr p `plusPtr` sizeofDouble) c - -jacobi :: Element a => Int -> Matrix a -> Matrix a -jacobi n mat = undefined - where - core = subMatrix (1, 1) (rows mat - 1, cols mat - 1) mat - -applyComputeElement _ v@(Constant _) = v -applyComputeElement f (Value v) = Value (f v) - - -writeMatrix' = uncurry . writeMatrix -readMatrix' = uncurry . readMatrix - -zeroRho _ _ = 0 - -type STComputeMatrix s = STMatrix s ComputeElement - -type RelaxationFunction s = STComputeMatrix s -- initial matrix - -> STComputeMatrix s -- new matrix - -> Int -- i - -> Int -- j - -> ST s Double -- new element - -applyMethod :: RelaxationFunction s -> STComputeMatrix s -> STComputeMatrix s -> Int -> Int -> ST s () -applyMethod f mat mat' i j = do - c <- readMatrix mat i j - u <- f mat mat' i j - writeMatrix mat' i j $ if isConstant c - then c - else Value u - -{-# INLINE readElement #-} -readElement mat x y = fromComputeElement <$> readMatrix mat x y - -jacobiST :: (Double -> Double -> Double) -> (Double, Double) -> Matrix ComputeElement -> Matrix ComputeElement -jacobiST rho (rangeX, rangeY) origMat = runST $ do - let m = rows origMat - n = cols origMat - - dx = rangeX / fromIntegral (m - 1) - dy = rangeY / fromIntegral (n - 1) - dd = dx * dy - - rs = [1 .. (m - 2)] -- without borders - cs = [1 .. (n - 2)] - - evalRho i j = rho (fromIntegral i * dx) (fromIntegral j * dy) - - gaussSeidel f mat mat' i j = do - -- Read from old matrix - a1 <- readElement mat (i + 1) j - a2 <- readElement mat i (j + 1) - - -- Read from new matrix - b1 <- readElement mat' (i - 1) j - b2 <- readElement mat' i (j - 1) - let f = evalRho i j - u = 0.25 * (a1 + a2 + b1 + b2) + (pi * f * dd) - return u - - - jacobi mat mat' i j = do - a <- readElement mat (i + 1) j - b <- readElement mat (i - 1) j - c <- readElement mat i (j + 1) - d <- readElement mat i (j - 1) - - let f = evalRho i j - u = 0.25 * (a + b + c + d) + (pi * f * dd) - return u - - jacobiThings = applyMethod jacobi - - --iterateJacobi mat mat' = sequence_ [jacobiThings mat mat' r c | r <- rs, c <- cs] - - -- faster - iterateJacobi mat mat' = sequence_ $ map (uncurry (jacobiThings mat mat')) [(r, c) | r <- rs, c <- cs] - - -- Swap the matrices. Iterations will be an event number, 2 * n - iterateNJacobi n mat mat' = replicateM n (iterateJacobi mat mat' >> iterateJacobi mat' mat) - - mat <- thawMatrix origMat - mat' <- thawMatrix origMat - - iterateNJacobi 4000 mat mat' - - freezeMatrix mat' - -constLeftBorder v n = fromColumns (border:replicate (n - 1) rest) - where border = buildVector n (const (Constant v)) - rest = buildVector n (const (Value 0)) - -computeElementMatrixToDouble :: Matrix ComputeElement -> Matrix Double -computeElementMatrixToDouble = liftMatrix (mapVector fromComputeElement) - diff --git a/testsuite/tests/llvm/should_compile/all.T b/testsuite/tests/llvm/should_compile/all.T index 6806c25..0708615 100644 --- a/testsuite/tests/llvm/should_compile/all.T +++ b/testsuite/tests/llvm/should_compile/all.T @@ -5,8 +5,6 @@ def f( name, opts ): setTestOpts(f) -test('T5054', reqlib('hmatrix'), compile, ['-package hmatrix']) -test('T5054_2', reqlib('hmatrix'), compile, ['-package hmatrix']) # test('T5486', reqlib('integer-gmp'), compile, ['']) test('T5681', normal, compile, ['']) test('T6158', [reqlib('vector'), reqlib('primitive')], compile, ['-package vector -package primitive']) From git at git.haskell.org Thu Apr 28 21:40:15 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Apr 2016 21:40:15 +0000 (UTC) Subject: [commit: ghc] master: rts/LdvProfile.c: Fix NULL dereference on shutdown (bcfee21) Message-ID: <20160428214015.95C7B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/bcfee2181e7b7edfea3473ec408a3a2a1815ecff/ghc >--------------------------------------------------------------- commit bcfee2181e7b7edfea3473ec408a3a2a1815ecff Author: Erik de Castro Lopo Date: Fri Apr 29 07:15:53 2016 +1000 rts/LdvProfile.c: Fix NULL dereference on shutdown Test Plan: validate Reviewers: carter, austin, simonmar, bgamari Reviewed By: simonmar, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2154 GHC Trac Issues: #11978 >--------------------------------------------------------------- bcfee2181e7b7edfea3473ec408a3a2a1815ecff rts/LdvProfile.c | 3 +++ testsuite/tests/profiling/should_run/T11978a.hs | 2 ++ .../should_run/T5594.stdout => profiling/should_run/T11978a.stdout} | 0 testsuite/tests/profiling/should_run/all.T | 4 ++++ 4 files changed, 9 insertions(+) diff --git a/rts/LdvProfile.c b/rts/LdvProfile.c index 2330d74..4a2ee42 100644 --- a/rts/LdvProfile.c +++ b/rts/LdvProfile.c @@ -178,6 +178,9 @@ processNurseryForDead( void ) StgPtr p; bdescr *bd; + if (MainCapability.r.rNursery == NULL) + return; + for (bd = MainCapability.r.rNursery->blocks; bd != NULL; bd = bd->link) { p = bd->start; while (p < bd->free) { diff --git a/testsuite/tests/profiling/should_run/T11978a.hs b/testsuite/tests/profiling/should_run/T11978a.hs new file mode 100644 index 0000000..bb859f3 --- /dev/null +++ b/testsuite/tests/profiling/should_run/T11978a.hs @@ -0,0 +1,2 @@ +main :: IO () +main = putStrLn "Hello!" diff --git a/testsuite/tests/ffi/should_run/T5594.stdout b/testsuite/tests/profiling/should_run/T11978a.stdout similarity index 100% copy from testsuite/tests/ffi/should_run/T5594.stdout copy to testsuite/tests/profiling/should_run/T11978a.stdout diff --git a/testsuite/tests/profiling/should_run/all.T b/testsuite/tests/profiling/should_run/all.T index c6ce6d4..1f74a27 100644 --- a/testsuite/tests/profiling/should_run/all.T +++ b/testsuite/tests/profiling/should_run/all.T @@ -106,3 +106,7 @@ test('T11627b', [ extra_run_opts('+RTS -i0 -RTS') # census after each GC ] , compile_and_run , ['']) + +test('T11978a', + [only_ways(['profthreaded']), extra_run_opts('+RTS -hb -N10')], + compile_and_run, ['']) From git at git.haskell.org Thu Apr 28 21:40:18 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Apr 2016 21:40:18 +0000 (UTC) Subject: [commit: ghc] master: Linker: Fix implicit function declaration warning on OS X (f255f80) Message-ID: <20160428214018.480BE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f255f80132aa4cbe16db85b759350945fb66ef85/ghc >--------------------------------------------------------------- commit f255f80132aa4cbe16db85b759350945fb66ef85 Author: Erik de Castro Lopo Date: Wed Apr 27 07:01:26 2016 +1000 Linker: Fix implicit function declaration warning on OS X Introduced in commit 177aec697b3. Test Plan: Validate on OSX and Linux. Reviewers: austin, bgamari, hvr Subscribers: goldfire, thomie Differential Revision: https://phabricator.haskell.org/D2140 >--------------------------------------------------------------- f255f80132aa4cbe16db85b759350945fb66ef85 rts/Linker.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/rts/Linker.c b/rts/Linker.c index ef7baf9..87ad9e3 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -342,10 +342,7 @@ static int ocVerifyImage_MachO ( ObjectCode* oc ); static int ocGetNames_MachO ( ObjectCode* oc ); static int ocResolve_MachO ( ObjectCode* oc ); static int ocRunInit_MachO ( ObjectCode* oc ); - -#if (USE_MMAP == 0) static int machoGetMisalignment( FILE * ); -#endif #if NEED_SYMBOL_EXTRAS static int ocAllocateSymbolExtras_MachO ( ObjectCode* oc ); #endif @@ -7320,7 +7317,7 @@ machoInitSymbolsWithoutUnderscore(void) } #endif -#if (USE_MMAP == 0) +#if defined(OBJFORMAT_MACHO) /* * Figure out by how much to shift the entire Mach-O file in memory * when loading so that its single segment ends up 16-byte-aligned From git at git.haskell.org Thu Apr 28 21:54:56 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Apr 2016 21:54:56 +0000 (UTC) Subject: [commit: ghc] master: Remove unused foldFsEnv (6e195f4) Message-ID: <20160428215456.355083A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6e195f4f0c151b787f122ebab1e334fbaf0ebce9/ghc >--------------------------------------------------------------- commit 6e195f4f0c151b787f122ebab1e334fbaf0ebce9 Author: Bartosz Nitka Date: Thu Apr 28 14:56:28 2016 -0700 Remove unused foldFsEnv foldFsEnv is nondeterministic in the general case and since it's unused we can just remove it. >--------------------------------------------------------------- 6e195f4f0c151b787f122ebab1e334fbaf0ebce9 compiler/utils/FastStringEnv.hs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/compiler/utils/FastStringEnv.hs b/compiler/utils/FastStringEnv.hs index 6398146..02ee029 100644 --- a/compiler/utils/FastStringEnv.hs +++ b/compiler/utils/FastStringEnv.hs @@ -15,7 +15,7 @@ module FastStringEnv ( emptyFsEnv, unitFsEnv, fsEnvElts, fsEnvUniqueElts, extendFsEnv_C, extendFsEnv_Acc, extendFsEnv, extendFsEnvList, extendFsEnvList_C, - foldFsEnv, filterFsEnv, + filterFsEnv, plusFsEnv, plusFsEnv_C, alterFsEnv, lookupFsEnv, lookupFsEnv_NF, delFromFsEnv, delListFromFsEnv, elemFsEnv, mapFsEnv, @@ -47,7 +47,6 @@ elemFsEnv :: FastString -> FastStringEnv a -> Bool unitFsEnv :: FastString -> a -> FastStringEnv a lookupFsEnv :: FastStringEnv a -> FastString -> Maybe a lookupFsEnv_NF :: FastStringEnv a -> FastString -> a -foldFsEnv :: (a -> b -> b) -> b -> FastStringEnv a -> b filterFsEnv :: (elt -> Bool) -> FastStringEnv elt -> FastStringEnv elt mapFsEnv :: (elt1 -> elt2) -> FastStringEnv elt1 -> FastStringEnv elt2 @@ -60,7 +59,6 @@ lookupFsEnv x y = lookupUFM x y alterFsEnv = alterUFM mkFsEnv l = listToUFM l elemFsEnv x y = elemUFM x y -foldFsEnv a b c = foldUFM a b c plusFsEnv x y = plusUFM x y plusFsEnv_C f x y = plusUFM_C f x y extendFsEnv_C f x y z = addToUFM_C f x y z From git at git.haskell.org Thu Apr 28 22:25:00 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Apr 2016 22:25:00 +0000 (UTC) Subject: [commit: ghc] master: Remove unused foldNameEnv (031de8b) Message-ID: <20160428222500.3C2253A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/031de8bbcebf897a8fb7b1e571291da2387b49ca/ghc >--------------------------------------------------------------- commit 031de8bbcebf897a8fb7b1e571291da2387b49ca Author: Bartosz Nitka Date: Thu Apr 28 15:27:17 2016 -0700 Remove unused foldNameEnv foldNameEnv is nondeterministic in the general case and it's currently unused so we can remove it. >--------------------------------------------------------------- 031de8bbcebf897a8fb7b1e571291da2387b49ca compiler/basicTypes/NameEnv.hs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/compiler/basicTypes/NameEnv.hs b/compiler/basicTypes/NameEnv.hs index d2641e2..d9ad359 100644 --- a/compiler/basicTypes/NameEnv.hs +++ b/compiler/basicTypes/NameEnv.hs @@ -16,7 +16,7 @@ module NameEnv ( unitNameEnv, nameEnvElts, nameEnvUniqueElts, extendNameEnv_C, extendNameEnv_Acc, extendNameEnv, extendNameEnvList, extendNameEnvList_C, - foldNameEnv, filterNameEnv, anyNameEnv, + filterNameEnv, anyNameEnv, plusNameEnv, plusNameEnv_C, alterNameEnv, lookupNameEnv, lookupNameEnv_NF, delFromNameEnv, delListFromNameEnv, elemNameEnv, mapNameEnv, disjointNameEnv, @@ -87,7 +87,6 @@ elemNameEnv :: Name -> NameEnv a -> Bool unitNameEnv :: Name -> a -> NameEnv a lookupNameEnv :: NameEnv a -> Name -> Maybe a lookupNameEnv_NF :: NameEnv a -> Name -> a -foldNameEnv :: (a -> b -> b) -> b -> NameEnv a -> b filterNameEnv :: (elt -> Bool) -> NameEnv elt -> NameEnv elt anyNameEnv :: (elt -> Bool) -> NameEnv elt -> Bool mapNameEnv :: (elt1 -> elt2) -> NameEnv elt1 -> NameEnv elt2 @@ -103,7 +102,6 @@ lookupNameEnv x y = lookupUFM x y alterNameEnv = alterUFM mkNameEnv l = listToUFM l elemNameEnv x y = elemUFM x y -foldNameEnv a b c = foldUFM a b c plusNameEnv x y = plusUFM x y plusNameEnv_C f x y = plusUFM_C f x y extendNameEnv_C f x y z = addToUFM_C f x y z From git at git.haskell.org Thu Apr 28 22:29:25 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Apr 2016 22:29:25 +0000 (UTC) Subject: [commit: ghc] master: Fix path to the new build system, now called Hadrian. (f99db38) Message-ID: <20160428222925.A3C513A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f99db383b9b280a6611c640180efffbd97fc319f/ghc >--------------------------------------------------------------- commit f99db383b9b280a6611c640180efffbd97fc319f Author: Andrey Mokhov Date: Thu Apr 28 23:32:14 2016 +0100 Fix path to the new build system, now called Hadrian. Summary: The new Shake-based build system has been given a name -- Hadrian, and now lives in /hadrian directory. This fixes the path to the configuration file to be populated by the configure script. Test Plan: Run Hadrian build. Reviewers: thomie, bgamari, hvr, austin Reviewed By: austin Subscribers: erikd Differential Revision: https://phabricator.haskell.org/D2153 >--------------------------------------------------------------- f99db383b9b280a6611c640180efffbd97fc319f configure.ac | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index a5ee3bc..defc182 100644 --- a/configure.ac +++ b/configure.ac @@ -1099,9 +1099,9 @@ if grep ' ' compiler/ghc.cabal.in 2>&1 >/dev/null; then AC_MSG_ERROR([compiler/ghc.cabal.in contains tab characters; please remove them]) fi -# Create the configuration for the Shake-based build system if it is present -if test -e shake-build/cfg/system.config.in; then - AC_CONFIG_FILES([shake-build/cfg/system.config]) +# Create the configuration for the Hadrian build system if it is present +if test -e hadrian/cfg/system.config.in; then + AC_CONFIG_FILES([hadrian/cfg/system.config]) fi # We got caught by From git at git.haskell.org Thu Apr 28 23:50:19 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 28 Apr 2016 23:50:19 +0000 (UTC) Subject: [commit: ghc] master: testsuite: fix up T11223's Makefile (0fa1d07) Message-ID: <20160428235019.38D9B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0fa1d075eb1ec07ff6e22472fc5d6f08b3206a2f/ghc >--------------------------------------------------------------- commit 0fa1d075eb1ec07ff6e22472fc5d6f08b3206a2f Author: Austin Seipp Date: Thu Apr 28 23:42:55 2016 +0000 testsuite: fix up T11223's Makefile As reported by Simon on ghc-devs, this causes the build on Windows to fail because it cannot find the `cc` command. The Makefile here actually already sets `GCC=gcc`, but for some reason then uses both `$(GCC)` and `$(CC)` to refer to C compilation. Signed-off-by: Austin Seipp Reviewed By: thomie Differential Revision: https://phabricator.haskell.org/D2158 >--------------------------------------------------------------- 0fa1d075eb1ec07ff6e22472fc5d6f08b3206a2f testsuite/tests/rts/T11223/Makefile | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/testsuite/tests/rts/T11223/Makefile b/testsuite/tests/rts/T11223/Makefile index 6bcb9a5..895c6b8 100644 --- a/testsuite/tests/rts/T11223/Makefile +++ b/testsuite/tests/rts/T11223/Makefile @@ -6,7 +6,7 @@ include $(TOP)/mk/test.mk # Testing RTS linker object resolution # -GCC=gcc +CC=gcc .PHONY: t_11223_simple_link t_11223_simple_link: @@ -87,40 +87,40 @@ t_11223_link_order_b_a_2_succeed: .PHONY: t_11223_weak_only_link_fail t_11223_weak_only_link_fail: $(RM) -f power_w1.o power.hi power.o - "$(GCC)" -c power.c -DWEAK -o power_w1.o + "$(CC)" -c power.c -DWEAK -o power_w1.o echo main | "$(TEST_HC)" --interactive -v0 $(filter-out -rtsopts, $(TEST_HC_OPTS)) -ignore-dot-ghci power.hs power_w1.o .PHONY: t_11223_weak_only_link_succeed t_11223_weak_only_link_succeed: $(RM) -f power_w2.o power3.hi power3.o - "$(GCC)" -c power_slow.c -DWEAK -o power_w2.o + "$(CC)" -c power_slow.c -DWEAK -o power_w2.o echo main | "$(TEST_HC)" --interactive -v0 $(filter-out -rtsopts, $(TEST_HC_OPTS)) -ignore-dot-ghci power3.hs power_w2.o .PHONY: t_11223_weak_both_link_order_a_b_succeed t_11223_weak_both_link_order_a_b_succeed: $(RM) -f fast_power_w3.o slow_power_w3.o power3.hi power3.o - "$(GCC)" -c power_slow.c -DWEAK -o slow_power_w3.o - "$(GCC)" -c power.c -DWEAK -o fast_power_w3.o + "$(CC)" -c power_slow.c -DWEAK -o slow_power_w3.o + "$(CC)" -c power.c -DWEAK -o fast_power_w3.o echo main | "$(TEST_HC)" --interactive -v0 $(filter-out -rtsopts, $(TEST_HC_OPTS)) -ignore-dot-ghci power3.hs fast_power_w3.o slow_power_w3.o .PHONY: t_11223_weak_both_link_order_b_a_succeed t_11223_weak_both_link_order_b_a_succeed: $(RM) -f fast_power_w4.o slow_power_w4.o power3.hi power3.o - "$(GCC)" -c power_slow.c -DWEAK -o slow_power_w4.o - "$(GCC)" -c power.c -DWEAK -o fast_power_w4.o + "$(CC)" -c power_slow.c -DWEAK -o slow_power_w4.o + "$(CC)" -c power.c -DWEAK -o fast_power_w4.o echo main | "$(TEST_HC)" --interactive -v0 $(filter-out -rtsopts, $(TEST_HC_OPTS)) -ignore-dot-ghci power3.hs slow_power_w4.o fast_power_w4.o .PHONY: t_11223_weak_single_link_order_a_b_succeed t_11223_weak_single_link_order_a_b_succeed: $(RM) -f fast_power_w5.o slow_power_w5.o power3.hi power3.o - "$(GCC)" -c power_slow.c -o slow_power_w5.o - "$(GCC)" -c power.c -DWEAK -o fast_power_w5.o + "$(CC)" -c power_slow.c -o slow_power_w5.o + "$(CC)" -c power.c -DWEAK -o fast_power_w5.o echo main | "$(TEST_HC)" --interactive -v0 $(filter-out -rtsopts, $(TEST_HC_OPTS)) -ignore-dot-ghci power3.hs fast_power_w5.o slow_power_w5.o .PHONY: t_11223_weak_single_link_order_b_a_succeed t_11223_weak_single_link_order_b_a_succeed: $(RM) -f fast_power_w6.o slow_power_w6.o power3.hi power3.o - "$(GCC)" -c power_slow.c -DWEAK -o slow_power_w6.o - "$(GCC)" -c power.c -o fast_power_w6.o + "$(CC)" -c power_slow.c -DWEAK -o slow_power_w6.o + "$(CC)" -c power.c -o fast_power_w6.o echo main | "$(TEST_HC)" --interactive -v0 $(filter-out -rtsopts, $(TEST_HC_OPTS)) -ignore-dot-ghci power3.hs slow_power_w6.o fast_power_w6.o From git at git.haskell.org Fri Apr 29 08:46:47 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 29 Apr 2016 08:46:47 +0000 (UTC) Subject: [commit: ghc] master: RTS: delete BlockedOnGA* + dead code (a2970f8) Message-ID: <20160429084647.90F1C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a2970f883d1018107f745531aab56e872311d8c7/ghc >--------------------------------------------------------------- commit a2970f883d1018107f745531aab56e872311d8c7 Author: Thomas Miedema Date: Sat Feb 27 22:02:22 2016 +0100 RTS: delete BlockedOnGA* + dead code Some old stuff related to the PAR way. Reviewed by: austin, simonmar Differential Revision: https://phabricator.haskell.org/D2137 >--------------------------------------------------------------- a2970f883d1018107f745531aab56e872311d8c7 includes/rts/Constants.h | 5 ----- includes/rts/storage/ClosureMacros.h | 6 ------ includes/rts/storage/InfoTables.h | 4 ++-- includes/rts/storage/TSO.h | 11 +---------- rts/sm/Scav.c | 4 ---- 5 files changed, 3 insertions(+), 27 deletions(-) diff --git a/includes/rts/Constants.h b/includes/rts/Constants.h index 6e44410..b65b8d3 100644 --- a/includes/rts/Constants.h +++ b/includes/rts/Constants.h @@ -212,11 +212,6 @@ /* Win32 only: */ #define BlockedOnDoProc 7 -/* Only relevant for PAR: */ - /* blocked on a remote closure represented by a Global Address: */ -#define BlockedOnGA 8 - /* same as above but without sending a Fetch message */ -#define BlockedOnGA_NoSend 9 /* Only relevant for THREADED_RTS: */ #define BlockedOnCCall 10 #define BlockedOnCCall_Interruptible 11 diff --git a/includes/rts/storage/ClosureMacros.h b/includes/rts/storage/ClosureMacros.h index d534873..03589f2 100644 --- a/includes/rts/storage/ClosureMacros.h +++ b/includes/rts/storage/ClosureMacros.h @@ -177,12 +177,6 @@ STATIC_LINK(const StgInfoTable *info, StgClosure *p) } } -INLINE_HEADER StgClosure *STATIC_LINK2(const StgInfoTable *info, - StgClosure *p) { - return (*(StgClosure**)(&((p)->payload[info->layout.payload.ptrs + - info->layout.payload.nptrs + 1]))); -} - /* ----------------------------------------------------------------------------- INTLIKE and CHARLIKE closures. -------------------------------------------------------------------------- */ diff --git a/includes/rts/storage/InfoTables.h b/includes/rts/storage/InfoTables.h index 3de63c8..b165be2 100644 --- a/includes/rts/storage/InfoTables.h +++ b/includes/rts/storage/InfoTables.h @@ -17,7 +17,7 @@ position-independent code. Note [x86-64-relative] - There is a complication on the x86_64 platform, where pointeres are + There is a complication on the x86_64 platform, where pointers are 64 bits, but the tools don't support 64-bit relative relocations. However, the default memory model (small) ensures that all symbols have values in the lower 2Gb of the address space, so offsets all @@ -208,7 +208,7 @@ typedef struct StgInfoTable_ { #ifdef TABLES_NEXT_TO_CODE StgCode code[]; #endif -} *StgInfoTablePtr; +} *StgInfoTablePtr; // StgInfoTable defined in rts/Types.h /* ----------------------------------------------------------------------------- diff --git a/includes/rts/storage/TSO.h b/includes/rts/storage/TSO.h index aa3d057..fd32919 100644 --- a/includes/rts/storage/TSO.h +++ b/includes/rts/storage/TSO.h @@ -184,7 +184,7 @@ typedef struct StgTSO_ { StgWord32 saved_winerror; #endif -} *StgTSOPtr; +} *StgTSOPtr; // StgTSO defined in rts/Types.h typedef struct StgStack_ { StgHeader header; @@ -242,8 +242,6 @@ void dirty_STACK (Capability *cap, StgStack *stack); BlockedOnRead NULL blocked_queue BlockedOnWrite NULL blocked_queue BlockedOnDelay NULL blocked_queue - BlockedOnGA closure TSO blocks on BQ of that closure - BlockedOnGA_NoSend closure TSO blocks on BQ of that closure tso->link == END_TSO_QUEUE, if the thread is currently running. @@ -258,13 +256,6 @@ void dirty_STACK (Capability *cap, StgStack *stack); (tso->sp is left pointing at the top word on the stack so that the return value or exception will be retained by a GC). - The 2 cases BlockedOnGA and BlockedOnGA_NoSend are needed in a GUM - setup only. They mark a TSO that has entered a FETCH_ME or - FETCH_ME_BQ closure, respectively; only the first TSO hitting the - closure will send a Fetch message. - Currently we have no separate code for blocking on an RBH; we use the - BlockedOnBlackHole case for that. -- HWL - ---------------------------------------------------------------------------- */ /* this is the NIL ptr for a TSO queue (e.g. runnable queue) */ diff --git a/rts/sm/Scav.c b/rts/sm/Scav.c index abb7726..7f64ea6 100644 --- a/rts/sm/Scav.c +++ b/rts/sm/Scav.c @@ -1702,10 +1702,6 @@ scavenge_static(void) ASSERT(LOOKS_LIKE_CLOSURE_PTR(p)); info = get_itbl(p); - /* - if (info->type==RBH) - info = REVERT_INFOPTR(info); // if it's an RBH, look at the orig closure - */ // make sure the info pointer is into text space /* Take this object *off* the static_objects list, From git at git.haskell.org Fri Apr 29 12:59:14 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 29 Apr 2016 12:59:14 +0000 (UTC) Subject: [commit: ghc] master: Remove the incredibly hairy splitTelescopeTvs. (c5919f7) Message-ID: <20160429125914.38D3F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c5919f75afab9dd6f0a4a2670402024cece5da57/ghc >--------------------------------------------------------------- commit c5919f75afab9dd6f0a4a2670402024cece5da57 Author: Richard Eisenberg Date: Tue Apr 26 10:50:33 2016 -0400 Remove the incredibly hairy splitTelescopeTvs. This patch removes splitTelescopeTvs by adding information about scoped type variables to TcTyCon. Vast simplification! This also fixes #11821 by bringing only unzonked vars into scope. Test case: polykinds/T11821 >--------------------------------------------------------------- c5919f75afab9dd6f0a4a2670402024cece5da57 compiler/typecheck/TcHsType.hs | 411 ++++++++---------------------- compiler/typecheck/TcMType.hs | 10 +- compiler/typecheck/TcTyClsDecls.hs | 107 ++++---- compiler/typecheck/TcValidity.hs | 1 - compiler/types/TyCon.hs | 63 ++++- testsuite/tests/ghci/scripts/T7873.stderr | 9 +- testsuite/tests/polykinds/T11821.hs | 31 +++ testsuite/tests/polykinds/all.T | 1 + 8 files changed, 264 insertions(+), 369 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc c5919f75afab9dd6f0a4a2670402024cece5da57 From git at git.haskell.org Fri Apr 29 12:59:17 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 29 Apr 2016 12:59:17 +0000 (UTC) Subject: [commit: ghc] master: Test #11484 in th/T11484 (7242582) Message-ID: <20160429125917.5CF793A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7242582b2fad6e0a734c012da25e66fe6f2ef11a/ghc >--------------------------------------------------------------- commit 7242582b2fad6e0a734c012da25e66fe6f2ef11a Author: Richard Eisenberg Date: Tue Apr 26 14:07:08 2016 -0400 Test #11484 in th/T11484 >--------------------------------------------------------------- 7242582b2fad6e0a734c012da25e66fe6f2ef11a testsuite/tests/th/T11484.hs | 9 +++++++++ testsuite/tests/th/all.T | 1 + 2 files changed, 10 insertions(+) diff --git a/testsuite/tests/th/T11484.hs b/testsuite/tests/th/T11484.hs new file mode 100644 index 0000000..d8c0708 --- /dev/null +++ b/testsuite/tests/th/T11484.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE TypeInType #-} + +module T11484 where + +import Data.Kind + +type TySyn (k :: *) (a :: k) = () + +$([d| type TySyn2 (k :: *) (a :: k) = () |]) diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index 09960d1..a69f8a7 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -404,3 +404,4 @@ test('T11680', normal, compile_fail, ['-v0']) test('T11809', normal, compile, ['-v0']) test('T11797', normal, compile, ['-v0 -dsuppress-uniques']) test('T11941', normal, compile_fail, ['-v0']) +test('T11484', normal, compile, ['-v0']) From git at git.haskell.org Fri Apr 29 14:43:41 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 29 Apr 2016 14:43:41 +0000 (UTC) Subject: [commit: ghc] master: Fix typo: Superclases -> Superclasses (00053ee) Message-ID: <20160429144341.210243A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/00053ee6f450c4503c25ed9ba33089d991e2a04b/ghc >--------------------------------------------------------------- commit 00053ee6f450c4503c25ed9ba33089d991e2a04b Author: Bartosz Nitka Date: Fri Apr 29 07:46:24 2016 -0700 Fix typo: Superclases -> Superclasses >--------------------------------------------------------------- 00053ee6f450c4503c25ed9ba33089d991e2a04b compiler/typecheck/TcInstDcls.hs | 4 ++-- compiler/typecheck/TcRnTypes.hs | 2 +- compiler/typecheck/TcSimplify.hs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/compiler/typecheck/TcInstDcls.hs b/compiler/typecheck/TcInstDcls.hs index 8554796..483d322 100644 --- a/compiler/typecheck/TcInstDcls.hs +++ b/compiler/typecheck/TcInstDcls.hs @@ -952,7 +952,7 @@ Notice that ************************************************************************ * * - Type-checking superclases + Type-checking superclasses * * ************************************************************************ -} @@ -1115,7 +1115,7 @@ add (Super (Fam a)) to the context of (i3). Note [Solving superclass constraints] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ How do we ensure that every superclass witness is generated by -one of (sc1) (sc2) or (sc3) in Note [Recursive superclases]. +one of (sc1) (sc2) or (sc3) in Note [Recursive superclasses]. Answer: * Superclass "wanted" constraints have CtOrigin of (ScOrigin size) diff --git a/compiler/typecheck/TcRnTypes.hs b/compiler/typecheck/TcRnTypes.hs index f3aef11..2172cd8 100644 --- a/compiler/typecheck/TcRnTypes.hs +++ b/compiler/typecheck/TcRnTypes.hs @@ -1812,7 +1812,7 @@ isPendingScDict _ = Nothing superClassesMightHelp :: Ct -> Bool -- ^ True if taking superclasses of givens, or of wanteds (to perhaps -- expose more equalities or functional dependencies) might help to --- solve this constraint. See Note [When superclases help] +-- solve this constraint. See Note [When superclasses help] superClassesMightHelp ct = isWantedCt ct && not (is_ip ct) where diff --git a/compiler/typecheck/TcSimplify.hs b/compiler/typecheck/TcSimplify.hs index 58ed3ca..bb17fd7 100644 --- a/compiler/typecheck/TcSimplify.hs +++ b/compiler/typecheck/TcSimplify.hs @@ -446,7 +446,7 @@ tcCheckSatisfiability given_ids ; (res, _ev_binds) <- runTcS $ do { traceTcS "checkSatisfiability {" (ppr given_ids) ; given_cts <- mkGivensWithSuperClasses given_loc (bagToList given_ids) - -- See Note [Superclases and satisfiability] + -- See Note [Superclasses and satisfiability] ; insols <- solveSimpleGivens given_cts ; insols <- try_harder insols ; traceTcS "checkSatisfiability }" (ppr insols) @@ -465,7 +465,7 @@ tcCheckSatisfiability given_ids ; new_given <- makeSuperClasses pending_given ; solveSimpleGivens new_given } -{- Note [Superclases and satisfiability] +{- Note [Superclasses and satisfiability] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Expand superclasses before starting, because (Int ~ Bool), has (Int ~~ Bool) as a superclass, which in turn has (Int ~N# Bool) From git at git.haskell.org Fri Apr 29 18:43:38 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 29 Apr 2016 18:43:38 +0000 (UTC) Subject: [commit: ghc] master: PPC NCG: Improve pointer de-tagging code (b725fe0) Message-ID: <20160429184338.160293A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b725fe0a8d2a2ee3e6d95bb0ec345ee532381ee2/ghc >--------------------------------------------------------------- commit b725fe0a8d2a2ee3e6d95bb0ec345ee532381ee2 Author: Peter Trommler Date: Fri Apr 29 17:45:10 2016 +0000 PPC NCG: Improve pointer de-tagging code Generate a clrr[wd]i instruction to clear the tag bits in a pointer. This saves one instruction and one temporary register. Optimize signed comparison with zero after andi. operation This saves one instruction when comparing a pointer tag with zero. This reduces code size by 0.6 % in all nofib benchmarks. Test Plan: validate on AIX and 32-bit Linux Reviewed By: erikd, hvr Differential Revision: https://phabricator.haskell.org/D2093 >--------------------------------------------------------------- b725fe0a8d2a2ee3e6d95bb0ec345ee532381ee2 compiler/nativeGen/PPC/CodeGen.hs | 27 ++++++++++++++++++++++----- compiler/nativeGen/PPC/Instr.hs | 3 +++ compiler/nativeGen/PPC/Ppr.hs | 11 +++++++++++ 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/compiler/nativeGen/PPC/CodeGen.hs b/compiler/nativeGen/PPC/CodeGen.hs index 7b2f79b..12d5d88 100644 --- a/compiler/nativeGen/PPC/CodeGen.hs +++ b/compiler/nativeGen/PPC/CodeGen.hs @@ -574,7 +574,7 @@ getRegister' dflags (CmmMachOp mop [x, y]) -- dyadic PrimOps -- (needed for PIC) MO_Add W32 -> case y of - CmmLit (CmmInt imm immrep) | Just _ <- makeImmediate W32 True (-imm) + CmmLit (CmmInt imm immrep) | Just _ <- makeImmediate W32 True imm -> trivialCode W32 True ADD x (CmmLit $ CmmInt imm immrep) CmmLit lit -> do @@ -626,7 +626,16 @@ getRegister' dflags (CmmMachOp mop [x, y]) -- dyadic PrimOps | otherwise -> remainderCode rep DIVDU (extendSExpr dflags rep x) (extendSExpr dflags rep y) - MO_And rep -> trivialCode rep False AND x y + MO_And rep -> case y of + (CmmLit (CmmInt imm _)) | imm == -8 || imm == -4 + -> do + (src, srcCode) <- getSomeReg x + let clear_mask = if imm == -4 then 2 else 3 + fmt = intFormat rep + code dst = srcCode + `appOL` unitOL (CLRRI fmt dst src clear_mask) + return (Any fmt code) + _ -> trivialCode rep False AND x y MO_Or rep -> trivialCode rep False OR x y MO_Xor rep -> trivialCode rep False XOR x y @@ -912,14 +921,22 @@ getCondCode (CmmMachOp mop [x, y]) getCondCode _ = panic "getCondCode(2)(powerpc)" - -- @cond(Int|Flt)Code@: Turn a boolean expression into a condition, to be -- passed back up the tree. condIntCode, condFltCode :: Cond -> CmmExpr -> CmmExpr -> NatM CondCode --- ###FIXME: I16 and I8! --- TODO: Is this still an issue? All arguments are extend?Expr'd. +-- optimize pointer tag checks. Operation andi. sets condition register +-- so cmpi ..., 0 is redundant. +condIntCode cond (CmmMachOp (MO_And _) [x, CmmLit (CmmInt imm rep)]) + (CmmLit (CmmInt 0 _)) + | not $ condUnsigned cond, + Just src2 <- makeImmediate rep False imm + = do + (src1, code) <- getSomeReg x + let code' = code `snocOL` AND r0 src1 (RIImm src2) + return (CondCode False cond code') + condIntCode cond x (CmmLit (CmmInt y rep)) | Just src2 <- makeImmediate rep (not $ condUnsigned cond) y = do diff --git a/compiler/nativeGen/PPC/Instr.hs b/compiler/nativeGen/PPC/Instr.hs index b5c26ed..23d8b6b 100644 --- a/compiler/nativeGen/PPC/Instr.hs +++ b/compiler/nativeGen/PPC/Instr.hs @@ -251,6 +251,7 @@ data Instr | SRA Format Reg Reg RI -- shift right arithmetic | RLWINM Reg Reg Int Int Int -- Rotate Left Word Immediate then AND with Mask + | CLRRI Format Reg Reg Int -- clear right immediate (extended mnemonic) | FADD Format Reg Reg Reg | FSUB Format Reg Reg Reg @@ -340,6 +341,7 @@ ppc_regUsageOfInstr platform instr SR _ reg1 reg2 ri -> usage (reg2 : regRI ri, [reg1]) SRA _ reg1 reg2 ri -> usage (reg2 : regRI ri, [reg1]) RLWINM reg1 reg2 _ _ _ -> usage ([reg2], [reg1]) + CLRRI _ reg1 reg2 _ -> usage ([reg2], [reg1]) FADD _ r1 r2 r3 -> usage ([r2,r3], [r1]) FSUB _ r1 r2 r3 -> usage ([r2,r3], [r1]) @@ -430,6 +432,7 @@ ppc_patchRegsOfInstr instr env -> SRA fmt (env reg1) (env reg2) (fixRI ri) RLWINM reg1 reg2 sh mb me -> RLWINM (env reg1) (env reg2) sh mb me + CLRRI fmt reg1 reg2 n -> CLRRI fmt (env reg1) (env reg2) n FADD fmt r1 r2 r3 -> FADD fmt (env r1) (env r2) (env r3) FSUB fmt r1 r2 r3 -> FSUB fmt (env r1) (env r2) (env r3) FMUL fmt r1 r2 r3 -> FMUL fmt (env r1) (env r2) (env r3) diff --git a/compiler/nativeGen/PPC/Ppr.hs b/compiler/nativeGen/PPC/Ppr.hs index 59b0ad8..3e1fd07 100644 --- a/compiler/nativeGen/PPC/Ppr.hs +++ b/compiler/nativeGen/PPC/Ppr.hs @@ -791,6 +791,17 @@ pprInstr (RLWINM reg1 reg2 sh mb me) = hcat [ int me ] +pprInstr (CLRRI fmt reg1 reg2 n) = hcat [ + text "\tclrr", + pprFormat fmt, + text "i ", + pprReg reg1, + text ", ", + pprReg reg2, + text ", ", + int n + ] + pprInstr (FADD fmt reg1 reg2 reg3) = pprBinaryF (sLit "fadd") fmt reg1 reg2 reg3 pprInstr (FSUB fmt reg1 reg2 reg3) = pprBinaryF (sLit "fsub") fmt reg1 reg2 reg3 pprInstr (FMUL fmt reg1 reg2 reg3) = pprBinaryF (sLit "fmul") fmt reg1 reg2 reg3 From git at git.haskell.org Sat Apr 30 08:15:22 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 30 Apr 2016 08:15:22 +0000 (UTC) Subject: [commit: ghc] master: Testsuite: make CLEANUP=1 the default (#9758) (c4259ff) Message-ID: <20160430081522.A3E653A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c4259ff3defcac0d8f8075fd99884eef22e5d966/ghc >--------------------------------------------------------------- commit c4259ff3defcac0d8f8075fd99884eef22e5d966 Author: Thomas Miedema Date: Tue Apr 26 15:12:05 2016 +0200 Testsuite: make CLEANUP=1 the default (#9758) Also move the `cleanup` setting from `default_testopts` to `config`. The `cleanup` setting is the same for all tests, hence it belongs in `config`. Reviewed by: austin Differential Revision: https://phabricator.haskell.org/D2148 >--------------------------------------------------------------- c4259ff3defcac0d8f8075fd99884eef22e5d966 testsuite/config/ghc | 1 + testsuite/driver/testglobals.py | 3 --- testsuite/driver/testlib.py | 2 +- testsuite/mk/test.mk | 19 +++++++++++++------ testsuite/tests/cabal/cabal01/all.T | 4 ++-- testsuite/tests/cabal/cabal03/all.T | 4 ++-- testsuite/tests/cabal/cabal04/all.T | 4 ++-- testsuite/tests/cabal/cabal05/all.T | 4 ++-- testsuite/tests/cabal/cabal06/all.T | 4 ++-- testsuite/tests/cabal/cabal08/all.T | 4 ++-- testsuite/tests/cabal/cabal09/all.T | 4 ++-- testsuite/tests/cabal/sigcabal01/all.T | 4 ++-- 12 files changed, 31 insertions(+), 26 deletions(-) diff --git a/testsuite/config/ghc b/testsuite/config/ghc index 26ce3bd..595415a 100644 --- a/testsuite/config/ghc +++ b/testsuite/config/ghc @@ -81,6 +81,7 @@ if (ghc_with_llvm == 1): config.run_ways.append('optllvm') config.in_tree_compiler = in_tree_compiler +config.cleanup = cleanup config.clean_only = clean_only config.way_flags = lambda name : { diff --git a/testsuite/driver/testglobals.py b/testsuite/driver/testglobals.py index 2c7f551..d197692 100644 --- a/testsuite/driver/testglobals.py +++ b/testsuite/driver/testglobals.py @@ -207,9 +207,6 @@ class TestOptions: # expected exit code self.exit_code = 0 - # should we clean up after ourselves? - self.cleanup = '' - # extra files to clean afterward self.clean_files = [] diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index c69c874..a722184 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -694,7 +694,7 @@ def test_common_work (name, opts, func, args): if way not in do_ways: skiptest (name,way) - if getTestOpts().cleanup != '' and (config.clean_only or do_ways != []): + if config.cleanup and (config.clean_only or do_ways): pretest_cleanup(name) clean([name + suff for suff in [ '', '.exe', '.exe.manifest', '.genscript', diff --git a/testsuite/mk/test.mk b/testsuite/mk/test.mk index 6d9a4c2..8198efb 100644 --- a/testsuite/mk/test.mk +++ b/testsuite/mk/test.mk @@ -189,6 +189,14 @@ ifeq "$(SKIP_PERF_TESTS)" "YES" RUNTEST_OPTS += --skip-perf-tests endif +ifeq "$(CLEANUP)" "0" +RUNTEST_OPTS += -e cleanup=False +else ifeq "$(CLEANUP)" "NO" +RUNTEST_OPTS += -e cleanup=False +else +RUNTEST_OPTS += -e cleanup=True +endif + ifneq "$(CLEAN_ONLY)" "" RUNTEST_OPTS += -e clean_only=True else @@ -207,7 +215,6 @@ RUNTEST_OPTS += \ -e 'config.os="$(TargetOS_CPP)"' \ -e 'config.arch="$(TargetARCH_CPP)"' \ -e 'config.wordsize="$(WORDSIZE)"' \ - -e 'default_testopts.cleanup="$(CLEANUP)"' \ -e 'config.timeout=int($(TIMEOUT)) or config.timeout' \ -e 'config.exeext="$(exeext)"' \ -e 'config.top="$(TOP_ABS)"' @@ -326,15 +333,15 @@ list_broken: # From # https://www.gnu.org/software/make/manual/html_node/Variables_002fRecursion.html: # -# "The ?-j? option is a special case (see Parallel Execution). If you set -# it to some numeric value ?N? and your operating system supports it (most -# any UNIX system will; others typically won?t), the parent make and all the -# sub-makes will communicate to ensure that there are only ?N? jobs running +# "The '-j' option is a special case (see Parallel Execution). If you set +# it to some numeric value 'N' and your operating system supports it (most +# any UNIX system will; others typically won't), the parent make and all the +# sub-makes will communicate to ensure that there are only 'N' jobs running # at the same time between them all." # # In our scenario, the user will actually see the following warning [2]: # -# ?warning: jobserver unavailable: using -j1. Add `+' to parent make rule.? +# 'warning: jobserver unavailable: using -j1. Add '+' to parent make rule.' # # The problem is that topmake and submake don't know about eachother, since # python is in between. To let them communicate, we have to use the '+' diff --git a/testsuite/tests/cabal/cabal01/all.T b/testsuite/tests/cabal/cabal01/all.T index 5149805..43485ea 100644 --- a/testsuite/tests/cabal/cabal01/all.T +++ b/testsuite/tests/cabal/cabal01/all.T @@ -13,10 +13,10 @@ if config.have_shared_libs: else: dyn = '--disable-shared' -if default_testopts.cleanup != '': +if config.cleanup: cleanup = 'CLEANUP=1' else: - cleanup = '' + cleanup = 'CLEANUP=0' def ignoreLdOutput(str): return re.sub('Creating library file: dist.build.libHStest-1.0-ghc[0-9.]*.dll.a\n', '', str) diff --git a/testsuite/tests/cabal/cabal03/all.T b/testsuite/tests/cabal/cabal03/all.T index 01d3882..b1b0561 100644 --- a/testsuite/tests/cabal/cabal03/all.T +++ b/testsuite/tests/cabal/cabal03/all.T @@ -1,7 +1,7 @@ -if default_testopts.cleanup != '': +if config.cleanup: cleanup = 'CLEANUP=1' else: - cleanup = '' + cleanup = 'CLEANUP=0' test('cabal03', ignore_output, diff --git a/testsuite/tests/cabal/cabal04/all.T b/testsuite/tests/cabal/cabal04/all.T index b2794a5..e69b540 100644 --- a/testsuite/tests/cabal/cabal04/all.T +++ b/testsuite/tests/cabal/cabal04/all.T @@ -13,10 +13,10 @@ if not config.compiler_profiled and config.have_shared_libs: else: dyn = '--disable-shared' -if default_testopts.cleanup != '': +if config.cleanup: cleanup = 'CLEANUP=1' else: - cleanup = '' + cleanup = 'CLEANUP=0' test('cabal04', normal, diff --git a/testsuite/tests/cabal/cabal05/all.T b/testsuite/tests/cabal/cabal05/all.T index 36dcbdf..d7d9ffb 100644 --- a/testsuite/tests/cabal/cabal05/all.T +++ b/testsuite/tests/cabal/cabal05/all.T @@ -1,7 +1,7 @@ -if default_testopts.cleanup != '': +if config.cleanup: cleanup = 'CLEANUP=1' else: - cleanup = '' + cleanup = 'CLEANUP=0' test('cabal05', ignore_output, diff --git a/testsuite/tests/cabal/cabal06/all.T b/testsuite/tests/cabal/cabal06/all.T index edca288..6568e07 100644 --- a/testsuite/tests/cabal/cabal06/all.T +++ b/testsuite/tests/cabal/cabal06/all.T @@ -1,7 +1,7 @@ -if default_testopts.cleanup != '': +if config.cleanup: cleanup = 'CLEANUP=1' else: - cleanup = '' + cleanup = 'CLEANUP=0' test('cabal06', normal, diff --git a/testsuite/tests/cabal/cabal08/all.T b/testsuite/tests/cabal/cabal08/all.T index fc4221a..3aaf185 100644 --- a/testsuite/tests/cabal/cabal08/all.T +++ b/testsuite/tests/cabal/cabal08/all.T @@ -1,7 +1,7 @@ -if default_testopts.cleanup != '': +if config.cleanup: cleanup = 'CLEANUP=1' else: - cleanup = '' + cleanup = 'CLEANUP=0' test('cabal08', normal, diff --git a/testsuite/tests/cabal/cabal09/all.T b/testsuite/tests/cabal/cabal09/all.T index 66bdb01..6728c77 100644 --- a/testsuite/tests/cabal/cabal09/all.T +++ b/testsuite/tests/cabal/cabal09/all.T @@ -1,7 +1,7 @@ -if default_testopts.cleanup != '': +if config.cleanup: cleanup = 'CLEANUP=1' else: - cleanup = '' + cleanup = 'CLEANUP=0' test('cabal09', ignore_output, diff --git a/testsuite/tests/cabal/sigcabal01/all.T b/testsuite/tests/cabal/sigcabal01/all.T index 24c50b6..4a1bad9 100644 --- a/testsuite/tests/cabal/sigcabal01/all.T +++ b/testsuite/tests/cabal/sigcabal01/all.T @@ -1,7 +1,7 @@ -if default_testopts.cleanup != '': +if config.cleanup: cleanup = 'CLEANUP=1' else: - cleanup = '' + cleanup = 'CLEANUP=0' test('sigcabal01', expect_broken(10622), From git at git.haskell.org Sat Apr 30 11:05:53 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 30 Apr 2016 11:05:53 +0000 (UTC) Subject: [commit: ghc] master: Testsuite: accept new output for 2 partial-sigs tests (2ae39ac) Message-ID: <20160430110553.E803B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2ae39acd1309c85dbc579976674bcef7172510c2/ghc >--------------------------------------------------------------- commit 2ae39acd1309c85dbc579976674bcef7172510c2 Author: Thomas Miedema Date: Thu Apr 28 15:49:24 2016 +0200 Testsuite: accept new output for 2 partial-sigs tests Test Plan: make TEST='ExtraNumAMROn TidyClash2' Differential Revision: https://phabricator.haskell.org/D2155 GHC Trac Issues: #9478 >--------------------------------------------------------------- 2ae39acd1309c85dbc579976674bcef7172510c2 .../should_compile/ExtraNumAMROn.stderr | 4 +- .../partial-sigs/should_compile/PatBind2.stderr | 6 +- testsuite/tests/partial-sigs/should_compile/all.T | 3 +- .../tests/partial-sigs/should_fail/TidyClash2.hs | 11 ++- .../partial-sigs/should_fail/TidyClash2.stderr | 103 +++++++++++---------- testsuite/tests/partial-sigs/should_fail/all.T | 3 +- 6 files changed, 71 insertions(+), 59 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 2ae39acd1309c85dbc579976674bcef7172510c2 From git at git.haskell.org Sat Apr 30 18:14:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 30 Apr 2016 18:14:23 +0000 (UTC) Subject: [commit: ghc] master: Fix reference to Note in TcCanonical (2fe7a0a) Message-ID: <20160430181423.E63393A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2fe7a0aed83cbf2f98904eba68c0aafe28c5fcda/ghc >--------------------------------------------------------------- commit 2fe7a0aed83cbf2f98904eba68c0aafe28c5fcda Author: RyanGlScott Date: Sat Apr 30 14:06:31 2016 -0400 Fix reference to Note in TcCanonical Previously, it was referring to Note [Decomposing equalities], but the name of it is actually Note [Decomposing equality]. [ci skip] >--------------------------------------------------------------- 2fe7a0aed83cbf2f98904eba68c0aafe28c5fcda compiler/types/TyCon.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/types/TyCon.hs b/compiler/types/TyCon.hs index 0f9f434..628eabd 100644 --- a/compiler/types/TyCon.hs +++ b/compiler/types/TyCon.hs @@ -1510,7 +1510,7 @@ isDataTyCon _ = False -- (where X is the role passed in): -- If (T a1 b1 c1) ~X (T a2 b2 c2), then (a1 ~X1 a2), (b1 ~X2 b2), and (c1 ~X3 c2) -- (where X1, X2, and X3, are the roles given by tyConRolesX tc X) --- See also Note [Decomposing equalities] in TcCanonical +-- See also Note [Decomposing equality] in TcCanonical isInjectiveTyCon :: TyCon -> Role -> Bool isInjectiveTyCon _ Phantom = False isInjectiveTyCon (FunTyCon {}) _ = True @@ -1530,7 +1530,7 @@ isInjectiveTyCon tc@(TcTyCon {}) _ -- | 'isGenerativeTyCon' is true of 'TyCon's for which this property holds -- (where X is the role passed in): -- If (T tys ~X t), then (t's head ~X T). --- See also Note [Decomposing equalities] in TcCanonical +-- See also Note [Decomposing equality] in TcCanonical isGenerativeTyCon :: TyCon -> Role -> Bool isGenerativeTyCon (FamilyTyCon { famTcFlav = DataFamilyTyCon _ }) Nominal = True isGenerativeTyCon (FamilyTyCon {}) _ = False From git at git.haskell.org Sat Apr 30 18:14:26 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 30 Apr 2016 18:14:26 +0000 (UTC) Subject: [commit: ghc] master: Comment typos: Mkae -> Make, Hsakell -> Haskell (cb05860) Message-ID: <20160430181426.91F423A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cb0586075e7fed5439949cc39862f5ea66403394/ghc >--------------------------------------------------------------- commit cb0586075e7fed5439949cc39862f5ea66403394 Author: RyanGlScott Date: Sat Apr 30 14:10:30 2016 -0400 Comment typos: Mkae -> Make, Hsakell -> Haskell [ci skip] >--------------------------------------------------------------- cb0586075e7fed5439949cc39862f5ea66403394 compiler/typecheck/TcDeriv.hs | 2 +- compiler/types/TyCoRep.hs | 2 +- compiler/vectorise/Vectorise/Monad/Naming.hs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/typecheck/TcDeriv.hs b/compiler/typecheck/TcDeriv.hs index 28d154e..57a4037 100644 --- a/compiler/typecheck/TcDeriv.hs +++ b/compiler/typecheck/TcDeriv.hs @@ -2279,7 +2279,7 @@ a)) will be solved by the explicit Eq (N a) instance. We do *not* create the superclasses by casting the superclass dictionaries for the representation type. -See the paper "Safe zero-cost coercions for Hsakell". +See the paper "Safe zero-cost coercions for Haskell". Note [DeriveAnyClass and default family instances] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/compiler/types/TyCoRep.hs b/compiler/types/TyCoRep.hs index 118fd95..4cdd883 100644 --- a/compiler/types/TyCoRep.hs +++ b/compiler/types/TyCoRep.hs @@ -1752,7 +1752,7 @@ mkTCvSubst :: InScopeSet -> (TvSubstEnv, CvSubstEnv) -> TCvSubst mkTCvSubst in_scope (tenv, cenv) = TCvSubst in_scope tenv cenv mkTvSubst :: InScopeSet -> TvSubstEnv -> TCvSubst --- ^ Mkae a TCvSubst with specified tyvar subst and empty covar subst +-- ^ Make a TCvSubst with specified tyvar subst and empty covar subst mkTvSubst in_scope tenv = TCvSubst in_scope tenv emptyCvSubstEnv getTvSubstEnv :: TCvSubst -> TvSubstEnv diff --git a/compiler/vectorise/Vectorise/Monad/Naming.hs b/compiler/vectorise/Vectorise/Monad/Naming.hs index 9bb9bd1..1cb8d87 100644 --- a/compiler/vectorise/Vectorise/Monad/Naming.hs +++ b/compiler/vectorise/Vectorise/Monad/Naming.hs @@ -123,7 +123,7 @@ newTyVar fs k = do u <- liftDs newUnique return $ mkTyVar (mkSysTvName u fs) k --- |Mkae a fresh coercion variable with the given kind. +-- |Make a fresh coercion variable with the given kind. newCoVar :: FastString -> Kind -> VM Var newCoVar fs k = do u <- liftDs newUnique From git at git.haskell.org Sat Apr 30 18:31:46 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 30 Apr 2016 18:31:46 +0000 (UTC) Subject: [commit: ghc] master: Comment typo: unambigious -> unambiguous (49bae46) Message-ID: <20160430183146.E9E3C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/49bae464abbbc1473fa7480ef1951e0a76019d07/ghc >--------------------------------------------------------------- commit 49bae464abbbc1473fa7480ef1951e0a76019d07 Author: Ryan Scott Date: Sat Apr 30 14:34:25 2016 -0400 Comment typo: unambigious -> unambiguous [ci skip] >--------------------------------------------------------------- 49bae464abbbc1473fa7480ef1951e0a76019d07 compiler/basicTypes/Name.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/basicTypes/Name.hs b/compiler/basicTypes/Name.hs index eb820d4..2616372 100644 --- a/compiler/basicTypes/Name.hs +++ b/compiler/basicTypes/Name.hs @@ -101,7 +101,7 @@ import Data.Data ************************************************************************ -} --- | A unique, unambigious name for something, containing information about where +-- | A unique, unambiguous name for something, containing information about where -- that thing originated. data Name = Name { n_sort :: NameSort, -- What sort of name it is