From git at git.haskell.org Wed Feb 1 08:22:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 1 Feb 2017 08:22:59 +0000 (UTC) Subject: [commit: ghc] master: Typos in note header and test (99e920c) Message-ID: <20170201082259.D6F843A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/99e920c1287e0b11892b47078e8d0dfabef8e0f2/ghc >--------------------------------------------------------------- commit 99e920c1287e0b11892b47078e8d0dfabef8e0f2 Author: Gabor Greif Date: Tue Jan 31 12:41:29 2017 +0100 Typos in note header and test >--------------------------------------------------------------- 99e920c1287e0b11892b47078e8d0dfabef8e0f2 compiler/coreSyn/CoreUtils.hs | 2 +- testsuite/tests/deSugar/should_run/DsStrict.hs | 2 +- testsuite/tests/deSugar/should_run/DsStrict.stdout | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/coreSyn/CoreUtils.hs b/compiler/coreSyn/CoreUtils.hs index d8e34ad..d856e3d 100644 --- a/compiler/coreSyn/CoreUtils.hs +++ b/compiler/coreSyn/CoreUtils.hs @@ -1138,7 +1138,7 @@ exprIsOk ok_app e go _ (Let {}) = False -- Case: see Note [Case expressions are work-free] - -- App: see Note [Arugments in exprIsOk] + -- App: see Note [Arguments in exprIsOk] -- Let: the old exprIsCheap worked through lets diff --git a/testsuite/tests/deSugar/should_run/DsStrict.hs b/testsuite/tests/deSugar/should_run/DsStrict.hs index ef3f06f..aa11735 100644 --- a/testsuite/tests/deSugar/should_run/DsStrict.hs +++ b/testsuite/tests/deSugar/should_run/DsStrict.hs @@ -14,7 +14,7 @@ f1' ~n = case n of ~a -> "case2" -f2 = \a -> "lamda" +f2 = \a -> "lambda" f2' = \ ~a -> "lambda2" newtype Age = MkAge Int diff --git a/testsuite/tests/deSugar/should_run/DsStrict.stdout b/testsuite/tests/deSugar/should_run/DsStrict.stdout index 7895f2a..ec66884 100644 --- a/testsuite/tests/deSugar/should_run/DsStrict.stdout +++ b/testsuite/tests/deSugar/should_run/DsStrict.stdout @@ -2,7 +2,7 @@ fun fun2 case case2 -lamda +lambda lambda2 newtype newtype2 From git at git.haskell.org Wed Feb 1 09:04:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 1 Feb 2017 09:04:13 +0000 (UTC) Subject: [commit: ghc] master: Update output of failing 11223 tests (f660306) Message-ID: <20170201090413.ABDAE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f66030656f47ed9917d7ec6a5f80b37ec6507396/ghc >--------------------------------------------------------------- commit f66030656f47ed9917d7ec6a5f80b37ec6507396 Author: Tamar Christina Date: Wed Feb 1 06:41:48 2017 +0000 Update output of failing 11223 tests Summary: make accept new test output Test Plan: make test TEST="T11223_link_order_a_b_2_fail T11223_simple_duplicate_lib" Reviewers: austin, bgamari, simonmar Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3053 >--------------------------------------------------------------- f66030656f47ed9917d7ec6a5f80b37ec6507396 testsuite/tests/rts/T11223/T11223_link_order_a_b_2_fail.stderr | 2 +- .../tests/rts/T11223/T11223_link_order_a_b_2_fail.stderr-mingw32 | 8 ++++---- testsuite/tests/rts/T11223/T11223_simple_duplicate_lib.stderr | 2 +- .../tests/rts/T11223/T11223_simple_duplicate_lib.stderr-mingw32 | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/testsuite/tests/rts/T11223/T11223_link_order_a_b_2_fail.stderr b/testsuite/tests/rts/T11223/T11223_link_order_a_b_2_fail.stderr index b7079a6..fdb91d1 100644 --- a/testsuite/tests/rts/T11223/T11223_link_order_a_b_2_fail.stderr +++ b/testsuite/tests/rts/T11223/T11223_link_order_a_b_2_fail.stderr @@ -9,7 +9,7 @@ This could be caused by: * Specifying the same object file twice on the GHCi command line * An incorrect `package.conf' entry, causing some object to be loaded twice. -ghc-stage2: Could not on-demand load symbol 'c' +ghc-stage2: ^^ Could not load 'c', dependency unresolved. See top entry above. ByteCodeLink: can't find label diff --git a/testsuite/tests/rts/T11223/T11223_link_order_a_b_2_fail.stderr-mingw32 b/testsuite/tests/rts/T11223/T11223_link_order_a_b_2_fail.stderr-mingw32 index bf1685e..1fea3e2 100644 --- a/testsuite/tests/rts/T11223/T11223_link_order_a_b_2_fail.stderr-mingw32 +++ b/testsuite/tests/rts/T11223/T11223_link_order_a_b_2_fail.stderr-mingw32 @@ -1,14 +1,16 @@ GHC runtime linker: fatal error: I found a duplicate definition for symbol a whilst processing object file - E:/msys64/home/Tamar/ghc2/testsuite/tests/rts/T11223\libfoo_link_lib_3.a + E:\ghc-dev\msys64\home\Tamar\ghc\testsuite\tests\rts\T11223\T11223_link_order_a_b_2_fail.run\libfoo_link_lib_3.a The symbol was previously defined in - E:/msys64/home/Tamar/ghc2/testsuite/tests/rts/T11223\libbar_link_lib_3.a(bar_link_lib_3.o) + E:\ghc-dev\msys64\home\Tamar\ghc\testsuite\tests\rts\T11223\T11223_link_order_a_b_2_fail.run\libbar_link_lib_3.a(bar_link_lib_3.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. +ghc-stage2.exe: ^^ Could not load 'c', dependency unresolved. See top entry above. + ByteCodeLink: can't find label During interactive linking, GHCi couldn't find the following symbol: @@ -21,5 +23,3 @@ 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-stage2.exe: Could not on-demand load symbol 'c' - diff --git a/testsuite/tests/rts/T11223/T11223_simple_duplicate_lib.stderr b/testsuite/tests/rts/T11223/T11223_simple_duplicate_lib.stderr index 0785cdc..b5e9213 100644 --- a/testsuite/tests/rts/T11223/T11223_simple_duplicate_lib.stderr +++ b/testsuite/tests/rts/T11223/T11223_simple_duplicate_lib.stderr @@ -9,7 +9,7 @@ This could be caused by: * Specifying the same object file twice on the GHCi command line * An incorrect `package.conf' entry, causing some object to be loaded twice. -ghc-stage2: Could not on-demand load symbol 'c' +ghc-stage2: ^^ Could not load 'c', dependency unresolved. See top entry above. ByteCodeLink: can't find label diff --git a/testsuite/tests/rts/T11223/T11223_simple_duplicate_lib.stderr-mingw32 b/testsuite/tests/rts/T11223/T11223_simple_duplicate_lib.stderr-mingw32 index 151aab3..4d4656f 100644 --- a/testsuite/tests/rts/T11223/T11223_simple_duplicate_lib.stderr-mingw32 +++ b/testsuite/tests/rts/T11223/T11223_simple_duplicate_lib.stderr-mingw32 @@ -1,14 +1,16 @@ GHC runtime linker: fatal error: I found a duplicate definition for symbol a whilst processing object file - E:/msys64/home/Tamar/ghc2/testsuite/tests/rts/T11223\libfoo_dup_lib.a + E:\ghc-dev\msys64\home\Tamar\ghc\testsuite\tests\rts\T11223\T11223_simple_duplicate_lib.run\libfoo_dup_lib.a The symbol was previously defined in - bar_dup_lib.o + E:\ghc-dev\msys64\home\Tamar\ghc\testsuite\tests\rts\T11223\T11223_simple_duplicate_lib.run\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 * An incorrect `package.conf' entry, causing some object to be loaded twice. +ghc-stage2.exe: ^^ Could not load 'c', dependency unresolved. See top entry above. + ByteCodeLink: can't find label During interactive linking, GHCi couldn't find the following symbol: @@ -21,5 +23,3 @@ 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-stage2.exe: Could not on-demand load symbol 'c' - From git at git.haskell.org Wed Feb 1 10:20:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 1 Feb 2017 10:20:58 +0000 (UTC) Subject: [commit: ghc] master: Remove very broad ignore. [ci skip] (4fa439e) Message-ID: <20170201102058.BBE833A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4fa439e3ee2822f893bd364a6cbfe410a0c1e29f/ghc >--------------------------------------------------------------- commit 4fa439e3ee2822f893bd364a6cbfe410a0c1e29f Author: Tamar Christina Date: Wed Feb 1 10:20:03 2017 +0000 Remove very broad ignore. [ci skip] Summary: `.gitignore` contains a very broad ignore entry for `foo*`. This has bitten us before and should probably be removed. Reviewers: bgamari, austin Subscribers: simonpj, thomie Differential Revision: https://phabricator.haskell.org/D3054 >--------------------------------------------------------------- 4fa439e3ee2822f893bd364a6cbfe410a0c1e29f .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 7d64a12..16071f6 100644 --- a/.gitignore +++ b/.gitignore @@ -14,7 +14,6 @@ Thumbs.db *.rej *.patch *.stackdump -foo* *.hi *.hi-boot From git at git.haskell.org Wed Feb 1 18:46:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 1 Feb 2017 18:46:12 +0000 (UTC) Subject: [commit: ghc] master: Join points (8d5cf8b) Message-ID: <20170201184612.4EB383A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8d5cf8bf584fd4849917c29d82dcf46ee75dd035/ghc >--------------------------------------------------------------- commit 8d5cf8bf584fd4849917c29d82dcf46ee75dd035 Author: Luke Maurer Date: Wed Feb 1 11:56:01 2017 -0500 Join points This major patch implements Join Points, as described in https://ghc.haskell.org/trac/ghc/wiki/SequentCore. You have to read that page, and especially the paper it links to, to understand what's going on; but it is very cool. It's Luke Maurer's work, but done in close collaboration with Simon PJ. This Phab is a squash-merge of wip/join-points branch of http://github.com/lukemaurer/ghc. There are many, many interdependent changes. Reviewers: goldfire, mpickering, bgamari, simonmar, dfeuer, austin Subscribers: simonpj, dfeuer, mpickering, Mikolaj, thomie Differential Revision: https://phabricator.haskell.org/D2853 >--------------------------------------------------------------- 8d5cf8bf584fd4849917c29d82dcf46ee75dd035 compiler/backpack/RnModIface.hs | 4 +- compiler/basicTypes/BasicTypes.hs | 126 ++- compiler/basicTypes/Demand.hs | 8 +- compiler/basicTypes/Id.hs | 62 +- compiler/basicTypes/IdInfo.hs | 34 +- compiler/basicTypes/IdInfo.hs-boot | 2 + compiler/basicTypes/Var.hs | 18 +- compiler/basicTypes/VarEnv.hs | 10 +- compiler/coreSyn/CoreArity.hs | 158 +++- compiler/coreSyn/CoreArity.hs-boot | 6 + compiler/coreSyn/CoreLint.hs | 337 ++++++-- compiler/coreSyn/CorePrep.hs | 120 ++- compiler/coreSyn/CoreStats.hs | 44 +- compiler/coreSyn/CoreSubst.hs | 33 +- compiler/coreSyn/CoreSyn.hs | 223 ++++- compiler/coreSyn/CoreUnfold.hs | 47 +- compiler/coreSyn/CoreUtils.hs | 19 +- compiler/coreSyn/MkCore.hs | 1 + compiler/coreSyn/PprCore.hs | 33 +- compiler/deSugar/DsUtils.hs | 14 + compiler/iface/IfaceSyn.hs | 36 +- compiler/iface/TcIface.hs | 13 +- compiler/iface/ToIface.hs | 5 + compiler/simplCore/CSE.hs | 16 +- compiler/simplCore/CoreMonad.hs | 2 + compiler/simplCore/FloatIn.hs | 79 +- compiler/simplCore/FloatOut.hs | 261 ++++-- compiler/simplCore/LiberateCase.hs | 24 +- compiler/simplCore/OccurAnal.hs | 956 ++++++++++++++++----- compiler/simplCore/SetLevels.hs | 363 ++++++-- compiler/simplCore/SimplCore.hs | 17 +- compiler/simplCore/SimplEnv.hs | 204 ++++- compiler/simplCore/SimplUtils.hs | 29 +- compiler/simplCore/Simplify.hs | 554 ++++++++---- compiler/specialise/Rules.hs | 6 +- compiler/specialise/SpecConstr.hs | 23 +- compiler/specialise/Specialise.hs | 23 +- compiler/stgSyn/CoreToStg.hs | 286 +++--- compiler/stranal/DmdAnal.hs | 16 +- compiler/stranal/WorkWrap.hs | 74 +- compiler/stranal/WwLib.hs | 96 ++- compiler/types/Type.hs | 66 ++ compiler/utils/Outputable.hs | 13 + compiler/utils/UniqFM.hs | 10 + .../tests/deSugar/should_compile/T2431.stderr | 29 +- testsuite/tests/deriving/perf/all.T | 4 +- .../tests/numeric/should_compile/T7116.stdout | 21 +- testsuite/tests/perf/compiler/all.T | 18 +- testsuite/tests/perf/haddock/all.T | 6 +- .../should_compile => perf/join_points}/Makefile | 0 testsuite/tests/perf/join_points/all.T | 28 + testsuite/tests/perf/join_points/join001.hs | 16 + testsuite/tests/perf/join_points/join002.hs | 51 ++ .../tests/perf/join_points/join002.stdout | 0 testsuite/tests/perf/join_points/join003.hs | 69 ++ .../tests/perf/join_points/join003.stdout | 0 testsuite/tests/perf/join_points/join004.hs | 30 + testsuite/tests/perf/join_points/join004.stdout | 1 + testsuite/tests/perf/join_points/join005.hs | 23 + testsuite/tests/perf/join_points/join006.hs | 22 + testsuite/tests/perf/join_points/join007.hs | 42 + testsuite/tests/perf/join_points/join007.stdout | 1 + testsuite/tests/perf/should_run/all.T | 6 +- .../tests/roles/should_compile/Roles13.stderr | 41 +- testsuite/tests/simplCore/should_compile/Makefile | 3 +- testsuite/tests/simplCore/should_compile/T13156.hs | 37 +- .../tests/simplCore/should_compile/T13156.stdout | 4 +- .../tests/simplCore/should_compile/T3717.stderr | 17 +- .../tests/simplCore/should_compile/T3772.stdout | 17 +- .../tests/simplCore/should_compile/T4908.stderr | 19 +- .../tests/simplCore/should_compile/T4930.stderr | 28 +- .../tests/simplCore/should_compile/T5658b.stdout | 2 +- .../tests/simplCore/should_compile/T7360.stderr | 47 +- .../tests/simplCore/should_compile/T9400.stderr | 15 +- testsuite/tests/simplCore/should_compile/all.T | 3 +- .../tests/simplCore/should_compile/par01.stderr | 15 +- .../simplCore/should_compile/spec-inline.stderr | 29 +- 77 files changed, 3964 insertions(+), 1151 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 8d5cf8bf584fd4849917c29d82dcf46ee75dd035 From git at git.haskell.org Wed Feb 1 20:46:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 1 Feb 2017 20:46:56 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Update allocations for T12234 (3d65411) Message-ID: <20170201204656.0E62E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3d654115fc65cfed94f964a456e7c522b5587ea9/ghc >--------------------------------------------------------------- commit 3d654115fc65cfed94f964a456e7c522b5587ea9 Author: Ben Gamari Date: Wed Feb 1 15:45:20 2017 -0500 testsuite: Update allocations for T12234 This has been failing on Darwin since 748b79741652028827b6225c36b8ab55d22bdeb0. >--------------------------------------------------------------- 3d654115fc65cfed94f964a456e7c522b5587ea9 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 822ccb0..1ceda50 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -916,9 +916,10 @@ test('T12234', compiler_stats_num_field('bytes allocated', [(platform('x86_64-unknown-mingw32'), 77949232, 5), # initial: 77949232 - (wordsize(64), 76848856, 5), + (wordsize(64), 80882208, 5), # initial: 72958288 # 2016-01-17: 76848856 (x86-64, Linux. drift?) + # 2017-02-01: 80882208 (Use superclass instances when solving) ]), ], compile, From git at git.haskell.org Wed Feb 1 21:08:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 1 Feb 2017 21:08:36 +0000 (UTC) Subject: [commit: ghc] master: Fix documentation NOTE about can_fail (d2b681b) Message-ID: <20170201210836.324793A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d2b681bbdf8359b1813ea6c895498737eadc5261/ghc >--------------------------------------------------------------- commit d2b681bbdf8359b1813ea6c895498737eadc5261 Author: Vladislav Zavialov Date: Wed Feb 1 14:07:36 2017 +0300 Fix documentation NOTE about can_fail In the note it is explained why it's fine to discard a can_fail primop, but the table erroneously says it's not fine. >--------------------------------------------------------------- d2b681bbdf8359b1813ea6c895498737eadc5261 compiler/prelude/PrimOp.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/prelude/PrimOp.hs b/compiler/prelude/PrimOp.hs index 41458b0..cc63216 100644 --- a/compiler/prelude/PrimOp.hs +++ b/compiler/prelude/PrimOp.hs @@ -357,7 +357,7 @@ The can_fail and has_side_effects properties have the following effect on program transformations. Summary table is followed by details. can_fail has_side_effects -Discard NO NO +Discard YES NO Float in YES YES Float out NO NO Duplicate YES NO From git at git.haskell.org Thu Feb 2 04:38:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Feb 2017 04:38:10 +0000 (UTC) Subject: [commit: ghc] master: base: Derive Enum, Bounded for VecCount, VecElem (5cb5b7a) Message-ID: <20170202043810.D07703A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5cb5b7a505d3cf87b4bdac31acae2a650221d05f/ghc >--------------------------------------------------------------- commit 5cb5b7a505d3cf87b4bdac31acae2a650221d05f Author: Ben Gamari Date: Wed Feb 1 22:48:01 2017 -0500 base: Derive Enum, Bounded for VecCount, VecElem Test Plan: Validate Reviewers: RyanGlScott, austin, hvr Reviewed By: RyanGlScott Subscribers: goldfire, RyanGlScott, thomie Differential Revision: https://phabricator.haskell.org/D3059 >--------------------------------------------------------------- 5cb5b7a505d3cf87b4bdac31acae2a650221d05f compiler/prelude/TysWiredIn.hs | 4 ++-- libraries/base/GHC/Enum.hs | 12 ++++++++++++ libraries/base/changelog.md | 2 ++ libraries/ghc-prim/GHC/Types.hs | 2 ++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/compiler/prelude/TysWiredIn.hs b/compiler/prelude/TysWiredIn.hs index 66eb396..b238201 100644 --- a/compiler/prelude/TysWiredIn.hs +++ b/compiler/prelude/TysWiredIn.hs @@ -1168,7 +1168,7 @@ liftedRepDataConTy, unliftedRepDataConTy, = map (mkTyConTy . promoteDataCon) runtimeRepSimpleDataCons vecCountTyCon :: TyCon -vecCountTyCon = pcNonEnumTyCon vecCountTyConName Nothing [] +vecCountTyCon = pcTyCon True vecCountTyConName Nothing [] vecCountDataCons -- See Note [Wiring in RuntimeRep] @@ -1187,7 +1187,7 @@ vec2DataConTy, vec4DataConTy, vec8DataConTy, vec16DataConTy, vec32DataConTy, vec64DataConTy] = map (mkTyConTy . promoteDataCon) vecCountDataCons vecElemTyCon :: TyCon -vecElemTyCon = pcNonEnumTyCon vecElemTyConName Nothing [] vecElemDataCons +vecElemTyCon = pcTyCon True vecElemTyConName Nothing [] vecElemDataCons -- See Note [Wiring in RuntimeRep] vecElemDataCons :: [DataCon] diff --git a/libraries/base/GHC/Enum.hs b/libraries/base/GHC/Enum.hs index 50ca4a0..feb4585 100644 --- a/libraries/base/GHC/Enum.hs +++ b/libraries/base/GHC/Enum.hs @@ -876,3 +876,15 @@ dn_list x0 delta lim = go (x0 :: Integer) where go x | x < lim = [] | otherwise = x : go (x+delta) + +-- Instances from GHC.Types + +-- | @since 4.10.0.0 +deriving instance Bounded VecCount +-- | @since 4.10.0.0 +deriving instance Enum VecCount + +-- | @since 4.10.0.0 +deriving instance Bounded VecElem +-- | @since 4.10.0.0 +deriving instance Enum VecElem diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index 40e18ff..afb9e9f 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -199,6 +199,8 @@ * The field `spInfoName` of `GHC.StaticPtr.StaticPtrInfo` has been removed. The value is no longer available when constructing the `StaticPtr`. + * `VecElem` and `VecCount` now have `Enum` and `Bounded` instances. + ### Generalizations * Generalize `Debug.Trace.{traceM, traceShowM}` from `Monad` to `Applicative` diff --git a/libraries/ghc-prim/GHC/Types.hs b/libraries/ghc-prim/GHC/Types.hs index 16a4921..c913af6 100644 --- a/libraries/ghc-prim/GHC/Types.hs +++ b/libraries/ghc-prim/GHC/Types.hs @@ -395,6 +395,7 @@ data VecCount = Vec2 | Vec16 | Vec32 | Vec64 +-- Enum, Bounded instances in GHC.Enum -- | Element of a SIMD vector type data VecElem = Int8ElemRep @@ -407,6 +408,7 @@ data VecElem = Int8ElemRep | Word64ElemRep | FloatElemRep | DoubleElemRep +-- Enum, Bounded instances in GHC.Enum {- ********************************************************************* * * From git at git.haskell.org Thu Feb 2 04:38:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Feb 2017 04:38:13 +0000 (UTC) Subject: [commit: ghc] master: Don't tick top-level string literals (f5b275a) Message-ID: <20170202043813.8DE453A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f5b275a239d2554c4da0b7621211642bf3b10650/ghc >--------------------------------------------------------------- commit f5b275a239d2554c4da0b7621211642bf3b10650 Author: Ben Gamari Date: Wed Feb 1 22:48:32 2017 -0500 Don't tick top-level string literals This fixes a regression due to D2605 (see #8472) wherein top-level primitive strings would fail to be noticed by CoreToStg as they were wrapped in a tick. This resulted in a panic in CoreToStg due to inconsistent CAF information (or a Core Lint failure, if enabled). Here we document the invariant that unlifted expressions can only sit at top-level if of the form `Lit (MachStr ...)` with no ticks or other embellishments. Moreover, we fix instance of this in `Simplify.prepareRhs` and `FloatOut.wrapTick` where this invariant was being broken. Test Plan: Validate with `-g`. Run testsuite with `WAY=ghci`. Reviewers: austin, simonpj Reviewed By: simonpj Subscribers: simonpj, akio, scpmw, thomie Differential Revision: https://phabricator.haskell.org/D3051 >--------------------------------------------------------------- f5b275a239d2554c4da0b7621211642bf3b10650 compiler/coreSyn/CoreSyn.hs | 5 +++++ compiler/simplCore/FloatOut.hs | 32 ++++++++++++++++++++------------ compiler/simplCore/Simplify.hs | 10 ++++++++-- 3 files changed, 33 insertions(+), 14 deletions(-) diff --git a/compiler/coreSyn/CoreSyn.hs b/compiler/coreSyn/CoreSyn.hs index f74e3e5..f8cf6f4 100644 --- a/compiler/coreSyn/CoreSyn.hs +++ b/compiler/coreSyn/CoreSyn.hs @@ -383,6 +383,11 @@ The solution is simply to allow top-level unlifted binders. We can't allow arbitrary unlifted expression at the top-level though, unlifted binders cannot be thunks, so we just allow string literals. +It is important to note that top-level primitive string literals cannot be +wrapped in Ticks, as is otherwise done with lifted bindings. CoreToStg expects +to see just a plain (Lit (MachStr ...)) expression on the RHS of primitive +string bindings; anything else and things break. CoreLint checks this invariant. + Also see Note [Compilation plan for top-level string literals]. Note [Compilation plan for top-level string literals] diff --git a/compiler/simplCore/FloatOut.hs b/compiler/simplCore/FloatOut.hs index 17ffba4..4806862 100644 --- a/compiler/simplCore/FloatOut.hs +++ b/compiler/simplCore/FloatOut.hs @@ -22,6 +22,7 @@ import ErrUtils ( dumpIfSet_dyn ) import Id ( Id, idArity, idType, isBottomingId, isJoinId, isJoinId_maybe ) import Var ( Var ) +import BasicTypes ( TopLevelFlag(..), isTopLevel ) import SetLevels import UniqSupply ( UniqSupply ) import Bag @@ -735,19 +736,26 @@ atJoinCeiling (fs, floats, expr') wrapTick :: Tickish Id -> FloatBinds -> FloatBinds wrapTick t (FB tops ceils defns) - = FB (mapBag wrap_bind tops) (wrap_defns ceils) - (M.map (M.map wrap_defns) defns) + = FB (mapBag (wrap_bind TopLevel) tops) + (wrap_defns NotTopLevel ceils) + (M.map (M.map (wrap_defns NotTopLevel)) defns) where - wrap_defns = mapBag wrap_one - - wrap_bind (NonRec binder rhs) = NonRec binder (maybe_tick rhs) - wrap_bind (Rec pairs) = Rec (mapSnd maybe_tick pairs) - - wrap_one (FloatLet bind) = FloatLet (wrap_bind bind) - wrap_one (FloatCase e b c bs) = FloatCase (maybe_tick e) b c bs - - maybe_tick e | exprIsHNF e = tickHNFArgs t e - | otherwise = mkTick t e + wrap_defns toplvl = mapBag (wrap_one toplvl) + + wrap_bind toplvl (NonRec binder rhs) = NonRec binder (maybe_tick toplvl rhs) + wrap_bind toplvl (Rec pairs) = Rec (mapSnd (maybe_tick toplvl) pairs) + + wrap_one toplvl (FloatLet bind) = FloatLet (wrap_bind toplvl bind) + wrap_one toplvl (FloatCase e b c bs) = FloatCase (maybe_tick toplvl e) b c bs + + maybe_tick :: TopLevelFlag -> CoreExpr -> CoreExpr + maybe_tick toplvl e + -- We must take care not to tick top-level literal + -- strings as this violated the Core invariants. See Note [CoreSyn + -- top-level string literals]. + | isTopLevel toplvl && exprIsLiteralString e = e + | exprIsHNF e = tickHNFArgs t e + | otherwise = mkTick t e -- we don't need to wrap a tick around an HNF when we float it -- outside a tick: that is an invariant of the tick semantics -- Conversely, inlining of HNFs inside an SCC is allowed, and diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index 7c6f875..7357e32 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -566,9 +566,15 @@ prepareRhs top_lvl env0 id rhs0 -- On the other hand, for scoping ticks we need to be able to -- copy them on the floats, which in turn is only allowed if -- we can obtain non-counting ticks. - | not (tickishCounts t) || tickishCanSplit t + | (not (tickishCounts t) || tickishCanSplit t) = do { (is_exp, env', rhs') <- go n_val_args (zapFloats env) rhs - ; let tickIt (id, expr) = (id, mkTick (mkNoCount t) expr) + ; let tickIt (id, expr) + -- we have to take care not to tick top-level literal + -- strings. See Note [CoreSyn top-level string literals]. + | isTopLevel top_lvl && exprIsLiteralString expr + = (id, expr) + | otherwise + = (id, mkTick (mkNoCount t) expr) floats' = seFloats $ env `addFloats` mapFloats env' tickIt ; return (is_exp, env' { seFloats = floats' }, Tick t rhs') } From git at git.haskell.org Thu Feb 2 04:38:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Feb 2017 04:38:19 +0000 (UTC) Subject: [commit: ghc] master: Make interface loading for COMPLETE pragmas lazy (b16239a) Message-ID: <20170202043819.7D49D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b16239a95b730dd2d6fc0dbb18c8430669f2c187/ghc >--------------------------------------------------------------- commit b16239a95b730dd2d6fc0dbb18c8430669f2c187 Author: Matthew Pickering Date: Wed Feb 1 22:54:31 2017 -0500 Make interface loading for COMPLETE pragmas lazy Without this additional laziness we will loop forever trying to find the definitions of the conlikes referenced in the pragma. Fixes #13188 Reviewers: austin, RyanGlScott, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3058 GHC Trac Issues: #13188 >--------------------------------------------------------------- b16239a95b730dd2d6fc0dbb18c8430669f2c187 compiler/iface/TcIface.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/iface/TcIface.hs b/compiler/iface/TcIface.hs index f6a4f41..d2ddeb2 100644 --- a/compiler/iface/TcIface.hs +++ b/compiler/iface/TcIface.hs @@ -1033,8 +1033,9 @@ tcIfaceCompleteSigs :: [IfaceCompleteMatch] -> IfL [CompleteMatch] tcIfaceCompleteSigs = mapM tcIfaceCompleteSig tcIfaceCompleteSig :: IfaceCompleteMatch -> IfL CompleteMatch -tcIfaceCompleteSig (IfaceCompleteMatch ms t) = - CompleteMatch <$> (mapM tcIfaceConLike ms) <*> tcIfaceTyConByName t +tcIfaceCompleteSig cm@(IfaceCompleteMatch ms t) = + forkM (text "COMPLETE" <+> ppr cm) $ + CompleteMatch <$> mapM tcIfaceConLike ms <*> tcIfaceTyConByName t {- ************************************************************************ From git at git.haskell.org Thu Feb 2 04:38:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Feb 2017 04:38:16 +0000 (UTC) Subject: [commit: ghc] master: Introduce GHC.TypeNats module, change KnownNat evidence to be Natural (1fcede4) Message-ID: <20170202043816.BB3183A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1fcede43d2b30f33b7505e25eb6b1f321be0407f/ghc >--------------------------------------------------------------- commit 1fcede43d2b30f33b7505e25eb6b1f321be0407f Author: Oleg Grenrus Date: Wed Feb 1 22:49:17 2017 -0500 Introduce GHC.TypeNats module, change KnownNat evidence to be Natural Reviewers: dfeuer, austin, hvr, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3024 GHC Trac Issues: #13181 >--------------------------------------------------------------- 1fcede43d2b30f33b7505e25eb6b1f321be0407f compiler/coreSyn/MkCore.hs | 11 +- compiler/deSugar/DsBinds.hs | 2 +- compiler/prelude/PrelNames.hs | 27 +++- docs/users_guide/8.2.1-notes.rst | 4 + libraries/base/Data/Data.hs | 18 +++ libraries/base/Data/Typeable/Internal.hs | 3 +- libraries/base/GHC/Exception.hs | 4 +- libraries/base/GHC/Exception.hs-boot | 4 +- libraries/base/GHC/Natural.hs | 79 +++++----- libraries/base/GHC/TypeLits.hs | 78 ++-------- libraries/base/GHC/TypeNats.hs | 160 +++++++++++++++++++++ libraries/base/base.cabal | 1 + libraries/base/changelog.md | 4 + .../tests/annotations/should_fail/annfail10.stderr | 4 +- testsuite/tests/ghci/scripts/T9181.stdout | 26 ++-- .../tests/typecheck/should_fail/T12921.stderr | 2 +- 16 files changed, 302 insertions(+), 125 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 1fcede43d2b30f33b7505e25eb6b1f321be0407f From git at git.haskell.org Thu Feb 2 05:20:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Feb 2017 05:20:01 +0000 (UTC) Subject: [commit: ghc] master: Add support for StaticPointers in GHCi (eedb3df) Message-ID: <20170202052001.3D01F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/eedb3df0c1c28a7abc43705d614239c1c6199a1f/ghc >--------------------------------------------------------------- commit eedb3df0c1c28a7abc43705d614239c1c6199a1f Author: Ben Gamari Date: Wed Feb 1 23:39:52 2017 -0500 Add support for StaticPointers in GHCi Here we add support to GHCi for StaticPointers. This process begins by adding remote GHCi messages for adding entries to the static pointer table. We then collect binders needing SPT entries after linking and send the interpreter a message adding entries with the appropriate fingerprints. Test Plan: `make test TEST=StaticPtr` Reviewers: facundominguez, mboes, simonpj, simonmar, goldfire, austin, hvr, erikd Reviewed By: simonpj, simonmar Subscribers: RyanGlScott, simonpj, thomie Differential Revision: https://phabricator.haskell.org/D2504 GHC Trac Issues: #12356 >--------------------------------------------------------------- eedb3df0c1c28a7abc43705d614239c1c6199a1f compiler/ghci/GHCi.hsc | 7 +++++ compiler/main/DriverPipeline.hs | 5 ++-- compiler/main/GHC.hs | 17 ++++++++++-- compiler/main/GhcMake.hs | 12 +++++++++ compiler/main/HscMain.hs | 24 ++++++++++++++--- compiler/main/HscTypes.hs | 30 ++++++++++++++++----- compiler/main/InteractiveEval.hs | 2 +- compiler/main/StaticPtrTable.hs | 38 ++++++++++++++++----------- compiler/main/TidyPgm.hs | 18 ++++++++++--- compiler/rename/RnExpr.hs | 9 ------- docs/users_guide/8.2.1-notes.rst | 3 +++ docs/users_guide/glasgow_exts.rst | 7 +++++ includes/rts/StaticPtrTable.h | 8 ++++++ libraries/ghci/GHCi/Message.hs | 8 +++++- libraries/ghci/GHCi/Run.hs | 2 ++ libraries/ghci/GHCi/StaticPtrTable.hs | 24 +++++++++++++++++ libraries/ghci/ghci.cabal.in | 1 + rts/RtsSymbols.c | 1 + rts/StaticPtrTable.c | 12 ++++++--- testsuite/tests/ghci/scripts/StaticPtr.hs | 20 ++++++++++++++ testsuite/tests/ghci/scripts/StaticPtr.script | 27 +++++++++++++++++++ testsuite/tests/ghci/scripts/StaticPtr.stderr | 3 +++ testsuite/tests/ghci/scripts/StaticPtr.stdout | 2 ++ testsuite/tests/ghci/scripts/T9878.stderr | 4 --- testsuite/tests/ghci/scripts/all.T | 1 + 25 files changed, 232 insertions(+), 53 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 eedb3df0c1c28a7abc43705d614239c1c6199a1f From git at git.haskell.org Thu Feb 2 11:17:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Feb 2017 11:17:40 +0000 (UTC) Subject: [commit: ghc] master: Spelling fixes (8dd82ea) Message-ID: <20170202111740.8BC183A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8dd82ead7ddd65348bcbea4e2bb8defce4253173/ghc >--------------------------------------------------------------- commit 8dd82ead7ddd65348bcbea4e2bb8defce4253173 Author: Gabor Greif Date: Wed Feb 1 11:29:47 2017 +0100 Spelling fixes >--------------------------------------------------------------- 8dd82ead7ddd65348bcbea4e2bb8defce4253173 compiler/cmm/CmmLayoutStack.hs | 2 +- compiler/coreSyn/CoreFVs.hs | 4 ++-- compiler/coreSyn/CoreSyn.hs | 2 +- compiler/hsSyn/Convert.hs | 2 +- compiler/stranal/WwLib.hs | 2 +- compiler/typecheck/TcGenFunctor.hs | 2 +- compiler/typecheck/TcInteract.hs | 2 +- compiler/typecheck/TcSplice.hs | 2 +- compiler/utils/GraphOps.hs | 2 +- docs/users_guide/conf.py | 10 +++++----- docs/users_guide/editing-guide.rst | 8 ++++---- docs/users_guide/ghc-theme/layout.html | 2 +- docs/users_guide/index.rst | 6 +++--- docs/users_guide/safe_haskell.rst | 4 ++-- libraries/base/GHC/TypeLits.hs | 2 +- libraries/template-haskell/Language/Haskell/TH/Ppr.hs | 2 +- libraries/template-haskell/Language/Haskell/TH/Syntax.hs | 2 +- mk/get-win32-tarballs.sh | 2 +- testsuite/tests/concurrent/prog003/Main.lhs | 2 +- testsuite/tests/concurrent/prog003/MainMVarList.lhs | 2 +- testsuite/tests/plugins/all.T | 2 +- testsuite/tests/plugins/plugins03.hs | 2 +- testsuite/tests/plugins/plugins03.stderr | 2 +- testsuite/tests/typecheck/should_compile/T6018.hs | 2 +- utils/mkUserGuidePart/Main.hs | 4 ++-- utils/testremove/checkremove.hs | 4 ++-- 26 files changed, 39 insertions(+), 39 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 8dd82ead7ddd65348bcbea4e2bb8defce4253173 From git at git.haskell.org Thu Feb 2 17:05:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Feb 2017 17:05:38 +0000 (UTC) Subject: [commit: ghc] master: Add a testcase for #13227 (d8ac64e) Message-ID: <20170202170538.32D5C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d8ac64e782b8543e5a525c7bb738620bd09aa398/ghc >--------------------------------------------------------------- commit d8ac64e782b8543e5a525c7bb738620bd09aa398 Author: Joachim Breitner Date: Thu Feb 2 12:04:43 2017 -0500 Add a testcase for #13227 where an expected float-out is not happening. >--------------------------------------------------------------- d8ac64e782b8543e5a525c7bb738620bd09aa398 testsuite/tests/simplCore/should_run/T13227.hs | 10 ++++++++++ testsuite/tests/simplCore/should_run/T13227.stderr | 1 + testsuite/tests/simplCore/should_run/all.T | 1 + 3 files changed, 12 insertions(+) diff --git a/testsuite/tests/simplCore/should_run/T13227.hs b/testsuite/tests/simplCore/should_run/T13227.hs new file mode 100644 index 0000000..7bf1b84 --- /dev/null +++ b/testsuite/tests/simplCore/should_run/T13227.hs @@ -0,0 +1,10 @@ +import Debug.Trace + +g x expensive ys = let h = \y -> y + expensive x + in map h ys +{-# NOINLINE g #-} + +foo x = trace "Evaluate me only once!" x + +main = sum (g 1 foo [1,2,3]) `seq` return () + diff --git a/testsuite/tests/simplCore/should_run/T13227.stderr b/testsuite/tests/simplCore/should_run/T13227.stderr new file mode 100644 index 0000000..9b9ef72 --- /dev/null +++ b/testsuite/tests/simplCore/should_run/T13227.stderr @@ -0,0 +1 @@ +Evaluate me only once! diff --git a/testsuite/tests/simplCore/should_run/all.T b/testsuite/tests/simplCore/should_run/all.T index 68bd12c..6fe17e1 100644 --- a/testsuite/tests/simplCore/should_run/all.T +++ b/testsuite/tests/simplCore/should_run/all.T @@ -73,3 +73,4 @@ test('T12689broken', expect_broken(12689), compile_and_run, ['']) test('T12689a', normal, compile_and_run, ['']) test('T13172', only_ways(['optasm']), compile_and_run, ['-dcore-lint']) +test('T13227', expect_broken(13227), compile_and_run, ['']) From git at git.haskell.org Thu Feb 2 17:54:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Feb 2017 17:54:11 +0000 (UTC) Subject: [commit: ghc] branch 'wip/T13227' created Message-ID: <20170202175411.140F43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/T13227 Referencing: 99857796bdac0845e62ed7d134b9696bbdf884c5 From git at git.haskell.org Thu Feb 2 17:54:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Feb 2017 17:54:13 +0000 (UTC) Subject: [commit: ghc] wip/T13227: Get rid of ProbOneShot (9985779) Message-ID: <20170202175413.C9F843A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T13227 Link : http://ghc.haskell.org/trac/ghc/changeset/99857796bdac0845e62ed7d134b9696bbdf884c5/ghc >--------------------------------------------------------------- commit 99857796bdac0845e62ed7d134b9696bbdf884c5 Author: Joachim Breitner Date: Thu Feb 2 12:52:57 2017 -0500 Get rid of ProbOneShot This fixes #13227. It remains to be seen what the performance impacts are. Pushing as a branch to get perf.haskell.org answer that for us. >--------------------------------------------------------------- 99857796bdac0845e62ed7d134b9696bbdf884c5 compiler/basicTypes/BasicTypes.hs | 7 ------- compiler/basicTypes/Demand.hs | 22 ++++------------------ compiler/basicTypes/Id.hs | 3 +-- testsuite/tests/simplCore/should_run/all.T | 2 +- 4 files changed, 6 insertions(+), 28 deletions(-) diff --git a/compiler/basicTypes/BasicTypes.hs b/compiler/basicTypes/BasicTypes.hs index ff4d2c7..49ecc72 100644 --- a/compiler/basicTypes/BasicTypes.hs +++ b/compiler/basicTypes/BasicTypes.hs @@ -211,8 +211,6 @@ type Alignment = Int -- align to next N-byte boundary (N must be a power of 2). -- work. data OneShotInfo = NoOneShotInfo -- ^ No information - | ProbOneShot -- ^ The lambda is probably applied at most once - -- See Note [Computing one-shot info, and ProbOneShot] in Demand | OneShotLam -- ^ The lambda is applied at most once. deriving (Eq) @@ -229,18 +227,13 @@ hasNoOneShotInfo _ = False worstOneShot, bestOneShot :: OneShotInfo -> OneShotInfo -> OneShotInfo worstOneShot NoOneShotInfo _ = NoOneShotInfo -worstOneShot ProbOneShot NoOneShotInfo = NoOneShotInfo -worstOneShot ProbOneShot _ = ProbOneShot worstOneShot OneShotLam os = os bestOneShot NoOneShotInfo os = os -bestOneShot ProbOneShot OneShotLam = OneShotLam -bestOneShot ProbOneShot _ = ProbOneShot bestOneShot OneShotLam _ = OneShotLam pprOneShotInfo :: OneShotInfo -> SDoc pprOneShotInfo NoOneShotInfo = empty -pprOneShotInfo ProbOneShot = text "ProbOneShot" pprOneShotInfo OneShotLam = text "OneShot" instance Outputable OneShotInfo where diff --git a/compiler/basicTypes/Demand.hs b/compiler/basicTypes/Demand.hs index 8cacf22..d7fa57c 100644 --- a/compiler/basicTypes/Demand.hs +++ b/compiler/basicTypes/Demand.hs @@ -1783,13 +1783,13 @@ it should not fall over. -} argsOneShots :: StrictSig -> Arity -> [[OneShotInfo]] --- See Note [Computing one-shot info, and ProbOneShot] +-- See Note [Computing one-shot info] argsOneShots (StrictSig (DmdType _ arg_ds _)) n_val_args = go arg_ds where unsaturated_call = arg_ds `lengthExceeds` n_val_args good_one_shot - | unsaturated_call = ProbOneShot + | unsaturated_call = NoOneShotInfo | otherwise = OneShotLam go [] = [] @@ -1813,7 +1813,7 @@ saturatedByOneShots n (JD { ud = usg }) go n (UCall One u) = go (n-1) u go _ _ = False -argOneShots :: OneShotInfo -- OneShotLam or ProbOneShot, +argOneShots :: OneShotInfo -- OneShotLam or NoOneShotInfo, -> Demand -- depending on saturation -> [OneShotInfo] argOneShots one_shot_info (JD { ud = usg }) @@ -1825,7 +1825,7 @@ argOneShots one_shot_info (JD { ud = usg }) go (UCall Many u) = NoOneShotInfo : go u go _ = [] -{- Note [Computing one-shot info, and ProbOneShot] +{- Note [Computing one-shot info] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Consider a call f (\pqr. e1) (\xyz. e2) e3 @@ -1835,20 +1835,6 @@ Then argsOneShots returns a [[OneShotInfo]] of [[OneShot,NoOneShotInfo,OneShot], [OneShot]] The occurrence analyser propagates this one-shot infor to the binders \pqr and \xyz; see Note [Use one-shot information] in OccurAnal. - -But suppose f was not saturated, so the call looks like - f (\pqr. e1) (\xyz. e2) -The in principle this partial application might be shared, and -the (\prq.e1) abstraction might be called more than once. So -we can't mark them OneShot. But instead we return - [[ProbOneShot,NoOneShotInfo,ProbOneShot], [ProbOneShot]] -The occurrence analyser propagates this to the \pqr and \xyz -binders. - -How is it used? Well, it's quite likely that the partial application -of f is not shared, so the float-out pass (in SetLevels.lvlLamBndrs) -does not float MFEs out of a ProbOneShot lambda. That currently is -the only way that ProbOneShot is used. -} -- appIsBottom returns true if an application to n args diff --git a/compiler/basicTypes/Id.hs b/compiler/basicTypes/Id.hs index acb22e8..09e018c 100644 --- a/compiler/basicTypes/Id.hs +++ b/compiler/basicTypes/Id.hs @@ -762,7 +762,7 @@ isOneShotBndr var -- | Should we apply the state hack to values of this 'Type'? stateHackOneShot :: OneShotInfo -stateHackOneShot = OneShotLam -- Or maybe ProbOneShot? +stateHackOneShot = OneShotLam typeOneShot :: Type -> OneShotInfo typeOneShot ty @@ -798,7 +798,6 @@ isStateHackType ty isProbablyOneShotLambda :: Id -> Bool isProbablyOneShotLambda id = case idStateHackOneShotInfo id of OneShotLam -> True - ProbOneShot -> True NoOneShotInfo -> False setOneShotLambda :: Id -> Id diff --git a/testsuite/tests/simplCore/should_run/all.T b/testsuite/tests/simplCore/should_run/all.T index 6fe17e1..702d83c 100644 --- a/testsuite/tests/simplCore/should_run/all.T +++ b/testsuite/tests/simplCore/should_run/all.T @@ -73,4 +73,4 @@ test('T12689broken', expect_broken(12689), compile_and_run, ['']) test('T12689a', normal, compile_and_run, ['']) test('T13172', only_ways(['optasm']), compile_and_run, ['-dcore-lint']) -test('T13227', expect_broken(13227), compile_and_run, ['']) +test('T13227', normal, compile_and_run, ['']) From git at git.haskell.org Thu Feb 2 19:06:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Feb 2017 19:06:45 +0000 (UTC) Subject: [commit: packages/haskeline] master: Update changelog. (2002f85) Message-ID: <20170202190645.1AF0D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/haskeline On branch : master Link : http://git.haskell.org/packages/haskeline.git/commitdiff/2002f85b021e4508190894234e2714894d2ec277 >--------------------------------------------------------------- commit 2002f85b021e4508190894234e2714894d2ec277 Author: Judah Jacobson Date: Wed Jan 11 16:02:21 2017 -0800 Update changelog. >--------------------------------------------------------------- 2002f85b021e4508190894234e2714894d2ec277 Changelog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Changelog b/Changelog index 1ff7b9b..137d83a 100644 --- a/Changelog +++ b/Changelog @@ -1,6 +1,8 @@ Changed in version 0.7.3.0: * Require ghc version of at least 7.4.1, and clean up obsolete code * Add thread-safe (in terminal-style interaction) external print function + * Add a MonadFix instance for InputT + * Bump upper bounds on `base` and `directory` to support ghc-8.0.2 Changed in version 0.7.2.3: * Fix hsc2hs-related warning on ghc-8 From git at git.haskell.org Thu Feb 2 19:06:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Feb 2017 19:06:47 +0000 (UTC) Subject: [commit: packages/haskeline] master: Properly disable echoing in getPassword when running in MinTTY (#52) (9027b63) Message-ID: <20170202190647.252323A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/haskeline On branch : master Link : http://git.haskell.org/packages/haskeline.git/commitdiff/9027b63a5a80cb5ce5668e311ad57326a72775b6 >--------------------------------------------------------------- commit 9027b63a5a80cb5ce5668e311ad57326a72775b6 Author: Ryan Scott Date: Mon Jan 30 22:46:20 2017 -0500 Properly disable echoing in getPassword when running in MinTTY (#52) Fixes #50. >--------------------------------------------------------------- 9027b63a5a80cb5ce5668e311ad57326a72775b6 System/Console/Haskeline.hs | 8 +- System/Console/Haskeline/Backend/Posix.hsc | 13 +- System/Console/Haskeline/Backend/Win32.hsc | 12 +- System/Console/Haskeline/Backend/Win32/Echo.hs | 171 +++++++++++++++++++++++++ System/Console/Haskeline/Directory.hsc | 9 +- System/Console/Haskeline/Term.hs | 3 +- haskeline.cabal | 8 +- includes/windows_cconv.h | 12 ++ 8 files changed, 207 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 9027b63a5a80cb5ce5668e311ad57326a72775b6 From git at git.haskell.org Thu Feb 2 19:06:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Feb 2017 19:06:49 +0000 (UTC) Subject: [commit: packages/haskeline] master: Use cast from Data.Typeable instead of Data.Dynamic (#53) (39168d2) Message-ID: <20170202190649.2C6D03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/haskeline On branch : master Link : http://git.haskell.org/packages/haskeline.git/commitdiff/39168d2feaebb0c16b8415727283a031afc7c721 >--------------------------------------------------------------- commit 39168d2feaebb0c16b8415727283a031afc7c721 Author: Ben Gamari Date: Thu Feb 2 07:13:10 2017 +0000 Use cast from Data.Typeable instead of Data.Dynamic (#53) >--------------------------------------------------------------- 39168d2feaebb0c16b8415727283a031afc7c721 System/Console/Haskeline/Backend/Posix.hsc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/System/Console/Haskeline/Backend/Posix.hsc b/System/Console/Haskeline/Backend/Posix.hsc index 0ceb144..ec76a98 100644 --- a/System/Console/Haskeline/Backend/Posix.hsc +++ b/System/Console/Haskeline/Backend/Posix.hsc @@ -34,7 +34,7 @@ import System.Console.Haskeline.Prefs import System.Console.Haskeline.Backend.Posix.Encoder import GHC.IO.FD (fdFD) -import Data.Dynamic (cast) +import Data.Typeable (cast) import System.IO.Error import GHC.IO.Exception import GHC.IO.Handle.Types hiding (getState) From git at git.haskell.org Thu Feb 2 19:15:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Feb 2017 19:15:08 +0000 (UTC) Subject: [commit: packages/pretty] tag 'v1.1.3.4' created Message-ID: <20170202191508.EF7CE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/pretty New tag : v1.1.3.4 Referencing: 38222e338233d90773627be1a3e92d5bbacbd7e0 From git at git.haskell.org Thu Feb 2 19:15:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Feb 2017 19:15:11 +0000 (UTC) Subject: [commit: packages/pretty] master: Fix typo (5f1a7bf) Message-ID: <20170202191511.016663A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/pretty On branch : master Link : http://git.haskell.org/packages/pretty.git/commitdiff/5f1a7bf2d18b06e1692593c417a56ef022dac5e4 >--------------------------------------------------------------- commit 5f1a7bf2d18b06e1692593c417a56ef022dac5e4 Author: Christoph Hegemann Date: Mon Apr 25 12:34:09 2016 +0200 Fix typo >--------------------------------------------------------------- 5f1a7bf2d18b06e1692593c417a56ef022dac5e4 src/Text/PrettyPrint/HughesPJ.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Text/PrettyPrint/HughesPJ.hs b/src/Text/PrettyPrint/HughesPJ.hs index 3780e21..0925774 100644 --- a/src/Text/PrettyPrint/HughesPJ.hs +++ b/src/Text/PrettyPrint/HughesPJ.hs @@ -299,7 +299,7 @@ vcat = liftList Ann.vcat -- -- * @'nest' k ('nest' k' x) = 'nest' (k+k') x@ -- --- * @'nest' k (x '<>' y) = 'nest' k z '<>' 'nest' k y@ +-- * @'nest' k (x '<>' y) = 'nest' k x '<>' 'nest' k y@ -- -- * @'nest' k (x '$$' y) = 'nest' k x '$$' 'nest' k y@ -- From git at git.haskell.org Thu Feb 2 19:15:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Feb 2017 19:15:13 +0000 (UTC) Subject: [commit: packages/pretty] master: Merge pull request #34 from kRITZCREEK/patch-1 (fb6d5b1) Message-ID: <20170202191513.075283A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/pretty On branch : master Link : http://git.haskell.org/packages/pretty.git/commitdiff/fb6d5b184e419fba3d9a9fa9c3c8da200dcff4b4 >--------------------------------------------------------------- commit fb6d5b184e419fba3d9a9fa9c3c8da200dcff4b4 Merge: 3b84566 5f1a7bf Author: David Terei Date: Mon Apr 25 11:38:04 2016 -0700 Merge pull request #34 from kRITZCREEK/patch-1 Fix typo >--------------------------------------------------------------- fb6d5b184e419fba3d9a9fa9c3c8da200dcff4b4 src/Text/PrettyPrint/HughesPJ.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) From git at git.haskell.org Thu Feb 2 19:15:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Feb 2017 19:15:15 +0000 (UTC) Subject: [commit: packages/pretty] master: Rename todo document (3858310) Message-ID: <20170202191515.0C2473A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/pretty On branch : master Link : http://git.haskell.org/packages/pretty.git/commitdiff/3858310e1eddeae36f928dbd9cdf93780cbeea56 >--------------------------------------------------------------- commit 3858310e1eddeae36f928dbd9cdf93780cbeea56 Author: David Terei Date: Wed Jun 1 21:16:46 2016 -0700 Rename todo document >--------------------------------------------------------------- 3858310e1eddeae36f928dbd9cdf93780cbeea56 TODO => docs/new-pretty.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/TODO b/docs/new-pretty.md similarity index 100% rename from TODO rename to docs/new-pretty.md From git at git.haskell.org Thu Feb 2 19:15:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Feb 2017 19:15:17 +0000 (UTC) Subject: [commit: packages/pretty] master: Fix testsuite (21fc457) Message-ID: <20170202191517.1345E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/pretty On branch : master Link : http://git.haskell.org/packages/pretty.git/commitdiff/21fc4577b1ce2bcd63f3064282f755371160894a >--------------------------------------------------------------- commit 21fc4577b1ce2bcd63f3064282f755371160894a Author: David Terei Date: Wed Jun 1 21:17:22 2016 -0700 Fix testsuite >--------------------------------------------------------------- 21fc4577b1ce2bcd63f3064282f755371160894a src/Text/PrettyPrint/Annotated/HughesPJ.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Text/PrettyPrint/Annotated/HughesPJ.hs b/src/Text/PrettyPrint/Annotated/HughesPJ.hs index dc2133a..77a59c2 100644 --- a/src/Text/PrettyPrint/Annotated/HughesPJ.hs +++ b/src/Text/PrettyPrint/Annotated/HughesPJ.hs @@ -262,7 +262,11 @@ data TextDetails = Chr {-# UNPACK #-} !Char -- ^ A single Char fragment -- Combining @Doc@ values #if __GLASGOW_HASKELL__ >= 800 instance Semi.Semigroup (Doc a) where +#ifndef TESTING (<>) = (Text.PrettyPrint.Annotated.HughesPJ.<>) +#else + (<>) = (PrettyTestVersion.<>) +#endif instance Monoid (Doc a) where mempty = empty From git at git.haskell.org Thu Feb 2 19:15:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Feb 2017 19:15:19 +0000 (UTC) Subject: [commit: packages/pretty] master: Run testsuite with small stack (issue #29) (f904ff7) Message-ID: <20170202191519.186A83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/pretty On branch : master Link : http://git.haskell.org/packages/pretty.git/commitdiff/f904ff769691d56c3fa4e814912c01624101e714 >--------------------------------------------------------------- commit f904ff769691d56c3fa4e814912c01624101e714 Author: David Terei Date: Wed Jun 1 21:17:41 2016 -0700 Run testsuite with small stack (issue #29) >--------------------------------------------------------------- f904ff769691d56c3fa4e814912c01624101e714 pretty.cabal | 1 + 1 file changed, 1 insertion(+) diff --git a/pretty.cabal b/pretty.cabal index 0786a2f..4bfef78 100644 --- a/pretty.cabal +++ b/pretty.cabal @@ -64,4 +64,5 @@ Test-Suite test-pretty UnitT3911 extensions: CPP, BangPatterns, DeriveGeneric include-dirs: src/Text/PrettyPrint/Annotated + ghc-options: -rtsopts -with-rtsopts=-K2M From git at git.haskell.org Thu Feb 2 19:15:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Feb 2017 19:15:21 +0000 (UTC) Subject: [commit: packages/pretty] master: #32, remove a harmful $! (bbe9270) Message-ID: <20170202191521.1EAF83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/pretty On branch : master Link : http://git.haskell.org/packages/pretty.git/commitdiff/bbe9270c5f849a5bb74c9166a5f4202cfb0dba22 >--------------------------------------------------------------- commit bbe9270c5f849a5bb74c9166a5f4202cfb0dba22 Author: Neil Mitchell Date: Thu Jun 2 13:15:01 2016 +0100 #32, remove a harmful $! >--------------------------------------------------------------- bbe9270c5f849a5bb74c9166a5f4202cfb0dba22 src/Text/PrettyPrint/Annotated/HughesPJ.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Text/PrettyPrint/Annotated/HughesPJ.hs b/src/Text/PrettyPrint/Annotated/HughesPJ.hs index 77a59c2..33623ff 100644 --- a/src/Text/PrettyPrint/Annotated/HughesPJ.hs +++ b/src/Text/PrettyPrint/Annotated/HughesPJ.hs @@ -695,7 +695,7 @@ beside p@(Beside p1 g1 q1) g2 q2 | otherwise = beside (reduceDoc p) g2 q2 beside p@(Above{}) g q = let !d = reduceDoc p in beside d g q beside (NilAbove p) g q = nilAbove_ $! beside p g q -beside (TextBeside t p) g q = TextBeside t $! rest +beside (TextBeside t p) g q = TextBeside t rest where rest = case p of Empty -> nilBeside g q From git at git.haskell.org Thu Feb 2 19:15:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Feb 2017 19:15:23 +0000 (UTC) Subject: [commit: packages/pretty] master: #32, add a test that rendering the prefix of an infinite document produces some result (a5c916a) Message-ID: <20170202191523.2639F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/pretty On branch : master Link : http://git.haskell.org/packages/pretty.git/commitdiff/a5c916ae4fe90f2cfb65357aafc3b7673845f3d0 >--------------------------------------------------------------- commit a5c916ae4fe90f2cfb65357aafc3b7673845f3d0 Author: Neil Mitchell Date: Thu Jun 2 13:15:32 2016 +0100 #32, add a test that rendering the prefix of an infinite document produces some result >--------------------------------------------------------------- a5c916ae4fe90f2cfb65357aafc3b7673845f3d0 pretty.cabal | 1 + tests/Test.hs | 2 ++ tests/UnitT32.hs | 9 +++++++++ 3 files changed, 12 insertions(+) diff --git a/pretty.cabal b/pretty.cabal index 4bfef78..f3116eb 100644 --- a/pretty.cabal +++ b/pretty.cabal @@ -62,6 +62,7 @@ Test-Suite test-pretty UnitLargeDoc UnitPP1 UnitT3911 + UnitT32 extensions: CPP, BangPatterns, DeriveGeneric include-dirs: src/Text/PrettyPrint/Annotated ghc-options: -rtsopts -with-rtsopts=-K2M diff --git a/tests/Test.hs b/tests/Test.hs index bbcd0f7..4d23ac0 100644 --- a/tests/Test.hs +++ b/tests/Test.hs @@ -18,6 +18,7 @@ import TestStructures import UnitLargeDoc import UnitPP1 import UnitT3911 +import UnitT32 import Control.Monad import Data.Char (isSpace) @@ -39,6 +40,7 @@ main = do -- unit tests testPP1 testT3911 + testT32 testLargeDoc -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/UnitT32.hs b/tests/UnitT32.hs new file mode 100755 index 0000000..8c1eb85 --- /dev/null +++ b/tests/UnitT32.hs @@ -0,0 +1,9 @@ +-- Test from https://github.com/haskell/pretty/issues/32#issuecomment-223073337 +module UnitT32 where + +import Text.PrettyPrint.HughesPJ + +import TestUtils + +testT32 :: IO () +testT32 = simpleMatch "T3911" (replicate 10 'x') $ take 10 $ render $ hcat $ repeat $ text "x" From git at git.haskell.org Thu Feb 2 19:15:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Feb 2017 19:15:25 +0000 (UTC) Subject: [commit: packages/pretty] master: Merge pull request #35 from ndmitchell/master (ba5a4da) Message-ID: <20170202191525.2F37E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/pretty On branch : master Link : http://git.haskell.org/packages/pretty.git/commitdiff/ba5a4da66925ce08a08e7f6549e08952e636a915 >--------------------------------------------------------------- commit ba5a4da66925ce08a08e7f6549e08952e636a915 Merge: f904ff7 a5c916a Author: David Terei Date: Thu Jun 2 14:24:54 2016 -0700 Merge pull request #35 from ndmitchell/master Remove harmful $! forcing in beside >--------------------------------------------------------------- ba5a4da66925ce08a08e7f6549e08952e636a915 pretty.cabal | 1 + src/Text/PrettyPrint/Annotated/HughesPJ.hs | 2 +- tests/Test.hs | 2 ++ tests/UnitT32.hs | 9 +++++++++ 4 files changed, 13 insertions(+), 1 deletion(-) From git at git.haskell.org Thu Feb 2 19:15:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Feb 2017 19:15:27 +0000 (UTC) Subject: [commit: packages/pretty] : Bump to version 1.1.3.4 (562d8ff) Message-ID: <20170202191527.34AD23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/pretty On branch : Link : http://git.haskell.org/packages/pretty.git/commitdiff/562d8ff2c21e9305bedd72b6bfb5f7f0ea478ebc >--------------------------------------------------------------- commit 562d8ff2c21e9305bedd72b6bfb5f7f0ea478ebc Author: David Terei Date: Fri Jun 3 11:36:52 2016 -0700 Bump to version 1.1.3.4 >--------------------------------------------------------------- 562d8ff2c21e9305bedd72b6bfb5f7f0ea478ebc CHANGELOG.md | 5 +++++ pretty.cabal | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 41243c3..b2bd2a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Pretty library change log +## 1.1.3.4 -- 3rd June, 2016 + +* Fix over-zeleaous use of strictness causing stack allocation, fixes part of + issue #32 (by Neil Mitchell). + ## 1.1.3.3 -- 29th February, 2016 * Improve documentation. diff --git a/pretty.cabal b/pretty.cabal index f3116eb..39fe558 100644 --- a/pretty.cabal +++ b/pretty.cabal @@ -1,5 +1,5 @@ name: pretty -version: 1.1.3.3 +version: 1.1.3.4 synopsis: Pretty-printing library description: This package contains a pretty-printing library, a set of API's @@ -24,7 +24,7 @@ Cabal-Version: >= 1.8 source-repository this type: git location: http://github.com/haskell/pretty.git - tag: 1.1.3.3 + tag: 1.1.3.4 source-repository head type: git From git at git.haskell.org Thu Feb 2 19:15:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Feb 2017 19:15:29 +0000 (UTC) Subject: [commit: packages/pretty] master: Fix up an error in paper title (7a63331) Message-ID: <20170202191529.3AFD33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/pretty On branch : master Link : http://git.haskell.org/packages/pretty.git/commitdiff/7a63331017dc888a997159066400298a62d8e067 >--------------------------------------------------------------- commit 7a63331017dc888a997159066400298a62d8e067 Author: Ivan Lazar Miljenovic Date: Wed Jun 8 00:16:52 2016 +1000 Fix up an error in paper title My guess is that this was a formatting/wrapping error. >--------------------------------------------------------------- 7a63331017dc888a997159066400298a62d8e067 src/Text/PrettyPrint/HughesPJ.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Text/PrettyPrint/HughesPJ.hs b/src/Text/PrettyPrint/HughesPJ.hs index 0925774..98e1bd7 100644 --- a/src/Text/PrettyPrint/HughesPJ.hs +++ b/src/Text/PrettyPrint/HughesPJ.hs @@ -22,7 +22,7 @@ -- -- For more information you can refer to the -- that --- serves as the basis for this libraries design: /The Design -- of a +-- serves as the basis for this libraries design: /The Design of a -- Pretty-printing Library/ by John Hughes, in Advanced Functional Programming, -- 1995. -- From git at git.haskell.org Thu Feb 2 19:15:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Feb 2017 19:15:31 +0000 (UTC) Subject: [commit: packages/pretty] master: Merge pull request #38 from ivan-m/patch-1 (7653ca5) Message-ID: <20170202191531.42A493A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/pretty On branch : master Link : http://git.haskell.org/packages/pretty.git/commitdiff/7653ca5136af27ae632ad51ad65cd2aa36256dff >--------------------------------------------------------------- commit 7653ca5136af27ae632ad51ad65cd2aa36256dff Merge: ba5a4da 7a63331 Author: David Terei Date: Thu Jun 16 18:34:46 2016 -0700 Merge pull request #38 from ivan-m/patch-1 Fix up an error in paper title >--------------------------------------------------------------- 7653ca5136af27ae632ad51ad65cd2aa36256dff src/Text/PrettyPrint/HughesPJ.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) From git at git.haskell.org Thu Feb 2 19:58:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Feb 2017 19:58:13 +0000 (UTC) Subject: [commit: ghc] master: Bump haskeline submodule (895aa6d) Message-ID: <20170202195813.923003A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/895aa6d12ef7ea7d03b0c3ea5cfc10664cfd705a/ghc >--------------------------------------------------------------- commit 895aa6d12ef7ea7d03b0c3ea5cfc10664cfd705a Author: Ben Gamari Date: Thu Feb 2 14:20:57 2017 -0500 Bump haskeline submodule >--------------------------------------------------------------- 895aa6d12ef7ea7d03b0c3ea5cfc10664cfd705a libraries/haskeline | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/haskeline b/libraries/haskeline index 3653874..39168d2 160000 --- a/libraries/haskeline +++ b/libraries/haskeline @@ -1 +1 @@ -Subproject commit 3653874be6a6b0df3077b7dee583c9aa442e2ebd +Subproject commit 39168d2feaebb0c16b8415727283a031afc7c721 From git at git.haskell.org Thu Feb 2 19:58:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Feb 2017 19:58:10 +0000 (UTC) Subject: [commit: ghc] master: Exhaustiveness check for EmptyCase (Trac #10746) (b103532) Message-ID: <20170202195810.C96D63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b10353216f5ff5d5e410334e4c118b6695b628d0/ghc >--------------------------------------------------------------- commit b10353216f5ff5d5e410334e4c118b6695b628d0 Author: George Karachalias Date: Thu Feb 2 13:51:33 2017 -0500 Exhaustiveness check for EmptyCase (Trac #10746) Empty case expressions have strict semantics so the problem boils down to inhabitation checking for the type of the scrutinee. 3 main functions added: - pmTopNormaliseType_maybe for the normalisation of the scrutinee type - inhabitationCandidates for generating the possible patterns of the appropriate type - checkEmptyCase' to filter out the candidates that give rise to unsatisfiable constraints. See Note [Checking EmptyCase Expressions] in Check and Note [Type normalisation for EmptyCase] in FamInstEnv Test Plan: validate Reviewers: simonpj, goldfire, dfeuer, austin, bgamari Reviewed By: bgamari Subscribers: mpickering, thomie Differential Revision: https://phabricator.haskell.org/D2105 GHC Trac Issues: #10746 >--------------------------------------------------------------- b10353216f5ff5d5e410334e4c118b6695b628d0 compiler/deSugar/Check.hs | 194 +++++++++++++++++++-- compiler/types/FamInstEnv.hs | 114 +++++++++++- compiler/types/Type.hs | 8 +- .../tests/pmcheck/should_compile/EmptyCase001.hs | 18 ++ .../pmcheck/should_compile/EmptyCase001.stderr | 14 ++ .../tests/pmcheck/should_compile/EmptyCase002.hs | 54 ++++++ .../pmcheck/should_compile/EmptyCase002.stderr | 22 +++ .../tests/pmcheck/should_compile/EmptyCase003.hs | 95 ++++++++++ .../pmcheck/should_compile/EmptyCase003.stderr | 11 ++ .../tests/pmcheck/should_compile/EmptyCase004.hs | 49 ++++++ .../pmcheck/should_compile/EmptyCase004.stderr | 36 ++++ .../tests/pmcheck/should_compile/EmptyCase005.hs | 101 +++++++++++ .../pmcheck/should_compile/EmptyCase005.stderr | 32 ++++ .../tests/pmcheck/should_compile/EmptyCase006.hs | 28 +++ .../pmcheck/should_compile/EmptyCase006.stderr | 11 ++ .../tests/pmcheck/should_compile/EmptyCase007.hs | 46 +++++ .../pmcheck/should_compile/EmptyCase007.stderr | 26 +++ .../tests/pmcheck/should_compile/EmptyCase008.hs | 52 ++++++ .../pmcheck/should_compile/EmptyCase008.stderr | 18 ++ .../tests/pmcheck/should_compile/EmptyCase009.hs | 40 +++++ .../pmcheck/should_compile/EmptyCase009.stderr | 11 ++ .../tests/pmcheck/should_compile/EmptyCase010.hs | 71 ++++++++ .../pmcheck/should_compile/EmptyCase010.stderr | 41 +++++ testsuite/tests/pmcheck/should_compile/T10746.hs | 25 +++ .../tests/pmcheck/should_compile/T10746.stderr | 6 + testsuite/tests/pmcheck/should_compile/all.T | 24 +++ 26 files changed, 1128 insertions(+), 19 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 b10353216f5ff5d5e410334e4c118b6695b628d0 From git at git.haskell.org Thu Feb 2 20:32:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Feb 2017 20:32:21 +0000 (UTC) Subject: [commit: ghc] wip/T13227: Get rid of ProbOneShot (4c5af21) Message-ID: <20170202203221.988E73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T13227 Link : http://ghc.haskell.org/trac/ghc/changeset/4c5af213a9fff60ca8de2ed9f5ae28955d21beb6/ghc >--------------------------------------------------------------- commit 4c5af213a9fff60ca8de2ed9f5ae28955d21beb6 Author: Joachim Breitner Date: Thu Feb 2 12:52:57 2017 -0500 Get rid of ProbOneShot This fixes #13227. It remains to be seen what the performance impacts are. Pushing as a branch to get perf.haskell.org answer that for us. >--------------------------------------------------------------- 4c5af213a9fff60ca8de2ed9f5ae28955d21beb6 compiler/basicTypes/BasicTypes.hs | 7 ------- compiler/basicTypes/Demand.hs | 22 ++++------------------ compiler/basicTypes/Id.hs | 5 +---- testsuite/tests/simplCore/should_run/all.T | 2 +- 4 files changed, 6 insertions(+), 30 deletions(-) diff --git a/compiler/basicTypes/BasicTypes.hs b/compiler/basicTypes/BasicTypes.hs index ff4d2c7..49ecc72 100644 --- a/compiler/basicTypes/BasicTypes.hs +++ b/compiler/basicTypes/BasicTypes.hs @@ -211,8 +211,6 @@ type Alignment = Int -- align to next N-byte boundary (N must be a power of 2). -- work. data OneShotInfo = NoOneShotInfo -- ^ No information - | ProbOneShot -- ^ The lambda is probably applied at most once - -- See Note [Computing one-shot info, and ProbOneShot] in Demand | OneShotLam -- ^ The lambda is applied at most once. deriving (Eq) @@ -229,18 +227,13 @@ hasNoOneShotInfo _ = False worstOneShot, bestOneShot :: OneShotInfo -> OneShotInfo -> OneShotInfo worstOneShot NoOneShotInfo _ = NoOneShotInfo -worstOneShot ProbOneShot NoOneShotInfo = NoOneShotInfo -worstOneShot ProbOneShot _ = ProbOneShot worstOneShot OneShotLam os = os bestOneShot NoOneShotInfo os = os -bestOneShot ProbOneShot OneShotLam = OneShotLam -bestOneShot ProbOneShot _ = ProbOneShot bestOneShot OneShotLam _ = OneShotLam pprOneShotInfo :: OneShotInfo -> SDoc pprOneShotInfo NoOneShotInfo = empty -pprOneShotInfo ProbOneShot = text "ProbOneShot" pprOneShotInfo OneShotLam = text "OneShot" instance Outputable OneShotInfo where diff --git a/compiler/basicTypes/Demand.hs b/compiler/basicTypes/Demand.hs index 8cacf22..d7fa57c 100644 --- a/compiler/basicTypes/Demand.hs +++ b/compiler/basicTypes/Demand.hs @@ -1783,13 +1783,13 @@ it should not fall over. -} argsOneShots :: StrictSig -> Arity -> [[OneShotInfo]] --- See Note [Computing one-shot info, and ProbOneShot] +-- See Note [Computing one-shot info] argsOneShots (StrictSig (DmdType _ arg_ds _)) n_val_args = go arg_ds where unsaturated_call = arg_ds `lengthExceeds` n_val_args good_one_shot - | unsaturated_call = ProbOneShot + | unsaturated_call = NoOneShotInfo | otherwise = OneShotLam go [] = [] @@ -1813,7 +1813,7 @@ saturatedByOneShots n (JD { ud = usg }) go n (UCall One u) = go (n-1) u go _ _ = False -argOneShots :: OneShotInfo -- OneShotLam or ProbOneShot, +argOneShots :: OneShotInfo -- OneShotLam or NoOneShotInfo, -> Demand -- depending on saturation -> [OneShotInfo] argOneShots one_shot_info (JD { ud = usg }) @@ -1825,7 +1825,7 @@ argOneShots one_shot_info (JD { ud = usg }) go (UCall Many u) = NoOneShotInfo : go u go _ = [] -{- Note [Computing one-shot info, and ProbOneShot] +{- Note [Computing one-shot info] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Consider a call f (\pqr. e1) (\xyz. e2) e3 @@ -1835,20 +1835,6 @@ Then argsOneShots returns a [[OneShotInfo]] of [[OneShot,NoOneShotInfo,OneShot], [OneShot]] The occurrence analyser propagates this one-shot infor to the binders \pqr and \xyz; see Note [Use one-shot information] in OccurAnal. - -But suppose f was not saturated, so the call looks like - f (\pqr. e1) (\xyz. e2) -The in principle this partial application might be shared, and -the (\prq.e1) abstraction might be called more than once. So -we can't mark them OneShot. But instead we return - [[ProbOneShot,NoOneShotInfo,ProbOneShot], [ProbOneShot]] -The occurrence analyser propagates this to the \pqr and \xyz -binders. - -How is it used? Well, it's quite likely that the partial application -of f is not shared, so the float-out pass (in SetLevels.lvlLamBndrs) -does not float MFEs out of a ProbOneShot lambda. That currently is -the only way that ProbOneShot is used. -} -- appIsBottom returns true if an application to n args diff --git a/compiler/basicTypes/Id.hs b/compiler/basicTypes/Id.hs index acb22e8..2f07fc6 100644 --- a/compiler/basicTypes/Id.hs +++ b/compiler/basicTypes/Id.hs @@ -762,7 +762,7 @@ isOneShotBndr var -- | Should we apply the state hack to values of this 'Type'? stateHackOneShot :: OneShotInfo -stateHackOneShot = OneShotLam -- Or maybe ProbOneShot? +stateHackOneShot = OneShotLam typeOneShot :: Type -> OneShotInfo typeOneShot ty @@ -798,7 +798,6 @@ isStateHackType ty isProbablyOneShotLambda :: Id -> Bool isProbablyOneShotLambda id = case idStateHackOneShotInfo id of OneShotLam -> True - ProbOneShot -> True NoOneShotInfo -> False setOneShotLambda :: Id -> Id @@ -819,8 +818,6 @@ updOneShotInfo id one_shot do_upd = case (idOneShotInfo id, one_shot) of (NoOneShotInfo, _) -> True (OneShotLam, _) -> False - (_, NoOneShotInfo) -> False - _ -> True -- The OneShotLambda functions simply fiddle with the IdInfo flag -- But watch out: this may change the type of something else diff --git a/testsuite/tests/simplCore/should_run/all.T b/testsuite/tests/simplCore/should_run/all.T index 6fe17e1..702d83c 100644 --- a/testsuite/tests/simplCore/should_run/all.T +++ b/testsuite/tests/simplCore/should_run/all.T @@ -73,4 +73,4 @@ test('T12689broken', expect_broken(12689), compile_and_run, ['']) test('T12689a', normal, compile_and_run, ['']) test('T13172', only_ways(['optasm']), compile_and_run, ['-dcore-lint']) -test('T13227', expect_broken(13227), compile_and_run, ['']) +test('T13227', normal, compile_and_run, ['']) From git at git.haskell.org Thu Feb 2 22:35:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 2 Feb 2017 22:35:52 +0000 (UTC) Subject: [commit: ghc] master: Remove INLINE pragma on loopbreaker (5728f4b) Message-ID: <20170202223552.05B873A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5728f4b83a06b28fc3bf75f5d13675fe5e9888c6/ghc >--------------------------------------------------------------- commit 5728f4b83a06b28fc3bf75f5d13675fe5e9888c6 Author: Matthew Pickering Date: Thu Feb 2 21:00:39 2017 +0000 Remove INLINE pragma on loopbreaker >--------------------------------------------------------------- 5728f4b83a06b28fc3bf75f5d13675fe5e9888c6 compiler/deSugar/Check.hs | 1 - 1 file changed, 1 deletion(-) diff --git a/compiler/deSugar/Check.hs b/compiler/deSugar/Check.hs index 5fd1adf..2b14739 100644 --- a/compiler/deSugar/Check.hs +++ b/compiler/deSugar/Check.hs @@ -1202,7 +1202,6 @@ Main functions are: runMany :: (ValVec -> PmM PartialResult) -> (Uncovered -> PmM PartialResult) runMany _ [] = return mempty runMany pm (m:ms) = mappend <$> pm m <*> runMany pm ms -{-# INLINE runMany #-} -- | Generate the initial uncovered set. It initializes the -- delta with all term and type constraints in scope. From git at git.haskell.org Fri Feb 3 03:14:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Feb 2017 03:14:09 +0000 (UTC) Subject: [commit: ghc] master: users-guide: Explain behavior of verbose-core2core + dump-inlinings (6128b2f) Message-ID: <20170203031409.1B0343A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6128b2ffbe36ed2779583e05ee9d817eaafc1c9c/ghc >--------------------------------------------------------------- commit 6128b2ffbe36ed2779583e05ee9d817eaafc1c9c Author: Ben Gamari Date: Thu Feb 2 20:17:08 2017 -0500 users-guide: Explain behavior of verbose-core2core + dump-inlinings >--------------------------------------------------------------- 6128b2ffbe36ed2779583e05ee9d817eaafc1c9c docs/users_guide/debugging.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/users_guide/debugging.rst b/docs/users_guide/debugging.rst index 8191048..3dda67b 100644 --- a/docs/users_guide/debugging.rst +++ b/docs/users_guide/debugging.rst @@ -103,7 +103,9 @@ Dumping out compiler intermediate structures .. ghc-flag:: -ddump-inlinings - Dumps inlining info from the simplifier + Dumps inlining info from the simplifier. Note that if used in conjunction with + :ghc-flag:`-dverbose-core2core` the compiler will also dump the inlinings that + it considers but passes up, along with its rationale. .. ghc-flag:: -ddump-stranal From git at git.haskell.org Fri Feb 3 03:14:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Feb 2017 03:14:12 +0000 (UTC) Subject: [commit: ghc] master: Ditch static flags (bbd3c39) Message-ID: <20170203031412.0D9CD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/bbd3c399939311ec3e308721ab87ca6b9443f358/ghc >--------------------------------------------------------------- commit bbd3c399939311ec3e308721ab87ca6b9443f358 Author: Sylvain Henry Date: Thu Feb 2 14:37:24 2017 -0500 Ditch static flags This patch converts the 4 lasting static flags (read from the command line and unsafely stored in immutable global variables) into dynamic flags. Most use cases have been converted into reading them from a DynFlags. In cases for which we don't have easy access to a DynFlags, we read from 'unsafeGlobalDynFlags' that is set at the beginning of each 'runGhc'. It's not perfect (not thread-safe) but it is still better as we can set/unset these 4 flags before each run when using GHC API. Updates haddock submodule. Rebased and finished by: bgamari Test Plan: validate Reviewers: goldfire, erikd, hvr, austin, simonmar, bgamari Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2839 GHC Trac Issues: #8440 >--------------------------------------------------------------- bbd3c399939311ec3e308721ab87ca6b9443f358 compiler/backpack/DriverBkp.hs | 11 +- compiler/basicTypes/BasicTypes.hs | 6 +- compiler/basicTypes/Id.hs | 4 +- compiler/basicTypes/RdrName.hs | 6 +- compiler/basicTypes/VarEnv.hs | 8 +- compiler/cmm/CmmParse.y | 1 - compiler/coreSyn/CoreLint.hs | 20 +- compiler/deSugar/Coverage.hs | 4 +- compiler/ghc.cabal.in | 1 - compiler/ghc.mk | 1 - compiler/ghci/Linker.hs | 8 +- compiler/ghci/RtClosureInspect.hs | 25 ++- compiler/hsSyn/HsExpr.hs | 15 +- compiler/hsSyn/HsTypes.hs | 8 +- compiler/iface/BinIface.hs | 2 +- compiler/iface/IfaceSyn.hs | 3 +- compiler/iface/IfaceType.hs | 18 +- compiler/iface/LoadIface.hs | 12 +- compiler/llvmGen/LlvmCodeGen/Base.hs | 4 +- compiler/main/CmdLineParser.hs | 3 +- compiler/main/CodeOutput.hs | 2 +- compiler/main/DriverPipeline.hs | 6 +- compiler/main/DynFlags.hs | 35 +++- compiler/main/DynFlags.hs-boot | 2 + compiler/main/ErrUtils.hs | 21 +- compiler/main/GHC.hs | 6 +- compiler/main/StaticFlags.hs | 248 ------------------------ compiler/main/StaticFlags.hs-boot | 4 - compiler/main/SysTools.hs | 6 +- compiler/main/TidyPgm.hs | 5 +- compiler/simplCore/CoreMonad.hs | 12 +- compiler/simplCore/SimplCore.hs | 2 +- compiler/simplStg/SimplStg.hs | 3 +- compiler/specialise/Rules.hs | 24 +-- compiler/specialise/SpecConstr.hs | 15 +- compiler/typecheck/TcBackpack.hs | 3 +- compiler/typecheck/TcDeriv.hs | 7 +- compiler/typecheck/TcDerivUtils.hs | 8 +- compiler/typecheck/TcErrors.hs | 19 +- compiler/typecheck/TcGenDeriv.hs | 243 ++++++++++++----------- compiler/typecheck/TcRnDriver.hs | 37 ++-- compiler/typecheck/TcRnDriver.hs-boot | 3 +- compiler/typecheck/TcRnMonad.hs | 33 ++-- compiler/typecheck/TcSMonad.hs | 4 +- compiler/types/OptCoercion.hs | 4 +- compiler/utils/Outputable.hs | 71 ++++--- ghc/Main.hs | 22 +-- rts/RtsSymbols.c | 2 - testsuite/tests/ghc-api/T10052/T10052.hs | 5 +- testsuite/tests/plugins/LinkerTicklingPlugin.hs | 10 +- utils/haddock | 2 +- 51 files changed, 413 insertions(+), 611 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 bbd3c399939311ec3e308721ab87ca6b9443f358 From git at git.haskell.org Fri Feb 3 16:39:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Feb 2017 16:39:21 +0000 (UTC) Subject: [commit: ghc] master: Get rid of ProbOneShot (09b8332) Message-ID: <20170203163921.440513A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/09b8332df92428fe1be780c8a6bbcdd4c341a50d/ghc >--------------------------------------------------------------- commit 09b8332df92428fe1be780c8a6bbcdd4c341a50d Author: Joachim Breitner Date: Thu Feb 2 12:52:57 2017 -0500 Get rid of ProbOneShot This fixes #13227. It remains to be seen what the performance impacts are. Pushing as a branch to get perf.haskell.org answer that for us. Differential Revision: https://phabricator.haskell.org/D3067 >--------------------------------------------------------------- 09b8332df92428fe1be780c8a6bbcdd4c341a50d compiler/basicTypes/BasicTypes.hs | 7 ------- compiler/basicTypes/Demand.hs | 33 ++++++++---------------------- compiler/basicTypes/Id.hs | 5 +---- compiler/simplCore/OccurAnal.hs | 2 +- testsuite/tests/simplCore/should_run/all.T | 2 +- 5 files changed, 11 insertions(+), 38 deletions(-) diff --git a/compiler/basicTypes/BasicTypes.hs b/compiler/basicTypes/BasicTypes.hs index a23255b..5af9017 100644 --- a/compiler/basicTypes/BasicTypes.hs +++ b/compiler/basicTypes/BasicTypes.hs @@ -210,8 +210,6 @@ type Alignment = Int -- align to next N-byte boundary (N must be a power of 2). -- work. data OneShotInfo = NoOneShotInfo -- ^ No information - | ProbOneShot -- ^ The lambda is probably applied at most once - -- See Note [Computing one-shot info, and ProbOneShot] in Demand | OneShotLam -- ^ The lambda is applied at most once. deriving (Eq) @@ -228,18 +226,13 @@ hasNoOneShotInfo _ = False worstOneShot, bestOneShot :: OneShotInfo -> OneShotInfo -> OneShotInfo worstOneShot NoOneShotInfo _ = NoOneShotInfo -worstOneShot ProbOneShot NoOneShotInfo = NoOneShotInfo -worstOneShot ProbOneShot _ = ProbOneShot worstOneShot OneShotLam os = os bestOneShot NoOneShotInfo os = os -bestOneShot ProbOneShot OneShotLam = OneShotLam -bestOneShot ProbOneShot _ = ProbOneShot bestOneShot OneShotLam _ = OneShotLam pprOneShotInfo :: OneShotInfo -> SDoc pprOneShotInfo NoOneShotInfo = empty -pprOneShotInfo ProbOneShot = text "ProbOneShot" pprOneShotInfo OneShotLam = text "OneShot" instance Outputable OneShotInfo where diff --git a/compiler/basicTypes/Demand.hs b/compiler/basicTypes/Demand.hs index 8cacf22..1d90ac0 100644 --- a/compiler/basicTypes/Demand.hs +++ b/compiler/basicTypes/Demand.hs @@ -1783,17 +1783,15 @@ it should not fall over. -} argsOneShots :: StrictSig -> Arity -> [[OneShotInfo]] --- See Note [Computing one-shot info, and ProbOneShot] +-- See Note [Computing one-shot info] argsOneShots (StrictSig (DmdType _ arg_ds _)) n_val_args - = go arg_ds + | unsaturated_call = [] + | otherwise = go arg_ds where unsaturated_call = arg_ds `lengthExceeds` n_val_args - good_one_shot - | unsaturated_call = ProbOneShot - | otherwise = OneShotLam go [] = [] - go (arg_d : arg_ds) = argOneShots good_one_shot arg_d `cons` go arg_ds + go (arg_d : arg_ds) = argOneShots arg_d `cons` go arg_ds -- Avoid list tail like [ [], [], [] ] cons [] [] = [] @@ -1813,19 +1811,18 @@ saturatedByOneShots n (JD { ud = usg }) go n (UCall One u) = go (n-1) u go _ _ = False -argOneShots :: OneShotInfo -- OneShotLam or ProbOneShot, - -> Demand -- depending on saturation +argOneShots :: Demand -- depending on saturation -> [OneShotInfo] -argOneShots one_shot_info (JD { ud = usg }) +argOneShots (JD { ud = usg }) = case usg of Use _ arg_usg -> go arg_usg _ -> [] where - go (UCall One u) = one_shot_info : go u + go (UCall One u) = OneShotLam : go u go (UCall Many u) = NoOneShotInfo : go u go _ = [] -{- Note [Computing one-shot info, and ProbOneShot] +{- Note [Computing one-shot info] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Consider a call f (\pqr. e1) (\xyz. e2) e3 @@ -1835,20 +1832,6 @@ Then argsOneShots returns a [[OneShotInfo]] of [[OneShot,NoOneShotInfo,OneShot], [OneShot]] The occurrence analyser propagates this one-shot infor to the binders \pqr and \xyz; see Note [Use one-shot information] in OccurAnal. - -But suppose f was not saturated, so the call looks like - f (\pqr. e1) (\xyz. e2) -The in principle this partial application might be shared, and -the (\prq.e1) abstraction might be called more than once. So -we can't mark them OneShot. But instead we return - [[ProbOneShot,NoOneShotInfo,ProbOneShot], [ProbOneShot]] -The occurrence analyser propagates this to the \pqr and \xyz -binders. - -How is it used? Well, it's quite likely that the partial application -of f is not shared, so the float-out pass (in SetLevels.lvlLamBndrs) -does not float MFEs out of a ProbOneShot lambda. That currently is -the only way that ProbOneShot is used. -} -- appIsBottom returns true if an application to n args diff --git a/compiler/basicTypes/Id.hs b/compiler/basicTypes/Id.hs index 64b87ff..69c2cc3 100644 --- a/compiler/basicTypes/Id.hs +++ b/compiler/basicTypes/Id.hs @@ -762,7 +762,7 @@ isOneShotBndr var -- | Should we apply the state hack to values of this 'Type'? stateHackOneShot :: OneShotInfo -stateHackOneShot = OneShotLam -- Or maybe ProbOneShot? +stateHackOneShot = OneShotLam typeOneShot :: Type -> OneShotInfo typeOneShot ty @@ -798,7 +798,6 @@ isStateHackType ty isProbablyOneShotLambda :: Id -> Bool isProbablyOneShotLambda id = case idStateHackOneShotInfo id of OneShotLam -> True - ProbOneShot -> True NoOneShotInfo -> False setOneShotLambda :: Id -> Id @@ -819,8 +818,6 @@ updOneShotInfo id one_shot do_upd = case (idOneShotInfo id, one_shot) of (NoOneShotInfo, _) -> True (OneShotLam, _) -> False - (_, NoOneShotInfo) -> False - _ -> True -- The OneShotLambda functions simply fiddle with the IdInfo flag -- But watch out: this may change the type of something else diff --git a/compiler/simplCore/OccurAnal.hs b/compiler/simplCore/OccurAnal.hs index 864d468..b02ddc9 100644 --- a/compiler/simplCore/OccurAnal.hs +++ b/compiler/simplCore/OccurAnal.hs @@ -1548,7 +1548,7 @@ occAnalNonRecRhs env bndr bndrs body | otherwise = rhsCtxt env -- See Note [Use one-shot info] - rhs_env = env1 { occ_one_shots = argOneShots OneShotLam dmd } + rhs_env = env1 { occ_one_shots = argOneShots dmd } certainly_inline -- See Note [Cascading inlines] diff --git a/testsuite/tests/simplCore/should_run/all.T b/testsuite/tests/simplCore/should_run/all.T index 6fe17e1..702d83c 100644 --- a/testsuite/tests/simplCore/should_run/all.T +++ b/testsuite/tests/simplCore/should_run/all.T @@ -73,4 +73,4 @@ test('T12689broken', expect_broken(12689), compile_and_run, ['']) test('T12689a', normal, compile_and_run, ['']) test('T13172', only_ways(['optasm']), compile_and_run, ['-dcore-lint']) -test('T13227', expect_broken(13227), compile_and_run, ['']) +test('T13227', normal, compile_and_run, ['']) From git at git.haskell.org Fri Feb 3 16:39:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Feb 2017 16:39:24 +0000 (UTC) Subject: [commit: ghc] master: Bump performance mark for T9020 (c2becee) Message-ID: <20170203163924.097E53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c2becee48aa73795cbf04905f3891f543f1c746e/ghc >--------------------------------------------------------------- commit c2becee48aa73795cbf04905f3891f543f1c746e Author: Joachim Breitner Date: Fri Feb 3 11:38:16 2017 -0500 Bump performance mark for T9020 according to the graph at perf.haskell.org, it has regressed due to join points, which moved it very very close to the +10% mark and hence made it fail just sometimes. >--------------------------------------------------------------- c2becee48aa73795cbf04905f3891f543f1c746e 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 1ceda50..eb7a5f5 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -669,7 +669,7 @@ test('T9020', [(wordsize(32), 343005716, 10), # Original: 381360728 # 2014-07-31: 343005716 (Windows) (general round of updates) - (wordsize(64), 698401736, 10)]) + (wordsize(64), 764866144, 10)]) # prev: 795469104 # 2014-07-17: 728263536 (general round of updates) # 2014-09-10: 785871680 post-AMP-cleanup @@ -678,6 +678,7 @@ test('T9020', # 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 + # 2017-02-03: 764866144 Join points ], compile,['']) From git at git.haskell.org Fri Feb 3 17:47:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Feb 2017 17:47:22 +0000 (UTC) Subject: [commit: ghc] master: Use tyCoVarsOfType for CTyEqCan in shouldSplitWD (afa409f) Message-ID: <20170203174722.407FA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/afa409faffba6c340db9ee20f7fa2634ac4f8cd0/ghc >--------------------------------------------------------------- commit afa409faffba6c340db9ee20f7fa2634ac4f8cd0 Author: Simon Peyton Jones Date: Fri Feb 3 16:15:56 2017 +0000 Use tyCoVarsOfType for CTyEqCan in shouldSplitWD An ASSERT failure in rewritableTyVars made me realise that there was an outright bug in shouldSplitWD. See the long Note [Splitting WD constraints]. >--------------------------------------------------------------- afa409faffba6c340db9ee20f7fa2634ac4f8cd0 compiler/typecheck/TcSMonad.hs | 52 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 47 insertions(+), 5 deletions(-) diff --git a/compiler/typecheck/TcSMonad.hs b/compiler/typecheck/TcSMonad.hs index 7e19ea9..caa20e0 100644 --- a/compiler/typecheck/TcSMonad.hs +++ b/compiler/typecheck/TcSMonad.hs @@ -1043,7 +1043,8 @@ can rewrite it. Then: [WD] fmv ~ Maybe e -- (C) [WD] Foo ee ~ fmv -Now the work item is rewritten by (C) and we soon get ee := e. +See Note [Splitting WD constraints]. Now the work item is rewritten +by (C) and we soon get ee := e. Additional notes: @@ -1066,6 +1067,41 @@ Additional notes: * inert_funeqs, inert_dicts is a finite map keyed by the type; it's inconvenient for it to map to TWO constraints +Note [Splitting WD constraints] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +We are about to add a [WD] constraint to the inert set; and we +know that the inert set has fully rewritten it. Should we split +it into [W] and [D], and put the [D] in the work list for further +work? + +* CDictCan (C tys) or CFunEqCan (F tys ~ fsk): + Yes if the inert set couuld rerite tys to make the class constraint, + or type family, fire. That is, yes if the inert_eqs interects + with the free vars of tys. For this test we use rewriteableTyVars + which ignores casts and coercions in tys, because rewriting the + casts or coercions won't make the thing fire more often. + +* CTyEqCan (a ~ ty): Yes if the inert set could rewrite 'a' or 'ty'. + We need to check both 'a' and 'ty' against the inert set: + - Inert set contains [D] a ~ ty2 + Then we want to put [D] a ~ ty in the worklist, so we'll + get [D] ty ~ ty2 with consequent good things + + - Inert set constains [D] b ~ a, where b is in ty. + We can't just add [WD] a ~ ty[b] to the inert set, because + that breaks the inert-set invariants. If we tried to + canonicalise another [D] constraint mentioning 'a', we'd + get an infinite loop + + Moreover we must use the full-blown (tyVarsOfType ty) for the + RHS, for two reasons: + 1. even tyvars in the casts and coercions could give + an infinite loop + 2. rewritableTyVarsOfType doesn't handle foralls (just + because it doesn't need to) + +* Others: nothing is gained by splitting. + Note [Examples of how Derived shadows helps completeness] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Trac #10009, a very nasty example: @@ -1211,14 +1247,20 @@ shouldSplitWD :: InertEqs -> Ct -> Bool -- Precondition: 'ct' is [WD], and is inert -- True <=> we should split ct ito [W] and [D] because -- the inert_eqs can make progress on the [D] - +-- See Note [Splitting WD constraints] shouldSplitWD inert_eqs (CFunEqCan { cc_tyargs = tys }) = inert_eqs `intersects_with` rewritableTyVarsOfTypes tys -- We don't need to split if the tv is the RHS fsk -shouldSplitWD inert_eqs ct - = inert_eqs `intersects_with` rewritableTyVarsOfType (ctPred ct) - -- Otherwise split if the tv is mentioned at all +shouldSplitWD inert_eqs (CDictCan { cc_tyargs = tys }) + = inert_eqs `intersects_with` rewritableTyVarsOfTypes tys + +shouldSplitWD inert_eqs (CTyEqCan { cc_tyvar = tv, cc_rhs = ty }) + = tv `elemDVarEnv` inert_eqs + || inert_eqs `intersects_with` tyCoVarsOfType ty + -- See Note [Splitting WD constraints] + +shouldSplitWD _ _ = False -- No point in splitting otherwise intersects_with :: InertEqs -> TcTyVarSet -> Bool intersects_with inert_eqs free_vars From git at git.haskell.org Fri Feb 3 21:38:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Feb 2017 21:38:44 +0000 (UTC) Subject: [commit: ghc] branch 'wip/rwbarton-revert-splitter' created Message-ID: <20170203213844.7B92A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/rwbarton-revert-splitter Referencing: 1efa85cebdc311bf0cf68240a7dc23dd4646ee9b From git at git.haskell.org Fri Feb 3 21:38:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Feb 2017 21:38:47 +0000 (UTC) Subject: [commit: ghc] wip/rwbarton-revert-splitter: Revert "Don't use the splitter on Darwin" (1efa85c) Message-ID: <20170203213847.47B643A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rwbarton-revert-splitter Link : http://ghc.haskell.org/trac/ghc/changeset/1efa85cebdc311bf0cf68240a7dc23dd4646ee9b/ghc >--------------------------------------------------------------- commit 1efa85cebdc311bf0cf68240a7dc23dd4646ee9b Author: Reid Barton Date: Fri Feb 3 16:38:25 2017 -0500 Revert "Don't use the splitter on Darwin" This reverts commit 266a9dc4cd34008f1162eb276032c85ef8371842. >--------------------------------------------------------------- 1efa85cebdc311bf0cf68240a7dc23dd4646ee9b driver/split/ghc-split.pl | 177 +++++++++++++++++++++++++++++++++++++++++++--- mk/config.mk.in | 33 ++++----- 2 files changed, 184 insertions(+), 26 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 1efa85cebdc311bf0cf68240a7dc23dd4646ee9b From git at git.haskell.org Fri Feb 3 22:04:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Feb 2017 22:04:13 +0000 (UTC) Subject: [commit: ghc] branch 'wip/rwbarton-supports-split-sections' created Message-ID: <20170203220413.072453A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/rwbarton-supports-split-sections Referencing: 45a9b9923ce6f093fb27c9e7bf82b95607db9869 From git at git.haskell.org Fri Feb 3 22:04:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Feb 2017 22:04:15 +0000 (UTC) Subject: [commit: ghc] wip/rwbarton-supports-split-sections: Make split sections by default work again (45a9b99) Message-ID: <20170203220415.BB9893A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rwbarton-supports-split-sections Link : http://ghc.haskell.org/trac/ghc/changeset/45a9b9923ce6f093fb27c9e7bf82b95607db9869/ghc >--------------------------------------------------------------- commit 45a9b9923ce6f093fb27c9e7bf82b95607db9869 Author: Reid Barton Date: Fri Feb 3 17:00:02 2017 -0500 Make split sections by default work again Commit 266a9dc4c changed = to := in one place in mk/config.mk.in. This broke SupportsSplitSections because the variable LdIsGNULd that it depends on is not defined until later in the file. >--------------------------------------------------------------- 45a9b9923ce6f093fb27c9e7bf82b95607db9869 mk/config.mk.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mk/config.mk.in b/mk/config.mk.in index f4508af..35ff04c 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -359,7 +359,7 @@ SplitObjs = $(if $(and $(filter YES,$(SupportsSplitObjs)),\ # This is not supported on Darwin (where you can use subsections-via-symbols # instead) and Windows is not yet working. (See #11445 and related tickets.) OsSupportsSplitSections=$(if $(filter $(TargetOS_CPP),mingw32 darwin),NO,YES) -SupportsSplitSections :=$(if $(and $(filter YES,$(OsSupportsSplitSections)),\ +SupportsSplitSections=$(if $(and $(filter YES,$(OsSupportsSplitSections)),\ $(filter YES,$(LdIsGNULd))),YES,NO) SplitSections ?= $(SupportsSplitSections) From git at git.haskell.org Fri Feb 3 22:26:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 3 Feb 2017 22:26:17 +0000 (UTC) Subject: [commit: ghc] master: Attempt to make lazy ST thread safe (2f5cb3d) Message-ID: <20170203222617.154E03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2f5cb3d44d05e581b75a47fec222577dfa7a533e/ghc >--------------------------------------------------------------- commit 2f5cb3d44d05e581b75a47fec222577dfa7a533e Author: David Feuer Date: Fri Feb 3 17:24:17 2017 -0500 Attempt to make lazy ST thread safe Use `noDuplicate#` to prevent lazy `ST` thunks from being evaluated in multiple GHC threads. Some lazy `ST` functions added laziness that did not seem to be useful (e.g., creating lazy pairs that will never be matched unless one of their components is demanded). Stripped that out. Reviewers: ekmett, simonpj, bgamari, simonmar, austin, hvr Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3038 GHC Trac Issues: #11760 >--------------------------------------------------------------- 2f5cb3d44d05e581b75a47fec222577dfa7a533e libraries/base/Control/Monad/ST/Lazy/Imp.hs | 142 +++++++++++++++++---- libraries/base/tests/T11760.hs | 51 ++++++++ .../tests/{IO/IOError002.stdout => T11760.stdout} | 0 libraries/base/tests/all.T | 2 + libraries/base/tests/fixUsingLazyST.stdout | 2 + libraries/base/tests/lazySTexamples.hs | 110 ++++++++++++++++ libraries/base/tests/lazySTexamples.stderr | 16 +++ libraries/base/tests/lazySTexamples.stdout | 6 + 8 files changed, 305 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 2f5cb3d44d05e581b75a47fec222577dfa7a533e From git at git.haskell.org Sat Feb 4 10:33:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 10:33:13 +0000 (UTC) Subject: [commit: ghc] master: Fix comment (old file names) in includes/ (9984024) Message-ID: <20170204103313.8A89D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9984024a58a277fad23efd09df0ab51cdd39a87a/ghc >--------------------------------------------------------------- commit 9984024a58a277fad23efd09df0ab51cdd39a87a Author: Takenobu Tani Date: Sat Feb 4 10:24:42 2017 +0000 Fix comment (old file names) in includes/ [skip ci] There ware some old file names (.lhs, ...) at comments. * includes/rts/Bytecodes.h - ghc/compiler/ghci/ByteCodeGen.lhs -> ByteCodeAsm.hs * includes/rts/Constants.h - libraries/base/GHC/Conc.lhs -> libraries/base/GHC/Conc/Sync.hs * includes/rts/storage/FunTypes.h - utils/genapply/GenApply.hs -> utils/genappl/Main.hs - compiler/codeGen/CgCallConv.lhs -> compiler/codeGen/StgCmmLayout.hs * includes/stg/MiscClosures.h - compiler/codeGen/CgStackery.lhs -> compiler/codeGen/StgCmmArgRep.hs - HeapStackCheck.hc -> HeapStackCheck.cmm Reviewers: bgamari, austin, simonmar, erikd Reviewed By: erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3074 >--------------------------------------------------------------- 9984024a58a277fad23efd09df0ab51cdd39a87a includes/rts/Bytecodes.h | 2 +- includes/rts/Constants.h | 2 +- includes/rts/storage/FunTypes.h | 4 ++-- includes/stg/MiscClosures.h | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/includes/rts/Bytecodes.h b/includes/rts/Bytecodes.h index 5e1fc28..6ca74bf 100644 --- a/includes/rts/Bytecodes.h +++ b/includes/rts/Bytecodes.h @@ -17,7 +17,7 @@ /* NOTE: - THIS FILE IS INCLUDED IN HASKELL SOURCES (ghc/compiler/ghci/ByteCodeGen.lhs). + THIS FILE IS INCLUDED IN HASKELL SOURCES (ghc/compiler/ghci/ByteCodeAsm.hs). DO NOT PUT C-SPECIFIC STUFF IN HERE! I hope that's clear :-) diff --git a/includes/rts/Constants.h b/includes/rts/Constants.h index 114f30c..bd602e7 100644 --- a/includes/rts/Constants.h +++ b/includes/rts/Constants.h @@ -198,7 +198,7 @@ /* * Constants for the why_blocked field of a TSO - * NB. keep these in sync with GHC/Conc.lhs: threadStatus + * NB. keep these in sync with GHC/Conc/Sync.hs: threadStatus */ #define NotBlocked 0 #define BlockedOnMVar 1 diff --git a/includes/rts/storage/FunTypes.h b/includes/rts/storage/FunTypes.h index 094bd87..8c56588 100644 --- a/includes/rts/storage/FunTypes.h +++ b/includes/rts/storage/FunTypes.h @@ -24,8 +24,8 @@ * generated code in ghc/rts/AutoApply.cmm. * * NOTE: other places to change if you change this table: - * - utils/genapply/GenApply.hs: stackApplyTypes - * - compiler/codeGen/CgCallConv.lhs: stdPattern + * - utils/genapply/Main.hs: stackApplyTypes + * - compiler/codeGen/StgCmmLayout.hs: stdPattern */ #define ARG_NONE 3 #define ARG_N 4 diff --git a/includes/stg/MiscClosures.h b/includes/stg/MiscClosures.h index 994b369..8894535 100644 --- a/includes/stg/MiscClosures.h +++ b/includes/stg/MiscClosures.h @@ -232,7 +232,7 @@ RTS_THUNK(stg_ap_6_upd); RTS_THUNK(stg_ap_7_upd); /* standard application routines (see also utils/genapply, - * and compiler/codeGen/CgStackery.lhs). + * and compiler/codeGen/StgCmmArgRep.hs). */ RTS_RET(stg_ap_v); RTS_RET(stg_ap_f); @@ -272,7 +272,7 @@ RTS_FUN_DECL(stg_ap_ppppp_fast); RTS_FUN_DECL(stg_ap_pppppp_fast); RTS_FUN_DECL(stg_PAP_apply); -/* standard GC & stack check entry points, all defined in HeapStackCheck.hc */ +/* standard GC & stack check entry points, all defined in HeapStackCheck.cmm */ RTS_FUN_DECL(stg_gc_noregs); From git at git.haskell.org Sat Feb 4 10:33:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 10:33:16 +0000 (UTC) Subject: [commit: ghc] master: Fix comment (old file names) in rts/ (31bb85f) Message-ID: <20170204103316.47BDA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/31bb85ffc4b68b5e2625ae374822ab8e8548eecc/ghc >--------------------------------------------------------------- commit 31bb85ffc4b68b5e2625ae374822ab8e8548eecc Author: Takenobu Tani Date: Sat Feb 4 10:24:49 2017 +0000 Fix comment (old file names) in rts/ [skip ci] There ware some old file names (.lhs, ...) at comments. * rts/win32/ThrIOManager.c - Conc.lhs -> Conc.hs * rts/PrimOps.cmm - ByteCodeLink.lhs -> ByteCodeLink.hs - StgMiscClosures.hc -> StgMiscClosures.cmm * rts/AutoApply.h - AutoApply.hc -> AutoApply.cmm * rts/HeapStackCheck.cmm - PrimOps.hc -> PrimOps.cmm * rts/LdvProfile.h - Updates.hc -> Updates.cmm * rts/Schedule.c - StgStartup.hc -> StgStartup.cmm * rts/Weak.c - StgMiscClosures.hc -> StgMiscClosures.cmm Reviewers: bgamari, austin, erikd, simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3075 >--------------------------------------------------------------- 31bb85ffc4b68b5e2625ae374822ab8e8548eecc rts/AutoApply.h | 2 +- rts/HeapStackCheck.cmm | 2 +- rts/LdvProfile.h | 2 +- rts/PrimOps.cmm | 4 ++-- rts/Schedule.c | 2 +- rts/Weak.c | 2 +- rts/win32/ThrIOManager.c | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/rts/AutoApply.h b/rts/AutoApply.h index 4e441ca..b73e666 100644 --- a/rts/AutoApply.h +++ b/rts/AutoApply.h @@ -2,7 +2,7 @@ * * (c) The University of Glasgow 2002-2004 * - * Helper bits for the generic apply code (AutoApply.hc) + * Helper bits for the generic apply code (AutoApply.cmm) * * -------------------------------------------------------------------------- */ diff --git a/rts/HeapStackCheck.cmm b/rts/HeapStackCheck.cmm index 69bff74..9bfe37e 100644 --- a/rts/HeapStackCheck.cmm +++ b/rts/HeapStackCheck.cmm @@ -526,7 +526,7 @@ stg_block_noregs * ptr to MVar (R1) * stg_block_putmvar_info * - * See PrimOps.hc for a description of the workings of take/putMVar. + * See PrimOps.cmm for a description of the workings of take/putMVar. * * -------------------------------------------------------------------------- */ diff --git a/rts/LdvProfile.h b/rts/LdvProfile.h index e515715..7475dc1 100644 --- a/rts/LdvProfile.h +++ b/rts/LdvProfile.h @@ -21,7 +21,7 @@ RTS_PRIVATE void LdvCensusKillAll ( void ); // address 'from'. // // Invoked when: -// 1) Hp is incremented and exceeds HpLim (in Updates.hc). +// 1) Hp is incremented and exceeds HpLim (in Updates.cmm). // 2) copypart() is called (in GC.c). #define LDV_FILL_SLOP(from, howMany) \ if (era > 0) { \ diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm index d6cdb3d..4baf63a 100644 --- a/rts/PrimOps.cmm +++ b/rts/PrimOps.cmm @@ -723,7 +723,7 @@ stg_finalizzeWeakzh ( gcptr w ) // LDV_recordDead((StgClosure *)w, sizeofW(StgWeak) - sizeofW(StgProfHeader)); // Furthermore, when PROFILING is turned on, dead weak pointers are exactly as // large as weak pointers, so there is no need to fill the slop, either. - // See stg_DEAD_WEAK_info in StgMiscClosures.hc. + // See stg_DEAD_WEAK_info in StgMiscClosures.cmm. #endif // @@ -1968,7 +1968,7 @@ stg_mkApUpd0zh ( P_ bco ) W_ ap; // This function is *only* used to wrap zero-arity BCOs in an - // updatable wrapper (see ByteCodeLink.lhs). An AP thunk is always + // updatable wrapper (see ByteCodeLink.hs). An AP thunk is always // saturated and always points directly to a FUN or BCO. ASSERT(%INFO_TYPE(%GET_STD_INFO(bco)) == HALF_W_(BCO) && StgBCO_arity(bco) == HALF_W_(0)); diff --git a/rts/Schedule.c b/rts/Schedule.c index 02d8137..a4d0c1d 100644 --- a/rts/Schedule.c +++ b/rts/Schedule.c @@ -1323,7 +1323,7 @@ scheduleHandleThreadFinished (Capability *cap STG_UNUSED, Task *task, StgTSO *t) if (t->what_next == ThreadComplete) { if (task->incall->ret) { - // NOTE: return val is stack->sp[1] (see StgStartup.hc) + // NOTE: return val is stack->sp[1] (see StgStartup.cmm) *(task->incall->ret) = (StgClosure *)task->incall->tso->stackobj->sp[1]; } task->incall->rstat = Success; diff --git a/rts/Weak.c b/rts/Weak.c index 1974bb9..46a853d 100644 --- a/rts/Weak.c +++ b/rts/Weak.c @@ -110,7 +110,7 @@ scheduleFinalizers(Capability *cap, StgWeak *list) // Furthermore, when PROFILING is turned on, dead weak // pointers are exactly as large as weak pointers, so there is // no need to fill the slop, either. See stg_DEAD_WEAK_info - // in StgMiscClosures.hc. + // in StgMiscClosures.cmm. #endif SET_HDR(w, &stg_DEAD_WEAK_info, w->header.prof.ccs); } diff --git a/rts/win32/ThrIOManager.c b/rts/win32/ThrIOManager.c index 56042dd..13c5e22 100644 --- a/rts/win32/ThrIOManager.c +++ b/rts/win32/ThrIOManager.c @@ -3,7 +3,7 @@ * (c) The GHC Team, 1998-2006 * * The IO manager thread in THREADED_RTS. - * See also libraries/base/GHC/Conc.lhs. + * See also libraries/base/GHC/Conc.hs. * * ---------------------------------------------------------------------------*/ From git at git.haskell.org Sat Feb 4 10:33:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 10:33:19 +0000 (UTC) Subject: [commit: ghc] master: Fix comment (old file names) in compiler/ (8d60d73) Message-ID: <20170204103319.119F13A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8d60d739489b2f5108b1786a3c2075e2a6062a6b/ghc >--------------------------------------------------------------- commit 8d60d739489b2f5108b1786a3c2075e2a6062a6b Author: Takenobu Tani Date: Sat Feb 4 10:24:55 2017 +0000 Fix comment (old file names) in compiler/ [skip ci] There ware some old file names (.lhs, ...) at comments. * compiler/ghc.mk - prelude/PrimOp.lhs -> prelude/PrimOp.hs * compiler/parser/cutils.h - PrimPacked.lhs -> compiler/utils/FastString.hs Reviewers: bgamari, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3076 >--------------------------------------------------------------- 8d60d739489b2f5108b1786a3c2075e2a6062a6b compiler/ghc.mk | 2 +- compiler/parser/cutils.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/ghc.mk b/compiler/ghc.mk index df16483..ce41eca 100644 --- a/compiler/ghc.mk +++ b/compiler/ghc.mk @@ -233,7 +233,7 @@ compiler/stage3/$(PLATFORM_H) : compiler/stage2/$(PLATFORM_H) "$(CP)" $< $@ # ---------------------------------------------------------------------------- -# Generate supporting stuff for prelude/PrimOp.lhs +# Generate supporting stuff for prelude/PrimOp.hs # from prelude/primops.txt PRIMOP_BITS_NAMES = primop-data-decl.hs-incl \ diff --git a/compiler/parser/cutils.h b/compiler/parser/cutils.h index 95a10c5..0c8ab12 100644 --- a/compiler/parser/cutils.h +++ b/compiler/parser/cutils.h @@ -6,7 +6,7 @@ #include "HsFFI.h" -// Out-of-line string functions, see PrimPacked.lhs +// Out-of-line string functions, see compiler/utils/FastString.hs HsInt ghc_strlen( HsAddr a ); HsInt ghc_memcmp( HsAddr a1, HsAddr a2, HsInt len ); From git at git.haskell.org Sat Feb 4 10:33:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 10:33:21 +0000 (UTC) Subject: [commit: ghc] master: Fix comment (old filename '.lhs') in libraries/ (4d31880) Message-ID: <20170204103321.CC7AC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4d31880a0bfb3bf653c86f844fc8cf332c955547/ghc >--------------------------------------------------------------- commit 4d31880a0bfb3bf653c86f844fc8cf332c955547 Author: Takenobu Tani Date: Sat Feb 4 10:25:21 2017 +0000 Fix comment (old filename '.lhs') in libraries/ [skip ci] There are some old file names (*.lhs) at comments. (I'm fixing to read source code by newcomers.) * libraries/base/GHC/Base.hs - compiler/deSugar/DsListComp.lhs - PrelRules.lhs x2 - Base.lhs * libraries/base/GHC/IO.hs - PrimOp.lhs - GHC.IO.lhs - GHC.Exception.lhs * libraries/base/GHC/Real.hs - compiler/prelude/PrelRules.lhs * libraries/ghc-prim/GHC/Magic.hs - MkId.lhs x2 Reviewers: austin, hvr, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3060 >--------------------------------------------------------------- 4d31880a0bfb3bf653c86f844fc8cf332c955547 libraries/base/GHC/Base.hs | 8 ++++---- libraries/base/GHC/IO.hs | 6 +++--- libraries/base/GHC/Real.hs | 2 +- libraries/ghc-prim/GHC/Magic.hs | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libraries/base/GHC/Base.hs b/libraries/base/GHC/Base.hs index 25c78b2..2863ea7 100644 --- a/libraries/base/GHC/Base.hs +++ b/libraries/base/GHC/Base.hs @@ -261,7 +261,7 @@ mechanism to define mconcat and the Applicative and Monad instances for lists. We mark them INLINE because the inliner is not generally too keen to inline build forms such as the ones these desugar to without our insistence. Defining these using list comprehensions instead of foldr has an additional potential -benefit, as described in compiler/deSugar/DsListComp.lhs: if optimizations +benefit, as described in compiler/deSugar/DsListComp.hs: if optimizations needed to make foldr/build forms efficient are turned off, we'll get reasonably efficient translations anyway. -} @@ -991,7 +991,7 @@ eqString (c1:cs1) (c2:cs2) = c1 == c2 && cs1 `eqString` cs2 eqString _ _ = False {-# RULES "eqString" (==) = eqString #-} --- eqString also has a BuiltInRule in PrelRules.lhs: +-- eqString also has a BuiltInRule in PrelRules.hs: -- eqString (unpackCString# (Lit s1)) (unpackCString# (Lit s2)) = s1==s2 @@ -1038,7 +1038,7 @@ id x = x -- SLPJ: in 5.04 etc 'assert' is in GHC.Prim, -- but from Template Haskell onwards it's simply --- defined here in Base.lhs +-- defined here in Base.hs assert :: Bool -> a -> a assert _pred r = r @@ -1249,7 +1249,7 @@ a `iShiftRL#` b | isTrue# (b >=# WORD_SIZE_IN_BITS#) = 0# "unpack-list" [1] forall a . unpackFoldrCString# a (:) [] = unpackCString# a "unpack-append" forall a n . unpackFoldrCString# a (:) n = unpackAppendCString# a n --- There's a built-in rule (in PrelRules.lhs) for +-- There's a built-in rule (in PrelRules.hs) for -- unpackFoldr "foo" c (unpackFoldr "baz" c n) = unpackFoldr "foobaz" c n #-} diff --git a/libraries/base/GHC/IO.hs b/libraries/base/GHC/IO.hs index 52a333a..0744e3a 100644 --- a/libraries/base/GHC/IO.hs +++ b/libraries/base/GHC/IO.hs @@ -59,15 +59,15 @@ implement IO exceptions. NOTE: The IO representation is deeply wired in to various parts of the system. The following list may or may not be exhaustive: -Compiler - types of various primitives in PrimOp.lhs +Compiler - types of various primitives in PrimOp.hs RTS - forceIO (StgMiscClosures.hc) - catchzh_fast, (un)?blockAsyncExceptionszh_fast, raisezh_fast (Exceptions.hc) - raiseAsync (Schedule.c) -Prelude - GHC.IO.lhs, and several other places including - GHC.Exception.lhs. +Prelude - GHC.IO.hs, and several other places including + GHC.Exception.hs. Libraries - parts of hslibs/lang. diff --git a/libraries/base/GHC/Real.hs b/libraries/base/GHC/Real.hs index 39a7a9d..17d56c6 100644 --- a/libraries/base/GHC/Real.hs +++ b/libraries/base/GHC/Real.hs @@ -329,7 +329,7 @@ instance Real Integer where -- -- Constant folding of quot, rem, div, mod, divMod and quotRem for -- Integer arguments depends crucially on inlining. Constant folding --- rules defined in compiler/prelude/PrelRules.lhs trigger for +-- rules defined in compiler/prelude/PrelRules.hs trigger for -- quotInteger, remInteger and so on. So if calls to quot, rem and so on -- were not inlined the rules would not fire. The rules would also not -- fire if calls to quotInteger and so on were inlined, but this does not diff --git a/libraries/ghc-prim/GHC/Magic.hs b/libraries/ghc-prim/GHC/Magic.hs index ecdffc5..3dbda1d 100644 --- a/libraries/ghc-prim/GHC/Magic.hs +++ b/libraries/ghc-prim/GHC/Magic.hs @@ -76,7 +76,7 @@ noinline x = x lazy :: a -> a lazy x = x -- Implementation note: its strictness and unfolding are over-ridden --- by the definition in MkId.lhs; in both cases to nothing at all. +-- by the definition in MkId.hs; in both cases to nothing at all. -- That way, 'lazy' does not get inlined, and the strictness analyser -- sees it as lazy. Then the worker/wrapper phase inlines it. -- Result: happiness @@ -97,7 +97,7 @@ oneShot :: forall (q :: RuntimeRep) (r :: RuntimeRep) (a :: TYPE q) (b :: TYPE r). (a -> b) -> a -> b oneShot f = f --- Implementation note: This is wired in in MkId.lhs, so the code here is +-- Implementation note: This is wired in in MkId.hs, so the code here is -- mostly there to have a place for the documentation. -- | Apply a function to a 'State# RealWorld' token. When manually applying From git at git.haskell.org Sat Feb 4 10:33:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 10:33:24 +0000 (UTC) Subject: [commit: ghc] master: Make split sections by default work again (283acec) Message-ID: <20170204103324.7E3223A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/283acec1d7307fdbd8cd7b3f1d984a036366d6b4/ghc >--------------------------------------------------------------- commit 283acec1d7307fdbd8cd7b3f1d984a036366d6b4 Author: Reid Barton Date: Sat Feb 4 10:29:17 2017 +0000 Make split sections by default work again Commit 266a9dc4c changed = to := in one place in mk/config.mk.in. This broke SupportsSplitSections because the variable LdIsGNULd that it depends on is not defined until later in the file. Test Plan: pushed to a wip/ branch for perf to build Reviewers: DemiMarie, austin, bgamari, mpickering Reviewed By: mpickering Subscribers: mpickering, thomie Differential Revision: https://phabricator.haskell.org/D3070 GHC Trac Issues: #13230 >--------------------------------------------------------------- 283acec1d7307fdbd8cd7b3f1d984a036366d6b4 mk/config.mk.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mk/config.mk.in b/mk/config.mk.in index f4508af..35ff04c 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -359,7 +359,7 @@ SplitObjs = $(if $(and $(filter YES,$(SupportsSplitObjs)),\ # This is not supported on Darwin (where you can use subsections-via-symbols # instead) and Windows is not yet working. (See #11445 and related tickets.) OsSupportsSplitSections=$(if $(filter $(TargetOS_CPP),mingw32 darwin),NO,YES) -SupportsSplitSections :=$(if $(and $(filter YES,$(OsSupportsSplitSections)),\ +SupportsSplitSections=$(if $(and $(filter YES,$(OsSupportsSplitSections)),\ $(filter YES,$(LdIsGNULd))),YES,NO) SplitSections ?= $(SupportsSplitSections) From git at git.haskell.org Sat Feb 4 14:14:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 14:14:18 +0000 (UTC) Subject: [commit: ghc] branch 'wip/T11179' created Message-ID: <20170204141418.F06593A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/T11179 Referencing: b59c2de7abe3cd4e046f11c3536ba8e7137c4f84 From git at git.haskell.org Sat Feb 4 14:14:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 14:14:24 +0000 (UTC) Subject: [commit: ghc] wip/T11179: Expose cseExpr from CSE (122c655) Message-ID: <20170204141424.816033A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T11179 Link : http://ghc.haskell.org/trac/ghc/changeset/122c655927185131186814064f30a041cc361630/ghc >--------------------------------------------------------------- commit 122c655927185131186814064f30a041cc361630 Author: Joachim Breitner Date: Thu Feb 2 20:28:29 2017 -0500 Expose cseExpr from CSE for the benefit of GHC API users who want to CSE single expressions. >--------------------------------------------------------------- 122c655927185131186814064f30a041cc361630 compiler/simplCore/CSE.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/simplCore/CSE.hs b/compiler/simplCore/CSE.hs index 971b3e0..21dbd07 100644 --- a/compiler/simplCore/CSE.hs +++ b/compiler/simplCore/CSE.hs @@ -6,7 +6,7 @@ {-# LANGUAGE CPP #-} -module CSE (cseProgram) where +module CSE (cseProgram, cseOneExpr) where #include "HsVersions.h" @@ -373,6 +373,9 @@ tryForCSE toplevel env expr -- top of the replaced sub-expression. This is probably not too -- useful in practice, but upholds our semantics. +cseOneExpr :: CoreExpr -> CoreExpr +cseOneExpr = cseExpr emptyCSEnv + cseExpr :: CSEnv -> InExpr -> OutExpr cseExpr env (Type t) = Type (substTy (csEnvSubst env) t) cseExpr env (Coercion c) = Coercion (substCo (csEnvSubst env) c) From git at git.haskell.org Sat Feb 4 14:14:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 14:14:21 +0000 (UTC) Subject: [commit: ghc] wip/T11179: New internal dynamic flag: Very aggressive inlining (6d5efdb) Message-ID: <20170204141421.C02B13A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T11179 Link : http://ghc.haskell.org/trac/ghc/changeset/6d5efdb9ab648bd327b70de445e3a49f7f7e00c8/ghc >--------------------------------------------------------------- commit 6d5efdb9ab648bd327b70de445e3a49f7f7e00c8 Author: Joachim Breitner Date: Thu Feb 2 20:28:07 2017 -0500 New internal dynamic flag: Very aggressive inlining This flag overrides the inliner heuristics to inline something independent of cost, size, expected gains or boringness of the context. It still adheres to arity, simplifier phase control and loop breakers. This is not exposed via a command line flag and added for the benefit of GHC API users. >--------------------------------------------------------------- 6d5efdb9ab648bd327b70de445e3a49f7f7e00c8 compiler/coreSyn/CoreUnfold.hs | 9 ++++++++- compiler/main/DynFlags.hs | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/compiler/coreSyn/CoreUnfold.hs b/compiler/coreSyn/CoreUnfold.hs index 11c4a5e..eaed698 100644 --- a/compiler/coreSyn/CoreUnfold.hs +++ b/compiler/coreSyn/CoreUnfold.hs @@ -913,6 +913,11 @@ ufFunAppDiscount ufDearOp The size of a foreign call or not-dupable PrimOp +ufVeryAggressive + If True, the compiler ignores all the thresholds and inlines very + aggressively. It still adheres to arity, simplifier phase control and + loop breakers. + Note [Function applications] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1155,7 +1160,7 @@ tryUnfolding dflags id lone_variable UnfNever -> traceInline dflags str (text "UnfNever") Nothing UnfWhen { ug_arity = uf_arity, ug_unsat_ok = unsat_ok, ug_boring_ok = boring_ok } - | enough_args && (boring_ok || some_benefit) + | enough_args && (boring_ok || some_benefit || ufVeryAggressive dflags) -- See Note [INLINE for small functions (3)] -> traceInline dflags str (mk_doc some_benefit empty True) (Just unf_template) | otherwise @@ -1165,6 +1170,8 @@ tryUnfolding dflags id lone_variable enough_args = (n_val_args >= uf_arity) || (unsat_ok && n_val_args > 0) UnfIfGoodArgs { ug_args = arg_discounts, ug_res = res_discount, ug_size = size } + | ufVeryAggressive dflags + -> traceInline dflags str (mk_doc some_benefit extra_doc True) (Just unf_template) | is_wf && some_benefit && small_enough -> traceInline dflags str (mk_doc some_benefit extra_doc True) (Just unf_template) | otherwise diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index d7a5f1f..ef8ac96 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -868,6 +868,7 @@ data DynFlags = DynFlags { ufDictDiscount :: Int, ufKeenessFactor :: Float, ufDearOp :: Int, + ufVeryAggressive :: Bool, maxWorkerArgs :: Int, @@ -1638,6 +1639,7 @@ defaultDynFlags mySettings = ufDictDiscount = 30, ufKeenessFactor = 1.5, ufDearOp = 40, + ufVeryAggressive = False, maxWorkerArgs = 10, From git at git.haskell.org Sat Feb 4 14:14:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 14:14:27 +0000 (UTC) Subject: [commit: ghc] wip/T11179: Do not drop dead code in the desugarer (b59c2de) Message-ID: <20170204141427.6FDEF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T11179 Link : http://ghc.haskell.org/trac/ghc/changeset/b59c2de7abe3cd4e046f11c3536ba8e7137c4f84/ghc >--------------------------------------------------------------- commit b59c2de7abe3cd4e046f11c3536ba8e7137c4f84 Author: Joachim Breitner Date: Fri Feb 3 16:27:51 2017 -0500 Do not drop dead code in the desugarer so that GHC plugins have a chance of doing something with them first. See #11179 and #10823. >--------------------------------------------------------------- b59c2de7abe3cd4e046f11c3536ba8e7137c4f84 compiler/coreSyn/CoreSubst.hs | 2 +- compiler/deSugar/Desugar.hs | 3 +-- compiler/simplCore/OccurAnal.hs | 20 ++++++++++++++++++-- compiler/simplCore/SimplCore.hs | 2 +- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/compiler/coreSyn/CoreSubst.hs b/compiler/coreSyn/CoreSubst.hs index 9d69493..7efb58d 100644 --- a/compiler/coreSyn/CoreSubst.hs +++ b/compiler/coreSyn/CoreSubst.hs @@ -906,7 +906,7 @@ simpleOptPgm dflags this_mod binds rules vects ; return (reverse binds', substRulesForImportedIds subst' rules, substVects subst' vects) } where - occ_anald_binds = occurAnalysePgm this_mod (\_ -> False) {- No rules active -} + occ_anald_binds = occurAnalysePgm this_mod False (\_ -> False) {- No rules active -} rules vects emptyVarEnv binds (subst', binds') = foldl do_one (emptySubst, []) occ_anald_binds diff --git a/compiler/deSugar/Desugar.hs b/compiler/deSugar/Desugar.hs index 1cd7979..4936ece 100644 --- a/compiler/deSugar/Desugar.hs +++ b/compiler/deSugar/Desugar.hs @@ -355,8 +355,7 @@ deSugar hsc_env #endif ; (ds_binds, ds_rules_for_imps, ds_vects) <- simpleOptPgm dflags mod final_pgm rules_for_imps vects0 - -- The simpleOptPgm gets rid of type - -- bindings plus any stupid dead code + -- The simpleOptPgm gets rid of type bindings ; endPassIO hsc_env print_unqual CoreDesugarOpt ds_binds ds_rules_for_imps diff --git a/compiler/simplCore/OccurAnal.hs b/compiler/simplCore/OccurAnal.hs index b02ddc9..52fa9d1 100644 --- a/compiler/simplCore/OccurAnal.hs +++ b/compiler/simplCore/OccurAnal.hs @@ -56,10 +56,11 @@ Here's the externally-callable interface: -} occurAnalysePgm :: Module -- Used only in debug output + -> Bool -> (Activation -> Bool) -> [CoreRule] -> [CoreVect] -> VarSet -> CoreProgram -> CoreProgram -occurAnalysePgm this_mod active_rule imp_rules vects vectVars binds +occurAnalysePgm this_mod remove_dead active_rule imp_rules vects vectVars binds | isEmptyDetails final_usage = occ_anald_binds @@ -81,11 +82,16 @@ occurAnalysePgm this_mod active_rule imp_rules vects vectVars binds initial_uds = addManyOccsSet emptyDetails (rulesFreeVars imp_rules `unionVarSet` vectsFreeVars vects `unionVarSet` - vectVars) + vectVars `unionVarSet` + keepAliveVars) -- The RULES and VECTORISE declarations keep things alive! (For VECTORISE declarations, -- we only get them *until* the vectoriser runs. Afterwards, these dependencies are -- reflected in 'vectors' — see Note [Vectorisation declarations and occurrences].) + -- Note [Do not delete dead code in the desugarer] + keepAliveVars | remove_dead = emptyVarSet + | otherwise = mkVarSet $ concatMap bindersOf binds + -- Note [Preventing loops due to imported functions rules] imp_rule_edges = foldr (plusVarEnv_C unionVarSet) emptyVarEnv [ mapVarEnv (const maps_to) (exprFreeIds arg `delVarSetList` ru_bndrs imp_rule) @@ -2709,3 +2715,13 @@ andTailCallInfo :: TailCallInfo -> TailCallInfo -> TailCallInfo andTailCallInfo info@(AlwaysTailCalled arity1) (AlwaysTailCalled arity2) | arity1 == arity2 = info andTailCallInfo _ _ = NoTailCallInfo + +-- Note [Do not delete dead code in the desugarer] +-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +-- GHC plugins rightly want to access code that is maybe not exported and thus +-- “dead” from GHC's point of view. So we must not eliminate dead code before +-- the first time a user plugin had a chance to run. +-- +-- The desugarer runs the occurrence analyser; in that run we will add +-- all binders to the “body” of the module, thus preventing them from being +-- deleted or marked as dead. diff --git a/compiler/simplCore/SimplCore.hs b/compiler/simplCore/SimplCore.hs index 23faac8..b7253a9 100644 --- a/compiler/simplCore/SimplCore.hs +++ b/compiler/simplCore/SimplCore.hs @@ -703,7 +703,7 @@ simplifyPgmIO pass@(CoreDoSimplify max_iterations mode) InitialPhase -> (mg_vect_decls guts, vectVars) _ -> ([], vectVars) ; tagged_binds = {-# SCC "OccAnal" #-} - occurAnalysePgm this_mod active_rule rules + occurAnalysePgm this_mod True active_rule rules maybeVects maybeVectVars binds } ; Err.dumpIfSet_dyn dflags Opt_D_dump_occur_anal "Occurrence analysis" From git at git.haskell.org Sat Feb 4 21:17:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 21:17:13 +0000 (UTC) Subject: [commit: packages/binary] master: Require GHC>=7.4.1. (4da6183) Message-ID: <20170204211713.A42BC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/4da61831229bf952225e50b8f8277ece89fd6ba0 >--------------------------------------------------------------- commit 4da61831229bf952225e50b8f8277ece89fd6ba0 Author: Lennart Kolmodin Date: Sat Apr 30 23:34:43 2016 +0200 Require GHC>=7.4.1. >--------------------------------------------------------------- 4da61831229bf952225e50b8f8277ece89fd6ba0 binary.cabal | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/binary.cabal b/binary.cabal index e69b3cd..d99024f 100644 --- a/binary.cabal +++ b/binary.cabal @@ -31,7 +31,7 @@ source-repository head location: git://github.com/kolmodin/binary.git library - build-depends: base >= 3.0 && < 5, bytestring >= 0.10.2, containers, array + build-depends: base >= 4.5.0.0 && < 5, bytestring >= 0.10.2, containers, array hs-source-dirs: src exposed-modules: Data.Binary, Data.Binary.Put, @@ -67,7 +67,7 @@ test-suite qc Action Arbitrary build-depends: - base >= 3.0 && < 5, + base >= 4.5.0.0 && < 5, bytestring >= 0.10.2, random>=1.0.1.0, test-framework, @@ -83,7 +83,7 @@ test-suite read-write-file hs-source-dirs: src tests main-is: File.hs build-depends: - base >= 3.0 && < 5, + base >= 4.5.0.0 && < 5, bytestring >= 0.10.2, Cabal, directory, @@ -100,7 +100,7 @@ benchmark bench main-is: Benchmark.hs other-modules: MemBench build-depends: - base >= 3.0 && < 5, + base >= 4.5.0.0 && < 5, bytestring -- build dependencies from using binary source rather than depending on the library build-depends: array, containers @@ -114,7 +114,7 @@ benchmark get main-is: Get.hs build-depends: attoparsec, - base >= 3.0 && < 5, + base >= 4.5.0.0 && < 5, bytestring, cereal, criterion == 1.*, @@ -129,7 +129,7 @@ benchmark put hs-source-dirs: src benchmarks main-is: Put.hs build-depends: - base >= 3.0 && < 5, + base >= 4.5.0.0 && < 5, bytestring, criterion == 1.*, deepseq @@ -148,7 +148,7 @@ benchmark generics-bench hs-source-dirs: src benchmarks main-is: GenericsBench.hs build-depends: - base >= 3.0 && < 5, + base >= 4.5.0.0 && < 5, bytestring, Cabal == 1.22.*, directory, @@ -175,7 +175,7 @@ benchmark builder hs-source-dirs: src benchmarks main-is: Builder.hs build-depends: - base >= 3.0 && < 5, + base >= 4.5.0.0 && < 5, bytestring, criterion == 1.*, deepseq, From git at git.haskell.org Sat Feb 4 21:17:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 21:17:15 +0000 (UTC) Subject: [commit: packages/binary] master: Remove old CPP (84c0f68) Message-ID: <20170204211715.ADA2A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/84c0f68716db6ea0c36037db4553898838701a9e >--------------------------------------------------------------- commit 84c0f68716db6ea0c36037db4553898838701a9e Author: Lennart Kolmodin Date: Sun May 1 11:05:19 2016 +0200 Remove old CPP This CPP is no longer needed now that we only support GHC >= 7.4. >--------------------------------------------------------------- 84c0f68716db6ea0c36037db4553898838701a9e benchmarks/Put.hs | 10 ---------- binary.cabal | 33 +++++++++++++-------------------- src/Data/Binary.hs | 6 ------ src/Data/Binary/Builder.hs | 2 -- src/Data/Binary/Class.hs | 27 +-------------------------- src/Data/Binary/Generic.hs | 2 -- src/Data/Binary/Get.hs | 8 -------- src/Data/Binary/Get/Internal.hs | 8 -------- src/Data/Binary/Put.hs | 2 -- tests/QC.hs | 10 ---------- 10 files changed, 14 insertions(+), 94 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 84c0f68716db6ea0c36037db4553898838701a9e From git at git.haskell.org Sat Feb 4 21:17:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 21:17:17 +0000 (UTC) Subject: [commit: packages/binary] master: Reenable GHC 7.4.2 on Travis CI (d92acf2) Message-ID: <20170204211717.B3F4F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/d92acf273202dcbbdac12ac28a8a53c2e6e0a36f >--------------------------------------------------------------- commit d92acf273202dcbbdac12ac28a8a53c2e6e0a36f Author: Lennart Kolmodin Date: Sun May 1 11:07:47 2016 +0200 Reenable GHC 7.4.2 on Travis CI The dependency problem should have been fixed now. See haskell/tar#15. >--------------------------------------------------------------- d92acf273202dcbbdac12ac28a8a53c2e6e0a36f .travis.yml | 2 ++ binary.cabal | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d3483af..2866756 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,8 @@ 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 diff --git a/binary.cabal b/binary.cabal index 00916b8..e7ca8a4 100644 --- a/binary.cabal +++ b/binary.cabal @@ -18,7 +18,7 @@ category: Data, Parsing stability: provisional build-type: Simple cabal-version: >= 1.8 -tested-with: GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.3 +tested-with: GHC == 7.4.2, 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 From git at git.haskell.org Sat Feb 4 21:17:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 21:17:19 +0000 (UTC) Subject: [commit: packages/binary] master: Add ghc-prim dependency to all targets. (55d5a94) Message-ID: <20170204211719.B9EE13A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/55d5a94cde9f8d21db469288941e97a5df8d94bd >--------------------------------------------------------------- commit 55d5a94cde9f8d21db469288941e97a5df8d94bd Author: Lennart Kolmodin Date: Sun May 1 11:19:58 2016 +0200 Add ghc-prim dependency to all targets. Now that Generics is used in all targets, we also need ghc-prim. >--------------------------------------------------------------- 55d5a94cde9f8d21db469288941e97a5df8d94bd binary.cabal | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/binary.cabal b/binary.cabal index e7ca8a4..a282ea0 100644 --- a/binary.cabal +++ b/binary.cabal @@ -74,6 +74,10 @@ test-suite qc -- build dependencies from using binary source rather than depending on the library build-depends: array, containers ghc-options: -Wall -O2 -threaded + if impl(ghc <= 7.6) + -- prior to ghc-7.4 generics lived in ghc-prim + build-depends: ghc-prim + test-suite read-write-file type: exitcode-stdio-1.0 @@ -90,6 +94,10 @@ test-suite read-write-file -- build dependencies from using binary source rather than depending on the library build-depends: array, containers ghc-options: -Wall + if impl(ghc <= 7.6) + -- prior to ghc-7.4 generics lived in ghc-prim + build-depends: ghc-prim + benchmark bench type: exitcode-stdio-1.0 @@ -104,6 +112,10 @@ benchmark bench c-sources: benchmarks/CBenchmark.c include-dirs: benchmarks ghc-options: -O2 + if impl(ghc <= 7.6) + -- prior to ghc-7.4 generics lived in ghc-prim + build-depends: ghc-prim + benchmark get type: exitcode-stdio-1.0 @@ -120,6 +132,10 @@ benchmark get -- build dependencies from using binary source rather than depending on the library build-depends: array, containers ghc-options: -O2 -Wall + if impl(ghc <= 7.6) + -- prior to ghc-7.4 generics lived in ghc-prim + build-depends: ghc-prim + benchmark put type: exitcode-stdio-1.0 @@ -176,3 +192,6 @@ benchmark builder -- build dependencies from using binary source rather than depending on the library build-depends: array, containers ghc-options: -O2 + if impl(ghc <= 7.6) + -- prior to ghc-7.4 generics lived in ghc-prim + build-depends: ghc-prim From git at git.haskell.org Sat Feb 4 21:17:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 21:17:21 +0000 (UTC) Subject: [commit: packages/binary] master: Add Binary instances for datatypes in Data.Monoid/Data.Semigroup (2e1c4b2) Message-ID: <20170204211721.C072C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/2e1c4b2a9ca1722429ef5eb23015f30055d7aef9 >--------------------------------------------------------------- commit 2e1c4b2a9ca1722429ef5eb23015f30055d7aef9 Author: Ryan Scott Date: Wed May 11 10:13:21 2016 -0400 Add Binary instances for datatypes in Data.Monoid/Data.Semigroup This adds simple `Binary` instances for: 1. The newtype wrappers in `Data.Monoid` 2. The datatypes brought into `base` (from `semigroups`) in `base-4.9`: * The datatypes in `Data.Semigroup` * `Data.List.NonEmpty.NonEmpty` Fixes #107. >--------------------------------------------------------------- 2e1c4b2a9ca1722429ef5eb23015f30055d7aef9 src/Data/Binary/Class.hs | 102 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/src/Data/Binary/Class.hs b/src/Data/Binary/Class.hs index 19d00ae..4526f09 100644 --- a/src/Data/Binary/Class.hs +++ b/src/Data/Binary/Class.hs @@ -2,6 +2,10 @@ {-# LANGUAGE DefaultSignatures #-} {-# LANGUAGE Safe #-} +#if __GLASGOW_HASKELL__ >= 706 +{-# LANGUAGE PolyKinds #-} +#endif + #if MIN_VERSION_base(4,8,0) #define HAS_NATURAL #define HAS_VOID @@ -55,7 +59,12 @@ import Data.Binary.Get import Control.Applicative import Data.Monoid (mempty) #endif +import qualified Data.Monoid as Monoid import Data.Monoid ((<>)) +#if MIN_VERSION_base(4,9,0) +import qualified Data.List.NonEmpty as NE +import qualified Data.Semigroup as Semigroup +#endif import Control.Monad import Data.ByteString.Lazy (ByteString) @@ -699,3 +708,96 @@ instance Binary Fingerprint where instance Binary Version where put (Version br tags) = put br <> put tags get = Version <$> get <*> get + +------------------------------------------------------------------------ +-- Data.Monoid datatypes + +-- | /Since: 0.8.4.0/ +instance Binary a => Binary (Monoid.Dual a) where + get = fmap Monoid.Dual get + put = put . Monoid.getDual + +-- | /Since: 0.8.4.0/ +instance Binary Monoid.All where + get = fmap Monoid.All get + put = put . Monoid.getAll + +-- | /Since: 0.8.4.0/ +instance Binary Monoid.Any where + get = fmap Monoid.Any get + put = put . Monoid.getAny + +-- | /Since: 0.8.4.0/ +instance Binary a => Binary (Monoid.Sum a) where + get = fmap Monoid.Sum get + put = put . Monoid.getSum + +-- | /Since: 0.8.4.0/ +instance Binary a => Binary (Monoid.Product a) where + get = fmap Monoid.Product get + put = put . Monoid.getProduct + +-- | /Since: 0.8.4.0/ +instance Binary a => Binary (Monoid.First a) where + get = fmap Monoid.First get + put = put . Monoid.getFirst + +-- | /Since: 0.8.4.0/ +instance Binary a => Binary (Monoid.Last a) where + get = fmap Monoid.Last get + put = put . Monoid.getLast + +#if MIN_VERSION_base(4,8,0) +-- | /Since: 0.8.4.0/ +instance Binary (f a) => Binary (Monoid.Alt f a) where + get = fmap Monoid.Alt get + put = put . Monoid.getAlt +#endif + +#if MIN_VERSION_base(4,9,0) +------------------------------------------------------------------------ +-- Data.Semigroup datatypes + +-- | /Since: 0.8.4.0/ +instance Binary a => Binary (Semigroup.Min a) where + get = fmap Semigroup.Min get + put = put . Semigroup.getMin + +-- | /Since: 0.8.4.0/ +instance Binary a => Binary (Semigroup.Max a) where + get = fmap Semigroup.Max get + put = put . Semigroup.getMax + +-- | /Since: 0.8.4.0/ +instance Binary a => Binary (Semigroup.First a) where + get = fmap Semigroup.First get + put = put . Semigroup.getFirst + +-- | /Since: 0.8.4.0/ +instance Binary a => Binary (Semigroup.Last a) where + get = fmap Semigroup.Last get + put = put . Semigroup.getLast + +-- | /Since: 0.8.4.0/ +instance Binary a => Binary (Semigroup.Option a) where + get = fmap Semigroup.Option get + put = put . Semigroup.getOption + +-- | /Since: 0.8.4.0/ +instance Binary m => Binary (Semigroup.WrappedMonoid m) where + get = fmap Semigroup.WrapMonoid get + put = put . Semigroup.unwrapMonoid + +-- | /Since: 0.8.4.0/ +instance (Binary a, Binary b) => Binary (Semigroup.Arg a b) where + get = liftM2 Semigroup.Arg get get + put (Semigroup.Arg a b) = put a <> put b + +------------------------------------------------------------------------ +-- Non-empty lists + +-- | /Since: 0.8.4.0/ +instance Binary a => Binary (NE.NonEmpty a) where + get = fmap NE.fromList get + put = put . NE.toList +#endif From git at git.haskell.org Sat Feb 4 21:17:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 21:17:25 +0000 (UTC) Subject: [commit: packages/binary] master: Get: Avoid needless copies of input (7532daa) Message-ID: <20170204211725.CED503A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/7532daa8789e5199109bb1fcde367d71effb07e2 >--------------------------------------------------------------- commit 7532daa8789e5199109bb1fcde367d71effb07e2 Author: Ben Gamari Date: Sun May 15 23:55:43 2016 +0200 Get: Avoid needless copies of input My `b-tree` library seems to tickle a rather pathological behavior in `binary`'s decoding logic, where `binary` will create many needless copies of the input buffer by evaluating things of the form `B.concat [B.empty, leftovers]`, where `leftovers` is large. This resulted in runtimes of over two minutes when parsing a 50 MByte file. With this fix run drops to less than 100 milliseconds. >--------------------------------------------------------------- 7532daa8789e5199109bb1fcde367d71effb07e2 src/Data/Binary/Get/Internal.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Data/Binary/Get/Internal.hs b/src/Data/Binary/Get/Internal.hs index cf2d012..b9a0818 100644 --- a/src/Data/Binary/Get/Internal.hs +++ b/src/Data/Binary/Get/Internal.hs @@ -404,7 +404,11 @@ ensureN !n0 = C $ \inp ks -> do enoughChunks n str | B.length str >= n = Right (str,B.empty) | otherwise = Left (n - B.length str) - onSucc = B.concat + -- Sometimes we will produce leftovers lists of the form [B.empty, nonempty] + -- where `nonempty` is a non-empty ByteString. In this case we can avoid a copy + -- by simply dropping the empty prefix. In principle ByteString might want + -- to gain this optimization as well + onSucc = B.concat . dropWhile B.null onFail bss = C $ \_ _ -> Fail (B.concat bss) "not enough bytes" {-# INLINE ensureN #-} From git at git.haskell.org Sat Feb 4 21:17:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 21:17:23 +0000 (UTC) Subject: [commit: packages/binary] master: Ensure that Binary instances for tuples are inlined (23e0073) Message-ID: <20170204211723.C79093A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/23e00731a001e6c4d674127a1333c9013ca6458f >--------------------------------------------------------------- commit 23e00731a001e6c4d674127a1333c9013ca6458f Author: Ben Gamari Date: Sun May 15 23:54:02 2016 +0200 Ensure that Binary instances for tuples are inlined Otherwise we end up relying on dynamic dispatch here which has a rather drastic effect on runtime. >--------------------------------------------------------------- 23e00731a001e6c4d674127a1333c9013ca6458f src/Data/Binary/Class.hs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/Data/Binary/Class.hs b/src/Data/Binary/Class.hs index 19d00ae..4956f18 100644 --- a/src/Data/Binary/Class.hs +++ b/src/Data/Binary/Class.hs @@ -484,19 +484,27 @@ instance Binary Char where -- Instances for the first few tuples instance (Binary a, Binary b) => Binary (a,b) where + {-# INLINE put #-} put (a,b) = put a <> put b + {-# INLINE get #-} get = liftM2 (,) get get instance (Binary a, Binary b, Binary c) => Binary (a,b,c) where + {-# INLINE put #-} put (a,b,c) = put a <> put b <> put c + {-# INLINE get #-} get = liftM3 (,,) get get get instance (Binary a, Binary b, Binary c, Binary d) => Binary (a,b,c,d) where + {-# INLINE put #-} put (a,b,c,d) = put a <> put b <> put c <> put d + {-# INLINE get #-} get = liftM4 (,,,) get get get get instance (Binary a, Binary b, Binary c, Binary d, Binary e) => Binary (a,b,c,d,e) where + {-# INLINE put #-} put (a,b,c,d,e) = put a <> put b <> put c <> put d <> put e + {-# INLINE get #-} get = liftM5 (,,,,) get get get get get -- @@ -505,30 +513,40 @@ instance (Binary a, Binary b, Binary c, Binary d, Binary e) => Binary (a,b,c,d,e instance (Binary a, Binary b, Binary c, Binary d, Binary e, Binary f) => Binary (a,b,c,d,e,f) where + {-# INLINE put #-} put (a,b,c,d,e,f) = put (a,(b,c,d,e,f)) + {-# INLINE get #-} get = do (a,(b,c,d,e,f)) <- get ; return (a,b,c,d,e,f) instance (Binary a, Binary b, Binary c, Binary d, Binary e, Binary f, Binary g) => Binary (a,b,c,d,e,f,g) where + {-# INLINE put #-} put (a,b,c,d,e,f,g) = put (a,(b,c,d,e,f,g)) + {-# INLINE get #-} get = do (a,(b,c,d,e,f,g)) <- get ; return (a,b,c,d,e,f,g) instance (Binary a, Binary b, Binary c, Binary d, Binary e, Binary f, Binary g, Binary h) => Binary (a,b,c,d,e,f,g,h) where + {-# INLINE put #-} put (a,b,c,d,e,f,g,h) = put (a,(b,c,d,e,f,g,h)) + {-# INLINE get #-} get = do (a,(b,c,d,e,f,g,h)) <- get ; return (a,b,c,d,e,f,g,h) instance (Binary a, Binary b, Binary c, Binary d, Binary e, Binary f, Binary g, Binary h, Binary i) => Binary (a,b,c,d,e,f,g,h,i) where + {-# INLINE put #-} put (a,b,c,d,e,f,g,h,i) = put (a,(b,c,d,e,f,g,h,i)) + {-# INLINE get #-} get = do (a,(b,c,d,e,f,g,h,i)) <- get ; return (a,b,c,d,e,f,g,h,i) instance (Binary a, Binary b, Binary c, Binary d, Binary e, Binary f, Binary g, Binary h, Binary i, Binary j) => Binary (a,b,c,d,e,f,g,h,i,j) where + {-# INLINE put #-} put (a,b,c,d,e,f,g,h,i,j) = put (a,(b,c,d,e,f,g,h,i,j)) + {-# INLINE get #-} get = do (a,(b,c,d,e,f,g,h,i,j)) <- get ; return (a,b,c,d,e,f,g,h,i,j) ------------------------------------------------------------------------ From git at git.haskell.org Sat Feb 4 21:17:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 21:17:27 +0000 (UTC) Subject: [commit: packages/binary] master: Implementation of get/put functions for floats/doubles. (f3ec4e3) Message-ID: <20170204211727.D73713A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/f3ec4e3e1fa12d736b9643c733b96e6ca68245df >--------------------------------------------------------------- commit f3ec4e3e1fa12d736b9643c733b96e6ca68245df Author: Daniel Díaz Date: Sat May 21 14:58:50 2016 -0400 Implementation of get/put functions for floats/doubles. >--------------------------------------------------------------- f3ec4e3e1fa12d736b9643c733b96e6ca68245df binary.cabal | 8 +++++--- src/Data/Binary/Get.hs | 44 ++++++++++++++++++++++++++++++++++++++++++++ src/Data/Binary/Put.hs | 43 ++++++++++++++++++++++++++++++++++++++++++- tests/QC.hs | 27 +++++++++++++++++++++++++++ 4 files changed, 118 insertions(+), 4 deletions(-) diff --git a/binary.cabal b/binary.cabal index a282ea0..555b2d6 100644 --- a/binary.cabal +++ b/binary.cabal @@ -31,7 +31,7 @@ source-repository head location: git://github.com/kolmodin/binary.git library - build-depends: base >= 4.5.0.0 && < 5, bytestring >= 0.10.2, containers, array + build-depends: base >= 4.5.0.0 && < 5, bytestring >= 0.10.2, containers, array, reinterpret-cast hs-source-dirs: src exposed-modules: Data.Binary, Data.Binary.Put, @@ -69,7 +69,8 @@ test-suite qc random>=1.0.1.0, test-framework, test-framework-quickcheck2 >= 0.3, - QuickCheck>=2.8 + QuickCheck>=2.8, + reinterpret-cast -- build dependencies from using binary source rather than depending on the library build-depends: array, containers @@ -89,7 +90,8 @@ test-suite read-write-file Cabal, directory, filepath, - HUnit + HUnit, + reinterpret-cast -- build dependencies from using binary source rather than depending on the library build-depends: array, containers diff --git a/src/Data/Binary/Get.hs b/src/Data/Binary/Get.hs index 40e3e70..3488f66 100644 --- a/src/Data/Binary/Get.hs +++ b/src/Data/Binary/Get.hs @@ -205,6 +205,14 @@ module Data.Binary.Get ( , getInt32host , getInt64host + -- ** Decoding Floats/Doubles + , getFloatbe + , getFloatle + , getFloathost + , getDoublebe + , getDoublele + , getDoublehost + -- * Deprecated functions , runGetState -- DEPRECATED , remaining -- DEPRECATED @@ -229,6 +237,9 @@ import GHC.Base import GHC.Word #endif +-- needed for casting words to float/double +import Data.ReinterpretCast (wordToFloat, wordToDouble) + -- $lazyinterface -- The lazy interface consumes a single lazy 'L.ByteString'. It's the easiest -- interface to get started with, but it doesn't support interleaving I\/O and @@ -609,6 +620,39 @@ getInt64host = getPtr (sizeOf (undefined :: Int64)) ------------------------------------------------------------------------ +-- Double/Float reads + +-- | Read a 'Float' in big endian format. +getFloatbe :: Get Float +getFloatbe = wordToFloat <$> getWord32be +{-# INLINE getFloatbe #-} + +-- | Read a 'Float' in little endian format. +getFloatle :: Get Float +getFloatle = wordToFloat <$> getWord32le +{-# INLINE getFloatle #-} + +-- | Read a 'Float' in native host order and host endianess. +getFloathost :: Get Float +getFloathost = wordToFloat <$> getWord32host +{-# INLINE getFloathost #-} + +-- | Read a 'Double' in big endian format. +getDoublebe :: Get Double +getDoublebe = wordToDouble <$> getWord64be +{-# INLINE getDoublebe #-} + +-- | Read a 'Double' in little endian format. +getDoublele :: Get Double +getDoublele = wordToDouble <$> getWord64le +{-# INLINE getDoublele #-} + +-- | Read a 'Double' in native host order and host endianess. +getDoublehost :: Get Double +getDoublehost = wordToDouble <$> getWord64host +{-# INLINE getDoublehost #-} + +------------------------------------------------------------------------ -- Unchecked shifts shiftl_w16 :: Word16 -> Int -> Word16 diff --git a/src/Data/Binary/Put.hs b/src/Data/Binary/Put.hs index 9af7c11..286161c 100644 --- a/src/Data/Binary/Put.hs +++ b/src/Data/Binary/Put.hs @@ -1,6 +1,7 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} -{-# LANGUAGE Safe #-} +-- {-# LANGUAGE Safe #-} +{-# LANGUAGE Trustworthy #-} #if MIN_VERSION_base(4,9,0) #define HAS_SEMIGROUP @@ -49,6 +50,8 @@ module Data.Binary.Put ( , putInt16be , putInt32be , putInt64be + , putFloatbe + , putDoublebe -- * Little-endian primitives , putWord16le @@ -57,6 +60,8 @@ module Data.Binary.Put ( , putInt16le , putInt32le , putInt64le + , putFloatle + , putDoublele -- * Host-endian, unaligned writes , putWordhost -- :: Word -> Put @@ -67,6 +72,8 @@ module Data.Binary.Put ( , putInt16host -- :: Int16 -> Put , putInt32host -- :: Int32 -> Put , putInt64host -- :: Int64 -> Put + , putFloathost + , putDoublehost -- * Unicode , putCharUtf8 @@ -93,6 +100,8 @@ import Data.Semigroup import Control.Applicative import Prelude -- Silence AMP warning. +-- needed for casting Floats/Doubles to words. +import Data.ReinterpretCast (floatToWord, doubleToWord) ------------------------------------------------------------------------ @@ -346,6 +355,38 @@ putInt64host :: Int64 -> Put putInt64host = tell . B.putInt64host {-# INLINE putInt64host #-} +------------------------------------------------------------------------ +-- Floats/Doubles + +-- | Write a 'Float' in big endian format. +putFloatbe :: Float -> Put +putFloatbe = putWord32be . floatToWord +{-# INLINE putFloatbe #-} + +-- | Write a 'Float' in little endian format. +putFloatle :: Float -> Put +putFloatle = putWord32le . floatToWord +{-# INLINE putFloatle #-} + +-- | Write a 'Float' in native host order and host endianness. +putFloathost :: Float -> Put +putFloathost = putWord32host . floatToWord +{-# INLINE putFloathost #-} + +-- | Write a 'Double' in big endian format. +putDoublebe :: Double -> Put +putDoublebe = putWord64be . doubleToWord +{-# INLINE putDoublebe #-} + +-- | Write a 'Double' in little endian format. +putDoublele :: Double -> Put +putDoublele = putWord64le . doubleToWord +{-# INLINE putDoublele #-} + +-- | Write a 'Double' in native host order and host endianness. +putDoublehost :: Double -> Put +putDoublehost = putWord64host . doubleToWord +{-# INLINE putDoublehost #-} ------------------------------------------------------------------------ -- Unicode diff --git a/tests/QC.hs b/tests/QC.hs index 3bda2bd..650d32b 100644 --- a/tests/QC.hs +++ b/tests/QC.hs @@ -131,6 +131,26 @@ prop_Int64host = roundTripWith putInt64host getInt64host prop_Inthost :: Int -> Property prop_Inthost = roundTripWith putInthost getInthost +-- Floats and Doubles + +prop_Floatbe :: Float -> Property +prop_Floatbe = roundTripWith putFloatbe getFloatbe + +prop_Floatle :: Float -> Property +prop_Floatle = roundTripWith putFloatle getFloatle + +prop_Floathost :: Float -> Property +prop_Floathost = roundTripWith putFloathost getFloathost + +prop_Doublebe :: Double -> Property +prop_Doublebe = roundTripWith putDoublebe getDoublebe + +prop_Doublele :: Double -> Property +prop_Doublele = roundTripWith putDoublele getDoublele + +prop_Doublehost :: Double -> Property +prop_Doublehost = roundTripWith putDoublehost getDoublehost + -- done, partial and fail @@ -552,6 +572,13 @@ tests = , testProperty "Int64le" (p prop_Int64le) , testProperty "Int64host" (p prop_Int64host) , testProperty "Inthost" (p prop_Inthost) + -- Float/Double + , testProperty "Floatbe" (p prop_Floatbe) + , testProperty "Floatle" (p prop_Floatle) + , testProperty "Floathost" (p prop_Floathost) + , testProperty "Doublebe" (p prop_Doublebe) + , testProperty "Doublele" (p prop_Doublele) + , testProperty "Doublehost" (p prop_Doublehost) ] , testGroup "String utils" From git at git.haskell.org Sat Feb 4 21:17:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 21:17:29 +0000 (UTC) Subject: [commit: packages/binary] master: Update generics-bench to use Cabal == 1.24.* (e69378c) Message-ID: <20170204211729.DD6663A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/e69378c5c809d312488cd580a60e0bb195e266c2 >--------------------------------------------------------------- commit e69378c5c809d312488cd580a60e0bb195e266c2 Author: Lennart Kolmodin Date: Wed May 25 21:04:05 2016 +0200 Update generics-bench to use Cabal == 1.24.* >--------------------------------------------------------------- e69378c5c809d312488cd580a60e0bb195e266c2 .travis.yml | 2 +- benchmarks/GenericsBenchTypes.hs | 1 + binary.cabal | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2866756..cb4732b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,7 +30,7 @@ install: - sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config - cabal sandbox init # can't use "cabal install --only-dependencies --enable-tests --enable-benchmarks" due to dep-cycle - - cabal install criterion deepseq mtl "QuickCheck >= 2.8" HUnit "test-framework-quickcheck2 >= 0.3" "random >= 1.0.1.0" attoparsec cereal 'Cabal == 1.22.*' tar zlib -j + - cabal install criterion deepseq mtl "QuickCheck >= 2.8" HUnit "test-framework-quickcheck2 >= 0.3" "random >= 1.0.1.0" attoparsec cereal 'Cabal == 1.24.*' tar zlib -j script: - cabal configure --enable-tests --enable-benchmarks -v2 --ghc-options=-fno-spec-constr diff --git a/benchmarks/GenericsBenchTypes.hs b/benchmarks/GenericsBenchTypes.hs index 65f1efa..cbedf1e 100644 --- a/benchmarks/GenericsBenchTypes.hs +++ b/benchmarks/GenericsBenchTypes.hs @@ -39,6 +39,7 @@ instance Binary PackageIdentifier instance Binary PackageName instance Binary RepoKind instance Binary RepoType +instance Binary SetupBuildInfo instance Binary SourceRepo instance Binary TestSuite instance Binary TestSuiteInterface diff --git a/binary.cabal b/binary.cabal index a282ea0..70161c4 100644 --- a/binary.cabal +++ b/binary.cabal @@ -161,7 +161,7 @@ benchmark generics-bench build-depends: base >= 4.5.0.0 && < 5, bytestring, - Cabal == 1.22.*, + Cabal == 1.24.*, directory, filepath, tar, From git at git.haskell.org Sat Feb 4 21:17:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 21:17:31 +0000 (UTC) Subject: [commit: packages/binary] master: Merge pull request #116 from bgamari/inline-tuple-instances (b7a4075) Message-ID: <20170204211731.E518B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/b7a4075d80fa828de4f7d939cd37c4b8a01fcf06 >--------------------------------------------------------------- commit b7a4075d80fa828de4f7d939cd37c4b8a01fcf06 Merge: e69378c 23e0073 Author: Lennart Kolmodin Date: Wed May 25 21:40:33 2016 +0200 Merge pull request #116 from bgamari/inline-tuple-instances Ensure that Binary instances for tuples are inlined >--------------------------------------------------------------- b7a4075d80fa828de4f7d939cd37c4b8a01fcf06 src/Data/Binary/Class.hs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) From git at git.haskell.org Sat Feb 4 21:17:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 21:17:33 +0000 (UTC) Subject: [commit: packages/binary] master: Added some missing deps (2bf4993) Message-ID: <20170204211733.E9CC73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/2bf4993587b76e3a91f0403a1ffcc6f04d041440 >--------------------------------------------------------------- commit 2bf4993587b76e3a91f0403a1ffcc6f04d041440 Author: Daniel Díaz Date: Wed May 25 17:14:02 2016 -0400 Added some missing deps >--------------------------------------------------------------- 2bf4993587b76e3a91f0403a1ffcc6f04d041440 binary.cabal | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/binary.cabal b/binary.cabal index 555b2d6..5f2619b 100644 --- a/binary.cabal +++ b/binary.cabal @@ -108,7 +108,8 @@ benchmark bench other-modules: MemBench build-depends: base >= 4.5.0.0 && < 5, - bytestring + bytestring, + reinterpret-cast -- build dependencies from using binary source rather than depending on the library build-depends: array, containers c-sources: benchmarks/CBenchmark.c @@ -130,7 +131,8 @@ benchmark get cereal, criterion == 1.*, deepseq, - mtl + mtl, + reinterpret-cast -- build dependencies from using binary source rather than depending on the library build-depends: array, containers ghc-options: -O2 -Wall @@ -147,7 +149,8 @@ benchmark put base >= 4.5.0.0 && < 5, bytestring, criterion == 1.*, - deepseq + deepseq, + reinterpret-cast -- build dependencies from using binary source rather than depending on the library build-depends: array, containers ghc-options: -O2 -Wall @@ -169,7 +172,9 @@ benchmark generics-bench tar, unordered-containers, zlib, - criterion + criterion, + reinterpret-cast + other-modules: GenericsBenchCache GenericsBenchTypes From git at git.haskell.org Sat Feb 4 21:17:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 21:17:35 +0000 (UTC) Subject: [commit: packages/binary] master: Removed reinterpret-cast dependency. Embedded the code from this library instead. (93e3199) Message-ID: <20170204211735.F0AFF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/93e31997fb7b9e52627bc8af2a0a2b9f1ff7118f >--------------------------------------------------------------- commit 93e31997fb7b9e52627bc8af2a0a2b9f1ff7118f Author: Daniel Díaz Date: Fri May 27 12:07:14 2016 -0400 Removed reinterpret-cast dependency. Embedded the code from this library instead. >--------------------------------------------------------------- 93e31997fb7b9e52627bc8af2a0a2b9f1ff7118f binary.cabal | 23 +++++++++-------------- src/Data/Binary/Get.hs | 2 +- src/Data/Binary/Put.hs | 2 +- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/binary.cabal b/binary.cabal index 5f2619b..9e5c577 100644 --- a/binary.cabal +++ b/binary.cabal @@ -31,7 +31,7 @@ source-repository head location: git://github.com/kolmodin/binary.git library - build-depends: base >= 4.5.0.0 && < 5, bytestring >= 0.10.2, containers, array, reinterpret-cast + build-depends: base >= 4.5.0.0 && < 5, bytestring >= 0.10.2, containers, array hs-source-dirs: src exposed-modules: Data.Binary, Data.Binary.Put, @@ -41,7 +41,8 @@ library other-modules: Data.Binary.Class, Data.Binary.Internal, - Data.Binary.Generic + Data.Binary.Generic, + Data.Binary.FloatCast if impl(ghc <= 7.6) -- prior to ghc-7.4 generics lived in ghc-prim build-depends: ghc-prim @@ -69,8 +70,7 @@ test-suite qc random>=1.0.1.0, test-framework, test-framework-quickcheck2 >= 0.3, - QuickCheck>=2.8, - reinterpret-cast + QuickCheck>=2.8 -- build dependencies from using binary source rather than depending on the library build-depends: array, containers @@ -90,8 +90,7 @@ test-suite read-write-file Cabal, directory, filepath, - HUnit, - reinterpret-cast + HUnit -- build dependencies from using binary source rather than depending on the library build-depends: array, containers @@ -108,8 +107,7 @@ benchmark bench other-modules: MemBench build-depends: base >= 4.5.0.0 && < 5, - bytestring, - reinterpret-cast + bytestring -- build dependencies from using binary source rather than depending on the library build-depends: array, containers c-sources: benchmarks/CBenchmark.c @@ -131,8 +129,7 @@ benchmark get cereal, criterion == 1.*, deepseq, - mtl, - reinterpret-cast + mtl -- build dependencies from using binary source rather than depending on the library build-depends: array, containers ghc-options: -O2 -Wall @@ -149,8 +146,7 @@ benchmark put base >= 4.5.0.0 && < 5, bytestring, criterion == 1.*, - deepseq, - reinterpret-cast + deepseq -- build dependencies from using binary source rather than depending on the library build-depends: array, containers ghc-options: -O2 -Wall @@ -172,8 +168,7 @@ benchmark generics-bench tar, unordered-containers, zlib, - criterion, - reinterpret-cast + criterion other-modules: GenericsBenchCache diff --git a/src/Data/Binary/Get.hs b/src/Data/Binary/Get.hs index 3488f66..a5282d6 100644 --- a/src/Data/Binary/Get.hs +++ b/src/Data/Binary/Get.hs @@ -238,7 +238,7 @@ import GHC.Word #endif -- needed for casting words to float/double -import Data.ReinterpretCast (wordToFloat, wordToDouble) +import Data.Binary.FloatCast (wordToFloat, wordToDouble) -- $lazyinterface -- The lazy interface consumes a single lazy 'L.ByteString'. It's the easiest diff --git a/src/Data/Binary/Put.hs b/src/Data/Binary/Put.hs index 286161c..c403e17 100644 --- a/src/Data/Binary/Put.hs +++ b/src/Data/Binary/Put.hs @@ -101,7 +101,7 @@ import Control.Applicative import Prelude -- Silence AMP warning. -- needed for casting Floats/Doubles to words. -import Data.ReinterpretCast (floatToWord, doubleToWord) +import Data.Binary.FloatCast (floatToWord, doubleToWord) ------------------------------------------------------------------------ From git at git.haskell.org Sat Feb 4 21:17:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 21:17:38 +0000 (UTC) Subject: [commit: packages/binary] master: Forgot to add the source of the new module. (ac28b9e) Message-ID: <20170204211738.036E63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/ac28b9e986d4b6181516c9561ef40784444705fa >--------------------------------------------------------------- commit ac28b9e986d4b6181516c9561ef40784444705fa Author: Daniel Díaz Date: Fri May 27 12:37:30 2016 -0400 Forgot to add the source of the new module. >--------------------------------------------------------------- ac28b9e986d4b6181516c9561ef40784444705fa src/Data/Binary/FloatCast.hs | 54 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/src/Data/Binary/FloatCast.hs b/src/Data/Binary/FloatCast.hs new file mode 100644 index 0000000..aff3a3d --- /dev/null +++ b/src/Data/Binary/FloatCast.hs @@ -0,0 +1,54 @@ + +{-# LANGUAGE FlexibleContexts #-} + +-- | This module is a literal copy of +-- . +-- +-- Implements casting via a 1-elemnt STUArray, as described in +-- . +module Data.Binary.FloatCast + ( floatToWord + , wordToFloat + , doubleToWord + , wordToDouble + ) where + + +import Data.Word (Word32, Word64) +import Data.Array.ST (newArray, readArray, MArray, STUArray) +import Data.Array.Unsafe (castSTUArray) +import GHC.ST (runST, ST) + + +-- | Reinterpret-casts a `Float` to a `Word32`. +floatToWord :: Float -> Word32 +floatToWord x = runST (cast x) + +{-# INLINEABLE floatToWord #-} + + +-- | Reinterpret-casts a `Word32` to a `Float`. +wordToFloat :: Word32 -> Float +wordToFloat x = runST (cast x) + +{-# INLINEABLE wordToFloat #-} + + +-- | Reinterpret-casts a `Double` to a `Word64`. +doubleToWord :: Double -> Word64 +doubleToWord x = runST (cast x) + +{-# INLINEABLE doubleToWord #-} + + +-- | Reinterpret-casts a `Word64` to a `Double`. +wordToDouble :: Word64 -> Double +wordToDouble x = runST (cast x) + +{-# INLINEABLE wordToDouble #-} + + +{-# INLINE cast #-} +cast :: (MArray (STUArray s) a (ST s), + MArray (STUArray s) b (ST s)) => a -> ST s b +cast x = newArray (0 :: Int, 0) x >>= castSTUArray >>= flip readArray 0 From git at git.haskell.org Sat Feb 4 21:17:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 21:17:40 +0000 (UTC) Subject: [commit: packages/binary] master: On Travis CI, also build with GHC 8.0.1 and cabal-install 1.24. (d597871) Message-ID: <20170204211740.0A3553A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/d59787196ad7d1e0bbf6b03526c2aa44afb22eb2 >--------------------------------------------------------------- commit d59787196ad7d1e0bbf6b03526c2aa44afb22eb2 Author: Lennart Kolmodin Date: Sat May 28 11:34:57 2016 +0200 On Travis CI, also build with GHC 8.0.1 and cabal-install 1.24. >--------------------------------------------------------------- d59787196ad7d1e0bbf6b03526c2aa44afb22eb2 .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index cb4732b..5dc64cc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,8 @@ matrix: addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4], 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=1.24 GHCVER=8.0.1 + addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.1], 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 Sat Feb 4 21:17:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 21:17:42 +0000 (UTC) Subject: [commit: packages/binary] master: Fix generic-bench build error on GHC 8.0.1. (bbe7789) Message-ID: <20170204211742.115F63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/bbe7789b7bf8657b9e9740351bed6252352e98fb >--------------------------------------------------------------- commit bbe7789b7bf8657b9e9740351bed6252352e98fb Author: Lennart Kolmodin Date: Sat May 28 11:59:26 2016 +0200 Fix generic-bench build error on GHC 8.0.1. >--------------------------------------------------------------- bbe7789b7bf8657b9e9740351bed6252352e98fb benchmarks/GenericsBenchTypes.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/benchmarks/GenericsBenchTypes.hs b/benchmarks/GenericsBenchTypes.hs index cbedf1e..4ffc248 100644 --- a/benchmarks/GenericsBenchTypes.hs +++ b/benchmarks/GenericsBenchTypes.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE DeriveGeneric, StandaloneDeriving #-} +{-# LANGUAGE CPP, DeriveGeneric, StandaloneDeriving #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module GenericsBenchTypes where @@ -14,8 +14,9 @@ import GHC.Generics (Generic) import Data.Binary - +#if ! MIN_VERSION_base(4,9,0) deriving instance Generic Version +#endif instance Binary Benchmark instance Binary BenchmarkInterface From git at git.haskell.org Sat Feb 4 21:17:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 21:17:44 +0000 (UTC) Subject: [commit: packages/binary] master: Merge pull request #115 from bgamari/needless-copies (ed9a278) Message-ID: <20170204211744.177003A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/ed9a27831041d625d19f980b66bc4f718c920b62 >--------------------------------------------------------------- commit ed9a27831041d625d19f980b66bc4f718c920b62 Merge: bbe7789 7532daa Author: Lennart Kolmodin Date: Sat May 28 21:26:10 2016 +0200 Merge pull request #115 from bgamari/needless-copies [RFC] Get: Avoid needless copies of input >--------------------------------------------------------------- ed9a27831041d625d19f980b66bc4f718c920b62 src/Data/Binary/Get/Internal.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) From git at git.haskell.org Sat Feb 4 21:17:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 21:17:46 +0000 (UTC) Subject: [commit: packages/binary] master: Inline the Alternative functions. (4042fb5) Message-ID: <20170204211746.1D53A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/4042fb5243872a4f75fd6fe1a6f6941708993660 >--------------------------------------------------------------- commit 4042fb5243872a4f75fd6fe1a6f6941708993660 Author: Lennart Kolmodin Date: Mon May 30 21:21:19 2016 +0200 Inline the Alternative functions. The related benchmarks in benchmarks/Get.hs become 20% faster. >--------------------------------------------------------------- 4042fb5243872a4f75fd6fe1a6f6941708993660 src/Data/Binary/Get/Internal.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Data/Binary/Get/Internal.hs b/src/Data/Binary/Get/Internal.hs index b9a0818..c2ebcff 100644 --- a/src/Data/Binary/Get/Internal.hs +++ b/src/Data/Binary/Get/Internal.hs @@ -259,18 +259,22 @@ getBytes = getByteString -- | /Since: 0.7.0.0/ instance Alternative Get where empty = C $ \inp _ks -> Fail inp "Data.Binary.Get(Alternative).empty" + {-# INLINE empty #-} (<|>) f g = do (decoder, bs) <- runAndKeepTrack f case decoder of Done inp x -> C $ \_ ks -> ks inp x Fail _ _ -> pushBack bs >> g _ -> error "Binary: impossible" + {-# INLINE (<|>) #-} some p = (:) <$> p <*> many p + {-# INLINE some #-} many p = do v <- (Just <$> p) <|> pure Nothing case v of Nothing -> pure [] Just x -> (:) x <$> many p + {-# INLINE many #-} -- | Run a decoder and keep track of all the input it consumes. -- Once it's finished, return the final decoder (always 'Done' or 'Fail'), From git at git.haskell.org Sat Feb 4 21:17:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 21:17:48 +0000 (UTC) Subject: [commit: packages/binary] master: Merge branch 'pr/monoid-semigroup-instances' (a907c4a) Message-ID: <20170204211748.242393A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/a907c4afc1b7e56fda1acc5a64b92b6ac955ffec >--------------------------------------------------------------- commit a907c4afc1b7e56fda1acc5a64b92b6ac955ffec Merge: 4042fb5 2e1c4b2 Author: Lennart Kolmodin Date: Mon May 30 21:46:05 2016 +0200 Merge branch 'pr/monoid-semigroup-instances' >--------------------------------------------------------------- a907c4afc1b7e56fda1acc5a64b92b6ac955ffec src/Data/Binary/Class.hs | 102 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) From git at git.haskell.org Sat Feb 4 21:17:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 21:17:50 +0000 (UTC) Subject: [commit: packages/binary] master: Changed INLINEABLEs with INLINEs (976468b) Message-ID: <20170204211750.2A4553A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/976468b71a4f45640e4f013223a7d2ea97eaaf1b >--------------------------------------------------------------- commit 976468b71a4f45640e4f013223a7d2ea97eaaf1b Author: Daniel Díaz Date: Tue May 31 13:11:40 2016 -0400 Changed INLINEABLEs with INLINEs >--------------------------------------------------------------- 976468b71a4f45640e4f013223a7d2ea97eaaf1b src/Data/Binary/FloatCast.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Data/Binary/FloatCast.hs b/src/Data/Binary/FloatCast.hs index aff3a3d..31ed0a0 100644 --- a/src/Data/Binary/FloatCast.hs +++ b/src/Data/Binary/FloatCast.hs @@ -24,28 +24,28 @@ import GHC.ST (runST, ST) floatToWord :: Float -> Word32 floatToWord x = runST (cast x) -{-# INLINEABLE floatToWord #-} +{-# INLINE floatToWord #-} -- | Reinterpret-casts a `Word32` to a `Float`. wordToFloat :: Word32 -> Float wordToFloat x = runST (cast x) -{-# INLINEABLE wordToFloat #-} +{-# INLINE wordToFloat #-} -- | Reinterpret-casts a `Double` to a `Word64`. doubleToWord :: Double -> Word64 doubleToWord x = runST (cast x) -{-# INLINEABLE doubleToWord #-} +{-# INLINE doubleToWord #-} -- | Reinterpret-casts a `Word64` to a `Double`. wordToDouble :: Word64 -> Double wordToDouble x = runST (cast x) -{-# INLINEABLE wordToDouble #-} +{-# INLINE wordToDouble #-} {-# INLINE cast #-} From git at git.haskell.org Sat Feb 4 21:17:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 21:17:52 +0000 (UTC) Subject: [commit: packages/binary] master: Only layout changes (ef18f42) Message-ID: <20170204211752.314523A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/ef18f42da2d67bdbe0ede2c23d911218761fbb43 >--------------------------------------------------------------- commit ef18f42da2d67bdbe0ede2c23d911218761fbb43 Author: Daniel Díaz Date: Tue May 31 13:12:49 2016 -0400 Only layout changes >--------------------------------------------------------------- ef18f42da2d67bdbe0ede2c23d911218761fbb43 src/Data/Binary/FloatCast.hs | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/Data/Binary/FloatCast.hs b/src/Data/Binary/FloatCast.hs index 31ed0a0..65f876e 100644 --- a/src/Data/Binary/FloatCast.hs +++ b/src/Data/Binary/FloatCast.hs @@ -1,7 +1,7 @@ {-# LANGUAGE FlexibleContexts #-} --- | This module is a literal copy of +-- | This module was written based on -- . -- -- Implements casting via a 1-elemnt STUArray, as described in @@ -13,42 +13,32 @@ module Data.Binary.FloatCast , wordToDouble ) where - import Data.Word (Word32, Word64) import Data.Array.ST (newArray, readArray, MArray, STUArray) import Data.Array.Unsafe (castSTUArray) import GHC.ST (runST, ST) - -- | Reinterpret-casts a `Float` to a `Word32`. floatToWord :: Float -> Word32 floatToWord x = runST (cast x) - {-# INLINE floatToWord #-} - -- | Reinterpret-casts a `Word32` to a `Float`. wordToFloat :: Word32 -> Float wordToFloat x = runST (cast x) - {-# INLINE wordToFloat #-} - -- | Reinterpret-casts a `Double` to a `Word64`. doubleToWord :: Double -> Word64 doubleToWord x = runST (cast x) - {-# INLINE doubleToWord #-} - -- | Reinterpret-casts a `Word64` to a `Double`. wordToDouble :: Word64 -> Double wordToDouble x = runST (cast x) - {-# INLINE wordToDouble #-} - -{-# INLINE cast #-} cast :: (MArray (STUArray s) a (ST s), MArray (STUArray s) b (ST s)) => a -> ST s b cast x = newArray (0 :: Int, 0) x >>= castSTUArray >>= flip readArray 0 +{-# INLINE cast #-} From git at git.haskell.org Sat Feb 4 21:17:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 21:17:54 +0000 (UTC) Subject: [commit: packages/binary] master: Back to safety! (b34aff8) Message-ID: <20170204211754.37D223A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/b34aff825f7be10002743f60090b26b96b12d141 >--------------------------------------------------------------- commit b34aff825f7be10002743f60090b26b96b12d141 Author: Daniel Díaz Date: Wed Jun 1 10:20:33 2016 -0400 Back to safety! >--------------------------------------------------------------- b34aff825f7be10002743f60090b26b96b12d141 src/Data/Binary/FloatCast.hs | 1 + src/Data/Binary/Put.hs | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Data/Binary/FloatCast.hs b/src/Data/Binary/FloatCast.hs index 65f876e..2eb86f0 100644 --- a/src/Data/Binary/FloatCast.hs +++ b/src/Data/Binary/FloatCast.hs @@ -1,5 +1,6 @@ {-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE Trustworthy #-} -- | This module was written based on -- . diff --git a/src/Data/Binary/Put.hs b/src/Data/Binary/Put.hs index c403e17..de18ab0 100644 --- a/src/Data/Binary/Put.hs +++ b/src/Data/Binary/Put.hs @@ -1,7 +1,6 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} --- {-# LANGUAGE Safe #-} -{-# LANGUAGE Trustworthy #-} +{-# LANGUAGE Safe #-} #if MIN_VERSION_base(4,9,0) #define HAS_SEMIGROUP From git at git.haskell.org Sat Feb 4 21:17:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 21:17:56 +0000 (UTC) Subject: [commit: packages/binary] master: Specify IEEE-754 in the haddocks for the new Float/Double functions. (15649b6) Message-ID: <20170204211756.3E3F33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/15649b6e28e573e157beeeb4abfeddc11b824317 >--------------------------------------------------------------- commit 15649b6e28e573e157beeeb4abfeddc11b824317 Author: Lennart Kolmodin Date: Wed Jun 1 22:15:14 2016 +0200 Specify IEEE-754 in the haddocks for the new Float/Double functions. >--------------------------------------------------------------- 15649b6e28e573e157beeeb4abfeddc11b824317 src/Data/Binary/Get.hs | 12 ++++++------ src/Data/Binary/Put.hs | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Data/Binary/Get.hs b/src/Data/Binary/Get.hs index a5282d6..dcabf72 100644 --- a/src/Data/Binary/Get.hs +++ b/src/Data/Binary/Get.hs @@ -622,32 +622,32 @@ getInt64host = getPtr (sizeOf (undefined :: Int64)) ------------------------------------------------------------------------ -- Double/Float reads --- | Read a 'Float' in big endian format. +-- | Read a 'Float' in big endian IEEE-754 format. getFloatbe :: Get Float getFloatbe = wordToFloat <$> getWord32be {-# INLINE getFloatbe #-} --- | Read a 'Float' in little endian format. +-- | Read a 'Float' in little endian IEEE-754 format. getFloatle :: Get Float getFloatle = wordToFloat <$> getWord32le {-# INLINE getFloatle #-} --- | Read a 'Float' in native host order and host endianess. +-- | Read a 'Float' in IEEE-754 format and host endian. getFloathost :: Get Float getFloathost = wordToFloat <$> getWord32host {-# INLINE getFloathost #-} --- | Read a 'Double' in big endian format. +-- | Read a 'Double' in big endian IEEE-754 format. getDoublebe :: Get Double getDoublebe = wordToDouble <$> getWord64be {-# INLINE getDoublebe #-} --- | Read a 'Double' in little endian format. +-- | Read a 'Double' in little endian IEEE-754 format. getDoublele :: Get Double getDoublele = wordToDouble <$> getWord64le {-# INLINE getDoublele #-} --- | Read a 'Double' in native host order and host endianess. +-- | Read a 'Double' in IEEE-754 format and host endian. getDoublehost :: Get Double getDoublehost = wordToDouble <$> getWord64host {-# INLINE getDoublehost #-} diff --git a/src/Data/Binary/Put.hs b/src/Data/Binary/Put.hs index de18ab0..32fb618 100644 --- a/src/Data/Binary/Put.hs +++ b/src/Data/Binary/Put.hs @@ -357,32 +357,32 @@ putInt64host = tell . B.putInt64host ------------------------------------------------------------------------ -- Floats/Doubles --- | Write a 'Float' in big endian format. +-- | Write a 'Float' in big endian IEEE-754 format. putFloatbe :: Float -> Put putFloatbe = putWord32be . floatToWord {-# INLINE putFloatbe #-} --- | Write a 'Float' in little endian format. +-- | Write a 'Float' in little endian IEEE-754 format. putFloatle :: Float -> Put putFloatle = putWord32le . floatToWord {-# INLINE putFloatle #-} --- | Write a 'Float' in native host order and host endianness. +-- | Write a 'Float' in native in IEEE-754 format and host endian. putFloathost :: Float -> Put putFloathost = putWord32host . floatToWord {-# INLINE putFloathost #-} --- | Write a 'Double' in big endian format. +-- | Write a 'Double' in big endian IEEE-754 format. putDoublebe :: Double -> Put putDoublebe = putWord64be . doubleToWord {-# INLINE putDoublebe #-} --- | Write a 'Double' in little endian format. +-- | Write a 'Double' in little endian IEEE-754 format. putDoublele :: Double -> Put putDoublele = putWord64le . doubleToWord {-# INLINE putDoublele #-} --- | Write a 'Double' in native host order and host endianness. +-- | Write a 'Double' in native in IEEE-754 format and host endian. putDoublehost :: Double -> Put putDoublehost = putWord64host . doubleToWord {-# INLINE putDoublehost #-} From git at git.haskell.org Sat Feb 4 21:17:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 21:17:58 +0000 (UTC) Subject: [commit: packages/binary] master: Fix haddocks. (c15410b) Message-ID: <20170204211758.44FDD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/c15410bf4df3368037627ef98e4bb4124b827ae7 >--------------------------------------------------------------- commit c15410bf4df3368037627ef98e4bb4124b827ae7 Author: Lennart Kolmodin Date: Wed Jun 1 22:16:04 2016 +0200 Fix haddocks. >--------------------------------------------------------------- c15410bf4df3368037627ef98e4bb4124b827ae7 src/Data/Binary/Get.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Data/Binary/Get.hs b/src/Data/Binary/Get.hs index dcabf72..6220759 100644 --- a/src/Data/Binary/Get.hs +++ b/src/Data/Binary/Get.hs @@ -540,33 +540,33 @@ word64le = \s -> {-# INLINE word64le #-} --- | Read an Int16 in big endian format +-- | Read an Int16 in big endian format. getInt16be :: Get Int16 getInt16be = fromIntegral <$> getWord16be {-# INLINE getInt16be #-} --- | Read an Int32 in big endian format +-- | Read an Int32 in big endian format. getInt32be :: Get Int32 getInt32be = fromIntegral <$> getWord32be {-# INLINE getInt32be #-} --- | Read an Int64 in big endian format +-- | Read an Int64 in big endian format. getInt64be :: Get Int64 getInt64be = fromIntegral <$> getWord64be {-# INLINE getInt64be #-} --- | Read an Int16 in little endian format +-- | Read an Int16 in little endian format. getInt16le :: Get Int16 getInt16le = fromIntegral <$> getWord16le {-# INLINE getInt16le #-} --- | Read an Int32 in little endian format +-- | Read an Int32 in little endian format. getInt32le :: Get Int32 getInt32le = fromIntegral <$> getWord32le {-# INLINE getInt32le #-} --- | Read an Int64 in little endian format +-- | Read an Int64 in little endian format. getInt64le :: Get Int64 getInt64le = fromIntegral <$> getWord64le {-# INLINE getInt64le #-} From git at git.haskell.org Sat Feb 4 21:18:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 21:18:00 +0000 (UTC) Subject: [commit: packages/binary] master: Merge branch 'pr/float-double-instances' (a5d1cc9) Message-ID: <20170204211800.4C80C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/a5d1cc900867e99b0e48a0d11f25ae268d05a40c >--------------------------------------------------------------- commit a5d1cc900867e99b0e48a0d11f25ae268d05a40c Merge: a907c4a c15410b Author: Lennart Kolmodin Date: Wed Jun 1 22:16:21 2016 +0200 Merge branch 'pr/float-double-instances' >--------------------------------------------------------------- a5d1cc900867e99b0e48a0d11f25ae268d05a40c binary.cabal | 4 +++- src/Data/Binary/FloatCast.hs | 45 +++++++++++++++++++++++++++++++++++ src/Data/Binary/Get.hs | 56 +++++++++++++++++++++++++++++++++++++++----- src/Data/Binary/Put.hs | 40 +++++++++++++++++++++++++++++++ tests/QC.hs | 27 +++++++++++++++++++++ 5 files changed, 165 insertions(+), 7 deletions(-) From git at git.haskell.org Sat Feb 4 21:18:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 21:18:02 +0000 (UTC) Subject: [commit: packages/binary] master: Bump version to 0.8.4.0. (7f723fd) Message-ID: <20170204211802.52A0A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/7f723fd06d7467d27e8d7eb58bc9fc0d7b373f52 >--------------------------------------------------------------- commit 7f723fd06d7467d27e8d7eb58bc9fc0d7b373f52 Author: Lennart Kolmodin Date: Fri Jun 3 20:27:52 2016 +0200 Bump version to 0.8.4.0. >--------------------------------------------------------------- 7f723fd06d7467d27e8d7eb58bc9fc0d7b373f52 binary.cabal | 2 +- changelog.md | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/binary.cabal b/binary.cabal index a08de8d..15fa379 100644 --- a/binary.cabal +++ b/binary.cabal @@ -1,5 +1,5 @@ name: binary -version: 0.8.3.0 +version: 0.8.4.0 license: BSD3 license-file: LICENSE author: Lennart Kolmodin diff --git a/changelog.md b/changelog.md index cde0eb1..80e1af4 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,15 @@ binary ====== +binary-0.8.4.0 +-------------- + +- `binary` supports GHC >= 7.4.2 +- Performance improvements for `Alternative` functions. +- put/get functions for IEEE-754 floats and doubles, #119. +- Fix performance bugs, #115. +- Binary instances for datatypes in `Data.Monoid` and `Data.Semigroup`, #114. + binary-0.8.3.0 -------------- From git at git.haskell.org Sat Feb 4 21:18:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 21:18:04 +0000 (UTC) Subject: [commit: packages/binary] master: Import Data.ByteString.Short conditionally (61e1b4a) Message-ID: <20170204211804.58AE13A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/61e1b4a0b8a3d4434562b30a6ae07cacbbb3622d >--------------------------------------------------------------- commit 61e1b4a0b8a3d4434562b30a6ae07cacbbb3622d Author: Lennart Kolmodin Date: Thu Jul 7 09:47:02 2016 +0200 Import Data.ByteString.Short conditionally Fixes #121. >--------------------------------------------------------------- 61e1b4a0b8a3d4434562b30a6ae07cacbbb3622d src/Data/Binary/Builder.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Data/Binary/Builder.hs b/src/Data/Binary/Builder.hs index 5cf86b1..1f20496 100644 --- a/src/Data/Binary/Builder.hs +++ b/src/Data/Binary/Builder.hs @@ -68,7 +68,11 @@ module Data.Binary.Builder ( import qualified Data.ByteString as S import qualified Data.ByteString.Lazy as L + +#if MIN_VERSION_bytestring(0,10,4) import qualified Data.ByteString.Short as T +#endif + import qualified Data.ByteString.Builder as B import qualified Data.ByteString.Builder.Prim as Prim import Data.ByteString.Builder ( Builder, toLazyByteString ) From git at git.haskell.org Sat Feb 4 21:18:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 21:18:06 +0000 (UTC) Subject: [commit: packages/binary] master: Merge pull request #122 from kolmodin/pr-short-import (4ebd69d) Message-ID: <20170204211806.5FF7F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/4ebd69de6022f1c74356b1d1f1cd17141365d65f >--------------------------------------------------------------- commit 4ebd69de6022f1c74356b1d1f1cd17141365d65f Merge: 7f723fd 61e1b4a Author: Lennart Kolmodin Date: Thu Jul 7 13:52:46 2016 +0200 Merge pull request #122 from kolmodin/pr-short-import Import Data.ByteString.Short conditionally >--------------------------------------------------------------- 4ebd69de6022f1c74356b1d1f1cd17141365d65f src/Data/Binary/Builder.hs | 4 ++++ 1 file changed, 4 insertions(+) From git at git.haskell.org Sat Feb 4 21:18:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 21:18:08 +0000 (UTC) Subject: [commit: packages/binary] master: Bump to 0.8.4.1. (af1d17c) Message-ID: <20170204211808.671353A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/af1d17c27867f644886fcbc4703eb3e48792f3e7 >--------------------------------------------------------------- commit af1d17c27867f644886fcbc4703eb3e48792f3e7 Author: Lennart Kolmodin Date: Thu Jul 7 13:55:55 2016 +0200 Bump to 0.8.4.1. >--------------------------------------------------------------- af1d17c27867f644886fcbc4703eb3e48792f3e7 binary.cabal | 2 +- changelog.md | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/binary.cabal b/binary.cabal index 15fa379..d396648 100644 --- a/binary.cabal +++ b/binary.cabal @@ -1,5 +1,5 @@ name: binary -version: 0.8.4.0 +version: 0.8.4.1 license: BSD3 license-file: LICENSE author: Lennart Kolmodin diff --git a/changelog.md b/changelog.md index 80e1af4..8cff85d 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,11 @@ binary ====== +binary-0.8.4.1 +-------------- + +- Fix compilation with bytestring < 0.10.4. + binary-0.8.4.0 -------------- From git at git.haskell.org Sat Feb 4 23:08:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 23:08:33 +0000 (UTC) Subject: [commit: ghc] master: Update binary submodule to 0.8.4.1 (157a46f) Message-ID: <20170204230833.DA50E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/157a46fb17a28e0923a3498ce8609f24ed554a1a/ghc >--------------------------------------------------------------- commit 157a46fb17a28e0923a3498ce8609f24ed554a1a Author: Ben Gamari Date: Sat Feb 4 15:00:59 2017 -0500 Update binary submodule to 0.8.4.1 >--------------------------------------------------------------- 157a46fb17a28e0923a3498ce8609f24ed554a1a libraries/binary | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/binary b/libraries/binary index 38aef85..af1d17c 160000 --- a/libraries/binary +++ b/libraries/binary @@ -1 +1 @@ -Subproject commit 38aef85a759c9a0f64e8c40042e9fa1f675a2f1a +Subproject commit af1d17c27867f644886fcbc4703eb3e48792f3e7 From git at git.haskell.org Sat Feb 4 23:08:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 23:08:31 +0000 (UTC) Subject: [commit: ghc] master: Fix minusNatural exception to be Underflow (18cdef3) Message-ID: <20170204230831.2C2DF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/18cdef385d432efc57bbda3818265e0fde41e701/ghc >--------------------------------------------------------------- commit 18cdef385d432efc57bbda3818265e0fde41e701 Author: Oleg Grenrus Date: Fri Feb 3 13:52:25 2017 +0200 Fix minusNatural exception to be Underflow >--------------------------------------------------------------- 18cdef385d432efc57bbda3818265e0fde41e701 libraries/base/GHC/Natural.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/base/GHC/Natural.hs b/libraries/base/GHC/Natural.hs index 9bca0a2..0e5abc7 100644 --- a/libraries/base/GHC/Natural.hs +++ b/libraries/base/GHC/Natural.hs @@ -399,8 +399,8 @@ minusNatural :: Natural -> Natural -> Natural minusNatural x (NatS# 0##) = x minusNatural (NatS# x) (NatS# y) = case subWordC# x y of (# l, 0# #) -> NatS# l - _ -> divZeroError -- underflowException -minusNatural (NatS# _) (NatJ# _) = divZeroError -- underflowException + _ -> underflowError +minusNatural (NatS# _) (NatJ# _) = underflowError minusNatural (NatJ# x) (NatS# y) = bigNatToNatural $ minusBigNatWord x y minusNatural (NatJ# x) (NatJ# y) From git at git.haskell.org Sat Feb 4 23:08:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 23:08:39 +0000 (UTC) Subject: [commit: ghc] master: Don't panic when printing match with RecUpd context (68cbe52) Message-ID: <20170204230839.564703A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/68cbe52fd3ae618a9778e79bf6a9806bab21aff2/ghc >--------------------------------------------------------------- commit 68cbe52fd3ae618a9778e79bf6a9806bab21aff2 Author: Matthew Pickering Date: Sat Feb 4 15:15:06 2017 -0500 Don't panic when printing match with RecUpd context Reviewers: bgamari, austin Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3065 GHC Trac Issues: #12957 >--------------------------------------------------------------- 68cbe52fd3ae618a9778e79bf6a9806bab21aff2 compiler/hsSyn/HsExpr.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/hsSyn/HsExpr.hs b/compiler/hsSyn/HsExpr.hs index 617972d..7500189 100644 --- a/compiler/hsSyn/HsExpr.hs +++ b/compiler/hsSyn/HsExpr.hs @@ -2403,7 +2403,8 @@ matchSeparator LambdaExpr = text "->" matchSeparator ProcExpr = text "->" matchSeparator PatBindRhs = text "=" matchSeparator (StmtCtxt _) = text "<-" -matchSeparator RecUpd = panic "unused" +matchSeparator RecUpd = text "=" -- This can be printed by the pattern + -- match checker trace matchSeparator ThPatSplice = panic "unused" matchSeparator ThPatQuote = panic "unused" matchSeparator PatSyn = panic "unused" From git at git.haskell.org Sat Feb 4 23:08:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 23:08:42 +0000 (UTC) Subject: [commit: ghc] master: Fix comment (old file names) in mk/ and utils/ (bd818a7) Message-ID: <20170204230842.183DB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/bd818a7ce0b872fc0b03375c65d55932ada1940d/ghc >--------------------------------------------------------------- commit bd818a7ce0b872fc0b03375c65d55932ada1940d Author: Takenobu Tani Date: Sat Feb 4 15:16:10 2017 -0500 Fix comment (old file names) in mk/ and utils/ There ware some old file names (.lhs, ...) at comments. * mk/config.mk.in - compiler/hsSyn/HsExpr.lhs -> HsExpr.hs * utils/ghc-pkg/Main.hs - compiler/main/Packages.lhs -> Packages.hs * utils/genapply/Main.hs - CgRetConv.lhs -> * REMOVE THIS COMMENT (OLDER FILE THAN GHC6) * - Constants.lhs -> Constants.hs - compiler/codeGen/CgCallConv.lhs -> compiler/codeGen/StgCmmLayout.hs - Apply.hc -> Apply.cmm - HeapStackCheck.hc -> HeapStackCheck.cmm Reviewers: mpickering, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3077 >--------------------------------------------------------------- bd818a7ce0b872fc0b03375c65d55932ada1940d mk/config.mk.in | 4 ++-- utils/genapply/Main.hs | 12 ++++++------ utils/ghc-pkg/Main.hs | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/mk/config.mk.in b/mk/config.mk.in index 35ff04c..b90aca3 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -71,9 +71,9 @@ GhcStage2HcOpts=-O2 GhcStage3HcOpts=-O2 # Disable -O2 optimization. Otherwise amount of generated C code -# makes things very slow to compile (~5 minutes on core-i7 for 'compiler/hsSyn/HsExpr.lhs') +# makes things very slow to compile (~5 minutes on core-i7 for 'compiler/hsSyn/HsExpr.hs') # and sometimes not compile at all (powerpc64 overflows something -# on 'compiler/hsSyn/HsExpr.lhs'). +# on 'compiler/hsSyn/HsExpr.hs'). ifeq "$(GhcUnregisterised)" "YES" GhcStage1HcOpts= GhcStage2HcOpts= diff --git a/utils/genapply/Main.hs b/utils/genapply/Main.hs index c5752fe..f9d6ea1 100644 --- a/utils/genapply/Main.hs +++ b/utils/genapply/Main.hs @@ -106,7 +106,6 @@ loadRegOffs = vcat . map (uncurry assign_stk_to_reg) saveRegOffs :: [(Reg,Int)] -> Doc saveRegOffs = vcat . map (uncurry assign_reg_to_stk) --- a bit like assignRegs in CgRetConv.lhs assignRegs :: RegStatus -- are we registerised? -> Int -- Sp of first arg @@ -332,7 +331,7 @@ genMkPAP regstatus macro jump live ticker disamb -- for a PAP, we have to arrange that the stack contains a -- return address in the event that stg_PAP_entry fails its - -- heap check. See stg_PAP_entry in Apply.hc for details. + -- heap check. See stg_PAP_entry in Apply.cmm for details. if is_pap then text "R2 = " <> mkApplyInfoName this_call_args <> semi @@ -524,7 +523,7 @@ enterFastPath regstatus no_load_regs args_in_regs args = enterFastPathHelper tag regstatus no_load_regs args_in_regs args enterFastPath _ _ _ _ = empty --- Copied from Constants.lhs & CgUtils.hs, i'd rather have this imported: +-- Copied from Constants.hs & CgUtils.hs, i'd rather have this imported: -- (arity,tag) tAG_BITS = (TAG_BITS :: Int) tAG_BITS_MAX = ((1 `shiftL` tAG_BITS) :: Int) @@ -903,7 +902,7 @@ genStackApply regstatus args = -- These code fragments are used to save registers on the stack at a heap -- check failure in the entry code for a function. We also have to save R1 -- and the return address (stg_gc_fun_info) on the stack. See stg_gc_fun_gen --- in HeapStackCheck.hc for more details. +-- in HeapStackCheck.cmm for more details. mkStackSaveEntryLabel :: [ArgRep] -> Doc mkStackSaveEntryLabel args = text "stg_stk_save_" <> text (concatMap showArg args) @@ -925,7 +924,8 @@ genStackSave regstatus args = ] std_frame_size = 3 -- the std bits of the frame. See StgRetFun in Closures.h, - -- and the comment on stg_fun_gc_gen in HeapStackCheck.hc. + -- and the comment on stg_fun_gc_gen + -- in HeapStackCheck.cmm. (reg_locs, leftovers, sp_offset) = assignRegs regstatus std_frame_size args -- number of words of arguments on the stack. @@ -994,7 +994,7 @@ applyTypes = [ -- -- NOTE: other places to change if you change stackApplyTypes: -- - includes/rts/storage/FunTypes.h --- - compiler/codeGen/CgCallConv.lhs: stdPattern +-- - compiler/codeGen/StgCmmLayout.hs: stdPattern stackApplyTypes = [ [], [N], diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs index 53f5f9d..1383f8f 100644 --- a/utils/ghc-pkg/Main.hs +++ b/utils/ghc-pkg/Main.hs @@ -806,7 +806,7 @@ mungePackageDBPaths top_dir db at PackageDB { packages = pkgs } = -- files and "package.conf.d" dirs) the pkgroot is the parent directory -- ${pkgroot}/package.conf or ${pkgroot}/package.conf.d/ --- TODO: This code is duplicated in compiler/main/Packages.lhs +-- TODO: This code is duplicated in compiler/main/Packages.hs mungePackagePaths :: FilePath -> FilePath -> InstalledPackageInfo -> InstalledPackageInfo -- Perform path/URL variable substitution as per the Cabal ${pkgroot} spec From git at git.haskell.org Sat Feb 4 23:08:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 23:08:36 +0000 (UTC) Subject: [commit: ghc] master: Improve wrapTicks performance with lots of redundant source notes (2912231) Message-ID: <20170204230836.8E9203A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/29122312cc7b8f9890eb53f92d76ecdd8ded24ee/ghc >--------------------------------------------------------------- commit 29122312cc7b8f9890eb53f92d76ecdd8ded24ee Author: Peter Wortmann Date: Sat Feb 4 15:14:31 2017 -0500 Improve wrapTicks performance with lots of redundant source notes The old version had O(n^3) performance for n non-overlapping source notes and let floats each, which is exactly what happens with -g if we compile a list literal of length n. The idea here is simply to establish early which source notes will actually survive (e.g. use a left fold). The new code should be O(n) for list literals. Reviewers: austin, dfeuer, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3037 GHC Trac Issues: #11095 >--------------------------------------------------------------- 29122312cc7b8f9890eb53f92d76ecdd8ded24ee compiler/coreSyn/CorePrep.hs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/compiler/coreSyn/CorePrep.hs b/compiler/coreSyn/CorePrep.hs index 74de5af..ab64449 100644 --- a/compiler/coreSyn/CorePrep.hs +++ b/compiler/coreSyn/CorePrep.hs @@ -1565,11 +1565,20 @@ newVar ty -- | Like wrapFloats, but only wraps tick floats wrapTicks :: Floats -> CoreExpr -> (Floats, CoreExpr) -wrapTicks (Floats flag floats0) expr = (Floats flag floats1, expr') - where (floats1, expr') = foldrOL go (nilOL, expr) floats0 - go (FloatTick t) (fs, e) = ASSERT(tickishPlace t == PlaceNonLam) - (mapOL (wrap t) fs, mkTick t e) - go other (fs, e) = (other `consOL` fs, e) +wrapTicks (Floats flag floats0) expr = + (Floats flag (toOL $ reverse floats1), foldr mkTick expr (reverse ticks1)) + where (floats1, ticks1) = foldlOL go ([], []) $ floats0 + -- Deeply nested constructors will produce long lists of + -- redundant source note floats here. We need to eliminate + -- those early, as relying on mkTick to spot it after the fact + -- can yield O(n^3) complexity [#11095] + go (floats, ticks) (FloatTick t) + = ASSERT(tickishPlace t == PlaceNonLam) + (floats, if any (flip tickishContains t) ticks + then ticks else t:ticks) + go (floats, ticks) f + = (foldr wrap f (reverse ticks):floats, ticks) + wrap t (FloatLet bind) = FloatLet (wrapBind t bind) wrap t (FloatCase b r ok) = FloatCase b (mkTick t r) ok wrap _ other = pprPanic "wrapTicks: unexpected float!" From git at git.haskell.org Sat Feb 4 23:09:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 23:09:31 +0000 (UTC) Subject: [commit: ghc] master: Expose cseExpr from CSE (54b9b06) Message-ID: <20170204230931.EAA483A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/54b9b064fc7960a4dbad387481bc3a6496cc397f/ghc >--------------------------------------------------------------- commit 54b9b064fc7960a4dbad387481bc3a6496cc397f Author: Joachim Breitner Date: Thu Feb 2 20:28:29 2017 -0500 Expose cseExpr from CSE for the benefit of GHC API users who want to CSE single expressions. Differential Revision: https://phabricator.haskell.org/D3069 >--------------------------------------------------------------- 54b9b064fc7960a4dbad387481bc3a6496cc397f compiler/simplCore/CSE.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/simplCore/CSE.hs b/compiler/simplCore/CSE.hs index 971b3e0..21dbd07 100644 --- a/compiler/simplCore/CSE.hs +++ b/compiler/simplCore/CSE.hs @@ -6,7 +6,7 @@ {-# LANGUAGE CPP #-} -module CSE (cseProgram) where +module CSE (cseProgram, cseOneExpr) where #include "HsVersions.h" @@ -373,6 +373,9 @@ tryForCSE toplevel env expr -- top of the replaced sub-expression. This is probably not too -- useful in practice, but upholds our semantics. +cseOneExpr :: CoreExpr -> CoreExpr +cseOneExpr = cseExpr emptyCSEnv + cseExpr :: CSEnv -> InExpr -> OutExpr cseExpr env (Type t) = Type (substTy (csEnvSubst env) t) cseExpr env (Coercion c) = Coercion (substCo (csEnvSubst env) c) From git at git.haskell.org Sat Feb 4 23:09:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 4 Feb 2017 23:09:34 +0000 (UTC) Subject: [commit: ghc] master: New internal dynamic flag: Very aggressive inlining (8212135) Message-ID: <20170204230934.B46283A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/82121357f5bf0fd04500187a097c3b614e1fcfd1/ghc >--------------------------------------------------------------- commit 82121357f5bf0fd04500187a097c3b614e1fcfd1 Author: Joachim Breitner Date: Thu Feb 2 20:28:07 2017 -0500 New internal dynamic flag: Very aggressive inlining This flag overrides the inliner heuristics to inline something independent of cost, size, expected gains or boringness of the context. It still adheres to arity, simplifier phase control and loop breakers. This is not exposed via a command line flag and added for the benefit of GHC API users. Differential Revision: https://phabricator.haskell.org/D3069 >--------------------------------------------------------------- 82121357f5bf0fd04500187a097c3b614e1fcfd1 compiler/coreSyn/CoreUnfold.hs | 9 ++++++++- compiler/main/DynFlags.hs | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/compiler/coreSyn/CoreUnfold.hs b/compiler/coreSyn/CoreUnfold.hs index 11c4a5e..eaed698 100644 --- a/compiler/coreSyn/CoreUnfold.hs +++ b/compiler/coreSyn/CoreUnfold.hs @@ -913,6 +913,11 @@ ufFunAppDiscount ufDearOp The size of a foreign call or not-dupable PrimOp +ufVeryAggressive + If True, the compiler ignores all the thresholds and inlines very + aggressively. It still adheres to arity, simplifier phase control and + loop breakers. + Note [Function applications] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1155,7 +1160,7 @@ tryUnfolding dflags id lone_variable UnfNever -> traceInline dflags str (text "UnfNever") Nothing UnfWhen { ug_arity = uf_arity, ug_unsat_ok = unsat_ok, ug_boring_ok = boring_ok } - | enough_args && (boring_ok || some_benefit) + | enough_args && (boring_ok || some_benefit || ufVeryAggressive dflags) -- See Note [INLINE for small functions (3)] -> traceInline dflags str (mk_doc some_benefit empty True) (Just unf_template) | otherwise @@ -1165,6 +1170,8 @@ tryUnfolding dflags id lone_variable enough_args = (n_val_args >= uf_arity) || (unsat_ok && n_val_args > 0) UnfIfGoodArgs { ug_args = arg_discounts, ug_res = res_discount, ug_size = size } + | ufVeryAggressive dflags + -> traceInline dflags str (mk_doc some_benefit extra_doc True) (Just unf_template) | is_wf && some_benefit && small_enough -> traceInline dflags str (mk_doc some_benefit extra_doc True) (Just unf_template) | otherwise diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index d7a5f1f..ef8ac96 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -868,6 +868,7 @@ data DynFlags = DynFlags { ufDictDiscount :: Int, ufKeenessFactor :: Float, ufDearOp :: Int, + ufVeryAggressive :: Bool, maxWorkerArgs :: Int, @@ -1638,6 +1639,7 @@ defaultDynFlags mySettings = ufDictDiscount = 30, ufKeenessFactor = 1.5, ufDearOp = 40, + ufVeryAggressive = False, maxWorkerArgs = 10, From git at git.haskell.org Sun Feb 5 04:25:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 5 Feb 2017 04:25:09 +0000 (UTC) Subject: [commit: ghc] wip/T10246: Ensure that Literals in an Int# case are in range (88950a1) Message-ID: <20170205042509.95E6A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T10246 Link : http://ghc.haskell.org/trac/ghc/changeset/88950a11b9df37a2cf37349ec75f7b9868b1ea1e/ghc >--------------------------------------------------------------- commit 88950a11b9df37a2cf37349ec75f7b9868b1ea1e Author: Joachim Breitner Date: Mon Apr 6 10:31:02 2015 +0200 Ensure that Literals in an Int# case are in range This is one way to fix #10246 and #13171. The chosen path involves adding the invariant that the argument of MachInt/MachWord etc. is always in the appropriate range, and that the smart constructors for them (mkMachInt etc.) wrap arguments that are outside the range in the expected way. Differential Revision: https://phabricator.haskell.org/D810 >--------------------------------------------------------------- 88950a11b9df37a2cf37349ec75f7b9868b1ea1e compiler/basicTypes/Literal.hs | 47 +++++++++++++++++++++----------- compiler/deSugar/Match.hs | 24 ++++++++-------- compiler/deSugar/MatchLit.hs | 32 +++++++++++----------- compiler/simplCore/SimplUtils.hs | 2 +- testsuite/tests/codeGen/should_run/all.T | 4 +-- 5 files changed, 62 insertions(+), 47 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 88950a11b9df37a2cf37349ec75f7b9868b1ea1e From git at git.haskell.org Sun Feb 5 04:25:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 5 Feb 2017 04:25:30 +0000 (UTC) Subject: [commit: ghc] wip/T10246's head updated: Ensure that Literals in an Int# case are in range (88950a1) Message-ID: <20170205042530.98F863A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/T10246' now includes: fef4948 User's guide: .a files can be 2-2.5x larger with -split-objs c81e070 Stop profiling output from running together (#8811) 22eecaf fix '&stg_interp_constr_entry' FFI type to be FunPtr 7209290 fix typo a7ab161 Replace hooks by callbacks in RtsConfig (#8785) 890461e Add +RTS -O to control the minimum old gen size 93f3a64 Add -n to the RTS help output f745b6e Typechecker: refactoring only 0622970 testdriver: delete unused ways b972de0 Suggest how to fix .ghci when it is group writeable (#8248) 9f0f99f Fix a long-standing bug in the demand analyser 547c597 Reduce module qualifiers in pretty-printing c897613 Error msg wibbles from reduced module prefixes 74d2c33 GHC.Prim.Constraint is not built-in syntax cfb6042 Do not quantify over the function itself in a RULE 6ca7b84 Put quotes round a Name in an error message 8b7ceec More aggressive Given/Wanted overlap check 553c518 Look inside synonyms for foralls when unifying 4f8e348 Replace endian test by 64-bit word access in T7600 ab76b09 rts/Linker.c: distinct between DATA and CODE labels when importing cf1d975 Don't repeat package key with -dppr-debug when package info is missing. f1a4e42 The production for `pquals` is incorrect; the specifics are in D803. cf19640 The production for squals is incorrect; see D806 for specifics. eacda92 Test Trac #10148 e6e0415 More error message wibbles a058ad6 Final error message wibble a7524ea Support for multiple signature files in scope. 9e7802f Commit missing T10148 files and ignore the built executable. 1d5c887 Axe one-shot sig-of 3c6448c Ignore temporary ./configure files. 53cc9af Test Trac #8030 6b96eeb Fixes a compiler error with -DDEBUG (#10265) f536d89 Import rand using capi 2d68aa6 Comments about AnyK d9b0be3 Comments in rejigConRes 702fc77 Comments only fa46c59 Make the evidence in a CtGiven into an EvId 9d16808 Typos in error messages and in comments 485dba8 configure : LLVM and LD detections improvements (#10234). edc059a Fix autoconf's check for create_timer() a5745d2 Derive Generic instance for System.Exit.ExitCode c327393 Derive Generic instance for Data.Version.Version 6109b31 use projectVersion from DynFlags rather than cProjectVersion for versionedAppDir 8aefc9b parser: opt_kind_sig has incorrect SrcSpan 9eab6fe parser: API Annotations : guardquals1 does not annotate commas properly 919b511 parser : the API annotation on opt_sig is being discarded d261d4c Zap usage info in CSE (Trac #10218) 25f2d68 Comments only a2ce3af Comments and white space only 7febc2b Add "error:" prefix to error-messages 79bfe27 Remove LlvmCodeGen panic variants. 8dc2944 API Annotations : ExprWithTySig processing discards annotated spans 5fded20 ApiAnnotations : lexer discards comment close in nested comment 6dd2765 Implement -f[no-]print-unicode-syntax flag for unicode syntax output (#8959) 7b042d5 Do not allow Typeable on constraints (Trac #9858) 49d9b00 Fix fundep coverage-condition check for poly-kinds a9ca67f Improve Call Arity performance 9654a7c Call Arity: Trade precision for performance in large mutually recursive groups 1fb4dd3 Add exception for `KnownNat` and `KnownSymbol` in super classes. d8d541d Fixes (hopefully!) T9858 e68e8ca Fix test output. ea579d9 Fix test output 3b90d8c Rename tests so that they have a unique name. 51af102 Better hints when RTS options not available (Trac #9579) 2483644 Documentation for rnImports/rnImportDecl. 2b3766b Comments only. ad6d6a7 Stub out pkgState with non-error, helps with debugging. 619a324 Make T9579 parallel-safe and add build outputs to .gitignore 88b8406 Test case for indirect dependencies in ghci linker (#10322) 4bc925a Update Cabal submodule to 1.22.3.0 release d5773a4 Teach DmdAnal that coercions are value arguments! 3bec1ac Teach DmdAnal about free coercion variables d12c7cb Spelling in comment f2d1b7f Support unboxing for GADT product types 5c7e4db Wibble to DmdAnal b9f20bd GADTs now are CPR-able 1e8c9b8 Enable SMP and GHCi support for Aarch64 0bbc2ac Use the gold linker for aarch64/linux (#9673) 3b932cc Add a blank line 9b9fc4c Fix the boot dfun impedence-matching binding c0b5adb Do not decompose => (Trac #9858) 1bb1ff2 Mark T8743 as passing 1bd1cef Don't use self {-# SOURCE #-} import in test-cases. a2f9fef Fix #10182 by disallowing/avoiding self {-# SOURCE #-} imports 646866f Fix superclass generation in an instance 9d3bd3d Comments only c715166 Improve error reporting for impredicative types 746f086 Better documetation of higher rank types 932f086 Test Trac #9858 comment:101 43d7137 Rename new T9858c to T9858d to avoid test name clash a55bfab Rename new T9858d to T9858e to avoid test name clash 524ddbd Make sure GHC.List.last is memory-efficient 6ab5da9 Rename role annotations w.r.t only local decls. a8d39a7 Fix #10285 by refusing to use NthCo on a newtype. 414e20b Fix the formal operational semantics (#10121) d4cf559 Test #10321 in ghci/scripts/T10321 dc587fe Test case for #10141 72a9272 Change default roles in hs-boot files. (#9204) bbabb71 Updates to Backpack documentation based on recent visit to MSRC. c4e8097 Bump base version to 4.8.2.0 75adc35 Add missing since-annotations for c024af131b9e2538 9a0c179 base: Export GHC.Event(.Internal).Lifetime 5f127fc Flesh out some more Backpack examples in the merging section. d0898ca Backpack docs: explain alternate merging scheme. 541aa7f Full type checking Backpack details. 21a37ca Backpack docs: merge backpack-shaping into algorithm, sigs no longer provide b61562f Seed SpecConstr from local calls 168c883 A little outright bug in canEqTyVar2 d9bb0ee Don't print evidence in TcFlatten a1275a7 Improve improvement in the constraint solver d4a926b Test Trac #10226 54cefbd Typeset Backpack syntax in a figure b83160d Tidy up treatment of FlexibleContexts a3f7517 Typo fixes (mostly in comments) fe5ccbb Typeset Backpack semantic entities in figure, figure-ify all asides. bbfa0ca Comments only f6ab0f2 Refactor TyCon to eliminate TupleTyCon 0d715db Update haddock submodule to track TyCon change b626cb0 Make Derived NomEq rewrite only Derived NomEq de5d022 Kill off the default types in ghc-prim 2f6a0ac Move IP, Symbol, Nat to ghc-prim 4efa421 Permit empty closed type families 63a10bb arm: Force non-executable stack (#10369) f7dfcef Fix safeHaskell test for llvm backend bf4f3e6 Give a hint when a TH splice has a bad package key, partially fixes #10279 cdba973 Documentation for Language.Haskell.TH.Quote. 1a4374c arm: Force non-executable stack (part 2) 341a766 Doc: checkCrossStageLifting, RnSplice/TcExpr is untyped/typed brackets (#10384) f7daf5a Normalise type families in the type of an expression 458a97b Fix typo: identifer -> identifier 03c4893 Retain ic_monad and ic_int_print from external packages after load 477f514 rts: add "-no-rtsopts-suggestions" option fa0474d base: Fix confusing docs typo fb54b2c API Annotations : add Locations in hsSyn were layout occurs caeae1a Correct parsing of lifted empty list constructor 15aafc7 ApiAnnotations : quoted type variables missing leading quote 81030ed ApiAnnotations : Nested forall loses forall annotation f34c072 Revert "ApiAnnotations : Nested forall loses forall annotation" 97d320f Revert "API Annotations : add Locations in hsSyn were layout occurs" d1295da Comments only 931d014 A bit of refactoring RnSplice c3e6b3a Regression test for Trac #10390 5bde9f7 ApiAnnotations : RdrHsSyn.isFunLhs discards parentheses cc9b788 Backpack docs: meditate on AvailTC with four examples. 225df19 ApiAnnotations : AnnComma missing in TupleSection 7136126 ApiAnnotations: misplaced AnnComma for squals production 2601a43 Backpack docs: AvailInfo plan, and why selectors are hard. 28257ca Support stage 1 Template Haskell (non-quasi) quotes, fixes #10382. 21c72e7 Split off quotes/ from th/ for tests that can be done on stage1 compiler. eb0ed40 RnSplice's staging test should be applied for quotes in stage1. 9a43b2c Always do polymorphic typed quote check, c.f. #10384 3c70ae0 Quick fix: drop base bound on template-haskell. 5c459ee Revert stage 1 template-haskell. This is a combination of 5 commits. 811b72a Api Annotations: RdrHsSyn.mkAtDefault causes annotations to be disconnected. e4032b1 ApiAnnotations : mkGadtDecl discards annotations for HsFunTy 27aa733 IdInfo comment update 2666ba3 haddock: update submodule to fix #10206 cf7573b More accurate allocation stats for :set +s 9736c04 compiler: make sure we reject -O + HscInterpreted 24707d7 ApiAnnotations : BooleanFormula construction discards original f35d621 Fix build breakage from 9736c042 fe38195 ApiAnnotations : pquals production adds AnnVbar in the wrong place ecc3d6b ApiAnnotations : PatBind gives wrong SrcSpan for the pattern. f16ddce Support stage 1 Template Haskell (non-quasi) quotes, fixes #10382. b0784cc Backpack docs: more carefully describe unification versus unioning. b4f6c16 Ignore out and toc files. 53409a7 Backpack docs: proper discourse on ModIface and ModDetails. eecef17 Fix safe haskell bug: instances in safe-inferred 4fffbc3 New handling of overlapping inst in Safe Haskell ef7ed16 Make template-haskell build with GHC 7.6, fixes bootstrap build. c119a80 Use fmap instead of <$> (Fixes #10407) ca7c855 We need an empty boolFormula.stderr f5188f3 Fix weird behavior of -ignore-dot-ghci and -ghci-scipt 6ee4b6f Turn off warnings when compiling boolFormula 1b47692 Backpack docs: Consistently italicize metavariables. 4432863 Update some tests for recent Safe Haskell change. a171cc1 Update Safe Haskell documentation. 4b8b4ce Fix fragile T9579 tests 8764a7e Revert D727 8da785d Delete commented-out line 130e93a Refactor tuple constraints 5910a1b Change in capitalisation of error msg a154944 Two wibbles to fix the build a8493e0 Fix imports in HscMain (stage2) 6e1174d Separate transCloVarSet from fixVarSet 51cbad1 Update haddock submodule ca173aa Add a case to checkValidTyCon eb6ca85 Make the "matchable-given" check happen first c0aae6f Test Trac #10248 a9ccd37 Test Trac #10403 04a484e Test Trac #10359 3cf8ecd Revert multiple commits 3ef7fce Do not check dir perms when .ghci doesn't exist 5972037 Backpack docs: Rewrite type checking section to have a more concrete plan. ab45de1 Failing test for #10420 using plugins. c256357 Speed up elimCommonBlocks by grouping blocks also by outgoing labels 8e4dc8f Greatly speed up nativeCodeGen/seqBlocks 73f836f CmmCommonBlockElim: Improve hash function 3f42de5 Test Trac #10359 f1f265d Test Trac #10403 fa0bdd3 Test Trac #10248 76024fd Delete commented-out line ffc2150 Refactor tuple constraints 228ddb9 Make the "matchable-given" check happen first eaaa38b includes/stg/SMP.h: implement simple load_/store_load_barrier on armv6 and older 85bf9e4 Add regression test for #10110. 5cbac88 user guide: correct documentation for -Wall (fixes #10386) 578d2ba Remove unneeded compatibility with LLVM < 3.6 b03f074 ghci: Allow :back and :forward to take counts b0b11ad In ghci linker, link against all previous temp sos (#10322) b199536 compiler: make sure we reject -O + HscInterpreted 470a949 Revert "In ghci linker, link against all previous temp sos (#10322)" 753b156 Add a TODO FIXME w.r.t. D894 fc8c5e7 Test Trac #8799, #8555 edb8dc5 Revert "compiler: make sure we reject -O + HscInterpreted" (again) 25d1a71 Fix error messages from open(Binary)TempFileWithDefaultPermissions c934914 Backpack docs: Clarifications from today's Skype call. 9f968e9 Fix binary instance for IfaceLitTy c553e98 ApiAnnotations : AST version of nested forall loses forall annotation 0df14b5 ApiAnnotations : parens around a context with wildcard loses annotations c488da8 ApiAnnotatons : AnnDcolon in wrong place for PatBind 369dd0c White space layout only eae703a Reduce magic for seqId c89bd68 Fix quadratic behaviour in tidyOccName 45d9a15 Fix a huge space leak in the mighty Simplifier 7d519da testsuite: commit missing T4945 stdout 4d6c0ee compiler: kill a stray pprTrace in OccName 6694ccf testsuite: handle missing stats files gracefully (#10305) c00f051 Update .mailmap c04571d rts: Fix typo in comment 326989e Add missing name for FFI import (fixes #9950) 70f1ca4 Fix ghci-way tests of -XStaticPointers. 71d1f01 Omit the static form error for variables not in scope. 388448b Build system: don't install haddock .t files (#10410) c591147 ApiAnnotations tweaks ef90466 Testdriver: don't use os.popen in config/ghc ce166a3 Testdriver: do not interfer with MinGW path magic (#10449) 640fe14 Remove unnecessary loadInterface for TH quoted name. e28462d base: fix #10298 & #7695 b0d8ba3 Add liftData function. a138fa1 Testsuite: accept new output for T2507 and T8959a 5ead7d1 Build system: make more targets PHONY 4c7d177 Build system: remove toplevel target `fast` a065a3a Build system: use `mkdir -p` instead of `-mkdir` 51aacde Build system: allow missing config.mk for target clean_% 4de8028 Build system: check $CLEANING instead of $MAKECMDGOALS 47e00ec Build system: don't set CLEANING=NO b0885e4 Build system: whitespace and comments only cd0e2f5 Build system: prevent "--version: Command not found" 0bfd05e Build system: prevent "./Setup: Command not found" a49070e Build system: time's config files have moved 48ed2f1 Build system: always allow me to clean haddock 577d315 Build system: always use `make -r` 0d20d76 Build system: make clean in utils/ghc-pkg should not delete inplace/lib/bin 0a159e3 Build system: don't use supposedly local variable inside macro 018fec0 Build system: also clean the inplace wrapper 508a3a3 Build system: don't build runghc if GhcWithInterpreter=NO (#10261) 7db2dec linker_unload working on Windows, fixes #8292. 5a65da4 Don't run T9330fail on Windows, no clobber occurs. #9930 94fff17 Travis: use validate --quiet to prevent hitting log file limits 4756438 Catch canonicalizePath exceptions, fix #10101 a52f144 In ghci linker, link against all previous temp sos (#10322) f5b43ce compiler/specialise: shut match_co up a bit f6ca695 rts: Fix aarch64 implementation of xchg e00910b ApiAnnotations : rationalise tests 7dd0ea7 Update binary submodule to 0.7.5.0 release e6191d1 ApiAnnotations : strings in warnings do not return SourceText e8a7254 Add constraint creation functions to TcPluginM API 1c38325 Fix dropped event registrations 928f536 Use seq rather than (==) to force the size 5eee6a1 Move seqExpr, seqIdInfo etc to CoreUtils 20d8621 Add some missing seqs to Coercion.seqCo d245787 Use named fields in SimplCont.Select constructor 403cfc9 Comments only 931268a Replace tabs with spaces. 98b0b2e Add information about allowed foreign prim args, see #10460. e5be846 Typofix: missing period. (#10460) a27fb46 Add (failing) test case for #7672. f82e866 Newline after type of allocate(). dfdc50d Don't call DEAD_WEAK finalizer again on shutdown (#7170) 34dcf8a Re-center perf numbers for T5631 2f0011a White space only 11d8f84 Treat pattern-synonym binders more consistently 9b73cb1 Refactor the GlobalRdrEnv, fixing #7672 90fde52 Mark sigof02 tests as expect_broken 1189196 Re-do superclass solving (again); fixes #10423 b095c97 Improve constraint tuples (Trac #10451) dbcdfe2 Set 32-bit perf figure d6c01fa Remove redundant import b1b2b44 Test Trac #10423 8a38348 Test Trac #10451 8e5f8cf Test Trac #10466 b2b69b2 Test Trac #10438 091944e compiler: make sure we reject -O + HscInterpreted e796026 build: make haddock a bit less chatty 3758050 Improve FFI error reporting 5688053 Detabify a programlisting in the User's Guide (#10425) 942a074 testsuite: mark test T9938 (#9938) as passing again 7a82b77 newTempName: Do not include pid in basename 2c4c627 Typofixes 6adfb88 Suggest -H to improve GC productivity, fixes #10474. 7b6800c Remove outdated uBackpack docs. 7ea156a Refactor RdrName.Provenance, to fix #7672 cd9c5c6 Allow Any return in foreign prim, fixes #10460. 08558a3 Move liftData and use it as a default definition for Lift. 942cfa4 typo: 'Ture' / 'True' 21d7c85 Travis: Send notifications to author and commiter c69b69d ghc-pkg support query by package-key, fixes #9507 d8f66f1 Re-center perf numbers for haddock.compiler 75c6e06 Build: make configure and ghc-pkg a bit less chatty 14652b5 ghc-cabal: don't warn about missing cabal fields 092082e Build: ./boot && ./configure && make sdist (#8723) cac68d0 Build: remove unnecessary CLEANING/=YES check 5dd0286 Build: remove more unnecessary CLEANING/=YES checks d0063e8 Make validate more quiet e340f6e Testsuite: add/fix cleanup for certain tests 07feab1 Testsuite: ignore `stdcall attribute ignored` (#1288) 0686d76 Testsuite: don't show compile/link info for some tests 7beb477 Travis: allow user forks 761fb7c Fix #10488 by unwrapping type synonyms. 53c1374 Minor code cleanup 61b96a8 Fix #10489 dcaaa98 docs: Fix #10416 ae83a81 Testsuite: only show output diff when test is expected to pass 328c212 Fix the sdist build 89223ce Fix the build when SplitObjs=YES 19ec6a8 Fix for CAF retention when dynamically loading & unloading code 7944a68 Revert "docs: Fix #10416" 058af6c Refactor wild card renaming a48167e build: Clean testsuite before sdist 3b55659 Always force the exception in enqueued commands bb99671 Revert "The test runner now also works under the msys-native Python." 43ebe24 Testsuite: delete expect_fail setups for hugs 3445947 Testsuite: delete expect_fail setups for ghc < 7.1 4a0b7a1 Build: run autoreconf jobs in parallel 5828457 make sdist: distclean testsuite for real (#10406) ca39b96 docs: Fix #10416 ddbb97d Another major improvement of "improvement" c0dc79f IndTypesPerfMerge no longer seems to requre -M20M a66ef35 Fix DWARF generation for MinGW (#10468) c1dc421 Update submodule process to master da84fd5 Testsuite Windows: fix T8172 (#8172) a765f72 Testsuite: mark tests as expect_broken on win64 506522c Testsuite: mark T4945 as expect_broken (#4945) 6cefeb3 Testsuite: mention the existence of ticket #10510 5e66a69 Testsuite: change some expect_fail tests to expect_broken a4318c6 Travis: use apt-get -q 0db0ac4 Removes all occurrences of __MINGW32__ (#10485) 23582b0 Add failing test for #9562. 28e04de Remove redundant tcg_visible_orphan_mods, it is recorded in imp_orphs. bac927b Revert "Support for multiple signature files in scope." c60704f Revert "Change loadSrcInterface to return a list of ModIface" ce53138 Delete _MSC_VER when not necessary, fix #10511 016bbfd docs: Fix unicode alternatives table (fixes #10509). 0ef7174 Squash typos in comments c14bd01 Testsuite: fix the little known CHECK_FILES_WRITTEN=1 d20031d Add parseExpr and compileParsedExpr and use them in GHC API and GHCi 892c3e9 Do not copy stack after stack overflow, refix #8435 dd5cac7 Fix typo in `traceShowM` haddock comment (#10392) 0a086c8 Docs: it's `gv --orientation=seascape` nowadays (#10497) b07dccc Docs: `-XTypeOperators` (#10175) e02a4f2 Add versioning section to Backpack docs. 5ddd904 Testsuite: diff non-whitespace normalised output (#10152) 6e542a6 Testsuite: add function compile_timeout_multiplier (#10345) a508455 UNREG: fix pprHexVal to emit zeros (#10518) 1cf7fc0 add type annotations to SrcLoc functions dd3080f Increase constraint tuple limit to 62 (Trac #10451) a607011 Test Trac #10348 77e5ec8 Demonstrate that inferring Typeable for type literals works efa136f Remove derived CFunEqCans after solving givens a3f6239 GHCi: fix scoping for record selectors a6cbf41 Spelling in comments 855f56b Improved peak_megabytes_allocated 2613271 Testsuite: fix framework failure 89c7168 Fix #10534 df63736 ghc.mk: Update instances of -auto-all 1ff7f09 Lexer: Suggest adding 'let' on unexpected '=' token 0d6c97b Lexer: Suggest adding 'let' on unexpected '=' token a90712b users_guide: Various spelling fixes d46fdf2 users_guide: Various spelling fixes 681973c Encode alignment in MO_Memcpy and friends a0d158f Encode alignment in MO_Memcpy and friends c772f57 Fix #10494 0de0b14 Fix #10495. ace8d4f Fix #10493. 6644039 Test case for #10428. ff82387 Decompose wanted repr. eqs. when no matchable givens. 93f97be (mostly) Comments only f108003 Testsuite wibble around decomposing newtypes. 7eceffb Refactor handling of decomposition. 9b105c6 Reimplement Unify.typesCantMatch in terms of apartness. 298c424 Treat funTyCon like any other TyCon in can_eq_nc. a6b8b9c Fix typo in comment daf1eee Clarify some comments around injectivity. 65d4b89 Add `Monoid` instance for `IO` f063656 Fix ghc-pkg reports cache out date (#10205) 0760b84 Update foreign export docs, fixes #10467 b98ca17 Make enum01/enum02/enum03 tests clang-compatible 023a0ba Care with impossible-cons in combineIdenticalAlts 5879d5a Report arity errors correctly despite kinds f4370c6 Comments only 4a7a6c3 Rename getCtLoc, setCtLoc 02bac02 Remove some horrible munging of origins for Coercible 760b079 A bit more tracing 0899911 Comments plus tiny refactoring ee64369 Refactor filterAlts into two parts 5d98b68 Trac #4945 is working again 72b21c3 Parser: commas_tup_tail duplicate SrcSpan on "Missing" value ba7c8e5 Test Trac #10503 c45f8ce Elaborate test for Trac #10403 40698fe Spelling in comments e283cec testsuite: mark T4945 as expect_broken 440d1bc docs: Unbreak the PS/PDF builds for the User's Guide (#10509) 7d5a845 should_run/allocLimit4: disable ghci way e491803 Amend tcrun024, tcrun025 after Trac #7854 fix 7c2293a Amend tcrun037 after Trac #7854 fix 2c6a041 Fix a couple of tests for GHCi/-O* (Trac #10052) 5cc08eb Recognise 'hardhloat' as a valid vendor in a host tuple f2ffdc6 Updated output for test ghci024 85d5397 Make GHC install libraries to e.g. xhtml-3000.2.1-0ACfOp3hebWD9jGWE4v4Gh. 0cb1f5c Filter orphan rules based on imports, fixes #10294 and #10420. 29bc13a Fix all.T for T8131/T8131b. 15ef5fc Remove duplicate test. 13ba87f Build system: unset HADDOCK when haddock is not found 4854fce Change `Typeable` instance for type-lis to use the Known* classes. 38f3745 Add parsePattern parser entry point b5a2e87 Documentation: add section on .haskeline file (#2531) e60dbf3 Check KnownSymbol => Typeable deduction f70fb68 Use -package-id to specify libraries on command line. 6c5a66a Fix #10551 by using LIB_NAMES. 01f7e44 Rename $1_$2_$3_LIB_NAME to LIB_FILE. 55843f1 Further elaborate Trac #10403 test c084796 powerpc: add basic support for PLT relocations (#10402) 73a6265 Make $1 in $1_$2_$3_FOO actually be directory. 95d5031 Build system: delete unused variables in config.mk.in ece2c43 Drop prefix from package keys. aa26731 Clean outdated ext-core references in comments. 4d1316a driver: pass '-fPIC' option to all CC invocations 9a34864 Improve kind-checking for 'deriving' clauses c7b6fb5 Test Trac #10562 a2f828a Be aware of overlapping global STG registers in CmmSink (#10521) a7eee0d Comments only 3edc186 White space only 9195927 Improve pretty-printing for CoPat ff8a671 Use a Representaional coercion for data families 0b7e538 Allow recursive unwrapping of data families cc0dba1 Minor fix to free-vars in RnTypes 9014a7e Fix addDataConStrictness b69dc73 Don't float out alpha[sig] ~ Int 97e313c Add module header to test 2f16a3b Get rid of irrlevant result type signature 95fc6d5 Get rid of irrelevant impredicative polymoprhism fb7b692 Treat out-of-scope variables as holes b98ff25 Error message wibbles from out-of-scope changes 0aaea5b Tiny refactor plus comments be0ce87 Fix for crash in setnumcapabilities001 111ba4b Fix deadlock (#10545) 7c8ffd3 GHCi docs: layout rule is respected inside :{ :} cbd9278 Comments only caf9d42 Small doc fixes 0696fc6 Improve CPR behavior for strict constructors 7c07cf1 closeOverKinds *before* oclose in coverage check 614ba3c Kill off sizePred 8e34783 Make fvType ignore kinds a64a26f Better tracing and tiny refactoring ceb3c84 Improve error message for Typeable k (T k) 0e1e798 Test Trac #10524 8d221bb Test #10582 89834d6 Add -fcross-module-specialise flag 302d937 Add -fcross-module-specialise flag bb0e462 Mask to avoid uncaught ^C exceptions 9b5df2a Update performance numbers due to #10482 c6bb2fc Correct BangPat SrcSpan calculation c495c67 Build system: remove unused variable CHECK_PACKAGES 897a46c Testsuite: accept T2592.stderr (minor changes) 6b9fc65 Testsuite: put extra_run_opts last on command line daa5097 Build system: prevent "warning: overriding commands for target..." bbf6078 disable check for .init_array section on OpenBSD 9aa0e4b ghc-pkg: use read/writeUTF8File from Cabal bdd0b71 bin-package-db: copy paste writeFileAtomic from Cabal bdf7f13 Build system: rename bindist to bindist-list... d3c1dda Implement PowerPC 64-bit native code backend for Linux b5e1944 Use `+RTS -G1` for more stable residency measurements (#9675) 1d6ead7 Enable using qualified field of constructor in GHCi f856383 Fix Trac #10519 f07b7a8 Remove unnecessary OrdList from decl parser. 6400c76 users_guide: Describe order-dependence of -f and -O flags e4bf4bf Remove redundant parser entry point 8b55788 Add "since" column for LANGUAGE extensions in user guide 39d83f2 Generalize traceM, traceShowM (fixes #10023) 6b01d3c parser: Allow Lm (MODIFIER LETTER) category in identifiers 889c81c Fix some validation errors. 69beef5 Replace usages of `-w` by `-fno-warn`s b1d1c65 Support MO_{Add,Sub}IntC and MO_Add2 in the LLVM backend 124f399 Testsuite: add -ignore-dot-ghci to some tests ced27de Remove dead code / overlapping pattern (#9723) a4b0342 Lexer: remove -fno-warn-unused-do-bind aa778c8 Comments only [skip ci] c875b08 Use -fno-warn-unused-imports instead of hiding `ord` 8e12a21 Lexer.x and Parser.y: delete dead code 5d48e67 Easy way to defer type errors (implements #8353) 3fabb71 Fix typo [skip ci] (#10605) 75de613 rts: fix incorrect checking start for -x arguments (#9839) edb2c54 Remove Hugs specific test setups (omit_compiler_type) 7a3d85e Remove all *.stderr/stdout-hugs files 4681f55 Specialise: Avoid unnecessary recomputation of free variable information 2765fcf Remove warnings for -fwarn-incomplete-patterns a07898e Spelling in comments 9180df1 Fix offset calculation in __stg_gc_fun aaa0cd2 Don't eagerly blackhole single-entry thunks (#10414) d27e7fd Add more discussion of black-holing logic for #10414 d59cf4e Fix "CPP directive" in comment db530f1 Add Note [Warnings in code generated by Alex] 37de4ad Build system: don't set GhcLibWays explicitly in build.mk.sample (#10536) 62fcf05 Fix word repetitions in comments ebfc2fb Update comments around blackholes f753cf1 Allow deferred type error warnings to be suppressed 31580e2 Fix todo in compiler/nativeGen: Rename Size to Format 9a3e165 Deferred type errors now throw TypeError (#10284) 5857e0a fix EBADF unqueueing in select backend (Trac #10590) 6d69c3a Generalize `Control.Monad.forever` d03bcfa always use -fPIC on OpenBSD/AMD64 platform 00c8d4d Fix #10596 by looking up 'Int' not 'Maybe Int' in the map. 1967a52 Export more types from GHC.RTS.Flags (#9970) 8800a73 Backpack: Flesh out more Cabal details d71b65f holePackageKey and isHoleModule utility functions. 3d5f8e7 Unbreak Windows build: delete unusud throwIOIO 6f9efcb Delete duplicate "Note [Unpack equality predicates]" f3bfa3b Broaden Outputable instance for Termination 85b14a7 Comments only 4f9d600 Fix Trac #10618 (out of scope operator) b29633f Bitmap: Fix thunk explosion 889824d Document RULES and class methods c58dc1a White space only b5aabfb Infer types with flexible contexts 7dcf86f users_guide: Fix errant "a" in RULES/class methods docs a6359f2 Add testcase for #10602 6f1c076 Make mkQualPackage more robust when package key is bad. 0a3c43f Comments only 9e86bf1 Better type wildcard errors 888026d Update .mailmap [skip ci] 2d06a9f Improve error message for fundeps 9b1ebba Delete the WayPar way d69dfba Fix self-contained handling of ASCII encoding ee28a79 T1969: Update max_bytes_used a846088 T876 (32-bit): Update bytes allocated de6597e perf/compiler: Switch to -G1 and update performance metrics b935497 T9872d: Update 32-bit allocations d073c77 Do not optimise RULE lhs in substRule e922847 Add Linting for Rules 7da7b0e Make sure rule LHSs are simplified 875723b Reformat a leading # in a comment d7335f7 Test Trac #10463 02a6b29 Test Trac #10634 946c8b1 Another comment with a leading # (sigh) 2e52057 Build system: comments only [skip ci] ec197d3 Build system: add `make show!` command (#7810) f70f1b6 Build system: delete two unused files 47ebe26 Build system: delete REGULAR_INSTALL_DYNLIBS and INSTALL_DYNLIBS 392ff06 Build system: do not build stm and parallel by default 5764ade Testsuite: delete unused with_namebase 322ae32 Testsuite: delete remaining only_compiler_types(['ghc']) setups 783b79b traivs: Use the new container based travis setup 4dc3877 Testsuite: rename *.stderr-ghc to *.stderr ab5257b Testsuite: delete *.stderr-ghc-7.0 *.stdout-ghc-7.0 4ee658a0 Mark test case for #10294 expect_broken on #10301 0a40278 Flush stdout in test case for #10596 8e6a503 Mark test case for #10294 conditionally expect_broken on #10301 b1063b1 Testsuite: mark T10294 conditionally expect_broken on #10301 348f5ca Build system: delete fingerprint.py [skip ci] a592e9f Remove all references to sync-all 75fd5dc Don't get a new nursery if we exceeded large_alloc_lim 9f978b6 Fix #10642. 74a00bc initGroup: only initialize the first and last blocks of a group 504c2ae Docs: `sortOn = sortBy (comparing f)` [skip ci] 02897c5 Failing test case: idArity invariant check, #10181 e29c2ac CoreUtils: Move seq* functions to CoreSeq ae0e340 CoreUtils: Move size utilities to CoreStats fa33f45 PprCore: Add size annotations for top-level bindings 29f8225 CoreLint: Use size-annotated ppr variant 82f1c78 Fix tests ae96c75 Implement -fprint-expanded-synonyms 415351a Put Opt_Static into defaultFlags if not pc_DYNAMIC_BY_DEFAULT (#7478) 2c5c297 DeriveFoldable for data types with existential constraints (#10447) 2c9de9c Handle Char#, Addr# in TH quasiquoter (fixes #10620) a5e9da8 Fix off-by-one error in GHCi line reporting (Trac #10578) 3448f98 Reduce non-determinism in ABI hashes with RULES and instance decls bc604bd Update assert to fix retc001 and retc002 (#9243) 0d4b074 Travis: actually do debug builds ac0feec Testsuite: small test cleanups f607393 Testsuite: accept new stderr for T9497{a,b,c}-run (#10224) a0371c0 Build system: fail when encountering an unknown package tag dc6e556 Testsuite: mark T2497 expect_broken_for(#10657, ['optasm', 'optllvm']) dcaa486 Testsuite: mark T7919 expect_broken_for(#7919, ['optasm','dyn','optllvm']) 11f8612 Testsuite: mark 3 tests expect_broken_for(#10181, ['optasm', 'optllvm']) 16a8739 Testsuite: mark qq007 and qq008 expect_broken(#10181) cbb4d78 Testsuite: mark qq007 and qq008 expect_broken(#10047) 43dafc9 Testsuite: mark gadt/termination expect_broken_for(#10658, ['optasm','optllvm']) 34bb460 Testsuite: mark array001 and conc034 expect_broken_for(#10659, ['optasm',...]) 9834fea Add regression test for unused implicit parameter warning (#10632) 4c96e7c Testsuite: add ImpredicativeTypes to T7861 (#7861) 7f37274 Testsuite: add -XUndecidableInstances to T3500a 029367e Testsuite: add regression test for missing class constraint 82ffc80 LlvmCodeGen: add support for MO_U_Mul2 CallishMachOp 49373ff Support wild cards in TH splices c526e09 primops: Add haddocks to BCO primops 4cd008b Do not treat prim and javascript imports as C imports in TH and QQ 96de809 Fix primops documentation syntax d71d9a9 Testsuite: fix concprog002 (AMP) 2f18b197 Testsuite: mark concprog002 expect_broken_for(#10661, ['threaded2_hT']) d0cf8f1 Testsuite: simplify T8089 (#8089) b4ef8b8 Update submodule hpc with fix for #10529 0c6c015 Revert "Revert "Change loadSrcInterface to return a list of ModIface"" 214596d Revert "Revert "Support for multiple signature files in scope."" 9ade087 primops: Fix spelling mistake e0a3c44 Delete __GLASGOW_HASKELL__ ifdefs for stage0 < 7.8 8f48fdc Use varToCoreExpr in mkWWcpr_help 3fbf496 Comments only (superclasses and improvement) 3509191 Refactor newSCWorkFromFlavoured 7c0fff4 Improve strictness analysis for exceptions cd48797 Comments and white space only 3c44a46 Refactor self-boot info efa7b3a Add NOINLINE for hs-boot functions aa78cd6 Documents -dsuppress-unfoldings 0df2348 Comments and layout only a0e8bb7 Implement -dsuppress-unfoldings b5c1400 Comments and white space only f1d0480 Avoid out-of-scope top-level Ids 7a6ed66 Comments only 55754ea Fix test T2497 to avoid infinite loop in RULES feaa095 Do occurrence analysis on result of BuiltInRule 00f3187 Make seq-of-cast rule generate a case 35eb736 T4945 is working again f519cb5 testsuite: Show killed command line on timeout 97a50d5 configure: Bump minimum bootstrap GHC version to 7.8 dbe6dac When iconv is unavailable, use an ASCII encoding to encode ASCII 18c6ee2 Travis: use ghc-7.8.4 as stage0 to fix the build d941a89 Validate: by default do show commands a7e0326 Validate: document --quiet [skip ci] 1224bb5 Add utility function isHoleName. 50b9a7a Revert "Trac #4945 is working again" 1b76997 Testsuite: recenter haddock.base allocation numbers b949c96 Eliminate zero_static_objects_list() 0d1a8d0 Two step allocator for 64-bit systems e3df1b1 Validate: explain THREADS instead of CPUS in --help cf57f8f Travis: do pass `--quiet` to validate 0b12aca Switch from recording IsBootInterface to recording full HscSource. adea827 Add ExceptionMonad instance for IOEnv. 144096e Give more informative panic for checkFamInstConsistency. 4a9b40d Export alwaysQualifyPackages and neverQualifyPackages. 939f1b2 Some utility functions for testing IfaceType equality. dd365b1 Use lookupIfaceTop for loading IfaceDecls. 5c3fc92 Fix Trac #10670 9851275 Comments only d784bde Lexer: support consecutive references to Haddock chunks (#10398) d2b4df1 Generate .dyn_o files for .hsig files with -dynamic-too 76e2341 Accept next-docstrings on GADT constructors. e78841b Update encoding001 to test the full range of non-surrogate code points b5c9426 Parenthesise TypeOperator in import hints 1852c3d DataCon: Fix redundant import 4c8e69e rts/sm: Add missing argument names in function definitions 7ec07e4 Slight refactoring to the fix for #4012 608e76c Document type functions in the Paterson conditions e809ef5 ghci: fixity declarations for infix data constructors (#10018) 5ff4dad Add a few comments from SPJ on fixity declarations f9687ca Library names, with Cabal submodule update 45c319f Fix line number in T10018 testcase 30d8349 Comments only e161634 Comments about stricteness of catch# d53d808 Refactoring around FunDeps 6e618d7 Improve instanceCantMatch 09d0505 RetainerProfile: Add missing UNTAG_STATIC_LIST_PTR b04bed0 renamer: fix module-level deprecation message 070f76a -include-pkg-deps takes only one hyphen. 7e70c06 Use isTrue# around primitive comparisons in integer-gmp c55f61c Add missing parentheses in eqBigNatWord# 474d4cc Comment tweaks only f842ad6 Implementation of StrictData language extension 2178273 Add UInfixT to TH types (fixes #10522) 81fffc4 Remove runSTRep from PrelNames bc4b64c Do not inline or apply rules on LHS of rules 2d88a53 Improve warnings for rules that might not fire 09925c3 Revert "RetainerProfile: Add missing UNTAG_STATIC_LIST_PTR" a1e8620 Revert "Eliminate zero_static_objects_list()" e343c0a Test case for #10698 a1dd7dd Fallout from more assiduous RULE warnings f83aab9 Eliminate zero_static_objects_list() 2dbb01a Add a missing check for -fcpr-off fac11f8 Comments only 4e8d74d Deal with phantom type variables in rules 92d2567 Define DsUtils.mkCastDs and use it fa915af Spit out a little more info with -dppr-debug e4114c8 Fix an outright error in competesWith 499b926 Fix Trac #10694: CPR analysis 918dcf8 The parallel package has warnings 2e33b9c Modify spec002 to be less trivial 72d23c3 Better treatment of signatures in cls/inst 24afe6d Fix missing files 5a8a8a6 Don't allowInterrupt inside uninterruptibleMask 9f7cdfe Make configure error out on missing ghc-tarballs on Windows e7c331a Make headers C++ compatible (fixes #10700) 26315ed Fix misspelled function name in a comment 4f80ec0 Improve error message for newtypes and deriving clauses e9ad42d Typos in comments and strings d7c2b01 Fix comment that confused Haddock b5097fe Testsuite: rename rename/should_fail/T5001 to T5001b (#5001) e273c67 Testsuite: mark tests recently fixed as passing + accept new stderr 756fa0a Testsuite: skip T10489 unless compiler_debugged (#10489) 6880277 Testsuite: add arrows/should_compile/T5333 (#5333) 58b5f04 Testsuite: add typecheck/should_fail/T9260 (#9260) 58986c4 Testsuite: add typecheck/should_fail/T8034 (#8034) aee19d0 Testsuite: T10245 is passing for WAY=ghci (#10245) 36bbfbd Backpack docs on renamer and depsolver, also s/package/unit/. a442800 Build system: remove function keyword from configure.ac (#10705) a66e1ba User's guide: delete ancient "Core syntax" example 7cf87df Fix #7919 (again) 353db30 Remove checked-in PDFs. 8f81af9 Typos in comments ad089f5 Give raise# a return type of open kind (#10481) 75504f3 Typos in comments 15dd700 Replace (SourceText,FastString) with StringLiteral data type d9b618f Typo in comment 37227d3 Make BranchFlag a new kind 92f5385 Support MO_U_QuotRem2 in LLVM backend 948e03e Update parallel submodule, and re-enable warnings b38ee89 Fix incorrect stack pointer usage in StgRun() on x86_64 4d8859c Typos in comments d7ced09 Minor improvement to user guide 30b32f4 Test Trac #10134 697079f 4 reduce/reduce parser conflicts resolved d9d2102 Support wild cards in data/type family instances 7ec6ffc Typos in comments [skip ci] 64b6733 CmmParse: Don't force alignment in memcpy-ish operations 30c981e Removed deprecated syntax for GADT constuctors. f063bd5 Fix #10713. b5f1c85 Test #9233 in perf/compiler/T9233 d7b053a Pretty: reformat using style from libraries/pretty (#10735) 9d24b06 Pretty: rename variables to the ones used by libraries/pretty (#10735) 25bc406 Pretty: improve error messages (#10735) 53484d3 Pretty: remove superfluous parenthesis (#10735) 2d1eae2 Pretty: kill code that has been dead since 1997 (#10735) 6f6d082 Pretty: Args of NilAbove/TextBeside/Nest/Union are always RDocs (#10735) 926e428 Pretty: use BangPatterns instead of manual unboxing Ints (#10735) f951ffc Pretty: mimic pretty API more closely (#10735) 85179b5 Pretty: use replicate for spaces and multi_ch (#10735) dd7e188 Add framework flags when linking a dynamic library 4c55f14 users_guide: Add note about #367 to Bugs section 6029748 Drop custom mapM impl for [] ecb1752 Make -fcpr-off a dynamic flag b12dba7 Make Exception datatypes into newtypes 22bbc1c Make sure that `all`, `any`, `and`, and `or` fuse (#9848) fd6b24f Additions to users' guide and release notes 575abf4 Add Fixity info for infix types e2b5738 Allow proper errors/warnings in core2core passes 617f696 Do not complain about SPECIALISE for INLINE a426154 Warn about missed specialisations for imports 49615d9 Comments only ab98860 Minor refactor to use filterInScope 9536481 Tidy up and refactor wildcard handling 28096b2 Fix quantification for inference with sigs 75f5f23 Coments only cc07c40 Comments only 294553e T8968-1 and -3 should pass 64dba51 Test Trac #10742 eca9a1a Ensure DynFlags are consistent 97843d0 base: Add instances 600b153 llvmGen: Rework LLVM mangler aa23054 Add test for #10600 (exhaustiveness check with --make and -fno-code) bc43d23 Rejigger OSMem.my_mmap to allow building on Mac a1c934c base: Add missing Traversable instance for ZipList 6cab3af Big batch of Backpack documentation edits. 79e0a10 Test Trac #10753 a192d6b Comments only f1b4864 Sync base/changelog.md with GHC 7.10.2 release 590aa0f Make oneShot open-kinded 92f35cd cmmCreateSwitchPlan: Handle singletons up-front 2c4a7d3 Update transformers submodule to 0.4.3.0 release f04c7be Fix unused-matches warnings in CmmLex.x a40ec75 Update testsuite/.gitignore [skip ci] b4ed130 Replace HsBang type with HsSrcBang and HsImplBang 2da06d7 User manual update, as prodded by #10760. 2b4710b Add missing to User's guide to fix the build 8cce7e4 Bump template-haskell to new major version 2.11 67576dd Pretty: bugfix fillNB (#10735) bcfae08 Pretty: fix potential bad formatting of error message (#10735) 5d57087 Pretty: fix a broken invariant (#10735) 85bf76a Pretty: show rational as is (#10735) f903949 Pretty: improving the space/time performance of vcat, hsep, hcat (#10735) b0dee61 template-haskell: Add changelog entry to infix type operators 7b211b4 Upgrade GCC to 5.2.0 for Windows x86 and x86_64 e415369 Update mingw tarball location 8c5b087 SysTools: Fix whitespace in error message d2dd5af DynFlags: Prohibit hpc and byte-code interpreter ec68618 Name: Show NameSort in warning 1857191 Testsuite: mark T8089 expect_broken(#7325) on Windows 8906037 Testsuite: mark encoding005 expect_broken(#10623) on Windows ca85442 Testsuite: recenter 2 performance tests on Windows 744ff88 Testsuite: speedup running a single test e367e27 Travis: prevent 10' no output, by setting VERBOSE=2 74897de Make rts/ThreadLabels.c threadsafe for debug runtime. 22aca53 Transliterate unknown characters at output ab9403d Dump files always use UTF8 encoding #10762 b17ec56 Fix rdynamic flag and test on Windows ebca3f8 rts/Printer.c: speed up '-Da' printer for 'LIBBFD' build 18a1567 Add selectors for common fields (DataCon/PatSyn) to ConLike d97e60f Comments reformating/corrections b6be81b Build system: delete half-baked Cygwin support 98f8c9e Delete sync-all a146b28 GhcMake: Fix spelling in comment 0d0e651 Bag: Add Foldable instance 9e8562a Implement getSizeofMutableByteArrayOp primop 3452473 Delete FastBool 2f29ebb Refactor: delete most of the module FastTypes 47493e6 Build system: simplify install.mk.in a1c008b Build system: delete unused distrib/Makefile a5061a9 Check options before warning about source imports. 37a0b50 Delete ExtsCompat46 (#8330) b78494e fix 64bit two-stage allocator on Solaris/AMD64 platform (#10790) fba724c configure.ac: Allow disabling of large-address-space 1c643ba Fix algorithm.tex build and update with some new info. 0f3335f Comments and white space 816d48a Implement lookupGlobal in TcEnv, and use it 711e0bf tcRnDeclsi can use tcRnSrcDecls ac0d052 TcDeriv: Kill dead code de476e9 PrelNames: Clean up list a bit 89d25b9 BinIface: Clean up whitespace 7924469 Clean up handling of knownKeyNames a8601a8 Revert "Clean up handling of knownKeyNames" 28ad98e PrelNames: introduce dcQual in place of conName 211b349 Move newImplicitBinder to from IfaceEnv to BuildTyCl 70ea94c IfaceEnv: Clean up updNameCache a bit f6035bc MkIface: Introduce PatSynId, ReflectionId, DefMethId 7bd8f8f TysWiredIn: Shuffle code around 15c63d2 base: Remove a redundant 'return' 38c98e4 RTS: Reduce MBLOCK_SPACE_SIZE on AArch64 15cb83d Add testcase for #7411 a6826c5 Make Generic (Proxy t) instance poly-kinded (fixes #10775) 1b56c40 Respect GHC_CHARENC environment variable #10762 81ae26d Dwarf: Fix DW_AT_use_UTF8 attribute cbf58a2 Dwarf: Produce {low,high}_pc attributes for compilation units 8476ce2 Dwarf: Produce .dwarf_aranges section 0c823af Fix identifier parsing in hp2ps cd2dc9e ghc-pkg --enable-multi-instance should not complain about case sensitivity. c7f0626 integer-gmp: optimise bitBigNat c1d7b4b StgCmmHeap: Re-add check for large static allocations 60120d2 Fix 7.10 validate 12098c2 Fix typo in pattern synonym documentation. 10a0775 Anchor type family instances deterministically ad26c54 Testsuite: refactoring only 6740d70 Use IP based CallStack in error and undefined 010e187 Fix trac #10413 ff9432f Add test for updating a record with existentially quantified fields. 296bc70 Use a response file for linker command line arguments #10777 ba5554e Allow annotations though addTopDecls (#10486) c8f623e Expand declaration QQs first (#10047) 28ac9d3 Improve the error messages for class instance errors 3cc8f07 stm: Fix test case 5d7a873 Testsuite: don't warn about missing specialisations e0b3ff0 Testsuite: update expected output 3b23379 Testsuite: mark 4 tests expect_broken_for(#10712, opt_ways) 32a9ead Fix some tests that were broken by D861 c43c8e2 Testsuite: by default run all tests for a single way bd16e0b Testsuite: delete dead code 3744578 Injective type families 5dc88b7 Add test for T10836 (expected broken) 34b106f Accept underscores in the module parser. (Thanks spinda for the fix.) b639c97 Testsuite: fix tcfail220 - Maybe is wired-in now e1293bb Testsuite: only print msg when timeout kills process unexpectedly 79cdb25 Testsuite: ignore line number differences in call stacks (#10834) 85915e9 Make Data.List.foldr1 inline 19c6049 Fix T6018th test failure 64761ce Build system: implement `make install-strip` (#1851) 5c372fe ghc-pkg: don't print ignored errors when verbosity=0 c60c462 user-guide: Add missing tags around body 96b986b EventLog: Factor out ensureRoomFor*Event 062feee tracing: Kill EVENT_STARTUP 2c24fd7 Build system: put each BuildFlavour in a separate file (#10223) b40e559 Build system: simplify *-llvm BuildFlavours (#10223) 1abbacd Build system: cleanup utils/ghc-pkg/ghc.mk dc671a1 SPECIALIZE strictMinimum for Int and Integer c6b82e9 Further simplify the story around minimum/maximum 554be5e Build system: detect when user cloned from GitHub 864a9c4 Build system: remove hack for Mac OSX in configure.ac (#10476) a158607 Build system: delete the InstallExtraPackages variable 330fbbd Build system: make *-cross BuildFlavours consistent (#10223) 8be43dd Build system: cleanup BUILD_DIRS + add lots of Notes e4a73f4 Move GeneralCategory et al to GHC.Unicode 1b8eca1 Build system: check for inconsistent settings (#10157) dbb4e41 HeapStackCheck: Small refactoring 4356dac Forbid annotations when Safe Haskell safe mode is enabled. 23a301a Testsuite: comment out `setnumcapabilities001` (#10860) cdca31e Don't check in autogenerated hs files for recomp013. 3a71d78 Comments on oneShot a870738 Improve rejigConRes (again) 487c90e Add a test for Trac #10806 a7f6909 A CFunEqCan can be Derived 377395e Improve documentation for transform list-comps 50d1c72 Fix broken links in documentation 413fa95 Improve documentation of comprehensions f30a492 Testsuite cleanup 8c0eca3 Add assertions 18759cc Remove redundant language extensions 195af2d Dead code removal, export cleanup 4275028 Code movement 7ad4b3c s/StgArrWords/StgArrBytes/ 89324b8 Testsuite: normalise slashes in callstack output 37081ac Testsuite: mark enum01-enum03 expect_broken(#9399) on Windows 3ec205a CodeGen: fix typo in error message 08af42f hpc: use `takeDirectory` instead of `dropWhileEnd (/= '/')` c8d438f Testsuite: mark T6037 expect_fail on Windows (#6037) 12b0bb6 Account for stack allocation in the thread's allocation counter 14c4090 Pretty: fix unicode arrow operators. 325efac Fix `hp2ps -i-` e66daec DynFlags: remove unused sPgm_sysman (#8689) 8d89d80 Testsuite: add test for #10781 43eb1dc Show minimal complete definitions in ghci (#10847) 8ecf6d8 ApplicativeDo transformation 77662e1 Add namePackage function to template-haskell 48746ff Docs: make sure all libs are included in index.html (#10879) a8406f8 Pass TEST_HC_OPTS in bug1465 and T5792. 2d4db40 Fix #10815 by kind-checking type patterns against known kinds. 8ee2b95 Polish some error messages. b89c491 Always run explicitly requested ways (extra_ways) for fast runs. c738b12 Replace [PostTc id Type] with PostTc id [Type] e156361 Put stable pointer names in the name cache. 1637e4d Driver: --make -o without Main should be an error (#10895) 1a13551 Test #10347 d19a77a Update user guide, fixing #10772 d7f2ab0 Test #10770 79b8e89 Print associated types a bit better. 1292c17 Allow TH quoting of assoc type defaults. 27f9186 Clarify parsing infelicity. 93fafe0 Re-polish error messages around injective TFs. 6a20920 Small improvement in pretty-printing constructors. cbcad85 Fix typo in test for #10347. 2f9809e Slightly better `Coercible` errors. e27b267 Perform a validity check on assoc type defaults. 8e8b9ed Run simplifier only when the env is clean. cd2840a Refactor BranchLists. c234acb `_ <- mapM` --> `mapM_` 3f13c20 Revert "Revert "Revert "Support for multiple signature files in scope.""" 09d214d Revert "Revert "Revert "Change loadSrcInterface to return a list of ModIface""" 06d46b1 Unify hsig and hs-boot; add preliminary "hs-boot" merging. d516d2e Fix build failure, I think. 07f6418 Remove graphFromVerticesAndAdjacency 5a8b055 TcDeriv: Use a NameEnv instead of association list 83e23c1 Remove (now bogus) assert. 0b852fc base: use Show for ErrorCall in uncaughtExceptionHandler d4d34a7 Make derived names deterministic 089b72f DeriveLift extension (#1830) 4cdab73 HscMain: Place CPP macro invocation on one line 79f5732 testsuite: attempt fixing fallout from 089b72f52 c6bdf4f Remove references to () from types of mkWeak# and friends 65bf7ba DsBinds: Avoid using String when desugaring CallStack construction 939a7d6 Annotate CmmBranch with an optional likely target cf90a1e Add constant-folding rule for Data.Bits.bit 73921df Update Cabal to recognize DeriveLift 453cdbf base: export allocation counter/limit API from System.Mem 5c11523 reify associated types when reifying typeclasses 39a262e Revert "reify associated types when reifying typeclasses" 2440e3c Fix a bug with mallocForeignPtr and finalizers (#10904) b08a533d Fix DeriveGeneric for types with same OccName (#10487) 4f9ee91 Testsuite: update expected output for T8832 on 32-bit systems (#8832) 5883b56 Testsuite: properly fix T8832.stdout-ws-32 (#8832) 1395185 Testsuite: add test for #10767 fb40926 Weak: Don't require wrapping/unwrapping of finalizers a98815a Dwarf: Rename binding to avoid shadowing ppr a0b1f41 Dwarf: Ensure block length is encoded correctly f7fd864 Skip a possible BOM in utf8 encoding 3fbf8f4 Debug: Remove extraneous LANGUAGE CPP 988b2ba rts: Clean up whitespace in Trace.h b4d43b4 reify associated types when reifying typeclasses(#10891) 78053f4 Allow enumDeltaIntegerFB to be inlined 2eddcd9 Lexer: delete dead code for binary character literals 23baa65 .gitignore update for some test files. e3ab25a Typos in comments 03b3804 Add Data.Semigroup and Data.List.NonEmpty (re #10365) f2a174a Update nofib submodule a52db23 Update nofib submodule again eb975d2 Fix treatment of -0.0 57e3742 Document peculiarities of `traceM`. b29f20e nativeGen PPC: fix > 16 bit offsets in stack handling bd41eb2 LLVM: Implement atomic operations in terms of LLVM primitives 9539408 LLVM: Factor out accumulation of LLVM statements and variables 7442434 Move CallStack back to base e3d2bab Fix signature of atomic builtins 9ed700b Don't use old linkable for hs-boot files. 4fd6207 Move user's guide to ReStructuredText 93e21b9 docs: Fix ghc_config.py.in b6f76b9 Prevent GHC from silently dying when preprocessor is not found c4d7df0 Fix broken validation Build 6564 and accepting a few other test results a3c78ab Build system: add mk/validate.mk.sample a96f1ac Testsuite: update expected output for T8602 6cde981 Make GHC generics capable of handling unboxed types 0eb8fcd Enable `Enumeration is empty` warnings for `Integer` 2f74be9 Fill in associated type defaults with DeriveAnyClass d2fb532 testsuite: Bump up haddock.base expected allocations 620fc6f Make Windows linker more robust to unknown sections aecf4a5 Build system: don't create mk/are-validating.mk c0bdfee Testsuite: only add -fno-warn-missed-specialisations for ghc>=7.11 7fcfee1 A few typos in comments 5ca1d31 Testsuite: make driver python 2.6 compatible again 427f8a1 Deduplicate one-shot/make compile paths. 8c1866a Comments only 0e169a8 Fix kind-var abstraction in SimplUtils.abstractFloats ca816c6 Remove dead code: ruleLhsOrphNames 7da3d30 Comments only 3833e71 Comments about TcLevel assignment 59883ae Documentation for FrontendResult 36811bf AsmCodeGen: Ensure LLVM .line directives are sorted ea4df12 Ensure shiftL/shiftR arguments aren't negative 7b443bb Improve error messages for ambiguous type variables 69a6e42 Allow non-operator infix pattern synonyms e2b579e Parser: revert some error messages to what they were before 7.10 f64f7c3 Tests for #10945 and #10946 931d0a7 Move orphan instance/rule warnings to typechecker/desugarer. e99e6db Extra files to ignore from the new Restructured documentation. 0ead0ca Disable man building for most quick build styles. c7ab799 Ignore __pycache__. e5baf62 Simplify type of ms_srcimps and ms_textual_imps. 5dc3db7 Switch to LLVM version 3.7 80602af Revert "Switch to LLVM version 3.7" e331392 Fix error msg: ghci can't be used with -prof or -static (#10936) 5d84110 Add short library names support to Windows linker 182c44d Keep `shift{L,R}` on `Integer` from segfaulting 840df33 Rename SpecInfo to RuleInfo (upon SPJ's advice). fa5eabe sphinx: Don't share doctrees between targets 614ce4b Testsuite: T3333 still fails on non-linux statically linked ghci (#3333) bbad4f6 Delete ShPackageKey for now. f002340 compiler/nativeGen/PPC/Ppr.hs: Whitespace 4bd58c1 PPC: Fix right shift by 32 bits #10870 e737a51 base: MRP-refactoring of AMP instances 6b7bad9 Test Trac #10931 f8fbf38 Reinstate monomorphism-restriction warnings dcc3428 Don't inline/apply other rules when simplifying a rule RHS. 330ba6a testsuite: attempt fixing T10935 output 94ef79a Slightly wibble TcSimplify documentation d2f9972 Make dataToQa aware of Data instances which use functions to implement toConstr 1818b48 Fix incorrect import warnings when methods with identical names are imported e5bfd70 docs: overhaul Derive{Functor,Foldable,Traversable} notes dec5cd4 base: Add forkOSWithUnmask e8c8173 Allow arr ∧ (first ∨ (***)) as minimal definition of Arrow instance 29310b6 Switch to LLVM version 3.7 7756161 travis: use LLVM 3.7 933adc0 Fix GHCi on Arm (#10375). 729bf08 User should use -package-id flag if value in question is IPID. 5b0191f Update Cabal to HEAD, IPID renamed to Component ID. b92a51f Rename package key to unit ID, and installed package ID to component ID. 6338a1c Rename PACKAGE_KEY and LIB_NAME in build system. 20e30d5 Minor stylistic update. 04e8366 ELF/x86_64: map object file sections separately into the low 2GB 78c9dea Fix windows build after D975 4d6844a rts/Linker.c : Fix armhf build (#10977) 808bbdf Remove dead function patSynTyDetails b1884b0 Implement DuplicateRecordFields 75492e7 Add typed holes support in Template Haskell. 6a8ca65 Allow left ∨ (+++) as minimal definition of ArrowChoice instance e7c076d base: changelog entries for Arrow/ArrowChoice 324e0ac base: MINIMAL pragmas for Arrow/ArrowChoice 3340fe0 Build system: fix `make -j1` (#10973) 603a369 Silence the linker on Windows so tests pass fff0254 Move Control.Monad.IO.Class to base from transformers a6a3dab Libdw: Add libdw-based stack unwinding 40cbf9a Signals: Print backtrace on SIGUSR2 e8ed213 Make Monad/Applicative instances MRP-friendly 6638bfd CmmParse: Clarify description of calling convention d990b5f Signals: Always install SIGUSR2 handler 75c7cda ghc-pkg: Express return-method in terms of pure c6781a5 template-haskell: MRP-refactor Applicative/Monad instances 1e34f62 MRP-refactor `GHCi` Applicative/Monad instance d6d421c template-haskell: set explicit return=pure 40235c3 fix RTS linker compilation failure on Solaris 7bbb61b Driver: `ghci -e` should behave like `ghc -e` (#9360) 2b25a58 base: Have the argument of mask restore the state. 96dc041 Systools.hs: Improve detection of GCC and Clang ae4acbd Testsuite Windows: don't use forward slashes in topdir path 1750ebc Reject top-level typed TH splices. Fixes #10945 bb7e93c Extended default rules now specialize Foldable, Traversable to [] (#10971) 68a084f Testsuite: add test for #10997 2bc6efc Fix caching of pagesize 7855afb Fix breakage in the GHCi debugger e3e5a96 Remove old trace statement d77c404 Stop the pipeline when it doesn't need to be run. c633f71 Add another test for #10549 1e8d1f1 Suggest enabling PatternSynonyms (#10943) 9ec5996 rts/Schedule.c: remove unused variable 0499aa7 Add missing stderr file 9cb192c Make stronglyConnCompFromEdgedVertices deterministic 0ae6a43 Suggest chmod 755 instead of 644 fa7d582 Quote GHC path in configure so we can deal with multiple spaces. 8f5ad1a Quote GHC_PKG in Makefile. fdb08e2 Add testcase for #10426 0afba67 arclint: ReST doesn't need ArcanistMergeConflictLinter fd63ea5 base: Note platform dependence of registerFd 7dae074 Verify minimum required version of sphinx-build 67284a0 gitignore: Ignore sphinx doctrees directories 2866dfb Fix broken .arclint 4e40340 Support more sphinx-build versions in configure script ec14392 typo in comments: s/selectg/select/ 798d2e2 configure.ac: Fix autotool warnings 7aea0cf use Proxy instead of undefined -- we already dropped support for 7.6 ca12c24 Update example GHCi startup abc214b rts/Linker.c: Split RTS symbols out into separate file 3ed4b80 rts/Linker.c: Convert #if/#else to if/else 898f34c rts/RtsSymbols.c: Fix Windows build 43751b2 Provide a utility to check API Annotations c2fab84 Add testcase for #10370 86e5eb9 Remove redundant typedef 0b79aa1 base: Add Haddocks to GHC.RTS.Flags 73c273a Fix a typo in the User's Guide ReST intro 23e344b Remove cygwin32_HOST_OS #ifdefs 499ce29 Add flag to reverse errors in GHC/GHCi a9c93bd Implement MIN_VERSION and VERSION macros natively in GHC. c10c01c Build system: comments only [skip ci] f86fb5e Add regression tests for #10045, #10999 6831815 Comments only 0ce858e Zonk properly when checkig pattern synonyms adc3d17 manpage: Mark as orphan document d1d8704 Use correct documentation flag for freverse-errors 158d2a9 Make it possible to have different UniqSupply strategies 079dd12 Fix "Use correct documentation flag for freverse-errors" dc13467 DynFlags: Fix more merge errors ffcdd84 Sort field labels before fingerprint hashing 166c597 DynFlags: Yet one more fix 31704ad Make worker-wrapper optional 9efa56d Fix the DYNAMIC_GHC_PROGRAMS=NO build on Mac/Windows 19354fb Make T10970a non-dependent on GCC version. 7c2ab6f Testsuite: accept output for T10999 (#10999) d1ab6fc PrelNames: Fix duplicate unique 9fc2d77 Build system: don't add ALL_HC_OPTS when linking 04b0a73 Pattern synonyms: swap provided/required de27bed Update haskeline/terminfo submodules c1e1584 Update `deepseq` submodule 776d55c rts/Linker.c: Drop support for legacy OS X dyn loading ce2416b Fix rts/T9579 tests on OS X 08f5c4e Backpack documentation updates for component IDs [no-ci] 032be43 Testsuite: report and error out on unfound tests a051788 Revert "Build system: don't add ALL_HC_OPTS when linking" 2a74a64 Record pattern synonyms fa58731 Revert "Build system: don't create mk/are-validating.mk" e31113f Move mkDefaultMethodIds, mkRecSelBinds from TcTyClsDecls to TcTyDecls d25fa86 TcTyDecls: Remove redundant import of Applicative 40e6214 DynFlags: Add (another) missing hunk from D1360 bef2f03 Generate Typeable info at definition sites bbaf76f Revert "Generate Typeable info at definition sites" e272ab9 x86 codegen: don't generate location comments 8ddf417 Linker: Fix type in m32_free_internal 9b3a058 Swap prov/req in variable naming in Parser.y 9376249 Fix unused-import stuff in a better way 3e94842 Record usage information using GlobalRdrElt da58d15 Kill redundant import 268aa9a integerConstantFolding: when(compiler_debugged(), expect_broken(#11006)) 0a16374 Disambiguate record selectors by type signature 1f1c7c6 Build system: rename runghc.hs to Main.hs b05ab1a Build system: cleanup a few .cabal files 314395e Build system: cabalise deriveConstants + genprimopcode 2624298 Fix segfault due to reading non-existent memory 42e8528 CmmParse: Expose popcnt operations 3e2c227 Linker: Clean up USE_MMAP usage 1c80db5 Insert an empty line between two STG definitions in dump output. 56f9ef4 Unify: Add Outputable instance for UnifyResultM aa289d2 Move win32 tarball download logic to script f78b477 driver: use PROGBITS type for .debug-ghc-link-info section 59e728b Testsuite: suggest quoting $(TEST_HC) 91c6b1f Generate Typeable info at definition sites 39b71e8 Reimplement shadowing on a per database basis. f5974c8 rts: Make MBLOCK_SPACE_SIZE dynamic fce758c Add failing test for #11039 a5cb27f Make type-class dictionary let binds deterministic e03e22c testsuite: performGC requires SMP support for 'qg' option d9d201c testsuite: 'threaded2' tests require '-N' RTS option support e0071c3 unreg: handle CmmStack in C codegen (unbreaks '-g') 8995865 Update primitive/vector submodules 62f0fbc Update parallel submodule 8160f42 Add subWordC# on x86ish 7a48e6c Make ghc-cabal's `System.Directory` import more robust 6bef55c Fix documentation build on windows e2a78ee Signals: Ensure libdw session is freed 8f02baa Remove Data.List.NonEmpty.{words,unwords,lines,unlines} bc7cc25 disable large address space on OpenBSD da1a8da llvmGen: Fix build with Clang 8fd5cff llvmGen: Really fix build with Clang 3021cc0 Add rts/Linker support for more than 64k sections 31bcf9b Apply WERROR only to stage2 HC options c3b0215 Provide a utility to check API Annotations docs 4ad2a8f rts/posix: Reduce heap allocation amount on mmap failure c8e866a Enforce linkage with pthread library on OpenBSD 184dfce Linker: More uint64_t to uintptr_t fixes 9f0ecb4 ghc-prim: Fix hs_ctz64 for powerpc 62e1b35 Update array/stm/hpc/haddock submodules d2a7fb9 Update directory submodule 12abc77 Update filepath submodule de8443c Update process submodule 3238ef7 Update unix submodule 32f92a3 Update hoopl submodule f8ba4b5 Bump `base` version to 4.9.0.0 (closes #11026) 4b8b934 ghc-prim: add API delta as changelog (re #11043) 84bf1eb Bump ghc-prim version to 0.5.0.0 (closes #11043) f16827f ApiAnnotations: BooleanFormula is not properly Located 5a48180 keepCAFsForGHCi was broken 677d768 DynFlags: -freverse-errors should be defFlag 3431ad6 Update Cabal submodule 6fb0ba6 Dwarf: Preserve stack pointer register 76611d7 Dwarf.Types: Fix comment style 159a1a2 cmm: Expose machine's stack and return address register d9f8862 StgStartup: Setup unwinding for stg_stop_thread bb446b2 Libdw: Remove special treatment for stg_stop_thread b8df858 Dwarf.Constants: Introduce Haddock sections 52c6e3d Libdw: Fix symbol naming e9bfb3f Minor simplification in unariser pass: 65f3c4c Change sphinx for documentation building on windows to the python3 version f46f32b EventLog: Loop fwrite if necessary during flush 9fe5497 rts: Produce stack trace on fatal error 1e2259b Update process submodule to process-1.4 release c00c5e5 get rid of Elf32/Elf64_Section as this is a non-portable Linux-ism. 130ca3e Update filepath submodule for proper version 5065cf4 base: Update `@since 4.8.2` annotations (re #11026) 0bc8c6a base: GHC.RTS.Flags symbols really were introduced in 4.8.2 83fd2ba base: Add changelog entry for 4.8.2.0 8c80dcc base: Add new Control.Monad.Fail module (re #10751) b62605e Add `MonadPlus IO` and `Alternative IO` instances 334fe45 rts/Hash: Constify HashTable* in lookupHashTable 987d542 Build system: renable -Wall on validate (base) 0e21678 Cabal-level sanity check to enforce Cabal flag-invariant 22fcf9c Tweak settings for LLVM tests e547954 Use full name of LLVM program in error message 10647d4 Linker: #ifdef cleanup a58eeb7 Call Arity: In "e x", the result of "x" is not shared ce1f160 Make GHCi & TH work when the compiler is built with -prof 6e6438e Allow the GHCi Linker to resolve related dependencies when loading DLLs be88585 fix #10734 by adding braces to pretty-printing of let inside do 2208011 Remove PatSynBuilderId d9c1450 Build system: use stage0 to build dll-split 8262c95 Parser: allow empty multi-line deprecation warnings bd69f6f minor: use unless instead of (when . not) 932d503 Replace freeVarsOf scrut with scrut_fvs to avoid repetition 80d7ce8 Add pprSTrace for debugging with call stacks 0e40c01 Quote file paths in linker scripts 2b7d9c2 Add OpenBSD specific RTS symbols f405632 Fix sporadic failing ghci/Linker/Dyn tests 3cfe60a Abstract TFs can have injectivity information 96621b1 Associate pattern synonyms with types in module exports 5eb56ed Fix link in documentation fbc2537 OPTIONS_GHC compiler flags may contain spaces (#4931) ea8c116 Remove unused field in ConDecl f0f9365 Remove fun_infix from Funbind, as it is now in Match 109d7ce Systools: read ELF section without calling readelf fa61edd Improve documentation of Data.List.lines: 0f49508 Put kind variables before type variables when specializing badf5d5 Detect invalid foreign imports in bytecode compiler fb0d512 nativeGen.PPC: Fix shift arith. right > 31 bits afbd30b mkGadtDecl no longer in P monad 63cad5d Rename bundled pattern synonym tests to reflect new terminology a038b72 Remove redundant test. 9bea234 fix RTS Linker on platforms without SHN_XINDEX support 4a32bf9 Implement function-sections for Haskell code, #8405 e090f1b Change demand information for foreign calls 8755719 rules/haddock: Set __HADDOCK_VERSION__ 351de16 New magic function for applying realWorld# ac2e1e5 T10678: Fix bytes allocated statistic 5d6133b Ignore comments in getOptions 2290c8b APIAnnotations:add Locations in hsSyn for layout e66f79d Give helpful advice when a fully qualified name is not in scope b8d263d Turn ImportedModsVal into a data type 5a86292 Remove imv_empty from ImportedModsVal 8868ff3 Update note for Parent to explain PatternSynonym. 8988be8 Make 'error' include the CCS call stack when profiled 3353f62 Rip out __HADDOCK__ references 5488422 Fix bootstrapping with GHC 7.10.1 46a03fb Implement the Strict language extension fe95463 ApiAnnotations: Add SourceText for unicode tokens ee91482 ApiAnnotations : ITopenExpQuote needs SourceText 83b214d RtsFlags: Clean up stale CPP b8a849b users-guide: Limit column width 69822f0 RtsFlags: Refactor some of the deeper switches 7485d0c ghc.mk: Make install_docs rule sh-compatible 82cf672 haddock.mk: Use \{1,\} instead of \+ 3773e91 Use TcM instead of it's expanded form, in TcSplice 741cf18 Weaken monadic list operations to Applicative e2d9821 Data.List.isSubsequenceOf documentation clarification 2d1a563 Implement support for user-defined type errors. 3d88e89 s/FrontendMerge/FrontendInterface/g 9193629 Move usage calculation to desugaring, simplifying ModGuts. ac1a379 Revert "Unify hsig and hs-boot; add preliminary "hs-boot" merging." df8169c Bump process submodule 4e74ef9 T9181: Fix testsuite output 615ba5f Remove orphan Functor instance of Data.Graph.SCC 7c9cbfd template-haskell: drop `TemplateHaskell` requirement b3d6c0f Update Cabal submodule for new known extension 8ad9e74 Make `timer_create(CLOCK_REALTIME)` autoconf test more reliable acce37f Fix archive loading on Windows by the runtime loader 7b962ba Implement OverloadedLabels 233d131 MonadFail proposal, phase 1 98a4fa5 DynFlags: Don't list TemplateHaskell as supported if it's not 11e336e More import related hints f405e1e Disable failed specialisation warnings by default & update documentation. f9e17fd Add -fwarn-missing-monadfail-instance to mkUserGuidePart 6b3d5b5 rts: Kill PAPI support c945c90 base: Documentation for TypeError 112ce87 docs: Ignore Sphinx doctrees produced by manpage build 3ee0c14 Improve MonadFail errors by mentioning the pattern 2f7e895 users-guide: Give links more contrast a0f977e relnotes: Update base version 8eefdf0 users-guide: Use tango pygments style 02eb44d users-guide: Fix typo in conf.py 2d0e1db Comments only 8e8d26a Comments on TcRnTypes.canDischarge 07eb258 Refactor HsExpr.RecordCon, RecordUpd c61759d Fix inconsistent pretty-printing of type families cc79dd1 users-guide: Move

outside of tag 971f2c9 Correct > to > in user's guide a41830f Mention "-XMonadFailDesugaring" in the docs a586622 Release Notes: Mention out-of-scope error message improvements 2442038 Fix interaction of DuplicateRecordFields and GHC.Generics 3e2a4ee Fix broken build-system when libffi uses install-sh 65d7ff0 Make `derivedConstants` more crosscompile-friendly 7dfde0e derivedConstants: Add support for AIX c5d8162 Make GHC aware of OSAIX and AixLD 75036aa Set AIX specific CFLAGS flags fce0465 Unbreak Text.Read.Lex.lex on Unicode symbols d732ce0 Bump process submodule b72ca3e Pattern Synonym Documentation a689c8e ghci: don't let ctags/etags overwrite source files 1994304 user's guide: Fix some accidental triple-` quote 998c371 users-guide: Fix version number 7e6dcf4 base: Delete errant GHC/Stack.hsc f40fe62 Follow-up fixup to c5d8162d230c373 7f77e4e Fix Windows builds after D1242 d585073 RtsFlags: Fix const warning 192dd06 Suppress conflicting types for builtins warnings 6664ab8 Add DVarSet - a deterministic set of Vars 2325bd4 Create a deterministic version of tyVarsOfType b98ff3c Function definition in GHCi a703fbc Remove accidentally added T10359 blob 4976ab2 Follow-up fix to 3e2a4eefbed7002437c3f (re #11109) 638fde5 Add comment to Parser.y re extra API Annotation 64737f2 New expected test output for 32 bit platforms 3df9563 ApiAnnotations: Make all RdrName occurences Located 6393dd8 Make abstractVars deterministic in SetLevel 02c689c build.mk.sample: Document meaning of WERROR 5d6cfbc Rip out Papi configure check 7c9a04d Add a note explaining why every RdrName is Located dbad0d5 Libdw: Fix build on 32-bit platforms 70ee638 Libdw: Fix initial register collection on i386 36b2139 rts: Expose more libdw symbols a3a8ce6 rts: Add simple resource pool 6fbf22d rts: Add LibdwPool, a pool for libdw sessions bb249aa base: Add Haskell interface to ExecutionStack 7aaeaf8 Support multiple debug output levels 40be909 Dwarf: Ensure tick parentage is preserved 9471562 Output source notes in extended DWARF DIEs 5955510 Improve constraint-used-as-type error msg 70efb62 Add tests/monadfail/Makefile e587217 Add the rest of the notes for Located RdrName 1c45f41 rts: Always export Libdw* symbols 12dbc89 Add `PrelNames.thenAName` for `Applicative(*>)` f09f247 Implement new `-fwarn-noncanonical-monad-instances` c05fddd Rearrange error msgs and add section markers (Trac #11014). 6d14793 Add -Wcompat warning flag group e506f02 Rewrite checkUniques and incorporate into validate 8c5fe53 DynFlags: Update comments to reflect new users guide 8dc6da8 Comments only 5e04c38 Simplify the MonadFail code 76f3142 DynFlags: Drop stale comment 9032d05 update link to MonadFail proposal 924f851 Refactor default methods (Trac #11105) e9a4c09 Comments only e913676 Add a simplifier trace for eta-expansion 9aa9458 Note STM's vulnerability to non-allocating loops c7a058f User's Guide: Add links to MFP wiki page 5699ac9 User documentation for DuplicateRecordFields d2a2d5e Note #11108 in the bugs section of users guide c4308b4 rts/Pool: Add poolTryTake 1712a9e LibdwPool: Use poolTryTake ba14f04 Libdw: Handle failure to grab session for location lookup d25f853 Update transformers submodule 49aae12 Check arity on default decl for assoc types 583867b Update haskeline & terminfo submodules 85fcd03 Implement new -XTemplateHaskellQuotes pragma 72e3620 ghci: Add support for prompt functions 55c737f ghc-pkg: print version when verbose 399a5b4 Remove deprecated quasiquoter syntax. 71c0cc1 GHCi should not defer typed holes 54a9456 Update containers submodule 616aceb Update deepseq submodule 5897213 Remove redundant `#if`s f101a82 ghci: Refactor handling of :show bcd55a9 Some improvements on CoreToDos passed to plugins 290def7 Implement warnings for Semigroups as parent of Monoid afb7213 MkId: Typos in comments 14d0f7f Build system: Add stage specific SRC_HC_(WARNING_)OPTS 6dce643 Fix grammar and typo in TcTyDecls 36c1247 Remove duplicated line 44c3e37 Fix warning about unused pattern variable b432e2f Make the determinism tests more robust 1e041b7 Refactor treatment of wildcards 218fdf9 Make the order of fixities in the iface file deterministic 741f837 Implement more deterministic operations and document them 52b02e6 Comments only (isIrrefutablePat) b564731 Comments (TcSMonad) d00cdf2 Revert "ghci: Add support for prompt functions" 1caff20 StgSyn: Remove unused SRT constructor c75948b Move Stg-specific code from DynFlags to SimplStg d4d54b4 Remove *.xml from gitignore a12e47b Avoid panic due to partial ieName 8cba907 Create empty dump files when there was nothing to dump 0d1a2d2 ErrUtils: Spruce up Haddocks e7929ba Update bytestring submodule d25f3c0 users_guide/glasgow_exts.rst: fix link markup 8a50610 Major Overhaul of Pattern Match Checking (Fixes #595) 43a31fe testsuite: haddock.compiler: Bump expected allocations a034031 extending_ghc.rst: fix broken link (Trac #10950) c5597bb Revert "Create empty dump files when there was nothing to dump" 7b29b0b Fix haddock syntax 0dd61fe Kill redundant patterns 934b3a0 Update test output 40fc353 Bump hoopl submodule ae4398d Improve performance for PM check on literals (Fixes #11160 and #11161) 99d01e1 Remove unused import in deSugar/TmOracle.hs 7af29da Use Autoconf's AC_USE_SYSTEM_EXTENSIONS cd9f3bf RTS: Rename InCall.stat struct field to .rstat 6ef351d On AIX we need -D_BSD defined in d40f5b7 PmExpr: Fix CPP unacceptable too clang's CPP 36a208f Use builtin ISO 8859-1 decoder in mkTextEncoding befc4e4 Check: More Clang/CPP wibbles e9220da Bump allocations for T783 dc33e4c T5642 is broken 96e67c0 T5642: Skip it entirely 5b2b7e3 Make callToPats deterministic in SpecConstr 1c9fd3f Case-of-empty-alts is trivial (Trac #11155) 28035c0 Add derived constraints for wildcard signatures 1cb3c8c Wibbles only 822141b Make -dppr-debug show contents of (TypeError ...) 1160dc5 Fix egregious error in eta-reduction of data families 31b482b Minor refactoring of user type errors 67565a7 Tidy user type errors in checkValidType 43a5970 Comments only 16aae60 T5642: Fix skip usage caa6851 testsuite: Rename pmcheck/T7669 to pmcheck/T7669a d4bf863 Update peak_megabytes_allocated for T9675 020375d Add linter to check for binaries accidentally added to repository 901cab1 lint: Add linter to catch uses of ASSERT macro that Clang dislikes c865c42 StgCmmMonad: Implement Outputable instance for Sequel for debugging e2c518e libdw: enable support only on i386 and amd64 81cf200 pmcheck: Comments about term equality representation 406444b pmcheck: Comments about undecidability of literal equality 8f28797 Fix broken linters when using python3 c714f8f Use git.h.o copy of arcanist-external-json-linter a14296c Temporarily disable external-json linters 51d08d8 Enable non-canonical Monad instance warnings for stage1/2 314bc99 ghc.mk: cleanup: use tab consistently d6512c7 ghc.mk: don't run mkUserGuidePart more than once 13ab2c6 ghc.mk: fix docs re-rebuilding 5f1e42f Allow to compile OSMem.c when MEM_NORESERVE is not available df67940 Make ghc.mk compatible with pedantic /bin/sh impls 986ceb1 Implement new `-fwarn-noncanonical-monoid-instances` 8b42214 Tweak use of AC_USE_SYSTEM_EXTENSIONS be92c28 Update hoopl submodule f5127c8 linters/check-cpp: Don't produce debug log 3ea4fb7 Documentation: escape characters in template-haskell Haddocks 42a5469 Ignore generated linter.log 3d55e41 ghc-pkg: Restore old behavior in colored version; fixes 6119 8cef8af Re-export data family when exporting a data instance without an export list 91e985c Minor stylistic fixes in glasgow_exts.rst 2110037 Add isImport, isDecl, and isStmt functions to GHC API d4bcd05 rts: Remove space before argument list in ASSERTs 700c42b Use TypeLits in the meta-data encoding of GHC.Generics 51a5e68 Refactor ConDecl 1bd40c8 Move checking for missing signatures to RnNames.reportUnusedNames 151c4b0 ghc-pkg: don't sort packages unnecessarily 04e1c27 rts: One more Clang-unfriendly CPP usage 0933331 Re-use `transformers`'s `MaybeT` rather than our own b292720 Remove redundant CPP conditionals 834f9a4 Get rid of tcView altogether 2f6e87a Introduce HasGhciState class and refactor use-sites 9f4ca5a Associate ErrorCall pattern with ErrorCall type fd3b845 Make HasDynFlags more transformers friendly 7a40a6c Update libffi-tarballs submodule to libffi 3.1 (re #10238) bb753c5 Rename s/7.12.1/8.0.1/ two minor occurences 2cfa5db Fix double MaybeT instance 2106d86 Fix typo sneaked in with fd3b845c01aa26b6e5 69c3964 docs/glasgow_exts: Use warning admonition e792711 users_guide: Show sub-sub-sections in ToC aa6ae8a Comments only 6c794c3 Comments about polymorphic recursion d7729c7 An assortment of typos 7997d6c Refactor GHCi Command type; allow "hidden" commands 31bddc4 Add missing whitespace in toArgs' error msg af77089 Fix DeriveAnyClass (Trac #9968) e9ea020 Comments only 8317893 Improve documentation for DeriveAnyClass 688069c More typos in comments/docs 602889a Test Trac #11192 f4f00c0 Test Trac #11187 41ef8f7 Make sure PatSyns only get added once to tcg_patsyns f7c17c8 T7478: Don't expect broken on Darwin 5447c20 Mark retc001 as broken on Darwin 262954c T4801: Update expected allocations on Darwin c205aeb Removed colon append operation (fixes #10785) b138248 Improved data family export documentation ceaf0f4 testsuite: Only run recomp015 on ELF-based platforms 6e56ac5 Fix infix record field fixity (#11167 and #11173). 6746549 Add kind equalities to GHC. 5183109 Revert README.md changes from 6746549772c5 a6e0394 haddock: Fix submodule commit to point to ghc-head b5d5d83 Revert .gitmodules changes from 6746549772c5 a459451 rm rae.txt 68f198f Test case for #7961. 779dfea Test #9017 in polykinds/T9017 a3c2a26 Frontend plugins. 1883afb Implement -fwarn-missing-pat-syn-sigs 3ec8288 Rework the Implicit CallStack solver to handle local lets. 4935b48 Make -XStrict imply -XStrictData 3640ae9 Dwarf: Use .short instead of .hword on Darwin aaed24a Build system: fix 'make install-strip' in bindist 9934819 Refactor type families in Template Haskell 59cc6ed Fix release notes markup 669c5ed Remove redundant imports f48015b configure: add support for 'sh4' (Trac #11209) 0bf0cf9 Update Cabal submodule fcc6b1d Use idiomatic way to tell Autoconf the c compiler baed2f5 Don't pass CC= explicitly to `./configure` scripts 65920c9 Some more typos in comments 04ab55d Use Cxt for deriving clauses in TH (#10819) 023f11f Suggest import Data.Kinds when * is out of scope 419b6c0 Make binds in do-blocks strict when -XStrict (#11193) 59d3948 Add testcase for #11216 402bbe6 Add IsString Outputable.SDoc instance 05fe546 Test #9632 in dependent/should_compile/T9632 ddde542 DynFlags Remove -fwarn-context-quantification flag 9017f16 Mention "handle is semi-closed" in error messages 05a5ebe Fix runghc when $1_$2_SHELL_WRAPPER = NO 6d9c18c DynFlags: remove Opt_Static 33742db DynFlags: delete function that doesn't do anything f4dd486 Document -XOverloadedLabels 8e6f9bf TysWiredIn: Fix a comment - Note [TYPE] is in TysPrim 4c9d1ea Update expected test output for 32 bit platforms f4d90f9 Reset process submodule to v1.4.1.0 release tag d1ca5d2 Fix formatting complaint from Sphinx 98cdaee Improve documentation for -XStrict b8ca645 Comments on equality types and classes 6eabb6d Allow recursive (undecidable) superclasses 947e44f Comment layout only e2c9173 Narrow scope of special-case for unqualified printing of names in core libraries 758e6b3 base: NonEmpty: Fix documentation example a701694 Add testcase for #11224 28638df primops: Mark actions evaluated by `catch*` as lazy c1e2553 Expose enabled language extensions to TH 50c795c Update pretty submodule to v1.1.3.2 release 3a48e6e Update binary submodule to binary-0.8 snapshot 2206fa8 Add `-W(no-)xxx` aliases for `-f(no-)warn-xxx` flags 437ebdd Start using `-W` instead of `-f(no-)warn` in some places d36e9e1 GHC.Stack: Fix Haddock markup 4c7da9c Update haddock submodule ab79ed7 Improve detection of `fdatasync(2)` (re #11137) 11b9ada Synchronize Haddock submodule with master branch efaa51d Look through type synonyms in GADT kind signatures 046b47a Note [The equality types story] in TysPrim b35cc1f Update Cabal submodule to latest snapshot 1687f99 Update transformers submodule to latest v0.5.0.0 6c9258d Add test for #10897 7221ad7 GHC doesn't have a way to ask for user-package-db, so Cabal reimplemented it. 4905b83 Remote GHCi, -fexternal-interpreter a6d664c accept output dd3837a Fix tests when run in parallel acd447e Bump haddock expected performance numbers b20a65d testsuite: Add missing LiteralsTest2.hs 786d528 TcTypeable: Don't use bogus fingerprints when suppress-uniques is enabled 62e60bb Fix haddock hyperlinker 27f47cd Fix libffi dependency, and remove redundant LibFFI.hsc 0cc4aad Build system: Cabalize genapply 86ad116 Add Shake configuration to configure.ac 109d847 Build system: Make cGhcRtsWithLibdw flag a proper Bool e58a936 rules/haddock: Add EXTRA_HADDOCK_OPTS flag 4f870f8 Conditionally show plural "s" in warnings cab1316 Fix #11232. 4b161c9 Reify DuplicateRecordFields by label, rather than by selector d3dac4e Add -fprint-typechecker-elaboration flag (fixes #10662) 575f0ad users_guide: Remove extraneous vertical whitespace e7f22bf Improve pretty-printing in pprIfaceIdBndr e32c2e1 Remove unused T10524.stderr 89d70f9 Update Cabal submodule aee58e1 T9961 allocations crept further upwards e2e24f2 Disable recomp015 on ARM ece8aff Remove warning-suppression flags for Cabal a2f04a2 Testsuite: #10712 is fixed 9d9c534 Lexer: update outdated comments [skip ci] 1b6323b IO Handles: update comments [skip ci] ae86eb9 Fix tcTyClTyVars to handle SigTvs 1722fa1 Fix #11230. c1bd3d4 Build system: also put scripts in libexecdir/bin 272e1cc Testsuite: allow spaces in TEST_HC passed in by the user 116ba5e Build system: allow bindist without docs f1fa383 Suppress warnings when compiling primitive and random bc436f9 Testsuite: mark frontend01 conditionally expect_broken on #10301 e0e03d5 Move Data.Functor.(Classes,Compose,Product,Sum) into base c5c72aa Update containers submodule to v0.5.7.0 release 3dd06d5 Random typo fixes 06cb695 ghci: fix UNREG build (missing fromJust import) 98ccb72 Testsuite: widen lazy-bs-alloc 3->5% 8d45ccd Testsuite Windows: fix sigof01m, sigof012m and sigof02dm dc8b647 Testsuite Windows: fix ghcpkg03 and ghcpkg05 34393d9 Documentation for -fexternal-interpreter 77b7f24 Use `-Wno-tabs` more targetted ba80fc6 Fix PowerPC build 55e9ab8 Update directory submodule to v1.2.5.0 release 83e4140 Comments only ed3bfca Update Win32 submodule to fix 77b7f24543f fallout 8946ee6 GHCi.Run: Remove redundant language pragma 53a567c configure.ac: Rename shake/ to build/ f857d27 configure.ac: Rename build/ to shake-build/ 9d921d6 Test Trac #11248, #11249 ff752a1 tcCheckSatisfiability: less aggressive superclass expansion 987426c SrcLoc: Eliminate constructors of RealSrcSpan d6b91ea Add test for T11122 4198b81 ghc.cabal: Backpack directory no longer exists 0e9a331 LLVM backend: Show expected LLVM version in warnings/errors e02a4c2 Fix build for AArch64/Arm64 9356393 Update terminfo submodule to v0.4.0.2 release 97281b4 Update terminfo submodule to v0.7.2.2 release ccc5a1a Build system: fix 'make sdist' d1416c3 Update .mailmap [skip ci] 5431273 Bump hsc2hs submodule b2670fc fix typo 2cc5b60 Documentation, tests for hsc2hs's new #alignment macro b028384 Add -Nmax RTS feature (#10728) 59de6e8 Add sparc64 a known architecture (Ticket #11211) 7b8a822 Make ghc-boot Hackage-ready 64b6a76 Fix typo in 7b8a8222e8f0 d8c8902 First pass at cleaning up ghci.cabal 34eaf2b Fix two occurences of `x86_HOST_ARCH` bcc213d Update time submodule to v1.6 release dd56eb1 Merge new commands from ghci-ng (re #10874) 59cc32c Update containers submodule to v0.5.7.1 release tag 3b66960 Remove unused/redundant fields from ghc-cabal. f7bd37e aclocal.m4: Fix llc/opt detection code 1a86413 Update binary submodule to final 0.8.0.0 release 8d95412 Disallow empty where bindings in pattern synonym declarations. 44640af Allow as-patterns in pattern synonym declarations. 29ca4a1 DynFlags: call defaultWays when creating defaultFlags 62155a6 TcTyClsDecls: use zipWith3M_ instead of generating triplets 850710a TcTyClsDecls: Add a type annotation d8ed20c Add Location to RdrName in FieldOcc b225b23 Modify IsString String instance (fixes #10814) eb7796f Warn about unused type variables in type families edcf17b Move Const to own module in Data.Functor.Const and enable PolyKinds 6457903 Implement phase 1 of expanded Floating 9f23dd9 testsuite: Add ClassOperator testcase 25db56c Minor clean-up to ghc-bin.cabal.in e29ee49 Fix AnnDotDot in module export 99b956e Fix-up GHC 7.12 artifacts ee6fba8 Encode strictness in GHC generics metadata c8c44fd Maintain cost-centre stacks in the interpreter 4bb9f88 TcTyClsDecls: Remove invalid comments about list monads fd1b5ae testsuite/ClassOperator: This actually should_fail a61e717 testsuite: Add testcase for #8316 eeecb86 Add proper GADTs support to Template Haskell 55250a6 Rename GHCi's UI modules into GHCi.UI(.*) ff3f918 Fix #11256 by not immediately erroring if we can't find a module. 2dff6c1 Added missing instances for Identity and Const (#11210) 1fcdcae testsuite/ClassOperator: Mark as compile_fail instead of should_fail fb3302c base: Add sections to changelog 083b700 users_guide: Synchronize relnotes with base changelog c12fc2e Update hoopl submodule to final 3.10.2.1 release aa7fb9a Fix GHCi segfault in Windows 32bit ff92395 Make HsAppsType contents Located 44de66b Update Cabal submodule to latest snapshot ea3f733 Comments only, about coercion holes b407bd7 Retain AnnTilde in splitTildeApps f975b0b Rework Template Haskell's handling of strictness 6eabd93 Update stm submodule to v2.4.4.1 release 29928f2 Fix grouping for pattern synonyms f40e122 Fix typechecking for pattern synonym signatures 51d8330 Remove duplicate T11224 test definition 7966eea Localize API Annotation in LInjectivtyAnn 01b0461 Remove another duplicate test 575a98e Refactor named wildcards (again) 721d56d APIAnnotations:AnnComma in wrong place in qcnames1 d3ce417 Tweak comments around UnivCos. 21b25df CoercionN is not in scope in TyCoRep 998739d Refactor package flags into several distinct types. 1faf1fc Implement -hide-all-plugin-packages and -plugin-package(-id), fixing #11244 3e99980 Update filepath submodule to latest snapshot 5f08681 - fix tests on OpenBSD which requires _DYNAMIC symbol 48e0634 Revert "Allow as-patterns in pattern synonym declarations." b55ad1b Wibble to error message in Trac #10426 1963250 Comments and white space c069be8 Add a pattern-syn form of PromotionErr 99eb002 Comments only 6eb9dc9 Tidy up and comment wildcards in family instances ed213ea Test Trac #11274 7ed0da6 Modify Nmax to maxN Trac #10728 dab8e34 Delete incorrect *-ws-32 expected test output 84f6739 - fix gc_thread related compilation failure on Solaris/i386 platform f13de71 Fix super-class cycle check b37f216 Comments only 7824870 Fix ASSERT in buildPatSyn, and T10897 test 380b25e Allow CallStacks to be frozen cb989e2 API Annotaions:add name in PatBind Match d1e9f82 Update tests for Trac #11039 f141f41 Test #10432 7cddcde Docs: -interactive-print should reside in registered package 3221599 Make testsuite work again with Py3 353e97a config.mk.in: Disable stripping by default on ARM 3017cbc ghc-cabal: Bring back TRANSITIVE_DEP_NAMES 6ec236b Improve SimplUtils.interestingArg d990354 Improve the runRW magic in CorePrep fcc7498 Improve tracing a bit in CoreSubst 1af0d36 Refactoring only e338376 Fix normalisation of TyCon representations 48db13d Don't drop last char of file if -osuf contains dot 2db18b8 Visible type application 2032635 Testsuite: fix qq005 and qq006 (#11279) bc8cac1 Testsuite: mark T7681 expect_broken (#11287) 5e4e9e0 Fix #11255. bd7ab66 Test #11254 in typecheck/should_compile/T11254 1411eaf Note [TyBinder] in TyCoRep 52da6bd Have mkCastTy look more closely for reflexivity. da69358 Fix #11287. b218241 Test #10589 in typecheck/should_compile/T10589 05e3541 Test #10619 in typecheck/should_fail/T10619 0fda908 Bump Haddock submodule again 8bf2d8f Linker: Fix cut-and-paste error in debug output 422107e T10518: Ensure literal has 64-bit type e39d10f testsuite/T8274: Remove 32-bit test output fb5d26d testsuite/codegen: Add missing dummy Makefiles 0b0652f testsuite/T9430: Fix word-size dependence b62215d Linker: Reenable Thumb support e8672e5 libraries/ghci: Implement mkJumpToAddr for ppc64 909bbdb Linker(ELF): Fix addProddableBlocks usage da5e693 testsuite/joao-circular: Clean up test results a3b34b6 Clean up a botched merge. d1ebbb0 testsuite/CmmSwitchTest: Mark as broken on 32-bit platforms 11778f7 Add testcase for getSizeofMutableByteArray# 07b3be7 integer-gmp: Fix #11296 bec5350 Adding flags: -ffull-guard-reasoning and too-many-guards c8d0af3 RTS: Detect powerpc64le as ELF 64-bit system 1b00016 The -package flag should select match from right-most package db. 0054bcd rts/Linker(ARM): Ensure all code sections are flushed from cache 01299ca Synchronise ghci-package version with ghc-package 4a10ecb Patch-level increment integer-gmp to 1.0.0.1 e01aa22 Patch-level increment integer-simple version 0.1.1.1 c7830bd Update hpc submodule to 0.6.0.3 version 3aa4a45 Update filepath submodule to v1.4.1.0 rls tag 295085c Update time submodule to latest snapshot bab5109 Make git-committer inferred version-date TZ-invariant 7fef7fe drop obsolete/redundant OPTIONS pragma [skip ci] af92ef3 ghc/Main: Update list of --print modes 4f69203 Fix panic when using pattern synonyms with DisambiguateRecordFields 5bb7fec Export some useful GHC API functions. 8e735fd Fix GEq1 when optimizations are enabled 2e49c8c users_guide: Move 7.12.1-notes to 8.0.1-notes 9cb79c5 Update a few references to GHC 7.12 b093e63 Modify getFullArgs to include program name df6cb57 Accept submodule libraries/primitive commit 1af89788d fcc7649 Introduce negative patterns for literals (addresses #11303) a1e01b6 testlib: Make TyCon normalization Python 2.6-compatible adcbc98 Add regression test for #11303 e4cc19d Update Cabal submodule to latest snapshot c6cab9d Remove `cabal07`-test broken by e4cc19de4bdbcc 34af60c testsuite: normalise away `ld`-warning on AIX c06b46d Fix #11305. 8fcf1e7 Make iserv-bin compatible with GHC version bump to 8.0 07779c2 T11303: Set maximum heap size 630303a users_guide/ghci: Fix heading 3bbc01a Testsuite: mark T7653 with high_memory_usage b0fa286 Fix some typos e9ab6d5 rts/PrimOps.cmm: fix UNREG profiled build d3a79bc rts/Linker.c: mark ia64 as 64-bit ELF, drop unused branches 0380a95 glasgow_exts.rst: fix code block 947c8a5 Bump GHC HEAD's Version from 7.11 to 8.1 bb7f2e3 Address #11245: Ensure the non-matched list is always non-empty 25e4556 Various API Annotations fixes 75851bf fix ghci build on ArchUnknown targets 0579fe9 Improve exprIsBottom 5ba3caa Comments only 70eefbc Test Trac #11245 351dea4 Drop redundant `-D__GLASGOW_HASKELL__=...` flag eae40e1 Use 0/1 instead of YES/NO as `__GLASGOW_HASKELL_TH__` macro value 0d20737 Drop redundant/explicit `=1` in `-DFOO=1` flags 2f923ce Drop pre-AMP compatibility CPP conditionals 3c8cb7f Remove some redundant definitions/constraints 12ee511 Remove ghc-7.8 `-package-name`-compat handling 37945c1 Simplify -fcmm-sink handling for Parser.hs 6a010b9 Update haskeline submodule to latest snapshot 8afeaad travis: use GHC 7.10.3 dafeb51 Canonicalise `MonadPlus` instances b469b30 Minor fix of MonadFail instance for `ReadPrec` ab0d733 Update Cabal submodule, Fixes #11326 f3cc345 Add strictness for runRW# 0b8dc7d API Annotations: AnnTilde missing 78daabc mk/config.mk.in: drop unused CONF_CC_OPTS for ia64 f5ad1f0 AnnDotDot missing for Pattern Synonym export 256c2cf Test Trac #11336 0490fed Linker: ARM: Ensure that cache flush covers all symbol extras d159a51 Linker: ARM: Refactor relocation handling 48e0f9c Linker: Make debugging output a bit more readable 07d127a Linker: Use contiguous mmapping on ARM d935d20 Omit TEST=T10697_decided_3 WAY=ghci 1dbc8d9 Add test for #10379 04f3524 Linker: ARM: Don't change to BLX if jump needed veneer c7d84d2 Update .mailmap [skip ci] 7e599f5 Linker: Move helpers to #ifdef da0f043 Rewrite Haddocks for GHC.Base.const 5c10f5c users_guide: Add ghci-cmd directive 4c56ad3 Build system: delete ghc-pwd 0acdcf2 Avoid generating guards for CoPats if possible (Addresses #11276) 1a8b752 Add (failing) test case for #11347 1f526d2 Release notes: Mention remote GHCi cdeefa4 ghc.mk: Add reference to Trac #5987 77494fa Remove -Wtoo-many-guards from default flags (fixes #11316) e32a6e1 Add Cabal synopses and descriptions bbee3e1 StgCmmForeign: Push local register creation into code generation bd702f4 StgCmmForeign: Break up long line aa699b9 Extend ghc environment file features 4dc4b84 relnotes: Note dropped support for Windows XP and earlier 852b603 Restore old GHC generics behavior vis-à-vis Fixity cac0795 Change Template Haskell representation of GADTs. 89ba83d Bump Cabal and Haddock to fix #11308 7861a22 Add a note describing the protocol for adding a language extension f01eb54 Fall back on ghc-stage2 when using Windows' GHCi driver 568736d users guide: Add documentation for custom compile-time errors 5040686 users guide: Add links to release notes 47367e0 Rewrite announce file 0a04837 users guide: Tweak wording of RTS -Nmax description 0839a66 Remove unused export 3f98045 Tiny refactor 97c49e9 Spelling in a comment 290a553 Tidy up tidySkolemInfo 4dda4ed Comment wibble 29b4632 Inline solveTopConstraints dc97096 Refactor simpl_top 02c1c57 Use an Implication in 'deriving' error a5cea73 Turn AThing into ATcTyCon, in TcTyThing 9915b65 Make demand analysis understand catch 1ee9229 Test Trac #10625 c78fedd Typos in docs and comments 6be09e8 Enable stack traces with ghci -fexternal-interpreter -prof 09425cb Support for qRecover in TH with -fexternal-interpreter 6f2e722 User's Guide: injective type families section 0163427 Fix Template Haskell's handling of infix GADT constructors 1abb700 Improve GHC.Event.IntTable performance c33e7c2 Fix +RTS -h when compiling without -prof 10769a1 Rename the test-way prof_h to normal_h 47ccf4d Add a pointer to the relevant paper for InScopeSet 2bd05b8 Docs for stack traces in GHCi f7b45c3 Build system: fix `pwd` issues on Windows 1cdf12c Fix test for T9367 (Windows) a6c3289 users_guide: Use semantic directive/role for command line options 86d0657 users-guide: A few fixes 8f60fd4 docs: Fix DeriveAnyClass reference in release notes and ANNOUNCE 67b5cec user-guide: More semantic markup 0dc2308 user-guide/safe_haskell: Fix typos a84c21e Reject import declaration with semicolon in GHCi 831102f Parser: delete rule numbers + validate shift/reduce conlicts 4405f9d Add failing testcase for #10603 5cb236d fix -ddump-splices to parenthesize ((\x -> x) a) correctly fbd6de2 Add InjectiveTypeFamilies language extension 4c9620f TrieMap: Minor documentation fix b1c063b ghc.mk: Use Windows_Target instead of Windows_Host 8e0c658 Linker: Define ELF_64BIT for aarch64_HOST_ARCH 00c8076 fix typo causing compilation failure on SPARC (ArchSparc -> ArchSPARC) 6cb860a Add -prof stack trace to assert 3e796e1 A little closer to supporting breakpoints with -fexternal-interpreter 88d6d5a Use implicit CallStacks for ASSERT when available d44bc5c TemplateHaskell: revive isStrict, notStrict and unpacked ac3cf68 Add missing type representations e782e88 Add test for Data.Typeable.typeOf c3f9246 Print a message when loading a .ghci file. 6ea24af Handle over-applied custom type errors too. c313327 Minor improvement in CoreDump outputs: c73333a Minor code refactoring 61011b4 users-guide: Wibbles 91dcc65 GHC.Generics: Fix documentation f0c4e46 Add tests for #11391 b0641ad INSTALL.md: Mention -j and other wibbles 78a4c72 Rename InjectiveTypeFamilies to TypeFamilyDependencies 4dbc31b users-guide: Update language extension implications b355b8f users-guide: Add since annotations for language extensions 83c13c2 user-guide: Use ghc-flag for dump formatting flags fd686c4 API Annotations: use AnnValue for (~) db371c1 T11300: Fix test on windows 49e414a Remove lookup of sections by name instead use the index numbers as offsets 91f1c60 Fix #11015 with a nice note. 8959b03 ANNOUNCE: Mention powerpc code generator b90cac6 user-guide: Note Cabal version limitation faf3f96 users-guide: Fix cabal version number c6a3e22 Link command line libs to temp so e7eec3a Use XZ compression by default 7cf16aa Don't output manpage in same directory as source 756b228 Refactor lookupFixityRn-related code following D1744 67fc3f3 configure.ac: Export MAKECMD to build system 443bf04 Allow pattern synonyms which have several clauses. 165ae44 Expand type/kind synonyms in TyVars before deriving-related typechecking e6ca930 Fix #11355. d4af57f Test #11252 in ghci/scripts/T11252 d459f55 Fix #10872. 6c07f14 Fix #11311 3a7f204 Clarify topological sorting of spec vars in manual 39ea4b4 Fix #11254. bafbde7 Constrained types have kind * in validity check. 072191f Fix #11404 33950aa Tiny refactoring in TcUnify 80b4c71 Fix typo in error message (#11409) 3c6635e Fix #11405. 148a50b Fix some typos 3a1babd Work SourceText in for all integer literals 9308c73 Fix a number of subtle solver bugs 3b6a490 Add missing T11408.hs ae1c48c rts/posix: Fail with HEAPOVERFLOW when out of memory during mmap d1ce1aa users-guide: Clean manpage build artifacts and fix usage of clean-target b3eb8fa Complete operators properly 65b810b Show TYPE 'Lifted/TYPE 'Unlifted as */# in Show TypeRep instance f3a867e Add testcase for #11414 2fd407c validate: Use gz compression during bindist check a7b751d un-wire-in error, undefined, CallStack, and IP 5a62b6a Simplify API to tcMatchTys f02200f Layout only cb24e68 Fix typecheck of default associated type decls b7e5c30 White space only 6e0c0fd Improve debug printing/warnings ec8a188 Refactoring on IdInfo and system derived names 8e6a68d Add Trac #11427 to Note [Recursive superclasses] e2c7b7e Implement scoped type variables in pattern synonyms 8e50301 Test Trac #11379 5412899 Typo in comment 817dd92 Fixes to "make clean" for the iserv dir b8abd85 Replace calls to `ptext . sLit` with `text` 240ddd7 Switch from -this-package-key to -this-unit-id. cbc03f1 ghci: Kill global macros list d2ea7f9 Hide derived OccNames from user 38666bd user-guide: Delete errant fragment aff51af users-guide: Begin documenting --frontend 80265c4 Typos in comments 9d33adb Check InScopeSet in substTy and provide substTyUnchecked 713aa90 Re-export ghc-boot:GHC.Serialized as Serialized 952eda2 Fix IfaceType generation for TyCons without TyVars 975bdac T11266: Improve the test by adding more of the other problematic modules 514bac2 Fix combineIdenticalAlts 0373a84 Oops. Add missing close-comment 5cce095 Use (&&) instead of `if` in Ix derivation 84b0ebe Rework derivation of type representations for wired-in things 225afc4 Add test T9407 (Windows) 6ddc991 Update submodule stm + random 48d4bc5 substTy to substTyUnchecked to fix Travis build 1ce1371 MkId: Update OpenKind reference 2e65aae Add comments about tyCoVarsOfType e604e91 Comments only c572430 Re-add missing kind generalisation 6f95e23 Comments only b3ee37c Improve pretty-printing of UnivCo 07afe44 Remove the check_lifted check in TcValidity b2e6350 Strip casts in checkValidInstHead 395ec41 Allow implicit parameters in constraint synonyms ede055e TyCoRep: Restore compatibility with 7.10.1 f23b578 user-guide:: Improve -D description 928484d user-guide: Refer to MIN_VERSION_GLASGOW_HASKELL from intro 3883f99 rel-notes: Note the return of -Wmonomorphism-restriction 7cb893f Update and improve documentation in Data.Foldable 96303db Add a missing .gitignore entry in annotations tests 2ffc260 Add -ignore-dot-ghci to tests that use --interactive 4c4a0a5 Fix docstring GHC.IO.Handle.FD.openFileBLocking 4c11db6 sphinx-build: fix python stack overflow (Trac #10950) b617e9f Improve comments in CmmSwitch 85e147e Always run test T9407 36b174d Add expected stderr for #11466 test case adb721b Make a constraint synonym for repeated BinaryStringRep and use it. 835a2a2 Default non-canonical CallStack constraints 2df4221 Add tests for #11465 and the kind invariant 9048c3d Don't print "Loaded GHCi configuration" message in ghc -e (#11478) 65881c0 Mark some ghci tests as req_interp 6e5f828 Fix a formatting error in the user's guide 4d51bfc Do not count void arguments when considering a function for loopification. b01288d rts: Disable tick timer unless really needed 4e04043 Add test for Trac #11056 f42db15 Remove unused IND_PERM 06c2547 Small doc fix 7cd37c5 Give a more verbose error message when desugaring a HsTypeOut 8e9a870 Remove -Wredundant-superclasses from standard warnings 1be8491 mkUserGuidePart: Better flag cross-referencing 6f96109 user-guide: Reformat warning lists b5e52bf user-guide: Fix typos ec87788 Don't add ticks around type applications (#11329) 923d215 user-guide: Document -L RTS flag 89bdac7 Add test for #11473 8b5ea7c User's guide: fix singular/plural typo in flagnames 98d6a29 Docs: delete section on Hierarchical Modules edc68b2 Remove `replaceDynFlags` from `ContainsDynFlags` 2c6fe5b Add -fwarn-redundant-constrains to test for #9708 fd6dd41 Implement `-Wnoncanonical-monadfail-instances` warning ff21795 Special-case implicit params in superclass expansion 746764c Refactor validity checking for type/data instances 42c6263 Avoid recursive use of immSuperClasses f7e0e5f Improve tracing in checkValidInstance 3c060f3 Fix exprIsHNF (Trac #11248) 5c82333 Show error message for unknown symbol on Elf_Rel platforms edb30fd Comments only: more alternate names for ARM registers [skip ci] bc1e085 HscTypes: Fix typo in comment 132c208 Rename -Wmissing-monadfail-instance to plural-form 6e2658f Better document behavior of -Wmissed-specialisations 128b678 user-guide: Note order-dependence of flags f0f63b3 Implement -Wunrecognised-warning-flag 9fe7d20 Ensure that we don't produce code for pre-ARMv7 without barriers 632f020 Less verbose output for the in-scope set cf788a5 White space only 47b3f58 Add "ticks-exhausted" comment 1c6d70c Kill off zipTopTCvSubst in favour of zipOpenTCvSubst 016a0bd Fix two cloning-related bugs 34c9a4e Missed plural renaming in user's guide 5f5dc86 Minor users-guide markup fixup [skip ci] 9b71695 Update transformers submodule to 0.5.1.0 release f1885df Update process submodule to 1.4.2.0 release 3798b2a Fix three broken tests involving exceptions 01809bc Pass InScopeSet to substTy in lintTyApp e24a9b5 Nicer error on +RTS -hc without -rtsopts or -prof 6d2bdfd Fix segmentation fault when .prof file not writeable 6817703 Split off -Wunused-type-variables from -Wunused-matches 144ddb4 Construct in_scope set in mkTopTCvSubst eeb67c9 Testsuite: fixup req_profiling tests (#11496) e2bdf03 Build profiling libraries on `validate --slow` (#11496) 44a5d51 Enable RemoteGHCi on Windows 45fd83b Fix a typo in the note name in comments 448ea97 Typos in comments 1f6d142 ghci: fix trac issue #11481 1c6130d rts/Timer: Actually fix #9105 0dc7b36 Restore original alignment for info tables 0d92d9c Use stage1 build variables when building the RTS d50609e Test for undef bugs in the LLVM backend when validating 45c6fbc Document -fllvm-fill-undef-with-garbage 4faa1a6 s/unLifted/unlifted for consistency 2899aa5 Fix some substitution InScopeSets 00cbbab Refactor the typechecker to use ExpTypes. 5dcae88 Rename "open" subst functions 85daac5 Fix cost-centre-stack bug when creating new PAP (#5654) a496f82 Remote GHCi: create cost centre stacks in batches 71b1183 Update profiling test output 0d5ddad fix validate breakage 63700a1 Use the in_scope set in lint_app 1b72534 Fixup test for #10728 61e4d6b Mark dynamic-paper as expect_fail_for optasm and optllvm (#11330) d3b7db0 Fix the Windows build 0dd663b Add closing parenthesis in comment for eqString (#11507) bc83c73 Add release note about flexible RebindableSyntax bb956eb Add asserts to other substitution functions 6c7760b Define CTYPE for more Posix types 2fbf370 Update unix submodule to latest snapshot b61f5f7 Put docs in /usr/share/doc/ghc- 4d0e4fe Add type signatures. 90f688e Code formatting cleanup. 6544f8d Properly track live registers when saving the CCCS. 669cbef Fix Trac issue #11487. 34519f0 When encountering a duplicate symbol, show source of the first symbol f8e2b7e Minor doc fixes to GHC.Generics a883c1b Missing @since annotations in GHC.Generics e5a0a89 Suppress substitution assertions to fix tests 0d60165 Simplify ghc-boot database representation with new type class. 94048f9 Hide the CallStack implicit parameter 86897e1 Implement basic uniform warning set tower ba88aab Fix LOOKS_LIKE_PTR for 64-bit platforms 2ad46a8 Add some Outputable instances 02e3ce0 Typo in docs 7329310 Fix runtime linker error message when old symbol had no owner dd0b7c7 Avoid mangled/derived names in GHCi autocomplete (fixes #11328) ddd38e7 Update unix submodule to latest snapshot af8fdb9 TyCoRep: Implement some helpers for dropping/checking Levity arguments 2fb6a8c Remote GHCi: Optimize the serialization/deserialization of byte code 7cb1fae Remote GHCi: batch the creation of strings c996db5 Remote GHCi: parallelise BCO serialization 01c587c Fix Windows build after D1874 07ed241 Use a correct substitution in tcCheckPatSynDecl a7ad0b9 Make TypeError a newtype, add changelog entry db97ed9 Add (failing) test for #11247 871c96f TcMType: Add some elementary notes 92c46a4 Update cabal_macros_boot.h 483858e Update binary submodule to 0.8.2.0 release db121b2 Allow all RTS options to iserv 28f951e Overhaul the Overhauled Pattern Match Checker bbc0ec5 Fix a few loose ends from D1795 4f9967a Remove unused LiveVars and SRT fields of StgCase and StgLetNoEscape 91a56e9 Use default xz compression level 70980b1 GHCi: Fix Windows build (again) 8aa9f35 Fix @since annotations for renamed pretty{CallStack,SrcLoc} 38af3d1 Add a derived `Show SrcLoc` instance b49d509 Add test for #11516 5d73fb6 Revert "Remove unused LiveVars and SRT fields of StgCase and StgLetNoEscape" f1f5837 unlit: mark local functions as 'static' 72545c7 hp2ps: mark local functions as 'static' f3923d5 testsuite: ignore *.prof.normalised files 1060301 mkDocs: Update for xz c96acf3 mkDocs: Fix fallout from c5f4f95c64006a9f 66fa0ed validate: enable -DDEBUG in stage 1 by default 7362809 rts: drop unused calcLiveBlocks, calcLiveWords 9e43c7f rts: mark scavenge_mutable_list as static 4f283a6 rts: mark 'copied' as static 256c1b3 rts: drop unused getThreadCPUTime 3dbd836 rts: mark 'wakeBlockingQueue' as static 8abc7e7 rts: drop unused mut_user_time_during_heap_census 39cba20 rts: mark 'removeFromRunQueue' as static 7a48865 rts: mark 'setProgName' as static a49c9d4 rts: drop unused 'traverseAllRetainerSet' c358567 rts: mark 'blockedThrowTo' as static e1ca583 rts: mark 'ccs_mutex' and 'prof_arena' as static 0e51109 rts: drop unused 'traceEventThreadRunnable' 0a2bd9c rts: mark 'shutdownCapability' as static c0a0ee3 Fix haddocks for TypeError b3e9452 Bump haddock submodule 8263d09 Remove unused export from TcUnify 2cf3cac Allow foralls in instance decls 20f90ea Fix SimpleFail12 error output e2b66a0 user-guide: Add cross-reference for -XUnicodeSyntax 4e65301 Add Edward Kmett's example as a test case 6036cb6 Comments only, on the invariants of GlobalRdrEnv a96c4e7 Add comments to TcCoercibleFail ee11a84 White space and comments only 8871737 Document and improve superclass expansion e72665b Comment out some traceFlat calls 7212968 Improve tracing in TcInteract d6b68be Improve error messages for recursive superclasses f79b9ec Use runTcSDeriveds for simplifyDefault 6252b70 A small, local refactoring of TcSimplify.usefulToFloat 43e02d1 Fix a nasty superclass expansion bug 5a58634 release notes: Note new two-step allocator 96d4514 Some tiding up in TcGenDeriv fac0efc Define mkTvSubst, and use it c9ac9de Test Trac #11552 489a9a3 Define tyConRolesRepresentational and use it 023fc92 Remove unused LiveVars and SRT fields of StgCase da19c13 Print * has Unicode star with -fprint-unicode-syntax 16cf460 testsuite: Un-break T5642 4ec6141 Fix the removal of unnecessary stack checks 04fb781 Early error when crosscompiling + haddock/docs bfec4a6 Unset GREP_OPTIONS in build system 1f894f2 Restore derived Eq instance for SrcLoc c8702e3 TcErrors: Fix plural form of "instance" error 99cb627 TcPatSyn: Fix spelling of "pattern" in error message 7953b27 DynFlags: drop tracking of '-#include' flags 2f9931e add Template Haskell regression test for #9022. 93e2c8f Expand users' guide TH declaration groups section (#9813) d80caca Error early when you register with too old a version of Cabal. c57d019 docs: add newline after '.. ghc-flag::' a824972 mkUserGuide: fix option wrapping in a table b565830 Wrap solveEqualities in checkNoErrs d27da53 Replace mkTvSubstPrs (a `zip` b) with zipTvSubst a b 8500855 Always do eta-reduction 62d1888 Comments about ru_auto 023bf8d Ignore untracked in nofib 51a3392 sizeExpr: fix a bug in the size calculation 46af683 compiler: Do not suggest nor complete deprecated flags fix trac issue #11454 efba41e Another batch of typo fixes in non-code dbf72db Build the substitution correctly in piResultTy b7dfbb4 Add test for #11319 8da6a16 Revert "sizeExpr: fix a bug in the size calculation" be3d7f6 Add IsList instance for CallStack, restore Show instance for CallStack f3b9db3 Revert "Build the substitution correctly in piResultTy" c6485d5 Simplify AbsBinds wrapping 1251518 Beef up tc124 d084624 Improve pretty-printing of HsWrappers 24305be Minor refactoring to tauifyMultipleMatches 6cf9b06 User manual improvments f37bb54 testsuite: tweak error messages for new Show instance cd4a7d0 renamer discards name location for HsRecField 4bba19a Update directory submodule to v1.2.5.1 release 18cd712 Improve error message suppression bb7f230 Comments only 160765f Document -dynamic-too (#11488) f6b98ea Tiny refactor; use guards instead of 'if' 0057125 Comments and white space e2f7d77 A tiny, outright bug in tcDataFamInstDecl 023742e Add a testcase for #11362 426a25c Make T11361 actually run with reversed uniques 3c39bec Rename missing-pat-syn-sigs to missing-pat-syn-signatures ed69b21 Add missing newlines at end of file [skip ci] d066e68 Testsuite: delete only_compiler_types, assume ghc c8df3f1 Bump haddock submodule 525a304 Make bootstrapping more robust 693a54e Improved error message about exported type operators. af5a0e5 Fix two wrong uses of "data constructor" in error msgs 3116003 PowerPC: Improve float register assignment. 49c5cb4 Fix typos 5fc06b9 Suggest candidate instances in error message ad30c76 Remove documentation for -Wlazy-unlifted-bindings 2b906af DynFlags: Don't panic on incompatible Safe Haskell flags 6f25fb3 Testsuite: delete compiler_lt/le/gt/ge setup functions 34c9523 Comments only 21b4228 Simplify the defn of coreViewOneStarKind 4c6e95e Small refactor and comments b962bcc Make exactTyCoVarsOfTypes closed over kinds. 90f3561 Existentials should be specified. aff5bb4 Add missing kind cast to pure unifier. 7d8031b Remove extraneous fundeps on (~) 6f952f5 Use CoercionN and friends in TyCoRep 43468fe Fix #11241. 489e6ab Fix #11246. a615215 Fix #11313. 67d2226 Derive Eq and Ord instance for SrcLoc and RealSrcLoc a82956d Remove superfluous code when deriving Foldable/Traversable 525b54c users-guide: Fix typos 0c420cb Comments only (#11513) 27842ec Fix thinko that crept into D1908 01449eb Fix desugaring of bang-pattern let-bindings b529255 (Another) minor refactoring of substitutions 4d031cf Improve piResultTys and friends a008ead Take type-function arity into account 206a8bf Unwire Typeable representation types 0b68cbe Bump haddock submodule 8b073f6 A few more typos in non-code 2f733b3 Delete support for deprecated "-- # ..."-style haddock options d738e66 Modifier letter in middle of identifier is ok c6007fe Pass -haddock to tests in should_compile_*flag*_nohaddock a8653c8 Docs: no space in `-i⟨dir1⟩:⟨dir2⟩` [skip ci] 6cec905 Refactoring only: use ExprLStmt 3259bf6 Fix a bug in ApplicativeDo (#11612) 2340485 Fix a double-free bug in -fexternal-interpreter 80d35be Use a better test for profiling 1ef7add Add test (only) to assure that #11535 is fixed 9634e24 unexport MAKEFLAGS when running tests (#11569) 0b00add Add test for #6132: hash bang + CPP 6e691ca Testsuite: pass '-s --no-print-directory' to MAKE f451039 Build system: fix sed expression (#11537) bb9cd45 Fix GHC.Stats documentation markup (#11619) ed11909 Docs: -keep-llvm-file(s)/-ddump-llvm imply -fllvm d3cf2a9 Add missing files 31c312e Testsuite: delete Windows line endings [skip ci] (#11631) 8626ac9 Testsuite: delete Windows line endings [skip ci] (#11631) 754a2f2 Testsuite: delete Windows line endings [skip ci] (#11631) 6074c10 Testsuite: delete Windows line endings [skip ci] (#11631) d5e8b39 Testsuite: delete Windows line endings [skip ci] (#11631) 978c3ea Testsuite: accept output without Windows line endings (#11631) 42f06f6 Testsuite: accept output without Windows line endings (#11631) 28620ba Testsuite: delete Windows line endings [skip ci] (#11631) 6d0aa9f Testsuite: delete Windows line endings [skip ci] (#11631) 73e4095 Testsuite: cleanup profiling/should_run/all.T (#11521) 176be87 Filter out -prof callstacks from test output (#11521) 661aa07 Testsuite: failing profiling tests (#10037) 2aee419 Allow combining characters in identifiers (#7650) a3e0e93 Testsuite: MAKEFLAGS is magic, do not unexport it 32a9a7f Extend `-Wunrecognised-warning-flag` to cover `-f(no-)warn-*` ce36115 Follow-up to 32a9a7f514bdd33ff72a673ade d8c64e8 Address #11471 by putting RuntimeRep in kinds. a9dc62a Remove "use mask" from StgAlt syntax 009a999 TyCoRep: Add haddock sections c1efdcc Overload the static form to reduce verbosity. feb19ea testsuite: mark tests broken on powerpc64 8e19d3a base: A selection of fixes to the comments in GHC.Stats 0c7db61 ApplicativeDo: Handle terminal `pure` statements 6319a8c HscMain: Delete some unused code 673efcc Add more type class instances for GHC.Generics 6658491 Make warning names more consistent 52879d1 Reconstruct record expression in bidir pattern synonym ebaa638 Bump haddock.base allocations 073e20e cmpTypeX: Avoid kind comparison when possible 6739397 (Alternative way to) address #8710 6350eb1 Handle multiline named haddock comments properly e38c07b Improve accuracy of suggestion to use TypeApplications 20ab2ad Note new GHC.Generics instances in release notes 116528c Improve pattern synonym error messages (add `PatSynOrigin`) 8e6e022 Testsuite: Introduce config.plugin_way_flags. e02b8c8 Testsuite: for tests that use TH, omit *all* prof_ways 90fa8cf Mark tests for #11643, #11644, #11645 and #9406 expect_broken 9b49c65 Testsuite: delete empty files [skip ci] 1badf15 Testsuite: do not write empty files on 'make accept' bb5afd3 Print which warning-flag controls an emitted warning bbfff22 Unconditionally handle TH known key names. a026112 Typos in comments, etc. e3f341f Fix and refactor strict pattern bindings a81e9d5 Special case for desugaring AbsBinds 4ddfe13 Get the right in-scope set in specUnfolding 7496be5 Exclude TyVars from the constraint solver 253ccdf Comments and white space only b4dfe04 Fix kind generalisation for pattern synonyms e193f66 Filter out BuiltinRules in occurrence analysis ef7b1d5 Test Trac #11611 eee040c Update transformer submodule to v0.5.2.0 release 890e2bb GHC.Generics: Ensure some, many for U1 don't bottom 3ee4fc0 rts: drop unused global 'blackhole_queue' b9c697e Print which flag controls emitted desugaring warnings 869d9c6 Print which flag controls emitted lexer warnings 82f200b Annotate `[-Wredundant-constraints]` in warnings (re #10752) b6c61e3 Print which flag controls emitted SafeHaskell warnings 3cd4c9c Annotate `[-Wdeferred-type-errors]` in warnings (re #10752) 46f3775 Default to -fno-show-warning-groups (re #10752) 171d95d Missing Proxy instances, make U1 instance more Proxy-like ad4428d base: Mark Data.Type.Equality as Trustworthy 2535c82 Fix bug where reexports of wired-in packages don't work. f72bdbd Refactor `warnMissingSignatures` in `RnNames.hs` 16e97c1 Build system: Correctly pass `TARGETPLATFORM` as host 2e49a31 DynFlags: Add -Wredundant-constraints to -Wall e3b9dbf Testsuite: check actual_prof_file only when needed de01de7 Remove some more Windows line endings [skip ci] f8a5dd0 Only add -fshow-warning-groups for ghc >= 7.11 (#10752) 49c55e6 Skip TEST=TcCoercibleFail when compiler_debugged 3c29c77 Do not check synonym RHS for ambiguity 243e2ab Comments only 2d52c3a A bit more tracing in TcHsType.tcTyVar a0899b2 Remove unnecessary isTyVar tests in TcType 57b4c55 Don't complain about unused Rule binders 286dc02 Fix an outright bug in expandTypeSynonyms aea1e5d Use tyConArity rather than (length tvs) 91a6a9c Add Monoid instance for FastString 15517f3 SimplEnv: Add Haddock headings to export list 1f3d953 users-guide: Mention #11558 in release notes 120b9cd rts/timer: use timerfd_* on Linux instead of alarm signals 6ca9b15 GHCi: Fix load/reload space leaks (#4029) 3801262 Fix printing of an `IfacePatSyn` 1d6177b Using unsafe foreign import for rtsSupportsBoundThreads (part of #9696) bd681bc Drop module qualifier from punned record fields (#11662) ade1a46 Fix minimum alignment for StgClosure (Trac #11395) 5e2605e GhcMake: Clang/ASSERT fix 13a801a Revert "Mark tests for #11643, #11644, #11645 and #9406 expect_broken" 82e36ed Reduce fragmentation from m32_allocator 90e1e16 Split external symbol prototypes (EF_) (Trac #11395) 1a9734a template-haskell: Drop use of Rank2Types/PolymorphicComponents 941b8f5 template-haskell: remove redundant CPP use 1c76e16 template-haskell: define `MonadFail Q` instance 4c3a0a4 Fix the implementation of lazyId 5a494d8 Refactoring around TcPatSyn.tcPatToExpr 374f919 Update Cabal submodule to latest HEAD snapshot c42cdb7 fix Float/Double unreg cross-compilation fc16690 Fix #11624, cannot declare hs-boot if already one in scope. c937f42 Add regression test for #11555 a1c4230 Use catchException in a few more places 30ee910 Make `catch` lazy in the action f3def76 add regression test for #11145. 767ff7c Document Quasi-quotes/list comprehension ambiguity a74a384 Include version in AC_PACKAGE_TARNAME f8056fc Make integer-gmp operations more strict d48220e Add Note [Running splices in the Renamer] 90b8af0 Fix readme link to FixingBugs wiki page 06b70ff Add doc to (<$>) explaining its relationship to ($) 8626d76 rtx/posix/Itimer.c: Handle return value of `read` 6a2992d Add MonadUnique instance for LlvmM e764ede Add ghc-flag directory for -XPatternGuards 2908ae8 Handle unset HOME environment variable more gracefully 3ea11eb Move getOccFS to Name 7ba817c Bump allocations for T6048 2f45cf3 Add -foptimal-applicative-do e46742f rts: fix threadStackUnderflow type in cmm 4d791b4 Simplify: Make generated names more useful 41051dd ghci: add message when reusing compiled code #9887 92821ec LlvmCodeGen: Fix generation of malformed LLVM blocks 9ee51da users_guide: Break up -fprint-* description d12166a Fix the name of the Word16ElemRep wired-in datacon 3f60ce8 Add regression test for #11702 18fbfa3 Move and expand (slightly) TypeApplications docs e9bf7bb Fix #11407. 84c773e Fix #11334. 35d37ff Fix #11401. 972730c Refactor visible type application. 6c768fc Expand Note [Non-trivial definitional equality] 693b38c Test case for #11699 in typecheck/should_compile e7a8cb1 Document TypeInType (#11614) 55577a9 Fix #11648. 3f5d1a1 Allow eager unification with type families. de4df6b Testsuite wibbles from previous commits. 19be538 Remove redundant anonymiseTyBinders (#11648) 857e9b0 Incorporate bgamari's suggestions for #11614. 1eefedf Fix #11357. aade111 Fix #11473. f602f4a Fix printing of "kind" vs. "type" 5d98b8b Clean up some pretty-printing in errors. 46f9a47 DriverPipeline: Fix 'unused arguments' warnings from Clang b5565f1 Fix #11711. c5ed41c typechecker: fix trac issue #11708 3fe87aa Fix #11716. f4f315a Fix #11512 by getting visibility right for methods 220a0b9 Add test for #9646 3ddfcc9 PrelRules: Fix constant folding for WordRemOp 2841cca Mark GHC.Real.even and odd as INLINEABLE c095ec5 Ensure T11702 always runs with optasm c0f628d Revert "Add test for #11473" cb7ecda Fix duplicate T11334 test 08d254b Fix T9646 7186a01 Dwarf: Add support for labels in unwind expressions ba95f22 prof: Fix heap census for large ARR_WORDS (#11627) b735e99 DsExpr: Don't build/foldr huge lists 289d57a Add test for incompatible flags (issue #11580) cb3456d base: Rework System.CPUTime e6a44f2 T11145: Fix expected output 286c65f base: Fix CPUTime on Windows 3ade8bc Delete a misleading comment in TyCon 2cb5577 Remove unnecessary Ord instance for ConLike c37a583 Remove unused substTyWithBinders functions af2f7f9 Fix exponential algorithm in pure unifier. 01b29eb TypeApplications does not imply AllowAmbiguousTypes 0706a10 Add two small optimizations. (#11196) 1701255 Fix #11635 / #11719. 0b89064 Make equality print better. (#11712) f8ab575 Rename test for #11334 to 11334b, fixing conflict 3e1b882 Prevent eager unification with type families. 9477093 Comment a suspicious zonk in TcFlatten. 35e9379 Track specified/invisible more carefully. 5c0c751 Zonk before calling splitDepVarsOfType. d978c5e Fix #11723 and #11724. e19e58c Improve panicking output 1934f7f stgMallocBytes: Tolerate malloc(0) returning a NULL ptr 2d6d907 Comments (only) in TcFlatten 6f0e41d PPC NCG: Emit more portable `fcmpu 0, ...` instead of `fcmpu cr0, ...` 685398e Use the correct in-scope set in coercionKind 0beb82c Avoid running afoul of the zipTvSubst check. 7e74079 Comment fix 7d5ff3d Move applyTysX near piResultTys db9e4eb Move DFunUnfolding generation to TcInstDcls e57b9ff Fix regression test for #11145. 2ddfb75 base: Fix ClockGetTime on OS X da3b29b Ensure T9646 dump-simpl output is cleaned 8048d51 ErrUtils: Add timings to compiler phases 997312b Add `PatSynSigSkol` and modify `PatSynCtxt` 2708c22 Close ticky profiling file stream after printing (#9405) 03a1bb4 Add unicode syntax for banana brackets 6c2c853 Various ticky-related work 9f9345e Create empty dump files (fixes #10320) 0db0594 DsExpr: Rip out static/dynamic check in list desugaring 8335cc7 Add expected output for T9405 ef653f1 Revert "Various ticky-related work" 1448f8a Show: Restore redundant parentheses around records 371608f Default RuntimeRep variables unless -fprint-explicit-runtime-reps 0bd0c31 Defer inlining of Eq for primitive types 2b5929c Comments only cb08f8d Tidy up handling of coercion variables 343349d Avoid local label syntax for assembler on AIX 2cebbe6 users_guide: Fix various issues 8ff6518 users-guide: Add -Wredundant-constraints to flags reference 173a5d8 users_guide: small improvements on pattern synonyms. 2414952 Add option `no-keep-hi-files` and `no-keep-o-files` (fixes #4114) df26b95 Add NCG support for AIX/ppc32 4dc8835 Remove code-duplication in the PPC NCG 26f86f3 base: Fix GHC.Word and GHC.Int on 32-bit platforms 84dd9d0 An extra traceTc in tcExpr for ExprWithSig 356e5e0 Do not eta-reduce across Ticks in CorePrep 12372ba CorePrep: refactoring to reduce duplication 067335a A raft of comments about TyBinders b416630f Test Trac #11728 da4bc0c Document implicit quantification better 454585c More clarification in docs for implicit quantification 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 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 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 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 3c426b0 Add uniqSetAny and uniqSetAll and use them 7312923 Kill mapUniqSet 32c0aba Testsuite: delete -fesc tests e20b3ed Testsuite: delete T5054 and T5054_2 (#5054) bcfee21 rts/LdvProfile.c: Fix NULL dereference on shutdown f255f80 Linker: Fix implicit function declaration warning on OS X 6e195f4 Remove unused foldFsEnv 031de8b Remove unused foldNameEnv f99db38 Fix path to the new build system, now called Hadrian. 0fa1d07 testsuite: fix up T11223's Makefile a2970f8 RTS: delete BlockedOnGA* + dead code c5919f7 Remove the incredibly hairy splitTelescopeTvs. 7242582 Test #11484 in th/T11484 00053ee Fix typo: Superclases -> Superclasses b725fe0 PPC NCG: Improve pointer de-tagging code c4259ff Testsuite: make CLEANUP=1 the default (#9758) 2ae39ac Testsuite: accept new output for 2 partial-sigs tests 2fe7a0a Fix reference to Note in TcCanonical cb05860 Comment typos: Mkae -> Make, Hsakell -> Haskell 49bae46 Comment typo: unambigious -> unambiguous f69e707 Typos in DmdAnal e6627d1 Fix aggressive cleanup of T1407 868d2c4 rts: Remove deprecated C type `lnat` eac6967 users-guide: Add index entry for "environment file" 18676a4 Bump haddock submodule 533037c Greater customization of GHCi prompt 16a51a6 rts: Close livelock window due to rapid ticker enable/disable 65e13f6 rts: Split up Itimer.c df9b772 Catch errors from timerfd_settime 55f4009 Kill Itimer.h 999c464 rts/itimer/pthread: Stop timer when ticker is stopped 116d3fe Remove unused getScopedTyVarBinds 1161932 Add T11747 as a test ecc0603 deriveConstants: Fix nm advice one last time a28611b Export constructors for IntPtr and WordPtr ea34f56 Remove unused equivClassesByUniq cd85dc8 Make sure record pattern synonym selectors are in scope in GHCi. db2bfe0 added docstring for '-fhistory-size' flag 81d8a23 glasgow_exts.rst: fix quoting c5be5e2 docs/users_guide/glasgow_exts.rst: fix merge conflict fa86ac7 Make validDerivPred ignore non-visible arguments to a class type constructor 36d29f7 StaticPointers: Allow closed vars in the static form. 5f8c0b8 Revert "Revert "Use __builtin_clz() to implement log_1()"" ef44606 Cleanups related to MAX_FREE_LIST 0051ac1 Update libraries/hpc submodule to v0.6.0.3 release tag 4466ae6 Update bytestring submodule to 0.10.8.0 release tag 50e7055 Export oneShot from GHC.Exts f9d9375 Adjust testsuite output to bytestring-0.10.8.0 76ee260 Allow limiting the number of GC threads (+RTS -qn) f703fd6 Add +RTS -AL 1fa92ca schedulePushWork: avoid unnecessary wakeups dbcaa8c Don't STATIC_INLINE giveCapabilityToTask aa5e2dd Make 'make fast' work for the User Guide b75d194 Be more aggressive when checking constraints for custom type errors. 4f2afe1 testsuite: Add test for #11959 763610e base: Export runRW# from GHC.Exts ad4392c Kill non-deterministic foldUFM in TrieMap and TcAppMap db9de7e rts: Replace `nat` with `uint32_t` e340520 Comments only explaining export list parsing. 94f2ee1 Explain linter optimization for StaticPtr checks. 990ce8c Use tcExtendGlobalValEnv for default methods ecc1d58 Update Win32 submodule to v2.3.1.1 release tag 018487e Fix pretty printing of IEThingWith fe190ae Remove trailing whitespace from 'testsuite/tests/module/all.T' 633b099 Update time submodule to 1.6.0.1 release tag 8e5776b rts/ProfHeap.c: Use `ssize_t` instead of `long`. dd3e847 Documentation for simplifyDeriv. 260a564 Use stdint types for Stg{Word,Int}{8,16,32,64} 2593e20 White space only 76d9156 Emit wild-card constraints in the right place cc75a5d Comments only e1ff2b4 Fix partial sigs and pattern bindings interaction 9dbf5f5 Tidy up partial-sig quantification bb296bf Error message wibbles, re partial type sigs 0597493 Re-do the invariant for TcDepVars 3ca7806 stg/Types.h: Fix comment and #include 53f26f5 Forbid variables to be parents in import lists. e996e85 RdrHsSyn: Only suggest `type` qualification when appropriate ea3d1ef Fix a crash in requestSync() bff6e1b Comments only 4ac0e81 Kill unnecessary cmpType in lhs_cmp_type b58b0e1 Make simplifyInstanceContexts deterministic a4717f5 Comments about static forms b21e8cc Comments only e7e5939 Add Outputable ShowHowMuch e24b50c Use partial-sig constraints as givens 1a43783 Record that EqualityConstraint now works f6e58be Test Trac #11640 7e28e47 Get rid of Traversable UniqFM and Foldable UniqFM 402f201 Fix typos ab91b85 make accept for Make simplifyInstanceContexts deterministic e207198 Kill foldUFM in classifyTyCon 8669c48 Document why closeOverKind is OK for determinism 584ade6 RtsFlags: Make `mallocFailHook` const correct 0efbf18 rts: Fix C compiler warnings on Windows 9363f04 Handle promotion failures when scavenging a WEAK (#11108) 0e71988 Remove some varSetElems in dsCmdStmt 3edbd09 Document SCC determinism cfc5df4 Fix ASSERT failure and re-enable setnumcapabilities001 2a0d00d Make random an "extra" package 86a1f20 Remove a copy of System.Random and use reqlib('random') b5f85ce Remove stale comment. da105ca Don't prematurely force TyThing thunks with -ddump-if-trace. 925b0ae Make absentError not depend on uniques eae3362 docs: add skeleton 8.2.1 release notes e217287 Bump haddock submodule c079de3 Add TH support for pattern synonyms (fixes #8761) e53f218 Fix deriveTyData's kind unification when two kind variables are unified b8e2565 Make Generic1 poly-kinded 6971430 Allow putting Haddocks on derived instances 01bc109 Document zonkTyCoVarsAndFV determinism 6bf0eef Kill varEnvElts in specImports 69c974f Use StgHalfWord instead of a CPP #if 995cf0f rts: Make function pointer parameters `const` where possible 0c0129b RtsUtils: Use `size_t` instead of `int` where appropriate 7c0b595 Fix comments about scavenging WEAK objects 5416fad Refactor some ppr functions to use pprUFM bd01bbb Test Trac #12039 8e48d24 Bump haddock submodule e4834ed Fix a performance issue with -fprint-expanded-synonyms c974927 Update bytestring submodule to 0.10.8.1 release tag bf669a0 Bump haddock submodule 2dbdc79 PPC NCG: Fix pretty printing of st[wd]ux instr. 563a485 PPC: Implement SMP primitives using gcc built-ins d78faa1 testsuite/ImpSafe03: Normalize version of bytestring eed820b Move Extension type to ghc-boot-th 21fe4ff Kill varSetElems in tcInferPatSynDecl d20d843 Another bump of haddock submodule 7814420 Remove html_theme requirement of haddock docs 4a037a9 Set `USE_MMAP` at configure time 770d708 Add ghc-boot-th to rules/foreachLibrary dc94914 Document determinism in shortOutIndirections 3f3dc23 Testsuite: run tests in /tmp after copying required files 1a9ae4b Testsuite: delete old cleanup code (#11980) a9dd9b7 Testsuite: delete unused file [skip ci] c92cfbc Testsuite: don't skip concio001 and concio001_thr 931b3c7 Delete libraries/ghci/GNUmakefile [skip ci] a54d87a rules: Fix name of ghc-boot-th library 5d80d14 rules/build-prog: Ensure programs depend upon their transitive deps 33c029d rts: More const correct-ness fixes b088c02 Testsuite: T10052 requires interpreter (#11730) 3251743 Testsuite: don't warn when mk/ghcconfig_* hasn't been created yet 77ee3a9 Update .mailmap [skip ci] fffe3a2 Make inert_model and inert_eqs deterministic sets f0f0ac8 Fix histograms for ticky code ba3e1fd Add a test for #11108 39a2faa Rework parser to allow use with DynFlags 310371f rts: Add isPinnedByteArray# primop f091218 CLabel: Catch #11155 during C-- pretty-printing 9dd0481 Add (broken) test for #12063. 5f1557e Failing test case for #12076. f18e8d8 rts: Add missing `const` from HashTable API 6282bc3 Kill varSetElems in tidyFreeTyCoVars 13e40f9 Kill varEnvElts in tcPragExpr 72b677d Fix Trac #12051 ad7f122 Improve pretty-printing of equalities f9e90bc Improve documentation for type wildcards 0bfcfd0 Comments only d1efe86 Comments only 358567a testsuite: Add expected output for T11108 470def9 Testsuite: fix T11827 (#11827) 296b8f1 Add libraries/ghci/GNUmakefile to .gitignore [skip ci] f0f3517 Remove use of caddr_t 8abc193 Get types in osFreeMBlocks in sync with osGetMBlocks 464b6f8 {,M}BLOCK_SIZE_W * sizeof(W_) -> {,M}BLOCK_SIZE 2e6433a testsuite: Add a TypeRep test a88bb1b Give lifted primitive types a representation 1ee47c1 Use the correct return type for Windows' send()/recv() (Fix #12010) 3910306 Add -XStaticPointers to the flag reference. 08e47ca FunDep printer: Fix unicode arrow 43589f5 testsuite: add CmmSwitchTest for 32-bit platforms ae7e9cb Fix Windows build after Ticky changes 8e92974 Testsuite: mark T8761 expect_broken #12077 a1f3bb8 Fix failing T12010 d9cb7a8 compiler/iface: compress .hi files e44a6f9 users-guide: Vector version of Thomson-Wheeler logo 6d6d6e4 rules/sphinx: Add missing dependency on conf.py for pdf rule cf1efc7 users-guide: Fix index in PDF output da3c1eb Enable checkProddableBlock on x86_64 527ed72 Fix deriving Ord when RebindableSyntax is enabled c81e7b2 Build system: temp solution for parallelisation bug (#11960) f669764 Use `setSession` instead of `modifySession` when setting `HscEnv` a70a6da rts/Linker.c: Fix compile error on Arm fa58710 Update format specifiers for Tickey.c 2230c88 Testsuite: fix T12010 for real 8c9b8a3 Allow unlifted types in pattern synonym result type d835ee6 Fix build by removing unused import. 785b38f testsuite: Update max_bytes_used for T4029 9bb2772 Revert "compiler/iface: compress .hi files" 4f5b335 Suppress the warning about __sync_fetch_and_nand (#9678) 03d8960 Don't split the arg types in a PatSyn signature eb8eb02 Spelling in comment 839b424 Remove unused Type.splitFunTysN 9c3e55b Comments only 35053eb Testsuite: delete check_files_written 1bf5c12 Spelling 8f7d016 Add support for unicode TH quotes (#11743) 4c6e69d Document some benign nondeterminism 9d06ef1 Make Arrow desugaring deterministic 95dfdce Remove 'deriving Typeable' statements fe8a4e5 Runtime linker: Break m32 allocator out into its own file 1956cbf Fix: #12084 deprecate old profiling flags 31f1804 Testsuite: delete drvfail015.stderr-7.0 [skip ci] 1319363 Always use native-Haskell de/encoders for ASCII and latin1 ac38c02 Update submodule vector [skip ci] 961ed26 Fix broken links to mdo papers eec88ee RTS: simplify read_heap_profiling_flag bdc5558 Testsuite: introduce TEST_HC_OPTS_INTERACTIVE (#11468) 8408d84 Spelling in comments 6a5bce1 Testsuite: also normalise platform-dependent .stdout/stderr f07bf19 Testsuite: fix enum01/02/03 on Windows (#9399) 5020bc8 Testsuite: add a test for #5522 (-fliberate-case -fspec-constr) 0f1e315 Fix bytecode gen to deal with rep-polymorphism e9e61f1 Reduce special-casing for nullary unboxed tuple 5b8bec2 StgCmmExpr: Fix a duplication 5b145c9 Coverage.hs: Fix a duplication cd50d23 StgCmmCon: Do not generate moves from unused fields to local variables b43a793 More fixes for unboxed tuples 72fd407 Comments and white space only 59250dc StgCmmExpr: Remove a redundant list 3a00ff9 Do not init record accessors as exported 3f20da1 Typos in comments d0dd572 Clarify users' guide section on GeneralizedNewtypeDeriving d40682e Testsuite: don't use --interactive in Makefiles 1e67010 RtsFlags.c: Const correct fixes 7e4f3dc StgCmmUtils.emitMultiAssign: Make assertion msg more helpful 0ffa23d Remove unused FAST_STRING_NOT_NEEDED macro defs 930e74f Update a Cmm note 0676e68 Fix detection and use of `USE_LIBDW` cb2c042 Use nameSetAny in findUses f2b3be0 Improve failed knot-tying error message. 99ace83 Kill nameSetElems in getInfo 36d254a Testsuite: run tests in /tmp/ghctest-xxx instead of /tmp/ghctest/xxx 940229c Travis: llvm's apt repository is offline cb9f635 Localize orphan-related nondeterminism d348acd Serialize vParallelTyCons in a stable order 3eac3a0 Add nameSetElemsStable and fix the build dad39ff Remove dead generics-related code from OccName d753ea2 Use UniqDSet for finding free names in the Linker e2446c0 Kill nameSetElems in findImportUsage be47085 Kill nameSetElems in rnCmdTop 060c176 Whitespace only 1d1987e HscMain: Minor simplification 9cc6fac Make FieldLabelEnv a deterministic set 2046297 Document putSymbolTable determinism 4842a80 Derive instances in Data.Data 1dadd9a testsuite: Mark broken tests on powerpc64le 3747372 Refactored SymbolInfo to lower memory usage in RTS 079c1b8 Use useful names for Symbol Addr and Names in Linker.c 02f893e integer-gmp: Make minusInteger more efficient 4aa299d PrelInfo: Ensure that tuple promoted datacon names are in knownKeyNames eda73a3 RTS SMP: Use compiler built-ins on all platforms. 4dbacbc Rename isPinnedByteArray# to isByteArrayPinned# b948a1d Refactor the SymbolName and SymbolAddr types to be pointers 5965117 Replace hand-written Bounded instances with derived ones 0d963ca Add relocation type R_X86_64_REX_GOTPCRELX 4848ab9 Testsuite: fixup comments for T9872d [skip ci] 886f4c1 Better comment for orIfNotFound. f91d87d Failing test-case for #12135. 3042a9d Use UniqDFM for HomePackageTable 48e9a1f Implement deterministic CallInfoSet a90085b Add @since annotations to base instances e684f54 Desugar ApplicativeDo and RecDo deterministically 31ba8d6 Kill nameSetElems 46d2da0 Document putDictionary determinism 3e7a876 Kill foldUniqSet 1937ef1 Make UnitIdMap a deterministic map a13cb27 Merge MatchFixity and HsMatchContext 77ccdf3 Kill occSetElts 7fea712 Use a deterministic map for imp_dep_mods d05dee3 CoreToStg: Remove hand-written Eq instances of HowBound and LetInfo 4426c5f Kill two instances of uniqSetToList 0d6f428 Fix build by removing unused import c148212 Kill varSetElems in checkValidInferredKinds ad8e203 Use DVarSet in Vectorise.Exp 3b698e8 Document determinism in pprintClosureCommand 5db93d2 Make vectInfoParallelVars a DVarSet 7008515 Kill varSetElems 7d58a97 Use pprUFM in pprStgLVs 00e3a5d Typofix. 4d5b2f6 Testsuite driver: always quote opts.testdir f5f5a8a Testsuite Windows: mark T8308 expect_broken (#8308) d4b548e Add some determinism tests dd33245 Desugar: Display resulting program stats with -v2 44a3c18 Revert "Desugar: Display resulting program stats with -v2" c2bbc8b Report term sizes with -v3 even when -ddump is enabled 80cf4cf Literal: Remove unused hashLiteral function d7933cb Show sources of cost centers in .prof 8f6d292 Fix #12064 by making IfaceClass typechecking more lazy. acb9e85 Minor performance note about IdInfo. 11ff1df Fix #12076 by inlining trivial expressions in CorePrep. 48385cb Remove special casing of Windows in generic files ceaf7f1 Implement Eq TyCon directly 68c1c29 Remove Ord (CoAxiom br) 9dbf354 Testsuite: delete dead code [skip ci] e703a23 Docs: fix links to ghc-flags 70e0a56 Remove Ord Class b2624ee Remove Ord PatSyn 77b8c29 Remove Ord AltCon c22ab1a Docs: delete PatternGuards documentation b020db2 Fix Ticky histogram on Windows e9dfb6e Improve the error messages for static forms. b0a7664 prettyPrintClosure(): Untag the closure before accessing fields 47d8173 Remove Printer.c:prettyPrintClosure() bcb419a Fix #12099: Remove bogus flags 6adff01 Comments only 6905ce2 Refine imports slightly 0f0b002 Comments only 3ae18df Minor refactoring b9fa72a Small refactor to mkRuntimErrorId 9e5ea67 NUMA support c88f31a Rts flags cleanup 5990016 ModuleSet: Use an actual set instead of map to units 6ace660 rts: Fix build when USE_LARGE_ADDRESS_SPACE is undefined 9130867 Skip retc001 on OSX b40e1b4 Fix incorrect calculated relocations on Windows x86_64 29e1464 Disable T12031 on linux 2bb6ba6 rts: Fix NUMA when cross compiling d25cb61 Kill off redundant SigTv check in occurCheckExpand 15b9bf4 Improve typechecking of let-bindings c28dde3 Tidy up zonkQuantifiedTyVar 7afb7ad Get in-scope set right in top_instantiate 35c9de7 Move the constraint-kind validity check 1f66128 Beef up mkNakedCastTy 15fc528 Fix the in-scope set for extendTvSubstWithClone 599d912 Beef up isPredTy 8104f7c Remove some traceTc calls e064f50 Add to .gitignore 921ebc9 Test Trac #12055 1dcb32d A second test for Trac #12055 5cee88d Add thin library support to Windows too 7de776c Kill unused foldModuleEnv 586d558 Use UniqFM for SigOf 0497ee5 Make the Ord Module independent of Unique order d55a9b4 Update Haddock to follow change in LHsSigWcType 4f35646 Adjust error message slightly 8dfd4ae Build system: mention ghc version in bindist's `configure --help` docdir a2deee0 Testsuite: enable ghci.prog010 (#2542) 23b73c9 Don't GC sparks for CAFs 9d22fbe Rename cmpType to nonDetCmpType 753c5b2 Simplify readProcessEnvWithExitCode + set LANGUAGE=C 70a4589 Revert "Make the Ord Module independent of Unique order" e33ca0e Fix testsuite wibble 77bb092 Re-add FunTy (big patch) e368f32 Major patch to introduce TyConBinder c56f8bd CoreMonad: Update error msg function docs 930a525 Abort the build when a Core plugin pass is specified in stage1 compiler a7f65b8 Remove dead code: countOnce, countMany 498ed26 NUMA cleanups 8d33af9 CoreLint: Slightly improve case type annotation error msgs 3e8c495 CmmNode: Make CmmTickScope's Unique strict 2396d9b llvmGen: Make metadata ids a newtype 85e09b1 llvmGen: Consolidate MetaExpr pretty-printing 9bb0578 Revert accidental submodule updates e02beb1 Driver: `ghc ../Test` (without file extension) should work f72f23f Testsuite: run tests in .run instead of /tmp 6f6f515 Testsuite: write "\n" instead of "\r\n" when using mingw Python d94c405 Testsuite: validate the tests/stage1 directory with the stage1 compiler a4c8532 Validate: use `rm -f` instead of `rm` 6354991 VarEnv: Comment only 270d545 Add Bifoldable and Bitraversable to base 9649fc0 Refactor derived Generic instances to reduce allocations 4d71cc8 Avoid find_tycon panic if datacon is not in scope f12fb8a Fix trac #10647: Notice about lack of SIMD support 2897be7 PPC NCG: Fix float parameter passing on 64-bit. f4b0488 PPC NCG: Fix and refactor TOC handling. 0be38a2 llvmGen: Add strictness to metadata fields 0e92af9 Remove use of KProxy in GHC.Generics 0ba34b6 ApplicativeDo: allow "return $ e" e7e42c8 Fix double-free in T5644 (#12208) cdc14b4 Testsuite: remove Windows CR again.. [skip ci] 9cdde38 Testsuite: remove Windows CR [skip ci] cf6e656 Testsuite: remove Windows CR [skip ci] 3dc1202 Testsuite: tabs -> spaces [skip ci] 7e7094f Testsuite: tabs -> spaces [skip ci] 46ff80f Testsuite: tabs -> spaces [skip ci] 915e07c Testsuite: tabs -> spaces [skip ci] 5b03dc6 Testsuite: tabs -> spaces [skip ci] a7160fa Testsuite: tabs -> spaces [skip ci] 4a4bdda Testsuite: recover from utf8 decoding errors 6d0a4fc Testsuite: fix WAY=ghci when LOCAL=0 1ddc10b Testsuite: *do* replace backslashes in config.libdir 1d938aa Testsuite: mark tests expect broken 3b49f8f Testsuite: remove `-fforce-recomp` from default flags (#11980) 82f7f18 Testsuite: delete TEST_HC_OPTS_NO_RECOMP 135fc86 Testsuite: remove `-Wno-warn-tabs` from default flags ebaf26b Testsuite: delete dead code + cleanup e170d19 Testsuite: assume timeout_prog always exists ee3bde7 Expand and clarify the docs for ApplicativeDo (#11835) 7301404 Typos in comments d09e982 Don't quantify over Refl in a RULE 97a50f8 Delete commented-out code 1230629 Make checkFamInstConsistency less expensive a47b62c Second attempt to fix sizeExpr c0583a9 Fix build breakage due to rebase 9d62d09 Hopefully fix all the rebase-induced breakage 4e7d835 Typos in comments [skip ci] 6199588 More typos in comments [skip ci] 93f40cb Don't error on GCC inlining warning in rts 348f2db Make the Ord Module independent of Unique order (2nd try) 15641b0 Accept new (lower) allocations for T7257 7e7aeab Comments only cc92a44 Improve error message in deriving( Functor ) a1b3359 Remove unused arg to tcSuperClasses ce97b72 Expand given superclasses more eagerly 210a2e1 Test Trac #12163 3e0af46 Give lookupGRE_Name a better API e556f76 Remove unused import 643706e Narrow the warning for simplifiable constraints 2f8cd14 Narrow the use of record wildcards slightly 7fc20b0 Have Core linter accept programs using StaticPointers and -fhpc. 35d1564 Provide Uniquable version of SCC bb74021 Remove Ord TyCon 7f5d560 Very confusing typo in error message. 9a34bf1 Fix #11974 by adding a more smarts to TcDefaults. 8035d1a Fix #10963 and #11975 by adding new cmds to GHCi. 4ae950f Release notes for #11975 and #10963 df9611e Testsuite: do not copy .hi/.o files to testdir (#12112) d2958bd Improve typechecking of instance defaults c871ce4 Comments around invisibility 393928d Fix renamer panic f86a337 Remove bogus comment on ForAllTy bb84ee4 Improve pretty-printing of Avail 12c4449 Implement ReifyConStrictness for -fexternal-interpreter (#12219) d2006d0 Run all TH tests with -fexternal-interpreter (#12219) bdb0d24 Remote GHCi: separate out message types eb73219 Remote GHCi: comments only 0bab375 Fix T8761 (#12219, #12077) dadd8b8 Test Trac #12229 9bc2233 Fix typo in Data.Bitraverse Haddocks 31b5806 Clean up outdated comments in template-haskell changelog a33b498 Add template-haskell changelog note for #8761 5fdb854 s/Invisible/Inferred/g s/Visible/Required/g 4cc5a39 Refactor tcInferArgs and add comments. 8c1cedd Allow building static libs. da60e3e rts/Linker.c: Improve ugly C pre-processor hack 7843c71 Make T8761 deterministic, I hope ff1cc26 Don't run the run_command tests with ext-interp 82282e8 Remove some `undefined`s 60c24b2 Typos in user manual and code: recurisve -> recursive afa6e83 rts/Linker.c: Rename ONLY_USED_x86_64_HOST_ARCH macro bbf0aa2 Testsuite: never pick up .T files in .run directories 7593c2f Testsuite: report duplicate testnames when `make TEST=` 1f45bce Testsuite: remove one level of indentation [skip ci] 206b4a1 Testsuite: simplify extra_file handling bafd615 Testsuite: do not print timeout message 58f0086 Testsuite: open/close stdin/stdout/stderr explicitly d8e9b87 Testsuite: cleanup printing of summary 782cacf Testsuite: framework failure improvements (#11165) 6b3b631 Testsuite: run all indexed-types ways on ./validate --slow 0eb0378 Testsuite: do not add -debug explicitly in .T file 3fb9837 Testsuite: mark tests expect_broken af21e38 Don't omit any evidence bindings 23b80ac Deal correctly with unused imports for 'coerce' dc62a22 Wibble error message for #11471 dd92c67 Stop the simplifier from removing StaticPtr binds. 2e9079f Test Trac #12185 848e3ce Testsuite: fixes for python2.6 support 9a645a1 Refactor match to not use Unique order 8f7194f Double the file descriptor limit for openFile008 1084d37 Testsuite: use ignore_stderr/stdout instead of ignore_output 24194a6 Fix pretty-printer for IfaceCo e8d6271 Testsuite: do not depend on sys.stdout.encoding fb6e2c7 Delete Ord Unique 9854f14 Add a new determinism test b6b20a5 Reorganize some determinism tests 480e066 Remove ufmToList b8b3e30 Axe RecFlag on TyCons. 0701db1 Updates to handle new Cabal 430f5c8 Trac #11554 fix loopy GADTs 6a5d13c nativeGen: Allow -fregs-graph to be used f68d40c ghc-pkg: Drop trailing slashes in computing db paths f1e16e9 CmmExpr: remove unused `vgcFlag` function b65363d Fix check_uniques in non-unicode locale 0afc41b Testsuite: be less strict about topHandler03's stderr c27ce26 users-guide: Fix markup in release notes 81b437b Add NamedThing (GenLocated l e) instance b412d82 Allow one type signature for multiple pattern synonyms 6ba4197 rules/sphinx.mk: stop xelatex on error ee8d1fa Remove unused oc->isImportLib (#12230) 6377757 Linker: some extra debugging / logging cbfeff4 Remove uniqSetToList 0d522b8 Document some benign nondeterminism 0ab63cf Kill varEnvElts in seqDmdEnv 01f449f Fix 32-bit build failures 9031382 MkCore: Fix some note names a6819a0 base: Add release date to changelog bf7cbe7 users-guide: Note multiple pattern signature change in relnotes afec447 testsuite: Add testcase for #12355 2a3af15 Treat duplicate pattern synonym signatures as an error 3b2deca users-guide: Remove static field type from rts-flag 331febf CallArity: Use not . null instead of length > 0 0bd7c4b Enum: Ensure that operations on Word fuse 18e71e4 Revert "Fix 32-bit build failures" 890ec98 Revert "Linker: some extra debugging / logging" e10497b Kill some varEnvElts 85aa6ef Check generic-default method for ambiguity 1267048 Extra ASSERTs for nameModule 55e43a6 Use DVarEnv for vectInfoVar 5f79394 Delete out-of-date comment 895eefa Make unique auxiliary function names in deriving cbe30fd Tidy up tidying f2d36ea White space only 6cedef0 Test Trac #12133 27fc75b Document codegen nondeterminism 18b782e Kill varEnvElts in zonkEnvIds 1b058d4 Remove varEnvElts b7b130c Fix GetTime.c on Darwin with clock_gettime f560a03 Adds x86_64-apple-darwin14 target. 567dbd9 Have addModFinalizer expose the local type environment. 56f47d4 Mention addModFinalizer changes in release notes. 672314c Switch to LLVM version 3.8 b9cea81 Show testcase where demand analysis abortion code fails 979baec --without-libcharset disables the use of libcharset bedd620 Style changes for UniqFM 6ed7c47 Document some codegen nondeterminism 9858552 Use deterministic maps for FamInstEnv 34085b5 Correct the message displayed for syntax error (#12146) 64bce8c Add Note [FamInstEnv determinism] 6e280c2 Utils: Fix `lengthIs` and `lengthExceeds` for negative args 0481324 Use UniqDFM for InstEnv b8cd94d GHC.Stack.CCS: Fix typo in Haddocks 91fd87e FastString: Reduce allocations of concatFS 15751f2 FastString: Add IsString instance c4a9dca FastString: Supply mconcat implementation fc53d36 OccName: Implement startsWithUnderscore in terms of headFS eb3d659 OccName: Avoid re-encoding derived OccNames 4f21a51 Kill eltsUFM in classifyTyCons 6c7c193 DsExpr: Remove usage of concatFS in fingerprintName 0177c85 Testsuite: expose TEST_CC (path to gcc) f53d761 TysWiredIn: Use UniqFM lookup for built-in OccNames 9a3df1f check-api-annotations utility loads by filename 17d0b84 Add -package-env to the flags reference 372dbc4 Pretty: delete really old changelog 45d8f4e Demand analyser: Implement LetUp rule (#12370) 18ac80f tidyType: Rename variables of nested forall at once cd0750e tidyOccNames: Rename variables fairly 37aeff6 Added type family dependency to Data.Type.Bool.Not b35e01c Bring comments in TcGenGenerics up to date a9bc547 Log heap profiler samples to event log ffe4660 IfaceEnv: Only check for built-in OccNames if mod is GHC.Types 24f5f36 Binary: Use ByteString's copy in getBS 0f0cdb6 Bugfix for bug 11632: `readLitChar` should consume null characters 1ba79fa CodeGen: Way to dump cmm only once (#11717) 89a8be7 Pretty: remove a harmful $! (#12227) 5df92f6 hp2ps: fix invalid PostScript for names with parentheses d213ab3 Fix misspellings of the word "instance" in comments 3fa3fe8 Make DeriveFunctor work with unboxed tuples 514c4a4 Fix Template Haskell reification of unboxed tuple types 1fc41d3 Make okConIdOcc recognize unboxed tuples 0df3f4c Fix PDF build for the User's Guide. 98b2c50 Support SCC pragmas in declaration context e46b768 Make Data.{Bifoldable,Bitraversable} -XSafe 908f8e2 TcInteract: Add braces to matchClassInst trace output 8de6e13 Fix bytecode generator panic cac3fb0 Cleanup PosixSource.h a0f83a6 Data.Either: Add fromLeft and fromRight (#12402) 627c767 Update docs for partial type signatures (#12365) ed48098 InstEnv: Ensure that instance visibility check is lazy 9513fe6 Clean up interaction between name cache and built-in syntax a4f2b76 testsuite: Add regression test for #12381 93acc02 Add another testcase for #12082 cf989ff Compact Regions 83e4f49 Revert "Clean up interaction between name cache and built-in syntax" 714bebf Implement unboxed sum primitive type a09c0e3 Comments only 9c54185 Comments + tiny refactor of isNullarySrcDataCon 8d4760f Comments re ApThunks + small refactor in mkRhsClosure 6a4dc89 Bump Haddock submodule 8265c78 Fix and document Unique generation for sum TyCon and DataCons e710f8f Correct a few mistyped words in prose/comments bbf36f8 More typos in comments fb34b27 Revert "Cleanup PosixSource.h" 86b1522 Unboxed sums: More unit tests bfef2eb StgCmmBind: Some minor simplifications c4f3d91 Add deepseq dependency and a few NFData instances 648fd73 Squash space leaks in the result of byteCodeGen 7f0f1d7 -fprof-auto-top 1fe5c89 UNPACK the size field of SizedSeq d068220 Fix the non-Linux build 4036c1f Testsuite: fix T10482a 1967d74 Some typos in comments a9251c6 MonadUtils: Typos in comments 1783011 Fix productivity calculation (#12424) 9d62f0d Accept better stats for T9675 8f63ba3 Compute boot-defined TyCon names from ModIface. b0a5144 Add mblocks_allocated to GC stats API e98edbd Move stat_startGCSync d3feb16 Make Unique a newtype c06e3f4 Add atomic operations to package.conf.in 89ae1e8 Relevant Bindings no longer reports shadowed bindings (fixes #12176) 750553a Use MO_Cmpxchg in Primops.cmm instead of ccall cas(..) 2078909 Typo in comment 36565a9 ForeignCall.hs: Remove DrIFT directives 55f5aed Track the lengths of the thread queues 988ad8b Fix to thread migration d1fe08e Only trace cap/capset events if we're tracing anything else 4dcbbd1 Remove the DEBUG_ variables, use RtsFlags directly 9df9490 StgSyn: Remove unused StgLiveVars types 2f79e79 Add comment about lexing of INLINE and INLINABLE pragma 0c37aef Update old comment InlinePragma b1e6415 More comments about InlinePragmas 7a06b22 Typo in comment [skip ci] 7a8ef01 Remove `setUnfoldingInfoLazily` a13fda7 Clarify comment on makeCorePair d85b26d CmmLive: Remove some redundant exports 8ecac25 CmmLayoutStack: Minor simplification fc66415 Replace an unsafeCoerce with coerce db5a226 Fix omission in haddock instance head 1101045 Trim all spaces after 'version:' fe4008f Remove identity update of field componentsConfigs f09d654 check that the number of parallel build is greater than 0 e3e2e49 codeGen: Remove binutils<2.17 hack, fixes T11758 ca7e1ad Expanded abbreviations in Haddock documentation ce13a9a Fix an assertion that could randomly fail 89fa4e9 Another try to get thread migration right 8fe1672 Bump `hoopl` submodule, mostly cosmetics 253fc38 Temporarily mark T1969 perf test as broken (#12437) 7354f93 StgCmm: Remove unused Bool field of Return sequel 02614fd Replace some `length . filter` with `count` 9aa5d87 Util.count: Implement as a left-fold instead of a right-fold affcec7 rts/Printer.h: fix constness of argument declaration 03af399 AsmCodeGen: Give linear-scan and coloring reg. allocators different cc names 3bfe6a5 RegAlloc: Remove duplicate seqList (use seqList from Util) bd51064 RegAlloc: Use IntSet/IntMaps instead of generic Set/Maps 7a2e933 Use Data.Functor.Const to implement Data.Data internals 6fe2355 configure.ac: Remove checks for bug 9439 773e3aa T1969: Enable it again but bump the max residency temporarily 4d9c22d Fix typo in Data.Bitraversable Haddocks fe19be2 Cabal submodule update. dd23a4c Actually update haddock.Cabal stats. e79bb2c Fix a bug in unboxed sum layout generation 9684dbb Remove StgRubbishArg and CmmArg ac0e112 Improve missing-sig warning bd0c310 Fix GHCi perf-llvm build on x86_64 37a7bcb Update `nofib` submodule to newest commit 7ad3b49 Misspellings in comments [skip ci] 18f0687 Fix configure detection. ffd4029 fix compilation failure on OpenBSD with system supplied GNU C 4.2.1 fc1432a Update hoopl submodule (extra .gitignore entry) 3551e62 refactor test for __builtin_unreachable into Rts.h macro RTS_UNREACHABLE da99a7f Darwin: Detect broken NM program at configure time f9a11a2 When in sanity mode, un-zero malloc'd memory; fix uninitialized memory bugs. d331ace Minor typofix. b222ef7 Typofix in System.Environment docs. 34da8e5 Typo in comment efc0372 Not-in-scope variables are always errors f352e5c Keep the bindings local during defaultCallStacks 58e7316 Refactor nestImplicTcS d610274 Revert "T1969: Enable it again but bump the max residency temporarily" 113d50b Add gcoerceWith to Data.Type.Coercion b2c5e4c Revert "codeGen: Remove binutils<2.17 hack, fixes T11758" 896d216 Annotate initIfaceCheck with usage information. e907e1f Axe initIfaceTc, tie the knot through HPT (or if_rec_types). 704913c Support for noinline magic function. 1f1bd92 Introduce BootUnfolding, set when unfolding is absent due to hs-boot file. 5a8fa2e When a value Id comes from hi-boot, insert noinline. Fixes #10083. 8fd1848 Retypecheck both before and after finishing hs-boot loops in --make. e528061 We also need to retypecheck before when we do parallel make. 0d3bf62 Fix #12472 by looking for noinline/lazy inside oversaturated applications. f9aa996 pass -z wxneeded or -Wl,-zwxneeded for linking on OpenBSD fb0d87f Splice singleton unboxed tuples correctly with Template Haskell 1f75440 Extra comments, as per SPJ in #12035. acdbd16 Move #12403, #12513 users guide notes to 8.2.1 release notes 89facad Add T12520 as a test 1766bb3 RtClosureInspect: Fix off-by-one error in cvReconstructType 613d745 Template Haskell support for unboxed sums 7a86f58 Comments only: Refer to actually existing Notes 8d92b88 DmdAnal: Add a final, safe iteration d6fd2e3 DmdAnal: Testcase about splitFVs and dmdFix abortion ec7fcfd Degrade "case scrutinee not known to diverge for sure" Lint error to warning faaf313 WwLib: Add strictness signature to "let x = absentError …" 1083f45 Fix doc build inconsistency ae66f35 Allow typed holes to be levity-polymorphic a60ea70 Move import to avoid warning 0050aff Fix scoping of type variables in instances ca8c0e2 Typofix in docs. 983f660 Template Haskell support for TypeApplications 822af41 Fix broken Haddock comment f4384ef Remove unused DerivInst constructor for DerivStuff 21c2ebf Missing stderr for T12531. 9d17560 GhcMake: limit Capability count to CPU count in parallel mode a5d26f2 rts: enable parallel GC scan of large (32M+) allocation area 044e81b OccName: Remove unused DrIFT directive ff1931e TcGenDeriv: Typofix d168c41 Fix and complete runghc documentation 6781f37 Clarify pkg selection when multiple versions are available 83b326c Fix binary-trees regression from unnecessary floating in CorePrep. a25bf26 Tag pointers in interpreted constructors ef784c5 Fix handling of package-db entries in .ghc.environment files, etc. 2ee1db6 Fixes #12504: Double-escape paths used to build call to hsc_line 28b71c5 users_guide: More capabilities than processors considered harmful 0e74925 GHC: Expose installSignalHandlers, withCleanupSession 3005fa5 iserv: Show usage message on argument parse failure d790cb9 Bump the default allocation area size to 1MB d40d6df StgCmmPrim: Add missing MO_WriteBarrier d1f2239 Clarify scope of `getQ`/`putQ` state. 22259c1 testsuite: Failing testcase for #12091 2d22026 ErrUtils: Expose accessors of ErrDoc and ErrMsg a07a3ff A failing testcase for T12485 9306db0 TysWiredIn: Use dataConWorkerUnique instead of incrUnique 9cfef16 Add Read1/Read2 methods defined in terms of ReadPrec 1ad770f Add -flocal-ghci-history flag (#9089). 010b07a PPC NCG: Implement minimal stack frame header. ca6d0eb testsuite: Update bytes allocated of parsing001 75321ff Add -fdefer-out-of-scope-variables flag (#12170). e9b0bf4 Remove redundant-constraints from -Wall (#10635) 043604c RnExpr: Fix ApplicativeDo desugaring with RebindableSyntax dad6a88 LoadIFace: Show known names on inconsistent interface file 3fb8f48 Revert "testsuite: Update bytes allocated of parsing001" a69371c users_guide: Document removal of -Wredundant-constraints from -Wall ad1e072 users_guide: Move addModFinalizer mention to 8.0.2 release notes 1f5d4a3 users_guide: Move -fdefer-out-of-scope-variables note to 8.0.2 relnotes da920f6 users_guide: Move initGhcMonad note to 8.0.2 relnotes a48de37 restore -fmax-worker-args handling (Trac #11565) 1e39c29 Kill vestiages of DEFAULT_TMPDIR 8d35e18 Fix startsVarSym and refactor operator predicates (fixes #4239) b946cf3 Revert "Fix startsVarSym and refactor operator predicates (fixes #4239)" f233f00 Fix startsVarSym and refactor operator predicates (fixes #4239) e5ecb20 Added support for deprecated POSIX functions on Windows. 0cc3931 configure.ac: fix --host= handling 818760d Fix #10923 by fingerprinting optimization level. 36bba47 Typos in notes 33d3527 Protect StablPtr dereference with the StaticPtr table lock. 133a5cc ghc-cabal: accept EXTRA_HC_OPTS make variable f93c363 extend '-fmax-worker-args' limit to specialiser (Trac #11565) ac2ded3 Typo in comment 57aa6bb Fix comment about result f8b139f test #12567: add new testcase with expected plugin behaviour 1805754 accept current (problematic) output cdbb9da cleanup: drop 11 years old performance hack 71dd6e4 Don't ignore addTopDecls in module finalizers. 6ea6242 Turn divInt# and modInt# into bitwise operations when possible 8d00175 Less scary arity mismatch error message when deriving 4ff4929 Make generated Ord instances smaller (per #10858). 34010db Derive the Generic instance in perf/compiler/T5642 05b497e distrib: Fix libdw bindist check a7a960e Make the test for #11108 less fragile dcc4904 Add failing testcase for #12433 feaa31f Remove references to -XRelaxedPolyRec 5eab6a0 Document meaning of order of --package-db flags, fixes #12485. a8238a4 Update unix submodule to latest HEAD. 65d9597 Add hook for creating ghci external interpreter 1b5f920 Make start address of `osReserveHeapMemory` tunable via command line -xb 7b4bb40 Remove -flocal-ghci-history from default flags 710f21c Add platform warning to Foreign.C.Types 158288b Generalise type of mkMatchGroup to unify with mkMatchGroupName 04184a2 Remove uses of mkMatchGroupName 7b7ea8f Fix derived Ix instances for one-constructor GADTs 0e7ccf6 Fix TH ppr output for list comprehensions with only one Stmt 454033b Add hs_try_putmvar() 03541cb Be less picky about reporing inaccessible code 21d0bfe Remove unused exports 35086d4 users_guide: Fix Docbook remnant b451fef users_guide: #8761 is now fixed c6ac1e5 users_guide: TH now partially supports typed holes 6555c6b rts: Disable -hb with multiple capabilities 5eeabe2 Test wibbles for commit 03541cba ec3edd5 Testsuite wibbles, to the same files 505a518 Comments and white space only 8074e03 Comments and white space only 876b00b Comments and white space 86836a2 Fix codegen bug in PIC version of genSwitch (#12433) 9123845 tryGrabCapability should be using TRY_ACQUIRE_LOCK 626db8f Unify CallStack handling in ghc a001299 Comments only a72d798 Comments in TH.Syntax (Trac #12596) 97b47d2 Add test case for #7611 ea310f9 Remove directories from include paths 14c2e8e Codegen for case: Remove redundant void id checks 6886bba Bump Haddock submodule to fix rendering of class methods 8bd3d41 Fix failing test T12504 9cbcdb4 shutdownHaskellAndExit: just do a normal hs_exit() (#5402) 74c4ca0 Expose hs_exit_(rtsFalse) as hs_exit_nowait() 3a17916 Improved documentation for Foreign.Concurrent (#12547) 9766b0c Fix #12442. d122935 Mark mapUnionFV as INLINABLE rather than INLINE 68f72f1 Replace INLINEABLE by INLINABLE (#12613) 55d92cc Update test output bc7c730 Pattern Synonyms documentation update 796f0f2 Print foralls in user format b0ae0dd Remove #ifdef with never fulfilled condition c36904d Fix layout of MultiWayIf expressions (#10807) f897b74 TH: Use atomicModifyIORef' for fresh names 0b6024c Comments and manual only: spelling 13d3b53 Test Trac #12634 f21eedb Check.hs: Use actual import lists instead of comments 0b533a2 A bit of tracing about flattening 2fbfbca Fix desugaring of pattern bindings (again) 66a8c19 Fix a bug in occurs checking 3012c43 Add Outputable Report in TcErrors b612da6 Fix impredicativity (again) fc4ef66 Comments only 5d473cd Add missing stderr file 3f27237 Make tcrun042 fail 28a00ea Correct spelling in note references b3d55e2 Document Safe Haskell restrictions on Generic instances 9e86276 Implement deriving strategies b61b7c2 CodeGen X86: fix unsafe foreign calls wrt inlining 59d7ee5 GHCi: Don't remove shadowed bindings from typechecker scope. 3c17905 Support more than 64 logical processors on Windows 151edd8 Recognise US spelling for specialisation flags. f869b23 Move -dno-debug-output to the end of the test flags d1b4fec Mark T11978a as broken due to #12019 1e795a0 Use check stacking on Windows. c93813d Add NUMA support for Windows 2d6642b Fix interaction of record pattern synonyms and record wildcards 1851349 Don't warn about name shadowing when renaming the patten in a PatSyn decl ce3370e PPC/CodeGen: fix lwa instruction generation 48ff084 Do not warn about unused underscore-prefixed fields (fixes Trac #12609) 0014fa5 ghc-pkg: Allow unregistering multiple packages in one call b0d53a8 Turn `__GLASGOW_HASKELL_LLVM__` into an integer again f547b44 Eliminate some unsafeCoerce#s with deriving strategies 23cf32d Disallow standalone deriving declarations involving unboxed tuples or sums 4d2b15d validate: Add --build-only 42f1d86 runghc: use executeFile to run ghc process on POSIX 3630ad3 Mark #6132 as broken on OS X 8cab9bd Ignore output from derefnull and divbyzero on Darwin e9104d4 DynFlags: Fix absolute import path to generated header eda5a4a testsuite: Mark test for #12355 as unbroken on Darwin. 22c6b7f Update Cabal submodule to latest version. 8952cc3 runghc: Fix import of System.Process on Windows 7a6731c genapply: update source file in autogenerated text c5d6288 Mark zipWithAndUnzipM as INLINABLE rather than INLINE e4cf962 Bring Note in TcDeriv up to date 465c6c5 Improve error handling in TcRnMonad 58ecdf8 Remove unused T12124.srderr 4a03012 Refactor TcDeriv and TcGenDeriv a2bedb5 RegAlloc: Make some pattern matched complete 57a207c Remove dead code “mkHsConApp” cbe11d5 Add compact to packages so it gets cleaned on make clean. e41b9c6 Fix memory leak from #12664 f3be304 Don't suggest deprecated flags in error messages 76aaa6e Simplify implementation of wWarningFlags 082991a Tc267, tests what happens if you forgot to knot-tie. 3b9e45e Note about external interface changes. 940ded8 Remove reexports from ghc-boot, help bootstrap with GHC 8. 887485a Exclude Cabal PackageTests from gen_contents_index. 00b530d The Backpack patch. 4e8a060 Distinguish between UnitId and InstalledUnitId. 5bd8e8d Make InstalledUnitId be ONLY a FastString. 027a086 Update haddock.Cabal perf for Cabal update. 61b143a Report that we support Backpack in --info. 46b78e6 Cabal submodule update. e660f4b Rework renaming of children in export lists. f2d80de Add trailing comma to fix the build. 21647bc Fix build 7b060e1 Generate a unique symbol for signature object stub files, fixes #12673 bcd3445 Do not segfault if no common root can be found 8dc72f3 Cleanup PosixSource.h 6c47f2e Default +RTS -qn to the number of cores 85e81a8 Turn on -n4m with -A16m or greater 1a9705c Escape lambda. b255ae7 Orient improvement constraints better b5c8963 Rename a parameter; trivial refactor 88eb773 Delete orphan where clause 76a5477 Move zonking out of tcFamTyPats cc5ca21 Improved stats for Trac #1969 a6111b8 More tests for Trac #12522 b5be2ec Add test case for #12689 f8d2c20 Add a broken test case for #12689 8fa5f5b Add derived shadows only for Wanted constraints d2959df Comments and equation ordering only bce9908 RnExpr: Actually fail if patterns found in expression 577effd testsuite: Bump T1969 allocations 184d7cb Add test for #12411 042c593 Add test for #12589 fef1df4 Add test for #12456 57f7a37 Add missing @since annotations 2fdf21b Further improve error handling in TcRn monad 015e9e3 Cabal submodule update. 1cccb64 Unique: Simplify encoding of sum uniques 34d933d Clean up handling of known-key Names in interface files 3991da4 MkIface: Turn a foldr into a foldl' aa06883 Improve find_lbl panic message 90df91a PrelInfo: Fix style 8c6a3d6 Add missing Semigroup instances for Monoidal datatypes in base d5a4e49 Make error when deriving an instance for a typeclass less misleading 3ce0e0b Build ghc-iserv with --export-dynamic 6c73932 Check for empty entity string in "prim" foreign imports 0d9524a Disable T-signals-child test on single-threaded runtime e39589e Fix Windows build following D2588 b501709 Fix Show derivation in the presence of RebindableSyntax/OverloadedStrings 512541b Add a forward reference for a Note afdde48 Correct name of makeStableName in haddock 3174beb Comments about -Wredundant-constraints 82b54fc Fix comment typo 692c8df Fix shadowing in mkWwBodies 609d2c8 Typo in comment a693d1c Correct order of existentials in pattern synonyms f7278a9 Fix wrapping order in matchExpectedConTy 1790762 Test Trac #12681 db71d97 Reduce trace output slightly 156db6b Add more variants of T3064 (in comments) a391a38 Comments only f43db14 Typos in comments 3adaacd Re-add accidentally-deleted line 9cb4459 testsuite: Work around #12554 deed418 testsuite: Mark break011 as broken 8b84b4f testsuite: Mark T10858 as broken on Windows 3325435 testsuite: Mark T9405 as broken on Windows 8bb960e testsuite/driver: Never symlink on Windows c6ee773 testsuite/timeout: Ensure that processes are cleaned up on Windows 17d696f validate: Allow user to override Python interpreter 7d2df32 testsuite/driver: More Unicode awareness 5b55e4b testsuite: Eliminate unnecessary compile_timeout_multiplier 2864ad7 testsuite/driver: Allow threading on Windows c5c6d80 testsuite: Mark T7037 as broken on Windows cf5eec3 Bump parallel submodule 8fa2cdb Track dep_finsts in exports hash, as it affects downstream deps. f148513 Add option to not retain CAFs to the linker API 1275994 remove unnecessary ifdef 46f5f02 fixup! Add option to not retain CAFs to the linker API 7129861 DynamicLoading: Replace map + zip with zipWith 161f463 ghc/Main.hs: Add import list to DynamicLoading fa8940e fix build failure on Solaris caused by usage of --export-dynamic a3bc93e Add some missing RTS symbols 3866481 Compute export hash based on ALL transitive orphan modules. 02f2f21 cmm/Hoopl/Dataflow: remove unused code 1f09c16 Test for newtype with unboxed argument 2cb8cc2 StgCmmPrim: Add missing write barrier. a6094fa configure.ac: Report Unregisterised setting 518f289 New story for abstract data types in hsig files. 7e77c4b Support constraint synonym implementations of abstract classes. 9df4ce4 Only delete instances when merging when there is an exact match. 01490b4 Mark previously failing backpack tests as passing, with correct output. c2142ca Fix Mac OS X build by removing space after ASSERT. c23dc61 check-cpp: Make it more robust ff225b4 Typos in comments 45bfd1a Refactor typechecking of pattern bindings 82efad7 Comments and trivial refactoring cdbc73a Test Trac #12507 d61c7e8 Make TcLevel increase by 1 not 2 3f5673f A collection of type-inference refactorings. 1f09b24 Accept 20% dedgradation in Trac #5030 compile time 9417e57 Refactor occurrence-check logic e1fc5a3 Define emitNewWantedEq, and use it 6ddba64 Improve TcCanonical.unifyWanted and unifyDerived f41a8a3 Add and use a new dynamic-library-dirs field in the ghc-pkg info acc9851 Fix failure in setnumcapabilities001 (#12728) 1050e46 rts: configure.ac should populate HAVE_LIBNUMA instead of USE_LIBNUMA a662f46 Skip T5611 on OSX as it fails non-deterministically. 3cb32d8 Add -Wcpp-undef warning flag 6e9a51c Refactoring: Delete copied function in backpack/NameShape b76cf04 cmm/Hoopl/Dataflow: minor cleanup aaede1e rts/package.conf.in: Fix CPP usage a6bcf87 Refactoring: Replace when (not ...) with unless in ErrUtils f084e68 rts: Move path utilities to separate source file 1c4a39d Prioritise class-level equality costraints 1221f81 Don't instantaite when typechecking a pattern synonym 08ba691 Take account of kinds in promoteTcType 03b0b8e Test Trac #12174 853cdae Test Trac #12081 a182c0e testsuite: Bump peak_megabytes_allocated for T3064 801c263 Fundeps work even for unary type classes 9f814b2 Delete extraneous backtick in users' guide 925d178 Make traceRn behave more like traceTc 488a9ed rts/linker: Move loadArchive to new source file 23143f6 Refine ASSERT in buildPatSyn for the nullary case. 48876ae Remove -dtrace-level b8effa7 CmmUtils: remove the last dataflow functions 3562727 Simple refactor to remove misleading comment f9308c2 Collect coercion variables, not type variables eefe86d Allow levity-polymorpic arrows 0eb8934 Fix typo in comment cc29eb5 Revert "rts/linker: Move loadArchive to new source file" 815b837 Minor doc addition as requested in #12774. 7187ded Clarify comments on kinds (Trac #12536) aae2b3d Make it possible to use +RTS -qn without -N 60343a4 Add test for #12732 5ebcb3a Document unpackClosure# primop 4b300a3 Minor refactoring in stg_unpackClosurezh 4e088b4 Fix a bug in parallel GC synchronisation 7ddbdfd Zap redundant imports 80d4a03 Typos in comments 795be0e Align GHCi's library search order more closely with LDs 0b70ec0 Have static pointers work with -fno-full-laziness. 19ce8a5 Sparc*: Prevent GHC from doing unaligned accesses 79fb6e6 Tiny refactor 9968949 Get rid of TcTyVars more assiduously 7a50966 Simplify the API for TcHsType.kcHsTyVarBndrs f4a14d6 Use substTyUnchecked in TcMType.new_meta_tv_x 13508ba Fix Trac #12797: approximateWC 623b8e4 Renaming and comments in CorePrep 8a5960a Uninstall signal handlers cc4710a testsuite: Simplify kernel32 glue logic f4fb3bc linker: Split out CacheFlush logic abfa319 linker: Shuffle configuration into LinkerInternals.h 43c8c1c linker: Move mmapForLinker declaration into LinkerInternals.h 3f05126 linker: Split symbol extras logic into new source file c3446c6 Shuffle declarations into LinkerInternals.h 6ea0b4f linker: Split PEi386 implementation into new source file f6c47df linker: Split MachO implementation into new source file bdc262c linker: Split ELF implementation into separate source file 6fecb7e linker: Move ARM interworking note to SymbolExtras.c dc4d596 Hoopl/Dataflow: make the module more self-contained 80076fa Add notes describing SRT concepts b5460dd Add testcase for #12757 967dd5c Merge cpe_ExprIsTrivial and exprIsTrivial eaa3482 testsuite: Update T10858 allocations ec22bac Add test for #12788 f46bfeb API Annotations: make all ModuleName Located a977c96 Omit unnecessary linker flags e43f05b Add comments from Trac #12768 7b0ae41 Remove a debug trace 2cdd9bd Take account of injectivity when doing fundeps b012120 Handle types w/ type variables in signatures inside patterns (DsMeta) 1cab42d Update release notes for type sigs in TH patterns patch 1c886ea Stop -dno-debug-output suppressing -ddump-tc-trace 25c8e80 Add tracing infrastructure to pattern match checker 630d881 Allow GeneralizedNewtypeDeriving for classes with associated type families ead83db Describe symptoms of (and the cure for) #12768 in 8.0.2 release notes 1964d86 Some minor linker cleanups. 7d988dd Fix broken validate build. 91f9e13 Fix hs_try_putmvar003 (#12800) 2e8463b Update 8.0.2 release notes for #12784 2325afe Fix comment about pointer tagging 7fe7163 Adapt the (commented out) pprTrace in OccurAnal f05d685 Refactoring of mkNewTypeEqn 317236d Refactor CallStack defaulting slightly 500d90d ghc-cabal: Use correct name of linker flags env variable 816d2e4 build system: Include CONF_LD_LINKER_OPTS in ALL_LD_OPTS 9030d8e configure: Pass HC_OPTS_STAGEx to build system bae4a55 Pass -no-pie to GCC 0a122a4 testsuite: Update allocation numbers for T5631 e06e21a Add Richard Eisenberg's new email to mailmap bef7e78 Read parentheses better 122d826 rts: Add api to pin a thread to a numa node but without fixing a capability aa10c67 rts/linker: Move loadArchive to new source file e8ae4dc Update user's guide after D2490 03e8d26 Prevent GND from inferring an instance context for method-less classes 60bb9d1 Revert "Pass -no-pie to GCC" 7a7bb5d Revert "Refactor CallStack defaulting slightly" ec0bf81 rts: Fix LoadArchive on OS X d421a7e Pass -no-pie to GCC 46e2bef testsuite: Lower allocations for T876 7eae862 ghc-pkg: Munge dynamic library directories 2cfbee8 rts: Fix build when linked with gold 4e0b8f4 rts: Fix #include of 587dccc Make default output less verbose (source/object paths) 568e003 template-haskell: Version bump ca1b986 ghc: Fix ghc's template-haskell bound 8cb7bc5 rts: Fix references to UChar 6c0f10f Kill Type pretty-printer 55d535d Remove CONSTR_STATIC 034e01e Accept output for scc003 e0ca7ff Fix numa001 failure with "too many NUMA nodes" cb16890 testsuite: Fix creep of T4029 011af2b configure: Verify that GCC recognizes -no-pie flag 1b336d9 Skip 64-bit symbol tables 98f9759 Hopefully fix build on OS X 642adec Mark T12041 as expect_broken with -DDEBUG (#12826) 017d11e Typos in comments, notes and manual 31d5b6e fixup! Stop the simplifier from removing StaticPtr binds. 0e58652 Test for unnecessary register spills 4a835f0 Update xhtml submodule a637eeb Don't use mmap symbols when !RTS_LINKER_USE_MMAP 0135188 Storage.c: Pass a size to sys_icache_invalidate fa70b1e Fix -fobject-code with -fexternal-interpreter 7acee06 Avoid calling newDynFlags when there are no changes d3542fa Generalise the implicit prelude import 8dfca69 Inline compiler/NOTES into X86/Ppr.hs b769586 Fix windows validate 31398fb Test for type synonym loops on TyCon. 2878604 Correct spelling of command-line option in comment cede770 Correct name of Note in comment 07e40e9 Add Data instance for Const 18eb57b Revert "Add Data instance for Const" 9a4983d Pass autoconf triplets to sub-project configures 20fb781 LLVM generate llvm.expect for conditional branches 4d4f353 testsuite: Rip out hack for #12554 04b024a GHCi: Unconditionally import System.Directory 231a3ae Have reify work for local variables with functional dependencies. 9c39e09 Switch to LLVM version 3.9 94d1221 Add missing SMP symbols to RT linker. d328abc Spelling in comment only 3bd1dd4 Add Data instance for Const 4b72f85 Optimise whole module exports 6ad94d8 Updated code comment regarding EquationInfo. Trac #12856 ea37b83 A few typos in comments 5bce207 testsuite: Add test for #12855 926469f testsuite: Add test for #12024 b98dbdf testsuite: Add (still broken) testcase for #12447 e7ec521 testsuite: Add (still failing) testcase for #12550 ea76a21 add ieee754 next* functions to math_funs 514acfe Implement fine-grained `-Werror=...` facility 4c0dc76 Ignore Hadrian build products. 7e4b611 Make transformers upstream repository location consistent with others 1399c8b ghc/hschooks.c: Fix include path of Rts.h f430253 Allow to unregister threadWaitReadSTM action. 14ac372 Collect wildcards in sum types during renaming (#12711) d081fcf Make quoting and reification return the same types 9a431e5 Make a panic into an ASSERT 0476a64 Fix a bug in mk_superclasses_of f04f118 Comments only in TcType 0123efd Add elemDVarEnv 1eec1f2 Another major constraint-solver refactoring 18d0bdd Allow TyVars in TcTypes 4431e48 Remove redundant kind check 90a65ad Perf improvements in T6048, T10547 e319466 Typos in comments c1b4b76 Fix a name-space problem with promotion f0f4682 Test Trac #12867 83a952d Test Trac #12845 a5a3926 Kill off ifaceTyVarsOfType bc35c3f Use 'v' instead of 'tpl' for template vars edbe831 Use TyVars in a DFunUnfolding 12eff23 Use TyVars in PatSyns 5f349fe Improve pretty-printing of types eb55ec2 Refactor functional dependencies a bit 1bfff60 Fix inference of partial signatures 086b483 A tiny bit more tc tracing f8c966c Be a bit more selective about improvement 6ec2304 Fix an long-standing bug in OccurAnal 5238842 Typos in comments only [ci skip] 605af54 Test Trac #12776 27a6bdf Test Trac #12885 3aa9368 Comments only (related to #12789) abd4a4c Make note of #12881 in 8.0.2 release notes f8c8de8 Zonk the free tvs of a RULE lhs to TyVars e755930 Typos in comments 36e3622 Store string as parsed in SourceText for CImport 1732d7a Define thread primitives if they're supported. 30cecae users_guide: Bring 8.0.2 release notes up-to-date with ghc-8.0 branch f1fc8cb Make diagnostics slightly more colorful 52222f9b Detect color support da5a61e Minor cleanup of foldRegs{Used,Defd} 2d99da0 testsuite: Mention CLEANUP option in README 3ec8563 Replace -fshow-source-paths with -fhide-source-paths c2268ba Refactor Pattern Match Checker to use ListT 6845087 Purge GHC of literate Perl 4d4e7a5 Use newBlockId instead of newLabelC 7753273 AsmCodeGen: Refactor worker in cmmNativeGens 6d5c2e7 NCGMonad: Add MonadUnique NatM instance eaed140 OrdList: Add Foldable, Traversable instances fe3748b testsuite: Bump haddock.compiler allocations 795f8bd hschooks.c: Ensure correct header file is included 6f7ed1e Make globals use sharedCAF 56d7451 Fix type of GarbageCollect declaration 428e152 Use C99's bool 758b81d rts: Add missing #include 23dc6c4 Remove most functions from cmm/BlockId b92f8e3 Added Eq1, Ord1, Read1 and Show1 instances for NonEmpty 679ccd1 Hoopl/Dataflow: use block-oriented interface 0ce59be Fix testsuite threading, timeout, encoding and performance issues on Windows dd9ba50 Update test output for Windows 605bb9b testsuite: Use python3 by default 20c0614 Update Mingw-w64 bindist for Windows ef37580 Fix windows validate. be8a47f Tweaks to grammar and such. 03766cd Rename RuntimeRepPolymorphism to LevityPolymorphism e2330b6 Revert "Make globals use sharedCAF" c2a2911 Revert "Fix windows validate." 6c54fa5 testsuite: Add another testcase for #11821 0200ded Fix typo in functional dependencies doc f48f5a9e Ensure flags destined for ld are properly passed 514c01e Levity polymorphic expressions mustn't be floated-out in let-bindings. a452c6e Make note of #12907 in 8.0.2 release notes 0ac5e0c rts: Fix type of bool literal 7214e92 testsuite: Remove Unicode literals from driver 6576bf8 rts: Ensure we always give MADV_DONTNEED a chance in osDecommitMemory 0f37550 Typos in comments a934e25 testsuite: Actually update haddock.compiler allocations 7fafb84 testsuite/conc059: Don't attempt to use stdcall where it isn't supported 747e77c Fix naming of the native latin1 encodings ddc271e Travis: Add dependency on python3 27731f1 Note Trac #12141 in mk/build.mk.sample f46369b fdReady: use poll() instead of select() 895a131 Install toplevel handler inside fork. 2350906 Maintain in-scope set in deeply_instantiate (fixes #12549). eb6f673 8.2.1-notes.rst: tweak binutils version 90c5af4 core-spec: Fix S_MatchData 517d03e Fix an asymptotic bug in the occurrence analyser 6305674 Fix used-variable calculation (Trac #12548) e912310 Use isFamFreeTyCon now we have it 3e3f7c2 Test Trac #12925 847d229 Color output is wreaking havoc on test results b82f71b Fix x86 Windows build and testsuite eec02ab Give concrete example for #12784 in 8.0.2 release notes 24e6594 Overhaul GC stats 19ae142 Mark rn017 and T7672 as expect_broken(#12930) with -DDEBUG 6e4188a Fix unsafe usage of `is_iloc` selector in Ord instance for ImportSpec eafa06d Revert "Mark rn017 and T7672 as expect_broken(#12930) with -DDEBUG" b7e88ee Reduce the size of string literals in binaries. 41ec722d Test Trac #12919 39143a4 Mark T9577 as broken on Darwin due to #12937 4dd6b37 Really mark T9577 as broken 7036fde Overhaul of Compact Regions (#12455) c02aeb5 Ignore output for compact_gc: sizes change when profiling 5aa9c75 Fix the test with -O 9043a40 Fix crashes in hash table scanning with THREADED_RTS d70d452 rts: Use pthread itimer implementation on Darwin 83d69dc Don't barf() on failures in loadArchive() 499e438 Add HsSyn prettyprinter tests 58d78dc Fix pretty printer test to nog generate stdout 9bcc4e3 Remove stray commented out line in all.T c5fbbac Ignore stderr of all printer tests 62332f3 Setup tcg_imports earlier during signature matching, so orphans are visible. 617d57d Reduce qualification in error messages from signature matching. 58c290a hschooks.c: Fix long line 5063edb arclint: Lint cabal files c766d53 rts/linker: Fix LoadArchive build on Windows 6889400 testsuite: Add test for #10249 1e5b7d7 Update Windows GCC driver. 55361b3 nativeGen: Fix string merging on Windows 2bb099e BlockId: remove BlockMap and BlockSet synonyms 6da6253 rts/PosixSource.h: Define __USE_MINGW_ANSI_STDIO on Windows f65ff2c Disambiguate reified closed type family kinds in TH 61932cd Bump haddock submodule d3b546b Scrutinee Constant Folding cee72d5 Disable colors unless printing to stderr 1c296c0c Export `warningGroups' and `warningHierarchies' 62418b8 Mark T12903 as broken on OS X 90fae01 Fix LLVM TBAA metadata 2823492 NCG: Implement trivColorable for PowerPC 64-bit ca593c7 testsuite: make tests respond to SIGINT properly d1df8d1 Ensure each test inherits the TEST_HC_OPTS 5349d64 Rename TH constructors for deriving strategies 24a4fe2 testsuite: Mark prog003 as broken on Windows 2618090 testsuite: Fix syntax error in rts/all.T 17ac9b1 rts: Provide _lock_file in symbol table on Windows 0ac5a00 Add `_unlock_file` to RTS symbols 490b942 Automate GCC driver wrapper c3c7024 Make globals use sharedCAF 818e027 Refactor pruning of implication constraints f1036ad Make dropDerivedSimples restore [WD] constraints 6720376 Disable T12903 due to flakiness d03dd23 Fix a long-standing bug in CSE bc3d37d Float unboxed expressions by boxing 8f6d241 Add infix flag for class and data declarations 24f6bec Sanity check if we pick up an hsig file without -instantiated-with. db23ccf Fix recompilation detection when set of signatures to merge changes. f723ba2 Revert "Float unboxed expressions by boxing" cc2e3ec base: Make raw buffer IO operations more strict cb582b6 Don't have CPP macros expanding to 'defined'. 9cb4a13 Fix Win32 x86 build validation after D2756 aa123f4 Fix testcase T12903 on OS X 7031704 print * in unicode correctly (fixes #12550) 8ec864d Fix pretty printing of top level SCC pragmas 9c9a222 Load orphan interfaces before checking if module implements signature 26ce99c Fix typo in users' guide 52c5e55 mk/config.mk.in: enable SMP on ARMv7+ (Trac #12981) 0c3341b Show constraints when reporting typed holes 6f7d827 Reset FPU precision back to MSVCRT defaults 8b2e588 Adds llvm-prof flavour 6370a56 Build terminfo on iOS. 3c7cf18 Fix pprCLabel on platforms without native codegen. be5384c testsuite: Mark T9577 as broken due to #12965 27287c8 procPointAnalysis doesn't need UniqSM fe5d68a Add entry to .gitignore to for __.SYMDEF_SORTED 9550b8d Make unboxedTuple{Type,Data}Name support 0- and 1-tuples 2940a61 testsuite: Specify expected allocations of T12877 for Windows 5c76f83 check-ppr: Add a --dump flag to aid in debugging 394231b Fix cost-centre-stacks bug (#5654) 1ec632f Fix pretty printing of MINIMAL signatures 503219e Warn about missing instance methods that start with an underscore d398162 testsuite: Separate out Windows results for T5205 4d683fa base: Bump version to 4.10.0.0 8f0546b testsuite: Add test for #12971 0cad52d testsuite: Mark T10294 as fixed 81c4956 testsuite: Add test for #12966 cd4b202 array: Check for integer overflow during allocation 0d213c1 UniqSupply: Use full range of machine word ffc2327 base: Add more POSIX types (fixes #12795) 6fecb2a Verify that known-key uniques fit in interface file ed4cf03 Typos in comments 13c1fc4 DynFlags: Rip out remnants of WarnContextQuantification c889df8 Packages: Kill unused UnitId argument to isDllName 5bf344b CLabel: Kill redundant UnitId argument from labelDynamic 222e99d Make up a module name for c-- files 4026b45 Fix string merging with -split-sections 8f71d95 Enable split sections by default where possible c8ed1bd testsuite: Add test for #12993 2fa00f5 UNREG: include CCS_OVERHEAD to STG a6657bd revert '-Wl' prefixing to *_LD_OPTS c480860 rts/Compact.cmm: fix UNREG build failure d88efb7 Fix Pretty printer tests on Windows 0af959b Revert "Do not init record accessors as exported" 87c3b1d fix OpenBSD linkage (wxneeded) 6c816c5 utils/genargs: delete unused tool 8906e7b Reshuffle levity polymorphism checks. 3dbd2b0 Windows: Improve terminal detection mechanism 2d1beb1 rts/win32/IOManager: Fix integer types 343b147 Reexport Language.Haskell.TH.Lib from Language.Haskell.TH 2a02040 Fix bug in previous fix for #5654 90cfa84 Run some tests with -fexternal-interpreter -prof 21dde81 Improve StringBuffer and FastString docs e0fe7c3 Docs: Delete duplicate paragraph in user guide 52ba947 Allow use of the external interpreter in stage1. 25b70a2 Check family instance consistency of hs-boot families later, fixes #11062. 630cfc3 Fix Haddock comment typo. b5d788a Introduce unboxedSum{Data,Type}Name to template-haskell 513eb6a Fix #12998 by removing CTimer 88e8194 T12035j: disable on NOSMP targets 4704d65 T8209: disable on NOSMP targets 7f5be7e T10296a: disable on NOSMP targets d327ebd regalloc_unit_tests: disable on UNREG targets bb74bc7 T8242: disable on NOSMP targets f1dfce1 Revert "Allow use of the external interpreter in stage1." 6263e10 Fix timeout's timeout on Windows c0c1f80 Mark T8089 as unbroken since #7325 is now resolved 27f7925 Allow use of the external interpreter in stage1. 4535fa2 Test Trac #12996 8fdb937 Make CompactionFailed a newtype 574abb7 Rewrite Note [Api annotations] for clarity. 9a29b65 Suppress duplicate .T files 1771da2 Fix typos (not test relevant) f97d489 Test Trac #12968, plus some comments c73a982 Add note for rebindable syntax of [a..b] c66dd05 Move typeSize/coercionSize into TyCoRep d250d49 Add INLINE pragamas on Traversable default methods e07ad4d Don't eta-expand in stable unfoldings 0a18231 Lint DFunUnfoldings 05d233e Move InId/OutId to CoreSyn c48595e Never apply worker/wrapper to DFuns 1a4c04b Fix 'SPECIALISE instance' c469db4 Test Trac #12950 74033c4 Improved perf for T12227 ccc918c Fix a forward reference to a Note 2189239 Disambiguate two Notes with identical names ee4e165 Support for abi-depends for computing shadowing. 99db12f Update ghc-cabal command line usage text. 46f7f31 Notes on parsing lists in Parser.y 41ade95 Fix another forward reference to a Note b7a6e62 Revert "Suppress duplicate .T files" efc4a16 Allow timeout to kill entire process tree. 7a13f1f Alpha-renaming and white space only f06b71a Fix a bug in ABot handling in CoreArity ea8f91d White space only 9a4af2c Comments only 11306d6 Ensure that even bottoming functions have an unfolding 432f952 Float unboxed expressions by boxing 793ddb6 Tiny refactor in CoreTidy 75e8c30 Propagate evaluated-ness a bit more faithfully ee872d3 Removed dead code in DsCCall.mk_alt b4c3a66 Push coercions in exprIsConApp_maybe 8712148 testsuite: Split out Windows allocations numbers for T12234 f95e669 users-guide: Kill extraneous link 8f89e76 rename: Don't require 'fail' in non-monadic contexts 158530a Add caret diagnostics 46a195f Use python3 for linters 1b06231 Fix test for T12877 94d2cce base: Override Foldable.{toList,length} for NonEmpty 2689a16 Define MAP_ANONYMOUS on systems that only provide MAP_ANON 48a5da9 rename: Add note describing #11216 9331e33 check-ppr: Make --dump the default behavior 3c9fbba Remove redudant import from check-ppr 815099c CallArity: Use exprIsCheap to detect thunks d2788ab Expand I/O CP in comments 88f5add testsuite: Fix T13025 4dec7d1 Testsuite: Skip failing tests on PowerPC 64-bit f3b99c7 Bump array submodule a370440 Fix various issues with testsuite code on Windows bab4ae8 Fix incorrect statement about plugin packages. 9ff0738 Remove documentation about non-existent flag. c560957 Disallow users to write instances of KnownNat and KnownSym cc0abfa Update .mailmap b28ca38 Don't suggest enabling TypeApplications when it's already enabled 8d63ca9 Refactor importdecls/topdecls parsing. 5800b02 Add specialization rules for realToFrac on Complex 683ed47 Don't use $ in the definition of (<**>) in GHC.Base 6b3c039 Typo in manual [ci skip] df72368 Typofixes in manual and comments [ci skip] 2664641 Remove a redundant test c909e6e Minor refactoring in CSE baf9ebe Ensure nested binders have Internal Names 19d5c73 Add a CSE pass to Stg (#9291) 5d2a92a Use atomic counter for GHC.Event.Unique 5797784 Remove single top-level section in Foldable docs 5ef956e Fix doctests in Data.Functor 5f91ac8 Coerce for fmapDefault and foldMapDefault e6aefd6 Use the right in-scope set 3540d1e Avoid exponential blowup in FamInstEnv.normaliseType b4f2afe Fix the implementation of the "push rules" 5088110 Add performance test for #13056 3a18baf More fixes for #5654 f3c7cf9 Add missing stderr file for T13035 e5d1ed9 Have addModFinalizer expose the local type environment. 54227a4 Actually add the right file for T13035 stderr c5452cc Revert "Have addModFinalizer expose the local type environment." c1ed955 Have addModFinalizer expose the local type environment. 7b317ef TH: Add Trustworthy language pragma 6c869f9 Parse holes as infix operators 7d2e5da Fix zonk_eq_types in TcCanonical a8a714e Typos in comments (and in a test) 1a6bdca Make HsIParamTy have a Located HsIPName e94b07d CmmCommonBlockElim: Ignore CmmUnwind nodes 6fe9b05 Properly detect MinTTY when running GHCi on Windows 0a6c257 -dead_strip is now the default on Darwin fe75d2d Ensure mkUserGuidePart is compiled with current GHC version e8d7432 testsuite: Add performance testcase from #12707 12ad4d4 Throw an exception on heap overflow 226c535 base: Add Foreign.ForeignPtr.plusForeignPtr. 8a76d32 Check that type variable does not reference itself in its kind signature 58e68b3 Enable subsections via symbols on iOS 89d4d26 users-guide: Produce OpenSearch description fe8bc14 Add doc header to Dynamic's re-export of Typeable 6de7613 event manager: Don't worry if attempt to wake dead manager fails eee8199 Remove deprecated InteractiveEval API 5857dfb Remove tyConString b1923ed Fix typo in comment c2bd62e Expose purgeObj in ObjLink 35a5b60 testsuite driver: don't append to existing output files 22845ad Fix terminal corruption bug and clean up SDoc interface. 266a9dc Don't use the splitter on Darwin 09bce7a Mark *FB functions INLINE[0] (Fixes #13001) 8b15fc4 Fix references in let/app invariant note 2be364a Inline partially-applied wrappers 436aa7a Revert "event manager: Don't worry if attempt to wake dead manager fails" 5f9c6d2 Support for using only partial pieces of included signatures. 9f169bc Attach warnings to non-PVP compatible uses of signatures. 0bbcf76 Warn if you explicitly export an identifier with warning attached. e41c61f Improve Backpack support for fixities. 5def07f Revamp Backpack/hs-boot handling of type class signatures. 8744869 Rewrite module signature documentation. f59aad6 Fix handling of closed type families in Backpack. 501de26 Improve coment in typecheckIfacesForMerging. f9df77e Add mkUserGuidePart.cabal to .gitignore c6b0486 Typos in manual, comments and tests 89ce9cd Small refactoring in TcErrors f5f6d42 Fix top-level constraint handling (Trac #12921) 6b976eb Record evaluated-ness on workers and wrappers d3ad013 Typos in comments 8b6fa4f Spelling fixes in non-exported data type a62701f Simplify CPP logic as we now need v7.10 for bootstrapping dde63e0 Require python3 like everywhere else too 13a8521 Desugar static forms to makeStatic calls. f63c8ef Use latin1 code page on Windows for response files. 331f88d Fix abort and import lib search on Windows db91d17 Properly introduce CTimer to System.Posix.Types c13151e Improve access violation reporting on Windows 1f48fbc Revert "Record evaluated-ness on workers and wrappers" 9d67f04 LLVM: Tweak TBAA metadata codegen 1ff3c58 Add dump-parsed-ast flag and functionality 4bfe3d4 Add missing test files for T13082. be79289 Unbreak libGHCi by adding missing symbol. 5a9a173 Refine exprOkForSpeculation 563d64f Comments about TyBinders (only) 715be01 Typos in manual and comments [ci skip] 38f289f Fix API Annotations for unboxed sums 769e3ee testsuite/recomp001: Sleep to ensure that GHC notices file change b1726c1 Bitmap: Use foldl' instead of foldr 19cc007 testsuite: Bump allocations for T12234 e7e5f7a Some 8.2.1 release notes for my stuff d5cd505 event manager: Don't worry if attempt to wake dead manager fails e195add Unquote ‘import’ in bad import error message d360ec3 Split mkInlineUnfolding into two functions 2b61f52 Unbreak build with ghc-7.10.1 e324e31 Typos in comments only [ci skip] 70472bf Spelling fixes in comments [ci skip] 3046dbb testsuite: Really fix recomp001 0b7cd65 Clean up RTS Linker Windows. 852c6a0 Modify ForeignPtr documentation in light of plusForeignPtr 181688a Improve suggestion for misspelled flag including '=' (fixes #11789) 0d769d5 Add CBool to Foreign.C.Types 38374ca Fix get_op in the case of an unambiguous record selector (#13132) e7985ed Update levity polymorphism f5bea98 Fix the GHC 7.10 build f07a6c1 Don't error on missing Perl, just warn and disable object splitting. bf1e1f3 Add explicit foldMap implementation for Maybe 9be18ea Fix a nasty bug in exprIsExpandable b78fa75 Simplify and improve CSE b8f1b01 Test Trac #11444 5ff812c check-cpp.py: change rb'foo' to br'foo' for Python 3.2 compatibility 7026edc Add 'type family (m :: Symbol) <> (n :: Symbol)' a2a67b7 Bump Cabal submodule d49b2bb Allow top-level string literals in Core (#8472) 33140f4 Show explicit quantifiers in conflicting definitions error b476131 Add a failing test for #13099 b626a00 testsuite: Don't fail if "target has RTS linker" field is missing c43011d Clean up some shell code and M4 quoting 15b9a85 Warn on missing home modules f9ccad2 Always use -Xlinker for -rpath 560bc28 Revert "Remove unnecessary isTyVar tests in TcType" 238f31c configure.ac: Eliminate stray close bracket 3f1a21d testsuite: Bump allocations on T5321Fun and T12707 5d38fb6 Remove clean_cmd and extra_clean usage from .T files 294f95d Preserve coercion axioms when thinning. bbe8956 Rewrite Backpack comments on never-exported TyThings. 9ef237b Failing test for #13149. 6850eb6 Improve pretty-printing of IfaceCoercions 2b64e92 Apply the right substitution in ty-fam improvement 80560e6 Typos and grammar in manual/comments 18ceb14 Make checkFamInstConsistency faster 729a5e4 Don't quantify implicit type variables when quoting type signatures in TH 596dece Record evaluated-ness on workers and wrappers 532c6ad Make tickishContains faster 368d547 typecheck: Fix note 1761bfa users-guide: Document -dppr-ticks 53e2e70 Ensure that scrutinee constant folding wraps numbers abaa681 Re-sort case alternatives after scrutinee constant folding (#13170) a8c81f3 Document -fspecialise-aggressively 8f49f6d Add a failing test for #13102 7726fd7 Remove unused LOCAL_GHC_PKG definition from a test Makefile 90e83a7 Skip path_with_commas when dyn unavailable 9fd87ef Don't put foralls in front of TH-spliced GADT constructors that don't need them 99f8182 Partially revert D3001 deb75cb UniqSet: Implement unionManyUniqSets in terms of foldl' instead of foldr efc8e3b nativeGen: Use `foldl'` instead of `foldr` in free register accumulation 2cc67ad HscTypes: Use foldl' instead of foldr 2aaafc8 Bump Win32 version. 65cc762 testsuite: Bump compiler allocations of T5837 675b54f Update .mailmap e4ae78a Typos in comments [ci skip] a1cd959 Add myself [ci skip] 078c211 Update Win32 submodule to fix Windows build 1a3f1ee COMPLETE pragmas for enhanced pattern exhaustiveness checking 95dc6dc Template Haskell support for COMPLETE pragmas c344005 Generalize the type of runRW# e4ab8ba Add pragCompleteDName to templateHaskellNames 88a89b7 Nix typo and redundant where-clauses ff9355e Typos in comments [ci skip] 0d1cb15 Make type import/export API Annotation friendly 50544ee Prune unneeded Derive* language pragmas ad3d2df Don't unnecessarily qualify TH-converted instances with empty contexts 3eebd1f Generalizes the type of asProxyTypeOf (#12805) d8cb4b0 Bump nofib submodule 4e63e85 Bump hsc2hs submodule 2ffcdfa Fatal if we try to reinitialize the RTS 06b9561 Fix the right-shift operation for negative big integers (fixes #12136) 2af38b0 Remove Data.Tuple doc's claim to have tuple types 1f366b8 Add delete retry loop. [ci skip] de78ee6 Document GHC.Profiling functions [ci skip] bc42e2b Convert pprTrace in isPredTy to a WARN 34a0205 UNREG: fix "_bytes" string literal forward declaration 4441f90 UNREG: add a forward declaration for local literals f60287c Fix mismatched tick in GHC.Generics documentation d2cf5de Fix deprecation warnings from containers 2ec1c83 Fix broken tests 7363d53 Check that a default type signature aligns with the non-default signature 9169111 Add a flag to emit error messages as JSON 5593573 Fixes bug #11046 f41c27d Slighly clean up symbol loading error. 5f8e234 Print COMPLETE pragmas in --show-iface f984bf2 Simplify minusInteger in integer-gmp slightly 9af1fb2 Fix links to building guides in MAKEHELP.md e9a239c Fix minor typo in README.md 32729d3 Turn libraries/integer-gmp/gmp/tarball into a submodule c71f0c4 Fix binary instance for SrcStrictness 748b797 Use top-level instances to solve superclasses where possible b3576ed Mark reallyUnsafePtrEquality# as can_fail cb4b4fe users guide: Fix markup of COMPLETE pragma examples afc05c7 README: Mention acceptability of pull requests 44f079f FloatOut: Allow floating through breakpoint ticks 4dfc6d1 Abstract over the way eventlogs are flushed b15136a user-guide: fix links and file names (fixes #13198) 25e0cfc Export callStackDoc 99e920c Typos in note header and test f660306 Update output of failing 11223 tests 4fa439e Remove very broad ignore. [ci skip] 8d5cf8b Join points 3d65411 testsuite: Update allocations for T12234 d2b681b Fix documentation NOTE about can_fail 5cb5b7a base: Derive Enum, Bounded for VecCount, VecElem f5b275a Don't tick top-level string literals 1fcede4 Introduce GHC.TypeNats module, change KnownNat evidence to be Natural b16239a Make interface loading for COMPLETE pragmas lazy eedb3df Add support for StaticPointers in GHCi 8dd82ea Spelling fixes d8ac64e Add a testcase for #13227 b103532 Exhaustiveness check for EmptyCase (Trac #10746) 895aa6d Bump haskeline submodule 5728f4b Remove INLINE pragma on loopbreaker 6128b2f users-guide: Explain behavior of verbose-core2core + dump-inlinings bbd3c39 Ditch static flags 09b8332 Get rid of ProbOneShot c2becee Bump performance mark for T9020 afa409f Use tyCoVarsOfType for CTyEqCan in shouldSplitWD 2f5cb3d Attempt to make lazy ST thread safe 9984024 Fix comment (old file names) in includes/ 31bb85f Fix comment (old file names) in rts/ 8d60d73 Fix comment (old file names) in compiler/ 4d31880 Fix comment (old filename '.lhs') in libraries/ 283acec Make split sections by default work again 18cdef3 Fix minusNatural exception to be Underflow 157a46f Update binary submodule to 0.8.4.1 2912231 Improve wrapTicks performance with lots of redundant source notes 68cbe52 Don't panic when printing match with RecUpd context bd818a7 Fix comment (old file names) in mk/ and utils/ 8212135 New internal dynamic flag: Very aggressive inlining 54b9b06 Expose cseExpr from CSE 88950a1 Ensure that Literals in an Int# case are in range From git at git.haskell.org Sun Feb 5 15:53:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 5 Feb 2017 15:53:18 +0000 (UTC) Subject: [commit: ghc] wip/T13227: Improve the Occurrence Analyzer’s handling of one-shot functions (a9dc47a) Message-ID: <20170205155318.6914B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T13227 Link : http://ghc.haskell.org/trac/ghc/changeset/a9dc47a1b9950afc4690f950dbcbf0f135a20b45/ghc >--------------------------------------------------------------- commit a9dc47a1b9950afc4690f950dbcbf0f135a20b45 Author: Joachim Breitner Date: Sun Feb 5 10:52:12 2017 -0500 Improve the Occurrence Analyzer’s handling of one-shot functions as suggested by Simon. This commit is sent to perf.haskell.org, and will be commented before it goes towards master. >--------------------------------------------------------------- a9dc47a1b9950afc4690f950dbcbf0f135a20b45 compiler/simplCore/OccurAnal.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/simplCore/OccurAnal.hs b/compiler/simplCore/OccurAnal.hs index b02ddc9..b328146 100644 --- a/compiler/simplCore/OccurAnal.hs +++ b/compiler/simplCore/OccurAnal.hs @@ -1867,7 +1867,7 @@ occAnalApp env (Var fun, args, ticks) -- This is the *whole point* of the isRhsEnv predicate -- See Note [Arguments of let-bound constructors] - n_val_args = valArgCount args + n_val_args = valArgCount args + length (occ_one_shots env) n_args = length args fun_uds = mkOneOcc env fun (n_val_args > 0) n_args is_exp = isExpandableApp fun n_val_args @@ -1876,7 +1876,7 @@ occAnalApp env (Var fun, args, ticks) -- Simplify.prepareRhs one_shots = argsOneShots (idStrictness fun) n_val_args - -- See Note [Use one-shot info] + -- See Note [Use one-shot information] occAnalApp env (fun, args, ticks) = (markAllNonTailCalled (fun_uds +++ args_uds), From git at git.haskell.org Sun Feb 5 15:53:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 5 Feb 2017 15:53:20 +0000 (UTC) Subject: [commit: ghc] wip/T13227's head updated: Improve the Occurrence Analyzer’s handling of one-shot functions (a9dc47a) Message-ID: <20170205155320.D71693A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/T13227' now includes: b103532 Exhaustiveness check for EmptyCase (Trac #10746) 895aa6d Bump haskeline submodule 5728f4b Remove INLINE pragma on loopbreaker 6128b2f users-guide: Explain behavior of verbose-core2core + dump-inlinings bbd3c39 Ditch static flags 09b8332 Get rid of ProbOneShot c2becee Bump performance mark for T9020 afa409f Use tyCoVarsOfType for CTyEqCan in shouldSplitWD 2f5cb3d Attempt to make lazy ST thread safe 9984024 Fix comment (old file names) in includes/ 31bb85f Fix comment (old file names) in rts/ 8d60d73 Fix comment (old file names) in compiler/ 4d31880 Fix comment (old filename '.lhs') in libraries/ 283acec Make split sections by default work again 18cdef3 Fix minusNatural exception to be Underflow 157a46f Update binary submodule to 0.8.4.1 2912231 Improve wrapTicks performance with lots of redundant source notes 68cbe52 Don't panic when printing match with RecUpd context bd818a7 Fix comment (old file names) in mk/ and utils/ 8212135 New internal dynamic flag: Very aggressive inlining 54b9b06 Expose cseExpr from CSE a9dc47a Improve the Occurrence Analyzer’s handling of one-shot functions From git at git.haskell.org Sun Feb 5 17:28:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 5 Feb 2017 17:28:29 +0000 (UTC) Subject: [commit: ghc] wip/T13227: Improve the Occurrence Analyzer’s handling of one-shot functions (4a78993) Message-ID: <20170205172829.4CF103A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T13227 Link : http://ghc.haskell.org/trac/ghc/changeset/4a78993377b2bcafc5f28eccac48c5388624d2f2/ghc >--------------------------------------------------------------- commit 4a78993377b2bcafc5f28eccac48c5388624d2f2 Author: Joachim Breitner Date: Sun Feb 5 10:52:12 2017 -0500 Improve the Occurrence Analyzer’s handling of one-shot functions as suggested by Simon. This commit is sent to perf.haskell.org, and will be commented before it goes towards master. >--------------------------------------------------------------- 4a78993377b2bcafc5f28eccac48c5388624d2f2 compiler/simplCore/OccurAnal.hs | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/compiler/simplCore/OccurAnal.hs b/compiler/simplCore/OccurAnal.hs index b02ddc9..39daa8d 100644 --- a/compiler/simplCore/OccurAnal.hs +++ b/compiler/simplCore/OccurAnal.hs @@ -1547,7 +1547,7 @@ occAnalNonRecRhs env bndr bndrs body env1 | certainly_inline = env | otherwise = rhsCtxt env - -- See Note [Use one-shot info] + -- See Note [Sources of one-shot info] rhs_env = env1 { occ_one_shots = argOneShots dmd } @@ -1867,7 +1867,8 @@ occAnalApp env (Var fun, args, ticks) -- This is the *whole point* of the isRhsEnv predicate -- See Note [Arguments of let-bound constructors] - n_val_args = valArgCount args + n_val_args = valArgCount args + length (occ_one_shots env) + n_args = length args fun_uds = mkOneOcc env fun (n_val_args > 0) n_args is_exp = isExpandableApp fun n_val_args @@ -1876,7 +1877,7 @@ occAnalApp env (Var fun, args, ticks) -- Simplify.prepareRhs one_shots = argsOneShots (idStrictness fun) n_val_args - -- See Note [Use one-shot info] + -- See Note [Sources of one-shot information] occAnalApp env (fun, args, ticks) = (markAllNonTailCalled (fun_uds +++ args_uds), @@ -1898,10 +1899,9 @@ zapDetailsIf True uds = zapDetails uds zapDetailsIf False uds = uds {- -Note [Use one-shot information] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The occurrrence analyser propagates one-shot-lambda information in two -situations: +Note [Sources of one-shot information] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +The occurrence analyser obtains one-shot-lambda information from two sources: * Applications: eg build (\c n -> blah) @@ -1924,6 +1924,22 @@ Previously, the demand analyser would *also* set the one-shot information, but that code was buggy (see #11770), so doing it only in on place, namely here, is saner. +Note [OneShots] +~~~~~~~~~~~~~~~ +When analysing an expression, the occ_one_shots argument contains information +about how the function is being used. The length of the list indicates +how many arguments will eventually be passed to the analysed expression, +and the OneShotInfo indicates whether this application is once or multiple times. + +Example: + + Context of f occ_one_shots when analysing f + + f 1 2 [OneShot, OneShot] + map (f 1) [OneShot, NoOneShotInfo] + build f [OneShot, OneShot] + f 1 2 `seq` f 2 1 [NoOneShotInfo, OneShot] + Note [Binders in case alternatives] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Consider @@ -2008,7 +2024,7 @@ wrapAltRHS _ _ alt_usg _ alt_rhs data OccEnv = OccEnv { occ_encl :: !OccEncl -- Enclosing context information - , occ_one_shots :: !OneShots -- Tells about linearity + , occ_one_shots :: !OneShots -- See Note [OneShots] , occ_gbl_scrut :: GlobalScruts , occ_rule_act :: Activation -> Bool -- Which rules are active -- See Note [Finding rule RHS free vars] @@ -2037,11 +2053,8 @@ instance Outputable OccEncl where ppr OccRhs = text "occRhs" ppr OccVanilla = text "occVanilla" +-- See note [OneShots] type OneShots = [OneShotInfo] - -- [] No info - -- - -- one_shot_info:ctxt Analysing a function-valued expression that - -- will be applied as described by one_shot_info initOccEnv :: (Activation -> Bool) -> OccEnv initOccEnv active_rule From git at git.haskell.org Sun Feb 5 17:35:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 5 Feb 2017 17:35:37 +0000 (UTC) Subject: [commit: ghc] wip/T13227: Bind educated guess: count OneShotInfos in occ_one_shots (6564330) Message-ID: <20170205173537.505063A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T13227 Link : http://ghc.haskell.org/trac/ghc/changeset/6564330e7be18cc8154843f9c0aa75e67422d6ae/ghc >--------------------------------------------------------------- commit 6564330e7be18cc8154843f9c0aa75e67422d6ae Author: Joachim Breitner Date: Sun Feb 5 12:34:48 2017 -0500 Bind educated guess: count OneShotInfos in occ_one_shots so lets see what perf.haskell.org has to say. >--------------------------------------------------------------- 6564330e7be18cc8154843f9c0aa75e67422d6ae compiler/simplCore/OccurAnal.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/simplCore/OccurAnal.hs b/compiler/simplCore/OccurAnal.hs index 39daa8d..495201b 100644 --- a/compiler/simplCore/OccurAnal.hs +++ b/compiler/simplCore/OccurAnal.hs @@ -1867,7 +1867,7 @@ occAnalApp env (Var fun, args, ticks) -- This is the *whole point* of the isRhsEnv predicate -- See Note [Arguments of let-bound constructors] - n_val_args = valArgCount args + length (occ_one_shots env) + n_val_args = valArgCount args + length (takeWhile (==OneShotInfo) occ_one_shots env) n_args = length args fun_uds = mkOneOcc env fun (n_val_args > 0) n_args From git at git.haskell.org Sun Feb 5 17:46:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 5 Feb 2017 17:46:27 +0000 (UTC) Subject: [commit: ghc] wip/T13227: Bind educated guess: count OneShotInfos in occ_one_shots (88dcbc6) Message-ID: <20170205174627.364F23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T13227 Link : http://ghc.haskell.org/trac/ghc/changeset/88dcbc63ae3482c55e96c12ab02ebc9a820781ff/ghc >--------------------------------------------------------------- commit 88dcbc63ae3482c55e96c12ab02ebc9a820781ff Author: Joachim Breitner Date: Sun Feb 5 12:34:48 2017 -0500 Bind educated guess: count OneShotInfos in occ_one_shots so lets see what perf.haskell.org has to say. >--------------------------------------------------------------- 88dcbc63ae3482c55e96c12ab02ebc9a820781ff compiler/simplCore/OccurAnal.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/simplCore/OccurAnal.hs b/compiler/simplCore/OccurAnal.hs index 39daa8d..e3fef9d 100644 --- a/compiler/simplCore/OccurAnal.hs +++ b/compiler/simplCore/OccurAnal.hs @@ -1867,7 +1867,7 @@ occAnalApp env (Var fun, args, ticks) -- This is the *whole point* of the isRhsEnv predicate -- See Note [Arguments of let-bound constructors] - n_val_args = valArgCount args + length (occ_one_shots env) + n_val_args = valArgCount args + length (takeWhile isOneShotInfo (occ_one_shots env)) n_args = length args fun_uds = mkOneOcc env fun (n_val_args > 0) n_args From git at git.haskell.org Sun Feb 5 21:47:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 5 Feb 2017 21:47:21 +0000 (UTC) Subject: [commit: ghc] wip/T13227: Improve the Occurrence Analyzer’s handling of one-shot functions (4f92864) Message-ID: <20170205214721.398BC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T13227 Link : http://ghc.haskell.org/trac/ghc/changeset/4f92864d04045b9ad58c6ee95616631f53c817c3/ghc >--------------------------------------------------------------- commit 4f92864d04045b9ad58c6ee95616631f53c817c3 Author: Joachim Breitner Date: Sun Feb 5 10:52:12 2017 -0500 Improve the Occurrence Analyzer’s handling of one-shot functions when determining whether an expression is used saturatedly, count the number of value arguments that the occurrence analyser sees, and add the number of one-shot arguments that we know (from the strictness analyser) are passed from the context. This was suggested by Simon PJ in ticket #13227. perf results suggest no noticable change in allocations, reduction of code sizes, and performance regression possibliy due to loss of join points. Differential Revision: https://phabricator.haskell.org/D3089 >--------------------------------------------------------------- 4f92864d04045b9ad58c6ee95616631f53c817c3 compiler/simplCore/OccurAnal.hs | 42 +++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/compiler/simplCore/OccurAnal.hs b/compiler/simplCore/OccurAnal.hs index b02ddc9..1438ac6 100644 --- a/compiler/simplCore/OccurAnal.hs +++ b/compiler/simplCore/OccurAnal.hs @@ -1547,7 +1547,7 @@ occAnalNonRecRhs env bndr bndrs body env1 | certainly_inline = env | otherwise = rhsCtxt env - -- See Note [Use one-shot info] + -- See Note [Sources of one-shot info] rhs_env = env1 { occ_one_shots = argOneShots dmd } @@ -1867,7 +1867,13 @@ occAnalApp env (Var fun, args, ticks) -- This is the *whole point* of the isRhsEnv predicate -- See Note [Arguments of let-bound constructors] - n_val_args = valArgCount args + n_val_args = valArgCount args + length (takeWhile isOneShotInfo (occ_one_shots env)) + -- n_val_args is used to determine if this call is saturated. We want to consider + -- the lambda expression in 'build (\x y -> …)' to be considered + -- saturated, so we count one-shot arguments from the context. + -- But 'map (\x -> …)' is not saturated, so we only count the one-shot + -- arguments. + n_args = length args fun_uds = mkOneOcc env fun (n_val_args > 0) n_args is_exp = isExpandableApp fun n_val_args @@ -1876,7 +1882,7 @@ occAnalApp env (Var fun, args, ticks) -- Simplify.prepareRhs one_shots = argsOneShots (idStrictness fun) n_val_args - -- See Note [Use one-shot info] + -- See Note [Sources of one-shot information] occAnalApp env (fun, args, ticks) = (markAllNonTailCalled (fun_uds +++ args_uds), @@ -1898,10 +1904,9 @@ zapDetailsIf True uds = zapDetails uds zapDetailsIf False uds = uds {- -Note [Use one-shot information] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The occurrrence analyser propagates one-shot-lambda information in two -situations: +Note [Sources of one-shot information] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +The occurrence analyser obtains one-shot-lambda information from two sources: * Applications: eg build (\c n -> blah) @@ -1924,6 +1929,22 @@ Previously, the demand analyser would *also* set the one-shot information, but that code was buggy (see #11770), so doing it only in on place, namely here, is saner. +Note [OneShots] +~~~~~~~~~~~~~~~ +When analysing an expression, the occ_one_shots argument contains information +about how the function is being used. The length of the list indicates +how many arguments will eventually be passed to the analysed expression, +and the OneShotInfo indicates whether this application is once or multiple times. + +Example: + + Context of f occ_one_shots when analysing f + + f 1 2 [OneShot, OneShot] + map (f 1) [OneShot, NoOneShotInfo] + build f [OneShot, OneShot] + f 1 2 `seq` f 2 1 [NoOneShotInfo, OneShot] + Note [Binders in case alternatives] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Consider @@ -2008,7 +2029,7 @@ wrapAltRHS _ _ alt_usg _ alt_rhs data OccEnv = OccEnv { occ_encl :: !OccEncl -- Enclosing context information - , occ_one_shots :: !OneShots -- Tells about linearity + , occ_one_shots :: !OneShots -- See Note [OneShots] , occ_gbl_scrut :: GlobalScruts , occ_rule_act :: Activation -> Bool -- Which rules are active -- See Note [Finding rule RHS free vars] @@ -2037,11 +2058,8 @@ instance Outputable OccEncl where ppr OccRhs = text "occRhs" ppr OccVanilla = text "occVanilla" +-- See note [OneShots] type OneShots = [OneShotInfo] - -- [] No info - -- - -- one_shot_info:ctxt Analysing a function-valued expression that - -- will be applied as described by one_shot_info initOccEnv :: (Activation -> Bool) -> OccEnv initOccEnv active_rule From git at git.haskell.org Mon Feb 6 00:49:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 6 Feb 2017 00:49:36 +0000 (UTC) Subject: [commit: ghc] master: Add liftA2 to Applicative class (a2f39da) Message-ID: <20170206004936.528783A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a2f39da0461b5da62a9020b0d98a1ce2765dd700/ghc >--------------------------------------------------------------- commit a2f39da0461b5da62a9020b0d98a1ce2765dd700 Author: David Feuer Date: Sun Feb 5 19:43:31 2017 -0500 Add liftA2 to Applicative class * Make `liftA2` a method of `Applicative`. * Add explicit `liftA2` definitions to instances in `base`. * Add explicit invocations in `base`. Reviewers: ekmett, bgamari, RyanGlScott, austin, hvr Reviewed By: RyanGlScott Subscribers: ekmett, RyanGlScott, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3031 >--------------------------------------------------------------- a2f39da0461b5da62a9020b0d98a1ce2765dd700 compiler/prelude/PrelNames.hs | 3 +- compiler/typecheck/TcGenFunctor.hs | 15 +++-- docs/users_guide/8.2.1-notes.rst | 6 ++ libraries/base/Control/Applicative.hs | 8 ++- libraries/base/Control/Monad/ST/Lazy/Imp.hs | 15 +++++ libraries/base/Data/Bitraversable.hs | 13 ++-- libraries/base/Data/Complex.hs | 2 + libraries/base/Data/Functor/Compose.hs | 11 +++- libraries/base/Data/Functor/Const.hs | 1 + libraries/base/Data/Functor/Identity.hs | 1 + libraries/base/Data/Functor/Product.hs | 3 +- libraries/base/Data/Functor/Utils.hs | 8 +++ libraries/base/Data/List/NonEmpty.hs | 9 +-- libraries/base/Data/Semigroup.hs | 13 ++-- libraries/base/Data/Traversable.hs | 2 +- libraries/base/GHC/Base.hs | 75 +++++++++++++++++----- libraries/base/GHC/Conc/Sync.hs | 2 + libraries/base/GHC/Generics.hs | 39 ++++++----- libraries/base/GHC/ST.hs | 1 + libraries/base/Text/ParserCombinators/ReadP.hs | 1 + libraries/base/Text/ParserCombinators/ReadPrec.hs | 1 + libraries/base/changelog.md | 7 ++ libraries/base/tests/T13191.hs | 71 ++++++++++++++++++++ libraries/base/tests/T13191.stdout | 1 + libraries/base/tests/all.T | 8 +++ .../tests/simplCore/should_compile/T8848.stderr | 48 ++++++++++---- 26 files changed, 285 insertions(+), 79 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 a2f39da0461b5da62a9020b0d98a1ce2765dd700 From git at git.haskell.org Mon Feb 6 02:25:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 6 Feb 2017 02:25:09 +0000 (UTC) Subject: [commit: ghc] master: Use proper primitives in Utils.Binary (fbcef83) Message-ID: <20170206022509.0E07F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fbcef83a3aa130d976a201f2a21c5afc5a43d000/ghc >--------------------------------------------------------------- commit fbcef83a3aa130d976a201f2a21c5afc5a43d000 Author: alexbiehl Date: Sun Feb 5 20:23:09 2017 -0500 Use proper primitives in Utils.Binary `Word{16,32,64}` are implemented using `getWord8`. This patch introduces `getWord{16,32,64}` and `putWord{16,32,64}`. This is nicer and probably a bit faster. Reviewers: bgamari, austin Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2908 >--------------------------------------------------------------- fbcef83a3aa130d976a201f2a21c5afc5a43d000 compiler/utils/Binary.hs | 189 ++++++++++++++++++++++++----------------------- 1 file changed, 96 insertions(+), 93 deletions(-) diff --git a/compiler/utils/Binary.hs b/compiler/utils/Binary.hs index 07eb3bc..275b1a9 100644 --- a/compiler/utils/Binary.hs +++ b/compiler/utils/Binary.hs @@ -68,7 +68,7 @@ import SrcLoc import Foreign import Data.Array import Data.ByteString (ByteString) -import qualified Data.ByteString as BS +import qualified Data.ByteString.Internal as BS import qualified Data.ByteString.Unsafe as BS import Data.IORef import Data.Char ( ord, chr ) @@ -225,35 +225,80 @@ expandBin (BinMem _ _ sz_r arr_r) off = do -- ----------------------------------------------------------------------------- -- Low-level reading/writing of bytes +be16 :: Word16 -> Word16 +#ifdef WORDS_BIGENDIAN +be16 w = w +#else +be16 w = byteSwap16 w +#endif +{-# INLINE be16 #-} + +be32 :: Word32 -> Word32 +#ifdef WORDS_BIGENDIAN +be32 w = w +#else +be32 w = byteSwap32 w +#endif +{-# INLINE be32 #-} + +be64 :: Word64 -> Word64 +#ifdef WORDS_BIGENDIAN +be64 w = w +#else +be64 w = byteSwap64 w +#endif +{-# INLINE be64 #-} + +putPrim :: BinHandle -> Int -> (Ptr Word8 -> IO ()) -> IO () +putPrim h@(BinMem _ ix_r sz_r arr_r) size f = do + ix <- readFastMutInt ix_r + sz <- readFastMutInt sz_r + when (ix + size > sz) $ + expandBin h (ix + size) + arr <- readIORef arr_r + withForeignPtr arr $ \op -> f (op `plusPtr` ix) + writeFastMutInt ix_r (ix + size) + +getPrim :: BinHandle -> Int -> (Ptr Word8 -> IO a) -> IO a +getPrim (BinMem _ ix_r sz_r arr_r) size f = do + ix <- readFastMutInt ix_r + sz <- readFastMutInt sz_r + when (ix + size > sz) $ + ioError (mkIOError eofErrorType "Data.Binary.getPrim" Nothing Nothing) + arr <- readIORef arr_r + w <- withForeignPtr arr $ \op -> f (op `plusPtr` ix) + writeFastMutInt ix_r (ix + size) + return w + putWord8 :: BinHandle -> Word8 -> IO () -putWord8 h@(BinMem _ ix_r sz_r arr_r) w = do - ix <- readFastMutInt ix_r - sz <- readFastMutInt sz_r - -- double the size of the array if it overflows - if (ix >= sz) - then do expandBin h ix - putWord8 h w - else do arr <- readIORef arr_r - withForeignPtr arr $ \p -> pokeByteOff p ix w - writeFastMutInt ix_r (ix+1) - return () +putWord8 h w = putPrim h 1 (\op -> poke op w) getWord8 :: BinHandle -> IO Word8 -getWord8 (BinMem _ ix_r sz_r arr_r) = do - ix <- readFastMutInt ix_r - sz <- readFastMutInt sz_r - when (ix >= sz) $ - ioError (mkIOError eofErrorType "Data.Binary.getWord8" Nothing Nothing) - arr <- readIORef arr_r - w <- withForeignPtr arr $ \p -> peekByteOff p ix - writeFastMutInt ix_r (ix+1) - return w +getWord8 h = getPrim h 1 peek + +putWord16 :: BinHandle -> Word16 -> IO () +putWord16 h w = putPrim h 2 (\op -> poke (castPtr op :: Ptr Word16) (be16 w)) + +getWord16 :: BinHandle -> IO Word16 +getWord16 h = getPrim h 2 (\op -> be16 <$> peek (castPtr op :: Ptr Word16)) + +putWord32 :: BinHandle -> Word32 -> IO () +putWord32 h w = putPrim h 4 (\op -> poke (castPtr op :: Ptr Word32) (be32 w)) + +getWord32 :: BinHandle -> IO Word32 +getWord32 h = getPrim h 4 (\op -> be32 <$> peek (castPtr op :: Ptr Word32)) + +putWord64 :: BinHandle -> Word64 -> IO () +putWord64 h w = putPrim h 8 (\op -> poke (castPtr op :: Ptr Word64) (be64 w)) + +getWord64 :: BinHandle -> IO Word64 +getWord64 h = getPrim h 8 (\op -> be64 <$> peek (castPtr op :: Ptr Word64)) putByte :: BinHandle -> Word8 -> IO () -putByte bh w = put_ bh w +putByte bh w = putWord8 bh w getByte :: BinHandle -> IO Word8 -getByte = getWord8 +getByte h = getWord8 h -- ----------------------------------------------------------------------------- -- Primitve Word writes @@ -263,58 +308,16 @@ instance Binary Word8 where get = getWord8 instance Binary Word16 where - put_ h w = do -- XXX too slow.. inline putWord8? - putByte h (fromIntegral (w `shiftR` 8)) - putByte h (fromIntegral (w .&. 0xff)) - get h = do - w1 <- getWord8 h - w2 <- getWord8 h - return $! ((fromIntegral w1 `shiftL` 8) .|. fromIntegral w2) - + put_ h w = putWord16 h w + get h = getWord16 h instance Binary Word32 where - put_ h w = do - putByte h (fromIntegral (w `shiftR` 24)) - putByte h (fromIntegral ((w `shiftR` 16) .&. 0xff)) - putByte h (fromIntegral ((w `shiftR` 8) .&. 0xff)) - putByte h (fromIntegral (w .&. 0xff)) - get h = do - w1 <- getWord8 h - w2 <- getWord8 h - w3 <- getWord8 h - w4 <- getWord8 h - return $! ((fromIntegral w1 `shiftL` 24) .|. - (fromIntegral w2 `shiftL` 16) .|. - (fromIntegral w3 `shiftL` 8) .|. - (fromIntegral w4)) + put_ h w = putWord32 h w + get h = getWord32 h instance Binary Word64 where - put_ h w = do - putByte h (fromIntegral (w `shiftR` 56)) - putByte h (fromIntegral ((w `shiftR` 48) .&. 0xff)) - putByte h (fromIntegral ((w `shiftR` 40) .&. 0xff)) - putByte h (fromIntegral ((w `shiftR` 32) .&. 0xff)) - putByte h (fromIntegral ((w `shiftR` 24) .&. 0xff)) - putByte h (fromIntegral ((w `shiftR` 16) .&. 0xff)) - putByte h (fromIntegral ((w `shiftR` 8) .&. 0xff)) - putByte h (fromIntegral (w .&. 0xff)) - get h = do - w1 <- getWord8 h - w2 <- getWord8 h - w3 <- getWord8 h - w4 <- getWord8 h - w5 <- getWord8 h - w6 <- getWord8 h - w7 <- getWord8 h - w8 <- getWord8 h - return $! ((fromIntegral w1 `shiftL` 56) .|. - (fromIntegral w2 `shiftL` 48) .|. - (fromIntegral w3 `shiftL` 40) .|. - (fromIntegral w4 `shiftL` 32) .|. - (fromIntegral w5 `shiftL` 24) .|. - (fromIntegral w6 `shiftL` 16) .|. - (fromIntegral w7 `shiftL` 8) .|. - (fromIntegral w8)) + put_ h w = putWord64 h w + get h = getWord64 h -- ----------------------------------------------------------------------------- -- Primitve Int writes @@ -471,12 +474,25 @@ instance Binary DiffTime where -- yes, we need Binary Integer and Binary Rational in basicTypes/Literal.hs instance Binary Integer where - -- XXX This is hideous - put_ bh i = put_ bh (show i) - get bh = do str <- get bh + put_ bh i + | i >= lo32 && i <= hi32 = do + putWord8 bh 0 + put_ bh (fromIntegral i :: Int32) + | otherwise = do + putWord8 bh 1 + put_ bh (show i) + where + lo32 = fromIntegral (minBound :: Int32) + hi32 = fromIntegral (maxBound :: Int32) + + get bh = do + int_kind <- getWord8 bh + case int_kind of + 0 -> fromIntegral <$> (get bh :: IO Int32) + _ -> do str <- get bh case reads str of - [(i, "")] -> return i - _ -> fail ("Binary Integer: got " ++ show str) + [(i, "")] -> return i + _ -> fail ("Binary integer: got " ++ show str) {- -- This code is currently commented out. @@ -714,27 +730,14 @@ getFS bh = do bs <- getBS bh putBS :: BinHandle -> ByteString -> IO () putBS bh bs = BS.unsafeUseAsCStringLen bs $ \(ptr, l) -> do - put_ bh l - let - go n | n == l = return () - | otherwise = do - b <- peekElemOff (castPtr ptr) n - putByte bh b - go (n+1) - go 0 + put_ bh l + putPrim bh l (\op -> BS.memcpy op (castPtr ptr) l) getBS :: BinHandle -> IO ByteString getBS bh = do l <- get bh :: IO Int - arr <- readIORef (_arr_r bh) - sz <- readFastMutInt (_sz_r bh) - off <- readFastMutInt (_off_r bh) - when (off + l > sz) $ - ioError (mkIOError eofErrorType "Data.Binary.getBS" Nothing Nothing) - writeFastMutInt (_off_r bh) (off+l) - withForeignPtr arr $ \ptr -> do - bs <- BS.unsafePackCStringLen (castPtr $ ptr `plusPtr` off, fromIntegral l) - return $! BS.copy bs + BS.create l $ \dest -> do + getPrim bh l (\src -> BS.memcpy dest src l) instance Binary ByteString where put_ bh f = putBS bh f From git at git.haskell.org Mon Feb 6 02:25:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 6 Feb 2017 02:25:12 +0000 (UTC) Subject: [commit: ghc] master: Don't replace type family instances with the same LHS in GHCi (#7102) (0abe736) Message-ID: <20170206022512.C3AC03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0abe7361249b0b4dc43dc66547451da8916b30bf/ghc >--------------------------------------------------------------- commit 0abe7361249b0b4dc43dc66547451da8916b30bf Author: Reid Barton Date: Sun Feb 5 20:24:06 2017 -0500 Don't replace type family instances with the same LHS in GHCi (#7102) This fixes the easy part of #7102 by removing the logic that lets the user replace a type family instance with a new one with the same LHS. As discussed on that ticket, this is unsound in general. Better to have the user redefine the type family from scratch. The example from comment:7 involving loading modules into ghci is not fixed yet; it actually doesn't rely on the instances having the same LHS. This commit adds an expect_broken test for that example as well. Test Plan: T7102a for the fix; T7102 is the test not fixed yet Reviewers: dfeuer, austin, bgamari, goldfire Reviewed By: dfeuer Subscribers: dfeuer, thomie Differential Revision: https://phabricator.haskell.org/D2994 >--------------------------------------------------------------- 0abe7361249b0b4dc43dc66547451da8916b30bf compiler/main/HscTypes.hs | 5 +-- compiler/typecheck/FamInst.hs | 21 +++++------- compiler/types/FamInstEnv.hs | 32 ++---------------- docs/users_guide/ghci.rst | 38 +++++++++++++++++++--- testsuite/tests/ghci/scripts/ghci046.script | 1 + testsuite/tests/ghci/scripts/ghci046.stderr | 5 +++ testsuite/tests/ghci/scripts/ghci046.stdout | 2 +- .../tests/indexed-types/should_fail/T7102.script | 5 +++ .../should_fail/T7102.stdout} | 0 .../tests/indexed-types/should_fail/T7102A.hs | 3 ++ .../tests/indexed-types/should_fail/T7102B.hs | 6 ++++ .../tests/indexed-types/should_fail/T7102C.hs | 6 ++++ .../tests/indexed-types/should_fail/T7102a.script | 4 +++ .../tests/indexed-types/should_fail/T7102a.stderr | 5 +++ testsuite/tests/indexed-types/should_fail/all.T | 2 ++ 15 files changed, 84 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 0abe7361249b0b4dc43dc66547451da8916b30bf From git at git.haskell.org Mon Feb 6 02:25:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 6 Feb 2017 02:25:16 +0000 (UTC) Subject: [commit: ghc] master: Don't return empty initial uncovered set for an unsat context (adb565a) Message-ID: <20170206022516.0DEA03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/adb565aa74582969bbcc3b411d6d518b1c76c3cf/ghc >--------------------------------------------------------------- commit adb565aa74582969bbcc3b411d6d518b1c76c3cf Author: Matthew Pickering Date: Sun Feb 5 20:27:41 2017 -0500 Don't return empty initial uncovered set for an unsat context Previously when the checker encountered an unsatisfiable term of type context it would return an empty initial uncovered set. This caused all pattern matches in the context to be reported as redudant. This is arguably correct behaviour as they will never be reached but it is better to recover and provide accurate warnings for these cases to avoid error cascades. It would perhaps be better to report an error to the user about an inacessible branch but this is certainly better than many confusing redundant match warnings. Reviewers: gkaracha, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3064 >--------------------------------------------------------------- adb565aa74582969bbcc3b411d6d518b1c76c3cf compiler/deSugar/Check.hs | 13 ++++++------- testsuite/tests/ghci/scripts/Defer02.stderr | 4 ---- testsuite/tests/pmcheck/should_compile/T12957.hs | 5 +++++ testsuite/tests/pmcheck/should_compile/T12957.stderr | 4 ++++ testsuite/tests/pmcheck/should_compile/all.T | 1 + testsuite/tests/typecheck/should_fail/FDsFromGivens.stderr | 4 ---- testsuite/tests/typecheck/should_fail/T10715.stderr | 4 ---- testsuite/tests/typecheck/should_fail/T8392a.stderr | 4 ---- 8 files changed, 16 insertions(+), 23 deletions(-) diff --git a/compiler/deSugar/Check.hs b/compiler/deSugar/Check.hs index 2b14739..720c2c9 100644 --- a/compiler/deSugar/Check.hs +++ b/compiler/deSugar/Check.hs @@ -46,7 +46,7 @@ import UniqSupply import DsGRHSs (isTrueLHsExpr) import Data.List (find) -import Data.Maybe (isJust) +import Data.Maybe (isJust, fromMaybe) import Control.Monad (forM, when, forM_) import Coercion import TcEvidence @@ -1210,13 +1210,12 @@ mkInitialUncovered vars = do ty_cs <- liftD getDictsDs tm_cs <- map toComplex . bagToList <$> liftD getTmCsDs sat_ty <- tyOracle ty_cs - return $ case (sat_ty, tmOracle initialTmState tm_cs) of - (True, Just tm_state) -> [ValVec patterns (MkDelta ty_cs tm_state)] + let initTyCs = if sat_ty then ty_cs else emptyBag + initTmState = fromMaybe initialTmState (tmOracle initialTmState tm_cs) + patterns = map PmVar vars -- If any of the term/type constraints are non - -- satisfiable, the initial uncovered set is empty - _non_satisfiable -> [] - where - patterns = map PmVar vars + -- satisfiable then return with the initialTmState. See #12957 + return [ValVec patterns (MkDelta initTyCs initTmState)] -- | Increase the counter for elapsed algorithm iterations, check that the -- limit is not exceeded and call `pmcheck` diff --git a/testsuite/tests/ghci/scripts/Defer02.stderr b/testsuite/tests/ghci/scripts/Defer02.stderr index b9764c3..527a987 100644 --- a/testsuite/tests/ghci/scripts/Defer02.stderr +++ b/testsuite/tests/ghci/scripts/Defer02.stderr @@ -84,10 +84,6 @@ Defer01.hs:43:10: warning: [-Wdeferred-type-errors (in -Wdefault)] In the expression: myOp 23 In an equation for ‘j’: j = myOp 23 -Defer01.hs:47:1: warning: [-Woverlapping-patterns (in -Wdefault)] - Pattern match is redundant - In an equation for ‘k’: k x = ... - Defer01.hs:50:5: warning: [-Wdeferred-type-errors (in -Wdefault)] • Couldn't match expected type ‘IO a0’ with actual type ‘Char -> IO ()’ diff --git a/testsuite/tests/pmcheck/should_compile/T12957.hs b/testsuite/tests/pmcheck/should_compile/T12957.hs new file mode 100644 index 0000000..d0956c6 --- /dev/null +++ b/testsuite/tests/pmcheck/should_compile/T12957.hs @@ -0,0 +1,5 @@ +module T12957 where + +data A = N | A { b :: Bool } +f = case [] of (_:_) -> case () of + a -> undefined diff --git a/testsuite/tests/pmcheck/should_compile/T12957.stderr b/testsuite/tests/pmcheck/should_compile/T12957.stderr new file mode 100644 index 0000000..35a608e --- /dev/null +++ b/testsuite/tests/pmcheck/should_compile/T12957.stderr @@ -0,0 +1,4 @@ + +T12957.hs:4:16: warning: [-Woverlapping-patterns (in -Wdefault)] + Pattern match is redundant + In a case alternative: (_ : _) -> ... diff --git a/testsuite/tests/pmcheck/should_compile/all.T b/testsuite/tests/pmcheck/should_compile/all.T index f19e1de..7fc4fc5 100644 --- a/testsuite/tests/pmcheck/should_compile/all.T +++ b/testsuite/tests/pmcheck/should_compile/all.T @@ -59,6 +59,7 @@ test('pmc007', [], compile, ['-fwarn-incomplete-patterns -fwarn-overlapping-patterns']) test('T11245', [], compile, ['-fwarn-incomplete-patterns -fwarn-overlapping-patterns']) +test('T12957', [], compile, ['-fwarn-overlapping-patterns']) # EmptyCase test('T10746', [], compile, diff --git a/testsuite/tests/typecheck/should_fail/FDsFromGivens.stderr b/testsuite/tests/typecheck/should_fail/FDsFromGivens.stderr deleted file mode 100644 index a271580..0000000 --- a/testsuite/tests/typecheck/should_fail/FDsFromGivens.stderr +++ /dev/null @@ -1,4 +0,0 @@ - -FDsFromGivens.hs:14:1: warning: [-Woverlapping-patterns (in -Wdefault)] - Pattern match is redundant - In an equation for ‘g1’: g1 x = ... diff --git a/testsuite/tests/typecheck/should_fail/T10715.stderr b/testsuite/tests/typecheck/should_fail/T10715.stderr deleted file mode 100644 index 68aa7f9..0000000 --- a/testsuite/tests/typecheck/should_fail/T10715.stderr +++ /dev/null @@ -1,4 +0,0 @@ - -T10715.hs:18:1: warning: [-Woverlapping-patterns (in -Wdefault)] - Pattern match is redundant - In an equation for ‘doCoerce’: doCoerce = ... diff --git a/testsuite/tests/typecheck/should_fail/T8392a.stderr b/testsuite/tests/typecheck/should_fail/T8392a.stderr deleted file mode 100644 index bfc30e7..0000000 --- a/testsuite/tests/typecheck/should_fail/T8392a.stderr +++ /dev/null @@ -1,4 +0,0 @@ - -T8392a.hs:11:1: warning: [-Woverlapping-patterns (in -Wdefault)] - Pattern match is redundant - In an equation for ‘foo’: foo x = ... From git at git.haskell.org Mon Feb 6 02:25:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 6 Feb 2017 02:25:18 +0000 (UTC) Subject: [commit: ghc] master: Fix comment (old file names '.hc' ) in libraries/ (26f5e60) Message-ID: <20170206022518.B1EA13A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/26f5e60b7916587c093072b2b68f4260666ba992/ghc >--------------------------------------------------------------- commit 26f5e60b7916587c093072b2b68f4260666ba992 Author: Takenobu Tani Date: Sun Feb 5 20:27:57 2017 -0500 Fix comment (old file names '.hc' ) in libraries/ There ware some old file names (.hc, ...) at comments. * libraries/base/GHC/IO.hs - StgMiscClosures.hc -> StgStartup.cmm - Exceptions.hc -> Exception.cmm - Schedule.c -> RaiseAsync.c A comment of `(un)?blockAsyncExceptionszh_fast` in IO.hs may be old. Since I don't understand it, I have not modified it yet. Reviewers: mpickering, bgamari, austin, hvr Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3081 >--------------------------------------------------------------- 26f5e60b7916587c093072b2b68f4260666ba992 libraries/base/GHC/IO.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/base/GHC/IO.hs b/libraries/base/GHC/IO.hs index 0744e3a..0737d19 100644 --- a/libraries/base/GHC/IO.hs +++ b/libraries/base/GHC/IO.hs @@ -61,10 +61,10 @@ system. The following list may or may not be exhaustive: Compiler - types of various primitives in PrimOp.hs -RTS - forceIO (StgMiscClosures.hc) +RTS - forceIO (StgStartup.cmm) - catchzh_fast, (un)?blockAsyncExceptionszh_fast, raisezh_fast - (Exceptions.hc) - - raiseAsync (Schedule.c) + (Exception.cmm) + - raiseAsync (RaiseAsync.c) Prelude - GHC.IO.hs, and several other places including GHC.Exception.hs. From git at git.haskell.org Mon Feb 6 02:25:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 6 Feb 2017 02:25:21 +0000 (UTC) Subject: [commit: ghc] master: Fix broken link of GHC.RTS.Flags (563148c) Message-ID: <20170206022521.76F2C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/563148cdf6e6560ccf842aa4e2bd6262ea463d66/ghc >--------------------------------------------------------------- commit 563148cdf6e6560ccf842aa4e2bd6262ea463d66 Author: Takenobu Tani Date: Sun Feb 5 20:29:37 2017 -0500 Fix broken link of GHC.RTS.Flags There ware broken link to GHC User's Guide. * libraries/base/GHC/RTS/Flags.hsc - runtime-control.html -> runtime_control.html Reviewers: bgamari, austin, hvr Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3084 >--------------------------------------------------------------- 563148cdf6e6560ccf842aa4e2bd6262ea463d66 libraries/base/GHC/RTS/Flags.hsc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/base/GHC/RTS/Flags.hsc b/libraries/base/GHC/RTS/Flags.hsc index 5eba486..46534fe 100644 --- a/libraries/base/GHC/RTS/Flags.hsc +++ b/libraries/base/GHC/RTS/Flags.hsc @@ -3,7 +3,7 @@ -- | Accessors to GHC RTS flags. -- Descriptions of flags can be seen in --- , +-- , -- or by running RTS help message using @+RTS --help at . -- -- @since 4.8.0.0 From git at git.haskell.org Mon Feb 6 02:25:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 6 Feb 2017 02:25:24 +0000 (UTC) Subject: [commit: ghc] master: Fixes for OccurAnal bugs (#13221) (795bc49) Message-ID: <20170206022524.3315D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/795bc49ceb12cecf46e0c53a570809c3df85ab9a/ghc >--------------------------------------------------------------- commit 795bc49ceb12cecf46e0c53a570809c3df85ab9a Author: Luke Maurer Date: Sun Feb 5 20:32:20 2017 -0500 Fixes for OccurAnal bugs (#13221) - OccurAnal: When checking tail calls, count rule's LHS args, not bndrs Pretty obvious error in retrospect: ``` let $sj = \y ys -> ... {-# RULES "SC:j" forall y ys. j (y:ys) = $sj y ys #-} j = \xs -> ... in ... ``` A jump on the RHS of a rule for a join point is only okay if the rule's LHS is saturated - in this case, since the LHS is j (y:ys) and j takes one argument, both j and $sj can become join points. See Note [Rules and join points] in OccurAnal. By mistake, OccAnal was counting the rule's binders (y and ys) rather than the args in its LHS, so $sj wasn't being made a join point. - Don't zap tail calls in unfoldings This was causing T7796 to squeal about join points not being rediscovered. Reviewers: bgamari, austin Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3080 >--------------------------------------------------------------- 795bc49ceb12cecf46e0c53a570809c3df85ab9a compiler/simplCore/OccurAnal.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/compiler/simplCore/OccurAnal.hs b/compiler/simplCore/OccurAnal.hs index b02ddc9..80eca71 100644 --- a/compiler/simplCore/OccurAnal.hs +++ b/compiler/simplCore/OccurAnal.hs @@ -1574,7 +1574,7 @@ occAnalUnfolding env rec_flag id | not (isStableSource src) -> Nothing | otherwise - -> Just $ zapDetails usage + -> Just $ markAllMany usage where (bndrs, body) = collectBinders rhs (usage, _, _) = occAnalRhs env rec_flag id bndrs body @@ -1608,15 +1608,15 @@ occAnalRules env mb_expected_join_arity rec_flag id (rhs_uds, _, _) = occAnalRhs env rec_flag id rhs_bndrs rhs_body -- Note [Rules are extra RHSs] -- Note [Rule dependency info] - final_rhs_uds = adjust_tail_info bndrs $ markAllMany $ + final_rhs_uds = adjust_tail_info args $ markAllMany $ (rhs_uds `delDetailsList` bndrs) occ_anal_rule _ = (emptyDetails, emptyDetails) - adjust_tail_info bndrs uds -- see Note [Rules and join points] + adjust_tail_info args uds -- see Note [Rules and join points] = case mb_expected_join_arity of - Just ar | bndrs `lengthIs` ar -> uds - _ -> markAllNonTailCalled uds + Just ar | args `lengthIs` ar -> uds + _ -> markAllNonTailCalled uds {- Note [Cascading inlines] ~~~~~~~~~~~~~~~~~~~~~~~~ From git at git.haskell.org Mon Feb 6 02:25:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 6 Feb 2017 02:25:26 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Update expected values for T13035 and T12234 (a9754e3) Message-ID: <20170206022526.F21723A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a9754e3cfa71f5d346b5d6e88fbb2324b57a7421/ghc >--------------------------------------------------------------- commit a9754e3cfa71f5d346b5d6e88fbb2324b57a7421 Author: Ben Gamari Date: Sun Feb 5 21:23:26 2017 -0500 testsuite: Update expected values for T13035 and T12234 >--------------------------------------------------------------- a9754e3cfa71f5d346b5d6e88fbb2324b57a7421 testsuite/tests/perf/compiler/all.T | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index eb7a5f5..491fa19 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -917,10 +917,11 @@ test('T12234', compiler_stats_num_field('bytes allocated', [(platform('x86_64-unknown-mingw32'), 77949232, 5), # initial: 77949232 - (wordsize(64), 80882208, 5), + (wordsize(64), 74374440, 5), # initial: 72958288 # 2016-01-17: 76848856 (x86-64, Linux. drift?) # 2017-02-01: 80882208 (Use superclass instances when solving) + # 2017-02-05: 74374440 (Probably OccAnal fixes) ]), ], compile, @@ -929,9 +930,10 @@ test('T12234', test('T13035', [ only_ways(['normal']), compiler_stats_num_field('bytes allocated', - [(wordsize(64), 95269000, 5), + [(wordsize(64), 88806416, 5), # 2017-01-05 90595208 initial # 2017-01-19 95269000 Allow top-level string literals in Core + # 2017-02-05 88806416 Probably OccAnal fixes ]), ], compile, From git at git.haskell.org Mon Feb 6 03:54:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 6 Feb 2017 03:54:52 +0000 (UTC) Subject: [commit: ghc] master: Do Worker/Wrapper for NOINLINE things (b572aad) Message-ID: <20170206035452.48ACF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b572aadb20c2e41e2f6d7b48401bd0b4239ce9f8/ghc >--------------------------------------------------------------- commit b572aadb20c2e41e2f6d7b48401bd0b4239ce9f8 Author: Eric Seidel Date: Sun Feb 5 21:29:37 2017 -0500 Do Worker/Wrapper for NOINLINE things Disabling worker/wrapper for NOINLINE things can cause unnecessary reboxing of values. Consider {-# NOINLINE f #-} f :: Int -> a f x = error (show x) g :: Bool -> Bool -> Int -> Int g True True p = f p g False True p = p + 1 g b False p = g b True p the strictness analysis will discover f and g are strict, but because f has no wrapper, the worker for g will rebox p. So we get $wg x y p# = let p = I# p# in -- Yikes! Reboxing! case x of False -> case y of False -> $wg False True p# True -> +# p# 1# True -> case y of False -> $wg True True p# True -> case f p of { } g x y p = case p of (I# p#) -> $wg x y p# Now, in this case the reboxing will float into the True branch, an so the allocation will only happen on the error path. But it won't float inwards if there are multiple branches that call (f p), so the reboxing will happen on every call of g. Disaster. Solution: do worker/wrapper even on NOINLINE things; but move the NOINLINE pragma to the worker. Test Plan: make test TEST="13143" Reviewers: simonpj, bgamari, dfeuer, austin Reviewed By: simonpj, bgamari Subscribers: dfeuer, thomie Differential Revision: https://phabricator.haskell.org/D3046 >--------------------------------------------------------------- b572aadb20c2e41e2f6d7b48401bd0b4239ce9f8 compiler/coreSyn/CoreUnfold.hs | 5 +- compiler/stranal/WorkWrap.hs | 86 +++++++++++++-- testsuite/tests/perf/join_points/all.T | 4 +- testsuite/tests/perf/should_run/all.T | 8 +- testsuite/tests/simplCore/should_compile/T13143.hs | 10 ++ .../tests/simplCore/should_compile/T13143.stderr | 121 +++++++++++++++++++++ .../tests/simplCore/should_compile/T3772.stdout | 32 ++++-- .../tests/simplCore/should_compile/T7360.stderr | 10 +- .../tests/simplCore/should_compile/T7865.stdout | 10 +- testsuite/tests/simplCore/should_compile/all.T | 1 + .../tests/stranal/should_compile/T10694.stderr | 55 ++++++---- .../stranal/sigs/BottomFromInnerLambda.stderr | 4 +- 12 files changed, 290 insertions(+), 56 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 b572aadb20c2e41e2f6d7b48401bd0b4239ce9f8 From git at git.haskell.org Mon Feb 6 11:52:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 6 Feb 2017 11:52:12 +0000 (UTC) Subject: [commit: ghc] master: Typos in comments [skip ci] (2dff54b) Message-ID: <20170206115212.815E53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2dff54b39f31a81cb410682cd8e735bda22d2b57/ghc >--------------------------------------------------------------- commit 2dff54b39f31a81cb410682cd8e735bda22d2b57 Author: Gabor Greif Date: Mon Feb 6 12:50:42 2017 +0100 Typos in comments [skip ci] >--------------------------------------------------------------- 2dff54b39f31a81cb410682cd8e735bda22d2b57 compiler/typecheck/TcSMonad.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/typecheck/TcSMonad.hs b/compiler/typecheck/TcSMonad.hs index caa20e0..7bc955b 100644 --- a/compiler/typecheck/TcSMonad.hs +++ b/compiler/typecheck/TcSMonad.hs @@ -1075,8 +1075,8 @@ it into [W] and [D], and put the [D] in the work list for further work? * CDictCan (C tys) or CFunEqCan (F tys ~ fsk): - Yes if the inert set couuld rerite tys to make the class constraint, - or type family, fire. That is, yes if the inert_eqs interects + Yes if the inert set could rewrite tys to make the class constraint, + or type family, fire. That is, yes if the inert_eqs intersects with the free vars of tys. For this test we use rewriteableTyVars which ignores casts and coercions in tys, because rewriting the casts or coercions won't make the thing fire more often. @@ -1087,7 +1087,7 @@ work? Then we want to put [D] a ~ ty in the worklist, so we'll get [D] ty ~ ty2 with consequent good things - - Inert set constains [D] b ~ a, where b is in ty. + - Inert set contains [D] b ~ a, where b is in ty. We can't just add [WD] a ~ ty[b] to the inert set, because that breaks the inert-set invariants. If we tried to canonicalise another [D] constraint mentioning 'a', we'd From git at git.haskell.org Mon Feb 6 16:11:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 6 Feb 2017 16:11:23 +0000 (UTC) Subject: [commit: ghc] master: Typos in comments [skip ci] (4aae191) Message-ID: <20170206161123.852133A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4aae1918e68c71f14f52d9c96b51b2876744bac8/ghc >--------------------------------------------------------------- commit 4aae1918e68c71f14f52d9c96b51b2876744bac8 Author: Gabor Greif Date: Mon Feb 6 17:09:18 2017 +0100 Typos in comments [skip ci] >--------------------------------------------------------------- 4aae1918e68c71f14f52d9c96b51b2876744bac8 compiler/deSugar/Check.hs | 2 +- compiler/simplCore/SimplCore.hs | 2 +- compiler/typecheck/TcRnMonad.hs | 2 +- compiler/types/FamInstEnv.hs | 4 ++-- libraries/integer-gmp/src/GHC/Integer.hs | 2 +- libraries/integer-gmp/src/GHC/Integer/GMP/Internals.hs | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/compiler/deSugar/Check.hs b/compiler/deSugar/Check.hs index 720c2c9..3bf52ce 100644 --- a/compiler/deSugar/Check.hs +++ b/compiler/deSugar/Check.hs @@ -953,7 +953,7 @@ pmPatType (PmGrd { pm_grd_pv = pv }) -- fresh variables of the appropriate type for arguments) mkOneConFull :: Id -> ConLike -> DsM (ValAbs, ComplexEq, Bag EvVar) -- * x :: T tys, where T is an algebraic data type --- NB: in the case of a data familiy, T is the *representation* TyCon +-- NB: in the case of a data family, T is the *representation* TyCon -- e.g. data instance T (a,b) = T1 a b -- leads to -- data TPair a b = T1 a b -- The "representation" type diff --git a/compiler/simplCore/SimplCore.hs b/compiler/simplCore/SimplCore.hs index 23faac8..3c6c311 100644 --- a/compiler/simplCore/SimplCore.hs +++ b/compiler/simplCore/SimplCore.hs @@ -331,7 +331,7 @@ getCoreToDo dflags CoreLiberateCase, simpl_phase 0 ["post-liberate-case"] max_iter ]), -- Run the simplifier after LiberateCase to vastly - -- reduce the possiblility of shadowing + -- reduce the possibility of shadowing -- Reason: see Note [Shadowing] in SpecConstr.hs runWhen spec_constr CoreDoSpecConstr, diff --git a/compiler/typecheck/TcRnMonad.hs b/compiler/typecheck/TcRnMonad.hs index a0600b1..33cb4d1 100644 --- a/compiler/typecheck/TcRnMonad.hs +++ b/compiler/typecheck/TcRnMonad.hs @@ -1755,7 +1755,7 @@ getIfModule = do { env <- getLclEnv; return (if_mod env) } -------------------- failIfM :: MsgDoc -> IfL a -- The Iface monad doesn't have a place to accumulate errors, so we --- just fall over fast if one happens; it "shouldnt happen". +-- just fall over fast if one happens; it "shouldn't happen". -- We use IfL here so that we can get context info out of the local env failIfM msg = do { env <- getLclEnv diff --git a/compiler/types/FamInstEnv.hs b/compiler/types/FamInstEnv.hs index d4fc902..e605f7b 100644 --- a/compiler/types/FamInstEnv.hs +++ b/compiler/types/FamInstEnv.hs @@ -1219,7 +1219,7 @@ topNormaliseType_maybe env ty where stepper = unwrapNewTypeStepper `composeSteppers` tyFamStepper - tyFamStepper rec_nts tc tys -- Try to step a type/data familiy + tyFamStepper rec_nts tc tys -- Try to step a type/data family = let (args_co, ntys) = normaliseTcArgs env Representational tc tys in -- NB: It's OK to use normaliseTcArgs here instead of -- normalise_tc_args (which takes the LiftingContext described @@ -1276,7 +1276,7 @@ pmTopNormaliseType_maybe env typ = NS_Done tyFamStepper :: NormaliseStepper ([Type] -> [Type], [DataCon] -> [DataCon]) - tyFamStepper rec_nts tc tys -- Try to step a type/data familiy + tyFamStepper rec_nts tc tys -- Try to step a type/data family = let (_args_co, ntys) = normaliseTcArgs env Representational tc tys in -- NB: It's OK to use normaliseTcArgs here instead of -- normalise_tc_args (which takes the LiftingContext described diff --git a/libraries/integer-gmp/src/GHC/Integer.hs b/libraries/integer-gmp/src/GHC/Integer.hs index ffd708b..ab45887 100644 --- a/libraries/integer-gmp/src/GHC/Integer.hs +++ b/libraries/integer-gmp/src/GHC/Integer.hs @@ -49,7 +49,7 @@ module GHC.Integer ( eqInteger, neqInteger, leInteger, gtInteger, ltInteger, geInteger, compareInteger, - -- ** 'Int#'-boolean valued versions of comparision predicates + -- ** 'Int#'-boolean valued versions of comparison predicates -- -- | These operations return @0#@ and @1#@ instead of 'False' and -- 'True' respectively. See diff --git a/libraries/integer-gmp/src/GHC/Integer/GMP/Internals.hs b/libraries/integer-gmp/src/GHC/Integer/GMP/Internals.hs index 0ad6848..0d8d572 100644 --- a/libraries/integer-gmp/src/GHC/Integer/GMP/Internals.hs +++ b/libraries/integer-gmp/src/GHC/Integer/GMP/Internals.hs @@ -112,7 +112,7 @@ module GHC.Integer.GMP.Internals , orBigNat , bitBigNat - -- ** 'BigNat' comparision predicates + -- ** 'BigNat' comparison predicates , isZeroBigNat , isNullBigNat# From git at git.haskell.org Mon Feb 6 19:34:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 6 Feb 2017 19:34:28 +0000 (UTC) Subject: [commit: ghc] master: Remove unnecessary use of -DGENERICS flag (a28a552) Message-ID: <20170206193428.666323A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a28a55211d6fb8d3182b0a9e47656ff9ca8a3766/ghc >--------------------------------------------------------------- commit a28a55211d6fb8d3182b0a9e47656ff9ca8a3766 Author: Ryan Scott Date: Mon Feb 6 14:31:17 2017 -0500 Remove unnecessary use of -DGENERICS flag This flag was only needed for old versions of binary, and now that we've upgraded to binary-0.8.4.1, it is no longer necessary. >--------------------------------------------------------------- a28a55211d6fb8d3182b0a9e47656ff9ca8a3766 utils/ghc-cabal/ghc.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/ghc-cabal/ghc.mk b/utils/ghc-cabal/ghc.mk index 78a6705..4f896aa 100644 --- a/utils/ghc-cabal/ghc.mk +++ b/utils/ghc-cabal/ghc.mk @@ -60,7 +60,7 @@ $(ghc-cabal_DIST_BINARY): utils/ghc-cabal/Main.hs $(TOUCH_DEP) | $$(dir $$@)/. b -odir bootstrapping \ -hidir bootstrapping \ -ilibraries/Cabal/Cabal \ - -ilibraries/binary/src -DGENERICS \ + -ilibraries/binary/src \ -ilibraries/filepath \ -ilibraries/hpc \ $(utils/ghc-cabal_dist_EXTRA_HC_OPTS) \ From git at git.haskell.org Tue Feb 7 02:39:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Feb 2017 02:39:10 +0000 (UTC) Subject: [commit: ghc] wip/T13227: Improve the Occurrence Analyzer’s handling of one-shot functions (52fc503) Message-ID: <20170207023910.3203F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T13227 Link : http://ghc.haskell.org/trac/ghc/changeset/52fc50301279da2e8672f57d5505c94a6d9b9217/ghc >--------------------------------------------------------------- commit 52fc50301279da2e8672f57d5505c94a6d9b9217 Author: Joachim Breitner Date: Sun Feb 5 10:52:12 2017 -0500 Improve the Occurrence Analyzer’s handling of one-shot functions when determining whether an expression is used saturatedly, count the number of value arguments that the occurrence analyser sees, and add the number of one-shot arguments that we know (from the strictness analyser) are passed from the context. This was suggested by Simon PJ in ticket #13227. perf results suggest no noticable change in allocations, reduction of code sizes, and performance regression possibliy due to loss of join points. Differential Revision: https://phabricator.haskell.org/D3089 >--------------------------------------------------------------- 52fc50301279da2e8672f57d5505c94a6d9b9217 compiler/simplCore/OccurAnal.hs | 42 +++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/compiler/simplCore/OccurAnal.hs b/compiler/simplCore/OccurAnal.hs index 80eca71..6d0e321 100644 --- a/compiler/simplCore/OccurAnal.hs +++ b/compiler/simplCore/OccurAnal.hs @@ -1547,7 +1547,7 @@ occAnalNonRecRhs env bndr bndrs body env1 | certainly_inline = env | otherwise = rhsCtxt env - -- See Note [Use one-shot info] + -- See Note [Sources of one-shot info] rhs_env = env1 { occ_one_shots = argOneShots dmd } @@ -1867,7 +1867,13 @@ occAnalApp env (Var fun, args, ticks) -- This is the *whole point* of the isRhsEnv predicate -- See Note [Arguments of let-bound constructors] - n_val_args = valArgCount args + n_val_args = valArgCount args + length (takeWhile isOneShotInfo (occ_one_shots env)) + -- n_val_args is used to determine if this call is saturated. We want to consider + -- the lambda expression in 'build (\x y -> …)' to be considered + -- saturated, so we count one-shot arguments from the context. + -- But 'map (\x -> …)' is not saturated, so we only count the one-shot + -- arguments. + n_args = length args fun_uds = mkOneOcc env fun (n_val_args > 0) n_args is_exp = isExpandableApp fun n_val_args @@ -1876,7 +1882,7 @@ occAnalApp env (Var fun, args, ticks) -- Simplify.prepareRhs one_shots = argsOneShots (idStrictness fun) n_val_args - -- See Note [Use one-shot info] + -- See Note [Sources of one-shot information] occAnalApp env (fun, args, ticks) = (markAllNonTailCalled (fun_uds +++ args_uds), @@ -1898,10 +1904,9 @@ zapDetailsIf True uds = zapDetails uds zapDetailsIf False uds = uds {- -Note [Use one-shot information] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The occurrrence analyser propagates one-shot-lambda information in two -situations: +Note [Sources of one-shot information] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +The occurrence analyser obtains one-shot-lambda information from two sources: * Applications: eg build (\c n -> blah) @@ -1924,6 +1929,22 @@ Previously, the demand analyser would *also* set the one-shot information, but that code was buggy (see #11770), so doing it only in on place, namely here, is saner. +Note [OneShots] +~~~~~~~~~~~~~~~ +When analysing an expression, the occ_one_shots argument contains information +about how the function is being used. The length of the list indicates +how many arguments will eventually be passed to the analysed expression, +and the OneShotInfo indicates whether this application is once or multiple times. + +Example: + + Context of f occ_one_shots when analysing f + + f 1 2 [OneShot, OneShot] + map (f 1) [OneShot, NoOneShotInfo] + build f [OneShot, OneShot] + f 1 2 `seq` f 2 1 [NoOneShotInfo, OneShot] + Note [Binders in case alternatives] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Consider @@ -2008,7 +2029,7 @@ wrapAltRHS _ _ alt_usg _ alt_rhs data OccEnv = OccEnv { occ_encl :: !OccEncl -- Enclosing context information - , occ_one_shots :: !OneShots -- Tells about linearity + , occ_one_shots :: !OneShots -- See Note [OneShots] , occ_gbl_scrut :: GlobalScruts , occ_rule_act :: Activation -> Bool -- Which rules are active -- See Note [Finding rule RHS free vars] @@ -2037,11 +2058,8 @@ instance Outputable OccEncl where ppr OccRhs = text "occRhs" ppr OccVanilla = text "occVanilla" +-- See note [OneShots] type OneShots = [OneShotInfo] - -- [] No info - -- - -- one_shot_info:ctxt Analysing a function-valued expression that - -- will be applied as described by one_shot_info initOccEnv :: (Activation -> Bool) -> OccEnv initOccEnv active_rule From git at git.haskell.org Tue Feb 7 02:39:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Feb 2017 02:39:12 +0000 (UTC) Subject: [commit: ghc] wip/T13227's head updated: Improve the Occurrence Analyzer’s handling of one-shot functions (52fc503) Message-ID: <20170207023912.A0EB63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/T13227' now includes: a2f39da Add liftA2 to Applicative class fbcef83 Use proper primitives in Utils.Binary 0abe736 Don't replace type family instances with the same LHS in GHCi (#7102) adb565a Don't return empty initial uncovered set for an unsat context 26f5e60 Fix comment (old file names '.hc' ) in libraries/ 563148c Fix broken link of GHC.RTS.Flags 795bc49 Fixes for OccurAnal bugs (#13221) a9754e3 testsuite: Update expected values for T13035 and T12234 b572aad Do Worker/Wrapper for NOINLINE things 2dff54b Typos in comments [skip ci] 4aae191 Typos in comments [skip ci] a28a552 Remove unnecessary use of -DGENERICS flag 52fc503 Improve the Occurrence Analyzer’s handling of one-shot functions From git at git.haskell.org Tue Feb 7 05:18:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Feb 2017 05:18:14 +0000 (UTC) Subject: [commit: ghc] master: Derive <$ (2219c8c) Message-ID: <20170207051814.618E83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2219c8cd612ec7920a3bd1661b3c663575737267/ghc >--------------------------------------------------------------- commit 2219c8cd612ec7920a3bd1661b3c663575737267 Author: David Feuer Date: Tue Feb 7 00:16:55 2017 -0500 Derive <$ Using the default definition of `<$` for derived `Functor` instance is very bad for recursive data types. Derive the definition instead. Fixes #13218 Reviewers: austin, bgamari, RyanGlScott Reviewed By: RyanGlScott Subscribers: RyanGlScott, thomie Differential Revision: https://phabricator.haskell.org/D3072 >--------------------------------------------------------------- 2219c8cd612ec7920a3bd1661b3c663575737267 compiler/prelude/PrelNames.hs | 10 +- compiler/typecheck/TcGenFunctor.hs | 154 ++++++++++++++++++++- docs/users_guide/8.2.1-notes.rst | 5 + testsuite/tests/generics/GenDerivOutput.stderr | 9 +- .../tests/generics/T10604/T10604_deriving.stderr | 7 +- testsuite/tests/perf/should_run/T13218.hs | 26 ++++ testsuite/tests/perf/should_run/all.T | 13 ++ 7 files changed, 202 insertions(+), 22 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 2219c8cd612ec7920a3bd1661b3c663575737267 From git at git.haskell.org Tue Feb 7 09:30:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Feb 2017 09:30:12 +0000 (UTC) Subject: [commit: ghc] master: Typos in comments [skip ci] (17ae5e7) Message-ID: <20170207093012.E90AC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/17ae5e79cad49ff05941d9d9234648b15d0169dc/ghc >--------------------------------------------------------------- commit 17ae5e79cad49ff05941d9d9234648b15d0169dc Author: Gabor Greif Date: Tue Feb 7 10:25:38 2017 +0100 Typos in comments [skip ci] >--------------------------------------------------------------- 17ae5e79cad49ff05941d9d9234648b15d0169dc compiler/typecheck/TcErrors.hs | 2 +- compiler/typecheck/TcGenFunctor.hs | 2 +- testsuite/tests/th/T12130a.hs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/typecheck/TcErrors.hs b/compiler/typecheck/TcErrors.hs index eaccc2d..6d4e3de 100644 --- a/compiler/typecheck/TcErrors.hs +++ b/compiler/typecheck/TcErrors.hs @@ -2056,7 +2056,7 @@ But nowadays when inferring the type of a function with no type signature, even if there are errors inside, we still generalise its signature and carry on. For example f x = x:x -Here we will infer somethiing like +Here we will infer something like f :: forall a. a -> [a] with a deferred error of (a ~ [a]). So in the deferred unsolved constraint 'a' is now a skolem, but not one bound by the programmer in the context! diff --git a/compiler/typecheck/TcGenFunctor.hs b/compiler/typecheck/TcGenFunctor.hs index b34a0b6..49129bf 100644 --- a/compiler/typecheck/TcGenFunctor.hs +++ b/compiler/typecheck/TcGenFunctor.hs @@ -252,7 +252,7 @@ non-regular, such as data Nesty a = Z a | S (Nesty a) (Nest (a, a)) the function argument is no longer (entirely) static, so the static argument -transformation will do nothiing for us. +transformation will do nothing for us. Applying the default definition of `<$` will produce a tree full of thunks that look like ((\_ -> x) x0), which represents unnecessary thunk allocation and diff --git a/testsuite/tests/th/T12130a.hs b/testsuite/tests/th/T12130a.hs index f393967..38e2bdf 100644 --- a/testsuite/tests/th/T12130a.hs +++ b/testsuite/tests/th/T12130a.hs @@ -11,7 +11,7 @@ data Block = Block block :: Q Exp block = [| Block { - -- Using record syntax is neccesary to trigger the bug. + -- Using record syntax is necessary to trigger the bug. blockSelector = () } |] From git at git.haskell.org Tue Feb 7 14:01:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Feb 2017 14:01:04 +0000 (UTC) Subject: [commit: ghc] master: Comments only (f77e99b) Message-ID: <20170207140104.B02EB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f77e99bbaac1b9ef7c47ed7fd750f0105f7fc28b/ghc >--------------------------------------------------------------- commit f77e99bbaac1b9ef7c47ed7fd750f0105f7fc28b Author: Simon Peyton Jones Date: Fri Jan 20 15:12:17 2017 +0000 Comments only >--------------------------------------------------------------- f77e99bbaac1b9ef7c47ed7fd750f0105f7fc28b compiler/coreSyn/CoreUnfold.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/coreSyn/CoreUnfold.hs b/compiler/coreSyn/CoreUnfold.hs index f9ca36f..c69357b 100644 --- a/compiler/coreSyn/CoreUnfold.hs +++ b/compiler/coreSyn/CoreUnfold.hs @@ -722,6 +722,9 @@ callSize -> Int -- ^ number of value args that are void -> Int callSize n_val_args voids = 10 * (1 + n_val_args - voids) + -- The 1+ is for the function itself + -- Add 1 for each non-trivial arg; + -- the allocation cost, as in let(rec) -- | The size of a jump to a join point jumpSize @@ -748,9 +751,6 @@ funSize dflags top_args fun n_val_args voids size | is_join = jumpSize n_val_args voids | not some_val_args = 0 | otherwise = callSize n_val_args voids - -- The 1+ is for the function itself - -- Add 1 for each non-trivial arg; - -- the allocation cost, as in let(rec) -- DISCOUNTS -- See Note [Function and non-function discounts] From git at git.haskell.org Tue Feb 7 14:01:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Feb 2017 14:01:07 +0000 (UTC) Subject: [commit: ghc] master: Another improvement to SetLevels (b8f58d7) Message-ID: <20170207140107.795493A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b8f58d79ee3e34840beeea2fab846a9f47bff21a/ghc >--------------------------------------------------------------- commit b8f58d79ee3e34840beeea2fab846a9f47bff21a Author: Simon Peyton Jones Date: Fri Dec 23 14:17:42 2016 +0000 Another improvement to SetLevels In my recent commit commit 432f952ef64641be9f32152a0fbf2b8496d8fe9c Float unboxed expressions by boxing I changed how float_me in lvlMFE worked. That was right, but it exposed another bug: an error expression wasn't getting floated as it should from a case alternative. And that led to a collection of minor improvements * I found a much better way to cast it, by using lvlFloatRhs for top-level bindinds as well as nested ones, which is (a) more consistent and (b) works correctly. See Note [Floating from a RHS] * I also found some delicacy in the "floating to the top" stuff, so I greatly elaborated the Note [Floating to the top]. * I simplified the "bottoming-float" stuff; the change is in the treatment of bottoming lambdas (\x y. error blah), where we now float the (error blah) part instead of the whole lambda (which risks just making duplicate lambdas. See Note [Bottoming floats], esp (2). Perf effects are minor. * perf/compiler/T13056 improved sligtly (about 2%) in compiler allocations. Also T9233 improved by 1%. I'm not sure why. * Some small nofib changes: - Generally some very small reductions in run-time allocation, except k-nucleotide, which halves for some reason. (I did try to look but it's a big complicated function and it was far from obvious. Had it been a loss I would have looked harder! NB: there's a nearby patch "Do not inline bottoming things" that could also be responsible for either or both. I didn't think it was worth more testing to distinguish. -------------------------------------------------------------------------------- Program Size Allocs Runtime Elapsed TotalMem -------------------------------------------------------------------------------- grep +0.1% -0.2% 0.00 0.00 +0.0% mandel -0.1% -1.4% 0.13 0.13 +0.0% k-nucleotide +0.1% -51.6% -1.0% -1.0% +0.0% -------------------------------------------------------------------------------- Min -0.3% -51.6% -9.4% -9.1% -4.0% Max +0.2% +0.0% +31.8% +32.7% +0.0% Geometric Mean -0.0% -0.8% +1.4% +1.4% -0.1% >--------------------------------------------------------------- b8f58d79ee3e34840beeea2fab846a9f47bff21a compiler/coreSyn/CoreUtils.hs | 7 +- compiler/simplCore/SetLevels.hs | 499 ++++++++++++++++++++++-------------- compiler/simplCore/Simplify.hs | 8 +- testsuite/tests/perf/compiler/all.T | 19 +- 4 files changed, 329 insertions(+), 204 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 b8f58d79ee3e34840beeea2fab846a9f47bff21a From git at git.haskell.org Tue Feb 7 14:01:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Feb 2017 14:01:10 +0000 (UTC) Subject: [commit: ghc] master: Do not inline bottoming things (a0174d2) Message-ID: <20170207140110.351B63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a0174d2264358c5930a54e372d5d3ab5e713b87a/ghc >--------------------------------------------------------------- commit a0174d2264358c5930a54e372d5d3ab5e713b87a Author: Simon Peyton Jones Date: Fri Jan 20 15:12:42 2017 +0000 Do not inline bottoming things If a function seems small, worker/wrapper won't split it; instead it turns it into an INLINE function. But if it's a /bottoming/ function that's a bad idea. We want don't want to inline bottoming functions unless they are /really/ small (smaller than the call itself) and that's handled by a different branch in certainlyWillInline. So this patch adds a not-bottom test to the UnfIfGoodArgs case of certainlyWillInline. No big perf effect, but this will tend to keep error code out of functions, and hence make them a bit more likely to inline. I fell over this when fiddling with #13144 >--------------------------------------------------------------- a0174d2264358c5930a54e372d5d3ab5e713b87a compiler/coreSyn/CoreUnfold.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/compiler/coreSyn/CoreUnfold.hs b/compiler/coreSyn/CoreUnfold.hs index a558dc4..f9ca36f 100644 --- a/compiler/coreSyn/CoreUnfold.hs +++ b/compiler/coreSyn/CoreUnfold.hs @@ -50,6 +50,7 @@ import CoreSubst hiding( substTy ) import CoreArity ( manifestArity ) import CoreUtils import Id +import Demand ( isBottomingSig ) import DataCon import Literal import PrimOp @@ -1034,6 +1035,10 @@ certainlyWillInline dflags fn_info , case inlinePragmaSpec (inlinePragInfo fn_info) of NoInline -> False -- NOINLINE; do not say certainlyWillInline! _ -> True -- INLINE, INLINABLE, or nothing + , not (isBottomingSig (strictnessInfo fn_info)) + -- Do not unconditionally inline a bottoming functions even if + -- it seems smallish. We've carefully lifted it out to top level, + -- so we don't want to re-inline it. , let arity = length args , size - (10 * (arity + 1)) <= ufUseThreshold dflags = Just (fn_unf { uf_src = InlineStable From git at git.haskell.org Tue Feb 7 16:18:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Feb 2017 16:18:11 +0000 (UTC) Subject: [commit: ghc] master: Docs: Fix typo in glasgow_exts.rst (078beea) Message-ID: <20170207161811.D87A33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/078beea9e97033ca88c6415a5e019ca0eb19389d/ghc >--------------------------------------------------------------- commit 078beea9e97033ca88c6415a5e019ca0eb19389d Author: Daniel Gröber Date: Tue Feb 7 17:07:10 2017 +0100 Docs: Fix typo in glasgow_exts.rst >--------------------------------------------------------------- 078beea9e97033ca88c6415a5e019ca0eb19389d 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 c2d8437..f9869ca 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -10615,7 +10615,7 @@ Using Template Haskell ---------------------- - The data types and monadic constructor functions for Template Haskell - are in the library ``Language.Haskell.THSyntax``. + are in the library ``Language.Haskell.TH.Syntax``. - You can only run a function at compile time if it is imported from another module. That is, you can't define a function in a module, and From git at git.haskell.org Tue Feb 7 16:20:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Feb 2017 16:20:22 +0000 (UTC) Subject: [commit: ghc] master: Add Wredundant-constraints to list of flags excluded from -Wall (5ce39f6) Message-ID: <20170207162022.2DE6F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5ce39f6395efd81f9cc0e0aa2f36a7552ed75f7c/ghc >--------------------------------------------------------------- commit 5ce39f6395efd81f9cc0e0aa2f36a7552ed75f7c Author: Siddhanathan Shanmugam Date: Tue Feb 7 08:12:05 2017 -0800 Add Wredundant-constraints to list of flags excluded from -Wall In light of #10635 >--------------------------------------------------------------- 5ce39f6395efd81f9cc0e0aa2f36a7552ed75f7c docs/users_guide/using-warnings.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/users_guide/using-warnings.rst b/docs/users_guide/using-warnings.rst index de660ed..6408559 100644 --- a/docs/users_guide/using-warnings.rst +++ b/docs/users_guide/using-warnings.rst @@ -68,6 +68,7 @@ The following flags are simple ways to select standard "packages" of warnings: * :ghc-flag:`-Wmissing-import-lists` * :ghc-flag:`-Wmissing-home-modules` * :ghc-flag:`-Widentities` + * :ghc-flag:`-Wredundant-constraints` .. ghc-flag:: -Wcompat From git at git.haskell.org Tue Feb 7 17:29:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Feb 2017 17:29:52 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Genealize arrow (350caf3) Message-ID: <20170207172952.959B83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/350caf3e2fffba933450999d7f60347d6ee450ee/ghc >--------------------------------------------------------------- commit 350caf3e2fffba933450999d7f60347d6ee450ee Author: Ben Gamari Date: Wed Feb 1 20:25:33 2017 -0500 Genealize arrow >--------------------------------------------------------------- 350caf3e2fffba933450999d7f60347d6ee450ee compiler/coreSyn/CoreFVs.hs | 1 + compiler/coreSyn/CoreLint.hs | 33 ++++- compiler/coreSyn/CoreSubst.hs | 4 +- compiler/coreSyn/TrieMap.hs | 6 +- compiler/iface/ToIface.hs | 6 +- compiler/prelude/TysPrim.hs | 27 ++-- compiler/specialise/Rules.hs | 7 + compiler/typecheck/TcCanonical.hs | 23 ++- compiler/typecheck/TcSMonad.hs | 4 +- compiler/typecheck/TcTyDecls.hs | 1 + compiler/typecheck/TcType.hs | 73 ++++++++-- compiler/typecheck/TcUnify.hs | 3 + compiler/typecheck/TcValidity.hs | 1 + compiler/types/Coercion.hs | 119 ++++++++++++--- compiler/types/Coercion.hs-boot | 6 +- compiler/types/FamInstEnv.hs | 1 + compiler/types/OptCoercion.hs | 9 ++ compiler/types/TyCoRep.hs | 24 ++- compiler/types/TyCon.hs | 4 +- compiler/types/Type.hs | 161 ++++++++++++++++----- compiler/types/Unify.hs | 20 ++- libraries/base/tests/all.T | 2 +- testsuite/tests/ghci/scripts/T8535.stdout | 2 +- testsuite/tests/ghci/scripts/ghci020.stdout | 2 +- testsuite/tests/ghci/should_run/T10145.stdout | 2 +- .../partial-sigs/should_compile/T10403.stderr | 3 +- testsuite/tests/perf/compiler/all.T | 3 +- testsuite/tests/typecheck/should_compile/all.T | 1 + .../tests/typecheck/should_fail/tcfail181.stderr | 5 +- 29 files changed, 446 insertions(+), 107 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 350caf3e2fffba933450999d7f60347d6ee450ee From git at git.haskell.org Tue Feb 7 17:29:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Feb 2017 17:29:55 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Add catchalls (973f22f) Message-ID: <20170207172955.568BF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/973f22fc99299416a132a2ad7f6f767f161c0de9/ghc >--------------------------------------------------------------- commit 973f22fc99299416a132a2ad7f6f767f161c0de9 Author: Ben Gamari Date: Thu Feb 2 02:13:15 2017 -0500 Add catchalls >--------------------------------------------------------------- 973f22fc99299416a132a2ad7f6f767f161c0de9 compiler/utils/Binary.hs | 1 + libraries/ghci/GHCi/TH/Binary.hs | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/compiler/utils/Binary.hs b/compiler/utils/Binary.hs index 2782b79..65157bd 100644 --- a/compiler/utils/Binary.hs +++ b/compiler/utils/Binary.hs @@ -633,6 +633,7 @@ instance Binary KindRep where put_ bh (KindRepFun a b) = putByte bh 3 >> put_ bh a >> put_ bh b put_ bh (KindRepTYPE r) = putByte bh 4 >> put_ bh r put_ bh (KindRepTypeLit sort r) = putByte bh 5 >> put_ bh sort >> put_ bh r + put_ _ _ = fail "Binary.putKindRep: impossible" get bh = do tag <- getByte bh diff --git a/libraries/ghci/GHCi/TH/Binary.hs b/libraries/ghci/GHCi/TH/Binary.hs index 0d0ea9d..4dfe441 100644 --- a/libraries/ghci/GHCi/TH/Binary.hs +++ b/libraries/ghci/GHCi/TH/Binary.hs @@ -135,6 +135,7 @@ instance Binary KindRep where put (KindRepFun a b) = putWord8 3 >> put a >> put b put (KindRepTYPE r) = putWord8 4 >> put r put (KindRepTypeLit sort r) = putWord8 5 >> put sort >> put r + put _ = fail "GHCi.TH.Binary.putKindRep: Impossible" get = do tag <- getWord8 @@ -144,14 +145,14 @@ instance Binary KindRep where 2 -> KindRepApp <$> get <*> get 3 -> KindRepFun <$> get <*> get 4 -> KindRepTYPE <$> get - 5 -> KindRepTypeList <$> get <*> get + 5 -> KindRepTypeLit <$> get <*> get _ -> fail "GHCi.TH.Binary.putKindRep: invalid tag" instance Binary TypeLitSort where put TypeLitSymbol = putWord8 0 put TypeLitNat = putWord8 1 - get bh = do - tag <- getWord8 bh + get = do + tag <- getWord8 case tag of 0 -> pure TypeLitSymbol 1 -> pure TypeLitNat From git at git.haskell.org Tue Feb 7 17:30:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Feb 2017 17:30:00 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Comments (f428bf0) Message-ID: <20170207173000.D06A93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/f428bf035b4c0f8e5ef7145abc46182d762f8f64/ghc >--------------------------------------------------------------- commit f428bf035b4c0f8e5ef7145abc46182d762f8f64 Author: Ben Gamari Date: Thu Feb 2 12:44:45 2017 -0500 Comments >--------------------------------------------------------------- f428bf035b4c0f8e5ef7145abc46182d762f8f64 compiler/typecheck/TcTypeable.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/compiler/typecheck/TcTypeable.hs b/compiler/typecheck/TcTypeable.hs index 6ae5002..25c7830 100644 --- a/compiler/typecheck/TcTypeable.hs +++ b/compiler/typecheck/TcTypeable.hs @@ -358,6 +358,8 @@ mkTyConRepBinds stuff@(Stuff {..}) todo (tycon, tycon_kind) -- We should have already excluded non-representable tycons in -- mkTyConTodos. +-- | Here is where we define the set of Typeable types. These exclude type +-- families and polytypes. tyConIsTypeable :: TyCon -> Bool tyConIsTypeable tc = isJust (tyConRepName_maybe tc) @@ -366,9 +368,12 @@ tyConIsTypeable tc = -- is representable (e.g. has no higher-rank polymorphism or type -- synonyms). +-- | Is a particular 'Type' representable by @Typeable@? Here we look for +-- polytypes and types containing casts (which may be, for instance, a type +-- family). typeIsTypeable :: Type -> Bool -- We handle types of the form (TYPE rep) specifically to avoid --- looping on RuntimeRep +-- looping on (tyConIsTypeable RuntimeRep) typeIsTypeable ty | Just ty' <- coreView ty = typeIsTypeable ty' typeIsTypeable ty From git at git.haskell.org Tue Feb 7 17:30:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Feb 2017 17:30:03 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Debugging (d8756ff) Message-ID: <20170207173003.912193A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/d8756ffd6aa3e95c3497f0b7c055a41689ddaeca/ghc >--------------------------------------------------------------- commit d8756ffd6aa3e95c3497f0b7c055a41689ddaeca Author: Ben Gamari Date: Thu Feb 2 18:05:15 2017 -0500 Debugging >--------------------------------------------------------------- d8756ffd6aa3e95c3497f0b7c055a41689ddaeca compiler/typecheck/TcType.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/typecheck/TcType.hs b/compiler/typecheck/TcType.hs index cf77fa5..146de37 100644 --- a/compiler/typecheck/TcType.hs +++ b/compiler/typecheck/TcType.hs @@ -887,10 +887,10 @@ exactTyCoVarsOfType ty exactTyCoVarsOfTypes :: [Type] -> TyVarSet exactTyCoVarsOfTypes tys = mapUnionVarSet exactTyCoVarsOfType tys -rewritableTyVarsOfTypes :: [TcType] -> TcTyVarSet +rewritableTyVarsOfTypes :: HasCallStack => [TcType] -> TcTyVarSet rewritableTyVarsOfTypes tys = mapUnionVarSet rewritableTyVarsOfType tys -rewritableTyVarsOfType :: TcType -> TcTyVarSet +rewritableTyVarsOfType :: HasCallStack => TcType -> TcTyVarSet -- Used during kick-out from the inert set -- Ignores coercions and casts, because rewriting those does -- not help solving, and it's more efficient to ignore them From git at git.haskell.org Tue Feb 7 17:29:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Feb 2017 17:29:58 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: TcInteract: Cleanup imports (dc19773) Message-ID: <20170207172958.1BEA93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/dc1977323b5a35384681bea5a00b6623b8a4ab40/ghc >--------------------------------------------------------------- commit dc1977323b5a35384681bea5a00b6623b8a4ab40 Author: Ben Gamari Date: Thu Feb 2 02:29:03 2017 -0500 TcInteract: Cleanup imports >--------------------------------------------------------------- dc1977323b5a35384681bea5a00b6623b8a4ab40 compiler/typecheck/TcInteract.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/typecheck/TcInteract.hs b/compiler/typecheck/TcInteract.hs index 6cded90..2cd2fa7 100644 --- a/compiler/typecheck/TcInteract.hs +++ b/compiler/typecheck/TcInteract.hs @@ -27,8 +27,8 @@ import PrelNames ( knownNatClassName, knownSymbolClassName, typeableClassName, coercibleTyConKey, heqTyConKey, ipClassKey ) import TysWiredIn ( typeNatKind, typeSymbolKind, heqDataCon, - coercibleDataCon, runtimeRepTy ) -import TysPrim ( eqPrimTyCon, eqReprPrimTyCon, tYPETyCon ) + coercibleDataCon ) +import TysPrim ( eqPrimTyCon, eqReprPrimTyCon ) import Id( idType ) import CoAxiom ( TypeEqn, CoAxiom(..), CoAxBranch(..), fromBranches ) import Class From git at git.haskell.org Tue Feb 7 17:30:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Feb 2017 17:30:07 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Type-indexed Typeable (7b7c77b) Message-ID: <20170207173007.CF01B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/7b7c77b92f20cdd0c5f36d820f085dd9eb5090f4/ghc >--------------------------------------------------------------- commit 7b7c77b92f20cdd0c5f36d820f085dd9eb5090f4 Author: Ben Gamari Date: Thu Feb 2 01:29:26 2017 -0500 Type-indexed Typeable >--------------------------------------------------------------- 7b7c77b92f20cdd0c5f36d820f085dd9eb5090f4 compiler/backpack/RnModIface.hs | 3 + compiler/basicTypes/OccName.hs | 12 +- compiler/coreSyn/CoreLint.hs | 2 +- compiler/deSugar/DsBinds.hs | 101 +-- compiler/prelude/KnownUniques.hs | 47 +- compiler/prelude/PrelNames.hs | 149 +++- compiler/prelude/THNames.hs | 32 +- compiler/prelude/TysPrim.hs | 1 + compiler/prelude/TysWiredIn.hs | 4 +- compiler/rename/RnSource.hs | 29 +- compiler/typecheck/TcBackpack.hs | 4 +- compiler/typecheck/TcEvidence.hs | 19 +- compiler/typecheck/TcHsSyn.hs | 12 +- compiler/typecheck/TcInteract.hs | 50 +- compiler/typecheck/TcRnDriver.hs | 6 +- compiler/typecheck/TcSMonad.hs | 9 +- compiler/typecheck/TcTypeable.hs | 450 ++++++++++--- compiler/types/Kind.hs | 14 +- compiler/types/TyCon.hs | 6 +- compiler/types/Type.hs | 4 +- compiler/types/Type.hs-boot | 5 + compiler/utils/Binary.hs | 176 ++++- compiler/utils/Fingerprint.hsc | 1 + libraries/base/Data/Dynamic.hs | 55 +- libraries/base/Data/Type/Equality.hs | 6 + libraries/base/Data/Typeable.hs | 225 +++++-- libraries/base/Data/Typeable/Internal.hs | 746 ++++++++++++++------- libraries/base/GHC/Conc/Sync.hs | 4 - libraries/base/GHC/Show.hs | 4 +- libraries/base/Type/Reflection.hs | 42 ++ libraries/base/Type/Reflection/Unsafe.hs | 22 + libraries/base/base.cabal | 4 +- libraries/base/tests/T11334a.stdout | 2 +- libraries/base/tests/all.T | 2 +- libraries/base/tests/dynamic002.hs | 5 + libraries/base/tests/dynamic002.stdout | 2 +- libraries/base/tests/dynamic004.hs | 1 - libraries/ghc-boot/GHC/Serialized.hs | 15 +- libraries/ghc-prim/GHC/Classes.hs | 8 +- libraries/ghc-prim/GHC/Types.hs | 40 +- libraries/ghci/GHCi/Message.hs | 6 +- libraries/ghci/GHCi/TH/Binary.hs | 170 +++++ .../tests/deSugar/should_compile/T2431.stderr | 98 ++- .../tests/dependent/should_compile/RaeJobTalk.hs | 52 +- testsuite/tests/dependent/should_compile/T11711.hs | 10 +- .../dependent/should_compile/dynamic-paper.hs | 16 +- .../tests/ghci.debugger/scripts/print019.stderr | 6 +- testsuite/tests/patsyn/should_compile/T12698.hs | 2 +- testsuite/tests/perf/should_run/all.T | 3 +- testsuite/tests/polykinds/T8132.hs | 5 +- testsuite/tests/polykinds/T8132.stderr | 2 +- testsuite/tests/roles/should_compile/Roles1.stderr | 128 +++- .../tests/roles/should_compile/Roles13.stderr | 144 +++- .../tests/roles/should_compile/Roles14.stderr | 18 +- testsuite/tests/roles/should_compile/Roles2.stderr | 36 +- testsuite/tests/roles/should_compile/Roles3.stderr | 77 ++- testsuite/tests/roles/should_compile/Roles4.stderr | 38 +- testsuite/tests/roles/should_compile/T8958.stderr | 68 +- .../tests/safeHaskell/unsafeLibs/GoodImport03.hs | 3 +- .../tests/simplCore/should_compile/T7360.stderr | 141 ++-- .../tests/simplCore/should_compile/T8274.stdout | 25 +- testsuite/tests/th/TH_Roles2.stderr | 12 +- .../should_fail/TcStaticPointersFail02.stderr | 4 +- .../typecheck/should_run/TestTypeableBinary.hs | 37 + .../typecheck/should_run/TestTypeableBinary.stdout | 15 + testsuite/tests/typecheck/should_run/TypeOf.stdout | 6 +- testsuite/tests/typecheck/should_run/TypeRep.hs | 12 +- .../tests/typecheck/should_run/TypeRep.stdout | 6 +- testsuite/tests/typecheck/should_run/Typeable1.hs | 23 + testsuite/tests/typecheck/should_run/TypeableEq.hs | 79 +++ .../tests/typecheck/should_run/TypeableEq.stdout | 10 + testsuite/tests/typecheck/should_run/all.T | 3 + 72 files changed, 2684 insertions(+), 890 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 7b7c77b92f20cdd0c5f36d820f085dd9eb5090f4 From git at git.haskell.org Tue Feb 7 17:30:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Feb 2017 17:30:10 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Kill redundant import (6371097) Message-ID: <20170207173010.96D703A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/63710979542779c688235a421e17b03701dabe56/ghc >--------------------------------------------------------------- commit 63710979542779c688235a421e17b03701dabe56 Author: Ben Gamari Date: Thu Feb 2 02:18:36 2017 -0500 Kill redundant import >--------------------------------------------------------------- 63710979542779c688235a421e17b03701dabe56 compiler/prelude/TysPrim.hs | 1 - 1 file changed, 1 deletion(-) diff --git a/compiler/prelude/TysPrim.hs b/compiler/prelude/TysPrim.hs index a6054dc..daa1634 100644 --- a/compiler/prelude/TysPrim.hs +++ b/compiler/prelude/TysPrim.hs @@ -96,7 +96,6 @@ import {-# SOURCE #-} TysWiredIn import Var ( TyVar, TyVarBndr(TvBndr), mkTyVar ) import Name -import NameEnv import TyCon import SrcLoc import Unique From git at git.haskell.org Tue Feb 7 17:30:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Feb 2017 17:30:13 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Fix warning (94cda07) Message-ID: <20170207173013.5601C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/94cda07d36b3370ea90c6b5f81f7e30b5d3a1281/ghc >--------------------------------------------------------------- commit 94cda07d36b3370ea90c6b5f81f7e30b5d3a1281 Author: Ben Gamari Date: Thu Feb 2 11:38:33 2017 -0500 Fix warning >--------------------------------------------------------------- 94cda07d36b3370ea90c6b5f81f7e30b5d3a1281 compiler/typecheck/TcTypeable.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/typecheck/TcTypeable.hs b/compiler/typecheck/TcTypeable.hs index 93be5be..6ae5002 100644 --- a/compiler/typecheck/TcTypeable.hs +++ b/compiler/typecheck/TcTypeable.hs @@ -196,7 +196,7 @@ todoForTyCons mod mod_id tycons = do , Just _ <- pure $ tyConRepName_maybe tc'' ] let typeable_tycons = filter dbg tycons - dbg (tycon, kind) = + dbg (_tycon, kind) = --pprTrace "todoForTycons" (ppr tycon $$ ppr bare_kind $$ ppr is_typeable) is_typeable where is_typeable = typeIsTypeable bare_kind From git at git.haskell.org Tue Feb 7 17:30:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Feb 2017 17:30:15 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable's head updated: Debugging (d8756ff) Message-ID: <20170207173015.D1F813A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/ttypeable' now includes: 1f366b8 Add delete retry loop. [ci skip] de78ee6 Document GHC.Profiling functions [ci skip] bc42e2b Convert pprTrace in isPredTy to a WARN 34a0205 UNREG: fix "_bytes" string literal forward declaration 4441f90 UNREG: add a forward declaration for local literals f60287c Fix mismatched tick in GHC.Generics documentation d2cf5de Fix deprecation warnings from containers 2ec1c83 Fix broken tests 7363d53 Check that a default type signature aligns with the non-default signature 9169111 Add a flag to emit error messages as JSON 5593573 Fixes bug #11046 f41c27d Slighly clean up symbol loading error. 5f8e234 Print COMPLETE pragmas in --show-iface f984bf2 Simplify minusInteger in integer-gmp slightly 9af1fb2 Fix links to building guides in MAKEHELP.md e9a239c Fix minor typo in README.md 32729d3 Turn libraries/integer-gmp/gmp/tarball into a submodule c71f0c4 Fix binary instance for SrcStrictness 748b797 Use top-level instances to solve superclasses where possible b3576ed Mark reallyUnsafePtrEquality# as can_fail cb4b4fe users guide: Fix markup of COMPLETE pragma examples afc05c7 README: Mention acceptability of pull requests 44f079f FloatOut: Allow floating through breakpoint ticks 4dfc6d1 Abstract over the way eventlogs are flushed b15136a user-guide: fix links and file names (fixes #13198) 25e0cfc Export callStackDoc 99e920c Typos in note header and test f660306 Update output of failing 11223 tests 4fa439e Remove very broad ignore. [ci skip] 8d5cf8b Join points 3d65411 testsuite: Update allocations for T12234 d2b681b Fix documentation NOTE about can_fail 5cb5b7a base: Derive Enum, Bounded for VecCount, VecElem f5b275a Don't tick top-level string literals 1fcede4 Introduce GHC.TypeNats module, change KnownNat evidence to be Natural b16239a Make interface loading for COMPLETE pragmas lazy eedb3df Add support for StaticPointers in GHCi 8dd82ea Spelling fixes d8ac64e Add a testcase for #13227 b103532 Exhaustiveness check for EmptyCase (Trac #10746) 895aa6d Bump haskeline submodule 5728f4b Remove INLINE pragma on loopbreaker 6128b2f users-guide: Explain behavior of verbose-core2core + dump-inlinings bbd3c39 Ditch static flags 09b8332 Get rid of ProbOneShot c2becee Bump performance mark for T9020 afa409f Use tyCoVarsOfType for CTyEqCan in shouldSplitWD 350caf3 Genealize arrow 7b7c77b Type-indexed Typeable 973f22f Add catchalls 6371097 Kill redundant import dc19773 TcInteract: Cleanup imports 94cda07 Fix warning f428bf0 Comments d8756ff Debugging From git at git.haskell.org Tue Feb 7 17:40:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Feb 2017 17:40:13 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Fix rebase issues (ccc9104) Message-ID: <20170207174013.137653A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/ccc9104f8ffe583fee81de03ac1896f1f386e085/ghc >--------------------------------------------------------------- commit ccc9104f8ffe583fee81de03ac1896f1f386e085 Author: Ben Gamari Date: Tue Feb 7 12:39:59 2017 -0500 Fix rebase issues >--------------------------------------------------------------- ccc9104f8ffe583fee81de03ac1896f1f386e085 libraries/base/Data/Typeable/Internal.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/base/Data/Typeable/Internal.hs b/libraries/base/Data/Typeable/Internal.hs index 6e6cc04..95a36d3 100644 --- a/libraries/base/Data/Typeable/Internal.hs +++ b/libraries/base/Data/Typeable/Internal.hs @@ -81,9 +81,9 @@ import Data.Type.Equality import GHC.List ( splitAt, foldl ) import GHC.Word import GHC.Show -import Data.Proxy -import GHC.TypeLits ( KnownNat, KnownSymbol, natVal', symbolVal' ) +import GHC.TypeLits ( KnownSymbol, symbolVal' ) import GHC.TypeNats ( KnownNat, natVal' ) +import Unsafe.Coerce ( unsafeCoerce ) import GHC.Fingerprint.Type import {-# SOURCE #-} GHC.Fingerprint From git at git.haskell.org Tue Feb 7 19:50:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Feb 2017 19:50:47 +0000 (UTC) Subject: [commit: ghc] branch 'wip/travis' created Message-ID: <20170207195047.27A0B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/travis Referencing: 6fce907bf573e95977e18c256cc3c548e09a4823 From git at git.haskell.org Tue Feb 7 19:50:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Feb 2017 19:50:49 +0000 (UTC) Subject: [commit: ghc] wip/travis: Travis experiment: Build in non-container environment (6fce907) Message-ID: <20170207195049.E031C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/travis Link : http://ghc.haskell.org/trac/ghc/changeset/6fce907bf573e95977e18c256cc3c548e09a4823/ghc >--------------------------------------------------------------- commit 6fce907bf573e95977e18c256cc3c548e09a4823 Author: Joachim Breitner Date: Tue Feb 7 14:48:27 2017 -0500 Travis experiment: Build in non-container environment >--------------------------------------------------------------- 6fce907bf573e95977e18c256cc3c548e09a4823 .travis.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 218f5ba..77bd244 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,3 @@ -# The following enables container-based travis instances -sudo: false - git: submodules: false From git at git.haskell.org Tue Feb 7 19:51:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Feb 2017 19:51:45 +0000 (UTC) Subject: [commit: ghc] wip/travis: Travis experiment: language: generic (f9a0639) Message-ID: <20170207195145.6AD5A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/travis Link : http://ghc.haskell.org/trac/ghc/changeset/f9a0639fe00c39d800b8e1c6a3b549a286702da3/ghc >--------------------------------------------------------------- commit f9a0639fe00c39d800b8e1c6a3b549a286702da3 Author: Joachim Breitner Date: Tue Feb 7 14:51:36 2017 -0500 Travis experiment: language: generic >--------------------------------------------------------------- f9a0639fe00c39d800b8e1c6a3b549a286702da3 .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 77bd244..b47da5c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,7 @@ +# The following enables container-based travis instances +sudo: false +language: generic + git: submodules: false From git at git.haskell.org Tue Feb 7 19:54:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Feb 2017 19:54:01 +0000 (UTC) Subject: [commit: ghc] wip/travis: Travis experiment: try trusty (c729798) Message-ID: <20170207195401.DCD8F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/travis Link : http://ghc.haskell.org/trac/ghc/changeset/c729798f5a07e95c4be44ded4a62fd74e3ea283f/ghc >--------------------------------------------------------------- commit c729798f5a07e95c4be44ded4a62fd74e3ea283f Author: Joachim Breitner Date: Tue Feb 7 14:52:34 2017 -0500 Travis experiment: try trusty >--------------------------------------------------------------- c729798f5a07e95c4be44ded4a62fd74e3ea283f .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index b47da5c..04bad9b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ # The following enables container-based travis instances +dist: trusty sudo: false language: generic From git at git.haskell.org Tue Feb 7 19:54:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Feb 2017 19:54:40 +0000 (UTC) Subject: [commit: ghc] wip/travis: Travis experiment: bump boot GHC (a0440d8) Message-ID: <20170207195440.8A2EF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/travis Link : http://ghc.haskell.org/trac/ghc/changeset/a0440d8d12b05e4720982e42d74db4a17bd71cc2/ghc >--------------------------------------------------------------- commit a0440d8d12b05e4720982e42d74db4a17bd71cc2 Author: Joachim Breitner Date: Tue Feb 7 14:54:31 2017 -0500 Travis experiment: bump boot GHC >--------------------------------------------------------------- a0440d8d12b05e4720982e42d74db4a17bd71cc2 .travis.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 04bad9b..8047f1a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,15 +19,15 @@ addons: #- llvm-toolchain-precise-3.7 - ubuntu-toolchain-r-test packages: - - cabal-install-1.18 - - ghc-7.10.3 - - alex-3.1.3 - - happy-1.19.4 + - cabal-install-1.24 + - ghc-8.0.2 + - alex-3.1.7 + - happy-1.19.5 - python3 #- llvm-3.7 before_install: - - export PATH=/opt/ghc/7.10.3/bin:/opt/cabal/1.18/bin:/opt/alex/3.1.3/bin:/opt/happy/1.19.4/bin:/usr/lib/llvm-3.7/bin:$PATH + - export PATH=/opt/ghc/7.0.2/bin:/opt/cabal/1.24/bin:/opt/alex/3.1.7/bin:/opt/happy/1.19.5/bin:/usr/lib/llvm-3.7/bin:$PATH # Be explicit about which protocol to use, such that we don't have to repeat the rewrite command for each. - git config remote.origin.url git://github.com/${TRAVIS_REPO_SLUG}.git From git at git.haskell.org Tue Feb 7 21:35:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Feb 2017 21:35:06 +0000 (UTC) Subject: [commit: ghc] wip/T13227: Improve the Occurrence Analyzer’s handling of one-shot functions (8882aa7) Message-ID: <20170207213506.59FBE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T13227 Link : http://ghc.haskell.org/trac/ghc/changeset/8882aa770588540c4c31cdb64bb152292108c0a7/ghc >--------------------------------------------------------------- commit 8882aa770588540c4c31cdb64bb152292108c0a7 Author: Joachim Breitner Date: Sun Feb 5 10:52:12 2017 -0500 Improve the Occurrence Analyzer’s handling of one-shot functions when determining whether an expression is used saturatedly, count the number of value arguments that the occurrence analyser sees, and add the number of one-shot arguments that we know (from the strictness analyser) are passed from the context. This was suggested by Simon PJ in ticket #13227. perf results suggest no noticable change in allocations, reduction of code sizes, and performance regression possibliy due to loss of join points. Differential Revision: https://phabricator.haskell.org/D3089 >--------------------------------------------------------------- 8882aa770588540c4c31cdb64bb152292108c0a7 compiler/simplCore/OccurAnal.hs | 80 ++++++++++++++++++++++++++++++----------- 1 file changed, 59 insertions(+), 21 deletions(-) diff --git a/compiler/simplCore/OccurAnal.hs b/compiler/simplCore/OccurAnal.hs index 80eca71..3388b20 100644 --- a/compiler/simplCore/OccurAnal.hs +++ b/compiler/simplCore/OccurAnal.hs @@ -1547,7 +1547,7 @@ occAnalNonRecRhs env bndr bndrs body env1 | certainly_inline = env | otherwise = rhsCtxt env - -- See Note [Use one-shot info] + -- See Note [Sources of one-shot information] rhs_env = env1 { occ_one_shots = argOneShots dmd } @@ -1867,16 +1867,17 @@ occAnalApp env (Var fun, args, ticks) -- This is the *whole point* of the isRhsEnv predicate -- See Note [Arguments of let-bound constructors] - n_val_args = valArgCount args + n_val_args = valArgCount args + length (takeWhile isOneShotInfo (occ_one_shots env)) + -- See Note [Sources of one-shot information], bullet point A' + n_args = length args fun_uds = mkOneOcc env fun (n_val_args > 0) n_args is_exp = isExpandableApp fun n_val_args - -- See Note [CONLIKE pragma] in BasicTypes - -- The definition of is_exp should match that in - -- Simplify.prepareRhs + -- See Note [CONLIKE pragma] in BasicTypes + -- The definition of is_exp should match that in Simplify.prepareRhs one_shots = argsOneShots (idStrictness fun) n_val_args - -- See Note [Use one-shot info] + -- See Note [Sources of one-shot information] occAnalApp env (fun, args, ticks) = (markAllNonTailCalled (fun_uds +++ args_uds), @@ -1898,20 +1899,44 @@ zapDetailsIf True uds = zapDetails uds zapDetailsIf False uds = uds {- -Note [Use one-shot information] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The occurrrence analyser propagates one-shot-lambda information in two -situations: +Note [Sources of one-shot information] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +The occurrence analyser obtains one-shot-lambda information from two sources: + +A: Saturated applications: eg f e1 .. en + + In general, given a call (f e1 .. en) we can propagate one-shot info from + f's strictness signature into e1 .. en, but /only/ if n is enough to + saturate the strictness signature. A stricteness signature like + + f :: C1(C1(L))LS + + means that *if f is applied to three arguments* then it will guarantee to + call its first argument at most once, and to call the result of that at + most once. But if f has fewer than three arguments, all bets are off; e.g. + + map (f (\x y. expensive) e2) xs + + Here the \x y abstraction may be called many times (once for each element of + xs) so we should not mark x and y as one-shot. But if it was - * Applications: eg build (\c n -> blah) + map (f (\x y. expensive) 3 2) xs - Propagate one-shot info from the strictness signature of 'build' to - the \c n. + then the first argument of f will be called at most once. - This strictness signature can come from a module interface, in the case of - an imported function, or from a previous run of the demand analyser. +A': Non-obviously satuated applications: eg build (f (\x y -> expensive)) - * Let-bindings: eg let f = \c. let ... in \n -> blah + In this case, f is only manifestly applied to one argument, so it does not + look saturated. So bye the previous point, we should not use its strictness + signature to learn about the one-shotness of \x y. But in this case we can: + + build is fully applied, so we may use its strictness signature. From that + we learn that build calls its argument with two arguments *at most once*. + + So there is really only one call to f, and it will have three arguments. In + that sense, f is saturated, and we may proceed as described above. + +B: Let-bindings: eg let f = \c. let ... in \n -> blah in (build f, build f) Propagate one-shot info from the demanand-info on 'f' to the @@ -1924,6 +1949,22 @@ Previously, the demand analyser would *also* set the one-shot information, but that code was buggy (see #11770), so doing it only in on place, namely here, is saner. +Note [OneShots] +~~~~~~~~~~~~~~~ +When analysing an expression, the occ_one_shots argument contains information +about how the function is being used. The length of the list indicates +how many arguments will eventually be passed to the analysed expression, +and the OneShotInfo indicates whether this application is once or multiple times. + +Example: + + Context of f occ_one_shots when analysing f + + f 1 2 [OneShot, OneShot] + map (f 1) [OneShot, NoOneShotInfo] + build f [OneShot, OneShot] + f 1 2 `seq` f 2 1 [NoOneShotInfo, OneShot] + Note [Binders in case alternatives] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Consider @@ -2008,7 +2049,7 @@ wrapAltRHS _ _ alt_usg _ alt_rhs data OccEnv = OccEnv { occ_encl :: !OccEncl -- Enclosing context information - , occ_one_shots :: !OneShots -- Tells about linearity + , occ_one_shots :: !OneShots -- See Note [OneShots] , occ_gbl_scrut :: GlobalScruts , occ_rule_act :: Activation -> Bool -- Which rules are active -- See Note [Finding rule RHS free vars] @@ -2037,11 +2078,8 @@ instance Outputable OccEncl where ppr OccRhs = text "occRhs" ppr OccVanilla = text "occVanilla" +-- See note [OneShots] type OneShots = [OneShotInfo] - -- [] No info - -- - -- one_shot_info:ctxt Analysing a function-valued expression that - -- will be applied as described by one_shot_info initOccEnv :: (Activation -> Bool) -> OccEnv initOccEnv active_rule From git at git.haskell.org Tue Feb 7 21:35:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Feb 2017 21:35:08 +0000 (UTC) Subject: [commit: ghc] wip/T13227's head updated: Improve the Occurrence Analyzer’s handling of one-shot functions (8882aa7) Message-ID: <20170207213508.C1E713A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/T13227' now includes: 2219c8c Derive <$ 17ae5e7 Typos in comments [skip ci] a0174d2 Do not inline bottoming things f77e99b Comments only b8f58d7 Another improvement to SetLevels 078beea Docs: Fix typo in glasgow_exts.rst 5ce39f6 Add Wredundant-constraints to list of flags excluded from -Wall 8882aa7 Improve the Occurrence Analyzer’s handling of one-shot functions From git at git.haskell.org Tue Feb 7 21:38:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 7 Feb 2017 21:38:52 +0000 (UTC) Subject: [commit: ghc] wip/travis: Travis experiment: bump boot GHC (2f31711) Message-ID: <20170207213852.CF7083A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/travis Link : http://ghc.haskell.org/trac/ghc/changeset/2f31711f92916f9539ce26317879a0ac0e7d25bf/ghc >--------------------------------------------------------------- commit 2f31711f92916f9539ce26317879a0ac0e7d25bf Author: Joachim Breitner Date: Tue Feb 7 14:54:31 2017 -0500 Travis experiment: bump boot GHC >--------------------------------------------------------------- 2f31711f92916f9539ce26317879a0ac0e7d25bf .travis.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 04bad9b..64a72b5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,15 +19,15 @@ addons: #- llvm-toolchain-precise-3.7 - ubuntu-toolchain-r-test packages: - - cabal-install-1.18 - - ghc-7.10.3 - - alex-3.1.3 - - happy-1.19.4 + - cabal-install-1.24 + - ghc-8.0.2 + - alex-3.1.7 + - happy-1.19.5 - python3 #- llvm-3.7 before_install: - - export PATH=/opt/ghc/7.10.3/bin:/opt/cabal/1.18/bin:/opt/alex/3.1.3/bin:/opt/happy/1.19.4/bin:/usr/lib/llvm-3.7/bin:$PATH + - export PATH=/opt/ghc/8.0.2/bin:/opt/cabal/1.24/bin:/opt/alex/3.1.7/bin:/opt/happy/1.19.5/bin:/usr/lib/llvm-3.7/bin:$PATH # Be explicit about which protocol to use, such that we don't have to repeat the rewrite command for each. - git config remote.origin.url git://github.com/${TRAVIS_REPO_SLUG}.git From git at git.haskell.org Wed Feb 8 02:34:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Feb 2017 02:34:50 +0000 (UTC) Subject: [commit: ghc] master: Use better map operations in CoreMonad (d5e9b7f) Message-ID: <20170208023450.DB1063A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d5e9b7f5b84440e0e81515773c8fa31cbaebfd57/ghc >--------------------------------------------------------------- commit d5e9b7f5b84440e0e81515773c8fa31cbaebfd57 Author: David Feuer Date: Tue Feb 7 21:34:00 2017 -0500 Use better map operations in CoreMonad Use strict `unionWith` where apparently appropriate, and use strict `insertWith` rather than lookup followed by insertion. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3099 >--------------------------------------------------------------- d5e9b7f5b84440e0e81515773c8fa31cbaebfd57 compiler/simplCore/CoreMonad.hs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/compiler/simplCore/CoreMonad.hs b/compiler/simplCore/CoreMonad.hs index 087410c..ac3e2c4 100644 --- a/compiler/simplCore/CoreMonad.hs +++ b/compiler/simplCore/CoreMonad.hs @@ -83,6 +83,7 @@ import Data.Dynamic import Data.IORef import Data.Map (Map) import qualified Data.Map as Map +import qualified Data.Map.Strict as MapStrict import Data.Word import Control.Monad import Control.Applicative ( Alternative(..) ) @@ -311,19 +312,13 @@ doSimplTick dflags tick doSimplTick _ _ (VerySimplCount n) = VerySimplCount (n+1) --- Don't use Map.unionWith because that's lazy, and we want to --- be pretty strict here! addTick :: TickCounts -> Tick -> TickCounts -addTick fm tick = case Map.lookup tick fm of - Nothing -> Map.insert tick 1 fm - Just n -> n1 `seq` Map.insert tick n1 fm - where - n1 = n+1 - +addTick fm tick = MapStrict.insertWith (+) tick 1 fm plusSimplCount sc1@(SimplCount { ticks = tks1, details = dts1 }) sc2@(SimplCount { ticks = tks2, details = dts2 }) - = log_base { ticks = tks1 + tks2, details = Map.unionWith (+) dts1 dts2 } + = log_base { ticks = tks1 + tks2 + , details = MapStrict.unionWith (+) dts1 dts2 } where -- A hackish way of getting recent log info log_base | null (log1 sc2) = sc1 -- Nothing at all in sc2 From git at git.haskell.org Wed Feb 8 02:41:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Feb 2017 02:41:39 +0000 (UTC) Subject: [commit: ghc] master: Clean up findPartiallyCompletedCycles (e90f611) Message-ID: <20170208024139.047453A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e90f611d2c4d4cfea80400b4dce30e9659ae0655/ghc >--------------------------------------------------------------- commit e90f611d2c4d4cfea80400b4dce30e9659ae0655 Author: David Feuer Date: Tue Feb 7 21:38:34 2017 -0500 Clean up findPartiallyCompletedCycles Rewrite `findPartiallyCompletedCycles` to use a list comprehension rather than pattern matching on a list. Make it use `Data.Set` rather than fussing with lists. Reviewers: austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3102 >--------------------------------------------------------------- e90f611d2c4d4cfea80400b4dce30e9659ae0655 compiler/main/GhcMake.hs | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/compiler/main/GhcMake.hs b/compiler/main/GhcMake.hs index 77b9581..b518518 100644 --- a/compiler/main/GhcMake.hs +++ b/compiler/main/GhcMake.hs @@ -414,7 +414,7 @@ load' how_much mHscMessage mod_graph = do = findPartiallyCompletedCycles modsDone_names mg2_with_srcimps let mods_to_keep - = filter ((`notElem` mods_to_zap_names).ms_mod) + = filter ((`Set.notMember` mods_to_zap_names).ms_mod) modsDone hsc_env1 <- getSession @@ -575,23 +575,18 @@ pruneHomePackageTable hpt summ (stable_obj, stable_bco) -- -- | Return (names of) all those in modsDone who are part of a cycle as defined -- by theGraph. -findPartiallyCompletedCycles :: [Module] -> [SCC ModSummary] -> [Module] +findPartiallyCompletedCycles :: [Module] -> [SCC ModSummary] -> Set.Set Module findPartiallyCompletedCycles modsDone theGraph - = chew theGraph - where - chew [] = [] - chew ((AcyclicSCC _):rest) = chew rest -- acyclic? not interesting. - chew ((CyclicSCC vs):rest) - = let names_in_this_cycle = nub (map ms_mod vs) - mods_in_this_cycle - = nub ([done | done <- modsDone, - done `elem` names_in_this_cycle]) - chewed_rest = chew rest - in - if notNull mods_in_this_cycle - && length mods_in_this_cycle < length names_in_this_cycle - then mods_in_this_cycle ++ chewed_rest - else chewed_rest + = Set.unions + [mods_in_this_cycle + | CyclicSCC vs <- theGraph -- Acyclic? Not interesting. + , let names_in_this_cycle = Set.fromList (map ms_mod vs) + mods_in_this_cycle = + Set.intersection (Set.fromList modsDone) names_in_this_cycle + -- If size mods_in_this_cycle == size names_in_this_cycle, + -- then this cycle has already been completed and we're not + -- interested. + , Set.size mods_in_this_cycle < Set.size names_in_this_cycle] -- --------------------------------------------------------------------------- From git at git.haskell.org Wed Feb 8 03:40:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Feb 2017 03:40:21 +0000 (UTC) Subject: [commit: ghc] master: Update Core formalize for Levity -> RuntimeRep (bc376d3) Message-ID: <20170208034021.7B8BD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/bc376d329ae2d727e9b88f2fcbc1a9315300a4fc/ghc >--------------------------------------------------------------- commit bc376d329ae2d727e9b88f2fcbc1a9315300a4fc Author: Ben Gamari Date: Tue Feb 7 21:34:26 2017 -0500 Update Core formalize for Levity -> RuntimeRep Reviewers: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3094 >--------------------------------------------------------------- bc376d329ae2d727e9b88f2fcbc1a9315300a4fc docs/core-spec/CoreSyn.ott | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/core-spec/CoreSyn.ott b/docs/core-spec/CoreSyn.ott index f966661..578d200 100644 --- a/docs/core-spec/CoreSyn.ott +++ b/docs/core-spec/CoreSyn.ott @@ -342,9 +342,9 @@ terminals :: 'terminals_' ::= | isNewTyCon :: :: isNewTyCon {{ tex \textsf{isNewTyCon} }} | Constraint :: :: Constraint {{ tex \textsf{Constraint} }} | TYPE :: :: TYPE {{ tex \textsf{TYPE} }} - | Levity :: :: Levity {{ tex \textsf{Levity} }} - | Lifted :: :: Lifted {{ tex \textsf{Lifted} }} - | Unlifted :: :: Unlifted {{ tex \textsf{Unlifted} }} + | RuntimeRep :: :: RuntimeRep {{ tex \textsf{RuntimeRep} }} + | LiftedRep :: :: LiftedRep {{ tex \textsf{LiftedRep} }} + | UnliftedRep :: :: UnliftedRep {{ tex \textsf{UnliftedRep} }} | no_conflict :: :: no_conflict {{ tex \textsf{no\_conflict} }} | apart :: :: apart {{ tex \textsf{apart} }} | kind :: :: kind {{ tex \textsf{kind} }} From git at git.haskell.org Wed Feb 8 03:40:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Feb 2017 03:40:24 +0000 (UTC) Subject: [commit: ghc] master: cpeApp: Make Int accumulator strict (8c25be8) Message-ID: <20170208034024.3C24F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8c25be80a41f436225f4d18ec4f624a17562a490/ghc >--------------------------------------------------------------- commit 8c25be80a41f436225f4d18ec4f624a17562a490 Author: Ben Gamari Date: Tue Feb 7 21:33:16 2017 -0500 cpeApp: Make Int accumulator strict Test Plan: Validate Reviewers: austin, dfeuer Subscribers: dfeuer, thomie Differential Revision: https://phabricator.haskell.org/D3093 >--------------------------------------------------------------- 8c25be80a41f436225f4d18ec4f624a17562a490 compiler/coreSyn/CorePrep.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/coreSyn/CorePrep.hs b/compiler/coreSyn/CorePrep.hs index ab64449..ce6eba2 100644 --- a/compiler/coreSyn/CorePrep.hs +++ b/compiler/coreSyn/CorePrep.hs @@ -774,7 +774,7 @@ cpeApp top_env expr collect_args :: CoreExpr -> (CoreExpr, [ArgInfo], Int) collect_args e = go e [] 0 where - go (App fun arg) as depth + go (App fun arg) as !depth = go fun (CpeApp arg : as) (if isTyCoArg arg then depth else depth + 1) go (Cast fun co) as depth From git at git.haskell.org Wed Feb 8 03:40:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Feb 2017 03:40:27 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Bump max_bytes_used for T4029 (369c534) Message-ID: <20170208034027.2B8DD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/369c534f8b6d0857d718a076c5f98f0a74a2c0a4/ghc >--------------------------------------------------------------- commit 369c534f8b6d0857d718a076c5f98f0a74a2c0a4 Author: Ben Gamari Date: Tue Feb 7 21:26:49 2017 -0500 testsuite: Bump max_bytes_used for T4029 Unfortunately it's not clear what regressed this. >--------------------------------------------------------------- 369c534f8b6d0857d718a076c5f98f0a74a2c0a4 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 56a58cb..a58ae2c 100644 --- a/testsuite/tests/perf/space_leaks/all.T +++ b/testsuite/tests/perf/space_leaks/all.T @@ -64,7 +64,7 @@ test('T4029', # 2016-07-13: 92 (amd64/Linux) Changes to tidyType # 2016-09-01: 71 (amd64/Linux) Restore w/w limit (#11565) stats_num_field('max_bytes_used', - [(wordsize(64), 21670448 , 5)]), + [(wordsize(64), 22770352, 5)]), # 2016-02-26: 24071720 (amd64/Linux) INITIAL # 2016-04-21: 25542832 (amd64/Linux) # 2016-05-23: 25247216 (amd64/Linux) Use -G1 @@ -74,6 +74,7 @@ test('T4029', # 2016-10-13: 20325248 (amd64/Linux) Creep (downwards, yay!) # 2016-11-14: 21387048 (amd64/Linux) Creep back upwards :( # 2017-01-18: 21670448 (amd64/Linux) Float string literals to toplevel + # 2017-02-07: 22770352 (amd64/Linux) It is unclear extra_hc_opts('+RTS -G1 -RTS' ), ], ghci_script, From git at git.haskell.org Wed Feb 8 03:40:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Feb 2017 03:40:29 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Bump bytes allocated for T5837 (0aa3f8d) Message-ID: <20170208034029.DF0363A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0aa3f8d4645c078ae07509870eae539e42483f78/ghc >--------------------------------------------------------------- commit 0aa3f8d4645c078ae07509870eae539e42483f78 Author: Ben Gamari Date: Tue Feb 7 21:30:15 2017 -0500 testsuite: Bump bytes allocated for T5837 Simon decreased this earlier today but Harbormaster doesn't reproduce his number. I've done two things here: 1. increased the allocations number to the Harbormaster value 2. increased the acceptance threshold from 5% to 7%, since Simon saw a 6.6% change in his environment. >--------------------------------------------------------------- 0aa3f8d4645c078ae07509870eae539e42483f78 testsuite/tests/perf/compiler/all.T | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index a9464fc..1df1eae 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -608,7 +608,7 @@ test('T5837', # 2014-12-08: 115905208 Constraint solver perf improvements (esp kick-out) # 2016-04-06: 24199320 (x86/Linux, 64-bit machine) TypeInType - (wordsize(64), 50253880, 5)]) + (wordsize(64), 53592736, 7)]) # sample: 3926235424 (amd64/Linux, 15/2/2012) # 2012-10-02 81879216 # 2012-09-20 87254264 amd64/Linux @@ -638,6 +638,9 @@ test('T5837', # all the gain here is from this patch, but I think it # just pushed it over the edge, so I'm re-centreing, and # changing to 5% tolerance + # 2017-02-07 53592736 amd64/Linux Simon's earlier decrease appears + # to be environmentally-dependent. + # Also bumped acceptance threshold to 7%. ], compile, ['-freduction-depth=50']) From git at git.haskell.org Wed Feb 8 03:40:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Feb 2017 03:40:33 +0000 (UTC) Subject: [commit: ghc] master: Fix push_bang_into_newtype when the pattern match has no arguments (062f112) Message-ID: <20170208034033.086ED3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/062f112388ac879dc78a9a0c5a947894d20cd899/ghc >--------------------------------------------------------------- commit 062f112388ac879dc78a9a0c5a947894d20cd899 Author: Matthew Pickering Date: Tue Feb 7 21:35:32 2017 -0500 Fix push_bang_into_newtype when the pattern match has no arguments Correct behaviour of push_bang_into_newtype when the pattern match has no arguments. A user can write ``` newtype T = T Int f :: T -> () f !(T {}) = () ``` in which case we have to push the bang inwards through the newtype in order to achieve the desired strictness properties. This patch fixes this special case where the pattern match has no arguments to push the bang onto. We now make up a wildcard pattern which is wrapped in the bang pattern. ``` f (T !_) = () ``` Reviewers: simonpj, austin, bgamari Reviewed By: simonpj Subscribers: simonpj, thomie Differential Revision: https://phabricator.haskell.org/D3057 >--------------------------------------------------------------- 062f112388ac879dc78a9a0c5a947894d20cd899 compiler/deSugar/Match.hs | 32 +++++++++++++++++------- testsuite/tests/deSugar/should_compile/T13215.hs | 6 +++++ testsuite/tests/deSugar/should_compile/all.T | 1 + testsuite/tests/deSugar/should_run/T9844.hs | 13 ++++++++++ testsuite/tests/deSugar/should_run/T9844.stderr | 2 ++ testsuite/tests/deSugar/should_run/T9844.stdout | 2 ++ 6 files changed, 47 insertions(+), 9 deletions(-) diff --git a/compiler/deSugar/Match.hs b/compiler/deSugar/Match.hs index f5c3cf5..53b719a 100644 --- a/compiler/deSugar/Match.hs +++ b/compiler/deSugar/Match.hs @@ -518,11 +518,16 @@ tidy_bang_pat v _ p@(SumPat {}) = tidy1 v p tidy_bang_pat v _ p@(PArrPat {}) = tidy1 v p -- Data/newtype constructors -tidy_bang_pat v l p@(ConPatOut { pat_con = L _ (RealDataCon dc), pat_args = args }) - | isNewTyCon (dataConTyCon dc) -- Newtypes: push bang inwards (Trac #9844) - = tidy1 v (p { pat_args = push_bang_into_newtype_arg l args }) - | otherwise -- Data types: discard the bang - = tidy1 v p +tidy_bang_pat v l p@(ConPatOut { pat_con = L _ (RealDataCon dc) + , pat_args = args + , pat_arg_tys = arg_tys }) + -- Newtypes: push bang inwards (Trac #9844) + = + if isNewTyCon (dataConTyCon dc) + then tidy1 v (p { pat_args = push_bang_into_newtype_arg l ty args }) + else tidy1 v p -- Data types: discard the bang + where + (ty:_) = dataConInstArgTys dc arg_tys ------------------- -- Default case, leave the bang there: @@ -542,18 +547,24 @@ tidy_bang_pat v l p@(ConPatOut { pat_con = L _ (RealDataCon dc), pat_args = args tidy_bang_pat _ l p = return (idDsWrapper, BangPat (L l p)) ------------------- -push_bang_into_newtype_arg :: SrcSpan -> HsConPatDetails Id -> HsConPatDetails Id +push_bang_into_newtype_arg :: SrcSpan + -> Type -- The type of the argument we are pushing + -- onto + -> HsConPatDetails Id -> HsConPatDetails Id -- See Note [Bang patterns and newtypes] -- We are transforming !(N p) into (N !p) -push_bang_into_newtype_arg l (PrefixCon (arg:args)) +push_bang_into_newtype_arg l _ty (PrefixCon (arg:args)) = ASSERT( null args) PrefixCon [L l (BangPat arg)] -push_bang_into_newtype_arg l (RecCon rf) +push_bang_into_newtype_arg l _ty (RecCon rf) | HsRecFields { rec_flds = L lf fld : flds } <- rf , HsRecField { hsRecFieldArg = arg } <- fld = ASSERT( null flds) RecCon (rf { rec_flds = [L lf (fld { hsRecFieldArg = L l (BangPat arg) })] }) -push_bang_into_newtype_arg _ cd +push_bang_into_newtype_arg l ty (RecCon rf) -- If a user writes !(T {}) + | HsRecFields { rec_flds = [] } <- rf + = PrefixCon [L l (BangPat (noLoc (WildPat ty)))] +push_bang_into_newtype_arg _ _ cd = pprPanic "push_bang_into_newtype_arg" (pprConArgs cd) {- @@ -568,6 +579,9 @@ So what we do is to push the bang inwards, in the hope that it will get discarded there. So we transform !(N pat) into (N !pat) +But what if there is nothing to push the bang onto? In at least one instance +a user has written !(N {}) which we translate into (N !_). See #13215 + \noindent {\bf Previous @matchTwiddled@ stuff:} diff --git a/testsuite/tests/deSugar/should_compile/T13215.hs b/testsuite/tests/deSugar/should_compile/T13215.hs new file mode 100644 index 0000000..102bd90 --- /dev/null +++ b/testsuite/tests/deSugar/should_compile/T13215.hs @@ -0,0 +1,6 @@ +{-# LANGUAGE BangPatterns #-} +module T13215 where + +newtype F = F Int + +foo !(F {}) = () diff --git a/testsuite/tests/deSugar/should_compile/all.T b/testsuite/tests/deSugar/should_compile/all.T index d40f8eb..24b95a0 100644 --- a/testsuite/tests/deSugar/should_compile/all.T +++ b/testsuite/tests/deSugar/should_compile/all.T @@ -95,3 +95,4 @@ test('T11414', normal, compile, ['']) test('T12944', normal, compile, ['']) test('T12950', normal, compile, ['']) test('T13043', normal, compile, ['']) +test('T13215', normal, compile, ['']) diff --git a/testsuite/tests/deSugar/should_run/T9844.hs b/testsuite/tests/deSugar/should_run/T9844.hs index e06628e..851f628 100644 --- a/testsuite/tests/deSugar/should_run/T9844.hs +++ b/testsuite/tests/deSugar/should_run/T9844.hs @@ -12,6 +12,19 @@ f1 :: N -> Int f1 n = n `seq` case n of N _ -> 0 +f2 :: N -> Int +f2 n = case n of + !(N {}) -> 0 + +f3 :: N -> Int +f3 n = n `seq` case n of + N {} -> 0 + + + main = do print $ f0 (trace "evaluated f0" (N 1)) print $ f1 (trace "evaluated f1" (N 1)) + + print $ f2 (trace "evaluated f2" (N 1)) + print $ f3 (trace "evaluated f3" (N 1)) diff --git a/testsuite/tests/deSugar/should_run/T9844.stderr b/testsuite/tests/deSugar/should_run/T9844.stderr index c94d12f..6da33db 100644 --- a/testsuite/tests/deSugar/should_run/T9844.stderr +++ b/testsuite/tests/deSugar/should_run/T9844.stderr @@ -1,2 +1,4 @@ evaluated f0 evaluated f1 +evaluated f2 +evaluated f3 diff --git a/testsuite/tests/deSugar/should_run/T9844.stdout b/testsuite/tests/deSugar/should_run/T9844.stdout index aa47d0d..44e0be8 100644 --- a/testsuite/tests/deSugar/should_run/T9844.stdout +++ b/testsuite/tests/deSugar/should_run/T9844.stdout @@ -1,2 +1,4 @@ 0 0 +0 +0 From git at git.haskell.org Wed Feb 8 03:40:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Feb 2017 03:40:35 +0000 (UTC) Subject: [commit: ghc] master: Fix comment of `section "Exceptions"` (3e07126) Message-ID: <20170208034035.B43AB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3e0712612a1e6c9b404e31b2a0175d8f9c5d443e/ghc >--------------------------------------------------------------- commit 3e0712612a1e6c9b404e31b2a0175d8f9c5d443e Author: Takenobu Tani Date: Tue Feb 7 21:36:54 2017 -0500 Fix comment of `section "Exceptions"` I changed comment from `{- .. -}` to `--`. Because Haddock comment for `section "Exceptions"` [1] was broken. [1]: https://downloads.haskell.org/~ghc/latest/docs/html/libraries/ghc-prim-0 .5.0.0/GHC-Prim.html Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3083 >--------------------------------------------------------------- 3e0712612a1e6c9b404e31b2a0175d8f9c5d443e compiler/prelude/primops.txt.pp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp index 5245272..533d198 100644 --- a/compiler/prelude/primops.txt.pp +++ b/compiler/prelude/primops.txt.pp @@ -1945,19 +1945,18 @@ primop CasMutVarOp "casMutVar#" GenPrimOp section "Exceptions" ------------------------------------------------------------------------ -{- Note [Strictness for mask/unmask/catch] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Consider this example, which comes from GHC.IO.Handle.Internals: - wantReadableHandle3 f ma b st - = case ... of - DEFAULT -> case ma of MVar a -> ... - 0# -> maskAsynchExceptions# (\st -> case ma of MVar a -> ...) -The outer case just decides whether to mask exceptions, but we don't want -thereby to hide the strictness in 'ma'! Hence the use of strictApply1Dmd. - -For catch, we must be extra careful; see -Note [Exceptions and strictness] in Demand --} +-- Note [Strictness for mask/unmask/catch] +-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +-- Consider this example, which comes from GHC.IO.Handle.Internals: +-- wantReadableHandle3 f ma b st +-- = case ... of +-- DEFAULT -> case ma of MVar a -> ... +-- 0# -> maskAsynchExceptions# (\st -> case ma of MVar a -> ...) +-- The outer case just decides whether to mask exceptions, but we don't want +-- thereby to hide the strictness in 'ma'! Hence the use of strictApply1Dmd. +-- +-- For catch, we must be extra careful; see +-- Note [Exceptions and strictness] in Demand primop CatchOp "catch#" GenPrimOp (State# RealWorld -> (# State# RealWorld, a #) ) From git at git.haskell.org Wed Feb 8 03:40:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Feb 2017 03:40:38 +0000 (UTC) Subject: [commit: ghc] master: Update hoopl submodule (512f157) Message-ID: <20170208034038.7D58B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/512f157c2ac0d4b9d754dc83ba1df819eb766e70/ghc >--------------------------------------------------------------- commit 512f157c2ac0d4b9d754dc83ba1df819eb766e70 Author: Ben Gamari Date: Tue Feb 7 21:58:46 2017 -0500 Update hoopl submodule This is in preparation for an upcoming bump of the containers submodule. >--------------------------------------------------------------- 512f157c2ac0d4b9d754dc83ba1df819eb766e70 libraries/hoopl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/hoopl b/libraries/hoopl index d2f1175..46d43d4 160000 --- a/libraries/hoopl +++ b/libraries/hoopl @@ -1 +1 @@ -Subproject commit d2f117557ea08bb7cf062573d0e39f523bb1a4d0 +Subproject commit 46d43d439c30a237edd78b0bd7d86a31fe3efca9 From git at git.haskell.org Wed Feb 8 03:40:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Feb 2017 03:40:41 +0000 (UTC) Subject: [commit: ghc] master: Fix comment (broken link to users_guide) in $(TOP)/ (db3a797) Message-ID: <20170208034041.3F44C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/db3a797a8014e30f831dc0a0b53482319688c800/ghc >--------------------------------------------------------------- commit db3a797a8014e30f831dc0a0b53482319688c800 Author: Takenobu Tani Date: Tue Feb 7 21:37:07 2017 -0500 Fix comment (broken link to users_guide) in $(TOP)/ There was a broken link to users_guide at a comment. * compiler/types/InstEnv.hs - type-class-extensions.html -> glasgow_exts.html Reviewers: bgamari, austin Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3092 >--------------------------------------------------------------- db3a797a8014e30f831dc0a0b53482319688c800 compiler/types/InstEnv.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/types/InstEnv.hs b/compiler/types/InstEnv.hs index e91e5b8..8198a53 100644 --- a/compiler/types/InstEnv.hs +++ b/compiler/types/InstEnv.hs @@ -524,7 +524,7 @@ These functions implement the carefully-written rules in the user manual section on "overlapping instances". At risk of duplication, here are the rules. If the rules change, change this text and the user manual simultaneously. The link may be this: -http://www.haskell.org/ghc/docs/latest/html/users_guide/type-class-extensions.html#instance-overlap +http://www.haskell.org/ghc/docs/latest/html/users_guide/glasgow_exts.html#instance-overlap The willingness to be overlapped or incoherent is a property of the instance declaration itself, controlled as follows: From git at git.haskell.org Wed Feb 8 03:40:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Feb 2017 03:40:43 +0000 (UTC) Subject: [commit: ghc] master: Pass -v0 to ghc-pkg to reduce noise in build ouput (015e97a) Message-ID: <20170208034043.EA8733A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/015e97afd43a1b1762e1d6eef5d904c904e82965/ghc >--------------------------------------------------------------- commit 015e97afd43a1b1762e1d6eef5d904c904e82965 Author: Matthew Pickering Date: Tue Feb 7 21:39:02 2017 -0500 Pass -v0 to ghc-pkg to reduce noise in build ouput By default ghc-pkg is quite noisy as it can't find interface files. Test Plan: Look at the build log stderr and see if there are lots of "cannot find any of" errors. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3103 >--------------------------------------------------------------- 015e97afd43a1b1762e1d6eef5d904c904e82965 rules/build-package-data.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/build-package-data.mk b/rules/build-package-data.mk index e340c8b..8f3a8e7 100644 --- a/rules/build-package-data.mk +++ b/rules/build-package-data.mk @@ -129,7 +129,7 @@ endif endif "$$(ghc-cabal_INPLACE)" configure $1 $2 "$$($1_$2_dll0_MODULES)" --with-ghc="$$($1_$2_HC_CONFIG)" --with-ghc-pkg="$$($1_$2_GHC_PKG)" $$($1_CONFIGURE_OPTS) $$($1_$2_CONFIGURE_OPTS) ifeq "$$($1_$2_PROG)" "" - $$(call cmd,$1_$2_GHC_PKG) update --force $$($1_$2_GHC_PKG_OPTS) $1/$2/inplace-pkg-config + $$(call cmd,$1_$2_GHC_PKG) update -v0 --force $$($1_$2_GHC_PKG_OPTS) $1/$2/inplace-pkg-config endif endif # NO_GENERATED_MAKEFILE_RULES endif # BINDIST From git at git.haskell.org Wed Feb 8 08:39:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Feb 2017 08:39:40 +0000 (UTC) Subject: [commit: ghc] master: More typos in comments [skip ci] (b990f65) Message-ID: <20170208083940.80F8E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b990f656091cb6c960fb21f05791acf38a19abc1/ghc >--------------------------------------------------------------- commit b990f656091cb6c960fb21f05791acf38a19abc1 Author: Gabor Greif Date: Tue Feb 7 11:55:16 2017 +0100 More typos in comments [skip ci] >--------------------------------------------------------------- b990f656091cb6c960fb21f05791acf38a19abc1 compiler/coreSyn/CorePrep.hs | 2 +- compiler/coreSyn/CoreUnfold.hs | 8 ++++---- compiler/deSugar/DsMeta.hs | 2 +- compiler/deSugar/DsMonad.hs | 2 +- compiler/main/HscTypes.hs | 2 +- compiler/main/TidyPgm.hs | 2 +- compiler/simplCore/OccurAnal.hs | 4 ++-- compiler/typecheck/TcInteract.hs | 2 +- compiler/typecheck/TcRnTypes.hs | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/compiler/coreSyn/CorePrep.hs b/compiler/coreSyn/CorePrep.hs index ce6eba2..db0e996 100644 --- a/compiler/coreSyn/CorePrep.hs +++ b/compiler/coreSyn/CorePrep.hs @@ -451,7 +451,7 @@ cpeBind top_lvl env (Rec pairs) where (bndrs, rhss) = unzip pairs - -- Flatten all the floats, and the currrent + -- Flatten all the floats, and the current -- group into a single giant Rec add_float (FloatLet (NonRec b r)) prs2 = (b,r) : prs2 add_float (FloatLet (Rec prs1)) prs2 = prs1 ++ prs2 diff --git a/compiler/coreSyn/CoreUnfold.hs b/compiler/coreSyn/CoreUnfold.hs index c69357b..71c5f0f 100644 --- a/compiler/coreSyn/CoreUnfold.hs +++ b/compiler/coreSyn/CoreUnfold.hs @@ -98,7 +98,7 @@ mkDFunUnfolding bndrs con ops = DFunUnfolding { df_bndrs = bndrs , df_con = con , df_args = map occurAnalyseExpr ops } - -- See Note [Occurrrence analysis of unfoldings] + -- See Note [Occurrence analysis of unfoldings] mkWwInlineRule :: CoreExpr -> Arity -> Unfolding mkWwInlineRule expr arity @@ -238,7 +238,7 @@ mkCoreUnfolding :: UnfoldingSource -> Bool -> CoreExpr -- Occurrence-analyses the expression before capturing it mkCoreUnfolding src top_lvl expr guidance = CoreUnfolding { uf_tmpl = occurAnalyseExpr expr, - -- See Note [Occurrrence analysis of unfoldings] + -- See Note [Occurrence analysis of unfoldings] uf_src = src, uf_is_top = top_lvl, uf_is_value = exprIsHNF expr, @@ -257,7 +257,7 @@ mkUnfolding :: DynFlags -> UnfoldingSource -- Occurrence-analyses the expression before capturing it mkUnfolding dflags src is_top_lvl is_bottoming expr = CoreUnfolding { uf_tmpl = occurAnalyseExpr expr, - -- See Note [Occurrrence analysis of unfoldings] + -- See Note [Occurrence analysis of unfoldings] uf_src = src, uf_is_top = is_top_lvl, uf_is_value = exprIsHNF expr, @@ -646,7 +646,7 @@ sizeExpr dflags bOMB_OUT_SIZE top_args expr -- -- IMPORATANT: *do* charge 1 for the alternative, else we -- find that giant case nests are treated as practically free - -- A good example is Foreign.C.Error.errrnoToIOError + -- A good example is Foreign.C.Error.errnoToIOError ------------ -- Cost to allocate binding with given binder diff --git a/compiler/deSugar/DsMeta.hs b/compiler/deSugar/DsMeta.hs index 1ec70c7..f8572cb 100644 --- a/compiler/deSugar/DsMeta.hs +++ b/compiler/deSugar/DsMeta.hs @@ -1428,7 +1428,7 @@ repBinds b@(HsIPBinds _) = notHandled "Implicit parameters" (ppr b) repBinds (HsValBinds decs) = do { let { bndrs = hsSigTvBinders decs ++ collectHsValBinders decs } - -- No need to worrry about detailed scopes within + -- No need to worry about detailed scopes within -- the binding group, because we are talking Names -- here, so we can safely treat it as a mutually -- recursive group diff --git a/compiler/deSugar/DsMonad.hs b/compiler/deSugar/DsMonad.hs index f9533e3..4f68100 100644 --- a/compiler/deSugar/DsMonad.hs +++ b/compiler/deSugar/DsMonad.hs @@ -253,7 +253,7 @@ initDsTc thing_inside initTcDsForSolver :: TcM a -> DsM (Messages, Maybe a) -- Spin up a TcM context so that we can run the constraint solver -- Returns any error messages generated by the constraint solver --- and (Just res) if no error happened; Nothing if an errror happened +-- and (Just res) if no error happened; Nothing if an error happened -- -- Simon says: I'm not very happy about this. We spin up a complete TcM monad -- only to immediately refine it to a TcS monad. diff --git a/compiler/main/HscTypes.hs b/compiler/main/HscTypes.hs index d476faf..581912d 100644 --- a/compiler/main/HscTypes.hs +++ b/compiler/main/HscTypes.hs @@ -1591,7 +1591,7 @@ extendInteractiveContext ictxt new_tythings new_cls_insts new_fam_insts defaults } where - -- Discard old instances that have been fully overrridden + -- Discard old instances that have been fully overridden -- See Note [Override identical instances in GHCi] (cls_insts, fam_insts) = ic_instances ictxt old_cls_insts = filterOut (\i -> any (identicalClsInstHead i) new_cls_insts) cls_insts diff --git a/compiler/main/TidyPgm.hs b/compiler/main/TidyPgm.hs index 0c8f491..2e603a6 100644 --- a/compiler/main/TidyPgm.hs +++ b/compiler/main/TidyPgm.hs @@ -691,7 +691,7 @@ chooseExternalIds hsc_env mod omit_prags expose_all binds implicit_binds imp_id_ init_occ_env = initTidyOccEnv avoids - search :: [(Id,Id)] -- The work-list: (external id, referrring id) + search :: [(Id,Id)] -- The work-list: (external id, referring id) -- Make a tidy, external Name for the external id, -- add it to the UnfoldEnv, and do the same for the -- transitive closure of Ids it refers to diff --git a/compiler/simplCore/OccurAnal.hs b/compiler/simplCore/OccurAnal.hs index 80eca71..96107fe 100644 --- a/compiler/simplCore/OccurAnal.hs +++ b/compiler/simplCore/OccurAnal.hs @@ -1472,7 +1472,7 @@ chooses a loop breaker. Suppose in iteration 1 it choose g as the loop breaker. That means it is free to inline f. Suppose that GHC decides to inline f in the branches of the case, but -(for some reason; eg it is not satureated) in the rhs of g. So we get +(for some reason; eg it is not saturated) in the rhs of g. So we get let rec { f = ...g...g... ; g = ...f...f... } @@ -1900,7 +1900,7 @@ zapDetailsIf False uds = uds {- Note [Use one-shot information] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The occurrrence analyser propagates one-shot-lambda information in two +The occurrence analyser propagates one-shot-lambda information in two situations: * Applications: eg build (\c n -> blah) diff --git a/compiler/typecheck/TcInteract.hs b/compiler/typecheck/TcInteract.hs index 13fc0b0..e8ac6e9 100644 --- a/compiler/typecheck/TcInteract.hs +++ b/compiler/typecheck/TcInteract.hs @@ -615,7 +615,7 @@ we keep? More subtle than you might think! IRReplace, to avoid unnecessary munging of the inert set. Doing the depth-check for implicit parameters, rather than making the work item -always overrride, is important. Consider +always override, is important. Consider data T a where { T1 :: (?x::Int) => T Int; T2 :: T a } diff --git a/compiler/typecheck/TcRnTypes.hs b/compiler/typecheck/TcRnTypes.hs index 9e3ed5b..782a992 100644 --- a/compiler/typecheck/TcRnTypes.hs +++ b/compiler/typecheck/TcRnTypes.hs @@ -857,7 +857,7 @@ type TcIdBinderStack = [TcIdBinder] data TcIdBinder = TcIdBndr TcId - TopLevelFlag -- Tells whether the bindind is syntactically top-level + TopLevelFlag -- Tells whether the binding is syntactically top-level -- (The monomorphic Ids for a recursive group count -- as not-top-level for this purpose.) | TcIdBndr_ExpType -- Variant that allows the type to be specified as From git at git.haskell.org Wed Feb 8 13:12:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Feb 2017 13:12:58 +0000 (UTC) Subject: [commit: ghc] master: Improve -dsuppress-coercions (421308e) Message-ID: <20170208131258.B4E043A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/421308ef6ae3987f8077c6bfe1d9a6a03e53458c/ghc >--------------------------------------------------------------- commit 421308ef6ae3987f8077c6bfe1d9a6a03e53458c Author: Simon Peyton Jones Date: Wed Feb 8 11:31:32 2017 +0000 Improve -dsuppress-coercions The -dsuppress-coercions flag was being ignored when printing the CastIt constructor in SimplUtils.SimplCont. This fixes ths problem, and improves what is printed when suppressing coercions, to show the size of the suppressed coercion. >--------------------------------------------------------------- 421308ef6ae3987f8077c6bfe1d9a6a03e53458c compiler/coreSyn/PprCore.hs | 5 +++-- compiler/simplCore/SimplUtils.hs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/compiler/coreSyn/PprCore.hs b/compiler/coreSyn/PprCore.hs index 196a9b9..c61b166 100644 --- a/compiler/coreSyn/PprCore.hs +++ b/compiler/coreSyn/PprCore.hs @@ -12,7 +12,7 @@ module PprCore ( pprCoreExpr, pprParendExpr, pprCoreBinding, pprCoreBindings, pprCoreAlt, pprCoreBindingWithSize, pprCoreBindingsWithSize, - pprRules + pprRules, pprOptCo ) where import CoreSyn @@ -130,9 +130,10 @@ noParens :: SDoc -> SDoc noParens pp = pp pprOptCo :: Coercion -> SDoc +-- Print a coercion optionally; i.e. honouring -dsuppress-coercions pprOptCo co = sdocWithDynFlags $ \dflags -> if gopt Opt_SuppressCoercions dflags - then text "..." + then angleBrackets (text "Co:" <> int (coercionSize co)) else parens (sep [ppr co, dcolon <+> ppr (coercionType co)]) ppr_expr :: OutputableBndr b => (SDoc -> SDoc) -> Expr b -> SDoc diff --git a/compiler/simplCore/SimplUtils.hs b/compiler/simplCore/SimplUtils.hs index 2e985c5..7deaf5b 100644 --- a/compiler/simplCore/SimplUtils.hs +++ b/compiler/simplCore/SimplUtils.hs @@ -179,7 +179,7 @@ instance Outputable DupFlag where instance Outputable SimplCont where ppr (Stop ty interesting) = text "Stop" <> brackets (ppr interesting) <+> ppr ty - ppr (CastIt co cont ) = (text "CastIt" <+> ppr co) $$ ppr cont + ppr (CastIt co cont ) = (text "CastIt" <+> pprOptCo co) $$ ppr cont ppr (TickIt t cont) = (text "TickIt" <+> ppr t) $$ ppr cont ppr (ApplyToTy { sc_arg_ty = ty, sc_cont = cont }) = (text "ApplyToTy" <+> pprParendType ty) $$ ppr cont From git at git.haskell.org Wed Feb 8 13:13:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Feb 2017 13:13:01 +0000 (UTC) Subject: [commit: ghc] master: Improve the simple optimiser (8e9593f) Message-ID: <20170208131301.79C803A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8e9593fb2147252ecb8b685ef6bf9c0237a71219/ghc >--------------------------------------------------------------- commit 8e9593fb2147252ecb8b685ef6bf9c0237a71219 Author: Simon Peyton Jones Date: Tue Feb 7 00:32:43 2017 +0000 Improve the simple optimiser The previous version of the simple optimiser would leave beta-redexes, which was bad for join points. E.g. join j x = .... -- a join point in (\x. j x) y This would be ok if we beta-reduced the (\x) but not if we don't. This patch improves the simple optimiser, to follow the plan described in "Secrets of the GHC inliner", and implemented in the Mighty Simplifier. It turns out not to be too hard to use the same plan here, and we get slightly better code as a result. >--------------------------------------------------------------- 8e9593fb2147252ecb8b685ef6bf9c0237a71219 compiler/coreSyn/CoreSubst.hs | 562 +++++++++++++++++++++++++++--------------- 1 file changed, 364 insertions(+), 198 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 8e9593fb2147252ecb8b685ef6bf9c0237a71219 From git at git.haskell.org Wed Feb 8 15:26:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Feb 2017 15:26:19 +0000 (UTC) Subject: [commit: ghc] master: Generalize CmmUnwind and pass unwind information through NCG (3eb737e) Message-ID: <20170208152619.856AD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3eb737ee3f900f256a7474b199a4ab40178a8cac/ghc >--------------------------------------------------------------- commit 3eb737ee3f900f256a7474b199a4ab40178a8cac Author: Ben Gamari Date: Tue Feb 7 22:49:06 2017 -0500 Generalize CmmUnwind and pass unwind information through NCG As discussed in D1532, Trac Trac #11337, and Trac Trac #11338, the stack unwinding information produced by GHC is currently quite approximate. Essentially we assume that register values do not change at all within a basic block. While this is somewhat true in normal Haskell code, blocks containing foreign calls often break this assumption. This results in unreliable call stacks, especially in the code containing foreign calls. This is worse than it sounds as unreliable unwinding information can at times result in segmentation faults. This patch set attempts to improve this situation by tracking unwinding information with finer granularity. By dispensing with the assumption of one unwinding table per block, we allow the compiler to accurately represent the areas surrounding foreign calls. Towards this end we generalize the representation of unwind information in the backend in three ways, * Multiple CmmUnwind nodes can occur per block * CmmUnwind nodes can now carry unwind information for multiple registers (while not strictly necessary; this makes emitting unwinding information a bit more convenient in the compiler) * The NCG backend is given an opportunity to modify the unwinding records since it may need to make adjustments due to, for instance, native calling convention requirements for foreign calls (see #11353). This sets the stage for resolving #11337 and #11338. Test Plan: Validate Reviewers: scpmw, simonmar, austin, erikd Subscribers: qnikst, thomie Differential Revision: https://phabricator.haskell.org/D2741 >--------------------------------------------------------------- 3eb737ee3f900f256a7474b199a4ab40178a8cac compiler/cmm/CmmLayoutStack.hs | 32 ++-- compiler/cmm/CmmNode.hs | 10 +- compiler/cmm/CmmParse.y | 11 +- compiler/cmm/Debug.hs | 222 +++++++++++++++++++----- compiler/cmm/MkGraph.hs | 3 + compiler/cmm/PprCmm.hs | 4 +- compiler/codeGen/CgUtils.hs | 16 +- compiler/codeGen/StgCmmMonad.hs | 8 +- compiler/codeGen/StgCmmUtils.hs | 2 +- compiler/nativeGen/AsmCodeGen.hs | 96 +++++++++- compiler/nativeGen/Dwarf.hs | 43 +++-- compiler/nativeGen/Dwarf/Types.hs | 60 ++++--- compiler/nativeGen/NCGMonad.hs | 1 - compiler/nativeGen/X86/CodeGen.hs | 39 ++++- compiler/nativeGen/X86/Instr.hs | 14 +- compiler/nativeGen/X86/Ppr.hs | 14 +- rts/StgStartup.cmm | 4 +- testsuite/tests/regalloc/regalloc_unit_tests.hs | 2 +- 18 files changed, 450 insertions(+), 131 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 3eb737ee3f900f256a7474b199a4ab40178a8cac From git at git.haskell.org Wed Feb 8 15:26:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Feb 2017 15:26:22 +0000 (UTC) Subject: [commit: ghc] master: CmmLayoutStack: Add unwind information on stack fixups (733e845) Message-ID: <20170208152622.4CB1C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/733e845d0f66541a06415c6b420e51fc99eb9d95/ghc >--------------------------------------------------------------- commit 733e845d0f66541a06415c6b420e51fc99eb9d95 Author: Ben Gamari Date: Tue Feb 7 22:51:50 2017 -0500 CmmLayoutStack: Add unwind information on stack fixups Currently stack fixup blocks don't include unwinding information, leaving a small window where our unwinding information is incorrect. Fix this by adding unwinding information to emitted fixup blocks. Reviewers: scpmw, simonmar, austin Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2742 >--------------------------------------------------------------- 733e845d0f66541a06415c6b420e51fc99eb9d95 compiler/cmm/CmmLayoutStack.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/compiler/cmm/CmmLayoutStack.hs b/compiler/cmm/CmmLayoutStack.hs index 60f8970..fbd1d71 100644 --- a/compiler/cmm/CmmLayoutStack.hs +++ b/compiler/cmm/CmmLayoutStack.hs @@ -528,8 +528,16 @@ makeFixupBlock dflags sp0 l stack tscope assigs | otherwise = do tmp_lbl <- newBlockId let sp_off = sp0 - sm_sp stack + maybeAddUnwind block + | debugLevel dflags > 0 + = block `blockSnoc` CmmUnwind [(Sp, unwind_val)] + | otherwise + = block + where unwind_val = cmmOffset dflags (CmmReg spReg) (sm_sp stack) block = blockJoin (CmmEntry tmp_lbl tscope) - (maybeAddSpAdj dflags sp_off (blockFromList assigs)) + ( maybeAddSpAdj dflags sp_off + $ maybeAddUnwind + $ blockFromList assigs ) (CmmBranch l) return (tmp_lbl, [block]) From git at git.haskell.org Wed Feb 8 15:26:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Feb 2017 15:26:25 +0000 (UTC) Subject: [commit: ghc] master: Cmm: Add support for undefined unwinding statements (3328ddb) Message-ID: <20170208152625.13C1B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3328ddb88b6eb11cb1f6e844f883e7e9d2b8f21b/ghc >--------------------------------------------------------------- commit 3328ddb88b6eb11cb1f6e844f883e7e9d2b8f21b Author: Ben Gamari Date: Tue Feb 7 22:56:36 2017 -0500 Cmm: Add support for undefined unwinding statements And use to mark `stg_stack_underflow_frame`, which we are unable to determine a caller from. To simplify parsing at the moment we steal the `return` keyword to indicate an undefined unwind value. Perhaps this should be revisited. Reviewers: scpmw, simonmar, austin, erikd Subscribers: dfeuer, thomie Differential Revision: https://phabricator.haskell.org/D2738 >--------------------------------------------------------------- 3328ddb88b6eb11cb1f6e844f883e7e9d2b8f21b compiler/cmm/CmmLayoutStack.hs | 9 ++++---- compiler/cmm/CmmNode.hs | 8 +++---- compiler/cmm/CmmParse.y | 14 +++++++++--- compiler/cmm/Debug.hs | 8 ++++--- compiler/cmm/MkGraph.hs | 4 +++- compiler/codeGen/StgCmmMonad.hs | 2 +- compiler/nativeGen/Dwarf.hs | 4 +++- compiler/nativeGen/Dwarf/Types.hs | 47 ++++++++++++++++++++++++++------------- compiler/nativeGen/X86/CodeGen.hs | 6 ++--- rts/StgMiscClosures.cmm | 2 ++ 10 files changed, 68 insertions(+), 36 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 3328ddb88b6eb11cb1f6e844f883e7e9d2b8f21b From git at git.haskell.org Wed Feb 8 15:26:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Feb 2017 15:26:27 +0000 (UTC) Subject: [commit: ghc] master: Fix stop_thread unwinding information (34e3523) Message-ID: <20170208152627.CFDE63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/34e3523354916b0fb8a0dc93041d25812f7e6181/ghc >--------------------------------------------------------------- commit 34e3523354916b0fb8a0dc93041d25812f7e6181 Author: Ben Gamari Date: Tue Feb 7 23:00:10 2017 -0500 Fix stop_thread unwinding information This corrects the unwind information for `stg_stop_thread`, which allows us to unwind back to the C stack after reaching the end of the STG stack. Test Plan: Validate Reviewers: simonmar, austin, erikd Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2746 >--------------------------------------------------------------- 34e3523354916b0fb8a0dc93041d25812f7e6181 includes/rts/Constants.h | 14 ++++++++++++++ rts/StgCRun.c | 6 +----- rts/StgStartup.cmm | 14 +++++++++++--- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/includes/rts/Constants.h b/includes/rts/Constants.h index bd602e7..62fa833 100644 --- a/includes/rts/Constants.h +++ b/includes/rts/Constants.h @@ -112,6 +112,20 @@ #define RESERVED_C_STACK_BYTES (2048 * SIZEOF_LONG) /* ----------------------------------------------------------------------------- + How large is the stack frame saved by StgRun? + world. Used in StgCRun.c. + -------------------------------------------------------------------------- */ +#if defined(x86_64_HOST_ARCH) +# if defined(mingw32_HOST_OS) +/* 8 larger than necessary to make the alignment right*/ +# define STG_RUN_STACK_FRAME_SIZE 80 +# else +# define STG_RUN_STACK_FRAME_SIZE 48 +# endif +#endif + + +/* ----------------------------------------------------------------------------- How much Haskell stack space to reserve for the saving of registers etc. in the case of a stack/heap overflow. diff --git a/rts/StgCRun.c b/rts/StgCRun.c index 0610dd3..5f7f2b9 100644 --- a/rts/StgCRun.c +++ b/rts/StgCRun.c @@ -320,11 +320,7 @@ StgRunIsImplementedInAssembler(void) : : "i"(RESERVED_C_STACK_BYTES), -#if defined(mingw32_HOST_OS) - "i"(80 /*stack frame size; 8 too large to make the alignment right*/) -#else - "i"(48 /*stack frame size*/) -#endif + "i"(STG_RUN_STACK_FRAME_SIZE /* stack frame size */) ); /* * See Note [Stack Alignment on X86] diff --git a/rts/StgStartup.cmm b/rts/StgStartup.cmm index a3a75d8..4cc84bc 100644 --- a/rts/StgStartup.cmm +++ b/rts/StgStartup.cmm @@ -67,11 +67,19 @@ INFO_TABLE_RET(stg_stop_thread, STOP_FRAME, debuggers to find their way back to the C stack. This is a bit fiddly as we assume the layout of the stack prepared - for us by StgRun. + for us by StgRun. Note that in most cases StgRun is written in assembler + and therefore has no associated unwind information. For this reason we + need to identify the platform stack pointer and return address values for + the StgRun's caller. */ #ifdef x86_64_HOST_ARCH - unwind MachSp = MachSp + RESERVED_C_STACK_BYTES + 0x38 + 8, - UnwindReturnReg = W_[MachSp + RESERVED_C_STACK_BYTES + 0x38]; + // offset of 8 in MachSp value due to return address + unwind MachSp = MachSp + RESERVED_C_STACK_BYTES + STG_RUN_STACK_FRAME_SIZE + 8, + UnwindReturnReg = W_[MachSp + RESERVED_C_STACK_BYTES + STG_RUN_STACK_FRAME_SIZE]; +#else + // FIXME: Fill in for other platforms + unwind MachSp = return, + UnwindReturnReg = return; #endif Sp = Sp + SIZEOF_StgStopFrame - WDS(2); From git at git.haskell.org Wed Feb 8 15:26:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Feb 2017 15:26:30 +0000 (UTC) Subject: [commit: ghc] master: CmmLayoutStack: Correctly annotate Sp adjustments with unwinding information (5279b08) Message-ID: <20170208152630.A54233A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5279b08ba3f01e4b7e28d12b2751413d789d9fbe/ghc >--------------------------------------------------------------- commit 5279b08ba3f01e4b7e28d12b2751413d789d9fbe Author: Ben Gamari Date: Tue Feb 7 22:58:48 2017 -0500 CmmLayoutStack: Correctly annotate Sp adjustments with unwinding information Test Plan: Validate Reviewers: austin, simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3104 >--------------------------------------------------------------- 5279b08ba3f01e4b7e28d12b2751413d789d9fbe compiler/cmm/CmmLayoutStack.hs | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/compiler/cmm/CmmLayoutStack.hs b/compiler/cmm/CmmLayoutStack.hs index f59daad..9051845 100644 --- a/compiler/cmm/CmmLayoutStack.hs +++ b/compiler/cmm/CmmLayoutStack.hs @@ -802,18 +802,29 @@ manifestSp dflags stackmaps stack0 sp0 sp_high adj_pre_sp = mapExpDeep (areaToSp dflags sp0 sp_high area_off) adj_post_sp = mapExpDeep (areaToSp dflags (sp0 - sp_off) sp_high area_off) - -- Add unwind pseudo-instructions at the beginning of each block to + -- Add unwind pseudo-instruction at the beginning of each block to -- document Sp level for debugging - add_unwind_info block + add_initial_unwind block | debugLevel dflags > 0 - = CmmUnwind [(Sp, Just sp_unwind)] : block + = CmmUnwind [(Sp, Just sp_unwind)] `blockCons` block | otherwise = block - sp_unwind = CmmRegOff (CmmGlobal Sp) (sp0 - wORD_SIZE dflags) + where sp_unwind = CmmRegOff spReg (sp0 - wORD_SIZE dflags) + + -- Add unwind pseudo-instruction right before the Sp adjustment + -- if there is one. + add_adj_unwind block + | debugLevel dflags > 0 + , sp_off /= 0 + = block `blockSnoc` CmmUnwind [(Sp, Just sp_unwind)] + | otherwise + = block + where sp_unwind = CmmRegOff spReg (sp0 - wORD_SIZE dflags - sp_off) final_middle = maybeAddSpAdj dflags sp_off + . add_adj_unwind + . add_initial_unwind . blockFromList - . add_unwind_info . map adj_pre_sp . elimStackStores stack0 stackmaps area_off $ middle_pre From git at git.haskell.org Wed Feb 8 17:09:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Feb 2017 17:09:39 +0000 (UTC) Subject: [commit: ghc] master: Back-pedal the fix for Trac #8155 (a94b484) Message-ID: <20170208170939.E449B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a94b484715d3caf445a7069377d5311e0e50f66e/ghc >--------------------------------------------------------------- commit a94b484715d3caf445a7069377d5311e0e50f66e Author: Simon Peyton Jones Date: Wed Feb 8 16:15:11 2017 +0000 Back-pedal the fix for Trac #8155 I implemented a rather elaborate fix for #8155 ages ago, which which turns out to be a) unnecesssary in this particular case b) harmful to the defaulting story; see comment:15 of #12923. So this patch reverts the elaborate bit. The bit I removed is described in "Historical note" under Note [approximateWC]. >--------------------------------------------------------------- a94b484715d3caf445a7069377d5311e0e50f66e compiler/typecheck/TcSimplify.hs | 55 +++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/compiler/typecheck/TcSimplify.hs b/compiler/typecheck/TcSimplify.hs index c30398d..d13f9e5 100644 --- a/compiler/typecheck/TcSimplify.hs +++ b/compiler/typecheck/TcSimplify.hs @@ -1638,18 +1638,9 @@ approximateWC float_past_equalities wc float_wc :: TcTyCoVarSet -> WantedConstraints -> Cts float_wc trapping_tvs (WC { wc_simple = simples, wc_impl = implics }) = filterBag is_floatable simples `unionBags` - do_bag (float_implic new_trapping_tvs) implics + do_bag (float_implic trapping_tvs) implics where - is_floatable ct = tyCoVarsOfCt ct `disjointVarSet` new_trapping_tvs - new_trapping_tvs = transCloVarSet grow trapping_tvs - - grow :: VarSet -> VarSet -- Maps current trapped tyvars to newly-trapped ones - grow so_far = foldrBag (grow_one so_far) emptyVarSet simples - grow_one so_far ct tvs - | ct_tvs `intersectsVarSet` so_far = tvs `unionVarSet` ct_tvs - | otherwise = tvs - where - ct_tvs = tyCoVarsOfCt ct + is_floatable ct = tyCoVarsOfCt ct `disjointVarSet` trapping_tvs float_implic :: TcTyCoVarSet -> Implication -> Cts float_implic trapping_tvs imp @@ -1673,7 +1664,7 @@ out from inside, if they are not captured by skolems. The same function is used when doing type-class defaulting (see the call to applyDefaultingRules) to extract constraints that that might be defaulted. -There are two caveats: +There is one caveat: 1. When infering most-general types (in simplifyInfer), we do *not* float anything out if the implication binds equality constraints, @@ -1696,20 +1687,32 @@ There are two caveats: the most-general type; and we /do/ want to float out of equalities. Hence the boolean flag to approximateWC. -2. We do not float out an inner constraint that shares a type variable - (transitively) with one that is trapped by a skolem. Eg - forall a. F a ~ beta, Integral beta - We don't want to float out (Integral beta). Doing so would be bad - when defaulting, because then we'll default beta:=Integer, and that - makes the error message much worse; we'd get - Can't solve F a ~ Integer - rather than - Can't solve Integral (F a) - - Moreover, floating out these "contaminated" constraints doesn't help - when generalising either. If we generalise over (Integral b), we still - can't solve the retained implication (forall a. F a ~ b). Indeed, - arguably that too would be a harder error to understand. +------ Historical note ----------- +There used to be a second caveat, driven by Trac #8155 + + 2. We do not float out an inner constraint that shares a type variable + (transitively) with one that is trapped by a skolem. Eg + forall a. F a ~ beta, Integral beta + We don't want to float out (Integral beta). Doing so would be bad + when defaulting, because then we'll default beta:=Integer, and that + makes the error message much worse; we'd get + Can't solve F a ~ Integer + rather than + Can't solve Integral (F a) + + Moreover, floating out these "contaminated" constraints doesn't help + when generalising either. If we generalise over (Integral b), we still + can't solve the retained implication (forall a. F a ~ b). Indeed, + arguably that too would be a harder error to understand. + +But this transitive closure stuff gives rise to a complex rule for +when defaulting actually happens, and one that was never documented. +Moreover (Trac #12923), the more complex rule is sometimes NOT what +you want. So I simply removed the extra code to implement the +contamination stuff. There was zero effect on the testsuite (not even +#8155). +------ End of historical note ----------- + Note [DefaultTyVar] ~~~~~~~~~~~~~~~~~~~ From git at git.haskell.org Wed Feb 8 17:09:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Feb 2017 17:09:42 +0000 (UTC) Subject: [commit: ghc] master: Add some commented-out tracing in SpecConstr (9f3c1e6) Message-ID: <20170208170942.A0F703A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9f3c1e67e5731124e499a420df52397b652876c8/ghc >--------------------------------------------------------------- commit 9f3c1e67e5731124e499a420df52397b652876c8 Author: Simon Peyton Jones Date: Wed Feb 8 16:12:11 2017 +0000 Add some commented-out tracing in SpecConstr >--------------------------------------------------------------- 9f3c1e67e5731124e499a420df52397b652876c8 compiler/specialise/SpecConstr.hs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/compiler/specialise/SpecConstr.hs b/compiler/specialise/SpecConstr.hs index f6e10ad..15c031b 100644 --- a/compiler/specialise/SpecConstr.hs +++ b/compiler/specialise/SpecConstr.hs @@ -1509,7 +1509,7 @@ specialise env bind_calls (RI { ri_fn = fn, ri_lam_bndrs = arg_bndrs Nothing -> return (nullUsage, spec_info) | Just all_calls <- lookupVarEnv bind_calls fn - = -- pprTrace "specialise entry {" (ppr fn <+> ppr (length all_calls)) $ + = -- pprTrace "specialise entry {" (ppr fn <+> ppr all_calls) $ do { (boring_call, all_pats) <- callsToPats env specs arg_occs all_calls -- Bale out if too many specialisations ; let pats = filter (is_small_enough . fst) all_pats @@ -1565,8 +1565,9 @@ specialise env bind_calls (RI { ri_fn = fn, ri_lam_bndrs = arg_bndrs Just rhs_usg | boring_call -> (spec_usg `combineUsage` rhs_usg, Nothing) _ -> (spec_usg, mb_unspec) --- ; pprTrace "specialise return }" (ppr fn --- <+> ppr (scu_calls new_usg)) +-- ; pprTrace "specialise return }" (vcat [ ppr fn +-- , text "boring_call:" <+> ppr boring_call +-- , text "new calls:" <+> ppr (scu_calls new_usg)]) $ ; return (new_usg, SI (new_specs ++ specs) spec_count' mb_unspec') } } @@ -1815,8 +1816,11 @@ callsToPats env done_specs bndr_occs calls is_done p = any (samePat p) done_pats no_recursive = map fst (filterOut (is_too_recursive env) good_pats) - ; return (any isNothing mb_pats, - filterOut is_done (nubBy samePat no_recursive)) } +-- ; pprTrace "callsToPats" (vcat [ text "calls:" <+> ppr calls +-- , text "good_pats:" <+> ppr good_pats +-- , text "no_recursive:" <+> ppr no_recursive ]) $ + ; return (any isNothing mb_pats, + filterOut is_done (nubBy samePat no_recursive)) } is_too_recursive :: ScEnv -> (CallPat, ValueEnv) -> Bool -- Count the number of recursive constructors in a call pattern, From git at git.haskell.org Wed Feb 8 17:09:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Feb 2017 17:09:45 +0000 (UTC) Subject: [commit: ghc] master: Kill inaccessible-branch complaints in record update (3cfef76) Message-ID: <20170208170945.DB7F63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3cfef763ab6ccd23f72604e5ee2f027a4b6ce043/ghc >--------------------------------------------------------------- commit 3cfef763ab6ccd23f72604e5ee2f027a4b6ce043 Author: Simon Peyton Jones Date: Wed Feb 8 16:12:36 2017 +0000 Kill inaccessible-branch complaints in record update Trac #12957 (the original case in the Description) showed a record update that yielded an "inaccessible code" warning. This should not happen; it's just some redundant code generated by the desugarer (later pruned away) and it's not the user's fault. This patch suppresses the warning. See Check.hs Note [Inaccessible warnings for record updates] >--------------------------------------------------------------- 3cfef763ab6ccd23f72604e5ee2f027a4b6ce043 compiler/deSugar/Check.hs | 28 +++++++++++++++++++++-- testsuite/tests/pmcheck/should_compile/T12957a.hs | 25 ++++++++++++++++++++ testsuite/tests/pmcheck/should_compile/all.T | 1 + 3 files changed, 52 insertions(+), 2 deletions(-) diff --git a/compiler/deSugar/Check.hs b/compiler/deSugar/Check.hs index 3bf52ce..4a8a18d 100644 --- a/compiler/deSugar/Check.hs +++ b/compiler/deSugar/Check.hs @@ -51,7 +51,6 @@ import Control.Monad (forM, when, forM_) import Coercion import TcEvidence import IOEnv -import Data.Monoid ( Monoid(mappend) ) import ListT (ListT(..), fold, select) @@ -1606,7 +1605,7 @@ dsPmWarn :: DynFlags -> DsMatchContext -> PmResult -> DsM () dsPmWarn dflags ctx@(DsMatchContext kind loc) pm_result = when (flag_i || flag_u) $ do let exists_r = flag_i && notNull redundant && onlyBuiltin - exists_i = flag_i && notNull inaccessible && onlyBuiltin + exists_i = flag_i && notNull inaccessible && onlyBuiltin && not is_rec_upd exists_u = flag_u && (case uncovered of TypeOfUncovered _ -> True UncoveredPatterns u -> notNull u) @@ -1632,6 +1631,9 @@ dsPmWarn dflags ctx@(DsMatchContext kind loc) pm_result flag_u = exhaustive dflags kind flag_u_reason = maybe NoReason Reason (exhaustiveWarningFlag kind) + is_rec_upd = case kind of { RecUpd -> True; _ -> False } + -- See Note [Inaccessible warnings for record updates] + onlyBuiltin = prov == FromBuiltin maxPatterns = maxUncoveredPatterns dflags @@ -1654,6 +1656,28 @@ dsPmWarn dflags ctx@(DsMatchContext kind loc) pm_result warnEmptyCase ty = pp_context False ctx (text "are non-exhaustive") $ \_ -> hang (text "Patterns not matched:") 4 (underscore <+> dcolon <+> ppr ty) +{- Note [Inaccessible warnings for record updates] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Consider (Trac #12957) + data T a where + T1 :: { x :: Int } -> T Bool + T2 :: { x :: Int } -> T a + T3 :: T a + + f :: T Char -> T a + f r = r { x = 3 } + +The desugarer will (conservatively generate a case for T1 even though +it's impossible: + f r = case r of + T1 x -> T1 3 -- Inaccessible branch + T2 x -> T2 3 + _ -> error "Missing" + +We don't want to warn about the inaccessible branch because the programmer +didn't put it there! So we filter out the warning here. +-} + -- | Issue a warning when the predefined number of iterations is exceeded -- for the pattern match checker warnPmIters :: DynFlags -> DsMatchContext -> DsM () diff --git a/testsuite/tests/pmcheck/should_compile/T12957a.hs b/testsuite/tests/pmcheck/should_compile/T12957a.hs new file mode 100644 index 0000000..72330e9 --- /dev/null +++ b/testsuite/tests/pmcheck/should_compile/T12957a.hs @@ -0,0 +1,25 @@ +{-# LANGUAGE RecordWildCards #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE KindSignatures #-} + +-- The original test case for Trac #12957 + +module T12957a where + +data T = A | B + +data Fields (t :: T) where + BFields :: { list :: [()] } -> Fields 'B + + AFields :: Fields 'A + + EmptyFields :: Fields t + +emptyA :: Fields 'A +emptyA = AFields + +data S t = S { sFields :: Fields t } + +f :: () -> S 'A +f a = (S EmptyFields) { sFields = emptyA { list = [ a ] } } diff --git a/testsuite/tests/pmcheck/should_compile/all.T b/testsuite/tests/pmcheck/should_compile/all.T index 7fc4fc5..8745358 100644 --- a/testsuite/tests/pmcheck/should_compile/all.T +++ b/testsuite/tests/pmcheck/should_compile/all.T @@ -60,6 +60,7 @@ test('pmc007', [], compile, test('T11245', [], compile, ['-fwarn-incomplete-patterns -fwarn-overlapping-patterns']) test('T12957', [], compile, ['-fwarn-overlapping-patterns']) +test('T12957a', [], compile, ['-fwarn-overlapping-patterns']) # EmptyCase test('T10746', [], compile, From git at git.haskell.org Wed Feb 8 18:48:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Feb 2017 18:48:07 +0000 (UTC) Subject: [commit: ghc] master: Add dump flags for the renamed and typechecked hsSyn ASTs (7e4e6a7) Message-ID: <20170208184807.ADE243A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7e4e6a7309b2eb74933f95f18d83e74dbf166a7e/ghc >--------------------------------------------------------------- commit 7e4e6a7309b2eb74933f95f18d83e74dbf166a7e Author: Alan Zimmerman Date: Wed Feb 8 13:20:02 2017 +0200 Add dump flags for the renamed and typechecked hsSyn ASTs Summary: D2958 brought in the "dump-parsed-ast" functionality. Extend it to include "dump-rn-ast" and "dump-tc-ast" Test Plan: ./validate Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3107 >--------------------------------------------------------------- 7e4e6a7309b2eb74933f95f18d83e74dbf166a7e compiler/main/DynFlags.hs | 6 + compiler/typecheck/TcRnDriver.hs | 18 +- docs/users_guide/debugging.rst | 8 + .../tests/parser/should_compile/DumpParsedAst.hs | 4 +- .../parser/should_compile/DumpParsedAst.stderr | 175 +++++------------- .../{T10188.hs => DumpRenamedAst.hs} | 6 +- .../parser/should_compile/DumpRenamedAst.stderr | 190 ++++++++++++++++++++ .../{T10188.hs => DumpTypecheckedAst.hs} | 6 +- .../should_compile/DumpTypecheckedAst.stderr | 195 +++++++++++++++++++++ testsuite/tests/parser/should_compile/all.T | 4 +- 10 files changed, 460 insertions(+), 152 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 7e4e6a7309b2eb74933f95f18d83e74dbf166a7e From git at git.haskell.org Wed Feb 8 19:29:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Feb 2017 19:29:44 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: users-guide/8.0.2-notes: Fix reference to wrong ticket (c873012) Message-ID: <20170208192944.517303A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/c873012bdc1f349cbee75cf514c0d3403d21a5bc/ghc >--------------------------------------------------------------- commit c873012bdc1f349cbee75cf514c0d3403d21a5bc Author: Ben Gamari Date: Wed Feb 8 14:29:01 2017 -0500 users-guide/8.0.2-notes: Fix reference to wrong ticket >--------------------------------------------------------------- c873012bdc1f349cbee75cf514c0d3403d21a5bc docs/users_guide/8.0.2-notes.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/users_guide/8.0.2-notes.rst b/docs/users_guide/8.0.2-notes.rst index 237c3b9..f975b16 100644 --- a/docs/users_guide/8.0.2-notes.rst +++ b/docs/users_guide/8.0.2-notes.rst @@ -126,7 +126,7 @@ Compiler programs has been fixed (see :ghc-ticket:`12757`). - GHC now supports systems whose C compiler produces position-independent - executables by default. (see :ghc-ticket:`12579`). + executables by default. (see :ghc-ticket:`12755`). - GHC can now be built on systems which use the ``gold`` linker by default (see :ghc-ticket:`12816`). From git at git.haskell.org Wed Feb 8 19:38:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Feb 2017 19:38:44 +0000 (UTC) Subject: [commit: ghc] wip/travis: Travis experiment: Try “quickest” build flavor (8c4c084) Message-ID: <20170208193844.46BF33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/travis Link : http://ghc.haskell.org/trac/ghc/changeset/8c4c084f858c3a6f2a7c5e77f78e0567305d49a7/ghc >--------------------------------------------------------------- commit 8c4c084f858c3a6f2a7c5e77f78e0567305d49a7 Author: Joachim Breitner Date: Wed Feb 8 14:38:35 2017 -0500 Travis experiment: Try “quickest” build flavor >--------------------------------------------------------------- 8c4c084f858c3a6f2a7c5e77f78e0567305d49a7 .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index 64a72b5..64957f5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,6 +44,11 @@ before_install: - git submodule --quiet update --recursive # Now we can be quiet again. script: + # try "quickest" flavor + - echo 'SRC_HC_OPTS = -O0 -H64m' >> mk/validate.mk + - echo 'GhcStage1HcOpts = -O' >> mk/validate.mk + - echo 'GhcStage2HcOpts = -O0' >> mk/validate.mk + - echo 'GhcLibHcOpts = -O0' >> mk/validate.mk # do not build docs - echo 'HADDOCK_DOCS = NO' >> mk/validate.mk - echo 'BUILD_SPHINX_HTML = NO' >> mk/validate.mk From git at git.haskell.org Wed Feb 8 21:24:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Feb 2017 21:24:11 +0000 (UTC) Subject: [commit: ghc] wip/orf-2017: Remove IsLabel instance for (->) (533ee26) Message-ID: <20170208212411.5B8BE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/orf-2017 Link : http://ghc.haskell.org/trac/ghc/changeset/533ee260026abe2d2fda687282023bc1594ee494/ghc >--------------------------------------------------------------- commit 533ee260026abe2d2fda687282023bc1594ee494 Author: Adam Gundry Date: Wed Feb 8 20:56:19 2017 +0000 Remove IsLabel instance for (->) >--------------------------------------------------------------- 533ee260026abe2d2fda687282023bc1594ee494 libraries/base/GHC/OverloadedLabels.hs | 6 ------ .../should_fail/overloadedlabelsfail01.stderr | 10 ++-------- testsuite/tests/overloadedrecflds/should_run/hasfieldrun02.hs | 6 ++++++ .../overloadedrecflds/should_run/overloadedrecfldsrun07.hs | 7 +++++-- 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/libraries/base/GHC/OverloadedLabels.hs b/libraries/base/GHC/OverloadedLabels.hs index 670ce7c..7e27cf6 100644 --- a/libraries/base/GHC/OverloadedLabels.hs +++ b/libraries/base/GHC/OverloadedLabels.hs @@ -49,12 +49,6 @@ module GHC.OverloadedLabels ) where import GHC.Base ( Symbol ) -import GHC.Records class IsLabel (x :: Symbol) a where fromLabel :: a - --- | If an overloaded label is used at function type, it will be --- treated as an overloaded record field selector using 'HasField'. -instance HasField x r a => IsLabel x (r -> a) where - fromLabel = getField @x diff --git a/testsuite/tests/overloadedrecflds/should_fail/overloadedlabelsfail01.stderr b/testsuite/tests/overloadedrecflds/should_fail/overloadedlabelsfail01.stderr index 6709008..4cd5231 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/overloadedlabelsfail01.stderr +++ b/testsuite/tests/overloadedrecflds/should_fail/overloadedlabelsfail01.stderr @@ -1,13 +1,7 @@ overloadedlabelsfail01.hs:6:5: error: - • Ambiguous type variable ‘t0’ arising from the overloaded label ‘#x’ - prevents the constraint ‘(IsLabel "x" t0)’ from being solved. - Relevant bindings include - a :: t0 (bound at overloadedlabelsfail01.hs:6:1) - Probable fix: use a type annotation to specify what ‘t0’ should be. - These potential instance exist: - instance GHC.Records.HasField x r a => IsLabel x (r -> a) - -- Defined in ‘GHC.OverloadedLabels’ + • No instance for (IsLabel "x" t0) + arising from the overloaded label ‘#x’ • In the expression: #x In an equation for ‘a’: a = #x diff --git a/testsuite/tests/overloadedrecflds/should_run/hasfieldrun02.hs b/testsuite/tests/overloadedrecflds/should_run/hasfieldrun02.hs index 4ea86c2..5bfddbb 100644 --- a/testsuite/tests/overloadedrecflds/should_run/hasfieldrun02.hs +++ b/testsuite/tests/overloadedrecflds/should_run/hasfieldrun02.hs @@ -3,8 +3,14 @@ FlexibleInstances, MultiParamTypeClasses, ScopedTypeVariables, TypeApplications #-} +import GHC.OverloadedLabels +import GHC.Records + data S = MkS { foo :: Int } data T x y z = forall b . MkT { foo :: y, bar :: b } +instance HasField x r a => IsLabel x (r -> a) where + fromLabel = getField @x + main = do print (#foo (MkS 42)) print (#foo (MkT True False)) diff --git a/testsuite/tests/overloadedrecflds/should_run/overloadedrecfldsrun07.hs b/testsuite/tests/overloadedrecflds/should_run/overloadedrecfldsrun07.hs index 5e9a8af..25da616 100644 --- a/testsuite/tests/overloadedrecflds/should_run/overloadedrecfldsrun07.hs +++ b/testsuite/tests/overloadedrecflds/should_run/overloadedrecfldsrun07.hs @@ -11,7 +11,7 @@ , UndecidableInstances #-} -import qualified GHC.OverloadedLabels as OL +import GHC.OverloadedLabels import GHC.Records import GHC.TypeLits @@ -29,9 +29,12 @@ instance {-# OVERLAPS #-} a ~ b => HasField foo (Rec ('(foo, a) ': xs)) b where instance HasField foo (Rec xs) b => HasField foo (Rec ('(bar, a) ': xs)) b where getField (_ :> vs) = getField @foo vs -instance y ~ x => OL.IsLabel y (Label x) where +instance y ~ x => IsLabel y (Label x) where fromLabel = Label +instance HasField x r a => IsLabel x (r -> a) where + fromLabel = getField @x + x :: Rec '[ '("foo", Int), '("bar", Bool)] x = #foo := 42 :> #bar := True :> Nil From git at git.haskell.org Wed Feb 8 21:24:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Feb 2017 21:24:16 +0000 (UTC) Subject: [commit: ghc] wip/orf-2017: Use OccSet instead of [FastString] in rnHsRecFields.rn_dotdot (2833f0e) Message-ID: <20170208212416.B29A73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/orf-2017 Link : http://ghc.haskell.org/trac/ghc/changeset/2833f0eae725e85bc180be151798f637bb5251c7/ghc >--------------------------------------------------------------- commit 2833f0eae725e85bc180be151798f637bb5251c7 Author: Adam Gundry Date: Wed Feb 8 21:22:54 2017 +0000 Use OccSet instead of [FastString] in rnHsRecFields.rn_dotdot >--------------------------------------------------------------- 2833f0eae725e85bc180be151798f637bb5251c7 compiler/rename/RnPat.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/rename/RnPat.hs b/compiler/rename/RnPat.hs index 84dcc69..c18138b 100644 --- a/compiler/rename/RnPat.hs +++ b/compiler/rename/RnPat.hs @@ -618,20 +618,20 @@ rnHsRecFields ctxt mk_arg (HsRecFields { rec_flds = flds, rec_dotdot = dotdot }) ; (rdr_env, lcl_env) <- getRdrEnvs ; con_fields <- lookupConstructorFields con ; when (null con_fields) (addErr (badDotDotCon con)) - ; let present_flds = map (occNameFS . rdrNameOcc) $ getFieldLbls flds + ; let present_flds = mkOccSet $ map rdrNameOcc (getFieldLbls flds) -- For constructor uses (but not patterns) -- the arg should be in scope locally; -- i.e. not top level or imported -- Eg. data R = R { x,y :: Int } -- f x = R { .. } -- Should expand to R {x=x}, not R{x=x,y=y} - arg_in_scope lbl = mkVarUnqual lbl `elemLocalRdrEnv` lcl_env + arg_in_scope lbl = mkRdrUnqual lbl `elemLocalRdrEnv` lcl_env (dot_dot_fields, dot_dot_gres) = unzip [ (fl, gre) | fl <- con_fields - , let lbl = flLabel fl - , not (lbl `elem` present_flds) + , let lbl = mkVarOccFS (flLabel fl) + , not (lbl `elemOccSet` present_flds) , Just gre <- [lookupGRE_FieldLabel rdr_env fl] -- Check selector is in scope , case ctxt of From git at git.haskell.org Wed Feb 8 21:24:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 8 Feb 2017 21:24:14 +0000 (UTC) Subject: [commit: ghc] wip/orf-2017: Comments only (bdd3158) Message-ID: <20170208212414.0D1F93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/orf-2017 Link : http://ghc.haskell.org/trac/ghc/changeset/bdd315839d1b906718d7bc7255fab3cbf0f702e2/ghc >--------------------------------------------------------------- commit bdd315839d1b906718d7bc7255fab3cbf0f702e2 Author: Adam Gundry Date: Wed Feb 8 21:22:10 2017 +0000 Comments only >--------------------------------------------------------------- bdd315839d1b906718d7bc7255fab3cbf0f702e2 compiler/basicTypes/RdrName.hs | 11 ++++++----- compiler/hsSyn/HsExpr.hs | 2 ++ compiler/typecheck/TcSMonad.hs | 6 ++++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/compiler/basicTypes/RdrName.hs b/compiler/basicTypes/RdrName.hs index 69dd020..d70724b 100644 --- a/compiler/basicTypes/RdrName.hs +++ b/compiler/basicTypes/RdrName.hs @@ -800,15 +800,16 @@ lookupGRE_Name env name = lookupGRE_Name_OccName env name (nameOccName name) lookupGRE_FieldLabel :: GlobalRdrEnv -> FieldLabel -> Maybe GlobalRdrElt --- ^ Look for a particular record field selector in the environment, --- where the selector name and field label may be different: the --- GlobalRdrEnv is keyed on the label. +-- ^ Look for a particular record field selector in the environment, where the +-- selector name and field label may be different: the GlobalRdrEnv is keyed on +-- the label. See Note [Parents for record fields] for why this happens. lookupGRE_FieldLabel env fl = lookupGRE_Name_OccName env (flSelector fl) (mkVarOccFS (flLabel fl)) lookupGRE_Name_OccName :: GlobalRdrEnv -> Name -> OccName -> Maybe GlobalRdrElt --- ^ Look for precisely this 'Name' in the environment, but with an --- 'OccName' that might differ from that of the 'Name'. +-- ^ Look for precisely this 'Name' in the environment, but with an 'OccName' +-- that might differ from that of the 'Name'. See 'lookupGRE_FieldLabel' and +-- Note [Parents for record fields]. lookupGRE_Name_OccName env name occ = case [ gre | gre <- lookupGlobalRdrEnv env occ , gre_name gre == name ] of diff --git a/compiler/hsSyn/HsExpr.hs b/compiler/hsSyn/HsExpr.hs index 23a960e..4a37998 100644 --- a/compiler/hsSyn/HsExpr.hs +++ b/compiler/hsSyn/HsExpr.hs @@ -295,6 +295,8 @@ data HsExpr id | HsOverLabel (Maybe id) FastString -- ^ Overloaded label (Note [Overloaded labels] in GHC.OverloadedLabels) + -- @Just id@ means @RebindableSyntax@ is in use, and gives the id of the + -- in-scope 'fromLabel'. -- NB: Not in use after typechecking | HsIPVar HsIPName -- ^ Implicit parameter (not in use after typechecking) diff --git a/compiler/typecheck/TcSMonad.hs b/compiler/typecheck/TcSMonad.hs index 5142baf..b76b2d3 100644 --- a/compiler/typecheck/TcSMonad.hs +++ b/compiler/typecheck/TcSMonad.hs @@ -2816,8 +2816,10 @@ instFlexiHelper subst tv ; return (extendTvSubst subst tv ty') } tcInstType :: ([TyVar] -> TcM (TCvSubst, [TcTyVar])) - -> Id - -> TcS ([(Name, TcTyVar)], TcThetaType, TcType) + -- ^ How to instantiate the type variables + -> Id -- ^ Type to instantiate + -> TcS ([(Name, TcTyVar)], TcThetaType, TcType) -- ^ Result + -- (type vars, preds (incl equalities), rho) tcInstType inst_tyvars id = wrapTcS (TcM.tcInstType inst_tyvars id) From git at git.haskell.org Thu Feb 9 02:21:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Feb 2017 02:21:11 +0000 (UTC) Subject: [commit: packages/array] master: Add diagnostics to overflow errors (b8a6d31) Message-ID: <20170209022111.7232C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/array On branch : master Link : http://git.haskell.org/packages/array.git/commitdiff/b8a6d313a9f20b756fc90845fdd530927686257d >--------------------------------------------------------------- commit b8a6d313a9f20b756fc90845fdd530927686257d Author: Oleg Grenrus Date: Tue Feb 7 13:17:03 2017 +0200 Add diagnostics to overflow errors >--------------------------------------------------------------- b8a6d313a9f20b756fc90845fdd530927686257d Data/Array/Base.hs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Data/Array/Base.hs b/Data/Array/Base.hs index 43963eb..3bf861f 100644 --- a/Data/Array/Base.hs +++ b/Data/Array/Base.hs @@ -1354,13 +1354,15 @@ bOOL_SCALE, bOOL_WORD_SCALE, wORD_SCALE, dOUBLE_SCALE, fLOAT_SCALE :: Int# -> Int# bOOL_SCALE n# | isTrue# (res# ># n#) = res# - | otherwise = error "Data.Array.Base.bOOL_SCALE: Overflow" + | otherwise = error $ "Data.Array.Base.bOOL_SCALE: Overflow; n: " + ++ show (I# n#) ++ ", res: " ++ show (I# n#) where !(I# last#) = SIZEOF_HSWORD * 8 - 1 !res# = (n# +# last#) `uncheckedIShiftRA#` 3# bOOL_WORD_SCALE n# | isTrue# (res# ># n#) = res# - | otherwise = error "Data.Array.Base.bOOL_WORD_SCALE: Overflow" + | otherwise = error $ "Data.Array.Base.bOOL_WORD_SCALE: Overflow; n: " + ++ show (I# n#) ++ ", res: " ++ show (I# n#) where !(I# last#) = SIZEOF_HSWORD * 8 - 1 !res# = bOOL_INDEX (n# +# last#) @@ -1371,7 +1373,8 @@ fLOAT_SCALE n# = safe_scale scale# n# where !(I# scale#) = SIZEOF_HSFLOAT safe_scale :: Int# -> Int# -> Int# safe_scale scale# n# | not overflow = res# - | otherwise = error "Data.Array.Base.safe_scale: Overflow" + | otherwise = error $ "Data.Array.Base.safe_scale: Overflow; scale: " + ++ show (I# scale#) ++ ", n: " ++ show (I# n#) where !res# = scale# *# n# !overflow = isTrue# (maxN# `divInt#` scale# <# n#) From git at git.haskell.org Thu Feb 9 02:21:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Feb 2017 02:21:13 +0000 (UTC) Subject: [commit: packages/array] master: Fix and simplify handling of Bool arrays (7adaf40) Message-ID: <20170209022113.771A63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/array On branch : master Link : http://git.haskell.org/packages/array.git/commitdiff/7adaf408cf24e420083f88ecd5b8d7bd7d0e5512 >--------------------------------------------------------------- commit 7adaf408cf24e420083f88ecd5b8d7bd7d0e5512 Author: Ben Gamari Date: Tue Feb 7 21:32:29 2017 -0500 Fix and simplify handling of Bool arrays No overflow check is necessary in the case of Bool arrays since the array size is actually smaller than the number of elements it contains. Moreover, we can use setByteArray# to initialize the array. >--------------------------------------------------------------- 7adaf408cf24e420083f88ecd5b8d7bd7d0e5512 Data/Array/Base.hs | 41 +++++++++++------------------------------ 1 file changed, 11 insertions(+), 30 deletions(-) diff --git a/Data/Array/Base.hs b/Data/Array/Base.hs index 3bf861f..36db53f 100644 --- a/Data/Array/Base.hs +++ b/Data/Array/Base.hs @@ -1023,21 +1023,13 @@ instance MArray (STUArray s) Bool (ST s) where getNumElements (STUArray _ _ n _) = return n {-# INLINE newArray #-} newArray (l,u) initialValue = ST $ \s1# -> - case safeRangeSize (l,u) of { n@(I# n#) -> - case newByteArray# (bOOL_SCALE n#) s1# of { (# s2#, marr# #) -> - case bOOL_WORD_SCALE n# of { n'# -> -#if __GLASGOW_HASKELL__ > 706 - let loop i# s3# | isTrue# (i# ==# n'#) = s3# -#else - let loop i# s3# | i# ==# n'# = s3# -#endif - | otherwise = - case writeWordArray# marr# i# e# s3# of { s4# -> - loop (i# +# 1#) s4# } in - case loop 0# s2# of { s3# -> + case safeRangeSize (l,u) of { n@(I# n#) -> + case bOOL_SCALE n# of { nbytes# -> + case newByteArray# nbytes# s1# of { (# s2#, marr# #) -> + case setByteArray# marr# 0# nbytes# e# s2# of { s3# -> (# s3#, STUArray l u n marr# #) }}}} where - !(W# e#) = if initialValue then maxBound else 0 + !(I# e#) = if initialValue then 0xff else 0x0 {-# INLINE unsafeNewArray_ #-} unsafeNewArray_ (l,u) = unsafeNewArraySTUArray_ (l,u) bOOL_SCALE {-# INLINE newArray_ #-} @@ -1350,22 +1342,10 @@ instance MArray (STUArray s) Word64 (ST s) where ----------------------------------------------------------------------------- -- Translation between elements and bytes -bOOL_SCALE, bOOL_WORD_SCALE, - wORD_SCALE, dOUBLE_SCALE, fLOAT_SCALE :: Int# -> Int# -bOOL_SCALE n# - | isTrue# (res# ># n#) = res# - | otherwise = error $ "Data.Array.Base.bOOL_SCALE: Overflow; n: " - ++ show (I# n#) ++ ", res: " ++ show (I# n#) - where - !(I# last#) = SIZEOF_HSWORD * 8 - 1 - !res# = (n# +# last#) `uncheckedIShiftRA#` 3# -bOOL_WORD_SCALE n# - | isTrue# (res# ># n#) = res# - | otherwise = error $ "Data.Array.Base.bOOL_WORD_SCALE: Overflow; n: " - ++ show (I# n#) ++ ", res: " ++ show (I# n#) - where - !(I# last#) = SIZEOF_HSWORD * 8 - 1 - !res# = bOOL_INDEX (n# +# last#) +bOOL_SCALE, wORD_SCALE, dOUBLE_SCALE, fLOAT_SCALE :: Int# -> Int# +bOOL_SCALE n# = + -- + 7 to handle case where n is not divisible by 8 + (n# +# 7#) `uncheckedIShiftRA#` 3# wORD_SCALE n# = safe_scale scale# n# where !(I# scale#) = SIZEOF_HSWORD dOUBLE_SCALE n# = safe_scale scale# n# where !(I# scale#) = SIZEOF_HSDOUBLE fLOAT_SCALE n# = safe_scale scale# n# where !(I# scale#) = SIZEOF_HSFLOAT @@ -1379,8 +1359,9 @@ safe_scale scale# n# !res# = scale# *# n# !overflow = isTrue# (maxN# `divInt#` scale# <# n#) !(I# maxN#) = maxBound +{-# INLINE safe_scale #-} - +-- | The index of the word which the given @Bool@ array elements falls within. bOOL_INDEX :: Int# -> Int# #if SIZEOF_HSWORD == 4 bOOL_INDEX i# = i# `uncheckedIShiftRA#` 5# From git at git.haskell.org Thu Feb 9 02:23:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Feb 2017 02:23:39 +0000 (UTC) Subject: [commit: packages/array] master: Update test output for T229 (329b2cd) Message-ID: <20170209022339.A929B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/array On branch : master Link : http://git.haskell.org/packages/array.git/commitdiff/329b2cdb6452e5cfa47ad662d38b706fb9a50e7f >--------------------------------------------------------------- commit 329b2cdb6452e5cfa47ad662d38b706fb9a50e7f Author: Ben Gamari Date: Wed Feb 8 21:22:23 2017 -0500 Update test output for T229 >--------------------------------------------------------------- 329b2cdb6452e5cfa47ad662d38b706fb9a50e7f tests/T229.stderr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/T229.stderr b/tests/T229.stderr index deb6094..6a5c456 100644 --- a/tests/T229.stderr +++ b/tests/T229.stderr @@ -1,3 +1,3 @@ -T229: Data.Array.Base.safe_scale: Overflow +T229: Data.Array.Base.safe_scale: Overflow; scale: 4, n: 4611686018427387904 CallStack (from HasCallStack): - error, called at libraries/array/Data/Array/Base.hs:1374:17 in array-0.5.1.2:Data.Array.Base + error, called at libraries/array/Data/Array/Base.hs:1356:20 in array-0.5.1.2:Data.Array.Base From git at git.haskell.org Thu Feb 9 02:25:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Feb 2017 02:25:40 +0000 (UTC) Subject: [commit: ghc] master: users-guide: Document defaults for remaining optimization flags (41c7437) Message-ID: <20170209022540.019003A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/41c7437e13494c548de83f10154ff35940748aaf/ghc >--------------------------------------------------------------- commit 41c7437e13494c548de83f10154ff35940748aaf Author: Ben Gamari Date: Wed Feb 8 15:49:46 2017 -0500 users-guide: Document defaults for remaining optimization flags >--------------------------------------------------------------- 41c7437e13494c548de83f10154ff35940748aaf docs/users_guide/using-optimisation.rst | 52 ++++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 10 deletions(-) diff --git a/docs/users_guide/using-optimisation.rst b/docs/users_guide/using-optimisation.rst index 123d74b..9436832 100644 --- a/docs/users_guide/using-optimisation.rst +++ b/docs/users_guide/using-optimisation.rst @@ -196,16 +196,20 @@ list. .. ghc-flag:: -fdicts-cheap + :default: off + A very experimental flag that makes dictionary-valued expressions seem cheap to the optimiser. .. ghc-flag:: -fdicts-strict + :default: off + Make dictionaries strict. .. ghc-flag:: -fdmd-tx-dict-sel - *On by default for ``-O0``, ``-O``, ``-O2``.* + :default: on Use a special demand transformer for dictionary selectors. @@ -224,6 +228,8 @@ list. .. ghc-flag:: -feager-blackholing + :default: off + Usually GHC black-holes a thunk only when it switches threads. This flag makes it do so as soon as the thunk is entered. See `Haskell on a shared-memory @@ -231,6 +237,8 @@ list. .. ghc-flag:: -fexcess-precision + :default: off + When this option is given, intermediate floating point values can have a *greater* precision/range than the final type. Generally this is a good thing, but some programs may rely on the exact @@ -244,6 +252,8 @@ list. .. ghc-flag:: -fexpose-all-unfoldings + :default: off + An experimental flag to expose all unfoldings, even for very large or recursive functions. This allows for all functions to be inlined while usually GHC would avoid inlining larger functions. @@ -309,6 +319,8 @@ list. .. ghc-flag:: -fignore-interface-pragmas + :default: off + Tells GHC to ignore all inessential information when reading interface files. That is, even if :file:`M.hi` contains unfolding or strictness information for a function, GHC will ignore that @@ -316,6 +328,8 @@ list. .. ghc-flag:: -flate-dmd-anal + :default: off + Run demand analysis again, at the end of the simplification pipeline. We found some opportunities for discovering strictness that were not visible earlier; and optimisations like @@ -325,11 +339,12 @@ list. .. ghc-flag:: -fliberate-case - *Off by default, but enabled by -O2.* Turn on the liberate-case - transformation. This unrolls recursive function once in its own RHS, - to avoid repeated case analysis of free variables. It's a bit like - the call-pattern specialiser (:ghc-flag:`-fspec-constr`) but for free - variables rather than arguments. + :default: off but enabled with :ghc-flag:`-O2`. + + Turn on the liberate-case transformation. This unrolls recursive function + once in its own RHS, to avoid repeated case analysis of free variables. It's + a bit like the call-pattern specialiser (:ghc-flag:`-fspec-constr`) but for + free variables rather than arguments. .. ghc-flag:: -fliberate-case-threshold= @@ -401,14 +416,20 @@ list. .. ghc-flag:: -fno-opt-coercion + :default: off + Turn off the coercion optimiser. .. ghc-flag:: -fno-pre-inlining + :default: off + Turn off pre-inlining. .. ghc-flag:: -fno-state-hack + :default: off + Turn off the "state hack" whereby any lambda with a ``State#`` token as argument is considered to be single-entry, hence it is considered okay to inline things inside it. This can improve performance of IO @@ -416,6 +437,8 @@ list. .. ghc-flag:: -fomit-interface-pragmas + :default: off + Tells GHC to omit all inessential information from the interface file generated for the module being compiled (say M). This means that a module importing M will see only the *types* of the functions @@ -495,9 +518,11 @@ list. .. ghc-flag:: -fspec-constr - *Off by default, but enabled by -O2.* Turn on call-pattern - specialisation; see `Call-pattern specialisation for Haskell - programs `__. + :default: off but enabled by :ghc-flag:`-O2`. + + Turn on call-pattern specialisation; see `Call-pattern specialisation for + Haskell programs + `__. This optimisation specializes recursive functions according to their argument "shapes". This is best explained by example so consider: :: @@ -601,7 +626,7 @@ list. .. ghc-flag:: -fsolve-constant-dicts - :default on + :default: on When solving constraints, try to eagerly solve super classes using availible dictionaries. @@ -632,6 +657,8 @@ list. .. ghc-flag:: -fstatic-argument-transformation + :default: off + Turn on the static argument transformation, which turns a recursive function into a non-recursive one with a local recursive loop. See Chapter 7 of `Andre Santos's PhD @@ -695,6 +722,8 @@ list. .. ghc-flag:: -funbox-strict-fields + :default: off + .. index:: single: strict constructor fields single: constructor fields, strict @@ -711,6 +740,9 @@ list. it for certain constructor fields using the ``NOUNPACK`` pragma (see :ref:`nounpack-pragma`). + Alternatively you can use :ghc-flag:`-funbox-small-strict-fields` to only + unbox strict fields which are "small". + .. ghc-flag:: -funfolding-creation-threshold= :default: 750 From git at git.haskell.org Thu Feb 9 02:25:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Feb 2017 02:25:42 +0000 (UTC) Subject: [commit: ghc] master: Fix documentation for setByteArray# (082936d) Message-ID: <20170209022542.A8BAE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/082936d98a619e8f7a95c7762fb40fae04c99db5/ghc >--------------------------------------------------------------- commit 082936d98a619e8f7a95c7762fb40fae04c99db5 Author: Ben Gamari Date: Wed Feb 8 18:55:32 2017 -0500 Fix documentation for setByteArray# The documentation was previously unusably incomplete. >--------------------------------------------------------------- 082936d98a619e8f7a95c7762fb40fae04c99db5 compiler/prelude/primops.txt.pp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp index 533d198..f1ee3b3 100644 --- a/compiler/prelude/primops.txt.pp +++ b/compiler/prelude/primops.txt.pp @@ -1440,7 +1440,8 @@ primop CopyAddrToByteArrayOp "copyAddrToByteArray#" GenPrimOp primop SetByteArrayOp "setByteArray#" GenPrimOp MutableByteArray# s -> Int# -> Int# -> Int# -> State# s -> State# s - {Set the range of the MutableByteArray# to the specified character.} + {{\tt setByteArray# ba off len c} sets the byte range {\tt [off, off+len]} of + the {\tt MutableByteArray#} to the byte {\tt c}.} with has_side_effects = True code_size = { primOpCodeSizeForeignCall + 4 } From git at git.haskell.org Thu Feb 9 02:25:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Feb 2017 02:25:45 +0000 (UTC) Subject: [commit: ghc] master: Bump array submodule (afaf6d5) Message-ID: <20170209022545.5D6C73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/afaf6d58f2c1b131eecee65d69d5dfbf10dc1b0b/ghc >--------------------------------------------------------------- commit afaf6d58f2c1b131eecee65d69d5dfbf10dc1b0b Author: Ben Gamari Date: Wed Feb 8 18:59:55 2017 -0500 Bump array submodule Fixes https://github.com/ekmett/ad/issues/62. >--------------------------------------------------------------- afaf6d58f2c1b131eecee65d69d5dfbf10dc1b0b libraries/array | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/array b/libraries/array index 6e110fe..7adaf40 160000 --- a/libraries/array +++ b/libraries/array @@ -1 +1 @@ -Subproject commit 6e110fe4193472c2e47aa0563362f95dd8bca37b +Subproject commit 7adaf408cf24e420083f88ecd5b8d7bd7d0e5512 From git at git.haskell.org Thu Feb 9 03:06:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Feb 2017 03:06:14 +0000 (UTC) Subject: [commit: ghc] branch 'wip/t11715' created Message-ID: <20170209030614.2695C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/t11715 Referencing: b6558d80072257b9bd41fb6099a86e7411c8ba97 From git at git.haskell.org Thu Feb 9 03:06:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Feb 2017 03:06:19 +0000 (UTC) Subject: [commit: ghc] wip/t11715: Bugfixing. Deleting code. (7929073) Message-ID: <20170209030619.970E03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/t11715 Link : http://ghc.haskell.org/trac/ghc/changeset/79290738dbaa8eb0786549cf47ac073761e9f301/ghc >--------------------------------------------------------------- commit 79290738dbaa8eb0786549cf47ac073761e9f301 Author: Richard Eisenberg Date: Wed Jan 25 17:50:44 2017 -0500 Bugfixing. Deleting code. >--------------------------------------------------------------- 79290738dbaa8eb0786549cf47ac073761e9f301 compiler/basicTypes/MkId.hs | 9 ++++-- compiler/coreSyn/CorePrep.hs | 14 ++++++-- compiler/coreSyn/TrieMap.hs | 6 ++-- compiler/iface/ToIface.hs | 8 +++-- compiler/simplStg/RepType.hs | 2 +- compiler/typecheck/TcErrors.hs | 9 ++---- compiler/typecheck/TcMType.hs | 2 +- compiler/types/Kind.hs | 72 +++++++---------------------------------- compiler/types/TyCoRep.hs | 15 ++++++--- compiler/types/TyCon.hs | 8 ++++- compiler/types/Type.hs | 26 ++++----------- compiler/types/Unify.hs | 4 +-- libraries/ghc-prim/GHC/Magic.hs | 12 +++++-- 13 files changed, 78 insertions(+), 109 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 79290738dbaa8eb0786549cf47ac073761e9f301 From git at git.haskell.org Thu Feb 9 03:06:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Feb 2017 03:06:22 +0000 (UTC) Subject: [commit: ghc] wip/t11715: More deleting code. Bugfixing. (07a34c4) Message-ID: <20170209030622.6DD793A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/t11715 Link : http://ghc.haskell.org/trac/ghc/changeset/07a34c4cf08bc08b23d6532c94eec91938e5c0ce/ghc >--------------------------------------------------------------- commit 07a34c4cf08bc08b23d6532c94eec91938e5c0ce Author: Richard Eisenberg Date: Wed Jan 25 23:32:27 2017 -0500 More deleting code. Bugfixing. >--------------------------------------------------------------- 07a34c4cf08bc08b23d6532c94eec91938e5c0ce compiler/coreSyn/CoreFVs.hs | 2 +- compiler/coreSyn/CoreLint.hs | 6 +- compiler/iface/IfaceSyn.hs | 2 +- compiler/iface/IfaceType.hs | 16 +-- compiler/iface/TcIface.hs | 2 +- compiler/iface/ToIface.hs | 2 +- compiler/typecheck/FamInst.hs | 4 + compiler/typecheck/TcCanonical.hs | 39 ++++--- compiler/typecheck/TcDerivInfer.hs | 2 +- compiler/typecheck/TcDerivUtils.hs | 2 +- compiler/typecheck/TcErrors.hs | 3 +- compiler/typecheck/TcEvidence.hs | 2 +- compiler/typecheck/TcFlatten.hs | 2 +- compiler/typecheck/TcGenDeriv.hs | 4 +- compiler/typecheck/TcInteract.hs | 12 +-- compiler/typecheck/TcMType.hs | 3 +- compiler/typecheck/TcRnTypes.hs | 2 +- compiler/typecheck/TcRules.hs | 2 +- compiler/typecheck/TcSMonad.hs | 2 +- compiler/typecheck/TcTyClsDecls.hs | 1 - compiler/typecheck/TcTyDecls.hs | 2 +- compiler/typecheck/TcType.hs | 38 ++----- compiler/typecheck/TcTypeNats.hs | 44 ++++---- compiler/typecheck/TcUnify.hs | 8 +- compiler/typecheck/TcValidity.hs | 4 +- compiler/types/Coercion.hs | 114 ++++++++++----------- compiler/types/Coercion.hs-boot | 2 +- compiler/types/FamInstEnv.hs | 4 +- compiler/types/Kind.hs | 10 +- compiler/types/OptCoercion.hs | 33 +++--- compiler/types/TyCoRep.hs | 22 ++-- compiler/types/Type.hs | 8 +- compiler/types/Type.hs-boot | 2 - compiler/types/Unify.hs | 11 +- docs/core-spec/CoreLint.ott | 10 +- docs/core-spec/CoreSyn.ott | 8 +- docs/core-spec/core-spec.mng | 10 +- docs/core-spec/core-spec.pdf | Bin 348416 -> 349038 bytes libraries/ghc-prim/GHC/Magic.hs | 7 +- testsuite/tests/pmcheck/should_compile/T11195.hs | 4 +- testsuite/tests/typecheck/should_run/TypeOf.stdout | 14 +-- .../tests/typecheck/should_run/TypeRep.stdout | 12 +-- 42 files changed, 237 insertions(+), 240 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 07a34c4cf08bc08b23d6532c94eec91938e5c0ce From git at git.haskell.org Thu Feb 9 03:06:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Feb 2017 03:06:16 +0000 (UTC) Subject: [commit: ghc] wip/t11715: Separate Constraint from Type in Core. (30895d6) Message-ID: <20170209030616.D08F93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/t11715 Link : http://ghc.haskell.org/trac/ghc/changeset/30895d6f0c5a46f87249af157d579008c8b964d9/ghc >--------------------------------------------------------------- commit 30895d6f0c5a46f87249af157d579008c8b964d9 Author: Richard Eisenberg Date: Wed Jan 25 16:47:59 2017 -0500 Separate Constraint from Type in Core. This was just about as easy as I thought it would be. There are still various bookkeeping issues, but it seems to be working. >--------------------------------------------------------------- 30895d6f0c5a46f87249af157d579008c8b964d9 compiler/prelude/PrelNames.hs | 14 ++++++-------- compiler/prelude/TysWiredIn.hs | 17 ++++++++++------- compiler/types/Kind.hs | 2 +- compiler/types/Type.hs | 3 ++- libraries/ghc-prim/GHC/Types.hs | 3 ++- 5 files changed, 21 insertions(+), 18 deletions(-) diff --git a/compiler/prelude/PrelNames.hs b/compiler/prelude/PrelNames.hs index 4d28ba3..0e30c81 100644 --- a/compiler/prelude/PrelNames.hs +++ b/compiler/prelude/PrelNames.hs @@ -1602,7 +1602,7 @@ statePrimTyConKey, stableNamePrimTyConKey, stableNameTyConKey, mutVarPrimTyConKey, ioTyConKey, wordPrimTyConKey, wordTyConKey, word8TyConKey, word16TyConKey, word32PrimTyConKey, word32TyConKey, word64PrimTyConKey, word64TyConKey, - liftedConKey, unliftedConKey, anyBoxConKey, kindConKey, boxityConKey, + anyBoxConKey, kindConKey, boxityConKey, typeConKey, threadIdPrimTyConKey, bcoPrimTyConKey, ptrTyConKey, funPtrTyConKey, tVarPrimTyConKey, eqPrimTyConKey, eqReprPrimTyConKey, eqPhantPrimTyConKey, voidPrimTyConKey, @@ -1624,8 +1624,6 @@ word32PrimTyConKey = mkPreludeTyConUnique 63 word32TyConKey = mkPreludeTyConUnique 64 word64PrimTyConKey = mkPreludeTyConUnique 65 word64TyConKey = mkPreludeTyConUnique 66 -liftedConKey = mkPreludeTyConUnique 67 -unliftedConKey = mkPreludeTyConUnique 68 anyBoxConKey = mkPreludeTyConUnique 69 kindConKey = mkPreludeTyConUnique 70 boxityConKey = mkPreludeTyConUnique 71 @@ -1904,20 +1902,20 @@ sumRepDataConKey = mkPreludeDataConUnique 73 -- See Note [Wiring in RuntimeRep] in TysWiredIn runtimeRepSimpleDataConKeys :: [Unique] -liftedRepDataConKey :: Unique +liftedRepDataConKey, constraintRepDataConKey :: Unique runtimeRepSimpleDataConKeys@( - liftedRepDataConKey : _) - = map mkPreludeDataConUnique [74..82] + liftedRepDataConKey : _ : constraintRepDataConKey : _) + = map mkPreludeDataConUnique [74..83] -- See Note [Wiring in RuntimeRep] in TysWiredIn -- VecCount vecCountDataConKeys :: [Unique] -vecCountDataConKeys = map mkPreludeDataConUnique [83..88] +vecCountDataConKeys = map mkPreludeDataConUnique [84..89] -- See Note [Wiring in RuntimeRep] in TysWiredIn -- VecElem vecElemDataConKeys :: [Unique] -vecElemDataConKeys = map mkPreludeDataConUnique [89..98] +vecElemDataConKeys = map mkPreludeDataConUnique [90..99] ---------------- Template Haskell ------------------- -- THNames.hs: USES DataUniques 100-150 diff --git a/compiler/prelude/TysWiredIn.hs b/compiler/prelude/TysWiredIn.hs index 66eb396..1234007 100644 --- a/compiler/prelude/TysWiredIn.hs +++ b/compiler/prelude/TysWiredIn.hs @@ -111,7 +111,8 @@ module TysWiredIn ( vecRepDataConTyCon, tupleRepDataConTyCon, sumRepDataConTyCon, - liftedRepDataConTy, unliftedRepDataConTy, intRepDataConTy, + liftedRepDataConTy, unliftedRepDataConTy, constraintRepDataConTy, + intRepDataConTy, wordRepDataConTy, int64RepDataConTy, word64RepDataConTy, addrRepDataConTy, floatRepDataConTy, doubleRepDataConTy, @@ -413,7 +414,7 @@ sumRepDataConName = mkWiredInDataConName UserSyntax gHC_TYPES (fsLit "SumRep") s runtimeRepSimpleDataConNames :: [Name] runtimeRepSimpleDataConNames = zipWith3Lazy mk_special_dc_name - [ fsLit "LiftedRep", fsLit "UnliftedRep" + [ fsLit "LiftedRep", fsLit "UnliftedRep", fsLit "ConstraintRep" , fsLit "IntRep" , fsLit "WordRep", fsLit "Int64Rep", fsLit "Word64Rep" , fsLit "AddrRep", fsLit "FloatRep", fsLit "DoubleRep" ] @@ -575,8 +576,9 @@ typeNatKind = mkTyConTy typeNatKindCon typeSymbolKind = mkTyConTy typeSymbolKindCon constraintKindTyCon :: TyCon -constraintKindTyCon = pcTyCon False constraintKindTyConName - Nothing [] [] +constraintKindTyCon = buildSynTyCon constraintKindTyConName [] + liftedTypeKind [] + (tYPE constraintRepDataConTy) liftedTypeKind, constraintKind :: Kind liftedTypeKind = tYPE liftedRepTy @@ -1151,7 +1153,8 @@ runtimeRepSimpleDataCons :: [DataCon] liftedRepDataCon :: DataCon runtimeRepSimpleDataCons@(liftedRepDataCon : _) = zipWithLazy mk_runtime_rep_dc - [ LiftedRep, UnliftedRep, IntRep, WordRep, Int64Rep + [ LiftedRep, UnliftedRep, LiftedRep -- <-- that's for ConstraintRep + , IntRep, WordRep, Int64Rep , Word64Rep, AddrRep, FloatRep, DoubleRep ] runtimeRepSimpleDataConNames where @@ -1159,10 +1162,10 @@ runtimeRepSimpleDataCons@(liftedRepDataCon : _) = pcSpecialDataCon name [] runtimeRepTyCon (RuntimeRep (\_ -> [primrep])) -- See Note [Wiring in RuntimeRep] -liftedRepDataConTy, unliftedRepDataConTy, +liftedRepDataConTy, unliftedRepDataConTy, constraintRepDataConTy, intRepDataConTy, wordRepDataConTy, int64RepDataConTy, word64RepDataConTy, addrRepDataConTy, floatRepDataConTy, doubleRepDataConTy :: Type -[liftedRepDataConTy, unliftedRepDataConTy, +[liftedRepDataConTy, unliftedRepDataConTy, constraintRepDataConTy, intRepDataConTy, wordRepDataConTy, int64RepDataConTy, word64RepDataConTy, addrRepDataConTy, floatRepDataConTy, doubleRepDataConTy] = map (mkTyConTy . promoteDataCon) runtimeRepSimpleDataCons diff --git a/compiler/types/Kind.hs b/compiler/types/Kind.hs index b67eec0..dd50c7e 100644 --- a/compiler/types/Kind.hs +++ b/compiler/types/Kind.hs @@ -140,7 +140,7 @@ isStarKind _ = False -- | Is the tycon @Constraint@? isStarKindSynonymTyCon :: TyCon -> Bool -isStarKindSynonymTyCon tc = tc `hasKey` constraintKindTyConKey +isStarKindSynonymTyCon _ = False {- Note [Levity polymorphism] diff --git a/compiler/types/Type.hs b/compiler/types/Type.hs index b611786..85426c3 100644 --- a/compiler/types/Type.hs +++ b/compiler/types/Type.hs @@ -1852,7 +1852,8 @@ isLiftedType_maybe ty = go (getRuntimeRep "isLiftedType_maybe" ty) where go rr | Just rr' <- coreView rr = go rr' go (TyConApp lifted_rep []) - | lifted_rep `hasKey` liftedRepDataConKey = Just True + | lifted_rep `hasKey` liftedRepDataConKey + || lifted_rep `hasKey` constraintRepDataConKey = Just True go (TyConApp {}) = Just False -- everything else is unlifted go _ = Nothing -- levity polymorphic diff --git a/libraries/ghc-prim/GHC/Types.hs b/libraries/ghc-prim/GHC/Types.hs index 16a4921..070f3b0 100644 --- a/libraries/ghc-prim/GHC/Types.hs +++ b/libraries/ghc-prim/GHC/Types.hs @@ -57,7 +57,7 @@ infixr 5 : ********************************************************************* -} -- | The kind of constraints, like @Show a@ -data Constraint +type Constraint = TYPE 'ConstraintRep -- | The kind of types with values. For example @Int :: Type at . type Type = TYPE 'LiftedRep @@ -378,6 +378,7 @@ data RuntimeRep = VecRep VecCount VecElem -- ^ a SIMD vector type | SumRep [RuntimeRep] -- ^ An unboxed sum of the given reps | LiftedRep -- ^ lifted; represented by a pointer | UnliftedRep -- ^ unlifted; represented by a pointer + | ConstraintRep -- ^ lifted; a constraint | IntRep -- ^ signed, word-sized value | WordRep -- ^ unsigned, word-sized value | Int64Rep -- ^ signed, 64-bit value (on 32-bit only) From git at git.haskell.org Thu Feb 9 03:06:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Feb 2017 03:06:25 +0000 (UTC) Subject: [commit: ghc] wip/t11715: Use mkCastTy in subst_ty (07a1c1b) Message-ID: <20170209030625.1E86D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/t11715 Link : http://ghc.haskell.org/trac/ghc/changeset/07a1c1b4d97e689a59b90b4095a977afe4638bbb/ghc >--------------------------------------------------------------- commit 07a1c1b4d97e689a59b90b4095a977afe4638bbb Author: Richard Eisenberg Date: Sun Jan 29 00:11:15 2017 -0500 Use mkCastTy in subst_ty >--------------------------------------------------------------- 07a1c1b4d97e689a59b90b4095a977afe4638bbb compiler/types/TyCoRep.hs | 6 ++++-- compiler/types/Type.hs-boot | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/compiler/types/TyCoRep.hs b/compiler/types/TyCoRep.hs index 85a1df8..696cd42 100644 --- a/compiler/types/TyCoRep.hs +++ b/compiler/types/TyCoRep.hs @@ -138,7 +138,7 @@ import {-# SOURCE #-} DataCon( dataConFullSig , DataCon, filterEqSpec ) import {-# SOURCE #-} Type( isPredTy, isCoercionTy, mkAppTy , tyCoVarsOfTypesWellScoped - , coreView, typeKind ) + , coreView, typeKind, mkCastTy ) -- Transitively pulls in a LOT of stuff, better to break the loop import {-# SOURCE #-} Coercion @@ -2180,7 +2180,9 @@ subst_ty subst ty (ForAllTy $! ((TvBndr $! tv') vis)) $! (subst_ty subst' ty) go (LitTy n) = LitTy $! n - go (CastTy ty co) = (CastTy $! (go ty)) $! (subst_co subst co) + go (CastTy ty co) = (mkCastTy $! (go ty)) $! (subst_co subst co) + -- NB: mkCastTy, not CastTy. The subst_co might make something + -- reflexive go (CoercionTy co) = CoercionTy $! (subst_co subst co) substTyVar :: TCvSubst -> TyVar -> Type diff --git a/compiler/types/Type.hs-boot b/compiler/types/Type.hs-boot index 78c6681..39a4c80 100644 --- a/compiler/types/Type.hs-boot +++ b/compiler/types/Type.hs-boot @@ -1,12 +1,13 @@ module Type where import TyCon import Var ( TyVar ) -import {-# SOURCE #-} TyCoRep( Type, Kind ) +import {-# SOURCE #-} TyCoRep( Type, Kind, Coercion ) isPredTy :: Type -> Bool isCoercionTy :: Type -> Bool mkAppTy :: Type -> Type -> Type +mkCastTy :: Type -> Coercion -> Type piResultTy :: Type -> Type -> Type typeKind :: Type -> Kind From git at git.haskell.org Thu Feb 9 03:06:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Feb 2017 03:06:27 +0000 (UTC) Subject: [commit: ghc] wip/t11715: Work toward adding new `Visibility` parameter. (1c8aab4) Message-ID: <20170209030627.E36923A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/t11715 Link : http://ghc.haskell.org/trac/ghc/changeset/1c8aab4f4800cb72562cc1364a7e91e95c37d77c/ghc >--------------------------------------------------------------- commit 1c8aab4f4800cb72562cc1364a7e91e95c37d77c Author: Richard Eisenberg Date: Mon Jan 30 15:06:10 2017 -0500 Work toward adding new `Visibility` parameter. >--------------------------------------------------------------- 1c8aab4f4800cb72562cc1364a7e91e95c37d77c compiler/basicTypes/MkId.hs | 63 +++++++++++++-------------- compiler/basicTypes/PatSyn.hs | 4 +- compiler/coreSyn/CorePrep.hs | 15 ++----- compiler/coreSyn/CoreSubst.hs | 2 +- compiler/coreSyn/CoreSyn.hs | 7 +-- compiler/coreSyn/MkCore.hs | 8 ++-- compiler/ghci/ByteCodeGen.hs | 4 +- compiler/hsSyn/HsUtils.hs | 2 +- compiler/iface/IfaceType.hs | 48 ++++++++++++++------- compiler/iface/ToIface.hs | 13 +++--- compiler/prelude/PrelNames.hs | 24 +++++++---- compiler/prelude/TysPrim.hs | 69 +++++++++++++++++------------ compiler/prelude/TysWiredIn.hs | 74 ++++++++++++++++++++------------ compiler/prelude/TysWiredIn.hs-boot | 6 ++- compiler/simplStg/RepType.hs | 14 +++--- compiler/typecheck/TcExpr.hs | 2 +- compiler/typecheck/TcMType.hs | 8 ++-- compiler/typecheck/TcPatSyn.hs | 2 +- compiler/typecheck/TcSimplify.hs | 2 +- compiler/typecheck/TcTyClsDecls.hs | 4 +- compiler/typecheck/TcType.hs | 2 +- compiler/typecheck/TcUnify.hs | 8 ++-- compiler/typecheck/TcValidity.hs | 2 +- compiler/types/Kind.hs | 15 +++---- compiler/types/TyCoRep.hs | 27 ++++++------ compiler/types/TyCon.hs | 8 ++-- compiler/types/Type.hs | 13 +++--- libraries/base/Data/Typeable/Internal.hs | 6 ++- libraries/base/GHC/Err.hs | 8 ++-- libraries/base/GHC/Exts.hs | 2 +- libraries/base/tests/T11334a.hs | 5 ++- libraries/ghc-prim/GHC/Magic.hs | 17 +------- libraries/ghc-prim/GHC/Types.hs | 26 ++++++++--- 33 files changed, 282 insertions(+), 228 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 1c8aab4f4800cb72562cc1364a7e91e95c37d77c From git at git.haskell.org Thu Feb 9 03:06:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Feb 2017 03:06:30 +0000 (UTC) Subject: [commit: ghc] wip/t11715: Checkpoint. Stage 2 compiles + works. (e554ac3) Message-ID: <20170209030630.B31683A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/t11715 Link : http://ghc.haskell.org/trac/ghc/changeset/e554ac3e19eec3bb738caa74d74609b05b312a7e/ghc >--------------------------------------------------------------- commit e554ac3e19eec3bb738caa74d74609b05b312a7e Author: Richard Eisenberg Date: Mon Jan 30 20:55:02 2017 -0500 Checkpoint. Stage 2 compiles + works. About to change the name of the types. >--------------------------------------------------------------- e554ac3e19eec3bb738caa74d74609b05b312a7e compiler/coreSyn/MkCore.hs | 10 ++++- compiler/ghci/RtClosureInspect.hs | 4 +- compiler/iface/IfaceType.hs | 10 ++--- compiler/iface/TcIface.hs | 9 ++-- compiler/prelude/TysWiredIn.hs | 26 +++++++----- compiler/prelude/TysWiredIn.hs-boot | 3 +- compiler/stgSyn/CoreToStg.hs | 2 +- compiler/stranal/WwLib.hs | 3 ++ compiler/typecheck/TcExpr.hs | 18 ++++++-- compiler/typecheck/TcGenFunctor.hs | 6 +-- compiler/typecheck/TcHsSyn.hs | 7 +++- compiler/typecheck/TcHsType.hs | 10 +++-- compiler/typecheck/TcMType.hs | 4 ++ compiler/typecheck/TcPat.hs | 6 +-- compiler/typecheck/TcSimplify.hs | 11 ++++- compiler/typecheck/TcSplice.hs | 8 ++-- compiler/types/TyCoRep.hs | 23 +++++----- compiler/types/TyCon.hs | 22 ++++++---- compiler/types/Type.hs | 49 ++++++++++++++++------ libraries/base/GHC/Exts.hs | 2 +- .../tests/deSugar/should_compile/T2431.stderr | 6 +-- .../tests/dependent/should_compile/RaeJobTalk.hs | 6 +++ testsuite/tests/dependent/should_compile/T11405.hs | 2 +- testsuite/tests/dependent/should_fail/T11473.hs | 4 +- .../tests/dependent/should_fail/TypeSkolEscape.hs | 2 +- testsuite/tests/deriving/should_fail/T12512.hs | 4 +- .../tests/indexed-types/should_run/T11465a.hs | 2 +- testsuite/tests/polykinds/T12668.hs | 4 +- testsuite/tests/polykinds/T12718.hs | 4 +- testsuite/tests/typecheck/should_compile/T11723.hs | 2 +- testsuite/tests/typecheck/should_compile/T12911.hs | 2 +- testsuite/tests/typecheck/should_compile/T12987.hs | 2 +- .../tests/typecheck/should_fail/LevPolyBounded.hs | 2 +- testsuite/tests/typecheck/should_fail/T11724.hs | 2 +- testsuite/tests/typecheck/should_fail/T12973.hs | 6 +-- testsuite/tests/typecheck/should_fail/T13105.hs | 2 +- .../tests/typecheck/should_run/EtaExpandLevPoly.hs | 8 ++-- testsuite/tests/typecheck/should_run/T12809.hs | 4 +- testsuite/tests/typecheck/should_run/TypeOf.hs | 2 +- testsuite/tests/typecheck/should_run/TypeRep.hs | 2 +- testsuite/tests/unboxedsums/UbxSumLevPoly.hs | 2 +- testsuite/tests/unboxedsums/sum_rr.hs | 2 +- 42 files changed, 195 insertions(+), 110 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 e554ac3e19eec3bb738caa74d74609b05b312a7e From git at git.haskell.org Thu Feb 9 03:06:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Feb 2017 03:06:33 +0000 (UTC) Subject: [commit: ghc] wip/t11715: Checkpoint after renaming (b6558d8) Message-ID: <20170209030633.7F3903A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/t11715 Link : http://ghc.haskell.org/trac/ghc/changeset/b6558d80072257b9bd41fb6099a86e7411c8ba97/ghc >--------------------------------------------------------------- commit b6558d80072257b9bd41fb6099a86e7411c8ba97 Author: Richard Eisenberg Date: Mon Jan 30 22:45:16 2017 -0500 Checkpoint after renaming >--------------------------------------------------------------- b6558d80072257b9bd41fb6099a86e7411c8ba97 compiler/basicTypes/MkId.hs | 8 +-- compiler/basicTypes/PatSyn.hs | 4 +- compiler/coreSyn/CoreSyn.hs | 6 +- compiler/coreSyn/MkCore.hs | 6 +- compiler/ghci/ByteCodeGen.hs | 4 +- compiler/hsSyn/HsUtils.hs | 2 +- compiler/iface/IfaceType.hs | 29 +++++--- compiler/prelude/PrelNames.hs | 9 +-- compiler/prelude/TysPrim.hs | 82 +++++++++++----------- compiler/prelude/TysWiredIn.hs | 38 +++++----- compiler/prelude/TysWiredIn.hs-boot | 1 + compiler/simplStg/RepType.hs | 10 +-- compiler/typecheck/TcExpr.hs | 2 +- compiler/typecheck/TcMType.hs | 8 +-- compiler/typecheck/TcPatSyn.hs | 2 +- compiler/typecheck/TcSimplify.hs | 2 +- compiler/typecheck/TcTyClsDecls.hs | 4 +- compiler/typecheck/TcType.hs | 2 +- compiler/typecheck/TcUnify.hs | 8 +-- compiler/typecheck/TcValidity.hs | 2 +- compiler/types/Kind.hs | 14 ++-- compiler/types/TyCoRep.hs | 22 +++--- compiler/types/TyCon.hs | 7 +- compiler/types/Type.hs | 10 +-- libraries/base/Data/Typeable/Internal.hs | 6 +- libraries/base/GHC/Err.hs | 8 +-- libraries/base/GHC/Exts.hs | 4 +- libraries/base/tests/T11334a.hs | 6 +- libraries/ghc-prim/GHC/Types.hs | 14 ++-- .../tests/dependent/should_compile/RaeJobTalk.hs | 6 +- testsuite/tests/dependent/should_compile/T11405.hs | 2 +- testsuite/tests/dependent/should_fail/T11473.hs | 4 +- .../tests/dependent/should_fail/TypeSkolEscape.hs | 2 +- testsuite/tests/deriving/should_fail/T12512.hs | 4 +- .../tests/indexed-types/should_run/T11465a.hs | 2 +- testsuite/tests/polykinds/T12668.hs | 4 +- testsuite/tests/polykinds/T12718.hs | 4 +- testsuite/tests/typecheck/should_compile/T11723.hs | 2 +- testsuite/tests/typecheck/should_compile/T12911.hs | 2 +- testsuite/tests/typecheck/should_compile/T12987.hs | 2 +- .../tests/typecheck/should_fail/LevPolyBounded.hs | 2 +- testsuite/tests/typecheck/should_fail/T11724.hs | 2 +- testsuite/tests/typecheck/should_fail/T12973.hs | 4 +- testsuite/tests/typecheck/should_fail/T13105.hs | 2 +- .../tests/typecheck/should_run/EtaExpandLevPoly.hs | 8 +-- testsuite/tests/typecheck/should_run/T12809.hs | 4 +- testsuite/tests/typecheck/should_run/TypeOf.hs | 4 +- testsuite/tests/typecheck/should_run/TypeRep.hs | 4 +- testsuite/tests/unboxedsums/UbxSumLevPoly.hs | 2 +- testsuite/tests/unboxedsums/sum_rr.hs | 2 +- 50 files changed, 202 insertions(+), 186 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 b6558d80072257b9bd41fb6099a86e7411c8ba97 From git at git.haskell.org Thu Feb 9 11:12:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Feb 2017 11:12:11 +0000 (UTC) Subject: [commit: ghc] master: Implement addCStub in template-haskell. (b9bebd8) Message-ID: <20170209111211.42B413A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b9bebd8cedccd7e8dd6df89b5504cd8f1e7a675b/ghc >--------------------------------------------------------------- commit b9bebd8cedccd7e8dd6df89b5504cd8f1e7a675b Author: Facundo Domínguez Date: Tue Feb 7 18:55:34 2017 -0300 Implement addCStub in template-haskell. Summary: addCStub allows injecting C code in the current module to be included in the final object file. Test Plan: ./validate Reviewers: simonpj, goldfire, austin, bgamari Reviewed By: bgamari Subscribers: bitonic, duncan, mboes, thomie Differential Revision: https://phabricator.haskell.org/D3106 >--------------------------------------------------------------- b9bebd8cedccd7e8dd6df89b5504cd8f1e7a675b compiler/deSugar/Desugar.hs | 6 +++++- compiler/typecheck/TcRnMonad.hs | 2 ++ compiler/typecheck/TcRnTypes.hs | 3 +++ compiler/typecheck/TcSplice.hs | 12 +++++++++++ libraries/ghci/GHCi/Message.hs | 5 ++++- libraries/ghci/GHCi/TH.hs | 1 + .../template-haskell/Language/Haskell/TH/Syntax.hs | 23 ++++++++++++++++++++++ testsuite/tests/th/TH_addCStub1.hs | 22 +++++++++++++++++++++ testsuite/tests/th/TH_addCStub1.stdout | 2 ++ testsuite/tests/th/TH_addCStub2.hs | 22 +++++++++++++++++++++ testsuite/tests/th/TH_addCStub2.stderr | 6 ++++++ testsuite/tests/th/all.T | 3 +++ 12 files changed, 105 insertions(+), 2 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 b9bebd8cedccd7e8dd6df89b5504cd8f1e7a675b From git at git.haskell.org Thu Feb 9 12:13:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Feb 2017 12:13:48 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Guard rewritableTyVarsOfType (f03ebe3) Message-ID: <20170209121348.AA82A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/f03ebe3ac6a5de5038a431d0a1e527354b339cd2/ghc >--------------------------------------------------------------- commit f03ebe3ac6a5de5038a431d0a1e527354b339cd2 Author: Simon Peyton Jones Date: Thu Feb 9 12:12:21 2017 +0000 Guard rewritableTyVarsOfType We only want to use rewriteableTyVarsOfType on CDictCan, CFunEqCan (and maybe CIrredCan). But not CTyEqCan. But we were -- for insolubles. So I narrowed the scope of the insuluble kick-out. >--------------------------------------------------------------- f03ebe3ac6a5de5038a431d0a1e527354b339cd2 compiler/typecheck/TcSMonad.hs | 25 +++++++++++++------------ compiler/typecheck/TcType.hs | 2 ++ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/compiler/typecheck/TcSMonad.hs b/compiler/typecheck/TcSMonad.hs index 6f53f07..00dcd06 100644 --- a/compiler/typecheck/TcSMonad.hs +++ b/compiler/typecheck/TcSMonad.hs @@ -1495,24 +1495,25 @@ kick_out_rewritable new_fr new_tv ics@(IC { inert_eqs = tv_eqs -- See Note [Kicking out CFunEqCan for fundeps] (dicts_out, dicts_in) = partitionDicts kick_out_ct dictmap (irs_out, irs_in) = partitionBag kick_out_ct irreds - (insols_out, insols_in) = partitionBag kick_out_ct insols - -- Kick out even insolubles; see Note [Kick out insolubles] + (insols_out, insols_in) = partitionBag kick_out_insol insols fr_may_rewrite :: CtFlavourRole -> Bool fr_may_rewrite fs = new_fr `eqMayRewriteFR` fs -- Can the new item rewrite the inert item? + kick_out_insol :: Ct -> Bool + -- See Note [Kick out insolubles] + kick_out_insol (CTyEqCan { cc_tyvar = tv }) = new_tv == tv + kick_out_insol _ = False + kick_out_ct :: Ct -> Bool - -- Kick it out if the new CTyEqCan can rewrite the inert - -- one. See Note [kickOutRewritable] - -- Or if it has no shadow and the shadow - kick_out_ct ct = kick_out_ev (ctEvidence ct) - - kick_out_ev :: CtEvidence -> Bool - -- Kick it out if the new CTyEqCan can rewrite the inert - -- one. See Note [kickOutRewritable] - kick_out_ev ev = fr_may_rewrite (ctEvFlavourRole ev) - && new_tv `elemVarSet` rewritableTyVarsOfType (ctEvPred ev) + -- Kick it out if the new CTyEqCan can rewrite the inert one + -- See Note [kickOutRewritable] + -- Used only on CFunEqCan, CDictCan, CIrredCan + -- hence no forallls in (ctEvPred ev), hence rewriteableTyVarsOfType ok + kick_out_ct ct | let ev = ctEvidence ct + = fr_may_rewrite (ctEvFlavourRole ev) + && new_tv `elemVarSet` rewritableTyVarsOfType (ctEvPred ev) -- NB: this includes the fsk of a CFunEqCan. It can't -- actually be rewritten, but we need to kick it out -- so we get to take advantage of injectivity diff --git a/compiler/typecheck/TcType.hs b/compiler/typecheck/TcType.hs index 146de37..f19ff10 100644 --- a/compiler/typecheck/TcType.hs +++ b/compiler/typecheck/TcType.hs @@ -892,6 +892,8 @@ rewritableTyVarsOfTypes tys = mapUnionVarSet rewritableTyVarsOfType tys rewritableTyVarsOfType :: HasCallStack => TcType -> TcTyVarSet -- Used during kick-out from the inert set +-- This function is used for the arguments of class and type families, +-- which should not have any foralls in them -- Ignores coercions and casts, because rewriting those does -- not help solving, and it's more efficient to ignore them rewritableTyVarsOfType ty From git at git.haskell.org Thu Feb 9 12:16:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Feb 2017 12:16:39 +0000 (UTC) Subject: [commit: ghc] master: Tweaks and typos in manual, note refs, comments (e8f5efb) Message-ID: <20170209121639.1FE673A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e8f5efb55b694f70542d22d5c3aaf92222ccd973/ghc >--------------------------------------------------------------- commit e8f5efb55b694f70542d22d5c3aaf92222ccd973 Author: Gabor Greif Date: Wed Feb 8 14:14:36 2017 +0100 Tweaks and typos in manual, note refs, comments >--------------------------------------------------------------- e8f5efb55b694f70542d22d5c3aaf92222ccd973 compiler/basicTypes/Demand.hs | 2 +- compiler/cmm/CmmSink.hs | 2 +- compiler/codeGen/StgCmmCon.hs | 2 +- compiler/coreSyn/CoreUtils.hs | 2 +- compiler/ghci/ByteCodeGen.hs | 2 +- compiler/prelude/TysPrim.hs | 2 +- compiler/simplCore/OccurAnal.hs | 2 +- compiler/simplCore/SetLevels.hs | 16 ++++++++-------- compiler/simplCore/Simplify.hs | 2 +- compiler/stranal/DmdAnal.hs | 2 +- compiler/typecheck/TcEvidence.hs | 2 +- compiler/typecheck/TcMatches.hs | 2 +- compiler/typecheck/TcRnTypes.hs | 2 +- compiler/typecheck/TcSimplify.hs | 2 +- compiler/types/Unify.hs | 2 +- compiler/vectorise/Vectorise.hs | 2 +- docs/users_guide/glasgow_exts.rst | 2 +- ghc/GHCi/UI.hs | 2 +- libraries/base/GHC/ExecutionStack/Internal.hsc | 2 +- testsuite/tests/parser/should_fail/readFail027.hs | 2 +- testsuite/tests/programs/andy_cherry/andy_cherry.stdout | 2 +- testsuite/tests/programs/andy_cherry/mygames.pgn | 2 +- testsuite/tests/programs/galois_raytrace/Data.hs | 2 +- testsuite/tests/rename/should_fail/T4042.hs | 2 +- testsuite/tests/simplCore/T9646/readme.txt | 2 +- testsuite/tests/typecheck/should_fail/tcfail162.hs | 2 +- utils/ghc-pkg/Main.hs | 2 +- 27 files changed, 34 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 e8f5efb55b694f70542d22d5c3aaf92222ccd973 From git at git.haskell.org Thu Feb 9 16:35:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Feb 2017 16:35:12 +0000 (UTC) Subject: [commit: ghc] master: Bump array submodule (a6a4d0e) Message-ID: <20170209163512.304433A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a6a4d0e1b558166c87b4f60500855fcd5f088f7c/ghc >--------------------------------------------------------------- commit a6a4d0e1b558166c87b4f60500855fcd5f088f7c Author: Ben Gamari Date: Wed Feb 8 21:47:34 2017 -0500 Bump array submodule Previously test output was left in inconsistent state. >--------------------------------------------------------------- a6a4d0e1b558166c87b4f60500855fcd5f088f7c libraries/array | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/array b/libraries/array index 7adaf40..329b2cd 160000 --- a/libraries/array +++ b/libraries/array @@ -1 +1 @@ -Subproject commit 7adaf408cf24e420083f88ecd5b8d7bd7d0e5512 +Subproject commit 329b2cdb6452e5cfa47ad662d38b706fb9a50e7f From git at git.haskell.org Thu Feb 9 18:17:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Feb 2017 18:17:32 +0000 (UTC) Subject: [commit: ghc] master: Library docs: Document the order for sort and sortOn. (d266aac) Message-ID: <20170209181732.157F83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d266aac9586d42295df56ca077746d3876a1c849/ghc >--------------------------------------------------------------- commit d266aac9586d42295df56ca077746d3876a1c849 Author: Alexander Kjeldaas Date: Thu Feb 9 00:26:02 2017 +0100 Library docs: Document the order for sort and sortOn. This closes GH-22. >--------------------------------------------------------------- d266aac9586d42295df56ca077746d3876a1c849 libraries/base/Data/OldList.hs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libraries/base/Data/OldList.hs b/libraries/base/Data/OldList.hs index c3618c4..428d3bd 100644 --- a/libraries/base/Data/OldList.hs +++ b/libraries/base/Data/OldList.hs @@ -815,6 +815,9 @@ permutations xs0 = xs0 : perms xs0 [] -- | The 'sort' function implements a stable sorting algorithm. -- It is a special case of 'sortBy', which allows the programmer to supply -- their own comparison function. +-- +-- Elements are arranged from from lowest to highest, keeping duplicates in +-- the order they appeared in the input. sort :: (Ord a) => [a] -> [a] -- | The 'sortBy' function is the non-overloaded version of 'sort'. @@ -978,6 +981,9 @@ rqpart cmp x (y:ys) rle rgt r = -- input list. This is called the decorate-sort-undecorate paradigm, or -- Schwartzian transform. -- +-- Elements are arranged from from lowest to highest, keeping duplicates in +-- the order they appeared in the input. +-- -- @since 4.8.0.0 sortOn :: Ord b => (a -> b) -> [a] -> [a] sortOn f = From git at git.haskell.org Thu Feb 9 21:34:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Feb 2017 21:34:16 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Add testcase for #13248 (c22cd7c) Message-ID: <20170209213416.A50FB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c22cd7cc28238cf84f90dda9961064f5ea44761d/ghc >--------------------------------------------------------------- commit c22cd7cc28238cf84f90dda9961064f5ea44761d Author: Ben Gamari Date: Wed Feb 8 23:31:04 2017 -0500 testsuite: Add testcase for #13248 >--------------------------------------------------------------- c22cd7cc28238cf84f90dda9961064f5ea44761d testsuite/tests/typecheck/should_compile/T13248.hs | 12 ++++++++++++ testsuite/tests/typecheck/should_compile/all.T | 1 + 2 files changed, 13 insertions(+) diff --git a/testsuite/tests/typecheck/should_compile/T13248.hs b/testsuite/tests/typecheck/should_compile/T13248.hs new file mode 100644 index 0000000..b2eebc7 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T13248.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE TypeFamilies, TypeFamilyDependencies, UndecidableInstances #-} + +type family Foo a = r | r -> a where + Foo Int = Char + Foo Integer = String + +type family Bar a = r | r -> a where + Bar Char = Double + Bar String = Float + +type family Baz a = r | r -> a where + Baz x = Bar (Foo x) diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index ccebf75..7d2e3c6 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -535,3 +535,4 @@ test('T13083', normal, compile, ['']) test('T11723', normal, compile, ['']) test('T12987', normal, compile, ['']) test('T11736', normal, compile, ['']) +test('T13248', expect_broken(13248), compile, ['']) From git at git.haskell.org Thu Feb 9 21:34:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Feb 2017 21:34:19 +0000 (UTC) Subject: [commit: ghc] master: Bump bytestring submodule (b92ca83) Message-ID: <20170209213419.5A5753A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b92ca83eed162764ab50f1a9e7b73a70988a3551/ghc >--------------------------------------------------------------- commit b92ca83eed162764ab50f1a9e7b73a70988a3551 Author: Ben Gamari Date: Wed Feb 8 17:41:51 2017 -0500 Bump bytestring submodule >--------------------------------------------------------------- b92ca83eed162764ab50f1a9e7b73a70988a3551 libraries/bytestring | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/bytestring b/libraries/bytestring index 84253da..ce3c6a0 160000 --- a/libraries/bytestring +++ b/libraries/bytestring @@ -1 +1 @@ -Subproject commit 84253da85952765dd7631e467cc2b1d1bba03f24 +Subproject commit ce3c6a01cd9e2438358108e3e4b515304b5ce5a6 From git at git.haskell.org Thu Feb 9 21:34:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 9 Feb 2017 21:34:22 +0000 (UTC) Subject: [commit: ghc] master: Guard rewritableTyVarsOfType (a5a6c52) Message-ID: <20170209213422.136573A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a5a6c527bed408d8ed43b83a1e9cd69693553779/ghc >--------------------------------------------------------------- commit a5a6c527bed408d8ed43b83a1e9cd69693553779 Author: Simon Peyton Jones Date: Thu Feb 9 12:12:21 2017 +0000 Guard rewritableTyVarsOfType We only want to use rewriteableTyVarsOfType on CDictCan, CFunEqCan (and maybe CIrredCan). But not CTyEqCan. But we were -- for insolubles. So I narrowed the scope of the insuluble kick-out. >--------------------------------------------------------------- a5a6c527bed408d8ed43b83a1e9cd69693553779 compiler/typecheck/TcSMonad.hs | 25 +++++++++++----------- compiler/typecheck/TcType.hs | 2 ++ .../typecheck/should_fail/FrozenErrorTests.stderr | 5 +++-- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/compiler/typecheck/TcSMonad.hs b/compiler/typecheck/TcSMonad.hs index 7bc955b..1be1724 100644 --- a/compiler/typecheck/TcSMonad.hs +++ b/compiler/typecheck/TcSMonad.hs @@ -1495,24 +1495,25 @@ kick_out_rewritable new_fr new_tv ics@(IC { inert_eqs = tv_eqs -- See Note [Kicking out CFunEqCan for fundeps] (dicts_out, dicts_in) = partitionDicts kick_out_ct dictmap (irs_out, irs_in) = partitionBag kick_out_ct irreds - (insols_out, insols_in) = partitionBag kick_out_ct insols - -- Kick out even insolubles; see Note [Kick out insolubles] + (insols_out, insols_in) = partitionBag kick_out_insol insols fr_may_rewrite :: CtFlavourRole -> Bool fr_may_rewrite fs = new_fr `eqMayRewriteFR` fs -- Can the new item rewrite the inert item? + kick_out_insol :: Ct -> Bool + -- See Note [Kick out insolubles] + kick_out_insol (CTyEqCan { cc_tyvar = tv }) = new_tv == tv + kick_out_insol _ = False + kick_out_ct :: Ct -> Bool - -- Kick it out if the new CTyEqCan can rewrite the inert - -- one. See Note [kickOutRewritable] - -- Or if it has no shadow and the shadow - kick_out_ct ct = kick_out_ev (ctEvidence ct) - - kick_out_ev :: CtEvidence -> Bool - -- Kick it out if the new CTyEqCan can rewrite the inert - -- one. See Note [kickOutRewritable] - kick_out_ev ev = fr_may_rewrite (ctEvFlavourRole ev) - && new_tv `elemVarSet` rewritableTyVarsOfType (ctEvPred ev) + -- Kick it out if the new CTyEqCan can rewrite the inert one + -- See Note [kickOutRewritable] + -- Used only on CFunEqCan, CDictCan, CIrredCan + -- hence no forallls in (ctEvPred ev), hence rewriteableTyVarsOfType ok + kick_out_ct ct | let ev = ctEvidence ct + = fr_may_rewrite (ctEvFlavourRole ev) + && new_tv `elemVarSet` rewritableTyVarsOfType (ctEvPred ev) -- NB: this includes the fsk of a CFunEqCan. It can't -- actually be rewritten, but we need to kick it out -- so we get to take advantage of injectivity diff --git a/compiler/typecheck/TcType.hs b/compiler/typecheck/TcType.hs index a2d8063..2dffed2 100644 --- a/compiler/typecheck/TcType.hs +++ b/compiler/typecheck/TcType.hs @@ -891,6 +891,8 @@ rewritableTyVarsOfTypes tys = mapUnionVarSet rewritableTyVarsOfType tys rewritableTyVarsOfType :: TcType -> TcTyVarSet -- Used during kick-out from the inert set +-- This function is used for the arguments of class and type families, +-- which should not have any foralls in them -- Ignores coercions and casts, because rewriting those does -- not help solving, and it's more efficient to ignore them rewritableTyVarsOfType ty diff --git a/testsuite/tests/typecheck/should_fail/FrozenErrorTests.stderr b/testsuite/tests/typecheck/should_fail/FrozenErrorTests.stderr index bff6ba5..2ad8d45 100644 --- a/testsuite/tests/typecheck/should_fail/FrozenErrorTests.stderr +++ b/testsuite/tests/typecheck/should_fail/FrozenErrorTests.stderr @@ -24,7 +24,7 @@ FrozenErrorTests.hs:29:15: error: In an equation for ‘test2’: test2 = goo2 (goo1 False undefined) FrozenErrorTests.hs:30:9: error: - • Couldn't match type ‘Int’ with ‘[Int]’ + • Couldn't match type ‘[Int]’ with ‘[[Int]]’ arising from a use of ‘goo1’ • In the expression: goo1 False (goo2 undefined) In an equation for ‘test3’: test3 = goo1 False (goo2 undefined) @@ -39,7 +39,8 @@ FrozenErrorTests.hs:45:15: error: test4 :: T2 (T2 c c) c (bound at FrozenErrorTests.hs:45:1) FrozenErrorTests.hs:46:9: error: - • Couldn't match type ‘T2 c c’ with ‘M (T2 (T2 c c) c)’ + • Couldn't match type ‘T2 (T2 c c) c’ + with ‘T2 (M (T2 (T2 c c) c)) (T2 (T2 c c) c)’ arising from a use of ‘goo3’ • In the expression: goo3 False (goo4 undefined) In an equation for ‘test5’: test5 = goo3 False (goo4 undefined) From git at git.haskell.org Fri Feb 10 02:23:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 10 Feb 2017 02:23:10 +0000 (UTC) Subject: [commit: ghc] branch 'fd/fix-travis' created Message-ID: <20170210022310.9E1603A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : fd/fix-travis Referencing: 969bc7be4a26bf46bce0cf2a22b8487e3bb45dc4 From git at git.haskell.org Fri Feb 10 02:23:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 10 Feb 2017 02:23:13 +0000 (UTC) Subject: [commit: ghc] fd/fix-travis: Relax test TH_addCStub2 so it succeeds on travis. (969bc7b) Message-ID: <20170210022313.505C33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : fd/fix-travis Link : http://ghc.haskell.org/trac/ghc/changeset/969bc7be4a26bf46bce0cf2a22b8487e3bb45dc4/ghc >--------------------------------------------------------------- commit 969bc7be4a26bf46bce0cf2a22b8487e3bb45dc4 Author: Facundo Domínguez Date: Thu Feb 9 23:20:17 2017 -0300 Relax test TH_addCStub2 so it succeeds on travis. >--------------------------------------------------------------- 969bc7be4a26bf46bce0cf2a22b8487e3bb45dc4 testsuite/tests/th/TH_addCStub2.stderr | 5 ----- testsuite/tests/th/all.T | 11 ++++++++++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/testsuite/tests/th/TH_addCStub2.stderr b/testsuite/tests/th/TH_addCStub2.stderr index ba3277b..5095103 100644 --- a/testsuite/tests/th/TH_addCStub2.stderr +++ b/testsuite/tests/th/TH_addCStub2.stderr @@ -1,6 +1 @@ - TH_addCStub2.hs:13:13: - expected ‘;’, ‘,’ or ‘)’ before ‘{’ token - [ "#include " - ^ -`gcc' failed in phase `C Compiler'. (Exit code: 1) diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index 9a08b65..f710089 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -63,8 +63,17 @@ test('TH_reifyDecl2', normal, compile, ['-v0']) test('TH_reifyLocalDefs', normal, compile, ['-v0']) test('TH_reifyLocalDefs2', normal, compile, ['-v0']) + +# Filters the output of an appended command with the given pattern. +def grep_stderr_of(pattern): + swap12 = '3>&1 1>&2 2>&3 3>&-' # Swap file descriptors 1 and 2. + # pipefail: fail if the command fails + return('bash -o pipefail -c \'"$@" {swap12} | grep {pattern} {swap12}\' --'.format(**locals())) + test('TH_addCStub1', normal, compile_and_run, ['-v0']) -test('TH_addCStub2', normal, compile_fail, ['-v0']) +test('TH_addCStub2', + [normal, compile_cmd_prefix(grep_stderr_of('TH_addCStub2.hs:13:13:'))] + , compile_fail, ['-v0']) test('TH_reifyMkName', normal, compile, ['-v0']) From git at git.haskell.org Fri Feb 10 10:42:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 10 Feb 2017 10:42:58 +0000 (UTC) Subject: [commit: ghc] master: TH-spliced class instances are pretty-printed incorrectly post-#3384 (258c719) Message-ID: <20170210104258.908C23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/258c719599f78178c75b58d9c49e10e498cb7c48/ghc >--------------------------------------------------------------- commit 258c719599f78178c75b58d9c49e10e498cb7c48 Author: Alan Zimmerman Date: Sun Jan 29 22:35:41 2017 +0200 TH-spliced class instances are pretty-printed incorrectly post-#3384 Summary: The HsSyn prettyprinter tests patch 499e43824bda967546ebf95ee33ec1f84a114a7c broke the pretty-printing of Template Haskell-spliced class instances. Test Plan: ./validate Reviewers: RyanGlScott, austin, goldfire, bgamari Reviewed By: RyanGlScott, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3043 >--------------------------------------------------------------- 258c719599f78178c75b58d9c49e10e498cb7c48 compiler/hsSyn/Convert.hs | 42 ++++++++++--- compiler/hsSyn/HsExpr.hs | 34 +++++----- compiler/hsSyn/HsUtils.hs | 2 +- compiler/rename/RnSplice.hs | 6 -- compiler/typecheck/TcExpr.hs | 2 +- compiler/typecheck/TcGenGenerics.hs | 9 ++- compiler/typecheck/TcSplice.hs | 2 +- compiler/typecheck/TcTypeable.hs | 6 +- ghc/GHCi/UI.hs | 3 +- testsuite/tests/ghci/scripts/T10508.stderr | 2 +- .../should_compile/DumpTypecheckedAst.stderr | 72 ++++++++++++---------- testsuite/tests/printer/Makefile | 4 ++ testsuite/tests/printer/T13199.hs | 38 ++++++++++++ testsuite/tests/printer/T13199.stdout | 48 +++++++++++++++ testsuite/tests/printer/all.T | 1 + testsuite/tests/th/T12530.stderr | 2 +- 16 files changed, 201 insertions(+), 72 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 258c719599f78178c75b58d9c49e10e498cb7c48 From git at git.haskell.org Fri Feb 10 12:18:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 10 Feb 2017 12:18:09 +0000 (UTC) Subject: [commit: ghc] branch 'fd/fix-travis2' created Message-ID: <20170210121809.B54563A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : fd/fix-travis2 Referencing: db92ab81e8a8ab925f2074fb0a90c72a0187a058 From git at git.haskell.org Fri Feb 10 12:18:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 10 Feb 2017 12:18:12 +0000 (UTC) Subject: [commit: ghc] fd/fix-travis2: Relax test TH_addCStub2 so it succeeds on travis. (db92ab8) Message-ID: <20170210121812.68E343A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : fd/fix-travis2 Link : http://ghc.haskell.org/trac/ghc/changeset/db92ab81e8a8ab925f2074fb0a90c72a0187a058/ghc >--------------------------------------------------------------- commit db92ab81e8a8ab925f2074fb0a90c72a0187a058 Author: Facundo Domínguez Date: Thu Feb 9 23:20:17 2017 -0300 Relax test TH_addCStub2 so it succeeds on travis. >--------------------------------------------------------------- db92ab81e8a8ab925f2074fb0a90c72a0187a058 testsuite/tests/th/TH_addCStub2.stderr | 6 ------ testsuite/tests/th/all.T | 12 +++++++++++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/testsuite/tests/th/TH_addCStub2.stderr b/testsuite/tests/th/TH_addCStub2.stderr deleted file mode 100644 index ba3277b..0000000 --- a/testsuite/tests/th/TH_addCStub2.stderr +++ /dev/null @@ -1,6 +0,0 @@ - -TH_addCStub2.hs:13:13: - expected ‘;’, ‘,’ or ‘)’ before ‘{’ token - [ "#include " - ^ -`gcc' failed in phase `C Compiler'. (Exit code: 1) diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index 9a08b65..7eb104c 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -63,8 +63,18 @@ test('TH_reifyDecl2', normal, compile, ['-v0']) test('TH_reifyLocalDefs', normal, compile, ['-v0']) test('TH_reifyLocalDefs2', normal, compile, ['-v0']) + +# Checks if the error output of an appended command has the given pattern. +def error_has(pattern): + swap12 = '3>&1 1>&2 2>&3 3>&-' # Swap file descriptors 1 and 2. + # pipefail: make a pipe fail if any of the commands fails + # the following fails only if both the command fails and the pattern is found + return('bash -o pipefail -c \'! (! "$@" {swap12}) | grep {pattern} {swap12} &> /dev/null\' --'.format(**locals())) + test('TH_addCStub1', normal, compile_and_run, ['-v0']) -test('TH_addCStub2', normal, compile_fail, ['-v0']) +test('TH_addCStub2' + , [compile_cmd_prefix(error_has('TH_addCStub2.hs:13:13:'))] + , compile_fail, ['-v0']) test('TH_reifyMkName', normal, compile, ['-v0']) From git at git.haskell.org Fri Feb 10 12:41:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 10 Feb 2017 12:41:41 +0000 (UTC) Subject: [commit: ghc] master: Spelling in comments [ci skip] (3211fa0) Message-ID: <20170210124141.03F153A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3211fa06744731ec117219fe50a304e952e072ef/ghc >--------------------------------------------------------------- commit 3211fa06744731ec117219fe50a304e952e072ef Author: Gabor Greif Date: Fri Feb 10 09:12:12 2017 +0100 Spelling in comments [ci skip] >--------------------------------------------------------------- 3211fa06744731ec117219fe50a304e952e072ef compiler/specialise/Specialise.hs | 2 +- compiler/typecheck/TcInstDcls.hs | 2 +- compiler/typecheck/TcSMonad.hs | 6 +++--- compiler/typecheck/TcType.hs | 2 +- rts/Adjustor.c | 2 +- rules/hs-suffix-way-rules.mk | 6 +++--- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/compiler/specialise/Specialise.hs b/compiler/specialise/Specialise.hs index 2b4d9f5..0090417 100644 --- a/compiler/specialise/Specialise.hs +++ b/compiler/specialise/Specialise.hs @@ -145,7 +145,7 @@ becomes fl We still have recusion for non-overloaded functions which we -speciailise, but the recursive call should get specialised to the +specialise, but the recursive call should get specialised to the same recursive version. diff --git a/compiler/typecheck/TcInstDcls.hs b/compiler/typecheck/TcInstDcls.hs index 9298b10..95d33dd 100644 --- a/compiler/typecheck/TcInstDcls.hs +++ b/compiler/typecheck/TcInstDcls.hs @@ -988,7 +988,7 @@ tcSuperClasses :: DFunId -> Class -> [TcTyVar] -> [EvVar] -> [TcType] -- $Ordp1 = /\a \(d:Ord a). dfunEqList a (sc_sel d) -- -- See Note [Recursive superclasses] for why this is so hard! --- In effect, be build a special-purpose solver for the first step +-- In effect, we build a special-purpose solver for the first step -- of solving each superclass constraint tcSuperClasses dfun_id cls tyvars dfun_evs inst_tys dfun_ev_binds sc_theta = do { (ids, binds, implics) <- mapAndUnzip3M tc_super (zip sc_theta [fIRST_TAG..]) diff --git a/compiler/typecheck/TcSMonad.hs b/compiler/typecheck/TcSMonad.hs index 1be1724..4fb0632 100644 --- a/compiler/typecheck/TcSMonad.hs +++ b/compiler/typecheck/TcSMonad.hs @@ -797,7 +797,7 @@ Theorem [Stability under extension] is an inert generalised substitution. Conditions (T1-T3) are established by the canonicaliser -Conditions (K1-K3) are established by TcSMonad.kickOutRewriteable +Conditions (K1-K3) are established by TcSMonad.kickOutRewritable The idea is that * (T1-2) are guaranteed by exhaustively rewriting the work-item @@ -1077,7 +1077,7 @@ work? * CDictCan (C tys) or CFunEqCan (F tys ~ fsk): Yes if the inert set could rewrite tys to make the class constraint, or type family, fire. That is, yes if the inert_eqs intersects - with the free vars of tys. For this test we use rewriteableTyVars + with the free vars of tys. For this test we use rewritableTyVars which ignores casts and coercions in tys, because rewriting the casts or coercions won't make the thing fire more often. @@ -1510,7 +1510,7 @@ kick_out_rewritable new_fr new_tv ics@(IC { inert_eqs = tv_eqs -- Kick it out if the new CTyEqCan can rewrite the inert one -- See Note [kickOutRewritable] -- Used only on CFunEqCan, CDictCan, CIrredCan - -- hence no forallls in (ctEvPred ev), hence rewriteableTyVarsOfType ok + -- hence no foralls in (ctEvPred ev), hence rewritableTyVarsOfType ok kick_out_ct ct | let ev = ctEvidence ct = fr_may_rewrite (ctEvFlavourRole ev) && new_tv `elemVarSet` rewritableTyVarsOfType (ctEvPred ev) diff --git a/compiler/typecheck/TcType.hs b/compiler/typecheck/TcType.hs index 2dffed2..0e1ad7f 100644 --- a/compiler/typecheck/TcType.hs +++ b/compiler/typecheck/TcType.hs @@ -903,7 +903,7 @@ rewritableTyVarsOfType ty go (TyConApp _ tys) = rewritableTyVarsOfTypes tys go (AppTy fun arg) = go fun `unionVarSet` go arg go (FunTy arg res) = go arg `unionVarSet` go res - go ty@(ForAllTy {}) = pprPanic "rewriteableTyVarOfType" (ppr ty) + go ty@(ForAllTy {}) = pprPanic "rewritableTyVarOfType" (ppr ty) go (CastTy ty _co) = go ty go (CoercionTy _co) = emptyVarSet diff --git a/rts/Adjustor.c b/rts/Adjustor.c index 5f047b3..9f5a000 100644 --- a/rts/Adjustor.c +++ b/rts/Adjustor.c @@ -78,7 +78,7 @@ extern void *adjustorCode; * recover the writable address, we subtract 1 word from the executable * address and fetch. This works because Linux kernel magic gives us two * pointers with different addresses that refer to the same memory. Whatever - * you write into the writeable address can be read back at the executable + * you write into the writable address can be read back at the executable * address. This method is very efficient. * * On iOS this breaks for two reasons: 1. the two pointers do not refer to diff --git a/rules/hs-suffix-way-rules.mk b/rules/hs-suffix-way-rules.mk index d7b4520..b77806f 100644 --- a/rules/hs-suffix-way-rules.mk +++ b/rules/hs-suffix-way-rules.mk @@ -55,8 +55,8 @@ else # needs to make a choice which of the above two implicit rules to follow (it # never runs 2 recipes for the same target, unless double colon rules are # used, which we don't), logically it will choose the first rule: Lexer.o will -# depend on Lexer.hs in the build directory, that file will be build, and then -# Lexer.o can be build. +# depend on Lexer.hs in the build directory, that file will be built, and then +# Lexer.o can be built. # # In an sdist however, Lexer.hs is present in the source directory. It was # copied there during the creation of the sdist by a rule in @@ -65,7 +65,7 @@ else # building from sdist and 2) the sdist creation process renamed Lexer.x to # Lexer.x.source. So normally make would now choose the second rule: Lexer.o # will depend on Lexer.hs in the source directory, for which nothing needs to -# be done, and then Lexer.o can be build. +# be done, and then Lexer.o can be built. # # There is however another actor in play, a rule in sdist-ghc-file.mk, which # after after instantiating with the same directory ($1=utils/genprimops) and From git at git.haskell.org Fri Feb 10 14:20:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 10 Feb 2017 14:20:27 +0000 (UTC) Subject: [commit: ghc] master: Change rewritableTyVarsOfType to anyRewritableTyVar (76244ec) Message-ID: <20170210142027.7D82E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/76244ec2cbdef8e3cd54466ae0b55ecffb81817c/ghc >--------------------------------------------------------------- commit 76244ec2cbdef8e3cd54466ae0b55ecffb81817c Author: Simon Peyton Jones Date: Fri Feb 10 13:54:48 2017 +0000 Change rewritableTyVarsOfType to anyRewritableTyVar This fixes the regression in FrozenErrorTests, eliminates the awkward "crash on forall" in rewritableTyVars, and makes it more efficient too. >--------------------------------------------------------------- 76244ec2cbdef8e3cd54466ae0b55ecffb81817c compiler/typecheck/TcSMonad.hs | 56 ++++++++++------------ compiler/typecheck/TcType.hs | 55 +++++++++++++-------- .../typecheck/should_fail/FrozenErrorTests.stderr | 5 +- 3 files changed, 61 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 76244ec2cbdef8e3cd54466ae0b55ecffb81817c From git at git.haskell.org Fri Feb 10 15:34:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 10 Feb 2017 15:34:59 +0000 (UTC) Subject: [commit: ghc] master: Prevent Template Haskell splices from throwing a spurious TypeInType error (283a346) Message-ID: <20170210153459.791733A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/283a346586e5bf711ecd8cc61263d87771f8f744/ghc >--------------------------------------------------------------- commit 283a346586e5bf711ecd8cc61263d87771f8f744 Author: Ryan Scott Date: Fri Feb 10 10:31:10 2017 -0500 Prevent Template Haskell splices from throwing a spurious TypeInType error Summary: There was a rather annoying corner case where splicing poly-kinded Template Haskell declarations could trigger an error muttering about `TypeInType` not being enabled, whereas the equivalent non-TH code would compile without issue. This was causing by overzealous validity check in the renamer, wherein failed to distinguish between two different `Exact` names with the same `OccName`. As a result, it mistakenly believed some type variables were being used as both type and kind variables simultaneously! Ack. This avoids the issue by simply disabling the aforementioned validity check for Exact names. Fixes #12503. Test Plan: ./validate Reviewers: austin, bgamari, goldfire Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3022 >--------------------------------------------------------------- 283a346586e5bf711ecd8cc61263d87771f8f744 compiler/rename/RnTypes.hs | 40 ++++++++++++++++++++++++++++++++++++++-- testsuite/tests/th/T12503.hs | 29 +++++++++++++++++++++++++++++ testsuite/tests/th/all.T | 1 + 3 files changed, 68 insertions(+), 2 deletions(-) diff --git a/compiler/rename/RnTypes.hs b/compiler/rename/RnTypes.hs index 91d6978..9cf78c2 100644 --- a/compiler/rename/RnTypes.hs +++ b/compiler/rename/RnTypes.hs @@ -1692,18 +1692,20 @@ extract_tv t_or_k ltv@(L _ tv) acc | isRdrTyVar tv = case acc of FKTV kvs k_set tvs t_set all | isTypeLevel t_or_k - -> do { when (occ `elemOccSet` k_set) $ + -> do { when (not_exact && occ `elemOccSet` k_set) $ mixedVarsErr ltv ; return (FKTV kvs k_set (ltv : tvs) (t_set `extendOccSet` occ) (ltv : all)) } | otherwise - -> do { when (occ `elemOccSet` t_set) $ + -> do { when (not_exact && occ `elemOccSet` t_set) $ mixedVarsErr ltv ; return (FKTV (ltv : kvs) (k_set `extendOccSet` occ) tvs t_set (ltv : all)) } | otherwise = return acc where occ = rdrNameOcc tv + -- See Note [TypeInType validity checking and Template Haskell] + not_exact = not $ isExact tv mixedVarsErr :: Located RdrName -> RnM () mixedVarsErr (L loc tv) @@ -1716,3 +1718,37 @@ mixedVarsErr (L loc tv) -- just used in this module; seemed convenient here nubL :: Eq a => [Located a] -> [Located a] nubL = nubBy eqLocated + +{- +Note [TypeInType validity checking and Template Haskell] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +extract_tv enforces an invariant that no variable can be used as both a kind +and a type unless -XTypeInType is enabled. It does so by accumulating two sets +of variables' OccNames (one for type variables and one for kind variables) that +it has seen before. If a new type variable's OccName appears in the kind set, +then it errors, and similarly for kind variables and the type set. + +This relies on the assumption that any two variables with the same OccName +are the same. While this is always true of user-written code, it is not always +true in the presence of Template Haskell! GHC Trac #12503 demonstrates a +scenario where two different Exact TH-generated names can have the same +OccName. As a result, if one of these Exact names is for a type variable +and the other Exact name is for a kind variable, then extracting them both +can lead to a spurious error in extract_tv. + +To avoid such a scenario, we simply don't check the invariant in extract_tv +when the name is Exact. This allows Template Haskell users to write code that +uses -XPolyKinds without needing to enable -XTypeInType. + +This is a somewhat arbitrary design choice, as adding this special case causes +this code to be accepted when spliced in via Template Haskell: + + data T1 k e + class C1 b + instance C1 (T1 k (e :: k)) + +Even if -XTypeInType is _not enabled. But accepting too many programs without +the prerequisite GHC extensions is better than the alternative, where some +programs would not be accepted unless enabling an extension which has nothing +to do with the code itself. +-} diff --git a/testsuite/tests/th/T12503.hs b/testsuite/tests/th/T12503.hs new file mode 100644 index 0000000..517c4ba --- /dev/null +++ b/testsuite/tests/th/T12503.hs @@ -0,0 +1,29 @@ +{-# LANGUAGE KindSignatures #-} +{-# LANGUAGE PolyKinds #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE TypeFamilies #-} +module T12503 where + +import Language.Haskell.TH + +data T1 k +class C1 a + +$(do TyConI (DataD [] tName [ KindedTV kName kKind] _ _ _) + <- reify ''T1 + d <- instanceD (cxt []) + (conT ''C1 `appT` + (conT tName `appT` sigT (varT kName) kKind)) + [] + return [d]) + +data family T2 (a :: b) +data instance T2 b +class C2 a + +$(do FamilyI (DataFamilyD tName _ _) [DataInstD [] _ [tyVar] _ _ _] + <- reify ''T2 + d <- instanceD (cxt []) + (conT ''C2 `appT` (conT tName `appT` return tyVar)) + [] + return [d]) diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index 9a08b65..56aca1a 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -363,6 +363,7 @@ test('T12478_2', omit_ways(['ghci']), compile_and_run, ['-v0']) test('T12478_3', omit_ways(['ghci']), compile, ['-v0']) test('T12478_4', omit_ways(['ghci']), compile_fail, ['-v0']) test('T12478_5', omit_ways(['ghci']), compile, ['-v0']) +test('T12503', normal, compile, ['-v0']) test('T12513', omit_ways(['ghci']), compile_fail, ['-v0']) test('T12530', normal, compile, ['-v0 -ddump-splices -dsuppress-uniques']) test('T12646', normal, compile, ['-v0']) From git at git.haskell.org Fri Feb 10 15:44:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 10 Feb 2017 15:44:58 +0000 (UTC) Subject: [commit: ghc] branch 'wip/rwbarton-D2992' created Message-ID: <20170210154458.B36FD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/rwbarton-D2992 Referencing: 640cf03259c74f9f8eacf539337192d3c56d4b8b From git at git.haskell.org Fri Feb 10 15:45:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 10 Feb 2017 15:45:01 +0000 (UTC) Subject: [commit: ghc] wip/rwbarton-D2992: Fix implementation of nameIsHomePackage (da3bace) Message-ID: <20170210154501.758E53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rwbarton-D2992 Link : http://ghc.haskell.org/trac/ghc/changeset/da3baceeb0df05fd60ef2f0a38f0202a4828fd91/ghc >--------------------------------------------------------------- commit da3baceeb0df05fd60ef2f0a38f0202a4828fd91 Author: Reid Barton Date: Thu Feb 9 15:14:58 2017 -0500 Fix implementation of nameIsHomePackage >--------------------------------------------------------------- da3baceeb0df05fd60ef2f0a38f0202a4828fd91 compiler/basicTypes/Name.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/compiler/basicTypes/Name.hs b/compiler/basicTypes/Name.hs index 7cb2939..5d47613 100644 --- a/compiler/basicTypes/Name.hs +++ b/compiler/basicTypes/Name.hs @@ -273,9 +273,11 @@ nameIsLocalOrFrom from name nameIsHomePackage :: Module -> Name -> Bool -- True if the Name is defined in module of this package nameIsHomePackage this_mod - = \nm -> case nameModule_maybe nm of - Nothing -> False - Just nm_mod -> moduleUnitId nm_mod == this_pkg + = \nm -> case n_sort nm of + External nm_mod -> moduleUnitId nm_mod == this_pkg + WiredIn nm_mod _ _ -> moduleUnitId nm_mod == this_pkg + Internal -> True + System -> False where this_pkg = moduleUnitId this_mod From git at git.haskell.org Fri Feb 10 15:45:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 10 Feb 2017 15:45:04 +0000 (UTC) Subject: [commit: ghc] wip/rwbarton-D2992: Add a reference to #13251 in the big Note (640cf03) Message-ID: <20170210154504.2ABDD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rwbarton-D2992 Link : http://ghc.haskell.org/trac/ghc/changeset/640cf03259c74f9f8eacf539337192d3c56d4b8b/ghc >--------------------------------------------------------------- commit 640cf03259c74f9f8eacf539337192d3c56d4b8b Author: Reid Barton Date: Thu Feb 9 15:22:32 2017 -0500 Add a reference to #13251 in the big Note >--------------------------------------------------------------- 640cf03259c74f9f8eacf539337192d3c56d4b8b compiler/typecheck/FamInst.hs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/compiler/typecheck/FamInst.hs b/compiler/typecheck/FamInst.hs index 0229c84..b6b85b1 100644 --- a/compiler/typecheck/FamInst.hs +++ b/compiler/typecheck/FamInst.hs @@ -127,6 +127,13 @@ module. Otherwise, we'll end up with no record of the fact that M depends on this family instance and type safety will be compromised. See #13102. +* It can also happen that M uses a function defined in another module +which is not transitively imported by M. Examples include the +desugaring of various overloaded constructs, and references inserted +by Template Haskell splices. If that function's definition makes use +of type family instances which are not checked against those visible +visible from M, type safety can again be compromised. See #13251. + * When a module C imports a boot module B.hs-boot, we check that C's type family instances are compatible with those visible from B.hs-boot. However, C will eventually be linked against a different From git at git.haskell.org Fri Feb 10 15:45:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 10 Feb 2017 15:45:06 +0000 (UTC) Subject: [commit: ghc] wip/rwbarton-D2992: Check local type family instances against all imported ones (28da0a9) Message-ID: <20170210154506.EFC9A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rwbarton-D2992 Link : http://ghc.haskell.org/trac/ghc/changeset/28da0a94ea7640a94565500ee66093816f2cfe7f/ghc >--------------------------------------------------------------- commit 28da0a94ea7640a94565500ee66093816f2cfe7f Author: Reid Barton Date: Wed Feb 8 17:55:31 2017 -0500 Check local type family instances against all imported ones Summary: We previously checked type family instance declarations in a module for consistency with all instances that we happened to have read into the EPS or HPT. It was possible to arrange that an imported type family instance (used by an imported function) was in a module whose interface file was never read during compilation; then we wouldn't check consistency of local instances with this imported instance and as a result type safety was lost. With this patch, we still check consistency of local type family instances with all type family instances that we have loaded; but we make sure to load the interface files of all our imports that define family instances first. More selective consistency checking is left to #13102. On the other hand, we can now safely assume when we import a module that it has been checked for consistency with its imports. So we can save checking in checkFamInstConsistency, and overall we should have less work to do now. This patch also adds a note describing the Plan for ensuring type family consistency. Test Plan: Two new tests added; harbormaster Reviewers: bgamari, austin, simonpj Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2992 >--------------------------------------------------------------- 28da0a94ea7640a94565500ee66093816f2cfe7f compiler/basicTypes/Name.hs | 12 +- compiler/main/HscTypes.hs | 7 +- compiler/typecheck/FamInst.hs | 151 +++++++++++++++++++-- compiler/typecheck/TcRnDriver.hs | 16 ++- testsuite/tests/ghci/scripts/T4175.stdout | 2 +- .../indexed-types/should_compile/T13092b/Makefile | 10 ++ .../should_compile/T13092b/T13092b_1.hs | 7 + .../should_compile/T13092b/T13092b_2.hs | 8 ++ .../indexed-types/should_compile/T13092b/all.T | 5 + .../tests/indexed-types/should_fail/T13092/A.hs | 3 + .../tests/indexed-types/should_fail/T13092/B.hs | 5 + .../tests/indexed-types/should_fail/T13092/C.hs | 6 + .../tests/indexed-types/should_fail/T13092/Main.hs | 18 +++ .../indexed-types/should_fail/T13092/Makefile | 9 ++ .../indexed-types/should_fail/T13092/T13092.stderr | 5 + .../tests/indexed-types/should_fail/T13092/all.T | 5 + .../indexed-types/should_fail/T13092c/Makefile | 12 ++ .../should_fail/T13092c/T13092c.stderr | 5 + .../indexed-types/should_fail/T13092c/T13092c_1.hs | 6 + .../indexed-types/should_fail/T13092c/T13092c_2.hs | 8 ++ .../indexed-types/should_fail/T13092c/T13092c_3.hs | 5 + .../indexed-types/should_fail/T13092c/T13092c_4.hs | 7 + .../tests/indexed-types/should_fail/T13092c/all.T | 8 ++ 23 files changed, 301 insertions(+), 19 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 28da0a94ea7640a94565500ee66093816f2cfe7f From git at git.haskell.org Fri Feb 10 20:40:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 10 Feb 2017 20:40:01 +0000 (UTC) Subject: [commit: ghc] master: Relax test TH_addCStub2 so it succeeds on travis. (e79ef75) Message-ID: <20170210204001.3FFC33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e79ef75d9a224ab1eac1c237e686bcaef97b8e9c/ghc >--------------------------------------------------------------- commit e79ef75d9a224ab1eac1c237e686bcaef97b8e9c Author: Facundo Domínguez Date: Thu Feb 9 23:20:17 2017 -0300 Relax test TH_addCStub2 so it succeeds on travis. Test Plan: ./validate Reviewers: bgamari, nomeata, austin, mpickering Reviewed By: mpickering Subscribers: mpickering, rwbarton, mboes, thomie Differential Revision: https://phabricator.haskell.org/D3124 >--------------------------------------------------------------- e79ef75d9a224ab1eac1c237e686bcaef97b8e9c testsuite/tests/th/TH_addCStub2.stderr | 6 ------ testsuite/tests/th/all.T | 12 +++++++++++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/testsuite/tests/th/TH_addCStub2.stderr b/testsuite/tests/th/TH_addCStub2.stderr deleted file mode 100644 index ba3277b..0000000 --- a/testsuite/tests/th/TH_addCStub2.stderr +++ /dev/null @@ -1,6 +0,0 @@ - -TH_addCStub2.hs:13:13: - expected ‘;’, ‘,’ or ‘)’ before ‘{’ token - [ "#include " - ^ -`gcc' failed in phase `C Compiler'. (Exit code: 1) diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index 56aca1a..47da8df 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -63,8 +63,18 @@ test('TH_reifyDecl2', normal, compile, ['-v0']) test('TH_reifyLocalDefs', normal, compile, ['-v0']) test('TH_reifyLocalDefs2', normal, compile, ['-v0']) + +# Checks if the error output of an appended command has the given pattern. +def error_has(pattern): + swap12 = '3>&1 1>&2 2>&3 3>&-' # Swap file descriptors 1 and 2. + # pipefail: make a pipe fail if any of the commands fails + # the following fails only if both the command fails and the pattern is found + return('bash -o pipefail -c \'! (! "$@" {swap12}) | grep {pattern} {swap12} &> /dev/null\' --'.format(**locals())) + test('TH_addCStub1', normal, compile_and_run, ['-v0']) -test('TH_addCStub2', normal, compile_fail, ['-v0']) +test('TH_addCStub2' + , [compile_cmd_prefix(error_has('TH_addCStub2.hs:13:'))] + , compile_fail, ['-v0']) test('TH_reifyMkName', normal, compile, ['-v0']) From git at git.haskell.org Fri Feb 10 21:24:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 10 Feb 2017 21:24:13 +0000 (UTC) Subject: [commit: ghc] master: Refactor DeriveAnyClass's instance context inference (639e702) Message-ID: <20170210212413.B1C033A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/639e702b6129f501c539b158b982ed8489e3d09c/ghc >--------------------------------------------------------------- commit 639e702b6129f501c539b158b982ed8489e3d09c Author: Ryan Scott Date: Fri Feb 10 16:12:46 2017 -0500 Refactor DeriveAnyClass's instance context inference Summary: Currently, `DeriveAnyClass` has two glaring flaws: * It only works on classes whose argument is of kind `*` or `* -> *` (#9821). * The way it infers constraints makes no sense. It basically co-opts the algorithms used to infer contexts for `Eq` (for `*`-kinded arguments) or `Functor` (for `(* -> *)`-kinded arguments). This tends to produce overly constrained instances, which in extreme cases can lead to legitimate things failing to typecheck (#12594). Or even worse, it can trigger GHC panics (#12144 and #12423). This completely reworks the way `DeriveAnyClass` infers constraints to fix these two issues. It now uses the type signatures of the derived class's methods to infer constraints (and to simplify them). A high-level description of how this works is included in the GHC users' guide, and more technical notes on what is going on can be found as comments (and a Note) in `TcDerivInfer`. Fixes #9821, #12144, #12423, #12594. Test Plan: ./validate Reviewers: dfeuer, goldfire, simonpj, austin, bgamari Subscribers: dfeuer, thomie Differential Revision: https://phabricator.haskell.org/D2961 >--------------------------------------------------------------- 639e702b6129f501c539b158b982ed8489e3d09c compiler/typecheck/TcDeriv.hs | 50 +-- compiler/typecheck/TcDerivInfer.hs | 357 +++++++++++++++++---- compiler/typecheck/TcDerivUtils.hs | 92 ++++-- compiler/typecheck/TcSimplify.hs | 3 +- compiler/typecheck/TcType.hs | 6 +- docs/users_guide/8.2.1-notes.rst | 11 + docs/users_guide/glasgow_exts.rst | 72 ++++- .../tests/deriving/should_compile/T12144_1.hs | 6 + .../tests/deriving/should_compile/T12144_2.hs | 15 + testsuite/tests/deriving/should_compile/T12423.hs | 10 + testsuite/tests/deriving/should_compile/T12594.hs | 41 +++ .../{should_fail => should_compile}/T9968a.hs | 0 .../tests/deriving/should_compile/T9968a.stderr | 5 + testsuite/tests/deriving/should_compile/all.T | 7 +- .../tests/deriving/should_fail/T10598_fail1.stderr | 6 - testsuite/tests/deriving/should_fail/T9968a.stderr | 6 - testsuite/tests/deriving/should_fail/all.T | 1 - .../tests/deriving/should_fail/drvfail004.stderr | 17 +- .../tests/deriving/should_fail/drvfail012.stderr | 17 +- .../tests/typecheck/should_fail/tcfail046.stderr | 31 +- .../tests/typecheck/should_fail/tcfail169.stderr | 17 +- 21 files changed, 579 insertions(+), 191 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 639e702b6129f501c539b158b982ed8489e3d09c From git at git.haskell.org Sat Feb 11 05:30:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 11 Feb 2017 05:30:57 +0000 (UTC) Subject: [commit: ghc] branch 'wip/rwbarton-no-core-lint' created Message-ID: <20170211053057.C05153A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/rwbarton-no-core-lint Referencing: 0206750fcd3fe2299419a9020ec39fa557a866d0 From git at git.haskell.org Sat Feb 11 05:31:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 11 Feb 2017 05:31:00 +0000 (UTC) Subject: [commit: ghc] wip/rwbarton-no-core-lint: Disable core lint (0206750) Message-ID: <20170211053100.76E3D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rwbarton-no-core-lint Link : http://ghc.haskell.org/trac/ghc/changeset/0206750fcd3fe2299419a9020ec39fa557a866d0/ghc >--------------------------------------------------------------- commit 0206750fcd3fe2299419a9020ec39fa557a866d0 Author: Reid Barton Date: Sat Feb 11 00:30:12 2017 -0500 Disable core lint >--------------------------------------------------------------- 0206750fcd3fe2299419a9020ec39fa557a866d0 mk/custom-settings.mk | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mk/custom-settings.mk b/mk/custom-settings.mk index 2b4b127..3fb8e63 100644 --- a/mk/custom-settings.mk +++ b/mk/custom-settings.mk @@ -5,7 +5,11 @@ ifeq "$(Validating)" "YES" include mk/flavours/validate.mk -include mk/validate.mk else --include $(firstword $(wildcard mk/$(TargetPlatformFull)-build.mk) mk/build.mk) +# -include $(firstword $(wildcard mk/$(TargetPlatformFull)-build.mk) mk/build.mk) +GhcHcOpts = +GhcLibWays := $(filter v dyn,$(GhcLibWays)) +GhcLibHcOpts += -O +GhcStage2HcOpts += -O endif ifeq "$(BINDIST)" "YES" From git at git.haskell.org Sat Feb 11 13:12:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 11 Feb 2017 13:12:36 +0000 (UTC) Subject: [commit: ghc] master: IcmmMachOpFoldM: clarify panic message (594123f) Message-ID: <20170211131236.7A3CB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/594123f57779464c9b7c0f51445639e15b8bd55c/ghc >--------------------------------------------------------------- commit 594123f57779464c9b7c0f51445639e15b8bd55c Author: Sergei Trofimovich Date: Sat Feb 11 13:05:24 2017 +0000 IcmmMachOpFoldM: clarify panic message When adding a new primop cinimod noticed uninformative ghc panic: cmmMachOpFoldM: unknown unary op This change tweaks panic to contain the op: cmmMachOpFoldM: unknown unary op: MO_F_Neg W64 Signed-off-by: Sergei Trofimovich >--------------------------------------------------------------- 594123f57779464c9b7c0f51445639e15b8bd55c compiler/cmm/CmmOpt.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/cmm/CmmOpt.hs b/compiler/cmm/CmmOpt.hs index 8d1641a..38c399e 100644 --- a/compiler/cmm/CmmOpt.hs +++ b/compiler/cmm/CmmOpt.hs @@ -79,7 +79,7 @@ cmmMachOpFoldM _ op [CmmLit (CmmInt x rep)] MO_SS_Conv from to -> CmmLit (CmmInt (narrowS from x) to) MO_UU_Conv from to -> CmmLit (CmmInt (narrowU from x) to) - _ -> panic "cmmMachOpFoldM: unknown unary op" + _ -> panic $ "cmmMachOpFoldM: unknown unary op: " ++ show op -- Eliminate conversion NOPs From git at git.haskell.org Sat Feb 11 15:15:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 11 Feb 2017 15:15:47 +0000 (UTC) Subject: [commit: ghc] branch 'wip/rwbarton-no-core-lint-before-jp' created Message-ID: <20170211151547.613383A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/rwbarton-no-core-lint-before-jp Referencing: 505521ce26df5a49a0372fa096b9fd791110293c From git at git.haskell.org Sat Feb 11 15:15:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 11 Feb 2017 15:15:50 +0000 (UTC) Subject: [commit: ghc] wip/rwbarton-no-core-lint-before-jp: Disable core lint (505521c) Message-ID: <20170211151550.1D6503A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rwbarton-no-core-lint-before-jp Link : http://ghc.haskell.org/trac/ghc/changeset/505521ce26df5a49a0372fa096b9fd791110293c/ghc >--------------------------------------------------------------- commit 505521ce26df5a49a0372fa096b9fd791110293c Author: Reid Barton Date: Sat Feb 11 00:30:12 2017 -0500 Disable core lint >--------------------------------------------------------------- 505521ce26df5a49a0372fa096b9fd791110293c mk/custom-settings.mk | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mk/custom-settings.mk b/mk/custom-settings.mk index 2b4b127..3fb8e63 100644 --- a/mk/custom-settings.mk +++ b/mk/custom-settings.mk @@ -5,7 +5,11 @@ ifeq "$(Validating)" "YES" include mk/flavours/validate.mk -include mk/validate.mk else --include $(firstword $(wildcard mk/$(TargetPlatformFull)-build.mk) mk/build.mk) +# -include $(firstword $(wildcard mk/$(TargetPlatformFull)-build.mk) mk/build.mk) +GhcHcOpts = +GhcLibWays := $(filter v dyn,$(GhcLibWays)) +GhcLibHcOpts += -O +GhcStage2HcOpts += -O endif ifeq "$(BINDIST)" "YES" From git at git.haskell.org Sat Feb 11 15:16:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 11 Feb 2017 15:16:32 +0000 (UTC) Subject: [commit: ghc] branch 'wip/rwbarton-no-core-lint-after-jp' created Message-ID: <20170211151632.6A2D43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/rwbarton-no-core-lint-after-jp Referencing: d268e595968e03d488609e38f5f708dfa393a05c From git at git.haskell.org Sat Feb 11 15:16:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 11 Feb 2017 15:16:35 +0000 (UTC) Subject: [commit: ghc] wip/rwbarton-no-core-lint-after-jp: Disable core lint (d268e59) Message-ID: <20170211151635.359E73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rwbarton-no-core-lint-after-jp Link : http://ghc.haskell.org/trac/ghc/changeset/d268e595968e03d488609e38f5f708dfa393a05c/ghc >--------------------------------------------------------------- commit d268e595968e03d488609e38f5f708dfa393a05c Author: Reid Barton Date: Sat Feb 11 00:30:12 2017 -0500 Disable core lint >--------------------------------------------------------------- d268e595968e03d488609e38f5f708dfa393a05c mk/custom-settings.mk | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mk/custom-settings.mk b/mk/custom-settings.mk index 2b4b127..3fb8e63 100644 --- a/mk/custom-settings.mk +++ b/mk/custom-settings.mk @@ -5,7 +5,11 @@ ifeq "$(Validating)" "YES" include mk/flavours/validate.mk -include mk/validate.mk else --include $(firstword $(wildcard mk/$(TargetPlatformFull)-build.mk) mk/build.mk) +# -include $(firstword $(wildcard mk/$(TargetPlatformFull)-build.mk) mk/build.mk) +GhcHcOpts = +GhcLibWays := $(filter v dyn,$(GhcLibWays)) +GhcLibHcOpts += -O +GhcStage2HcOpts += -O endif ifeq "$(BINDIST)" "YES" From git at git.haskell.org Sat Feb 11 16:49:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 11 Feb 2017 16:49:29 +0000 (UTC) Subject: [commit: ghc] wip/T13227: Improve the Occurrence Analyzer’s handling of one-shot functions (917f43a) Message-ID: <20170211164929.040403A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T13227 Link : http://ghc.haskell.org/trac/ghc/changeset/917f43acb4a1b315108f8bafe0cfd61fe56e7688/ghc >--------------------------------------------------------------- commit 917f43acb4a1b315108f8bafe0cfd61fe56e7688 Author: Joachim Breitner Date: Sun Feb 5 10:52:12 2017 -0500 Improve the Occurrence Analyzer’s handling of one-shot functions when determining whether an expression is used saturatedly, count the number of value arguments that the occurrence analyser sees, and add the number of one-shot arguments that we know (from the strictness analyser) are passed from the context. This was suggested by Simon PJ in ticket #13227. perf results suggest no noticable change in allocations, reduction of code sizes, and performance regression possibliy due to loss of join points. Differential Revision: https://phabricator.haskell.org/D3089 >--------------------------------------------------------------- 917f43acb4a1b315108f8bafe0cfd61fe56e7688 compiler/simplCore/OccurAnal.hs | 80 ++++++++++++++++++++++++++++++----------- 1 file changed, 59 insertions(+), 21 deletions(-) diff --git a/compiler/simplCore/OccurAnal.hs b/compiler/simplCore/OccurAnal.hs index 728e472..92c21ad 100644 --- a/compiler/simplCore/OccurAnal.hs +++ b/compiler/simplCore/OccurAnal.hs @@ -1547,7 +1547,7 @@ occAnalNonRecRhs env bndr bndrs body env1 | certainly_inline = env | otherwise = rhsCtxt env - -- See Note [Use one-shot info] + -- See Note [Sources of one-shot information] rhs_env = env1 { occ_one_shots = argOneShots dmd } @@ -1867,16 +1867,17 @@ occAnalApp env (Var fun, args, ticks) -- This is the *whole point* of the isRhsEnv predicate -- See Note [Arguments of let-bound constructors] - n_val_args = valArgCount args + n_val_args = valArgCount args + length (takeWhile isOneShotInfo (occ_one_shots env)) + -- See Note [Sources of one-shot information], bullet point A' + n_args = length args fun_uds = mkOneOcc env fun (n_val_args > 0) n_args is_exp = isExpandableApp fun n_val_args - -- See Note [CONLIKE pragma] in BasicTypes - -- The definition of is_exp should match that in - -- Simplify.prepareRhs + -- See Note [CONLIKE pragma] in BasicTypes + -- The definition of is_exp should match that in Simplify.prepareRhs one_shots = argsOneShots (idStrictness fun) n_val_args - -- See Note [Use one-shot info] + -- See Note [Sources of one-shot information] occAnalApp env (fun, args, ticks) = (markAllNonTailCalled (fun_uds +++ args_uds), @@ -1898,20 +1899,44 @@ zapDetailsIf True uds = zapDetails uds zapDetailsIf False uds = uds {- -Note [Use one-shot information] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The occurrence analyser propagates one-shot-lambda information in two -situations: +Note [Sources of one-shot information] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +The occurrence analyser obtains one-shot-lambda information from two sources: + +A: Saturated applications: eg f e1 .. en + + In general, given a call (f e1 .. en) we can propagate one-shot info from + f's strictness signature into e1 .. en, but /only/ if n is enough to + saturate the strictness signature. A stricteness signature like + + f :: C1(C1(L))LS + + means that *if f is applied to three arguments* then it will guarantee to + call its first argument at most once, and to call the result of that at + most once. But if f has fewer than three arguments, all bets are off; e.g. + + map (f (\x y. expensive) e2) xs + + Here the \x y abstraction may be called many times (once for each element of + xs) so we should not mark x and y as one-shot. But if it was - * Applications: eg build (\c n -> blah) + map (f (\x y. expensive) 3 2) xs - Propagate one-shot info from the strictness signature of 'build' to - the \c n. + then the first argument of f will be called at most once. - This strictness signature can come from a module interface, in the case of - an imported function, or from a previous run of the demand analyser. +A': Non-obviously satuated applications: eg build (f (\x y -> expensive)) - * Let-bindings: eg let f = \c. let ... in \n -> blah + In this case, f is only manifestly applied to one argument, so it does not + look saturated. So bye the previous point, we should not use its strictness + signature to learn about the one-shotness of \x y. But in this case we can: + + build is fully applied, so we may use its strictness signature. From that + we learn that build calls its argument with two arguments *at most once*. + + So there is really only one call to f, and it will have three arguments. In + that sense, f is saturated, and we may proceed as described above. + +B: Let-bindings: eg let f = \c. let ... in \n -> blah in (build f, build f) Propagate one-shot info from the demanand-info on 'f' to the @@ -1924,6 +1949,22 @@ Previously, the demand analyser would *also* set the one-shot information, but that code was buggy (see #11770), so doing it only in on place, namely here, is saner. +Note [OneShots] +~~~~~~~~~~~~~~~ +When analysing an expression, the occ_one_shots argument contains information +about how the function is being used. The length of the list indicates +how many arguments will eventually be passed to the analysed expression, +and the OneShotInfo indicates whether this application is once or multiple times. + +Example: + + Context of f occ_one_shots when analysing f + + f 1 2 [OneShot, OneShot] + map (f 1) [OneShot, NoOneShotInfo] + build f [OneShot, OneShot] + f 1 2 `seq` f 2 1 [NoOneShotInfo, OneShot] + Note [Binders in case alternatives] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Consider @@ -2008,7 +2049,7 @@ wrapAltRHS _ _ alt_usg _ alt_rhs data OccEnv = OccEnv { occ_encl :: !OccEncl -- Enclosing context information - , occ_one_shots :: !OneShots -- Tells about linearity + , occ_one_shots :: !OneShots -- See Note [OneShots] , occ_gbl_scrut :: GlobalScruts , occ_rule_act :: Activation -> Bool -- Which rules are active -- See Note [Finding rule RHS free vars] @@ -2037,11 +2078,8 @@ instance Outputable OccEncl where ppr OccRhs = text "occRhs" ppr OccVanilla = text "occVanilla" +-- See note [OneShots] type OneShots = [OneShotInfo] - -- [] No info - -- - -- one_shot_info:ctxt Analysing a function-valued expression that - -- will be applied as described by one_shot_info initOccEnv :: (Activation -> Bool) -> OccEnv initOccEnv active_rule From git at git.haskell.org Sat Feb 11 16:49:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 11 Feb 2017 16:49:31 +0000 (UTC) Subject: [commit: ghc] wip/T13227's head updated: Improve the Occurrence Analyzer’s handling of one-shot functions (917f43a) Message-ID: <20170211164931.894BC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/T13227' now includes: d5e9b7f Use better map operations in CoreMonad e90f611 Clean up findPartiallyCompletedCycles 369c534 testsuite: Bump max_bytes_used for T4029 0aa3f8d testsuite: Bump bytes allocated for T5837 8c25be8 cpeApp: Make Int accumulator strict bc376d3 Update Core formalize for Levity -> RuntimeRep 062f112 Fix push_bang_into_newtype when the pattern match has no arguments 3e07126 Fix comment of `section "Exceptions"` db3a797 Fix comment (broken link to users_guide) in $(TOP)/ 015e97a Pass -v0 to ghc-pkg to reduce noise in build ouput 512f157 Update hoopl submodule b990f65 More typos in comments [skip ci] 8e9593f Improve the simple optimiser 421308e Improve -dsuppress-coercions 3eb737e Generalize CmmUnwind and pass unwind information through NCG 733e845 CmmLayoutStack: Add unwind information on stack fixups 3328ddb Cmm: Add support for undefined unwinding statements 5279b08 CmmLayoutStack: Correctly annotate Sp adjustments with unwinding information 34e3523 Fix stop_thread unwinding information 9f3c1e6 Add some commented-out tracing in SpecConstr 3cfef76 Kill inaccessible-branch complaints in record update a94b484 Back-pedal the fix for Trac #8155 7e4e6a7 Add dump flags for the renamed and typechecked hsSyn ASTs 41c7437 users-guide: Document defaults for remaining optimization flags 082936d Fix documentation for setByteArray# afaf6d5 Bump array submodule b9bebd8 Implement addCStub in template-haskell. e8f5efb Tweaks and typos in manual, note refs, comments a6a4d0e Bump array submodule d266aac Library docs: Document the order for sort and sortOn. b92ca83 Bump bytestring submodule c22cd7c testsuite: Add testcase for #13248 a5a6c52 Guard rewritableTyVarsOfType 258c719 TH-spliced class instances are pretty-printed incorrectly post-#3384 3211fa0 Spelling in comments [ci skip] 76244ec Change rewritableTyVarsOfType to anyRewritableTyVar 283a346 Prevent Template Haskell splices from throwing a spurious TypeInType error e79ef75 Relax test TH_addCStub2 so it succeeds on travis. 639e702 Refactor DeriveAnyClass's instance context inference 594123f IcmmMachOpFoldM: clarify panic message 917f43a Improve the Occurrence Analyzer’s handling of one-shot functions From git at git.haskell.org Sat Feb 11 16:50:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 11 Feb 2017 16:50:22 +0000 (UTC) Subject: [commit: ghc] branch 'wip/travis' deleted Message-ID: <20170211165022.9F21F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Deleted branch: wip/travis From git at git.haskell.org Sat Feb 11 19:32:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 11 Feb 2017 19:32:27 +0000 (UTC) Subject: [commit: ghc] branch 'wip/rwbarton-jp-nolint' created Message-ID: <20170211193227.D2D993A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/rwbarton-jp-nolint Referencing: 3c6b4b3d153ed6ec9c0180ed3d1496211824c794 From git at git.haskell.org Sat Feb 11 19:32:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 11 Feb 2017 19:32:30 +0000 (UTC) Subject: [commit: ghc] wip/rwbarton-jp-nolint: Revert join points core lint changes (3c6b4b3) Message-ID: <20170211193230.8B0703A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rwbarton-jp-nolint Link : http://ghc.haskell.org/trac/ghc/changeset/3c6b4b3d153ed6ec9c0180ed3d1496211824c794/ghc >--------------------------------------------------------------- commit 3c6b4b3d153ed6ec9c0180ed3d1496211824c794 Author: Reid Barton Date: Sat Feb 11 14:32:10 2017 -0500 Revert join points core lint changes >--------------------------------------------------------------- 3c6b4b3d153ed6ec9c0180ed3d1496211824c794 compiler/coreSyn/CoreLint.hs | 337 ++++++------------------------------------- 1 file changed, 48 insertions(+), 289 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 3c6b4b3d153ed6ec9c0180ed3d1496211824c794 From git at git.haskell.org Sun Feb 12 01:08:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 12 Feb 2017 01:08:37 +0000 (UTC) Subject: [commit: ghc] master: Dwarf.Types: Use DW_CFA_same_value encoding when possible (7fac7cd) Message-ID: <20170212010837.450ED3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7fac7cdce975620e04eccfc2751190063cf715a8/ghc >--------------------------------------------------------------- commit 7fac7cdce975620e04eccfc2751190063cf715a8 Author: Ben Gamari Date: Sat Feb 11 19:19:42 2017 -0500 Dwarf.Types: Use DW_CFA_same_value encoding when possible This is a bit smaller than the alternative, DW_CFA_val_expression. Also a bit of refactoring. Test Plan: Validate Reviewers: scpmw, simonmar, austin Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2745 >--------------------------------------------------------------- 7fac7cdce975620e04eccfc2751190063cf715a8 compiler/nativeGen/Dwarf/Types.hs | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/compiler/nativeGen/Dwarf/Types.hs b/compiler/nativeGen/Dwarf/Types.hs index b5348db..d4d8e24 100644 --- a/compiler/nativeGen/Dwarf/Types.hs +++ b/compiler/nativeGen/Dwarf/Types.hs @@ -436,10 +436,10 @@ pprSetUnwind _ Sp (Just (UwReg s _), Just (UwReg s' o')) | s == s' pprSetUnwind plat Sp (_, Just (UwReg s' o')) = if o' >= 0 then pprByte dW_CFA_def_cfa $$ - pprLEBWord (fromIntegral $ dwarfGlobalRegNo plat s') $$ + pprLEBRegNo plat s' $$ pprLEBWord (fromIntegral o') else pprByte dW_CFA_def_cfa_sf $$ - pprLEBWord (fromIntegral $ dwarfGlobalRegNo plat s') $$ + pprLEBRegNo plat s' $$ pprLEBInt o' pprSetUnwind _ Sp (_, Just uw) = pprByte dW_CFA_def_cfa_expression $$ pprUnwindExpr False uw @@ -449,17 +449,26 @@ pprSetUnwind plat g (_, Just (UwDeref (UwReg Sp o))) pprLEBWord (fromIntegral ((-o) `div` platformWordSize plat)) | otherwise = pprByte dW_CFA_offset_extended_sf $$ - pprLEBWord (fromIntegral (dwarfGlobalRegNo plat g)) $$ + pprLEBRegNo plat g $$ pprLEBInt o pprSetUnwind plat g (_, Just (UwDeref uw)) = pprByte dW_CFA_expression $$ - pprLEBWord (fromIntegral (dwarfGlobalRegNo plat g)) $$ + pprLEBRegNo plat g $$ pprUnwindExpr True uw +pprSetUnwind plat g (_, Just (UwReg g' 0)) + | g == g' + = pprByte dW_CFA_same_value $$ + pprLEBRegNo plat g pprSetUnwind plat g (_, Just uw) = pprByte dW_CFA_val_expression $$ - pprLEBWord (fromIntegral (dwarfGlobalRegNo plat g)) $$ + pprLEBRegNo plat g $$ pprUnwindExpr True uw +-- | Print the register number of the given 'GlobalReg' as an unsigned LEB128 +-- encoded number. +pprLEBRegNo :: Platform -> GlobalReg -> SDoc +pprLEBRegNo plat = pprLEBWord . fromIntegral . dwarfGlobalRegNo plat + -- | Generates a DWARF expression for the given unwind expression. If -- @spIsCFA@ is true, we see @Sp@ as the frame base CFA where it gets -- mentioned. @@ -488,7 +497,7 @@ pprUnwindExpr spIsCFA expr -- register to @undefined@ pprUndefUnwind :: Platform -> GlobalReg -> SDoc pprUndefUnwind plat g = pprByte dW_CFA_undefined $$ - pprLEBWord (fromIntegral $ dwarfGlobalRegNo plat g) + pprLEBRegNo plat g -- | Align assembly at (machine) word boundary From git at git.haskell.org Sun Feb 12 01:08:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 12 Feb 2017 01:08:41 +0000 (UTC) Subject: [commit: ghc] master: Mark orphan instances and rules in --show-iface output (17b1e0b) Message-ID: <20170212010841.297543A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/17b1e0bae7c0d7b4d3f8e1847e919c0e882e55c6/ghc >--------------------------------------------------------------- commit 17b1e0bae7c0d7b4d3f8e1847e919c0e882e55c6 Author: Reid Barton Date: Sat Feb 11 19:20:08 2017 -0500 Mark orphan instances and rules in --show-iface output Test Plan: new test Orphans Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3086 >--------------------------------------------------------------- 17b1e0bae7c0d7b4d3f8e1847e919c0e882e55c6 compiler/iface/IfaceSyn.hs | 22 ++++++++++++++-------- testsuite/tests/showIface/Makefile | 7 +++++++ testsuite/tests/showIface/Orphans.hs | 26 ++++++++++++++++++++++++++ testsuite/tests/showIface/Orphans.stdout | 6 ++++++ testsuite/tests/showIface/all.T | 1 + 5 files changed, 54 insertions(+), 8 deletions(-) diff --git a/compiler/iface/IfaceSyn.hs b/compiler/iface/IfaceSyn.hs index 9a69b39..6469878 100644 --- a/compiler/iface/IfaceSyn.hs +++ b/compiler/iface/IfaceSyn.hs @@ -43,7 +43,7 @@ module IfaceSyn ( import IfaceType import BinFingerprint -import CoreSyn( IsOrphan ) +import CoreSyn( IsOrphan, isOrphan ) import PprCore() -- Printing DFunArgs import Demand import Class @@ -1029,8 +1029,11 @@ pprIfaceConDecl ss gadt_style fls tycon tc_binders parent instance Outputable IfaceRule where ppr (IfaceRule { ifRuleName = name, ifActivation = act, ifRuleBndrs = bndrs, - ifRuleHead = fn, ifRuleArgs = args, ifRuleRhs = rhs }) - = sep [hsep [pprRuleName name, ppr act, + ifRuleHead = fn, ifRuleArgs = args, ifRuleRhs = rhs, + ifRuleOrph = orph }) + = sep [hsep [pprRuleName name, + if isOrphan orph then text "[orphan]" else Outputable.empty, + ppr act, text "forall" <+> pprIfaceBndrs bndrs], nest 2 (sep [ppr fn <+> sep (map pprParendIfaceExpr args), text "=" <+> ppr rhs]) @@ -1038,16 +1041,19 @@ instance Outputable IfaceRule where instance Outputable IfaceClsInst where ppr (IfaceClsInst { ifDFun = dfun_id, ifOFlag = flag - , ifInstCls = cls, ifInstTys = mb_tcs}) + , ifInstCls = cls, ifInstTys = mb_tcs + , ifInstOrph = orph }) = hang (text "instance" <+> ppr flag - <+> ppr cls <+> brackets (pprWithCommas ppr_rough mb_tcs)) + <+> (if isOrphan orph then text "[orphan]" else Outputable.empty) + <+> ppr cls <+> brackets (pprWithCommas ppr_rough mb_tcs)) 2 (equals <+> ppr dfun_id) instance Outputable IfaceFamInst where ppr (IfaceFamInst { ifFamInstFam = fam, ifFamInstTys = mb_tcs - , ifFamInstAxiom = tycon_ax}) - = hang (text "family instance" <+> - ppr fam <+> pprWithCommas (brackets . ppr_rough) mb_tcs) + , ifFamInstAxiom = tycon_ax, ifFamInstOrph = orph }) + = hang (text "family instance" + <+> (if isOrphan orph then text "[orphan]" else Outputable.empty) + <+> ppr fam <+> pprWithCommas (brackets . ppr_rough) mb_tcs) 2 (equals <+> ppr tycon_ax) ppr_rough :: Maybe IfaceTyCon -> SDoc diff --git a/testsuite/tests/showIface/Makefile b/testsuite/tests/showIface/Makefile new file mode 100644 index 0000000..49b9034 --- /dev/null +++ b/testsuite/tests/showIface/Makefile @@ -0,0 +1,7 @@ +TOP=../.. +include $(TOP)/mk/boilerplate.mk +include $(TOP)/mk/test.mk + +Orphans: + '$(TEST_HC)' $(TEST_HC_OPTS) -c Orphans.hs + '$(TEST_HC)' $(TEST_HC_OPTS) --show-iface Orphans.hi | grep -E '^(instance |family instance |"myrule)' | grep -v 'family instance modules:' diff --git a/testsuite/tests/showIface/Orphans.hs b/testsuite/tests/showIface/Orphans.hs new file mode 100644 index 0000000..f3b7b6a --- /dev/null +++ b/testsuite/tests/showIface/Orphans.hs @@ -0,0 +1,26 @@ +{-# LANGUAGE TypeFamilies #-} +{-# OPTIONS_GHC -O -Wno-inline-rule-shadowing #-} +-- Rules are ignored without -O + +module Orphans where + +import GHC.Exts (IsList(..)) + +-- Some orphan things +instance IsList Bool where + type Item Bool = Double + fromList = undefined + toList = undefined + +{-# RULES "myrule1" id id = id #-} + +-- And some non-orphan things +data X = X [Int] +instance IsList X where + type Item X = Int + fromList = undefined + toList = undefined + +f :: X -> X +f x = x +{-# RULES "myrule2" id f = f #-} diff --git a/testsuite/tests/showIface/Orphans.stdout b/testsuite/tests/showIface/Orphans.stdout new file mode 100644 index 0000000..d61a5c9 --- /dev/null +++ b/testsuite/tests/showIface/Orphans.stdout @@ -0,0 +1,6 @@ +instance [orphan] IsList [Bool] = $fIsListBool +instance IsList [X] = $fIsListX +family instance Item [X] = D:R:ItemX +family instance [orphan] Item [Bool] = D:R:ItemBool +"myrule1" [orphan] forall @ a id @ (a -> a) (id @ a) = id @ a +"myrule2" forall id @ (X -> X) f = f diff --git a/testsuite/tests/showIface/all.T b/testsuite/tests/showIface/all.T new file mode 100644 index 0000000..5c89b70 --- /dev/null +++ b/testsuite/tests/showIface/all.T @@ -0,0 +1 @@ +test('Orphans', normal, run_command, ['$MAKE -s --no-print-directory Orphans']) From git at git.haskell.org Sun Feb 12 01:08:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 12 Feb 2017 01:08:44 +0000 (UTC) Subject: [commit: ghc] master: Improve the Occurrence Analyzer’s handling of one-shot functions (a1980ec) Message-ID: <20170212010844.474D83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a1980ecb5626ec85fc14fbd217e2d16c7d50a120/ghc >--------------------------------------------------------------- commit a1980ecb5626ec85fc14fbd217e2d16c7d50a120 Author: Joachim Breitner Date: Sat Feb 11 19:20:24 2017 -0500 Improve the Occurrence Analyzer’s handling of one-shot functions When determining whether an expression is used saturatedly, count the number of value arguments that the occurrence analyser sees, and add the number of one-shot arguments that we know (from the strictness analyser) are passed from the context. perf results suggest no noticable change in allocations, reduction of code sizes, and performance regression possibliy due to loss of join points. Test Plan: perf.haskell.org Reviewers: simonpj, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3089 >--------------------------------------------------------------- a1980ecb5626ec85fc14fbd217e2d16c7d50a120 compiler/simplCore/OccurAnal.hs | 80 +++++++++++++++++++++++--------- testsuite/tests/perf/haddock/all.T | 93 ++++++++++++++++++++------------------ 2 files changed, 107 insertions(+), 66 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 a1980ecb5626ec85fc14fbd217e2d16c7d50a120 From git at git.haskell.org Sun Feb 12 01:08:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 12 Feb 2017 01:08:48 +0000 (UTC) Subject: [commit: ghc] master: Fix #13214 by correctly setting up dep_orphs for signatures. (26eaa7e) Message-ID: <20170212010848.345BD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/26eaa7ecde288b9dc123f3c120e70b2cf18b4e4a/ghc >--------------------------------------------------------------- commit 26eaa7ecde288b9dc123f3c120e70b2cf18b4e4a Author: Edward Z. Yang Date: Sat Feb 11 19:20:36 2017 -0500 Fix #13214 by correctly setting up dep_orphs for signatures. Prior to this, I hadn't thought about orphan handling at all. This commit implements the semantics that if a signature (transitively) imports an orphan instance, that instance is considered in scope no matter what the implementing module is. (As it turns out, this is the semantics that falls out when orphans are recorded transitively.) This patch fixes a few bugs: 1. Put semantic modules in dep_orphs rather than identity modules. 2. Don't put the implementing module in dep_orphs when merging signatures (this is a silly bug that happened because we were reusing calculateAvails, which is designed for imports. It mostly works for signature merging, except this case.) 3. When renaming a signature, blast in the orphans of the implementing module inside Dependencies. Signed-off-by: Edward Z. Yang Test Plan: validate Reviewers: bgamari, austin Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3095 >--------------------------------------------------------------- 26eaa7ecde288b9dc123f3c120e70b2cf18b4e4a compiler/backpack/RnModIface.hs | 24 ++++++++++++++- compiler/rename/RnNames.hs | 9 +++--- compiler/typecheck/TcBackpack.hs | 6 +++- docs/users_guide/separate_compilation.rst | 5 ++++ testsuite/tests/backpack/should_compile/T13214.bkp | 33 ++++++++++++++++++++ .../tests/backpack/should_compile/T13214.stderr | 18 +++++++++++ testsuite/tests/backpack/should_compile/all.T | 2 ++ testsuite/tests/backpack/should_compile/bkp51.bkp | 35 ++++++++++++++++++++++ .../tests/backpack/should_compile/bkp51.stderr | 22 ++++++++++++++ testsuite/tests/backpack/should_fail/all.T | 1 + testsuite/tests/backpack/should_fail/bkpfail43.bkp | 13 ++++++++ .../tests/backpack/should_fail/bkpfail43.stderr | 19 ++++++++++++ 12 files changed, 181 insertions(+), 6 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 26eaa7ecde288b9dc123f3c120e70b2cf18b4e4a From git at git.haskell.org Sun Feb 12 01:08:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 12 Feb 2017 01:08:50 +0000 (UTC) Subject: [commit: ghc] master: rts/Profiling: Kill a few globals and add consts (1a14d38) Message-ID: <20170212010850.E80273A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1a14d384136ce91d3469f462d192c3721b27fbd5/ghc >--------------------------------------------------------------- commit 1a14d384136ce91d3469f462d192c3721b27fbd5 Author: Ben Gamari Date: Sat Feb 11 19:20:56 2017 -0500 rts/Profiling: Kill a few globals and add consts Previously it was quite difficult to follow the dataflow through this file due to global mutation and rather non-descriptive types. This is a cleanup in preparation for factoring out the report-generating logic, which is itself in preparation for somedayteaching the profiler to produce more machine-readable reports (JSON perhaps?). Test Plan: Validate Reviewers: austin, erikd, simonmar Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3096 >--------------------------------------------------------------- 1a14d384136ce91d3469f462d192c3721b27fbd5 rts/Profiling.c | 113 +++++++++++++++++++++++++++++++------------------------- rts/Profiling.h | 8 +++- 2 files changed, 70 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 1a14d384136ce91d3469f462d192c3721b27fbd5 From git at git.haskell.org Sun Feb 12 01:08:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 12 Feb 2017 01:08:54 +0000 (UTC) Subject: [commit: ghc] master: zonkCt tries to maintain the canonical form of a Ct. (07292e9) Message-ID: <20170212010854.8BB483A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/07292e958cb0c08705d9a694f09d9621058b16e6/ghc >--------------------------------------------------------------- commit 07292e958cb0c08705d9a694f09d9621058b16e6 Author: Christiaan Baaij Date: Sat Feb 11 19:21:52 2017 -0500 zonkCt tries to maintain the canonical form of a Ct. For example, - a CDictCan should stay a CDictCan; - a CTyEqCan should stay a CTyEqCan (if the LHS stays as a variable.). - a CHoleCan should stay a CHoleCan Why? For CDicteqCan see Trac #11525. Test Plan: Validate Reviewers: austin, adamgundry, simonpj, goldfire, bgamari Reviewed By: simonpj, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3105 >--------------------------------------------------------------- 07292e958cb0c08705d9a694f09d9621058b16e6 compiler/typecheck/TcMType.hs | 40 +++++++++++++++++++++- testsuite/tests/typecheck/should_compile/T11525.hs | 26 ++++++++++++++ .../{T11462_Plugin.hs => T11525_Plugin.hs} | 2 +- testsuite/tests/typecheck/should_compile/all.T | 3 ++ 4 files changed, 69 insertions(+), 2 deletions(-) diff --git a/compiler/typecheck/TcMType.hs b/compiler/typecheck/TcMType.hs index d9105b3..56cc711 100644 --- a/compiler/typecheck/TcMType.hs +++ b/compiler/typecheck/TcMType.hs @@ -1355,12 +1355,50 @@ zonkSimples cts = do { cts' <- mapBagM zonkCt' cts zonkCt' :: Ct -> TcM Ct zonkCt' ct = zonkCt ct +{- Note [zonkCt behaviour] +zonkCt tries to maintain the canonical form of a Ct. For example, + - a CDictCan should stay a CDictCan; + - a CTyEqCan should stay a CTyEqCan (if the LHS stays as a variable.). + - a CHoleCan should stay a CHoleCan + +Why?, for example: +- For CDictCan, the @TcSimplify.expandSuperClasses@ step, which runs after the + simple wanted and plugin loop, looks for @CDictCan at s. If a plugin is in use, + constraints are zonked before being passed to the plugin. This means if we + don't preserve a canonical form, @expandSuperClasses@ fails to expand + superclasses. This is what happened in Trac #11525. + +- For CHoleCan, once we forget that it's a hole, we can never recover that info. + +NB: we do not expect to see any CFunEqCans, because zonkCt is only +called on unflattened constraints. +NB: Constraints are always re-flattened etc by the canonicaliser in + at TcCanonical@ even if they come in as CDictCan. Only canonical constraints that +are actually in the inert set carry all the guarantees. So it is okay if zonkCt +creates e.g. a CDictCan where the cc_tyars are /not/ function free. +-} zonkCt :: Ct -> TcM Ct zonkCt ct@(CHoleCan { cc_ev = ev }) = do { ev' <- zonkCtEvidence ev ; return $ ct { cc_ev = ev' } } +zonkCt ct@(CDictCan { cc_ev = ev, cc_tyargs = args }) + = do { ev' <- zonkCtEvidence ev + ; args' <- mapM zonkTcType args + ; return $ ct { cc_ev = ev', cc_tyargs = args' } } +zonkCt ct@(CTyEqCan { cc_ev = ev, cc_tyvar = tv, cc_rhs = rhs }) + = do { ev' <- zonkCtEvidence ev + ; tv_ty' <- zonkTcTyVar tv + ; case getTyVar_maybe tv_ty' of + Just tv' -> do { rhs' <- zonkTcType rhs + ; return ct { cc_ev = ev' + , cc_tyvar = tv' + , cc_rhs = rhs' } } + Nothing -> return (mkNonCanonical ev') } zonkCt ct - = do { fl' <- zonkCtEvidence (cc_ev ct) + = ASSERT( not (isCFunEqCan ct) ) + -- We do not expect to see any CFunEqCans, because zonkCt is only called on + -- unflattened constraints. + do { fl' <- zonkCtEvidence (cc_ev ct) ; return (mkNonCanonical fl') } zonkCtEvidence :: CtEvidence -> TcM CtEvidence diff --git a/testsuite/tests/typecheck/should_compile/T11525.hs b/testsuite/tests/typecheck/should_compile/T11525.hs new file mode 100644 index 0000000..406bf5f --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T11525.hs @@ -0,0 +1,26 @@ +{-# LANGUAGE DataKinds, TypeOperators, KindSignatures, TypeFamilies, + ConstraintKinds, FlexibleContexts #-} +{-# OPTIONS_GHC -fplugin T11525_Plugin #-} +module T11525 where + +import GHC.TypeLits +import Data.Proxy + +truncateB :: KnownNat a => Proxy (a + b) -> Proxy a +truncateB Proxy = Proxy + +class Bus t where + type AddrBits t :: Nat + +data MasterOut b = MasterOut + { adr :: Proxy (AddrBits b) + } + +type WiderAddress b b' k = ( KnownNat (AddrBits b) + , AddrBits b' ~ (AddrBits b + k) + ) + +narrowAddress' :: (WiderAddress b b' k) + => MasterOut b' + -> MasterOut b +narrowAddress' m = MasterOut { adr = truncateB (adr m) } diff --git a/testsuite/tests/typecheck/should_compile/T11462_Plugin.hs b/testsuite/tests/typecheck/should_compile/T11525_Plugin.hs similarity index 91% copy from testsuite/tests/typecheck/should_compile/T11462_Plugin.hs copy to testsuite/tests/typecheck/should_compile/T11525_Plugin.hs index 5d98395..bc1ffc4 100644 --- a/testsuite/tests/typecheck/should_compile/T11462_Plugin.hs +++ b/testsuite/tests/typecheck/should_compile/T11525_Plugin.hs @@ -1,4 +1,4 @@ -module T11462_Plugin(plugin) where +module T11525_Plugin(plugin) where import TcRnMonad ( TcPlugin(..), TcPluginResult(..) ) import Plugins ( defaultPlugin, Plugin(..), CommandLineOption ) diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index 7d2e3c6..286ebbb 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -536,3 +536,6 @@ test('T11723', normal, compile, ['']) test('T12987', normal, compile, ['']) test('T11736', normal, compile, ['']) test('T13248', expect_broken(13248), compile, ['']) +test('T11525', [unless(have_dynamic(), expect_broken(10301))], multi_compile, + ['', [('T11525_Plugin.hs', '-package ghc'), ('T11525.hs', '')], + '-dynamic']) From git at git.haskell.org Sun Feb 12 01:08:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 12 Feb 2017 01:08:58 +0000 (UTC) Subject: [commit: ghc] master: rts/Profiling: Factor out report generation (56c9bb3) Message-ID: <20170212010858.56D113A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/56c9bb39246f9ffd8ed41a0656bfe8e60d23be57/ghc >--------------------------------------------------------------- commit 56c9bb39246f9ffd8ed41a0656bfe8e60d23be57 Author: Ben Gamari Date: Sat Feb 11 19:21:22 2017 -0500 rts/Profiling: Factor out report generation Here we move the actual report generation logic to `rts/ProfilerReport.c`. This break is actually quite clean, void writeCCSReport( FILE *prof_file, CostCentreStack const *ccs, ProfilerTotals totals ); This is more profiler refactoring in preparation for machine-readable output. Test Plan: Validate Reviewers: austin, erikd, simonmar Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3097 >--------------------------------------------------------------- 56c9bb39246f9ffd8ed41a0656bfe8e60d23be57 rts/ProfilerReport.c | 331 +++++++++++++++++++++++++++++++++++++++++++++++++++ rts/ProfilerReport.h | 28 +++++ rts/Profiling.c | 322 ++----------------------------------------------- rts/Profiling.h | 11 +- 4 files changed, 374 insertions(+), 318 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 56c9bb39246f9ffd8ed41a0656bfe8e60d23be57 From git at git.haskell.org Sun Feb 12 01:09:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 12 Feb 2017 01:09:01 +0000 (UTC) Subject: [commit: ghc] master: Binary: Only allocate un-interned FastStrings (64da671) Message-ID: <20170212010901.14F4F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/64da671afb9fdb097ff355a9cca1c8ed098a9114/ghc >--------------------------------------------------------------- commit 64da671afb9fdb097ff355a9cca1c8ed098a9114 Author: alexbiehl Date: Sat Feb 11 19:22:26 2017 -0500 Binary: Only allocate un-interned FastStrings Test Plan: Validate Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3109 >--------------------------------------------------------------- 64da671afb9fdb097ff355a9cca1c8ed098a9114 compiler/utils/Binary.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/utils/Binary.hs b/compiler/utils/Binary.hs index 275b1a9..565d162 100644 --- a/compiler/utils/Binary.hs +++ b/compiler/utils/Binary.hs @@ -724,8 +724,9 @@ putFS :: BinHandle -> FastString -> IO () putFS bh fs = putBS bh $ fastStringToByteString fs getFS :: BinHandle -> IO FastString -getFS bh = do bs <- getBS bh - return $! mkFastStringByteString bs +getFS bh = do + l <- get bh :: IO Int + getPrim bh l (\src -> pure $! mkFastStringBytes src l ) putBS :: BinHandle -> ByteString -> IO () putBS bh bs = From git at git.haskell.org Sun Feb 12 01:09:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 12 Feb 2017 01:09:04 +0000 (UTC) Subject: [commit: ghc] master: Avoid repeated list elem checks (7938ef2) Message-ID: <20170212010904.27DCA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7938ef23387e10ea8e33fc6531706b79c62634af/ghc >--------------------------------------------------------------- commit 7938ef23387e10ea8e33fc6531706b79c62634af Author: David Feuer Date: Sat Feb 11 19:23:20 2017 -0500 Avoid repeated list elem checks Convert a list to a set before testing membership multiple times. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3111 >--------------------------------------------------------------- 7938ef23387e10ea8e33fc6531706b79c62634af compiler/main/SysTools.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/compiler/main/SysTools.hs b/compiler/main/SysTools.hs index 17ce634..b34b1b8 100644 --- a/compiler/main/SysTools.hs +++ b/compiler/main/SysTools.hs @@ -79,6 +79,7 @@ import System.Directory import Data.Char import Data.List import qualified Data.Map as Map +import qualified Data.Set as Set #ifndef mingw32_HOST_OS import qualified System.Posix.Internals @@ -1068,9 +1069,11 @@ cleanTempFilesExcept dflags dont_delete $ mask_ $ do let ref = filesToClean dflags to_delete <- atomicModifyIORef' ref $ \files -> - let (to_keep,to_delete) = partition (`elem` dont_delete) files - in (to_keep,to_delete) + let res@(_to_keep, _to_delete) = + partition (`Set.member` dont_delete_set) files + in res removeTmpFiles dflags to_delete + where dont_delete_set = Set.fromList dont_delete -- Return a unique numeric temp file suffix From git at git.haskell.org Sun Feb 12 01:09:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 12 Feb 2017 01:09:07 +0000 (UTC) Subject: [commit: ghc] master: Binary: Correct endian issue when cross-compiling (d3ea38e) Message-ID: <20170212010907.78EB03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d3ea38ef0299e9330a105fa59dda38f9ec0712c4/ghc >--------------------------------------------------------------- commit d3ea38ef0299e9330a105fa59dda38f9ec0712c4 Author: alexbiehl Date: Sat Feb 11 19:25:27 2017 -0500 Binary: Correct endian issue when cross-compiling Using `WORDS_BIGENDIAN` wasn't such a great idea after all! When cross compiling host and target endianess may differ and `WORDS_BIGENDIAN` refers to host endianess. Reviewers: austin, bgamari, trofi Reviewed By: bgamari, trofi Subscribers: rwbarton, trofi, thomie Differential Revision: https://phabricator.haskell.org/D3122 >--------------------------------------------------------------- d3ea38ef0299e9330a105fa59dda38f9ec0712c4 compiler/utils/Binary.hs | 85 +++++++++++++++++++++++++++++++----------------- 1 file changed, 55 insertions(+), 30 deletions(-) diff --git a/compiler/utils/Binary.hs b/compiler/utils/Binary.hs index 565d162..ffd1eb2 100644 --- a/compiler/utils/Binary.hs +++ b/compiler/utils/Binary.hs @@ -225,30 +225,6 @@ expandBin (BinMem _ _ sz_r arr_r) off = do -- ----------------------------------------------------------------------------- -- Low-level reading/writing of bytes -be16 :: Word16 -> Word16 -#ifdef WORDS_BIGENDIAN -be16 w = w -#else -be16 w = byteSwap16 w -#endif -{-# INLINE be16 #-} - -be32 :: Word32 -> Word32 -#ifdef WORDS_BIGENDIAN -be32 w = w -#else -be32 w = byteSwap32 w -#endif -{-# INLINE be32 #-} - -be64 :: Word64 -> Word64 -#ifdef WORDS_BIGENDIAN -be64 w = w -#else -be64 w = byteSwap64 w -#endif -{-# INLINE be64 #-} - putPrim :: BinHandle -> Int -> (Ptr Word8 -> IO ()) -> IO () putPrim h@(BinMem _ ix_r sz_r arr_r) size f = do ix <- readFastMutInt ix_r @@ -277,22 +253,71 @@ getWord8 :: BinHandle -> IO Word8 getWord8 h = getPrim h 1 peek putWord16 :: BinHandle -> Word16 -> IO () -putWord16 h w = putPrim h 2 (\op -> poke (castPtr op :: Ptr Word16) (be16 w)) +putWord16 h w = putPrim h 2 (\op -> do + pokeElemOff op 0 (fromIntegral (w `shiftR` 8)) + pokeElemOff op 1 (fromIntegral (w .&. 0xFF)) + ) getWord16 :: BinHandle -> IO Word16 -getWord16 h = getPrim h 2 (\op -> be16 <$> peek (castPtr op :: Ptr Word16)) +getWord16 h = getPrim h 2 (\op -> do + w0 <- fromIntegral <$> peekElemOff op 0 + w1 <- fromIntegral <$> peekElemOff op 1 + return $! w0 `shiftL` 8 .|. w1 + ) putWord32 :: BinHandle -> Word32 -> IO () -putWord32 h w = putPrim h 4 (\op -> poke (castPtr op :: Ptr Word32) (be32 w)) +putWord32 h w = putPrim h 4 (\op -> do + pokeElemOff op 0 (fromIntegral (w `shiftR` 24)) + pokeElemOff op 1 (fromIntegral ((w `shiftR` 16) .&. 0xFF)) + pokeElemOff op 2 (fromIntegral ((w `shiftR` 8) .&. 0xFF)) + pokeElemOff op 3 (fromIntegral (w .&. 0xFF)) + ) getWord32 :: BinHandle -> IO Word32 -getWord32 h = getPrim h 4 (\op -> be32 <$> peek (castPtr op :: Ptr Word32)) +getWord32 h = getPrim h 4 (\op -> do + w0 <- fromIntegral <$> peekElemOff op 0 + w1 <- fromIntegral <$> peekElemOff op 1 + w2 <- fromIntegral <$> peekElemOff op 2 + w3 <- fromIntegral <$> peekElemOff op 3 + + return $! (w0 `shiftL` 24) .|. + (w1 `shiftL` 16) .|. + (w2 `shiftL` 8) .|. + w3 + ) putWord64 :: BinHandle -> Word64 -> IO () -putWord64 h w = putPrim h 8 (\op -> poke (castPtr op :: Ptr Word64) (be64 w)) +putWord64 h w = putPrim h 8 (\op -> do + pokeElemOff op 0 (fromIntegral (w `shiftR` 56)) + pokeElemOff op 1 (fromIntegral ((w `shiftR` 48) .&. 0xFF)) + pokeElemOff op 2 (fromIntegral ((w `shiftR` 40) .&. 0xFF)) + pokeElemOff op 3 (fromIntegral ((w `shiftR` 32) .&. 0xFF)) + pokeElemOff op 4 (fromIntegral ((w `shiftR` 24) .&. 0xFF)) + pokeElemOff op 5 (fromIntegral ((w `shiftR` 16) .&. 0xFF)) + pokeElemOff op 6 (fromIntegral ((w `shiftR` 8) .&. 0xFF)) + pokeElemOff op 7 (fromIntegral (w .&. 0xFF)) + ) getWord64 :: BinHandle -> IO Word64 -getWord64 h = getPrim h 8 (\op -> be64 <$> peek (castPtr op :: Ptr Word64)) +getWord64 h = getPrim h 8 (\op -> do + w0 <- fromIntegral <$> peekElemOff op 0 + w1 <- fromIntegral <$> peekElemOff op 1 + w2 <- fromIntegral <$> peekElemOff op 2 + w3 <- fromIntegral <$> peekElemOff op 3 + w4 <- fromIntegral <$> peekElemOff op 4 + w5 <- fromIntegral <$> peekElemOff op 5 + w6 <- fromIntegral <$> peekElemOff op 6 + w7 <- fromIntegral <$> peekElemOff op 7 + + return $! (w0 `shiftL` 56) .|. + (w1 `shiftL` 48) .|. + (w2 `shiftL` 40) .|. + (w3 `shiftL` 32) .|. + (w4 `shiftL` 24) .|. + (w5 `shiftL` 16) .|. + (w6 `shiftL` 8) .|. + w7 + ) putByte :: BinHandle -> Word8 -> IO () putByte bh w = putWord8 bh w From git at git.haskell.org Sun Feb 12 01:09:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 12 Feb 2017 01:09:10 +0000 (UTC) Subject: [commit: ghc] master: Fix: Default FD buffer size is not a power of 2 (#13245) (4e2e9b7) Message-ID: <20170212010910.B3C2E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4e2e9b7324e253295613fe868a281e1801e05d10/ghc >--------------------------------------------------------------- commit 4e2e9b7324e253295613fe868a281e1801e05d10 Author: Niklas Hambüchen Date: Sat Feb 11 19:23:37 2017 -0500 Fix: Default FD buffer size is not a power of 2 (#13245) Reviewers: simonmar, austin, hvr, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3115 >--------------------------------------------------------------- 4e2e9b7324e253295613fe868a281e1801e05d10 libraries/base/GHC/IO/FD.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/base/GHC/IO/FD.hs b/libraries/base/GHC/IO/FD.hs index 82ba628..c4e4d46 100644 --- a/libraries/base/GHC/IO/FD.hs +++ b/libraries/base/GHC/IO/FD.hs @@ -121,7 +121,7 @@ instance GHC.IO.Device.IODevice FD where -- varies too much though: it is 512 on Windows, 1024 on OS X and 8192 -- on Linux. So let's just use a decent size on every platform: dEFAULT_FD_BUFFER_SIZE :: Int -dEFAULT_FD_BUFFER_SIZE = 8096 +dEFAULT_FD_BUFFER_SIZE = 8192 -- | @since 4.1.0.0 instance BufferedIO FD where From git at git.haskell.org Sun Feb 12 01:09:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 12 Feb 2017 01:09:13 +0000 (UTC) Subject: [commit: ghc] master: bufWrite: Save extra syscall when data fills handle buffer completely. (6b4e46a) Message-ID: <20170212010913.950AD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6b4e46a1ad57f90726de7e5b7f59814aea5f03ef/ghc >--------------------------------------------------------------- commit 6b4e46a1ad57f90726de7e5b7f59814aea5f03ef Author: Niklas Hambüchen Date: Sat Feb 11 19:24:49 2017 -0500 bufWrite: Save extra syscall when data fills handle buffer completely. The bug is that the check `if (size - w > count)` should be `if (size - w >= count)` instead (`>=` instead of `>`), because we can do the write all fine if it fits exactly. This allows us to do 1 instead of 2 write syscalls the case it fits. An example of when this matters is when an application writes output in chunks that are a fraction of the handle buffer size. For example, assume the buffer size is 8 KB, and the application writes four 2 KB chunks. Until now, this would result in 3 copies to the handle buffer, but the 4th one would not be allowed in by `size - w > count` (because `size - w == count` is the case), so we'd end up with a write syscall of only 6 KB data instead of 8 KB, thus creating more syscalls overall. Implementing this fix (switching to `size - w >= count`), we also have to flush the buffer if we fill it completely. If we made only the changes described so far, that would have the unintended side effect that writes of the size equal to the handle buffer size (`count == size`) suddenly also go to the handle buffer first: The data would first be copied to the handle buffer, and then immediately get flushed to the underlying FD. We don't want that extra `memcpy`, because it'd be unnecessary: The point of handle buffering is to coalesce smaller writes, and there are no smaller writes in this case. For example, if you specify 8 KB buffers (which menas you want your data to be written out in 8 KB blocks), and you get data that's already 8 KB in size, you can write that out as an 8 KB straight away, zero-copy fashion. For this reason, adding to the handle buffer now got an additional condition `count < size`. That way, writes equal to the buffer size go straight to the FD, as they did before this commit. Reviewers: simonmar, austin, hvr, bgamari Reviewed By: simonmar Subscribers: mpickering, thomie Differential Revision: https://phabricator.haskell.org/D3117 >--------------------------------------------------------------- 6b4e46a1ad57f90726de7e5b7f59814aea5f03ef libraries/base/GHC/IO/Handle/Text.hs | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/libraries/base/GHC/IO/Handle/Text.hs b/libraries/base/GHC/IO/Handle/Text.hs index c53b429..8d92738 100644 --- a/libraries/base/GHC/IO/Handle/Text.hs +++ b/libraries/base/GHC/IO/Handle/Text.hs @@ -736,13 +736,30 @@ bufWrite h_ at Handle__{..} ptr count can_block = old_buf at Buffer{ bufRaw=old_raw, bufR=w, bufSize=size } <- readIORef haByteBuffer - -- enough room in handle buffer? - if (size - w > count) - -- There's enough room in the buffer: + -- TODO: Possible optimisation: + -- If we know that `w + count > size`, we should write both the + -- handle buffer and the `ptr` in a single `writev()` syscall. + + -- Need to buffer and enough room in handle buffer? + -- There's no need to buffer if the data to be written is larger than + -- the handle buffer (`count >= size`). + if (count < size && count <= size - w) + -- We need to buffer and there's enough room in the buffer: -- just copy the data in and update bufR. then do debugIO ("hPutBuf: copying to buffer, w=" ++ show w) copyToRawBuffer old_raw w ptr count - writeIORef haByteBuffer old_buf{ bufR = w + count } + let copied_buf = old_buf{ bufR = w + count } + -- If the write filled the buffer completely, we need to flush, + -- to maintain the "INVARIANTS on Buffers" from + -- GHC.IO.Buffer.checkBuffer: "a write buffer is never full". + if (count == size - w) + then do + debugIO "hPutBuf: flushing full buffer after writing" + flushed_buf <- Buffered.flushWriteBuffer haDevice copied_buf + -- TODO: we should do a non-blocking flush here + writeIORef haByteBuffer flushed_buf + else do + writeIORef haByteBuffer copied_buf return count -- else, we have to flush any existing handle buffer data From git at git.haskell.org Sun Feb 12 01:09:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 12 Feb 2017 01:09:16 +0000 (UTC) Subject: [commit: ghc] master: Apply SplitSections to all C compilations (a50082c) Message-ID: <20170212010916.8207E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a50082c115bed1891b2e5aac4a21462935f4f0d6/ghc >--------------------------------------------------------------- commit a50082c115bed1891b2e5aac4a21462935f4f0d6 Author: Simon Brenner Date: Sat Feb 11 19:25:16 2017 -0500 Apply SplitSections to all C compilations Previously this was added only to the RTS's C files (those are the bulk of it though), but there are C bits in ghc-prim, integer-gmp and base too. Followup for #8405, allows the large table of character properties in base to be stripped when not used. Test Plan: validate Reviewers: austin, bgamari, simonmar Reviewed By: bgamari Subscribers: thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3121 >--------------------------------------------------------------- a50082c115bed1891b2e5aac4a21462935f4f0d6 rts/ghc.mk | 4 ---- rules/distdir-way-opts.mk | 3 ++- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/rts/ghc.mk b/rts/ghc.mk index d3daec5..89c5a0b 100644 --- a/rts/ghc.mk +++ b/rts/ghc.mk @@ -335,10 +335,6 @@ ifeq "$$(TargetOS_CPP)" "mingw32" rts_CC_OPTS += -DWINVER=$(rts_WINVER) endif -ifeq "$(SplitSections)" "YES" -rts_CC_OPTS += -ffunction-sections -fdata-sections -endif - #----------------------------------------------------------------------------- # Flags for compiling specific files rts/RtsMessages_CC_OPTS += -DProjectVersion=\"$(ProjectVersion)\" diff --git a/rules/distdir-way-opts.mk b/rules/distdir-way-opts.mk index 62a1451..c4d7168 100644 --- a/rules/distdir-way-opts.mk +++ b/rules/distdir-way-opts.mk @@ -190,7 +190,8 @@ $1_$2_$3_ALL_CC_OPTS = \ $$($1_$2_$3_CC_OPTS) \ $$($$(basename $$<)_CC_OPTS) \ $$($1_$2_EXTRA_CC_OPTS) \ - $$(EXTRA_CC_OPTS) + $$(EXTRA_CC_OPTS) \ + $$(if $$(findstring YES,$$($1_$2_SplitSections)),-ffunction-sections -fdata-sections) $1_$2_$3_GHC_CC_OPTS = \ $$(addprefix -optc, $$($1_$2_$3_ALL_CC_OPTS)) \ From git at git.haskell.org Sun Feb 12 01:09:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 12 Feb 2017 01:09:19 +0000 (UTC) Subject: [commit: ghc] master: Fix: hPutBuf issues unnecessary empty write syscalls for large writes (#13246) (805db96) Message-ID: <20170212010919.52E673A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/805db96544111bd548c9a32488a9c97996cc2b49/ghc >--------------------------------------------------------------- commit 805db96544111bd548c9a32488a9c97996cc2b49 Author: Niklas Hambüchen Date: Sat Feb 11 19:24:30 2017 -0500 Fix: hPutBuf issues unnecessary empty write syscalls for large writes (#13246) Until now, any `hPutBuf` that wrote `>= the handle buffer size` would trigger an unnecessary `write("")` system call before the actual write system call. This is fixed by making sure that we never flush an empty handle buffer: Only flush `when (w > 0)`. Reviewers: simonmar, austin, hvr, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3119 >--------------------------------------------------------------- 805db96544111bd548c9a32488a9c97996cc2b49 libraries/base/GHC/IO/Handle/Text.hs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/libraries/base/GHC/IO/Handle/Text.hs b/libraries/base/GHC/IO/Handle/Text.hs index 4a5e4cf..c53b429 100644 --- a/libraries/base/GHC/IO/Handle/Text.hs +++ b/libraries/base/GHC/IO/Handle/Text.hs @@ -745,11 +745,14 @@ bufWrite h_ at Handle__{..} ptr count can_block = writeIORef haByteBuffer old_buf{ bufR = w + count } return count - -- else, we have to flush - else do debugIO "hPutBuf: flushing first" - old_buf' <- Buffered.flushWriteBuffer haDevice old_buf - -- TODO: we should do a non-blocking flush here - writeIORef haByteBuffer old_buf' + -- else, we have to flush any existing handle buffer data + -- and can then write out the data in `ptr` directly. + else do -- No point flushing when there's nothing in the buffer. + when (w > 0) $ do + debugIO "hPutBuf: flushing first" + flushed_buf <- Buffered.flushWriteBuffer haDevice old_buf + -- TODO: we should do a non-blocking flush here + writeIORef haByteBuffer flushed_buf -- if we can fit in the buffer, then just loop if count < size then bufWrite h_ ptr count can_block From git at git.haskell.org Sun Feb 12 01:59:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 12 Feb 2017 01:59:42 +0000 (UTC) Subject: [commit: ghc] master: Bump hoopl submodule to 3.10.2.2 (e46a2e1) Message-ID: <20170212015942.6F2993A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e46a2e164f7a785892e481fb35d66f3a50678ce8/ghc >--------------------------------------------------------------- commit e46a2e164f7a785892e481fb35d66f3a50678ce8 Author: Ben Gamari Date: Sat Feb 11 20:20:16 2017 -0500 Bump hoopl submodule to 3.10.2.2 >--------------------------------------------------------------- e46a2e164f7a785892e481fb35d66f3a50678ce8 libraries/hoopl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/hoopl b/libraries/hoopl index 46d43d4..ac24864 160000 --- a/libraries/hoopl +++ b/libraries/hoopl @@ -1 +1 @@ -Subproject commit 46d43d439c30a237edd78b0bd7d86a31fe3efca9 +Subproject commit ac24864c2db7951a6f34674e2b11b69d37ef84ff From git at git.haskell.org Sun Feb 12 02:06:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 12 Feb 2017 02:06:40 +0000 (UTC) Subject: [commit: ghc] branch 'fd/fix-travis' deleted Message-ID: <20170212020640.2E0053A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Deleted branch: fd/fix-travis From git at git.haskell.org Sun Feb 12 02:06:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 12 Feb 2017 02:06:50 +0000 (UTC) Subject: [commit: ghc] branch 'fd/fix-travis2' deleted Message-ID: <20170212020650.747333A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Deleted branch: fd/fix-travis2 From git at git.haskell.org Sun Feb 12 02:07:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 12 Feb 2017 02:07:02 +0000 (UTC) Subject: [commit: ghc] branch 'fd/D2519' deleted Message-ID: <20170212020702.6E2673A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Deleted branch: fd/D2519 From git at git.haskell.org Sun Feb 12 02:07:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 12 Feb 2017 02:07:13 +0000 (UTC) Subject: [commit: ghc] branch 'foldr-to-foldl' deleted Message-ID: <20170212020713.763D53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Deleted branch: foldr-to-foldl From git at git.haskell.org Sun Feb 12 02:56:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 12 Feb 2017 02:56:23 +0000 (UTC) Subject: [commit: ghc] branch 'wip/T13227' deleted Message-ID: <20170212025623.425CC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Deleted branch: wip/T13227 From git at git.haskell.org Mon Feb 13 04:13:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Feb 2017 04:13:40 +0000 (UTC) Subject: [commit: ghc] master: Add index entry for signature files / Backpack. (a4ccd33) Message-ID: <20170213041340.734793A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a4ccd330273ccfd136481ee82ae9495f5dd5f146/ghc >--------------------------------------------------------------- commit a4ccd330273ccfd136481ee82ae9495f5dd5f146 Author: Edward Z. Yang Date: Fri Feb 10 00:48:42 2017 -0800 Add index entry for signature files / Backpack. Signed-off-by: Edward Z. Yang >--------------------------------------------------------------- a4ccd330273ccfd136481ee82ae9495f5dd5f146 docs/users_guide/separate_compilation.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/users_guide/separate_compilation.rst b/docs/users_guide/separate_compilation.rst index 9693cea..f6c710f 100644 --- a/docs/users_guide/separate_compilation.rst +++ b/docs/users_guide/separate_compilation.rst @@ -662,6 +662,9 @@ A hs-boot file is written in a subset of Haskell: Module signatures ----------------- +.. index:: + single: signature files; Backpack; hsig files + GHC 8.2 supports module signatures (``hsig`` files), which allow you to write a signature in place of a module implementation, deferring the choice of implementation until a later point in time. This feature is From git at git.haskell.org Mon Feb 13 04:13:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Feb 2017 04:13:43 +0000 (UTC) Subject: [commit: ghc] master: Setup more error context for Backpack operations. (8e9ad24) Message-ID: <20170213041343.2C6BB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8e9ad240a9345527fc0635b89cc39b4d73b08e03/ghc >--------------------------------------------------------------- commit 8e9ad240a9345527fc0635b89cc39b4d73b08e03 Author: Edward Z. Yang Date: Tue Feb 7 15:02:40 2017 -0800 Setup more error context for Backpack operations. Signed-off-by: Edward Z. Yang Test Plan: validate Reviewers: bgamari, simonpj, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3101 >--------------------------------------------------------------- 8e9ad240a9345527fc0635b89cc39b4d73b08e03 compiler/main/ErrUtils.hs | 1 - compiler/typecheck/TcBackpack.hs | 28 +++++++++++++++++----- compiler/utils/Outputable.hs | 11 ++++++++- .../backpack/cabal/bkpcabal02/bkpcabal02.stderr | 13 ++++++---- .../tests/backpack/should_fail/bkpfail01.stderr | 6 +++-- .../tests/backpack/should_fail/bkpfail03.stderr | 5 ++-- .../tests/backpack/should_fail/bkpfail04.stderr | 18 ++++++++------ .../tests/backpack/should_fail/bkpfail05.stderr | 3 ++- .../tests/backpack/should_fail/bkpfail06.stderr | 11 +++++---- .../tests/backpack/should_fail/bkpfail10.stderr | 22 +++++++++-------- .../tests/backpack/should_fail/bkpfail11.stderr | 9 +++---- .../tests/backpack/should_fail/bkpfail16.stderr | 3 ++- .../tests/backpack/should_fail/bkpfail17.stderr | 13 +++++----- .../tests/backpack/should_fail/bkpfail19.stderr | 5 ++-- .../tests/backpack/should_fail/bkpfail20.stderr | 6 ++++- .../tests/backpack/should_fail/bkpfail21.stderr | 8 +++++-- .../tests/backpack/should_fail/bkpfail22.stderr | 9 +++---- .../tests/backpack/should_fail/bkpfail23.stderr | 15 ++++++------ .../tests/backpack/should_fail/bkpfail25.stderr | 9 +++---- .../tests/backpack/should_fail/bkpfail26.stderr | 13 +++++----- .../tests/backpack/should_fail/bkpfail27.stderr | 11 +++++---- .../tests/backpack/should_fail/bkpfail29.stderr | 10 +++++--- .../tests/backpack/should_fail/bkpfail32.stderr | 3 ++- .../tests/backpack/should_fail/bkpfail33.stderr | 5 +++- .../tests/backpack/should_fail/bkpfail35.stderr | 3 ++- .../tests/backpack/should_fail/bkpfail37.stderr | 9 +++---- .../tests/backpack/should_fail/bkpfail38.stderr | 12 ++++++---- .../tests/backpack/should_fail/bkpfail42.stderr | 15 +++++++----- .../tests/backpack/should_fail/bkpfail43.stderr | 13 +++++----- 29 files changed, 181 insertions(+), 108 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 8e9ad240a9345527fc0635b89cc39b4d73b08e03 From git at git.haskell.org Mon Feb 13 04:13:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Feb 2017 04:13:45 +0000 (UTC) Subject: [commit: ghc] master: Remove obsolete Backpack manual. (c81f3bc) Message-ID: <20170213041345.DF64E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c81f3bc6a83efc7941dfe3d070de9a14c775f5cf/ghc >--------------------------------------------------------------- commit c81f3bc6a83efc7941dfe3d070de9a14c775f5cf Author: Edward Z. Yang Date: Fri Feb 10 00:50:22 2017 -0800 Remove obsolete Backpack manual. Signed-off-by: Edward Z. Yang >--------------------------------------------------------------- c81f3bc6a83efc7941dfe3d070de9a14c775f5cf docs/backpack/.gitignore | 12 - docs/backpack/Makefile | 10 - docs/backpack/algorithm.tex | 1392 ------------------ docs/backpack/arch.png | Bin 107562 -> 0 bytes docs/backpack/backpack-impl.bib | 17 - docs/backpack/backpack-impl.tex | 2519 --------------------------------- docs/backpack/backpack-manual.tex | 623 -------- docs/backpack/commands-new-new.tex | 891 ------------ docs/backpack/commands-rebindings.tex | 57 - docs/backpack/diagrams.xoj | Bin 118800 -> 0 bytes docs/backpack/pkgdb.png | Bin 61693 -> 0 bytes 11 files changed, 5521 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 c81f3bc6a83efc7941dfe3d070de9a14c775f5cf From git at git.haskell.org Mon Feb 13 04:13:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Feb 2017 04:13:48 +0000 (UTC) Subject: [commit: ghc] master: Slightly reword not-exported message. (2f16484) Message-ID: <20170213041348.8FD1C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2f164846884610cf78f02771711cd5613839b952/ghc >--------------------------------------------------------------- commit 2f164846884610cf78f02771711cd5613839b952 Author: Edward Z. Yang Date: Fri Feb 10 00:54:55 2017 -0800 Slightly reword not-exported message. Signed-off-by: Edward Z. Yang >--------------------------------------------------------------- 2f164846884610cf78f02771711cd5613839b952 compiler/typecheck/TcBackpack.hs | 3 ++- testsuite/tests/backpack/should_fail/bkpfail01.stderr | 4 ++-- testsuite/tests/backpack/should_fail/bkpfail05.stderr | 2 +- testsuite/tests/backpack/should_fail/bkpfail09.stderr | 4 ++-- testsuite/tests/backpack/should_fail/bkpfail16.stderr | 2 +- testsuite/tests/backpack/should_fail/bkpfail35.stderr | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/compiler/typecheck/TcBackpack.hs b/compiler/typecheck/TcBackpack.hs index 72cd89b..fe17af5 100644 --- a/compiler/typecheck/TcBackpack.hs +++ b/compiler/typecheck/TcBackpack.hs @@ -823,7 +823,8 @@ checkImplements impl_mod req_mod@(IndefModule uid mod_name) = forM_ (exportOccs (mi_exports isig_iface)) $ \occ -> case lookupGlobalRdrEnv impl_gr occ of [] -> addErr $ quotes (ppr occ) - <+> text "is exported by the hsig file, but not exported the module" + <+> text "is exported by the hsig file, but not" + <+> text "exported by the implementing module" <+> quotes (ppr impl_mod) _ -> return () failIfErrsM diff --git a/testsuite/tests/backpack/should_fail/bkpfail01.stderr b/testsuite/tests/backpack/should_fail/bkpfail01.stderr index 3231922..e88d122 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail01.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail01.stderr @@ -11,9 +11,9 @@ [1 of 2] Compiling H[sig] ( p/H.hsig, nothing ) bkpfail01.out/p/p-D5Mg3foBSCrDbQDKH4WGSG/../H.hi:1:1: error: - • ‘H’ is exported by the hsig file, but not exported the module ‘q:H’ + • ‘H’ is exported by the hsig file, but not exported by the implementing module ‘q:H’ • while checking that q:H implements signature H in p[H=q:H] bkpfail01.out/p/p-D5Mg3foBSCrDbQDKH4WGSG/../H.hi:1:1: error: - • ‘H’ is exported by the hsig file, but not exported the module ‘q:H’ + • ‘H’ is exported by the hsig file, but not exported by the implementing module ‘q:H’ • while checking that q:H implements signature H in p[H=q:H] diff --git a/testsuite/tests/backpack/should_fail/bkpfail05.stderr b/testsuite/tests/backpack/should_fail/bkpfail05.stderr index cb83305..b231bbd 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail05.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail05.stderr @@ -18,5 +18,5 @@ [1 of 1] Compiling H[sig] ( h/H.hsig, bkpfail05.out/h/h-5FYQgnNkfSvBT5yogOxPpf/H.o ) bkpfail05.out/h/h-5FYQgnNkfSvBT5yogOxPpf/../H.hi:1:1: error: - • ‘T1’ is exported by the hsig file, but not exported the module ‘h-impl:H’ + • ‘T1’ is exported by the hsig file, but not exported by the implementing module ‘h-impl:H’ • while checking that h-impl:H implements signature H in h[H=h-impl:H] diff --git a/testsuite/tests/backpack/should_fail/bkpfail09.stderr b/testsuite/tests/backpack/should_fail/bkpfail09.stderr index a767abc..b33c3b4 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail09.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail09.stderr @@ -7,9 +7,9 @@ [3 of 3] Processing r Command line argument: -unit-id p[H=H]:0:0: error: - • ‘H’ is exported by the hsig file, but not exported the module ‘q:H’ + • ‘H’ is exported by the hsig file, but not exported by the implementing module ‘q:H’ • while checking that q:H implements signature H in p[H=q:H] Command line argument: -unit-id p[H=H]:0:0: error: - • ‘H’ is exported by the hsig file, but not exported the module ‘q:H’ + • ‘H’ is exported by the hsig file, but not exported by the implementing module ‘q:H’ • while checking that q:H implements signature H in p[H=q:H] diff --git a/testsuite/tests/backpack/should_fail/bkpfail16.stderr b/testsuite/tests/backpack/should_fail/bkpfail16.stderr index 3b38ea8..bd7c229 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail16.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail16.stderr @@ -7,5 +7,5 @@ [1 of 1] Compiling ShouldFail[sig] ( p/ShouldFail.hsig, bkpfail16.out/p/p-1OqLaT7dAn947wScQQKCw5/ShouldFail.o ) bkpfail16.out/p/p-1OqLaT7dAn947wScQQKCw5/../ShouldFail.hi:1:1: error: - • ‘Booly’ is exported by the hsig file, but not exported the module ‘Data.Bool’ + • ‘Booly’ is exported by the hsig file, but not exported by the implementing module ‘Data.Bool’ • while checking that Data.Bool implements signature ShouldFail in p[ShouldFail=Data.Bool] diff --git a/testsuite/tests/backpack/should_fail/bkpfail35.stderr b/testsuite/tests/backpack/should_fail/bkpfail35.stderr index ceafe14..6b21317 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail35.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail35.stderr @@ -17,5 +17,5 @@ bkpfail35.bkp:8:18: warning: [1 of 1] Compiling A[sig] ( q/A.hsig, bkpfail35.out/q/q-E72T6bb4XRkIeTPWK2mCKa/A.o ) bkpfail35.out/q/q-E72T6bb4XRkIeTPWK2mCKa/../A.hi:1:1: error: - • ‘y’ is exported by the hsig file, but not exported the module ‘aimpl:A’ + • ‘y’ is exported by the hsig file, but not exported by the implementing module ‘aimpl:A’ • while checking that aimpl:A implements signature A in q[A=aimpl:A] From git at git.haskell.org Mon Feb 13 04:13:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Feb 2017 04:13:51 +0000 (UTC) Subject: [commit: ghc] master: Disable PVP warnings temporarily. (7666a9f) Message-ID: <20170213041351.488273A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7666a9febae0a578aedabc49bcdc87d487b0e252/ghc >--------------------------------------------------------------- commit 7666a9febae0a578aedabc49bcdc87d487b0e252 Author: Edward Z. Yang Date: Fri Feb 10 23:15:30 2017 -0800 Disable PVP warnings temporarily. While the intent is good, they are actually too aggressive: if a module reexports an identifier from a signature, we will warn (even though we should not!) We'll have to implement this differently. Signed-off-by: Edward Z. Yang >--------------------------------------------------------------- 7666a9febae0a578aedabc49bcdc87d487b0e252 compiler/typecheck/TcBackpack.hs | 12 ++++++++++-- testsuite/tests/backpack/should_compile/bkp10.stderr | 4 ---- testsuite/tests/backpack/should_compile/bkp11.stderr | 8 -------- testsuite/tests/backpack/should_compile/bkp24.stderr | 4 ---- testsuite/tests/backpack/should_compile/bkp36.stderr | 4 ---- 5 files changed, 10 insertions(+), 22 deletions(-) diff --git a/compiler/typecheck/TcBackpack.hs b/compiler/typecheck/TcBackpack.hs index fe17af5..cca40d8 100644 --- a/compiler/typecheck/TcBackpack.hs +++ b/compiler/typecheck/TcBackpack.hs @@ -16,7 +16,7 @@ module TcBackpack ( instantiateSignature, ) where -import BasicTypes (StringLiteral(..), SourceText(..), defaultFixity) +import BasicTypes (defaultFixity) import Packages import TcRnExports import DynFlags @@ -412,6 +412,7 @@ ifaceDeclNeverExportedRefs _ = [] -- the wheels of recompilation avoidance which assumes that -- source files always exist. +{- inheritedSigPvpWarning :: WarningTxt inheritedSigPvpWarning = WarningTxt (noLoc NoSourceText) [noLoc (StringLiteral NoSourceText (fsLit msg))] @@ -421,6 +422,7 @@ inheritedSigPvpWarning = "compatible with PVP-style version bounds. Instead, copy the " ++ "declaration to the local hsig file or move the signature to a " ++ "library of its own and add that library as a dependency." +-} -- Note [Handling never-exported TyThings under Backpack] -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -559,9 +561,15 @@ mergeSignatures hsmod lcl_iface0 = do let thinned_ifaces = reverse rev_thinned_ifaces exports = nameShapeExports nsubst rdr_env = mkGlobalRdrEnv (gresFromAvails Nothing exports) - warn_occs = filter (not . (`elemOccSet` ok_to_use)) (exportOccs exports) + _warn_occs = filter (not . (`elemOccSet` ok_to_use)) (exportOccs exports) + warns = NoWarnings + {- + -- TODO: Warnings are transitive, but this is not what we want here: + -- if a module reexports an entity from a signature, that should be OK. + -- Not supported in current warning framework warns | null warn_occs = NoWarnings | otherwise = WarnSome $ map (\o -> (o, inheritedSigPvpWarning)) warn_occs + -} setGblEnv tcg_env { tcg_rdr_env = rdr_env, tcg_exports = exports, diff --git a/testsuite/tests/backpack/should_compile/bkp10.stderr b/testsuite/tests/backpack/should_compile/bkp10.stderr index 13c33f3..350670e 100644 --- a/testsuite/tests/backpack/should_compile/bkp10.stderr +++ b/testsuite/tests/backpack/should_compile/bkp10.stderr @@ -4,7 +4,3 @@ [2 of 2] Processing q [1 of 2] Compiling H2[sig] ( q/H2.hsig, nothing ) [2 of 2] Compiling B ( q/B.hs, nothing ) - -bkp10.bkp:13:18: warning: [-Wdeprecations (in -Wdefault)] - In the use of type constructor or class ‘S’ (imported from H2): - "Inherited requirements from non-signature libraries (libraries with modules) should not be used, as this mode of use is not compatible with PVP-style version bounds. Instead, copy the declaration to the local hsig file or move the signature to a library of its own and add that library as a dependency." diff --git a/testsuite/tests/backpack/should_compile/bkp11.stderr b/testsuite/tests/backpack/should_compile/bkp11.stderr index ca45b49..a804563 100644 --- a/testsuite/tests/backpack/should_compile/bkp11.stderr +++ b/testsuite/tests/backpack/should_compile/bkp11.stderr @@ -5,11 +5,3 @@ [2 of 2] Processing q [1 of 2] Compiling H[sig] ( q/H.hsig, nothing ) [2 of 2] Compiling B ( q/B.hs, nothing ) - -bkp11.bkp:16:14: warning: [-Wdeprecations (in -Wdefault)] - In the use of type constructor or class ‘S’ (imported from H): - "Inherited requirements from non-signature libraries (libraries with modules) should not be used, as this mode of use is not compatible with PVP-style version bounds. Instead, copy the declaration to the local hsig file or move the signature to a library of its own and add that library as a dependency." - -bkp11.bkp:16:19: warning: [-Wdeprecations (in -Wdefault)] - In the use of type constructor or class ‘T’ (imported from H): - "Inherited requirements from non-signature libraries (libraries with modules) should not be used, as this mode of use is not compatible with PVP-style version bounds. Instead, copy the declaration to the local hsig file or move the signature to a library of its own and add that library as a dependency." diff --git a/testsuite/tests/backpack/should_compile/bkp24.stderr b/testsuite/tests/backpack/should_compile/bkp24.stderr index fbde703..ddafe41 100644 --- a/testsuite/tests/backpack/should_compile/bkp24.stderr +++ b/testsuite/tests/backpack/should_compile/bkp24.stderr @@ -11,10 +11,6 @@ [4 of 5] Processing q [1 of 2] Compiling B[sig] ( q/B.hsig, nothing ) [2 of 2] Compiling Q ( q/Q.hs, nothing ) - -bkp24.bkp:23:24: warning: [-Wdeprecations (in -Wdefault)] - In the use of type constructor or class ‘B’ (imported from B): - "Inherited requirements from non-signature libraries (libraries with modules) should not be used, as this mode of use is not compatible with PVP-style version bounds. Instead, copy the declaration to the local hsig file or move the signature to a library of its own and add that library as a dependency." [5 of 5] Processing r Instantiating r [1 of 2] Including q[B=b:B] diff --git a/testsuite/tests/backpack/should_compile/bkp36.stderr b/testsuite/tests/backpack/should_compile/bkp36.stderr index c891ab4..45ade14 100644 --- a/testsuite/tests/backpack/should_compile/bkp36.stderr +++ b/testsuite/tests/backpack/should_compile/bkp36.stderr @@ -7,7 +7,3 @@ [3 of 3] Processing q [1 of 2] Compiling B[sig] ( q/B.hsig, nothing ) [2 of 2] Compiling Q ( q/Q.hs, nothing ) - -bkp36.bkp:20:16: warning: [-Wdeprecations (in -Wdefault)] - In the use of type constructor or class ‘T’ (imported from B): - "Inherited requirements from non-signature libraries (libraries with modules) should not be used, as this mode of use is not compatible with PVP-style version bounds. Instead, copy the declaration to the local hsig file or move the signature to a library of its own and add that library as a dependency." From git at git.haskell.org Mon Feb 13 14:28:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Feb 2017 14:28:54 +0000 (UTC) Subject: [commit: ghc] master: Typos in notes and comments [ci skip] (20b5dfc) Message-ID: <20170213142854.CCB863A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/20b5dfc2a203fb06ba1971f9623578f1e66540b7/ghc >--------------------------------------------------------------- commit 20b5dfc2a203fb06ba1971f9623578f1e66540b7 Author: Gabor Greif Date: Mon Feb 13 13:37:59 2017 +0100 Typos in notes and comments [ci skip] >--------------------------------------------------------------- 20b5dfc2a203fb06ba1971f9623578f1e66540b7 compiler/simplCore/OccurAnal.hs | 6 +++--- compiler/simplCore/Simplify.hs | 2 +- compiler/typecheck/TcCanonical.hs | 2 +- compiler/typecheck/TcHsType.hs | 2 +- testsuite/tests/simplCore/should_run/T11731.hs | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/compiler/simplCore/OccurAnal.hs b/compiler/simplCore/OccurAnal.hs index 92c21ad..6217dc8 100644 --- a/compiler/simplCore/OccurAnal.hs +++ b/compiler/simplCore/OccurAnal.hs @@ -1907,7 +1907,7 @@ A: Saturated applications: eg f e1 .. en In general, given a call (f e1 .. en) we can propagate one-shot info from f's strictness signature into e1 .. en, but /only/ if n is enough to - saturate the strictness signature. A stricteness signature like + saturate the strictness signature. A strictness signature like f :: C1(C1(L))LS @@ -1924,10 +1924,10 @@ A: Saturated applications: eg f e1 .. en then the first argument of f will be called at most once. -A': Non-obviously satuated applications: eg build (f (\x y -> expensive)) +A': Non-obviously saturated applications: eg build (f (\x y -> expensive)) In this case, f is only manifestly applied to one argument, so it does not - look saturated. So bye the previous point, we should not use its strictness + look saturated. So by the previous point, we should not use its strictness signature to learn about the one-shotness of \x y. But in this case we can: build is fully applied, so we may use its strictness signature. From that diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index a6dbfc1..2ad080d 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -2283,7 +2283,7 @@ simplAlts env scrut case_bndr alts cont' ; (env1, case_bndr1) <- simplBinder env0 case_bndr ; let case_bndr2 = case_bndr1 `setIdUnfolding` evaldUnfolding env2 = modifyInScope env1 case_bndr2 - -- See Note [Case-binder evaluated-ness] + -- See Note [Case binder evaluated-ness] ; fam_envs <- getFamEnvs ; (alt_env', scrut', case_bndr') <- improveSeq fam_envs env2 scrut diff --git a/compiler/typecheck/TcCanonical.hs b/compiler/typecheck/TcCanonical.hs index 671cb13..038b6b9 100644 --- a/compiler/typecheck/TcCanonical.hs +++ b/compiler/typecheck/TcCanonical.hs @@ -443,7 +443,7 @@ mk_superclasses_of rec_clss ev cls tys where cls_nm = className cls loop_found = not (isCTupleClass cls) && cls_nm `elemNameSet` rec_clss - -- Tuples neveer contribute to recursion, and can be nested + -- Tuples never contribute to recursion, and can be nested rec_clss' = rec_clss `extendNameSet` cls_nm this_ct = CDictCan { cc_ev = ev, cc_class = cls, cc_tyargs = tys , cc_pend_sc = loop_found } diff --git a/compiler/typecheck/TcHsType.hs b/compiler/typecheck/TcHsType.hs index 15f6217..ef8d84c 100644 --- a/compiler/typecheck/TcHsType.hs +++ b/compiler/typecheck/TcHsType.hs @@ -1061,7 +1061,7 @@ Trac #11554 shows this example, which made GHC loop: data A :: Type where B :: forall (a :: A). P a -> A -In order to check the constructor B, we need have the promoted type A, but in +In order to check the constructor B, we need to have the promoted type A, but in order to get that promoted type, B must first be checked. To prevent looping, a TyConPE promotion error is given when tcTyVar checks an ATcTyCon in kind mode. Any ATcTyCon is a TyCon being defined in the current recursive group (see data diff --git a/testsuite/tests/simplCore/should_run/T11731.hs b/testsuite/tests/simplCore/should_run/T11731.hs index e148507..f61841e 100644 --- a/testsuite/tests/simplCore/should_run/T11731.hs +++ b/testsuite/tests/simplCore/should_run/T11731.hs @@ -10,7 +10,7 @@ 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 + -- This ensures 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 From git at git.haskell.org Mon Feb 13 15:16:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Feb 2017 15:16:31 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Generalize arrow (31134d5) Message-ID: <20170213151631.774E73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/31134d55138e6be4ea4abad6764b112a7ff5dce9/ghc >--------------------------------------------------------------- commit 31134d55138e6be4ea4abad6764b112a7ff5dce9 Author: Ben Gamari Date: Wed Feb 1 20:25:33 2017 -0500 Generalize arrow >--------------------------------------------------------------- 31134d55138e6be4ea4abad6764b112a7ff5dce9 compiler/coreSyn/CoreFVs.hs | 1 + compiler/coreSyn/CoreLint.hs | 33 ++++- compiler/coreSyn/CoreSubst.hs | 4 +- compiler/coreSyn/TrieMap.hs | 6 +- compiler/iface/ToIface.hs | 6 +- compiler/prelude/TysPrim.hs | 27 ++-- compiler/specialise/Rules.hs | 7 + compiler/typecheck/TcCanonical.hs | 23 ++- compiler/typecheck/TcSMonad.hs | 2 +- compiler/typecheck/TcTyDecls.hs | 1 + compiler/typecheck/TcType.hs | 73 ++++++++-- compiler/typecheck/TcUnify.hs | 3 + compiler/typecheck/TcValidity.hs | 1 + compiler/types/Coercion.hs | 119 ++++++++++++--- compiler/types/Coercion.hs-boot | 6 +- compiler/types/FamInstEnv.hs | 1 + compiler/types/OptCoercion.hs | 9 ++ compiler/types/TyCoRep.hs | 24 ++- compiler/types/TyCon.hs | 4 +- compiler/types/Type.hs | 161 ++++++++++++++++----- compiler/types/Unify.hs | 20 ++- libraries/base/tests/all.T | 2 +- testsuite/tests/ghci/scripts/T8535.stdout | 2 +- testsuite/tests/ghci/scripts/ghci020.stdout | 2 +- testsuite/tests/ghci/should_run/T10145.stdout | 2 +- .../partial-sigs/should_compile/T10403.stderr | 3 +- testsuite/tests/perf/compiler/all.T | 3 +- testsuite/tests/typecheck/should_compile/all.T | 1 + .../tests/typecheck/should_fail/tcfail181.stderr | 5 +- 29 files changed, 445 insertions(+), 106 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 31134d55138e6be4ea4abad6764b112a7ff5dce9 From git at git.haskell.org Mon Feb 13 15:16:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Feb 2017 15:16:43 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Disable Typeable binding generation for unboxed tuples (d31cdc4) Message-ID: <20170213151643.DC9003A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/d31cdc483534b6847fdc2e3e0c5abaed4f69b24a/ghc >--------------------------------------------------------------- commit d31cdc483534b6847fdc2e3e0c5abaed4f69b24a Author: Ben Gamari Date: Sun Feb 12 09:06:00 2017 -0500 Disable Typeable binding generation for unboxed tuples >--------------------------------------------------------------- d31cdc483534b6847fdc2e3e0c5abaed4f69b24a compiler/prelude/TysWiredIn.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/prelude/TysWiredIn.hs b/compiler/prelude/TysWiredIn.hs index ace7444..4c70382 100644 --- a/compiler/prelude/TysWiredIn.hs +++ b/compiler/prelude/TysWiredIn.hs @@ -974,7 +974,9 @@ mk_sum :: Arity -> (TyCon, Array ConTagZ DataCon) mk_sum arity = (tycon, sum_cons) where tycon = mkSumTyCon tc_name tc_binders tc_res_kind (arity * 2) tyvars (elems sum_cons) - (UnboxedAlgTyCon (mkPrelTyConRepName tc_name)) + (UnboxedAlgTyCon rep_name) + + rep_name = mkPrelTyConRepName tc_name tc_binders = mkTemplateTyConBinders (nOfThem arity runtimeRepTy) (\ks -> map tYPE ks) From git at git.haskell.org Mon Feb 13 15:16:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Feb 2017 15:16:34 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Fix #13264 (bb5953f) Message-ID: <20170213151634.3282B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/bb5953f048b51a965a6b3204ae0ed5040d1e6979/ghc >--------------------------------------------------------------- commit bb5953f048b51a965a6b3204ae0ed5040d1e6979 Author: Ben Gamari Date: Fri Feb 10 17:49:38 2017 -0500 Fix #13264 >--------------------------------------------------------------- bb5953f048b51a965a6b3204ae0ed5040d1e6979 compiler/typecheck/TcCanonical.hs | 24 ++++++++++++++++++++++-- compiler/typecheck/TcType.hs | 24 +++++++++++++++++++++++- 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/compiler/typecheck/TcCanonical.hs b/compiler/typecheck/TcCanonical.hs index 1cfa9a5..ad8e939 100644 --- a/compiler/typecheck/TcCanonical.hs +++ b/compiler/typecheck/TcCanonical.hs @@ -541,6 +541,25 @@ track whether or not we've already flattened. It is conceivable to do a better job at tracking whether or not a type is flattened, but this is left as future work. (Mar '15) + + +Note [FunTy and decomposing tycon applications] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +When can_eq_nc' attempts to decompose a tycon application we haven't yet zonked. +This means that we may very well have a FunTy containing a type of some unknown +kind. For instance, we may have, + + FunTy (a :: k) Int + +Where k is a unification variable. tcRepSplitTyConApp_maybe panics in the event +that it sees such a type as it cannot determine the RuntimeReps which the (->) +is applied to. Consequently, it is vital that we instead use +tcRepSplitTyConApp_maybe', which simply returns Nothing in such a case. + +When this happens can_eq_nc' will fail to decompose, zonk, and try again. +Zonking should fill the variable k, meaning that decomposition will succeed the +second time around. -} canEqNC :: CtEvidence -> EqRel -> Type -> Type -> TcS (StopOrContinue Ct) @@ -614,8 +633,9 @@ can_eq_nc' _flat _rdr_env _envs ev eq_rel ty1@(LitTy l1) _ (LitTy l2) _ -- Try to decompose type constructor applications -- Including FunTy (s -> t) can_eq_nc' _flat _rdr_env _envs ev eq_rel ty1 _ ty2 _ - | Just (tc1, tys1) <- tcRepSplitTyConApp_maybe ty1 - , Just (tc2, tys2) <- tcRepSplitTyConApp_maybe ty2 + --- See Note [FunTy and decomposing type constructor applications]. + | Just (tc1, tys1) <- tcRepSplitTyConApp_maybe' ty1 + , Just (tc2, tys2) <- tcRepSplitTyConApp_maybe' ty2 , not (isTypeFamilyTyCon tc1) , not (isTypeFamilyTyCon tc2) = canTyConApp ev eq_rel tc1 tys1 tc2 tys2 diff --git a/compiler/typecheck/TcType.hs b/compiler/typecheck/TcType.hs index 3581d87..63cc1ee 100644 --- a/compiler/typecheck/TcType.hs +++ b/compiler/typecheck/TcType.hs @@ -62,7 +62,8 @@ module TcType ( tcSplitPhiTy, tcSplitPredFunTy_maybe, tcSplitFunTy_maybe, tcSplitFunTys, tcFunArgTy, tcFunResultTy, tcFunResultTyN, tcSplitFunTysN, - tcSplitTyConApp, tcSplitTyConApp_maybe, tcRepSplitTyConApp_maybe, + tcSplitTyConApp, tcSplitTyConApp_maybe, + tcRepSplitTyConApp_maybe, tcRepSplitTyConApp_maybe', tcTyConAppTyCon, tcTyConAppTyCon_maybe, tcTyConAppArgs, tcSplitAppTy_maybe, tcSplitAppTy, tcSplitAppTys, tcRepSplitAppTy_maybe, tcGetTyVar_maybe, tcGetTyVar, nextRole, @@ -1458,6 +1459,7 @@ tcSplitTyConApp_maybe :: HasCallStack => Type -> Maybe (TyCon, [Type]) tcSplitTyConApp_maybe ty | Just ty' <- coreView ty = tcSplitTyConApp_maybe ty' tcSplitTyConApp_maybe ty = tcRepSplitTyConApp_maybe ty +-- | Like 'tcSplitTyConApp_maybe' but doesn't look through type synonyms. tcRepSplitTyConApp_maybe :: HasCallStack => Type -> Maybe (TyCon, [Type]) tcRepSplitTyConApp_maybe (TyConApp tc tys) = Just (tc, tys) tcRepSplitTyConApp_maybe (FunTy arg res) @@ -1469,6 +1471,26 @@ tcRepSplitTyConApp_maybe (FunTy arg res) = pprPanic "tcRepSplitTyConApp_maybe" (ppr arg $$ ppr res) tcRepSplitTyConApp_maybe _ = Nothing +-- | Like 'tcRepSplitTyConApp_maybe', but returns 'Nothing' if, +-- +-- 1. the type is structurally not a type constructor application, or +-- +-- 2. the type is a function type (e.g. application of 'funTyCon'), but we +-- currently don't even enough information to fully determine its RuntimeRep +-- variables. For instance, @FunTy (a :: k) Int at . +-- +-- By constrast 'tcRepSplitTyConApp_maybe' panics in the second case. +-- +-- The behavior here is needed during canonicalization; see Note [FunTy and +-- decomposing tycon applications] in TcCanonical for details. +tcRepSplitTyConApp_maybe' :: HasCallStack => Type -> Maybe (TyCon, [Type]) +tcRepSplitTyConApp_maybe' (TyConApp tc tys) = Just (tc, tys) +tcRepSplitTyConApp_maybe' (FunTy arg res) + | Just arg_rep <- getRuntimeRep_maybe arg + , Just res_rep <- getRuntimeRep_maybe res + = Just (funTyCon, [arg_rep, res_rep, arg, res]) +tcRepSplitTyConApp_maybe' _ = Nothing + ----------------------- tcSplitFunTys :: Type -> ([Type], Type) From git at git.haskell.org Mon Feb 13 15:16:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Feb 2017 15:16:46 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Mark KindReps as noinline (cbe7dac) Message-ID: <20170213151646.977233A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/cbe7dac78618b7ef4ac382c68e69c2f9aa8d3044/ghc >--------------------------------------------------------------- commit cbe7dac78618b7ef4ac382c68e69c2f9aa8d3044 Author: Ben Gamari Date: Sun Feb 12 09:18:43 2017 -0500 Mark KindReps as noinline >--------------------------------------------------------------- cbe7dac78618b7ef4ac382c68e69c2f9aa8d3044 compiler/basicTypes/MkId.hs | 2 +- compiler/typecheck/TcTypeable.hs | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/compiler/basicTypes/MkId.hs b/compiler/basicTypes/MkId.hs index 65860d9..8a204be 100644 --- a/compiler/basicTypes/MkId.hs +++ b/compiler/basicTypes/MkId.hs @@ -31,7 +31,7 @@ module MkId ( voidPrimId, voidArgId, nullAddrId, seqId, lazyId, lazyIdKey, runRWId, coercionTokenId, magicDictId, coerceId, - proxyHashId, noinlineIdName, + proxyHashId, noinlineId, noinlineIdName, -- Re-export error Ids module PrelRules diff --git a/compiler/typecheck/TcTypeable.hs b/compiler/typecheck/TcTypeable.hs index 1676b76..247dc6d 100644 --- a/compiler/typecheck/TcTypeable.hs +++ b/compiler/typecheck/TcTypeable.hs @@ -22,6 +22,7 @@ import TysPrim ( primTyCons ) import TysWiredIn ( tupleTyCon, sumTyCon, runtimeRepTyCon , vecCountTyCon, vecElemTyCon , nilDataCon, consDataCon ) +import MkId ( noinlineId ) import Id import Type import Kind ( isTYPEApp ) @@ -396,13 +397,18 @@ mkTyConRepTyConRHS :: TypeableStuff -> TypeRepTodo -> TcRn (LHsExpr Id) mkTyConRepTyConRHS stuff@(Stuff {..}) todo tycon tycon_kind = do kind_rep <- mkTyConKindRep stuff tycon tycon_kind + -- We mark kind reps as noinline as they tend to get floated + -- out and consequently blow up interface file sizes. + let kind_rep' = mkLHsWrap (mkWpTyApps [mkTyConTy kindRepTyCon]) + (nlHsVar noinlineId) + `nlHsApp` kind_rep let rep_rhs = nlHsDataCon trTyConDataCon `nlHsApp` nlHsLit (word64 dflags high) `nlHsApp` nlHsLit (word64 dflags low) `nlHsApp` mod_rep_expr todo `nlHsApp` trNameLit (mkFastString tycon_str) `nlHsApp` nlHsLit (int n_kind_vars) - `nlHsApp` kind_rep + `nlHsApp` kind_rep' return rep_rhs where n_kind_vars = length $ filter isNamedTyConBinder (tyConBinders tycon) From git at git.haskell.org Mon Feb 13 15:16:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Feb 2017 15:16:41 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Move Typeable Binary instances to binary package (c5a8e9e) Message-ID: <20170213151641.338843A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/c5a8e9e9a96b29b60f0e0e96d2e0067258b16bd0/ghc >--------------------------------------------------------------- commit c5a8e9e9a96b29b60f0e0e96d2e0067258b16bd0 Author: Ben Gamari Date: Wed Feb 8 23:00:46 2017 -0500 Move Typeable Binary instances to binary package >--------------------------------------------------------------- c5a8e9e9a96b29b60f0e0e96d2e0067258b16bd0 libraries/binary | 2 +- libraries/ghci/GHCi/TH/Binary.hs | 176 --------------------------------------- 2 files changed, 1 insertion(+), 177 deletions(-) diff --git a/libraries/binary b/libraries/binary index af1d17c..abda726 160000 --- a/libraries/binary +++ b/libraries/binary @@ -1 +1 @@ -Subproject commit af1d17c27867f644886fcbc4703eb3e48792f3e7 +Subproject commit abda726cceef5d5533feffcc79e9fe1cdfb4e2cc diff --git a/libraries/ghci/GHCi/TH/Binary.hs b/libraries/ghci/GHCi/TH/Binary.hs index fcff168..439a43d 100644 --- a/libraries/ghci/GHCi/TH/Binary.hs +++ b/libraries/ghci/GHCi/TH/Binary.hs @@ -10,14 +10,6 @@ module GHCi.TH.Binary () where import Data.Binary import qualified Data.ByteString as B -#if MIN_VERSION_base(4,10,0) -import Type.Reflection -import Type.Reflection.Unsafe -import Data.Kind (Type) -import GHC.Exts (RuntimeRep(..), VecCount, VecElem) -#else -import Data.Typeable -#endif import GHC.Serialized import qualified Language.Haskell.TH as TH import qualified Language.Haskell.TH.Syntax as TH @@ -79,174 +71,6 @@ instance Binary TH.PatSynArgs -- We need Binary TypeRep for serializing annotations -#if MIN_VERSION_base(4,10,0) -instance Binary VecCount where - put = putWord8 . fromIntegral . fromEnum - get = toEnum . fromIntegral <$> getWord8 - -instance Binary VecElem where - put = putWord8 . fromIntegral . fromEnum - get = toEnum . fromIntegral <$> getWord8 - -instance Binary RuntimeRep where - put (VecRep a b) = putWord8 0 >> put a >> put b - put (TupleRep reps) = putWord8 1 >> put reps - put (SumRep reps) = putWord8 2 >> put reps - put LiftedRep = putWord8 3 - put UnliftedRep = putWord8 4 - put IntRep = putWord8 5 - put WordRep = putWord8 6 - put Int64Rep = putWord8 7 - put Word64Rep = putWord8 8 - put AddrRep = putWord8 9 - put FloatRep = putWord8 10 - put DoubleRep = putWord8 11 - - get = do - tag <- getWord8 - case tag of - 0 -> VecRep <$> get <*> get - 1 -> TupleRep <$> get - 2 -> SumRep <$> get - 3 -> pure LiftedRep - 4 -> pure UnliftedRep - 5 -> pure IntRep - 6 -> pure WordRep - 7 -> pure Int64Rep - 8 -> pure Word64Rep - 9 -> pure AddrRep - 10 -> pure FloatRep - 11 -> pure DoubleRep - _ -> fail "GHCi.TH.Binary.putRuntimeRep: invalid tag" - -instance Binary TyCon where - put tc = do - put (tyConPackage tc) - put (tyConModule tc) - put (tyConName tc) - put (tyConKindArgs tc) - put (tyConKindRep tc) - get = mkTyCon <$> get <*> get <*> get <*> get <*> get - -instance Binary KindRep where - put (KindRepTyConApp tc k) = putWord8 0 >> put tc >> put k - put (KindRepVar bndr) = putWord8 1 >> put bndr - put (KindRepApp a b) = putWord8 2 >> put a >> put b - put (KindRepFun a b) = putWord8 3 >> put a >> put b - put (KindRepTYPE r) = putWord8 4 >> put r - put (KindRepTypeLit sort r) = putWord8 5 >> put sort >> put r - put _ = fail "GHCi.TH.Binary.putKindRep: Impossible" - - get = do - tag <- getWord8 - case tag of - 0 -> KindRepTyConApp <$> get <*> get - 1 -> KindRepVar <$> get - 2 -> KindRepApp <$> get <*> get - 3 -> KindRepFun <$> get <*> get - 4 -> KindRepTYPE <$> get - 5 -> KindRepTypeLit <$> get <*> get - _ -> fail "GHCi.TH.Binary.putKindRep: invalid tag" - -instance Binary TypeLitSort where - put TypeLitSymbol = putWord8 0 - put TypeLitNat = putWord8 1 - get = do - tag <- getWord8 - case tag of - 0 -> pure TypeLitSymbol - 1 -> pure TypeLitNat - _ -> fail "GHCi.TH.Binary.putTypeLitSort: invalid tag" - -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 -- Handle Type specially since it's so common - | Just HRefl <- rep `eqTypeRep` (typeRep :: TypeRep Type) - = put (0 :: Word8) -putTypeRep (Con' con ks) = do - put (1 :: Word8) - put con - put ks -putTypeRep (App f x) = do - put (2 :: Word8) - putTypeRep f - putTypeRep x -putTypeRep (Fun arg res) = do - put (3 :: Word8) - putTypeRep arg - putTypeRep res -putTypeRep _ = fail "GHCi.TH.Binary.putTypeRep: Impossible" - -getSomeTypeRep :: Get SomeTypeRep -getSomeTypeRep = do - tag <- get :: Get Word8 - case tag of - 0 -> return $ SomeTypeRep (typeRep :: TypeRep Type) - 1 -> do con <- get :: Get TyCon - ks <- get :: Get [SomeTypeRep] - return $ SomeTypeRep $ mkTrCon con ks - 2 -> do SomeTypeRep f <- getSomeTypeRep - SomeTypeRep x <- getSomeTypeRep - case typeRepKind f of - Fun arg res -> - case arg `eqTypeRep` typeRepKind x of - Just HRefl -> do - case typeRepKind res `eqTypeRep` (typeRep :: TypeRep Type) of - Just HRefl -> return $ SomeTypeRep $ mkTrApp f x - _ -> failure "Kind mismatch" [] - _ -> failure "Kind mismatch" - [ "Found argument of kind: " ++ show (typeRepKind x) - , "Where the constructor: " ++ show f - , "Expects an argument of kind: " ++ show arg - ] - _ -> failure "Applied non-arrow type" - [ "Applied type: " ++ show f - , "To argument: " ++ show x - ] - 3 -> do SomeTypeRep arg <- getSomeTypeRep - SomeTypeRep res <- getSomeTypeRep - case typeRepKind arg `eqTypeRep` (typeRep :: TypeRep Type) of - Just HRefl -> - case typeRepKind res `eqTypeRep` (typeRep :: TypeRep Type) of - Just HRefl -> return $ SomeTypeRep $ Fun arg res - Nothing -> failure "Kind mismatch" [] - Nothing -> failure "Kind mismatch" [] - _ -> failure "Invalid SomeTypeRep" [] - where - failure description info = - fail $ unlines $ [ "GHCi.TH.Binary.getSomeTypeRep: "++description ] - ++ map (" "++) info - -instance Typeable a => Binary (TypeRep (a :: k)) where - put = putTypeRep - get = do - SomeTypeRep rep <- getSomeTypeRep - case rep `eqTypeRep` expected of - Just HRefl -> pure rep - Nothing -> fail $ unlines - [ "GHCi.TH.Binary: Type mismatch" - , " Deserialized type: " ++ show rep - , " Expected type: " ++ show expected - ] - where expected = typeRep :: TypeRep a - -instance Binary SomeTypeRep where - put (SomeTypeRep rep) = putTypeRep rep - get = getSomeTypeRep -#else -instance Binary TyCon where - put tc = put (tyConPackage tc) >> put (tyConModule tc) >> put (tyConName tc) - get = mkTyCon3 <$> get <*> get <*> get - -instance Binary TypeRep where - put type_rep = put (splitTyConApp type_rep) - get = do - (ty_con, child_type_reps) <- get - return (mkTyConApp ty_con child_type_reps) -#endif - instance Binary Serialized where put (Serialized tyrep wds) = put tyrep >> put (B.pack wds) get = Serialized <$> get <*> (B.unpack <$> get) From git at git.haskell.org Mon Feb 13 15:16:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Feb 2017 15:16:38 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Type-indexed Typeable (5691e41) Message-ID: <20170213151638.70BE53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/5691e41ab49c13b44bb5799bb7140eef34883ec1/ghc >--------------------------------------------------------------- commit 5691e41ab49c13b44bb5799bb7140eef34883ec1 Author: Ben Gamari Date: Thu Feb 2 01:29:26 2017 -0500 Type-indexed Typeable >--------------------------------------------------------------- 5691e41ab49c13b44bb5799bb7140eef34883ec1 compiler/backpack/RnModIface.hs | 3 + compiler/basicTypes/OccName.hs | 12 +- compiler/coreSyn/CoreLint.hs | 2 +- compiler/deSugar/DsBinds.hs | 101 +-- compiler/prelude/KnownUniques.hs | 47 +- compiler/prelude/PrelNames.hs | 149 ++++- compiler/prelude/THNames.hs | 32 +- compiler/prelude/TysWiredIn.hs | 4 +- compiler/rename/RnSource.hs | 29 +- compiler/typecheck/TcBackpack.hs | 4 +- compiler/typecheck/TcEvidence.hs | 19 +- compiler/typecheck/TcHsSyn.hs | 12 +- compiler/typecheck/TcInteract.hs | 46 +- compiler/typecheck/TcRnDriver.hs | 6 +- compiler/typecheck/TcSMonad.hs | 7 +- compiler/typecheck/TcTypeable.hs | 465 ++++++++++--- compiler/types/Kind.hs | 14 +- compiler/types/TyCon.hs | 6 +- compiler/types/Type.hs | 4 +- compiler/types/Type.hs-boot | 5 + compiler/utils/Binary.hs | 177 ++++- compiler/utils/Fingerprint.hsc | 1 + libraries/base/Data/Dynamic.hs | 55 +- libraries/base/Data/Type/Equality.hs | 6 + libraries/base/Data/Typeable.hs | 226 +++++-- libraries/base/Data/Typeable/Internal.hs | 736 ++++++++++++++------- libraries/base/GHC/Conc/Sync.hs | 4 - libraries/base/GHC/Show.hs | 4 +- libraries/base/Type/Reflection.hs | 41 ++ libraries/base/Type/Reflection/Unsafe.hs | 22 + libraries/base/base.cabal | 4 +- libraries/base/tests/T11334a.stdout | 2 +- libraries/base/tests/all.T | 2 +- libraries/base/tests/dynamic002.hs | 5 + libraries/base/tests/dynamic002.stdout | 2 +- libraries/base/tests/dynamic004.hs | 1 - libraries/ghc-boot/GHC/Serialized.hs | 15 +- libraries/ghc-prim/GHC/Classes.hs | 8 +- libraries/ghc-prim/GHC/Types.hs | 40 +- libraries/ghci/GHCi/Message.hs | 6 +- libraries/ghci/GHCi/TH/Binary.hs | 171 +++++ .../tests/deSugar/should_compile/T2431.stderr | 98 ++- .../tests/dependent/should_compile/RaeJobTalk.hs | 52 +- testsuite/tests/dependent/should_compile/T11711.hs | 10 +- .../dependent/should_compile/dynamic-paper.hs | 16 +- testsuite/tests/deriving/perf/all.T | 5 +- .../tests/ghci.debugger/scripts/print019.stderr | 6 +- .../parser/should_compile/DumpRenamedAst.stderr | 42 +- testsuite/tests/patsyn/should_compile/T12698.hs | 2 +- testsuite/tests/perf/compiler/all.T | 10 +- testsuite/tests/perf/should_run/all.T | 3 +- testsuite/tests/polykinds/T8132.hs | 5 +- testsuite/tests/polykinds/T8132.stderr | 2 +- testsuite/tests/roles/should_compile/Roles1.stderr | 128 +++- .../tests/roles/should_compile/Roles13.stderr | 144 +++- .../tests/roles/should_compile/Roles14.stderr | 18 +- testsuite/tests/roles/should_compile/Roles2.stderr | 36 +- testsuite/tests/roles/should_compile/Roles3.stderr | 77 ++- testsuite/tests/roles/should_compile/Roles4.stderr | 38 +- testsuite/tests/roles/should_compile/T8958.stderr | 68 +- .../tests/safeHaskell/unsafeLibs/GoodImport03.hs | 3 +- .../tests/simplCore/should_compile/T7360.stderr | 141 ++-- .../tests/simplCore/should_compile/T8274.stdout | 25 +- testsuite/tests/th/TH_Roles2.stderr | 12 +- .../typecheck/should_fail/FrozenErrorTests.stderr | 5 +- .../should_fail/TcStaticPointersFail02.stderr | 4 +- .../typecheck/should_run/TestTypeableBinary.hs | 37 ++ .../typecheck/should_run/TestTypeableBinary.stdout | 15 + testsuite/tests/typecheck/should_run/TypeOf.stdout | 6 +- testsuite/tests/typecheck/should_run/TypeRep.hs | 12 +- .../tests/typecheck/should_run/TypeRep.stdout | 6 +- testsuite/tests/typecheck/should_run/Typeable1.hs | 23 + .../tests/typecheck/should_run/Typeable1.stderr | 25 + testsuite/tests/typecheck/should_run/TypeableEq.hs | 79 +++ .../tests/typecheck/should_run/TypeableEq.stdout | 10 + testsuite/tests/typecheck/should_run/all.T | 3 + 76 files changed, 2741 insertions(+), 920 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 5691e41ab49c13b44bb5799bb7140eef34883ec1 From git at git.haskell.org Mon Feb 13 15:16:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Feb 2017 15:16:49 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Plop kindreps in another binding (a6599dc) Message-ID: <20170213151649.55EB03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/a6599dcc794e0db830151a9feee08a0109180a4f/ghc >--------------------------------------------------------------- commit a6599dcc794e0db830151a9feee08a0109180a4f Author: Ben Gamari Date: Sun Feb 12 10:10:03 2017 -0500 Plop kindreps in another binding >--------------------------------------------------------------- a6599dcc794e0db830151a9feee08a0109180a4f compiler/typecheck/TcTypeable.hs | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/compiler/typecheck/TcTypeable.hs b/compiler/typecheck/TcTypeable.hs index 247dc6d..4605c39 100644 --- a/compiler/typecheck/TcTypeable.hs +++ b/compiler/typecheck/TcTypeable.hs @@ -8,7 +8,7 @@ module TcTypeable(mkTypeableBinds) where -import BasicTypes ( SourceText(..), Boxity(..) ) +import BasicTypes ( SourceText(..), Boxity(..), neverInlinePragma ) import TcBinds( addTypecheckedBinds ) import IfaceEnv( newGlobalBinder ) import TyCoRep( Type(..), TyLit(..) ) @@ -22,7 +22,6 @@ import TysPrim ( primTyCons ) import TysWiredIn ( tupleTyCon, sumTyCon, runtimeRepTyCon , vecCountTyCon, vecElemTyCon , nilDataCon, consDataCon ) -import MkId ( noinlineId ) import Id import Type import Kind ( isTYPEApp ) @@ -39,7 +38,7 @@ import VarEnv import Constants import Fingerprint(Fingerprint(..), fingerprintString, fingerprintFingerprints) import Outputable -import FastString ( FastString, mkFastString ) +import FastString ( FastString, mkFastString, fsLit ) import Data.Maybe ( isJust ) import Data.Word( Word64 ) @@ -260,8 +259,9 @@ mkTypeableTyConBinds todos -- promoted constructors. mk_typeable_binds :: TypeableStuff -> TcGblEnv -> TypeRepTodo -> TcM TcGblEnv mk_typeable_binds stuff gbl_env todo - = do binds <- mapM (mkTyConRepBinds stuff todo) (todo_tycons todo) - return $ gbl_env `addTypecheckedBinds` binds + = do pairs <- mapM (mkTyConRepBinds stuff todo) (todo_tycons todo) + gbl_env <- tcExtendGlobalValEnv (map fst pairs) (return gbl_env) + return $ gbl_env `addTypecheckedBinds` map snd pairs -- | Generate bindings for the type representation of a wired-in 'TyCon's -- defined by the virtual "GHC.Prim" module. This is where we inject the @@ -355,11 +355,18 @@ mkTrNameLit = do -- | Make typeable bindings for the given 'TyCon'. mkTyConRepBinds :: TypeableStuff -> TypeRepTodo - -> TypeableTyCon -> TcRn (LHsBinds Id) + -> TypeableTyCon -> TcRn (Id, LHsBinds Id) mkTyConRepBinds stuff@(Stuff {..}) todo (TypeableTyCon {..}) - = do tycon_rep_rhs <- mkTyConRepTyConRHS stuff todo tycon tycon_kind - let tycon_rep = mkVarBind tycon_rep_id tycon_rep_rhs - return $ unitBag tycon_rep + = do -- Place a NOINLINE pragma on KindReps since they tend to be quite large + -- and bloat interface files. + kind_rep_id <- (`setInlinePragma` neverInlinePragma) + <$> newSysLocalId (fsLit "krep") (mkTyConTy kindRepTyCon) + kind_rep <- mkTyConKindRep stuff tycon tycon_kind + + tycon_rep_rhs <- mkTyConRepTyConRHS stuff todo tycon kind_rep_id + let tycon_rep_bind = mkVarBind tycon_rep_id tycon_rep_rhs + kind_rep_bind = mkVarBind kind_rep_id kind_rep + return (kind_rep_id, listToBag [tycon_rep_bind, kind_rep_bind]) -- | Here is where we define the set of Typeable types. These exclude type -- families and polytypes. @@ -393,22 +400,16 @@ typeIsTypeable (CoercionTy{}) = panic "typeIsTypeable(Coercion)" -- | Produce the right-hand-side of a @TyCon@ representation. mkTyConRepTyConRHS :: TypeableStuff -> TypeRepTodo - -> TyCon -> Kind + -> TyCon -> Id -> TcRn (LHsExpr Id) -mkTyConRepTyConRHS stuff@(Stuff {..}) todo tycon tycon_kind - = do kind_rep <- mkTyConKindRep stuff tycon tycon_kind - -- We mark kind reps as noinline as they tend to get floated - -- out and consequently blow up interface file sizes. - let kind_rep' = mkLHsWrap (mkWpTyApps [mkTyConTy kindRepTyCon]) - (nlHsVar noinlineId) - `nlHsApp` kind_rep - let rep_rhs = nlHsDataCon trTyConDataCon +mkTyConRepTyConRHS (Stuff {..}) todo tycon kind_rep_id + = do let rep_rhs = nlHsDataCon trTyConDataCon `nlHsApp` nlHsLit (word64 dflags high) `nlHsApp` nlHsLit (word64 dflags low) `nlHsApp` mod_rep_expr todo `nlHsApp` trNameLit (mkFastString tycon_str) `nlHsApp` nlHsLit (int n_kind_vars) - `nlHsApp` kind_rep' + `nlHsApp` nlHsVar kind_rep_id return rep_rhs where n_kind_vars = length $ filter isNamedTyConBinder (tyConBinders tycon) From git at git.haskell.org Mon Feb 13 15:16:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Feb 2017 15:16:52 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Make unboxed sums not Typeable (ad6d51c) Message-ID: <20170213151652.096453A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/ad6d51c4d4561ff4eeade88158b4f9dc4dea8ec0/ghc >--------------------------------------------------------------- commit ad6d51c4d4561ff4eeade88158b4f9dc4dea8ec0 Author: Ben Gamari Date: Sun Feb 12 12:54:59 2017 -0500 Make unboxed sums not Typeable >--------------------------------------------------------------- ad6d51c4d4561ff4eeade88158b4f9dc4dea8ec0 compiler/prelude/TysWiredIn.hs | 5 +++-- compiler/types/TyCon.hs | 9 +++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/compiler/prelude/TysWiredIn.hs b/compiler/prelude/TysWiredIn.hs index 4c70382..77fef17 100644 --- a/compiler/prelude/TysWiredIn.hs +++ b/compiler/prelude/TysWiredIn.hs @@ -865,7 +865,7 @@ mk_tuple Unboxed arity = (tycon, tuple_con) tc_res_kind = unboxedTupleKind rr_tys tc_arity = arity * 2 - flavour = UnboxedAlgTyCon (mkPrelTyConRepName tc_name) + flavour = UnboxedAlgTyCon $ Just (mkPrelTyConRepName tc_name) dc_tvs = binderVars tc_binders (rr_tys, dc_arg_tys) = splitAt arity (mkTyVarTys dc_tvs) @@ -976,7 +976,8 @@ mk_sum arity = (tycon, sum_cons) tycon = mkSumTyCon tc_name tc_binders tc_res_kind (arity * 2) tyvars (elems sum_cons) (UnboxedAlgTyCon rep_name) - rep_name = mkPrelTyConRepName tc_name + -- Unboxed sums are currently not Typeable due to efficiency concerns. See #13276. + rep_name = Nothing -- Just $ mkPrelTyConRepName tc_name tc_binders = mkTemplateTyConBinders (nOfThem arity runtimeRepTy) (\ks -> map tYPE ks) diff --git a/compiler/types/TyCon.hs b/compiler/types/TyCon.hs index 1c749dc..e82d0cf 100644 --- a/compiler/types/TyCon.hs +++ b/compiler/types/TyCon.hs @@ -895,10 +895,11 @@ data AlgTyConFlav VanillaAlgTyCon TyConRepName - -- | An unboxed type constructor. Note that this carries no TyConRepName - -- as it is not representable. + -- | An unboxed type constructor. The TyConRepName is a Maybe since we + -- currently don't allow unboxed sums to be Typeable since there are too + -- many of them. See #13276. | UnboxedAlgTyCon - TyConRepName + (Maybe TyConRepName) -- | Type constructors representing a class dictionary. -- See Note [ATyCon for classes] in TyCoRep @@ -1170,7 +1171,7 @@ tyConRepName_maybe (PrimTyCon { primRepName = mb_rep_nm }) tyConRepName_maybe (AlgTyCon { algTcParent = parent }) | VanillaAlgTyCon rep_nm <- parent = Just rep_nm | ClassTyCon _ rep_nm <- parent = Just rep_nm - | UnboxedAlgTyCon rep_nm <- parent = Just rep_nm + | UnboxedAlgTyCon rep_nm <- parent = rep_nm tyConRepName_maybe (FamilyTyCon { famTcFlav = DataFamilyTyCon rep_nm }) = Just rep_nm tyConRepName_maybe (PromotedDataCon { tcRepName = rep_nm }) From git at git.haskell.org Mon Feb 13 15:16:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Feb 2017 15:16:54 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Fix tests (42f3cb5) Message-ID: <20170213151654.BAFEC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/42f3cb50d0b561c11c21ee52854781583c3a7fa9/ghc >--------------------------------------------------------------- commit 42f3cb50d0b561c11c21ee52854781583c3a7fa9 Author: Ben Gamari Date: Sun Feb 12 16:46:19 2017 -0500 Fix tests >--------------------------------------------------------------- 42f3cb50d0b561c11c21ee52854781583c3a7fa9 .../tests/deSugar/should_compile/T2431.stderr | 84 +++---- testsuite/tests/deriving/perf/all.T | 4 +- .../parser/should_compile/DumpRenamedAst.stderr | 42 ++-- .../should_compile/DumpTypecheckedAst.stderr | 252 +++++++++++++++------ testsuite/tests/perf/compiler/all.T | 113 ++++----- testsuite/tests/perf/haddock/all.T | 6 +- testsuite/tests/perf/space_leaks/all.T | 6 +- testsuite/tests/roles/should_compile/Roles1.stderr | 140 +++++++----- .../tests/roles/should_compile/Roles13.stderr | 120 +++++----- .../tests/roles/should_compile/Roles14.stderr | 18 +- testsuite/tests/roles/should_compile/Roles2.stderr | 40 ++-- testsuite/tests/roles/should_compile/Roles3.stderr | 64 +++--- testsuite/tests/roles/should_compile/Roles4.stderr | 38 ++-- testsuite/tests/roles/should_compile/T8958.stderr | 80 ++++--- .../tests/simplCore/should_compile/T7360.stderr | 96 ++++---- .../tests/simplCore/should_compile/T8274.stdout | 28 +-- testsuite/tests/th/TH_Roles2.stderr | 10 +- testsuite/tests/typecheck/should_compile/all.T | 2 +- testsuite/tests/typecheck/should_compile/tc167.hs | 6 +- .../tests/typecheck/should_compile/tc167.stderr | 6 - .../typecheck/should_fail/FrozenErrorTests.stderr | 5 +- .../tests/typecheck/should_run/Typeable1.stderr | 2 +- 22 files changed, 680 insertions(+), 482 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 42f3cb50d0b561c11c21ee52854781583c3a7fa9 From git at git.haskell.org Mon Feb 13 15:16:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Feb 2017 15:16:57 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: More notes (25fcb3d) Message-ID: <20170213151657.720AF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/25fcb3d591c2b3f843e941a5c885525542e89e8b/ghc >--------------------------------------------------------------- commit 25fcb3d591c2b3f843e941a5c885525542e89e8b Author: Ben Gamari Date: Sun Feb 12 19:33:10 2017 -0500 More notes >--------------------------------------------------------------- 25fcb3d591c2b3f843e941a5c885525542e89e8b compiler/typecheck/TcTypeable.hs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/compiler/typecheck/TcTypeable.hs b/compiler/typecheck/TcTypeable.hs index 4605c39..e7fe588 100644 --- a/compiler/typecheck/TcTypeable.hs +++ b/compiler/typecheck/TcTypeable.hs @@ -111,6 +111,25 @@ There are many wrinkles: representations for TyCon and Module. See GHC.Types Note [Runtime representation of modules and tycons] +* The KindReps can unfortunately get quite large. Moreover, the simplifier will + float out various pieces of them, resulting in numerous top-level bindings. + Consequently we mark the KindRep bindings as noinline, ensuring that the + float-outs don't make it into the interface file. This is important since + there is generally little benefit to inlining KindReps and they would + otherwise strongly affect compiler performance. + +* Even KindReps aren't inlined this scheme still has more of an effect on + compilation time than I'd like. This is especially true in the case of + families of type constructors (e.g. tuples and unboxed sums). The problem is + particularly bad in the case of sums, since each arity-N tycon brings with it + N promoted datacons, each with a KindRep whose size also scales with N. + Consequently we currently simply don't allow sums to be Typeable. + + In general we might consider moving some or all of this generation logic back + to the solver since the performance hit we take in doing this at + type-definition time is non-trivial and Typeable isn't very widely used. This + is discussed in #13261. + -} -- | Generate the Typeable bindings for a module. This is the only From git at git.haskell.org Mon Feb 13 15:17:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Feb 2017 15:17:00 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Documentation (2e96c20) Message-ID: <20170213151700.28D473A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/2e96c2008eb2396738f46f0d25893d219101687b/ghc >--------------------------------------------------------------- commit 2e96c2008eb2396738f46f0d25893d219101687b Author: Ben Gamari Date: Sun Feb 12 20:22:33 2017 -0500 Documentation >--------------------------------------------------------------- 2e96c2008eb2396738f46f0d25893d219101687b libraries/base/Data/Type/Equality.hs | 2 ++ libraries/base/Type/Reflection.hs | 26 ++++++++++++++++++++++++++ libraries/base/changelog.md | 9 +++++++++ 3 files changed, 37 insertions(+) diff --git a/libraries/base/Data/Type/Equality.hs b/libraries/base/Data/Type/Equality.hs index 503a3f0..73f8407 100644 --- a/libraries/base/Data/Type/Equality.hs +++ b/libraries/base/Data/Type/Equality.hs @@ -140,6 +140,8 @@ deriving instance a ~ b => Bounded (a :~: b) -- | Kind heterogeneous propositional equality. Like '(:~:)', @a :~~: b@ is -- inhabited by a terminating value if and only if @a@ is the same type as @b at . +-- +-- @since 4.10.0.0 data (a :: k1) :~~: (b :: k2) where HRefl :: a :~~: a diff --git a/libraries/base/Type/Reflection.hs b/libraries/base/Type/Reflection.hs index 75352df..37efcba 100644 --- a/libraries/base/Type/Reflection.hs +++ b/libraries/base/Type/Reflection.hs @@ -2,6 +2,29 @@ {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE PatternSynonyms #-} +----------------------------------------------------------------------------- +-- | +-- Module : Type.Reflection +-- Copyright : (c) The University of Glasgow, CWI 2001--2017 +-- License : BSD-style (see the file libraries/base/LICENSE) +-- +-- Maintainer : libraries at haskell.org +-- Stability : experimental +-- Portability : non-portable (requires GADTs and compiler support) +-- +-- This provides a type-indexed type representation mechanism, similar to that +-- described by, +-- +-- * Simon Peyton-Jones, Stephanie Weirich, Richard Eisenberg, +-- Dimitrios Vytiniotis. "A reflection on types." /Proc. Philip Wadler's 60th +-- birthday Festschrift/, Edinburgh (April 2016). +-- +-- The interface provides 'TypeRep', a type representation which can +-- be safely decomposed and composed. See "Data.Dynamic" for an example of this. +-- +-- @since 4.10.0.0 +-- +----------------------------------------------------------------------------- module Type.Reflection ( -- * The Typeable class I.Typeable @@ -24,6 +47,9 @@ module Type.Reflection , I.typeRepKind -- ** Quantified + -- + -- "Data.Typeable" exports a variant of this interface (named differently + -- for backwards compatibility). , I.SomeTypeRep(..) , I.typeRepXTyCon , I.rnfSomeTypeRep diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index aa7302d..fd8f188 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -56,6 +56,15 @@ imported from `Control.Applicative`. It is likely to be added to the `Prelude` in the future. (#13191) + * A new module exposing GHC's new type-indexed type representation + mechanism, `Type.Reflection`, is now provided. + + * `Data.Dynamic` now exports the `Dyn` data constructor, enabled by the new + type-indexed type representation mechanism. + + * `Data.Type.Equality` now provides a kind heterogeneous type equality type, + `(:~~:)`. + ## 4.9.0.0 *May 2016* * Bundled with GHC 8.0 From git at git.haskell.org Mon Feb 13 15:17:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Feb 2017 15:17:02 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable's head updated: Documentation (2e96c20) Message-ID: <20170213151702.D226A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/ttypeable' now includes: 2f5cb3d Attempt to make lazy ST thread safe 9984024 Fix comment (old file names) in includes/ 31bb85f Fix comment (old file names) in rts/ 8d60d73 Fix comment (old file names) in compiler/ 4d31880 Fix comment (old filename '.lhs') in libraries/ 283acec Make split sections by default work again 18cdef3 Fix minusNatural exception to be Underflow 157a46f Update binary submodule to 0.8.4.1 2912231 Improve wrapTicks performance with lots of redundant source notes 68cbe52 Don't panic when printing match with RecUpd context bd818a7 Fix comment (old file names) in mk/ and utils/ 8212135 New internal dynamic flag: Very aggressive inlining 54b9b06 Expose cseExpr from CSE a2f39da Add liftA2 to Applicative class fbcef83 Use proper primitives in Utils.Binary 0abe736 Don't replace type family instances with the same LHS in GHCi (#7102) adb565a Don't return empty initial uncovered set for an unsat context 26f5e60 Fix comment (old file names '.hc' ) in libraries/ 563148c Fix broken link of GHC.RTS.Flags 795bc49 Fixes for OccurAnal bugs (#13221) a9754e3 testsuite: Update expected values for T13035 and T12234 b572aad Do Worker/Wrapper for NOINLINE things 2dff54b Typos in comments [skip ci] 4aae191 Typos in comments [skip ci] a28a552 Remove unnecessary use of -DGENERICS flag 2219c8c Derive <$ 17ae5e7 Typos in comments [skip ci] a0174d2 Do not inline bottoming things f77e99b Comments only b8f58d7 Another improvement to SetLevels 078beea Docs: Fix typo in glasgow_exts.rst 5ce39f6 Add Wredundant-constraints to list of flags excluded from -Wall d5e9b7f Use better map operations in CoreMonad e90f611 Clean up findPartiallyCompletedCycles 369c534 testsuite: Bump max_bytes_used for T4029 0aa3f8d testsuite: Bump bytes allocated for T5837 8c25be8 cpeApp: Make Int accumulator strict bc376d3 Update Core formalize for Levity -> RuntimeRep 062f112 Fix push_bang_into_newtype when the pattern match has no arguments 3e07126 Fix comment of `section "Exceptions"` db3a797 Fix comment (broken link to users_guide) in $(TOP)/ 015e97a Pass -v0 to ghc-pkg to reduce noise in build ouput 512f157 Update hoopl submodule b990f65 More typos in comments [skip ci] 8e9593f Improve the simple optimiser 421308e Improve -dsuppress-coercions 3eb737e Generalize CmmUnwind and pass unwind information through NCG 733e845 CmmLayoutStack: Add unwind information on stack fixups 3328ddb Cmm: Add support for undefined unwinding statements 5279b08 CmmLayoutStack: Correctly annotate Sp adjustments with unwinding information 34e3523 Fix stop_thread unwinding information 9f3c1e6 Add some commented-out tracing in SpecConstr 3cfef76 Kill inaccessible-branch complaints in record update a94b484 Back-pedal the fix for Trac #8155 7e4e6a7 Add dump flags for the renamed and typechecked hsSyn ASTs 41c7437 users-guide: Document defaults for remaining optimization flags 082936d Fix documentation for setByteArray# afaf6d5 Bump array submodule b9bebd8 Implement addCStub in template-haskell. e8f5efb Tweaks and typos in manual, note refs, comments a6a4d0e Bump array submodule d266aac Library docs: Document the order for sort and sortOn. b92ca83 Bump bytestring submodule c22cd7c testsuite: Add testcase for #13248 a5a6c52 Guard rewritableTyVarsOfType 258c719 TH-spliced class instances are pretty-printed incorrectly post-#3384 3211fa0 Spelling in comments [ci skip] 76244ec Change rewritableTyVarsOfType to anyRewritableTyVar 283a346 Prevent Template Haskell splices from throwing a spurious TypeInType error e79ef75 Relax test TH_addCStub2 so it succeeds on travis. 639e702 Refactor DeriveAnyClass's instance context inference 594123f IcmmMachOpFoldM: clarify panic message 7fac7cd Dwarf.Types: Use DW_CFA_same_value encoding when possible 17b1e0b Mark orphan instances and rules in --show-iface output a1980ec Improve the Occurrence Analyzer’s handling of one-shot functions 26eaa7e Fix #13214 by correctly setting up dep_orphs for signatures. 1a14d38 rts/Profiling: Kill a few globals and add consts 56c9bb3 rts/Profiling: Factor out report generation 07292e9 zonkCt tries to maintain the canonical form of a Ct. 64da671 Binary: Only allocate un-interned FastStrings 7938ef2 Avoid repeated list elem checks 4e2e9b7 Fix: Default FD buffer size is not a power of 2 (#13245) 805db96 Fix: hPutBuf issues unnecessary empty write syscalls for large writes (#13246) 6b4e46a bufWrite: Save extra syscall when data fills handle buffer completely. a50082c Apply SplitSections to all C compilations d3ea38e Binary: Correct endian issue when cross-compiling e46a2e1 Bump hoopl submodule to 3.10.2.2 31134d5 Generalize arrow bb5953f Fix #13264 5691e41 Type-indexed Typeable c5a8e9e Move Typeable Binary instances to binary package d31cdc4 Disable Typeable binding generation for unboxed tuples cbe7dac Mark KindReps as noinline a6599dc Plop kindreps in another binding ad6d51c Make unboxed sums not Typeable 42f3cb5 Fix tests 25fcb3d More notes 2e96c20 Documentation From git at git.haskell.org Mon Feb 13 16:51:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Feb 2017 16:51:08 +0000 (UTC) Subject: [commit: ghc] branch 'wip/rwbarton-O2' created Message-ID: <20170213165108.E39353A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/rwbarton-O2 Referencing: 203ecbd0adb3ad38132e51e72b77fc658a9c228f From git at git.haskell.org Mon Feb 13 16:51:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 13 Feb 2017 16:51:11 +0000 (UTC) Subject: [commit: ghc] wip/rwbarton-O2: Build stage1 compiler with -O2 (203ecbd) Message-ID: <20170213165111.AEEF03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rwbarton-O2 Link : http://ghc.haskell.org/trac/ghc/changeset/203ecbd0adb3ad38132e51e72b77fc658a9c228f/ghc >--------------------------------------------------------------- commit 203ecbd0adb3ad38132e51e72b77fc658a9c228f Author: Reid Barton Date: Sat Feb 11 16:48:19 2017 -0500 Build stage1 compiler with -O2 >--------------------------------------------------------------- 203ecbd0adb3ad38132e51e72b77fc658a9c228f mk/custom-settings.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/mk/custom-settings.mk b/mk/custom-settings.mk index 2b4b127..0546f1b 100644 --- a/mk/custom-settings.mk +++ b/mk/custom-settings.mk @@ -6,6 +6,7 @@ include mk/flavours/validate.mk -include mk/validate.mk else -include $(firstword $(wildcard mk/$(TargetPlatformFull)-build.mk) mk/build.mk) +GhcStage1HcOpts = -O2 endif ifeq "$(BINDIST)" "YES" From git at git.haskell.org Tue Feb 14 15:54:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Feb 2017 15:54:30 +0000 (UTC) Subject: [commit: ghc] master: Allow type defaulting for multi-param type classes with ExtendedDefaultRules (c3bbd1a) Message-ID: <20170214155430.2A5C13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c3bbd1afc85cd634d8d26e27bafb92cc7481667b/ghc >--------------------------------------------------------------- commit c3bbd1afc85cd634d8d26e27bafb92cc7481667b Author: vivid-synth Date: Tue Feb 14 09:51:54 2017 -0500 Allow type defaulting for multi-param type classes with ExtendedDefaultRules Expressions like the following will now typecheck: ``` data A x = A deriving Show class ToA a x where toA :: a -> A x instance ToA Integer x where toA _ = A main = print (toA 5 :: A Bool) ``` The new defaulting rules are Find all the unsolved constraints. Then: * Find those that have exactly one free type variable, and partition that subset into groups that share a common type variable `a`. * Now default `a` (to one of the types in the default list) if at least one of the classes `Ci` is an interactive class Reviewers: goldfire, bgamari, austin, mpickering, simonpj Reviewed By: bgamari, simonpj Subscribers: mpickering, simonpj, goldfire, thomie Differential Revision: https://phabricator.haskell.org/D2822 >--------------------------------------------------------------- c3bbd1afc85cd634d8d26e27bafb92cc7481667b compiler/typecheck/TcSimplify.hs | 29 +++++++++++++++++++++- docs/users_guide/8.2.1-notes.rst | 3 +++ docs/users_guide/ghci.rst | 20 +++++++++++---- testsuite/tests/typecheck/should_compile/T12923.hs | 19 ++++++++++++++ testsuite/tests/typecheck/should_compile/T12924.hs | 26 +++++++++++++++++++ testsuite/tests/typecheck/should_compile/T12926.hs | 23 +++++++++++++++++ testsuite/tests/typecheck/should_compile/all.T | 3 +++ 7 files changed, 117 insertions(+), 6 deletions(-) diff --git a/compiler/typecheck/TcSimplify.hs b/compiler/typecheck/TcSimplify.hs index 61f2c12..ee07e84 100644 --- a/compiler/typecheck/TcSimplify.hs +++ b/compiler/typecheck/TcSimplify.hs @@ -2019,6 +2019,7 @@ findDefaultableGroups (default_tys, (ovl_strings, extended_defaults)) wanteds -- Finds unary type-class constraints -- But take account of polykinded classes like Typeable, -- which may look like (Typeable * (a:*)) (Trac #8931) + find_unary :: Ct -> Either (Ct, Class, TyVar) Ct find_unary cc | Just (cls,tys) <- getClassPredTys_maybe (ctPred cc) , [ty] <- filterOutInvisibleTypes (classTyCon cls) tys @@ -2034,11 +2035,13 @@ findDefaultableGroups (default_tys, (ovl_strings, extended_defaults)) wanteds cmp_tv (_,_,tv1) (_,_,tv2) = tv1 `compare` tv2 + defaultable_tyvar :: TcTyVar -> Bool defaultable_tyvar tv = let b1 = isTyConableTyVar tv -- Note [Avoiding spurious errors] b2 = not (tv `elemVarSet` bad_tvs) - in b1 && b2 + in b1 && (b2 || extended_defaults) -- Note [Multi-parameter defaults] + defaultable_classes :: [Class] -> Bool defaultable_classes clss | extended_defaults = any (isInteractiveClass ovl_strings) clss | otherwise = all is_std_class clss && (any (isNumClass ovl_strings) clss) @@ -2125,4 +2128,28 @@ that g isn't polymorphic enough; but then we get another one when dealing with the (Num a) context arising from f's definition; we try to unify a with Int (to default it), but find that it's already been unified with the rigid variable from g's type sig. + +Note [Multi-parameter defaults] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +With -XExtendedDefaultRules, we default only based on single-variable +constraints, but do not exclude from defaulting any type variables which also +appear in multi-variable constraints. This means that the following will +default properly: + + default (Integer, Double) + + class A b (c :: Symbol) where + a :: b -> Proxy c + + instance A Integer c where a _ = Proxy + + main = print (a 5 :: Proxy "5") + +Note that if we change the above instance ("instance A Integer") to +"instance A Double", we get an error: + + No instance for (A Integer "5") + +This is because the first defaulted type (Integer) has successfully satisfied +its single-parameter constraints (in this case Num). -} diff --git a/docs/users_guide/8.2.1-notes.rst b/docs/users_guide/8.2.1-notes.rst index 00e6c7c..d70dc50 100644 --- a/docs/users_guide/8.2.1-notes.rst +++ b/docs/users_guide/8.2.1-notes.rst @@ -154,6 +154,9 @@ Compiler allocation and a potential space leak when deriving ``Functor`` for a recursive type. +- The :ghc-flag:`-XExtendedDefaultRules` extension now defaults multi-parameter + typeclasses. See :ghc-ticket:`12923`. + GHCi ~~~~ diff --git a/docs/users_guide/ghci.rst b/docs/users_guide/ghci.rst index fa00b80..04864cd 100644 --- a/docs/users_guide/ghci.rst +++ b/docs/users_guide/ghci.rst @@ -1040,17 +1040,27 @@ and defaults the type variable if 3. At least one of the classes ``Ci`` is numeric. At the GHCi prompt, or with GHC if the :ghc-flag:`-XExtendedDefaultRules` flag -is given, the following additional differences apply: +is given, the types are instead resolved with the following method: -- Rule 2 above is relaxed thus: *All* of the classes ``Ci`` are - single-parameter type classes. +Find all the unsolved constraints. Then: -- Rule 3 above is relaxed thus: At least one of the classes ``Ci`` is - an *interactive class* (defined below). +- Find those that are of form ``(C a)`` where ``a`` is a type variable, and + partition those constraints into groups that share a common type variable ``a``. + +- Keep only the groups in which at least one of the classes is an + **interactive class** (defined below). + +- Now, for each remaining group G, try each type ``ty`` from the default-type list + in turn; if setting ``a = ty`` would allow the constraints in G to be completely + solved. If so, default ``a`` to ``ty``. - The unit type ``()`` and the list type ``[]`` are added to the start of the standard list of types which are tried when doing type defaulting. +Note that any multi-parameter constraints ``(D a b)`` or ``(D [a] Int)`` do not +participate in the process (either to help or to hinder); but they must of course +be soluble once the defaulting process is complete. + The last point means that, for example, this program: :: main :: IO () diff --git a/testsuite/tests/typecheck/should_compile/T12923.hs b/testsuite/tests/typecheck/should_compile/T12923.hs new file mode 100644 index 0000000..bd3f55d --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T12923.hs @@ -0,0 +1,19 @@ +{-# LANGUAGE ExtendedDefaultRules #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE KindSignatures #-} +{-# LANGUAGE DataKinds #-} + +module T12923 where + +-- Test that ExtendedDefaultRules defaults multiparameter typeclasses with only +-- one parameter of kind Type. +class Works a (b :: Bool) where + works :: a -> A b + +data A (b :: Bool) = A deriving Show + +instance Works Integer 'True where works _ = A + +main :: IO () +main = print (works 5 :: A 'True) diff --git a/testsuite/tests/typecheck/should_compile/T12924.hs b/testsuite/tests/typecheck/should_compile/T12924.hs new file mode 100644 index 0000000..573abc4 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T12924.hs @@ -0,0 +1,26 @@ +{-# LANGUAGE ExtendedDefaultRules #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE KindSignatures #-} + +module T12924 where + +import GHC.TypeLits + +data A (b :: [Symbol]) = A deriving Show + +-- Test that ExtendedDefaultRules defaults multiparameter typeclasses with only +-- one parameter of kind Type. +class Works a (b :: [Symbol]) where + works :: a -> A b + +instance Works Integer a where + works _ = A + +main :: IO () +main = print (addA (works 5) (works 10)) -- :: A '[]) + +-- | Note argument types aren't concrete +addA :: A a -> A a -> A '[] +addA A A = A diff --git a/testsuite/tests/typecheck/should_compile/T12926.hs b/testsuite/tests/typecheck/should_compile/T12926.hs new file mode 100644 index 0000000..8f9f5df --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T12926.hs @@ -0,0 +1,23 @@ +{-# LANGUAGE ExtendedDefaultRules #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE KindSignatures #-} + +module T12926 where + +import GHC.TypeLits + +data A (b :: [Symbol]) = A deriving Show + +class Works a (b :: [Symbol]) where + works :: a -> A b + +instance Works Integer a where + works _ = A + +addA :: A a -> A a -> A a +addA A A = A + +test2 :: A x -- Note this is able to have a polymorphic type +test2 = addA (works 5) (works 5) diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index 286ebbb..c44ab91 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -539,3 +539,6 @@ test('T13248', expect_broken(13248), compile, ['']) test('T11525', [unless(have_dynamic(), expect_broken(10301))], multi_compile, ['', [('T11525_Plugin.hs', '-package ghc'), ('T11525.hs', '')], '-dynamic']) +test('T12923', normal, compile, ['']) +test('T12924', normal, compile, ['']) +test('T12926', normal, compile, ['']) From git at git.haskell.org Tue Feb 14 15:54:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Feb 2017 15:54:32 +0000 (UTC) Subject: [commit: ghc] master: Fix ExtraSymbols jump table on Windows. (2f1017b) Message-ID: <20170214155432.D5CE93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2f1017b924740e66f093b0baba62ac0b1528abf8/ghc >--------------------------------------------------------------- commit 2f1017b924740e66f093b0baba62ac0b1528abf8 Author: Tamar Christina Date: Tue Feb 14 09:44:53 2017 -0500 Fix ExtraSymbols jump table on Windows. This corrects the `jump islands` calculations for Windows. The code was incorrectly creating a new entry for every `usage` of a symbol instead of every used symbol. e.g. if a symbol is used 5 times it used to create 5 jump islands. This is incorrect and not in line with what the `ELF` and `Mach-O` linkers do. Also since we allocate `n` spaces where `n` is number of symbols, we would quickly run out of space and abort. Test Plan: ./validate Reviewers: simonmar, hvr, erikd, bgamari, austin Reviewed By: bgamari Subscribers: thomie, #ghc_windows_task_force Differential Revision: https://phabricator.haskell.org/D3026 >--------------------------------------------------------------- 2f1017b924740e66f093b0baba62ac0b1528abf8 rts/linker/PEi386.c | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/rts/linker/PEi386.c b/rts/linker/PEi386.c index bfac34f..b62f1eb 100644 --- a/rts/linker/PEi386.c +++ b/rts/linker/PEi386.c @@ -73,6 +73,7 @@ static uint8_t* cstring_from_COFF_symbol_name( #if defined(x86_64_HOST_ARCH) static size_t makeSymbolExtra_PEi386( ObjectCode* oc, + uint64_t index, size_t s, SymbolName* symbol); #endif @@ -346,7 +347,7 @@ bool removeLibrarySearchPath_PEi386(HsPtr dll_path_index) } } - return result == 0; + return !result; } @@ -869,8 +870,7 @@ ocVerifyImage_PEi386 ( ObjectCode* oc ) rel->VirtualAddress ); sym = (COFF_symbol*) myindex ( sizeof_COFF_symbol, symtab, rel->SymbolTableIndex ); - /* Hmm..mysterious looking offset - what's it for? SOF */ - printName ( sym->N.ShortName, strtab -10 ); + printName ( sym->N.ShortName, strtab ); debugBelch("'\n" ); } @@ -1185,24 +1185,25 @@ ocAllocateSymbolExtras_PEi386 ( ObjectCode* oc ) } static size_t -makeSymbolExtra_PEi386( ObjectCode* oc, size_t s, char* symbol ) +makeSymbolExtra_PEi386( ObjectCode* oc, uint64_t index, size_t s, char* symbol ) { unsigned int curr_thunk; SymbolExtra *extra; - - curr_thunk = oc->first_symbol_extra; - if (curr_thunk >= oc->n_symbol_extras) { - barf("Can't allocate thunk for %s", symbol); + curr_thunk = oc->first_symbol_extra + index; + if (index >= oc->n_symbol_extras) { + IF_DEBUG(linker, debugBelch("makeSymbolExtra first:%d, num:%lu, member:%s, index:%llu\n", curr_thunk, oc->n_symbol_extras, oc->archiveMemberName, index)); + barf("Can't allocate thunk for `%s' in `%" PATH_FMT "' with member `%s'", symbol, oc->fileName, oc->archiveMemberName); } extra = oc->symbol_extras + curr_thunk; - // jmp *-14(%rip) - static uint8_t jmp[] = { 0xFF, 0x25, 0xF2, 0xFF, 0xFF, 0xFF }; - extra->addr = (uint64_t)s; - memcpy(extra->jumpIsland, jmp, 6); - - oc->first_symbol_extra++; + if (!extra->addr) + { + // jmp *-14(%rip) + static uint8_t jmp[] = { 0xFF, 0x25, 0xF2, 0xFF, 0xFF, 0xFF }; + extra->addr = (uint64_t)s; + memcpy(extra->jumpIsland, jmp, 6); + } return (size_t)extra->jumpIsland; } @@ -1313,6 +1314,10 @@ ocResolve_PEi386 ( ObjectCode* oc ) sym = (COFF_symbol*) myindex ( sizeof_COFF_symbol, symtab, reltab_j->SymbolTableIndex ); + uint64_t symIndex = ((uint64_t)myindex(sizeof_COFF_symbol, symtab, + reltab_j->SymbolTableIndex) + - (uint64_t)symtab) / sizeof_COFF_symbol; + IF_DEBUG(linker, debugBelch( "reloc sec %2d num %3d: type 0x%-4x " @@ -1389,7 +1394,7 @@ ocResolve_PEi386 ( ObjectCode* oc ) v = S + ((size_t)A); if (v >> 32) { copyName ( sym->N.ShortName, strtab, symbol, 1000-1 ); - S = makeSymbolExtra_PEi386(oc, S, (char *)symbol); + S = makeSymbolExtra_PEi386(oc, symIndex, S, (char *)symbol); /* And retry */ v = S + ((size_t)A); if (v >> 32) { @@ -1407,7 +1412,7 @@ ocResolve_PEi386 ( ObjectCode* oc ) if ((v >> 32) && ((-v) >> 32)) { /* Make the trampoline then */ copyName ( sym->N.ShortName, strtab, symbol, 1000-1 ); - S = makeSymbolExtra_PEi386(oc, S, (char *)symbol); + S = makeSymbolExtra_PEi386(oc, symIndex, S, (char *)symbol); /* And retry */ v = ((intptr_t)S) + ((intptr_t)(int32_t)A) - ((intptr_t)pP) - 4; if ((v >> 32) && ((-v) >> 32)) { From git at git.haskell.org Tue Feb 14 15:54:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Feb 2017 15:54:35 +0000 (UTC) Subject: [commit: ghc] master: Debug: Use local symbols for unwind points (#13278) (2d6e91e) Message-ID: <20170214155435.879DC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2d6e91eab9391210b8b816d9664407f246ef30e4/ghc >--------------------------------------------------------------- commit 2d6e91eab9391210b8b816d9664407f246ef30e4 Author: Ben Gamari Date: Tue Feb 14 08:43:40 2017 -0500 Debug: Use local symbols for unwind points (#13278) While this apparently didn't matter on Linux, the OS X toolchain seems to treat local and external symbols differently during linking. Namely, the linker assumes that an external symbol marks the beginning of a new, unused procedure, and consequently drops it. Fixes regression introduced in D2741. Test Plan: `debug` testcase on OS X Reviewers: austin, simonmar, rwbarton Reviewed By: rwbarton Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3135 >--------------------------------------------------------------- 2d6e91eab9391210b8b816d9664407f246ef30e4 compiler/cmm/Debug.hs | 2 +- compiler/nativeGen/X86/CodeGen.hs | 5 +++-- compiler/nativeGen/X86/Instr.hs | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/compiler/cmm/Debug.hs b/compiler/cmm/Debug.hs index 7902694..428721a 100644 --- a/compiler/cmm/Debug.hs +++ b/compiler/cmm/Debug.hs @@ -393,7 +393,7 @@ See also: Note [Unwinding information in the NCG] in AsmCodeGen. -} -- | A label associated with an 'UnwindTable' -data UnwindPoint = UnwindPoint !Label !UnwindTable +data UnwindPoint = UnwindPoint !CLabel !UnwindTable instance Outputable UnwindPoint where ppr (UnwindPoint lbl uws) = diff --git a/compiler/nativeGen/X86/CodeGen.hs b/compiler/nativeGen/X86/CodeGen.hs index a0a8f9d..72f8290 100644 --- a/compiler/nativeGen/X86/CodeGen.hs +++ b/compiler/nativeGen/X86/CodeGen.hs @@ -68,6 +68,7 @@ import Unique import FastString import DynFlags import Util +import UniqSupply ( getUniqueM ) import Control.Monad import Data.Bits @@ -162,7 +163,7 @@ addSpUnwindings :: Instr -> NatM (OrdList Instr) addSpUnwindings instr@(DELTA d) = do dflags <- getDynFlags if debugLevel dflags >= 1 - then do lbl <- newBlockId + then do lbl <- mkAsmTempLabel <$> getUniqueM let unwind = M.singleton MachSp (Just $ UwReg MachSp $ negate d) return $ toOL [ instr, UNWIND lbl unwind ] else return (unitOL instr) @@ -188,7 +189,7 @@ stmtToInstrs stmt = do case foldMap to_unwind_entry regs of tbl | M.null tbl -> return nilOL | otherwise -> do - lbl <- newBlockId + lbl <- mkAsmTempLabel <$> getUniqueM return $ unitOL $ UNWIND lbl tbl CmmAssign reg src diff --git a/compiler/nativeGen/X86/Instr.hs b/compiler/nativeGen/X86/Instr.hs index 4b43a1c..f4ac55c 100644 --- a/compiler/nativeGen/X86/Instr.hs +++ b/compiler/nativeGen/X86/Instr.hs @@ -182,7 +182,7 @@ data Instr -- unwinding information -- See Note [Unwinding information in the NCG]. - | UNWIND BlockId UnwindTable + | UNWIND CLabel UnwindTable -- specify current stack offset for benefit of subsequent passes. -- This carries a BlockId so it can be used in unwinding information. From git at git.haskell.org Tue Feb 14 15:54:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Feb 2017 15:54:38 +0000 (UTC) Subject: [commit: ghc] master: Expand list of always loaded Windows shared libs (04f67c9) Message-ID: <20170214155438.3FA3D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/04f67c9970c0e2599e0b2a29353b1acec72dacf0/ghc >--------------------------------------------------------------- commit 04f67c9970c0e2599e0b2a29353b1acec72dacf0 Author: Tamar Christina Date: Tue Feb 14 09:43:02 2017 -0500 Expand list of always loaded Windows shared libs When the `GCC` driver envokes the pipeline a `SPEC` is used to determine how to configure the compiler and which libraries to pass along. For Windows/mingw, this specfile is https://github.com/gcc-mirror/gcc/blob/master/gcc/config/i386/mingw32.h This expands the list of base DLLs with the ones that GCC always links, and adds extra sibling dlls of `stdc++` in case it is linked in. Following D3028 this patch only needs to load the always load only the top level individual shared libs. Test Plan: ./validate Reviewers: RyanGlScott, austin, bgamari, erikd, simonmar Reviewed By: bgamari Subscribers: RyanGlScott, thomie, #ghc_windows_task_force Differential Revision: https://phabricator.haskell.org/D3029 >--------------------------------------------------------------- 04f67c9970c0e2599e0b2a29353b1acec72dacf0 docs/users_guide/8.2.1-notes.rst | 3 +++ rts/linker/PEi386.c | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/docs/users_guide/8.2.1-notes.rst b/docs/users_guide/8.2.1-notes.rst index 45ed589..00e6c7c 100644 --- a/docs/users_guide/8.2.1-notes.rst +++ b/docs/users_guide/8.2.1-notes.rst @@ -263,6 +263,9 @@ Runtime system Enabling external tools to collect and analyze the event log data while the application is still running. +- advapi32, shell32 and user32 are now automatically loaded in GHCi. libGCC is also + loaded when a depencency requires it. See :ghc-ticket:`13189`. + Build system ~~~~~~~~~~~~ diff --git a/rts/linker/PEi386.c b/rts/linker/PEi386.c index f29bb8b..bfac34f 100644 --- a/rts/linker/PEi386.c +++ b/rts/linker/PEi386.c @@ -107,9 +107,15 @@ void initLinker_PEi386() * These two libraries cause problems when added to the static link, * but are necessary for resolving symbols in GHCi, hence we load * them manually here. + * + * Most of these are included by base, but GCC always includes them + * So lets make sure we always have them too. */ addDLL(WSTR("msvcrt")); addDLL(WSTR("kernel32")); + addDLL(WSTR("advapi32")); + addDLL(WSTR("shell32")); + addDLL(WSTR("user32")); addDLLHandle(WSTR("*.exe"), GetModuleHandle(NULL)); #endif } From git at git.haskell.org Tue Feb 14 15:54:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Feb 2017 15:54:40 +0000 (UTC) Subject: [commit: ghc] master: Typecast covers entire expression to fix format warning. (60c4986) Message-ID: <20170214155440.EC47B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/60c49861465015659a25542692b6d259667759e5/ghc >--------------------------------------------------------------- commit 60c49861465015659a25542692b6d259667759e5 Author: bollu Date: Tue Feb 14 08:43:58 2017 -0500 Typecast covers entire expression to fix format warning. - Fixes (#12636). - changes all the typecasts to _unsinged long long_ to have the format specifiers work. Reviewers: austin, bgamari, erikd, simonmar, Phyx Reviewed By: erikd, Phyx Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3129 >--------------------------------------------------------------- 60c49861465015659a25542692b6d259667759e5 rts/ProfHeap.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/rts/ProfHeap.c b/rts/ProfHeap.c index d492b89..608b976 100644 --- a/rts/ProfHeap.c +++ b/rts/ProfHeap.c @@ -770,17 +770,22 @@ dumpCensus( Census *census ) traceHeapProfSampleBegin(era); #ifdef PROFILING + /* change typecast to uint64_t to remove + * print formatting warning. See #12636 */ if (RtsFlags.ProfFlags.doHeapProfile == HEAP_BY_LDV) { - fprintf(hp_file, "VOID\t%lu\n", - (unsigned long)(census->void_total) * sizeof(W_)); - fprintf(hp_file, "LAG\t%lu\n", - (unsigned long)(census->not_used - census->void_total) * sizeof(W_)); - fprintf(hp_file, "USE\t%lu\n", - (unsigned long)(census->used - census->drag_total) * sizeof(W_)); - fprintf(hp_file, "INHERENT_USE\t%lu\n", - (unsigned long)(census->prim) * sizeof(W_)); - fprintf(hp_file, "DRAG\t%lu\n", - (unsigned long)(census->drag_total) * sizeof(W_)); + fprintf(hp_file, "VOID\t%" FMT_Word64 "\n", + (uint64_t)(census->void_total * + sizeof(W_))); + fprintf(hp_file, "LAG\t%" FMT_Word64 "\n", + (uint64_t)((census->not_used - census->void_total) * + sizeof(W_))); + fprintf(hp_file, "USE\t%" FMT_Word64 "\n", + (uint64_t)((census->used - census->drag_total) * + sizeof(W_))); + fprintf(hp_file, "INHERENT_USE\t%" FMT_Word64 "\n", + (uint64_t)(census->prim * sizeof(W_))); + fprintf(hp_file, "DRAG\t%" FMT_Word64 "\n", + (uint64_t)(census->drag_total * sizeof(W_))); printSample(false, census->time); return; } From git at git.haskell.org Tue Feb 14 15:54:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Feb 2017 15:54:49 +0000 (UTC) Subject: [commit: ghc] master: TcUnify: Assert precondition of matchExpectedTyConApp (6626242) Message-ID: <20170214155449.F3FA13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6626242ba334d81ecf5fe6dd4ef964f74656e541/ghc >--------------------------------------------------------------- commit 6626242ba334d81ecf5fe6dd4ef964f74656e541 Author: Ben Gamari Date: Tue Feb 14 09:31:08 2017 -0500 TcUnify: Assert precondition of matchExpectedTyConApp Test Plan: Validate Reviewers: simonpj, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3128 >--------------------------------------------------------------- 6626242ba334d81ecf5fe6dd4ef964f74656e541 compiler/typecheck/TcUnify.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/typecheck/TcUnify.hs b/compiler/typecheck/TcUnify.hs index b7c4aee..db3233e 100644 --- a/compiler/typecheck/TcUnify.hs +++ b/compiler/typecheck/TcUnify.hs @@ -367,7 +367,7 @@ matchExpectedTyConApp :: TyCon -- T :: forall kv1 ... kvm. k1 -> -- Postcondition: (T k1 k2 k3 a b c) is well-kinded matchExpectedTyConApp tc orig_ty - = go orig_ty + = ASSERT(tc /= funTyCon) go orig_ty where go ty | Just ty' <- coreView ty From git at git.haskell.org Tue Feb 14 15:54:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Feb 2017 15:54:43 +0000 (UTC) Subject: [commit: ghc] master: Implement HasField constraint solving and modify OverloadedLabels (da49389) Message-ID: <20170214155443.CD4EA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/da493897ac6ee2b17a0c58b51315f9d136de730d/ghc >--------------------------------------------------------------- commit da493897ac6ee2b17a0c58b51315f9d136de730d Author: Adam Gundry Date: Tue Feb 14 09:53:28 2017 -0500 Implement HasField constraint solving and modify OverloadedLabels This implements automatic constraint solving for the new HasField class and modifies the existing OverloadedLabels extension, as described in the GHC proposal (https://github.com/ghc-proposals/ghc-proposals/pull/6). Per the current form of the proposal, it does *not* currently introduce a separate `OverloadedRecordFields` extension. This replaces D1687. The users guide documentation still needs to be written, but I'll do that after the implementation is merged, in case there are further design changes. Test Plan: new and modified tests in overloadedrecflds Reviewers: simonpj, goldfire, dfeuer, bgamari, austin, hvr Reviewed By: bgamari Subscribers: maninalift, dfeuer, ysangkok, thomie, mpickering Differential Revision: https://phabricator.haskell.org/D2708 >--------------------------------------------------------------- da493897ac6ee2b17a0c58b51315f9d136de730d compiler/basicTypes/DataCon.hs | 14 ++- compiler/basicTypes/RdrName.hs | 32 ++++-- compiler/deSugar/Coverage.hs | 2 +- compiler/deSugar/DsBinds.hs | 4 + compiler/deSugar/DsExpr.hs | 2 +- compiler/deSugar/DsMeta.hs | 2 +- compiler/deSugar/Match.hs | 2 +- compiler/hsSyn/HsExpr.hs | 10 +- compiler/parser/Parser.y | 2 +- compiler/prelude/PrelNames.hs | 16 +++ compiler/rename/RnExpr.hs | 8 +- compiler/rename/RnPat.hs | 23 ++-- compiler/typecheck/TcEvidence.hs | 7 ++ compiler/typecheck/TcExpr.hs | 58 ++++++---- compiler/typecheck/TcHsSyn.hs | 8 +- compiler/typecheck/TcInteract.hs | 127 ++++++++++++++++++++- compiler/typecheck/TcRnTypes.hs | 2 +- compiler/typecheck/TcSMonad.hs | 21 +++- compiler/typecheck/TcValidity.hs | 44 +++++++ compiler/types/TyCon.hs | 5 +- compiler/utils/FastStringEnv.hs | 5 +- libraries/base/GHC/OverloadedLabels.hs | 38 +++--- libraries/base/GHC/Records.hs | 34 ++++++ libraries/base/base.cabal | 1 + testsuite/driver/extra_files.py | 1 + testsuite/tests/overloadedrecflds/ghci/all.T | 2 +- ...ghci01.script => duplicaterecfldsghci01.script} | 0 ...ghci01.stdout => duplicaterecfldsghci01.stdout} | 0 .../ghci/overloadedlabelsghci01.script | 7 +- .../should_fail/HasFieldFail01_A.hs | 3 + .../tests/overloadedrecflds/should_fail/all.T | 7 ++ .../should_fail/hasfieldfail01.hs | 9 ++ .../should_fail/hasfieldfail01.stderr | 11 ++ .../should_fail/hasfieldfail02.hs | 16 +++ .../should_fail/hasfieldfail02.stderr | 13 +++ .../should_fail/hasfieldfail03.hs | 39 +++++++ .../should_fail/hasfieldfail03.stderr | 21 ++++ .../should_fail/overloadedlabelsfail01.hs | 5 +- .../should_fail/overloadedlabelsfail01.stderr | 21 +--- .../should_fail/overloadedlabelsfail02.hs | 3 + .../should_fail/overloadedlabelsfail02.stderr | 2 + .../should_fail/overloadedlabelsfail03.hs | 5 + .../should_fail/overloadedlabelsfail03.stderr | 10 ++ .../should_run/OverloadedLabelsRun04_A.hs | 2 +- .../tests/overloadedrecflds/should_run/T12243.hs | 25 ++++ .../overloadedrecflds/should_run/T12243.stdout | 2 + testsuite/tests/overloadedrecflds/should_run/all.T | 4 + .../overloadedrecflds/should_run/hasfieldrun01.hs | 51 +++++++++ .../should_run/hasfieldrun01.stdout | 8 ++ .../overloadedrecflds/should_run/hasfieldrun02.hs | 16 +++ ...dedrecfldsrun06.stdout => hasfieldrun02.stdout} | 0 .../should_run/overloadedlabelsrun01.hs | 4 +- .../should_run/overloadedlabelsrun02.hs | 4 +- .../should_run/overloadedlabelsrun03.hs | 2 +- .../should_run/overloadedrecfldsrun07.hs | 45 ++++++++ .../should_run/overloadedrecfldsrun07.stdout | 3 + 56 files changed, 699 insertions(+), 109 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 da493897ac6ee2b17a0c58b51315f9d136de730d From git at git.haskell.org Tue Feb 14 15:54:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Feb 2017 15:54:47 +0000 (UTC) Subject: [commit: ghc] master: Refactor renaming of operators/sections to fix DuplicateRecordFields bugs (2484d4d) Message-ID: <20170214155447.4C29F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2484d4dae65c81f218dcfe494b963b2630bb8fa6/ghc >--------------------------------------------------------------- commit 2484d4dae65c81f218dcfe494b963b2630bb8fa6 Author: Adam Gundry Date: Tue Feb 14 09:35:06 2017 -0500 Refactor renaming of operators/sections to fix DuplicateRecordFields bugs A variety of panics were possible because the get_op function in RnTypes didn't handle the possibility that its argument might be an ambiguous record field. I've made its return type more informative to correctly handle occurrences of record fields. Fixes Trac #13132. Test Plan: new test overloadedrecflds/should_fail/T13132_duplicaterecflds Reviewers: bgamari, simonpj, austin Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3126 >--------------------------------------------------------------- 2484d4dae65c81f218dcfe494b963b2630bb8fa6 compiler/rename/RnTypes.hs | 74 +++++++++++++++------- .../should_fail/T13132_duplicaterecflds.hs | 9 +++ .../should_fail/T13132_duplicaterecflds.stderr | 6 ++ .../tests/overloadedrecflds/should_fail/all.T | 1 + 4 files changed, 68 insertions(+), 22 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 2484d4dae65c81f218dcfe494b963b2630bb8fa6 From git at git.haskell.org Tue Feb 14 16:16:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Feb 2017 16:16:25 +0000 (UTC) Subject: [commit: ghc] master: Update .mailmap [skip ci] (392cec4) Message-ID: <20170214161625.845E63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/392cec4da9a7ce2b5c89ac688a5b9844a543c909/ghc >--------------------------------------------------------------- commit 392cec4da9a7ce2b5c89ac688a5b9844a543c909 Author: Matthew Pickering Date: Tue Feb 14 16:15:55 2017 +0000 Update .mailmap [skip ci] >--------------------------------------------------------------- 392cec4da9a7ce2b5c89ac688a5b9844a543c909 .mailmap | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.mailmap b/.mailmap index 5cfc6c4..c4a93de 100644 --- a/.mailmap +++ b/.mailmap @@ -224,6 +224,7 @@ Sergei Trofimovich Sergei Trofimovich Shae Matijs Erisson shae at ScannedInAvian.com +Siddharth Bhat Sigbjorn Finne sof Sigbjorn Finne sof at galois.com Simon Hengel @@ -267,6 +268,7 @@ Tim Harris tharris Tim Harris tharris at microsoft.com Tobias Gedell tgedell Tom Schrijvers tom.schrijvers at cs.kuleuven.be +Tom Murphy Umut Acar umuta # POPL 2002 paper Adaptive Functional Programming Vitaly Bragilevsky Volker Stolz From git at git.haskell.org Tue Feb 14 16:39:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Feb 2017 16:39:28 +0000 (UTC) Subject: [commit: ghc] branch 'wip/rwbarton-split-sections' created Message-ID: <20170214163928.789783A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/rwbarton-split-sections Referencing: ac85c29f8e41ea8ec2a6bdd15736902f700715f6 From git at git.haskell.org Tue Feb 14 16:39:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Feb 2017 16:39:31 +0000 (UTC) Subject: [commit: ghc] wip/rwbarton-split-sections: Set $1_$2_SplitSections in distdir-opts.mk not build-package.mk (ac85c29) Message-ID: <20170214163931.305133A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rwbarton-split-sections Link : http://ghc.haskell.org/trac/ghc/changeset/ac85c29f8e41ea8ec2a6bdd15736902f700715f6/ghc >--------------------------------------------------------------- commit ac85c29f8e41ea8ec2a6bdd15736902f700715f6 Author: Reid Barton Date: Tue Feb 14 11:30:08 2017 -0500 Set $1_$2_SplitSections in distdir-opts.mk not build-package.mk After commit a50082c11 we use -ffunction-sections -fdata-sections for all C compilations, when $1_$2_SplitSections is set. But that variable was set in build-package.mk which is not run for the RTS. As a result the RTS was not being split, leading to larger binaries. This commit fixes RTS splitting by moving the definition of $1_$2_SplitSections to distdir-opts.mk, which is run for the RTS (and also from build-package.mk). >--------------------------------------------------------------- ac85c29f8e41ea8ec2a6bdd15736902f700715f6 rules/build-package.mk | 18 ------------------ rules/distdir-opts.mk | 20 +++++++++++++++++++- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/rules/build-package.mk b/rules/build-package.mk index 9599c57..fb04f02 100644 --- a/rules/build-package.mk +++ b/rules/build-package.mk @@ -102,24 +102,6 @@ endif $1_$2_PKGDATA_DEP = $1/$2/package-data.mk endif -# We don't bother splitting the bootstrap packages (built with stage 0) -ifeq "$$($1_$2_SplitObjs)" "" -ifeq "$$(SplitObjs) $3" "YES 1" -$1_$2_SplitObjs = YES -else -$1_$2_SplitObjs = NO -endif -endif -# Disable split sections when building with stage0, it won't be supported yet -# and it's probably not very relevant anyway (smaller stage1 ghc?). -ifeq "$$($1_$2_SplitSections)" "" -ifeq "$3" "1" -$1_$2_SplitSections = $(SplitSections) -else -$1_$2_SplitSections = NO -endif -endif - $(call hs-sources,$1,$2) $(call c-sources,$1,$2) $(call includes-sources,$1,$2) diff --git a/rules/distdir-opts.mk b/rules/distdir-opts.mk index b3dfba1..6cabac3 100644 --- a/rules/distdir-opts.mk +++ b/rules/distdir-opts.mk @@ -11,7 +11,7 @@ # ----------------------------------------------------------------------------- -# Set compilation flags that additionally depend on a particular way +# Set compilation flags that do not depend on a particular way define distdir-opts # args: $1 = dir, $2 = distdir, $3 = stage @@ -89,5 +89,23 @@ $1_$2_ALL_HAPPY_OPTS = \ $$($1_$2_HAPPY_OPTS) \ $$(EXTRA_HAPPY_OPTS) +# We don't bother splitting the bootstrap packages (built with stage 0) +ifeq "$$($1_$2_SplitObjs)" "" +ifeq "$$(SplitObjs) $3" "YES 1" +$1_$2_SplitObjs = YES +else +$1_$2_SplitObjs = NO +endif +endif +# Disable split sections when building with stage0, it won't be supported yet +# and it's probably not very relevant anyway (smaller stage1 ghc?). +ifeq "$$($1_$2_SplitSections)" "" +ifeq "$3" "1" +$1_$2_SplitSections = $(SplitSections) +else +$1_$2_SplitSections = NO +endif +endif + endef From git at git.haskell.org Tue Feb 14 21:57:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Feb 2017 21:57:59 +0000 (UTC) Subject: [commit: ghc] master: Check local type family instances against all imported ones (bedcb71) Message-ID: <20170214215759.B2C863A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/bedcb71659253bb8ab5d449df8e3ee884cc85d46/ghc >--------------------------------------------------------------- commit bedcb71659253bb8ab5d449df8e3ee884cc85d46 Author: Reid Barton Date: Tue Feb 14 13:13:37 2017 -0500 Check local type family instances against all imported ones We previously checked type family instance declarations in a module for consistency with all instances that we happened to have read into the EPS or HPT. It was possible to arrange that an imported type family instance (used by an imported function) was in a module whose interface file was never read during compilation; then we wouldn't check consistency of local instances with this imported instance and as a result type safety was lost. With this patch, we still check consistency of local type family instances with all type family instances that we have loaded; but we make sure to load the interface files of all our imports that define family instances first. More selective consistency checking is left to #13102. On the other hand, we can now safely assume when we import a module that it has been checked for consistency with its imports. So we can save checking in checkFamInstConsistency, and overall we should have less work to do now. This patch also adds a note describing the Plan for ensuring type family consistency. Test Plan: Two new tests added; harbormaster Reviewers: austin, simonpj, bgamari Reviewed By: simonpj, bgamari Subscribers: ggreif, thomie Differential Revision: https://phabricator.haskell.org/D2992 >--------------------------------------------------------------- bedcb71659253bb8ab5d449df8e3ee884cc85d46 compiler/basicTypes/Name.hs | 14 +- compiler/main/HscTypes.hs | 7 +- compiler/typecheck/FamInst.hs | 158 +++++++++++++++++++-- compiler/typecheck/TcRnDriver.hs | 16 ++- testsuite/tests/ghci/scripts/T4175.stdout | 2 +- .../indexed-types/should_compile/T13092b/Makefile | 10 ++ .../should_compile/T13092b/T13092b_1.hs | 7 + .../should_compile/T13092b/T13092b_2.hs | 8 ++ .../indexed-types/should_compile/T13092b/all.T | 5 + .../tests/indexed-types/should_fail/T13092/A.hs | 3 + .../tests/indexed-types/should_fail/T13092/B.hs | 5 + .../tests/indexed-types/should_fail/T13092/C.hs | 6 + .../tests/indexed-types/should_fail/T13092/Main.hs | 18 +++ .../indexed-types/should_fail/T13092/Makefile | 9 ++ .../indexed-types/should_fail/T13092/T13092.stderr | 5 + .../tests/indexed-types/should_fail/T13092/all.T | 5 + .../indexed-types/should_fail/T13092c/Makefile | 12 ++ .../should_fail/T13092c/T13092c.stderr | 5 + .../indexed-types/should_fail/T13092c/T13092c_1.hs | 6 + .../indexed-types/should_fail/T13092c/T13092c_2.hs | 8 ++ .../indexed-types/should_fail/T13092c/T13092c_3.hs | 5 + .../indexed-types/should_fail/T13092c/T13092c_4.hs | 7 + .../tests/indexed-types/should_fail/T13092c/all.T | 8 ++ testsuite/tests/perf/compiler/all.T | 3 +- 24 files changed, 312 insertions(+), 20 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 bedcb71659253bb8ab5d449df8e3ee884cc85d46 From git at git.haskell.org Tue Feb 14 21:57:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Feb 2017 21:57:53 +0000 (UTC) Subject: [commit: ghc] master: Make deSugarExpr use runTcInteractive (f90e61a) Message-ID: <20170214215753.A75E43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f90e61ad6e5fa0655185f14ca128d507e489c4b7/ghc >--------------------------------------------------------------- commit f90e61ad6e5fa0655185f14ca128d507e489c4b7 Author: Reid Barton Date: Tue Feb 14 13:13:56 2017 -0500 Make deSugarExpr use runTcInteractive Preparation for #13102, which needs to add more logic to runTcInteractive, which would need to be duplicated in deSugarExpr. In order to break an import cycle, I had to move "Dependency/fingerprinting code" to a new module DsUsage; which seems sensible anyways. Test Plan: validate Reviewers: simonpj, austin, bgamari Reviewed By: bgamari Subscribers: thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3125 >--------------------------------------------------------------- f90e61ad6e5fa0655185f14ca128d507e489c4b7 compiler/deSugar/Desugar.hs | 214 ++------------------------------------------ compiler/deSugar/DsUsage.hs | 211 +++++++++++++++++++++++++++++++++++++++++++ compiler/ghc.cabal.in | 1 + compiler/iface/MkIface.hs | 2 +- 4 files changed, 221 insertions(+), 207 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 f90e61ad6e5fa0655185f14ca128d507e489c4b7 From git at git.haskell.org Tue Feb 14 21:57:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Feb 2017 21:57:56 +0000 (UTC) Subject: [commit: ghc] master: Don't warn about missing methods for instances in signatures. (93e65c8) Message-ID: <20170214215756.E42533A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/93e65c8ab7b468d69bf24d9dc2f197d24e5166f4/ghc >--------------------------------------------------------------- commit 93e65c8ab7b468d69bf24d9dc2f197d24e5166f4 Author: Edward Z. Yang Date: Tue Feb 14 13:16:04 2017 -0500 Don't warn about missing methods for instances in signatures. Test Plan: validate Reviewers: bgamari, austin, dfeuer Reviewed By: dfeuer Subscribers: dfeuer, thomie Differential Revision: https://phabricator.haskell.org/D3134 >--------------------------------------------------------------- 93e65c8ab7b468d69bf24d9dc2f197d24e5166f4 compiler/typecheck/TcClassDcl.hs | 4 +++- testsuite/tests/backpack/should_compile/all.T | 1 + testsuite/tests/backpack/should_compile/bkp52.bkp | 10 ++++++++++ .../backpack/should_compile/{bkp49.stderr => bkp52.stderr} | 3 ++- 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/compiler/typecheck/TcClassDcl.hs b/compiler/typecheck/TcClassDcl.hs index 716aed3..3b9e6ac 100644 --- a/compiler/typecheck/TcClassDcl.hs +++ b/compiler/typecheck/TcClassDcl.hs @@ -516,7 +516,9 @@ warnMissingAT :: Name -> TcM () warnMissingAT name = do { warn <- woptM Opt_WarnMissingMethods ; traceTc "warn" (ppr name <+> ppr warn) - ; warnTc (Reason Opt_WarnMissingMethods) warn -- Warn only if -Wmissing-methods + ; hsc_src <- fmap tcg_src getGblEnv + -- Warn only if -Wmissing-methods AND not a signature + ; warnTc (Reason Opt_WarnMissingMethods) (warn && hsc_src /= HsigFile) (text "No explicit" <+> text "associated type" <+> text "or default declaration for " <+> quotes (ppr name)) } diff --git a/testsuite/tests/backpack/should_compile/all.T b/testsuite/tests/backpack/should_compile/all.T index 31bbfcf..683d913 100644 --- a/testsuite/tests/backpack/should_compile/all.T +++ b/testsuite/tests/backpack/should_compile/all.T @@ -43,6 +43,7 @@ test('bkp48', normal, backpack_compile, ['']) test('bkp49', normal, backpack_compile, ['']) test('bkp50', normal, backpack_compile, ['']) test('bkp51', normal, backpack_compile, ['']) +test('bkp52', normal, backpack_compile, ['']) test('T13149', expect_broken(13149), backpack_compile, ['']) test('T13214', normal, backpack_compile, ['']) diff --git a/testsuite/tests/backpack/should_compile/bkp52.bkp b/testsuite/tests/backpack/should_compile/bkp52.bkp new file mode 100644 index 0000000..b60cd70 --- /dev/null +++ b/testsuite/tests/backpack/should_compile/bkp52.bkp @@ -0,0 +1,10 @@ +{-# LANGUAGE TypeFamilies #-} +unit p where + module M where + class F a where + type T a :: * +unit q where + dependency p + signature A where + import M + instance F Int diff --git a/testsuite/tests/backpack/should_compile/bkp49.stderr b/testsuite/tests/backpack/should_compile/bkp52.stderr similarity index 55% copy from testsuite/tests/backpack/should_compile/bkp49.stderr copy to testsuite/tests/backpack/should_compile/bkp52.stderr index d8f64f0..5e67670 100644 --- a/testsuite/tests/backpack/should_compile/bkp49.stderr +++ b/testsuite/tests/backpack/should_compile/bkp52.stderr @@ -1,4 +1,5 @@ [1 of 2] Processing p - [1 of 1] Compiling A[sig] ( p/A.hsig, nothing ) + Instantiating p + [1 of 1] Compiling M ( p/M.hs, bkp52.out/p/M.o ) [2 of 2] Processing q [1 of 1] Compiling A[sig] ( q/A.hsig, nothing ) From git at git.haskell.org Tue Feb 14 22:05:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 14 Feb 2017 22:05:49 +0000 (UTC) Subject: [commit: packages/array] master: Add arcconfig (c58ecfa) Message-ID: <20170214220549.BA2D13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/array On branch : master Link : http://git.haskell.org/packages/array.git/commitdiff/c58ecfadbe68486e9eab925c9c44d667316b2d14 >--------------------------------------------------------------- commit c58ecfadbe68486e9eab925c9c44d667316b2d14 Author: Ben Gamari Date: Tue Feb 14 17:05:04 2017 -0500 Add arcconfig >--------------------------------------------------------------- c58ecfadbe68486e9eab925c9c44d667316b2d14 .arcconfig | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.arcconfig b/.arcconfig new file mode 100644 index 0000000..49c6521 --- /dev/null +++ b/.arcconfig @@ -0,0 +1,5 @@ +{ + "project.name" : "array", + "repository.callsign" : "ARRAY", + "phabricator.uri" : "https://phabricator.haskell.org" +} From git at git.haskell.org Wed Feb 15 17:08:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 15 Feb 2017 17:08:07 +0000 (UTC) Subject: [commit: ghc] master: Typos [ci skip] (e28fbbb) Message-ID: <20170215170807.A39C33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e28fbbb7c3d5904a88b4743d0d10f212d61d8293/ghc >--------------------------------------------------------------- commit e28fbbb7c3d5904a88b4743d0d10f212d61d8293 Author: Gabor Greif Date: Mon Feb 13 15:32:49 2017 +0100 Typos [ci skip] >--------------------------------------------------------------- e28fbbb7c3d5904a88b4743d0d10f212d61d8293 compiler/coreSyn/CoreUtils.hs | 4 ++-- compiler/hsSyn/HsExpr.hs | 2 +- compiler/prelude/TysWiredIn.hs | 2 +- compiler/rename/RnPat.hs | 2 +- compiler/simplCore/SetLevels.hs | 2 +- compiler/typecheck/TcSimplify.hs | 2 +- compiler/types/Type.hs | 2 +- docs/users_guide/glasgow_exts.rst | 2 +- rts/RetainerProfile.c | 2 +- rts/Trace.c | 2 +- testsuite/tests/programs/andy_cherry/Main.hs | 4 ++-- testsuite/tests/typecheck/should_compile/tc146.hs | 2 +- 12 files changed, 14 insertions(+), 14 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 e28fbbb7c3d5904a88b4743d0d10f212d61d8293 From git at git.haskell.org Thu Feb 16 00:30:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 16 Feb 2017 00:30:55 +0000 (UTC) Subject: [commit: ghc] branch 'wip/rwbarton-gold' created Message-ID: <20170216003055.EADF03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/rwbarton-gold Referencing: f176ae1db68406ef7cc2aa9ef816c8fb054db902 From git at git.haskell.org Thu Feb 16 00:30:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 16 Feb 2017 00:30:58 +0000 (UTC) Subject: [commit: ghc] wip/rwbarton-gold: TEST: Force use of gold linker (f176ae1) Message-ID: <20170216003058.A65F43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rwbarton-gold Link : http://ghc.haskell.org/trac/ghc/changeset/f176ae1db68406ef7cc2aa9ef816c8fb054db902/ghc >--------------------------------------------------------------- commit f176ae1db68406ef7cc2aa9ef816c8fb054db902 Author: Reid Barton Date: Wed Feb 15 19:30:23 2017 -0500 TEST: Force use of gold linker >--------------------------------------------------------------- f176ae1db68406ef7cc2aa9ef816c8fb054db902 aclocal.m4 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aclocal.m4 b/aclocal.m4 index 3337215..23f72a8 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -672,6 +672,8 @@ AC_DEFUN([FPTOOLS_SET_C_LD_FLAGS], $2="$$2 -fno-stack-protector" fi + $3="$$3 -fuse-ld=gold" + rm -f conftest.c conftest.o AC_MSG_RESULT([done]) ]) From git at git.haskell.org Thu Feb 16 14:25:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 16 Feb 2017 14:25:21 +0000 (UTC) Subject: [commit: ghc] master: Improve checking of joins in Core Lint (6bab649) Message-ID: <20170216142521.A32233A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6bab649bde653f13c15eba30d5007bef4a9a9d3a/ghc >--------------------------------------------------------------- commit 6bab649bde653f13c15eba30d5007bef4a9a9d3a Author: Simon Peyton Jones Date: Thu Feb 16 09:42:32 2017 +0000 Improve checking of joins in Core Lint This patch addresses the rather expensive treatment of join points, identified in Trac #13220 comment:17 Before we were tracking the "bad joins". Now we track the good ones. That is easier to think about, and much more efficient; see CoreLint Note [Join points]. On the way I did some other modest refactoring, among other things removing a duplicated call of lintIdBndr for let-bindings. On teh >--------------------------------------------------------------- 6bab649bde653f13c15eba30d5007bef4a9a9d3a compiler/coreSyn/CoreLint.hs | 253 ++++++++++++++++++++++--------------------- 1 file changed, 130 insertions(+), 123 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 6bab649bde653f13c15eba30d5007bef4a9a9d3a From git at git.haskell.org Thu Feb 16 14:25:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 16 Feb 2017 14:25:25 +0000 (UTC) Subject: [commit: ghc] master: Use the correct origin in SectionL and Section R (b8c29bc) Message-ID: <20170216142525.3D21E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b8c29bc9ccd541478b6c1b9d04ca940b9d74cf96/ghc >--------------------------------------------------------------- commit b8c29bc9ccd541478b6c1b9d04ca940b9d74cf96 Author: Simon Peyton Jones Date: Thu Feb 16 12:51:36 2017 +0000 Use the correct origin in SectionL and Section R This fixes Trac #13285. The CallStack stuff is all driven by a CtOrigin of (OccurenceOf f), and we were instead using SectionOrigin. Boo! Easily fixed; and I did a little refactoring as usual. >--------------------------------------------------------------- b8c29bc9ccd541478b6c1b9d04ca940b9d74cf96 compiler/typecheck/TcExpr.hs | 22 +++++++++++----- compiler/typecheck/TcMatches.hs | 2 +- compiler/typecheck/TcPat.hs | 2 +- compiler/typecheck/TcRnDriver.hs | 2 +- compiler/typecheck/TcRnTypes.hs | 29 ++++++++++++---------- testsuite/tests/deSugar/should_run/T13285.hs | 12 +++++++++ .../should_run/T13285.stdout} | 1 + testsuite/tests/deSugar/should_run/all.T | 1 + testsuite/tests/parser/should_compile/T2245.stderr | 2 +- 9 files changed, 50 insertions(+), 23 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 b8c29bc9ccd541478b6c1b9d04ca940b9d74cf96 From git at git.haskell.org Thu Feb 16 14:25:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 16 Feb 2017 14:25:18 +0000 (UTC) Subject: [commit: ghc] master: Comments and tiny refactor only (fc9d152) Message-ID: <20170216142518.CEF3E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fc9d152b058f21ab03986ea722d0c94688b9969f/ghc >--------------------------------------------------------------- commit fc9d152b058f21ab03986ea722d0c94688b9969f Author: Simon Peyton Jones Date: Thu Feb 16 09:41:55 2017 +0000 Comments and tiny refactor only >--------------------------------------------------------------- fc9d152b058f21ab03986ea722d0c94688b9969f compiler/simplCore/OccurAnal.hs | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/compiler/simplCore/OccurAnal.hs b/compiler/simplCore/OccurAnal.hs index 6217dc8..f2f7da6 100644 --- a/compiler/simplCore/OccurAnal.hs +++ b/compiler/simplCore/OccurAnal.hs @@ -1867,17 +1867,17 @@ occAnalApp env (Var fun, args, ticks) -- This is the *whole point* of the isRhsEnv predicate -- See Note [Arguments of let-bound constructors] - n_val_args = valArgCount args + length (takeWhile isOneShotInfo (occ_one_shots env)) - -- See Note [Sources of one-shot information], bullet point A' - + n_val_args = valArgCount args n_args = length args fun_uds = mkOneOcc env fun (n_val_args > 0) n_args is_exp = isExpandableApp fun n_val_args -- See Note [CONLIKE pragma] in BasicTypes -- The definition of is_exp should match that in Simplify.prepareRhs - one_shots = argsOneShots (idStrictness fun) n_val_args - -- See Note [Sources of one-shot information] + one_shots = argsOneShots (idStrictness fun) guaranteed_val_args + guaranteed_val_args = n_val_args + length (takeWhile isOneShotInfo + (occ_one_shots env)) + -- See Note [Sources of one-shot information], bullet point A'] occAnalApp env (fun, args, ticks) = (markAllNonTailCalled (fun_uds +++ args_uds), @@ -1909,33 +1909,39 @@ A: Saturated applications: eg f e1 .. en f's strictness signature into e1 .. en, but /only/ if n is enough to saturate the strictness signature. A strictness signature like - f :: C1(C1(L))LS + f :: C1(C1(L))LS means that *if f is applied to three arguments* then it will guarantee to call its first argument at most once, and to call the result of that at most once. But if f has fewer than three arguments, all bets are off; e.g. - map (f (\x y. expensive) e2) xs + map (f (\x y. expensive) e2) xs Here the \x y abstraction may be called many times (once for each element of xs) so we should not mark x and y as one-shot. But if it was - map (f (\x y. expensive) 3 2) xs + map (f (\x y. expensive) 3 2) xs then the first argument of f will be called at most once. + The one-shot info, derived from f's strictness signature, is + computed by 'argsOneShots', called in occAnalApp. + A': Non-obviously saturated applications: eg build (f (\x y -> expensive)) + where f is as above. In this case, f is only manifestly applied to one argument, so it does not look saturated. So by the previous point, we should not use its strictness signature to learn about the one-shotness of \x y. But in this case we can: - - build is fully applied, so we may use its strictness signature. From that - we learn that build calls its argument with two arguments *at most once*. + build is fully applied, so we may use its strictness signature; and from + that we learn that build calls its argument with two arguments *at most once*. So there is really only one call to f, and it will have three arguments. In that sense, f is saturated, and we may proceed as described above. + Hence the computation of 'guaranteed_val_args' in occAnalApp, using + '(occ_one_shots env)'. See also Trac #13227, comment:9 + B: Let-bindings: eg let f = \c. let ... in \n -> blah in (build f, build f) From git at git.haskell.org Thu Feb 16 17:46:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 16 Feb 2017 17:46:15 +0000 (UTC) Subject: [commit: ghc] master: Better perf for haddock.base, haddock.Cabal (f4aa998) Message-ID: <20170216174615.6170D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f4aa9984790332a908e8b1321d00a839fb42c3ea/ghc >--------------------------------------------------------------- commit f4aa9984790332a908e8b1321d00a839fb42c3ea Author: Simon Peyton Jones Date: Thu Feb 16 17:44:58 2017 +0000 Better perf for haddock.base, haddock.Cabal I think this is due to commit 6bab649bde653f13c15eba30d5007bef4a9a9d3a Author: Simon Peyton Jones Date: Thu Feb 16 09:42:32 2017 +0000 Improve checking of joins in Core Lint Improvement is around 5%. >--------------------------------------------------------------- f4aa9984790332a908e8b1321d00a839fb42c3ea testsuite/tests/perf/haddock/all.T | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/testsuite/tests/perf/haddock/all.T b/testsuite/tests/perf/haddock/all.T index c9b84cf..5ed6758 100644 --- a/testsuite/tests/perf/haddock/all.T +++ b/testsuite/tests/perf/haddock/all.T @@ -5,7 +5,7 @@ test('haddock.base', [unless(in_tree_compiler(), skip), req_haddock ,stats_num_field('bytes allocated', - [(wordsize(64), 34819979936 , 5) + [(wordsize(64), 32695562088, 5) # 2012-08-14: 5920822352 (amd64/Linux) # 2012-09-20: 5829972376 (amd64/Linux) # 2012-10-08: 5902601224 (amd64/Linux) @@ -32,6 +32,7 @@ test('haddock.base', # 2016-05-12: 32855223200 (x86_64/Linux) - Make Generic1 poly-kinded # 2017-01-11: 31115778088 (x86_64/Linux) - Join points (#12988) # 2017-02-11: 34819979936 (x86_64/Linux) - OccurAnal / One-Shot (#13227) + # 2017-02-16: 32695562088 Better Lint for join points ,(platform('i386-unknown-mingw32'), 4434804940, 5) # 2013-02-10: 3358693084 (x86/Windows) @@ -54,7 +55,7 @@ test('haddock.base', test('haddock.Cabal', [unless(in_tree_compiler(), skip), req_haddock ,stats_num_field('bytes allocated', - [(wordsize(64), 25533642168, 5) + [(wordsize(64), 23867276992, 5) # 2012-08-14: 3255435248 (amd64/Linux) # 2012-08-29: 3324606664 (amd64/Linux, new codegen) # 2012-10-08: 3373401360 (amd64/Linux) @@ -96,6 +97,7 @@ test('haddock.Cabal', # 2016-12-20: 25478853176 (amd64/Linux) - Cabal update # 2017-01-14: 23272708864 (amd64/Linux) - Join points (#12988) # 2017-02-11: 25533642168 (amd64/Linux) - OccurAnal / One-Shot (#13227) + # 2017-02-16: 23867276992 Better Lint for join points ,(platform('i386-unknown-mingw32'), 3293415576, 5) # 2012-10-30: 1733638168 (x86/Windows) From git at git.haskell.org Fri Feb 17 00:04:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Feb 2017 00:04:18 +0000 (UTC) Subject: [commit: ghc] master: Comments only, about inl_inline and inl_act (e52a335) Message-ID: <20170217000418.8F0FF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e52a335d3ae2437f3705baa8c81e3a62ebdd75ab/ghc >--------------------------------------------------------------- commit e52a335d3ae2437f3705baa8c81e3a62ebdd75ab Author: Simon Peyton Jones Date: Fri Feb 17 00:01:46 2017 +0000 Comments only, about inl_inline and inl_act >--------------------------------------------------------------- e52a335d3ae2437f3705baa8c81e3a62ebdd75ab compiler/basicTypes/BasicTypes.hs | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/compiler/basicTypes/BasicTypes.hs b/compiler/basicTypes/BasicTypes.hs index 5af9017..03e588c 100644 --- a/compiler/basicTypes/BasicTypes.hs +++ b/compiler/basicTypes/BasicTypes.hs @@ -1144,7 +1144,7 @@ data RuleMatchInfo = ConLike -- See Note [CONLIKE pragma] data InlinePragma -- Note [InlinePragma] = InlinePragma { inl_src :: SourceText -- Note [Pragma source text] - , inl_inline :: InlineSpec + , inl_inline :: InlineSpec -- See Note [inl_inline and inl_act] , inl_sat :: Maybe Arity -- Just n <=> Inline only when applied to n -- explicit (non-type, non-dictionary) args @@ -1154,6 +1154,7 @@ data InlinePragma -- Note [InlinePragma] -- the Unfolding, and don't look at inl_sat further , inl_act :: Activation -- Says during which phases inlining is allowed + -- See Note [inl_inline and inl_act] , inl_rule :: RuleMatchInfo -- Should the function be treated like a constructor? } deriving( Eq, Data ) @@ -1168,9 +1169,8 @@ data InlineSpec -- What the user's INLINE pragma looked like deriving( Eq, Data, Show ) -- Show needed for Lexer.x -{- -Note [InlinePragma] -~~~~~~~~~~~~~~~~~~~ +{- Note [InlinePragma] +~~~~~~~~~~~~~~~~~~~~~~ This data type mirrors what you can write in an INLINE or NOINLINE pragma in the source program. @@ -1186,6 +1186,23 @@ If inl_inline = Inline or Inlineable, then the Id should have an InlineRule unfo If you want to know where InlinePragmas take effect: Look in DsBinds.makeCorePair +Note [inl_inline and inl_act] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +* inl_inline says what the user wrote: did she say INLINE, NOINLINE, + INLINABLE, or nothing at all + +* inl_act says in what phases the unfolding is active or inactive + E.g If you write INLINE[1] then inl_act will be set to ActiveAfter 1 + If you write NOINLINE[1] then inl_act will be set to ActiveBefore 1 + If you write NOINLINE[~1] then inl_act will be set to ActiveAfter 1 + So note that inl_act does not say what pragma you wrote: it just + expresses its consequences + +* inl_act just says when the unfolding is active; it doesn't say what + to inline. If you say INLINE f, then f's inl_act will be AlwaysActive, + but in addition f will get a "stable unfolding" with UnfoldingGuidance + that tells the inliner to be pretty eager about it. + Note [CONLIKE pragma] ~~~~~~~~~~~~~~~~~~~~~ The ConLike constructor of a RuleMatchInfo is aimed at the following. From git at git.haskell.org Fri Feb 17 13:16:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Feb 2017 13:16:31 +0000 (UTC) Subject: [commit: ghc] master: Honour -dsuppress-uniques more thoroughly (8d401e5) Message-ID: <20170217131631.88DFC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8d401e50ce35525dcdc6a21fcf952c3cbf3a72d4/ghc >--------------------------------------------------------------- commit 8d401e50ce35525dcdc6a21fcf952c3cbf3a72d4 Author: Simon Peyton Jones Date: Fri Feb 17 13:14:00 2017 +0000 Honour -dsuppress-uniques more thoroughly I found that tests parser/should_compile/DumpRenamedAst and friends were printing uniques, which makes the test fragile. But -dsuppress-uniques made no difference! It turned out that pprName wasn't properly consulting Opt_SuppressUniques. This patch fixes the problem, and updates those three tests to use -dsuppress-uniques >--------------------------------------------------------------- 8d401e50ce35525dcdc6a21fcf952c3cbf3a72d4 compiler/basicTypes/Name.hs | 16 +++++--- compiler/basicTypes/Unique.hs | 13 ++++-- compiler/cmm/CLabel.hs | 24 +++++------ compiler/llvmGen/Llvm/PpLlvm.hs | 2 +- compiler/nativeGen/PPC/Ppr.hs | 12 +++--- compiler/nativeGen/Reg.hs | 10 ++--- compiler/nativeGen/SPARC/Ppr.hs | 12 +++--- compiler/nativeGen/X86/Ppr.hs | 12 +++--- .../parser/should_compile/DumpParsedAst.stderr | 2 +- .../parser/should_compile/DumpRenamedAst.stderr | 46 +++++++++++----------- .../should_compile/DumpTypecheckedAst.stderr | 26 ++++++------ testsuite/tests/parser/should_compile/all.T | 6 +-- 12 files changed, 96 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 8d401e50ce35525dcdc6a21fcf952c3cbf3a72d4 From git at git.haskell.org Fri Feb 17 14:00:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Feb 2017 14:00:48 +0000 (UTC) Subject: [commit: ghc] master: Fix a substitution bug in cseCase (e55986a) Message-ID: <20170217140048.69C713A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e55986a9810129d47a59c0bd4fcdc96f32108041/ghc >--------------------------------------------------------------- commit e55986a9810129d47a59c0bd4fcdc96f32108041 Author: Simon Peyton Jones Date: Fri Feb 17 12:47:39 2017 +0000 Fix a substitution bug in cseCase There was a missing substTy in cseCase! Wow. I'm surprised it has not caused problems. Anyway, easily fixed. >--------------------------------------------------------------- e55986a9810129d47a59c0bd4fcdc96f32108041 compiler/simplCore/CSE.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/simplCore/CSE.hs b/compiler/simplCore/CSE.hs index 21dbd07..80013a3 100644 --- a/compiler/simplCore/CSE.hs +++ b/compiler/simplCore/CSE.hs @@ -392,8 +392,9 @@ cseExpr env (Case e bndr ty alts) = cseCase env e bndr ty alts cseCase :: CSEnv -> InExpr -> InId -> InType -> [InAlt] -> OutExpr cseCase env scrut bndr ty alts - = Case scrut1 bndr3 ty (map cse_alt alts) + = Case scrut1 bndr3 ty' (map cse_alt alts) where + ty' = substTy (csEnvSubst env) ty scrut1 = tryForCSE False env scrut bndr1 = zapIdOccInfo bndr From git at git.haskell.org Fri Feb 17 14:00:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Feb 2017 14:00:51 +0000 (UTC) Subject: [commit: ghc] master: Simplify OutputableBndr (0e76017) Message-ID: <20170217140051.297C23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0e7601749d53d59df528ede996d8b54352051498/ghc >--------------------------------------------------------------- commit 0e7601749d53d59df528ede996d8b54352051498 Author: Simon Peyton Jones Date: Fri Feb 17 13:58:58 2017 +0000 Simplify OutputableBndr This replaces three methods in OutputableBndr with one, and adds comments. There's also a tiny change in the placement of equals signs in debug-prints. I like it better that way, but if it complicates life for anyone we can put it back. >--------------------------------------------------------------- 0e7601749d53d59df528ede996d8b54352051498 compiler/basicTypes/Name.hs | 1 - compiler/coreSyn/CoreSyn.hs | 4 +- compiler/coreSyn/PprCore.hs | 45 +++++++++++++--------- compiler/utils/Outputable.hs | 18 +++------ .../tests/numeric/should_compile/T7116.stdout | 36 ++++++++--------- .../tests/simplCore/should_compile/T13156.stdout | 8 ++-- .../tests/simplCore/should_compile/T3772.stdout | 32 +++++++-------- .../tests/simplCore/should_compile/T7865.stdout | 10 ++--- 8 files changed, 76 insertions(+), 78 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 0e7601749d53d59df528ede996d8b54352051498 From git at git.haskell.org Fri Feb 17 15:08:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Feb 2017 15:08:56 +0000 (UTC) Subject: [commit: ghc] branch 'wip/T13255-spj' created Message-ID: <20170217150856.CD4013A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/T13255-spj Referencing: 5cef996c7cac724174a4f9b3ecceb4f84737d49e From git at git.haskell.org Fri Feb 17 15:08:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Feb 2017 15:08:59 +0000 (UTC) Subject: [commit: ghc] wip/T13255-spj: Improve Core Lint, mainly for join points (49eed68) Message-ID: <20170217150859.8EC043A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T13255-spj Link : http://ghc.haskell.org/trac/ghc/changeset/49eed68295ad547fbd4d9b3c3e9ed25fde8f00d6/ghc >--------------------------------------------------------------- commit 49eed68295ad547fbd4d9b3c3e9ed25fde8f00d6 Author: Simon Peyton Jones Date: Fri Feb 17 15:03:01 2017 +0000 Improve Core Lint, mainly for join points * lintSingleBinding: check that join points have a valid join-point type (Trac #13281) * lintIdBinder: check that a JoinId is bound by a non-top-level let i.e. not a top level binder not lambda/case binder * Check for empty Rec [] bindings * Rename lintIdBndrs to lintLetBndrs >--------------------------------------------------------------- 49eed68295ad547fbd4d9b3c3e9ed25fde8f00d6 compiler/coreSyn/CoreLint.hs | 107 ++++++++++++++++++++++++++++--------------- 1 file changed, 69 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 49eed68295ad547fbd4d9b3c3e9ed25fde8f00d6 From git at git.haskell.org Fri Feb 17 15:09:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Feb 2017 15:09:02 +0000 (UTC) Subject: [commit: ghc] wip/T13255-spj: Fix SetLevels for join points (5cef996) Message-ID: <20170217150902.4C6633A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T13255-spj Link : http://ghc.haskell.org/trac/ghc/changeset/5cef996c7cac724174a4f9b3ecceb4f84737d49e/ghc >--------------------------------------------------------------- commit 5cef996c7cac724174a4f9b3ecceb4f84737d49e Author: Simon Peyton Jones Date: Fri Feb 17 15:03:52 2017 +0000 Fix SetLevels for join points This fixes Trac #13255. The trouble was that we had a bottoming join point, and tried to float it to top level. But it had free JoinIds, so we tried to abstract over them. Disaster. Lint should have caught it, but didn't (now fixed). This patch fixes the original problem. >--------------------------------------------------------------- 5cef996c7cac724174a4f9b3ecceb4f84737d49e compiler/simplCore/SetLevels.hs | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/compiler/simplCore/SetLevels.hs b/compiler/simplCore/SetLevels.hs index 4fca18d..22d4048 100644 --- a/compiler/simplCore/SetLevels.hs +++ b/compiler/simplCore/SetLevels.hs @@ -977,8 +977,7 @@ lvlBind env (AnnNonRec bndr rhs) rhs_fvs = freeVarsOf rhs bind_fvs = rhs_fvs `unionDVarSet` dIdFreeVars bndr abs_vars = abstractVars dest_lvl env bind_fvs - dest_lvl = destLevel env bind_fvs (isFunction rhs) is_bot - is_unfloatable_join + dest_lvl = destLevel env bind_fvs (isFunction rhs) is_bot is_join mb_bot_str = exprBotStrictness_maybe (deAnnotate rhs) -- See Note [Bottoming floats] -- esp Bottoming floats (2) @@ -986,8 +985,8 @@ lvlBind env (AnnNonRec bndr rhs) n_extra = count isId abs_vars mb_join_arity = isJoinId_maybe bndr - is_unfloatable_join = case mb_join_arity of Just ar -> ar > 0 - Nothing -> False + is_join = isJust mb_join_arity + -- See Note [When to ruin a join point] need_zap = dest_lvl `ltLvl` joinCeilingLevel env zapped_join | need_zap = Nothing -- Zap the join point @@ -1066,15 +1065,11 @@ lvlBind env (AnnRec pairs) `delDVarSetList` bndrs - dest_lvl = destLevel env bind_fvs (all isFunction rhss) False - has_unfloatable_join + dest_lvl = destLevel env bind_fvs (all isFunction rhss) False is_join abs_vars = abstractVars dest_lvl env bind_fvs mb_join_arities = map isJoinId_maybe bndrs - has_unfloatable_join - = any (\mb_ar -> case mb_ar of Just ar -> ar > 0 - Nothing -> False) mb_join_arities - + is_join = any isJust mb_join_arities need_zap = dest_lvl `ltLvl` joinCeilingLevel env zap_join mb_join_arity | need_zap = Nothing | otherwise = mb_join_arity @@ -1244,6 +1239,14 @@ destLevel :: LevelEnv -> DVarSet -> Bool -- True <=> is join point (or can be floated anyway) -> Level destLevel env fvs is_function is_bot is_join + | isTopLvl max_fv_level -- Float even joins if they get to top level + = tOP_LEVEL + + | is_join + = if max_fv_level `ltLvl` join_ceiling + then join_ceiling + else max_fv_level + | is_bot -- Send bottoming bindings to the top = tOP_LEVEL -- regardless; see Note [Bottoming floats] -- Esp Bottoming floats (1) @@ -1255,19 +1258,12 @@ destLevel env fvs is_function is_bot is_join = tOP_LEVEL -- Send functions to top level; see -- the comments with isFunction - | is_join - , hits_ceiling - = join_ceiling - | otherwise = max_fv_level where max_fv_level = maxFvLevel isId env fvs -- Max over Ids only; the tyvars -- will be abstracted - join_ceiling = joinCeilingLevel env - hits_ceiling = max_fv_level `ltLvl` join_ceiling && - not (isTopLvl max_fv_level) - -- Note [When to ruin a join point] + isFunction :: CoreExprWithFVs -> Bool -- The idea here is that we want to float *functions* to From git at git.haskell.org Fri Feb 17 15:09:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Feb 2017 15:09:07 +0000 (UTC) Subject: [commit: ghc] wip/T13255-spj: Fix Core pretty printer (da89de7) Message-ID: <20170217150907.B62D03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T13255-spj Link : http://ghc.haskell.org/trac/ghc/changeset/da89de72847c2baeebeb81933fe43158b2d4d8a3/ghc >--------------------------------------------------------------- commit da89de72847c2baeebeb81933fe43158b2d4d8a3 Author: Simon Peyton Jones Date: Fri Feb 17 14:56:13 2017 +0000 Fix Core pretty printer If a JoinId (bogusly) ends up in an argument position we printed f jump j rather than f (jump j) Easy to fix. >--------------------------------------------------------------- da89de72847c2baeebeb81933fe43158b2d4d8a3 compiler/coreSyn/PprCore.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/coreSyn/PprCore.hs b/compiler/coreSyn/PprCore.hs index 994c237..30de5d2 100644 --- a/compiler/coreSyn/PprCore.hs +++ b/compiler/coreSyn/PprCore.hs @@ -148,8 +148,9 @@ ppr_expr :: OutputableBndr b => (SDoc -> SDoc) -> Expr b -> SDoc -- The function adds parens in context that need -- an atomic value (e.g. function args) -ppr_expr _ (Var name) = ppWhen (isJoinId name) (text "jump") <+> - ppr name +ppr_expr add_par (Var name) + | isJoinId name = add_par ((text "jump") <+> ppr name) + | otherwise = ppr name ppr_expr add_par (Type ty) = add_par (text "TYPE:" <+> ppr ty) -- Weird ppr_expr add_par (Coercion co) = add_par (text "CO:" <+> ppr co) ppr_expr add_par (Lit lit) = pprLiteral add_par lit From git at git.haskell.org Fri Feb 17 15:09:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Feb 2017 15:09:05 +0000 (UTC) Subject: [commit: ghc] wip/T13255-spj: Change -dppr-ticks to -dsuppress-ticks (e562ff3) Message-ID: <20170217150905.0F18A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T13255-spj Link : http://ghc.haskell.org/trac/ghc/changeset/e562ff3021052d0d731888d94e8ed4c3485ebbfd/ghc >--------------------------------------------------------------- commit e562ff3021052d0d731888d94e8ed4c3485ebbfd Author: Simon Peyton Jones Date: Fri Feb 17 14:50:59 2017 +0000 Change -dppr-ticks to -dsuppress-ticks I spent about two hours today hunting fruitlessly for a simplifier bug (when fixing Trac #13255), only to find that it was caused by -ddump-X silently suppressing all ticks in Core. I think this has happened to me once before. So I've changed to make tick-printing on by default (like coercions, etc), with a flag -dsuppress-ticks (like -dsuppress-coercions) to suppress them. Blargh. -dppr-ticks is still there, but deprecated. >--------------------------------------------------------------- e562ff3021052d0d731888d94e8ed4c3485ebbfd compiler/cmm/PprCmm.hs | 7 +++---- compiler/coreSyn/PprCore.hs | 6 +++--- compiler/main/DynFlags.hs | 8 ++++++-- compiler/stgSyn/StgSyn.hs | 6 +++--- docs/users_guide/debugging.rst | 8 ++++---- testsuite/tests/codeGen/should_compile/Makefile | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/compiler/cmm/PprCmm.hs b/compiler/cmm/PprCmm.hs index 089066a..d20f013 100644 --- a/compiler/cmm/PprCmm.hs +++ b/compiler/cmm/PprCmm.hs @@ -186,15 +186,14 @@ pprNode node = pp_node <+> pp_debug -- label: CmmEntry id tscope -> ppr id <> colon <+> (sdocWithDynFlags $ \dflags -> - ppWhen (gopt Opt_PprShowTicks dflags) (text "//" <+> ppr tscope)) + ppUnless (gopt Opt_SuppressTicks dflags) (text "//" <+> ppr tscope)) -- // text CmmComment s -> text "//" <+> ftext s -- //tick bla<...> - CmmTick t -> if gopt Opt_PprShowTicks dflags - then text "//tick" <+> ppr t - else empty + CmmTick t -> ppUnless (gopt Opt_SuppressTicks dflags) $ + text "//tick" <+> ppr t -- unwind reg = expr; CmmUnwind regs -> diff --git a/compiler/coreSyn/PprCore.hs b/compiler/coreSyn/PprCore.hs index a8dc217..994c237 100644 --- a/compiler/coreSyn/PprCore.hs +++ b/compiler/coreSyn/PprCore.hs @@ -274,9 +274,9 @@ ppr_expr add_par (Let bind expr) ppr_expr add_par (Tick tickish expr) = sdocWithDynFlags $ \dflags -> - if gopt Opt_PprShowTicks dflags - then add_par (sep [ppr tickish, pprCoreExpr expr]) - else ppr_expr add_par expr + if gopt Opt_SuppressTicks dflags + then ppr_expr add_par expr + else add_par (sep [ppr tickish, pprCoreExpr expr]) pprCoreAlt :: OutputableBndr a => (AltCon, [a] , Expr a) -> SDoc pprCoreAlt (con, args, rhs) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index e04d408..d3d0ac3 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -545,6 +545,7 @@ data GeneralFlag -- Except for uniques, as some simplifier phases introduce new -- variables that have otherwise identical names. | Opt_SuppressUniques + | Opt_SuppressTicks -- Replaces Opt_PprShowTicks -- temporary flags | Opt_AutoLinkPackages @@ -2829,6 +2830,7 @@ dynamic_flags_deps = [ setGeneralFlag Opt_SuppressModulePrefixes setGeneralFlag Opt_SuppressTypeApplications setGeneralFlag Opt_SuppressIdInfo + setGeneralFlag Opt_SuppressTicks setGeneralFlag Opt_SuppressTypeSignatures) ------ Debugging ---------------------------------------------------- @@ -3586,7 +3588,9 @@ dFlagsDeps = [ -- See Note [Supporting CLI completion] -- Please keep the list of flags below sorted alphabetically flagSpec "ppr-case-as-let" Opt_PprCaseAsLet, - flagSpec "ppr-ticks" Opt_PprShowTicks, + depFlagSpec' "ppr-ticks" Opt_PprShowTicks + (\turn_on -> useInstead "suppress-ticks" (not turn_on)), + flagSpec "suppress-ticks" Opt_SuppressTicks, flagSpec "suppress-coercions" Opt_SuppressCoercions, flagSpec "suppress-idinfo" Opt_SuppressIdInfo, flagSpec "suppress-unfoldings" Opt_SuppressUnfoldings, @@ -3677,7 +3681,7 @@ fFlagsDeps = [ flagSpec "regs-graph" Opt_RegsGraph, flagSpec "regs-iterative" Opt_RegsIterative, depFlagSpec' "rewrite-rules" Opt_EnableRewriteRules - (useInstead "enable-rewrite-rules"), + (useInstead "enable-rewrite-rules"), flagSpec "shared-implib" Opt_SharedImplib, flagSpec "spec-constr" Opt_SpecConstr, flagSpec "specialise" Opt_Specialise, diff --git a/compiler/stgSyn/StgSyn.hs b/compiler/stgSyn/StgSyn.hs index 93b6e76..15181f3 100644 --- a/compiler/stgSyn/StgSyn.hs +++ b/compiler/stgSyn/StgSyn.hs @@ -766,9 +766,9 @@ pprStgExpr (StgLetNoEscape bind expr) pprStgExpr (StgTick tickish expr) = sdocWithDynFlags $ \dflags -> - if gopt Opt_PprShowTicks dflags - then sep [ ppr tickish, pprStgExpr expr ] - else pprStgExpr expr + if gopt Opt_SuppressTicks dflags + then pprStgExpr expr + else sep [ ppr tickish, pprStgExpr expr ] pprStgExpr (StgCase expr bndr alt_type alts) diff --git a/docs/users_guide/debugging.rst b/docs/users_guide/debugging.rst index fc634d0..fd4adc7 100644 --- a/docs/users_guide/debugging.rst +++ b/docs/users_guide/debugging.rst @@ -267,10 +267,6 @@ Dumping out compiler intermediate structures aren't). This flag makes debugging output appear in the more verbose debug style. -.. ghc-flag:: -dppr-ticks - - Includes "ticks" in the pretty-printer output. - .. _formatting dumps: @@ -323,6 +319,10 @@ parts that you are not interested in. this often makes the printout ambiguous. If you just want to see the overall structure of the code, then start here. +.. ghc-flag:: -dsuppress-ticks + + Suppress "ticks" in the pretty-printer output. + .. ghc-flag:: -dsuppress-uniques Suppress the printing of uniques. This may make the printout diff --git a/testsuite/tests/codeGen/should_compile/Makefile b/testsuite/tests/codeGen/should_compile/Makefile index fda9c94..a3e03d2 100644 --- a/testsuite/tests/codeGen/should_compile/Makefile +++ b/testsuite/tests/codeGen/should_compile/Makefile @@ -9,13 +9,13 @@ debug: # Without optimisations, we should get annotations for basically # all expressions in the example program. echo == Dbg == - '$(TEST_HC)' $(TEST_HC_OPTS) debug -fforce-recomp -g -dppr-ticks -ddump-cmm-verbose \ + '$(TEST_HC)' $(TEST_HC_OPTS) debug -fforce-recomp -g -ddump-cmm-verbose \ | grep -o src\ | sort -u ./debug # With optimisations we will get fewer annotations. echo == Dbg -O2 == - '$(TEST_HC)' $(TEST_HC_OPTS) debug -fforce-recomp -g -dppr-ticks -ddump-cmm-verbose -O2 \ + '$(TEST_HC)' $(TEST_HC_OPTS) debug -fforce-recomp -g -ddump-cmm-verbose -O2 \ > debug.cmm cat debug.cmm | grep -o src\ | sort -u From git at git.haskell.org Fri Feb 17 15:09:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Feb 2017 15:09:10 +0000 (UTC) Subject: [commit: ghc] wip/T13255-spj: Remove redundant import (3b0b4f3) Message-ID: <20170217150910.6FB9E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T13255-spj Link : http://ghc.haskell.org/trac/ghc/changeset/3b0b4f36fa1b1a06c3e88811f527d9a333c0e8f3/ghc >--------------------------------------------------------------- commit 3b0b4f36fa1b1a06c3e88811f527d9a333c0e8f3 Author: Simon Peyton Jones Date: Fri Feb 17 14:57:26 2017 +0000 Remove redundant import >--------------------------------------------------------------- 3b0b4f36fa1b1a06c3e88811f527d9a333c0e8f3 compiler/simplCore/FloatOut.hs | 1 - 1 file changed, 1 deletion(-) diff --git a/compiler/simplCore/FloatOut.hs b/compiler/simplCore/FloatOut.hs index 4806862..72fc0d1 100644 --- a/compiler/simplCore/FloatOut.hs +++ b/compiler/simplCore/FloatOut.hs @@ -21,7 +21,6 @@ import DynFlags import ErrUtils ( dumpIfSet_dyn ) import Id ( Id, idArity, idType, isBottomingId, isJoinId, isJoinId_maybe ) -import Var ( Var ) import BasicTypes ( TopLevelFlag(..), isTopLevel ) import SetLevels import UniqSupply ( UniqSupply ) From git at git.haskell.org Fri Feb 17 15:09:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Feb 2017 15:09:13 +0000 (UTC) Subject: [commit: ghc] wip/T13255-spj: Kill off the remaining Rec [] (3be6895) Message-ID: <20170217150913.2D9C03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T13255-spj Link : http://ghc.haskell.org/trac/ghc/changeset/3be689539dc29e10026961b99a7e08afc632aad0/ghc >--------------------------------------------------------------- commit 3be689539dc29e10026961b99a7e08afc632aad0 Author: Simon Peyton Jones Date: Fri Feb 17 14:55:06 2017 +0000 Kill off the remaining Rec [] The desugarer was producing an empty Rec group, which is never supposed to happen. This small patch stops that happening. Next up: Lint should check. >--------------------------------------------------------------- 3be689539dc29e10026961b99a7e08afc632aad0 compiler/coreSyn/CoreSyn.hs | 9 +++- compiler/deSugar/DsBinds.hs | 4 +- testsuite/tests/callarity/unittest/CallArity1.hs | 60 ++++++++++++------------ 3 files changed, 39 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 3be689539dc29e10026961b99a7e08afc632aad0 From git at git.haskell.org Fri Feb 17 16:27:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Feb 2017 16:27:57 +0000 (UTC) Subject: [commit: ghc] branch 'wip/spj-early-inline' created Message-ID: <20170217162757.E15F83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/spj-early-inline Referencing: 7f14d15c0e5fc2c9a81db3d0f0b01d85857b1d87 From git at git.haskell.org Fri Feb 17 16:28:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Feb 2017 16:28:00 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline: Refactor floating of bindings (fiBind) (67a0c18) Message-ID: <20170217162800.A2AE03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline Link : http://ghc.haskell.org/trac/ghc/changeset/67a0c1872c0515f1f12ea68097a84e02da92f45b/ghc >--------------------------------------------------------------- commit 67a0c1872c0515f1f12ea68097a84e02da92f45b Author: Simon Peyton Jones Date: Tue Feb 14 12:18:38 2017 +0000 Refactor floating of bindings (fiBind) This is just a local refactoring. I originally planned to try floating top-level bindings inwards, but I backed off from that leaving only this (harmless) refactoring, which has no behavioural effect. I also make FloatIn into a ModGuts -> ModGuts function; again not necessary now, but no harm either. My attempt also used the new function CoreFVs.freeVarsBind; but that too is a plausible refactorig of freeVars, so I left it in too. >--------------------------------------------------------------- 67a0c1872c0515f1f12ea68097a84e02da92f45b compiler/coreSyn/CoreFVs.hs | 57 +++++++------- compiler/simplCore/FloatIn.hs | 173 +++++++++++++++++++++++------------------- 2 files changed, 125 insertions(+), 105 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 67a0c1872c0515f1f12ea68097a84e02da92f45b From git at git.haskell.org Fri Feb 17 16:28:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Feb 2017 16:28:03 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline: More tracing in SpecConstr (e90f4d7) Message-ID: <20170217162803.5C78E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline Link : http://ghc.haskell.org/trac/ghc/changeset/e90f4d7c6d3003039fa1647a3da3dafcaa75527b/ghc >--------------------------------------------------------------- commit e90f4d7c6d3003039fa1647a3da3dafcaa75527b Author: Simon Peyton Jones Date: Thu Feb 9 09:35:19 2017 +0000 More tracing in SpecConstr >--------------------------------------------------------------- e90f4d7c6d3003039fa1647a3da3dafcaa75527b compiler/specialise/SpecConstr.hs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/compiler/specialise/SpecConstr.hs b/compiler/specialise/SpecConstr.hs index 15c031b..8a3e227 100644 --- a/compiler/specialise/SpecConstr.hs +++ b/compiler/specialise/SpecConstr.hs @@ -1346,7 +1346,8 @@ scTopBind env body_usage (Rec prs) , not force_spec , not (all (couldBeSmallEnoughToInline (sc_dflags env) threshold) rhss) -- No specialisation - = do { (rhs_usgs, rhss') <- mapAndUnzipM (scExpr env) rhss + = -- pprTrace "scTopBind: nospec" (ppr bndrs) $ + do { (rhs_usgs, rhss') <- mapAndUnzipM (scExpr env) rhss ; return (body_usage `combineUsage` combineUsages rhs_usgs, Rec (bndrs `zip` rhss')) } | otherwise -- Do specialisation @@ -1469,7 +1470,10 @@ specRec top_lvl env body_usg rhs_infos -- Loop, specialising, until you get no new specialisations go seed_calls usg_so_far spec_infos | isEmptyVarEnv seed_calls - = return (usg_so_far, spec_infos) + = -- pprTrace "specRec" (vcat [ ppr (map ri_fn rhs_infos) + -- , ppr seed_calls + -- , ppr body_usg ]) $ + return (usg_so_far, spec_infos) | otherwise = do { specs_w_usg <- zipWithM (specialise env seed_calls) rhs_infos spec_infos ; let (extra_usg_s, new_spec_infos) = unzip specs_w_usg @@ -1499,11 +1503,13 @@ specialise env bind_calls (RI { ri_fn = fn, ri_lam_bndrs = arg_bndrs spec_info@(SI specs spec_count mb_unspec) | isBottomingId fn -- Note [Do not specialise diverging functions] -- and do not generate specialisation seeds from its RHS - = return (nullUsage, spec_info) + = -- pprTrace "specialise bot" (ppr fn) $ + return (nullUsage, spec_info) | isNeverActive (idInlineActivation fn) -- See Note [Transfer activation] || null arg_bndrs -- Only specialise functions - = case mb_unspec of -- Behave as if there was a single, boring call + = -- pprTrace "specialise inactive" (ppr fn) $ + case mb_unspec of -- Behave as if there was a single, boring call Just rhs_usg -> return (rhs_usg, SI specs spec_count Nothing) -- See Note [spec_usg includes rhs_usg] Nothing -> return (nullUsage, spec_info) From git at git.haskell.org Fri Feb 17 16:28:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Feb 2017 16:28:06 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline: Add -fspec-constr-keen (607a735) Message-ID: <20170217162806.1C2BB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline Link : http://ghc.haskell.org/trac/ghc/changeset/607a735dfb99bb8f0edf466ccb01e732218c42ec/ghc >--------------------------------------------------------------- commit 607a735dfb99bb8f0edf466ccb01e732218c42ec Author: Simon Peyton Jones Date: Tue Feb 14 13:08:00 2017 +0000 Add -fspec-constr-keen I dicovered that the dramatic imprvoement in perf/should_run/T9339 with the introduction of join points was really rather a fluke, and very fragile. The real problem (see Note [Making SpecConstr keener]) is that SpecConstr wasn't specialising a function even though it was applied to a freshly-allocated constructor. The paper describes plausible reasons for this, but I think it may well be better to be a bit more aggressive. So this patch add -fspec-constr-keen, which makes SpecConstr a bit keener to specialise, by ignoring whether or not the argument corresponding to a call pattern is scrutinised in the function body. Now the gains in T9339 should be robust; and it might even be a better default. I'd be interested in what happens if we switched on -fspec-constr-keen with -O2. >--------------------------------------------------------------- 607a735dfb99bb8f0edf466ccb01e732218c42ec compiler/main/DynFlags.hs | 2 ++ compiler/specialise/SpecConstr.hs | 57 +++++++++++++++++++++++++++++---- docs/users_guide/using-optimisation.rst | 12 ++++++- testsuite/tests/perf/should_run/all.T | 4 ++- 4 files changed, 66 insertions(+), 9 deletions(-) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index e04d408..15da91a 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -432,6 +432,7 @@ data GeneralFlag | Opt_StgCSE | Opt_LiberateCase | Opt_SpecConstr + | Opt_SpecConstrKeen | Opt_DoLambdaEtaExpansion | Opt_IgnoreAsserts | Opt_DoEtaReduction @@ -3680,6 +3681,7 @@ fFlagsDeps = [ (useInstead "enable-rewrite-rules"), flagSpec "shared-implib" Opt_SharedImplib, flagSpec "spec-constr" Opt_SpecConstr, + flagSpec "spec-constr-keen" Opt_SpecConstrKeen, flagSpec "specialise" Opt_Specialise, flagSpec "specialize" Opt_Specialise, flagSpec "specialise-aggressively" Opt_SpecialiseAggressively, diff --git a/compiler/specialise/SpecConstr.hs b/compiler/specialise/SpecConstr.hs index 8a3e227..a68955e 100644 --- a/compiler/specialise/SpecConstr.hs +++ b/compiler/specialise/SpecConstr.hs @@ -41,7 +41,8 @@ import VarEnv import VarSet import Name import BasicTypes -import DynFlags ( DynFlags(..), hasPprDebug ) +import DynFlags ( DynFlags(..), GeneralFlag( Opt_SpecConstrKeen ) + , gopt, hasPprDebug ) import Maybes ( orElse, catMaybes, isJust, isNothing ) import Demand import GHC.Serialized ( deserializeWithData ) @@ -447,7 +448,6 @@ breaks an invariant. Note [Forcing specialisation] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - With stream fusion and in other similar cases, we want to fully specialise some (but not necessarily all!) loops regardless of their size and the number of specialisations. @@ -754,6 +754,39 @@ into a work-free value again, thus a'_shr = (a1, x_af7) but that's more work, so until its shown to be important I'm going to leave it for now. + +Note [Making SpecConstr keener] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Consider this, in (perf/should_run/T9339) + last (filter odd [1..1000]) + +After optimisation, including SpecConstr, we get: + f :: Int# -> Int -> Int + f x y = case case remInt# x 2# of + __DEFAULT -> case x of + __DEFAULT -> f (+# wild_Xp 1#) (I# x) + 1000000# -> ... + 0# -> case x of + __DEFAULT -> f (+# wild_Xp 1#) y + 1000000# -> y + +Not good! We build an (I# x) box every time around the loop. +SpecConstr (as described in the paper) does not specialise f, despite +the call (f ... (I# x)) because 'y' is not scrutinied in the body. +But it is much better to specialise f for the case where the argument +is of form (I# x); then we build the box only when returning y, which +is on the cold path. + +Another exmaple: + + f x = ...(g x).... + +Here 'x' is not scrutinised in f's body; but if we did specialise 'f' +then the call (g x) might allow 'g' to be specialised in turn. + +So sc_keen controls whether or not we take account of whether argument is +scrutinised in the body. True <=> ignore that, and speicalise whenever +the function is applied to a data constructor. -} data ScEnv = SCE { sc_dflags :: DynFlags, @@ -765,6 +798,11 @@ data ScEnv = SCE { sc_dflags :: DynFlags, sc_recursive :: Int, -- Max # of specialisations over recursive type. -- Stops ForceSpecConstr from diverging. + sc_keen :: Bool, -- Specialise on arguments that are known + -- constructorss, even if they are not + -- scrutinised in the body. See + -- Note [Making SpecConstr keener] + sc_force :: Bool, -- Force specialisation? -- See Note [Forcing specialisation] @@ -807,6 +845,7 @@ initScEnv dflags this_mod anns sc_size = specConstrThreshold dflags, sc_count = specConstrCount dflags, sc_recursive = specConstrRecursive dflags, + sc_keen = gopt Opt_SpecConstrKeen dflags, sc_force = False, sc_subst = emptySubst, sc_how_bound = emptyVarEnv, @@ -1976,11 +2015,12 @@ argToPat env in_scope val_env arg arg_occ mkConApp dc (ty_args ++ args')) } where mb_scrut dc = case arg_occ of - ScrutOcc bs - | Just occs <- lookupUFM bs dc - -> Just (occs) -- See Note [Reboxing] - _other | sc_force env -> Just (repeat UnkOcc) - | otherwise -> Nothing + ScrutOcc bs | Just occs <- lookupUFM bs dc + -> Just (occs) -- See Note [Reboxing] + _other | sc_force env || sc_keen env + -> Just (repeat UnkOcc) + | otherwise + -> Nothing -- Check if the argument is a variable that -- (a) is used in an interesting way in the function body @@ -1989,6 +2029,9 @@ argToPat env in_scope val_env arg arg_occ argToPat env in_scope val_env (Var v) arg_occ | sc_force env || case arg_occ of { UnkOcc -> False; _other -> True }, -- (a) is_value, -- (b) + -- Ignoring sc_keen here to avoid gratuitously incurring Note [Reboxing] + -- So sc_keen focused just on f (I# x), where we have freshly-allocated + -- box that we can eliminate in the caller not (ignoreType env (varType v)) = return (True, Var v) where diff --git a/docs/users_guide/using-optimisation.rst b/docs/users_guide/using-optimisation.rst index 9436832..e56c473 100644 --- a/docs/users_guide/using-optimisation.rst +++ b/docs/users_guide/using-optimisation.rst @@ -522,7 +522,7 @@ list. Turn on call-pattern specialisation; see `Call-pattern specialisation for Haskell programs - `__. + `__. This optimisation specializes recursive functions according to their argument "shapes". This is best explained by example so consider: :: @@ -580,6 +580,16 @@ list. body directly, allowing heavy specialisation over the recursive cases. +.. ghc-flag:: -fspec-constr-keen + + :default: off + + If this flag is on, call-patten specialision will specialise a call + ``(f (Just x))`` with an explicit constructor agument, even if the argument + is not scrutinised in the body of the function. This is sometimes + beneficial; e.g. the argument might be given to some other function + that can itself be specialised. + .. ghc-flag:: -fspec-constr-count= :default: 3 diff --git a/testsuite/tests/perf/should_run/all.T b/testsuite/tests/perf/should_run/all.T index 4bd75f7..c70fd44 100644 --- a/testsuite/tests/perf/should_run/all.T +++ b/testsuite/tests/perf/should_run/all.T @@ -455,7 +455,9 @@ test('T9339', # 2016-08-17: 50728 Join points (#12988) only_ways(['normal'])], compile_and_run, - ['-O2']) + ['-O2 -fspec-constr-keen']) + # For the -fspec-constr-keen see Note [Making SpecConstr keener] in SpecConstr + test('T8472', [stats_num_field('bytes allocated', From git at git.haskell.org Fri Feb 17 16:28:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Feb 2017 16:28:08 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline: Occurrence-analyse the result of rule firings (b49ed1f) Message-ID: <20170217162808.D2AA03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline Link : http://ghc.haskell.org/trac/ghc/changeset/b49ed1f0102f93ca7f62632c436b41bd240b501f/ghc >--------------------------------------------------------------- commit b49ed1f0102f93ca7f62632c436b41bd240b501f Author: Simon Peyton Jones Date: Tue Feb 14 13:29:40 2017 +0000 Occurrence-analyse the result of rule firings When studying simplCore/should_compile/T7785 I found that a long chain of maps map f (map f (map f (map f (...)))) took an unreasonably long time to simplify. The problem got worse when I started inlining in the InitialPhase, which is how I stumbled on it. The solution turned out to be rather simple. It's described in Note [Occurence-analyse after rule firing] in Simplify.hs >--------------------------------------------------------------- b49ed1f0102f93ca7f62632c436b41bd240b501f compiler/simplCore/Simplify.hs | 68 ++++++++++++++++++++++++++++++++++++++++-- compiler/specialise/Rules.hs | 9 ++---- 2 files changed, 68 insertions(+), 9 deletions(-) diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index 2ad080d..1974d3b 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -15,6 +15,7 @@ import SimplMonad import Type hiding ( substTy, substTyVar, extendTvSubst, extendCvSubst ) import SimplEnv import SimplUtils +import OccurAnal ( occurAnalyseExpr ) import FamInstEnv ( FamInstEnv ) import Literal ( litIsLifted ) --, mkMachInt ) -- temporalily commented out. See #8326 import Id @@ -1803,9 +1804,13 @@ tryRules env rules fn args call_cont ; let cont' = pushSimplifiedArgs env (drop (ruleArity rule) args) call_cont - -- (ruleArity rule) says how many args the rule consumed + -- (ruleArity rule) says how + -- many args the rule consumed + + occ_anald_rhs = occurAnalyseExpr rule_rhs + -- See Note [Occurence-analyse after rule firing] ; dump dflags rule rule_rhs - ; return (Just (rule_rhs, cont')) }}} + ; return (Just (occ_anald_rhs, cont')) }}} where dump dflags rule rule_rhs | dopt Opt_D_dump_rule_rewrites dflags @@ -1836,7 +1841,64 @@ tryRules env rules fn args call_cont = liftIO . dumpSDoc dflags alwaysQualify flag "" $ sep [text hdr, nest 4 details] -{- +{- Note [Occurence-analyse after rule firing] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +After firing a rule, we occurrence-analyse the instantiated RHS before +simplifying it. Usually this doesn't make much difference, but it can +be huge. Here's an example (simplCore/should_compile/T7785) + + map f (map f (map f xs) + += -- Use build/fold form of map, twice + map f (build (\cn. foldr (mapFB c f) n + (build (\cn. foldr (mapFB c f) n xs)))) + += -- Apply fold/build rule + map f (build (\cn. (\cn. foldr (mapFB c f) n xs) (mapFB c f) n)) + += -- Beta-reduce + -- Alas we have no occurrence-analysed, so we don't know + -- that c is used exactly once + map f (build (\cn. let c1 = mapFB c f in + foldr (mapFB c1 f) n xs)) + += -- Use mapFB rule: mapFB (mapFB c f) g = mapFB c (f.g) + -- We can do this becuase (mapFB c n) is a PAP and hence expandable + map f (build (\cn. let c1 = mapFB c n in + foldr (mapFB c (f.f)) n x)) + +This is not too bad. But now do the same with the outer map, and +we get another use of mapFB, and t can interact with /both/ remaining +mapFB calls in the above expression. This is stupid because actually +that 'c1' binding is dead. The outer map introduces another c2. If +there is a deep stack of maps we get lots of dead bindings, and lots +of redundant work as we repeatedly simplify the result of firing rules. + +The easy thing to do is simply to occurrence analyse the result of +the rule firing. Not that this occ-anals not only the RHS of the +rule, but also the function arguments, which by now are OutExprs. +E.g. + RULE f (g x) = x+1 + +Call f (g BIG) --> (\x. x+1) BIG + +The rule binders are lambda-bound and applied to the OutExpr arguments +(here BIG) which lack all internal occurrence info. + +Is this inefficient? Not really: we are about to walk over the result +of the rule firing to simplify it, so occurrence analysis is at most +a constant factor. + +Possible improvement: occ-anal the rules when putting them in the +database; and in the simplifier just occ-anal the OutExpr arguments. +But that's more complicated and the rule RHS is usually tiny; so I'm +just doing the simple thing. + +Historical note: previously we did occ-anal the rules in Rule.hs, +but failed to occ-anal the OutExpr arguments, which led to the +nasty performance problem described above. + + Note [Optimising tagToEnum#] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If we have an enumeration data type: diff --git a/compiler/specialise/Rules.hs b/compiler/specialise/Rules.hs index 1681041..0bd9166 100644 --- a/compiler/specialise/Rules.hs +++ b/compiler/specialise/Rules.hs @@ -31,7 +31,6 @@ module Rules ( import CoreSyn -- All of it import Module ( Module, ModuleSet, elemModuleSet ) import CoreSubst -import OccurAnal ( occurAnalyseExpr ) import CoreFVs ( exprFreeVars, exprsFreeVars, bindFreeVars , rulesFreeVarsDSet, exprsOrphNames, exprFreeVarsList ) import CoreUtils ( exprType, eqExpr, mkTick, mkTicks, @@ -172,7 +171,7 @@ mkRule :: Module -> Bool -> Bool -> RuleName -> Activation mkRule this_mod is_auto is_local name act fn bndrs args rhs = Rule { ru_name = name, ru_fn = fn, ru_act = act, ru_bndrs = bndrs, ru_args = args, - ru_rhs = occurAnalyseExpr rhs, + ru_rhs = rhs, ru_rough = roughTopNames args, ru_origin = this_mod, ru_orphan = orph, @@ -508,8 +507,7 @@ matchRule dflags rule_env _is_active fn args _rough_args -- Built-in rules can't be switched off, it seems = case match_fn dflags rule_env fn args of Nothing -> Nothing - Just expr -> Just (occurAnalyseExpr expr) - -- We could do this when putting things into the rulebase, I guess + Just expr -> Just expr matchRule _ in_scope is_active _ args rough_args (Rule { ru_name = rule_name, ru_act = act, ru_rough = tpl_tops @@ -522,8 +520,7 @@ matchRule _ in_scope is_active _ args rough_args Just (bind_wrapper, tpl_vals) -> Just (bind_wrapper $ rule_fn `mkApps` tpl_vals) where - rule_fn = occurAnalyseExpr (mkLams tpl_vars rhs) - -- We could do this when putting things into the rulebase, I guess + rule_fn = mkLams tpl_vars rhs --------------------------------------- matchN :: InScopeEnv From git at git.haskell.org Fri Feb 17 16:28:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Feb 2017 16:28:11 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline: Stop uniques ending up in SPEC rule names (c767ae5) Message-ID: <20170217162811.8E99B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline Link : http://ghc.haskell.org/trac/ghc/changeset/c767ae5f04a09ef71dcb8f67a17225a52c2cc5d2/ghc >--------------------------------------------------------------- commit c767ae5f04a09ef71dcb8f67a17225a52c2cc5d2 Author: Simon Peyton Jones Date: Tue Feb 14 13:33:36 2017 +0000 Stop uniques ending up in SPEC rule names >--------------------------------------------------------------- c767ae5f04a09ef71dcb8f67a17225a52c2cc5d2 compiler/specialise/Specialise.hs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/compiler/specialise/Specialise.hs b/compiler/specialise/Specialise.hs index 0090417..3f937c2 100644 --- a/compiler/specialise/Specialise.hs +++ b/compiler/specialise/Specialise.hs @@ -1293,10 +1293,11 @@ specCalls mb_mod env rules_for_me calls_for_me fn rhs Just this_mod -- Specialising imoprted fn -> text "SPEC/" <> ppr this_mod - rule_name = mkFastString $ showSDocForUser dflags neverQualify $ - herald <+> ppr fn <+> hsep (map ppr_call_key_ty call_ts) - -- This name ends up in interface files, so use showSDocForUser, - -- otherwise uniques end up there, making builds + rule_name = mkFastString $ showSDoc dflags $ + herald <+> text (occNameString (getOccName fn)) + <+> hsep (map ppr_call_key_ty call_ts) + -- This name ends up in interface files, so use occNameString. + -- Otherwise uniques end up there, making builds -- less deterministic (See #4012 comment:61 ff) rule_wout_eta = mkRule From git at git.haskell.org Fri Feb 17 16:28:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Feb 2017 16:28:14 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline: Make Specialise work with casts (b868de5) Message-ID: <20170217162814.482EC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline Link : http://ghc.haskell.org/trac/ghc/changeset/b868de53dd19f639c1070089ecff21948ff33e0d/ghc >--------------------------------------------------------------- commit b868de53dd19f639c1070089ecff21948ff33e0d Author: Simon Peyton Jones Date: Tue Feb 14 13:47:13 2017 +0000 Make Specialise work with casts With my upcoming early-inlining patch it turned out that Specialise was getting stuck on casts. This patch fixes it; see Specialise [Account for casts in binding]. >--------------------------------------------------------------- b868de53dd19f639c1070089ecff21948ff33e0d compiler/coreSyn/CoreSubst.hs | 49 +++++++++++++++++++++++++++++++++++++-- compiler/specialise/Specialise.hs | 35 +++++++++++++++++++++------- 2 files changed, 73 insertions(+), 11 deletions(-) diff --git a/compiler/coreSyn/CoreSubst.hs b/compiler/coreSyn/CoreSubst.hs index d669569..ea9a0f3 100644 --- a/compiler/coreSyn/CoreSubst.hs +++ b/compiler/coreSyn/CoreSubst.hs @@ -34,7 +34,7 @@ module CoreSubst ( -- ** Simple expression optimiser simpleOptPgm, simpleOptExpr, simpleOptExprWith, exprIsConApp_maybe, exprIsLiteral_maybe, exprIsLambda_maybe, - pushCoArg, pushCoValArg, pushCoTyArg + pushCoArg, pushCoValArg, pushCoTyArg, collectBindersPushingCo ) where #include "HsVersions.h" @@ -1605,7 +1605,7 @@ exprIsLambda_maybe _ _e Here we implement the "push rules" from FC papers: -* The push-argument ules, where we can move a coercion past an argument. +* The push-argument rules, where we can move a coercion past an argument. We have (fun |> co) arg and we want to transform it to @@ -1775,3 +1775,48 @@ pushCoDataCon dc dc_args co where Pair from_ty to_ty = coercionKind co + +collectBindersPushingCo :: CoreExpr -> ([Var], CoreExpr) +-- Collect lambda binders, pushing coercions inside if possible +-- E..g (\x.e) |> g g :: -> blah +-- = (\x. e |> Nth 1 g) +collectBindersPushingCo e + = go [] e + where + go :: [Var] -> CoreExpr -> ([Var], CoreExpr) + -- The accumulator is in reverse order + go bs (Lam b e) = go (b:bs) e + go bs (Cast e co) = go_c bs e co + go bs e = (reverse bs, e) + + go_c :: [Var] -> CoreExpr -> Coercion -> ([Var], CoreExpr) + -- (go_c bs e c) is same as (go bs e (e |> c)) + go_c bs (Cast e co1) co2 = go_c bs e (co1 `mkTransCo` co2) + go_c bs (Lam b e) co = go_lam bs b e co + go_c bs e co = (reverse bs, mkCast e co) + + go_lam :: [Var] -> Var -> CoreExpr -> Coercion -> ([Var], CoreExpr) + -- (go_lam bs b e c) is same as (go_c bs (\b.e) c) + go_lam bs b e co + | isTyVar b + , let Pair tyL tyR = coercionKind co + , ASSERT( isForAllTy tyL ) + isForAllTy tyR + , isReflCo (mkNthCo 0 co) -- See Note [collectBindersPushingCo] + = go_c (b:bs) e (mkInstCo co (mkNomReflCo (mkTyVarTy b))) + + | isId b + , let Pair tyL tyR = coercionKind co + , ASSERT( isFunTy tyL) isFunTy tyR + , isReflCo (mkNthCo 0 co) -- See Note [collectBindersPushingCo] + = go_c (b:bs) e (mkNthCo 1 co) + + | otherwise = (reverse bs, mkCast (Lam b e) co) + +{- Note [collectBindersPushingCo] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +We just look for coercions of form + -> blah +(and similarly for foralls) to keep this function simple. We could do +more elaborate stuff, but it'd involve substitution etc. +-} diff --git a/compiler/specialise/Specialise.hs b/compiler/specialise/Specialise.hs index 3f937c2..fb3c7cc 100644 --- a/compiler/specialise/Specialise.hs +++ b/compiler/specialise/Specialise.hs @@ -1153,8 +1153,8 @@ specCalls :: Maybe Module -- Just this_mod => specialising imported fn specCalls mb_mod env rules_for_me calls_for_me fn rhs -- The first case is the interesting one - | rhs_tyvars `lengthIs` n_tyvars -- Rhs of fn's defn has right number of big lambdas - && rhs_ids `lengthAtLeast` n_dicts -- and enough dict args + | rhs_tyvars `lengthIs` n_tyvars -- Rhs of fn's defn has right number of big lambdas + && rhs_bndrs1 `lengthAtLeast` n_dicts -- and enough dict args && notNull calls_for_me -- And there are some calls to specialise && not (isNeverActive (idInlineActivation fn)) -- Don't specialise NOINLINE things @@ -1178,7 +1178,7 @@ specCalls mb_mod env rules_for_me calls_for_me fn rhs return ([], [], emptyUDs) where _trace_doc = sep [ ppr rhs_tyvars, ppr n_tyvars - , ppr rhs_ids, ppr n_dicts + , ppr rhs_bndrs, ppr n_dicts , ppr (idInlineActivation fn) ] fn_type = idType fn @@ -1194,11 +1194,12 @@ specCalls mb_mod env rules_for_me calls_for_me fn rhs -- Figure out whether the function has an INLINE pragma -- See Note [Inline specialisations] - (rhs_tyvars, rhs_ids, rhs_body) = collectTyAndValBinders rhs - - rhs_dict_ids = take n_dicts rhs_ids - body = mkLams (drop n_dicts rhs_ids) rhs_body - -- Glue back on the non-dict lambdas + (rhs_bndrs, rhs_body) = CoreSubst.collectBindersPushingCo rhs + -- See Note [Account for casts in binding] + (rhs_tyvars, rhs_bndrs1) = span isTyVar rhs_bndrs + (rhs_dict_ids, rhs_bndrs2) = splitAt n_dicts rhs_bndrs1 + body = mkLams rhs_bndrs2 rhs_body + -- Glue back on the non-dict lambdas already_covered :: DynFlags -> [CoreExpr] -> Bool already_covered dflags args -- Note [Specialisations already covered] @@ -1350,7 +1351,23 @@ specCalls mb_mod env rules_for_me calls_for_me fn rhs ; return (Just ((spec_f_w_arity, spec_rhs), final_uds, spec_env_rule)) } } -{- Note [Evidence foralls] +{- Note [Account for casts in binding] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Consider + f :: Eq a => a -> IO () + {-# INLINABLE f + StableUnf = (/\a \(d:Eq a) (x:a). blah) |> g + #-} + f = ... + +In f's stable unfolding we have done some modest simplification which +has pushed the cast to the outside. (I wonder if this is the Right +Thing, but it's what happens now; see SimplUtils Note [Casts and +lambdas].) Now that stable unfolding must be specialised, so we want +to push the cast back inside. It would be terrible if the cast +defeated specialisation! Hence the use of collectBindersPushingCo. + +Note [Evidence foralls] ~~~~~~~~~~~~~~~~~~~~~~~~~~ Suppose (Trac #12212) that we are specialising f :: forall a b. (Num a, F a ~ F b) => blah From git at git.haskell.org Fri Feb 17 16:28:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Feb 2017 16:28:16 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline: Inline data constructor wrappers in phase 2 only (2e077cc) Message-ID: <20170217162816.F2E453A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline Link : http://ghc.haskell.org/trac/ghc/changeset/2e077ccc736a0b2a622b7f42b7929966bddb4ded/ghc >--------------------------------------------------------------- commit 2e077ccc736a0b2a622b7f42b7929966bddb4ded Author: Simon Peyton Jones Date: Tue Feb 14 13:49:13 2017 +0000 Inline data constructor wrappers in phase 2 only This patch prepares for my upcoming early-inlining patch. It arranges that data constructor wrappers are not inlined until Phase 2 (the first of the "normal" phases.) That gives rules a chance to fire in the InitialPhase (aka "gentle"). This has been a bit of a problem for a while, so it's nice to have a fix. It should make no difference immediately, becuase currently nothing is inlined in the InitialPhase anyway. >--------------------------------------------------------------- 2e077ccc736a0b2a622b7f42b7929966bddb4ded compiler/basicTypes/MkId.hs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/compiler/basicTypes/MkId.hs b/compiler/basicTypes/MkId.hs index 65860d9..2b18186 100644 --- a/compiler/basicTypes/MkId.hs +++ b/compiler/basicTypes/MkId.hs @@ -518,7 +518,7 @@ mkDataConRep dflags fam_envs wrap_name mb_bangs data_con `setArityInfo` wrap_arity -- It's important to specify the arity, so that partial -- applications are treated as values - `setInlinePragInfo` alwaysInlinePragma + `setInlinePragInfo` wrap_prag `setUnfoldingInfo` wrap_unf `setStrictnessInfo` wrap_sig -- We need to get the CAF info right here because TidyPgm @@ -527,10 +527,15 @@ mkDataConRep dflags fam_envs wrap_name mb_bangs data_con `setNeverLevPoly` wrap_ty wrap_sig = mkClosedStrictSig wrap_arg_dmds (dataConCPR data_con) + wrap_arg_dmds = map mk_dmd arg_ibangs mk_dmd str | isBanged str = evalDmd | otherwise = topDmd + wrap_prag = alwaysInlinePragma `setInlinePragmaActivation` + ActiveAfter NoSourceText 2 + -- See Note [Activation for data constructor wrappers] + -- The wrapper will usually be inlined (see wrap_unf), so its -- strictness and CPR info is usually irrelevant. But this is -- not always the case; GHC may choose not to inline it. In @@ -620,7 +625,20 @@ mkDataConRep dflags fam_envs wrap_name mb_bangs data_con ; expr <- mk_rep_app prs (mkVarApps con_app rep_ids) ; return (unbox_fn expr) } -{- +{- Note [Activation for data constructor wrappers] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +The Activation on a data constructor wrapper allows it to inline in +Phase 2 and later (1, 0). But not in the InitialPhase. That gives +rewrite rules a chance to fire (in the InitialPhase) if they mention +a data constructor on the left + RULE "foo" f (K a b) = ... +Since the LHS of rules are simplified with InitialPhase, we won't +inline the wrapper on the LHS either. + +People have asked for this before, but now that even the InitialPhase +does some inlining, it has become important. + + Note [Bangs on imported data constructors] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From git at git.haskell.org Fri Feb 17 16:28:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Feb 2017 16:28:19 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline: Combine identical case alterantives in CSE (5041199) Message-ID: <20170217162819.A744C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline Link : http://ghc.haskell.org/trac/ghc/changeset/50411995641802568bb27c867afe804f91e0524c/ghc >--------------------------------------------------------------- commit 50411995641802568bb27c867afe804f91e0524c Author: Simon Peyton Jones Date: Tue Feb 14 13:59:04 2017 +0000 Combine identical case alterantives in CSE See Note [Combine case alternatives] in CSE. This opportunity surfaced when I was was studying early inlining. It's easy (and cheap) to exploit, and sometimes makes a worthwhile saving. >--------------------------------------------------------------- 50411995641802568bb27c867afe804f91e0524c compiler/simplCore/CSE.hs | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/compiler/simplCore/CSE.hs b/compiler/simplCore/CSE.hs index 80013a3..31532af 100644 --- a/compiler/simplCore/CSE.hs +++ b/compiler/simplCore/CSE.hs @@ -392,7 +392,8 @@ cseExpr env (Case e bndr ty alts) = cseCase env e bndr ty alts cseCase :: CSEnv -> InExpr -> InId -> InType -> [InAlt] -> OutExpr cseCase env scrut bndr ty alts - = Case scrut1 bndr3 ty' (map cse_alt alts) + = Case scrut1 bndr3 ty' $ + combineAlts alt_env (map cse_alt alts) where ty' = substTy (csEnvSubst env) ty scrut1 = tryForCSE False env scrut @@ -429,7 +430,43 @@ cseCase env scrut bndr ty alts where (env', args') = addBinders alt_env args -{- +combineAlts :: CSEnv -> [InAlt] -> [InAlt] +-- See Note [Combine case alternatives] +combineAlts env ((_,bndrs1,rhs1) : rest_alts) + | all isDeadBinder bndrs1 + , LT <- filtered_alts `compareLength` rest_alts + = (DEFAULT, [], rhs1) : filtered_alts + where + in_scope = substInScope (csEnvSubst env) + filtered_alts = filterOut identical rest_alts + identical (_con, bndrs, rhs) = all ok bndrs && eqExpr in_scope rhs1 rhs + ok bndr = isDeadBinder bndr || not (bndr `elemInScopeSet` in_scope) + +combineAlts _ alts = alts -- Default case + +{- Note [Combine case alternatives] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +combineCaseAlts is just a more heavyweight version of the use of +combineIdentialAlts in SimplUtils.prepareAlts. The basic idea is +to transform + + DEFAULT -> e1 + K x -> e1 + W y z -> e2 +===> + DEFAULT -> e1 + W y z -> e2 + +In the simplifier we use cheapEqExpr, because it is called a lot. +But here in CSE we use the full eqExpr. After all, two alterantives usually +differ near the root, so it probably isn't expensive to compare the full +alternative. It seems like the the same kind of thing that CSE is supposed +to be doing, which is why I put it here. + +I acutally saw some examples in the wild, where some inlining made e1 too +big for cheapEqExpr to catch it. + + ************************************************************************ * * \section{The CSE envt} From git at git.haskell.org Fri Feb 17 16:28:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Feb 2017 16:28:25 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline: Fix SetLevels for makeStaticPtr (bfc6fa3) Message-ID: <20170217162825.14C613A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline Link : http://ghc.haskell.org/trac/ghc/changeset/bfc6fa3f377d11bdfcdbf82b65bf2f39cb00b90c/ghc >--------------------------------------------------------------- commit bfc6fa3f377d11bdfcdbf82b65bf2f39cb00b90c Author: Simon Peyton Jones Date: Tue Feb 14 14:13:16 2017 +0000 Fix SetLevels for makeStaticPtr This too is prepartory for my early-inlining patch. It turned out that early inlining exposed a bug in the way that static pointers were being floated. >--------------------------------------------------------------- bfc6fa3f377d11bdfcdbf82b65bf2f39cb00b90c compiler/simplCore/SetLevels.hs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/compiler/simplCore/SetLevels.hs b/compiler/simplCore/SetLevels.hs index 4fca18d..f681bf3 100644 --- a/compiler/simplCore/SetLevels.hs +++ b/compiler/simplCore/SetLevels.hs @@ -566,12 +566,12 @@ lvlMFE env strict_ctxt ann_expr -- or if we are wrapping it in one or more value lambdas = do { expr1 <- lvlFloatRhs abs_vars dest_lvl rhs_env NonRecursive join_arity_maybe ann_expr -- Treat the expr just like a right-hand side - ; var <- newLvlVar expr1 join_arity_maybe + ; var <- newLvlVar expr1 join_arity_maybe is_mk_static ; let var2 = annotateBotStr var float_n_lams mb_bot_str ; return (Let (NonRec (TB var2 (FloatMe dest_lvl)) expr1) (mkVarApps (Var var2) abs_vars)) } - -- OK, so the float has an unlifted type + -- OK, so the float has an unlifted type (not top-level bindable) -- and no new value lambdas (float_is_new_lam is False) -- Try for the boxing strategy -- See Note [Floating MFEs of unlifted type] @@ -588,7 +588,7 @@ lvlMFE env strict_ctxt ann_expr Case expr1 (stayPut l1r ubx_bndr) dc_res_ty [(DEFAULT, [], mkConApp dc [Var ubx_bndr])] - ; var <- newLvlVar float_rhs Nothing + ; var <- newLvlVar float_rhs Nothing is_mk_static ; let l1u = incMinorLvlFrom env use_expr = Case (mkVarApps (Var var) abs_vars) (stayPut l1u bx_bndr) expr_ty @@ -626,9 +626,12 @@ lvlMFE env strict_ctxt ann_expr join_arity_maybe | need_join = Just (length abs_vars) | otherwise = Nothing + is_mk_static = isJust (collectMakeStaticArgs expr) + -- Yuk: See Note [Grand plan for static forms] in main/StaticPtrTable + -- A decision to float entails let-binding this thing, and we only do -- that if we'll escape a value lambda, or will go to the top level. - float_me = saves_work || saves_alloc + float_me = saves_work || saves_alloc || is_mk_static -- We can save work if we can move a redex outside a value lambda -- But if float_is_new_lam is True, then the redex is wrapped in a @@ -1503,8 +1506,9 @@ newPolyBndrs dest_lvl newLvlVar :: LevelledExpr -- The RHS of the new binding -> Maybe JoinArity -- Its join arity, if it is a join point + -> Bool -- True <=> the RHS looks like (makeStatic ...) -> LvlM Id -newLvlVar lvld_rhs join_arity_maybe +newLvlVar lvld_rhs join_arity_maybe is_mk_static = do { uniq <- getUniqueM ; return (add_join_info (mk_id uniq rhs_ty)) } @@ -1515,8 +1519,7 @@ newLvlVar lvld_rhs join_arity_maybe mk_id uniq rhs_ty -- See Note [Grand plan for static forms] in StaticPtrTable. - | isJust $ collectMakeStaticArgs $ snd $ - collectTyBinders de_tagged_rhs + | is_mk_static = mkExportedVanillaId (mkSystemVarName uniq (mkFastString "static_ptr")) rhs_ty | otherwise From git at git.haskell.org Fri Feb 17 16:28:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Feb 2017 16:28:22 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline: Extend CSE to handle recursive bindings (8b1cfea) Message-ID: <20170217162822.638203A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline Link : http://ghc.haskell.org/trac/ghc/changeset/8b1cfea089faacb5b95ffcc3511e05faeabb8076/ghc >--------------------------------------------------------------- commit 8b1cfea089faacb5b95ffcc3511e05faeabb8076 Author: Simon Peyton Jones Date: Tue Feb 14 14:07:39 2017 +0000 Extend CSE to handle recursive bindings I came across a program with two identical recursive bindings, so I wondered if they could be CSE'd. It turned out to be pretty easy so I did it. See Note [CSE for recursive bindings] in CSE >--------------------------------------------------------------- 8b1cfea089faacb5b95ffcc3511e05faeabb8076 compiler/simplCore/CSE.hs | 92 ++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 76 insertions(+), 16 deletions(-) diff --git a/compiler/simplCore/CSE.hs b/compiler/simplCore/CSE.hs index 31532af..012607a 100644 --- a/compiler/simplCore/CSE.hs +++ b/compiler/simplCore/CSE.hs @@ -12,16 +12,18 @@ module CSE (cseProgram, cseOneExpr) where import CoreSubst import Var ( Var, isJoinId ) -import Id ( Id, idType, idUnfolding, idInlineActivation - , zapIdOccInfo, zapIdUsageInfo ) -import CoreUtils ( mkAltExpr +import VarEnv ( elemInScopeSet ) +import Id ( Id, idType, idInlineActivation, isDeadBinder + , zapIdOccInfo, zapIdUsageInfo, idInlinePragma ) +import CoreUtils ( mkAltExpr, eqExpr , exprIsLiteralString , stripTicksE, stripTicksT, mkTicks ) import Literal ( litIsTrivial ) import Type ( tyConAppArgs ) import CoreSyn import Outputable -import BasicTypes ( isAlwaysActive ) +import Util ( compareLength, filterOut ) +import BasicTypes ( isAlwaysActive, isAnyInlinePragma ) import TrieMap import Data.List ( mapAccumL ) @@ -258,6 +260,27 @@ We could try and be careful by tracking which join points are still valid at each subexpression, but since join points aren't allocated or shared, there's less to gain by trying to CSE them. +Note [CSE for recursive bindings] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Consider + f = \x ... f.... + g = \y ... g ... +where the "..." are identical. Could we CSE them? In full generality +with mutual recursion it's quite hard; but for self-recursive bindings +(which are very common) it's rather easy: + +* Maintain a separate cs_rec_map, that maps + (\f. (\x. ...f...) ) -> f + Note the \f in the domain of the mapping! + +* When we come across the binding for 'g', look up (\g. (\y. ...g...)) + Bingo we get a hit. So we can repace the 'g' binding with + g = f + +We can't use cs_map for this, because the key isn't an expression of +the program; it's a kind of synthetic key for recursive bindings. + + ************************************************************************ * * \section{Common subexpression} @@ -276,6 +299,26 @@ cseBind toplevel env (NonRec b e) (env1, b1) = addBinder env b (env2, b2) = addBinding env1 b b1 e1 +cseBind _ env (Rec [(in_id, rhs)]) + | noCSE in_id + = (env1, Rec [(out_id, rhs')]) + + -- See Note [CSE for recursive bindings] + | Just previous <- lookupCSRecEnv env out_id rhs'' + , let previous' = mkTicks ticks previous + = (extendCSSubst env1 in_id previous', NonRec out_id previous') + + | otherwise + = (extendCSRecEnv env1 out_id rhs'' id_expr', Rec [(zapped_id, rhs')]) + + where + (env1, [out_id]) = addRecBinders env [in_id] + rhs' = cseExpr env1 rhs + rhs'' = stripTicksE tickishFloatable rhs' + ticks = stripTicksT tickishFloatable rhs' + id_expr' = varToCoreExpr out_id + zapped_id = zapIdUsageInfo out_id + cseBind toplevel env (Rec pairs) = (env2, Rec pairs') where @@ -296,9 +339,9 @@ addBinding :: CSEnv -- Includes InId->OutId cloning -- Extend the CSE env with a mapping [rhs -> out-id] -- unless we can instead just substitute [in-id -> rhs] addBinding env in_id out_id rhs' - | no_cse = (env, out_id) - | use_subst = (extendCSSubst env in_id rhs', out_id) - | otherwise = (extendCSEnv env rhs' id_expr', zapped_id) + | noCSE in_id = (env, out_id) + | use_subst = (extendCSSubst env in_id rhs', out_id) + | otherwise = (extendCSEnv env rhs' id_expr', zapped_id) where id_expr' = varToCoreExpr out_id zapped_id = zapIdUsageInfo out_id @@ -312,13 +355,6 @@ addBinding env in_id out_id rhs' -- it is bad for performance if you don't do late demand -- analysis - no_cse = not (isAlwaysActive (idInlineActivation out_id)) - -- See Note [CSE for INLINE and NOINLINE] - || isStableUnfolding (idUnfolding out_id) - -- See Note [CSE for stable unfoldings] - || isJoinId in_id - -- See Note [CSE for join points?] - -- Should we use SUBSTITUTE or EXTEND? -- See Note [CSE for bindings] use_subst = case rhs' of @@ -326,6 +362,16 @@ addBinding env in_id out_id rhs' Lit l -> litIsTrivial l _ -> False +noCSE :: InId -> Bool +noCSE id = not (isAlwaysActive (idInlineActivation id)) + -- See Note [CSE for INLINE and NOINLINE] + || isAnyInlinePragma (idInlinePragma id) + --isStableUnfolding (idUnfolding id) + -- See Note [CSE for stable unfoldings] + || isJoinId id + -- See Note [CSE for join points?] + + {- Note [Take care with literal strings] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -373,7 +419,7 @@ tryForCSE toplevel env expr -- top of the replaced sub-expression. This is probably not too -- useful in practice, but upholds our semantics. -cseOneExpr :: CoreExpr -> CoreExpr +cseOneExpr :: InExpr -> OutExpr cseOneExpr = cseExpr emptyCSEnv cseExpr :: CSEnv -> InExpr -> OutExpr @@ -482,10 +528,14 @@ data CSEnv , cs_map :: CoreMap OutExpr -- The reverse mapping -- Maps a OutExpr to a /trivial/ OutExpr -- The key of cs_map is stripped of all Ticks + + , cs_rec_map :: CoreMap OutExpr + -- See Note [CSE for recursive bindings] } emptyCSEnv :: CSEnv -emptyCSEnv = CS { cs_map = emptyCoreMap, cs_subst = emptySubst } +emptyCSEnv = CS { cs_map = emptyCoreMap, cs_rec_map = emptyCoreMap + , cs_subst = emptySubst } lookupCSEnv :: CSEnv -> OutExpr -> Maybe OutExpr lookupCSEnv (CS { cs_map = csmap }) expr @@ -497,6 +547,16 @@ extendCSEnv cse expr triv_expr where sexpr = stripTicksE tickishFloatable expr +extendCSRecEnv :: CSEnv -> OutId -> OutExpr -> OutExpr -> CSEnv +-- See Note [CSE for recursive bindings] +extendCSRecEnv cse bndr expr triv_expr + = cse { cs_rec_map = extendCoreMap (cs_map cse) (Lam bndr expr) triv_expr } + +lookupCSRecEnv :: CSEnv -> OutId -> OutExpr -> Maybe OutExpr +-- See Note [CSE for recursive bindings] +lookupCSRecEnv (CS { cs_rec_map = csmap }) bndr expr + = lookupCoreMap csmap (Lam bndr expr) + csEnvSubst :: CSEnv -> Subst csEnvSubst = cs_subst From git at git.haskell.org Fri Feb 17 16:28:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Feb 2017 16:28:30 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline: The Early Inline Patch (912e71e) Message-ID: <20170217162830.8028E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline Link : http://ghc.haskell.org/trac/ghc/changeset/912e71eb3b4ec91e805ecf2236d1033e55e2933a/ghc >--------------------------------------------------------------- commit 912e71eb3b4ec91e805ecf2236d1033e55e2933a Author: Simon Peyton Jones Date: Tue Feb 14 15:08:24 2017 +0000 The Early Inline Patch This very small patch switches on sm_inline even in the InitialPhase (aka "gentle" phase). There is no reason not to... and the results are astonishing. I think the peformance of GHC itself improves by about 5%; and some programs get much smaller, quicker. Result: across the board irmprovements in compile time performance. Here are the changes in perf/compiler; the numbers are decreases in compiler bytes-allocated: 3% T5837 7% parsing001 9% T12234 35% T9020 9% T3064 13% T9961 20% T13056 5% T9872d 5% T9872c 5% T9872b 7% T9872a 5% T783 35% T12227 20% T1969 Plus in perf/should_run 5% lazy-bs-alloc It wasn't as easy as it sounds: I did a raft of preparatory work in earlier patches. But it's great! >--------------------------------------------------------------- 912e71eb3b4ec91e805ecf2236d1033e55e2933a compiler/simplCore/SimplCore.hs | 40 ++++++++-- compiler/simplCore/SimplUtils.hs | 60 ++++++--------- .../tests/deSugar/should_compile/T2431.stderr | 2 +- .../indexed-types/should_compile/T7837.stderr | 3 +- .../tests/numeric/should_compile/T7116.stdout | 16 ++-- testsuite/tests/perf/compiler/T4007.stdout | 8 +- testsuite/tests/perf/compiler/all.T | 52 +++++++++---- testsuite/tests/perf/should_run/all.T | 2 + testsuite/tests/simplCore/should_compile/Makefile | 11 ++- testsuite/tests/simplCore/should_compile/T10181.hs | 5 ++ .../tests/simplCore/should_compile/T3234.stderr | 13 ++-- .../tests/simplCore/should_compile/T3772.stdout | 88 +++++++++++----------- .../tests/simplCore/should_compile/T4138.stdout | 2 +- .../tests/simplCore/should_compile/T7360.stderr | 2 +- testsuite/tests/simplCore/should_compile/T7785.hs | 14 +++- testsuite/tests/simplCore/should_compile/T8848.hs | 13 +++- .../tests/simplCore/should_compile/T9509.stdout | 1 + testsuite/tests/simplCore/should_compile/T9509a.hs | 4 +- testsuite/tests/simplCore/should_compile/all.T | 6 +- .../tests/simplCore/should_compile/rule2.stderr | 13 ++-- testsuite/tests/simplCore/should_run/T7611.hs | 1 + .../tests/simplCore/should_run/simplrun002.hs | 8 +- .../tests/simplCore/should_run/simplrun008.hs | 6 +- 23 files changed, 218 insertions(+), 152 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 912e71eb3b4ec91e805ecf2236d1033e55e2933a From git at git.haskell.org Fri Feb 17 16:28:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Feb 2017 16:28:27 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline: Small changes to expression sizing in CoreUnfold (7188cd1) Message-ID: <20170217162827.C42B23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline Link : http://ghc.haskell.org/trac/ghc/changeset/7188cd13f8e54efa764d52ca016b87b3669b29f5/ghc >--------------------------------------------------------------- commit 7188cd13f8e54efa764d52ca016b87b3669b29f5 Author: Simon Peyton Jones Date: Tue Feb 14 14:15:01 2017 +0000 Small changes to expression sizing in CoreUnfold The only significant change here is that case e of {} should be treated like 'e', rather than like a case expression. We don't push a return address, for example, since 'e' is sure to diverge. I forget why I did this; but it will make these empty-case expressions (which are only there to satisfy the type checker) cost-free. >--------------------------------------------------------------- 7188cd13f8e54efa764d52ca016b87b3669b29f5 compiler/coreSyn/CoreUnfold.hs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/compiler/coreSyn/CoreUnfold.hs b/compiler/coreSyn/CoreUnfold.hs index 71c5f0f..3b12234 100644 --- a/compiler/coreSyn/CoreUnfold.hs +++ b/compiler/coreSyn/CoreUnfold.hs @@ -534,6 +534,11 @@ sizeExpr dflags bOMB_OUT_SIZE top_args expr pairs size_up (Case e _ _ alts) + | null alts + = size_up e -- case e of {} never returns, so take size of scrutinee + + size_up (Case e _ _ alts) + -- Now alts is non-empty | Just v <- is_top_arg e -- We are scrutinising an argument variable = let alt_sizes = map size_up_alt alts @@ -558,8 +563,8 @@ sizeExpr dflags bOMB_OUT_SIZE top_args expr alts_size tot_size _ = tot_size in - alts_size (foldr addAltSize sizeZero alt_sizes) - (foldr maxSize sizeZero alt_sizes) + alts_size (foldr1 addAltSize alt_sizes) -- alts is non-empty + (foldr1 maxSize alt_sizes) -- Good to inline if an arg is scrutinised, because -- that may eliminate allocation in the caller -- And it eliminates the case itself @@ -763,6 +768,7 @@ funSize dflags top_args fun n_val_args voids res_discount | idArity fun > n_val_args = ufFunAppDiscount dflags | otherwise = 0 -- If the function is partially applied, show a result discount +-- XXX maybe behave like ConSize for eval'd varaible conSize :: DataCon -> Int -> ExprSize conSize dc n_val_args @@ -774,6 +780,8 @@ conSize dc n_val_args -- See Note [Constructor size and result discount] | otherwise = SizeIs 10 emptyBag (10 * (1 + n_val_args)) +-- XXX still looks to large to me + {- Note [Constructor size and result discount] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From git at git.haskell.org Fri Feb 17 16:28:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Feb 2017 16:28:33 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline: Add VarSet.anyDVarSet, allDVarSet (3f346ea) Message-ID: <20170217162833.36EF23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline Link : http://ghc.haskell.org/trac/ghc/changeset/3f346eac06399a79adf48425018ee949cee245bf/ghc >--------------------------------------------------------------- commit 3f346eac06399a79adf48425018ee949cee245bf Author: Simon Peyton Jones Date: Fri Feb 17 12:17:08 2017 +0000 Add VarSet.anyDVarSet, allDVarSet I need these in a later commit. Also rename varSetAny --> anyVarSet varSetAll --> allVarSet for consistency with other functions; eg filterVarSet >--------------------------------------------------------------- 3f346eac06399a79adf48425018ee949cee245bf compiler/basicTypes/VarSet.hs | 18 ++++++++++++------ compiler/specialise/Rules.hs | 2 +- compiler/typecheck/TcType.hs | 2 +- compiler/types/Unify.hs | 4 ++-- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/compiler/basicTypes/VarSet.hs b/compiler/basicTypes/VarSet.hs index a6e508a..a95e369 100644 --- a/compiler/basicTypes/VarSet.hs +++ b/compiler/basicTypes/VarSet.hs @@ -17,7 +17,7 @@ module VarSet ( intersectVarSet, intersectsVarSet, disjointVarSet, isEmptyVarSet, delVarSet, delVarSetList, delVarSetByKey, minusVarSet, filterVarSet, - varSetAny, varSetAll, + anyVarSet, allVarSet, transCloVarSet, fixVarSet, lookupVarSet, lookupVarSetByName, sizeVarSet, seqVarSet, @@ -35,7 +35,7 @@ module VarSet ( intersectDVarSet, intersectsDVarSet, disjointDVarSet, isEmptyDVarSet, delDVarSet, delDVarSetList, minusDVarSet, foldDVarSet, filterDVarSet, - dVarSetMinusVarSet, + dVarSetMinusVarSet, anyDVarSet, allDVarSet, transCloDVarSet, sizeDVarSet, seqDVarSet, partitionDVarSet, @@ -139,11 +139,11 @@ 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 +anyVarSet :: (Var -> Bool) -> VarSet -> Bool +anyVarSet = uniqSetAny -varSetAll :: (Var -> Bool) -> VarSet -> Bool -varSetAll = uniqSetAll +allVarSet :: (Var -> Bool) -> VarSet -> Bool +allVarSet = uniqSetAll -- There used to exist mapVarSet, see Note [Unsound mapUniqSet] in UniqSet for -- why it got removed. @@ -282,6 +282,12 @@ dVarSetMinusVarSet = uniqDSetMinusUniqSet foldDVarSet :: (Var -> a -> a) -> a -> DVarSet -> a foldDVarSet = foldUniqDSet +anyDVarSet :: (Var -> Bool) -> DVarSet -> Bool +anyDVarSet p = foldDVarSet ((||) . p) False + +allDVarSet :: (Var -> Bool) -> DVarSet -> Bool +allDVarSet p = foldDVarSet ((&&) . p) True + filterDVarSet :: (Var -> Bool) -> DVarSet -> DVarSet filterDVarSet = filterUniqDSet diff --git a/compiler/specialise/Rules.hs b/compiler/specialise/Rules.hs index 0bd9166..e95c5ff 100644 --- a/compiler/specialise/Rules.hs +++ b/compiler/specialise/Rules.hs @@ -858,7 +858,7 @@ match_alts _ _ _ _ ------------------------------------------ okToFloat :: RnEnv2 -> VarSet -> Bool okToFloat rn_env bind_fvs - = varSetAll not_captured bind_fvs + = allVarSet not_captured bind_fvs where not_captured fv = not (inRnEnvR rn_env fv) diff --git a/compiler/typecheck/TcType.hs b/compiler/typecheck/TcType.hs index a0ca0b2..97e5e15 100644 --- a/compiler/typecheck/TcType.hs +++ b/compiler/typecheck/TcType.hs @@ -909,7 +909,7 @@ anyRewritableTyVar ignore_cos pred ty go_co bound co | ignore_cos = False - | otherwise = varSetAny (go_tv bound) (tyCoVarsOfCo co) + | otherwise = anyVarSet (go_tv bound) (tyCoVarsOfCo co) -- We don't have an equivalent of anyRewritableTyVar for coercions -- (at least not yet) so take the free vars and test them diff --git a/compiler/types/Unify.hs b/compiler/types/Unify.hs index 0ee895a..6061319 100644 --- a/compiler/types/Unify.hs +++ b/compiler/types/Unify.hs @@ -522,7 +522,7 @@ niFixTCvSubst tenv = f tenv | not_fixpoint = f (mapVarEnv (substTy subst') tenv) | otherwise = subst where - not_fixpoint = varSetAny in_domain range_tvs + not_fixpoint = anyVarSet in_domain range_tvs in_domain tv = tv `elemVarEnv` tenv range_tvs = nonDetFoldUFM (unionVarSet . tyCoVarsOfType) emptyVarSet tenv @@ -1223,7 +1223,7 @@ ty_co_match menv subst ty co lkco rkco = noneSet (\v -> elemVarEnv v env) set noneSet :: (Var -> Bool) -> VarSet -> Bool - noneSet f = varSetAll (not . f) + noneSet f = allVarSet (not . f) ty_co_match menv subst ty co lkco rkco | CastTy ty' co' <- ty From git at git.haskell.org Fri Feb 17 16:28:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Feb 2017 16:28:35 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline: Improve pretty-printing of types (9ffdf62) Message-ID: <20170217162835.EE37D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline Link : http://ghc.haskell.org/trac/ghc/changeset/9ffdf62b0ca72c4f35579f9d6f31a9beebf23025/ghc >--------------------------------------------------------------- commit 9ffdf62b0ca72c4f35579f9d6f31a9beebf23025 Author: Simon Peyton Jones Date: Fri Feb 17 12:30:35 2017 +0000 Improve pretty-printing of types When doing debug-printing it's really important that the free vars of a type are printed with their uniques. The IfaceTcTyVar thing was a stab in that direction, but it only worked for TcTyVars, not TyVars. This patch does it properly, by keeping track of the free vars of the type when translating Type -> IfaceType, and passing that down through toIfaceTypeX. Then when we find a variable, look in that set, and translate it to IfaceFreeTyVar if so. (I renamed IfaceTcTyVar to IfaceFreeTyVar.) Fiddly but not difficult. >--------------------------------------------------------------- 9ffdf62b0ca72c4f35579f9d6f31a9beebf23025 compiler/backpack/RnModIface.hs | 4 +- compiler/iface/IfaceSyn.hs | 2 +- compiler/iface/IfaceType.hs | 38 +++++------ compiler/iface/TcIface.hs | 2 +- compiler/iface/ToIface.hs | 143 +++++++++++++++++++++++----------------- compiler/iface/ToIface.hs-boot | 2 + compiler/typecheck/TcRnTypes.hs | 5 +- compiler/types/TyCoRep.hs | 37 ++++++----- compiler/types/Type.hs | 2 +- compiler/types/Type.hs-boot | 1 + 10 files changed, 134 insertions(+), 102 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 9ffdf62b0ca72c4f35579f9d6f31a9beebf23025 From git at git.haskell.org Fri Feb 17 16:28:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Feb 2017 16:28:41 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline: Improve SetLevels for join points (0499c65) Message-ID: <20170217162841.698063A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline Link : http://ghc.haskell.org/trac/ghc/changeset/0499c65d9fa45e7879e1e1264fdaa15274adcba6/ghc >--------------------------------------------------------------- commit 0499c65d9fa45e7879e1e1264fdaa15274adcba6 Author: Simon Peyton Jones Date: Fri Feb 17 16:17:16 2017 +0000 Improve SetLevels for join points C.f. Trac #13286, #13236 * Never destroy a join point unless it goes to top level See Note [Floating join point bindings] * Never float a MFE if it has a free join variable Note [Free join points] * Stop treating nullary join points specially * Enforce the invariant that le_join_ceil >= le_ctxt_lvl (Needs more thought...) >--------------------------------------------------------------- 0499c65d9fa45e7879e1e1264fdaa15274adcba6 compiler/simplCore/SetLevels.hs | 315 +++++++++++++++++++--------------------- 1 file changed, 149 insertions(+), 166 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 0499c65d9fa45e7879e1e1264fdaa15274adcba6 From git at git.haskell.org Fri Feb 17 16:28:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Feb 2017 16:28:38 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline: Change -ddump-tc-trace output in TcErrors, slightly (3b2fc08) Message-ID: <20170217162838.AEE393A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline Link : http://ghc.haskell.org/trac/ghc/changeset/3b2fc0827ff6cafa34836c2d9dc710b628c990b6/ghc >--------------------------------------------------------------- commit 3b2fc0827ff6cafa34836c2d9dc710b628c990b6 Author: Simon Peyton Jones Date: Fri Feb 17 12:49:26 2017 +0000 Change -ddump-tc-trace output in TcErrors, slightly Only affects debugging >--------------------------------------------------------------- 3b2fc0827ff6cafa34836c2d9dc710b628c990b6 compiler/typecheck/TcErrors.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/compiler/typecheck/TcErrors.hs b/compiler/typecheck/TcErrors.hs index 6d4e3de..d47ecc6 100644 --- a/compiler/typecheck/TcErrors.hs +++ b/compiler/typecheck/TcErrors.hs @@ -191,9 +191,9 @@ report_unsolved mb_binds_var err_as_warn type_errors expr_holes ; let tidy_env = tidyFreeTyCoVars env0 free_tvs free_tvs = tyCoVarsOfWCList wanted - ; traceTc "reportUnsolved (after zonking and tidying):" $ - vcat [ pprTyVars free_tvs - , ppr wanted ] + ; traceTc "reportUnsolved (after zonking):" $ + vcat [ text "Free tyvars:" <+> pprTyVars free_tvs + , text "Wanted:" <+> ppr wanted ] ; warn_redundant <- woptM Opt_WarnRedundantConstraints ; let err_ctxt = CEC { cec_encl = [] @@ -335,8 +335,8 @@ reportImplic ctxt implic@(Implic { ic_skols = tvs, ic_given = given -- certainly be un-satisfied constraints | otherwise - = do { reportWanteds ctxt' tc_lvl wanted - ; traceTc "reportImplic" (ppr implic) + = do { traceTc "reportImplic" (ppr implic') + ; reportWanteds ctxt' tc_lvl wanted ; when (cec_warn_redundant ctxt) $ warnRedundantConstraints ctxt' tcl_env info' dead_givens } where From git at git.haskell.org Fri Feb 17 16:28:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Feb 2017 16:28:44 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline: Error message wibbles accumulated from the preceding patches (7f14d15) Message-ID: <20170217162844.25CA33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline Link : http://ghc.haskell.org/trac/ghc/changeset/7f14d15c0e5fc2c9a81db3d0f0b01d85857b1d87/ghc >--------------------------------------------------------------- commit 7f14d15c0e5fc2c9a81db3d0f0b01d85857b1d87 Author: Simon Peyton Jones Date: Fri Feb 17 16:23:45 2017 +0000 Error message wibbles accumulated from the preceding patches I suppose it would be better to spread them with their individual changes >--------------------------------------------------------------- 7f14d15c0e5fc2c9a81db3d0f0b01d85857b1d87 testsuite/tests/deriving/should_fail/T7148.stderr | 8 +- testsuite/tests/perf/compiler/all.T | 11 +- testsuite/tests/perf/should_run/all.T | 2 +- testsuite/tests/perf/space_leaks/all.T | 3 +- testsuite/tests/simplCore/should_compile/Makefile | 7 +- .../tests/simplCore/should_compile/T12603.stdout | 2 +- .../tests/simplCore/should_compile/T13156.stdout | 5 +- .../tests/simplCore/should_compile/T3772.stdout | 2 +- .../tests/simplCore/should_compile/T8848.stderr | 101 ------------- .../simplCore/should_compile/spec-inline.stderr | 158 +++++---------------- testsuite/tests/th/T8761.stderr | 57 ++++---- .../tests/typecheck/should_fail/T12785b.stderr | 15 +- 12 files changed, 92 insertions(+), 279 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 7f14d15c0e5fc2c9a81db3d0f0b01d85857b1d87 From git at git.haskell.org Fri Feb 17 18:08:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Feb 2017 18:08:26 +0000 (UTC) Subject: [commit: ghc] branch 'wip/embelleshed-rdr' created Message-ID: <20170217180826.15EFF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/embelleshed-rdr Referencing: 13f79baf857d82abc8ab838d814ddb1ffc8a1b9f From git at git.haskell.org Fri Feb 17 18:08:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 17 Feb 2017 18:08:29 +0000 (UTC) Subject: [commit: ghc] wip/embelleshed-rdr: Add HsEmbellished type to hsSyn (13f79ba) Message-ID: <20170217180829.672F93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/embelleshed-rdr Link : http://ghc.haskell.org/trac/ghc/changeset/13f79baf857d82abc8ab838d814ddb1ffc8a1b9f/ghc >--------------------------------------------------------------- commit 13f79baf857d82abc8ab838d814ddb1ffc8a1b9f Author: Alan Zimmerman Date: Fri Feb 17 12:13:14 2017 +0200 Add HsEmbellished type to hsSyn Summary: A RdrName can be parsed with parens or backquotes if it is used prefix or infix respectively when it is normally not used that way. This is not captured in hsSyn, and must be inferred from the occName when pretty printing, or using the API annotations. Introduce a wrapper type around the name to capture this data Embellished name = EName name | EParens (Located name) | EBackquotes (Located name) So that we now have data HsExpr id = HsVar (LEmbellished id) -- ^ Variable and in the other relevant points in hsSyn. Test Plan: ./validate Reviewers: bgamari, austin, goldfire Subscribers: goldfire, thomie, mpickering, snowleopard Differential Revision: https://phabricator.haskell.org/D3145 >--------------------------------------------------------------- 13f79baf857d82abc8ab838d814ddb1ffc8a1b9f compiler/deSugar/Check.hs | 4 +- compiler/deSugar/Coverage.hs | 2 +- compiler/deSugar/Desugar.hs | 4 +- compiler/deSugar/DsArrows.hs | 2 +- compiler/deSugar/DsExpr.hs | 2 +- compiler/deSugar/DsGRHSs.hs | 4 +- compiler/deSugar/DsMeta.hs | 96 ++++----- compiler/deSugar/DsUtils.hs | 2 +- compiler/deSugar/Match.hs | 2 +- compiler/deSugar/PmExpr.hs | 2 +- compiler/ghc.cabal.in | 1 + compiler/ghc.mk | 1 + compiler/hsSyn/Convert.hs | 82 ++++---- compiler/hsSyn/HsBinds.hs | 23 ++- compiler/hsSyn/HsDecls.hs | 35 ++-- compiler/hsSyn/HsEmbellished.hs | 63 ++++++ compiler/hsSyn/HsExpr.hs | 14 +- compiler/hsSyn/HsPat.hs | 5 +- compiler/hsSyn/HsSyn.hs | 2 + compiler/hsSyn/HsTypes.hs | 28 +-- compiler/hsSyn/HsUtils.hs | 54 ++--- compiler/main/HscMain.hs | 2 +- compiler/main/InteractiveEval.hs | 5 +- compiler/parser/ApiAnnotation.hs | 1 - compiler/parser/Parser.y | 220 ++++++++++----------- compiler/parser/RdrHsSyn.hs | 92 +++++---- compiler/rename/RnBinds.hs | 69 +++---- compiler/rename/RnEnv.hs | 36 +++- compiler/rename/RnExpr.hs | 28 +-- compiler/rename/RnNames.hs | 30 +-- compiler/rename/RnPat.hs | 45 +++-- compiler/rename/RnSource.hs | 66 ++++--- compiler/rename/RnSplice.hs | 8 +- compiler/rename/RnTypes.hs | 17 +- compiler/typecheck/Inst.hs | 6 +- compiler/typecheck/TcAnnotations.hs | 3 +- compiler/typecheck/TcBinds.hs | 31 +-- compiler/typecheck/TcClassDcl.hs | 10 +- compiler/typecheck/TcEnv.hs | 8 +- compiler/typecheck/TcErrors.hs | 3 +- compiler/typecheck/TcExpr.hs | 76 +++---- compiler/typecheck/TcGenDeriv.hs | 12 +- compiler/typecheck/TcHsSyn.hs | 23 +-- compiler/typecheck/TcHsType.hs | 2 +- compiler/typecheck/TcInstDcls.hs | 4 +- compiler/typecheck/TcPat.hs | 11 +- compiler/typecheck/TcPatSyn.hs | 33 ++-- compiler/typecheck/TcRnDriver.hs | 2 +- compiler/typecheck/TcRnTypes.hs | 5 +- compiler/typecheck/TcSigs.hs | 34 ++-- compiler/typecheck/TcSplice.hs | 2 +- compiler/typecheck/TcTyClsDecls.hs | 28 +-- compiler/typecheck/TcTyDecls.hs | 16 +- ghc/GHCi/UI/Info.hs | 2 +- testsuite/tests/ghc-api/annotations/T10357.stdout | 2 - testsuite/tests/ghc-api/annotations/T11321.stdout | 1 - testsuite/tests/ghc-api/annotations/T13163.stdout | 7 - testsuite/tests/ghc-api/landmines/landmines.stdout | 2 +- .../tests/parser/should_compile/DumpParsedAst.hs | 4 + .../parser/should_compile/DumpParsedAst.stderr | 160 +++++++++++++-- .../parser/should_compile/DumpRenamedAst.stderr | 36 ++-- .../should_compile/DumpTypecheckedAst.stderr | 14 +- testsuite/tests/quasiquotation/T7918.hs | 4 +- utils/ghctags/Main.hs | 6 +- utils/haddock | 2 +- 65 files changed, 952 insertions(+), 644 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 13f79baf857d82abc8ab838d814ddb1ffc8a1b9f From git at git.haskell.org Sat Feb 18 00:47:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 18 Feb 2017 00:47:50 +0000 (UTC) Subject: [commit: ghc] master: Fix a Backpack recompilation avoidance bug when signatures change. (ca54315) Message-ID: <20170218004750.D7DB43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ca543154bbf0ec36ee2654050ee67a467420449f/ghc >--------------------------------------------------------------- commit ca543154bbf0ec36ee2654050ee67a467420449f Author: Edward Z. Yang Date: Sun Feb 12 02:44:01 2017 -0800 Fix a Backpack recompilation avoidance bug when signatures change. Summary: Recompilation avoidance checks if -this-unit-id has changed by relying on the "wanted module" check in readIface ("Something is amiss..."). Unfortunately, this check didn't check if the instantiation made sense, which meant that if you changed the signatures of a Backpack package, we'd still treat the old signatures as up-to-date. The way I fixed this was by having findAndReadIface take in a 'Module' representing the /actual/ module we were intending to lookup. We convert this into the 'Module' we expect to see in 'mi_module' and now do a more elaborate check that will also verify that instantiations make sense. Along the way, I robustified the logging infrastructure for recompilation checking, and folded wrongIfaceModErr (which was dead code) into the error message. Signed-off-by: Edward Z. Yang Test Plan: validate Reviewers: bgamari, austin Subscribers: thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3130 >--------------------------------------------------------------- ca543154bbf0ec36ee2654050ee67a467420449f compiler/basicTypes/Module.hs | 4 ++ compiler/iface/FlagChecker.hs | 4 ++ compiler/iface/LoadIface.hs | 68 +++++++++++++--------- compiler/iface/MkIface.hs | 13 ++++- compiler/iface/TcIface.hs | 2 +- compiler/typecheck/TcBackpack.hs | 12 ++-- testsuite/driver/extra_files.py | 1 + .../tests/backpack/cabal/bkpcabal04/.gitignore | 3 + testsuite/tests/backpack/cabal/bkpcabal04/Makefile | 29 +++++++++ .../cabal/{bkpcabal01 => bkpcabal04}/Setup.hs | 0 testsuite/tests/backpack/cabal/bkpcabal04/all.T | 10 ++++ .../bkpcabal04.cabal.in1} | 12 ++-- .../bkpcabal04.cabal.in2} | 12 ++-- .../{bkpcabal03/asig1 => bkpcabal04/p}/A.hsig | 1 - .../tests/backpack/cabal/bkpcabal04/q/A/B.hsig.in | 2 + .../tests/backpack/cabal/bkpcabal04/q/B.hsig.in | 2 + testsuite/tests/backpack/should_compile/bkp51.bkp | 2 +- 17 files changed, 124 insertions(+), 53 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 ca543154bbf0ec36ee2654050ee67a467420449f From git at git.haskell.org Sat Feb 18 00:47:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 18 Feb 2017 00:47:55 +0000 (UTC) Subject: [commit: ghc] master: Fix recompilation tracking on signatures. (22dba98) Message-ID: <20170218004755.096AF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/22dba98f2b22141d8238d7e7a42141495945f1cf/ghc >--------------------------------------------------------------- commit 22dba98f2b22141d8238d7e7a42141495945f1cf Author: Edward Z. Yang Date: Sun Feb 12 04:28:38 2017 -0800 Fix recompilation tracking on signatures. Summary: Previously we weren't tracking these dependencies at all, because we couldn't "find" the interface for {A.H}. Now we've associated hole names to the correct module identity so we will pick them up. Signed-off-by: Edward Z. Yang Test Plan: validate Reviewers: bgamari, austin Subscribers: thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3131 >--------------------------------------------------------------- 22dba98f2b22141d8238d7e7a42141495945f1cf compiler/deSugar/DsUsage.hs | 15 ++++++++++----- compiler/typecheck/TcRnTypes.hs | 4 ++++ testsuite/driver/extra_files.py | 1 + testsuite/tests/backpack/cabal/bkpcabal05/.gitignore | 1 + testsuite/tests/backpack/cabal/bkpcabal05/A.hsig.in1 | 3 +++ .../cabal/{bkpcabal04/p/A.hsig => bkpcabal05/A.hsig.in2} | 1 + testsuite/tests/backpack/cabal/bkpcabal05/M.hs | 4 ++++ .../backpack/cabal/{bkpcabal04 => bkpcabal05}/Makefile | 16 +++++----------- .../backpack/cabal/{bkpcabal01 => bkpcabal05}/Setup.hs | 0 .../{cabal/T12733 => backpack/cabal/bkpcabal05}/all.T | 4 ++-- .../asig1/asig1.cabal => bkpcabal05/bkpcabal05.cabal} | 6 +++--- .../tests/backpack/cabal/bkpcabal05/bkpcabal05.stderr | 5 +++++ 12 files changed, 39 insertions(+), 21 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 22dba98f2b22141d8238d7e7a42141495945f1cf From git at git.haskell.org Sat Feb 18 00:47:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 18 Feb 2017 00:47:58 +0000 (UTC) Subject: [commit: ghc] master: Improvements/bugfixes to signature reexport handling. (fd2d5b6) Message-ID: <20170218004758.DB3B63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fd2d5b6de7493c2ff2ac76401ef296f575c52483/ghc >--------------------------------------------------------------- commit fd2d5b6de7493c2ff2ac76401ef296f575c52483 Author: Edward Z. Yang Date: Sun Feb 12 16:02:44 2017 -0800 Improvements/bugfixes to signature reexport handling. Summary: A number of changes: - Keep the TcGblEnv from typechecking the local signature around when we do merging. In particular, we setup tcg_imports and tcg_rdr_env according to the local signature. This improves our error output (for example, see bkpfail04) and also fixes a bug with reexporting modules in signatures (see bkpreex07) - Fix a bug in thinning, where if we had signature A(module A), this previously would have *thinned out* all of the inherited signatures. Now we treat every inherited signature as having come from an import like "import A", so a module A reexport will pick them up. - Recompilation checking now keeps track of dependent source files of the source signature; previously we forgot to retain this info. There's a manual update too. Signed-off-by: Edward Z. Yang Test Plan: validate Reviewers: bgamari, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3133 >--------------------------------------------------------------- fd2d5b6de7493c2ff2ac76401ef296f575c52483 compiler/main/HscMain.hs | 2 +- compiler/typecheck/TcBackpack.hs | 43 +++++++++--- docs/users_guide/separate_compilation.rst | 82 +++++++++++++--------- .../backpack/cabal/bkpcabal02/bkpcabal02.stderr | 4 +- testsuite/tests/backpack/reexport/all.T | 4 ++ testsuite/tests/backpack/reexport/bkpreex07.bkp | 3 + testsuite/tests/backpack/reexport/bkpreex07.stderr | 2 + testsuite/tests/backpack/reexport/bkpreex08.bkp | 17 +++++ testsuite/tests/backpack/reexport/bkpreex08.stderr | 8 +++ testsuite/tests/backpack/reexport/bkpreex09.bkp | 10 +++ .../bkp07.stderr => reexport/bkpreex09.stderr} | 2 +- testsuite/tests/backpack/reexport/bkpreex10.bkp | 10 +++ .../bkp07.stderr => reexport/bkpreex10.stderr} | 2 +- .../tests/backpack/should_fail/bkpfail04.stderr | 4 +- .../tests/backpack/should_fail/bkpfail42.stderr | 4 +- 15 files changed, 148 insertions(+), 49 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 fd2d5b6de7493c2ff2ac76401ef296f575c52483 From git at git.haskell.org Sat Feb 18 00:48:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 18 Feb 2017 00:48:01 +0000 (UTC) Subject: [commit: ghc] master: Say 'data' explicitly in IfAbstractTyCon output. (8916884) Message-ID: <20170218004801.911ED3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/89168849a781626fc794ae97375da979ac83bf96/ghc >--------------------------------------------------------------- commit 89168849a781626fc794ae97375da979ac83bf96 Author: Edward Z. Yang Date: Sun Feb 12 22:36:19 2017 -0800 Say 'data' explicitly in IfAbstractTyCon output. Signed-off-by: Edward Z. Yang >--------------------------------------------------------------- 89168849a781626fc794ae97375da979ac83bf96 compiler/iface/IfaceSyn.hs | 4 ++-- testsuite/tests/backpack/should_fail/bkpfail10.stderr | 2 +- testsuite/tests/backpack/should_fail/bkpfail23.stderr | 2 +- testsuite/tests/backpack/should_fail/bkpfail25.stderr | 2 +- testsuite/tests/backpack/should_fail/bkpfail26.stderr | 2 +- testsuite/tests/backpack/should_fail/bkpfail27.stderr | 2 +- testsuite/tests/roles/should_fail/Roles12.stderr | 2 +- testsuite/tests/roles/should_fail/T9204.stderr | 2 +- testsuite/tests/typecheck/should_fail/T12035.stderr | 2 +- testsuite/tests/typecheck/should_fail/T12035j.stderr | 2 +- testsuite/tests/typecheck/should_fail/T3468.stderr | 4 ++-- 11 files changed, 13 insertions(+), 13 deletions(-) diff --git a/compiler/iface/IfaceSyn.hs b/compiler/iface/IfaceSyn.hs index 6469878..7150e22 100644 --- a/compiler/iface/IfaceSyn.hs +++ b/compiler/iface/IfaceSyn.hs @@ -726,8 +726,8 @@ pprIfaceDecl ss (IfaceData { ifName = tycon, ifCType = ctype, pp_nd = case condecls of IfAbstractTyCon how -> case how of - DistinctNominalAbstract -> text "abstract" - SkolemAbstract -> text "skolem" + DistinctNominalAbstract -> text "{- abstract -} data" + SkolemAbstract -> text "{- skolem -} data" IfDataTyCon{} -> text "data" IfNewTyCon{} -> text "newtype" diff --git a/testsuite/tests/backpack/should_fail/bkpfail10.stderr b/testsuite/tests/backpack/should_fail/bkpfail10.stderr index bb31da4..c521451 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail10.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail10.stderr @@ -13,7 +13,7 @@ bkpfail10.bkp:8:9: error: • Type constructor ‘H’ has conflicting definitions in the module and its hsig file Main module: data H a = H a - Hsig file: skolem H + Hsig file: {- skolem -} data H The types have different kinds • while checking that q:H implements signature H in p[H=q:H] diff --git a/testsuite/tests/backpack/should_fail/bkpfail23.stderr b/testsuite/tests/backpack/should_fail/bkpfail23.stderr index 54dddc0..de4026a 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail23.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail23.stderr @@ -15,7 +15,7 @@ bkpfail23.bkp:14:9: error: and its hsig file Main module: type F a = () Hsig file: type role F phantom - skolem F a + {- skolem -} data F a Illegal parameterized type synonym in implementation of abstract data. (Try eta reducing your type synonym so that it is nullary.) • while checking that h:H implements signature H in p[H=h:H] diff --git a/testsuite/tests/backpack/should_fail/bkpfail25.stderr b/testsuite/tests/backpack/should_fail/bkpfail25.stderr index f01231d..ef2d035 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail25.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail25.stderr @@ -19,5 +19,5 @@ bkpfail25.bkp:12:9: error: • Type constructor ‘T’ has conflicting definitions in the module and its hsig file Main module: type T a = a - Hsig file: skolem T a + Hsig file: {- skolem -} data T a • while checking that q:H implements signature H in p[H=q:H] diff --git a/testsuite/tests/backpack/should_fail/bkpfail26.stderr b/testsuite/tests/backpack/should_fail/bkpfail26.stderr index 583629f..fa192c2 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail26.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail26.stderr @@ -14,7 +14,7 @@ bkpfail26.bkp:15:9: error: • Type constructor ‘T’ has conflicting definitions in the module and its hsig file Main module: type T a = [a] - Hsig file: skolem T a + Hsig file: {- skolem -} data T a Illegal parameterized type synonym in implementation of abstract data. (Try eta reducing your type synonym so that it is nullary.) • while checking that q:H implements signature H in p[H=q:H] diff --git a/testsuite/tests/backpack/should_fail/bkpfail27.stderr b/testsuite/tests/backpack/should_fail/bkpfail27.stderr index 5f33d04..3d1446a 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail27.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail27.stderr @@ -14,6 +14,6 @@ bkpfail27.bkp:15:9: error: • Type constructor ‘T’ has conflicting definitions in the module and its hsig file Main module: type T = F - Hsig file: skolem T + Hsig file: {- skolem -} data T Illegal type family application in implementation of abstract data. • while checking that q:H implements signature H in p[H=q:H] diff --git a/testsuite/tests/roles/should_fail/Roles12.stderr b/testsuite/tests/roles/should_fail/Roles12.stderr index 7dff7f9..ac57e2b 100644 --- a/testsuite/tests/roles/should_fail/Roles12.stderr +++ b/testsuite/tests/roles/should_fail/Roles12.stderr @@ -4,6 +4,6 @@ Roles12.hs:5:1: error: and its hs-boot file Main module: type role T phantom data T a - Boot file: abstract T a + Boot file: {- abstract -} data T a The roles do not match. Roles on abstract types default to ‘representational’ in boot files. diff --git a/testsuite/tests/roles/should_fail/T9204.stderr b/testsuite/tests/roles/should_fail/T9204.stderr index 721e74e..e5e9925 100644 --- a/testsuite/tests/roles/should_fail/T9204.stderr +++ b/testsuite/tests/roles/should_fail/T9204.stderr @@ -4,6 +4,6 @@ T9204.hs:6:1: error: and its hs-boot file Main module: type role D phantom data D a - Boot file: abstract D a + Boot file: {- abstract -} data D a The roles do not match. Roles on abstract types default to ‘representational’ in boot files. diff --git a/testsuite/tests/typecheck/should_fail/T12035.stderr b/testsuite/tests/typecheck/should_fail/T12035.stderr index 7086785..9e5ff78 100644 --- a/testsuite/tests/typecheck/should_fail/T12035.stderr +++ b/testsuite/tests/typecheck/should_fail/T12035.stderr @@ -3,4 +3,4 @@ T12035.hs-boot:2:1: error: Type constructor ‘T’ has conflicting definitions in the module and its hs-boot file Main module: type T = Bool - Boot file: abstract T + Boot file: {- abstract -} data T diff --git a/testsuite/tests/typecheck/should_fail/T12035j.stderr b/testsuite/tests/typecheck/should_fail/T12035j.stderr index 7086785..9e5ff78 100644 --- a/testsuite/tests/typecheck/should_fail/T12035j.stderr +++ b/testsuite/tests/typecheck/should_fail/T12035j.stderr @@ -3,4 +3,4 @@ T12035.hs-boot:2:1: error: Type constructor ‘T’ has conflicting definitions in the module and its hs-boot file Main module: type T = Bool - Boot file: abstract T + Boot file: {- abstract -} data T diff --git a/testsuite/tests/typecheck/should_fail/T3468.stderr b/testsuite/tests/typecheck/should_fail/T3468.stderr index 9284df2..cae8eed 100644 --- a/testsuite/tests/typecheck/should_fail/T3468.stderr +++ b/testsuite/tests/typecheck/should_fail/T3468.stderr @@ -1,9 +1,9 @@ -T3468.hs-boot:3:1: +T3468.hs-boot:3:1: error: Type constructor ‘Tool’ has conflicting definitions in the module and its hs-boot file Main module: type role Tool phantom data Tool d where F :: a -> Tool d - Boot file: abstract Tool + Boot file: {- abstract -} data Tool The types have different kinds From git at git.haskell.org Sat Feb 18 05:10:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 18 Feb 2017 05:10:14 +0000 (UTC) Subject: [commit: nofib] master: Fix nofib benchmarks on Windows. (307ae61) Message-ID: <20170218051014.A95AE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/nofib On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/307ae61121a99f6ffd3d5fa56e5d37b1b91a492b/nofib >--------------------------------------------------------------- commit 307ae61121a99f6ffd3d5fa56e5d37b1b91a492b Author: Tamar Christina Date: Tue Feb 14 16:59:57 2017 -0500 Fix nofib benchmarks on Windows. Summary: This allows nofib to run on Windows using `msys`. Also deprecates the old `cygwin` stuff. Test Plan: make clean && make Reviewers: bgamari Reviewed By: bgamari Subscribers: RyanGlScott, #ghc_windows_task_force Differential Revision: https://phabricator.haskell.org/D3030 >--------------------------------------------------------------- 307ae61121a99f6ffd3d5fa56e5d37b1b91a492b mk/boilerplate.mk | 10 +++++++++- runstdtest/runstdtest.prl | 13 ++++++------- shootout/k-nucleotide/Makefile | 6 +++--- shootout/reverse-complement/Makefile | 6 +++--- .../fft2/{fft2.slowstdout => fft2.slowstdout-x86-mingw} | 2 +- 5 files changed, 22 insertions(+), 15 deletions(-) diff --git a/mk/boilerplate.mk b/mk/boilerplate.mk index 906cd0b..45344ca 100644 --- a/mk/boilerplate.mk +++ b/mk/boilerplate.mk @@ -19,9 +19,17 @@ RM = rm -f SIZE = size STRIP = strip PERL = /usr/bin/perl -CONTEXT_DIFF = diff -U 1 +CONTEXT_DIFF_RAW = diff -U 1 EXECUTABLE_FILE = chmod +x +# Windows MSYS specific settings +ifeq ($(shell uname -o), Msys) + exeext=.exe + CONTEXT_DIFF=$(CONTEXT_DIFF_RAW) --strip-trailing-cr +else + CONTEXT_DIFF=$(CONTEXT_DIFF_RAW) +endif + # Benchmarks controls which set of tests should be run # You can run one or more of # imaginary diff --git a/runstdtest/runstdtest.prl b/runstdtest/runstdtest.prl index bab0ab4..8af3c0b 100644 --- a/runstdtest/runstdtest.prl +++ b/runstdtest/runstdtest.prl @@ -55,12 +55,11 @@ if ( $ENV{'TMPDIR'} ) { # where to make tmp file names $TmpPrefix = '/tmp'; $ENV{'TMPDIR'} = '/tmp'; # set the env var as well } -# If this is Cygwin, ignore eol and CR characters. -# Perhaps required for MSYS too, although the cygpath -# bit is hopefully unnecessary. -if ( `uname | grep CYGWIN` ) { +$cmp = "cmp -s"; +# If this is Msys, ignore eol and CR characters. +if ( `uname -o | grep Msys` ) { $CONTEXT_DIFF=$CONTEXT_DIFF . " --strip-trailing-cr" ; - $TmpPrefix = `cygpath -m $TmpPrefix | tr -d \\\\n`; + $cmp = $CONTEXT_DIFF . " -q"; } $ScriptFile = "$TmpPrefix/run_me$$"; $DefaultStdoutFile = "$TmpPrefix/no_stdout$$"; # can't use /dev/null (e.g. Alphas) @@ -260,7 +259,7 @@ else $PostScriptLines hit='NO' for out_file in @PgmStdoutFile ; do - if cmp -s \$out_file $TmpPrefix/runtest$$.1 ; then + if $cmp \$out_file $TmpPrefix/runtest$$.1 ; then hit='YES' fi done @@ -286,7 +285,7 @@ fi hit='NO' for out_file in @PgmStderrFile ; do - if cmp -s \$out_file $TmpPrefix/runtest$$.2 ; then + if $cmp \$out_file $TmpPrefix/runtest$$.2 ; then hit='YES' fi done diff --git a/shootout/k-nucleotide/Makefile b/shootout/k-nucleotide/Makefile index 5d0baaf..ceeda7a 100644 --- a/shootout/k-nucleotide/Makefile +++ b/shootout/k-nucleotide/Makefile @@ -18,13 +18,13 @@ fasta-c : ../fasta/fasta-c.c $(CC) -std=gnu99 -O3 -fomit-frame-pointer $< -o $@ knucleotide-input250000.txt : fasta-c - ./fasta-c $(FAST_OPTS) > $@ + ./fasta-c $(FAST_OPTS) | tr -d '\r' > $@ knucleotide-input2500000.txt : fasta-c - ./fasta-c $(NORM_OPTS) > $@ + ./fasta-c $(NORM_OPTS) | tr -d '\r' > $@ knucleotide-input25000000.txt : fasta-c - ./fasta-c $(SLOW_OPTS) > $@ + ./fasta-c $(SLOW_OPTS) | tr -d '\r' > $@ ifeq "$(mode)" "slow" INPUT_FILE = knucleotide-input25000000.txt diff --git a/shootout/reverse-complement/Makefile b/shootout/reverse-complement/Makefile index 4524dc1..19f976f 100644 --- a/shootout/reverse-complement/Makefile +++ b/shootout/reverse-complement/Makefile @@ -23,13 +23,13 @@ fasta-c : ../fasta/fasta-c.c $(CC) -std=gnu99 -O3 -fomit-frame-pointer $< -o $@ revcomp-input250000.txt : fasta-c - ./fasta-c $(FAST_OPTS) > $@ + ./fasta-c $(FAST_OPTS) | tr -d '\r' > $@ revcomp-input2500000.txt : fasta-c - ./fasta-c $(NORM_OPTS) > $@ + ./fasta-c $(NORM_OPTS) | tr -d '\r' > $@ revcomp-input25000000.txt : fasta-c - ./fasta-c $(SLOW_OPTS) > $@ + ./fasta-c $(SLOW_OPTS) | tr -d '\r' > $@ ifeq "$(mode)" "slow" INPUT_FILE = revcomp-input25000000.txt diff --git a/spectral/fft2/fft2.slowstdout b/spectral/fft2/fft2.slowstdout-x86-mingw similarity index 62% copy from spectral/fft2/fft2.slowstdout copy to spectral/fft2/fft2.slowstdout-x86-mingw index 203cb74..b541c97 100644 --- a/spectral/fft2/fft2.slowstdout +++ b/spectral/fft2/fft2.slowstdout-x86-mingw @@ -1,3 +1,3 @@ result1 = 21167.208319565725 -result2 = 2.5448319287502744e-11 +result2 = 2.5472441940698405e-11 result3 = 2.2515175714943325e-6 From git at git.haskell.org Sat Feb 18 05:10:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 18 Feb 2017 05:10:16 +0000 (UTC) Subject: [commit: nofib] master: nucleic2: removed unused files & simplify Makefile (df44189) Message-ID: <20170218051016.BBD113A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/nofib On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/df44189dd7b926abff795fc1ecac08baa69c812e/nofib >--------------------------------------------------------------- commit df44189dd7b926abff795fc1ecac08baa69c812e Author: Michal Terepeta Date: Tue Feb 14 17:00:02 2017 -0500 nucleic2: removed unused files & simplify Makefile Summary: This commit does a few small cleanups: - Remove the unused files (implementations in C, SML, etc.). - Move the paper to a new `paper` subdirectory. - Remove unnecessary things from the Makefile. The last one will make it easier to move to a Shake-based build system. Signed-off-by: Michal Terepeta Test Plan: compile & run nofib Reviewers: bgamari Reviewed By: bgamari Subscribers: dfeuer Differential Revision: https://phabricator.haskell.org/D3041 >--------------------------------------------------------------- df44189dd7b926abff795fc1ecac08baa69c812e spectral/hartel/nucleic2/Makefile | 4 - spectral/hartel/nucleic2/README | 10 + spectral/hartel/nucleic2/nucleic2.c | 3321 ----------------------- spectral/hartel/nucleic2/nucleic2.m | 3329 ----------------------- spectral/hartel/nucleic2/nucleic2.scm | 3453 ------------------------ spectral/hartel/nucleic2/nucleic2.sml | 3306 ----------------------- spectral/hartel/nucleic2/{ => paper}/paper.bbl | 0 spectral/hartel/nucleic2/{ => paper}/paper.ps | 0 spectral/hartel/nucleic2/{ => paper}/paper.tex | 0 9 files changed, 10 insertions(+), 13413 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 df44189dd7b926abff795fc1ecac08baa69c812e From git at git.haskell.org Sat Feb 18 05:10:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 18 Feb 2017 05:10:18 +0000 (UTC) Subject: [commit: nofib] master: spectral: revive last-piece (070e016) Message-ID: <20170218051018.C6B2C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/nofib On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/070e01659b533dad8f3379f31813d4f3b1bf2c71/nofib >--------------------------------------------------------------- commit 070e01659b533dad8f3379f31813d4f3b1bf2c71 Author: Michal Terepeta Date: Tue Feb 14 17:00:06 2017 -0500 spectral: revive last-piece Summary: I'm not entirely sure if the benchmark is worth reviving, but it was quite easy and we can always remove it later. This also removed the unused PROG_ARGS from the Makefile. Signed-off-by: Michal Terepeta Test Plan: compile & run Reviewers: bgamari Reviewed By: bgamari Differential Revision: https://phabricator.haskell.org/D3042 >--------------------------------------------------------------- 070e01659b533dad8f3379f31813d4f3b1bf2c71 spectral/Makefile | 6 +++--- spectral/last-piece/Main.hs | 14 +++++++------- spectral/last-piece/Makefile | 6 +----- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/spectral/Makefile b/spectral/Makefile index 4b1ee52..27d3d60 100644 --- a/spectral/Makefile +++ b/spectral/Makefile @@ -3,13 +3,13 @@ include $(TOP)/mk/boilerplate.mk SUBDIRS = ansi atom awards banner boyer boyer2 calendar cichelli circsim \ clausify constraints cryptarithm1 cryptarithm2 cse eliza expert \ - fft2 fibheaps fish gcd hartel integer knights lcss life mandel \ - mandel2 minimax multiplier para power pretty primetest puzzle \ + fft2 fibheaps fish gcd hartel integer knights last-piece lcss life \ + mandel mandel2 minimax multiplier para power pretty primetest puzzle \ rewrite scc simple sorting sphere treejoin # compreals no suitable test data # salishan no Haskell code! -OTHER_SUBDIRS = compreals lambda last-piece mate salishan secretary triangle +OTHER_SUBDIRS = compreals lambda mate salishan secretary triangle include $(TOP)/mk/target.mk diff --git a/spectral/last-piece/Main.hs b/spectral/last-piece/Main.hs index d2251bd..41552c4 100644 --- a/spectral/last-piece/Main.hs +++ b/spectral/last-piece/Main.hs @@ -4,9 +4,9 @@ module Main where import Prelude hiding( flip ) -import Pretty import Data.Maybe -import FiniteMap +import Text.PrettyPrint +import qualified Data.Map as Map ---------------------------- -- Driver @@ -119,19 +119,19 @@ check :: Board -> Square -> Maybe PieceId extend :: Board -> Square -> PieceId -> Board extend_maybe :: Board -> Square -> PieceId -> Maybe Board -type Board = FiniteMap Square PieceId +type Board = Map.Map Square PieceId -emptyBoard = emptyFM +emptyBoard = Map.empty -check bd sq = lookupFM bd sq +check bd sq = Map.lookup sq bd -extend bd sq id = addToFM bd sq id +extend bd sq id = Map.insert sq id bd extend_maybe bd sq@(row,col) id | row > maxRow || col < 1 || col > maxCol = Nothing | otherwise - = case lookupFM bd sq of + = case check bd sq of Just _ -> Nothing Nothing -> Just (extend bd sq id) diff --git a/spectral/last-piece/Makefile b/spectral/last-piece/Makefile index 5316d0e..94ab9a3 100644 --- a/spectral/last-piece/Makefile +++ b/spectral/last-piece/Makefile @@ -1,11 +1,7 @@ TOP = ../.. include $(TOP)/mk/boilerplate.mk -SRC_HC_OPTS += -package text -package data - - -# Arguments for the test program -PROG_ARGS = 8 3 +SRC_HC_OPTS += -package containers -package pretty include $(TOP)/mk/target.mk From git at git.haskell.org Sat Feb 18 05:10:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 18 Feb 2017 05:10:20 +0000 (UTC) Subject: [commit: nofib] master: imaginary: re-enable digits-of-e{1, 2} (0a12057) Message-ID: <20170218051020.D10DF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/nofib On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0a120575afb635ab0b1d9d670d5eb386c2b4fb8d/nofib >--------------------------------------------------------------- commit 0a120575afb635ab0b1d9d670d5eb386c2b4fb8d Author: Michal Terepeta Date: Tue Feb 14 17:00:11 2017 -0500 imaginary: re-enable digits-of-e{1,2} Summary: These still compile and are quick to run so we might as well enable them. Signed-off-by: Michal Terepeta Test Plan: run nofib Reviewers: bgamari Reviewed By: bgamari Subscribers: bgamari Differential Revision: https://phabricator.haskell.org/D3078 >--------------------------------------------------------------- 0a120575afb635ab0b1d9d670d5eb386c2b4fb8d imaginary/Makefile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/imaginary/Makefile b/imaginary/Makefile index 7c2fcfa..a38ff2a 100644 --- a/imaginary/Makefile +++ b/imaginary/Makefile @@ -1,10 +1,8 @@ TOP = .. include $(TOP)/mk/boilerplate.mk -SUBDIRS = bernouilli exp3_8 gen_regexps integrate paraffins primes queens \ - rfib tak wheel-sieve1 wheel-sieve2 x2n1 kahan - -OTHER_SUBDIRS = digits-of-e1 digits-of-e2 +SUBDIRS = bernouilli digits-of-e1 digits-of-e2 exp3_8 gen_regexps integrate \ + paraffins primes queens rfib tak wheel-sieve1 wheel-sieve2 x2n1 kahan include $(TOP)/mk/target.mk From git at git.haskell.org Sat Feb 18 05:10:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 18 Feb 2017 05:10:24 +0000 (UTC) Subject: [commit: nofib] master: real: remove ebnf2ps (8a11a38) Message-ID: <20170218051024.EC5153A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/nofib On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8a11a3859bb63ecd0bad56181f56f5d020447a48/nofib >--------------------------------------------------------------- commit 8a11a3859bb63ecd0bad56181f56f5d020447a48 Author: Michal Terepeta Date: Tue Feb 14 17:01:52 2017 -0500 real: remove ebnf2ps Summary: The benchmark doesn't compile and even after fixing, it runs in about 0.006s. The compile time is super fast as well (tiny modules). So it seems like another candidate for removal. Signed-off-by: Michal Terepeta Test Plan: run nofib Reviewers: goldfire, bgamari Reviewed By: bgamari Differential Revision: https://phabricator.haskell.org/D3087 >--------------------------------------------------------------- 8a11a3859bb63ecd0bad56181f56f5d020447a48 real/Makefile | 2 +- real/ebnf2ps/AbstractSyntax.hs | 18 - real/ebnf2ps/Color.hs | 106 --- real/ebnf2ps/CommandLine.hs | 81 -- real/ebnf2ps/CommandLineFlags | 20 - real/ebnf2ps/EbnfGrammar.hs | 96 -- real/ebnf2ps/EbnfLayout.hs | 398 -------- real/ebnf2ps/FigOutput.hs | 170 ---- real/ebnf2ps/Fonts.hs | 142 --- real/ebnf2ps/GrammarTransform.hs | 151 --- real/ebnf2ps/HappyParser.ly | 182 ---- real/ebnf2ps/IOSupplement.hs | 96 -- real/ebnf2ps/Info.hs | 45 - real/ebnf2ps/Lexer.hs | 74 -- real/ebnf2ps/Main.hs | 206 ---- real/ebnf2ps/Makefile | 14 - real/ebnf2ps/Parsers.hs | 104 --- real/ebnf2ps/PsOutput.hs | 262 ------ real/ebnf2ps/README | 30 - real/ebnf2ps/StringMatch.hs | 97 -- real/ebnf2ps/Times-Roman.afm | 425 --------- real/ebnf2ps/doc.ps | 1924 -------------------------------------- real/ebnf2ps/doc.tex | 192 ---- real/ebnf2ps/ebnf.BNF | 16 - real/ebnf2ps/ebnf2ps.stdin | 292 ------ real/ebnf2ps/ebnf2ps.stdout | 290 ------ real/ebnf2ps/gofer.BNF | 292 ------ real/ebnf2ps/regular.BNF | 4 - 28 files changed, 1 insertion(+), 5728 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 8a11a3859bb63ecd0bad56181f56f5d020447a48 From git at git.haskell.org Sat Feb 18 05:10:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 18 Feb 2017 05:10:22 +0000 (UTC) Subject: [commit: nofib] master: spectral: revive lambda (5786292) Message-ID: <20170218051022.DC55D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/nofib On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5786292b9473b8db8880f13bc5b6b5e254339ec2/nofib >--------------------------------------------------------------- commit 5786292b9473b8db8880f13bc5b6b5e254339ec2 Author: Michal Terepeta Date: Tue Feb 14 17:00:14 2017 -0500 spectral: revive lambda Summary: Instead of using the hand rolled monads, this now uses monads from `transformers` (shouldn't complicate running the benchmark, since it's a boot library). Signed-off-by: Michal Terepeta Test Plan: run nofib Reviewers: bgamari Reviewed By: bgamari Differential Revision: https://phabricator.haskell.org/D3079 >--------------------------------------------------------------- 5786292b9473b8db8880f13bc5b6b5e254339ec2 spectral/Makefile | 4 ++-- spectral/lambda/Main.hs | 50 ++++++++++++++++-------------------------------- spectral/lambda/Makefile | 2 ++ 3 files changed, 21 insertions(+), 35 deletions(-) diff --git a/spectral/Makefile b/spectral/Makefile index 27d3d60..6187c33 100644 --- a/spectral/Makefile +++ b/spectral/Makefile @@ -3,13 +3,13 @@ include $(TOP)/mk/boilerplate.mk SUBDIRS = ansi atom awards banner boyer boyer2 calendar cichelli circsim \ clausify constraints cryptarithm1 cryptarithm2 cse eliza expert \ - fft2 fibheaps fish gcd hartel integer knights last-piece lcss life \ + fft2 fibheaps fish gcd hartel integer knights lambda last-piece lcss life \ mandel mandel2 minimax multiplier para power pretty primetest puzzle \ rewrite scc simple sorting sphere treejoin # compreals no suitable test data # salishan no Haskell code! -OTHER_SUBDIRS = compreals lambda mate salishan secretary triangle +OTHER_SUBDIRS = compreals lambda last-piece mate salishan secretary triangle include $(TOP)/mk/target.mk diff --git a/spectral/lambda/Main.hs b/spectral/lambda/Main.hs index 59938d1..66bd517 100644 --- a/spectral/lambda/Main.hs +++ b/spectral/lambda/Main.hs @@ -1,3 +1,5 @@ +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} module Main( main ) where -- From Mark: marku at cs.waikato.ac.nz [Nov 2001] @@ -38,6 +40,9 @@ module Main( main ) where import System.Environment +import Control.Monad.Trans.State.Strict +import Data.Functor.Identity + main :: IO () main = do { mainSimple ; mainMonad } @@ -81,8 +86,7 @@ type Env = [(String,Term)] ---------------------------------------------------------------------- ev :: Term -> IO (Env,Term) ev t = - do let StateMonad2 m = traverseTerm t - let (env,t2) = m [] + do let (t2, env) = runState (traverseTerm t :: State Env Term) [] putStrLn (pp t2 ++ " " ++ ppenv env) return (env,t2) @@ -102,32 +106,16 @@ class (Monad m) => EvalEnvMonad m where withEnv :: Env -> m a -> m a -- uses the given environment pushVar v t m = do env <- currEnv; withEnv ((v,t):env) m - --- Here is a monad that evaluates the term. -newtype StateMonad2 a = StateMonad2 (Env -> (Env,a)) - -instance (Show a) => Show (StateMonad2 a) where - show (StateMonad2 f) = show (f []) - -instance Monad StateMonad2 where - return a = StateMonad2 (\s -> (s,a)) - fail msg = StateMonad2 (\s -> (s,error msg)) - (StateMonad2 g) >>= h = - StateMonad2 (\a -> (let (s,a1) = g a in - (let StateMonad2 h' = h a1 in - h' s))) - -instance EvalEnvMonad StateMonad2 where - incr = StateMonad2 (\s -> (s,())) +instance EvalEnvMonad (State Env) where + incr = return () traverseTerm = eval - lookupVar v = - StateMonad2 (\env -> (env, lookup2 env)) + lookupVar v = do + env <- get + return $ lookup2 env where - lookup2 env = maybe (error ("undefined var: " ++ v)) id (lookup v env) - currEnv = - StateMonad2 (\env -> (env,env)) - withEnv tmp (StateMonad2 m) = - StateMonad2 (\env -> let (_,t) = m tmp in (env,t)) + lookup2 env = maybe (error ("undefined var: " ++ v)) id (lookup v env) + currEnv = get + withEnv tmp m = return (evalState m tmp) eval :: (EvalEnvMonad m) => Term -> m Term @@ -171,15 +159,11 @@ apply a b = fail ("bad application: " ++ pp a ++ -- A directly recursive Eval, with explicit environment ---------------------------------------------------------------------- -- A trivial monad so that we can use monad syntax. -data Id a = Id a - -instance Monad Id where - return t = Id t - fail = error - (Id t) >>= f = f t +newtype Id a = Id (Identity a) + deriving (Applicative, Functor, Monad) instance Show a => Show (Id a) where - show (Id t) = show t + show (Id i) = show (runIdentity i) simpleEval :: Env -> Term -> Id Term simpleEval env (Var v) = diff --git a/spectral/lambda/Makefile b/spectral/lambda/Makefile index 03dcddc..2b33f94 100644 --- a/spectral/lambda/Makefile +++ b/spectral/lambda/Makefile @@ -1,6 +1,8 @@ TOP = ../.. include $(TOP)/mk/boilerplate.mk +SRC_HC_OPTS += -package transformers + # Arguments for the test program PROG_ARGS = 1600 From git at git.haskell.org Sat Feb 18 05:10:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 18 Feb 2017 05:10:27 +0000 (UTC) Subject: [commit: nofib] master: real: remove HMMS (3ac6f2d) Message-ID: <20170218051027.0CEFD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/nofib On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3ac6f2db09254c52a87f3f1c79798f27d390e899/nofib >--------------------------------------------------------------- commit 3ac6f2db09254c52a87f3f1c79798f27d390e899 Author: Michal Terepeta Date: Tue Feb 14 17:02:17 2017 -0500 real: remove HMMS Summary: It doesn't compile and I didn't see any easy way to fix it (I got stuck at `import Native`, which, according to a comment, comes from `hbc`). According to another comment, there were other problems with the test even when it did compile: "HMMS test only works on SPARC machines" In any case, this has been broken for a while so I don't think anyone will miss it. Signed-off-by: Michal Terepeta Test Plan: run nofib Reviewers: erikd, bgamari Reviewed By: bgamari Differential Revision: https://phabricator.haskell.org/D3088 >--------------------------------------------------------------- 3ac6f2db09254c52a87f3f1c79798f27d390e899 real/HMMS/Alignments.lhs | 76 --- real/HMMS/BalBinSTrees.lhs | 290 ------------ real/HMMS/BatchAlign.lhs | 281 ----------- real/HMMS/BatchTranscribe.lhs | 62 --- real/HMMS/COPYRIGHT | 26 -- real/HMMS/ComputeNewDgs.lhs | 203 -------- real/HMMS/ConvertLinearDic.lhs | 91 ---- real/HMMS/CountAlignmentDiffs.lhs | 91 ---- real/HMMS/DumpPhoneList.lhs | 13 - real/HMMS/Extrema.lhs | 52 --- real/HMMS/HMMS.stderr | 6 - real/HMMS/HmmConstants.lhs | 16 - real/HMMS/HmmDensities.lhs | 425 ----------------- real/HMMS/HmmDigraphs.lhs | 682 --------------------------- real/HMMS/Jmakefile | 108 ----- real/HMMS/Lists.lhs | 146 ------ real/HMMS/Makefile | 93 ---- real/HMMS/MathTypes.lhs | 12 - real/HMMS/MaybeStateT.lhs | 56 --- real/HMMS/NativeIO.lhs | 35 -- real/HMMS/Phones.lhs | 142 ------ real/HMMS/PlainTextIO.lhs | 126 ----- real/HMMS/Pronunciations.lhs | 898 ------------------------------------ real/HMMS/README | 120 ----- real/HMMS/README.nofib | 11 - real/HMMS/StateT.lhs | 124 ----- real/HMMS/Transcribe.lhs | 54 --- real/HMMS/Viterbi.lhs | 278 ----------- real/HMMS/app/test/README | 194 -------- real/HMMS/app/test/demo | 23 - real/HMMS/app/test/dictionary.0.dgs | 166 ------- real/HMMS/data/dmg_01 | Bin 62592 -> 0 bytes real/HMMS/data/dmg_01.fea | Bin 13680 -> 0 bytes real/HMMS/data/dmg_01.ppm | 16 - real/HMMS/data/dmg_01.txt | 1 - real/HMMS/data/dmg_02 | Bin 68736 -> 0 bytes real/HMMS/data/dmg_02.fea | Bin 15120 -> 0 bytes real/HMMS/data/dmg_02.ppm | 20 - real/HMMS/data/dmg_02.txt | 1 - real/HMMS/data/dmg_03 | Bin 85120 -> 0 bytes real/HMMS/data/dmg_03.fea | Bin 18792 -> 0 bytes real/HMMS/data/dmg_03.ppm | 25 - real/HMMS/data/dmg_03.txt | 1 - real/HMMS/data/dmg_04 | Bin 81536 -> 0 bytes real/HMMS/data/dmg_04.fea | Bin 18000 -> 0 bytes real/HMMS/data/dmg_04.ppm | 24 - real/HMMS/data/dmg_04.txt | 1 - real/HMMS/data/dmg_05 | Bin 117888 -> 0 bytes real/HMMS/data/dmg_05.fea | Bin 26136 -> 0 bytes real/HMMS/data/dmg_05.ppm | 42 -- real/HMMS/data/dmg_05.txt | 1 - real/HMMS/data/dmg_06 | Bin 83072 -> 0 bytes real/HMMS/data/dmg_06.fea | Bin 18360 -> 0 bytes real/HMMS/data/dmg_06.ppm | 21 - real/HMMS/data/dmg_06.txt | 1 - real/HMMS/dictionary.0 | 27 -- real/HMMS/dictionary.0.dgs | 166 ------- real/HMMS/hmms-data/h9.dgs | 368 --------------- real/HMMS/hmms-data/h9.ties | 46 -- real/HMMS/hmms-data/h9/AA.1.gm | Bin 154 -> 0 bytes real/HMMS/hmms-data/h9/AA.2.gm | Bin 66 -> 0 bytes real/HMMS/hmms-data/h9/AA.3.gm | Bin 50 -> 0 bytes real/HMMS/hmms-data/h9/AE.1.gm | Bin 6 -> 0 bytes real/HMMS/hmms-data/h9/AE.2.gm | Bin 110 -> 0 bytes real/HMMS/hmms-data/h9/AE.3.gm | Bin 49 -> 0 bytes real/HMMS/hmms-data/h9/AH.1.gm | Bin 1188 -> 0 bytes real/HMMS/hmms-data/h9/AH.2.gm | Bin 10 -> 0 bytes real/HMMS/hmms-data/h9/AH.3.gm | Bin 303 -> 0 bytes real/HMMS/hmms-data/h9/AO.1.gm | Bin 694 -> 0 bytes real/HMMS/hmms-data/h9/AO.2.gm | Bin 239 -> 0 bytes real/HMMS/hmms-data/h9/AO.3.gm | Bin 201 -> 0 bytes real/HMMS/hmms-data/h9/AW.1.gm | Bin 448 -> 0 bytes real/HMMS/hmms-data/h9/AW.2.gm | Bin 33 -> 0 bytes real/HMMS/hmms-data/h9/AW.3.gm | Bin 448 -> 0 bytes real/HMMS/hmms-data/h9/AX.1.gm | Bin 194 -> 0 bytes real/HMMS/hmms-data/h9/AX.2.gm | Bin 45 -> 0 bytes real/HMMS/hmms-data/h9/AX.3.gm | Bin 65 -> 0 bytes real/HMMS/hmms-data/h9/AXR.1.gm | Bin 354 -> 0 bytes real/HMMS/hmms-data/h9/AXR.2.gm | Bin 1188 -> 0 bytes real/HMMS/hmms-data/h9/AXR.3.gm | Bin 337 -> 0 bytes real/HMMS/hmms-data/h9/AY.1.gm | Bin 371 -> 0 bytes real/HMMS/hmms-data/h9/AY.2.gm | Bin 6 -> 0 bytes real/HMMS/hmms-data/h9/AY.3.gm | Bin 426 -> 0 bytes real/HMMS/hmms-data/h9/B.1.gm | Bin 107 -> 0 bytes real/HMMS/hmms-data/h9/B.2.gm | Bin 217 -> 0 bytes real/HMMS/hmms-data/h9/B.3.gm | Bin 744 -> 0 bytes real/HMMS/hmms-data/h9/CH.1.gm | Bin 448 -> 0 bytes real/HMMS/hmms-data/h9/CH.2.gm | Bin 66 -> 0 bytes real/HMMS/hmms-data/h9/CH.3.gm | Bin 143 -> 0 bytes real/HMMS/hmms-data/h9/D.1.gm | Bin 193 -> 0 bytes real/HMMS/hmms-data/h9/D.2.gm | Bin 234 -> 0 bytes real/HMMS/hmms-data/h9/D.3.gm | Bin 666 -> 0 bytes real/HMMS/hmms-data/h9/DH.1.gm | Bin 309 -> 0 bytes real/HMMS/hmms-data/h9/DH.2.gm | Bin 19 -> 0 bytes real/HMMS/hmms-data/h9/DH.3.gm | Bin 596 -> 0 bytes real/HMMS/hmms-data/h9/DX.1.gm | Bin 211 -> 0 bytes real/HMMS/hmms-data/h9/DX.2.gm | Bin 448 -> 0 bytes real/HMMS/hmms-data/h9/DX.3.gm | Bin 448 -> 0 bytes real/HMMS/hmms-data/h9/EH.1.gm | Bin 373 -> 0 bytes real/HMMS/hmms-data/h9/EH.2.gm | Bin 78 -> 0 bytes real/HMMS/hmms-data/h9/EH.3.gm | Bin 519 -> 0 bytes real/HMMS/hmms-data/h9/EL.1.gm | Bin 448 -> 0 bytes real/HMMS/hmms-data/h9/EL.2.gm | Bin 448 -> 0 bytes real/HMMS/hmms-data/h9/EL.3.gm | Bin 448 -> 0 bytes real/HMMS/hmms-data/h9/EN.1.gm | Bin 69 -> 0 bytes real/HMMS/hmms-data/h9/EN.2.gm | Bin 161 -> 0 bytes real/HMMS/hmms-data/h9/EN.3.gm | Bin 127 -> 0 bytes real/HMMS/hmms-data/h9/ER.1.gm | Bin 342 -> 0 bytes real/HMMS/hmms-data/h9/ER.2.gm | Bin 669 -> 0 bytes real/HMMS/hmms-data/h9/ER.3.gm | Bin 158 -> 0 bytes real/HMMS/hmms-data/h9/EY.1.gm | Bin 295 -> 0 bytes real/HMMS/hmms-data/h9/EY.2.gm | Bin 279 -> 0 bytes real/HMMS/hmms-data/h9/EY.3.gm | Bin 317 -> 0 bytes real/HMMS/hmms-data/h9/F.1.gm | Bin 155 -> 0 bytes real/HMMS/hmms-data/h9/F.2.gm | Bin 89 -> 0 bytes real/HMMS/hmms-data/h9/F.3.gm | Bin 1035 -> 0 bytes real/HMMS/hmms-data/h9/G.1.gm | Bin 150 -> 0 bytes real/HMMS/hmms-data/h9/G.2.gm | Bin 153 -> 0 bytes real/HMMS/hmms-data/h9/G.3.gm | Bin 453 -> 0 bytes real/HMMS/hmms-data/h9/HH.1.gm | Bin 306 -> 0 bytes real/HMMS/hmms-data/h9/HH.2.gm | Bin 613 -> 0 bytes real/HMMS/hmms-data/h9/HH.3.gm | Bin 406 -> 0 bytes real/HMMS/hmms-data/h9/IH.1.gm | Bin 107 -> 0 bytes real/HMMS/hmms-data/h9/IH.2.gm | Bin 138 -> 0 bytes real/HMMS/hmms-data/h9/IH.3.gm | Bin 162 -> 0 bytes real/HMMS/hmms-data/h9/IX.1.gm | Bin 301 -> 0 bytes real/HMMS/hmms-data/h9/IX.2.gm | Bin 127 -> 0 bytes real/HMMS/hmms-data/h9/IX.3.gm | Bin 106 -> 0 bytes real/HMMS/hmms-data/h9/IY.1.gm | Bin 139 -> 0 bytes real/HMMS/hmms-data/h9/IY.2.gm | Bin 153 -> 0 bytes real/HMMS/hmms-data/h9/IY.3.gm | Bin 206 -> 0 bytes real/HMMS/hmms-data/h9/JH.1.gm | Bin 242 -> 0 bytes real/HMMS/hmms-data/h9/JH.2.gm | Bin 448 -> 0 bytes real/HMMS/hmms-data/h9/JH.3.gm | Bin 448 -> 0 bytes real/HMMS/hmms-data/h9/K.1.gm | Bin 154 -> 0 bytes real/HMMS/hmms-data/h9/K.2.gm | Bin 283 -> 0 bytes real/HMMS/hmms-data/h9/K.3.gm | Bin 7 -> 0 bytes real/HMMS/hmms-data/h9/L.1.gm | Bin 177 -> 0 bytes real/HMMS/hmms-data/h9/L.2.gm | Bin 1188 -> 0 bytes real/HMMS/hmms-data/h9/L.3.gm | Bin 343 -> 0 bytes real/HMMS/hmms-data/h9/M.1.gm | Bin 206 -> 0 bytes real/HMMS/hmms-data/h9/M.2.gm | Bin 335 -> 0 bytes real/HMMS/hmms-data/h9/M.3.gm | Bin 93 -> 0 bytes real/HMMS/hmms-data/h9/N.1.gm | Bin 183 -> 0 bytes real/HMMS/hmms-data/h9/N.2.gm | Bin 87 -> 0 bytes real/HMMS/hmms-data/h9/N.3.gm | Bin 118 -> 0 bytes real/HMMS/hmms-data/h9/NG.1.gm | Bin 581 -> 0 bytes real/HMMS/hmms-data/h9/NG.2.gm | Bin 41 -> 0 bytes real/HMMS/hmms-data/h9/NG.3.gm | Bin 89 -> 0 bytes real/HMMS/hmms-data/h9/OW.1.gm | Bin 281 -> 0 bytes real/HMMS/hmms-data/h9/OW.2.gm | Bin 598 -> 0 bytes real/HMMS/hmms-data/h9/OW.3.gm | Bin 138 -> 0 bytes real/HMMS/hmms-data/h9/OY.1.gm | Bin 22 -> 0 bytes real/HMMS/hmms-data/h9/OY.2.gm | Bin 127 -> 0 bytes real/HMMS/hmms-data/h9/OY.3.gm | Bin 448 -> 0 bytes real/HMMS/hmms-data/h9/P.1.gm | Bin 30 -> 0 bytes real/HMMS/hmms-data/h9/P.2.gm | Bin 30 -> 0 bytes real/HMMS/hmms-data/h9/P.3.gm | Bin 353 -> 0 bytes real/HMMS/hmms-data/h9/R.1.gm | Bin 277 -> 0 bytes real/HMMS/hmms-data/h9/R.2.gm | Bin 153 -> 0 bytes real/HMMS/hmms-data/h9/R.3.gm | Bin 53 -> 0 bytes real/HMMS/hmms-data/h9/S.1.gm | Bin 73 -> 0 bytes real/HMMS/hmms-data/h9/S.2.gm | Bin 907 -> 0 bytes real/HMMS/hmms-data/h9/S.3.gm | Bin 314 -> 0 bytes real/HMMS/hmms-data/h9/SH.1.gm | Bin 571 -> 0 bytes real/HMMS/hmms-data/h9/SH.2.gm | Bin 945 -> 0 bytes real/HMMS/hmms-data/h9/SH.3.gm | Bin 406 -> 0 bytes real/HMMS/hmms-data/h9/SIL.1.gm | Bin 485 -> 0 bytes real/HMMS/hmms-data/h9/SIL.2.gm | Bin 453 -> 0 bytes real/HMMS/hmms-data/h9/SIL.3.gm | Bin 273 -> 0 bytes real/HMMS/hmms-data/h9/T.1.gm | Bin 257 -> 0 bytes real/HMMS/hmms-data/h9/T.2.gm | Bin 25 -> 0 bytes real/HMMS/hmms-data/h9/T.3.gm | Bin 443 -> 0 bytes real/HMMS/hmms-data/h9/TH.1.gm | Bin 145 -> 0 bytes real/HMMS/hmms-data/h9/TH.2.gm | Bin 242 -> 0 bytes real/HMMS/hmms-data/h9/TH.3.gm | Bin 390 -> 0 bytes real/HMMS/hmms-data/h9/UH.1.gm | Bin 429 -> 0 bytes real/HMMS/hmms-data/h9/UH.2.gm | Bin 82 -> 0 bytes real/HMMS/hmms-data/h9/UH.3.gm | Bin 93 -> 0 bytes real/HMMS/hmms-data/h9/UW.1.gm | Bin 35 -> 0 bytes real/HMMS/hmms-data/h9/UW.2.gm | Bin 95 -> 0 bytes real/HMMS/hmms-data/h9/UW.3.gm | Bin 521 -> 0 bytes real/HMMS/hmms-data/h9/V.1.gm | Bin 217 -> 0 bytes real/HMMS/hmms-data/h9/V.2.gm | Bin 613 -> 0 bytes real/HMMS/hmms-data/h9/V.3.gm | Bin 131 -> 0 bytes real/HMMS/hmms-data/h9/W.1.gm | Bin 346 -> 0 bytes real/HMMS/hmms-data/h9/W.2.gm | Bin 503 -> 0 bytes real/HMMS/hmms-data/h9/W.3.gm | Bin 125 -> 0 bytes real/HMMS/hmms-data/h9/Y.1.gm | Bin 147 -> 0 bytes real/HMMS/hmms-data/h9/Y.2.gm | Bin 497 -> 0 bytes real/HMMS/hmms-data/h9/Y.3.gm | Bin 319 -> 0 bytes real/HMMS/hmms-data/h9/Z.1.gm | Bin 314 -> 0 bytes real/HMMS/hmms-data/h9/Z.2.gm | Bin 1103 -> 0 bytes real/HMMS/hmms-data/h9/Z.3.gm | Bin 171 -> 0 bytes real/HMMS/hmms-data/h9/ZH.1.gm | Bin 448 -> 0 bytes real/HMMS/hmms-data/h9/ZH.2.gm | Bin 186 -> 0 bytes real/HMMS/hmms-data/h9/ZH.3.gm | Bin 25 -> 0 bytes real/HMMS/lib/haskell/GhcPrintf.hs | 163 ------- real/HMMS/lib/haskell/SignalIO.lhs | 18 - real/HMMS/sentences | 6 - real/HMMS/vocabulary | 27 -- real/Makefile | 4 +- 202 files changed, 1 insertion(+), 5878 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 3ac6f2db09254c52a87f3f1c79798f27d390e899 From git at git.haskell.org Sat Feb 18 05:10:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 18 Feb 2017 05:10:51 +0000 (UTC) Subject: [commit: ghc] master: Bump libraries/array submodule (7c057b5) Message-ID: <20170218051051.DBFEA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7c057b50e7c2efa877565fa34baba47f1fc72ccc/ghc >--------------------------------------------------------------- commit 7c057b50e7c2efa877565fa34baba47f1fc72ccc Author: Ben Gamari Date: Thu Feb 16 16:38:32 2017 -0500 Bump libraries/array submodule >--------------------------------------------------------------- 7c057b50e7c2efa877565fa34baba47f1fc72ccc libraries/array | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/array b/libraries/array index 329b2cd..c58ecfa 160000 --- a/libraries/array +++ b/libraries/array @@ -1 +1 @@ -Subproject commit 329b2cdb6452e5cfa47ad662d38b706fb9a50e7f +Subproject commit c58ecfadbe68486e9eab925c9c44d667316b2d14 From git at git.haskell.org Sat Feb 18 05:10:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 18 Feb 2017 05:10:49 +0000 (UTC) Subject: [commit: ghc] master: Bump nofib submodule (efeaf9e) Message-ID: <20170218051049.370C23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/efeaf9e436109cb35b491e08b5407c0598108186/ghc >--------------------------------------------------------------- commit efeaf9e436109cb35b491e08b5407c0598108186 Author: Ben Gamari Date: Thu Feb 16 16:38:43 2017 -0500 Bump nofib submodule >--------------------------------------------------------------- efeaf9e436109cb35b491e08b5407c0598108186 nofib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nofib b/nofib index ce4b36b..3ac6f2d 160000 --- a/nofib +++ b/nofib @@ -1 +1 @@ -Subproject commit ce4b36b56727f1bdfc318fc0f7f4c4b192781537 +Subproject commit 3ac6f2db09254c52a87f3f1c79798f27d390e899 From git at git.haskell.org Sat Feb 18 05:10:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 18 Feb 2017 05:10:54 +0000 (UTC) Subject: [commit: ghc] master: Generalize kind of the (->) tycon (b207b53) Message-ID: <20170218051054.B0FFC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b207b536ded40156f9adb168565ca78e1eef2c74/ghc >--------------------------------------------------------------- commit b207b536ded40156f9adb168565ca78e1eef2c74 Author: Ben Gamari Date: Wed Feb 1 20:25:33 2017 -0500 Generalize kind of the (->) tycon This is generalizes the kind of `(->)`, as discussed in #11714. This involves a few things, * Generalizing the kind of `funTyCon`, adding two new `RuntimeRep` binders, ```lang=haskell (->) :: forall (r1 :: RuntimeRep) (r2 :: RuntimeRep) (a :: TYPE r1) (b :: TYPE r2). a -> b -> * ``` * Unsaturated applications of `(->)` are expressed as explicit `TyConApp`s * Saturated applications of `(->)` are expressed as `FunTy` as they are currently * Saturated applications of `(->)` are expressed by a new `FunCo` constructor in coercions * `splitTyConApp` needs to ensure that `FunTy`s are split to a `TyConApp` of `(->)` with the appropriate `RuntimeRep` arguments * Teach CoreLint to check that all saturated applications of `(->)` are represented with `FunTy` At the moment I assume that `Constraint ~ *`, which is an annoying source of complexity. This will be simplified once D3023 is resolved. Also, this introduces two known regressions, `tcfail181`, `T10403` ===================== Only shows the instance, instance Monad ((->) r) -- Defined in ‘GHC.Base’ in its error message when -fprint-potential-instances is used. This is because its instance head now mentions 'LiftedRep which is not in scope. I'm not entirely sure of the right way to fix this so I'm just accepting the new output for now. T5963 (Typeable) ================ T5963 is now broken since Data.Typeable.Internals.mkFunTy computes its fingerprint without the RuntimeRep variables that (->) expects. This will be fixed with the merge of D2010. Haddock performance =================== The `haddock.base` and `haddock.Cabal` tests regress in allocations by about 20%. This certainly hurts, but it's also not entirely unexpected: the size of every function type grows with this patch and Haddock has a lot of functions in its heap. >--------------------------------------------------------------- b207b536ded40156f9adb168565ca78e1eef2c74 compiler/coreSyn/CoreFVs.hs | 1 + compiler/coreSyn/CoreLint.hs | 33 +++-- compiler/coreSyn/CoreSubst.hs | 4 +- compiler/coreSyn/TrieMap.hs | 6 +- compiler/iface/ToIface.hs | 6 +- compiler/prelude/TysPrim.hs | 27 ++-- compiler/specialise/Rules.hs | 6 + compiler/typecheck/TcCanonical.hs | 47 ++++++- compiler/typecheck/TcSMonad.hs | 2 +- compiler/typecheck/TcTyDecls.hs | 1 + compiler/typecheck/TcType.hs | 98 +++++++++++-- compiler/typecheck/TcUnify.hs | 3 + compiler/typecheck/TcValidity.hs | 1 + compiler/types/Coercion.hs | 118 +++++++++++++--- compiler/types/Coercion.hs-boot | 6 +- compiler/types/FamInstEnv.hs | 1 + compiler/types/OptCoercion.hs | 9 ++ compiler/types/TyCoRep.hs | 13 +- compiler/types/TyCon.hs | 4 +- compiler/types/Type.hs | 156 +++++++++++++++++---- compiler/types/Unify.hs | 20 ++- libraries/base/tests/all.T | 2 +- testsuite/tests/ghci/scripts/T8535.stdout | 2 +- testsuite/tests/ghci/scripts/ghci020.stdout | 2 +- testsuite/tests/ghci/should_run/T10145.stdout | 2 +- .../partial-sigs/should_compile/T10403.stderr | 3 +- testsuite/tests/perf/compiler/all.T | 3 +- testsuite/tests/perf/haddock/all.T | 6 +- testsuite/tests/typecheck/should_compile/all.T | 2 +- .../tests/typecheck/should_compile/tc167.stderr | 6 - .../tests/typecheck/should_fail/tcfail181.stderr | 5 +- 31 files changed, 480 insertions(+), 115 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 b207b536ded40156f9adb168565ca78e1eef2c74 From git at git.haskell.org Sat Feb 18 05:10:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 18 Feb 2017 05:10:58 +0000 (UTC) Subject: [commit: ghc] master: Type-indexed Typeable (8fa4bf9) Message-ID: <20170218051058.CC0E63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8fa4bf9ab3f4ea4b208f4a43cc90857987e6d497/ghc >--------------------------------------------------------------- commit 8fa4bf9ab3f4ea4b208f4a43cc90857987e6d497 Author: Ben Gamari Date: Thu Feb 2 01:29:26 2017 -0500 Type-indexed Typeable This at long last realizes the ideas for type-indexed Typeable discussed in A Reflection on Types (#11011). The general sketch of the project is described on the Wiki (Typeable/BenGamari). The general idea is that we are adding a type index to `TypeRep`, data TypeRep (a :: k) This index allows the typechecker to reason about the type represented by the `TypeRep`. This index representation mechanism is exposed as `Type.Reflection`, which also provides a number of patterns for inspecting `TypeRep`s, ```lang=haskell pattern TRFun :: forall k (fun :: k). () => forall (r1 :: RuntimeRep) (r2 :: RuntimeRep) (arg :: TYPE r1) (res :: TYPE r2). (k ~ Type, fun ~~ (arg -> res)) => TypeRep arg -> TypeRep res -> 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 match on a type constructor. pattern TRCon :: forall k (a :: k). TyCon -> TypeRep a -- | Pattern match on a type constructor including its instantiated kind -- variables. pattern TRCon' :: forall k (a :: k). TyCon -> [SomeTypeRep] -> TypeRep a ``` In addition, we give the user access to the kind of a `TypeRep` (#10343), typeRepKind :: TypeRep (a :: k) -> TypeRep k Moreover, all of this plays nicely with 8.2's levity polymorphism, including the newly levity polymorphic (->) type constructor. Library changes --------------- The primary change here is the introduction of a Type.Reflection module to base. This module provides access to the new type-indexed TypeRep introduced in this patch. We also continue to provide the unindexed Data.Typeable interface, which is simply a type synonym for the existentially quantified SomeTypeRep, data SomeTypeRep where SomeTypeRep :: TypeRep a -> SomeTypeRep Naturally, this change also touched Data.Dynamic, which can now export the Dynamic data constructor. Moreover, I removed a blanket reexport of Data.Typeable from Data.Dynamic (which itself doesn't even import Data.Typeable now). We also add a kind heterogeneous type equality type, (:~~:), to Data.Type.Equality. Implementation -------------- The implementation strategy is described in Note [Grand plan for Typeable] in TcTypeable. None of it was difficult, but it did exercise a number of parts of the new levity polymorphism story which had not yet been exercised, which took some sorting out. The rough idea is that we augment the TyCon produced for each type constructor with information about the constructor's kind (which we call a KindRep). This allows us to reconstruct the monomorphic result kind of an particular instantiation of a type constructor given its kind arguments. Unfortunately all of this takes a fair amount of work to generate and send through the compilation pipeline. In particular, the KindReps can unfortunately get quite large. Moreover, the simplifier will float out various pieces of them, resulting in numerous top-level bindings. Consequently we mark the KindRep bindings as noinline, ensuring that the float-outs don't make it into the interface file. This is important since there is generally little benefit to inlining KindReps and they would otherwise strongly affect compiler performance. Performance ----------- Initially I was hoping to also clear up the remaining holes in Typeable's coverage by adding support for both unboxed tuples (#12409) and unboxed sums (#13276). While the former was fairly straightforward, the latter ended up being quite difficult: while the implementation can support them easily, enabling this support causes thousands of Typeable bindings to be emitted to the GHC.Types as each arity-N sum tycon brings with it N promoted datacons, each of which has a KindRep whose size which itself scales with N. Doing this was simply too expensive to be practical; consequently I've disabled support for the time being. Even after disabling sums this change regresses compiler performance far more than I would like. In particular there are several testcases in the testsuite which consist mostly of types which regress by over 30% in compiler allocations. These include (considering the "bytes allocated" metric), * T1969: +10% * T10858: +23% * T3294: +19% * T5631: +41% * T6048: +23% * T9675: +20% * T9872a: +5.2% * T9872d: +12% * T9233: +10% * T10370: +34% * T12425: +30% * T12234: +16% * 13035: +17% * T4029: +6.1% I've spent quite some time chasing down the source of this regression and while I was able to make som improvements, I think this approach of generating Typeable bindings at time of type definition is doomed to give us unnecessarily large compile-time overhead. In the future I think we should consider moving some of all of the Typeable binding generation logic back to the solver (where it was prior to 91c6b1f54aea658b0056caec45655475897f1972). I've opened #13261 documenting this proposal. >--------------------------------------------------------------- 8fa4bf9ab3f4ea4b208f4a43cc90857987e6d497 compiler/backpack/RnModIface.hs | 3 + compiler/basicTypes/MkId.hs | 2 +- compiler/basicTypes/OccName.hs | 12 +- compiler/coreSyn/CoreLint.hs | 2 +- compiler/deSugar/DsBinds.hs | 101 +-- compiler/prelude/KnownUniques.hs | 47 +- compiler/prelude/PrelNames.hs | 149 ++++- compiler/prelude/THNames.hs | 32 +- compiler/prelude/TysWiredIn.hs | 4 +- compiler/rename/RnSource.hs | 29 +- compiler/typecheck/TcBackpack.hs | 4 +- compiler/typecheck/TcEvidence.hs | 19 +- compiler/typecheck/TcHsSyn.hs | 12 +- compiler/typecheck/TcInteract.hs | 46 +- compiler/typecheck/TcRnDriver.hs | 6 +- compiler/typecheck/TcTypeable.hs | 493 +++++++++++--- compiler/types/Kind.hs | 14 +- compiler/types/TyCon.hs | 6 +- compiler/types/Type.hs | 4 +- compiler/types/Type.hs-boot | 5 + compiler/utils/Binary.hs | 177 ++++- compiler/utils/Fingerprint.hsc | 1 + libraries/base/Data/Dynamic.hs | 55 +- libraries/base/Data/Type/Equality.hs | 8 + libraries/base/Data/Typeable.hs | 226 +++++-- libraries/base/Data/Typeable/Internal.hs | 736 ++++++++++++++------- libraries/base/GHC/Conc/Sync.hs | 4 - libraries/base/GHC/Show.hs | 4 +- libraries/base/Type/Reflection.hs | 67 ++ libraries/base/Type/Reflection/Unsafe.hs | 22 + libraries/base/base.cabal | 4 +- libraries/base/changelog.md | 9 + libraries/base/tests/T11334a.stdout | 2 +- libraries/base/tests/all.T | 2 +- libraries/base/tests/dynamic002.hs | 5 + libraries/base/tests/dynamic002.stdout | 2 +- libraries/base/tests/dynamic004.hs | 1 - libraries/ghc-boot/GHC/Serialized.hs | 15 +- libraries/ghc-prim/GHC/Classes.hs | 8 +- libraries/ghc-prim/GHC/Types.hs | 40 +- libraries/ghci/GHCi/Message.hs | 6 +- libraries/ghci/GHCi/TH/Binary.hs | 171 +++++ .../tests/deSugar/should_compile/T2431.stderr | 90 ++- .../tests/dependent/should_compile/RaeJobTalk.hs | 52 +- testsuite/tests/dependent/should_compile/T11711.hs | 10 +- .../dependent/should_compile/dynamic-paper.hs | 16 +- testsuite/tests/deriving/perf/all.T | 5 +- .../tests/ghci.debugger/scripts/print019.stderr | 6 +- .../should_compile/DumpTypecheckedAst.stderr | 238 +++++-- testsuite/tests/patsyn/should_compile/T12698.hs | 2 +- testsuite/tests/perf/compiler/all.T | 115 ++-- testsuite/tests/perf/haddock/all.T | 6 +- testsuite/tests/perf/should_run/all.T | 3 +- testsuite/tests/perf/space_leaks/all.T | 6 +- testsuite/tests/polykinds/T8132.hs | 5 +- testsuite/tests/polykinds/T8132.stderr | 2 +- testsuite/tests/roles/should_compile/Roles1.stderr | 156 ++++- .../tests/roles/should_compile/Roles13.stderr | 144 +++- .../tests/roles/should_compile/Roles14.stderr | 22 +- testsuite/tests/roles/should_compile/Roles2.stderr | 44 +- testsuite/tests/roles/should_compile/Roles3.stderr | 89 ++- testsuite/tests/roles/should_compile/Roles4.stderr | 46 +- testsuite/tests/roles/should_compile/T8958.stderr | 80 ++- .../tests/safeHaskell/unsafeLibs/GoodImport03.hs | 3 +- .../tests/simplCore/should_compile/T7360.stderr | 141 ++-- .../tests/simplCore/should_compile/T8274.stdout | 29 +- testsuite/tests/th/TH_Roles2.stderr | 14 +- testsuite/tests/typecheck/should_compile/tc167.hs | 6 +- .../should_fail/TcStaticPointersFail02.stderr | 4 +- .../typecheck/should_run/TestTypeableBinary.hs | 37 ++ .../typecheck/should_run/TestTypeableBinary.stdout | 15 + testsuite/tests/typecheck/should_run/TypeOf.stdout | 6 +- testsuite/tests/typecheck/should_run/TypeRep.hs | 12 +- .../tests/typecheck/should_run/TypeRep.stdout | 6 +- testsuite/tests/typecheck/should_run/Typeable1.hs | 23 + .../tests/typecheck/should_run/Typeable1.stderr | 25 + testsuite/tests/typecheck/should_run/TypeableEq.hs | 79 +++ .../tests/typecheck/should_run/TypeableEq.stdout | 10 + testsuite/tests/typecheck/should_run/all.T | 3 + 79 files changed, 3095 insertions(+), 1010 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 8fa4bf9ab3f4ea4b208f4a43cc90857987e6d497 From git at git.haskell.org Sat Feb 18 05:11:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 18 Feb 2017 05:11:01 +0000 (UTC) Subject: [commit: ghc] master: Disable Typeable binding generation for unboxed sums (42ff5d9) Message-ID: <20170218051101.89B2E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/42ff5d97b486d50b0d10e474f47e86822bb71ace/ghc >--------------------------------------------------------------- commit 42ff5d97b486d50b0d10e474f47e86822bb71ace Author: Ben Gamari Date: Sun Feb 12 09:06:00 2017 -0500 Disable Typeable binding generation for unboxed sums These things are simply too expensive to generate at the moment. More work is needed here; see #13276 and #13261. >--------------------------------------------------------------- 42ff5d97b486d50b0d10e474f47e86822bb71ace compiler/prelude/TysWiredIn.hs | 7 +++++-- compiler/types/TyCon.hs | 9 +++++---- testsuite/tests/perf/compiler/all.T | 4 ++-- testsuite/tests/th/TH_Roles2.stderr | 4 ++-- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/compiler/prelude/TysWiredIn.hs b/compiler/prelude/TysWiredIn.hs index 85771a0..b683564 100644 --- a/compiler/prelude/TysWiredIn.hs +++ b/compiler/prelude/TysWiredIn.hs @@ -865,7 +865,7 @@ mk_tuple Unboxed arity = (tycon, tuple_con) tc_res_kind = unboxedTupleKind rr_tys tc_arity = arity * 2 - flavour = UnboxedAlgTyCon (mkPrelTyConRepName tc_name) + flavour = UnboxedAlgTyCon $ Just (mkPrelTyConRepName tc_name) dc_tvs = binderVars tc_binders (rr_tys, dc_arg_tys) = splitAt arity (mkTyVarTys dc_tvs) @@ -974,7 +974,10 @@ mk_sum :: Arity -> (TyCon, Array ConTagZ DataCon) mk_sum arity = (tycon, sum_cons) where tycon = mkSumTyCon tc_name tc_binders tc_res_kind (arity * 2) tyvars (elems sum_cons) - (UnboxedAlgTyCon (mkPrelTyConRepName tc_name)) + (UnboxedAlgTyCon rep_name) + + -- Unboxed sums are currently not Typeable due to efficiency concerns. See #13276. + rep_name = Nothing -- Just $ mkPrelTyConRepName tc_name tc_binders = mkTemplateTyConBinders (nOfThem arity runtimeRepTy) (\ks -> map tYPE ks) diff --git a/compiler/types/TyCon.hs b/compiler/types/TyCon.hs index 7140009..8f1082d 100644 --- a/compiler/types/TyCon.hs +++ b/compiler/types/TyCon.hs @@ -895,10 +895,11 @@ data AlgTyConFlav VanillaAlgTyCon TyConRepName - -- | An unboxed type constructor. Note that this carries no TyConRepName - -- as it is not representable. + -- | An unboxed type constructor. The TyConRepName is a Maybe since we + -- currently don't allow unboxed sums to be Typeable since there are too + -- many of them. See #13276. | UnboxedAlgTyCon - TyConRepName + (Maybe TyConRepName) -- | Type constructors representing a class dictionary. -- See Note [ATyCon for classes] in TyCoRep @@ -1170,7 +1171,7 @@ tyConRepName_maybe (PrimTyCon { primRepName = mb_rep_nm }) tyConRepName_maybe (AlgTyCon { algTcParent = parent }) | VanillaAlgTyCon rep_nm <- parent = Just rep_nm | ClassTyCon _ rep_nm <- parent = Just rep_nm - | UnboxedAlgTyCon rep_nm <- parent = Just rep_nm + | UnboxedAlgTyCon rep_nm <- parent = rep_nm tyConRepName_maybe (FamilyTyCon { famTcFlav = DataFamilyTyCon rep_nm }) = Just rep_nm tyConRepName_maybe (PromotedDataCon { tcRepName = rep_nm }) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index 24b03d0..7ebfb89 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -926,10 +926,10 @@ test('T12227', test('T12425', [ only_ways(['optasm']), compiler_stats_num_field('bytes allocated', - [(wordsize(64), 173257664, 5), + [(wordsize(64), 153611448, 5), # initial: 125831400 # 2017-01-18: 133380960 Allow top-level string literals in Core - # 2017-02-17: 173257664 Type-indexed Typeable + # 2017-02-17: 153611448 Type-indexed Typeable ]), ], compile, diff --git a/testsuite/tests/th/TH_Roles2.stderr b/testsuite/tests/th/TH_Roles2.stderr index 7b872aa..3027911 100644 --- a/testsuite/tests/th/TH_Roles2.stderr +++ b/testsuite/tests/th/TH_Roles2.stderr @@ -16,8 +16,8 @@ TH_Roles2.$tcT TH_Roles2.$trModule (GHC.Types.TrNameS "T"#) 1 - krep_a7XD -krep_a7XD [InlPrag=[~]] + krep_a4im +krep_a4im [InlPrag=[~]] = GHC.Types.KindRepFun (GHC.Types.KindRepVar 0) (GHC.Types.KindRepTYPE GHC.Types.LiftedRep) From git at git.haskell.org Sat Feb 18 08:29:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 18 Feb 2017 08:29:40 +0000 (UTC) Subject: [commit: ghc] master: Improve Haddock documentation for compact. (98e494a) Message-ID: <20170218082940.A77593A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/98e494afed3c73f88ff1d57a9ca46b1f6ddbd1b9/ghc >--------------------------------------------------------------- commit 98e494afed3c73f88ff1d57a9ca46b1f6ddbd1b9 Author: Edward Z. Yang Date: Fri Feb 17 17:30:16 2017 -0800 Improve Haddock documentation for compact. Test Plan: none Reviewers: simonmar, bgamari, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3148 >--------------------------------------------------------------- 98e494afed3c73f88ff1d57a9ca46b1f6ddbd1b9 libraries/compact/Data/Compact.hs | 89 +++++++++++++++++++++++----- libraries/compact/Data/Compact/Internal.hs | 42 ++++++++----- libraries/compact/Data/Compact/Serialized.hs | 14 ++--- 3 files changed, 110 insertions(+), 35 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 98e494afed3c73f88ff1d57a9ca46b1f6ddbd1b9 From git at git.haskell.org Sat Feb 18 20:28:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 18 Feb 2017 20:28:21 +0000 (UTC) Subject: [commit: ghc] wip/embelleshed-rdr: Add HsEmbellished type to hsSyn (43a082b) Message-ID: <20170218202821.659233A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/embelleshed-rdr Link : http://ghc.haskell.org/trac/ghc/changeset/43a082bb59310d10d3c7550d5cbeaab384ca4c76/ghc >--------------------------------------------------------------- commit 43a082bb59310d10d3c7550d5cbeaab384ca4c76 Author: Alan Zimmerman Date: Fri Feb 17 12:13:14 2017 +0200 Add HsEmbellished type to hsSyn Summary: A RdrName can be parsed with parens or backquotes if it is used prefix or infix respectively when it is normally not used that way. This is not captured in hsSyn, and must be inferred from the occName when pretty printing, or using the API annotations. Introduce a wrapper type around the name to capture this data Embellished name = EName name | EParens (Located name) | EBackquotes (Located name) So that we now have data HsExpr id = HsVar (LEmbellished id) -- ^ Variable and in the other relevant points in hsSyn. Test Plan: ./validate Reviewers: bgamari, austin, goldfire Subscribers: goldfire, thomie, mpickering, snowleopard Differential Revision: https://phabricator.haskell.org/D3145 >--------------------------------------------------------------- 43a082bb59310d10d3c7550d5cbeaab384ca4c76 compiler/deSugar/Check.hs | 4 +- compiler/deSugar/Coverage.hs | 2 +- compiler/deSugar/Desugar.hs | 4 +- compiler/deSugar/DsArrows.hs | 2 +- compiler/deSugar/DsExpr.hs | 2 +- compiler/deSugar/DsGRHSs.hs | 4 +- compiler/deSugar/DsMeta.hs | 96 ++++----- compiler/deSugar/DsUtils.hs | 2 +- compiler/deSugar/Match.hs | 2 +- compiler/deSugar/PmExpr.hs | 2 +- compiler/ghc.cabal.in | 1 + compiler/ghc.mk | 1 + compiler/hsSyn/Convert.hs | 82 ++++---- compiler/hsSyn/HsBinds.hs | 23 ++- compiler/hsSyn/HsDecls.hs | 35 ++-- compiler/hsSyn/HsEmbellished.hs | 63 ++++++ compiler/hsSyn/HsExpr.hs | 14 +- compiler/hsSyn/HsPat.hs | 5 +- compiler/hsSyn/HsSyn.hs | 2 + compiler/hsSyn/HsTypes.hs | 28 +-- compiler/hsSyn/HsUtils.hs | 54 ++--- compiler/main/HscMain.hs | 2 +- compiler/main/InteractiveEval.hs | 5 +- compiler/parser/ApiAnnotation.hs | 1 - compiler/parser/Parser.y | 220 ++++++++++----------- compiler/parser/RdrHsSyn.hs | 92 +++++---- compiler/rename/RnBinds.hs | 69 +++---- compiler/rename/RnEnv.hs | 36 +++- compiler/rename/RnExpr.hs | 28 +-- compiler/rename/RnNames.hs | 30 +-- compiler/rename/RnPat.hs | 45 +++-- compiler/rename/RnSource.hs | 66 ++++--- compiler/rename/RnSplice.hs | 8 +- compiler/rename/RnTypes.hs | 17 +- compiler/typecheck/Inst.hs | 6 +- compiler/typecheck/TcAnnotations.hs | 3 +- compiler/typecheck/TcBinds.hs | 31 +-- compiler/typecheck/TcClassDcl.hs | 10 +- compiler/typecheck/TcEnv.hs | 8 +- compiler/typecheck/TcErrors.hs | 3 +- compiler/typecheck/TcExpr.hs | 76 +++---- compiler/typecheck/TcGenDeriv.hs | 12 +- compiler/typecheck/TcHsSyn.hs | 22 +-- compiler/typecheck/TcHsType.hs | 2 +- compiler/typecheck/TcInstDcls.hs | 4 +- compiler/typecheck/TcPat.hs | 11 +- compiler/typecheck/TcPatSyn.hs | 33 ++-- compiler/typecheck/TcRnDriver.hs | 2 +- compiler/typecheck/TcRnTypes.hs | 5 +- compiler/typecheck/TcSigs.hs | 34 ++-- compiler/typecheck/TcSplice.hs | 2 +- compiler/typecheck/TcTyClsDecls.hs | 28 +-- compiler/typecheck/TcTyDecls.hs | 16 +- ghc/GHCi/UI/Info.hs | 2 +- testsuite/tests/ghc-api/annotations/T10357.stdout | 2 - testsuite/tests/ghc-api/annotations/T11321.stdout | 1 - testsuite/tests/ghc-api/annotations/T13163.stdout | 7 - testsuite/tests/ghc-api/landmines/landmines.stdout | 2 +- .../tests/parser/should_compile/DumpParsedAst.hs | 4 + .../parser/should_compile/DumpParsedAst.stderr | 160 +++++++++++++-- .../parser/should_compile/DumpRenamedAst.stderr | 36 ++-- .../should_compile/DumpTypecheckedAst.stderr | 32 +-- testsuite/tests/quasiquotation/T7918.hs | 4 +- utils/ghctags/Main.hs | 6 +- utils/haddock | 2 +- 65 files changed, 963 insertions(+), 650 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 43a082bb59310d10d3c7550d5cbeaab384ca4c76 From git at git.haskell.org Sat Feb 18 20:28:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 18 Feb 2017 20:28:23 +0000 (UTC) Subject: [commit: ghc] wip/embelleshed-rdr's head updated: Add HsEmbellished type to hsSyn (43a082b) Message-ID: <20170218202823.8699A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/embelleshed-rdr' now includes: 8d401e5 Honour -dsuppress-uniques more thoroughly e55986a Fix a substitution bug in cseCase 0e76017 Simplify OutputableBndr ca54315 Fix a Backpack recompilation avoidance bug when signatures change. 22dba98 Fix recompilation tracking on signatures. fd2d5b6 Improvements/bugfixes to signature reexport handling. 8916884 Say 'data' explicitly in IfAbstractTyCon output. 7c057b5 Bump libraries/array submodule efeaf9e Bump nofib submodule b207b53 Generalize kind of the (->) tycon 8fa4bf9 Type-indexed Typeable 42ff5d9 Disable Typeable binding generation for unboxed sums 98e494a Improve Haddock documentation for compact. 43a082b Add HsEmbellished type to hsSyn From git at git.haskell.org Sun Feb 19 11:43:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 19 Feb 2017 11:43:22 +0000 (UTC) Subject: [commit: ghc] master: Remove ghc-api/landmine tests (dae5003) Message-ID: <20170219114322.D9F563A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/dae50032c1f17e49d115c853752259c35cc9840c/ghc >--------------------------------------------------------------- commit dae50032c1f17e49d115c853752259c35cc9840c Author: Alan Zimmerman Date: Sun Feb 19 13:40:52 2017 +0200 Remove ghc-api/landmine tests They take a long time to run, and are effectively superseded by the -ddump-*-ast tests. >--------------------------------------------------------------- dae50032c1f17e49d115c853752259c35cc9840c testsuite/tests/ghc-api/landmines/.gitignore | 5 -- testsuite/tests/ghc-api/landmines/Makefile | 13 ---- testsuite/tests/ghc-api/landmines/MineFixity.hs | 23 ------ testsuite/tests/ghc-api/landmines/MineKind.hs | 26 ------- testsuite/tests/ghc-api/landmines/MineNames.hs | 22 ------ testsuite/tests/ghc-api/landmines/MineType.hs | 21 ----- testsuite/tests/ghc-api/landmines/all.T | 2 - testsuite/tests/ghc-api/landmines/landmines.hs | 90 ---------------------- testsuite/tests/ghc-api/landmines/landmines.stdout | 4 - 9 files changed, 206 deletions(-) diff --git a/testsuite/tests/ghc-api/landmines/.gitignore b/testsuite/tests/ghc-api/landmines/.gitignore deleted file mode 100644 index 1452e78..0000000 --- a/testsuite/tests/ghc-api/landmines/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -landmines -*.hi -*.o -*.run.* -*.normalised diff --git a/testsuite/tests/ghc-api/landmines/Makefile b/testsuite/tests/ghc-api/landmines/Makefile deleted file mode 100644 index c727b95..0000000 --- a/testsuite/tests/ghc-api/landmines/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -TOP=../../.. -include $(TOP)/mk/boilerplate.mk -include $(TOP)/mk/test.mk - -clean: - rm -f *.o *.hi - -landmines: clean - '$(TEST_HC)' $(TEST_HC_OPTS) --make -v0 -package ghc landmines - ./landmines "`'$(TEST_HC)' $(TEST_HC_OPTS) --print-libdir | tr -d '\r'`" - - -.PHONY: clean landmines diff --git a/testsuite/tests/ghc-api/landmines/MineFixity.hs b/testsuite/tests/ghc-api/landmines/MineFixity.hs deleted file mode 100644 index a735ee6..0000000 --- a/testsuite/tests/ghc-api/landmines/MineFixity.hs +++ /dev/null @@ -1,23 +0,0 @@ -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE KindSignatures #-} -{-# LANGUAGE TypeOperators #-} -{- - -Exercising avoidance of known landmines. - -We need one each of - - PostTc id Kind - PostTc id Type - - PostRn id Fixity - PostRn id NameSet - - --} -module MineFixity where - -infixl 3 `foo` - -foo = undefined diff --git a/testsuite/tests/ghc-api/landmines/MineKind.hs b/testsuite/tests/ghc-api/landmines/MineKind.hs deleted file mode 100644 index c97a996..0000000 --- a/testsuite/tests/ghc-api/landmines/MineKind.hs +++ /dev/null @@ -1,26 +0,0 @@ -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE KindSignatures #-} -{-# LANGUAGE TypeOperators #-} -{- - -Exercising avoidance of known landmines. - -We need one each of - - PostTc id Kind - PostTc id Type - - PostRn id Fixity - PostRn id NameSet - - --} -module MineKind where - -data HList :: [*] -> * where - HNil :: HList '[] - HCons :: a -> HList t -> HList (a ': t) - -data Tuple :: (*,*) -> * where - Tuple :: a -> b -> Tuple '(a,b) diff --git a/testsuite/tests/ghc-api/landmines/MineNames.hs b/testsuite/tests/ghc-api/landmines/MineNames.hs deleted file mode 100644 index af5362f..0000000 --- a/testsuite/tests/ghc-api/landmines/MineNames.hs +++ /dev/null @@ -1,22 +0,0 @@ -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE KindSignatures #-} -{-# LANGUAGE TypeOperators #-} -{- - -Exercising avoidance of known landmines. - -We need one each of - - PostTc id Kind - PostTc id Type - - PostRn id Fixity - PostRn id NameSet - - --} -module MineNames where - -foo :: Int -foo = 1 diff --git a/testsuite/tests/ghc-api/landmines/MineType.hs b/testsuite/tests/ghc-api/landmines/MineType.hs deleted file mode 100644 index 142d7c9..0000000 --- a/testsuite/tests/ghc-api/landmines/MineType.hs +++ /dev/null @@ -1,21 +0,0 @@ -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE GADTs #-} -{-# LANGUAGE KindSignatures #-} -{-# LANGUAGE TypeOperators #-} -{- - -Exercising avoidance of known landmines. - -We need one each of - - PostTc id Kind - PostTc id Type - - PostRn id Fixity - PostRn id NameSet - - --} -module MineType where - -foo = undefined diff --git a/testsuite/tests/ghc-api/landmines/all.T b/testsuite/tests/ghc-api/landmines/all.T deleted file mode 100644 index b03a97f..0000000 --- a/testsuite/tests/ghc-api/landmines/all.T +++ /dev/null @@ -1,2 +0,0 @@ -test('landmines', normal, run_command, ['$MAKE -s --no-print-directory landmines']) - diff --git a/testsuite/tests/ghc-api/landmines/landmines.hs b/testsuite/tests/ghc-api/landmines/landmines.hs deleted file mode 100644 index 9b058fa..0000000 --- a/testsuite/tests/ghc-api/landmines/landmines.hs +++ /dev/null @@ -1,90 +0,0 @@ -{-# LANGUAGE RankNTypes #-} - --- This program must be called with GHC's libdir as the single command line --- argument. -module Main where - --- import Data.Generics -import Data.Data -import System.IO -import GHC -import MonadUtils -import Outputable -import Bag (filterBag,isEmptyBag) -import System.Directory (removeFile) -import System.Environment( getArgs ) - -main::IO() -main = do - [libdir] <- getArgs - testOneFile libdir "MineFixity" - testOneFile libdir "MineKind" - testOneFile libdir "MineNames" - testOneFile libdir "MineType" - - -testOneFile libdir fileName = do - (p,r,ts) <- runGhc (Just libdir) $ do - dflags <- getSessionDynFlags - setSessionDynFlags dflags - let mn =mkModuleName fileName - addTarget Target { targetId = TargetModule mn - , targetAllowObjCode = True - , targetContents = Nothing } - load LoadAllTargets - modSum <- getModSummary mn - p <- parseModule modSum - t <- typecheckModule p - d <- desugarModule t - l <- loadModule d - let ts=typecheckedSource l - r =renamedSource l - -- liftIO (putStr (showSDocDebug (ppr ts))) - return (pm_parsed_source p,r,ts) - let pCount = gq p - rCount = gq r - tsCount = gq ts - - print (pCount,rCount,tsCount) - where - gq ast = length $ everything (++) ([] `mkQ` worker) ast - - worker (s@(RealSrcSpan _)) = [s] - worker _ = [] - --- --------------------------------------------------------------------- - --- Copied from syb for the test - - --- | Generic queries of type \"r\", --- i.e., take any \"a\" and return an \"r\" --- -type GenericQ r = forall a. Data a => a -> r - - --- | Make a generic query; --- start from a type-specific case; --- return a constant otherwise --- -mkQ :: ( Typeable a - , Typeable b - ) - => r - -> (b -> r) - -> a - -> r -(r `mkQ` br) a = case cast a of - Just b -> br b - Nothing -> r - - - --- | Summarise all nodes in top-down, left-to-right order -everything :: (r -> r -> r) -> GenericQ r -> GenericQ r - --- Apply f to x to summarise top-level node; --- use gmapQ to recurse into immediate subterms; --- use ordinary foldl to reduce list of intermediate results - -everything k f x = foldl k (f x) (gmapQ (everything k f) x) diff --git a/testsuite/tests/ghc-api/landmines/landmines.stdout b/testsuite/tests/ghc-api/landmines/landmines.stdout deleted file mode 100644 index 61ddb37..0000000 --- a/testsuite/tests/ghc-api/landmines/landmines.stdout +++ /dev/null @@ -1,4 +0,0 @@ -(12,12,8) -(93,63,0) -(15,13,8) -(10,10,8) From git at git.haskell.org Mon Feb 20 01:06:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 01:06:31 +0000 (UTC) Subject: [commit: ghc] branch 'wip/rwbarton-biniface' created Message-ID: <20170220010631.9A0CA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/rwbarton-biniface Referencing: 36fdaf672d7dcafd56ae3710635720310feeb0a0 From git at git.haskell.org Mon Feb 20 01:06:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 01:06:35 +0000 (UTC) Subject: [commit: ghc] wip/rwbarton-biniface: Ensure that Literals are in range (c63b2dc) Message-ID: <20170220010635.327B03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rwbarton-biniface Link : http://ghc.haskell.org/trac/ghc/changeset/c63b2dc9cf9d09788d64de48f07f9640aac2a3fe/ghc >--------------------------------------------------------------- commit c63b2dc9cf9d09788d64de48f07f9640aac2a3fe Author: Joachim Breitner Date: Thu Feb 9 15:28:54 2017 -0500 Ensure that Literals are in range Summary: This commit fixes several bugs related to case expressions involving numeric literals which are not in the range of values of their (fixed-width, integral) type. There is a new invariant on Literal: The argument of a MachInt[64] or MachWord[64] must lie within the range of the corresponding primitive type Int[64]# or Word[64]#, as defined by the target machine. This invariant is enforced in mkMachInt[64]/mkMachWord[64] by wrapping the argument to the target type's range if necessary. Test Plan: make slowtest TEST="T9533 T9533b T9533c T10245 T10246" Reviewers: simonmar, simonpj, austin, bgamari, nomeata Subscribers: thomie, rwbarton Differential Revision: https://phabricator.haskell.org/D810 GHC Trac Issues: #9533, #10245, #10246, #13171 >--------------------------------------------------------------- c63b2dc9cf9d09788d64de48f07f9640aac2a3fe compiler/basicTypes/Literal.hs | 81 +++++++++++++++++----- compiler/deSugar/Match.hs | 45 ++++++++++-- compiler/deSugar/MatchLit.hs | 43 +++++------- compiler/simplCore/SimplUtils.hs | 3 +- testsuite/tests/codeGen/should_run/T9533.hs | 13 ++++ .../should_run/T9533.stdout} | 0 testsuite/tests/codeGen/should_run/T9533b.hs | 8 +++ testsuite/tests/codeGen/should_run/T9533b.stdout | 1 + testsuite/tests/codeGen/should_run/T9533c.hs | 8 +++ .../should_run/T9533c.stdout} | 0 testsuite/tests/codeGen/should_run/all.T | 7 +- 11 files changed, 157 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 c63b2dc9cf9d09788d64de48f07f9640aac2a3fe From git at git.haskell.org Mon Feb 20 01:06:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 01:06:40 +0000 (UTC) Subject: [commit: ghc] wip/rwbarton-biniface: Avoid using Binary Integer instance excessively in Literal (3fa9d77) Message-ID: <20170220010640.93CC03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rwbarton-biniface Link : http://ghc.haskell.org/trac/ghc/changeset/3fa9d77f36d94a1926a065d7cad7ab9208205d63/ghc >--------------------------------------------------------------- commit 3fa9d77f36d94a1926a065d7cad7ab9208205d63 Author: Reid Barton Date: Sun Feb 19 20:05:25 2017 -0500 Avoid using Binary Integer instance excessively in Literal >--------------------------------------------------------------- 3fa9d77f36d94a1926a065d7cad7ab9208205d63 compiler/basicTypes/Literal.hs | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/compiler/basicTypes/Literal.hs b/compiler/basicTypes/Literal.hs index cc53b47..2f3fdf5 100644 --- a/compiler/basicTypes/Literal.hs +++ b/compiler/basicTypes/Literal.hs @@ -152,10 +152,23 @@ instance Binary Literal where put_ bh (MachChar aa) = do putByte bh 0; put_ bh aa put_ bh (MachStr ab) = do putByte bh 1; put_ bh ab put_ bh (MachNullAddr) = do putByte bh 2 - put_ bh (MachInt ad) = do putByte bh 3; put_ bh ad - put_ bh (MachInt64 ae) = do putByte bh 4; put_ bh ae - put_ bh (MachWord af) = do putByte bh 5; put_ bh af - put_ bh (MachWord64 ag) = do putByte bh 6; put_ bh ag + + -- The target int/word sizes should at least fit within 64 bits, + -- so let's not use the (truly awful) Binary Integer instance + -- if we can avoid it. + put_ bh (MachInt ad) = ASSERT2( inInt64Range x, integer x ) + do putByte bh 3 + put_ bh (fromInteger ad :: Int64) + put_ bh (MachInt64 ae) = ASSERT2( inInt64Range x, integer x ) + do putByte bh 4 + put_ bh (fromInteger ad :: Int64) + put_ bh (MachWord af) = ASSERT2( inWord64Range x, integer x ) + do putByte bh 5 + put_ bh (fromInteger af :: Word64) + put_ bh (MachWord64 ag) = ASSERT2( inWord64Range x, integer x ) + do putByte bh 6 + put_ bh (fromInteger ag :: Word64) + put_ bh (MachFloat ah) = do putByte bh 7; put_ bh ah put_ bh (MachDouble ai) = do putByte bh 8; put_ bh ai put_ bh (MachLabel aj mb fod) @@ -177,16 +190,16 @@ instance Binary Literal where return (MachNullAddr) 3 -> do ad <- get bh - return (MachInt ad) + return (MachInt (toInteger (ad :: Int64))) 4 -> do ae <- get bh - return (MachInt64 ae) + return (MachInt64 (toInteger (ae :: Int64))) 5 -> do af <- get bh - return (MachWord af) + return (MachWord (toInteger (af :: Word64))) 6 -> do ag <- get bh - return (MachWord64 ag) + return (MachWord64 (toInteger (ag :: Word64))) 7 -> do ah <- get bh return (MachFloat ah) From git at git.haskell.org Mon Feb 20 01:06:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 01:06:37 +0000 (UTC) Subject: [commit: ghc] wip/rwbarton-biniface: Use half as much memory when reading interfaces (285be06) Message-ID: <20170220010637.D55703A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rwbarton-biniface Link : http://ghc.haskell.org/trac/ghc/changeset/285be0626a28980e87c1c8afb628b0ca0f7d08f4/ghc >--------------------------------------------------------------- commit 285be0626a28980e87c1c8afb628b0ca0f7d08f4 Author: Reid Barton Date: Sun Feb 19 20:05:06 2017 -0500 Use half as much memory when reading interfaces >--------------------------------------------------------------- 285be0626a28980e87c1c8afb628b0ca0f7d08f4 compiler/utils/Binary.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/utils/Binary.hs b/compiler/utils/Binary.hs index 07eb3bc..4345654 100644 --- a/compiler/utils/Binary.hs +++ b/compiler/utils/Binary.hs @@ -197,7 +197,7 @@ readBinMem filename = do h <- openBinaryFile filename ReadMode filesize' <- hFileSize h let filesize = fromIntegral filesize' - arr <- mallocForeignPtrBytes (filesize*2) + arr <- mallocForeignPtrBytes filesize count <- withForeignPtr arr $ \p -> hGetBuf h p filesize when (count /= filesize) $ error ("Binary.readBinMem: only read " ++ show count ++ " bytes") From git at git.haskell.org Mon Feb 20 01:06:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 01:06:43 +0000 (UTC) Subject: [commit: ghc] wip/rwbarton-biniface: Boundary condition fixes for Binary (36fdaf6) Message-ID: <20170220010643.49D993A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rwbarton-biniface Link : http://ghc.haskell.org/trac/ghc/changeset/36fdaf672d7dcafd56ae3710635720310feeb0a0/ghc >--------------------------------------------------------------- commit 36fdaf672d7dcafd56ae3710635720310feeb0a0 Author: Reid Barton Date: Sun Feb 19 20:06:13 2017 -0500 Boundary condition fixes for Binary >--------------------------------------------------------------- 36fdaf672d7dcafd56ae3710635720310feeb0a0 compiler/utils/Binary.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/compiler/utils/Binary.hs b/compiler/utils/Binary.hs index 4345654..7ed45ed 100644 --- a/compiler/utils/Binary.hs +++ b/compiler/utils/Binary.hs @@ -91,6 +91,7 @@ data BinHandle = BinMem { -- binary data stored in an unboxed array bh_usr :: UserData, -- sigh, need parameterized modules :-) _off_r :: !FastMutInt, -- the current offset + -- Invariant: _off_r <= _sz_r _sz_r :: !FastMutInt, -- size of the array (cached) _arr_r :: !(IORef BinArray) -- the array (bounds: (0,size-1)) } @@ -164,7 +165,7 @@ tellBin (BinMem _ r _ _) = do ix <- readFastMutInt r; return (BinPtr ix) seekBin :: BinHandle -> Bin a -> IO () seekBin h@(BinMem _ ix_r sz_r _) (BinPtr p) = do sz <- readFastMutInt sz_r - if (p >= sz) + if (p > sz) then do expandBin h p; writeFastMutInt ix_r p else writeFastMutInt ix_r p @@ -173,7 +174,7 @@ seekBy h@(BinMem _ ix_r sz_r _) off = do sz <- readFastMutInt sz_r ix <- readFastMutInt ix_r let ix' = ix + off - if (ix' >= sz) + if (ix' > sz) then do expandBin h ix'; writeFastMutInt ix_r ix' else writeFastMutInt ix_r ix' @@ -209,7 +210,8 @@ readBinMem filename = do writeFastMutInt sz_r filesize return (BinMem noUserData ix_r sz_r arr_r) --- expand the size of the array to include a specified offset +-- expand the size of the array to strictly include a specified offset +-- (i.e., not at EOF, so we can write at least one byte there) expandBin :: BinHandle -> Int -> IO () expandBin (BinMem _ _ sz_r arr_r) off = do sz <- readFastMutInt sz_r From git at git.haskell.org Mon Feb 20 02:14:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 02:14:06 +0000 (UTC) Subject: [commit: ghc] wip/rwbarton-biniface: Avoid using Binary Integer instance excessively in Literal (a07c07b) Message-ID: <20170220021406.0B4E93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rwbarton-biniface Link : http://ghc.haskell.org/trac/ghc/changeset/a07c07b974d9754057a18ca52574824ee2fada04/ghc >--------------------------------------------------------------- commit a07c07b974d9754057a18ca52574824ee2fada04 Author: Reid Barton Date: Sun Feb 19 20:05:25 2017 -0500 Avoid using Binary Integer instance excessively in Literal >--------------------------------------------------------------- a07c07b974d9754057a18ca52574824ee2fada04 compiler/basicTypes/Literal.hs | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/compiler/basicTypes/Literal.hs b/compiler/basicTypes/Literal.hs index cc53b47..959a8a3 100644 --- a/compiler/basicTypes/Literal.hs +++ b/compiler/basicTypes/Literal.hs @@ -152,10 +152,23 @@ instance Binary Literal where put_ bh (MachChar aa) = do putByte bh 0; put_ bh aa put_ bh (MachStr ab) = do putByte bh 1; put_ bh ab put_ bh (MachNullAddr) = do putByte bh 2 - put_ bh (MachInt ad) = do putByte bh 3; put_ bh ad - put_ bh (MachInt64 ae) = do putByte bh 4; put_ bh ae - put_ bh (MachWord af) = do putByte bh 5; put_ bh af - put_ bh (MachWord64 ag) = do putByte bh 6; put_ bh ag + + -- The target int/word sizes should at least fit within 64 bits, + -- so let's not use the (truly awful) Binary Integer instance + -- if we can avoid it. + put_ bh (MachInt ad) = ASSERT2( inInt64Range ad, integer ad ) + do putByte bh 3 + put_ bh (fromInteger ad :: Int64) + put_ bh (MachInt64 ae) = ASSERT2( inInt64Range ae, integer ae ) + do putByte bh 4 + put_ bh (fromInteger ae :: Int64) + put_ bh (MachWord af) = ASSERT2( inWord64Range af, integer af ) + do putByte bh 5 + put_ bh (fromInteger af :: Word64) + put_ bh (MachWord64 ag) = ASSERT2( inWord64Range ag, integer ag ) + do putByte bh 6 + put_ bh (fromInteger ag :: Word64) + put_ bh (MachFloat ah) = do putByte bh 7; put_ bh ah put_ bh (MachDouble ai) = do putByte bh 8; put_ bh ai put_ bh (MachLabel aj mb fod) @@ -177,16 +190,16 @@ instance Binary Literal where return (MachNullAddr) 3 -> do ad <- get bh - return (MachInt ad) + return (MachInt (toInteger (ad :: Int64))) 4 -> do ae <- get bh - return (MachInt64 ae) + return (MachInt64 (toInteger (ae :: Int64))) 5 -> do af <- get bh - return (MachWord af) + return (MachWord (toInteger (af :: Word64))) 6 -> do ag <- get bh - return (MachWord64 ag) + return (MachWord64 (toInteger (ag :: Word64))) 7 -> do ah <- get bh return (MachFloat ah) From git at git.haskell.org Mon Feb 20 02:14:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 02:14:08 +0000 (UTC) Subject: [commit: ghc] wip/rwbarton-biniface: Boundary condition fixes for Binary (d405c7a) Message-ID: <20170220021408.B6EE13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rwbarton-biniface Link : http://ghc.haskell.org/trac/ghc/changeset/d405c7a4adf506c7b4c9b638582b84568fb19396/ghc >--------------------------------------------------------------- commit d405c7a4adf506c7b4c9b638582b84568fb19396 Author: Reid Barton Date: Sun Feb 19 20:06:13 2017 -0500 Boundary condition fixes for Binary >--------------------------------------------------------------- d405c7a4adf506c7b4c9b638582b84568fb19396 compiler/utils/Binary.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/compiler/utils/Binary.hs b/compiler/utils/Binary.hs index 4345654..7ed45ed 100644 --- a/compiler/utils/Binary.hs +++ b/compiler/utils/Binary.hs @@ -91,6 +91,7 @@ data BinHandle = BinMem { -- binary data stored in an unboxed array bh_usr :: UserData, -- sigh, need parameterized modules :-) _off_r :: !FastMutInt, -- the current offset + -- Invariant: _off_r <= _sz_r _sz_r :: !FastMutInt, -- size of the array (cached) _arr_r :: !(IORef BinArray) -- the array (bounds: (0,size-1)) } @@ -164,7 +165,7 @@ tellBin (BinMem _ r _ _) = do ix <- readFastMutInt r; return (BinPtr ix) seekBin :: BinHandle -> Bin a -> IO () seekBin h@(BinMem _ ix_r sz_r _) (BinPtr p) = do sz <- readFastMutInt sz_r - if (p >= sz) + if (p > sz) then do expandBin h p; writeFastMutInt ix_r p else writeFastMutInt ix_r p @@ -173,7 +174,7 @@ seekBy h@(BinMem _ ix_r sz_r _) off = do sz <- readFastMutInt sz_r ix <- readFastMutInt ix_r let ix' = ix + off - if (ix' >= sz) + if (ix' > sz) then do expandBin h ix'; writeFastMutInt ix_r ix' else writeFastMutInt ix_r ix' @@ -209,7 +210,8 @@ readBinMem filename = do writeFastMutInt sz_r filesize return (BinMem noUserData ix_r sz_r arr_r) --- expand the size of the array to include a specified offset +-- expand the size of the array to strictly include a specified offset +-- (i.e., not at EOF, so we can write at least one byte there) expandBin :: BinHandle -> Int -> IO () expandBin (BinMem _ _ sz_r arr_r) off = do sz <- readFastMutInt sz_r From git at git.haskell.org Mon Feb 20 05:30:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 05:30:45 +0000 (UTC) Subject: [commit: ghc] wip/rwbarton-biniface: Use half as much memory when reading interfaces (84fa482) Message-ID: <20170220053045.63C343A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rwbarton-biniface Link : http://ghc.haskell.org/trac/ghc/changeset/84fa48224dafc32fcb7e906ad248048e32370865/ghc >--------------------------------------------------------------- commit 84fa48224dafc32fcb7e906ad248048e32370865 Author: Reid Barton Date: Sun Feb 19 20:05:06 2017 -0500 Use half as much memory when reading interfaces >--------------------------------------------------------------- 84fa48224dafc32fcb7e906ad248048e32370865 compiler/utils/Binary.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/utils/Binary.hs b/compiler/utils/Binary.hs index b10ab1d..a1ccee3 100644 --- a/compiler/utils/Binary.hs +++ b/compiler/utils/Binary.hs @@ -207,7 +207,7 @@ readBinMem filename = do h <- openBinaryFile filename ReadMode filesize' <- hFileSize h let filesize = fromIntegral filesize' - arr <- mallocForeignPtrBytes (filesize*2) + arr <- mallocForeignPtrBytes filesize count <- withForeignPtr arr $ \p -> hGetBuf h p filesize when (count /= filesize) $ error ("Binary.readBinMem: only read " ++ show count ++ " bytes") From git at git.haskell.org Mon Feb 20 05:30:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 05:30:50 +0000 (UTC) Subject: [commit: ghc] wip/rwbarton-biniface: Avoid using Binary Integer instance excessively in Literal (7527870) Message-ID: <20170220053050.E1AEC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rwbarton-biniface Link : http://ghc.haskell.org/trac/ghc/changeset/7527870438ad664cbb353a8dc4c5ee2b30472f89/ghc >--------------------------------------------------------------- commit 7527870438ad664cbb353a8dc4c5ee2b30472f89 Author: Reid Barton Date: Sun Feb 19 20:05:25 2017 -0500 Avoid using Binary Integer instance excessively in Literal >--------------------------------------------------------------- 7527870438ad664cbb353a8dc4c5ee2b30472f89 compiler/basicTypes/Literal.hs | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/compiler/basicTypes/Literal.hs b/compiler/basicTypes/Literal.hs index cc53b47..959a8a3 100644 --- a/compiler/basicTypes/Literal.hs +++ b/compiler/basicTypes/Literal.hs @@ -152,10 +152,23 @@ instance Binary Literal where put_ bh (MachChar aa) = do putByte bh 0; put_ bh aa put_ bh (MachStr ab) = do putByte bh 1; put_ bh ab put_ bh (MachNullAddr) = do putByte bh 2 - put_ bh (MachInt ad) = do putByte bh 3; put_ bh ad - put_ bh (MachInt64 ae) = do putByte bh 4; put_ bh ae - put_ bh (MachWord af) = do putByte bh 5; put_ bh af - put_ bh (MachWord64 ag) = do putByte bh 6; put_ bh ag + + -- The target int/word sizes should at least fit within 64 bits, + -- so let's not use the (truly awful) Binary Integer instance + -- if we can avoid it. + put_ bh (MachInt ad) = ASSERT2( inInt64Range ad, integer ad ) + do putByte bh 3 + put_ bh (fromInteger ad :: Int64) + put_ bh (MachInt64 ae) = ASSERT2( inInt64Range ae, integer ae ) + do putByte bh 4 + put_ bh (fromInteger ae :: Int64) + put_ bh (MachWord af) = ASSERT2( inWord64Range af, integer af ) + do putByte bh 5 + put_ bh (fromInteger af :: Word64) + put_ bh (MachWord64 ag) = ASSERT2( inWord64Range ag, integer ag ) + do putByte bh 6 + put_ bh (fromInteger ag :: Word64) + put_ bh (MachFloat ah) = do putByte bh 7; put_ bh ah put_ bh (MachDouble ai) = do putByte bh 8; put_ bh ai put_ bh (MachLabel aj mb fod) @@ -177,16 +190,16 @@ instance Binary Literal where return (MachNullAddr) 3 -> do ad <- get bh - return (MachInt ad) + return (MachInt (toInteger (ad :: Int64))) 4 -> do ae <- get bh - return (MachInt64 ae) + return (MachInt64 (toInteger (ae :: Int64))) 5 -> do af <- get bh - return (MachWord af) + return (MachWord (toInteger (af :: Word64))) 6 -> do ag <- get bh - return (MachWord64 ag) + return (MachWord64 (toInteger (ag :: Word64))) 7 -> do ah <- get bh return (MachFloat ah) From git at git.haskell.org Mon Feb 20 05:30:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 05:30:48 +0000 (UTC) Subject: [commit: ghc] wip/rwbarton-biniface: Boundary condition fixes for Binary (179eafe) Message-ID: <20170220053048.283403A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rwbarton-biniface Link : http://ghc.haskell.org/trac/ghc/changeset/179eafedda7c2063c07858b79d32b7d90e32cb0b/ghc >--------------------------------------------------------------- commit 179eafedda7c2063c07858b79d32b7d90e32cb0b Author: Reid Barton Date: Sun Feb 19 20:06:13 2017 -0500 Boundary condition fixes for Binary >--------------------------------------------------------------- 179eafedda7c2063c07858b79d32b7d90e32cb0b compiler/utils/Binary.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/compiler/utils/Binary.hs b/compiler/utils/Binary.hs index a1ccee3..4398f12 100644 --- a/compiler/utils/Binary.hs +++ b/compiler/utils/Binary.hs @@ -101,6 +101,7 @@ data BinHandle = BinMem { -- binary data stored in an unboxed array bh_usr :: UserData, -- sigh, need parameterized modules :-) _off_r :: !FastMutInt, -- the current offset + -- Invariant: _off_r <= _sz_r _sz_r :: !FastMutInt, -- size of the array (cached) _arr_r :: !(IORef BinArray) -- the array (bounds: (0,size-1)) } @@ -174,7 +175,7 @@ tellBin (BinMem _ r _ _) = do ix <- readFastMutInt r; return (BinPtr ix) seekBin :: BinHandle -> Bin a -> IO () seekBin h@(BinMem _ ix_r sz_r _) (BinPtr p) = do sz <- readFastMutInt sz_r - if (p >= sz) + if (p > sz) then do expandBin h p; writeFastMutInt ix_r p else writeFastMutInt ix_r p @@ -183,7 +184,7 @@ seekBy h@(BinMem _ ix_r sz_r _) off = do sz <- readFastMutInt sz_r ix <- readFastMutInt ix_r let ix' = ix + off - if (ix' >= sz) + if (ix' > sz) then do expandBin h ix'; writeFastMutInt ix_r ix' else writeFastMutInt ix_r ix' @@ -219,7 +220,8 @@ readBinMem filename = do writeFastMutInt sz_r filesize return (BinMem noUserData ix_r sz_r arr_r) --- expand the size of the array to include a specified offset +-- expand the size of the array to strictly include a specified offset +-- (i.e., not at EOF, so we can write at least one byte there) expandBin :: BinHandle -> Int -> IO () expandBin (BinMem _ _ sz_r arr_r) off = do sz <- readFastMutInt sz_r From git at git.haskell.org Mon Feb 20 05:30:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 05:30:54 +0000 (UTC) Subject: [commit: ghc] wip/rwbarton-biniface: Ensure that Literals are in range (eef5da0) Message-ID: <20170220053054.8F11F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rwbarton-biniface Link : http://ghc.haskell.org/trac/ghc/changeset/eef5da0eda84707af0780732d810f0fdd86e6ee2/ghc >--------------------------------------------------------------- commit eef5da0eda84707af0780732d810f0fdd86e6ee2 Author: Joachim Breitner Date: Thu Feb 9 15:28:54 2017 -0500 Ensure that Literals are in range Summary: This commit fixes several bugs related to case expressions involving numeric literals which are not in the range of values of their (fixed-width, integral) type. There is a new invariant on Literal: The argument of a MachInt[64] or MachWord[64] must lie within the range of the corresponding primitive type Int[64]# or Word[64]#, as defined by the target machine. This invariant is enforced in mkMachInt[64]/mkMachWord[64] by wrapping the argument to the target type's range if necessary. Test Plan: make slowtest TEST="T9533 T9533b T9533c T10245 T10246" Reviewers: simonmar, simonpj, austin, bgamari, nomeata Subscribers: thomie, rwbarton Differential Revision: https://phabricator.haskell.org/D810 GHC Trac Issues: #9533, #10245, #10246, #13171 >--------------------------------------------------------------- eef5da0eda84707af0780732d810f0fdd86e6ee2 compiler/basicTypes/Literal.hs | 81 +++++++++++++++++----- compiler/deSugar/Match.hs | 45 ++++++++++-- compiler/deSugar/MatchLit.hs | 43 +++++------- compiler/simplCore/SimplUtils.hs | 3 +- testsuite/tests/codeGen/should_run/T9533.hs | 13 ++++ .../should_run/T9533.stdout} | 0 testsuite/tests/codeGen/should_run/T9533b.hs | 8 +++ testsuite/tests/codeGen/should_run/T9533b.stdout | 1 + testsuite/tests/codeGen/should_run/T9533c.hs | 8 +++ .../should_run/T9533c.stdout} | 0 testsuite/tests/codeGen/should_run/all.T | 7 +- 11 files changed, 157 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 eef5da0eda84707af0780732d810f0fdd86e6ee2 From git at git.haskell.org Mon Feb 20 05:30:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 05:30:57 +0000 (UTC) Subject: [commit: ghc] wip/rwbarton-biniface's head updated: Boundary condition fixes for Binary (179eafe) Message-ID: <20170220053057.3B6B53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/rwbarton-biniface' now includes: a2f39da Add liftA2 to Applicative class fbcef83 Use proper primitives in Utils.Binary 0abe736 Don't replace type family instances with the same LHS in GHCi (#7102) adb565a Don't return empty initial uncovered set for an unsat context 26f5e60 Fix comment (old file names '.hc' ) in libraries/ 563148c Fix broken link of GHC.RTS.Flags 795bc49 Fixes for OccurAnal bugs (#13221) a9754e3 testsuite: Update expected values for T13035 and T12234 b572aad Do Worker/Wrapper for NOINLINE things 2dff54b Typos in comments [skip ci] 4aae191 Typos in comments [skip ci] a28a552 Remove unnecessary use of -DGENERICS flag 2219c8c Derive <$ 17ae5e7 Typos in comments [skip ci] a0174d2 Do not inline bottoming things f77e99b Comments only b8f58d7 Another improvement to SetLevels 078beea Docs: Fix typo in glasgow_exts.rst 5ce39f6 Add Wredundant-constraints to list of flags excluded from -Wall d5e9b7f Use better map operations in CoreMonad e90f611 Clean up findPartiallyCompletedCycles 369c534 testsuite: Bump max_bytes_used for T4029 0aa3f8d testsuite: Bump bytes allocated for T5837 8c25be8 cpeApp: Make Int accumulator strict bc376d3 Update Core formalize for Levity -> RuntimeRep 062f112 Fix push_bang_into_newtype when the pattern match has no arguments 3e07126 Fix comment of `section "Exceptions"` db3a797 Fix comment (broken link to users_guide) in $(TOP)/ 015e97a Pass -v0 to ghc-pkg to reduce noise in build ouput 512f157 Update hoopl submodule b990f65 More typos in comments [skip ci] 8e9593f Improve the simple optimiser 421308e Improve -dsuppress-coercions 3eb737e Generalize CmmUnwind and pass unwind information through NCG 733e845 CmmLayoutStack: Add unwind information on stack fixups 3328ddb Cmm: Add support for undefined unwinding statements 5279b08 CmmLayoutStack: Correctly annotate Sp adjustments with unwinding information 34e3523 Fix stop_thread unwinding information 9f3c1e6 Add some commented-out tracing in SpecConstr 3cfef76 Kill inaccessible-branch complaints in record update a94b484 Back-pedal the fix for Trac #8155 7e4e6a7 Add dump flags for the renamed and typechecked hsSyn ASTs 41c7437 users-guide: Document defaults for remaining optimization flags 082936d Fix documentation for setByteArray# afaf6d5 Bump array submodule b9bebd8 Implement addCStub in template-haskell. e8f5efb Tweaks and typos in manual, note refs, comments a6a4d0e Bump array submodule d266aac Library docs: Document the order for sort and sortOn. b92ca83 Bump bytestring submodule c22cd7c testsuite: Add testcase for #13248 a5a6c52 Guard rewritableTyVarsOfType 258c719 TH-spliced class instances are pretty-printed incorrectly post-#3384 3211fa0 Spelling in comments [ci skip] 76244ec Change rewritableTyVarsOfType to anyRewritableTyVar 283a346 Prevent Template Haskell splices from throwing a spurious TypeInType error e79ef75 Relax test TH_addCStub2 so it succeeds on travis. 639e702 Refactor DeriveAnyClass's instance context inference 594123f IcmmMachOpFoldM: clarify panic message 7fac7cd Dwarf.Types: Use DW_CFA_same_value encoding when possible 17b1e0b Mark orphan instances and rules in --show-iface output a1980ec Improve the Occurrence Analyzer’s handling of one-shot functions 26eaa7e Fix #13214 by correctly setting up dep_orphs for signatures. 1a14d38 rts/Profiling: Kill a few globals and add consts 56c9bb3 rts/Profiling: Factor out report generation 07292e9 zonkCt tries to maintain the canonical form of a Ct. 64da671 Binary: Only allocate un-interned FastStrings 7938ef2 Avoid repeated list elem checks 4e2e9b7 Fix: Default FD buffer size is not a power of 2 (#13245) 805db96 Fix: hPutBuf issues unnecessary empty write syscalls for large writes (#13246) 6b4e46a bufWrite: Save extra syscall when data fills handle buffer completely. a50082c Apply SplitSections to all C compilations d3ea38e Binary: Correct endian issue when cross-compiling e46a2e1 Bump hoopl submodule to 3.10.2.2 a4ccd33 Add index entry for signature files / Backpack. 8e9ad24 Setup more error context for Backpack operations. c81f3bc Remove obsolete Backpack manual. 2f16484 Slightly reword not-exported message. 7666a9f Disable PVP warnings temporarily. 20b5dfc Typos in notes and comments [ci skip] 2d6e91e Debug: Use local symbols for unwind points (#13278) 60c4986 Typecast covers entire expression to fix format warning. 6626242 TcUnify: Assert precondition of matchExpectedTyConApp 2484d4d Refactor renaming of operators/sections to fix DuplicateRecordFields bugs 04f67c9 Expand list of always loaded Windows shared libs 2f1017b Fix ExtraSymbols jump table on Windows. c3bbd1a Allow type defaulting for multi-param type classes with ExtendedDefaultRules da49389 Implement HasField constraint solving and modify OverloadedLabels 392cec4 Update .mailmap [skip ci] bedcb71 Check local type family instances against all imported ones f90e61a Make deSugarExpr use runTcInteractive 93e65c8 Don't warn about missing methods for instances in signatures. e28fbbb Typos [ci skip] fc9d152 Comments and tiny refactor only 6bab649 Improve checking of joins in Core Lint b8c29bc Use the correct origin in SectionL and Section R f4aa998 Better perf for haddock.base, haddock.Cabal e52a335 Comments only, about inl_inline and inl_act 8d401e5 Honour -dsuppress-uniques more thoroughly e55986a Fix a substitution bug in cseCase 0e76017 Simplify OutputableBndr ca54315 Fix a Backpack recompilation avoidance bug when signatures change. 22dba98 Fix recompilation tracking on signatures. fd2d5b6 Improvements/bugfixes to signature reexport handling. 8916884 Say 'data' explicitly in IfAbstractTyCon output. 7c057b5 Bump libraries/array submodule efeaf9e Bump nofib submodule b207b53 Generalize kind of the (->) tycon 8fa4bf9 Type-indexed Typeable 42ff5d9 Disable Typeable binding generation for unboxed sums 98e494a Improve Haddock documentation for compact. dae5003 Remove ghc-api/landmine tests eef5da0 Ensure that Literals are in range 84fa482 Use half as much memory when reading interfaces 7527870 Avoid using Binary Integer instance excessively in Literal 179eafe Boundary condition fixes for Binary From git at git.haskell.org Mon Feb 20 14:31:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 14:31:54 +0000 (UTC) Subject: [commit: ghc] master: Typos in manual, tests and comments (0aafe51) Message-ID: <20170220143154.CBD9B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0aafe5191c3c4b83cc414fb5cb31d2e6f100bee0/ghc >--------------------------------------------------------------- commit 0aafe5191c3c4b83cc414fb5cb31d2e6f100bee0 Author: Gabor Greif Date: Wed Feb 15 18:13:26 2017 +0100 Typos in manual, tests and comments >--------------------------------------------------------------- 0aafe5191c3c4b83cc414fb5cb31d2e6f100bee0 compiler/coreSyn/CorePrep.hs | 2 +- compiler/coreSyn/CoreSyn.hs | 2 +- compiler/typecheck/TcPatSyn.hs | 2 +- compiler/typecheck/TcSMonad.hs | 4 ++-- compiler/typecheck/TcTyClsDecls.hs | 2 +- compiler/typecheck/TcType.hs | 2 +- compiler/types/TyCon.hs | 2 +- compiler/types/Unify.hs | 2 +- docs/users_guide/ghci.rst | 2 +- testsuite/tests/indexed-types/should_fail/T4485.hs | 2 +- testsuite/tests/programs/andy_cherry/andy_cherry.stdout | 2 +- testsuite/tests/programs/andy_cherry/mygames.pgn | 2 +- 12 files changed, 13 insertions(+), 13 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 0aafe5191c3c4b83cc414fb5cb31d2e6f100bee0 From git at git.haskell.org Mon Feb 20 16:57:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 16:57:48 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline: Error message wibbles (0a45231) Message-ID: <20170220165748.929773A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline Link : http://ghc.haskell.org/trac/ghc/changeset/0a45231c6e12c83eb8316053395c816bb92d123b/ghc >--------------------------------------------------------------- commit 0a45231c6e12c83eb8316053395c816bb92d123b Author: Simon Peyton Jones Date: Mon Feb 20 16:56:43 2017 +0000 Error message wibbles >--------------------------------------------------------------- 0a45231c6e12c83eb8316053395c816bb92d123b testsuite/tests/simplCore/should_compile/Makefile | 2 +- .../tests/simplCore/should_compile/T12603.stdout | 2 +- .../tests/simplCore/should_compile/T13156.stdout | 2 +- .../tests/simplCore/should_compile/T3772.stdout | 6 +- .../simplCore/should_compile/spec-inline.stderr | 158 ++++++++++++++++----- 5 files changed, 128 insertions(+), 42 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 0a45231c6e12c83eb8316053395c816bb92d123b From git at git.haskell.org Mon Feb 20 18:41:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 18:41:53 +0000 (UTC) Subject: [commit: ghc] master: Fix Core pretty printer (3f653c1) Message-ID: <20170220184153.5297C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3f653c1ec62eadaffd239391ce6b8411942daa50/ghc >--------------------------------------------------------------- commit 3f653c1ec62eadaffd239391ce6b8411942daa50 Author: Simon Peyton Jones Date: Fri Feb 17 14:56:13 2017 +0000 Fix Core pretty printer If a JoinId (bogusly) ends up in an argument position we printed f jump j rather than f (jump j) Easy to fix. >--------------------------------------------------------------- 3f653c1ec62eadaffd239391ce6b8411942daa50 compiler/coreSyn/PprCore.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/coreSyn/PprCore.hs b/compiler/coreSyn/PprCore.hs index 994c237..30de5d2 100644 --- a/compiler/coreSyn/PprCore.hs +++ b/compiler/coreSyn/PprCore.hs @@ -148,8 +148,9 @@ ppr_expr :: OutputableBndr b => (SDoc -> SDoc) -> Expr b -> SDoc -- The function adds parens in context that need -- an atomic value (e.g. function args) -ppr_expr _ (Var name) = ppWhen (isJoinId name) (text "jump") <+> - ppr name +ppr_expr add_par (Var name) + | isJoinId name = add_par ((text "jump") <+> ppr name) + | otherwise = ppr name ppr_expr add_par (Type ty) = add_par (text "TYPE:" <+> ppr ty) -- Weird ppr_expr add_par (Coercion co) = add_par (text "CO:" <+> ppr co) ppr_expr add_par (Lit lit) = pprLiteral add_par lit From git at git.haskell.org Mon Feb 20 18:41:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 18:41:58 +0000 (UTC) Subject: [commit: ghc] master: A number of Typeable wibbles from review (27a2854) Message-ID: <20170220184158.B82213A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/27a2854124cc1c101570104501beea234a4ee921/ghc >--------------------------------------------------------------- commit 27a2854124cc1c101570104501beea234a4ee921 Author: Ben Gamari Date: Sun Feb 19 10:07:56 2017 -0500 A number of Typeable wibbles from review I forgot to fold these in to the patch merged earlier. >--------------------------------------------------------------- 27a2854124cc1c101570104501beea234a4ee921 libraries/base/Data/Typeable/Internal.hs | 10 +++++----- libraries/base/GHC/Show.hs | 2 +- libraries/base/changelog.md | 8 ++++---- libraries/ghc-boot/GHC/Serialized.hs | 4 +--- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/libraries/base/Data/Typeable/Internal.hs b/libraries/base/Data/Typeable/Internal.hs index 800dc2a..c230d3a 100644 --- a/libraries/base/Data/Typeable/Internal.hs +++ b/libraries/base/Data/Typeable/Internal.hs @@ -77,7 +77,7 @@ import GHC.Base import qualified GHC.Arr as A import GHC.Types ( TYPE ) import Data.Type.Equality -import GHC.List ( splitAt, foldl ) +import GHC.List ( splitAt, foldl' ) import GHC.Word import GHC.Show import GHC.TypeLits ( KnownSymbol, symbolVal' ) @@ -209,7 +209,7 @@ instance Ord (TypeRep a) where -- | A non-indexed type representation. data SomeTypeRep where - SomeTypeRep :: forall k (a :: k). TypeRep a -> SomeTypeRep + SomeTypeRep :: forall k (a :: k). !(TypeRep a) -> SomeTypeRep instance Eq SomeTypeRep where SomeTypeRep a == SomeTypeRep b = @@ -308,7 +308,7 @@ typeRepTyCon (TrFun _ _ _) = error "typeRepTyCon: FunTy" -- TODO eqTypeRep :: forall k1 k2 (a :: k1) (b :: k2). TypeRep a -> TypeRep b -> Maybe (a :~~: b) eqTypeRep a b - | typeRepFingerprint a == typeRepFingerprint b = Just (unsafeCoerce# HRefl) + | typeRepFingerprint a == typeRepFingerprint b = Just (unsafeCoerce HRefl) | otherwise = Nothing @@ -349,7 +349,7 @@ instantiateKindRep vars = go applyTy (SomeTypeRep acc) ty | SomeTypeRep ty' <- go ty = SomeTypeRep $ mkTrApp (unsafeCoerce acc) (unsafeCoerce ty') - in foldl applyTy tycon_app ty_args + in foldl' applyTy tycon_app ty_args go (KindRepVar var) = vars A.! var go (KindRepApp f a) @@ -517,7 +517,7 @@ splitApps = go [] go xs (TrApp _ f x) = go (SomeTypeRep x : xs) f go [] (TrFun _ a b) = (funTyCon, [SomeTypeRep a, SomeTypeRep b]) go _ (TrFun _ _ _) = - error "Data.Typeable.Internal.splitApps: Impossible" + errorWithoutStackTrace "Data.Typeable.Internal.splitApps: Impossible" funTyCon :: TyCon funTyCon = typeRepTyCon (typeRep @(->)) diff --git a/libraries/base/GHC/Show.hs b/libraries/base/GHC/Show.hs index 510c655..c52824b 100644 --- a/libraries/base/GHC/Show.hs +++ b/libraries/base/GHC/Show.hs @@ -1,6 +1,6 @@ {-# LANGUAGE Trustworthy #-} {-# LANGUAGE CPP, NoImplicitPrelude, BangPatterns, StandaloneDeriving, - MagicHash, UnboxedTuples, PolyKinds #-} + MagicHash, UnboxedTuples #-} {-# OPTIONS_HADDOCK hide #-} #include "MachDeps.h" diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index fd8f188..68650e3 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -56,14 +56,14 @@ imported from `Control.Applicative`. It is likely to be added to the `Prelude` in the future. (#13191) - * A new module exposing GHC's new type-indexed type representation - mechanism, `Type.Reflection`, is now provided. + * A new module, `Type.Reflection`, exposing GHC's new type-indexed type + representation mechanism is now provided. * `Data.Dynamic` now exports the `Dyn` data constructor, enabled by the new type-indexed type representation mechanism. - * `Data.Type.Equality` now provides a kind heterogeneous type equality type, - `(:~~:)`. + * `Data.Type.Equality` now provides a kind heterogeneous type equality + evidence type, `(:~~:)`. ## 4.9.0.0 *May 2016* diff --git a/libraries/ghc-boot/GHC/Serialized.hs b/libraries/ghc-boot/GHC/Serialized.hs index 42a9604..161bbb3 100644 --- a/libraries/ghc-boot/GHC/Serialized.hs +++ b/libraries/ghc-boot/GHC/Serialized.hs @@ -29,9 +29,7 @@ data Serialized = Serialized TypeRep [Word8] -- | Put a Typeable value that we are able to actually turn into bytes into a 'Serialized' value ready for deserialization later toSerialized :: forall a. Typeable a => (a -> [Word8]) -> a -> Serialized -toSerialized serialize what = Serialized rep (serialize what) - where - rep = typeOf what +toSerialized serialize what = Serialized (typeOf what) (serialize what) -- | If the 'Serialized' value contains something of the given type, then use the specified deserializer to return @Just@ that. -- Otherwise return @Nothing at . From git at git.haskell.org Mon Feb 20 18:41:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 18:41:56 +0000 (UTC) Subject: [commit: ghc] master: Kill off the remaining Rec [] (8a9b57f) Message-ID: <20170220184156.0D2663A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8a9b57f6c16e712e8931d9ed6c7d863e27208242/ghc >--------------------------------------------------------------- commit 8a9b57f6c16e712e8931d9ed6c7d863e27208242 Author: Simon Peyton Jones Date: Fri Feb 17 14:55:06 2017 +0000 Kill off the remaining Rec [] The desugarer was producing an empty Rec group, which is never supposed to happen. This small patch stops that happening. Next up: Lint should check. >--------------------------------------------------------------- 8a9b57f6c16e712e8931d9ed6c7d863e27208242 compiler/coreSyn/CoreSyn.hs | 9 +++- compiler/deSugar/DsBinds.hs | 4 +- testsuite/tests/callarity/unittest/CallArity1.hs | 60 ++++++++++++------------ 3 files changed, 39 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 8a9b57f6c16e712e8931d9ed6c7d863e27208242 From git at git.haskell.org Mon Feb 20 18:42:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 18:42:01 +0000 (UTC) Subject: [commit: ghc] master: Change -dppr-ticks to -dsuppress-ticks (2d5be63) Message-ID: <20170220184201.841953A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2d5be63d1140a409eb18d1a77d439053844f7ce7/ghc >--------------------------------------------------------------- commit 2d5be63d1140a409eb18d1a77d439053844f7ce7 Author: Simon Peyton Jones Date: Fri Feb 17 14:50:59 2017 +0000 Change -dppr-ticks to -dsuppress-ticks I spent about two hours today hunting fruitlessly for a simplifier bug (when fixing Trac #13255), only to find that it was caused by -ddump-X silently suppressing all ticks in Core. I think this has happened to me once before. So I've changed to make tick-printing on by default (like coercions, etc), with a flag -dsuppress-ticks (like -dsuppress-coercions) to suppress them. Blargh. -dppr-ticks is still there, but deprecated. >--------------------------------------------------------------- 2d5be63d1140a409eb18d1a77d439053844f7ce7 compiler/cmm/PprCmm.hs | 7 +++---- compiler/coreSyn/PprCore.hs | 6 +++--- compiler/main/DynFlags.hs | 8 ++++++-- compiler/stgSyn/StgSyn.hs | 6 +++--- docs/users_guide/debugging.rst | 8 ++++---- testsuite/tests/codeGen/should_compile/Makefile | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/compiler/cmm/PprCmm.hs b/compiler/cmm/PprCmm.hs index 089066a..d20f013 100644 --- a/compiler/cmm/PprCmm.hs +++ b/compiler/cmm/PprCmm.hs @@ -186,15 +186,14 @@ pprNode node = pp_node <+> pp_debug -- label: CmmEntry id tscope -> ppr id <> colon <+> (sdocWithDynFlags $ \dflags -> - ppWhen (gopt Opt_PprShowTicks dflags) (text "//" <+> ppr tscope)) + ppUnless (gopt Opt_SuppressTicks dflags) (text "//" <+> ppr tscope)) -- // text CmmComment s -> text "//" <+> ftext s -- //tick bla<...> - CmmTick t -> if gopt Opt_PprShowTicks dflags - then text "//tick" <+> ppr t - else empty + CmmTick t -> ppUnless (gopt Opt_SuppressTicks dflags) $ + text "//tick" <+> ppr t -- unwind reg = expr; CmmUnwind regs -> diff --git a/compiler/coreSyn/PprCore.hs b/compiler/coreSyn/PprCore.hs index a8dc217..994c237 100644 --- a/compiler/coreSyn/PprCore.hs +++ b/compiler/coreSyn/PprCore.hs @@ -274,9 +274,9 @@ ppr_expr add_par (Let bind expr) ppr_expr add_par (Tick tickish expr) = sdocWithDynFlags $ \dflags -> - if gopt Opt_PprShowTicks dflags - then add_par (sep [ppr tickish, pprCoreExpr expr]) - else ppr_expr add_par expr + if gopt Opt_SuppressTicks dflags + then ppr_expr add_par expr + else add_par (sep [ppr tickish, pprCoreExpr expr]) pprCoreAlt :: OutputableBndr a => (AltCon, [a] , Expr a) -> SDoc pprCoreAlt (con, args, rhs) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index e04d408..d3d0ac3 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -545,6 +545,7 @@ data GeneralFlag -- Except for uniques, as some simplifier phases introduce new -- variables that have otherwise identical names. | Opt_SuppressUniques + | Opt_SuppressTicks -- Replaces Opt_PprShowTicks -- temporary flags | Opt_AutoLinkPackages @@ -2829,6 +2830,7 @@ dynamic_flags_deps = [ setGeneralFlag Opt_SuppressModulePrefixes setGeneralFlag Opt_SuppressTypeApplications setGeneralFlag Opt_SuppressIdInfo + setGeneralFlag Opt_SuppressTicks setGeneralFlag Opt_SuppressTypeSignatures) ------ Debugging ---------------------------------------------------- @@ -3586,7 +3588,9 @@ dFlagsDeps = [ -- See Note [Supporting CLI completion] -- Please keep the list of flags below sorted alphabetically flagSpec "ppr-case-as-let" Opt_PprCaseAsLet, - flagSpec "ppr-ticks" Opt_PprShowTicks, + depFlagSpec' "ppr-ticks" Opt_PprShowTicks + (\turn_on -> useInstead "suppress-ticks" (not turn_on)), + flagSpec "suppress-ticks" Opt_SuppressTicks, flagSpec "suppress-coercions" Opt_SuppressCoercions, flagSpec "suppress-idinfo" Opt_SuppressIdInfo, flagSpec "suppress-unfoldings" Opt_SuppressUnfoldings, @@ -3677,7 +3681,7 @@ fFlagsDeps = [ flagSpec "regs-graph" Opt_RegsGraph, flagSpec "regs-iterative" Opt_RegsIterative, depFlagSpec' "rewrite-rules" Opt_EnableRewriteRules - (useInstead "enable-rewrite-rules"), + (useInstead "enable-rewrite-rules"), flagSpec "shared-implib" Opt_SharedImplib, flagSpec "spec-constr" Opt_SpecConstr, flagSpec "specialise" Opt_Specialise, diff --git a/compiler/stgSyn/StgSyn.hs b/compiler/stgSyn/StgSyn.hs index 93b6e76..15181f3 100644 --- a/compiler/stgSyn/StgSyn.hs +++ b/compiler/stgSyn/StgSyn.hs @@ -766,9 +766,9 @@ pprStgExpr (StgLetNoEscape bind expr) pprStgExpr (StgTick tickish expr) = sdocWithDynFlags $ \dflags -> - if gopt Opt_PprShowTicks dflags - then sep [ ppr tickish, pprStgExpr expr ] - else pprStgExpr expr + if gopt Opt_SuppressTicks dflags + then pprStgExpr expr + else sep [ ppr tickish, pprStgExpr expr ] pprStgExpr (StgCase expr bndr alt_type alts) diff --git a/docs/users_guide/debugging.rst b/docs/users_guide/debugging.rst index fc634d0..fd4adc7 100644 --- a/docs/users_guide/debugging.rst +++ b/docs/users_guide/debugging.rst @@ -267,10 +267,6 @@ Dumping out compiler intermediate structures aren't). This flag makes debugging output appear in the more verbose debug style. -.. ghc-flag:: -dppr-ticks - - Includes "ticks" in the pretty-printer output. - .. _formatting dumps: @@ -323,6 +319,10 @@ parts that you are not interested in. this often makes the printout ambiguous. If you just want to see the overall structure of the code, then start here. +.. ghc-flag:: -dsuppress-ticks + + Suppress "ticks" in the pretty-printer output. + .. ghc-flag:: -dsuppress-uniques Suppress the printing of uniques. This may make the printout diff --git a/testsuite/tests/codeGen/should_compile/Makefile b/testsuite/tests/codeGen/should_compile/Makefile index fda9c94..a3e03d2 100644 --- a/testsuite/tests/codeGen/should_compile/Makefile +++ b/testsuite/tests/codeGen/should_compile/Makefile @@ -9,13 +9,13 @@ debug: # Without optimisations, we should get annotations for basically # all expressions in the example program. echo == Dbg == - '$(TEST_HC)' $(TEST_HC_OPTS) debug -fforce-recomp -g -dppr-ticks -ddump-cmm-verbose \ + '$(TEST_HC)' $(TEST_HC_OPTS) debug -fforce-recomp -g -ddump-cmm-verbose \ | grep -o src\ | sort -u ./debug # With optimisations we will get fewer annotations. echo == Dbg -O2 == - '$(TEST_HC)' $(TEST_HC_OPTS) debug -fforce-recomp -g -dppr-ticks -ddump-cmm-verbose -O2 \ + '$(TEST_HC)' $(TEST_HC_OPTS) debug -fforce-recomp -g -ddump-cmm-verbose -O2 \ > debug.cmm cat debug.cmm | grep -o src\ | sort -u From git at git.haskell.org Mon Feb 20 18:42:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 18:42:04 +0000 (UTC) Subject: [commit: ghc] master: Remove redundant import (8dd4e3b) Message-ID: <20170220184204.3F37F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8dd4e3bbbaa3a262c45368985a575e970f7b7fe3/ghc >--------------------------------------------------------------- commit 8dd4e3bbbaa3a262c45368985a575e970f7b7fe3 Author: Simon Peyton Jones Date: Fri Feb 17 14:57:26 2017 +0000 Remove redundant import >--------------------------------------------------------------- 8dd4e3bbbaa3a262c45368985a575e970f7b7fe3 compiler/simplCore/FloatOut.hs | 1 - 1 file changed, 1 deletion(-) diff --git a/compiler/simplCore/FloatOut.hs b/compiler/simplCore/FloatOut.hs index 4806862..72fc0d1 100644 --- a/compiler/simplCore/FloatOut.hs +++ b/compiler/simplCore/FloatOut.hs @@ -21,7 +21,6 @@ import DynFlags import ErrUtils ( dumpIfSet_dyn ) import Id ( Id, idArity, idType, isBottomingId, isJoinId, isJoinId_maybe ) -import Var ( Var ) import BasicTypes ( TopLevelFlag(..), isTopLevel ) import SetLevels import UniqSupply ( UniqSupply ) From git at git.haskell.org Mon Feb 20 18:42:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 18:42:06 +0000 (UTC) Subject: [commit: ghc] master: Bump Cabal submodule (087dbbe) Message-ID: <20170220184206.E931B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/087dbbedc4caaf96cd92d88f3c334fbf912658c3/ghc >--------------------------------------------------------------- commit 087dbbedc4caaf96cd92d88f3c334fbf912658c3 Author: Ben Gamari Date: Mon Feb 20 11:11:03 2017 -0500 Bump Cabal submodule We are now tracking the 2.0 branch. >--------------------------------------------------------------- 087dbbedc4caaf96cd92d88f3c334fbf912658c3 libraries/Cabal | 2 +- testsuite/tests/backpack/cabal/bkpcabal02/bkpcabal02.stdout | 10 ++++++---- testsuite/tests/cabal/cabal03/cabal03.stderr | 4 ++-- testsuite/tests/driver/recomp007/recomp007.stdout | 3 ++- testsuite/tests/th/T10796b.stderr | 6 +++--- utils/check-api-annotations/check-api-annotations.cabal | 2 +- utils/check-ppr/check-ppr.cabal | 3 +-- utils/ghc-cabal/ghc-cabal.cabal | 2 +- utils/ghc-cabal/ghc.mk | 2 +- utils/ghctags/ghctags.cabal | 2 +- 10 files changed, 19 insertions(+), 17 deletions(-) diff --git a/libraries/Cabal b/libraries/Cabal index 824d0ba..e8aa542 160000 --- a/libraries/Cabal +++ b/libraries/Cabal @@ -1 +1 @@ -Subproject commit 824d0bae1aee2a25cabdcef92e5e1dd470c7dac0 +Subproject commit e8aa54220a4bbe3fe6d14542f3a94222228efb2f diff --git a/testsuite/tests/backpack/cabal/bkpcabal02/bkpcabal02.stdout b/testsuite/tests/backpack/cabal/bkpcabal02/bkpcabal02.stdout index 2d219b0..2f17fdf 100644 --- a/testsuite/tests/backpack/cabal/bkpcabal02/bkpcabal02.stdout +++ b/testsuite/tests/backpack/cabal/bkpcabal02/bkpcabal02.stdout @@ -1,4 +1,6 @@ -Preprocessing library 'bkpcabal01-0.1.0.0-JzlnBa7joVSAwW36Ug1T14-p' for -bkpcabal01-0.1.0.0... -Preprocessing library 'bkpcabal01-0.1.0.0-JzlnBa7joVSAwW36Ug1T14-q' for -bkpcabal01-0.1.0.0... +Preprocessing library 'p' for bkpcabal01-0.1.0.0.. +Building library 'p' instantiated with H = +for bkpcabal01-0.1.0.0.. +Preprocessing library 'q' for bkpcabal01-0.1.0.0.. +Building library 'q' instantiated with H = +for bkpcabal01-0.1.0.0.. diff --git a/testsuite/tests/cabal/cabal03/cabal03.stderr b/testsuite/tests/cabal/cabal03/cabal03.stderr index 81b3e4b..42821ba 100644 --- a/testsuite/tests/cabal/cabal03/cabal03.stderr +++ b/testsuite/tests/cabal/cabal03/cabal03.stderr @@ -1,3 +1,3 @@ -Setup: The following packages are broken because other packages they depend on -are missing. These broken packages must be rebuilt before they can be used. +Error: + The following packages are broken because other packages they depend on are missing. These broken packages must be rebuilt before they can be used. installed package q-1.0 is broken due to missing package p-noopt diff --git a/testsuite/tests/driver/recomp007/recomp007.stdout b/testsuite/tests/driver/recomp007/recomp007.stdout index 6230acf..d834315 100644 --- a/testsuite/tests/driver/recomp007/recomp007.stdout +++ b/testsuite/tests/driver/recomp007/recomp007.stdout @@ -1,4 +1,5 @@ -Preprocessing executable 'test' for b-1.0... +Preprocessing executable 'test' for b-1.0.. +Building executable 'test' for b-1.0.. [1 of 2] Compiling B ( B.hs, dist/build/test/test-tmp/B.o ) [A changed] [2 of 2] Compiling Main ( Main.hs, dist/build/test/test-tmp/Main.o ) [B changed] Linking dist/build/test/test ... diff --git a/testsuite/tests/th/T10796b.stderr b/testsuite/tests/th/T10796b.stderr index 1dd5110..eff1f75 100644 --- a/testsuite/tests/th/T10796b.stderr +++ b/testsuite/tests/th/T10796b.stderr @@ -1,5 +1,5 @@ T10796b.hs:8:17: error: - Can't construct a pattern from name Data.Set.Base.fromList - In the untyped splice: - $(dataToPatQ (const Nothing) (fromList "test")) + • Can't construct a pattern from name Data.Set.Base.fromList + • In the untyped splice: + $(dataToPatQ (const Nothing) (fromList "test")) diff --git a/utils/check-api-annotations/check-api-annotations.cabal b/utils/check-api-annotations/check-api-annotations.cabal index da68dba..880f4d6 100644 --- a/utils/check-api-annotations/check-api-annotations.cabal +++ b/utils/check-api-annotations/check-api-annotations.cabal @@ -24,6 +24,6 @@ Executable check-api-annotations Build-Depends: base >= 4 && < 5, containers, - Cabal >= 1.25 && <1.27, + Cabal >= 2.0 && < 2.1, directory, ghc diff --git a/utils/check-ppr/check-ppr.cabal b/utils/check-ppr/check-ppr.cabal index 96863e5..584558b 100644 --- a/utils/check-ppr/check-ppr.cabal +++ b/utils/check-ppr/check-ppr.cabal @@ -25,8 +25,7 @@ Executable check-ppr Build-Depends: base >= 4 && < 5, bytestring, containers, - -- Cabal >= 1.25 && <1.27, - Cabal >= 1.24 && <1.27, + Cabal >= 2.0 && < 2.1, directory, filepath, ghc diff --git a/utils/ghc-cabal/ghc-cabal.cabal b/utils/ghc-cabal/ghc-cabal.cabal index d65ffba..2c20432 100644 --- a/utils/ghc-cabal/ghc-cabal.cabal +++ b/utils/ghc-cabal/ghc-cabal.cabal @@ -21,7 +21,7 @@ Executable ghc-cabal Build-Depends: base >= 3 && < 5, bytestring >= 0.10 && < 0.11, - Cabal >= 1.25 && < 1.27, + Cabal >= 2.0 && < 2.1, directory >= 1.1 && < 1.4, filepath >= 1.2 && < 1.5 diff --git a/utils/ghc-cabal/ghc.mk b/utils/ghc-cabal/ghc.mk index 4f896aa..b8f03a9 100644 --- a/utils/ghc-cabal/ghc.mk +++ b/utils/ghc-cabal/ghc.mk @@ -54,7 +54,7 @@ $(ghc-cabal_DIST_BINARY): utils/ghc-cabal/Main.hs $(TOUCH_DEP) | $$(dir $$@)/. b -no-user-$(GHC_PACKAGE_DB_FLAG) \ -Wall -fno-warn-unused-imports -fno-warn-warnings-deprecations \ -DCABAL_VERSION=$(CABAL_VERSION) \ - -DMIN_VERSION_binary_0_8_0 \ + -DHAVE_containers_050 \ -DBOOTSTRAPPING \ -optP-include -optPutils/ghc-cabal/cabal_macros_boot.h \ -odir bootstrapping \ diff --git a/utils/ghctags/ghctags.cabal b/utils/ghctags/ghctags.cabal index b871f8c..1bb6588 100644 --- a/utils/ghctags/ghctags.cabal +++ b/utils/ghctags/ghctags.cabal @@ -18,6 +18,6 @@ Executable ghctags Build-Depends: base >= 4 && < 5, containers, - Cabal >= 1.25 && <1.27, + Cabal >= 2.0 && <2.1, ghc From git at git.haskell.org Mon Feb 20 18:42:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 18:42:09 +0000 (UTC) Subject: [commit: ghc] master: Bump a few more performance regressions from Type-indexed Typeable (6ad89d7) Message-ID: <20170220184209.A144E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6ad89d7bacc9aeca377d05e4f74b35f4036f7d25/ghc >--------------------------------------------------------------- commit 6ad89d7bacc9aeca377d05e4f74b35f4036f7d25 Author: Ben Gamari Date: Mon Feb 20 13:30:49 2017 -0500 Bump a few more performance regressions from Type-indexed Typeable These are right on the edge of acceptance and are only reproducible on a stressed machine. >--------------------------------------------------------------- 6ad89d7bacc9aeca377d05e4f74b35f4036f7d25 testsuite/tests/perf/compiler/all.T | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index 7ebfb89..f3c318b 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -612,7 +612,7 @@ test('T5837', # 2014-12-08: 115905208 Constraint solver perf improvements (esp kick-out) # 2016-04-06: 24199320 (x86/Linux, 64-bit machine) TypeInType - (wordsize(64), 53592736, 7)]) + (wordsize(64), 58648600, 7)]) # sample: 3926235424 (amd64/Linux, 15/2/2012) # 2012-10-02 81879216 # 2012-09-20 87254264 amd64/Linux @@ -645,6 +645,7 @@ test('T5837', # 2017-02-07 53592736 amd64/Linux Simon's earlier decrease appears # to be environmentally-dependent. # Also bumped acceptance threshold to 7%. + # 2017-02-20 58648600 amd64/Linux Type-indexed Typeable ], compile, ['-freduction-depth=50']) @@ -902,8 +903,9 @@ test('T10547', [ compiler_stats_num_field('bytes allocated', [(wordsize(64), 31041520, 20), # initial: 39165544 - # 25/11/2106: 31041520 Linux Around the time of refactoring the constraint solver; + # 2016-11-25: 31041520 Linux Around the time of refactoring the constraint solver; # but I think that only pushed it over the edge + # 2017-02-20: 38681216 Linux Type-indexed Typeable ]), ], compile_fail, From git at git.haskell.org Mon Feb 20 21:06:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:06:24 +0000 (UTC) Subject: [commit: packages/time] branch 'posix-perf' created Message-ID: <20170220210624.87B1B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time New branch : posix-perf Referencing: f37d418745e0ba95788dfbba355ef3cf87d16b0f From git at git.haskell.org Mon Feb 20 21:06:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:06:26 +0000 (UTC) Subject: [commit: packages/time] branch 'tasty' created Message-ID: <20170220210626.887F23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time New branch : tasty Referencing: c9756f78625e0a1aa5247d97ed3ff85f4df94d75 From git at git.haskell.org Mon Feb 20 21:06:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:06:28 +0000 (UTC) Subject: [commit: packages/time] branch 'improve-leapseconds' created Message-ID: <20170220210628.88A2E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time New branch : improve-leapseconds Referencing: 7b1dddd9d1d0fe4bc3c82d8dedb9ca3232b556b1 From git at git.haskell.org Mon Feb 20 21:06:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:06:32 +0000 (UTC) Subject: [commit: packages/time] branch 'ghc-7.8' created Message-ID: <20170220210632.8AFCE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time New branch : ghc-7.8 Referencing: adafac26307cffab0be20c126385ab161c259237 From git at git.haskell.org Mon Feb 20 21:06:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:06:30 +0000 (UTC) Subject: [commit: packages/time] branch 'format-widths' created Message-ID: <20170220210630.89FB33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time New branch : format-widths Referencing: 85904c55ecce05534fc5b5341fca0611350e3591 From git at git.haskell.org Mon Feb 20 21:06:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:06:34 +0000 (UTC) Subject: [commit: packages/time] branch 'wip/travis' created Message-ID: <20170220210634.8BE5C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time New branch : wip/travis Referencing: b837d6c1a7ba651fe67043a27d2bd0ffea2235fa From git at git.haskell.org Mon Feb 20 21:06:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:06:38 +0000 (UTC) Subject: [commit: packages/time] branch 'ezyang-scrap' deleted Message-ID: <20170220210638.8D9E73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time Deleted branch: ezyang-scrap From git at git.haskell.org Mon Feb 20 21:06:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:06:36 +0000 (UTC) Subject: [commit: packages/time] branch 'ghc-head' deleted Message-ID: <20170220210636.8CD7B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time Deleted branch: ghc-head From git at git.haskell.org Mon Feb 20 21:06:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:06:40 +0000 (UTC) Subject: [commit: packages/time] tag 'time-1.6.0.1-release' created Message-ID: <20170220210640.8E7963A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time New tag : time-1.6.0.1-release Referencing: 2b8b0a1406e10e851bfbcb5326730788c564de90 From git at git.haskell.org Mon Feb 20 21:06:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:06:42 +0000 (UTC) Subject: [commit: packages/time] tag 'time-1.5.0.1-release' created Message-ID: <20170220210642.9079F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time New tag : time-1.5.0.1-release Referencing: 02aa59816ac87af9623752937ce2cb6ddbd7eb98 From git at git.haskell.org Mon Feb 20 21:06:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:06:44 +0000 (UTC) Subject: [commit: packages/time] tag '1.8' created Message-ID: <20170220210644.90AD93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time New tag : 1.8 Referencing: 72728f2151aa207bce94fc0da4d6b28b2bac17df From git at git.haskell.org Mon Feb 20 21:06:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:06:46 +0000 (UTC) Subject: [commit: packages/time] tag 'time-1.6-release' created Message-ID: <20170220210646.919193A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time New tag : time-1.6-release Referencing: 098185968c31dfbc27ebd548460795b72b1ea274 From git at git.haskell.org Mon Feb 20 21:06:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:06:48 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: initial revision, including draft of Clock and outlines of TAI and Calendar (239f07b) Message-ID: <20170220210648.9D8633A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/239f07b42ef31a05b9b3894dc656620c8699cc9b >--------------------------------------------------------------- commit 239f07b42ef31a05b9b3894dc656620c8699cc9b Author: Ashley Yakeley Date: Tue Feb 22 21:19:59 2005 -0800 initial revision, including draft of Clock and outlines of TAI and Calendar darcs-hash:20050223051959-ac6dd-ea6ff7c56b81deaffc2584a3a196a8e6262805d9 >--------------------------------------------------------------- 239f07b42ef31a05b9b3894dc656620c8699cc9b Makefile | 30 +++++++++++++ System/Time/Calendar.hs | 61 +++++++++++++++++++++++++ System/Time/Clock.hs | 116 ++++++++++++++++++++++++++++++++++++++++++++++++ System/Time/TAI.hs | 33 ++++++++++++++ TestTime.hs | 11 +++++ 5 files changed, 251 insertions(+) diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..4a6709f --- /dev/null +++ b/Makefile @@ -0,0 +1,30 @@ +default: TestTime.run + +#TestTime: TestTime.o System/Time/Clock.o System/Time/TAI.o System/Time/Calendar.o +TestTime: TestTime.o System/Time/Clock.o + ghc $^ -o $@ + + +clean: + rm -f TestTime *.o *.hi System/Time/*.o System/Time/*.hi Makefile.bak + + +%.run: % + ./$< + +%.hi: %.o + @: + +%.o: %.hs + ghc -c $< -o $@ + +depend: TestTime.hs System/Time/Clock.hs System/Time/TAI.hs System/Time/Calendar.hs + ghc -M $^ +# DO NOT DELETE: Beginning of Haskell dependencies +TestTime.o : TestTime.hs +TestTime.o : ./System/Time/Clock.hi +System/Time/Clock.o : System/Time/Clock.hs +System/Time/TAI.o : System/Time/TAI.hs +System/Time/TAI.o : System/Time/Clock.hi +System/Time/Calendar.o : System/Time/Calendar.hs +# DO NOT DELETE: End of Haskell dependencies diff --git a/System/Time/Calendar.hs b/System/Time/Calendar.hs new file mode 100644 index 0000000..944f4fb --- /dev/null +++ b/System/Time/Calendar.hs @@ -0,0 +1,61 @@ +module System.Time.Calendar +( + -- time zones + TimeZone, + + -- getting the locale time zone + + -- converting times to Gregorian "calendrical" format + TimeOfDay,CalendarDay,CalendarTime + + -- calendrical arithmetic + -- e.g. "one month after March 31st" + + -- parsing and showing dates and times +) where + +-- | count of minutes +newtype TimeZone = MkTimeZone Int deriving (Eq,Ord,Num) + + +data TimeOfDay = TimeOfDay +{ + todHour :: Int, + todMin :: Int, + todSec :: Int, + todPicosec :: Integer +} deriving (Eq,Ord) + +instance Show TimeOfDay where + show (TimeOfDay h m s ps) = + +data CalendarDay = CalendarDay +{ + cdYear :: Integer, + cdMonth :: Int, + cdDay :: Int +} deriving (Eq,Ord) + +data CalendarTime = CalendarTime +{ + ctDay :: CalendarDay, + ctTime :: TimeOfDay +} deriving (Eq,Ord) + + + +-- ((365 * 3 + 366) * 24 + 365 * 4) * 3 + (365 * 3 + 366) * 25 +dayToCalendar :: ModJulianDay -> CalendarDay +dayToCalendar mjd = let + a = mjd + 2000 -- ? + quadcent = a / 146097 + b = a % 146097 + cent = min (b / 36524) 3 + ...to be continued + + +utcToCalendar :: TimeZone -> UTCTime -> CalendarTime + +calendarToUTC :: TimeZone -> CalendarTime -> UTCTime + + diff --git a/System/Time/Clock.hs b/System/Time/Clock.hs new file mode 100644 index 0000000..386c920 --- /dev/null +++ b/System/Time/Clock.hs @@ -0,0 +1,116 @@ +{-# OPTIONS -ffi #-} + +module System.Time.Clock +( + -- Modified Julian days and dates (for UT1) + ModJulianDay,ModJulianDate, + + -- absolute time intervals + DiffTime,timeToSISeconds,siSecondsToTime, + + -- UTC arithmetic + UTCTime(..),UTCDiffTime,utcTimeToUTCSeconds,utcSecondsToUTCTime, + + -- getting the current UTC time + getCurrentTime +) where + +import Foreign +import Foreign.C + +-- | standard Julian count of Earth days +type ModJulianDay = Integer + +-- | standard Julian dates for UT1, 1 = 1 day +type ModJulianDate = Rational + +secondPicoseconds :: (Num a) => a +secondPicoseconds = 1000000000000 + +newtype DiffTime = MkDiffTime Integer deriving (Eq,Ord,Show) + +timeToSIPicoseconds :: DiffTime -> Integer +timeToSIPicoseconds (MkDiffTime ps) = ps + +siPicosecondsToTime :: Integer -> DiffTime +siPicosecondsToTime = MkDiffTime + +timeToSISeconds :: (Fractional a) => DiffTime -> a +timeToSISeconds t = fromRational ((toRational (timeToSIPicoseconds t)) / (toRational secondPicoseconds)); + +siSecondsToTime :: (Real a) => a -> DiffTime +siSecondsToTime t = siPicosecondsToTime (round ((toRational t) * secondPicoseconds)) + +data UTCTime = UTCTime { + utctDay :: ModJulianDay, + utctDayTime :: DiffTime +} + +newtype UTCDiffTime = MkUTCDiffTime Integer + +utcTimeToUTCPicoseconds :: UTCDiffTime -> Integer +utcTimeToUTCPicoseconds (MkUTCDiffTime ps) = ps + +utcPicosecondsToUTCTime :: Integer -> UTCDiffTime +utcPicosecondsToUTCTime = MkUTCDiffTime + +utcTimeToUTCSeconds :: (Fractional a) => UTCDiffTime -> a +utcTimeToUTCSeconds t = fromRational ((toRational (utcTimeToUTCPicoseconds t)) / (toRational secondPicoseconds)) + +utcSecondsToUTCTime :: (Real a) => a -> UTCDiffTime +utcSecondsToUTCTime t = utcPicosecondsToUTCTime (round ((toRational t) * secondPicoseconds)) + +posixDaySeconds :: (Num a) => a +posixDaySeconds = 86400 + +posixDayPicoseconds :: Integer +posixDayPicoseconds = posixDaySeconds * secondPicoseconds + +unixEpochMJD :: ModJulianDay +unixEpochMJD = 40587 + +posixPicosecondsToUTCTime :: Integer -> UTCTime +posixPicosecondsToUTCTime i = let + (d,t) = divMod i posixDayPicoseconds + in UTCTime (d + unixEpochMJD) (siPicosecondsToTime t) + +utcTimeToPOSIXPicoseconds :: UTCTime -> Integer +utcTimeToPOSIXPicoseconds (UTCTime d t) = + ((d - unixEpochMJD) * posixDayPicoseconds) + min posixDayPicoseconds (timeToSIPicoseconds t) + +addUTCTime :: UTCDiffTime -> UTCTime -> UTCTime +addUTCTime x t = posixPicosecondsToUTCTime ((utcTimeToUTCPicoseconds x) + (utcTimeToPOSIXPicoseconds t)) + +diffUTCTime :: UTCTime -> UTCTime -> UTCDiffTime +diffUTCTime a b = utcPicosecondsToUTCTime ((utcTimeToPOSIXPicoseconds a) - (utcTimeToPOSIXPicoseconds b)) + + +-- Get current time + +data CTimeval = MkCTimeval CLong CLong + +ctimevalToPosixPicoseconds :: CTimeval -> Integer +ctimevalToPosixPicoseconds (MkCTimeval s mus) = ((fromIntegral s) * 1000000 + (fromIntegral mus)) * 1000000 + +instance Storable CTimeval where + sizeOf _ = (sizeOf (undefined :: CLong)) * 2 + alignment _ = alignment (undefined :: CLong) + peek p = do + s <- peekElemOff (castPtr p) 0 + mus <- peekElemOff (castPtr p) 1 + return (MkCTimeval s mus) + poke p (MkCTimeval s mus) = do + pokeElemOff (castPtr p) 0 s + pokeElemOff (castPtr p) 1 mus + +foreign import ccall unsafe "sys/time.h gettimeofday" gettimeofday :: Ptr CTimeval -> Ptr () -> IO CInt + +getCurrentTime :: IO UTCTime +getCurrentTime = with (MkCTimeval 0 0) (\ptval -> do + result <- gettimeofday ptval nullPtr + if (result == 0) + then do + tval <- peek ptval + return (posixPicosecondsToUTCTime (ctimevalToPosixPicoseconds tval)) + else fail ("error in gettimeofday: " ++ (show result)) + ) diff --git a/System/Time/TAI.hs b/System/Time/TAI.hs new file mode 100644 index 0000000..fb5df5a --- /dev/null +++ b/System/Time/TAI.hs @@ -0,0 +1,33 @@ +-- | most people won't need this module +module System.Time.TAI +( + -- TAI arithmetic + AbsoluteTime,addAbsoluteTime,diffAbsoluteTime, + + -- leap-second table type + LeapSecondTable, + + -- conversion between UTC and TAI with table + utcDayLength,utcToTAITime,taiToUTCTime +) where + +import System.Time.Clock + +-- | TAI +type AbsoluteTime = MkAbsoluteTime Integer + +addAbsoluteTime :: DiffTime -> AbsoluteTime -> AbsoluteTime + +diffAbsoluteTime :: AbsoluteTime -> AbsoluteTime -> DiffTime + +-- | TAI - UTC during this day +type LeapSecondTable = ModJulianDay -> Int + +utcDayLength :: LeapSecondTable -> ModJulianDay -> DiffTime +utcDayLength table day = siSecondsToTime (86400 + (table (day + 1)) - (table day)) + +utcToTAITime :: LeapSecondTable -> UTCTime -> TAITime +utcToTAITime table (UTCTime day dtime) = siSecondsToTime (table day) + + +taiToUTCTime :: LeapSecondTable -> TAITime -> UTCTime + diff --git a/TestTime.hs b/TestTime.hs new file mode 100644 index 0000000..77dff58 --- /dev/null +++ b/TestTime.hs @@ -0,0 +1,11 @@ +module Main where + +import System.Time.Clock +--import System.Time.TAI +--import System.Time.Calendar + +main :: IO () +main = do + now <- getCurrentTime + putStrLn (show (utctDay now) ++ "," ++ show (utctDayTime now)) +-- putStrLn (show (utcToCalendar (60 * -8) now)) From git at git.haskell.org Mon Feb 20 21:06:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:06:50 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: make diff times instances of Num (7339f64) Message-ID: <20170220210650.A472F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/7339f6490cd349867b5cb93d8a59f31a4a92c9cd >--------------------------------------------------------------- commit 7339f6490cd349867b5cb93d8a59f31a4a92c9cd Author: Ashley Yakeley Date: Wed Feb 23 02:28:59 2005 -0800 make diff times instances of Num darcs-hash:20050223102859-ac6dd-24d8169a3ff6da7e55dc008515c04dc56e5e902d >--------------------------------------------------------------- 7339f6490cd349867b5cb93d8a59f31a4a92c9cd System/Time/Clock.hs | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/System/Time/Clock.hs b/System/Time/Clock.hs index 386c920..628a627 100644 --- a/System/Time/Clock.hs +++ b/System/Time/Clock.hs @@ -1,4 +1,4 @@ -{-# OPTIONS -ffi #-} +{-# OPTIONS -ffi -fglasgow-exts #-} module System.Time.Clock ( @@ -27,38 +27,32 @@ type ModJulianDate = Rational secondPicoseconds :: (Num a) => a secondPicoseconds = 1000000000000 -newtype DiffTime = MkDiffTime Integer deriving (Eq,Ord,Show) +newtype DiffTime = MkDiffTime Integer deriving (Eq,Ord,Num,Enum,Real,Integral) -timeToSIPicoseconds :: DiffTime -> Integer -timeToSIPicoseconds (MkDiffTime ps) = ps - -siPicosecondsToTime :: Integer -> DiffTime -siPicosecondsToTime = MkDiffTime +instance Show DiffTime where + show (MkDiffTime t) = (show t) ++ "ps" timeToSISeconds :: (Fractional a) => DiffTime -> a -timeToSISeconds t = fromRational ((toRational (timeToSIPicoseconds t)) / (toRational secondPicoseconds)); +timeToSISeconds t = fromRational ((toRational t) / (toRational secondPicoseconds)); siSecondsToTime :: (Real a) => a -> DiffTime -siSecondsToTime t = siPicosecondsToTime (round ((toRational t) * secondPicoseconds)) +siSecondsToTime t = fromInteger (round ((toRational t) * secondPicoseconds)) data UTCTime = UTCTime { utctDay :: ModJulianDay, utctDayTime :: DiffTime } -newtype UTCDiffTime = MkUTCDiffTime Integer - -utcTimeToUTCPicoseconds :: UTCDiffTime -> Integer -utcTimeToUTCPicoseconds (MkUTCDiffTime ps) = ps +newtype UTCDiffTime = MkUTCDiffTime Integer deriving (Eq,Ord,Num,Enum,Real,Integral) -utcPicosecondsToUTCTime :: Integer -> UTCDiffTime -utcPicosecondsToUTCTime = MkUTCDiffTime +instance Show UTCDiffTime where + show (MkUTCDiffTime t) = (show t) ++ "ps" utcTimeToUTCSeconds :: (Fractional a) => UTCDiffTime -> a -utcTimeToUTCSeconds t = fromRational ((toRational (utcTimeToUTCPicoseconds t)) / (toRational secondPicoseconds)) +utcTimeToUTCSeconds t = fromRational ((toRational t) / (toRational secondPicoseconds)) utcSecondsToUTCTime :: (Real a) => a -> UTCDiffTime -utcSecondsToUTCTime t = utcPicosecondsToUTCTime (round ((toRational t) * secondPicoseconds)) +utcSecondsToUTCTime t = fromInteger (round ((toRational t) * secondPicoseconds)) posixDaySeconds :: (Num a) => a posixDaySeconds = 86400 @@ -72,17 +66,17 @@ unixEpochMJD = 40587 posixPicosecondsToUTCTime :: Integer -> UTCTime posixPicosecondsToUTCTime i = let (d,t) = divMod i posixDayPicoseconds - in UTCTime (d + unixEpochMJD) (siPicosecondsToTime t) + in UTCTime (d + unixEpochMJD) (fromInteger t) utcTimeToPOSIXPicoseconds :: UTCTime -> Integer utcTimeToPOSIXPicoseconds (UTCTime d t) = - ((d - unixEpochMJD) * posixDayPicoseconds) + min posixDayPicoseconds (timeToSIPicoseconds t) + ((d - unixEpochMJD) * posixDayPicoseconds) + min posixDayPicoseconds (toInteger t) addUTCTime :: UTCDiffTime -> UTCTime -> UTCTime -addUTCTime x t = posixPicosecondsToUTCTime ((utcTimeToUTCPicoseconds x) + (utcTimeToPOSIXPicoseconds t)) +addUTCTime x t = posixPicosecondsToUTCTime ((toInteger x) + (utcTimeToPOSIXPicoseconds t)) diffUTCTime :: UTCTime -> UTCTime -> UTCDiffTime -diffUTCTime a b = utcPicosecondsToUTCTime ((utcTimeToPOSIXPicoseconds a) - (utcTimeToPOSIXPicoseconds b)) +diffUTCTime a b = fromInteger ((utcTimeToPOSIXPicoseconds a) - (utcTimeToPOSIXPicoseconds b)) -- Get current time From git at git.haskell.org Mon Feb 20 21:06:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:06:52 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: export addUTCTime and diffUTCTime (3dfb0c3) Message-ID: <20170220210652.AAF603A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/3dfb0c35e8d9936bfab73a57a07bd1fcf5a70d04 >--------------------------------------------------------------- commit 3dfb0c35e8d9936bfab73a57a07bd1fcf5a70d04 Author: Ashley Yakeley Date: Wed Feb 23 02:35:17 2005 -0800 export addUTCTime and diffUTCTime darcs-hash:20050223103517-ac6dd-7c644aba8ebbe04a96df851aef01d33e1692adfc >--------------------------------------------------------------- 3dfb0c35e8d9936bfab73a57a07bd1fcf5a70d04 System/Time/Clock.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/System/Time/Clock.hs b/System/Time/Clock.hs index 628a627..9f59a8c 100644 --- a/System/Time/Clock.hs +++ b/System/Time/Clock.hs @@ -10,6 +10,7 @@ module System.Time.Clock -- UTC arithmetic UTCTime(..),UTCDiffTime,utcTimeToUTCSeconds,utcSecondsToUTCTime, + addUTCTime,diffUTCTime, -- getting the current UTC time getCurrentTime From git at git.haskell.org Mon Feb 20 21:06:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:06:54 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: get TAI to compile (cf576d3) Message-ID: <20170220210654.B1B0C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/cf576d323e605122b337c64327ca047c999c7454 >--------------------------------------------------------------- commit cf576d323e605122b337c64327ca047c999c7454 Author: Ashley Yakeley Date: Wed Feb 23 02:48:25 2005 -0800 get TAI to compile darcs-hash:20050223104825-ac6dd-0a3e7a4109ecca08fb312f83deca2257b815310e >--------------------------------------------------------------- cf576d323e605122b337c64327ca047c999c7454 System/Time/TAI.hs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/System/Time/TAI.hs b/System/Time/TAI.hs index fb5df5a..501f817 100644 --- a/System/Time/TAI.hs +++ b/System/Time/TAI.hs @@ -13,21 +13,24 @@ module System.Time.TAI import System.Time.Clock --- | TAI -type AbsoluteTime = MkAbsoluteTime Integer +-- | TAI as DiffTime from epoch +newtype AbsoluteTime = MkAbsoluteTime DiffTime deriving (Eq,Ord) addAbsoluteTime :: DiffTime -> AbsoluteTime -> AbsoluteTime +addAbsoluteTime t (MkAbsoluteTime a) = MkAbsoluteTime (t + a) diffAbsoluteTime :: AbsoluteTime -> AbsoluteTime -> DiffTime +diffAbsoluteTime (MkAbsoluteTime a) (MkAbsoluteTime b) = a - b -- | TAI - UTC during this day -type LeapSecondTable = ModJulianDay -> Int +type LeapSecondTable = ModJulianDay -> Integer utcDayLength :: LeapSecondTable -> ModJulianDay -> DiffTime utcDayLength table day = siSecondsToTime (86400 + (table (day + 1)) - (table day)) -utcToTAITime :: LeapSecondTable -> UTCTime -> TAITime -utcToTAITime table (UTCTime day dtime) = siSecondsToTime (table day) + - -taiToUTCTime :: LeapSecondTable -> TAITime -> UTCTime +utcToTAITime :: LeapSecondTable -> UTCTime -> AbsoluteTime +utcToTAITime table (UTCTime day dtime) = MkAbsoluteTime + ((siSecondsToTime (day * 86400 + (table day))) + dtime) +taiToUTCTime :: LeapSecondTable -> AbsoluteTime -> UTCTime +taiToUTCTime table (MkAbsoluteTime t) = undefined From git at git.haskell.org Mon Feb 20 21:06:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:06:56 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: clean up Makefile (cc4d5c2) Message-ID: <20170220210656.B7BBA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/cc4d5c2ee1bcfc224d98a5f41054b511c5b52cfc >--------------------------------------------------------------- commit cc4d5c2ee1bcfc224d98a5f41054b511c5b52cfc Author: Ashley Yakeley Date: Wed Feb 23 02:58:07 2005 -0800 clean up Makefile darcs-hash:20050223105807-ac6dd-7d333afe8a9804e06faab7a6bebf8e07ee435d9c >--------------------------------------------------------------- cc4d5c2ee1bcfc224d98a5f41054b511c5b52cfc Makefile | 18 +++++++++++++----- TestTime.hs | 2 +- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 4a6709f..502873c 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,19 @@ default: TestTime.run -#TestTime: TestTime.o System/Time/Clock.o System/Time/TAI.o System/Time/Calendar.o -TestTime: TestTime.o System/Time/Clock.o +# SRCS = System/Time/Clock.hs System/Time/TAI.hs System/Time/Calendar.hs +SRCS = System/Time/Clock.hs System/Time/TAI.hs + +TestTime: TestTime.o $(patsubst %.hs,%.o,$(SRCS)) ghc $^ -o $@ clean: - rm -f TestTime *.o *.hi System/Time/*.o System/Time/*.hi Makefile.bak + rm -f TestTime *.o *.hi $(patsubst %.hs,%.o,$(SRCS)) $(patsubst %.hs,%.hi,$(SRCS)) Makefile.bak + + +doc: $(SRCS) + mkdir -p $@ + haddock -h -o $@ $^ %.run: % @@ -18,13 +25,14 @@ clean: %.o: %.hs ghc -c $< -o $@ -depend: TestTime.hs System/Time/Clock.hs System/Time/TAI.hs System/Time/Calendar.hs +depend: TestTime.hs $(SRCS) ghc -M $^ + # DO NOT DELETE: Beginning of Haskell dependencies TestTime.o : TestTime.hs +TestTime.o : ./System/Time/TAI.hi TestTime.o : ./System/Time/Clock.hi System/Time/Clock.o : System/Time/Clock.hs System/Time/TAI.o : System/Time/TAI.hs System/Time/TAI.o : System/Time/Clock.hi -System/Time/Calendar.o : System/Time/Calendar.hs # DO NOT DELETE: End of Haskell dependencies diff --git a/TestTime.hs b/TestTime.hs index 77dff58..9f7339b 100644 --- a/TestTime.hs +++ b/TestTime.hs @@ -1,7 +1,7 @@ module Main where import System.Time.Clock ---import System.Time.TAI +import System.Time.TAI --import System.Time.Calendar main :: IO () From git at git.haskell.org Mon Feb 20 21:06:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:06:58 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: get Calendar to compile, make TestTime a proper test, create CurrentTime to show the current time (d00d4f9) Message-ID: <20170220210658.BFF613A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/d00d4f9cbc5a05f0447ed3af9f940766641117cc >--------------------------------------------------------------- commit d00d4f9cbc5a05f0447ed3af9f940766641117cc Author: Ashley Yakeley Date: Tue Mar 1 20:54:55 2005 -0800 get Calendar to compile, make TestTime a proper test, create CurrentTime to show the current time darcs-hash:20050302045455-ac6dd-61bc2b00b1cbb7f174c701b8776f73b837d5cf0f >--------------------------------------------------------------- d00d4f9cbc5a05f0447ed3af9f940766641117cc TestTime.hs => CurrentTime.hs | 2 +- Makefile | 24 +- System/Time/Calendar.hs | 71 +++- TestTime.hs | 31 +- TestTime.ref | 754 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 857 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 d00d4f9cbc5a05f0447ed3af9f940766641117cc From git at git.haskell.org Mon Feb 20 21:07:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:07:00 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: more haddock comments, timezone conversion functions (3ad0923) Message-ID: <20170220210700.C66483A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/3ad0923af5407c1bb45d6ca6ce8ba8d6614598a8 >--------------------------------------------------------------- commit 3ad0923af5407c1bb45d6ca6ce8ba8d6614598a8 Author: Ashley Yakeley Date: Wed Mar 2 02:53:53 2005 -0800 more haddock comments, timezone conversion functions darcs-hash:20050302105353-ac6dd-7e0a4765b0845ddc199bfb01fd74cb35c77fbe47 >--------------------------------------------------------------- 3ad0923af5407c1bb45d6ca6ce8ba8d6614598a8 System/Time/Calendar.hs | 22 +++++++++++++++++----- System/Time/Clock.hs | 11 +++++++++-- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/System/Time/Calendar.hs b/System/Time/Calendar.hs index 725398c..fa55f5a 100644 --- a/System/Time/Calendar.hs +++ b/System/Time/Calendar.hs @@ -1,7 +1,7 @@ module System.Time.Calendar ( -- time zones - TimeZone, + TimeZone,timezoneToMinutes,minutesToTimezone, -- getting the locale time zone @@ -19,9 +19,14 @@ import System.Time.Clock import Data.Char -- | count of minutes -newtype TimeZone = MkTimeZone Int deriving (Eq,Ord) +newtype TimeZone = MkTimeZone { + timezoneToMinutes :: Int +} deriving (Eq,Ord) +minutesToTimezone :: Int -> TimeZone +minutesToTimezone = MkTimeZone +-- | time of day as represented in hour, minute and second (with picoseconds), typically used to express local time of day data TimeOfDay = TimeOfDay { todHour :: Int, todMin :: Int, @@ -47,6 +52,7 @@ showpicodecimal i = '.':(showFraction 100000000000 i) instance Show TimeOfDay where show (TimeOfDay h m s ps) = (show2 h) ++ ":" ++ (show2 m) ++ ":" ++ (show2 s) ++ (showpicodecimal ps) +-- | a year, month and day aggregate, suitable for the Gregorian calendar data CalendarDay = CalendarDay { cdYear :: Integer, cdMonth :: Int, @@ -56,6 +62,7 @@ data CalendarDay = CalendarDay { instance Show CalendarDay where show (CalendarDay y m d) = (if y > 0 then show y else (show (1 - y) ++ "BCE")) ++ "-" ++ (show2 m) ++ "-" ++ (show2 d) +-- | straightforward date and time aggregate data CalendarTime = CalendarTime { ctDay :: CalendarDay, ctTime :: TimeOfDay @@ -83,12 +90,17 @@ findMonthDay :: [Int] -> Int -> (Int,Int) findMonthDay (n:ns) yd | yd > n = (\(m,d) -> (m + 1,d)) (findMonthDay ns (yd - n)) findMonthDay _ yd = (1,yd) + +months :: Bool -> [Int] +months isleap = + [31,if isleap then 29 else 28,31,30,31,30,31,31,30,31,30,31] + --J F M A M J J A S O N D + +-- | name the given day according to the Gregorian calendar dayToCalendar :: ModJulianDay -> CalendarDay dayToCalendar mjd = CalendarDay year month day where (year,yd,isleap) = dayToYearDay mjd - (month,day) = findMonthDay - [31,if isleap then 29 else 28,31,30,31,30,31,31,30,31,30,31] yd - --J F M A M J J A S O N D + (month,day) = findMonthDay (months isleap) yd utcToCalendar :: TimeZone -> UTCTime -> CalendarTime diff --git a/System/Time/Clock.hs b/System/Time/Clock.hs index 9f59a8c..5a4825f 100644 --- a/System/Time/Clock.hs +++ b/System/Time/Clock.hs @@ -19,15 +19,17 @@ module System.Time.Clock import Foreign import Foreign.C --- | standard Julian count of Earth days +-- | standard Modified Julian Day, a count of Earth days type ModJulianDay = Integer --- | standard Julian dates for UT1, 1 = 1 day +-- | standard Modified Julian Date to represent UT1, 1 = 1 day type ModJulianDate = Rational +-- | the number of picoseconds in a second secondPicoseconds :: (Num a) => a secondPicoseconds = 1000000000000 +-- | a length of time newtype DiffTime = MkDiffTime Integer deriving (Eq,Ord,Num,Enum,Real,Integral) instance Show DiffTime where @@ -39,11 +41,15 @@ timeToSISeconds t = fromRational ((toRational t) / (toRational secondPicoseconds siSecondsToTime :: (Real a) => a -> DiffTime siSecondsToTime t = fromInteger (round ((toRational t) * secondPicoseconds)) +-- | time in UTC data UTCTime = UTCTime { + -- | the day utctDay :: ModJulianDay, + -- | the time from midnight, 0 <= t < 61s (because of leap-seconds) utctDayTime :: DiffTime } +-- | a length of time for UTC, ignoring leap-seconds newtype UTCDiffTime = MkUTCDiffTime Integer deriving (Eq,Ord,Num,Enum,Real,Integral) instance Show UTCDiffTime where @@ -100,6 +106,7 @@ instance Storable CTimeval where foreign import ccall unsafe "sys/time.h gettimeofday" gettimeofday :: Ptr CTimeval -> Ptr () -> IO CInt +-- | get the current time getCurrentTime :: IO UTCTime getCurrentTime = with (MkCTimeval 0 0) (\ptval -> do result <- gettimeofday ptval nullPtr From git at git.haskell.org Mon Feb 20 21:07:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:07:02 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: add dayToCalendar function, with test (266f005) Message-ID: <20170220210702.CE1183A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/266f0057ecca2b00449eb0c631c6d9507b8281af >--------------------------------------------------------------- commit 266f0057ecca2b00449eb0c631c6d9507b8281af Author: Ashley Yakeley Date: Wed Mar 2 03:12:18 2005 -0800 add dayToCalendar function, with test darcs-hash:20050302111218-ac6dd-2efd1ae180bcf6b419cbab3f1a1876c5ed7b55c4 >--------------------------------------------------------------- 266f0057ecca2b00449eb0c631c6d9507b8281af System/Time/Calendar.hs | 12 +++++++++++- TestTime.hs | 6 +++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/System/Time/Calendar.hs b/System/Time/Calendar.hs index fa55f5a..a3b9e5a 100644 --- a/System/Time/Calendar.hs +++ b/System/Time/Calendar.hs @@ -7,7 +7,7 @@ module System.Time.Calendar -- converting times to Gregorian "calendrical" format TimeOfDay,CalendarDay,CalendarTime, - dayToCalendar + dayToCalendar,calendarToDay -- calendrical arithmetic -- e.g. "one month after March 31st" @@ -102,6 +102,16 @@ dayToCalendar mjd = CalendarDay year month day where (year,yd,isleap) = dayToYearDay mjd (month,day) = findMonthDay (months isleap) yd +-- | find out which day a given Gregorian calendar day is +calendarToDay :: CalendarDay -> ModJulianDay +-- formula from +calendarToDay (CalendarDay year month day) = + (fromIntegral day) + (div (153 * m + 2) 5) + (365 * y) + (div y 4) - (div y 100) + (div y 400) - 678882 where + month' = fromIntegral month + a = div (14 - month') 12 + y = year - a + m = month' + (12 * a) - 3 + utcToCalendar :: TimeZone -> UTCTime -> CalendarTime utcToCalendar tz utc = undefined diff --git a/TestTime.hs b/TestTime.hs index d724f89..af9ceec 100644 --- a/TestTime.hs +++ b/TestTime.hs @@ -5,7 +5,11 @@ import System.Time.TAI import System.Time.Calendar showCal :: ModJulianDay -> IO () -showCal d = putStrLn ((show d) ++ "=" ++ show (dayToCalendar d)) +showCal d = do + let cal = dayToCalendar d + let d' = calendarToDay cal + putStr ((show d) ++ "=" ++ show (dayToCalendar d)) + putStrLn (if d == d' then "" else "=" ++ (show d') ++ "!") for :: (Monad m) => (a -> m ()) -> [a] -> m () for _ [] = return () From git at git.haskell.org Mon Feb 20 21:07:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:07:04 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: more calendar functions, plus test for UTC - Calendar conversion (70e1b39) Message-ID: <20170220210704.D43F23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/70e1b39e22c8b19ab1d8bfa128c63256f8d84a9f >--------------------------------------------------------------- commit 70e1b39e22c8b19ab1d8bfa128c63256f8d84a9f Author: Ashley Yakeley Date: Thu Mar 3 22:24:46 2005 -0800 more calendar functions, plus test for UTC - Calendar conversion darcs-hash:20050304062446-ac6dd-51e7118d9d1d7e194bb7b0734a76ec9a3a0ebb88 >--------------------------------------------------------------- 70e1b39e22c8b19ab1d8bfa128c63256f8d84a9f CurrentTime.hs | 5 ++++- System/Time/Calendar.hs | 58 ++++++++++++++++++++++++++++++++++++++++++++----- System/Time/Clock.hs | 5 ++++- TestTime.hs | 21 ++++++++++++++++++ TestTime.ref | 6 +++++ 5 files changed, 88 insertions(+), 7 deletions(-) diff --git a/CurrentTime.hs b/CurrentTime.hs index aebfd6a..19e46c1 100644 --- a/CurrentTime.hs +++ b/CurrentTime.hs @@ -4,8 +4,11 @@ import System.Time.Clock import System.Time.TAI import System.Time.Calendar +myzone :: TimeZone +myzone = hoursToTimezone (- 8) + main :: IO () main = do now <- getCurrentTime putStrLn (show (utctDay now) ++ "," ++ show (utctDayTime now)) --- putStrLn (show (utcToCalendar (60 * -8) now)) + putStrLn (show (utcToCalendar myzone now)) diff --git a/System/Time/Calendar.hs b/System/Time/Calendar.hs index a3b9e5a..60312e8 100644 --- a/System/Time/Calendar.hs +++ b/System/Time/Calendar.hs @@ -1,13 +1,16 @@ module System.Time.Calendar ( -- time zones - TimeZone,timezoneToMinutes,minutesToTimezone, + TimeZone,timezoneToMinutes,minutesToTimezone,hoursToTimezone,utc, -- getting the locale time zone -- converting times to Gregorian "calendrical" format - TimeOfDay,CalendarDay,CalendarTime, - dayToCalendar,calendarToDay + TimeOfDay(..),CalendarDay(..),CalendarTime(..), + dayToCalendar,calendarToDay, + utcToLocalTimeOfDay,localToUTCTimeOfDay, + timeToTimeOfDay,timeOfDayToTime, + utcToCalendar,calendarToUTC -- calendrical arithmetic -- e.g. "one month after March 31st" @@ -26,6 +29,13 @@ newtype TimeZone = MkTimeZone { minutesToTimezone :: Int -> TimeZone minutesToTimezone = MkTimeZone +hoursToTimezone :: Int -> TimeZone +hoursToTimezone i = minutesToTimezone (60 * i) + +-- | The UTC time zone +utc :: TimeZone +utc = minutesToTimezone 0 + -- | time of day as represented in hour, minute and second (with picoseconds), typically used to express local time of day data TimeOfDay = TimeOfDay { todHour :: Int, @@ -112,11 +122,49 @@ calendarToDay (CalendarDay year month day) = y = year - a m = month' + (12 * a) - 3 +-- | convert a ToD in UTC to a ToD in some timezone, together with a day adjustment +utcToLocalTimeOfDay :: TimeZone -> TimeOfDay -> (Integer,TimeOfDay) +utcToLocalTimeOfDay (MkTimeZone tz) (TimeOfDay h m s p) = (fromIntegral (div h' 24),TimeOfDay (mod h' 60) (mod m' 60) s p) where + m' = m + tz + h' = h + (div m' 60) + +-- | convert a ToD in some timezone to a ToD in UTC, together with a day adjustment +localToUTCTimeOfDay :: TimeZone -> TimeOfDay -> (Integer,TimeOfDay) +localToUTCTimeOfDay (MkTimeZone tz) = utcToLocalTimeOfDay (MkTimeZone (negate tz)) + +-- note: this is also in System.Time.Clock. +posixDaySeconds :: (Num a) => a +posixDaySeconds = 86400 + +posixDay :: DiffTime +posixDay = siSecondsToTime posixDaySeconds + +-- | get a TimeOfDay given a time since midnight +-- | time more than 24h will be converted to leap-seconds +timeToTimeOfDay :: DiffTime -> TimeOfDay +timeToTimeOfDay dt | dt >= posixDay = TimeOfDay 23 59 (60 + s) p where + offset = dt - posixDay + s = fromIntegral (div offset siSecond) + p = fromIntegral (mod offset siSecond) +timeToTimeOfDay dt = TimeOfDay (fromInteger h) (fromInteger m) (fromInteger s) p where + p = fromIntegral (mod dt siSecond) + s' = fromIntegral (div dt siSecond) + s = mod s' 60 + m' = div s' 60 + m = mod m' 60 + h = div m' 60 + +-- | find out how much time since midnight a given TimeOfDay is +timeOfDayToTime :: TimeOfDay -> DiffTime +timeOfDayToTime (TimeOfDay h m s ps) = (((fromIntegral h) * 60 + (fromIntegral m)) * 60 + (fromIntegral s)) * siSecond + (fromIntegral ps) utcToCalendar :: TimeZone -> UTCTime -> CalendarTime -utcToCalendar tz utc = undefined +utcToCalendar tz (UTCTime day dt) = CalendarTime (dayToCalendar (day + i)) tod where + (i,tod) = utcToLocalTimeOfDay tz (timeToTimeOfDay dt) calendarToUTC :: TimeZone -> CalendarTime -> UTCTime -calendarToUTC tz cal = undefined +calendarToUTC tz (CalendarTime cday tod) = UTCTime (day + i) (timeOfDayToTime todUTC) where + day = calendarToDay cday + (i,todUTC) = localToUTCTimeOfDay tz tod diff --git a/System/Time/Clock.hs b/System/Time/Clock.hs index 5a4825f..bfc7379 100644 --- a/System/Time/Clock.hs +++ b/System/Time/Clock.hs @@ -6,7 +6,7 @@ module System.Time.Clock ModJulianDay,ModJulianDate, -- absolute time intervals - DiffTime,timeToSISeconds,siSecondsToTime, + DiffTime,siSecond,timeToSISeconds,siSecondsToTime, -- UTC arithmetic UTCTime(..),UTCDiffTime,utcTimeToUTCSeconds,utcSecondsToUTCTime, @@ -35,6 +35,9 @@ newtype DiffTime = MkDiffTime Integer deriving (Eq,Ord,Num,Enum,Real,Integral) instance Show DiffTime where show (MkDiffTime t) = (show t) ++ "ps" +siSecond :: DiffTime +siSecond = secondPicoseconds + timeToSISeconds :: (Fractional a) => DiffTime -> a timeToSISeconds t = fromRational ((toRational t) / (toRational secondPicoseconds)); diff --git a/TestTime.hs b/TestTime.hs index af9ceec..104801e 100644 --- a/TestTime.hs +++ b/TestTime.hs @@ -11,10 +11,22 @@ showCal d = do putStr ((show d) ++ "=" ++ show (dayToCalendar d)) putStrLn (if d == d' then "" else "=" ++ (show d') ++ "!") +showUTCTime :: UTCTime -> String +showUTCTime (UTCTime d t) = show d ++ "," ++ show t + for :: (Monad m) => (a -> m ()) -> [a] -> m () for _ [] = return () for f (x:xs) = f x >> for f xs +myzone :: TimeZone +myzone = hoursToTimezone (- 8) + +leapSec1998Cal :: CalendarTime +leapSec1998Cal = CalendarTime (CalendarDay 1998 12 31) (TimeOfDay 23 59 60 500000000000) + +leapSec1998 :: UTCTime +leapSec1998 = calendarToUTC utc leapSec1998Cal + main :: IO () main = do showCal 0 @@ -36,3 +48,12 @@ main = do showCal 51604 -- years 2000 and 2001, plus some slop for showCal [51540..52280] + -- + putStrLn "" + showCal 51178 + putStrLn (show leapSec1998Cal) + putStrLn (showUTCTime leapSec1998) + let lsMineCal = utcToCalendar myzone leapSec1998 + putStrLn (show lsMineCal) + let lsMine = calendarToUTC myzone lsMineCal + putStrLn (showUTCTime lsMine) diff --git a/TestTime.ref b/TestTime.ref index c589a5d..ebe832a 100644 --- a/TestTime.ref +++ b/TestTime.ref @@ -752,3 +752,9 @@ 52278=2002-01-04 52279=2002-01-05 52280=2002-01-06 + +51178=1998-12-31 +1998-12-31 23:59:60.5 +51178,86400500000000000ps +1998-12-31 15:59:60.5 +51178,86400500000000000ps From git at git.haskell.org Mon Feb 20 21:07:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:07:08 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: clean up Makefile (b1c2cb6) Message-ID: <20170220210708.E37113A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/b1c2cb692a509647df3cc13e51aae4876dab9146 >--------------------------------------------------------------- commit b1c2cb692a509647df3cc13e51aae4876dab9146 Author: Ashley Yakeley Date: Mon Mar 7 15:47:36 2005 -0800 clean up Makefile darcs-hash:20050307234736-ac6dd-66591efb772cae81fb9bd808041e77c25388a881 >--------------------------------------------------------------- b1c2cb692a509647df3cc13e51aae4876dab9146 Makefile | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index e957529..f96ab63 100644 --- a/Makefile +++ b/Makefile @@ -1,21 +1,26 @@ -default: CurrentTime.run TestTime.diff +default: CurrentTime.run TestTime.diff doc SRCS = System/Time/Clock.hs System/Time/TAI.hs System/Time/Calendar.hs -TestTime: TestTime.o $(patsubst %.hs,%.o,$(SRCS)) +TestTime: TestTime.o libTimeLib.a ghc $^ -o $@ -CurrentTime: CurrentTime.o $(patsubst %.hs,%.o,$(SRCS)) +CurrentTime: CurrentTime.o libTimeLib.a ghc $^ -o $@ +libTimeLib.a: $(patsubst %.hs,%.o,$(SRCS)) + rm -f $@ + ar cru $@ $^ + ranlib $@ clean: - rm -f TestTime *.o *.hi $(patsubst %.hs,%.o,$(SRCS)) $(patsubst %.hs,%.hi,$(SRCS)) Makefile.bak + rm -rf TestTime doc haddock *.out *.o *.hi $(patsubst %.hs,%.o,$(SRCS)) $(patsubst %.hs,%.hi,$(SRCS)) Makefile.bak +doc: haddock/index.html -doc: $(SRCS) - mkdir -p $@ - haddock -h -o $@ $^ +haddock/index.html: $(SRCS) + mkdir -p haddock + haddock -h -o haddock $^ %.diff: %.ref %.out diff -u $^ From git at git.haskell.org Mon Feb 20 21:07:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:07:10 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: remove -fglasgow-exts, add -Wall -Werror to all library modules (8ae7ab8) Message-ID: <20170220210710.EA0123A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/8ae7ab80ed7deb4e07ed2f6ddf1ce52620f3df35 >--------------------------------------------------------------- commit 8ae7ab80ed7deb4e07ed2f6ddf1ce52620f3df35 Author: Ashley Yakeley Date: Mon Mar 7 17:40:33 2005 -0800 remove -fglasgow-exts, add -Wall -Werror to all library modules darcs-hash:20050308014033-ac6dd-7894f665c98a12862a4af7de8f1eb49e2342aa26 >--------------------------------------------------------------- 8ae7ab80ed7deb4e07ed2f6ddf1ce52620f3df35 System/Time/Calendar.hs | 8 ++++--- System/Time/Clock.hs | 62 +++++++++++++++++++++++++++++++++++++++++++++---- System/Time/TAI.hs | 4 +++- 3 files changed, 65 insertions(+), 9 deletions(-) diff --git a/System/Time/Calendar.hs b/System/Time/Calendar.hs index cb1862b..552f215 100644 --- a/System/Time/Calendar.hs +++ b/System/Time/Calendar.hs @@ -1,3 +1,5 @@ +{-# OPTIONS -Wall -Werror #-} + module System.Time.Calendar ( -- time zones @@ -57,7 +59,7 @@ show2 i = let _ -> s showFraction :: Integer -> Integer -> String -showFraction d 0 = "" +showFraction _ 0 = "" showFraction d i = (chr (fromInteger (48 + (div i d)))):showFraction (div d 10) (mod i d) showpicodecimal :: Integer -> String @@ -138,7 +140,7 @@ localToUTCTimeOfDay :: TimeZone -> TimeOfDay -> (Integer,TimeOfDay) localToUTCTimeOfDay (MkTimeZone tz) = utcToLocalTimeOfDay (MkTimeZone (negate tz)) -- note: this is also in System.Time.Clock. -posixDaySeconds :: (Num a) => a +posixDaySeconds :: Rational posixDaySeconds = 86400 posixDay :: DiffTime @@ -174,7 +176,7 @@ calendarToUTC tz (CalendarTime cday tod) = UTCTime (day + i) (timeOfDayToTime to -- | get a TimeOfDay given the fraction of a day since midnight dayFractionToTimeOfDay :: Rational -> TimeOfDay -dayFractionToTimeOfDay df = timeToTimeOfDay (siSecondsToTime (round (df * posixDaySeconds))) +dayFractionToTimeOfDay df = timeToTimeOfDay (siSecondsToTime (round (df * posixDaySeconds) :: Integer)) -- | 1st arg is observation meridian in degrees, positive is East ut1ToCalendar :: Rational -> ModJulianDate -> CalendarTime diff --git a/System/Time/Clock.hs b/System/Time/Clock.hs index bfc7379..63540d6 100644 --- a/System/Time/Clock.hs +++ b/System/Time/Clock.hs @@ -1,4 +1,4 @@ -{-# OPTIONS -ffi -fglasgow-exts #-} +{-# OPTIONS -ffi -Wall -Werror #-} module System.Time.Clock ( @@ -30,16 +30,42 @@ secondPicoseconds :: (Num a) => a secondPicoseconds = 1000000000000 -- | a length of time -newtype DiffTime = MkDiffTime Integer deriving (Eq,Ord,Num,Enum,Real,Integral) +newtype DiffTime = MkDiffTime Integer deriving (Eq,Ord,Enum) instance Show DiffTime where show (MkDiffTime t) = (show t) ++ "ps" +-- necessary because H98 doesn't have "cunning newtype" derivation +instance Num DiffTime where + (MkDiffTime a) + (MkDiffTime b) = MkDiffTime (a + b) + (MkDiffTime a) - (MkDiffTime b) = MkDiffTime (a - b) + (MkDiffTime a) * (MkDiffTime b) = MkDiffTime (a * b) + negate (MkDiffTime a) = MkDiffTime (negate a) + abs (MkDiffTime a) = MkDiffTime (abs a) + signum (MkDiffTime a) = MkDiffTime (signum a) + fromInteger i = MkDiffTime (fromInteger i) + +-- necessary because H98 doesn't have "cunning newtype" derivation +instance Real DiffTime where + toRational (MkDiffTime a) = toRational a + +-- necessary because H98 doesn't have "cunning newtype" derivation +instance Integral DiffTime where + quot (MkDiffTime a) (MkDiffTime b) = MkDiffTime (quot a b) + rem (MkDiffTime a) (MkDiffTime b) = MkDiffTime (rem a b) + div (MkDiffTime a) (MkDiffTime b) = MkDiffTime (div a b) + mod (MkDiffTime a) (MkDiffTime b) = MkDiffTime (mod a b) + quotRem (MkDiffTime a) (MkDiffTime b) = (MkDiffTime p,MkDiffTime q) where + (p,q) = quotRem a b + divMod (MkDiffTime a) (MkDiffTime b) = (MkDiffTime p,MkDiffTime q) where + (p,q) = divMod a b + toInteger (MkDiffTime a) = toInteger a + siSecond :: DiffTime siSecond = secondPicoseconds timeToSISeconds :: (Fractional a) => DiffTime -> a -timeToSISeconds t = fromRational ((toRational t) / (toRational secondPicoseconds)); +timeToSISeconds t = fromRational ((toRational t) / secondPicoseconds); siSecondsToTime :: (Real a) => a -> DiffTime siSecondsToTime t = fromInteger (round ((toRational t) * secondPicoseconds)) @@ -53,13 +79,39 @@ data UTCTime = UTCTime { } -- | a length of time for UTC, ignoring leap-seconds -newtype UTCDiffTime = MkUTCDiffTime Integer deriving (Eq,Ord,Num,Enum,Real,Integral) +newtype UTCDiffTime = MkUTCDiffTime Integer deriving (Eq,Ord,Enum) instance Show UTCDiffTime where show (MkUTCDiffTime t) = (show t) ++ "ps" +-- necessary because H98 doesn't have "cunning newtype" derivation +instance Num UTCDiffTime where + (MkUTCDiffTime a) + (MkUTCDiffTime b) = MkUTCDiffTime (a + b) + (MkUTCDiffTime a) - (MkUTCDiffTime b) = MkUTCDiffTime (a - b) + (MkUTCDiffTime a) * (MkUTCDiffTime b) = MkUTCDiffTime (a * b) + negate (MkUTCDiffTime a) = MkUTCDiffTime (negate a) + abs (MkUTCDiffTime a) = MkUTCDiffTime (abs a) + signum (MkUTCDiffTime a) = MkUTCDiffTime (signum a) + fromInteger i = MkUTCDiffTime (fromInteger i) + +-- necessary because H98 doesn't have "cunning newtype" derivation +instance Real UTCDiffTime where + toRational (MkUTCDiffTime a) = toRational a + +-- necessary because H98 doesn't have "cunning newtype" derivation +instance Integral UTCDiffTime where + quot (MkUTCDiffTime a) (MkUTCDiffTime b) = MkUTCDiffTime (quot a b) + rem (MkUTCDiffTime a) (MkUTCDiffTime b) = MkUTCDiffTime (rem a b) + div (MkUTCDiffTime a) (MkUTCDiffTime b) = MkUTCDiffTime (div a b) + mod (MkUTCDiffTime a) (MkUTCDiffTime b) = MkUTCDiffTime (mod a b) + quotRem (MkUTCDiffTime a) (MkUTCDiffTime b) = (MkUTCDiffTime p,MkUTCDiffTime q) where + (p,q) = quotRem a b + divMod (MkUTCDiffTime a) (MkUTCDiffTime b) = (MkUTCDiffTime p,MkUTCDiffTime q) where + (p,q) = divMod a b + toInteger (MkUTCDiffTime a) = toInteger a + utcTimeToUTCSeconds :: (Fractional a) => UTCDiffTime -> a -utcTimeToUTCSeconds t = fromRational ((toRational t) / (toRational secondPicoseconds)) +utcTimeToUTCSeconds t = fromRational ((toRational t) / secondPicoseconds) utcSecondsToUTCTime :: (Real a) => a -> UTCDiffTime utcSecondsToUTCTime t = fromInteger (round ((toRational t) * secondPicoseconds)) diff --git a/System/Time/TAI.hs b/System/Time/TAI.hs index 501f817..0b85db8 100644 --- a/System/Time/TAI.hs +++ b/System/Time/TAI.hs @@ -1,3 +1,5 @@ +{-# OPTIONS -Wall -Werror #-} + -- | most people won't need this module module System.Time.TAI ( @@ -33,4 +35,4 @@ utcToTAITime table (UTCTime day dtime) = MkAbsoluteTime ((siSecondsToTime (day * 86400 + (table day))) + dtime) taiToUTCTime :: LeapSecondTable -> AbsoluteTime -> UTCTime -taiToUTCTime table (MkAbsoluteTime t) = undefined +taiToUTCTime table (MkAbsoluteTime t) = undefined table t From git at git.haskell.org Mon Feb 20 21:07:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:07:06 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: UT1 calendar functions, with test (49c8b0d) Message-ID: <20170220210706.DAB823A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/49c8b0dd832c81ebe74516fa479bf131708e4e3b >--------------------------------------------------------------- commit 49c8b0dd832c81ebe74516fa479bf131708e4e3b Author: Ashley Yakeley Date: Mon Mar 7 15:17:45 2005 -0800 UT1 calendar functions, with test darcs-hash:20050307231745-ac6dd-24178425239c3be3a07adedddb2914b3af72353e >--------------------------------------------------------------- 49c8b0dd832c81ebe74516fa479bf131708e4e3b System/Time/Calendar.hs | 26 +++++++++++++++++++-- TestTime.hs | 61 ++++++++++++++++++++++++++++++++++--------------- TestTime.ref | 7 ++++++ 3 files changed, 74 insertions(+), 20 deletions(-) diff --git a/System/Time/Calendar.hs b/System/Time/Calendar.hs index 60312e8..cb1862b 100644 --- a/System/Time/Calendar.hs +++ b/System/Time/Calendar.hs @@ -5,12 +5,17 @@ module System.Time.Calendar -- getting the locale time zone - -- converting times to Gregorian "calendrical" format + -- Gregorian "calendrical" format TimeOfDay(..),CalendarDay(..),CalendarTime(..), dayToCalendar,calendarToDay, + + -- converting UTC times to Gregorian "calendrical" format utcToLocalTimeOfDay,localToUTCTimeOfDay, timeToTimeOfDay,timeOfDayToTime, - utcToCalendar,calendarToUTC + utcToCalendar,calendarToUTC, + + -- converting UT1 times to Gregorian "calendrical" format + ut1ToCalendar,calendarToUT1 -- calendrical arithmetic -- e.g. "one month after March 31st" @@ -167,4 +172,21 @@ calendarToUTC tz (CalendarTime cday tod) = UTCTime (day + i) (timeOfDayToTime to day = calendarToDay cday (i,todUTC) = localToUTCTimeOfDay tz tod +-- | get a TimeOfDay given the fraction of a day since midnight +dayFractionToTimeOfDay :: Rational -> TimeOfDay +dayFractionToTimeOfDay df = timeToTimeOfDay (siSecondsToTime (round (df * posixDaySeconds))) + +-- | 1st arg is observation meridian in degrees, positive is East +ut1ToCalendar :: Rational -> ModJulianDate -> CalendarTime +ut1ToCalendar long date = CalendarTime (dayToCalendar localDay) (dayFractionToTimeOfDay localToDOffset) where + localTime = date + long / 360 :: Rational + localDay = floor localTime + localToDOffset = localTime - (fromIntegral localDay) + +-- | get the fraction of a day since midnight given a TimeOfDay +timeOfDayToDayFraction :: TimeOfDay -> Rational +timeOfDayToDayFraction tod = timeToSISeconds (timeOfDayToTime tod) / posixDaySeconds +-- | 1st arg is observation meridian in degrees, positive is East +calendarToUT1 :: Rational -> CalendarTime -> ModJulianDate +calendarToUT1 long (CalendarTime cday tod) = (fromIntegral (calendarToDay cday)) + (timeOfDayToDayFraction tod) - (long / 360) diff --git a/TestTime.hs b/TestTime.hs index 104801e..d2c47cb 100644 --- a/TestTime.hs +++ b/TestTime.hs @@ -11,24 +11,9 @@ showCal d = do putStr ((show d) ++ "=" ++ show (dayToCalendar d)) putStrLn (if d == d' then "" else "=" ++ (show d') ++ "!") -showUTCTime :: UTCTime -> String -showUTCTime (UTCTime d t) = show d ++ "," ++ show t - -for :: (Monad m) => (a -> m ()) -> [a] -> m () -for _ [] = return () -for f (x:xs) = f x >> for f xs -myzone :: TimeZone -myzone = hoursToTimezone (- 8) - -leapSec1998Cal :: CalendarTime -leapSec1998Cal = CalendarTime (CalendarDay 1998 12 31) (TimeOfDay 23 59 60 500000000000) - -leapSec1998 :: UTCTime -leapSec1998 = calendarToUTC utc leapSec1998Cal - -main :: IO () -main = do +testCal :: IO () +testCal = do showCal 0 showCal 40000 showCal 50000 @@ -48,7 +33,25 @@ main = do showCal 51604 -- years 2000 and 2001, plus some slop for showCal [51540..52280] - -- + +showUTCTime :: UTCTime -> String +showUTCTime (UTCTime d t) = show d ++ "," ++ show t + +for :: (Monad m) => (a -> m ()) -> [a] -> m () +for _ [] = return () +for f (x:xs) = f x >> for f xs + +myzone :: TimeZone +myzone = hoursToTimezone (- 8) + +leapSec1998Cal :: CalendarTime +leapSec1998Cal = CalendarTime (CalendarDay 1998 12 31) (TimeOfDay 23 59 60 500000000000) + +leapSec1998 :: UTCTime +leapSec1998 = calendarToUTC utc leapSec1998Cal + +testUTC :: IO () +testUTC = do putStrLn "" showCal 51178 putStrLn (show leapSec1998Cal) @@ -57,3 +60,25 @@ main = do putStrLn (show lsMineCal) let lsMine = calendarToUTC myzone lsMineCal putStrLn (showUTCTime lsMine) + +neglong :: Rational +neglong = -120 + +poslong :: Rational +poslong = 120 + +testUT1 :: IO () +testUT1 = do + putStrLn "" + putStrLn (show (ut1ToCalendar 0 51604.0)) + putStrLn (show (ut1ToCalendar 0 51604.5)) + putStrLn (show (ut1ToCalendar neglong 51604.0)) + putStrLn (show (ut1ToCalendar neglong 51604.5)) + putStrLn (show (ut1ToCalendar poslong 51604.0)) + putStrLn (show (ut1ToCalendar poslong 51604.5)) + +main :: IO () +main = do + testCal + testUTC + testUT1 diff --git a/TestTime.ref b/TestTime.ref index ebe832a..0d8e12b 100644 --- a/TestTime.ref +++ b/TestTime.ref @@ -758,3 +758,10 @@ 51178,86400500000000000ps 1998-12-31 15:59:60.5 51178,86400500000000000ps + +2000-03-01 00:00:00 +2000-03-01 12:00:00 +2000-02-29 16:00:00 +2000-03-01 04:00:00 +2000-03-01 08:00:00 +2000-03-01 20:00:00 From git at git.haskell.org Mon Feb 20 21:07:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:07:12 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: new Data.Fixed module with test, move System.Time.* to Fixed arithmetic (fd8f5d0) Message-ID: <20170220210712.F3C0F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/fd8f5d0cfe55fbf4e4bfd36c594ee80e65704b98 >--------------------------------------------------------------- commit fd8f5d0cfe55fbf4e4bfd36c594ee80e65704b98 Author: Ashley Yakeley Date: Wed Mar 9 01:07:08 2005 -0800 new Data.Fixed module with test, move System.Time.* to Fixed arithmetic darcs-hash:20050309090708-ac6dd-967511e90aa27f86370e163ff42ee30950b27250 >--------------------------------------------------------------- fd8f5d0cfe55fbf4e4bfd36c594ee80e65704b98 Data/Fixed.hs | 118 ++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 17 +++++-- System/Time/Calendar.hs | 50 ++++++++------------ System/Time/Clock.hs | 94 +++++++++++++------------------------- System/Time/TAI.hs | 5 +- TestFixed.hs | 23 ++++++++++ TestFixed.ref | 72 +++++++++++++++++++++++++++++ TestTime.hs | 2 +- TestTime.ref | 4 +- 9 files changed, 284 insertions(+), 101 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 fd8f5d0cfe55fbf4e4bfd36c594ee80e65704b98 From git at git.haskell.org Mon Feb 20 21:07:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:07:15 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: use realToFrac (dfadfd1) Message-ID: <20170220210715.06E913A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/dfadfd12a18f2fec5bdd56e47c847a9fcfb79cb2 >--------------------------------------------------------------- commit dfadfd12a18f2fec5bdd56e47c847a9fcfb79cb2 Author: Ashley Yakeley Date: Sun Mar 20 22:31:44 2005 -0800 use realToFrac darcs-hash:20050321063144-ac6dd-a67fc28e4d4dfcabaf93e5863c79e8697254d5e5 >--------------------------------------------------------------- dfadfd12a18f2fec5bdd56e47c847a9fcfb79cb2 Data/Fixed.hs | 6 +----- System/Time/Calendar.hs | 12 ++++++------ System/Time/Clock.hs | 8 ++++---- System/Time/TAI.hs | 5 ++--- 4 files changed, 13 insertions(+), 18 deletions(-) diff --git a/Data/Fixed.hs b/Data/Fixed.hs index 7e90374..971a39b 100644 --- a/Data/Fixed.hs +++ b/Data/Fixed.hs @@ -2,7 +2,7 @@ module Data.Fixed ( - fromReal,div',mod',divMod', + div',mod',divMod', Fixed,HasResolution(..), showFixed, @@ -10,10 +10,6 @@ module Data.Fixed E12,Pico ) where --- | similar idea to "fromIntegral" -fromReal :: (Real a,Fractional b) => a -> b -fromReal = fromRational . toRational - -- | like "div", but with a more useful type div' :: (Real a,Integral b) => a -> a -> b div' n d = floor ((toRational n) / (toRational d)) diff --git a/System/Time/Calendar.hs b/System/Time/Calendar.hs index 9c434f6..5cc646a 100644 --- a/System/Time/Calendar.hs +++ b/System/Time/Calendar.hs @@ -127,7 +127,7 @@ calendarToDay (CalendarDay year month day) = -- | convert a ToD in UTC to a ToD in some timezone, together with a day adjustment utcToLocalTimeOfDay :: TimeZone -> TimeOfDay -> (Integer,TimeOfDay) -utcToLocalTimeOfDay (MkTimeZone tz) (TimeOfDay h m s) = (fromIntegral (div h' 24),TimeOfDay (mod h' 60) (mod m' 60) s) where +utcToLocalTimeOfDay (MkTimeZone tz) (TimeOfDay h m s) = (fromIntegral (div h' 24),TimeOfDay (mod h' 24) (mod m' 60) s) where m' = m + tz h' = h + (div m' 60) @@ -141,9 +141,9 @@ posixDay = fromInteger 86400 -- | get a TimeOfDay given a time since midnight -- | time more than 24h will be converted to leap-seconds timeToTimeOfDay :: DiffTime -> TimeOfDay -timeToTimeOfDay dt | dt >= posixDay = TimeOfDay 23 59 (60 + (fromReal (dt - posixDay))) +timeToTimeOfDay dt | dt >= posixDay = TimeOfDay 23 59 (60 + (realToFrac (dt - posixDay))) timeToTimeOfDay dt = TimeOfDay (fromInteger h) (fromInteger m) s where - s' = fromReal dt + s' = realToFrac dt s = mod' s' 60 m' = div' s' 60 m = mod' m' 60 @@ -151,7 +151,7 @@ timeToTimeOfDay dt = TimeOfDay (fromInteger h) (fromInteger m) s where -- | find out how much time since midnight a given TimeOfDay is timeOfDayToTime :: TimeOfDay -> DiffTime -timeOfDayToTime (TimeOfDay h m s) = ((fromIntegral h) * 60 + (fromIntegral m)) * 60 + (fromReal s) +timeOfDayToTime (TimeOfDay h m s) = ((fromIntegral h) * 60 + (fromIntegral m)) * 60 + (realToFrac s) -- | show a UTC time in a given time zone as a CalendarTime utcToCalendar :: TimeZone -> UTCTime -> CalendarTime @@ -166,7 +166,7 @@ calendarToUTC tz (CalendarTime cday tod) = UTCTime (day + i) (timeOfDayToTime to -- | get a TimeOfDay given the fraction of a day since midnight dayFractionToTimeOfDay :: Rational -> TimeOfDay -dayFractionToTimeOfDay df = timeToTimeOfDay (fromReal (df * 86400)) +dayFractionToTimeOfDay df = timeToTimeOfDay (realToFrac (df * 86400)) -- | 1st arg is observation meridian in degrees, positive is East ut1ToCalendar :: Rational -> ModJulianDate -> CalendarTime @@ -177,7 +177,7 @@ ut1ToCalendar long date = CalendarTime (dayToCalendar localDay) (dayFractionToTi -- | get the fraction of a day since midnight given a TimeOfDay timeOfDayToDayFraction :: TimeOfDay -> Rational -timeOfDayToDayFraction tod = fromReal (timeOfDayToTime tod / posixDay) +timeOfDayToDayFraction tod = realToFrac (timeOfDayToTime tod / posixDay) -- | 1st arg is observation meridian in degrees, positive is East calendarToUT1 :: Rational -> CalendarTime -> ModJulianDate diff --git a/System/Time/Clock.hs b/System/Time/Clock.hs index 73b9bf3..c13fb61 100644 --- a/System/Time/Clock.hs +++ b/System/Time/Clock.hs @@ -97,18 +97,18 @@ unixEpochMJD = 40587 posixSecondsToUTCTime :: Pico -> UTCTime posixSecondsToUTCTime i = let (d,t) = divMod' i posixDaySeconds - in UTCTime (d + unixEpochMJD) (fromReal t) + in UTCTime (d + unixEpochMJD) (realToFrac t) utcTimeToPOSIXSeconds :: UTCTime -> Pico utcTimeToPOSIXSeconds (UTCTime d t) = - (fromInteger (d - unixEpochMJD) * posixDaySeconds) + min posixDaySeconds (fromReal t) + (fromInteger (d - unixEpochMJD) * posixDaySeconds) + min posixDaySeconds (realToFrac t) addUTCTime :: UTCDiffTime -> UTCTime -> UTCTime -addUTCTime x t = posixSecondsToUTCTime ((fromReal x) + (utcTimeToPOSIXSeconds t)) +addUTCTime x t = posixSecondsToUTCTime ((realToFrac x) + (utcTimeToPOSIXSeconds t)) diffUTCTime :: UTCTime -> UTCTime -> UTCDiffTime -diffUTCTime a b = fromReal ((utcTimeToPOSIXSeconds a) - (utcTimeToPOSIXSeconds b)) +diffUTCTime a b = realToFrac ((utcTimeToPOSIXSeconds a) - (utcTimeToPOSIXSeconds b)) -- Get current time diff --git a/System/Time/TAI.hs b/System/Time/TAI.hs index b21daa6..8cd7315 100644 --- a/System/Time/TAI.hs +++ b/System/Time/TAI.hs @@ -14,7 +14,6 @@ module System.Time.TAI ) where import System.Time.Clock -import Data.Fixed -- | TAI as DiffTime from epoch newtype AbsoluteTime = MkAbsoluteTime DiffTime deriving (Eq,Ord) @@ -29,11 +28,11 @@ diffAbsoluteTime (MkAbsoluteTime a) (MkAbsoluteTime b) = a - b type LeapSecondTable = ModJulianDay -> Integer utcDayLength :: LeapSecondTable -> ModJulianDay -> DiffTime -utcDayLength table day = fromReal (86400 + (table (day + 1)) - (table day)) +utcDayLength table day = realToFrac (86400 + (table (day + 1)) - (table day)) utcToTAITime :: LeapSecondTable -> UTCTime -> AbsoluteTime utcToTAITime table (UTCTime day dtime) = MkAbsoluteTime - ((fromReal (day * 86400 + (table day))) + dtime) + ((realToFrac (day * 86400 + (table day))) + dtime) taiToUTCTime :: LeapSecondTable -> AbsoluteTime -> UTCTime taiToUTCTime table (MkAbsoluteTime t) = undefined table t From git at git.haskell.org Mon Feb 20 21:07:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:07:17 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: getCurrentTimezone, with test (cb6d14e) Message-ID: <20170220210717.0E83E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/cb6d14eea0baae5259775481c8b7cc0b584b1219 >--------------------------------------------------------------- commit cb6d14eea0baae5259775481c8b7cc0b584b1219 Author: Ashley Yakeley Date: Sun Mar 20 22:37:22 2005 -0800 getCurrentTimezone, with test darcs-hash:20050321063722-ac6dd-9792ff0e686b52fa1c9770058f77e6614445f6fb >--------------------------------------------------------------- cb6d14eea0baae5259775481c8b7cc0b584b1219 CurrentTime.hs | 6 +++--- Makefile | 5 ++++- System/Time/Calendar.hs | 16 +++++++++++++++- timestuff.c | 11 +++++++++++ timestuff.h | 1 + 5 files changed, 34 insertions(+), 5 deletions(-) diff --git a/CurrentTime.hs b/CurrentTime.hs index 19e46c1..770699d 100644 --- a/CurrentTime.hs +++ b/CurrentTime.hs @@ -4,11 +4,11 @@ import System.Time.Clock import System.Time.TAI import System.Time.Calendar -myzone :: TimeZone -myzone = hoursToTimezone (- 8) - main :: IO () main = do now <- getCurrentTime putStrLn (show (utctDay now) ++ "," ++ show (utctDayTime now)) + putStrLn (show (utcToCalendar utc now)) + myzone <- getCurrentTimezone + putStrLn ("timezone minutes: " ++ show (timezoneToMinutes myzone)) putStrLn (show (utcToCalendar myzone now)) diff --git a/Makefile b/Makefile index 82f4d8a..e29aaa5 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,10 @@ TestTime: TestTime.o libTimeLib.a CurrentTime: CurrentTime.o libTimeLib.a ghc $^ -o $@ -libTimeLib.a: $(patsubst %.hs,%.o,$(SRCS)) +timestuff.o: timestuff.c timestuff.h + gcc -o $@ -c $< + +libTimeLib.a: $(patsubst %.hs,%.o,$(SRCS)) timestuff.o rm -f $@ ar cru $@ $^ ranlib $@ diff --git a/System/Time/Calendar.hs b/System/Time/Calendar.hs index 5cc646a..683e017 100644 --- a/System/Time/Calendar.hs +++ b/System/Time/Calendar.hs @@ -1,4 +1,4 @@ -{-# OPTIONS -Wall -Werror #-} +{-# OPTIONS -ffi -Wall -Werror #-} module System.Time.Calendar ( @@ -6,6 +6,7 @@ module System.Time.Calendar TimeZone,timezoneToMinutes,minutesToTimezone,hoursToTimezone,utc, -- getting the locale time zone + getCurrentTimezone, -- Gregorian "calendrical" format TimeOfDay(..),CalendarDay(..),CalendarTime(..), @@ -29,6 +30,9 @@ import System.Time.Clock import Data.Fixed import Data.Char +import Foreign +import Foreign.C + -- | count of minutes newtype TimeZone = MkTimeZone { timezoneToMinutes :: Int @@ -44,6 +48,16 @@ hoursToTimezone i = minutesToTimezone (60 * i) utc :: TimeZone utc = minutesToTimezone 0 +foreign import ccall unsafe "timestuff.h get_current_timezone_seconds" get_current_timezone_seconds :: IO CLong + +-- | Get the current time-zone +getCurrentTimezone :: IO TimeZone +getCurrentTimezone = do + secs <- get_current_timezone_seconds + case secs of + 0x80000000 -> fail "localtime_r failed" + _ -> return (minutesToTimezone (div (fromIntegral secs) 60)) + -- | time of day as represented in hour, minute and second (with picoseconds), typically used to express local time of day data TimeOfDay = TimeOfDay { todHour :: Int, diff --git a/timestuff.c b/timestuff.c new file mode 100644 index 0000000..79139bd --- /dev/null +++ b/timestuff.c @@ -0,0 +1,11 @@ +#include + +long int get_current_timezone_seconds () +{ + time_t t = 0; + struct tm tmd; + struct tm* ptm = localtime_r(&t,&tmd); + if (ptm) + return ptm -> tm_gmtoff; + else return 0x80000000; +} diff --git a/timestuff.h b/timestuff.h new file mode 100644 index 0000000..f58c0f1 --- /dev/null +++ b/timestuff.h @@ -0,0 +1 @@ +long int get_current_timezone_seconds (); From git at git.haskell.org Mon Feb 20 21:07:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:07:21 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: use correct time C header (0d51531) Message-ID: <20170220210721.1B5CD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/0d515313859d601ec4049d971316af1cb944928e >--------------------------------------------------------------- commit 0d515313859d601ec4049d971316af1cb944928e Author: ashley Date: Tue Apr 12 00:06:58 2005 -0700 use correct time C header darcs-hash:20050412070658-ca2d0-13155e99611adfa2e008de3b0461fde925a6b602 >--------------------------------------------------------------- 0d515313859d601ec4049d971316af1cb944928e timestuff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/timestuff.c b/timestuff.c index 79139bd..24c6983 100644 --- a/timestuff.c +++ b/timestuff.c @@ -1,4 +1,4 @@ -#include +#include long int get_current_timezone_seconds () { From git at git.haskell.org Mon Feb 20 21:07:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:07:19 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: fix Enums to conform with Haskell 98 (and GHC 6.4) (59ab29a) Message-ID: <20170220210719.14D8F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/59ab29ace05cdab48bb25566f31f56d443c5fc53 >--------------------------------------------------------------- commit 59ab29ace05cdab48bb25566f31f56d443c5fc53 Author: ashley Date: Tue Apr 12 00:02:57 2005 -0700 fix Enums to conform with Haskell 98 (and GHC 6.4) darcs-hash:20050412070257-ca2d0-fc71ddb95a4c9ca4f6c77e5a90020d194bd814c7 >--------------------------------------------------------------- 59ab29ace05cdab48bb25566f31f56d443c5fc53 Data/Fixed.hs | 12 +++++++++++- System/Time/Clock.hs | 24 ++++++++++++++++++++++-- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/Data/Fixed.hs b/Data/Fixed.hs index 971a39b..697c460 100644 --- a/Data/Fixed.hs +++ b/Data/Fixed.hs @@ -24,7 +24,7 @@ mod' :: (Real a) => a -> a -> a mod' n d = n - (fromInteger f) * d where f = div' n d -newtype Fixed a = MkFixed Integer deriving (Eq,Ord,Enum) +newtype Fixed a = MkFixed Integer deriving (Eq,Ord) class HasResolution a where resolution :: a -> Integer @@ -40,6 +40,16 @@ withType foo = foo undefined withResolution :: (HasResolution a) => (Integer -> f a) -> f a withResolution foo = withType (foo . resolution) +instance Enum (Fixed a) where + succ (MkFixed a) = MkFixed (succ a) + pred (MkFixed a) = MkFixed (pred a) + toEnum = MkFixed . toEnum + fromEnum (MkFixed a) = fromEnum a + enumFrom (MkFixed a) = fmap MkFixed (enumFrom a) + enumFromThen (MkFixed a) (MkFixed b) = fmap MkFixed (enumFromThen a b) + enumFromTo (MkFixed a) (MkFixed b) = fmap MkFixed (enumFromTo a b) + enumFromThenTo (MkFixed a) (MkFixed b) (MkFixed c) = fmap MkFixed (enumFromThenTo a b c) + instance (HasResolution a) => Num (Fixed a) where (MkFixed a) + (MkFixed b) = MkFixed (a + b) (MkFixed a) - (MkFixed b) = MkFixed (a - b) diff --git a/System/Time/Clock.hs b/System/Time/Clock.hs index c13fb61..44192b5 100644 --- a/System/Time/Clock.hs +++ b/System/Time/Clock.hs @@ -28,7 +28,17 @@ type ModJulianDay = Integer type ModJulianDate = Rational -- | a length of time -newtype DiffTime = MkDiffTime Pico deriving (Eq,Ord,Enum) +newtype DiffTime = MkDiffTime Pico deriving (Eq,Ord) + +instance Enum DiffTime where + succ (MkDiffTime a) = MkDiffTime (succ a) + pred (MkDiffTime a) = MkDiffTime (pred a) + toEnum = MkDiffTime . toEnum + fromEnum (MkDiffTime a) = fromEnum a + enumFrom (MkDiffTime a) = fmap MkDiffTime (enumFrom a) + enumFromThen (MkDiffTime a) (MkDiffTime b) = fmap MkDiffTime (enumFromThen a b) + enumFromTo (MkDiffTime a) (MkDiffTime b) = fmap MkDiffTime (enumFromTo a b) + enumFromThenTo (MkDiffTime a) (MkDiffTime b) (MkDiffTime c) = fmap MkDiffTime (enumFromThenTo a b c) instance Show DiffTime where show (MkDiffTime t) = (showFixed True t) ++ "s" @@ -62,7 +72,17 @@ data UTCTime = UTCTime { } -- | a length of time for UTC, ignoring leap-seconds -newtype UTCDiffTime = MkUTCDiffTime Pico deriving (Eq,Ord,Enum) +newtype UTCDiffTime = MkUTCDiffTime Pico deriving (Eq,Ord) + +instance Enum UTCDiffTime where + succ (MkUTCDiffTime a) = MkUTCDiffTime (succ a) + pred (MkUTCDiffTime a) = MkUTCDiffTime (pred a) + toEnum = MkUTCDiffTime . toEnum + fromEnum (MkUTCDiffTime a) = fromEnum a + enumFrom (MkUTCDiffTime a) = fmap MkUTCDiffTime (enumFrom a) + enumFromThen (MkUTCDiffTime a) (MkUTCDiffTime b) = fmap MkUTCDiffTime (enumFromThen a b) + enumFromTo (MkUTCDiffTime a) (MkUTCDiffTime b) = fmap MkUTCDiffTime (enumFromTo a b) + enumFromThenTo (MkUTCDiffTime a) (MkUTCDiffTime b) (MkUTCDiffTime c) = fmap MkUTCDiffTime (enumFromThenTo a b c) instance Show UTCDiffTime where show (MkUTCDiffTime t) = (showFixed True t) ++ "s" From git at git.haskell.org Mon Feb 20 21:07:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:07:23 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Makefile to clean properly (0a170a3) Message-ID: <20170220210723.2284A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/0a170a3e84eb34fdf317328e341431536b554fda >--------------------------------------------------------------- commit 0a170a3e84eb34fdf317328e341431536b554fda Author: ashley Date: Thu Apr 14 00:46:18 2005 -0700 Makefile to clean properly darcs-hash:20050414074618-ca2d0-6b5b46879ec6f176b24a30adf5aa9c699f61de06 >--------------------------------------------------------------- 0a170a3e84eb34fdf317328e341431536b554fda Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e29aaa5..3a69e06 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ libTimeLib.a: $(patsubst %.hs,%.o,$(SRCS)) timestuff.o ranlib $@ clean: - rm -rf TestTime TestFixed doc haddock *.out *.o *.hi $(patsubst %.hs,%.o,$(SRCS)) $(patsubst %.hs,%.hi,$(SRCS)) Makefile.bak + rm -rf CurrentTime TestTime TestFixed doc haddock *.out *.a *.o *.hi $(patsubst %.hs,%.o,$(SRCS)) $(patsubst %.hs,%.hi,$(SRCS)) Makefile.bak doc: haddock/index.html From git at git.haskell.org Mon Feb 20 21:07:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:07:25 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: convert to Cabal (a352b22) Message-ID: <20170220210725.290C63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/a352b227681d42a535e6644688fb01a27c4793f6 >--------------------------------------------------------------- commit a352b227681d42a535e6644688fb01a27c4793f6 Author: ashley Date: Thu Apr 14 00:47:06 2005 -0700 convert to Cabal darcs-hash:20050414074706-ca2d0-8991cfdebe2d192385f7bc175995e0c0d5e1f750 >--------------------------------------------------------------- a352b227681d42a535e6644688fb01a27c4793f6 Setup.hs | 2 ++ TimeLib.cabal | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/Setup.hs b/Setup.hs new file mode 100644 index 0000000..9a994af --- /dev/null +++ b/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/TimeLib.cabal b/TimeLib.cabal new file mode 100644 index 0000000..d7a8089 --- /dev/null +++ b/TimeLib.cabal @@ -0,0 +1,15 @@ +Name: TimeLib +Version: 0.1 +Stability: Alpha +-- unsure of best license +License: AllRightsReserved +Author: Ashley Yakeley +Maintainer: +Homepage: +Category: +Build-Depends: base +Synopsis: a new time library +Exposed-modules: Data.Fixed, System.Time.Clock, System.Time.TAI, System.Time.Calendar +Extensions: ForeignFunctionInterface +C-Sources: timestuff.c + From git at git.haskell.org Mon Feb 20 21:07:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:07:27 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: time-zone test (3317848) Message-ID: <20170220210727.2F7553A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/3317848eb12ef6881bd02614dd3baf1fd9664f1e >--------------------------------------------------------------- commit 3317848eb12ef6881bd02614dd3baf1fd9664f1e Author: Ashley Yakeley Date: Tue Apr 26 00:48:29 2005 -0700 time-zone test darcs-hash:20050426074829-ac6dd-bb8e92544838e18afe1ec6020e8fb145cfaa56e7 >--------------------------------------------------------------- 3317848eb12ef6881bd02614dd3baf1fd9664f1e Makefile | 12 ++++++++++-- System/Time/Calendar.hs | 4 ++++ TimeZone.hs | 9 +++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 3a69e06..44f6935 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -default: TestFixed.diff CurrentTime.run TestTime.diff doc +default: TestFixed.diff CurrentTime.run TestTime.diff TimeZone.diff doc SRCS = Data/Fixed.hs System/Time/Clock.hs System/Time/TAI.hs System/Time/Calendar.hs @@ -11,6 +11,12 @@ TestTime: TestTime.o libTimeLib.a CurrentTime: CurrentTime.o libTimeLib.a ghc $^ -o $@ +TimeZone: TimeZone.o libTimeLib.a + ghc $^ -o $@ + +TimeZone.ref: FORCE + date +%z > $@ + timestuff.o: timestuff.c timestuff.h gcc -o $@ -c $< @@ -20,7 +26,7 @@ libTimeLib.a: $(patsubst %.hs,%.o,$(SRCS)) timestuff.o ranlib $@ clean: - rm -rf CurrentTime TestTime TestFixed doc haddock *.out *.a *.o *.hi $(patsubst %.hs,%.o,$(SRCS)) $(patsubst %.hs,%.hi,$(SRCS)) Makefile.bak + rm -rf TimeZone TimeZone.ref CurrentTime TestTime TestFixed doc haddock *.out *.a *.o *.hi $(patsubst %.hs,%.o,$(SRCS)) $(patsubst %.hs,%.hi,$(SRCS)) Makefile.bak doc: haddock/index.html @@ -43,6 +49,8 @@ haddock/index.html: $(SRCS) %.o: %.hs ghc -c $< -o $@ +FORCE: + .SECONDARY: depend: TestFixed.hs CurrentTime.hs TestTime.hs $(SRCS) diff --git a/System/Time/Calendar.hs b/System/Time/Calendar.hs index 683e017..ca10a6e 100644 --- a/System/Time/Calendar.hs +++ b/System/Time/Calendar.hs @@ -44,6 +44,10 @@ minutesToTimezone = MkTimeZone hoursToTimezone :: Int -> TimeZone hoursToTimezone i = minutesToTimezone (60 * i) +instance Show TimeZone where + show (MkTimeZone t) | t < 0 = '-':(show (MkTimeZone (negate t))) + show (MkTimeZone t) = (show2 (div t 60)) ++ (show2 (mod t 60)) + -- | The UTC time zone utc :: TimeZone utc = minutesToTimezone 0 diff --git a/TimeZone.hs b/TimeZone.hs new file mode 100644 index 0000000..3d8b8bc --- /dev/null +++ b/TimeZone.hs @@ -0,0 +1,9 @@ +module Main where + +import System.Time.Clock +import System.Time.Calendar + +main :: IO () +main = do + zone <- getCurrentTimezone + putStrLn (show zone) From git at git.haskell.org Mon Feb 20 21:07:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:07:31 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: fix posixToCTime for compile on 6.4 (81468e1) Message-ID: <20170220210731.3DCDB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/81468e1dd2fe06e43bdd5368f9861b5b0c541435 >--------------------------------------------------------------- commit 81468e1dd2fe06e43bdd5368f9861b5b0c541435 Author: ashley Date: Wed Apr 27 23:02:29 2005 -0700 fix posixToCTime for compile on 6.4 darcs-hash:20050428060229-ca2d0-86daee65c2a063f72be81d04c32aa3efed47180b >--------------------------------------------------------------- 81468e1dd2fe06e43bdd5368f9861b5b0c541435 System/Time/Calendar.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/System/Time/Calendar.hs b/System/Time/Calendar.hs index 58f38a3..97c6bac 100644 --- a/System/Time/Calendar.hs +++ b/System/Time/Calendar.hs @@ -55,7 +55,7 @@ utc = minutesToTimezone 0 foreign import ccall unsafe "timestuff.h get_current_timezone_seconds" get_current_timezone_seconds :: CTime -> IO CLong posixToCTime :: POSIXTime -> CTime -posixToCTime = floor +posixToCTime = fromInteger . floor -- | Get the local time-zone for a given time (varying as per summertime adjustments) getTimezone :: UTCTime -> IO TimeZone From git at git.haskell.org Mon Feb 20 21:07:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:07:29 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: correct time-zone handling (066e6ee) Message-ID: <20170220210729.364053A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/066e6ee153ebb020a34f27a23c0db05f433fc5ef >--------------------------------------------------------------- commit 066e6ee153ebb020a34f27a23c0db05f433fc5ef Author: Ashley Yakeley Date: Wed Apr 27 01:47:46 2005 -0700 correct time-zone handling darcs-hash:20050427084746-ac6dd-6fe841a9a26be8954affc8cc42e5f080e4b355a2 >--------------------------------------------------------------- 066e6ee153ebb020a34f27a23c0db05f433fc5ef CurrentTime.hs | 2 +- System/Time/Calendar.hs | 17 ++++++++++++----- System/Time/Clock.hs | 35 ++++++++++++++++++++++++----------- TimeLib.cabal | 1 - timestuff.c | 5 ++--- timestuff.h | 4 +++- 6 files changed, 42 insertions(+), 22 deletions(-) diff --git a/CurrentTime.hs b/CurrentTime.hs index 770699d..62c88e5 100644 --- a/CurrentTime.hs +++ b/CurrentTime.hs @@ -10,5 +10,5 @@ main = do putStrLn (show (utctDay now) ++ "," ++ show (utctDayTime now)) putStrLn (show (utcToCalendar utc now)) myzone <- getCurrentTimezone - putStrLn ("timezone minutes: " ++ show (timezoneToMinutes myzone)) + putStrLn ("timezone: " ++ show myzone) putStrLn (show (utcToCalendar myzone now)) diff --git a/System/Time/Calendar.hs b/System/Time/Calendar.hs index ca10a6e..58f38a3 100644 --- a/System/Time/Calendar.hs +++ b/System/Time/Calendar.hs @@ -52,16 +52,23 @@ instance Show TimeZone where utc :: TimeZone utc = minutesToTimezone 0 -foreign import ccall unsafe "timestuff.h get_current_timezone_seconds" get_current_timezone_seconds :: IO CLong +foreign import ccall unsafe "timestuff.h get_current_timezone_seconds" get_current_timezone_seconds :: CTime -> IO CLong --- | Get the current time-zone -getCurrentTimezone :: IO TimeZone -getCurrentTimezone = do - secs <- get_current_timezone_seconds +posixToCTime :: POSIXTime -> CTime +posixToCTime = floor + +-- | Get the local time-zone for a given time (varying as per summertime adjustments) +getTimezone :: UTCTime -> IO TimeZone +getTimezone time = do + secs <- get_current_timezone_seconds (posixToCTime (utcTimeToPOSIXSeconds time)) case secs of 0x80000000 -> fail "localtime_r failed" _ -> return (minutesToTimezone (div (fromIntegral secs) 60)) +-- | Get the current time-zone +getCurrentTimezone :: IO TimeZone +getCurrentTimezone = getCurrentTime >>= getTimezone + -- | time of day as represented in hour, minute and second (with picoseconds), typically used to express local time of day data TimeOfDay = TimeOfDay { todHour :: Int, diff --git a/System/Time/Clock.hs b/System/Time/Clock.hs index 44192b5..2683841 100644 --- a/System/Time/Clock.hs +++ b/System/Time/Clock.hs @@ -13,7 +13,10 @@ module System.Time.Clock addUTCTime,diffUTCTime, -- getting the current UTC time - getCurrentTime + getCurrentTime, + + -- needed by System.Time.Calendar to talk to the Unix API + POSIXTime,posixSecondsToUTCTime,utcTimeToPOSIXSeconds ) where import Data.Fixed @@ -107,36 +110,46 @@ instance Fractional UTCDiffTime where recip (MkUTCDiffTime a) = MkUTCDiffTime (recip a) fromRational r = MkUTCDiffTime (fromRational r) -posixDaySeconds :: Pico -posixDaySeconds = 86400 +-- necessary because H98 doesn't have "cunning newtype" derivation +instance RealFrac UTCDiffTime where + properFraction (MkUTCDiffTime a) = (i,MkUTCDiffTime f) where + (i,f) = properFraction a + truncate (MkUTCDiffTime a) = truncate a + round (MkUTCDiffTime a) = round a + ceiling (MkUTCDiffTime a) = ceiling a + floor (MkUTCDiffTime a) = floor a + +posixDay :: UTCDiffTime +posixDay = 86400 unixEpochMJD :: ModJulianDay unixEpochMJD = 40587 +type POSIXTime = UTCDiffTime -posixSecondsToUTCTime :: Pico -> UTCTime +posixSecondsToUTCTime :: POSIXTime -> UTCTime posixSecondsToUTCTime i = let - (d,t) = divMod' i posixDaySeconds + (d,t) = divMod' i posixDay in UTCTime (d + unixEpochMJD) (realToFrac t) -utcTimeToPOSIXSeconds :: UTCTime -> Pico +utcTimeToPOSIXSeconds :: UTCTime -> POSIXTime utcTimeToPOSIXSeconds (UTCTime d t) = - (fromInteger (d - unixEpochMJD) * posixDaySeconds) + min posixDaySeconds (realToFrac t) + (fromInteger (d - unixEpochMJD) * posixDay) + min posixDay (realToFrac t) addUTCTime :: UTCDiffTime -> UTCTime -> UTCTime -addUTCTime x t = posixSecondsToUTCTime ((realToFrac x) + (utcTimeToPOSIXSeconds t)) +addUTCTime x t = posixSecondsToUTCTime (x + (utcTimeToPOSIXSeconds t)) diffUTCTime :: UTCTime -> UTCTime -> UTCDiffTime -diffUTCTime a b = realToFrac ((utcTimeToPOSIXSeconds a) - (utcTimeToPOSIXSeconds b)) +diffUTCTime a b = (utcTimeToPOSIXSeconds a) - (utcTimeToPOSIXSeconds b) -- Get current time data CTimeval = MkCTimeval CLong CLong -ctimevalToPosixSeconds :: CTimeval -> Pico -ctimevalToPosixSeconds (MkCTimeval s mus) = ((fromIntegral s) + (fromIntegral mus) / 1000000) +ctimevalToPosixSeconds :: CTimeval -> POSIXTime +ctimevalToPosixSeconds (MkCTimeval s mus) = (fromIntegral s) + (fromIntegral mus) / 1000000 instance Storable CTimeval where sizeOf _ = (sizeOf (undefined :: CLong)) * 2 diff --git a/TimeLib.cabal b/TimeLib.cabal index d7a8089..f609ac4 100644 --- a/TimeLib.cabal +++ b/TimeLib.cabal @@ -12,4 +12,3 @@ Synopsis: a new time library Exposed-modules: Data.Fixed, System.Time.Clock, System.Time.TAI, System.Time.Calendar Extensions: ForeignFunctionInterface C-Sources: timestuff.c - diff --git a/timestuff.c b/timestuff.c index 24c6983..92d9fbe 100644 --- a/timestuff.c +++ b/timestuff.c @@ -1,8 +1,7 @@ -#include +#include "timestuff.h" -long int get_current_timezone_seconds () +long int get_current_timezone_seconds (time_t t) { - time_t t = 0; struct tm tmd; struct tm* ptm = localtime_r(&t,&tmd); if (ptm) diff --git a/timestuff.h b/timestuff.h index f58c0f1..534ee67 100644 --- a/timestuff.h +++ b/timestuff.h @@ -1 +1,3 @@ -long int get_current_timezone_seconds (); +#include + +long int get_current_timezone_seconds (time_t); From git at git.haskell.org Mon Feb 20 21:07:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:07:33 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: expose getTimeZone (51caf03) Message-ID: <20170220210733.43F483A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/51caf0365ac20cfb829cedb18364e6891186325e >--------------------------------------------------------------- commit 51caf0365ac20cfb829cedb18364e6891186325e Author: ashley Date: Wed Apr 27 23:03:04 2005 -0700 expose getTimeZone darcs-hash:20050428060304-ca2d0-462560f690d4a8d591fc61dcf9eacdf91618b663 >--------------------------------------------------------------- 51caf0365ac20cfb829cedb18364e6891186325e System/Time/Calendar.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/System/Time/Calendar.hs b/System/Time/Calendar.hs index 97c6bac..828a664 100644 --- a/System/Time/Calendar.hs +++ b/System/Time/Calendar.hs @@ -6,7 +6,7 @@ module System.Time.Calendar TimeZone,timezoneToMinutes,minutesToTimezone,hoursToTimezone,utc, -- getting the locale time zone - getCurrentTimezone, + getTimezone,getCurrentTimezone, -- Gregorian "calendrical" format TimeOfDay(..),CalendarDay(..),CalendarTime(..), From git at git.haskell.org Mon Feb 20 21:07:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:07:35 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: rename id to Timezone (126e42f) Message-ID: <20170220210735.4AC233A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/126e42f0147dc3738fb5116ea1ee0062ecc91e88 >--------------------------------------------------------------- commit 126e42f0147dc3738fb5116ea1ee0062ecc91e88 Author: ashley Date: Wed Apr 27 23:03:31 2005 -0700 rename id to Timezone darcs-hash:20050428060331-ca2d0-3076a294d8177816b619226e48304a9b093c8cd5 >--------------------------------------------------------------- 126e42f0147dc3738fb5116ea1ee0062ecc91e88 System/Time/Calendar.hs | 34 +++++++++++++++++----------------- TestTime.hs | 2 +- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/System/Time/Calendar.hs b/System/Time/Calendar.hs index 828a664..c5aea12 100644 --- a/System/Time/Calendar.hs +++ b/System/Time/Calendar.hs @@ -3,7 +3,7 @@ module System.Time.Calendar ( -- time zones - TimeZone,timezoneToMinutes,minutesToTimezone,hoursToTimezone,utc, + Timezone,timezoneToMinutes,minutesToTimezone,hoursToTimezone,utc, -- getting the locale time zone getTimezone,getCurrentTimezone, @@ -34,22 +34,22 @@ import Foreign import Foreign.C -- | count of minutes -newtype TimeZone = MkTimeZone { +newtype Timezone = MkTimezone { timezoneToMinutes :: Int } deriving (Eq,Ord) -minutesToTimezone :: Int -> TimeZone -minutesToTimezone = MkTimeZone +minutesToTimezone :: Int -> Timezone +minutesToTimezone = MkTimezone -hoursToTimezone :: Int -> TimeZone +hoursToTimezone :: Int -> Timezone hoursToTimezone i = minutesToTimezone (60 * i) -instance Show TimeZone where - show (MkTimeZone t) | t < 0 = '-':(show (MkTimeZone (negate t))) - show (MkTimeZone t) = (show2 (div t 60)) ++ (show2 (mod t 60)) +instance Show Timezone where + show (MkTimezone t) | t < 0 = '-':(show (MkTimezone (negate t))) + show (MkTimezone t) = (show2 (div t 60)) ++ (show2 (mod t 60)) -- | The UTC time zone -utc :: TimeZone +utc :: Timezone utc = minutesToTimezone 0 foreign import ccall unsafe "timestuff.h get_current_timezone_seconds" get_current_timezone_seconds :: CTime -> IO CLong @@ -58,7 +58,7 @@ posixToCTime :: POSIXTime -> CTime posixToCTime = fromInteger . floor -- | Get the local time-zone for a given time (varying as per summertime adjustments) -getTimezone :: UTCTime -> IO TimeZone +getTimezone :: UTCTime -> IO Timezone getTimezone time = do secs <- get_current_timezone_seconds (posixToCTime (utcTimeToPOSIXSeconds time)) case secs of @@ -66,7 +66,7 @@ getTimezone time = do _ -> return (minutesToTimezone (div (fromIntegral secs) 60)) -- | Get the current time-zone -getCurrentTimezone :: IO TimeZone +getCurrentTimezone :: IO Timezone getCurrentTimezone = getCurrentTime >>= getTimezone -- | time of day as represented in hour, minute and second (with picoseconds), typically used to express local time of day @@ -151,14 +151,14 @@ calendarToDay (CalendarDay year month day) = m = month' + (12 * a) - 3 -- | convert a ToD in UTC to a ToD in some timezone, together with a day adjustment -utcToLocalTimeOfDay :: TimeZone -> TimeOfDay -> (Integer,TimeOfDay) -utcToLocalTimeOfDay (MkTimeZone tz) (TimeOfDay h m s) = (fromIntegral (div h' 24),TimeOfDay (mod h' 24) (mod m' 60) s) where +utcToLocalTimeOfDay :: Timezone -> TimeOfDay -> (Integer,TimeOfDay) +utcToLocalTimeOfDay (MkTimezone tz) (TimeOfDay h m s) = (fromIntegral (div h' 24),TimeOfDay (mod h' 24) (mod m' 60) s) where m' = m + tz h' = h + (div m' 60) -- | convert a ToD in some timezone to a ToD in UTC, together with a day adjustment -localToUTCTimeOfDay :: TimeZone -> TimeOfDay -> (Integer,TimeOfDay) -localToUTCTimeOfDay (MkTimeZone tz) = utcToLocalTimeOfDay (MkTimeZone (negate tz)) +localToUTCTimeOfDay :: Timezone -> TimeOfDay -> (Integer,TimeOfDay) +localToUTCTimeOfDay (MkTimezone tz) = utcToLocalTimeOfDay (MkTimezone (negate tz)) posixDay :: DiffTime posixDay = fromInteger 86400 @@ -179,12 +179,12 @@ timeOfDayToTime :: TimeOfDay -> DiffTime timeOfDayToTime (TimeOfDay h m s) = ((fromIntegral h) * 60 + (fromIntegral m)) * 60 + (realToFrac s) -- | show a UTC time in a given time zone as a CalendarTime -utcToCalendar :: TimeZone -> UTCTime -> CalendarTime +utcToCalendar :: Timezone -> UTCTime -> CalendarTime utcToCalendar tz (UTCTime day dt) = CalendarTime (dayToCalendar (day + i)) tod where (i,tod) = utcToLocalTimeOfDay tz (timeToTimeOfDay dt) -- | find out what UTC time a given CalendarTime in a given time zone is -calendarToUTC :: TimeZone -> CalendarTime -> UTCTime +calendarToUTC :: Timezone -> CalendarTime -> UTCTime calendarToUTC tz (CalendarTime cday tod) = UTCTime (day + i) (timeOfDayToTime todUTC) where day = calendarToDay cday (i,todUTC) = localToUTCTimeOfDay tz tod diff --git a/TestTime.hs b/TestTime.hs index e4a2712..83d2141 100644 --- a/TestTime.hs +++ b/TestTime.hs @@ -41,7 +41,7 @@ for :: (Monad m) => (a -> m ()) -> [a] -> m () for _ [] = return () for f (x:xs) = f x >> for f xs -myzone :: TimeZone +myzone :: Timezone myzone = hoursToTimezone (- 8) leapSec1998Cal :: CalendarTime From git at git.haskell.org Mon Feb 20 21:07:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:07:37 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: midnight and midday (5564e25) Message-ID: <20170220210737.51D8B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/5564e2557b48670109ae4ef8bc3cd1c72793ecf8 >--------------------------------------------------------------- commit 5564e2557b48670109ae4ef8bc3cd1c72793ecf8 Author: Ashley Yakeley Date: Thu Apr 28 02:45:26 2005 -0700 midnight and midday darcs-hash:20050428094526-ac6dd-6f5c7b8db227357b86d1f1c71d1e119404c7e985 >--------------------------------------------------------------- 5564e2557b48670109ae4ef8bc3cd1c72793ecf8 System/Time/Calendar.hs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/System/Time/Calendar.hs b/System/Time/Calendar.hs index c5aea12..fa91928 100644 --- a/System/Time/Calendar.hs +++ b/System/Time/Calendar.hs @@ -8,8 +8,11 @@ module System.Time.Calendar -- getting the locale time zone getTimezone,getCurrentTimezone, + -- TimeOfDay + TimeOfDay(..),midnight,midday, + -- Gregorian "calendrical" format - TimeOfDay(..),CalendarDay(..),CalendarTime(..), + CalendarDay(..),CalendarTime(..), dayToCalendar,calendarToDay, -- converting UTC times to Gregorian "calendrical" format @@ -76,6 +79,12 @@ data TimeOfDay = TimeOfDay { todSec :: Pico } deriving (Eq,Ord) +midnight :: TimeOfDay +midnight = TimeOfDay 0 0 0 + +midday :: TimeOfDay +midday = TimeOfDay 12 0 0 + show2 :: Int -> String show2 i = let s = show i in From git at git.haskell.org Mon Feb 20 21:07:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:07:39 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Eq and Ord instances for UTCTime (2ba76c8) Message-ID: <20170220210739.581D73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/2ba76c8d8b27054af0ed3d6e84117d4669315998 >--------------------------------------------------------------- commit 2ba76c8d8b27054af0ed3d6e84117d4669315998 Author: Ashley Yakeley Date: Thu Apr 28 02:52:24 2005 -0700 Eq and Ord instances for UTCTime darcs-hash:20050428095224-ac6dd-7134a7acb637c0b575d82a6d1e96fab36e834c5a >--------------------------------------------------------------- 2ba76c8d8b27054af0ed3d6e84117d4669315998 System/Time/Clock.hs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/System/Time/Clock.hs b/System/Time/Clock.hs index 2683841..5cb946e 100644 --- a/System/Time/Clock.hs +++ b/System/Time/Clock.hs @@ -74,6 +74,14 @@ data UTCTime = UTCTime { utctDayTime :: DiffTime } +instance Eq UTCTime where + (UTCTime da ta) == (UTCTime db tb) = (da == db) && (ta == tb) + +instance Ord UTCTime where + compare (UTCTime da ta) (UTCTime db tb) = case (compare da db) of + EQ -> compare ta tb + cmp -> cmp + -- | a length of time for UTC, ignoring leap-seconds newtype UTCDiffTime = MkUTCDiffTime Pico deriving (Eq,Ord) From git at git.haskell.org Mon Feb 20 21:07:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:07:41 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: add ShowDST test program (445ae81) Message-ID: <20170220210741.6004D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/445ae81631df6ed4ab222f104783cddd2d3e4737 >--------------------------------------------------------------- commit 445ae81631df6ed4ab222f104783cddd2d3e4737 Author: Ashley Yakeley Date: Thu Apr 28 03:12:16 2005 -0700 add ShowDST test program darcs-hash:20050428101216-ac6dd-b195b5ad2f9d60f5ad650762d377d465f535a991 >--------------------------------------------------------------- 445ae81631df6ed4ab222f104783cddd2d3e4737 Makefile | 7 ++++++- ShowDST.hs | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 44f6935..46f48b9 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -default: TestFixed.diff CurrentTime.run TestTime.diff TimeZone.diff doc +default: test doc CurrentTime.run ShowDST.run SRCS = Data/Fixed.hs System/Time/Clock.hs System/Time/TAI.hs System/Time/Calendar.hs @@ -11,6 +11,9 @@ TestTime: TestTime.o libTimeLib.a CurrentTime: CurrentTime.o libTimeLib.a ghc $^ -o $@ +ShowDST: ShowDST.o libTimeLib.a + ghc $^ -o $@ + TimeZone: TimeZone.o libTimeLib.a ghc $^ -o $@ @@ -25,6 +28,8 @@ libTimeLib.a: $(patsubst %.hs,%.o,$(SRCS)) timestuff.o ar cru $@ $^ ranlib $@ +test: TestFixed.diff TestTime.diff TimeZone.diff + clean: rm -rf TimeZone TimeZone.ref CurrentTime TestTime TestFixed doc haddock *.out *.a *.o *.hi $(patsubst %.hs,%.o,$(SRCS)) $(patsubst %.hs,%.hi,$(SRCS)) Makefile.bak diff --git a/ShowDST.hs b/ShowDST.hs new file mode 100644 index 0000000..7b2dda1 --- /dev/null +++ b/ShowDST.hs @@ -0,0 +1,42 @@ +module Main where + +import System.Time.Clock +import System.Time.Calendar + +monthBeginning :: Timezone -> Integer -> Int -> UTCTime +monthBeginning zone year month = calendarToUTC zone + (CalendarTime (CalendarDay year month 1) midnight) + +findTransition :: UTCTime -> UTCTime -> IO [(UTCTime,Timezone,Timezone)] +findTransition a b = do + za <- getTimezone a + zb <- getTimezone b + if za == zb then return [] else do + let c = addUTCTime ((diffUTCTime b a) / 2) a + if a == c then return [(b,za,zb)] else do + tp <- findTransition a c + tq <- findTransition c b + return (tp ++ tq) + +showZoneTime :: Timezone -> UTCTime -> String +showZoneTime zone time = (show (utcToCalendar zone time)) ++ " " ++ (show zone) + +showTransition :: (UTCTime,Timezone,Timezone) -> String +showTransition (time,zone1,zone2) = (showZoneTime zone1 time) ++ " => " ++ (showZoneTime zone2 time) + +main :: IO () +main = do + now <- getCurrentTime + zone <- getTimezone now + let year = cdYear (ctDay (utcToCalendar zone now)) + putStrLn ("DST adjustments for " ++ show year ++ ":") + let t0 = monthBeginning zone year 1 + let t1 = monthBeginning zone year 4 + let t2 = monthBeginning zone year 7 + let t3 = monthBeginning zone year 10 + let t4 = monthBeginning zone (year + 1) 1 + tr1 <- findTransition t0 t1 + tr2 <- findTransition t1 t2 + tr3 <- findTransition t2 t3 + tr4 <- findTransition t3 t4 + mapM_ (putStrLn . showTransition) (tr1 ++ tr2 ++ tr3 ++ tr4) From git at git.haskell.org Mon Feb 20 21:07:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:07:43 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: generalise calendar type, split Calendar module (78c7468) Message-ID: <20170220210743.6A4C63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/78c7468a65657014621c6a1e8b2e0d38750c62db >--------------------------------------------------------------- commit 78c7468a65657014621c6a1e8b2e0d38750c62db Author: Ashley Yakeley Date: Thu Apr 28 23:15:53 2005 -0700 generalise calendar type, split Calendar module darcs-hash:20050429061553-ac6dd-1248b0405e1e0913b6bbf3c9abafeca5ef95f31d >--------------------------------------------------------------- 78c7468a65657014621c6a1e8b2e0d38750c62db CurrentTime.hs | 4 +- Makefile | 33 +++++- ShowDST.hs | 4 +- System/Time/Calendar.hs | 222 ++------------------------------------ System/Time/Calendar/Calendar.hs | 64 +++++++++++ System/Time/Calendar/Gregorian.hs | 61 +++++++++++ System/Time/Calendar/Private.hs | 17 +++ System/Time/Calendar/TimeOfDay.hs | 69 ++++++++++++ System/Time/Calendar/Timezone.hs | 54 ++++++++++ TestTime.hs | 22 ++-- TimeLib.cabal | 3 +- 11 files changed, 320 insertions(+), 233 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 78c7468a65657014621c6a1e8b2e0d38750c62db From git at git.haskell.org Mon Feb 20 21:07:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:07:45 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: first attempt at formatting (with failing test) (2678bff) Message-ID: <20170220210745.73AB93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/2678bff94d02f6b646ce73392af6ce59d2af8aa6 >--------------------------------------------------------------- commit 2678bff94d02f6b646ce73392af6ce59d2af8aa6 Author: Ashley Yakeley Date: Sun May 1 01:35:54 2005 -0700 first attempt at formatting (with failing test) darcs-hash:20050501083554-ac6dd-bd83ee2a88e471f1e5e1a828d6de6bd9e5447b7b >--------------------------------------------------------------- 2678bff94d02f6b646ce73392af6ce59d2af8aa6 Makefile | 40 ++++++++++++++++---------- System/Time/Calendar.hs | 2 ++ System/Time/Calendar/Calendar.hs | 17 ++++++++--- System/Time/Calendar/Format.hs | 21 ++++++++++++++ System/Time/Calendar/Gregorian.hs | 50 ++++++++++++++++++++++++++++++--- System/Time/Calendar/Private.hs | 13 +++++++++ System/Time/Calendar/TimeOfDay.hs | 21 ++++++++++---- System/Time/Calendar/Timezone.hs | 16 +++++++---- System/Time/Clock.hs | 2 +- TestFormat.hs | 59 +++++++++++++++++++++++++++++++++++++++ TestFormatStuff.c | 14 ++++++++++ TestFormatStuff.h | 6 ++++ TestTime.hs | 10 ++----- TimeLib.cabal | 2 +- 14 files changed, 231 insertions(+), 42 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 2678bff94d02f6b646ce73392af6ce59d2af8aa6 From git at git.haskell.org Mon Feb 20 21:07:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:07:47 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: add DST field to Timezone (471f5ea) Message-ID: <20170220210747.7ADF73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/471f5ea9c67160d9740c63e6aab87a9b72c72747 >--------------------------------------------------------------- commit 471f5ea9c67160d9740c63e6aab87a9b72c72747 Author: Ashley Yakeley Date: Sun May 1 02:05:11 2005 -0700 add DST field to Timezone darcs-hash:20050501090511-ac6dd-7dfe69ea72cee8b3fe4bd070dd0a1065fdd30280 >--------------------------------------------------------------- 471f5ea9c67160d9740c63e6aab87a9b72c72747 System/Time/Calendar/TimeOfDay.hs | 4 ++-- System/Time/Calendar/Timezone.hs | 24 ++++++++++++++---------- TestFormat.hs | 6 +++--- timestuff.c | 5 ++++- timestuff.h | 2 +- 5 files changed, 24 insertions(+), 17 deletions(-) diff --git a/System/Time/Calendar/TimeOfDay.hs b/System/Time/Calendar/TimeOfDay.hs index d71c334..17cdc93 100644 --- a/System/Time/Calendar/TimeOfDay.hs +++ b/System/Time/Calendar/TimeOfDay.hs @@ -46,12 +46,12 @@ instance FormatTime TimeOfDay where -- | convert a ToD in UTC to a ToD in some timezone, together with a day adjustment utcToLocalTimeOfDay :: Timezone -> TimeOfDay -> (Integer,TimeOfDay) utcToLocalTimeOfDay zone (TimeOfDay h m s) = (fromIntegral (div h' 24),TimeOfDay (mod h' 24) (mod m' 60) s) where - m' = m + timezoneToMinutes zone + m' = m + timezoneMinutes zone h' = h + (div m' 60) -- | convert a ToD in some timezone to a ToD in UTC, together with a day adjustment localToUTCTimeOfDay :: Timezone -> TimeOfDay -> (Integer,TimeOfDay) -localToUTCTimeOfDay zone = utcToLocalTimeOfDay (minutesToTimezone (negate (timezoneToMinutes zone))) +localToUTCTimeOfDay zone = utcToLocalTimeOfDay (minutesToTimezone (negate (timezoneMinutes zone))) posixDay :: DiffTime posixDay = fromInteger 86400 diff --git a/System/Time/Calendar/Timezone.hs b/System/Time/Calendar/Timezone.hs index acfcad0..87defcd 100644 --- a/System/Time/Calendar/Timezone.hs +++ b/System/Time/Calendar/Timezone.hs @@ -3,7 +3,7 @@ module System.Time.Calendar.Timezone ( -- time zones - Timezone,timezoneToMinutes,minutesToTimezone,hoursToTimezone,utc, + Timezone(..),minutesToTimezone,hoursToTimezone,utc, -- getting the locale time zone getTimezone,getCurrentTimezone @@ -17,12 +17,13 @@ import Foreign import Foreign.C -- | count of minutes -newtype Timezone = MkTimezone { - timezoneToMinutes :: Int +data Timezone = MkTimezone { + timezoneDST :: Bool, + timezoneMinutes :: Int } deriving (Eq,Ord) minutesToTimezone :: Int -> Timezone -minutesToTimezone = MkTimezone +minutesToTimezone = MkTimezone False hoursToTimezone :: Int -> Timezone hoursToTimezone i = minutesToTimezone (60 * i) @@ -31,8 +32,8 @@ showT :: Int -> String showT t = (show2 (div t 60)) ++ (show2 (mod t 60)) instance Show Timezone where - show (MkTimezone t) | t < 0 = '-':(showT (negate t)) - show (MkTimezone t) = '+':(showT t) + show (MkTimezone _ t) | t < 0 = '-':(showT (negate t)) + show (MkTimezone _ t) = '+':(showT t) instance FormatTime Timezone where formatCharacter _ 'z' zone = Just (show zone) @@ -42,18 +43,21 @@ instance FormatTime Timezone where utc :: Timezone utc = minutesToTimezone 0 -foreign import ccall unsafe "timestuff.h get_current_timezone_seconds" get_current_timezone_seconds :: CTime -> IO CLong +foreign import ccall unsafe "timestuff.h get_current_timezone_seconds" get_current_timezone_seconds :: CTime -> Ptr CInt -> IO CLong posixToCTime :: POSIXTime -> CTime posixToCTime = fromInteger . floor -- | Get the local time-zone for a given time (varying as per summertime adjustments) getTimezone :: UTCTime -> IO Timezone -getTimezone time = do - secs <- get_current_timezone_seconds (posixToCTime (utcTimeToPOSIXSeconds time)) +getTimezone time = with 0 (\pdst -> do + secs <- get_current_timezone_seconds (posixToCTime (utcTimeToPOSIXSeconds time)) pdst case secs of 0x80000000 -> fail "localtime_r failed" - _ -> return (minutesToTimezone (div (fromIntegral secs) 60)) + _ -> do + dst <- peek pdst + return (MkTimezone (dst == 1) (div (fromIntegral secs) 60)) + ) -- | Get the current time-zone getCurrentTimezone :: IO Timezone diff --git a/TestFormat.hs b/TestFormat.hs index 6675884..4d7f800 100644 --- a/TestFormat.hs +++ b/TestFormat.hs @@ -26,11 +26,11 @@ withBuffer n f = withArray (replicate n 0) (\buffer -> do unixFormatTime :: String -> Timezone -> UTCTime -> IO String unixFormatTime fmt zone time = withCString fmt (\pfmt -> - withBuffer 100 (\buffer -> format_time buffer 100 pfmt 0 (fromIntegral (timezoneToMinutes zone * 60)) (fromInteger (truncate (utcTimeToPOSIXSeconds time)))) + withBuffer 100 (\buffer -> format_time buffer 100 pfmt (if timezoneDST zone then 1 else 0) (fromIntegral (timezoneMinutes zone * 60)) (fromInteger (truncate (utcTimeToPOSIXSeconds time)))) ) locale :: TimeLocale -locale = defaultTimeLocale +locale = defaultTimeLocale {dateTimeFmt = "%a %b %e %H:%M:%S %Y"} zones :: [Timezone] zones = [utc,hoursToTimezone (- 7)] @@ -46,7 +46,7 @@ times = [baseTime1,addUTCTime posixDay baseTime1,addUTCTime (2 * posixDay) baseT -- as found in http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html chars :: [Char] -chars = "aAbBcCdDehHIjmMnprRStTuUVwWxXyYZ%" +chars = "aAbBcCdDehHIjmMnprRStTuUVwWxXyYzZ%" main :: IO () main = mapM_ (\char -> let fmt = '%':char:[] in mapM_ (\time -> mapM_ (\zone -> let diff --git a/timestuff.c b/timestuff.c index 92d9fbe..6968a9d 100644 --- a/timestuff.c +++ b/timestuff.c @@ -1,10 +1,13 @@ #include "timestuff.h" -long int get_current_timezone_seconds (time_t t) +long int get_current_timezone_seconds (time_t t,int* dst) { struct tm tmd; struct tm* ptm = localtime_r(&t,&tmd); if (ptm) + { + *dst = ptm -> tm_isdst; return ptm -> tm_gmtoff; + } else return 0x80000000; } diff --git a/timestuff.h b/timestuff.h index 534ee67..6eaf614 100644 --- a/timestuff.h +++ b/timestuff.h @@ -1,3 +1,3 @@ #include -long int get_current_timezone_seconds (time_t); +long int get_current_timezone_seconds (time_t,int* dst); From git at git.haskell.org Mon Feb 20 21:07:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:07:49 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: add GNU and other extensions to formatting (ce92c0a) Message-ID: <20170220210749.81A663A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/ce92c0a6f8d88ab2f1aa6de6dce271b1d790ce1b >--------------------------------------------------------------- commit ce92c0a6f8d88ab2f1aa6de6dce271b1d790ce1b Author: Ashley Yakeley Date: Sun May 1 05:08:16 2005 -0700 add GNU and other extensions to formatting darcs-hash:20050501120816-ac6dd-b30e46bc30c5fae816095c2f154ea9cb5ee3c3f8 >--------------------------------------------------------------- ce92c0a6f8d88ab2f1aa6de6dce271b1d790ce1b System/Time/Calendar/Gregorian.hs | 12 +++++++++--- System/Time/Calendar/TimeOfDay.hs | 7 ++++++- TestFormat.hs | 3 ++- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/System/Time/Calendar/Gregorian.hs b/System/Time/Calendar/Gregorian.hs index 3d0dcce..b10c509 100644 --- a/System/Time/Calendar/Gregorian.hs +++ b/System/Time/Calendar/Gregorian.hs @@ -39,8 +39,11 @@ weekNumber day = (div (dayOfYear day) 7) + 1 weekNumber' :: ModJulianDay -> Int weekNumber' day = (div (dayOfYear day) 7) + 1 -weekNumber'' :: ModJulianDay -> Int -weekNumber'' day = (div (dayOfYear day) 7) + 1 +isoWeekFormat :: ModJulianDay -> (Integer,Int,Int) +isoWeekFormat day = (y,div k 7,fromInteger (mod day 7) + 1) where + (year,yd,_) = dayToYearDay day + k = yd -- WRONG + y = year -- WRONG instance FormatTime GregorianDay where formatCharacter locale 'a' day = Just (snd ((wDays locale) !! (weekDay (calendarToDay day)))) @@ -51,12 +54,15 @@ instance FormatTime GregorianDay where formatCharacter _ 'd' (GregorianDay _ _ d) = Just (show2 d) formatCharacter locale 'D' day = Just (formatTime locale "%m/%d/%y" day) formatCharacter _ 'e' (GregorianDay _ _ d) = Just (show2Space d) + formatCharacter locale 'F' day = Just (formatTime locale "%Y-%m-%d" day) + formatCharacter _ 'g' day = let (y,_,_) = isoWeekFormat (calendarToDay day) in Just (show2 (fromInteger (mod y 100))) + formatCharacter _ 'G' day = let (y,_,_) = isoWeekFormat (calendarToDay day) in Just (show y) formatCharacter locale 'h' (GregorianDay _ m _) = Just (snd ((months locale) !! (m - 1))) formatCharacter _ 'j' day = Just (show3 (dayOfYear (calendarToDay day))) formatCharacter _ 'm' (GregorianDay _ m _) = Just (show2 m) formatCharacter _ 'u' day = Just (show (weekDay' (calendarToDay day))) formatCharacter _ 'U' day = Just (show2 (weekNumber (calendarToDay day))) - formatCharacter _ 'V' day = Just (show2 (weekNumber'' (calendarToDay day))) + formatCharacter _ 'V' day = let (_,n,_) = isoWeekFormat (calendarToDay day) in Just (show2 n) formatCharacter _ 'w' day = Just (show (weekDay (calendarToDay day))) formatCharacter _ 'W' day = Just (show2 (weekNumber' (calendarToDay day))) formatCharacter locale 'x' day = Just (formatTime locale (dateFmt locale) day) diff --git a/System/Time/Calendar/TimeOfDay.hs b/System/Time/Calendar/TimeOfDay.hs index 17cdc93..ba1c891 100644 --- a/System/Time/Calendar/TimeOfDay.hs +++ b/System/Time/Calendar/TimeOfDay.hs @@ -12,9 +12,11 @@ import System.Time.Calendar.Timezone import System.Time.Calendar.Format import System.Time.Calendar.Private import System.Time.Clock -import System.Locale import Data.Fixed +import System.Locale +import Data.Char + -- | time of day as represented in hour, minute and second (with picoseconds), typically used to express local time of day data TimeOfDay = TimeOfDay { todHour :: Int, @@ -34,8 +36,11 @@ instance Show TimeOfDay where instance FormatTime TimeOfDay where formatCharacter _ 'H' (TimeOfDay h _ _) = Just (show2 h) formatCharacter _ 'I' (TimeOfDay h _ _) = Just (show2 ((mod (h - 1) 12) + 1)) + formatCharacter _ 'k' (TimeOfDay h _ _) = Just (show2Space h) + formatCharacter _ 'l' (TimeOfDay h _ _) = Just (show2Space ((mod (h - 1) 12) + 1)) formatCharacter _ 'M' (TimeOfDay _ m _) = Just (show2 m) formatCharacter locale 'p' (TimeOfDay h _ _) = Just ((if h < 12 then fst else snd) (amPm locale)) + formatCharacter locale 'P' (TimeOfDay h _ _) = Just (map toLower ((if h < 12 then fst else snd) (amPm locale))) formatCharacter locale 'r' time = Just (formatTime locale (time12Fmt locale) time) formatCharacter locale 'R' time = Just (formatTime locale "%H:%M" time) formatCharacter _ 'S' (TimeOfDay _ _ s) = Just (show2Fixed s) diff --git a/TestFormat.hs b/TestFormat.hs index 4d7f800..8534c77 100644 --- a/TestFormat.hs +++ b/TestFormat.hs @@ -45,8 +45,9 @@ times :: [UTCTime] times = [baseTime1,addUTCTime posixDay baseTime1,addUTCTime (2 * posixDay) baseTime1] -- as found in http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html +-- plus FgGklPsz chars :: [Char] -chars = "aAbBcCdDehHIjmMnprRStTuUVwWxXyYzZ%" +chars = "aAbBcCdDeFgGhHIjklmMnpPrRsStTuUVwWxXyYzZ%" main :: IO () main = mapM_ (\char -> let fmt = '%':char:[] in mapM_ (\time -> mapM_ (\zone -> let From git at git.haskell.org Mon Feb 20 21:07:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:07:51 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: generalise types with classes, introduce zoned time (1c076bc) Message-ID: <20170220210751.896903A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/1c076bc2e6ad37b2ae5b282aed23327079c38515 >--------------------------------------------------------------- commit 1c076bc2e6ad37b2ae5b282aed23327079c38515 Author: Ashley Yakeley Date: Mon May 2 04:09:40 2005 -0700 generalise types with classes, introduce zoned time darcs-hash:20050502110940-ac6dd-e290f92541cf1b0119110b49889535312f931af7 >--------------------------------------------------------------- 1c076bc2e6ad37b2ae5b282aed23327079c38515 CurrentTime.hs | 4 +- ShowDST.hs | 6 +-- System/Time/Calendar/Calendar.hs | 95 +++++++++++++++++++++++---------------- System/Time/Calendar/Gregorian.hs | 35 ++++++++------- TestFormat.hs | 4 +- TestTime.hs | 24 +++++----- 6 files changed, 95 insertions(+), 73 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 1c076bc2e6ad37b2ae5b282aed23327079c38515 From git at git.haskell.org Mon Feb 20 21:07:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:07:53 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: fix for Makefile (86fca98) Message-ID: <20170220210753.8FA733A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/86fca98754ee7a052b61dafbcac863b0abf4eac0 >--------------------------------------------------------------- commit 86fca98754ee7a052b61dafbcac863b0abf4eac0 Author: ashley Date: Mon May 2 15:33:00 2005 -0700 fix for Makefile darcs-hash:20050502223300-ca2d0-85d0e358de00b9468f419c2a43a87f1ad8498d5c >--------------------------------------------------------------- 86fca98754ee7a052b61dafbcac863b0abf4eac0 Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index b269e58..878f7e4 100644 --- a/Makefile +++ b/Makefile @@ -81,6 +81,8 @@ depend: $(SRCS) TestTime.o TestFormat.o CurrentTime.o ShowDST.o TimeZone.o: $(patsubst %.hs,%.hi,$(SRCS)) +TestFixed.o: Data/Fixed.hi + # DO NOT DELETE: Beginning of Haskell dependencies System/Time/Calendar/Format.o : System/Time/Calendar/Format.hs Data/Fixed.o : Data/Fixed.hs From git at git.haskell.org Mon Feb 20 21:07:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:07:55 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: add %s format option to ZonedTime (18b9d5a) Message-ID: <20170220210755.963693A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/18b9d5aea26a1701d120f0003fbae80b3739a577 >--------------------------------------------------------------- commit 18b9d5aea26a1701d120f0003fbae80b3739a577 Author: ashley Date: Wed May 4 01:15:17 2005 -0700 add %s format option to ZonedTime darcs-hash:20050504081517-ca2d0-1e7afb6180a65e6451b094468b1ae503acc8469b >--------------------------------------------------------------- 18b9d5aea26a1701d120f0003fbae80b3739a577 System/Time/Calendar/Calendar.hs | 3 ++- TestFormat.hs | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/System/Time/Calendar/Calendar.hs b/System/Time/Calendar/Calendar.hs index c0bc502..9283094 100644 --- a/System/Time/Calendar/Calendar.hs +++ b/System/Time/Calendar/Calendar.hs @@ -85,6 +85,7 @@ decodeUTC (ZonedTime t zone) = decodeLocalUTC zone t instance (Show t) => Show (ZonedTime t) where show (ZonedTime t zone) = show t ++ " " ++ show zone -instance (FormatTime t) => FormatTime (ZonedTime t) where +instance (FormatTime t,LocalTimeEncoding t) => FormatTime (ZonedTime t) where + formatCharacter _ 's' zt = Just (show (truncate (utcTimeToPOSIXSeconds (decodeUTC zt)) :: Integer)) formatCharacter locale c (ZonedTime t zone) = melse (formatCharacter locale c t) (formatCharacter locale c zone) diff --git a/TestFormat.hs b/TestFormat.hs index 34c9892..e3f2728 100644 --- a/TestFormat.hs +++ b/TestFormat.hs @@ -38,11 +38,14 @@ zones = [utc,hoursToTimezone (- 7)] posixDay :: UTCDiffTime posixDay = 86400 +baseTime0 :: UTCTime +baseTime0 = decodeLocalUTC utc (CalendarTime (GregorianDay 1970 01 01) midnight) + baseTime1 :: UTCTime baseTime1 = decodeLocalUTC utc (CalendarTime (GregorianDay 2005 05 01) midnight) times :: [UTCTime] -times = [baseTime1,addUTCTime posixDay baseTime1,addUTCTime (2 * posixDay) baseTime1] +times = [baseTime0,baseTime1,addUTCTime posixDay baseTime1,addUTCTime (2 * posixDay) baseTime1] -- as found in http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html -- plus FgGklPsz @@ -56,5 +59,5 @@ main = mapM_ (\char -> let fmt = '%':char:[] in mapM_ (\time -> mapM_ (\zone -> in do unixText <- unixFormatTime fmt zone time if haskellText == unixText then return () else - putStrLn ("Mismatch with " ++ fmt ++ " for " ++ (show ctime) ++ " " ++ (show zone) ++ ": UNIX says \"" ++ unixText ++ "\", TimeLib says \"" ++ haskellText ++ "\".") + putStrLn ("Mismatch with " ++ fmt ++ " for " ++ (show ctime) ++ ": UNIX says \"" ++ unixText ++ "\", TimeLib says \"" ++ haskellText ++ "\".") ) zones) times) chars From git at git.haskell.org Mon Feb 20 21:07:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:07:57 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: add name to Timezone (d028ced) Message-ID: <20170220210757.9D6BD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/d028cedc35e60de0e111a5c4318f0c41c46db52e >--------------------------------------------------------------- commit d028cedc35e60de0e111a5c4318f0c41c46db52e Author: Ashley Yakeley Date: Wed May 4 04:16:42 2005 -0700 add name to Timezone darcs-hash:20050504111642-ac6dd-aeb9239e546e584e7f6d027e7b3a70b87ea793f8 >--------------------------------------------------------------- d028cedc35e60de0e111a5c4318f0c41c46db52e System/Time/Calendar/Timezone.hs | 24 ++++++++++++++---------- TestFormat.hs | 13 +++++++++---- TestFormatStuff.c | 3 ++- TestFormatStuff.h | 2 +- timestuff.c | 3 ++- timestuff.h | 2 +- 6 files changed, 29 insertions(+), 18 deletions(-) diff --git a/System/Time/Calendar/Timezone.hs b/System/Time/Calendar/Timezone.hs index 87defcd..ec003dc 100644 --- a/System/Time/Calendar/Timezone.hs +++ b/System/Time/Calendar/Timezone.hs @@ -18,12 +18,13 @@ import Foreign.C -- | count of minutes data Timezone = MkTimezone { + timezoneMinutes :: Int, timezoneDST :: Bool, - timezoneMinutes :: Int + timezoneName :: String } deriving (Eq,Ord) minutesToTimezone :: Int -> Timezone -minutesToTimezone = MkTimezone False +minutesToTimezone m = MkTimezone m False "" hoursToTimezone :: Int -> Timezone hoursToTimezone i = minutesToTimezone (60 * i) @@ -32,32 +33,35 @@ showT :: Int -> String showT t = (show2 (div t 60)) ++ (show2 (mod t 60)) instance Show Timezone where - show (MkTimezone _ t) | t < 0 = '-':(showT (negate t)) - show (MkTimezone _ t) = '+':(showT t) + show (MkTimezone t _ _) | t < 0 = '-':(showT (negate t)) + show (MkTimezone t _ _) = '+':(showT t) instance FormatTime Timezone where formatCharacter _ 'z' zone = Just (show zone) + formatCharacter _ 'Z' (MkTimezone _ _ name) = Just name formatCharacter _ _ _ = Nothing -- | The UTC time zone utc :: Timezone -utc = minutesToTimezone 0 +utc = MkTimezone 0 False "UTC" -foreign import ccall unsafe "timestuff.h get_current_timezone_seconds" get_current_timezone_seconds :: CTime -> Ptr CInt -> IO CLong +foreign import ccall unsafe "timestuff.h get_current_timezone_seconds" get_current_timezone_seconds :: CTime -> Ptr CInt -> Ptr CString -> IO CLong posixToCTime :: POSIXTime -> CTime posixToCTime = fromInteger . floor -- | Get the local time-zone for a given time (varying as per summertime adjustments) getTimezone :: UTCTime -> IO Timezone -getTimezone time = with 0 (\pdst -> do - secs <- get_current_timezone_seconds (posixToCTime (utcTimeToPOSIXSeconds time)) pdst +getTimezone time = with 0 (\pdst -> with nullPtr (\pcname -> do + secs <- get_current_timezone_seconds (posixToCTime (utcTimeToPOSIXSeconds time)) pdst pcname case secs of 0x80000000 -> fail "localtime_r failed" _ -> do dst <- peek pdst - return (MkTimezone (dst == 1) (div (fromIntegral secs) 60)) - ) + cname <- peek pcname + name <- peekCString cname + return (MkTimezone (div (fromIntegral secs) 60) (dst == 1) name) + )) -- | Get the current time-zone getCurrentTimezone :: IO Timezone diff --git a/TestFormat.hs b/TestFormat.hs index e3f2728..21a84f7 100644 --- a/TestFormat.hs +++ b/TestFormat.hs @@ -16,7 +16,7 @@ import Foreign.C int isdst,int gmtoff,time_t t); -} -foreign import ccall unsafe "TestFormatStuff.h format_time" format_time :: CString -> CSize -> CString -> CInt -> CInt -> CTime -> IO CSize +foreign import ccall unsafe "TestFormatStuff.h format_time" format_time :: CString -> CSize -> CString -> CInt -> CInt -> CString -> CTime -> IO CSize withBuffer :: Int -> (CString -> IO CSize) -> IO String withBuffer n f = withArray (replicate n 0) (\buffer -> do @@ -25,9 +25,14 @@ withBuffer n f = withArray (replicate n 0) (\buffer -> do ) unixFormatTime :: String -> Timezone -> UTCTime -> IO String -unixFormatTime fmt zone time = withCString fmt (\pfmt -> - withBuffer 100 (\buffer -> format_time buffer 100 pfmt (if timezoneDST zone then 1 else 0) (fromIntegral (timezoneMinutes zone * 60)) (fromInteger (truncate (utcTimeToPOSIXSeconds time)))) - ) +unixFormatTime fmt zone time = withCString fmt (\pfmt -> withCString (timezoneName zone) (\pzonename -> + withBuffer 100 (\buffer -> format_time buffer 100 pfmt + (if timezoneDST zone then 1 else 0) + (fromIntegral (timezoneMinutes zone * 60)) + pzonename + (fromInteger (truncate (utcTimeToPOSIXSeconds time))) + ) + )) locale :: TimeLocale locale = defaultTimeLocale {dateTimeFmt = "%a %b %e %H:%M:%S %Y"} diff --git a/TestFormatStuff.c b/TestFormatStuff.c index 8450fb5..8d314ba 100644 --- a/TestFormatStuff.c +++ b/TestFormatStuff.c @@ -3,12 +3,13 @@ size_t format_time ( char* buffer, size_t maxsize, const char* format, - int isdst,int gmtoff,time_t t) + int isdst,int gmtoff,char* zonename,time_t t) { t += gmtoff; struct tm tmd; gmtime_r(&t,&tmd); tmd.tm_isdst = isdst; tmd.tm_gmtoff = gmtoff; + tmd.tm_zone = zonename; return strftime(buffer,maxsize,format,&tmd); } diff --git a/TestFormatStuff.h b/TestFormatStuff.h index 5f9e853..f2f7175 100644 --- a/TestFormatStuff.h +++ b/TestFormatStuff.h @@ -3,4 +3,4 @@ size_t format_time ( char *s, size_t maxsize, const char *format, - int isdst,int gmtoff,time_t t); + int isdst,int gmtoff,char* zonename,time_t t); diff --git a/timestuff.c b/timestuff.c index 6968a9d..386616e 100644 --- a/timestuff.c +++ b/timestuff.c @@ -1,12 +1,13 @@ #include "timestuff.h" -long int get_current_timezone_seconds (time_t t,int* dst) +long int get_current_timezone_seconds (time_t t,int* dst,char** name) { struct tm tmd; struct tm* ptm = localtime_r(&t,&tmd); if (ptm) { *dst = ptm -> tm_isdst; + *name = ptm -> tm_zone; return ptm -> tm_gmtoff; } else return 0x80000000; diff --git a/timestuff.h b/timestuff.h index 6eaf614..936cd84 100644 --- a/timestuff.h +++ b/timestuff.h @@ -1,3 +1,3 @@ #include -long int get_current_timezone_seconds (time_t,int* dst); +long int get_current_timezone_seconds (time_t,int* dst,char** name); From git at git.haskell.org Mon Feb 20 21:07:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:07:59 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: build/test target fiddling in Makefile (1c01493) Message-ID: <20170220210759.A4CBE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/1c01493fa23ff52673863e7cc4f42f01f2859c73 >--------------------------------------------------------------- commit 1c01493fa23ff52673863e7cc4f42f01f2859c73 Author: Ashley Yakeley Date: Thu May 5 00:17:36 2005 -0700 build/test target fiddling in Makefile darcs-hash:20050505071736-ac6dd-71984598fc9b9282614217eaf645e2e81fcc2a9c >--------------------------------------------------------------- 1c01493fa23ff52673863e7cc4f42f01f2859c73 Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 878f7e4..14c6e54 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,6 @@ -default: test doc CurrentTime.run ShowDST.run +default: build doc CurrentTime.run ShowDST.run test + +build: $(patsubst %.hs,%.hi,$(SRCS)) libTimeLib.a SRCS = Data/Fixed.hs \ System/Time/Clock.hs \ From git at git.haskell.org Mon Feb 20 21:08:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:08:01 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: better type for formatCharacter (a55e303) Message-ID: <20170220210801.ACA513A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/a55e3039dfa75c7d6dc7e079b869b5eeaf345ba2 >--------------------------------------------------------------- commit a55e3039dfa75c7d6dc7e079b869b5eeaf345ba2 Author: Ashley Yakeley Date: Thu May 5 00:18:49 2005 -0700 better type for formatCharacter darcs-hash:20050505071849-ac6dd-6a0365ab76ba8bb976eb8ea8537416db492a3230 >--------------------------------------------------------------- a55e3039dfa75c7d6dc7e079b869b5eeaf345ba2 System/Time/Calendar/Calendar.hs | 22 ++++++++++--------- System/Time/Calendar/Format.hs | 6 ++--- System/Time/Calendar/Gregorian.hs | 46 +++++++++++++++++++-------------------- System/Time/Calendar/TimeOfDay.hs | 26 +++++++++++----------- System/Time/Calendar/Timezone.hs | 16 +++++++++----- TimeZone.hs | 2 +- 6 files changed, 62 insertions(+), 56 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 a55e3039dfa75c7d6dc7e079b869b5eeaf345ba2 From git at git.haskell.org Mon Feb 20 21:08:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:08:03 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: separate tests into dir, new ISOWeek and YearDay modules, pull Format code into module, new ConvertBack test (ffc5046) Message-ID: <20170220210803.B6D273A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/ffc504663a608ba94a8242b505f39a9ba7e2eff5 >--------------------------------------------------------------- commit ffc504663a608ba94a8242b505f39a9ba7e2eff5 Author: Ashley Yakeley Date: Sat May 7 18:39:22 2005 -0700 separate tests into dir, new ISOWeek and YearDay modules, pull Format code into module, new ConvertBack test darcs-hash:20050508013922-ac6dd-3a0e7a0e7248b710906427343fe829c0085ca815 >--------------------------------------------------------------- ffc504663a608ba94a8242b505f39a9ba7e2eff5 Makefile | 66 ++++++--------- System/Time/Calendar.hs | 10 ++- System/Time/Calendar/Calendar.hs | 22 +---- System/Time/Calendar/Format.hs | 119 ++++++++++++++++++++++++++++ System/Time/Calendar/Gregorian.hs | 70 +--------------- System/Time/Calendar/ISOWeek.hs | 36 +++++++++ System/Time/Calendar/Private.hs | 6 ++ System/Time/Calendar/TimeOfDay.hs | 19 ----- System/Time/Calendar/Timezone.hs | 7 +- System/Time/Calendar/YearDay.hs | 36 +++++++++ TimeLib.cabal | 2 +- test/ConvertBack.hs | 20 +++++ CurrentTime.hs => test/CurrentTime.hs | 0 test/Makefile | 59 ++++++++++++++ ShowDST.hs => test/ShowDST.hs | 0 TestFixed.hs => test/TestFixed.hs | 0 TestFixed.ref => test/TestFixed.ref | 0 TestFormat.hs => test/TestFormat.hs | 47 ++++++++--- TestFormatStuff.c => test/TestFormatStuff.c | 0 TestFormatStuff.h => test/TestFormatStuff.h | 0 TestTime.hs => test/TestTime.hs | 0 TestTime.ref => test/TestTime.ref | 0 TimeZone.hs => test/TimeZone.hs | 0 23 files changed, 352 insertions(+), 167 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 ffc504663a608ba94a8242b505f39a9ba7e2eff5 From git at git.haskell.org Mon Feb 20 21:08:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:08:05 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Clock documentation (622d6b5) Message-ID: <20170220210805.BD9043A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/622d6b52d402996282c403d7497215f42b117d13 >--------------------------------------------------------------- commit 622d6b52d402996282c403d7497215f42b117d13 Author: Ashley Yakeley Date: Sun May 8 05:10:59 2005 -0700 Clock documentation darcs-hash:20050508121059-ac6dd-912229bbc27e18aea3168073d4976f46e7b97aa3 >--------------------------------------------------------------- 622d6b52d402996282c403d7497215f42b117d13 System/Time/Clock.hs | 41 ++++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/System/Time/Clock.hs b/System/Time/Clock.hs index ae29dd1..5f809f1 100644 --- a/System/Time/Clock.hs +++ b/System/Time/Clock.hs @@ -1,21 +1,29 @@ {-# OPTIONS -ffi -Wall -Werror #-} +-- | Types and functions for UTC and UT1 module System.Time.Clock ( - -- Modified Julian days and dates (for UT1) + -- * Universal Time + -- | Time as measured by the earth. ModJulianDay,ModJulianDate, - -- absolute time intervals + -- * Absolute intervals DiffTime, - -- UTC arithmetic + -- * UTC + -- | UTC is time as measured by a clock, corrected to keep pace with the earth by adding or removing + -- occasional seconds, known as \"leap seconds\". + -- These corrections are not predictable and are announced with six month's notice. + -- No table of these corrections is provided, as any program compiled with it would become + -- out of date in six months. UTCTime(..),UTCDiffTime, addUTCTime,diffUTCTime, - -- getting the current UTC time + -- * Current time getCurrentTime, - -- needed by System.Time.Calendar to talk to the Unix API + -- * POSIX time + -- | This is needed by System.Time.Calendar to talk to the Unix API. POSIXTime,posixSecondsToUTCTime,utcTimeToPOSIXSeconds ) where @@ -24,13 +32,14 @@ import Data.Fixed import Foreign import Foreign.C --- | standard Modified Julian Day, a count of Earth days +-- | The Modified Julian Day is a standard count of days, with zero being the day 1858-11-17. type ModJulianDay = Integer --- | standard Modified Julian Date to represent UT1, 1 = 1 day +-- | The Modified Julian Date is the day with the fraction of the day, measured from UT midnight. +-- It's used to represent UT1, which is time as measured by the earth's rotation, adjusted for various wobbles. type ModJulianDate = Rational --- | a length of time +-- | This is a length of time, as measured by a clock. newtype DiffTime = MkDiffTime Pico deriving (Eq,Ord) instance Enum DiffTime where @@ -66,11 +75,13 @@ instance Fractional DiffTime where recip (MkDiffTime a) = MkDiffTime (recip a) fromRational r = MkDiffTime (fromRational r) --- | time in UTC +-- | This is the simplest representation of UTC. +-- It consists of the day number, and a time offset from midnight. +-- Note that if a day has a leap second added to it, it will have 86401 seconds. data UTCTime = UTCTime { -- | the day utctDay :: ModJulianDay, - -- | the time from midnight, 0 <= t < 61s (because of leap-seconds) + -- | the time from midnight, 0 <= t < 86401s (because of leap-seconds) utctDayTime :: DiffTime } @@ -82,7 +93,10 @@ instance Ord UTCTime where EQ -> compare ta tb cmp -> cmp --- | a length of time for UTC, ignoring leap-seconds +-- | This is a length of time, as measured by UTC. +-- It ignores leap-seconds, so it's not necessarily a fixed amount of clock time. +-- For instance, 23:00 UTC + 2 hours of UTCDiffTime = 01:00 UTC (+ 1 day), +-- regardless of whether a leap-second intervened. newtype UTCDiffTime = MkUTCDiffTime Pico deriving (Eq,Ord) instance Enum UTCDiffTime where @@ -144,10 +158,11 @@ utcTimeToPOSIXSeconds :: UTCTime -> POSIXTime utcTimeToPOSIXSeconds (UTCTime d t) = (fromInteger (d - unixEpochMJD) * posixDay) + min posixDay (realToFrac t) - +-- | addUTCTime a b = a + b addUTCTime :: UTCDiffTime -> UTCTime -> UTCTime addUTCTime x t = posixSecondsToUTCTime (x + (utcTimeToPOSIXSeconds t)) +-- | diffUTCTime a b = a - b diffUTCTime :: UTCTime -> UTCTime -> UTCDiffTime diffUTCTime a b = (utcTimeToPOSIXSeconds a) - (utcTimeToPOSIXSeconds b) @@ -172,7 +187,7 @@ instance Storable CTimeval where foreign import ccall unsafe "time.h gettimeofday" gettimeofday :: Ptr CTimeval -> Ptr () -> IO CInt --- | get the current time +-- | Get the current UTC time from the system clock. getCurrentTime :: IO UTCTime getCurrentTime = with (MkCTimeval 0 0) (\ptval -> do result <- gettimeofday ptval nullPtr From git at git.haskell.org Mon Feb 20 21:08:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:08:07 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: TAI documentation (0782592) Message-ID: <20170220210807.C3F843A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/07825921e2e187d56a1e0838ea35d13d733ffb66 >--------------------------------------------------------------- commit 07825921e2e187d56a1e0838ea35d13d733ffb66 Author: Ashley Yakeley Date: Sun May 8 21:08:36 2005 -0700 TAI documentation darcs-hash:20050509040836-ac6dd-189305d5b41c695936e994099c0f6b0f5f952fbf >--------------------------------------------------------------- 07825921e2e187d56a1e0838ea35d13d733ffb66 System/Time/TAI.hs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/System/Time/TAI.hs b/System/Time/TAI.hs index 8cd7315..f78eab0 100644 --- a/System/Time/TAI.hs +++ b/System/Time/TAI.hs @@ -1,10 +1,10 @@ {-# OPTIONS -Wall -Werror #-} --- | most people won't need this module +-- | TAI and leap-second tables for converting to UTC: most people won't need this module. module System.Time.TAI ( -- TAI arithmetic - AbsoluteTime,addAbsoluteTime,diffAbsoluteTime, + AbsoluteTime,taiEpoch,addAbsoluteTime,diffAbsoluteTime, -- leap-second table type LeapSecondTable, @@ -15,16 +15,24 @@ module System.Time.TAI import System.Time.Clock --- | TAI as DiffTime from epoch +-- | AbsoluteTime is TAI, time as measured by a clock. newtype AbsoluteTime = MkAbsoluteTime DiffTime deriving (Eq,Ord) +-- | The epoch of TAI, which is +taiEpoch :: AbsoluteTime +taiEpoch = MkAbsoluteTime 0 + +-- | addAbsoluteTime a b = a + b addAbsoluteTime :: DiffTime -> AbsoluteTime -> AbsoluteTime addAbsoluteTime t (MkAbsoluteTime a) = MkAbsoluteTime (t + a) +-- | diffAbsoluteTime a b = a - b diffAbsoluteTime :: AbsoluteTime -> AbsoluteTime -> DiffTime diffAbsoluteTime (MkAbsoluteTime a) (MkAbsoluteTime b) = a - b --- | TAI - UTC during this day +-- | TAI - UTC during this day. +-- No table is provided, as any program compiled with it would become +-- out of date in six months. type LeapSecondTable = ModJulianDay -> Integer utcDayLength :: LeapSecondTable -> ModJulianDay -> DiffTime @@ -35,4 +43,4 @@ utcToTAITime table (UTCTime day dtime) = MkAbsoluteTime ((realToFrac (day * 86400 + (table day))) + dtime) taiToUTCTime :: LeapSecondTable -> AbsoluteTime -> UTCTime -taiToUTCTime table (MkAbsoluteTime t) = undefined table t +taiToUTCTime table (MkAbsoluteTime t) = undefined table t -- WRONG From git at git.haskell.org Mon Feb 20 21:08:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:08:09 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: test in Makefile (e12e45e) Message-ID: <20170220210809.CA5083A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/e12e45e5f42c7a8c1ec29576d4d9014edbf5d7cd >--------------------------------------------------------------- commit e12e45e5f42c7a8c1ec29576d4d9014edbf5d7cd Author: Ashley Yakeley Date: Sun May 8 21:12:05 2005 -0700 test in Makefile darcs-hash:20050509041205-ac6dd-5390ff04e98e6c097dedbafd1a1c72833014de83 >--------------------------------------------------------------- e12e45e5f42c7a8c1ec29576d4d9014edbf5d7cd Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index e94c52d..c6c6b0b 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,9 @@ default: build doc build: $(patsubst %.hs,%.hi,$(SRCS)) libTimeLib.a +test: build + cd test && make + SRCS = Data/Fixed.hs \ System/Time/Clock.hs \ System/Time/TAI.hs \ From git at git.haskell.org Mon Feb 20 21:08:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:08:11 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: fix decodeDay in ISOWeek, with improved ConvertBack test (899a104) Message-ID: <20170220210811.D10EC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/899a1047cf6940d1378dcc6efac9b987152ddae9 >--------------------------------------------------------------- commit 899a1047cf6940d1378dcc6efac9b987152ddae9 Author: Ashley Yakeley Date: Sun May 8 21:37:46 2005 -0700 fix decodeDay in ISOWeek, with improved ConvertBack test darcs-hash:20050509043746-ac6dd-de2745bf5dcba79c8a2e1600b9e9d2a4564d9ae7 >--------------------------------------------------------------- 899a1047cf6940d1378dcc6efac9b987152ddae9 System/Time/Calendar/ISOWeek.hs | 5 +++-- test/ConvertBack.hs | 25 ++++++++++++++++++------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/System/Time/Calendar/ISOWeek.hs b/System/Time/Calendar/ISOWeek.hs index 9126ac9..e6412e4 100644 --- a/System/Time/Calendar/ISOWeek.hs +++ b/System/Time/Calendar/ISOWeek.hs @@ -21,7 +21,7 @@ instance DayEncoding ISOWeek where (YearDay y0 yd) = encodeDay mjd d = mjd + 2 foo :: Integer -> Integer - foo y = bar (decodeDay (YearDay y 4) + 2) + foo y = bar (decodeDay (YearDay y 6)) bar k = (div d 7) - (div k 7) w0 = bar (d - (toInteger yd) + 4) (y1,w1) = if w0 == -1 @@ -32,5 +32,6 @@ instance DayEncoding ISOWeek where else (y0,w0) else (y0,w0) - decodeDay (ISOWeek _ _ _) = undefined -- WRONG + decodeDay (ISOWeek y w d) = k - (mod k 7) + (toInteger ((w * 7) + d)) - 10 where + k = decodeDay (YearDay y 6) maybeDecodeDay = Just . decodeDay -- WRONG diff --git a/test/ConvertBack.hs b/test/ConvertBack.hs index da3bf3e..5b4968d 100644 --- a/test/ConvertBack.hs +++ b/test/ConvertBack.hs @@ -5,16 +5,27 @@ module Main where import System.Time.Calendar import System.Time.Clock -checkDay :: ModJulianDay -> IO () -checkDay day = do - let st = encodeDay day :: YearDay +checkDay :: (DayEncoding t,Show t) => t -> ModJulianDay -> IO () +checkDay t day = do + let st = encodeDay' t day let day' = decodeDay st if day /= day' - then putStrLn ((show day) ++ " -> " ++ (show st) ++ " -> " ++ (show day')) + then putStrLn ((show day) ++ " -> " ++ (show st) ++ " -> " ++ (show day') ++ " (diff " ++ (show (day' - day)) ++ ")") else return () + where + encodeDay' :: (DayEncoding t,Show t) => t -> ModJulianDay -> t + encodeDay' _ = encodeDay +checkers :: [ModJulianDay -> IO ()] +checkers = [ + checkDay (undefined :: YearDay), + checkDay (undefined :: ISOWeek), + checkDay (undefined :: GregorianDay) + ] + +days :: [ModJulianDay] +days = [50000..50200] ++ + (fmap (\year -> (decodeDay (GregorianDay year 1 4))) [1980..2000]) main :: IO () -main = do - mapM_ checkDay [50000..50200] - mapM_ (\year -> checkDay (decodeDay (GregorianDay year 1 4))) [1980..2000] +main = mapM_ (\ch -> mapM_ ch days) checkers From git at git.haskell.org Mon Feb 20 21:08:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:08:13 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: remove maybeDecodeDay (7ece834) Message-ID: <20170220210813.D7C2F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/7ece8344e900e08a360e85c610f3160303f47887 >--------------------------------------------------------------- commit 7ece8344e900e08a360e85c610f3160303f47887 Author: Ashley Yakeley Date: Mon May 9 01:24:16 2005 -0700 remove maybeDecodeDay darcs-hash:20050509082416-ac6dd-891eb8f17253072739f7852627b2a9de76a855c0 >--------------------------------------------------------------- 7ece8344e900e08a360e85c610f3160303f47887 System/Time/Calendar/Calendar.hs | 4 ---- System/Time/Calendar/Gregorian.hs | 1 - System/Time/Calendar/ISOWeek.hs | 1 - System/Time/Calendar/YearDay.hs | 2 -- 4 files changed, 8 deletions(-) diff --git a/System/Time/Calendar/Calendar.hs b/System/Time/Calendar/Calendar.hs index 060e43a..77f30d2 100644 --- a/System/Time/Calendar/Calendar.hs +++ b/System/Time/Calendar/Calendar.hs @@ -14,19 +14,15 @@ module System.Time.Calendar.Calendar import System.Time.Calendar.TimeOfDay import System.Time.Calendar.Timezone import System.Time.Clock -import Data.Maybe class (Eq d) => DayEncoding d where -- | name the given day according to the calendar encodeDay :: ModJulianDay -> d -- | find out which day a given calendar day is - maybeDecodeDay :: d -> Maybe ModJulianDay decodeDay :: d -> ModJulianDay - decodeDay day = fromMaybe (error "invalid day") (maybeDecodeDay day) instance DayEncoding ModJulianDay where encodeDay = id - maybeDecodeDay = Just decodeDay = id class (Eq t) => LocalTimeEncoding t where diff --git a/System/Time/Calendar/Gregorian.hs b/System/Time/Calendar/Gregorian.hs index 4422ce1..fa9b89c 100644 --- a/System/Time/Calendar/Gregorian.hs +++ b/System/Time/Calendar/Gregorian.hs @@ -47,4 +47,3 @@ instance DayEncoding GregorianDay where a = div (14 - month') 12 y = year - a m = month' + (12 * a) - 3 - maybeDecodeDay = Just . decodeDay -- WRONG diff --git a/System/Time/Calendar/ISOWeek.hs b/System/Time/Calendar/ISOWeek.hs index e6412e4..2390f01 100644 --- a/System/Time/Calendar/ISOWeek.hs +++ b/System/Time/Calendar/ISOWeek.hs @@ -34,4 +34,3 @@ instance DayEncoding ISOWeek where decodeDay (ISOWeek y w d) = k - (mod k 7) + (toInteger ((w * 7) + d)) - 10 where k = decodeDay (YearDay y 6) - maybeDecodeDay = Just . decodeDay -- WRONG diff --git a/System/Time/Calendar/YearDay.hs b/System/Time/Calendar/YearDay.hs index d9ecf53..556c913 100644 --- a/System/Time/Calendar/YearDay.hs +++ b/System/Time/Calendar/YearDay.hs @@ -29,8 +29,6 @@ instance DayEncoding YearDay where decodeDay (YearDay year day) = (fromIntegral day) + (div (1532) 5) + (365 * y) + (div y 4) - (div y 100) + (div y 400) - 678882 where y = year - 1 - maybeDecodeDay t@(YearDay year day) | (day >= 1) && (day <= if isLeapYear year then 366 else 365) = Just (decodeDay t) - maybeDecodeDay _ = Nothing isLeapYear :: Integer -> Bool isLeapYear year = (mod year 4 == 0) && ((mod year 400 == 0) || not (mod year 100 == 0)) From git at git.haskell.org Mon Feb 20 21:08:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:08:15 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: fix week-based formatting chars, with more testing (f61178d) Message-ID: <20170220210815.DE56A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/f61178de5671ebf0006c0a9500f2b0f0d84da152 >--------------------------------------------------------------- commit f61178de5671ebf0006c0a9500f2b0f0d84da152 Author: Ashley Yakeley Date: Tue May 10 03:33:55 2005 -0700 fix week-based formatting chars, with more testing darcs-hash:20050510103355-ac6dd-319f78ca2b58fb5a381a9882cfa9727f3bfa465d >--------------------------------------------------------------- f61178de5671ebf0006c0a9500f2b0f0d84da152 System/Time/Calendar/Format.hs | 13 ++++++++----- test/TestFormat.hs | 14 ++++++-------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/System/Time/Calendar/Format.hs b/System/Time/Calendar/Format.hs index eba951f..a3f08d3 100644 --- a/System/Time/Calendar/Format.hs +++ b/System/Time/Calendar/Format.hs @@ -79,14 +79,17 @@ weekDay day = fromInteger (mod (day + 3) 7) weekDay' :: ModJulianDay -> Int weekDay' day = weekDay (day - 1) + 1 -dayOfYear :: ModJulianDay -> Int -dayOfYear = ydDay . encodeDay - weekNumber :: ModJulianDay -> Int -weekNumber day = (div (dayOfYear day) 7) + 1 +weekNumber mjd = fromInteger ((div d 7) - (div k 7)) where + yd = ydDay (encodeDay mjd) + d = mjd + 3 + k = d - (toInteger yd) weekNumber' :: ModJulianDay -> Int -weekNumber' day = (div (dayOfYear day) 7) + 1 +weekNumber' mjd = fromInteger ((div d 7) - (div k 7)) where + yd = ydDay (encodeDay mjd) + d = mjd + 2 + k = d - (toInteger yd) instance FormatTime ModJulianDay where -- Aggregate diff --git a/test/TestFormat.hs b/test/TestFormat.hs index 651df97..89ed600 100644 --- a/test/TestFormat.hs +++ b/test/TestFormat.hs @@ -65,7 +65,8 @@ getYearP4 :: Integer -> UTCTime getYearP4 year = decodeLocalUTC utc (CalendarTime (GregorianDay year 12 31) midnight) times :: [UTCTime] -times = [baseTime0] ++ (fmap getDay [0..23]) +times = [baseTime0] ++ (fmap getDay [0..23]) ++ (fmap getDay [0..100]) ++ + (fmap getYearP1 [1980..2000]) ++ (fmap getYearP2 [1980..2000]) ++ (fmap getYearP3 [1980..2000]) ++ (fmap getYearP4 [1980..2000]) compareFormat :: String -> Timezone -> UTCTime -> IO () compareFormat fmt zone time = let @@ -83,11 +84,8 @@ compareFormat fmt zone time = let chars :: [Char] chars = "aAbBcCdDeFgGhHIjklmMnprRStTuUVwWxXyYzZ%" +formats :: [String] +formats = ["%G-W%V-%u","%U-%w","%W-%u"] ++ (fmap (\char -> '%':char:[]) chars) + main :: IO () -main = do - mapM_ (\day -> compareFormat "%G-W%V-%u" utc (getDay day)) [0..100] - mapM_ (\year -> compareFormat "%G-W%V-%u" utc (getYearP1 year)) [1980..2000] - mapM_ (\year -> compareFormat "%G-W%V-%u" utc (getYearP2 year)) [1980..2000] - mapM_ (\year -> compareFormat "%G-W%V-%u" utc (getYearP3 year)) [1980..2000] - mapM_ (\year -> compareFormat "%G-W%V-%u" utc (getYearP4 year)) [1980..2000] - mapM_ (\char -> let fmt = '%':char:[] in mapM_ (\time -> mapM_ (\zone -> compareFormat fmt zone time) zones) times) chars +main = mapM_ (\fmt -> mapM_ (\time -> mapM_ (\zone -> compareFormat fmt zone time) zones) times) formats From git at git.haskell.org Mon Feb 20 21:08:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:08:17 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: organise week functions (73c160c) Message-ID: <20170220210817.E614C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/73c160cf9cb8289b041389470d38afaacbd31387 >--------------------------------------------------------------- commit 73c160cf9cb8289b041389470d38afaacbd31387 Author: Ashley Yakeley Date: Tue May 10 04:03:21 2005 -0700 organise week functions darcs-hash:20050510110321-ac6dd-405622ed76952493da885fb866043a8d247ac06c >--------------------------------------------------------------- 73c160cf9cb8289b041389470d38afaacbd31387 Makefile | 1 + System/Time/Calendar/Format.hs | 28 +++++----------------------- System/Time/Calendar/YearDay.hs | 19 +++++++++++++++++++ 3 files changed, 25 insertions(+), 23 deletions(-) diff --git a/Makefile b/Makefile index c6c6b0b..36a93b7 100644 --- a/Makefile +++ b/Makefile @@ -82,6 +82,7 @@ System/Time/Calendar/Calendar.o : System/Time/Clock.hi System/Time/Calendar/Calendar.o : System/Time/Calendar/Timezone.hi System/Time/Calendar/Calendar.o : System/Time/Calendar/TimeOfDay.hi System/Time/Calendar/YearDay.o : System/Time/Calendar/YearDay.hs +System/Time/Calendar/YearDay.o : System/Time/Clock.hi System/Time/Calendar/YearDay.o : System/Time/Calendar/Private.hi System/Time/Calendar/YearDay.o : System/Time/Calendar/Calendar.hi System/Time/Calendar/Gregorian.o : System/Time/Calendar/Gregorian.hs diff --git a/System/Time/Calendar/Format.hs b/System/Time/Calendar/Format.hs index a3f08d3..398c4c0 100644 --- a/System/Time/Calendar/Format.hs +++ b/System/Time/Calendar/Format.hs @@ -73,24 +73,6 @@ instance FormatTime Timezone where formatCharacter 'Z' = Just (\_ -> timezoneName) formatCharacter _ = Nothing -weekDay :: ModJulianDay -> Int -weekDay day = fromInteger (mod (day + 3) 7) - -weekDay' :: ModJulianDay -> Int -weekDay' day = weekDay (day - 1) + 1 - -weekNumber :: ModJulianDay -> Int -weekNumber mjd = fromInteger ((div d 7) - (div k 7)) where - yd = ydDay (encodeDay mjd) - d = mjd + 3 - k = d - (toInteger yd) - -weekNumber' :: ModJulianDay -> Int -weekNumber' mjd = fromInteger ((div d 7) - (div k 7)) where - yd = ydDay (encodeDay mjd) - d = mjd + 2 - k = d - (toInteger yd) - instance FormatTime ModJulianDay where -- Aggregate formatCharacter 'D' = Just (\locale -> formatTime locale "%m/%d/%y") @@ -119,11 +101,11 @@ instance FormatTime ModJulianDay where formatCharacter 'u' = Just (\_ -> show . isowDay . encodeDay) -- Day of week - formatCharacter 'a' = Just (\locale -> snd . ((wDays locale) !!) . weekDay) - formatCharacter 'A' = Just (\locale -> fst . ((wDays locale) !!) . weekDay) - formatCharacter 'U' = Just (\_ -> show2 . weekNumber) - formatCharacter 'w' = Just (\_ -> show . weekDay) - formatCharacter 'W' = Just (\_ -> show2 . weekNumber') + formatCharacter 'a' = Just (\locale -> snd . ((wDays locale) !!) . snd . sundayStartWeek) + formatCharacter 'A' = Just (\locale -> fst . ((wDays locale) !!) . snd . sundayStartWeek) + formatCharacter 'U' = Just (\_ -> show2 . fst . sundayStartWeek) + formatCharacter 'w' = Just (\_ -> show . snd . sundayStartWeek) + formatCharacter 'W' = Just (\_ -> show2 . fst . mondayStartWeek) -- Default formatCharacter _ = Nothing diff --git a/System/Time/Calendar/YearDay.hs b/System/Time/Calendar/YearDay.hs index 556c913..2c120eb 100644 --- a/System/Time/Calendar/YearDay.hs +++ b/System/Time/Calendar/YearDay.hs @@ -4,6 +4,7 @@ module System.Time.Calendar.YearDay where import System.Time.Calendar.Calendar import System.Time.Calendar.Private +import System.Time.Clock -- | ISO 8601 Ordinal Date data YearDay = YearDay { @@ -32,3 +33,21 @@ instance DayEncoding YearDay where isLeapYear :: Integer -> Bool isLeapYear year = (mod year 4 == 0) && ((mod year 400 == 0) || not (mod year 100 == 0)) + +-- | Get the number of the Monday-starting week in the year and the day of the week. +-- The first Monday is the first day of week 1, any earlier days in the year are week 0 (as \"%W\" in formatTime). +-- Monday is 1, Sunday is 7 (as \"%u\" in formatTime). +mondayStartWeek :: ModJulianDay -> (Int,Int) +mondayStartWeek mjd =(fromInteger ((div d 7) - (div k 7)),fromInteger (mod d 7) + 1) where + yd = ydDay (encodeDay mjd) + d = mjd + 2 + k = d - (toInteger yd) + +-- | Get the number of the Sunday-starting week in the year and the day of the week. +-- The first Sunday is the first day of week 1, any earlier days in the year are week 0 (as \"%U\" in formatTime). +-- Sunday is 0, Saturday is 6 (as \"%w\" in formatTime). +sundayStartWeek :: ModJulianDay -> (Int,Int) +sundayStartWeek mjd =(fromInteger ((div d 7) - (div k 7)),fromInteger (mod d 7)) where + yd = ydDay (encodeDay mjd) + d = mjd + 3 + k = d - (toInteger yd) From git at git.haskell.org Mon Feb 20 21:08:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:08:19 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: clean up some type names, more doc (23be1cb) Message-ID: <20170220210819.EE4CD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/23be1cbc6f4656788094ab2356f4ebe80f81f9ec >--------------------------------------------------------------- commit 23be1cbc6f4656788094ab2356f4ebe80f81f9ec Author: Ashley Yakeley Date: Wed May 11 02:02:36 2005 -0700 clean up some type names, more doc darcs-hash:20050511090236-ac6dd-933871a97e6db2b7c089579ec25f4016211be440 >--------------------------------------------------------------- 23be1cbc6f4656788094ab2356f4ebe80f81f9ec System/Time/Calendar/Calendar.hs | 35 +++++++++++++++++++++-------------- System/Time/Calendar/Format.hs | 24 ++++++++++++------------ System/Time/Calendar/Gregorian.hs | 10 +++++----- System/Time/Calendar/TimeOfDay.hs | 16 ++++++++-------- test/ShowDST.hs | 4 ++-- test/TestFormat.hs | 12 ++++++------ test/TestTime.hs | 2 +- 7 files changed, 55 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 23be1cbc6f4656788094ab2356f4ebe80f81f9ec From git at git.haskell.org Mon Feb 20 21:08:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:08:22 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: CalendarTime synonym with convenience functions (f853253) Message-ID: <20170220210822.010723A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/f8532533d788c272d59278286c021eab2b973744 >--------------------------------------------------------------- commit f8532533d788c272d59278286c021eab2b973744 Author: Ashley Yakeley Date: Wed May 11 02:30:27 2005 -0700 CalendarTime synonym with convenience functions darcs-hash:20050511093027-ac6dd-4336dabf134f48c15b0b922d4ee54d11567b7975 >--------------------------------------------------------------- f8532533d788c272d59278286c021eab2b973744 System/Time/Calendar.hs | 39 ++++++++++++++++++++++++++++++++++++++- System/Time/Calendar/Gregorian.hs | 7 +------ test/CurrentTime.hs | 5 ++--- test/ShowDST.hs | 4 ++-- test/TestFormat.hs | 2 +- test/TestTime.hs | 16 ++++++++-------- 6 files changed, 52 insertions(+), 21 deletions(-) diff --git a/System/Time/Calendar.hs b/System/Time/Calendar.hs index 9b5d890..4b848e5 100644 --- a/System/Time/Calendar.hs +++ b/System/Time/Calendar.hs @@ -8,9 +8,13 @@ module System.Time.Calendar module System.Time.Calendar.YearDay, module System.Time.Calendar.Gregorian, module System.Time.Calendar.ISOWeek, - module System.Time.Calendar.Format + module System.Time.Calendar.Format, + module System.Time.Calendar ) where +import Data.Fixed +import System.Time.Clock + import System.Time.Calendar.Timezone import System.Time.Calendar.TimeOfDay import System.Time.Calendar.Calendar @@ -18,3 +22,36 @@ import System.Time.Calendar.YearDay import System.Time.Calendar.Gregorian import System.Time.Calendar.ISOWeek import System.Time.Calendar.Format + +type CalendarTime = ZonedTime (DayAndTime GregorianDay) + +calendarTime :: Timezone -> Integer -> Int -> Int -> Int -> Int -> Pico -> CalendarTime +calendarTime zone year month day hour minute second = + ZonedTime (DayAndTime (GregorianDay year month day) (TimeOfDay hour minute second)) zone + +ctZone :: CalendarTime -> Timezone +ctZone = ztZone + +ctYear :: CalendarTime -> Integer +ctYear = gregYear . dtDay . ztTime + +ctMonth :: CalendarTime -> Int +ctMonth = gregMonth . dtDay . ztTime + +ctDay :: CalendarTime -> Int +ctDay = gregDay . dtDay . ztTime + +ctHour :: CalendarTime -> Int +ctHour = todHour . dtTime . ztTime + +ctMin :: CalendarTime -> Int +ctMin = todMin . dtTime . ztTime + +ctSec :: CalendarTime -> Pico +ctSec = todSec . dtTime . ztTime + +getCalendarTime :: IO CalendarTime +getCalendarTime = do + t <- getCurrentTime + zone <- getTimezone t + return (encodeUTC zone t) diff --git a/System/Time/Calendar/Gregorian.hs b/System/Time/Calendar/Gregorian.hs index 77f389d..3e986bd 100644 --- a/System/Time/Calendar/Gregorian.hs +++ b/System/Time/Calendar/Gregorian.hs @@ -2,7 +2,7 @@ module System.Time.Calendar.Gregorian ( - GregorianDay(..),GregorianTime,ZonedGregorianTime + GregorianDay(..) -- calendrical arithmetic -- e.g. "one month after March 31st" @@ -19,10 +19,6 @@ data GregorianDay = GregorianDay { gregDay :: Int } deriving (Eq,Ord) -type GregorianTime = DayAndTime GregorianDay - -type ZonedGregorianTime = ZonedTime (DayAndTime GregorianDay) - instance Show GregorianDay where show (GregorianDay y m d) = (if y > 0 then show y else (show (1 - y) ++ "BCE")) ++ "-" ++ (show2 m) ++ "-" ++ (show2 d) @@ -30,7 +26,6 @@ findMonthDay :: [Int] -> Int -> (Int,Int) findMonthDay (n:ns) yd | yd > n = (\(m,d) -> (m + 1,d)) (findMonthDay ns (yd - n)) findMonthDay _ yd = (1,yd) - monthLengths :: Bool -> [Int] monthLengths isleap = [31,if isleap then 29 else 28,31,30,31,30,31,31,30,31,30,31] diff --git a/test/CurrentTime.hs b/test/CurrentTime.hs index 2bb3f11..ae00fae 100644 --- a/test/CurrentTime.hs +++ b/test/CurrentTime.hs @@ -8,7 +8,6 @@ main :: IO () main = do now <- getCurrentTime putStrLn (show (utctDay now) ++ "," ++ show (utctDayTime now)) - putStrLn (show (encodeLocalUTC utc now :: GregorianTime)) + putStrLn (show (encodeUTC utc now :: CalendarTime)) myzone <- getCurrentTimezone - putStrLn ("timezone: " ++ show myzone) - putStrLn (show (encodeLocalUTC myzone now :: GregorianTime)) + putStrLn (show (encodeUTC myzone now :: CalendarTime)) diff --git a/test/ShowDST.hs b/test/ShowDST.hs index 655beca..a061060 100644 --- a/test/ShowDST.hs +++ b/test/ShowDST.hs @@ -19,7 +19,7 @@ findTransition a b = do return (tp ++ tq) showZoneTime :: Timezone -> UTCTime -> String -showZoneTime zone time = (show (encodeLocalUTC zone time :: GregorianTime)) ++ " " ++ (show zone) +showZoneTime zone time = show (encodeUTC zone time :: CalendarTime) showTransition :: (UTCTime,Timezone,Timezone) -> String showTransition (time,zone1,zone2) = (showZoneTime zone1 time) ++ " => " ++ (showZoneTime zone2 time) @@ -28,7 +28,7 @@ main :: IO () main = do now <- getCurrentTime zone <- getTimezone now - let year = cdYear (dtDay (encodeLocalUTC zone now)) + let year = gregYear (dtDay (encodeLocalUTC zone now)) putStrLn ("DST adjustments for " ++ show year ++ ":") let t0 = monthBeginning zone year 1 let t1 = monthBeginning zone year 4 diff --git a/test/TestFormat.hs b/test/TestFormat.hs index fbb1b7d..d4a7675 100644 --- a/test/TestFormat.hs +++ b/test/TestFormat.hs @@ -70,7 +70,7 @@ times = [baseTime0] ++ (fmap getDay [0..23]) ++ (fmap getDay [0..100]) ++ compareFormat :: String -> Timezone -> UTCTime -> IO () compareFormat fmt zone time = let - ctime = encodeUTC zone time :: ZonedGregorianTime + ctime = encodeUTC zone time :: CalendarTime haskellText = formatTime locale fmt ctime in do unixText <- unixFormatTime fmt zone time diff --git a/test/TestTime.hs b/test/TestTime.hs index 13a1ead..908ad88 100644 --- a/test/TestTime.hs +++ b/test/TestTime.hs @@ -40,7 +40,7 @@ showUTCTime (UTCTime d t) = show d ++ "," ++ show t myzone :: Timezone myzone = hoursToTimezone (- 8) -leapSec1998Cal :: GregorianTime +leapSec1998Cal :: DayAndTime GregorianDay leapSec1998Cal = DayAndTime (GregorianDay 1998 12 31) (TimeOfDay 23 59 60.5) leapSec1998 :: UTCTime @@ -52,7 +52,7 @@ testUTC = do showCal 51178 putStrLn (show leapSec1998Cal) putStrLn (showUTCTime leapSec1998) - let lsMineCal = encodeLocalUTC myzone leapSec1998 :: GregorianTime + let lsMineCal = encodeLocalUTC myzone leapSec1998 :: DayAndTime GregorianDay putStrLn (show lsMineCal) let lsMine = decodeLocalUTC myzone lsMineCal putStrLn (showUTCTime lsMine) @@ -66,12 +66,12 @@ poslong = 120 testUT1 :: IO () testUT1 = do putStrLn "" - putStrLn (show (encodeLocalUT1 0 51604.0 :: GregorianTime)) - putStrLn (show (encodeLocalUT1 0 51604.5 :: GregorianTime)) - putStrLn (show (encodeLocalUT1 neglong 51604.0 :: GregorianTime)) - putStrLn (show (encodeLocalUT1 neglong 51604.5 :: GregorianTime)) - putStrLn (show (encodeLocalUT1 poslong 51604.0 :: GregorianTime)) - putStrLn (show (encodeLocalUT1 poslong 51604.5 :: GregorianTime)) + putStrLn (show (encodeLocalUT1 0 51604.0 :: DayAndTime GregorianDay)) + putStrLn (show (encodeLocalUT1 0 51604.5 :: DayAndTime GregorianDay)) + putStrLn (show (encodeLocalUT1 neglong 51604.0 :: DayAndTime GregorianDay)) + putStrLn (show (encodeLocalUT1 neglong 51604.5 :: DayAndTime GregorianDay)) + putStrLn (show (encodeLocalUT1 poslong 51604.0 :: DayAndTime GregorianDay)) + putStrLn (show (encodeLocalUT1 poslong 51604.5 :: DayAndTime GregorianDay)) main :: IO () main = do From git at git.haskell.org Mon Feb 20 21:08:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:08:24 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: better tz for test (865557b) Message-ID: <20170220210824.070EF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/865557b3d37b3cba48ed1c4d4f12128f19c7f28f >--------------------------------------------------------------- commit 865557b3d37b3cba48ed1c4d4f12128f19c7f28f Author: Ashley Yakeley Date: Wed May 11 22:50:47 2005 -0700 better tz for test darcs-hash:20050512055047-ac6dd-1f4486d8b5ca0fa95be731b31b603535bb5695cc >--------------------------------------------------------------- 865557b3d37b3cba48ed1c4d4f12128f19c7f28f test/TestFormat.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/TestFormat.hs b/test/TestFormat.hs index d4a7675..a273448 100644 --- a/test/TestFormat.hs +++ b/test/TestFormat.hs @@ -38,7 +38,7 @@ locale :: TimeLocale locale = defaultTimeLocale {dateTimeFmt = "%a %b %e %H:%M:%S %Y"} zones :: [Timezone] -zones = [utc,hoursToTimezone (- 7)] +zones = [utc,MkTimezone 87 True "Fenwickian Daylight Time"] posixDay :: UTCDiffTime posixDay = 86400 From git at git.haskell.org Mon Feb 20 21:08:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:08:26 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: better C type for name param (7a52230) Message-ID: <20170220210826.0E9AC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/7a522300362bccc114014743d3e0d6b2823fa252 >--------------------------------------------------------------- commit 7a522300362bccc114014743d3e0d6b2823fa252 Author: Ashley Yakeley Date: Wed May 11 22:55:54 2005 -0700 better C type for name param darcs-hash:20050512055554-ac6dd-5dd656b851561c2626a5a62eaef9600aeab35490 >--------------------------------------------------------------- 7a522300362bccc114014743d3e0d6b2823fa252 timestuff.c | 2 +- timestuff.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/timestuff.c b/timestuff.c index 386616e..0fdbd9e 100644 --- a/timestuff.c +++ b/timestuff.c @@ -1,6 +1,6 @@ #include "timestuff.h" -long int get_current_timezone_seconds (time_t t,int* dst,char** name) +long int get_current_timezone_seconds (time_t t,int* dst,char const* * name) { struct tm tmd; struct tm* ptm = localtime_r(&t,&tmd); diff --git a/timestuff.h b/timestuff.h index 936cd84..c161fc9 100644 --- a/timestuff.h +++ b/timestuff.h @@ -1,3 +1,3 @@ #include -long int get_current_timezone_seconds (time_t,int* dst,char** name); +long int get_current_timezone_seconds (time_t,int* dst,char const* * name); From git at git.haskell.org Mon Feb 20 21:08:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:08:28 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: XCode 2.0 project (1ecbd6c) Message-ID: <20170220210828.14AD53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/1ecbd6c347b20e978149947e4623a62dd662193e >--------------------------------------------------------------- commit 1ecbd6c347b20e978149947e4623a62dd662193e Author: Ashley Yakeley Date: Mon May 16 01:36:36 2005 -0700 XCode 2.0 project darcs-hash:20050516083636-ac6dd-b6506418cfe358e9e64528fc691c54bd5e56fac3 >--------------------------------------------------------------- 1ecbd6c347b20e978149947e4623a62dd662193e Makefile | 7 +- TimeLib.xcode/project.pbxproj | 259 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 265 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 36a93b7..fe5e66d 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,13 @@ -default: build doc +default: build build: $(patsubst %.hs,%.hi,$(SRCS)) libTimeLib.a test: build cd test && make +cleantest: build + cd test && make clean + SRCS = Data/Fixed.hs \ System/Time/Clock.hs \ System/Time/TAI.hs \ @@ -54,6 +57,8 @@ FORCE: .SECONDARY: +.PHONY: default build test doc clean + depend: $(SRCS) ghc -M $^ diff --git a/TimeLib.xcode/project.pbxproj b/TimeLib.xcode/project.pbxproj new file mode 100644 index 0000000..8a889aa --- /dev/null +++ b/TimeLib.xcode/project.pbxproj @@ -0,0 +1,259 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 39; + objects = { + AB01DCEA083747B1003C9EF7 = { + children = ( + AB01DCF508374807003C9EF7, + AB01DCF908374808003C9EF7, + AB01DCF808374808003C9EF7, + AB01DD0008374848003C9EF7, + AB35747F08386FCD00B5F897, + ); + isa = PBXGroup; + refType = 4; + sourceTree = ""; + }; + AB01DCEC083747B1003C9EF7 = { + buildSettings = { + COPY_PHASE_STRIP = NO; + }; + isa = PBXBuildStyle; + name = Development; + }; + AB01DCED083747B1003C9EF7 = { + buildSettings = { + COPY_PHASE_STRIP = YES; + }; + isa = PBXBuildStyle; + name = Deployment; + }; + AB01DCEE083747B1003C9EF7 = { + buildSettings = { + }; + buildStyles = ( + AB01DCEC083747B1003C9EF7, + AB01DCED083747B1003C9EF7, + ); + hasScannedForEncodings = 0; + isa = PBXProject; + mainGroup = AB01DCEA083747B1003C9EF7; + projectDirPath = ""; + targets = ( + AB01DD2108374A56003C9EF7, + AB3571F5083759B20059BD19, + ); + }; + AB01DCF508374807003C9EF7 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.make; + path = Makefile; + refType = 4; + sourceTree = ""; + }; + AB01DCF608374808003C9EF7 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.haskell; + path = Setup.hs; + refType = 4; + sourceTree = ""; + }; + AB01DCF708374808003C9EF7 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = text; + path = TimeLib.cabal; + refType = 4; + sourceTree = ""; + }; + AB01DCF808374808003C9EF7 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + path = timestuff.c; + refType = 4; + sourceTree = ""; + }; + AB01DCF908374808003C9EF7 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = timestuff.h; + refType = 4; + sourceTree = ""; + }; + AB01DCFC08374838003C9EF7 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.haskell; + path = Calendar.hs; + refType = 4; + sourceTree = ""; + }; + AB01DCFD08374838003C9EF7 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.haskell; + path = Clock.hs; + refType = 4; + sourceTree = ""; + }; + AB01DCFE08374838003C9EF7 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.haskell; + path = TAI.hs; + refType = 4; + sourceTree = ""; + }; + AB01DD0008374848003C9EF7 = { + children = ( + AB01DCFD08374838003C9EF7, + AB01DCFE08374838003C9EF7, + AB01DD0D083748C0003C9EF7, + AB01DCFC08374838003C9EF7, + ); + isa = PBXGroup; + name = Time; + path = System/Time; + refType = 4; + sourceTree = ""; + }; + AB01DD0D083748C0003C9EF7 = { + children = ( + AB01DD16083748EC003C9EF7, + AB01DD18083748EC003C9EF7, + AB01DD17083748EC003C9EF7, + AB01DD12083748EC003C9EF7, + AB01DD19083748EC003C9EF7, + AB01DD14083748EC003C9EF7, + AB01DD15083748EC003C9EF7, + AB01DD13083748EC003C9EF7, + ); + isa = PBXGroup; + path = Calendar; + refType = 4; + sourceTree = ""; + }; + AB01DD12083748EC003C9EF7 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.haskell; + path = Calendar.hs; + refType = 4; + sourceTree = ""; + }; + AB01DD13083748EC003C9EF7 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.haskell; + path = Format.hs; + refType = 4; + sourceTree = ""; + }; + AB01DD14083748EC003C9EF7 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.haskell; + path = Gregorian.hs; + refType = 4; + sourceTree = ""; + }; + AB01DD15083748EC003C9EF7 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.haskell; + path = ISOWeek.hs; + refType = 4; + sourceTree = ""; + }; + AB01DD16083748EC003C9EF7 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.haskell; + path = Private.hs; + refType = 4; + sourceTree = ""; + }; + AB01DD17083748EC003C9EF7 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.haskell; + path = TimeOfDay.hs; + refType = 4; + sourceTree = ""; + }; + AB01DD18083748EC003C9EF7 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.haskell; + path = Timezone.hs; + refType = 4; + sourceTree = ""; + }; + AB01DD19083748EC003C9EF7 = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.haskell; + path = YearDay.hs; + refType = 4; + sourceTree = ""; + }; + AB01DD2108374A56003C9EF7 = { + buildArgumentsString = "$(ACTION)"; + buildPhases = ( + ); + buildSettings = { + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ""; + OTHER_REZFLAGS = ""; + PRODUCT_NAME = Untitled; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas"; + }; + buildToolPath = /usr/bin/make; + dependencies = ( + ); + isa = PBXLegacyTarget; + name = Build; + passBuildSettingsInEnvironment = 1; + productName = Untitled; + }; + AB3571F5083759B20059BD19 = { + buildArgumentsString = "$(ACTION)test"; + buildPhases = ( + ); + buildSettings = { + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ""; + OTHER_REZFLAGS = ""; + PRODUCT_NAME = Test; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas"; + }; + buildToolPath = /usr/bin/make; + dependencies = ( + ); + isa = PBXLegacyTarget; + name = Test; + passBuildSettingsInEnvironment = 1; + productName = Test; + }; + AB35747F08386FCD00B5F897 = { + children = ( + AB01DCF708374808003C9EF7, + AB01DCF608374808003C9EF7, + ); + isa = PBXGroup; + name = Cabal; + refType = 4; + sourceTree = ""; + }; + }; + rootObject = AB01DCEE083747B1003C9EF7; +} From git at git.haskell.org Mon Feb 20 21:08:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:08:30 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: clean up XCode project & makefile (0bb6871) Message-ID: <20170220210830.1B9743A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/0bb687137246fa43f8fe42f3720463e2f105a9ac >--------------------------------------------------------------- commit 0bb687137246fa43f8fe42f3720463e2f105a9ac Author: Ashley Yakeley Date: Wed May 18 01:13:06 2005 -0700 clean up XCode project & makefile darcs-hash:20050518081306-ac6dd-2b83dc54af7951b3697bbf75aff9c2d05195992c >--------------------------------------------------------------- 0bb687137246fa43f8fe42f3720463e2f105a9ac Makefile | 13 ++- TimeLib.xcode/project.pbxproj | 217 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 225 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index fe5e66d..442f354 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,11 @@ -default: build +default: build test doc build: $(patsubst %.hs,%.hi,$(SRCS)) libTimeLib.a test: build cd test && make -cleantest: build +cleantest: cd test && make clean SRCS = Data/Fixed.hs \ @@ -29,8 +29,13 @@ libTimeLib.a: $(patsubst %.hs,%.o,$(SRCS)) timestuff.o ar cru $@ $^ ranlib $@ -clean: - rm -rf doc haddock *.a *.o *.hi $(patsubst %.hs,%.o,$(SRCS)) $(patsubst %.hs,%.hi,$(SRCS)) Makefile.bak +cleanbuild: + rm -rf *.a *.o *.hi $(patsubst %.hs,%.o,$(SRCS)) $(patsubst %.hs,%.hi,$(SRCS)) Makefile.bak + +cleandoc: + rm -rf doc haddock + +clean: cleandoc cleantest cleanbuild doc: haddock/index.html diff --git a/TimeLib.xcode/project.pbxproj b/TimeLib.xcode/project.pbxproj index 8a889aa..c2742eb 100644 --- a/TimeLib.xcode/project.pbxproj +++ b/TimeLib.xcode/project.pbxproj @@ -10,8 +10,10 @@ AB01DCF508374807003C9EF7, AB01DCF908374808003C9EF7, AB01DCF808374808003C9EF7, + ABFA25DC0839F8C90096540C, AB01DD0008374848003C9EF7, AB35747F08386FCD00B5F897, + ABFA25EC0839F9FD0096540C, ); isa = PBXGroup; refType = 4; @@ -45,6 +47,8 @@ targets = ( AB01DD2108374A56003C9EF7, AB3571F5083759B20059BD19, + ABFA25E20839F9310096540C, + ABFA25E50839F99F0096540C, ); }; AB01DCF508374807003C9EF7 = { @@ -205,7 +209,7 @@ sourceTree = ""; }; AB01DD2108374A56003C9EF7 = { - buildArgumentsString = "$(ACTION)"; + buildArgumentsString = "$(ACTION)build"; buildPhases = ( ); buildSettings = { @@ -254,6 +258,217 @@ refType = 4; sourceTree = ""; }; + ABFA25DC0839F8C90096540C = { + children = ( + ABFA25DF0839F8F70096540C, + ); + isa = PBXGroup; + path = Data; + refType = 4; + sourceTree = ""; + }; + ABFA25DF0839F8F70096540C = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.haskell; + path = Fixed.hs; + refType = 4; + sourceTree = ""; + }; + ABFA25E20839F9310096540C = { + buildArgumentsString = "$(ACTION)doc"; + buildPhases = ( + ); + buildSettings = { + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ""; + OTHER_REZFLAGS = ""; + PRODUCT_NAME = Untitled; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas"; + }; + buildToolPath = /usr/bin/make; + dependencies = ( + ); + isa = PBXLegacyTarget; + name = Documentation; + passBuildSettingsInEnvironment = 1; + productName = Untitled; + }; + ABFA25E50839F99F0096540C = { + buildPhases = ( + ); + buildSettings = { + OPTIMIZATION_CFLAGS = ""; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ""; + OTHER_REZFLAGS = ""; + PRODUCT_NAME = Everything; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas"; + }; + dependencies = ( + ABFA25E90839F9AF0096540C, + ABFA25EB0839F9B10096540C, + ABFA25E70839F9AD0096540C, + ); + isa = PBXAggregateTarget; + name = Everything; + productName = Everything; + }; + ABFA25E60839F9AD0096540C = { + containerPortal = AB01DCEE083747B1003C9EF7; + isa = PBXContainerItemProxy; + proxyType = 1; + remoteGlobalIDString = ABFA25E20839F9310096540C; + remoteInfo = Documentation; + }; + ABFA25E70839F9AD0096540C = { + isa = PBXTargetDependency; + target = ABFA25E20839F9310096540C; + targetProxy = ABFA25E60839F9AD0096540C; + }; + ABFA25E80839F9AF0096540C = { + containerPortal = AB01DCEE083747B1003C9EF7; + isa = PBXContainerItemProxy; + proxyType = 1; + remoteGlobalIDString = AB01DD2108374A56003C9EF7; + remoteInfo = Build; + }; + ABFA25E90839F9AF0096540C = { + isa = PBXTargetDependency; + target = AB01DD2108374A56003C9EF7; + targetProxy = ABFA25E80839F9AF0096540C; + }; + ABFA25EA0839F9B10096540C = { + containerPortal = AB01DCEE083747B1003C9EF7; + isa = PBXContainerItemProxy; + proxyType = 1; + remoteGlobalIDString = AB3571F5083759B20059BD19; + remoteInfo = Test; + }; + ABFA25EB0839F9B10096540C = { + isa = PBXTargetDependency; + target = AB3571F5083759B20059BD19; + targetProxy = ABFA25EA0839F9B10096540C; + }; + ABFA25EC0839F9FD0096540C = { + children = ( + ABFA2623083B28C00096540C, + ABFA2624083B28C00096540C, + ABFA2625083B28C00096540C, + ABFA2626083B28C00096540C, + ABFA2627083B28C00096540C, + ABFA2628083B28C00096540C, + ABFA2629083B28C00096540C, + ABFA262A083B28C00096540C, + ABFA262B083B28C00096540C, + ABFA262C083B28C00096540C, + ABFA262D083B28C00096540C, + ABFA262E083B28C00096540C, + ); + isa = PBXGroup; + name = Test; + path = test; + refType = 4; + sourceTree = ""; + }; + ABFA2623083B28C00096540C = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.haskell; + path = ConvertBack.hs; + refType = 4; + sourceTree = ""; + }; + ABFA2624083B28C00096540C = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.haskell; + path = CurrentTime.hs; + refType = 4; + sourceTree = ""; + }; + ABFA2625083B28C00096540C = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.make; + path = Makefile; + refType = 4; + sourceTree = ""; + }; + ABFA2626083B28C00096540C = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.haskell; + path = ShowDST.hs; + refType = 4; + sourceTree = ""; + }; + ABFA2627083B28C00096540C = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.haskell; + path = TestFixed.hs; + refType = 4; + sourceTree = ""; + }; + ABFA2628083B28C00096540C = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = text; + path = TestFixed.ref; + refType = 4; + sourceTree = ""; + }; + ABFA2629083B28C00096540C = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.haskell; + path = TestFormat.hs; + refType = 4; + sourceTree = ""; + }; + ABFA262A083B28C00096540C = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.c; + path = TestFormatStuff.c; + refType = 4; + sourceTree = ""; + }; + ABFA262B083B28C00096540C = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + path = TestFormatStuff.h; + refType = 4; + sourceTree = ""; + }; + ABFA262C083B28C00096540C = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.haskell; + path = TestTime.hs; + refType = 4; + sourceTree = ""; + }; + ABFA262D083B28C00096540C = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = text; + path = TestTime.ref; + refType = 4; + sourceTree = ""; + }; + ABFA262E083B28C00096540C = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = sourcecode.haskell; + path = TimeZone.hs; + refType = 4; + sourceTree = ""; + }; }; rootObject = AB01DCEE083747B1003C9EF7; } From git at git.haskell.org Mon Feb 20 21:08:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:08:32 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: hide submodules in Haddock docs (e128961) Message-ID: <20170220210832.23C173A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/e1289618cca447ca7348da0d032b1dd0dc2f5a84 >--------------------------------------------------------------- commit e1289618cca447ca7348da0d032b1dd0dc2f5a84 Author: Ashley Yakeley Date: Wed May 18 01:14:23 2005 -0700 hide submodules in Haddock docs darcs-hash:20050518081423-ac6dd-76ee3e4f8b6b1ee8e55235367594fb52d321a4ee >--------------------------------------------------------------- e1289618cca447ca7348da0d032b1dd0dc2f5a84 System/Time/Calendar.hs | 1 + System/Time/Calendar/Calendar.hs | 2 ++ System/Time/Calendar/Format.hs | 8 +++++++- System/Time/Calendar/Gregorian.hs | 2 ++ System/Time/Calendar/ISOWeek.hs | 7 ++++++- System/Time/Calendar/Private.hs | 1 + System/Time/Calendar/TimeOfDay.hs | 2 ++ System/Time/Calendar/Timezone.hs | 3 ++- System/Time/Calendar/YearDay.hs | 7 ++++++- 9 files changed, 29 insertions(+), 4 deletions(-) diff --git a/System/Time/Calendar.hs b/System/Time/Calendar.hs index 4b848e5..7035149 100644 --- a/System/Time/Calendar.hs +++ b/System/Time/Calendar.hs @@ -9,6 +9,7 @@ module System.Time.Calendar module System.Time.Calendar.Gregorian, module System.Time.Calendar.ISOWeek, module System.Time.Calendar.Format, + -- * CalendarTime module System.Time.Calendar ) where diff --git a/System/Time/Calendar/Calendar.hs b/System/Time/Calendar/Calendar.hs index f15890d..cc4e0c3 100644 --- a/System/Time/Calendar/Calendar.hs +++ b/System/Time/Calendar/Calendar.hs @@ -1,7 +1,9 @@ {-# OPTIONS -Wall -Werror #-} +-- #hide module System.Time.Calendar.Calendar ( + -- * Classes -- "Calendrical" format DayAndTime(..),DayEncoding(..), diff --git a/System/Time/Calendar/Format.hs b/System/Time/Calendar/Format.hs index db63090..e81312a 100644 --- a/System/Time/Calendar/Format.hs +++ b/System/Time/Calendar/Format.hs @@ -1,6 +1,12 @@ {-# OPTIONS -Wall -Werror #-} -module System.Time.Calendar.Format where + +-- #hide +module System.Time.Calendar.Format + ( + -- * UNIX-style formatting + module System.Time.Calendar.Format + ) where import System.Time.Calendar.ISOWeek import System.Time.Calendar.Gregorian diff --git a/System/Time/Calendar/Gregorian.hs b/System/Time/Calendar/Gregorian.hs index 3e986bd..d4cced7 100644 --- a/System/Time/Calendar/Gregorian.hs +++ b/System/Time/Calendar/Gregorian.hs @@ -1,7 +1,9 @@ {-# OPTIONS -Wall -Werror #-} +-- #hide module System.Time.Calendar.Gregorian ( + -- * Gregorian calendar GregorianDay(..) -- calendrical arithmetic diff --git a/System/Time/Calendar/ISOWeek.hs b/System/Time/Calendar/ISOWeek.hs index 2390f01..eb03a39 100644 --- a/System/Time/Calendar/ISOWeek.hs +++ b/System/Time/Calendar/ISOWeek.hs @@ -1,6 +1,11 @@ {-# OPTIONS -Wall -Werror #-} -module System.Time.Calendar.ISOWeek where +-- #hide +module System.Time.Calendar.ISOWeek + ( + -- * ISO Week calendar + module System.Time.Calendar.ISOWeek + ) where import System.Time.Calendar.YearDay import System.Time.Calendar.Calendar diff --git a/System/Time/Calendar/Private.hs b/System/Time/Calendar/Private.hs index db63216..17d2322 100644 --- a/System/Time/Calendar/Private.hs +++ b/System/Time/Calendar/Private.hs @@ -1,5 +1,6 @@ {-# OPTIONS -Wall -Werror #-} +-- #hide module System.Time.Calendar.Private where import Data.Fixed diff --git a/System/Time/Calendar/TimeOfDay.hs b/System/Time/Calendar/TimeOfDay.hs index bf04e78..9bd8213 100644 --- a/System/Time/Calendar/TimeOfDay.hs +++ b/System/Time/Calendar/TimeOfDay.hs @@ -1,7 +1,9 @@ {-# OPTIONS -Wall -Werror #-} +-- #hide module System.Time.Calendar.TimeOfDay ( + -- * Time of day TimeOfDay(..),midnight,midday, utcToLocalTimeOfDay,localToUTCTimeOfDay, timeToTimeOfDay,timeOfDayToTime, diff --git a/System/Time/Calendar/Timezone.hs b/System/Time/Calendar/Timezone.hs index dc836ca..fc2423d 100644 --- a/System/Time/Calendar/Timezone.hs +++ b/System/Time/Calendar/Timezone.hs @@ -1,8 +1,9 @@ {-# OPTIONS -ffi -Wall -Werror #-} +-- #hide module System.Time.Calendar.Timezone ( - -- time zones + -- * Time zones Timezone(..),timezoneOffsetString,minutesToTimezone,hoursToTimezone,utc, -- getting the locale time zone diff --git a/System/Time/Calendar/YearDay.hs b/System/Time/Calendar/YearDay.hs index 2c120eb..49e3c58 100644 --- a/System/Time/Calendar/YearDay.hs +++ b/System/Time/Calendar/YearDay.hs @@ -1,6 +1,11 @@ {-# OPTIONS -Wall -Werror #-} -module System.Time.Calendar.YearDay where +-- #hide +module System.Time.Calendar.YearDay + ( + -- * Year and day format + module System.Time.Calendar.YearDay + ) where import System.Time.Calendar.Calendar import System.Time.Calendar.Private From git at git.haskell.org Mon Feb 20 21:08:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:08:34 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: use "time" for package name (f323ece) Message-ID: <20170220210834.2A2643A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/f323ece469852fd50fc1b7edfe4bbe455a7d23ee >--------------------------------------------------------------- commit f323ece469852fd50fc1b7edfe4bbe455a7d23ee Author: Ashley Yakeley Date: Sun May 22 17:16:50 2005 -0700 use "time" for package name darcs-hash:20050523001650-ac6dd-2b3762d875eedb504f71b92ceb3c39b95edaa914 >--------------------------------------------------------------- f323ece469852fd50fc1b7edfe4bbe455a7d23ee TimeLib.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TimeLib.cabal b/TimeLib.cabal index a4d5a21..60895d0 100644 --- a/TimeLib.cabal +++ b/TimeLib.cabal @@ -1,4 +1,4 @@ -Name: TimeLib +Name: time Version: 0.1 Stability: Alpha -- unsure of best license From git at git.haskell.org Mon Feb 20 21:08:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:08:36 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: put doc index in project (c2214f5) Message-ID: <20170220210836.320D63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/c2214f530199aecbf47cf9ac0e6ed3bb3271f67e >--------------------------------------------------------------- commit c2214f530199aecbf47cf9ac0e6ed3bb3271f67e Author: Ashley Yakeley Date: Sun May 22 17:17:27 2005 -0700 put doc index in project darcs-hash:20050523001727-ac6dd-0718ea889354fccce1f2cecf75a80494a0dbe211 >--------------------------------------------------------------- c2214f530199aecbf47cf9ac0e6ed3bb3271f67e TimeLib.xcode/project.pbxproj | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/TimeLib.xcode/project.pbxproj b/TimeLib.xcode/project.pbxproj index c2742eb..4e18e68 100644 --- a/TimeLib.xcode/project.pbxproj +++ b/TimeLib.xcode/project.pbxproj @@ -14,6 +14,7 @@ AB01DD0008374848003C9EF7, AB35747F08386FCD00B5F897, ABFA25EC0839F9FD0096540C, + ABFA264B083C8AA40096540C, ); isa = PBXGroup; refType = 4; @@ -299,7 +300,6 @@ buildPhases = ( ); buildSettings = { - OPTIMIZATION_CFLAGS = ""; OTHER_CFLAGS = ""; OTHER_LDFLAGS = ""; OTHER_REZFLAGS = ""; @@ -354,18 +354,18 @@ }; ABFA25EC0839F9FD0096540C = { children = ( - ABFA2623083B28C00096540C, - ABFA2624083B28C00096540C, ABFA2625083B28C00096540C, - ABFA2626083B28C00096540C, ABFA2627083B28C00096540C, ABFA2628083B28C00096540C, - ABFA2629083B28C00096540C, - ABFA262A083B28C00096540C, - ABFA262B083B28C00096540C, + ABFA2624083B28C00096540C, + ABFA2626083B28C00096540C, + ABFA2623083B28C00096540C, ABFA262C083B28C00096540C, ABFA262D083B28C00096540C, ABFA262E083B28C00096540C, + ABFA262B083B28C00096540C, + ABFA262A083B28C00096540C, + ABFA2629083B28C00096540C, ); isa = PBXGroup; name = Test; @@ -469,6 +469,24 @@ refType = 4; sourceTree = ""; }; + ABFA2649083BF6210096540C = { + fileEncoding = 4; + isa = PBXFileReference; + lastKnownFileType = text.html; + path = index.html; + refType = 4; + sourceTree = ""; + }; + ABFA264B083C8AA40096540C = { + children = ( + ABFA2649083BF6210096540C, + ); + isa = PBXGroup; + name = "Target Doc"; + path = haddock; + refType = 4; + sourceTree = ""; + }; }; rootObject = AB01DCEE083747B1003C9EF7; } From git at git.haskell.org Mon Feb 20 21:08:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:08:38 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: split up System.Time.Clock (462818f) Message-ID: <20170220210838.3CF243A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/462818f7aa1ffca64aa0d4346979e2fb52f48f0d >--------------------------------------------------------------- commit 462818f7aa1ffca64aa0d4346979e2fb52f48f0d Author: Ashley Yakeley Date: Sun Jul 3 17:15:58 2005 -0700 split up System.Time.Clock darcs-hash:20050704001558-ac6dd-53cb216f3d097415d6d85bffe4e23cadc8266435 >--------------------------------------------------------------- 462818f7aa1ffca64aa0d4346979e2fb52f48f0d Makefile | 21 +++- System/Time/Calendar/Format.hs | 1 + System/Time/Calendar/Timezone.hs | 1 + System/Time/Clock.hs | 200 ++------------------------------- System/Time/Clock/POSIX.hs | 11 ++ System/Time/Clock/Scale.hs | 57 ++++++++++ System/Time/{Clock.hs => Clock/UTC.hs} | 97 +--------------- TimeLib.xcode/project.pbxproj | 79 +++++++++++++ test/TestFormat.hs | 4 +- 9 files changed, 182 insertions(+), 289 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 462818f7aa1ffca64aa0d4346979e2fb52f48f0d From git at git.haskell.org Mon Feb 20 21:08:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:08:40 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: migrate to XCode 2.1 (64d9973) Message-ID: <20170220210840.452F53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/64d997335afcb2b4334eb035f2739bc81a4f45b8 >--------------------------------------------------------------- commit 64d997335afcb2b4334eb035f2739bc81a4f45b8 Author: Ashley Yakeley Date: Sun Jul 3 17:21:10 2005 -0700 migrate to XCode 2.1 darcs-hash:20050704002110-ac6dd-06b1bdc0aefafb58e05bc7ca7bc82da13dd8c902 >--------------------------------------------------------------- 64d997335afcb2b4334eb035f2739bc81a4f45b8 TimeLib.xcode/project.pbxproj | 571 ------------------------------ TimeLib.xcodeproj/project.pbxproj | 709 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 709 insertions(+), 571 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 64d997335afcb2b4334eb035f2739bc81a4f45b8 From git at git.haskell.org Mon Feb 20 21:08:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:08:42 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: use BSD license (02e4b6b) Message-ID: <20170220210842.4D17E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/02e4b6bcacc7d6c6a92ece300e8a89b684c206ca >--------------------------------------------------------------- commit 02e4b6bcacc7d6c6a92ece300e8a89b684c206ca Author: Ashley Yakeley Date: Sun Jul 3 20:41:14 2005 -0700 use BSD license darcs-hash:20050704034114-ac6dd-3e117fba8fe901eae07dbbf7462eb350e1a38931 >--------------------------------------------------------------- 02e4b6bcacc7d6c6a92ece300e8a89b684c206ca LICENSE | 10 ++++++++++ TimeLib.cabal | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..17f1f27 --- /dev/null +++ b/LICENSE @@ -0,0 +1,10 @@ +TimeLib is Copyright (c) Ashley Yakeley, 2004-2005. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +- Neither name of the copyright holders nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/TimeLib.cabal b/TimeLib.cabal index 60895d0..c4b6a45 100644 --- a/TimeLib.cabal +++ b/TimeLib.cabal @@ -1,8 +1,8 @@ Name: time Version: 0.1 Stability: Alpha --- unsure of best license -License: AllRightsReserved +License: BSD3 +License-File: LICENSE Author: Ashley Yakeley Maintainer: Homepage: From git at git.haskell.org Mon Feb 20 21:08:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:08:44 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: fix cabal file private mods (1a29bf0) Message-ID: <20170220210844.53B0A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/1a29bf0d401182730710d0f13d3985980b2a7012 >--------------------------------------------------------------- commit 1a29bf0d401182730710d0f13d3985980b2a7012 Author: Ashley Yakeley Date: Mon Jul 4 16:25:13 2005 -0700 fix cabal file private mods darcs-hash:20050704232513-ac6dd-b41a00c8152f74b5551fa51fb7eeb3c19b405783 >--------------------------------------------------------------- 1a29bf0d401182730710d0f13d3985980b2a7012 TimeLib.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TimeLib.cabal b/TimeLib.cabal index c4b6a45..06ce2d7 100644 --- a/TimeLib.cabal +++ b/TimeLib.cabal @@ -12,4 +12,4 @@ Synopsis: a new time library Exposed-modules: Data.Fixed, System.Time.Clock, System.Time.TAI, System.Time.Calendar.Timezone, System.Time.Calendar.TimeOfDay, System.Time.Calendar.Calendar, System.Time.Calendar.Gregorian, System.Time.Calendar.ISOWeek, System.Time.Calendar.Format, System.Time.Calendar Extensions: ForeignFunctionInterface C-Sources: timestuff.c -Other-modules: System.Time.Calendar.Private +Other-modules: System.Time.Calendar.Private, System.Time.Clock.Scale, System.Time.Clock.UTC, System.Time.Clock.POSIX, System.Time.Clock.Current From git at git.haskell.org Mon Feb 20 21:08:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:08:46 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: add missing Current file (bcb1ac3) Message-ID: <20170220210846.5B8533A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/bcb1ac36593fe40e822f89c8800641bbb1c0c3ae >--------------------------------------------------------------- commit bcb1ac36593fe40e822f89c8800641bbb1c0c3ae Author: Ashley Yakeley Date: Mon Jul 4 16:27:49 2005 -0700 add missing Current file darcs-hash:20050704232749-ac6dd-643f88f66a58d3c45c317cac5d85ef31b471fbb0 >--------------------------------------------------------------- bcb1ac36593fe40e822f89c8800641bbb1c0c3ae System/Time/Clock/Current.hs | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/System/Time/Clock/Current.hs b/System/Time/Clock/Current.hs new file mode 100644 index 0000000..66f4809 --- /dev/null +++ b/System/Time/Clock/Current.hs @@ -0,0 +1,42 @@ +{-# OPTIONS -ffi -Wall -Werror #-} + +-- #hide +module System.Time.Clock.Current +( + -- * Current time + getCurrentTime, +) where + +import System.Time.Clock.UTC + +import Foreign +import Foreign.C + +data CTimeval = MkCTimeval CLong CLong + +ctimevalToPosixSeconds :: CTimeval -> POSIXTime +ctimevalToPosixSeconds (MkCTimeval s mus) = (fromIntegral s) + (fromIntegral mus) / 1000000 + +instance Storable CTimeval where + sizeOf _ = (sizeOf (undefined :: CLong)) * 2 + alignment _ = alignment (undefined :: CLong) + peek p = do + s <- peekElemOff (castPtr p) 0 + mus <- peekElemOff (castPtr p) 1 + return (MkCTimeval s mus) + poke p (MkCTimeval s mus) = do + pokeElemOff (castPtr p) 0 s + pokeElemOff (castPtr p) 1 mus + +foreign import ccall unsafe "time.h gettimeofday" gettimeofday :: Ptr CTimeval -> Ptr () -> IO CInt + +-- | Get the current UTC time from the system clock. +getCurrentTime :: IO UTCTime +getCurrentTime = with (MkCTimeval 0 0) (\ptval -> do + result <- gettimeofday ptval nullPtr + if (result == 0) + then do + tval <- peek ptval + return (posixSecondsToUTCTime (ctimevalToPosixSeconds tval)) + else fail ("error in gettimeofday: " ++ (show result)) + ) From git at git.haskell.org Mon Feb 20 21:08:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:08:48 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: fix exposed/hidden module lists in cabal file (53e4437) Message-ID: <20170220210848.627533A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/53e4437d8a8d6ae470579eb4282a0384f4f6d381 >--------------------------------------------------------------- commit 53e4437d8a8d6ae470579eb4282a0384f4f6d381 Author: Ashley Yakeley Date: Thu Jul 7 01:37:32 2005 -0700 fix exposed/hidden module lists in cabal file darcs-hash:20050707083732-ac6dd-992773e72a12d14203e5decdb323b0e88219f2a2 >--------------------------------------------------------------- 53e4437d8a8d6ae470579eb4282a0384f4f6d381 TimeLib.cabal | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TimeLib.cabal b/TimeLib.cabal index 06ce2d7..903907c 100644 --- a/TimeLib.cabal +++ b/TimeLib.cabal @@ -9,7 +9,7 @@ Homepage: Category: Build-Depends: base Synopsis: a new time library -Exposed-modules: Data.Fixed, System.Time.Clock, System.Time.TAI, System.Time.Calendar.Timezone, System.Time.Calendar.TimeOfDay, System.Time.Calendar.Calendar, System.Time.Calendar.Gregorian, System.Time.Calendar.ISOWeek, System.Time.Calendar.Format, System.Time.Calendar +Exposed-modules: Data.Fixed, System.Time.Clock, System.Time.TAI, System.Time.Calendar Extensions: ForeignFunctionInterface C-Sources: timestuff.c -Other-modules: System.Time.Calendar.Private, System.Time.Clock.Scale, System.Time.Clock.UTC, System.Time.Clock.POSIX, System.Time.Clock.Current +Other-modules: System.Time.Clock.Scale, System.Time.Clock.UTC, System.Time.Clock.POSIX, System.Time.Clock.Current, System.Time.Calendar.Private, System.Time.Calendar.Timezone, System.Time.Calendar.TimeOfDay, System.Time.Calendar.Calendar, System.Time.Calendar.Gregorian, System.Time.Calendar.ISOWeek, System.Time.Calendar.Format, System.Time.Calendar.YearDay From git at git.haskell.org Mon Feb 20 21:08:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:08:50 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: difftime doc seconds (cdfb558) Message-ID: <20170220210850.68A023A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/cdfb558a851f8e91658a066692d711b484047f18 >--------------------------------------------------------------- commit cdfb558a851f8e91658a066692d711b484047f18 Author: Ashley Yakeley Date: Fri Jul 8 04:28:21 2005 -0700 difftime doc seconds darcs-hash:20050708112821-ac6dd-ce19449da430dad80f8cb0375be757416fc495bf >--------------------------------------------------------------- cdfb558a851f8e91658a066692d711b484047f18 System/Time/Clock/Scale.hs | 2 ++ System/Time/Clock/UTC.hs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/System/Time/Clock/Scale.hs b/System/Time/Clock/Scale.hs index 3150dbc..2cb56e7 100644 --- a/System/Time/Clock/Scale.hs +++ b/System/Time/Clock/Scale.hs @@ -21,6 +21,8 @@ type ModJulianDay = Integer type ModJulianDate = Rational -- | This is a length of time, as measured by a clock. +-- Conversion functions will treat it as seconds. +-- It has an accuracy of 10^-12 s. newtype DiffTime = MkDiffTime Pico deriving (Eq,Ord) instance Enum DiffTime where diff --git a/System/Time/Clock/UTC.hs b/System/Time/Clock/UTC.hs index 3c59fdd..1cdf8d2 100644 --- a/System/Time/Clock/UTC.hs +++ b/System/Time/Clock/UTC.hs @@ -39,6 +39,8 @@ instance Ord UTCTime where cmp -> cmp -- | This is a length of time, as measured by UTC. +-- Conversion functions will treat it as seconds. +-- It has an accuracy of 10^-12 s. -- It ignores leap-seconds, so it's not necessarily a fixed amount of clock time. -- For instance, 23:00 UTC + 2 hours of UTCDiffTime = 01:00 UTC (+ 1 day), -- regardless of whether a leap-second intervened. From git at git.haskell.org Mon Feb 20 21:08:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:08:52 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: rename ISOWeek to ISOWeekDay (3ccb9bf) Message-ID: <20170220210852.722A03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/3ccb9bf252051f8207e2726c51d843bc2e0457da >--------------------------------------------------------------- commit 3ccb9bf252051f8207e2726c51d843bc2e0457da Author: Ashley Yakeley Date: Fri Jul 8 04:29:01 2005 -0700 rename ISOWeek to ISOWeekDay darcs-hash:20050708112901-ac6dd-0a17d5e4667c94e263e72102946669ee9ae85fbe >--------------------------------------------------------------- 3ccb9bf252051f8207e2726c51d843bc2e0457da Makefile | 14 +++++++------- System/Time/Calendar.hs | 4 ++-- System/Time/Calendar/Format.hs | 6 +++--- System/Time/Calendar/{ISOWeek.hs => ISOWeekDay.hs} | 16 ++++++++-------- TimeLib.cabal | 2 +- TimeLib.xcodeproj/project.pbxproj | 4 ++-- test/ConvertBack.hs | 2 +- 7 files changed, 24 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 3ccb9bf252051f8207e2726c51d843bc2e0457da From git at git.haskell.org Mon Feb 20 21:08:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:08:54 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Separate out DayEncoding into Days.hs (0fdf95f) Message-ID: <20170220210854.7ACC93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/0fdf95fc5443c0fde004ce4b78714149c6bcad49 >--------------------------------------------------------------- commit 0fdf95fc5443c0fde004ce4b78714149c6bcad49 Author: Ashley Yakeley Date: Sun Jul 10 05:03:45 2005 -0700 Separate out DayEncoding into Days.hs darcs-hash:20050710120345-ac6dd-59f2e7e97354dd8b99ee92c3d5aebac00ce2b806 >--------------------------------------------------------------- 0fdf95fc5443c0fde004ce4b78714149c6bcad49 Makefile | 42 ++++++++++++++++++++++---------------- System/Time/Calendar.hs | 14 +++++++------ System/Time/Calendar/Calendar.hs | 15 ++------------ System/Time/Calendar/Days.hs | 22 ++++++++++++++++++++ System/Time/Calendar/Format.hs | 1 + System/Time/Calendar/Gregorian.hs | 2 +- System/Time/Calendar/ISOWeekDay.hs | 2 +- System/Time/Calendar/YearDay.hs | 2 +- TimeLib.cabal | 23 ++++++++++++++++++--- TimeLib.xcodeproj/project.pbxproj | 10 +++++---- 10 files changed, 86 insertions(+), 47 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 0fdf95fc5443c0fde004ce4b78714149c6bcad49 From git at git.haskell.org Mon Feb 20 21:08:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:08:56 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Major simplification of calendar types (3cec8f8) Message-ID: <20170220210856.830653A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/3cec8f830b4bf234ccc317bd44aedb5baad2f50b >--------------------------------------------------------------- commit 3cec8f830b4bf234ccc317bd44aedb5baad2f50b Author: Ashley Yakeley Date: Wed Aug 3 17:51:41 2005 -0700 Major simplification of calendar types darcs-hash:20050804005141-ac6dd-b0b617b54ea958834c74238d9096231534661cc8 >--------------------------------------------------------------- 3cec8f830b4bf234ccc317bd44aedb5baad2f50b Makefile | 9 ++--- System/Time/Calendar.hs | 12 ++---- System/Time/Calendar/Calendar.hs | 75 ++++++++++++++++++++------------------ System/Time/Calendar/Days.hs | 53 +++++++++++++++++++++------ System/Time/Calendar/Format.hs | 49 ++++++++++--------------- System/Time/Calendar/Gregorian.hs | 39 ++++++++++---------- System/Time/Calendar/ISOWeekDay.hs | 45 ++++++++++------------- System/Time/Calendar/YearDay.hs | 61 +++++++++++++++---------------- System/Time/Clock/Scale.hs | 8 ++-- System/Time/Clock/UTC.hs | 11 +++--- System/Time/TAI.hs | 9 +++-- TimeLib.xcodeproj/project.pbxproj | 4 +- test/ConvertBack.hs | 26 ++++++------- test/CurrentTime.hs | 4 +- test/ShowDST.hs | 6 +-- test/TestFormat.hs | 14 +++---- test/TestTime.hs | 33 +++++++++-------- 17 files changed, 232 insertions(+), 226 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 3cec8f830b4bf234ccc317bd44aedb5baad2f50b From git at git.haskell.org Mon Feb 20 21:08:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:08:58 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: move from System to Data (64ab015) Message-ID: <20170220210858.8E0CC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/64ab015da821a8b9a43721683be81c8dae4e319b >--------------------------------------------------------------- commit 64ab015da821a8b9a43721683be81c8dae4e319b Author: Ashley Yakeley Date: Wed Aug 3 21:56:18 2005 -0700 move from System to Data darcs-hash:20050804045618-ac6dd-17cb2c59d50efd7409c0cad1a5a6afbfafffdb19 >--------------------------------------------------------------- 64ab015da821a8b9a43721683be81c8dae4e319b {System => Data}/Time/Calendar.hs | 40 +++---- {System => Data}/Time/Calendar/Calendar.hs | 12 +- {System => Data}/Time/Calendar/Days.hs | 2 +- {System => Data}/Time/Calendar/Format.hs | 24 ++-- {System => Data}/Time/Calendar/Gregorian.hs | 8 +- {System => Data}/Time/Calendar/ISOWeekDay.hs | 10 +- {System => Data}/Time/Calendar/Private.hs | 2 +- {System => Data}/Time/Calendar/TimeOfDay.hs | 8 +- {System => Data}/Time/Calendar/Timezone.hs | 8 +- {System => Data}/Time/Calendar/YearDay.hs | 8 +- Data/Time/Clock.hs | 13 +++ {System => Data}/Time/Clock/Current.hs | 4 +- {System => Data}/Time/Clock/POSIX.hs | 4 +- {System => Data}/Time/Clock/Scale.hs | 2 +- {System => Data}/Time/Clock/UTC.hs | 6 +- {System => Data}/Time/TAI.hs | 6 +- Makefile | 164 +++++++++++++-------------- System/Time/Clock.hs | 13 --- TimeLib.cabal | 32 +++--- TimeLib.xcodeproj/project.pbxproj | 5 +- test/ConvertBack.hs | 2 +- test/CurrentTime.hs | 6 +- test/ShowDST.hs | 4 +- test/TestFormat.hs | 6 +- test/TestTime.hs | 4 +- test/TimeZone.hs | 4 +- 26 files changed, 198 insertions(+), 199 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 64ab015da821a8b9a43721683be81c8dae4e319b From git at git.haskell.org Mon Feb 20 21:09:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:09:00 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: correct showing of years before 1000 CE, with test (869ebcc) Message-ID: <20170220210900.967043A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/869ebcc990f261502b5121373cbd6c689ac6e954 >--------------------------------------------------------------- commit 869ebcc990f261502b5121373cbd6c689ac6e954 Author: Ashley Yakeley Date: Wed Aug 3 23:27:38 2005 -0700 correct showing of years before 1000 CE, with test darcs-hash:20050804062738-ac6dd-b4c6228b0b4847944ef83f880cfa977035c1ea5c >--------------------------------------------------------------- 869ebcc990f261502b5121373cbd6c689ac6e954 Data/Time/Calendar/Format.hs | 6 +- Data/Time/Calendar/Gregorian.hs | 2 +- Data/Time/Calendar/ISOWeekDay.hs | 2 +- Data/Time/Calendar/Private.hs | 17 +- Data/Time/Calendar/YearDay.hs | 2 +- test/TestTime.hs | 9 +- test/TestTime.ref | 1612 ++++++++++++++++++++------------------ 7 files changed, 884 insertions(+), 766 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 869ebcc990f261502b5121373cbd6c689ac6e954 From git at git.haskell.org Mon Feb 20 21:09:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:09:02 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: clip incorrect values in converters, with tests (b107508) Message-ID: <20170220210902.A04633A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/b107508b2e78edf6ba7b42b5e9cbd6247ed1dc7c >--------------------------------------------------------------- commit b107508b2e78edf6ba7b42b5e9cbd6247ed1dc7c Author: Ashley Yakeley Date: Fri Aug 5 23:01:28 2005 -0700 clip incorrect values in converters, with tests darcs-hash:20050806060128-ac6dd-bbc8cb9b16607d205fcf9b10a927e23c33a971e1 >--------------------------------------------------------------- b107508b2e78edf6ba7b42b5e9cbd6247ed1dc7c Data/Time/Calendar/Gregorian.hs | 10 +- Data/Time/Calendar/ISOWeekDay.hs | 13 +- Data/Time/Calendar/Private.hs | 5 + Data/Time/Calendar/YearDay.hs | 2 +- TimeLib.xcodeproj/project.pbxproj | 8 + test/ClipDates.hs | 24 ++ test/ClipDates.ref | 561 ++++++++++++++++++++++++++++++++++++++ test/LongWeekYears.hs | 17 ++ test/LongWeekYears.ref | 150 ++++++++++ test/Makefile | 8 +- 10 files changed, 787 insertions(+), 11 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 b107508b2e78edf6ba7b42b5e9cbd6247ed1dc7c From git at git.haskell.org Mon Feb 20 21:09:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:09:04 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: new gregorianMonthLength function (cfab0ea) Message-ID: <20170220210904.A74C63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/cfab0ea8c8107f76745a3bde61519b6bdd46c539 >--------------------------------------------------------------- commit cfab0ea8c8107f76745a3bde61519b6bdd46c539 Author: Ashley Yakeley Date: Sat Aug 6 13:38:12 2005 -0700 new gregorianMonthLength function darcs-hash:20050806203812-ac6dd-9110023cbd93ef6501f65be4439cac6093c372c9 >--------------------------------------------------------------- cfab0ea8c8107f76745a3bde61519b6bdd46c539 Data/Time/Calendar/Gregorian.hs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Data/Time/Calendar/Gregorian.hs b/Data/Time/Calendar/Gregorian.hs index 74b1435..9e83440 100644 --- a/Data/Time/Calendar/Gregorian.hs +++ b/Data/Time/Calendar/Gregorian.hs @@ -4,7 +4,7 @@ module Data.Time.Calendar.Gregorian ( -- * Gregorian calendar - gregorian,fromGregorian,showGregorian + gregorian,fromGregorian,showGregorian,gregorianMonthLength -- calendrical arithmetic -- e.g. "one month after March 31st" @@ -22,13 +22,13 @@ gregorian date = (year,month,day) where fromGregorian :: Integer -> Int -> Int -> Date -- formula from fromGregorian year month day = ModJulianDay - ((fromIntegral (clip 1 monthLength day)) + (div (153 * m + 2) 5) + (365 * y) + (div y 4) - (div y 100) + (div y 400) - 678882) where + (day' + (div (153 * m + 2) 5) + (365 * y) + (div y 4) - (div y 100) + (div y 400) - 678882) where month' = clip 1 12 month month'' = fromIntegral month' a = div (14 - month'') 12 y = year - a m = month'' + (12 * a) - 3 - monthLength = (monthLengths (isLeapYear year)) !! (month' - 1) + day' = fromIntegral (clip 1 (gregorianMonthLength' year month') day) showGregorian :: Date -> String showGregorian date = (show4 y) ++ "-" ++ (show2 m) ++ "-" ++ (show2 d) where @@ -38,6 +38,13 @@ findMonthDay :: [Int] -> Int -> (Int,Int) findMonthDay (n:ns) yd | yd > n = (\(m,d) -> (m + 1,d)) (findMonthDay ns (yd - n)) findMonthDay _ yd = (1,yd) +gregorianMonthLength' :: Integer -> Int -> Int +gregorianMonthLength' year month' = (monthLengths (isLeapYear year)) !! (month' - 1) + +-- | The number of days in a given month according to the proleptic Gregorian calendar. First argument is year, second is month. +gregorianMonthLength :: Integer -> Int -> Int +gregorianMonthLength year month = gregorianMonthLength' year (clip 1 12 month) + monthLengths :: Bool -> [Int] monthLengths isleap = [31,if isleap then 29 else 28,31,30,31,30,31,31,30,31,30,31] From git at git.haskell.org Mon Feb 20 21:09:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:09:06 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: conversion documentation (c2ff391) Message-ID: <20170220210906.AE3F13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/c2ff391a8786ebeba2e6574634ddc7d70e039822 >--------------------------------------------------------------- commit c2ff391a8786ebeba2e6574634ddc7d70e039822 Author: Ashley Yakeley Date: Sat Aug 6 13:42:34 2005 -0700 conversion documentation darcs-hash:20050806204234-ac6dd-6b698b3ab0328723f4da2ca9f22000b8792cbee8 >--------------------------------------------------------------- c2ff391a8786ebeba2e6574634ddc7d70e039822 Data/Time/Calendar/Gregorian.hs | 4 ++++ Data/Time/Calendar/ISOWeekDay.hs | 7 ++++++- Data/Time/Calendar/YearDay.hs | 7 ++++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Data/Time/Calendar/Gregorian.hs b/Data/Time/Calendar/Gregorian.hs index 9e83440..3312b29 100644 --- a/Data/Time/Calendar/Gregorian.hs +++ b/Data/Time/Calendar/Gregorian.hs @@ -14,11 +14,14 @@ import Data.Time.Calendar.YearDay import Data.Time.Calendar.Days import Data.Time.Calendar.Private +-- | convert to proleptic Gregorian calendar. First element of result is year, second month number (1-12), third day (1-31). gregorian :: Date -> (Integer,Int,Int) gregorian date = (year,month,day) where (year,yd) = yearAndDay date (month,day) = findMonthDay (monthLengths (isLeapYear year)) yd +-- | convert from proleptic Gregorian calendar. First argument is year, second month number (1-12), third day (1-31). +-- Invalid values will be clipped to the correct range, month first, then day. fromGregorian :: Integer -> Int -> Int -> Date -- formula from fromGregorian year month day = ModJulianDay @@ -30,6 +33,7 @@ fromGregorian year month day = ModJulianDay m = month'' + (12 * a) - 3 day' = fromIntegral (clip 1 (gregorianMonthLength' year month') day) +-- | show in ISO 8601 format (yyyy-mm-dd) showGregorian :: Date -> String showGregorian date = (show4 y) ++ "-" ++ (show2 m) ++ "-" ++ (show2 d) where (y,m,d) = gregorian date diff --git a/Data/Time/Calendar/ISOWeekDay.hs b/Data/Time/Calendar/ISOWeekDay.hs index 2dbd7e9..0c23495 100644 --- a/Data/Time/Calendar/ISOWeekDay.hs +++ b/Data/Time/Calendar/ISOWeekDay.hs @@ -3,7 +3,7 @@ -- #hide module Data.Time.Calendar.ISOWeekDay ( - -- * ISO Week calendar + -- * ISO 8601 Week calendar module Data.Time.Calendar.ISOWeekDay ) where @@ -11,6 +11,9 @@ import Data.Time.Calendar.YearDay import Data.Time.Calendar.Days import Data.Time.Calendar.Private +-- | convert to ISO 8601 Week format. First element of result is year, second week number (1-53), third day of week (1 for Monday to 7 for Sunday). +-- Note that "Week" years are not quite the same as Gregorian years, as the first day of the year is always a Monday. +-- The first week of a year is the first week to contain at least four days in the corresponding Gregorian year. isoWeekDay :: Date -> (Integer,Int,Int) isoWeekDay date@(ModJulianDay mjd) = (y1,fromInteger (w1 + 1),fromInteger (mod d 7) + 1) where (y0,yd) = yearAndDay date @@ -27,6 +30,7 @@ isoWeekDay date@(ModJulianDay mjd) = (y1,fromInteger (w1 + 1),fromInteger (mod d else (y0,w0) else (y0,w0) +-- | convert from ISO 8601 Week format. First argument is year, second week number (1-53), third day of week (1 for Monday to 7 for Sunday). fromISOWeekDay :: Integer -> Int -> Int -> Date fromISOWeekDay y w d = ModJulianDay (k - (mod k 7) + (toInteger (((clip 1 (if longYear then 53 else 52) w) * 7) + (clip 1 7 d))) - 10) where k = getModJulianDay (fromYearAndDay y 6) @@ -34,6 +38,7 @@ fromISOWeekDay y w d = ModJulianDay (k - (mod k 7) + (toInteger (((clip 1 (if lo (_,53,_) -> True _ -> False +-- | show in ISO 8601 Week format as yyyy-Www-dd (e.g. showISOWeekDay :: Date -> String showISOWeekDay date = (show4 y) ++ "-W" ++ (show2 w) ++ "-" ++ (show d) where (y,w,d) = isoWeekDay date diff --git a/Data/Time/Calendar/YearDay.hs b/Data/Time/Calendar/YearDay.hs index 6b8790a..68fe0da 100644 --- a/Data/Time/Calendar/YearDay.hs +++ b/Data/Time/Calendar/YearDay.hs @@ -10,6 +10,8 @@ module Data.Time.Calendar.YearDay import Data.Time.Calendar.Days import Data.Time.Calendar.Private +-- | convert to ISO 8601 Ordinal Date format. First element of result is year (proleptic Gregoran calendar), +-- second is the day of the year, with 1 for Jan 1, and 365 (or 366 in leap years) for Dec 31. yearAndDay :: Date -> (Integer,Int) yearAndDay (ModJulianDay mjd) = (year,yd) where a = mjd + 678575 @@ -23,16 +25,19 @@ yearAndDay (ModJulianDay mjd) = (year,yd) where yd = fromInteger (d - (y * 365) + 1) year = quadcent * 400 + cent * 100 + quad * 4 + y + 1 +-- | convert from ISO 8601 Ordinal Date format. +-- Invalid day numbers will be clipped to the correct range (1 to 365 or 366). fromYearAndDay :: Integer -> Int -> Date fromYearAndDay year day = ModJulianDay mjd where y = year - 1 mjd = (fromIntegral (clip 1 (if isLeapYear year then 366 else 365) day)) + (div (1532) 5) + (365 * y) + (div y 4) - (div y 100) + (div y 400) - 678882 --- | ISO 8601 Ordinal Date +-- | show in ISO 8601 Ordinal Date format (yyyy-ddd) showYearAndDay :: Date -> String showYearAndDay date = (show4 y) ++ "-" ++ (show3 d) where (y,d) = yearAndDay date +-- | Is this year a leap year according to the propleptic Gregorian calendar? isLeapYear :: Integer -> Bool isLeapYear year = (mod year 4 == 0) && ((mod year 400 == 0) || not (mod year 100 == 0)) From git at git.haskell.org Mon Feb 20 21:09:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:09:08 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: more time doc (8cea925) Message-ID: <20170220210908.B4F353A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/8cea925e57e0498cab65f7d92e1aef6fc84e1d07 >--------------------------------------------------------------- commit 8cea925e57e0498cab65f7d92e1aef6fc84e1d07 Author: Ashley Yakeley Date: Sat Aug 6 14:03:50 2005 -0700 more time doc darcs-hash:20050806210350-ac6dd-137bddea624190e5df0f8db7b5eaf47662da1d26 >--------------------------------------------------------------- 8cea925e57e0498cab65f7d92e1aef6fc84e1d07 Data/Time/Calendar/ISOWeekDay.hs | 3 ++- Data/Time/Calendar/TimeOfDay.hs | 6 ++++++ Data/Time/Calendar/Timezone.hs | 8 +++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Data/Time/Calendar/ISOWeekDay.hs b/Data/Time/Calendar/ISOWeekDay.hs index 0c23495..ea6522b 100644 --- a/Data/Time/Calendar/ISOWeekDay.hs +++ b/Data/Time/Calendar/ISOWeekDay.hs @@ -30,7 +30,8 @@ isoWeekDay date@(ModJulianDay mjd) = (y1,fromInteger (w1 + 1),fromInteger (mod d else (y0,w0) else (y0,w0) --- | convert from ISO 8601 Week format. First argument is year, second week number (1-53), third day of week (1 for Monday to 7 for Sunday). +-- | convert from ISO 8601 Week format. First argument is year, second week number (1-52 or 53), third day of week (1 for Monday to 7 for Sunday). +-- Invalid week and day values will be clipped to the correct range. fromISOWeekDay :: Integer -> Int -> Int -> Date fromISOWeekDay y w d = ModJulianDay (k - (mod k 7) + (toInteger (((clip 1 (if longYear then 53 else 52) w) * 7) + (clip 1 7 d))) - 10) where k = getModJulianDay (fromYearAndDay y 6) diff --git a/Data/Time/Calendar/TimeOfDay.hs b/Data/Time/Calendar/TimeOfDay.hs index b064048..c8598c2 100644 --- a/Data/Time/Calendar/TimeOfDay.hs +++ b/Data/Time/Calendar/TimeOfDay.hs @@ -17,14 +17,20 @@ import Data.Fixed -- | Time of day as represented in hour, minute and second (with picoseconds), typically used to express local time of day. data TimeOfDay = TimeOfDay { + -- | range 0 - 23 todHour :: Int, + -- | range 0 - 59 todMin :: Int, + -- | Note that 0 <= todSec < 61, accomodating leap seconds. + -- Any local minute may have a leap second, since leap seconds happen in all zones simultaneously todSec :: Pico } deriving (Eq,Ord) +-- | Hour zero midnight :: TimeOfDay midnight = TimeOfDay 0 0 0 +-- | Hour twelve midday :: TimeOfDay midday = TimeOfDay 12 0 0 diff --git a/Data/Time/Calendar/Timezone.hs b/Data/Time/Calendar/Timezone.hs index 525b91b..f2b3ea6 100644 --- a/Data/Time/Calendar/Timezone.hs +++ b/Data/Time/Calendar/Timezone.hs @@ -18,22 +18,28 @@ import Data.Time.Clock.POSIX import Foreign import Foreign.C --- | count of minutes +-- | A Timezone is a whole number of minutes offset from UTC, together with a name and a "just for summer" flag. data Timezone = MkTimezone { + -- | The number of minutes offset from UTC. Positive means local time will be later in the day than UTC. timezoneMinutes :: Int, + -- | Is this time zone just persisting for the summer? timezoneDST :: Bool, + -- | The name of the zone, typically a three- or four-letter acronym. timezoneName :: String } deriving (Eq,Ord) +-- | Create a nameless non-summer timezone for this number of minutes minutesToTimezone :: Int -> Timezone minutesToTimezone m = MkTimezone m False "" +-- | Create a nameless non-summer timezone for this number of hours hoursToTimezone :: Int -> Timezone hoursToTimezone i = minutesToTimezone (60 * i) showT :: Int -> String showT t = (show2 (div t 60)) ++ (show2 (mod t 60)) +-- | Text representing the offset of this timezone, such as \"-0800\" or \"+0400\" (like %z in formatTime) timezoneOffsetString :: Timezone -> String timezoneOffsetString (MkTimezone t _ _) | t < 0 = '-':(showT (negate t)) timezoneOffsetString (MkTimezone t _ _) = '+':(showT t) From git at git.haskell.org Mon Feb 20 21:09:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:09:10 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: rename names in Data.Time.Calendar.Calendar (f35dd9e) Message-ID: <20170220210910.BC8563A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/f35dd9eab042ed2dc568555ffb131b1b8a08d264 >--------------------------------------------------------------- commit f35dd9eab042ed2dc568555ffb131b1b8a08d264 Author: Ashley Yakeley Date: Sat Aug 6 14:38:39 2005 -0700 rename names in Data.Time.Calendar.Calendar darcs-hash:20050806213839-ac6dd-24d6c932075fefea6d82a558b809686ce68757bb >--------------------------------------------------------------- f35dd9eab042ed2dc568555ffb131b1b8a08d264 Data/Time/Calendar.hs | 12 +++++----- Data/Time/Calendar/Calendar.hs | 52 +++++++++++++++++++++--------------------- Data/Time/Calendar/Format.hs | 12 +++++----- test/CurrentTime.hs | 4 ++-- test/ShowDST.hs | 8 +++---- test/TestFormat.hs | 14 ++++++------ test/TestTime.hs | 22 +++++++++--------- 7 files 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 f35dd9eab042ed2dc568555ffb131b1b8a08d264 From git at git.haskell.org Mon Feb 20 21:09:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:09:12 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: reorg modules with new LocalTime hier (ce92c8a) Message-ID: <20170220210912.C74BC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/ce92c8a5ab39a42df4742655bd8d544e1d376e4c >--------------------------------------------------------------- commit ce92c8a5ab39a42df4742655bd8d544e1d376e4c Author: Ashley Yakeley Date: Sat Aug 6 15:46:20 2005 -0700 reorg modules with new LocalTime hier darcs-hash:20050806224620-ac6dd-662c819750a100ceb819d242dac41751d74c0154 >--------------------------------------------------------------- ce92c8a5ab39a42df4742655bd8d544e1d376e4c Data/Time/Calendar.hs | 44 +------------ Data/Time/{Calendar => LocalTime}/Format.hs | 10 +-- .../Calendar.hs => LocalTime/LocalTime.hs} | 11 ++-- Data/Time/{Calendar => LocalTime}/TimeOfDay.hs | 4 +- Data/Time/{Calendar => LocalTime}/Timezone.hs | 2 +- Makefile | 77 ++++++++++++---------- TimeLib.xcodeproj/project.pbxproj | 18 ++++- test/CurrentTime.hs | 6 +- test/ShowDST.hs | 5 +- test/TestFixed.hs | 2 + test/TestFormat.hs | 3 +- test/TestTime.hs | 3 +- test/TimeZone.hs | 5 +- 13 files changed, 84 insertions(+), 106 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 ce92c8a5ab39a42df4742655bd8d544e1d376e4c From git at git.haskell.org Mon Feb 20 21:09:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:09:14 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Timezone -> TimeZone (3db5c8e) Message-ID: <20170220210914.D18563A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/3db5c8e08b16fd9d39dd829787c3a8d659f7d371 >--------------------------------------------------------------- commit 3db5c8e08b16fd9d39dd829787c3a8d659f7d371 Author: Ashley Yakeley Date: Sat Aug 6 16:16:46 2005 -0700 Timezone -> TimeZone darcs-hash:20050806231646-ac6dd-d82ec74508635fa1210768b6ae3a6e0ae360602c >--------------------------------------------------------------- 3db5c8e08b16fd9d39dd829787c3a8d659f7d371 Data/Time/LocalTime/Format.hs | 8 ++-- Data/Time/LocalTime/LocalTime.hs | 14 +++---- Data/Time/LocalTime/TimeOfDay.hs | 10 ++--- Data/Time/LocalTime/{Timezone.hs => TimeZone.hs} | 50 ++++++++++++------------ Makefile | 18 ++++----- TimeLib.xcodeproj/project.pbxproj | 4 +- test/CurrentTime.hs | 2 +- test/ShowDST.hs | 14 +++---- test/TestFormat.hs | 14 +++---- test/TestTime.hs | 4 +- test/TimeZone.hs | 4 +- 11 files changed, 71 insertions(+), 71 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 3db5c8e08b16fd9d39dd829787c3a8d659f7d371 From git at git.haskell.org Mon Feb 20 21:09:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:09:16 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: fix TimeLib.cabal (aba753e) Message-ID: <20170220210916.D87843A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/aba753e95dbc55cf87493fb05960bba36841e83f >--------------------------------------------------------------- commit aba753e95dbc55cf87493fb05960bba36841e83f Author: Ashley Yakeley Date: Sat Aug 6 16:25:16 2005 -0700 fix TimeLib.cabal darcs-hash:20050806232516-ac6dd-75b60635df2f90092b75e60e72ae17fc9e47e5ff >--------------------------------------------------------------- aba753e95dbc55cf87493fb05960bba36841e83f TimeLib.cabal | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/TimeLib.cabal b/TimeLib.cabal index 42ad145..ec8e9ad 100644 --- a/TimeLib.cabal +++ b/TimeLib.cabal @@ -11,22 +11,24 @@ Build-Depends: base Synopsis: a new time library Exposed-modules: Data.Fixed, + Data.Time.Calendar, Data.Time.Clock, Data.Time.TAI, - Data.Time.Calendar + Data.Time.LocalTime, + Data.Time Extensions: ForeignFunctionInterface C-Sources: timestuff.c Other-modules: - Data.Time.Clock.Scale, - Data.Time.Clock.UTC, - Data.Time.Clock.POSIX, - Data.Time.Clock.Current, Data.Time.Calendar.Private, Data.Time.Calendar.Days, - Data.Time.Calendar.Calendar, + Data.Time.Calendar.YearDay, Data.Time.Calendar.Gregorian, Data.Time.Calendar.ISOWeekDay, - Data.Time.Calendar.Format, - Data.Time.Calendar.YearDay, - Data.Time.Calendar.Timezone, - Data.Time.Calendar.TimeOfDay + Data.Time.Clock.Scale, + Data.Time.Clock.UTC, + Data.Time.Clock.POSIX, + Data.Time.Clock.Current, + Data.Time.LocalTime.TimeZone, + Data.Time.LocalTime.TimeOfDay, + Data.Time.LocalTime.LocalTime, + Data.Time.LocalTime.Format From git at git.haskell.org Mon Feb 20 21:09:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:09:18 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: tiny doc fix (e2b7e0f) Message-ID: <20170220210918.DFBCC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/e2b7e0f591aef5258142d3c739579b46c01efe8e >--------------------------------------------------------------- commit e2b7e0f591aef5258142d3c739579b46c01efe8e Author: Ashley Yakeley Date: Sat Aug 6 21:15:05 2005 -0700 tiny doc fix darcs-hash:20050807041505-ac6dd-5ab2844a54039f56f193821ca76a567683bacff9 >--------------------------------------------------------------- e2b7e0f591aef5258142d3c739579b46c01efe8e Data/Time/LocalTime/TimeZone.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Data/Time/LocalTime/TimeZone.hs b/Data/Time/LocalTime/TimeZone.hs index f784e8e..b9a8978 100644 --- a/Data/Time/LocalTime/TimeZone.hs +++ b/Data/Time/LocalTime/TimeZone.hs @@ -18,7 +18,7 @@ import Data.Time.Clock.POSIX import Foreign import Foreign.C --- | A TimeZone is a whole number of minutes offset from UTC, together with a name and a "just for summer" flag. +-- | A TimeZone is a whole number of minutes offset from UTC, together with a name and a \"just for summer\" flag. data TimeZone = TimeZone { -- | The number of minutes offset from UTC. Positive means local time will be later in the day than UTC. timeZoneMinutes :: Int, From git at git.haskell.org Mon Feb 20 21:09:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:09:20 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: rename to-converter functions (f783b6b) Message-ID: <20170220210920.E6AC43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/f783b6b6042d26c7ac76763f5020e244dd9198c4 >--------------------------------------------------------------- commit f783b6b6042d26c7ac76763f5020e244dd9198c4 Author: Ashley Yakeley Date: Sat Aug 6 21:24:37 2005 -0700 rename to-converter functions darcs-hash:20050807042437-ac6dd-5ab571d0bdb5d64ffd32ba244050f48734dfe313 >--------------------------------------------------------------- f783b6b6042d26c7ac76763f5020e244dd9198c4 Data/Time/Calendar/Gregorian.hs | 10 +++++----- Data/Time/Calendar/ISOWeekDay.hs | 10 +++++----- Data/Time/Calendar/YearDay.hs | 10 +++++----- Data/Time/LocalTime/Format.hs | 28 ++++++++++++++-------------- test/ConvertBack.hs | 6 +++--- test/LongWeekYears.hs | 2 +- test/ShowDST.hs | 2 +- test/TestTime.hs | 2 +- 8 files changed, 35 insertions(+), 35 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 f783b6b6042d26c7ac76763f5020e244dd9198c4 From git at git.haskell.org Mon Feb 20 21:09:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:09:22 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: rename Date to Day (9c5fedd) Message-ID: <20170220210922.EF8FE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/9c5fedd97c9b3b9119f0b6c6aa302c361c7c8222 >--------------------------------------------------------------- commit 9c5fedd97c9b3b9119f0b6c6aa302c361c7c8222 Author: Ashley Yakeley Date: Sat Aug 6 22:05:37 2005 -0700 rename Date to Day darcs-hash:20050807050537-ac6dd-a7752f2f5fb0d5a80c5a9e16439635f62d7c3699 >--------------------------------------------------------------- 9c5fedd97c9b3b9119f0b6c6aa302c361c7c8222 Data/Time/Calendar/Days.hs | 68 ++++++++++++++++++++-------------------- Data/Time/Calendar/Gregorian.hs | 10 +++--- Data/Time/Calendar/ISOWeekDay.hs | 14 ++++----- Data/Time/Calendar/YearDay.hs | 24 +++++++------- Data/Time/Clock/UTC.hs | 10 +++--- Data/Time/LocalTime/Format.hs | 2 +- Data/Time/LocalTime/LocalTime.hs | 10 +++--- Data/Time/TAI.hs | 8 ++--- test/ConvertBack.hs | 10 +++--- test/TestTime.hs | 6 ++-- 10 files changed, 81 insertions(+), 81 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 9c5fedd97c9b3b9119f0b6c6aa302c361c7c8222 From git at git.haskell.org Mon Feb 20 21:09:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:09:25 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: reorder modules in Makefile (bbbc983) Message-ID: <20170220210925.0168D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/bbbc983c7cc720e9c9d1a5fa60b4761359b29600 >--------------------------------------------------------------- commit bbbc983c7cc720e9c9d1a5fa60b4761359b29600 Author: Ashley Yakeley Date: Sun Aug 7 01:27:33 2005 -0700 reorder modules in Makefile darcs-hash:20050807082733-ac6dd-52df8b71fa34fa635f3c55ac1b3bdab293234355 >--------------------------------------------------------------- bbbc983c7cc720e9c9d1a5fa60b4761359b29600 Data/Time/LocalTime/TimeOfDay.hs | 2 +- Makefile | 46 ++++++++++++++++++++-------------------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/Data/Time/LocalTime/TimeOfDay.hs b/Data/Time/LocalTime/TimeOfDay.hs index d59919c..a4646cf 100644 --- a/Data/Time/LocalTime/TimeOfDay.hs +++ b/Data/Time/LocalTime/TimeOfDay.hs @@ -51,7 +51,7 @@ posixDay :: DiffTime posixDay = fromInteger 86400 -- | Get a TimeOfDay given a time since midnight. --- | Time more than 24h will be converted to leap-seconds. +-- Time more than 24h will be converted to leap-seconds. timeToTimeOfDay :: DiffTime -> TimeOfDay timeToTimeOfDay dt | dt >= posixDay = TimeOfDay 23 59 (60 + (realToFrac (dt - posixDay))) timeToTimeOfDay dt = TimeOfDay (fromInteger h) (fromInteger m) s where diff --git a/Makefile b/Makefile index cdee40c..95d5dc7 100644 --- a/Makefile +++ b/Makefile @@ -9,18 +9,18 @@ cleantest: cd test && make clean SRCS = Data/Fixed.hs \ - Data/Time/Clock/Scale.hs \ - Data/Time/Clock/UTC.hs \ - Data/Time/Clock/POSIX.hs \ - Data/Time/Clock/Current.hs \ - Data/Time/Clock.hs \ - Data/Time/TAI.hs \ Data/Time/Calendar/Private.hs \ Data/Time/Calendar/Days.hs \ Data/Time/Calendar/YearDay.hs \ Data/Time/Calendar/Gregorian.hs \ Data/Time/Calendar/ISOWeekDay.hs \ Data/Time/Calendar.hs \ + Data/Time/Clock/Scale.hs \ + Data/Time/Clock/UTC.hs \ + Data/Time/Clock/POSIX.hs \ + Data/Time/Clock/Current.hs \ + Data/Time/Clock.hs \ + Data/Time/TAI.hs \ Data/Time/LocalTime/TimeZone.hs \ Data/Time/LocalTime/TimeOfDay.hs \ Data/Time/LocalTime/LocalTime.hs \ @@ -81,23 +81,6 @@ TestFixed.o: Data/Fixed.hi # DO NOT DELETE: Beginning of Haskell dependencies Data/Time/Calendar/Days.o : Data/Time/Calendar/Days.hs Data/Fixed.o : Data/Fixed.hs -Data/Time/Clock/Scale.o : Data/Time/Clock/Scale.hs -Data/Time/Clock/Scale.o : Data/Fixed.hi -Data/Time/Clock/UTC.o : Data/Time/Clock/UTC.hs -Data/Time/Clock/UTC.o : Data/Fixed.hi -Data/Time/Clock/UTC.o : Data/Time/Clock/Scale.hi -Data/Time/Clock/UTC.o : Data/Time/Calendar/Days.hi -Data/Time/Clock/POSIX.o : Data/Time/Clock/POSIX.hs -Data/Time/Clock/POSIX.o : Data/Time/Clock/UTC.hi -Data/Time/Clock/Current.o : Data/Time/Clock/Current.hs -Data/Time/Clock/Current.o : Data/Time/Clock/UTC.hi -Data/Time/Clock.o : Data/Time/Clock.hs -Data/Time/Clock.o : Data/Time/Clock/Current.hi -Data/Time/Clock.o : Data/Time/Clock/UTC.hi -Data/Time/Clock.o : Data/Time/Clock/Scale.hi -Data/Time/TAI.o : Data/Time/TAI.hs -Data/Time/TAI.o : Data/Time/Clock.hi -Data/Time/TAI.o : Data/Time/Calendar/Days.hi Data/Time/Calendar/Private.o : Data/Time/Calendar/Private.hs Data/Time/Calendar/Private.o : Data/Fixed.hi Data/Time/Calendar/YearDay.o : Data/Time/Calendar/YearDay.hs @@ -116,6 +99,23 @@ Data/Time/Calendar.o : Data/Time/Calendar/ISOWeekDay.hi Data/Time/Calendar.o : Data/Time/Calendar/Gregorian.hi Data/Time/Calendar.o : Data/Time/Calendar/YearDay.hi Data/Time/Calendar.o : Data/Time/Calendar/Days.hi +Data/Time/Clock/Scale.o : Data/Time/Clock/Scale.hs +Data/Time/Clock/Scale.o : Data/Fixed.hi +Data/Time/Clock/UTC.o : Data/Time/Clock/UTC.hs +Data/Time/Clock/UTC.o : Data/Fixed.hi +Data/Time/Clock/UTC.o : Data/Time/Clock/Scale.hi +Data/Time/Clock/UTC.o : Data/Time/Calendar/Days.hi +Data/Time/Clock/POSIX.o : Data/Time/Clock/POSIX.hs +Data/Time/Clock/POSIX.o : Data/Time/Clock/UTC.hi +Data/Time/Clock/Current.o : Data/Time/Clock/Current.hs +Data/Time/Clock/Current.o : Data/Time/Clock/UTC.hi +Data/Time/Clock.o : Data/Time/Clock.hs +Data/Time/Clock.o : Data/Time/Clock/Current.hi +Data/Time/Clock.o : Data/Time/Clock/UTC.hi +Data/Time/Clock.o : Data/Time/Clock/Scale.hi +Data/Time/TAI.o : Data/Time/TAI.hs +Data/Time/TAI.o : Data/Time/Clock.hi +Data/Time/TAI.o : Data/Time/Calendar/Days.hi Data/Time/LocalTime/TimeZone.o : Data/Time/LocalTime/TimeZone.hs Data/Time/LocalTime/TimeZone.o : Data/Time/Clock/POSIX.hi Data/Time/LocalTime/TimeZone.o : Data/Time/Clock.hi From git at git.haskell.org Mon Feb 20 21:09:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:09:27 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: add months (with test) (853190e) Message-ID: <20170220210927.0ACEB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/853190edc59e02e2b3bb8e1510372003c1931a11 >--------------------------------------------------------------- commit 853190edc59e02e2b3bb8e1510372003c1931a11 Author: Ashley Yakeley Date: Sun Aug 7 01:51:39 2005 -0700 add months (with test) darcs-hash:20050807085139-ac6dd-824564aeeffc6bfc7c57e76de6d2b1b3d653b293 >--------------------------------------------------------------- 853190edc59e02e2b3bb8e1510372003c1931a11 Data/Time/Calendar/Days.hs | 4 +- Data/Time/Calendar/Gregorian.hs | 41 ++++++- Data/Time/Clock/UTC.hs | 2 +- Data/Time/LocalTime/LocalTime.hs | 4 +- Data/Time/TAI.hs | 4 +- TimeLib.xcodeproj/project.pbxproj | 4 + test/AddDays.hs | 42 +++++++ test/AddDays.ref | 245 ++++++++++++++++++++++++++++++++++++++ test/Makefile | 5 +- 9 files changed, 337 insertions(+), 14 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 853190edc59e02e2b3bb8e1510372003c1931a11 From git at git.haskell.org Mon Feb 20 21:09:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:09:29 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: clean up deps (957955c) Message-ID: <20170220210929.114D63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/957955cbe73528d64b1ea8ba588ccda5dc799698 >--------------------------------------------------------------- commit 957955cbe73528d64b1ea8ba588ccda5dc799698 Author: Ashley Yakeley Date: Sun Aug 7 01:59:59 2005 -0700 clean up deps darcs-hash:20050807085959-ac6dd-d8e24b7b295204e276192302ff914792aec6e12c >--------------------------------------------------------------- 957955cbe73528d64b1ea8ba588ccda5dc799698 Data/Time/LocalTime/Format.hs | 5 +---- Data/Time/LocalTime/LocalTime.hs | 3 +-- Makefile | 8 ++------ 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/Data/Time/LocalTime/Format.hs b/Data/Time/LocalTime/Format.hs index 75cd91b..9e3385a 100644 --- a/Data/Time/LocalTime/Format.hs +++ b/Data/Time/LocalTime/Format.hs @@ -11,10 +11,7 @@ module Data.Time.LocalTime.Format import Data.Time.LocalTime.LocalTime import Data.Time.LocalTime.TimeOfDay import Data.Time.LocalTime.TimeZone -import Data.Time.Calendar.ISOWeekDay -import Data.Time.Calendar.Gregorian -import Data.Time.Calendar.YearDay -import Data.Time.Calendar.Days +import Data.Time.Calendar import Data.Time.Calendar.Private import Data.Time.Clock import Data.Time.Clock.POSIX diff --git a/Data/Time/LocalTime/LocalTime.hs b/Data/Time/LocalTime/LocalTime.hs index cbfb0d8..541a47b 100644 --- a/Data/Time/LocalTime/LocalTime.hs +++ b/Data/Time/LocalTime/LocalTime.hs @@ -14,8 +14,7 @@ module Data.Time.LocalTime.LocalTime import Data.Time.LocalTime.TimeOfDay import Data.Time.LocalTime.TimeZone -import Data.Time.Calendar.Gregorian -import Data.Time.Calendar.Days +import Data.Time.Calendar import Data.Time.Clock -- | A simple day and time aggregate, where the day is of the specified parameter, diff --git a/Makefile b/Makefile index 95d5dc7..218b096 100644 --- a/Makefile +++ b/Makefile @@ -127,18 +127,14 @@ Data/Time/LocalTime/TimeOfDay.o : Data/Time/Calendar/Private.hi Data/Time/LocalTime/TimeOfDay.o : Data/Time/LocalTime/TimeZone.hi Data/Time/LocalTime/LocalTime.o : Data/Time/LocalTime/LocalTime.hs Data/Time/LocalTime/LocalTime.o : Data/Time/Clock.hi -Data/Time/LocalTime/LocalTime.o : Data/Time/Calendar/Days.hi -Data/Time/LocalTime/LocalTime.o : Data/Time/Calendar/Gregorian.hi +Data/Time/LocalTime/LocalTime.o : Data/Time/Calendar.hi Data/Time/LocalTime/LocalTime.o : Data/Time/LocalTime/TimeZone.hi Data/Time/LocalTime/LocalTime.o : Data/Time/LocalTime/TimeOfDay.hi Data/Time/LocalTime/Format.o : Data/Time/LocalTime/Format.hs Data/Time/LocalTime/Format.o : Data/Time/Clock/POSIX.hi Data/Time/LocalTime/Format.o : Data/Time/Clock.hi Data/Time/LocalTime/Format.o : Data/Time/Calendar/Private.hi -Data/Time/LocalTime/Format.o : Data/Time/Calendar/Days.hi -Data/Time/LocalTime/Format.o : Data/Time/Calendar/YearDay.hi -Data/Time/LocalTime/Format.o : Data/Time/Calendar/Gregorian.hi -Data/Time/LocalTime/Format.o : Data/Time/Calendar/ISOWeekDay.hi +Data/Time/LocalTime/Format.o : Data/Time/Calendar.hi Data/Time/LocalTime/Format.o : Data/Time/LocalTime/TimeZone.hi Data/Time/LocalTime/Format.o : Data/Time/LocalTime/TimeOfDay.hi Data/Time/LocalTime/Format.o : Data/Time/LocalTime/LocalTime.hi From git at git.haskell.org Mon Feb 20 21:09:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:09:31 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: rename ISOWeekDay to ISO8601Week (8723c5f) Message-ID: <20170220210931.1B3453A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/8723c5f86424ee1d4c2d4b442fc10cda6ea58275 >--------------------------------------------------------------- commit 8723c5f86424ee1d4c2d4b442fc10cda6ea58275 Author: Ashley Yakeley Date: Sun Aug 7 02:04:57 2005 -0700 rename ISOWeekDay to ISO8601Week darcs-hash:20050807090457-ac6dd-413246f167e57da7cb93e7c975091f949f97f8a6 >--------------------------------------------------------------- 8723c5f86424ee1d4c2d4b442fc10cda6ea58275 Data/Time/Calendar.hs | 4 ++-- Data/Time/Calendar/{ISOWeekDay.hs => ISO8601Week.hs} | 20 ++++++++++---------- Data/Time/LocalTime/Format.hs | 8 ++++---- Makefile | 12 ++++++------ TimeLib.cabal | 2 +- TimeLib.xcodeproj/project.pbxproj | 4 ++-- test/ClipDates.hs | 2 +- test/ConvertBack.hs | 2 +- test/LongWeekYears.hs | 2 +- test/TestTime.hs | 2 +- 10 files changed, 29 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 8723c5f86424ee1d4c2d4b442fc10cda6ea58275 From git at git.haskell.org Mon Feb 20 21:09:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:09:33 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: utcToLocalZonedTime (5f330c5) Message-ID: <20170220210933.21BBC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/5f330c5e312131d4fe5abce8fadb79b69601dfd8 >--------------------------------------------------------------- commit 5f330c5e312131d4fe5abce8fadb79b69601dfd8 Author: Ashley Yakeley Date: Sun Aug 7 15:36:19 2005 -0700 utcToLocalZonedTime darcs-hash:20050807223619-ac6dd-e7ba5a92ce87e506014e37539f2b14952f5b47b1 >--------------------------------------------------------------- 5f330c5e312131d4fe5abce8fadb79b69601dfd8 Data/Time/LocalTime/LocalTime.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Data/Time/LocalTime/LocalTime.hs b/Data/Time/LocalTime/LocalTime.hs index 541a47b..9d718ee 100644 --- a/Data/Time/LocalTime/LocalTime.hs +++ b/Data/Time/LocalTime/LocalTime.hs @@ -9,7 +9,7 @@ module Data.Time.LocalTime.LocalTime -- converting UTC and UT1 times to LocalTime utcToLocalTime,localTimeToUTC,ut1ToLocalTime,localTimeToUT1, - ZonedTime(..),zonedTimeFromUTC,ztUTC,getZonedTime + ZonedTime(..),zonedTimeFromUTC,ztUTC,getZonedTime,utcToLocalZonedTime ) where import Data.Time.LocalTime.TimeOfDay @@ -70,3 +70,9 @@ getZonedTime = do t <- getCurrentTime zone <- getTimeZone t return (zonedTimeFromUTC zone t) + +-- | +utcToLocalZonedTime :: UTCTime -> IO ZonedTime +utcToLocalZonedTime t = do + zone <- getTimeZone t + return (zonedTimeFromUTC zone t) From git at git.haskell.org Mon Feb 20 21:09:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:09:35 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: rename UTCDiffTime to NominalDiffTime (6a21693) Message-ID: <20170220210935.28B543A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/6a216935f0b21b7f5546cfd8a2844042b5053dbf >--------------------------------------------------------------- commit 6a216935f0b21b7f5546cfd8a2844042b5053dbf Author: Ashley Yakeley Date: Sun Aug 7 15:40:56 2005 -0700 rename UTCDiffTime to NominalDiffTime darcs-hash:20050807224056-ac6dd-2a810f3e5a80c5585e6a0d2678e8729d29c1ed9b >--------------------------------------------------------------- 6a216935f0b21b7f5546cfd8a2844042b5053dbf Data/Time/Clock.hs | 2 +- Data/Time/Clock/UTC.hs | 76 +++++++++++++++++++++++++------------------------- 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/Data/Time/Clock.hs b/Data/Time/Clock.hs index 9235296..3b736b7 100644 --- a/Data/Time/Clock.hs +++ b/Data/Time/Clock.hs @@ -9,5 +9,5 @@ module Data.Time.Clock ) where import Data.Time.Clock.Scale -import Data.Time.Clock.UTC(UTCTime(..),UTCDiffTime,addUTCTime,diffUTCTime) +import Data.Time.Clock.UTC(UTCTime(..),NominalDiffTime,addUTCTime,diffUTCTime) import Data.Time.Clock.Current diff --git a/Data/Time/Clock/UTC.hs b/Data/Time/Clock/UTC.hs index 8b937e3..d1ca38d 100644 --- a/Data/Time/Clock/UTC.hs +++ b/Data/Time/Clock/UTC.hs @@ -9,7 +9,7 @@ module Data.Time.Clock.UTC -- These corrections are not predictable and are announced with six month's notice. -- No table of these corrections is provided, as any program compiled with it would become -- out of date in six months. - UTCTime(..),UTCDiffTime, + UTCTime(..),NominalDiffTime, addUTCTime,diffUTCTime, -- * POSIX time @@ -43,59 +43,59 @@ instance Ord UTCTime where -- Conversion functions will treat it as seconds. -- It has an accuracy of 10^-12 s. -- It ignores leap-seconds, so it's not necessarily a fixed amount of clock time. --- For instance, 23:00 UTC + 2 hours of UTCDiffTime = 01:00 UTC (+ 1 day), +-- For instance, 23:00 UTC + 2 hours of NominalDiffTime = 01:00 UTC (+ 1 day), -- regardless of whether a leap-second intervened. -newtype UTCDiffTime = MkUTCDiffTime Pico deriving (Eq,Ord) +newtype NominalDiffTime = MkNominalDiffTime Pico deriving (Eq,Ord) -instance Enum UTCDiffTime where - succ (MkUTCDiffTime a) = MkUTCDiffTime (succ a) - pred (MkUTCDiffTime a) = MkUTCDiffTime (pred a) - toEnum = MkUTCDiffTime . toEnum - fromEnum (MkUTCDiffTime a) = fromEnum a - enumFrom (MkUTCDiffTime a) = fmap MkUTCDiffTime (enumFrom a) - enumFromThen (MkUTCDiffTime a) (MkUTCDiffTime b) = fmap MkUTCDiffTime (enumFromThen a b) - enumFromTo (MkUTCDiffTime a) (MkUTCDiffTime b) = fmap MkUTCDiffTime (enumFromTo a b) - enumFromThenTo (MkUTCDiffTime a) (MkUTCDiffTime b) (MkUTCDiffTime c) = fmap MkUTCDiffTime (enumFromThenTo a b c) +instance Enum NominalDiffTime where + succ (MkNominalDiffTime a) = MkNominalDiffTime (succ a) + pred (MkNominalDiffTime a) = MkNominalDiffTime (pred a) + toEnum = MkNominalDiffTime . toEnum + fromEnum (MkNominalDiffTime a) = fromEnum a + enumFrom (MkNominalDiffTime a) = fmap MkNominalDiffTime (enumFrom a) + enumFromThen (MkNominalDiffTime a) (MkNominalDiffTime b) = fmap MkNominalDiffTime (enumFromThen a b) + enumFromTo (MkNominalDiffTime a) (MkNominalDiffTime b) = fmap MkNominalDiffTime (enumFromTo a b) + enumFromThenTo (MkNominalDiffTime a) (MkNominalDiffTime b) (MkNominalDiffTime c) = fmap MkNominalDiffTime (enumFromThenTo a b c) -instance Show UTCDiffTime where - show (MkUTCDiffTime t) = (showFixed True t) ++ "s" +instance Show NominalDiffTime where + show (MkNominalDiffTime t) = (showFixed True t) ++ "s" -- necessary because H98 doesn't have "cunning newtype" derivation -instance Num UTCDiffTime where - (MkUTCDiffTime a) + (MkUTCDiffTime b) = MkUTCDiffTime (a + b) - (MkUTCDiffTime a) - (MkUTCDiffTime b) = MkUTCDiffTime (a - b) - (MkUTCDiffTime a) * (MkUTCDiffTime b) = MkUTCDiffTime (a * b) - negate (MkUTCDiffTime a) = MkUTCDiffTime (negate a) - abs (MkUTCDiffTime a) = MkUTCDiffTime (abs a) - signum (MkUTCDiffTime a) = MkUTCDiffTime (signum a) - fromInteger i = MkUTCDiffTime (fromInteger i) +instance Num NominalDiffTime where + (MkNominalDiffTime a) + (MkNominalDiffTime b) = MkNominalDiffTime (a + b) + (MkNominalDiffTime a) - (MkNominalDiffTime b) = MkNominalDiffTime (a - b) + (MkNominalDiffTime a) * (MkNominalDiffTime b) = MkNominalDiffTime (a * b) + negate (MkNominalDiffTime a) = MkNominalDiffTime (negate a) + abs (MkNominalDiffTime a) = MkNominalDiffTime (abs a) + signum (MkNominalDiffTime a) = MkNominalDiffTime (signum a) + fromInteger i = MkNominalDiffTime (fromInteger i) -- necessary because H98 doesn't have "cunning newtype" derivation -instance Real UTCDiffTime where - toRational (MkUTCDiffTime a) = toRational a +instance Real NominalDiffTime where + toRational (MkNominalDiffTime a) = toRational a -- necessary because H98 doesn't have "cunning newtype" derivation -instance Fractional UTCDiffTime where - (MkUTCDiffTime a) / (MkUTCDiffTime b) = MkUTCDiffTime (a / b) - recip (MkUTCDiffTime a) = MkUTCDiffTime (recip a) - fromRational r = MkUTCDiffTime (fromRational r) +instance Fractional NominalDiffTime where + (MkNominalDiffTime a) / (MkNominalDiffTime b) = MkNominalDiffTime (a / b) + recip (MkNominalDiffTime a) = MkNominalDiffTime (recip a) + fromRational r = MkNominalDiffTime (fromRational r) -- necessary because H98 doesn't have "cunning newtype" derivation -instance RealFrac UTCDiffTime where - properFraction (MkUTCDiffTime a) = (i,MkUTCDiffTime f) where +instance RealFrac NominalDiffTime where + properFraction (MkNominalDiffTime a) = (i,MkNominalDiffTime f) where (i,f) = properFraction a - truncate (MkUTCDiffTime a) = truncate a - round (MkUTCDiffTime a) = round a - ceiling (MkUTCDiffTime a) = ceiling a - floor (MkUTCDiffTime a) = floor a + truncate (MkNominalDiffTime a) = truncate a + round (MkNominalDiffTime a) = round a + ceiling (MkNominalDiffTime a) = ceiling a + floor (MkNominalDiffTime a) = floor a -posixDay :: UTCDiffTime +posixDay :: NominalDiffTime posixDay = 86400 unixEpochMJD :: Day unixEpochMJD = ModifiedJulianDay 40587 -type POSIXTime = UTCDiffTime +type POSIXTime = NominalDiffTime posixSecondsToUTCTime :: POSIXTime -> UTCTime posixSecondsToUTCTime i = let @@ -107,9 +107,9 @@ utcTimeToPOSIXSeconds (UTCTime d t) = (fromInteger (diffDays d unixEpochMJD) * posixDay) + min posixDay (realToFrac t) -- | addUTCTime a b = a + b -addUTCTime :: UTCDiffTime -> UTCTime -> UTCTime +addUTCTime :: NominalDiffTime -> UTCTime -> UTCTime addUTCTime x t = posixSecondsToUTCTime (x + (utcTimeToPOSIXSeconds t)) -- | diffUTCTime a b = a - b -diffUTCTime :: UTCTime -> UTCTime -> UTCDiffTime +diffUTCTime :: UTCTime -> UTCTime -> NominalDiffTime diffUTCTime a b = (utcTimeToPOSIXSeconds a) - (utcTimeToPOSIXSeconds b) From git at git.haskell.org Mon Feb 20 21:09:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:09:37 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: use cases (as test) (68e172c) Message-ID: <20170220210937.30FB33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/68e172c2fb6f6c2374edd3e759fb68499cb38e51 >--------------------------------------------------------------- commit 68e172c2fb6f6c2374edd3e759fb68499cb38e51 Author: Ashley Yakeley Date: Mon Aug 8 01:16:52 2005 -0700 use cases (as test) darcs-hash:20050808081652-ac6dd-a158d7e515bb01a942d39803b9eb5251db29ac9b >--------------------------------------------------------------- 68e172c2fb6f6c2374edd3e759fb68499cb38e51 TimeLib.xcodeproj/project.pbxproj | 2 + test/Makefile | 5 ++- test/UseCases.lhs | 82 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+), 1 deletion(-) diff --git a/TimeLib.xcodeproj/project.pbxproj b/TimeLib.xcodeproj/project.pbxproj index f4f5ca6..89c8c9b 100644 --- a/TimeLib.xcodeproj/project.pbxproj +++ b/TimeLib.xcodeproj/project.pbxproj @@ -108,6 +108,7 @@ AB2666F108A572520059DEC0 /* Time.hs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.haskell; path = Time.hs; sourceTree = ""; }; AB26682008A5FF0D0059DEC0 /* AddDays.hs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.haskell; path = AddDays.hs; sourceTree = ""; }; AB26682108A5FF0D0059DEC0 /* AddDays.ref */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = AddDays.ref; sourceTree = ""; }; + AB26689F08A6D7290059DEC0 /* UseCases.lhs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.haskell.literate; path = UseCases.lhs; sourceTree = ""; }; ABD6783F084167B900CF37C0 /* POSIX.hs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.haskell; path = POSIX.hs; sourceTree = ""; }; ABD67840084167D100CF37C0 /* Current.hs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.haskell; path = Current.hs; sourceTree = ""; }; ABD67841084168B700CF37C0 /* UTC.hs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.haskell; path = UTC.hs; sourceTree = ""; }; @@ -231,6 +232,7 @@ ABFA262B083B28C00096540C /* TestFormatStuff.h */, ABFA262A083B28C00096540C /* TestFormatStuff.c */, ABFA2629083B28C00096540C /* TestFormat.hs */, + AB26689F08A6D7290059DEC0 /* UseCases.lhs */, ); name = Test; path = test; diff --git a/test/Makefile b/test/Makefile index 3e8fddd..034e2f4 100644 --- a/test/Makefile +++ b/test/Makefile @@ -36,7 +36,7 @@ TimeZone: TimeZone.o ../libTimeLib.a TimeZone.ref: FORCE date +%z > $@ -test: TestFixed.diff ConvertBack.diff0 TestTime.diff LongWeekYears.diff ClipDates.diff AddDays.diff TimeZone.diff TestFormat.diff0 +test: TestFixed.diff ConvertBack.diff0 TestTime.diff LongWeekYears.diff ClipDates.diff AddDays.diff TimeZone.diff TestFormat.diff0 UseCases.o clean: rm -rf ConvertBack TimeZone TimeZone.ref CurrentTime TestTime TestFixed ShowDST TestFormat *.out *.o *.hi Makefile.bak @@ -59,6 +59,9 @@ clean: %.o: %.hs ghc -i.. -c $< -o $@ +%.o: %.lhs + ghc -i.. -c $< -o $@ + FORCE: .SECONDARY: diff --git a/test/UseCases.lhs b/test/UseCases.lhs new file mode 100644 index 0000000..3db8834 --- /dev/null +++ b/test/UseCases.lhs @@ -0,0 +1,82 @@ +> module UseCases where +> import Data.Time +> import System.Locale + + +From Brian Smith: + + +Use cases (primarily taken from real-world corporate IT applications I have +developed) : + +* What is the equivalent (or closest aproximation) of the SQL DateTime type +(date and time without any timezone information)? What is the equivalent of +the SQL Date type (date without any timezone information)? + +> type SQLDateTime = LocalTime +> type SQLDate = Day + +* The user enters a date as "7/4/2005." How do I determine if this date is +before or after July 1st of this year? + +TODO: Parsing + +* How do I present the date "July 1st of this year" to the user in M/D/YYYY +format? + +> july1st = do +> now <- getZonedTime +> let (thisYear,_,_) = toGregorian (localDay (ztLocalTime now)) +> let day = fromGregorian thisYear 7 1 +> return (formatTime defaultTimeLocale "%m/%d/%Y" day) + +This actually gives "07/01/2005" rather than "7/1/2005". +ISSUE: Should I make additional %-codes for this? + + +* How do I truncate a datetime to midnight of the same day? How do I +truncate a date to the first of the month? How do I truncate a date to the +first day of the year it occurred in? + +> truncateToMidnight (LocalTime day _) = (LocalTime day midnight) + +> truncateToFirstOfMonth day = fromGregorian y m 1 where +> (y,m,_) = toGregorian day + +> truncateToJan1st day = fromYearAndDay y 1 where +> (y,_) = toYearAndDay day + +* Given a date X, how do I find the last day of the month that X occurs in. +For example, If X is July 4th, 2005, then I want the result to be July 31st, +2005. If X is Februrary 5, then I want the result to be Februrary 28 for +non-leap-years and February 29 for leap years. + +> lastDayOfMonth day = fromGregorian y m (gregorianMonthLength y m) where +> (y,m,_) = toGregorian day + +* The user enters a time T with no date, e.g. "17:30". How do I merge this +time onto a date D (e.g. July 4, 2005), so that the result has is a datetime +with date D and the time T (July 4, 2005 at 17:30). + +> mergeDateAndTime = LocalTime + +* Given two datetimes T1, T2, how do I determine if they are on the same +date? + +> sameDay (LocalTime d1 _) (LocalTime d2 _) = d1 == d2 + + +From Simon Marlow: + + +I just had a little look around, mainly at System.Time.Calendar. I +think the structure is rather complicated - I wanted to find out how to +get a CalendarTime for "this time tomorrow", and ended up with this: + +*System.Time.Calendar> let c' = +c{ztTime=zttime{dtDay=dtday{gregDay=day+1}}} where { zttime = ztTime c; +dtday = dtDay zttime; day = gregDay dtday } + +> thisTimeTomorrow (ZonedTime (LocalTime day tod) zone) = (ZonedTime (LocalTime (addDays 1 day) tod) zone) + + From git at git.haskell.org Mon Feb 20 21:09:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:09:39 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: add missing file (70544be) Message-ID: <20170220210939.387DB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/70544be1f29f912a032c1ba364b343d621faaa03 >--------------------------------------------------------------- commit 70544be1f29f912a032c1ba364b343d621faaa03 Author: Ashley Yakeley Date: Mon Aug 8 01:44:55 2005 -0700 add missing file darcs-hash:20050808084455-ac6dd-f30c61c5f69f22ce1764c10640dec0e564a68d01 >--------------------------------------------------------------- 70544be1f29f912a032c1ba364b343d621faaa03 Data/Time/LocalTime.hs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Data/Time/LocalTime.hs b/Data/Time/LocalTime.hs new file mode 100644 index 0000000..553a409 --- /dev/null +++ b/Data/Time/LocalTime.hs @@ -0,0 +1,14 @@ +{-# OPTIONS -Wall -Werror #-} + +module Data.Time.LocalTime +( + module Data.Time.LocalTime.TimeZone, + module Data.Time.LocalTime.TimeOfDay, + module Data.Time.LocalTime.LocalTime, + module Data.Time.LocalTime.Format +) where + +import Data.Time.LocalTime.TimeZone +import Data.Time.LocalTime.TimeOfDay +import Data.Time.LocalTime.LocalTime +import Data.Time.LocalTime.Format From git at git.haskell.org Mon Feb 20 21:09:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:09:41 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: add missing file (e3f3a03) Message-ID: <20170220210941.411CE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/e3f3a0377025ebf746274e31f0651138350fa6d1 >--------------------------------------------------------------- commit e3f3a0377025ebf746274e31f0651138350fa6d1 Author: Ashley Yakeley Date: Mon Aug 8 01:45:48 2005 -0700 add missing file darcs-hash:20050808084548-ac6dd-ed5644c971cd295aeb8602214cacbe198fc0e4e8 >--------------------------------------------------------------- e3f3a0377025ebf746274e31f0651138350fa6d1 Data/Time.hs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Data/Time.hs b/Data/Time.hs new file mode 100644 index 0000000..65926cd --- /dev/null +++ b/Data/Time.hs @@ -0,0 +1,12 @@ +{-# OPTIONS -Wall -Werror #-} + +module Data.Time +( + module Data.Time.Calendar, + module Data.Time.Clock, + module Data.Time.LocalTime +) where + +import Data.Time.Calendar +import Data.Time.Clock +import Data.Time.LocalTime From git at git.haskell.org Mon Feb 20 21:09:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:09:43 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: get taiToUTCTime working (with test) (db06886) Message-ID: <20170220210943.4C1E53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/db06886a8ffce339c0abb82c5d64aede7adaec8a >--------------------------------------------------------------- commit db06886a8ffce339c0abb82c5d64aede7adaec8a Author: Ashley Yakeley Date: Sun Oct 30 21:19:09 2005 -0800 get taiToUTCTime working (with test) darcs-hash:20051031051909-ac6dd-d6c3e23dfd9d8af47176829d9b08ee53bd087ff8 >--------------------------------------------------------------- db06886a8ffce339c0abb82c5d64aede7adaec8a Data/Time/TAI.hs | 90 ++++++++++++++++++++++++++++++++++++--- Makefile | 8 ++-- TimeLib.xcodeproj/project.pbxproj | 8 +++- test/Makefile | 5 ++- test/TestParseDAT.hs | 65 ++++++++++++++++++++++++++++ test/TestParseDAT.ref | 90 +++++++++++++++++++++++++++++++++++++++ test/tai-utc.dat | 37 ++++++++++++++++ 7 files changed, 293 insertions(+), 10 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 db06886a8ffce339c0abb82c5d64aede7adaec8a From git at git.haskell.org Mon Feb 20 21:09:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:09:45 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: comments (cae9a55) Message-ID: <20170220210945.5334C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/cae9a559b5e04cf6a909e50a849701ef1a4b9ee9 >--------------------------------------------------------------- commit cae9a559b5e04cf6a909e50a849701ef1a4b9ee9 Author: Ashley Yakeley Date: Sun Oct 30 21:20:38 2005 -0800 comments darcs-hash:20051031052038-ac6dd-53d86650e4a39607f63fa4512d559cad30995bcf >--------------------------------------------------------------- cae9a559b5e04cf6a909e50a849701ef1a4b9ee9 Data/Fixed.hs | 6 +++--- Data/Time/Clock/UTC.hs | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Data/Fixed.hs b/Data/Fixed.hs index 697c460..919862b 100644 --- a/Data/Fixed.hs +++ b/Data/Fixed.hs @@ -10,16 +10,16 @@ module Data.Fixed E12,Pico ) where --- | like "div", but with a more useful type +-- | generalisation of 'div' to any instance of Real div' :: (Real a,Integral b) => a -> a -> b div' n d = floor ((toRational n) / (toRational d)) --- | like "divMod", but with a more useful type +-- | generalisation of 'divMod' to any instance of Real divMod' :: (Real a,Integral b) => a -> a -> (b,a) divMod' n d = (f,n - (fromIntegral f) * d) where f = div' n d --- | like "mod", but with a more useful type +-- | generalisation of 'mod' to any instance of Real mod' :: (Real a) => a -> a -> a mod' n d = n - (fromInteger f) * d where f = div' n d diff --git a/Data/Time/Clock/UTC.hs b/Data/Time/Clock/UTC.hs index d1ca38d..282ee4f 100644 --- a/Data/Time/Clock/UTC.hs +++ b/Data/Time/Clock/UTC.hs @@ -9,6 +9,9 @@ module Data.Time.Clock.UTC -- These corrections are not predictable and are announced with six month's notice. -- No table of these corrections is provided, as any program compiled with it would become -- out of date in six months. + -- + -- If you don't care about leap seconds, use UTCTime and NominalDiffTime for your clock calculations, + -- and you'll be fine. UTCTime(..),NominalDiffTime, addUTCTime,diffUTCTime, From git at git.haskell.org Mon Feb 20 21:09:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:09:47 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: set cabal to 0.2 (e1f3f24) Message-ID: <20170220210947.5AEFF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/e1f3f243b389395f4d50d992c2500c3815a9eb25 >--------------------------------------------------------------- commit e1f3f243b389395f4d50d992c2500c3815a9eb25 Author: Ashley Yakeley Date: Sun Oct 30 22:06:47 2005 -0800 set cabal to 0.2 darcs-hash:20051031060647-ac6dd-cae6ed88711bc94a8feeb11d2968b766ae0ce53b >--------------------------------------------------------------- e1f3f243b389395f4d50d992c2500c3815a9eb25 TimeLib.cabal | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TimeLib.cabal b/TimeLib.cabal index dc74660..7713452 100644 --- a/TimeLib.cabal +++ b/TimeLib.cabal @@ -1,6 +1,6 @@ Name: time -Version: 0.1 -Stability: Alpha +Version: 0.2 +Stability: Beta License: BSD3 License-File: LICENSE Author: Ashley Yakeley From git at git.haskell.org Mon Feb 20 21:09:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:09:49 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: instance Show UTCTime (c03ad77) Message-ID: <20170220210949.610F93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/c03ad77480823c2e9c4cc919192a65052448ee57 >--------------------------------------------------------------- commit c03ad77480823c2e9c4cc919192a65052448ee57 Author: Ashley Yakeley Date: Tue Nov 1 23:48:56 2005 -0800 instance Show UTCTime darcs-hash:20051102074856-ac6dd-034566ea08d12d2e6bbd34390e1a7cfd7a69cac4 >--------------------------------------------------------------- c03ad77480823c2e9c4cc919192a65052448ee57 Data/Time/LocalTime/LocalTime.hs | 3 +++ test/TestParseDAT.hs | 7 ++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Data/Time/LocalTime/LocalTime.hs b/Data/Time/LocalTime/LocalTime.hs index 9d718ee..1ac0f1f 100644 --- a/Data/Time/LocalTime/LocalTime.hs +++ b/Data/Time/LocalTime/LocalTime.hs @@ -65,6 +65,9 @@ ztUTC (ZonedTime t zone) = localTimeToUTC zone t instance Show ZonedTime where show (ZonedTime t zone) = show t ++ " " ++ show zone +instance Show UTCTime where + show t = show (zonedTimeFromUTC utc t) + getZonedTime :: IO ZonedTime getZonedTime = do t <- getCurrentTime diff --git a/test/TestParseDAT.hs b/test/TestParseDAT.hs index 48104ca..2f53fab 100644 --- a/test/TestParseDAT.hs +++ b/test/TestParseDAT.hs @@ -46,9 +46,6 @@ times = fmap (LocalTime (fromGregorian 1999 01 01)) tods ++ fmap (LocalTime (fromGregorian 1999 01 02)) tods -showUTC :: UTCTime -> String -showUTC t = show (zonedTimeFromUTC utc t) - main :: IO () main = do h <- openFile "tai-utc.dat" ReadMode @@ -60,6 +57,6 @@ main = do let taiTime = utcToTAITime lst utcTime let utcTime' = taiToUTCTime lst taiTime if utcTime == utcTime' - then putStrLn ((showUTC utcTime) ++ " == " ++ (show taiTime)) - else putStrLn ("correction: " ++ (showUTC utcTime) ++ " -> " ++ (show taiTime) ++ " -> " ++ (showUTC utcTime')) + then putStrLn ((show utcTime) ++ " == " ++ (show taiTime)) + else putStrLn ("correction: " ++ (show utcTime) ++ " -> " ++ (show taiTime) ++ " -> " ++ (show utcTime')) ) times From git at git.haskell.org Mon Feb 20 21:09:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:09:51 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: more sensible identifer names (acc1fc8) Message-ID: <20170220210951.684343A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/acc1fc8124f9dbdb740c76a543421ba47ab1d456 >--------------------------------------------------------------- commit acc1fc8124f9dbdb740c76a543421ba47ab1d456 Author: Ashley Yakeley Date: Sat Nov 12 17:45:46 2005 -0800 more sensible identifer names darcs-hash:20051113014546-ac6dd-27e3b85dc58a1c0cef8b1611e17415887cc4ecc8 >--------------------------------------------------------------- acc1fc8124f9dbdb740c76a543421ba47ab1d456 Data/Time/LocalTime/Format.hs | 4 ++-- Data/Time/LocalTime/LocalTime.hs | 16 ++++++++-------- test/CurrentTime.hs | 4 ++-- test/ShowDST.hs | 2 +- test/TestFormat.hs | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Data/Time/LocalTime/Format.hs b/Data/Time/LocalTime/Format.hs index 3976658..ccb72e9 100644 --- a/Data/Time/LocalTime/Format.hs +++ b/Data/Time/LocalTime/Format.hs @@ -66,7 +66,7 @@ instance FormatTime TimeOfDay where formatCharacter _ = Nothing instance FormatTime ZonedTime where - formatCharacter 's' = Just (\_ zt -> show (truncate (utcTimeToPOSIXSeconds (ztUTC zt)) :: Integer)) + formatCharacter 's' = Just (\_ zt -> show (truncate (utcTimeToPOSIXSeconds (zonedTimeToUTC zt)) :: Integer)) formatCharacter c = case (formatCharacter c) of Just f -> Just (\locale dt -> f locale (ztLocalTime dt)) Nothing -> case (formatCharacter c) of @@ -116,4 +116,4 @@ instance FormatTime Day where formatCharacter _ = Nothing instance FormatTime UTCTime where - formatCharacter c = fmap (\f locale t -> f locale (zonedTimeFromUTC utc t)) (formatCharacter c) + formatCharacter c = fmap (\f locale t -> f locale (utcToZonedTime utc t)) (formatCharacter c) diff --git a/Data/Time/LocalTime/LocalTime.hs b/Data/Time/LocalTime/LocalTime.hs index 1ac0f1f..6cb0d49 100644 --- a/Data/Time/LocalTime/LocalTime.hs +++ b/Data/Time/LocalTime/LocalTime.hs @@ -9,7 +9,7 @@ module Data.Time.LocalTime.LocalTime -- converting UTC and UT1 times to LocalTime utcToLocalTime,localTimeToUTC,ut1ToLocalTime,localTimeToUT1, - ZonedTime(..),zonedTimeFromUTC,ztUTC,getZonedTime,utcToLocalZonedTime + ZonedTime(..),utcToZonedTime,zonedTimeToUTC,getZonedTime,utcToLocalZonedTime ) where import Data.Time.LocalTime.TimeOfDay @@ -56,26 +56,26 @@ data ZonedTime = ZonedTime { ztZone :: TimeZone } -zonedTimeFromUTC :: TimeZone -> UTCTime -> ZonedTime -zonedTimeFromUTC zone time = ZonedTime (utcToLocalTime zone time) zone +utcToZonedTime :: TimeZone -> UTCTime -> ZonedTime +utcToZonedTime zone time = ZonedTime (utcToLocalTime zone time) zone -ztUTC :: ZonedTime -> UTCTime -ztUTC (ZonedTime t zone) = localTimeToUTC zone t +zonedTimeToUTC :: ZonedTime -> UTCTime +zonedTimeToUTC (ZonedTime t zone) = localTimeToUTC zone t instance Show ZonedTime where show (ZonedTime t zone) = show t ++ " " ++ show zone instance Show UTCTime where - show t = show (zonedTimeFromUTC utc t) + show t = show (utcToZonedTime utc t) getZonedTime :: IO ZonedTime getZonedTime = do t <- getCurrentTime zone <- getTimeZone t - return (zonedTimeFromUTC zone t) + return (utcToZonedTime zone t) -- | utcToLocalZonedTime :: UTCTime -> IO ZonedTime utcToLocalZonedTime t = do zone <- getTimeZone t - return (zonedTimeFromUTC zone t) + return (utcToZonedTime zone t) diff --git a/test/CurrentTime.hs b/test/CurrentTime.hs index b0970f0..464e643 100644 --- a/test/CurrentTime.hs +++ b/test/CurrentTime.hs @@ -8,6 +8,6 @@ main :: IO () main = do now <- getCurrentTime putStrLn (show (utctDay now) ++ "," ++ show (utctDayTime now)) - putStrLn (show (zonedTimeFromUTC utc now :: ZonedTime)) + putStrLn (show (utcToZonedTime utc now :: ZonedTime)) myzone <- getCurrentTimeZone - putStrLn (show (zonedTimeFromUTC myzone now :: ZonedTime)) + putStrLn (show (utcToZonedTime myzone now :: ZonedTime)) diff --git a/test/ShowDST.hs b/test/ShowDST.hs index ed1a92f..fa7dbda 100644 --- a/test/ShowDST.hs +++ b/test/ShowDST.hs @@ -20,7 +20,7 @@ findTransition a b = do return (tp ++ tq) showZoneTime :: TimeZone -> UTCTime -> String -showZoneTime zone time = show (zonedTimeFromUTC zone time) +showZoneTime zone time = show (utcToZonedTime zone time) showTransition :: (UTCTime,TimeZone,TimeZone) -> String showTransition (time,zone1,zone2) = (showZoneTime zone1 time) ++ " => " ++ (showZoneTime zone2 time) diff --git a/test/TestFormat.hs b/test/TestFormat.hs index b4d1e70..1529dee 100644 --- a/test/TestFormat.hs +++ b/test/TestFormat.hs @@ -67,7 +67,7 @@ times = [baseTime0] ++ (fmap getDay [0..23]) ++ (fmap getDay [0..100]) ++ compareFormat :: String -> TimeZone -> UTCTime -> IO () compareFormat fmt zone time = let - ctime = zonedTimeFromUTC zone time + ctime = utcToZonedTime zone time haskellText = formatTime locale fmt ctime in do unixText <- unixFormatTime fmt zone time From git at git.haskell.org Mon Feb 20 21:09:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:09:53 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: version 0.2.1 (68b10d9) Message-ID: <20170220210953.6ED9F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/68b10d91802ebe97804eac22b08770e460c2c4f4 >--------------------------------------------------------------- commit 68b10d91802ebe97804eac22b08770e460c2c4f4 Author: Ashley Yakeley Date: Sat Nov 12 17:50:15 2005 -0800 version 0.2.1 darcs-hash:20051113015015-ac6dd-97e5fc55cc5d13ef0b24c75c160dfb3def05d7bb >--------------------------------------------------------------- 68b10d91802ebe97804eac22b08770e460c2c4f4 TimeLib.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TimeLib.cabal b/TimeLib.cabal index 7713452..820035a 100644 --- a/TimeLib.cabal +++ b/TimeLib.cabal @@ -1,5 +1,5 @@ Name: time -Version: 0.2 +Version: 0.2.1 Stability: Beta License: BSD3 License-File: LICENSE From git at git.haskell.org Mon Feb 20 21:09:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:09:55 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: ZonedTime id names (e0937c8) Message-ID: <20170220210955.75C853A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/e0937c846ffaa0958d821cd2b5b040e364e5a7db >--------------------------------------------------------------- commit e0937c846ffaa0958d821cd2b5b040e364e5a7db Author: Ashley Yakeley Date: Sat Nov 12 17:54:19 2005 -0800 ZonedTime id names darcs-hash:20051113015419-ac6dd-d0f1b11eb888e9535372340ec3b4f3a38c36bd80 >--------------------------------------------------------------- e0937c846ffaa0958d821cd2b5b040e364e5a7db Data/Time/LocalTime/Format.hs | 4 ++-- Data/Time/LocalTime/LocalTime.hs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Data/Time/LocalTime/Format.hs b/Data/Time/LocalTime/Format.hs index ccb72e9..8457086 100644 --- a/Data/Time/LocalTime/Format.hs +++ b/Data/Time/LocalTime/Format.hs @@ -68,9 +68,9 @@ instance FormatTime TimeOfDay where instance FormatTime ZonedTime where formatCharacter 's' = Just (\_ zt -> show (truncate (utcTimeToPOSIXSeconds (zonedTimeToUTC zt)) :: Integer)) formatCharacter c = case (formatCharacter c) of - Just f -> Just (\locale dt -> f locale (ztLocalTime dt)) + Just f -> Just (\locale dt -> f locale (zonedTimeToLocalTime dt)) Nothing -> case (formatCharacter c) of - Just f -> Just (\locale dt -> f locale (ztZone dt)) + Just f -> Just (\locale dt -> f locale (zonedTimeZone dt)) Nothing -> Nothing instance FormatTime TimeZone where diff --git a/Data/Time/LocalTime/LocalTime.hs b/Data/Time/LocalTime/LocalTime.hs index 6cb0d49..c902bb6 100644 --- a/Data/Time/LocalTime/LocalTime.hs +++ b/Data/Time/LocalTime/LocalTime.hs @@ -52,8 +52,8 @@ localTimeToUT1 long (LocalTime (ModifiedJulianDay localMJD) tod) = ModJulianDate -- | A local time together with a TimeZone. data ZonedTime = ZonedTime { - ztLocalTime :: LocalTime, - ztZone :: TimeZone + zonedTimeToLocalTime :: LocalTime, + zonedTimeZone :: TimeZone } utcToZonedTime :: TimeZone -> UTCTime -> ZonedTime From git at git.haskell.org Mon Feb 20 21:09:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:09:57 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: new MonthDay module (f4e177d) Message-ID: <20170220210957.812983A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/f4e177df657acec49e90ee1fd1443827fb08e5ae >--------------------------------------------------------------- commit f4e177df657acec49e90ee1fd1443827fb08e5ae Author: Ashley Yakeley Date: Sun Nov 13 03:11:58 2005 -0800 new MonthDay module darcs-hash:20051113111158-ac6dd-0bbbd8a48c559aa87e0ec57128af814e83ee7396 >--------------------------------------------------------------- f4e177df657acec49e90ee1fd1443827fb08e5ae Data/Time/Calendar.hs | 2 + Data/Time/Calendar/Gregorian.hs | 24 +- Data/Time/Calendar/MonthDay.hs | 41 +++ Makefile | 5 + TimeLib.cabal | 1 + TimeLib.xcodeproj/project.pbxproj | 6 + test/Makefile | 16 +- test/TestMonthDay.hs | 20 + test/TestMonthDay.ref | 746 ++++++++++++++++++++++++++++++++++++++ 9 files changed, 840 insertions(+), 21 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 f4e177df657acec49e90ee1fd1443827fb08e5ae From git at git.haskell.org Mon Feb 20 21:09:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:09:59 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Julian and Easter calendars (869b07f) Message-ID: <20170220210959.8BBC63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/869b07fbd86304b5ef9ac67cf398b7bbd232f663 >--------------------------------------------------------------- commit 869b07fbd86304b5ef9ac67cf398b7bbd232f663 Author: Ashley Yakeley Date: Mon Nov 14 01:42:01 2005 -0800 Julian and Easter calendars darcs-hash:20051114094201-ac6dd-a131f426e1d19bdf05a559ee6a110c9e9740b4c4 >--------------------------------------------------------------- 869b07fbd86304b5ef9ac67cf398b7bbd232f663 Data/Time/Calendar/Easter.hs | 38 +++++++++++++++++++++ Data/Time/Calendar/Julian.hs | 68 +++++++++++++++++++++++++++++++++++++ Data/Time/Calendar/JulianYearDay.hs | 38 +++++++++++++++++++++ Data/Time/Calendar/YearDay.hs | 2 +- Makefile | 14 ++++++++ TimeLib.cabal | 3 ++ TimeLib.xcodeproj/project.pbxproj | 14 ++++++++ test/ConvertBack.hs | 4 ++- test/Makefile | 8 +++++ test/TestCalendars.hs | 28 +++++++++++++++ test/TestCalendars.ref | 4 +++ test/TestEaster.hs | 23 +++++++++++++ test/TestEaster.ref | 57 +++++++++++++++++++++++++++++++ 13 files changed, 299 insertions(+), 2 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 869b07fbd86304b5ef9ac67cf398b7bbd232f663 From git at git.haskell.org Mon Feb 20 21:10:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:10:01 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: move ISO8601Week to separate module space (b802476) Message-ID: <20170220211001.932A93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/b802476ee193ac4616eb35945069fd9007aa39c6 >--------------------------------------------------------------- commit b802476ee193ac4616eb35945069fd9007aa39c6 Author: Ashley Yakeley Date: Mon Nov 14 01:49:03 2005 -0800 move ISO8601Week to separate module space darcs-hash:20051114094903-ac6dd-606f84f89b9ef911bddbed72ef80778b57d4a586 >--------------------------------------------------------------- b802476ee193ac4616eb35945069fd9007aa39c6 Data/Time/Calendar.hs | 4 +--- Data/Time/Calendar/ISO8601Week.hs | 7 +------ Data/Time/LocalTime/Format.hs | 2 +- Makefile | 10 +++++----- TimeLib.cabal | 2 +- test/ClipDates.hs | 1 + test/ConvertBack.hs | 1 + test/LongWeekYears.hs | 1 + test/TestCalendars.hs | 1 + test/TestTime.hs | 1 + 10 files changed, 14 insertions(+), 16 deletions(-) diff --git a/Data/Time/Calendar.hs b/Data/Time/Calendar.hs index 8cf43ce..db87917 100644 --- a/Data/Time/Calendar.hs +++ b/Data/Time/Calendar.hs @@ -5,12 +5,10 @@ module Data.Time.Calendar module Data.Time.Calendar.Days, module Data.Time.Calendar.YearDay, module Data.Time.Calendar.MonthDay, - module Data.Time.Calendar.Gregorian, - module Data.Time.Calendar.ISO8601Week + module Data.Time.Calendar.Gregorian ) where import Data.Time.Calendar.Days import Data.Time.Calendar.YearDay import Data.Time.Calendar.MonthDay import Data.Time.Calendar.Gregorian -import Data.Time.Calendar.ISO8601Week diff --git a/Data/Time/Calendar/ISO8601Week.hs b/Data/Time/Calendar/ISO8601Week.hs index 8a9e61f..88e8e3e 100644 --- a/Data/Time/Calendar/ISO8601Week.hs +++ b/Data/Time/Calendar/ISO8601Week.hs @@ -1,11 +1,6 @@ {-# OPTIONS -Wall -Werror #-} --- #hide -module Data.Time.Calendar.ISO8601Week - ( - -- * ISO 8601 Week calendar - module Data.Time.Calendar.ISO8601Week - ) where +module Data.Time.Calendar.ISO8601Week where import Data.Time.Calendar.YearDay import Data.Time.Calendar.Days diff --git a/Data/Time/LocalTime/Format.hs b/Data/Time/LocalTime/Format.hs index 8457086..3fbbe0e 100644 --- a/Data/Time/LocalTime/Format.hs +++ b/Data/Time/LocalTime/Format.hs @@ -1,6 +1,5 @@ {-# OPTIONS -Wall -Werror #-} - -- #hide module Data.Time.LocalTime.Format ( @@ -11,6 +10,7 @@ module Data.Time.LocalTime.Format import Data.Time.LocalTime.LocalTime import Data.Time.LocalTime.TimeOfDay import Data.Time.LocalTime.TimeZone +import Data.Time.Calendar.ISO8601Week import Data.Time.Calendar import Data.Time.Calendar.Private import Data.Time.Clock diff --git a/Makefile b/Makefile index 9bfdf0c..b387425 100644 --- a/Makefile +++ b/Makefile @@ -97,16 +97,15 @@ Data/Time/Calendar/Gregorian.o : Data/Time/Calendar/Private.hi Data/Time/Calendar/Gregorian.o : Data/Time/Calendar/Days.hi Data/Time/Calendar/Gregorian.o : Data/Time/Calendar/YearDay.hi Data/Time/Calendar/Gregorian.o : Data/Time/Calendar/MonthDay.hi -Data/Time/Calendar/ISO8601Week.o : Data/Time/Calendar/ISO8601Week.hs -Data/Time/Calendar/ISO8601Week.o : Data/Time/Calendar/Private.hi -Data/Time/Calendar/ISO8601Week.o : Data/Time/Calendar/Days.hi -Data/Time/Calendar/ISO8601Week.o : Data/Time/Calendar/YearDay.hi Data/Time/Calendar.o : Data/Time/Calendar.hs -Data/Time/Calendar.o : Data/Time/Calendar/ISO8601Week.hi Data/Time/Calendar.o : Data/Time/Calendar/Gregorian.hi Data/Time/Calendar.o : Data/Time/Calendar/MonthDay.hi Data/Time/Calendar.o : Data/Time/Calendar/YearDay.hi Data/Time/Calendar.o : Data/Time/Calendar/Days.hi +Data/Time/Calendar/ISO8601Week.o : Data/Time/Calendar/ISO8601Week.hs +Data/Time/Calendar/ISO8601Week.o : Data/Time/Calendar/Private.hi +Data/Time/Calendar/ISO8601Week.o : Data/Time/Calendar/Days.hi +Data/Time/Calendar/ISO8601Week.o : Data/Time/Calendar/YearDay.hi Data/Time/Calendar/JulianYearDay.o : Data/Time/Calendar/JulianYearDay.hs Data/Time/Calendar/JulianYearDay.o : Data/Time/Calendar/Private.hi Data/Time/Calendar/JulianYearDay.o : Data/Time/Calendar/Days.hi @@ -151,6 +150,7 @@ Data/Time/LocalTime/Format.o : Data/Time/Clock/POSIX.hi Data/Time/LocalTime/Format.o : Data/Time/Clock.hi Data/Time/LocalTime/Format.o : Data/Time/Calendar/Private.hi Data/Time/LocalTime/Format.o : Data/Time/Calendar.hi +Data/Time/LocalTime/Format.o : Data/Time/Calendar/ISO8601Week.hi Data/Time/LocalTime/Format.o : Data/Time/LocalTime/TimeZone.hi Data/Time/LocalTime/Format.o : Data/Time/LocalTime/TimeOfDay.hi Data/Time/LocalTime/Format.o : Data/Time/LocalTime/LocalTime.hi diff --git a/TimeLib.cabal b/TimeLib.cabal index b10cb7c..16a43c7 100644 --- a/TimeLib.cabal +++ b/TimeLib.cabal @@ -12,6 +12,7 @@ Synopsis: a new time library Exposed-modules: Data.Fixed, Data.Time.Calendar, + Data.Time.Calendar.ISO8601Week, Data.Time.Calendar.Julian, Data.Time.Calendar.Easter, Data.Time.Clock, @@ -26,7 +27,6 @@ Other-modules: Data.Time.Calendar.YearDay, Data.Time.Calendar.MonthDay, Data.Time.Calendar.Gregorian, - Data.Time.Calendar.ISO8601Week, Data.Time.Calendar.JulianYearDay, Data.Time.Clock.Scale, Data.Time.Clock.UTC, diff --git a/test/ClipDates.hs b/test/ClipDates.hs index f9abb6c..cd0fe9c 100644 --- a/test/ClipDates.hs +++ b/test/ClipDates.hs @@ -2,6 +2,7 @@ module Main where +import Data.Time.Calendar.ISO8601Week import Data.Time.Calendar import Control.Monad diff --git a/test/ConvertBack.hs b/test/ConvertBack.hs index 7f3ea1e..76dda86 100644 --- a/test/ConvertBack.hs +++ b/test/ConvertBack.hs @@ -3,6 +3,7 @@ module Main where import Data.Time.Calendar.Julian +import Data.Time.Calendar.ISO8601Week import Data.Time.Calendar checkDay :: (Show t) => (Day -> t) -> (t -> Day) -> Day -> IO () diff --git a/test/LongWeekYears.hs b/test/LongWeekYears.hs index 3715b6d..674e8c6 100644 --- a/test/LongWeekYears.hs +++ b/test/LongWeekYears.hs @@ -2,6 +2,7 @@ module Main where +import Data.Time.Calendar.ISO8601Week import Data.Time.Calendar longYear :: Integer -> Bool diff --git a/test/TestCalendars.hs b/test/TestCalendars.hs index 3dd935a..d463b3a 100644 --- a/test/TestCalendars.hs +++ b/test/TestCalendars.hs @@ -3,6 +3,7 @@ module Main where import Data.Time.Calendar.Julian +import Data.Time.Calendar.ISO8601Week import Data.Time.Calendar showers :: [(String,Day -> String)] diff --git a/test/TestTime.hs b/test/TestTime.hs index 2870026..f95c4ca 100644 --- a/test/TestTime.hs +++ b/test/TestTime.hs @@ -2,6 +2,7 @@ module Main where +import Data.Time.Calendar.ISO8601Week import Data.Time showCal :: Integer -> IO () From git at git.haskell.org Mon Feb 20 21:10:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:10:03 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: fix identifier in UseCases.lhs (0e3dd85) Message-ID: <20170220211003.99D1D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/0e3dd8527b87f54d00deb8fba9806c6c49e844e4 >--------------------------------------------------------------- commit 0e3dd8527b87f54d00deb8fba9806c6c49e844e4 Author: Ashley Yakeley Date: Mon Nov 14 01:50:01 2005 -0800 fix identifier in UseCases.lhs darcs-hash:20051114095001-ac6dd-9bd1aba492639cb8de6f1b14f98ef2f7fc70a414 >--------------------------------------------------------------- 0e3dd8527b87f54d00deb8fba9806c6c49e844e4 test/UseCases.lhs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/UseCases.lhs b/test/UseCases.lhs index 3db8834..dff4af1 100644 --- a/test/UseCases.lhs +++ b/test/UseCases.lhs @@ -26,7 +26,7 @@ format? > july1st = do > now <- getZonedTime -> let (thisYear,_,_) = toGregorian (localDay (ztLocalTime now)) +> let (thisYear,_,_) = toGregorian (localDay (zonedTimeToLocalTime now)) > let day = fromGregorian thisYear 7 1 > return (formatTime defaultTimeLocale "%m/%d/%Y" day) From git at git.haskell.org Mon Feb 20 21:10:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:10:05 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: move out MonthDay and YearDay (6f8d525) Message-ID: <20170220211005.A03783A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/6f8d525b72b83b9e7d6ae9a6a54412772827f04e >--------------------------------------------------------------- commit 6f8d525b72b83b9e7d6ae9a6a54412772827f04e Author: Ashley Yakeley Date: Sun Nov 27 19:15:30 2005 -0800 move out MonthDay and YearDay darcs-hash:20051128031530-ac6dd-3f85b81566d7460fb2faa21f0783f11b4421cf62 >--------------------------------------------------------------- 6f8d525b72b83b9e7d6ae9a6a54412772827f04e Data/Time/Calendar.hs | 4 ---- Data/Time/Calendar/ISO8601Week.hs | 2 +- Data/Time/Calendar/MonthDay.hs | 2 -- Data/Time/Calendar/YearDay.hs | 7 +------ Data/Time/LocalTime/Format.hs | 1 + Makefile | 3 +-- TimeLib.cabal | 4 ++-- 7 files changed, 6 insertions(+), 17 deletions(-) diff --git a/Data/Time/Calendar.hs b/Data/Time/Calendar.hs index db87917..30dd9bf 100644 --- a/Data/Time/Calendar.hs +++ b/Data/Time/Calendar.hs @@ -3,12 +3,8 @@ module Data.Time.Calendar ( module Data.Time.Calendar.Days, - module Data.Time.Calendar.YearDay, - module Data.Time.Calendar.MonthDay, module Data.Time.Calendar.Gregorian ) where import Data.Time.Calendar.Days -import Data.Time.Calendar.YearDay -import Data.Time.Calendar.MonthDay import Data.Time.Calendar.Gregorian diff --git a/Data/Time/Calendar/ISO8601Week.hs b/Data/Time/Calendar/ISO8601Week.hs index 88e8e3e..59e082a 100644 --- a/Data/Time/Calendar/ISO8601Week.hs +++ b/Data/Time/Calendar/ISO8601Week.hs @@ -7,7 +7,7 @@ import Data.Time.Calendar.Days import Data.Time.Calendar.Private -- | convert to ISO 8601 Week format. First element of result is year, second week number (1-53), third day of week (1 for Monday to 7 for Sunday). --- Note that "Week" years are not quite the same as Gregorian years, as the first day of the year is always a Monday. +-- Note that \"Week\" years are not quite the same as Gregorian years, as the first day of the year is always a Monday. -- The first week of a year is the first week to contain at least four days in the corresponding Gregorian year. toISO8601Week :: Day -> (Integer,Int,Int) toISO8601Week date@(ModifiedJulianDay mjd) = (y1,fromInteger (w1 + 1),fromInteger (mod d 7) + 1) where diff --git a/Data/Time/Calendar/MonthDay.hs b/Data/Time/Calendar/MonthDay.hs index 5f15d7d..ac0c4d3 100644 --- a/Data/Time/Calendar/MonthDay.hs +++ b/Data/Time/Calendar/MonthDay.hs @@ -1,9 +1,7 @@ {-# OPTIONS -Wall -Werror #-} --- #hide module Data.Time.Calendar.MonthDay ( - -- * Month and day format monthAndDayToDayOfYear,dayOfYearToMonthAndDay,monthLength ) where diff --git a/Data/Time/Calendar/YearDay.hs b/Data/Time/Calendar/YearDay.hs index f860810..f8673cc 100644 --- a/Data/Time/Calendar/YearDay.hs +++ b/Data/Time/Calendar/YearDay.hs @@ -1,11 +1,6 @@ {-# OPTIONS -Wall -Werror #-} --- #hide -module Data.Time.Calendar.YearDay - ( - -- * Year and day format - module Data.Time.Calendar.YearDay - ) where +module Data.Time.Calendar.YearDay where import Data.Time.Calendar.Days import Data.Time.Calendar.Private diff --git a/Data/Time/LocalTime/Format.hs b/Data/Time/LocalTime/Format.hs index 3fbbe0e..c459796 100644 --- a/Data/Time/LocalTime/Format.hs +++ b/Data/Time/LocalTime/Format.hs @@ -11,6 +11,7 @@ import Data.Time.LocalTime.LocalTime import Data.Time.LocalTime.TimeOfDay import Data.Time.LocalTime.TimeZone import Data.Time.Calendar.ISO8601Week +import Data.Time.Calendar.YearDay import Data.Time.Calendar import Data.Time.Calendar.Private import Data.Time.Clock diff --git a/Makefile b/Makefile index b387425..30e47b9 100644 --- a/Makefile +++ b/Makefile @@ -99,8 +99,6 @@ Data/Time/Calendar/Gregorian.o : Data/Time/Calendar/YearDay.hi Data/Time/Calendar/Gregorian.o : Data/Time/Calendar/MonthDay.hi Data/Time/Calendar.o : Data/Time/Calendar.hs Data/Time/Calendar.o : Data/Time/Calendar/Gregorian.hi -Data/Time/Calendar.o : Data/Time/Calendar/MonthDay.hi -Data/Time/Calendar.o : Data/Time/Calendar/YearDay.hi Data/Time/Calendar.o : Data/Time/Calendar/Days.hi Data/Time/Calendar/ISO8601Week.o : Data/Time/Calendar/ISO8601Week.hs Data/Time/Calendar/ISO8601Week.o : Data/Time/Calendar/Private.hi @@ -150,6 +148,7 @@ Data/Time/LocalTime/Format.o : Data/Time/Clock/POSIX.hi Data/Time/LocalTime/Format.o : Data/Time/Clock.hi Data/Time/LocalTime/Format.o : Data/Time/Calendar/Private.hi Data/Time/LocalTime/Format.o : Data/Time/Calendar.hi +Data/Time/LocalTime/Format.o : Data/Time/Calendar/YearDay.hi Data/Time/LocalTime/Format.o : Data/Time/Calendar/ISO8601Week.hi Data/Time/LocalTime/Format.o : Data/Time/LocalTime/TimeZone.hi Data/Time/LocalTime/Format.o : Data/Time/LocalTime/TimeOfDay.hi diff --git a/TimeLib.cabal b/TimeLib.cabal index 16a43c7..828074e 100644 --- a/TimeLib.cabal +++ b/TimeLib.cabal @@ -12,6 +12,8 @@ Synopsis: a new time library Exposed-modules: Data.Fixed, Data.Time.Calendar, + Data.Time.Calendar.MonthDay, + Data.Time.Calendar.YearDay, Data.Time.Calendar.ISO8601Week, Data.Time.Calendar.Julian, Data.Time.Calendar.Easter, @@ -24,8 +26,6 @@ C-Sources: timestuff.c Other-modules: Data.Time.Calendar.Private, Data.Time.Calendar.Days, - Data.Time.Calendar.YearDay, - Data.Time.Calendar.MonthDay, Data.Time.Calendar.Gregorian, Data.Time.Calendar.JulianYearDay, Data.Time.Clock.Scale, From git at git.haskell.org Mon Feb 20 21:10:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:10:07 +0000 (UTC) Subject: [commit: packages/time] format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis: fix tests; rename ISO 8601 modules (be389b5) Message-ID: <20170220211007.AB1433A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/be389b5fa0e1fb037903c464139386ae87935cb2 >--------------------------------------------------------------- commit be389b5fa0e1fb037903c464139386ae87935cb2 Author: Ashley Yakeley Date: Sun Nov 27 20:06:14 2005 -0800 fix tests; rename ISO 8601 modules darcs-hash:20051128040614-ac6dd-83a5a6ba7fa4764ae4e9b8cfea18401f260f3aeb >--------------------------------------------------------------- be389b5fa0e1fb037903c464139386ae87935cb2 Data/Time/Calendar/Gregorian.hs | 2 +- Data/Time/Calendar/{YearDay.hs => OrdinalDate.hs} | 2 +- Data/Time/Calendar/{ISO8601Week.hs => WeekDate.hs} | 4 ++-- Data/Time/LocalTime/Format.hs | 4 ++-- Makefile | 24 +++++++++++----------- TimeLib.cabal | 4 ++-- TimeLib.xcodeproj/project.pbxproj | 8 ++++---- test/ClipDates.hs | 3 ++- test/ConvertBack.hs | 3 ++- test/LongWeekYears.hs | 3 ++- test/TestCalendars.hs | 2 +- test/TestMonthDay.hs | 2 +- test/TestTime.hs | 3 ++- test/UseCases.lhs | 1 + 14 files changed, 35 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 be389b5fa0e1fb037903c464139386ae87935cb2 From git at git.haskell.org Mon Feb 20 21:10:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:10:09 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: more sensible WeekDate and OrdinalDate names (4752044) Message-ID: <20170220211009.B3C0C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/47520443fcfea4a54bd3e894584e7c1d998d9534 >--------------------------------------------------------------- commit 47520443fcfea4a54bd3e894584e7c1d998d9534 Author: Ashley Yakeley Date: Sun Nov 27 20:40:59 2005 -0800 more sensible WeekDate and OrdinalDate names darcs-hash:20051128044059-ac6dd-0840e1a031d533a71fb5e438f1e3d6bcaa67ee5a >--------------------------------------------------------------- 47520443fcfea4a54bd3e894584e7c1d998d9534 Data/Time/Calendar/Gregorian.hs | 4 ++-- Data/Time/Calendar/OrdinalDate.hs | 18 +++++++++--------- Data/Time/Calendar/WeekDate.hs | 22 +++++++++++----------- Data/Time/LocalTime/Format.hs | 16 ++++++++-------- test/ClipDates.hs | 4 ++-- test/ConvertBack.hs | 4 ++-- test/LongWeekYears.hs | 2 +- test/Makefile | 3 ++- test/TestCalendars.hs | 2 +- test/TestTime.hs | 2 +- test/UseCases.lhs | 4 ++-- 11 files changed, 41 insertions(+), 40 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 47520443fcfea4a54bd3e894584e7c1d998d9534 From git at git.haskell.org Mon Feb 20 21:10:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:10:11 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: version 0.3 (90f8854) Message-ID: <20170220211011.BAFCB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/90f8854bf4c9ae3c59c425ea9b9bdaf6eff39bfe >--------------------------------------------------------------- commit 90f8854bf4c9ae3c59c425ea9b9bdaf6eff39bfe Author: Ashley Yakeley Date: Sun Nov 27 20:41:54 2005 -0800 version 0.3 darcs-hash:20051128044154-ac6dd-7cc2b0fc15533e050ef0dd5838501b1030940f6e >--------------------------------------------------------------- 90f8854bf4c9ae3c59c425ea9b9bdaf6eff39bfe TimeLib.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TimeLib.cabal b/TimeLib.cabal index d8af9e5..2bdac30 100644 --- a/TimeLib.cabal +++ b/TimeLib.cabal @@ -1,5 +1,5 @@ Name: time -Version: 0.2.1 +Version: 0.3 Stability: Beta License: BSD3 License-File: LICENSE From git at git.haskell.org Mon Feb 20 21:10:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:10:13 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: haddock comments for formatTime and others (8573895) Message-ID: <20170220211013.C1BEB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/85738953ad2b075730cf79de9c557dc42f095504 >--------------------------------------------------------------- commit 85738953ad2b075730cf79de9c557dc42f095504 Author: Ashley Yakeley Date: Sat Dec 17 14:10:53 2005 -0800 haddock comments for formatTime and others darcs-hash:20051217221053-ac6dd-21a6dfbffaf15cc895532249c0b8a9cd451a97ca >--------------------------------------------------------------- 85738953ad2b075730cf79de9c557dc42f095504 Data/Time/Calendar/OrdinalDate.hs | 7 +-- Data/Time/Calendar/WeekDate.hs | 7 +-- Data/Time/LocalTime/Format.hs | 95 ++++++++++++++++++++++++++++++++++++++- 3 files changed, 102 insertions(+), 7 deletions(-) diff --git a/Data/Time/Calendar/OrdinalDate.hs b/Data/Time/Calendar/OrdinalDate.hs index 94a1bfa..7c2099a 100644 --- a/Data/Time/Calendar/OrdinalDate.hs +++ b/Data/Time/Calendar/OrdinalDate.hs @@ -1,11 +1,12 @@ {-# OPTIONS -Wall -Werror #-} +-- | ISO 8601 Ordinal Date format module Data.Time.Calendar.OrdinalDate where import Data.Time.Calendar.Days import Data.Time.Calendar.Private --- | convert to ISO 8601 Ordinal Day format. First element of result is year (proleptic Gregoran calendar), +-- | convert to ISO 8601 Ordinal Date format. First element of result is year (proleptic Gregoran calendar), -- second is the day of the year, with 1 for Jan 1, and 365 (or 366 in leap years) for Dec 31. toOrdinalDate :: Day -> (Integer,Int) toOrdinalDate (ModifiedJulianDay mjd) = (year,yd) where @@ -20,14 +21,14 @@ toOrdinalDate (ModifiedJulianDay mjd) = (year,yd) where yd = fromInteger (d - (y * 365) + 1) year = quadcent * 400 + cent * 100 + quad * 4 + y + 1 --- | convert from ISO 8601 Ordinal Day format. +-- | convert from ISO 8601 Ordinal Date format. -- Invalid day numbers will be clipped to the correct range (1 to 365 or 366). fromOrdinalDate :: Integer -> Int -> Day fromOrdinalDate year day = ModifiedJulianDay mjd where y = year - 1 mjd = (fromIntegral (clip 1 (if isLeapYear year then 366 else 365) day)) + (365 * y) + (div y 4) - (div y 100) + (div y 400) - 678576 --- | show in ISO 8601 Ordinal Day format (yyyy-ddd) +-- | show in ISO 8601 Ordinal Date format (yyyy-ddd) showOrdinalDate :: Day -> String showOrdinalDate date = (show4 y) ++ "-" ++ (show3 d) where (y,d) = toOrdinalDate date diff --git a/Data/Time/Calendar/WeekDate.hs b/Data/Time/Calendar/WeekDate.hs index 1d4ebe5..a186ca9 100644 --- a/Data/Time/Calendar/WeekDate.hs +++ b/Data/Time/Calendar/WeekDate.hs @@ -1,12 +1,13 @@ {-# OPTIONS -Wall -Werror #-} +-- | ISO 8601 Week Date format module Data.Time.Calendar.WeekDate where import Data.Time.Calendar.OrdinalDate import Data.Time.Calendar.Days import Data.Time.Calendar.Private --- | convert to ISO 8601 Week format. First element of result is year, second week number (1-53), third day of week (1 for Monday to 7 for Sunday). +-- | convert to ISO 8601 Week Date format. First element of result is year, second week number (1-53), third day of week (1 for Monday to 7 for Sunday). -- Note that \"Week\" years are not quite the same as Gregorian years, as the first day of the year is always a Monday. -- The first week of a year is the first week to contain at least four days in the corresponding Gregorian year. toWeekDate :: Day -> (Integer,Int,Int) @@ -25,7 +26,7 @@ toWeekDate date@(ModifiedJulianDay mjd) = (y1,fromInteger (w1 + 1),fromInteger ( else (y0,w0) else (y0,w0) --- | convert from ISO 8601 Week format. First argument is year, second week number (1-52 or 53), third day of week (1 for Monday to 7 for Sunday). +-- | convert from ISO 8601 Week Date format. First argument is year, second week number (1-52 or 53), third day of week (1 for Monday to 7 for Sunday). -- Invalid week and day values will be clipped to the correct range. fromWeekDate :: Integer -> Int -> Int -> Day fromWeekDate y w d = ModifiedJulianDay (k - (mod k 7) + (toInteger (((clip 1 (if longYear then 53 else 52) w) * 7) + (clip 1 7 d))) - 10) where @@ -34,7 +35,7 @@ fromWeekDate y w d = ModifiedJulianDay (k - (mod k 7) + (toInteger (((clip 1 (if (_,53,_) -> True _ -> False --- | show in ISO 8601 Week format as yyyy-Www-dd (e.g. +-- | show in ISO 8601 Week Date format as yyyy-Www-dd (e.g. showWeekDate :: Day -> String showWeekDate date = (show4 y) ++ "-W" ++ (show2 w) ++ "-" ++ (show d) where (y,w,d) = toWeekDate date diff --git a/Data/Time/LocalTime/Format.hs b/Data/Time/LocalTime/Format.hs index 4f36f33..9564868 100644 --- a/Data/Time/LocalTime/Format.hs +++ b/Data/Time/LocalTime/Format.hs @@ -25,6 +25,99 @@ import Data.Char class FormatTime t where formatCharacter :: Char -> Maybe (TimeLocale -> t -> String) +-- | Substitute various time-related information for each %-code in the string, as per 'formatCharacter'. +-- +-- For all types (note these three are done here, not by 'formatCharacter'): +-- +-- [@%%@] @%@ +-- +-- [@%t@] tab +-- +-- [@%n@] newline +-- +-- For TimeZone (and ZonedTime and UTCTime): +-- +-- [@%z@] timezone offset +-- +-- [@%Z@] timezone name +-- +-- For LocalTime (and ZonedTime and UTCTime): +-- +-- [@%c@] as 'dateTimeFmt' @locale@ (e.g. @%a %b %e %H:%M:%S %Z %Y@) +-- +-- For TimeOfDay (and LocalTime and ZonedTime and UTCTime): +-- +-- [@%R@] same as @%H:%M@ +-- +-- [@%T@] same as @%H:%M:%S@ +-- +-- [@%X@] as 'timeFmt' @locale@ (e.g. @%H:%M:%S@) +-- +-- [@%r@] as 'time12Fmt' @locale@ (e.g. @%I:%M:%S %p@) +-- +-- [@%P@] day half from ('amPm' @locale@), converted to lowercase, @am@, @pm@ +-- +-- [@%p@] day half from ('amPm' @locale@), @AM@, @PM@ +-- +-- [@%H@] hour, 24-hour, leading 0 as needed, @00@ - @23@ +-- +-- [@%I@] hour, 12-hour, leading 0 as needed, @01@ - @12@ +-- +-- [@%k@] hour, 24-hour, leading space as needed, @ 0@ - @23@ +-- +-- [@%l@] hour, 12-hour, leading space as needed, @ 1@ - @12@ +-- +-- [@%M@] minute, @00@ - @59@ +-- +-- [@%S@] second with decimal part if not an integer, @00@ - @60.999999999999@ +-- +-- For UTCTime and ZonedTime: +-- +-- [@%s@] number of seconds since the Unix epoch +-- +-- For Day (and LocalTime and ZonedTime and UTCTime): +-- +-- [@%D@] same as @%m\/%d\/%y@ +-- +-- [@%F@] same as @%Y-%m-%d@ +-- +-- [@%x@] as 'dateFmt' @locale@ (e.g. @%m\/%d\/%y@) +-- +-- [@%Y@] year +-- +-- [@%y@] last two digits of year, @00@ - @99@ +-- +-- [@%C@] century (being the first two digits of the year), @00@ - @99@ +-- +-- [@%B@] month name, long form ('fst' from 'months' @locale@), @January@ - @December@ +-- +-- [@%b@, @%h@] month name, short form ('snd' from 'months' @locale@), @Jan@ - @Dec@ +-- +-- [@%m@] month of year, leading 0 as needed, @01@ - @12@ +-- +-- [@%d@] day of month, leading 0 as needed, @01@ - @31@ +-- +-- [@%e@] day of month, leading space as needed, @ 1@ - @31@ +-- +-- [@%j@] day of year for Ordinal Date format, @001@ - @366@ +-- +-- [@%G@] year for Week Date format +-- +-- [@%g@] last two digits of year for Week Date format, @00@ - @99@ +-- +-- [@%V@] week for Week Date format, @01@ - @53@ +-- +-- [@%u@] day for Week Date format, @1@ - @7@ +-- +-- [@%a@] day of week, short form ('snd' from 'wDays' @locale@), @Sun@ - @Sat@ +-- +-- [@%A@] day of week, long form ('fst' from 'wDays' @locale@), @Sunday@ - @Saturday@ +-- +-- [@%U@] week number of year, where weeks start on Sunday (as 'sundayStartWeek'), @01@ - @53@ +-- +-- [@%w@] day of week number, @0@ (= Sunday) - @6@ (= Saturday) +-- +-- [@%W@] week number of year, where weeks start on Monday (as 'mondayStartWeek'), @01@ - @53@ formatTime :: (FormatTime t) => TimeLocale -> String -> t -> String formatTime _ [] _ = "" formatTime locale ('%':c:cs) t = (formatChar c) ++ (formatTime locale cs t) where @@ -100,7 +193,7 @@ instance FormatTime Day where -- Day of Year formatCharacter 'j' = Just (\_ -> show3 . snd . toOrdinalDate) - -- ISOWeekDay + -- ISO 8601 Week Date formatCharacter 'G' = Just (\_ -> show . (\(y,_,_) -> y) . toWeekDate) formatCharacter 'g' = Just (\_ -> show2 . mod100 . (\(y,_,_) -> y) . toWeekDate) formatCharacter 'V' = Just (\_ -> show2 . (\(_,w,_) -> w) . toWeekDate) From git at git.haskell.org Mon Feb 20 21:10:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:10:15 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: move Data.Time.TAI to Data.Time.Clock.TAI (f99b7a1) Message-ID: <20170220211015.C9A643A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/f99b7a1d1f143053a1443b43663f2f34c9fc83a1 >--------------------------------------------------------------- commit f99b7a1d1f143053a1443b43663f2f34c9fc83a1 Author: Ashley Yakeley Date: Sat Dec 17 14:19:51 2005 -0800 move Data.Time.TAI to Data.Time.Clock.TAI darcs-hash:20051217221951-ac6dd-98191cd696896f70ab9883e60043ab442885518d >--------------------------------------------------------------- f99b7a1d1f143053a1443b43663f2f34c9fc83a1 Data/Time/{ => Clock}/TAI.hs | 2 +- Makefile | 12 ++++++------ TimeLib.cabal | 2 +- TimeLib.xcodeproj/project.pbxproj | 2 +- test/TestParseDAT.hs | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Data/Time/TAI.hs b/Data/Time/Clock/TAI.hs similarity index 99% rename from Data/Time/TAI.hs rename to Data/Time/Clock/TAI.hs index 23d3c08..00cebd5 100644 --- a/Data/Time/TAI.hs +++ b/Data/Time/Clock/TAI.hs @@ -1,7 +1,7 @@ {-# OPTIONS -Wall -Werror #-} -- | TAI and leap-second tables for converting to UTC: most people won't need this module. -module Data.Time.TAI +module Data.Time.Clock.TAI ( -- TAI arithmetic AbsoluteTime,taiEpoch,addAbsoluteTime,diffAbsoluteTime, diff --git a/Makefile b/Makefile index 15f4aae..f4960f2 100644 --- a/Makefile +++ b/Makefile @@ -23,8 +23,8 @@ SRCS = Data/Fixed.hs \ Data/Time/Clock/UTC.hs \ Data/Time/Clock/POSIX.hs \ Data/Time/Clock/Current.hs \ + Data/Time/Clock/TAI.hs \ Data/Time/Clock.hs \ - Data/Time/TAI.hs \ Data/Time/LocalTime/TimeZone.hs \ Data/Time/LocalTime/TimeOfDay.hs \ Data/Time/LocalTime/LocalTime.hs \ @@ -158,11 +158,11 @@ Data/Time/LocalTime.o : Data/Time/LocalTime/Format.hi Data/Time/LocalTime.o : Data/Time/LocalTime/LocalTime.hi Data/Time/LocalTime.o : Data/Time/LocalTime/TimeOfDay.hi Data/Time/LocalTime.o : Data/Time/LocalTime/TimeZone.hi -Data/Time/TAI.o : Data/Time/TAI.hs -Data/Time/TAI.o : Data/Fixed.hi -Data/Time/TAI.o : Data/Time/Clock.hi -Data/Time/TAI.o : Data/Time/Calendar/Days.hi -Data/Time/TAI.o : Data/Time/LocalTime.hi +Data/Time/Clock/TAI.o : Data/Time/Clock/TAI.hs +Data/Time/Clock/TAI.o : Data/Fixed.hi +Data/Time/Clock/TAI.o : Data/Time/Clock.hi +Data/Time/Clock/TAI.o : Data/Time/Calendar/Days.hi +Data/Time/Clock/TAI.o : Data/Time/LocalTime.hi Data/Time.o : Data/Time.hs Data/Time.o : Data/Time/LocalTime.hi Data/Time.o : Data/Time/Clock.hi diff --git a/TimeLib.cabal b/TimeLib.cabal index 2bdac30..04c1d97 100644 --- a/TimeLib.cabal +++ b/TimeLib.cabal @@ -18,7 +18,7 @@ Exposed-modules: Data.Time.Calendar.Julian, Data.Time.Calendar.Easter, Data.Time.Clock, - Data.Time.TAI, + Data.Time.Clock.TAI, Data.Time.LocalTime, Data.Time Extensions: ForeignFunctionInterface diff --git a/TimeLib.xcodeproj/project.pbxproj b/TimeLib.xcodeproj/project.pbxproj index a3e6a24..e382c8e 100644 --- a/TimeLib.xcodeproj/project.pbxproj +++ b/TimeLib.xcodeproj/project.pbxproj @@ -166,7 +166,6 @@ AB01DCFD08374838003C9EF7 /* Clock.hs */, AB2666A808A56FE30059DEC0 /* LocalTime */, AB2666E808A571460059DEC0 /* LocalTime.hs */, - AB01DCFE08374838003C9EF7 /* TAI.hs */, ); path = Time; sourceTree = ""; @@ -214,6 +213,7 @@ ABD67841084168B700CF37C0 /* UTC.hs */, ABD6783F084167B900CF37C0 /* POSIX.hs */, ABD67840084167D100CF37C0 /* Current.hs */, + AB01DCFE08374838003C9EF7 /* TAI.hs */, ); path = Clock; sourceTree = ""; diff --git a/test/TestParseDAT.hs b/test/TestParseDAT.hs index 2f53fab..ee56d49 100644 --- a/test/TestParseDAT.hs +++ b/test/TestParseDAT.hs @@ -3,7 +3,7 @@ module Main where import Data.Time -import Data.Time.TAI +import Data.Time.Clock.TAI import System.IO hSafeGetContents :: Handle -> IO String From git at git.haskell.org Mon Feb 20 21:10:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:10:17 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: sort out POSIX module mess (4bfc389) Message-ID: <20170220211017.D320A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/4bfc389bd98e0a25f2033dd53b3f77733c932e45 >--------------------------------------------------------------- commit 4bfc389bd98e0a25f2033dd53b3f77733c932e45 Author: Ashley Yakeley Date: Sat Dec 17 15:20:41 2005 -0800 sort out POSIX module mess darcs-hash:20051217232041-ac6dd-3796054df5e794cec4e432cc2a9b192ac0f0df5e >--------------------------------------------------------------- 4bfc389bd98e0a25f2033dd53b3f77733c932e45 Data/Time/Clock.hs | 13 +++++++--- Data/Time/Clock/{Current.hs => CTimeval.hs} | 21 ++++------------ Data/Time/Clock/POSIX.hs | 38 ++++++++++++++++++++++++++--- Data/Time/Clock/UTC.hs | 32 +----------------------- Data/Time/LocalTime/TimeOfDay.hs | 8 +++--- Makefile | 15 +++++++++--- TimeLib.cabal | 5 ++-- TimeLib.xcodeproj/project.pbxproj | 6 +++-- test/TestFormat.hs | 2 +- 9 files changed, 73 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 4bfc389bd98e0a25f2033dd53b3f77733c932e45 From git at git.haskell.org Mon Feb 20 21:10:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:10:19 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Big Split into separate fixed and time packages (f82aac1) Message-ID: <20170220211019.DFA603A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/f82aac1e2d97ce199dba3c5b7875ed3717cf3d79 >--------------------------------------------------------------- commit f82aac1e2d97ce199dba3c5b7875ed3717cf3d79 Author: Ashley Yakeley Date: Sun Feb 5 21:42:30 2006 -0800 Big Split into separate fixed and time packages darcs-hash:20060206054230-ac6dd-a970e95db4cf6337537aaf779596636f8b92f5fe >--------------------------------------------------------------- f82aac1e2d97ce199dba3c5b7875ed3717cf3d79 Makefile | 189 ++------------------- TimeLib.xcodeproj/project.pbxproj | 68 ++++++-- {Data => fixed/Data}/Fixed.hs | 0 LICENSE => fixed/LICENSE | 2 +- fixed/Makefile | 61 +++++++ Setup.hs => fixed/Setup.hs | 0 fixed/fixed.cabal | 13 ++ fixed/test/Makefile | 39 +++++ {test => fixed/test}/TestFixed.hs | 0 {test => fixed/test}/TestFixed.ref | 0 test/Makefile | 97 ----------- {Data => time/Data}/Time.hs | 0 {Data => time/Data}/Time/Calendar.hs | 0 {Data => time/Data}/Time/Calendar/Days.hs | 0 {Data => time/Data}/Time/Calendar/Easter.hs | 0 {Data => time/Data}/Time/Calendar/Gregorian.hs | 0 {Data => time/Data}/Time/Calendar/Julian.hs | 0 {Data => time/Data}/Time/Calendar/JulianYearDay.hs | 0 {Data => time/Data}/Time/Calendar/MonthDay.hs | 0 {Data => time/Data}/Time/Calendar/OrdinalDate.hs | 0 {Data => time/Data}/Time/Calendar/Private.hs | 0 {Data => time/Data}/Time/Calendar/WeekDate.hs | 0 {Data => time/Data}/Time/Clock.hs | 0 {Data => time/Data}/Time/Clock/CTimeval.hs | 0 {Data => time/Data}/Time/Clock/POSIX.hs | 0 {Data => time/Data}/Time/Clock/Scale.hs | 0 {Data => time/Data}/Time/Clock/TAI.hs | 0 {Data => time/Data}/Time/Clock/UTC.hs | 0 {Data => time/Data}/Time/LocalTime.hs | 0 {Data => time/Data}/Time/LocalTime/Format.hs | 0 {Data => time/Data}/Time/LocalTime/LocalTime.hs | 0 {Data => time/Data}/Time/LocalTime/TimeOfDay.hs | 0 {Data => time/Data}/Time/LocalTime/TimeZone.hs | 0 LICENSE => time/LICENSE | 0 Makefile => time/Makefile | 54 +++--- Setup.hs => time/Setup.hs | 0 {test => time/test}/AddDays.hs | 0 {test => time/test}/AddDays.ref | 0 {test => time/test}/ClipDates.hs | 0 {test => time/test}/ClipDates.ref | 0 {test => time/test}/ConvertBack.hs | 0 {test => time/test}/CurrentTime.hs | 0 {test => time/test}/LongWeekYears.hs | 0 {test => time/test}/LongWeekYears.ref | 0 time/test/Makefile | 93 ++++++++++ {test => time/test}/ShowDST.hs | 0 {test => time/test}/TestCalendars.hs | 0 {test => time/test}/TestCalendars.ref | 0 {test => time/test}/TestEaster.hs | 0 {test => time/test}/TestEaster.ref | 0 {test => time/test}/TestFormat.hs | 0 {test => time/test}/TestFormatStuff.c | 0 {test => time/test}/TestFormatStuff.h | 0 {test => time/test}/TestMonthDay.hs | 0 {test => time/test}/TestMonthDay.ref | 0 {test => time/test}/TestParseDAT.hs | 0 {test => time/test}/TestParseDAT.ref | 0 {test => time/test}/TestTime.hs | 0 {test => time/test}/TestTime.ref | 0 {test => time/test}/TimeZone.hs | 0 {test => time/test}/UseCases.lhs | 0 {test => time/test}/tai-utc.dat | 0 TimeLib.cabal => time/time.cabal | 3 +- timestuff.c => time/timestuff.c | 0 timestuff.h => time/timestuff.h | 0 65 files changed, 312 insertions(+), 307 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 f82aac1e2d97ce199dba3c5b7875ed3717cf3d79 From git at git.haskell.org Mon Feb 20 21:10:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:10:21 +0000 (UTC) Subject: [commit: packages/time] format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis: add missing file; README file; root Makefile clean fix (76b8ca2) Message-ID: <20170220211021.E6D033A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/76b8ca2b62a41a3bddf727de841d35aac11df6d5 >--------------------------------------------------------------- commit 76b8ca2b62a41a3bddf727de841d35aac11df6d5 Author: Ashley Yakeley Date: Sun Feb 5 22:36:47 2006 -0800 add missing file; README file; root Makefile clean fix darcs-hash:20060206063647-ac6dd-e953bb4a546bdbadc1547fcc27f8f30f537eb435 >--------------------------------------------------------------- 76b8ca2b62a41a3bddf727de841d35aac11df6d5 Makefile | 2 +- README | 24 ++++++++++++++++++++++++ time/Data/Time/Clock/UTCDiff.hs | 15 +++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 571d69a..46d68a2 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,6 @@ doc: sources haddock -h -o haddock `cat sources` clean: - rm -f sources + rm -f sources haddock cd time && make clean cd fixed && make clean diff --git a/README b/README new file mode 100644 index 0000000..7661654 --- /dev/null +++ b/README @@ -0,0 +1,24 @@ +This contains two packages, "fixed" and "time". They can each be built with Cabal. "time" depends on "fixed". + + cd fixed + runghc Setup.hs configure + runghc Setup.hs build + sudo runghc Setup.hs install + cd .. + + cd time + runghc Setup.hs configure + runghc Setup.hs build + sudo runghc Setup.hs install + cd .. + +You can use it with ghci: + + $ ghci + Prelude> :m +Data.Time + Prelude Data.Time> t <- getCurrentTime + Prelude Data.Time> t + 2006-02-06 06:31:43.859082 UTC + Prelude Data.Time> zt <- getZonedTime + Prelude Data.Time> zt + 2006-02-05 22:32:32.948607 PST diff --git a/time/Data/Time/Clock/UTCDiff.hs b/time/Data/Time/Clock/UTCDiff.hs new file mode 100644 index 0000000..66a2a48 --- /dev/null +++ b/time/Data/Time/Clock/UTCDiff.hs @@ -0,0 +1,15 @@ +{-# OPTIONS -Wall -Werror #-} + +-- #hide +module Data.Time.Clock.UTCDiff where + +import Data.Time.Clock.POSIX +import Data.Time.Clock.UTC + +-- | addUTCTime a b = a + b +addUTCTime :: NominalDiffTime -> UTCTime -> UTCTime +addUTCTime x t = posixSecondsToUTCTime (x + (utcTimeToPOSIXSeconds t)) + +-- | diffUTCTime a b = a - b +diffUTCTime :: UTCTime -> UTCTime -> NominalDiffTime +diffUTCTime a b = (utcTimeToPOSIXSeconds a) - (utcTimeToPOSIXSeconds b) From git at git.haskell.org Mon Feb 20 21:10:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:10:23 +0000 (UTC) Subject: [commit: packages/time] format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis: export isLeapYear in Calendar; new version (eb6d142) Message-ID: <20170220211023.ED5A53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/eb6d142d93f770efa3424ac923fe43c3ffabf0ca >--------------------------------------------------------------- commit eb6d142d93f770efa3424ac923fe43c3ffabf0ca Author: Ashley Yakeley Date: Sat Mar 18 19:47:59 2006 -0800 export isLeapYear in Calendar; new version darcs-hash:20060319034759-ac6dd-c81de3b9819edf8f99dd95e5e34af1871d29fab8 >--------------------------------------------------------------- eb6d142d93f770efa3424ac923fe43c3ffabf0ca time/Data/Time/Calendar/Gregorian.hs | 5 ++++- time/time.cabal | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/time/Data/Time/Calendar/Gregorian.hs b/time/Data/Time/Calendar/Gregorian.hs index 9fe381d..2d3546c 100644 --- a/time/Data/Time/Calendar/Gregorian.hs +++ b/time/Data/Time/Calendar/Gregorian.hs @@ -9,7 +9,10 @@ module Data.Time.Calendar.Gregorian -- calendrical arithmetic -- e.g. "one month after March 31st" addGregorianMonthsClip,addGregorianMonthsRollOver, - addGregorianYearsClip,addGregorianYearsRollOver + addGregorianYearsClip,addGregorianYearsRollOver, + + -- re-exported from OrdinalDate + isLeapYear ) where import Data.Time.Calendar.MonthDay diff --git a/time/time.cabal b/time/time.cabal index c682d8c..c0f0fe5 100644 --- a/time/time.cabal +++ b/time/time.cabal @@ -1,5 +1,5 @@ Name: time -Version: 0.3 +Version: 0.3.1 Stability: Beta License: BSD3 License-File: LICENSE From git at git.haskell.org Mon Feb 20 21:10:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:10:26 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: remove everything not part of time package (df1c341) Message-ID: <20170220211026.012C53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/df1c341543873de7d250d9ef92a726647d3ef665 >--------------------------------------------------------------- commit df1c341543873de7d250d9ef92a726647d3ef665 Author: Ashley Yakeley Date: Mon May 1 00:20:30 2006 -0700 remove everything not part of time package darcs-hash:20060501072030-ac6dd-fd9cd75b438585429686c16d0d5b1cd27dd17f31 >--------------------------------------------------------------- df1c341543873de7d250d9ef92a726647d3ef665 LICENSE | 10 ---- Makefile | 24 --------- README | 24 --------- fixed/Data/Fixed.hs | 124 ----------------------------------------------- fixed/LICENSE | 10 ---- fixed/Makefile | 61 ----------------------- fixed/Setup.hs | 2 - fixed/fixed.cabal | 13 ----- fixed/test/Makefile | 39 --------------- fixed/test/TestFixed.hs | 25 ---------- fixed/test/TestFixed.ref | 72 --------------------------- 11 files changed, 404 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 df1c341543873de7d250d9ef92a726647d3ef665 From git at git.haskell.org Mon Feb 20 21:10:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:10:28 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: move time files to proper place (e29bc42) Message-ID: <20170220211028.095B53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/e29bc429afa968dad1a372108a8efd62be28cf03 >--------------------------------------------------------------- commit e29bc429afa968dad1a372108a8efd62be28cf03 Author: Ashley Yakeley Date: Mon May 1 01:07:37 2006 -0700 move time files to proper place darcs-hash:20060501080737-ac6dd-1516981211d8e07fa5bbb97c1e4c24b0cb4661b2 >--------------------------------------------------------------- e29bc429afa968dad1a372108a8efd62be28cf03 {time/Data => Data}/Time.hs | 0 {time/Data => Data}/Time/Calendar.hs | 0 {time/Data => Data}/Time/Calendar/Days.hs | 0 {time/Data => Data}/Time/Calendar/Easter.hs | 0 {time/Data => Data}/Time/Calendar/Gregorian.hs | 0 {time/Data => Data}/Time/Calendar/Julian.hs | 0 {time/Data => Data}/Time/Calendar/JulianYearDay.hs | 0 {time/Data => Data}/Time/Calendar/MonthDay.hs | 0 {time/Data => Data}/Time/Calendar/OrdinalDate.hs | 0 {time/Data => Data}/Time/Calendar/Private.hs | 0 {time/Data => Data}/Time/Calendar/WeekDate.hs | 0 {time/Data => Data}/Time/Clock.hs | 0 {time/Data => Data}/Time/Clock/CTimeval.hs | 0 {time/Data => Data}/Time/Clock/POSIX.hs | 0 {time/Data => Data}/Time/Clock/Scale.hs | 0 {time/Data => Data}/Time/Clock/TAI.hs | 0 {time/Data => Data}/Time/Clock/UTC.hs | 0 {time/Data => Data}/Time/Clock/UTCDiff.hs | 0 {time/Data => Data}/Time/LocalTime.hs | 0 {time/Data => Data}/Time/LocalTime/Format.hs | 0 {time/Data => Data}/Time/LocalTime/LocalTime.hs | 0 {time/Data => Data}/Time/LocalTime/TimeOfDay.hs | 0 {time/Data => Data}/Time/LocalTime/TimeZone.hs | 0 time/LICENSE => LICENSE | 0 time/Setup.hs => Setup.hs | 0 time/time.cabal => time.cabal | 4 ++-- time/timestuff.c => timestuff.c | 0 time/timestuff.h => timestuff.h | 0 28 files changed, 2 insertions(+), 2 deletions(-) diff --git a/time/Data/Time.hs b/Data/Time.hs similarity index 100% rename from time/Data/Time.hs rename to Data/Time.hs diff --git a/time/Data/Time/Calendar.hs b/Data/Time/Calendar.hs similarity index 100% rename from time/Data/Time/Calendar.hs rename to Data/Time/Calendar.hs diff --git a/time/Data/Time/Calendar/Days.hs b/Data/Time/Calendar/Days.hs similarity index 100% rename from time/Data/Time/Calendar/Days.hs rename to Data/Time/Calendar/Days.hs diff --git a/time/Data/Time/Calendar/Easter.hs b/Data/Time/Calendar/Easter.hs similarity index 100% rename from time/Data/Time/Calendar/Easter.hs rename to Data/Time/Calendar/Easter.hs diff --git a/time/Data/Time/Calendar/Gregorian.hs b/Data/Time/Calendar/Gregorian.hs similarity index 100% rename from time/Data/Time/Calendar/Gregorian.hs rename to Data/Time/Calendar/Gregorian.hs diff --git a/time/Data/Time/Calendar/Julian.hs b/Data/Time/Calendar/Julian.hs similarity index 100% rename from time/Data/Time/Calendar/Julian.hs rename to Data/Time/Calendar/Julian.hs diff --git a/time/Data/Time/Calendar/JulianYearDay.hs b/Data/Time/Calendar/JulianYearDay.hs similarity index 100% rename from time/Data/Time/Calendar/JulianYearDay.hs rename to Data/Time/Calendar/JulianYearDay.hs diff --git a/time/Data/Time/Calendar/MonthDay.hs b/Data/Time/Calendar/MonthDay.hs similarity index 100% rename from time/Data/Time/Calendar/MonthDay.hs rename to Data/Time/Calendar/MonthDay.hs diff --git a/time/Data/Time/Calendar/OrdinalDate.hs b/Data/Time/Calendar/OrdinalDate.hs similarity index 100% rename from time/Data/Time/Calendar/OrdinalDate.hs rename to Data/Time/Calendar/OrdinalDate.hs diff --git a/time/Data/Time/Calendar/Private.hs b/Data/Time/Calendar/Private.hs similarity index 100% rename from time/Data/Time/Calendar/Private.hs rename to Data/Time/Calendar/Private.hs diff --git a/time/Data/Time/Calendar/WeekDate.hs b/Data/Time/Calendar/WeekDate.hs similarity index 100% rename from time/Data/Time/Calendar/WeekDate.hs rename to Data/Time/Calendar/WeekDate.hs diff --git a/time/Data/Time/Clock.hs b/Data/Time/Clock.hs similarity index 100% rename from time/Data/Time/Clock.hs rename to Data/Time/Clock.hs diff --git a/time/Data/Time/Clock/CTimeval.hs b/Data/Time/Clock/CTimeval.hs similarity index 100% rename from time/Data/Time/Clock/CTimeval.hs rename to Data/Time/Clock/CTimeval.hs diff --git a/time/Data/Time/Clock/POSIX.hs b/Data/Time/Clock/POSIX.hs similarity index 100% rename from time/Data/Time/Clock/POSIX.hs rename to Data/Time/Clock/POSIX.hs diff --git a/time/Data/Time/Clock/Scale.hs b/Data/Time/Clock/Scale.hs similarity index 100% rename from time/Data/Time/Clock/Scale.hs rename to Data/Time/Clock/Scale.hs diff --git a/time/Data/Time/Clock/TAI.hs b/Data/Time/Clock/TAI.hs similarity index 100% rename from time/Data/Time/Clock/TAI.hs rename to Data/Time/Clock/TAI.hs diff --git a/time/Data/Time/Clock/UTC.hs b/Data/Time/Clock/UTC.hs similarity index 100% rename from time/Data/Time/Clock/UTC.hs rename to Data/Time/Clock/UTC.hs diff --git a/time/Data/Time/Clock/UTCDiff.hs b/Data/Time/Clock/UTCDiff.hs similarity index 100% rename from time/Data/Time/Clock/UTCDiff.hs rename to Data/Time/Clock/UTCDiff.hs diff --git a/time/Data/Time/LocalTime.hs b/Data/Time/LocalTime.hs similarity index 100% rename from time/Data/Time/LocalTime.hs rename to Data/Time/LocalTime.hs diff --git a/time/Data/Time/LocalTime/Format.hs b/Data/Time/LocalTime/Format.hs similarity index 100% rename from time/Data/Time/LocalTime/Format.hs rename to Data/Time/LocalTime/Format.hs diff --git a/time/Data/Time/LocalTime/LocalTime.hs b/Data/Time/LocalTime/LocalTime.hs similarity index 100% rename from time/Data/Time/LocalTime/LocalTime.hs rename to Data/Time/LocalTime/LocalTime.hs diff --git a/time/Data/Time/LocalTime/TimeOfDay.hs b/Data/Time/LocalTime/TimeOfDay.hs similarity index 100% rename from time/Data/Time/LocalTime/TimeOfDay.hs rename to Data/Time/LocalTime/TimeOfDay.hs diff --git a/time/Data/Time/LocalTime/TimeZone.hs b/Data/Time/LocalTime/TimeZone.hs similarity index 100% rename from time/Data/Time/LocalTime/TimeZone.hs rename to Data/Time/LocalTime/TimeZone.hs diff --git a/time/LICENSE b/LICENSE similarity index 100% rename from time/LICENSE rename to LICENSE diff --git a/time/Setup.hs b/Setup.hs similarity index 100% rename from time/Setup.hs rename to Setup.hs diff --git a/time/time.cabal b/time.cabal similarity index 94% rename from time/time.cabal rename to time.cabal index c0f0fe5..4d8ebf5 100644 --- a/time/time.cabal +++ b/time.cabal @@ -7,8 +7,8 @@ Author: Ashley Yakeley Maintainer: Homepage: http://semantic.org/TimeLib/ Category: -Build-Depends: base, fixed -Synopsis: a new time library +Build-Depends: base +Synopsis: time library Exposed-modules: Data.Time.Calendar, Data.Time.Calendar.MonthDay, diff --git a/time/timestuff.c b/timestuff.c similarity index 100% rename from time/timestuff.c rename to timestuff.c diff --git a/time/timestuff.h b/timestuff.h similarity index 100% rename from time/timestuff.h rename to timestuff.h From git at git.haskell.org Mon Feb 20 21:10:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:10:30 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: make suitable for build process (7d86eaa) Message-ID: <20170220211030.10CFF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/7d86eaa6b7ef59d9fb09c9b1cbe74c76621404b3 >--------------------------------------------------------------- commit 7d86eaa6b7ef59d9fb09c9b1cbe74c76621404b3 Author: Ashley Yakeley Date: Mon May 1 02:21:11 2006 -0700 make suitable for build process darcs-hash:20060501092111-ac6dd-5bffa4956f92b470779215f8b501d2cb7e7fcafc >--------------------------------------------------------------- 7d86eaa6b7ef59d9fb09c9b1cbe74c76621404b3 Makefile | 23 +++++++++++++++++++++++ Setup.hs | 2 -- timestuff.h => include/timestuff.h | 0 time.cabal => package.conf.in | 7 +++++-- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..33c2a3f --- /dev/null +++ b/Makefile @@ -0,0 +1,23 @@ +TOP=.. +include $(TOP)/mk/boilerplate.mk + +SUBDIRS = + +ALL_DIRS = \ + Data \ + Data/Time \ + Data/Time/Calendar \ + Data/Time/Clock \ + Data/Time/LocalTime + +PACKAGE = time +VERSION = 0.3.1 +PACKAGE_DEPS = base + +SRC_HC_OPTS += -Wall -Werror -fffi -Iinclude + +SRC_CC_OPTS += -Wall -Werror -Iinclude + +SRC_HADDOCK_OPTS += -t "Haskell Hierarchical Libraries ($(PACKAGE) package)" + +include $(TOP)/mk/target.mk diff --git a/Setup.hs b/Setup.hs deleted file mode 100644 index 9a994af..0000000 --- a/Setup.hs +++ /dev/null @@ -1,2 +0,0 @@ -import Distribution.Simple -main = defaultMain diff --git a/timestuff.h b/include/timestuff.h similarity index 100% rename from timestuff.h rename to include/timestuff.h diff --git a/time.cabal b/package.conf.in similarity index 90% copy from time.cabal copy to package.conf.in index 4d8ebf5..eec6b3a 100644 --- a/time.cabal +++ b/package.conf.in @@ -1,11 +1,12 @@ -Name: time -Version: 0.3.1 +Name: PACKAGE +Version: VERSION Stability: Beta License: BSD3 License-File: LICENSE Author: Ashley Yakeley Maintainer: Homepage: http://semantic.org/TimeLib/ +exposed: True Category: Build-Depends: base Synopsis: time library @@ -36,3 +37,5 @@ Other-modules: Data.Time.LocalTime.TimeOfDay, Data.Time.LocalTime.LocalTime, Data.Time.LocalTime.Format +include-dirs: INCLUDE_DIR +includes: "timestuff.h" From git at git.haskell.org Mon Feb 20 21:10:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:10:32 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: haddock working with time package (021cdd7) Message-ID: <20170220211032.17FCA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/021cdd7549ae6472c25adaa7b3a49dac7af082b0 >--------------------------------------------------------------- commit 021cdd7549ae6472c25adaa7b3a49dac7af082b0 Author: Ashley Yakeley Date: Tue May 2 22:41:16 2006 -0700 haddock working with time package darcs-hash:20060503054116-ac6dd-5604e00093fa50793b3a97849988ca2530a82cc3 >--------------------------------------------------------------- 021cdd7549ae6472c25adaa7b3a49dac7af082b0 package.conf.in | 2 ++ prologue.txt | 2 ++ 2 files changed, 4 insertions(+) diff --git a/package.conf.in b/package.conf.in index eec6b3a..dd2a3cb 100644 --- a/package.conf.in +++ b/package.conf.in @@ -39,3 +39,5 @@ Other-modules: Data.Time.LocalTime.Format include-dirs: INCLUDE_DIR includes: "timestuff.h" +haddock-interfaces: HADDOCK_IFACE +haddock-html: HTML_DIR diff --git a/prologue.txt b/prologue.txt new file mode 100644 index 0000000..6fa7b04 --- /dev/null +++ b/prologue.txt @@ -0,0 +1,2 @@ +Clock and calendar time. + From git at git.haskell.org Mon Feb 20 21:10:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:10:34 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: set up boringfile (706483e) Message-ID: <20170220211034.20D193A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/706483e5b72570be046ca6c352540bca01507217 >--------------------------------------------------------------- commit 706483e5b72570be046ca6c352540bca01507217 Author: Ashley Yakeley Date: Wed May 3 23:20:30 2006 -0700 set up boringfile darcs-hash:20060504062030-ac6dd-233eb703d26a826c1c664cf52f3d8a23dd5a8203 >--------------------------------------------------------------- 706483e5b72570be046ca6c352540bca01507217 .darcs-boring | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/.darcs-boring b/.darcs-boring new file mode 100644 index 0000000..61e18b4 --- /dev/null +++ b/.darcs-boring @@ -0,0 +1,43 @@ +# Boring file regexps: +\.hi$ +\.o$ +\.p_hi$ +\.p_o$ +\.raw-hs$ +_split$ +\.a$ +(^|/)dist$ +(^|/)package.conf.inplace$ +(^|/)package.conf.installed$ +(^|/)\.depend$ +(^|/)\.setup-config$ +\.haddock$ +\.o\.cmd$ +\.ko$ +\.ko\.cmd$ +\.mod\.c$ +(^|/)\.tmp_versions($|/) +(^|/)CVS($|/) +(^|/)RCS($|/) +~$ +#(^|/)\.[^/] +(^|/)_darcs($|/) +\.bak$ +\.BAK$ +\.orig$ +(^|/)vssver\.scc$ +\.swp$ +(^|/)MT($|/) +(^|/)\{arch\}($|/) +(^|/).arch-ids($|/) +(^|/), +\.class$ +\.prof$ +(^|/)\.DS_Store$ +(^|/)BitKeeper($|/) +(^|/)ChangeSet($|/) +(^|/)\.svn($|/) +\.py[co]$ +\# +\.cvsignore$ +(^|/)Thumbs\.db$ From git at git.haskell.org Mon Feb 20 21:10:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:10:36 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: XCode build and temp files are boring (e5ea873) Message-ID: <20170220211036.2732B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/e5ea873e700621b7221433617392fa79d2be732e >--------------------------------------------------------------- commit e5ea873e700621b7221433617392fa79d2be732e Author: Ashley Yakeley Date: Wed May 3 23:27:58 2006 -0700 XCode build and temp files are boring darcs-hash:20060504062758-ac6dd-3987f29736c7fb7e2286a95f7a2113addbc513e9 >--------------------------------------------------------------- e5ea873e700621b7221433617392fa79d2be732e .darcs-boring | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.darcs-boring b/.darcs-boring index 61e18b4..6c379a9 100644 --- a/.darcs-boring +++ b/.darcs-boring @@ -12,6 +12,9 @@ _split$ (^|/)\.depend$ (^|/)\.setup-config$ \.haddock$ +^build$ +\.xcodeproj/.*\.pbxuser$ +\.xcodeproj/.*\.mode1$ \.o\.cmd$ \.ko$ \.ko\.cmd$ From git at git.haskell.org Mon Feb 20 21:10:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:10:38 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Various fixes to make this build & work on Windows (4b425ec) Message-ID: <20170220211038.316653A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/4b425ec9819e4a3c0ae52a3f84c2094d46a1ceac >--------------------------------------------------------------- commit 4b425ec9819e4a3c0ae52a3f84c2094d46a1ceac Author: Simon Marlow Date: Mon May 29 05:25:23 2006 -0700 Various fixes to make this build & work on Windows A number of things didn't work on Windows: we were using gettimeofday() which doesn't exist, localtime_r() doesn't exist, the tm_zone field in struct tm doesn't exist, etc. * timestuff.{c,h} is now cbits/HsTime.c and includes/HsTime.h, for consistency with other packages * There's a configure script. Hence, a default Setup.hs will be required for using Cabal (I haven't added this yet, I think we were going to make some more changes in Cabal to make it optional). * fixed various problems in package.conf.in. I haven't tested time.cabal, I expect it doesn't work on Windows, but it might still work on Unix. * We get the current time from the native Win32 API. This requires the Win32 library, hence a conditional dependency on Win32. * some cursory testing on Win32, we can get the local time and the timezone looks ok. darcs-hash:20060529122523-760e2-1707aeb6dcf612f6c7c134b1eab52c1187a8305f >--------------------------------------------------------------- 4b425ec9819e4a3c0ae52a3f84c2094d46a1ceac Data/Time/Clock/CTimeval.hs | 7 +++++- Data/Time/Clock/POSIX.hs | 34 ++++++++++++++++++++++---- Data/Time/LocalTime/TimeZone.hs | 2 +- Makefile | 3 +++ aclocal.m4 | 19 +++++++++++++++ cbits/HsTime.c | 54 +++++++++++++++++++++++++++++++++++++++++ configure.ac | 15 ++++++++++++ include/HsTime.h | 13 ++++++++++ include/timestuff.h | 3 --- package.conf.in | 19 ++++++++++++--- time.cabal | 4 ++- timestuff.c | 14 ----------- 12 files changed, 158 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 4b425ec9819e4a3c0ae52a3f84c2094d46a1ceac From git at git.haskell.org Mon Feb 20 21:10:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:10:40 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: fix build breakage on Linux (a499f3f) Message-ID: <20170220211040.382033A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/a499f3f06163bbf84bf104334db88b28de599d63 >--------------------------------------------------------------- commit a499f3f06163bbf84bf104334db88b28de599d63 Author: Simon Marlow Date: Mon May 29 05:42:50 2006 -0700 fix build breakage on Linux darcs-hash:20060529124250-760e2-12bae2db16624f19ae6462abe185ae79d3a04ad2 >--------------------------------------------------------------- a499f3f06163bbf84bf104334db88b28de599d63 cbits/HsTime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cbits/HsTime.c b/cbits/HsTime.c index a63836f..6fd8342 100644 --- a/cbits/HsTime.c +++ b/cbits/HsTime.c @@ -6,7 +6,7 @@ long int get_current_timezone_seconds (time_t t,int* pdst,char const* * pname) struct tm* ptm; long gmtoff; int dst; - char *name; + const char *name; #if HAVE_LOCALTIME_R struct tm tmd; From git at git.haskell.org Mon Feb 20 21:10:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:10:42 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: CFILES directive for the benefit of Hugs (76bf7f8) Message-ID: <20170220211042.3E2F73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/76bf7f82a6d883d933b97f1187aef79cd3cebbfb >--------------------------------------------------------------- commit 76bf7f82a6d883d933b97f1187aef79cd3cebbfb Author: Ross Paterson Date: Tue May 30 16:29:48 2006 -0700 CFILES directive for the benefit of Hugs darcs-hash:20060530232948-b47d3-2ff97506454a770200384abb80b730d91a45c73d >--------------------------------------------------------------- 76bf7f82a6d883d933b97f1187aef79cd3cebbfb Data/Time/LocalTime/TimeZone.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/Data/Time/LocalTime/TimeZone.hs b/Data/Time/LocalTime/TimeZone.hs index 07c1c01..d80671e 100644 --- a/Data/Time/LocalTime/TimeZone.hs +++ b/Data/Time/LocalTime/TimeZone.hs @@ -52,6 +52,7 @@ instance Show TimeZone where utc :: TimeZone utc = TimeZone 0 False "UTC" +{-# CFILES cbits/HsTime.c #-} foreign import ccall unsafe "HsTime.h get_current_timezone_seconds" get_current_timezone_seconds :: CTime -> Ptr CInt -> Ptr CString -> IO CLong posixToCTime :: POSIXTime -> CTime From git at git.haskell.org Mon Feb 20 21:10:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:10:46 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: extra Cabal fields for clean and sdist (37fd2cd) Message-ID: <20170220211046.4C9093A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/37fd2cdcfa945dee219ecfa5e69f3b640da9321b >--------------------------------------------------------------- commit 37fd2cdcfa945dee219ecfa5e69f3b640da9321b Author: Ross Paterson Date: Tue May 30 16:51:52 2006 -0700 extra Cabal fields for clean and sdist darcs-hash:20060530235152-b47d3-782de042e361c2c70e3bdf8d7677f4fdf36314d4 >--------------------------------------------------------------- 37fd2cdcfa945dee219ecfa5e69f3b640da9321b time.cabal | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/time.cabal b/time.cabal index cce942c..89881a0 100644 --- a/time.cabal +++ b/time.cabal @@ -1,6 +1,6 @@ Name: time Version: 0.3.1 -Stability: Beta +Stability: beta License: BSD3 License-File: LICENSE Author: Ashley Yakeley @@ -9,7 +9,7 @@ Homepage: http://semantic.org/TimeLib/ Category: Build-Depends: base Synopsis: time library -Exposed-modules: +Exposed-Modules: Data.Time.Calendar, Data.Time.Calendar.MonthDay, Data.Time.Calendar.OrdinalDate, @@ -23,7 +23,7 @@ Exposed-modules: Data.Time Extensions: ForeignFunctionInterface C-Sources: HsTime.c -Other-modules: +Other-Modules: Data.Time.Calendar.Private, Data.Time.Calendar.Days, Data.Time.Calendar.Gregorian, @@ -36,5 +36,11 @@ Other-modules: Data.Time.LocalTime.TimeOfDay, Data.Time.LocalTime.LocalTime, Data.Time.LocalTime.Format -include-dirs: include -includes: "HsTime.h" +Extra-Source-Files: + configure.ac configure + include/HsTime.h include/HsTimeConfig.h.in +Extra-Tmp-Files: + config.log config.status autom4te.cache + include/HsTimeConfig.h +Include-Dirs: include +Includes: "HsTime.h" From git at git.haskell.org Mon Feb 20 21:10:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:10:44 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: remove dependency on ghcconfig.h (f67b546) Message-ID: <20170220211044.457863A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/f67b5466dd799a0ce8b7847a71b1fa9f2ad6f2c2 >--------------------------------------------------------------- commit f67b5466dd799a0ce8b7847a71b1fa9f2ad6f2c2 Author: Ross Paterson Date: Tue May 30 16:30:29 2006 -0700 remove dependency on ghcconfig.h darcs-hash:20060530233029-b47d3-8879f40442c09036bcb394df9f8bcf4f08a40d12 >--------------------------------------------------------------- f67b5466dd799a0ce8b7847a71b1fa9f2ad6f2c2 configure.ac | 1 + include/HsTime.h | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 51dbd33..f2e4186 100644 --- a/configure.ac +++ b/configure.ac @@ -5,6 +5,7 @@ AC_CONFIG_SRCDIR([include/HsTime.h]) AC_CONFIG_HEADERS([include/HsTimeConfig.h]) +AC_CHECK_HEADERS([time.h]) AC_CHECK_FUNCS([gmtime_r localtime_r]) AC_STRUCT_TM diff --git a/include/HsTime.h b/include/HsTime.h index b447792..b8da946 100644 --- a/include/HsTime.h +++ b/include/HsTime.h @@ -1,7 +1,6 @@ #ifndef __HSTIME_H__ #define __HSTIME_H__ -#include "ghcconfig.h" #include "HsTimeConfig.h" #if HAVE_TIME_H From git at git.haskell.org Mon Feb 20 21:10:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:10:48 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: fix typo (3721982) Message-ID: <20170220211048.52B5B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/37219827d0e5796eb716007399dcbf3270b73986 >--------------------------------------------------------------- commit 37219827d0e5796eb716007399dcbf3270b73986 Author: Simon Marlow Date: Tue Jun 6 05:16:20 2006 -0700 fix typo darcs-hash:20060606121620-760e2-1dc4cf4db92cbe47dcbfb7cca4b8f6e34df94c4d >--------------------------------------------------------------- 37219827d0e5796eb716007399dcbf3270b73986 package.conf.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.conf.in b/package.conf.in index f308e51..98922d7 100644 --- a/package.conf.in +++ b/package.conf.in @@ -47,7 +47,7 @@ Hidden-modules: Data.Time.LocalTime.Format import-dirs: IMPORT_DIR library-dirs: LIB_DIR -hs-libraries: "HSTime" +hs-libraries: "HStime" include-dirs: INCLUDE_DIR includes: "HsTime.h" haddock-interfaces: HADDOCK_IFACE From git at git.haskell.org Mon Feb 20 21:10:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:10:50 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: re-add #include "ghcconfig.h", conditional on __GLASGOW_HASKELL__ (17faab4) Message-ID: <20170220211050.595E83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/17faab4835a1decbb2c3dd5297b0073e56a8eed7 >--------------------------------------------------------------- commit 17faab4835a1decbb2c3dd5297b0073e56a8eed7 Author: simonmar Date: Tue Jun 6 05:38:41 2006 -0700 re-add #include "ghcconfig.h", conditional on __GLASGOW_HASKELL__ darcs-hash:20060606123841-3ed52-e9ff9e6558dfbbc2ed6b26a3abb430079749e9c4 >--------------------------------------------------------------- 17faab4835a1decbb2c3dd5297b0073e56a8eed7 include/HsTime.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/HsTime.h b/include/HsTime.h index b8da946..baca0d5 100644 --- a/include/HsTime.h +++ b/include/HsTime.h @@ -1,6 +1,9 @@ #ifndef __HSTIME_H__ #define __HSTIME_H__ +#ifdef __GLASGOW_HASKELL__ +#include "ghcconfig.h" +#endif #include "HsTimeConfig.h" #if HAVE_TIME_H From git at git.haskell.org Mon Feb 20 21:10:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:10:52 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: remove debugging code (580b6d2) Message-ID: <20170220211052.5F3973A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/580b6d2b0e3c6409b1592c508754460c079a3969 >--------------------------------------------------------------- commit 580b6d2b0e3c6409b1592c508754460c079a3969 Author: simonmar Date: Tue Jun 6 06:00:44 2006 -0700 remove debugging code darcs-hash:20060606130044-3ed52-0c26fad63e2d0cde23c686bccd51205105b702a5 >--------------------------------------------------------------- 580b6d2b0e3c6409b1592c508754460c079a3969 cbits/HsTime.c | 1 - 1 file changed, 1 deletion(-) diff --git a/cbits/HsTime.c b/cbits/HsTime.c index 6fd8342..133fd6c 100644 --- a/cbits/HsTime.c +++ b/cbits/HsTime.c @@ -29,7 +29,6 @@ long int get_current_timezone_seconds (time_t t,int* pdst,char const* * pname) # if mingw32_HOST_OS name = dst ? _tzname[1] : _tzname[0]; - printf("dst: %d, tzname0: %s, tzname1: %s\n", dst, _tzname[0], _tzname[1]); # elif HAVE_TZNAME name = *tzname; # else From git at git.haskell.org Mon Feb 20 21:10:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:10:54 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: use non-GHC-specific #ifdef test for Windows (d65e1de) Message-ID: <20170220211054.651943A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/d65e1de56921e9646f42f7cfda349100d57f1bba >--------------------------------------------------------------- commit d65e1de56921e9646f42f7cfda349100d57f1bba Author: Simon Marlow Date: Wed Jun 7 01:18:06 2006 -0700 use non-GHC-specific #ifdef test for Windows darcs-hash:20060607081806-760e2-001f4dfd1e83fba078f4d18274e0bda5ce8910c3 >--------------------------------------------------------------- d65e1de56921e9646f42f7cfda349100d57f1bba cbits/HsTime.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cbits/HsTime.c b/cbits/HsTime.c index 133fd6c..7e93fe8 100644 --- a/cbits/HsTime.c +++ b/cbits/HsTime.c @@ -26,8 +26,7 @@ long int get_current_timezone_seconds (time_t t,int* pdst,char const* * pname) name = ptm -> tm_zone; gmtoff = ptm -> tm_gmtoff; #else - -# if mingw32_HOST_OS +# if defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32) name = dst ? _tzname[1] : _tzname[0]; # elif HAVE_TZNAME name = *tzname; From git at git.haskell.org Mon Feb 20 21:10:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:10:56 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: no need to include ghcconfig.h any more (cecf1ab) Message-ID: <20170220211056.6B4873A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/cecf1abf74c74307c799d2f7555bcca2fb010f2a >--------------------------------------------------------------- commit cecf1abf74c74307c799d2f7555bcca2fb010f2a Author: Simon Marlow Date: Wed Jun 7 01:18:29 2006 -0700 no need to include ghcconfig.h any more darcs-hash:20060607081829-760e2-39d464373937cba058c1f6b2b6b6bfd5c16d98a5 >--------------------------------------------------------------- cecf1abf74c74307c799d2f7555bcca2fb010f2a include/HsTime.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/HsTime.h b/include/HsTime.h index baca0d5..b8da946 100644 --- a/include/HsTime.h +++ b/include/HsTime.h @@ -1,9 +1,6 @@ #ifndef __HSTIME_H__ #define __HSTIME_H__ -#ifdef __GLASGOW_HASKELL__ -#include "ghcconfig.h" -#endif #include "HsTimeConfig.h" #if HAVE_TIME_H From git at git.haskell.org Mon Feb 20 21:10:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:10:58 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: eliminate the other mingw32_HOST_OS test (0108ad0) Message-ID: <20170220211058.7267D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/0108ad00f1ea1b38f448a7a3462a1745b892467c >--------------------------------------------------------------- commit 0108ad00f1ea1b38f448a7a3462a1745b892467c Author: Ross Paterson Date: Wed Jun 7 01:35:28 2006 -0700 eliminate the other mingw32_HOST_OS test darcs-hash:20060607083528-b47d3-c41fa71af0c4ab114f85816306687ee85c2860a1 >--------------------------------------------------------------- 0108ad00f1ea1b38f448a7a3462a1745b892467c cbits/HsTime.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cbits/HsTime.c b/cbits/HsTime.c index 7e93fe8..f9651e9 100644 --- a/cbits/HsTime.c +++ b/cbits/HsTime.c @@ -25,18 +25,18 @@ long int get_current_timezone_seconds (time_t t,int* pdst,char const* * pname) #if HAVE_TM_ZONE name = ptm -> tm_zone; gmtoff = ptm -> tm_gmtoff; -#else -# if defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32) +#elif defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32) name = dst ? _tzname[1] : _tzname[0]; -# elif HAVE_TZNAME + gmtoff = dst ? _timezone - 3600 : _timezone; +#else + +# if HAVE_TZNAME name = *tzname; # else # error "Don't know how to get at timezone name on your OS" # endif -# if mingw32_HOST_OS - gmtoff = dst ? _timezone - 3600 : _timezone; -# elif HAVE_DECL_ALTZONE +# if HAVE_DECL_ALTZONE gmtoff = dst ? altzone : timezone; # else gmtoff = dst ? timezone - 3600 : timezone; From git at git.haskell.org Mon Feb 20 21:11:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:11:00 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Set version to 1.0 stable (0908d41) Message-ID: <20170220211100.796823A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/0908d41b2b54d964238138e073a560f73a7b48ae >--------------------------------------------------------------- commit 0908d41b2b54d964238138e073a560f73a7b48ae Author: Ashley Yakeley Date: Sun Jun 11 15:03:22 2006 -0700 Set version to 1.0 stable darcs-hash:20060611220322-ac6dd-ab053b27abeaf26b9342a0ae7c5151d61f1e95f5 >--------------------------------------------------------------- 0908d41b2b54d964238138e073a560f73a7b48ae Makefile | 2 +- time.cabal | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 9ee3b33..9c27f39 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ ALL_DIRS = \ Data/Time/LocalTime PACKAGE = time -VERSION = 0.3.1 +VERSION = 1.0 PACKAGE_DEPS = base SRC_HC_OPTS += -Wall -Werror -fffi -Iinclude diff --git a/time.cabal b/time.cabal index 89881a0..80096e6 100644 --- a/time.cabal +++ b/time.cabal @@ -1,6 +1,6 @@ Name: time -Version: 0.3.1 -Stability: beta +Version: 1.0 +Stability: stable License: BSD3 License-File: LICENSE Author: Ashley Yakeley From git at git.haskell.org Mon Feb 20 21:11:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:11:04 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: includes -> install-includes (ca25b1b) Message-ID: <20170220211104.8751C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/ca25b1ba1cedb6f9f94e5ecdc74c43712fe4abc4 >--------------------------------------------------------------- commit ca25b1ba1cedb6f9f94e5ecdc74c43712fe4abc4 Author: Ross Paterson Date: Tue Aug 29 05:37:45 2006 -0700 includes -> install-includes darcs-hash:20060829123745-b47d3-b412b445da8438997899714f0cd0d54c91e54595 >--------------------------------------------------------------- ca25b1ba1cedb6f9f94e5ecdc74c43712fe4abc4 time.cabal | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/time.cabal b/time.cabal index 672bd2a..1199bfd 100644 --- a/time.cabal +++ b/time.cabal @@ -43,4 +43,5 @@ Extra-Tmp-Files: config.log config.status autom4te.cache include/HsTimeConfig.h Include-Dirs: include -Includes: "HsTime.h" +Install-Includes: + HsTime.h HsTimeConfig.h From git at git.haskell.org Mon Feb 20 21:11:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:11:02 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: add aclocal.m4 to extra sources (4def2c0) Message-ID: <20170220211102.805743A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/4def2c0923b48c9b3dcfdf996b83163d82649c82 >--------------------------------------------------------------- commit 4def2c0923b48c9b3dcfdf996b83163d82649c82 Author: Ross Paterson Date: Tue Aug 29 05:36:40 2006 -0700 add aclocal.m4 to extra sources darcs-hash:20060829123640-b47d3-3e8a7c23975307c746b443eca30ca4c427468bcf >--------------------------------------------------------------- 4def2c0923b48c9b3dcfdf996b83163d82649c82 time.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/time.cabal b/time.cabal index 80096e6..672bd2a 100644 --- a/time.cabal +++ b/time.cabal @@ -37,7 +37,7 @@ Other-Modules: Data.Time.LocalTime.LocalTime, Data.Time.LocalTime.Format Extra-Source-Files: - configure.ac configure + aclocal.m4 configure.ac configure include/HsTime.h include/HsTimeConfig.h.in Extra-Tmp-Files: config.log config.status autom4te.cache From git at git.haskell.org Mon Feb 20 21:11:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:11:06 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: fix C-Sources (#893) (3b0c7d3) Message-ID: <20170220211106.8E6053A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/3b0c7d3c2f4953b9fa2d4d8ce14ae4ed2b1ab4b5 >--------------------------------------------------------------- commit 3b0c7d3c2f4953b9fa2d4d8ce14ae4ed2b1ab4b5 Author: Ross Paterson Date: Fri Sep 8 15:53:13 2006 -0700 fix C-Sources (#893) darcs-hash:20060908225313-b47d3-f3e63afec5f2173f6d7e535f6e6ee8a23094e725 >--------------------------------------------------------------- 3b0c7d3c2f4953b9fa2d4d8ce14ae4ed2b1ab4b5 time.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/time.cabal b/time.cabal index 1199bfd..8500d1a 100644 --- a/time.cabal +++ b/time.cabal @@ -22,7 +22,7 @@ Exposed-Modules: Data.Time.LocalTime, Data.Time Extensions: ForeignFunctionInterface -C-Sources: HsTime.c +C-Sources: cbits/HsTime.c Other-Modules: Data.Time.Calendar.Private, Data.Time.Calendar.Days, From git at git.haskell.org Mon Feb 20 21:11:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:11:08 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: note CPP extension (0323c8c) Message-ID: <20170220211108.958653A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/0323c8c75fc453d5945d177e4b17db8b7d032e73 >--------------------------------------------------------------- commit 0323c8c75fc453d5945d177e4b17db8b7d032e73 Author: Ross Paterson Date: Fri Sep 8 16:37:07 2006 -0700 note CPP extension darcs-hash:20060908233707-b47d3-78501ce27828a9dec451577e46d281e401b84277 >--------------------------------------------------------------- 0323c8c75fc453d5945d177e4b17db8b7d032e73 time.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/time.cabal b/time.cabal index 8500d1a..8720db3 100644 --- a/time.cabal +++ b/time.cabal @@ -21,7 +21,7 @@ Exposed-Modules: Data.Time.Clock.TAI, Data.Time.LocalTime, Data.Time -Extensions: ForeignFunctionInterface +Extensions: ForeignFunctionInterface, CPP C-Sources: cbits/HsTime.c Other-Modules: Data.Time.Calendar.Private, From git at git.haskell.org Mon Feb 20 21:11:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:11:10 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: fix up XCode project file for added files (b50f0c7) Message-ID: <20170220211110.9CF2F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/b50f0c78a16e3380759283b559dfec92e8f3f923 >--------------------------------------------------------------- commit b50f0c78a16e3380759283b559dfec92e8f3f923 Author: Ashley Yakeley Date: Sun Sep 24 15:11:49 2006 -0700 fix up XCode project file for added files darcs-hash:20060924221149-ac6dd-19f372cb63d0e2d981aaec9f0dd4ff79ad98c26a >--------------------------------------------------------------- b50f0c78a16e3380759283b559dfec92e8f3f923 TimeLib.xcodeproj/project.pbxproj | 153 +++++--------------------------------- 1 file changed, 18 insertions(+), 135 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 b50f0c78a16e3380759283b559dfec92e8f3f923 From git at git.haskell.org Mon Feb 20 21:11:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:11:12 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: add Setup.hs (de08f7e) Message-ID: <20170220211112.A401C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/de08f7e6870ea40f58f77719e08ca6562084f141 >--------------------------------------------------------------- commit de08f7e6870ea40f58f77719e08ca6562084f141 Author: Ross Paterson Date: Thu Sep 28 05:43:41 2006 -0700 add Setup.hs darcs-hash:20060928124341-b47d3-60393a942de235747b1fd6da3d2368850b46b3e4 >--------------------------------------------------------------- de08f7e6870ea40f58f77719e08ca6562084f141 Makefile | 2 ++ Setup.hs | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/Makefile b/Makefile index 9c27f39..e2d286b 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,8 @@ SRC_HC_OPTS += -Wall -Werror -fffi -Iinclude SRC_CC_OPTS += -Wall -Werror -Iinclude +EXCLUDED_SRCS += Setup.hs + SRC_HADDOCK_OPTS += -t "Haskell Hierarchical Libraries ($(PACKAGE) package)" UseGhcForCc = YES diff --git a/Setup.hs b/Setup.hs new file mode 100644 index 0000000..60804b2 --- /dev/null +++ b/Setup.hs @@ -0,0 +1,6 @@ +module Main (main) where + +import Distribution.Simple (defaultMainWithHooks, defaultUserHooks) + +main :: IO () +main = defaultMainWithHooks defaultUserHooks From git at git.haskell.org Mon Feb 20 21:11:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:11:14 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Changed docs for %U and %W to include the possibility of week 0 results. (85fd256) Message-ID: <20170220211114.AA87E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/85fd2569144c8fc3d2249817dabf9944e32cba78 >--------------------------------------------------------------- commit 85fd2569144c8fc3d2249817dabf9944e32cba78 Author: bjorn Date: Sat Nov 11 08:52:07 2006 -0800 Changed docs for %U and %W to include the possibility of week 0 results. darcs-hash:20061111165207-6cdb2-9182b09f62f804176b0febb4a2169348d06655f3 >--------------------------------------------------------------- 85fd2569144c8fc3d2249817dabf9944e32cba78 Data/Time/LocalTime/Format.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Data/Time/LocalTime/Format.hs b/Data/Time/LocalTime/Format.hs index 9564868..d817c13 100644 --- a/Data/Time/LocalTime/Format.hs +++ b/Data/Time/LocalTime/Format.hs @@ -113,11 +113,11 @@ class FormatTime t where -- -- [@%A@] day of week, long form ('fst' from 'wDays' @locale@), @Sunday@ - @Saturday@ -- --- [@%U@] week number of year, where weeks start on Sunday (as 'sundayStartWeek'), @01@ - @53@ +-- [@%U@] week number of year, where weeks start on Sunday (as 'sundayStartWeek'), @00@ - @53@ -- -- [@%w@] day of week number, @0@ (= Sunday) - @6@ (= Saturday) -- --- [@%W@] week number of year, where weeks start on Monday (as 'mondayStartWeek'), @01@ - @53@ +-- [@%W@] week number of year, where weeks start on Monday (as 'mondayStartWeek'), @00@ - @53@ formatTime :: (FormatTime t) => TimeLocale -> String -> t -> String formatTime _ [] _ = "" formatTime locale ('%':c:cs) t = (formatChar c) ++ (formatTime locale cs t) where From git at git.haskell.org Mon Feb 20 21:11:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:11:16 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Fixed typo: s/propleptic/proleptic/. (927eb34) Message-ID: <20170220211116.B0E313A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/927eb3448f5bf93ca44cf636b2f390f9520e9277 >--------------------------------------------------------------- commit 927eb3448f5bf93ca44cf636b2f390f9520e9277 Author: bjorn Date: Sat Nov 11 08:55:49 2006 -0800 Fixed typo: s/propleptic/proleptic/. darcs-hash:20061111165549-6cdb2-2229da79c00c5415630eb6866533c290022c7ba0 >--------------------------------------------------------------- 927eb3448f5bf93ca44cf636b2f390f9520e9277 Data/Time/Calendar/JulianYearDay.hs | 2 +- Data/Time/Calendar/OrdinalDate.hs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Data/Time/Calendar/JulianYearDay.hs b/Data/Time/Calendar/JulianYearDay.hs index a6d5baa..ba10c8f 100644 --- a/Data/Time/Calendar/JulianYearDay.hs +++ b/Data/Time/Calendar/JulianYearDay.hs @@ -33,6 +33,6 @@ showJulianYearAndDay :: Day -> String showJulianYearAndDay date = (show4 y) ++ "-" ++ (show3 d) where (y,d) = toJulianYearAndDay date --- | Is this year a leap year according to the propleptic Gregorian calendar? +-- | Is this year a leap year according to the proleptic Gregorian calendar? isJulianLeapYear :: Integer -> Bool isJulianLeapYear year = (mod year 4 == 0) diff --git a/Data/Time/Calendar/OrdinalDate.hs b/Data/Time/Calendar/OrdinalDate.hs index 7c2099a..a293b5e 100644 --- a/Data/Time/Calendar/OrdinalDate.hs +++ b/Data/Time/Calendar/OrdinalDate.hs @@ -33,7 +33,7 @@ showOrdinalDate :: Day -> String showOrdinalDate date = (show4 y) ++ "-" ++ (show3 d) where (y,d) = toOrdinalDate date --- | Is this year a leap year according to the propleptic Gregorian calendar? +-- | Is this year a leap year according to the proleptic Gregorian calendar? isLeapYear :: Integer -> Bool isLeapYear year = (mod year 4 == 0) && ((mod year 400 == 0) || not (mod year 100 == 0)) From git at git.haskell.org Mon Feb 20 21:11:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:11:18 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Added missing example for showWeekDate. (147381b) Message-ID: <20170220211118.B77433A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/147381b33918537d64e9df200ed20ddac993d012 >--------------------------------------------------------------- commit 147381b33918537d64e9df200ed20ddac993d012 Author: bjorn Date: Wed Nov 15 14:07:39 2006 -0800 Added missing example for showWeekDate. The showWeekDate haddock comment was: "show in ISO 8601 Week Date format as yyyy-Www-dd (e.g." darcs-hash:20061115220739-6cdb2-5f577de58f061136b82cffa9c22c73b2e914bbed >--------------------------------------------------------------- 147381b33918537d64e9df200ed20ddac993d012 Data/Time/Calendar/WeekDate.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Data/Time/Calendar/WeekDate.hs b/Data/Time/Calendar/WeekDate.hs index a186ca9..0568a32 100644 --- a/Data/Time/Calendar/WeekDate.hs +++ b/Data/Time/Calendar/WeekDate.hs @@ -35,7 +35,7 @@ fromWeekDate y w d = ModifiedJulianDay (k - (mod k 7) + (toInteger (((clip 1 (if (_,53,_) -> True _ -> False --- | show in ISO 8601 Week Date format as yyyy-Www-dd (e.g. +-- | show in ISO 8601 Week Date format as yyyy-Www-dd (e.g. \"2006-W46-3\"). showWeekDate :: Day -> String showWeekDate date = (show4 y) ++ "-W" ++ (show2 w) ++ "-" ++ (show d) where (y,w,d) = toWeekDate date From git at git.haskell.org Mon Feb 20 21:11:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:11:20 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Handle 'c' also in formatTime for ZonedTime, to get %Z filled in for ZonedTime and UTCTime. (573daed) Message-ID: <20170220211120.BEAEA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/573daed43a143ea75360c23317ec9efebe01dfe5 >--------------------------------------------------------------- commit 573daed43a143ea75360c23317ec9efebe01dfe5 Author: bjorn Date: Wed Nov 15 14:08:18 2006 -0800 Handle 'c' also in formatTime for ZonedTime, to get %Z filled in for ZonedTime and UTCTime. Before, formatTime "%c" did not include the time zone even when applied to ZonedTime or UTCTime, since "%c" was handled by the FormatTime LocalTime instance: > fmap (formatTime System.Locale.defaultTimeLocale "%c") getZonedTime "Sat Nov 11 19:12:45.395568 2006" > fmap (formatTime System.Locale.defaultTimeLocale "%c") getCurrentTime "Sat Nov 11 18:13:52.010944 2006" Now it is correct: > fmap (formatTime System.Locale.defaultTimeLocale "%c") getZonedTime "Wed Nov 15 23:08:43.987526 CET 2006" > fmap (formatTime System.Locale.defaultTimeLocale "%c") getCurrentTime "Wed Nov 15 22:08:51.530603 UTC 2006" darcs-hash:20061115220818-6cdb2-db20654b473141486d86a09551688043eebafb8b >--------------------------------------------------------------- 573daed43a143ea75360c23317ec9efebe01dfe5 Data/Time/LocalTime/Format.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/Data/Time/LocalTime/Format.hs b/Data/Time/LocalTime/Format.hs index d817c13..c13160e 100644 --- a/Data/Time/LocalTime/Format.hs +++ b/Data/Time/LocalTime/Format.hs @@ -160,6 +160,7 @@ instance FormatTime TimeOfDay where formatCharacter _ = Nothing instance FormatTime ZonedTime where + formatCharacter 'c' = Just (\locale -> formatTime locale (dateTimeFmt locale)) formatCharacter 's' = Just (\_ zt -> show (truncate (utcTimeToPOSIXSeconds (zonedTimeToUTC zt)) :: Integer)) formatCharacter c = case (formatCharacter c) of Just f -> Just (\locale dt -> f locale (zonedTimeToLocalTime dt)) From git at git.haskell.org Mon Feb 20 21:11:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:11:22 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Add secondsToDiffTime and picosecondsToDiffTime. (96ec994) Message-ID: <20170220211122.C628C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/96ec99479c89cac13ac310b0b85536e6973c2af1 >--------------------------------------------------------------- commit 96ec99479c89cac13ac310b0b85536e6973c2af1 Author: bjorn Date: Wed Nov 15 14:21:45 2006 -0800 Add secondsToDiffTime and picosecondsToDiffTime. Rationale: As has come up on haskell-cafe (http://comments.gmane.org/gmane.comp.lang.haskell.cafe/15653), it takes a while to figure out how to make DiffTime values. secondsToDiffTime is not that important since it is just another name for fromInteger, but I suspect that it would be used a lot. Using fromRational to create a DiffTime from a number of picoseconds is a bit of a hassle, so having a picosecondsToDiffTime would be useful. darcs-hash:20061115222145-6cdb2-4c0badc67fc5a5c1880c111902ee3e28ad793719 >--------------------------------------------------------------- 96ec99479c89cac13ac310b0b85536e6973c2af1 Data/Time/Clock/Scale.hs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Data/Time/Clock/Scale.hs b/Data/Time/Clock/Scale.hs index b7bcf97..053c515 100644 --- a/Data/Time/Clock/Scale.hs +++ b/Data/Time/Clock/Scale.hs @@ -8,9 +8,11 @@ module Data.Time.Clock.Scale UniversalTime(..), -- * Absolute intervals - DiffTime + DiffTime, + secondsToDiffTime, picosecondsToDiffTime ) where +import Data.Ratio ((%)) import Data.Fixed -- | The Modified Julian Date is the day with the fraction of the day, measured from UT midnight. @@ -55,3 +57,11 @@ instance Fractional DiffTime where (MkDiffTime a) / (MkDiffTime b) = MkDiffTime (a / b) recip (MkDiffTime a) = MkDiffTime (recip a) fromRational r = MkDiffTime (fromRational r) + +-- | Create a 'DiffTime' which represents an integral number of seconds. +secondsToDiffTime :: Integer -> DiffTime +secondsToDiffTime = fromInteger + +-- | Create a 'DiffTime' from a number of picoseconds. +picosecondsToDiffTime :: Integer -> DiffTime +picosecondsToDiffTime x = fromRational (x % 1000000000000) From git at git.haskell.org Mon Feb 20 21:11:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:11:24 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Added fromMondayStartWeek and fromSundayStartWeek to Data.Time.Calendar.OrdinalDate. (04282fe) Message-ID: <20170220211124.CCEDD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/04282fedbfbc79af60e7b430457f72789917da9d >--------------------------------------------------------------- commit 04282fedbfbc79af60e7b430457f72789917da9d Author: bjorn Date: Thu Nov 16 01:21:14 2006 -0800 Added fromMondayStartWeek and fromSundayStartWeek to Data.Time.Calendar.OrdinalDate. I couldn't find any duals of mondayStartWeek and sundayStartWeek. They are useful when implementing parsing for %W and %U. darcs-hash:20061116092114-6cdb2-794a278759d65b1cdbb8fbb8f890409edbaa3834 >--------------------------------------------------------------- 04282fedbfbc79af60e7b430457f72789917da9d Data/Time/Calendar/OrdinalDate.hs | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/Data/Time/Calendar/OrdinalDate.hs b/Data/Time/Calendar/OrdinalDate.hs index a293b5e..a88943f 100644 --- a/Data/Time/Calendar/OrdinalDate.hs +++ b/Data/Time/Calendar/OrdinalDate.hs @@ -54,3 +54,36 @@ sundayStartWeek date =(fromInteger ((div d 7) - (div k 7)),fromInteger (mod d 7) yd = snd (toOrdinalDate date) d = (toModifiedJulianDay date) + 3 k = d - (toInteger yd) + +-- | The inverse of 'mondayStartWeek'. Get a 'Day' given the year, +-- the number of the Monday-starting week, and the day of the week. +-- The first Monday is the first day of week 1, any earlier days in the year +-- are week 0 (as \"%W\" in formatTime). +fromMondayStartWeek :: Integer -- ^ Year. + -> Int -- ^ Monday-starting week number. + -> Int -- ^ Day of week. + -- Monday is 1, Sunday is 7 (as \"%u\" in formatTime). + -> Day +fromMondayStartWeek y w d = ModifiedJulianDay (firstDay + yd) + where yd = firstMonday + 7 * toInteger (w-1) + toInteger d - 1 + -- first day of the year + firstDay = toModifiedJulianDay (fromOrdinalDate y 1) + -- 0-based year day of first monday of the year + firstMonday = (5 - firstDay) `mod` 7 + +-- | The inverse of 'sundayStartWeek'. Get a 'Day' given the year and +-- the number of the day of a Sunday-starting week. +-- The first Sunday is the first day of week 1, any earlier days in the +-- year are week 0 (as \"%U\" in formatTime). +-- Sunday is 0, Saturday is 6 (as \"%w\" in formatTime). +fromSundayStartWeek :: Integer -- ^ Year. + -> Int -- ^ Sunday-starting week number. + -> Int -- ^ Day of week + -- Sunday is 0, Saturday is 6 (as \"%w\" in formatTime). + -> Day +fromSundayStartWeek y w d = ModifiedJulianDay (firstDay + yd) + where yd = firstSunday + 7 * toInteger (w-1) + toInteger d + -- first day of the year + firstDay = toModifiedJulianDay (fromOrdinalDate y 1) + -- 0-based year day of first sunday of the year + firstSunday = (4 - firstDay) `mod` 7 From git at git.haskell.org Mon Feb 20 21:11:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:11:26 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Some haddock formatting for fromMondayStartWeek and fromSundayStartWeek. (c2bc34a) Message-ID: <20170220211126.D34143A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/c2bc34a0e99761e5c16f3217d4b1bc67c6303dc2 >--------------------------------------------------------------- commit c2bc34a0e99761e5c16f3217d4b1bc67c6303dc2 Author: bjorn Date: Thu Nov 16 01:56:20 2006 -0800 Some haddock formatting for fromMondayStartWeek and fromSundayStartWeek. darcs-hash:20061116095620-6cdb2-0add550bd79d80a7f1ddd794a050d72c25226e63 >--------------------------------------------------------------- c2bc34a0e99761e5c16f3217d4b1bc67c6303dc2 Data/Time/Calendar/OrdinalDate.hs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Data/Time/Calendar/OrdinalDate.hs b/Data/Time/Calendar/OrdinalDate.hs index a88943f..dfd4069 100644 --- a/Data/Time/Calendar/OrdinalDate.hs +++ b/Data/Time/Calendar/OrdinalDate.hs @@ -58,11 +58,11 @@ sundayStartWeek date =(fromInteger ((div d 7) - (div k 7)),fromInteger (mod d 7) -- | The inverse of 'mondayStartWeek'. Get a 'Day' given the year, -- the number of the Monday-starting week, and the day of the week. -- The first Monday is the first day of week 1, any earlier days in the year --- are week 0 (as \"%W\" in formatTime). +-- are week 0 (as \"%W\" in 'formatTime'). fromMondayStartWeek :: Integer -- ^ Year. -> Int -- ^ Monday-starting week number. -> Int -- ^ Day of week. - -- Monday is 1, Sunday is 7 (as \"%u\" in formatTime). + -- Monday is 1, Sunday is 7 (as \"%u\" in 'formatTime'). -> Day fromMondayStartWeek y w d = ModifiedJulianDay (firstDay + yd) where yd = firstMonday + 7 * toInteger (w-1) + toInteger d - 1 @@ -74,12 +74,11 @@ fromMondayStartWeek y w d = ModifiedJulianDay (firstDay + yd) -- | The inverse of 'sundayStartWeek'. Get a 'Day' given the year and -- the number of the day of a Sunday-starting week. -- The first Sunday is the first day of week 1, any earlier days in the --- year are week 0 (as \"%U\" in formatTime). --- Sunday is 0, Saturday is 6 (as \"%w\" in formatTime). +-- year are week 0 (as \"%U\" in 'formatTime'). fromSundayStartWeek :: Integer -- ^ Year. -> Int -- ^ Sunday-starting week number. -> Int -- ^ Day of week - -- Sunday is 0, Saturday is 6 (as \"%w\" in formatTime). + -- Sunday is 0, Saturday is 6 (as \"%w\" in 'formatTime'). -> Day fromSundayStartWeek y w d = ModifiedJulianDay (firstDay + yd) where yd = firstSunday + 7 * toInteger (w-1) + toInteger d From git at git.haskell.org Mon Feb 20 21:11:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:11:28 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Added Data.Time.LocalTime.Parse, UNIX-style time parsing. (06ad028) Message-ID: <20170220211128.DCA373A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/06ad028f0ddff11a63871b119393b9cc0ee30cd3 >--------------------------------------------------------------- commit 06ad028f0ddff11a63871b119393b9cc0ee30cd3 Author: bjorn Date: Thu Nov 16 01:58:49 2006 -0800 Added Data.Time.LocalTime.Parse, UNIX-style time parsing. The old System.Time has had a TODO "* add functions to parse strings to `CalendarTime' (some day...)" for a long time. The question about date parsing comes up once in a while on the mailing lists (e.g. http://comments.gmane.org/gmane.comp.lang.haskell.cafe/16438). darcs-hash:20061116095849-6cdb2-fef2cd50b6017d49ede023864ae4a2f56f9584a8 >--------------------------------------------------------------- 06ad028f0ddff11a63871b119393b9cc0ee30cd3 Data/Time/LocalTime.hs | 4 +- Data/Time/LocalTime/Parse.hs | 310 +++++++++++++++++++++++++++++++++++++++++++ time.cabal | 3 +- 3 files changed, 315 insertions(+), 2 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 06ad028f0ddff11a63871b119393b9cc0ee30cd3 From git at git.haskell.org Mon Feb 20 21:11:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:11:30 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Updated SRC and dependencies in time/Makefile to include Data.Time.LocalTime.Parse. (d6ff855) Message-ID: <20170220211130.E37553A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/d6ff855adbb921cd61cdf46ffa2781c4c6466618 >--------------------------------------------------------------- commit d6ff855adbb921cd61cdf46ffa2781c4c6466618 Author: bjorn Date: Thu Nov 16 02:44:38 2006 -0800 Updated SRC and dependencies in time/Makefile to include Data.Time.LocalTime.Parse. darcs-hash:20061116104438-6cdb2-7dad989c3cb1ccaadefe38b7f03a40a0a219ad8d >--------------------------------------------------------------- d6ff855adbb921cd61cdf46ffa2781c4c6466618 time/Makefile | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/time/Makefile b/time/Makefile index 9ca9a17..f99d908 100644 --- a/time/Makefile +++ b/time/Makefile @@ -42,6 +42,7 @@ SRCS = \ Data/Time/LocalTime/TimeOfDay.hs \ Data/Time/LocalTime/LocalTime.hs \ Data/Time/LocalTime/Format.hs \ + Data/Time/LocalTime/Parse.hs \ Data/Time/LocalTime.hs \ Data/Time.hs @@ -121,19 +122,13 @@ Data/Time/Calendar/Julian.o : Data/Time/Calendar/Private.hi Data/Time/Calendar/Julian.o : Data/Time/Calendar/Days.hi Data/Time/Calendar/Julian.o : Data/Time/Calendar/JulianYearDay.hi Data/Time/Calendar/Julian.o : Data/Time/Calendar/MonthDay.hi -Data/Time/Calendar.o : Data/Time/Calendar.hs -Data/Time/Calendar.o : Data/Time/Calendar/Gregorian.hi -Data/Time/Calendar.o : Data/Time/Calendar/Days.hi -Data/Time/Calendar/Easter.o : Data/Time/Calendar/Easter.hs -Data/Time/Calendar/Easter.o : Data/Time/Calendar/Julian.hi -Data/Time/Calendar/Easter.o : Data/Time/Calendar.hi Data/Time/Clock/UTC.o : Data/Time/Clock/UTC.hs Data/Time/Clock/UTC.o : Data/Time/Clock/Scale.hi Data/Time/Clock/UTC.o : Data/Time/Calendar/Days.hi Data/Time/Clock/POSIX.o : Data/Time/Clock/POSIX.hs +Data/Time/Clock/POSIX.o : Data/Time/Clock/CTimeval.hi Data/Time/Clock/POSIX.o : Data/Time/Calendar/Days.hi Data/Time/Clock/POSIX.o : Data/Time/Clock/UTC.hi -Data/Time/Clock/POSIX.o : Data/Time/Clock/CTimeval.hi Data/Time/Clock/UTCDiff.o : Data/Time/Clock/UTCDiff.hs Data/Time/Clock/UTCDiff.o : Data/Time/Clock/UTC.hi Data/Time/Clock/UTCDiff.o : Data/Time/Clock/POSIX.hi @@ -150,11 +145,27 @@ Data/Time/LocalTime/TimeOfDay.o : Data/Time/LocalTime/TimeOfDay.hs Data/Time/LocalTime/TimeOfDay.o : Data/Time/Clock.hi Data/Time/LocalTime/TimeOfDay.o : Data/Time/Calendar/Private.hi Data/Time/LocalTime/TimeOfDay.o : Data/Time/LocalTime/TimeZone.hi +Data/Time/Calendar.o : Data/Time/Calendar.hs +Data/Time/Calendar.o : Data/Time/Calendar/Gregorian.hi +Data/Time/Calendar.o : Data/Time/Calendar/Days.hi +Data/Time/Calendar/Easter.o : Data/Time/Calendar/Easter.hs +Data/Time/Calendar/Easter.o : Data/Time/Calendar/Julian.hi +Data/Time/Calendar/Easter.o : Data/Time/Calendar.hi Data/Time/LocalTime/LocalTime.o : Data/Time/LocalTime/LocalTime.hs Data/Time/LocalTime/LocalTime.o : Data/Time/Clock.hi Data/Time/LocalTime/LocalTime.o : Data/Time/Calendar.hi Data/Time/LocalTime/LocalTime.o : Data/Time/LocalTime/TimeZone.hi Data/Time/LocalTime/LocalTime.o : Data/Time/LocalTime/TimeOfDay.hi +Data/Time/LocalTime/Parse.o : Data/Time/LocalTime/Parse.hs +Data/Time/LocalTime/Parse.o : Data/Time/LocalTime/TimeZone.hi +Data/Time/LocalTime/Parse.o : Data/Time/LocalTime/TimeOfDay.hi +Data/Time/LocalTime/Parse.o : Data/Time/LocalTime/LocalTime.hi +Data/Time/LocalTime/Parse.o : Data/Time/Calendar/WeekDate.hi +Data/Time/LocalTime/Parse.o : Data/Time/Calendar/OrdinalDate.hi +Data/Time/LocalTime/Parse.o : Data/Time/Calendar/Gregorian.hi +Data/Time/LocalTime/Parse.o : Data/Time/Calendar/Days.hi +Data/Time/LocalTime/Parse.o : Data/Time/Clock/UTC.hi +Data/Time/LocalTime/Parse.o : Data/Time/Clock/POSIX.hi Data/Time/LocalTime/Format.o : Data/Time/LocalTime/Format.hs Data/Time/LocalTime/Format.o : Data/Time/Clock/POSIX.hi Data/Time/LocalTime/Format.o : Data/Time/Clock.hi @@ -166,6 +177,7 @@ Data/Time/LocalTime/Format.o : Data/Time/LocalTime/TimeZone.hi Data/Time/LocalTime/Format.o : Data/Time/LocalTime/TimeOfDay.hi Data/Time/LocalTime/Format.o : Data/Time/LocalTime/LocalTime.hi Data/Time/LocalTime.o : Data/Time/LocalTime.hs +Data/Time/LocalTime.o : Data/Time/LocalTime/Parse.hi Data/Time/LocalTime.o : Data/Time/LocalTime/Format.hi Data/Time/LocalTime.o : Data/Time/LocalTime/LocalTime.hi Data/Time/LocalTime.o : Data/Time/LocalTime/TimeOfDay.hi From git at git.haskell.org Mon Feb 20 21:11:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:11:32 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Changed UTC to +0000 in default time zone in ParseTime, to avoid spurios time zone names. (16a9225) Message-ID: <20170220211132.EA66A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/16a92252a19297d9e1ec75a7b292a880f57b9587 >--------------------------------------------------------------- commit 16a92252a19297d9e1ec75a7b292a880f57b9587 Author: bjorn Date: Thu Nov 16 02:52:54 2006 -0800 Changed UTC to +0000 in default time zone in ParseTime, to avoid spurios time zone names. darcs-hash:20061116105254-6cdb2-3328529fc7d8536b6e9009295768fdc2eae7e25a >--------------------------------------------------------------- 16a92252a19297d9e1ec75a7b292a880f57b9587 Data/Time/LocalTime/Parse.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Data/Time/LocalTime/Parse.hs b/Data/Time/LocalTime/Parse.hs index b3c42c7..a5420d3 100644 --- a/Data/Time/LocalTime/Parse.hs +++ b/Data/Time/LocalTime/Parse.hs @@ -33,7 +33,7 @@ class ParseTime t where -- | Builds a time value from a parsed input string. -- If the input does not include all the information needed to -- construct a complete value, any missing parts should be taken - -- from 1970-01-01 00:00:00 UTC (which was a Thursday). + -- from 1970-01-01 00:00:00 +0000 (which was a Thursday). buildTime :: TimeLocale -- ^ The time locale. -> [(Char,String)] -- ^ Pairs of format characters and the -- corresponding part of the input. @@ -263,7 +263,7 @@ instance ParseTime LocalTime where buildTime l xs = LocalTime (buildTime l xs) (buildTime l xs) instance ParseTime TimeZone where - buildTime _ = foldl f utc + buildTime _ = foldl f (minutesToTimeZone 0) where f t@(TimeZone offset dst name) (c,x) = case c of From git at git.haskell.org Mon Feb 20 21:11:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:11:34 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Added quickcheck properties for time parsing. (ad26aa5) Message-ID: <20170220211134.F394A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/ad26aa5cf47d8c573dd0b6333da5e065843f37af >--------------------------------------------------------------- commit ad26aa5cf47d8c573dd0b6333da5e065843f37af Author: bjorn Date: Thu Nov 16 02:56:16 2006 -0800 Added quickcheck properties for time parsing. darcs-hash:20061116105616-6cdb2-eed6a7e86410241c74b0b43e4e2d8c4a45096ba7 >--------------------------------------------------------------- ad26aa5cf47d8c573dd0b6333da5e065843f37af time/test/Makefile | 6 +- time/test/TestParseTime.hs | 290 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 295 insertions(+), 1 deletion(-) 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 ad26aa5cf47d8c573dd0b6333da5e065843f37af From git at git.haskell.org Mon Feb 20 21:11:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:11:37 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Moved %c to failing ZonedTime test since formatTime %Z does not output time zone offset if there is no time zone name. (bef9a3c) Message-ID: <20170220211137.059F93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/bef9a3cf6f39980706483a8e14013890a9c54d80 >--------------------------------------------------------------- commit bef9a3cf6f39980706483a8e14013890a9c54d80 Author: bjorn Date: Thu Nov 16 03:12:47 2006 -0800 Moved %c to failing ZonedTime test since formatTime %Z does not output time zone offset if there is no time zone name. darcs-hash:20061116111247-6cdb2-509d4a19b5225b95dc0343a983099569d2f90fad >--------------------------------------------------------------- bef9a3cf6f39980706483a8e14013890a9c54d80 time/test/TestParseTime.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/time/test/TestParseTime.hs b/time/test/TestParseTime.hs index 356f2fb..91d76b0 100644 --- a/time/test/TestParseTime.hs +++ b/time/test/TestParseTime.hs @@ -237,7 +237,7 @@ timeZoneFormats = map FormatString ["%z","%z%Z","%Z%z"] zonedTimeFormats :: [FormatString ZonedTime] zonedTimeFormats = map FormatString - ["%a, %d %b %Y %H:%M:%S %z","%c"] + ["%a, %d %b %Y %H:%M:%S %z"] utcTimeFormats :: [FormatString UTCTime] utcTimeFormats = map FormatString @@ -275,7 +275,8 @@ failingTimeZoneFormats = map FormatString failingZonedTimeFormats :: [FormatString ZonedTime] failingZonedTimeFormats = map FormatString [ - -- %Z is not implemented properly + -- can't figure out offset from %Z, also, formatTime produces "" for %Z + "%c", "%a, %d %b %Y %H:%M:%S %Z", -- %s does not include second decimals "%s %z" From git at git.haskell.org Mon Feb 20 21:11:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:11:39 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Changed test case Makefile to work with GHC 6.6 (there is no -package fixed). (eba81c2) Message-ID: <20170220211139.0C14F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/eba81c2d010185d361181c3132f6de9165037b43 >--------------------------------------------------------------- commit eba81c2d010185d361181c3132f6de9165037b43 Author: bjorn Date: Thu Nov 16 03:13:46 2006 -0800 Changed test case Makefile to work with GHC 6.6 (there is no -package fixed). darcs-hash:20061116111346-6cdb2-7ced2b2124315f6bf4545d0617ec10bd50bd6896 >--------------------------------------------------------------- eba81c2d010185d361181c3132f6de9165037b43 time/test/LongWeekYears.hs | 1 - time/test/Makefile | 32 ++++++++++++++++++-------------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/time/test/LongWeekYears.hs b/time/test/LongWeekYears.hs index b5c3913..db453be 100644 --- a/time/test/LongWeekYears.hs +++ b/time/test/LongWeekYears.hs @@ -2,7 +2,6 @@ module Main where -import Data.Time.Calendar.OrdinalDate import Data.Time.Calendar.WeekDate import Data.Time.Calendar diff --git a/time/test/Makefile b/time/test/Makefile index cb4c2ea..9df2b39 100644 --- a/time/test/Makefile +++ b/time/test/Makefile @@ -1,52 +1,55 @@ +GHC = ghc +GHCFLAGS = + default: CurrentTime.run ShowDST.run test TestMonthDay: TestMonthDay.o ../libHStime.a - ghc -package fixed $^ -o $@ + $(GHC) $(GHCFLAGS) $^ -o $@ ConvertBack: ConvertBack.o ../libHStime.a - ghc -package fixed $^ -o $@ + $(GHC) $(GHCFLAGS) $^ -o $@ TestCalendars: TestCalendars.o ../libHStime.a - ghc -package fixed $^ -o $@ + $(GHC) $(GHCFLAGS) $^ -o $@ TestTime: TestTime.o ../libHStime.a - ghc -package fixed $^ -o $@ + $(GHC) $(GHCFLAGS) $^ -o $@ LongWeekYears: LongWeekYears.o ../libHStime.a - ghc -package fixed $^ -o $@ + $(GHC) $(GHCFLAGS) $^ -o $@ ClipDates: ClipDates.o ../libHStime.a - ghc -package fixed $^ -o $@ + $(GHC) $(GHCFLAGS) $^ -o $@ AddDays: AddDays.o ../libHStime.a - ghc -package fixed $^ -o $@ + $(GHC) $(GHCFLAGS) $^ -o $@ TestFormat: TestFormat.o TestFormatStuff.o ../libHStime.a - ghc -package fixed $^ -o $@ + $(GHC) $(GHCFLAGS) $^ -o $@ TestFormatStuff.o: TestFormatStuff.c TestFormatStuff.h gcc -o $@ -c $< TestParseDAT: TestParseDAT.o ../libHStime.a - ghc -package fixed $^ -o $@ + $(GHC) $(GHCFLAGS) $^ -o $@ TestEaster: TestEaster.o ../libHStime.a - ghc -package fixed $^ -o $@ + $(GHC) $(GHCFLAGS) $^ -o $@ CurrentTime: CurrentTime.o ../libHStime.a - ghc -package fixed $^ -o $@ + $(GHC) $(GHCFLAGS) $^ -o $@ ShowDST: ShowDST.o ../libHStime.a - ghc -package fixed $^ -o $@ + $(GHC) $(GHCFLAGS) $^ -o $@ TimeZone: TimeZone.o ../libHStime.a - ghc -package fixed $^ -o $@ + $(GHC) $(GHCFLAGS) $^ -o $@ TimeZone.ref: FORCE date +%z > $@ TestParseTime: TestParseTime.o ../libHStime.a - ghc -package fixed -package QuickCheck $^ -o $@ + $(GHC) $(GHCFLAGS) -package QuickCheck $^ -o $@ test: \ TestMonthDay.diff \ @@ -60,6 +63,7 @@ test: \ TestFormat.diff0 \ TestParseDAT.diff \ TestEaster.diff \ + TestParseTime.run \ UseCases.o clean: From git at git.haskell.org Mon Feb 20 21:11:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:11:41 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Compile test programs using ../../dist/build/libHStime-1.0.a as produced by the Cabal build step. (43d95b2) Message-ID: <20170220211141.126803A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/43d95b2e3a860661e66bed2e606b7675178eb22f >--------------------------------------------------------------- commit 43d95b2e3a860661e66bed2e606b7675178eb22f Author: bjorn Date: Thu Nov 16 03:20:48 2006 -0800 Compile test programs using ../../dist/build/libHStime-1.0.a as produced by the Cabal build step. darcs-hash:20061116112048-6cdb2-c592217ab26ead8026d074c6d410f0d10265e0c0 >--------------------------------------------------------------- 43d95b2e3a860661e66bed2e606b7675178eb22f time/test/Makefile | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/time/test/Makefile b/time/test/Makefile index 9df2b39..c3f2992 100644 --- a/time/test/Makefile +++ b/time/test/Makefile @@ -1,54 +1,55 @@ GHC = ghc GHCFLAGS = +LIBS = ../../dist/build/libHStime-1.0.a default: CurrentTime.run ShowDST.run test -TestMonthDay: TestMonthDay.o ../libHStime.a +TestMonthDay: TestMonthDay.o $(LIBS) $(GHC) $(GHCFLAGS) $^ -o $@ -ConvertBack: ConvertBack.o ../libHStime.a +ConvertBack: ConvertBack.o $(LIBS) $(GHC) $(GHCFLAGS) $^ -o $@ -TestCalendars: TestCalendars.o ../libHStime.a +TestCalendars: TestCalendars.o $(LIBS) $(GHC) $(GHCFLAGS) $^ -o $@ -TestTime: TestTime.o ../libHStime.a +TestTime: TestTime.o $(LIBS) $(GHC) $(GHCFLAGS) $^ -o $@ -LongWeekYears: LongWeekYears.o ../libHStime.a +LongWeekYears: LongWeekYears.o $(LIBS) $(GHC) $(GHCFLAGS) $^ -o $@ -ClipDates: ClipDates.o ../libHStime.a +ClipDates: ClipDates.o $(LIBS) $(GHC) $(GHCFLAGS) $^ -o $@ -AddDays: AddDays.o ../libHStime.a +AddDays: AddDays.o $(LIBS) $(GHC) $(GHCFLAGS) $^ -o $@ -TestFormat: TestFormat.o TestFormatStuff.o ../libHStime.a +TestFormat: TestFormat.o TestFormatStuff.o $(LIBS) $(GHC) $(GHCFLAGS) $^ -o $@ TestFormatStuff.o: TestFormatStuff.c TestFormatStuff.h gcc -o $@ -c $< -TestParseDAT: TestParseDAT.o ../libHStime.a +TestParseDAT: TestParseDAT.o $(LIBS) $(GHC) $(GHCFLAGS) $^ -o $@ -TestEaster: TestEaster.o ../libHStime.a +TestEaster: TestEaster.o $(LIBS) $(GHC) $(GHCFLAGS) $^ -o $@ -CurrentTime: CurrentTime.o ../libHStime.a +CurrentTime: CurrentTime.o $(LIBS) $(GHC) $(GHCFLAGS) $^ -o $@ -ShowDST: ShowDST.o ../libHStime.a +ShowDST: ShowDST.o $(LIBS) $(GHC) $(GHCFLAGS) $^ -o $@ -TimeZone: TimeZone.o ../libHStime.a +TimeZone: TimeZone.o $(LIBS) $(GHC) $(GHCFLAGS) $^ -o $@ TimeZone.ref: FORCE date +%z > $@ -TestParseTime: TestParseTime.o ../libHStime.a +TestParseTime: TestParseTime.o $(LIBS) $(GHC) $(GHCFLAGS) -package QuickCheck $^ -o $@ test: \ From git at git.haskell.org Mon Feb 20 21:11:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:11:43 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Fixed taiEpoch Haddock comment to include the epoch time. (1632436) Message-ID: <20170220211143.1967A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/16324364771a9c323bed81d8eba20083576c9a4a >--------------------------------------------------------------- commit 16324364771a9c323bed81d8eba20083576c9a4a Author: bjorn Date: Thu Nov 16 04:00:24 2006 -0800 Fixed taiEpoch Haddock comment to include the epoch time. The taiEpoch haddock comment was just "The epoch of TAI, which is". Changed this to "The epoch of TAI, which is 1858-11-17 00:00:00 TAI." darcs-hash:20061116120024-6cdb2-fe77f9d9bd5336bbd91bee5afcb055f3a6796965 >--------------------------------------------------------------- 16324364771a9c323bed81d8eba20083576c9a4a Data/Time/Clock/TAI.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Data/Time/Clock/TAI.hs b/Data/Time/Clock/TAI.hs index 00cebd5..b1c37c1 100644 --- a/Data/Time/Clock/TAI.hs +++ b/Data/Time/Clock/TAI.hs @@ -26,7 +26,7 @@ newtype AbsoluteTime = MkAbsoluteTime {unAbsoluteTime :: DiffTime} deriving (Eq, instance Show AbsoluteTime where show t = show (utcToLocalTime utc (taiToUTCTime (const 0) t)) ++ " TAI" -- ugly, but standard apparently --- | The epoch of TAI, which is +-- | The epoch of TAI, which is 1858-11-17 00:00:00 TAI. taiEpoch :: AbsoluteTime taiEpoch = MkAbsoluteTime 0 From git at git.haskell.org Mon Feb 20 21:11:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:11:45 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: move test dir up, remove old junk (9b6744e) Message-ID: <20170220211145.21A1E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/9b6744e0fb08826431d844e6f3e0e1f57544f8cf >--------------------------------------------------------------- commit 9b6744e0fb08826431d844e6f3e0e1f57544f8cf Author: Ashley Yakeley Date: Mon Dec 11 00:00:45 2006 -0800 move test dir up, remove old junk darcs-hash:20061211080045-ac6dd-ce8452ab86b8c8efdfb9d6697df9c32aad49d87d >--------------------------------------------------------------- 9b6744e0fb08826431d844e6f3e0e1f57544f8cf {time/test => test}/AddDays.hs | 0 {time/test => test}/AddDays.ref | 0 {time/test => test}/ClipDates.hs | 0 {time/test => test}/ClipDates.ref | 0 {time/test => test}/ConvertBack.hs | 0 {time/test => test}/CurrentTime.hs | 0 {time/test => test}/LongWeekYears.hs | 0 {time/test => test}/LongWeekYears.ref | 0 {time/test => test}/Makefile | 0 {time/test => test}/ShowDST.hs | 0 {time/test => test}/TestCalendars.hs | 0 {time/test => test}/TestCalendars.ref | 0 {time/test => test}/TestEaster.hs | 0 {time/test => test}/TestEaster.ref | 0 {time/test => test}/TestFormat.hs | 0 {time/test => test}/TestFormatStuff.c | 0 {time/test => test}/TestFormatStuff.h | 0 {time/test => test}/TestMonthDay.hs | 0 {time/test => test}/TestMonthDay.ref | 0 {time/test => test}/TestParseDAT.hs | 0 {time/test => test}/TestParseDAT.ref | 0 {time/test => test}/TestParseTime.hs | 0 {time/test => test}/TestTime.hs | 0 {time/test => test}/TestTime.ref | 0 {time/test => test}/TimeZone.hs | 0 {time/test => test}/UseCases.lhs | 0 {time/test => test}/tai-utc.dat | 0 time/Makefile | 193 ---------------------------------- 28 files changed, 193 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 9b6744e0fb08826431d844e6f3e0e1f57544f8cf From git at git.haskell.org Mon Feb 20 21:11:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:11:47 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: HsTime.h should be installed (acf02ec) Message-ID: <20170220211147.28CCE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/acf02ece782ad06eed2bf8980e2c24e65d6dca3b >--------------------------------------------------------------- commit acf02ece782ad06eed2bf8980e2c24e65d6dca3b Author: mukai Date: Wed Dec 13 07:13:46 2006 -0800 HsTime.h should be installed darcs-hash:20061213151346-f0081-bc57b7801c511854b6e762e4db78a5e68ff109b7 >--------------------------------------------------------------- acf02ece782ad06eed2bf8980e2c24e65d6dca3b Makefile | 2 +- include/Makefile | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e2d286b..76ea560 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ TOP=.. include $(TOP)/mk/boilerplate.mk -SUBDIRS = +SUBDIRS = include ALL_DIRS = \ cbits \ diff --git a/include/Makefile b/include/Makefile new file mode 100644 index 0000000..748523c --- /dev/null +++ b/include/Makefile @@ -0,0 +1,11 @@ +TOP=../.. +include $(TOP)/mk/boilerplate.mk + +H_FILES = $(wildcard *.h) + +includedir = $(libdir)/include +INSTALL_INCLUDES = $(H_FILES) + +DIST_CLEAN_FILES += HsTimeConfig.h + +include $(TOP)/mk/target.mk From git at git.haskell.org Mon Feb 20 21:11:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:11:49 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: clean up .xcodeproj to use cabal (5892926) Message-ID: <20170220211149.34B9C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/58929269a10f917192c37231dade58935dded69b >--------------------------------------------------------------- commit 58929269a10f917192c37231dade58935dded69b Author: Ashley Yakeley Date: Tue Dec 19 21:05:38 2006 -0800 clean up .xcodeproj to use cabal darcs-hash:20061220050538-ac6dd-e79ba99f9d60002b3298c351f73744dd7fc8eafd >--------------------------------------------------------------- 58929269a10f917192c37231dade58935dded69b time.xcodeproj/cabalbuild | 5 + .../project.pbxproj | 180 +++++---------------- 2 files changed, 42 insertions(+), 143 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 58929269a10f917192c37231dade58935dded69b From git at git.haskell.org Mon Feb 20 21:11:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:11:51 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: improve error reporting in XCode (a4b8812) Message-ID: <20170220211151.3C5AF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/a4b8812aa30291185aca449117d2bc8141985121 >--------------------------------------------------------------- commit a4b8812aa30291185aca449117d2bc8141985121 Author: Ashley Yakeley Date: Tue Dec 19 22:49:48 2006 -0800 improve error reporting in XCode darcs-hash:20061220064948-ac6dd-e6e4ca06bf1e0a7d15ca9d825a42a6b34775cefc >--------------------------------------------------------------- a4b8812aa30291185aca449117d2bc8141985121 time.xcodeproj/cabalbuild | 5 ++++- time.xcodeproj/fixerrormsgs | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/time.xcodeproj/cabalbuild b/time.xcodeproj/cabalbuild index 6b4a2d1..2462967 100755 --- a/time.xcodeproj/cabalbuild +++ b/time.xcodeproj/cabalbuild @@ -1,5 +1,8 @@ #!/bin/sh +{ case $1 in '' ) runghc Setup.hs configure;runghc Setup.hs build ;; * ) runghc Setup.hs $1 ;; -esac +esac 2>&1; +} | ${0/%cabalbuild/}/fixerrormsgs +exit $PIPESTATUS diff --git a/time.xcodeproj/fixerrormsgs b/time.xcodeproj/fixerrormsgs new file mode 100755 index 0000000..ee6d461 --- /dev/null +++ b/time.xcodeproj/fixerrormsgs @@ -0,0 +1,10 @@ +#!/usr/bin/perl +$| = 1; +my $found = false; +while (<>) + { + s/^[ ]*/ / if $found; + s/^ Warning:/ warning:/ if $found; + $found = s/(^[^ ][^ ]*:[0-9][0-9]*:)\n/$1/; + print; + } From git at git.haskell.org Mon Feb 20 21:11:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:11:53 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: XCode tweak (ef08a05) Message-ID: <20170220211153.42A2E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/ef08a05eb43c43181d0af24ba66dd6038f078665 >--------------------------------------------------------------- commit ef08a05eb43c43181d0af24ba66dd6038f078665 Author: Ashley Yakeley Date: Tue Dec 19 22:50:56 2006 -0800 XCode tweak darcs-hash:20061220065056-ac6dd-5e7ba8cb7e336e47f345da73ee1bec98f45ef182 >--------------------------------------------------------------- ef08a05eb43c43181d0af24ba66dd6038f078665 time.xcodeproj/project.pbxproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/time.xcodeproj/project.pbxproj b/time.xcodeproj/project.pbxproj index 6152858..a4fb8b8 100644 --- a/time.xcodeproj/project.pbxproj +++ b/time.xcodeproj/project.pbxproj @@ -87,6 +87,7 @@ AB6859EE0AC73993004B83FC /* prologue.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = prologue.txt; sourceTree = ""; }; AB7FC7490954C86800796113 /* UTCDiff.hs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.haskell; path = UTCDiff.hs; sourceTree = ""; }; AB7FC8360954E17000796113 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = ""; }; + AB9864C60B39084300D66E11 /* Setup.hs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.haskell; path = Setup.hs; sourceTree = ""; }; ABC0F98D090C7A6000DEF265 /* tai-utc.dat */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "tai-utc.dat"; sourceTree = ""; }; ABC0F98E090C7A6000DEF265 /* TestParseDAT.hs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.haskell; path = TestParseDAT.hs; sourceTree = ""; }; ABC0F9910913518A00DEF265 /* TestParseDAT.ref */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = TestParseDAT.ref; sourceTree = ""; }; @@ -165,6 +166,7 @@ isa = PBXGroup; children = ( AB01DCF708374808003C9EF7 /* time.cabal */, + AB9864C60B39084300D66E11 /* Setup.hs */, AB7FC8360954E17000796113 /* LICENSE */, AB01DCF908374808003C9EF7 /* HsTime.h */, AB01DCF808374808003C9EF7 /* HsTime.c */, From git at git.haskell.org Mon Feb 20 21:11:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:11:55 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: xcodeproj cleanup (49451d6) Message-ID: <20170220211155.4A1E83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/49451d6560edc0cf438c63d06b392a61f224c2ca >--------------------------------------------------------------- commit 49451d6560edc0cf438c63d06b392a61f224c2ca Author: Ashley Yakeley Date: Wed Dec 20 02:10:47 2006 -0800 xcodeproj cleanup darcs-hash:20061220101047-ac6dd-3093f56c4241839008d7f7d41348462ddab923de >--------------------------------------------------------------- 49451d6560edc0cf438c63d06b392a61f224c2ca time.xcodeproj/project.pbxproj | 160 +---------------------------------------- 1 file changed, 2 insertions(+), 158 deletions(-) diff --git a/time.xcodeproj/project.pbxproj b/time.xcodeproj/project.pbxproj index a4fb8b8..ee8c7d6 100644 --- a/time.xcodeproj/project.pbxproj +++ b/time.xcodeproj/project.pbxproj @@ -91,6 +91,7 @@ ABC0F98D090C7A6000DEF265 /* tai-utc.dat */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "tai-utc.dat"; sourceTree = ""; }; ABC0F98E090C7A6000DEF265 /* TestParseDAT.hs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.haskell; path = TestParseDAT.hs; sourceTree = ""; }; ABC0F9910913518A00DEF265 /* TestParseDAT.ref */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = TestParseDAT.ref; sourceTree = ""; }; + ABD4C3540B3939E7003A5C75 /* TestParseTime.hs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.haskell; path = TestParseTime.hs; sourceTree = ""; }; ABD6783F084167B900CF37C0 /* POSIX.hs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.haskell; path = POSIX.hs; sourceTree = ""; }; ABD67840084167D100CF37C0 /* CTimeval.hs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.haskell; path = CTimeval.hs; sourceTree = ""; }; ABD67841084168B700CF37C0 /* UTC.hs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.haskell; path = UTC.hs; sourceTree = ""; }; @@ -247,6 +248,7 @@ AB20A9E509275795001A7C3C /* TestEaster.ref */, ABC0F98D090C7A6000DEF265 /* tai-utc.dat */, AB26689F08A6D7290059DEC0 /* UseCases.lhs */, + ABD4C3540B3939E7003A5C75 /* TestParseTime.hs */, ); path = test; sourceTree = ""; @@ -339,40 +341,6 @@ /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ - ABD26A480878B4D200AD8A23 /* Development */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = NO; - OTHER_CFLAGS = ""; - OTHER_LDFLAGS = ""; - OTHER_REZFLAGS = ""; - PRODUCT_NAME = Untitled; - SECTORDER_FLAGS = ""; - WARNING_CFLAGS = ( - "-Wmost", - "-Wno-four-char-constants", - "-Wno-unknown-pragmas", - ); - }; - name = Development; - }; - ABD26A490878B4D200AD8A23 /* Deployment */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = YES; - OTHER_CFLAGS = ""; - OTHER_LDFLAGS = ""; - OTHER_REZFLAGS = ""; - PRODUCT_NAME = Untitled; - SECTORDER_FLAGS = ""; - WARNING_CFLAGS = ( - "-Wmost", - "-Wno-four-char-constants", - "-Wno-unknown-pragmas", - ); - }; - name = Deployment; - }; ABD26A4A0878B4D200AD8A23 /* Default */ = { isa = XCBuildConfiguration; buildSettings = { @@ -380,40 +348,6 @@ }; name = Default; }; - ABD26A4C0878B4D200AD8A23 /* Development */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = NO; - OTHER_CFLAGS = ""; - OTHER_LDFLAGS = ""; - OTHER_REZFLAGS = ""; - PRODUCT_NAME = Test; - SECTORDER_FLAGS = ""; - WARNING_CFLAGS = ( - "-Wmost", - "-Wno-four-char-constants", - "-Wno-unknown-pragmas", - ); - }; - name = Development; - }; - ABD26A4D0878B4D200AD8A23 /* Deployment */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = YES; - OTHER_CFLAGS = ""; - OTHER_LDFLAGS = ""; - OTHER_REZFLAGS = ""; - PRODUCT_NAME = Test; - SECTORDER_FLAGS = ""; - WARNING_CFLAGS = ( - "-Wmost", - "-Wno-four-char-constants", - "-Wno-unknown-pragmas", - ); - }; - name = Deployment; - }; ABD26A4E0878B4D200AD8A23 /* Default */ = { isa = XCBuildConfiguration; buildSettings = { @@ -421,40 +355,6 @@ }; name = Default; }; - ABD26A500878B4D200AD8A23 /* Development */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = NO; - OTHER_CFLAGS = ""; - OTHER_LDFLAGS = ""; - OTHER_REZFLAGS = ""; - PRODUCT_NAME = Untitled; - SECTORDER_FLAGS = ""; - WARNING_CFLAGS = ( - "-Wmost", - "-Wno-four-char-constants", - "-Wno-unknown-pragmas", - ); - }; - name = Development; - }; - ABD26A510878B4D200AD8A23 /* Deployment */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = YES; - OTHER_CFLAGS = ""; - OTHER_LDFLAGS = ""; - OTHER_REZFLAGS = ""; - PRODUCT_NAME = Untitled; - SECTORDER_FLAGS = ""; - WARNING_CFLAGS = ( - "-Wmost", - "-Wno-four-char-constants", - "-Wno-unknown-pragmas", - ); - }; - name = Deployment; - }; ABD26A520878B4D200AD8A23 /* Default */ = { isa = XCBuildConfiguration; buildSettings = { @@ -462,40 +362,6 @@ }; name = Default; }; - ABD26A540878B4D200AD8A23 /* Development */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = NO; - OTHER_CFLAGS = ""; - OTHER_LDFLAGS = ""; - OTHER_REZFLAGS = ""; - PRODUCT_NAME = Everything; - SECTORDER_FLAGS = ""; - WARNING_CFLAGS = ( - "-Wmost", - "-Wno-four-char-constants", - "-Wno-unknown-pragmas", - ); - }; - name = Development; - }; - ABD26A550878B4D200AD8A23 /* Deployment */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = YES; - OTHER_CFLAGS = ""; - OTHER_LDFLAGS = ""; - OTHER_REZFLAGS = ""; - PRODUCT_NAME = Everything; - SECTORDER_FLAGS = ""; - WARNING_CFLAGS = ( - "-Wmost", - "-Wno-four-char-constants", - "-Wno-unknown-pragmas", - ); - }; - name = Deployment; - }; ABD26A560878B4D200AD8A23 /* Default */ = { isa = XCBuildConfiguration; buildSettings = { @@ -512,18 +378,6 @@ }; name = Default; }; - ABD26A580878B4D200AD8A23 /* Development */ = { - isa = XCBuildConfiguration; - buildSettings = { - }; - name = Development; - }; - ABD26A590878B4D200AD8A23 /* Deployment */ = { - isa = XCBuildConfiguration; - buildSettings = { - }; - name = Deployment; - }; ABD26A5A0878B4D200AD8A23 /* Default */ = { isa = XCBuildConfiguration; buildSettings = { @@ -536,8 +390,6 @@ ABD26A470878B4D200AD8A23 /* Build configuration list for PBXLegacyTarget "Build" */ = { isa = XCConfigurationList; buildConfigurations = ( - ABD26A480878B4D200AD8A23 /* Development */, - ABD26A490878B4D200AD8A23 /* Deployment */, ABD26A4A0878B4D200AD8A23 /* Default */, ); defaultConfigurationIsVisible = 0; @@ -546,8 +398,6 @@ ABD26A4B0878B4D200AD8A23 /* Build configuration list for PBXLegacyTarget "Test" */ = { isa = XCConfigurationList; buildConfigurations = ( - ABD26A4C0878B4D200AD8A23 /* Development */, - ABD26A4D0878B4D200AD8A23 /* Deployment */, ABD26A4E0878B4D200AD8A23 /* Default */, ); defaultConfigurationIsVisible = 0; @@ -556,8 +406,6 @@ ABD26A4F0878B4D200AD8A23 /* Build configuration list for PBXLegacyTarget "Documentation" */ = { isa = XCConfigurationList; buildConfigurations = ( - ABD26A500878B4D200AD8A23 /* Development */, - ABD26A510878B4D200AD8A23 /* Deployment */, ABD26A520878B4D200AD8A23 /* Default */, ); defaultConfigurationIsVisible = 0; @@ -566,8 +414,6 @@ ABD26A530878B4D200AD8A23 /* Build configuration list for PBXAggregateTarget "Everything" */ = { isa = XCConfigurationList; buildConfigurations = ( - ABD26A540878B4D200AD8A23 /* Development */, - ABD26A550878B4D200AD8A23 /* Deployment */, ABD26A560878B4D200AD8A23 /* Default */, ); defaultConfigurationIsVisible = 0; @@ -576,8 +422,6 @@ ABD26A570878B4D200AD8A23 /* Build configuration list for PBXProject "time" */ = { isa = XCConfigurationList; buildConfigurations = ( - ABD26A580878B4D200AD8A23 /* Development */, - ABD26A590878B4D200AD8A23 /* Deployment */, ABD26A5A0878B4D200AD8A23 /* Default */, ); defaultConfigurationIsVisible = 0; From git at git.haskell.org Mon Feb 20 21:11:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:11:57 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: attempt to get cabal test working (843ed89) Message-ID: <20170220211157.5089E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/843ed89f8f3d46ddabe04f1ea8ccf33426a13c92 >--------------------------------------------------------------- commit 843ed89f8f3d46ddabe04f1ea8ccf33426a13c92 Author: Ashley Yakeley Date: Wed Dec 20 02:12:54 2006 -0800 attempt to get cabal test working darcs-hash:20061220101254-ac6dd-56f6ff37f578c96f352ca61032eaf269e727bdf9 >--------------------------------------------------------------- 843ed89f8f3d46ddabe04f1ea8ccf33426a13c92 Setup.hs | 19 +++++++++++++++++-- test/Makefile | 8 ++++---- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/Setup.hs b/Setup.hs index 60804b2..2859262 100644 --- a/Setup.hs +++ b/Setup.hs @@ -1,6 +1,21 @@ module Main (main) where -import Distribution.Simple (defaultMainWithHooks, defaultUserHooks) +import Distribution.Simple +import Distribution.PackageDescription +import Distribution.Simple.LocalBuildInfo +import System.Exit +import System.Cmd +import System.Directory +import Control.Exception + +withCurrentDirectory :: FilePath -> IO a -> IO a +withCurrentDirectory path f = do + cur <- getCurrentDirectory + setCurrentDirectory path + finally f (setCurrentDirectory cur) + +runTestScript :: Args -> Bool -> PackageDescription -> LocalBuildInfo -> IO ExitCode +runTestScript args flag pd lbi = withCurrentDirectory "test" (system "make") main :: IO () -main = defaultMainWithHooks defaultUserHooks +main = defaultMainWithHooks defaultUserHooks{runTests = runTestScript} diff --git a/test/Makefile b/test/Makefile index c3f2992..ff2454b 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,6 +1,6 @@ GHC = ghc -GHCFLAGS = -LIBS = ../../dist/build/libHStime-1.0.a +GHCFLAGS = -i../dist/build +LIBS = ../dist/build/libHStime-1.0.a default: CurrentTime.run ShowDST.run test @@ -88,10 +88,10 @@ clean: @: %.o: %.hs - ghc -i.. -c $< -o $@ + $(GHC) $(GHCFLAGS) -c $< -o $@ %.o: %.lhs - ghc -i.. -c $< -o $@ + $(GHC) $(GHCFLAGS) -c $< -o $@ FORCE: From git at git.haskell.org Mon Feb 20 21:11:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:11:59 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: get "runhaskell Setup.hs test" to work (ab61764) Message-ID: <20170220211159.5722E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/ab6176494357c23ad1bd6b4a79bc5cbeae76c4b6 >--------------------------------------------------------------- commit ab6176494357c23ad1bd6b4a79bc5cbeae76c4b6 Author: Ashley Yakeley Date: Fri Dec 22 18:26:02 2006 -0800 get "runhaskell Setup.hs test" to work darcs-hash:20061223022602-ac6dd-8a16b100b94134574f8368cb1a521ea0d55ff64f >--------------------------------------------------------------- ab6176494357c23ad1bd6b4a79bc5cbeae76c4b6 test/Makefile | 36 +++++++++++++++++++----------------- test/TestParseTime.hs | 23 ++++++++++++++++------- 2 files changed, 35 insertions(+), 24 deletions(-) diff --git a/test/Makefile b/test/Makefile index ff2454b..ecfaa96 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,55 +1,57 @@ GHC = ghc -GHCFLAGS = -i../dist/build -LIBS = ../dist/build/libHStime-1.0.a +GHCFLAGS = -package time -default: CurrentTime.run ShowDST.run test +default: + cd ..; runhaskell Setup.hs register --user --inplace + make CurrentTime.run ShowDST.run test + cd ..; runhaskell Setup.hs unregister --user -TestMonthDay: TestMonthDay.o $(LIBS) +TestMonthDay: TestMonthDay.o $(GHC) $(GHCFLAGS) $^ -o $@ -ConvertBack: ConvertBack.o $(LIBS) +ConvertBack: ConvertBack.o $(GHC) $(GHCFLAGS) $^ -o $@ -TestCalendars: TestCalendars.o $(LIBS) +TestCalendars: TestCalendars.o $(GHC) $(GHCFLAGS) $^ -o $@ -TestTime: TestTime.o $(LIBS) +TestTime: TestTime.o $(GHC) $(GHCFLAGS) $^ -o $@ -LongWeekYears: LongWeekYears.o $(LIBS) +LongWeekYears: LongWeekYears.o $(GHC) $(GHCFLAGS) $^ -o $@ -ClipDates: ClipDates.o $(LIBS) +ClipDates: ClipDates.o $(GHC) $(GHCFLAGS) $^ -o $@ -AddDays: AddDays.o $(LIBS) +AddDays: AddDays.o $(GHC) $(GHCFLAGS) $^ -o $@ -TestFormat: TestFormat.o TestFormatStuff.o $(LIBS) +TestFormat: TestFormat.o TestFormatStuff.o $(GHC) $(GHCFLAGS) $^ -o $@ TestFormatStuff.o: TestFormatStuff.c TestFormatStuff.h gcc -o $@ -c $< -TestParseDAT: TestParseDAT.o $(LIBS) +TestParseDAT: TestParseDAT.o $(GHC) $(GHCFLAGS) $^ -o $@ -TestEaster: TestEaster.o $(LIBS) +TestEaster: TestEaster.o $(GHC) $(GHCFLAGS) $^ -o $@ -CurrentTime: CurrentTime.o $(LIBS) +CurrentTime: CurrentTime.o $(GHC) $(GHCFLAGS) $^ -o $@ -ShowDST: ShowDST.o $(LIBS) +ShowDST: ShowDST.o $(GHC) $(GHCFLAGS) $^ -o $@ -TimeZone: TimeZone.o $(LIBS) +TimeZone: TimeZone.o $(GHC) $(GHCFLAGS) $^ -o $@ TimeZone.ref: FORCE date +%z > $@ -TestParseTime: TestParseTime.o $(LIBS) +TestParseTime: TestParseTime.o $(GHC) $(GHCFLAGS) -package QuickCheck $^ -o $@ test: \ diff --git a/test/TestParseTime.hs b/test/TestParseTime.hs index 91d76b0..ad0c1c5 100644 --- a/test/TestParseTime.hs +++ b/test/TestParseTime.hs @@ -1,3 +1,5 @@ +{-# OPTIONS -Wall -Werror -fno-warn-type-defaults -fno-warn-unused-binds #-} + import Control.Monad import Data.Char import Data.Ratio @@ -10,6 +12,7 @@ import System.Locale import Test.QuickCheck +ntest :: Int ntest = 1000 main :: IO () @@ -26,10 +29,13 @@ checkOne :: Config -> NamedProperty -> IO () checkOne config (n,p) = do putStr (rpad 65 ' ' n) check config p - where rpad n c xs = xs ++ replicate (n - length xs) c + where rpad n' c xs = xs ++ replicate (n' - length xs) c + +parse :: ParseTime t => String -> String -> Maybe t parse f t = parseTime defaultTimeLocale f t +format :: (FormatTime t) => String -> t -> String format f t = formatTime defaultTimeLocale f t @@ -39,12 +45,12 @@ instance Arbitrary Day where instance Arbitrary DiffTime where arbitrary = oneof [intSecs, fracSecs] -- up to 1 leap second - where intSecs = liftM secondsToDiffTime $ choose (0, 86400) - fracSecs = liftM picosecondsToDiffTime $ choose (0, 86400 * 10^12) - secondsToDiffTime :: Integer -> DiffTime - secondsToDiffTime = fromInteger - picosecondsToDiffTime :: Integer -> DiffTime - picosecondsToDiffTime x = fromRational (x % 10^12) + where intSecs = liftM secondsToDiffTime' $ choose (0, 86400) + fracSecs = liftM picosecondsToDiffTime' $ choose (0, 86400 * 10^12) + secondsToDiffTime' :: Integer -> DiffTime + secondsToDiffTime' = fromInteger + picosecondsToDiffTime' :: Integer -> DiffTime + picosecondsToDiffTime' x = fromRational (x % 10^12) coarbitrary t = coarbitrary (fromEnum t) instance Arbitrary TimeOfDay where @@ -75,6 +81,7 @@ instance Eq ZonedTime where -- * tests for dbugging failing cases -- +test_parse_format :: (FormatTime t,ParseTime t,Show t) => String -> t -> (String,String,Maybe t) test_parse_format f t = let s = format f t in (show t, s, parse f s `asTypeOf` Just t) -- @@ -101,11 +108,13 @@ prop_parse_showOrdinalDate d = parse "%Y-%j" (showOrdinalDate d) == Just d -- * fromMondayStartWeek and fromSundayStartWeek -- +prop_fromMondayStartWeek :: Day -> Bool prop_fromMondayStartWeek d = let (w,wd) = mondayStartWeek d (y,_,_) = toGregorian d in fromMondayStartWeek y w wd == d +prop_fromSundayStartWeek :: Day -> Bool prop_fromSundayStartWeek d = let (w,wd) = sundayStartWeek d (y,_,_) = toGregorian d From git at git.haskell.org Mon Feb 20 21:12:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:12:01 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Changed %S to return whole seconds, and added %Q and %q. (f73da90) Message-ID: <20170220211201.5E81F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/f73da902c82a2ce5f0a336ee1fd1774df5bdb6e2 >--------------------------------------------------------------- commit f73da902c82a2ce5f0a336ee1fd1774df5bdb6e2 Author: bjorn Date: Sun Feb 11 07:53:58 2007 -0800 Changed %S to return whole seconds, and added %Q and %q. Implements part of http://hackage.haskell.org/trac/ghc/ticket/1007 formatTime: Change %S to: the number of whole seconds. formatTime: Add %q: the number of picoseconds (including trailing zeroes). formatTime: Add %Q: decimal point and second decimals, without trailing zeros. If the number of picoseconds is zero, nothing is produced (not even the decimal point). Rationale: Currently %S includes decimals if there are any. This is different from strftime, and there is no format specifier for just the integer part of the seconds. It would be nice to have such a specifier to implement many standard date formats (e.g. RFC 822). Also a specifier for second decimals would also help when using %s. Currently there is no reasonable way to get more than integer second precision with since-epoch timestamps. The current %S would be equivalent to %S%Q under this proposal." darcs-hash:20070211155358-6cdb2-de94204665c57a1b86b65bd80f1a98d3d469d0f0 >--------------------------------------------------------------- f73da902c82a2ce5f0a336ee1fd1774df5bdb6e2 Data/Time/LocalTime/Format.hs | 19 +++++++++++++++---- Data/Time/LocalTime/Parse.hs | 34 +++++++++++++++++++--------------- 2 files changed, 34 insertions(+), 19 deletions(-) diff --git a/Data/Time/LocalTime/Format.hs b/Data/Time/LocalTime/Format.hs index c13160e..fc26327 100644 --- a/Data/Time/LocalTime/Format.hs +++ b/Data/Time/LocalTime/Format.hs @@ -20,6 +20,7 @@ import Data.Time.Clock.POSIX import System.Locale import Data.Maybe import Data.Char +import Data.Fixed -- class FormatTime t where @@ -69,11 +70,19 @@ class FormatTime t where -- -- [@%M@] minute, @00@ - @59@ -- --- [@%S@] second with decimal part if not an integer, @00@ - @60.999999999999@ +-- [@%S@] second, without decimal part, @00@ - @60@ +-- +-- [@%q@] picosecond, including trailing zeros, @000000000000@ - @999999999999 at . +-- +-- [@%Q@] decimal point and up to 12 second decimals, without trailing zeros. +-- For a whole number of seconds, @%Q@ produces the empty string. -- -- For UTCTime and ZonedTime: -- --- [@%s@] number of seconds since the Unix epoch +-- [@%s@] number of whole seconds since the Unix epoch. For times before +-- the Unix epoch, this is a negative number. Note that in @%s.%q@ and @%s%Q@ +-- the decimals are positive, not negative. For example, 0.9 seconds +-- before the Unix epoch is formatted as @-1.1@ with @%s%Q at . -- -- For Day (and LocalTime and ZonedTime and UTCTime): -- @@ -154,14 +163,16 @@ instance FormatTime TimeOfDay where -- Minute formatCharacter 'M' = Just (\_ -> show2 . todMin) -- Second - formatCharacter 'S' = Just (\_ -> show2Fixed . todSec) + formatCharacter 'S' = Just (\_ -> (show2 :: Int -> String) . truncate . todSec) + formatCharacter 'q' = Just (\_ -> drop 1 . dropWhile (/='.') . showFixed False . todSec) + formatCharacter 'Q' = Just (\_ -> dropWhile (/='.') . showFixed True . todSec) -- Default formatCharacter _ = Nothing instance FormatTime ZonedTime where formatCharacter 'c' = Just (\locale -> formatTime locale (dateTimeFmt locale)) - formatCharacter 's' = Just (\_ zt -> show (truncate (utcTimeToPOSIXSeconds (zonedTimeToUTC zt)) :: Integer)) + formatCharacter 's' = Just (\_ zt -> show (floor (utcTimeToPOSIXSeconds (zonedTimeToUTC zt)) :: Integer)) formatCharacter c = case (formatCharacter c) of Just f -> Just (\locale dt -> f locale (zonedTimeToLocalTime dt)) Nothing -> case (formatCharacter c) of diff --git a/Data/Time/LocalTime/Parse.hs b/Data/Time/LocalTime/Parse.hs index a5420d3..b6ae350 100644 --- a/Data/Time/LocalTime/Parse.hs +++ b/Data/Time/LocalTime/Parse.hs @@ -123,10 +123,9 @@ parseValue l c = 'k' -> spdigits 2 'l' -> spdigits 2 'M' -> digits 2 - 'S' -> do s <- digits 2 - ds <- liftM2 (:) (char '.') (munch isDigit) - <++ return "" - return $ s ++ ds + 'S' -> digits 2 + 'q' -> digits 12 + 'Q' -> liftM2 (:) (char '.') (munch isDigit) <++ return "" 's' -> (char '-' >> liftM ('-':) (munch1 isDigit)) <++ munch1 isDigit 'Y' -> digits 4 @@ -246,18 +245,20 @@ instance ParseTime TimeOfDay where 'k' -> TimeOfDay (read x) m s 'l' -> TimeOfDay (read x) m s 'M' -> TimeOfDay h (read x) s - 'S' -> TimeOfDay h m (readFixed x) + 'S' -> TimeOfDay h m (fromInteger (read x)) + 'q' -> TimeOfDay h m (mkPico (truncate s) (read x)) + 'Q' -> if null x then t + else let ps = read $ take 12 $ rpad 12 '0' $ drop 1 x + in TimeOfDay h m (mkPico (truncate s) ps) _ -> t where am = TimeOfDay (h `mod` 12) m s pm = TimeOfDay (if h < 12 then h + 12 else h) m s +rpad :: Int -> a -> [a] -> [a] +rpad n c xs = xs ++ replicate (n - length xs) c -readFixed :: HasResolution a => String -> Fixed a -readFixed s = case break (=='.') s of - (x,"") -> fromInteger (read x) - (x,_:y) -> mkFixed12 (read x) (read (rpad 12 '0' y)) - where rpad n c xs = xs ++ replicate (n - length xs) c - mkFixed12 i f = fromInteger i + fromRational (f % 1000000000000) +mkPico :: Integer -> Integer -> Pico +mkPico i f = fromInteger i + fromRational (f % 1000000000000) instance ParseTime LocalTime where buildTime l xs = LocalTime (buildTime l xs) (buildTime l xs) @@ -278,9 +279,12 @@ instance ParseTime TimeZone where instance ParseTime ZonedTime where buildTime l xs = foldl f (ZonedTime (buildTime l xs) (buildTime l xs)) xs where - f t (c,x) = + f t@(ZonedTime (LocalTime _ tod) z) (c,x) = case c of - 's' -> utcToZonedTime (zonedTimeZone t) (posixSecondsToUTCTime (fromInteger (read x))) + 's' -> let s = fromInteger (read x) + (_,ps) = properFraction (todSec tod) :: (Integer,Pico) + s' = s + fromRational (toRational ps) + in utcToZonedTime z (posixSecondsToUTCTime s') _ -> t instance ParseTime UTCTime where @@ -292,10 +296,10 @@ instance Read Day where readsPrec _ = readParen False $ readsTime defaultTimeLocale "%Y-%m-%d" instance Read TimeOfDay where - readsPrec _ = readParen False $ readsTime defaultTimeLocale "%H:%M:%S" + readsPrec _ = readParen False $ readsTime defaultTimeLocale "%H:%M:%S%Q" instance Read LocalTime where - readsPrec _ = readParen False $ readsTime defaultTimeLocale "%Y-%m-%d %H:%M:%S" + readsPrec _ = readParen False $ readsTime defaultTimeLocale "%Y-%m-%d %H:%M:%S%Q" instance Read TimeZone where readsPrec _ = readParen False $ \s -> From git at git.haskell.org Mon Feb 20 21:12:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:12:03 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: QuickCheck properties for the new %S, %q and %Q. (fcf3460) Message-ID: <20170220211203.6591C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/fcf34604835eb3f4b512052b49a1f51d3bc65fed >--------------------------------------------------------------- commit fcf34604835eb3f4b512052b49a1f51d3bc65fed Author: bjorn Date: Sun Feb 11 08:15:46 2007 -0800 QuickCheck properties for the new %S, %q and %Q. darcs-hash:20070211161546-6cdb2-207fccfeafd267fd7216458018b523bd134137e4 >--------------------------------------------------------------- fcf34604835eb3f4b512052b49a1f51d3bc65fed test/TestParseTime.hs | 102 ++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 83 insertions(+), 19 deletions(-) diff --git a/test/TestParseTime.hs b/test/TestParseTime.hs index ad0c1c5..8b8b334 100644 --- a/test/TestParseTime.hs +++ b/test/TestParseTime.hs @@ -133,6 +133,16 @@ prop_parse_format_named typeName f = ("prop_parse_format " ++ typeName ++ " " ++ show f, property (prop_parse_format f)) +prop_format_parse_format :: (FormatTime t, ParseTime t) => FormatString t -> t -> Bool +prop_format_parse_format (FormatString f) t = + fmap (format f) (parse f (format f t) `asTypeOf` Just t) == Just (format f t) + +prop_format_parse_format_named :: (Arbitrary t, Show t, FormatTime t, ParseTime t) + => String -> FormatString t -> NamedProperty +prop_format_parse_format_named typeName f = + ("prop_format_parse_format " ++ typeName ++ " " ++ show f, + property (prop_format_parse_format f)) + -- -- * crashes in parse -- @@ -190,6 +200,7 @@ properties = ++ [("prop_parse_showWeekDate", property prop_parse_showWeekDate), ("prop_parse_showGregorian", property prop_parse_showGregorian), ("prop_parse_showOrdinalDate", property prop_parse_showOrdinalDate)] + ++ map (prop_parse_format_named "Day") dayFormats ++ map (prop_parse_format_named "TimeOfDay") timeOfDayFormats ++ map (prop_parse_format_named "LocalTime") localTimeFormats @@ -197,13 +208,19 @@ properties = ++ map (prop_parse_format_named "ZonedTime") zonedTimeFormats ++ map (prop_parse_format_named "UTCTime") utcTimeFormats - ++ map (prop_no_crash_bad_input_named "Day") dayFormats - ++ map (prop_no_crash_bad_input_named "TimeOfDay") timeOfDayFormats - ++ map (prop_no_crash_bad_input_named "LocalTime") localTimeFormats - ++ map (prop_no_crash_bad_input_named "TimeZone") timeZoneFormats - ++ map (prop_no_crash_bad_input_named "ZonedTime") zonedTimeFormats - ++ map (prop_no_crash_bad_input_named "UTCTime") utcTimeFormats + ++ map (prop_format_parse_format_named "Day") partialDayFormats + ++ map (prop_format_parse_format_named "TimeOfDay") partialTimeOfDayFormats + ++ map (prop_format_parse_format_named "LocalTime") partialLocalTimeFormats + ++ map (prop_format_parse_format_named "TimeZone") partialTimeZoneFormats + ++ map (prop_format_parse_format_named "ZonedTime") partialZonedTimeFormats + ++ map (prop_format_parse_format_named "UTCTime") partialUTCTimeFormats + ++ map (prop_no_crash_bad_input_named "Day") (dayFormats ++ partialDayFormats ++ failingDayFormats) + ++ map (prop_no_crash_bad_input_named "TimeOfDay") (timeOfDayFormats ++ partialTimeOfDayFormats ++ failingTimeOfDayFormats) + ++ map (prop_no_crash_bad_input_named "LocalTime") (localTimeFormats ++ partialLocalTimeFormats ++ failingLocalTimeFormats) + ++ map (prop_no_crash_bad_input_named "TimeZone") (timeZoneFormats ++ partialTimeZoneFormats ++ failingTimeZoneFormats) + ++ map (prop_no_crash_bad_input_named "ZonedTime") (zonedTimeFormats ++ partialZonedTimeFormats ++ failingZonedTimeFormats) + ++ map (prop_no_crash_bad_input_named "UTCTime") (utcTimeFormats ++ partialUTCTimeFormats ++ failingUTCTimeFormats) @@ -227,14 +244,16 @@ timeOfDayFormats :: [FormatString TimeOfDay] timeOfDayFormats = map FormatString [ -- 24 h formats - "%H:%M:%S","%k:%M:%S","%H%M%S","%T","%X","%R:%S", + "%H:%M:%S.%q","%k:%M:%S.%q","%H%M%S.%q","%T.%q","%X.%q","%R:%S.%q", + "%H:%M:%S%Q","%k:%M:%S%Q","%H%M%S%Q","%T%Q","%X%Q","%R:%S%Q", -- 12 h formats - "%I:%M:%S %p","%I:%M:%S %P","%l:%M:%S %p","%r" + "%I:%M:%S.%q %p","%I:%M:%S.%q %P","%l:%M:%S.%q %p","%r %q", + "%I:%M:%S%Q %p","%I:%M:%S%Q %P","%l:%M:%S%Q %p","%r %Q" ] localTimeFormats :: [FormatString LocalTime] localTimeFormats = map FormatString $ - ["%c"] + [] {- -- there's soo many of them... concat [ [df ++ " " ++ tf, tf ++ " " ++ df] | FormatString df <- dayFormats, @@ -246,11 +265,52 @@ timeZoneFormats = map FormatString ["%z","%z%Z","%Z%z"] zonedTimeFormats :: [FormatString ZonedTime] zonedTimeFormats = map FormatString - ["%a, %d %b %Y %H:%M:%S %z"] + ["%a, %d %b %Y %H:%M:%S.%q %z", "%a, %d %b %Y %H:%M:%S%Q %z", "%s.%q %z", "%s%Q %z"] utcTimeFormats :: [FormatString UTCTime] utcTimeFormats = map FormatString - ["%c"] + ["%s.%q","%s%Q"] + +-- +-- * Formats that do not include all the information +-- + +partialDayFormats :: [FormatString Day] +partialDayFormats = map FormatString + [ ] + +partialTimeOfDayFormats :: [FormatString TimeOfDay] +partialTimeOfDayFormats = map FormatString + [ ] + +partialLocalTimeFormats :: [FormatString LocalTime] +partialLocalTimeFormats = map FormatString + [ + -- %c does not include second decimals + "%c" + ] + +partialTimeZoneFormats :: [FormatString TimeZone] +partialTimeZoneFormats = map FormatString + [ + ] + +partialZonedTimeFormats :: [FormatString ZonedTime] +partialZonedTimeFormats = map FormatString + [ + -- %s does not include second decimals + "%s %z" + ] + +partialUTCTimeFormats :: [FormatString UTCTime] +partialUTCTimeFormats = map FormatString + [ + -- %s does not include second decimals + "%s", + -- %c does not include second decimals + "%c" + ] + -- -- * Known failures @@ -266,13 +326,22 @@ knownFailures = + failingDayFormats :: [FormatString Day] failingDayFormats = map FormatString + [ -- ISO week dates with two digit year + "%g-%V-%u","%g-%V-%a","%g-%V-%A","%g-%V-%w", "%A week %V, %g", "day %V, week %A, %g", + "%g-W%V-%u" + ] + +failingTimeOfDayFormats :: [FormatString TimeOfDay] +failingTimeOfDayFormats = map FormatString [ ] failingLocalTimeFormats :: [FormatString LocalTime] failingLocalTimeFormats = map FormatString - [ ] + [ + ] failingTimeZoneFormats :: [FormatString TimeZone] failingTimeZoneFormats = map FormatString @@ -286,15 +355,10 @@ failingZonedTimeFormats = map FormatString [ -- can't figure out offset from %Z, also, formatTime produces "" for %Z "%c", - "%a, %d %b %Y %H:%M:%S %Z", - -- %s does not include second decimals - "%s %z" + "%a, %d %b %Y %H:%M:%S %Z" ] failingUTCTimeFormats :: [FormatString UTCTime] failingUTCTimeFormats = map FormatString - [ - -- %s does not include second decimals - "%s" - ] + [] From git at git.haskell.org Mon Feb 20 21:12:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:12:05 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Added %f: The century part of the week date year. (5ac1884) Message-ID: <20170220211205.6C37C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/5ac1884daa4866c151c1955cca0b0a308e95412d >--------------------------------------------------------------- commit 5ac1884daa4866c151c1955cca0b0a308e95412d Author: bjorn Date: Sun Feb 11 08:26:07 2007 -0800 Added %f: The century part of the week date year. Fixes part of http://hackage.haskell.org/trac/ghc/ticket/1007 Rationale: There is a %g specifier for the last two digits of the week date year, but no specifier for the century. %C cannot be used, since the normal century and the week date century can differ: > formatTime defaultTimeLocale "%Y %G" (fromGregorian 2000 1 1) "2000 1999" darcs-hash:20070211162607-6cdb2-605a7f26b21c0a063f2308683845e727688a35bd >--------------------------------------------------------------- 5ac1884daa4866c151c1955cca0b0a308e95412d Data/Time/LocalTime/Format.hs | 4 ++++ Data/Time/LocalTime/Parse.hs | 3 +++ test/TestParseTime.hs | 2 ++ 3 files changed, 9 insertions(+) diff --git a/Data/Time/LocalTime/Format.hs b/Data/Time/LocalTime/Format.hs index fc26327..ff9ca67 100644 --- a/Data/Time/LocalTime/Format.hs +++ b/Data/Time/LocalTime/Format.hs @@ -114,6 +114,8 @@ class FormatTime t where -- -- [@%g@] last two digits of year for Week Date format, @00@ - @99@ -- +-- [@%f@] century (first two digits of year) for Week Date format, @00@ - @99@ +-- -- [@%V@] week for Week Date format, @01@ - @53@ -- -- [@%u@] day for Week Date format, @1@ - @7@ @@ -208,6 +210,8 @@ instance FormatTime Day where -- ISO 8601 Week Date formatCharacter 'G' = Just (\_ -> show . (\(y,_,_) -> y) . toWeekDate) formatCharacter 'g' = Just (\_ -> show2 . mod100 . (\(y,_,_) -> y) . toWeekDate) + formatCharacter 'f' = Just (\_ -> show2 . div100 . (\(y,_,_) -> y) . toWeekDate) + formatCharacter 'V' = Just (\_ -> show2 . (\(_,w,_) -> w) . toWeekDate) formatCharacter 'u' = Just (\_ -> show . (\(_,_,d) -> d) . toWeekDate) diff --git a/Data/Time/LocalTime/Parse.hs b/Data/Time/LocalTime/Parse.hs index b6ae350..fa71a8a 100644 --- a/Data/Time/LocalTime/Parse.hs +++ b/Data/Time/LocalTime/Parse.hs @@ -139,6 +139,7 @@ parseValue l c = 'j' -> digits 3 'G' -> digits 4 'g' -> digits 2 + 'f' -> digits 2 'V' -> digits 2 'u' -> oneOf $ map (:[]) ['1'..'7'] 'a' -> oneOf (map snd (wDays l)) @@ -198,6 +199,8 @@ instance ParseTime Day where 'G' -> let y = read x in [Century (y `div` 100), Year (y `mod` 100)] -- %g: last two digits of year for Week Date format, 00 - 99 'g' -> [Year (read x)] + -- %f century (first two digits of year) for Week Date format, 00 - 99 + 'f' -> [Century (read x)] -- %V: week for Week Date format, 01 - 53 'V' -> [Week ISOWeek (read x)] -- %u: day for Week Date format, 1 - 7 diff --git a/test/TestParseTime.hs b/test/TestParseTime.hs index 8b8b334..876c227 100644 --- a/test/TestParseTime.hs +++ b/test/TestParseTime.hs @@ -236,6 +236,8 @@ dayFormats = map FormatString -- ISO week dates "%G-%V-%u","%G-%V-%a","%G-%V-%A","%G-%V-%w", "%A week %V, %G", "day %V, week %A, %G", "%G-W%V-%u", + "%f%g-%V-%u","%f%g-%V-%a","%f%g-%V-%A","%f%g-%V-%w", "%A week %V, %f%g", "day %V, week %A, %f%g", + "%f%g-W%V-%u", -- monday and sunday week dates "%Y-w%U-%A", "%Y-w%W-%A", "%Y-%A-w%U", "%Y-%A-w%W", "%A week %U, %Y", "%A week %W, %Y" ] From git at git.haskell.org Mon Feb 20 21:12:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:12:07 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Changed %Z to produce the time zone offset if the time zone name is "". (4d14562) Message-ID: <20170220211207.737C53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/4d14562fbd5ba0118216365198b3298eb6265648 >--------------------------------------------------------------- commit 4d14562fbd5ba0118216365198b3298eb6265648 Author: bjorn Date: Sun Feb 11 10:11:09 2007 -0800 Changed %Z to produce the time zone offset if the time zone name is "". Rationale: Without this, if you format a ZonedTime which contains an unnamed timezone, %Z produces the empty string. This is invalid in many formats. It is better to output the offset when there is no timezone name. darcs-hash:20070211181109-6cdb2-bde288cdfb6400ef08b24b26aa2f59d7f25807e4 >--------------------------------------------------------------- 4d14562fbd5ba0118216365198b3298eb6265648 Data/Time/LocalTime/Format.hs | 4 +++- Data/Time/LocalTime/Parse.hs | 17 ++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Data/Time/LocalTime/Format.hs b/Data/Time/LocalTime/Format.hs index ff9ca67..61a4e90 100644 --- a/Data/Time/LocalTime/Format.hs +++ b/Data/Time/LocalTime/Format.hs @@ -183,7 +183,9 @@ instance FormatTime ZonedTime where instance FormatTime TimeZone where formatCharacter 'z' = Just (\_ -> timeZoneOffsetString) - formatCharacter 'Z' = Just (\_ -> timeZoneName) + formatCharacter 'Z' = + Just (\_ z -> let n = timeZoneName z + in if null n then timeZoneOffsetString z else n) formatCharacter _ = Nothing instance FormatTime Day where diff --git a/Data/Time/LocalTime/Parse.hs b/Data/Time/LocalTime/Parse.hs index fa71a8a..605eee9 100644 --- a/Data/Time/LocalTime/Parse.hs +++ b/Data/Time/LocalTime/Parse.hs @@ -114,7 +114,9 @@ parseValue :: TimeLocale -> Char -> ReadP String parseValue l c = case c of 'z' -> liftM2 (:) (choice [char '+', char '-']) (digits 4) - 'Z' -> munch isUpper + 'Z' -> munch1 isUpper <++ + liftM2 (:) (choice [char '+', char '-']) (digits 4) <++ + return "" -- produced by %Z for LocalTime 'P' -> oneOf (let (am,pm) = amPm l in [map toLower am, map toLower pm]) 'p' -> oneOf (let (am,pm) = amPm l in [am, pm]) @@ -271,13 +273,16 @@ instance ParseTime TimeZone where where f t@(TimeZone offset dst name) (c,x) = case c of - 'z' -> TimeZone (sign * (60 * h + m)) dst name + 'z' -> zone + 'Z' | null x -> t + | isUpper (head x) -> TimeZone offset dst x -- FIXME: figure out timezone offset? + | otherwise -> zone + _ -> t + where zone = TimeZone (sign * (60 * h + m)) dst name where (s:h1:h2:m1:m2:[]) = x sign = if s == '-' then -1 else 1 h = read [h1,h2] m = read [m1,m2] - 'Z' -> TimeZone offset dst x -- FIXME: figure out timezone offset? - _ -> t instance ParseTime ZonedTime where buildTime l xs = foldl f (ZonedTime (buildTime l xs) (buildTime l xs)) xs @@ -305,9 +310,7 @@ instance Read LocalTime where readsPrec _ = readParen False $ readsTime defaultTimeLocale "%Y-%m-%d %H:%M:%S%Q" instance Read TimeZone where - readsPrec _ = readParen False $ \s -> - readsTime defaultTimeLocale "%z" s - ++ readsTime defaultTimeLocale "%Z" s + readsPrec _ = readParen False $ readsTime defaultTimeLocale "%Z" instance Read ZonedTime where readsPrec n = readParen False $ \s -> From git at git.haskell.org Mon Feb 20 21:12:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:12:09 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Cleaned up date parsing QuickCheck properties. (3750abf) Message-ID: <20170220211209.79CB93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/3750abfb4e0384d8cdcc84720cdc88bcd576ba08 >--------------------------------------------------------------- commit 3750abfb4e0384d8cdcc84720cdc88bcd576ba08 Author: bjorn Date: Sun Feb 11 10:15:02 2007 -0800 Cleaned up date parsing QuickCheck properties. darcs-hash:20070211181502-6cdb2-225795f312c8381c33bd79811535c0d34e2e461b >--------------------------------------------------------------- 3750abfb4e0384d8cdcc84720cdc88bcd576ba08 test/TestParseTime.hs | 75 +++++++++++++-------------------------------------- 1 file changed, 19 insertions(+), 56 deletions(-) diff --git a/test/TestParseTime.hs b/test/TestParseTime.hs index 876c227..50049bc 100644 --- a/test/TestParseTime.hs +++ b/test/TestParseTime.hs @@ -211,16 +211,15 @@ properties = ++ map (prop_format_parse_format_named "Day") partialDayFormats ++ map (prop_format_parse_format_named "TimeOfDay") partialTimeOfDayFormats ++ map (prop_format_parse_format_named "LocalTime") partialLocalTimeFormats - ++ map (prop_format_parse_format_named "TimeZone") partialTimeZoneFormats ++ map (prop_format_parse_format_named "ZonedTime") partialZonedTimeFormats ++ map (prop_format_parse_format_named "UTCTime") partialUTCTimeFormats - ++ map (prop_no_crash_bad_input_named "Day") (dayFormats ++ partialDayFormats ++ failingDayFormats) - ++ map (prop_no_crash_bad_input_named "TimeOfDay") (timeOfDayFormats ++ partialTimeOfDayFormats ++ failingTimeOfDayFormats) - ++ map (prop_no_crash_bad_input_named "LocalTime") (localTimeFormats ++ partialLocalTimeFormats ++ failingLocalTimeFormats) - ++ map (prop_no_crash_bad_input_named "TimeZone") (timeZoneFormats ++ partialTimeZoneFormats ++ failingTimeZoneFormats) - ++ map (prop_no_crash_bad_input_named "ZonedTime") (zonedTimeFormats ++ partialZonedTimeFormats ++ failingZonedTimeFormats) - ++ map (prop_no_crash_bad_input_named "UTCTime") (utcTimeFormats ++ partialUTCTimeFormats ++ failingUTCTimeFormats) + ++ map (prop_no_crash_bad_input_named "Day") (dayFormats ++ partialDayFormats ++ failingPartialDayFormats) + ++ map (prop_no_crash_bad_input_named "TimeOfDay") (timeOfDayFormats ++ partialTimeOfDayFormats) + ++ map (prop_no_crash_bad_input_named "LocalTime") (localTimeFormats ++ partialLocalTimeFormats) + ++ map (prop_no_crash_bad_input_named "TimeZone") (timeZoneFormats) + ++ map (prop_no_crash_bad_input_named "ZonedTime") (zonedTimeFormats ++ partialZonedTimeFormats) + ++ map (prop_no_crash_bad_input_named "UTCTime") (utcTimeFormats ++ partialUTCTimeFormats) @@ -263,11 +262,12 @@ localTimeFormats = map FormatString $ -} timeZoneFormats :: [FormatString TimeZone] -timeZoneFormats = map FormatString ["%z","%z%Z","%Z%z"] +timeZoneFormats = map FormatString ["%z","%z%Z","%Z%z","%Z"] zonedTimeFormats :: [FormatString ZonedTime] zonedTimeFormats = map FormatString - ["%a, %d %b %Y %H:%M:%S.%q %z", "%a, %d %b %Y %H:%M:%S%Q %z", "%s.%q %z", "%s%Q %z"] + ["%a, %d %b %Y %H:%M:%S.%q %z", "%a, %d %b %Y %H:%M:%S%Q %z", "%s.%q %z", "%s%Q %z", + "%a, %d %b %Y %H:%M:%S.%q %Z", "%a, %d %b %Y %H:%M:%S%Q %Z", "%s.%q %Z", "%s%Q %Z"] utcTimeFormats :: [FormatString UTCTime] utcTimeFormats = map FormatString @@ -279,7 +279,7 @@ utcTimeFormats = map FormatString partialDayFormats :: [FormatString Day] partialDayFormats = map FormatString - [ ] + [ ] partialTimeOfDayFormats :: [FormatString TimeOfDay] partialTimeOfDayFormats = map FormatString @@ -292,16 +292,13 @@ partialLocalTimeFormats = map FormatString "%c" ] -partialTimeZoneFormats :: [FormatString TimeZone] -partialTimeZoneFormats = map FormatString - [ - ] - partialZonedTimeFormats :: [FormatString ZonedTime] partialZonedTimeFormats = map FormatString [ -- %s does not include second decimals - "%s %z" + "%s %z", + -- %S does not include second decimals + "%c", "%a, %d %b %Y %H:%M:%S %Z" ] partialUTCTimeFormats :: [FormatString UTCTime] @@ -320,47 +317,13 @@ partialUTCTimeFormats = map FormatString knownFailures :: [NamedProperty] knownFailures = - map (prop_parse_format_named "Day") failingDayFormats - ++ map (prop_parse_format_named "LocalTime") failingLocalTimeFormats - ++ map (prop_parse_format_named "TimeZone") failingTimeZoneFormats - ++ map (prop_parse_format_named "ZonedTime") failingZonedTimeFormats - ++ map (prop_parse_format_named "UTCTime") failingUTCTimeFormats - + map (prop_format_parse_format_named "Day") failingPartialDayFormats - - -failingDayFormats :: [FormatString Day] -failingDayFormats = map FormatString - [ -- ISO week dates with two digit year +failingPartialDayFormats :: [FormatString Day] +failingPartialDayFormats = map FormatString + [ -- ISO week dates with two digit year. + -- This can fail in the beginning or the end of a year where + -- the ISO week date year does not match the gregorian year. "%g-%V-%u","%g-%V-%a","%g-%V-%A","%g-%V-%w", "%A week %V, %g", "day %V, week %A, %g", "%g-W%V-%u" ] - -failingTimeOfDayFormats :: [FormatString TimeOfDay] -failingTimeOfDayFormats = map FormatString - [ ] - -failingLocalTimeFormats :: [FormatString LocalTime] -failingLocalTimeFormats = map FormatString - [ - ] - -failingTimeZoneFormats :: [FormatString TimeZone] -failingTimeZoneFormats = map FormatString - [ - -- %Z does not figure out the offset - "%Z" - ] - -failingZonedTimeFormats :: [FormatString ZonedTime] -failingZonedTimeFormats = map FormatString - [ - -- can't figure out offset from %Z, also, formatTime produces "" for %Z - "%c", - "%a, %d %b %Y %H:%M:%S %Z" - ] - -failingUTCTimeFormats :: [FormatString UTCTime] -failingUTCTimeFormats = map FormatString - [] - From git at git.haskell.org Mon Feb 20 21:12:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:12:11 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: move parsing and formatting into new module (48535e6) Message-ID: <20170220211211.82D273A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/48535e6a2a85ec5545a1ff30d9f27087108bbc57 >--------------------------------------------------------------- commit 48535e6a2a85ec5545a1ff30d9f27087108bbc57 Author: Ashley Yakeley Date: Tue Feb 13 19:59:07 2007 -0800 move parsing and formatting into new module darcs-hash:20070214035907-ac6dd-25a86dd8e9d5313cc998c300f9c524d4652749bf >--------------------------------------------------------------- 48535e6a2a85ec5545a1ff30d9f27087108bbc57 Data/Time.hs | 4 +++- Data/Time/{LocalTime => }/Format.hs | 11 +++++------ Data/Time/{LocalTime => Format}/Parse.hs | 11 ++++------- Data/Time/LocalTime.hs | 6 +----- test/TestEaster.hs | 2 +- time.cabal | 4 ++-- time.xcodeproj/project.pbxproj | 12 ++++++++++-- 7 files changed, 26 insertions(+), 24 deletions(-) diff --git a/Data/Time.hs b/Data/Time.hs index 65926cd..4167ec6 100644 --- a/Data/Time.hs +++ b/Data/Time.hs @@ -4,9 +4,11 @@ module Data.Time ( module Data.Time.Calendar, module Data.Time.Clock, - module Data.Time.LocalTime + module Data.Time.LocalTime, + module Data.Time.Format ) where import Data.Time.Calendar import Data.Time.Clock import Data.Time.LocalTime +import Data.Time.Format diff --git a/Data/Time/LocalTime/Format.hs b/Data/Time/Format.hs similarity index 97% rename from Data/Time/LocalTime/Format.hs rename to Data/Time/Format.hs index 61a4e90..64f73ef 100644 --- a/Data/Time/LocalTime/Format.hs +++ b/Data/Time/Format.hs @@ -1,15 +1,14 @@ {-# OPTIONS -Wall -Werror #-} --- #hide -module Data.Time.LocalTime.Format +module Data.Time.Format ( -- * UNIX-style formatting - module Data.Time.LocalTime.Format + module Data.Time.Format, + module Data.Time.Format.Parse ) where -import Data.Time.LocalTime.LocalTime -import Data.Time.LocalTime.TimeOfDay -import Data.Time.LocalTime.TimeZone +import Data.Time.Format.Parse +import Data.Time.LocalTime import Data.Time.Calendar.WeekDate import Data.Time.Calendar.OrdinalDate import Data.Time.Calendar diff --git a/Data/Time/LocalTime/Parse.hs b/Data/Time/Format/Parse.hs similarity index 98% rename from Data/Time/LocalTime/Parse.hs rename to Data/Time/Format/Parse.hs index 605eee9..bee16e8 100644 --- a/Data/Time/LocalTime/Parse.hs +++ b/Data/Time/Format/Parse.hs @@ -1,7 +1,7 @@ {-# OPTIONS -Wall -Werror #-} -- #hide -module Data.Time.LocalTime.Parse +module Data.Time.Format.Parse ( -- * UNIX-style parsing parseTime, readTime, readsTime, @@ -9,14 +9,11 @@ module Data.Time.LocalTime.Parse ) where import Data.Time.Clock.POSIX -import Data.Time.Clock.UTC -import Data.Time.Calendar.Days -import Data.Time.Calendar.Gregorian +import Data.Time.Clock +import Data.Time.Calendar import Data.Time.Calendar.OrdinalDate import Data.Time.Calendar.WeekDate -import Data.Time.LocalTime.LocalTime -import Data.Time.LocalTime.TimeOfDay -import Data.Time.LocalTime.TimeZone +import Data.Time.LocalTime import Control.Monad import Data.Char diff --git a/Data/Time/LocalTime.hs b/Data/Time/LocalTime.hs index a5e2943..5676b58 100644 --- a/Data/Time/LocalTime.hs +++ b/Data/Time/LocalTime.hs @@ -4,13 +4,9 @@ module Data.Time.LocalTime ( module Data.Time.LocalTime.TimeZone, module Data.Time.LocalTime.TimeOfDay, - module Data.Time.LocalTime.LocalTime, - module Data.Time.LocalTime.Format, - module Data.Time.LocalTime.Parse + module Data.Time.LocalTime.LocalTime ) where import Data.Time.LocalTime.TimeZone import Data.Time.LocalTime.TimeOfDay import Data.Time.LocalTime.LocalTime -import Data.Time.LocalTime.Format -import Data.Time.LocalTime.Parse diff --git a/test/TestEaster.hs b/test/TestEaster.hs index 86a3318..290c066 100644 --- a/test/TestEaster.hs +++ b/test/TestEaster.hs @@ -4,7 +4,7 @@ module Main where import Data.Time.Calendar.Easter import Data.Time.Calendar -import Data.Time.LocalTime +import Data.Time.Format import System.Locale diff --git a/time.cabal b/time.cabal index a4fae43..c45da8c 100644 --- a/time.cabal +++ b/time.cabal @@ -20,6 +20,7 @@ Exposed-Modules: Data.Time.Clock.POSIX, Data.Time.Clock.TAI, Data.Time.LocalTime, + Data.Time.Format, Data.Time Extensions: ForeignFunctionInterface, CPP C-Sources: cbits/HsTime.c @@ -35,8 +36,7 @@ Other-Modules: Data.Time.LocalTime.TimeZone, Data.Time.LocalTime.TimeOfDay, Data.Time.LocalTime.LocalTime, - Data.Time.LocalTime.Format, - Data.Time.LocalTime.Parse + Data.Time.Format.Parse Extra-Source-Files: aclocal.m4 configure.ac configure include/HsTime.h include/HsTimeConfig.h.in diff --git a/time.xcodeproj/project.pbxproj b/time.xcodeproj/project.pbxproj index ee8c7d6..e7fab3a 100644 --- a/time.xcodeproj/project.pbxproj +++ b/time.xcodeproj/project.pbxproj @@ -130,6 +130,8 @@ ABD6783C0841677900CF37C0 /* Clock */, AB01DCFD08374838003C9EF7 /* Clock.hs */, AB2666A808A56FE30059DEC0 /* LocalTime */, + ABD4B1320B82BCA100CEB254 /* Format */, + AB01DD13083748EC003C9EF7 /* Format.hs */, AB2666E808A571460059DEC0 /* LocalTime.hs */, ); path = Time; @@ -157,8 +159,6 @@ AB01DD18083748EC003C9EF7 /* TimeZone.hs */, AB01DD17083748EC003C9EF7 /* TimeOfDay.hs */, AB01DD12083748EC003C9EF7 /* LocalTime.hs */, - AB01DD13083748EC003C9EF7 /* Format.hs */, - ABD6AC650B2D52D400843342 /* Parse.hs */, ); path = LocalTime; sourceTree = ""; @@ -197,6 +197,14 @@ name = "GHC stuff"; sourceTree = ""; }; + ABD4B1320B82BCA100CEB254 /* Format */ = { + isa = PBXGroup; + children = ( + ABD6AC650B2D52D400843342 /* Parse.hs */, + ); + path = Format; + sourceTree = ""; + }; ABD6783C0841677900CF37C0 /* Clock */ = { isa = PBXGroup; children = ( From git at git.haskell.org Mon Feb 20 21:12:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:12:13 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: README about building from darcs (09c85ef) Message-ID: <20170220211213.8A2933A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/09c85ef703705f311b49ea7e7291a80c3a452d49 >--------------------------------------------------------------- commit 09c85ef703705f311b49ea7e7291a80c3a452d49 Author: Ross Paterson Date: Sun Feb 18 03:01:59 2007 -0800 README about building from darcs darcs-hash:20070218110159-b47d3-02982554bbac9710b4ad35c5d4de873c6c0f693f >--------------------------------------------------------------- 09c85ef703705f311b49ea7e7291a80c3a452d49 README | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README b/README new file mode 100644 index 0000000..f5aa1cf --- /dev/null +++ b/README @@ -0,0 +1,4 @@ +To build this package using Cabal directly from darcs, you must run +"autoreconf" before the usual Cabal build steps (configure/build/install). +autoreconf is included in the GNU autoconf tools. There is no need to run +the "configure" script: the "setup configure" step will do this for you. From git at git.haskell.org Mon Feb 20 21:12:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:12:15 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: version 1.1 (28d5ef3) Message-ID: <20170220211215.90B893A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/28d5ef3d018b1650652d25d6be07e5b3749dc6b3 >--------------------------------------------------------------- commit 28d5ef3d018b1650652d25d6be07e5b3749dc6b3 Author: Ashley Yakeley Date: Mon Feb 19 17:52:51 2007 -0800 version 1.1 darcs-hash:20070220015251-ac6dd-223729392751ba0ef63dda315df9cd5263dbadc4 >--------------------------------------------------------------- 28d5ef3d018b1650652d25d6be07e5b3749dc6b3 Makefile | 2 +- configure.ac | 2 +- time.cabal | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 76ea560..9fca5cd 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ ALL_DIRS = \ Data/Time/LocalTime PACKAGE = time -VERSION = 1.0 +VERSION = 1.1 PACKAGE_DEPS = base SRC_HC_OPTS += -Wall -Werror -fffi -Iinclude diff --git a/configure.ac b/configure.ac index f2e4186..5778502 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([Haskell time package], [0.3.1], [ashley at semantic.org], [time]) +AC_INIT([Haskell time package], [1.1], [ashley at semantic.org], [time]) # Safety check: Ensure that we are in the correct source directory. AC_CONFIG_SRCDIR([include/HsTime.h]) diff --git a/time.cabal b/time.cabal index c45da8c..d877a1b 100644 --- a/time.cabal +++ b/time.cabal @@ -1,5 +1,5 @@ Name: time -Version: 1.0 +Version: 1.1 Stability: stable License: BSD3 License-File: LICENSE From git at git.haskell.org Mon Feb 20 21:12:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:12:17 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: clean up HsTime (696f384) Message-ID: <20170220211217.97AD63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/696f384f00c6a33e0114fe30cd3a80e2e93dc3dc >--------------------------------------------------------------- commit 696f384f00c6a33e0114fe30cd3a80e2e93dc3dc Author: Ashley Yakeley Date: Mon Feb 19 18:01:29 2007 -0800 clean up HsTime darcs-hash:20070220020129-ac6dd-8b7a4cfbded155623c93ee1b26bafe5f801fd1c6 >--------------------------------------------------------------- 696f384f00c6a33e0114fe30cd3a80e2e93dc3dc cbits/HsTime.c | 44 ++++++++++++++++---------------------------- include/HsTime.h | 2 +- 2 files changed, 17 insertions(+), 29 deletions(-) diff --git a/cbits/HsTime.c b/cbits/HsTime.c index f9651e9..58b7d06 100644 --- a/cbits/HsTime.c +++ b/cbits/HsTime.c @@ -3,50 +3,38 @@ long int get_current_timezone_seconds (time_t t,int* pdst,char const* * pname) { - struct tm* ptm; - long gmtoff; - int dst; - const char *name; - #if HAVE_LOCALTIME_R struct tm tmd; - ptm = localtime_r(&t,&tmd); + struct tm* ptm = localtime_r(&t,&tmd); #else - ptm = localtime(&t); + struct tm* ptm = localtime(&t); #endif - // We don't have a better API to use on Windows, the logic to - // decide whether a given data/time falls within DST is - // implemented as part of localtime() in the CRT. This is_dst - // flag is all we need here. - if (ptm) { - dst = ptm -> tm_isdst; + int dst = ptm -> tm_isdst; + *pdst = dst; #if HAVE_TM_ZONE - name = ptm -> tm_zone; - gmtoff = ptm -> tm_gmtoff; + *pname = ptm -> tm_zone; + return ptm -> tm_gmtoff; #elif defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32) - name = dst ? _tzname[1] : _tzname[0]; - gmtoff = dst ? _timezone - 3600 : _timezone; + // We don't have a better API to use on Windows, the logic to + // decide whether a given date/time falls within DST is + // implemented as part of localtime() in the CRT. This is_dst + // flag is all we need here. + *pname = dst ? _tzname[1] : _tzname[0]; + return dst ? _timezone - 3600 : _timezone; #else - # if HAVE_TZNAME - name = *tzname; + *pname = *tzname; # else -# error "Don't know how to get at timezone name on your OS" +# error "Don't know how to get timezone name on your OS" # endif - # if HAVE_DECL_ALTZONE - gmtoff = dst ? altzone : timezone; + return dst ? altzone : timezone; # else - gmtoff = dst ? timezone - 3600 : timezone; + return dst ? timezone - 3600 : timezone; # endif - #endif // HAVE_TM_ZONE - *pdst = dst; - *pname = name; - return gmtoff; - } else return 0x80000000; } diff --git a/include/HsTime.h b/include/HsTime.h index b8da946..059cbc0 100644 --- a/include/HsTime.h +++ b/include/HsTime.h @@ -7,6 +7,6 @@ #include #endif -long int get_current_timezone_seconds (time_t,int* dst,char const* * name); +long int get_current_timezone_seconds (time_t,int* pdst,char const* * pname); #endif From git at git.haskell.org Mon Feb 20 21:12:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:12:19 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: build/license/boring cleanup (cc9a460) Message-ID: <20170220211219.9EE6F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/cc9a460009cf283c0e533ac051967a363842b1db >--------------------------------------------------------------- commit cc9a460009cf283c0e533ac051967a363842b1db Author: Ashley Yakeley Date: Thu Feb 22 16:33:26 2007 -0800 build/license/boring cleanup darcs-hash:20070223003326-ac6dd-68918006d98d55eea314ccedb36a5b24de0d509b >--------------------------------------------------------------- cc9a460009cf283c0e533ac051967a363842b1db .darcs-boring | 23 +++++++++++++++++++++++ LICENSE | 2 +- package.conf.in | 14 ++++++++------ 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/.darcs-boring b/.darcs-boring index 6c379a9..0b4f6cb 100644 --- a/.darcs-boring +++ b/.darcs-boring @@ -11,6 +11,7 @@ _split$ (^|/)package.conf.installed$ (^|/)\.depend$ (^|/)\.setup-config$ +(^|/)\.installed-pkg-config$ \.haddock$ ^build$ \.xcodeproj/.*\.pbxuser$ @@ -43,4 +44,26 @@ _split$ \.py[co]$ \# \.cvsignore$ +^Private($|/) (^|/)Thumbs\.db$ +^configure$ +^config\..*$ +^autom4te.cache($|/) +^include/HsTimeConfig\.h$ +^include/HsTimeConfig\.h.in$ +^test/.*\.out$ +^test/AddDays$ +^test/ClipDates$ +^test/ConvertBack$ +^test/CurrentTime$ +^test/LongWeekYears$ +^test/ShowDST$ +^test/TestCalendars$ +^test/TestEaster$ +^test/TestFormat$ +^test/TestMonthDay$ +^test/TestParseDAT$ +^test/TestParseTime$ +^test/TestTime$ +^test/TimeZone$ +^test/TimeZone.ref$ diff --git a/LICENSE b/LICENSE index 17f1f27..af649fe 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -TimeLib is Copyright (c) Ashley Yakeley, 2004-2005. +TimeLib is Copyright (c) Ashley Yakeley, 2004-2007. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/package.conf.in b/package.conf.in index 98922d7..fc3bf80 100644 --- a/package.conf.in +++ b/package.conf.in @@ -2,7 +2,7 @@ Name: PACKAGE Version: VERSION -Stability: Beta +Stability: stable License: BSD3 License-File: LICENSE Author: Ashley Yakeley @@ -29,10 +29,11 @@ Exposed-modules: Data.Time.Clock.POSIX, Data.Time.Clock.TAI, Data.Time.LocalTime, + Data.Time.Format, Data.Time -Extensions: ForeignFunctionInterface -C-Sources: HsTime.c -Hidden-modules: +Extensions: ForeignFunctionInterface, CPP +C-Sources: cbits/HsTime.c +Other-Modules: Data.Time.Calendar.Private, Data.Time.Calendar.Days, Data.Time.Calendar.Gregorian, @@ -44,11 +45,12 @@ Hidden-modules: Data.Time.LocalTime.TimeZone, Data.Time.LocalTime.TimeOfDay, Data.Time.LocalTime.LocalTime, - Data.Time.LocalTime.Format + Data.Time.Format.Parse import-dirs: IMPORT_DIR library-dirs: LIB_DIR hs-libraries: "HStime" include-dirs: INCLUDE_DIR -includes: "HsTime.h" +Install-Includes: + HsTime.h HsTimeConfig.h haddock-interfaces: HADDOCK_IFACE haddock-html: HTML_DIR From git at git.haskell.org Mon Feb 20 21:12:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:12:23 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Added missing directory (a293612) Message-ID: <20170220211223.AC9F13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/a29361230de31e0d0fc6acb6b3e4c185f683463c >--------------------------------------------------------------- commit a29361230de31e0d0fc6acb6b3e4c185f683463c Author: sven.panne Date: Thu Mar 22 10:26:49 2007 -0700 Added missing directory darcs-hash:20070322172649-96103-35df5e909f8a7d8bb1158a45cc50110b24aa7c4f >--------------------------------------------------------------- a29361230de31e0d0fc6acb6b3e4c185f683463c Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 9fca5cd..8c4e8f5 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,7 @@ ALL_DIRS = \ Data/Time \ Data/Time/Calendar \ Data/Time/Clock \ + Data/Time/Format \ Data/Time/LocalTime PACKAGE = time From git at git.haskell.org Mon Feb 20 21:12:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:12:21 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Fixed hyperlinks to formatTime (7053937) Message-ID: <20170220211221.A61683A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/7053937ced02dbed6684556445211d094bb61c4b >--------------------------------------------------------------- commit 7053937ced02dbed6684556445211d094bb61c4b Author: sven.panne Date: Thu Mar 22 10:02:58 2007 -0700 Fixed hyperlinks to formatTime darcs-hash:20070322170258-96103-bd25d42aa6fa7432c891d28a9032b103f3cc53f3 >--------------------------------------------------------------- 7053937ced02dbed6684556445211d094bb61c4b Data/Time/Calendar/OrdinalDate.hs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Data/Time/Calendar/OrdinalDate.hs b/Data/Time/Calendar/OrdinalDate.hs index dfd4069..9dbdd96 100644 --- a/Data/Time/Calendar/OrdinalDate.hs +++ b/Data/Time/Calendar/OrdinalDate.hs @@ -38,8 +38,8 @@ isLeapYear :: Integer -> Bool isLeapYear year = (mod year 4 == 0) && ((mod year 400 == 0) || not (mod year 100 == 0)) -- | Get the number of the Monday-starting week in the year and the day of the week. --- The first Monday is the first day of week 1, any earlier days in the year are week 0 (as \"%W\" in formatTime). --- Monday is 1, Sunday is 7 (as \"%u\" in formatTime). +-- The first Monday is the first day of week 1, any earlier days in the year are week 0 (as \"%W\" in 'Data.Time.Format.formatTime'). +-- Monday is 1, Sunday is 7 (as \"%u\" in 'Data.Time.Format.formatTime'). mondayStartWeek :: Day -> (Int,Int) mondayStartWeek date = (fromInteger ((div d 7) - (div k 7)),fromInteger (mod d 7) + 1) where yd = snd (toOrdinalDate date) @@ -47,8 +47,8 @@ mondayStartWeek date = (fromInteger ((div d 7) - (div k 7)),fromInteger (mod d 7 k = d - (toInteger yd) -- | Get the number of the Sunday-starting week in the year and the day of the week. --- The first Sunday is the first day of week 1, any earlier days in the year are week 0 (as \"%U\" in formatTime). --- Sunday is 0, Saturday is 6 (as \"%w\" in formatTime). +-- The first Sunday is the first day of week 1, any earlier days in the year are week 0 (as \"%U\" in 'Data.Time.Format.formatTime'). +-- Sunday is 0, Saturday is 6 (as \"%w\" in 'Data.Time.Format.formatTime'). sundayStartWeek :: Day -> (Int,Int) sundayStartWeek date =(fromInteger ((div d 7) - (div k 7)),fromInteger (mod d 7)) where yd = snd (toOrdinalDate date) @@ -58,11 +58,11 @@ sundayStartWeek date =(fromInteger ((div d 7) - (div k 7)),fromInteger (mod d 7) -- | The inverse of 'mondayStartWeek'. Get a 'Day' given the year, -- the number of the Monday-starting week, and the day of the week. -- The first Monday is the first day of week 1, any earlier days in the year --- are week 0 (as \"%W\" in 'formatTime'). +-- are week 0 (as \"%W\" in 'Data.Time.Format.formatTime'). fromMondayStartWeek :: Integer -- ^ Year. -> Int -- ^ Monday-starting week number. -> Int -- ^ Day of week. - -- Monday is 1, Sunday is 7 (as \"%u\" in 'formatTime'). + -- Monday is 1, Sunday is 7 (as \"%u\" in 'Data.Time.Format.formatTime'). -> Day fromMondayStartWeek y w d = ModifiedJulianDay (firstDay + yd) where yd = firstMonday + 7 * toInteger (w-1) + toInteger d - 1 @@ -74,11 +74,11 @@ fromMondayStartWeek y w d = ModifiedJulianDay (firstDay + yd) -- | The inverse of 'sundayStartWeek'. Get a 'Day' given the year and -- the number of the day of a Sunday-starting week. -- The first Sunday is the first day of week 1, any earlier days in the --- year are week 0 (as \"%U\" in 'formatTime'). +-- year are week 0 (as \"%U\" in 'Data.Time.Format.formatTime'). fromSundayStartWeek :: Integer -- ^ Year. -> Int -- ^ Sunday-starting week number. -> Int -- ^ Day of week - -- Sunday is 0, Saturday is 6 (as \"%w\" in 'formatTime'). + -- Sunday is 0, Saturday is 6 (as \"%w\" in 'Data.Time.Format.formatTime'). -> Day fromSundayStartWeek y w d = ModifiedJulianDay (firstDay + yd) where yd = firstSunday + 7 * toInteger (w-1) + toInteger d From git at git.haskell.org Mon Feb 20 21:12:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:12:25 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Make Setup.hs suitable for building in a GHC tree (2f507d7) Message-ID: <20170220211225.B3AC73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/2f507d73fbd98f417b70fd4ce01c1108c211847e >--------------------------------------------------------------- commit 2f507d73fbd98f417b70fd4ce01c1108c211847e Author: Ian Lynagh Date: Sat Apr 7 10:41:49 2007 -0700 Make Setup.hs suitable for building in a GHC tree darcs-hash:20070407174149-3fd76-51c9fae37e93e4f367400b38078fc490266864f0 >--------------------------------------------------------------- 2f507d73fbd98f417b70fd4ce01c1108c211847e Setup.hs | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 60 insertions(+), 8 deletions(-) diff --git a/Setup.hs b/Setup.hs index 2859262..9ef61d3 100644 --- a/Setup.hs +++ b/Setup.hs @@ -1,21 +1,73 @@ module Main (main) where +import Control.Exception +import Data.List import Distribution.Simple import Distribution.PackageDescription +import Distribution.PreProcess +import Distribution.Setup import Distribution.Simple.LocalBuildInfo -import System.Exit import System.Cmd import System.Directory -import Control.Exception +import System.Environment +import System.Exit + +main :: IO () +main = do args <- getArgs + let (ghcArgs, args') = extractGhcArgs args + (_, args'') = extractConfigureArgs args' + hooks = defaultUserHooks { + buildHook = add_ghc_options ghcArgs + $ buildHook defaultUserHooks, + runTests = runTestScript } + withArgs args'' $ defaultMainWithHooks hooks withCurrentDirectory :: FilePath -> IO a -> IO a withCurrentDirectory path f = do - cur <- getCurrentDirectory - setCurrentDirectory path - finally f (setCurrentDirectory cur) + cur <- getCurrentDirectory + setCurrentDirectory path + finally f (setCurrentDirectory cur) -runTestScript :: Args -> Bool -> PackageDescription -> LocalBuildInfo -> IO ExitCode +runTestScript :: Args -> Bool -> PackageDescription -> LocalBuildInfo + -> IO ExitCode runTestScript args flag pd lbi = withCurrentDirectory "test" (system "make") -main :: IO () -main = defaultMainWithHooks defaultUserHooks{runTests = runTestScript} +extractGhcArgs :: [String] -> ([String], [String]) +extractGhcArgs = extractPrefixArgs "--ghc-option=" + +extractConfigureArgs :: [String] -> ([String], [String]) +extractConfigureArgs = extractPrefixArgs "--configure-option=" + +extractPrefixArgs :: String -> [String] -> ([String], [String]) +extractPrefixArgs prefix args + = let f [] = ([], []) + f (x:xs) = case f xs of + (wantedArgs, otherArgs) -> + case removePrefix prefix x of + Just wantedArg -> + (wantedArg:wantedArgs, otherArgs) + Nothing -> + (wantedArgs, x:otherArgs) + in f args + +removePrefix :: String -> String -> Maybe String +removePrefix "" ys = Just ys +removePrefix (x:xs) (y:ys) + | x == y = removePrefix xs ys + | otherwise = Nothing + +type Hook a = PackageDescription -> LocalBuildInfo -> Maybe UserHooks -> a + -> IO () + +add_ghc_options :: [String] -> Hook a -> Hook a +add_ghc_options args f pd lbi muhs x + = do let lib' = case library pd of + Just lib -> + let bi = libBuildInfo lib + opts = options bi ++ [(GHC, args)] + bi' = bi { options = opts } + in lib { libBuildInfo = bi' } + Nothing -> error "Expected a library" + pd' = pd { library = Just lib' } + f pd' lbi muhs x + From git at git.haskell.org Mon Feb 20 21:12:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:12:27 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Fix -Wall warnings (ae16651) Message-ID: <20170220211227.B9F073A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/ae16651f2429c01af64184318d06bed2023cd380 >--------------------------------------------------------------- commit ae16651f2429c01af64184318d06bed2023cd380 Author: Ian Lynagh Date: Tue Apr 10 18:22:40 2007 -0700 Fix -Wall warnings darcs-hash:20070411012240-3fd76-b092e0f174e882a180df231c955a3456d2ddeb65 >--------------------------------------------------------------- ae16651f2429c01af64184318d06bed2023cd380 Setup.hs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Setup.hs b/Setup.hs index 9ef61d3..3c31867 100644 --- a/Setup.hs +++ b/Setup.hs @@ -4,7 +4,6 @@ import Control.Exception import Data.List import Distribution.Simple import Distribution.PackageDescription -import Distribution.PreProcess import Distribution.Setup import Distribution.Simple.LocalBuildInfo import System.Cmd @@ -30,7 +29,8 @@ withCurrentDirectory path f = do runTestScript :: Args -> Bool -> PackageDescription -> LocalBuildInfo -> IO ExitCode -runTestScript args flag pd lbi = withCurrentDirectory "test" (system "make") +runTestScript _args _flag _pd _lbi + = withCurrentDirectory "test" (system "make") extractGhcArgs :: [String] -> ([String], [String]) extractGhcArgs = extractPrefixArgs "--ghc-option=" @@ -39,11 +39,11 @@ extractConfigureArgs :: [String] -> ([String], [String]) extractConfigureArgs = extractPrefixArgs "--configure-option=" extractPrefixArgs :: String -> [String] -> ([String], [String]) -extractPrefixArgs prefix args +extractPrefixArgs the_prefix args = let f [] = ([], []) f (x:xs) = case f xs of (wantedArgs, otherArgs) -> - case removePrefix prefix x of + case removePrefix the_prefix x of Just wantedArg -> (wantedArg:wantedArgs, otherArgs) Nothing -> @@ -52,6 +52,7 @@ extractPrefixArgs prefix args removePrefix :: String -> String -> Maybe String removePrefix "" ys = Just ys +removePrefix _ "" = Nothing removePrefix (x:xs) (y:ys) | x == y = removePrefix xs ys | otherwise = Nothing From git at git.haskell.org Mon Feb 20 21:12:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:12:29 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Hack due to time needing Win32 on Windows (dbd2265) Message-ID: <20170220211229.C0B6D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/dbd22650b674227dff9c45c53e921367441fdc99 >--------------------------------------------------------------- commit dbd22650b674227dff9c45c53e921367441fdc99 Author: Ian Lynagh Date: Sun Apr 15 14:52:27 2007 -0700 Hack due to time needing Win32 on Windows darcs-hash:20070415215227-3fd76-ee66b60c836f81fa879ba9e80220fac57f47e261 >--------------------------------------------------------------- dbd22650b674227dff9c45c53e921367441fdc99 Setup.hs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Setup.hs b/Setup.hs index 3c31867..f078742 100644 --- a/Setup.hs +++ b/Setup.hs @@ -10,12 +10,15 @@ import System.Cmd import System.Directory import System.Environment import System.Exit +import System.Info main :: IO () main = do args <- getArgs let (ghcArgs, args') = extractGhcArgs args (_, args'') = extractConfigureArgs args' hooks = defaultUserHooks { + confHook = add_Win32_dep + $ confHook defaultUserHooks, buildHook = add_ghc_options ghcArgs $ buildHook defaultUserHooks, runTests = runTestScript } @@ -72,3 +75,14 @@ add_ghc_options args f pd lbi muhs x pd' = pd { library = Just lib' } f pd' lbi muhs x +type ConfHook = PackageDescription -> ConfigFlags -> IO LocalBuildInfo + +-- XXX Hideous hack +add_Win32_dep :: ConfHook -> ConfHook +add_Win32_dep f pd cf + = do let pd' = if os == "mingw32" + then pd { buildDepends = Dependency "Win32" AnyVersion + : buildDepends pd } + else pd + f pd' cf + From git at git.haskell.org Mon Feb 20 21:12:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:12:31 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Follow Cabal changes in Setup.*hs (fae8a55) Message-ID: <20170220211231.C73D13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/fae8a5587481b1ae3da17c49d04cc0ab89ed8ca6 >--------------------------------------------------------------- commit fae8a5587481b1ae3da17c49d04cc0ab89ed8ca6 Author: Ian Lynagh Date: Wed Apr 18 05:14:32 2007 -0700 Follow Cabal changes in Setup.*hs darcs-hash:20070418121432-3fd76-50d82afe568d115252a1a061ee8e8cb581e2bebc >--------------------------------------------------------------- fae8a5587481b1ae3da17c49d04cc0ab89ed8ca6 Setup.hs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Setup.hs b/Setup.hs index f078742..caecfdd 100644 --- a/Setup.hs +++ b/Setup.hs @@ -9,7 +9,6 @@ import Distribution.Simple.LocalBuildInfo import System.Cmd import System.Directory import System.Environment -import System.Exit import System.Info main :: IO () @@ -31,7 +30,7 @@ withCurrentDirectory path f = do finally f (setCurrentDirectory cur) runTestScript :: Args -> Bool -> PackageDescription -> LocalBuildInfo - -> IO ExitCode + -> IO () runTestScript _args _flag _pd _lbi = withCurrentDirectory "test" (system "make") @@ -60,11 +59,10 @@ removePrefix (x:xs) (y:ys) | x == y = removePrefix xs ys | otherwise = Nothing -type Hook a = PackageDescription -> LocalBuildInfo -> Maybe UserHooks -> a - -> IO () +type Hook a = PackageDescription -> LocalBuildInfo -> UserHooks -> a -> IO () add_ghc_options :: [String] -> Hook a -> Hook a -add_ghc_options args f pd lbi muhs x +add_ghc_options args f pd lbi uhs x = do let lib' = case library pd of Just lib -> let bi = libBuildInfo lib @@ -73,7 +71,7 @@ add_ghc_options args f pd lbi muhs x in lib { libBuildInfo = bi' } Nothing -> error "Expected a library" pd' = pd { library = Just lib' } - f pd' lbi muhs x + f pd' lbi uhs x type ConfHook = PackageDescription -> ConfigFlags -> IO LocalBuildInfo From git at git.haskell.org Mon Feb 20 21:12:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:12:33 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: We now need to check the exitcode of the tests (ccb1264) Message-ID: <20170220211233.CDA9D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/ccb1264e93dfa379d26368677aa05ec3b7ec34c2 >--------------------------------------------------------------- commit ccb1264e93dfa379d26368677aa05ec3b7ec34c2 Author: Ian Lynagh Date: Sat Apr 21 09:23:30 2007 -0700 We now need to check the exitcode of the tests darcs-hash:20070421162330-3fd76-36ce113c06f673ae509deac9eb047e5f539a69c5 >--------------------------------------------------------------- ccb1264e93dfa379d26368677aa05ec3b7ec34c2 Setup.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Setup.hs b/Setup.hs index caecfdd..d2fff29 100644 --- a/Setup.hs +++ b/Setup.hs @@ -2,10 +2,11 @@ module Main (main) where import Control.Exception import Data.List -import Distribution.Simple import Distribution.PackageDescription import Distribution.Setup +import Distribution.Simple import Distribution.Simple.LocalBuildInfo +import Distribution.Simple.Utils import System.Cmd import System.Directory import System.Environment @@ -29,10 +30,9 @@ withCurrentDirectory path f = do setCurrentDirectory path finally f (setCurrentDirectory cur) -runTestScript :: Args -> Bool -> PackageDescription -> LocalBuildInfo - -> IO () +runTestScript :: Args -> Bool -> PackageDescription -> LocalBuildInfo -> IO () runTestScript _args _flag _pd _lbi - = withCurrentDirectory "test" (system "make") + = maybeExit $ withCurrentDirectory "test" $ system "make" extractGhcArgs :: [String] -> ([String], [String]) extractGhcArgs = extractPrefixArgs "--ghc-option=" From git at git.haskell.org Mon Feb 20 21:12:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:12:35 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Bump version to 1.1.1 (9eb62d6) Message-ID: <20170220211235.D77FD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/9eb62d6b83f0401cf7d11afdbaaed725f44a57f5 >--------------------------------------------------------------- commit 9eb62d6b83f0401cf7d11afdbaaed725f44a57f5 Author: Ian Lynagh Date: Sun Apr 22 12:52:28 2007 -0700 Bump version to 1.1.1 darcs-hash:20070422195228-3fd76-279361d39d538b6e458e46526389712ccc8b45fe >--------------------------------------------------------------- 9eb62d6b83f0401cf7d11afdbaaed725f44a57f5 Makefile | 2 +- configure.ac | 2 +- time.cabal | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 8c4e8f5..9f61dd2 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ ALL_DIRS = \ Data/Time/LocalTime PACKAGE = time -VERSION = 1.1 +VERSION = 1.1.1 PACKAGE_DEPS = base SRC_HC_OPTS += -Wall -Werror -fffi -Iinclude diff --git a/configure.ac b/configure.ac index 5778502..0da7fc4 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([Haskell time package], [1.1], [ashley at semantic.org], [time]) +AC_INIT([Haskell time package], [1.1.1], [ashley at semantic.org], [time]) # Safety check: Ensure that we are in the correct source directory. AC_CONFIG_SRCDIR([include/HsTime.h]) diff --git a/time.cabal b/time.cabal index d877a1b..3c44a66 100644 --- a/time.cabal +++ b/time.cabal @@ -1,5 +1,5 @@ Name: time -Version: 1.1 +Version: 1.1.1 Stability: stable License: BSD3 License-File: LICENSE From git at git.haskell.org Mon Feb 20 21:12:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:12:37 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Remove Makefile and package.conf.in (used in the old GHC build system) (ef82b6f) Message-ID: <20170220211237.DDB5D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/ef82b6ff52f984bb55c26ef10624adc218a18f98 >--------------------------------------------------------------- commit ef82b6ff52f984bb55c26ef10624adc218a18f98 Author: Ian Lynagh Date: Thu May 24 07:58:37 2007 -0700 Remove Makefile and package.conf.in (used in the old GHC build system) darcs-hash:20070524145837-3fd76-402cae7ffe2155bdb3ef4b1a3081935c74e66f32 >--------------------------------------------------------------- ef82b6ff52f984bb55c26ef10624adc218a18f98 Makefile | 29 ----------------------------- package.conf.in | 56 -------------------------------------------------------- 2 files changed, 85 deletions(-) diff --git a/Makefile b/Makefile deleted file mode 100644 index 9f61dd2..0000000 --- a/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -TOP=.. -include $(TOP)/mk/boilerplate.mk - -SUBDIRS = include - -ALL_DIRS = \ - cbits \ - Data \ - Data/Time \ - Data/Time/Calendar \ - Data/Time/Clock \ - Data/Time/Format \ - Data/Time/LocalTime - -PACKAGE = time -VERSION = 1.1.1 -PACKAGE_DEPS = base - -SRC_HC_OPTS += -Wall -Werror -fffi -Iinclude - -SRC_CC_OPTS += -Wall -Werror -Iinclude - -EXCLUDED_SRCS += Setup.hs - -SRC_HADDOCK_OPTS += -t "Haskell Hierarchical Libraries ($(PACKAGE) package)" - -UseGhcForCc = YES - -include $(TOP)/mk/target.mk diff --git a/package.conf.in b/package.conf.in deleted file mode 100644 index fc3bf80..0000000 --- a/package.conf.in +++ /dev/null @@ -1,56 +0,0 @@ -#include "ghcconfig.h" - -Name: PACKAGE -Version: VERSION -Stability: stable -License: BSD3 -License-File: LICENSE -Author: Ashley Yakeley -Maintainer: -Homepage: http://semantic.org/TimeLib/ -exposed: True -Category: - -#if mingw32_HOST_OS -depends: Win32, base -#else -depends: base -#endif - -Synopsis: time library -Exposed-modules: - Data.Time.Calendar, - Data.Time.Calendar.MonthDay, - Data.Time.Calendar.OrdinalDate, - Data.Time.Calendar.WeekDate, - Data.Time.Calendar.Julian, - Data.Time.Calendar.Easter, - Data.Time.Clock, - Data.Time.Clock.POSIX, - Data.Time.Clock.TAI, - Data.Time.LocalTime, - Data.Time.Format, - Data.Time -Extensions: ForeignFunctionInterface, CPP -C-Sources: cbits/HsTime.c -Other-Modules: - Data.Time.Calendar.Private, - Data.Time.Calendar.Days, - Data.Time.Calendar.Gregorian, - Data.Time.Calendar.JulianYearDay, - Data.Time.Clock.Scale, - Data.Time.Clock.UTC, - Data.Time.Clock.CTimeval, - Data.Time.Clock.UTCDiff, - Data.Time.LocalTime.TimeZone, - Data.Time.LocalTime.TimeOfDay, - Data.Time.LocalTime.LocalTime, - Data.Time.Format.Parse -import-dirs: IMPORT_DIR -library-dirs: LIB_DIR -hs-libraries: "HStime" -include-dirs: INCLUDE_DIR -Install-Includes: - HsTime.h HsTimeConfig.h -haddock-interfaces: HADDOCK_IFACE -haddock-html: HTML_DIR From git at git.haskell.org Mon Feb 20 21:12:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:12:39 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Follow base split (now dep on old-locale) (c0d8daf) Message-ID: <20170220211239.E44733A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/c0d8daf1b9f892bf94cf16e41f928c45c0437542 >--------------------------------------------------------------- commit c0d8daf1b9f892bf94cf16e41f928c45c0437542 Author: Ian Lynagh Date: Thu May 24 10:37:51 2007 -0700 Follow base split (now dep on old-locale) darcs-hash:20070524173751-3fd76-d9ce4ca8fba7e38a62deaea0920d0011cf82678e >--------------------------------------------------------------- c0d8daf1b9f892bf94cf16e41f928c45c0437542 time.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/time.cabal b/time.cabal index 3c44a66..cb9b6ca 100644 --- a/time.cabal +++ b/time.cabal @@ -7,7 +7,7 @@ Author: Ashley Yakeley Maintainer: Homepage: http://semantic.org/TimeLib/ Category: -Build-Depends: base +Build-Depends: base, old-locale Synopsis: time library Exposed-Modules: Data.Time.Calendar, From git at git.haskell.org Mon Feb 20 21:12:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:12:41 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: --configure-option and --ghc-option are now provided by Cabal (a9edca5) Message-ID: <20170220211241.EBDE63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/a9edca50d629162c592b7ef78d6cb55b23822b2c >--------------------------------------------------------------- commit a9edca50d629162c592b7ef78d6cb55b23822b2c Author: Ross Paterson Date: Mon Jun 4 04:55:55 2007 -0700 --configure-option and --ghc-option are now provided by Cabal darcs-hash:20070604115555-b47d3-494f023ee54f001497ff09fe4e165b655a776147 >--------------------------------------------------------------- a9edca50d629162c592b7ef78d6cb55b23822b2c Setup.hs | 51 ++------------------------------------------------- 1 file changed, 2 insertions(+), 49 deletions(-) diff --git a/Setup.hs b/Setup.hs index d2fff29..e8a005c 100644 --- a/Setup.hs +++ b/Setup.hs @@ -1,7 +1,6 @@ module Main (main) where import Control.Exception -import Data.List import Distribution.PackageDescription import Distribution.Setup import Distribution.Simple @@ -9,20 +8,14 @@ import Distribution.Simple.LocalBuildInfo import Distribution.Simple.Utils import System.Cmd import System.Directory -import System.Environment import System.Info main :: IO () -main = do args <- getArgs - let (ghcArgs, args') = extractGhcArgs args - (_, args'') = extractConfigureArgs args' - hooks = defaultUserHooks { +main = do let hooks = defaultUserHooks { confHook = add_Win32_dep $ confHook defaultUserHooks, - buildHook = add_ghc_options ghcArgs - $ buildHook defaultUserHooks, runTests = runTestScript } - withArgs args'' $ defaultMainWithHooks hooks + defaultMainWithHooks hooks withCurrentDirectory :: FilePath -> IO a -> IO a withCurrentDirectory path f = do @@ -34,45 +27,6 @@ runTestScript :: Args -> Bool -> PackageDescription -> LocalBuildInfo -> IO () runTestScript _args _flag _pd _lbi = maybeExit $ withCurrentDirectory "test" $ system "make" -extractGhcArgs :: [String] -> ([String], [String]) -extractGhcArgs = extractPrefixArgs "--ghc-option=" - -extractConfigureArgs :: [String] -> ([String], [String]) -extractConfigureArgs = extractPrefixArgs "--configure-option=" - -extractPrefixArgs :: String -> [String] -> ([String], [String]) -extractPrefixArgs the_prefix args - = let f [] = ([], []) - f (x:xs) = case f xs of - (wantedArgs, otherArgs) -> - case removePrefix the_prefix x of - Just wantedArg -> - (wantedArg:wantedArgs, otherArgs) - Nothing -> - (wantedArgs, x:otherArgs) - in f args - -removePrefix :: String -> String -> Maybe String -removePrefix "" ys = Just ys -removePrefix _ "" = Nothing -removePrefix (x:xs) (y:ys) - | x == y = removePrefix xs ys - | otherwise = Nothing - -type Hook a = PackageDescription -> LocalBuildInfo -> UserHooks -> a -> IO () - -add_ghc_options :: [String] -> Hook a -> Hook a -add_ghc_options args f pd lbi uhs x - = do let lib' = case library pd of - Just lib -> - let bi = libBuildInfo lib - opts = options bi ++ [(GHC, args)] - bi' = bi { options = opts } - in lib { libBuildInfo = bi' } - Nothing -> error "Expected a library" - pd' = pd { library = Just lib' } - f pd' lbi uhs x - type ConfHook = PackageDescription -> ConfigFlags -> IO LocalBuildInfo -- XXX Hideous hack @@ -83,4 +37,3 @@ add_Win32_dep f pd cf : buildDepends pd } else pd f pd' cf - From git at git.haskell.org Mon Feb 20 21:12:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:12:43 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: #undef PACKAGE_NAME and friends to avoid clashes (2f36990) Message-ID: <20170220211243.F2B563A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/2f369900a7bb45aa52dede558fa5364a1a7a7e13 >--------------------------------------------------------------- commit 2f369900a7bb45aa52dede558fa5364a1a7a7e13 Author: Simon Marlow Date: Wed Jun 6 07:20:42 2007 -0700 #undef PACKAGE_NAME and friends to avoid clashes darcs-hash:20070606142042-760e2-20bc4e080e1edf8b0e12fd8c5b68da9d21e89c79 >--------------------------------------------------------------- 2f369900a7bb45aa52dede558fa5364a1a7a7e13 include/HsTime.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/HsTime.h b/include/HsTime.h index 059cbc0..c02cc53 100644 --- a/include/HsTime.h +++ b/include/HsTime.h @@ -2,6 +2,12 @@ #define __HSTIME_H__ #include "HsTimeConfig.h" +// Otherwise these clash with similar definitions from other packages: +#undef PACKAGE_BUGREPORT +#undef PACKAGE_NAME +#undef PACKAGE_STRING +#undef PACKAGE_TARNAME +#undef PACKAGE_VERSION #if HAVE_TIME_H #include From git at git.haskell.org Mon Feb 20 21:12:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:12:46 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Provide a configure flag to set which C compiler is used (96f1b36) Message-ID: <20170220211246.055243A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/96f1b36a54af14d10654ff15235ab652fa187ef4 >--------------------------------------------------------------- commit 96f1b36a54af14d10654ff15235ab652fa187ef4 Author: Ian Lynagh Date: Sat Jul 7 04:24:51 2007 -0700 Provide a configure flag to set which C compiler is used darcs-hash:20070707112451-3fd76-20588169237238c46714c9edaa964ca373949bfa >--------------------------------------------------------------- 96f1b36a54af14d10654ff15235ab652fa187ef4 configure.ac | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/configure.ac b/configure.ac index 0da7fc4..1b45b5b 100644 --- a/configure.ac +++ b/configure.ac @@ -3,6 +3,11 @@ AC_INIT([Haskell time package], [1.1.1], [ashley at semantic.org], [time]) # Safety check: Ensure that we are in the correct source directory. AC_CONFIG_SRCDIR([include/HsTime.h]) +AC_ARG_WITH([cc], + [C compiler], + [CC=$withval]) +AC_PROG_CC() + AC_CONFIG_HEADERS([include/HsTimeConfig.h]) AC_CHECK_HEADERS([time.h]) From git at git.haskell.org Mon Feb 20 21:12:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:12:48 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: FIX #1486: timezone offset has the wrong sign on Windows (8e487ba) Message-ID: <20170220211248.0C43C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/8e487bae5f6507e15d8b142683b0ba1c4eefa223 >--------------------------------------------------------------- commit 8e487bae5f6507e15d8b142683b0ba1c4eefa223 Author: Simon Marlow Date: Tue Jul 10 01:12:36 2007 -0700 FIX #1486: timezone offset has the wrong sign on Windows Fix submitted by Olivier Boudry, thanks! darcs-hash:20070710081236-760e2-6581eff1e91b2207190b15ec6143f0eb26442178 >--------------------------------------------------------------- 8e487bae5f6507e15d8b142683b0ba1c4eefa223 cbits/HsTime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cbits/HsTime.c b/cbits/HsTime.c index 58b7d06..dacb1d4 100644 --- a/cbits/HsTime.c +++ b/cbits/HsTime.c @@ -22,7 +22,7 @@ long int get_current_timezone_seconds (time_t t,int* pdst,char const* * pname) // implemented as part of localtime() in the CRT. This is_dst // flag is all we need here. *pname = dst ? _tzname[1] : _tzname[0]; - return dst ? _timezone - 3600 : _timezone; + return - (dst ? _timezone - 3600 : _timezone); #else # if HAVE_TZNAME *pname = *tzname; From git at git.haskell.org Mon Feb 20 21:12:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:12:50 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Use configurations rather than Setup.hs hacks (5b0af2b) Message-ID: <20170220211250.130D83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/5b0af2be4901a466c6daf2895b242eaf46e70870 >--------------------------------------------------------------- commit 5b0af2be4901a466c6daf2895b242eaf46e70870 Author: Ian Lynagh Date: Sun Jul 29 14:38:33 2007 -0700 Use configurations rather than Setup.hs hacks darcs-hash:20070729213833-3fd76-865c6cb804d9768e5712cfe6bb5cd1f77340eda9 >--------------------------------------------------------------- 5b0af2be4901a466c6daf2895b242eaf46e70870 Setup.hs | 13 +--------- time.cabal | 85 ++++++++++++++++++++++++++++++++++---------------------------- 2 files changed, 47 insertions(+), 51 deletions(-) diff --git a/Setup.hs b/Setup.hs index e8a005c..d57f1c9 100644 --- a/Setup.hs +++ b/Setup.hs @@ -11,10 +11,7 @@ import System.Directory import System.Info main :: IO () -main = do let hooks = defaultUserHooks { - confHook = add_Win32_dep - $ confHook defaultUserHooks, - runTests = runTestScript } +main = do let hooks = defaultUserHooks { runTests = runTestScript } defaultMainWithHooks hooks withCurrentDirectory :: FilePath -> IO a -> IO a @@ -29,11 +26,3 @@ runTestScript _args _flag _pd _lbi type ConfHook = PackageDescription -> ConfigFlags -> IO LocalBuildInfo --- XXX Hideous hack -add_Win32_dep :: ConfHook -> ConfHook -add_Win32_dep f pd cf - = do let pd' = if os == "mingw32" - then pd { buildDepends = Dependency "Win32" AnyVersion - : buildDepends pd } - else pd - f pd' cf diff --git a/time.cabal b/time.cabal index cb9b6ca..e32a126 100644 --- a/time.cabal +++ b/time.cabal @@ -7,42 +7,49 @@ Author: Ashley Yakeley Maintainer: Homepage: http://semantic.org/TimeLib/ Category: -Build-Depends: base, old-locale -Synopsis: time library -Exposed-Modules: - Data.Time.Calendar, - Data.Time.Calendar.MonthDay, - Data.Time.Calendar.OrdinalDate, - Data.Time.Calendar.WeekDate, - Data.Time.Calendar.Julian, - Data.Time.Calendar.Easter, - Data.Time.Clock, - Data.Time.Clock.POSIX, - Data.Time.Clock.TAI, - Data.Time.LocalTime, - Data.Time.Format, - Data.Time -Extensions: ForeignFunctionInterface, CPP -C-Sources: cbits/HsTime.c -Other-Modules: - Data.Time.Calendar.Private, - Data.Time.Calendar.Days, - Data.Time.Calendar.Gregorian, - Data.Time.Calendar.JulianYearDay, - Data.Time.Clock.Scale, - Data.Time.Clock.UTC, - Data.Time.Clock.CTimeval, - Data.Time.Clock.UTCDiff, - Data.Time.LocalTime.TimeZone, - Data.Time.LocalTime.TimeOfDay, - Data.Time.LocalTime.LocalTime, - Data.Time.Format.Parse -Extra-Source-Files: - aclocal.m4 configure.ac configure - include/HsTime.h include/HsTimeConfig.h.in -Extra-Tmp-Files: - config.log config.status autom4te.cache - include/HsTimeConfig.h -Include-Dirs: include -Install-Includes: - HsTime.h HsTimeConfig.h + +Library { + Build-Depends: base, old-locale + if os(mingw32) { + Build-Depends: Win32 + } + Synopsis: time library + Exposed-Modules: + Data.Time.Calendar, + Data.Time.Calendar.MonthDay, + Data.Time.Calendar.OrdinalDate, + Data.Time.Calendar.WeekDate, + Data.Time.Calendar.Julian, + Data.Time.Calendar.Easter, + Data.Time.Clock, + Data.Time.Clock.POSIX, + Data.Time.Clock.TAI, + Data.Time.LocalTime, + Data.Time.Format, + Data.Time + Extensions: ForeignFunctionInterface, CPP + C-Sources: cbits/HsTime.c + Other-Modules: + Data.Time.Calendar.Private, + Data.Time.Calendar.Days, + Data.Time.Calendar.Gregorian, + Data.Time.Calendar.JulianYearDay, + Data.Time.Clock.Scale, + Data.Time.Clock.UTC, + Data.Time.Clock.CTimeval, + Data.Time.Clock.UTCDiff, + Data.Time.LocalTime.TimeZone, + Data.Time.LocalTime.TimeOfDay, + Data.Time.LocalTime.LocalTime, + Data.Time.Format.Parse + Extra-Source-Files: + aclocal.m4 configure.ac configure + include/HsTime.h include/HsTimeConfig.h.in + Extra-Tmp-Files: + config.log config.status autom4te.cache + include/HsTimeConfig.h + Include-Dirs: include + Install-Includes: + HsTime.h HsTimeConfig.h +} + From git at git.haskell.org Mon Feb 20 21:12:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:12:52 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Track .cabal syntax changes once again (8b0d7b8) Message-ID: <20170220211252.193F33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/8b0d7b84e60e824da7a410431dfafcee52d64029 >--------------------------------------------------------------- commit 8b0d7b84e60e824da7a410431dfafcee52d64029 Author: sven.panne Date: Sat Sep 1 08:47:28 2007 -0700 Track .cabal syntax changes once again darcs-hash:20070901154728-96103-656ff80bfc077ca44cbfe2afc3ca3a1a032b2fa9 >--------------------------------------------------------------- 8b0d7b84e60e824da7a410431dfafcee52d64029 time.cabal | 65 +++++++++++++++++++++++++++++++------------------------------- 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/time.cabal b/time.cabal index e32a126..f9c0c17 100644 --- a/time.cabal +++ b/time.cabal @@ -6,50 +6,51 @@ License-File: LICENSE Author: Ashley Yakeley Maintainer: Homepage: http://semantic.org/TimeLib/ +Synopsis: time library Category: +Extra-Source-Files: + aclocal.m4 configure.ac configure + include/HsTime.h include/HsTimeConfig.h.in +Extra-Tmp-Files: + config.log config.status autom4te.cache + include/HsTimeConfig.h + Library { Build-Depends: base, old-locale if os(mingw32) { Build-Depends: Win32 } - Synopsis: time library Exposed-Modules: - Data.Time.Calendar, - Data.Time.Calendar.MonthDay, - Data.Time.Calendar.OrdinalDate, - Data.Time.Calendar.WeekDate, - Data.Time.Calendar.Julian, - Data.Time.Calendar.Easter, - Data.Time.Clock, - Data.Time.Clock.POSIX, - Data.Time.Clock.TAI, - Data.Time.LocalTime, - Data.Time.Format, - Data.Time + Data.Time.Calendar, + Data.Time.Calendar.MonthDay, + Data.Time.Calendar.OrdinalDate, + Data.Time.Calendar.WeekDate, + Data.Time.Calendar.Julian, + Data.Time.Calendar.Easter, + Data.Time.Clock, + Data.Time.Clock.POSIX, + Data.Time.Clock.TAI, + Data.Time.LocalTime, + Data.Time.Format, + Data.Time Extensions: ForeignFunctionInterface, CPP C-Sources: cbits/HsTime.c Other-Modules: - Data.Time.Calendar.Private, - Data.Time.Calendar.Days, - Data.Time.Calendar.Gregorian, - Data.Time.Calendar.JulianYearDay, - Data.Time.Clock.Scale, - Data.Time.Clock.UTC, - Data.Time.Clock.CTimeval, - Data.Time.Clock.UTCDiff, - Data.Time.LocalTime.TimeZone, - Data.Time.LocalTime.TimeOfDay, - Data.Time.LocalTime.LocalTime, - Data.Time.Format.Parse - Extra-Source-Files: - aclocal.m4 configure.ac configure - include/HsTime.h include/HsTimeConfig.h.in - Extra-Tmp-Files: - config.log config.status autom4te.cache - include/HsTimeConfig.h + Data.Time.Calendar.Private, + Data.Time.Calendar.Days, + Data.Time.Calendar.Gregorian, + Data.Time.Calendar.JulianYearDay, + Data.Time.Clock.Scale, + Data.Time.Clock.UTC, + Data.Time.Clock.CTimeval, + Data.Time.Clock.UTCDiff, + Data.Time.LocalTime.TimeZone, + Data.Time.LocalTime.TimeOfDay, + Data.Time.LocalTime.LocalTime, + Data.Time.Format.Parse Include-Dirs: include Install-Includes: - HsTime.h HsTimeConfig.h + HsTime.h HsTimeConfig.h } From git at git.haskell.org Mon Feb 20 21:12:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:12:54 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Fixed Cabal-induced breakage, once again... (635d902) Message-ID: <20170220211254.1FF353A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/635d902b2a9ddcece575ae4b2873f793201e5684 >--------------------------------------------------------------- commit 635d902b2a9ddcece575ae4b2873f793201e5684 Author: sven.panne Date: Sat Sep 8 09:02:56 2007 -0700 Fixed Cabal-induced breakage, once again... MERGE TO STABLE (if we have a concept of "stable libraries") darcs-hash:20070908160256-96103-c5c21e89632939ac5896cf44abc9aa381df7ed4e >--------------------------------------------------------------- 635d902b2a9ddcece575ae4b2873f793201e5684 Setup.hs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Setup.hs b/Setup.hs index d57f1c9..1863d6e 100644 --- a/Setup.hs +++ b/Setup.hs @@ -2,13 +2,11 @@ module Main (main) where import Control.Exception import Distribution.PackageDescription -import Distribution.Setup import Distribution.Simple import Distribution.Simple.LocalBuildInfo import Distribution.Simple.Utils import System.Cmd import System.Directory -import System.Info main :: IO () main = do let hooks = defaultUserHooks { runTests = runTestScript } @@ -23,6 +21,3 @@ withCurrentDirectory path f = do runTestScript :: Args -> Bool -> PackageDescription -> LocalBuildInfo -> IO () runTestScript _args _flag _pd _lbi = maybeExit $ withCurrentDirectory "test" $ system "make" - -type ConfHook = PackageDescription -> ConfigFlags -> IO LocalBuildInfo - From git at git.haskell.org Mon Feb 20 21:12:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:12:56 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Allow a colon between the hours and minutes when parsing with %z and %Z. (e6e4837) Message-ID: <20170220211256.261F83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/e6e4837310610731a112dced280b3a14e9fe9e8b >--------------------------------------------------------------- commit e6e4837310610731a112dced280b3a14e9fe9e8b Author: bjorn Date: Tue Oct 16 12:52:39 2007 -0700 Allow a colon between the hours and minutes when parsing with %z and %Z. darcs-hash:20071016195239-6cdb2-17cf31be16d40e755740f2d3d264094be8e344a3 >--------------------------------------------------------------- e6e4837310610731a112dced280b3a14e9fe9e8b Data/Time/Format/Parse.hs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Data/Time/Format/Parse.hs b/Data/Time/Format/Parse.hs index bee16e8..7e4c319 100644 --- a/Data/Time/Format/Parse.hs +++ b/Data/Time/Format/Parse.hs @@ -110,9 +110,9 @@ parseInput l = liftM catMaybes . mapM p parseValue :: TimeLocale -> Char -> ReadP String parseValue l c = case c of - 'z' -> liftM2 (:) (choice [char '+', char '-']) (digits 4) + 'z' -> numericTZ 'Z' -> munch1 isUpper <++ - liftM2 (:) (choice [char '+', char '-']) (digits 4) <++ + numericTZ <++ return "" -- produced by %Z for LocalTime 'P' -> oneOf (let (am,pm) = amPm l in [map toLower am, map toLower pm]) @@ -154,8 +154,11 @@ parseValue l c = upTo :: Int -> ReadP a -> ReadP [a] upTo 0 _ = return [] upTo n x = liftM2 (:) x (upTo (n-1) x) <++ return [] - - + numericTZ = do s <- choice [char '+', char '-'] + h <- digits 2 + optional (char ':') + m <- digits 2 + return (s:h++m) -- -- * Instances for the time package types From git at git.haskell.org Mon Feb 20 21:12:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:12:58 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Document the format used for output with %z. (894b1f8) Message-ID: <20170220211258.2D6FB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/894b1f8e83bee2e25b93441e01b72953150d5931 >--------------------------------------------------------------- commit 894b1f8e83bee2e25b93441e01b72953150d5931 Author: bjorn Date: Tue Oct 16 12:54:49 2007 -0700 Document the format used for output with %z. darcs-hash:20071016195449-6cdb2-282aead0b5077d6d80d15d2110c9316b910ff13a >--------------------------------------------------------------- 894b1f8e83bee2e25b93441e01b72953150d5931 Data/Time/Format.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Data/Time/Format.hs b/Data/Time/Format.hs index 64f73ef..5e10cd1 100644 --- a/Data/Time/Format.hs +++ b/Data/Time/Format.hs @@ -37,7 +37,7 @@ class FormatTime t where -- -- For TimeZone (and ZonedTime and UTCTime): -- --- [@%z@] timezone offset +-- [@%z@] timezone offset on the format @-HHMM at . -- -- [@%Z@] timezone name -- From git at git.haskell.org Mon Feb 20 21:13:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:13:00 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Haddock for parseTime and friends. (0f2e21b) Message-ID: <20170220211300.33E6A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/0f2e21b7e9a01b5deea2ece7173b91d45a145c30 >--------------------------------------------------------------- commit 0f2e21b7e9a01b5deea2ece7173b91d45a145c30 Author: bjorn Date: Tue Oct 16 13:19:31 2007 -0700 Haddock for parseTime and friends. darcs-hash:20071016201931-6cdb2-3cfa3dd21381bb0fd52398f717d5ba9ad4eaa7b2 >--------------------------------------------------------------- 0f2e21b7e9a01b5deea2ece7173b91d45a145c30 Data/Time/Format/Parse.hs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Data/Time/Format/Parse.hs b/Data/Time/Format/Parse.hs index 7e4c319..c4a258d 100644 --- a/Data/Time/Format/Parse.hs +++ b/Data/Time/Format/Parse.hs @@ -36,8 +36,15 @@ class ParseTime t where -- corresponding part of the input. -> t --- | Parse a time value given a format string. Supports the same %-codes as --- 'formatTime'. +-- | Parses a time value given a format string. Supports the same %-codes as +-- 'formatTime'. Leading and trailing whitespace is accepted. +-- Some variations in the input are accepted: +-- +-- [@%z@] accepts any of @-HHMM@ or @-HH:MM at . +-- +-- [@%Z@] accepts any string of upper case letters, or any +-- of the formats accepted by @%z at . +-- parseTime :: ParseTime t => TimeLocale -- ^ Time locale. -> String -- ^ Format string. @@ -49,8 +56,7 @@ parseTime l fmt s = case readsTime l fmt s of _ -> Nothing -- | Parse a time value given a format string. Fails if the input could --- not be parsed using the given format. Supports the same %-codes as --- 'formatTime'. +-- not be parsed using the given format. See 'parseTime' for details. readTime :: ParseTime t => TimeLocale -- ^ Time locale. -> String -- ^ Format string. @@ -61,8 +67,7 @@ readTime l fmt s = case readsTime l fmt s of [(_,x)] -> error $ "readTime: junk at end of " ++ show x _ -> error $ "readsTime: bad input " ++ show s --- | Parse a time value given a format string. Supports the same %-codes as --- 'formatTime'. +-- | Parse a time value given a format string. See 'parseTime' for details. readsTime :: ParseTime t => TimeLocale -- ^ Time locale. -> String -- ^ Format string From git at git.haskell.org Mon Feb 20 21:13:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:13:02 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Use configurations to allow building with ghc-6.6, 6.8 (eff99ca) Message-ID: <20170220211302.3A5313A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/eff99ca5fd0da086e3fcb75203ff3d76fc4f2d00 >--------------------------------------------------------------- commit eff99ca5fd0da086e3fcb75203ff3d76fc4f2d00 Author: Duncan Coutts Date: Thu Oct 18 10:38:27 2007 -0700 Use configurations to allow building with ghc-6.6, 6.8 Specify build-type: Custom since there is test code in Setup.hs darcs-hash:20071018173827-adfee-6a7bc524d8bade80a2276c809006e48faeb701dd >--------------------------------------------------------------- eff99ca5fd0da086e3fcb75203ff3d76fc4f2d00 time.cabal | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/time.cabal b/time.cabal index f9c0c17..e2c477e 100644 --- a/time.cabal +++ b/time.cabal @@ -8,6 +8,8 @@ Maintainer: Homepage: http://semantic.org/TimeLib/ Synopsis: time library Category: +Build-Type: Custom +Cabal-Version: >=1.2 Extra-Source-Files: aclocal.m4 configure.ac configure @@ -16,11 +18,16 @@ Extra-Tmp-Files: config.log config.status autom4te.cache include/HsTimeConfig.h +Flag split-base + Library { - Build-Depends: base, old-locale - if os(mingw32) { + Build-Depends: base >= 2 + if flag(split-base) + Build-Depends: base >= 3, old-locale + else + Build-Depends: base < 3 + if os(windows) Build-Depends: Win32 - } Exposed-Modules: Data.Time.Calendar, Data.Time.Calendar.MonthDay, From git at git.haskell.org Mon Feb 20 21:13:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:13:04 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Bump version number (39c0eef) Message-ID: <20170220211304.412683A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/39c0eef062a890c38565b4d2ff65494d6c9b87b8 >--------------------------------------------------------------- commit 39c0eef062a890c38565b4d2ff65494d6c9b87b8 Author: Ian Lynagh Date: Sat Oct 27 05:49:20 2007 -0700 Bump version number darcs-hash:20071027124920-3fd76-1e1832bf4e7b70abd50fd5f502f04781e30836b2 >--------------------------------------------------------------- 39c0eef062a890c38565b4d2ff65494d6c9b87b8 time.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/time.cabal b/time.cabal index e2c477e..0e7c244 100644 --- a/time.cabal +++ b/time.cabal @@ -1,5 +1,5 @@ Name: time -Version: 1.1.1 +Version: 1.1.2.0 Stability: stable License: BSD3 License-File: LICENSE From git at git.haskell.org Mon Feb 20 21:13:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:13:06 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: document how to get a POSIXTime from an EpochTime or CTime. (2869c91) Message-ID: <20170220211306.47E293A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/2869c91e34012c0dc1834db50c79b5e68d4b95f2 >--------------------------------------------------------------- commit 2869c91e34012c0dc1834db50c79b5e68d4b95f2 Author: Simon Marlow Date: Wed Dec 5 01:15:37 2007 -0800 document how to get a POSIXTime from an EpochTime or CTime. darcs-hash:20071205091537-760e2-5c6cf6c587c9f72fe962cedd4a33b764a627016d >--------------------------------------------------------------- 2869c91e34012c0dc1834db50c79b5e68d4b95f2 Data/Time/Clock/POSIX.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Data/Time/Clock/POSIX.hs b/Data/Time/Clock/POSIX.hs index b877bf7..84137c1 100644 --- a/Data/Time/Clock/POSIX.hs +++ b/Data/Time/Clock/POSIX.hs @@ -24,6 +24,9 @@ posixDayLength :: NominalDiffTime posixDayLength = 86400 -- | POSIX time is the nominal time since 1970-01-01 00:00 UTC +-- +-- To convert from a 'Foreign.C.CTime' or 'System.Posix.EpochTime', use 'realToFrac'. +-- type POSIXTime = NominalDiffTime unixEpochDay :: Day From git at git.haskell.org Mon Feb 20 21:13:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:13:08 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Figure out timezone offset from timezone name (3c404c3) Message-ID: <20170220211308.4FE3B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/3c404c3416cd4610b1189b1b40193e5617a143eb >--------------------------------------------------------------- commit 3c404c3416cd4610b1189b1b40193e5617a143eb Author: David Leuschner Date: Sat Feb 2 03:33:17 2008 -0800 Figure out timezone offset from timezone name darcs-hash:20080202113317-3c698-73870973cd45d7f9ca67476c4d46e39db79e8402 >--------------------------------------------------------------- 3c404c3416cd4610b1189b1b40193e5617a143eb Data/Time/Format/Parse.hs | 232 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 226 insertions(+), 6 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 3c404c3416cd4610b1189b1b40193e5617a143eb From git at git.haskell.org Mon Feb 20 21:13:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:13:10 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Bump version to 1.1.2.1 (71f2aa9) Message-ID: <20170220211310.5755A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/71f2aa9d7792783ae7fe4dc19f1d90bfa92f380d >--------------------------------------------------------------- commit 71f2aa9d7792783ae7fe4dc19f1d90bfa92f380d Author: Ian Lynagh Date: Wed Jun 4 05:13:53 2008 -0700 Bump version to 1.1.2.1 darcs-hash:20080604121353-3fd76-d2a8d0737dfac619589ac8d511c9712259c7a7a8 >--------------------------------------------------------------- 71f2aa9d7792783ae7fe4dc19f1d90bfa92f380d time.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/time.cabal b/time.cabal index 0e7c244..43cf8a0 100644 --- a/time.cabal +++ b/time.cabal @@ -1,5 +1,5 @@ Name: time -Version: 1.1.2.0 +Version: 1.1.2.1 Stability: stable License: BSD3 License-File: LICENSE From git at git.haskell.org Mon Feb 20 21:13:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:13:12 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Remove -Wall and -Werror, they don't belong here (c46f680) Message-ID: <20170220211312.5D0583A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/c46f680fc0d2eec0a2c85b344478010097bcb05a >--------------------------------------------------------------- commit c46f680fc0d2eec0a2c85b344478010097bcb05a Author: Simon Marlow Date: Thu Jun 19 07:12:19 2008 -0700 Remove -Wall and -Werror, they don't belong here this fixes GHC HEAD right now, which generates a warning for -ffi. darcs-hash:20080619141219-12142-2fdb57eb762347e667e8e5d1ed92e82afd5ef599 >--------------------------------------------------------------- c46f680fc0d2eec0a2c85b344478010097bcb05a Data/Time/Clock/CTimeval.hs | 2 +- Data/Time/LocalTime/TimeZone.hs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Data/Time/Clock/CTimeval.hs b/Data/Time/Clock/CTimeval.hs index 8025bdb..0e83072 100644 --- a/Data/Time/Clock/CTimeval.hs +++ b/Data/Time/Clock/CTimeval.hs @@ -1,4 +1,4 @@ -{-# OPTIONS -ffi -Wall -Werror -cpp #-} +{-# OPTIONS -ffi -cpp #-} -- #hide module Data.Time.Clock.CTimeval where diff --git a/Data/Time/LocalTime/TimeZone.hs b/Data/Time/LocalTime/TimeZone.hs index d80671e..81f15d3 100644 --- a/Data/Time/LocalTime/TimeZone.hs +++ b/Data/Time/LocalTime/TimeZone.hs @@ -1,4 +1,4 @@ -{-# OPTIONS -ffi -Wall -Werror #-} +{-# OPTIONS -ffi #-} -- #hide module Data.Time.LocalTime.TimeZone From git at git.haskell.org Mon Feb 20 21:13:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:13:14 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Change "accuracy" to "precision". (cc3dae0) Message-ID: <20170220211314.62EE63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/cc3dae057e2bdcd8423b8beb9b46d2651e114de7 >--------------------------------------------------------------- commit cc3dae057e2bdcd8423b8beb9b46d2651e114de7 Author: Alexander Dunlap Date: Tue Jul 29 11:37:58 2008 -0700 Change "accuracy" to "precision". See . darcs-hash:20080729183758-e80da-955fe221e10854ee27e143cdb282caae7c010d33 >--------------------------------------------------------------- cc3dae057e2bdcd8423b8beb9b46d2651e114de7 Data/Time/Clock/Scale.hs | 2 +- Data/Time/Clock/UTC.hs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Data/Time/Clock/Scale.hs b/Data/Time/Clock/Scale.hs index 053c515..cb3fbee 100644 --- a/Data/Time/Clock/Scale.hs +++ b/Data/Time/Clock/Scale.hs @@ -21,7 +21,7 @@ newtype UniversalTime = ModJulianDate {getModJulianDate :: Rational} deriving (E -- | This is a length of time, as measured by a clock. -- Conversion functions will treat it as seconds. --- It has an accuracy of 10^-12 s. +-- It has a precision of 10^-12 s. newtype DiffTime = MkDiffTime Pico deriving (Eq,Ord) -- necessary because H98 doesn't have "cunning newtype" derivation diff --git a/Data/Time/Clock/UTC.hs b/Data/Time/Clock/UTC.hs index 57daa6b..a76a805 100644 --- a/Data/Time/Clock/UTC.hs +++ b/Data/Time/Clock/UTC.hs @@ -39,7 +39,7 @@ instance Ord UTCTime where -- | This is a length of time, as measured by UTC. -- Conversion functions will treat it as seconds. --- It has an accuracy of 10^-12 s. +-- It has a precision of 10^-12 s. -- It ignores leap-seconds, so it's not necessarily a fixed amount of clock time. -- For instance, 23:00 UTC + 2 hours of NominalDiffTime = 01:00 UTC (+ 1 day), -- regardless of whether a leap-second intervened. From git at git.haskell.org Mon Feb 20 21:13:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:13:16 +0000 (UTC) Subject: [commit: packages/time] format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis: don't warn about orphan instances; they're real warnings now (i.e. errors with -Werror) (b010dd2) Message-ID: <20170220211316.6A5ED3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/b010dd2b7c8e852a85d4f1c2136f17dad8e33ddf >--------------------------------------------------------------- commit b010dd2b7c8e852a85d4f1c2136f17dad8e33ddf Author: Ashley Yakeley Date: Tue Aug 12 00:35:46 2008 -0700 don't warn about orphan instances; they're real warnings now (i.e. errors with -Werror) darcs-hash:20080812073546-ac6dd-936d990eb8c2e6293124aec9f646a7988edca214 >--------------------------------------------------------------- b010dd2b7c8e852a85d4f1c2136f17dad8e33ddf Data/Time/Calendar/Gregorian.hs | 2 +- Data/Time/Format/Parse.hs | 2 +- Data/Time/LocalTime/LocalTime.hs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Data/Time/Calendar/Gregorian.hs b/Data/Time/Calendar/Gregorian.hs index 2d3546c..1887838 100644 --- a/Data/Time/Calendar/Gregorian.hs +++ b/Data/Time/Calendar/Gregorian.hs @@ -1,4 +1,4 @@ -{-# OPTIONS -Wall -Werror #-} +{-# OPTIONS -Wall -Werror -fno-warn-orphans #-} -- #hide module Data.Time.Calendar.Gregorian diff --git a/Data/Time/Format/Parse.hs b/Data/Time/Format/Parse.hs index 9f97cfd..aa9e2c3 100644 --- a/Data/Time/Format/Parse.hs +++ b/Data/Time/Format/Parse.hs @@ -1,4 +1,4 @@ -{-# OPTIONS -Wall -Werror #-} +{-# OPTIONS -Wall -Werror -fno-warn-orphans #-} -- #hide module Data.Time.Format.Parse diff --git a/Data/Time/LocalTime/LocalTime.hs b/Data/Time/LocalTime/LocalTime.hs index c902bb6..6c8bbb6 100644 --- a/Data/Time/LocalTime/LocalTime.hs +++ b/Data/Time/LocalTime/LocalTime.hs @@ -1,4 +1,4 @@ -{-# OPTIONS -Wall -Werror #-} +{-# OPTIONS -Wall -Werror -fno-warn-orphans #-} -- #hide module Data.Time.LocalTime.LocalTime From git at git.haskell.org Mon Feb 20 21:13:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:13:18 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: remove -ffi options (in favour of -XForeignFunctionInterface) (e581e9c) Message-ID: <20170220211318.715F03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/e581e9cbf1fc840663fa0e154ae99fc476223d5a >--------------------------------------------------------------- commit e581e9cbf1fc840663fa0e154ae99fc476223d5a Author: Ashley Yakeley Date: Sun Sep 14 17:19:01 2008 -0700 remove -ffi options (in favour of -XForeignFunctionInterface) darcs-hash:20080915001901-ac6dd-48abe6364ead4d30656f5a1ca6a05a854f9bd0fb >--------------------------------------------------------------- e581e9cbf1fc840663fa0e154ae99fc476223d5a Data/Time/Clock/CTimeval.hs | 2 +- test/TestEaster.hs | 2 +- test/TestFormat.hs | 2 +- test/TestParseDAT.hs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Data/Time/Clock/CTimeval.hs b/Data/Time/Clock/CTimeval.hs index 0e83072..ab5fd79 100644 --- a/Data/Time/Clock/CTimeval.hs +++ b/Data/Time/Clock/CTimeval.hs @@ -1,4 +1,4 @@ -{-# OPTIONS -ffi -cpp #-} +{-# OPTIONS -cpp #-} -- #hide module Data.Time.Clock.CTimeval where diff --git a/test/TestEaster.hs b/test/TestEaster.hs index 290c066..8aae5ce 100644 --- a/test/TestEaster.hs +++ b/test/TestEaster.hs @@ -1,4 +1,4 @@ -{-# OPTIONS -ffi -Wall -Werror #-} +{-# OPTIONS -Wall -Werror #-} module Main where diff --git a/test/TestFormat.hs b/test/TestFormat.hs index ecfa9fa..b827e0a 100644 --- a/test/TestFormat.hs +++ b/test/TestFormat.hs @@ -1,4 +1,4 @@ -{-# OPTIONS -ffi -Wall -Werror #-} +{-# OPTIONS -XForeignFunctionInterface -Wall -Werror #-} module Main where diff --git a/test/TestParseDAT.hs b/test/TestParseDAT.hs index ee56d49..181ca08 100644 --- a/test/TestParseDAT.hs +++ b/test/TestParseDAT.hs @@ -1,4 +1,4 @@ -{-# OPTIONS -ffi -Wall -Werror #-} +{-# OPTIONS -Wall -Werror #-} module Main where From git at git.haskell.org Mon Feb 20 21:13:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:13:20 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Add x-follows-version-policy tag (230f9ee) Message-ID: <20170220211320.782933A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/230f9ee15609e6e5b43d32f71041f18c15857ccb >--------------------------------------------------------------- commit 230f9ee15609e6e5b43d32f71041f18c15857ccb Author: Duncan Coutts Date: Fri Oct 10 20:47:42 2008 -0700 Add x-follows-version-policy tag darcs-hash:20081011034742-adfee-ceabc7cef114c6bc02d37cba7cdcd56e71e15744 >--------------------------------------------------------------- 230f9ee15609e6e5b43d32f71041f18c15857ccb time.cabal | 1 + 1 file changed, 1 insertion(+) diff --git a/time.cabal b/time.cabal index 43cf8a0..287ac1a 100644 --- a/time.cabal +++ b/time.cabal @@ -10,6 +10,7 @@ Synopsis: time library Category: Build-Type: Custom Cabal-Version: >=1.2 +x-follows-version-policy: Extra-Source-Files: aclocal.m4 configure.ac configure From git at git.haskell.org Mon Feb 20 21:13:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:13:22 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Bump version number to 1.1.2.2 (3f174bc) Message-ID: <20170220211322.7EE7C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/3f174bc80dc7342572622da4a83db83fc90e8622 >--------------------------------------------------------------- commit 3f174bc80dc7342572622da4a83db83fc90e8622 Author: Duncan Coutts Date: Fri Oct 10 20:48:01 2008 -0700 Bump version number to 1.1.2.2 Only warning and doc changes since the last release darcs-hash:20081011034801-adfee-f2cb7e23c6e6f767ee8b80bfa30c5fd78fefd7ab >--------------------------------------------------------------- 3f174bc80dc7342572622da4a83db83fc90e8622 time.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/time.cabal b/time.cabal index 287ac1a..aad656a 100644 --- a/time.cabal +++ b/time.cabal @@ -1,5 +1,5 @@ Name: time -Version: 1.1.2.1 +Version: 1.1.2.2 Stability: stable License: BSD3 License-File: LICENSE From git at git.haskell.org Mon Feb 20 21:13:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:13:24 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Improve meta-data (989fc61) Message-ID: <20170220211324.85CD63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/989fc61698038e6b230ce1c92b63167ccfe979e6 >--------------------------------------------------------------- commit 989fc61698038e6b230ce1c92b63167ccfe979e6 Author: Don Stewart Date: Sat Oct 11 15:04:12 2008 -0700 Improve meta-data darcs-hash:20081011220412-cba2c-18eac614e5ee4b1c7cc34abf7c6a91d3a28166c0 >--------------------------------------------------------------- 989fc61698038e6b230ce1c92b63167ccfe979e6 time.cabal | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/time.cabal b/time.cabal index aad656a..3b3dcde 100644 --- a/time.cabal +++ b/time.cabal @@ -6,8 +6,9 @@ License-File: LICENSE Author: Ashley Yakeley Maintainer: Homepage: http://semantic.org/TimeLib/ -Synopsis: time library -Category: +Synopsis: A time library +Description: A time library +Category: System Build-Type: Custom Cabal-Version: >=1.2 x-follows-version-policy: From git at git.haskell.org Mon Feb 20 21:13:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:13:26 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Ix instance for Day. This is useful for e.g. storing daily tabulated data in arrays. (b94d3b7) Message-ID: <20170220211326.8D58D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/b94d3b7c106b06acd57822dee8bf464022c3e53c >--------------------------------------------------------------- commit b94d3b7c106b06acd57822dee8bf464022c3e53c Author: Bjorn Buckwalter Date: Sat Nov 29 18:22:54 2008 -0800 Ix instance for Day. This is useful for e.g. storing daily tabulated data in arrays. darcs-hash:20081130022254-03283-3e7adc8ff05bff3fb416856f6a1e58697a073cf6 >--------------------------------------------------------------- b94d3b7c106b06acd57822dee8bf464022c3e53c Data/Time/Calendar/Days.hs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Data/Time/Calendar/Days.hs b/Data/Time/Calendar/Days.hs index 9d91db0..2e62400 100644 --- a/Data/Time/Calendar/Days.hs +++ b/Data/Time/Calendar/Days.hs @@ -5,6 +5,8 @@ module Data.Time.Calendar.Days Day(..),addDays,diffDays ) where +import Data.Ix + -- | The Modified Julian Day is a standard count of days, with zero being the day 1858-11-17. newtype Day = ModifiedJulianDay {toModifiedJulianDay :: Integer} deriving (Eq,Ord) @@ -19,6 +21,13 @@ instance Enum Day where enumFromTo (ModifiedJulianDay a) (ModifiedJulianDay b) = fmap ModifiedJulianDay (enumFromTo a b) enumFromThenTo (ModifiedJulianDay a) (ModifiedJulianDay b) (ModifiedJulianDay c) = fmap ModifiedJulianDay (enumFromThenTo a b c) +-- necessary because H98 doesn't have "cunning newtype" derivation +instance Ix Day where + range (ModifiedJulianDay a,ModifiedJulianDay b) = fmap ModifiedJulianDay (range (a,b)) + index (ModifiedJulianDay a,ModifiedJulianDay b) (ModifiedJulianDay c) = index (a,b) c + inRange (ModifiedJulianDay a,ModifiedJulianDay b) (ModifiedJulianDay c) = inRange (a,b) c + rangeSize (ModifiedJulianDay a,ModifiedJulianDay b) = rangeSize (a,b) + addDays :: Integer -> Day -> Day addDays n (ModifiedJulianDay a) = ModifiedJulianDay (a + n) From git at git.haskell.org Mon Feb 20 21:13:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:13:28 +0000 (UTC) Subject: [commit: packages/time] format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis: fix warnings; fix tests; remove GHC cruft; bump to 1.1.2.3 (578a832) Message-ID: <20170220211328.952643A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/578a832dbdba861430513fa4ef6c778af722fe37 >--------------------------------------------------------------- commit 578a832dbdba861430513fa4ef6c778af722fe37 Author: Ashley Yakeley Date: Sun Jan 4 14:37:28 2009 -0800 fix warnings; fix tests; remove GHC cruft; bump to 1.1.2.3 darcs-hash:20090104223728-ac6dd-4019748e20d222ef709e509c98869e59c238b2aa >--------------------------------------------------------------- 578a832dbdba861430513fa4ef6c778af722fe37 Data/Time/LocalTime/TimeZone.hs | 2 +- Setup.hs | 2 +- configure.ac | 2 +- include/Makefile | 11 - prologue.txt | 2 - test/TestParseTime.hs | 2 +- time.cabal | 2 +- time.xcodeproj/cabalbuild | 8 - time.xcodeproj/fixerrormsgs | 10 - time.xcodeproj/project.pbxproj | 441 ---------------------------------------- 10 files changed, 5 insertions(+), 477 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 578a832dbdba861430513fa4ef6c778af722fe37 From git at git.haskell.org Mon Feb 20 21:13:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:13:30 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: fix Julian haddock docs (6a4e1ea) Message-ID: <20170220211330.9BC3C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/6a4e1ea5f1a477ded35b7eedec59a55b18cbc4b1 >--------------------------------------------------------------- commit 6a4e1ea5f1a477ded35b7eedec59a55b18cbc4b1 Author: Ashley Yakeley Date: Sun Jan 4 14:43:39 2009 -0800 fix Julian haddock docs darcs-hash:20090104224339-ac6dd-d7e1a83ebcdace7c2f9638aa855efc18f9b6b0ae >--------------------------------------------------------------- 6a4e1ea5f1a477ded35b7eedec59a55b18cbc4b1 Data/Time/Calendar/JulianYearDay.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Data/Time/Calendar/JulianYearDay.hs b/Data/Time/Calendar/JulianYearDay.hs index ba10c8f..26e4660 100644 --- a/Data/Time/Calendar/JulianYearDay.hs +++ b/Data/Time/Calendar/JulianYearDay.hs @@ -10,7 +10,7 @@ module Data.Time.Calendar.JulianYearDay import Data.Time.Calendar.Days import Data.Time.Calendar.Private --- | convert to ISO 8601 Ordinal Day format. First element of result is year (proleptic Gregoran calendar), +-- | convert to proleptic Julian year and day format. First element of result is year (proleptic Julian calendar), -- second is the day of the year, with 1 for Jan 1, and 365 (or 366 in leap years) for Dec 31. toJulianYearAndDay :: Day -> (Integer,Int) toJulianYearAndDay (ModifiedJulianDay mjd) = (year,yd) where @@ -21,18 +21,18 @@ toJulianYearAndDay (ModifiedJulianDay mjd) = (year,yd) where yd = fromInteger (d - (y * 365) + 1) year = quad * 4 + y + 1 --- | convert from ISO 8601 Ordinal Day format. +-- | convert from proleptic Julian year and day format. -- Invalid day numbers will be clipped to the correct range (1 to 365 or 366). fromJulianYearAndDay :: Integer -> Int -> Day fromJulianYearAndDay year day = ModifiedJulianDay mjd where y = year - 1 mjd = (fromIntegral (clip 1 (if isJulianLeapYear year then 366 else 365) day)) + (365 * y) + (div y 4) - 678578 --- | show in ISO 8601 Ordinal Day format (yyyy-ddd) +-- | show in proleptic Julian year and day format (yyyy-ddd) showJulianYearAndDay :: Day -> String showJulianYearAndDay date = (show4 y) ++ "-" ++ (show3 d) where (y,d) = toJulianYearAndDay date --- | Is this year a leap year according to the proleptic Gregorian calendar? +-- | Is this year a leap year according to the proleptic Julian calendar? isJulianLeapYear :: Integer -> Bool isJulianLeapYear year = (mod year 4 == 0) From git at git.haskell.org Mon Feb 20 21:13:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:13:32 +0000 (UTC) Subject: [commit: packages/time] format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis: add Makefile for development building; remove OPTIONS -Wall -Werror in each file (a8f5da7) Message-ID: <20170220211332.A56143A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/a8f5da7d9d7d32114977b566f1f0f0546e07c219 >--------------------------------------------------------------- commit a8f5da7d9d7d32114977b566f1f0f0546e07c219 Author: Ashley Yakeley Date: Sun Jan 4 15:03:18 2009 -0800 add Makefile for development building; remove OPTIONS -Wall -Werror in each file darcs-hash:20090104230318-ac6dd-8719d86331f9b46e617e53665bc12e6e067c21f9 >--------------------------------------------------------------- a8f5da7d9d7d32114977b566f1f0f0546e07c219 Data/Time.hs | 2 -- Data/Time/Calendar.hs | 2 -- Data/Time/Calendar/Days.hs | 2 -- Data/Time/Calendar/Easter.hs | 2 -- Data/Time/Calendar/Gregorian.hs | 3 ++- Data/Time/Calendar/Julian.hs | 2 -- Data/Time/Calendar/JulianYearDay.hs | 2 -- Data/Time/Calendar/MonthDay.hs | 2 -- Data/Time/Calendar/OrdinalDate.hs | 2 -- Data/Time/Calendar/Private.hs | 2 -- Data/Time/Calendar/WeekDate.hs | 2 -- Data/Time/Clock.hs | 2 -- Data/Time/Clock/CTimeval.hs | 2 -- Data/Time/Clock/POSIX.hs | 2 -- Data/Time/Clock/Scale.hs | 2 -- Data/Time/Clock/TAI.hs | 2 -- Data/Time/Clock/UTC.hs | 2 -- Data/Time/Clock/UTCDiff.hs | 2 -- Data/Time/Format.hs | 2 -- Data/Time/Format/Parse.hs | 2 +- Data/Time/LocalTime.hs | 2 -- Data/Time/LocalTime/LocalTime.hs | 3 ++- Data/Time/LocalTime/TimeOfDay.hs | 2 -- Makefile | 29 +++++++++++++++++++++++++++++ 24 files changed, 34 insertions(+), 43 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 a8f5da7d9d7d32114977b566f1f0f0546e07c219 From git at git.haskell.org Mon Feb 20 21:13:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:13:34 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: prop_name helper for defining named properties. (c8bba9b) Message-ID: <20170220211334.AC1CF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/c8bba9b75c9ea49bfa955a2c5913b5322446923d >--------------------------------------------------------------- commit c8bba9b75c9ea49bfa955a2c5913b5322446923d Author: Bjorn Buckwalter Date: Sat Jan 17 17:10:08 2009 -0800 prop_name helper for defining named properties. darcs-hash:20090118011008-03283-d383aaaec1c96d8ca8a0f23ca2464d29e6e7d428 >--------------------------------------------------------------- c8bba9b75c9ea49bfa955a2c5913b5322446923d test/TestParseTime.hs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/test/TestParseTime.hs b/test/TestParseTime.hs index 8e313ba..11b8787 100644 --- a/test/TestParseTime.hs +++ b/test/TestParseTime.hs @@ -124,14 +124,17 @@ prop_fromSundayStartWeek d = -- * format and parse -- +-- | Helper for defining named properties. +prop_named :: (Arbitrary t, Show t, Testable a) + => String -> (FormatString s -> t -> a) -> String -> FormatString s -> NamedProperty +prop_named name prop typeName f = (name ++ " " ++ typeName ++ " " ++ show f, property (prop f)) + prop_parse_format :: (Eq t, FormatTime t, ParseTime t) => FormatString t -> t -> Bool prop_parse_format (FormatString f) t = parse f (format f t) == Just t prop_parse_format_named :: (Arbitrary t, Eq t, Show t, FormatTime t, ParseTime t) => String -> FormatString t -> NamedProperty -prop_parse_format_named typeName f = - ("prop_parse_format " ++ typeName ++ " " ++ show f, - property (prop_parse_format f)) +prop_parse_format_named = prop_named "prop_parse_format" prop_parse_format prop_format_parse_format :: (FormatTime t, ParseTime t) => FormatString t -> t -> Bool prop_format_parse_format (FormatString f) t = @@ -139,9 +142,7 @@ prop_format_parse_format (FormatString f) t = prop_format_parse_format_named :: (Arbitrary t, Show t, FormatTime t, ParseTime t) => String -> FormatString t -> NamedProperty -prop_format_parse_format_named typeName f = - ("prop_format_parse_format " ++ typeName ++ " " ++ show f, - property (prop_format_parse_format f)) +prop_format_parse_format_named = prop_named "prop_format_parse_format" prop_format_parse_format -- -- * crashes in parse @@ -166,9 +167,7 @@ prop_no_crash_bad_input fs@(FormatString f) (Input s) = property $ where prop_no_crash_bad_input_named :: (Eq t, ParseTime t) => String -> FormatString t -> NamedProperty -prop_no_crash_bad_input_named typeName f = - ("prop_no_crash_bad_input " ++ typeName ++ " " ++ show f, - property (prop_no_crash_bad_input f)) +prop_no_crash_bad_input_named = prop_named "prop_no_crash_bad_input" prop_no_crash_bad_input -- -- From git at git.haskell.org Mon Feb 20 21:13:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:13:36 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Properties for testing case-insensitivity. (bd8607f) Message-ID: <20170220211336.B29A43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/bd8607fd727c79c066aeae398104eee74b3faa53 >--------------------------------------------------------------- commit bd8607fd727c79c066aeae398104eee74b3faa53 Author: Bjorn Buckwalter Date: Sun Jan 18 13:51:43 2009 -0800 Properties for testing case-insensitivity. Note that not all formats being tested have alphabetical characters. The additional testing of those is "wasteful". darcs-hash:20090118215143-03283-5ed4f9ba7cdc8fa09afdb4584e52ac017c4421db >--------------------------------------------------------------- bd8607fd727c79c066aeae398104eee74b3faa53 test/TestParseTime.hs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/test/TestParseTime.hs b/test/TestParseTime.hs index 11b8787..76b897a 100644 --- a/test/TestParseTime.hs +++ b/test/TestParseTime.hs @@ -136,6 +136,22 @@ prop_parse_format_named :: (Arbitrary t, Eq t, Show t, FormatTime t, ParseTime t => String -> FormatString t -> NamedProperty prop_parse_format_named = prop_named "prop_parse_format" prop_parse_format +-- Verify case-insensitivity with upper case. +prop_parse_format_upper :: (Eq t, FormatTime t, ParseTime t) => FormatString t -> t -> Bool +prop_parse_format_upper (FormatString f) t = parse f (map toUpper $ format f t) == Just t + +prop_parse_format_upper_named :: (Arbitrary t, Eq t, Show t, FormatTime t, ParseTime t) + => String -> FormatString t -> NamedProperty +prop_parse_format_upper_named = prop_named "prop_parse_format_upper" prop_parse_format_upper + +-- Verify case-insensitivity with lower case. +prop_parse_format_lower :: (Eq t, FormatTime t, ParseTime t) => FormatString t -> t -> Bool +prop_parse_format_lower (FormatString f) t = parse f (map toLower $ format f t) == Just t + +prop_parse_format_lower_named :: (Arbitrary t, Eq t, Show t, FormatTime t, ParseTime t) + => String -> FormatString t -> NamedProperty +prop_parse_format_lower_named = prop_named "prop_parse_format_lower" prop_parse_format_lower + prop_format_parse_format :: (FormatTime t, ParseTime t) => FormatString t -> t -> Bool prop_format_parse_format (FormatString f) t = fmap (format f) (parse f (format f t) `asTypeOf` Just t) == Just (format f t) @@ -207,6 +223,20 @@ properties = ++ map (prop_parse_format_named "ZonedTime") zonedTimeFormats ++ map (prop_parse_format_named "UTCTime") utcTimeFormats + ++ map (prop_parse_format_upper_named "Day") dayFormats + ++ map (prop_parse_format_upper_named "TimeOfDay") timeOfDayFormats + ++ map (prop_parse_format_upper_named "LocalTime") localTimeFormats + ++ map (prop_parse_format_upper_named "TimeZone") timeZoneFormats + ++ map (prop_parse_format_upper_named "ZonedTime") zonedTimeFormats + ++ map (prop_parse_format_upper_named "UTCTime") utcTimeFormats + + ++ map (prop_parse_format_lower_named "Day") dayFormats + ++ map (prop_parse_format_lower_named "TimeOfDay") timeOfDayFormats + ++ map (prop_parse_format_lower_named "LocalTime") localTimeFormats + ++ map (prop_parse_format_lower_named "TimeZone") timeZoneFormats + ++ map (prop_parse_format_lower_named "ZonedTime") zonedTimeFormats + ++ map (prop_parse_format_lower_named "UTCTime") utcTimeFormats + ++ map (prop_format_parse_format_named "Day") partialDayFormats ++ map (prop_format_parse_format_named "TimeOfDay") partialTimeOfDayFormats ++ map (prop_format_parse_format_named "LocalTime") partialLocalTimeFormats From git at git.haskell.org Mon Feb 20 21:13:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:13:38 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Case-insensitive parsing. (781548a) Message-ID: <20170220211338.B91723A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/781548a552f78bba54abcdd2e3fb178786bdf547 >--------------------------------------------------------------- commit 781548a552f78bba54abcdd2e3fb178786bdf547 Author: Bjorn Buckwalter Date: Sun Jan 18 13:54:47 2009 -0800 Case-insensitive parsing. Note that when a TimeZone is parsed the timeZoneName is converted to upper case. The capitalization of the input could just as easily be preserved instead. It is unclear whether there is any clear advantage to either option. darcs-hash:20090118215447-03283-5df560167dff9f5cfaa4a40988befc60b0029696 >--------------------------------------------------------------- 781548a552f78bba54abcdd2e3fb178786bdf547 Data/Time/Format/Parse.hs | 49 +++++++++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/Data/Time/Format/Parse.hs b/Data/Time/Format/Parse.hs index 7218bfb..1aaf0d0 100644 --- a/Data/Time/Format/Parse.hs +++ b/Data/Time/Format/Parse.hs @@ -22,7 +22,23 @@ import Data.List import Data.Maybe import Data.Ratio import System.Locale -import Text.ParserCombinators.ReadP +import Text.ParserCombinators.ReadP hiding (char, string) + + +-- | Case-insensitive version of 'Text.ParserCombinators.ReadP.char'. +char :: Char -> ReadP Char +char c = satisfy (\x -> toUpper c == toUpper x) +-- | Case-insensitive version of 'Text.ParserCombinators.ReadP.string'. +string :: String -> ReadP String +string this = do s <- look; scan this s + where + scan [] _ = do return this + scan (x:xs) (y:ys) | toUpper x == toUpper y = do get; scan xs ys + scan _ _ = do pfail +-- | Convert string to upper case. +up :: String -> String +up = map toUpper + -- | The class of types which can be parsed given a UNIX-style time format -- string. @@ -37,12 +53,12 @@ class ParseTime t where -> t -- | Parses a time value given a format string. Supports the same %-codes as --- 'formatTime'. Leading and trailing whitespace is accepted. --- Some variations in the input are accepted: +-- 'formatTime'. Leading and trailing whitespace is accepted. Case is not +-- significant. Some variations in the input are accepted: -- -- [@%z@] accepts any of @-HHMM@ or @-HH:MM at . -- --- [@%Z@] accepts any string of upper case letters, or any +-- [@%Z@] accepts any string of letters, or any -- of the formats accepted by @%z at . -- parseTime :: ParseTime t => @@ -116,11 +132,10 @@ parseValue :: TimeLocale -> Char -> ReadP String parseValue l c = case c of 'z' -> numericTZ - 'Z' -> munch1 isUpper <++ + 'Z' -> munch1 isAlpha <++ numericTZ <++ return "" -- produced by %Z for LocalTime - 'P' -> oneOf (let (am,pm) = amPm l - in [map toLower am, map toLower pm]) + 'P' -> oneOf (let (am,pm) = amPm l in [am, pm]) 'p' -> oneOf (let (am,pm) = amPm l in [am, pm]) 'H' -> digits 2 'I' -> digits 2 @@ -191,9 +206,9 @@ instance ParseTime Day where -- %C: century (being the first two digits of the year), 00 - 99 'C' -> [Century (read x)] -- %B: month name, long form (fst from months locale), January - December - 'B' -> [Month (1 + fromJust (elemIndex x (map fst (months l))))] + 'B' -> [Month (1 + fromJust (elemIndex (up x) (map (up . fst) (months l))))] -- %b: month name, short form (snd from months locale), Jan - Dec - 'b' -> [Month (1 + fromJust (elemIndex x (map snd (months l))))] + 'b' -> [Month (1 + fromJust (elemIndex (up x) (map (up . snd) (months l))))] -- %m: month of year, leading 0 as needed, 01 - 12 'm' -> [Month (read x)] -- %d: day of month, leading 0 as needed, 01 - 31 @@ -213,9 +228,9 @@ instance ParseTime Day where -- %u: day for Week Date format, 1 - 7 'u' -> [WeekDay (read x)] -- %a: day of week, short form (snd from wDays locale), Sun - Sat - 'a' -> [WeekDay (1 + (fromJust (elemIndex x (map snd (wDays l))) + 6) `mod` 7)] + 'a' -> [WeekDay (1 + (fromJust (elemIndex (up x) (map (up . snd) (wDays l))) + 6) `mod` 7)] -- %A: day of week, long form (fst from wDays locale), Sunday - Saturday - 'A' -> [WeekDay (1 + (fromJust (elemIndex x (map fst (wDays l))) + 6) `mod` 7)] + 'A' -> [WeekDay (1 + (fromJust (elemIndex (up x) (map (up . fst) (wDays l))) + 6) `mod` 7)] -- %U: week number of year, where weeks start on Sunday (as sundayStartWeek), 01 - 53 'U' -> [Week SundayWeek (read x)] -- %w: day of week number, 0 (= Sunday) - 6 (= Saturday) @@ -248,8 +263,8 @@ instance ParseTime TimeOfDay where where f t@(TimeOfDay h m s) (c,x) = case c of - 'P' -> if x == map toLower (fst (amPm l)) then am else pm - 'p' -> if x == fst (amPm l) then am else pm + 'P' -> if up x == fst (amPm l) then am else pm + 'p' -> if up x == fst (amPm l) then am else pm 'H' -> TimeOfDay (read x) m s 'I' -> TimeOfDay (read x) m s 'k' -> TimeOfDay (read x) m s @@ -280,10 +295,10 @@ instance ParseTime TimeZone where case c of 'z' -> zone 'Z' | null x -> t - | isUpper (head x) -> - case lookup x _TIMEZONES_ of - Just (offset', dst') -> TimeZone offset' dst' x - Nothing -> TimeZone offset dst x + | isAlpha (head x) -> let y = up x in + case lookup y _TIMEZONES_ of + Just (offset', dst') -> TimeZone offset' dst' y + Nothing -> TimeZone offset dst y | otherwise -> zone _ -> t where zone = TimeZone (readTzOffset x) dst name From git at git.haskell.org Mon Feb 20 21:13:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:13:40 +0000 (UTC) Subject: [commit: packages/time] format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis: clean up .cabal; first attempt at Windows compilability (1e426ff) Message-ID: <20170220211340.C02703A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/1e426fff781e9bee333e4c1d0ffe28ebbe9360b4 >--------------------------------------------------------------- commit 1e426fff781e9bee333e4c1d0ffe28ebbe9360b4 Author: Ashley Yakeley Date: Thu Apr 16 23:36:49 2009 -0700 clean up .cabal; first attempt at Windows compilability darcs-hash:20090417063649-ac6dd-223499b4d550028c3f5cc97094745c4eb72ca60e >--------------------------------------------------------------- 1e426fff781e9bee333e4c1d0ffe28ebbe9360b4 Setup.hs | 6 +++-- include/HsTime.h | 4 ++++ time.cabal | 69 +++++++++++++++++++++++++++++++------------------------- 3 files changed, 46 insertions(+), 33 deletions(-) diff --git a/Setup.hs b/Setup.hs index 2211a91..ac50db8 100644 --- a/Setup.hs +++ b/Setup.hs @@ -7,10 +7,12 @@ import Distribution.Simple.LocalBuildInfo import Distribution.Simple.Utils import System.Cmd import System.Directory +import System.Info main :: IO () -main = do let hooks = autoconfUserHooks { runTests = runTestScript } - defaultMainWithHooks hooks +main = if os == "windows" + then defaultMain + else let hooks = autoconfUserHooks { runTests = runTestScript } in defaultMainWithHooks hooks withCurrentDirectory :: FilePath -> IO a -> IO a withCurrentDirectory path f = do diff --git a/include/HsTime.h b/include/HsTime.h index c02cc53..12d45bd 100644 --- a/include/HsTime.h +++ b/include/HsTime.h @@ -1,6 +1,9 @@ #ifndef __HSTIME_H__ #define __HSTIME_H__ +#if defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32) +#else + #include "HsTimeConfig.h" // Otherwise these clash with similar definitions from other packages: #undef PACKAGE_BUGREPORT @@ -12,6 +15,7 @@ #if HAVE_TIME_H #include #endif +#endif long int get_current_timezone_seconds (time_t,int* pdst,char const* * pname); diff --git a/time.cabal b/time.cabal index 84b17b5..2850397 100644 --- a/time.cabal +++ b/time.cabal @@ -1,36 +1,42 @@ -Name: time -Version: 1.1.2.3 -Stability: stable -License: BSD3 -License-File: LICENSE -Author: Ashley Yakeley -Maintainer: -Homepage: http://semantic.org/TimeLib/ -Synopsis: A time library -Description: A time library -Category: System -Build-Type: Custom -Cabal-Version: >=1.2 +name: time +version: 1.1.2.4 +stability: stable +license: BSD3 +license-file: LICENSE +author: Ashley Yakeley +maintainer: +homepage: http://semantic.org/TimeLib/ +synopsis: A time library +description: A time library +category: System +build-type: Custom +cabal-version: >=1.2 x-follows-version-policy: -Extra-Source-Files: - aclocal.m4 configure.ac configure - include/HsTime.h include/HsTimeConfig.h.in -Extra-Tmp-Files: - config.log config.status autom4te.cache - include/HsTimeConfig.h +extra-source-files: + aclocal.m4 + configure.ac + configure + include/HsTime.h + include/HsTimeConfig.h.in +extra-tmp-files: + config.log + config.status + autom4te.cache + include/HsTimeConfig.h -Flag split-base +flag split-base -Library { - Build-Depends: base >= 2 +library +{ + build-depends: base >= 2 if flag(split-base) - Build-Depends: base >= 3, old-locale + Build-Depends: base >= 3, old-locale else - Build-Depends: base < 3 + Build-Depends: base < 3 if os(windows) Build-Depends: Win32 - Exposed-Modules: + exposed-modules: Data.Time.Calendar, Data.Time.Calendar.MonthDay, Data.Time.Calendar.OrdinalDate, @@ -43,9 +49,9 @@ Library { Data.Time.LocalTime, Data.Time.Format, Data.Time - Extensions: ForeignFunctionInterface, CPP - C-Sources: cbits/HsTime.c - Other-Modules: + extensions: ForeignFunctionInterface, CPP + c-sources: cbits/HsTime.c + other-modules: Data.Time.Calendar.Private, Data.Time.Calendar.Days, Data.Time.Calendar.Gregorian, @@ -58,8 +64,9 @@ Library { Data.Time.LocalTime.TimeOfDay, Data.Time.LocalTime.LocalTime, Data.Time.Format.Parse - Include-Dirs: include - Install-Includes: - HsTime.h HsTimeConfig.h + include-dirs: include + install-includes: + HsTime.h + HsTimeConfig.h } From git at git.haskell.org Mon Feb 20 21:13:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:13:42 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: get building on Windows (89e52b0) Message-ID: <20170220211342.C77693A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/89e52b024e4b9600af3bb30debd6ac43711cdc04 >--------------------------------------------------------------- commit 89e52b024e4b9600af3bb30debd6ac43711cdc04 Author: ashley Date: Fri Apr 17 00:58:14 2009 -0700 get building on Windows Ignore-this: 7f61aa6f76736ff855aa665991f2a2c6 darcs-hash:20090417075814-ca2d0-d459b191878a61b0ac33b05230ecba1d94f93e69 >--------------------------------------------------------------- 89e52b024e4b9600af3bb30debd6ac43711cdc04 Setup.hs | 7 ++++--- include/HsTime.h | 3 ++- time.cabal | 10 +++++++--- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Setup.hs b/Setup.hs index ac50db8..cdd46de 100644 --- a/Setup.hs +++ b/Setup.hs @@ -10,9 +10,10 @@ import System.Directory import System.Info main :: IO () -main = if os == "windows" - then defaultMain - else let hooks = autoconfUserHooks { runTests = runTestScript } in defaultMainWithHooks hooks +main = case os of + "windows" -> defaultMain + "mingw32" -> defaultMain + _ -> let hooks = autoconfUserHooks { runTests = runTestScript } in defaultMainWithHooks hooks withCurrentDirectory :: FilePath -> IO a -> IO a withCurrentDirectory path f = do diff --git a/include/HsTime.h b/include/HsTime.h index 12d45bd..5296437 100644 --- a/include/HsTime.h +++ b/include/HsTime.h @@ -2,6 +2,7 @@ #define __HSTIME_H__ #if defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32) +#define HAVE_TIME_H 1 #else #include "HsTimeConfig.h" @@ -11,11 +12,11 @@ #undef PACKAGE_STRING #undef PACKAGE_TARNAME #undef PACKAGE_VERSION +#endif #if HAVE_TIME_H #include #endif -#endif long int get_current_timezone_seconds (time_t,int* pdst,char const* * pname); diff --git a/time.cabal b/time.cabal index 2850397..9c74c9e 100644 --- a/time.cabal +++ b/time.cabal @@ -65,8 +65,12 @@ library Data.Time.LocalTime.LocalTime, Data.Time.Format.Parse include-dirs: include - install-includes: - HsTime.h - HsTimeConfig.h + if os(windows) + install-includes: + HsTime.h + else + install-includes: + HsTime.h + HsTimeConfig.h } From git at git.haskell.org Mon Feb 20 21:13:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:13:44 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: next version will be 1.1.3 (1b7d9c2) Message-ID: <20170220211344.CDAAF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/1b7d9c29efb67bcc7488cb67bd8c964fa1582d1c >--------------------------------------------------------------- commit 1b7d9c29efb67bcc7488cb67bd8c964fa1582d1c Author: Ashley Yakeley Date: Sun Apr 26 17:07:46 2009 -0700 next version will be 1.1.3 Ignore-this: 5ba6f9cb1bf0e27b3f461f77ac6a9787 darcs-hash:20090427000746-ac6dd-4a8d881865f225955e9445bfc0aa33e3748ac158 >--------------------------------------------------------------- 1b7d9c29efb67bcc7488cb67bd8c964fa1582d1c time.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/time.cabal b/time.cabal index 9c74c9e..a5bc5b2 100644 --- a/time.cabal +++ b/time.cabal @@ -1,5 +1,5 @@ name: time -version: 1.1.2.4 +version: 1.1.3 stability: stable license: BSD3 license-file: LICENSE From git at git.haskell.org Mon Feb 20 21:13:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:13:48 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: cap in .cabal (6d9856b) Message-ID: <20170220211348.DBD673A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/6d9856b700ad8c10333f344b06ddfa1c4555b8e7 >--------------------------------------------------------------- commit 6d9856b700ad8c10333f344b06ddfa1c4555b8e7 Author: Ashley Yakeley Date: Mon Jun 1 21:04:36 2009 -0700 cap in .cabal Ignore-this: edc82bb754c59d5acd39a6d8b4c75cd4 darcs-hash:20090602040436-ac6dd-ae0eacca055d2f75b4d1410707434625c4e288b7 >--------------------------------------------------------------- 6d9856b700ad8c10333f344b06ddfa1c4555b8e7 time.cabal | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/time.cabal b/time.cabal index a5bc5b2..15bde6b 100644 --- a/time.cabal +++ b/time.cabal @@ -31,11 +31,11 @@ library { build-depends: base >= 2 if flag(split-base) - Build-Depends: base >= 3, old-locale + build-depends: base >= 3, old-locale else - Build-Depends: base < 3 + build-depends: base < 3 if os(windows) - Build-Depends: Win32 + build-depends: Win32 exposed-modules: Data.Time.Calendar, Data.Time.Calendar.MonthDay, From git at git.haskell.org Mon Feb 20 21:13:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:13:46 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Typeable instances for all types (1b0f97e) Message-ID: <20170220211346.D541C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/1b0f97ef5603d21c23a8db6485e2aeb602196cb5 >--------------------------------------------------------------- commit 1b0f97ef5603d21c23a8db6485e2aeb602196cb5 Author: Ashley Yakeley Date: Sun Apr 26 17:48:05 2009 -0700 Typeable instances for all types Ignore-this: 48421f072110ddf70b09bd4c030af863 darcs-hash:20090427004805-ac6dd-4cf4de606d27096343156c687b2a37991e055312 >--------------------------------------------------------------- 1b0f97ef5603d21c23a8db6485e2aeb602196cb5 Data/Time/Calendar/Days.hs | 4 ++++ Data/Time/Clock/Scale.hs | 7 +++++++ Data/Time/Clock/TAI.hs | 4 ++++ Data/Time/Clock/UTC.hs | 7 +++++++ Data/Time/LocalTime/LocalTime.hs | 7 +++++++ Data/Time/LocalTime/TimeOfDay.hs | 4 ++++ Data/Time/LocalTime/TimeZone.hs | 4 ++++ 7 files changed, 37 insertions(+) diff --git a/Data/Time/Calendar/Days.hs b/Data/Time/Calendar/Days.hs index 2e62400..ad493c4 100644 --- a/Data/Time/Calendar/Days.hs +++ b/Data/Time/Calendar/Days.hs @@ -6,10 +6,14 @@ module Data.Time.Calendar.Days ) where import Data.Ix +import Data.Typeable -- | The Modified Julian Day is a standard count of days, with zero being the day 1858-11-17. newtype Day = ModifiedJulianDay {toModifiedJulianDay :: Integer} deriving (Eq,Ord) +instance Typeable Day where + typeOf _ = mkTyConApp (mkTyCon "Data.Time.Calendar.Days.Day") [] + -- necessary because H98 doesn't have "cunning newtype" derivation instance Enum Day where succ (ModifiedJulianDay a) = ModifiedJulianDay (succ a) diff --git a/Data/Time/Clock/Scale.hs b/Data/Time/Clock/Scale.hs index 30f585b..101b770 100644 --- a/Data/Time/Clock/Scale.hs +++ b/Data/Time/Clock/Scale.hs @@ -12,16 +12,23 @@ module Data.Time.Clock.Scale import Data.Ratio ((%)) import Data.Fixed +import Data.Typeable -- | The Modified Julian Date is the day with the fraction of the day, measured from UT midnight. -- It's used to represent UT1, which is time as measured by the earth's rotation, adjusted for various wobbles. newtype UniversalTime = ModJulianDate {getModJulianDate :: Rational} deriving (Eq,Ord) +instance Typeable UniversalTime where + typeOf _ = mkTyConApp (mkTyCon "Data.Time.Clock.Scale.UniversalTime") [] + -- | This is a length of time, as measured by a clock. -- Conversion functions will treat it as seconds. -- It has a precision of 10^-12 s. newtype DiffTime = MkDiffTime Pico deriving (Eq,Ord) +instance Typeable DiffTime where + typeOf _ = mkTyConApp (mkTyCon "Data.Time.Clock.Scale.DiffTime") [] + -- necessary because H98 doesn't have "cunning newtype" derivation instance Enum DiffTime where succ (MkDiffTime a) = MkDiffTime (succ a) diff --git a/Data/Time/Clock/TAI.hs b/Data/Time/Clock/TAI.hs index 835746c..a43e75e 100644 --- a/Data/Time/Clock/TAI.hs +++ b/Data/Time/Clock/TAI.hs @@ -16,11 +16,15 @@ module Data.Time.Clock.TAI import Data.Time.LocalTime import Data.Time.Calendar.Days import Data.Time.Clock +import Data.Typeable import Data.Fixed -- | AbsoluteTime is TAI, time as measured by a clock. newtype AbsoluteTime = MkAbsoluteTime {unAbsoluteTime :: DiffTime} deriving (Eq,Ord) +instance Typeable AbsoluteTime where + typeOf _ = mkTyConApp (mkTyCon "Data.Time.Clock.TAI.AbsoluteTime") [] + instance Show AbsoluteTime where show t = show (utcToLocalTime utc (taiToUTCTime (const 0) t)) ++ " TAI" -- ugly, but standard apparently diff --git a/Data/Time/Clock/UTC.hs b/Data/Time/Clock/UTC.hs index e28ce77..74df8d7 100644 --- a/Data/Time/Clock/UTC.hs +++ b/Data/Time/Clock/UTC.hs @@ -16,6 +16,7 @@ module Data.Time.Clock.UTC import Data.Time.Calendar.Days import Data.Time.Clock.Scale import Data.Fixed +import Data.Typeable -- | This is the simplest representation of UTC. -- It consists of the day number, and a time offset from midnight. @@ -27,6 +28,9 @@ data UTCTime = UTCTime { utctDayTime :: DiffTime } +instance Typeable UTCTime where + typeOf _ = mkTyConApp (mkTyCon "Data.Time.Clock.UTC.UTCTime") [] + instance Eq UTCTime where (UTCTime da ta) == (UTCTime db tb) = (da == db) && (ta == tb) @@ -43,6 +47,9 @@ instance Ord UTCTime where -- regardless of whether a leap-second intervened. newtype NominalDiffTime = MkNominalDiffTime Pico deriving (Eq,Ord) +instance Typeable NominalDiffTime where + typeOf _ = mkTyConApp (mkTyCon "Data.Time.Clock.UTC.NominalDiffTime") [] + instance Enum NominalDiffTime where succ (MkNominalDiffTime a) = MkNominalDiffTime (succ a) pred (MkNominalDiffTime a) = MkNominalDiffTime (pred a) diff --git a/Data/Time/LocalTime/LocalTime.hs b/Data/Time/LocalTime/LocalTime.hs index 6d8f219..7125a55 100644 --- a/Data/Time/LocalTime/LocalTime.hs +++ b/Data/Time/LocalTime/LocalTime.hs @@ -16,6 +16,7 @@ import Data.Time.LocalTime.TimeOfDay import Data.Time.LocalTime.TimeZone import Data.Time.Calendar import Data.Time.Clock +import Data.Typeable -- | A simple day and time aggregate, where the day is of the specified parameter, -- and the time is a TimeOfDay. @@ -26,6 +27,9 @@ data LocalTime = LocalTime { localTimeOfDay :: TimeOfDay } deriving (Eq,Ord) +instance Typeable LocalTime where + typeOf _ = mkTyConApp (mkTyCon "Data.Time.LocalTime.LocalTime.LocalTime") [] + instance Show LocalTime where show (LocalTime d t) = (showGregorian d) ++ " " ++ (show t) @@ -56,6 +60,9 @@ data ZonedTime = ZonedTime { zonedTimeZone :: TimeZone } +instance Typeable ZonedTime where + typeOf _ = mkTyConApp (mkTyCon "Data.Time.LocalTime.LocalTime.ZonedTime") [] + utcToZonedTime :: TimeZone -> UTCTime -> ZonedTime utcToZonedTime zone time = ZonedTime (utcToLocalTime zone time) zone diff --git a/Data/Time/LocalTime/TimeOfDay.hs b/Data/Time/LocalTime/TimeOfDay.hs index 8134d1d..c0b4608 100644 --- a/Data/Time/LocalTime/TimeOfDay.hs +++ b/Data/Time/LocalTime/TimeOfDay.hs @@ -11,6 +11,7 @@ module Data.Time.LocalTime.TimeOfDay import Data.Time.LocalTime.TimeZone import Data.Time.Calendar.Private import Data.Time.Clock +import Data.Typeable import Data.Fixed -- | Time of day as represented in hour, minute and second (with picoseconds), typically used to express local time of day. @@ -24,6 +25,9 @@ data TimeOfDay = TimeOfDay { todSec :: Pico } deriving (Eq,Ord) +instance Typeable TimeOfDay where + typeOf _ = mkTyConApp (mkTyCon "Data.Time.LocalTime.TimeOfDay.TimeOfDay") [] + -- | Hour zero midnight :: TimeOfDay midnight = TimeOfDay 0 0 0 diff --git a/Data/Time/LocalTime/TimeZone.hs b/Data/Time/LocalTime/TimeZone.hs index da4a9cb..34c85a5 100644 --- a/Data/Time/LocalTime/TimeZone.hs +++ b/Data/Time/LocalTime/TimeZone.hs @@ -17,6 +17,7 @@ import Data.Time.Clock.POSIX import Foreign import Foreign.C +import Data.Typeable -- | A TimeZone is a whole number of minutes offset from UTC, together with a name and a \"just for summer\" flag. data TimeZone = TimeZone { @@ -28,6 +29,9 @@ data TimeZone = TimeZone { timeZoneName :: String } deriving (Eq,Ord) +instance Typeable TimeZone where + typeOf _ = mkTyConApp (mkTyCon "Data.Time.LocalTime.TimeZone.TimeZone") [] + -- | Create a nameless non-summer timezone for this number of minutes minutesToTimeZone :: Int -> TimeZone minutesToTimeZone m = TimeZone m False "" From git at git.haskell.org Mon Feb 20 21:13:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:13:50 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: add validating converters (0cf7847) Message-ID: <20170220211350.E3F2C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/0cf7847561972882b17979ca1213525f8cba5ae2 >--------------------------------------------------------------- commit 0cf7847561972882b17979ca1213525f8cba5ae2 Author: Ashley Yakeley Date: Mon Jun 1 23:51:42 2009 -0700 add validating converters Ignore-this: 4b18a44adbcb288e62f8dbce1377be8b darcs-hash:20090602065142-ac6dd-8e4090d57516369e58f07fbf5872fadd5b30db9c >--------------------------------------------------------------- 0cf7847561972882b17979ca1213525f8cba5ae2 Data/Time/Calendar/Gregorian.hs | 9 ++++++++- Data/Time/Calendar/Julian.hs | 9 ++++++++- Data/Time/Calendar/JulianYearDay.hs | 10 ++++++++++ Data/Time/Calendar/MonthDay.hs | 14 +++++++++++++- Data/Time/Calendar/OrdinalDate.hs | 10 ++++++++++ Data/Time/Calendar/Private.hs | 5 +++++ Data/Time/Calendar/WeekDate.hs | 14 ++++++++++++++ test/ConvertBack.hs | 17 +++++++++++------ 8 files changed, 79 insertions(+), 9 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 0cf7847561972882b17979ca1213525f8cba5ae2 From git at git.haskell.org Mon Feb 20 21:13:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:13:52 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: use base==4.* (1a31e47) Message-ID: <20170220211352.EA78B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/1a31e473c9c5827233abb7d7eccbd81ffdc16fa2 >--------------------------------------------------------------- commit 1a31e473c9c5827233abb7d7eccbd81ffdc16fa2 Author: Ashley Yakeley Date: Wed Jun 17 01:48:43 2009 -0700 use base==4.* Ignore-this: e37c8cafd9ef17ff3eff6980162e41e5 darcs-hash:20090617084843-ac6dd-bb32d062e0f968ce9f7cd3f1cd0ab09732956943 >--------------------------------------------------------------- 1a31e473c9c5827233abb7d7eccbd81ffdc16fa2 time.cabal | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/time.cabal b/time.cabal index 15bde6b..ef27092 100644 --- a/time.cabal +++ b/time.cabal @@ -25,15 +25,9 @@ extra-tmp-files: autom4te.cache include/HsTimeConfig.h -flag split-base - library { - build-depends: base >= 2 - if flag(split-base) - build-depends: base >= 3, old-locale - else - build-depends: base < 3 + build-depends: base == 4.*, old-locale if os(windows) build-depends: Win32 exposed-modules: From git at git.haskell.org Mon Feb 20 21:13:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:13:54 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: add validating constructors (9884b31) Message-ID: <20170220211354.F17DA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/9884b31fcca197b64f6e356142d9d99e1422ab38 >--------------------------------------------------------------- commit 9884b31fcca197b64f6e356142d9d99e1422ab38 Author: Ashley Yakeley Date: Wed Jun 17 01:49:36 2009 -0700 add validating constructors Ignore-this: e01e75f9d860f34285265b39b20cf225 darcs-hash:20090617084936-ac6dd-5ecf266acb8e2dabaa0b7a33fc2cda0cf6d44727 >--------------------------------------------------------------- 9884b31fcca197b64f6e356142d9d99e1422ab38 Data/Time/Calendar/OrdinalDate.hs | 31 +++++++++++++++++++++++++++++++ Data/Time/LocalTime/TimeOfDay.hs | 9 ++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/Data/Time/Calendar/OrdinalDate.hs b/Data/Time/Calendar/OrdinalDate.hs index 327c561..4e5b2b9 100644 --- a/Data/Time/Calendar/OrdinalDate.hs +++ b/Data/Time/Calendar/OrdinalDate.hs @@ -79,6 +79,21 @@ fromMondayStartWeek y w d = ModifiedJulianDay (firstDay + yd) -- 0-based year day of first monday of the year firstMonday = (5 - firstDay) `mod` 7 +fromMondayStartWeekValid :: Integer -- ^ Year. + -> Int -- ^ Monday-starting week number. + -> Int -- ^ Day of week. + -- Monday is 1, Sunday is 7 (as \"%u\" in 'Data.Time.Format.formatTime'). + -> Maybe Day +fromMondayStartWeekValid year w d = do + d' <- clipValid 1 7 d + -- first day of the year + let firstDay = toModifiedJulianDay (fromOrdinalDate year 1) + -- 0-based year day of first monday of the year + let firstMonday = (5 - firstDay) `mod` 7 + let yd = firstMonday + 7 * toInteger (w-1) + toInteger d' + yd' <- clipValid 1 (if isLeapYear year then 366 else 365) yd + return (ModifiedJulianDay (firstDay - 1 + yd')) + -- | The inverse of 'sundayStartWeek'. Get a 'Day' given the year and -- the number of the day of a Sunday-starting week. -- The first Sunday is the first day of week 1, any earlier days in the @@ -94,3 +109,19 @@ fromSundayStartWeek y w d = ModifiedJulianDay (firstDay + yd) firstDay = toModifiedJulianDay (fromOrdinalDate y 1) -- 0-based year day of first sunday of the year firstSunday = (4 - firstDay) `mod` 7 + +fromSundayStartWeekValid :: Integer -- ^ Year. + -> Int -- ^ Monday-starting week number. + -> Int -- ^ Day of week. + -- Monday is 1, Sunday is 7 (as \"%u\" in 'Data.Time.Format.formatTime'). + -> Maybe Day +fromSundayStartWeekValid year w d = do + d' <- clipValid 1 7 d + -- first day of the year + let firstDay = toModifiedJulianDay (fromOrdinalDate year 1) + -- 0-based year day of first sunday of the year + let firstMonday = (4 - firstDay) `mod` 7 + let yd = firstMonday + 7 * toInteger (w-1) + toInteger d' + yd' <- clipValid 1 (if isLeapYear year then 366 else 365) yd + return (ModifiedJulianDay (firstDay - 1 + yd')) + diff --git a/Data/Time/LocalTime/TimeOfDay.hs b/Data/Time/LocalTime/TimeOfDay.hs index c0b4608..9639545 100644 --- a/Data/Time/LocalTime/TimeOfDay.hs +++ b/Data/Time/LocalTime/TimeOfDay.hs @@ -2,7 +2,7 @@ module Data.Time.LocalTime.TimeOfDay ( -- * Time of day - TimeOfDay(..),midnight,midday, + TimeOfDay(..),midnight,midday,makeTimeOfDayValid, utcToLocalTimeOfDay,localToUTCTimeOfDay, timeToTimeOfDay,timeOfDayToTime, dayFractionToTimeOfDay,timeOfDayToDayFraction @@ -39,6 +39,13 @@ midday = TimeOfDay 12 0 0 instance Show TimeOfDay where show (TimeOfDay h m s) = (show2 h) ++ ":" ++ (show2 m) ++ ":" ++ (show2Fixed s) +makeTimeOfDayValid :: Int -> Int -> Pico -> Maybe TimeOfDay +makeTimeOfDayValid h m s = do + clipValid 0 23 h + clipValid 0 59 m + clipValid 0 60.999999999999 s + return (TimeOfDay h m s) + -- | Convert a ToD in UTC to a ToD in some timezone, together with a day adjustment. utcToLocalTimeOfDay :: TimeZone -> TimeOfDay -> (Integer,TimeOfDay) utcToLocalTimeOfDay zone (TimeOfDay h m s) = (fromIntegral (div h' 24),TimeOfDay (mod h' 24) (mod m' 60) s) where From git at git.haskell.org Mon Feb 20 21:13:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:13:57 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: version 1.1.4 (2c8d2f1) Message-ID: <20170220211357.045EE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/2c8d2f18f7ac245413c03b10589f0a9c479b03f7 >--------------------------------------------------------------- commit 2c8d2f18f7ac245413c03b10589f0a9c479b03f7 Author: Ashley Yakeley Date: Sat Jul 11 00:50:07 2009 -0700 version 1.1.4 Ignore-this: e431293abfeda1f8459f0b737d23fd7b darcs-hash:20090711075007-ac6dd-296363021486c36779a7414beb5df74b6891096d >--------------------------------------------------------------- 2c8d2f18f7ac245413c03b10589f0a9c479b03f7 time.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/time.cabal b/time.cabal index ef27092..943570a 100644 --- a/time.cabal +++ b/time.cabal @@ -1,5 +1,5 @@ name: time -version: 1.1.3 +version: 1.1.4 stability: stable license: BSD3 license-file: LICENSE From git at git.haskell.org Mon Feb 20 21:13:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:13:59 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: formatTime: glibc-style modifier flags (2dc3703) Message-ID: <20170220211359.0C5AF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/2dc370310ded2f5d49393b15aa06cb5fe37a5fe4 >--------------------------------------------------------------- commit 2dc370310ded2f5d49393b15aa06cb5fe37a5fe4 Author: Ashley Yakeley Date: Sat Jul 11 01:01:32 2009 -0700 formatTime: glibc-style modifier flags Ignore-this: 8331c2248a9b7613bec5547b491345e4 darcs-hash:20090711080132-ac6dd-d47e07a220f2aeb88b27e621fdcf3c3498fb8875 >--------------------------------------------------------------- 2dc370310ded2f5d49393b15aa06cb5fe37a5fe4 Data/Time/Calendar/Gregorian.hs | 2 +- Data/Time/Calendar/Julian.hs | 2 +- Data/Time/Calendar/JulianYearDay.hs | 2 +- Data/Time/Calendar/OrdinalDate.hs | 2 +- Data/Time/Calendar/Private.hs | 48 ++++++------ Data/Time/Calendar/WeekDate.hs | 4 +- Data/Time/Format.hs | 143 ++++++++++++++++++++---------------- Data/Time/LocalTime/TimeOfDay.hs | 2 +- Data/Time/LocalTime/TimeZone.hs | 14 ++-- test/TestFormat.hs | 21 +++++- 10 files changed, 137 insertions(+), 103 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 2dc370310ded2f5d49393b15aa06cb5fe37a5fe4 From git at git.haskell.org Mon Feb 20 21:14:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:14:01 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: update cabal-version constraint (2084584) Message-ID: <20170220211401.1357D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/2084584ab23d68190b1962a83dce55364fe59fa3 >--------------------------------------------------------------- commit 2084584ab23d68190b1962a83dce55364fe59fa3 Author: Ross Paterson Date: Fri Jul 17 09:02:55 2009 -0700 update cabal-version constraint Ignore-this: 8afa55b6e44d52192aca8b1c94e59b4a The syntax 'base == 4.*' requires cabal version 1.6 or later. darcs-hash:20090717160255-b47d3-1ea8d54339e500897925ccd5fc60b37769f4e12f >--------------------------------------------------------------- 2084584ab23d68190b1962a83dce55364fe59fa3 time.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/time.cabal b/time.cabal index 943570a..b86a5cf 100644 --- a/time.cabal +++ b/time.cabal @@ -10,7 +10,7 @@ synopsis: A time library description: A time library category: System build-type: Custom -cabal-version: >=1.2 +cabal-version: >=1.6 x-follows-version-policy: extra-source-files: From git at git.haskell.org Mon Feb 20 21:14:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:14:03 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: copyright date (f071372) Message-ID: <20170220211403.1A4633A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/f0713723994cc5ddbcbd7243aaf893ba942fb187 >--------------------------------------------------------------- commit f0713723994cc5ddbcbd7243aaf893ba942fb187 Author: Ashley Yakeley Date: Sat Apr 10 20:25:06 2010 -0700 copyright date Ignore-this: 198dfe29d0077290f955c72688527bc8 darcs-hash:20100411032506-ac6dd-104beb14b3799423c78ee5053baf16cd9dd18c41 >--------------------------------------------------------------- f0713723994cc5ddbcbd7243aaf893ba942fb187 LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index af649fe..485d7f6 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -TimeLib is Copyright (c) Ashley Yakeley, 2004-2007. +TimeLib is Copyright (c) Ashley Yakeley, 2004-2010. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: From git at git.haskell.org Mon Feb 20 21:14:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:14:05 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: sort out GHC 6.12 warnings (66ee658) Message-ID: <20170220211405.217633A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/66ee658898559bfff6f7de50015f4827f5e7a967 >--------------------------------------------------------------- commit 66ee658898559bfff6f7de50015f4827f5e7a967 Author: Ashley Yakeley Date: Sat Apr 10 20:34:14 2010 -0700 sort out GHC 6.12 warnings Ignore-this: f97673c30230c03de97445fbab0e4bf6 darcs-hash:20100411033414-ac6dd-1c96f2e3e15eb0296f7e20aaf5b695b7dff225ef >--------------------------------------------------------------- 66ee658898559bfff6f7de50015f4827f5e7a967 Data/Time/Format/Parse.hs | 2 +- Data/Time/LocalTime/TimeOfDay.hs | 6 +++--- Makefile | 2 +- time.cabal | 1 + 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Data/Time/Format/Parse.hs b/Data/Time/Format/Parse.hs index 1aaf0d0..d30d75c 100644 --- a/Data/Time/Format/Parse.hs +++ b/Data/Time/Format/Parse.hs @@ -33,7 +33,7 @@ string :: String -> ReadP String string this = do s <- look; scan this s where scan [] _ = do return this - scan (x:xs) (y:ys) | toUpper x == toUpper y = do get; scan xs ys + scan (x:xs) (y:ys) | toUpper x == toUpper y = do _ <- get; scan xs ys scan _ _ = do pfail -- | Convert string to upper case. up :: String -> String diff --git a/Data/Time/LocalTime/TimeOfDay.hs b/Data/Time/LocalTime/TimeOfDay.hs index 8b5ef19..1a360b7 100644 --- a/Data/Time/LocalTime/TimeOfDay.hs +++ b/Data/Time/LocalTime/TimeOfDay.hs @@ -41,9 +41,9 @@ instance Show TimeOfDay where makeTimeOfDayValid :: Int -> Int -> Pico -> Maybe TimeOfDay makeTimeOfDayValid h m s = do - clipValid 0 23 h - clipValid 0 59 m - clipValid 0 60.999999999999 s + _ <- clipValid 0 23 h + _ <- clipValid 0 59 m + _ <- clipValid 0 60.999999999999 s return (TimeOfDay h m s) -- | Convert a ToD in UTC to a ToD in some timezone, together with a day adjustment. diff --git a/Makefile b/Makefile index 1b6d17b..d56bf1a 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ configure: cabal configure --enable-library-profiling --enable-executable-profiling build: configure - cabal build --ghc-options="-Wall -Werror" + cabal build --ghc-options=-Werror test: build cabal test diff --git a/time.cabal b/time.cabal index b86a5cf..51a77db 100644 --- a/time.cabal +++ b/time.cabal @@ -28,6 +28,7 @@ extra-tmp-files: library { build-depends: base == 4.*, old-locale + ghc-options: -Wall if os(windows) build-depends: Win32 exposed-modules: From git at git.haskell.org Mon Feb 20 21:14:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:14:07 +0000 (UTC) Subject: [commit: packages/time] format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis: version 1.2; add Data instance, conditional on support (1bf713f) Message-ID: <20170220211407.2AA353A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/1bf713fdcc3d3e2e8bb85f261822ba5933c7a7cf >--------------------------------------------------------------- commit 1bf713fdcc3d3e2e8bb85f261822ba5933c7a7cf Author: Ashley Yakeley Date: Sat Apr 10 22:19:39 2010 -0700 version 1.2; add Data instance, conditional on support Ignore-this: fd76cc60dee7fdee543cf9156d7be919 darcs-hash:20100411051939-ac6dd-28dd1696fee060935dbe26a49da0f53dc0f4490d >--------------------------------------------------------------- 1bf713fdcc3d3e2e8bb85f261822ba5933c7a7cf Data/Time/Calendar/Days.hs | 13 ++++++++++++- Data/Time/Clock/Scale.hs | 21 +++++++++++++++++++-- Data/Time/Clock/TAI.hs | 13 ++++++++++++- Data/Time/Clock/UTC.hs | 18 +++++++++++++++++- Data/Time/Format/Parse.hs | 13 ++++++++++++- Data/Time/LocalTime/LocalTime.hs | 18 +++++++++++++++++- Data/Time/LocalTime/TimeOfDay.hs | 13 ++++++++++++- Data/Time/LocalTime/TimeZone.hs | 13 ++++++++++++- time.cabal | 9 ++++++++- 9 files changed, 121 insertions(+), 10 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 1bf713fdcc3d3e2e8bb85f261822ba5933c7a7cf From git at git.haskell.org Mon Feb 20 21:14:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:14:09 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: fix tests (cec60a0) Message-ID: <20170220211409.31C9B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/cec60a0b5e84c4240d2fe0419b215f6fe3da43dc >--------------------------------------------------------------- commit cec60a0b5e84c4240d2fe0419b215f6fe3da43dc Author: Ashley Yakeley Date: Sat Apr 10 22:40:58 2010 -0700 fix tests Ignore-this: 98e1f1b38f6d01fbcaff8ffbc45ec492 darcs-hash:20100411054058-ac6dd-b658c36af21af9caa015dc3fda05bad7f53457fc >--------------------------------------------------------------- cec60a0b5e84c4240d2fe0419b215f6fe3da43dc Makefile | 2 +- test/AddDays.hs | 1 - test/Makefile | 4 +--- test/TestParseTime.hs | 1 - 4 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index d56bf1a..de4898f 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ configure: build: configure cabal build --ghc-options=-Werror -test: build +test: install cabal test haddock: configure diff --git a/test/AddDays.hs b/test/AddDays.hs index 719f70a..a867905 100644 --- a/test/AddDays.hs +++ b/test/AddDays.hs @@ -3,7 +3,6 @@ module Main where import Data.Time.Calendar -import Control.Monad days ::[Day] days = diff --git a/test/Makefile b/test/Makefile index ecfaa96..307adcc 100644 --- a/test/Makefile +++ b/test/Makefile @@ -2,9 +2,7 @@ GHC = ghc GHCFLAGS = -package time default: - cd ..; runhaskell Setup.hs register --user --inplace make CurrentTime.run ShowDST.run test - cd ..; runhaskell Setup.hs unregister --user TestMonthDay: TestMonthDay.o $(GHC) $(GHCFLAGS) $^ -o $@ @@ -66,7 +64,7 @@ test: \ TestFormat.diff0 \ TestParseDAT.diff \ TestEaster.diff \ - TestParseTime.run \ +# TestParseTime.run \ UseCases.o clean: diff --git a/test/TestParseTime.hs b/test/TestParseTime.hs index 76b897a..b727f3f 100644 --- a/test/TestParseTime.hs +++ b/test/TestParseTime.hs @@ -6,7 +6,6 @@ import Data.Ratio import Data.Time import Data.Time.Calendar.OrdinalDate import Data.Time.Calendar.WeekDate -import Data.Time.Clock import Data.Time.Clock.POSIX import System.Locale import Test.QuickCheck From git at git.haskell.org Mon Feb 20 21:14:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:14:11 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: get working with both GHC 6.10 and 6.12 (f4a0fd3) Message-ID: <20170220211411.3BA2A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/f4a0fd3f8168c2ea9296eb96ec8acb1577be4561 >--------------------------------------------------------------- commit f4a0fd3f8168c2ea9296eb96ec8acb1577be4561 Author: Ashley Yakeley Date: Sun Apr 11 01:26:03 2010 -0700 get working with both GHC 6.10 and 6.12 Ignore-this: 700ee8cb739e67c438d40313d8e38378 darcs-hash:20100411082603-ac6dd-e5eaf0e878baa6b4348ccb11e1533d8279316952 >--------------------------------------------------------------- f4a0fd3f8168c2ea9296eb96ec8acb1577be4561 Data/Time/Calendar/Days.hs | 10 +++++----- Data/Time/Clock/Scale.hs | 17 ++++++++++------- Data/Time/Clock/TAI.hs | 12 +++++++----- Data/Time/Clock/UTC.hs | 18 +++++++++++------- Data/Time/Format/Parse.hs | 13 +++++++------ Data/Time/LocalTime/LocalTime.hs | 19 +++++++++++-------- Data/Time/LocalTime/TimeOfDay.hs | 12 +++++++----- Data/Time/LocalTime/TimeZone.hs | 10 +++++----- include/HsConfigure.h | 7 +++++++ time.cabal | 4 ++-- 10 files changed, 72 insertions(+), 50 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 f4a0fd3f8168c2ea9296eb96ec8acb1577be4561 From git at git.haskell.org Mon Feb 20 21:14:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:14:13 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: 1.2.0.1, include missing HsConfigure in sdist (bfa764f) Message-ID: <20170220211413.42EAE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/bfa764fe8086315833df9f74727951d7118e279d >--------------------------------------------------------------- commit bfa764fe8086315833df9f74727951d7118e279d Author: Ashley Yakeley Date: Sun Apr 11 13:35:07 2010 -0700 1.2.0.1, include missing HsConfigure in sdist Ignore-this: 78dfddb786e7c1103f1ea70a33a43683 darcs-hash:20100411203507-ac6dd-93f6581e5deec6bb709669222630b210dd3b2e55 >--------------------------------------------------------------- bfa764fe8086315833df9f74727951d7118e279d time.cabal | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/time.cabal b/time.cabal index 9b0d75e..22fa857 100644 --- a/time.cabal +++ b/time.cabal @@ -1,5 +1,5 @@ name: time -version: 1.2 +version: 1.2.0.1 stability: stable license: BSD3 license-file: LICENSE @@ -17,6 +17,7 @@ extra-source-files: aclocal.m4 configure.ac configure + include/HsConfigure.h include/HsTime.h include/HsTimeConfig.h.in extra-tmp-files: From git at git.haskell.org Mon Feb 20 21:14:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:14:15 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: include test files in package (5c73538) Message-ID: <20170220211415.49F683A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/5c73538f7d5ba0d850089b255360c5fb49f21ab7 >--------------------------------------------------------------- commit 5c73538f7d5ba0d850089b255360c5fb49f21ab7 Author: Ashley Yakeley Date: Mon Apr 26 23:55:11 2010 -0700 include test files in package Ignore-this: f13d5c23a548692e9700359316171b3f darcs-hash:20100427065511-ac6dd-0010c3787102b0df85f73274c78edf094d477936 >--------------------------------------------------------------- 5c73538f7d5ba0d850089b255360c5fb49f21ab7 time.cabal | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/time.cabal b/time.cabal index 22fa857..5db8d82 100644 --- a/time.cabal +++ b/time.cabal @@ -1,5 +1,5 @@ name: time -version: 1.2.0.1 +version: 1.2.0.2 stability: stable license: BSD3 license-file: LICENSE @@ -20,6 +20,13 @@ extra-source-files: include/HsConfigure.h include/HsTime.h include/HsTimeConfig.h.in + test/Makefile + test/*.hs + test/*.lhs + test/*.ref + test/*.dat + test/*.c + test/*.h extra-tmp-files: config.log config.status From git at git.haskell.org Mon Feb 20 21:14:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:14:19 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: set version to 1.2.1 (5c06110) Message-ID: <20170220211419.57F313A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/5c06110cf659ea939b3cf1649224ef461e66330f >--------------------------------------------------------------- commit 5c06110cf659ea939b3cf1649224ef461e66330f Author: Ashley Yakeley Date: Mon Jun 21 01:35:26 2010 -0700 set version to 1.2.1 Ignore-this: 91693f57fdce225a96d5464e6b2fea8 darcs-hash:20100621083526-ac6dd-f26575ae0f18ee7643bcd4db109d27b10d87657a >--------------------------------------------------------------- 5c06110cf659ea939b3cf1649224ef461e66330f configure.ac | 2 +- time.cabal | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 885bb01..9b071fd 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([Haskell time package], [1.1.2.3], [ashley at semantic.org], [time]) +AC_INIT([Haskell time package], [1.2.1], [ashley at semantic.org], [time]) # Safety check: Ensure that we are in the correct source directory. AC_CONFIG_SRCDIR([include/HsTime.h]) diff --git a/time.cabal b/time.cabal index 5db8d82..fff80ca 100644 --- a/time.cabal +++ b/time.cabal @@ -1,5 +1,5 @@ name: time -version: 1.2.0.2 +version: 1.2.1 stability: stable license: BSD3 license-file: LICENSE From git at git.haskell.org Mon Feb 20 21:14:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:14:17 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Fixed loss of accuracy in timeOfDayToDayFraction. (2677235) Message-ID: <20170220211417.50C803A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/2677235d39a575502782af06898f3b80ee8a460c >--------------------------------------------------------------- commit 2677235d39a575502782af06898f3b80ee8a460c Author: Bjorn Buckwalter Date: Mon Jun 21 01:04:47 2010 -0700 Fixed loss of accuracy in timeOfDayToDayFraction. Ignore-this: 4ba8be01f14c2838bede8c16866ad134 darcs-hash:20100621080447-6cbaf-00ccf839cf4be9821b7c2456a4d96e29ec5753ea >--------------------------------------------------------------- 2677235d39a575502782af06898f3b80ee8a460c Data/Time/LocalTime/TimeOfDay.hs | 2 +- test/TestTime.hs | 10 ++++++++++ test/TestTime.ref | 5 +++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Data/Time/LocalTime/TimeOfDay.hs b/Data/Time/LocalTime/TimeOfDay.hs index e7618e4..37b2079 100644 --- a/Data/Time/LocalTime/TimeOfDay.hs +++ b/Data/Time/LocalTime/TimeOfDay.hs @@ -93,4 +93,4 @@ dayFractionToTimeOfDay df = timeToTimeOfDay (realToFrac (df * 86400)) -- | Get the fraction of a day since midnight given a TimeOfDay. timeOfDayToDayFraction :: TimeOfDay -> Rational -timeOfDayToDayFraction tod = realToFrac (timeOfDayToTime tod / posixDayLength) +timeOfDayToDayFraction tod = realToFrac (timeOfDayToTime tod) / realToFrac posixDayLength diff --git a/test/TestTime.hs b/test/TestTime.hs index 159d001..5fb35c2 100644 --- a/test/TestTime.hs +++ b/test/TestTime.hs @@ -80,8 +80,18 @@ testUT1 = do putStrLn (show (ut1ToLocalTime poslong (ModJulianDate 51604.0))) putStrLn (show (ut1ToLocalTime poslong (ModJulianDate 51604.5))) +testTimeOfDayToDayFraction :: IO () +testTimeOfDayToDayFraction = do + putStrLn "" + let f = dayFractionToTimeOfDay . timeOfDayToDayFraction + putStrLn (show (f (TimeOfDay 12 34 56.789))) + putStrLn (show (f (TimeOfDay 12 34 56.789123))) + putStrLn (show (f (TimeOfDay 12 34 56.789123456))) + putStrLn (show (f (TimeOfDay 12 34 56.789123456789))) + main :: IO () main = do testCal testUTC testUT1 + testTimeOfDayToDayFraction diff --git a/test/TestTime.ref b/test/TestTime.ref index 00cb151..9f8dd39 100644 --- a/test/TestTime.ref +++ b/test/TestTime.ref @@ -867,3 +867,8 @@ 2000-03-01 04:00:00 2000-03-01 08:00:00 2000-03-01 20:00:00 + +12:34:56.789 +12:34:56.789123 +12:34:56.789123456 +12:34:56.789123456789 From git at git.haskell.org Mon Feb 20 21:14:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:14:21 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: version 1.2.0.3 is more appropriate than 1.2.1. (aeb4c0e) Message-ID: <20170220211421.5E10D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/aeb4c0ea777413874e3c84b7159f45f9a6d012b2 >--------------------------------------------------------------- commit aeb4c0ea777413874e3c84b7159f45f9a6d012b2 Author: Ashley Yakeley Date: Mon Jun 21 20:58:47 2010 -0700 version 1.2.0.3 is more appropriate than 1.2.1. Ignore-this: 9f96c2b5545fc859d43ae3bb1284860a darcs-hash:20100622035847-ac6dd-e660685ec54477b1d73da5e537b1fe36c632a584 >--------------------------------------------------------------- aeb4c0ea777413874e3c84b7159f45f9a6d012b2 configure.ac | 2 +- time.cabal | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 9b071fd..b04e8cd 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([Haskell time package], [1.2.1], [ashley at semantic.org], [time]) +AC_INIT([Haskell time package], [1.2.0.3], [ashley at semantic.org], [time]) # Safety check: Ensure that we are in the correct source directory. AC_CONFIG_SRCDIR([include/HsTime.h]) diff --git a/time.cabal b/time.cabal index fff80ca..3f88c02 100644 --- a/time.cabal +++ b/time.cabal @@ -1,5 +1,5 @@ name: time -version: 1.2.1 +version: 1.2.0.3 stability: stable license: BSD3 license-file: LICENSE From git at git.haskell.org Mon Feb 20 21:14:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:14:23 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: test says Success (f3d2c2a) Message-ID: <20170220211423.650263A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/f3d2c2af9a0319280a3ea7ccba31a28ee2e62001 >--------------------------------------------------------------- commit f3d2c2af9a0319280a3ea7ccba31a28ee2e62001 Author: Ashley Yakeley Date: Sun Jan 23 17:55:11 2011 -0800 test says Success Ignore-this: 91a0f645a63f9a42877122ae2121f59f darcs-hash:20110124015511-ac6dd-71e1db4e1a45886cdb5038dc5ed3d4995b01258f >--------------------------------------------------------------- f3d2c2af9a0319280a3ea7ccba31a28ee2e62001 test/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/test/Makefile b/test/Makefile index 307adcc..f97252e 100644 --- a/test/Makefile +++ b/test/Makefile @@ -66,6 +66,7 @@ test: \ TestEaster.diff \ # TestParseTime.run \ UseCases.o + @echo "Success!" clean: rm -rf TestMonthDay ConvertBack TestCalendars TestTime LongWeekYears ClipDates \ From git at git.haskell.org Mon Feb 20 21:14:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:14:25 +0000 (UTC) Subject: [commit: packages/time] format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis: fix parse "undefined" bug; added TestParseTime into tests (c5041a7) Message-ID: <20170220211425.6C8533A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/c5041a75c0c4ac903d4b6aa8ce4494b3fd75138b >--------------------------------------------------------------- commit c5041a75c0c4ac903d4b6aa8ce4494b3fd75138b Author: Ashley Yakeley Date: Wed Feb 2 21:32:19 2011 -0800 fix parse "undefined" bug; added TestParseTime into tests Ignore-this: aa74ebeef71272fda0a79962ed2e8f93 darcs-hash:20110203053219-ac6dd-38e9068fa7badb315aa19be8f1f77f75f06c03cc >--------------------------------------------------------------- c5041a75c0c4ac903d4b6aa8ce4494b3fd75138b Data/Time/Format.hs | 2 +- Data/Time/Format/Parse.hs | 7 ++++-- Makefile | 2 +- test/Makefile | 10 ++++---- test/TestFormat.hs | 59 +++++++++++++++++++++++++++++++++++++++++++++-- test/TestParseTime.hs | 42 +++++++++++++++++++++++---------- time.cabal | 2 +- 7 files changed, 99 insertions(+), 25 deletions(-) diff --git a/Data/Time/Format.hs b/Data/Time/Format.hs index 8d27f83..174bbea 100644 --- a/Data/Time/Format.hs +++ b/Data/Time/Format.hs @@ -55,7 +55,7 @@ formatChar c locale mpado t = case (formatCharacter c) of -- -- For 'TimeZone' (and 'ZonedTime' and 'UTCTime'): -- --- [@%z@] timezone offset on the format @-HHMM at . +-- [@%z@] timezone offset in the format @-HHMM at . -- -- [@%Z@] timezone name -- diff --git a/Data/Time/Format/Parse.hs b/Data/Time/Format/Parse.hs index 4fd2282..aa0b66d 100644 --- a/Data/Time/Format/Parse.hs +++ b/Data/Time/Format/Parse.hs @@ -179,10 +179,13 @@ parseValue l c = where oneOf = choice . map string digits n = count n (satisfy isDigit) - spdigits n = skipSpaces >> upTo n (satisfy isDigit) + spdigits n = skipSpaces >> oneUpTo n (satisfy isDigit) + oneUpTo :: Int -> ReadP a -> ReadP [a] + oneUpTo 0 _ = pfail + oneUpTo n x = liftM2 (:) x (upTo (n-1) x) upTo :: Int -> ReadP a -> ReadP [a] upTo 0 _ = return [] - upTo n x = liftM2 (:) x (upTo (n-1) x) <++ return [] + upTo n x = (oneUpTo n x) <++ return [] numericTZ = do s <- choice [char '+', char '-'] h <- digits 2 optional (char ':') diff --git a/Makefile b/Makefile index de4898f..a0b37a9 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -default: build +default: install # Building diff --git a/test/Makefile b/test/Makefile index f97252e..5c1487a 100644 --- a/test/Makefile +++ b/test/Makefile @@ -64,26 +64,27 @@ test: \ TestFormat.diff0 \ TestParseDAT.diff \ TestEaster.diff \ -# TestParseTime.run \ + TestParseTime.run \ UseCases.o @echo "Success!" clean: rm -rf TestMonthDay ConvertBack TestCalendars TestTime LongWeekYears ClipDates \ AddDays TestFormat TestParseDAT TestEaster CurrentTime ShowDST TimeZone TimeZone.ref TestParseTime \ - *.out *.o *.hi Makefile.bak + *.out *.run *.o *.hi Makefile.bak %.diff: %.ref %.out diff -u $^ %.diff0: %.out - echo -n | diff -u - $^ + diff -u /dev/null $^ %.out: % ./$< > $@ %.run: % ./$< + touch $@ %.hi: %.o @: @@ -98,6 +99,3 @@ FORCE: .SECONDARY: -# TestTime.o TestFormat.o CurrentTime.o ShowDST.o TimeZone.o: $(patsubst %.hs,%.hi,$(SRCS)) - -TestFixed.o: ../Data/Fixed.hi diff --git a/test/TestFormat.hs b/test/TestFormat.hs index bcc18d4..65ca575 100644 --- a/test/TestFormat.hs +++ b/test/TestFormat.hs @@ -9,6 +9,7 @@ import Data.Char import System.Locale import Foreign import Foreign.C +import Control.Exception; {- size_t format_time ( @@ -93,9 +94,63 @@ formats = ["%G-W%V-%u","%U-%w","%W-%u"] ++ (fmap (\char -> '%':char:[]) chars) hashformats :: [String] hashformats = (fmap (\char -> '%':'#':char:[]) chars) +somestrings :: [String] +somestrings = ["", " ", "-", "\n"] + +getBottom :: a -> IO (Maybe Control.Exception.SomeException); +getBottom a = Control.Exception.catch (seq a (return Nothing)) (return . Just); + +safeString :: String -> IO String +safeString s = do + msx <- getBottom s + case msx of + Just sx -> return (show sx) + Nothing -> case s of + (c:cc) -> do + mcx <- getBottom c + case mcx of + Just cx -> return (show cx) + Nothing -> do + ss <- safeString cc + return (c:ss) + [] -> return "" + +compareExpected :: (Eq t,Show t,ParseTime t) => String -> String -> String -> Maybe t -> IO () +compareExpected ts fmt str expected = let + found = parseTime defaultTimeLocale fmt str + in do + mex <- getBottom found + case mex of + Just ex -> putStrLn ("Exception with " ++ fmt ++ " for " ++ ts ++" " ++ (show str) ++ ": expected " ++ (show expected) ++ ", caught " ++ (show ex)) + Nothing -> if found == expected + then return () + else do + sf <- safeString (show found) + putStrLn ("Mismatch with " ++ fmt ++ " for " ++ ts ++" " ++ (show str) ++ ": expected " ++ (show expected) ++ ", found " ++ sf) + +class (ParseTime t) => TestParse t where + expectedParse :: String -> String -> Maybe t + expectedParse "%Z" str | all isSpace str = Just (buildTime defaultTimeLocale []) + expectedParse _ _ = Nothing + +instance TestParse Day +instance TestParse TimeOfDay +instance TestParse LocalTime +instance TestParse TimeZone +instance TestParse ZonedTime +instance TestParse UTCTime + +checkParse :: String -> String -> IO () +checkParse fmt str = do + compareExpected "Day" fmt str (expectedParse fmt str :: Maybe Day) + compareExpected "TimeOfDay" fmt str (expectedParse fmt str :: Maybe TimeOfDay) + compareExpected "LocalTime" fmt str (expectedParse fmt str :: Maybe LocalTime) + compareExpected "TimeZone" fmt str (expectedParse fmt str :: Maybe TimeZone) + compareExpected "UTCTime" fmt str (expectedParse fmt str :: Maybe UTCTime) main :: IO () -main = - mapM_ (\fmt -> mapM_ (\time -> mapM_ (\zone -> compareFormat id fmt zone time) zones) times) formats >> +main = do + mapM_ (\fmt -> mapM_ (checkParse fmt) somestrings) formats + mapM_ (\fmt -> mapM_ (\time -> mapM_ (\zone -> compareFormat id fmt zone time) zones) times) formats mapM_ (\fmt -> mapM_ (\time -> mapM_ (\zone -> compareFormat (fmap toLower) fmt zone time) zones) times) hashformats diff --git a/test/TestParseTime.hs b/test/TestParseTime.hs index b727f3f..37d13f6 100644 --- a/test/TestParseTime.hs +++ b/test/TestParseTime.hs @@ -8,7 +8,9 @@ import Data.Time.Calendar.OrdinalDate import Data.Time.Calendar.WeekDate import Data.Time.Clock.POSIX import System.Locale +import System.Exit import Test.QuickCheck +import Test.QuickCheck.Batch ntest :: Int @@ -16,19 +18,35 @@ ntest = 1000 main :: IO () main = do putStrLn "Should work:" - checkAll properties + good <- checkAll properties putStrLn "Known failures:" - checkAll knownFailures - -checkAll :: [NamedProperty] -> IO () -checkAll ps = mapM_ (checkOne config) ps - where config = defaultConfig { configMaxTest = ntest } - -checkOne :: Config -> NamedProperty -> IO () -checkOne config (n,p) = - do putStr (rpad 65 ' ' n) - check config p - where rpad n' c xs = xs ++ replicate (n' - length xs) c + _ <- checkAll knownFailures + exitWith (if good then ExitSuccess else ExitFailure 1) + + +checkAll :: [NamedProperty] -> IO Bool +checkAll ps = fmap and (mapM checkOne ps) + +trMessage :: TestResult -> String +trMessage (TestOk s _ _) = s +trMessage (TestExausted s i ss) = "Exhausted " ++ (show s) ++ " " ++ (show i) ++ " " ++ (show ss) +trMessage (TestFailed ss i) = "Failed " ++ (show ss) ++ " " ++ (show i) +trMessage (TestAborted ex) = "Aborted " ++ (show ex) + +trGood :: TestResult -> Bool +trGood (TestOk _ _ _) = True +trGood _ = False + +checkOne :: NamedProperty -> IO Bool +checkOne (n,p) = + do + putStr (rpad 65 ' ' n) + tr <- run p options + putStrLn (trMessage tr) + return (trGood tr) + where + rpad n' c xs = xs ++ replicate (n' - length xs) c + options = TestOptions {no_of_tests = 10000,length_of_tests = 0,debug_tests = False} parse :: ParseTime t => String -> String -> Maybe t diff --git a/time.cabal b/time.cabal index 3f88c02..2759127 100644 --- a/time.cabal +++ b/time.cabal @@ -1,5 +1,5 @@ name: time -version: 1.2.0.3 +version: 1.2.0.4 stability: stable license: BSD3 license-file: LICENSE From git at git.haskell.org Mon Feb 20 21:14:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:14:27 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: .run files are boring (ff06923) Message-ID: <20170220211427.73F843A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/ff069238035c36b43d10502a9a02cf10f9497c80 >--------------------------------------------------------------- commit ff069238035c36b43d10502a9a02cf10f9497c80 Author: Ashley Yakeley Date: Wed Feb 2 21:34:07 2011 -0800 .run files are boring Ignore-this: 7d76b141e01b923879e5e432d41b933c darcs-hash:20110203053407-ac6dd-f4ffed0f583b01ebeb95bc92770c60fab025d047 >--------------------------------------------------------------- ff069238035c36b43d10502a9a02cf10f9497c80 .darcs-boring | 1 + 1 file changed, 1 insertion(+) diff --git a/.darcs-boring b/.darcs-boring index 0b4f6cb..ca040f7 100644 --- a/.darcs-boring +++ b/.darcs-boring @@ -52,6 +52,7 @@ _split$ ^include/HsTimeConfig\.h$ ^include/HsTimeConfig\.h.in$ ^test/.*\.out$ +^test/.*\.run$ ^test/AddDays$ ^test/ClipDates$ ^test/ConvertBack$ From git at git.haskell.org Mon Feb 20 21:14:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:14:29 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: specify QuickCheck version (1c69e66) Message-ID: <20170220211429.7ADEA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/1c69e66cfbf65a7e224ef97023063b9c7d39e112 >--------------------------------------------------------------- commit 1c69e66cfbf65a7e224ef97023063b9c7d39e112 Author: Ashley Yakeley Date: Sat May 7 21:21:47 2011 -0700 specify QuickCheck version Ignore-this: b82b874985d6bc74cf6f7989f46f5a96 darcs-hash:20110508042147-ac6dd-0198670fb2c4e5ecc8e0ffa16dcc2b6618564ac7 >--------------------------------------------------------------- 1c69e66cfbf65a7e224ef97023063b9c7d39e112 test/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Makefile b/test/Makefile index 5c1487a..f8ef07d 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,5 +1,5 @@ GHC = ghc -GHCFLAGS = -package time +GHCFLAGS = -package time -package QuickCheck-1.2.0.1 default: make CurrentTime.run ShowDST.run test @@ -50,7 +50,7 @@ TimeZone.ref: FORCE date +%z > $@ TestParseTime: TestParseTime.o - $(GHC) $(GHCFLAGS) -package QuickCheck $^ -o $@ + $(GHC) $(GHCFLAGS) $^ -o $@ test: \ TestMonthDay.diff \ From git at git.haskell.org Mon Feb 20 21:14:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:14:31 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: test for %y parse to 1969 - 2068 (ac3fc0b) Message-ID: <20170220211431.8130C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/ac3fc0bf4d197ed82fdd6dff4383a07d8766d433 >--------------------------------------------------------------- commit ac3fc0bf4d197ed82fdd6dff4383a07d8766d433 Author: Ashley Yakeley Date: Sat May 7 21:22:16 2011 -0700 test for %y parse to 1969 - 2068 Ignore-this: ac903c931b2fe745f073a5cb474e9d95 darcs-hash:20110508042216-ac6dd-e6e305e2cb3804511eefdd74dc4b558fcfd00f51 >--------------------------------------------------------------- ac3fc0bf4d197ed82fdd6dff4383a07d8766d433 test/TestParseTime.hs | 54 ++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 43 insertions(+), 11 deletions(-) diff --git a/test/TestParseTime.hs b/test/TestParseTime.hs index 37d13f6..64a4504 100644 --- a/test/TestParseTime.hs +++ b/test/TestParseTime.hs @@ -1,8 +1,10 @@ {-# OPTIONS -Wall -Werror -fno-warn-type-defaults -fno-warn-unused-binds -fno-warn-orphans #-} +{-# LANGUAGE FlexibleInstances, ExistentialQuantification #-} import Control.Monad import Data.Char import Data.Ratio +import Data.Maybe import Data.Time import Data.Time.Calendar.OrdinalDate import Data.Time.Calendar.WeekDate @@ -13,18 +15,49 @@ import Test.QuickCheck import Test.QuickCheck.Batch +class RunTest p where + runTest :: p -> IO TestResult + +instance RunTest (IO TestResult) where + runTest iob = iob + +instance RunTest Property where + runTest p = run p (TestOptions {no_of_tests = 10000,length_of_tests = 0,debug_tests = False}) + +data ExhaustiveTest = forall t. (Show t) => MkExhaustiveTest [t] (t -> IO Bool) + +instance RunTest ExhaustiveTest where + runTest (MkExhaustiveTest cases f) = do + results <- mapM (\t -> do {b <- f t;return (b,show t)}) cases + let failures = mapMaybe (\(b,n) -> if b then Nothing else Just n) results + let fcount = length failures + return (if fcount == 0 then TestOk "OK" 0 [] else TestFailed failures fcount) + ntest :: Int ntest = 1000 main :: IO () -main = do putStrLn "Should work:" - good <- checkAll properties - putStrLn "Known failures:" - _ <- checkAll knownFailures - exitWith (if good then ExitSuccess else ExitFailure 1) - - -checkAll :: [NamedProperty] -> IO Bool +main = do + putStrLn "Should work:" + good1 <- checkAll extests + putStrLn "Should work:" + good2 <- checkAll properties + putStrLn "Known failures:" + _ <- checkAll knownFailures + exitWith (if good1 && good2 then ExitSuccess else ExitFailure 1) + +extests :: [(String,ExhaustiveTest)] +extests = [("parse %y",MkExhaustiveTest [0..99] parseYY)] + +-- | 1969 - 2068 +expectedYear :: Integer -> Integer +expectedYear i | i >= 69 = 1900 + i +expectedYear i = 2000 + i + +parseYY :: Integer -> IO Bool +parseYY i = return (parse "%y" ((show (div i 10)) ++ (show (mod i 10))) == Just (fromGregorian (expectedYear i) 1 1)) + +checkAll :: RunTest p => [(String,p)] -> IO Bool checkAll ps = fmap and (mapM checkOne ps) trMessage :: TestResult -> String @@ -37,16 +70,15 @@ trGood :: TestResult -> Bool trGood (TestOk _ _ _) = True trGood _ = False -checkOne :: NamedProperty -> IO Bool +checkOne :: RunTest p => (String,p) -> IO Bool checkOne (n,p) = do putStr (rpad 65 ' ' n) - tr <- run p options + tr <- runTest p putStrLn (trMessage tr) return (trGood tr) where rpad n' c xs = xs ++ replicate (n' - length xs) c - options = TestOptions {no_of_tests = 10000,length_of_tests = 0,debug_tests = False} parse :: ParseTime t => String -> String -> Maybe t From git at git.haskell.org Mon Feb 20 21:14:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:14:33 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: test parse %C %y (c3d1c28) Message-ID: <20170220211433.882A93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/c3d1c2821373e6dbc62923ab74d89c4a6b1b0b18 >--------------------------------------------------------------- commit c3d1c2821373e6dbc62923ab74d89c4a6b1b0b18 Author: Ashley Yakeley Date: Sat May 7 21:29:05 2011 -0700 test parse %C %y Ignore-this: 22f6db0e1424c95dece1fdf7740d982e darcs-hash:20110508042905-ac6dd-5026d47053631acb8848806368fb17bbf8bc9837 >--------------------------------------------------------------- c3d1c2821373e6dbc62923ab74d89c4a6b1b0b18 test/TestParseTime.hs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/test/TestParseTime.hs b/test/TestParseTime.hs index 64a4504..5594f34 100644 --- a/test/TestParseTime.hs +++ b/test/TestParseTime.hs @@ -47,15 +47,27 @@ main = do exitWith (if good1 && good2 then ExitSuccess else ExitFailure 1) extests :: [(String,ExhaustiveTest)] -extests = [("parse %y",MkExhaustiveTest [0..99] parseYY)] +extests = [ + ("parse %y",MkExhaustiveTest [0..99] parseYY), + ("parse %C %y 1900s",MkExhaustiveTest [0..99] (parseCYY 19)), + ("parse %C %y 2000s",MkExhaustiveTest [0..99] (parseCYY 20)), + ("parse %C %y 1400s",MkExhaustiveTest [0..99] (parseCYY 14)), + ("parse %C %y 700s",MkExhaustiveTest [0..99] (parseCYY 7)) + ] -- | 1969 - 2068 expectedYear :: Integer -> Integer expectedYear i | i >= 69 = 1900 + i expectedYear i = 2000 + i +show2 :: Integer -> String +show2 i = (show (div i 10)) ++ (show (mod i 10)) + parseYY :: Integer -> IO Bool -parseYY i = return (parse "%y" ((show (div i 10)) ++ (show (mod i 10))) == Just (fromGregorian (expectedYear i) 1 1)) +parseYY i = return (parse "%y" (show2 i) == Just (fromGregorian (expectedYear i) 1 1)) + +parseCYY :: Integer -> Integer -> IO Bool +parseCYY c i = return (parse "%C %y" ((show2 c) ++ " " ++ (show2 i)) == Just (fromGregorian ((c * 100) + i) 1 1)) checkAll :: RunTest p => [(String,p)] -> IO Bool checkAll ps = fmap and (mapM checkOne ps) From git at git.haskell.org Mon Feb 20 21:14:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:14:37 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: test for parse %m single digit (3dd4c2c) Message-ID: <20170220211437.95BC33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/3dd4c2cab3b79fb33933f5d64108e474de3f1a06 >--------------------------------------------------------------- commit 3dd4c2cab3b79fb33933f5d64108e474de3f1a06 Author: Ashley Yakeley Date: Sat May 7 22:16:09 2011 -0700 test for parse %m single digit Ignore-this: a79ecf3b70510657aca907e78c70f012 darcs-hash:20110508051609-ac6dd-9ad32ef4836008a307a1de03594d405fd79daec3 >--------------------------------------------------------------- 3dd4c2cab3b79fb33933f5d64108e474de3f1a06 test/TestParseTime.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/TestParseTime.hs b/test/TestParseTime.hs index 5594f34..c8eabd2 100644 --- a/test/TestParseTime.hs +++ b/test/TestParseTime.hs @@ -52,9 +52,14 @@ extests = [ ("parse %C %y 1900s",MkExhaustiveTest [0..99] (parseCYY 19)), ("parse %C %y 2000s",MkExhaustiveTest [0..99] (parseCYY 20)), ("parse %C %y 1400s",MkExhaustiveTest [0..99] (parseCYY 14)), - ("parse %C %y 700s",MkExhaustiveTest [0..99] (parseCYY 7)) + ("parse %C %y 700s",MkExhaustiveTest [0..99] (parseCYY 7)), + ("parseYearDay",MkExhaustiveTest [(fromGregorian 2011 1 1) .. (fromGregorian 2011 12 31)] parseYearDay) ] +parseYearDay :: Day -> IO Bool +parseYearDay day = case toGregorian day of + (y,m,d) -> return $ (parse "%Y %m %e" ((show y) ++ " " ++ (show m) ++ " " ++ (show d))) == Just day + -- | 1969 - 2068 expectedYear :: Integer -> Integer expectedYear i | i >= 69 = 1900 + i From git at git.haskell.org Mon Feb 20 21:14:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:14:35 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: parse %y range 1969 - 2068, bug #2671 (84f1505) Message-ID: <20170220211435.8F66A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/84f1505205d9edfce0315fe18cba3fa506554a85 >--------------------------------------------------------------- commit 84f1505205d9edfce0315fe18cba3fa506554a85 Author: Ashley Yakeley Date: Sat May 7 21:36:17 2011 -0700 parse %y range 1969 - 2068, bug #2671 Ignore-this: 30d5c56ed53c337433764e109aaa5ac4 darcs-hash:20110508043617-ac6dd-8e192552d6fd229ccc824600cba2bb74170ebd6a >--------------------------------------------------------------- 84f1505205d9edfce0315fe18cba3fa506554a85 Data/Time/Format/Parse.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Data/Time/Format/Parse.hs b/Data/Time/Format/Parse.hs index aa0b66d..135fc01 100644 --- a/Data/Time/Format/Parse.hs +++ b/Data/Time/Format/Parse.hs @@ -254,8 +254,9 @@ instance ParseTime Day where buildDay cs = rest cs where - y = let c = safeLast 19 [x | Century x <- cs] + y = let d = safeLast 70 [x | Year x <- cs] + c = safeLast (if d >= 69 then 19 else 20) [x | Century x <- cs] in 100 * c + d rest (Month m:_) = let d = safeLast 1 [x | Day x <- cs] From git at git.haskell.org Mon Feb 20 21:14:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:14:41 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: test parse %-m single digit (7cef519) Message-ID: <20170220211441.A37523A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/7cef51954de82636ac53c25858531569c0fbebbe >--------------------------------------------------------------- commit 7cef51954de82636ac53c25858531569c0fbebbe Author: Ashley Yakeley Date: Sat May 7 22:31:58 2011 -0700 test parse %-m single digit Ignore-this: 32fc454ea7f34c9985e4d2cab174021 darcs-hash:20110508053158-ac6dd-3c4acb3124184955ea67bc432067ec40d11558a8 >--------------------------------------------------------------- 7cef51954de82636ac53c25858531569c0fbebbe test/TestParseTime.hs | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/test/TestParseTime.hs b/test/TestParseTime.hs index 1d2d1c2..a8b3832 100644 --- a/test/TestParseTime.hs +++ b/test/TestParseTime.hs @@ -56,27 +56,22 @@ extests = [ ("parse %C %y 2000s",MkExhaustiveTest [0..99] (parseCYY 20)), ("parse %C %y 1400s",MkExhaustiveTest [0..99] (parseCYY 14)), ("parse %C %y 700s",MkExhaustiveTest [0..99] (parseCYY 7)), - ("parseYearDay %Y %m %d",MkExhaustiveTest days2011 parseYearDayD), - ("parseYearDay %Y %m %d 0-pad",MkExhaustiveTest days2011 parseYearDayD2), - ("parseYearDay %Y %m %e",MkExhaustiveTest days2011 parseYearDayE), - ("parseYearDay %Y %m %e 0-pad",MkExhaustiveTest days2011 parseYearDayE2) + ("parse %Y%m%d",MkExhaustiveTest days2011 parseYMD), + ("parse %Y %m %d",MkExhaustiveTest days2011 parseYearDayD), + ("parse %Y %-m %e",MkExhaustiveTest days2011 parseYearDayE) ] +parseYMD :: Day -> IO Bool +parseYMD day = case toGregorian day of + (y,m,d) -> return $ (parse "%Y%m%d" ((show y) ++ (show2 m) ++ (show2 d))) == Just day + parseYearDayD :: Day -> IO Bool parseYearDayD day = case toGregorian day of - (y,m,d) -> return $ (parse "%Y %m %d" ((show y) ++ " " ++ (show m) ++ " " ++ (show d))) == Just day - -parseYearDayD2 :: Day -> IO Bool -parseYearDayD2 day = case toGregorian day of (y,m,d) -> return $ (parse "%Y %m %d" ((show y) ++ " " ++ (show2 m) ++ " " ++ (show2 d))) == Just day parseYearDayE :: Day -> IO Bool parseYearDayE day = case toGregorian day of - (y,m,d) -> return $ (parse "%Y %m %e" ((show y) ++ " " ++ (show m) ++ " " ++ (show d))) == Just day - -parseYearDayE2 :: Day -> IO Bool -parseYearDayE2 day = case toGregorian day of - (y,m,d) -> return $ (parse "%Y %m %e" ((show y) ++ " " ++ (show2 m) ++ " " ++ (show2 d))) == Just day + (y,m,d) -> return $ (parse "%Y %-m %e" ((show y) ++ " " ++ (show m) ++ " " ++ (show d))) == Just day -- | 1969 - 2068 expectedYear :: Integer -> Integer From git at git.haskell.org Mon Feb 20 21:14:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:14:39 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: test parse %d %e single digit (8028949) Message-ID: <20170220211439.9C7183A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/802894907b34d4f3979ea2a88d0393c7d404e9ec >--------------------------------------------------------------- commit 802894907b34d4f3979ea2a88d0393c7d404e9ec Author: Ashley Yakeley Date: Sat May 7 22:21:09 2011 -0700 test parse %d %e single digit Ignore-this: 81b90faa6de38d80462fc534b5e0f101 darcs-hash:20110508052109-ac6dd-6c9689e1cf5500fb02b7172ba2e6dd731a81f1b9 >--------------------------------------------------------------- 802894907b34d4f3979ea2a88d0393c7d404e9ec test/TestParseTime.hs | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/test/TestParseTime.hs b/test/TestParseTime.hs index c8eabd2..1d2d1c2 100644 --- a/test/TestParseTime.hs +++ b/test/TestParseTime.hs @@ -46,6 +46,9 @@ main = do _ <- checkAll knownFailures exitWith (if good1 && good2 then ExitSuccess else ExitFailure 1) +days2011 :: [Day] +days2011 = [(fromGregorian 2011 1 1) .. (fromGregorian 2011 12 31)] + extests :: [(String,ExhaustiveTest)] extests = [ ("parse %y",MkExhaustiveTest [0..99] parseYY), @@ -53,19 +56,34 @@ extests = [ ("parse %C %y 2000s",MkExhaustiveTest [0..99] (parseCYY 20)), ("parse %C %y 1400s",MkExhaustiveTest [0..99] (parseCYY 14)), ("parse %C %y 700s",MkExhaustiveTest [0..99] (parseCYY 7)), - ("parseYearDay",MkExhaustiveTest [(fromGregorian 2011 1 1) .. (fromGregorian 2011 12 31)] parseYearDay) + ("parseYearDay %Y %m %d",MkExhaustiveTest days2011 parseYearDayD), + ("parseYearDay %Y %m %d 0-pad",MkExhaustiveTest days2011 parseYearDayD2), + ("parseYearDay %Y %m %e",MkExhaustiveTest days2011 parseYearDayE), + ("parseYearDay %Y %m %e 0-pad",MkExhaustiveTest days2011 parseYearDayE2) ] -parseYearDay :: Day -> IO Bool -parseYearDay day = case toGregorian day of +parseYearDayD :: Day -> IO Bool +parseYearDayD day = case toGregorian day of + (y,m,d) -> return $ (parse "%Y %m %d" ((show y) ++ " " ++ (show m) ++ " " ++ (show d))) == Just day + +parseYearDayD2 :: Day -> IO Bool +parseYearDayD2 day = case toGregorian day of + (y,m,d) -> return $ (parse "%Y %m %d" ((show y) ++ " " ++ (show2 m) ++ " " ++ (show2 d))) == Just day + +parseYearDayE :: Day -> IO Bool +parseYearDayE day = case toGregorian day of (y,m,d) -> return $ (parse "%Y %m %e" ((show y) ++ " " ++ (show m) ++ " " ++ (show d))) == Just day +parseYearDayE2 :: Day -> IO Bool +parseYearDayE2 day = case toGregorian day of + (y,m,d) -> return $ (parse "%Y %m %e" ((show y) ++ " " ++ (show2 m) ++ " " ++ (show2 d))) == Just day + -- | 1969 - 2068 expectedYear :: Integer -> Integer expectedYear i | i >= 69 = 1900 + i expectedYear i = 2000 + i -show2 :: Integer -> String +show2 :: (Integral n) => n -> String show2 i = (show (div i 10)) ++ (show (mod i 10)) parseYY :: Integer -> IO Bool From git at git.haskell.org Mon Feb 20 21:14:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:14:43 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: allow - _ 0 modifiers in % parsing (b2902c9) Message-ID: <20170220211443.AA2683A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/b2902c953cbe901a755539cdde45458d6b623c74 >--------------------------------------------------------------- commit b2902c953cbe901a755539cdde45458d6b623c74 Author: Ashley Yakeley Date: Sat May 7 22:57:59 2011 -0700 allow - _ 0 modifiers in % parsing Ignore-this: 275981732f80ca7fd14bf2a33a578632 darcs-hash:20110508055759-ac6dd-aff88a854a40ff2ad6e168ed5c719bdf55b72d31 >--------------------------------------------------------------- b2902c953cbe901a755539cdde45458d6b623c74 Data/Time/Format/Parse.hs | 89 +++++++++++++++++++++++++---------------------- test/TestFormat.hs | 3 ++ 2 files changed, 51 insertions(+), 41 deletions(-) diff --git a/Data/Time/Format/Parse.hs b/Data/Time/Format/Parse.hs index 135fc01..b8855c1 100644 --- a/Data/Time/Format/Parse.hs +++ b/Data/Time/Format/Parse.hs @@ -104,9 +104,12 @@ readsTime l f = readP_to_S (liftM (buildTime l) r) -- * Internals -- +data Padding = NoPadding | SpacePadding | ZeroPadding + deriving Show + type DateFormat = [DateFormatSpec] -data DateFormatSpec = Value Char +data DateFormatSpec = Value (Maybe Padding) Char | WhiteSpace | Literal Char deriving Show @@ -114,31 +117,33 @@ data DateFormatSpec = Value Char parseFormat :: TimeLocale -> String -> DateFormat parseFormat l = p where p "" = [] - p ('%': c :cs) = s ++ p cs - where s = case c of - 'c' -> p (dateTimeFmt l) - 'R' -> p "%H:%M" - 'T' -> p "%H:%M:%S" - 'X' -> p (timeFmt l) - 'r' -> p (time12Fmt l) - 'D' -> p "%m/%d/%y" - 'F' -> p "%Y-%m-%d" - 'x' -> p (dateFmt l) - 'h' -> p "%b" - '%' -> [Literal '%'] - _ -> [Value c] + p ('%': '-' : c :cs) = (pc (Just NoPadding) c) ++ p cs + p ('%': '_' : c :cs) = (pc (Just SpacePadding) c) ++ p cs + p ('%': '0' : c :cs) = (pc (Just ZeroPadding) c) ++ p cs + p ('%': c :cs) = (pc Nothing c) ++ p cs p (c:cs) | isSpace c = WhiteSpace : p cs p (c:cs) = Literal c : p cs + pc _ 'c' = p (dateTimeFmt l) + pc _ 'R' = p "%H:%M" + pc _ 'T' = p "%H:%M:%S" + pc _ 'X' = p (timeFmt l) + pc _ 'r' = p (time12Fmt l) + pc _ 'D' = p "%m/%d/%y" + pc _ 'F' = p "%Y-%m-%d" + pc _ 'x' = p (dateFmt l) + pc _ 'h' = p "%b" + pc _ '%' = [Literal '%'] + pc mpad c = [Value mpad c] parseInput :: TimeLocale -> DateFormat -> ReadP [(Char,String)] parseInput l = liftM catMaybes . mapM p - where p (Value c) = parseValue l c >>= return . Just . (,) c + where p (Value mpad c) = parseValue l mpad c >>= return . Just . (,) c p WhiteSpace = skipSpaces >> return Nothing p (Literal c) = char c >> return Nothing -- | Get the string corresponding to the given format specifier. -parseValue :: TimeLocale -> Char -> ReadP String -parseValue l c = +parseValue :: TimeLocale -> Maybe Padding -> Char -> ReadP String +parseValue l mpad c = case c of 'z' -> numericTZ 'Z' -> munch1 isAlpha <++ @@ -146,40 +151,42 @@ parseValue l c = return "" -- produced by %Z for LocalTime 'P' -> oneOf (let (am,pm) = amPm l in [am, pm]) 'p' -> oneOf (let (am,pm) = amPm l in [am, pm]) - 'H' -> digits 2 - 'I' -> digits 2 - 'k' -> spdigits 2 - 'l' -> spdigits 2 - 'M' -> digits 2 - 'S' -> digits 2 - 'q' -> digits 12 + 'H' -> digits ZeroPadding 2 + 'I' -> digits ZeroPadding 2 + 'k' -> digits NoPadding 2 + 'l' -> digits NoPadding 2 + 'M' -> digits ZeroPadding 2 + 'S' -> digits ZeroPadding 2 + 'q' -> digits ZeroPadding 12 'Q' -> liftM2 (:) (char '.') (munch isDigit) <++ return "" 's' -> (char '-' >> liftM ('-':) (munch1 isDigit)) <++ munch1 isDigit - 'Y' -> digits 4 - 'y' -> digits 2 - 'C' -> digits 2 + 'Y' -> digits ZeroPadding 4 + 'y' -> digits ZeroPadding 2 + 'C' -> digits ZeroPadding 2 'B' -> oneOf (map fst (months l)) 'b' -> oneOf (map snd (months l)) - 'm' -> digits 2 - 'd' -> digits 2 - 'e' -> spdigits 2 - 'j' -> digits 3 - 'G' -> digits 4 - 'g' -> digits 2 - 'f' -> digits 2 - 'V' -> digits 2 + 'm' -> digits ZeroPadding 2 + 'd' -> digits ZeroPadding 2 + 'e' -> digits NoPadding 2 + 'j' -> digits ZeroPadding 3 + 'G' -> digits ZeroPadding 4 + 'g' -> digits ZeroPadding 2 + 'f' -> digits ZeroPadding 2 + 'V' -> digits ZeroPadding 2 'u' -> oneOf $ map (:[]) ['1'..'7'] 'a' -> oneOf (map snd (wDays l)) 'A' -> oneOf (map fst (wDays l)) - 'U' -> digits 2 + 'U' -> digits ZeroPadding 2 'w' -> oneOf $ map (:[]) ['0'..'6'] - 'W' -> digits 2 + 'W' -> digits ZeroPadding 2 _ -> fail $ "Unknown format character: " ++ show c where oneOf = choice . map string - digits n = count n (satisfy isDigit) - spdigits n = skipSpaces >> oneUpTo n (satisfy isDigit) + digitsforce ZeroPadding n = count n (satisfy isDigit) + digitsforce SpacePadding n = skipSpaces >> oneUpTo n (satisfy isDigit) + digitsforce NoPadding n = skipSpaces >> oneUpTo n (satisfy isDigit) + digits pad = digitsforce (fromMaybe pad mpad) oneUpTo :: Int -> ReadP a -> ReadP [a] oneUpTo 0 _ = pfail oneUpTo n x = liftM2 (:) x (upTo (n-1) x) @@ -187,9 +194,9 @@ parseValue l c = upTo 0 _ = return [] upTo n x = (oneUpTo n x) <++ return [] numericTZ = do s <- choice [char '+', char '-'] - h <- digits 2 + h <- digitsforce ZeroPadding 2 optional (char ':') - m <- digits 2 + m <- digitsforce ZeroPadding 2 return (s:h++m) #endif diff --git a/test/TestFormat.hs b/test/TestFormat.hs index 65ca575..19173b6 100644 --- a/test/TestFormat.hs +++ b/test/TestFormat.hs @@ -131,6 +131,9 @@ compareExpected ts fmt str expected = let class (ParseTime t) => TestParse t where expectedParse :: String -> String -> Maybe t expectedParse "%Z" str | all isSpace str = Just (buildTime defaultTimeLocale []) + expectedParse "%_Z" str | all isSpace str = Just (buildTime defaultTimeLocale []) + expectedParse "%-Z" str | all isSpace str = Just (buildTime defaultTimeLocale []) + expectedParse "%0Z" str | all isSpace str = Just (buildTime defaultTimeLocale []) expectedParse _ _ = Nothing instance TestParse Day From git at git.haskell.org Mon Feb 20 21:14:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:14:45 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: version 1.2.0.5 (c8c840a) Message-ID: <20170220211445.B0E233A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/c8c840a328c38acc6a2f243832e474715d4d1568 >--------------------------------------------------------------- commit c8c840a328c38acc6a2f243832e474715d4d1568 Author: Ashley Yakeley Date: Tue May 10 23:34:37 2011 -0700 version 1.2.0.5 Ignore-this: 3def541a0b608a54c482ada9b0ab89ff darcs-hash:20110511063437-ac6dd-fd171d1311e7e6247158b5b132abffb0cc088948 >--------------------------------------------------------------- c8c840a328c38acc6a2f243832e474715d4d1568 time.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/time.cabal b/time.cabal index 2759127..5ca5557 100644 --- a/time.cabal +++ b/time.cabal @@ -1,5 +1,5 @@ name: time -version: 1.2.0.4 +version: 1.2.0.5 stability: stable license: BSD3 license-file: LICENSE From git at git.haskell.org Mon Feb 20 21:14:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:14:47 +0000 (UTC) Subject: [commit: packages/time] format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis: correct padding in parse; doc (83ec536) Message-ID: <20170220211447.B7D0A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/83ec536b75b3bd342ee273a7db061d35830afc32 >--------------------------------------------------------------- commit 83ec536b75b3bd342ee273a7db061d35830afc32 Author: Ashley Yakeley Date: Wed May 11 00:40:32 2011 -0700 correct padding in parse; doc Ignore-this: b922ed3e94021edde3d9d78bdb9844b2 darcs-hash:20110511074032-ac6dd-51fd06ffe64b8c2c3b836ebc511b990c1d9a0662 >--------------------------------------------------------------- 83ec536b75b3bd342ee273a7db061d35830afc32 Data/Time/Format/Parse.hs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Data/Time/Format/Parse.hs b/Data/Time/Format/Parse.hs index b8855c1..aaf7029 100644 --- a/Data/Time/Format/Parse.hs +++ b/Data/Time/Format/Parse.hs @@ -55,20 +55,21 @@ class ParseTime t where -- If the input does not include all the information needed to -- construct a complete value, any missing parts should be taken -- from 1970-01-01 00:00:00 +0000 (which was a Thursday). + -- In the absence of @%C@ or @%Y@, century is 1969 - 2068. buildTime :: TimeLocale -- ^ The time locale. -> [(Char,String)] -- ^ Pairs of format characters and the -- corresponding part of the input. -> t #if LANGUAGE_Rank2Types --- | Parses a time value given a format string. Supports the same %-codes as --- 'formatTime'. Leading and trailing whitespace is accepted. Case is not --- significant. Some variations in the input are accepted: +-- | Parses a time value given a format string. +-- Supports the same %-codes as 'formatTime', including @%-@, @%_@ and @%0@ modifiers. +-- Leading and trailing whitespace is accepted. Case is not significant. +-- Some variations in the input are accepted: -- -- [@%z@] accepts any of @-HHMM@ or @-HH:MM at . -- --- [@%Z@] accepts any string of letters, or any --- of the formats accepted by @%z at . +-- [@%Z@] accepts any string of letters, or any of the formats accepted by @%z at . -- parseTime :: ParseTime t => TimeLocale -- ^ Time locale. @@ -153,8 +154,8 @@ parseValue l mpad c = 'p' -> oneOf (let (am,pm) = amPm l in [am, pm]) 'H' -> digits ZeroPadding 2 'I' -> digits ZeroPadding 2 - 'k' -> digits NoPadding 2 - 'l' -> digits NoPadding 2 + 'k' -> digits SpacePadding 2 + 'l' -> digits SpacePadding 2 'M' -> digits ZeroPadding 2 'S' -> digits ZeroPadding 2 'q' -> digits ZeroPadding 12 @@ -168,7 +169,7 @@ parseValue l mpad c = 'b' -> oneOf (map snd (months l)) 'm' -> digits ZeroPadding 2 'd' -> digits ZeroPadding 2 - 'e' -> digits NoPadding 2 + 'e' -> digits SpacePadding 2 'j' -> digits ZeroPadding 3 'G' -> digits ZeroPadding 4 'g' -> digits ZeroPadding 2 @@ -185,7 +186,7 @@ parseValue l mpad c = oneOf = choice . map string digitsforce ZeroPadding n = count n (satisfy isDigit) digitsforce SpacePadding n = skipSpaces >> oneUpTo n (satisfy isDigit) - digitsforce NoPadding n = skipSpaces >> oneUpTo n (satisfy isDigit) + digitsforce NoPadding n = oneUpTo n (satisfy isDigit) digits pad = digitsforce (fromMaybe pad mpad) oneUpTo :: Int -> ReadP a -> ReadP [a] oneUpTo 0 _ = pfail From git at git.haskell.org Mon Feb 20 21:14:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:14:49 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: version 1.3: instance RealFrac DiffTime (234e6ce) Message-ID: <20170220211449.BE90F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/234e6cef3c5ade6b46b7a55a90c12247d918bf0a >--------------------------------------------------------------- commit 234e6cef3c5ade6b46b7a55a90c12247d918bf0a Author: Ashley Yakeley Date: Tue Aug 9 19:12:09 2011 -0700 version 1.3: instance RealFrac DiffTime Ignore-this: db3b670e3c17170909ab4c5b34b83716 darcs-hash:20110810021209-ac6dd-915d3dcb3b6e543f834c997820182d669e7bb2ac >--------------------------------------------------------------- 234e6cef3c5ade6b46b7a55a90c12247d918bf0a Data/Time/Clock/Scale.hs | 8 ++++++++ configure.ac | 2 +- time.cabal | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Data/Time/Clock/Scale.hs b/Data/Time/Clock/Scale.hs index f07fd64..fb67cc5 100644 --- a/Data/Time/Clock/Scale.hs +++ b/Data/Time/Clock/Scale.hs @@ -83,6 +83,14 @@ instance Fractional DiffTime where recip (MkDiffTime a) = MkDiffTime (recip a) fromRational r = MkDiffTime (fromRational r) +-- necessary because H98 doesn't have "cunning newtype" derivation +instance RealFrac DiffTime where + properFraction (MkDiffTime a) = let (b',a') = properFraction a in (b',MkDiffTime a') + truncate (MkDiffTime a) = truncate a + round (MkDiffTime a) = round a + ceiling (MkDiffTime a) = ceiling a + floor (MkDiffTime a) = floor a + -- | Create a 'DiffTime' which represents an integral number of seconds. secondsToDiffTime :: Integer -> DiffTime secondsToDiffTime = fromInteger diff --git a/configure.ac b/configure.ac index b04e8cd..dc58c49 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([Haskell time package], [1.2.0.3], [ashley at semantic.org], [time]) +AC_INIT([Haskell time package], [1.3], [ashley at semantic.org], [time]) # Safety check: Ensure that we are in the correct source directory. AC_CONFIG_SRCDIR([include/HsTime.h]) diff --git a/time.cabal b/time.cabal index 5ca5557..21bf3e4 100644 --- a/time.cabal +++ b/time.cabal @@ -1,5 +1,5 @@ name: time -version: 1.2.0.5 +version: 1.3 stability: stable license: BSD3 license-file: LICENSE From git at git.haskell.org Mon Feb 20 21:14:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:14:51 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: NFData instances, contributed by Herbert Valerio Riedel (4466857) Message-ID: <20170220211451.C57823A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/4466857c177c0315e8400fe7d64b930d52e12ce1 >--------------------------------------------------------------- commit 4466857c177c0315e8400fe7d64b930d52e12ce1 Author: Ashley Yakeley Date: Mon Sep 12 03:08:07 2011 -0700 NFData instances, contributed by Herbert Valerio Riedel Ignore-this: 5279778ec762aa123b8ff68f417d5353 darcs-hash:20110912100807-ac6dd-182208624a89df2741cdc147aa1f6255cf35ee9d >--------------------------------------------------------------- 4466857c177c0315e8400fe7d64b930d52e12ce1 Data/Time/Calendar/Days.hs | 4 ++++ Data/Time/Clock/Scale.hs | 8 ++++++++ Data/Time/Clock/TAI.hs | 4 ++++ Data/Time/Clock/UTC.hs | 7 +++++++ Data/Time/LocalTime/LocalTime.hs | 7 +++++++ Data/Time/LocalTime/TimeOfDay.hs | 4 ++++ Data/Time/LocalTime/TimeZone.hs | 4 ++++ time.cabal | 4 ++-- 8 files changed, 40 insertions(+), 2 deletions(-) diff --git a/Data/Time/Calendar/Days.hs b/Data/Time/Calendar/Days.hs index bd2be33..c09a273 100644 --- a/Data/Time/Calendar/Days.hs +++ b/Data/Time/Calendar/Days.hs @@ -7,6 +7,7 @@ module Data.Time.Calendar.Days Day(..),addDays,diffDays ) where +import Control.DeepSeq import Data.Ix import Data.Typeable #if LANGUAGE_Rank2Types @@ -22,6 +23,9 @@ newtype Day = ModifiedJulianDay {toModifiedJulianDay :: Integer} deriving (Eq,Or #endif ) +instance NFData Day where + rnf (ModifiedJulianDay a) = rnf a + instance Typeable Day where typeOf _ = mkTyConApp (mkTyCon "Data.Time.Calendar.Days.Day") [] diff --git a/Data/Time/Clock/Scale.hs b/Data/Time/Clock/Scale.hs index fb67cc5..37c3f32 100644 --- a/Data/Time/Clock/Scale.hs +++ b/Data/Time/Clock/Scale.hs @@ -12,6 +12,7 @@ module Data.Time.Clock.Scale secondsToDiffTime, picosecondsToDiffTime ) where +import Control.DeepSeq import Data.Ratio ((%)) import Data.Fixed import Data.Typeable @@ -29,6 +30,10 @@ newtype UniversalTime = ModJulianDate {getModJulianDate :: Rational} deriving (E #endif ) +-- necessary because H98 doesn't have "cunning newtype" derivation +instance NFData UniversalTime where + rnf (ModJulianDate a) = rnf a + instance Typeable UniversalTime where typeOf _ = mkTyConApp (mkTyCon "Data.Time.Clock.Scale.UniversalTime") [] @@ -46,6 +51,9 @@ newtype DiffTime = MkDiffTime Pico deriving (Eq,Ord #endif ) +-- necessary because H98 doesn't have "cunning newtype" derivation +instance NFData DiffTime -- FIXME: Data.Fixed had no NFData instances yet at time of writing + instance Typeable DiffTime where typeOf _ = mkTyConApp (mkTyCon "Data.Time.Clock.Scale.DiffTime") [] diff --git a/Data/Time/Clock/TAI.hs b/Data/Time/Clock/TAI.hs index 946e4ca..77c2134 100644 --- a/Data/Time/Clock/TAI.hs +++ b/Data/Time/Clock/TAI.hs @@ -18,6 +18,7 @@ module Data.Time.Clock.TAI import Data.Time.LocalTime import Data.Time.Calendar.Days import Data.Time.Clock +import Control.DeepSeq import Data.Typeable import Data.Fixed #if LANGUAGE_Rank2Types @@ -35,6 +36,9 @@ newtype AbsoluteTime = MkAbsoluteTime {unAbsoluteTime :: DiffTime} deriving (Eq, #endif ) +instance NFData AbsoluteTime where + rnf (MkAbsoluteTime a) = rnf a + instance Typeable AbsoluteTime where typeOf _ = mkTyConApp (mkTyCon "Data.Time.Clock.TAI.AbsoluteTime") [] diff --git a/Data/Time/Clock/UTC.hs b/Data/Time/Clock/UTC.hs index 1153bf8..e172b15 100644 --- a/Data/Time/Clock/UTC.hs +++ b/Data/Time/Clock/UTC.hs @@ -15,6 +15,7 @@ module Data.Time.Clock.UTC UTCTime(..),NominalDiffTime ) where +import Control.DeepSeq import Data.Time.Calendar.Days import Data.Time.Clock.Scale import Data.Fixed @@ -40,6 +41,9 @@ data UTCTime = UTCTime { #endif #endif +instance NFData UTCTime where + rnf (UTCTime d t) = d `deepseq` t `deepseq` () + instance Typeable UTCTime where typeOf _ = mkTyConApp (mkTyCon "Data.Time.Clock.UTC.UTCTime") [] @@ -67,6 +71,9 @@ newtype NominalDiffTime = MkNominalDiffTime Pico deriving (Eq,Ord #endif ) +-- necessary because H98 doesn't have "cunning newtype" derivation +instance NFData NominalDiffTime -- FIXME: Data.Fixed had no NFData instances yet at time of writing + instance Typeable NominalDiffTime where typeOf _ = mkTyConApp (mkTyCon "Data.Time.Clock.UTC.NominalDiffTime") [] diff --git a/Data/Time/LocalTime/LocalTime.hs b/Data/Time/LocalTime/LocalTime.hs index 0a79728..feb0341 100644 --- a/Data/Time/LocalTime/LocalTime.hs +++ b/Data/Time/LocalTime/LocalTime.hs @@ -17,6 +17,7 @@ import Data.Time.LocalTime.TimeOfDay import Data.Time.LocalTime.TimeZone import Data.Time.Calendar import Data.Time.Clock +import Control.DeepSeq import Data.Typeable #if LANGUAGE_Rank2Types import Data.Data @@ -39,6 +40,9 @@ data LocalTime = LocalTime { #endif ) +instance NFData LocalTime where + rnf (LocalTime d t) = d `deepseq` t `deepseq` () + instance Typeable LocalTime where typeOf _ = mkTyConApp (mkTyCon "Data.Time.LocalTime.LocalTime.LocalTime") [] @@ -79,6 +83,9 @@ data ZonedTime = ZonedTime { #endif #endif +instance NFData ZonedTime where + rnf (ZonedTime lt z) = lt `deepseq` z `deepseq` () + instance Typeable ZonedTime where typeOf _ = mkTyConApp (mkTyCon "Data.Time.LocalTime.LocalTime.ZonedTime") [] diff --git a/Data/Time/LocalTime/TimeOfDay.hs b/Data/Time/LocalTime/TimeOfDay.hs index 37b2079..ed0dbed 100644 --- a/Data/Time/LocalTime/TimeOfDay.hs +++ b/Data/Time/LocalTime/TimeOfDay.hs @@ -13,6 +13,7 @@ module Data.Time.LocalTime.TimeOfDay import Data.Time.LocalTime.TimeZone import Data.Time.Calendar.Private import Data.Time.Clock +import Control.DeepSeq import Data.Typeable import Data.Fixed #if LANGUAGE_Rank2Types @@ -38,6 +39,9 @@ data TimeOfDay = TimeOfDay { #endif ) +instance NFData TimeOfDay where + rnf (TimeOfDay h m s) = h `deepseq` m `deepseq` s `seq` () -- FIXME: Data.Fixed had no NFData instances yet at time of writing + instance Typeable TimeOfDay where typeOf _ = mkTyConApp (mkTyCon "Data.Time.LocalTime.TimeOfDay.TimeOfDay") [] diff --git a/Data/Time/LocalTime/TimeZone.hs b/Data/Time/LocalTime/TimeZone.hs index 35ffaab..16b2e52 100644 --- a/Data/Time/LocalTime/TimeZone.hs +++ b/Data/Time/LocalTime/TimeZone.hs @@ -19,6 +19,7 @@ import Data.Time.Clock.POSIX import Foreign import Foreign.C +import Control.DeepSeq import Data.Typeable #if LANGUAGE_Rank2Types import Data.Data @@ -40,6 +41,9 @@ data TimeZone = TimeZone { #endif ) +instance NFData TimeZone where + rnf (TimeZone m so n) = m `deepseq` so `deepseq` n `deepseq` () + instance Typeable TimeZone where typeOf _ = mkTyConApp (mkTyCon "Data.Time.LocalTime.TimeZone.TimeZone") [] diff --git a/time.cabal b/time.cabal index 21bf3e4..c8f0f0f 100644 --- a/time.cabal +++ b/time.cabal @@ -1,5 +1,5 @@ name: time -version: 1.3 +version: 1.4 stability: stable license: BSD3 license-file: LICENSE @@ -35,7 +35,7 @@ extra-tmp-files: library { - build-depends: base == 4.*, old-locale + build-depends: base == 4.*, deepseq >= 1.1 && < 1.2, old-locale ghc-options: -Wall if impl(ghc) extensions: Rank2Types DeriveDataTypeable StandaloneDeriving From git at git.haskell.org Mon Feb 20 21:14:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:14:53 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: remove upper bound on deepseq dependency (e395b77) Message-ID: <20170220211453.CC2FD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/e395b77cdd1f2f7573ad8938c2a55c87152acc11 >--------------------------------------------------------------- commit e395b77cdd1f2f7573ad8938c2a55c87152acc11 Author: Ashley Yakeley Date: Tue Sep 13 02:22:50 2011 -0700 remove upper bound on deepseq dependency Ignore-this: d0b757647470d538d442591df4753e2 darcs-hash:20110913092250-ac6dd-41757c62fa83dafea4fbddac27038fcb405ba108 >--------------------------------------------------------------- e395b77cdd1f2f7573ad8938c2a55c87152acc11 time.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/time.cabal b/time.cabal index c8f0f0f..7acb243 100644 --- a/time.cabal +++ b/time.cabal @@ -35,7 +35,7 @@ extra-tmp-files: library { - build-depends: base == 4.*, deepseq >= 1.1 && < 1.2, old-locale + build-depends: base == 4.*, deepseq >= 1.1, old-locale ghc-options: -Wall if impl(ghc) extensions: Rank2Types DeriveDataTypeable StandaloneDeriving From git at git.haskell.org Mon Feb 20 21:14:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:14:55 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: RULES for realToFrac, for speed, contributed by Liyang HU (8eee78e) Message-ID: <20170220211455.D3FC63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/8eee78e5d4de47651bb837adb28f3550e0611a52 >--------------------------------------------------------------- commit 8eee78e5d4de47651bb837adb28f3550e0611a52 Author: Ashley Yakeley Date: Sun Oct 30 17:38:00 2011 -0700 RULES for realToFrac, for speed, contributed by Liyang HU Ignore-this: c277f94b61ec0c6eab64c1770478220b darcs-hash:20111031003800-ac6dd-affc63c79ba1478a0ebe610bdd42772a7fd85d86 >--------------------------------------------------------------- 8eee78e5d4de47651bb837adb28f3550e0611a52 Data/Time/Clock/Scale.hs | 6 ++++++ Data/Time/Clock/UTC.hs | 9 +++++++++ test/Makefile | 10 +++++++--- test/RealToFracBenchmark.hs | 22 ++++++++++++++++++++++ time.cabal | 2 +- 5 files changed, 45 insertions(+), 4 deletions(-) diff --git a/Data/Time/Clock/Scale.hs b/Data/Time/Clock/Scale.hs index 37c3f32..ffa52a2 100644 --- a/Data/Time/Clock/Scale.hs +++ b/Data/Time/Clock/Scale.hs @@ -106,3 +106,9 @@ secondsToDiffTime = fromInteger -- | Create a 'DiffTime' from a number of picoseconds. picosecondsToDiffTime :: Integer -> DiffTime picosecondsToDiffTime x = fromRational (x % 1000000000000) + +{-# RULES +"realToFrac/DiffTime->Pico" realToFrac = \ (MkDiffTime ps) -> ps +"realToFrac/Pico->DiffTime" realToFrac = MkDiffTime + #-} + diff --git a/Data/Time/Clock/UTC.hs b/Data/Time/Clock/UTC.hs index e172b15..4f3c23a 100644 --- a/Data/Time/Clock/UTC.hs +++ b/Data/Time/Clock/UTC.hs @@ -118,3 +118,12 @@ instance RealFrac NominalDiffTime where round (MkNominalDiffTime a) = round a ceiling (MkNominalDiffTime a) = ceiling a floor (MkNominalDiffTime a) = floor a + +{-# RULES +"realToFrac/DiffTime->NominalDiffTime" realToFrac = \ dt -> MkNominalDiffTime (realToFrac dt) +"realToFrac/NominalDiffTime->DiffTime" realToFrac = \ (MkNominalDiffTime ps) -> realToFrac ps + +"realToFrac/NominalDiffTime->Pico" realToFrac = \ (MkNominalDiffTime ps) -> ps +"realToFrac/Pico->NominalDiffTime" realToFrac = MkNominalDiffTime + #-} + diff --git a/test/Makefile b/test/Makefile index f8ef07d..ca57f7d 100644 --- a/test/Makefile +++ b/test/Makefile @@ -52,6 +52,9 @@ TimeZone.ref: FORCE TestParseTime: TestParseTime.o $(GHC) $(GHCFLAGS) $^ -o $@ +RealToFracBenchmark: RealToFracBenchmark.o + $(GHC) $(GHCFLAGS) $^ -o $@ + test: \ TestMonthDay.diff \ ConvertBack.diff0 \ @@ -64,13 +67,14 @@ test: \ TestFormat.diff0 \ TestParseDAT.diff \ TestEaster.diff \ - TestParseTime.run \ - UseCases.o + TestParseTime.run \ + UseCases.o \ + RealToFracBenchmark.run @echo "Success!" clean: rm -rf TestMonthDay ConvertBack TestCalendars TestTime LongWeekYears ClipDates \ - AddDays TestFormat TestParseDAT TestEaster CurrentTime ShowDST TimeZone TimeZone.ref TestParseTime \ + AddDays TestFormat TestParseDAT TestEaster CurrentTime ShowDST TimeZone TimeZone.ref TestParseTime RealToFracBenchmark \ *.out *.run *.o *.hi Makefile.bak %.diff: %.ref %.out diff --git a/test/RealToFracBenchmark.hs b/test/RealToFracBenchmark.hs new file mode 100644 index 0000000..be4eae2 --- /dev/null +++ b/test/RealToFracBenchmark.hs @@ -0,0 +1,22 @@ +{- Contributed by Liyang HU -} +module Main where + +import Prelude +import Control.Applicative +import Control.Monad +import Control.DeepSeq +import Data.Time +import Data.Time.Clock.POSIX +import System.Random + +main :: IO () +main = do + ts <- replicateM 100000 $ do + t <- posixSecondsToUTCTime . realToFrac <$> + ( (*) . fromInteger <$> randomRIO (-15*10^21, 15*10^21) <*> + randomIO :: IO Double ) :: IO UTCTime + rnf t `seq` return t + now <- getCurrentTime + print . sum $ map (diffUTCTime now) ts + print =<< flip diffUTCTime now <$> getCurrentTime + diff --git a/time.cabal b/time.cabal index 7acb243..cadeea7 100644 --- a/time.cabal +++ b/time.cabal @@ -1,5 +1,5 @@ name: time -version: 1.4 +version: 1.4.0.1 stability: stable license: BSD3 license-file: LICENSE From git at git.haskell.org Mon Feb 20 21:14:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:14:57 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: fix for latest GHC (1674b5d) Message-ID: <20170220211457.DAB2A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/1674b5d844d146915003beb46c152b3056cfd3a9 >--------------------------------------------------------------- commit 1674b5d844d146915003beb46c152b3056cfd3a9 Author: Ashley Yakeley Date: Sat Jul 7 19:59:16 2012 -0700 fix for latest GHC Ignore-this: b6ff8799465d56758c990e952c77e140 darcs-hash:20120708025916-ac6dd-6a0bae17c075e655e248024f48e0fed5a259433f >--------------------------------------------------------------- 1674b5d844d146915003beb46c152b3056cfd3a9 test/TestParseTime.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/TestParseTime.hs b/test/TestParseTime.hs index a8b3832..1ee7368 100644 --- a/test/TestParseTime.hs +++ b/test/TestParseTime.hs @@ -78,7 +78,7 @@ expectedYear :: Integer -> Integer expectedYear i | i >= 69 = 1900 + i expectedYear i = 2000 + i -show2 :: (Integral n) => n -> String +show2 :: (Integral n,Show n) => n -> String show2 i = (show (div i 10)) ++ (show (mod i 10)) parseYY :: Integer -> IO Bool From git at git.haskell.org Mon Feb 20 21:14:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:14:59 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: changed uses of mkTyCon to mkTyCon3 (8f9b7ae) Message-ID: <20170220211459.E1E4A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/8f9b7ae035401105e311dcd8596da5d1aa2f5801 >--------------------------------------------------------------- commit 8f9b7ae035401105e311dcd8596da5d1aa2f5801 Author: blackredtree Date: Thu Sep 13 15:00:34 2012 -0700 changed uses of mkTyCon to mkTyCon3 Ignore-this: f31d15b2eccb114f507cadfcda0b0630 darcs-hash:20120913220034-08fed-bb57957a23120580281bea112d59d15509920b0e >--------------------------------------------------------------- 8f9b7ae035401105e311dcd8596da5d1aa2f5801 Data/Time/Calendar/Days.hs | 2 +- Data/Time/Clock/Scale.hs | 4 ++-- Data/Time/Clock/TAI.hs | 2 +- Data/Time/Clock/UTC.hs | 4 ++-- Data/Time/LocalTime/LocalTime.hs | 4 ++-- Data/Time/LocalTime/TimeOfDay.hs | 2 +- Data/Time/LocalTime/TimeZone.hs | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Data/Time/Calendar/Days.hs b/Data/Time/Calendar/Days.hs index c09a273..6911833 100644 --- a/Data/Time/Calendar/Days.hs +++ b/Data/Time/Calendar/Days.hs @@ -27,7 +27,7 @@ instance NFData Day where rnf (ModifiedJulianDay a) = rnf a instance Typeable Day where - typeOf _ = mkTyConApp (mkTyCon "Data.Time.Calendar.Days.Day") [] + typeOf _ = mkTyConApp (mkTyCon3 "time" "Data.Time.Calendar.Days" "Day") [] -- necessary because H98 doesn't have "cunning newtype" derivation instance Enum Day where diff --git a/Data/Time/Clock/Scale.hs b/Data/Time/Clock/Scale.hs index ffa52a2..237a77b 100644 --- a/Data/Time/Clock/Scale.hs +++ b/Data/Time/Clock/Scale.hs @@ -35,7 +35,7 @@ instance NFData UniversalTime where rnf (ModJulianDate a) = rnf a instance Typeable UniversalTime where - typeOf _ = mkTyConApp (mkTyCon "Data.Time.Clock.Scale.UniversalTime") [] + typeOf _ = mkTyConApp (mkTyCon3 "time" "Data.Time.Clock.Scale" "UniversalTime") [] -- | This is a length of time, as measured by a clock. -- Conversion functions will treat it as seconds. @@ -55,7 +55,7 @@ newtype DiffTime = MkDiffTime Pico deriving (Eq,Ord instance NFData DiffTime -- FIXME: Data.Fixed had no NFData instances yet at time of writing instance Typeable DiffTime where - typeOf _ = mkTyConApp (mkTyCon "Data.Time.Clock.Scale.DiffTime") [] + typeOf _ = mkTyConApp (mkTyCon3 "time" "Data.Time.Clock.Scale" "DiffTime") [] -- necessary because H98 doesn't have "cunning newtype" derivation instance Enum DiffTime where diff --git a/Data/Time/Clock/TAI.hs b/Data/Time/Clock/TAI.hs index 77c2134..5e6bfef 100644 --- a/Data/Time/Clock/TAI.hs +++ b/Data/Time/Clock/TAI.hs @@ -40,7 +40,7 @@ instance NFData AbsoluteTime where rnf (MkAbsoluteTime a) = rnf a instance Typeable AbsoluteTime where - typeOf _ = mkTyConApp (mkTyCon "Data.Time.Clock.TAI.AbsoluteTime") [] + typeOf _ = mkTyConApp (mkTyCon3 "time" "Data.Time.Clock.TAI" "AbsoluteTime") [] instance Show AbsoluteTime where show t = show (utcToLocalTime utc (taiToUTCTime (const 0) t)) ++ " TAI" -- ugly, but standard apparently diff --git a/Data/Time/Clock/UTC.hs b/Data/Time/Clock/UTC.hs index 4f3c23a..da1ecc2 100644 --- a/Data/Time/Clock/UTC.hs +++ b/Data/Time/Clock/UTC.hs @@ -45,7 +45,7 @@ instance NFData UTCTime where rnf (UTCTime d t) = d `deepseq` t `deepseq` () instance Typeable UTCTime where - typeOf _ = mkTyConApp (mkTyCon "Data.Time.Clock.UTC.UTCTime") [] + typeOf _ = mkTyConApp (mkTyCon3 "time" "Data.Time.Clock.UTC" "UTCTime") [] instance Eq UTCTime where (UTCTime da ta) == (UTCTime db tb) = (da == db) && (ta == tb) @@ -75,7 +75,7 @@ newtype NominalDiffTime = MkNominalDiffTime Pico deriving (Eq,Ord instance NFData NominalDiffTime -- FIXME: Data.Fixed had no NFData instances yet at time of writing instance Typeable NominalDiffTime where - typeOf _ = mkTyConApp (mkTyCon "Data.Time.Clock.UTC.NominalDiffTime") [] + typeOf _ = mkTyConApp (mkTyCon3 "time" "Data.Time.Clock.UTC" "NominalDiffTime") [] instance Enum NominalDiffTime where succ (MkNominalDiffTime a) = MkNominalDiffTime (succ a) diff --git a/Data/Time/LocalTime/LocalTime.hs b/Data/Time/LocalTime/LocalTime.hs index feb0341..02f06a4 100644 --- a/Data/Time/LocalTime/LocalTime.hs +++ b/Data/Time/LocalTime/LocalTime.hs @@ -44,7 +44,7 @@ instance NFData LocalTime where rnf (LocalTime d t) = d `deepseq` t `deepseq` () instance Typeable LocalTime where - typeOf _ = mkTyConApp (mkTyCon "Data.Time.LocalTime.LocalTime.LocalTime") [] + typeOf _ = mkTyConApp (mkTyCon3 "time" "Data.Time.LocalTime.LocalTime" "LocalTime") [] instance Show LocalTime where show (LocalTime d t) = (showGregorian d) ++ " " ++ (show t) @@ -87,7 +87,7 @@ instance NFData ZonedTime where rnf (ZonedTime lt z) = lt `deepseq` z `deepseq` () instance Typeable ZonedTime where - typeOf _ = mkTyConApp (mkTyCon "Data.Time.LocalTime.LocalTime.ZonedTime") [] + typeOf _ = mkTyConApp (mkTyCon3 "time" "Data.Time.LocalTime.LocalTime" "ZonedTime") [] utcToZonedTime :: TimeZone -> UTCTime -> ZonedTime utcToZonedTime zone time = ZonedTime (utcToLocalTime zone time) zone diff --git a/Data/Time/LocalTime/TimeOfDay.hs b/Data/Time/LocalTime/TimeOfDay.hs index ed0dbed..8fdf539 100644 --- a/Data/Time/LocalTime/TimeOfDay.hs +++ b/Data/Time/LocalTime/TimeOfDay.hs @@ -43,7 +43,7 @@ instance NFData TimeOfDay where rnf (TimeOfDay h m s) = h `deepseq` m `deepseq` s `seq` () -- FIXME: Data.Fixed had no NFData instances yet at time of writing instance Typeable TimeOfDay where - typeOf _ = mkTyConApp (mkTyCon "Data.Time.LocalTime.TimeOfDay.TimeOfDay") [] + typeOf _ = mkTyConApp (mkTyCon3 "time" "Data.Time.LocalTime.TimeOfDay" "TimeOfDay") [] -- | Hour zero midnight :: TimeOfDay diff --git a/Data/Time/LocalTime/TimeZone.hs b/Data/Time/LocalTime/TimeZone.hs index 16b2e52..689288f 100644 --- a/Data/Time/LocalTime/TimeZone.hs +++ b/Data/Time/LocalTime/TimeZone.hs @@ -45,7 +45,7 @@ instance NFData TimeZone where rnf (TimeZone m so n) = m `deepseq` so `deepseq` n `deepseq` () instance Typeable TimeZone where - typeOf _ = mkTyConApp (mkTyCon "Data.Time.LocalTime.TimeZone.TimeZone") [] + typeOf _ = mkTyConApp (mkTyCon3 "time" "Data.Time.LocalTime.TimeZone" "TimeZone") [] -- | Create a nameless non-summer timezone for this number of minutes minutesToTimeZone :: Int -> TimeZone From git at git.haskell.org Mon Feb 20 21:15:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:15:02 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: revamped tests to use the new cabal testing interface (df3fc69) Message-ID: <20170220211502.0320C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/df3fc69a5e9b5a668933b1c6cca88a9ab6d14db2 >--------------------------------------------------------------- commit df3fc69a5e9b5a668933b1c6cca88a9ab6d14db2 Author: blackredtree Date: Thu Sep 13 15:22:27 2012 -0700 revamped tests to use the new cabal testing interface Ignore-this: bf07a09bbbf9641fcaa104d0540b9646 tests now use string comparsion instead of diffing to determine test results .ref files were converted into hs modules exporting the same data darcs-hash:20120913222227-08fed-71851925b9e0a2a7b67d193b8e92fac37fc95c6f >--------------------------------------------------------------- df3fc69a5e9b5a668933b1c6cca88a9ab6d14db2 {test => Test}/AddDays.hs | 14 +- Test/AddDaysRef.hs | 249 ++++++++++ Test/ClipDates.hs | 56 +++ Test/ClipDatesRef.hs | 565 ++++++++++++++++++++++ Test/ConvertBack.hs | 46 ++ {test => Test}/CurrentTime.hs | 0 Test/LongWeekYears.hs | 26 + Test/LongWeekYearsRef.hs | 154 ++++++ {test => Test}/Makefile | 0 {test => Test}/RealToFracBenchmark.hs | 0 {test => Test}/ShowDST.hs | 0 Test/TAI_UTC_DAT.hs | 41 ++ {test => Test}/TestCalendars.hs | 20 +- Test/TestCalendarsRef.hs | 8 + Test/TestEaster.hs | 40 ++ Test/TestEasterRef.hs | 61 +++ {test => Test}/TestFormat.hs | 111 +++-- {test => Test}/TestFormatStuff.c | 0 {test => Test}/TestFormatStuff.h | 0 Test/TestMonthDay.hs | 29 ++ Test/TestMonthDayRef.hs | 750 +++++++++++++++++++++++++++++ {test => Test}/TestParseDAT.hs | 48 +- Test/TestParseDAT_Ref.hs | 94 ++++ {test => Test}/TestParseTime.hs | 23 +- Test/TestTime.hs | 112 +++++ Test/TestTimeRef.hs | 880 ++++++++++++++++++++++++++++++++++ {test => Test}/TimeZone.hs | 0 {test => Test}/UseCases.lhs | 0 test/AddDays.ref | 245 ---------- test/ClipDates.hs | 26 - test/ClipDates.ref | 561 ---------------------- test/ConvertBack.hs | 36 -- test/LongWeekYears.hs | 18 - test/LongWeekYears.ref | 150 ------ test/TestCalendars.ref | 4 - test/TestEaster.hs | 23 - test/TestEaster.ref | 57 --- test/TestMonthDay.hs | 20 - test/TestMonthDay.ref | 746 ---------------------------- test/TestParseDAT.ref | 90 ---- test/TestTime.hs | 97 ---- test/TestTime.ref | 874 --------------------------------- test/tai-utc.dat | 37 -- time.cabal | 66 ++- 44 files changed, 3307 insertions(+), 3070 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 df3fc69a5e9b5a668933b1c6cca88a9ab6d14db2 From git at git.haskell.org Mon Feb 20 21:15:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:15:04 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: removed unneccesary Makefile (b317b99) Message-ID: <20170220211504.099063A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/b317b9924e78b343f585a92cbb66d486a6e80bc4 >--------------------------------------------------------------- commit b317b9924e78b343f585a92cbb66d486a6e80bc4 Author: blackredtree Date: Thu Sep 13 15:24:52 2012 -0700 removed unneccesary Makefile Ignore-this: cf806b83e0305616c9ab0f403ee90cd0 darcs-hash:20120913222452-08fed-25ca1213291a7fafe793405b1b265ffddc4f1a5d >--------------------------------------------------------------- b317b9924e78b343f585a92cbb66d486a6e80bc4 Test/Makefile | 105 ---------------------------------------------------------- 1 file changed, 105 deletions(-) diff --git a/Test/Makefile b/Test/Makefile deleted file mode 100644 index ca57f7d..0000000 --- a/Test/Makefile +++ /dev/null @@ -1,105 +0,0 @@ -GHC = ghc -GHCFLAGS = -package time -package QuickCheck-1.2.0.1 - -default: - make CurrentTime.run ShowDST.run test - -TestMonthDay: TestMonthDay.o - $(GHC) $(GHCFLAGS) $^ -o $@ - -ConvertBack: ConvertBack.o - $(GHC) $(GHCFLAGS) $^ -o $@ - -TestCalendars: TestCalendars.o - $(GHC) $(GHCFLAGS) $^ -o $@ - -TestTime: TestTime.o - $(GHC) $(GHCFLAGS) $^ -o $@ - -LongWeekYears: LongWeekYears.o - $(GHC) $(GHCFLAGS) $^ -o $@ - -ClipDates: ClipDates.o - $(GHC) $(GHCFLAGS) $^ -o $@ - -AddDays: AddDays.o - $(GHC) $(GHCFLAGS) $^ -o $@ - -TestFormat: TestFormat.o TestFormatStuff.o - $(GHC) $(GHCFLAGS) $^ -o $@ - -TestFormatStuff.o: TestFormatStuff.c TestFormatStuff.h - gcc -o $@ -c $< - -TestParseDAT: TestParseDAT.o - $(GHC) $(GHCFLAGS) $^ -o $@ - -TestEaster: TestEaster.o - $(GHC) $(GHCFLAGS) $^ -o $@ - -CurrentTime: CurrentTime.o - $(GHC) $(GHCFLAGS) $^ -o $@ - -ShowDST: ShowDST.o - $(GHC) $(GHCFLAGS) $^ -o $@ - -TimeZone: TimeZone.o - $(GHC) $(GHCFLAGS) $^ -o $@ - -TimeZone.ref: FORCE - date +%z > $@ - -TestParseTime: TestParseTime.o - $(GHC) $(GHCFLAGS) $^ -o $@ - -RealToFracBenchmark: RealToFracBenchmark.o - $(GHC) $(GHCFLAGS) $^ -o $@ - -test: \ - TestMonthDay.diff \ - ConvertBack.diff0 \ - TestCalendars.diff \ - TestTime.diff \ - LongWeekYears.diff \ - ClipDates.diff \ - AddDays.diff \ - TimeZone.diff \ - TestFormat.diff0 \ - TestParseDAT.diff \ - TestEaster.diff \ - TestParseTime.run \ - UseCases.o \ - RealToFracBenchmark.run - @echo "Success!" - -clean: - rm -rf TestMonthDay ConvertBack TestCalendars TestTime LongWeekYears ClipDates \ - AddDays TestFormat TestParseDAT TestEaster CurrentTime ShowDST TimeZone TimeZone.ref TestParseTime RealToFracBenchmark \ - *.out *.run *.o *.hi Makefile.bak - -%.diff: %.ref %.out - diff -u $^ - -%.diff0: %.out - diff -u /dev/null $^ - -%.out: % - ./$< > $@ - -%.run: % - ./$< - touch $@ - -%.hi: %.o - @: - -%.o: %.hs - $(GHC) $(GHCFLAGS) -c $< -o $@ - -%.o: %.lhs - $(GHC) $(GHCFLAGS) -c $< -o $@ - -FORCE: - -.SECONDARY: - From git at git.haskell.org Mon Feb 20 21:15:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:15:06 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: added Test.Tests and Test.TestUtil modules (46ce767) Message-ID: <20170220211506.116DE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/46ce76714c2a83d851a644a170ac958673aaa86c >--------------------------------------------------------------- commit 46ce76714c2a83d851a644a170ac958673aaa86c Author: blackredtree Date: Thu Sep 20 15:41:04 2012 -0700 added Test.Tests and Test.TestUtil modules Ignore-this: d5fe357080d6ed4f83e2272ad789bbb3 darcs-hash:20120920224104-08fed-3afdeb091b1fab883b255c1be18af368c103dd2c >--------------------------------------------------------------- 46ce76714c2a83d851a644a170ac958673aaa86c Test/TestUtil.hs | 43 +++++++++++++++++++++++++++++++++++++++++++ Test/Tests.hs | 26 ++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) diff --git a/Test/TestUtil.hs b/Test/TestUtil.hs new file mode 100644 index 0000000..237bcfb --- /dev/null +++ b/Test/TestUtil.hs @@ -0,0 +1,43 @@ +module Test.TestUtil + ( SimpleTest(..) + , IO_SimpleTest(..) + , diff + , module Distribution.TestSuite ) + where + +import Distribution.TestSuite + +import System.Cmd +import System.Exit + +-- + +data SimpleTest = SimpleTest String Result + +instance TestOptions SimpleTest where + name (SimpleTest s _) = s + options = const [] + defaultOptions _ = return $ Options [] + check _ _ = [] + +instance PureTestable SimpleTest where + run (SimpleTest _ r) _ = r + +-- + +data IO_SimpleTest = IO_SimpleTest String (IO Result) + +instance TestOptions IO_SimpleTest where + name (IO_SimpleTest s _) = s + options = const [] + defaultOptions _ = return $ Options [] + check _ _ = [] + +instance ImpureTestable IO_SimpleTest where + runM (IO_SimpleTest _ r) _ = r + +-- + +diff :: String -> String -> Result +diff s t + = if s == t then Pass else Fail "" diff --git a/Test/Tests.hs b/Test/Tests.hs new file mode 100644 index 0000000..d8e1cb2 --- /dev/null +++ b/Test/Tests.hs @@ -0,0 +1,26 @@ +module Test.Tests where + +import Distribution.TestSuite + +import Test.AddDays +import Test.ClipDates +import Test.ConvertBack +import Test.LongWeekYears +import Test.TestCalendars +import Test.TestEaster +import Test.TestFormat +import Test.TestMonthDay +import Test.TestParseDAT +import Test.TestTime + +tests :: [Test] +tests = [ addDaysTest + , clipDates + , convertBack + , longWeekYears + , testCalendars + , testEaster + , testFormat + , testMonthDay + , testParseDAT + , testTime ] From git at git.haskell.org Mon Feb 20 21:15:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:15:08 +0000 (UTC) Subject: [commit: packages/time] format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis: get working with Cabal 1.16; fix up build process (2fa30f7) Message-ID: <20170220211508.184013A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/2fa30f752df06fad3f4245f99b9c3aefcdf447df >--------------------------------------------------------------- commit 2fa30f752df06fad3f4245f99b9c3aefcdf447df Author: Ashley Yakeley Date: Sun Oct 21 16:48:44 2012 -0700 get working with Cabal 1.16; fix up build process Ignore-this: f4503eb3fa2fbd1ac938024548d1176f darcs-hash:20121021234844-ac6dd-fc357fa538cdf5e1c09c14771cd37c204331a35a >--------------------------------------------------------------- 2fa30f752df06fad3f4245f99b9c3aefcdf447df Makefile | 10 +++++----- Setup.hs | 18 +----------------- Test/TestUtil.hs | 38 ++++++++------------------------------ Test/Tests.hs | 4 ++-- configure.ac | 2 ++ time.cabal | 6 +++--- 6 files changed, 21 insertions(+), 57 deletions(-) diff --git a/Makefile b/Makefile index a0b37a9..37a78fc 100644 --- a/Makefile +++ b/Makefile @@ -6,24 +6,24 @@ clean: cabal clean configure: - cabal configure --enable-library-profiling --enable-executable-profiling + cabal configure --enable-library-profiling --enable-executable-profiling --enable-tests build: configure cabal build --ghc-options=-Werror -test: install +test: build cabal test haddock: configure cabal haddock -install: build haddock +install: build test haddock cabal install --user --enable-library-profiling --enable-executable-profiling -sdist: configure +sdist: clean configure cabal sdist # switch off intermediate file deletion .SECONDARY: -.PHONY: default configure build haddock install test sdist +.PHONY: default clean configure build haddock install test sdist diff --git a/Setup.hs b/Setup.hs index cdd46de..26fdbce 100644 --- a/Setup.hs +++ b/Setup.hs @@ -1,26 +1,10 @@ module Main (main) where -import Control.Exception -import Distribution.PackageDescription import Distribution.Simple -import Distribution.Simple.LocalBuildInfo -import Distribution.Simple.Utils -import System.Cmd -import System.Directory import System.Info main :: IO () main = case os of "windows" -> defaultMain "mingw32" -> defaultMain - _ -> let hooks = autoconfUserHooks { runTests = runTestScript } in defaultMainWithHooks hooks - -withCurrentDirectory :: FilePath -> IO a -> IO a -withCurrentDirectory path f = do - cur <- getCurrentDirectory - setCurrentDirectory path - finally f (setCurrentDirectory cur) - -runTestScript :: Args -> Bool -> PackageDescription -> LocalBuildInfo -> IO () -runTestScript _args _flag _pd _lbi - = maybeExit $ withCurrentDirectory "test" $ system "make" + _ -> defaultMainWithHooks autoconfUserHooks diff --git a/Test/TestUtil.hs b/Test/TestUtil.hs index 237bcfb..2c0be91 100644 --- a/Test/TestUtil.hs +++ b/Test/TestUtil.hs @@ -1,42 +1,20 @@ module Test.TestUtil - ( SimpleTest(..) - , IO_SimpleTest(..) - , diff - , module Distribution.TestSuite ) - where + ( + module Test.TestUtil + , module Distribution.TestSuite + ) where import Distribution.TestSuite -import System.Cmd -import System.Exit - --- - data SimpleTest = SimpleTest String Result -instance TestOptions SimpleTest where - name (SimpleTest s _) = s - options = const [] - defaultOptions _ = return $ Options [] - check _ _ = [] - -instance PureTestable SimpleTest where - run (SimpleTest _ r) _ = r - --- +pure :: SimpleTest -> Test +pure (SimpleTest name result) = Test (TestInstance (return (Finished result)) name [] [] (\_ _ -> Left "")) data IO_SimpleTest = IO_SimpleTest String (IO Result) -instance TestOptions IO_SimpleTest where - name (IO_SimpleTest s _) = s - options = const [] - defaultOptions _ = return $ Options [] - check _ _ = [] - -instance ImpureTestable IO_SimpleTest where - runM (IO_SimpleTest _ r) _ = r - --- +impure :: IO_SimpleTest -> Test +impure (IO_SimpleTest name mresult) = Test (TestInstance (fmap Finished mresult) name [] [] (\_ _ -> Left "")) diff :: String -> String -> Result diff s t diff --git a/Test/Tests.hs b/Test/Tests.hs index d8e1cb2..2185918 100644 --- a/Test/Tests.hs +++ b/Test/Tests.hs @@ -13,8 +13,8 @@ import Test.TestMonthDay import Test.TestParseDAT import Test.TestTime -tests :: [Test] -tests = [ addDaysTest +tests :: IO [Test] +tests = return [ addDaysTest , clipDates , convertBack , longWeekYears diff --git a/configure.ac b/configure.ac index dc58c49..927625a 100644 --- a/configure.ac +++ b/configure.ac @@ -6,6 +6,8 @@ AC_CONFIG_SRCDIR([include/HsTime.h]) AC_ARG_WITH([cc], [C compiler], [CC=$withval]) +AC_ARG_WITH([gcc],[Gnu C compiler]) +AC_ARG_WITH([compiler],[Haskell compiler]) AC_PROG_CC() AC_CONFIG_HEADERS([include/HsTimeConfig.h]) diff --git a/time.cabal b/time.cabal index e6e2668..ec13915 100644 --- a/time.cabal +++ b/time.cabal @@ -9,8 +9,8 @@ homepage: http://semantic.org/TimeLib/ synopsis: A time library description: A time library category: System -build-type: Simple -cabal-version: >=1.9.2 +build-type: Custom +cabal-version: >=1.16 x-follows-version-policy: extra-source-files: @@ -91,7 +91,7 @@ Test-Suite tests cpp-options: -DLANGUAGE_Rank2Types -DLANGUAGE_DeriveDataTypeable -DLANGUAGE_StandaloneDeriving c-sources: cbits/HsTime.c Test/TestFormatStuff.c include-dirs: include - build-depends: base, deepseq, Cabal >= 1.9.2, old-locale, process + build-depends: base, deepseq, Cabal >= 1.16, old-locale, process other-modules: Test.TestTime Test.TestTimeRef From git at git.haskell.org Mon Feb 20 21:15:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:15:10 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: clean up tests (54a7b3b) Message-ID: <20170220211510.20ACF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/54a7b3baccde8bcafd9238f587f728e9beb73b7f >--------------------------------------------------------------- commit 54a7b3baccde8bcafd9238f587f728e9beb73b7f Author: Ashley Yakeley Date: Sun Oct 28 17:05:35 2012 -0700 clean up tests Ignore-this: daf151d23ca95cf9938f58b2378b68df darcs-hash:20121029000535-ac6dd-aa7918f6f704d0591e929c58c506b69250593844 >--------------------------------------------------------------- 54a7b3baccde8bcafd9238f587f728e9beb73b7f Test/AddDays.hs | 2 +- Test/ClipDates.hs | 2 +- Test/ConvertBack.hs | 2 +- Test/LongWeekYears.hs | 2 +- Test/TestCalendars.hs | 2 +- Test/TestEaster.hs | 2 +- Test/TestFormat.hs | 103 ++++++++++++++++++++------------------------------ Test/TestMonthDay.hs | 2 +- Test/TestParseDAT.hs | 2 +- Test/TestTime.hs | 2 +- Test/TestUtil.hs | 37 ++++++++++++++++-- 11 files changed, 83 insertions(+), 75 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 54a7b3baccde8bcafd9238f587f728e9beb73b7f From git at git.haskell.org Mon Feb 20 21:15:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:15:12 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: clean up cabal (f3549c0) Message-ID: <20170220211512.26EF63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/f3549c01321318e863201c60fbab1cae0d7009c0 >--------------------------------------------------------------- commit f3549c01321318e863201c60fbab1cae0d7009c0 Author: Ashley Yakeley Date: Sun Oct 28 22:26:12 2012 -0700 clean up cabal Ignore-this: 5e5b69183c6e72366a4dd98122daa5ef darcs-hash:20121029052612-ac6dd-bcb9e948acbc01ea8ce0964bcbdd20afe27d0796 >--------------------------------------------------------------- f3549c01321318e863201c60fbab1cae0d7009c0 Setup.hs | 10 ---------- time.cabal | 14 ++++++++------ 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/Setup.hs b/Setup.hs deleted file mode 100644 index 26fdbce..0000000 --- a/Setup.hs +++ /dev/null @@ -1,10 +0,0 @@ -module Main (main) where - -import Distribution.Simple -import System.Info - -main :: IO () -main = case os of - "windows" -> defaultMain - "mingw32" -> defaultMain - _ -> defaultMainWithHooks autoconfUserHooks diff --git a/time.cabal b/time.cabal index ec13915..6574f89 100644 --- a/time.cabal +++ b/time.cabal @@ -9,7 +9,7 @@ homepage: http://semantic.org/TimeLib/ synopsis: A time library description: A time library category: System -build-type: Custom +build-type: Configure cabal-version: >=1.16 x-follows-version-policy: @@ -34,16 +34,17 @@ extra-tmp-files: include/HsTimeConfig.h library - Build-Depends: base >= 4, + build-depends: base >= 4, deepseq >= 1.1, old-locale ghc-options: -Wall + default-language: Haskell2010 if impl(ghc) - extensions: Rank2Types DeriveDataTypeable StandaloneDeriving + default-extensions: Rank2Types DeriveDataTypeable StandaloneDeriving cpp-options: -DLANGUAGE_Rank2Types -DLANGUAGE_DeriveDataTypeable -DLANGUAGE_StandaloneDeriving else if impl(hugs) - extensions: Rank2Types + default-extensions: Rank2Types cpp-options: -DLANGUAGE_Rank2Types if os(windows) build-depends: Win32 @@ -60,7 +61,7 @@ library Data.Time.LocalTime, Data.Time.Format, Data.Time - extensions: ForeignFunctionInterface, CPP + default-extensions: CPP c-sources: cbits/HsTime.c other-modules: Data.Time.Calendar.Private, @@ -87,7 +88,8 @@ library Test-Suite tests type: detailed-0.9 test-module: Test.Tests - extensions: Rank2Types, ForeignFunctionInterface, CPP, DeriveDataTypeable, StandaloneDeriving + default-language: Haskell2010 + default-extensions: Rank2Types, CPP, DeriveDataTypeable, StandaloneDeriving cpp-options: -DLANGUAGE_Rank2Types -DLANGUAGE_DeriveDataTypeable -DLANGUAGE_StandaloneDeriving c-sources: cbits/HsTime.c Test/TestFormatStuff.c include-dirs: include From git at git.haskell.org Mon Feb 20 21:15:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:15:14 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: more TestInstance clean-up (0417890) Message-ID: <20170220211514.2E4D43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/041789051b0d6aa09d03560bf0b5b3c7fda9c645 >--------------------------------------------------------------- commit 041789051b0d6aa09d03560bf0b5b3c7fda9c645 Author: Ashley Yakeley Date: Sun Oct 28 22:28:49 2012 -0700 more TestInstance clean-up Ignore-this: 2596abdead9de1796655be9e58f2ce95 darcs-hash:20121029052849-ac6dd-ebd63fbd2dd9044bcd2ec8f5c5073c5514eac0f5 >--------------------------------------------------------------- 041789051b0d6aa09d03560bf0b5b3c7fda9c645 Test/AddDays.hs | 2 +- Test/ClipDates.hs | 2 +- Test/ConvertBack.hs | 2 +- Test/LongWeekYears.hs | 2 +- Test/TestCalendars.hs | 2 +- Test/TestEaster.hs | 2 +- Test/TestFormat.hs | 4 ++-- Test/TestMonthDay.hs | 2 +- Test/TestParseDAT.hs | 2 +- Test/TestTime.hs | 2 +- Test/TestUtil.hs | 38 +++++++++++++++++--------------------- 11 files changed, 28 insertions(+), 32 deletions(-) diff --git a/Test/AddDays.hs b/Test/AddDays.hs index a3754d9..0066673 100644 --- a/Test/AddDays.hs +++ b/Test/AddDays.hs @@ -43,5 +43,5 @@ resultDays = do addDaysTest :: Test addDaysTest - = Test $ pure $ SimpleTest "addDays" + = Test $ pure "addDays" $ diff addDaysRef $ unlines resultDays diff --git a/Test/ClipDates.hs b/Test/ClipDates.hs index 1b5d35f..761b9e9 100644 --- a/Test/ClipDates.hs +++ b/Test/ClipDates.hs @@ -35,7 +35,7 @@ tupleUp3 l1 l2 l3 clipDates :: Test clipDates - = Test $ pure $ SimpleTest "clipDates" + = Test $ pure "clipDates" $ let yad = unlines $ map yearAndDay $ tupleUp2 [1968,1969,1971] [-4,0,1,200,364,365,366,367,700] diff --git a/Test/ConvertBack.hs b/Test/ConvertBack.hs index ce0238b..857e80f 100644 --- a/Test/ConvertBack.hs +++ b/Test/ConvertBack.hs @@ -42,5 +42,5 @@ days = [ModifiedJulianDay 50000 .. ModifiedJulianDay 50200] ++ convertBack :: Test convertBack - = Test $ pure $ SimpleTest "convertBack" + = Test $ pure "convertBack" $ diff "" $ concatMap (\ch -> concatMap ch days) checkers diff --git a/Test/LongWeekYears.hs b/Test/LongWeekYears.hs index 7824425..220b3c7 100644 --- a/Test/LongWeekYears.hs +++ b/Test/LongWeekYears.hs @@ -22,5 +22,5 @@ showLongYear year longWeekYears :: Test longWeekYears - = Test $ pure $ SimpleTest "longWeekYears" + = Test $ pure "longWeekYears" $ diff longWeekYearsRef $ unlines $ map showLongYear [1901 .. 2050] diff --git a/Test/TestCalendars.hs b/Test/TestCalendars.hs index 324b792..5f1932c 100644 --- a/Test/TestCalendars.hs +++ b/Test/TestCalendars.hs @@ -29,7 +29,7 @@ days = [ testCalendars :: Test testCalendars - = Test $ pure $ SimpleTest "testCalendars" + = Test $ pure "testCalendars" $ diff testCalendarsRef $ unlines $ map (\d -> showShowers d) days where diff --git a/Test/TestEaster.hs b/Test/TestEaster.hs index b6b9bd7..e97c84e 100644 --- a/Test/TestEaster.hs +++ b/Test/TestEaster.hs @@ -21,7 +21,7 @@ showWithWDay = formatTime defaultTimeLocale "%F %A" testEaster :: Test testEaster - = Test $ pure $ SimpleTest "testEaster" + = Test $ pure "testEaster" $ let ds = unlines $ map (\day -> unwords [ showWithWDay day, "->" , showWithWDay (sundayAfter day)]) days diff --git a/Test/TestFormat.hs b/Test/TestFormat.hs index eb8b2ee..001de68 100644 --- a/Test/TestFormat.hs +++ b/Test/TestFormat.hs @@ -75,7 +75,7 @@ times = [baseTime0] ++ (fmap getDay [0..23]) ++ (fmap getDay [0..100]) ++ compareFormat :: String -> (String -> String) -> String -> TimeZone -> UTCTime -> TestInstance compareFormat testname modUnix fmt zone time = let ctime = utcToZonedTime zone time in - impure $ IO_SimpleTest (testname ++ ": " ++ (show fmt) ++ " of " ++ (show ctime)) $ + impure (testname ++ ": " ++ (show fmt) ++ " of " ++ (show ctime)) $ do let haskellText = formatTime locale fmt ctime unixText <- fmap modUnix (unixFormatTime fmt zone time) @@ -124,7 +124,7 @@ safeString s = do [] -> return "" compareExpected :: (Eq t,Show t,ParseTime t) => String -> String -> String -> Maybe t -> TestInstance -compareExpected testname fmt str expected = impure $ IO_SimpleTest (testname ++ ": " ++ (show fmt) ++ " on " ++ (show str)) $ do +compareExpected testname fmt str expected = impure (testname ++ ": " ++ (show fmt) ++ " on " ++ (show str)) $ do let found = parseTime defaultTimeLocale fmt str mex <- getBottom found case mex of diff --git a/Test/TestMonthDay.hs b/Test/TestMonthDay.hs index 0d3a665..fa3bdcc 100644 --- a/Test/TestMonthDay.hs +++ b/Test/TestMonthDay.hs @@ -15,7 +15,7 @@ showCompare a1 b a2 = "DIFF: " ++ (show a1) ++ " -> " ++ b ++ " -> " ++ (show a2 testMonthDay :: Test testMonthDay - = Test $ pure $ SimpleTest "testMonthDay" + = Test $ pure "testMonthDay" $ diff testMonthDayRef $ concat $ map (\isL -> unlines (leap isL : yearDays isL)) [False,True] where diff --git a/Test/TestParseDAT.hs b/Test/TestParseDAT.hs index 187d062..313758d 100644 --- a/Test/TestParseDAT.hs +++ b/Test/TestParseDAT.hs @@ -43,7 +43,7 @@ times = testParseDAT :: Test testParseDAT - = Test $ pure $ SimpleTest "testParseDAT" + = Test $ pure "testParseDAT" $ diff testParseDAT_Ref parseDAT where parseDAT = diff --git a/Test/TestTime.hs b/Test/TestTime.hs index c47712e..cfa476b 100644 --- a/Test/TestTime.hs +++ b/Test/TestTime.hs @@ -108,5 +108,5 @@ testTimeOfDayToDayFraction testTime :: Test testTime - = Test $ pure $ SimpleTest "testTime" + = Test $ pure "testTime" $ diff testTimeRef $ unlines [testCal, testUTC, testUT1, testTimeOfDayToDayFraction] diff --git a/Test/TestUtil.hs b/Test/TestUtil.hs index 776b859..88d95d2 100644 --- a/Test/TestUtil.hs +++ b/Test/TestUtil.hs @@ -6,19 +6,21 @@ module Test.TestUtil import Distribution.TestSuite -data SimpleTest = SimpleTest String Result - -pure :: SimpleTest -> TestInstance -pure (SimpleTest name result) = TestInstance (return (Finished result)) name [] [] (\_ _ -> Left "") - -data IO_SimpleTest = IO_SimpleTest String (IO Result) +impure :: String -> IO Result -> TestInstance +impure name mresult = TestInstance { + run = fmap Finished mresult, + name = name, + tags = [], + options = [], + setOption = \_ _ -> Left "unsupported" +} -impure :: IO_SimpleTest -> TestInstance -impure (IO_SimpleTest name mresult) = TestInstance (fmap Finished mresult) name [] [] (\_ _ -> Left "") +pure :: String -> Result -> TestInstance +pure name result = impure name (return result) diff :: String -> String -> Result -diff s t - = if s == t then Pass else Fail "" +diff s t | s == t = Pass +diff _ _ = Fail "" finish :: IO Progress -> IO Result finish iop = do @@ -27,24 +29,18 @@ finish iop = do Finished result -> return result Progress _ iop' -> finish iop' -concatRun :: [IO Progress] -> IO Progress -concatRun [] = return (Finished Pass) +concatRun :: [IO Progress] -> IO Result +concatRun [] = return Pass concatRun (iop:iops) = do result <- finish iop case result of Pass -> concatRun iops - _ -> return (Finished result) + _ -> return result concatTestInstance :: String -> [TestInstance] -> TestInstance -concatTestInstance tname tis = TestInstance { - run = concatRun (fmap run tis), - name = tname, - tags = [], - options = [], - setOption = \_ _ -> Left "unsupported" -} +concatTestInstance tname tis = impure tname (concatRun (fmap run tis)) fastTestInstanceGroup :: String -> [TestInstance] -> Test ---fastTestGroup tname tis = testGroup tname (fmap Test tis) +fastTestInstanceGroup tname tis | False = testGroup tname (fmap Test tis) fastTestInstanceGroup tname tis = Test (concatTestInstance tname tis) From git at git.haskell.org Mon Feb 20 21:15:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:15:16 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: %C not restricted to two characters in format (295c172) Message-ID: <20170220211516.355203A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/295c172ffdfd981375485387e3c1963d2544095a >--------------------------------------------------------------- commit 295c172ffdfd981375485387e3c1963d2544095a Author: Ashley Yakeley Date: Sun Oct 28 22:29:37 2012 -0700 %C not restricted to two characters in format Ignore-this: dab171d022b83436dc3a0449525654e darcs-hash:20121029052937-ac6dd-916d8ce315605f9b428f32728e8da8007091ae27 >--------------------------------------------------------------- 295c172ffdfd981375485387e3c1963d2544095a Data/Time/Format.hs | 4 ++-- Test/TestFormat.hs | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Data/Time/Format.hs b/Data/Time/Format.hs index 174bbea..926004b 100644 --- a/Data/Time/Format.hs +++ b/Data/Time/Format.hs @@ -113,7 +113,7 @@ formatChar c locale mpado t = case (formatCharacter c) of -- -- [@%y@] last two digits of year, @00@ - @99@ -- --- [@%C@] century (being the first two digits of the year), @00@ - @99@ +-- [@%C@] century -- -- [@%B@] month name, long form ('fst' from 'months' @locale@), @January@ - @December@ -- @@ -213,7 +213,7 @@ instance FormatTime Day where -- Year Count formatCharacter 'Y' = Just (\_ _ -> show . fst . toOrdinalDate) formatCharacter 'y' = Just (\_ opt -> (show2 (fromMaybe (Just '0') opt)) . mod100 . fst . toOrdinalDate) - formatCharacter 'C' = Just (\_ opt -> (show2 (fromMaybe (Just '0') opt)) . div100 . fst . toOrdinalDate) + formatCharacter 'C' = Just (\_ _ -> show . div100 . fst . toOrdinalDate) -- Month of Year formatCharacter 'B' = Just (\locale _ -> fst . (\(_,m,_) -> (months locale) !! (m - 1)) . toGregorian) formatCharacter 'b' = Just (\locale _ -> snd . (\(_,m,_) -> (months locale) !! (m - 1)) . toGregorian) diff --git a/Test/TestFormat.hs b/Test/TestFormat.hs index 001de68..3aae5e5 100644 --- a/Test/TestFormat.hs +++ b/Test/TestFormat.hs @@ -68,9 +68,12 @@ getYearP3 year = localTimeToUTC utc (LocalTime (fromGregorian year 03 04) midnig getYearP4 :: Integer -> UTCTime getYearP4 year = localTimeToUTC utc (LocalTime (fromGregorian year 12 31) midnight) +years :: [Integer] +years = [999,1000,1899,1900,1901] ++ [1980..2000] ++ [9999,10000] + times :: [UTCTime] times = [baseTime0] ++ (fmap getDay [0..23]) ++ (fmap getDay [0..100]) ++ - (fmap getYearP1 [1980..2000]) ++ (fmap getYearP2 [1980..2000]) ++ (fmap getYearP3 [1980..2000]) ++ (fmap getYearP4 [1980..2000]) + (fmap getYearP1 years) ++ (fmap getYearP2 years) ++ (fmap getYearP3 years) ++ (fmap getYearP4 years) compareFormat :: String -> (String -> String) -> String -> TimeZone -> UTCTime -> TestInstance compareFormat testname modUnix fmt zone time = From git at git.haskell.org Mon Feb 20 21:15:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:15:18 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: fix up test infrastructure (500ca20) Message-ID: <20170220211518.3DF043A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/500ca2046c1f85279a4b2b95b71dadc5f4c22986 >--------------------------------------------------------------- commit 500ca2046c1f85279a4b2b95b71dadc5f4c22986 Author: Ashley Yakeley Date: Wed Nov 14 20:17:38 2012 -0800 fix up test infrastructure Ignore-this: 884e829c58ee215ab63a75114c0627ec darcs-hash:20121115041738-ac6dd-c747d085442d3b43b6c8f66bf7b78431ad2efd4b >--------------------------------------------------------------- 500ca2046c1f85279a4b2b95b71dadc5f4c22986 Makefile | 2 +- Test/AddDays.hs | 10 +--- Test/ClipDates.hs | 38 +++++--------- Test/ConvertBack.hs | 10 +--- Test/LongWeekYears.hs | 10 +--- Test/TestCalendars.hs | 17 ++---- Test/TestEaster.hs | 12 ++--- Test/TestFormat.hs | 49 +++++++----------- Test/TestMonthDay.hs | 29 ++++------- Test/TestParseDAT.hs | 35 +++++-------- Test/TestParseTime.hs | 127 +++++++++++++++++++++++---------------------- Test/TestTime.hs | 10 +--- Test/TestUtil.hs | 85 +++++++++++++++--------------- Test/Tests.hs | 8 +-- time.cabal | 140 +++++++++++++++++++++++++++++--------------------- 15 files changed, 271 insertions(+), 311 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 500ca2046c1f85279a4b2b95b71dadc5f4c22986 From git at git.haskell.org Mon Feb 20 21:15:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:15:20 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: more test infrastructure (b85fefa) Message-ID: <20170220211520.44DC83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/b85fefa65a538c2e38bd688594c68fd0d16236db >--------------------------------------------------------------- commit b85fefa65a538c2e38bd688594c68fd0d16236db Author: Ashley Yakeley Date: Thu Nov 15 00:52:10 2012 -0800 more test infrastructure Ignore-this: 7e091ce926e7c054340ecdbc1779fb84 darcs-hash:20121115085210-ac6dd-a38387a32dbb5d33ce700fc5004aa8e73475831f >--------------------------------------------------------------- b85fefa65a538c2e38bd688594c68fd0d16236db Test.hs | 6 ++++++ Test/TestParseTime.hs | 35 ----------------------------------- 2 files changed, 6 insertions(+), 35 deletions(-) diff --git a/Test.hs b/Test.hs new file mode 100644 index 0000000..27e2bee --- /dev/null +++ b/Test.hs @@ -0,0 +1,6 @@ +module Main where +import Test.Framework +import Test.Tests + +main :: IO () +main = defaultMain tests diff --git a/Test/TestParseTime.hs b/Test/TestParseTime.hs index 823a3c1..fa7b241 100644 --- a/Test/TestParseTime.hs +++ b/Test/TestParseTime.hs @@ -12,13 +12,7 @@ import Data.Time.Calendar.WeekDate import Data.Time.Clock.POSIX import System.Locale import Test.QuickCheck hiding (Result) ---import qualified Test.QuickCheck import Test.TestUtil ---import qualified Test.TestUtil - - ---instance RunTest Property where --- runTest p = run p (TestOptions {no_of_tests = 10000,length_of_tests = 0,debug_tests = False}) ntest :: Int ntest = 1000 @@ -32,9 +26,6 @@ testParseTime = testGroup "testParseTime" testGroup "properties" (fmap (\(n,prop) -> testProperty n prop) properties) ] -{- -knownFailures --} yearDays :: Integer -> [Day] yearDays y = [(fromGregorian y 1 1) .. (fromGregorian y 12 31)] @@ -83,38 +74,12 @@ parseCYY c i = return $ diff (Just (fromGregorian ((c * 100) + i) 1 1)) (parse " parseCYY2 :: Integer -> Integer -> IO Result parseCYY2 c i = return $ diff (Just (fromGregorian ((c * 100) + i) 1 1)) (parse "%C %y" ((show2 c) ++ " " ++ (show2 i))) -{- -checkAll :: RunTest p => [(String,p)] -> IO Bool -checkAll ps = fmap and (mapM checkOne ps) - -trMessage :: TestResult -> String -trMessage (TestOk s _ _) = s -trMessage (TestExausted s i ss) = "Exhausted " ++ (show s) ++ " " ++ (show i) ++ " " ++ (show ss) -trMessage (TestFailed ss i) = "Failed " ++ (show ss) ++ " " ++ (show i) -trMessage (TestAborted ex) = "Aborted " ++ (show ex) - -trGood :: TestResult -> Bool -trGood (TestOk _ _ _) = True -trGood _ = False - -checkOne :: RunTest p => (String,p) -> IO Bool -checkOne (n,p) = - do - putStr (rpad 65 ' ' n) - tr <- runTest p - putStrLn (trMessage tr) - return (trGood tr) - where - rpad n' c xs = xs ++ replicate (n' - length xs) c --} - parse :: ParseTime t => String -> String -> Maybe t parse f t = parseTime defaultTimeLocale f t format :: (FormatTime t) => String -> t -> String format f t = formatTime defaultTimeLocale f t - instance Arbitrary Day where arbitrary = liftM ModifiedJulianDay $ choose (-313698, 2973483) -- 1000-01-1 to 9999-12-31 From git at git.haskell.org Mon Feb 20 21:15:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:15:24 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: fix format modifiers for YCGf (fc49f3e) Message-ID: <20170220211524.543B03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/fc49f3e92d7ce4474d16a282784da6686ed8a180 >--------------------------------------------------------------- commit fc49f3e92d7ce4474d16a282784da6686ed8a180 Author: Ashley Yakeley Date: Sat Nov 24 18:23:58 2012 -0800 fix format modifiers for YCGf Ignore-this: 6fb972e177214f11f807e125d5e69da3 darcs-hash:20121125022358-ac6dd-901bbe054d6df17f3410480ba25140d6d0068879 >--------------------------------------------------------------- fc49f3e92d7ce4474d16a282784da6686ed8a180 Data/Time/Calendar/Private.hs | 32 ++++++++++++++------------------ Data/Time/Format.hs | 8 ++++---- Test/TestFormat.hs | 21 +++++++++++++++++++-- 3 files changed, 37 insertions(+), 24 deletions(-) diff --git a/Data/Time/Calendar/Private.hs b/Data/Time/Calendar/Private.hs index 6afe648..f241dc3 100644 --- a/Data/Time/Calendar/Private.hs +++ b/Data/Time/Calendar/Private.hs @@ -9,33 +9,29 @@ pad1 :: NumericPadOption -> String -> String pad1 (Just c) s = c:s pad1 _ s = s +padN :: Int -> Char -> String -> String +padN i _ s | i <= 0 = s +padN i c s = (replicate i c) ++ s + show2Fixed :: NumericPadOption -> Pico -> String show2Fixed opt x | x < 10 = pad1 opt (showFixed True x) show2Fixed _ x = showFixed True x +showPaddedMin :: (Num t,Ord t,Show t) => Int -> NumericPadOption -> t -> String +showPaddedMin _ Nothing i = show i +showPaddedMin pl opt i | i < 0 = '-':(showPaddedMin pl opt (negate i)) +showPaddedMin pl (Just c) i = + let s = show i in + padN (pl - (length s)) c s + show2 :: (Num t,Ord t,Show t) => NumericPadOption -> t -> String -show2 opt i | i < 0 = '-':(show2 opt (negate i)) -show2 opt i = let - s = show i in - case s of - [_] -> pad1 opt s - _ -> s +show2 = showPaddedMin 2 show3 :: (Num t,Ord t,Show t) => NumericPadOption -> t -> String -show3 opt i | i < 0 = '-':(show3 opt (negate i)) -show3 opt i = let - s = show2 opt i in - case s of - [_,_] -> pad1 opt s - _ -> s +show3 = showPaddedMin 3 show4 :: (Num t,Ord t,Show t) => NumericPadOption -> t -> String -show4 opt i | i < 0 = '-':(show4 opt (negate i)) -show4 opt i = let - s = show3 opt i in - case s of - [_,_,_] -> pad1 opt s - _ -> s +show4 = showPaddedMin 4 mod100 :: (Integral i) => i -> i mod100 x = mod x 100 diff --git a/Data/Time/Format.hs b/Data/Time/Format.hs index 926004b..f332f97 100644 --- a/Data/Time/Format.hs +++ b/Data/Time/Format.hs @@ -211,9 +211,9 @@ instance FormatTime Day where formatCharacter 'x' = Just (\locale _ -> formatTime locale (dateFmt locale)) -- Year Count - formatCharacter 'Y' = Just (\_ _ -> show . fst . toOrdinalDate) + formatCharacter 'Y' = Just (\_ opt -> (show4 (fromMaybe Nothing opt)) . fst . toOrdinalDate) formatCharacter 'y' = Just (\_ opt -> (show2 (fromMaybe (Just '0') opt)) . mod100 . fst . toOrdinalDate) - formatCharacter 'C' = Just (\_ _ -> show . div100 . fst . toOrdinalDate) + formatCharacter 'C' = Just (\_ opt -> (show2 (fromMaybe Nothing opt)) . div100 . fst . toOrdinalDate) -- Month of Year formatCharacter 'B' = Just (\locale _ -> fst . (\(_,m,_) -> (months locale) !! (m - 1)) . toGregorian) formatCharacter 'b' = Just (\locale _ -> snd . (\(_,m,_) -> (months locale) !! (m - 1)) . toGregorian) @@ -226,9 +226,9 @@ instance FormatTime Day where formatCharacter 'j' = Just (\_ opt -> (show3 (fromMaybe (Just '0') opt)) . snd . toOrdinalDate) -- ISO 8601 Week Date - formatCharacter 'G' = Just (\_ _ -> show . (\(y,_,_) -> y) . toWeekDate) + formatCharacter 'G' = Just (\_ opt -> (show4 (fromMaybe Nothing opt)) . (\(y,_,_) -> y) . toWeekDate) formatCharacter 'g' = Just (\_ opt -> (show2 (fromMaybe (Just '0') opt)) . mod100 . (\(y,_,_) -> y) . toWeekDate) - formatCharacter 'f' = Just (\_ opt -> (show2 (fromMaybe (Just '0') opt)) . div100 . (\(y,_,_) -> y) . toWeekDate) + formatCharacter 'f' = Just (\_ opt -> (show2 (fromMaybe Nothing opt)) . div100 . (\(y,_,_) -> y) . toWeekDate) formatCharacter 'V' = Just (\_ opt -> (show2 (fromMaybe (Just '0') opt)) . (\(_,w,_) -> w) . toWeekDate) formatCharacter 'u' = Just (\_ _ -> show . (\(_,_,d) -> d) . toWeekDate) diff --git a/Test/TestFormat.hs b/Test/TestFormat.hs index c063847..fe5f375 100644 --- a/Test/TestFormat.hs +++ b/Test/TestFormat.hs @@ -70,17 +70,34 @@ times :: [UTCTime] times = [baseTime0] ++ (fmap getDay [0..23]) ++ (fmap getDay [0..100]) ++ (fmap getYearP1 years) ++ (fmap getYearP2 years) ++ (fmap getYearP3 years) ++ (fmap getYearP4 years) +padN :: Int -> Char -> String -> String +padN n _ s | n <= (length s) = s +padN n c s = (replicate (n - length s) c) ++ s + +unixWorkarounds :: String -> String -> String +unixWorkarounds "%_Y" s = padN 4 ' ' s +unixWorkarounds "%0Y" s = padN 4 '0' s +unixWorkarounds "%_C" s = padN 2 ' ' s +unixWorkarounds "%0C" s = padN 2 '0' s +unixWorkarounds "%_G" s = padN 4 ' ' s +unixWorkarounds "%0G" s = padN 4 '0' s +unixWorkarounds "%_f" s = padN 2 ' ' s +unixWorkarounds "%0f" s = padN 2 '0' s +unixWorkarounds _ s = s + compareFormat :: String -> (String -> String) -> String -> TimeZone -> UTCTime -> Test compareFormat testname modUnix fmt zone time = let ctime = utcToZonedTime zone time haskellText = formatTime locale fmt ctime in ioTest (testname ++ ": " ++ (show fmt) ++ " of " ++ (show ctime)) $ do - unixText <- fmap modUnix (unixFormatTime fmt zone time) - return $ diff unixText haskellText + unixText <- unixFormatTime fmt zone time + let expectedText = unixWorkarounds fmt (modUnix unixText) + return $ diff expectedText haskellText -- as found in http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html -- plus FgGklz +-- f not supported -- P not always supported -- s time-zone dependent chars :: [Char] From git at git.haskell.org Mon Feb 20 21:15:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:15:22 +0000 (UTC) Subject: [commit: packages/time] format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis: fixed some parsing issues; more test sorting out (3d0480a) Message-ID: <20170220211522.4DBD93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/3d0480ac7ea30169cc5b3f5e3d39aa45f9bd80b8 >--------------------------------------------------------------- commit 3d0480ac7ea30169cc5b3f5e3d39aa45f9bd80b8 Author: Ashley Yakeley Date: Sat Nov 24 03:47:35 2012 -0800 fixed some parsing issues; more test sorting out Ignore-this: d08009aa11f8a8919041b57651193763 darcs-hash:20121124114735-ac6dd-252292144b82f3ec98609cdc344de145d123a3a1 >--------------------------------------------------------------- 3d0480ac7ea30169cc5b3f5e3d39aa45f9bd80b8 Data/Time/Format/Parse.hs | 176 +++++++++++++++++++++++++++++----------------- Test/AddDaysRef.hs | 1 + Test/ClipDatesRef.hs | 1 + Test/LongWeekYearsRef.hs | 1 + Test/TAI_UTC_DAT.hs | 1 + Test/TestCalendarsRef.hs | 1 + Test/TestEasterRef.hs | 1 + Test/TestMonthDayRef.hs | 1 + Test/TestParseDAT_Ref.hs | 1 + Test/TestParseTime.hs | 82 +++++++++++++-------- Test/TestTimeRef.hs | 1 + Test/TestUtil.hs | 7 +- 12 files changed, 174 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 3d0480ac7ea30169cc5b3f5e3d39aa45f9bd80b8 From git at git.haskell.org Mon Feb 20 21:15:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:15:26 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: test warning on 32-bit systems (63896a3) Message-ID: <20170220211526.5AB4B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/63896a3379e35c635487ecb0c8ca90fb0debb6f4 >--------------------------------------------------------------- commit 63896a3379e35c635487ecb0c8ca90fb0debb6f4 Author: Ashley Yakeley Date: Sun Nov 25 02:18:39 2012 -0800 test warning on 32-bit systems Ignore-this: 8b699d17f9112b170580414a8b4a2b2 darcs-hash:20121125101839-ac6dd-953b3b0c939f02e528a3a8fb3fce55365e8839c4 >--------------------------------------------------------------- 63896a3379e35c635487ecb0c8ca90fb0debb6f4 Test.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Test.hs b/Test.hs index 27e2bee..855e73c 100644 --- a/Test.hs +++ b/Test.hs @@ -1,6 +1,11 @@ module Main where import Test.Framework import Test.Tests +import Foreign.C.Types main :: IO () -main = defaultMain tests +main = do + if (toRational (1000000000000 :: CTime)) /= (1000000000000 :: Rational) + then putStrLn "WARNING: Some tests will incorrectly fail due to a 32-bit time_t C type." + else return () + defaultMain tests From git at git.haskell.org Mon Feb 20 21:15:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:15:28 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: update haddock for format & parse (9b3c6c7) Message-ID: <20170220211528.62CB33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/9b3c6c7662ec88e8b2df1d43927027989668c6e3 >--------------------------------------------------------------- commit 9b3c6c7662ec88e8b2df1d43927027989668c6e3 Author: Ashley Yakeley Date: Sun Nov 25 02:54:34 2012 -0800 update haddock for format & parse Ignore-this: 5f710d4cf2071a3e93fe5b17729a72de darcs-hash:20121125105434-ac6dd-361778510fc0965617ec4b4f3316bc37adfb3ff7 >--------------------------------------------------------------- 9b3c6c7662ec88e8b2df1d43927027989668c6e3 Data/Time/Format.hs | 48 +++++++++++++++++++++++------------------------ Data/Time/Format/Parse.hs | 36 +++++++++++++++++++++-------------- 2 files changed, 46 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 9b3c6c7662ec88e8b2df1d43927027989668c6e3 From git at git.haskell.org Mon Feb 20 21:15:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:15:30 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: fix time.cabal (c5f3fdc) Message-ID: <20170220211530.6920D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/c5f3fdc94e0724af6bc91be94487e939d2211da6 >--------------------------------------------------------------- commit c5f3fdc94e0724af6bc91be94487e939d2211da6 Author: Ashley Yakeley Date: Sun Nov 25 03:12:24 2012 -0800 fix time.cabal Ignore-this: bac91d44100c3aab03e4ef2440ec3a9c darcs-hash:20121125111224-ac6dd-c7db079938d2688d6803332b742e4e02ff9abaaf >--------------------------------------------------------------- c5f3fdc94e0724af6bc91be94487e939d2211da6 configure.ac | 2 +- time.cabal | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index 927625a..82a1173 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([Haskell time package], [1.3], [ashley at semantic.org], [time]) +AC_INIT([Haskell time package], [1.4.0.2], [ashley at semantic.org], [time]) # Safety check: Ensure that we are in the correct source directory. AC_CONFIG_SRCDIR([include/HsTime.h]) diff --git a/time.cabal b/time.cabal index 7254d3b..0335d52 100644 --- a/time.cabal +++ b/time.cabal @@ -20,19 +20,20 @@ extra-source-files: include/HsConfigure.h include/HsTime.h include/HsTimeConfig.h.in - test/Makefile - test/*.hs - test/*.lhs - test/*.ref - test/*.dat - test/*.c - test/*.h + Test/*.hs + Test/*.lhs + Test/*.c + Test/*.h extra-tmp-files: config.log config.status autom4te.cache include/HsTimeConfig.h +source-repository head + type: darcs + location: http://code.haskell.org/time/ + library build-depends: base >= 4, From git at git.haskell.org Mon Feb 20 21:15:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:15:32 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: more fixing of time.cabal (d452222) Message-ID: <20170220211532.6F7553A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/d4522223d762136234793dbdef5c21bbb000143e >--------------------------------------------------------------- commit d4522223d762136234793dbdef5c21bbb000143e Author: Ashley Yakeley Date: Sun Nov 25 03:22:49 2012 -0800 more fixing of time.cabal Ignore-this: 589eeb82bf6e1c7a8a4513c924c2299a darcs-hash:20121125112249-ac6dd-dc7003a0bcdf8530d63fee170344b4513490e119 >--------------------------------------------------------------- d4522223d762136234793dbdef5c21bbb000143e time.cabal | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/time.cabal b/time.cabal index 0335d52..873a06a 100644 --- a/time.cabal +++ b/time.cabal @@ -10,7 +10,7 @@ synopsis: A time library description: A time library category: System build-type: Configure -cabal-version: >=1.16 +cabal-version: >=1.14 x-follows-version-policy: extra-source-files: @@ -36,7 +36,7 @@ source-repository head library build-depends: - base >= 4, + base >= 4 && < 5, deepseq >= 1.1, old-locale ghc-options: -Wall From git at git.haskell.org Mon Feb 20 21:15:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:15:36 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: use throwErrnoIfMinus1 gettimeofday for consistency in error handling (d575902) Message-ID: <20170220211536.7FD803A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/d575902c77c2697cc03e28a0f3e81fffbae7c7b6 >--------------------------------------------------------------- commit d575902c77c2697cc03e28a0f3e81fffbae7c7b6 Author: Dylan Simon Date: Fri Jan 25 18:59:54 2013 -0800 use throwErrnoIfMinus1 gettimeofday for consistency in error handling Ignore-this: fc81b9dd998c4e7c01a58d3e3a104cb8 darcs-hash:20130126025954-56c21-c94b312b53512f2202f5012b2abab5b2b8f4c05d >--------------------------------------------------------------- d575902c77c2697cc03e28a0f3e81fffbae7c7b6 Data/Time/Clock/CTimeval.hs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Data/Time/Clock/CTimeval.hs b/Data/Time/Clock/CTimeval.hs index 5e0ffdf..b0d8920 100644 --- a/Data/Time/Clock/CTimeval.hs +++ b/Data/Time/Clock/CTimeval.hs @@ -25,10 +25,8 @@ foreign import ccall unsafe "time.h gettimeofday" gettimeofday :: Ptr CTimeval - -- | Get the current POSIX time from the system clock. getCTimeval :: IO CTimeval getCTimeval = with (MkCTimeval 0 0) (\ptval -> do - result <- gettimeofday ptval nullPtr - if (result == 0) - then peek ptval - else fail ("error in gettimeofday: " ++ (show result)) + throwErrnoIfMinus1_ "gettimeofday" $ gettimeofday ptval nullPtr + peek ptval ) #endif From git at git.haskell.org Mon Feb 20 21:15:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:15:34 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Derive Typeable instances (222f71c) Message-ID: <20170220211534.762113A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/222f71c3c2d97dfcb68e2db171d57835695c91b5 >--------------------------------------------------------------- commit 222f71c3c2d97dfcb68e2db171d57835695c91b5 Author: jpm Date: Wed Nov 28 06:58:44 2012 -0800 Derive Typeable instances Ignore-this: d301bb00a270f5c27cf9bffc27f85828 darcs-hash:20121128145844-ddd07-279620f99a395c40ffc649ee93d3c5bee3e4e7d9 >--------------------------------------------------------------- 222f71c3c2d97dfcb68e2db171d57835695c91b5 Data/Time/Calendar/Days.hs | 5 +---- Data/Time/Clock/Scale.hs | 10 ++-------- Data/Time/Clock/TAI.hs | 5 +---- Data/Time/Clock/UTC.hs | 10 ++-------- Data/Time/LocalTime/LocalTime.hs | 10 ++-------- Data/Time/LocalTime/TimeOfDay.hs | 5 +---- Data/Time/LocalTime/TimeZone.hs | 5 +---- 7 files changed, 10 insertions(+), 40 deletions(-) diff --git a/Data/Time/Calendar/Days.hs b/Data/Time/Calendar/Days.hs index 6911833..9b535c0 100644 --- a/Data/Time/Calendar/Days.hs +++ b/Data/Time/Calendar/Days.hs @@ -18,7 +18,7 @@ import Data.Data newtype Day = ModifiedJulianDay {toModifiedJulianDay :: Integer} deriving (Eq,Ord #if LANGUAGE_DeriveDataTypeable #if LANGUAGE_Rank2Types - ,Data + ,Data, Typeable #endif #endif ) @@ -26,9 +26,6 @@ newtype Day = ModifiedJulianDay {toModifiedJulianDay :: Integer} deriving (Eq,Or instance NFData Day where rnf (ModifiedJulianDay a) = rnf a -instance Typeable Day where - typeOf _ = mkTyConApp (mkTyCon3 "time" "Data.Time.Calendar.Days" "Day") [] - -- necessary because H98 doesn't have "cunning newtype" derivation instance Enum Day where succ (ModifiedJulianDay a) = ModifiedJulianDay (succ a) diff --git a/Data/Time/Clock/Scale.hs b/Data/Time/Clock/Scale.hs index 237a77b..9e91795 100644 --- a/Data/Time/Clock/Scale.hs +++ b/Data/Time/Clock/Scale.hs @@ -25,7 +25,7 @@ import Data.Data newtype UniversalTime = ModJulianDate {getModJulianDate :: Rational} deriving (Eq,Ord #if LANGUAGE_DeriveDataTypeable #if LANGUAGE_Rank2Types - ,Data + ,Data, Typeable #endif #endif ) @@ -34,9 +34,6 @@ newtype UniversalTime = ModJulianDate {getModJulianDate :: Rational} deriving (E instance NFData UniversalTime where rnf (ModJulianDate a) = rnf a -instance Typeable UniversalTime where - typeOf _ = mkTyConApp (mkTyCon3 "time" "Data.Time.Clock.Scale" "UniversalTime") [] - -- | This is a length of time, as measured by a clock. -- Conversion functions will treat it as seconds. -- It has a precision of 10^-12 s. @@ -44,7 +41,7 @@ newtype DiffTime = MkDiffTime Pico deriving (Eq,Ord #if LANGUAGE_DeriveDataTypeable #if LANGUAGE_Rank2Types #if HAS_DataPico - ,Data + ,Data, Typeable #else #endif #endif @@ -54,9 +51,6 @@ newtype DiffTime = MkDiffTime Pico deriving (Eq,Ord -- necessary because H98 doesn't have "cunning newtype" derivation instance NFData DiffTime -- FIXME: Data.Fixed had no NFData instances yet at time of writing -instance Typeable DiffTime where - typeOf _ = mkTyConApp (mkTyCon3 "time" "Data.Time.Clock.Scale" "DiffTime") [] - -- necessary because H98 doesn't have "cunning newtype" derivation instance Enum DiffTime where succ (MkDiffTime a) = MkDiffTime (succ a) diff --git a/Data/Time/Clock/TAI.hs b/Data/Time/Clock/TAI.hs index 5e6bfef..271f750 100644 --- a/Data/Time/Clock/TAI.hs +++ b/Data/Time/Clock/TAI.hs @@ -30,7 +30,7 @@ newtype AbsoluteTime = MkAbsoluteTime {unAbsoluteTime :: DiffTime} deriving (Eq, #if LANGUAGE_DeriveDataTypeable #if LANGUAGE_Rank2Types #if HAS_DataPico - ,Data + ,Data, Typeable #endif #endif #endif @@ -39,9 +39,6 @@ newtype AbsoluteTime = MkAbsoluteTime {unAbsoluteTime :: DiffTime} deriving (Eq, instance NFData AbsoluteTime where rnf (MkAbsoluteTime a) = rnf a -instance Typeable AbsoluteTime where - typeOf _ = mkTyConApp (mkTyCon3 "time" "Data.Time.Clock.TAI" "AbsoluteTime") [] - instance Show AbsoluteTime where show t = show (utcToLocalTime utc (taiToUTCTime (const 0) t)) ++ " TAI" -- ugly, but standard apparently diff --git a/Data/Time/Clock/UTC.hs b/Data/Time/Clock/UTC.hs index da1ecc2..3ba3309 100644 --- a/Data/Time/Clock/UTC.hs +++ b/Data/Time/Clock/UTC.hs @@ -36,7 +36,7 @@ data UTCTime = UTCTime { #if LANGUAGE_DeriveDataTypeable #if LANGUAGE_Rank2Types #if HAS_DataPico - deriving (Data) + deriving (Data, Typeable) #endif #endif #endif @@ -44,9 +44,6 @@ data UTCTime = UTCTime { instance NFData UTCTime where rnf (UTCTime d t) = d `deepseq` t `deepseq` () -instance Typeable UTCTime where - typeOf _ = mkTyConApp (mkTyCon3 "time" "Data.Time.Clock.UTC" "UTCTime") [] - instance Eq UTCTime where (UTCTime da ta) == (UTCTime db tb) = (da == db) && (ta == tb) @@ -65,7 +62,7 @@ newtype NominalDiffTime = MkNominalDiffTime Pico deriving (Eq,Ord #if LANGUAGE_DeriveDataTypeable #if LANGUAGE_Rank2Types #if HAS_DataPico - ,Data + ,Data, Typeable #endif #endif #endif @@ -74,9 +71,6 @@ newtype NominalDiffTime = MkNominalDiffTime Pico deriving (Eq,Ord -- necessary because H98 doesn't have "cunning newtype" derivation instance NFData NominalDiffTime -- FIXME: Data.Fixed had no NFData instances yet at time of writing -instance Typeable NominalDiffTime where - typeOf _ = mkTyConApp (mkTyCon3 "time" "Data.Time.Clock.UTC" "NominalDiffTime") [] - instance Enum NominalDiffTime where succ (MkNominalDiffTime a) = MkNominalDiffTime (succ a) pred (MkNominalDiffTime a) = MkNominalDiffTime (pred a) diff --git a/Data/Time/LocalTime/LocalTime.hs b/Data/Time/LocalTime/LocalTime.hs index 02f06a4..b32af80 100644 --- a/Data/Time/LocalTime/LocalTime.hs +++ b/Data/Time/LocalTime/LocalTime.hs @@ -34,7 +34,7 @@ data LocalTime = LocalTime { #if LANGUAGE_DeriveDataTypeable #if LANGUAGE_Rank2Types #if HAS_DataPico - ,Data + ,Data, Typeable #endif #endif #endif @@ -43,9 +43,6 @@ data LocalTime = LocalTime { instance NFData LocalTime where rnf (LocalTime d t) = d `deepseq` t `deepseq` () -instance Typeable LocalTime where - typeOf _ = mkTyConApp (mkTyCon3 "time" "Data.Time.LocalTime.LocalTime" "LocalTime") [] - instance Show LocalTime where show (LocalTime d t) = (showGregorian d) ++ " " ++ (show t) @@ -78,7 +75,7 @@ data ZonedTime = ZonedTime { #if LANGUAGE_DeriveDataTypeable #if LANGUAGE_Rank2Types #if HAS_DataPico - deriving (Data) + deriving (Data, Typeable) #endif #endif #endif @@ -86,9 +83,6 @@ data ZonedTime = ZonedTime { instance NFData ZonedTime where rnf (ZonedTime lt z) = lt `deepseq` z `deepseq` () -instance Typeable ZonedTime where - typeOf _ = mkTyConApp (mkTyCon3 "time" "Data.Time.LocalTime.LocalTime" "ZonedTime") [] - utcToZonedTime :: TimeZone -> UTCTime -> ZonedTime utcToZonedTime zone time = ZonedTime (utcToLocalTime zone time) zone diff --git a/Data/Time/LocalTime/TimeOfDay.hs b/Data/Time/LocalTime/TimeOfDay.hs index 8fdf539..93c0c70 100644 --- a/Data/Time/LocalTime/TimeOfDay.hs +++ b/Data/Time/LocalTime/TimeOfDay.hs @@ -33,7 +33,7 @@ data TimeOfDay = TimeOfDay { #if LANGUAGE_DeriveDataTypeable #if LANGUAGE_Rank2Types #if HAS_DataPico - ,Data + ,Data, Typeable #endif #endif #endif @@ -42,9 +42,6 @@ data TimeOfDay = TimeOfDay { instance NFData TimeOfDay where rnf (TimeOfDay h m s) = h `deepseq` m `deepseq` s `seq` () -- FIXME: Data.Fixed had no NFData instances yet at time of writing -instance Typeable TimeOfDay where - typeOf _ = mkTyConApp (mkTyCon3 "time" "Data.Time.LocalTime.TimeOfDay" "TimeOfDay") [] - -- | Hour zero midnight :: TimeOfDay midnight = TimeOfDay 0 0 0 diff --git a/Data/Time/LocalTime/TimeZone.hs b/Data/Time/LocalTime/TimeZone.hs index 689288f..fa70026 100644 --- a/Data/Time/LocalTime/TimeZone.hs +++ b/Data/Time/LocalTime/TimeZone.hs @@ -36,7 +36,7 @@ data TimeZone = TimeZone { } deriving (Eq,Ord #if LANGUAGE_DeriveDataTypeable #if LANGUAGE_Rank2Types - ,Data + ,Data, Typeable #endif #endif ) @@ -44,9 +44,6 @@ data TimeZone = TimeZone { instance NFData TimeZone where rnf (TimeZone m so n) = m `deepseq` so `deepseq` n `deepseq` () -instance Typeable TimeZone where - typeOf _ = mkTyConApp (mkTyCon3 "time" "Data.Time.LocalTime.TimeZone" "TimeZone") [] - -- | Create a nameless non-summer timezone for this number of minutes minutesToTimeZone :: Int -> TimeZone minutesToTimeZone m = TimeZone m False "" From git at git.haskell.org Mon Feb 20 21:15:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:15:38 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Make getTimeZone cross-platform consistent by always considering the TZ environment variable. (9926c4a) Message-ID: <20170220211538.861D93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/9926c4aae23dc11afb018175a15e505da4e73e73 >--------------------------------------------------------------- commit 9926c4aae23dc11afb018175a15e505da4e73e73 Author: oconnorr Date: Mon Jun 10 15:22:54 2013 -0700 Make getTimeZone cross-platform consistent by always considering the TZ environment variable. Ignore-this: 98f02c84c56cc5f77aa96e3f9d9e90fc The current behaviour of getTimeZone is system dependent. On Linux, using glibc we get the following result: $ ghc -package time-1.4 -e 'System.Posix.Env.putEnv "TZ=EST5EDT" >> Data.Time.getCurrentTimeZone >>= print >> System.Posix.Env.putEnv "TZ=PST8PDT" >> Data.Time.getCurrentTimeZone >>= print' EDT EDT Under MacOS X we get a different result $ ghc -package time-1.4 -e 'System.Posix.Env.putEnv "TZ=EST5EDT" >> Data.Time.getCurrentTimeZone >>= print >> System.Posix.Env.putEnv "TZ=PST8PDT" >> Data.Time.getCurrentTimeZone >>= print' EDT PDT The underlying problem is that POSIX does not fully specify the behaviour of localtime_r, upon which getTimeZone relies. POSIX.1-2008 says: Unlike localtime(), the localtime_r() function is not required to set tzname. "not required" means that localtime_r may or may not set tzname. MacOS X's behaviour sets tzname on every call to localtime_r. On the other hand, Linux, using glibc, the behaviour of localtime_r is outstandingly complicated. Upon the first call to localtime_r (or more techincially upon the first call to tzset_internal) it will set tzname based upon the value in the TZ environment variable, but upon subsequent calls, localtime_r will *not* set the tzname. This leads to the bizzare behaviour under Linux whereby the value used by getTimeZone (and getCurrentTimeZone) will always use the value of the TZ environment variable during the first call, and it is impossible to change it again. The only workaround available to a Haskell programer is to call tzset, which is can only be found in another package. This patch calls tzset() before each call to localtime_r() which forces tzname to be set from the TZ enviroment call. The result is that on all platforms one gets the sane result of $ ghc -package time-1.4.1 -e 'System.Posix.Env.putEnv "TZ=EST5EDT" >> Data.Time.getCurrentTimeZone >>= print >> System.Posix.Env.putEnv "TZ=PST8PDT" >> Data.Time.getCurrentTimeZone >>= print' EDT PDT darcs-hash:20130610222254-a4c94-e18c93b079fcee2becc635ed32a2ce3c34f9276e >--------------------------------------------------------------- 9926c4aae23dc11afb018175a15e505da4e73e73 cbits/HsTime.c | 1 + time.cabal | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cbits/HsTime.c b/cbits/HsTime.c index dacb1d4..e8a1155 100644 --- a/cbits/HsTime.c +++ b/cbits/HsTime.c @@ -5,6 +5,7 @@ long int get_current_timezone_seconds (time_t t,int* pdst,char const* * pname) { #if HAVE_LOCALTIME_R struct tm tmd; + tzset(); struct tm* ptm = localtime_r(&t,&tmd); #else struct tm* ptm = localtime(&t); diff --git a/time.cabal b/time.cabal index 873a06a..5e38d2a 100644 --- a/time.cabal +++ b/time.cabal @@ -1,5 +1,5 @@ name: time -version: 1.4.0.2 +version: 1.4.1 stability: stable license: BSD3 license-file: LICENSE From git at git.haskell.org Mon Feb 20 21:15:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:15:40 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Regression test for getTimeZone. (27173fc) Message-ID: <20170220211540.8D2F33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/27173fcefbcaf8d699a3929585758597191ca313 >--------------------------------------------------------------- commit 27173fcefbcaf8d699a3929585758597191ca313 Author: oconnorr Date: Fri Jun 14 12:19:45 2013 -0700 Regression test for getTimeZone. Ignore-this: e113a43c80f89126aa12b2fdcd73ae9f The localtime_r call made from getTimeZone may or may not perform a tzset(). In particular, in glibc, a tzset() will only be performed the first time a process runs localtime_r. This added regression test will fail on implementations like glibc that only perform a tzset() on the first call to localtime_r. A fix to make getTimeZone always call tzset() can be found in patch: [Make getTimeZone cross-platform consistent by always considering the TZ environment variable. oconnorr at google.com**20130610222254 darcs-hash:20130614191945-a4c94-8b89e390a71d3b46bf56997ad103bec7a5144f13 >--------------------------------------------------------------- 27173fcefbcaf8d699a3929585758597191ca313 Test/TestTimeZone.hs | 17 +++++++++++++++++ Test/Tests.hs | 4 +++- time.cabal | 5 +++-- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/Test/TestTimeZone.hs b/Test/TestTimeZone.hs new file mode 100644 index 0000000..8e79baa --- /dev/null +++ b/Test/TestTimeZone.hs @@ -0,0 +1,17 @@ +{-# OPTIONS -Wall -Werror #-} + +module Test.TestTimeZone where + +import Data.Time +import System.Posix.Env (putEnv) +import Test.TestUtil + +testTimeZone :: Test +testTimeZone = ioTest "getTimeZone respects TZ env var" $ do + putEnv "TZ=UTC+0" + zone1 <- getTimeZone epoch + putEnv "TZ=EST+5" + zone2 <- getTimeZone epoch + return $ diff False (zone1 == zone2) + where + epoch = UTCTime (ModifiedJulianDay 0) 0 diff --git a/Test/Tests.hs b/Test/Tests.hs index 512b64e..3900e45 100644 --- a/Test/Tests.hs +++ b/Test/Tests.hs @@ -13,6 +13,7 @@ import Test.TestMonthDay import Test.TestParseDAT import Test.TestParseTime import Test.TestTime +import Test.TestTimeZone tests :: [Test] tests = [ addDaysTest @@ -25,4 +26,5 @@ tests = [ addDaysTest , testMonthDay , testParseDAT , testParseTime - , testTime ] + , testTime + , testTimeZone ] diff --git a/time.cabal b/time.cabal index 5e38d2a..e1f7d79 100644 --- a/time.cabal +++ b/time.cabal @@ -114,8 +114,9 @@ test-suite tests old-locale, process, QuickCheck >= 2.5.1, - test-framework >= 0.6.1, - test-framework-quickcheck2 >= 0.2.12 + test-framework >= 0.6.1 && < 0.7, + test-framework-quickcheck2 >= 0.2.12, + unix main-is: Test.hs other-modules: Test.Tests From git at git.haskell.org Mon Feb 20 21:15:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:15:42 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: detabify cbits (a4fbbed) Message-ID: <20170220211542.94C423A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/a4fbbedf1bb8190ed6ac57b0fc89750b581be31a >--------------------------------------------------------------- commit a4fbbedf1bb8190ed6ac57b0fc89750b581be31a Author: Ashley Yakeley Date: Sun Jun 23 17:35:10 2013 -0700 detabify cbits Ignore-this: bc6e127a254ec4e39b03ad5d601ee014 darcs-hash:20130624003510-ac6dd-f1537ad91adc4bd50fc1b222d6af0311ccde7a06 >--------------------------------------------------------------- a4fbbedf1bb8190ed6ac57b0fc89750b581be31a cbits/HsTime.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/cbits/HsTime.c b/cbits/HsTime.c index e8a1155..cfafb27 100644 --- a/cbits/HsTime.c +++ b/cbits/HsTime.c @@ -4,38 +4,38 @@ long int get_current_timezone_seconds (time_t t,int* pdst,char const* * pname) { #if HAVE_LOCALTIME_R - struct tm tmd; - tzset(); - struct tm* ptm = localtime_r(&t,&tmd); + struct tm tmd; + tzset(); + struct tm* ptm = localtime_r(&t,&tmd); #else - struct tm* ptm = localtime(&t); + struct tm* ptm = localtime(&t); #endif - if (ptm) - { - int dst = ptm -> tm_isdst; - *pdst = dst; + if (ptm) + { + int dst = ptm -> tm_isdst; + *pdst = dst; #if HAVE_TM_ZONE - *pname = ptm -> tm_zone; - return ptm -> tm_gmtoff; + *pname = ptm -> tm_zone; + return ptm -> tm_gmtoff; #elif defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32) - // We don't have a better API to use on Windows, the logic to - // decide whether a given date/time falls within DST is - // implemented as part of localtime() in the CRT. This is_dst - // flag is all we need here. - *pname = dst ? _tzname[1] : _tzname[0]; - return - (dst ? _timezone - 3600 : _timezone); + // We don't have a better API to use on Windows, the logic to + // decide whether a given date/time falls within DST is + // implemented as part of localtime() in the CRT. This is_dst + // flag is all we need here. + *pname = dst ? _tzname[1] : _tzname[0]; + return - (dst ? _timezone - 3600 : _timezone); #else # if HAVE_TZNAME - *pname = *tzname; + *pname = *tzname; # else # error "Don't know how to get timezone name on your OS" # endif # if HAVE_DECL_ALTZONE - return dst ? altzone : timezone; + return dst ? altzone : timezone; # else - return dst ? timezone - 3600 : timezone; + return dst ? timezone - 3600 : timezone; # endif #endif // HAVE_TM_ZONE - } - else return 0x80000000; + } + else return 0x80000000; } From git at git.haskell.org Mon Feb 20 21:15:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:15:44 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Changes for Safe Haskell (7cc0d01) Message-ID: <20170220211544.9BAC03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/7cc0d011e7a956c62d1c6a5d83b302cb938693e4 >--------------------------------------------------------------- commit 7cc0d011e7a956c62d1c6a5d83b302cb938693e4 Author: omari Date: Thu Feb 13 15:24:36 2014 -0800 Changes for Safe Haskell Ignore-this: c7c8f97541bd4ab2620613c51fad3b91 Makes minimal necessary changes so that modules will infer as Safe for Safe Haskell. Some modules are using rewrite rules, which are not Safe; to these I added Trustworthy pragmas. The rewrite rules will continue to fire as normal, according to GHC's documentation. Other modules import Foreign. I changed these to import Foreign.Safe instead. I changed the time.cabal file so that the minimum version of Base is 4.4; that was the first version of Base that has the Foreign.Safe module. (base 4.4 came with GHC 7.2, which is over two years old.) darcs-hash:20140213232436-6ee4c-27c941c537e6ab258befe3e38b9d9266334e9421 >--------------------------------------------------------------- 7cc0d011e7a956c62d1c6a5d83b302cb938693e4 Data/Time/Clock/CTimeval.hs | 2 +- Data/Time/Clock/Scale.hs | 1 + Data/Time/Clock/UTC.hs | 1 + Data/Time/LocalTime/TimeZone.hs | 2 +- time.cabal | 2 +- 5 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Data/Time/Clock/CTimeval.hs b/Data/Time/Clock/CTimeval.hs index b0d8920..c8a692a 100644 --- a/Data/Time/Clock/CTimeval.hs +++ b/Data/Time/Clock/CTimeval.hs @@ -4,7 +4,7 @@ module Data.Time.Clock.CTimeval where #ifndef mingw32_HOST_OS -- All Unix-specific, this -import Foreign +import Foreign.Safe import Foreign.C data CTimeval = MkCTimeval CLong CLong diff --git a/Data/Time/Clock/Scale.hs b/Data/Time/Clock/Scale.hs index 9e91795..8ba7759 100644 --- a/Data/Time/Clock/Scale.hs +++ b/Data/Time/Clock/Scale.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE Trustworthy #-} {-# OPTIONS -fno-warn-unused-imports #-} #include "HsConfigure.h" -- #hide diff --git a/Data/Time/Clock/UTC.hs b/Data/Time/Clock/UTC.hs index 3ba3309..d41b8f8 100644 --- a/Data/Time/Clock/UTC.hs +++ b/Data/Time/Clock/UTC.hs @@ -1,4 +1,5 @@ {-# OPTIONS -fno-warn-unused-imports #-} +{-# LANGUAGE Trustworthy #-} #include "HsConfigure.h" -- #hide module Data.Time.Clock.UTC diff --git a/Data/Time/LocalTime/TimeZone.hs b/Data/Time/LocalTime/TimeZone.hs index fa70026..e9e4f5f 100644 --- a/Data/Time/LocalTime/TimeZone.hs +++ b/Data/Time/LocalTime/TimeZone.hs @@ -17,7 +17,7 @@ import Data.Time.Calendar.Private import Data.Time.Clock import Data.Time.Clock.POSIX -import Foreign +import Foreign.Safe import Foreign.C import Control.DeepSeq import Data.Typeable diff --git a/time.cabal b/time.cabal index e1f7d79..334fa08 100644 --- a/time.cabal +++ b/time.cabal @@ -36,7 +36,7 @@ source-repository head library build-depends: - base >= 4 && < 5, + base >= 4.4 && < 5, deepseq >= 1.1, old-locale ghc-options: -Wall From git at git.haskell.org Mon Feb 20 21:15:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:15:46 +0000 (UTC) Subject: [commit: packages/time] format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis: version 1.4.2; improve Makefile (1e92867) Message-ID: <20170220211546.A1EEC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/1e928677ff732d5355ef249faa4584caa2335bd9 >--------------------------------------------------------------- commit 1e928677ff732d5355ef249faa4584caa2335bd9 Author: Ashley Yakeley Date: Sun Mar 2 21:18:43 2014 -0800 version 1.4.2; improve Makefile Ignore-this: 9dcd1b4a4decdf6ea319f55849f97cbf darcs-hash:20140303051843-ac6dd-949729bef614ae9d022ba7a96419719ef92c2f0a >--------------------------------------------------------------- 1e928677ff732d5355ef249faa4584caa2335bd9 Makefile | 11 +++++++---- time.cabal | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 4fe6afb..73f55fd 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -default: install +default: clean test install sdist # Building @@ -17,8 +17,11 @@ test: build haddock: configure cabal haddock -install: build test haddock - cabal install --user --enable-library-profiling --enable-executable-profiling +copy: build test haddock + cabal copy + +install: + cabal install --user --ghc-options=-Werror --enable-library-profiling --enable-executable-profiling sdist: clean configure cabal sdist @@ -26,4 +29,4 @@ sdist: clean configure # switch off intermediate file deletion .SECONDARY: -.PHONY: default clean configure build haddock install test sdist +.PHONY: default clean configure build haddock copy install test sdist diff --git a/time.cabal b/time.cabal index 334fa08..fad816c 100644 --- a/time.cabal +++ b/time.cabal @@ -1,5 +1,5 @@ name: time -version: 1.4.1 +version: 1.4.2 stability: stable license: BSD3 license-file: LICENSE From git at git.haskell.org Mon Feb 20 21:15:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:15:48 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: tzset regardless of HAVE_LOCALTIME_R (a22e848) Message-ID: <20170220211548.A91813A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/a22e848dde29581cecb03a6cea70a73ee6a405cf >--------------------------------------------------------------- commit a22e848dde29581cecb03a6cea70a73ee6a405cf Author: Ashley Yakeley Date: Sat Jul 19 13:37:05 2014 -0700 tzset regardless of HAVE_LOCALTIME_R Ignore-this: a03b607f40ed91382348da78649d6f62 darcs-hash:20140719203705-ac6dd-dd66552eab0b730816f50cf4a30add39a633240b >--------------------------------------------------------------- a22e848dde29581cecb03a6cea70a73ee6a405cf cbits/HsTime.c | 2 +- time.cabal | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cbits/HsTime.c b/cbits/HsTime.c index cfafb27..646fac6 100644 --- a/cbits/HsTime.c +++ b/cbits/HsTime.c @@ -3,9 +3,9 @@ long int get_current_timezone_seconds (time_t t,int* pdst,char const* * pname) { + tzset(); #if HAVE_LOCALTIME_R struct tm tmd; - tzset(); struct tm* ptm = localtime_r(&t,&tmd); #else struct tm* ptm = localtime(&t); diff --git a/time.cabal b/time.cabal index fad816c..b02f0e3 100644 --- a/time.cabal +++ b/time.cabal @@ -1,5 +1,5 @@ name: time -version: 1.4.2 +version: 1.4.2.1 stability: stable license: BSD3 license-file: LICENSE From git at git.haskell.org Mon Feb 20 21:15:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:15:50 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: use latest test library (656b250) Message-ID: <20170220211550.AF4E13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/656b250ba24a60e15abb440ec302bd479270bae4 >--------------------------------------------------------------- commit 656b250ba24a60e15abb440ec302bd479270bae4 Author: Ashley Yakeley Date: Sat Jul 19 20:57:07 2014 -0700 use latest test library >--------------------------------------------------------------- 656b250ba24a60e15abb440ec302bd479270bae4 Test/TestUtil.hs | 3 ++- time.cabal | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Test/TestUtil.hs b/Test/TestUtil.hs index bb2b58e..b711f93 100644 --- a/Test/TestUtil.hs +++ b/Test/TestUtil.hs @@ -9,8 +9,9 @@ module Test.TestUtil import Test.Framework import Test.Framework.Providers.API import Test.Framework.Providers.QuickCheck2 +import Data.Typeable -data Result = Pass | Fail String +data Result = Pass | Fail String deriving Typeable instance Show Result where show Pass = "passed" diff --git a/time.cabal b/time.cabal index b02f0e3..34cdd78 100644 --- a/time.cabal +++ b/time.cabal @@ -114,8 +114,8 @@ test-suite tests old-locale, process, QuickCheck >= 2.5.1, - test-framework >= 0.6.1 && < 0.7, - test-framework-quickcheck2 >= 0.2.12, + test-framework >= 0.8, + test-framework-quickcheck2 >= 0.3, unix main-is: Test.hs other-modules: From git at git.haskell.org Mon Feb 20 21:15:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:15:52 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: .gitignore (08a0531) Message-ID: <20170220211552.B77F53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/08a053130822da4933c8a289277a6dbd103e308b >--------------------------------------------------------------- commit 08a053130822da4933c8a289277a6dbd103e308b Author: Ashley Yakeley Date: Sat Jul 19 20:58:50 2014 -0700 .gitignore >--------------------------------------------------------------- 08a053130822da4933c8a289277a6dbd103e308b .darcs-boring | 70 ----------------------------------------------------------- .gitignore | 6 +++++ 2 files changed, 6 insertions(+), 70 deletions(-) diff --git a/.darcs-boring b/.darcs-boring deleted file mode 100644 index ca040f7..0000000 --- a/.darcs-boring +++ /dev/null @@ -1,70 +0,0 @@ -# Boring file regexps: -\.hi$ -\.o$ -\.p_hi$ -\.p_o$ -\.raw-hs$ -_split$ -\.a$ -(^|/)dist$ -(^|/)package.conf.inplace$ -(^|/)package.conf.installed$ -(^|/)\.depend$ -(^|/)\.setup-config$ -(^|/)\.installed-pkg-config$ -\.haddock$ -^build$ -\.xcodeproj/.*\.pbxuser$ -\.xcodeproj/.*\.mode1$ -\.o\.cmd$ -\.ko$ -\.ko\.cmd$ -\.mod\.c$ -(^|/)\.tmp_versions($|/) -(^|/)CVS($|/) -(^|/)RCS($|/) -~$ -#(^|/)\.[^/] -(^|/)_darcs($|/) -\.bak$ -\.BAK$ -\.orig$ -(^|/)vssver\.scc$ -\.swp$ -(^|/)MT($|/) -(^|/)\{arch\}($|/) -(^|/).arch-ids($|/) -(^|/), -\.class$ -\.prof$ -(^|/)\.DS_Store$ -(^|/)BitKeeper($|/) -(^|/)ChangeSet($|/) -(^|/)\.svn($|/) -\.py[co]$ -\# -\.cvsignore$ -^Private($|/) -(^|/)Thumbs\.db$ -^configure$ -^config\..*$ -^autom4te.cache($|/) -^include/HsTimeConfig\.h$ -^include/HsTimeConfig\.h.in$ -^test/.*\.out$ -^test/.*\.run$ -^test/AddDays$ -^test/ClipDates$ -^test/ConvertBack$ -^test/CurrentTime$ -^test/LongWeekYears$ -^test/ShowDST$ -^test/TestCalendars$ -^test/TestEaster$ -^test/TestFormat$ -^test/TestMonthDay$ -^test/TestParseDAT$ -^test/TestParseTime$ -^test/TestTime$ -^test/TimeZone$ -^test/TimeZone.ref$ diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dead619 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +dist/ +configure +autom4te.cache/ +config.* +include/HsTimeConfig.h +include/HsTimeConfig.h.in From git at git.haskell.org Mon Feb 20 21:15:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:15:54 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: time.cabal: note homepage and source-repository (dff2fcf) Message-ID: <20170220211554.BD95B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/dff2fcfa89e87de2ea67b701ad2b6d3ad090aa3e >--------------------------------------------------------------- commit dff2fcfa89e87de2ea67b701ad2b6d3ad090aa3e Author: Ashley Yakeley Date: Sat Jul 19 21:54:57 2014 -0700 time.cabal: note homepage and source-repository >--------------------------------------------------------------- dff2fcfa89e87de2ea67b701ad2b6d3ad090aa3e time.cabal | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/time.cabal b/time.cabal index 34cdd78..1b71b00 100644 --- a/time.cabal +++ b/time.cabal @@ -5,7 +5,7 @@ license: BSD3 license-file: LICENSE author: Ashley Yakeley maintainer: -homepage: http://semantic.org/TimeLib/ +homepage: https://github.com/haskell/time synopsis: A time library description: A time library category: System @@ -31,8 +31,8 @@ extra-tmp-files: include/HsTimeConfig.h source-repository head - type: darcs - location: http://code.haskell.org/time/ + type: git + location: https://github.com/haskell/time library build-depends: From git at git.haskell.org Mon Feb 20 21:15:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:15:56 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: more parse tests (757c5c4) Message-ID: <20170220211556.C5FD33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/757c5c4e7293c01a2dee8e59b86bbccbe57c814b >--------------------------------------------------------------- commit 757c5c4e7293c01a2dee8e59b86bbccbe57c814b Author: Ashley Yakeley Date: Sun Jul 20 20:59:52 2014 -0700 more parse tests >--------------------------------------------------------------- 757c5c4e7293c01a2dee8e59b86bbccbe57c814b Test/TestParseTime.hs | 120 ++++++++++++++++++++++++++++++++------------------ 1 file changed, 76 insertions(+), 44 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 757c5c4e7293c01a2dee8e59b86bbccbe57c814b From git at git.haskell.org Mon Feb 20 21:15:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:15:58 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Data.Time.Format.Parse re-exports System.Locale. Bump to 1.5 for this. (f1853e7) Message-ID: <20170220211558.CD69C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/f1853e7ecb323df073606a028898fdfe0a5933e6 >--------------------------------------------------------------- commit f1853e7ecb323df073606a028898fdfe0a5933e6 Author: Ashley Yakeley Date: Sun Aug 10 02:46:16 2014 -0700 Data.Time.Format.Parse re-exports System.Locale. Bump to 1.5 for this. >--------------------------------------------------------------- f1853e7ecb323df073606a028898fdfe0a5933e6 Data/Time/Format.hs | 1 - Data/Time/Format/Parse.hs | 4 +++- Test/TestEaster.hs | 2 -- Test/TestFormat.hs | 1 - Test/TestParseTime.hs | 1 - time.cabal | 2 +- 6 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Data/Time/Format.hs b/Data/Time/Format.hs index 21bce35..d071c30 100644 --- a/Data/Time/Format.hs +++ b/Data/Time/Format.hs @@ -14,7 +14,6 @@ import Data.Time.Calendar.Private import Data.Time.Clock import Data.Time.Clock.POSIX -import System.Locale import Data.Maybe import Data.Char import Data.Fixed diff --git a/Data/Time/Format/Parse.hs b/Data/Time/Format/Parse.hs index f9cc33d..c0569ee 100644 --- a/Data/Time/Format/Parse.hs +++ b/Data/Time/Format/Parse.hs @@ -8,7 +8,9 @@ module Data.Time.Format.Parse #if LANGUAGE_Rank2Types parseTime, readTime, readsTime, #endif - ParseTime(..) + ParseTime(..), + -- * Locale + module System.Locale ) where import Data.Time.Clock.POSIX diff --git a/Test/TestEaster.hs b/Test/TestEaster.hs index 20c8889..afba44c 100644 --- a/Test/TestEaster.hs +++ b/Test/TestEaster.hs @@ -6,8 +6,6 @@ import Data.Time.Calendar.Easter import Data.Time.Calendar import Data.Time.Format -import System.Locale - import Test.TestUtil import Test.TestEasterRef diff --git a/Test/TestFormat.hs b/Test/TestFormat.hs index fe5f375..68b8d2f 100644 --- a/Test/TestFormat.hs +++ b/Test/TestFormat.hs @@ -5,7 +5,6 @@ module Test.TestFormat where import Data.Time import Data.Time.Clock.POSIX import Data.Char -import System.Locale import Foreign import Foreign.C import Control.Exception; diff --git a/Test/TestParseTime.hs b/Test/TestParseTime.hs index 7ddf400..fcb7421 100644 --- a/Test/TestParseTime.hs +++ b/Test/TestParseTime.hs @@ -10,7 +10,6 @@ import Data.Time import Data.Time.Calendar.OrdinalDate import Data.Time.Calendar.WeekDate import Data.Time.Clock.POSIX -import System.Locale import Test.QuickCheck hiding (Result,reason) import Test.QuickCheck.Property hiding (result) import Test.TestUtil hiding (Result) diff --git a/time.cabal b/time.cabal index 1b71b00..d41b553 100644 --- a/time.cabal +++ b/time.cabal @@ -1,5 +1,5 @@ name: time -version: 1.4.2.1 +version: 1.5 stability: stable license: BSD3 license-file: LICENSE From git at git.haskell.org Mon Feb 20 21:16:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:16:00 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: .Format.Parse: add parseTimeM parseTimeOrError readSTime readPTime, deprecate parseTime readTime readsTime (1a633e6) Message-ID: <20170220211600.D54C53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/1a633e6737ae45634619e2c9895c89848020bdec >--------------------------------------------------------------- commit 1a633e6737ae45634619e2c9895c89848020bdec Author: Ashley Yakeley Date: Sun Aug 10 03:19:27 2014 -0700 .Format.Parse: add parseTimeM parseTimeOrError readSTime readPTime, deprecate parseTime readTime readsTime >--------------------------------------------------------------- 1a633e6737ae45634619e2c9895c89848020bdec Data/Time/Format/Parse.hs | 95 +++++++++++++++++++++++++++++++++++------------ Test/TestFormat.hs | 10 ++--- Test/TestParseTime.hs | 89 +++++++++++++++++++++++++++++++------------- 3 files changed, 140 insertions(+), 54 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 1a633e6737ae45634619e2c9895c89848020bdec From git at git.haskell.org Mon Feb 20 21:16:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:16:02 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: clean up source (50ddcf7) Message-ID: <20170220211602.DCDA73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/50ddcf77f6ab8d6464e64422c0ac563c2b600423 >--------------------------------------------------------------- commit 50ddcf77f6ab8d6464e64422c0ac563c2b600423 Author: Ashley Yakeley Date: Sun Aug 17 19:21:51 2014 -0700 clean up source >--------------------------------------------------------------- 50ddcf77f6ab8d6464e64422c0ac563c2b600423 Data/Time/Format/Parse.hs | 0 Test/TestFormat.hs | 0 Test/TestParseTime.hs | 0 3 files changed, 0 insertions(+), 0 deletions(-) From git at git.haskell.org Mon Feb 20 21:16:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:16:04 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: TestParseTime: more tests (c732e4d) Message-ID: <20170220211604.E39433A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/c732e4d16d58ec1de790dc60afd7475c96641d89 >--------------------------------------------------------------- commit c732e4d16d58ec1de790dc60afd7475c96641d89 Author: Ashley Yakeley Date: Sun Aug 17 19:39:51 2014 -0700 TestParseTime: more tests >--------------------------------------------------------------- c732e4d16d58ec1de790dc60afd7475c96641d89 Test/TestParseTime.hs | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/Test/TestParseTime.hs b/Test/TestParseTime.hs index e53a016..97acfb6 100644 --- a/Test/TestParseTime.hs +++ b/Test/TestParseTime.hs @@ -63,25 +63,37 @@ readTest expected target = let name = show target in pureTest name result +readTestsParensSpaces :: forall a. (Eq a,Show a,Read a) => a -> String -> Test +readTestsParensSpaces expected target = testGroup target + [ + readTest [(expected,"")] $ target, + readTest [(expected,"")] $ "("++target++")", + readTest [(expected,"")] $ " ("++target++")", + readTest [(expected," ")] $ " ( "++target++" ) ", + readTest [(expected," ")] $ " (( "++target++" )) ", + readTest ([] :: [(a,String)]) $ "("++target, + readTest [(expected,")")] $ ""++target++")", + readTest [(expected,"")] $ "(("++target++"))", + readTest [(expected," ")] $ " ( ( "++target++" ) ) " + ] where + readOtherTypesTest :: Test readOtherTypesTest = testGroup "read other types" [ - readTest [(3,"")] "3", - readTest [(3,"")] "(3)", - readTest [(3,"")] " (3)", - readTest [(3," ")] " ( 3 ) ", - readTest [(3," ")] " (( 3 )) ", - readTest [("a","")] "(\"a\")", - readTest ([] :: [(String,String)]) "(\"a\"", - readTest [("a",")")] "\"a\")", - readTest [("a","")] "((\"a\"))", - readTest [("a"," ")] " ( ( \"a\" ) ) " - ] where + readTestsParensSpaces 3 "3", + readTestsParensSpaces "a" "\"a\"" + ] readTests :: Test readTests = testGroup "read times" [ - ] + readTestsParensSpaces testDay "1912-07-08", + readTestsParensSpaces testDay "1912-7-8", + readTestsParensSpaces testTimeOfDay "08:04:02", + readTestsParensSpaces testTimeOfDay "8:4:2" + ] where + testDay = fromGregorian 1912 7 8 + testTimeOfDay = TimeOfDay 8 4 2 simpleFormatTests :: Test simpleFormatTests = testGroup "simple" From git at git.haskell.org Mon Feb 20 21:16:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:16:06 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: move lib/test sources to separate directories (ad32d01) Message-ID: <20170220211606.ED9F83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/ad32d011138e7147236b0299cb0c2efb327e1f9d >--------------------------------------------------------------- commit ad32d011138e7147236b0299cb0c2efb327e1f9d Author: Ashley Yakeley Date: Sun Aug 17 20:00:05 2014 -0700 move lib/test sources to separate directories >--------------------------------------------------------------- ad32d011138e7147236b0299cb0c2efb327e1f9d Makefile | 2 +- {Data => lib/Data}/Time.hs | 0 {Data => lib/Data}/Time/Calendar.hs | 0 {Data => lib/Data}/Time/Calendar/Days.hs | 0 {Data => lib/Data}/Time/Calendar/Easter.hs | 0 {Data => lib/Data}/Time/Calendar/Gregorian.hs | 0 {Data => lib/Data}/Time/Calendar/Julian.hs | 0 {Data => lib/Data}/Time/Calendar/JulianYearDay.hs | 0 {Data => lib/Data}/Time/Calendar/MonthDay.hs | 0 {Data => lib/Data}/Time/Calendar/OrdinalDate.hs | 0 {Data => lib/Data}/Time/Calendar/Private.hs | 0 {Data => lib/Data}/Time/Calendar/WeekDate.hs | 0 {Data => lib/Data}/Time/Clock.hs | 0 {Data => lib/Data}/Time/Clock/CTimeval.hs | 0 {Data => lib/Data}/Time/Clock/POSIX.hs | 0 {Data => lib/Data}/Time/Clock/Scale.hs | 0 {Data => lib/Data}/Time/Clock/TAI.hs | 0 {Data => lib/Data}/Time/Clock/UTC.hs | 0 {Data => lib/Data}/Time/Clock/UTCDiff.hs | 0 {Data => lib/Data}/Time/Format.hs | 0 {Data => lib/Data}/Time/Format/Parse.hs | 0 {Data => lib/Data}/Time/LocalTime.hs | 0 {Data => lib/Data}/Time/LocalTime/LocalTime.hs | 0 {Data => lib/Data}/Time/LocalTime/TimeOfDay.hs | 0 {Data => lib/Data}/Time/LocalTime/TimeZone.hs | 0 Test.hs => test/Test.hs | 0 {Test => test/Test}/AddDays.hs | 0 {Test => test/Test}/AddDaysRef.hs | 0 {Test => test/Test}/ClipDates.hs | 0 {Test => test/Test}/ClipDatesRef.hs | 0 {Test => test/Test}/ConvertBack.hs | 0 {Test => test/Test}/CurrentTime.hs | 0 {Test => test/Test}/LongWeekYears.hs | 0 {Test => test/Test}/LongWeekYearsRef.hs | 0 {Test => test/Test}/RealToFracBenchmark.hs | 0 {Test => test/Test}/ShowDST.hs | 0 {Test => test/Test}/TAI_UTC_DAT.hs | 0 {Test => test/Test}/TestCalendars.hs | 0 {Test => test/Test}/TestCalendarsRef.hs | 0 {Test => test/Test}/TestEaster.hs | 0 {Test => test/Test}/TestEasterRef.hs | 0 {Test => test/Test}/TestFormat.hs | 0 {Test => test/Test}/TestFormatStuff.c | 0 {Test => test/Test}/TestFormatStuff.h | 0 {Test => test/Test}/TestMonthDay.hs | 0 {Test => test/Test}/TestMonthDayRef.hs | 0 {Test => test/Test}/TestParseDAT.hs | 0 {Test => test/Test}/TestParseDAT_Ref.hs | 0 {Test => test/Test}/TestParseTime.hs | 0 {Test => test/Test}/TestTime.hs | 0 {Test => test/Test}/TestTimeRef.hs | 0 {Test => test/Test}/TestTimeZone.hs | 0 {Test => test/Test}/TestUtil.hs | 0 {Test => test/Test}/Tests.hs | 0 {Test => test/Test}/TimeZone.hs | 0 {Test => test/Test}/UseCases.lhs | 0 time.cabal | 32 ++++------------------- 57 files changed, 6 insertions(+), 28 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 ad32d011138e7147236b0299cb0c2efb327e1f9d From git at git.haskell.org Mon Feb 20 21:16:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:16:09 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: further file moves and .cabal fixes (0939180) Message-ID: <20170220211609.03C143A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/093918017defa1bf5c56c6ca5f31c6bc03c52de5 >--------------------------------------------------------------- commit 093918017defa1bf5c56c6ca5f31c6bc03c52de5 Author: Ashley Yakeley Date: Sun Aug 17 20:09:24 2014 -0700 further file moves and .cabal fixes >--------------------------------------------------------------- 093918017defa1bf5c56c6ca5f31c6bc03c52de5 configure.ac | 4 +- {cbits => lib/cbits}/HsTime.c | 0 {include => lib/include}/HsConfigure.h | 0 {include => lib/include}/HsTime.h | 0 lib/include/HsTimeConfig.h | 87 ++++++++++++++++++++++++++++++++++ lib/include/HsTimeConfig.h.in | 86 +++++++++++++++++++++++++++++++++ lib/include/HsTimeConfig.h.in~ | 86 +++++++++++++++++++++++++++++++++ time.cabal | 23 ++++----- 8 files changed, 270 insertions(+), 16 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 093918017defa1bf5c56c6ca5f31c6bc03c52de5 From git at git.haskell.org Mon Feb 20 21:16:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:16:13 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Makefile: slight fix (077665f) Message-ID: <20170220211613.11A993A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/077665f054fb140b8e0ef8afbdf03eec1b627a30 >--------------------------------------------------------------- commit 077665f054fb140b8e0ef8afbdf03eec1b627a30 Author: Ashley Yakeley Date: Mon Aug 18 00:54:48 2014 -0700 Makefile: slight fix >--------------------------------------------------------------- 077665f054fb140b8e0ef8afbdf03eec1b627a30 Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index afe2b5b..7b37eb9 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ build: configure cabal build --ghc-options=-Werror test: configure - cabal test --test-option=--hide-successes --test-option=--color + cabal test --ghc-options=-Werror --test-option=--hide-successes --test-option=--color haddock: configure cabal haddock From git at git.haskell.org Mon Feb 20 21:16:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:16:11 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: remove odd file (185cb99) Message-ID: <20170220211611.0A2DF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/185cb993a5b2d0bda1d214d9d811ae68456440e6 >--------------------------------------------------------------- commit 185cb993a5b2d0bda1d214d9d811ae68456440e6 Author: Ashley Yakeley Date: Sun Aug 17 20:11:34 2014 -0700 remove odd file >--------------------------------------------------------------- 185cb993a5b2d0bda1d214d9d811ae68456440e6 lib/include/HsTimeConfig.h.in~ | 86 ------------------------------------------ 1 file changed, 86 deletions(-) diff --git a/lib/include/HsTimeConfig.h.in~ b/lib/include/HsTimeConfig.h.in~ deleted file mode 100644 index 618088e..0000000 --- a/lib/include/HsTimeConfig.h.in~ +++ /dev/null @@ -1,86 +0,0 @@ -/* include/HsTimeConfig.h.in. Generated from configure.ac by autoheader. */ - -/* Define to 1 if you have the declaration of `altzone', and to 0 if you - don't. */ -#undef HAVE_DECL_ALTZONE - -/* Define to 1 if you have the declaration of `tzname', and to 0 if you don't. - */ -#undef HAVE_DECL_TZNAME - -/* Define to 1 if you have the `gmtime_r' function. */ -#undef HAVE_GMTIME_R - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the `localtime_r' function. */ -#undef HAVE_LOCALTIME_R - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if `tm_zone' is a member of `struct tm'. */ -#undef HAVE_STRUCT_TM_TM_ZONE - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TIME_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_TIME_H - -/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use - `HAVE_STRUCT_TM_TM_ZONE' instead. */ -#undef HAVE_TM_ZONE - -/* Define to 1 if you don't have `tm_zone' but do have the external array - `tzname'. */ -#undef HAVE_TZNAME - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Define to 1 if you can safely include both and . */ -#undef TIME_WITH_SYS_TIME - -/* Define to 1 if your declares `struct tm'. */ -#undef TM_IN_SYS_TIME From git at git.haskell.org Mon Feb 20 21:16:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:16:15 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: .Format.Parse: be cleverer about skipping spaces (42afd39) Message-ID: <20170220211615.195FC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/42afd39fc919636b86c7b4764d0e610afce208ef >--------------------------------------------------------------- commit 42afd39fc919636b86c7b4764d0e610afce208ef Author: Ashley Yakeley Date: Mon Aug 18 01:48:59 2014 -0700 .Format.Parse: be cleverer about skipping spaces >--------------------------------------------------------------- 42afd39fc919636b86c7b4764d0e610afce208ef lib/Data/Time/Format/Parse.hs | 2 +- test/Test/TestParseTime.hs | 67 +++++++++++++++++++++++++++++-------------- 2 files changed, 47 insertions(+), 22 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 42afd39fc919636b86c7b4764d0e610afce208ef From git at git.haskell.org Mon Feb 20 21:16:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:16:17 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: .Format.Parse: fix spaces parsing (f964074) Message-ID: <20170220211617.20A903A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/f964074acda92566bc15e25f31bb5c752b17c002 >--------------------------------------------------------------- commit f964074acda92566bc15e25f31bb5c752b17c002 Author: Ashley Yakeley Date: Mon Aug 18 02:03:25 2014 -0700 .Format.Parse: fix spaces parsing >--------------------------------------------------------------- f964074acda92566bc15e25f31bb5c752b17c002 lib/Data/Time/Format/Parse.hs | 2 +- test/Test/TestParseTime.hs | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/Data/Time/Format/Parse.hs b/lib/Data/Time/Format/Parse.hs index e750f9a..5b0b762 100644 --- a/lib/Data/Time/Format/Parse.hs +++ b/lib/Data/Time/Format/Parse.hs @@ -131,7 +131,7 @@ readPTime :: ParseTime t => -> String -- ^ Format string -> ReadP t readPTime False l f = readPOnlyTime l f -readPTime True l f = readPOnlyTime l f <++ (skipSpaces >> readPOnlyTime l f) +readPTime True l f = (skipSpaces >> readPOnlyTime l f) <++ readPOnlyTime l f -- | Parse a time value given a format string (without allowing leading whitespace). See 'parseTimeM' for details. readPOnlyTime :: ParseTime t => diff --git a/test/Test/TestParseTime.hs b/test/Test/TestParseTime.hs index 0fb9711..b0e9ef2 100644 --- a/test/Test/TestParseTime.hs +++ b/test/Test/TestParseTime.hs @@ -147,9 +147,13 @@ particularParseTests :: Test particularParseTests = testGroup "particular" [ spacingTests epoch "%Q" "", + spacingTests epoch "%Q" ".0", spacingTests epoch "%k" " 0", spacingTests epoch "%M" "00", - spacingTests (TimeZone 120 False "") "%Z" "+0200" + spacingTests epoch "%m" "01", + spacingTests (TimeZone 120 False "") "%z" "+0200", + spacingTests (TimeZone 120 False "") "%Z" "+0200", + spacingTests (TimeZone (-480) False "PST") "%Z" "PST" ] parseYMD :: Day -> Test From git at git.haskell.org Mon Feb 20 21:16:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:16:19 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: remove dependency on old-locale (907cbc2) Message-ID: <20170220211619.29B853A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/907cbc2c7c3fcecea255028fb895c3f5b144a6eb >--------------------------------------------------------------- commit 907cbc2c7c3fcecea255028fb895c3f5b144a6eb Author: Ashley Yakeley Date: Sat Aug 23 21:56:11 2014 -0700 remove dependency on old-locale >--------------------------------------------------------------- 907cbc2c7c3fcecea255028fb895c3f5b144a6eb lib/Data/Time/Format/Locale.hs | 78 ++++++++++++++++++++++++++++++++++++++++++ lib/Data/Time/Format/Parse.hs | 4 +-- lib/System/Locale.hs | 5 +++ time.cabal | 8 ++--- 4 files changed, 89 insertions(+), 6 deletions(-) diff --git a/lib/Data/Time/Format/Locale.hs b/lib/Data/Time/Format/Locale.hs new file mode 100644 index 0000000..11ec05a --- /dev/null +++ b/lib/Data/Time/Format/Locale.hs @@ -0,0 +1,78 @@ +-- Note: this file derives from old-locale:System.Locale.hs, which is copyright (c) The University of Glasgow 2001 + +module Data.Time.Format.Locale ( + + TimeLocale(..) + + , defaultTimeLocale + + , iso8601DateFormat + , rfc822DateFormat + ) +where + +import Prelude + +data TimeLocale = TimeLocale { + -- |full and abbreviated week days + wDays :: [(String, String)], + -- |full and abbreviated months + months :: [(String, String)], + intervals :: [(String, String)], + -- |AM\/PM symbols + amPm :: (String, String), + -- |formatting strings + dateTimeFmt, dateFmt, + timeFmt, time12Fmt :: String + } deriving (Eq, Ord, Show) + +defaultTimeLocale :: TimeLocale +defaultTimeLocale = TimeLocale { + wDays = [("Sunday", "Sun"), ("Monday", "Mon"), + ("Tuesday", "Tue"), ("Wednesday", "Wed"), + ("Thursday", "Thu"), ("Friday", "Fri"), + ("Saturday", "Sat")], + + months = [("January", "Jan"), ("February", "Feb"), + ("March", "Mar"), ("April", "Apr"), + ("May", "May"), ("June", "Jun"), + ("July", "Jul"), ("August", "Aug"), + ("September", "Sep"), ("October", "Oct"), + ("November", "Nov"), ("December", "Dec")], + + intervals = [ ("year","years") + , ("month", "months") + , ("day","days") + , ("hour","hours") + , ("min","mins") + , ("sec","secs") + , ("usec","usecs") + ], + + amPm = ("AM", "PM"), + dateTimeFmt = "%a %b %e %H:%M:%S %Z %Y", + dateFmt = "%m/%d/%y", + timeFmt = "%H:%M:%S", + time12Fmt = "%I:%M:%S %p" + } + + +{- | Construct format string according to . + +The @Maybe String@ argument allows to supply an optional time specification. E.g.: + +@ +'iso8601DateFormat' Nothing == "%Y-%m-%d" -- i.e. @/YYYY-MM-DD/@ +'iso8601DateFormat' (Just "%H:%M:%S") == "%Y-%m-%dT%H:%M:%S" -- i.e. @/YYYY-MM-DD/T/HH:MM:SS/@ +@ +-} + +iso8601DateFormat :: Maybe String -> String +iso8601DateFormat mTimeFmt = + "%Y-%m-%d" ++ case mTimeFmt of + Nothing -> "" + Just fmt -> 'T' : fmt + +-- | Format string according to . +rfc822DateFormat :: String +rfc822DateFormat = "%a, %_d %b %Y %H:%M:%S %Z" diff --git a/lib/Data/Time/Format/Parse.hs b/lib/Data/Time/Format/Parse.hs index 5b0b762..82c48df 100644 --- a/lib/Data/Time/Format/Parse.hs +++ b/lib/Data/Time/Format/Parse.hs @@ -11,7 +11,7 @@ module Data.Time.Format.Parse #endif ParseTime(..), -- * Locale - module System.Locale + module Data.Time.Format.Locale ) where import Data.Time.Clock.POSIX @@ -29,7 +29,7 @@ import Data.Fixed import Data.List import Data.Maybe import Data.Ratio -import System.Locale +import Data.Time.Format.Locale #if LANGUAGE_Rank2Types import Text.ParserCombinators.ReadP hiding (char, string) #endif diff --git a/lib/System/Locale.hs b/lib/System/Locale.hs new file mode 100644 index 0000000..88961cc --- /dev/null +++ b/lib/System/Locale.hs @@ -0,0 +1,5 @@ +module System.Locale +{-# DEPRECATED "Use Data.Time.Format instead" #-} +(module Data.Time.Format.Locale) +where +import Data.Time.Format.Locale diff --git a/time.cabal b/time.cabal index 881fd7d..23a388f 100644 --- a/time.cabal +++ b/time.cabal @@ -36,8 +36,7 @@ library hs-source-dirs: lib build-depends: base >= 4.4 && < 5, - deepseq >= 1.1, - old-locale + deepseq >= 1.1 ghc-options: -Wall default-language: Haskell2010 if impl(ghc) @@ -64,7 +63,8 @@ library Data.Time.Clock.TAI, Data.Time.LocalTime, Data.Time.Format, - Data.Time + Data.Time, + System.Locale default-extensions: CPP c-sources: lib/cbits/HsTime.c other-modules: @@ -80,6 +80,7 @@ library Data.Time.LocalTime.TimeOfDay, Data.Time.LocalTime.LocalTime, Data.Time.Format.Parse + Data.Time.Format.Locale include-dirs: lib/include if os(windows) install-includes: @@ -108,7 +109,6 @@ test-suite tests build-depends: base, deepseq, - old-locale, time == 1.5, QuickCheck >= 2.5.1, test-framework >= 0.8, From git at git.haskell.org Mon Feb 20 21:16:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:16:21 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: LICENSE: some code U. Glasgow (635917c) Message-ID: <20170220211621.312AB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/635917c79260a6ddf890b2e2b5ff257bb029ff35 >--------------------------------------------------------------- commit 635917c79260a6ddf890b2e2b5ff257bb029ff35 Author: Ashley Yakeley Date: Sat Aug 23 22:10:18 2014 -0700 LICENSE: some code U. Glasgow >--------------------------------------------------------------- 635917c79260a6ddf890b2e2b5ff257bb029ff35 LICENSE | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LICENSE b/LICENSE index 485d7f6..34a3712 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ -TimeLib is Copyright (c) Ashley Yakeley, 2004-2010. -All rights reserved. +TimeLib is Copyright (c) Ashley Yakeley, 2004-2014. All rights reserved. +Certain sections are Copyright 2004, The University Court of the University of Glasgow. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: From git at git.haskell.org Mon Feb 20 21:16:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:16:23 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: remove System.Locale (e4ea1d9) Message-ID: <20170220211623.37B293A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/e4ea1d9be7cb20339b1140937f2db01e5fe1d1a0 >--------------------------------------------------------------- commit e4ea1d9be7cb20339b1140937f2db01e5fe1d1a0 Author: Ashley Yakeley Date: Mon Aug 25 01:32:51 2014 -0700 remove System.Locale >--------------------------------------------------------------- e4ea1d9be7cb20339b1140937f2db01e5fe1d1a0 lib/System/Locale.hs | 5 ----- time.cabal | 3 +-- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/lib/System/Locale.hs b/lib/System/Locale.hs deleted file mode 100644 index 88961cc..0000000 --- a/lib/System/Locale.hs +++ /dev/null @@ -1,5 +0,0 @@ -module System.Locale -{-# DEPRECATED "Use Data.Time.Format instead" #-} -(module Data.Time.Format.Locale) -where -import Data.Time.Format.Locale diff --git a/time.cabal b/time.cabal index 23a388f..383267f 100644 --- a/time.cabal +++ b/time.cabal @@ -63,8 +63,7 @@ library Data.Time.Clock.TAI, Data.Time.LocalTime, Data.Time.Format, - Data.Time, - System.Locale + Data.Time default-extensions: CPP c-sources: lib/cbits/HsTime.c other-modules: From git at git.haskell.org Mon Feb 20 21:16:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:16:25 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: allow user control of parsing of time-zone names (dc4157a) Message-ID: <20170220211625.3F5B43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/dc4157a645c6a91803470a2e795008b680072586 >--------------------------------------------------------------- commit dc4157a645c6a91803470a2e795008b680072586 Author: Ashley Yakeley Date: Mon Aug 25 02:39:44 2014 -0700 allow user control of parsing of time-zone names >--------------------------------------------------------------- dc4157a645c6a91803470a2e795008b680072586 lib/Data/Time/Format/Locale.hs | 230 ++++++++++++++++++++++++++++++++++++++- lib/Data/Time/Format/Parse.hs | 238 +++-------------------------------------- 2 files changed, 241 insertions(+), 227 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 dc4157a645c6a91803470a2e795008b680072586 From git at git.haskell.org Mon Feb 20 21:16:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:16:27 +0000 (UTC) Subject: [commit: packages/time] format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis: parse single-letter "military" time zones; test parsing of all defaultLocale time zones. Test failure: "EAST" is there twice. (2e0c3f8) Message-ID: <20170220211627.46D043A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/2e0c3f84f91a22e6c7cf9ee77d3f823a3aeb9355 >--------------------------------------------------------------- commit 2e0c3f84f91a22e6c7cf9ee77d3f823a3aeb9355 Author: Ashley Yakeley Date: Mon Sep 1 20:34:22 2014 -0700 parse single-letter "military" time zones; test parsing of all defaultLocale time zones. Test failure: "EAST" is there twice. >--------------------------------------------------------------- 2e0c3f84f91a22e6c7cf9ee77d3f823a3aeb9355 lib/Data/Time/Format/Locale.hs | 2 -- lib/Data/Time/Format/Parse.hs | 16 +++++++++++++++- test/ShowDefaultTZAbbreviations.hs | 9 +++++++++ test/Test/TestParseTime.hs | 32 ++++++++++++++++++++++++++++++++ time.cabal | 8 ++++++++ 5 files changed, 64 insertions(+), 3 deletions(-) diff --git a/lib/Data/Time/Format/Locale.hs b/lib/Data/Time/Format/Locale.hs index 3708b8e..399cb25 100644 --- a/lib/Data/Time/Format/Locale.hs +++ b/lib/Data/Time/Format/Locale.hs @@ -210,8 +210,6 @@ _TIMEZONES_ = -- Universal Coordinated Time ,("UTC", (readTzOffset "+00:00", False)) -- Same as UTC - ,("Z", (readTzOffset "+00:00", False)) - -- Same as UTC ,("ZULU", (readTzOffset "+00:00", False)) -- Western European Time ,("WET", (readTzOffset "+00:00", False)) diff --git a/lib/Data/Time/Format/Parse.hs b/lib/Data/Time/Format/Parse.hs index 0064dda..07dc5b2 100644 --- a/lib/Data/Time/Format/Parse.hs +++ b/lib/Data/Time/Format/Parse.hs @@ -410,6 +410,18 @@ mkPico i f = fromInteger i + fromRational (f % 1000000000000) instance ParseTime LocalTime where buildTime l xs = LocalTime (buildTime l xs) (buildTime l xs) +enumDiff :: (Enum a) => a -> a -> Int +enumDiff a b = (fromEnum a) - (fromEnum b) + +getMilZoneHours :: Char -> Maybe Int +getMilZoneHours c | c < 'A' = Nothing +getMilZoneHours c | c <= 'I' = Just $ 1 + enumDiff c 'A' +getMilZoneHours 'J' = Nothing +getMilZoneHours c | c <= 'M' = Just $ 10 + enumDiff c 'K' +getMilZoneHours c | c <= 'Y' = Just $ (enumDiff 'N' c) - 1 +getMilZoneHours 'Z' = Just 0 +getMilZoneHours _ = Nothing + instance ParseTime TimeZone where buildTime l = foldl f (minutesToTimeZone 0) where @@ -420,7 +432,9 @@ instance ParseTime TimeZone where | isAlpha (head x) -> let y = up x in case find (\tz -> y == timeZoneName tz) (knownTimeZones l) of Just tz -> tz - Nothing -> TimeZone offset dst y + Nothing -> case y of + [yc] | Just hours <- getMilZoneHours yc -> TimeZone (hours * 60) False y + _ -> TimeZone offset dst y | otherwise -> zone _ -> t where zone = TimeZone (readTzOffset x) dst name diff --git a/test/ShowDefaultTZAbbreviations.hs b/test/ShowDefaultTZAbbreviations.hs new file mode 100644 index 0000000..fc24783 --- /dev/null +++ b/test/ShowDefaultTZAbbreviations.hs @@ -0,0 +1,9 @@ +module Main where + +import Data.Time + +showTZ :: TimeZone -> String +showTZ tz = (formatTime defaultTimeLocale "%Z %z " tz) ++ show (timeZoneSummerOnly tz) + +main :: IO () +main = mapM_ (\tz -> putStrLn (showTZ tz)) (knownTimeZones defaultTimeLocale) diff --git a/test/Test/TestParseTime.hs b/test/Test/TestParseTime.hs index b0e9ef2..26ee67d 100644 --- a/test/Test/TestParseTime.hs +++ b/test/Test/TestParseTime.hs @@ -27,6 +27,9 @@ testParseTime = testGroup "testParseTime" simpleFormatTests, extests, particularParseTests, + badParseTests, + defaultTimeZoneTests, + militaryTimeZoneTests, testGroup "properties" (fmap (\(n,prop) -> testProperty n prop) properties) ] @@ -156,6 +159,12 @@ particularParseTests = testGroup "particular" spacingTests (TimeZone (-480) False "PST") "%Z" "PST" ] +badParseTests :: Test +badParseTests = testGroup "bad" + [ + parseTest False (Nothing :: Maybe Day) "%Y" "" + ] + parseYMD :: Day -> Test parseYMD day = case toGregorian day of (y,m,d) -> parseTest False (Just day) "%Y%m%d" ((show y) ++ (show2 m) ++ (show2 d)) @@ -200,6 +209,29 @@ readsTest :: forall t. (Show t, Eq t, ParseTime t) => Maybe t -> String -> Strin readsTest (Just e) = readsTest' [(e,"")] readsTest Nothing = readsTest' ([] :: [(t,String)]) -} + +enumAdd :: (Enum a) => Int -> a -> a +enumAdd i a = toEnum (i + fromEnum a) + +getMilZoneLetter :: Int -> Char +getMilZoneLetter 0 = 'Z' +getMilZoneLetter h | h < 0 = enumAdd (negate h) 'M' +getMilZoneLetter h | h < 10 = enumAdd (h - 1) 'A' +getMilZoneLetter h = enumAdd (h - 10) 'K' + +getMilZone :: Int -> TimeZone +getMilZone hour = TimeZone (hour * 60) False [getMilZoneLetter hour] + +testParseTimeZone :: TimeZone -> Test +testParseTimeZone tz = parseTest False (Just tz) "%Z" (timeZoneName tz) + +defaultTimeZoneTests :: Test +defaultTimeZoneTests = testGroup "default time zones" (fmap testParseTimeZone (knownTimeZones defaultTimeLocale)) + +militaryTimeZoneTests :: Test +militaryTimeZoneTests = testGroup "military time zones" (fmap (testParseTimeZone . getMilZone) [-12 .. 12]) + + parse :: ParseTime t => Bool -> String -> String -> Maybe t parse sp f t = parseTimeM sp defaultTimeLocale f t diff --git a/time.cabal b/time.cabal index 383267f..b5c1638 100644 --- a/time.cabal +++ b/time.cabal @@ -89,6 +89,14 @@ library HsTime.h HsTimeConfig.h +test-suite ShowDefaultTZAbbreviations + hs-source-dirs: test + type: exitcode-stdio-1.0 + build-depends: + base, + time == 1.5 + main-is: ShowDefaultTZAbbreviations.hs + test-suite tests hs-source-dirs: test type: exitcode-stdio-1.0 From git at git.haskell.org Mon Feb 20 21:16:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:16:29 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: We're not in the time-zone business. defaultTimeLocale only has the time-zones mentioned in RFC 822. (f5ed156) Message-ID: <20170220211629.4E3393A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/f5ed15614b8950c1c31b031a50ce18755b652f0e >--------------------------------------------------------------- commit f5ed15614b8950c1c31b031a50ce18755b652f0e Author: Ashley Yakeley Date: Mon Sep 1 20:53:59 2014 -0700 We're not in the time-zone business. defaultTimeLocale only has the time-zones mentioned in RFC 822. >--------------------------------------------------------------- f5ed15614b8950c1c31b031a50ce18755b652f0e lib/Data/Time/Format/Locale.hs | 239 +++---------------------------------- test/ShowDefaultTZAbbreviations.hs | 2 +- 2 files changed, 19 insertions(+), 222 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 f5ed15614b8950c1c31b031a50ce18755b652f0e From git at git.haskell.org Mon Feb 20 21:16:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:16:31 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: remove "intervals" from TimeLocale (2be4631) Message-ID: <20170220211631.55B353A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/2be46316b8ae4849fb38555c36722116b71edd74 >--------------------------------------------------------------- commit 2be46316b8ae4849fb38555c36722116b71edd74 Author: Ashley Yakeley Date: Mon Sep 1 21:22:44 2014 -0700 remove "intervals" from TimeLocale >--------------------------------------------------------------- 2be46316b8ae4849fb38555c36722116b71edd74 lib/Data/Time/Format/Locale.hs | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/lib/Data/Time/Format/Locale.hs b/lib/Data/Time/Format/Locale.hs index e613fb9..ce0598a 100644 --- a/lib/Data/Time/Format/Locale.hs +++ b/lib/Data/Time/Format/Locale.hs @@ -18,7 +18,6 @@ data TimeLocale = TimeLocale { wDays :: [(String, String)], -- |full and abbreviated months months :: [(String, String)], - intervals :: [(String, String)], -- |AM\/PM symbols amPm :: (String, String), -- |formatting strings @@ -47,15 +46,6 @@ defaultTimeLocale = TimeLocale { ("September", "Sep"), ("October", "Oct"), ("November", "Nov"), ("December", "Dec")], - intervals = [ ("year","years") - , ("month", "months") - , ("day","days") - , ("hour","hours") - , ("min","mins") - , ("sec","secs") - , ("usec","usecs") - ], - amPm = ("AM", "PM"), dateTimeFmt = "%a %b %e %H:%M:%S %Z %Y", dateFmt = "%m/%d/%y", From git at git.haskell.org Mon Feb 20 21:16:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:16:33 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: doc quote cleanup (2a14cb0) Message-ID: <20170220211633.5D15F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/2a14cb05a1685d6f8ddc3725f811cbfd48a34915 >--------------------------------------------------------------- commit 2a14cb05a1685d6f8ddc3725f811cbfd48a34915 Author: Ashley Yakeley Date: Sun Sep 7 20:26:16 2014 -0700 doc quote cleanup >--------------------------------------------------------------- 2a14cb05a1685d6f8ddc3725f811cbfd48a34915 lib/Data/Time/Format/Locale.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Data/Time/Format/Locale.hs b/lib/Data/Time/Format/Locale.hs index ce0598a..2ce510f 100644 --- a/lib/Data/Time/Format/Locale.hs +++ b/lib/Data/Time/Format/Locale.hs @@ -30,7 +30,7 @@ data TimeLocale = TimeLocale { -- | Locale representing American usage. -- -- 'knownTimeZones' contains only the ten time-zones mentioned in RFC 822 sec. 5: --- "UT", "GMT", "EST", "EDT", "CST", "CDT", "MST", "MDT", "PST", "PDT". +-- \"UT\", \"GMT\", \"EST\", \"EDT\", \"CST\", \"CDT\", \"MST\", \"MDT\", \"PST\", \"PDT\". -- Note that the parsing functions will regardless parse single-letter military time-zones and +HHMM format. defaultTimeLocale :: TimeLocale defaultTimeLocale = TimeLocale { From git at git.haskell.org Mon Feb 20 21:16:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:16:35 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Added bug-reports line to time.cabal (892717c) Message-ID: <20170220211635.63D893A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/892717c506ebbeadf8b9f1f8eecf5e145cfed47e >--------------------------------------------------------------- commit 892717c506ebbeadf8b9f1f8eecf5e145cfed47e Author: Ashley Yakeley Date: Sun Sep 7 23:13:08 2014 -0700 Added bug-reports line to time.cabal >--------------------------------------------------------------- 892717c506ebbeadf8b9f1f8eecf5e145cfed47e time.cabal | 1 + 1 file changed, 1 insertion(+) diff --git a/time.cabal b/time.cabal index b5c1638..068219a 100644 --- a/time.cabal +++ b/time.cabal @@ -6,6 +6,7 @@ license-file: LICENSE author: Ashley Yakeley maintainer: homepage: https://github.com/haskell/time +bug-reports: https://github.com/haskell/time/issues synopsis: A time library description: A time library category: System From git at git.haskell.org Mon Feb 20 21:16:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:16:37 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Removed autogenerated HsTimeConfig.h* from repository, updated .gitignore. (82e0256) Message-ID: <20170220211637.6A4153A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/82e0256223e94b21dbffb0dc60d196fc54cb41a4 >--------------------------------------------------------------- commit 82e0256223e94b21dbffb0dc60d196fc54cb41a4 Author: Gintautas Miliauskas Date: Sun Oct 12 02:29:04 2014 +0200 Removed autogenerated HsTimeConfig.h* from repository, updated .gitignore. >--------------------------------------------------------------- 82e0256223e94b21dbffb0dc60d196fc54cb41a4 .gitignore | 11 ++++-- lib/include/HsTimeConfig.h | 87 ------------------------------------------- lib/include/HsTimeConfig.h.in | 86 ------------------------------------------ 3 files changed, 7 insertions(+), 177 deletions(-) diff --git a/.gitignore b/.gitignore index dead619..5880242 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,9 @@ -dist/ -configure +GNUmakefile autom4te.cache/ config.* -include/HsTimeConfig.h -include/HsTimeConfig.h.in +configure +dist/ +dist-install +ghc.mk +lib/include/HsTimeConfig.h +lib/include/HsTimeConfig.h.in diff --git a/lib/include/HsTimeConfig.h b/lib/include/HsTimeConfig.h deleted file mode 100644 index 769d94e..0000000 --- a/lib/include/HsTimeConfig.h +++ /dev/null @@ -1,87 +0,0 @@ -/* lib/include/HsTimeConfig.h. Generated from HsTimeConfig.h.in by configure. */ -/* lib/include/HsTimeConfig.h.in. Generated from configure.ac by autoheader. */ - -/* Define to 1 if you have the declaration of `altzone', and to 0 if you - don't. */ -#define HAVE_DECL_ALTZONE 0 - -/* Define to 1 if you have the declaration of `tzname', and to 0 if you don't. - */ -/* #undef HAVE_DECL_TZNAME */ - -/* Define to 1 if you have the `gmtime_r' function. */ -#define HAVE_GMTIME_R 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the `localtime_r' function. */ -#define HAVE_LOCALTIME_R 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if `tm_zone' is a member of `struct tm'. */ -#define HAVE_STRUCT_TM_TM_ZONE 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TIME_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_TIME_H 1 - -/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use - `HAVE_STRUCT_TM_TM_ZONE' instead. */ -#define HAVE_TM_ZONE 1 - -/* Define to 1 if you don't have `tm_zone' but do have the external array - `tzname'. */ -/* #undef HAVE_TZNAME */ - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "ashley at semantic.org" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "Haskell time package" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "Haskell time package 1.4.0.2" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "time" - -/* Define to the home page for this package. */ -#define PACKAGE_URL "" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "1.4.0.2" - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define to 1 if you can safely include both and . */ -#define TIME_WITH_SYS_TIME 1 - -/* Define to 1 if your declares `struct tm'. */ -/* #undef TM_IN_SYS_TIME */ diff --git a/lib/include/HsTimeConfig.h.in b/lib/include/HsTimeConfig.h.in deleted file mode 100644 index b6da5d3..0000000 --- a/lib/include/HsTimeConfig.h.in +++ /dev/null @@ -1,86 +0,0 @@ -/* lib/include/HsTimeConfig.h.in. Generated from configure.ac by autoheader. */ - -/* Define to 1 if you have the declaration of `altzone', and to 0 if you - don't. */ -#undef HAVE_DECL_ALTZONE - -/* Define to 1 if you have the declaration of `tzname', and to 0 if you don't. - */ -#undef HAVE_DECL_TZNAME - -/* Define to 1 if you have the `gmtime_r' function. */ -#undef HAVE_GMTIME_R - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the `localtime_r' function. */ -#undef HAVE_LOCALTIME_R - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if `tm_zone' is a member of `struct tm'. */ -#undef HAVE_STRUCT_TM_TM_ZONE - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TIME_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_TIME_H - -/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use - `HAVE_STRUCT_TM_TM_ZONE' instead. */ -#undef HAVE_TM_ZONE - -/* Define to 1 if you don't have `tm_zone' but do have the external array - `tzname'. */ -#undef HAVE_TZNAME - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Define to 1 if you can safely include both and . */ -#undef TIME_WITH_SYS_TIME - -/* Define to 1 if your declares `struct tm'. */ -#undef TM_IN_SYS_TIME From git at git.haskell.org Mon Feb 20 21:16:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:16:39 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Use `_tzset()` for non-POSIX Windows environments (9f12261) Message-ID: <20170220211639.717753A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/9f12261f5e81f70a50f29f0a43d487070cfa1ab4 >--------------------------------------------------------------- commit 9f12261f5e81f70a50f29f0a43d487070cfa1ab4 Author: Herbert Valerio Riedel Date: Sun Oct 12 10:26:50 2014 +0200 Use `_tzset()` for non-POSIX Windows environments When compiling with MinGW (which does not provide a full POSIX layer as opposed to CygWin) it's better to use the CRT's underscore-prefixed `_tzset()` variant to avoid linker issues as Microsoft considers the POSIX named `tzset()` function deprecated Further reading - http://msdn.microsoft.com/en-us/library/ms235384.aspx - http://stackoverflow.com/questions/23477746/what-are-the-posix-like-functions-in-msvcs-c-runtime This hopefully addresses #2 >--------------------------------------------------------------- 9f12261f5e81f70a50f29f0a43d487070cfa1ab4 lib/cbits/HsTime.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/cbits/HsTime.c b/lib/cbits/HsTime.c index 646fac6..e2be98a 100644 --- a/lib/cbits/HsTime.c +++ b/lib/cbits/HsTime.c @@ -3,7 +3,17 @@ long int get_current_timezone_seconds (time_t t,int* pdst,char const* * pname) { +#if defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32) + // When compiling with MinGW (which does not provide a full POSIX + // layer as opposed to CygWin) it's better to use the CRT's + // underscore-prefixed `_tzset()` variant to avoid linker issues + // as Microsoft considers the POSIX named `tzset()` function + // deprecated (see http://msdn.microsoft.com/en-us/library/ms235384.aspx) + _tzset(); +#else tzset(); +#endif + #if HAVE_LOCALTIME_R struct tm tmd; struct tm* ptm = localtime_r(&t,&tmd); From git at git.haskell.org Mon Feb 20 21:16:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:16:41 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Merge pull request #4 from hvr/pr-tzset (7633c67) Message-ID: <20170220211641.78A283A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/7633c6731670fe757ccdf66ccd889e8e12ded56d >--------------------------------------------------------------- commit 7633c6731670fe757ccdf66ccd889e8e12ded56d Merge: 892717c 9f12261 Author: Ashley Yakeley Date: Sun Oct 12 22:18:16 2014 -0700 Merge pull request #4 from hvr/pr-tzset Use `_tzset()` for non-POSIX Windows environments >--------------------------------------------------------------- 7633c6731670fe757ccdf66ccd889e8e12ded56d lib/cbits/HsTime.c | 10 ++++++++++ 1 file changed, 10 insertions(+) From git at git.haskell.org Mon Feb 20 21:16:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:16:43 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Merge pull request #3 from gintas/master (991e6be) Message-ID: <20170220211643.7F70F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/991e6be84974b02d7f968601ab02d2e2b3e14190 >--------------------------------------------------------------- commit 991e6be84974b02d7f968601ab02d2e2b3e14190 Merge: 7633c67 82e0256 Author: Ashley Yakeley Date: Sun Oct 12 22:19:57 2014 -0700 Merge pull request #3 from gintas/master Removed autogenerated HsTimeConfig.h* from repository, updated .gitignore >--------------------------------------------------------------- 991e6be84974b02d7f968601ab02d2e2b3e14190 .gitignore | 11 ++++-- lib/include/HsTimeConfig.h | 87 ------------------------------------------- lib/include/HsTimeConfig.h.in | 86 ------------------------------------------ 3 files changed, 7 insertions(+), 177 deletions(-) From git at git.haskell.org Mon Feb 20 21:16:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:16:45 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Add `Setup.hs` file (5511b80) Message-ID: <20170220211645.864853A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/5511b80a884ec945fabfa3ca7ae0107713e5000e >--------------------------------------------------------------- commit 5511b80a884ec945fabfa3ca7ae0107713e5000e Author: Herbert Valerio Riedel Date: Tue Oct 14 17:40:36 2014 +0200 Add `Setup.hs` file This adds a `Setup.hs` appropriate for `build-type: configure` and makes `cabal check` happy. >--------------------------------------------------------------- 5511b80a884ec945fabfa3ca7ae0107713e5000e Setup.hs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Setup.hs b/Setup.hs new file mode 100644 index 0000000..54f57d6 --- /dev/null +++ b/Setup.hs @@ -0,0 +1,6 @@ +module Main (main) where + +import Distribution.Simple + +main :: IO () +main = defaultMainWithHooks autoconfUserHooks From git at git.haskell.org Mon Feb 20 21:16:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:16:47 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Remove an extra division (52523fb) Message-ID: <20170220211647.8D0363A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/52523fbc2deebeb7137b76d66e68eea1c8c030c0 >--------------------------------------------------------------- commit 52523fbc2deebeb7137b76d66e68eea1c8c030c0 Author: treeowl Date: Fri Nov 7 00:14:37 2014 -0500 Remove an extra division Currently, GHC does not merge `div` with `mod` by itself; `divMod` saves time. Turn nested `if`s into `case`. >--------------------------------------------------------------- 52523fbc2deebeb7137b76d66e68eea1c8c030c0 lib/Data/Time/Calendar/WeekDate.hs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/lib/Data/Time/Calendar/WeekDate.hs b/lib/Data/Time/Calendar/WeekDate.hs index 1c76977..c7046b4 100644 --- a/lib/Data/Time/Calendar/WeekDate.hs +++ b/lib/Data/Time/Calendar/WeekDate.hs @@ -9,20 +9,19 @@ import Data.Time.Calendar.Private -- Note that \"Week\" years are not quite the same as Gregorian years, as the first day of the year is always a Monday. -- The first week of a year is the first week to contain at least four days in the corresponding Gregorian year. toWeekDate :: Day -> (Integer,Int,Int) -toWeekDate date@(ModifiedJulianDay mjd) = (y1,fromInteger (w1 + 1),fromInteger (mod d 7) + 1) where +toWeekDate date@(ModifiedJulianDay mjd) = (y1,fromInteger (w1 + 1),fromInteger d_mod_7 + 1) where + (d_div_7, d_mod_7) = d `divMod` 7 (y0,yd) = toOrdinalDate date d = mjd + 2 foo :: Integer -> Integer foo y = bar (toModifiedJulianDay (fromOrdinalDate y 6)) - bar k = (div d 7) - (div k 7) - w0 = bar (d - (toInteger yd) + 4) - (y1,w1) = if w0 == -1 - then (y0 - 1,foo (y0 - 1)) - else if w0 == 52 - then if (foo (y0 + 1)) == 0 - then (y0 + 1,0) - else (y0,w0) - else (y0,w0) + bar k = d_div_7 - k `div` 7 + (y1,w1) = case bar (d - toInteger yd + 4) of + -1 -> (y0 - 1, foo (y0 - 1)) + 52 -> if foo (y0 + 1) == 0 + then (y0 + 1, 0) + else (y0, 52) + w0 -> (y0, w0) -- | convert from ISO 8601 Week Date format. First argument is year, second week number (1-52 or 53), third day of week (1 for Monday to 7 for Sunday). -- Invalid week and day values will be clipped to the correct range. From git at git.haskell.org Mon Feb 20 21:16:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:16:49 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Merge pull request #10 from treeowl/master (b55b3c2) Message-ID: <20170220211649.948F73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/b55b3c260f042791d4c833d454cc576db9ddf574 >--------------------------------------------------------------- commit b55b3c260f042791d4c833d454cc576db9ddf574 Merge: 991e6be 52523fb Author: Ashley Yakeley Date: Fri Nov 7 02:14:54 2014 -0800 Merge pull request #10 from treeowl/master Remove an extra division >--------------------------------------------------------------- b55b3c260f042791d4c833d454cc576db9ddf574 lib/Data/Time/Calendar/WeekDate.hs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) From git at git.haskell.org Mon Feb 20 21:16:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:16:51 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Add support for `deepseq-1.4.0.0` (e6d887a) Message-ID: <20170220211651.9BB873A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/e6d887a4eb63a9971ba86d84222e809f3c20373c >--------------------------------------------------------------- commit e6d887a4eb63a9971ba86d84222e809f3c20373c Author: Herbert Valerio Riedel Date: Fri Nov 14 18:19:36 2014 +0100 Add support for `deepseq-1.4.0.0` `deepseq-1.4.0.0`'s major change is the default `rnf` method implementation (see haskell/deepseq#1 for details). This commit changes `time` not to rely on the default implementation and instead explicitly make use of `seq` like the old default implementation did. >--------------------------------------------------------------- e6d887a4eb63a9971ba86d84222e809f3c20373c lib/Data/Time/Clock/Scale.hs | 3 ++- lib/Data/Time/Clock/UTC.hs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Data/Time/Clock/Scale.hs b/lib/Data/Time/Clock/Scale.hs index 8ba7759..def28ce 100644 --- a/lib/Data/Time/Clock/Scale.hs +++ b/lib/Data/Time/Clock/Scale.hs @@ -50,7 +50,8 @@ newtype DiffTime = MkDiffTime Pico deriving (Eq,Ord ) -- necessary because H98 doesn't have "cunning newtype" derivation -instance NFData DiffTime -- FIXME: Data.Fixed had no NFData instances yet at time of writing +instance NFData DiffTime where -- FIXME: Data.Fixed had no NFData instances yet at time of writing + rnf dt = seq dt () -- necessary because H98 doesn't have "cunning newtype" derivation instance Enum DiffTime where diff --git a/lib/Data/Time/Clock/UTC.hs b/lib/Data/Time/Clock/UTC.hs index d41b8f8..4cb9447 100644 --- a/lib/Data/Time/Clock/UTC.hs +++ b/lib/Data/Time/Clock/UTC.hs @@ -70,7 +70,8 @@ newtype NominalDiffTime = MkNominalDiffTime Pico deriving (Eq,Ord ) -- necessary because H98 doesn't have "cunning newtype" derivation -instance NFData NominalDiffTime -- FIXME: Data.Fixed had no NFData instances yet at time of writing +instance NFData NominalDiffTime where -- FIXME: Data.Fixed had no NFData instances yet at time of writing + rnf ndt = seq ndt () instance Enum NominalDiffTime where succ (MkNominalDiffTime a) = MkNominalDiffTime (succ a) From git at git.haskell.org Mon Feb 20 21:16:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:16:53 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Merge pull request #11 from hvr/pr-deepseq14 (982ea8f) Message-ID: <20170220211653.A2B6C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/982ea8f68740a93399c78b0275d2a685d79c15cf >--------------------------------------------------------------- commit 982ea8f68740a93399c78b0275d2a685d79c15cf Merge: b55b3c2 e6d887a Author: Ashley Yakeley Date: Fri Nov 14 14:27:46 2014 -0800 Merge pull request #11 from hvr/pr-deepseq14 Add support for `deepseq-1.4.0.0` >--------------------------------------------------------------- 982ea8f68740a93399c78b0275d2a685d79c15cf lib/Data/Time/Clock/Scale.hs | 3 ++- lib/Data/Time/Clock/UTC.hs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) From git at git.haskell.org Mon Feb 20 21:16:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:16:55 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Merge pull request #5 from hvr/pr-setuphs (ab6475c) Message-ID: <20170220211655.AACF83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/ab6475cb94260f4303afbbd4b770cbd14ec2f57e >--------------------------------------------------------------- commit ab6475cb94260f4303afbbd4b770cbd14ec2f57e Merge: 982ea8f 5511b80 Author: Ashley Yakeley Date: Fri Nov 14 14:28:19 2014 -0800 Merge pull request #5 from hvr/pr-setuphs Add `Setup.hs` file >--------------------------------------------------------------- ab6475cb94260f4303afbbd4b770cbd14ec2f57e Setup.hs | 6 ++++++ 1 file changed, 6 insertions(+) From git at git.haskell.org Mon Feb 20 21:16:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:16:57 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: fix deprecation of base 4.8 (7513fad) Message-ID: <20170220211657.B13993A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/7513fad1f1f7a4c48fa20582dfe407427484f367 >--------------------------------------------------------------- commit 7513fad1f1f7a4c48fa20582dfe407427484f367 Author: David Terei Date: Fri Nov 21 11:32:55 2014 -0800 fix deprecation of base 4.8 >--------------------------------------------------------------- 7513fad1f1f7a4c48fa20582dfe407427484f367 lib/Data/Time/Clock/CTimeval.hs | 4 ++++ lib/Data/Time/LocalTime/TimeZone.hs | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/lib/Data/Time/Clock/CTimeval.hs b/lib/Data/Time/Clock/CTimeval.hs index c8a692a..012501a 100644 --- a/lib/Data/Time/Clock/CTimeval.hs +++ b/lib/Data/Time/Clock/CTimeval.hs @@ -4,7 +4,11 @@ module Data.Time.Clock.CTimeval where #ifndef mingw32_HOST_OS -- All Unix-specific, this +#if __GLASGOW_HASKELL__ >= 709 +import Foreign +#else import Foreign.Safe +#endif import Foreign.C data CTimeval = MkCTimeval CLong CLong diff --git a/lib/Data/Time/LocalTime/TimeZone.hs b/lib/Data/Time/LocalTime/TimeZone.hs index e9e4f5f..2efaebb 100644 --- a/lib/Data/Time/LocalTime/TimeZone.hs +++ b/lib/Data/Time/LocalTime/TimeZone.hs @@ -17,7 +17,11 @@ import Data.Time.Calendar.Private import Data.Time.Clock import Data.Time.Clock.POSIX +#if __GLASGOW_HASKELL__ >= 709 +import Foreign +#else import Foreign.Safe +#endif import Foreign.C import Control.DeepSeq import Data.Typeable From git at git.haskell.org Mon Feb 20 21:16:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:16:59 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Merge pull request #12 from dterei/base48-foreign-fix (8c7c106) Message-ID: <20170220211659.B81693A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/8c7c106e890141b0452fefdc1bc03191a2f70893 >--------------------------------------------------------------- commit 8c7c106e890141b0452fefdc1bc03191a2f70893 Merge: ab6475c 7513fad Author: Ashley Yakeley Date: Fri Nov 21 12:54:26 2014 -0800 Merge pull request #12 from dterei/base48-foreign-fix Fix deprecation of Foreign.Safe in base 4.8 >--------------------------------------------------------------- 8c7c106e890141b0452fefdc1bc03191a2f70893 lib/Data/Time/Clock/CTimeval.hs | 4 ++++ lib/Data/Time/LocalTime/TimeZone.hs | 4 ++++ 2 files changed, 8 insertions(+) From git at git.haskell.org Mon Feb 20 21:17:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:17:01 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Improve documentation of wdays in TimeLocale (9366adb) Message-ID: <20170220211701.BF58F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/9366adb2d12ff3ad4be7a40a160e231b5c650af7 >--------------------------------------------------------------- commit 9366adb2d12ff3ad4be7a40a160e231b5c650af7 Author: Lubomír Sedlář Date: Sat Dec 13 14:46:50 2014 +0100 Improve documentation of wdays in TimeLocale >--------------------------------------------------------------- 9366adb2d12ff3ad4be7a40a160e231b5c650af7 lib/Data/Time/Format/Locale.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Data/Time/Format/Locale.hs b/lib/Data/Time/Format/Locale.hs index 2ce510f..80ead81 100644 --- a/lib/Data/Time/Format/Locale.hs +++ b/lib/Data/Time/Format/Locale.hs @@ -14,7 +14,7 @@ where import Data.Time.LocalTime data TimeLocale = TimeLocale { - -- |full and abbreviated week days + -- |full and abbreviated week days, starting with Sunday wDays :: [(String, String)], -- |full and abbreviated months months :: [(String, String)], From git at git.haskell.org Mon Feb 20 21:17:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:17:03 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Merge pull request #14 from lubomir/document-locale (968ec05) Message-ID: <20170220211703.C67663A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/968ec057a457c970a3b1bb6e5a612f392f29734e >--------------------------------------------------------------- commit 968ec057a457c970a3b1bb6e5a612f392f29734e Merge: 8c7c106 9366adb Author: Gregory Collins Date: Sat Dec 13 22:01:27 2014 +0100 Merge pull request #14 from lubomir/document-locale Improve documentation of wdays in TimeLocale >--------------------------------------------------------------- 968ec057a457c970a3b1bb6e5a612f392f29734e lib/Data/Time/Format/Locale.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) From git at git.haskell.org Mon Feb 20 21:17:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:17:05 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: version 1.5.0.1 (8d3c90a) Message-ID: <20170220211705.CD73B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/8d3c90a420c8985dcc439766c028821cea7dc848 >--------------------------------------------------------------- commit 8d3c90a420c8985dcc439766c028821cea7dc848 Author: Ashley Yakeley Date: Sat Dec 13 14:32:01 2014 -0800 version 1.5.0.1 >--------------------------------------------------------------- 8d3c90a420c8985dcc439766c028821cea7dc848 time.cabal | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/time.cabal b/time.cabal index 068219a..c1a82be 100644 --- a/time.cabal +++ b/time.cabal @@ -1,5 +1,5 @@ name: time -version: 1.5 +version: 1.5.0.1 stability: stable license: BSD3 license-file: LICENSE @@ -95,7 +95,7 @@ test-suite ShowDefaultTZAbbreviations type: exitcode-stdio-1.0 build-depends: base, - time == 1.5 + time == 1.5.0.1 main-is: ShowDefaultTZAbbreviations.hs test-suite tests @@ -117,7 +117,7 @@ test-suite tests build-depends: base, deepseq, - time == 1.5, + time == 1.5.0.1, QuickCheck >= 2.5.1, test-framework >= 0.8, test-framework-quickcheck2 >= 0.3, From git at git.haskell.org Mon Feb 20 21:17:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:17:07 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Fix note about `%Y` padding. (a52561a) Message-ID: <20170220211707.D4D0D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/a52561acc09a942995f74bb8a0a2cd89f955c941 >--------------------------------------------------------------- commit a52561acc09a942995f74bb8a0a2cd89f955c941 Author: Björn Buckwalter Date: Sun Dec 14 22:16:52 2014 +0100 Fix note about `%Y` padding. >--------------------------------------------------------------- a52561acc09a942995f74bb8a0a2cd89f955c941 lib/Data/Time/Format.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Data/Time/Format.hs b/lib/Data/Time/Format.hs index d071c30..91dc93d 100644 --- a/lib/Data/Time/Format.hs +++ b/lib/Data/Time/Format.hs @@ -108,7 +108,7 @@ formatChar c locale mpado t = case (formatCharacter c) of -- -- [@%x@] as 'dateFmt' @locale@ (e.g. @%m\/%d\/%y@) -- --- [@%Y@] year, no padding. Note @%0y@ and @%_y@ pad to four chars +-- [@%Y@] year, no padding. Note @%0Y@ and @%_Y@ pad to four chars -- -- [@%y@] year of century, 0-padded to two chars, @00@ - @99@ -- From git at git.haskell.org Mon Feb 20 21:17:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:17:09 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Merge pull request #17 from bjornbm/patch-1 (ba160e5) Message-ID: <20170220211709.DBB2C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/ba160e582fc02a9d9b19b3235926c91cc390240f >--------------------------------------------------------------- commit ba160e582fc02a9d9b19b3235926c91cc390240f Merge: 8d3c90a a52561a Author: Ashley Yakeley Date: Sun Dec 14 13:47:10 2014 -0800 Merge pull request #17 from bjornbm/patch-1 Fix note about `%Y` padding. >--------------------------------------------------------------- ba160e582fc02a9d9b19b3235926c91cc390240f lib/Data/Time/Format.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) From git at git.haskell.org Mon Feb 20 21:17:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:17:11 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: De-tabify all Haskell source files. (63d2c82) Message-ID: <20170220211711.E6E6C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/63d2c8270de4ce32ae39e4d98ca1749ebb10ad94 >--------------------------------------------------------------- commit 63d2c8270de4ce32ae39e4d98ca1749ebb10ad94 Author: Erik de Castro Lopo Date: Tue Dec 23 14:43:30 2014 +1100 De-tabify all Haskell source files. This library is a GHC core library and GHC is now built using the -fwarn-tabs flag by default. De-tabifying this brings it into line with GHC standard practice. Also add -fwarn-tabs to the cabal file. Closes: https://github.com/haskell/time/issues/18 >--------------------------------------------------------------- 63d2c8270de4ce32ae39e4d98ca1749ebb10ad94 lib/Data/Time.hs | 8 +- lib/Data/Time/Calendar.hs | 4 +- lib/Data/Time/Calendar/Days.hs | 54 +++++----- lib/Data/Time/Calendar/Easter.hs | 20 ++-- lib/Data/Time/Calendar/Gregorian.hs | 34 +++---- lib/Data/Time/Calendar/Julian.hs | 28 +++--- lib/Data/Time/Calendar/JulianYearDay.hs | 36 +++---- lib/Data/Time/Calendar/MonthDay.hs | 32 +++--- lib/Data/Time/Calendar/OrdinalDate.hs | 80 +++++++-------- lib/Data/Time/Calendar/WeekDate.hs | 52 +++++----- lib/Data/Time/Clock.hs | 8 +- lib/Data/Time/Clock/CTimeval.hs | 24 ++--- lib/Data/Time/Clock/POSIX.hs | 6 +- lib/Data/Time/Clock/Scale.hs | 52 +++++----- lib/Data/Time/Clock/TAI.hs | 142 +++++++++++++-------------- lib/Data/Time/Clock/UTC.hs | 90 ++++++++--------- lib/Data/Time/Format.hs | 168 ++++++++++++++++---------------- lib/Data/Time/LocalTime.hs | 6 +- lib/Data/Time/LocalTime/LocalTime.hs | 48 ++++----- lib/Data/Time/LocalTime/TimeOfDay.hs | 50 +++++----- lib/Data/Time/LocalTime/TimeZone.hs | 44 ++++----- time.cabal | 2 +- 22 files changed, 494 insertions(+), 494 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 63d2c8270de4ce32ae39e4d98ca1749ebb10ad94 From git at git.haskell.org Mon Feb 20 21:17:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:17:13 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Merge pull request #19 from erikd/master (b0c04d9) Message-ID: <20170220211713.EF40D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/b0c04d9e15ecfe7c629212280bb790d383a3f784 >--------------------------------------------------------------- commit b0c04d9e15ecfe7c629212280bb790d383a3f784 Merge: ba160e5 63d2c82 Author: Ashley Yakeley Date: Mon Dec 22 20:10:45 2014 -0800 Merge pull request #19 from erikd/master De-tabify all Haskell source files. >--------------------------------------------------------------- b0c04d9e15ecfe7c629212280bb790d383a3f784 lib/Data/Time.hs | 8 +- lib/Data/Time/Calendar.hs | 4 +- lib/Data/Time/Calendar/Days.hs | 54 +++++----- lib/Data/Time/Calendar/Easter.hs | 20 ++-- lib/Data/Time/Calendar/Gregorian.hs | 34 +++---- lib/Data/Time/Calendar/Julian.hs | 28 +++--- lib/Data/Time/Calendar/JulianYearDay.hs | 36 +++---- lib/Data/Time/Calendar/MonthDay.hs | 32 +++--- lib/Data/Time/Calendar/OrdinalDate.hs | 80 +++++++-------- lib/Data/Time/Calendar/WeekDate.hs | 52 +++++----- lib/Data/Time/Clock.hs | 8 +- lib/Data/Time/Clock/CTimeval.hs | 24 ++--- lib/Data/Time/Clock/POSIX.hs | 6 +- lib/Data/Time/Clock/Scale.hs | 52 +++++----- lib/Data/Time/Clock/TAI.hs | 142 +++++++++++++-------------- lib/Data/Time/Clock/UTC.hs | 90 ++++++++--------- lib/Data/Time/Format.hs | 168 ++++++++++++++++---------------- lib/Data/Time/LocalTime.hs | 6 +- lib/Data/Time/LocalTime/LocalTime.hs | 48 ++++----- lib/Data/Time/LocalTime/TimeOfDay.hs | 50 +++++----- lib/Data/Time/LocalTime/TimeZone.hs | 44 ++++----- time.cabal | 2 +- 22 files changed, 494 insertions(+), 494 deletions(-) From git at git.haskell.org Mon Feb 20 21:17:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:17:16 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Convert README file to markdown. (5808f3e) Message-ID: <20170220211716.030603A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/5808f3eb013c67e1605678ed67323a557c03d835 >--------------------------------------------------------------- commit 5808f3eb013c67e1605678ed67323a557c03d835 Author: Erik de Castro Lopo Date: Tue Dec 23 20:25:10 2014 +1100 Convert README file to markdown. Also change 'darcs' to 'git'. >--------------------------------------------------------------- 5808f3eb013c67e1605678ed67323a557c03d835 README => Readme.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README b/Readme.md similarity index 50% rename from README rename to Readme.md index f5aa1cf..584287b 100644 --- a/README +++ b/Readme.md @@ -1,4 +1,11 @@ -To build this package using Cabal directly from darcs, you must run +# time + +This is the haskell time library that is bundled with [GHC][GHC] the Glasgow/ +Glorious Haskell compiler. + +To build this package using Cabal directly from git, you must run "autoreconf" before the usual Cabal build steps (configure/build/install). autoreconf is included in the GNU autoconf tools. There is no need to run the "configure" script: the "setup configure" step will do this for you. + +[GHC]: https://www.haskell.org/ghc/ From git at git.haskell.org Mon Feb 20 21:17:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:17:18 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Document that the show instance for UTCTime is elsewhere. (5bcf96f) Message-ID: <20170220211718.0A0A93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/5bcf96f4c0f5755a110e7ef6ae3ab54b42a1e96e >--------------------------------------------------------------- commit 5bcf96f4c0f5755a110e7ef6ae3ab54b42a1e96e Author: Tom Ellis Date: Wed Dec 31 13:05:27 2014 +0000 Document that the show instance for UTCTime is elsewhere. >--------------------------------------------------------------- 5bcf96f4c0f5755a110e7ef6ae3ab54b42a1e96e lib/Data/Time/Clock/UTC.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/Data/Time/Clock/UTC.hs b/lib/Data/Time/Clock/UTC.hs index eff7f4d..0c0a7d3 100644 --- a/lib/Data/Time/Clock/UTC.hs +++ b/lib/Data/Time/Clock/UTC.hs @@ -28,6 +28,9 @@ import Data.Data -- | This is the simplest representation of UTC. -- It consists of the day number, and a time offset from midnight. -- Note that if a day has a leap second added to it, it will have 86401 seconds. +-- +-- For the 'Show' instance of 'UTCTime' import @Data.Time@ or +-- @Data.Time.LocalTime at . data UTCTime = UTCTime { -- | the day utctDay :: Day, From git at git.haskell.org Mon Feb 20 21:17:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:17:20 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Merge pull request #21 from tomjaguarpaw/master (acc5478) Message-ID: <20170220211720.1262A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/acc5478a3aa6c2e33f4fb3f644a2239490e7447f >--------------------------------------------------------------- commit acc5478a3aa6c2e33f4fb3f644a2239490e7447f Merge: b0c04d9 5bcf96f Author: Ashley Yakeley Date: Mon Jan 5 16:43:51 2015 -0800 Merge pull request #21 from tomjaguarpaw/master Document that the show instance for UTCTime is elsewhere. >--------------------------------------------------------------- acc5478a3aa6c2e33f4fb3f644a2239490e7447f lib/Data/Time/Clock/UTC.hs | 3 +++ 1 file changed, 3 insertions(+) From git at git.haskell.org Mon Feb 20 21:17:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:17:22 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: document orphan Read instances (0a8946c) Message-ID: <20170220211722.19D3D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/0a8946c3bc8159960dd50ef28ff17b21aceb4e92 >--------------------------------------------------------------- commit 0a8946c3bc8159960dd50ef28ff17b21aceb4e92 Author: Ashley Yakeley Date: Sat Feb 21 02:02:29 2015 -0800 document orphan Read instances >--------------------------------------------------------------- 0a8946c3bc8159960dd50ef28ff17b21aceb4e92 lib/Data/Time/Calendar/Days.hs | 3 +++ lib/Data/Time/Clock/UTC.hs | 7 +++++-- lib/Data/Time/LocalTime/LocalTime.hs | 6 ++++++ lib/Data/Time/LocalTime/TimeOfDay.hs | 3 +++ lib/Data/Time/LocalTime/TimeZone.hs | 3 +++ 5 files changed, 20 insertions(+), 2 deletions(-) diff --git a/lib/Data/Time/Calendar/Days.hs b/lib/Data/Time/Calendar/Days.hs index 3ff0efb..c2ea920 100644 --- a/lib/Data/Time/Calendar/Days.hs +++ b/lib/Data/Time/Calendar/Days.hs @@ -15,6 +15,9 @@ import Data.Data #endif -- | The Modified Julian Day is a standard count of days, with zero being the day 1858-11-17. +-- +-- For the 'Read' instance of 'Day', +-- import "Data.Time" or "Data.Time.Format". newtype Day = ModifiedJulianDay {toModifiedJulianDay :: Integer} deriving (Eq,Ord #if LANGUAGE_DeriveDataTypeable #if LANGUAGE_Rank2Types diff --git a/lib/Data/Time/Clock/UTC.hs b/lib/Data/Time/Clock/UTC.hs index 0c0a7d3..63783e2 100644 --- a/lib/Data/Time/Clock/UTC.hs +++ b/lib/Data/Time/Clock/UTC.hs @@ -29,8 +29,11 @@ import Data.Data -- It consists of the day number, and a time offset from midnight. -- Note that if a day has a leap second added to it, it will have 86401 seconds. -- --- For the 'Show' instance of 'UTCTime' import @Data.Time@ or --- @Data.Time.LocalTime at . +-- For the 'Read' instance of 'UTCTime', +-- import "Data.Time" or "Data.Time.Format". +-- +-- For the 'Show' instance of 'UTCTime', +-- import "Data.Time" or "Data.Time.LocalTime". data UTCTime = UTCTime { -- | the day utctDay :: Day, diff --git a/lib/Data/Time/LocalTime/LocalTime.hs b/lib/Data/Time/LocalTime/LocalTime.hs index b2ae6e6..d653fb5 100644 --- a/lib/Data/Time/LocalTime/LocalTime.hs +++ b/lib/Data/Time/LocalTime/LocalTime.hs @@ -27,6 +27,9 @@ import Data.Data -- and the time is a TimeOfDay. -- Conversion of this (as local civil time) to UTC depends on the time zone. -- Conversion of this (as local mean time) to UT1 depends on the longitude. +-- +-- For the 'Read' instance of 'LocalTime', +-- import "Data.Time" or "Data.Time.Format". data LocalTime = LocalTime { localDay :: Day, localTimeOfDay :: TimeOfDay @@ -68,6 +71,9 @@ localTimeToUT1 :: Rational -> LocalTime -> UniversalTime localTimeToUT1 long (LocalTime (ModifiedJulianDay localMJD) tod) = ModJulianDate ((fromIntegral localMJD) + (timeOfDayToDayFraction tod) - (long / 360)) -- | A local time together with a TimeZone. +-- +-- For the 'Read' instance of 'ZonedTime', +-- import "Data.Time" or "Data.Time.Format". data ZonedTime = ZonedTime { zonedTimeToLocalTime :: LocalTime, zonedTimeZone :: TimeZone diff --git a/lib/Data/Time/LocalTime/TimeOfDay.hs b/lib/Data/Time/LocalTime/TimeOfDay.hs index 91d77df..8e6e7cc 100644 --- a/lib/Data/Time/LocalTime/TimeOfDay.hs +++ b/lib/Data/Time/LocalTime/TimeOfDay.hs @@ -21,6 +21,9 @@ import Data.Data #endif -- | Time of day as represented in hour, minute and second (with picoseconds), typically used to express local time of day. +-- +-- For the 'Read' instance of 'TimeOfDay', +-- import "Data.Time" or "Data.Time.Format". data TimeOfDay = TimeOfDay { -- | range 0 - 23 todHour :: Int, diff --git a/lib/Data/Time/LocalTime/TimeZone.hs b/lib/Data/Time/LocalTime/TimeZone.hs index 630ca54..6c2f39b 100644 --- a/lib/Data/Time/LocalTime/TimeZone.hs +++ b/lib/Data/Time/LocalTime/TimeZone.hs @@ -30,6 +30,9 @@ import Data.Data #endif -- | A TimeZone is a whole number of minutes offset from UTC, together with a name and a \"just for summer\" flag. +-- +-- For the 'Read' instance of 'TimeZone', +-- import "Data.Time" or "Data.Time.Format". data TimeZone = TimeZone { -- | The number of minutes offset from UTC. Positive means local time will be later in the day than UTC. timeZoneMinutes :: Int, From git at git.haskell.org Mon Feb 20 21:17:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:17:24 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Days: remove unused code (1749892) Message-ID: <20170220211724.20DB63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/1749892e6ae6eaafaf709cad1bc8361f4ae4ac25 >--------------------------------------------------------------- commit 1749892e6ae6eaafaf709cad1bc8361f4ae4ac25 Author: Ashley Yakeley Date: Sat Feb 21 02:17:17 2015 -0800 Days: remove unused code >--------------------------------------------------------------- 1749892e6ae6eaafaf709cad1bc8361f4ae4ac25 lib/Data/Time/Calendar/Days.hs | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/lib/Data/Time/Calendar/Days.hs b/lib/Data/Time/Calendar/Days.hs index c2ea920..b051288 100644 --- a/lib/Data/Time/Calendar/Days.hs +++ b/lib/Data/Time/Calendar/Days.hs @@ -52,26 +52,3 @@ addDays n (ModifiedJulianDay a) = ModifiedJulianDay (a + n) diffDays :: Day -> Day -> Integer diffDays (ModifiedJulianDay a) (ModifiedJulianDay b) = a - b - -{- -instance Show Day where - show (ModifiedJulianDay d) = "MJD " ++ (show d) - --- necessary because H98 doesn't have "cunning newtype" derivation -instance Num Day where - (ModifiedJulianDay a) + (ModifiedJulianDay b) = ModifiedJulianDay (a + b) - (ModifiedJulianDay a) - (ModifiedJulianDay b) = ModifiedJulianDay (a - b) - (ModifiedJulianDay a) * (ModifiedJulianDay b) = ModifiedJulianDay (a * b) - negate (ModifiedJulianDay a) = ModifiedJulianDay (negate a) - abs (ModifiedJulianDay a) = ModifiedJulianDay (abs a) - signum (ModifiedJulianDay a) = ModifiedJulianDay (signum a) - fromInteger = ModifiedJulianDay - -instance Real Day where - toRational (ModifiedJulianDay a) = toRational a - -instance Integral Day where - toInteger (ModifiedJulianDay a) = toInteger a - quotRem (ModifiedJulianDay a) (ModifiedJulianDay b) = (ModifiedJulianDay c,ModifiedJulianDay d) where - (c,d) = quotRem a b --} From git at git.haskell.org Mon Feb 20 21:17:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:17:26 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: instance Show UniversalTime (7b06a35) Message-ID: <20170220211726.280D73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/7b06a35f56e85fc2c1d2929fa2e174432d319211 >--------------------------------------------------------------- commit 7b06a35f56e85fc2c1d2929fa2e174432d319211 Author: Ashley Yakeley Date: Sat Feb 21 02:34:10 2015 -0800 instance Show UniversalTime >--------------------------------------------------------------- 7b06a35f56e85fc2c1d2929fa2e174432d319211 lib/Data/Time/Clock/Scale.hs | 3 +++ lib/Data/Time/LocalTime/LocalTime.hs | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/lib/Data/Time/Clock/Scale.hs b/lib/Data/Time/Clock/Scale.hs index 5838b4d..c511829 100644 --- a/lib/Data/Time/Clock/Scale.hs +++ b/lib/Data/Time/Clock/Scale.hs @@ -23,6 +23,9 @@ import Data.Data -- | The Modified Julian Date is the day with the fraction of the day, measured from UT midnight. -- It's used to represent UT1, which is time as measured by the earth's rotation, adjusted for various wobbles. +-- +-- For the 'Show' instance of 'UniversalTime', +-- import "Data.Time" or "Data.Time.LocalTime". newtype UniversalTime = ModJulianDate {getModJulianDate :: Rational} deriving (Eq,Ord #if LANGUAGE_DeriveDataTypeable #if LANGUAGE_Rank2Types diff --git a/lib/Data/Time/LocalTime/LocalTime.hs b/lib/Data/Time/LocalTime/LocalTime.hs index d653fb5..360a2c6 100644 --- a/lib/Data/Time/LocalTime/LocalTime.hs +++ b/lib/Data/Time/LocalTime/LocalTime.hs @@ -70,6 +70,10 @@ ut1ToLocalTime long (ModJulianDate date) = LocalTime (ModifiedJulianDay localMJD localTimeToUT1 :: Rational -> LocalTime -> UniversalTime localTimeToUT1 long (LocalTime (ModifiedJulianDay localMJD) tod) = ModJulianDate ((fromIntegral localMJD) + (timeOfDayToDayFraction tod) - (long / 360)) +-- orphan instance +instance Show UniversalTime where + show t = show (ut1ToLocalTime 0 t) + -- | A local time together with a TimeZone. -- -- For the 'Read' instance of 'ZonedTime', From git at git.haskell.org Mon Feb 20 21:17:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:17:28 +0000 (UTC) Subject: [commit: packages/time] format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis: instance FormatTime UniversalTime; instance ParseTime UniversalTime; instance Read UniversalTime (1ca245b) Message-ID: <20170220211728.2FDA83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/1ca245b63dcb9b409be9ecc2b034b821d24af8f9 >--------------------------------------------------------------- commit 1ca245b63dcb9b409be9ecc2b034b821d24af8f9 Author: Ashley Yakeley Date: Sat Feb 21 03:09:37 2015 -0800 instance FormatTime UniversalTime; instance ParseTime UniversalTime; instance Read UniversalTime >--------------------------------------------------------------- 1ca245b63dcb9b409be9ecc2b034b821d24af8f9 lib/Data/Time/Clock/Scale.hs | 3 +++ lib/Data/Time/Format.hs | 9 ++++++--- lib/Data/Time/Format/Parse.hs | 6 ++++++ test/Test/TestParseTime.hs | 22 +++++++++++++++++++++- 4 files changed, 36 insertions(+), 4 deletions(-) diff --git a/lib/Data/Time/Clock/Scale.hs b/lib/Data/Time/Clock/Scale.hs index c511829..8700e32 100644 --- a/lib/Data/Time/Clock/Scale.hs +++ b/lib/Data/Time/Clock/Scale.hs @@ -24,6 +24,9 @@ import Data.Data -- | The Modified Julian Date is the day with the fraction of the day, measured from UT midnight. -- It's used to represent UT1, which is time as measured by the earth's rotation, adjusted for various wobbles. -- +-- For the 'Read' instance of 'UniversalTime', +-- import "Data.Time" or "Data.Time.Format". +-- -- For the 'Show' instance of 'UniversalTime', -- import "Data.Time" or "Data.Time.LocalTime". newtype UniversalTime = ModJulianDate {getModJulianDate :: Rational} deriving (Eq,Ord diff --git a/lib/Data/Time/Format.hs b/lib/Data/Time/Format.hs index d9f0050..e3fe96b 100644 --- a/lib/Data/Time/Format.hs +++ b/lib/Data/Time/Format.hs @@ -58,11 +58,11 @@ formatChar c locale mpado t = case (formatCharacter c) of -- -- [@%Z@] timezone name -- --- For 'LocalTime' (and 'ZonedTime' and 'UTCTime'): +-- For 'LocalTime' (and 'ZonedTime' and 'UTCTime' and 'UniversalTime'): -- -- [@%c@] as 'dateTimeFmt' @locale@ (e.g. @%a %b %e %H:%M:%S %Z %Y@) -- --- For 'TimeOfDay' (and 'LocalTime' and 'ZonedTime' and 'UTCTime'): +-- For 'TimeOfDay' (and 'LocalTime' and 'ZonedTime' and 'UTCTime' and 'UniversalTime'): -- -- [@%R@] same as @%H:%M@ -- @@ -100,7 +100,7 @@ formatChar c locale mpado t = case (formatCharacter c) of -- the decimals are positive, not negative. For example, 0.9 seconds -- before the Unix epoch is formatted as @-1.1@ with @%s%Q at . -- --- For 'Day' (and 'LocalTime' and 'ZonedTime' and 'UTCTime'): +-- For 'Day' (and 'LocalTime' and 'ZonedTime' and 'UTCTime' and 'UniversalTime'): -- -- [@%D@] same as @%m\/%d\/%y@ -- @@ -244,3 +244,6 @@ instance FormatTime Day where instance FormatTime UTCTime where formatCharacter c = fmap (\f locale mpado t -> f locale mpado (utcToZonedTime utc t)) (formatCharacter c) + +instance FormatTime UniversalTime where + formatCharacter c = fmap (\f locale mpado t -> f locale mpado (ut1ToLocalTime 0 t)) (formatCharacter c) diff --git a/lib/Data/Time/Format/Parse.hs b/lib/Data/Time/Format/Parse.hs index 07dc5b2..0bd698d 100644 --- a/lib/Data/Time/Format/Parse.hs +++ b/lib/Data/Time/Format/Parse.hs @@ -464,6 +464,9 @@ instance ParseTime ZonedTime where instance ParseTime UTCTime where buildTime l = zonedTimeToUTC . buildTime l +instance ParseTime UniversalTime where + buildTime l = localTimeToUT1 0 . buildTime l + -- * Read instances for time package types #if LANGUAGE_Rank2Types @@ -485,5 +488,8 @@ instance Read ZonedTime where instance Read UTCTime where readsPrec n s = [ (zonedTimeToUTC t, r) | (t,r) <- readsPrec n s ] + +instance Read UniversalTime where + readsPrec n s = [ (localTimeToUT1 0 t, r) | (t,r) <- readsPrec n s ] #endif diff --git a/test/Test/TestParseTime.hs b/test/Test/TestParseTime.hs index 26ee67d..4c65fbd 100644 --- a/test/Test/TestParseTime.hs +++ b/test/Test/TestParseTime.hs @@ -286,6 +286,13 @@ instance Arbitrary UTCTime where instance CoArbitrary UTCTime where coarbitrary t = coarbitrary (truncate (utcTimeToPOSIXSeconds t) :: Integer) +instance Arbitrary UniversalTime where + arbitrary = liftM (\n -> ModJulianDate $ n % k) $ choose (-313698 * k, 2973483 * k) where -- 1000-01-1 to 9999-12-31 + k = 86400 + +instance CoArbitrary UniversalTime where + coarbitrary (ModJulianDate d) = coarbitrary d + -- missing from the time package instance Eq ZonedTime where ZonedTime t1 tz1 == ZonedTime t2 tz2 = t1 == t2 && tz1 == tz2 @@ -438,7 +445,8 @@ properties = ("prop_read_show LocalTime", property (prop_read_show :: LocalTime -> Result)), ("prop_read_show TimeZone", property (prop_read_show :: TimeZone -> Result)), ("prop_read_show ZonedTime", property (prop_read_show :: ZonedTime -> Result)), - ("prop_read_show UTCTime", property (prop_read_show :: UTCTime -> Result))] + ("prop_read_show UTCTime", property (prop_read_show :: UTCTime -> Result)), + ("prop_read_show UniversalTime", property (prop_read_show :: UniversalTime -> Result))] ++ [("prop_parse_showWeekDate", property prop_parse_showWeekDate), ("prop_parse_showGregorian", property prop_parse_showGregorian), ("prop_parse_showOrdinalDate", property prop_parse_showOrdinalDate)] @@ -449,6 +457,7 @@ properties = ++ map (prop_parse_format_named "TimeZone") timeZoneFormats ++ map (prop_parse_format_named "ZonedTime") zonedTimeFormats ++ map (prop_parse_format_named "UTCTime") utcTimeFormats + ++ map (prop_parse_format_named "UniversalTime") universalTimeFormats ++ map (prop_parse_format_upper_named "Day") dayFormats ++ map (prop_parse_format_upper_named "TimeOfDay") timeOfDayFormats @@ -456,6 +465,7 @@ properties = ++ map (prop_parse_format_upper_named "TimeZone") timeZoneFormats ++ map (prop_parse_format_upper_named "ZonedTime") zonedTimeFormats ++ map (prop_parse_format_upper_named "UTCTime") utcTimeFormats + ++ map (prop_parse_format_upper_named "UniversalTime") universalTimeFormats ++ map (prop_parse_format_lower_named "Day") dayFormats ++ map (prop_parse_format_lower_named "TimeOfDay") timeOfDayFormats @@ -463,12 +473,14 @@ properties = ++ map (prop_parse_format_lower_named "TimeZone") timeZoneFormats ++ map (prop_parse_format_lower_named "ZonedTime") zonedTimeFormats ++ map (prop_parse_format_lower_named "UTCTime") utcTimeFormats + ++ map (prop_parse_format_lower_named "UniversalTime") universalTimeFormats ++ map (prop_format_parse_format_named "Day") partialDayFormats ++ map (prop_format_parse_format_named "TimeOfDay") partialTimeOfDayFormats ++ map (prop_format_parse_format_named "LocalTime") partialLocalTimeFormats ++ map (prop_format_parse_format_named "ZonedTime") partialZonedTimeFormats ++ map (prop_format_parse_format_named "UTCTime") partialUTCTimeFormats + ++ map (prop_format_parse_format_named "UniversalTime") partialUniversalTimeFormats ++ map (prop_no_crash_bad_input_named "Day") (dayFormats ++ partialDayFormats ++ failingPartialDayFormats) ++ map (prop_no_crash_bad_input_named "TimeOfDay") (timeOfDayFormats ++ partialTimeOfDayFormats) @@ -476,6 +488,7 @@ properties = ++ map (prop_no_crash_bad_input_named "TimeZone") (timeZoneFormats) ++ map (prop_no_crash_bad_input_named "ZonedTime") (zonedTimeFormats ++ partialZonedTimeFormats) ++ map (prop_no_crash_bad_input_named "UTCTime") (utcTimeFormats ++ partialUTCTimeFormats) + ++ map (prop_no_crash_bad_input_named "UniversalTime") (universalTimeFormats ++ partialUniversalTimeFormats) @@ -528,6 +541,9 @@ utcTimeFormats :: [FormatString UTCTime] utcTimeFormats = map FormatString ["%s.%q","%s%Q"] +universalTimeFormats :: [FormatString UniversalTime] +universalTimeFormats = map FormatString [] + -- -- * Formats that do not include all the information -- @@ -562,6 +578,10 @@ partialUTCTimeFormats = map FormatString "%c" ] +partialUniversalTimeFormats :: [FormatString UniversalTime] +partialUniversalTimeFormats = map FormatString + [ ] + -- -- * Known failures From git at git.haskell.org Mon Feb 20 21:17:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:17:30 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Ensure Read/Show instances are always provided with UTCTime and Universal (34c255e) Message-ID: <20170220211730.37E4C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/34c255e0bfb1659d09785eaefcfd781549ff99ed >--------------------------------------------------------------- commit 34c255e0bfb1659d09785eaefcfd781549ff99ed Author: U-CIQDEV\gbazerman Date: Wed Mar 11 15:43:45 2015 -0400 Ensure Read/Show instances are always provided with UTCTime and Universal >--------------------------------------------------------------- 34c255e0bfb1659d09785eaefcfd781549ff99ed lib/Data/Time/Clock.hs | 9 +++------ lib/Data/Time/Clock/POSIX.hs | 6 +++++- lib/Data/Time/Clock/Scale.hs | 6 ------ lib/Data/Time/Clock/UTC.hs | 6 ------ lib/Data/Time/Format/Parse.hs | 3 ++- lib/Data/Time/LocalTime/LocalTime.hs | 7 ++++++- lib/Data/Time/LocalTime/TimeOfDay.hs | 2 +- lib/Data/Time/LocalTime/TimeZone.hs | 2 +- 8 files changed, 18 insertions(+), 23 deletions(-) diff --git a/lib/Data/Time/Clock.hs b/lib/Data/Time/Clock.hs index e1d1088..b03e272 100644 --- a/lib/Data/Time/Clock.hs +++ b/lib/Data/Time/Clock.hs @@ -4,15 +4,12 @@ module Data.Time.Clock module Data.Time.Clock.Scale, module Data.Time.Clock.UTC, module Data.Time.Clock.UTCDiff, - module Data.Time.Clock + getCurrentTime ) where import Data.Time.Clock.Scale import Data.Time.Clock.UTCDiff import Data.Time.Clock.UTC import Data.Time.Clock.POSIX -import Control.Monad - --- | Get the current UTC time from the system clock. -getCurrentTime :: IO UTCTime -getCurrentTime = liftM posixSecondsToUTCTime getPOSIXTime +import Data.Time.Format.Parse() +import Data.Time.LocalTime() diff --git a/lib/Data/Time/Clock/POSIX.hs b/lib/Data/Time/Clock/POSIX.hs index 07411c5..91f22e0 100644 --- a/lib/Data/Time/Clock/POSIX.hs +++ b/lib/Data/Time/Clock/POSIX.hs @@ -2,7 +2,7 @@ -- Most people won't need this module. module Data.Time.Clock.POSIX ( - posixDayLength,POSIXTime,posixSecondsToUTCTime,utcTimeToPOSIXSeconds,getPOSIXTime + posixDayLength,POSIXTime,posixSecondsToUTCTime,utcTimeToPOSIXSeconds,getPOSIXTime,getCurrentTime ) where import Data.Time.Clock.UTC @@ -64,3 +64,7 @@ ctimevalToPosixSeconds (MkCTimeval s mus) = (fromIntegral s) + (fromIntegral mus getPOSIXTime = liftM ctimevalToPosixSeconds getCTimeval #endif + +-- | Get the current UTC time from the system clock. +getCurrentTime :: IO UTCTime +getCurrentTime = liftM posixSecondsToUTCTime getPOSIXTime diff --git a/lib/Data/Time/Clock/Scale.hs b/lib/Data/Time/Clock/Scale.hs index 8700e32..5838b4d 100644 --- a/lib/Data/Time/Clock/Scale.hs +++ b/lib/Data/Time/Clock/Scale.hs @@ -23,12 +23,6 @@ import Data.Data -- | The Modified Julian Date is the day with the fraction of the day, measured from UT midnight. -- It's used to represent UT1, which is time as measured by the earth's rotation, adjusted for various wobbles. --- --- For the 'Read' instance of 'UniversalTime', --- import "Data.Time" or "Data.Time.Format". --- --- For the 'Show' instance of 'UniversalTime', --- import "Data.Time" or "Data.Time.LocalTime". newtype UniversalTime = ModJulianDate {getModJulianDate :: Rational} deriving (Eq,Ord #if LANGUAGE_DeriveDataTypeable #if LANGUAGE_Rank2Types diff --git a/lib/Data/Time/Clock/UTC.hs b/lib/Data/Time/Clock/UTC.hs index 63783e2..eff7f4d 100644 --- a/lib/Data/Time/Clock/UTC.hs +++ b/lib/Data/Time/Clock/UTC.hs @@ -28,12 +28,6 @@ import Data.Data -- | This is the simplest representation of UTC. -- It consists of the day number, and a time offset from midnight. -- Note that if a day has a leap second added to it, it will have 86401 seconds. --- --- For the 'Read' instance of 'UTCTime', --- import "Data.Time" or "Data.Time.Format". --- --- For the 'Show' instance of 'UTCTime', --- import "Data.Time" or "Data.Time.LocalTime". data UTCTime = UTCTime { -- | the day utctDay :: Day, diff --git a/lib/Data/Time/Format/Parse.hs b/lib/Data/Time/Format/Parse.hs index 0bd698d..dda7e8f 100644 --- a/lib/Data/Time/Format/Parse.hs +++ b/lib/Data/Time/Format/Parse.hs @@ -15,7 +15,8 @@ module Data.Time.Format.Parse ) where import Data.Time.Clock.POSIX -import Data.Time.Clock +import Data.Time.Clock.Scale +import Data.Time.Clock.UTC import Data.Time.Calendar import Data.Time.Calendar.OrdinalDate import Data.Time.Calendar.WeekDate diff --git a/lib/Data/Time/LocalTime/LocalTime.hs b/lib/Data/Time/LocalTime/LocalTime.hs index 360a2c6..1c47f53 100644 --- a/lib/Data/Time/LocalTime/LocalTime.hs +++ b/lib/Data/Time/LocalTime/LocalTime.hs @@ -16,7 +16,12 @@ module Data.Time.LocalTime.LocalTime import Data.Time.LocalTime.TimeOfDay import Data.Time.LocalTime.TimeZone import Data.Time.Calendar -import Data.Time.Clock + +import Data.Time.Clock.Scale +import Data.Time.Clock.UTCDiff +import Data.Time.Clock.UTC +import Data.Time.Clock.POSIX + import Control.DeepSeq import Data.Typeable #if LANGUAGE_Rank2Types diff --git a/lib/Data/Time/LocalTime/TimeOfDay.hs b/lib/Data/Time/LocalTime/TimeOfDay.hs index 8e6e7cc..30e03c9 100644 --- a/lib/Data/Time/LocalTime/TimeOfDay.hs +++ b/lib/Data/Time/LocalTime/TimeOfDay.hs @@ -12,7 +12,7 @@ module Data.Time.LocalTime.TimeOfDay import Data.Time.LocalTime.TimeZone import Data.Time.Calendar.Private -import Data.Time.Clock +import Data.Time.Clock.Scale import Control.DeepSeq import Data.Typeable import Data.Fixed diff --git a/lib/Data/Time/LocalTime/TimeZone.hs b/lib/Data/Time/LocalTime/TimeZone.hs index 6c2f39b..177d115 100644 --- a/lib/Data/Time/LocalTime/TimeZone.hs +++ b/lib/Data/Time/LocalTime/TimeZone.hs @@ -14,8 +14,8 @@ module Data.Time.LocalTime.TimeZone --import System.Time.Calendar.Format import Data.Time.Calendar.Private -import Data.Time.Clock import Data.Time.Clock.POSIX +import Data.Time.Clock.UTC #if __GLASGOW_HASKELL__ >= 709 import Foreign From git at git.haskell.org Mon Feb 20 21:17:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:17:32 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Loosen required cabal-version (85cf1aa) Message-ID: <20170220211732.3EE853A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/85cf1aa22833cb0cd4bec9aaae958a466cc7486b >--------------------------------------------------------------- commit 85cf1aa22833cb0cd4bec9aaae958a466cc7486b Author: Adam Bergmark Date: Sat May 2 09:39:16 2015 +0200 Loosen required cabal-version 1.14 has the same features as 1.10 so this was overly restrictive and can prevent you from installing time on older GHCs. >--------------------------------------------------------------- 85cf1aa22833cb0cd4bec9aaae958a466cc7486b time.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/time.cabal b/time.cabal index 3769786..3f1b32e 100644 --- a/time.cabal +++ b/time.cabal @@ -11,7 +11,7 @@ synopsis: A time library description: A time library category: System build-type: Configure -cabal-version: >=1.14 +cabal-version: >=1.10 x-follows-version-policy: extra-source-files: From git at git.haskell.org Mon Feb 20 21:17:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:17:34 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Merge pull request #32 from bergmark/patch-1 (7875368) Message-ID: <20170220211734.462FF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/7875368f8e901d7882dadbe4598ca2fed8c8adc2 >--------------------------------------------------------------- commit 7875368f8e901d7882dadbe4598ca2fed8c8adc2 Merge: 1ca245b 85cf1aa Author: Ashley Yakeley Date: Sat May 9 12:27:55 2015 -0700 Merge pull request #32 from bergmark/patch-1 Loosen required cabal-version >--------------------------------------------------------------- 7875368f8e901d7882dadbe4598ca2fed8c8adc2 time.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) From git at git.haskell.org Mon Feb 20 21:17:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:17:36 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Merge pull request #20 from erikd/master (ad3ee77) Message-ID: <20170220211736.4EB3A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/ad3ee7736dd67a2c428ec7ab95e1f0b1b476749c >--------------------------------------------------------------- commit ad3ee7736dd67a2c428ec7ab95e1f0b1b476749c Merge: 7875368 5808f3e Author: Ashley Yakeley Date: Sat May 9 12:30:40 2015 -0700 Merge pull request #20 from erikd/master Convert README file to markdown. >--------------------------------------------------------------- ad3ee7736dd67a2c428ec7ab95e1f0b1b476749c README => Readme.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) From git at git.haskell.org Mon Feb 20 21:17:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:17:38 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: ensure read instances for additional types -- TimeZone, Day, LocalTime, ZonedTime, TimeOfDay (60408b8) Message-ID: <20170220211738.566703A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/60408b856a1f05b8bdda93d59c960f5a8611e31e >--------------------------------------------------------------- commit 60408b856a1f05b8bdda93d59c960f5a8611e31e Author: Gershom Date: Fri May 22 17:32:51 2015 -0600 ensure read instances for additional types -- TimeZone, Day, LocalTime, ZonedTime, TimeOfDay >--------------------------------------------------------------- 60408b856a1f05b8bdda93d59c960f5a8611e31e lib/Data/Time/Calendar.hs | 1 + lib/Data/Time/Calendar/Days.hs | 3 --- lib/Data/Time/Format.hs | 11 ++++++++--- lib/Data/Time/Format/Locale.hs | 3 ++- lib/Data/Time/Format/Parse.hs | 8 +++++--- lib/Data/Time/LocalTime.hs | 1 + lib/Data/Time/LocalTime/LocalTime.hs | 9 ++------- lib/Data/Time/LocalTime/TimeOfDay.hs | 3 --- lib/Data/Time/LocalTime/TimeZone.hs | 3 --- 9 files changed, 19 insertions(+), 23 deletions(-) diff --git a/lib/Data/Time/Calendar.hs b/lib/Data/Time/Calendar.hs index cf2279c..2abe1a0 100644 --- a/lib/Data/Time/Calendar.hs +++ b/lib/Data/Time/Calendar.hs @@ -6,3 +6,4 @@ module Data.Time.Calendar import Data.Time.Calendar.Days import Data.Time.Calendar.Gregorian +import Data.Time.Format() \ No newline at end of file diff --git a/lib/Data/Time/Calendar/Days.hs b/lib/Data/Time/Calendar/Days.hs index b051288..6b472b5 100644 --- a/lib/Data/Time/Calendar/Days.hs +++ b/lib/Data/Time/Calendar/Days.hs @@ -15,9 +15,6 @@ import Data.Data #endif -- | The Modified Julian Day is a standard count of days, with zero being the day 1858-11-17. --- --- For the 'Read' instance of 'Day', --- import "Data.Time" or "Data.Time.Format". newtype Day = ModifiedJulianDay {toModifiedJulianDay :: Integer} deriving (Eq,Ord #if LANGUAGE_DeriveDataTypeable #if LANGUAGE_Rank2Types diff --git a/lib/Data/Time/Format.hs b/lib/Data/Time/Format.hs index e3fe96b..5ddd341 100644 --- a/lib/Data/Time/Format.hs +++ b/lib/Data/Time/Format.hs @@ -6,12 +6,17 @@ module Data.Time.Format ) where import Data.Time.Format.Parse -import Data.Time.LocalTime + +import Data.Time.LocalTime.TimeZone +import Data.Time.LocalTime.TimeOfDay +import Data.Time.LocalTime.LocalTime +import Data.Time.Calendar.Days +import Data.Time.Calendar.Gregorian import Data.Time.Calendar.WeekDate import Data.Time.Calendar.OrdinalDate -import Data.Time.Calendar import Data.Time.Calendar.Private -import Data.Time.Clock +import Data.Time.Clock.Scale +import Data.Time.Clock.UTC import Data.Time.Clock.POSIX import Data.Maybe diff --git a/lib/Data/Time/Format/Locale.hs b/lib/Data/Time/Format/Locale.hs index 80ead81..e0e57c9 100644 --- a/lib/Data/Time/Format/Locale.hs +++ b/lib/Data/Time/Format/Locale.hs @@ -11,7 +11,8 @@ module Data.Time.Format.Locale ( ) where -import Data.Time.LocalTime +import Data.Time.LocalTime.TimeZone + data TimeLocale = TimeLocale { -- |full and abbreviated week days, starting with Sunday diff --git a/lib/Data/Time/Format/Parse.hs b/lib/Data/Time/Format/Parse.hs index dda7e8f..20dad98 100644 --- a/lib/Data/Time/Format/Parse.hs +++ b/lib/Data/Time/Format/Parse.hs @@ -17,10 +17,13 @@ module Data.Time.Format.Parse import Data.Time.Clock.POSIX import Data.Time.Clock.Scale import Data.Time.Clock.UTC -import Data.Time.Calendar +import Data.Time.Calendar.Days +import Data.Time.Calendar.Gregorian import Data.Time.Calendar.OrdinalDate import Data.Time.Calendar.WeekDate -import Data.Time.LocalTime +import Data.Time.LocalTime.TimeZone +import Data.Time.LocalTime.TimeOfDay +import Data.Time.LocalTime.LocalTime #if LANGUAGE_Rank2Types import Control.Monad @@ -493,4 +496,3 @@ instance Read UTCTime where instance Read UniversalTime where readsPrec n s = [ (localTimeToUT1 0 t, r) | (t,r) <- readsPrec n s ] #endif - diff --git a/lib/Data/Time/LocalTime.hs b/lib/Data/Time/LocalTime.hs index 046da36..735d826 100644 --- a/lib/Data/Time/LocalTime.hs +++ b/lib/Data/Time/LocalTime.hs @@ -5,6 +5,7 @@ module Data.Time.LocalTime module Data.Time.LocalTime.LocalTime ) where +import Data.Time.Format() import Data.Time.LocalTime.TimeZone import Data.Time.LocalTime.TimeOfDay import Data.Time.LocalTime.LocalTime diff --git a/lib/Data/Time/LocalTime/LocalTime.hs b/lib/Data/Time/LocalTime/LocalTime.hs index 1c47f53..77ab2cc 100644 --- a/lib/Data/Time/LocalTime/LocalTime.hs +++ b/lib/Data/Time/LocalTime/LocalTime.hs @@ -15,7 +15,8 @@ module Data.Time.LocalTime.LocalTime import Data.Time.LocalTime.TimeOfDay import Data.Time.LocalTime.TimeZone -import Data.Time.Calendar +import Data.Time.Calendar.Days +import Data.Time.Calendar.Gregorian import Data.Time.Clock.Scale import Data.Time.Clock.UTCDiff @@ -32,9 +33,6 @@ import Data.Data -- and the time is a TimeOfDay. -- Conversion of this (as local civil time) to UTC depends on the time zone. -- Conversion of this (as local mean time) to UT1 depends on the longitude. --- --- For the 'Read' instance of 'LocalTime', --- import "Data.Time" or "Data.Time.Format". data LocalTime = LocalTime { localDay :: Day, localTimeOfDay :: TimeOfDay @@ -80,9 +78,6 @@ instance Show UniversalTime where show t = show (ut1ToLocalTime 0 t) -- | A local time together with a TimeZone. --- --- For the 'Read' instance of 'ZonedTime', --- import "Data.Time" or "Data.Time.Format". data ZonedTime = ZonedTime { zonedTimeToLocalTime :: LocalTime, zonedTimeZone :: TimeZone diff --git a/lib/Data/Time/LocalTime/TimeOfDay.hs b/lib/Data/Time/LocalTime/TimeOfDay.hs index 30e03c9..4645857 100644 --- a/lib/Data/Time/LocalTime/TimeOfDay.hs +++ b/lib/Data/Time/LocalTime/TimeOfDay.hs @@ -21,9 +21,6 @@ import Data.Data #endif -- | Time of day as represented in hour, minute and second (with picoseconds), typically used to express local time of day. --- --- For the 'Read' instance of 'TimeOfDay', --- import "Data.Time" or "Data.Time.Format". data TimeOfDay = TimeOfDay { -- | range 0 - 23 todHour :: Int, diff --git a/lib/Data/Time/LocalTime/TimeZone.hs b/lib/Data/Time/LocalTime/TimeZone.hs index 177d115..90846f2 100644 --- a/lib/Data/Time/LocalTime/TimeZone.hs +++ b/lib/Data/Time/LocalTime/TimeZone.hs @@ -30,9 +30,6 @@ import Data.Data #endif -- | A TimeZone is a whole number of minutes offset from UTC, together with a name and a \"just for summer\" flag. --- --- For the 'Read' instance of 'TimeZone', --- import "Data.Time" or "Data.Time.Format". data TimeZone = TimeZone { -- | The number of minutes offset from UTC. Positive means local time will be later in the day than UTC. timeZoneMinutes :: Int, From git at git.haskell.org Mon Feb 20 21:17:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:17:40 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: newline (76bd850) Message-ID: <20170220211740.5CFC73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/76bd8504a450b7cfb52f6a98908313b687a7aab5 >--------------------------------------------------------------- commit 76bd8504a450b7cfb52f6a98908313b687a7aab5 Author: Gershom Date: Sat May 23 00:07:43 2015 -0600 newline >--------------------------------------------------------------- 76bd8504a450b7cfb52f6a98908313b687a7aab5 lib/Data/Time/Calendar.hs | 0 1 file changed, 0 insertions(+), 0 deletions(-) From git at git.haskell.org Mon Feb 20 21:17:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:17:42 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: remove tabs and trailing spaces (dd6dce8) Message-ID: <20170220211742.67EC23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/dd6dce846f5cd000fb069f90060bbd8453d1d996 >--------------------------------------------------------------- commit dd6dce846f5cd000fb069f90060bbd8453d1d996 Author: Ashley Yakeley Date: Sat May 30 19:01:25 2015 -0700 remove tabs and trailing spaces >--------------------------------------------------------------- dd6dce846f5cd000fb069f90060bbd8453d1d996 lib/Data/Time/Calendar/Private.hs | 0 test/Test/AddDays.hs | 40 ++++++++++++++++---------------- test/Test/ClipDates.hs | 0 test/Test/ClipDatesRef.hs | 0 test/Test/ConvertBack.hs | 22 +++++++++--------- test/Test/CurrentTime.hs | 10 ++++---- test/Test/LongWeekYears.hs | 4 ++-- test/Test/ShowDST.hs | 46 ++++++++++++++++++------------------- test/Test/TAI_UTC_DAT.hs | 0 test/Test/TestCalendars.hs | 20 ++++++++-------- test/Test/TestEaster.hs | 0 test/Test/TestFormat.hs | 30 ++++++++++++------------ test/Test/TestFormatStuff.c | 20 ++++++++-------- test/Test/TestFormatStuff.h | 6 ++--- test/Test/TestMonthDay.hs | 0 test/Test/TestParseDAT.hs | 48 +++++++++++++++++++-------------------- test/Test/TestParseTime.hs | 2 +- test/Test/TestTime.hs | 8 +++---- test/Test/TestTimeRef.hs | 0 test/Test/TimeZone.hs | 4 ++-- test/Test/UseCases.lhs | 0 21 files changed, 130 insertions(+), 130 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 dd6dce846f5cd000fb069f90060bbd8453d1d996 From git at git.haskell.org Mon Feb 20 21:17:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:17:44 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: clean up .cabal (e1246f4) Message-ID: <20170220211744.6E0923A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/e1246f42651f6903157419522c0a019645312d82 >--------------------------------------------------------------- commit e1246f42651f6903157419522c0a019645312d82 Author: Ashley Yakeley Date: Sat May 30 19:05:21 2015 -0700 clean up .cabal >--------------------------------------------------------------- e1246f42651f6903157419522c0a019645312d82 time.cabal | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/time.cabal b/time.cabal index 3f1b32e..ea78698 100644 --- a/time.cabal +++ b/time.cabal @@ -30,15 +30,11 @@ extra-tmp-files: lib/include/HsTimeConfig.h source-repository head - type: git - location: https://github.com/haskell/time + type: git + location: https://github.com/haskell/time library hs-source-dirs: lib - build-depends: - base >= 4.4 && < 5, - deepseq >= 1.1 - ghc-options: -Wall -fwarn-tabs default-language: Haskell2010 if impl(ghc) default-extensions: @@ -50,6 +46,10 @@ library if impl(hugs) default-extensions: Rank2Types cpp-options: -DLANGUAGE_Rank2Types + ghc-options: -Wall -fwarn-tabs + build-depends: + base >= 4.4 && < 5, + deepseq >= 1.1 if os(windows) build-depends: Win32 exposed-modules: @@ -91,16 +91,18 @@ library HsTimeConfig.h test-suite ShowDefaultTZAbbreviations - hs-source-dirs: test type: exitcode-stdio-1.0 + hs-source-dirs: test + default-language: Haskell2010 + ghc-options: -Wall -fwarn-tabs build-depends: base, time == 1.5.0.1 main-is: ShowDefaultTZAbbreviations.hs test-suite tests - hs-source-dirs: test type: exitcode-stdio-1.0 + hs-source-dirs: test default-language: Haskell2010 default-extensions: Rank2Types @@ -112,7 +114,7 @@ test-suite tests FlexibleInstances UndecidableInstances ScopedTypeVariables - ghc-options: -Wall + ghc-options: -Wall -fwarn-tabs c-sources: test/Test/TestFormatStuff.c build-depends: base, From git at git.haskell.org Mon Feb 20 21:17:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:17:46 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: bump version (3a3bbe0) Message-ID: <20170220211746.751213A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/3a3bbe07210659e9563e845bce25b764fe2c4439 >--------------------------------------------------------------- commit 3a3bbe07210659e9563e845bce25b764fe2c4439 Author: Ashley Yakeley Date: Sat May 30 19:19:14 2015 -0700 bump version >--------------------------------------------------------------- 3a3bbe07210659e9563e845bce25b764fe2c4439 time.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/time.cabal b/time.cabal index ea78698..dbeaf09 100644 --- a/time.cabal +++ b/time.cabal @@ -1,5 +1,5 @@ name: time -version: 1.5.0.1 +version: 1.5.1 stability: stable license: BSD3 license-file: LICENSE From git at git.haskell.org Mon Feb 20 21:17:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:17:48 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: bump version (5b4f363) Message-ID: <20170220211748.7BC793A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/5b4f363d51eb6c44a94cb80be1de0dcc77b28858 >--------------------------------------------------------------- commit 5b4f363d51eb6c44a94cb80be1de0dcc77b28858 Author: Ashley Yakeley Date: Sat May 30 19:45:48 2015 -0700 bump version >--------------------------------------------------------------- 5b4f363d51eb6c44a94cb80be1de0dcc77b28858 time.cabal | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/time.cabal b/time.cabal index dbeaf09..9ad68b6 100644 --- a/time.cabal +++ b/time.cabal @@ -97,7 +97,7 @@ test-suite ShowDefaultTZAbbreviations ghc-options: -Wall -fwarn-tabs build-depends: base, - time == 1.5.0.1 + time == 1.5.1 main-is: ShowDefaultTZAbbreviations.hs test-suite tests @@ -119,7 +119,7 @@ test-suite tests build-depends: base, deepseq, - time == 1.5.0.1, + time == 1.5.1, QuickCheck >= 2.5.1, test-framework >= 0.8, test-framework-quickcheck2 >= 0.3, From git at git.haskell.org Mon Feb 20 21:17:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:17:50 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Merge pull request #26 from gbaz/instances (80a554c) Message-ID: <20170220211750.84BC33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/80a554c39ae8b99b46a0f64c63a43cf359a8fc09 >--------------------------------------------------------------- commit 80a554c39ae8b99b46a0f64c63a43cf359a8fc09 Merge: 5b4f363 76bd850 Author: Ashley Yakeley Date: Sat May 30 20:48:57 2015 -0700 Merge pull request #26 from gbaz/instances Ensure Read/Show instances are always provided with UTCTime and Universa... >--------------------------------------------------------------- 80a554c39ae8b99b46a0f64c63a43cf359a8fc09 lib/Data/Time/Calendar.hs | 1 + lib/Data/Time/Calendar/Days.hs | 3 --- lib/Data/Time/Clock.hs | 9 +++------ lib/Data/Time/Clock/POSIX.hs | 6 +++++- lib/Data/Time/Clock/Scale.hs | 6 ------ lib/Data/Time/Clock/UTC.hs | 6 ------ lib/Data/Time/Format.hs | 11 ++++++++--- lib/Data/Time/Format/Locale.hs | 3 ++- lib/Data/Time/Format/Parse.hs | 11 +++++++---- lib/Data/Time/LocalTime.hs | 1 + lib/Data/Time/LocalTime/LocalTime.hs | 16 ++++++++-------- lib/Data/Time/LocalTime/TimeOfDay.hs | 5 +---- lib/Data/Time/LocalTime/TimeZone.hs | 5 +---- 13 files changed, 37 insertions(+), 46 deletions(-) From git at git.haskell.org Mon Feb 20 21:17:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:17:52 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: test sdist (ccd0609) Message-ID: <20170220211752.8BC083A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/ccd06090ff5db142dabd36d7e8ce5ca5bc10b60f >--------------------------------------------------------------- commit ccd06090ff5db142dabd36d7e8ce5ca5bc10b60f Author: Ashley Yakeley Date: Sat May 30 21:05:46 2015 -0700 test sdist >--------------------------------------------------------------- ccd06090ff5db142dabd36d7e8ce5ca5bc10b60f .gitignore | 1 + Makefile | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 5880242..2c7ac62 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ dist-install ghc.mk lib/include/HsTimeConfig.h lib/include/HsTimeConfig.h.in +test-sdist diff --git a/Makefile b/Makefile index 7b37eb9..291dc2f 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,9 @@ -default: clean test install sdist +default: clean test install test-sdist # Building clean: + rm -rf test-sdist cabal clean configure: @@ -26,7 +27,13 @@ install: sdist: clean configure cabal sdist +test-sdist: sdist + mkdir -p test-sdist + tar -C test-sdist -z -x -f dist/time-1.5.1.tar.gz + cp Makefile test-sdist/time-1.5.1/ + cd test-sdist/time-1.5.1 && make test + # switch off intermediate file deletion .SECONDARY: -.PHONY: default clean configure build haddock copy install test sdist +.PHONY: default clean configure build haddock copy install test sdist test-sdist From git at git.haskell.org Mon Feb 20 21:17:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:17:54 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Test.TestTimeZone was missing in time.cabal, added (4c63614) Message-ID: <20170220211754.946F33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/4c636143d7ce70a595a0e413812792d8d208dbf9 >--------------------------------------------------------------- commit 4c636143d7ce70a595a0e413812792d8d208dbf9 Author: Ashley Yakeley Date: Sat May 30 21:07:36 2015 -0700 Test.TestTimeZone was missing in time.cabal, added >--------------------------------------------------------------- 4c636143d7ce70a595a0e413812792d8d208dbf9 time.cabal | 1 + 1 file changed, 1 insertion(+) diff --git a/time.cabal b/time.cabal index 9ad68b6..ed6479e 100644 --- a/time.cabal +++ b/time.cabal @@ -140,6 +140,7 @@ test-suite tests Test.TestEasterRef Test.TestCalendars Test.TestCalendarsRef + Test.TestTimeZone Test.LongWeekYears Test.LongWeekYearsRef Test.ConvertBack From git at git.haskell.org Mon Feb 20 21:17:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:17:56 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Added diffTimeToPicoseconds (also cleaned up picosecondsToDiffTime) (020ce40) Message-ID: <20170220211756.9B76A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/020ce40e69951849041349c0c38243e56169f572 >--------------------------------------------------------------- commit 020ce40e69951849041349c0c38243e56169f572 Author: Ashley Yakeley Date: Sat May 30 21:54:25 2015 -0700 Added diffTimeToPicoseconds (also cleaned up picosecondsToDiffTime) >--------------------------------------------------------------- 020ce40e69951849041349c0c38243e56169f572 lib/Data/Time/Clock/Scale.hs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/Data/Time/Clock/Scale.hs b/lib/Data/Time/Clock/Scale.hs index 5838b4d..c508f7b 100644 --- a/lib/Data/Time/Clock/Scale.hs +++ b/lib/Data/Time/Clock/Scale.hs @@ -10,7 +10,9 @@ module Data.Time.Clock.Scale -- * Absolute intervals DiffTime, - secondsToDiffTime, picosecondsToDiffTime + secondsToDiffTime, + picosecondsToDiffTime, + diffTimeToPicoseconds, ) where import Control.DeepSeq @@ -101,7 +103,11 @@ secondsToDiffTime = fromInteger -- | Create a 'DiffTime' from a number of picoseconds. picosecondsToDiffTime :: Integer -> DiffTime -picosecondsToDiffTime x = fromRational (x % 1000000000000) +picosecondsToDiffTime x = MkDiffTime (MkFixed x) + +-- | Get the number of picoseconds in a 'DiffTime'. +diffTimeToPicoseconds :: DiffTime -> Integer +diffTimeToPicoseconds (MkDiffTime (MkFixed x)) = x {-# RULES "realToFrac/DiffTime->Pico" realToFrac = \ (MkDiffTime ps) -> ps From git at git.haskell.org Mon Feb 20 21:17:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:17:58 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Fix compilation on GHC 7.0 by not using Trustworthy (603b058) Message-ID: <20170220211758.A2CBD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/603b05864dbba686873828c2498c75e73a3adc9a >--------------------------------------------------------------- commit 603b05864dbba686873828c2498c75e73a3adc9a Author: Adam Bergmark Date: Mon Jul 13 10:59:41 2015 +0200 Fix compilation on GHC 7.0 by not using Trustworthy >--------------------------------------------------------------- 603b05864dbba686873828c2498c75e73a3adc9a lib/Data/Time/Clock/CTimeval.hs | 2 +- lib/Data/Time/Clock/Scale.hs | 3 ++- lib/Data/Time/Clock/UTC.hs | 3 ++- lib/Data/Time/LocalTime/TimeZone.hs | 2 +- time.cabal | 3 +-- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/Data/Time/Clock/CTimeval.hs b/lib/Data/Time/Clock/CTimeval.hs index add0bf9..8c2d550 100644 --- a/lib/Data/Time/Clock/CTimeval.hs +++ b/lib/Data/Time/Clock/CTimeval.hs @@ -4,7 +4,7 @@ module Data.Time.Clock.CTimeval where #ifndef mingw32_HOST_OS -- All Unix-specific, this -#if __GLASGOW_HASKELL__ >= 709 +#if __GLASGOW_HASKELL__ >= 709 || __GLASGOW_HASKELL__ < 702 import Foreign #else import Foreign.Safe diff --git a/lib/Data/Time/Clock/Scale.hs b/lib/Data/Time/Clock/Scale.hs index 5838b4d..6cef322 100644 --- a/lib/Data/Time/Clock/Scale.hs +++ b/lib/Data/Time/Clock/Scale.hs @@ -1,4 +1,6 @@ +#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-} +#endif {-# OPTIONS -fno-warn-unused-imports #-} #include "HsConfigure.h" -- #hide @@ -107,4 +109,3 @@ picosecondsToDiffTime x = fromRational (x % 1000000000000) "realToFrac/DiffTime->Pico" realToFrac = \ (MkDiffTime ps) -> ps "realToFrac/Pico->DiffTime" realToFrac = MkDiffTime #-} - diff --git a/lib/Data/Time/Clock/UTC.hs b/lib/Data/Time/Clock/UTC.hs index eff7f4d..3e27076 100644 --- a/lib/Data/Time/Clock/UTC.hs +++ b/lib/Data/Time/Clock/UTC.hs @@ -1,5 +1,7 @@ {-# OPTIONS -fno-warn-unused-imports #-} +#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-} +#endif #include "HsConfigure.h" -- #hide module Data.Time.Clock.UTC @@ -122,4 +124,3 @@ instance RealFrac NominalDiffTime where "realToFrac/NominalDiffTime->Pico" realToFrac = \ (MkNominalDiffTime ps) -> ps "realToFrac/Pico->NominalDiffTime" realToFrac = MkNominalDiffTime #-} - diff --git a/lib/Data/Time/LocalTime/TimeZone.hs b/lib/Data/Time/LocalTime/TimeZone.hs index 90846f2..9381075 100644 --- a/lib/Data/Time/LocalTime/TimeZone.hs +++ b/lib/Data/Time/LocalTime/TimeZone.hs @@ -17,7 +17,7 @@ import Data.Time.Calendar.Private import Data.Time.Clock.POSIX import Data.Time.Clock.UTC -#if __GLASGOW_HASKELL__ >= 709 +#if __GLASGOW_HASKELL__ >= 709 || __GLASGOW_HASKELL__ < 702 import Foreign #else import Foreign.Safe diff --git a/time.cabal b/time.cabal index ed6479e..34f7f58 100644 --- a/time.cabal +++ b/time.cabal @@ -48,7 +48,7 @@ library cpp-options: -DLANGUAGE_Rank2Types ghc-options: -Wall -fwarn-tabs build-depends: - base >= 4.4 && < 5, + base >= 4.3 && < 5, deepseq >= 1.1 if os(windows) build-depends: Win32 @@ -149,4 +149,3 @@ test-suite tests Test.AddDays Test.AddDaysRef Test.TestUtil - From git at git.haskell.org Mon Feb 20 21:18:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:18:00 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: use clock_gettime to implement getPOSIXTime if available (1b74336) Message-ID: <20170220211800.AB7163A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/1b74336b646b6bd3e36eee3efa00f41b915f02c7 >--------------------------------------------------------------- commit 1b74336b646b6bd3e36eee3efa00f41b915f02c7 Author: Marios Titas Date: Sun Aug 23 00:23:02 2015 +0100 use clock_gettime to implement getPOSIXTime if available >--------------------------------------------------------------- 1b74336b646b6bd3e36eee3efa00f41b915f02c7 configure.ac | 2 ++ lib/Data/Time/Clock/CTimespec.hsc | 41 +++++++++++++++++++++++++++++++++++++++ lib/Data/Time/Clock/POSIX.hs | 14 +++++++++++++ time.cabal | 1 + 4 files changed, 58 insertions(+) diff --git a/configure.ac b/configure.ac index 2b2149a..4be2aff 100644 --- a/configure.ac +++ b/configure.ac @@ -15,6 +15,8 @@ AC_CONFIG_HEADERS([lib/include/HsTimeConfig.h]) AC_CHECK_HEADERS([time.h]) AC_CHECK_FUNCS([gmtime_r localtime_r]) +AC_CHECK_FUNCS([clock_gettime]) + AC_STRUCT_TM AC_STRUCT_TIMEZONE diff --git a/lib/Data/Time/Clock/CTimespec.hsc b/lib/Data/Time/Clock/CTimespec.hsc new file mode 100644 index 0000000..fb9aaa3 --- /dev/null +++ b/lib/Data/Time/Clock/CTimespec.hsc @@ -0,0 +1,41 @@ +-- #hide +module Data.Time.Clock.CTimespec where + +#include "HsTimeConfig.h" + +#if !defined(mingw32_HOST_OS) && HAVE_CLOCK_GETTIME + +#if __GLASGOW_HASKELL__ >= 709 +import Foreign +#else +import Foreign.Safe +#endif +import Foreign.C + +#include + +data CTimespec = MkCTimespec CTime CLong + +instance Storable CTimespec where + sizeOf _ = #{size struct timespec} + alignment _ = alignment (undefined :: CLong) + peek p = do + s <- #{peek struct timespec, tv_sec } p + ns <- #{peek struct timespec, tv_nsec} p + return (MkCTimespec s ns) + poke p (MkCTimespec s ns) = do + #{poke struct timespec, tv_sec } p s + #{poke struct timespec, tv_nsec} p ns + +foreign import ccall unsafe "time.h clock_gettime" + clock_gettime :: #{type clockid_t} -> Ptr CTimespec -> IO CInt + +-- | Get the current POSIX time from the system clock. +getCTimespec :: IO CTimespec +getCTimespec = alloca (\ptspec -> do + throwErrnoIfMinus1_ "clock_gettime" $ + clock_gettime #{const CLOCK_REALTIME} ptspec + peek ptspec + ) + +#endif diff --git a/lib/Data/Time/Clock/POSIX.hs b/lib/Data/Time/Clock/POSIX.hs index 91f22e0..a7a3737 100644 --- a/lib/Data/Time/Clock/POSIX.hs +++ b/lib/Data/Time/Clock/POSIX.hs @@ -10,9 +10,14 @@ import Data.Time.Calendar.Days import Data.Fixed import Control.Monad +#include "HsTimeConfig.h" + #ifdef mingw32_HOST_OS import Data.Word ( Word64) import System.Win32.Time +#elif HAVE_CLOCK_GETTIME +import Data.Time.Clock.CTimespec +import Foreign.C.Types (CTime(..)) #else import Data.Time.Clock.CTimeval #endif @@ -55,6 +60,15 @@ getPOSIXTime = do win32_epoch_adjust :: Word64 win32_epoch_adjust = 116444736000000000 +#elif HAVE_CLOCK_GETTIME + +-- Use hi-res POSIX time +ctimespecToPosixSeconds :: CTimespec -> POSIXTime +ctimespecToPosixSeconds (MkCTimespec (CTime s) ns) = + (fromIntegral s) + (fromIntegral ns) / 1000000000 + +getPOSIXTime = liftM ctimespecToPosixSeconds getCTimespec + #else -- Use POSIX time diff --git a/time.cabal b/time.cabal index ed6479e..0115a47 100644 --- a/time.cabal +++ b/time.cabal @@ -75,6 +75,7 @@ library Data.Time.Clock.Scale, Data.Time.Clock.UTC, Data.Time.Clock.CTimeval, + Data.Time.Clock.CTimespec, Data.Time.Clock.UTCDiff, Data.Time.LocalTime.TimeZone, Data.Time.LocalTime.TimeOfDay, From git at git.haskell.org Mon Feb 20 21:18:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:18:02 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Merge pull request #38 from redneb/clock_gettime (882305f) Message-ID: <20170220211802.B3DDD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/882305fbe11e1ce43fbd7cf09f5e64f7d755d67e >--------------------------------------------------------------- commit 882305fbe11e1ce43fbd7cf09f5e64f7d755d67e Merge: 020ce40 1b74336 Author: Ashley Yakeley Date: Sun Aug 23 13:01:53 2015 -0700 Merge pull request #38 from redneb/clock_gettime use clock_gettime to implement getPOSIXTime if available >--------------------------------------------------------------- 882305fbe11e1ce43fbd7cf09f5e64f7d755d67e configure.ac | 2 ++ lib/Data/Time/Clock/CTimespec.hsc | 41 +++++++++++++++++++++++++++++++++++++++ lib/Data/Time/Clock/POSIX.hs | 14 +++++++++++++ time.cabal | 1 + 4 files changed, 58 insertions(+) From git at git.haskell.org Mon Feb 20 21:18:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:18:04 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Merge pull request #35 from bergmark/ghc70 (45c652b) Message-ID: <20170220211804.BCA133A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/45c652b0a88097bf00ab2e81625741ee3552a309 >--------------------------------------------------------------- commit 45c652b0a88097bf00ab2e81625741ee3552a309 Merge: 882305f 603b058 Author: Ashley Yakeley Date: Sun Aug 23 13:08:53 2015 -0700 Merge pull request #35 from bergmark/ghc70 Fix compilation on GHC 7.0 by not using Trustworthy >--------------------------------------------------------------- 45c652b0a88097bf00ab2e81625741ee3552a309 lib/Data/Time/Clock/CTimeval.hs | 2 +- lib/Data/Time/Clock/Scale.hs | 3 ++- lib/Data/Time/Clock/UTC.hs | 3 ++- lib/Data/Time/LocalTime/TimeZone.hs | 2 +- time.cabal | 3 +-- 5 files changed, 7 insertions(+), 6 deletions(-) From git at git.haskell.org Mon Feb 20 21:18:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:18:06 +0000 (UTC) Subject: [commit: packages/time] format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis: use stack; include autotools stuff (899f339) Message-ID: <20170220211806.CA6133A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/899f3394427f53e04bd2c7ddd14d5ff3916a037f >--------------------------------------------------------------- commit 899f3394427f53e04bd2c7ddd14d5ff3916a037f Author: Ashley Yakeley Date: Sat Dec 19 14:48:35 2015 -0800 use stack; include autotools stuff >--------------------------------------------------------------- 899f3394427f53e04bd2c7ddd14d5ff3916a037f .gitignore | 3 +- Makefile | 39 - configure | 4638 +++++++++++++++++++++++++++++++++++++++++ lib/include/HsTimeConfig.h.in | 89 + stack.yaml | 32 + 5 files changed, 4760 insertions(+), 41 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 899f3394427f53e04bd2c7ddd14d5ff3916a037f From git at git.haskell.org Mon Feb 20 21:18:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:18:08 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: fix bug in fromSundayStartWeekValid, with tests (1732b96) Message-ID: <20170220211808.D4D9F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/1732b969c0e2845b20969a539db217eff9e1c91f >--------------------------------------------------------------- commit 1732b969c0e2845b20969a539db217eff9e1c91f Author: Ashley Yakeley Date: Sat Dec 19 19:59:01 2015 -0800 fix bug in fromSundayStartWeekValid, with tests >--------------------------------------------------------------- 1732b969c0e2845b20969a539db217eff9e1c91f lib/Data/Time/Calendar/OrdinalDate.hs | 109 ++++++++++++++++++++++++---------- test/Test/TestValid.hs | 61 +++++++++++++++++++ test/Test/Tests.hs | 4 +- time.cabal | 1 + 4 files changed, 141 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 1732b969c0e2845b20969a539db217eff9e1c91f From git at git.haskell.org Mon Feb 20 21:18:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:18:10 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: make parsing reject invalid dates and the like (e9cd141) Message-ID: <20170220211810.DD99A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/e9cd1412d9e6b6a52f936edfe370ced30084ae88 >--------------------------------------------------------------- commit e9cd1412d9e6b6a52f936edfe370ced30084ae88 Author: Ashley Yakeley Date: Sat Dec 19 20:13:27 2015 -0800 make parsing reject invalid dates and the like >--------------------------------------------------------------- e9cd1412d9e6b6a52f936edfe370ced30084ae88 lib/Data/Time/Format/Parse.hs | 361 ++++++++++++++++++++++++++++-------------- test/Test/TestFormat.hs | 8 +- 2 files changed, 245 insertions(+), 124 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 e9cd1412d9e6b6a52f936edfe370ced30084ae88 From git at git.haskell.org Mon Feb 20 21:18:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:18:12 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: bump version (05ae57a) Message-ID: <20170220211812.E499E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/05ae57ad38e1b8d56146b213050dc6b9886a1ee6 >--------------------------------------------------------------- commit 05ae57ad38e1b8d56146b213050dc6b9886a1ee6 Author: Ashley Yakeley Date: Sat Dec 19 20:31:28 2015 -0800 bump version >--------------------------------------------------------------- 05ae57ad38e1b8d56146b213050dc6b9886a1ee6 configure.ac | 2 +- time.cabal | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 4be2aff..4367fd2 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([Haskell time package], [1.4.0.2], [ashley at semantic.org], [time]) +AC_INIT([Haskell time package], [1.6], [ashley at semantic.org], [time]) # Safety check: Ensure that we are in the correct source directory. AC_CONFIG_SRCDIR([lib/include/HsTime.h]) diff --git a/time.cabal b/time.cabal index 31d1e93..4e766b2 100644 --- a/time.cabal +++ b/time.cabal @@ -1,5 +1,5 @@ name: time -version: 1.5.1 +version: 1.6 stability: stable license: BSD3 license-file: LICENSE @@ -98,7 +98,7 @@ test-suite ShowDefaultTZAbbreviations ghc-options: -Wall -fwarn-tabs build-depends: base, - time == 1.5.1 + time == 1.6 main-is: ShowDefaultTZAbbreviations.hs test-suite tests @@ -120,7 +120,7 @@ test-suite tests build-depends: base, deepseq, - time == 1.5.1, + time == 1.6, QuickCheck >= 2.5.1, test-framework >= 0.8, test-framework-quickcheck2 >= 0.3, From git at git.haskell.org Mon Feb 20 21:18:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:18:14 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: remove trailing space (b31cee9) Message-ID: <20170220211814.EBA7D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/b31cee91232e1f134a8cfa41b977077854ccc040 >--------------------------------------------------------------- commit b31cee91232e1f134a8cfa41b977077854ccc040 Author: Ashley Yakeley Date: Sat Dec 19 20:33:15 2015 -0800 remove trailing space >--------------------------------------------------------------- b31cee91232e1f134a8cfa41b977077854ccc040 lib/Data/Time/Calendar/OrdinalDate.hs | 0 lib/Data/Time/Format/Parse.hs | 0 test/Test/ConvertBack.hs | 0 test/Test/TestTime.hs | 0 4 files changed, 0 insertions(+), 0 deletions(-) From git at git.haskell.org Mon Feb 20 21:18:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:18:19 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Remove autogenerated artifacts from Git (409d7a0) Message-ID: <20170220211819.09C903A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/409d7a01659c2ac331017a6ece423485bc7aaf01 >--------------------------------------------------------------- commit 409d7a01659c2ac331017a6ece423485bc7aaf01 Author: Herbert Valerio Riedel Date: Sun Dec 20 09:14:46 2015 +0100 Remove autogenerated artifacts from Git @AshleyYakeley I had to remove these in order to be able to update to time-1.6 in GHC as it otherwise breaks GHC's buildsystem GHC's buildsystem needs to regenerate those files and cause subtle but annoying issues for users if files tracked by Git are modified everytime GHC is built. >--------------------------------------------------------------- 409d7a01659c2ac331017a6ece423485bc7aaf01 .gitignore | 2 + configure | 4638 ----------------------------------------- lib/include/HsTimeConfig.h.in | 89 - 3 files changed, 2 insertions(+), 4727 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 409d7a01659c2ac331017a6ece423485bc7aaf01 From git at git.haskell.org Mon Feb 20 21:18:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:18:21 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Restore compat for GHC 7.8 (5cd5490) Message-ID: <20170220211821.1150E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/5cd5490e271b1e137d46cb9ec2e75624c154be8d >--------------------------------------------------------------- commit 5cd5490e271b1e137d46cb9ec2e75624c154be8d Author: Herbert Valerio Riedel Date: Sun Dec 20 15:37:45 2015 +0100 Restore compat for GHC 7.8 Restoring support for GHC 7.6 would require more work due to MkFixed This renders #41 obsolete >--------------------------------------------------------------- 5cd5490e271b1e137d46cb9ec2e75624c154be8d lib/Data/Time/Format/Parse.hs | 3 +++ time.cabal | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Data/Time/Format/Parse.hs b/lib/Data/Time/Format/Parse.hs index 3918719..30b4705 100644 --- a/lib/Data/Time/Format/Parse.hs +++ b/lib/Data/Time/Format/Parse.hs @@ -27,6 +27,9 @@ import Data.Time.LocalTime.TimeZone import Data.Time.LocalTime.TimeOfDay import Data.Time.LocalTime.LocalTime +#if !MIN_VERSION_base(4,8,0) +import Control.Applicative ((<$>),(<*>)) +#endif #if LANGUAGE_Rank2Types import Control.Monad #endif diff --git a/time.cabal b/time.cabal index 8eea72e..bf74606 100644 --- a/time.cabal +++ b/time.cabal @@ -49,7 +49,7 @@ library cpp-options: -DLANGUAGE_Rank2Types ghc-options: -Wall -fwarn-tabs build-depends: - base >= 4.3 && < 5, + base >= 4.7 && < 5, deepseq >= 1.1 if os(windows) build-depends: Win32 From git at git.haskell.org Mon Feb 20 21:18:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:18:17 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: added changelog.md (346ced4) Message-ID: <20170220211817.00B2E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/346ced46c94c6113b7333beb8fa1b577f03fa2e5 >--------------------------------------------------------------- commit 346ced46c94c6113b7333beb8fa1b577f03fa2e5 Author: Ashley Yakeley Date: Sat Dec 19 20:47:55 2015 -0800 added changelog.md >--------------------------------------------------------------- 346ced46c94c6113b7333beb8fa1b577f03fa2e5 changelog.md | 17 +++++++++++++++++ time.cabal | 1 + 2 files changed, 18 insertions(+) diff --git a/changelog.md b/changelog.md new file mode 100644 index 0000000..ee9e84c --- /dev/null +++ b/changelog.md @@ -0,0 +1,17 @@ +# Change Log + +## [1.6] + +### Added +- FormatTime, ParseTime, Show and Read instances for UniversalTime +- diffTimeToPicoseconds +- this change log + +### Changed +- Use clock_gettime where available +- Read and Show instances exported in the same module as their types +- Fixed bug in fromSundayStartWeekValid +- Parsing functions now reject invalid dates +- Various documentation fixes + +## [1.5.0.1] diff --git a/time.cabal b/time.cabal index 4e766b2..8eea72e 100644 --- a/time.cabal +++ b/time.cabal @@ -15,6 +15,7 @@ cabal-version: >=1.10 x-follows-version-policy: extra-source-files: + changelog.md aclocal.m4 configure.ac configure From git at git.haskell.org Mon Feb 20 21:18:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:18:23 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Merge pull request #42 from hvr/pr/ghc-78-fix (cc7f64b) Message-ID: <20170220211823.195073A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/cc7f64b0e36e1df24a3b167a93640921a1e765a9 >--------------------------------------------------------------- commit cc7f64b0e36e1df24a3b167a93640921a1e765a9 Merge: 409d7a0 5cd5490 Author: Ashley Yakeley Date: Sun Dec 20 13:28:38 2015 -0800 Merge pull request #42 from hvr/pr/ghc-78-fix Restore compat for GHC 7.8 >--------------------------------------------------------------- cc7f64b0e36e1df24a3b167a93640921a1e765a9 lib/Data/Time/Format/Parse.hs | 3 +++ time.cabal | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) From git at git.haskell.org Mon Feb 20 21:18:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:18:25 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Remove obsolete `--with-cc` flag from configure.ac (2d939c9) Message-ID: <20170220211825.2043D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/2d939c9cdb4dcdfc88737a38463e7e5bde8eb240 >--------------------------------------------------------------- commit 2d939c9cdb4dcdfc88737a38463e7e5bde8eb240 Author: Herbert Valerio Riedel Date: Mon Dec 28 08:59:55 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 >--------------------------------------------------------------- 2d939c9cdb4dcdfc88737a38463e7e5bde8eb240 configure.ac | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 4367fd2..457c7e1 100644 --- a/configure.ac +++ b/configure.ac @@ -3,11 +3,10 @@ AC_INIT([Haskell time package], [1.6], [ashley at semantic.org], [time]) # Safety check: Ensure that we are in the correct source directory. AC_CONFIG_SRCDIR([lib/include/HsTime.h]) -AC_ARG_WITH([cc], - [C compiler], - [CC=$withval]) +# These are to silence warnings with older Cabal versions AC_ARG_WITH([gcc],[Gnu C compiler]) AC_ARG_WITH([compiler],[Haskell compiler]) + AC_PROG_CC() AC_CONFIG_HEADERS([lib/include/HsTimeConfig.h]) From git at git.haskell.org Mon Feb 20 21:18:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:18:27 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Enable AC_USE_SYSTEM_EXTENSIONS (716033d) Message-ID: <20170220211827.276143A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/716033de217960037327a09b823f88f1aa96266d >--------------------------------------------------------------- commit 716033de217960037327a09b823f88f1aa96266d Author: Herbert Valerio Riedel Date: Mon Dec 28 09:00:46 2015 +0100 Enable AC_USE_SYSTEM_EXTENSIONS `AC_USE_SYSTEM_EXTENSIONS` takes care of defining feature_test_macros(7) and makes sure we have a consistent environment across GHC. >--------------------------------------------------------------- 716033de217960037327a09b823f88f1aa96266d configure.ac | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure.ac b/configure.ac index 457c7e1..8a9ad02 100644 --- a/configure.ac +++ b/configure.ac @@ -9,6 +9,8 @@ AC_ARG_WITH([compiler],[Haskell compiler]) AC_PROG_CC() +AC_USE_SYSTEM_EXTENSIONS + AC_CONFIG_HEADERS([lib/include/HsTimeConfig.h]) AC_CHECK_HEADERS([time.h]) From git at git.haskell.org Mon Feb 20 21:18:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:18:31 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: version 1.6.0.1 (1eb323b) Message-ID: <20170220211831.37AE93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/1eb323b8eaa46331da2b688ca15343b7815240a4 >--------------------------------------------------------------- commit 1eb323b8eaa46331da2b688ca15343b7815240a4 Author: Ashley Yakeley Date: Fri Apr 22 17:48:56 2016 -0700 version 1.6.0.1 >--------------------------------------------------------------- 1eb323b8eaa46331da2b688ca15343b7815240a4 changelog.md | 4 ++++ configure.ac | 2 +- time.cabal | 6 +++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/changelog.md b/changelog.md index ee9e84c..91b1285 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ # Change Log +## [1.6.0.1] +- Get building with earlier GHC versions +- Set lower bound of base correctly + ## [1.6] ### Added diff --git a/configure.ac b/configure.ac index 8a9ad02..cc86a88 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([Haskell time package], [1.6], [ashley at semantic.org], [time]) +AC_INIT([Haskell time package], [1.6.0.1], [ashley at semantic.org], [time]) # Safety check: Ensure that we are in the correct source directory. AC_CONFIG_SRCDIR([lib/include/HsTime.h]) diff --git a/time.cabal b/time.cabal index bf74606..8a7025b 100644 --- a/time.cabal +++ b/time.cabal @@ -1,5 +1,5 @@ name: time -version: 1.6 +version: 1.6.0.1 stability: stable license: BSD3 license-file: LICENSE @@ -99,7 +99,7 @@ test-suite ShowDefaultTZAbbreviations ghc-options: -Wall -fwarn-tabs build-depends: base, - time == 1.6 + time == 1.6.0.1 main-is: ShowDefaultTZAbbreviations.hs test-suite tests @@ -121,7 +121,7 @@ test-suite tests build-depends: base, deepseq, - time == 1.6, + time == 1.6.0.1, QuickCheck >= 2.5.1, test-framework >= 0.8, test-framework-quickcheck2 >= 0.3, From git at git.haskell.org Mon Feb 20 21:18:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:18:29 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Merge pull request #44 from hvr/pr/configure (a73564c) Message-ID: <20170220211829.307E03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/a73564c366b15f7057b614188662d7b7a8eaab19 >--------------------------------------------------------------- commit a73564c366b15f7057b614188662d7b7a8eaab19 Merge: cc7f64b 716033d Author: Ashley Yakeley Date: Mon Dec 28 09:36:55 2015 -0800 Merge pull request #44 from hvr/pr/configure Tweaks to configure.ac >--------------------------------------------------------------- a73564c366b15f7057b614188662d7b7a8eaab19 configure.ac | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) From git at git.haskell.org Mon Feb 20 21:18:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:18:33 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty, wip/travis: Add Travis-CI job config (393e6e2) Message-ID: <20170220211833.413803A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty,wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/393e6e247fd472d8833e69cc79679ba9c09311bc >--------------------------------------------------------------- commit 393e6e247fd472d8833e69cc79679ba9c09311bc Author: Herbert Valerio Riedel Date: Thu May 5 11:37:11 2016 +0200 Add Travis-CI job config >--------------------------------------------------------------- 393e6e247fd472d8833e69cc79679ba9c09311bc .travis.yml | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ time.cabal | 1 + 2 files changed, 83 insertions(+) diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..de662d8 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,82 @@ +# 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.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.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 + - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH + +install: + - 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 --enable-tests --enable-benchmarks --dry -v > installplan.txt + - sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt + +# 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 "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 --enable-tests --enable-benchmarks; + 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 --enable-tests --enable-benchmarks -v2 # -v2 provides useful information for debugging + - cabal build # this builds all libraries and executables (including tests/benchmarks) + - cabal test + - cabal check + - 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/time.cabal b/time.cabal index 8a7025b..4a6eb02 100644 --- a/time.cabal +++ b/time.cabal @@ -12,6 +12,7 @@ description: A time library category: System build-type: Configure cabal-version: >=1.10 +tested-with: GHC == 8.0.1, GHC == 7.10.3, GHC == 7.8.4 x-follows-version-policy: extra-source-files: From git at git.haskell.org Mon Feb 20 21:18:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:18:35 +0000 (UTC) Subject: [commit: packages/time] wip/travis: Disable travis caching logic for now (6c35d3a) Message-ID: <20170220211835.479B83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branch : wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/6c35d3a7433173ca92771153f3ad483435a8b447 >--------------------------------------------------------------- commit 6c35d3a7433173ca92771153f3ad483435a8b447 Author: Herbert Valerio Riedel Date: Thu May 5 12:12:45 2016 +0200 Disable travis caching logic for now >--------------------------------------------------------------- 6c35d3a7433173ca92771153f3ad483435a8b447 .travis.yml | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-) diff --git a/.travis.yml b/.travis.yml index de662d8..245ec22 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,6 @@ sudo: false cache: directories: - - $HOME/.cabsnap - $HOME/.cabal/packages before_cache: @@ -37,37 +36,16 @@ install: fi - travis_retry cabal update -v - sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config - - cabal install --only-dependencies --enable-tests --enable-benchmarks --dry -v > installplan.txt - - sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt -# 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 "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 --enable-tests --enable-benchmarks; - 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 +# cache-logic disabled for now # 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 --enable-tests --enable-benchmarks -v2 # -v2 provides useful information for debugging +# worarkound cyclic deps within testsuite + - cabal install . 'QuickCheck >= 2.5.1' 'test-framework >= 0.8' 'test-framework-quickcheck2' + - cabal configure --enable-tests -v2 # -v2 provides useful information for debugging - cabal build # this builds all libraries and executables (including tests/benchmarks) - cabal test - cabal check From git at git.haskell.org Mon Feb 20 21:18:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:18:37 +0000 (UTC) Subject: [commit: packages/time] wip/travis: force-reinstalls (f18e3c3) Message-ID: <20170220211837.4E55B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branch : wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/f18e3c3bfe413a50ba66df1dcc08ca3fb0233a2e >--------------------------------------------------------------- commit f18e3c3bfe413a50ba66df1dcc08ca3fb0233a2e Author: Herbert Valerio Riedel Date: Thu May 5 12:29:39 2016 +0200 force-reinstalls >--------------------------------------------------------------- f18e3c3bfe413a50ba66df1dcc08ca3fb0233a2e .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 245ec22..53e6309 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,7 +44,7 @@ install: script: - if [ -f configure.ac ]; then autoreconf -i; fi # worarkound cyclic deps within testsuite - - cabal install . 'QuickCheck >= 2.5.1' 'test-framework >= 0.8' 'test-framework-quickcheck2' + - cabal install . 'QuickCheck >= 2.5.1' 'test-framework >= 0.8' 'test-framework-quickcheck2' --force-reinstalls - cabal configure --enable-tests -v2 # -v2 provides useful information for debugging - cabal build # this builds all libraries and executables (including tests/benchmarks) - cabal test From git at git.haskell.org Mon Feb 20 21:18:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:18:41 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty: Disable travis caching logic for now (16a36e4) Message-ID: <20170220211841.5C71A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/16a36e43507101ee21aa921a61e963578a7e3e4c >--------------------------------------------------------------- commit 16a36e43507101ee21aa921a61e963578a7e3e4c Author: Herbert Valerio Riedel Date: Thu May 5 12:12:45 2016 +0200 Disable travis caching logic for now >--------------------------------------------------------------- 16a36e43507101ee21aa921a61e963578a7e3e4c .travis.yml | 33 ++++++--------------------------- 1 file changed, 6 insertions(+), 27 deletions(-) diff --git a/.travis.yml b/.travis.yml index de662d8..4153c83 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,6 @@ sudo: false cache: directories: - - $HOME/.cabsnap - $HOME/.cabal/packages before_cache: @@ -37,39 +36,19 @@ install: fi - travis_retry cabal update -v - sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config - - cabal install --only-dependencies --enable-tests --enable-benchmarks --dry -v > installplan.txt - - sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt -# 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 "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 --enable-tests --enable-benchmarks; - 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 +# cache-logic disabled for now # 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 --enable-tests --enable-benchmarks -v2 # -v2 provides useful information for debugging +# worarkound cyclic deps within testsuite +# no tests for now +# - cabal install . 'QuickCheck >= 2.5.1' 'test-framework >= 0.8' 'test-framework-quickcheck2' --force-reinstalls + - cabal configure --disable-tests -v2 # -v2 provides useful information for debugging - cabal build # this builds all libraries and executables (including tests/benchmarks) - - cabal test +# - cabal test - cabal check - cabal sdist # tests that a source-distribution can be generated From git at git.haskell.org Mon Feb 20 21:18:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:18:43 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty: remove stack.yaml for the time being (52e0f5e) Message-ID: <20170220211843.644183A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/52e0f5e85ffbaab77b155d48720fb216021c8a73 >--------------------------------------------------------------- commit 52e0f5e85ffbaab77b155d48720fb216021c8a73 Author: Ashley Yakeley Date: Fri May 6 17:18:46 2016 -0700 remove stack.yaml for the time being >--------------------------------------------------------------- 52e0f5e85ffbaab77b155d48720fb216021c8a73 stack.yaml | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/stack.yaml b/stack.yaml deleted file mode 100644 index 4b5c03e..0000000 --- a/stack.yaml +++ /dev/null @@ -1,32 +0,0 @@ -# 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-3.18 - -# 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.10.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 Mon Feb 20 21:18:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:18:39 +0000 (UTC) Subject: [commit: packages/time] wip/travis: disable tests (b837d6c) Message-ID: <20170220211839.54DD23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branch : wip/travis Link : http://git.haskell.org/packages/time.git/commitdiff/b837d6c1a7ba651fe67043a27d2bd0ffea2235fa >--------------------------------------------------------------- commit b837d6c1a7ba651fe67043a27d2bd0ffea2235fa Author: Herbert Valerio Riedel Date: Thu May 5 12:43:00 2016 +0200 disable tests >--------------------------------------------------------------- b837d6c1a7ba651fe67043a27d2bd0ffea2235fa .travis.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 53e6309..4153c83 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,10 +44,11 @@ install: script: - if [ -f configure.ac ]; then autoreconf -i; fi # worarkound cyclic deps within testsuite - - cabal install . 'QuickCheck >= 2.5.1' 'test-framework >= 0.8' 'test-framework-quickcheck2' --force-reinstalls - - cabal configure --enable-tests -v2 # -v2 provides useful information for debugging +# no tests for now +# - cabal install . 'QuickCheck >= 2.5.1' 'test-framework >= 0.8' 'test-framework-quickcheck2' --force-reinstalls + - cabal configure --disable-tests -v2 # -v2 provides useful information for debugging - cabal build # this builds all libraries and executables (including tests/benchmarks) - - cabal test +# - cabal test - cabal check - cabal sdist # tests that a source-distribution can be generated From git at git.haskell.org Mon Feb 20 21:18:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:18:45 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty: added stack.yaml (171ee88) Message-ID: <20170220211845.6B6E13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/171ee88fd30f9df0d2ffc9f83180b090647fb8db >--------------------------------------------------------------- commit 171ee88fd30f9df0d2ffc9f83180b090647fb8db Author: Ashley Yakeley Date: Sun Nov 13 21:22:55 2016 -0800 added stack.yaml >--------------------------------------------------------------- 171ee88fd30f9df0d2ffc9f83180b090647fb8db stack.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/stack.yaml b/stack.yaml new file mode 100644 index 0000000..3fbbbeb --- /dev/null +++ b/stack.yaml @@ -0,0 +1,3 @@ +resolver: lts-6.25 +packages: +- '.' From git at git.haskell.org Mon Feb 20 21:18:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:18:47 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty: Better leap-second handling (d6863ff) Message-ID: <20170220211847.733953A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/d6863ffef40f3af69b9cbbd5397e39f89f81324f >--------------------------------------------------------------- commit d6863ffef40f3af69b9cbbd5397e39f89f81324f Author: Ashley Yakeley Date: Sun Nov 13 21:42:25 2016 -0800 Better leap-second handling >--------------------------------------------------------------- d6863ffef40f3af69b9cbbd5397e39f89f81324f lib/Data/Time/Clock/TAI.hs | 127 ++++++++++++------------------------------ test/Test/TAI_UTC_DAT.hs | 42 -------------- test/Test/TestParseDAT.hs | 53 ------------------ test/Test/TestParseDAT_Ref.hs | 95 ------------------------------- test/Test/Tests.hs | 2 - time.cabal | 3 - 6 files changed, 35 insertions(+), 287 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 d6863ffef40f3af69b9cbbd5397e39f89f81324f From git at git.haskell.org Mon Feb 20 21:18:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:18:49 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty: tests for leap-second conversion (7c29ef7) Message-ID: <20170220211849.7C7A13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/7c29ef790802bfab897ad1b116b0b94761e4eff0 >--------------------------------------------------------------- commit 7c29ef790802bfab897ad1b116b0b94761e4eff0 Author: Ashley Yakeley Date: Sat Nov 19 00:14:39 2016 -0800 tests for leap-second conversion >--------------------------------------------------------------- 7c29ef790802bfab897ad1b116b0b94761e4eff0 test/Test/TestTAI.hs | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++ test/Test/TestUtil.hs | 20 +++++++++++++++++ test/Test/Tests.hs | 2 ++ time.cabal | 1 + 4 files changed, 83 insertions(+) diff --git a/test/Test/TestTAI.hs b/test/Test/TestTAI.hs new file mode 100644 index 0000000..9284f35 --- /dev/null +++ b/test/Test/TestTAI.hs @@ -0,0 +1,60 @@ +module Test.TestTAI(testTAI) where + +import Data.Time +import Data.Time.Clock.TAI +import Test.TestUtil + + +sampleLeapSecondMap :: LeapSecondMap Maybe +sampleLeapSecondMap d | d < fromGregorian 1972 1 1 = Nothing +sampleLeapSecondMap d | d < fromGregorian 1972 7 1 = Just 10 +sampleLeapSecondMap d | d < fromGregorian 1975 1 1 = Just 11 +sampleLeapSecondMap _ = Nothing + +testTAI :: TestTree; +testTAI = testGroup "leap second transition" $ let + dayA = fromGregorian 1972 6 30 + dayB = fromGregorian 1972 7 1 + + utcTime1 = UTCTime dayA 86399 + utcTime2 = UTCTime dayA 86400 + utcTime3 = UTCTime dayB 0 + + mAbsTime1 = utcToTAITime sampleLeapSecondMap utcTime1 + mAbsTime2 = utcToTAITime sampleLeapSecondMap utcTime2 + mAbsTime3 = utcToTAITime sampleLeapSecondMap utcTime3 + in + [ + testCase "mapping" $ do + assertEqual "dayA" (Just 10) $ sampleLeapSecondMap dayA + assertEqual "dayB" (Just 11) $ sampleLeapSecondMap dayB + , + testCase "day length" $ do + assertEqual "dayA" (Just 86401) $ utcDayLength sampleLeapSecondMap dayA + assertEqual "dayB" (Just 86400) $ utcDayLength sampleLeapSecondMap dayB + , + testCase "differences" $ do + absTime1 <- assertJust mAbsTime1 + absTime2 <- assertJust mAbsTime2 + absTime3 <- assertJust mAbsTime3 + assertEqual "absTime2 - absTime1" 1 $ diffAbsoluteTime absTime2 absTime1 + assertEqual "absTime3 - absTime2" 1 $ diffAbsoluteTime absTime3 absTime2 + , + testGroup "round-trip" + [ + testCase "1" $ do + absTime <- assertJust mAbsTime1 + utcTime <- assertJust $ taiToUTCTime sampleLeapSecondMap absTime + assertEqual "round-trip" utcTime1 utcTime + , + testCase "2" $ do + absTime <- assertJust mAbsTime2 + utcTime <- assertJust $ taiToUTCTime sampleLeapSecondMap absTime + assertEqual "round-trip" utcTime2 utcTime + , + testCase "3" $ do + absTime <- assertJust mAbsTime3 + utcTime <- assertJust $ taiToUTCTime sampleLeapSecondMap absTime + assertEqual "round-trip" utcTime3 utcTime + ] + ] diff --git a/test/Test/TestUtil.hs b/test/Test/TestUtil.hs index b711f93..cef8763 100644 --- a/test/Test/TestUtil.hs +++ b/test/Test/TestUtil.hs @@ -37,3 +37,23 @@ diff :: (Show a,Eq a) => a -> a -> Result diff expected found | expected == found = Pass diff expected found = Fail ("expected " ++ (show expected) ++ " but found " ++ (show found)) + +-- for tasty-like test code + +type TestTree = Test +type Assertion = Either String () + +testCase :: String -> Assertion -> Test +testCase name (Right ()) = pureTest name Pass +testCase name (Left s) = pureTest name (Fail s) + +assertFailure :: String -> Either String a +assertFailure = Left + +assertEqual :: (Show a,Eq a) => String -> a -> a -> Assertion +assertEqual _ expected found | expected == found = return () +assertEqual name expected found = assertFailure $ name ++ ": expected " ++ (show expected) ++ " but found " ++ (show found) + +assertJust :: Maybe a -> Either String a +assertJust (Just a) = return a +assertJust Nothing = assertFailure "Nothing" diff --git a/test/Test/Tests.hs b/test/Test/Tests.hs index cd5ac0f..d241204 100644 --- a/test/Test/Tests.hs +++ b/test/Test/Tests.hs @@ -11,6 +11,7 @@ import Test.TestEaster import Test.TestFormat import Test.TestMonthDay import Test.TestParseTime +import Test.TestTAI import Test.TestTime import Test.TestTimeZone import Test.TestValid @@ -25,6 +26,7 @@ tests = [ addDaysTest , testFormat , testMonthDay , testParseTime + , testTAI , testTime , testTimeZone , testValid ] diff --git a/time.cabal b/time.cabal index e48087a..8b520b4 100644 --- a/time.cabal +++ b/time.cabal @@ -140,6 +140,7 @@ test-suite tests Test.TestEasterRef Test.TestCalendars Test.TestCalendarsRef + Test.TestTAI Test.TestTimeZone Test.TestValid Test.LongWeekYears From git at git.haskell.org Mon Feb 20 21:18:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:18:51 +0000 (UTC) Subject: [commit: packages/time] format-widths, improve-leapseconds, master, posix-perf, tasty: Simplify LeapSecondMap type (7b1dddd) Message-ID: <20170220211851.834DA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,improve-leapseconds,master,posix-perf,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/7b1dddd9d1d0fe4bc3c82d8dedb9ca3232b556b1 >--------------------------------------------------------------- commit 7b1dddd9d1d0fe4bc3c82d8dedb9ca3232b556b1 Author: Ashley Yakeley Date: Sat Nov 19 00:15:25 2016 -0800 Simplify LeapSecondMap type >--------------------------------------------------------------- 7b1dddd9d1d0fe4bc3c82d8dedb9ca3232b556b1 lib/Data/Time/Clock/TAI.hs | 10 +++++----- test/Test/TestTAI.hs | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/Data/Time/Clock/TAI.hs b/lib/Data/Time/Clock/TAI.hs index 054e0ad..dbde65f 100644 --- a/lib/Data/Time/Clock/TAI.hs +++ b/lib/Data/Time/Clock/TAI.hs @@ -56,25 +56,25 @@ diffAbsoluteTime (MkAbsoluteTime a) (MkAbsoluteTime b) = a - b -- | TAI - UTC during this day. -- No table is provided, as any program compiled with it would become -- out of date in six months. -type LeapSecondMap m = Day -> m Int +type LeapSecondMap = Day -> Maybe Int -utcDayLength :: Monad m => LeapSecondMap m -> Day -> m DiffTime +utcDayLength :: LeapSecondMap -> Day -> Maybe DiffTime utcDayLength lsmap day = do i0 <- lsmap day i1 <- lsmap $ addDays 1 day return $ realToFrac (86400 + i1 - i0) -dayStart :: Monad m => LeapSecondMap m -> Day -> m AbsoluteTime +dayStart :: LeapSecondMap -> Day -> Maybe AbsoluteTime dayStart lsmap day = do i <- lsmap day return $ addAbsoluteTime (realToFrac $ (toModifiedJulianDay day) * 86400 + toInteger i) taiEpoch -utcToTAITime :: Monad m => LeapSecondMap m -> UTCTime -> m AbsoluteTime +utcToTAITime :: LeapSecondMap -> UTCTime -> Maybe AbsoluteTime utcToTAITime lsmap (UTCTime day dtime) = do t <- dayStart lsmap day return $ addAbsoluteTime dtime t -taiToUTCTime :: Monad m => LeapSecondMap m -> AbsoluteTime -> m UTCTime +taiToUTCTime :: LeapSecondMap -> AbsoluteTime -> Maybe UTCTime taiToUTCTime lsmap abstime = let stable day = do dayt <- dayStart lsmap day diff --git a/test/Test/TestTAI.hs b/test/Test/TestTAI.hs index 9284f35..dfaf605 100644 --- a/test/Test/TestTAI.hs +++ b/test/Test/TestTAI.hs @@ -5,7 +5,7 @@ import Data.Time.Clock.TAI import Test.TestUtil -sampleLeapSecondMap :: LeapSecondMap Maybe +sampleLeapSecondMap :: LeapSecondMap sampleLeapSecondMap d | d < fromGregorian 1972 1 1 = Nothing sampleLeapSecondMap d | d < fromGregorian 1972 7 1 = Just 10 sampleLeapSecondMap d | d < fromGregorian 1975 1 1 = Just 11 From git at git.haskell.org Mon Feb 20 21:18:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:18:53 +0000 (UTC) Subject: [commit: packages/time] format-widths,master,posix-perf,tasty: set version to 1.7; changelog (df8a5e4) Message-ID: <20170220211853.8A7253A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,master,posix-perf,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/df8a5e4d6749ca743efa15b8547402f57ee72d8b >--------------------------------------------------------------- commit df8a5e4d6749ca743efa15b8547402f57ee72d8b Author: Ashley Yakeley Date: Sat Nov 19 00:30:21 2016 -0800 set version to 1.7; changelog >--------------------------------------------------------------- df8a5e4d6749ca743efa15b8547402f57ee72d8b changelog.md | 3 +++ configure.ac | 2 +- time.cabal | 6 +++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/changelog.md b/changelog.md index 91b1285..e1e44a2 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,8 @@ # Change Log +## [1.7] +- Data.Time.Clock.TAI: change LeapSecondTable to LeapSecondMap with Maybe type; remove parseTAIUTCDATFile + ## [1.6.0.1] - Get building with earlier GHC versions - Set lower bound of base correctly diff --git a/configure.ac b/configure.ac index cc86a88..4f254dd 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([Haskell time package], [1.6.0.1], [ashley at semantic.org], [time]) +AC_INIT([Haskell time package], [1.7], [ashley at semantic.org], [time]) # Safety check: Ensure that we are in the correct source directory. AC_CONFIG_SRCDIR([lib/include/HsTime.h]) diff --git a/time.cabal b/time.cabal index 8b520b4..99ed765 100644 --- a/time.cabal +++ b/time.cabal @@ -1,5 +1,5 @@ name: time -version: 1.6.0.1 +version: 1.7 stability: stable license: BSD3 license-file: LICENSE @@ -100,7 +100,7 @@ test-suite ShowDefaultTZAbbreviations ghc-options: -Wall -fwarn-tabs build-depends: base, - time == 1.6.0.1 + time == 1.7 main-is: ShowDefaultTZAbbreviations.hs test-suite tests @@ -122,7 +122,7 @@ test-suite tests build-depends: base, deepseq, - time == 1.6.0.1, + time == 1.7, QuickCheck >= 2.5.1, test-framework >= 0.8, test-framework-quickcheck2 >= 0.3, From git at git.haskell.org Mon Feb 20 21:18:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:18:55 +0000 (UTC) Subject: [commit: packages/time] format-widths, master, posix-perf, tasty: add bench, improve getCurrentTime (9008175) Message-ID: <20170220211855.932633A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,master,posix-perf,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/900817565e44152e1083d5dd2d0f7e07683c830a >--------------------------------------------------------------- commit 900817565e44152e1083d5dd2d0f7e07683c830a Author: winterland1989 Date: Tue Nov 29 01:59:32 2016 +0800 add bench, improve getCurrentTime >--------------------------------------------------------------- 900817565e44152e1083d5dd2d0f7e07683c830a benchmark/Main.hs | 19 +++++++++++++ lib/Data/Time/Clock/POSIX.hs | 43 +++++++++++++++++++++++++----- time.cabal | 63 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 119 insertions(+), 6 deletions(-) diff --git a/benchmark/Main.hs b/benchmark/Main.hs new file mode 100644 index 0000000..e64a3cf --- /dev/null +++ b/benchmark/Main.hs @@ -0,0 +1,19 @@ +module Main where + +------------------------------------------------------------------------------- + +import Criterion.Main +import Data.Time.Clock.POSIX +import Data.Time + +main :: IO () +main = do + getCurrentTime >>= print + getPOSIXTime >>= print . posixSecondsToUTCTime + defaultMain + [ bgroup "time" + [ bench "UTCTime" $ whnfIO getCurrentTime + , bench "POSIXTime" $ whnfIO getPOSIXTime + ] + ] + diff --git a/lib/Data/Time/Clock/POSIX.hs b/lib/Data/Time/Clock/POSIX.hs index a7a3737..1aa1901 100644 --- a/lib/Data/Time/Clock/POSIX.hs +++ b/lib/Data/Time/Clock/POSIX.hs @@ -6,18 +6,20 @@ module Data.Time.Clock.POSIX ) where import Data.Time.Clock.UTC +import Data.Time.Clock.Scale (picosecondsToDiffTime) import Data.Time.Calendar.Days import Data.Fixed import Control.Monad +import Data.Int (Int64) #include "HsTimeConfig.h" #ifdef mingw32_HOST_OS -import Data.Word ( Word64) +import Data.Word (Word64) import System.Win32.Time #elif HAVE_CLOCK_GETTIME import Data.Time.Clock.CTimespec -import Foreign.C.Types (CTime(..)) +import Foreign.C.Types (CTime(..), CLong(..)) #else import Data.Time.Clock.CTimeval #endif @@ -26,6 +28,10 @@ import Data.Time.Clock.CTimeval posixDayLength :: NominalDiffTime posixDayLength = 86400 +-- | 86400 nominal seconds in every day +posixDayLength_ :: Int64 +posixDayLength_ = 86400 + -- | POSIX time is the nominal time since 1970-01-01 00:00 UTC -- -- To convert from a 'Foreign.C.CTime' or 'System.Posix.EpochTime', use 'realToFrac'. @@ -60,6 +66,17 @@ getPOSIXTime = do win32_epoch_adjust :: Word64 win32_epoch_adjust = 116444736000000000 +getCurrentTime = do + FILETIME ft <- System.Win32.Time.getSystemTimeAsFileTime + let (s, us) = (ft - win32_epoch_adjust) `divMod` 10000000 + (d, s') = fromIntegral s `divMod` posixDayLength_ + ps = s' * 1000000000000 + fromIntegral us * 1000000 -- 'Int64' can hold ps in one day + return + (UTCTime + (addDays (fromIntegral d) unixEpochDay) + (picosecondsToDiffTime (fromIntegral ps)) + ) + #elif HAVE_CLOCK_GETTIME -- Use hi-res POSIX time @@ -69,6 +86,15 @@ ctimespecToPosixSeconds (MkCTimespec (CTime s) ns) = getPOSIXTime = liftM ctimespecToPosixSeconds getCTimespec +getCurrentTime = do + MkCTimespec (CTime s) (CLong ns) <- getCTimespec + let (d, s') = s `divMod` posixDayLength_ + ps = s' * 1000000000000 + ns * 1000 + return + (UTCTime + (addDays (fromIntegral d) unixEpochDay) + (picosecondsToDiffTime (fromIntegral ps)) + ) #else -- Use POSIX time @@ -77,8 +103,13 @@ ctimevalToPosixSeconds (MkCTimeval s mus) = (fromIntegral s) + (fromIntegral mus getPOSIXTime = liftM ctimevalToPosixSeconds getCTimeval +getCurrentTime = do + MkCTimeval (CLong s) (CLong us) <- getCTimeval + let (d, s') = s `divMod` posixDayLength_ + ps = s' * 1000000000000 + us * 1000000 + return + (UTCTime + (addDays (fromIntegral d) unixEpochDay) + (picosecondsToDiffTime (fromIntegral ps)) + ) #endif - --- | Get the current UTC time from the system clock. -getCurrentTime :: IO UTCTime -getCurrentTime = liftM posixSecondsToUTCTime getPOSIXTime diff --git a/time.cabal b/time.cabal index 99ed765..8f791e8 100644 --- a/time.cabal +++ b/time.cabal @@ -151,3 +151,66 @@ test-suite tests Test.AddDays Test.AddDaysRef Test.TestUtil + +benchmark bench + hs-source-dirs: lib, benchmark + default-language: Haskell2010 + type: exitcode-stdio-1.0 + main-is: Main.hs + if impl(ghc) + default-extensions: + Rank2Types + DeriveDataTypeable + StandaloneDeriving + cpp-options: -DLANGUAGE_Rank2Types -DLANGUAGE_DeriveDataTypeable -DLANGUAGE_StandaloneDeriving + else + if impl(hugs) + default-extensions: Rank2Types + cpp-options: -DLANGUAGE_Rank2Types + ghc-options: -Wall -fwarn-tabs + build-depends: + base >= 4.7 && < 5 + , deepseq >= 1.1 + , criterion >= 1.0.2.0 + , time + + if os(windows) + build-depends: Win32 + other-modules: + Data.Time.Calendar, + Data.Time.Calendar.MonthDay, + Data.Time.Calendar.OrdinalDate, + Data.Time.Calendar.WeekDate, + Data.Time.Calendar.Julian, + Data.Time.Calendar.Easter, + Data.Time.Clock, + Data.Time.Clock.POSIX, + Data.Time.Clock.TAI, + Data.Time.LocalTime, + Data.Time.Format, + Data.Time + default-extensions: CPP + c-sources: lib/cbits/HsTime.c + other-modules: + Data.Time.Calendar.Private, + Data.Time.Calendar.Days, + Data.Time.Calendar.Gregorian, + Data.Time.Calendar.JulianYearDay, + Data.Time.Clock.Scale, + Data.Time.Clock.UTC, + Data.Time.Clock.CTimeval, + Data.Time.Clock.CTimespec, + Data.Time.Clock.UTCDiff, + Data.Time.LocalTime.TimeZone, + Data.Time.LocalTime.TimeOfDay, + Data.Time.LocalTime.LocalTime, + Data.Time.Format.Parse + Data.Time.Format.Locale + include-dirs: lib/include + if os(windows) + install-includes: + HsTime.h + else + install-includes: + HsTime.h + HsTimeConfig.h From git at git.haskell.org Mon Feb 20 21:18:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:18:57 +0000 (UTC) Subject: [commit: packages/time] format-widths, master, posix-perf, tasty: fix import with POSIX time (572a72e) Message-ID: <20170220211857.9A2A43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,master,posix-perf,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/572a72ec09d33ae93ccbec86a34e6c0c2193e3d4 >--------------------------------------------------------------- commit 572a72ec09d33ae93ccbec86a34e6c0c2193e3d4 Author: winterland1989 Date: Tue Nov 29 02:20:38 2016 +0800 fix import with POSIX time >--------------------------------------------------------------- 572a72ec09d33ae93ccbec86a34e6c0c2193e3d4 lib/Data/Time/Clock/POSIX.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Data/Time/Clock/POSIX.hs b/lib/Data/Time/Clock/POSIX.hs index 1aa1901..ca8f364 100644 --- a/lib/Data/Time/Clock/POSIX.hs +++ b/lib/Data/Time/Clock/POSIX.hs @@ -22,6 +22,7 @@ import Data.Time.Clock.CTimespec import Foreign.C.Types (CTime(..), CLong(..)) #else import Data.Time.Clock.CTimeval +import Foreign.C.Types (CLong(..)) #endif -- | 86400 nominal seconds in every day From git at git.haskell.org Mon Feb 20 21:18:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:18:59 +0000 (UTC) Subject: [commit: packages/time] format-widths, master, posix-perf, tasty: Replace benchmark stanza with separate time-bench package (fe018aa) Message-ID: <20170220211859.A2FB33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,master,posix-perf,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/fe018aab2322fbac6a928e19a4310013622ed7da >--------------------------------------------------------------- commit fe018aab2322fbac6a928e19a4310013622ed7da Author: Ashley Yakeley Date: Mon Dec 5 22:46:03 2016 -0800 Replace benchmark stanza with separate time-bench package >--------------------------------------------------------------- fe018aab2322fbac6a928e19a4310013622ed7da benchmark/Main.hs | 44 ++++++++++++++++++++++++++------ benchmark/time-bench.cabal | 41 ++++++++++++++++++++++++++++++ time.cabal | 63 ---------------------------------------------- 3 files changed, 77 insertions(+), 71 deletions(-) diff --git a/benchmark/Main.hs b/benchmark/Main.hs index e64a3cf..1be1b67 100644 --- a/benchmark/Main.hs +++ b/benchmark/Main.hs @@ -1,19 +1,47 @@ +{-# LANGUAGE PackageImports #-} module Main where -------------------------------------------------------------------------------- +import Criterion.Main +import Data.Time.Clock +import Data.Time.Calendar +import Data.Time.Clock.POSIX +import Data.Time.LocalTime +import Data.Time.Format +import Data.Time.Clock -import Criterion.Main -import Data.Time.Clock.POSIX -import Data.Time +import qualified "time" Data.Time.Clock as O +import qualified "time" Data.Time.Clock.POSIX as O +import qualified "time" Data.Time.LocalTime as O +import qualified "time" Data.Time.Format as O +import qualified "time" Data.Time.Clock as O main :: IO () main = do getCurrentTime >>= print - getPOSIXTime >>= print . posixSecondsToUTCTime + O.getCurrentTime >>= print + getPOSIXTime >>= print . posixToUTCTime + O.getPOSIXTime >>= print . O.posixSecondsToUTCTime + getZonedTime >>= print + O.getZonedTime >>= print + + tz <- getCurrentTimeZone + ct <- getCurrentTime + otz <- O.getCurrentTimeZone + oct <- O.getCurrentTime + defaultMain - [ bgroup "time" - [ bench "UTCTime" $ whnfIO getCurrentTime - , bench "POSIXTime" $ whnfIO getPOSIXTime + [ bgroup "new" + [ bench "getCurrentTime" $ nfIO getCurrentTime + , bench "getPOSIXTime" $ nfIO getPOSIXTime + , bench "getZonedTime" $ nfIO getZonedTime + , bench "formatTime" $ nf (formatTime defaultTimeLocale "%a, %_d %b %Y %H:%M:%S %Z") ct + ] + , + bgroup "old" + [ bench "getCurrentTime" $ nfIO O.getCurrentTime + , bench "getPOSIXTime" $ nfIO O.getPOSIXTime + , bench "getZonedTime" $ nfIO O.getZonedTime + , bench "formatTime" $ nf (O.formatTime O.defaultTimeLocale "%a, %_d %b %Y %H:%M:%S %Z") oct ] ] diff --git a/benchmark/time-bench.cabal b/benchmark/time-bench.cabal new file mode 100644 index 0000000..0a94ad4 --- /dev/null +++ b/benchmark/time-bench.cabal @@ -0,0 +1,41 @@ +name: time-bench +version: 0.1.0.0 +author: Winter +homepage: https://github.com/haskell/time +bug-reports: https://github.com/haskell/time/issues +cabal-version: >=1.10 +build-type: Simple + + +executable time-bench + hs-source-dirs: ../lib, . + main-is: Main.hs + default-language: Haskell2010 + if impl(ghc) + default-extensions: + Rank2Types + DeriveDataTypeable + StandaloneDeriving + cpp-options: -DLANGUAGE_Rank2Types -DLANGUAGE_DeriveDataTypeable -DLANGUAGE_StandaloneDeriving + else + if impl(hugs) + default-extensions: Rank2Types + cpp-options: -DLANGUAGE_Rank2Types + ghc-options: -Wall -fwarn-tabs + build-depends: + base >= 4.7 && < 5, + deepseq >= 1.1, + time, + criterion + if os(windows) + build-depends: Win32 + default-extensions: CPP + c-sources: ../lib/cbits/HsTime.c + include-dirs: ../lib/include + if os(windows) + install-includes: + HsTime.h + else + install-includes: + HsTime.h + HsTimeConfig.h diff --git a/time.cabal b/time.cabal index 8f791e8..99ed765 100644 --- a/time.cabal +++ b/time.cabal @@ -151,66 +151,3 @@ test-suite tests Test.AddDays Test.AddDaysRef Test.TestUtil - -benchmark bench - hs-source-dirs: lib, benchmark - default-language: Haskell2010 - type: exitcode-stdio-1.0 - main-is: Main.hs - if impl(ghc) - default-extensions: - Rank2Types - DeriveDataTypeable - StandaloneDeriving - cpp-options: -DLANGUAGE_Rank2Types -DLANGUAGE_DeriveDataTypeable -DLANGUAGE_StandaloneDeriving - else - if impl(hugs) - default-extensions: Rank2Types - cpp-options: -DLANGUAGE_Rank2Types - ghc-options: -Wall -fwarn-tabs - build-depends: - base >= 4.7 && < 5 - , deepseq >= 1.1 - , criterion >= 1.0.2.0 - , time - - if os(windows) - build-depends: Win32 - other-modules: - Data.Time.Calendar, - Data.Time.Calendar.MonthDay, - Data.Time.Calendar.OrdinalDate, - Data.Time.Calendar.WeekDate, - Data.Time.Calendar.Julian, - Data.Time.Calendar.Easter, - Data.Time.Clock, - Data.Time.Clock.POSIX, - Data.Time.Clock.TAI, - Data.Time.LocalTime, - Data.Time.Format, - Data.Time - default-extensions: CPP - c-sources: lib/cbits/HsTime.c - other-modules: - Data.Time.Calendar.Private, - Data.Time.Calendar.Days, - Data.Time.Calendar.Gregorian, - Data.Time.Calendar.JulianYearDay, - Data.Time.Clock.Scale, - Data.Time.Clock.UTC, - Data.Time.Clock.CTimeval, - Data.Time.Clock.CTimespec, - Data.Time.Clock.UTCDiff, - Data.Time.LocalTime.TimeZone, - Data.Time.LocalTime.TimeOfDay, - Data.Time.LocalTime.LocalTime, - Data.Time.Format.Parse - Data.Time.Format.Locale - include-dirs: lib/include - if os(windows) - install-includes: - HsTime.h - else - install-includes: - HsTime.h - HsTimeConfig.h From git at git.haskell.org Mon Feb 20 21:19:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:19:01 +0000 (UTC) Subject: [commit: packages/time] format-widths, master, posix-perf, tasty: Change type of POSIX time for performance improvement (827c26c) Message-ID: <20170220211901.AA4EC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,master,posix-perf,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/827c26c27a03dbbb9f91ed5fb7b45a1c6b36fc9d >--------------------------------------------------------------- commit 827c26c27a03dbbb9f91ed5fb7b45a1c6b36fc9d Author: Ashley Yakeley Date: Mon Dec 5 22:46:51 2016 -0800 Change type of POSIX time for performance improvement >--------------------------------------------------------------- 827c26c27a03dbbb9f91ed5fb7b45a1c6b36fc9d lib/Data/Time/Clock/POSIX.hs | 141 ++++++++++++++++++------------------ lib/Data/Time/LocalTime/TimeZone.hs | 2 +- 2 files changed, 73 insertions(+), 70 deletions(-) diff --git a/lib/Data/Time/Clock/POSIX.hs b/lib/Data/Time/Clock/POSIX.hs index ca8f364..68516cd 100644 --- a/lib/Data/Time/Clock/POSIX.hs +++ b/lib/Data/Time/Clock/POSIX.hs @@ -2,20 +2,20 @@ -- Most people won't need this module. module Data.Time.Clock.POSIX ( - posixDayLength,POSIXTime,posixSecondsToUTCTime,utcTimeToPOSIXSeconds,getPOSIXTime,getCurrentTime + posixDayLength,POSIXTime(..),posixSecondsToUTCTime,utcTimeToPOSIXSeconds,getPOSIXTime,getCurrentTime ) where import Data.Time.Clock.UTC import Data.Time.Clock.Scale (picosecondsToDiffTime) import Data.Time.Calendar.Days -import Data.Fixed -import Control.Monad -import Data.Int (Int64) +import Data.Int (Int64) +import Data.Fixed (divMod') +import Control.DeepSeq #include "HsTimeConfig.h" #ifdef mingw32_HOST_OS -import Data.Word (Word64) +import Data.Word (Word64) import System.Win32.Time #elif HAVE_CLOCK_GETTIME import Data.Time.Clock.CTimespec @@ -25,35 +25,52 @@ import Data.Time.Clock.CTimeval import Foreign.C.Types (CLong(..)) #endif --- | 86400 nominal seconds in every day -posixDayLength :: NominalDiffTime -posixDayLength = 86400 - --- | 86400 nominal seconds in every day -posixDayLength_ :: Int64 -posixDayLength_ = 86400 +-------------------------------------------------------------------------------- -- | POSIX time is the nominal time since 1970-01-01 00:00 UTC -- --- To convert from a 'Foreign.C.CTime' or 'System.Posix.EpochTime', use 'realToFrac'. --- -type POSIXTime = NominalDiffTime +data POSIXTime = POSIXTime + { ptSeconds :: {-# UNPACK #-} !Int64 + , ptNanoSeconds :: {-# UNPACK #-} !Int64 + } + +normalizePosix :: POSIXTime -> POSIXTime +normalizePosix raw@(POSIXTime xs xn) + | xn < 0 || xn >= 1000000000 = POSIXTime (xs + q) r + | otherwise = raw + where (q, r) = xn `divMod` 1000000000 + +instance Eq POSIXTime where + rawx == rawy = + let POSIXTime xs xn = normalizePosix rawx + POSIXTime ys yn = normalizePosix rawy + in xs == ys && xn == yn + +instance Ord POSIXTime where + rawx `compare` rawy = + let POSIXTime xs xn = normalizePosix rawx + POSIXTime ys yn = normalizePosix rawy + os = compare xs ys + in if os == EQ then xn `compare` yn else os + +instance NFData POSIXTime where + rnf a = a `seq` () + +posixToUTCTime :: POSIXTime -> UTCTime +posixToUTCTime raw = + let POSIXTime s ns = normalizePosix raw + (d, s') = s `divMod` posixDayLength + ps = s' * 1000000000000 + ns * 1000 -- 'Int64' can hold ps in one day + in UTCTime (addDays (fromIntegral d) unixEpochDay) + (picosecondsToDiffTime (fromIntegral ps)) + +posixDayLength :: Int64 +posixDayLength = 86400 unixEpochDay :: Day unixEpochDay = ModifiedJulianDay 40587 -posixSecondsToUTCTime :: POSIXTime -> UTCTime -posixSecondsToUTCTime i = let - (d,t) = divMod' i posixDayLength - in UTCTime (addDays d unixEpochDay) (realToFrac t) - -utcTimeToPOSIXSeconds :: UTCTime -> POSIXTime -utcTimeToPOSIXSeconds (UTCTime d t) = - (fromInteger (diffDays d unixEpochDay) * posixDayLength) + min posixDayLength (realToFrac t) - --- | Get the current POSIX time from the system clock. getPOSIXTime :: IO POSIXTime - #ifdef mingw32_HOST_OS -- On Windows, the equlvalent of POSIX time is "file time", defined as -- the number of 100-nanosecond intervals that have elapsed since @@ -61,56 +78,42 @@ getPOSIXTime :: IO POSIXTime -- time by adjusting the offset to be relative to the POSIX epoch. getPOSIXTime = do - FILETIME ft <- System.Win32.Time.getSystemTimeAsFileTime - return (fromIntegral (ft - win32_epoch_adjust) / 10000000) - -win32_epoch_adjust :: Word64 -win32_epoch_adjust = 116444736000000000 - -getCurrentTime = do FILETIME ft <- System.Win32.Time.getSystemTimeAsFileTime let (s, us) = (ft - win32_epoch_adjust) `divMod` 10000000 - (d, s') = fromIntegral s `divMod` posixDayLength_ - ps = s' * 1000000000000 + fromIntegral us * 1000000 -- 'Int64' can hold ps in one day - return - (UTCTime - (addDays (fromIntegral d) unixEpochDay) - (picosecondsToDiffTime (fromIntegral ps)) - ) + return (POSIXTime (fromIntegral s) (fromIntegral us * 1000)) + where + win32_epoch_adjust :: Word64 + win32_epoch_adjust = 116444736000000000 #elif HAVE_CLOCK_GETTIME +-- Use hi-res clock_gettime --- Use hi-res POSIX time -ctimespecToPosixSeconds :: CTimespec -> POSIXTime -ctimespecToPosixSeconds (MkCTimespec (CTime s) ns) = - (fromIntegral s) + (fromIntegral ns) / 1000000000 - -getPOSIXTime = liftM ctimespecToPosixSeconds getCTimespec - -getCurrentTime = do +getPOSIXTime = do MkCTimespec (CTime s) (CLong ns) <- getCTimespec - let (d, s') = s `divMod` posixDayLength_ - ps = s' * 1000000000000 + ns * 1000 - return - (UTCTime - (addDays (fromIntegral d) unixEpochDay) - (picosecondsToDiffTime (fromIntegral ps)) - ) + return (POSIXTime (fromIntegral s) (fromIntegral ns)) + #else +-- Use gettimeofday +getPOSIXTime = do + MkCTimeval (CLong s) (CLong us) <- getCTimeval + return (POSIXTime (fromIntegral s) (fromIntegral us * 1000)) --- Use POSIX time -ctimevalToPosixSeconds :: CTimeval -> POSIXTime -ctimevalToPosixSeconds (MkCTimeval s mus) = (fromIntegral s) + (fromIntegral mus) / 1000000 +#endif -getPOSIXTime = liftM ctimevalToPosixSeconds getCTimeval +-------------------------------------------------------------------------------- -getCurrentTime = do - MkCTimeval (CLong s) (CLong us) <- getCTimeval - let (d, s') = s `divMod` posixDayLength_ - ps = s' * 1000000000000 + us * 1000000 - return - (UTCTime - (addDays (fromIntegral d) unixEpochDay) - (picosecondsToDiffTime (fromIntegral ps)) - ) -#endif +posixDayLength_ :: NominalDiffTime +posixDayLength_ = 86400 + +posixSecondsToUTCTime :: NominalDiffTime -> UTCTime +posixSecondsToUTCTime i = let + (d,t) = divMod' i posixDayLength_ + in UTCTime (addDays d unixEpochDay) (realToFrac t) + +utcTimeToPOSIXSeconds :: UTCTime -> NominalDiffTime +utcTimeToPOSIXSeconds (UTCTime d t) = + (fromInteger (diffDays d unixEpochDay) * posixDayLength_) + min posixDayLength_ (realToFrac t) + +-- | Get the current 'UTCTime' from the system clock. +getCurrentTime :: IO UTCTime +getCurrentTime = posixToUTCTime `fmap` getPOSIXTime diff --git a/lib/Data/Time/LocalTime/TimeZone.hs b/lib/Data/Time/LocalTime/TimeZone.hs index 9381075..1b97643 100644 --- a/lib/Data/Time/LocalTime/TimeZone.hs +++ b/lib/Data/Time/LocalTime/TimeZone.hs @@ -79,7 +79,7 @@ utc = TimeZone 0 False "UTC" {-# CFILES cbits/HsTime.c #-} foreign import ccall unsafe "HsTime.h get_current_timezone_seconds" get_current_timezone_seconds :: CTime -> Ptr CInt -> Ptr CString -> IO CLong -posixToCTime :: POSIXTime -> CTime +posixToCTime :: NominalDiffTime -> CTime posixToCTime = fromInteger . floor -- | Get the local time-zone for a given time (varying as per summertime adjustments) From git at git.haskell.org Mon Feb 20 21:19:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:19:03 +0000 (UTC) Subject: [commit: packages/time] format-widths, master, posix-perf, tasty: set version to 1.8 (b662090) Message-ID: <20170220211903.B15133A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,master,posix-perf,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/b66209034d660f6c8a14522f09745b277d5280b9 >--------------------------------------------------------------- commit b66209034d660f6c8a14522f09745b277d5280b9 Author: Ashley Yakeley Date: Mon Dec 5 22:54:12 2016 -0800 set version to 1.8 >--------------------------------------------------------------- b66209034d660f6c8a14522f09745b277d5280b9 changelog.md | 3 +++ configure.ac | 2 +- time.cabal | 6 +++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/changelog.md b/changelog.md index e1e44a2..e957e34 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,8 @@ # Change Log +## [1.8] +- Change type of POSIXTime + ## [1.7] - Data.Time.Clock.TAI: change LeapSecondTable to LeapSecondMap with Maybe type; remove parseTAIUTCDATFile diff --git a/configure.ac b/configure.ac index 4f254dd..02104dc 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([Haskell time package], [1.7], [ashley at semantic.org], [time]) +AC_INIT([Haskell time package], [1.8], [ashley at semantic.org], [time]) # Safety check: Ensure that we are in the correct source directory. AC_CONFIG_SRCDIR([lib/include/HsTime.h]) diff --git a/time.cabal b/time.cabal index 99ed765..c1c2d26 100644 --- a/time.cabal +++ b/time.cabal @@ -1,5 +1,5 @@ name: time -version: 1.7 +version: 1.8 stability: stable license: BSD3 license-file: LICENSE @@ -100,7 +100,7 @@ test-suite ShowDefaultTZAbbreviations ghc-options: -Wall -fwarn-tabs build-depends: base, - time == 1.7 + time == 1.8 main-is: ShowDefaultTZAbbreviations.hs test-suite tests @@ -122,7 +122,7 @@ test-suite tests build-depends: base, deepseq, - time == 1.7, + time == 1.8, QuickCheck >= 2.5.1, test-framework >= 0.8, test-framework-quickcheck2 >= 0.3, From git at git.haskell.org Mon Feb 20 21:19:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:19:05 +0000 (UTC) Subject: [commit: packages/time] format-widths,master,posix-perf,tasty: stack.yaml: update resolver; allow-newer (0240be7) Message-ID: <20170220211905.B85273A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,master,posix-perf,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/0240be76eaccd43c1756c58cd9cf8718c1a3c762 >--------------------------------------------------------------- commit 0240be76eaccd43c1756c58cd9cf8718c1a3c762 Author: Ashley Yakeley Date: Mon Dec 5 22:55:12 2016 -0800 stack.yaml: update resolver; allow-newer >--------------------------------------------------------------- 0240be76eaccd43c1756c58cd9cf8718c1a3c762 stack.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stack.yaml b/stack.yaml index 3fbbbeb..8957306 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,3 +1,4 @@ -resolver: lts-6.25 +resolver: lts-7.12 packages: - '.' +allow-newer: true From git at git.haskell.org Mon Feb 20 21:19:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:19:07 +0000 (UTC) Subject: [commit: packages/time] format-widths,master,posix-perf,tasty: Use Word32 for ptNanoSeconds; replace normalizePosix with makePOSIXTime (c04bf45) Message-ID: <20170220211907.BEFBF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,master,posix-perf,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/c04bf45d01ecac8c150cf67097a8902846e383c0 >--------------------------------------------------------------- commit c04bf45d01ecac8c150cf67097a8902846e383c0 Author: Ashley Yakeley Date: Mon Dec 5 23:04:50 2016 -0800 Use Word32 for ptNanoSeconds; replace normalizePosix with makePOSIXTime >--------------------------------------------------------------- c04bf45d01ecac8c150cf67097a8902846e383c0 lib/Data/Time/Clock/POSIX.hs | 38 +++++++++++++------------------------- 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/lib/Data/Time/Clock/POSIX.hs b/lib/Data/Time/Clock/POSIX.hs index 68516cd..91a096a 100644 --- a/lib/Data/Time/Clock/POSIX.hs +++ b/lib/Data/Time/Clock/POSIX.hs @@ -2,20 +2,22 @@ -- Most people won't need this module. module Data.Time.Clock.POSIX ( - posixDayLength,POSIXTime(..),posixSecondsToUTCTime,utcTimeToPOSIXSeconds,getPOSIXTime,getCurrentTime + posixDayLength,POSIXTime, + makePOSIXTime,ptSeconds,ptNanoSeconds, + posixSecondsToUTCTime,utcTimeToPOSIXSeconds,getPOSIXTime,getCurrentTime ) where import Data.Time.Clock.UTC import Data.Time.Clock.Scale (picosecondsToDiffTime) import Data.Time.Calendar.Days import Data.Int (Int64) +import Data.Word import Data.Fixed (divMod') import Control.DeepSeq #include "HsTimeConfig.h" #ifdef mingw32_HOST_OS -import Data.Word (Word64) import System.Win32.Time #elif HAVE_CLOCK_GETTIME import Data.Time.Clock.CTimespec @@ -31,36 +33,22 @@ import Foreign.C.Types (CLong(..)) -- data POSIXTime = POSIXTime { ptSeconds :: {-# UNPACK #-} !Int64 - , ptNanoSeconds :: {-# UNPACK #-} !Int64 - } + , ptNanoSeconds :: {-# UNPACK #-} !Word32 + } deriving (Eq,Ord) -normalizePosix :: POSIXTime -> POSIXTime -normalizePosix raw@(POSIXTime xs xn) - | xn < 0 || xn >= 1000000000 = POSIXTime (xs + q) r - | otherwise = raw +makePOSIXTime :: Int64 -> Word32 -> POSIXTime +makePOSIXTime xs xn + | xn < 0 || xn >= 1000000000 = POSIXTime (xs + fromIntegral q) r + | otherwise = POSIXTime xs xn where (q, r) = xn `divMod` 1000000000 -instance Eq POSIXTime where - rawx == rawy = - let POSIXTime xs xn = normalizePosix rawx - POSIXTime ys yn = normalizePosix rawy - in xs == ys && xn == yn - -instance Ord POSIXTime where - rawx `compare` rawy = - let POSIXTime xs xn = normalizePosix rawx - POSIXTime ys yn = normalizePosix rawy - os = compare xs ys - in if os == EQ then xn `compare` yn else os - instance NFData POSIXTime where rnf a = a `seq` () posixToUTCTime :: POSIXTime -> UTCTime -posixToUTCTime raw = - let POSIXTime s ns = normalizePosix raw - (d, s') = s `divMod` posixDayLength - ps = s' * 1000000000000 + ns * 1000 -- 'Int64' can hold ps in one day +posixToUTCTime (POSIXTime s ns) = + let (d, s') = s `divMod` posixDayLength + ps = s' * 1000000000000 + fromIntegral (ns * 1000) -- 'Int64' can hold ps in one day in UTCTime (addDays (fromIntegral d) unixEpochDay) (picosecondsToDiffTime (fromIntegral ps)) From git at git.haskell.org Mon Feb 20 21:19:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:19:09 +0000 (UTC) Subject: [commit: packages/time] format-widths, master, posix-perf, tasty: Get testing working (e63859c) Message-ID: <20170220211909.C6E073A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,master,posix-perf,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/e63859c4c74a12b1a8ce1fc7b67bf0dbef52d8d2 >--------------------------------------------------------------- commit e63859c4c74a12b1a8ce1fc7b67bf0dbef52d8d2 Author: Ashley Yakeley Date: Mon Dec 5 23:55:12 2016 -0800 Get testing working >--------------------------------------------------------------- e63859c4c74a12b1a8ce1fc7b67bf0dbef52d8d2 lib/Data/Time/Clock/UTC.hs | 5 ++++- stack.yaml | 2 +- test/Test/TestFormat.hs | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/Data/Time/Clock/UTC.hs b/lib/Data/Time/Clock/UTC.hs index 3e27076..27c8bb6 100644 --- a/lib/Data/Time/Clock/UTC.hs +++ b/lib/Data/Time/Clock/UTC.hs @@ -15,7 +15,7 @@ module Data.Time.Clock.UTC -- -- If you don't care about leap seconds, use UTCTime and NominalDiffTime for your clock calculations, -- and you'll be fine. - UTCTime(..),NominalDiffTime + UTCTime(..),NominalDiffTime,nominalDay ) where import Control.DeepSeq @@ -124,3 +124,6 @@ instance RealFrac NominalDiffTime where "realToFrac/NominalDiffTime->Pico" realToFrac = \ (MkNominalDiffTime ps) -> ps "realToFrac/Pico->NominalDiffTime" realToFrac = MkNominalDiffTime #-} + +nominalDay :: NominalDiffTime +nominalDay = 86400 diff --git a/stack.yaml b/stack.yaml index 8957306..e93eb5a 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,4 +1,4 @@ -resolver: lts-7.12 +resolver: lts-6.26 packages: - '.' allow-newer: true diff --git a/test/Test/TestFormat.hs b/test/Test/TestFormat.hs index 55ca481..bed8ac6 100644 --- a/test/Test/TestFormat.hs +++ b/test/Test/TestFormat.hs @@ -48,7 +48,7 @@ baseTime1 :: UTCTime baseTime1 = localTimeToUTC utc (LocalTime (fromGregorian 2000 01 01) midnight) getDay :: Integer -> UTCTime -getDay day = addUTCTime ((fromInteger day) * posixDayLength) baseTime1 +getDay day = addUTCTime ((fromInteger day) * nominalDay) baseTime1 getYearP1 :: Integer -> UTCTime getYearP1 year = localTimeToUTC utc (LocalTime (fromGregorian year 01 01) midnight) From git at git.haskell.org Mon Feb 20 21:19:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:19:11 +0000 (UTC) Subject: [commit: packages/time] format-widths, master, posix-perf, tasty: workaround for test unix dependency (91e345b) Message-ID: <20170220211911.CD6193A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,master,posix-perf,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/91e345b1014851a23b7b7ea1000337a9bab1fde9 >--------------------------------------------------------------- commit 91e345b1014851a23b7b7ea1000337a9bab1fde9 Author: Ashley Yakeley Date: Tue Dec 6 00:34:48 2016 -0800 workaround for test unix dependency >--------------------------------------------------------------- 91e345b1014851a23b7b7ea1000337a9bab1fde9 lib/Data/Time/Clock/POSIX.hs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/lib/Data/Time/Clock/POSIX.hs b/lib/Data/Time/Clock/POSIX.hs index 91a096a..2bd1965 100644 --- a/lib/Data/Time/Clock/POSIX.hs +++ b/lib/Data/Time/Clock/POSIX.hs @@ -36,6 +36,30 @@ data POSIXTime = POSIXTime , ptNanoSeconds :: {-# UNPACK #-} !Word32 } deriving (Eq,Ord) +#if 0 +-- workaround for time test stanza dependency on unix, which needs fromRational and toRational + +instance Show POSIXTime where + show = error "undefined POSIXTime function" + +instance Num POSIXTime where + (+) = error "undefined POSIXTime function" + (-) = error "undefined POSIXTime function" + (*) = error "undefined POSIXTime function" + negate = error "undefined POSIXTime function" + abs = error "undefined POSIXTime function" + signum = error "undefined POSIXTime function" + fromInteger = error "undefined POSIXTime function" + +instance Real POSIXTime where + toRational (POSIXTime xs xn) = toRational xs + (toRational xn) / 1000000000 + +instance Fractional POSIXTime where + fromRational r = makePOSIXTime 0 $ floor $ r * 1000000000 + recip = error "undefined POSIXTime function" + (/) = error "undefined POSIXTime function" +#endif + makePOSIXTime :: Int64 -> Word32 -> POSIXTime makePOSIXTime xs xn | xn < 0 || xn >= 1000000000 = POSIXTime (xs + fromIntegral q) r From git at git.haskell.org Mon Feb 20 21:19:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:19:13 +0000 (UTC) Subject: [commit: packages/time] format-widths, master, posix-perf, tasty: expose posixToUTCTime (1e18026) Message-ID: <20170220211913.D46273A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,master,posix-perf,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/1e1802635dabab325e38d126de1540425202a5b4 >--------------------------------------------------------------- commit 1e1802635dabab325e38d126de1540425202a5b4 Author: Ashley Yakeley Date: Tue Dec 6 02:05:48 2016 -0800 expose posixToUTCTime >--------------------------------------------------------------- 1e1802635dabab325e38d126de1540425202a5b4 lib/Data/Time/Clock/POSIX.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Data/Time/Clock/POSIX.hs b/lib/Data/Time/Clock/POSIX.hs index 2bd1965..94bc8ee 100644 --- a/lib/Data/Time/Clock/POSIX.hs +++ b/lib/Data/Time/Clock/POSIX.hs @@ -4,7 +4,8 @@ module Data.Time.Clock.POSIX ( posixDayLength,POSIXTime, makePOSIXTime,ptSeconds,ptNanoSeconds, - posixSecondsToUTCTime,utcTimeToPOSIXSeconds,getPOSIXTime,getCurrentTime + posixSecondsToUTCTime,utcTimeToPOSIXSeconds, + posixToUTCTime,getPOSIXTime,getCurrentTime ) where import Data.Time.Clock.UTC From git at git.haskell.org Mon Feb 20 21:19:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:19:15 +0000 (UTC) Subject: [commit: packages/time] format-widths, master, posix-perf, tasty: Get benchmark working (08bb154) Message-ID: <20170220211915.DC80F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,master,posix-perf,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/08bb154b73d0379b3a8023ff5fa5c6e828e45a2c >--------------------------------------------------------------- commit 08bb154b73d0379b3a8023ff5fa5c6e828e45a2c Author: Ashley Yakeley Date: Tue Dec 6 02:10:15 2016 -0800 Get benchmark working >--------------------------------------------------------------- 08bb154b73d0379b3a8023ff5fa5c6e828e45a2c benchmark/Main.hs | 15 ++++----------- stack.yaml => benchmark/stack.yaml | 1 - benchmark/time-bench.cabal | 2 ++ 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/benchmark/Main.hs b/benchmark/Main.hs index 1be1b67..8eeb7a0 100644 --- a/benchmark/Main.hs +++ b/benchmark/Main.hs @@ -2,18 +2,11 @@ module Main where import Criterion.Main -import Data.Time.Clock -import Data.Time.Calendar +import Data.Time import Data.Time.Clock.POSIX -import Data.Time.LocalTime -import Data.Time.Format -import Data.Time.Clock -import qualified "time" Data.Time.Clock as O +import qualified "time" Data.Time as O import qualified "time" Data.Time.Clock.POSIX as O -import qualified "time" Data.Time.LocalTime as O -import qualified "time" Data.Time.Format as O -import qualified "time" Data.Time.Clock as O main :: IO () main = do @@ -24,9 +17,9 @@ main = do getZonedTime >>= print O.getZonedTime >>= print - tz <- getCurrentTimeZone + _tz <- getCurrentTimeZone ct <- getCurrentTime - otz <- O.getCurrentTimeZone + _otz <- O.getCurrentTimeZone oct <- O.getCurrentTime defaultMain diff --git a/stack.yaml b/benchmark/stack.yaml similarity index 66% copy from stack.yaml copy to benchmark/stack.yaml index e93eb5a..460c544 100644 --- a/stack.yaml +++ b/benchmark/stack.yaml @@ -1,4 +1,3 @@ resolver: lts-6.26 packages: - '.' -allow-newer: true diff --git a/benchmark/time-bench.cabal b/benchmark/time-bench.cabal index 0a94ad4..9026ffe 100644 --- a/benchmark/time-bench.cabal +++ b/benchmark/time-bench.cabal @@ -10,6 +10,8 @@ build-type: Simple executable time-bench hs-source-dirs: ../lib, . main-is: Main.hs + other-modules: + Data.Time.Clock.CTimespec default-language: Haskell2010 if impl(ghc) default-extensions: From git at git.haskell.org Mon Feb 20 21:19:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:19:17 +0000 (UTC) Subject: [commit: packages/time] format-widths, master, posix-perf, tasty: Rewrite NFData instances using rnf (f37d418) Message-ID: <20170220211917.E3A9F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,master,posix-perf,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/f37d418745e0ba95788dfbba355ef3cf87d16b0f >--------------------------------------------------------------- commit f37d418745e0ba95788dfbba355ef3cf87d16b0f Author: Ashley Yakeley Date: Tue Dec 6 19:46:49 2016 -0800 Rewrite NFData instances using rnf >--------------------------------------------------------------- f37d418745e0ba95788dfbba355ef3cf87d16b0f lib/Data/Time/Clock/UTC.hs | 2 +- lib/Data/Time/LocalTime/LocalTime.hs | 4 ++-- lib/Data/Time/LocalTime/TimeOfDay.hs | 2 +- lib/Data/Time/LocalTime/TimeZone.hs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/Data/Time/Clock/UTC.hs b/lib/Data/Time/Clock/UTC.hs index 27c8bb6..683323f 100644 --- a/lib/Data/Time/Clock/UTC.hs +++ b/lib/Data/Time/Clock/UTC.hs @@ -45,7 +45,7 @@ data UTCTime = UTCTime { #endif instance NFData UTCTime where - rnf (UTCTime d t) = d `deepseq` t `deepseq` () + rnf (UTCTime d t) = rnf d `seq` rnf t `seq` () instance Eq UTCTime where (UTCTime da ta) == (UTCTime db tb) = (da == db) && (ta == tb) diff --git a/lib/Data/Time/LocalTime/LocalTime.hs b/lib/Data/Time/LocalTime/LocalTime.hs index 77ab2cc..74e4f9c 100644 --- a/lib/Data/Time/LocalTime/LocalTime.hs +++ b/lib/Data/Time/LocalTime/LocalTime.hs @@ -47,7 +47,7 @@ data LocalTime = LocalTime { ) instance NFData LocalTime where - rnf (LocalTime d t) = d `deepseq` t `deepseq` () + rnf (LocalTime d t) = rnf d `seq` rnf t `seq` () instance Show LocalTime where show (LocalTime d t) = (showGregorian d) ++ " " ++ (show t) @@ -91,7 +91,7 @@ data ZonedTime = ZonedTime { #endif instance NFData ZonedTime where - rnf (ZonedTime lt z) = lt `deepseq` z `deepseq` () + rnf (ZonedTime lt z) = rnf lt `seq` rnf z `seq` () utcToZonedTime :: TimeZone -> UTCTime -> ZonedTime utcToZonedTime zone time = ZonedTime (utcToLocalTime zone time) zone diff --git a/lib/Data/Time/LocalTime/TimeOfDay.hs b/lib/Data/Time/LocalTime/TimeOfDay.hs index 4645857..318c87d 100644 --- a/lib/Data/Time/LocalTime/TimeOfDay.hs +++ b/lib/Data/Time/LocalTime/TimeOfDay.hs @@ -40,7 +40,7 @@ data TimeOfDay = TimeOfDay { ) instance NFData TimeOfDay where - rnf (TimeOfDay h m s) = h `deepseq` m `deepseq` s `seq` () -- FIXME: Data.Fixed had no NFData instances yet at time of writing + rnf (TimeOfDay h m s) = rnf h `seq` rnf m `seq` s `seq` () -- FIXME: Data.Fixed had no NFData instances yet at time of writing -- | Hour zero midnight :: TimeOfDay diff --git a/lib/Data/Time/LocalTime/TimeZone.hs b/lib/Data/Time/LocalTime/TimeZone.hs index 1b97643..b876556 100644 --- a/lib/Data/Time/LocalTime/TimeZone.hs +++ b/lib/Data/Time/LocalTime/TimeZone.hs @@ -46,7 +46,7 @@ data TimeZone = TimeZone { ) instance NFData TimeZone where - rnf (TimeZone m so n) = m `deepseq` so `deepseq` n `deepseq` () + rnf (TimeZone m so n) = rnf m `seq` rnf so `seq` rnf n `seq` () -- | Create a nameless non-summer timezone for this number of minutes minutesToTimeZone :: Int -> TimeZone From git at git.haskell.org Mon Feb 20 21:19:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:19:19 +0000 (UTC) Subject: [commit: packages/time] format-widths, master, tasty: POSIX: clean up definitions, fix posixToUTCTime (255aa53) Message-ID: <20170220211919.EB4793A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,master,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/255aa53abdf6119a2e764de04ab88bdbffec9b4c >--------------------------------------------------------------- commit 255aa53abdf6119a2e764de04ab88bdbffec9b4c Author: Ashley Yakeley Date: Tue Dec 6 23:03:00 2016 -0800 POSIX: clean up definitions, fix posixToUTCTime >--------------------------------------------------------------- 255aa53abdf6119a2e764de04ab88bdbffec9b4c lib/Data/Time/Clock/POSIX.hs | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/lib/Data/Time/Clock/POSIX.hs b/lib/Data/Time/Clock/POSIX.hs index 94bc8ee..82d18fd 100644 --- a/lib/Data/Time/Clock/POSIX.hs +++ b/lib/Data/Time/Clock/POSIX.hs @@ -2,7 +2,7 @@ -- Most people won't need this module. module Data.Time.Clock.POSIX ( - posixDayLength,POSIXTime, + POSIXTime, makePOSIXTime,ptSeconds,ptNanoSeconds, posixSecondsToUTCTime,utcTimeToPOSIXSeconds, posixToUTCTime,getPOSIXTime,getCurrentTime @@ -71,14 +71,11 @@ instance NFData POSIXTime where rnf a = a `seq` () posixToUTCTime :: POSIXTime -> UTCTime -posixToUTCTime (POSIXTime s ns) = - let (d, s') = s `divMod` posixDayLength - ps = s' * 1000000000000 + fromIntegral (ns * 1000) -- 'Int64' can hold ps in one day - in UTCTime (addDays (fromIntegral d) unixEpochDay) - (picosecondsToDiffTime (fromIntegral ps)) - -posixDayLength :: Int64 -posixDayLength = 86400 +posixToUTCTime (POSIXTime s ns) = let + (d, s') = s `divMod` 86400 + ps :: Int64 + ps = s' * 1000000000000 + (fromIntegral ns) * 1000 + in UTCTime (addDays (fromIntegral d) unixEpochDay) (picosecondsToDiffTime $ fromIntegral ps) unixEpochDay :: Day unixEpochDay = ModifiedJulianDay 40587 @@ -115,17 +112,14 @@ getPOSIXTime = do -------------------------------------------------------------------------------- -posixDayLength_ :: NominalDiffTime -posixDayLength_ = 86400 - posixSecondsToUTCTime :: NominalDiffTime -> UTCTime posixSecondsToUTCTime i = let - (d,t) = divMod' i posixDayLength_ + (d,t) = divMod' i nominalDay in UTCTime (addDays d unixEpochDay) (realToFrac t) utcTimeToPOSIXSeconds :: UTCTime -> NominalDiffTime utcTimeToPOSIXSeconds (UTCTime d t) = - (fromInteger (diffDays d unixEpochDay) * posixDayLength_) + min posixDayLength_ (realToFrac t) + (fromInteger (diffDays d unixEpochDay) * nominalDay) + min nominalDay (realToFrac t) -- | Get the current 'UTCTime' from the system clock. getCurrentTime :: IO UTCTime From git at git.haskell.org Mon Feb 20 21:19:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:19:21 +0000 (UTC) Subject: [commit: packages/time] format-widths, master, tasty: benchmark getTimeZone and getCurrentTime (08f8296) Message-ID: <20170220211921.F32A33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,master,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/08f8296f06981afd9ea3031ba145ec0ea708305b >--------------------------------------------------------------- commit 08f8296f06981afd9ea3031ba145ec0ea708305b Author: Ashley Yakeley Date: Sun Dec 11 23:32:27 2016 -0800 benchmark getTimeZone and getCurrentTime >--------------------------------------------------------------- 08f8296f06981afd9ea3031ba145ec0ea708305b benchmark/Main.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/benchmark/Main.hs b/benchmark/Main.hs index 8eeb7a0..dbee637 100644 --- a/benchmark/Main.hs +++ b/benchmark/Main.hs @@ -26,6 +26,8 @@ main = do [ bgroup "new" [ bench "getCurrentTime" $ nfIO getCurrentTime , bench "getPOSIXTime" $ nfIO getPOSIXTime + , bench "getTimeZone" $ nfIO $ getTimeZone ct + , bench "getCurrentTimeZone" $ nfIO getCurrentTimeZone , bench "getZonedTime" $ nfIO getZonedTime , bench "formatTime" $ nf (formatTime defaultTimeLocale "%a, %_d %b %Y %H:%M:%S %Z") ct ] @@ -33,8 +35,9 @@ main = do bgroup "old" [ bench "getCurrentTime" $ nfIO O.getCurrentTime , bench "getPOSIXTime" $ nfIO O.getPOSIXTime + , bench "getTimeZone" $ nfIO $ O.getTimeZone oct + , bench "getCurrentTimeZone" $ nfIO O.getCurrentTimeZone , bench "getZonedTime" $ nfIO O.getZonedTime , bench "formatTime" $ nf (O.formatTime O.defaultTimeLocale "%a, %_d %b %Y %H:%M:%S %Z") oct ] ] - From git at git.haskell.org Mon Feb 20 21:19:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:19:24 +0000 (UTC) Subject: [commit: packages/time] format-widths, master, tasty: faster getCurrentTimeZone (a6cedc9) Message-ID: <20170220211924.053103A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,master,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/a6cedc964f87279296557060dd8b361a87e75a96 >--------------------------------------------------------------- commit a6cedc964f87279296557060dd8b361a87e75a96 Author: Ashley Yakeley Date: Mon Dec 12 22:51:23 2016 -0800 faster getCurrentTimeZone >--------------------------------------------------------------- a6cedc964f87279296557060dd8b361a87e75a96 lib/Data/Time/LocalTime/TimeZone.hs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/lib/Data/Time/LocalTime/TimeZone.hs b/lib/Data/Time/LocalTime/TimeZone.hs index b876556..c77c9e7 100644 --- a/lib/Data/Time/LocalTime/TimeZone.hs +++ b/lib/Data/Time/LocalTime/TimeZone.hs @@ -79,13 +79,9 @@ utc = TimeZone 0 False "UTC" {-# CFILES cbits/HsTime.c #-} foreign import ccall unsafe "HsTime.h get_current_timezone_seconds" get_current_timezone_seconds :: CTime -> Ptr CInt -> Ptr CString -> IO CLong -posixToCTime :: NominalDiffTime -> CTime -posixToCTime = fromInteger . floor - --- | Get the local time-zone for a given time (varying as per summertime adjustments) -getTimeZone :: UTCTime -> IO TimeZone -getTimeZone time = with 0 (\pdst -> with nullPtr (\pcname -> do - secs <- get_current_timezone_seconds (posixToCTime (utcTimeToPOSIXSeconds time)) pdst pcname +getTimeZoneCTime :: CTime -> IO TimeZone +getTimeZoneCTime ctime = with 0 (\pdst -> with nullPtr (\pcname -> do + secs <- get_current_timezone_seconds ctime pdst pcname case secs of 0x80000000 -> fail "localtime_r failed" _ -> do @@ -95,6 +91,14 @@ getTimeZone time = with 0 (\pdst -> with nullPtr (\pcname -> do return (TimeZone (div (fromIntegral secs) 60) (dst == 1) name) )) +-- | Get the local time-zone for a given time (varying as per summertime adjustments) +getTimeZonePosix :: POSIXTime -> IO TimeZone +getTimeZonePosix = getTimeZoneCTime . CTime . ptSeconds + +-- | Get the local time-zone for a given time (varying as per summertime adjustments) +getTimeZone :: UTCTime -> IO TimeZone +getTimeZone = getTimeZoneCTime . fromInteger . floor . utcTimeToPOSIXSeconds + -- | Get the current time-zone getCurrentTimeZone :: IO TimeZone -getCurrentTimeZone = getCurrentTime >>= getTimeZone +getCurrentTimeZone = getPOSIXTime >>= getTimeZonePosix From git at git.haskell.org Mon Feb 20 21:19:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:19:26 +0000 (UTC) Subject: [commit: packages/time] format-widths, master, tasty: Remove useless version bound on time. (bc8c7a2) Message-ID: <20170220211926.0C0AD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,master,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/bc8c7a2d525460f77f1ed739750426ce4dc30e0c >--------------------------------------------------------------- commit bc8c7a2d525460f77f1ed739750426ce4dc30e0c Author: Edward Z. Yang Date: Tue Dec 13 14:26:08 2016 -0800 Remove useless version bound on time. When build-depends refers to a library that is defined in the same package, a version bound is not necessary: the internal copy of the library is always preferred. New versions of Cabal now warn in this case. Signed-off-by: Edward Z. Yang >--------------------------------------------------------------- bc8c7a2d525460f77f1ed739750426ce4dc30e0c time.cabal | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/time.cabal b/time.cabal index c1c2d26..e8e18cb 100644 --- a/time.cabal +++ b/time.cabal @@ -100,7 +100,7 @@ test-suite ShowDefaultTZAbbreviations ghc-options: -Wall -fwarn-tabs build-depends: base, - time == 1.8 + time main-is: ShowDefaultTZAbbreviations.hs test-suite tests @@ -122,7 +122,7 @@ test-suite tests build-depends: base, deepseq, - time == 1.8, + time, QuickCheck >= 2.5.1, test-framework >= 0.8, test-framework-quickcheck2 >= 0.3, From git at git.haskell.org Mon Feb 20 21:19:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:19:28 +0000 (UTC) Subject: [commit: packages/time] format-widths, master, tasty: Merge pull request #58 from ezyang/master (ee8fe45) Message-ID: <20170220211928.13C623A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,master,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/ee8fe452fa45f6d78f8ce6deedb88b20eb3d5f42 >--------------------------------------------------------------- commit ee8fe452fa45f6d78f8ce6deedb88b20eb3d5f42 Merge: a6cedc9 bc8c7a2 Author: Ashley Yakeley Date: Tue Dec 13 19:50:17 2016 -0800 Merge pull request #58 from ezyang/master Remove useless version bound on time. >--------------------------------------------------------------- ee8fe452fa45f6d78f8ce6deedb88b20eb3d5f42 time.cabal | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) From git at git.haskell.org Mon Feb 20 21:19:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:19:30 +0000 (UTC) Subject: [commit: packages/time] format-widths,master,tasty: Move getPOSIXTime to new module; support other clocks in CTimeSpec (285cc1e) Message-ID: <20170220211930.1F41A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,master,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/285cc1e30f05df3a60b6d58f66f7f3b016711657 >--------------------------------------------------------------- commit 285cc1e30f05df3a60b6d58f66f7f3b016711657 Author: Ashley Yakeley Date: Tue Dec 13 20:41:35 2016 -0800 Move getPOSIXTime to new module; support other clocks in CTimeSpec >--------------------------------------------------------------- 285cc1e30f05df3a60b6d58f66f7f3b016711657 lib/Data/Time/Clock/CTimespec.hsc | 44 ++++++++++++++-- lib/Data/Time/Clock/{POSIX.hs => GetTime.hs} | 49 ++--------------- lib/Data/Time/Clock/POSIX.hs | 79 +--------------------------- time.cabal | 1 + 4 files changed, 44 insertions(+), 129 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 285cc1e30f05df3a60b6d58f66f7f3b016711657 From git at git.haskell.org Mon Feb 20 21:19:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:19:32 +0000 (UTC) Subject: [commit: packages/time] format-widths, master, tasty: add clockResolution (d7969bd) Message-ID: <20170220211932.285E23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,master,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/d7969bd44e2947f7d1ef8e6db0c0ae35436580f4 >--------------------------------------------------------------- commit d7969bd44e2947f7d1ef8e6db0c0ae35436580f4 Author: Ashley Yakeley Date: Wed Dec 14 00:10:03 2016 -0800 add clockResolution >--------------------------------------------------------------- d7969bd44e2947f7d1ef8e6db0c0ae35436580f4 lib/Data/Time/Clock.hs | 4 +++- lib/Data/Time/Clock/GetTime.hs | 13 ++++++++++++- test/Test/Resolution.hs | 29 +++++++++++++++++++++++++++++ test/Test/TestUtil.hs | 7 +++++-- test/Test/Tests.hs | 2 ++ time.cabal | 1 + 6 files changed, 52 insertions(+), 4 deletions(-) diff --git a/lib/Data/Time/Clock.hs b/lib/Data/Time/Clock.hs index b03e272..7b38c5a 100644 --- a/lib/Data/Time/Clock.hs +++ b/lib/Data/Time/Clock.hs @@ -4,10 +4,12 @@ module Data.Time.Clock module Data.Time.Clock.Scale, module Data.Time.Clock.UTC, module Data.Time.Clock.UTCDiff, - getCurrentTime + getCurrentTime, + clockResolution ) where import Data.Time.Clock.Scale +import Data.Time.Clock.GetTime import Data.Time.Clock.UTCDiff import Data.Time.Clock.UTC import Data.Time.Clock.POSIX diff --git a/lib/Data/Time/Clock/GetTime.hs b/lib/Data/Time/Clock/GetTime.hs index 0d453eb..6cb50af 100644 --- a/lib/Data/Time/Clock/GetTime.hs +++ b/lib/Data/Time/Clock/GetTime.hs @@ -1,8 +1,10 @@ +{-# LANGUAGE Trustworthy #-} module Data.Time.Clock.GetTime where import Data.Int (Int64) import Data.Word import Control.DeepSeq +import Data.Time.Clock.Scale #include "HsTimeConfig.h" @@ -44,7 +46,9 @@ instance Real POSIXTime where toRational (POSIXTime xs xn) = toRational xs + (toRational xn) / 1000000000 instance Fractional POSIXTime where - fromRational r = makePOSIXTime 0 $ floor $ r * 1000000000 + fromRational r = let + (s,ns) = divMod (floor $ r * 1000000000) 1000000000 + in POSIXTime (fromInteger s) (fromInteger ns) recip = error "undefined POSIXTime function" (/) = error "undefined POSIXTime function" #endif @@ -52,7 +56,10 @@ instance Fractional POSIXTime where instance NFData POSIXTime where rnf a = a `seq` () + getPOSIXTime :: IO POSIXTime +clockResolution :: DiffTime + #ifdef mingw32_HOST_OS -- On Windows, the equlvalent of POSIX time is "file time", defined as -- the number of 100-nanosecond intervals that have elapsed since @@ -66,6 +73,7 @@ getPOSIXTime = do where win32_epoch_adjust :: Word64 win32_epoch_adjust = 116444736000000000 +clockResolution = 1E-6 -- microsecond #elif HAVE_CLOCK_GETTIME -- Use hi-res clock_gettime @@ -73,11 +81,14 @@ getPOSIXTime = do getPOSIXTime = do MkCTimespec (CTime s) (CLong ns) <- clockGetTime clock_REALTIME return (POSIXTime (fromIntegral s) (fromIntegral ns)) +clockResolution = case realtimeRes of + MkCTimespec (CTime s) ns -> (fromIntegral s) + (fromIntegral ns) * 1E-9 #else -- Use gettimeofday getPOSIXTime = do MkCTimeval (CLong s) (CLong us) <- getCTimeval return (POSIXTime (fromIntegral s) (fromIntegral us * 1000)) +clockResolution = 1E-6 -- microsecond #endif diff --git a/test/Test/Resolution.hs b/test/Test/Resolution.hs new file mode 100644 index 0000000..579e14f --- /dev/null +++ b/test/Test/Resolution.hs @@ -0,0 +1,29 @@ +module Test.Resolution(testResolution) where + +import Data.Fixed +import Data.Time.Clock +import Test.TestUtil + +repeatN :: Monad m => Int -> m a -> m [a] +repeatN 0 _ = return [] +repeatN n ma = do + a <- ma + aa <- repeatN (n - 1) ma + return $ a:aa + +gcd' :: Real a => a -> a -> a +gcd' a 0 = a +gcd' a b = gcd' b (mod' a b) + +gcdAll :: Real a => [a] -> a +gcdAll = foldr gcd' 0 + +testClockResolution = ioTest "getCurrentTime" $ do + times <- repeatN 100 getCurrentTime + return $ assertionResult $ assertEqual "resolution" clockResolution $ gcdAll (fmap utctDayTime times) + +testResolution :: Test +testResolution = testGroup "resolution" + [ + testClockResolution + ] diff --git a/test/Test/TestUtil.hs b/test/Test/TestUtil.hs index cef8763..6b31273 100644 --- a/test/Test/TestUtil.hs +++ b/test/Test/TestUtil.hs @@ -43,9 +43,12 @@ diff expected found = Fail ("expected " ++ (show expected) ++ " but found " ++ ( type TestTree = Test type Assertion = Either String () +assertionResult :: Assertion -> Result +assertionResult (Right ()) = Pass +assertionResult (Left s) = Fail s + testCase :: String -> Assertion -> Test -testCase name (Right ()) = pureTest name Pass -testCase name (Left s) = pureTest name (Fail s) +testCase name ass = pureTest name $ assertionResult ass assertFailure :: String -> Either String a assertFailure = Left diff --git a/test/Test/Tests.hs b/test/Test/Tests.hs index d241204..d971887 100644 --- a/test/Test/Tests.hs +++ b/test/Test/Tests.hs @@ -6,6 +6,7 @@ import Test.AddDays import Test.ClipDates import Test.ConvertBack import Test.LongWeekYears +import Test.Resolution import Test.TestCalendars import Test.TestEaster import Test.TestFormat @@ -21,6 +22,7 @@ tests = [ addDaysTest , clipDates , convertBack , longWeekYears + , testResolution , testCalendars , testEaster , testFormat diff --git a/time.cabal b/time.cabal index e2dfa2c..84f60ed 100644 --- a/time.cabal +++ b/time.cabal @@ -144,6 +144,7 @@ test-suite tests Test.TestTAI Test.TestTimeZone Test.TestValid + Test.Resolution Test.LongWeekYears Test.LongWeekYearsRef Test.ConvertBack From git at git.haskell.org Mon Feb 20 21:19:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:19:34 +0000 (UTC) Subject: [commit: packages/time] format-widths, master, tasty: add taiClock (d04325a) Message-ID: <20170220211934.2F7993A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,master,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/d04325af1c5f202a38ddddcec0d6839ac7a94e15 >--------------------------------------------------------------- commit d04325af1c5f202a38ddddcec0d6839ac7a94e15 Author: Ashley Yakeley Date: Wed Dec 14 01:36:20 2016 -0800 add taiClock >--------------------------------------------------------------- d04325af1c5f202a38ddddcec0d6839ac7a94e15 lib/Data/Time/Clock.hs | 2 +- lib/Data/Time/Clock/GetTime.hs | 12 ++++++++---- lib/Data/Time/Clock/TAI.hs | 9 +++++++++ test/Test/Resolution.hs | 14 ++++++++++++-- 4 files changed, 30 insertions(+), 7 deletions(-) diff --git a/lib/Data/Time/Clock.hs b/lib/Data/Time/Clock.hs index 7b38c5a..e971555 100644 --- a/lib/Data/Time/Clock.hs +++ b/lib/Data/Time/Clock.hs @@ -5,7 +5,7 @@ module Data.Time.Clock module Data.Time.Clock.UTC, module Data.Time.Clock.UTCDiff, getCurrentTime, - clockResolution + getTime_resolution ) where import Data.Time.Clock.Scale diff --git a/lib/Data/Time/Clock/GetTime.hs b/lib/Data/Time/Clock/GetTime.hs index 6cb50af..5ede677 100644 --- a/lib/Data/Time/Clock/GetTime.hs +++ b/lib/Data/Time/Clock/GetTime.hs @@ -58,7 +58,8 @@ instance NFData POSIXTime where getPOSIXTime :: IO POSIXTime -clockResolution :: DiffTime +getTime_resolution :: DiffTime +getTAIRawTime :: Maybe (DiffTime,IO POSIXTime) #ifdef mingw32_HOST_OS -- On Windows, the equlvalent of POSIX time is "file time", defined as @@ -73,7 +74,8 @@ getPOSIXTime = do where win32_epoch_adjust :: Word64 win32_epoch_adjust = 116444736000000000 -clockResolution = 1E-6 -- microsecond +getTime_resolution = 1E-6 -- microsecond +getTAIRawTime = Nothing #elif HAVE_CLOCK_GETTIME -- Use hi-res clock_gettime @@ -81,14 +83,16 @@ clockResolution = 1E-6 -- microsecond getPOSIXTime = do MkCTimespec (CTime s) (CLong ns) <- clockGetTime clock_REALTIME return (POSIXTime (fromIntegral s) (fromIntegral ns)) -clockResolution = case realtimeRes of +getTime_resolution = case realtimeRes of MkCTimespec (CTime s) ns -> (fromIntegral s) + (fromIntegral ns) * 1E-9 +getTAIRawTime = Nothing #else -- Use gettimeofday getPOSIXTime = do MkCTimeval (CLong s) (CLong us) <- getCTimeval return (POSIXTime (fromIntegral s) (fromIntegral us * 1000)) -clockResolution = 1E-6 -- microsecond +getTime_resolution = 1E-6 -- microsecond +getTAIRawTime = Nothing #endif diff --git a/lib/Data/Time/Clock/TAI.hs b/lib/Data/Time/Clock/TAI.hs index dbde65f..dbda9a4 100644 --- a/lib/Data/Time/Clock/TAI.hs +++ b/lib/Data/Time/Clock/TAI.hs @@ -11,10 +11,13 @@ module Data.Time.Clock.TAI -- conversion between UTC and TAI with map utcDayLength,utcToTAITime,taiToUTCTime, + + taiClock, ) where import Data.Time.LocalTime import Data.Time.Calendar.Days +import Data.Time.Clock.GetTime import Data.Time.Clock import Control.DeepSeq import Data.Maybe @@ -84,3 +87,9 @@ taiToUTCTime lsmap abstime = let day' = addDays (div' dtime len) day if day == day' then return (UTCTime day dtime) else stable day' in stable $ ModifiedJulianDay $ div' (diffAbsoluteTime abstime taiEpoch) 86400 + +rawToTAITime :: POSIXTime -> AbsoluteTime +rawToTAITime (POSIXTime s ns) = MkAbsoluteTime $ (fromIntegral s) + (fromIntegral ns) * 1E-9 + +taiClock :: Maybe (DiffTime,IO AbsoluteTime) +taiClock = fmap (fmap (fmap rawToTAITime)) getTAIRawTime diff --git a/test/Test/Resolution.hs b/test/Test/Resolution.hs index 579e14f..f9e9e3a 100644 --- a/test/Test/Resolution.hs +++ b/test/Test/Resolution.hs @@ -2,6 +2,7 @@ module Test.Resolution(testResolution) where import Data.Fixed import Data.Time.Clock +import Data.Time.Clock.TAI import Test.TestUtil repeatN :: Monad m => Int -> m a -> m [a] @@ -18,12 +19,21 @@ gcd' a b = gcd' b (mod' a b) gcdAll :: Real a => [a] -> a gcdAll = foldr gcd' 0 +testClockResolution :: Test testClockResolution = ioTest "getCurrentTime" $ do times <- repeatN 100 getCurrentTime - return $ assertionResult $ assertEqual "resolution" clockResolution $ gcdAll (fmap utctDayTime times) + return $ assertionResult $ assertEqual "resolution" getTime_resolution $ gcdAll (fmap utctDayTime times) + +testTAIResolution :: (DiffTime,IO AbsoluteTime) -> Test +testTAIResolution (res,getTime) = ioTest "taiClock" $ do + times <- repeatN 100 getTime + return $ assertionResult $ assertEqual "resolution" res $ gcdAll (fmap (\t -> diffAbsoluteTime t taiEpoch) times) testResolution :: Test -testResolution = testGroup "resolution" +testResolution = testGroup "resolution" $ [ testClockResolution ] + ++ case taiClock of + Just clock -> [testTAIResolution clock] + Nothing -> [] From git at git.haskell.org Mon Feb 20 21:19:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:19:36 +0000 (UTC) Subject: [commit: packages/time] format-widths,master,tasty: added RawTime; restored old POSIXTime (880c2a2) Message-ID: <20170220211936.3A2223A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,master,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/880c2a2d920d75f3ec9aff0d130eb8f9356a1b85 >--------------------------------------------------------------- commit 880c2a2d920d75f3ec9aff0d130eb8f9356a1b85 Author: Ashley Yakeley Date: Sat Dec 17 22:38:30 2016 -0800 added RawTime; restored old POSIXTime >--------------------------------------------------------------- 880c2a2d920d75f3ec9aff0d130eb8f9356a1b85 changelog.md | 2 +- lib/Data/Time/Clock/GetTime.hs | 60 +++++++++++++------------------------ lib/Data/Time/Clock/POSIX.hs | 50 +++++++++++++------------------ lib/Data/Time/Clock/Raw.hs | 29 ++++++++++++++++++ lib/Data/Time/Clock/TAI.hs | 4 +-- lib/Data/Time/LocalTime/TimeZone.hs | 7 +++-- time.cabal | 1 + 7 files changed, 78 insertions(+), 75 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 880c2a2d920d75f3ec9aff0d130eb8f9356a1b85 From git at git.haskell.org Mon Feb 20 21:19:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:19:38 +0000 (UTC) Subject: [commit: packages/time] format-widths, master, tasty: Remove useless version bounds on time (1ee953d) Message-ID: <20170220211938.431E33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,master,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/1ee953d97d95082a7d672ead5b8d081d30fc3294 >--------------------------------------------------------------- commit 1ee953d97d95082a7d672ead5b8d081d30fc3294 Author: Ashley Yakeley Date: Sun Dec 18 17:06:30 2016 -0800 Remove useless version bounds on time >--------------------------------------------------------------- 1ee953d97d95082a7d672ead5b8d081d30fc3294 time.cabal | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/time.cabal b/time.cabal index 99ed765..275fdb7 100644 --- a/time.cabal +++ b/time.cabal @@ -100,7 +100,7 @@ test-suite ShowDefaultTZAbbreviations ghc-options: -Wall -fwarn-tabs build-depends: base, - time == 1.7 + time main-is: ShowDefaultTZAbbreviations.hs test-suite tests @@ -122,7 +122,7 @@ test-suite tests build-depends: base, deepseq, - time == 1.7, + time, QuickCheck >= 2.5.1, test-framework >= 0.8, test-framework-quickcheck2 >= 0.3, From git at git.haskell.org Mon Feb 20 21:19:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:19:40 +0000 (UTC) Subject: [commit: packages/time] format-widths, master, tasty: Set version to 1.7.0.1 (b6098be) Message-ID: <20170220211940.4A2183A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,master,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/b6098be8a4facfa854c633f2a3a82ab8e72962ef >--------------------------------------------------------------- commit b6098be8a4facfa854c633f2a3a82ab8e72962ef Author: Ashley Yakeley Date: Sun Dec 18 17:08:29 2016 -0800 Set version to 1.7.0.1 >--------------------------------------------------------------- b6098be8a4facfa854c633f2a3a82ab8e72962ef changelog.md | 3 +++ configure.ac | 2 +- time.cabal | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index e1e44a2..ee3cd48 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,8 @@ # Change Log +## [1.7.0.1] +- Fix bounds issue in .cabal file + ## [1.7] - Data.Time.Clock.TAI: change LeapSecondTable to LeapSecondMap with Maybe type; remove parseTAIUTCDATFile diff --git a/configure.ac b/configure.ac index 4f254dd..eacccf6 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([Haskell time package], [1.7], [ashley at semantic.org], [time]) +AC_INIT([Haskell time package], [1.7.0.1], [ashley at semantic.org], [time]) # Safety check: Ensure that we are in the correct source directory. AC_CONFIG_SRCDIR([lib/include/HsTime.h]) diff --git a/time.cabal b/time.cabal index 275fdb7..f85af97 100644 --- a/time.cabal +++ b/time.cabal @@ -1,5 +1,5 @@ name: time -version: 1.7 +version: 1.7.0.1 stability: stable license: BSD3 license-file: LICENSE From git at git.haskell.org Mon Feb 20 21:19:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:19:42 +0000 (UTC) Subject: [commit: packages/time] format-widths, master, tasty: Merge branch 'update' (cd5704b) Message-ID: <20170220211942.549043A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,master,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/cd5704b01bd1ebdb2c6c5e1936244eba62c50914 >--------------------------------------------------------------- commit cd5704b01bd1ebdb2c6c5e1936244eba62c50914 Merge: 880c2a2 b6098be Author: Ashley Yakeley Date: Sun Dec 18 17:13:45 2016 -0800 Merge branch 'update' >--------------------------------------------------------------- cd5704b01bd1ebdb2c6c5e1936244eba62c50914 changelog.md | 3 +++ 1 file changed, 3 insertions(+) diff --cc changelog.md index f91b353,ee3cd48..1b9f91d --- a/changelog.md +++ b/changelog.md @@@ -1,8 -1,8 +1,11 @@@ # Change Log +## [1.8] +- Added RawTime + + ## [1.7.0.1] + - Fix bounds issue in .cabal file + ## [1.7] - Data.Time.Clock.TAI: change LeapSecondTable to LeapSecondMap with Maybe type; remove parseTAIUTCDATFile From git at git.haskell.org Mon Feb 20 21:19:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:19:44 +0000 (UTC) Subject: [commit: packages/time] format-widths, master, tasty: rename some modules (0dff8b1) Message-ID: <20170220211944.626ED3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,master,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/0dff8b19afec77f1db9596124a6bbea191243a86 >--------------------------------------------------------------- commit 0dff8b19afec77f1db9596124a6bbea191243a86 Author: Ashley Yakeley Date: Sun Dec 18 19:27:40 2016 -0800 rename some modules >--------------------------------------------------------------- 0dff8b19afec77f1db9596124a6bbea191243a86 lib/Data/Time/Clock.hs | 6 +- lib/Data/Time/Clock/{Scale.hs => DiffTime.hs} | 26 +------ lib/Data/Time/Clock/GetTime.hs | 2 +- lib/Data/Time/Clock/{UTC.hs => NominalDiffTime.hs} | 45 +----------- lib/Data/Time/Clock/Raw.hs | 2 +- lib/Data/Time/Clock/UTC.hs | 81 +--------------------- lib/Data/Time/Clock/UniversalTime.hs | 23 ++++++ lib/Data/Time/Format.hs | 2 +- lib/Data/Time/Format/Parse.hs | 2 +- lib/Data/Time/LocalTime/LocalTime.hs | 3 +- lib/Data/Time/LocalTime/TimeOfDay.hs | 2 +- time.cabal | 4 +- 12 files changed, 42 insertions(+), 156 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 0dff8b19afec77f1db9596124a6bbea191243a86 From git at git.haskell.org Mon Feb 20 21:19:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:19:46 +0000 (UTC) Subject: [commit: packages/time] format-widths, master, tasty: Align modules/API with 1.7 (6322f2e) Message-ID: <20170220211946.6FB063A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,master,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/6322f2e1d739fc51138e907eff88606b9cea6120 >--------------------------------------------------------------- commit 6322f2e1d739fc51138e907eff88606b9cea6120 Author: Ashley Yakeley Date: Fri Dec 23 15:49:25 2016 -0800 Align modules/API with 1.7 >--------------------------------------------------------------- 6322f2e1d739fc51138e907eff88606b9cea6120 lib/Data/Time/Clock.hs | 2 ++ lib/Data/Time/Clock/AbsoluteTime.hs | 46 ++++++++++++++++++++++++++++++++++ lib/Data/Time/Clock/DiffTime.hs | 9 ++++++- lib/Data/Time/Clock/NominalDiffTime.hs | 7 +++++- lib/Data/Time/Clock/POSIX.hs | 20 +++++---------- lib/Data/Time/Clock/POSIXTime.hs | 13 ++++++++++ lib/Data/Time/Clock/Raw.hs | 25 ++++++++++++------ lib/Data/Time/Clock/TAI.hs | 40 +++-------------------------- lib/Data/Time/Clock/UTC.hs | 3 +-- lib/Data/Time/Clock/UTCDiff.hs | 1 + lib/Data/Time/Clock/UniversalTime.hs | 7 +++++- time.cabal | 2 ++ 12 files changed, 112 insertions(+), 63 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 6322f2e1d739fc51138e907eff88606b9cea6120 From git at git.haskell.org Mon Feb 20 21:19:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:19:48 +0000 (UTC) Subject: [commit: packages/time] format-widths, master, tasty: put package in Time category (7c5c1fa) Message-ID: <20170220211948.76CAC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,master,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/7c5c1fa5fe09d4c6865249db8e5cc11cb39ea158 >--------------------------------------------------------------- commit 7c5c1fa5fe09d4c6865249db8e5cc11cb39ea158 Author: Ashley Yakeley Date: Fri Dec 23 15:49:58 2016 -0800 put package in Time category >--------------------------------------------------------------- 7c5c1fa5fe09d4c6865249db8e5cc11cb39ea158 time.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/time.cabal b/time.cabal index 6bcf73b..3ecfc75 100644 --- a/time.cabal +++ b/time.cabal @@ -9,7 +9,7 @@ homepage: https://github.com/haskell/time bug-reports: https://github.com/haskell/time/issues synopsis: A time library description: A time library -category: System +category: Time build-type: Configure cabal-version: >=1.10 tested-with: GHC == 8.0.1, GHC == 7.10.3, GHC == 7.8.4 From git at git.haskell.org Mon Feb 20 21:19:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:19:50 +0000 (UTC) Subject: [commit: packages/time] format-widths, master, tasty: rename internal Clock modules (5a27173) Message-ID: <20170220211950.86A153A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,master,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/5a27173097782a32530c68e2e8fd1730ba06a948 >--------------------------------------------------------------- commit 5a27173097782a32530c68e2e8fd1730ba06a948 Author: Ashley Yakeley Date: Fri Dec 23 16:26:53 2016 -0800 rename internal Clock modules >--------------------------------------------------------------- 5a27173097782a32530c68e2e8fd1730ba06a948 lib/Data/Time/Clock.hs | 22 +++++++++++----------- lib/Data/Time/Clock/{ => Internal}/AbsoluteTime.hs | 9 +++++---- lib/Data/Time/Clock/{ => Internal}/CTimespec.hsc | 3 +-- lib/Data/Time/Clock/{ => Internal}/CTimeval.hs | 3 +-- lib/Data/Time/Clock/{ => Internal}/DiffTime.hs | 8 ++++---- lib/Data/Time/Clock/{ => Internal}/GetTime.hs | 8 ++++---- .../Time/Clock/{ => Internal}/NominalDiffTime.hs | 9 +++++---- lib/Data/Time/Clock/{ => Internal}/POSIXTime.hs | 5 +++-- lib/Data/Time/Clock/{ => Internal}/UTCDiff.hs | 6 +++--- .../Time/Clock/{UTC.hs => Internal/UTCTime.hs} | 10 +++++----- .../Time/Clock/{ => Internal}/UniversalTime.hs | 6 +++--- lib/Data/Time/Clock/POSIX.hs | 6 +++--- lib/Data/Time/Clock/Raw.hs | 10 +++++----- lib/Data/Time/Clock/TAI.hs | 6 +++--- lib/Data/Time/Format.hs | 4 ++-- lib/Data/Time/Format/Parse.hs | 4 ++-- lib/Data/Time/LocalTime/LocalTime.hs | 8 ++++---- lib/Data/Time/LocalTime/TimeOfDay.hs | 2 +- lib/Data/Time/LocalTime/TimeZone.hs | 2 +- time.cabal | 20 ++++++++++---------- 20 files changed, 76 insertions(+), 75 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 5a27173097782a32530c68e2e8fd1730ba06a948 From git at git.haskell.org Mon Feb 20 21:19:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:19:52 +0000 (UTC) Subject: [commit: packages/time] format-widths, master, tasty: rename RawTime to SystemTime (286d6dd) Message-ID: <20170220211952.91F5C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,master,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/286d6ddd1cf25b1d80b64bd33001c87dc906e98f >--------------------------------------------------------------- commit 286d6ddd1cf25b1d80b64bd33001c87dc906e98f Author: Ashley Yakeley Date: Fri Dec 23 16:31:48 2016 -0800 rename RawTime to SystemTime >--------------------------------------------------------------- 286d6ddd1cf25b1d80b64bd33001c87dc906e98f changelog.md | 2 +- lib/Data/Time/Clock/Internal/GetTime.hs | 36 +++++++++++++++---------------- lib/Data/Time/Clock/POSIX.hs | 6 +++--- lib/Data/Time/Clock/{Raw.hs => System.hs} | 22 +++++++++---------- lib/Data/Time/Clock/TAI.hs | 4 ++-- lib/Data/Time/LocalTime/TimeZone.hs | 8 +++---- time.cabal | 2 +- 7 files changed, 40 insertions(+), 40 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 286d6ddd1cf25b1d80b64bd33001c87dc906e98f From git at git.haskell.org Mon Feb 20 21:19:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:19:54 +0000 (UTC) Subject: [commit: packages/time] format-widths,master,tasty: add utcToSystemTime; add tests (5aae9ff) Message-ID: <20170220211954.9AA413A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,master,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/5aae9ff1e583667affb95ffb6c57ed5863a520d6 >--------------------------------------------------------------- commit 5aae9ff1e583667affb95ffb6c57ed5863a520d6 Author: Ashley Yakeley Date: Fri Dec 23 23:59:28 2016 -0800 add utcToSystemTime; add tests >--------------------------------------------------------------- 5aae9ff1e583667affb95ffb6c57ed5863a520d6 lib/Data/Time/Clock/Internal/GetTime.hs | 2 +- lib/Data/Time/Clock/POSIX.hs | 9 +++--- lib/Data/Time/Clock/System.hs | 57 ++++++++++++++++++++++++++------- test/Test/ClockConversion.hs | 24 ++++++++++++++ test/Test/Tests.hs | 2 ++ time.cabal | 1 + 6 files changed, 79 insertions(+), 16 deletions(-) diff --git a/lib/Data/Time/Clock/Internal/GetTime.hs b/lib/Data/Time/Clock/Internal/GetTime.hs index 8736246..397759a 100644 --- a/lib/Data/Time/Clock/Internal/GetTime.hs +++ b/lib/Data/Time/Clock/Internal/GetTime.hs @@ -26,7 +26,7 @@ import Foreign.C.Types (CLong(..)) data SystemTime = MkSystemTime { systemSeconds :: {-# UNPACK #-} !Int64 , systemNanoseconds :: {-# UNPACK #-} !Word32 - } deriving (Eq,Ord) + } deriving (Eq,Ord,Show) instance NFData SystemTime where rnf a = a `seq` () diff --git a/lib/Data/Time/Clock/POSIX.hs b/lib/Data/Time/Clock/POSIX.hs index 89a958b..3ca6642 100644 --- a/lib/Data/Time/Clock/POSIX.hs +++ b/lib/Data/Time/Clock/POSIX.hs @@ -2,7 +2,8 @@ -- Most people won't need this module. module Data.Time.Clock.POSIX ( - posixDayLength,POSIXTime,posixSecondsToUTCTime,utcTimeToPOSIXSeconds,getPOSIXTime,getCurrentTime + posixDayLength,POSIXTime,posixSecondsToUTCTime,utcTimeToPOSIXSeconds,getPOSIXTime,getCurrentTime, + systemToPOSIXTime, ) where import Data.Time.Clock.Internal.GetTime @@ -12,9 +13,6 @@ import Data.Time.Clock.System import Data.Time.Calendar.Days import Data.Fixed -unixEpochDay :: Day -unixEpochDay = ModifiedJulianDay 40587 - posixSecondsToUTCTime :: POSIXTime -> UTCTime posixSecondsToUTCTime i = let (d,t) = divMod' i posixDayLength @@ -24,6 +22,9 @@ utcTimeToPOSIXSeconds :: UTCTime -> POSIXTime utcTimeToPOSIXSeconds (UTCTime d t) = (fromInteger (diffDays d unixEpochDay) * posixDayLength) + min posixDayLength (realToFrac t) +systemToPOSIXTime :: SystemTime -> POSIXTime +systemToPOSIXTime (MkSystemTime s ns) = (fromIntegral s) + (fromIntegral ns) * 1E-9 + -- | Get the current POSIX time from the system clock. getPOSIXTime :: IO POSIXTime getPOSIXTime = fmap systemToPOSIXTime getSystemTime diff --git a/lib/Data/Time/Clock/System.hs b/lib/Data/Time/Clock/System.hs index f63248e..4dffa17 100644 --- a/lib/Data/Time/Clock/System.hs +++ b/lib/Data/Time/Clock/System.hs @@ -1,29 +1,64 @@ module Data.Time.Clock.System ( + unixEpochDay, SystemTime(..), - systemToUTCTime,getSystemTime, + truncateSystemTimeLeapSecond, + getSystemTime, + systemToUTCTime, + utcToSystemTime, systemToTAITime, - systemToPOSIXTime, ) where import Data.Time.Clock.Internal.AbsoluteTime import Data.Time.Clock.Internal.DiffTime import Data.Time.Clock.Internal.GetTime import Data.Time.Clock.Internal.UTCTime -import Data.Time.Clock.Internal.POSIXTime import Data.Time.Calendar.Days import Data.Int (Int64) +truncateSystemTimeLeapSecond :: SystemTime -> SystemTime +truncateSystemTimeLeapSecond (MkSystemTime seconds nanoseconds) | nanoseconds >= 1000000000 = MkSystemTime (succ seconds) 0 +truncateSystemTimeLeapSecond t = t + systemToUTCTime :: SystemTime -> UTCTime -systemToUTCTime (MkSystemTime s ns) = let - (d, s') = s `divMod` 86400 - ps :: Int64 - ps = s' * 1000000000000 + (fromIntegral ns) * 1000 - in UTCTime (addDays (fromIntegral d) unixEpochDay) (picosecondsToDiffTime $ fromIntegral ps) - -systemToPOSIXTime :: SystemTime -> POSIXTime -systemToPOSIXTime (MkSystemTime s ns) = (fromIntegral s) + (fromIntegral ns) * 1E-9 +systemToUTCTime (MkSystemTime seconds nanoseconds) = let + days :: Int64 + timeSeconds :: Int64 + (days, timeSeconds) = seconds `divMod` 86400 + + day :: Day + day = addDays (fromIntegral days) unixEpochDay + + timeNanoseconds :: Int64 + timeNanoseconds = timeSeconds * 1000000000 + (fromIntegral nanoseconds) + + timePicoseconds :: Int64 + timePicoseconds = timeNanoseconds * 1000 + + time :: DiffTime + time = picosecondsToDiffTime $ fromIntegral timePicoseconds + in UTCTime day time + +utcToSystemTime :: UTCTime -> SystemTime +utcToSystemTime (UTCTime day time) = let + days :: Int64 + days = fromIntegral $ diffDays day unixEpochDay + + timePicoseconds :: Int64 + timePicoseconds = fromIntegral $ diffTimeToPicoseconds time + + timeNanoseconds :: Int64 + timeNanoseconds = timePicoseconds `div` 1000 + + timeSeconds :: Int64 + nanoseconds :: Int64 + (timeSeconds,nanoseconds) = if timeNanoseconds >= 86400000000000 then (86399,timeNanoseconds - 86399000000000) else timeNanoseconds `divMod` 1000000000 + + seconds :: Int64 + seconds = days * 86400 + timeSeconds + + in MkSystemTime seconds $ fromIntegral nanoseconds unixEpochAbsolute :: AbsoluteTime unixEpochAbsolute = taiNominalDayStart unixEpochDay diff --git a/test/Test/ClockConversion.hs b/test/Test/ClockConversion.hs new file mode 100644 index 0000000..b968620 --- /dev/null +++ b/test/Test/ClockConversion.hs @@ -0,0 +1,24 @@ +module Test.ClockConversion(testClockConversion) where + +import Data.Time.Clock +import Data.Time.Clock.System +import Test.TestUtil + + +testClockConversion :: TestTree; +testClockConversion = testGroup "clock conversion" $ let + testPair :: (SystemTime,UTCTime) -> TestTree + testPair (st,ut) = testGroup (show ut) $ + [ + testCase "systemToUTCTime" $ assertEqual (show ut) ut $ systemToUTCTime st, + testCase "utcToSystemTime" $ assertEqual (show ut) st $ utcToSystemTime ut + ] + in + [ + testPair (MkSystemTime 0 0,UTCTime unixEpochDay 0), + testPair (MkSystemTime 86399 0,UTCTime unixEpochDay 86399), + testPair (MkSystemTime 86399 999999999,UTCTime unixEpochDay 86399.999999999), + testPair (MkSystemTime 86399 1000000000,UTCTime unixEpochDay 86400), + testPair (MkSystemTime 86399 1999999999,UTCTime unixEpochDay 86400.999999999), + testPair (MkSystemTime 86400 0,UTCTime (succ unixEpochDay) 0) + ] diff --git a/test/Test/Tests.hs b/test/Test/Tests.hs index d971887..93a68c8 100644 --- a/test/Test/Tests.hs +++ b/test/Test/Tests.hs @@ -4,6 +4,7 @@ import Test.Framework import Test.AddDays import Test.ClipDates +import Test.ClockConversion import Test.ConvertBack import Test.LongWeekYears import Test.Resolution @@ -20,6 +21,7 @@ import Test.TestValid tests :: [Test] tests = [ addDaysTest , clipDates + , testClockConversion , convertBack , longWeekYears , testResolution diff --git a/time.cabal b/time.cabal index 295385b..3ee2f0e 100644 --- a/time.cabal +++ b/time.cabal @@ -136,6 +136,7 @@ test-suite tests main-is: Test.hs other-modules: Test.Tests + Test.ClockConversion Test.TestTime Test.TestTimeRef Test.TestParseTime From git at git.haskell.org Mon Feb 20 21:19:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:19:56 +0000 (UTC) Subject: [commit: packages/time] format-widths, master, tasty: rename GetTime module to SystemTime (099e676) Message-ID: <20170220211956.A58753A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,master,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/099e6763321bb8805b9c6ba28e8dbf0e375cb43e >--------------------------------------------------------------- commit 099e6763321bb8805b9c6ba28e8dbf0e375cb43e Author: Ashley Yakeley Date: Sat Dec 24 00:03:32 2016 -0800 rename GetTime module to SystemTime >--------------------------------------------------------------- 099e6763321bb8805b9c6ba28e8dbf0e375cb43e lib/Data/Time/Clock.hs | 2 +- lib/Data/Time/Clock/Internal/{GetTime.hs => SystemTime.hs} | 2 +- lib/Data/Time/Clock/POSIX.hs | 1 - lib/Data/Time/Clock/System.hs | 2 +- lib/Data/Time/Clock/TAI.hs | 2 +- time.cabal | 2 +- 6 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/Data/Time/Clock.hs b/lib/Data/Time/Clock.hs index e6ca9a7..af771f7 100644 --- a/lib/Data/Time/Clock.hs +++ b/lib/Data/Time/Clock.hs @@ -12,7 +12,7 @@ module Data.Time.Clock import Data.Time.Clock.Internal.UniversalTime import Data.Time.Clock.Internal.DiffTime -import Data.Time.Clock.Internal.GetTime +import Data.Time.Clock.Internal.SystemTime import Data.Time.Clock.Internal.UTCDiff import Data.Time.Clock.Internal.NominalDiffTime import Data.Time.Clock.Internal.UTCTime diff --git a/lib/Data/Time/Clock/Internal/GetTime.hs b/lib/Data/Time/Clock/Internal/SystemTime.hs similarity index 98% rename from lib/Data/Time/Clock/Internal/GetTime.hs rename to lib/Data/Time/Clock/Internal/SystemTime.hs index 397759a..27d3d20 100644 --- a/lib/Data/Time/Clock/Internal/GetTime.hs +++ b/lib/Data/Time/Clock/Internal/SystemTime.hs @@ -1,5 +1,5 @@ {-# LANGUAGE Trustworthy #-} -module Data.Time.Clock.Internal.GetTime where +module Data.Time.Clock.Internal.SystemTime where import Data.Int (Int64) import Data.Word diff --git a/lib/Data/Time/Clock/POSIX.hs b/lib/Data/Time/Clock/POSIX.hs index 3ca6642..d634605 100644 --- a/lib/Data/Time/Clock/POSIX.hs +++ b/lib/Data/Time/Clock/POSIX.hs @@ -6,7 +6,6 @@ module Data.Time.Clock.POSIX systemToPOSIXTime, ) where -import Data.Time.Clock.Internal.GetTime import Data.Time.Clock.Internal.POSIXTime import Data.Time.Clock.Internal.UTCTime import Data.Time.Clock.System diff --git a/lib/Data/Time/Clock/System.hs b/lib/Data/Time/Clock/System.hs index 4dffa17..b9be502 100644 --- a/lib/Data/Time/Clock/System.hs +++ b/lib/Data/Time/Clock/System.hs @@ -11,7 +11,7 @@ module Data.Time.Clock.System import Data.Time.Clock.Internal.AbsoluteTime import Data.Time.Clock.Internal.DiffTime -import Data.Time.Clock.Internal.GetTime +import Data.Time.Clock.Internal.SystemTime import Data.Time.Clock.Internal.UTCTime import Data.Time.Calendar.Days import Data.Int (Int64) diff --git a/lib/Data/Time/Clock/TAI.hs b/lib/Data/Time/Clock/TAI.hs index 695e1d7..2613852 100644 --- a/lib/Data/Time/Clock/TAI.hs +++ b/lib/Data/Time/Clock/TAI.hs @@ -18,7 +18,7 @@ module Data.Time.Clock.TAI import Data.Time.Clock.Internal.AbsoluteTime import Data.Time.LocalTime import Data.Time.Calendar.Days -import Data.Time.Clock.Internal.GetTime +import Data.Time.Clock.Internal.SystemTime import Data.Time.Clock.System import Data.Time.Clock import Data.Maybe diff --git a/time.cabal b/time.cabal index 3ee2f0e..ebb33d2 100644 --- a/time.cabal +++ b/time.cabal @@ -80,7 +80,7 @@ library Data.Time.Clock.Internal.NominalDiffTime, Data.Time.Clock.Internal.POSIXTime, Data.Time.Clock.Internal.UniversalTime, - Data.Time.Clock.Internal.GetTime, + Data.Time.Clock.Internal.SystemTime, Data.Time.Clock.Internal.UTCTime, Data.Time.Clock.Internal.CTimeval, Data.Time.Clock.Internal.CTimespec, From git at git.haskell.org Mon Feb 20 21:19:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:19:58 +0000 (UTC) Subject: [commit: packages/time] format-widths, master, tasty: get TAI clock working (e4ca1b0) Message-ID: <20170220211958.ABF5A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,master,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/e4ca1b0cbd79ce38acae7e647a1cfa2720a58ca9 >--------------------------------------------------------------- commit e4ca1b0cbd79ce38acae7e647a1cfa2720a58ca9 Author: Ashley Yakeley Date: Sat Dec 24 00:18:35 2016 -0800 get TAI clock working >--------------------------------------------------------------- e4ca1b0cbd79ce38acae7e647a1cfa2720a58ca9 lib/Data/Time/Clock/Internal/CTimespec.hsc | 14 ++++++++------ lib/Data/Time/Clock/Internal/SystemTime.hs | 26 +++++++++++++++++++------- lib/Data/Time/Clock/TAI.hs | 1 + 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/lib/Data/Time/Clock/Internal/CTimespec.hsc b/lib/Data/Time/Clock/Internal/CTimespec.hsc index 74f6d64..38197a4 100644 --- a/lib/Data/Time/Clock/Internal/CTimespec.hsc +++ b/lib/Data/Time/Clock/Internal/CTimespec.hsc @@ -14,6 +14,8 @@ import System.IO.Unsafe #include +type ClockID = #{type clockid_t} + data CTimespec = MkCTimespec CTime CLong instance Storable CTimespec where @@ -28,9 +30,9 @@ instance Storable CTimespec where #{poke struct timespec, tv_nsec} p ns foreign import ccall unsafe "time.h clock_gettime" - clock_gettime :: #{type clockid_t} -> Ptr CTimespec -> IO CInt + clock_gettime :: ClockID -> Ptr CTimespec -> IO CInt foreign import ccall unsafe "time.h clock_getres" - clock_getres :: #{type clockid_t} -> Ptr CTimespec -> IO CInt + clock_getres :: ClockID -> Ptr CTimespec -> IO CInt -- | Get the resolution of the given clock. clockGetRes :: #{type clockid_t} -> IO (Either Errno CTimespec) @@ -45,16 +47,16 @@ clockGetRes clockid = alloca $ \ptspec -> do return $ Left errno -- | Get the current time from the given clock. -clockGetTime :: #{type clockid_t} -> IO CTimespec +clockGetTime :: ClockID -> IO CTimespec clockGetTime clockid = alloca (\ptspec -> do throwErrnoIfMinus1_ "clock_gettime" $ clock_gettime clockid ptspec peek ptspec ) -clock_REALTIME :: #{type clockid_t} +clock_REALTIME :: ClockID clock_REALTIME = #{const CLOCK_REALTIME} -clock_TAI :: #{type clockid_t} +clock_TAI :: ClockID clock_TAI = #{const 11} realtimeRes :: CTimespec @@ -64,7 +66,7 @@ realtimeRes = unsafePerformIO $ do Left errno -> ioError (errnoToIOError "clock_getres" errno Nothing Nothing) Right res -> return res -clockResolution :: #{type clockid_t} -> Maybe CTimespec +clockResolution :: ClockID -> Maybe CTimespec clockResolution clockid = unsafePerformIO $ do mres <- clockGetRes clockid case mres of diff --git a/lib/Data/Time/Clock/Internal/SystemTime.hs b/lib/Data/Time/Clock/Internal/SystemTime.hs index 27d3d20..840e207 100644 --- a/lib/Data/Time/Clock/Internal/SystemTime.hs +++ b/lib/Data/Time/Clock/Internal/SystemTime.hs @@ -1,5 +1,11 @@ {-# LANGUAGE Trustworthy #-} -module Data.Time.Clock.Internal.SystemTime where +module Data.Time.Clock.Internal.SystemTime + ( + SystemTime(..), + getSystemTime, + getTime_resolution, + getTAISystemTime, + ) where import Data.Int (Int64) import Data.Word @@ -60,12 +66,18 @@ getTAISystemTime = Nothing #elif HAVE_CLOCK_GETTIME -- Use hi-res clock_gettime -getSystemTime = do - MkCTimespec (CTime s) (CLong ns) <- clockGetTime clock_REALTIME - return (MkSystemTime (fromIntegral s) (fromIntegral ns)) -getTime_resolution = case realtimeRes of - MkCTimespec (CTime s) ns -> (fromIntegral s) + (fromIntegral ns) * 1E-9 -getTAISystemTime = Nothing +timespecToSystemTime :: CTimespec -> SystemTime +timespecToSystemTime (MkCTimespec (CTime s) (CLong ns)) = (MkSystemTime (fromIntegral s) (fromIntegral ns)) + +timespecToDiffTime :: CTimespec -> DiffTime +timespecToDiffTime (MkCTimespec (CTime s) ns) = (fromIntegral s) + (fromIntegral ns) * 1E-9 + +clockGetSystemTime :: ClockID -> IO SystemTime +clockGetSystemTime clock = fmap timespecToSystemTime $ clockGetTime clock + +getSystemTime = clockGetSystemTime clock_REALTIME +getTime_resolution = timespecToDiffTime realtimeRes +getTAISystemTime = fmap (\resolution -> (timespecToDiffTime resolution,clockGetSystemTime clock_TAI)) $ clockResolution clock_TAI #else -- Use gettimeofday diff --git a/lib/Data/Time/Clock/TAI.hs b/lib/Data/Time/Clock/TAI.hs index 2613852..3336fd7 100644 --- a/lib/Data/Time/Clock/TAI.hs +++ b/lib/Data/Time/Clock/TAI.hs @@ -59,5 +59,6 @@ taiToUTCTime lsmap abstime = let if day == day' then return (UTCTime day dtime) else stable day' in stable $ ModifiedJulianDay $ div' (diffAbsoluteTime abstime taiEpoch) 86400 +-- | TAI clock, if it exists. Note that it is unlikely to be set correctly, without due care and attention. taiClock :: Maybe (DiffTime,IO AbsoluteTime) taiClock = fmap (fmap (fmap systemToTAITime)) getTAISystemTime From git at git.haskell.org Mon Feb 20 21:20:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:20:00 +0000 (UTC) Subject: [commit: packages/time] format-widths, master, tasty: rename internal LocalTime modules (3ab6c4c) Message-ID: <20170220212000.B95023A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,master,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/3ab6c4c63ec0cdc8a6baba6984739beffd234174 >--------------------------------------------------------------- commit 3ab6c4c63ec0cdc8a6baba6984739beffd234174 Author: Ashley Yakeley Date: Sat Dec 24 13:54:55 2016 -0800 rename internal LocalTime modules >--------------------------------------------------------------- 3ab6c4c63ec0cdc8a6baba6984739beffd234174 lib/Data/Time/Format.hs | 21 ++++---- lib/Data/Time/Format/Locale.hs | 2 +- lib/Data/Time/Format/Parse.hs | 7 +-- lib/Data/Time/LocalTime.hs | 14 ++--- .../Time/LocalTime/{ => Internal}/LocalTime.hs | 63 ++++------------------ .../Time/LocalTime/{ => Internal}/TimeOfDay.hs | 9 ++-- lib/Data/Time/LocalTime/{ => Internal}/TimeZone.hs | 2 +- lib/Data/Time/LocalTime/Internal/ZonedTime.hs | 61 +++++++++++++++++++++ time.cabal | 7 +-- 9 files changed, 104 insertions(+), 82 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 3ab6c4c63ec0cdc8a6baba6984739beffd234174 From git at git.haskell.org Mon Feb 20 21:20:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:20:02 +0000 (UTC) Subject: [commit: packages/time] format-widths, master, tasty: rename unixEpochDay to systemEpochDay (a634d25) Message-ID: <20170220212002.C0B9D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,master,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/a634d251ef3a1fd48e5d143fcd09d03adfa04bc8 >--------------------------------------------------------------- commit a634d251ef3a1fd48e5d143fcd09d03adfa04bc8 Author: Ashley Yakeley Date: Sun Jan 15 12:05:34 2017 -0800 rename unixEpochDay to systemEpochDay >--------------------------------------------------------------- a634d251ef3a1fd48e5d143fcd09d03adfa04bc8 lib/Data/Time/Clock/POSIX.hs | 4 ++-- lib/Data/Time/Clock/System.hs | 16 ++++++++-------- test/Test/ClockConversion.hs | 12 ++++++------ 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/Data/Time/Clock/POSIX.hs b/lib/Data/Time/Clock/POSIX.hs index d634605..2fd2122 100644 --- a/lib/Data/Time/Clock/POSIX.hs +++ b/lib/Data/Time/Clock/POSIX.hs @@ -15,11 +15,11 @@ import Data.Fixed posixSecondsToUTCTime :: POSIXTime -> UTCTime posixSecondsToUTCTime i = let (d,t) = divMod' i posixDayLength - in UTCTime (addDays d unixEpochDay) (realToFrac t) + in UTCTime (addDays d systemEpochDay) (realToFrac t) utcTimeToPOSIXSeconds :: UTCTime -> POSIXTime utcTimeToPOSIXSeconds (UTCTime d t) = - (fromInteger (diffDays d unixEpochDay) * posixDayLength) + min posixDayLength (realToFrac t) + (fromInteger (diffDays d systemEpochDay) * posixDayLength) + min posixDayLength (realToFrac t) systemToPOSIXTime :: SystemTime -> POSIXTime systemToPOSIXTime (MkSystemTime s ns) = (fromIntegral s) + (fromIntegral ns) * 1E-9 diff --git a/lib/Data/Time/Clock/System.hs b/lib/Data/Time/Clock/System.hs index b9be502..a9664bc 100644 --- a/lib/Data/Time/Clock/System.hs +++ b/lib/Data/Time/Clock/System.hs @@ -1,6 +1,6 @@ module Data.Time.Clock.System ( - unixEpochDay, + systemEpochDay, SystemTime(..), truncateSystemTimeLeapSecond, getSystemTime, @@ -28,7 +28,7 @@ systemToUTCTime (MkSystemTime seconds nanoseconds) = let (days, timeSeconds) = seconds `divMod` 86400 day :: Day - day = addDays (fromIntegral days) unixEpochDay + day = addDays (fromIntegral days) systemEpochDay timeNanoseconds :: Int64 timeNanoseconds = timeSeconds * 1000000000 + (fromIntegral nanoseconds) @@ -43,7 +43,7 @@ systemToUTCTime (MkSystemTime seconds nanoseconds) = let utcToSystemTime :: UTCTime -> SystemTime utcToSystemTime (UTCTime day time) = let days :: Int64 - days = fromIntegral $ diffDays day unixEpochDay + days = fromIntegral $ diffDays day systemEpochDay timePicoseconds :: Int64 timePicoseconds = fromIntegral $ diffTimeToPicoseconds time @@ -60,14 +60,14 @@ utcToSystemTime (UTCTime day time) = let in MkSystemTime seconds $ fromIntegral nanoseconds -unixEpochAbsolute :: AbsoluteTime -unixEpochAbsolute = taiNominalDayStart unixEpochDay +systemEpochAbsolute :: AbsoluteTime +systemEpochAbsolute = taiNominalDayStart systemEpochDay systemToTAITime :: SystemTime -> AbsoluteTime systemToTAITime (MkSystemTime s ns) = let diff :: DiffTime diff = (fromIntegral s) + (fromIntegral ns) * 1E-9 - in addAbsoluteTime diff unixEpochAbsolute + in addAbsoluteTime diff systemEpochAbsolute -unixEpochDay :: Day -unixEpochDay = ModifiedJulianDay 40587 +systemEpochDay :: Day +systemEpochDay = ModifiedJulianDay 40587 diff --git a/test/Test/ClockConversion.hs b/test/Test/ClockConversion.hs index b968620..095bc3a 100644 --- a/test/Test/ClockConversion.hs +++ b/test/Test/ClockConversion.hs @@ -15,10 +15,10 @@ testClockConversion = testGroup "clock conversion" $ let ] in [ - testPair (MkSystemTime 0 0,UTCTime unixEpochDay 0), - testPair (MkSystemTime 86399 0,UTCTime unixEpochDay 86399), - testPair (MkSystemTime 86399 999999999,UTCTime unixEpochDay 86399.999999999), - testPair (MkSystemTime 86399 1000000000,UTCTime unixEpochDay 86400), - testPair (MkSystemTime 86399 1999999999,UTCTime unixEpochDay 86400.999999999), - testPair (MkSystemTime 86400 0,UTCTime (succ unixEpochDay) 0) + testPair (MkSystemTime 0 0,UTCTime systemEpochDay 0), + testPair (MkSystemTime 86399 0,UTCTime systemEpochDay 86399), + testPair (MkSystemTime 86399 999999999,UTCTime systemEpochDay 86399.999999999), + testPair (MkSystemTime 86399 1000000000,UTCTime systemEpochDay 86400), + testPair (MkSystemTime 86399 1999999999,UTCTime systemEpochDay 86400.999999999), + testPair (MkSystemTime 86400 0,UTCTime (succ systemEpochDay) 0) ] From git at git.haskell.org Mon Feb 20 21:20:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:20:04 +0000 (UTC) Subject: [commit: packages/time] format-widths, master, tasty: haddock for Data.Time.Clock.System (2a35a49) Message-ID: <20170220212004.C79EE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,master,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/2a35a490ea93a83d40ca0ff58c76435b11602e14 >--------------------------------------------------------------- commit 2a35a490ea93a83d40ca0ff58c76435b11602e14 Author: Ashley Yakeley Date: Sun Jan 15 14:01:59 2017 -0800 haddock for Data.Time.Clock.System >--------------------------------------------------------------- 2a35a490ea93a83d40ca0ff58c76435b11602e14 lib/Data/Time/Clock/Internal/SystemTime.hs | 2 +- lib/Data/Time/Clock/System.hs | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/Data/Time/Clock/Internal/SystemTime.hs b/lib/Data/Time/Clock/Internal/SystemTime.hs index 840e207..75af1fa 100644 --- a/lib/Data/Time/Clock/Internal/SystemTime.hs +++ b/lib/Data/Time/Clock/Internal/SystemTime.hs @@ -27,7 +27,7 @@ import Foreign.C.Types (CLong(..)) -------------------------------------------------------------------------------- -- | 'SystemTime' is time returned by system clock functions. --- Its semantics depends on the clock function. +-- Its semantics depends on the clock function, but the epoch is typically the beginning of 1970. -- Note that 'systemNanoseconds' of 1E9 to 2E9-1 can be used to represent leap seconds. data SystemTime = MkSystemTime { systemSeconds :: {-# UNPACK #-} !Int64 diff --git a/lib/Data/Time/Clock/System.hs b/lib/Data/Time/Clock/System.hs index a9664bc..6b41e2d 100644 --- a/lib/Data/Time/Clock/System.hs +++ b/lib/Data/Time/Clock/System.hs @@ -17,10 +17,13 @@ import Data.Time.Calendar.Days import Data.Int (Int64) +-- | Map leap-second values to the start of the following second. +-- The resulting 'systemNanoseconds' will always be in the range 0 to 1E9-1. truncateSystemTimeLeapSecond :: SystemTime -> SystemTime truncateSystemTimeLeapSecond (MkSystemTime seconds nanoseconds) | nanoseconds >= 1000000000 = MkSystemTime (succ seconds) 0 truncateSystemTimeLeapSecond t = t +-- | Convert 'SystemTime' to 'UTCTime', matching zero 'SystemTime' to midnight of 'systemEpochDay' UTC. systemToUTCTime :: SystemTime -> UTCTime systemToUTCTime (MkSystemTime seconds nanoseconds) = let days :: Int64 @@ -40,6 +43,7 @@ systemToUTCTime (MkSystemTime seconds nanoseconds) = let time = picosecondsToDiffTime $ fromIntegral timePicoseconds in UTCTime day time +-- | Convert 'UTCTime' to 'SystemTime', matching zero 'SystemTime' to midnight of 'systemEpochDay' UTC. utcToSystemTime :: UTCTime -> SystemTime utcToSystemTime (UTCTime day time) = let days :: Int64 @@ -63,11 +67,13 @@ utcToSystemTime (UTCTime day time) = let systemEpochAbsolute :: AbsoluteTime systemEpochAbsolute = taiNominalDayStart systemEpochDay +-- | Convert 'SystemTime' to 'AbsoluteTime', matching zero 'SystemTime' to midnight of 'systemEpochDay' TAI. systemToTAITime :: SystemTime -> AbsoluteTime systemToTAITime (MkSystemTime s ns) = let diff :: DiffTime diff = (fromIntegral s) + (fromIntegral ns) * 1E-9 in addAbsoluteTime diff systemEpochAbsolute +-- | The day of the epoch of 'SystemTime', 1970-01-01 systemEpochDay :: Day systemEpochDay = ModifiedJulianDay 40587 From git at git.haskell.org Mon Feb 20 21:20:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:20:06 +0000 (UTC) Subject: [commit: packages/time] format-widths, master, tasty: benchmark: fix (04c34a6) Message-ID: <20170220212006.CED033A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,master,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/04c34a6880937b7abbb17d54d05bce236d5da5f1 >--------------------------------------------------------------- commit 04c34a6880937b7abbb17d54d05bce236d5da5f1 Author: Ashley Yakeley Date: Sun Jan 15 16:14:11 2017 -0800 benchmark: fix >--------------------------------------------------------------- 04c34a6880937b7abbb17d54d05bce236d5da5f1 benchmark/Main.hs | 2 +- benchmark/time-bench.cabal | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/benchmark/Main.hs b/benchmark/Main.hs index dbee637..854144a 100644 --- a/benchmark/Main.hs +++ b/benchmark/Main.hs @@ -12,7 +12,7 @@ main :: IO () main = do getCurrentTime >>= print O.getCurrentTime >>= print - getPOSIXTime >>= print . posixToUTCTime + getPOSIXTime >>= print . posixSecondsToUTCTime O.getPOSIXTime >>= print . O.posixSecondsToUTCTime getZonedTime >>= print O.getZonedTime >>= print diff --git a/benchmark/time-bench.cabal b/benchmark/time-bench.cabal index 9026ffe..4cc6559 100644 --- a/benchmark/time-bench.cabal +++ b/benchmark/time-bench.cabal @@ -11,7 +11,7 @@ executable time-bench hs-source-dirs: ../lib, . main-is: Main.hs other-modules: - Data.Time.Clock.CTimespec + Data.Time.Clock.Internal.CTimespec default-language: Haskell2010 if impl(ghc) default-extensions: From git at git.haskell.org Mon Feb 20 21:20:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:20:08 +0000 (UTC) Subject: [commit: packages/time] format-widths, master, tasty: benchmark: regroup tests, add getSystemTime (da99ca7) Message-ID: <20170220212008.D5A053A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,master,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/da99ca7339f03e5b8f55e2e4a10789afa32b0632 >--------------------------------------------------------------- commit da99ca7339f03e5b8f55e2e4a10789afa32b0632 Author: Ashley Yakeley Date: Sun Jan 15 16:24:26 2017 -0800 benchmark: regroup tests, add getSystemTime >--------------------------------------------------------------- da99ca7339f03e5b8f55e2e4a10789afa32b0632 benchmark/Main.hs | 45 ++++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/benchmark/Main.hs b/benchmark/Main.hs index 854144a..4807034 100644 --- a/benchmark/Main.hs +++ b/benchmark/Main.hs @@ -4,6 +4,7 @@ module Main where import Criterion.Main import Data.Time import Data.Time.Clock.POSIX +import Data.Time.Clock.System import qualified "time" Data.Time as O import qualified "time" Data.Time.Clock.POSIX as O @@ -22,22 +23,32 @@ main = do _otz <- O.getCurrentTimeZone oct <- O.getCurrentTime - defaultMain - [ bgroup "new" - [ bench "getCurrentTime" $ nfIO getCurrentTime - , bench "getPOSIXTime" $ nfIO getPOSIXTime - , bench "getTimeZone" $ nfIO $ getTimeZone ct - , bench "getCurrentTimeZone" $ nfIO getCurrentTimeZone - , bench "getZonedTime" $ nfIO getZonedTime - , bench "formatTime" $ nf (formatTime defaultTimeLocale "%a, %_d %b %Y %H:%M:%S %Z") ct - ] - , - bgroup "old" - [ bench "getCurrentTime" $ nfIO O.getCurrentTime - , bench "getPOSIXTime" $ nfIO O.getPOSIXTime - , bench "getTimeZone" $ nfIO $ O.getTimeZone oct - , bench "getCurrentTimeZone" $ nfIO O.getCurrentTimeZone - , bench "getZonedTime" $ nfIO O.getZonedTime - , bench "formatTime" $ nf (O.formatTime O.defaultTimeLocale "%a, %_d %b %Y %H:%M:%S %Z") oct + defaultMain [ + bgroup "getCurrentTime" [ + bench "old" $ nfIO O.getCurrentTime, + bench "new" $ nfIO getCurrentTime + ], + bgroup "getPOSIXTime" [ + bench "old" $ nfIO O.getPOSIXTime, + bench "new" $ nfIO getPOSIXTime + ], + bgroup "getSystemTime" [ + bench "new" $ nfIO getSystemTime + ], + bgroup "getTimeZone" [ + bench "old" $ nfIO $ O.getTimeZone oct, + bench "new" $ nfIO $ getTimeZone ct + ], + bgroup "getCurrentTimeZone" [ + bench "old" $ nfIO O.getCurrentTimeZone, + bench "new" $ nfIO getCurrentTimeZone + ], + bgroup "getZonedTime" [ + bench "old" $ nfIO O.getZonedTime, + bench "new" $ nfIO getZonedTime + ], + bgroup "formatTime" [ + bench "old" $ nf (O.formatTime O.defaultTimeLocale "%a, %_d %b %Y %H:%M:%S %Z") oct, + bench "new" $ nf (formatTime defaultTimeLocale "%a, %_d %b %Y %H:%M:%S %Z") ct ] ] From git at git.haskell.org Mon Feb 20 21:20:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:20:10 +0000 (UTC) Subject: [commit: packages/time] master: SystemTime: fix for Win32 (6e202ed) Message-ID: <20170220212010.DC6A13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branch : master Link : http://git.haskell.org/packages/time.git/commitdiff/6e202edc1b0e32c25bc13194e6496c2c18198463 >--------------------------------------------------------------- commit 6e202edc1b0e32c25bc13194e6496c2c18198463 Author: Ashley Yakeley Date: Sun Jan 15 17:41:21 2017 -0800 SystemTime: fix for Win32 >--------------------------------------------------------------- 6e202edc1b0e32c25bc13194e6496c2c18198463 lib/Data/Time/Clock/Internal/SystemTime.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Data/Time/Clock/Internal/SystemTime.hs b/lib/Data/Time/Clock/Internal/SystemTime.hs index 75af1fa..3928def 100644 --- a/lib/Data/Time/Clock/Internal/SystemTime.hs +++ b/lib/Data/Time/Clock/Internal/SystemTime.hs @@ -15,7 +15,7 @@ import Data.Time.Clock.Internal.DiffTime #include "HsTimeConfig.h" #ifdef mingw32_HOST_OS -import System.Win32.Time +import qualified System.Win32.Time as Win32 #elif HAVE_CLOCK_GETTIME import Data.Time.Clock.Internal.CTimespec import Foreign.C.Types (CTime(..), CLong(..)) @@ -54,7 +54,7 @@ getTAISystemTime :: Maybe (DiffTime,IO SystemTime) -- time by adjusting the offset to be relative to the POSIX epoch. getSystemTime = do - FILETIME ft <- System.Win32.Time.getSystemTimeAsFileTime + FILETIME ft <- Win32.getSystemTimeAsFileTime let (s, us) = (ft - win32_epoch_adjust) `divMod` 10000000 return (MkSystemTime (fromIntegral s) (fromIntegral us * 1000)) where From git at git.haskell.org Mon Feb 20 21:20:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:20:12 +0000 (UTC) Subject: [commit: packages/time] format-widths, tasty: SystemTime: fix for Win32 (d30f427) Message-ID: <20170220212012.E312F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/d30f427fbab5f001fb4339a7e87ed7cdcffd1fb5 >--------------------------------------------------------------- commit d30f427fbab5f001fb4339a7e87ed7cdcffd1fb5 Author: Ashley Yakeley Date: Sun Jan 15 17:41:21 2017 -0800 SystemTime: fix for Win32 >--------------------------------------------------------------- d30f427fbab5f001fb4339a7e87ed7cdcffd1fb5 lib/Data/Time/Clock/Internal/SystemTime.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Data/Time/Clock/Internal/SystemTime.hs b/lib/Data/Time/Clock/Internal/SystemTime.hs index 75af1fa..5826263 100644 --- a/lib/Data/Time/Clock/Internal/SystemTime.hs +++ b/lib/Data/Time/Clock/Internal/SystemTime.hs @@ -15,7 +15,7 @@ import Data.Time.Clock.Internal.DiffTime #include "HsTimeConfig.h" #ifdef mingw32_HOST_OS -import System.Win32.Time +import qualified System.Win32.Time as Win32 #elif HAVE_CLOCK_GETTIME import Data.Time.Clock.Internal.CTimespec import Foreign.C.Types (CTime(..), CLong(..)) @@ -54,7 +54,7 @@ getTAISystemTime :: Maybe (DiffTime,IO SystemTime) -- time by adjusting the offset to be relative to the POSIX epoch. getSystemTime = do - FILETIME ft <- System.Win32.Time.getSystemTimeAsFileTime + Win32.FILETIME ft <- Win32.getSystemTimeAsFileTime let (s, us) = (ft - win32_epoch_adjust) `divMod` 10000000 return (MkSystemTime (fromIntegral s) (fromIntegral us * 1000)) where From git at git.haskell.org Mon Feb 20 21:20:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:20:14 +0000 (UTC) Subject: [commit: packages/time] format-widths, tasty: SystemTime: -fno-warn-trustworthy-safe (c53e19e) Message-ID: <20170220212014.EA3FA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/c53e19e79457e485ffa56607b5fd4b463a738880 >--------------------------------------------------------------- commit c53e19e79457e485ffa56607b5fd4b463a738880 Author: Ashley Yakeley Date: Sun Jan 15 18:05:44 2017 -0800 SystemTime: -fno-warn-trustworthy-safe >--------------------------------------------------------------- c53e19e79457e485ffa56607b5fd4b463a738880 lib/Data/Time/Clock/Internal/SystemTime.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Data/Time/Clock/Internal/SystemTime.hs b/lib/Data/Time/Clock/Internal/SystemTime.hs index 5826263..2fa0012 100644 --- a/lib/Data/Time/Clock/Internal/SystemTime.hs +++ b/lib/Data/Time/Clock/Internal/SystemTime.hs @@ -1,3 +1,4 @@ +{-# OPTIONS -fno-warn-trustworthy-safe #-} {-# LANGUAGE Trustworthy #-} module Data.Time.Clock.Internal.SystemTime ( From git at git.haskell.org Mon Feb 20 21:20:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:20:16 +0000 (UTC) Subject: [commit: packages/time] format-widths, tasty: get building with GHC 7.8 (df4fa15) Message-ID: <20170220212016.F13EF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/df4fa15b87f748487a9165aafcd08fae99c4c2ee >--------------------------------------------------------------- commit df4fa15b87f748487a9165aafcd08fae99c4c2ee Author: Ashley Yakeley Date: Sun Jan 15 18:55:11 2017 -0800 get building with GHC 7.8 >--------------------------------------------------------------- df4fa15b87f748487a9165aafcd08fae99c4c2ee lib/Data/Time/Clock/Internal/SystemTime.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/Data/Time/Clock/Internal/SystemTime.hs b/lib/Data/Time/Clock/Internal/SystemTime.hs index 2fa0012..bc9aad5 100644 --- a/lib/Data/Time/Clock/Internal/SystemTime.hs +++ b/lib/Data/Time/Clock/Internal/SystemTime.hs @@ -1,4 +1,6 @@ +#if __GLASGOW_HASKELL__ >= 710 {-# OPTIONS -fno-warn-trustworthy-safe #-} +#endif {-# LANGUAGE Trustworthy #-} module Data.Time.Clock.Internal.SystemTime ( From git at git.haskell.org Mon Feb 20 21:20:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:20:19 +0000 (UTC) Subject: [commit: packages/time] format-widths, tasty: test: switch from test-framework to tasty (6aba903) Message-ID: <20170220212019.06E2D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/6aba903cb1fa4c54317d5685e3f229a1cf405311 >--------------------------------------------------------------- commit 6aba903cb1fa4c54317d5685e3f229a1cf405311 Author: Ashley Yakeley Date: Wed Jan 18 20:22:20 2017 -0800 test: switch from test-framework to tasty >--------------------------------------------------------------- 6aba903cb1fa4c54317d5685e3f229a1cf405311 test/Test.hs | 2 +- test/Test/AddDays.hs | 6 ++-- test/Test/ClipDates.hs | 6 ++-- test/Test/ConvertBack.hs | 6 ++-- test/Test/LongWeekYears.hs | 6 ++-- test/Test/Resolution.hs | 14 ++++----- test/Test/TestCalendars.hs | 6 ++-- test/Test/TestEaster.hs | 6 ++-- test/Test/TestFormat.hs | 26 ++++++++--------- test/Test/TestMonthDay.hs | 6 ++-- test/Test/TestParseTime.hs | 72 +++++++++++++++++++++++----------------------- test/Test/TestTime.hs | 6 ++-- test/Test/TestTimeZone.hs | 17 ++++++----- test/Test/TestUtil.hs | 65 ++++++++--------------------------------- test/Test/TestValid.hs | 8 +++--- test/Test/Tests.hs | 6 ++-- time.cabal | 7 +++-- 17 files changed, 112 insertions(+), 153 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 6aba903cb1fa4c54317d5685e3f229a1cf405311 From git at git.haskell.org Mon Feb 20 21:20:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:20:21 +0000 (UTC) Subject: [commit: packages/time] format-widths,tasty: test: clean up TestUtil; group tests properly (ee4907c) Message-ID: <20170220212021.115FA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/ee4907c5730a882661548282690aa9e4fadeb5c6 >--------------------------------------------------------------- commit ee4907c5730a882661548282690aa9e4fadeb5c6 Author: Ashley Yakeley Date: Wed Feb 1 17:33:31 2017 -0800 test: clean up TestUtil; group tests properly >--------------------------------------------------------------- ee4907c5730a882661548282690aa9e4fadeb5c6 test/Test/AddDays.hs | 5 +- test/Test/ClipDates.hs | 5 +- test/Test/ClockConversion.hs | 3 +- test/Test/ConvertBack.hs | 5 +- test/Test/LongWeekYears.hs | 5 +- test/Test/Resolution.hs | 3 +- test/Test/TestCalendars.hs | 5 +- test/Test/TestEaster.hs | 5 +- test/Test/TestFormat.hs | 53 +++++-------- test/Test/TestMonthDay.hs | 5 +- test/Test/TestParseTime.hs | 172 +++++++++++++++++-------------------------- test/Test/TestTAI.hs | 2 + test/Test/TestTime.hs | 5 +- test/Test/TestTimeZone.hs | 5 +- test/Test/TestUtil.hs | 30 ++++++-- test/Test/TestValid.hs | 2 +- 16 files changed, 141 insertions(+), 169 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 ee4907c5730a882661548282690aa9e4fadeb5c6 From git at git.haskell.org Mon Feb 20 21:20:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:20:23 +0000 (UTC) Subject: [commit: packages/time] format-widths, tasty: test: TestValid: fix rejected cases problem (c9756f7) Message-ID: <20170220212023.17F4E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,tasty Link : http://git.haskell.org/packages/time.git/commitdiff/c9756f78625e0a1aa5247d97ed3ff85f4df94d75 >--------------------------------------------------------------- commit c9756f78625e0a1aa5247d97ed3ff85f4df94d75 Author: Ashley Yakeley Date: Fri Feb 3 00:32:27 2017 -0800 test: TestValid: fix rejected cases problem >--------------------------------------------------------------- c9756f78625e0a1aa5247d97ed3ff85f4df94d75 test/Test/TestValid.hs | 68 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 51 insertions(+), 17 deletions(-) diff --git a/test/Test/TestValid.hs b/test/Test/TestValid.hs index 6909425..4d8d18f 100644 --- a/test/Test/TestValid.hs +++ b/test/Test/TestValid.hs @@ -10,8 +10,9 @@ import Test.QuickCheck.Property validResult :: (Eq c,Show c,Eq t,Show t) => - Bool -> (t -> c) -> (c -> t) -> (c -> Maybe t) -> c -> Result -validResult valid toComponents fromComponents fromComponentsValid c = let + (s -> c) -> Bool -> (t -> c) -> (c -> t) -> (c -> Maybe t) -> s -> Result +validResult sc valid toComponents fromComponents fromComponentsValid s = let + c = sc s mt = fromComponentsValid c t' = fromComponents c c' = toComponents t' @@ -29,33 +30,66 @@ validResult valid toComponents fromComponents fromComponentsValid c = let else failed {reason = show c ++ " found invalid, but converts with " ++ show t'} Just _ -> rejected -validTest :: (Arbitrary c,Eq c,Show c,Eq t,Show t) => - String -> (t -> c) -> (c -> t) -> (c -> Maybe t) -> TestTree -validTest name toComponents fromComponents fromComponentsValid = testGroup name +validTest :: (Arbitrary s,Show s,Eq c,Show c,Eq t,Show t) => + String -> (s -> c) -> (t -> c) -> (c -> t) -> (c -> Maybe t) -> TestTree +validTest name sc toComponents fromComponents fromComponentsValid = testGroup name [ - testProperty "valid" $ property $ validResult True toComponents fromComponents fromComponentsValid, - testProperty "invalid" $ property $ validResult False toComponents fromComponents fromComponentsValid + testProperty "valid" $ property $ validResult sc True toComponents fromComponents fromComponentsValid, + testProperty "invalid" $ property $ validResult sc False toComponents fromComponents fromComponentsValid ] toSundayStartWeek :: Day -> (Integer,Int,Int) toSundayStartWeek day = let (y,_) = toOrdinalDate day - (m,d) = sundayStartWeek day - in (y,m,d) + (w,d) = sundayStartWeek day + in (y,w,d) toMondayStartWeek :: Day -> (Integer,Int,Int) toMondayStartWeek day = let (y,_) = toOrdinalDate day - (m,d) = mondayStartWeek day - in (y,m,d) + (w,d) = mondayStartWeek day + in (y,w,d) + +newtype Year = MkYear Integer deriving (Eq,Show) +instance Arbitrary Year where + arbitrary = fmap MkYear $ choose (-1000,3000) + +newtype YearMonth = MkYearMonth Int deriving (Eq,Show) +instance Arbitrary YearMonth where + arbitrary = fmap MkYearMonth $ choose (-5,17) + +newtype MonthDay = MkMonthDay Int deriving (Eq,Show) +instance Arbitrary MonthDay where + arbitrary = fmap MkMonthDay $ choose (-5,35) + +newtype YearDay = MkYearDay Int deriving (Eq,Show) +instance Arbitrary YearDay where + arbitrary = fmap MkYearDay $ choose (-20,400) + +newtype YearWeek = MkYearWeek Int deriving (Eq,Show) +instance Arbitrary YearWeek where + arbitrary = fmap MkYearWeek $ choose (-5,60) + +newtype WeekDay = MkWeekDay Int deriving (Eq,Show) +instance Arbitrary WeekDay where + arbitrary = fmap MkWeekDay $ choose (-5,15) + +fromYMD :: (Year,YearMonth,MonthDay) -> (Integer,Int,Int) +fromYMD (MkYear y,MkYearMonth ym,MkMonthDay md) = (y,ym,md) + +fromYD :: (Year,YearDay) -> (Integer,Int) +fromYD (MkYear y,MkYearDay yd) = (y,yd) + +fromYWD :: (Year,YearWeek,WeekDay) -> (Integer,Int,Int) +fromYWD (MkYear y,MkYearWeek yw,MkWeekDay wd) = (y,yw,wd) testValid :: TestTree testValid = testGroup "testValid" [ - validTest "Gregorian" toGregorian (\(y,m,d) -> fromGregorian y m d) (\(y,m,d) -> fromGregorianValid y m d), - validTest "OrdinalDate" toOrdinalDate (\(y,d) -> fromOrdinalDate y d) (\(y,d) -> fromOrdinalDateValid y d), - validTest "WeekDate" toWeekDate (\(y,m,d) -> fromWeekDate y m d) (\(y,m,d) -> fromWeekDateValid y m d), - validTest "SundayStartWeek" toSundayStartWeek (\(y,m,d) -> fromSundayStartWeek y m d) (\(y,m,d) -> fromSundayStartWeekValid y m d), - validTest "MondayStartWeek" toMondayStartWeek (\(y,m,d) -> fromMondayStartWeek y m d) (\(y,m,d) -> fromMondayStartWeekValid y m d), - validTest "Julian" toJulian (\(y,m,d) -> fromJulian y m d) (\(y,m,d) -> fromJulianValid y m d) + validTest "Gregorian" fromYMD toGregorian (\(y,m,d) -> fromGregorian y m d) (\(y,m,d) -> fromGregorianValid y m d), + validTest "OrdinalDate" fromYD toOrdinalDate (\(y,d) -> fromOrdinalDate y d) (\(y,d) -> fromOrdinalDateValid y d), + validTest "WeekDate" fromYWD toWeekDate (\(y,w,d) -> fromWeekDate y w d) (\(y,w,d) -> fromWeekDateValid y w d), + validTest "SundayStartWeek" fromYWD toSundayStartWeek (\(y,w,d) -> fromSundayStartWeek y w d) (\(y,w,d) -> fromSundayStartWeekValid y w d), + validTest "MondayStartWeek" fromYWD toMondayStartWeek (\(y,w,d) -> fromMondayStartWeek y w d) (\(y,w,d) -> fromMondayStartWeekValid y w d), + validTest "Julian" fromYMD toJulian (\(y,m,d) -> fromJulian y m d) (\(y,m,d) -> fromJulianValid y m d) ] From git at git.haskell.org Mon Feb 20 21:20:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:20:25 +0000 (UTC) Subject: [commit: packages/time] format-widths: test: reorganise module hierarchy (87ccd8c) Message-ID: <20170220212025.2C86D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branch : format-widths Link : http://git.haskell.org/packages/time.git/commitdiff/87ccd8cca1439ff7b9f7b00acb2afd50eecabf5b >--------------------------------------------------------------- commit 87ccd8cca1439ff7b9f7b00acb2afd50eecabf5b Author: Ashley Yakeley Date: Fri Feb 3 13:43:42 2017 -0800 test: reorganise module hierarchy >--------------------------------------------------------------- 87ccd8cca1439ff7b9f7b00acb2afd50eecabf5b test/{Test => }/CurrentTime.hs | 0 test/{Test => }/RealToFracBenchmark.hs | 0 test/{Test => }/ShowDST.hs | 0 test/Test/Tests.hs | 36 -------------- test/{Test => }/TimeZone.hs | 0 test/{Test => }/UseCases.lhs | 0 test/{Test.hs => main/Main.hs} | 0 test/{Test => main/Test/Calendar}/AddDays.hs | 4 +- test/{Test => main/Test/Calendar}/AddDaysRef.hs | 2 +- .../Test/Calendar/Calendars.hs} | 4 +- .../Test/Calendar/CalendarsRef.hs} | 2 +- test/{Test => main/Test/Calendar}/ClipDates.hs | 4 +- test/{Test => main/Test/Calendar}/ClipDatesRef.hs | 2 +- test/{Test => main/Test/Calendar}/ConvertBack.hs | 2 +- .../TestEaster.hs => main/Test/Calendar/Easter.hs} | 4 +- .../Test/Calendar/EasterRef.hs} | 2 +- test/{Test => main/Test/Calendar}/LongWeekYears.hs | 4 +- .../Test/Calendar}/LongWeekYearsRef.hs | 2 +- .../Test/Calendar/MonthDay.hs} | 4 +- .../Test/Calendar/MonthDayRef.hs} | 2 +- .../TestValid.hs => main/Test/Calendar/Valid.hs} | 2 +- .../Test/Clock/Conversion.hs} | 2 +- test/{Test => main/Test/Clock}/Resolution.hs | 2 +- test/{Test/TestTAI.hs => main/Test/Clock/TAI.hs} | 2 +- .../TestFormat.hs => main/Test/Format/Format.hs} | 4 +- .../Test/Format/FormatStuff.c} | 2 +- .../Test/Format/FormatStuff.h} | 0 .../Test/Format/ParseTime.hs} | 2 +- .../TestTime.hs => main/Test/LocalTime/Time.hs} | 4 +- .../Test/LocalTime/TimeRef.hs} | 2 +- .../Test/LocalTime/TimeZone.hs} | 2 +- test/{ => main}/Test/TestUtil.hs | 0 test/main/Test/Tests.hs | 36 ++++++++++++++ time.cabal | 56 +++++++++++----------- 34 files changed, 95 insertions(+), 95 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 87ccd8cca1439ff7b9f7b00acb2afd50eecabf5b From git at git.haskell.org Mon Feb 20 21:20:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:20:27 +0000 (UTC) Subject: [commit: packages/time] format-widths: test: minor clean-up (e71ecc3) Message-ID: <20170220212027.33D043A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branch : format-widths Link : http://git.haskell.org/packages/time.git/commitdiff/e71ecc300deee5782773a434769d3dc04e2e3831 >--------------------------------------------------------------- commit e71ecc300deee5782773a434769d3dc04e2e3831 Author: Ashley Yakeley Date: Fri Feb 3 14:02:22 2017 -0800 test: minor clean-up >--------------------------------------------------------------- e71ecc300deee5782773a434769d3dc04e2e3831 test/main/Main.hs | 47 +++++++++++++++++++++++++++++++++++++++++++++-- test/main/Test/Tests.hs | 36 ------------------------------------ time.cabal | 39 +++++++++++++++++++-------------------- 3 files changed, 64 insertions(+), 58 deletions(-) diff --git a/test/main/Main.hs b/test/main/Main.hs index 7602d2a..e0c3eaf 100644 --- a/test/main/Main.hs +++ b/test/main/Main.hs @@ -1,7 +1,50 @@ module Main where -import Test.Tasty -import Test.Tests + import Foreign.C.Types +import Test.Tasty +import Test.Calendar.AddDays +import Test.Calendar.Calendars +import Test.Calendar.ClipDates +import Test.Calendar.ConvertBack +import Test.Calendar.Easter +import Test.Calendar.LongWeekYears +import Test.Calendar.MonthDay +import Test.Calendar.Valid +import Test.Clock.Conversion +import Test.Clock.Resolution +import Test.Clock.TAI +import Test.Format.Format +import Test.Format.ParseTime +import Test.LocalTime.Time +import Test.LocalTime.TimeZone + + +tests :: TestTree +tests = testGroup "Time" [ + testGroup "Calendar" [ + addDaysTest, + testCalendars, + clipDates, + convertBack, + longWeekYears, + testMonthDay, + testEaster, + testValid + ], + testGroup "Clock" [ + testClockConversion, + testResolution, + testTAI + ], + testGroup "Format" [ + testFormat, + testParseTime + ], + testGroup "LocalTime" [ + testTime, + testTimeZone + ] + ] main :: IO () main = do diff --git a/test/main/Test/Tests.hs b/test/main/Test/Tests.hs deleted file mode 100644 index e95cb68..0000000 --- a/test/main/Test/Tests.hs +++ /dev/null @@ -1,36 +0,0 @@ -module Test.Tests where - -import Test.Tasty - -import Test.Calendar.AddDays -import Test.Calendar.ClipDates -import Test.Clock.Conversion -import Test.Calendar.ConvertBack -import Test.Calendar.LongWeekYears -import Test.Clock.Resolution -import Test.Calendar.Calendars -import Test.Calendar.Easter -import Test.Format.Format -import Test.Calendar.MonthDay -import Test.Format.ParseTime -import Test.Clock.TAI -import Test.LocalTime.Time -import Test.LocalTime.TimeZone -import Test.Calendar.Valid - -tests :: TestTree -tests = testGroup "time" [ addDaysTest - , clipDates - , testClockConversion - , convertBack - , longWeekYears - , testResolution - , testCalendars - , testEaster - , testFormat - , testMonthDay - , testParseTime - , testTAI - , testTime - , testTimeZone - , testValid ] diff --git a/time.cabal b/time.cabal index e8f9934..cc43eff 100644 --- a/time.cabal +++ b/time.cabal @@ -137,27 +137,26 @@ test-suite test-main unix main-is: Main.hs other-modules: - Test.Tests - Test.Clock.Conversion - Test.LocalTime.Time - Test.LocalTime.TimeRef - Test.Format.ParseTime - Test.Calendar.MonthDay - Test.Calendar.MonthDayRef - Test.Format.Format - Test.Calendar.Easter - Test.Calendar.EasterRef + Test.TestUtil + Test.Calendar.AddDays + Test.Calendar.AddDaysRef Test.Calendar.Calendars Test.Calendar.CalendarsRef - Test.Clock.TAI - Test.LocalTime.TimeZone - Test.Calendar.Valid - Test.Clock.Resolution - Test.Calendar.LongWeekYears - Test.Calendar.LongWeekYearsRef - Test.Calendar.ConvertBack Test.Calendar.ClipDates Test.Calendar.ClipDatesRef - Test.Calendar.AddDays - Test.Calendar.AddDaysRef - Test.TestUtil + Test.Calendar.ConvertBack + Test.Calendar.Easter + Test.Calendar.EasterRef + Test.Calendar.LongWeekYears + Test.Calendar.LongWeekYearsRef + Test.Calendar.MonthDay + Test.Calendar.MonthDayRef + Test.Calendar.Valid + Test.Clock.Conversion + Test.Clock.Resolution + Test.Clock.TAI + Test.Format.Format + Test.Format.ParseTime + Test.LocalTime.Time + Test.LocalTime.TimeRef + Test.LocalTime.TimeZone From git at git.haskell.org Mon Feb 20 21:20:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:20:29 +0000 (UTC) Subject: [commit: packages/time] format-widths: test: separate Unix-specific test stanza (b13119e) Message-ID: <20170220212029.3BB813A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branch : format-widths Link : http://git.haskell.org/packages/time.git/commitdiff/b13119e1557c3edfbc9d6fee7311671e55b6e16b >--------------------------------------------------------------- commit b13119e1557c3edfbc9d6fee7311671e55b6e16b Author: Ashley Yakeley Date: Fri Feb 3 14:09:12 2017 -0800 test: separate Unix-specific test stanza >--------------------------------------------------------------- b13119e1557c3edfbc9d6fee7311671e55b6e16b test/main/Main.hs | 4 +--- test/unix/Main.hs | 20 +++++++++++++++++ test/{main => unix}/Test/LocalTime/TimeZone.hs | 0 time.cabal | 30 ++++++++++++++++++++++++-- 4 files changed, 49 insertions(+), 5 deletions(-) diff --git a/test/main/Main.hs b/test/main/Main.hs index e0c3eaf..8f205e3 100644 --- a/test/main/Main.hs +++ b/test/main/Main.hs @@ -16,7 +16,6 @@ import Test.Clock.TAI import Test.Format.Format import Test.Format.ParseTime import Test.LocalTime.Time -import Test.LocalTime.TimeZone tests :: TestTree @@ -41,8 +40,7 @@ tests = testGroup "Time" [ testParseTime ], testGroup "LocalTime" [ - testTime, - testTimeZone + testTime ] ] diff --git a/test/unix/Main.hs b/test/unix/Main.hs new file mode 100644 index 0000000..8d1b932 --- /dev/null +++ b/test/unix/Main.hs @@ -0,0 +1,20 @@ +module Main where + +import Foreign.C.Types +import Test.Tasty +import Test.LocalTime.TimeZone + + +tests :: TestTree +tests = testGroup "Time" [ + testGroup "LocalTime" [ + testTimeZone + ] + ] + +main :: IO () +main = do + if (toRational (1000000000000 :: CTime)) /= (1000000000000 :: Rational) + then putStrLn "WARNING: Some tests will incorrectly fail due to a 32-bit time_t C type." + else return () + defaultMain tests diff --git a/test/main/Test/LocalTime/TimeZone.hs b/test/unix/Test/LocalTime/TimeZone.hs similarity index 100% rename from test/main/Test/LocalTime/TimeZone.hs rename to test/unix/Test/LocalTime/TimeZone.hs diff --git a/time.cabal b/time.cabal index cc43eff..a30fc45 100644 --- a/time.cabal +++ b/time.cabal @@ -133,8 +133,7 @@ test-suite test-main QuickCheck, tasty, tasty-hunit, - tasty-quickcheck, - unix + tasty-quickcheck main-is: Main.hs other-modules: Test.TestUtil @@ -159,4 +158,31 @@ test-suite test-main Test.Format.ParseTime Test.LocalTime.Time Test.LocalTime.TimeRef + +test-suite test-unix + type: exitcode-stdio-1.0 + hs-source-dirs: test/unix + default-language: Haskell2010 + default-extensions: + Rank2Types + CPP + DeriveDataTypeable + StandaloneDeriving + ExistentialQuantification + MultiParamTypeClasses + FlexibleInstances + UndecidableInstances + ScopedTypeVariables + ghc-options: -Wall -fwarn-tabs + build-depends: + base, + deepseq, + time, + unix, + QuickCheck, + tasty, + tasty-hunit, + tasty-quickcheck + main-is: Main.hs + other-modules: Test.LocalTime.TimeZone From git at git.haskell.org Mon Feb 20 21:20:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:20:31 +0000 (UTC) Subject: [commit: packages/time] format-widths: test: don't build test-unix on Windows (155227f) Message-ID: <20170220212031.42AF63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branch : format-widths Link : http://git.haskell.org/packages/time.git/commitdiff/155227f74ba30654f2ab7727bc824506efc34b9e >--------------------------------------------------------------- commit 155227f74ba30654f2ab7727bc824506efc34b9e Author: Ashley Yakeley Date: Fri Feb 3 14:16:11 2017 -0800 test: don't build test-unix on Windows >--------------------------------------------------------------- 155227f74ba30654f2ab7727bc824506efc34b9e time.cabal | 2 ++ 1 file changed, 2 insertions(+) diff --git a/time.cabal b/time.cabal index a30fc45..0a0ecb9 100644 --- a/time.cabal +++ b/time.cabal @@ -160,6 +160,8 @@ test-suite test-main Test.LocalTime.TimeRef test-suite test-unix + if os(windows) + buildable: false type: exitcode-stdio-1.0 hs-source-dirs: test/unix default-language: Haskell2010 From git at git.haskell.org Mon Feb 20 21:20:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:20:33 +0000 (UTC) Subject: [commit: packages/time] format-widths: test: cabal: fix flag (a8b3255) Message-ID: <20170220212033.494883A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branch : format-widths Link : http://git.haskell.org/packages/time.git/commitdiff/a8b325538bb0116ec5e6f64885ac8bfea04aa1b0 >--------------------------------------------------------------- commit a8b325538bb0116ec5e6f64885ac8bfea04aa1b0 Author: Ashley Yakeley Date: Fri Feb 3 14:52:34 2017 -0800 test: cabal: fix flag >--------------------------------------------------------------- a8b325538bb0116ec5e6f64885ac8bfea04aa1b0 time.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/time.cabal b/time.cabal index 0a0ecb9..929a6bb 100644 --- a/time.cabal +++ b/time.cabal @@ -161,7 +161,7 @@ test-suite test-main test-suite test-unix if os(windows) - buildable: false + buildable: False type: exitcode-stdio-1.0 hs-source-dirs: test/unix default-language: Haskell2010 From git at git.haskell.org Mon Feb 20 21:20:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:20:35 +0000 (UTC) Subject: [commit: packages/time] format-widths: test: move Unix formatting comparison tests to test-unix stanza (a285183) Message-ID: <20170220212035.541DB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branch : format-widths Link : http://git.haskell.org/packages/time.git/commitdiff/a2851837e06fc49cdf2a903d501f8b324d3ebbe7 >--------------------------------------------------------------- commit a2851837e06fc49cdf2a903d501f8b324d3ebbe7 Author: Ashley Yakeley Date: Sat Feb 4 02:45:52 2017 -0800 test: move Unix formatting comparison tests to test-unix stanza >--------------------------------------------------------------- a2851837e06fc49cdf2a903d501f8b324d3ebbe7 test/main/Test/Format/Format.hs | 114 ++------------------------ test/unix/Main.hs | 4 + test/{main => unix}/Test/Format/Format.hs | 42 ---------- test/{main => unix}/Test/Format/FormatStuff.c | 0 test/{main => unix}/Test/Format/FormatStuff.h | 0 test/{main => unix}/Test/TestUtil.hs | 0 time.cabal | 8 +- 7 files changed, 17 insertions(+), 151 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 a2851837e06fc49cdf2a903d501f8b324d3ebbe7 From git at git.haskell.org Mon Feb 20 21:20:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:20:37 +0000 (UTC) Subject: [commit: packages/time] format-widths: test: prevent building unix on Windows (1e3893c) Message-ID: <20170220212037.5B3133A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branch : format-widths Link : http://git.haskell.org/packages/time.git/commitdiff/1e3893c71658c631babe768d75dbe849727d154c >--------------------------------------------------------------- commit 1e3893c71658c631babe768d75dbe849727d154c Author: Ashley Yakeley Date: Sat Feb 4 02:59:21 2017 -0800 test: prevent building unix on Windows >--------------------------------------------------------------- 1e3893c71658c631babe768d75dbe849727d154c time.cabal | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/time.cabal b/time.cabal index f33380e..6fb2731 100644 --- a/time.cabal +++ b/time.cabal @@ -180,11 +180,12 @@ test-suite test-unix base, deepseq, time, - unix, QuickCheck, tasty, tasty-hunit, tasty-quickcheck + if !os(windows) + build-depends: unix main-is: Main.hs other-modules: Test.TestUtil From git at git.haskell.org Mon Feb 20 21:20:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:20:39 +0000 (UTC) Subject: [commit: packages/time] format-widths: Fix SystemTime on Windows (ad27c60) Message-ID: <20170220212039.6217A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branch : format-widths Link : http://git.haskell.org/packages/time.git/commitdiff/ad27c60e85531d607aa8a945406e2fe8c0184685 >--------------------------------------------------------------- commit ad27c60e85531d607aa8a945406e2fe8c0184685 Author: Ashley Yakeley Date: Sat Feb 4 18:10:39 2017 -0800 Fix SystemTime on Windows >--------------------------------------------------------------- ad27c60e85531d607aa8a945406e2fe8c0184685 lib/Data/Time/Clock/Internal/SystemTime.hs | 4 +-- test/main/Main.hs | 2 +- test/main/Test/Clock/Resolution.hs | 40 +++++++++++++++++++----------- 3 files changed, 29 insertions(+), 17 deletions(-) diff --git a/lib/Data/Time/Clock/Internal/SystemTime.hs b/lib/Data/Time/Clock/Internal/SystemTime.hs index bc9aad5..480d374 100644 --- a/lib/Data/Time/Clock/Internal/SystemTime.hs +++ b/lib/Data/Time/Clock/Internal/SystemTime.hs @@ -59,11 +59,11 @@ getTAISystemTime :: Maybe (DiffTime,IO SystemTime) getSystemTime = do Win32.FILETIME ft <- Win32.getSystemTimeAsFileTime let (s, us) = (ft - win32_epoch_adjust) `divMod` 10000000 - return (MkSystemTime (fromIntegral s) (fromIntegral us * 1000)) + return (MkSystemTime (fromIntegral s) (fromIntegral us * 100)) where win32_epoch_adjust :: Word64 win32_epoch_adjust = 116444736000000000 -getTime_resolution = 1E-6 -- microsecond +getTime_resolution = 100E-9 -- 100ns getTAISystemTime = Nothing #elif HAVE_CLOCK_GETTIME diff --git a/test/main/Main.hs b/test/main/Main.hs index 8f205e3..5c40256 100644 --- a/test/main/Main.hs +++ b/test/main/Main.hs @@ -32,7 +32,7 @@ tests = testGroup "Time" [ ], testGroup "Clock" [ testClockConversion, - testResolution, + testResolutions, testTAI ], testGroup "Format" [ diff --git a/test/main/Test/Clock/Resolution.hs b/test/main/Test/Clock/Resolution.hs index a8bcd91..d61e8d9 100644 --- a/test/main/Test/Clock/Resolution.hs +++ b/test/main/Test/Clock/Resolution.hs @@ -1,5 +1,6 @@ -module Test.Clock.Resolution(testResolution) where +module Test.Clock.Resolution(testResolutions) where +import Control.Concurrent import Data.Fixed import Data.Time.Clock import Data.Time.Clock.TAI @@ -20,21 +21,32 @@ gcd' a b = gcd' b (mod' a b) gcdAll :: Real a => [a] -> a gcdAll = foldr gcd' 0 -testClockResolution :: TestTree -testClockResolution = testCase "getCurrentTime" $ do - times <- repeatN 100 getCurrentTime - assertEqual "resolution" getTime_resolution $ gcdAll (fmap utctDayTime times) +testResolution :: (Show dt,Real dt) => String -> (at -> at -> dt) -> (dt,IO at) -> TestTree +testResolution name timeDiff (res,getTime) = testCase name $ do + t0 <- getTime + times0 <- repeatN 100 $ do + threadDelay 0 + getTime + times1 <- repeatN 100 $ do -- 100us + threadDelay 1 -- 1us + getTime + times2 <- repeatN 100 $ do -- 1ms + threadDelay 10 -- 10us + getTime + times3 <- repeatN 100 $ do -- 10ms + threadDelay 100 -- 100us + getTime + times4 <- repeatN 100 $ do -- 100ms + threadDelay 1000 -- 1ms + getTime + let times = fmap (\t -> timeDiff t t0) $ times0 ++ times1 ++ times2 ++ times3 ++ times4 + assertEqual "resolution" res $ gcdAll times -testTAIResolution :: (DiffTime,IO AbsoluteTime) -> TestTree -testTAIResolution (res,getTime) = testCase "taiClock" $ do - times <- repeatN 100 getTime - assertEqual "resolution" res $ gcdAll (fmap (\t -> diffAbsoluteTime t taiEpoch) times) - -testResolution :: TestTree -testResolution = testGroup "resolution" $ +testResolutions :: TestTree +testResolutions = testGroup "resolution" $ [ - testClockResolution + testResolution "getCurrentTime" diffUTCTime (realToFrac getTime_resolution,getCurrentTime) ] ++ case taiClock of - Just clock -> [testTAIResolution clock] + Just clock -> [testResolution "taiClock" diffAbsoluteTime clock] Nothing -> [] From git at git.haskell.org Mon Feb 20 21:20:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:20:41 +0000 (UTC) Subject: [commit: packages/time] format-widths: Format: widths for format specifiers (bd85cb0) Message-ID: <20170220212041.6A20C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branch : format-widths Link : http://git.haskell.org/packages/time.git/commitdiff/bd85cb05859f97224b5118b9cb67271d4429172a >--------------------------------------------------------------- commit bd85cb05859f97224b5118b9cb67271d4429172a Author: Ashley Yakeley Date: Sun Feb 5 20:30:12 2017 -0800 Format: widths for format specifiers >--------------------------------------------------------------- bd85cb05859f97224b5118b9cb67271d4429172a lib/Data/Time/Format.hs | 157 ++++++++++++++++++++++++---------------- test/main/Test/Format/Format.hs | 7 +- test/unix/Test/Format/Format.hs | 7 +- 3 files changed, 105 insertions(+), 66 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 bd85cb05859f97224b5118b9cb67271d4429172a From git at git.haskell.org Mon Feb 20 21:20:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:20:43 +0000 (UTC) Subject: [commit: packages/time] format-widths: test: unix: Format: use QuickCheck (dd86365) Message-ID: <20170220212043.70DF03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branch : format-widths Link : http://git.haskell.org/packages/time.git/commitdiff/dd86365d69a8f0caff9e31e9e9f31d70c5c3f359 >--------------------------------------------------------------- commit dd86365d69a8f0caff9e31e9e9f31d70c5c3f359 Author: Ashley Yakeley Date: Sun Feb 5 23:15:38 2017 -0800 test: unix: Format: use QuickCheck >--------------------------------------------------------------- dd86365d69a8f0caff9e31e9e9f31d70c5c3f359 test/unix/Test/Format/Format.hs | 96 +++++++++++++++++++---------------------- test/unix/Test/TestUtil.hs | 10 ++++- 2 files changed, 53 insertions(+), 53 deletions(-) diff --git a/test/unix/Test/Format/Format.hs b/test/unix/Test/Format/Format.hs index 02c8b33..420a70a 100644 --- a/test/unix/Test/Format/Format.hs +++ b/test/unix/Test/Format/Format.hs @@ -7,9 +7,11 @@ import Data.Time.Clock.POSIX import Data.Char import Foreign import Foreign.C +import Test.QuickCheck hiding (Result) +import Test.QuickCheck.Property import Test.Tasty -import Test.Tasty.HUnit import Test.TestUtil +import System.IO.Unsafe {- size_t format_time ( @@ -26,8 +28,8 @@ withBuffer n f = withArray (replicate n 0) (\buffer -> do peekCStringLen (buffer,fromIntegral len) ) -unixFormatTime :: String -> TimeZone -> UTCTime -> IO String -unixFormatTime fmt zone time = withCString fmt (\pfmt -> withCString (timeZoneName zone) (\pzonename -> +unixFormatTime :: String -> TimeZone -> UTCTime -> String +unixFormatTime fmt zone time = unsafePerformIO $ withCString fmt (\pfmt -> withCString (timeZoneName zone) (\pzonename -> withBuffer 100 (\buffer -> format_time buffer 100 pfmt (if timeZoneSummerOnly zone then 1 else 0) (fromIntegral (timeZoneMinutes zone * 60)) @@ -39,36 +41,18 @@ unixFormatTime fmt zone time = withCString fmt (\pfmt -> withCString (timeZoneNa locale :: TimeLocale locale = defaultTimeLocale {dateTimeFmt = "%a %b %e %H:%M:%S %Y"} -zones :: [TimeZone] -zones = [utc,TimeZone 87 True "Fenwickian Daylight Time"] +zones :: Gen TimeZone +zones = do + mins <- choose (-2000,2000) + dst <- arbitrary + name <- return "ZONE" + return $ TimeZone mins dst name -baseTime0 :: UTCTime -baseTime0 = localTimeToUTC utc (LocalTime (fromGregorian 1970 01 01) midnight) - -baseTime1 :: UTCTime -baseTime1 = localTimeToUTC utc (LocalTime (fromGregorian 2000 01 01) midnight) - -getDay :: Integer -> UTCTime -getDay day = addUTCTime ((fromInteger day) * nominalDay) baseTime1 - -getYearP1 :: Integer -> UTCTime -getYearP1 year = localTimeToUTC utc (LocalTime (fromGregorian year 01 01) midnight) - -getYearP2 :: Integer -> UTCTime -getYearP2 year = localTimeToUTC utc (LocalTime (fromGregorian year 02 04) midnight) - -getYearP3 :: Integer -> UTCTime -getYearP3 year = localTimeToUTC utc (LocalTime (fromGregorian year 03 04) midnight) - -getYearP4 :: Integer -> UTCTime -getYearP4 year = localTimeToUTC utc (LocalTime (fromGregorian year 12 31) midnight) - -years :: [Integer] -years = [999,1000,1899,1900,1901] ++ [1980..2000] ++ [9999,10000] - -times :: [UTCTime] -times = [baseTime0] ++ (fmap getDay [0..23]) ++ (fmap getDay [0..100]) ++ - (fmap getYearP1 years) ++ (fmap getYearP2 years) ++ (fmap getYearP3 years) ++ (fmap getYearP4 years) +times :: Gen UTCTime +times = do + day <- choose (-25000,75000) + time <- return midnight + return $ localTimeToUTC utc $ LocalTime (ModifiedJulianDay day) time padN :: Int -> Char -> String -> String padN n _ s | n <= (length s) = s @@ -85,14 +69,13 @@ unixWorkarounds "%_f" s = padN 2 ' ' s unixWorkarounds "%0f" s = padN 2 '0' s unixWorkarounds _ s = s -compareFormat :: (String -> String) -> String -> TimeZone -> UTCTime -> Assertion +compareFormat :: (String -> String) -> String -> TimeZone -> UTCTime -> Result compareFormat modUnix fmt zone time = let ctime = utcToZonedTime zone time haskellText = formatTime locale fmt ctime - in do - unixText <- unixFormatTime fmt zone time - let expectedText = unixWorkarounds fmt (modUnix unixText) - assertEqual "" expectedText haskellText + unixText = unixFormatTime fmt zone time + expectedText = unixWorkarounds fmt (modUnix unixText) + in assertEqualQC "" expectedText haskellText -- as found in http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html -- plus FgGklz @@ -103,24 +86,33 @@ chars :: [Char] chars = "aAbBcCdDeFgGhHIjklmMnprRStTuUVwWxXyYzZ%" -- as found in "man strftime" on a glibc system. '#' is different, though -modifiers :: [Char] -modifiers = "_-0^" +modifiers :: [String] +modifiers = ["","_","-","0","^"] formats :: [String] -formats = ["%G-W%V-%u","%U-%w","%W-%u"] ++ (fmap (\char -> '%':char:[]) chars) - ++ (concat (fmap (\char -> fmap (\modifier -> '%':modifier:char:[]) modifiers) chars)) +formats = ["%G-W%V-%u","%U-%w","%W-%u"] + ++ (do + char <- chars + modifier <- modifiers + return $ "%" ++ modifier ++ [char] + ) hashformats :: [String] -hashformats = (fmap (\char -> '%':'#':char:[]) chars) - -testCompareFormat :: TestTree -testCompareFormat = testGroup "compare format" $ tgroup formats $ \fmt -> tgroup times $ \time -> tgroup zones $ \zone -> compareFormat id fmt zone time - -testCompareHashFormat :: TestTree -testCompareHashFormat = testGroup "compare hashformat" $ tgroup hashformats $ \fmt -> tgroup times $ \time -> tgroup zones $ \zone -> compareFormat (fmap toLower) fmt zone time +hashformats = do + char <- chars + return $ "%#"++[char] + +testCompareFormat :: [TestTree] +testCompareFormat = tgroup formats $ \fmt -> do + time <- times + zone <- zones + return $ compareFormat id fmt zone time + +testCompareHashFormat :: [TestTree] +testCompareHashFormat = tgroup hashformats $ \fmt -> do + time <- times + zone <- zones + return $ compareFormat (fmap toLower) fmt zone time testFormat :: TestTree -testFormat = testGroup "testFormat" $ [ - testCompareFormat, - testCompareHashFormat - ] +testFormat = testGroup "testFormat" $ testCompareFormat ++ testCompareHashFormat diff --git a/test/unix/Test/TestUtil.hs b/test/unix/Test/TestUtil.hs index c306893..4a3b42d 100644 --- a/test/unix/Test/TestUtil.hs +++ b/test/unix/Test/TestUtil.hs @@ -4,7 +4,7 @@ module Test.TestUtil where import Test.QuickCheck.Property import Test.Tasty import Test.Tasty.HUnit -import Test.Tasty.QuickCheck +import Test.Tasty.QuickCheck hiding (reason) assertFailure' :: String -> IO a assertFailure' s = do @@ -33,5 +33,13 @@ instance NameTest Result where instance (Arbitrary a,Show a,Testable b) => NameTest (a -> b) where nameTest name = nameTest name . property +instance (Testable a) => NameTest (Gen a) where + nameTest name = nameTest name . property + tgroup :: (Show a,NameTest t) => [a] -> (a -> t) -> [TestTree] tgroup aa f = fmap (\a -> nameTest (show a) $ f a) aa + +assertEqualQC :: (Show a,Eq a) => String -> a -> a -> Result +assertEqualQC _name expected found | expected == found = succeeded +assertEqualQC "" expected found = failed{reason="expected "++show expected++", found "++show found} +assertEqualQC name expected found = failed{reason=name++": expected "++show expected++", found "++show found} From git at git.haskell.org Mon Feb 20 21:20:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:20:45 +0000 (UTC) Subject: [commit: packages/time] format-widths: Merge branch 'master' into format-widths (c763435) Message-ID: <20170220212045.780E23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branch : format-widths Link : http://git.haskell.org/packages/time.git/commitdiff/c763435ea5abfc253b24745f1afcdeeee3c03d94 >--------------------------------------------------------------- commit c763435ea5abfc253b24745f1afcdeeee3c03d94 Merge: bd85cb0 dd86365 Author: Ashley Yakeley Date: Sun Feb 5 23:24:00 2017 -0800 Merge branch 'master' into format-widths >--------------------------------------------------------------- c763435ea5abfc253b24745f1afcdeeee3c03d94 test/unix/Test/Format/Format.hs | 97 +++++++++++++++++++---------------------- test/unix/Test/TestUtil.hs | 10 ++++- 2 files changed, 54 insertions(+), 53 deletions(-) diff --cc test/unix/Test/Format/Format.hs index 1512c77,420a70a..77ae8e4 --- a/test/unix/Test/Format/Format.hs +++ b/test/unix/Test/Format/Format.hs @@@ -103,27 -86,33 +86,37 @@@ chars :: [Char chars = "aAbBcCdDeFgGhHIjklmMnprRStTuUVwWxXyYzZ%" -- as found in "man strftime" on a glibc system. '#' is different, though - modifiers :: [Char] - modifiers = "_-0^" + modifiers :: [String] + modifiers = ["","_","-","0","^"] +widths :: [String] +widths = ["","1","2","9","12"] + formats :: [String] - formats = ["%G-W%V-%u","%U-%w","%W-%u"] ++ (fmap (\char -> '%':[char]) chars) - ++ (concat $ fmap (\char -> concat $ fmap (\width -> fmap (\modifier -> "%" ++ [modifier] ++ width ++ [char]) modifiers) widths) chars) + formats = ["%G-W%V-%u","%U-%w","%W-%u"] + ++ (do + char <- chars ++ width <- widths + modifier <- modifiers - return $ "%" ++ modifier ++ [char] ++ return $ "%" ++ modifier ++ width ++ [char] + ) hashformats :: [String] - hashformats = (fmap (\char -> '%':'#':char:[]) chars) - - testCompareFormat :: TestTree - testCompareFormat = testGroup "compare format" $ tgroup formats $ \fmt -> tgroup times $ \time -> tgroup zones $ \zone -> compareFormat id fmt zone time - - testCompareHashFormat :: TestTree - testCompareHashFormat = testGroup "compare hashformat" $ tgroup hashformats $ \fmt -> tgroup times $ \time -> tgroup zones $ \zone -> compareFormat (fmap toLower) fmt zone time + hashformats = do + char <- chars + return $ "%#"++[char] + + testCompareFormat :: [TestTree] + testCompareFormat = tgroup formats $ \fmt -> do + time <- times + zone <- zones + return $ compareFormat id fmt zone time + + testCompareHashFormat :: [TestTree] + testCompareHashFormat = tgroup hashformats $ \fmt -> do + time <- times + zone <- zones + return $ compareFormat (fmap toLower) fmt zone time testFormat :: TestTree - testFormat = testGroup "testFormat" $ [ - testCompareFormat, - testCompareHashFormat - ] + testFormat = testGroup "testFormat" $ testCompareFormat ++ testCompareHashFormat From git at git.haskell.org Mon Feb 20 21:20:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:20:47 +0000 (UTC) Subject: [commit: packages/time] format-widths: test: formatting widths: fix most tests (789a32c) Message-ID: <20170220212047.80D303A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branch : format-widths Link : http://git.haskell.org/packages/time.git/commitdiff/789a32c20670e40182f39ef9ca89e255afe68b69 >--------------------------------------------------------------- commit 789a32c20670e40182f39ef9ca89e255afe68b69 Author: Ashley Yakeley Date: Tue Feb 7 19:26:05 2017 -0800 test: formatting widths: fix most tests >--------------------------------------------------------------- 789a32c20670e40182f39ef9ca89e255afe68b69 lib/Data/Time/Calendar/Gregorian.hs | 2 +- lib/Data/Time/Calendar/Julian.hs | 2 +- lib/Data/Time/Calendar/JulianYearDay.hs | 2 +- lib/Data/Time/Calendar/OrdinalDate.hs | 2 +- lib/Data/Time/Calendar/Private.hs | 42 ++++--- lib/Data/Time/Calendar/WeekDate.hs | 2 +- lib/Data/Time/Format.hs | 161 +++++++++++++++----------- lib/Data/Time/LocalTime/Internal/TimeOfDay.hs | 2 +- lib/Data/Time/LocalTime/Internal/TimeZone.hs | 8 +- test/unix/Test/Format/Format.hs | 5 +- 10 files changed, 130 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 789a32c20670e40182f39ef9ca89e255afe68b69 From git at git.haskell.org Mon Feb 20 21:20:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:20:49 +0000 (UTC) Subject: [commit: packages/time] format-widths: document formatting padding widths change (80ee35c) Message-ID: <20170220212049.8783B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branch : format-widths Link : http://git.haskell.org/packages/time.git/commitdiff/80ee35cc0b49c78c8209b6f9aaa276c4255185ca >--------------------------------------------------------------- commit 80ee35cc0b49c78c8209b6f9aaa276c4255185ca Author: Ashley Yakeley Date: Tue Feb 7 19:31:39 2017 -0800 document formatting padding widths change >--------------------------------------------------------------- 80ee35cc0b49c78c8209b6f9aaa276c4255185ca changelog.md | 1 + lib/Data/Time/Format.hs | 7 ++++++- lib/Data/Time/Format/Parse.hs | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 72f2ae6..3e03aca 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,7 @@ ## [1.8] - Added SystemTime +- Data.Time.Format: allow padding widths in specifiers for formatting (but not parsing) ## [1.7.0.1] - Fix bounds issue in .cabal file diff --git a/lib/Data/Time/Format.hs b/lib/Data/Time/Format.hs index 2a4815b..1538d34 100644 --- a/lib/Data/Time/Format.hs +++ b/lib/Data/Time/Format.hs @@ -54,7 +54,6 @@ padString ff = padGeneral False 1 ' ' $ \locale pado -> showPadded pado . ff loc padNum :: (Show i,Ord i,Num i) => Bool -> Int -> Char -> (t -> i) -> (TimeLocale -> Maybe NumericPadOption -> Maybe Int -> t -> String) padNum fdef idef cdef ff = padGeneral fdef idef cdef $ \_ pado -> showPaddedNum pado . ff - -- class FormatTime t where formatCharacter :: Char -> Maybe (TimeLocale -> Maybe NumericPadOption -> Maybe Int -> t -> String) @@ -89,6 +88,12 @@ formatChar c = case formatCharacter c of -- -- [@%#z@] convert to lower case (consistently, unlike glibc) -- +-- Width digits can also be used after any modifiers and before the letter (here marked as @z@), for example: +-- +-- [@%4z@] pad to 4 characters (with default padding character) +-- +-- [@%_12z@] pad with spaces to 12 characters +-- -- For 'TimeZone' (and 'ZonedTime' and 'UTCTime'): -- -- [@%z@] timezone offset in the format @-HHMM at . diff --git a/lib/Data/Time/Format/Parse.hs b/lib/Data/Time/Format/Parse.hs index 7715697..29f112e 100644 --- a/lib/Data/Time/Format/Parse.hs +++ b/lib/Data/Time/Format/Parse.hs @@ -76,7 +76,7 @@ class ParseTime t where #if LANGUAGE_Rank2Types -- | Parses a time value given a format string. --- Supports the same %-codes as 'formatTime', including @%-@, @%_@ and @%0@ modifiers. +-- Supports the same %-codes as 'formatTime', including @%-@, @%_@ and @%0@ modifiers, however padding widths are not supported. -- Case is not significant. -- Some variations in the input are accepted: -- From git at git.haskell.org Mon Feb 20 21:20:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:20:51 +0000 (UTC) Subject: [commit: packages/time] format-widths: mention test changes in changelog.md (d7ed24e) Message-ID: <20170220212051.8F8A43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branch : format-widths Link : http://git.haskell.org/packages/time.git/commitdiff/d7ed24e33fedcfeb9930b2d6eef8f2b5100965a5 >--------------------------------------------------------------- commit d7ed24e33fedcfeb9930b2d6eef8f2b5100965a5 Author: Ashley Yakeley Date: Tue Feb 7 19:32:40 2017 -0800 mention test changes in changelog.md >--------------------------------------------------------------- d7ed24e33fedcfeb9930b2d6eef8f2b5100965a5 changelog.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/changelog.md b/changelog.md index 72f2ae6..d4f6b2e 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,8 @@ ## [1.8] - Added SystemTime +- Test: use tasty, general clean-up +- Test: separate out UNIX-specific tests, so the others can be run on Windows ## [1.7.0.1] - Fix bounds issue in .cabal file From git at git.haskell.org Mon Feb 20 21:20:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:20:53 +0000 (UTC) Subject: [commit: packages/time] format-widths: Merge branch 'master' into format-widths (7767c80) Message-ID: <20170220212053.962303A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branch : format-widths Link : http://git.haskell.org/packages/time.git/commitdiff/7767c804ee38fcc6645c2b5c4445e7377876606d >--------------------------------------------------------------- commit 7767c804ee38fcc6645c2b5c4445e7377876606d Merge: 80ee35c d7ed24e Author: Ashley Yakeley Date: Tue Feb 7 19:33:24 2017 -0800 Merge branch 'master' into format-widths >--------------------------------------------------------------- 7767c804ee38fcc6645c2b5c4445e7377876606d changelog.md | 2 ++ 1 file changed, 2 insertions(+) diff --cc changelog.md index 3e03aca,d4f6b2e..e8ac39f --- a/changelog.md +++ b/changelog.md @@@ -2,7 -2,8 +2,9 @@@ ## [1.8] - Added SystemTime +- Data.Time.Format: allow padding widths in specifiers for formatting (but not parsing) + - Test: use tasty, general clean-up + - Test: separate out UNIX-specific tests, so the others can be run on Windows ## [1.7.0.1] - Fix bounds issue in .cabal file From git at git.haskell.org Mon Feb 20 21:20:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:20:55 +0000 (UTC) Subject: [commit: packages/time] format-widths: test: fix formatting "z" with widths tests (19f02fa) Message-ID: <20170220212055.9D1DB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branch : format-widths Link : http://git.haskell.org/packages/time.git/commitdiff/19f02fa1b580d0e2ec7af59ca28afd6a678804a1 >--------------------------------------------------------------- commit 19f02fa1b580d0e2ec7af59ca28afd6a678804a1 Author: Ashley Yakeley Date: Tue Feb 7 19:48:40 2017 -0800 test: fix formatting "z" with widths tests >--------------------------------------------------------------- 19f02fa1b580d0e2ec7af59ca28afd6a678804a1 test/unix/Test/Format/Format.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/unix/Test/Format/Format.hs b/test/unix/Test/Format/Format.hs index 1ad674b..35be9b1 100644 --- a/test/unix/Test/Format/Format.hs +++ b/test/unix/Test/Format/Format.hs @@ -69,6 +69,10 @@ unixWorkarounds "%_G" s = padN 4 ' ' s unixWorkarounds "%0G" s = padN 4 '0' s unixWorkarounds "%_f" s = padN 2 ' ' s unixWorkarounds "%0f" s = padN 2 '0' s +unixWorkarounds fmt s | elem 'z' fmt = dropWhile isPadChar s where + isPadChar ' ' = True + isPadChar '0' = True + isPadChar _ = False unixWorkarounds _ s = s compareFormat :: (String -> String) -> String -> TimeZone -> UTCTime -> Result From git at git.haskell.org Mon Feb 20 21:20:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:20:57 +0000 (UTC) Subject: [commit: packages/time] format-widths: format widths: fix %q and %Q specifiers, with tests (85904c5) Message-ID: <20170220212057.A59F73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branch : format-widths Link : http://git.haskell.org/packages/time.git/commitdiff/85904c55ecce05534fc5b5341fca0611350e3591 >--------------------------------------------------------------- commit 85904c55ecce05534fc5b5341fca0611350e3591 Author: Ashley Yakeley Date: Tue Feb 7 22:28:33 2017 -0800 format widths: fix %q and %Q specifiers, with tests >--------------------------------------------------------------- 85904c55ecce05534fc5b5341fca0611350e3591 lib/Data/Time/Calendar/Private.hs | 4 --- lib/Data/Time/Format.hs | 37 +++++++++++++---------- test/unix/Test/Format/Format.hs | 63 ++++++++++++++++++++++++++++++++++++++- 3 files changed, 84 insertions(+), 20 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 85904c55ecce05534fc5b5341fca0611350e3591 From git at git.haskell.org Mon Feb 20 21:20:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:20:59 +0000 (UTC) Subject: [commit: packages/time] : stack: lts-8.0 (28a2fe8) Message-ID: <20170220212059.ABE2A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branch : Link : http://git.haskell.org/packages/time.git/commitdiff/28a2fe8c361825dfa0b9b84a21e5667c53073a6f >--------------------------------------------------------------- commit 28a2fe8c361825dfa0b9b84a21e5667c53073a6f Author: Ashley Yakeley Date: Mon Feb 13 16:31:05 2017 -0800 stack: lts-8.0 >--------------------------------------------------------------- 28a2fe8c361825dfa0b9b84a21e5667c53073a6f benchmark/stack.yaml | 2 +- stack.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/benchmark/stack.yaml b/benchmark/stack.yaml index 460c544..8bd2b5d 100644 --- a/benchmark/stack.yaml +++ b/benchmark/stack.yaml @@ -1,3 +1,3 @@ -resolver: lts-6.26 +resolver: lts-8.0 packages: - '.' diff --git a/stack.yaml b/stack.yaml index e93eb5a..01d8752 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,4 +1,4 @@ -resolver: lts-6.26 +resolver: lts-8.0 packages: - '.' allow-newer: true From git at git.haskell.org Mon Feb 20 21:21:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:21:01 +0000 (UTC) Subject: [commit: packages/time] : Update haddock (f408d96) Message-ID: <20170220212101.B6E8D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branch : Link : http://git.haskell.org/packages/time.git/commitdiff/f408d961924b450f4f91b44790bf836d169c2009 >--------------------------------------------------------------- commit f408d961924b450f4f91b44790bf836d169c2009 Author: Ashley Yakeley Date: Mon Feb 13 18:13:48 2017 -0800 Update haddock >--------------------------------------------------------------- f408d961924b450f4f91b44790bf836d169c2009 lib/Data/Time/Calendar/Gregorian.hs | 8 +++--- lib/Data/Time/Calendar/Julian.hs | 8 +++--- lib/Data/Time/Calendar/JulianYearDay.hs | 8 +++--- lib/Data/Time/Calendar/MonthDay.hs | 16 +++++------ lib/Data/Time/Calendar/OrdinalDate.hs | 38 +++++++++++++-------------- lib/Data/Time/Calendar/WeekDate.hs | 8 +++--- lib/Data/Time/Clock/Internal/SystemTime.hs | 3 ++- lib/Data/Time/Clock/Internal/UTCTime.hs | 2 +- lib/Data/Time/Clock/System.hs | 1 + lib/Data/Time/Format.hs | 29 +++++++++++++------- lib/Data/Time/Format/Parse.hs | 2 +- lib/Data/Time/LocalTime/Internal/LocalTime.hs | 8 +++--- lib/Data/Time/LocalTime/Internal/TimeOfDay.hs | 14 +++++----- lib/Data/Time/LocalTime/Internal/TimeZone.hs | 16 +++++------ lib/Data/Time/LocalTime/Internal/ZonedTime.hs | 2 +- 15 files changed, 88 insertions(+), 75 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 f408d961924b450f4f91b44790bf836d169c2009 From git at git.haskell.org Mon Feb 20 21:21:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:21:03 +0000 (UTC) Subject: [commit: packages/time] : fix type of exposed function timeZoneOffsetString' (94777bd) Message-ID: <20170220212103.BF0F93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branch : Link : http://git.haskell.org/packages/time.git/commitdiff/94777bd038b6a5a03e379c9540406a58dd87bb39 >--------------------------------------------------------------- commit 94777bd038b6a5a03e379c9540406a58dd87bb39 Author: Ashley Yakeley Date: Mon Feb 13 19:29:30 2017 -0800 fix type of exposed function timeZoneOffsetString' >--------------------------------------------------------------- 94777bd038b6a5a03e379c9540406a58dd87bb39 lib/Data/Time/Format.hs | 4 ++-- lib/Data/Time/LocalTime.hs | 9 +++++++-- lib/Data/Time/LocalTime/Internal/TimeZone.hs | 14 +++++++++----- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/lib/Data/Time/Format.hs b/lib/Data/Time/Format.hs index 4869e67..7cea584 100644 --- a/lib/Data/Time/Format.hs +++ b/lib/Data/Time/Format.hs @@ -290,10 +290,10 @@ instance FormatTime ZonedTime where Nothing -> Nothing instance FormatTime TimeZone where - formatCharacter 'z' = Just $ padGeneral False True 4 '0' $ \_ pado -> showPadded pado . timeZoneOffsetString' pado + formatCharacter 'z' = Just $ padGeneral False True 4 '0' $ \_ pado -> showPadded pado . timeZoneOffsetString'' pado formatCharacter 'Z' = Just $ \locale mnpo mi z -> let n = timeZoneName z - in if null n then timeZoneOffsetString' (getPadOption False True 4 '0' mnpo mi) z else padString (\_ -> timeZoneName) locale mnpo mi z + in if null n then timeZoneOffsetString'' (getPadOption False True 4 '0' mnpo mi) z else padString (\_ -> timeZoneName) locale mnpo mi z formatCharacter _ = Nothing instance FormatTime Day where diff --git a/lib/Data/Time/LocalTime.hs b/lib/Data/Time/LocalTime.hs index d450d85..296fce9 100644 --- a/lib/Data/Time/LocalTime.hs +++ b/lib/Data/Time/LocalTime.hs @@ -1,13 +1,18 @@ module Data.Time.LocalTime ( - module Data.Time.LocalTime.Internal.TimeZone, + -- * Time zones + TimeZone(..),timeZoneOffsetString,timeZoneOffsetString',minutesToTimeZone,hoursToTimeZone,utc, + + -- getting the locale time zone + getTimeZone,getCurrentTimeZone, + module Data.Time.LocalTime.Internal.TimeOfDay, module Data.Time.LocalTime.Internal.LocalTime, module Data.Time.LocalTime.Internal.ZonedTime, ) where import Data.Time.Format() -import Data.Time.LocalTime.Internal.TimeZone +import Data.Time.LocalTime.Internal.TimeZone hiding (timeZoneOffsetString'') import Data.Time.LocalTime.Internal.TimeOfDay import Data.Time.LocalTime.Internal.LocalTime import Data.Time.LocalTime.Internal.ZonedTime diff --git a/lib/Data/Time/LocalTime/Internal/TimeZone.hs b/lib/Data/Time/LocalTime/Internal/TimeZone.hs index 40d6092..fe434b7 100644 --- a/lib/Data/Time/LocalTime/Internal/TimeZone.hs +++ b/lib/Data/Time/LocalTime/Internal/TimeZone.hs @@ -6,7 +6,7 @@ module Data.Time.LocalTime.Internal.TimeZone ( -- * Time zones - TimeZone(..),timeZoneOffsetString,timeZoneOffsetString',minutesToTimeZone,hoursToTimeZone,utc, + TimeZone(..),timeZoneOffsetString,timeZoneOffsetString',timeZoneOffsetString'',minutesToTimeZone,hoursToTimeZone,utc, -- getting the locale time zone getTimeZone,getCurrentTimeZone @@ -60,14 +60,18 @@ hoursToTimeZone i = minutesToTimeZone (60 * i) showT :: PadOption -> Int -> String showT opt t = showPaddedNum opt ((div t 60) * 100 + (mod t 60)) +timeZoneOffsetString'' :: PadOption -> TimeZone -> String +timeZoneOffsetString'' opt (TimeZone t _ _) | t < 0 = '-':(showT opt (negate t)) +timeZoneOffsetString'' opt (TimeZone t _ _) = '+':(showT opt t) + -- | Text representing the offset of this timezone, such as \"-0800\" or \"+0400\" (like @%z@ in formatTime), with arbitrary padding. -timeZoneOffsetString' :: PadOption -> TimeZone -> String -timeZoneOffsetString' opt (TimeZone t _ _) | t < 0 = '-':(showT opt (negate t)) -timeZoneOffsetString' opt (TimeZone t _ _) = '+':(showT opt t) +timeZoneOffsetString' :: Maybe Char -> TimeZone -> String +timeZoneOffsetString' Nothing = timeZoneOffsetString'' NoPad +timeZoneOffsetString' (Just c) = timeZoneOffsetString'' $ Pad 4 c -- | Text representing the offset of this timezone, such as \"-0800\" or \"+0400\" (like @%z@ in formatTime). timeZoneOffsetString :: TimeZone -> String -timeZoneOffsetString = timeZoneOffsetString' (Pad 4 '0') +timeZoneOffsetString = timeZoneOffsetString'' (Pad 4 '0') instance Show TimeZone where show zone@(TimeZone _ _ "") = timeZoneOffsetString zone From git at git.haskell.org Mon Feb 20 21:21:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:21:05 +0000 (UTC) Subject: [commit: packages/time] : Update changelog.md (9e92f65) Message-ID: <20170220212105.C65D43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branch : Link : http://git.haskell.org/packages/time.git/commitdiff/9e92f65491ccf0a78fd1e143db4b05ac5112d345 >--------------------------------------------------------------- commit 9e92f65491ccf0a78fd1e143db4b05ac5112d345 Author: Ashley Yakeley Date: Mon Feb 13 19:32:12 2017 -0800 Update changelog.md >--------------------------------------------------------------- 9e92f65491ccf0a78fd1e143db4b05ac5112d345 changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.md b/changelog.md index e8ac39f..87b9659 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,7 @@ - Data.Time.Format: allow padding widths in specifiers for formatting (but not parsing) - Test: use tasty, general clean-up - Test: separate out UNIX-specific tests, so the others can be run on Windows +- Clean up haddock. ## [1.7.0.1] - Fix bounds issue in .cabal file From git at git.haskell.org Mon Feb 20 21:21:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 20 Feb 2017 21:21:07 +0000 (UTC) Subject: [commit: packages/time] : Add pre-release checklist (098d907) Message-ID: <20170220212107.CF1753A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branch : Link : http://git.haskell.org/packages/time.git/commitdiff/098d90703e4049990fe6c1c72164fae7359d56af >--------------------------------------------------------------- commit 098d90703e4049990fe6c1c72164fae7359d56af Author: Ashley Yakeley Date: Mon Feb 13 19:32:29 2017 -0800 Add pre-release checklist >--------------------------------------------------------------- 098d90703e4049990fe6c1c72164fae7359d56af Checklist | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/Checklist b/Checklist new file mode 100644 index 0000000..876b2cc --- /dev/null +++ b/Checklist @@ -0,0 +1,61 @@ +Before release: + +1. Check appropriate issues are fixed + + https://github.com/haskell/time/pulls + https://github.com/haskell/time/issues + +2. Update version numbers + + https://pvp.haskell.org/ + time.cabal + configure.ac + +3. Update changelog + + changelog.md + +4. Use latest LTS resolver + + https://www.stackage.org/lts + time.cabal + (not necessarily benchmark/time-bench.cabal) + +5. Build & test + + stack build --pedantic --test --haddock && echo OK + +6. Build benchmark + + cd benchmark + stack build --pedantic + (ignore missing modules warning) + stack exec -- time-bench + +7. Read through generated haddock + + .stack-work/install/[PLATFORM]/[RESOLVER]/[COMPILER]/doc/index.html + +8. Commit and push changes to repo + + git commit -a + git push + +9. Check Travis build + + https://travis-ci.org/haskell/time + +10. Build and test on Windows + + git pull + stack build --pedantic --test --haddock && echo OK + +11. Upload to Hackage + + stack upload . + http://hackage.haskell.org/package/time + +12. Tag commit + + git tag -a -s [TAG] + git push --tags From git at git.haskell.org Tue Feb 21 00:19:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Feb 2017 00:19:59 +0000 (UTC) Subject: [commit: ghc] master: Bump Win32 submodule to 2.5.1.0 (240b43e) Message-ID: <20170221001959.458543A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/240b43e4969595418bb3c0d1519111be59572672/ghc >--------------------------------------------------------------- commit 240b43e4969595418bb3c0d1519111be59572672 Author: Ben Gamari Date: Mon Feb 20 15:59:35 2017 -0500 Bump Win32 submodule to 2.5.1.0 >--------------------------------------------------------------- 240b43e4969595418bb3c0d1519111be59572672 libraries/Win32 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/Win32 b/libraries/Win32 index 716c9a3..a410b4e 160000 --- a/libraries/Win32 +++ b/libraries/Win32 @@ -1 +1 @@ -Subproject commit 716c9a3e97611aea3a0a907ba80fe9c11e1afc7f +Subproject commit a410b4e8276d118273d3205dc58fdc632803a71a From git at git.haskell.org Tue Feb 21 00:20:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Feb 2017 00:20:01 +0000 (UTC) Subject: [commit: ghc] master: build.mk: Add option for debug symbols (b7265ff) Message-ID: <20170221002001.F012C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b7265ffa06d5481f598aeba93c1a432204408ec2/ghc >--------------------------------------------------------------- commit b7265ffa06d5481f598aeba93c1a432204408ec2 Author: Ben Gamari Date: Mon Feb 20 19:08:59 2017 -0500 build.mk: Add option for debug symbols >--------------------------------------------------------------- b7265ffa06d5481f598aeba93c1a432204408ec2 mk/build.mk.sample | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mk/build.mk.sample b/mk/build.mk.sample index 4175dc7..6bceca3 100644 --- a/mk/build.mk.sample +++ b/mk/build.mk.sample @@ -79,6 +79,13 @@ endif # working on stage 2 and want to freeze stage 1 and the libraries for # a while. +# Enable these if you would like DWARF debugging symbols for your libraries. +# This is necessary, for instance, to get DWARF stack traces out of programs +# built by the produced compiler. You must also pass --enable-dwarf-unwind to +# `configure` to enable the runtime system's builtin unwinding support. +#GhcLibHcOpts += -g3 +#GhcRtsHcOpts += -g3 + # Build the "extra" packages (see ./packages). This enables more tests. See: # https://ghc.haskell.org/trac/ghc/wiki/Building/RunningTests/Running#AdditionalPackages #BUILD_EXTRA_PKGS=YES From git at git.haskell.org Tue Feb 21 00:20:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Feb 2017 00:20:04 +0000 (UTC) Subject: [commit: ghc] master: Bump time submodule to 1.8 (7153370) Message-ID: <20170221002004.A6EF33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7153370288e6075c4f8c996ff02227e48805da06/ghc >--------------------------------------------------------------- commit 7153370288e6075c4f8c996ff02227e48805da06 Author: Ben Gamari Date: Mon Feb 20 16:01:04 2017 -0500 Bump time submodule to 1.8 This unfortunately had quite a number of knock-on effects, including a need for new releases of directory and unix. >--------------------------------------------------------------- 7153370288e6075c4f8c996ff02227e48805da06 compiler/ghc.cabal.in | 2 +- ghc/ghc-bin.cabal.in | 2 +- libraries/Cabal | 2 +- libraries/directory | 2 +- libraries/hpc | 2 +- libraries/time | 2 +- libraries/unix | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in index f3d6711..b8b7106 100644 --- a/compiler/ghc.cabal.in +++ b/compiler/ghc.cabal.in @@ -55,7 +55,7 @@ Library process >= 1 && < 1.5, bytestring >= 0.9 && < 0.11, binary == 0.8.*, - time >= 1.4 && < 1.8, + time >= 1.4 && < 1.9, containers >= 0.5 && < 0.6, array >= 0.1 && < 0.6, filepath >= 1 && < 1.5, diff --git a/ghc/ghc-bin.cabal.in b/ghc/ghc-bin.cabal.in index 9c9ca0e..0f50453 100644 --- a/ghc/ghc-bin.cabal.in +++ b/ghc/ghc-bin.cabal.in @@ -52,7 +52,7 @@ Executable ghc deepseq == 1.4.*, ghci == @ProjectVersionMunged@, haskeline == 0.7.*, - time == 1.7.*, + time == 1.8.*, transformers == 0.5.* CPP-Options: -DGHCI GHC-Options: -fno-warn-name-shadowing diff --git a/libraries/Cabal b/libraries/Cabal index e8aa542..19c278f 160000 --- a/libraries/Cabal +++ b/libraries/Cabal @@ -1 +1 @@ -Subproject commit e8aa54220a4bbe3fe6d14542f3a94222228efb2f +Subproject commit 19c278feb732f5797256ff28eb671440f5511c6c diff --git a/libraries/directory b/libraries/directory index 4a4a19d..af307f5 160000 --- a/libraries/directory +++ b/libraries/directory @@ -1 +1 @@ -Subproject commit 4a4a19d1c46c70ffd9a3e1c4c283e2e16214258f +Subproject commit af307f52ca94ed232d1372fc6760a4b3efa243c7 diff --git a/libraries/hpc b/libraries/hpc index 9267329..c23cad3 160000 --- a/libraries/hpc +++ b/libraries/hpc @@ -1 +1 @@ -Subproject commit 92673292ab7ce7878e982d0a02df3e548ef15b52 +Subproject commit c23cad32f408559ba95b880c04dc1a2c60ec3d01 diff --git a/libraries/time b/libraries/time index b6098be..6e202ed 160000 --- a/libraries/time +++ b/libraries/time @@ -1 +1 @@ -Subproject commit b6098be8a4facfa854c633f2a3a82ab8e72962ef +Subproject commit 6e202edc1b0e32c25bc13194e6496c2c18198463 diff --git a/libraries/unix b/libraries/unix index d0b0e8c..821cb07 160000 --- a/libraries/unix +++ b/libraries/unix @@ -1 +1 @@ -Subproject commit d0b0e8cf5a7fa5b9dc500d2f623258200818cb16 +Subproject commit 821cb07ecf235625b4bb06626d30e4b15f28df30 From git at git.haskell.org Tue Feb 21 02:49:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Feb 2017 02:49:28 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Move Typeable Binary instances to binary package (80c2f75) Message-ID: <20170221024928.AEED73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/80c2f754d2f49a0a7afb70b7abd0676a7986bf72/ghc >--------------------------------------------------------------- commit 80c2f754d2f49a0a7afb70b7abd0676a7986bf72 Author: Ben Gamari Date: Wed Feb 8 23:00:46 2017 -0500 Move Typeable Binary instances to binary package >--------------------------------------------------------------- 80c2f754d2f49a0a7afb70b7abd0676a7986bf72 libraries/binary | 2 +- libraries/ghci/GHCi/TH/Binary.hs | 176 --------------------------------------- 2 files changed, 1 insertion(+), 177 deletions(-) diff --git a/libraries/binary b/libraries/binary index af1d17c..abda726 160000 --- a/libraries/binary +++ b/libraries/binary @@ -1 +1 @@ -Subproject commit af1d17c27867f644886fcbc4703eb3e48792f3e7 +Subproject commit abda726cceef5d5533feffcc79e9fe1cdfb4e2cc diff --git a/libraries/ghci/GHCi/TH/Binary.hs b/libraries/ghci/GHCi/TH/Binary.hs index fcff168..439a43d 100644 --- a/libraries/ghci/GHCi/TH/Binary.hs +++ b/libraries/ghci/GHCi/TH/Binary.hs @@ -10,14 +10,6 @@ module GHCi.TH.Binary () where import Data.Binary import qualified Data.ByteString as B -#if MIN_VERSION_base(4,10,0) -import Type.Reflection -import Type.Reflection.Unsafe -import Data.Kind (Type) -import GHC.Exts (RuntimeRep(..), VecCount, VecElem) -#else -import Data.Typeable -#endif import GHC.Serialized import qualified Language.Haskell.TH as TH import qualified Language.Haskell.TH.Syntax as TH @@ -79,174 +71,6 @@ instance Binary TH.PatSynArgs -- We need Binary TypeRep for serializing annotations -#if MIN_VERSION_base(4,10,0) -instance Binary VecCount where - put = putWord8 . fromIntegral . fromEnum - get = toEnum . fromIntegral <$> getWord8 - -instance Binary VecElem where - put = putWord8 . fromIntegral . fromEnum - get = toEnum . fromIntegral <$> getWord8 - -instance Binary RuntimeRep where - put (VecRep a b) = putWord8 0 >> put a >> put b - put (TupleRep reps) = putWord8 1 >> put reps - put (SumRep reps) = putWord8 2 >> put reps - put LiftedRep = putWord8 3 - put UnliftedRep = putWord8 4 - put IntRep = putWord8 5 - put WordRep = putWord8 6 - put Int64Rep = putWord8 7 - put Word64Rep = putWord8 8 - put AddrRep = putWord8 9 - put FloatRep = putWord8 10 - put DoubleRep = putWord8 11 - - get = do - tag <- getWord8 - case tag of - 0 -> VecRep <$> get <*> get - 1 -> TupleRep <$> get - 2 -> SumRep <$> get - 3 -> pure LiftedRep - 4 -> pure UnliftedRep - 5 -> pure IntRep - 6 -> pure WordRep - 7 -> pure Int64Rep - 8 -> pure Word64Rep - 9 -> pure AddrRep - 10 -> pure FloatRep - 11 -> pure DoubleRep - _ -> fail "GHCi.TH.Binary.putRuntimeRep: invalid tag" - -instance Binary TyCon where - put tc = do - put (tyConPackage tc) - put (tyConModule tc) - put (tyConName tc) - put (tyConKindArgs tc) - put (tyConKindRep tc) - get = mkTyCon <$> get <*> get <*> get <*> get <*> get - -instance Binary KindRep where - put (KindRepTyConApp tc k) = putWord8 0 >> put tc >> put k - put (KindRepVar bndr) = putWord8 1 >> put bndr - put (KindRepApp a b) = putWord8 2 >> put a >> put b - put (KindRepFun a b) = putWord8 3 >> put a >> put b - put (KindRepTYPE r) = putWord8 4 >> put r - put (KindRepTypeLit sort r) = putWord8 5 >> put sort >> put r - put _ = fail "GHCi.TH.Binary.putKindRep: Impossible" - - get = do - tag <- getWord8 - case tag of - 0 -> KindRepTyConApp <$> get <*> get - 1 -> KindRepVar <$> get - 2 -> KindRepApp <$> get <*> get - 3 -> KindRepFun <$> get <*> get - 4 -> KindRepTYPE <$> get - 5 -> KindRepTypeLit <$> get <*> get - _ -> fail "GHCi.TH.Binary.putKindRep: invalid tag" - -instance Binary TypeLitSort where - put TypeLitSymbol = putWord8 0 - put TypeLitNat = putWord8 1 - get = do - tag <- getWord8 - case tag of - 0 -> pure TypeLitSymbol - 1 -> pure TypeLitNat - _ -> fail "GHCi.TH.Binary.putTypeLitSort: invalid tag" - -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 -- Handle Type specially since it's so common - | Just HRefl <- rep `eqTypeRep` (typeRep :: TypeRep Type) - = put (0 :: Word8) -putTypeRep (Con' con ks) = do - put (1 :: Word8) - put con - put ks -putTypeRep (App f x) = do - put (2 :: Word8) - putTypeRep f - putTypeRep x -putTypeRep (Fun arg res) = do - put (3 :: Word8) - putTypeRep arg - putTypeRep res -putTypeRep _ = fail "GHCi.TH.Binary.putTypeRep: Impossible" - -getSomeTypeRep :: Get SomeTypeRep -getSomeTypeRep = do - tag <- get :: Get Word8 - case tag of - 0 -> return $ SomeTypeRep (typeRep :: TypeRep Type) - 1 -> do con <- get :: Get TyCon - ks <- get :: Get [SomeTypeRep] - return $ SomeTypeRep $ mkTrCon con ks - 2 -> do SomeTypeRep f <- getSomeTypeRep - SomeTypeRep x <- getSomeTypeRep - case typeRepKind f of - Fun arg res -> - case arg `eqTypeRep` typeRepKind x of - Just HRefl -> do - case typeRepKind res `eqTypeRep` (typeRep :: TypeRep Type) of - Just HRefl -> return $ SomeTypeRep $ mkTrApp f x - _ -> failure "Kind mismatch" [] - _ -> failure "Kind mismatch" - [ "Found argument of kind: " ++ show (typeRepKind x) - , "Where the constructor: " ++ show f - , "Expects an argument of kind: " ++ show arg - ] - _ -> failure "Applied non-arrow type" - [ "Applied type: " ++ show f - , "To argument: " ++ show x - ] - 3 -> do SomeTypeRep arg <- getSomeTypeRep - SomeTypeRep res <- getSomeTypeRep - case typeRepKind arg `eqTypeRep` (typeRep :: TypeRep Type) of - Just HRefl -> - case typeRepKind res `eqTypeRep` (typeRep :: TypeRep Type) of - Just HRefl -> return $ SomeTypeRep $ Fun arg res - Nothing -> failure "Kind mismatch" [] - Nothing -> failure "Kind mismatch" [] - _ -> failure "Invalid SomeTypeRep" [] - where - failure description info = - fail $ unlines $ [ "GHCi.TH.Binary.getSomeTypeRep: "++description ] - ++ map (" "++) info - -instance Typeable a => Binary (TypeRep (a :: k)) where - put = putTypeRep - get = do - SomeTypeRep rep <- getSomeTypeRep - case rep `eqTypeRep` expected of - Just HRefl -> pure rep - Nothing -> fail $ unlines - [ "GHCi.TH.Binary: Type mismatch" - , " Deserialized type: " ++ show rep - , " Expected type: " ++ show expected - ] - where expected = typeRep :: TypeRep a - -instance Binary SomeTypeRep where - put (SomeTypeRep rep) = putTypeRep rep - get = getSomeTypeRep -#else -instance Binary TyCon where - put tc = put (tyConPackage tc) >> put (tyConModule tc) >> put (tyConName tc) - get = mkTyCon3 <$> get <*> get <*> get - -instance Binary TypeRep where - put type_rep = put (splitTyConApp type_rep) - get = do - (ty_con, child_type_reps) <- get - return (mkTyConApp ty_con child_type_reps) -#endif - instance Binary Serialized where put (Serialized tyrep wds) = put tyrep >> put (B.pack wds) get = Serialized <$> get <*> (B.unpack <$> get) From git at git.haskell.org Tue Feb 21 02:49:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Feb 2017 02:49:31 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: TcTypeable: Try to reuse KindReps (745dc89) Message-ID: <20170221024931.737333A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/745dc89c0ba403c5c64f0f41beaf93737d30d016/ghc >--------------------------------------------------------------- commit 745dc89c0ba403c5c64f0f41beaf93737d30d016 Author: Ben Gamari Date: Thu Feb 16 13:15:29 2017 -0500 TcTypeable: Try to reuse KindReps >--------------------------------------------------------------- 745dc89c0ba403c5c64f0f41beaf93737d30d016 compiler/coreSyn/TrieMap.hs | 28 ++++- compiler/typecheck/TcTypeable.hs | 257 ++++++++++++++++++++++++--------------- 2 files changed, 182 insertions(+), 103 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 745dc89c0ba403c5c64f0f41beaf93737d30d016 From git at git.haskell.org Tue Feb 21 02:49:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Feb 2017 02:49:33 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable's head updated: TcTypeable: Try to reuse KindReps (745dc89) Message-ID: <20170221024933.DF21C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/ttypeable' now includes: a4ccd33 Add index entry for signature files / Backpack. 8e9ad24 Setup more error context for Backpack operations. c81f3bc Remove obsolete Backpack manual. 2f16484 Slightly reword not-exported message. 7666a9f Disable PVP warnings temporarily. 20b5dfc Typos in notes and comments [ci skip] 2d6e91e Debug: Use local symbols for unwind points (#13278) 60c4986 Typecast covers entire expression to fix format warning. 6626242 TcUnify: Assert precondition of matchExpectedTyConApp 2484d4d Refactor renaming of operators/sections to fix DuplicateRecordFields bugs 04f67c9 Expand list of always loaded Windows shared libs 2f1017b Fix ExtraSymbols jump table on Windows. c3bbd1a Allow type defaulting for multi-param type classes with ExtendedDefaultRules da49389 Implement HasField constraint solving and modify OverloadedLabels 392cec4 Update .mailmap [skip ci] bedcb71 Check local type family instances against all imported ones f90e61a Make deSugarExpr use runTcInteractive 93e65c8 Don't warn about missing methods for instances in signatures. e28fbbb Typos [ci skip] fc9d152 Comments and tiny refactor only 6bab649 Improve checking of joins in Core Lint b8c29bc Use the correct origin in SectionL and Section R f4aa998 Better perf for haddock.base, haddock.Cabal e52a335 Comments only, about inl_inline and inl_act 8d401e5 Honour -dsuppress-uniques more thoroughly e55986a Fix a substitution bug in cseCase 0e76017 Simplify OutputableBndr ca54315 Fix a Backpack recompilation avoidance bug when signatures change. 22dba98 Fix recompilation tracking on signatures. fd2d5b6 Improvements/bugfixes to signature reexport handling. 8916884 Say 'data' explicitly in IfAbstractTyCon output. 7c057b5 Bump libraries/array submodule efeaf9e Bump nofib submodule b207b53 Generalize kind of the (->) tycon 8fa4bf9 Type-indexed Typeable 42ff5d9 Disable Typeable binding generation for unboxed sums 98e494a Improve Haddock documentation for compact. dae5003 Remove ghc-api/landmine tests 0aafe51 Typos in manual, tests and comments 2d5be63 Change -dppr-ticks to -dsuppress-ticks 8a9b57f Kill off the remaining Rec [] 3f653c1 Fix Core pretty printer 8dd4e3b Remove redundant import 27a2854 A number of Typeable wibbles from review 087dbbe Bump Cabal submodule 6ad89d7 Bump a few more performance regressions from Type-indexed Typeable 240b43e Bump Win32 submodule to 2.5.1.0 7153370 Bump time submodule to 1.8 b7265ff build.mk: Add option for debug symbols 80c2f75 Move Typeable Binary instances to binary package 745dc89 TcTypeable: Try to reuse KindReps From git at git.haskell.org Tue Feb 21 10:30:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Feb 2017 10:30:33 +0000 (UTC) Subject: [commit: ghc] master: Fix DeriveAnyClass (again) (fd841f8) Message-ID: <20170221103033.DC5903A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fd841f877ab7a991f667a50b401404927f6f599c/ghc >--------------------------------------------------------------- commit fd841f877ab7a991f667a50b401404927f6f599c Author: Simon Peyton Jones Date: Tue Feb 21 10:27:41 2017 +0000 Fix DeriveAnyClass (again) This patch fixes Trac #13272. The general approach was fine, but we were simply not generating the correct implication constraint (in particular generating fresh unification variables). I added a lot more commentary to Note [Gathering and simplifying constraints for DeriveAnyClass] I'm still not very happy with the overall architecture. It feels more complicate than it should. >--------------------------------------------------------------- fd841f877ab7a991f667a50b401404927f6f599c compiler/typecheck/TcDerivInfer.hs | 244 +++++++++++---------- testsuite/tests/deriving/should_compile/T13272.hs | 23 ++ testsuite/tests/deriving/should_compile/T13272a.hs | 21 ++ testsuite/tests/deriving/should_compile/all.T | 2 + 4 files changed, 172 insertions(+), 118 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 fd841f877ab7a991f667a50b401404927f6f599c From git at git.haskell.org Tue Feb 21 10:30:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Feb 2017 10:30:36 +0000 (UTC) Subject: [commit: ghc] master: Spelling in comments only (59026b3) Message-ID: <20170221103036.968063A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/59026b3be1ba9afed161e1a4cfcd98d3ee021afd/ghc >--------------------------------------------------------------- commit 59026b3be1ba9afed161e1a4cfcd98d3ee021afd Author: Simon Peyton Jones Date: Tue Feb 21 10:25:27 2017 +0000 Spelling in comments only >--------------------------------------------------------------- 59026b3be1ba9afed161e1a4cfcd98d3ee021afd compiler/types/Class.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/types/Class.hs b/compiler/types/Class.hs index 82a71f5..786ef7e 100644 --- a/compiler/types/Class.hs +++ b/compiler/types/Class.hs @@ -100,7 +100,7 @@ type DefMethInfo = Maybe (Name, DefMethSpec Type) -- Just ($gm, GenericDM ty) A generic default method, name $gm, type ty -- The generic dm type is *not* quantified -- over the class variables; ie has the - -- class vaiables free + -- class variables free data ClassATItem = ATI TyCon -- See Note [Associated type tyvar names] From git at git.haskell.org Tue Feb 21 14:29:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Feb 2017 14:29:14 +0000 (UTC) Subject: [commit: ghc] master: Fix computation of dfun_tvs in mkNewTypeEqn (713ebd7) Message-ID: <20170221142914.865A33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/713ebd7cf03876c6bedc1be9fba8f60ccc5bc8f0/ghc >--------------------------------------------------------------- commit 713ebd7cf03876c6bedc1be9fba8f60ccc5bc8f0 Author: Simon Peyton Jones Date: Tue Feb 21 13:29:16 2017 +0000 Fix computation of dfun_tvs in mkNewTypeEqn This bug was causing Trac #13297. We were recomputing ds_tvs, and doing it wrongly (by omitting variables that appear only in mtheta). But actually plain 'tvs' is just fine. So code deleted, and bug fixed. >--------------------------------------------------------------- 713ebd7cf03876c6bedc1be9fba8f60ccc5bc8f0 compiler/typecheck/TcDeriv.hs | 7 +++---- testsuite/tests/deriving/should_compile/T13297.hs | 9 +++++++++ testsuite/tests/deriving/should_compile/all.T | 1 + 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/compiler/typecheck/TcDeriv.hs b/compiler/typecheck/TcDeriv.hs index 00869c4..55b7d6d 100644 --- a/compiler/typecheck/TcDeriv.hs +++ b/compiler/typecheck/TcDeriv.hs @@ -1177,7 +1177,7 @@ mkNewTypeEqn dflags overlap_mode tvs case mtheta of Just theta -> return $ GivenTheta $ DS { ds_loc = loc - , ds_name = dfun_name, ds_tvs = dfun_tvs + , ds_name = dfun_name, ds_tvs = tvs , ds_cls = cls, ds_tys = inst_tys , ds_tc = rep_tycon , ds_theta = theta @@ -1185,7 +1185,7 @@ mkNewTypeEqn dflags overlap_mode tvs , ds_mechanism = mechanism } Nothing -> return $ InferTheta $ DS { ds_loc = loc - , ds_name = dfun_name, ds_tvs = dfun_tvs + , ds_name = dfun_name, ds_tvs = tvs , ds_cls = cls, ds_tys = inst_tys , ds_tc = rep_tycon , ds_theta = all_thetas @@ -1258,7 +1258,6 @@ mkNewTypeEqn dflags overlap_mode tvs -- See Note [Newtype deriving superclasses] above sc_preds :: [PredOrigin] cls_tyvars = classTyVars cls - dfun_tvs = tyCoVarsOfTypesWellScoped inst_tys inst_ty = mkTyConApp tycon tc_args inst_tys = cls_tys ++ [inst_ty] sc_preds = map (mkPredOrigin DerivOrigin TypeLevel) $ @@ -1278,7 +1277,7 @@ mkNewTypeEqn dflags overlap_mode tvs = [ mkPredOrigin (DerivOriginCoerce meth t1 t2) TypeLevel (mkReprPrimEqPred t1 t2) | meth <- meths - , let (Pair t1 t2) = mkCoerceClassMethEqn cls dfun_tvs + , let (Pair t1 t2) = mkCoerceClassMethEqn cls tvs inst_tys rep_inst_ty meth ] all_thetas :: [ThetaOrigin] diff --git a/testsuite/tests/deriving/should_compile/T13297.hs b/testsuite/tests/deriving/should_compile/T13297.hs new file mode 100644 index 0000000..604a649 --- /dev/null +++ b/testsuite/tests/deriving/should_compile/T13297.hs @@ -0,0 +1,9 @@ +{-# Language TypeFamilies, StandaloneDeriving, GeneralizedNewtypeDeriving, UndecidableInstances #-} +module T13297 where + +newtype N p m a = N (((CT p) m) a) +deriving instance (CT p ~ f, Functor (f m)) => Functor (N p m) +deriving instance (CT p ~ f, Applicative (f m)) => Applicative (N p m) -- panic when this line added + +class C p where + type CT p :: (* -> *) -> * -> * diff --git a/testsuite/tests/deriving/should_compile/all.T b/testsuite/tests/deriving/should_compile/all.T index e16bd95..5c3f970 100644 --- a/testsuite/tests/deriving/should_compile/all.T +++ b/testsuite/tests/deriving/should_compile/all.T @@ -84,3 +84,4 @@ test('T12688', normal, compile, ['']) test('T12814', normal, compile, ['-Wredundant-constraints']) test('T13272', normal, compile, ['']) test('T13272a', normal, compile, ['']) +test('T13297', normal, compile, ['']) From git at git.haskell.org Tue Feb 21 14:29:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Feb 2017 14:29:17 +0000 (UTC) Subject: [commit: ghc] master: Refactor inferConstraints not to use CPS (95cbb55) Message-ID: <20170221142917.3A5F13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/95cbb55cf7dfeaae466f0512af28a92914faacb5/ghc >--------------------------------------------------------------- commit 95cbb55cf7dfeaae466f0512af28a92914faacb5 Author: Simon Peyton Jones Date: Tue Feb 21 14:27:30 2017 +0000 Refactor inferConstraints not to use CPS For some odd reason inferConstraints was using a CPS style, which is entirely unnecessary. This patch straightens it out. No change in what it does. >--------------------------------------------------------------- 95cbb55cf7dfeaae466f0512af28a92914faacb5 compiler/typecheck/TcDeriv.hs | 10 ++++++---- compiler/typecheck/TcDerivInfer.hs | 33 +++++++++++++++------------------ 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/compiler/typecheck/TcDeriv.hs b/compiler/typecheck/TcDeriv.hs index 55b7d6d..86f0409 100644 --- a/compiler/typecheck/TcDeriv.hs +++ b/compiler/typecheck/TcDeriv.hs @@ -1010,16 +1010,18 @@ mk_data_eqn overlap_mode tvs cls cls_tys tycon tc_args rep_tc rep_tc_args dfun_name <- newDFunName' cls tycon case mtheta of Nothing -> -- Infer context - inferConstraints tvs cls cls_tys inst_ty rep_tc rep_tc_args mechanism - $ \inferred_constraints tvs' inst_tys' -> - return $ InferTheta $ DS + do { (inferred_constraints, tvs', inst_tys') + <- inferConstraints tvs cls cls_tys inst_ty + rep_tc rep_tc_args mechanism + ; return $ InferTheta $ DS { ds_loc = loc , ds_name = dfun_name, ds_tvs = tvs' , ds_cls = cls, ds_tys = inst_tys' , ds_tc = rep_tc , ds_theta = inferred_constraints , ds_overlap = overlap_mode - , ds_mechanism = mechanism } + , ds_mechanism = mechanism } } + Just theta -> do -- Specified context return $ GivenTheta $ DS { ds_loc = loc diff --git a/compiler/typecheck/TcDerivInfer.hs b/compiler/typecheck/TcDerivInfer.hs index 02e9f1f..22c0503 100644 --- a/compiler/typecheck/TcDerivInfer.hs +++ b/compiler/typecheck/TcDerivInfer.hs @@ -48,8 +48,7 @@ import Data.Maybe inferConstraints :: [TyVar] -> Class -> [TcType] -> TcType -> TyCon -> [TcType] -> DerivSpecMechanism - -> ([ThetaOrigin] -> [TyVar] -> [TcType] -> TcM a) - -> TcM a + -> TcM ([ThetaOrigin], [TyVar], [TcType]) -- inferConstraints figures out the constraints needed for the -- instance declaration generated by a 'deriving' clause on a -- data type declaration. It also returns the new in-scope type @@ -67,15 +66,15 @@ inferConstraints :: [TyVar] -> Class -> [TcType] -> TcType -- before being used in the instance declaration inferConstraints tvs main_cls cls_tys inst_ty rep_tc rep_tc_args - mechanism thing + mechanism | is_generic && not is_anyclass -- Generic constraints are easy - = thing [mkThetaOriginFromPreds []] tvs inst_tys + = return ([], tvs, inst_tys) | is_generic1 && not is_anyclass -- Generic1 needs Functor = ASSERT( length rep_tc_tvs > 0 ) -- See Note [Getting base classes] ASSERT( length cls_tys == 1 ) -- Generic1 has a single kind variable do { functorClass <- tcLookupClass functorClassName - ; con_arg_constraints (get_gen1_constraints functorClass) thing } + ; con_arg_constraints (get_gen1_constraints functorClass) } | otherwise -- The others are a bit more complicated = -- See the comment with all_rep_tc_args for an explanation of @@ -83,14 +82,14 @@ inferConstraints tvs main_cls cls_tys inst_ty ASSERT2( equalLength rep_tc_tvs all_rep_tc_args , ppr main_cls <+> ppr rep_tc $$ ppr rep_tc_tvs $$ ppr all_rep_tc_args ) - infer_constraints $ \arg_constraints tvs' inst_tys' -> - do { traceTc "inferConstraints" $ vcat + do { (arg_constraints, tvs', inst_tys') <- infer_constraints + ; traceTc "inferConstraints" $ vcat [ ppr main_cls <+> ppr inst_tys' , ppr arg_constraints ] - ; thing (stupid_constraints ++ extra_constraints - ++ sc_constraints ++ arg_constraints) - tvs' inst_tys' } + ; return (stupid_constraints ++ extra_constraints + ++ sc_constraints ++ arg_constraints + , tvs', inst_tys') } where is_anyclass = isDerivSpecAnyClass mechanism infer_constraints @@ -108,9 +107,8 @@ inferConstraints tvs main_cls cls_tys inst_ty con_arg_constraints :: (CtOrigin -> TypeOrKind -> Type -> [([PredOrigin], Maybe TCvSubst)]) - -> ([ThetaOrigin] -> [TyVar] -> [TcType] -> TcM a) - -> TcM a - con_arg_constraints get_arg_constraints thing + -> TcM ([ThetaOrigin], [TyVar], [TcType]) + con_arg_constraints get_arg_constraints = let (predss, mbSubsts) = unzip [ preds_and_mbSubst | data_con <- tyConDataCons rep_tc @@ -136,7 +134,7 @@ inferConstraints tvs main_cls cls_tys inst_ty preds' = map (substPredOrigin subst') preds inst_tys' = substTys subst' inst_tys tvs' = tyCoVarsOfTypesWellScoped inst_tys' - in thing [mkThetaOriginFromPreds preds'] tvs' inst_tys' + in return ([mkThetaOriginFromPreds preds'], tvs', inst_tys') is_generic = main_cls `hasKey` genClassKey is_generic1 = main_cls `hasKey` gen1ClassKey @@ -243,9 +241,8 @@ typeToTypeKind = liftedTypeKind `mkFunTy` liftedTypeKind -- for an explanation of how these constraints are used to determine the -- derived instance context. inferConstraintsDAC :: Class -> [TyVar] -> [TcType] - -> ([ThetaOrigin] -> [TyVar] -> [TcType] -> TcM a) - -> TcM a -inferConstraintsDAC cls tvs inst_tys thing + -> TcM ([ThetaOrigin], [TyVar], [TcType]) +inferConstraintsDAC cls tvs inst_tys = do { let gen_dms = [ (sel_id, dm_ty) | (sel_id, Just (_, GenericDM dm_ty)) <- classOpItems cls ] @@ -254,7 +251,7 @@ inferConstraintsDAC cls tvs inst_tys thing -- to mk_wanteds in simplifyDeriv. If we omit this, the -- unification variables will wrongly be untouchable. - ; thing theta_origins tvs inst_tys } + ; return (theta_origins, tvs, inst_tys) } where cls_tvs = classTyVars cls empty_subst = mkEmptyTCvSubst (mkInScopeSet (mkVarSet tvs)) From git at git.haskell.org Tue Feb 21 14:31:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Feb 2017 14:31:33 +0000 (UTC) Subject: [commit: ghc] master: Improve Core Lint, mainly for join points (e790126) Message-ID: <20170221143133.4E3B83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e790126cd57ab39649b1fd42996733fafe20eb34/ghc >--------------------------------------------------------------- commit e790126cd57ab39649b1fd42996733fafe20eb34 Author: Simon Peyton Jones Date: Fri Feb 17 15:03:01 2017 +0000 Improve Core Lint, mainly for join points * lintSingleBinding: check that join points have a valid join-point type (Trac #13281) * lintIdBinder: check that a JoinId is bound by a non-top-level let i.e. not a top level binder not lambda/case binder * Check for empty Rec [] bindings * Rename lintIdBndrs to lintLetBndrs >--------------------------------------------------------------- e790126cd57ab39649b1fd42996733fafe20eb34 compiler/coreSyn/CoreLint.hs | 107 ++++++++++++++++++++++++++++--------------- 1 file changed, 69 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 e790126cd57ab39649b1fd42996733fafe20eb34 From git at git.haskell.org Tue Feb 21 14:31:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Feb 2017 14:31:36 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Fix allocations of T10547 (82694e6) Message-ID: <20170221143136.04D063A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/82694e6765da1db4e7596ec410e4c41d3bf1ca94/ghc >--------------------------------------------------------------- commit 82694e6765da1db4e7596ec410e4c41d3bf1ca94 Author: Ben Gamari Date: Tue Feb 21 09:12:34 2017 -0500 testsuite: Fix allocations of T10547 Previously the comment was correct, but the expected value itself was never updated. >--------------------------------------------------------------- 82694e6765da1db4e7596ec410e4c41d3bf1ca94 testsuite/tests/perf/compiler/all.T | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index f3c318b..c9b5091 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -901,7 +901,7 @@ test('T10370', test('T10547', [ compiler_stats_num_field('bytes allocated', - [(wordsize(64), 31041520, 20), + [(wordsize(64), 37681360, 20), # initial: 39165544 # 2016-11-25: 31041520 Linux Around the time of refactoring the constraint solver; # but I think that only pushed it over the edge From git at git.haskell.org Tue Feb 21 14:31:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Feb 2017 14:31:38 +0000 (UTC) Subject: [commit: ghc] master: Fix SetLevels for join points (6e32884) Message-ID: <20170221143138.B1CCA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6e3288473718fcd8e6ad15a5e7db5b7ab43e9cbb/ghc >--------------------------------------------------------------- commit 6e3288473718fcd8e6ad15a5e7db5b7ab43e9cbb Author: Simon Peyton Jones Date: Fri Feb 17 15:03:52 2017 +0000 Fix SetLevels for join points This fixes Trac #13255. The trouble was that we had a bottoming join point, and tried to float it to top level. But it had free JoinIds, so we tried to abstract over them. Disaster. Lint should have caught it, but didn't (now fixed). This patch fixes the original problem. >--------------------------------------------------------------- 6e3288473718fcd8e6ad15a5e7db5b7ab43e9cbb compiler/simplCore/SetLevels.hs | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/compiler/simplCore/SetLevels.hs b/compiler/simplCore/SetLevels.hs index 4fca18d..22d4048 100644 --- a/compiler/simplCore/SetLevels.hs +++ b/compiler/simplCore/SetLevels.hs @@ -977,8 +977,7 @@ lvlBind env (AnnNonRec bndr rhs) rhs_fvs = freeVarsOf rhs bind_fvs = rhs_fvs `unionDVarSet` dIdFreeVars bndr abs_vars = abstractVars dest_lvl env bind_fvs - dest_lvl = destLevel env bind_fvs (isFunction rhs) is_bot - is_unfloatable_join + dest_lvl = destLevel env bind_fvs (isFunction rhs) is_bot is_join mb_bot_str = exprBotStrictness_maybe (deAnnotate rhs) -- See Note [Bottoming floats] -- esp Bottoming floats (2) @@ -986,8 +985,8 @@ lvlBind env (AnnNonRec bndr rhs) n_extra = count isId abs_vars mb_join_arity = isJoinId_maybe bndr - is_unfloatable_join = case mb_join_arity of Just ar -> ar > 0 - Nothing -> False + is_join = isJust mb_join_arity + -- See Note [When to ruin a join point] need_zap = dest_lvl `ltLvl` joinCeilingLevel env zapped_join | need_zap = Nothing -- Zap the join point @@ -1066,15 +1065,11 @@ lvlBind env (AnnRec pairs) `delDVarSetList` bndrs - dest_lvl = destLevel env bind_fvs (all isFunction rhss) False - has_unfloatable_join + dest_lvl = destLevel env bind_fvs (all isFunction rhss) False is_join abs_vars = abstractVars dest_lvl env bind_fvs mb_join_arities = map isJoinId_maybe bndrs - has_unfloatable_join - = any (\mb_ar -> case mb_ar of Just ar -> ar > 0 - Nothing -> False) mb_join_arities - + is_join = any isJust mb_join_arities need_zap = dest_lvl `ltLvl` joinCeilingLevel env zap_join mb_join_arity | need_zap = Nothing | otherwise = mb_join_arity @@ -1244,6 +1239,14 @@ destLevel :: LevelEnv -> DVarSet -> Bool -- True <=> is join point (or can be floated anyway) -> Level destLevel env fvs is_function is_bot is_join + | isTopLvl max_fv_level -- Float even joins if they get to top level + = tOP_LEVEL + + | is_join + = if max_fv_level `ltLvl` join_ceiling + then join_ceiling + else max_fv_level + | is_bot -- Send bottoming bindings to the top = tOP_LEVEL -- regardless; see Note [Bottoming floats] -- Esp Bottoming floats (1) @@ -1255,19 +1258,12 @@ destLevel env fvs is_function is_bot is_join = tOP_LEVEL -- Send functions to top level; see -- the comments with isFunction - | is_join - , hits_ceiling - = join_ceiling - | otherwise = max_fv_level where max_fv_level = maxFvLevel isId env fvs -- Max over Ids only; the tyvars -- will be abstracted - join_ceiling = joinCeilingLevel env - hits_ceiling = max_fv_level `ltLvl` join_ceiling && - not (isTopLvl max_fv_level) - -- Note [When to ruin a join point] + isFunction :: CoreExprWithFVs -> Bool -- The idea here is that we want to float *functions* to From git at git.haskell.org Tue Feb 21 14:54:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Feb 2017 14:54:08 +0000 (UTC) Subject: [commit: ghc] master: Minor spelling, grammar, and formatting fixes (4080a63) Message-ID: <20170221145408.98F7C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4080a63c510f13be22953383a07ce0cf2d29e17b/ghc >--------------------------------------------------------------- commit 4080a63c510f13be22953383a07ce0cf2d29e17b Author: Ryan Scott Date: Tue Feb 21 09:43:43 2017 -0500 Minor spelling, grammar, and formatting fixes [ci skip] >--------------------------------------------------------------- 4080a63c510f13be22953383a07ce0cf2d29e17b compiler/typecheck/TcDerivInfer.hs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/compiler/typecheck/TcDerivInfer.hs b/compiler/typecheck/TcDerivInfer.hs index 22c0503..a28b0bc 100644 --- a/compiler/typecheck/TcDerivInfer.hs +++ b/compiler/typecheck/TcDerivInfer.hs @@ -34,7 +34,7 @@ import Type import TcSimplify import TcValidity (validDerivPred) import TcUnify (buildImplicationFor) -import Unify ( {- tcMatchTy, -} tcUnifyTy) +import Unify (tcUnifyTy) import Util import Var import VarEnv @@ -592,7 +592,7 @@ simplifyDeriv pred tvs thetas -- Create the implications we need to solve. For stock and newtype -- deriving, these implication constraints will be simple class - -- constriants like (C a, Ord b). + -- constraints like (C a, Ord b). -- But with DeriveAnyClass, we make an implication constraint. -- See Note [Gathering and simplifying constraints for DeriveAnyClass] mk_wanteds :: ThetaOrigin -> TcM WantedConstraints @@ -716,8 +716,8 @@ To see why, consider this example of DeriveAnyClass: default baz :: (Ord a, Show a) => a -> a -> Bool baz x y = compare x y == EQ -Because 'bar' and 'baz' have default signatures, generates a top-level -definition for thse generic default methods +Because 'bar' and 'baz' have default signatures, this generates a top-level +definition for these generic default methods $gdm_bar :: forall a. Foo a => forall c. (Show a, Ix c) @@ -737,14 +737,15 @@ GHC were typechecking the binding bar = $gdm bar it would * skolemise the expected type of bar - * instaniate the type of $dm_bar with meta-type varibles + * instantiate the type of $dm_bar with meta-type varibles * build an implication constraint [STEP DAC BUILD] So that's what we do. We build the constraint (call it C1) forall b. Ix b => (Show (Maybe s), Ix cc, - Maybe s -> b -> String ~ Maybe s -> cc -> String) + Maybe s -> b -> String + ~ Maybe s -> cc -> String) The 'cc' is a unification variable that comes from instantiating $dm_bar's type. The equality constraint comes from marrying up From git at git.haskell.org Tue Feb 21 14:54:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Feb 2017 14:54:11 +0000 (UTC) Subject: [commit: ghc] master: Replace some pushTcLevelM's with pushTcLevelM_ (611f998) Message-ID: <20170221145411.4A4DE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/611f998fd545b45167170d9e60b7d9147178f0a1/ghc >--------------------------------------------------------------- commit 611f998fd545b45167170d9e60b7d9147178f0a1 Author: Ryan Scott Date: Tue Feb 21 09:51:43 2017 -0500 Replace some pushTcLevelM's with pushTcLevelM_ These occurrences of pushTcLevelM weren't using the resulting TcLevel, so they can be replaced with the (ostensibly more efficient) pushTcLevelM_. No change in behavior. >--------------------------------------------------------------- 611f998fd545b45167170d9e60b7d9147178f0a1 compiler/typecheck/TcDerivInfer.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/typecheck/TcDerivInfer.hs b/compiler/typecheck/TcDerivInfer.hs index a28b0bc..e0d46dd 100644 --- a/compiler/typecheck/TcDerivInfer.hs +++ b/compiler/typecheck/TcDerivInfer.hs @@ -246,7 +246,7 @@ inferConstraintsDAC cls tvs inst_tys = do { let gen_dms = [ (sel_id, dm_ty) | (sel_id, Just (_, GenericDM dm_ty)) <- classOpItems cls ] - ; (theta_origins, _lvl) <- pushTcLevelM (mapM do_one_meth gen_dms) + ; theta_origins <- pushTcLevelM_ (mapM do_one_meth gen_dms) -- Yuk: the pushTcLevel is to match the one wrapping the call -- to mk_wanteds in simplifyDeriv. If we omit this, the -- unification variables will wrongly be untouchable. @@ -268,8 +268,8 @@ inferConstraintsDAC cls tvs inst_tys gen_dm_ty' = substTyWith cls_tvs inst_tys gen_dm_ty (dm_tvs, dm_theta, dm_tau) = tcSplitNestedSigmaTys gen_dm_ty' - ; ((subst, _meta_tvs), _lvl) <- pushTcLevelM $ - newMetaTyVarsX empty_subst dm_tvs + ; (subst, _meta_tvs) <- pushTcLevelM_ $ + newMetaTyVarsX empty_subst dm_tvs -- Yuk: the pushTcLevel is to match the one in mk_wanteds -- simplifyDeriv. If we don't, the unification variables -- will bogusly be untouchable. From git at git.haskell.org Tue Feb 21 16:01:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Feb 2017 16:01:35 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline: Mark non-recursive join lambdas as one-shot (8515fcf) Message-ID: <20170221160135.0E9AB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline Link : http://ghc.haskell.org/trac/ghc/changeset/8515fcfa9196a107047d09f05dd81a4336600439/ghc >--------------------------------------------------------------- commit 8515fcfa9196a107047d09f05dd81a4336600439 Author: Simon Peyton Jones Date: Tue Feb 21 15:07:47 2017 +0000 Mark non-recursive join lambdas as one-shot When we have join j x y = rhs in ... we know that the lambdas for 'x' and 'y' are one-shot. Let's mark them as such! This doesn't fix a specific bug, but it feels right to me. >--------------------------------------------------------------- 8515fcfa9196a107047d09f05dd81a4336600439 compiler/simplCore/OccurAnal.hs | 68 +++++++++++++++++++++++++---------------- 1 file changed, 41 insertions(+), 27 deletions(-) diff --git a/compiler/simplCore/OccurAnal.hs b/compiler/simplCore/OccurAnal.hs index f2f7da6..949cbf1 100644 --- a/compiler/simplCore/OccurAnal.hs +++ b/compiler/simplCore/OccurAnal.hs @@ -732,7 +732,6 @@ add this analysis if necessary. ------------------------------------------------------------ Note [Adjusting for lambdas] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - There's a bit of a dance we need to do after analysing a lambda expression or a right-hand side. In particular, we need to @@ -802,28 +801,33 @@ occAnalNonRecBind env lvl imp_rule_edges binder rhs body_usage | otherwise -- It's mentioned in the body = (body_usage' +++ rhs_usage', [NonRec tagged_binder rhs']) where - (bndrs, body) = collectBinders rhs (body_usage', tagged_binder) = tagNonRecBinder lvl body_usage binder + mb_join_arity = willBeJoinId_maybe tagged_binder + + (bndrs, body) = collectBinders rhs + (rhs_usage1, bndrs', body') = occAnalNonRecRhs env tagged_binder bndrs body - rhs' = mkLams bndrs' body' + rhs' = mkLams (markJoinOneShots mb_join_arity bndrs') body' + -- For a /non-recursive/ join point we can mark all + -- its join-lambda as one-shot; and it's a good idea to do so + + -- Unfoldings + -- See Note [Unfoldings and join points] rhs_usage2 = case occAnalUnfolding env NonRecursive binder of Just unf_usage -> rhs_usage1 +++ unf_usage Nothing -> rhs_usage1 - -- See Note [Unfoldings and join points] - mb_join_arity = willBeJoinId_maybe tagged_binder + -- Rules + -- See Note [Rules are extra RHSs] and Note [Rule dependency info] rules_w_uds = occAnalRules env mb_join_arity NonRecursive tagged_binder - rhs_usage3 = rhs_usage2 +++ combineUsageDetailsList (map (\(_, l, r) -> l +++ r) rules_w_uds) - -- See Note [Rules are extra RHSs] and Note [Rule dependency info] - rhs_usage4 = maybe rhs_usage3 (addManyOccsSet rhs_usage3) $ lookupVarEnv imp_rule_edges binder -- See Note [Preventing loops due to imported functions rules] - rhs_usage' = adjustRhsUsage (willBeJoinId_maybe tagged_binder) NonRecursive - bndrs' rhs_usage4 + -- Final adjustment + rhs_usage' = adjustRhsUsage mb_join_arity NonRecursive bndrs' rhs_usage4 ----------------- occAnalRecBind :: OccEnv -> TopLevelFlag -> ImpRuleEdges -> [(Var,CoreExpr)] @@ -1550,7 +1554,6 @@ occAnalNonRecRhs env bndr bndrs body -- See Note [Sources of one-shot information] rhs_env = env1 { occ_one_shots = argOneShots dmd } - certainly_inline -- See Note [Cascading inlines] = case idOccInfo bndr of OneOcc { occ_in_lam = in_lam, occ_one_br = one_br } @@ -1731,7 +1734,8 @@ occAnal env app@(App _ _) -- (a) occurrences inside type lambdas only not marked as InsideLam -- (b) type variables not in environment -occAnal env (Lam x body) | isTyVar x +occAnal env (Lam x body) + | isTyVar x = case occAnal env body of { (body_usage, body') -> (markAllNonTailCalled body_usage, Lam x body') } @@ -1749,14 +1753,14 @@ occAnal env expr@(Lam _ _) = case occAnalLamOrRhs env binders body of { (usage, tagged_binders, body') -> let expr' = mkLams tagged_binders body' - final_usage | all isOneShotBndr tagged_binders - = markAllNonTailCalled usage - | otherwise - = markAllInsideLam $ markAllNonTailCalled usage + usage1 = markAllNonTailCalled usage + one_shot_gp = all isOneShotBndr tagged_binders + final_usage | one_shot_gp = usage1 + | otherwise = markAllInsideLam usage1 in (final_usage, expr') } where - (binders, body) = collectBinders expr + (binders, body) = collectBinders expr occAnal env (Case scrut bndr ty alts) = case occ_anal_scrut scrut alts of { (scrut_usage, scrut') -> @@ -2130,21 +2134,31 @@ oneShotGroup env@(OccEnv { occ_one_shots = ctxt }) bndrs = ( env { occ_one_shots = [], occ_encl = OccVanilla } , reverse rev_bndrs ++ bndrs ) - go ctxt (bndr:bndrs) rev_bndrs - | isId bndr - - = case ctxt of - [] -> go [] bndrs (bndr : rev_bndrs) - (one_shot : ctxt) -> go ctxt bndrs (bndr': rev_bndrs) - where - bndr' = updOneShotInfo bndr one_shot + go ctxt@(one_shot : ctxt') (bndr : bndrs) rev_bndrs + | isId bndr = go ctxt' bndrs (bndr': rev_bndrs) + | otherwise = go ctxt bndrs (bndr : rev_bndrs) + where + bndr' = updOneShotInfo bndr one_shot -- Use updOneShotInfo, not setOneShotInfo, as pre-existing -- one-shot info might be better than what we can infer, e.g. -- due to explicit use of the magic 'oneShot' function. -- See Note [The oneShot function] - | otherwise - = go ctxt bndrs (bndr:rev_bndrs) + +markJoinOneShots :: Maybe JoinArity -> [Var] -> [Var] +-- Mark the lambdas of a non-recursive join point as one-shot. +-- This is good to prevent gratuitous float-out etc +markJoinOneShots mb_join_arity bndrs + = case mb_join_arity of + Nothing -> bndrs + Just n -> go n bndrs + where + go 0 bndrs = bndrs + go _ [] = WARN( True, ppr mb_join_arity <+> ppr bndrs ) [] + go n (b:bs) = b' : go (n-1) bs + where + b' | isId b = setOneShotLambda b + | otherwise = b addAppCtxt :: OccEnv -> [Arg CoreBndr] -> OccEnv addAppCtxt env@(OccEnv { occ_one_shots = ctxt }) args From git at git.haskell.org Tue Feb 21 17:44:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Feb 2017 17:44:46 +0000 (UTC) Subject: [commit: ghc] master: A little refactoring of the simplifier around join points (0d43f74) Message-ID: <20170221174446.9790B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0d43f74fb6bfc38ee16f318db56716cb08d07939/ghc >--------------------------------------------------------------- commit 0d43f74fb6bfc38ee16f318db56716cb08d07939 Author: Simon Peyton Jones Date: Tue Feb 21 14:30:56 2017 +0000 A little refactoring of the simplifier around join points * Rename SimplEnv.setInScope to setInScopeAndZapFloats, because I keep forgetting that's what it does * Remove unnecessary (and hence confusing) zapJoinFloats from simplLazyBind * Reorder args of simplJoinRhs to put the cont last >--------------------------------------------------------------- 0d43f74fb6bfc38ee16f318db56716cb08d07939 compiler/simplCore/SimplEnv.hs | 15 +++++----- compiler/simplCore/Simplify.hs | 68 +++++++++++++++++++++++------------------- 2 files changed, 45 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 0d43f74fb6bfc38ee16f318db56716cb08d07939 From git at git.haskell.org Tue Feb 21 17:44:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Feb 2017 17:44:49 +0000 (UTC) Subject: [commit: ghc] master: Disallow class instances for synonyms (c750808) Message-ID: <20170221174449.E2DE03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c7508083388a71d76a5b6f1e46adfbcffba74b96/ghc >--------------------------------------------------------------- commit c7508083388a71d76a5b6f1e46adfbcffba74b96 Author: Simon Peyton Jones Date: Tue Feb 21 15:00:03 2017 +0000 Disallow class instances for synonyms See Trac #13267 and Note [Instances and constraint synonyms] in TcValidity. We can't easily do a perfect job, because the rename is really trying to do its lookup too early. But this is at least an improvement. >--------------------------------------------------------------- c7508083388a71d76a5b6f1e46adfbcffba74b96 compiler/typecheck/TcValidity.hs | 45 ++++++++++++++++++++++++++++----- testsuite/tests/polykinds/T13267.hs | 10 ++++++++ testsuite/tests/polykinds/T13267.stderr | 10 ++++++++ testsuite/tests/polykinds/all.T | 1 + 4 files changed, 60 insertions(+), 6 deletions(-) diff --git a/compiler/typecheck/TcValidity.hs b/compiler/typecheck/TcValidity.hs index f7cb319..6f9c3fa 100644 --- a/compiler/typecheck/TcValidity.hs +++ b/compiler/typecheck/TcValidity.hs @@ -1236,11 +1236,42 @@ validDerivPred tv_set pred ************************************************************************ -} +{- Note [Instances and constraint synonyms] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Currently, we don't allow instances for constraint synonyms at all. +Consider these (Trac #13267): + type C1 a = Show (a -> Bool) + instance C1 Int where -- I1 + show _ = "ur" + +This elicits "show is not a (visible) method of class C1", which isn't +a great message. But it comes from the renamer, so it's hard to improve. + +This needs a bit more care: + type C2 a = (Show a, Show Int) + instance C2 Int -- I2 + +If we use (splitTyConApp_maybe tau) in checkValidInstance to decompose +the instance head, we'll expand the synonym on fly, and it'll look like + instance (%,%) (Show Int, Show Int) +and we /really/ don't want that. So we carefully do /not/ expand +synonyms, by matching on TyConApp directly. +-} + checkValidInstance :: UserTypeCtxt -> LHsSigType Name -> Type -> TcM ([TyVar], ThetaType, Class, [Type]) checkValidInstance ctxt hs_type ty - | Just (clas,inst_tys) <- getClassPredTys_maybe tau - , inst_tys `lengthIs` classArity clas + | not is_tc_app + = failWithTc (text "Instance head is not headed by a class") + + | isNothing mb_cls + = failWithTc (vcat [ text "Illegal instance for a" <+> text (tyConFlavour tc) + , text "A class instance must be for a class" ]) + + | not arity_ok + = failWithTc (text "Arity mis-match in instance head") + + | otherwise = do { setSrcSpan head_loc (checkValidInstHead ctxt clas inst_tys) ; traceTc "checkValidInstance {" (ppr ty) ; checkValidTheta ctxt theta @@ -1269,11 +1300,13 @@ checkValidInstance ctxt hs_type ty ; traceTc "End checkValidInstance }" empty ; return (tvs, theta, clas, inst_tys) } - - | otherwise - = failWithTc (text "Malformed instance head:" <+> ppr tau) where - (tvs, theta, tau) = tcSplitSigmaTy ty + (tvs, theta, tau) = tcSplitSigmaTy ty + is_tc_app = case tau of { TyConApp {} -> True; _ -> False } + TyConApp tc inst_tys = tau -- See Note [Instances and constraint synonyms] + mb_cls = tyConClass_maybe tc + Just clas = mb_cls + arity_ok = inst_tys `lengthIs` classArity clas -- The location of the "head" of the instance head_loc = getLoc (getLHsInstDeclHead hs_type) diff --git a/testsuite/tests/polykinds/T13267.hs b/testsuite/tests/polykinds/T13267.hs new file mode 100644 index 0000000..cfc7efb --- /dev/null +++ b/testsuite/tests/polykinds/T13267.hs @@ -0,0 +1,10 @@ +{-# LANGUAGE ConstraintKinds, FlexibleContexts, FlexibleInstances, MultiParamTypeClasses #-} +module T13267 where + +type C1 a = (Show (a -> Bool)) + +instance C1 Int where + +type C2 a = (Show Bool, Show Int) + +instance C2 Int where diff --git a/testsuite/tests/polykinds/T13267.stderr b/testsuite/tests/polykinds/T13267.stderr new file mode 100644 index 0000000..ff6d7fd --- /dev/null +++ b/testsuite/tests/polykinds/T13267.stderr @@ -0,0 +1,10 @@ + +T13267.hs:6:10: error: + • Illegal instance for a type synonym + A class instance must be for a class + • In the instance declaration for ‘C1 Int’ + +T13267.hs:10:10: error: + • Illegal instance for a type synonym + A class instance must be for a class + • In the instance declaration for ‘C2 Int’ diff --git a/testsuite/tests/polykinds/all.T b/testsuite/tests/polykinds/all.T index 4cdcc17..270aea3 100644 --- a/testsuite/tests/polykinds/all.T +++ b/testsuite/tests/polykinds/all.T @@ -154,3 +154,4 @@ test('T12668', normal, compile, ['']) test('T12718', normal, compile, ['']) test('T12444', normal, compile_fail, ['']) test('T12885', normal, compile, ['']) +test('T13267', normal, compile_fail, ['']) From git at git.haskell.org Tue Feb 21 17:44:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Feb 2017 17:44:52 +0000 (UTC) Subject: [commit: ghc] master: Remove panics for TcTyCon (0c9d9de) Message-ID: <20170221174452.ACB523A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0c9d9dec0a924a4f34f4cff26d004143c028861a/ghc >--------------------------------------------------------------- commit 0c9d9dec0a924a4f34f4cff26d004143c028861a Author: Simon Peyton Jones Date: Tue Feb 21 14:34:50 2017 +0000 Remove panics for TcTyCon Previously TcTyCons were used only for knot-tying, but now they are also used after an error, to add a benign TyCon to the envt so we can carry on; see TyCon.makeRecoveryTyCon. But since it is used in this way, subsequent declarations may see a TcTyCon (e.g. during injectivity checks) and should not have a heart attack as a result. See Note [TcTyCon] in TyCon. This fixes Trac #13271 >--------------------------------------------------------------- 0c9d9dec0a924a4f34f4cff26d004143c028861a compiler/typecheck/TcTyClsDecls.hs | 4 +- compiler/types/TyCon.hs | 103 ++++++++++++++++++++----------------- 2 files changed, 57 insertions(+), 50 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 0c9d9dec0a924a4f34f4cff26d004143c028861a From git at git.haskell.org Tue Feb 21 17:44:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Feb 2017 17:44:55 +0000 (UTC) Subject: [commit: ghc] master: A bit more tc-tracing in TcTyClsDecls (e3e218e) Message-ID: <20170221174455.63B563A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e3e218e2785400efb824f6652f8927690adebd20/ghc >--------------------------------------------------------------- commit e3e218e2785400efb824f6652f8927690adebd20 Author: Simon Peyton Jones Date: Tue Feb 21 14:40:59 2017 +0000 A bit more tc-tracing in TcTyClsDecls >--------------------------------------------------------------- e3e218e2785400efb824f6652f8927690adebd20 compiler/typecheck/TcTyClsDecls.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compiler/typecheck/TcTyClsDecls.hs b/compiler/typecheck/TcTyClsDecls.hs index 48a51ba..805120c 100644 --- a/compiler/typecheck/TcTyClsDecls.hs +++ b/compiler/typecheck/TcTyClsDecls.hs @@ -147,6 +147,8 @@ tcTyClGroup (TyClGroup { group_tyclds = tyclds = do { let role_annots = mkRoleAnnotEnv roles -- Step 1: Typecheck the type/class declarations + ; traceTc "-------- tcTyClGroup ------------" empty + ; traceTc "Decls for" (ppr (map (tcdName . unLoc) tyclds)) ; tyclss <- tcTyClDecls tyclds role_annots -- Step 1.5: Make sure we don't have any type synonym cycles From git at git.haskell.org Tue Feb 21 17:44:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Feb 2017 17:44:58 +0000 (UTC) Subject: [commit: ghc] master: Gather constraints locally in checkMain (3c62b1d) Message-ID: <20170221174458.AF7093A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3c62b1d6b672e7727ea5fa56c69bf43e43d0fd8f/ghc >--------------------------------------------------------------- commit 3c62b1d6b672e7727ea5fa56c69bf43e43d0fd8f Author: Simon Peyton Jones Date: Tue Feb 21 15:53:06 2017 +0000 Gather constraints locally in checkMain Wiwth -fdefer-type-errors we were generating some top-level equality constraints, just in a corner of checkMain. The fix is easy. Fixes Trac #13292 >--------------------------------------------------------------- 3c62b1d6b672e7727ea5fa56c69bf43e43d0fd8f compiler/typecheck/TcRnDriver.hs | 18 ++++++++++------- testsuite/tests/typecheck/should_fail/T13292.hs | 6 ++++++ .../tests/typecheck/should_fail/T13292.stderr | 23 ++++++++++++++++++++++ testsuite/tests/typecheck/should_fail/T13292a.hs | 4 ++++ testsuite/tests/typecheck/should_fail/all.T | 1 + 5 files changed, 45 insertions(+), 7 deletions(-) diff --git a/compiler/typecheck/TcRnDriver.hs b/compiler/typecheck/TcRnDriver.hs index 082b2fd..107162b 100644 --- a/compiler/typecheck/TcRnDriver.hs +++ b/compiler/typecheck/TcRnDriver.hs @@ -46,6 +46,7 @@ import IfaceEnv( externaliseName ) import TcHsType import TcMatches import Inst( deeplyInstantiate ) +import TcUnify( checkConstraints ) import RnTypes import RnExpr import MkId @@ -1604,14 +1605,16 @@ check_main dflags tcg_env explicit_mod_hdr Just main_name -> do { traceTc "checkMain found" (ppr main_mod <+> ppr main_fn) - ; let loc = srcLocSpan (getSrcLoc main_name) + ; let loc = srcLocSpan (getSrcLoc main_name) ; ioTyCon <- tcLookupTyCon ioTyConName ; res_ty <- newFlexiTyVarTy liftedTypeKind - ; main_expr - <- addErrCtxt mainCtxt $ - tcMonoExpr (L loc (HsVar (L loc main_name))) - (mkCheckExpType $ - mkTyConApp ioTyCon [res_ty]) + ; let io_ty = mkTyConApp ioTyCon [res_ty] + skol_info = SigSkol (FunSigCtxt main_name False) io_ty + ; (ev_binds, main_expr) + <- checkConstraints skol_info [] [] $ + addErrCtxt mainCtxt $ + tcMonoExpr (L loc (HsVar (L loc main_name))) + (mkCheckExpType io_ty) -- See Note [Root-main Id] -- Construct the binding @@ -1623,7 +1626,8 @@ check_main dflags tcg_env explicit_mod_hdr ; root_main_id = Id.mkExportedVanillaId root_main_name (mkTyConApp ioTyCon [res_ty]) ; co = mkWpTyApps [res_ty] - ; rhs = nlHsApp (mkLHsWrap co (nlHsVar run_main_id)) main_expr + ; rhs = mkHsDictLet ev_binds $ + nlHsApp (mkLHsWrap co (nlHsVar run_main_id)) main_expr ; main_bind = mkVarBind root_main_id rhs } ; return (tcg_env { tcg_main = Just main_name, diff --git a/testsuite/tests/typecheck/should_fail/T13292.hs b/testsuite/tests/typecheck/should_fail/T13292.hs new file mode 100644 index 0000000..efc71b6 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T13292.hs @@ -0,0 +1,6 @@ +module Main where + +import T13292a + +-- main :: IO () +main = someFunc diff --git a/testsuite/tests/typecheck/should_fail/T13292.stderr b/testsuite/tests/typecheck/should_fail/T13292.stderr new file mode 100644 index 0000000..5d8ccd1 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T13292.stderr @@ -0,0 +1,23 @@ + +T13292a.hs:4:12: warning: [-Wdeferred-type-errors (in -Wdefault)] + • Ambiguous type variable ‘m0’ arising from a use of ‘return’ + prevents the constraint ‘(Monad m0)’ from being solved. + Relevant bindings include + someFunc :: m0 () (bound at T13292a.hs:4:1) + Probable fix: use a type annotation to specify what ‘m0’ should be. + These potential instances exist: + instance Monad IO -- Defined in ‘GHC.Base’ + instance Monad Maybe -- Defined in ‘GHC.Base’ + instance Monoid a => Monad ((,) a) -- Defined in ‘GHC.Base’ + ...plus one other + ...plus one instance involving out-of-scope types + (use -fprint-potential-instances to see them all) + • In the expression: return () + In an equation for ‘someFunc’: someFunc = return () + +T13292.hs:6:1: warning: [-Wdeferred-type-errors (in -Wdefault)] + • Couldn't match type ‘GHC.Types.Any’ with ‘IO’ + Expected type: IO () + Actual type: GHC.Types.Any () + • In the expression: main + When checking the type of the IO action ‘main’ diff --git a/testsuite/tests/typecheck/should_fail/T13292a.hs b/testsuite/tests/typecheck/should_fail/T13292a.hs new file mode 100644 index 0000000..067e086 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T13292a.hs @@ -0,0 +1,4 @@ +module T13292a( someFunc ) where + +--someFunc :: IO () +someFunc = return () diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index 94c215f..e9cad8f 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -425,3 +425,4 @@ test('T12973', normal, compile_fail, ['']) test('StrictBinds', normal, compile_fail, ['']) test('T13105', normal, compile_fail, ['']) test('LevPolyBounded', normal, compile_fail, ['']) +test('T13292', normal, multimod_compile, ['T13292', '-v0 -fdefer-type-errors']) From git at git.haskell.org Tue Feb 21 17:45:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Feb 2017 17:45:02 +0000 (UTC) Subject: [commit: ghc] master: Test Trac #13300 (499a15d) Message-ID: <20170221174502.151373A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/499a15db0d71a9d0b91cbd5f509dabff50df2566/ghc >--------------------------------------------------------------- commit 499a15db0d71a9d0b91cbd5f509dabff50df2566 Author: Simon Peyton Jones Date: Tue Feb 21 17:44:02 2017 +0000 Test Trac #13300 >--------------------------------------------------------------- 499a15db0d71a9d0b91cbd5f509dabff50df2566 testsuite/tests/typecheck/should_fail/T13300.hs | 10 ++++++++++ testsuite/tests/typecheck/should_fail/T13300.stderr | 6 ++++++ testsuite/tests/typecheck/should_fail/all.T | 1 + 3 files changed, 17 insertions(+) diff --git a/testsuite/tests/typecheck/should_fail/T13300.hs b/testsuite/tests/typecheck/should_fail/T13300.hs new file mode 100644 index 0000000..2803b42 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T13300.hs @@ -0,0 +1,10 @@ +{-# LANGUAGE GADTs #-} +module T13300 where + +data W where + WI :: Int + WD :: Double + +data Superblock + = A { f :: W } + | B { f :: W } diff --git a/testsuite/tests/typecheck/should_fail/T13300.stderr b/testsuite/tests/typecheck/should_fail/T13300.stderr new file mode 100644 index 0000000..5bc8e4d --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T13300.stderr @@ -0,0 +1,6 @@ + +T13300.hs:5:3: error: + • Data constructor ‘WI’ returns type ‘Int’ + instead of an instance of its parent type ‘W’ + • In the definition of data constructor ‘WI’ + In the data type declaration for ‘W’ diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index e9cad8f..a9c5f80 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -426,3 +426,4 @@ test('StrictBinds', normal, compile_fail, ['']) test('T13105', normal, compile_fail, ['']) test('LevPolyBounded', normal, compile_fail, ['']) test('T13292', normal, multimod_compile, ['T13292', '-v0 -fdefer-type-errors']) +test('T13300', normal, compile_fail, ['']) From git at git.haskell.org Tue Feb 21 23:26:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Feb 2017 23:26:35 +0000 (UTC) Subject: [commit: ghc] branch 'wip/spj-early-inline2' created Message-ID: <20170221232635.71C353A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/spj-early-inline2 Referencing: 2caa001813d03168266935a475aff34c55091e07 From git at git.haskell.org Tue Feb 21 23:26:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Feb 2017 23:26:40 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline2: More tracing in SpecConstr (0e83753) Message-ID: <20170221232640.D4EEE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline2 Link : http://ghc.haskell.org/trac/ghc/changeset/0e8375372bf830459dd4aeaa7159a72b582d5b64/ghc >--------------------------------------------------------------- commit 0e8375372bf830459dd4aeaa7159a72b582d5b64 Author: Simon Peyton Jones Date: Thu Feb 9 09:35:19 2017 +0000 More tracing in SpecConstr >--------------------------------------------------------------- 0e8375372bf830459dd4aeaa7159a72b582d5b64 compiler/specialise/SpecConstr.hs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/compiler/specialise/SpecConstr.hs b/compiler/specialise/SpecConstr.hs index 15c031b..8a3e227 100644 --- a/compiler/specialise/SpecConstr.hs +++ b/compiler/specialise/SpecConstr.hs @@ -1346,7 +1346,8 @@ scTopBind env body_usage (Rec prs) , not force_spec , not (all (couldBeSmallEnoughToInline (sc_dflags env) threshold) rhss) -- No specialisation - = do { (rhs_usgs, rhss') <- mapAndUnzipM (scExpr env) rhss + = -- pprTrace "scTopBind: nospec" (ppr bndrs) $ + do { (rhs_usgs, rhss') <- mapAndUnzipM (scExpr env) rhss ; return (body_usage `combineUsage` combineUsages rhs_usgs, Rec (bndrs `zip` rhss')) } | otherwise -- Do specialisation @@ -1469,7 +1470,10 @@ specRec top_lvl env body_usg rhs_infos -- Loop, specialising, until you get no new specialisations go seed_calls usg_so_far spec_infos | isEmptyVarEnv seed_calls - = return (usg_so_far, spec_infos) + = -- pprTrace "specRec" (vcat [ ppr (map ri_fn rhs_infos) + -- , ppr seed_calls + -- , ppr body_usg ]) $ + return (usg_so_far, spec_infos) | otherwise = do { specs_w_usg <- zipWithM (specialise env seed_calls) rhs_infos spec_infos ; let (extra_usg_s, new_spec_infos) = unzip specs_w_usg @@ -1499,11 +1503,13 @@ specialise env bind_calls (RI { ri_fn = fn, ri_lam_bndrs = arg_bndrs spec_info@(SI specs spec_count mb_unspec) | isBottomingId fn -- Note [Do not specialise diverging functions] -- and do not generate specialisation seeds from its RHS - = return (nullUsage, spec_info) + = -- pprTrace "specialise bot" (ppr fn) $ + return (nullUsage, spec_info) | isNeverActive (idInlineActivation fn) -- See Note [Transfer activation] || null arg_bndrs -- Only specialise functions - = case mb_unspec of -- Behave as if there was a single, boring call + = -- pprTrace "specialise inactive" (ppr fn) $ + case mb_unspec of -- Behave as if there was a single, boring call Just rhs_usg -> return (rhs_usg, SI specs spec_count Nothing) -- See Note [spec_usg includes rhs_usg] Nothing -> return (nullUsage, spec_info) From git at git.haskell.org Tue Feb 21 23:26:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Feb 2017 23:26:38 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline2: Occurrence-analyse the result of rule firings (0323300) Message-ID: <20170221232638.2B7063A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline2 Link : http://ghc.haskell.org/trac/ghc/changeset/032330075cb2e994c08e764a5626e4a6cbd88737/ghc >--------------------------------------------------------------- commit 032330075cb2e994c08e764a5626e4a6cbd88737 Author: Simon Peyton Jones Date: Tue Feb 14 13:29:40 2017 +0000 Occurrence-analyse the result of rule firings When studying simplCore/should_compile/T7785 I found that a long chain of maps map f (map f (map f (map f (...)))) took an unreasonably long time to simplify. The problem got worse when I started inlining in the InitialPhase, which is how I stumbled on it. The solution turned out to be rather simple. It's described in Note [Occurence-analyse after rule firing] in Simplify.hs >--------------------------------------------------------------- 032330075cb2e994c08e764a5626e4a6cbd88737 compiler/simplCore/Simplify.hs | 68 ++++++++++++++++++++++++++++++++++++++++-- compiler/specialise/Rules.hs | 9 ++---- 2 files changed, 68 insertions(+), 9 deletions(-) diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index 2ad080d..1974d3b 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -15,6 +15,7 @@ import SimplMonad import Type hiding ( substTy, substTyVar, extendTvSubst, extendCvSubst ) import SimplEnv import SimplUtils +import OccurAnal ( occurAnalyseExpr ) import FamInstEnv ( FamInstEnv ) import Literal ( litIsLifted ) --, mkMachInt ) -- temporalily commented out. See #8326 import Id @@ -1803,9 +1804,13 @@ tryRules env rules fn args call_cont ; let cont' = pushSimplifiedArgs env (drop (ruleArity rule) args) call_cont - -- (ruleArity rule) says how many args the rule consumed + -- (ruleArity rule) says how + -- many args the rule consumed + + occ_anald_rhs = occurAnalyseExpr rule_rhs + -- See Note [Occurence-analyse after rule firing] ; dump dflags rule rule_rhs - ; return (Just (rule_rhs, cont')) }}} + ; return (Just (occ_anald_rhs, cont')) }}} where dump dflags rule rule_rhs | dopt Opt_D_dump_rule_rewrites dflags @@ -1836,7 +1841,64 @@ tryRules env rules fn args call_cont = liftIO . dumpSDoc dflags alwaysQualify flag "" $ sep [text hdr, nest 4 details] -{- +{- Note [Occurence-analyse after rule firing] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +After firing a rule, we occurrence-analyse the instantiated RHS before +simplifying it. Usually this doesn't make much difference, but it can +be huge. Here's an example (simplCore/should_compile/T7785) + + map f (map f (map f xs) + += -- Use build/fold form of map, twice + map f (build (\cn. foldr (mapFB c f) n + (build (\cn. foldr (mapFB c f) n xs)))) + += -- Apply fold/build rule + map f (build (\cn. (\cn. foldr (mapFB c f) n xs) (mapFB c f) n)) + += -- Beta-reduce + -- Alas we have no occurrence-analysed, so we don't know + -- that c is used exactly once + map f (build (\cn. let c1 = mapFB c f in + foldr (mapFB c1 f) n xs)) + += -- Use mapFB rule: mapFB (mapFB c f) g = mapFB c (f.g) + -- We can do this becuase (mapFB c n) is a PAP and hence expandable + map f (build (\cn. let c1 = mapFB c n in + foldr (mapFB c (f.f)) n x)) + +This is not too bad. But now do the same with the outer map, and +we get another use of mapFB, and t can interact with /both/ remaining +mapFB calls in the above expression. This is stupid because actually +that 'c1' binding is dead. The outer map introduces another c2. If +there is a deep stack of maps we get lots of dead bindings, and lots +of redundant work as we repeatedly simplify the result of firing rules. + +The easy thing to do is simply to occurrence analyse the result of +the rule firing. Not that this occ-anals not only the RHS of the +rule, but also the function arguments, which by now are OutExprs. +E.g. + RULE f (g x) = x+1 + +Call f (g BIG) --> (\x. x+1) BIG + +The rule binders are lambda-bound and applied to the OutExpr arguments +(here BIG) which lack all internal occurrence info. + +Is this inefficient? Not really: we are about to walk over the result +of the rule firing to simplify it, so occurrence analysis is at most +a constant factor. + +Possible improvement: occ-anal the rules when putting them in the +database; and in the simplifier just occ-anal the OutExpr arguments. +But that's more complicated and the rule RHS is usually tiny; so I'm +just doing the simple thing. + +Historical note: previously we did occ-anal the rules in Rule.hs, +but failed to occ-anal the OutExpr arguments, which led to the +nasty performance problem described above. + + Note [Optimising tagToEnum#] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If we have an enumeration data type: diff --git a/compiler/specialise/Rules.hs b/compiler/specialise/Rules.hs index ae0798a..2ad4e1c 100644 --- a/compiler/specialise/Rules.hs +++ b/compiler/specialise/Rules.hs @@ -31,7 +31,6 @@ module Rules ( import CoreSyn -- All of it import Module ( Module, ModuleSet, elemModuleSet ) import CoreSubst -import OccurAnal ( occurAnalyseExpr ) import CoreFVs ( exprFreeVars, exprsFreeVars, bindFreeVars , rulesFreeVarsDSet, exprsOrphNames, exprFreeVarsList ) import CoreUtils ( exprType, eqExpr, mkTick, mkTicks, @@ -172,7 +171,7 @@ mkRule :: Module -> Bool -> Bool -> RuleName -> Activation mkRule this_mod is_auto is_local name act fn bndrs args rhs = Rule { ru_name = name, ru_fn = fn, ru_act = act, ru_bndrs = bndrs, ru_args = args, - ru_rhs = occurAnalyseExpr rhs, + ru_rhs = rhs, ru_rough = roughTopNames args, ru_origin = this_mod, ru_orphan = orph, @@ -508,8 +507,7 @@ matchRule dflags rule_env _is_active fn args _rough_args -- Built-in rules can't be switched off, it seems = case match_fn dflags rule_env fn args of Nothing -> Nothing - Just expr -> Just (occurAnalyseExpr expr) - -- We could do this when putting things into the rulebase, I guess + Just expr -> Just expr matchRule _ in_scope is_active _ args rough_args (Rule { ru_name = rule_name, ru_act = act, ru_rough = tpl_tops @@ -522,8 +520,7 @@ matchRule _ in_scope is_active _ args rough_args Just (bind_wrapper, tpl_vals) -> Just (bind_wrapper $ rule_fn `mkApps` tpl_vals) where - rule_fn = occurAnalyseExpr (mkLams tpl_vars rhs) - -- We could do this when putting things into the rulebase, I guess + rule_fn = mkLams tpl_vars rhs --------------------------------------- matchN :: InScopeEnv From git at git.haskell.org Tue Feb 21 23:26:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Feb 2017 23:26:43 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline2: Add -fspec-constr-keen (1b8d12b) Message-ID: <20170221232643.900E13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline2 Link : http://ghc.haskell.org/trac/ghc/changeset/1b8d12b97f8fbdefc1a31dfa17a1f7d57a04bfb2/ghc >--------------------------------------------------------------- commit 1b8d12b97f8fbdefc1a31dfa17a1f7d57a04bfb2 Author: Simon Peyton Jones Date: Tue Feb 14 13:08:00 2017 +0000 Add -fspec-constr-keen I dicovered that the dramatic imprvoement in perf/should_run/T9339 with the introduction of join points was really rather a fluke, and very fragile. The real problem (see Note [Making SpecConstr keener]) is that SpecConstr wasn't specialising a function even though it was applied to a freshly-allocated constructor. The paper describes plausible reasons for this, but I think it may well be better to be a bit more aggressive. So this patch add -fspec-constr-keen, which makes SpecConstr a bit keener to specialise, by ignoring whether or not the argument corresponding to a call pattern is scrutinised in the function body. Now the gains in T9339 should be robust; and it might even be a better default. I'd be interested in what happens if we switched on -fspec-constr-keen with -O2. >--------------------------------------------------------------- 1b8d12b97f8fbdefc1a31dfa17a1f7d57a04bfb2 compiler/main/DynFlags.hs | 2 ++ compiler/specialise/SpecConstr.hs | 57 +++++++++++++++++++++++++++++---- docs/users_guide/using-optimisation.rst | 12 ++++++- testsuite/tests/perf/should_run/all.T | 4 ++- 4 files changed, 66 insertions(+), 9 deletions(-) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index d3d0ac3..442bbb9 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -432,6 +432,7 @@ data GeneralFlag | Opt_StgCSE | Opt_LiberateCase | Opt_SpecConstr + | Opt_SpecConstrKeen | Opt_DoLambdaEtaExpansion | Opt_IgnoreAsserts | Opt_DoEtaReduction @@ -3684,6 +3685,7 @@ fFlagsDeps = [ (useInstead "enable-rewrite-rules"), flagSpec "shared-implib" Opt_SharedImplib, flagSpec "spec-constr" Opt_SpecConstr, + flagSpec "spec-constr-keen" Opt_SpecConstrKeen, flagSpec "specialise" Opt_Specialise, flagSpec "specialize" Opt_Specialise, flagSpec "specialise-aggressively" Opt_SpecialiseAggressively, diff --git a/compiler/specialise/SpecConstr.hs b/compiler/specialise/SpecConstr.hs index 8a3e227..a68955e 100644 --- a/compiler/specialise/SpecConstr.hs +++ b/compiler/specialise/SpecConstr.hs @@ -41,7 +41,8 @@ import VarEnv import VarSet import Name import BasicTypes -import DynFlags ( DynFlags(..), hasPprDebug ) +import DynFlags ( DynFlags(..), GeneralFlag( Opt_SpecConstrKeen ) + , gopt, hasPprDebug ) import Maybes ( orElse, catMaybes, isJust, isNothing ) import Demand import GHC.Serialized ( deserializeWithData ) @@ -447,7 +448,6 @@ breaks an invariant. Note [Forcing specialisation] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - With stream fusion and in other similar cases, we want to fully specialise some (but not necessarily all!) loops regardless of their size and the number of specialisations. @@ -754,6 +754,39 @@ into a work-free value again, thus a'_shr = (a1, x_af7) but that's more work, so until its shown to be important I'm going to leave it for now. + +Note [Making SpecConstr keener] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Consider this, in (perf/should_run/T9339) + last (filter odd [1..1000]) + +After optimisation, including SpecConstr, we get: + f :: Int# -> Int -> Int + f x y = case case remInt# x 2# of + __DEFAULT -> case x of + __DEFAULT -> f (+# wild_Xp 1#) (I# x) + 1000000# -> ... + 0# -> case x of + __DEFAULT -> f (+# wild_Xp 1#) y + 1000000# -> y + +Not good! We build an (I# x) box every time around the loop. +SpecConstr (as described in the paper) does not specialise f, despite +the call (f ... (I# x)) because 'y' is not scrutinied in the body. +But it is much better to specialise f for the case where the argument +is of form (I# x); then we build the box only when returning y, which +is on the cold path. + +Another exmaple: + + f x = ...(g x).... + +Here 'x' is not scrutinised in f's body; but if we did specialise 'f' +then the call (g x) might allow 'g' to be specialised in turn. + +So sc_keen controls whether or not we take account of whether argument is +scrutinised in the body. True <=> ignore that, and speicalise whenever +the function is applied to a data constructor. -} data ScEnv = SCE { sc_dflags :: DynFlags, @@ -765,6 +798,11 @@ data ScEnv = SCE { sc_dflags :: DynFlags, sc_recursive :: Int, -- Max # of specialisations over recursive type. -- Stops ForceSpecConstr from diverging. + sc_keen :: Bool, -- Specialise on arguments that are known + -- constructorss, even if they are not + -- scrutinised in the body. See + -- Note [Making SpecConstr keener] + sc_force :: Bool, -- Force specialisation? -- See Note [Forcing specialisation] @@ -807,6 +845,7 @@ initScEnv dflags this_mod anns sc_size = specConstrThreshold dflags, sc_count = specConstrCount dflags, sc_recursive = specConstrRecursive dflags, + sc_keen = gopt Opt_SpecConstrKeen dflags, sc_force = False, sc_subst = emptySubst, sc_how_bound = emptyVarEnv, @@ -1976,11 +2015,12 @@ argToPat env in_scope val_env arg arg_occ mkConApp dc (ty_args ++ args')) } where mb_scrut dc = case arg_occ of - ScrutOcc bs - | Just occs <- lookupUFM bs dc - -> Just (occs) -- See Note [Reboxing] - _other | sc_force env -> Just (repeat UnkOcc) - | otherwise -> Nothing + ScrutOcc bs | Just occs <- lookupUFM bs dc + -> Just (occs) -- See Note [Reboxing] + _other | sc_force env || sc_keen env + -> Just (repeat UnkOcc) + | otherwise + -> Nothing -- Check if the argument is a variable that -- (a) is used in an interesting way in the function body @@ -1989,6 +2029,9 @@ argToPat env in_scope val_env arg arg_occ argToPat env in_scope val_env (Var v) arg_occ | sc_force env || case arg_occ of { UnkOcc -> False; _other -> True }, -- (a) is_value, -- (b) + -- Ignoring sc_keen here to avoid gratuitously incurring Note [Reboxing] + -- So sc_keen focused just on f (I# x), where we have freshly-allocated + -- box that we can eliminate in the caller not (ignoreType env (varType v)) = return (True, Var v) where diff --git a/docs/users_guide/using-optimisation.rst b/docs/users_guide/using-optimisation.rst index 9436832..e56c473 100644 --- a/docs/users_guide/using-optimisation.rst +++ b/docs/users_guide/using-optimisation.rst @@ -522,7 +522,7 @@ list. Turn on call-pattern specialisation; see `Call-pattern specialisation for Haskell programs - `__. + `__. This optimisation specializes recursive functions according to their argument "shapes". This is best explained by example so consider: :: @@ -580,6 +580,16 @@ list. body directly, allowing heavy specialisation over the recursive cases. +.. ghc-flag:: -fspec-constr-keen + + :default: off + + If this flag is on, call-patten specialision will specialise a call + ``(f (Just x))`` with an explicit constructor agument, even if the argument + is not scrutinised in the body of the function. This is sometimes + beneficial; e.g. the argument might be given to some other function + that can itself be specialised. + .. ghc-flag:: -fspec-constr-count= :default: 3 diff --git a/testsuite/tests/perf/should_run/all.T b/testsuite/tests/perf/should_run/all.T index 27d8df8..dc354e9 100644 --- a/testsuite/tests/perf/should_run/all.T +++ b/testsuite/tests/perf/should_run/all.T @@ -456,7 +456,9 @@ test('T9339', # 2016-08-17: 50728 Join points (#12988) only_ways(['normal'])], compile_and_run, - ['-O2']) + ['-O2 -fspec-constr-keen']) + # For the -fspec-constr-keen see Note [Making SpecConstr keener] in SpecConstr + test('T8472', [stats_num_field('bytes allocated', From git at git.haskell.org Tue Feb 21 23:26:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Feb 2017 23:26:46 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline2: Make Specialise work with casts (fe912e0) Message-ID: <20170221232646.4B8B43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline2 Link : http://ghc.haskell.org/trac/ghc/changeset/fe912e0dc9d848162600cc4269b4943331ea28c3/ghc >--------------------------------------------------------------- commit fe912e0dc9d848162600cc4269b4943331ea28c3 Author: Simon Peyton Jones Date: Tue Feb 14 13:47:13 2017 +0000 Make Specialise work with casts With my upcoming early-inlining patch it turned out that Specialise was getting stuck on casts. This patch fixes it; see Specialise [Account for casts in binding]. >--------------------------------------------------------------- fe912e0dc9d848162600cc4269b4943331ea28c3 compiler/coreSyn/CoreSubst.hs | 49 +++++++++++++++++++++++++++++++++++++-- compiler/specialise/Specialise.hs | 35 +++++++++++++++++++++------- 2 files changed, 73 insertions(+), 11 deletions(-) diff --git a/compiler/coreSyn/CoreSubst.hs b/compiler/coreSyn/CoreSubst.hs index 89a92f8..6afa3ba 100644 --- a/compiler/coreSyn/CoreSubst.hs +++ b/compiler/coreSyn/CoreSubst.hs @@ -34,7 +34,7 @@ module CoreSubst ( -- ** Simple expression optimiser simpleOptPgm, simpleOptExpr, simpleOptExprWith, exprIsConApp_maybe, exprIsLiteral_maybe, exprIsLambda_maybe, - pushCoArg, pushCoValArg, pushCoTyArg + pushCoArg, pushCoValArg, pushCoTyArg, collectBindersPushingCo ) where #include "HsVersions.h" @@ -1605,7 +1605,7 @@ exprIsLambda_maybe _ _e Here we implement the "push rules" from FC papers: -* The push-argument ules, where we can move a coercion past an argument. +* The push-argument rules, where we can move a coercion past an argument. We have (fun |> co) arg and we want to transform it to @@ -1775,3 +1775,48 @@ pushCoDataCon dc dc_args co where Pair from_ty to_ty = coercionKind co + +collectBindersPushingCo :: CoreExpr -> ([Var], CoreExpr) +-- Collect lambda binders, pushing coercions inside if possible +-- E..g (\x.e) |> g g :: -> blah +-- = (\x. e |> Nth 1 g) +collectBindersPushingCo e + = go [] e + where + go :: [Var] -> CoreExpr -> ([Var], CoreExpr) + -- The accumulator is in reverse order + go bs (Lam b e) = go (b:bs) e + go bs (Cast e co) = go_c bs e co + go bs e = (reverse bs, e) + + go_c :: [Var] -> CoreExpr -> Coercion -> ([Var], CoreExpr) + -- (go_c bs e c) is same as (go bs e (e |> c)) + go_c bs (Cast e co1) co2 = go_c bs e (co1 `mkTransCo` co2) + go_c bs (Lam b e) co = go_lam bs b e co + go_c bs e co = (reverse bs, mkCast e co) + + go_lam :: [Var] -> Var -> CoreExpr -> Coercion -> ([Var], CoreExpr) + -- (go_lam bs b e c) is same as (go_c bs (\b.e) c) + go_lam bs b e co + | isTyVar b + , let Pair tyL tyR = coercionKind co + , ASSERT( isForAllTy tyL ) + isForAllTy tyR + , isReflCo (mkNthCo 0 co) -- See Note [collectBindersPushingCo] + = go_c (b:bs) e (mkInstCo co (mkNomReflCo (mkTyVarTy b))) + + | isId b + , let Pair tyL tyR = coercionKind co + , ASSERT( isFunTy tyL) isFunTy tyR + , isReflCo (mkNthCo 0 co) -- See Note [collectBindersPushingCo] + = go_c (b:bs) e (mkNthCo 1 co) + + | otherwise = (reverse bs, mkCast (Lam b e) co) + +{- Note [collectBindersPushingCo] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +We just look for coercions of form + -> blah +(and similarly for foralls) to keep this function simple. We could do +more elaborate stuff, but it'd involve substitution etc. +-} diff --git a/compiler/specialise/Specialise.hs b/compiler/specialise/Specialise.hs index 3f937c2..fb3c7cc 100644 --- a/compiler/specialise/Specialise.hs +++ b/compiler/specialise/Specialise.hs @@ -1153,8 +1153,8 @@ specCalls :: Maybe Module -- Just this_mod => specialising imported fn specCalls mb_mod env rules_for_me calls_for_me fn rhs -- The first case is the interesting one - | rhs_tyvars `lengthIs` n_tyvars -- Rhs of fn's defn has right number of big lambdas - && rhs_ids `lengthAtLeast` n_dicts -- and enough dict args + | rhs_tyvars `lengthIs` n_tyvars -- Rhs of fn's defn has right number of big lambdas + && rhs_bndrs1 `lengthAtLeast` n_dicts -- and enough dict args && notNull calls_for_me -- And there are some calls to specialise && not (isNeverActive (idInlineActivation fn)) -- Don't specialise NOINLINE things @@ -1178,7 +1178,7 @@ specCalls mb_mod env rules_for_me calls_for_me fn rhs return ([], [], emptyUDs) where _trace_doc = sep [ ppr rhs_tyvars, ppr n_tyvars - , ppr rhs_ids, ppr n_dicts + , ppr rhs_bndrs, ppr n_dicts , ppr (idInlineActivation fn) ] fn_type = idType fn @@ -1194,11 +1194,12 @@ specCalls mb_mod env rules_for_me calls_for_me fn rhs -- Figure out whether the function has an INLINE pragma -- See Note [Inline specialisations] - (rhs_tyvars, rhs_ids, rhs_body) = collectTyAndValBinders rhs - - rhs_dict_ids = take n_dicts rhs_ids - body = mkLams (drop n_dicts rhs_ids) rhs_body - -- Glue back on the non-dict lambdas + (rhs_bndrs, rhs_body) = CoreSubst.collectBindersPushingCo rhs + -- See Note [Account for casts in binding] + (rhs_tyvars, rhs_bndrs1) = span isTyVar rhs_bndrs + (rhs_dict_ids, rhs_bndrs2) = splitAt n_dicts rhs_bndrs1 + body = mkLams rhs_bndrs2 rhs_body + -- Glue back on the non-dict lambdas already_covered :: DynFlags -> [CoreExpr] -> Bool already_covered dflags args -- Note [Specialisations already covered] @@ -1350,7 +1351,23 @@ specCalls mb_mod env rules_for_me calls_for_me fn rhs ; return (Just ((spec_f_w_arity, spec_rhs), final_uds, spec_env_rule)) } } -{- Note [Evidence foralls] +{- Note [Account for casts in binding] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Consider + f :: Eq a => a -> IO () + {-# INLINABLE f + StableUnf = (/\a \(d:Eq a) (x:a). blah) |> g + #-} + f = ... + +In f's stable unfolding we have done some modest simplification which +has pushed the cast to the outside. (I wonder if this is the Right +Thing, but it's what happens now; see SimplUtils Note [Casts and +lambdas].) Now that stable unfolding must be specialised, so we want +to push the cast back inside. It would be terrible if the cast +defeated specialisation! Hence the use of collectBindersPushingCo. + +Note [Evidence foralls] ~~~~~~~~~~~~~~~~~~~~~~~~~~ Suppose (Trac #12212) that we are specialising f :: forall a b. (Num a, F a ~ F b) => blah From git at git.haskell.org Tue Feb 21 23:26:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Feb 2017 23:26:51 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline2: Inline data constructor wrappers in phase 2 only (3dcbc97) Message-ID: <20170221232651.CC1913A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline2 Link : http://ghc.haskell.org/trac/ghc/changeset/3dcbc9768ef06bb8d1d07a1a57988ab47224b041/ghc >--------------------------------------------------------------- commit 3dcbc9768ef06bb8d1d07a1a57988ab47224b041 Author: Simon Peyton Jones Date: Tue Feb 14 13:49:13 2017 +0000 Inline data constructor wrappers in phase 2 only This patch prepares for my upcoming early-inlining patch. It arranges that data constructor wrappers are not inlined until Phase 2 (the first of the "normal" phases.) That gives rules a chance to fire in the InitialPhase (aka "gentle"). This has been a bit of a problem for a while, so it's nice to have a fix. It should make no difference immediately, becuase currently nothing is inlined in the InitialPhase anyway. >--------------------------------------------------------------- 3dcbc9768ef06bb8d1d07a1a57988ab47224b041 compiler/basicTypes/MkId.hs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/compiler/basicTypes/MkId.hs b/compiler/basicTypes/MkId.hs index 8a204be..388f5eb 100644 --- a/compiler/basicTypes/MkId.hs +++ b/compiler/basicTypes/MkId.hs @@ -518,7 +518,7 @@ mkDataConRep dflags fam_envs wrap_name mb_bangs data_con `setArityInfo` wrap_arity -- It's important to specify the arity, so that partial -- applications are treated as values - `setInlinePragInfo` alwaysInlinePragma + `setInlinePragInfo` wrap_prag `setUnfoldingInfo` wrap_unf `setStrictnessInfo` wrap_sig -- We need to get the CAF info right here because TidyPgm @@ -527,10 +527,15 @@ mkDataConRep dflags fam_envs wrap_name mb_bangs data_con `setNeverLevPoly` wrap_ty wrap_sig = mkClosedStrictSig wrap_arg_dmds (dataConCPR data_con) + wrap_arg_dmds = map mk_dmd arg_ibangs mk_dmd str | isBanged str = evalDmd | otherwise = topDmd + wrap_prag = alwaysInlinePragma `setInlinePragmaActivation` + ActiveAfter NoSourceText 2 + -- See Note [Activation for data constructor wrappers] + -- The wrapper will usually be inlined (see wrap_unf), so its -- strictness and CPR info is usually irrelevant. But this is -- not always the case; GHC may choose not to inline it. In @@ -620,7 +625,20 @@ mkDataConRep dflags fam_envs wrap_name mb_bangs data_con ; expr <- mk_rep_app prs (mkVarApps con_app rep_ids) ; return (unbox_fn expr) } -{- +{- Note [Activation for data constructor wrappers] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +The Activation on a data constructor wrapper allows it to inline in +Phase 2 and later (1, 0). But not in the InitialPhase. That gives +rewrite rules a chance to fire (in the InitialPhase) if they mention +a data constructor on the left + RULE "foo" f (K a b) = ... +Since the LHS of rules are simplified with InitialPhase, we won't +inline the wrapper on the LHS either. + +People have asked for this before, but now that even the InitialPhase +does some inlining, it has become important. + + Note [Bangs on imported data constructors] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From git at git.haskell.org Tue Feb 21 23:26:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Feb 2017 23:26:49 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline2: Stop uniques ending up in SPEC rule names (368d882) Message-ID: <20170221232649.219433A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline2 Link : http://ghc.haskell.org/trac/ghc/changeset/368d882c66a8f85d16e91fb42930e45c39cfc342/ghc >--------------------------------------------------------------- commit 368d882c66a8f85d16e91fb42930e45c39cfc342 Author: Simon Peyton Jones Date: Tue Feb 14 13:33:36 2017 +0000 Stop uniques ending up in SPEC rule names >--------------------------------------------------------------- 368d882c66a8f85d16e91fb42930e45c39cfc342 compiler/specialise/Specialise.hs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/compiler/specialise/Specialise.hs b/compiler/specialise/Specialise.hs index 0090417..3f937c2 100644 --- a/compiler/specialise/Specialise.hs +++ b/compiler/specialise/Specialise.hs @@ -1293,10 +1293,11 @@ specCalls mb_mod env rules_for_me calls_for_me fn rhs Just this_mod -- Specialising imoprted fn -> text "SPEC/" <> ppr this_mod - rule_name = mkFastString $ showSDocForUser dflags neverQualify $ - herald <+> ppr fn <+> hsep (map ppr_call_key_ty call_ts) - -- This name ends up in interface files, so use showSDocForUser, - -- otherwise uniques end up there, making builds + rule_name = mkFastString $ showSDoc dflags $ + herald <+> text (occNameString (getOccName fn)) + <+> hsep (map ppr_call_key_ty call_ts) + -- This name ends up in interface files, so use occNameString. + -- Otherwise uniques end up there, making builds -- less deterministic (See #4012 comment:61 ff) rule_wout_eta = mkRule From git at git.haskell.org Tue Feb 21 23:26:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Feb 2017 23:26:54 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline2: Refactor floating of bindings (fiBind) (5e91669) Message-ID: <20170221232654.8A06D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline2 Link : http://ghc.haskell.org/trac/ghc/changeset/5e91669c8ccbad353553d8e8308682e0e9e07c70/ghc >--------------------------------------------------------------- commit 5e91669c8ccbad353553d8e8308682e0e9e07c70 Author: Simon Peyton Jones Date: Tue Feb 14 12:18:38 2017 +0000 Refactor floating of bindings (fiBind) This is just a local refactoring. I originally planned to try floating top-level bindings inwards, but I backed off from that leaving only this (harmless) refactoring, which has no behavioural effect. I also make FloatIn into a ModGuts -> ModGuts function; again not necessary now, but no harm either. My attempt also used the new function CoreFVs.freeVarsBind; but that too is a plausible refactorig of freeVars, so I left it in too. >--------------------------------------------------------------- 5e91669c8ccbad353553d8e8308682e0e9e07c70 compiler/coreSyn/CoreFVs.hs | 57 +++++++------- compiler/simplCore/FloatIn.hs | 173 +++++++++++++++++++++++------------------- 2 files changed, 125 insertions(+), 105 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 5e91669c8ccbad353553d8e8308682e0e9e07c70 From git at git.haskell.org Tue Feb 21 23:26:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Feb 2017 23:26:57 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline2: Combine identical case alterantives in CSE (46b6ac6) Message-ID: <20170221232657.3A3CB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline2 Link : http://ghc.haskell.org/trac/ghc/changeset/46b6ac610237c696b9a77c329c7746324330ab9d/ghc >--------------------------------------------------------------- commit 46b6ac610237c696b9a77c329c7746324330ab9d Author: Simon Peyton Jones Date: Tue Feb 14 13:59:04 2017 +0000 Combine identical case alterantives in CSE See Note [Combine case alternatives] in CSE. This opportunity surfaced when I was was studying early inlining. It's easy (and cheap) to exploit, and sometimes makes a worthwhile saving. >--------------------------------------------------------------- 46b6ac610237c696b9a77c329c7746324330ab9d compiler/simplCore/CSE.hs | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/compiler/simplCore/CSE.hs b/compiler/simplCore/CSE.hs index 80013a3..31532af 100644 --- a/compiler/simplCore/CSE.hs +++ b/compiler/simplCore/CSE.hs @@ -392,7 +392,8 @@ cseExpr env (Case e bndr ty alts) = cseCase env e bndr ty alts cseCase :: CSEnv -> InExpr -> InId -> InType -> [InAlt] -> OutExpr cseCase env scrut bndr ty alts - = Case scrut1 bndr3 ty' (map cse_alt alts) + = Case scrut1 bndr3 ty' $ + combineAlts alt_env (map cse_alt alts) where ty' = substTy (csEnvSubst env) ty scrut1 = tryForCSE False env scrut @@ -429,7 +430,43 @@ cseCase env scrut bndr ty alts where (env', args') = addBinders alt_env args -{- +combineAlts :: CSEnv -> [InAlt] -> [InAlt] +-- See Note [Combine case alternatives] +combineAlts env ((_,bndrs1,rhs1) : rest_alts) + | all isDeadBinder bndrs1 + , LT <- filtered_alts `compareLength` rest_alts + = (DEFAULT, [], rhs1) : filtered_alts + where + in_scope = substInScope (csEnvSubst env) + filtered_alts = filterOut identical rest_alts + identical (_con, bndrs, rhs) = all ok bndrs && eqExpr in_scope rhs1 rhs + ok bndr = isDeadBinder bndr || not (bndr `elemInScopeSet` in_scope) + +combineAlts _ alts = alts -- Default case + +{- Note [Combine case alternatives] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +combineCaseAlts is just a more heavyweight version of the use of +combineIdentialAlts in SimplUtils.prepareAlts. The basic idea is +to transform + + DEFAULT -> e1 + K x -> e1 + W y z -> e2 +===> + DEFAULT -> e1 + W y z -> e2 + +In the simplifier we use cheapEqExpr, because it is called a lot. +But here in CSE we use the full eqExpr. After all, two alterantives usually +differ near the root, so it probably isn't expensive to compare the full +alternative. It seems like the the same kind of thing that CSE is supposed +to be doing, which is why I put it here. + +I acutally saw some examples in the wild, where some inlining made e1 too +big for cheapEqExpr to catch it. + + ************************************************************************ * * \section{The CSE envt} From git at git.haskell.org Tue Feb 21 23:26:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Feb 2017 23:26:59 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline2: Extend CSE to handle recursive bindings (f484a24) Message-ID: <20170221232659.DDB113A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline2 Link : http://ghc.haskell.org/trac/ghc/changeset/f484a24716acb9eccf10dfd11f8a25ca01df056c/ghc >--------------------------------------------------------------- commit f484a24716acb9eccf10dfd11f8a25ca01df056c Author: Simon Peyton Jones Date: Tue Feb 14 14:07:39 2017 +0000 Extend CSE to handle recursive bindings I came across a program with two identical recursive bindings, so I wondered if they could be CSE'd. It turned out to be pretty easy so I did it. See Note [CSE for recursive bindings] in CSE >--------------------------------------------------------------- f484a24716acb9eccf10dfd11f8a25ca01df056c compiler/simplCore/CSE.hs | 92 ++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 76 insertions(+), 16 deletions(-) diff --git a/compiler/simplCore/CSE.hs b/compiler/simplCore/CSE.hs index 31532af..012607a 100644 --- a/compiler/simplCore/CSE.hs +++ b/compiler/simplCore/CSE.hs @@ -12,16 +12,18 @@ module CSE (cseProgram, cseOneExpr) where import CoreSubst import Var ( Var, isJoinId ) -import Id ( Id, idType, idUnfolding, idInlineActivation - , zapIdOccInfo, zapIdUsageInfo ) -import CoreUtils ( mkAltExpr +import VarEnv ( elemInScopeSet ) +import Id ( Id, idType, idInlineActivation, isDeadBinder + , zapIdOccInfo, zapIdUsageInfo, idInlinePragma ) +import CoreUtils ( mkAltExpr, eqExpr , exprIsLiteralString , stripTicksE, stripTicksT, mkTicks ) import Literal ( litIsTrivial ) import Type ( tyConAppArgs ) import CoreSyn import Outputable -import BasicTypes ( isAlwaysActive ) +import Util ( compareLength, filterOut ) +import BasicTypes ( isAlwaysActive, isAnyInlinePragma ) import TrieMap import Data.List ( mapAccumL ) @@ -258,6 +260,27 @@ We could try and be careful by tracking which join points are still valid at each subexpression, but since join points aren't allocated or shared, there's less to gain by trying to CSE them. +Note [CSE for recursive bindings] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Consider + f = \x ... f.... + g = \y ... g ... +where the "..." are identical. Could we CSE them? In full generality +with mutual recursion it's quite hard; but for self-recursive bindings +(which are very common) it's rather easy: + +* Maintain a separate cs_rec_map, that maps + (\f. (\x. ...f...) ) -> f + Note the \f in the domain of the mapping! + +* When we come across the binding for 'g', look up (\g. (\y. ...g...)) + Bingo we get a hit. So we can repace the 'g' binding with + g = f + +We can't use cs_map for this, because the key isn't an expression of +the program; it's a kind of synthetic key for recursive bindings. + + ************************************************************************ * * \section{Common subexpression} @@ -276,6 +299,26 @@ cseBind toplevel env (NonRec b e) (env1, b1) = addBinder env b (env2, b2) = addBinding env1 b b1 e1 +cseBind _ env (Rec [(in_id, rhs)]) + | noCSE in_id + = (env1, Rec [(out_id, rhs')]) + + -- See Note [CSE for recursive bindings] + | Just previous <- lookupCSRecEnv env out_id rhs'' + , let previous' = mkTicks ticks previous + = (extendCSSubst env1 in_id previous', NonRec out_id previous') + + | otherwise + = (extendCSRecEnv env1 out_id rhs'' id_expr', Rec [(zapped_id, rhs')]) + + where + (env1, [out_id]) = addRecBinders env [in_id] + rhs' = cseExpr env1 rhs + rhs'' = stripTicksE tickishFloatable rhs' + ticks = stripTicksT tickishFloatable rhs' + id_expr' = varToCoreExpr out_id + zapped_id = zapIdUsageInfo out_id + cseBind toplevel env (Rec pairs) = (env2, Rec pairs') where @@ -296,9 +339,9 @@ addBinding :: CSEnv -- Includes InId->OutId cloning -- Extend the CSE env with a mapping [rhs -> out-id] -- unless we can instead just substitute [in-id -> rhs] addBinding env in_id out_id rhs' - | no_cse = (env, out_id) - | use_subst = (extendCSSubst env in_id rhs', out_id) - | otherwise = (extendCSEnv env rhs' id_expr', zapped_id) + | noCSE in_id = (env, out_id) + | use_subst = (extendCSSubst env in_id rhs', out_id) + | otherwise = (extendCSEnv env rhs' id_expr', zapped_id) where id_expr' = varToCoreExpr out_id zapped_id = zapIdUsageInfo out_id @@ -312,13 +355,6 @@ addBinding env in_id out_id rhs' -- it is bad for performance if you don't do late demand -- analysis - no_cse = not (isAlwaysActive (idInlineActivation out_id)) - -- See Note [CSE for INLINE and NOINLINE] - || isStableUnfolding (idUnfolding out_id) - -- See Note [CSE for stable unfoldings] - || isJoinId in_id - -- See Note [CSE for join points?] - -- Should we use SUBSTITUTE or EXTEND? -- See Note [CSE for bindings] use_subst = case rhs' of @@ -326,6 +362,16 @@ addBinding env in_id out_id rhs' Lit l -> litIsTrivial l _ -> False +noCSE :: InId -> Bool +noCSE id = not (isAlwaysActive (idInlineActivation id)) + -- See Note [CSE for INLINE and NOINLINE] + || isAnyInlinePragma (idInlinePragma id) + --isStableUnfolding (idUnfolding id) + -- See Note [CSE for stable unfoldings] + || isJoinId id + -- See Note [CSE for join points?] + + {- Note [Take care with literal strings] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -373,7 +419,7 @@ tryForCSE toplevel env expr -- top of the replaced sub-expression. This is probably not too -- useful in practice, but upholds our semantics. -cseOneExpr :: CoreExpr -> CoreExpr +cseOneExpr :: InExpr -> OutExpr cseOneExpr = cseExpr emptyCSEnv cseExpr :: CSEnv -> InExpr -> OutExpr @@ -482,10 +528,14 @@ data CSEnv , cs_map :: CoreMap OutExpr -- The reverse mapping -- Maps a OutExpr to a /trivial/ OutExpr -- The key of cs_map is stripped of all Ticks + + , cs_rec_map :: CoreMap OutExpr + -- See Note [CSE for recursive bindings] } emptyCSEnv :: CSEnv -emptyCSEnv = CS { cs_map = emptyCoreMap, cs_subst = emptySubst } +emptyCSEnv = CS { cs_map = emptyCoreMap, cs_rec_map = emptyCoreMap + , cs_subst = emptySubst } lookupCSEnv :: CSEnv -> OutExpr -> Maybe OutExpr lookupCSEnv (CS { cs_map = csmap }) expr @@ -497,6 +547,16 @@ extendCSEnv cse expr triv_expr where sexpr = stripTicksE tickishFloatable expr +extendCSRecEnv :: CSEnv -> OutId -> OutExpr -> OutExpr -> CSEnv +-- See Note [CSE for recursive bindings] +extendCSRecEnv cse bndr expr triv_expr + = cse { cs_rec_map = extendCoreMap (cs_map cse) (Lam bndr expr) triv_expr } + +lookupCSRecEnv :: CSEnv -> OutId -> OutExpr -> Maybe OutExpr +-- See Note [CSE for recursive bindings] +lookupCSRecEnv (CS { cs_rec_map = csmap }) bndr expr + = lookupCoreMap csmap (Lam bndr expr) + csEnvSubst :: CSEnv -> Subst csEnvSubst = cs_subst From git at git.haskell.org Tue Feb 21 23:27:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Feb 2017 23:27:05 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline2: Small changes to expression sizing in CoreUnfold (1193b10) Message-ID: <20170221232705.4AF8E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline2 Link : http://ghc.haskell.org/trac/ghc/changeset/1193b10c2d925431bcecf0c8a71e0cad758af59a/ghc >--------------------------------------------------------------- commit 1193b10c2d925431bcecf0c8a71e0cad758af59a Author: Simon Peyton Jones Date: Tue Feb 14 14:15:01 2017 +0000 Small changes to expression sizing in CoreUnfold The only significant change here is that case e of {} should be treated like 'e', rather than like a case expression. We don't push a return address, for example, since 'e' is sure to diverge. I forget why I did this; but it will make these empty-case expressions (which are only there to satisfy the type checker) cost-free. >--------------------------------------------------------------- 1193b10c2d925431bcecf0c8a71e0cad758af59a compiler/coreSyn/CoreUnfold.hs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/compiler/coreSyn/CoreUnfold.hs b/compiler/coreSyn/CoreUnfold.hs index 71c5f0f..3b12234 100644 --- a/compiler/coreSyn/CoreUnfold.hs +++ b/compiler/coreSyn/CoreUnfold.hs @@ -534,6 +534,11 @@ sizeExpr dflags bOMB_OUT_SIZE top_args expr pairs size_up (Case e _ _ alts) + | null alts + = size_up e -- case e of {} never returns, so take size of scrutinee + + size_up (Case e _ _ alts) + -- Now alts is non-empty | Just v <- is_top_arg e -- We are scrutinising an argument variable = let alt_sizes = map size_up_alt alts @@ -558,8 +563,8 @@ sizeExpr dflags bOMB_OUT_SIZE top_args expr alts_size tot_size _ = tot_size in - alts_size (foldr addAltSize sizeZero alt_sizes) - (foldr maxSize sizeZero alt_sizes) + alts_size (foldr1 addAltSize alt_sizes) -- alts is non-empty + (foldr1 maxSize alt_sizes) -- Good to inline if an arg is scrutinised, because -- that may eliminate allocation in the caller -- And it eliminates the case itself @@ -763,6 +768,7 @@ funSize dflags top_args fun n_val_args voids res_discount | idArity fun > n_val_args = ufFunAppDiscount dflags | otherwise = 0 -- If the function is partially applied, show a result discount +-- XXX maybe behave like ConSize for eval'd varaible conSize :: DataCon -> Int -> ExprSize conSize dc n_val_args @@ -774,6 +780,8 @@ conSize dc n_val_args -- See Note [Constructor size and result discount] | otherwise = SizeIs 10 emptyBag (10 * (1 + n_val_args)) +-- XXX still looks to large to me + {- Note [Constructor size and result discount] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From git at git.haskell.org Tue Feb 21 23:27:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Feb 2017 23:27:02 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline2: Fix SetLevels for makeStaticPtr (3ca0287) Message-ID: <20170221232702.9308F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline2 Link : http://ghc.haskell.org/trac/ghc/changeset/3ca0287c527078bfc85e1db19582504f87a533cd/ghc >--------------------------------------------------------------- commit 3ca0287c527078bfc85e1db19582504f87a533cd Author: Simon Peyton Jones Date: Tue Feb 14 14:13:16 2017 +0000 Fix SetLevels for makeStaticPtr This too is prepartory for my early-inlining patch. It turned out that early inlining exposed a bug in the way that static pointers were being floated. >--------------------------------------------------------------- 3ca0287c527078bfc85e1db19582504f87a533cd compiler/simplCore/SetLevels.hs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/compiler/simplCore/SetLevels.hs b/compiler/simplCore/SetLevels.hs index 4fca18d..f681bf3 100644 --- a/compiler/simplCore/SetLevels.hs +++ b/compiler/simplCore/SetLevels.hs @@ -566,12 +566,12 @@ lvlMFE env strict_ctxt ann_expr -- or if we are wrapping it in one or more value lambdas = do { expr1 <- lvlFloatRhs abs_vars dest_lvl rhs_env NonRecursive join_arity_maybe ann_expr -- Treat the expr just like a right-hand side - ; var <- newLvlVar expr1 join_arity_maybe + ; var <- newLvlVar expr1 join_arity_maybe is_mk_static ; let var2 = annotateBotStr var float_n_lams mb_bot_str ; return (Let (NonRec (TB var2 (FloatMe dest_lvl)) expr1) (mkVarApps (Var var2) abs_vars)) } - -- OK, so the float has an unlifted type + -- OK, so the float has an unlifted type (not top-level bindable) -- and no new value lambdas (float_is_new_lam is False) -- Try for the boxing strategy -- See Note [Floating MFEs of unlifted type] @@ -588,7 +588,7 @@ lvlMFE env strict_ctxt ann_expr Case expr1 (stayPut l1r ubx_bndr) dc_res_ty [(DEFAULT, [], mkConApp dc [Var ubx_bndr])] - ; var <- newLvlVar float_rhs Nothing + ; var <- newLvlVar float_rhs Nothing is_mk_static ; let l1u = incMinorLvlFrom env use_expr = Case (mkVarApps (Var var) abs_vars) (stayPut l1u bx_bndr) expr_ty @@ -626,9 +626,12 @@ lvlMFE env strict_ctxt ann_expr join_arity_maybe | need_join = Just (length abs_vars) | otherwise = Nothing + is_mk_static = isJust (collectMakeStaticArgs expr) + -- Yuk: See Note [Grand plan for static forms] in main/StaticPtrTable + -- A decision to float entails let-binding this thing, and we only do -- that if we'll escape a value lambda, or will go to the top level. - float_me = saves_work || saves_alloc + float_me = saves_work || saves_alloc || is_mk_static -- We can save work if we can move a redex outside a value lambda -- But if float_is_new_lam is True, then the redex is wrapped in a @@ -1503,8 +1506,9 @@ newPolyBndrs dest_lvl newLvlVar :: LevelledExpr -- The RHS of the new binding -> Maybe JoinArity -- Its join arity, if it is a join point + -> Bool -- True <=> the RHS looks like (makeStatic ...) -> LvlM Id -newLvlVar lvld_rhs join_arity_maybe +newLvlVar lvld_rhs join_arity_maybe is_mk_static = do { uniq <- getUniqueM ; return (add_join_info (mk_id uniq rhs_ty)) } @@ -1515,8 +1519,7 @@ newLvlVar lvld_rhs join_arity_maybe mk_id uniq rhs_ty -- See Note [Grand plan for static forms] in StaticPtrTable. - | isJust $ collectMakeStaticArgs $ snd $ - collectTyBinders de_tagged_rhs + | is_mk_static = mkExportedVanillaId (mkSystemVarName uniq (mkFastString "static_ptr")) rhs_ty | otherwise From git at git.haskell.org Tue Feb 21 23:27:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Feb 2017 23:27:08 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline2: The Early Inline Patch (a234014) Message-ID: <20170221232708.098483A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline2 Link : http://ghc.haskell.org/trac/ghc/changeset/a23401493e8763c8f052a9e57b5c5de353173fac/ghc >--------------------------------------------------------------- commit a23401493e8763c8f052a9e57b5c5de353173fac Author: Simon Peyton Jones Date: Tue Feb 14 15:08:24 2017 +0000 The Early Inline Patch This very small patch switches on sm_inline even in the InitialPhase (aka "gentle" phase). There is no reason not to... and the results are astonishing. I think the peformance of GHC itself improves by about 5%; and some programs get much smaller, quicker. Result: across the board irmprovements in compile time performance. Here are the changes in perf/compiler; the numbers are decreases in compiler bytes-allocated: 3% T5837 7% parsing001 9% T12234 35% T9020 9% T3064 13% T9961 20% T13056 5% T9872d 5% T9872c 5% T9872b 7% T9872a 5% T783 35% T12227 20% T1969 Plus in perf/should_run 5% lazy-bs-alloc It wasn't as easy as it sounds: I did a raft of preparatory work in earlier patches. But it's great! >--------------------------------------------------------------- a23401493e8763c8f052a9e57b5c5de353173fac compiler/simplCore/SimplCore.hs | 40 ++++++++-- compiler/simplCore/SimplUtils.hs | 60 ++++++--------- .../tests/deSugar/should_compile/T2431.stderr | 2 +- .../indexed-types/should_compile/T7837.stderr | 3 +- .../tests/numeric/should_compile/T7116.stdout | 16 ++-- testsuite/tests/perf/compiler/T4007.stdout | 8 +- testsuite/tests/perf/compiler/all.T | 39 +++++++--- testsuite/tests/perf/should_run/all.T | 2 + testsuite/tests/simplCore/should_compile/Makefile | 11 ++- testsuite/tests/simplCore/should_compile/T10181.hs | 5 ++ .../tests/simplCore/should_compile/T3234.stderr | 13 ++-- .../tests/simplCore/should_compile/T3772.stdout | 88 +++++++++++----------- .../tests/simplCore/should_compile/T4138.stdout | 2 +- .../tests/simplCore/should_compile/T7360.stderr | 2 +- testsuite/tests/simplCore/should_compile/T7785.hs | 14 +++- testsuite/tests/simplCore/should_compile/T8848.hs | 13 +++- .../tests/simplCore/should_compile/T9509.stdout | 1 + testsuite/tests/simplCore/should_compile/T9509a.hs | 4 +- testsuite/tests/simplCore/should_compile/all.T | 6 +- .../tests/simplCore/should_compile/rule2.stderr | 13 ++-- testsuite/tests/simplCore/should_run/T7611.hs | 1 + .../tests/simplCore/should_run/simplrun002.hs | 8 +- .../tests/simplCore/should_run/simplrun008.hs | 6 +- 23 files changed, 208 insertions(+), 149 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 a23401493e8763c8f052a9e57b5c5de353173fac From git at git.haskell.org Tue Feb 21 23:27:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Feb 2017 23:27:10 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline2: Add VarSet.anyDVarSet, allDVarSet (49c9c5a) Message-ID: <20170221232710.B1EB93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline2 Link : http://ghc.haskell.org/trac/ghc/changeset/49c9c5ad9b03390d4d8d843bb0cf5796f3d19143/ghc >--------------------------------------------------------------- commit 49c9c5ad9b03390d4d8d843bb0cf5796f3d19143 Author: Simon Peyton Jones Date: Fri Feb 17 12:17:08 2017 +0000 Add VarSet.anyDVarSet, allDVarSet I need these in a later commit. Also rename varSetAny --> anyVarSet varSetAll --> allVarSet for consistency with other functions; eg filterVarSet >--------------------------------------------------------------- 49c9c5ad9b03390d4d8d843bb0cf5796f3d19143 compiler/basicTypes/VarSet.hs | 18 ++++++++++++------ compiler/specialise/Rules.hs | 2 +- compiler/typecheck/TcType.hs | 2 +- compiler/types/Unify.hs | 4 ++-- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/compiler/basicTypes/VarSet.hs b/compiler/basicTypes/VarSet.hs index a6e508a..a95e369 100644 --- a/compiler/basicTypes/VarSet.hs +++ b/compiler/basicTypes/VarSet.hs @@ -17,7 +17,7 @@ module VarSet ( intersectVarSet, intersectsVarSet, disjointVarSet, isEmptyVarSet, delVarSet, delVarSetList, delVarSetByKey, minusVarSet, filterVarSet, - varSetAny, varSetAll, + anyVarSet, allVarSet, transCloVarSet, fixVarSet, lookupVarSet, lookupVarSetByName, sizeVarSet, seqVarSet, @@ -35,7 +35,7 @@ module VarSet ( intersectDVarSet, intersectsDVarSet, disjointDVarSet, isEmptyDVarSet, delDVarSet, delDVarSetList, minusDVarSet, foldDVarSet, filterDVarSet, - dVarSetMinusVarSet, + dVarSetMinusVarSet, anyDVarSet, allDVarSet, transCloDVarSet, sizeDVarSet, seqDVarSet, partitionDVarSet, @@ -139,11 +139,11 @@ 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 +anyVarSet :: (Var -> Bool) -> VarSet -> Bool +anyVarSet = uniqSetAny -varSetAll :: (Var -> Bool) -> VarSet -> Bool -varSetAll = uniqSetAll +allVarSet :: (Var -> Bool) -> VarSet -> Bool +allVarSet = uniqSetAll -- There used to exist mapVarSet, see Note [Unsound mapUniqSet] in UniqSet for -- why it got removed. @@ -282,6 +282,12 @@ dVarSetMinusVarSet = uniqDSetMinusUniqSet foldDVarSet :: (Var -> a -> a) -> a -> DVarSet -> a foldDVarSet = foldUniqDSet +anyDVarSet :: (Var -> Bool) -> DVarSet -> Bool +anyDVarSet p = foldDVarSet ((||) . p) False + +allDVarSet :: (Var -> Bool) -> DVarSet -> Bool +allDVarSet p = foldDVarSet ((&&) . p) True + filterDVarSet :: (Var -> Bool) -> DVarSet -> DVarSet filterDVarSet = filterUniqDSet diff --git a/compiler/specialise/Rules.hs b/compiler/specialise/Rules.hs index 2ad4e1c..47193c6 100644 --- a/compiler/specialise/Rules.hs +++ b/compiler/specialise/Rules.hs @@ -864,7 +864,7 @@ match_alts _ _ _ _ ------------------------------------------ okToFloat :: RnEnv2 -> VarSet -> Bool okToFloat rn_env bind_fvs - = varSetAll not_captured bind_fvs + = allVarSet not_captured bind_fvs where not_captured fv = not (inRnEnvR rn_env fv) diff --git a/compiler/typecheck/TcType.hs b/compiler/typecheck/TcType.hs index 7e5c0b0..69d1f7c 100644 --- a/compiler/typecheck/TcType.hs +++ b/compiler/typecheck/TcType.hs @@ -911,7 +911,7 @@ anyRewritableTyVar ignore_cos pred ty go_co bound co | ignore_cos = False - | otherwise = varSetAny (go_tv bound) (tyCoVarsOfCo co) + | otherwise = anyVarSet (go_tv bound) (tyCoVarsOfCo co) -- We don't have an equivalent of anyRewritableTyVar for coercions -- (at least not yet) so take the free vars and test them diff --git a/compiler/types/Unify.hs b/compiler/types/Unify.hs index 7c6409f..05d6c6d 100644 --- a/compiler/types/Unify.hs +++ b/compiler/types/Unify.hs @@ -522,7 +522,7 @@ niFixTCvSubst tenv = f tenv | not_fixpoint = f (mapVarEnv (substTy subst') tenv) | otherwise = subst where - not_fixpoint = varSetAny in_domain range_tvs + not_fixpoint = anyVarSet in_domain range_tvs in_domain tv = tv `elemVarEnv` tenv range_tvs = nonDetFoldUFM (unionVarSet . tyCoVarsOfType) emptyVarSet tenv @@ -1223,7 +1223,7 @@ ty_co_match menv subst ty co lkco rkco = noneSet (\v -> elemVarEnv v env) set noneSet :: (Var -> Bool) -> VarSet -> Bool - noneSet f = varSetAll (not . f) + noneSet f = allVarSet (not . f) ty_co_match menv subst ty co lkco rkco | CastTy ty' co' <- ty From git at git.haskell.org Tue Feb 21 23:27:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Feb 2017 23:27:13 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline2: Change -ddump-tc-trace output in TcErrors, slightly (1bb6deb) Message-ID: <20170221232713.699883A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline2 Link : http://ghc.haskell.org/trac/ghc/changeset/1bb6debc7352f0f5e13940ef4023f7ca127f3c3e/ghc >--------------------------------------------------------------- commit 1bb6debc7352f0f5e13940ef4023f7ca127f3c3e Author: Simon Peyton Jones Date: Fri Feb 17 12:49:26 2017 +0000 Change -ddump-tc-trace output in TcErrors, slightly Only affects debugging >--------------------------------------------------------------- 1bb6debc7352f0f5e13940ef4023f7ca127f3c3e compiler/typecheck/TcErrors.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/compiler/typecheck/TcErrors.hs b/compiler/typecheck/TcErrors.hs index 6d4e3de..d47ecc6 100644 --- a/compiler/typecheck/TcErrors.hs +++ b/compiler/typecheck/TcErrors.hs @@ -191,9 +191,9 @@ report_unsolved mb_binds_var err_as_warn type_errors expr_holes ; let tidy_env = tidyFreeTyCoVars env0 free_tvs free_tvs = tyCoVarsOfWCList wanted - ; traceTc "reportUnsolved (after zonking and tidying):" $ - vcat [ pprTyVars free_tvs - , ppr wanted ] + ; traceTc "reportUnsolved (after zonking):" $ + vcat [ text "Free tyvars:" <+> pprTyVars free_tvs + , text "Wanted:" <+> ppr wanted ] ; warn_redundant <- woptM Opt_WarnRedundantConstraints ; let err_ctxt = CEC { cec_encl = [] @@ -335,8 +335,8 @@ reportImplic ctxt implic@(Implic { ic_skols = tvs, ic_given = given -- certainly be un-satisfied constraints | otherwise - = do { reportWanteds ctxt' tc_lvl wanted - ; traceTc "reportImplic" (ppr implic) + = do { traceTc "reportImplic" (ppr implic') + ; reportWanteds ctxt' tc_lvl wanted ; when (cec_warn_redundant ctxt) $ warnRedundantConstraints ctxt' tcl_env info' dead_givens } where From git at git.haskell.org Tue Feb 21 23:27:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Feb 2017 23:27:16 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline2: Improve pretty-printing of types (b3b0015) Message-ID: <20170221232716.2C9053A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline2 Link : http://ghc.haskell.org/trac/ghc/changeset/b3b0015cb374298256749931b35d45634bf70b9d/ghc >--------------------------------------------------------------- commit b3b0015cb374298256749931b35d45634bf70b9d Author: Simon Peyton Jones Date: Fri Feb 17 12:30:35 2017 +0000 Improve pretty-printing of types When doing debug-printing it's really important that the free vars of a type are printed with their uniques. The IfaceTcTyVar thing was a stab in that direction, but it only worked for TcTyVars, not TyVars. This patch does it properly, by keeping track of the free vars of the type when translating Type -> IfaceType, and passing that down through toIfaceTypeX. Then when we find a variable, look in that set, and translate it to IfaceFreeTyVar if so. (I renamed IfaceTcTyVar to IfaceFreeTyVar.) Fiddly but not difficult. >--------------------------------------------------------------- b3b0015cb374298256749931b35d45634bf70b9d compiler/backpack/RnModIface.hs | 4 +- compiler/iface/IfaceSyn.hs | 2 +- compiler/iface/IfaceType.hs | 38 +++++------ compiler/iface/TcIface.hs | 2 +- compiler/iface/ToIface.hs | 147 +++++++++++++++++++++++----------------- compiler/iface/ToIface.hs-boot | 2 + compiler/typecheck/TcRnTypes.hs | 5 +- compiler/types/TyCoRep.hs | 37 ++++++---- compiler/types/Type.hs | 2 +- compiler/types/Type.hs-boot | 1 + 10 files changed, 136 insertions(+), 104 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 b3b0015cb374298256749931b35d45634bf70b9d From git at git.haskell.org Tue Feb 21 23:27:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Feb 2017 23:27:18 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline2: Improve SetLevels for join points (acaa814) Message-ID: <20170221232718.E5C013A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline2 Link : http://ghc.haskell.org/trac/ghc/changeset/acaa814802ba2b94a696e43338e291bb396bb8a8/ghc >--------------------------------------------------------------- commit acaa814802ba2b94a696e43338e291bb396bb8a8 Author: Simon Peyton Jones Date: Fri Feb 17 16:17:16 2017 +0000 Improve SetLevels for join points C.f. Trac #13286, #13236 * Never destroy a join point unless it goes to top level See Note [Floating join point bindings] * Never float a MFE if it has a free join variable Note [Free join points] * Stop treating nullary join points specially * Enforce the invariant that le_join_ceil >= le_ctxt_lvl (Needs more thought...) >--------------------------------------------------------------- acaa814802ba2b94a696e43338e291bb396bb8a8 compiler/simplCore/SetLevels.hs | 315 +++++++++++++++++++--------------------- 1 file changed, 149 insertions(+), 166 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 acaa814802ba2b94a696e43338e291bb396bb8a8 From git at git.haskell.org Tue Feb 21 23:27:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Feb 2017 23:27:21 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline2: Error message wibbles accumulated from the preceding patches (b75cdba) Message-ID: <20170221232721.A32C03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline2 Link : http://ghc.haskell.org/trac/ghc/changeset/b75cdba59fec291e90639e800fd841ccdfe43cd3/ghc >--------------------------------------------------------------- commit b75cdba59fec291e90639e800fd841ccdfe43cd3 Author: Simon Peyton Jones Date: Fri Feb 17 16:23:45 2017 +0000 Error message wibbles accumulated from the preceding patches I suppose it would be better to spread them with their individual changes >--------------------------------------------------------------- b75cdba59fec291e90639e800fd841ccdfe43cd3 testsuite/tests/deriving/should_fail/T7148.stderr | 8 +- testsuite/tests/perf/compiler/all.T | 7 +- testsuite/tests/perf/should_run/all.T | 2 +- testsuite/tests/simplCore/should_compile/Makefile | 7 +- .../tests/simplCore/should_compile/T12603.stdout | 2 +- .../tests/simplCore/should_compile/T13156.stdout | 5 +- .../tests/simplCore/should_compile/T3772.stdout | 2 +- .../tests/simplCore/should_compile/T8848.stderr | 101 ------------- .../simplCore/should_compile/spec-inline.stderr | 158 +++++---------------- testsuite/tests/th/T8761.stderr | 57 ++++---- .../tests/typecheck/should_fail/T12785b.stderr | 15 +- 11 files changed, 87 insertions(+), 277 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 b75cdba59fec291e90639e800fd841ccdfe43cd3 From git at git.haskell.org Tue Feb 21 23:27:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Feb 2017 23:27:24 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline2: Error message wibbles (82178e4) Message-ID: <20170221232724.57BF93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline2 Link : http://ghc.haskell.org/trac/ghc/changeset/82178e40e65fcf8ad33768bc077085bac2506775/ghc >--------------------------------------------------------------- commit 82178e40e65fcf8ad33768bc077085bac2506775 Author: Simon Peyton Jones Date: Mon Feb 20 16:56:43 2017 +0000 Error message wibbles >--------------------------------------------------------------- 82178e40e65fcf8ad33768bc077085bac2506775 testsuite/tests/simplCore/should_compile/Makefile | 2 +- .../tests/simplCore/should_compile/T12603.stdout | 2 +- .../tests/simplCore/should_compile/T13156.stdout | 2 +- .../tests/simplCore/should_compile/T3772.stdout | 6 +- .../simplCore/should_compile/spec-inline.stderr | 158 ++++++++++++++++----- 5 files changed, 128 insertions(+), 42 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 82178e40e65fcf8ad33768bc077085bac2506775 From git at git.haskell.org Tue Feb 21 23:27:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 21 Feb 2017 23:27:27 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline2: Simon's early-inline patch, take 2 (2caa001) Message-ID: <20170221232727.3DB783A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline2 Link : http://ghc.haskell.org/trac/ghc/changeset/2caa001813d03168266935a475aff34c55091e07/ghc >--------------------------------------------------------------- commit 2caa001813d03168266935a475aff34c55091e07 Author: David Feuer Date: Tue Feb 21 00:00:54 2017 -0500 Simon's early-inline patch, take 2 Summary: Refactor floating of bindings (fiBind) This is just a local refactoring. I originally planned to try floating top-level bindings inwards, but I backed off from that leaving only this (harmless) refactoring, which has no behavioural effect. I also make FloatIn into a ModGuts -> ModGuts function; again not necessary now, but no harm either. My attempt also used the new function CoreFVs.freeVarsBind; but that too is a plausible refactorig of freeVars, so I left it in too. Add -fspec-constr-keen I dicovered that the dramatic imprvoement in perf/should_run/T9339 with the introduction of join points was really rather a fluke, and very fragile. The real problem (see Note [Making SpecConstr keener]) is that SpecConstr wasn't specialising a function even though it was applied to a freshly-allocated constructor. The paper describes plausible reasons for this, but I think it may well be better to be a bit more aggressive. So this patch add -fspec-constr-keen, which makes SpecConstr a bit keener to specialise, by ignoring whether or not the argument corresponding to a call pattern is scrutinised in the function body. Now the gains in T9339 should be robust; and it might even be a better default. I'd be interested in what happens if we switched on -fspec-constr-keen with -O2. Occurrence-analyse the result of rule firings When studying simplCore/should_compile/T7785 I found that a long chain of maps map f (map f (map f (map f (...)))) took an unreasonably long time to simplify. The problem got worse when I started inlining in the InitialPhase, which is how I stumbled on it. The solution turned out to be rather simple. It's described in Note [Occurence-analyse after rule firing] in Simplify.hs Stop uniques ending up in SPEC rule names Make Specialise work with casts With my upcoming early-inlining patch it turned out that Specialise was getting stuck on casts. This patch fixes it; see Specialise [Account for casts in binding]. Inline data constructor wrappers in phase 2 only This patch prepares for my upcoming early-inlining patch. It arranges that data constructor wrappers are not inlined until Phase 2 (the first of the "normal" phases.) That gives rules a chance to fire in the InitialPhase (aka "gentle"). This has been a bit of a problem for a while, so it's nice to have a fix. It should make no difference immediately, becuase currently nothing is inlined in the InitialPhase anyway. Combine identical case alterantives in CSE See Note [Combine case alternatives] in CSE. This opportunity surfaced when I was was studying early inlining. It's easy (and cheap) to exploit, and sometimes makes a worthwhile saving. Extend CSE to handle recursive bindings I came across a program with two identical recursive bindings, so I wondered if they could be CSE'd. It turned out to be pretty easy so I did it. See Note [CSE for recursive bindings] in CSE Fix SetLevels for makeStaticPtr This too is prepartory for my early-inlining patch. It turned out that early inlining exposed a bug in the way that static pointers were being floated. Small changes to expression sizing in CoreUnfold The only significant change here is that case e of {} should be treated like 'e', rather than like a case expression. We don't push a return address, for example, since 'e' is sure to diverge. I forget why I did this; but it will make these empty-case expressions (which are only there to satisfy the type checker) cost-free. The Early Inline Patch This very small patch switches on sm_inline even in the InitialPhase (aka "gentle" phase). There is no reason not to... and the results are astonishing. I think the peformance of GHC itself improves by about 5%; and some programs get much smaller, quicker. Result: across the board irmprovements in compile time performance. Here are the changes in perf/compiler; the numbers are decreases in compiler bytes-allocated: 3% T5837 7% parsing001 9% T12234 35% T9020 9% T3064 13% T9961 20% T13056 5% T9872d 5% T9872c 5% T9872b 7% T9872a 5% T783 35% T12227 20% T1969 Plus in perf/should_run 5% lazy-bs-alloc It wasn't as easy as it sounds: I did a raft of preparatory work in earlier patches. But it's great! Add VarSet.anyDVarSet, allDVarSet I need these in a later commit. Also rename varSetAny --> anyVarSet varSetAll --> allVarSet for consistency with other functions; eg filterVarSet Improve pretty-printing of types When doing debug-printing it's really important that the free vars of a type are printed with their uniques. The IfaceTcTyVar thing was a stab in that direction, but it only worked for TcTyVars, not TyVars. This patch does it properly, by keeping track of the free vars of the type when translating Type -> IfaceType, and passing that down through toIfaceTypeX. Then when we find a variable, look in that set, and translate it to IfaceFreeTyVar if so. (I renamed IfaceTcTyVar to IfaceFreeTyVar.) Fiddly but not difficult. Change -ddump-tc-trace output in TcErrors, slightly Only affects debugging Improve SetLevels for join points C.f. Trac #13286, #13236 * Never destroy a join point unless it goes to top level See Note [Floating join point bindings] * Never float a MFE if it has a free join variable Note [Free join points] * Stop treating nullary join points specially * Enforce the invariant that le_join_ceil >= le_ctxt_lvl (Needs more thought...) Error message wibbles accumulated from the preceding patches I suppose it would be better to spread them with their individual changes Error message wibbles More test suite wibbles Also update the Makefile to make it easier to see what's wrong with one test. Reviewers: austin, goldfire, bgamari, simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3167 >--------------------------------------------------------------- 2caa001813d03168266935a475aff34c55091e07 testsuite/tests/rts/all.T | 2 ++ testsuite/tests/simplCore/should_compile/Makefile | 2 +- testsuite/tests/simplCore/should_compile/T8848.hs | 0 testsuite/tests/simplCore/should_compile/T8848.stdout | 2 ++ testsuite/tests/th/TH_Roles2.stderr | 4 ++-- 5 files changed, 7 insertions(+), 3 deletions(-) diff --git a/testsuite/tests/rts/all.T b/testsuite/tests/rts/all.T index 2fae73c..1cf0e8e 100644 --- a/testsuite/tests/rts/all.T +++ b/testsuite/tests/rts/all.T @@ -162,6 +162,8 @@ def checkDynAsm(actual_file, normaliser): actual_raw = read_no_crs(actual_file) actual_str = normaliser(actual_raw) actual = actual_str.split() + # Note that the gold linker seems to reverse ctors1 and ctors2. + # See #13283. if actual == ['initArray1', 'initArray2', 'ctors1', 'ctors2', 'success']: return 1 elif actual == ['ctors1', 'ctors2', 'initArray1', 'initArray2', 'success']: diff --git a/testsuite/tests/simplCore/should_compile/Makefile b/testsuite/tests/simplCore/should_compile/Makefile index 590ba43..08664d7 100644 --- a/testsuite/tests/simplCore/should_compile/Makefile +++ b/testsuite/tests/simplCore/should_compile/Makefile @@ -16,7 +16,7 @@ T9509: $(RM) -f T9509*.o T9509*.hi '$(TEST_HC)' $(TEST_HC_OPTS) -O -c T9509a.hs '$(TEST_HC)' $(TEST_HC_OPTS) -O -c T9509.hs \ - -ddump-rule-rewrites | grep SPEC + -ddump-rule-rewrites | { grep SPEC || true; } # Grep output should show a SPEC rule firing, twice T8832: diff --git a/testsuite/tests/simplCore/should_compile/T8848.stdout b/testsuite/tests/simplCore/should_compile/T8848.stdout new file mode 100644 index 0000000..de0d424 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T8848.stdout @@ -0,0 +1,2 @@ +Rule fired: SPEC map2 +Rule fired: SPEC map2 diff --git a/testsuite/tests/th/TH_Roles2.stderr b/testsuite/tests/th/TH_Roles2.stderr index 3027911..d2c6316 100644 --- a/testsuite/tests/th/TH_Roles2.stderr +++ b/testsuite/tests/th/TH_Roles2.stderr @@ -16,8 +16,8 @@ TH_Roles2.$tcT TH_Roles2.$trModule (GHC.Types.TrNameS "T"#) 1 - krep_a4im -krep_a4im [InlPrag=[~]] + krep_a40L +krep_a40L [InlPrag=[~]] = GHC.Types.KindRepFun (GHC.Types.KindRepVar 0) (GHC.Types.KindRepTYPE GHC.Types.LiftedRep) From git at git.haskell.org Wed Feb 22 00:42:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 22 Feb 2017 00:42:09 +0000 (UTC) Subject: [commit: ghc] master: Bump Cabal and containers submodules (8ccbc2e) Message-ID: <20170222004209.BD6363A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8ccbc2e5252abd4fa67d155d4fff489ee9929906/ghc >--------------------------------------------------------------- commit 8ccbc2e5252abd4fa67d155d4fff489ee9929906 Author: Ben Gamari Date: Tue Feb 21 16:13:36 2017 -0500 Bump Cabal and containers submodules >--------------------------------------------------------------- 8ccbc2e5252abd4fa67d155d4fff489ee9929906 libraries/Cabal | 2 +- libraries/containers | 2 +- testsuite/tests/backpack/should_run/bkprun05.stderr | 2 +- testsuite/tests/cabal/cabal08/all.T | 2 +- testsuite/tests/driver/T10970.stdout | 2 +- testsuite/tests/ghci.debugger/scripts/print026.stdout | 11 +++++++---- testsuite/tests/package/package01e.stderr | 4 ++-- testsuite/tests/partial-sigs/should_fail/T10999.stderr | 3 +-- testsuite/tests/th/T10796b.stderr | 2 +- 9 files changed, 16 insertions(+), 14 deletions(-) diff --git a/libraries/Cabal b/libraries/Cabal index 19c278f..e4c36b9 160000 --- a/libraries/Cabal +++ b/libraries/Cabal @@ -1 +1 @@ -Subproject commit 19c278feb732f5797256ff28eb671440f5511c6c +Subproject commit e4c36b9dd51820f2380ce7a66f980c4e7b2e96fc diff --git a/libraries/containers b/libraries/containers index aa982fb..1a84cc6 160000 --- a/libraries/containers +++ b/libraries/containers @@ -1 +1 @@ -Subproject commit aa982fb83f2561d3b27b89b46d36ffca21e072cc +Subproject commit 1a84cc6b920a05533f5789d41a5d5d888351cb31 diff --git a/testsuite/tests/backpack/should_run/bkprun05.stderr b/testsuite/tests/backpack/should_run/bkprun05.stderr index d9042b07..854de8b 100644 --- a/testsuite/tests/backpack/should_run/bkprun05.stderr +++ b/testsuite/tests/backpack/should_run/bkprun05.stderr @@ -1,4 +1,4 @@ bkprun05: Prelude.undefined CallStack (from HasCallStack): error, called at libraries/base/GHC/Err.hs:79:14 in base:GHC.Err - undefined, called at bkprun05.bkp:138:30 in app+app-9GMmly0OuEYHDXryaGD7sX:App + undefined, called at bkprun05.bkp:138:30 in app+app-89WS9ScvjQd9lPG2oW0wWM:App diff --git a/testsuite/tests/cabal/cabal08/all.T b/testsuite/tests/cabal/cabal08/all.T index 3aaf185..914196b 100644 --- a/testsuite/tests/cabal/cabal08/all.T +++ b/testsuite/tests/cabal/cabal08/all.T @@ -4,6 +4,6 @@ else: cleanup = 'CLEANUP=0' test('cabal08', - normal, + expect_broken(13313), run_command, ['$MAKE -s --no-print-directory cabal08 ' + cleanup]) diff --git a/testsuite/tests/driver/T10970.stdout b/testsuite/tests/driver/T10970.stdout index fd35ddd..9636217 100644 --- a/testsuite/tests/driver/T10970.stdout +++ b/testsuite/tests/driver/T10970.stdout @@ -1,2 +1,2 @@ -0.5.7.1 +0.5.10.2 OK diff --git a/testsuite/tests/ghci.debugger/scripts/print026.stdout b/testsuite/tests/ghci.debugger/scripts/print026.stdout index decc3df..9ed900f 100644 --- a/testsuite/tests/ghci.debugger/scripts/print026.stdout +++ b/testsuite/tests/ghci.debugger/scripts/print026.stdout @@ -1,6 +1,9 @@ fromList "abc" -l = Data.Sequence.Seq (Data.Sequence.Deep - 3 (Data.Sequence.One (Data.Sequence.Elem 'a')) Data.Sequence.Empty - (Data.Sequence.Two - (Data.Sequence.Elem 'b') (Data.Sequence.Elem 'c'))) +l = Data.Sequence.Internal.Seq (Data.Sequence.Internal.Deep + 3 + (Data.Sequence.Internal.Two + (Data.Sequence.Internal.Elem 'a') + (Data.Sequence.Internal.Elem 'b')) + Data.Sequence.Internal.EmptyT + (Data.Sequence.Internal.One (Data.Sequence.Internal.Elem 'c'))) l = fromList "abc" diff --git a/testsuite/tests/package/package01e.stderr b/testsuite/tests/package/package01e.stderr index f34ee1d..cfde9a7 100644 --- a/testsuite/tests/package/package01e.stderr +++ b/testsuite/tests/package/package01e.stderr @@ -1,10 +1,10 @@ package01e.hs:2:1: error: Could not find module ‘Data.Map’ - It is a member of the hidden package ‘containers-0.5.7.1’. + It is a member of the hidden package ‘containers-0.5.10.2’. Use -v to see a list of the files searched for. package01e.hs:3:1: error: Could not find module ‘Data.IntMap’ - It is a member of the hidden package ‘containers-0.5.7.1’. + It is a member of the hidden package ‘containers-0.5.10.2’. Use -v to see a list of the files searched for. diff --git a/testsuite/tests/partial-sigs/should_fail/T10999.stderr b/testsuite/tests/partial-sigs/should_fail/T10999.stderr index 582cf1a..0b534b9 100644 --- a/testsuite/tests/partial-sigs/should_fail/T10999.stderr +++ b/testsuite/tests/partial-sigs/should_fail/T10999.stderr @@ -21,8 +21,7 @@ T10999.hs:8:28: error: Relevant bindings include g :: [b0] (bound at T10999.hs:8:1) Probable fix: use a type annotation to specify what ‘b0’ should be. These potential instances exist: - instance Ord a => Ord (Set.Set a) - -- Defined in ‘containers-0.5.7.1:Data.Set.Base’ + instance Ord a => Ord (Set.Set a) -- Defined in ‘Data.Set.Internal’ instance Ord Ordering -- Defined in ‘GHC.Classes’ instance Ord Integer -- Defined in ‘integer-gmp-1.0.0.1:GHC.Integer.Type’ diff --git a/testsuite/tests/th/T10796b.stderr b/testsuite/tests/th/T10796b.stderr index eff1f75..2491a8c 100644 --- a/testsuite/tests/th/T10796b.stderr +++ b/testsuite/tests/th/T10796b.stderr @@ -1,5 +1,5 @@ T10796b.hs:8:17: error: - • Can't construct a pattern from name Data.Set.Base.fromList + • Can't construct a pattern from name Data.Set.Internal.fromList • In the untyped splice: $(dataToPatQ (const Nothing) (fromList "test")) From git at git.haskell.org Wed Feb 22 00:42:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 22 Feb 2017 00:42:12 +0000 (UTC) Subject: [commit: ghc] master: Fix all broken perf tests on x64 Windows (9ef2749) Message-ID: <20170222004212.73E0F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9ef2749c3f3818944ae7dac5c9d10851b63b834a/ghc >--------------------------------------------------------------- commit 9ef2749c3f3818944ae7dac5c9d10851b63b834a Author: Tamar Christina Date: Tue Feb 21 11:21:48 2017 -0500 Fix all broken perf tests on x64 Windows various perf tests have been broken over the course of the past few months. This updates the numbers. Test Plan: ./validate Reviewers: austin, bgamari Subscribers: thomie, #ghc_windows_task_force Differential Revision: https://phabricator.haskell.org/D3160 >--------------------------------------------------------------- 9ef2749c3f3818944ae7dac5c9d10851b63b834a testsuite/tests/deriving/perf/all.T | 5 ++++- testsuite/tests/perf/compiler/all.T | 13 ++++++++++--- testsuite/tests/perf/haddock/all.T | 5 ++++- testsuite/tests/perf/join_points/all.T | 7 ++++++- testsuite/tests/perf/should_run/all.T | 5 +++++ 5 files changed, 29 insertions(+), 6 deletions(-) diff --git a/testsuite/tests/deriving/perf/all.T b/testsuite/tests/deriving/perf/all.T index 8dee989..a13a6aa 100644 --- a/testsuite/tests/deriving/perf/all.T +++ b/testsuite/tests/deriving/perf/all.T @@ -1,6 +1,9 @@ test('T10858', [compiler_stats_num_field('bytes allocated', - [ (wordsize(64), 304094944, 8) ]), + [(platform('x86_64-unknown-mingw32'), 272402736, 8), + # 2017-02-19 272402736 (x64/Windows) - unknown + + (wordsize(64), 304094944, 8) ]), # Initial: 476296112 # 2016-12-19 247768192 Join points (#19288) # 2016-02-12 304094944 Type-indexed Typeable diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index c9b5091..e5fefaa 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -612,6 +612,9 @@ test('T5837', # 2014-12-08: 115905208 Constraint solver perf improvements (esp kick-out) # 2016-04-06: 24199320 (x86/Linux, 64-bit machine) TypeInType + (platform('x86_64-unknown-mingw32'), 59161648, 7), + # 2017-02-19 59161648 (x64/Windows) - Unknown + (wordsize(64), 58648600, 7)]) # sample: 3926235424 (amd64/Linux, 15/2/2012) # 2012-10-02 81879216 @@ -901,7 +904,10 @@ test('T10370', test('T10547', [ compiler_stats_num_field('bytes allocated', - [(wordsize(64), 37681360, 20), + [(platform('x86_64-unknown-mingw32'), 37485128, 20), + # 2017-02-19 37485128 (x64/Windows) - Unknown + + (wordsize(64), 37681360, 20), # initial: 39165544 # 2016-11-25: 31041520 Linux Around the time of refactoring the constraint solver; # but I think that only pushed it over the edge @@ -940,8 +946,9 @@ test('T12425', test('T12234', [ only_ways(['optasm']), compiler_stats_num_field('bytes allocated', - [(platform('x86_64-unknown-mingw32'), 77949232, 5), - # initial: 77949232 + [(platform('x86_64-unknown-mingw32'), 89180624, 5), + # initial: 89180624 + # 2017-02-19 89180624 (x64/Windows) - Unknown (wordsize(64), 86525344, 5), # initial: 72958288 # 2016-01-17: 76848856 (x86-64, Linux. drift?) diff --git a/testsuite/tests/perf/haddock/all.T b/testsuite/tests/perf/haddock/all.T index a148b71..9bd29ff 100644 --- a/testsuite/tests/perf/haddock/all.T +++ b/testsuite/tests/perf/haddock/all.T @@ -5,7 +5,10 @@ test('haddock.base', [unless(in_tree_compiler(), skip), req_haddock ,stats_num_field('bytes allocated', - [(wordsize(64), 25592972912, 5) + [(platform('x86_64-unknown-mingw32'), 24286343184, 5) + # 2017-02-19 24286343184 (x64/Windows) - Generalize kind of (->) + + ,(wordsize(64), 25592972912, 5) # 2012-08-14: 5920822352 (amd64/Linux) # 2012-09-20: 5829972376 (amd64/Linux) # 2012-10-08: 5902601224 (amd64/Linux) diff --git a/testsuite/tests/perf/join_points/all.T b/testsuite/tests/perf/join_points/all.T index 0747dae..fe202b6 100644 --- a/testsuite/tests/perf/join_points/all.T +++ b/testsuite/tests/perf/join_points/all.T @@ -25,6 +25,11 @@ test('join005', normal, compile, ['']) test('join006', normal, compile, ['']) test('join007', - [stats_num_field('bytes allocated', [(wordsize(64), 50944, 5)])], + [stats_num_field('bytes allocated', + [(platform('x86_64-unknown-mingw32'), 47368, 5), + # 2017-02-19 47368 (x64/Windows) - Unknown + + (wordsize(64), 50944, 5)])], + # Initial 50944 compile_and_run, ['']) diff --git a/testsuite/tests/perf/should_run/all.T b/testsuite/tests/perf/should_run/all.T index 27d8df8..6670f34 100644 --- a/testsuite/tests/perf/should_run/all.T +++ b/testsuite/tests/perf/should_run/all.T @@ -450,6 +450,11 @@ test('T9203', test('T9339', [stats_num_field('bytes allocated', [ (wordsize(32), 40046844, 5) + # is this number correct? Seems very high. + + , (platform('x86_64-unknown-mingw32'), 47088, 7) + # 2017-02-19 47088 (x64/Windows) - Unknown + , (wordsize(64), 50728, 5) ]), # w/o fusing last: 320005080 # 2014-07-22: 80050760 From git at git.haskell.org Wed Feb 22 11:20:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 22 Feb 2017 11:20:11 +0000 (UTC) Subject: [commit: ghc] master: Test Trac #13271 (b125392) Message-ID: <20170222112011.2E9483A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b125392983401cc9fe13502e52880387bc71a092/ghc >--------------------------------------------------------------- commit b125392983401cc9fe13502e52880387bc71a092 Author: Simon Peyton Jones Date: Wed Feb 22 08:43:58 2017 +0000 Test Trac #13271 >--------------------------------------------------------------- b125392983401cc9fe13502e52880387bc71a092 testsuite/tests/indexed-types/should_fail/T13271.hs | 13 +++++++++++++ testsuite/tests/indexed-types/should_fail/T13271.stderr | 4 ++++ testsuite/tests/indexed-types/should_fail/all.T | 1 + 3 files changed, 18 insertions(+) diff --git a/testsuite/tests/indexed-types/should_fail/T13271.hs b/testsuite/tests/indexed-types/should_fail/T13271.hs new file mode 100644 index 0000000..3c72d2c --- /dev/null +++ b/testsuite/tests/indexed-types/should_fail/T13271.hs @@ -0,0 +1,13 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE TypeFamilyDependencies #-} + +module T13271 where + +import GHC.TypeLits + +data T1 = T1 +type T2 = TypeError (Text "You can't do that!") + +type family X i = r | r -> i where + X 1 = T1 + X 2 = T2 diff --git a/testsuite/tests/indexed-types/should_fail/T13271.stderr b/testsuite/tests/indexed-types/should_fail/T13271.stderr new file mode 100644 index 0000000..e28dcea --- /dev/null +++ b/testsuite/tests/indexed-types/should_fail/T13271.stderr @@ -0,0 +1,4 @@ + +T13271.hs:9:1: error: + • You can't do that! + • In the type synonym declaration for ‘T2’ diff --git a/testsuite/tests/indexed-types/should_fail/all.T b/testsuite/tests/indexed-types/should_fail/all.T index 7f23c34..0645601 100644 --- a/testsuite/tests/indexed-types/should_fail/all.T +++ b/testsuite/tests/indexed-types/should_fail/all.T @@ -130,3 +130,4 @@ test('T12522a', normal, compile_fail, ['']) test('T12867', normal, compile_fail, ['']) test('T7102', [ expect_broken(7102) ], ghci_script, ['T7102.script']) test('T7102a', normal, ghci_script, ['T7102a.script']) +test('T13271', normal, compile_fail, ['']) From git at git.haskell.org Wed Feb 22 11:20:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 22 Feb 2017 11:20:14 +0000 (UTC) Subject: [commit: ghc] master: Fix ApplicativeDo constraint scoping (484f8d3) Message-ID: <20170222112014.6695C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/484f8d35b7cb3f77d96f9f4ffc16bb8c946f47fd/ghc >--------------------------------------------------------------- commit 484f8d35b7cb3f77d96f9f4ffc16bb8c946f47fd Author: Simon Peyton Jones Date: Wed Feb 22 11:17:44 2017 +0000 Fix ApplicativeDo constraint scoping This patch fixes Trac #13242, by a bit of fancy footwork with the LIE variable in which the WantedConstraints are collected. I think it can be simplified further, using a 'map'. >--------------------------------------------------------------- 484f8d35b7cb3f77d96f9f4ffc16bb8c946f47fd compiler/typecheck/TcMatches.hs | 75 +++++++++++++++++++++++++++++------------ testsuite/tests/ado/T13242.hs | 16 +++++++++ testsuite/tests/ado/all.T | 1 + 3 files changed, 70 insertions(+), 22 deletions(-) diff --git a/compiler/typecheck/TcMatches.hs b/compiler/typecheck/TcMatches.hs index 579f2cd..68cc9a4 100644 --- a/compiler/typecheck/TcMatches.hs +++ b/compiler/typecheck/TcMatches.hs @@ -1002,6 +1002,7 @@ e_i :: exp_ty_i <*>_i :: t_(i-1) -> exp_ty_i -> t_i join :: tn -> res_ty -} + tcApplicativeStmts :: HsStmtContext Name -> [(SyntaxExpr Name, ApplicativeArg Name Name)] @@ -1023,8 +1024,9 @@ tcApplicativeStmts ctxt pairs rhs_ty thing_inside ; let (ops, args) = unzip pairs ; ops' <- goOps fun_ty (zip3 ops (ts ++ [rhs_ty]) exp_tys) - ; (args', thing) <- goArgs (zip3 args pat_tys exp_tys) $ - thing_inside body_ty + ; lie_var <- getConstraintVar -- See Note [ApplicativeDo and constraints] + ; (args', thing) <- goArgs (zip3 args pat_tys exp_tys) + lie_var (thing_inside body_ty) ; return (zip ops' args', body_ty, thing) } where goOps _ [] = return [] @@ -1037,41 +1039,70 @@ tcApplicativeStmts ctxt pairs rhs_ty thing_inside ; ops' <- goOps t_i ops ; return (op' : ops') } - goArgs - :: [(ApplicativeArg Name Name, Type, Type)] - -> TcM t - -> TcM ([ApplicativeArg TcId TcId], t) + goArgs :: [(ApplicativeArg Name Name, Type, Type)] + -> TcRef WantedConstraints -- See Note [ApplicativeDo and constraints] + -> TcM t + -> TcM ([ApplicativeArg TcId TcId], t) - goArgs [] thing_inside - = do { thing <- thing_inside + goArgs [] lie_var thing_inside + = do { thing <- setConstraintVar lie_var thing_inside ; return ([],thing) } - goArgs ((ApplicativeArgOne pat rhs, pat_ty, exp_ty) : rest) thing_inside - = do { let stmt :: ExprStmt Name - stmt = mkBindStmt pat rhs - ; setSrcSpan (combineSrcSpans (getLoc pat) (getLoc rhs)) $ - addErrCtxt (pprStmtInCtxt ctxt stmt) $ - do { rhs' <- tcMonoExprNC rhs (mkCheckExpType exp_ty) - ; (pat',(pairs, thing)) <- - tcPat (StmtCtxt ctxt) pat (mkCheckExpType pat_ty) $ - popErrCtxt $ - goArgs rest thing_inside - ; return (ApplicativeArgOne pat' rhs' : pairs, thing) } } + goArgs ((ApplicativeArgOne pat rhs, pat_ty, exp_ty) : rest) + lie_var thing_inside + = setSrcSpan (combineSrcSpans (getLoc pat) (getLoc rhs)) $ + addErrCtxt (pprStmtInCtxt ctxt (mkBindStmt pat rhs)) $ + setConstraintVar lie_var $ + do { rhs' <- tcMonoExprNC rhs (mkCheckExpType exp_ty) + ; (pat',(pairs, thing)) <- + tcPat (StmtCtxt ctxt) pat (mkCheckExpType pat_ty) $ + popErrCtxt $ -- Undoes the enclosing addErrCtxt + goArgs rest lie_var thing_inside + ; return (ApplicativeArgOne pat' rhs' : pairs, thing) } goArgs ((ApplicativeArgMany stmts ret pat, pat_ty, exp_ty) : rest) - thing_inside + lie_var thing_inside = do { (stmts', (ret',pat',rest',thing)) <- + setConstraintVar lie_var $ tcStmtsAndThen ctxt tcDoStmt stmts (mkCheckExpType exp_ty) $ \res_ty -> do { L _ ret' <- tcMonoExprNC (noLoc ret) res_ty ; (pat',(rest', thing)) <- tcPat (StmtCtxt ctxt) pat (mkCheckExpType pat_ty) $ - goArgs rest thing_inside + goArgs rest lie_var thing_inside ; return (ret', pat', rest', thing) } ; return (ApplicativeArgMany stmts' ret' pat' : rest', thing) } -{- +{- Note [ApplicativeDo and constraints] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +An applicative-do is supposed to take place in parallel, so +constraints bound in one arm can't possibly be available in aother +(Trac #13242). Our current rule is this (more details and discussion +on the ticket). Consider + + ...stmts... + ApplicativeStmts [arg1, arg2, ... argN] + ...more stmts... + +where argi :: ApplicativeArg. Each 'argi' itself contains one or more Stmts. +Now, we say that: + +* Constraints required by the argi can be solved from + constraint bound by ...stmts... + +* Constraints and existentials bound by the argi are not available + to solve constraints required either by argj (where i /= j), + or by ...more stmts.... + +* Within the stmts of each 'argi' individually, however, constraints bound + by earlier stmts can be used to solve later ones. + +To achieve this, we just reset the "LIE var" (in which new required +constraints are collected) to the outer context just before doing each arg, +and the thing_inside. + + ************************************************************************ * * \subsection{Errors and contexts} diff --git a/testsuite/tests/ado/T13242.hs b/testsuite/tests/ado/T13242.hs new file mode 100644 index 0000000..ccaa93c --- /dev/null +++ b/testsuite/tests/ado/T13242.hs @@ -0,0 +1,16 @@ +-- Panic.hs +{-# LANGUAGE ApplicativeDo #-} +{-# LANGUAGE ExistentialQuantification #-} +module T13242 where + +import Data.STRef +import Control.Monad.ST + +data A = forall a. A a + +st :: ST s () +st = do + A _ <- pure $ A True + ref <- newSTRef 1 + readSTRef ref + pure () diff --git a/testsuite/tests/ado/all.T b/testsuite/tests/ado/all.T index 67697b9..6a1b4ec 100644 --- a/testsuite/tests/ado/all.T +++ b/testsuite/tests/ado/all.T @@ -8,3 +8,4 @@ test('ado007', normal, compile, ['']) test('T11607', normal, compile_and_run, ['']) test('ado-optimal', normal, compile_and_run, ['']) test('T12490', normal, compile, ['']) +test('T13242', normal, compile, ['']) From git at git.haskell.org Wed Feb 22 11:20:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 22 Feb 2017 11:20:17 +0000 (UTC) Subject: [commit: ghc] master: Test Trac #13244 (fed7136) Message-ID: <20170222112017.872793A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fed7136c597868d1c13b96837a2b64137a9ee65c/ghc >--------------------------------------------------------------- commit fed7136c597868d1c13b96837a2b64137a9ee65c Author: Simon Peyton Jones Date: Wed Feb 22 11:19:49 2017 +0000 Test Trac #13244 >--------------------------------------------------------------- fed7136c597868d1c13b96837a2b64137a9ee65c .../tests/indexed-types/should_compile/T13244.hs | 34 ++++++++++++++++++++++ testsuite/tests/indexed-types/should_compile/all.T | 1 + 2 files changed, 35 insertions(+) diff --git a/testsuite/tests/indexed-types/should_compile/T13244.hs b/testsuite/tests/indexed-types/should_compile/T13244.hs new file mode 100644 index 0000000..e1a65b9 --- /dev/null +++ b/testsuite/tests/indexed-types/should_compile/T13244.hs @@ -0,0 +1,34 @@ +{-# LANGUAGE MagicHash, DataKinds, PolyKinds, TypeInType, TypeFamilies #-} + +module T13244 where + +import Data.Int +import Data.Word +import GHC.Prim +import GHC.Types + +type family Rep x where + Rep Int = IntRep + Rep Int8 = IntRep + Rep Int16 = IntRep + Rep Int32 = IntRep + Rep Int64 = Int64Rep + Rep Bool = IntRep + Rep Char = IntRep + Rep Word = WordRep + Rep Word8 = WordRep + Rep Word16 = WordRep + Rep Word32 = WordRep + Rep Word64 = Word64Rep + Rep Float = FloatRep + Rep Double = DoubleRep + +class Unbox x where + type Unboxed x :: TYPE (Rep x) + unbox :: x -> Unboxed x + box :: Unboxed x -> x + +instance Unbox Int where + type Unboxed Int = Int# + unbox (I# i) = i + box = I# diff --git a/testsuite/tests/indexed-types/should_compile/all.T b/testsuite/tests/indexed-types/should_compile/all.T index 26e24ad..cdce0f6 100644 --- a/testsuite/tests/indexed-types/should_compile/all.T +++ b/testsuite/tests/indexed-types/should_compile/all.T @@ -260,3 +260,4 @@ test('T12522b', normal, compile, ['']) test('T12676', normal, compile, ['']) test('T12526', normal, compile, ['']) test('T12538', normal, compile_fail, ['']) +test('T13244', normal, compile, ['']) From git at git.haskell.org Wed Feb 22 13:48:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 22 Feb 2017 13:48:37 +0000 (UTC) Subject: [commit: ghc] master: A much nicer solution for typechecking ApplicativeDo (254bc33) Message-ID: <20170222134837.51C233A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/254bc3357b0de673b7873f1c4cf5dfc26d0bb5f2/ghc >--------------------------------------------------------------- commit 254bc3357b0de673b7873f1c4cf5dfc26d0bb5f2 Author: Simon Peyton Jones Date: Wed Feb 22 13:45:52 2017 +0000 A much nicer solution for typechecking ApplicativeDo This patch improves the code for TcMatches.tcApplicativeStmts; see the suggestion in Trac #13242 comment:9. I now use (mapM goArg args) rather than a CPS-style fold. The result is less code, easier to understand, and automatically fixes the original problem in Trac #13242. See Note [ApplicativeDo and constraints]. >--------------------------------------------------------------- 254bc3357b0de673b7873f1c4cf5dfc26d0bb5f2 compiler/typecheck/TcMatches.hs | 67 ++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 35 deletions(-) diff --git a/compiler/typecheck/TcMatches.hs b/compiler/typecheck/TcMatches.hs index 68cc9a4..9a3add1 100644 --- a/compiler/typecheck/TcMatches.hs +++ b/compiler/typecheck/TcMatches.hs @@ -1024,10 +1024,17 @@ tcApplicativeStmts ctxt pairs rhs_ty thing_inside ; let (ops, args) = unzip pairs ; ops' <- goOps fun_ty (zip3 ops (ts ++ [rhs_ty]) exp_tys) - ; lie_var <- getConstraintVar -- See Note [ApplicativeDo and constraints] - ; (args', thing) <- goArgs (zip3 args pat_tys exp_tys) - lie_var (thing_inside body_ty) - ; return (zip ops' args', body_ty, thing) } + -- Typecheck each ApplicativeArg separately + -- See Note [ApplicativeDo and constraints] + ; args' <- mapM goArg (zip3 args pat_tys exp_tys) + + -- Bring into scope all the things bound by the args, + -- and typecheck the thign_inside + -- See Note [ApplicativeDo and constraints] + ; res <- tcExtendIdEnv (concatMap get_arg_bndrs args') $ + thing_inside body_ty + + ; return (zip ops' args', body_ty, res) } where goOps _ [] = return [] goOps t_left ((op,t_i,exp_ty) : ops) @@ -1039,40 +1046,32 @@ tcApplicativeStmts ctxt pairs rhs_ty thing_inside ; ops' <- goOps t_i ops ; return (op' : ops') } - goArgs :: [(ApplicativeArg Name Name, Type, Type)] - -> TcRef WantedConstraints -- See Note [ApplicativeDo and constraints] - -> TcM t - -> TcM ([ApplicativeArg TcId TcId], t) - - goArgs [] lie_var thing_inside - = do { thing <- setConstraintVar lie_var thing_inside - ; return ([],thing) - } - goArgs ((ApplicativeArgOne pat rhs, pat_ty, exp_ty) : rest) - lie_var thing_inside + goArg :: (ApplicativeArg Name Name, Type, Type) + -> TcM (ApplicativeArg TcId TcId) + + goArg (ApplicativeArgOne pat rhs, pat_ty, exp_ty) = setSrcSpan (combineSrcSpans (getLoc pat) (getLoc rhs)) $ addErrCtxt (pprStmtInCtxt ctxt (mkBindStmt pat rhs)) $ - setConstraintVar lie_var $ do { rhs' <- tcMonoExprNC rhs (mkCheckExpType exp_ty) - ; (pat',(pairs, thing)) <- - tcPat (StmtCtxt ctxt) pat (mkCheckExpType pat_ty) $ - popErrCtxt $ -- Undoes the enclosing addErrCtxt - goArgs rest lie_var thing_inside - ; return (ApplicativeArgOne pat' rhs' : pairs, thing) } - - goArgs ((ApplicativeArgMany stmts ret pat, pat_ty, exp_ty) : rest) - lie_var thing_inside - = do { (stmts', (ret',pat',rest',thing)) <- - setConstraintVar lie_var $ + ; (pat', _) <- tcPat (StmtCtxt ctxt) pat (mkCheckExpType pat_ty) $ + return () + ; return (ApplicativeArgOne pat' rhs') } + + goArg (ApplicativeArgMany stmts ret pat, pat_ty, exp_ty) + = do { (stmts', (ret',pat')) <- tcStmtsAndThen ctxt tcDoStmt stmts (mkCheckExpType exp_ty) $ \res_ty -> do { L _ ret' <- tcMonoExprNC (noLoc ret) res_ty - ; (pat',(rest', thing)) <- - tcPat (StmtCtxt ctxt) pat (mkCheckExpType pat_ty) $ - goArgs rest lie_var thing_inside - ; return (ret', pat', rest', thing) + ; (pat', _) <- tcPat (StmtCtxt ctxt) pat (mkCheckExpType pat_ty) $ + return () + ; return (ret', pat') } - ; return (ApplicativeArgMany stmts' ret' pat' : rest', thing) } + ; return (ApplicativeArgMany stmts' ret' pat') } + + get_arg_bndrs :: ApplicativeArg TcId TcId -> [Id] + get_arg_bndrs (ApplicativeArgOne pat _) = collectPatBinders pat + get_arg_bndrs (ApplicativeArgMany _ _ pat) = collectPatBinders pat + {- Note [ApplicativeDo and constraints] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1098,10 +1097,8 @@ Now, we say that: * Within the stmts of each 'argi' individually, however, constraints bound by earlier stmts can be used to solve later ones. -To achieve this, we just reset the "LIE var" (in which new required -constraints are collected) to the outer context just before doing each arg, -and the thing_inside. - +To achieve this, we just typecheck each 'argi' separately, bring all +the variables they bind into scope, and typecheck the thing_inside. ************************************************************************ * * From git at git.haskell.org Wed Feb 22 15:43:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 22 Feb 2017 15:43:04 +0000 (UTC) Subject: [commit: ghc] master: Bump time submodule (c8d995d) Message-ID: <20170222154304.356B23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c8d995db5d743358b0583fe97f8113bf9047641e/ghc >--------------------------------------------------------------- commit c8d995db5d743358b0583fe97f8113bf9047641e Author: Ben Gamari Date: Tue Feb 21 10:36:56 2017 -0500 Bump time submodule My previous attempt at bumping `time` was confused by a non-fast-forward update from upstream. Here we merge the orphaned commit back into master, fixing mirroring. Also, we will now follow upstream's `ghc` branch instead of `master` to prevent this sort of thing happening again in the future. >--------------------------------------------------------------- c8d995db5d743358b0583fe97f8113bf9047641e libraries/time | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/time b/libraries/time index 6e202ed..4eb06c0 160000 --- a/libraries/time +++ b/libraries/time @@ -1 +1 @@ -Subproject commit 6e202edc1b0e32c25bc13194e6496c2c18198463 +Subproject commit 4eb06c0e5381a5b5ad2186ac6ecff434cd711376 From git at git.haskell.org Wed Feb 22 17:55:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 22 Feb 2017 17:55:58 +0000 (UTC) Subject: [commit: ghc] master: Revert recent submodule bumps (c347a12) Message-ID: <20170222175558.3E4353A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c347a121b07d22fb91172337407986b6541e319d/ghc >--------------------------------------------------------------- commit c347a121b07d22fb91172337407986b6541e319d Author: Ben Gamari Date: Wed Feb 22 11:35:30 2017 -0500 Revert recent submodule bumps They broke everything and the solution will be non-trivial. This reverts commit 8ccbc2e5252abd4fa67d155d4fff489ee9929906. This reverts commit c8d995db5d743358b0583fe97f8113bf9047641e. This reverts commit 7153370288e6075c4f8c996ff02227e48805da06. >--------------------------------------------------------------- c347a121b07d22fb91172337407986b6541e319d compiler/ghc.cabal.in | 2 +- ghc/ghc-bin.cabal.in | 2 +- libraries/containers | 2 +- libraries/hpc | 2 +- libraries/time | 2 +- libraries/unix | 2 +- testsuite/tests/backpack/should_run/bkprun05.stderr | 2 +- testsuite/tests/cabal/cabal08/all.T | 2 +- testsuite/tests/driver/T10970.stdout | 2 +- testsuite/tests/ghci.debugger/scripts/print026.stdout | 11 ++++------- testsuite/tests/package/package01e.stderr | 4 ++-- testsuite/tests/partial-sigs/should_fail/T10999.stderr | 3 ++- testsuite/tests/th/T10796b.stderr | 2 +- 13 files changed, 18 insertions(+), 20 deletions(-) diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in index b8b7106..f3d6711 100644 --- a/compiler/ghc.cabal.in +++ b/compiler/ghc.cabal.in @@ -55,7 +55,7 @@ Library process >= 1 && < 1.5, bytestring >= 0.9 && < 0.11, binary == 0.8.*, - time >= 1.4 && < 1.9, + time >= 1.4 && < 1.8, containers >= 0.5 && < 0.6, array >= 0.1 && < 0.6, filepath >= 1 && < 1.5, diff --git a/ghc/ghc-bin.cabal.in b/ghc/ghc-bin.cabal.in index 0f50453..9c9ca0e 100644 --- a/ghc/ghc-bin.cabal.in +++ b/ghc/ghc-bin.cabal.in @@ -52,7 +52,7 @@ Executable ghc deepseq == 1.4.*, ghci == @ProjectVersionMunged@, haskeline == 0.7.*, - time == 1.8.*, + time == 1.7.*, transformers == 0.5.* CPP-Options: -DGHCI GHC-Options: -fno-warn-name-shadowing diff --git a/libraries/containers b/libraries/containers index 1a84cc6..aa982fb 160000 --- a/libraries/containers +++ b/libraries/containers @@ -1 +1 @@ -Subproject commit 1a84cc6b920a05533f5789d41a5d5d888351cb31 +Subproject commit aa982fb83f2561d3b27b89b46d36ffca21e072cc diff --git a/libraries/hpc b/libraries/hpc index c23cad3..9267329 160000 --- a/libraries/hpc +++ b/libraries/hpc @@ -1 +1 @@ -Subproject commit c23cad32f408559ba95b880c04dc1a2c60ec3d01 +Subproject commit 92673292ab7ce7878e982d0a02df3e548ef15b52 diff --git a/libraries/time b/libraries/time index 4eb06c0..b6098be 160000 --- a/libraries/time +++ b/libraries/time @@ -1 +1 @@ -Subproject commit 4eb06c0e5381a5b5ad2186ac6ecff434cd711376 +Subproject commit b6098be8a4facfa854c633f2a3a82ab8e72962ef diff --git a/libraries/unix b/libraries/unix index 821cb07..d0b0e8c 160000 --- a/libraries/unix +++ b/libraries/unix @@ -1 +1 @@ -Subproject commit 821cb07ecf235625b4bb06626d30e4b15f28df30 +Subproject commit d0b0e8cf5a7fa5b9dc500d2f623258200818cb16 diff --git a/testsuite/tests/backpack/should_run/bkprun05.stderr b/testsuite/tests/backpack/should_run/bkprun05.stderr index 854de8b..d9042b07 100644 --- a/testsuite/tests/backpack/should_run/bkprun05.stderr +++ b/testsuite/tests/backpack/should_run/bkprun05.stderr @@ -1,4 +1,4 @@ bkprun05: Prelude.undefined CallStack (from HasCallStack): error, called at libraries/base/GHC/Err.hs:79:14 in base:GHC.Err - undefined, called at bkprun05.bkp:138:30 in app+app-89WS9ScvjQd9lPG2oW0wWM:App + undefined, called at bkprun05.bkp:138:30 in app+app-9GMmly0OuEYHDXryaGD7sX:App diff --git a/testsuite/tests/cabal/cabal08/all.T b/testsuite/tests/cabal/cabal08/all.T index 914196b..3aaf185 100644 --- a/testsuite/tests/cabal/cabal08/all.T +++ b/testsuite/tests/cabal/cabal08/all.T @@ -4,6 +4,6 @@ else: cleanup = 'CLEANUP=0' test('cabal08', - expect_broken(13313), + normal, run_command, ['$MAKE -s --no-print-directory cabal08 ' + cleanup]) diff --git a/testsuite/tests/driver/T10970.stdout b/testsuite/tests/driver/T10970.stdout index 9636217..fd35ddd 100644 --- a/testsuite/tests/driver/T10970.stdout +++ b/testsuite/tests/driver/T10970.stdout @@ -1,2 +1,2 @@ -0.5.10.2 +0.5.7.1 OK diff --git a/testsuite/tests/ghci.debugger/scripts/print026.stdout b/testsuite/tests/ghci.debugger/scripts/print026.stdout index 9ed900f..decc3df 100644 --- a/testsuite/tests/ghci.debugger/scripts/print026.stdout +++ b/testsuite/tests/ghci.debugger/scripts/print026.stdout @@ -1,9 +1,6 @@ fromList "abc" -l = Data.Sequence.Internal.Seq (Data.Sequence.Internal.Deep - 3 - (Data.Sequence.Internal.Two - (Data.Sequence.Internal.Elem 'a') - (Data.Sequence.Internal.Elem 'b')) - Data.Sequence.Internal.EmptyT - (Data.Sequence.Internal.One (Data.Sequence.Internal.Elem 'c'))) +l = Data.Sequence.Seq (Data.Sequence.Deep + 3 (Data.Sequence.One (Data.Sequence.Elem 'a')) Data.Sequence.Empty + (Data.Sequence.Two + (Data.Sequence.Elem 'b') (Data.Sequence.Elem 'c'))) l = fromList "abc" diff --git a/testsuite/tests/package/package01e.stderr b/testsuite/tests/package/package01e.stderr index cfde9a7..f34ee1d 100644 --- a/testsuite/tests/package/package01e.stderr +++ b/testsuite/tests/package/package01e.stderr @@ -1,10 +1,10 @@ package01e.hs:2:1: error: Could not find module ‘Data.Map’ - It is a member of the hidden package ‘containers-0.5.10.2’. + It is a member of the hidden package ‘containers-0.5.7.1’. Use -v to see a list of the files searched for. package01e.hs:3:1: error: Could not find module ‘Data.IntMap’ - It is a member of the hidden package ‘containers-0.5.10.2’. + It is a member of the hidden package ‘containers-0.5.7.1’. Use -v to see a list of the files searched for. diff --git a/testsuite/tests/partial-sigs/should_fail/T10999.stderr b/testsuite/tests/partial-sigs/should_fail/T10999.stderr index 0b534b9..582cf1a 100644 --- a/testsuite/tests/partial-sigs/should_fail/T10999.stderr +++ b/testsuite/tests/partial-sigs/should_fail/T10999.stderr @@ -21,7 +21,8 @@ T10999.hs:8:28: error: Relevant bindings include g :: [b0] (bound at T10999.hs:8:1) Probable fix: use a type annotation to specify what ‘b0’ should be. These potential instances exist: - instance Ord a => Ord (Set.Set a) -- Defined in ‘Data.Set.Internal’ + instance Ord a => Ord (Set.Set a) + -- Defined in ‘containers-0.5.7.1:Data.Set.Base’ instance Ord Ordering -- Defined in ‘GHC.Classes’ instance Ord Integer -- Defined in ‘integer-gmp-1.0.0.1:GHC.Integer.Type’ diff --git a/testsuite/tests/th/T10796b.stderr b/testsuite/tests/th/T10796b.stderr index 2491a8c..eff1f75 100644 --- a/testsuite/tests/th/T10796b.stderr +++ b/testsuite/tests/th/T10796b.stderr @@ -1,5 +1,5 @@ T10796b.hs:8:17: error: - • Can't construct a pattern from name Data.Set.Internal.fromList + • Can't construct a pattern from name Data.Set.Base.fromList • In the untyped splice: $(dataToPatQ (const Nothing) (fromList "test")) From git at git.haskell.org Wed Feb 22 18:26:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 22 Feb 2017 18:26:16 +0000 (UTC) Subject: [commit: ghc] branch 'wip/rwbarton-D3164' created Message-ID: <20170222182616.69AF03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/rwbarton-D3164 Referencing: 99894850e71c9fc8f8e5f5531f4a643dbff081c0 From git at git.haskell.org Wed Feb 22 18:26:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 22 Feb 2017 18:26:19 +0000 (UTC) Subject: [commit: ghc] wip/rwbarton-D3164: Use half as much memory when reading interfaces (9989485) Message-ID: <20170222182619.1C4343A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rwbarton-D3164 Link : http://ghc.haskell.org/trac/ghc/changeset/99894850e71c9fc8f8e5f5531f4a643dbff081c0/ghc >--------------------------------------------------------------- commit 99894850e71c9fc8f8e5f5531f4a643dbff081c0 Author: Reid Barton Date: Sun Feb 19 20:05:06 2017 -0500 Use half as much memory when reading interfaces Summary: I don't see any reason for the (filesize*2), and experimentally allocationsn do go down slightly after this change. Test Plan: validate Reviewers: simonmar, austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3164 >--------------------------------------------------------------- 99894850e71c9fc8f8e5f5531f4a643dbff081c0 compiler/utils/Binary.hs | 2 +- testsuite/tests/perf/space_leaks/all.T | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/compiler/utils/Binary.hs b/compiler/utils/Binary.hs index b10ab1d..a1ccee3 100644 --- a/compiler/utils/Binary.hs +++ b/compiler/utils/Binary.hs @@ -207,7 +207,7 @@ readBinMem filename = do h <- openBinaryFile filename ReadMode filesize' <- hFileSize h let filesize = fromIntegral filesize' - arr <- mallocForeignPtrBytes (filesize*2) + arr <- mallocForeignPtrBytes filesize count <- withForeignPtr arr $ \p -> hGetBuf h p filesize when (count /= filesize) $ error ("Binary.readBinMem: only read " ++ show count ++ " bytes") diff --git a/testsuite/tests/perf/space_leaks/all.T b/testsuite/tests/perf/space_leaks/all.T index 76ad7a7..a9afd28 100644 --- a/testsuite/tests/perf/space_leaks/all.T +++ b/testsuite/tests/perf/space_leaks/all.T @@ -58,14 +58,15 @@ test('T4018', test('T4029', [stats_num_field('peak_megabytes_allocated', - [(wordsize(64), 80, 10)]), + [(wordsize(64), 76, 10)]), # 2016-02-26: 66 (amd64/Linux) INITIAL # 2016-05-23: 82 (amd64/Linux) Use -G1 # 2016-07-13: 92 (amd64/Linux) Changes to tidyType # 2016-09-01: 71 (amd64/Linux) Restore w/w limit (#11565) # 2017-02-12: 80 (amd64/Linux) Type-indexed Typeable + # 2017-02-20: 76 (amd64/Linux) Better reading of iface files stats_num_field('max_bytes_used', - [(wordsize(64), 24151096, 5)]), + [(wordsize(64), 22016200, 5)]), # 2016-02-26: 24071720 (amd64/Linux) INITIAL # 2016-04-21: 25542832 (amd64/Linux) # 2016-05-23: 25247216 (amd64/Linux) Use -G1 @@ -77,6 +78,7 @@ test('T4029', # 2017-01-18: 21670448 (amd64/Linux) Float string literals to toplevel # 2017-02-07: 22770352 (amd64/Linux) It is unclear # 2017-02-12: 24151096 (amd64/Linux) Type-indexed Typeable + # 2017-02-20: 22016200 (amd64/Linux) Better reading of iface files extra_hc_opts('+RTS -G1 -RTS' ), ], ghci_script, From git at git.haskell.org Thu Feb 23 08:05:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 23 Feb 2017 08:05:58 +0000 (UTC) Subject: [commit: ghc] master: Changelog notice for compact. (992ea02) Message-ID: <20170223080558.D533D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/992ea02980d59eec0ac730b912fa16733a0fe0e1/ghc >--------------------------------------------------------------- commit 992ea02980d59eec0ac730b912fa16733a0fe0e1 Author: Edward Z. Yang Date: Mon Feb 20 16:25:00 2017 -0800 Changelog notice for compact. Test Plan: none Reviewers: bgamari, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3165 >--------------------------------------------------------------- 992ea02980d59eec0ac730b912fa16733a0fe0e1 docs/users_guide/8.2.1-notes.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/users_guide/8.2.1-notes.rst b/docs/users_guide/8.2.1-notes.rst index d70dc50..9a222e6 100644 --- a/docs/users_guide/8.2.1-notes.rst +++ b/docs/users_guide/8.2.1-notes.rst @@ -346,6 +346,16 @@ containers - Version number XXXXX (was 0.5.4.0) +compact +~~~~~~~ + +The ``compact`` library provides an experimental API for placing immutable +data structures into a contiguous memory region. Data in these regions +is not traced during garbage collection and can be serialized to disk or +over the network. + +- Version number 1.0.0.0 (newly added) + deepseq ~~~~~~~ From git at git.haskell.org Thu Feb 23 08:06:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 23 Feb 2017 08:06:01 +0000 (UTC) Subject: [commit: ghc] master: Drop NFData constraint from compact. (5841574) Message-ID: <20170223080601.8FAB53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/58415741882b8e350beaf81ccedb74ee9c99257d/ghc >--------------------------------------------------------------- commit 58415741882b8e350beaf81ccedb74ee9c99257d Author: Edward Z. Yang Date: Mon Feb 20 21:50:41 2017 -0800 Drop NFData constraint from compact. Summary: It's both unsound (easy to write a bogus NFData instance) and incomplete (you might want to serialize data that doesn't have an NFData instance, and will be fine at runtime.) So better just to drop it. (By the way, we used to need the NFData instance to "pre-evaluate" the data before we copied it into the region, but since Simon Marlow rewrote the code to directly evaluate and copy, this is no longer necessary.) Signed-off-by: Edward Z. Yang Test Plan: validate Reviewers: simonmar, austin, dfeuer, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3168 >--------------------------------------------------------------- 58415741882b8e350beaf81ccedb74ee9c99257d libraries/compact/Data/Compact.hs | 38 +++++++++++-------------- libraries/compact/Data/Compact/Internal.hs | 3 +- libraries/compact/Data/Compact/Serialized.hs | 19 ++++++------- libraries/compact/compact.cabal | 8 ++---- libraries/compact/tests/compact_function.hs | 4 --- libraries/compact/tests/compact_huge_array.hs | 4 --- libraries/compact/tests/compact_loop.hs | 5 ---- libraries/compact/tests/compact_mutable.hs | 4 --- libraries/compact/tests/compact_pinned.hs | 1 - libraries/compact/tests/compact_serialize.hs | 3 +- libraries/compact/tests/compact_simple_array.hs | 4 --- 11 files changed, 31 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 58415741882b8e350beaf81ccedb74ee9c99257d From git at git.haskell.org Thu Feb 23 11:39:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 23 Feb 2017 11:39:09 +0000 (UTC) Subject: [commit: ghc] master: Export commentToAnnotation from Lexer.x (8a6b8c5) Message-ID: <20170223113909.BD6FE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8a6b8c5fb96472d7c2e2cd1918950dd50f2fef71/ghc >--------------------------------------------------------------- commit 8a6b8c5fb96472d7c2e2cd1918950dd50f2fef71 Author: Alan Zimmerman Date: Thu Feb 23 13:16:51 2017 +0200 Export commentToAnnotation from Lexer.x >--------------------------------------------------------------- 8a6b8c5fb96472d7c2e2cd1918950dd50f2fef71 compiler/parser/Lexer.x | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x index 63715a0..1939432 100644 --- a/compiler/parser/Lexer.x +++ b/compiler/parser/Lexer.x @@ -71,6 +71,7 @@ module Lexer ( addWarning, lexTokenStream, addAnnotation,AddAnn,addAnnsAt,mkParensApiAnn, + commentToAnnotation, moveAnnotations ) where From git at git.haskell.org Thu Feb 23 16:28:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 23 Feb 2017 16:28:44 +0000 (UTC) Subject: [commit: ghc] master: Spelling only [ci skip] (9a2a2ae) Message-ID: <20170223162844.734803A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9a2a2aef1c84292cc51719ee36e12c5723554efe/ghc >--------------------------------------------------------------- commit 9a2a2aef1c84292cc51719ee36e12c5723554efe Author: Gabor Greif Date: Thu Feb 23 17:01:07 2017 +0100 Spelling only [ci skip] >--------------------------------------------------------------- 9a2a2aef1c84292cc51719ee36e12c5723554efe compiler/basicTypes/Demand.hs | 2 +- compiler/basicTypes/MkId.hs | 2 +- compiler/codeGen/StgCmmExpr.hs | 2 +- compiler/coreSyn/CoreUnfold.hs | 2 +- compiler/coreSyn/CoreUtils.hs | 2 +- compiler/nativeGen/X86/CodeGen.hs | 2 +- compiler/parser/Lexer.x | 2 +- compiler/rename/RnSplice.hs | 2 +- compiler/typecheck/TcEnv.hs | 2 +- compiler/typecheck/TcExpr.hs | 2 +- compiler/typecheck/TcMatches.hs | 4 ++-- docs/storage-mgt/sm.tex | 2 +- docs/users_guide/using-warnings.rst | 2 +- libraries/base/System/Exit.hs | 2 +- rts/RaiseAsync.c | 2 +- 15 files changed, 16 insertions(+), 16 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 9a2a2aef1c84292cc51719ee36e12c5723554efe From git at git.haskell.org Thu Feb 23 16:50:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 23 Feb 2017 16:50:46 +0000 (UTC) Subject: [commit: ghc] branch 'wip/inline-ioenv' created Message-ID: <20170223165046.2DC0F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/inline-ioenv Referencing: 4a8e9b0bf2c48f1a9b8c8afd2c9b781da5fc866a From git at git.haskell.org Thu Feb 23 16:50:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 23 Feb 2017 16:50:51 +0000 (UTC) Subject: [commit: ghc] wip/inline-ioenv: Inline IOEnv methods (4a8e9b0) Message-ID: <20170223165051.885563A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/inline-ioenv Link : http://ghc.haskell.org/trac/ghc/changeset/4a8e9b0bf2c48f1a9b8c8afd2c9b781da5fc866a/ghc >--------------------------------------------------------------- commit 4a8e9b0bf2c48f1a9b8c8afd2c9b781da5fc866a Author: Dmitry Ivanov Date: Thu Feb 23 11:50:27 2017 -0500 Inline IOEnv methods These changes seem to make compiler allocate less and a bit faster. However, I've checked only with a few files and only with a profiled build of stage2. How do I check the alleged performance improvement properly? Reviewers: austin, bgamari, dfeuer Subscribers: dfeuer, thomie Differential Revision: https://phabricator.haskell.org/D3171 >--------------------------------------------------------------- 4a8e9b0bf2c48f1a9b8c8afd2c9b781da5fc866a compiler/utils/IOEnv.hs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/compiler/utils/IOEnv.hs b/compiler/utils/IOEnv.hs index 29854c5..17af162 100644 --- a/compiler/utils/IOEnv.hs +++ b/compiler/utils/IOEnv.hs @@ -58,7 +58,9 @@ unIOEnv :: IOEnv env a -> (env -> IO a) unIOEnv (IOEnv m) = m instance Monad (IOEnv m) where + {-# INLINE (>>=) #-} (>>=) = thenM + {-# INLINE (>>) #-} (>>) = (*>) fail _ = failM -- Ignore the string @@ -70,19 +72,24 @@ instance MonadFail.MonadFail (IOEnv m) where instance Applicative (IOEnv m) where pure = returnM + {-# INLINE (<*>) #-} IOEnv f <*> IOEnv x = IOEnv (\ env -> f env <*> x env ) (*>) = thenM_ instance Functor (IOEnv m) where + {-# INLINE fmap #-} fmap f (IOEnv m) = IOEnv (\ env -> fmap f (m env)) +{-# INLINE returnM #-} returnM :: a -> IOEnv env a returnM a = IOEnv (\ _ -> return a) +{-# INLINE thenM #-} thenM :: IOEnv env a -> (a -> IOEnv env b) -> IOEnv env b thenM (IOEnv m) f = IOEnv (\ env -> do { r <- m env ; unIOEnv (f r) env }) +{-# INLINE thenM_ #-} thenM_ :: IOEnv env a -> IOEnv env b -> IOEnv env b thenM_ (IOEnv m) f = IOEnv (\ env -> do { _ <- m env ; unIOEnv f env }) From git at git.haskell.org Thu Feb 23 16:50:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 23 Feb 2017 16:50:48 +0000 (UTC) Subject: [commit: ghc] wip/inline-ioenv: testsuite: Bump a performance tests (c6406fa) Message-ID: <20170223165048.D5B4F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/inline-ioenv Link : http://ghc.haskell.org/trac/ghc/changeset/c6406fa3638bb95fa9de4b0f3b3cc98f56a82b55/ghc >--------------------------------------------------------------- commit c6406fa3638bb95fa9de4b0f3b3cc98f56a82b55 Author: Ben Gamari Date: Thu Feb 23 11:25:57 2017 -0500 testsuite: Bump a performance tests T5321Fun, T3064, and T12707 are failing, but only on Darwin. I suspect this is probably creep from Typeable and pushed over the edge by some of Simon's recent commits. Unfortunately the tree brokenness due to the recent submodule bumps makes it difficult to pin down. >--------------------------------------------------------------- c6406fa3638bb95fa9de4b0f3b3cc98f56a82b55 testsuite/tests/perf/compiler/all.T | 67 +++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 32 deletions(-) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index e5fefaa..757bd36 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -316,29 +316,30 @@ test('T3064', # 2014-12-22: 122836340 (Windows) Death to silent superclasses # 2016-04-06: 153261024 (x86/Linux) probably wildcard refactor - (wordsize(64), 287460128, 5)]), - # (amd64/Linux) (28/06/2011): 73259544 - # (amd64/Linux) (07/02/2013): 224798696 - # (amd64/Linux) (02/08/2013): 236404384, increase from roles - # (amd64/Linux) (11/09/2013): 290165632, increase from AMP warnings - # (amd64/Linux) (22/11/2013): 308300448, GND via Coercible and counters for constraints solving - # (amd64/Linux) (02/12/2013): 329795912, Coercible refactor - # (amd64/Linux) (11/02/2014): 308422280, optimize Coercions in simpleOptExpr - # (amd64/Linux) (23/05/2014): 324022680, unknown cause + (wordsize(64), 306222424, 5)]), + # (amd64/Linux) (2011-06-28): 73259544 + # (amd64/Linux) (2013-02-07): 224798696 + # (amd64/Linux) (2013-08-02): 236404384, increase from roles + # (amd64/Linux) (2013-09-11): 290165632, increase from AMP warnings + # (amd64/Linux) (2013-11-22): 308300448, GND via Coercible and counters for constraints solving + # (amd64/Linux) (2013-12-02): 329795912, Coercible refactor + # (amd64/Linux) (2014-02-11): 308422280, optimize Coercions in simpleOptExpr + # (amd64/Linux) (2014-05-23): 324022680, unknown cause # (amd64/Linux) (2014-07-17): 332702112, general round of updates # (amd64/Linux) (2014-08-29): 313638592, w/w for INLINABLE things - # (amd64/Linux) (09/09/2014): 407416464, AMP changes (larger interfaces, more loading) - # (amd64/Linux) (14/09/2014): 385145080, BPP changes (more NoImplicitPrelude in base) - # (amd64/Linux) (10/12/2014): 363103840, improvements in constraint solver - # (Mac) (18/12/2014): 350418600, improvements to flattener - # (amd64/Linux) (22/12/2014): 243670824, Ha! Death to superclass constraints, makes + # (amd64/Linux) (2014-09-09): 407416464, AMP changes (larger interfaces, more loading) + # (amd64/Linux) (2014-09-14): 385145080, BPP changes (more NoImplicitPrelude in base) + # (amd64/Linux) (2014-12-10): 363103840, improvements in constraint solver + # (Mac) (2014-12-18): 350418600, improvements to flattener + # (amd64/Linux) (2014-12-22): 243670824, Ha! Death to superclass constraints, makes # much less code for Monad instances - # (amd64/Linux) (01/12/2015): 264952256, Regression due to Simon's wildcard refactor + # (amd64/Linux) (2015-12-01): 264952256, Regression due to Simon's wildcard refactor # Tracked as #11151. - # (amd64/Linux) (11/12/2015): 304344936, Regression due to TypeInType + # (amd64/Linux) (2015-12-11): 304344936, Regression due to TypeInType # Tracked as #11196 - # (amd64/Linux) (15/4/2016): 287460128 Improvement due to using coercionKind instead + # (amd64/Linux) (2016-04-15): 287460128 Improvement due to using coercionKind instead # of zonkTcType (Trac #11882) + # (amd64/Darwin) (2017-01-23): 306222424 Presumably creep from recent changes (Typeable?) ################################### # deactivated for now, as this metric became too volatile recently @@ -507,32 +508,33 @@ test('T5321Fun', # 2012-10-08: 344416344 x86/Linux # (increase due to new codegen) # 2014-09-03: 299656164 (specialisation and inlining) - # 10/12/2014: 206406188 # Improvements in constraint solver + # 2014-12-10: 206406188 # Improvements in constraint solver # 2016-04-06: 279922360 x86/Linux - (wordsize(64), 498135752, 5)]) + (wordsize(64), 524706256, 5)]) # prev: 585521080 - # 29/08/2012: 713385808 # (increase due to new codegen) - # 15/05/2013: 628341952 # (reason for decrease unknown) - # 24/06/2013: 694019152 # (reason for re-increase unknown) - # 12/05/2014: 614409344 # (specialisation and inlining changes) - # 10/09/2014: 601629032 # post-AMP-cleanup - # 06/11/2014: 541287000 # Simon's flat-skol changes to the constraint solver - # 10/12/2014: 408110888 # Improvements in constraint solver - # 16/12/2014: 429921312 # Flattener parameterized over roles - # 10/08/2015: 509921312 + # 2012-08-29: 713385808 # (increase due to new codegen) + # 2013-05-15: 628341952 # (reason for decrease unknown) + # 2013-06-24: 694019152 # (reason for re-increase unknown) + # 2014-05-12: 614409344 # (specialisation and inlining changes) + # 2014-09-10: 601629032 # post-AMP-cleanup + # 2014-11-06: 541287000 # Simon's flat-skol changes to the constraint solver + # 2014-12-10: 408110888 # Improvements in constraint solver + # 2014-12-16: 429921312 # Flattener parameterized over roles + # 2015-08-10: 509921312 # (undefined now takes an implicit parameter and GHC -O0 does # not recognize that the application is bottom) - # 11/12/2015: 565883176 # TypeInType (see #11196) - # 06/01/2017: 497356688 # Small coercion optimisations + # 2015-12-11: 565883176 # TypeInType (see #11196) + # 2017-01-06: 497356688 # Small coercion optimisations # The actual decrease was only 2%; earlier # commits had drifted down - # 22/01/2017: 525895608 # Allow top-level string literals in Core. I'm not + # 2017-01-22: 525895608 # Allow top-level string literals in Core. I'm not # convinced that this patch is # responsible for all of this # change, however. Namely I am # quite skeptical of the downward # "drift" reported above - # 31/01/2017: 498135752 # Join points (#12988) + # 2017-01-31: 498135752 # Join points (#12988) + # 2017-02-23: 524706256 # Type-indexed Typeable? (on Darwin) ], compile,['']) @@ -992,6 +994,7 @@ test('T12707', # 2017-01-22: 1348865648 Allow top-level strings in Core # 2017-01-31: 1280336112 Join points (#12988) # 2017-02-11: 1310037632 Check local family instances vs imports + # 2017-02-23: 1386110512 Type-indexed Typeable? (on Darwin) ]), ], compile, From git at git.haskell.org Thu Feb 23 16:53:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 23 Feb 2017 16:53:18 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Bump a performance tests (050f05d) Message-ID: <20170223165318.1D5253A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/050f05df7b3f33bf2ec66b103aaaa19ff9d08116/ghc >--------------------------------------------------------------- commit 050f05df7b3f33bf2ec66b103aaaa19ff9d08116 Author: Ben Gamari Date: Thu Feb 23 11:25:57 2017 -0500 testsuite: Bump a performance tests T5321Fun, T3064, and T12707 are failing, but only on Darwin. I suspect this is probably creep from Typeable and pushed over the edge by some of Simon's recent commits. Unfortunately the tree brokenness due to the recent submodule bumps makes it difficult to pin down. >--------------------------------------------------------------- 050f05df7b3f33bf2ec66b103aaaa19ff9d08116 testsuite/tests/perf/compiler/all.T | 67 +++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 32 deletions(-) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index e5fefaa..757bd36 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -316,29 +316,30 @@ test('T3064', # 2014-12-22: 122836340 (Windows) Death to silent superclasses # 2016-04-06: 153261024 (x86/Linux) probably wildcard refactor - (wordsize(64), 287460128, 5)]), - # (amd64/Linux) (28/06/2011): 73259544 - # (amd64/Linux) (07/02/2013): 224798696 - # (amd64/Linux) (02/08/2013): 236404384, increase from roles - # (amd64/Linux) (11/09/2013): 290165632, increase from AMP warnings - # (amd64/Linux) (22/11/2013): 308300448, GND via Coercible and counters for constraints solving - # (amd64/Linux) (02/12/2013): 329795912, Coercible refactor - # (amd64/Linux) (11/02/2014): 308422280, optimize Coercions in simpleOptExpr - # (amd64/Linux) (23/05/2014): 324022680, unknown cause + (wordsize(64), 306222424, 5)]), + # (amd64/Linux) (2011-06-28): 73259544 + # (amd64/Linux) (2013-02-07): 224798696 + # (amd64/Linux) (2013-08-02): 236404384, increase from roles + # (amd64/Linux) (2013-09-11): 290165632, increase from AMP warnings + # (amd64/Linux) (2013-11-22): 308300448, GND via Coercible and counters for constraints solving + # (amd64/Linux) (2013-12-02): 329795912, Coercible refactor + # (amd64/Linux) (2014-02-11): 308422280, optimize Coercions in simpleOptExpr + # (amd64/Linux) (2014-05-23): 324022680, unknown cause # (amd64/Linux) (2014-07-17): 332702112, general round of updates # (amd64/Linux) (2014-08-29): 313638592, w/w for INLINABLE things - # (amd64/Linux) (09/09/2014): 407416464, AMP changes (larger interfaces, more loading) - # (amd64/Linux) (14/09/2014): 385145080, BPP changes (more NoImplicitPrelude in base) - # (amd64/Linux) (10/12/2014): 363103840, improvements in constraint solver - # (Mac) (18/12/2014): 350418600, improvements to flattener - # (amd64/Linux) (22/12/2014): 243670824, Ha! Death to superclass constraints, makes + # (amd64/Linux) (2014-09-09): 407416464, AMP changes (larger interfaces, more loading) + # (amd64/Linux) (2014-09-14): 385145080, BPP changes (more NoImplicitPrelude in base) + # (amd64/Linux) (2014-12-10): 363103840, improvements in constraint solver + # (Mac) (2014-12-18): 350418600, improvements to flattener + # (amd64/Linux) (2014-12-22): 243670824, Ha! Death to superclass constraints, makes # much less code for Monad instances - # (amd64/Linux) (01/12/2015): 264952256, Regression due to Simon's wildcard refactor + # (amd64/Linux) (2015-12-01): 264952256, Regression due to Simon's wildcard refactor # Tracked as #11151. - # (amd64/Linux) (11/12/2015): 304344936, Regression due to TypeInType + # (amd64/Linux) (2015-12-11): 304344936, Regression due to TypeInType # Tracked as #11196 - # (amd64/Linux) (15/4/2016): 287460128 Improvement due to using coercionKind instead + # (amd64/Linux) (2016-04-15): 287460128 Improvement due to using coercionKind instead # of zonkTcType (Trac #11882) + # (amd64/Darwin) (2017-01-23): 306222424 Presumably creep from recent changes (Typeable?) ################################### # deactivated for now, as this metric became too volatile recently @@ -507,32 +508,33 @@ test('T5321Fun', # 2012-10-08: 344416344 x86/Linux # (increase due to new codegen) # 2014-09-03: 299656164 (specialisation and inlining) - # 10/12/2014: 206406188 # Improvements in constraint solver + # 2014-12-10: 206406188 # Improvements in constraint solver # 2016-04-06: 279922360 x86/Linux - (wordsize(64), 498135752, 5)]) + (wordsize(64), 524706256, 5)]) # prev: 585521080 - # 29/08/2012: 713385808 # (increase due to new codegen) - # 15/05/2013: 628341952 # (reason for decrease unknown) - # 24/06/2013: 694019152 # (reason for re-increase unknown) - # 12/05/2014: 614409344 # (specialisation and inlining changes) - # 10/09/2014: 601629032 # post-AMP-cleanup - # 06/11/2014: 541287000 # Simon's flat-skol changes to the constraint solver - # 10/12/2014: 408110888 # Improvements in constraint solver - # 16/12/2014: 429921312 # Flattener parameterized over roles - # 10/08/2015: 509921312 + # 2012-08-29: 713385808 # (increase due to new codegen) + # 2013-05-15: 628341952 # (reason for decrease unknown) + # 2013-06-24: 694019152 # (reason for re-increase unknown) + # 2014-05-12: 614409344 # (specialisation and inlining changes) + # 2014-09-10: 601629032 # post-AMP-cleanup + # 2014-11-06: 541287000 # Simon's flat-skol changes to the constraint solver + # 2014-12-10: 408110888 # Improvements in constraint solver + # 2014-12-16: 429921312 # Flattener parameterized over roles + # 2015-08-10: 509921312 # (undefined now takes an implicit parameter and GHC -O0 does # not recognize that the application is bottom) - # 11/12/2015: 565883176 # TypeInType (see #11196) - # 06/01/2017: 497356688 # Small coercion optimisations + # 2015-12-11: 565883176 # TypeInType (see #11196) + # 2017-01-06: 497356688 # Small coercion optimisations # The actual decrease was only 2%; earlier # commits had drifted down - # 22/01/2017: 525895608 # Allow top-level string literals in Core. I'm not + # 2017-01-22: 525895608 # Allow top-level string literals in Core. I'm not # convinced that this patch is # responsible for all of this # change, however. Namely I am # quite skeptical of the downward # "drift" reported above - # 31/01/2017: 498135752 # Join points (#12988) + # 2017-01-31: 498135752 # Join points (#12988) + # 2017-02-23: 524706256 # Type-indexed Typeable? (on Darwin) ], compile,['']) @@ -992,6 +994,7 @@ test('T12707', # 2017-01-22: 1348865648 Allow top-level strings in Core # 2017-01-31: 1280336112 Join points (#12988) # 2017-02-11: 1310037632 Check local family instances vs imports + # 2017-02-23: 1386110512 Type-indexed Typeable? (on Darwin) ]), ], compile, From git at git.haskell.org Thu Feb 23 21:46:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 23 Feb 2017 21:46:37 +0000 (UTC) Subject: [commit: ghc] master: Give better error message with you run ghc foo.bkp (de80558) Message-ID: <20170223214637.DDB083A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/de805583db457e2ee64468f3ed4cd9092d4ef8c8/ghc >--------------------------------------------------------------- commit de805583db457e2ee64468f3ed4cd9092d4ef8c8 Author: Edward Z. Yang Date: Wed Feb 22 19:54:40 2017 -0800 Give better error message with you run ghc foo.bkp Summary: Detect Backpackish suffixes, and bail out if we try to run them in the pipeline. Signed-off-by: Edward Z. Yang Test Plan: validate Reviewers: rwbarton, bgamari, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3172 >--------------------------------------------------------------- de805583db457e2ee64468f3ed4cd9092d4ef8c8 compiler/main/DriverPhases.hs | 11 ++++++++--- compiler/main/DriverPipeline.hs | 4 ++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/compiler/main/DriverPhases.hs b/compiler/main/DriverPhases.hs index 650bb15..57b2417 100644 --- a/compiler/main/DriverPhases.hs +++ b/compiler/main/DriverPhases.hs @@ -18,6 +18,7 @@ module DriverPhases ( isHaskellishSuffix, isHaskellSrcSuffix, + isBackpackishSuffix, isObjectSuffix, isCishSuffix, isDynLibSuffix, @@ -291,7 +292,7 @@ phaseInputExt Cmm = "cmmcpp" phaseInputExt MergeStub = "o" phaseInputExt StopLn = "o" -haskellish_src_suffixes, haskellish_suffixes, cish_suffixes, +haskellish_src_suffixes, backpackish_suffixes, haskellish_suffixes, cish_suffixes, haskellish_user_src_suffixes, haskellish_sig_suffixes :: [String] -- When a file with an extension in the haskellish_src_suffixes group is @@ -306,6 +307,7 @@ cish_suffixes = [ "c", "cpp", "C", "cc", "cxx", "s", "S", "ll", " haskellish_user_src_suffixes = haskellish_sig_suffixes ++ [ "hs", "lhs", "hs-boot", "lhs-boot" ] haskellish_sig_suffixes = [ "hsig", "lhsig" ] +backpackish_suffixes = [ "bkp" ] objish_suffixes :: Platform -> [String] -- Use the appropriate suffix for the system on which @@ -320,10 +322,11 @@ dynlib_suffixes platform = case platformOS platform of OSDarwin -> ["dylib", "so"] _ -> ["so"] -isHaskellishSuffix, isHaskellSrcSuffix, isCishSuffix, +isHaskellishSuffix, isBackpackishSuffix, isHaskellSrcSuffix, isCishSuffix, isHaskellUserSrcSuffix, isHaskellSigSuffix :: String -> Bool isHaskellishSuffix s = s `elem` haskellish_suffixes +isBackpackishSuffix s = s `elem` backpackish_suffixes isHaskellSigSuffix s = s `elem` haskellish_sig_suffixes isHaskellSrcSuffix s = s `elem` haskellish_src_suffixes isCishSuffix s = s `elem` cish_suffixes @@ -334,7 +337,9 @@ isObjectSuffix platform s = s `elem` objish_suffixes platform isDynLibSuffix platform s = s `elem` dynlib_suffixes platform isSourceSuffix :: String -> Bool -isSourceSuffix suff = isHaskellishSuffix suff || isCishSuffix suff +isSourceSuffix suff = isHaskellishSuffix suff + || isCishSuffix suff + || isBackpackishSuffix suff -- | When we are given files (modified by -x arguments) we need -- to determine if they are Haskellish or not to figure out diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index adebdf4..ca82e73 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -601,6 +601,10 @@ runPipeline stop_phase hsc_env0 (input_fn, mb_phase) src_suffix = suffix', output_spec = output } + when (isBackpackishSuffix suffix') $ + throwGhcExceptionIO (UsageError + ("use --backpack to process " ++ input_fn)) + -- We want to catch cases of "you can't get there from here" before -- we start the pipeline, because otherwise it will just run off the -- end. From git at git.haskell.org Thu Feb 23 21:46:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 23 Feb 2017 21:46:40 +0000 (UTC) Subject: [commit: ghc] master: Have --backpack complain if multiple files are passed. (0a77ced) Message-ID: <20170223214640.969BD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0a77cedb914a67b8bd7c4af1f87714dc497fec3e/ghc >--------------------------------------------------------------- commit 0a77cedb914a67b8bd7c4af1f87714dc497fec3e Author: Edward Z. Yang Date: Wed Feb 22 19:59:55 2017 -0800 Have --backpack complain if multiple files are passed. Summary: At the moment it silently swallows the actual arguments; not good! Signed-off-by: Edward Z. Yang Test Plan: validate Reviewers: rwbarton, bgamari, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3173 >--------------------------------------------------------------- 0a77cedb914a67b8bd7c4af1f87714dc497fec3e compiler/backpack/DriverBkp.hs | 7 +++++-- ghc/Main.hs | 12 ++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/compiler/backpack/DriverBkp.hs b/compiler/backpack/DriverBkp.hs index 25ef624..e14e2d8 100644 --- a/compiler/backpack/DriverBkp.hs +++ b/compiler/backpack/DriverBkp.hs @@ -51,6 +51,7 @@ import Util import qualified GHC.LanguageExtensions as LangExt +import Panic import Data.List import System.Exit import Control.Monad @@ -63,8 +64,8 @@ import Data.Map (Map) import qualified Data.Map as Map -- | Entry point to compile a Backpack file. -doBackpack :: FilePath -> Ghc () -doBackpack src_filename = do +doBackpack :: [FilePath] -> Ghc () +doBackpack [src_filename] = do -- Apply options from file to dflags dflags0 <- getDynFlags let dflags1 = dflags0 @@ -96,6 +97,8 @@ doBackpack src_filename = do then compileExe lunit else compileUnit cid [] else typecheckUnit cid insts +doBackpack _ = + throwGhcException (CmdLineError "--backpack can only process a single file") computeUnitId :: LHsUnit HsComponentId -> (ComponentId, [(ModuleName, Module)]) computeUnitId (L _ unit) = (cid, [ (r, mkHoleModule r) | r <- reqs ]) diff --git a/ghc/Main.hs b/ghc/Main.hs index 0984bf7..29012f6 100644 --- a/ghc/Main.hs +++ b/ghc/Main.hs @@ -162,7 +162,7 @@ main' postLoadMode dflags0 args flagWarnings = do DoInteractive -> (CompManager, HscInterpreted, LinkInMemory) DoEval _ -> (CompManager, HscInterpreted, LinkInMemory) DoMake -> (CompManager, dflt_target, LinkBinary) - DoBackpack _ -> (CompManager, dflt_target, LinkBinary) + DoBackpack -> (CompManager, dflt_target, LinkBinary) DoMkDependHS -> (MkDepend, dflt_target, LinkBinary) DoAbiHash -> (OneShot, dflt_target, LinkBinary) _ -> (OneShot, dflt_target, LinkBinary) @@ -253,7 +253,7 @@ main' postLoadMode dflags0 args flagWarnings = do DoAbiHash -> abiHash (map fst srcs) ShowPackages -> liftIO $ showPackages dflags6 DoFrontend f -> doFrontend f srcs - DoBackpack b -> doBackpack b + DoBackpack -> doBackpack (map fst srcs) liftIO $ dumpFinalStats dflags6 @@ -455,7 +455,7 @@ data PostLoadMode | StopBefore Phase -- ghc -E | -C | -S -- StopBefore StopLn is the default | DoMake -- ghc --make - | DoBackpack String -- ghc --backpack foo.bkp + | DoBackpack -- ghc --backpack foo.bkp | DoInteractive -- ghc --interactive | DoEval [String] -- ghc -e foo -e bar => DoEval ["bar", "foo"] | DoAbiHash -- ghc --abi-hash @@ -482,8 +482,8 @@ doEvalMode str = mkPostLoadMode (DoEval [str]) doFrontendMode :: String -> Mode doFrontendMode str = mkPostLoadMode (DoFrontend (mkModuleName str)) -doBackpackMode :: String -> Mode -doBackpackMode str = mkPostLoadMode (DoBackpack str) +doBackpackMode :: Mode +doBackpackMode = mkPostLoadMode DoBackpack mkPostLoadMode :: PostLoadMode -> Mode mkPostLoadMode = Right . Right @@ -614,7 +614,7 @@ mode_flags = , defFlag "C" (PassFlag (setMode (stopBeforeMode HCc))) , defFlag "S" (PassFlag (setMode (stopBeforeMode (As False)))) , defFlag "-make" (PassFlag (setMode doMakeMode)) - , defFlag "-backpack" (SepArg (\s -> setMode (doBackpackMode s) "-backpack")) + , defFlag "-backpack" (PassFlag (setMode doBackpackMode)) , defFlag "-interactive" (PassFlag (setMode doInteractiveMode)) , defFlag "-abi-hash" (PassFlag (setMode doAbiHashMode)) , defFlag "e" (SepArg (\s -> setMode (doEvalMode s) "-e")) From git at git.haskell.org Thu Feb 23 22:27:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 23 Feb 2017 22:27:03 +0000 (UTC) Subject: [commit: ghc] master: Use half as much memory when reading interfaces (12e21d3) Message-ID: <20170223222703.8F6ED3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/12e21d35ee1b77f5f2bb8bd747848f07a32d592f/ghc >--------------------------------------------------------------- commit 12e21d35ee1b77f5f2bb8bd747848f07a32d592f Author: Reid Barton Date: Thu Feb 23 13:54:36 2017 -0500 Use half as much memory when reading interfaces I don't see any reason for the (filesize*2), and experimentally allocations do go down slightly after this change. Test Plan: validate Reviewers: simonmar, austin, bgamari, trofi Reviewed By: bgamari, trofi Subscribers: trofi, thomie Differential Revision: https://phabricator.haskell.org/D3164 >--------------------------------------------------------------- 12e21d35ee1b77f5f2bb8bd747848f07a32d592f compiler/utils/Binary.hs | 2 +- testsuite/tests/perf/space_leaks/all.T | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/compiler/utils/Binary.hs b/compiler/utils/Binary.hs index b10ab1d..a1ccee3 100644 --- a/compiler/utils/Binary.hs +++ b/compiler/utils/Binary.hs @@ -207,7 +207,7 @@ readBinMem filename = do h <- openBinaryFile filename ReadMode filesize' <- hFileSize h let filesize = fromIntegral filesize' - arr <- mallocForeignPtrBytes (filesize*2) + arr <- mallocForeignPtrBytes filesize count <- withForeignPtr arr $ \p -> hGetBuf h p filesize when (count /= filesize) $ error ("Binary.readBinMem: only read " ++ show count ++ " bytes") diff --git a/testsuite/tests/perf/space_leaks/all.T b/testsuite/tests/perf/space_leaks/all.T index 76ad7a7..a9afd28 100644 --- a/testsuite/tests/perf/space_leaks/all.T +++ b/testsuite/tests/perf/space_leaks/all.T @@ -58,14 +58,15 @@ test('T4018', test('T4029', [stats_num_field('peak_megabytes_allocated', - [(wordsize(64), 80, 10)]), + [(wordsize(64), 76, 10)]), # 2016-02-26: 66 (amd64/Linux) INITIAL # 2016-05-23: 82 (amd64/Linux) Use -G1 # 2016-07-13: 92 (amd64/Linux) Changes to tidyType # 2016-09-01: 71 (amd64/Linux) Restore w/w limit (#11565) # 2017-02-12: 80 (amd64/Linux) Type-indexed Typeable + # 2017-02-20: 76 (amd64/Linux) Better reading of iface files stats_num_field('max_bytes_used', - [(wordsize(64), 24151096, 5)]), + [(wordsize(64), 22016200, 5)]), # 2016-02-26: 24071720 (amd64/Linux) INITIAL # 2016-04-21: 25542832 (amd64/Linux) # 2016-05-23: 25247216 (amd64/Linux) Use -G1 @@ -77,6 +78,7 @@ test('T4029', # 2017-01-18: 21670448 (amd64/Linux) Float string literals to toplevel # 2017-02-07: 22770352 (amd64/Linux) It is unclear # 2017-02-12: 24151096 (amd64/Linux) Type-indexed Typeable + # 2017-02-20: 22016200 (amd64/Linux) Better reading of iface files extra_hc_opts('+RTS -G1 -RTS' ), ], ghci_script, From git at git.haskell.org Thu Feb 23 22:27:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 23 Feb 2017 22:27:13 +0000 (UTC) Subject: [commit: ghc] master: ghci users guide: mention "~" expansion in :add (bb1c660) Message-ID: <20170223222713.3CD763A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/bb1c660f3e0f1b471eb74cbb02275b97db3fa8b4/ghc >--------------------------------------------------------------- commit bb1c660f3e0f1b471eb74cbb02275b97db3fa8b4 Author: Chris Martin Date: Thu Feb 23 13:52:51 2017 -0500 ghci users guide: mention "~" expansion in :add I discovered this feature via Stack Overflow. https://stackoverflow.com/questions/42310399 Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3150 >--------------------------------------------------------------- bb1c660f3e0f1b471eb74cbb02275b97db3fa8b4 docs/users_guide/ghci.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/users_guide/ghci.rst b/docs/users_guide/ghci.rst index d7f6b4b..864ae80 100644 --- a/docs/users_guide/ghci.rst +++ b/docs/users_guide/ghci.rst @@ -2045,6 +2045,10 @@ commonly used commands. available, or otherwise the module will be compiled to byte-code. Using the ``*`` prefix forces the module to be loaded as byte-code. + ⟨module⟩ may be a file path. A "``~``" symbol at the beginning of + ⟨module⟩ will be replaced by the contents of the environment variable + :envvar:`HOME`. + .. ghci-cmd:: :all-types List all types collected for expressions and (local) bindings From git at git.haskell.org Thu Feb 23 22:27:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 23 Feb 2017 22:27:06 +0000 (UTC) Subject: [commit: ghc] master: base: Add handling of -- to getArgs for Windows (6ca6a36) Message-ID: <20170223222706.E71913A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6ca6a360c2b71d7e0c77a819dc463b37efe7a39d/ghc >--------------------------------------------------------------- commit 6ca6a360c2b71d7e0c77a819dc463b37efe7a39d Author: Andreas Klebinger Date: Thu Feb 23 13:46:15 2017 -0500 base: Add handling of -- to getArgs for Windows getArgs didn't match the treatmeant of -- in the RTS leading to inconsistencies between behavior on Windows and other platforms. See #13287. Reviewers: austin, hvr, bgamari, erikd, simonmar, rwbarton Reviewed By: bgamari, rwbarton Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3147 >--------------------------------------------------------------- 6ca6a360c2b71d7e0c77a819dc463b37efe7a39d libraries/base/System/Environment.hs | 16 +++++++++++++++- rts/RtsFlags.c | 9 ++++++++- testsuite/tests/rts/T13287/T13287.hs | 4 ++++ testsuite/tests/rts/T13287/T13287.stdout | 1 + testsuite/tests/rts/T13287/all.T | 4 ++++ 5 files changed, 32 insertions(+), 2 deletions(-) diff --git a/libraries/base/System/Environment.hs b/libraries/base/System/Environment.hs index d8b3e03..61b728c 100644 --- a/libraries/base/System/Environment.hs +++ b/libraries/base/System/Environment.hs @@ -67,12 +67,24 @@ import System.Environment.ExecutablePath #ifdef mingw32_HOST_OS --- Ignore the arguments to hs_init on Windows for the sake of Unicode compat +{- +Note [Ignore hs_init argv] +~~~~~~~~~~~~~~~~~~~~~~~~~~ +Ignore the arguments to hs_init on Windows for the sake of Unicode compat + +Instead on Windows we get the list of arguments from getCommandLineW and +filter out arguments which the RTS would not have passed along. + +This is done to ensure we get the arguments in proper Unicode Encoding which +the RTS at this moment does not seem provide. The filtering has to match the +one done by the RTS to avoid inconsistencies like #13287. +-} getWin32ProgArgv_certainly :: IO [String] getWin32ProgArgv_certainly = do mb_argv <- getWin32ProgArgv case mb_argv of + -- see Note [Ignore hs_init argv] Nothing -> fmap dropRTSArgs getFullArgs Just argv -> return argv @@ -106,8 +118,10 @@ foreign import ccall unsafe "getWin32ProgArgv" foreign import ccall unsafe "setWin32ProgArgv" c_setWin32ProgArgv :: CInt -> Ptr CWString -> IO () +-- See Note [Ignore hs_init argv] dropRTSArgs :: [String] -> [String] dropRTSArgs [] = [] +dropRTSArgs rest@("--":_) = rest dropRTSArgs ("+RTS":rest) = dropRTSArgs (dropWhile (/= "-RTS") rest) dropRTSArgs ("--RTS":rest) = rest dropRTSArgs ("-RTS":rest) = dropRTSArgs rest diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c index 5fd368c..6ab70d4 100644 --- a/rts/RtsFlags.c +++ b/rts/RtsFlags.c @@ -512,6 +512,13 @@ static void errorRtsOptsDisabled(const char *s) - rtsConfig (global) contains the supplied RtsConfig + On Windows getArgs ignores argv and instead takes the arguments directly + from the WinAPI and removes any which would have been parsed by the RTS. + + If the handling of which arguments are passed to the Haskell side changes + these changes have to be synchronized with getArgs in base. See #13287 and + Note [Ignore hs_init argv] in System.Environment. + -------------------------------------------------------------------------- */ void setupRtsFlags (int *argc, char *argv[], RtsConfig rts_config) @@ -566,7 +573,7 @@ void setupRtsFlags (int *argc, char *argv[], RtsConfig rts_config) // Split arguments (argv) into PGM (argv) and RTS (rts_argv) parts // argv[0] must be PGM argument -- leave in argv - + // for (mode = PGM; arg < total_arg; arg++) { // The '--RTS' argument disables all future +RTS ... -RTS processing. if (strequal("--RTS", argv[arg])) { diff --git a/testsuite/tests/rts/T13287/T13287.hs b/testsuite/tests/rts/T13287/T13287.hs new file mode 100644 index 0000000..d5b8b43 --- /dev/null +++ b/testsuite/tests/rts/T13287/T13287.hs @@ -0,0 +1,4 @@ +import System.Environment (getArgs) + +main :: IO () +main = getArgs >>= print diff --git a/testsuite/tests/rts/T13287/T13287.stdout b/testsuite/tests/rts/T13287/T13287.stdout new file mode 100644 index 0000000..d6df8ca --- /dev/null +++ b/testsuite/tests/rts/T13287/T13287.stdout @@ -0,0 +1 @@ +["a1","--","a2","+RTS","-RTS","a3"] diff --git a/testsuite/tests/rts/T13287/all.T b/testsuite/tests/rts/T13287/all.T new file mode 100644 index 0000000..0543e50 --- /dev/null +++ b/testsuite/tests/rts/T13287/all.T @@ -0,0 +1,4 @@ +# Ensure that RTS flags past -- get ignored + +test('T13287', [extra_run_opts('a1 +RTS -RTS -- a2 +RTS -RTS a3'), omit_ways(['ghci'])], compile_and_run, ['']) + From git at git.haskell.org Thu Feb 23 22:27:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 23 Feb 2017 22:27:18 +0000 (UTC) Subject: [commit: ghc] master: More tracing in SpecConstr (39d926c) Message-ID: <20170223222718.B0D283A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/39d926cd353f203c6dfa2c106179946fa2615d45/ghc >--------------------------------------------------------------- commit 39d926cd353f203c6dfa2c106179946fa2615d45 Author: Simon Peyton Jones Date: Thu Feb 23 13:59:21 2017 -0500 More tracing in SpecConstr Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3179 >--------------------------------------------------------------- 39d926cd353f203c6dfa2c106179946fa2615d45 compiler/specialise/SpecConstr.hs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/compiler/specialise/SpecConstr.hs b/compiler/specialise/SpecConstr.hs index 15c031b..8a3e227 100644 --- a/compiler/specialise/SpecConstr.hs +++ b/compiler/specialise/SpecConstr.hs @@ -1346,7 +1346,8 @@ scTopBind env body_usage (Rec prs) , not force_spec , not (all (couldBeSmallEnoughToInline (sc_dflags env) threshold) rhss) -- No specialisation - = do { (rhs_usgs, rhss') <- mapAndUnzipM (scExpr env) rhss + = -- pprTrace "scTopBind: nospec" (ppr bndrs) $ + do { (rhs_usgs, rhss') <- mapAndUnzipM (scExpr env) rhss ; return (body_usage `combineUsage` combineUsages rhs_usgs, Rec (bndrs `zip` rhss')) } | otherwise -- Do specialisation @@ -1469,7 +1470,10 @@ specRec top_lvl env body_usg rhs_infos -- Loop, specialising, until you get no new specialisations go seed_calls usg_so_far spec_infos | isEmptyVarEnv seed_calls - = return (usg_so_far, spec_infos) + = -- pprTrace "specRec" (vcat [ ppr (map ri_fn rhs_infos) + -- , ppr seed_calls + -- , ppr body_usg ]) $ + return (usg_so_far, spec_infos) | otherwise = do { specs_w_usg <- zipWithM (specialise env seed_calls) rhs_infos spec_infos ; let (extra_usg_s, new_spec_infos) = unzip specs_w_usg @@ -1499,11 +1503,13 @@ specialise env bind_calls (RI { ri_fn = fn, ri_lam_bndrs = arg_bndrs spec_info@(SI specs spec_count mb_unspec) | isBottomingId fn -- Note [Do not specialise diverging functions] -- and do not generate specialisation seeds from its RHS - = return (nullUsage, spec_info) + = -- pprTrace "specialise bot" (ppr fn) $ + return (nullUsage, spec_info) | isNeverActive (idInlineActivation fn) -- See Note [Transfer activation] || null arg_bndrs -- Only specialise functions - = case mb_unspec of -- Behave as if there was a single, boring call + = -- pprTrace "specialise inactive" (ppr fn) $ + case mb_unspec of -- Behave as if there was a single, boring call Just rhs_usg -> return (rhs_usg, SI specs spec_count Nothing) -- See Note [spec_usg includes rhs_usg] Nothing -> return (nullUsage, spec_info) From git at git.haskell.org Thu Feb 23 22:27:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 23 Feb 2017 22:27:10 +0000 (UTC) Subject: [commit: ghc] master: JSON profiler reports (a204333) Message-ID: <20170223222710.864233A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a20433326eabd759502d9c170c3cc44ce6128a04/ghc >--------------------------------------------------------------- commit a20433326eabd759502d9c170c3cc44ce6128a04 Author: Ben Gamari Date: Thu Feb 23 13:22:48 2017 -0500 JSON profiler reports This introduces a JSON output format for cost-centre profiler reports. It's not clear whether this is really something we want to introduce given that we may also move to a more Haskell-driven output pipeline in the future, but I nevertheless found this helpful, so I thought I would put it up. Test Plan: Compile a program with `-prof -fprof-auto`; run with `+RTS -pj` Reviewers: austin, erikd, simonmar Reviewed By: simonmar Subscribers: duncan, maoe, thomie, simonmar Differential Revision: https://phabricator.haskell.org/D3132 >--------------------------------------------------------------- a20433326eabd759502d9c170c3cc44ce6128a04 docs/users_guide/profiling.rst | 5 + includes/rts/Flags.h | 4 +- libraries/base/GHC/RTS/Flags.hsc | 6 +- libraries/base/changelog.md | 6 +- rts/ProfilerReport.c | 16 ---- rts/ProfilerReportJson.c | 127 +++++++++++++++++++++++++ rts/{ProfilerReport.h => ProfilerReportJson.h} | 11 ++- rts/Profiling.c | 24 ++++- rts/RtsFlags.c | 10 +- 9 files changed, 177 insertions(+), 32 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 a20433326eabd759502d9c170c3cc44ce6128a04 From git at git.haskell.org Thu Feb 23 22:27:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 23 Feb 2017 22:27:15 +0000 (UTC) Subject: [commit: ghc] master: Set $1_$2_SplitSections in distdir-opts.mk not build-package.mk (3cb9b52) Message-ID: <20170223222715.F3EC13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3cb9b52fba92a0799d0c21f4ea247493dd0b811b/ghc >--------------------------------------------------------------- commit 3cb9b52fba92a0799d0c21f4ea247493dd0b811b Author: Reid Barton Date: Thu Feb 23 13:41:55 2017 -0500 Set $1_$2_SplitSections in distdir-opts.mk not build-package.mk After commit a50082c11 we use -ffunction-sections -fdata-sections for all C compilations, when $1_$2_SplitSections is set. But that variable was set in build-package.mk which is not run for the RTS. As a result the RTS was not being split, leading to larger binaries. This commit fixes RTS splitting by moving the definition of $1_$2_SplitSections to distdir-opts.mk, which is run for the RTS (and also from build-package.mk). Test Plan: manual ./validate and check that RTS and base .c files are split, but not object files in the compiler Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie, snowleopard, olsner Differential Revision: https://phabricator.haskell.org/D3137 >--------------------------------------------------------------- 3cb9b52fba92a0799d0c21f4ea247493dd0b811b rules/build-package.mk | 18 ------------------ rules/distdir-opts.mk | 20 +++++++++++++++++++- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/rules/build-package.mk b/rules/build-package.mk index 9599c57..fb04f02 100644 --- a/rules/build-package.mk +++ b/rules/build-package.mk @@ -102,24 +102,6 @@ endif $1_$2_PKGDATA_DEP = $1/$2/package-data.mk endif -# We don't bother splitting the bootstrap packages (built with stage 0) -ifeq "$$($1_$2_SplitObjs)" "" -ifeq "$$(SplitObjs) $3" "YES 1" -$1_$2_SplitObjs = YES -else -$1_$2_SplitObjs = NO -endif -endif -# Disable split sections when building with stage0, it won't be supported yet -# and it's probably not very relevant anyway (smaller stage1 ghc?). -ifeq "$$($1_$2_SplitSections)" "" -ifeq "$3" "1" -$1_$2_SplitSections = $(SplitSections) -else -$1_$2_SplitSections = NO -endif -endif - $(call hs-sources,$1,$2) $(call c-sources,$1,$2) $(call includes-sources,$1,$2) diff --git a/rules/distdir-opts.mk b/rules/distdir-opts.mk index b3dfba1..6cabac3 100644 --- a/rules/distdir-opts.mk +++ b/rules/distdir-opts.mk @@ -11,7 +11,7 @@ # ----------------------------------------------------------------------------- -# Set compilation flags that additionally depend on a particular way +# Set compilation flags that do not depend on a particular way define distdir-opts # args: $1 = dir, $2 = distdir, $3 = stage @@ -89,5 +89,23 @@ $1_$2_ALL_HAPPY_OPTS = \ $$($1_$2_HAPPY_OPTS) \ $$(EXTRA_HAPPY_OPTS) +# We don't bother splitting the bootstrap packages (built with stage 0) +ifeq "$$($1_$2_SplitObjs)" "" +ifeq "$$(SplitObjs) $3" "YES 1" +$1_$2_SplitObjs = YES +else +$1_$2_SplitObjs = NO +endif +endif +# Disable split sections when building with stage0, it won't be supported yet +# and it's probably not very relevant anyway (smaller stage1 ghc?). +ifeq "$$($1_$2_SplitSections)" "" +ifeq "$3" "1" +$1_$2_SplitSections = $(SplitSections) +else +$1_$2_SplitSections = NO +endif +endif + endef From git at git.haskell.org Thu Feb 23 22:27:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 23 Feb 2017 22:27:21 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Remove old python version tests (48a967c) Message-ID: <20170223222721.69A003A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/48a967ccf75145b7ffb5bf70d447bc533d17ade4/ghc >--------------------------------------------------------------- commit 48a967ccf75145b7ffb5bf70d447bc533d17ade4 Author: Reid Barton Date: Thu Feb 23 13:44:17 2017 -0500 testsuite: Remove old python version tests Test Plan: harbormaster Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3140 >--------------------------------------------------------------- 48a967ccf75145b7ffb5bf70d447bc533d17ade4 testsuite/driver/runtests.py | 42 ++++-------------------------------------- 1 file changed, 4 insertions(+), 38 deletions(-) diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py index 28b393a..df85fa1 100644 --- a/testsuite/driver/runtests.py +++ b/testsuite/driver/runtests.py @@ -11,7 +11,6 @@ import sys import os import string import getopt -import platform import shutil import tempfile import time @@ -25,8 +24,6 @@ import re # So we import it here first, so that the testsuite doesn't appear to fail. import subprocess -PYTHON3 = sys.version_info >= (3, 0) - from testutil import * from testglobals import * @@ -120,29 +117,6 @@ for opt,arg in opts: config.verbose = int(arg) -if config.use_threads == 1: - # Trac #1558 says threads don't work in python 2.4.4, but do - # in 2.5.2. Probably >= 2.5 is sufficient, but let's be - # conservative here. - # Some versions of python have things like '1c1' for some of - # these components (see trac #3091), but int() chokes on the - # 'c1', so we drop it. - (maj, min, pat) = platform.python_version_tuple() - # We wrap maj, min, and pat in str() to work around a bug in python - # 2.6.1 - maj = int(re.sub('[^0-9].*', '', str(maj))) - min = int(re.sub('[^0-9].*', '', str(min))) - pat = int(re.sub('[^0-9].*', '', str(pat))) - if (maj, min) < (2, 6): - print("Python < 2.6 is not supported") - sys.exit(1) - # We also need to disable threads for python 2.7.2, because of - # this bug: http://bugs.python.org/issue13817 - elif (maj, min, pat) == (2, 7, 2): - print("Warning: Ignoring request to use threads as python version is 2.7.2") - print("See http://bugs.python.org/issue13817 for details.") - config.use_threads = 0 - config.cygwin = False config.msys = False @@ -267,12 +241,8 @@ t.start_time = time.localtime() print('Beginning test run at', time.strftime("%c %Z",t.start_time)) sys.stdout.flush() -if PYTHON3: - # in Python 3, we output text, which cannot be unbuffered - sys.stdout = os.fdopen(sys.__stdout__.fileno(), "w") -else: - # set stdout to unbuffered (is this the best way to do it?) - sys.stdout = os.fdopen(sys.__stdout__.fileno(), "w", 0) +# we output text, which cannot be unbuffered +sys.stdout = os.fdopen(sys.__stdout__.fileno(), "w") if config.local: tempdir = '' @@ -301,12 +271,8 @@ for file in t_files: if_verbose(2, '====> Scanning %s' % file) newTestDir(tempdir, os.path.dirname(file)) try: - if PYTHON3: - with io.open(file, encoding='utf8') as f: - src = f.read() - else: - with open(file) as f: - src = f.read() + with io.open(file, encoding='utf8') as f: + src = f.read() exec(src) except Exception as e: From git at git.haskell.org Thu Feb 23 22:27:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 23 Feb 2017 22:27:24 +0000 (UTC) Subject: [commit: ghc] master: rts: Correct the nursery size in the gen 1 growth computation (7d116e5) Message-ID: <20170223222724.274DC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7d116e553f0b44723e279ae5affa744e6aefc3c0/ghc >--------------------------------------------------------------- commit 7d116e553f0b44723e279ae5affa744e6aefc3c0 Author: John C. Carey Date: Thu Feb 23 13:45:22 2017 -0500 rts: Correct the nursery size in the gen 1 growth computation Fixes trac issue #13288. Reviewers: austin, bgamari, erikd, simonmar Reviewed By: simonmar Subscribers: mutjida, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3143 >--------------------------------------------------------------- 7d116e553f0b44723e279ae5affa744e6aefc3c0 rts/sm/GC.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/rts/sm/GC.c b/rts/sm/GC.c index c41c979..358700e 100644 --- a/rts/sm/GC.c +++ b/rts/sm/GC.c @@ -742,6 +742,17 @@ GarbageCollect (uint32_t collect_gen, require (F+1)*need. We leave (F+2)*need in order to reduce repeated deallocation and reallocation. */ need = (RtsFlags.GcFlags.oldGenFactor + 2) * need; + /* But with a large nursery, the above estimate might exceed + * maxHeapSize. A large resident set size might make the OS + * kill this process, or swap unnecessarily. Therefore we + * ensure that our estimate does not exceed maxHeapSize. + */ + if (RtsFlags.GcFlags.maxHeapSize != 0) { + W_ max = BLOCKS_TO_MBLOCKS(RtsFlags.GcFlags.maxHeapSize); + if (need > max) { + need = max; + } + } if (got > need) { returnMemoryToOS(got - need); } @@ -1524,7 +1535,8 @@ resize_generations (void) // minimum size for generation zero min_alloc = stg_max((RtsFlags.GcFlags.pcFreeHeap * max) / 200, - RtsFlags.GcFlags.minAllocAreaSize); + RtsFlags.GcFlags.minAllocAreaSize + * (W_)n_capabilities); // Auto-enable compaction when the residency reaches a // certain percentage of the maximum heap size (default: 30%). From git at git.haskell.org Thu Feb 23 23:16:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 23 Feb 2017 23:16:39 +0000 (UTC) Subject: [commit: ghc] master: Include OverloadedRecordFields selectors in NameShape. (8f8016a) Message-ID: <20170223231639.066053A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8f8016a5cb006fe14e1058c01a215b90e8435cc8/ghc >--------------------------------------------------------------- commit 8f8016a5cb006fe14e1058c01a215b90e8435cc8 Author: Edward Z. Yang Date: Wed Feb 22 21:59:59 2017 -0800 Include OverloadedRecordFields selectors in NameShape. Summary: Fixes #13323. Signed-off-by: Edward Z. Yang Test Plan: validate Reviewers: bgamari, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3175 >--------------------------------------------------------------- 8f8016a5cb006fe14e1058c01a215b90e8435cc8 compiler/backpack/NameShape.hs | 2 +- testsuite/tests/backpack/should_compile/T13323.bkp | 17 +++++++++++++++++ testsuite/tests/backpack/should_compile/T13323.stderr | 13 +++++++++++++ testsuite/tests/backpack/should_compile/all.T | 1 + 4 files changed, 32 insertions(+), 1 deletion(-) diff --git a/compiler/backpack/NameShape.hs b/compiler/backpack/NameShape.hs index 9817854..261fffb 100644 --- a/compiler/backpack/NameShape.hs +++ b/compiler/backpack/NameShape.hs @@ -83,7 +83,7 @@ mkNameShape :: ModuleName -> [AvailInfo] -> NameShape mkNameShape mod_name as = NameShape mod_name as $ mkOccEnv $ do a <- as - n <- availName a : availNames a + n <- availName a : availNamesWithSelectors a return (occName n, n) -- | Given an existing 'NameShape', merge it with a list of 'AvailInfo's diff --git a/testsuite/tests/backpack/should_compile/T13323.bkp b/testsuite/tests/backpack/should_compile/T13323.bkp new file mode 100644 index 0000000..70a1ccf --- /dev/null +++ b/testsuite/tests/backpack/should_compile/T13323.bkp @@ -0,0 +1,17 @@ +{-# LANGUAGE DuplicateRecordFields #-} +unit p where + signature A where + data A = A { foo :: Int } + data B = B { foo :: Bool } + module P where + import A + x :: A -> Int + x = foo +unit q where + module A where + data A = A { foo :: Int } + data B = B { foo :: Bool } +unit r where + dependency p[A=q:A] + module R where + import P diff --git a/testsuite/tests/backpack/should_compile/T13323.stderr b/testsuite/tests/backpack/should_compile/T13323.stderr new file mode 100644 index 0000000..3d6a510 --- /dev/null +++ b/testsuite/tests/backpack/should_compile/T13323.stderr @@ -0,0 +1,13 @@ +[1 of 3] Processing p + [1 of 2] Compiling A[sig] ( p/A.hsig, nothing ) + [2 of 2] Compiling P ( p/P.hs, nothing ) +[2 of 3] Processing q + Instantiating q + [1 of 1] Compiling A ( q/A.hs, T13323.out/q/A.o ) +[3 of 3] Processing r + Instantiating r + [1 of 1] Including p[A=q:A] + Instantiating p[A=q:A] + [1 of 2] Compiling A[sig] ( p/A.hsig, T13323.out/p/p-HVmFlcYSefiK5n1aDP1v7x/A.o ) + [2 of 2] Compiling P ( p/P.hs, T13323.out/p/p-HVmFlcYSefiK5n1aDP1v7x/P.o ) + [1 of 1] Compiling R ( r/R.hs, T13323.out/r/R.o ) diff --git a/testsuite/tests/backpack/should_compile/all.T b/testsuite/tests/backpack/should_compile/all.T index 683d913..8f4ec3b 100644 --- a/testsuite/tests/backpack/should_compile/all.T +++ b/testsuite/tests/backpack/should_compile/all.T @@ -47,3 +47,4 @@ test('bkp52', normal, backpack_compile, ['']) test('T13149', expect_broken(13149), backpack_compile, ['']) test('T13214', normal, backpack_compile, ['']) +test('T13323', normal, backpack_compile, ['']) From git at git.haskell.org Thu Feb 23 23:57:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 23 Feb 2017 23:57:43 +0000 (UTC) Subject: [commit: ghc] master: Fix parsing of And chains in BoolFormula (4ad3620) Message-ID: <20170223235743.54A713A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4ad36206285a84bfc3c9f7d41c55bba83bfdffef/ghc >--------------------------------------------------------------- commit 4ad36206285a84bfc3c9f7d41c55bba83bfdffef Author: Dmitry Ivanov Date: Thu Feb 23 18:02:23 2017 -0500 Fix parsing of And chains in BoolFormula Parse `foo, bar, baz` into `And [foo, bar, baz]` instead of `And [foo, And [bar, baz]]`. Fixes #11024. Test Plan: read and think Reviewers: austin, bgamari, mpickering Reviewed By: bgamari, mpickering Subscribers: ezyang, thomie, alanz Differential Revision: https://phabricator.haskell.org/D3139 >--------------------------------------------------------------- 4ad36206285a84bfc3c9f7d41c55bba83bfdffef compiler/parser/Parser.y | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/compiler/parser/Parser.y b/compiler/parser/Parser.y index 175cfbb..fcc3707 100644 --- a/compiler/parser/Parser.y +++ b/compiler/parser/Parser.y @@ -2959,9 +2959,13 @@ name_boolformula :: { LBooleanFormula (Located RdrName) } >> return (sLL $1 $> (Or [$1,$3])) } name_boolformula_and :: { LBooleanFormula (Located RdrName) } - : name_boolformula_atom { $1 } - | name_boolformula_atom ',' name_boolformula_and - {% aa $1 (AnnComma,$2) >> return (sLL $1 $> (And [$1,$3])) } + : name_boolformula_and_list + { sLL (head $1) (last $1) (And ($1)) } + +name_boolformula_and_list :: { [LBooleanFormula (Located RdrName)] } + : name_boolformula_atom { [$1] } + | name_boolformula_atom ',' name_boolformula_and_list + {% aa $1 (AnnComma, $2) >> return ($1 : $3) } name_boolformula_atom :: { LBooleanFormula (Located RdrName) } : '(' name_boolformula ')' {% ams (sLL $1 $> (Parens $2)) [mop $1,mcp $3] } From git at git.haskell.org Thu Feb 23 23:57:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 23 Feb 2017 23:57:40 +0000 (UTC) Subject: [commit: ghc] master: Add instances for (:~~:) mirroring those for (:~:) (c88b7c9) Message-ID: <20170223235740.A148A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c88b7c9a06e387c3b9bdb359b9e1e4f3a9fba696/ghc >--------------------------------------------------------------- commit c88b7c9a06e387c3b9bdb359b9e1e4f3a9fba696 Author: Ryan Scott Date: Thu Feb 23 18:09:58 2017 -0500 Add instances for (:~~:) mirroring those for (:~:) `(:~~:)`, the hetergeneous version of `(:~:)`, should have class instances similar to those of `(:~:)`, especially since their implementations aren't particularly tricky or surprising. This adds them. Reviewers: bgamari, austin, hvr, goldfire Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3181 >--------------------------------------------------------------- c88b7c9a06e387c3b9bdb359b9e1e4f3a9fba696 libraries/base/Control/Category.hs | 5 +++++ libraries/base/Data/Data.hs | 5 +++++ libraries/base/Data/Type/Coercion.hs | 4 ++++ libraries/base/Data/Type/Equality.hs | 25 ++++++++++++++++++++++ .../tests/annotations/should_fail/annfail10.stderr | 2 +- .../tests/typecheck/should_fail/T12921.stderr | 2 +- 6 files changed, 41 insertions(+), 2 deletions(-) diff --git a/libraries/base/Control/Category.hs b/libraries/base/Control/Category.hs index cc76480..ba92178 100644 --- a/libraries/base/Control/Category.hs +++ b/libraries/base/Control/Category.hs @@ -56,6 +56,11 @@ instance Category (:~:) where id = Refl Refl . Refl = Refl +-- | @since 4.10.0.0 +instance Category (:~~:) where + id = HRefl + HRefl . HRefl = HRefl + -- | @since 4.7.0.0 instance Category Coercion where id = Coercion diff --git a/libraries/base/Data/Data.hs b/libraries/base/Data/Data.hs index 12f9378..8233f98 100644 --- a/libraries/base/Data/Data.hs +++ b/libraries/base/Data/Data.hs @@ -1210,6 +1210,11 @@ deriving instance (Data t) => Data (Proxy t) -- | @since 4.7.0.0 deriving instance (a ~ b, Data a) => Data (a :~: b) +-- | @since 4.10.0.0 +deriving instance (Typeable i, Typeable j, Typeable a, Typeable b, + (a :: i) ~~ (b :: j)) + => Data (a :~~: b) + -- | @since 4.7.0.0 deriving instance (Coercible a b, Data a, Data b) => Data (Coercion a b) diff --git a/libraries/base/Data/Type/Coercion.hs b/libraries/base/Data/Type/Coercion.hs index 318d098..2358115 100644 --- a/libraries/base/Data/Type/Coercion.hs +++ b/libraries/base/Data/Type/Coercion.hs @@ -105,6 +105,10 @@ class TestCoercion f where instance TestCoercion ((Eq.:~:) a) where testCoercion Eq.Refl Eq.Refl = Just Coercion +-- | @since 4.10.0.0 +instance TestCoercion ((Eq.:~~:) a) where + testCoercion Eq.HRefl Eq.HRefl = Just Coercion + -- | @since 4.7.0.0 instance TestCoercion (Coercion a) where testCoercion Coercion Coercion = Just Coercion diff --git a/libraries/base/Data/Type/Equality.hs b/libraries/base/Data/Type/Equality.hs index 73f8407..69da70b 100644 --- a/libraries/base/Data/Type/Equality.hs +++ b/libraries/base/Data/Type/Equality.hs @@ -145,6 +145,27 @@ deriving instance a ~ b => Bounded (a :~: b) data (a :: k1) :~~: (b :: k2) where HRefl :: a :~~: a +-- | @since 4.10.0.0 +deriving instance Eq (a :~~: b) +-- | @since 4.10.0.0 +deriving instance Show (a :~~: b) +-- | @since 4.10.0.0 +deriving instance Ord (a :~~: b) + +-- | @since 4.10.0.0 +instance a ~~ b => Read (a :~~: b) where + readsPrec d = readParen (d > 10) (\r -> [(HRefl, s) | ("HRefl",s) <- lex r ]) + +-- | @since 4.10.0.0 +instance a ~~ b => Enum (a :~~: b) where + toEnum 0 = HRefl + toEnum _ = errorWithoutStackTrace "Data.Type.Equality.toEnum: bad argument" + + fromEnum HRefl = 0 + +-- | @since 4.10.0.0 +deriving instance a ~~ b => Bounded (a :~~: b) + -- | This class contains types where you can learn the equality of two types -- from information contained in /terms/. Typically, only singleton types should -- inhabit this class. @@ -156,6 +177,10 @@ class TestEquality f where instance TestEquality ((:~:) a) where testEquality Refl Refl = Just Refl +-- | @since 4.10.0.0 +instance TestEquality ((:~~:) a) where + testEquality HRefl HRefl = Just Refl + -- | A type family to compute Boolean equality. Instances are provided -- only for /open/ kinds, such as @*@ and function kinds. Instances are -- also provided for datatypes exported from base. A poly-kinded instance diff --git a/testsuite/tests/annotations/should_fail/annfail10.stderr b/testsuite/tests/annotations/should_fail/annfail10.stderr index 0dea31a..6329c38 100644 --- a/testsuite/tests/annotations/should_fail/annfail10.stderr +++ b/testsuite/tests/annotations/should_fail/annfail10.stderr @@ -10,7 +10,7 @@ annfail10.hs:9:1: error: instance Data.Data.Data Ordering -- Defined in ‘Data.Data’ instance Data.Data.Data Integer -- Defined in ‘Data.Data’ ...plus 15 others - ...plus 41 instances involving out-of-scope types + ...plus 42 instances involving out-of-scope types (use -fprint-potential-instances to see them all) • In the annotation: {-# ANN f 1 #-} diff --git a/testsuite/tests/typecheck/should_fail/T12921.stderr b/testsuite/tests/typecheck/should_fail/T12921.stderr index a3ac8a2..422ec7d 100644 --- a/testsuite/tests/typecheck/should_fail/T12921.stderr +++ b/testsuite/tests/typecheck/should_fail/T12921.stderr @@ -10,7 +10,7 @@ T12921.hs:4:1: error: instance Data.Data.Data Ordering -- Defined in ‘Data.Data’ instance Data.Data.Data Integer -- Defined in ‘Data.Data’ ...plus 15 others - ...plus 41 instances involving out-of-scope types + ...plus 42 instances involving out-of-scope types (use -fprint-potential-instances to see them all) • In the annotation: {-# ANN module "HLint: ignore Reduce duplication" #-} From git at git.haskell.org Thu Feb 23 23:57:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 23 Feb 2017 23:57:46 +0000 (UTC) Subject: [commit: ghc] master: Correct Windows libdir assumptions. (8d64395) Message-ID: <20170223235746.2687F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8d64395b43cb73d110767cab512a368b3db018de/ghc >--------------------------------------------------------------- commit 8d64395b43cb73d110767cab512a368b3db018de Author: Tamar Christina Date: Thu Feb 23 18:07:19 2017 -0500 Correct Windows libdir assumptions. GHC and ghc-pkg make some pretty hard assumptions about where they're running on Windows. They assume that they are always running from `foo/bin/ghc.exe` and that to find the `lib` folder they can drop `bin/ghc.exe` from the base path and append `lib`. This is already false for the testsuite, which when testing thenbindist has one test which puts the binaries in `inplace/test spaces`. For some reason before this was either being skipped or mysteriously passing. But as of `2017.02.11` our luck ran out. the testsuite triggers a failure such as those in #13310 Let's soften the assumption and just check that `../lib` exists instead. 80 chars Test Plan: ./validate Reviewers: austin, erikd, bgamari Reviewed By: bgamari Subscribers: thomie, #ghc_windows_task_force Differential Revision: https://phabricator.haskell.org/D3158 >--------------------------------------------------------------- 8d64395b43cb73d110767cab512a368b3db018de compiler/main/SysTools.hs | 30 ++++++++++++++++-------------- utils/ghc-pkg/Main.hs | 14 ++++++++++---- 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/compiler/main/SysTools.hs b/compiler/main/SysTools.hs index b34b1b8..9a9f899 100644 --- a/compiler/main/SysTools.hs +++ b/compiler/main/SysTools.hs @@ -91,13 +91,10 @@ import qualified System.Win32.Types as Win32 #else import qualified System.Win32.Info as Win32 #endif -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 @@ -131,9 +128,9 @@ On Unix: On Windows: - ghc never has a shell wrapper. - we can find the location of the ghc binary, which is - $topdir/bin/.exe + $topdir//.exe where may be "ghc", "ghc-stage2", or similar - - we strip off the "bin/.exe" to leave $topdir. + - we strip off the "/.exe" to leave $topdir. from topdir we can find package.conf, ghc-asm, etc. @@ -1463,7 +1460,7 @@ traceCmd dflags phase_name cmd_line action getBaseDir :: IO (Maybe String) #if defined(mingw32_HOST_OS) --- Assuming we are running ghc, accessed by path $(stuff)/bin/ghc.exe, +-- Assuming we are running ghc, accessed by path $(stuff)//ghc.exe, -- return the path $(stuff)/lib. getBaseDir = try_size 2048 -- plenty, PATH_MAX is 512 under Win32. where @@ -1471,9 +1468,14 @@ 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 -> do path <- peekCWString buf - real <- getFinalPath path -- try to resolve symlinks paths - return $ (Just . rootDir . sanitize . maybe path id) real + _ | ret < size -> do + path <- peekCWString buf + real <- getFinalPath path -- try to resolve symlinks paths + let libdir = (rootDir . sanitize . maybe path id) real + exists <- doesDirectoryExist libdir + if exists + then return $ Just libdir + else fail path | otherwise -> try_size (size * 2) -- getFinalPath returns paths in full raw form. @@ -1492,11 +1494,11 @@ getBaseDir = try_size 2048 -- plenty, PATH_MAX is 512 under Win32. "ghc-stage3.exe"] -> case splitFileName $ takeDirectory d of -- ghc is in $topdir/bin/ghc.exe - (d', bin) | lower bin == "bin" -> takeDirectory d' "lib" - _ -> fail - _ -> fail - where fail = panic ("can't decompose ghc.exe path: " ++ show s) - lower = map toLower + (d', _) -> takeDirectory d' "lib" + _ -> fail s + + fail s = panic ("can't decompose ghc.exe path: " ++ show s) + lower = map toLower foreign import WINDOWS_CCONV unsafe "windows.h GetModuleFileNameW" c_GetModuleFileName :: Ptr () -> CWString -> Word32 -> IO Word32 diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs index b350e08..3355838 100644 --- a/utils/ghc-pkg/Main.hs +++ b/utils/ghc-pkg/Main.hs @@ -62,9 +62,7 @@ import qualified Data.ByteString.Char8 as BS -- mingw32 needs these for getExecDir import Foreign import Foreign.C -#endif - -#ifdef mingw32_HOST_OS +import System.Directory ( canonicalizePath ) import GHC.ConsoleHandler #else import System.Posix hiding (fdToHandle) @@ -1947,7 +1945,15 @@ unDosifyPath :: FilePath -> FilePath unDosifyPath xs = subst '\\' '/' xs getLibDir :: IO (Maybe String) -getLibDir = fmap (fmap ( "lib")) $ getExecDir "/bin/ghc-pkg.exe" +getLibDir = do base <- getExecDir "/ghc-pkg.exe" + case base of + Nothing -> return Nothing + Just base' -> do + libdir <- canonicalizePath $ base' "../lib" + exists <- doesDirectoryExist libdir + if exists + then return $ Just libdir + else return Nothing -- (getExecDir cmd) returns the directory in which the current -- executable, which should be called 'cmd', is running From git at git.haskell.org Fri Feb 24 09:05:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 24 Feb 2017 09:05:08 +0000 (UTC) Subject: [commit: ghc] master: Make exprIsConApp_maybe work better for literals strings (a6e13d5) Message-ID: <20170224090508.AC82A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a6e13d502ef46de854ec1babcd764ccce68c95e3/ghc >--------------------------------------------------------------- commit a6e13d502ef46de854ec1babcd764ccce68c95e3 Author: Simon Peyton Jones Date: Thu Feb 23 14:41:08 2017 +0000 Make exprIsConApp_maybe work better for literals strings There are two things here * Use exprIsLiteral_maybe to "look through" a variable bound to a literal string. * Add CONLIKE to the NOINLINE pragma for unpackCString# and unpackCStringUtf8# See Trac #13317, Trac #10844, and Note [exprIsConApp_maybe on literal strings] in CoreSubst I did a nofib run and got essentially zero change except for one 2.2% improvement in allocation for 'pretty'. >--------------------------------------------------------------- a6e13d502ef46de854ec1babcd764ccce68c95e3 compiler/coreSyn/CoreSubst.hs | 17 +++++++++++++---- libraries/ghc-prim/GHC/CString.hs | 21 ++++++++++++++++----- testsuite/tests/simplCore/should_compile/Makefile | 4 ++++ testsuite/tests/simplCore/should_compile/T13317.hs | 16 ++++++++++++++++ .../tests/simplCore/should_compile/T13317.stdout | 1 + .../tests/simplCore/should_compile/T3234.stderr | 4 ++-- testsuite/tests/simplCore/should_compile/all.T | 4 ++++ 7 files changed, 56 insertions(+), 11 deletions(-) diff --git a/compiler/coreSyn/CoreSubst.hs b/compiler/coreSyn/CoreSubst.hs index 89a92f8..53072dc 100644 --- a/compiler/coreSyn/CoreSubst.hs +++ b/compiler/coreSyn/CoreSubst.hs @@ -1378,7 +1378,7 @@ However e might not *look* as if Note [exprIsConApp_maybe on literal strings] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -See #9400. +See #9400 and #13317. Conceptually, a string literal "abc" is just ('a':'b':'c':[]), but in Core they are represented as unpackCString# "abc"# by MkCore.mkStringExprFS, or @@ -1394,6 +1394,13 @@ We need to be careful about UTF8 strings here. ""# contains a ByteString, so we must parse it back into a FastString to split off the first character. That way we can treat unpackCString# and unpackCStringUtf8# in the same way. +We must also be caeful about + lvl = "foo"# + ...(unpackCString# lvl)... +to ensure that we see through the let-binding for 'lvl'. Hence the +(exprIsLiteral_maybe .. arg) in the guard before the call to +dealWithStringLiteral. + Note [Push coercions in exprIsConApp_maybe] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In Trac #13025 I found a case where we had @@ -1460,9 +1467,11 @@ exprIsConApp_maybe (in_scope, id_unf) expr , let in_scope' = extendInScopeSetSet in_scope (exprFreeVars rhs) = go (Left in_scope') rhs cont - | (fun `hasKey` unpackCStringIdKey) - || (fun `hasKey` unpackCStringUtf8IdKey) - , [Lit (MachStr str)] <- args + -- See Note [exprIsConApp_maybe on literal strings] + | (fun `hasKey` unpackCStringIdKey) || + (fun `hasKey` unpackCStringUtf8IdKey) + , [arg] <- args + , Just (MachStr str) <- exprIsLiteral_maybe (in_scope, id_unf) arg = dealWithStringLiteral fun str co where unfolding = id_unf fun diff --git a/libraries/ghc-prim/GHC/CString.hs b/libraries/ghc-prim/GHC/CString.hs index 19e6f75..2adb13d 100644 --- a/libraries/ghc-prim/GHC/CString.hs +++ b/libraries/ghc-prim/GHC/CString.hs @@ -34,9 +34,8 @@ import GHC.Prim -- stuff uses Strings in the representation, so to give representations for -- ghc-prim types we need unpackCString# -{- -Note [Inlining unpackCString#] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +{- Note [Inlining unpackCString#] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ There's really no point in ever inlining things like unpackCString# as the loop doesn't specialise in an interesting way and we can't deforest the list constructors (we'd want to use unpackFoldrCString# for this). Moreover, it's @@ -57,10 +56,22 @@ to match unpackCString#, * stream fusion rules; e.g. in the `text` library, unstream (S.map safe (S.streamList (GHC.unpackCString# a))) = unpackCString# a + +Moreover, we want to make it CONLIKE, so that: + +* the rules in PrelRules will fire when the string is let-bound. + E.g. the eqString rule in PrelRules + eqString (unpackCString# (Lit s1)) (unpackCString# (Lit s2) = s1==s2 + +* exprIsConApp_maybe will see the string when we ahve + let x = unpackCString# "foo"# + ...(case x of algs)... + +All of this goes for unpackCStringUtf8# too. -} unpackCString# :: Addr# -> [Char] -{-# NOINLINE unpackCString# #-} +{-# NOINLINE CONLIKE unpackCString# #-} unpackCString# addr = unpack 0# where @@ -110,7 +121,7 @@ unpackFoldrCString# addr f z -- There's really no point in inlining this for the same reasons as -- unpackCString. See Note [Inlining unpackCString#] above for details. unpackCStringUtf8# :: Addr# -> [Char] -{-# NOINLINE unpackCStringUtf8# #-} +{-# NOINLINE CONLIKE unpackCStringUtf8# #-} unpackCStringUtf8# addr = unpack 0# where diff --git a/testsuite/tests/simplCore/should_compile/Makefile b/testsuite/tests/simplCore/should_compile/Makefile index ef3e74a..7dd784b 100644 --- a/testsuite/tests/simplCore/should_compile/Makefile +++ b/testsuite/tests/simplCore/should_compile/Makefile @@ -15,6 +15,10 @@ T9509: # Grep output should show a SPEC rule firing # The unfolding use threshold is to prevent foo inlining before it is specialised +T13317: + $(RM) -f T13317.o T13317.hi + '$(TEST_HC)' $(TEST_HC_OPTS) $(T8832_WORDSIZE_OPTS) -O -c -ddump-simpl-stats T13317.hs | grep 'KnownBranch' + 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/T13317.hs b/testsuite/tests/simplCore/should_compile/T13317.hs new file mode 100644 index 0000000..510d0d4 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T13317.hs @@ -0,0 +1,16 @@ +{-# LANGUAGE MagicHash #-} + +module T13317 where + +import GHC.Base + +f x = let x = "foo"# + y1 = unpackCString# x + y2 = unpackCString# x + in + (y1, case y2 of + 'f' : _ -> True + _ -> False + ) +-- This case-expression should simplify +-- yeilding a KnownBranch simplifier tick diff --git a/testsuite/tests/simplCore/should_compile/T13317.stdout b/testsuite/tests/simplCore/should_compile/T13317.stdout new file mode 100644 index 0000000..d54ebe9 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T13317.stdout @@ -0,0 +1 @@ +3 KnownBranch diff --git a/testsuite/tests/simplCore/should_compile/T3234.stderr b/testsuite/tests/simplCore/should_compile/T3234.stderr index 9d87b3e..ad31846 100644 --- a/testsuite/tests/simplCore/should_compile/T3234.stderr +++ b/testsuite/tests/simplCore/should_compile/T3234.stderr @@ -10,7 +10,7 @@ ==================== Grand total simplifier statistics ==================== -Total ticks: 54 +Total ticks: 55 15 PreInlineUnconditionally 1 n @@ -40,7 +40,7 @@ Total ticks: 54 1 fold/build 1 unpack 1 unpack-list -4 LetFloatFromLet 4 +5 LetFloatFromLet 5 25 BetaReduction 1 a 1 c diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index 1dd4232..53f5ade 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -240,3 +240,7 @@ test('str-rules', run_command, ['$MAKE -s --no-print-directory str-rules']) test('T13170', only_ways(['optasm']), compile, ['-dcore-lint']) +test('T13317', + normal, + run_command, + ['$MAKE -s --no-print-directory T13317']) From git at git.haskell.org Fri Feb 24 12:22:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 24 Feb 2017 12:22:52 +0000 (UTC) Subject: [commit: ghc] master: Add API Annotation AnnSignature for backpack signature modules (67c2e07) Message-ID: <20170224122252.998A23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/67c2e076c615acc91250e50fbb5f8c24961d4d9e/ghc >--------------------------------------------------------------- commit 67c2e076c615acc91250e50fbb5f8c24961d4d9e Author: Alan Zimmerman Date: Fri Feb 24 13:00:28 2017 +0200 Add API Annotation AnnSignature for backpack signature modules >--------------------------------------------------------------- 67c2e076c615acc91250e50fbb5f8c24961d4d9e compiler/parser/ApiAnnotation.hs | 1 + compiler/parser/Parser.y | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/parser/ApiAnnotation.hs b/compiler/parser/ApiAnnotation.hs index b20f23f..77db0f1 100644 --- a/compiler/parser/ApiAnnotation.hs +++ b/compiler/parser/ApiAnnotation.hs @@ -262,6 +262,7 @@ data AnnKeywordId | AnnSafe | AnnSemi -- ^ ';' | AnnSimpleQuote -- ^ ''' + | AnnSignature | AnnStatic -- ^ 'static' | AnnStock | AnnThen diff --git a/compiler/parser/Parser.y b/compiler/parser/Parser.y index fcc3707..92e3232 100644 --- a/compiler/parser/Parser.y +++ b/compiler/parser/Parser.y @@ -667,7 +667,7 @@ signature :: { Located (HsModule RdrName) } ams (L loc (HsModule (Just $3) $5 (fst $ snd $7) (snd $ snd $7) $4 $1) ) - ([mj AnnModule $2, mj AnnWhere $6] ++ fst $7) } + ([mj AnnSignature $2, mj AnnWhere $6] ++ fst $7) } module :: { Located (HsModule RdrName) } : maybedocheader 'module' modid maybemodwarning maybeexports 'where' body From git at git.haskell.org Fri Feb 24 16:58:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 24 Feb 2017 16:58:47 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline2: Move isJoinId, isJoinId_maybe to Id (185b41c) Message-ID: <20170224165847.304803A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline2 Link : http://ghc.haskell.org/trac/ghc/changeset/185b41c702929f7070a48422b5a9bc49a6c95603/ghc >--------------------------------------------------------------- commit 185b41c702929f7070a48422b5a9bc49a6c95603 Author: Simon Peyton Jones Date: Fri Feb 24 16:39:19 2017 +0000 Move isJoinId, isJoinId_maybe to Id This is just a refactoring, moving these two functions where they belong. The reason they were there was becuase of the use of isJoinId_maybe in the OutputableBndr instance of TaggedBndr, which was in CoreSyn. I moved it to PprCore, to join the OutputableBndr instance for Var. That makes more sense anyway. >--------------------------------------------------------------- 185b41c702929f7070a48422b5a9bc49a6c95603 compiler/basicTypes/Id.hs | 23 ++++++++++++++++++++--- compiler/basicTypes/IdInfo.hs-boot | 2 -- compiler/basicTypes/Var.hs | 12 ------------ compiler/coreSyn/CoreSyn.hs | 9 --------- compiler/coreSyn/PprCore.hs | 8 ++++++++ compiler/simplCore/CSE.hs | 5 +++-- compiler/simplCore/FloatIn.hs | 2 +- 7 files changed, 32 insertions(+), 29 deletions(-) diff --git a/compiler/basicTypes/Id.hs b/compiler/basicTypes/Id.hs index 69c2cc3..3934ae7 100644 --- a/compiler/basicTypes/Id.hs +++ b/compiler/basicTypes/Id.hs @@ -5,7 +5,7 @@ \section[Id]{@Ids@: Value and constructor identifiers} -} -{-# LANGUAGE CPP #-} +{-# LANGUAGE ImplicitParams, CPP #-} -- | -- #name_types# @@ -127,8 +127,7 @@ import Var( Id, CoVar, DictId, JoinId, InId, InVar, OutId, OutVar, idInfo, idDetails, setIdDetails, globaliseId, varType, - isId, isLocalId, isGlobalId, isExportedId, - isJoinId, isJoinId_maybe ) + isId, isLocalId, isGlobalId, isExportedId ) import qualified Var import Type @@ -478,6 +477,24 @@ isDataConId_maybe id = case Var.idDetails id of DataConWrapId con -> Just con _ -> Nothing +isJoinId :: Var -> Bool +-- It is convenient in SetLevels.lvlMFE to apply isJoinId +-- to the free vars of an expression, so it's convenient +-- if it returns False for type variables +isJoinId id + | isId id = case Var.idDetails id of + JoinId {} -> True + _ -> False + | otherwise = False + +isJoinId_maybe :: Var -> Maybe JoinArity +isJoinId_maybe id + | isId id = ASSERT2( isId id, ppr id ) + case Var.idDetails id of + JoinId arity -> Just arity + _ -> Nothing + | otherwise = Nothing + idDataCon :: Id -> DataCon -- ^ Get from either the worker or the wrapper 'Id' to the 'DataCon'. Currently used only in the desugarer. -- diff --git a/compiler/basicTypes/IdInfo.hs-boot b/compiler/basicTypes/IdInfo.hs-boot index 27c1217..0fabad3 100644 --- a/compiler/basicTypes/IdInfo.hs-boot +++ b/compiler/basicTypes/IdInfo.hs-boot @@ -1,5 +1,4 @@ module IdInfo where -import BasicTypes import Outputable data IdInfo data IdDetails @@ -7,6 +6,5 @@ data IdDetails vanillaIdInfo :: IdInfo coVarDetails :: IdDetails isCoVarDetails :: IdDetails -> Bool -isJoinIdDetails_maybe :: IdDetails -> Maybe JoinArity pprIdDetails :: IdDetails -> SDoc diff --git a/compiler/basicTypes/Var.hs b/compiler/basicTypes/Var.hs index 2b728af..2bdd5f0 100644 --- a/compiler/basicTypes/Var.hs +++ b/compiler/basicTypes/Var.hs @@ -57,7 +57,6 @@ module Var ( -- ** Predicates isId, isTyVar, isTcTyVar, isLocalVar, isLocalId, isCoVar, isNonCoVarId, isTyCoVar, - isJoinId, isJoinId_maybe, isGlobalId, isExportedId, mustHaveLocalBinding, @@ -85,10 +84,8 @@ module Var ( import {-# SOURCE #-} TyCoRep( Type, Kind, pprKind ) import {-# SOURCE #-} TcType( TcTyVarDetails, pprTcTyVarDetails, vanillaSkolemTv ) import {-# SOURCE #-} IdInfo( IdDetails, IdInfo, coVarDetails, isCoVarDetails, - isJoinIdDetails_maybe, vanillaIdInfo, pprIdDetails ) -import BasicTypes ( JoinArity ) import Name hiding (varName) import Unique ( Uniquable, Unique, getKey, getUnique , mkUniqueGrimily, nonDetCmpUnique ) @@ -96,7 +93,6 @@ import Util import Binary import DynFlags import Outputable -import Maybes import Data.Data @@ -618,14 +614,6 @@ isNonCoVarId :: Var -> Bool isNonCoVarId (Id { id_details = details }) = not (isCoVarDetails details) isNonCoVarId _ = False -isJoinId :: Var -> Bool -isJoinId (Id { id_details = details }) = isJust (isJoinIdDetails_maybe details) -isJoinId _ = False - -isJoinId_maybe :: Var -> Maybe JoinArity -isJoinId_maybe (Id { id_details = details }) = isJoinIdDetails_maybe details -isJoinId_maybe _ = Nothing - isLocalId :: Var -> Bool isLocalId (Id { idScope = LocalId _ }) = True isLocalId _ = False diff --git a/compiler/coreSyn/CoreSyn.hs b/compiler/coreSyn/CoreSyn.hs index b781863..2616e6f 100644 --- a/compiler/coreSyn/CoreSyn.hs +++ b/compiler/coreSyn/CoreSyn.hs @@ -1717,15 +1717,6 @@ type TaggedAlt t = Alt (TaggedBndr t) instance Outputable b => Outputable (TaggedBndr b) where ppr (TB b l) = char '<' <> ppr b <> comma <> ppr l <> char '>' --- OutputableBndr Var is declared separately in PprCore; using a FlexibleContext --- to avoid circularity -instance (OutputableBndr Var, Outputable b) => - OutputableBndr (TaggedBndr b) where - pprBndr _ b = ppr b -- Simple - pprInfixOcc b = ppr b - pprPrefixOcc b = ppr b - bndrIsJoin_maybe (TB b _) = isJoinId_maybe b - deTagExpr :: TaggedExpr t -> CoreExpr deTagExpr (Var v) = Var v deTagExpr (Lit l) = Lit l diff --git a/compiler/coreSyn/PprCore.hs b/compiler/coreSyn/PprCore.hs index 30de5d2..ddece8d 100644 --- a/compiler/coreSyn/PprCore.hs +++ b/compiler/coreSyn/PprCore.hs @@ -338,12 +338,20 @@ Furthermore, a dead case-binder is completely ignored, while otherwise, dead binders are printed as "_". -} +-- THese instances are sadly orphans + instance OutputableBndr Var where pprBndr = pprCoreBinder pprInfixOcc = pprInfixName . varName pprPrefixOcc = pprPrefixName . varName bndrIsJoin_maybe = isJoinId_maybe +instance Outputable b => OutputableBndr (TaggedBndr b) where + pprBndr _ b = ppr b -- Simple + pprInfixOcc b = ppr b + pprPrefixOcc b = ppr b + bndrIsJoin_maybe (TB b _) = isJoinId_maybe b + pprCoreBinder :: BindingSite -> Var -> SDoc pprCoreBinder LetBind binder | isTyVar binder = pprKindedTyVarBndr binder diff --git a/compiler/simplCore/CSE.hs b/compiler/simplCore/CSE.hs index 012607a..6bbd436 100644 --- a/compiler/simplCore/CSE.hs +++ b/compiler/simplCore/CSE.hs @@ -11,10 +11,11 @@ module CSE (cseProgram, cseOneExpr) where #include "HsVersions.h" import CoreSubst -import Var ( Var, isJoinId ) +import Var ( Var ) import VarEnv ( elemInScopeSet ) import Id ( Id, idType, idInlineActivation, isDeadBinder - , zapIdOccInfo, zapIdUsageInfo, idInlinePragma ) + , zapIdOccInfo, zapIdUsageInfo, idInlinePragma + , isJoinId ) import CoreUtils ( mkAltExpr, eqExpr , exprIsLiteralString , stripTicksE, stripTicksT, mkTicks ) diff --git a/compiler/simplCore/FloatIn.hs b/compiler/simplCore/FloatIn.hs index cabdc3b..4d5a564 100644 --- a/compiler/simplCore/FloatIn.hs +++ b/compiler/simplCore/FloatIn.hs @@ -25,7 +25,7 @@ import CoreUtils ( exprIsDupable, exprIsExpandable, exprOkForSideEffects, mkTicks ) import CoreFVs import CoreMonad ( CoreM ) -import Id ( isOneShotBndr, idType ) +import Id ( isOneShotBndr, idType, isJoinId, isJoinId_maybe ) import Var import Type ( isUnliftedType ) import VarSet From git at git.haskell.org Fri Feb 24 16:58:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 24 Feb 2017 16:58:49 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline2: Tidy up Coercion.mkRuntimeRepCo (323b7fa) Message-ID: <20170224165849.E38053A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline2 Link : http://ghc.haskell.org/trac/ghc/changeset/323b7fa47abb26f1ea869db27cc7714673d82900/ghc >--------------------------------------------------------------- commit 323b7fa47abb26f1ea869db27cc7714673d82900 Author: Simon Peyton Jones Date: Fri Feb 24 16:54:34 2017 +0000 Tidy up Coercion.mkRuntimeRepCo It was hard to understand, and inefficient in the common case. Better now. >--------------------------------------------------------------- 323b7fa47abb26f1ea869db27cc7714673d82900 compiler/prelude/TysWiredIn.hs-boot | 1 + compiler/types/Coercion.hs | 47 +++++++++++++++++++++---------------- 2 files changed, 28 insertions(+), 20 deletions(-) diff --git a/compiler/prelude/TysWiredIn.hs-boot b/compiler/prelude/TysWiredIn.hs-boot index 26e4201..c740690 100644 --- a/compiler/prelude/TysWiredIn.hs-boot +++ b/compiler/prelude/TysWiredIn.hs-boot @@ -17,6 +17,7 @@ constraintKind :: Kind runtimeRepTyCon, vecCountTyCon, vecElemTyCon :: TyCon runtimeRepTy :: Type +liftedRepTy :: Type liftedRepDataConTyCon, vecRepDataConTyCon, tupleRepDataConTyCon :: TyCon diff --git a/compiler/types/Coercion.hs b/compiler/types/Coercion.hs index f579145..f2351fe 100644 --- a/compiler/types/Coercion.hs +++ b/compiler/types/Coercion.hs @@ -123,7 +123,7 @@ import Pair import SrcLoc import PrelNames import TysPrim ( eqPhantPrimTyCon ) -import {-# SOURCE #-} TysWiredIn ( constraintKind ) +import {-# SOURCE #-} TysWiredIn ( liftedRepTy, constraintKind ) import ListSetOps import Maybes import UniqFM @@ -405,42 +405,49 @@ mkHeteroCoercionType Representational = mkHeteroReprPrimEqPred mkHeteroCoercionType Phantom = panic "mkHeteroCoercionType" constraintIsLifted :: CoAxiomRule -constraintIsLifted = - CoAxiomRule { coaxrName = mkFastString "constraintIsLifted" +-- constratintIsLifted :: Type ~N Constraint +constraintIsLifted + = CoAxiomRule { coaxrName = mkFastString "constraintIsLifted" , coaxrAsmpRoles = [] - , coaxrRole = Nominal - , coaxrProves = - const $ Just $ Pair constraintKind liftedTypeKind + , coaxrRole = Nominal + , coaxrProves = const $ Just $ + Pair constraintKind liftedTypeKind } --- | Given a coercion @co1 :: (a :: TYPE r1) ~ (b :: TYPE r2)@, --- produce a coercion @rep_co :: r1 ~ r2 at . +-- | Given a coercion @co :: (a :: TYPE r1) ~ (b :: TYPE r2)@, +-- produce a coercion @rep_co :: r1 ~N r2 at . +-- +-- HACK for Constraint (which is currently a different kind than TYPE r): +-- treat Constraint like TYPE LiftedRep, so +-- if co :: (a :: Constraint) ~ (b :: TYPE r2) +-- return rep_co :: LiftedRep ~ r2 mkRuntimeRepCo :: Coercion -> Coercion mkRuntimeRepCo co -- This is currently a bit tricky since we can see types of kind Constraint -- in addition to the usual things of kind (TYPE rep). We first map -- Constraint-kinded types to (TYPE 'LiftedRep). -- FIXME: this is terrible - | isConstraintKind a && isConstraintKind b - = mkNthCo 0 $ constraintToLifted - $ mkSymCo $ constraintToLifted $ mkSymCo kind_co + | isReflCo kind_co -- kind_co :: or + = -- If a=b, things are easy + if isConstraintKind a + then mkNomReflCo liftedRepTy -- + else mkNomReflCo (tyConAppArgN 0 a) -- - | isConstraintKind a + | isConstraintKind a -- Presumably b = TYPE r2 = WARN( True, text "mkRuntimeRepCo" ) - mkNthCo 0 - $ mkSymCo $ constraintToLifted $ mkSymCo kind_co + mkNthCo 0 (mkSymCo cl_co `mkTransCo` kind_co) - | isConstraintKind b + | isConstraintKind b -- Presumably a = TYPE r1 = WARN( True, text "mkRuntimeRepCo" ) - mkNthCo 0 $ constraintToLifted kind_co + mkNthCo 0 (kind_co `mkTransCo` cl_co) - | otherwise + | otherwise -- a = TYPE r1, t = TYPE r2 = mkNthCo 0 kind_co where - -- the right side of a coercion from Constraint to TYPE 'LiftedRep - constraintToLifted = (`mkTransCo` mkAxiomRuleCo constraintIsLifted []) + -- cl_co :: Constraint ~ TYPE LiftedRep + cl_co = mkAxiomRuleCo constraintIsLifted [] - kind_co = mkKindCo co -- kind_co :: TYPE r1 ~ TYPE r2 + kind_co = mkKindCo co -- kind_co :: TYPE r1 ~N TYPE r2 -- (up to silliness with Constraint) Pair a b = coercionKind kind_co -- Pair of (TYPE r1, TYPE r2) From git at git.haskell.org Fri Feb 24 16:58:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 24 Feb 2017 16:58:52 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline2: Fix a nasty bug in CoreSubst.collectBindersPushingCo (002192a) Message-ID: <20170224165852.9AB7E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline2 Link : http://ghc.haskell.org/trac/ghc/changeset/002192aa8df463ae945e8a94147cfc1d848f43a5/ghc >--------------------------------------------------------------- commit 002192aa8df463ae945e8a94147cfc1d848f43a5 Author: Simon Peyton Jones Date: Fri Feb 24 16:55:36 2017 +0000 Fix a nasty bug in CoreSubst.collectBindersPushingCo The bug wsa in the use of (mkNthCo 0) to get the argument part of a function coercion. Not so! Now (->) takes four arguments so that 0 should have been 2. Enough with magic numbers. I defined decomposeFunCo, and used it throughout. Much nicer now; and correct. The nete effect, incidentally, was that T9509 was failing to specialise. (And that was the initial reason for introducing collectBindersPushingCo in the first place.) >--------------------------------------------------------------- 002192aa8df463ae945e8a94147cfc1d848f43a5 compiler/coreSyn/CoreSubst.hs | 9 +++++---- compiler/types/Coercion.hs | 46 ++++++++++++++++++++++++++++++++++++++----- compiler/types/Unify.hs | 2 +- 3 files changed, 47 insertions(+), 10 deletions(-) diff --git a/compiler/coreSyn/CoreSubst.hs b/compiler/coreSyn/CoreSubst.hs index 6afa3ba..5072e70 100644 --- a/compiler/coreSyn/CoreSubst.hs +++ b/compiler/coreSyn/CoreSubst.hs @@ -1678,7 +1678,7 @@ pushCoValArg co = Just (mkRepReflCo arg, mkRepReflCo res) | isFunTy tyL - , [_, _, co1, co2] <- decomposeCo 4 co + , (co1, co2) <- decomposeFunCo co -- If co :: (tyL1 -> tyL2) ~ (tyR1 -> tyR2) -- then co1 :: tyL1 ~ tyR1 -- co2 :: tyL2 ~ tyR2 @@ -1702,7 +1702,7 @@ pushCoercionIntoLambda in_scope x e co , Pair s1s2 t1t2 <- coercionKind co , Just (_s1,_s2) <- splitFunTy_maybe s1s2 , Just (t1,_t2) <- splitFunTy_maybe t1t2 - = let [_rep1, _rep2, co1, co2] = decomposeCo 4 co + = let (co1, co2) = decomposeFunCo co -- Should we optimize the coercions here? -- Otherwise they might not match too well x' = x `setIdType` t1 @@ -1808,8 +1808,9 @@ collectBindersPushingCo e | isId b , let Pair tyL tyR = coercionKind co , ASSERT( isFunTy tyL) isFunTy tyR - , isReflCo (mkNthCo 0 co) -- See Note [collectBindersPushingCo] - = go_c (b:bs) e (mkNthCo 1 co) + , (co_arg, co_res) <- decomposeFunCo co + , isReflCo co_arg -- See Note [collectBindersPushingCo] + = go_c (b:bs) e co_res | otherwise = (reverse bs, mkCast (Lam b e) co) diff --git a/compiler/types/Coercion.hs b/compiler/types/Coercion.hs index f2351fe..f53968e 100644 --- a/compiler/types/Coercion.hs +++ b/compiler/types/Coercion.hs @@ -48,7 +48,7 @@ module Coercion ( mapStepResult, unwrapNewTypeStepper, topNormaliseNewType_maybe, topNormaliseTypeX, - decomposeCo, getCoVar_maybe, + decomposeCo, decomposeFunCo, getCoVar_maybe, splitTyConAppCo_maybe, splitAppCo_maybe, splitFunCo_maybe, @@ -296,8 +296,20 @@ ppr_co_ax_branch ppr_rhs Destructing coercions %* * %************************************************************************ + +Note [Function coercions] +~~~~~~~~~~~~~~~~~~~~~~~~~ +Remember that + (->) :: forall r1 r2. TYPE r1 -> TYPE r2 -> TYPE LiftedRep + +Hence + FunCo r co1 co2 :: (s1->t1) ~r (s2->t2) +is short for + TyConAppCo (->) co_rep1 co_rep2 co1 co2 +where co_rep1, co_rep2 are the coercions on the representations. -} + -- | This breaks a 'Coercion' with type @T A B C ~ T D E F@ into -- a list of 'Coercion's of kinds @A ~ D@, @B ~ E@ and @E ~ F at . Hence: -- @@ -307,6 +319,16 @@ decomposeCo arity co = [mkNthCo n co | n <- [0..(arity-1)] ] -- Remember, Nth is zero-indexed +decomposeFunCo :: Coercion -> (Coercion, Coercion) +-- Expects co :: (s1 -> t1) ~ (s2 -> t2) +-- Returns (co1 :: s1~s2, co2 :: t1~t2) +-- See Note [Function coercions] for the "2" and "3" +decomposeFunCo co = ASSERT2( all_ok, ppr co ) + (mkNthCo 2 co, mkNthCo 3 co) + where + Pair s1t1 s2t2 = coercionKind co + all_ok = isFunTy s1t1 && isFunTy s2t2 + -- | Attempts to obtain the type variable underlying a 'Coercion' getCoVar_maybe :: Coercion -> Maybe CoVar getCoVar_maybe (CoVarCo cv) = Just cv @@ -595,7 +617,7 @@ mkNomReflCo = mkReflCo Nominal mkTyConAppCo :: HasDebugCallStack => Role -> TyCon -> [Coercion] -> Coercion mkTyConAppCo r tc cos | tc `hasKey` funTyConKey - , [_rep1, _rep2, co1, co2] <- cos + , [_rep1, _rep2, co1, co2] <- cos -- See Note [Function coercions] = -- (a :: TYPE ra) -> (b :: TYPE rb) ~ (c :: TYPE rc) -> (d :: TYPE rd) -- rep1 :: ra ~ rc rep2 :: rb ~ rd -- co1 :: a ~ c co2 :: b ~ d @@ -923,14 +945,26 @@ mkNthCo n (Refl r ty) mkNthCo 0 (ForAllCo _ kind_co _) = kind_co -- If co :: (forall a1:k1. t1) ~ (forall a2:k2. t2) -- then (nth 0 co :: k1 ~ k2) -mkNthCo n (TyConAppCo _ _ arg_cos) = arg_cos `getNth` n + mkNthCo n co@(FunCo _ arg res) + -- See Note [Function coercions] + -- If FunCo _ arg_co res_co :: (s1:TYPE sk1 -> s2:TYPE sk2) + -- ~ (t1:TYPE tk1 -> t2:TYPE tk2) + -- Then we want to behave as if co was + -- TyConAppCo argk_co resk_co arg_co res_co + -- where + -- argk_co :: sk1 ~ tk1 = mkNthCo 0 (mkKindCo arg_co) + -- resk_co :: sk2 ~ tk2 = mkNthCo 0 (mkKindCo res_co) + -- i.e. mkRuntimeRepCo = case n of 0 -> mkRuntimeRepCo arg 1 -> mkRuntimeRepCo res 2 -> arg 3 -> res _ -> pprPanic "mkNthCo(FunCo)" (ppr n $$ ppr co) + +mkNthCo n (TyConAppCo _ _ arg_cos) = arg_cos `getNth` n + mkNthCo n co = NthCo n co mkLRCo :: LeftOrRight -> Coercion -> Coercion @@ -978,8 +1012,10 @@ mkKindCo co -- generally, calling coercionKind during coercion creation is a bad idea, -- as it can lead to exponential behavior. But, we don't have nested mkKindCos, -- so it's OK here. - , typeKind ty1 `eqType` typeKind ty2 - = Refl Nominal (typeKind ty1) + , let tk1 = typeKind ty1 + tk2 = typeKind ty2 + , tk1 `eqType` tk2 + = Refl Nominal tk1 | otherwise = KindCo co diff --git a/compiler/types/Unify.hs b/compiler/types/Unify.hs index 05d6c6d..517358d 100644 --- a/compiler/types/Unify.hs +++ b/compiler/types/Unify.hs @@ -843,7 +843,7 @@ unify_ty (CoercionTy co1) (CoercionTy co2) kco -> do { b <- tvBindFlagL cv ; if b == BindMe then do { checkRnEnvRCo co2 - ; let [_, _, co_l, co_r] = decomposeCo 4 kco + ; let (co_l, co_r) = decomposeFunCo kco -- cv :: t1 ~ t2 -- co2 :: s1 ~ s2 -- co_l :: t1 ~ s1 From git at git.haskell.org Fri Feb 24 16:59:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 24 Feb 2017 16:59:47 +0000 (UTC) Subject: [commit: ghc] master: Make SCCFunSig tag Located for ghc-exactprint (9b859ef) Message-ID: <20170224165947.16A333A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9b859ef0077972e8e37e29c546bf587fd9f65e4c/ghc >--------------------------------------------------------------- commit 9b859ef0077972e8e37e29c546bf587fd9f65e4c Author: Alan Zimmerman Date: Fri Feb 24 18:57:51 2017 +0200 Make SCCFunSig tag Located for ghc-exactprint >--------------------------------------------------------------- 9b859ef0077972e8e37e29c546bf587fd9f65e4c compiler/hsSyn/HsBinds.hs | 2 +- compiler/parser/Parser.y | 2 +- compiler/typecheck/TcBinds.hs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/hsSyn/HsBinds.hs b/compiler/hsSyn/HsBinds.hs index 1f38c38..d985082 100644 --- a/compiler/hsSyn/HsBinds.hs +++ b/compiler/hsSyn/HsBinds.hs @@ -852,7 +852,7 @@ data Sig name | SCCFunSig SourceText -- Note [Pragma source text] in BasicTypes (Located name) -- Function name - (Maybe StringLiteral) + (Maybe (Located StringLiteral)) | CompleteMatchSig SourceText (Located [Located name]) (Maybe (Located name)) deriving instance (DataId name) => Data (Sig name) diff --git a/compiler/parser/Parser.y b/compiler/parser/Parser.y index 92e3232..c6a8e48 100644 --- a/compiler/parser/Parser.y +++ b/compiler/parser/Parser.y @@ -2275,7 +2275,7 @@ sigdecl :: { LHsDecl RdrName } | '{-# SCC' qvar STRING '#-}' {% do { scc <- getSCC $3 ; let str_lit = StringLiteral (getSTRINGs $3) scc - ; ams (sLL $1 $> (SigD (SCCFunSig (getSCC_PRAGs $1) $2 (Just str_lit)))) + ; ams (sLL $1 $> (SigD (SCCFunSig (getSCC_PRAGs $1) $2 (Just ( sL1 $3 str_lit))))) [mo $1, mc $4] } } | '{-# SPECIALISE' activation qvar '::' sigtypes1 '#-}' diff --git a/compiler/typecheck/TcBinds.hs b/compiler/typecheck/TcBinds.hs index 25c4061..5586abe 100644 --- a/compiler/typecheck/TcBinds.hs +++ b/compiler/typecheck/TcBinds.hs @@ -727,7 +727,7 @@ funBindTicks loc fun_id mod sigs -- by the renamer , let cc_str | Just cc_str <- mb_cc_str - = sl_fs cc_str + = sl_fs $ unLoc cc_str | otherwise = getOccFS (Var.varName fun_id) cc_name = moduleNameFS (moduleName mod) `appendFS` consFS '.' cc_str From git at git.haskell.org Fri Feb 24 17:38:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 24 Feb 2017 17:38:29 +0000 (UTC) Subject: [commit: ghc] master: Add a comment explaining CompleteMatchSig in HsBinds (00c0120) Message-ID: <20170224173829.3B6893A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/00c01200cd1653b63ce77a57bc7e3a76f8ded26b/ghc >--------------------------------------------------------------- commit 00c01200cd1653b63ce77a57bc7e3a76f8ded26b Author: Matthew Pickering Date: Fri Feb 24 17:37:19 2017 +0000 Add a comment explaining CompleteMatchSig in HsBinds [skip ci] >--------------------------------------------------------------- 00c01200cd1653b63ce77a57bc7e3a76f8ded26b compiler/hsSyn/HsBinds.hs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/compiler/hsSyn/HsBinds.hs b/compiler/hsSyn/HsBinds.hs index d985082..b39e25a 100644 --- a/compiler/hsSyn/HsBinds.hs +++ b/compiler/hsSyn/HsBinds.hs @@ -853,6 +853,13 @@ data Sig name | SCCFunSig SourceText -- Note [Pragma source text] in BasicTypes (Located name) -- Function name (Maybe (Located StringLiteral)) + -- | A complete match pragma + -- + -- > {-# COMPLETE C, D [:: T] #-} + -- + -- Used to inform the pattern match checker about additional + -- complete matchings which, for example, arise from pattern + -- synonym definitions. | CompleteMatchSig SourceText (Located [Located name]) (Maybe (Located name)) deriving instance (DataId name) => Data (Sig name) From git at git.haskell.org Fri Feb 24 18:46:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 24 Feb 2017 18:46:10 +0000 (UTC) Subject: [commit: ghc] master: Document AMP as a Report deviation (93ffcb0) Message-ID: <20170224184610.6785C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/93ffcb028630df97bda82f16a103e3c8ffdaba35/ghc >--------------------------------------------------------------- commit 93ffcb028630df97bda82f16a103e3c8ffdaba35 Author: David Feuer Date: Fri Feb 24 13:45:00 2017 -0500 Document AMP as a Report deviation `Applicative` as a superclass of `Monad` is non-standard. Fixes #13196. [skip ci] Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3185 >--------------------------------------------------------------- 93ffcb028630df97bda82f16a103e3c8ffdaba35 docs/users_guide/bugs.rst | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/users_guide/bugs.rst b/docs/users_guide/bugs.rst index 9b60e54..707f66b 100644 --- a/docs/users_guide/bugs.rst +++ b/docs/users_guide/bugs.rst @@ -213,8 +213,8 @@ Numbers, basic types, and built-in classes - Whenever you give a function, instance or class a ``Num t`` constraint, also give it ``Show t`` and ``Eq t`` constraints. -``Bits`` superclasses - The ``Bits`` class does not have a ``Num`` superclasses. It +``Bits`` superclass + The ``Bits`` class does not have a ``Num`` superclass. It therefore does not have default methods for the ``bit``, ``testBit`` and ``popCount`` methods. @@ -239,6 +239,11 @@ Numbers, basic types, and built-in classes extra methods simply because ``ReadPrec`` is more efficient than ``ReadS`` (the type on which ``readsPrec`` is based). +``Monad`` superclass + The ``Monad`` class has an ``Applicative`` superclass. You cannot write + ``Monad`` instances that work for GHC and also for a Haskell 2010 + implementation that does not define ``Applicative``. + Extra instances The following extra instances are defined: :: From git at git.haskell.org Fri Feb 24 22:53:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 24 Feb 2017 22:53:08 +0000 (UTC) Subject: [commit: ghc] master: Record full FieldLabel in ifConFields. (9d17028) Message-ID: <20170224225308.8A4C93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9d17028fbcecb53480598c4fcc7bd9e71b2ac7cf/ghc >--------------------------------------------------------------- commit 9d17028fbcecb53480598c4fcc7bd9e71b2ac7cf Author: Edward Z. Yang Date: Wed Feb 22 20:32:41 2017 -0800 Record full FieldLabel in ifConFields. Summary: The previous implementation tried to be "efficient" by storing field names once in IfaceConDecls, and only just enough information for us to reconstruct the FieldLabel. But this came at a bit of code complexity cost. This patch undos the optimization, instead storing a full FieldLabel at each data constructor. Consequently, this fixes bugs #12699 and #13250. Signed-off-by: Edward Z. Yang Test Plan: validate Reviewers: adamgundry, bgamari, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3174 >--------------------------------------------------------------- 9d17028fbcecb53480598c4fcc7bd9e71b2ac7cf compiler/backpack/RnModIface.hs | 13 ++-- compiler/iface/IfaceSyn.hs | 75 +++++++++------------- compiler/iface/MkIface.hs | 15 ++--- compiler/iface/TcIface.hs | 24 ++----- testsuite/tests/backpack/should_compile/T13250.bkp | 8 +++ .../should_compile/{bkp37.stderr => T13250.stderr} | 4 +- testsuite/tests/backpack/should_compile/all.T | 1 + 7 files changed, 58 insertions(+), 82 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 9d17028fbcecb53480598c4fcc7bd9e71b2ac7cf From git at git.haskell.org Sat Feb 25 02:07:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 25 Feb 2017 02:07:12 +0000 (UTC) Subject: [commit: ghc] master: Fix validate. (7c060e4) Message-ID: <20170225020712.D82803A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7c060e4d688047b5e2a9c85878796e6e5cd86ccb/ghc >--------------------------------------------------------------- commit 7c060e4d688047b5e2a9c85878796e6e5cd86ccb Author: Edward Z. Yang Date: Fri Feb 24 18:06:58 2017 -0800 Fix validate. Signed-off-by: Edward Z. Yang >--------------------------------------------------------------- 7c060e4d688047b5e2a9c85878796e6e5cd86ccb compiler/iface/MkIface.hs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/compiler/iface/MkIface.hs b/compiler/iface/MkIface.hs index dcb55ef..0473ed1 100644 --- a/compiler/iface/MkIface.hs +++ b/compiler/iface/MkIface.hs @@ -1574,7 +1574,7 @@ tyConToIfaceDecl env tycon ifCType = tyConCType tycon, ifRoles = tyConRoles tycon, ifCtxt = tidyToIfaceContext tc_env1 (tyConStupidTheta tycon), - ifCons = ifaceConDecls (algTyConRhs tycon) (algTcFields tycon), + ifCons = ifaceConDecls (algTyConRhs tycon), ifGadtSyntax = isGadtSyntaxTyCon tycon, ifParent = parent }) @@ -1623,11 +1623,11 @@ tyConToIfaceDecl env tycon - ifaceConDecls (NewTyCon { data_con = con }) flds = IfNewTyCon (ifaceConDecl con) - ifaceConDecls (DataTyCon { data_cons = cons }) flds = IfDataTyCon (map ifaceConDecl cons) - ifaceConDecls (TupleTyCon { data_con = con }) _ = IfDataTyCon [ifaceConDecl con] - ifaceConDecls (SumTyCon { data_cons = cons }) flds = IfDataTyCon (map ifaceConDecl cons) - ifaceConDecls (AbstractTyCon distinct) _ = IfAbstractTyCon distinct + ifaceConDecls (NewTyCon { data_con = con }) = IfNewTyCon (ifaceConDecl con) + ifaceConDecls (DataTyCon { data_cons = cons }) = IfDataTyCon (map ifaceConDecl cons) + ifaceConDecls (TupleTyCon { data_con = con }) = IfDataTyCon [ifaceConDecl con] + ifaceConDecls (SumTyCon { data_cons = cons }) = IfDataTyCon (map ifaceConDecl cons) + ifaceConDecls (AbstractTyCon distinct) = IfAbstractTyCon distinct -- The AbstractTyCon case happens when a TyCon has been trimmed -- during tidying. -- Furthermore, tyThingToIfaceDecl is also used in TcRnDriver @@ -1666,10 +1666,6 @@ tyConToIfaceDecl env tycon (con_env2, ex_bndrs') = tidyTyVarBinders con_env1 ex_bndrs to_eq_spec (tv,ty) = (tidyTyVar con_env2 tv, tidyToIfaceType con_env2 ty) - ifaceOverloaded flds = case dFsEnvElts flds of - fl:_ -> flIsOverloaded fl - [] -> False - classToIfaceDecl :: TidyEnv -> Class -> (TidyEnv, IfaceDecl) classToIfaceDecl env clas = ( env1 From git at git.haskell.org Sat Feb 25 02:48:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 25 Feb 2017 02:48:03 +0000 (UTC) Subject: [commit: ghc] master: Delete redundant import. (8f15ab9) Message-ID: <20170225024803.3E0163A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8f15ab98a7fe7484089b48c94328fa2980978890/ghc >--------------------------------------------------------------- commit 8f15ab98a7fe7484089b48c94328fa2980978890 Author: Edward Z. Yang Date: Fri Feb 24 18:47:47 2017 -0800 Delete redundant import. Signed-off-by: Edward Z. Yang >--------------------------------------------------------------- 8f15ab98a7fe7484089b48c94328fa2980978890 compiler/iface/MkIface.hs | 1 - 1 file changed, 1 deletion(-) diff --git a/compiler/iface/MkIface.hs b/compiler/iface/MkIface.hs index 0473ed1..158e48f 100644 --- a/compiler/iface/MkIface.hs +++ b/compiler/iface/MkIface.hs @@ -100,7 +100,6 @@ import BasicTypes hiding ( SuccessFlag(..) ) import Unique import Util hiding ( eqListBy ) import FastString -import FastStringEnv import Maybes import Binary import Fingerprint From git at git.haskell.org Sat Feb 25 13:45:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 25 Feb 2017 13:45:34 +0000 (UTC) Subject: [commit: ghc] master: Correctly pretty print a wild card in infix position (8f20844) Message-ID: <20170225134534.810953A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8f20844d3435094583db92a30550ca319d2be863/ghc >--------------------------------------------------------------- commit 8f20844d3435094583db92a30550ca319d2be863 Author: Alan Zimmerman Date: Sat Feb 25 15:42:40 2017 +0200 Correctly pretty print a wild card in infix position >--------------------------------------------------------------- 8f20844d3435094583db92a30550ca319d2be863 compiler/hsSyn/HsExpr.hs | 1 + testsuite/tests/printer/Makefile | 4 ++++ .../tests/{typecheck/should_compile/T13050.hs => printer/T13050p.hs} | 0 testsuite/tests/printer/all.T | 1 + 4 files changed, 6 insertions(+) diff --git a/compiler/hsSyn/HsExpr.hs b/compiler/hsSyn/HsExpr.hs index 71c4089..6ec0f0a 100644 --- a/compiler/hsSyn/HsExpr.hs +++ b/compiler/hsSyn/HsExpr.hs @@ -852,6 +852,7 @@ ppr_expr (OpApp e1 op _ e2) should_print_infix (HsRecFld f) = Just (pprInfixOcc f) should_print_infix (HsUnboundVar h at TrueExprHole{}) = Just (pprInfixOcc (unboundVarOcc h)) + should_print_infix EWildPat = Just (text "`_`") should_print_infix (HsWrap _ e) = should_print_infix e should_print_infix _ = Nothing diff --git a/testsuite/tests/printer/Makefile b/testsuite/tests/printer/Makefile index bc2a4ed..9f0eb23 100644 --- a/testsuite/tests/printer/Makefile +++ b/testsuite/tests/printer/Makefile @@ -201,3 +201,7 @@ ppr048: .PHONY: T13199 T13199: $(CHECK_PPR) "`'$(TEST_HC)' $(TEST_HC_OPTS) --print-libdir | tr -d '\r'`" T13199.hs + +.PHONY: T13050p +T13050p: + $(CHECK_PPR) "`'$(TEST_HC)' $(TEST_HC_OPTS) --print-libdir | tr -d '\r'`" T13050p.hs diff --git a/testsuite/tests/typecheck/should_compile/T13050.hs b/testsuite/tests/printer/T13050p.hs similarity index 100% copy from testsuite/tests/typecheck/should_compile/T13050.hs copy to testsuite/tests/printer/T13050p.hs diff --git a/testsuite/tests/printer/all.T b/testsuite/tests/printer/all.T index 3106f93..e5fd00f 100644 --- a/testsuite/tests/printer/all.T +++ b/testsuite/tests/printer/all.T @@ -47,3 +47,4 @@ test('Ppr046', ignore_stderr, run_command, ['$MAKE -s --no-print-directory ppr04 test('Ppr047', expect_fail, run_command, ['$MAKE -s --no-print-directory ppr047']) test('Ppr048', ignore_stderr, run_command, ['$MAKE -s --no-print-directory ppr048']) test('T13199', ignore_stderr, run_command, ['$MAKE -s --no-print-directory T13199']) +test('T13050p', ignore_stderr, run_command, ['$MAKE -s --no-print-directory T13050p']) From git at git.haskell.org Sun Feb 26 09:32:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 09:32:10 +0000 (UTC) Subject: [commit: ghc] master: Rename compact to ghc-compact. (a0b4a2a) Message-ID: <20170226093210.31A5E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a0b4a2ac5015e9accd4fb71290a68ce1a1d3d630/ghc >--------------------------------------------------------------- commit a0b4a2ac5015e9accd4fb71290a68ce1a1d3d630 Author: Edward Z. Yang Date: Thu Feb 23 13:46:02 2017 -0800 Rename compact to ghc-compact. Summary: The plan is to release a separate library, 'compact', which gives a friendly user-facing interface. This library is just enough so that we can make sure the functionality is working in GHC. Signed-off-by: Edward Z. Yang Test Plan: validate Reviewers: bgamari, dfeuer, austin, simonmar, hvr Subscribers: thomie, erikd, snowleopard Differential Revision: https://phabricator.haskell.org/D3206 >--------------------------------------------------------------- a0b4a2ac5015e9accd4fb71290a68ce1a1d3d630 configure.ac | 2 +- ghc.mk | 2 +- libraries/compact/Data/Compact/Internal.hs | 115 --------------------- libraries/{compact => ghc-compact}/.gitignore | 0 .../{compact/Data => ghc-compact/GHC}/Compact.hs | 101 ++++++++++++++++-- .../Data => ghc-compact/GHC}/Compact/Serialized.hs | 6 +- libraries/{compact => ghc-compact}/LICENSE | 0 libraries/{compact => ghc-compact}/README.md | 0 libraries/{compact => ghc-compact}/Setup.hs | 0 .../ghc-compact.cabal} | 26 ++--- .../{compact => ghc-compact}/tests/.gitignore | 0 libraries/{compact => ghc-compact}/tests/Makefile | 0 libraries/{compact => ghc-compact}/tests/all.T | 0 .../tests/compact_append.hs | 2 +- .../tests/compact_autoexpand.hs | 3 +- .../tests/compact_bench.hs | 3 +- .../tests/compact_bytestring.hs | 3 +- .../tests/compact_cycle.hs | 3 +- .../tests/compact_cycle.stdout | 0 .../tests/compact_function.hs | 2 +- .../tests/compact_function.stderr | 0 .../{compact => ghc-compact}/tests/compact_gc.hs | 3 +- .../tests/compact_huge_array.hs | 3 +- .../tests/compact_largemap.hs | 3 +- .../tests/compact_largemap.stdout | 0 .../{compact => ghc-compact}/tests/compact_loop.hs | 3 +- .../tests/compact_mutable.hs | 2 +- .../tests/compact_mutable.stderr | 0 .../tests/compact_pinned.hs | 2 +- .../tests/compact_pinned.stderr | 0 .../tests/compact_serialize.hs | 5 +- .../tests/compact_serialize.stderr | 0 .../tests/compact_share.hs | 3 +- .../tests/compact_share.stdout | 0 .../tests/compact_simple.hs | 2 +- .../tests/compact_simple.stdout | 0 .../tests/compact_simple_array.hs | 3 +- .../tests/compact_threads.hs | 3 +- .../tests/compact_threads.stdout | 0 packages | 2 +- 40 files changed, 131 insertions(+), 171 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 a0b4a2ac5015e9accd4fb71290a68ce1a1d3d630 From git at git.haskell.org Sun Feb 26 13:46:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 13:46:22 +0000 (UTC) Subject: [commit: ghc] master: Bring in unicode variants of API Annotations for HsBracket (cae1a71) Message-ID: <20170226134622.CF5BC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cae1a71255221d5eec27c0c47c4aaf94293f8d59/ghc >--------------------------------------------------------------- commit cae1a71255221d5eec27c0c47c4aaf94293f8d59 Author: Alan Zimmerman Date: Sun Feb 26 14:18:44 2017 +0200 Bring in unicode variants of API Annotations for HsBracket >--------------------------------------------------------------- cae1a71255221d5eec27c0c47c4aaf94293f8d59 compiler/hsSyn/HsExpr.hs | 12 ++++++------ compiler/parser/ApiAnnotation.hs | 18 +++++++++++++++--- compiler/parser/Parser.y | 18 +++++++++--------- testsuite/tests/ghc-api/annotations/T10276.stdout | 6 +++--- testsuite/tests/ghc-api/annotations/T10399.stdout | 4 ++-- 5 files changed, 35 insertions(+), 23 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 cae1a71255221d5eec27c0c47c4aaf94293f8d59 From git at git.haskell.org Sun Feb 26 16:51:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 16:51:32 +0000 (UTC) Subject: [commit: ghc] master: Load dependent dlls. (41e54b4) Message-ID: <20170226165132.3CAE53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/41e54b4b1a2934364759edcf77ba1f5b03a4098f/ghc >--------------------------------------------------------------- commit 41e54b4b1a2934364759edcf77ba1f5b03a4098f Author: Tamar Christina Date: Thu Feb 23 18:32:28 2017 -0500 Load dependent dlls. When the `GCC` driver envokes the pipeline a `SPEC` is used to determine how to configure the compiler and which libraries to pass along. For Windows/mingw, this specfile is https://github.com/gcc-mirror/gcc/blob/master/gcc/config/i386/mingw32.h This has a lot of interesting things that we need to emulate in order to be able to link as many things out of the box as GCC. In particular this is why you never need to specify `-lgcc_s` when compiling, but you do when using `GHCi`. Unfortunately due to time constraints I can't set up the framework required in `GHC` to do this before the feature freeze. So I suggest this alternate implementation: When we load a dll, also bring it's dependencies into scope of the interpeter. This has pros and cons. Pro is, we'll fix many packages on hackage which specify just `-lstdc++`. Since this points to `libstdc++-6.dll` which will bring `libgcc` into scope. The downside is, we'll be more lenient than GCC, in that the interpreter will link much easier since it has implicit dependencies in scope. Whereas for compilation to work you will have to specify it as an argument to GHC. This will make the Windows runtime linker more consistent with the unix ones. The difference in semantics came about because of the differences between `dlsym` and `GetProcAddress`. The former seems to search the given library and all it's dependencies, while the latter only searches the export table of the library. So we need some extra manual work to search the dependencies which this patch provides. Test Plan: ``` ./validate ``` ``` $ echo :q | inplace/bin/ghc-stage2.exe --interactive +RTS -Dl -RTS -lstdc++ 2>&1 | grep "Loading dependency" ``` ``` $ echo :q | ../inplace/bin/ghc-stage2.exe --interactive -lstdc++ +RTS -Dl -RTS 2>&1 | grep "Loading dependency" Loading dependency *.exe -> GDI32.dll. Loading dependency GDI32.dll -> ntdll.dll. Loading dependency *.exe -> KERNEL32.dll. Loading dependency KERNEL32.dll -> KERNELBASE.dll. Loading dependency *.exe -> msvcrt.dll. Loading dependency *.exe -> SHELL32.dll. Loading dependency SHELL32.dll -> USER32.dll. Loading dependency USER32.dll -> win32u.dll. Loading dependency *.exe -> WINMM.dll. Loading dependency WINMM.dll -> WINMMBASE.dll. Loading dependency *.exe -> WSOCK32.dll. Loading dependency WSOCK32.dll -> WS2_32.dll. Loading dependency WS2_32.dll -> RPCRT4.dll. Loading dependency libstdc++-6.dll -> libwinpthread-1.dll. Loading dependency libstdc++-6.dll -> libgcc_s_seh-1.dll. ``` Trac tickets: #13093, #13189 Reviewers: simonmar, rwbarton, austin, bgamari, erikd Reviewed By: bgamari Subscribers: rwbarton, RyanGlScott, thomie, #ghc_windows_task_force Differential Revision: https://phabricator.haskell.org/D3028 >--------------------------------------------------------------- 41e54b4b1a2934364759edcf77ba1f5b03a4098f rts/linker/PEi386.c | 169 +++++++++++++++++++++------------- testsuite/tests/ghci/linking/Makefile | 4 - 2 files changed, 106 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 41e54b4b1a2934364759edcf77ba1f5b03a4098f From git at git.haskell.org Sun Feb 26 16:51:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 16:51:34 +0000 (UTC) Subject: [commit: ghc] master: Load `pthreads` by default on Windows (be3f436) Message-ID: <20170226165134.E56C43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/be3f436277042477d4a9215c4d5022a6f2225ed9/ghc >--------------------------------------------------------------- commit be3f436277042477d4a9215c4d5022a6f2225ed9 Author: Tamar Christina Date: Thu Feb 23 18:34:33 2017 -0500 Load `pthreads` by default on Windows The GCC Bindists that we use compile with `pthread` enabled by default. This means that on every link the dll is passed as a dependency by the driver. Lots of packages depend on it but the runtime linker doesn't provide it by default making compiled code work but not interpreted. Following D3028 `pthreads` would be provided by default ONLY when linked dynamicly, which we don't support yet (See D2592). Until this is the case we need to manually provide `libpthreads`. Test Plan: ./validate Reviewers: austin, hvr, bgamari Reviewed By: bgamari Subscribers: thomie, #ghc_windows_task_force Differential Revision: https://phabricator.haskell.org/D3155 >--------------------------------------------------------------- be3f436277042477d4a9215c4d5022a6f2225ed9 compiler/ghci/Linker.hs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/compiler/ghci/Linker.hs b/compiler/ghci/Linker.hs index e89f1bb..ebd27b0 100644 --- a/compiler/ghci/Linker.hs +++ b/compiler/ghci/Linker.hs @@ -312,7 +312,19 @@ linkCmdLineLibs' hsc_env pls = , libraryPaths = lib_paths}) = hsc_dflags hsc_env -- (c) Link libraries from the command-line - let minus_ls = [ lib | Option ('-':'l':lib) <- cmdline_ld_inputs ] + let minus_ls_1 = [ lib | Option ('-':'l':lib) <- cmdline_ld_inputs ] + + -- On Windows we want to add libpthread by default just as GCC would. + -- However because we don't know the actual name of pthread's dll we + -- need to defer this to the locateLib call so we can't initialize it + -- inside of the rts. Instead we do it here to be able to find the + -- import library for pthreads. See Trac #13210. + let platform = targetPlatform dflags + os = platformOS platform + minus_ls = case os of + OSMinGW32 -> "pthread" : minus_ls_1 + _ -> minus_ls_1 + libspecs <- mapM (locateLib hsc_env False lib_paths) minus_ls -- (d) Link .o files from the command-line From git at git.haskell.org Sun Feb 26 16:51:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 16:51:37 +0000 (UTC) Subject: [commit: ghc] master: Make list of deprecated symbols on Windows weak. (9968502) Message-ID: <20170226165137.9FE283A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9968502d075e3a714913e14cd96a7d6b7ac7b5e7/ghc >--------------------------------------------------------------- commit 9968502d075e3a714913e14cd96a7d6b7ac7b5e7 Author: Tamar Christina Date: Thu Feb 23 18:33:15 2017 -0500 Make list of deprecated symbols on Windows weak. We have a unfortunate workaround in place for the fact that most packages out there use POSIX names for symbols even on Windows. This means that we have to recognize e.g. both `_ungetch` and `ungetch`. The former is the actual symbol name on windows and the latter is the POSIX variant. The problem is that on normal windows programs `ungetch` should not be in the global namespace. To work around this, we now mark the deprecated symbols as weak symbols in the global namespace. This provides the flexibility we need: * If you use the symbol without defining it, we assume you meant to use the POSIX variant. * If you actually define the symbol, we'll hence forth use that definition and assume you didn't mean to use POSIX code. This is how MingW64's wrapper also works. This requires D3028. Fixes #13210. Test Plan: ./validate Reviewers: austin, bgamari, erikd, simonmar Reviewed By: bgamari Subscribers: thomie, #ghc_windows_task_force Differential Revision: https://phabricator.haskell.org/D3154 >--------------------------------------------------------------- 9968502d075e3a714913e14cd96a7d6b7ac7b5e7 rts/Linker.c | 3 ++- rts/RtsSymbols.c | 16 ++++++++++------ rts/RtsSymbols.h | 2 ++ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/rts/Linker.c b/rts/Linker.c index 8945a96..247f246 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -444,7 +444,8 @@ initLinker_ (int retain_cafs) /* populate the symbol table with stuff from the RTS */ for (sym = rtsSyms; sym->lbl != NULL; sym++) { if (! ghciInsertSymbolTable(WSTR("(GHCi built-in symbols)"), - symhash, sym->lbl, sym->addr, HS_BOOL_FALSE, NULL)) { + symhash, sym->lbl, sym->addr, + sym->weak, NULL)) { barf("ghciInsertSymbolTable failed"); } IF_DEBUG(linker, debugBelch("initLinker: inserting rts symbol %s, %p\n", sym->lbl, sym->addr)); diff --git a/rts/RtsSymbols.c b/rts/RtsSymbols.c index 3f7610c..0180554 100644 --- a/rts/RtsSymbols.c +++ b/rts/RtsSymbols.c @@ -14,6 +14,7 @@ #include "HsFFI.h" #include "sm/Storage.h" +#include #if !defined(mingw32_HOST_OS) #include "posix/Signals.h" @@ -982,11 +983,11 @@ RTS_LIBFFI_SYMBOLS #undef SymE_NeedsDataProto #define SymI_HasProto(vvv) { MAYBE_LEADING_UNDERSCORE_STR(#vvv), \ - (void*)(&(vvv)) }, + (void*)(&(vvv)), false }, #define SymI_HasDataProto(vvv) \ SymI_HasProto(vvv) #define SymE_HasProto(vvv) { MAYBE_LEADING_UNDERSCORE_STR(#vvv), \ - (void*)DLL_IMPORT_DATA_REF(vvv) }, + (void*)DLL_IMPORT_DATA_REF(vvv), false }, #define SymE_HasDataProto(vvv) \ SymE_HasProto(vvv) @@ -999,14 +1000,17 @@ RTS_LIBFFI_SYMBOLS // another symbol. See newCAF/newRetainedCAF/newGCdCAF for an example. #define SymI_HasProto_redirect(vvv,xxx) \ { MAYBE_LEADING_UNDERSCORE_STR(#vvv), \ - (void*)(&(xxx)) }, + (void*)(&(xxx)), false }, // SymI_HasProto_deprecated allows us to redirect references from their deprecated // names to the undeprecated ones. e.g. access -> _access. // We use the hexspeak for unallocated memory 0xBAADF00D to signal the RTS // that this needs to be loaded from somewhere else. +// These are inserted as weak symbols to prevent us overriding packages that do +// define them, since on Windows these functions shouldn't be in the top level +// namespace, but we have them for POSIX compatibility. #define SymI_HasProto_deprecated(vvv) \ - { #vvv, (void*)0xBAADF00D }, + { #vvv, (void*)0xBAADF00D, true }, RtsSymbolVal rtsSyms[] = { RTS_SYMBOLS @@ -1022,7 +1026,7 @@ RtsSymbolVal rtsSyms[] = { // dyld stub code contains references to this, // but it should never be called because we treat // lazy pointers as nonlazy. - { "dyld_stub_binding_helper", (void*)0xDEADBEEF }, + { "dyld_stub_binding_helper", (void*)0xDEADBEEF, false }, #endif - { 0, 0 } /* sentinel */ + { 0, 0, false } /* sentinel */ }; diff --git a/rts/RtsSymbols.h b/rts/RtsSymbols.h index dab2373..7f7ac0f 100644 --- a/rts/RtsSymbols.h +++ b/rts/RtsSymbols.h @@ -11,6 +11,7 @@ #include "ghcautoconf.h" #include "LinkerInternals.h" +#include #ifdef LEADING_UNDERSCORE #define MAYBE_LEADING_UNDERSCORE_STR(s) ("_" s) @@ -21,6 +22,7 @@ typedef struct _RtsSymbolVal { const SymbolName* lbl; SymbolAddr* addr; + bool weak; } RtsSymbolVal; extern RtsSymbolVal rtsSyms[]; From git at git.haskell.org Sun Feb 26 16:51:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 16:51:40 +0000 (UTC) Subject: [commit: ghc] master: rts: Usage message wibbles (97b1505) Message-ID: <20170226165140.5332E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/97b1505954673168e6c9979fc32434f616635b3f/ghc >--------------------------------------------------------------- commit 97b1505954673168e6c9979fc32434f616635b3f Author: Ben Gamari Date: Thu Feb 23 19:04:40 2017 -0500 rts: Usage message wibbles >--------------------------------------------------------------- 97b1505954673168e6c9979fc32434f616635b3f rts/RtsFlags.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c index 6ab70d4..9cff810 100644 --- a/rts/RtsFlags.c +++ b/rts/RtsFlags.c @@ -303,8 +303,8 @@ usage_text[] = { " -p Time/allocation profile (output file .prof)", " -P More detailed Time/Allocation profile", " -Pa Give information about *all* cost centres", +" -pj Output cost-center profile in JSON format", "", -" -Pj Output cost-center profile in JSON format", " -h Heap residency profile (hp2ps) (output file .hp)", " break-down: c = cost centre stack (default)", " m = module", From git at git.haskell.org Sun Feb 26 18:05:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 18:05:59 +0000 (UTC) Subject: [commit: ghc] branch 'wip/spj-early-inline4' created Message-ID: <20170226180559.318213A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/spj-early-inline4 Referencing: 56cb7251ef261a5b5a445d062fb9969a0ab49b4a From git at git.haskell.org Sun Feb 26 18:06:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 18:06:01 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline4: Add VarSet.anyDVarSet, allDVarSet (5990c05) Message-ID: <20170226180601.E3AB43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline4 Link : http://ghc.haskell.org/trac/ghc/changeset/5990c05e78946d9b4ff474df3adb354650670fcc/ghc >--------------------------------------------------------------- commit 5990c05e78946d9b4ff474df3adb354650670fcc Author: Simon Peyton Jones Date: Fri Feb 17 12:17:08 2017 +0000 Add VarSet.anyDVarSet, allDVarSet I need these in a later commit. Also rename varSetAny --> anyVarSet varSetAll --> allVarSet for consistency with other functions; eg filterVarSet >--------------------------------------------------------------- 5990c05e78946d9b4ff474df3adb354650670fcc compiler/basicTypes/VarSet.hs | 20 +++++++++++++------- compiler/specialise/Rules.hs | 2 +- compiler/typecheck/TcType.hs | 2 +- compiler/types/Unify.hs | 4 ++-- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/compiler/basicTypes/VarSet.hs b/compiler/basicTypes/VarSet.hs index a6e508a..f6d82fd 100644 --- a/compiler/basicTypes/VarSet.hs +++ b/compiler/basicTypes/VarSet.hs @@ -17,7 +17,7 @@ module VarSet ( intersectVarSet, intersectsVarSet, disjointVarSet, isEmptyVarSet, delVarSet, delVarSetList, delVarSetByKey, minusVarSet, filterVarSet, - varSetAny, varSetAll, + anyVarSet, allVarSet, transCloVarSet, fixVarSet, lookupVarSet, lookupVarSetByName, sizeVarSet, seqVarSet, @@ -35,7 +35,7 @@ module VarSet ( intersectDVarSet, intersectsDVarSet, disjointDVarSet, isEmptyDVarSet, delDVarSet, delDVarSetList, minusDVarSet, foldDVarSet, filterDVarSet, - dVarSetMinusVarSet, + dVarSetMinusVarSet, anyDVarSet, allDVarSet, transCloDVarSet, sizeDVarSet, seqDVarSet, partitionDVarSet, @@ -50,7 +50,7 @@ import Name ( Name ) import UniqSet import UniqDSet import UniqFM( disjointUFM, pluralUFM, pprUFM ) -import UniqDFM( disjointUDFM, udfmToUfm ) +import UniqDFM( disjointUDFM, udfmToUfm, anyUDFM, allUDFM ) import Outputable (SDoc) -- | A non-deterministic Variable Set @@ -139,11 +139,11 @@ 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 +anyVarSet :: (Var -> Bool) -> VarSet -> Bool +anyVarSet = uniqSetAny -varSetAll :: (Var -> Bool) -> VarSet -> Bool -varSetAll = uniqSetAll +allVarSet :: (Var -> Bool) -> VarSet -> Bool +allVarSet = uniqSetAll -- There used to exist mapVarSet, see Note [Unsound mapUniqSet] in UniqSet for -- why it got removed. @@ -282,6 +282,12 @@ dVarSetMinusVarSet = uniqDSetMinusUniqSet foldDVarSet :: (Var -> a -> a) -> a -> DVarSet -> a foldDVarSet = foldUniqDSet +anyDVarSet :: (Var -> Bool) -> DVarSet -> Bool +anyDVarSet = anyUDFM + +allDVarSet :: (Var -> Bool) -> DVarSet -> Bool +allDVarSet = allUDFM + filterDVarSet :: (Var -> Bool) -> DVarSet -> DVarSet filterDVarSet = filterUniqDSet diff --git a/compiler/specialise/Rules.hs b/compiler/specialise/Rules.hs index 2ad4e1c..47193c6 100644 --- a/compiler/specialise/Rules.hs +++ b/compiler/specialise/Rules.hs @@ -864,7 +864,7 @@ match_alts _ _ _ _ ------------------------------------------ okToFloat :: RnEnv2 -> VarSet -> Bool okToFloat rn_env bind_fvs - = varSetAll not_captured bind_fvs + = allVarSet not_captured bind_fvs where not_captured fv = not (inRnEnvR rn_env fv) diff --git a/compiler/typecheck/TcType.hs b/compiler/typecheck/TcType.hs index 7e5c0b0..69d1f7c 100644 --- a/compiler/typecheck/TcType.hs +++ b/compiler/typecheck/TcType.hs @@ -911,7 +911,7 @@ anyRewritableTyVar ignore_cos pred ty go_co bound co | ignore_cos = False - | otherwise = varSetAny (go_tv bound) (tyCoVarsOfCo co) + | otherwise = anyVarSet (go_tv bound) (tyCoVarsOfCo co) -- We don't have an equivalent of anyRewritableTyVar for coercions -- (at least not yet) so take the free vars and test them diff --git a/compiler/types/Unify.hs b/compiler/types/Unify.hs index ed879eb..517358d 100644 --- a/compiler/types/Unify.hs +++ b/compiler/types/Unify.hs @@ -522,7 +522,7 @@ niFixTCvSubst tenv = f tenv | not_fixpoint = f (mapVarEnv (substTy subst') tenv) | otherwise = subst where - not_fixpoint = varSetAny in_domain range_tvs + not_fixpoint = anyVarSet in_domain range_tvs in_domain tv = tv `elemVarEnv` tenv range_tvs = nonDetFoldUFM (unionVarSet . tyCoVarsOfType) emptyVarSet tenv @@ -1223,7 +1223,7 @@ ty_co_match menv subst ty co lkco rkco = noneSet (\v -> elemVarEnv v env) set noneSet :: (Var -> Bool) -> VarSet -> Bool - noneSet f = varSetAll (not . f) + noneSet f = allVarSet (not . f) ty_co_match menv subst ty co lkco rkco | CastTy ty' co' <- ty From git at git.haskell.org Sun Feb 26 18:06:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 18:06:07 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline4: Improve SetLevels for join points (2ff7aa7) Message-ID: <20170226180607.6435D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline4 Link : http://ghc.haskell.org/trac/ghc/changeset/2ff7aa78ba76a142cc115f31587c8d8cc5f1ab58/ghc >--------------------------------------------------------------- commit 2ff7aa78ba76a142cc115f31587c8d8cc5f1ab58 Author: Simon Peyton Jones Date: Fri Feb 17 16:17:16 2017 +0000 Improve SetLevels for join points C.f. Trac #13286, #13236 * Never destroy a join point unless it goes to top level See Note [Floating join point bindings] * Never float a MFE if it has a free join variable Note [Free join points] * Stop treating nullary join points specially * Enforce the invariant that le_join_ceil >= le_ctxt_lvl (Needs more thought...) >--------------------------------------------------------------- 2ff7aa78ba76a142cc115f31587c8d8cc5f1ab58 compiler/simplCore/SetLevels.hs | 301 +++++++++++++++++++--------------------- 1 file changed, 144 insertions(+), 157 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 2ff7aa78ba76a142cc115f31587c8d8cc5f1ab58 From git at git.haskell.org Sun Feb 26 18:06:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 18:06:04 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline4: Inline data constructor wrappers in phase 2 only (ee22201) Message-ID: <20170226180604.A2FAB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline4 Link : http://ghc.haskell.org/trac/ghc/changeset/ee22201cab0aced0ef0dca634179ad99f1ea8123/ghc >--------------------------------------------------------------- commit ee22201cab0aced0ef0dca634179ad99f1ea8123 Author: Simon Peyton Jones Date: Tue Feb 14 13:49:13 2017 +0000 Inline data constructor wrappers in phase 2 only This patch prepares for my upcoming early-inlining patch. It arranges that data constructor wrappers are not inlined until Phase 2 (the first of the "normal" phases.) That gives rules a chance to fire in the InitialPhase (aka "gentle"). This has been a bit of a problem for a while, so it's nice to have a fix. It should make no difference immediately, becuase currently nothing is inlined in the InitialPhase anyway. >--------------------------------------------------------------- ee22201cab0aced0ef0dca634179ad99f1ea8123 compiler/basicTypes/MkId.hs | 22 +++- .../tests/deSugar/should_compile/T2431.stderr | 46 ++++---- .../tests/simplCore/should_compile/T7360.stderr | 120 ++++++++++----------- 3 files changed, 103 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 ee22201cab0aced0ef0dca634179ad99f1ea8123 From git at git.haskell.org Sun Feb 26 18:06:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 18:06:10 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline4: Combine identical case alterantives in CSE (19d9422) Message-ID: <20170226180610.1E4003A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline4 Link : http://ghc.haskell.org/trac/ghc/changeset/19d9422108dc79ac65760718837da734c15366d5/ghc >--------------------------------------------------------------- commit 19d9422108dc79ac65760718837da734c15366d5 Author: Simon Peyton Jones Date: Tue Feb 14 13:59:04 2017 +0000 Combine identical case alterantives in CSE See Note [Combine case alternatives] in CSE. This opportunity surfaced when I was was studying early inlining. It's easy (and cheap) to exploit, and sometimes makes a worthwhile saving. >--------------------------------------------------------------- 19d9422108dc79ac65760718837da734c15366d5 compiler/simplCore/CSE.hs | 133 ++++++++++++++++++--- .../tests/numeric/should_compile/T7116.stdout | 16 +-- 2 files changed, 120 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 19d9422108dc79ac65760718837da734c15366d5 From git at git.haskell.org Sun Feb 26 18:06:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 18:06:15 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline4: Change -ddump-tc-trace output in TcErrors, slightly (e303dce) Message-ID: <20170226180615.86B503A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline4 Link : http://ghc.haskell.org/trac/ghc/changeset/e303dcedc8dde81166cf8f5fe69eeeac6506c1be/ghc >--------------------------------------------------------------- commit e303dcedc8dde81166cf8f5fe69eeeac6506c1be Author: Simon Peyton Jones Date: Fri Feb 17 12:49:26 2017 +0000 Change -ddump-tc-trace output in TcErrors, slightly Only affects debugging >--------------------------------------------------------------- e303dcedc8dde81166cf8f5fe69eeeac6506c1be compiler/typecheck/TcErrors.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/compiler/typecheck/TcErrors.hs b/compiler/typecheck/TcErrors.hs index 6d4e3de..d47ecc6 100644 --- a/compiler/typecheck/TcErrors.hs +++ b/compiler/typecheck/TcErrors.hs @@ -191,9 +191,9 @@ report_unsolved mb_binds_var err_as_warn type_errors expr_holes ; let tidy_env = tidyFreeTyCoVars env0 free_tvs free_tvs = tyCoVarsOfWCList wanted - ; traceTc "reportUnsolved (after zonking and tidying):" $ - vcat [ pprTyVars free_tvs - , ppr wanted ] + ; traceTc "reportUnsolved (after zonking):" $ + vcat [ text "Free tyvars:" <+> pprTyVars free_tvs + , text "Wanted:" <+> ppr wanted ] ; warn_redundant <- woptM Opt_WarnRedundantConstraints ; let err_ctxt = CEC { cec_encl = [] @@ -335,8 +335,8 @@ reportImplic ctxt implic@(Implic { ic_skols = tvs, ic_given = given -- certainly be un-satisfied constraints | otherwise - = do { reportWanteds ctxt' tc_lvl wanted - ; traceTc "reportImplic" (ppr implic) + = do { traceTc "reportImplic" (ppr implic') + ; reportWanteds ctxt' tc_lvl wanted ; when (cec_warn_redundant ctxt) $ warnRedundantConstraints ctxt' tcl_env info' dead_givens } where From git at git.haskell.org Sun Feb 26 18:06:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 18:06:12 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline4: Add -fspec-constr-keen (f8a2547) Message-ID: <20170226180612.CDBB03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline4 Link : http://ghc.haskell.org/trac/ghc/changeset/f8a2547c8769bd04c3b7f06ec76514a86a1c24ff/ghc >--------------------------------------------------------------- commit f8a2547c8769bd04c3b7f06ec76514a86a1c24ff Author: Simon Peyton Jones Date: Tue Feb 14 13:08:00 2017 +0000 Add -fspec-constr-keen I dicovered that the dramatic imprvoement in perf/should_run/T9339 with the introduction of join points was really rather a fluke, and very fragile. The real problem (see Note [Making SpecConstr keener]) is that SpecConstr wasn't specialising a function even though it was applied to a freshly-allocated constructor. The paper describes plausible reasons for this, but I think it may well be better to be a bit more aggressive. So this patch add -fspec-constr-keen, which makes SpecConstr a bit keener to specialise, by ignoring whether or not the argument corresponding to a call pattern is scrutinised in the function body. Now the gains in T9339 should be robust; and it might even be a better default. I'd be interested in what happens if we switched on -fspec-constr-keen with -O2. >--------------------------------------------------------------- f8a2547c8769bd04c3b7f06ec76514a86a1c24ff compiler/main/DynFlags.hs | 2 ++ compiler/specialise/SpecConstr.hs | 57 +++++++++++++++++++++++++++++---- docs/users_guide/using-optimisation.rst | 12 ++++++- testsuite/tests/perf/should_run/all.T | 4 ++- 4 files changed, 66 insertions(+), 9 deletions(-) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index d3d0ac3..442bbb9 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -432,6 +432,7 @@ data GeneralFlag | Opt_StgCSE | Opt_LiberateCase | Opt_SpecConstr + | Opt_SpecConstrKeen | Opt_DoLambdaEtaExpansion | Opt_IgnoreAsserts | Opt_DoEtaReduction @@ -3684,6 +3685,7 @@ fFlagsDeps = [ (useInstead "enable-rewrite-rules"), flagSpec "shared-implib" Opt_SharedImplib, flagSpec "spec-constr" Opt_SpecConstr, + flagSpec "spec-constr-keen" Opt_SpecConstrKeen, flagSpec "specialise" Opt_Specialise, flagSpec "specialize" Opt_Specialise, flagSpec "specialise-aggressively" Opt_SpecialiseAggressively, diff --git a/compiler/specialise/SpecConstr.hs b/compiler/specialise/SpecConstr.hs index 8a3e227..a68955e 100644 --- a/compiler/specialise/SpecConstr.hs +++ b/compiler/specialise/SpecConstr.hs @@ -41,7 +41,8 @@ import VarEnv import VarSet import Name import BasicTypes -import DynFlags ( DynFlags(..), hasPprDebug ) +import DynFlags ( DynFlags(..), GeneralFlag( Opt_SpecConstrKeen ) + , gopt, hasPprDebug ) import Maybes ( orElse, catMaybes, isJust, isNothing ) import Demand import GHC.Serialized ( deserializeWithData ) @@ -447,7 +448,6 @@ breaks an invariant. Note [Forcing specialisation] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - With stream fusion and in other similar cases, we want to fully specialise some (but not necessarily all!) loops regardless of their size and the number of specialisations. @@ -754,6 +754,39 @@ into a work-free value again, thus a'_shr = (a1, x_af7) but that's more work, so until its shown to be important I'm going to leave it for now. + +Note [Making SpecConstr keener] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Consider this, in (perf/should_run/T9339) + last (filter odd [1..1000]) + +After optimisation, including SpecConstr, we get: + f :: Int# -> Int -> Int + f x y = case case remInt# x 2# of + __DEFAULT -> case x of + __DEFAULT -> f (+# wild_Xp 1#) (I# x) + 1000000# -> ... + 0# -> case x of + __DEFAULT -> f (+# wild_Xp 1#) y + 1000000# -> y + +Not good! We build an (I# x) box every time around the loop. +SpecConstr (as described in the paper) does not specialise f, despite +the call (f ... (I# x)) because 'y' is not scrutinied in the body. +But it is much better to specialise f for the case where the argument +is of form (I# x); then we build the box only when returning y, which +is on the cold path. + +Another exmaple: + + f x = ...(g x).... + +Here 'x' is not scrutinised in f's body; but if we did specialise 'f' +then the call (g x) might allow 'g' to be specialised in turn. + +So sc_keen controls whether or not we take account of whether argument is +scrutinised in the body. True <=> ignore that, and speicalise whenever +the function is applied to a data constructor. -} data ScEnv = SCE { sc_dflags :: DynFlags, @@ -765,6 +798,11 @@ data ScEnv = SCE { sc_dflags :: DynFlags, sc_recursive :: Int, -- Max # of specialisations over recursive type. -- Stops ForceSpecConstr from diverging. + sc_keen :: Bool, -- Specialise on arguments that are known + -- constructorss, even if they are not + -- scrutinised in the body. See + -- Note [Making SpecConstr keener] + sc_force :: Bool, -- Force specialisation? -- See Note [Forcing specialisation] @@ -807,6 +845,7 @@ initScEnv dflags this_mod anns sc_size = specConstrThreshold dflags, sc_count = specConstrCount dflags, sc_recursive = specConstrRecursive dflags, + sc_keen = gopt Opt_SpecConstrKeen dflags, sc_force = False, sc_subst = emptySubst, sc_how_bound = emptyVarEnv, @@ -1976,11 +2015,12 @@ argToPat env in_scope val_env arg arg_occ mkConApp dc (ty_args ++ args')) } where mb_scrut dc = case arg_occ of - ScrutOcc bs - | Just occs <- lookupUFM bs dc - -> Just (occs) -- See Note [Reboxing] - _other | sc_force env -> Just (repeat UnkOcc) - | otherwise -> Nothing + ScrutOcc bs | Just occs <- lookupUFM bs dc + -> Just (occs) -- See Note [Reboxing] + _other | sc_force env || sc_keen env + -> Just (repeat UnkOcc) + | otherwise + -> Nothing -- Check if the argument is a variable that -- (a) is used in an interesting way in the function body @@ -1989,6 +2029,9 @@ argToPat env in_scope val_env arg arg_occ argToPat env in_scope val_env (Var v) arg_occ | sc_force env || case arg_occ of { UnkOcc -> False; _other -> True }, -- (a) is_value, -- (b) + -- Ignoring sc_keen here to avoid gratuitously incurring Note [Reboxing] + -- So sc_keen focused just on f (I# x), where we have freshly-allocated + -- box that we can eliminate in the caller not (ignoreType env (varType v)) = return (True, Var v) where diff --git a/docs/users_guide/using-optimisation.rst b/docs/users_guide/using-optimisation.rst index 9436832..e56c473 100644 --- a/docs/users_guide/using-optimisation.rst +++ b/docs/users_guide/using-optimisation.rst @@ -522,7 +522,7 @@ list. Turn on call-pattern specialisation; see `Call-pattern specialisation for Haskell programs - `__. + `__. This optimisation specializes recursive functions according to their argument "shapes". This is best explained by example so consider: :: @@ -580,6 +580,16 @@ list. body directly, allowing heavy specialisation over the recursive cases. +.. ghc-flag:: -fspec-constr-keen + + :default: off + + If this flag is on, call-patten specialision will specialise a call + ``(f (Just x))`` with an explicit constructor agument, even if the argument + is not scrutinised in the body of the function. This is sometimes + beneficial; e.g. the argument might be given to some other function + that can itself be specialised. + .. ghc-flag:: -fspec-constr-count= :default: 3 diff --git a/testsuite/tests/perf/should_run/all.T b/testsuite/tests/perf/should_run/all.T index 6670f34..172d648 100644 --- a/testsuite/tests/perf/should_run/all.T +++ b/testsuite/tests/perf/should_run/all.T @@ -461,7 +461,9 @@ test('T9339', # 2016-08-17: 50728 Join points (#12988) only_ways(['normal'])], compile_and_run, - ['-O2']) + ['-O2 -fspec-constr-keen']) + # For the -fspec-constr-keen see Note [Making SpecConstr keener] in SpecConstr + test('T8472', [stats_num_field('bytes allocated', From git at git.haskell.org Sun Feb 26 18:06:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 18:06:18 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline4: Improve pretty-printing of types (03068bc) Message-ID: <20170226180618.56E873A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline4 Link : http://ghc.haskell.org/trac/ghc/changeset/03068bc6b8783261ffbb4e66643c9d9c70bba23f/ghc >--------------------------------------------------------------- commit 03068bc6b8783261ffbb4e66643c9d9c70bba23f Author: Simon Peyton Jones Date: Fri Feb 17 12:30:35 2017 +0000 Improve pretty-printing of types When doing debug-printing it's really important that the free vars of a type are printed with their uniques. The IfaceTcTyVar thing was a stab in that direction, but it only worked for TcTyVars, not TyVars. This patch does it properly, by keeping track of the free vars of the type when translating Type -> IfaceType, and passing that down through toIfaceTypeX. Then when we find a variable, look in that set, and translate it to IfaceFreeTyVar if so. (I renamed IfaceTcTyVar to IfaceFreeTyVar.) Fiddly but not difficult. >--------------------------------------------------------------- 03068bc6b8783261ffbb4e66643c9d9c70bba23f compiler/backpack/RnModIface.hs | 4 +- compiler/iface/IfaceSyn.hs | 2 +- compiler/iface/IfaceType.hs | 38 +++--- compiler/iface/TcIface.hs | 2 +- compiler/iface/ToIface.hs | 147 ++++++++++++--------- compiler/iface/ToIface.hs-boot | 2 + compiler/typecheck/TcRnTypes.hs | 5 +- compiler/types/TyCoRep.hs | 37 +++--- compiler/types/Type.hs | 2 +- compiler/types/Type.hs-boot | 2 +- testsuite/tests/deriving/should_fail/T7148.stderr | 8 +- testsuite/tests/th/T8761.stderr | 57 ++++---- .../tests/typecheck/should_fail/T12785b.stderr | 15 +-- 13 files changed, 175 insertions(+), 146 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 03068bc6b8783261ffbb4e66643c9d9c70bba23f From git at git.haskell.org Sun Feb 26 18:06:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 18:06:21 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline4: Make Specialise work with casts (a25944c) Message-ID: <20170226180621.1C0F43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline4 Link : http://ghc.haskell.org/trac/ghc/changeset/a25944cfd5649e7a9399b0fd29a7a4a6f19e6074/ghc >--------------------------------------------------------------- commit a25944cfd5649e7a9399b0fd29a7a4a6f19e6074 Author: Simon Peyton Jones Date: Tue Feb 14 13:47:13 2017 +0000 Make Specialise work with casts With my upcoming early-inlining patch it turned out that Specialise was getting stuck on casts. This patch fixes it; see Specialise [Account for casts in binding]. >--------------------------------------------------------------- a25944cfd5649e7a9399b0fd29a7a4a6f19e6074 compiler/coreSyn/CoreSubst.hs | 54 ++++++++++++++++++++++++++++++++++++--- compiler/specialise/Specialise.hs | 35 ++++++++++++++++++------- compiler/types/Coercion.hs | 46 +++++++++++++++++++++++++++++---- compiler/types/Unify.hs | 2 +- 4 files changed, 118 insertions(+), 19 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 a25944cfd5649e7a9399b0fd29a7a4a6f19e6074 From git at git.haskell.org Sun Feb 26 18:06:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 18:06:23 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline4: Move isJoinId, isJoinId_maybe to Id (bf3aab7) Message-ID: <20170226180623.C88903A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline4 Link : http://ghc.haskell.org/trac/ghc/changeset/bf3aab760edb06ebd4d7e8d2ac02fd14c4fa27e8/ghc >--------------------------------------------------------------- commit bf3aab760edb06ebd4d7e8d2ac02fd14c4fa27e8 Author: Simon Peyton Jones Date: Fri Feb 24 16:39:19 2017 +0000 Move isJoinId, isJoinId_maybe to Id Summary: This is just a refactoring, moving these two functions where they belong. The reason they were there was becuase of the use of isJoinId_maybe in the OutputableBndr instance of TaggedBndr, which was in CoreSyn. I moved it to PprCore, to join the OutputableBndr instance for Var. That makes more sense anyway. Reviewers: austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3207 >--------------------------------------------------------------- bf3aab760edb06ebd4d7e8d2ac02fd14c4fa27e8 compiler/basicTypes/Id.hs | 23 ++++++++++++++++++++--- compiler/basicTypes/IdInfo.hs-boot | 2 -- compiler/basicTypes/Var.hs | 12 ------------ compiler/coreSyn/CoreSyn.hs | 9 --------- compiler/coreSyn/PprCore.hs | 8 ++++++++ compiler/simplCore/CSE.hs | 5 +++-- compiler/simplCore/FloatIn.hs | 2 +- 7 files changed, 32 insertions(+), 29 deletions(-) diff --git a/compiler/basicTypes/Id.hs b/compiler/basicTypes/Id.hs index 69c2cc3..3934ae7 100644 --- a/compiler/basicTypes/Id.hs +++ b/compiler/basicTypes/Id.hs @@ -5,7 +5,7 @@ \section[Id]{@Ids@: Value and constructor identifiers} -} -{-# LANGUAGE CPP #-} +{-# LANGUAGE ImplicitParams, CPP #-} -- | -- #name_types# @@ -127,8 +127,7 @@ import Var( Id, CoVar, DictId, JoinId, InId, InVar, OutId, OutVar, idInfo, idDetails, setIdDetails, globaliseId, varType, - isId, isLocalId, isGlobalId, isExportedId, - isJoinId, isJoinId_maybe ) + isId, isLocalId, isGlobalId, isExportedId ) import qualified Var import Type @@ -478,6 +477,24 @@ isDataConId_maybe id = case Var.idDetails id of DataConWrapId con -> Just con _ -> Nothing +isJoinId :: Var -> Bool +-- It is convenient in SetLevels.lvlMFE to apply isJoinId +-- to the free vars of an expression, so it's convenient +-- if it returns False for type variables +isJoinId id + | isId id = case Var.idDetails id of + JoinId {} -> True + _ -> False + | otherwise = False + +isJoinId_maybe :: Var -> Maybe JoinArity +isJoinId_maybe id + | isId id = ASSERT2( isId id, ppr id ) + case Var.idDetails id of + JoinId arity -> Just arity + _ -> Nothing + | otherwise = Nothing + idDataCon :: Id -> DataCon -- ^ Get from either the worker or the wrapper 'Id' to the 'DataCon'. Currently used only in the desugarer. -- diff --git a/compiler/basicTypes/IdInfo.hs-boot b/compiler/basicTypes/IdInfo.hs-boot index 27c1217..0fabad3 100644 --- a/compiler/basicTypes/IdInfo.hs-boot +++ b/compiler/basicTypes/IdInfo.hs-boot @@ -1,5 +1,4 @@ module IdInfo where -import BasicTypes import Outputable data IdInfo data IdDetails @@ -7,6 +6,5 @@ data IdDetails vanillaIdInfo :: IdInfo coVarDetails :: IdDetails isCoVarDetails :: IdDetails -> Bool -isJoinIdDetails_maybe :: IdDetails -> Maybe JoinArity pprIdDetails :: IdDetails -> SDoc diff --git a/compiler/basicTypes/Var.hs b/compiler/basicTypes/Var.hs index 2b728af..2bdd5f0 100644 --- a/compiler/basicTypes/Var.hs +++ b/compiler/basicTypes/Var.hs @@ -57,7 +57,6 @@ module Var ( -- ** Predicates isId, isTyVar, isTcTyVar, isLocalVar, isLocalId, isCoVar, isNonCoVarId, isTyCoVar, - isJoinId, isJoinId_maybe, isGlobalId, isExportedId, mustHaveLocalBinding, @@ -85,10 +84,8 @@ module Var ( import {-# SOURCE #-} TyCoRep( Type, Kind, pprKind ) import {-# SOURCE #-} TcType( TcTyVarDetails, pprTcTyVarDetails, vanillaSkolemTv ) import {-# SOURCE #-} IdInfo( IdDetails, IdInfo, coVarDetails, isCoVarDetails, - isJoinIdDetails_maybe, vanillaIdInfo, pprIdDetails ) -import BasicTypes ( JoinArity ) import Name hiding (varName) import Unique ( Uniquable, Unique, getKey, getUnique , mkUniqueGrimily, nonDetCmpUnique ) @@ -96,7 +93,6 @@ import Util import Binary import DynFlags import Outputable -import Maybes import Data.Data @@ -618,14 +614,6 @@ isNonCoVarId :: Var -> Bool isNonCoVarId (Id { id_details = details }) = not (isCoVarDetails details) isNonCoVarId _ = False -isJoinId :: Var -> Bool -isJoinId (Id { id_details = details }) = isJust (isJoinIdDetails_maybe details) -isJoinId _ = False - -isJoinId_maybe :: Var -> Maybe JoinArity -isJoinId_maybe (Id { id_details = details }) = isJoinIdDetails_maybe details -isJoinId_maybe _ = Nothing - isLocalId :: Var -> Bool isLocalId (Id { idScope = LocalId _ }) = True isLocalId _ = False diff --git a/compiler/coreSyn/CoreSyn.hs b/compiler/coreSyn/CoreSyn.hs index b781863..2616e6f 100644 --- a/compiler/coreSyn/CoreSyn.hs +++ b/compiler/coreSyn/CoreSyn.hs @@ -1717,15 +1717,6 @@ type TaggedAlt t = Alt (TaggedBndr t) instance Outputable b => Outputable (TaggedBndr b) where ppr (TB b l) = char '<' <> ppr b <> comma <> ppr l <> char '>' --- OutputableBndr Var is declared separately in PprCore; using a FlexibleContext --- to avoid circularity -instance (OutputableBndr Var, Outputable b) => - OutputableBndr (TaggedBndr b) where - pprBndr _ b = ppr b -- Simple - pprInfixOcc b = ppr b - pprPrefixOcc b = ppr b - bndrIsJoin_maybe (TB b _) = isJoinId_maybe b - deTagExpr :: TaggedExpr t -> CoreExpr deTagExpr (Var v) = Var v deTagExpr (Lit l) = Lit l diff --git a/compiler/coreSyn/PprCore.hs b/compiler/coreSyn/PprCore.hs index 30de5d2..ddece8d 100644 --- a/compiler/coreSyn/PprCore.hs +++ b/compiler/coreSyn/PprCore.hs @@ -338,12 +338,20 @@ Furthermore, a dead case-binder is completely ignored, while otherwise, dead binders are printed as "_". -} +-- THese instances are sadly orphans + instance OutputableBndr Var where pprBndr = pprCoreBinder pprInfixOcc = pprInfixName . varName pprPrefixOcc = pprPrefixName . varName bndrIsJoin_maybe = isJoinId_maybe +instance Outputable b => OutputableBndr (TaggedBndr b) where + pprBndr _ b = ppr b -- Simple + pprInfixOcc b = ppr b + pprPrefixOcc b = ppr b + bndrIsJoin_maybe (TB b _) = isJoinId_maybe b + pprCoreBinder :: BindingSite -> Var -> SDoc pprCoreBinder LetBind binder | isTyVar binder = pprKindedTyVarBndr binder diff --git a/compiler/simplCore/CSE.hs b/compiler/simplCore/CSE.hs index e850780..97a933e 100644 --- a/compiler/simplCore/CSE.hs +++ b/compiler/simplCore/CSE.hs @@ -11,10 +11,11 @@ module CSE (cseProgram, cseOneExpr) where #include "HsVersions.h" import CoreSubst -import Var ( Var, isJoinId ) +import Var ( Var ) import VarEnv ( elemInScopeSet ) import Id ( Id, idType, idInlineActivation, isDeadBinder - , zapIdOccInfo, zapIdUsageInfo, idInlinePragma ) + , zapIdOccInfo, zapIdUsageInfo, idInlinePragma + , isJoinId ) import CoreUtils ( mkAltExpr, eqExpr , exprIsLiteralString , stripTicksE, stripTicksT, mkTicks ) diff --git a/compiler/simplCore/FloatIn.hs b/compiler/simplCore/FloatIn.hs index cabdc3b..4d5a564 100644 --- a/compiler/simplCore/FloatIn.hs +++ b/compiler/simplCore/FloatIn.hs @@ -25,7 +25,7 @@ import CoreUtils ( exprIsDupable, exprIsExpandable, exprOkForSideEffects, mkTicks ) import CoreFVs import CoreMonad ( CoreM ) -import Id ( isOneShotBndr, idType ) +import Id ( isOneShotBndr, idType, isJoinId, isJoinId_maybe ) import Var import Type ( isUnliftedType ) import VarSet From git at git.haskell.org Sun Feb 26 18:06:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 18:06:26 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline4: Refactor floating of bindings (fiBind) (5c7068e) Message-ID: <20170226180626.8A8603A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline4 Link : http://ghc.haskell.org/trac/ghc/changeset/5c7068eddacd8ba8e6e461c89215084b93131702/ghc >--------------------------------------------------------------- commit 5c7068eddacd8ba8e6e461c89215084b93131702 Author: Simon Peyton Jones Date: Tue Feb 14 12:18:38 2017 +0000 Refactor floating of bindings (fiBind) This is just a local refactoring. I originally planned to try floating top-level bindings inwards, but I backed off from that leaving only this (harmless) refactoring, which has no behavioural effect. I also make FloatIn into a ModGuts -> ModGuts function; again not necessary now, but no harm either. My attempt also used the new function CoreFVs.freeVarsBind; but that too is a plausible refactorig of freeVars, so I left it in too. >--------------------------------------------------------------- 5c7068eddacd8ba8e6e461c89215084b93131702 compiler/coreSyn/CoreFVs.hs | 57 +++++------ compiler/simplCore/FloatIn.hs | 173 ++++++++++++++++++--------------- compiler/simplCore/SimplCore.hs | 2 +- testsuite/tests/perf/space_leaks/all.T | 5 +- 4 files changed, 129 insertions(+), 108 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 5c7068eddacd8ba8e6e461c89215084b93131702 From git at git.haskell.org Sun Feb 26 18:06:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 18:06:29 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline4: Small changes to expression sizing in CoreUnfold (8543c49) Message-ID: <20170226180629.42C183A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline4 Link : http://ghc.haskell.org/trac/ghc/changeset/8543c4934326bab5e8782cf65f34a087f6ec5b38/ghc >--------------------------------------------------------------- commit 8543c4934326bab5e8782cf65f34a087f6ec5b38 Author: Simon Peyton Jones Date: Tue Feb 14 14:15:01 2017 +0000 Small changes to expression sizing in CoreUnfold The only significant change here is that case e of {} should be treated like 'e', rather than like a case expression. We don't push a return address, for example, since 'e' is sure to diverge. I forget why I did this; but it will make these empty-case expressions (which are only there to satisfy the type checker) cost-free. >--------------------------------------------------------------- 8543c4934326bab5e8782cf65f34a087f6ec5b38 compiler/coreSyn/CoreUnfold.hs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/compiler/coreSyn/CoreUnfold.hs b/compiler/coreSyn/CoreUnfold.hs index bae6330..5844eb9 100644 --- a/compiler/coreSyn/CoreUnfold.hs +++ b/compiler/coreSyn/CoreUnfold.hs @@ -534,6 +534,11 @@ sizeExpr dflags bOMB_OUT_SIZE top_args expr pairs size_up (Case e _ _ alts) + | null alts + = size_up e -- case e of {} never returns, so take size of scrutinee + + size_up (Case e _ _ alts) + -- Now alts is non-empty | Just v <- is_top_arg e -- We are scrutinising an argument variable = let alt_sizes = map size_up_alt alts @@ -558,8 +563,8 @@ sizeExpr dflags bOMB_OUT_SIZE top_args expr alts_size tot_size _ = tot_size in - alts_size (foldr addAltSize sizeZero alt_sizes) - (foldr maxSize sizeZero alt_sizes) + alts_size (foldr1 addAltSize alt_sizes) -- alts is non-empty + (foldr1 maxSize alt_sizes) -- Good to inline if an arg is scrutinised, because -- that may eliminate allocation in the caller -- And it eliminates the case itself @@ -763,6 +768,7 @@ funSize dflags top_args fun n_val_args voids res_discount | idArity fun > n_val_args = ufFunAppDiscount dflags | otherwise = 0 -- If the function is partially applied, show a result discount +-- XXX maybe behave like ConSize for eval'd varaible conSize :: DataCon -> Int -> ExprSize conSize dc n_val_args @@ -774,6 +780,8 @@ conSize dc n_val_args -- See Note [Constructor size and result discount] | otherwise = SizeIs 10 emptyBag (10 * (1 + n_val_args)) +-- XXX still looks to large to me + {- Note [Constructor size and result discount] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From git at git.haskell.org Sun Feb 26 18:06:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 18:06:31 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline4: Fix SetLevels for makeStaticPtr (d26cfd0) Message-ID: <20170226180631.EB7383A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline4 Link : http://ghc.haskell.org/trac/ghc/changeset/d26cfd09cf2b9f533e222ca9124996420a89e4b1/ghc >--------------------------------------------------------------- commit d26cfd09cf2b9f533e222ca9124996420a89e4b1 Author: Simon Peyton Jones Date: Tue Feb 14 14:13:16 2017 +0000 Fix SetLevels for makeStaticPtr This too is prepartory for my early-inlining patch. It turned out that early inlining exposed a bug in the way that static pointers were being floated. >--------------------------------------------------------------- d26cfd09cf2b9f533e222ca9124996420a89e4b1 compiler/simplCore/SetLevels.hs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/compiler/simplCore/SetLevels.hs b/compiler/simplCore/SetLevels.hs index 22d4048..7b17c8d 100644 --- a/compiler/simplCore/SetLevels.hs +++ b/compiler/simplCore/SetLevels.hs @@ -566,12 +566,12 @@ lvlMFE env strict_ctxt ann_expr -- or if we are wrapping it in one or more value lambdas = do { expr1 <- lvlFloatRhs abs_vars dest_lvl rhs_env NonRecursive join_arity_maybe ann_expr -- Treat the expr just like a right-hand side - ; var <- newLvlVar expr1 join_arity_maybe + ; var <- newLvlVar expr1 join_arity_maybe is_mk_static ; let var2 = annotateBotStr var float_n_lams mb_bot_str ; return (Let (NonRec (TB var2 (FloatMe dest_lvl)) expr1) (mkVarApps (Var var2) abs_vars)) } - -- OK, so the float has an unlifted type + -- OK, so the float has an unlifted type (not top-level bindable) -- and no new value lambdas (float_is_new_lam is False) -- Try for the boxing strategy -- See Note [Floating MFEs of unlifted type] @@ -588,7 +588,7 @@ lvlMFE env strict_ctxt ann_expr Case expr1 (stayPut l1r ubx_bndr) dc_res_ty [(DEFAULT, [], mkConApp dc [Var ubx_bndr])] - ; var <- newLvlVar float_rhs Nothing + ; var <- newLvlVar float_rhs Nothing is_mk_static ; let l1u = incMinorLvlFrom env use_expr = Case (mkVarApps (Var var) abs_vars) (stayPut l1u bx_bndr) expr_ty @@ -626,9 +626,12 @@ lvlMFE env strict_ctxt ann_expr join_arity_maybe | need_join = Just (length abs_vars) | otherwise = Nothing + is_mk_static = isJust (collectMakeStaticArgs expr) + -- Yuk: See Note [Grand plan for static forms] in main/StaticPtrTable + -- A decision to float entails let-binding this thing, and we only do -- that if we'll escape a value lambda, or will go to the top level. - float_me = saves_work || saves_alloc + float_me = saves_work || saves_alloc || is_mk_static -- We can save work if we can move a redex outside a value lambda -- But if float_is_new_lam is True, then the redex is wrapped in a @@ -1499,8 +1502,9 @@ newPolyBndrs dest_lvl newLvlVar :: LevelledExpr -- The RHS of the new binding -> Maybe JoinArity -- Its join arity, if it is a join point + -> Bool -- True <=> the RHS looks like (makeStatic ...) -> LvlM Id -newLvlVar lvld_rhs join_arity_maybe +newLvlVar lvld_rhs join_arity_maybe is_mk_static = do { uniq <- getUniqueM ; return (add_join_info (mk_id uniq rhs_ty)) } @@ -1511,8 +1515,7 @@ newLvlVar lvld_rhs join_arity_maybe mk_id uniq rhs_ty -- See Note [Grand plan for static forms] in StaticPtrTable. - | isJust $ collectMakeStaticArgs $ snd $ - collectTyBinders de_tagged_rhs + | is_mk_static = mkExportedVanillaId (mkSystemVarName uniq (mkFastString "static_ptr")) rhs_ty | otherwise From git at git.haskell.org Sun Feb 26 18:06:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 18:06:34 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline4: Tidy up Coercion.mkRuntimeRepCo (56cb725) Message-ID: <20170226180634.A47283A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline4 Link : http://ghc.haskell.org/trac/ghc/changeset/56cb7251ef261a5b5a445d062fb9969a0ab49b4a/ghc >--------------------------------------------------------------- commit 56cb7251ef261a5b5a445d062fb9969a0ab49b4a Author: Simon Peyton Jones Date: Fri Feb 24 16:54:34 2017 +0000 Tidy up Coercion.mkRuntimeRepCo Summary: It was hard to understand, and inefficient in the common case. Better now. Reviewers: austin, goldfire, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3208 >--------------------------------------------------------------- 56cb7251ef261a5b5a445d062fb9969a0ab49b4a compiler/prelude/TysWiredIn.hs-boot | 1 + compiler/types/Coercion.hs | 47 +++++++++++++++++++++---------------- 2 files changed, 28 insertions(+), 20 deletions(-) diff --git a/compiler/prelude/TysWiredIn.hs-boot b/compiler/prelude/TysWiredIn.hs-boot index 26e4201..c740690 100644 --- a/compiler/prelude/TysWiredIn.hs-boot +++ b/compiler/prelude/TysWiredIn.hs-boot @@ -17,6 +17,7 @@ constraintKind :: Kind runtimeRepTyCon, vecCountTyCon, vecElemTyCon :: TyCon runtimeRepTy :: Type +liftedRepTy :: Type liftedRepDataConTyCon, vecRepDataConTyCon, tupleRepDataConTyCon :: TyCon diff --git a/compiler/types/Coercion.hs b/compiler/types/Coercion.hs index 353134d..f53968e 100644 --- a/compiler/types/Coercion.hs +++ b/compiler/types/Coercion.hs @@ -123,7 +123,7 @@ import Pair import SrcLoc import PrelNames import TysPrim ( eqPhantPrimTyCon ) -import {-# SOURCE #-} TysWiredIn ( constraintKind ) +import {-# SOURCE #-} TysWiredIn ( liftedRepTy, constraintKind ) import ListSetOps import Maybes import UniqFM @@ -427,42 +427,49 @@ mkHeteroCoercionType Representational = mkHeteroReprPrimEqPred mkHeteroCoercionType Phantom = panic "mkHeteroCoercionType" constraintIsLifted :: CoAxiomRule -constraintIsLifted = - CoAxiomRule { coaxrName = mkFastString "constraintIsLifted" +-- constratintIsLifted :: Type ~N Constraint +constraintIsLifted + = CoAxiomRule { coaxrName = mkFastString "constraintIsLifted" , coaxrAsmpRoles = [] - , coaxrRole = Nominal - , coaxrProves = - const $ Just $ Pair constraintKind liftedTypeKind + , coaxrRole = Nominal + , coaxrProves = const $ Just $ + Pair constraintKind liftedTypeKind } --- | Given a coercion @co1 :: (a :: TYPE r1) ~ (b :: TYPE r2)@, --- produce a coercion @rep_co :: r1 ~ r2 at . +-- | Given a coercion @co :: (a :: TYPE r1) ~ (b :: TYPE r2)@, +-- produce a coercion @rep_co :: r1 ~N r2 at . +-- +-- HACK for Constraint (which is currently a different kind than TYPE r): +-- treat Constraint like TYPE LiftedRep, so +-- if co :: (a :: Constraint) ~ (b :: TYPE r2) +-- return rep_co :: LiftedRep ~ r2 mkRuntimeRepCo :: Coercion -> Coercion mkRuntimeRepCo co -- This is currently a bit tricky since we can see types of kind Constraint -- in addition to the usual things of kind (TYPE rep). We first map -- Constraint-kinded types to (TYPE 'LiftedRep). -- FIXME: this is terrible - | isConstraintKind a && isConstraintKind b - = mkNthCo 0 $ constraintToLifted - $ mkSymCo $ constraintToLifted $ mkSymCo kind_co + | isReflCo kind_co -- kind_co :: or + = -- If a=b, things are easy + if isConstraintKind a + then mkNomReflCo liftedRepTy -- + else mkNomReflCo (tyConAppArgN 0 a) -- - | isConstraintKind a + | isConstraintKind a -- Presumably b = TYPE r2 = WARN( True, text "mkRuntimeRepCo" ) - mkNthCo 0 - $ mkSymCo $ constraintToLifted $ mkSymCo kind_co + mkNthCo 0 (mkSymCo cl_co `mkTransCo` kind_co) - | isConstraintKind b + | isConstraintKind b -- Presumably a = TYPE r1 = WARN( True, text "mkRuntimeRepCo" ) - mkNthCo 0 $ constraintToLifted kind_co + mkNthCo 0 (kind_co `mkTransCo` cl_co) - | otherwise + | otherwise -- a = TYPE r1, t = TYPE r2 = mkNthCo 0 kind_co where - -- the right side of a coercion from Constraint to TYPE 'LiftedRep - constraintToLifted = (`mkTransCo` mkAxiomRuleCo constraintIsLifted []) + -- cl_co :: Constraint ~ TYPE LiftedRep + cl_co = mkAxiomRuleCo constraintIsLifted [] - kind_co = mkKindCo co -- kind_co :: TYPE r1 ~ TYPE r2 + kind_co = mkKindCo co -- kind_co :: TYPE r1 ~N TYPE r2 -- (up to silliness with Constraint) Pair a b = coercionKind kind_co -- Pair of (TYPE r1, TYPE r2) From git at git.haskell.org Sun Feb 26 18:06:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 18:06:37 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline4: Occurrence-analyse the result of rule firings (73d4aa6) Message-ID: <20170226180637.6241A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline4 Link : http://ghc.haskell.org/trac/ghc/changeset/73d4aa6f991684aa0c4aa4a2b15aa930798d0340/ghc >--------------------------------------------------------------- commit 73d4aa6f991684aa0c4aa4a2b15aa930798d0340 Author: Simon Peyton Jones Date: Tue Feb 14 13:29:40 2017 +0000 Occurrence-analyse the result of rule firings When studying simplCore/should_compile/T7785 I found that a long chain of maps map f (map f (map f (map f (...)))) took an unreasonably long time to simplify. The problem got worse when I started inlining in the InitialPhase, which is how I stumbled on it. The solution turned out to be rather simple. It's described in Note [Occurence-analyse after rule firing] in Simplify.hs >--------------------------------------------------------------- 73d4aa6f991684aa0c4aa4a2b15aa930798d0340 compiler/simplCore/Simplify.hs | 68 +++++++++++++++++++++- compiler/specialise/Rules.hs | 9 +-- .../tests/simplCore/should_compile/T3234.stderr | 13 ++--- 3 files changed, 74 insertions(+), 16 deletions(-) diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index 4ef2994..1010bbc 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -15,6 +15,7 @@ import SimplMonad import Type hiding ( substTy, substTyVar, extendTvSubst, extendCvSubst ) import SimplEnv import SimplUtils +import OccurAnal ( occurAnalyseExpr ) import FamInstEnv ( FamInstEnv ) import Literal ( litIsLifted ) --, mkMachInt ) -- temporalily commented out. See #8326 import Id @@ -1809,9 +1810,13 @@ tryRules env rules fn args call_cont ; let cont' = pushSimplifiedArgs env (drop (ruleArity rule) args) call_cont - -- (ruleArity rule) says how many args the rule consumed + -- (ruleArity rule) says how + -- many args the rule consumed + + occ_anald_rhs = occurAnalyseExpr rule_rhs + -- See Note [Occurence-analyse after rule firing] ; dump dflags rule rule_rhs - ; return (Just (rule_rhs, cont')) }}} + ; return (Just (occ_anald_rhs, cont')) }}} where dump dflags rule rule_rhs | dopt Opt_D_dump_rule_rewrites dflags @@ -1842,7 +1847,64 @@ tryRules env rules fn args call_cont = liftIO . dumpSDoc dflags alwaysQualify flag "" $ sep [text hdr, nest 4 details] -{- +{- Note [Occurence-analyse after rule firing] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +After firing a rule, we occurrence-analyse the instantiated RHS before +simplifying it. Usually this doesn't make much difference, but it can +be huge. Here's an example (simplCore/should_compile/T7785) + + map f (map f (map f xs) + += -- Use build/fold form of map, twice + map f (build (\cn. foldr (mapFB c f) n + (build (\cn. foldr (mapFB c f) n xs)))) + += -- Apply fold/build rule + map f (build (\cn. (\cn. foldr (mapFB c f) n xs) (mapFB c f) n)) + += -- Beta-reduce + -- Alas we have no occurrence-analysed, so we don't know + -- that c is used exactly once + map f (build (\cn. let c1 = mapFB c f in + foldr (mapFB c1 f) n xs)) + += -- Use mapFB rule: mapFB (mapFB c f) g = mapFB c (f.g) + -- We can do this becuase (mapFB c n) is a PAP and hence expandable + map f (build (\cn. let c1 = mapFB c n in + foldr (mapFB c (f.f)) n x)) + +This is not too bad. But now do the same with the outer map, and +we get another use of mapFB, and t can interact with /both/ remaining +mapFB calls in the above expression. This is stupid because actually +that 'c1' binding is dead. The outer map introduces another c2. If +there is a deep stack of maps we get lots of dead bindings, and lots +of redundant work as we repeatedly simplify the result of firing rules. + +The easy thing to do is simply to occurrence analyse the result of +the rule firing. Not that this occ-anals not only the RHS of the +rule, but also the function arguments, which by now are OutExprs. +E.g. + RULE f (g x) = x+1 + +Call f (g BIG) --> (\x. x+1) BIG + +The rule binders are lambda-bound and applied to the OutExpr arguments +(here BIG) which lack all internal occurrence info. + +Is this inefficient? Not really: we are about to walk over the result +of the rule firing to simplify it, so occurrence analysis is at most +a constant factor. + +Possible improvement: occ-anal the rules when putting them in the +database; and in the simplifier just occ-anal the OutExpr arguments. +But that's more complicated and the rule RHS is usually tiny; so I'm +just doing the simple thing. + +Historical note: previously we did occ-anal the rules in Rule.hs, +but failed to occ-anal the OutExpr arguments, which led to the +nasty performance problem described above. + + Note [Optimising tagToEnum#] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If we have an enumeration data type: diff --git a/compiler/specialise/Rules.hs b/compiler/specialise/Rules.hs index ae0798a..2ad4e1c 100644 --- a/compiler/specialise/Rules.hs +++ b/compiler/specialise/Rules.hs @@ -31,7 +31,6 @@ module Rules ( import CoreSyn -- All of it import Module ( Module, ModuleSet, elemModuleSet ) import CoreSubst -import OccurAnal ( occurAnalyseExpr ) import CoreFVs ( exprFreeVars, exprsFreeVars, bindFreeVars , rulesFreeVarsDSet, exprsOrphNames, exprFreeVarsList ) import CoreUtils ( exprType, eqExpr, mkTick, mkTicks, @@ -172,7 +171,7 @@ mkRule :: Module -> Bool -> Bool -> RuleName -> Activation mkRule this_mod is_auto is_local name act fn bndrs args rhs = Rule { ru_name = name, ru_fn = fn, ru_act = act, ru_bndrs = bndrs, ru_args = args, - ru_rhs = occurAnalyseExpr rhs, + ru_rhs = rhs, ru_rough = roughTopNames args, ru_origin = this_mod, ru_orphan = orph, @@ -508,8 +507,7 @@ matchRule dflags rule_env _is_active fn args _rough_args -- Built-in rules can't be switched off, it seems = case match_fn dflags rule_env fn args of Nothing -> Nothing - Just expr -> Just (occurAnalyseExpr expr) - -- We could do this when putting things into the rulebase, I guess + Just expr -> Just expr matchRule _ in_scope is_active _ args rough_args (Rule { ru_name = rule_name, ru_act = act, ru_rough = tpl_tops @@ -522,8 +520,7 @@ matchRule _ in_scope is_active _ args rough_args Just (bind_wrapper, tpl_vals) -> Just (bind_wrapper $ rule_fn `mkApps` tpl_vals) where - rule_fn = occurAnalyseExpr (mkLams tpl_vars rhs) - -- We could do this when putting things into the rulebase, I guess + rule_fn = mkLams tpl_vars rhs --------------------------------------- matchN :: InScopeEnv diff --git a/testsuite/tests/simplCore/should_compile/T3234.stderr b/testsuite/tests/simplCore/should_compile/T3234.stderr index ad31846..e79bfbb 100644 --- a/testsuite/tests/simplCore/should_compile/T3234.stderr +++ b/testsuite/tests/simplCore/should_compile/T3234.stderr @@ -12,12 +12,15 @@ ==================== Grand total simplifier statistics ==================== Total ticks: 55 -15 PreInlineUnconditionally +18 PreInlineUnconditionally + 1 c 1 n 1 g 1 a 1 xs 1 ys + 1 c + 1 n 1 k 1 z 1 g @@ -28,11 +31,7 @@ Total ticks: 55 1 lvl 1 lvl 1 lvl -4 PostInlineUnconditionally - 1 c - 1 n - 1 c - 1 c +1 PostInlineUnconditionally 1 c 1 UnfoldingDone 1 GHC.Base.build 5 RuleFired 1 ++ @@ -67,6 +66,6 @@ Total ticks: 55 1 c 1 n 1 a -11 SimplifierDone 11 +10 SimplifierDone 10 From git at git.haskell.org Sun Feb 26 18:06:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 18:06:40 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline4: The Early Inline Patch (da9aaad) Message-ID: <20170226180640.3A7CA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline4 Link : http://ghc.haskell.org/trac/ghc/changeset/da9aaad9610c7e1dcd5cb624f87ced9b003ae569/ghc >--------------------------------------------------------------- commit da9aaad9610c7e1dcd5cb624f87ced9b003ae569 Author: Simon Peyton Jones Date: Tue Feb 14 15:08:24 2017 +0000 The Early Inline Patch This very small patch switches on sm_inline even in the InitialPhase (aka "gentle" phase). There is no reason not to... and the results are astonishing. I think the peformance of GHC itself improves by about 5%; and some programs get much smaller, quicker. Result: across the board irmprovements in compile time performance. Here are the changes in perf/compiler; the numbers are decreases in compiler bytes-allocated: 3% T5837 7% parsing001 9% T12234 35% T9020 9% T3064 13% T9961 20% T13056 5% T9872d 5% T9872c 5% T9872b 7% T9872a 5% T783 35% T12227 20% T1969 Plus in perf/should_run 5% lazy-bs-alloc It wasn't as easy as it sounds: I did a raft of preparatory work in earlier patches. But it's great! >--------------------------------------------------------------- da9aaad9610c7e1dcd5cb624f87ced9b003ae569 compiler/simplCore/SimplCore.hs | 38 +++++++- compiler/simplCore/SimplUtils.hs | 60 +++++------- .../tests/codeGen/should_compile/debug.stdout | 3 +- testsuite/tests/concurrent/should_run/T4030.stderr | 1 - testsuite/tests/deriving/perf/all.T | 3 +- .../indexed-types/should_compile/T7837.stderr | 3 +- testsuite/tests/perf/compiler/T4007.stdout | 8 +- testsuite/tests/perf/compiler/all.T | 65 +++++++++---- testsuite/tests/perf/haddock/all.T | 3 +- testsuite/tests/perf/should_run/all.T | 2 + testsuite/tests/simplCore/should_compile/Makefile | 11 ++- testsuite/tests/simplCore/should_compile/T10181.hs | 5 + .../tests/simplCore/should_compile/T3772.stdout | 88 +++++++++--------- .../tests/simplCore/should_compile/T4138.stdout | 2 +- testsuite/tests/simplCore/should_compile/T7785.hs | 14 ++- testsuite/tests/simplCore/should_compile/T8848.hs | 13 ++- .../tests/simplCore/should_compile/T8848.stderr | 101 --------------------- .../tests/simplCore/should_compile/T9509.stdout | 1 + testsuite/tests/simplCore/should_compile/T9509a.hs | 4 +- testsuite/tests/simplCore/should_compile/all.T | 6 +- .../tests/simplCore/should_compile/rule2.stderr | 13 +-- testsuite/tests/simplCore/should_run/T7611.hs | 1 + .../tests/simplCore/should_run/simplrun002.hs | 8 +- .../tests/simplCore/should_run/simplrun008.hs | 6 +- testsuite/tests/th/TH_Roles2.stderr | 4 +- 25 files changed, 219 insertions(+), 244 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 da9aaad9610c7e1dcd5cb624f87ced9b003ae569 From git at git.haskell.org Sun Feb 26 18:06:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 18:06:42 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline4: Stop uniques ending up in SPEC rule names (5cd8aab) Message-ID: <20170226180642.E67DA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline4 Link : http://ghc.haskell.org/trac/ghc/changeset/5cd8aabe7c0096b52147668a61610560001a564f/ghc >--------------------------------------------------------------- commit 5cd8aabe7c0096b52147668a61610560001a564f Author: Simon Peyton Jones Date: Tue Feb 14 13:33:36 2017 +0000 Stop uniques ending up in SPEC rule names >--------------------------------------------------------------- 5cd8aabe7c0096b52147668a61610560001a564f compiler/specialise/Specialise.hs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/compiler/specialise/Specialise.hs b/compiler/specialise/Specialise.hs index 0090417..3f937c2 100644 --- a/compiler/specialise/Specialise.hs +++ b/compiler/specialise/Specialise.hs @@ -1293,10 +1293,11 @@ specCalls mb_mod env rules_for_me calls_for_me fn rhs Just this_mod -- Specialising imoprted fn -> text "SPEC/" <> ppr this_mod - rule_name = mkFastString $ showSDocForUser dflags neverQualify $ - herald <+> ppr fn <+> hsep (map ppr_call_key_ty call_ts) - -- This name ends up in interface files, so use showSDocForUser, - -- otherwise uniques end up there, making builds + rule_name = mkFastString $ showSDoc dflags $ + herald <+> text (occNameString (getOccName fn)) + <+> hsep (map ppr_call_key_ty call_ts) + -- This name ends up in interface files, so use occNameString. + -- Otherwise uniques end up there, making builds -- less deterministic (See #4012 comment:61 ff) rule_wout_eta = mkRule From git at git.haskell.org Sun Feb 26 18:06:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 18:06:45 +0000 (UTC) Subject: [commit: ghc] wip/spj-early-inline4: Mark non-recursive join lambdas as one-shot (32e4feb) Message-ID: <20170226180645.A9F793A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-early-inline4 Link : http://ghc.haskell.org/trac/ghc/changeset/32e4febe700c2f3175b846739c1071f49b5fa1fe/ghc >--------------------------------------------------------------- commit 32e4febe700c2f3175b846739c1071f49b5fa1fe Author: Simon Peyton Jones Date: Tue Feb 21 15:07:47 2017 +0000 Mark non-recursive join lambdas as one-shot Summary: When we have join j x y = rhs in ... we know that the lambdas for 'x' and 'y' are one-shot. Let's mark them as such! This doesn't fix a specific bug, but it feels right to me. Reviewers: austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3196 >--------------------------------------------------------------- 32e4febe700c2f3175b846739c1071f49b5fa1fe compiler/simplCore/OccurAnal.hs | 68 +++++++++++++++++++++++++---------------- 1 file changed, 41 insertions(+), 27 deletions(-) diff --git a/compiler/simplCore/OccurAnal.hs b/compiler/simplCore/OccurAnal.hs index f2f7da6..949cbf1 100644 --- a/compiler/simplCore/OccurAnal.hs +++ b/compiler/simplCore/OccurAnal.hs @@ -732,7 +732,6 @@ add this analysis if necessary. ------------------------------------------------------------ Note [Adjusting for lambdas] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - There's a bit of a dance we need to do after analysing a lambda expression or a right-hand side. In particular, we need to @@ -802,28 +801,33 @@ occAnalNonRecBind env lvl imp_rule_edges binder rhs body_usage | otherwise -- It's mentioned in the body = (body_usage' +++ rhs_usage', [NonRec tagged_binder rhs']) where - (bndrs, body) = collectBinders rhs (body_usage', tagged_binder) = tagNonRecBinder lvl body_usage binder + mb_join_arity = willBeJoinId_maybe tagged_binder + + (bndrs, body) = collectBinders rhs + (rhs_usage1, bndrs', body') = occAnalNonRecRhs env tagged_binder bndrs body - rhs' = mkLams bndrs' body' + rhs' = mkLams (markJoinOneShots mb_join_arity bndrs') body' + -- For a /non-recursive/ join point we can mark all + -- its join-lambda as one-shot; and it's a good idea to do so + + -- Unfoldings + -- See Note [Unfoldings and join points] rhs_usage2 = case occAnalUnfolding env NonRecursive binder of Just unf_usage -> rhs_usage1 +++ unf_usage Nothing -> rhs_usage1 - -- See Note [Unfoldings and join points] - mb_join_arity = willBeJoinId_maybe tagged_binder + -- Rules + -- See Note [Rules are extra RHSs] and Note [Rule dependency info] rules_w_uds = occAnalRules env mb_join_arity NonRecursive tagged_binder - rhs_usage3 = rhs_usage2 +++ combineUsageDetailsList (map (\(_, l, r) -> l +++ r) rules_w_uds) - -- See Note [Rules are extra RHSs] and Note [Rule dependency info] - rhs_usage4 = maybe rhs_usage3 (addManyOccsSet rhs_usage3) $ lookupVarEnv imp_rule_edges binder -- See Note [Preventing loops due to imported functions rules] - rhs_usage' = adjustRhsUsage (willBeJoinId_maybe tagged_binder) NonRecursive - bndrs' rhs_usage4 + -- Final adjustment + rhs_usage' = adjustRhsUsage mb_join_arity NonRecursive bndrs' rhs_usage4 ----------------- occAnalRecBind :: OccEnv -> TopLevelFlag -> ImpRuleEdges -> [(Var,CoreExpr)] @@ -1550,7 +1554,6 @@ occAnalNonRecRhs env bndr bndrs body -- See Note [Sources of one-shot information] rhs_env = env1 { occ_one_shots = argOneShots dmd } - certainly_inline -- See Note [Cascading inlines] = case idOccInfo bndr of OneOcc { occ_in_lam = in_lam, occ_one_br = one_br } @@ -1731,7 +1734,8 @@ occAnal env app@(App _ _) -- (a) occurrences inside type lambdas only not marked as InsideLam -- (b) type variables not in environment -occAnal env (Lam x body) | isTyVar x +occAnal env (Lam x body) + | isTyVar x = case occAnal env body of { (body_usage, body') -> (markAllNonTailCalled body_usage, Lam x body') } @@ -1749,14 +1753,14 @@ occAnal env expr@(Lam _ _) = case occAnalLamOrRhs env binders body of { (usage, tagged_binders, body') -> let expr' = mkLams tagged_binders body' - final_usage | all isOneShotBndr tagged_binders - = markAllNonTailCalled usage - | otherwise - = markAllInsideLam $ markAllNonTailCalled usage + usage1 = markAllNonTailCalled usage + one_shot_gp = all isOneShotBndr tagged_binders + final_usage | one_shot_gp = usage1 + | otherwise = markAllInsideLam usage1 in (final_usage, expr') } where - (binders, body) = collectBinders expr + (binders, body) = collectBinders expr occAnal env (Case scrut bndr ty alts) = case occ_anal_scrut scrut alts of { (scrut_usage, scrut') -> @@ -2130,21 +2134,31 @@ oneShotGroup env@(OccEnv { occ_one_shots = ctxt }) bndrs = ( env { occ_one_shots = [], occ_encl = OccVanilla } , reverse rev_bndrs ++ bndrs ) - go ctxt (bndr:bndrs) rev_bndrs - | isId bndr - - = case ctxt of - [] -> go [] bndrs (bndr : rev_bndrs) - (one_shot : ctxt) -> go ctxt bndrs (bndr': rev_bndrs) - where - bndr' = updOneShotInfo bndr one_shot + go ctxt@(one_shot : ctxt') (bndr : bndrs) rev_bndrs + | isId bndr = go ctxt' bndrs (bndr': rev_bndrs) + | otherwise = go ctxt bndrs (bndr : rev_bndrs) + where + bndr' = updOneShotInfo bndr one_shot -- Use updOneShotInfo, not setOneShotInfo, as pre-existing -- one-shot info might be better than what we can infer, e.g. -- due to explicit use of the magic 'oneShot' function. -- See Note [The oneShot function] - | otherwise - = go ctxt bndrs (bndr:rev_bndrs) + +markJoinOneShots :: Maybe JoinArity -> [Var] -> [Var] +-- Mark the lambdas of a non-recursive join point as one-shot. +-- This is good to prevent gratuitous float-out etc +markJoinOneShots mb_join_arity bndrs + = case mb_join_arity of + Nothing -> bndrs + Just n -> go n bndrs + where + go 0 bndrs = bndrs + go _ [] = WARN( True, ppr mb_join_arity <+> ppr bndrs ) [] + go n (b:bs) = b' : go (n-1) bs + where + b' | isId b = setOneShotLambda b + | otherwise = b addAppCtxt :: OccEnv -> [Arg CoreBndr] -> OccEnv addAppCtxt env@(OccEnv { occ_one_shots = ctxt }) args From git at git.haskell.org Sun Feb 26 18:14:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 18:14:29 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Bump down T2762 number (d4b6dee) Message-ID: <20170226181429.39BA53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d4b6deee0edb1ef37d638aacc42c638b54bd9726/ghc >--------------------------------------------------------------- commit d4b6deee0edb1ef37d638aacc42c638b54bd9726 Author: Ben Gamari Date: Sun Feb 26 12:56:03 2017 -0500 testsuite: Bump down T2762 number Although I'm really not convinced that measuring peak_megabytes_allocated of this test is reasonable. >--------------------------------------------------------------- d4b6deee0edb1ef37d638aacc42c638b54bd9726 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 a9afd28..4a8937a 100644 --- a/testsuite/tests/perf/space_leaks/all.T +++ b/testsuite/tests/perf/space_leaks/all.T @@ -47,7 +47,8 @@ test('T2762', [# peak_megabytes_allocated is 2 with 7.0.2. # Was 57 with 6.12.3. # 2016-08-31: 3 (allocation area size bumped to 1MB) - stats_num_field('peak_megabytes_allocated', (3, 0)), + # 2017-02-26: 2 (it's not entirely clear) + stats_num_field('peak_megabytes_allocated', (2, 0)), only_ways(['normal']), extra_clean(['T2762A.hi', 'T2762A.o'])], compile_and_run, ['-O']) From git at git.haskell.org Sun Feb 26 19:56:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 19:56:43 +0000 (UTC) Subject: [commit: ghc] master: Add testcase for #13340 (517ad20) Message-ID: <20170226195643.03FAC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/517ad201ff6ca1ef0d78c22f31de747709fb7c99/ghc >--------------------------------------------------------------- commit 517ad201ff6ca1ef0d78c22f31de747709fb7c99 Author: Ben Gamari Date: Sun Feb 26 13:43:48 2017 -0500 Add testcase for #13340 Test Plan: Validate Reviewers: rwbarton, austin Reviewed By: rwbarton Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3215 >--------------------------------------------------------------- 517ad201ff6ca1ef0d78c22f31de747709fb7c99 testsuite/tests/simplCore/should_compile/Makefile | 6 ++++++ testsuite/tests/simplCore/should_compile/T13340.hs | 6 ++++++ .../bkprun02.stdout => simplCore/should_compile/T13340.stdout} | 0 testsuite/tests/simplCore/should_compile/all.T | 1 + 4 files changed, 13 insertions(+) diff --git a/testsuite/tests/simplCore/should_compile/Makefile b/testsuite/tests/simplCore/should_compile/Makefile index 7dd784b..1206ad6 100644 --- a/testsuite/tests/simplCore/should_compile/Makefile +++ b/testsuite/tests/simplCore/should_compile/Makefile @@ -195,3 +195,9 @@ T13025: str-rules: $(RM) -f str-rules.hi str-rules.o '$(TEST_HC)' $(TEST_HC_OPTS) -c -O str-rules.hs -ddump-simpl | grep -o '"@@@[^"].*"#' | sort + +# We expect there to be precisely one use of +# in the simplified Core as f and +# g should have been collapsed into one defininition by CSE. +.PHONY: T13340 +T13340: + '$(TEST_HC)' $(TEST_HC_OPTS) -c -O T13340.hs -ddump-simpl -dsuppress-all | grep '\+#' | wc -l diff --git a/testsuite/tests/simplCore/should_compile/T13340.hs b/testsuite/tests/simplCore/should_compile/T13340.hs new file mode 100644 index 0000000..813855b --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T13340.hs @@ -0,0 +1,6 @@ +module Hi where + +-- These two should be de-duplicated by CSE +f, g :: Int -> Int +f x = 2 + x +g x = 2 + x diff --git a/testsuite/tests/backpack/should_run/bkprun02.stdout b/testsuite/tests/simplCore/should_compile/T13340.stdout similarity index 100% copy from testsuite/tests/backpack/should_run/bkprun02.stdout copy to testsuite/tests/simplCore/should_compile/T13340.stdout diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index 53f5ade..5227c11 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -244,3 +244,4 @@ test('T13317', normal, run_command, ['$MAKE -s --no-print-directory T13317']) +test('T13340', expect_broken(13340), run_command, ['$MAKE -s --no-print-directory T13340']) From git at git.haskell.org Sun Feb 26 19:56:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 19:56:45 +0000 (UTC) Subject: [commit: ghc] master: Update OverloadedLabels docs and document HasField (2aac0ba) Message-ID: <20170226195645.BA1293A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2aac0ba111e0b09b1ffe4886b4a638042aae57d4/ghc >--------------------------------------------------------------- commit 2aac0ba111e0b09b1ffe4886b4a638042aae57d4 Author: Adam Gundry Date: Sun Feb 26 13:46:18 2017 -0500 Update OverloadedLabels docs and document HasField Test Plan: n/a Reviewers: bgamari, austin Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3144 >--------------------------------------------------------------- 2aac0ba111e0b09b1ffe4886b4a638042aae57d4 docs/users_guide/glasgow_exts.rst | 227 +++++++++++++++++++++++++++--- utils/mkUserGuidePart/Options/Language.hs | 7 + 2 files changed, 213 insertions(+), 21 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 2aac0ba111e0b09b1ffe4886b4a638042aae57d4 From git at git.haskell.org Sun Feb 26 19:56:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 19:56:39 +0000 (UTC) Subject: [commit: ghc] master: Bring sanity to openTempFile (ad617a3) Message-ID: <20170226195639.C22B13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ad617a3edf832b5368146e0bbf0cf2780d9355e1/ghc >--------------------------------------------------------------- commit ad617a3edf832b5368146e0bbf0cf2780d9355e1 Author: Ben Gamari Date: Sun Feb 26 13:44:44 2017 -0500 Bring sanity to openTempFile Test Plan: Run test of `openTempFile` under `strace` to verify reasonably random filenames Reviewers: austin, hvr, trofi, rwbarton Reviewed By: trofi, rwbarton Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3188 >--------------------------------------------------------------- ad617a3edf832b5368146e0bbf0cf2780d9355e1 libraries/base/System/IO.hs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/libraries/base/System/IO.hs b/libraries/base/System/IO.hs index 04e976a..656f852 100644 --- a/libraries/base/System/IO.hs +++ b/libraries/base/System/IO.hs @@ -233,6 +233,8 @@ import System.Posix.Types import GHC.Base import GHC.List +import GHC.IORef +import GHC.Num import GHC.IO hiding ( bracket, onException ) import GHC.IO.IOMode import GHC.IO.Handle.FD @@ -508,15 +510,16 @@ openTempFile' loc tmp_dir template binary mode = findTempName | last a == pathSeparator = a ++ b | otherwise = a ++ [pathSeparator] ++ b --- int rand(void) from , limited by RAND_MAX (small value, 32768) -foreign import capi "stdlib.h rand" c_rand :: IO CInt +tempCounter :: IORef Int +tempCounter = unsafePerformIO $ newIORef 0 +{-# NOINLINE tempCounter #-} -- build large digit-alike number rand_string :: IO String rand_string = do - r1 <- c_rand - r2 <- c_rand - return $ show r1 ++ show r2 + r1 <- c_getpid + r2 <- atomicModifyIORef tempCounter (\n -> (n+1, n)) + return $ show r1 ++ "-" ++ show r2 data OpenNewFileResult = NewFileCreated CInt From git at git.haskell.org Sun Feb 26 19:56:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 19:56:48 +0000 (UTC) Subject: [commit: ghc] master: Fix SetLevels for makeStaticPtr (9bc4311) Message-ID: <20170226195648.86DCA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9bc4311f975fc454c10be814ab3cc0ed27ce215a/ghc >--------------------------------------------------------------- commit 9bc4311f975fc454c10be814ab3cc0ed27ce215a Author: Simon Peyton Jones Date: Sun Feb 26 13:51:57 2017 -0500 Fix SetLevels for makeStaticPtr This too is prepartory for my early-inlining patch. It turned out that early inlining exposed a bug in the way that static pointers were being floated. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3205 >--------------------------------------------------------------- 9bc4311f975fc454c10be814ab3cc0ed27ce215a compiler/simplCore/SetLevels.hs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/compiler/simplCore/SetLevels.hs b/compiler/simplCore/SetLevels.hs index 22d4048..7b17c8d 100644 --- a/compiler/simplCore/SetLevels.hs +++ b/compiler/simplCore/SetLevels.hs @@ -566,12 +566,12 @@ lvlMFE env strict_ctxt ann_expr -- or if we are wrapping it in one or more value lambdas = do { expr1 <- lvlFloatRhs abs_vars dest_lvl rhs_env NonRecursive join_arity_maybe ann_expr -- Treat the expr just like a right-hand side - ; var <- newLvlVar expr1 join_arity_maybe + ; var <- newLvlVar expr1 join_arity_maybe is_mk_static ; let var2 = annotateBotStr var float_n_lams mb_bot_str ; return (Let (NonRec (TB var2 (FloatMe dest_lvl)) expr1) (mkVarApps (Var var2) abs_vars)) } - -- OK, so the float has an unlifted type + -- OK, so the float has an unlifted type (not top-level bindable) -- and no new value lambdas (float_is_new_lam is False) -- Try for the boxing strategy -- See Note [Floating MFEs of unlifted type] @@ -588,7 +588,7 @@ lvlMFE env strict_ctxt ann_expr Case expr1 (stayPut l1r ubx_bndr) dc_res_ty [(DEFAULT, [], mkConApp dc [Var ubx_bndr])] - ; var <- newLvlVar float_rhs Nothing + ; var <- newLvlVar float_rhs Nothing is_mk_static ; let l1u = incMinorLvlFrom env use_expr = Case (mkVarApps (Var var) abs_vars) (stayPut l1u bx_bndr) expr_ty @@ -626,9 +626,12 @@ lvlMFE env strict_ctxt ann_expr join_arity_maybe | need_join = Just (length abs_vars) | otherwise = Nothing + is_mk_static = isJust (collectMakeStaticArgs expr) + -- Yuk: See Note [Grand plan for static forms] in main/StaticPtrTable + -- A decision to float entails let-binding this thing, and we only do -- that if we'll escape a value lambda, or will go to the top level. - float_me = saves_work || saves_alloc + float_me = saves_work || saves_alloc || is_mk_static -- We can save work if we can move a redex outside a value lambda -- But if float_is_new_lam is True, then the redex is wrapped in a @@ -1499,8 +1502,9 @@ newPolyBndrs dest_lvl newLvlVar :: LevelledExpr -- The RHS of the new binding -> Maybe JoinArity -- Its join arity, if it is a join point + -> Bool -- True <=> the RHS looks like (makeStatic ...) -> LvlM Id -newLvlVar lvld_rhs join_arity_maybe +newLvlVar lvld_rhs join_arity_maybe is_mk_static = do { uniq <- getUniqueM ; return (add_join_info (mk_id uniq rhs_ty)) } @@ -1511,8 +1515,7 @@ newLvlVar lvld_rhs join_arity_maybe mk_id uniq rhs_ty -- See Note [Grand plan for static forms] in StaticPtrTable. - | isJust $ collectMakeStaticArgs $ snd $ - collectTyBinders de_tagged_rhs + | is_mk_static = mkExportedVanillaId (mkSystemVarName uniq (mkFastString "static_ptr")) rhs_ty | otherwise From git at git.haskell.org Sun Feb 26 19:56:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 19:56:51 +0000 (UTC) Subject: [commit: ghc] master: Change -ddump-tc-trace output in TcErrors, slightly (ff9ff4a) Message-ID: <20170226195651.3C51F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ff9ff4a8963179214f16c5b7f101d205a96024b1/ghc >--------------------------------------------------------------- commit ff9ff4a8963179214f16c5b7f101d205a96024b1 Author: Simon Peyton Jones Date: Sun Feb 26 13:50:02 2017 -0500 Change -ddump-tc-trace output in TcErrors, slightly Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3200 >--------------------------------------------------------------- ff9ff4a8963179214f16c5b7f101d205a96024b1 compiler/typecheck/TcErrors.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/compiler/typecheck/TcErrors.hs b/compiler/typecheck/TcErrors.hs index 6d4e3de..d47ecc6 100644 --- a/compiler/typecheck/TcErrors.hs +++ b/compiler/typecheck/TcErrors.hs @@ -191,9 +191,9 @@ report_unsolved mb_binds_var err_as_warn type_errors expr_holes ; let tidy_env = tidyFreeTyCoVars env0 free_tvs free_tvs = tyCoVarsOfWCList wanted - ; traceTc "reportUnsolved (after zonking and tidying):" $ - vcat [ pprTyVars free_tvs - , ppr wanted ] + ; traceTc "reportUnsolved (after zonking):" $ + vcat [ text "Free tyvars:" <+> pprTyVars free_tvs + , text "Wanted:" <+> ppr wanted ] ; warn_redundant <- woptM Opt_WarnRedundantConstraints ; let err_ctxt = CEC { cec_encl = [] @@ -335,8 +335,8 @@ reportImplic ctxt implic@(Implic { ic_skols = tvs, ic_given = given -- certainly be un-satisfied constraints | otherwise - = do { reportWanteds ctxt' tc_lvl wanted - ; traceTc "reportImplic" (ppr implic) + = do { traceTc "reportImplic" (ppr implic') + ; reportWanteds ctxt' tc_lvl wanted ; when (cec_warn_redundant ctxt) $ warnRedundantConstraints ctxt' tcl_env info' dead_givens } where From git at git.haskell.org Sun Feb 26 20:29:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 20:29:13 +0000 (UTC) Subject: [commit: ghc] branch 'wip/ttypeable-builtin-kindreps' created Message-ID: <20170226202913.1BC1F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/ttypeable-builtin-kindreps Referencing: 3f64df07ae00f376661ea25fc4fb5de9d73b9f0f From git at git.haskell.org Sun Feb 26 20:29:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 20:29:21 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable-builtin-kindreps: Produce KindReps for common kinds in GHC.Types (3f64df0) Message-ID: <20170226202921.45B443A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable-builtin-kindreps Link : http://ghc.haskell.org/trac/ghc/changeset/3f64df07ae00f376661ea25fc4fb5de9d73b9f0f/ghc >--------------------------------------------------------------- commit 3f64df07ae00f376661ea25fc4fb5de9d73b9f0f Author: Ben Gamari Date: Fri Feb 24 10:26:03 2017 -0500 Produce KindReps for common kinds in GHC.Types >--------------------------------------------------------------- 3f64df07ae00f376661ea25fc4fb5de9d73b9f0f compiler/prelude/PrelNames.hs | 23 ++- compiler/typecheck/TcTypeable.hs | 156 +++++++++++++++------ .../tests/deSugar/should_compile/T2431.stderr | 43 ++---- .../should_compile/DumpTypecheckedAst.stderr | 13 +- testsuite/tests/roles/should_compile/Roles1.stderr | 15 +- .../tests/roles/should_compile/Roles13.stderr | 56 +++----- .../tests/roles/should_compile/Roles14.stderr | 4 +- testsuite/tests/roles/should_compile/Roles2.stderr | 6 +- testsuite/tests/roles/should_compile/Roles3.stderr | 14 +- testsuite/tests/roles/should_compile/Roles4.stderr | 6 +- testsuite/tests/roles/should_compile/T8958.stderr | 9 +- .../tests/simplCore/should_compile/T7360.stderr | 19 +-- .../tests/simplCore/should_compile/T8274.stdout | 8 +- testsuite/tests/th/TH_Roles2.stderr | 8 +- 14 files changed, 209 insertions(+), 171 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 3f64df07ae00f376661ea25fc4fb5de9d73b9f0f From git at git.haskell.org Sun Feb 26 20:29:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 20:29:18 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable-builtin-kindreps: TcTypeable: Try to reuse KindReps (c95a4ad) Message-ID: <20170226202918.899C43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable-builtin-kindreps Link : http://ghc.haskell.org/trac/ghc/changeset/c95a4ad9ed2466ecf135349b58975d2fb5befa39/ghc >--------------------------------------------------------------- commit c95a4ad9ed2466ecf135349b58975d2fb5befa39 Author: Ben Gamari Date: Thu Feb 16 13:15:29 2017 -0500 TcTypeable: Try to reuse KindReps >--------------------------------------------------------------- c95a4ad9ed2466ecf135349b58975d2fb5befa39 compiler/coreSyn/TrieMap.hs | 28 ++- compiler/typecheck/TcTypeable.hs | 257 +++++++++++++-------- .../tests/deSugar/should_compile/T2431.stderr | 83 +++---- .../should_compile/DumpTypecheckedAst.stderr | 104 +++------ testsuite/tests/perf/compiler/all.T | 9 +- testsuite/tests/roles/should_compile/Roles1.stderr | 101 +++----- .../tests/roles/should_compile/Roles13.stderr | 155 ++++++------- .../tests/roles/should_compile/Roles14.stderr | 15 +- testsuite/tests/roles/should_compile/Roles2.stderr | 31 +-- testsuite/tests/roles/should_compile/Roles3.stderr | 56 ++--- testsuite/tests/roles/should_compile/Roles4.stderr | 33 +-- testsuite/tests/roles/should_compile/T8958.stderr | 66 ++---- .../tests/simplCore/should_compile/T7360.stderr | 153 ++++++------ .../tests/simplCore/should_compile/T8274.stdout | 14 +- testsuite/tests/th/TH_Roles2.stderr | 9 +- 15 files changed, 509 insertions(+), 605 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 c95a4ad9ed2466ecf135349b58975d2fb5befa39 From git at git.haskell.org Sun Feb 26 20:29:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 20:29:15 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable-builtin-kindreps: Move Typeable Binary instances to binary package (f296dda) Message-ID: <20170226202915.CB2933A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable-builtin-kindreps Link : http://ghc.haskell.org/trac/ghc/changeset/f296ddaefb139dd8fa144e2ebed90e8107d2d7bb/ghc >--------------------------------------------------------------- commit f296ddaefb139dd8fa144e2ebed90e8107d2d7bb Author: Ben Gamari Date: Wed Feb 8 23:00:46 2017 -0500 Move Typeable Binary instances to binary package >--------------------------------------------------------------- f296ddaefb139dd8fa144e2ebed90e8107d2d7bb libraries/binary | 2 +- libraries/ghci/GHCi/TH/Binary.hs | 177 ++------------------------------------- 2 files changed, 9 insertions(+), 170 deletions(-) diff --git a/libraries/binary b/libraries/binary index af1d17c..3985dae 160000 --- a/libraries/binary +++ b/libraries/binary @@ -1 +1 @@ -Subproject commit af1d17c27867f644886fcbc4703eb3e48792f3e7 +Subproject commit 3985daec78aac24be1dd26ad0949b5dd2733443d diff --git a/libraries/ghci/GHCi/TH/Binary.hs b/libraries/ghci/GHCi/TH/Binary.hs index fcff168..ae6bc9f 100644 --- a/libraries/ghci/GHCi/TH/Binary.hs +++ b/libraries/ghci/GHCi/TH/Binary.hs @@ -10,18 +10,12 @@ module GHCi.TH.Binary () where import Data.Binary import qualified Data.ByteString as B -#if MIN_VERSION_base(4,10,0) -import Type.Reflection -import Type.Reflection.Unsafe -import Data.Kind (Type) -import GHC.Exts (RuntimeRep(..), VecCount, VecElem) -#else -import Data.Typeable -#endif import GHC.Serialized import qualified Language.Haskell.TH as TH import qualified Language.Haskell.TH.Syntax as TH - +#if !MIN_VERSION_base(4,10,0) +import Data.Typeable +#endif -- Put these in a separate module because they take ages to compile instance Binary TH.Loc @@ -79,163 +73,12 @@ instance Binary TH.PatSynArgs -- We need Binary TypeRep for serializing annotations -#if MIN_VERSION_base(4,10,0) -instance Binary VecCount where - put = putWord8 . fromIntegral . fromEnum - get = toEnum . fromIntegral <$> getWord8 - -instance Binary VecElem where - put = putWord8 . fromIntegral . fromEnum - get = toEnum . fromIntegral <$> getWord8 - -instance Binary RuntimeRep where - put (VecRep a b) = putWord8 0 >> put a >> put b - put (TupleRep reps) = putWord8 1 >> put reps - put (SumRep reps) = putWord8 2 >> put reps - put LiftedRep = putWord8 3 - put UnliftedRep = putWord8 4 - put IntRep = putWord8 5 - put WordRep = putWord8 6 - put Int64Rep = putWord8 7 - put Word64Rep = putWord8 8 - put AddrRep = putWord8 9 - put FloatRep = putWord8 10 - put DoubleRep = putWord8 11 - - get = do - tag <- getWord8 - case tag of - 0 -> VecRep <$> get <*> get - 1 -> TupleRep <$> get - 2 -> SumRep <$> get - 3 -> pure LiftedRep - 4 -> pure UnliftedRep - 5 -> pure IntRep - 6 -> pure WordRep - 7 -> pure Int64Rep - 8 -> pure Word64Rep - 9 -> pure AddrRep - 10 -> pure FloatRep - 11 -> pure DoubleRep - _ -> fail "GHCi.TH.Binary.putRuntimeRep: invalid tag" - -instance Binary TyCon where - put tc = do - put (tyConPackage tc) - put (tyConModule tc) - put (tyConName tc) - put (tyConKindArgs tc) - put (tyConKindRep tc) - get = mkTyCon <$> get <*> get <*> get <*> get <*> get - -instance Binary KindRep where - put (KindRepTyConApp tc k) = putWord8 0 >> put tc >> put k - put (KindRepVar bndr) = putWord8 1 >> put bndr - put (KindRepApp a b) = putWord8 2 >> put a >> put b - put (KindRepFun a b) = putWord8 3 >> put a >> put b - put (KindRepTYPE r) = putWord8 4 >> put r - put (KindRepTypeLit sort r) = putWord8 5 >> put sort >> put r - put _ = fail "GHCi.TH.Binary.putKindRep: Impossible" - - get = do - tag <- getWord8 - case tag of - 0 -> KindRepTyConApp <$> get <*> get - 1 -> KindRepVar <$> get - 2 -> KindRepApp <$> get <*> get - 3 -> KindRepFun <$> get <*> get - 4 -> KindRepTYPE <$> get - 5 -> KindRepTypeLit <$> get <*> get - _ -> fail "GHCi.TH.Binary.putKindRep: invalid tag" - -instance Binary TypeLitSort where - put TypeLitSymbol = putWord8 0 - put TypeLitNat = putWord8 1 - get = do - tag <- getWord8 - case tag of - 0 -> pure TypeLitSymbol - 1 -> pure TypeLitNat - _ -> fail "GHCi.TH.Binary.putTypeLitSort: invalid tag" - -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 -- Handle Type specially since it's so common - | Just HRefl <- rep `eqTypeRep` (typeRep :: TypeRep Type) - = put (0 :: Word8) -putTypeRep (Con' con ks) = do - put (1 :: Word8) - put con - put ks -putTypeRep (App f x) = do - put (2 :: Word8) - putTypeRep f - putTypeRep x -putTypeRep (Fun arg res) = do - put (3 :: Word8) - putTypeRep arg - putTypeRep res -putTypeRep _ = fail "GHCi.TH.Binary.putTypeRep: Impossible" - -getSomeTypeRep :: Get SomeTypeRep -getSomeTypeRep = do - tag <- get :: Get Word8 - case tag of - 0 -> return $ SomeTypeRep (typeRep :: TypeRep Type) - 1 -> do con <- get :: Get TyCon - ks <- get :: Get [SomeTypeRep] - return $ SomeTypeRep $ mkTrCon con ks - 2 -> do SomeTypeRep f <- getSomeTypeRep - SomeTypeRep x <- getSomeTypeRep - case typeRepKind f of - Fun arg res -> - case arg `eqTypeRep` typeRepKind x of - Just HRefl -> do - case typeRepKind res `eqTypeRep` (typeRep :: TypeRep Type) of - Just HRefl -> return $ SomeTypeRep $ mkTrApp f x - _ -> failure "Kind mismatch" [] - _ -> failure "Kind mismatch" - [ "Found argument of kind: " ++ show (typeRepKind x) - , "Where the constructor: " ++ show f - , "Expects an argument of kind: " ++ show arg - ] - _ -> failure "Applied non-arrow type" - [ "Applied type: " ++ show f - , "To argument: " ++ show x - ] - 3 -> do SomeTypeRep arg <- getSomeTypeRep - SomeTypeRep res <- getSomeTypeRep - case typeRepKind arg `eqTypeRep` (typeRep :: TypeRep Type) of - Just HRefl -> - case typeRepKind res `eqTypeRep` (typeRep :: TypeRep Type) of - Just HRefl -> return $ SomeTypeRep $ Fun arg res - Nothing -> failure "Kind mismatch" [] - Nothing -> failure "Kind mismatch" [] - _ -> failure "Invalid SomeTypeRep" [] - where - failure description info = - fail $ unlines $ [ "GHCi.TH.Binary.getSomeTypeRep: "++description ] - ++ map (" "++) info - -instance Typeable a => Binary (TypeRep (a :: k)) where - put = putTypeRep - get = do - SomeTypeRep rep <- getSomeTypeRep - case rep `eqTypeRep` expected of - Just HRefl -> pure rep - Nothing -> fail $ unlines - [ "GHCi.TH.Binary: Type mismatch" - , " Deserialized type: " ++ show rep - , " Expected type: " ++ show expected - ] - where expected = typeRep :: TypeRep a +instance Binary Serialized where + put (Serialized tyrep wds) = put tyrep >> put (B.pack wds) + get = Serialized <$> get <*> (B.unpack <$> get) -instance Binary SomeTypeRep where - put (SomeTypeRep rep) = putTypeRep rep - get = getSomeTypeRep -#else +-- Typeable and related instances live in binary since GHC 8.2 +#if !MIN_VERSION_base(4,10,0) instance Binary TyCon where put tc = put (tyConPackage tc) >> put (tyConModule tc) >> put (tyConName tc) get = mkTyCon3 <$> get <*> get <*> get @@ -246,7 +89,3 @@ instance Binary TypeRep where (ty_con, child_type_reps) <- get return (mkTyConApp ty_con child_type_reps) #endif - -instance Binary Serialized where - put (Serialized tyrep wds) = put tyrep >> put (B.pack wds) - get = Serialized <$> get <*> (B.unpack <$> get) From git at git.haskell.org Sun Feb 26 20:30:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 20:30:06 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: TcTypeable: Try to reuse KindReps (c0399ec) Message-ID: <20170226203006.B3E093A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/c0399ec690ffd6b304d64fc4d0c2ba1f3408b5b3/ghc >--------------------------------------------------------------- commit c0399ec690ffd6b304d64fc4d0c2ba1f3408b5b3 Author: Ben Gamari Date: Thu Feb 16 13:15:29 2017 -0500 TcTypeable: Try to reuse KindReps >--------------------------------------------------------------- c0399ec690ffd6b304d64fc4d0c2ba1f3408b5b3 compiler/coreSyn/TrieMap.hs | 28 ++- compiler/typecheck/TcTypeable.hs | 257 +++++++++++++-------- .../tests/deSugar/should_compile/T2431.stderr | 83 +++---- .../should_compile/DumpTypecheckedAst.stderr | 104 +++------ testsuite/tests/perf/compiler/all.T | 9 +- testsuite/tests/roles/should_compile/Roles1.stderr | 101 +++----- .../tests/roles/should_compile/Roles13.stderr | 155 ++++++------- .../tests/roles/should_compile/Roles14.stderr | 15 +- testsuite/tests/roles/should_compile/Roles2.stderr | 31 +-- testsuite/tests/roles/should_compile/Roles3.stderr | 56 ++--- testsuite/tests/roles/should_compile/Roles4.stderr | 33 +-- testsuite/tests/roles/should_compile/T8958.stderr | 66 ++---- .../tests/simplCore/should_compile/T7360.stderr | 153 ++++++------ .../tests/simplCore/should_compile/T8274.stdout | 14 +- testsuite/tests/th/TH_Roles2.stderr | 9 +- 15 files changed, 509 insertions(+), 605 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 c0399ec690ffd6b304d64fc4d0c2ba1f3408b5b3 From git at git.haskell.org Sun Feb 26 20:30:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 20:30:11 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable's head updated: TcTypeable: Try to reuse KindReps (c0399ec) Message-ID: <20170226203011.ECBAE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/ttypeable' now includes: 59026b3 Spelling in comments only fd841f8 Fix DeriveAnyClass (again) 713ebd7 Fix computation of dfun_tvs in mkNewTypeEqn 95cbb55 Refactor inferConstraints not to use CPS 82694e6 testsuite: Fix allocations of T10547 e790126 Improve Core Lint, mainly for join points 6e32884 Fix SetLevels for join points 4080a63 Minor spelling, grammar, and formatting fixes 611f998 Replace some pushTcLevelM's with pushTcLevelM_ 0d43f74 A little refactoring of the simplifier around join points 0c9d9de Remove panics for TcTyCon e3e218e A bit more tc-tracing in TcTyClsDecls c750808 Disallow class instances for synonyms 3c62b1d Gather constraints locally in checkMain 499a15d Test Trac #13300 9ef2749 Fix all broken perf tests on x64 Windows 8ccbc2e Bump Cabal and containers submodules b125392 Test Trac #13271 484f8d3 Fix ApplicativeDo constraint scoping fed7136 Test Trac #13244 254bc33 A much nicer solution for typechecking ApplicativeDo c8d995d Bump time submodule c347a12 Revert recent submodule bumps 992ea02 Changelog notice for compact. 5841574 Drop NFData constraint from compact. 8a6b8c5 Export commentToAnnotation from Lexer.x 9a2a2ae Spelling only [ci skip] 050f05d testsuite: Bump a performance tests de80558 Give better error message with you run ghc foo.bkp 0a77ced Have --backpack complain if multiple files are passed. a204333 JSON profiler reports 3cb9b52 Set $1_$2_SplitSections in distdir-opts.mk not build-package.mk 48a967c testsuite: Remove old python version tests 7d116e5 rts: Correct the nursery size in the gen 1 growth computation 6ca6a36 base: Add handling of -- to getArgs for Windows bb1c660 ghci users guide: mention "~" expansion in :add 12e21d3 Use half as much memory when reading interfaces 39d926c More tracing in SpecConstr 8f8016a Include OverloadedRecordFields selectors in NameShape. 4ad3620 Fix parsing of And chains in BoolFormula 8d64395 Correct Windows libdir assumptions. c88b7c9 Add instances for (:~~:) mirroring those for (:~:) a6e13d5 Make exprIsConApp_maybe work better for literals strings 67c2e07 Add API Annotation AnnSignature for backpack signature modules 9b859ef Make SCCFunSig tag Located for ghc-exactprint 00c0120 Add a comment explaining CompleteMatchSig in HsBinds 93ffcb0 Document AMP as a Report deviation 9d17028 Record full FieldLabel in ifConFields. 7c060e4 Fix validate. 8f15ab9 Delete redundant import. 8f20844 Correctly pretty print a wild card in infix position a0b4a2a Rename compact to ghc-compact. cae1a71 Bring in unicode variants of API Annotations for HsBracket 41e54b4 Load dependent dlls. 9968502 Make list of deprecated symbols on Windows weak. be3f436 Load `pthreads` by default on Windows 97b1505 rts: Usage message wibbles d4b6dee testsuite: Bump down T2762 number 517ad20 Add testcase for #13340 ad617a3 Bring sanity to openTempFile 2aac0ba Update OverloadedLabels docs and document HasField ff9ff4a Change -ddump-tc-trace output in TcErrors, slightly 9bc4311 Fix SetLevels for makeStaticPtr 109795a Move Typeable Binary instances to binary package c0399ec TcTypeable: Try to reuse KindReps From git at git.haskell.org Sun Feb 26 20:30:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 20:30:09 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: Move Typeable Binary instances to binary package (109795a) Message-ID: <20170226203009.74DF93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/109795a1714cf0d838544ad209dd901a8b38458d/ghc >--------------------------------------------------------------- commit 109795a1714cf0d838544ad209dd901a8b38458d Author: Ben Gamari Date: Wed Feb 8 23:00:46 2017 -0500 Move Typeable Binary instances to binary package >--------------------------------------------------------------- 109795a1714cf0d838544ad209dd901a8b38458d libraries/binary | 2 +- libraries/ghci/GHCi/TH/Binary.hs | 177 ++------------------------------------- 2 files changed, 9 insertions(+), 170 deletions(-) diff --git a/libraries/binary b/libraries/binary index af1d17c..3985dae 160000 --- a/libraries/binary +++ b/libraries/binary @@ -1 +1 @@ -Subproject commit af1d17c27867f644886fcbc4703eb3e48792f3e7 +Subproject commit 3985daec78aac24be1dd26ad0949b5dd2733443d diff --git a/libraries/ghci/GHCi/TH/Binary.hs b/libraries/ghci/GHCi/TH/Binary.hs index fcff168..ae6bc9f 100644 --- a/libraries/ghci/GHCi/TH/Binary.hs +++ b/libraries/ghci/GHCi/TH/Binary.hs @@ -10,18 +10,12 @@ module GHCi.TH.Binary () where import Data.Binary import qualified Data.ByteString as B -#if MIN_VERSION_base(4,10,0) -import Type.Reflection -import Type.Reflection.Unsafe -import Data.Kind (Type) -import GHC.Exts (RuntimeRep(..), VecCount, VecElem) -#else -import Data.Typeable -#endif import GHC.Serialized import qualified Language.Haskell.TH as TH import qualified Language.Haskell.TH.Syntax as TH - +#if !MIN_VERSION_base(4,10,0) +import Data.Typeable +#endif -- Put these in a separate module because they take ages to compile instance Binary TH.Loc @@ -79,163 +73,12 @@ instance Binary TH.PatSynArgs -- We need Binary TypeRep for serializing annotations -#if MIN_VERSION_base(4,10,0) -instance Binary VecCount where - put = putWord8 . fromIntegral . fromEnum - get = toEnum . fromIntegral <$> getWord8 - -instance Binary VecElem where - put = putWord8 . fromIntegral . fromEnum - get = toEnum . fromIntegral <$> getWord8 - -instance Binary RuntimeRep where - put (VecRep a b) = putWord8 0 >> put a >> put b - put (TupleRep reps) = putWord8 1 >> put reps - put (SumRep reps) = putWord8 2 >> put reps - put LiftedRep = putWord8 3 - put UnliftedRep = putWord8 4 - put IntRep = putWord8 5 - put WordRep = putWord8 6 - put Int64Rep = putWord8 7 - put Word64Rep = putWord8 8 - put AddrRep = putWord8 9 - put FloatRep = putWord8 10 - put DoubleRep = putWord8 11 - - get = do - tag <- getWord8 - case tag of - 0 -> VecRep <$> get <*> get - 1 -> TupleRep <$> get - 2 -> SumRep <$> get - 3 -> pure LiftedRep - 4 -> pure UnliftedRep - 5 -> pure IntRep - 6 -> pure WordRep - 7 -> pure Int64Rep - 8 -> pure Word64Rep - 9 -> pure AddrRep - 10 -> pure FloatRep - 11 -> pure DoubleRep - _ -> fail "GHCi.TH.Binary.putRuntimeRep: invalid tag" - -instance Binary TyCon where - put tc = do - put (tyConPackage tc) - put (tyConModule tc) - put (tyConName tc) - put (tyConKindArgs tc) - put (tyConKindRep tc) - get = mkTyCon <$> get <*> get <*> get <*> get <*> get - -instance Binary KindRep where - put (KindRepTyConApp tc k) = putWord8 0 >> put tc >> put k - put (KindRepVar bndr) = putWord8 1 >> put bndr - put (KindRepApp a b) = putWord8 2 >> put a >> put b - put (KindRepFun a b) = putWord8 3 >> put a >> put b - put (KindRepTYPE r) = putWord8 4 >> put r - put (KindRepTypeLit sort r) = putWord8 5 >> put sort >> put r - put _ = fail "GHCi.TH.Binary.putKindRep: Impossible" - - get = do - tag <- getWord8 - case tag of - 0 -> KindRepTyConApp <$> get <*> get - 1 -> KindRepVar <$> get - 2 -> KindRepApp <$> get <*> get - 3 -> KindRepFun <$> get <*> get - 4 -> KindRepTYPE <$> get - 5 -> KindRepTypeLit <$> get <*> get - _ -> fail "GHCi.TH.Binary.putKindRep: invalid tag" - -instance Binary TypeLitSort where - put TypeLitSymbol = putWord8 0 - put TypeLitNat = putWord8 1 - get = do - tag <- getWord8 - case tag of - 0 -> pure TypeLitSymbol - 1 -> pure TypeLitNat - _ -> fail "GHCi.TH.Binary.putTypeLitSort: invalid tag" - -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 -- Handle Type specially since it's so common - | Just HRefl <- rep `eqTypeRep` (typeRep :: TypeRep Type) - = put (0 :: Word8) -putTypeRep (Con' con ks) = do - put (1 :: Word8) - put con - put ks -putTypeRep (App f x) = do - put (2 :: Word8) - putTypeRep f - putTypeRep x -putTypeRep (Fun arg res) = do - put (3 :: Word8) - putTypeRep arg - putTypeRep res -putTypeRep _ = fail "GHCi.TH.Binary.putTypeRep: Impossible" - -getSomeTypeRep :: Get SomeTypeRep -getSomeTypeRep = do - tag <- get :: Get Word8 - case tag of - 0 -> return $ SomeTypeRep (typeRep :: TypeRep Type) - 1 -> do con <- get :: Get TyCon - ks <- get :: Get [SomeTypeRep] - return $ SomeTypeRep $ mkTrCon con ks - 2 -> do SomeTypeRep f <- getSomeTypeRep - SomeTypeRep x <- getSomeTypeRep - case typeRepKind f of - Fun arg res -> - case arg `eqTypeRep` typeRepKind x of - Just HRefl -> do - case typeRepKind res `eqTypeRep` (typeRep :: TypeRep Type) of - Just HRefl -> return $ SomeTypeRep $ mkTrApp f x - _ -> failure "Kind mismatch" [] - _ -> failure "Kind mismatch" - [ "Found argument of kind: " ++ show (typeRepKind x) - , "Where the constructor: " ++ show f - , "Expects an argument of kind: " ++ show arg - ] - _ -> failure "Applied non-arrow type" - [ "Applied type: " ++ show f - , "To argument: " ++ show x - ] - 3 -> do SomeTypeRep arg <- getSomeTypeRep - SomeTypeRep res <- getSomeTypeRep - case typeRepKind arg `eqTypeRep` (typeRep :: TypeRep Type) of - Just HRefl -> - case typeRepKind res `eqTypeRep` (typeRep :: TypeRep Type) of - Just HRefl -> return $ SomeTypeRep $ Fun arg res - Nothing -> failure "Kind mismatch" [] - Nothing -> failure "Kind mismatch" [] - _ -> failure "Invalid SomeTypeRep" [] - where - failure description info = - fail $ unlines $ [ "GHCi.TH.Binary.getSomeTypeRep: "++description ] - ++ map (" "++) info - -instance Typeable a => Binary (TypeRep (a :: k)) where - put = putTypeRep - get = do - SomeTypeRep rep <- getSomeTypeRep - case rep `eqTypeRep` expected of - Just HRefl -> pure rep - Nothing -> fail $ unlines - [ "GHCi.TH.Binary: Type mismatch" - , " Deserialized type: " ++ show rep - , " Expected type: " ++ show expected - ] - where expected = typeRep :: TypeRep a +instance Binary Serialized where + put (Serialized tyrep wds) = put tyrep >> put (B.pack wds) + get = Serialized <$> get <*> (B.unpack <$> get) -instance Binary SomeTypeRep where - put (SomeTypeRep rep) = putTypeRep rep - get = getSomeTypeRep -#else +-- Typeable and related instances live in binary since GHC 8.2 +#if !MIN_VERSION_base(4,10,0) instance Binary TyCon where put tc = put (tyConPackage tc) >> put (tyConModule tc) >> put (tyConName tc) get = mkTyCon3 <$> get <*> get <*> get @@ -246,7 +89,3 @@ instance Binary TypeRep where (ty_con, child_type_reps) <- get return (mkTyConApp ty_con child_type_reps) #endif - -instance Binary Serialized where - put (Serialized tyrep wds) = put tyrep >> put (B.pack wds) - get = Serialized <$> get <*> (B.unpack <$> get) From git at git.haskell.org Sun Feb 26 20:35:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 20:35:21 +0000 (UTC) Subject: [commit: packages/binary] master: Add badges to README (2a20ea9) Message-ID: <20170226203521.ECC2B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/2a20ea9b2e694c10d5a68e31fd7ad7353df9f565 >--------------------------------------------------------------- commit 2a20ea9b2e694c10d5a68e31fd7ad7353df9f565 Author: Lennart Kolmodin Date: Wed Sep 21 11:05:06 2016 +0200 Add badges to README For Hackage and Stackage versions >--------------------------------------------------------------- 2a20ea9b2e694c10d5a68e31fd7ad7353df9f565 README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b32d7ff..73bc9a5 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # binary package # -[![Build Status](https://api.travis-ci.org/kolmodin/binary.png?branch=master)](http://travis-ci.org/kolmodin/binary) +[![Hackage version](https://img.shields.io/hackage/v/binary.svg?label=Hackage)](https://hackage.haskell.org/package/binary) [![Stackage version](https://www.stackage.org/package/binary/badge/lts?label=Stackage)](https://www.stackage.org/package/binary) [![Build Status](https://api.travis-ci.org/kolmodin/binary.png?branch=master)](http://travis-ci.org/kolmodin/binary) *Efficient, pure binary serialisation using lazy ByteStrings.* From git at git.haskell.org Sun Feb 26 20:35:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 20:35:23 +0000 (UTC) Subject: [commit: packages/binary] master: Remove tuple Arbitrary instances (7d75a2c) Message-ID: <20170226203523.F2BC43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/7d75a2ce11b79d6f1fc9a3674363723fd2c8e315 >--------------------------------------------------------------- commit 7d75a2ce11b79d6f1fc9a3674363723fd2c8e315 Author: Lennart Kolmodin Date: Wed Sep 21 14:49:40 2016 +0200 Remove tuple Arbitrary instances They're defined in recent QuickCheck versions. >--------------------------------------------------------------- 7d75a2ce11b79d6f1fc9a3674363723fd2c8e315 tests/Arbitrary.hs | 40 ---------------------------------------- 1 file changed, 40 deletions(-) diff --git a/tests/Arbitrary.hs b/tests/Arbitrary.hs index 3d6281f..2b7aea4 100644 --- a/tests/Arbitrary.hs +++ b/tests/Arbitrary.hs @@ -21,43 +21,3 @@ instance Arbitrary B.ByteString where instance Arbitrary S.ShortByteString where arbitrary = S.toShort `fmap` arbitrary #endif - -instance (Arbitrary a, Arbitrary b, Arbitrary c, Arbitrary d, Arbitrary e, - Arbitrary f) => - Arbitrary (a,b,c,d,e,f) where - arbitrary = do - (a,b,c,d,e) <- arbitrary - f <- arbitrary - return (a,b,c,d,e,f) - -instance (Arbitrary a, Arbitrary b, Arbitrary c, Arbitrary d, Arbitrary e, - Arbitrary f, Arbitrary g) => - Arbitrary (a,b,c,d,e,f,g) where - arbitrary = do - (a,b,c,d,e) <- arbitrary - (f,g) <- arbitrary - return (a,b,c,d,e,f,g) - -instance (Arbitrary a, Arbitrary b, Arbitrary c, Arbitrary d, Arbitrary e, - Arbitrary f, Arbitrary g, Arbitrary h) => - Arbitrary (a,b,c,d,e,f,g,h) where - arbitrary = do - (a,b,c,d,e) <- arbitrary - (f,g,h) <- arbitrary - return (a,b,c,d,e,f,g,h) - -instance (Arbitrary a, Arbitrary b, Arbitrary c, Arbitrary d, Arbitrary e, - Arbitrary f, Arbitrary g, Arbitrary h, Arbitrary i) => - Arbitrary (a,b,c,d,e,f,g,h,i) where - arbitrary = do - (a,b,c,d,e) <- arbitrary - (f,g,h,i) <- arbitrary - return (a,b,c,d,e,f,g,h,i) - -instance (Arbitrary a, Arbitrary b, Arbitrary c, Arbitrary d, Arbitrary e, - Arbitrary f, Arbitrary g, Arbitrary h, Arbitrary i, Arbitrary j) => - Arbitrary (a,b,c,d,e,f,g,h,i,j) where - arbitrary = do - (a,b,c,d,e) <- arbitrary - (f,g,h,i,j) <- arbitrary - return (a,b,c,d,e,f,g,h,i,j) From git at git.haskell.org Sun Feb 26 20:35:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 20:35:26 +0000 (UTC) Subject: [commit: packages/binary] master: Use QuickCheck == 2.9.* (46b2c67) Message-ID: <20170226203526.0451D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/46b2c6707d9772518c655848f98394b6ad62b9cf >--------------------------------------------------------------- commit 46b2c6707d9772518c655848f98394b6ad62b9cf Author: Lennart Kolmodin Date: Wed Sep 21 14:50:13 2016 +0200 Use QuickCheck == 2.9.* >--------------------------------------------------------------- 46b2c6707d9772518c655848f98394b6ad62b9cf binary.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/binary.cabal b/binary.cabal index d396648..bde0fbe 100644 --- a/binary.cabal +++ b/binary.cabal @@ -70,7 +70,7 @@ test-suite qc random>=1.0.1.0, test-framework, test-framework-quickcheck2 >= 0.3, - QuickCheck>=2.8 + QuickCheck == 2.9.* -- build dependencies from using binary source rather than depending on the library build-depends: array, containers From git at git.haskell.org Sun Feb 26 20:35:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 20:35:28 +0000 (UTC) Subject: [commit: packages/binary] master: [travis] Require "bytestring >= 0.10.2" for older GHCs (0b3a7ba) Message-ID: <20170226203528.0A9A33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/0b3a7ba6df0ceabfb224dd1621fda02a155fc8dc >--------------------------------------------------------------- commit 0b3a7ba6df0ceabfb224dd1621fda02a155fc8dc Author: Lennart Kolmodin Date: Wed Sep 21 15:59:16 2016 +0200 [travis] Require "bytestring >= 0.10.2" for older GHCs >--------------------------------------------------------------- 0b3a7ba6df0ceabfb224dd1621fda02a155fc8dc .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5dc64cc..6f17cda 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,9 +6,9 @@ sudo: false matrix: include: - - env: CABALVER=1.18 GHCVER=7.4.2 + - env: CABALVER=1.18 GHCVER=7.4.2 INSTALL_EXTRA="bytestring >= 0.10.2" addons: {apt: {packages: [cabal-install-1.18,ghc-7.4.2], sources: [hvr-ghc]}} - - env: CABALVER=1.18 GHCVER=7.6.3 + - env: CABALVER=1.18 GHCVER=7.6.3 INSTALL_EXTRA="bytestring >= 0.10.2" 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]}} @@ -32,7 +32,7 @@ install: - sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config - cabal sandbox init # can't use "cabal install --only-dependencies --enable-tests --enable-benchmarks" due to dep-cycle - - cabal install criterion deepseq mtl "QuickCheck >= 2.8" HUnit "test-framework-quickcheck2 >= 0.3" "random >= 1.0.1.0" attoparsec cereal 'Cabal == 1.24.*' tar zlib -j + - cabal install "${INSTALL_EXTRA}" criterion deepseq mtl "QuickCheck >= 2.8" HUnit "test-framework-quickcheck2 >= 0.3" "random >= 1.0.1.0" attoparsec cereal 'Cabal == 1.24.*' tar zlib -j script: - cabal configure --enable-tests --enable-benchmarks -v2 --ghc-options=-fno-spec-constr From git at git.haskell.org Sun Feb 26 20:35:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 20:35:30 +0000 (UTC) Subject: [commit: packages/binary] master: Install "bytestring >= 0.10.2" for all GHCs (3f30c35) Message-ID: <20170226203530.1116F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/3f30c35da4a8c235b75f98cbb8a3584a529cc5fd >--------------------------------------------------------------- commit 3f30c35da4a8c235b75f98cbb8a3584a529cc5fd Author: Lennart Kolmodin Date: Wed Sep 21 16:33:33 2016 +0200 Install "bytestring >= 0.10.2" for all GHCs Should be a no-op if the constraint is already satisfied. >--------------------------------------------------------------- 3f30c35da4a8c235b75f98cbb8a3584a529cc5fd .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6f17cda..c9112c1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,9 +6,9 @@ sudo: false matrix: include: - - env: CABALVER=1.18 GHCVER=7.4.2 INSTALL_EXTRA="bytestring >= 0.10.2" + - 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 INSTALL_EXTRA="bytestring >= 0.10.2" + - 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 addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4], sources: [hvr-ghc]}} @@ -32,7 +32,7 @@ install: - sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config - cabal sandbox init # can't use "cabal install --only-dependencies --enable-tests --enable-benchmarks" due to dep-cycle - - cabal install "${INSTALL_EXTRA}" criterion deepseq mtl "QuickCheck >= 2.8" HUnit "test-framework-quickcheck2 >= 0.3" "random >= 1.0.1.0" attoparsec cereal 'Cabal == 1.24.*' tar zlib -j + - cabal install "bytestring >= 0.10.2" criterion deepseq mtl "QuickCheck >= 2.8" HUnit "test-framework-quickcheck2 >= 0.3" "random >= 1.0.1.0" attoparsec cereal 'Cabal == 1.24.*' tar zlib -j script: - cabal configure --enable-tests --enable-benchmarks -v2 --ghc-options=-fno-spec-constr From git at git.haskell.org Sun Feb 26 20:35:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 20:35:36 +0000 (UTC) Subject: [commit: packages/binary] master: Don't use tyConString (d7ab033) Message-ID: <20170226203536.23FE83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/d7ab0337977e192d0c9d0c3dc5a78b00f42d2b87 >--------------------------------------------------------------- commit d7ab0337977e192d0c9d0c3dc5a78b00f42d2b87 Author: David Feuer Date: Tue Jan 10 01:37:03 2017 -0500 Don't use tyConString `tyConString` has been deprecated since GHC 7.4. I'd like to move toward actually removing it. That can't happen until `binary` stops using it. >--------------------------------------------------------------- d7ab0337977e192d0c9d0c3dc5a78b00f42d2b87 tools/derive/BinaryDerive.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/derive/BinaryDerive.hs b/tools/derive/BinaryDerive.hs index 914dbb0..cf3afb6 100644 --- a/tools/derive/BinaryDerive.hs +++ b/tools/derive/BinaryDerive.hs @@ -17,7 +17,7 @@ derive x = | nTypeChildren > 0 = wrap (join ", " (map ("Binary "++) typeLetters)) ++ " => " | otherwise = "" - inst = wrap $ tyConString typeName ++ concatMap (" "++) typeLetters + inst = wrap $ tyConName typeName ++ concatMap (" "++) typeLetters wrap x = if nTypeChildren > 0 then "("++x++")" else x join sep lst = concat $ intersperse sep lst nTypeChildren = length typeChildren From git at git.haskell.org Sun Feb 26 20:35:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 20:35:38 +0000 (UTC) Subject: [commit: packages/binary] master: Merge pull request #129 from treeowl/nix-tyConString (9d4e02f) Message-ID: <20170226203538.2AFF93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/9d4e02fcabd09dfff5679a1019a3fde9207be068 >--------------------------------------------------------------- commit 9d4e02fcabd09dfff5679a1019a3fde9207be068 Merge: 4afbf7c d7ab033 Author: Lennart Kolmodin Date: Wed Jan 11 20:58:49 2017 +0100 Merge pull request #129 from treeowl/nix-tyConString Don't use tyConString >--------------------------------------------------------------- 9d4e02fcabd09dfff5679a1019a3fde9207be068 tools/derive/BinaryDerive.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) From git at git.haskell.org Sun Feb 26 20:35:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 20:35:34 +0000 (UTC) Subject: [commit: packages/binary] master: Merge pull request #128 from tippenein/fix-unpack-pragma-link (4afbf7c) Message-ID: <20170226203534.1E2393A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/4afbf7cd70d4a3e9fd479a4f8fe8d8fb8cfc6023 >--------------------------------------------------------------- commit 4afbf7cd70d4a3e9fd479a4f8fe8d8fb8cfc6023 Merge: 3f30c35 d20f3da Author: Lennart Kolmodin Date: Sun Jan 8 16:59:25 2017 +0100 Merge pull request #128 from tippenein/fix-unpack-pragma-link fix link in Data.Binary.Get documentation. >--------------------------------------------------------------- 4afbf7cd70d4a3e9fd479a4f8fe8d8fb8cfc6023 src/Data/Binary/Get.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) From git at git.haskell.org Sun Feb 26 20:35:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 20:35:32 +0000 (UTC) Subject: [commit: packages/binary] master: fix unpack pragma link (d20f3da) Message-ID: <20170226203532.174C43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/d20f3daae617bb2d709eb6131abf9777981cb49f >--------------------------------------------------------------- commit d20f3daae617bb2d709eb6131abf9777981cb49f Author: brady.ouren Date: Sat Jan 7 20:59:24 2017 -0800 fix unpack pragma link >--------------------------------------------------------------- d20f3daae617bb2d709eb6131abf9777981cb49f src/Data/Binary/Get.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Data/Binary/Get.hs b/src/Data/Binary/Get.hs index 6220759..166b211 100644 --- a/src/Data/Binary/Get.hs +++ b/src/Data/Binary/Get.hs @@ -41,7 +41,7 @@ -- The fields in @Trade@ are marked as strict (using @!@) since we don't need -- laziness here. In practise, you would probably consider using the UNPACK -- pragma as well. --- +-- -- -- Now, let's have a look at a decoder for this format. -- From git at git.haskell.org Sun Feb 26 20:35:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 20:35:40 +0000 (UTC) Subject: [commit: packages/binary] master: [travis-ci] Fix some build breakage (#130) (74add75) Message-ID: <20170226203540.31DC43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/74add75b768879d815a8a4a0aee2132bbf28eb31 >--------------------------------------------------------------- commit 74add75b768879d815a8a4a0aee2132bbf28eb31 Author: Lennart Kolmodin Date: Sun Jan 22 18:56:14 2017 +0100 [travis-ci] Fix some build breakage (#130) Split cabal install into two invocations. Cabal seems to not handle the 'cabal-version' constraint correctly, and ends up ordering the packages to install in the wrong order. Installing Cabal separately first, and then all other packages, seems to work around the problem. >--------------------------------------------------------------- 74add75b768879d815a8a4a0aee2132bbf28eb31 .travis.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index c9112c1..703cd36 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,8 +31,10 @@ install: # workaround for https://ghc.haskell.org/trac/ghc/ticket/9221 - sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config - cabal sandbox init -# can't use "cabal install --only-dependencies --enable-tests --enable-benchmarks" due to dep-cycle - - cabal install "bytestring >= 0.10.2" criterion deepseq mtl "QuickCheck >= 2.8" HUnit "test-framework-quickcheck2 >= 0.3" "random >= 1.0.1.0" attoparsec cereal 'Cabal == 1.24.*' tar zlib -j +# can't use "cabal install --only-dependencies --enable-tests --enable-benchmarks" due to dep-cycle. +# must split in two separate 'cabal install's since cabal doesn't update the cabal library before it's needed in 'cabal-version' constraints. + - cabal install "bytestring >= 0.10.2" 'Cabal == 1.24.*' -j + - cabal install criterion deepseq mtl "QuickCheck >= 2.8" HUnit "test-framework-quickcheck2 >= 0.3" "random >= 1.0.1.0" attoparsec cereal tar zlib -j script: - cabal configure --enable-tests --enable-benchmarks -v2 --ghc-options=-fno-spec-constr From git at git.haskell.org Sun Feb 26 20:35:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 20:35:42 +0000 (UTC) Subject: [commit: packages/binary] master: Set bytestring >= 0.10.4. (a0b156f) Message-ID: <20170226203542.384C23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/a0b156f6bc621cceba2ba2a44f969bb9db9196c2 >--------------------------------------------------------------- commit a0b156f6bc621cceba2ba2a44f969bb9db9196c2 Author: Lennart Kolmodin Date: Wed Feb 15 20:52:21 2017 +0100 Set bytestring >= 0.10.4. See #123. >--------------------------------------------------------------- a0b156f6bc621cceba2ba2a44f969bb9db9196c2 binary.cabal | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/binary.cabal b/binary.cabal index bde0fbe..69ae150 100644 --- a/binary.cabal +++ b/binary.cabal @@ -31,7 +31,7 @@ source-repository head location: git://github.com/kolmodin/binary.git library - build-depends: base >= 4.5.0.0 && < 5, bytestring >= 0.10.2, containers, array + build-depends: base >= 4.5.0.0 && < 5, bytestring >= 0.10.4, containers, array hs-source-dirs: src exposed-modules: Data.Binary, Data.Binary.Put, @@ -66,7 +66,7 @@ test-suite qc Arbitrary build-depends: base >= 4.5.0.0 && < 5, - bytestring >= 0.10.2, + bytestring >= 0.10.4, random>=1.0.1.0, test-framework, test-framework-quickcheck2 >= 0.3, @@ -86,7 +86,7 @@ test-suite read-write-file main-is: File.hs build-depends: base >= 4.5.0.0 && < 5, - bytestring >= 0.10.2, + bytestring >= 0.10.4, Cabal, directory, filepath, @@ -107,7 +107,7 @@ benchmark bench other-modules: MemBench build-depends: base >= 4.5.0.0 && < 5, - bytestring + bytestring >= 0.10.4 -- build dependencies from using binary source rather than depending on the library build-depends: array, containers c-sources: benchmarks/CBenchmark.c @@ -125,7 +125,7 @@ benchmark get build-depends: attoparsec, base >= 4.5.0.0 && < 5, - bytestring, + bytestring >= 0.10.4, cereal, criterion == 1.*, deepseq, @@ -144,7 +144,7 @@ benchmark put main-is: Put.hs build-depends: base >= 4.5.0.0 && < 5, - bytestring, + bytestring >= 0.10.4, criterion == 1.*, deepseq -- build dependencies from using binary source rather than depending on the library @@ -161,7 +161,7 @@ benchmark generics-bench main-is: GenericsBench.hs build-depends: base >= 4.5.0.0 && < 5, - bytestring, + bytestring >= 0.10.4, Cabal == 1.24.*, directory, filepath, @@ -187,7 +187,7 @@ benchmark builder main-is: Builder.hs build-depends: base >= 4.5.0.0 && < 5, - bytestring, + bytestring >= 0.10.4, criterion == 1.*, deepseq, mtl From git at git.haskell.org Sun Feb 26 20:35:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 20:35:48 +0000 (UTC) Subject: [commit: packages/binary] master: [travis-ci] Increase verbosity even further. (8d7c36f) Message-ID: <20170226203548.49D6B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/8d7c36f43e4f80460fca132dd655ce68a6752dcf >--------------------------------------------------------------- commit 8d7c36f43e4f80460fca132dd655ce68a6752dcf Author: Lennart Kolmodin Date: Thu Feb 16 08:00:25 2017 +0100 [travis-ci] Increase verbosity even further. >--------------------------------------------------------------- 8d7c36f43e4f80460fca132dd655ce68a6752dcf .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ceacc6c..c5999ea 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,7 +33,7 @@ install: - cabal sandbox init # can't use "cabal install --only-dependencies --enable-tests --enable-benchmarks" due to dep-cycle. # must split in two separate 'cabal install's since cabal doesn't update the cabal library before it's needed in 'cabal-version' constraints. - - cabal install "bytestring >= 0.10.4" 'Cabal == 1.24.*' -j -v + - cabal install "bytestring >= 0.10.4" 'Cabal == 1.24.*' -j -v2 - cabal install criterion deepseq mtl "QuickCheck >= 2.8" HUnit "test-framework-quickcheck2 >= 0.3" "random >= 1.0.1.0" attoparsec cereal tar zlib -j script: From git at git.haskell.org Sun Feb 26 20:35:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 20:35:44 +0000 (UTC) Subject: [commit: packages/binary] master: [travis-ci] Reflect bytestring >= 0.10.4 change in cabal file. (bc74e4a) Message-ID: <20170226203544.3E10D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/bc74e4a2a85a9dd266382b404a01f7e9b6e29bf1 >--------------------------------------------------------------- commit bc74e4a2a85a9dd266382b404a01f7e9b6e29bf1 Author: Lennart Kolmodin Date: Wed Feb 15 21:18:41 2017 +0100 [travis-ci] Reflect bytestring >= 0.10.4 change in cabal file. >--------------------------------------------------------------- bc74e4a2a85a9dd266382b404a01f7e9b6e29bf1 .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 703cd36..ec9d195 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,7 +33,7 @@ install: - cabal sandbox init # can't use "cabal install --only-dependencies --enable-tests --enable-benchmarks" due to dep-cycle. # must split in two separate 'cabal install's since cabal doesn't update the cabal library before it's needed in 'cabal-version' constraints. - - cabal install "bytestring >= 0.10.2" 'Cabal == 1.24.*' -j + - cabal install "bytestring >= 0.10.4" 'Cabal == 1.24.*' -j - cabal install criterion deepseq mtl "QuickCheck >= 2.8" HUnit "test-framework-quickcheck2 >= 0.3" "random >= 1.0.1.0" attoparsec cereal tar zlib -j script: From git at git.haskell.org Sun Feb 26 20:35:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 20:35:46 +0000 (UTC) Subject: [commit: packages/binary] master: [travis-ci] Increase verbosity to debug failure. (e93ff9f) Message-ID: <20170226203546.43E9C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/e93ff9fed1ccd11edf27f346fc4260f24f7a4c80 >--------------------------------------------------------------- commit e93ff9fed1ccd11edf27f346fc4260f24f7a4c80 Author: Lennart Kolmodin Date: Thu Feb 16 07:33:34 2017 +0100 [travis-ci] Increase verbosity to debug failure. >--------------------------------------------------------------- e93ff9fed1ccd11edf27f346fc4260f24f7a4c80 .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ec9d195..ceacc6c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,7 +33,7 @@ install: - cabal sandbox init # can't use "cabal install --only-dependencies --enable-tests --enable-benchmarks" due to dep-cycle. # must split in two separate 'cabal install's since cabal doesn't update the cabal library before it's needed in 'cabal-version' constraints. - - cabal install "bytestring >= 0.10.4" 'Cabal == 1.24.*' -j + - cabal install "bytestring >= 0.10.4" 'Cabal == 1.24.*' -j -v - cabal install criterion deepseq mtl "QuickCheck >= 2.8" HUnit "test-framework-quickcheck2 >= 0.3" "random >= 1.0.1.0" attoparsec cereal tar zlib -j script: From git at git.haskell.org Sun Feb 26 20:35:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 20:35:50 +0000 (UTC) Subject: [commit: packages/binary] master: [travis-ci] Compile with -j1. (169cd4d) Message-ID: <20170226203550.512B53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/169cd4d95a4482d68d58cc6ccec83a5c9363f45f >--------------------------------------------------------------- commit 169cd4d95a4482d68d58cc6ccec83a5c9363f45f Author: Lennart Kolmodin Date: Thu Feb 16 20:48:47 2017 +0100 [travis-ci] Compile with -j1. >--------------------------------------------------------------- 169cd4d95a4482d68d58cc6ccec83a5c9363f45f .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c5999ea..cc51972 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,7 +33,7 @@ install: - cabal sandbox init # can't use "cabal install --only-dependencies --enable-tests --enable-benchmarks" due to dep-cycle. # must split in two separate 'cabal install's since cabal doesn't update the cabal library before it's needed in 'cabal-version' constraints. - - cabal install "bytestring >= 0.10.4" 'Cabal == 1.24.*' -j -v2 + - cabal install "bytestring >= 0.10.4" 'Cabal == 1.24.*' -j1 -v2 - cabal install criterion deepseq mtl "QuickCheck >= 2.8" HUnit "test-framework-quickcheck2 >= 0.3" "random >= 1.0.1.0" attoparsec cereal tar zlib -j script: From git at git.haskell.org Sun Feb 26 20:35:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 20:35:52 +0000 (UTC) Subject: [commit: packages/binary] master: [travis-ci] Bump to cabal-install-1.20 for GHC 7.8.4. (19572ba) Message-ID: <20170226203552.57D3B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/19572bafdd6880e8e922f8830bb98f6a2d4020ea >--------------------------------------------------------------- commit 19572bafdd6880e8e922f8830bb98f6a2d4020ea Author: Lennart Kolmodin Date: Sat Feb 18 11:42:08 2017 +0100 [travis-ci] Bump to cabal-install-1.20 for GHC 7.8.4. Again, trying to resolve haskell/cabal#4331. >--------------------------------------------------------------- 19572bafdd6880e8e922f8830bb98f6a2d4020ea .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index cc51972..9ecf595 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,8 +10,8 @@ matrix: 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 - addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4], sources: [hvr-ghc]}} + - env: CABALVER=1.20 GHCVER=7.8.4 + addons: {apt: {packages: [cabal-install-1.20,ghc-7.8.4], 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=1.24 GHCVER=8.0.1 @@ -33,7 +33,7 @@ install: - cabal sandbox init # can't use "cabal install --only-dependencies --enable-tests --enable-benchmarks" due to dep-cycle. # must split in two separate 'cabal install's since cabal doesn't update the cabal library before it's needed in 'cabal-version' constraints. - - cabal install "bytestring >= 0.10.4" 'Cabal == 1.24.*' -j1 -v2 + - cabal install "bytestring >= 0.10.4" 'Cabal == 1.24.*' -j - cabal install criterion deepseq mtl "QuickCheck >= 2.8" HUnit "test-framework-quickcheck2 >= 0.3" "random >= 1.0.1.0" attoparsec cereal tar zlib -j script: From git at git.haskell.org Sun Feb 26 20:35:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 20:35:54 +0000 (UTC) Subject: [commit: packages/binary] master: [travis-ci] cabal-install-1.22 for GHC 7.8.4. (8ba7317) Message-ID: <20170226203554.5E54C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/8ba7317544fdbb75f8591679975f1e5846727490 >--------------------------------------------------------------- commit 8ba7317544fdbb75f8591679975f1e5846727490 Author: Lennart Kolmodin Date: Sat Feb 18 11:46:35 2017 +0100 [travis-ci] cabal-install-1.22 for GHC 7.8.4. >--------------------------------------------------------------- 8ba7317544fdbb75f8591679975f1e5846727490 .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9ecf595..f7beafe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,8 +10,8 @@ matrix: 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.20 GHCVER=7.8.4 - addons: {apt: {packages: [cabal-install-1.20,ghc-7.8.4], sources: [hvr-ghc]}} + - env: CABALVER=1.22 GHCVER=7.8.4 + addons: {apt: {packages: [cabal-install-1.22,ghc-7.8.4], 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=1.24 GHCVER=8.0.1 From git at git.haskell.org Sun Feb 26 20:35:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 20:35:56 +0000 (UTC) Subject: [commit: packages/binary] master: Add Binary instances for Typeable TypeReps (#131) (42bba1c) Message-ID: <20170226203556.661053A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/42bba1c09c9e1030c3b8a40e5de059daf9d73625 >--------------------------------------------------------------- commit 42bba1c09c9e1030c3b8a40e5de059daf9d73625 Author: Ben Gamari Date: Sat Feb 25 09:01:12 2017 +0000 Add Binary instances for Typeable TypeReps (#131) >--------------------------------------------------------------- 42bba1c09c9e1030c3b8a40e5de059daf9d73625 src/Data/Binary/Class.hs | 205 +++++++++++++++++++++++++++++++++++++++++++++-- tests/QC.hs | 35 +++++++- 2 files changed, 234 insertions(+), 6 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 42bba1c09c9e1030c3b8a40e5de059daf9d73625 From git at git.haskell.org Sun Feb 26 21:18:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 21:18:36 +0000 (UTC) Subject: [commit: ghc] master: build system: Persist CrossCompiling in binary distributions (a7eeb60) Message-ID: <20170226211836.CE0BA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a7eeb607e62bb360327d834fc6dd5ea6195ae825/ghc >--------------------------------------------------------------- commit a7eeb607e62bb360327d834fc6dd5ea6195ae825 Author: Ben Gamari Date: Sun Feb 26 15:32:59 2017 -0500 build system: Persist CrossCompiling in binary distributions The build system uses the CrossCompiling variable to decide whether or not we should build various packages that must be built using the compiler. Consequently, it is important that we persist its value in the binary distribution so we know during `make install` not to go looking for files that would have been built for these packages. Failing to do this causes #13325. Test Plan: Cross compile, `make binary-dist`, and try installing the binary distribution on the target Reviewers: hvr, austin, trofi, rwbarton Reviewed By: trofi, rwbarton Subscribers: carter, trofi, rwbarton, erikd, thomie, snowleopard, davean Differential Revision: https://phabricator.haskell.org/D3187 >--------------------------------------------------------------- a7eeb607e62bb360327d834fc6dd5ea6195ae825 ghc.mk | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/ghc.mk b/ghc.mk index 19b0e49..b2888c0 100644 --- a/ghc.mk +++ b/ghc.mk @@ -1073,6 +1073,17 @@ endif BIN_DIST_MK = $(BIN_DIST_PREP_DIR)/bindist.mk +# Note [Persist CrossCompiling in binary distributions] +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# The build system uses the CrossCompiling variable to decide whether or not we +# should build various packages that must be built using the compiler. +# Consequently, it is important that we persist its value in the binary +# distribution so we know during `make install` not to go looking for files that +# would have been built for these packages. Failing to do this causes #13325. +# +# See Note [No stage2 packages when CrossCompiling or Stage1Only]. + unix-binary-dist-prep: $(call removeTrees,bindistprep/) "$(MKDIRHIER)" $(BIN_DIST_PREP_DIR) @@ -1083,6 +1094,8 @@ unix-binary-dist-prep: echo "BUILD_MAN = $(BUILD_MAN)" >> $(BIN_DIST_MK) echo "override ghc-cabal_INPLACE = utils/ghc-cabal/dist-install/build/tmp/ghc-cabal-bindist" >> $(BIN_DIST_MK) echo "UseSystemLibFFI = $(UseSystemLibFFI)" >> $(BIN_DIST_MK) +# See Note [Persist CrossCompiling in binary distributions] + echo "CrossCompiling = $(CrossCompiling)" >> $(BIN_DIST_MK) cd $(BIN_DIST_PREP_DIR) && autoreconf $(call removeFiles,$(BIN_DIST_PREP_TAR)) # h means "follow symlinks", e.g. if aclocal.m4 is a symlink to a source @@ -1484,6 +1497,11 @@ endif # [5]. Therefore in this case we also have to exclude the stage2 packages # from the build. # +# Because we omit certain packages from the build when CrossCompiling=YES, +# it is important that we remember the value of CrossCompiling in binary +# distributions that we produce. See Note [Persist CrossCompiling in binary +# distributions]. +# # [1] find utils -name ghc.mk | xargs grep -l 'build-prog.*,2' # # [2] From git at git.haskell.org Sun Feb 26 21:18:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 21:18:39 +0000 (UTC) Subject: [commit: ghc] master: Coercion: Try dropping constraintIsLifted axiom (d2f4849) Message-ID: <20170226211839.834953A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d2f48495ebe79b5ef5808a4891b3d03dfd297d35/ghc >--------------------------------------------------------------- commit d2f48495ebe79b5ef5808a4891b3d03dfd297d35 Author: Ben Gamari Date: Sun Feb 26 15:33:54 2017 -0500 Coercion: Try dropping constraintIsLifted axiom While working through the FunCo patch I encountered some lint issues which suggested that `Constraint` wasn't being considered equal to `TYPE 'LiftedRep`. Consequently I introduced this axiom and associated messy ball of logic to explicitly coerce `Constraint`. However, as @goldfire points out on D3208 this really shouldn't be necessary. Indeed, I tried ripping out the axiom and things appear to just work. I suspect the issue motivating the axiom was a bug elsewhere in the FunCo branch that I fixed during development. Test Plan: Validate Reviewers: simonpj, goldfire, austin Reviewed By: goldfire Subscribers: thomie, goldfire Differential Revision: https://phabricator.haskell.org/D3218 >--------------------------------------------------------------- d2f48495ebe79b5ef5808a4891b3d03dfd297d35 compiler/types/Coercion.hs | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/compiler/types/Coercion.hs b/compiler/types/Coercion.hs index f579145..d195b2f 100644 --- a/compiler/types/Coercion.hs +++ b/compiler/types/Coercion.hs @@ -108,7 +108,6 @@ module Coercion ( import TyCoRep import Type -import Kind import TyCon import CoAxiom import Var @@ -116,14 +115,12 @@ import VarEnv import Name hiding ( varName ) import Util import BasicTypes -import FastString import Outputable import Unique import Pair import SrcLoc import PrelNames import TysPrim ( eqPhantPrimTyCon ) -import {-# SOURCE #-} TysWiredIn ( constraintKind ) import ListSetOps import Maybes import UniqFM @@ -404,45 +401,14 @@ mkHeteroCoercionType Nominal = mkHeteroPrimEqPred mkHeteroCoercionType Representational = mkHeteroReprPrimEqPred mkHeteroCoercionType Phantom = panic "mkHeteroCoercionType" -constraintIsLifted :: CoAxiomRule -constraintIsLifted = - CoAxiomRule { coaxrName = mkFastString "constraintIsLifted" - , coaxrAsmpRoles = [] - , coaxrRole = Nominal - , coaxrProves = - const $ Just $ Pair constraintKind liftedTypeKind - } - -- | Given a coercion @co1 :: (a :: TYPE r1) ~ (b :: TYPE r2)@, -- produce a coercion @rep_co :: r1 ~ r2 at . mkRuntimeRepCo :: Coercion -> Coercion mkRuntimeRepCo co - -- This is currently a bit tricky since we can see types of kind Constraint - -- in addition to the usual things of kind (TYPE rep). We first map - -- Constraint-kinded types to (TYPE 'LiftedRep). - -- FIXME: this is terrible - | isConstraintKind a && isConstraintKind b - = mkNthCo 0 $ constraintToLifted - $ mkSymCo $ constraintToLifted $ mkSymCo kind_co - - | isConstraintKind a - = WARN( True, text "mkRuntimeRepCo" ) - mkNthCo 0 - $ mkSymCo $ constraintToLifted $ mkSymCo kind_co - - | isConstraintKind b - = WARN( True, text "mkRuntimeRepCo" ) - mkNthCo 0 $ constraintToLifted kind_co - - | otherwise = mkNthCo 0 kind_co where - -- the right side of a coercion from Constraint to TYPE 'LiftedRep - constraintToLifted = (`mkTransCo` mkAxiomRuleCo constraintIsLifted []) - kind_co = mkKindCo co -- kind_co :: TYPE r1 ~ TYPE r2 -- (up to silliness with Constraint) - Pair a b = coercionKind kind_co -- Pair of (TYPE r1, TYPE r2) -- | Tests if this coercion is obviously reflexive. Guaranteed to work -- very quickly. Sometimes a coercion can be reflexive, but not obviously From git at git.haskell.org Sun Feb 26 21:18:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 21:18:42 +0000 (UTC) Subject: [commit: ghc] master: Move Typeable Binary instances to binary package (bcffc35) Message-ID: <20170226211842.36DCD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/bcffc35c662a4074f515b912b80f2f3c90421361/ghc >--------------------------------------------------------------- commit bcffc35c662a4074f515b912b80f2f3c90421361 Author: Ben Gamari Date: Wed Feb 8 23:00:46 2017 -0500 Move Typeable Binary instances to binary package Bumps binary submodule. >--------------------------------------------------------------- bcffc35c662a4074f515b912b80f2f3c90421361 libraries/binary | 2 +- libraries/ghci/GHCi/TH/Binary.hs | 177 ++------------------------------------- 2 files changed, 9 insertions(+), 170 deletions(-) diff --git a/libraries/binary b/libraries/binary index af1d17c..42bba1c 160000 --- a/libraries/binary +++ b/libraries/binary @@ -1 +1 @@ -Subproject commit af1d17c27867f644886fcbc4703eb3e48792f3e7 +Subproject commit 42bba1c09c9e1030c3b8a40e5de059daf9d73625 diff --git a/libraries/ghci/GHCi/TH/Binary.hs b/libraries/ghci/GHCi/TH/Binary.hs index fcff168..ae6bc9f 100644 --- a/libraries/ghci/GHCi/TH/Binary.hs +++ b/libraries/ghci/GHCi/TH/Binary.hs @@ -10,18 +10,12 @@ module GHCi.TH.Binary () where import Data.Binary import qualified Data.ByteString as B -#if MIN_VERSION_base(4,10,0) -import Type.Reflection -import Type.Reflection.Unsafe -import Data.Kind (Type) -import GHC.Exts (RuntimeRep(..), VecCount, VecElem) -#else -import Data.Typeable -#endif import GHC.Serialized import qualified Language.Haskell.TH as TH import qualified Language.Haskell.TH.Syntax as TH - +#if !MIN_VERSION_base(4,10,0) +import Data.Typeable +#endif -- Put these in a separate module because they take ages to compile instance Binary TH.Loc @@ -79,163 +73,12 @@ instance Binary TH.PatSynArgs -- We need Binary TypeRep for serializing annotations -#if MIN_VERSION_base(4,10,0) -instance Binary VecCount where - put = putWord8 . fromIntegral . fromEnum - get = toEnum . fromIntegral <$> getWord8 - -instance Binary VecElem where - put = putWord8 . fromIntegral . fromEnum - get = toEnum . fromIntegral <$> getWord8 - -instance Binary RuntimeRep where - put (VecRep a b) = putWord8 0 >> put a >> put b - put (TupleRep reps) = putWord8 1 >> put reps - put (SumRep reps) = putWord8 2 >> put reps - put LiftedRep = putWord8 3 - put UnliftedRep = putWord8 4 - put IntRep = putWord8 5 - put WordRep = putWord8 6 - put Int64Rep = putWord8 7 - put Word64Rep = putWord8 8 - put AddrRep = putWord8 9 - put FloatRep = putWord8 10 - put DoubleRep = putWord8 11 - - get = do - tag <- getWord8 - case tag of - 0 -> VecRep <$> get <*> get - 1 -> TupleRep <$> get - 2 -> SumRep <$> get - 3 -> pure LiftedRep - 4 -> pure UnliftedRep - 5 -> pure IntRep - 6 -> pure WordRep - 7 -> pure Int64Rep - 8 -> pure Word64Rep - 9 -> pure AddrRep - 10 -> pure FloatRep - 11 -> pure DoubleRep - _ -> fail "GHCi.TH.Binary.putRuntimeRep: invalid tag" - -instance Binary TyCon where - put tc = do - put (tyConPackage tc) - put (tyConModule tc) - put (tyConName tc) - put (tyConKindArgs tc) - put (tyConKindRep tc) - get = mkTyCon <$> get <*> get <*> get <*> get <*> get - -instance Binary KindRep where - put (KindRepTyConApp tc k) = putWord8 0 >> put tc >> put k - put (KindRepVar bndr) = putWord8 1 >> put bndr - put (KindRepApp a b) = putWord8 2 >> put a >> put b - put (KindRepFun a b) = putWord8 3 >> put a >> put b - put (KindRepTYPE r) = putWord8 4 >> put r - put (KindRepTypeLit sort r) = putWord8 5 >> put sort >> put r - put _ = fail "GHCi.TH.Binary.putKindRep: Impossible" - - get = do - tag <- getWord8 - case tag of - 0 -> KindRepTyConApp <$> get <*> get - 1 -> KindRepVar <$> get - 2 -> KindRepApp <$> get <*> get - 3 -> KindRepFun <$> get <*> get - 4 -> KindRepTYPE <$> get - 5 -> KindRepTypeLit <$> get <*> get - _ -> fail "GHCi.TH.Binary.putKindRep: invalid tag" - -instance Binary TypeLitSort where - put TypeLitSymbol = putWord8 0 - put TypeLitNat = putWord8 1 - get = do - tag <- getWord8 - case tag of - 0 -> pure TypeLitSymbol - 1 -> pure TypeLitNat - _ -> fail "GHCi.TH.Binary.putTypeLitSort: invalid tag" - -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 -- Handle Type specially since it's so common - | Just HRefl <- rep `eqTypeRep` (typeRep :: TypeRep Type) - = put (0 :: Word8) -putTypeRep (Con' con ks) = do - put (1 :: Word8) - put con - put ks -putTypeRep (App f x) = do - put (2 :: Word8) - putTypeRep f - putTypeRep x -putTypeRep (Fun arg res) = do - put (3 :: Word8) - putTypeRep arg - putTypeRep res -putTypeRep _ = fail "GHCi.TH.Binary.putTypeRep: Impossible" - -getSomeTypeRep :: Get SomeTypeRep -getSomeTypeRep = do - tag <- get :: Get Word8 - case tag of - 0 -> return $ SomeTypeRep (typeRep :: TypeRep Type) - 1 -> do con <- get :: Get TyCon - ks <- get :: Get [SomeTypeRep] - return $ SomeTypeRep $ mkTrCon con ks - 2 -> do SomeTypeRep f <- getSomeTypeRep - SomeTypeRep x <- getSomeTypeRep - case typeRepKind f of - Fun arg res -> - case arg `eqTypeRep` typeRepKind x of - Just HRefl -> do - case typeRepKind res `eqTypeRep` (typeRep :: TypeRep Type) of - Just HRefl -> return $ SomeTypeRep $ mkTrApp f x - _ -> failure "Kind mismatch" [] - _ -> failure "Kind mismatch" - [ "Found argument of kind: " ++ show (typeRepKind x) - , "Where the constructor: " ++ show f - , "Expects an argument of kind: " ++ show arg - ] - _ -> failure "Applied non-arrow type" - [ "Applied type: " ++ show f - , "To argument: " ++ show x - ] - 3 -> do SomeTypeRep arg <- getSomeTypeRep - SomeTypeRep res <- getSomeTypeRep - case typeRepKind arg `eqTypeRep` (typeRep :: TypeRep Type) of - Just HRefl -> - case typeRepKind res `eqTypeRep` (typeRep :: TypeRep Type) of - Just HRefl -> return $ SomeTypeRep $ Fun arg res - Nothing -> failure "Kind mismatch" [] - Nothing -> failure "Kind mismatch" [] - _ -> failure "Invalid SomeTypeRep" [] - where - failure description info = - fail $ unlines $ [ "GHCi.TH.Binary.getSomeTypeRep: "++description ] - ++ map (" "++) info - -instance Typeable a => Binary (TypeRep (a :: k)) where - put = putTypeRep - get = do - SomeTypeRep rep <- getSomeTypeRep - case rep `eqTypeRep` expected of - Just HRefl -> pure rep - Nothing -> fail $ unlines - [ "GHCi.TH.Binary: Type mismatch" - , " Deserialized type: " ++ show rep - , " Expected type: " ++ show expected - ] - where expected = typeRep :: TypeRep a +instance Binary Serialized where + put (Serialized tyrep wds) = put tyrep >> put (B.pack wds) + get = Serialized <$> get <*> (B.unpack <$> get) -instance Binary SomeTypeRep where - put (SomeTypeRep rep) = putTypeRep rep - get = getSomeTypeRep -#else +-- Typeable and related instances live in binary since GHC 8.2 +#if !MIN_VERSION_base(4,10,0) instance Binary TyCon where put tc = put (tyConPackage tc) >> put (tyConModule tc) >> put (tyConName tc) get = mkTyCon3 <$> get <*> get <*> get @@ -246,7 +89,3 @@ instance Binary TypeRep where (ty_con, child_type_reps) <- get return (mkTyConApp ty_con child_type_reps) #endif - -instance Binary Serialized where - put (Serialized tyrep wds) = put tyrep >> put (B.pack wds) - get = Serialized <$> get <*> (B.unpack <$> get) From git at git.haskell.org Sun Feb 26 22:26:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 22:26:33 +0000 (UTC) Subject: [commit: ghc] master: Ensure that Literals are in range (6dfc5eb) Message-ID: <20170226222633.F12F13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6dfc5ebf70df8f0fdccc5004d914b777f21f3b72/ghc >--------------------------------------------------------------- commit 6dfc5ebf70df8f0fdccc5004d914b777f21f3b72 Author: Joachim Breitner Date: Sun Feb 26 16:27:52 2017 -0500 Ensure that Literals are in range This commit fixes several bugs related to case expressions involving numeric literals which are not in the range of values of their (fixed-width, integral) type. There is a new invariant on Literal: The argument of a MachInt[64] or MachWord[64] must lie within the range of the corresponding primitive type Int[64]# or Word[64]#, as defined by the target machine. This invariant is enforced in mkMachInt[64]/mkMachWord[64] by wrapping the argument to the target type's range if necessary. Test Plan: Test Plan: make slowtest TEST="T9533 T9533b T9533c T10245 T10246" Trac issues: #9533, #10245, #10246, #13171 Reviewers: simonmar, simonpj, austin, bgamari, nomeata Reviewed By: bgamari Subscribers: thomie, rwbarton Differential Revision: https://phabricator.haskell.org/D810 >--------------------------------------------------------------- 6dfc5ebf70df8f0fdccc5004d914b777f21f3b72 compiler/basicTypes/Literal.hs | 81 +++++++++++++++++----- compiler/deSugar/Match.hs | 45 ++++++++++-- compiler/deSugar/MatchLit.hs | 43 +++++------- compiler/simplCore/SimplUtils.hs | 3 +- testsuite/tests/codeGen/should_run/T9533.hs | 13 ++++ .../should_run/T9533.stdout} | 0 testsuite/tests/codeGen/should_run/T9533b.hs | 8 +++ testsuite/tests/codeGen/should_run/T9533b.stdout | 1 + testsuite/tests/codeGen/should_run/T9533c.hs | 8 +++ .../should_run/T9533c.stdout} | 0 testsuite/tests/codeGen/should_run/all.T | 7 +- 11 files changed, 157 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 6dfc5ebf70df8f0fdccc5004d914b777f21f3b72 From git at git.haskell.org Sun Feb 26 22:26:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 22:26:27 +0000 (UTC) Subject: [commit: ghc] master: users-guide: Add documentation for JSON profile format (b494689) Message-ID: <20170226222627.2C9B33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b494689c30fd0394423f264792530d1f352e1ee7/ghc >--------------------------------------------------------------- commit b494689c30fd0394423f264792530d1f352e1ee7 Author: Ben Gamari Date: Sun Feb 26 16:21:09 2017 -0500 users-guide: Add documentation for JSON profile format Reviewers: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3184 >--------------------------------------------------------------- b494689c30fd0394423f264792530d1f352e1ee7 docs/users_guide/profiling.rst | 153 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 151 insertions(+), 2 deletions(-) diff --git a/docs/users_guide/profiling.rst b/docs/users_guide/profiling.rst index 27b8839..764ee92 100644 --- a/docs/users_guide/profiling.rst +++ b/docs/users_guide/profiling.rst @@ -429,6 +429,155 @@ enclosed between ``+RTS ... -RTS`` as usual): notorious ``Prelude.head: empty list`` error. See :ref:`rts-options-debugging`. + +JSON profile format +~~~~~~~~~~~~~~~~~~~ + +When invoked with the :rts-flag:`-pj` flag the runtime will emit the cost-centre +profile in a machine-readable JSON format. The top-level object of this format +has the following properties, + +``program`` (string) + The name of the program +``arguments`` (list of strings) + The command line arguments passed to the program +``rts_arguments`` (list of strings) + The command line arguments passed to the runtime system +``initial_capabilities`` (integral number) + How many capabilities the program was started with (e.g. using the + :rts-flag:`-N` option). Note that the number of capabilities may change + during execution due to the ``setNumCapabilities`` function. +``total_time`` (number) + The total wall time of the program's execution in seconds. +``total_ticks`` (integral number) + How many profiler "ticks" elapsed over the course of the program's execution. +``end_time`` (number) + The approximate time when the program finished execution as a UNIX epoch timestamp. +``tick_interval`` (float) + How much time between profiler ticks. +``total_alloc`` (integer) + The cumulative allocations of the program in bytes. +``cost_centres`` (list of objects) + A list of the program's cost centres +``profile`` (object) + The profile tree itself + +Each entry in ``cost_centres`` is an object describing a cost-centre of the +program having the following properies, + +``id`` (integral number) + A unique identifier used to refer to the cost-centre +``is_caf`` (boolean) + Whether the cost-centre is a Constant Applicative Form (CAF) +``label`` (string) + A descriptive string roughly identifying the cost-centre. +``src_loc`` (string) + A string describing the source span enclosing the cost-centre. + +The profile data itself is described by the ``profile`` field, which contains a +tree-like object (which we'll call a "cost-centre stack" here) with the +following properties, + +``id`` (integral number) + The ``id`` of a cost-center listed in the ``cost_centres`` list. +``entries`` (integral number) + How many times was this cost-centre entered? +``ticks`` (integral number) + How many ticks was the program's execution inside of this cost-centre? This + does not include child cost-centres. +``alloc`` (integral number) + How many bytes did the program allocate while inside of this cost-centre? + This does not include allocations while in child cost-centres. +``children`` (list) + A list containing child cost-centre stacks. + +For instance, a simple profile might look like this, + +.. code-block:: json + + { + "program": "Main", + "arguments": [ + "nofib/shootout/n-body/Main", + "50000" + ], + "rts_arguments": [ + "-pj", + "-hy" + ], + "end_time": "Thu Feb 23 17:15 2017", + "initial_capabilities": 0, + "total_time": 1.7, + "total_ticks": 1700, + "tick_interval": 1000, + "total_alloc": 3770785728, + "cost_centres": [ + { + "id": 168, + "label": "IDLE", + "module": "IDLE", + "src_loc": "", + "is_caf": false + }, + { + "id": 156, + "label": "CAF", + "module": "GHC.Integer.Logarithms.Internals", + "src_loc": "", + "is_caf": true + }, + { + "id": 155, + "label": "CAF", + "module": "GHC.Integer.Logarithms", + "src_loc": "", + "is_caf": true + }, + { + "id": 154, + "label": "CAF", + "module": "GHC.Event.Array", + "src_loc": "", + "is_caf": true + } + ... + ], + "profile": { + "id": 162, + "entries": 0, + "alloc": 688, + "ticks": 0, + "children": [ + { + "id": 1, + "entries": 0, + "alloc": 208, + "ticks": 0, + "children": [ + { + "id": 22, + "entries": 1, + "alloc": 80, + "ticks": 0, + "children": [] + } + ] + }, + { + "id": 42, + "entries": 1, + "alloc": 1632, + "ticks": 0, + "children": [] + } + ] + } + } + + + + + .. _prof-heap: Profiling memory usage @@ -892,8 +1041,8 @@ The flags are: .. _manipulating-hp: -Manipulating the hp file -~~~~~~~~~~~~~~~~~~~~~~~~ +Manipulating the ``hp`` file +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (Notes kindly offered by Jan-Willem Maessen.) From git at git.haskell.org Sun Feb 26 22:26:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 22:26:30 +0000 (UTC) Subject: [commit: ghc] master: Add support for concurrent package db access and updates (0d86aa5) Message-ID: <20170226222630.55A5C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0d86aa5904e5a06c93632357122e57e4e118fd2a/ghc >--------------------------------------------------------------- commit 0d86aa5904e5a06c93632357122e57e4e118fd2a Author: Andrzej Rybczak Date: Sun Feb 26 16:25:17 2017 -0500 Add support for concurrent package db access and updates Trac issues: #13194 Reviewers: austin, hvr, erikd, bgamari, dfeuer, duncan Subscribers: DemiMarie, dfeuer, thomie Differential Revision: https://phabricator.haskell.org/D3090 >--------------------------------------------------------------- 0d86aa5904e5a06c93632357122e57e4e118fd2a libraries/base/GHC/IO/Handle.hs | 15 +- libraries/base/GHC/IO/Handle/FD.hs | 31 +-- libraries/base/GHC/IO/Handle/Lock.hsc | 162 ++++++++++++++ libraries/base/base.cabal | 1 + libraries/base/configure.ac | 8 +- libraries/ghc-boot/GHC/PackageDb.hs | 150 ++++++++++++- utils/ghc-pkg/Main.hs | 390 ++++++++++++++++++++++------------ 7 files changed, 600 insertions(+), 157 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 0d86aa5904e5a06c93632357122e57e4e118fd2a From git at git.haskell.org Sun Feb 26 23:14:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 23:14:59 +0000 (UTC) Subject: [commit: packages/hpc] master: tests: manual extra_files, extra_clean cleanup (5caceac) Message-ID: <20170226231459.1C8B83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hpc On branch : master Link : http://git.haskell.org/packages/hpc.git/commitdiff/5caceac7a05741f87f970e1d3f572b1fd8f10cec >--------------------------------------------------------------- commit 5caceac7a05741f87f970e1d3f572b1fd8f10cec Author: Reid Barton Date: Fri Feb 24 20:53:31 2017 -0500 tests: manual extra_files, extra_clean cleanup >--------------------------------------------------------------- 5caceac7a05741f87f970e1d3f572b1fd8f10cec tests/function/test.T | 4 +--- tests/function2/test.T | 3 --- tests/ghc_ghci/test.T | 3 +-- tests/raytrace/tixs/test.T | 6 +++--- tests/simple/test.T | 3 ++- tests/simple/tixs/test.T | 19 +++++++++++-------- 6 files changed, 18 insertions(+), 20 deletions(-) diff --git a/tests/function/test.T b/tests/function/test.T index a5515d9..0ba3edd 100644 --- a/tests/function/test.T +++ b/tests/function/test.T @@ -3,8 +3,6 @@ setTestOpts([omit_ways(['ghci']), when(fast(), skip)]) hpc_prefix = "perl hpcrun.pl --clear --exeext={exeext} --hpc={hpc}" test('tough', - [cmd_prefix(hpc_prefix), - extra_clean(['Main.hs.html', 'hpc_index.html', 'hpc_index_alt.html', - 'hpc_index_exp.html', 'hpc_index_fun.html', 'tough.tix'])], + [cmd_prefix(hpc_prefix)], compile_and_run, ['-fhpc']) diff --git a/tests/function2/test.T b/tests/function2/test.T index b37cc40..6f0a2d7 100644 --- a/tests/function2/test.T +++ b/tests/function2/test.T @@ -8,9 +8,6 @@ hpc_prefix = "perl hpcrun.pl --clear --exeext={exeext} --hpc={hpc}" # source file. test('tough2', [ literate, - extra_clean(['Main.hs.html', 'hpc_index.html', 'hpc_index_alt.html', - 'hpc_index_exp.html', 'hpc_index_fun.html', - 'subdir/tough2.hi', 'subdir/tough2.o', 'tough2.tix']), cmd_prefix(hpc_prefix), omit_ways(['ghci'] + prof_ways) ], # profile goes in the wrong place multimod_compile_and_run, ['subdir/tough2.lhs', '-fhpc']) diff --git a/tests/ghc_ghci/test.T b/tests/ghc_ghci/test.T index 28b658e..fe2a552 100644 --- a/tests/ghc_ghci/test.T +++ b/tests/ghc_ghci/test.T @@ -1,5 +1,4 @@ test('hpc_ghc_ghci', - [extra_clean(['A.hi', 'A.o', '.hpc/A.mix', '.hpc/']), - only_ways(['normal']), when(compiler_profiled(), skip), req_interp], + [only_ways(['normal']), when(compiler_profiled(), skip), req_interp], run_command, ['$MAKE -s --no-print-directory hpc_ghc_ghci']) diff --git a/tests/raytrace/tixs/test.T b/tests/raytrace/tixs/test.T index 9df587f..9895612 100644 --- a/tests/raytrace/tixs/test.T +++ b/tests/raytrace/tixs/test.T @@ -7,13 +7,13 @@ test('hpc_report_multi_002', normal, run_command, 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, +test('hpc_markup_multi_001', normal, run_command, ["{hpc} markup --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, +test('hpc_markup_multi_002', normal, run_command, ["{hpc} markup --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, +test('hpc_markup_multi_003', normal, run_command, ["{hpc} markup --hpcdir=tixs/.hpc --hpcdir=hpc_markup_multi_003/.hpc --destdir=markup_multi_003" " hpc_sample --fun-entry-count"]) diff --git a/tests/simple/test.T b/tests/simple/test.T index 375a97a..a2c2241 100644 --- a/tests/simple/test.T +++ b/tests/simple/test.T @@ -2,5 +2,6 @@ setTestOpts([omit_ways(['ghci']), when(fast(), skip)]) hpc_prefix = "perl hpcrun.pl --clear --exeext={exeext} --hpc={hpc}" -test('hpc001', cmd_prefix(hpc_prefix), compile_and_run, ['-fhpc']) +test('hpc001', [extra_files(['../hpcrun.pl']), cmd_prefix(hpc_prefix)], + compile_and_run, ['-fhpc']) diff --git a/tests/simple/tixs/test.T b/tests/simple/tixs/test.T index 19fae7e..554d779 100644 --- a/tests/simple/tixs/test.T +++ b/tests/simple/tixs/test.T @@ -20,10 +20,10 @@ test('hpc_markup_error_001', exit_code(1), run_command, ["{hpc} markup"]) # no .tix file test('hpc_markup_error_002', exit_code(1), run_command, ["{hpc} markup hpc001.hs"]) # bad .tix file -test('hpc_markup_001', extra_clean(['markup_001/*']), run_command, +test('hpc_markup_001', normal, run_command, ["{hpc} markup --verbosity=0 --destdir=markup_001" " hpc_sample.tix --highlight-covered; cat markup_001/Main.hs.html"]) -test('hpc_markup_002', extra_clean(['markup_002/*']), run_command, +test('hpc_markup_002', normal, run_command, ["{hpc} markup --verbosity=0 --destdir=markup_002" " hpc_sample.tix --fun-entry-count; cat markup_002/Main.hs.html"]) @@ -43,7 +43,7 @@ test('hpc_draft', normal, run_command, ["{hpc} draft hpc_sample.tix"]) test('hpc_help_overlay', normal, run_command, ["{hpc} help overlay"]) test('hpc_overlay', - [extra_clean(['sample_overlay1.tix', 'total1.tix'])], + normal, run_command, ["({hpc} overlay sample_overlay.ovr > sample_overlay1.tix; " "cat sample_overlay1.tix; echo; " @@ -51,7 +51,7 @@ test('hpc_overlay', "{hpc} report total1.tix)"]) test('hpc_overlay2', - [extra_clean(['sample_overlay2.tix', 'total2.tix'])], + normal, run_command, ["({hpc} overlay sample_overlay.ovr --output=sample_overlay2.tix; " "cat sample_overlay2.tix; echo; " @@ -59,7 +59,7 @@ test('hpc_overlay2', "{hpc} report total2.tix)"]) test('hpc_hand_overlay', - [extra_clean(['sample_overlay3.tix', 'total3.tix'])], + normal, run_command, ["({hpc} overlay hand_overlay.ovr --output=sample_overlay3.tix; " "cat sample_overlay3.tix; echo; " @@ -73,9 +73,12 @@ test('T9619', ignore_stdout, run_command, ["{hpc} report hpc_sample.tix --hpcdir=.hpc --hpcdir=.hpc.copy"]) # Show different error messages for different types of failures. -test('T10529a', exit_code(1), run_command, +test('T10529a', [extra_files(['hpc_sample_non_existing_module.tix']), + exit_code(1)], run_command, ["{hpc} report hpc_sample_non_existing_module.tix"]) -test('T10529b', exit_code(1), run_command, +test('T10529b', [extra_files(['.hpc/', 'hpc_sample_incompatible_hash.tix']), + exit_code(1)], run_command, ["{hpc} report hpc_sample_incompatible_hash.tix"]) -test('T10529c', exit_code(1), run_command, +test('T10529c', [extra_files(['.hpc/', 'hpc_sample_no_parse.tix']), + exit_code(1)], run_command, ["{hpc} report hpc_sample_no_parse.tix"]) From git at git.haskell.org Sun Feb 26 23:15:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 23:15:01 +0000 (UTC) Subject: [commit: packages/hpc] master: tests: automatically move extra_files (b28546c) Message-ID: <20170226231501.22EC43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hpc On branch : master Link : http://git.haskell.org/packages/hpc.git/commitdiff/b28546ca003c6dbff586609a093e8c8091c34b14 >--------------------------------------------------------------- commit b28546ca003c6dbff586609a093e8c8091c34b14 Author: Reid Barton Date: Fri Feb 24 21:11:43 2017 -0500 tests: automatically move extra_files >--------------------------------------------------------------- b28546ca003c6dbff586609a093e8c8091c34b14 tests/fork/test.T | 3 ++- tests/function/test.T | 3 ++- tests/function2/test.T | 3 ++- tests/ghc_ghci/test.T | 3 ++- tests/raytrace/test.T | 3 ++- tests/raytrace/tixs/test.T | 16 ++++++++-------- tests/simple/tixs/test.T | 23 ++++++++++++----------- 7 files changed, 30 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 b28546ca003c6dbff586609a093e8c8091c34b14 From git at git.haskell.org Sun Feb 26 23:15:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 23:15:20 +0000 (UTC) Subject: [commit: ghc] master: Manually move extra_files for tests T9579_* (35b5790) Message-ID: <20170226231520.80FC23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/35b5790ea1849821749c8527663463613dc945e7/ghc >--------------------------------------------------------------- commit 35b5790ea1849821749c8527663463613dc945e7 Author: Reid Barton Date: Fri Feb 24 19:58:03 2017 -0500 Manually move extra_files for tests T9579_* Summary: My script won't understand this. Test Plan: validate Reviewers: austin, bgamari, simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3210 >--------------------------------------------------------------- 35b5790ea1849821749c8527663463613dc945e7 testsuite/driver/extra_files.py | 8 -------- testsuite/tests/rts/T9579/all.T | 3 +-- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/testsuite/driver/extra_files.py b/testsuite/driver/extra_files.py index 28e9348..c7a1d12 100644 --- a/testsuite/driver/extra_files.py +++ b/testsuite/driver/extra_files.py @@ -132,14 +132,6 @@ extra_src_files = { 'T8602': ['A.hs'], 'T9293': ['ghci057.hs'], 'T9562': ['A.hs', 'B.hs', 'B.hs-boot', 'C.hs', 'D.hs', 'Main.hs'], - 'T9579_outofheap_rtsall': ['OutOfHeap.hs'], - 'T9579_outofheap_rtsall_no_suggestions': ['OutOfHeap.hs'], - 'T9579_outofheap_rtsnone': ['OutOfHeap.hs'], - 'T9579_outofheap_rtssome': ['OutOfHeap.hs'], - 'T9579_stackoverflow_rtsall': ['StackOverflow.hs'], - 'T9579_stackoverflow_rtsall_no_suggestions': ['StackOverflow.hs'], - 'T9579_stackoverflow_rtsnone': ['StackOverflow.hs'], - 'T9579_stackoverflow_rtssome': ['StackOverflow.hs'], 'T9619': ['.hpc', '.hpc.copy', 'hpc_sample.tix'], 'T9646': ['Main.hs', 'Natural.hs', 'StrictPrim.hs', 'Type.hs'], 'T9930fail': ['T9930'], diff --git a/testsuite/tests/rts/T9579/all.T b/testsuite/tests/rts/T9579/all.T index a8522bf..cc0180e 100644 --- a/testsuite/tests/rts/T9579/all.T +++ b/testsuite/tests/rts/T9579/all.T @@ -15,8 +15,7 @@ def T9579_run_test(binName, expExitCode): """ test(fmt('T9579_{binName}'), - [extra_clean([ fmt('tmp_T9579_{binName}/Main.hi'), - fmt('tmp_T9579_{binName}/Main.o') ])], + [extra_files(['OutOfHeap.hs', 'StackOverflow.hs'])], run_command, [fmt(testCommandTemplate)]) From git at git.haskell.org Sun Feb 26 23:15:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 23:15:17 +0000 (UTC) Subject: [commit: ghc] master: Bump hpc submodule to allow time-1.8 (ac55394) Message-ID: <20170226231517.C123F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ac55394127532ddef605d00094c08be7fa0a600f/ghc >--------------------------------------------------------------- commit ac55394127532ddef605d00094c08be7fa0a600f Author: Reid Barton Date: Fri Feb 24 21:56:51 2017 -0500 Bump hpc submodule to allow time-1.8 >--------------------------------------------------------------- ac55394127532ddef605d00094c08be7fa0a600f libraries/hpc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/hpc b/libraries/hpc index 9267329..c23cad3 160000 --- a/libraries/hpc +++ b/libraries/hpc @@ -1 +1 @@ -Subproject commit 92673292ab7ce7878e982d0a02df3e548ef15b52 +Subproject commit c23cad32f408559ba95b880c04dc1a2c60ec3d01 From git at git.haskell.org Sun Feb 26 23:15:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 23:15:23 +0000 (UTC) Subject: [commit: ghc] master: Remove extra_files entries for deleted tests (8bb63c2) Message-ID: <20170226231523.348513A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8bb63c2e982a12ad5f436320948e23a718069a4f/ghc >--------------------------------------------------------------- commit 8bb63c2e982a12ad5f436320948e23a718069a4f Author: Reid Barton Date: Fri Feb 24 20:16:46 2017 -0500 Remove extra_files entries for deleted tests >--------------------------------------------------------------- 8bb63c2e982a12ad5f436320948e23a718069a4f testsuite/driver/extra_files.py | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/testsuite/driver/extra_files.py b/testsuite/driver/extra_files.py index c7a1d12..3e294de 100644 --- a/testsuite/driver/extra_files.py +++ b/testsuite/driver/extra_files.py @@ -259,7 +259,6 @@ extra_src_files = { 'dynamicToo003': ['A003.hs'], 'dynamicToo004': ['Setup.hs', 'pkg1/', 'pkg1dyn/', 'pkg2/', 'prog.hs'], 'dynamicToo005': ['dynamicToo005.bkp'], - 'dynamicToo006': ['A.hsig', 'B.hs'], 'dynamic_flags_001': ['A.hs', 'B.hs', 'C.hs'], 'dynamic_flags_002A': ['A_First.hs', 'A_Main.hs', 'A_Second.hs'], 'dynamic_flags_002B': ['B_First.hs', 'B_Main.hs', 'B_Second.hs'], @@ -338,7 +337,6 @@ extra_src_files = { 'jtod_circint': ['Bit.hs', 'LogFun.hs', 'Main.hs', 'Signal.hs'], 'jules_xref': ['Main.hs'], 'jules_xref2': ['Main.hs'], - 'landmines': ['MineFixity.hs', 'MineKind.hs', 'MineNames.hs', 'MineType.hs'], 'launchbury': ['Main.hs'], 'lazy-bs-alloc': ['../../numeric/should_run/arith011.stdout'], 'lennart_range': ['Main.hs'], @@ -519,19 +517,6 @@ extra_src_files = { 'seward-space-leak': ['Main.lhs'], 'shared001': ['Shared001.hs'], 'sigcabal01': ['Main.hs', 'Setup.hs', 'p/'], - 'sigof01': ['A.hs', 'B.hsig', 'Main.hs'], - 'sigof01m': ['A.hs', 'B.hsig', 'Main.hs'], - 'sigof02': ['Main.hs', 'Map.hsig'], - 'sigof02d': ['Double.hs', 'Map.hsig', 'MapAsSet.hsig'], - 'sigof02dm': ['Double.hs', 'Map.hsig', 'MapAsSet.hsig'], - 'sigof02dmt': ['Double.hs', 'Map.hsig', 'MapAsSet.hsig'], - 'sigof02dt': ['Double.hs', 'Map.hsig', 'MapAsSet.hsig'], - 'sigof02m': ['Main.hs', 'Map.hsig'], - 'sigof02mt': ['Main.hs', 'Map.hsig'], - 'sigof02t': ['Main.hs', 'Map.hsig'], - 'sigof03': ['A.hs', 'ASig1.hsig', 'ASig2.hsig', 'Main.hs'], - 'sigof03m': ['A.hs', 'ASig1.hsig', 'ASig2.hsig', 'Main.hs'], - 'sigof04': ['Sig.hsig'], 'simpl020': ['Simpl020_A.hs'], 'simpl021': ['Simpl021A.hs', 'Simpl021B.hs'], 'simplCore.oneShot': ['OneShot1.hs', 'OneShot2.hs'], From git at git.haskell.org Sun Feb 26 23:15:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 23:15:31 +0000 (UTC) Subject: [commit: ghc] master: Remove outdated information about main() in HSrts (#1) (5c95e6b) Message-ID: <20170226231531.D5F063A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5c95e6b7c2790c192720ba5a533d6d11fad570f8/ghc >--------------------------------------------------------------- commit 5c95e6b7c2790c192720ba5a533d6d11fad570f8 Author: Ben Gamari Date: Sun Feb 26 17:34:09 2017 -0500 Remove outdated information about main() in HSrts (#1) The main method is not contained in HSrts so the removed section is no longer valid. >--------------------------------------------------------------- 5c95e6b7c2790c192720ba5a533d6d11fad570f8 docs/users_guide/phases.rst | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/docs/users_guide/phases.rst b/docs/users_guide/phases.rst index 01c2e1f..b1a6310 100644 --- a/docs/users_guide/phases.rst +++ b/docs/users_guide/phases.rst @@ -504,13 +504,11 @@ for example). There's one other gotcha to bear in mind when using external libraries: if the library contains a ``main()`` function, then this - will be linked in preference to GHC's own ``main()`` function (eg. - ``libf2c`` and ``libl`` have their own ``main()``\ s). This is - because GHC's ``main()`` comes from the ``HSrts`` library, which is - normally included *after* all the other libraries on the linker's - command line. To force GHC's ``main()`` to be used in preference to - any other ``main()``\ s from external libraries, just add the option - ``-lHSrts`` before any other libraries on the command line. + will be a link conflict with GHC's own ``main()`` function (eg. + ``libf2c`` and ``libl`` have their own ``main()``\ s). + + You can use an external main function if you initialize the RTS manually + and pass ``-no-hs-main``. See also :ref:`using-own-main`. .. ghc-flag:: -c From git at git.haskell.org Sun Feb 26 23:15:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 23:15:29 +0000 (UTC) Subject: [commit: ghc] master: tests: remove extra_files.py (#12223) (3415bca) Message-ID: <20170226231529.272E23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3415bcaa0b1903b5e12dfaadb5b774718e406eab/ghc >--------------------------------------------------------------- commit 3415bcaa0b1903b5e12dfaadb5b774718e406eab Author: Reid Barton Date: Fri Feb 24 21:14:50 2017 -0500 tests: remove extra_files.py (#12223) The script I used is included as testsuite/driver/kill_extra_files.py, though at this point it is for mostly historical interest. Some of the tests in libraries/hpc relied on extra_files.py, so this commit includes an update to that submodule. One test in libraries/process also relies on extra_files.py, but we cannot update that submodule so easily, so for now we special-case it in the test driver. >--------------------------------------------------------------- 3415bcaa0b1903b5e12dfaadb5b774718e406eab libraries/base/tests/IO/all.T | 4 +- libraries/base/tests/all.T | 15 +- libraries/hpc | 2 +- testsuite/driver/extra_files.py | 523 --------------------- testsuite/driver/kill_extra_files.py | 101 ++++ testsuite/driver/testlib.py | 2 +- .../tests/annotations/should_compile/th/all.T | 6 +- testsuite/tests/annotations/should_fail/all.T | 9 +- testsuite/tests/annotations/should_run/all.T | 3 +- testsuite/tests/backpack/cabal/bkpcabal01/all.T | 2 +- testsuite/tests/backpack/cabal/bkpcabal02/all.T | 2 +- testsuite/tests/backpack/cabal/bkpcabal03/all.T | 2 +- testsuite/tests/backpack/cabal/bkpcabal04/all.T | 2 +- testsuite/tests/backpack/cabal/bkpcabal05/all.T | 2 +- testsuite/tests/cabal/T12485/all.T | 2 +- testsuite/tests/cabal/T12733/all.T | 2 +- testsuite/tests/cabal/all.T | 25 +- testsuite/tests/cabal/cabal03/all.T | 2 +- testsuite/tests/cabal/cabal04/all.T | 2 +- testsuite/tests/cabal/cabal05/all.T | 2 +- testsuite/tests/cabal/cabal06/all.T | 2 +- testsuite/tests/cabal/cabal08/all.T | 2 +- testsuite/tests/cabal/cabal09/all.T | 2 +- testsuite/tests/cabal/pkg02/all.T | 2 +- testsuite/tests/codeGen/should_run/all.T | 2 +- testsuite/tests/concurrent/prog001/all.T | 3 +- testsuite/tests/concurrent/prog002/all.T | 3 +- testsuite/tests/concurrent/prog003/all.T | 3 +- testsuite/tests/determinism/determ002/all.T | 2 +- testsuite/tests/determinism/determ003/all.T | 2 +- testsuite/tests/determinism/determ005/all.T | 2 +- testsuite/tests/determinism/determ006/all.T | 2 +- testsuite/tests/determinism/determ007/all.T | 2 +- testsuite/tests/determinism/determ008/all.T | 2 +- testsuite/tests/determinism/determ009/all.T | 2 +- testsuite/tests/determinism/determ010/all.T | 2 +- testsuite/tests/determinism/determ011/all.T | 2 +- testsuite/tests/determinism/determ012/all.T | 2 +- testsuite/tests/determinism/determ013/all.T | 2 +- testsuite/tests/determinism/determ014/all.T | 2 +- testsuite/tests/determinism/determ015/all.T | 2 +- testsuite/tests/determinism/determ016/all.T | 2 +- testsuite/tests/determinism/determ017/all.T | 2 +- testsuite/tests/determinism/determ018/all.T | 2 +- testsuite/tests/determinism/determ019/all.T | 2 +- testsuite/tests/determinism/determ021/all.T | 2 +- testsuite/tests/driver/T12062/all.T | 2 +- testsuite/tests/driver/T1372/all.T | 2 +- testsuite/tests/driver/T1959/test.T | 2 +- testsuite/tests/driver/T3007/all.T | 2 +- testsuite/tests/driver/T437/all.T | 2 +- testsuite/tests/driver/T5147/all.T | 2 +- testsuite/tests/driver/T7373/all.T | 3 +- testsuite/tests/driver/T7835/all.T | 2 +- testsuite/tests/driver/T8184/all.T | 2 +- testsuite/tests/driver/T8526/T8526.T | 2 +- testsuite/tests/driver/T8602/T8602.T | 3 +- testsuite/tests/driver/T9562/all.T | 3 +- testsuite/tests/driver/all.T | 98 ++-- testsuite/tests/driver/bug1677/all.T | 2 +- testsuite/tests/driver/dynamicToo/all.T | 3 +- .../tests/driver/dynamicToo/dynamicToo001/test.T | 3 +- .../tests/driver/dynamicToo/dynamicToo002/test.T | 3 +- .../tests/driver/dynamicToo/dynamicToo004/test.T | 3 +- .../tests/driver/dynamicToo/dynamicToo005/test.T | 3 +- testsuite/tests/driver/dynamic_flags_001/all.T | 3 +- testsuite/tests/driver/recomp001/all.T | 3 +- testsuite/tests/driver/recomp002/all.T | 3 +- testsuite/tests/driver/recomp003/all.T | 2 +- testsuite/tests/driver/recomp004/all.T | 2 +- testsuite/tests/driver/recomp005/all.T | 3 +- testsuite/tests/driver/recomp006/all.T | 3 +- testsuite/tests/driver/recomp007/all.T | 3 +- testsuite/tests/driver/recomp008/all.T | 3 +- testsuite/tests/driver/recomp009/all.T | 2 +- testsuite/tests/driver/recomp010/all.T | 2 +- testsuite/tests/driver/recomp011/all.T | 3 +- testsuite/tests/driver/recomp015/all.T | 3 +- testsuite/tests/driver/recomp016/all.T | 2 +- testsuite/tests/driver/retc001/all.T | 3 +- testsuite/tests/driver/retc002/all.T | 3 +- testsuite/tests/driver/retc003/all.T | 2 +- testsuite/tests/ffi/should_fail/all.T | 2 +- testsuite/tests/ffi/should_run/all.T | 7 +- testsuite/tests/gadt/all.T | 4 +- testsuite/tests/generics/GFunctor/test.T | 2 +- testsuite/tests/generics/GMap/test.T | 2 +- testsuite/tests/generics/GShow/test.T | 2 +- testsuite/tests/generics/Uniplate/test.T | 2 +- testsuite/tests/ghc-api/T4891/all.T | 2 +- testsuite/tests/ghc-api/T7478/all.T | 3 +- testsuite/tests/ghc-api/annotations-literals/all.T | 4 +- testsuite/tests/ghc-api/annotations/all.T | 87 ++-- testsuite/tests/ghc-api/apirecomp001/all.T | 2 +- testsuite/tests/ghci.debugger/scripts/all.T | 92 ++-- .../tests/ghci.debugger/scripts/break022/all.T | 2 +- .../tests/ghci.debugger/scripts/break023/all.T | 2 +- testsuite/tests/ghci/T11827/all.T | 3 +- testsuite/tests/ghci/linking/all.T | 12 +- testsuite/tests/ghci/linking/dyn/all.T | 20 +- testsuite/tests/ghci/prog001/prog001.T | 3 +- testsuite/tests/ghci/prog002/prog002.T | 3 +- testsuite/tests/ghci/prog003/prog003.T | 3 +- testsuite/tests/ghci/prog005/prog005.T | 2 +- testsuite/tests/ghci/prog006/prog006.T | 2 +- testsuite/tests/ghci/prog007/prog007.T | 2 +- testsuite/tests/ghci/prog008/prog008.T | 2 +- testsuite/tests/ghci/prog009/ghci.prog009.T | 2 +- testsuite/tests/ghci/prog012/all.T | 2 +- testsuite/tests/ghci/prog013/prog013.T | 2 +- testsuite/tests/ghci/prog014/prog014.T | 3 +- testsuite/tests/ghci/prog015/prog015.T | 2 +- testsuite/tests/ghci/prog016/prog016.T | 2 +- testsuite/tests/ghci/prog017/prog017.T | 2 +- testsuite/tests/ghci/scripts/all.T | 18 +- testsuite/tests/haddock/haddock_examples/test.T | 3 +- testsuite/tests/hpc/all.T | 3 +- testsuite/tests/indexed-types/should_compile/all.T | 4 +- testsuite/tests/indexed-types/should_fail/all.T | 2 +- testsuite/tests/module/all.T | 94 ++-- testsuite/tests/module/base01/all.T | 3 +- testsuite/tests/module/mod175/all.T | 2 +- .../tests/overloadedrecflds/should_fail/all.T | 10 +- testsuite/tests/overloadedrecflds/should_run/all.T | 5 +- testsuite/tests/parser/prog001/test.T | 2 +- testsuite/tests/partial-sigs/should_compile/all.T | 3 +- testsuite/tests/partial-sigs/should_fail/all.T | 3 +- testsuite/tests/patsyn/should_compile/all.T | 8 +- testsuite/tests/perf/haddock/all.T | 9 +- testsuite/tests/perf/should_run/all.T | 3 +- testsuite/tests/plugins/all.T | 38 +- testsuite/tests/profiling/should_run/all.T | 3 +- testsuite/tests/programs/10queens/test.T | 3 +- testsuite/tests/programs/andre_monad/test.T | 3 +- testsuite/tests/programs/andy_cherry/test.T | 3 +- testsuite/tests/programs/barton-mangler-bug/test.T | 3 +- testsuite/tests/programs/cholewo-eval/test.T | 3 +- testsuite/tests/programs/cvh_unboxing/test.T | 3 +- testsuite/tests/programs/fast2haskell/test.T | 3 +- testsuite/tests/programs/fun_insts/test.T | 3 +- testsuite/tests/programs/galois_raytrace/test.T | 3 +- testsuite/tests/programs/hs-boot/all.T | 2 +- testsuite/tests/programs/jl_defaults/test.T | 3 +- testsuite/tests/programs/joao-circular/test.T | 3 +- testsuite/tests/programs/jq_readsPrec/test.T | 3 +- testsuite/tests/programs/jtod_circint/test.T | 3 +- testsuite/tests/programs/jules_xref/test.T | 3 +- testsuite/tests/programs/jules_xref2/test.T | 3 +- testsuite/tests/programs/launchbury/test.T | 3 +- testsuite/tests/programs/lennart_range/test.T | 3 +- testsuite/tests/programs/lex/test.T | 3 +- testsuite/tests/programs/life_space_leak/test.T | 3 +- testsuite/tests/programs/maessen-hashtab/test.T | 3 +- testsuite/tests/programs/north_array/test.T | 3 +- testsuite/tests/programs/okeefe_neural/test.T | 3 +- testsuite/tests/programs/record_upd/test.T | 3 +- testsuite/tests/programs/rittri/test.T | 3 +- testsuite/tests/programs/sanders_array/test.T | 3 +- testsuite/tests/programs/seward-space-leak/test.T | 3 +- testsuite/tests/programs/strict_anns/test.T | 3 +- .../tests/programs/thurston-modular-arith/test.T | 3 +- testsuite/tests/quasiquotation/T4491/test.T | 3 +- testsuite/tests/quasiquotation/qq005/test.T | 3 +- testsuite/tests/quasiquotation/qq006/test.T | 3 +- testsuite/tests/quasiquotation/qq007/test.T | 3 +- testsuite/tests/quasiquotation/qq008/test.T | 3 +- testsuite/tests/quasiquotation/qq009/test.T | 3 +- testsuite/tests/quotes/TH_spliceViewPat/test.T | 3 +- testsuite/tests/rename/prog001/test.T | 2 +- testsuite/tests/rename/prog002/test.T | 2 +- testsuite/tests/rename/prog003/test.T | 2 +- testsuite/tests/rename/prog004/test.T | 2 +- testsuite/tests/rename/prog005/test.T | 2 +- testsuite/tests/rename/prog006/all.T | 2 +- testsuite/tests/rename/should_compile/T3103/test.T | 2 +- testsuite/tests/rename/should_compile/all.T | 30 +- testsuite/tests/rename/should_fail/all.T | 6 +- testsuite/tests/rts/T10672/all.T | 6 +- testsuite/tests/rts/T11223/all.T | 45 +- testsuite/tests/rts/T5644/all.T | 3 +- testsuite/tests/rts/all.T | 26 +- testsuite/tests/safeHaskell/check/pkg01/all.T | 33 +- testsuite/tests/safeHaskell/ghci/all.T | 12 +- testsuite/tests/simplCore/T9646/test.T | 3 +- testsuite/tests/simplCore/prog001/test.T | 2 +- testsuite/tests/simplCore/prog002/test.T | 2 +- testsuite/tests/simplCore/prog003/test.T | 3 +- testsuite/tests/simplCore/should_compile/all.T | 7 +- testsuite/tests/stranal/should_run/T8425/all.T | 2 +- testsuite/tests/th/T2014/all.T | 3 +- testsuite/tests/th/TH_import_loop/TH_import_loop.T | 3 +- testsuite/tests/th/TH_linker/all.T | 3 +- testsuite/tests/typecheck/bug1465/all.T | 2 +- testsuite/tests/typecheck/prog001/test.T | 3 +- testsuite/tests/typecheck/prog002/test.T | 3 +- testsuite/tests/typecheck/should_compile/all.T | 18 +- testsuite/tests/typecheck/should_fail/all.T | 11 +- testsuite/tests/typecheck/should_run/all.T | 4 +- testsuite/tests/typecheck/testeq1/test.T | 3 +- .../tests/warnings/should_compile/T10637/all.T | 2 +- .../tests/warnings/should_compile/T10890/all.T | 4 +- testsuite/tests/warnings/should_compile/all.T | 2 +- 202 files changed, 791 insertions(+), 1018 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 3415bcaa0b1903b5e12dfaadb5b774718e406eab From git at git.haskell.org Sun Feb 26 23:15:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 26 Feb 2017 23:15:25 +0000 (UTC) Subject: [commit: ghc] master: tests: manually move some extra_files into *.T files (98119f5) Message-ID: <20170226231525.ECBC33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/98119f5a5224d321a1765f262c8c76dfd1b8ed35/ghc >--------------------------------------------------------------- commit 98119f5a5224d321a1765f262c8c76dfd1b8ed35 Author: Reid Barton Date: Fri Feb 24 20:56:19 2017 -0500 tests: manually move some extra_files into *.T files Some of the *.T files were in libraries/hpc, so this contains an update to that submodule. >--------------------------------------------------------------- 98119f5a5224d321a1765f262c8c76dfd1b8ed35 libraries/hpc | 2 +- testsuite/driver/extra_files.py | 25 ---------------------- testsuite/tests/cabal/cabal01/all.T | 3 ++- testsuite/tests/cabal/sigcabal01/all.T | 2 +- testsuite/tests/driver/dynamic_flags_002/all.T | 15 ++++++++----- testsuite/tests/generics/all.T | 7 +++--- testsuite/tests/ghc-e/should_fail/all.T | 3 ++- testsuite/tests/ghci.debugger/scripts/all.T | 3 ++- testsuite/tests/ghci/scripts/all.T | 9 +++++--- .../tests/overloadedrecflds/should_fail/all.T | 3 +-- testsuite/tests/rts/all.T | 18 ++++++++++------ testsuite/tests/typecheck/T11824/all.T | 5 ++++- 12 files changed, 45 insertions(+), 50 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 98119f5a5224d321a1765f262c8c76dfd1b8ed35 From git at git.haskell.org Mon Feb 27 00:03:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Feb 2017 00:03:42 +0000 (UTC) Subject: [commit: ghc] master: Treat all TyCon with hole names as skolem abstract. (9603de6) Message-ID: <20170227000342.667BD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9603de6ac7a75ea7c620ce05e3c5f500bcaf5dd6/ghc >--------------------------------------------------------------- commit 9603de6ac7a75ea7c620ce05e3c5f500bcaf5dd6 Author: Edward Z. Yang Date: Fri Feb 24 15:58:09 2017 -0800 Treat all TyCon with hole names as skolem abstract. Summary: Fixes #13335. Signed-off-by: Edward Z. Yang Test Plan: validate Reviewers: goldfire, austin, simonpj, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3211 >--------------------------------------------------------------- 9603de6ac7a75ea7c620ce05e3c5f500bcaf5dd6 compiler/backpack/RnModIface.hs | 2 +- compiler/iface/IfaceSyn.hs | 19 ++- compiler/iface/MkIface.hs | 2 +- compiler/iface/TcIface.hs | 4 +- compiler/typecheck/TcCanonical.hs | 4 +- compiler/typecheck/TcRnDriver.hs | 7 +- compiler/typecheck/TcTyClsDecls.hs | 9 +- compiler/types/TyCon.hs | 129 +++++++++------------ .../tests/backpack/should_fail/bkpfail10.stderr | 2 +- .../tests/backpack/should_fail/bkpfail23.stderr | 2 +- .../tests/backpack/should_fail/bkpfail25.stderr | 2 +- .../tests/backpack/should_fail/bkpfail26.stderr | 2 +- .../tests/backpack/should_fail/bkpfail27.stderr | 2 +- testsuite/tests/roles/should_fail/Roles12.stderr | 2 +- testsuite/tests/roles/should_fail/T9204.stderr | 2 +- .../tests/typecheck/should_fail/T12035.stderr | 2 +- .../tests/typecheck/should_fail/T12035j.stderr | 2 +- testsuite/tests/typecheck/should_fail/T3468.stderr | 2 +- 18 files changed, 84 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 9603de6ac7a75ea7c620ce05e3c5f500bcaf5dd6 From git at git.haskell.org Mon Feb 27 00:03:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Feb 2017 00:03:45 +0000 (UTC) Subject: [commit: ghc] master: Subtyping for roles in signatures. (923d7ca) Message-ID: <20170227000345.C07713A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/923d7ca2d90c1cb9816d14768abdd2e46adcd5dd/ghc >--------------------------------------------------------------- commit 923d7ca2d90c1cb9816d14768abdd2e46adcd5dd Author: Edward Z. Yang Date: Fri Feb 10 00:38:34 2017 -0800 Subtyping for roles in signatures. Summary: This commit implements the plan in #13140: * Today, roles in signature files default to representational. Let's change the default to nominal, as this is the most flexible implementation side. If a client of the signature needs to coerce with a type, the signature can be adjusted to have more stringent requirements. * If a parameter is declared as nominal in a signature, it can be implemented by a data type which is actually representational. * When merging abstract data declarations, we take the smallest role for every parameter. The roles are considered fix once we specify the structure of an ADT. * Critically, abstract types are NOT injective, so we aren't allowed to make inferences like "if T a ~R T b, then a ~N b" based on the nominal role of a parameter in an abstract type (this would be unsound if the parameter ended up being phantom.) This restriction is similar to the restriction we have on newtypes. Signed-off-by: Edward Z. Yang Test Plan: validate Reviewers: simonpj, bgamari, austin, goldfire Subscribers: goldfire, thomie Differential Revision: https://phabricator.haskell.org/D3123 >--------------------------------------------------------------- 923d7ca2d90c1cb9816d14768abdd2e46adcd5dd compiler/iface/TcIface.hs | 26 +++++++++--- compiler/typecheck/TcRnDriver.hs | 29 +++++++++---- compiler/typecheck/TcTyClsDecls.hs | 4 +- compiler/typecheck/TcTyDecls.hs | 48 ++++++++++++++++++---- compiler/types/CoAxiom.hs | 3 ++ docs/users_guide/separate_compilation.rst | 18 +++++--- testsuite/tests/backpack/should_compile/T13140.bkp | 40 ++++++++++++++++++ .../tests/backpack/should_compile/T13140.stderr | 28 +++++++++++++ testsuite/tests/backpack/should_compile/all.T | 1 + .../tests/backpack/should_fail/bkpfail25.stderr | 3 +- .../tests/backpack/should_fail/bkpfail26.stderr | 3 +- 11 files changed, 171 insertions(+), 32 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 923d7ca2d90c1cb9816d14768abdd2e46adcd5dd From git at git.haskell.org Mon Feb 27 00:18:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Feb 2017 00:18:50 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable: TcTypeable: Try to reuse KindReps (0dea76f) Message-ID: <20170227001850.0ADDE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/ttypeable Link : http://ghc.haskell.org/trac/ghc/changeset/0dea76f2798b921f2dd929128b578ef7d8a47d50/ghc >--------------------------------------------------------------- commit 0dea76f2798b921f2dd929128b578ef7d8a47d50 Author: Ben Gamari Date: Thu Feb 16 13:15:29 2017 -0500 TcTypeable: Try to reuse KindReps >--------------------------------------------------------------- 0dea76f2798b921f2dd929128b578ef7d8a47d50 compiler/coreSyn/TrieMap.hs | 28 ++- compiler/typecheck/TcTypeable.hs | 257 +++++++++++++-------- .../tests/deSugar/should_compile/T2431.stderr | 83 +++---- .../should_compile/DumpTypecheckedAst.stderr | 104 +++------ testsuite/tests/perf/compiler/all.T | 9 +- testsuite/tests/roles/should_compile/Roles1.stderr | 101 +++----- .../tests/roles/should_compile/Roles13.stderr | 155 ++++++------- .../tests/roles/should_compile/Roles14.stderr | 15 +- testsuite/tests/roles/should_compile/Roles2.stderr | 31 +-- testsuite/tests/roles/should_compile/Roles3.stderr | 56 ++--- testsuite/tests/roles/should_compile/Roles4.stderr | 33 +-- testsuite/tests/roles/should_compile/T8958.stderr | 66 ++---- .../tests/simplCore/should_compile/T7360.stderr | 153 ++++++------ .../tests/simplCore/should_compile/T8274.stdout | 14 +- testsuite/tests/th/TH_Roles2.stderr | 9 +- 15 files changed, 509 insertions(+), 605 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 0dea76f2798b921f2dd929128b578ef7d8a47d50 From git at git.haskell.org Mon Feb 27 00:18:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Feb 2017 00:18:52 +0000 (UTC) Subject: [commit: ghc] wip/ttypeable's head updated: TcTypeable: Try to reuse KindReps (0dea76f) Message-ID: <20170227001852.5713C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/ttypeable' now includes: a7eeb60 build system: Persist CrossCompiling in binary distributions d2f4849 Coercion: Try dropping constraintIsLifted axiom bcffc35 Move Typeable Binary instances to binary package b494689 users-guide: Add documentation for JSON profile format 0d86aa5 Add support for concurrent package db access and updates 6dfc5eb Ensure that Literals are in range ac55394 Bump hpc submodule to allow time-1.8 35b5790 Manually move extra_files for tests T9579_* 8bb63c2 Remove extra_files entries for deleted tests 98119f5 tests: manually move some extra_files into *.T files 3415bca tests: remove extra_files.py (#12223) 5c95e6b Remove outdated information about main() in HSrts (#1) 0dea76f TcTypeable: Try to reuse KindReps From git at git.haskell.org Mon Feb 27 02:45:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Feb 2017 02:45:42 +0000 (UTC) Subject: [commit: ghc] master: Refactor floating of bindings (fiBind) (e4188b5) Message-ID: <20170227024542.E15C23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e4188b538bfc879b201d416cf1d68ff7072c577f/ghc >--------------------------------------------------------------- commit e4188b538bfc879b201d416cf1d68ff7072c577f Author: Simon Peyton Jones Date: Sun Feb 26 21:45:00 2017 -0500 Refactor floating of bindings (fiBind) This is just a local refactoring. I originally planned to try floating top-level bindings inwards, but I backed off from that leaving only this (harmless) refactoring, which has no behavioural effect. I also make FloatIn into a ModGuts -> ModGuts function; again not necessary now, but no harm either. My attempt also used the new function CoreFVs.freeVarsBind; but that too is a plausible refactorig of freeVars, so I left it in too. Reviewers: austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3180 >--------------------------------------------------------------- e4188b538bfc879b201d416cf1d68ff7072c577f compiler/coreSyn/CoreFVs.hs | 57 +++++------ compiler/simplCore/FloatIn.hs | 173 ++++++++++++++++++--------------- compiler/simplCore/SimplCore.hs | 2 +- testsuite/tests/perf/space_leaks/all.T | 6 +- 4 files changed, 129 insertions(+), 109 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 e4188b538bfc879b201d416cf1d68ff7072c577f From git at git.haskell.org Mon Feb 27 02:55:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Feb 2017 02:55:10 +0000 (UTC) Subject: [commit: ghc] master: Add -fspec-constr-keen (4f38fa1) Message-ID: <20170227025510.B02C73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4f38fa100091152e6497db384af1fecd628e11e5/ghc >--------------------------------------------------------------- commit 4f38fa100091152e6497db384af1fecd628e11e5 Author: Simon Peyton Jones Date: Sun Feb 26 21:53:31 2017 -0500 Add -fspec-constr-keen I discovered that the dramatic imprvoement in perf/should_run/T9339 with the introduction of join points was really rather a fluke, and very fragile. The real problem (see Note [Making SpecConstr keener]) is that SpecConstr wasn't specialising a function even though it was applied to a freshly-allocated constructor. The paper describes plausible reasons for this, but I think it may well be better to be a bit more aggressive. So this patch add -fspec-constr-keen, which makes SpecConstr a bit keener to specialise, by ignoring whether or not the argument corresponding to a call pattern is scrutinised in the function body. Now the gains in T9339 should be robust; and it might even be a better default. I'd be interested in what happens if we switched on -fspec-constr-keen with -O2. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3186 >--------------------------------------------------------------- 4f38fa100091152e6497db384af1fecd628e11e5 compiler/main/DynFlags.hs | 2 ++ compiler/specialise/SpecConstr.hs | 57 +++++++++++++++++++++++++++++---- docs/users_guide/using-optimisation.rst | 12 ++++++- testsuite/tests/perf/should_run/all.T | 4 ++- 4 files changed, 66 insertions(+), 9 deletions(-) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index d3d0ac3..442bbb9 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -432,6 +432,7 @@ data GeneralFlag | Opt_StgCSE | Opt_LiberateCase | Opt_SpecConstr + | Opt_SpecConstrKeen | Opt_DoLambdaEtaExpansion | Opt_IgnoreAsserts | Opt_DoEtaReduction @@ -3684,6 +3685,7 @@ fFlagsDeps = [ (useInstead "enable-rewrite-rules"), flagSpec "shared-implib" Opt_SharedImplib, flagSpec "spec-constr" Opt_SpecConstr, + flagSpec "spec-constr-keen" Opt_SpecConstrKeen, flagSpec "specialise" Opt_Specialise, flagSpec "specialize" Opt_Specialise, flagSpec "specialise-aggressively" Opt_SpecialiseAggressively, diff --git a/compiler/specialise/SpecConstr.hs b/compiler/specialise/SpecConstr.hs index 8a3e227..c2470bd 100644 --- a/compiler/specialise/SpecConstr.hs +++ b/compiler/specialise/SpecConstr.hs @@ -41,7 +41,8 @@ import VarEnv import VarSet import Name import BasicTypes -import DynFlags ( DynFlags(..), hasPprDebug ) +import DynFlags ( DynFlags(..), GeneralFlag( Opt_SpecConstrKeen ) + , gopt, hasPprDebug ) import Maybes ( orElse, catMaybes, isJust, isNothing ) import Demand import GHC.Serialized ( deserializeWithData ) @@ -447,7 +448,6 @@ breaks an invariant. Note [Forcing specialisation] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - With stream fusion and in other similar cases, we want to fully specialise some (but not necessarily all!) loops regardless of their size and the number of specialisations. @@ -754,6 +754,39 @@ into a work-free value again, thus a'_shr = (a1, x_af7) but that's more work, so until its shown to be important I'm going to leave it for now. + +Note [Making SpecConstr keener] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Consider this, in (perf/should_run/T9339) + last (filter odd [1..1000]) + +After optimisation, including SpecConstr, we get: + f :: Int# -> Int -> Int + f x y = case case remInt# x 2# of + __DEFAULT -> case x of + __DEFAULT -> f (+# wild_Xp 1#) (I# x) + 1000000# -> ... + 0# -> case x of + __DEFAULT -> f (+# wild_Xp 1#) y + 1000000# -> y + +Not good! We build an (I# x) box every time around the loop. +SpecConstr (as described in the paper) does not specialise f, despite +the call (f ... (I# x)) because 'y' is not scrutinied in the body. +But it is much better to specialise f for the case where the argument +is of form (I# x); then we build the box only when returning y, which +is on the cold path. + +Another exmaple: + + f x = ...(g x).... + +Here 'x' is not scrutinised in f's body; but if we did specialise 'f' +then the call (g x) might allow 'g' to be specialised in turn. + +So sc_keen controls whether or not we take account of whether argument is +scrutinised in the body. True <=> ignore that, and speicalise whenever +the function is applied to a data constructor. -} data ScEnv = SCE { sc_dflags :: DynFlags, @@ -765,6 +798,11 @@ data ScEnv = SCE { sc_dflags :: DynFlags, sc_recursive :: Int, -- Max # of specialisations over recursive type. -- Stops ForceSpecConstr from diverging. + sc_keen :: Bool, -- Specialise on arguments that are known + -- constructors, even if they are not + -- scrutinised in the body. See + -- Note [Making SpecConstr keener] + sc_force :: Bool, -- Force specialisation? -- See Note [Forcing specialisation] @@ -807,6 +845,7 @@ initScEnv dflags this_mod anns sc_size = specConstrThreshold dflags, sc_count = specConstrCount dflags, sc_recursive = specConstrRecursive dflags, + sc_keen = gopt Opt_SpecConstrKeen dflags, sc_force = False, sc_subst = emptySubst, sc_how_bound = emptyVarEnv, @@ -1976,11 +2015,12 @@ argToPat env in_scope val_env arg arg_occ mkConApp dc (ty_args ++ args')) } where mb_scrut dc = case arg_occ of - ScrutOcc bs - | Just occs <- lookupUFM bs dc - -> Just (occs) -- See Note [Reboxing] - _other | sc_force env -> Just (repeat UnkOcc) - | otherwise -> Nothing + ScrutOcc bs | Just occs <- lookupUFM bs dc + -> Just (occs) -- See Note [Reboxing] + _other | sc_force env || sc_keen env + -> Just (repeat UnkOcc) + | otherwise + -> Nothing -- Check if the argument is a variable that -- (a) is used in an interesting way in the function body @@ -1989,6 +2029,9 @@ argToPat env in_scope val_env arg arg_occ argToPat env in_scope val_env (Var v) arg_occ | sc_force env || case arg_occ of { UnkOcc -> False; _other -> True }, -- (a) is_value, -- (b) + -- Ignoring sc_keen here to avoid gratuitously incurring Note [Reboxing] + -- So sc_keen focused just on f (I# x), where we have freshly-allocated + -- box that we can eliminate in the caller not (ignoreType env (varType v)) = return (True, Var v) where diff --git a/docs/users_guide/using-optimisation.rst b/docs/users_guide/using-optimisation.rst index 9436832..e56c473 100644 --- a/docs/users_guide/using-optimisation.rst +++ b/docs/users_guide/using-optimisation.rst @@ -522,7 +522,7 @@ list. Turn on call-pattern specialisation; see `Call-pattern specialisation for Haskell programs - `__. + `__. This optimisation specializes recursive functions according to their argument "shapes". This is best explained by example so consider: :: @@ -580,6 +580,16 @@ list. body directly, allowing heavy specialisation over the recursive cases. +.. ghc-flag:: -fspec-constr-keen + + :default: off + + If this flag is on, call-patten specialision will specialise a call + ``(f (Just x))`` with an explicit constructor agument, even if the argument + is not scrutinised in the body of the function. This is sometimes + beneficial; e.g. the argument might be given to some other function + that can itself be specialised. + .. ghc-flag:: -fspec-constr-count= :default: 3 diff --git a/testsuite/tests/perf/should_run/all.T b/testsuite/tests/perf/should_run/all.T index efcbb4a..2f57613 100644 --- a/testsuite/tests/perf/should_run/all.T +++ b/testsuite/tests/perf/should_run/all.T @@ -462,7 +462,9 @@ test('T9339', # 2016-08-17: 50728 Join points (#12988) only_ways(['normal'])], compile_and_run, - ['-O2']) + ['-O2 -fspec-constr-keen']) + # For the -fspec-constr-keen see Note [Making SpecConstr keener] in SpecConstr + test('T8472', [stats_num_field('bytes allocated', From git at git.haskell.org Mon Feb 27 03:18:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Feb 2017 03:18:51 +0000 (UTC) Subject: [commit: ghc] master: Occurrence-analyse the result of rule firings (76f2cd0) Message-ID: <20170227031851.0ABD53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/76f2cd02ab04818f19be1927c2a640dede3e9dd3/ghc >--------------------------------------------------------------- commit 76f2cd02ab04818f19be1927c2a640dede3e9dd3 Author: Simon Peyton Jones Date: Sun Feb 26 22:17:02 2017 -0500 Occurrence-analyse the result of rule firings When studying simplCore/should_compile/T7785 I found that a long chain of maps map f (map f (map f (map f (...)))) took an unreasonably long time to simplify. The problem got worse when I started inlining in the InitialPhase, which is how I stumbled on it. The solution turned out to be rather simple. It's described in Note [Occurence-analyse after rule firing] in Simplify.hs Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3190 >--------------------------------------------------------------- 76f2cd02ab04818f19be1927c2a640dede3e9dd3 compiler/simplCore/Simplify.hs | 68 +++++++++++++++++++++- compiler/specialise/Rules.hs | 9 +-- .../tests/simplCore/should_compile/T3234.stderr | 13 ++--- 3 files changed, 74 insertions(+), 16 deletions(-) diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index 4ef2994..d18eda7 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -15,6 +15,7 @@ import SimplMonad import Type hiding ( substTy, substTyVar, extendTvSubst, extendCvSubst ) import SimplEnv import SimplUtils +import OccurAnal ( occurAnalyseExpr ) import FamInstEnv ( FamInstEnv ) import Literal ( litIsLifted ) --, mkMachInt ) -- temporalily commented out. See #8326 import Id @@ -1809,9 +1810,13 @@ tryRules env rules fn args call_cont ; let cont' = pushSimplifiedArgs env (drop (ruleArity rule) args) call_cont - -- (ruleArity rule) says how many args the rule consumed + -- (ruleArity rule) says how + -- many args the rule consumed + + occ_anald_rhs = occurAnalyseExpr rule_rhs + -- See Note [Occurence-analyse after rule firing] ; dump dflags rule rule_rhs - ; return (Just (rule_rhs, cont')) }}} + ; return (Just (occ_anald_rhs, cont')) }}} where dump dflags rule rule_rhs | dopt Opt_D_dump_rule_rewrites dflags @@ -1842,7 +1847,64 @@ tryRules env rules fn args call_cont = liftIO . dumpSDoc dflags alwaysQualify flag "" $ sep [text hdr, nest 4 details] -{- +{- Note [Occurence-analyse after rule firing] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +After firing a rule, we occurrence-analyse the instantiated RHS before +simplifying it. Usually this doesn't make much difference, but it can +be huge. Here's an example (simplCore/should_compile/T7785) + + map f (map f (map f xs) + += -- Use build/fold form of map, twice + map f (build (\cn. foldr (mapFB c f) n + (build (\cn. foldr (mapFB c f) n xs)))) + += -- Apply fold/build rule + map f (build (\cn. (\cn. foldr (mapFB c f) n xs) (mapFB c f) n)) + += -- Beta-reduce + -- Alas we have no occurrence-analysed, so we don't know + -- that c is used exactly once + map f (build (\cn. let c1 = mapFB c f in + foldr (mapFB c1 f) n xs)) + += -- Use mapFB rule: mapFB (mapFB c f) g = mapFB c (f.g) + -- We can do this becuase (mapFB c n) is a PAP and hence expandable + map f (build (\cn. let c1 = mapFB c n in + foldr (mapFB c (f.f)) n x)) + +This is not too bad. But now do the same with the outer map, and +we get another use of mapFB, and t can interact with /both/ remaining +mapFB calls in the above expression. This is stupid because actually +that 'c1' binding is dead. The outer map introduces another c2. If +there is a deep stack of maps we get lots of dead bindings, and lots +of redundant work as we repeatedly simplify the result of firing rules. + +The easy thing to do is simply to occurrence analyse the result of +the rule firing. Note that this occ-anals not only the RHS of the +rule, but also the function arguments, which by now are OutExprs. +E.g. + RULE f (g x) = x+1 + +Call f (g BIG) --> (\x. x+1) BIG + +The rule binders are lambda-bound and applied to the OutExpr arguments +(here BIG) which lack all internal occurrence info. + +Is this inefficient? Not really: we are about to walk over the result +of the rule firing to simplify it, so occurrence analysis is at most +a constant factor. + +Possible improvement: occ-anal the rules when putting them in the +database; and in the simplifier just occ-anal the OutExpr arguments. +But that's more complicated and the rule RHS is usually tiny; so I'm +just doing the simple thing. + +Historical note: previously we did occ-anal the rules in Rule.hs, +but failed to occ-anal the OutExpr arguments, which led to the +nasty performance problem described above. + + Note [Optimising tagToEnum#] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If we have an enumeration data type: diff --git a/compiler/specialise/Rules.hs b/compiler/specialise/Rules.hs index ae0798a..2ad4e1c 100644 --- a/compiler/specialise/Rules.hs +++ b/compiler/specialise/Rules.hs @@ -31,7 +31,6 @@ module Rules ( import CoreSyn -- All of it import Module ( Module, ModuleSet, elemModuleSet ) import CoreSubst -import OccurAnal ( occurAnalyseExpr ) import CoreFVs ( exprFreeVars, exprsFreeVars, bindFreeVars , rulesFreeVarsDSet, exprsOrphNames, exprFreeVarsList ) import CoreUtils ( exprType, eqExpr, mkTick, mkTicks, @@ -172,7 +171,7 @@ mkRule :: Module -> Bool -> Bool -> RuleName -> Activation mkRule this_mod is_auto is_local name act fn bndrs args rhs = Rule { ru_name = name, ru_fn = fn, ru_act = act, ru_bndrs = bndrs, ru_args = args, - ru_rhs = occurAnalyseExpr rhs, + ru_rhs = rhs, ru_rough = roughTopNames args, ru_origin = this_mod, ru_orphan = orph, @@ -508,8 +507,7 @@ matchRule dflags rule_env _is_active fn args _rough_args -- Built-in rules can't be switched off, it seems = case match_fn dflags rule_env fn args of Nothing -> Nothing - Just expr -> Just (occurAnalyseExpr expr) - -- We could do this when putting things into the rulebase, I guess + Just expr -> Just expr matchRule _ in_scope is_active _ args rough_args (Rule { ru_name = rule_name, ru_act = act, ru_rough = tpl_tops @@ -522,8 +520,7 @@ matchRule _ in_scope is_active _ args rough_args Just (bind_wrapper, tpl_vals) -> Just (bind_wrapper $ rule_fn `mkApps` tpl_vals) where - rule_fn = occurAnalyseExpr (mkLams tpl_vars rhs) - -- We could do this when putting things into the rulebase, I guess + rule_fn = mkLams tpl_vars rhs --------------------------------------- matchN :: InScopeEnv diff --git a/testsuite/tests/simplCore/should_compile/T3234.stderr b/testsuite/tests/simplCore/should_compile/T3234.stderr index ad31846..e79bfbb 100644 --- a/testsuite/tests/simplCore/should_compile/T3234.stderr +++ b/testsuite/tests/simplCore/should_compile/T3234.stderr @@ -12,12 +12,15 @@ ==================== Grand total simplifier statistics ==================== Total ticks: 55 -15 PreInlineUnconditionally +18 PreInlineUnconditionally + 1 c 1 n 1 g 1 a 1 xs 1 ys + 1 c + 1 n 1 k 1 z 1 g @@ -28,11 +31,7 @@ Total ticks: 55 1 lvl 1 lvl 1 lvl -4 PostInlineUnconditionally - 1 c - 1 n - 1 c - 1 c +1 PostInlineUnconditionally 1 c 1 UnfoldingDone 1 GHC.Base.build 5 RuleFired 1 ++ @@ -67,6 +66,6 @@ Total ticks: 55 1 c 1 n 1 a -11 SimplifierDone 11 +10 SimplifierDone 10 From git at git.haskell.org Mon Feb 27 09:47:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Feb 2017 09:47:18 +0000 (UTC) Subject: [commit: ghc] master: Explicitly capture whether a splice has a dollar prefix (c0af206) Message-ID: <20170227094718.439AD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c0af206f26b97d8d4f1c5722825577b27087c0a9/ghc >--------------------------------------------------------------- commit c0af206f26b97d8d4f1c5722825577b27087c0a9 Author: Alan Zimmerman Date: Mon Feb 27 11:43:01 2017 +0200 Explicitly capture whether a splice has a dollar prefix A top-level splice can be written $splice or splice For accurate pretty-printing, and for ghc-exactprint, capture in the hsSyn AST which variant was parsed. >--------------------------------------------------------------- c0af206f26b97d8d4f1c5722825577b27087c0a9 compiler/hsSyn/HsExpr.hs | 28 ++++++++++++++++++---------- compiler/hsSyn/HsUtils.hs | 8 ++++---- compiler/parser/Parser.y | 6 +++--- testsuite/tests/printer/Ppr037.hs | 2 ++ 4 files changed, 27 insertions(+), 17 deletions(-) diff --git a/compiler/hsSyn/HsExpr.hs b/compiler/hsSyn/HsExpr.hs index de793bd..f627056 100644 --- a/compiler/hsSyn/HsExpr.hs +++ b/compiler/hsSyn/HsExpr.hs @@ -2045,12 +2045,12 @@ pprQuals quals = interpp'SP quals -- | Haskell Splice data HsSplice id = HsTypedSplice -- $$z or $$(f 4) - HasParens -- Whether $$( ) variant found, for pretty printing + SpliceDecoration -- Whether $$( ) variant found, for pretty printing id -- A unique name to identify this splice point (LHsExpr id) -- See Note [Pending Splices] | HsUntypedSplice -- $z or $(f 4) - HasParens -- Whether $( ) variant found, for pretty printing + SpliceDecoration -- Whether $( ) variant found, for pretty printing id -- A unique name to identify this splice point (LHsExpr id) -- See Note [Pending Splices] @@ -2070,13 +2070,17 @@ data HsSplice id deriving Typeable deriving instance (DataId id) => Data (HsSplice id) -data HasParens = HasParens - | NoParens - deriving (Data, Eq, Show) +-- | A splice can appear with various decorations wrapped around it. This data +-- type captures explicitly how it was originally written, for use in the pretty +-- printer. +data SpliceDecoration + = HasParens -- ^ $( splice ) or $$( splice ) + | HasDollar -- ^ $splice or $$splice + | NoParens -- ^ bare splice + deriving (Data, Eq, Show) -instance Outputable HasParens where - ppr HasParens = text "HasParens" - ppr NoParens = text "NoParens" +instance Outputable SpliceDecoration where + ppr x = text $ show x isTypedSplice :: HsSplice id -> Bool @@ -2218,12 +2222,16 @@ ppr_splice_decl e = pprSplice e pprSplice :: (OutputableBndrId id) => HsSplice id -> SDoc pprSplice (HsTypedSplice HasParens n e) = ppr_splice (text "$$(") n e (text ")") -pprSplice (HsTypedSplice NoParens n e) +pprSplice (HsTypedSplice HasDollar n e) = ppr_splice (text "$$") n e empty +pprSplice (HsTypedSplice NoParens n e) + = ppr_splice empty n e empty pprSplice (HsUntypedSplice HasParens n e) = ppr_splice (text "$(") n e (text ")") -pprSplice (HsUntypedSplice NoParens n e) +pprSplice (HsUntypedSplice HasDollar n e) = ppr_splice (text "$") n e empty +pprSplice (HsUntypedSplice NoParens n e) + = ppr_splice empty n e empty pprSplice (HsQuasiQuote n q _ s) = ppr_quasi n q s pprSplice (HsSpliced _ thing) = ppr thing diff --git a/compiler/hsSyn/HsUtils.hs b/compiler/hsSyn/HsUtils.hs index 8001a15..c7d43b0 100644 --- a/compiler/hsSyn/HsUtils.hs +++ b/compiler/hsSyn/HsUtils.hs @@ -321,16 +321,16 @@ mkHsOpApp e1 op e2 = OpApp e1 (noLoc (HsVar (noLoc op))) unqualSplice :: RdrName unqualSplice = mkRdrUnqual (mkVarOccFS (fsLit "splice")) -mkUntypedSplice :: HasParens -> LHsExpr RdrName -> HsSplice RdrName +mkUntypedSplice :: SpliceDecoration -> LHsExpr RdrName -> HsSplice RdrName mkUntypedSplice hasParen e = HsUntypedSplice hasParen unqualSplice e -mkHsSpliceE :: HasParens -> LHsExpr RdrName -> HsExpr RdrName +mkHsSpliceE :: SpliceDecoration -> LHsExpr RdrName -> HsExpr RdrName mkHsSpliceE hasParen e = HsSpliceE (mkUntypedSplice hasParen e) -mkHsSpliceTE :: HasParens -> LHsExpr RdrName -> HsExpr RdrName +mkHsSpliceTE :: SpliceDecoration -> LHsExpr RdrName -> HsExpr RdrName mkHsSpliceTE hasParen e = HsSpliceE (HsTypedSplice hasParen unqualSplice e) -mkHsSpliceTy :: HasParens -> LHsExpr RdrName -> HsType RdrName +mkHsSpliceTy :: SpliceDecoration -> LHsExpr RdrName -> HsType RdrName mkHsSpliceTy hasParen e = HsSpliceTy (HsUntypedSplice hasParen unqualSplice e) placeHolderKind diff --git a/compiler/parser/Parser.y b/compiler/parser/Parser.y index 721559f..b590333 100644 --- a/compiler/parser/Parser.y +++ b/compiler/parser/Parser.y @@ -1876,7 +1876,7 @@ atype :: { LHsType RdrName } | quasiquote { sL1 $1 (HsSpliceTy (unLoc $1) placeHolderKind) } | '$(' exp ')' {% ams (sLL $1 $> $ mkHsSpliceTy HasParens $2) [mj AnnOpenPE $1,mj AnnCloseP $3] } - | TH_ID_SPLICE {%ams (sLL $1 $> $ mkHsSpliceTy NoParens $ sL1 $1 $ HsVar $ + | TH_ID_SPLICE {%ams (sLL $1 $> $ mkHsSpliceTy HasDollar $ sL1 $1 $ HsVar $ (sL1 $1 (mkUnqual varName (getTH_ID_SPLICE $1)))) [mj AnnThIdSplice $1] } -- see Note [Promotion] for the followings @@ -2540,13 +2540,13 @@ aexp2 :: { LHsExpr RdrName } [mu AnnOpenB $1,mu AnnCloseB $4] } splice_exp :: { LHsExpr RdrName } - : TH_ID_SPLICE {% ams (sL1 $1 $ mkHsSpliceE NoParens + : TH_ID_SPLICE {% ams (sL1 $1 $ mkHsSpliceE HasDollar (sL1 $1 $ HsVar (sL1 $1 (mkUnqual varName (getTH_ID_SPLICE $1))))) [mj AnnThIdSplice $1] } | '$(' exp ')' {% ams (sLL $1 $> $ mkHsSpliceE HasParens $2) [mj AnnOpenPE $1,mj AnnCloseP $3] } - | TH_ID_TY_SPLICE {% ams (sL1 $1 $ mkHsSpliceTE NoParens + | TH_ID_TY_SPLICE {% ams (sL1 $1 $ mkHsSpliceTE HasDollar (sL1 $1 $ HsVar (sL1 $1 (mkUnqual varName (getTH_ID_TY_SPLICE $1))))) [mj AnnThIdTySplice $1] } diff --git a/testsuite/tests/printer/Ppr037.hs b/testsuite/tests/printer/Ppr037.hs index a812643..1ece439 100644 --- a/testsuite/tests/printer/Ppr037.hs +++ b/testsuite/tests/printer/Ppr037.hs @@ -62,3 +62,5 @@ class (kparam ~ 'KProxy) => SEq (kparam :: KProxy k) where infix 4 %:/= $(singEqInstances basicTypes) +$singEqInstances basicTypes +singEqInstances basicTypes From git at git.haskell.org Mon Feb 27 13:20:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Feb 2017 13:20:30 +0000 (UTC) Subject: [commit: ghc] branch 'wip/rwbarton-D3217' created Message-ID: <20170227132030.CC5C03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/rwbarton-D3217 Referencing: ecd2bf89816bd6f5f4c3e7648037d80fd79abb72 From git at git.haskell.org Mon Feb 27 13:20:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Feb 2017 13:20:34 +0000 (UTC) Subject: [commit: ghc] wip/rwbarton-D3217: When floating, don't box an expression that's okay for speculation (#13338) (ecd2bf8) Message-ID: <20170227132034.164F73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rwbarton-D3217 Link : http://ghc.haskell.org/trac/ghc/changeset/ecd2bf89816bd6f5f4c3e7648037d80fd79abb72/ghc >--------------------------------------------------------------- commit ecd2bf89816bd6f5f4c3e7648037d80fd79abb72 Author: Reid Barton Date: Sun Feb 26 12:09:47 2017 -0500 When floating, don't box an expression that's okay for speculation (#13338) Summary: Commit 432f952e (Float unboxed expressions by boxing) lets the float-out pass turn, for example, ... (-# (remInt# x# 100000#) i#) ... into let lvl :: Int lvl = case remInt# x# 100000# of v { __DEFAULT__ -> I# v } in ... (-# (case lvl of { I# v -> v }) i#) ... But when, as in the example above, the expression that was floated out was the argument of an application, the resulting application may no longer satisfy the let/app invariant, because exprOkForSpeculation doesn't look far enough inside the definition of lvl. Solution: When the expression we floated out was okay for speculation, don't bother boxing it. It will be evaluated earlier, and that's okay by assumption. Fixes the let/app invariant and is cheaper too. Test Plan: make slowtest TEST=T13338 Reviewers: simonpj, austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3217 >--------------------------------------------------------------- ecd2bf89816bd6f5f4c3e7648037d80fd79abb72 compiler/simplCore/SetLevels.hs | 9 ++++++++- testsuite/tests/simplCore/should_compile/T13338.hs | 12 ++++++++++++ testsuite/tests/simplCore/should_compile/all.T | 1 + 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/compiler/simplCore/SetLevels.hs b/compiler/simplCore/SetLevels.hs index 22d4048..0e067cc 100644 --- a/compiler/simplCore/SetLevels.hs +++ b/compiler/simplCore/SetLevels.hs @@ -561,9 +561,15 @@ lvlMFE env strict_ctxt ann_expr = -- Don't float it out lvlExpr env ann_expr - | float_is_new_lam || need_join || exprIsTopLevelBindable expr expr_ty + | float_is_new_lam || need_join || exprIsTopLevelBindable expr expr_ty + || exprOkForSpeculation expr && not (isTopLvl dest_lvl) -- No wrapping needed if the type is lifted, or is a literal string -- or if we are wrapping it in one or more value lambdas + -- or is okay for speculation (we'll now evaluate it earlier). + -- In the last case we _must not_ wrap, because it could violate + -- the let/app invariant (Trac #13338). + -- But we can't float an unboxed thing to top level; so don't float + -- it all, as in lvlBind. (See "Don't break let/app" below.) = do { expr1 <- lvlFloatRhs abs_vars dest_lvl rhs_env NonRecursive join_arity_maybe ann_expr -- Treat the expr just like a right-hand side ; var <- newLvlVar expr1 join_arity_maybe @@ -578,6 +584,7 @@ lvlMFE env strict_ctxt ann_expr | escapes_value_lam , not (exprIsCheap expr) -- Boxing/unboxing isn't worth -- it for cheap expressions + , not (exprOkForSpeculation expr && isTopLvl dest_lvl) -- Don't break let/app , Just (tc, _) <- splitTyConApp_maybe expr_ty , Just dc <- boxingDataCon_maybe tc , let dc_res_ty = dataConOrigResTy dc -- No free type variables diff --git a/testsuite/tests/simplCore/should_compile/T13338.hs b/testsuite/tests/simplCore/should_compile/T13338.hs new file mode 100644 index 0000000..347a9d7 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T13338.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE MagicHash #-} + +module T13338 where + +import GHC.Exts + +magic# :: Int# -> Bool +magic# x# = True +{-# NOINLINE magic# #-} + +f :: Int# -> Int -> Int +f x# n = length [ i | i@(I# i#) <- [0..n], magic# (remInt# x# 100000# -# i#) ] diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index 53f5ade..23cd77c 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -244,3 +244,4 @@ test('T13317', normal, run_command, ['$MAKE -s --no-print-directory T13317']) +test('T13338', only_ways(['optasm']), compile, ['-dcore-lint']) From git at git.haskell.org Mon Feb 27 13:45:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Feb 2017 13:45:11 +0000 (UTC) Subject: [commit: ghc] wip/rwbarton-D3217: Cleanup and comments from Simon (e105443) Message-ID: <20170227134511.8CEEE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rwbarton-D3217 Link : http://ghc.haskell.org/trac/ghc/changeset/e1054431affb92a0719419fea8701dc549edf0ac/ghc >--------------------------------------------------------------- commit e1054431affb92a0719419fea8701dc549edf0ac Author: Reid Barton Date: Mon Feb 27 08:43:14 2017 -0500 Cleanup and comments from Simon >--------------------------------------------------------------- e1054431affb92a0719419fea8701dc549edf0ac compiler/simplCore/SetLevels.hs | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/compiler/simplCore/SetLevels.hs b/compiler/simplCore/SetLevels.hs index 0e067cc..e51c6d0 100644 --- a/compiler/simplCore/SetLevels.hs +++ b/compiler/simplCore/SetLevels.hs @@ -64,7 +64,7 @@ module SetLevels ( import CoreSyn import CoreMonad ( FloatOutSwitches(..) ) -import CoreUtils ( exprType, exprIsCheap, exprIsHNF +import CoreUtils ( exprType, exprIsHNF , exprOkForSpeculation , exprIsTopLevelBindable , isExprLevPoly @@ -562,14 +562,11 @@ lvlMFE env strict_ctxt ann_expr lvlExpr env ann_expr | float_is_new_lam || need_join || exprIsTopLevelBindable expr expr_ty - || exprOkForSpeculation expr && not (isTopLvl dest_lvl) + || expr_ok_for_spec && not (isTopLvl dest_lvl) -- No wrapping needed if the type is lifted, or is a literal string -- or if we are wrapping it in one or more value lambdas -- or is okay for speculation (we'll now evaluate it earlier). - -- In the last case we _must not_ wrap, because it could violate - -- the let/app invariant (Trac #13338). - -- But we can't float an unboxed thing to top level; so don't float - -- it all, as in lvlBind. (See "Don't break let/app" below.) + -- But in the last case, we can't float an unlifted thing to top level = do { expr1 <- lvlFloatRhs abs_vars dest_lvl rhs_env NonRecursive join_arity_maybe ann_expr -- Treat the expr just like a right-hand side ; var <- newLvlVar expr1 join_arity_maybe @@ -582,9 +579,8 @@ lvlMFE env strict_ctxt ann_expr -- Try for the boxing strategy -- See Note [Floating MFEs of unlifted type] | escapes_value_lam - , not (exprIsCheap expr) -- Boxing/unboxing isn't worth - -- it for cheap expressions - , not (exprOkForSpeculation expr && isTopLvl dest_lvl) -- Don't break let/app + , not expr_ok_for_spec -- Boxing/unboxing isn't worth it for cheap expressions + -- See Note [Test cheapness with exprOkForSpeculation] , Just (tc, _) <- splitTyConApp_maybe expr_ty , Just dc <- boxingDataCon_maybe tc , let dc_res_ty = dataConOrigResTy dc -- No free type variables @@ -650,6 +646,8 @@ lvlMFE env strict_ctxt ann_expr && floatConsts env && (not strict_ctxt || is_bot || exprIsHNF expr) + expr_ok_for_spec = exprOkForSpeculation expr + isBottomThunk :: Maybe (Arity, s) -> Bool -- See Note [Bottoming floats] (2) isBottomThunk (Just (0, _)) = True -- Zero arity @@ -741,6 +739,21 @@ It works fine, but it's 50% slower (based on some crude benchmarking). I suppose we could do it for types not covered by boxingDataCon_maybe, but it's more code and I'll wait to see if anyone wants it. +Note [Test cheapness with exprOkForSpeculation] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +We don't want to float very cheap expressions by boxing and unboxing. +But we use exprOkForSpeculation for the test, not exprIsCheap. +Why? Because it's important /not/ to transform + f (a /# 3) +to + f (case bx of I# a -> a /# 3) +and float bx = I# (a /# 3), because the application of f no +longer obeys the let/app invariant. But (a /# 3) is ok-for-spec +due to a special hack that says division operators can't fail +when the denominator is definitely no-zero. And yet that +same expression says False to exprIsCheap. Simplest way to +guarantee the let/app invariant is to use the same function! + Note [Bottoming floats] ~~~~~~~~~~~~~~~~~~~~~~~ If we see From git at git.haskell.org Mon Feb 27 14:11:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Feb 2017 14:11:33 +0000 (UTC) Subject: [commit: ghc] master: Stop uniques ending up in SPEC rule names (0f7a369) Message-ID: <20170227141133.A42C83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0f7a369f78b7ef05d958d331bb02ad2d361abee0/ghc >--------------------------------------------------------------- commit 0f7a369f78b7ef05d958d331bb02ad2d361abee0 Author: Simon Peyton Jones Date: Mon Feb 27 09:09:26 2017 -0500 Stop uniques ending up in SPEC rule names Reviewers: austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3191 >--------------------------------------------------------------- 0f7a369f78b7ef05d958d331bb02ad2d361abee0 compiler/specialise/Specialise.hs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/compiler/specialise/Specialise.hs b/compiler/specialise/Specialise.hs index 0090417..9e189df 100644 --- a/compiler/specialise/Specialise.hs +++ b/compiler/specialise/Specialise.hs @@ -1293,10 +1293,11 @@ specCalls mb_mod env rules_for_me calls_for_me fn rhs Just this_mod -- Specialising imoprted fn -> text "SPEC/" <> ppr this_mod - rule_name = mkFastString $ showSDocForUser dflags neverQualify $ - herald <+> ppr fn <+> hsep (map ppr_call_key_ty call_ts) - -- This name ends up in interface files, so use showSDocForUser, - -- otherwise uniques end up there, making builds + rule_name = mkFastString $ showSDoc dflags $ + herald <+> ftext (occNameFS (getOccName fn)) + <+> hsep (map ppr_call_key_ty call_ts) + -- This name ends up in interface files, so use occNameString. + -- Otherwise uniques end up there, making builds -- less deterministic (See #4012 comment:61 ff) rule_wout_eta = mkRule From git at git.haskell.org Mon Feb 27 18:25:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Feb 2017 18:25:34 +0000 (UTC) Subject: [commit: ghc] branch 'wip/rwbarton-float-unboxed' created Message-ID: <20170227182534.C29F83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/rwbarton-float-unboxed Referencing: 8f99cfa49be0fc0767f0c73967ff2472de5cfcd6 From git at git.haskell.org Mon Feb 27 18:25:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Feb 2017 18:25:37 +0000 (UTC) Subject: [commit: ghc] wip/rwbarton-float-unboxed: Cleanup and comments from Simon (d30b1e1) Message-ID: <20170227182537.7B3C83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rwbarton-float-unboxed Link : http://ghc.haskell.org/trac/ghc/changeset/d30b1e15d73c8638cc76debfbd63c1263cb3bcd5/ghc >--------------------------------------------------------------- commit d30b1e15d73c8638cc76debfbd63c1263cb3bcd5 Author: Reid Barton Date: Mon Feb 27 08:43:14 2017 -0500 Cleanup and comments from Simon >--------------------------------------------------------------- d30b1e15d73c8638cc76debfbd63c1263cb3bcd5 compiler/simplCore/SetLevels.hs | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/compiler/simplCore/SetLevels.hs b/compiler/simplCore/SetLevels.hs index 0e067cc..e51c6d0 100644 --- a/compiler/simplCore/SetLevels.hs +++ b/compiler/simplCore/SetLevels.hs @@ -64,7 +64,7 @@ module SetLevels ( import CoreSyn import CoreMonad ( FloatOutSwitches(..) ) -import CoreUtils ( exprType, exprIsCheap, exprIsHNF +import CoreUtils ( exprType, exprIsHNF , exprOkForSpeculation , exprIsTopLevelBindable , isExprLevPoly @@ -562,14 +562,11 @@ lvlMFE env strict_ctxt ann_expr lvlExpr env ann_expr | float_is_new_lam || need_join || exprIsTopLevelBindable expr expr_ty - || exprOkForSpeculation expr && not (isTopLvl dest_lvl) + || expr_ok_for_spec && not (isTopLvl dest_lvl) -- No wrapping needed if the type is lifted, or is a literal string -- or if we are wrapping it in one or more value lambdas -- or is okay for speculation (we'll now evaluate it earlier). - -- In the last case we _must not_ wrap, because it could violate - -- the let/app invariant (Trac #13338). - -- But we can't float an unboxed thing to top level; so don't float - -- it all, as in lvlBind. (See "Don't break let/app" below.) + -- But in the last case, we can't float an unlifted thing to top level = do { expr1 <- lvlFloatRhs abs_vars dest_lvl rhs_env NonRecursive join_arity_maybe ann_expr -- Treat the expr just like a right-hand side ; var <- newLvlVar expr1 join_arity_maybe @@ -582,9 +579,8 @@ lvlMFE env strict_ctxt ann_expr -- Try for the boxing strategy -- See Note [Floating MFEs of unlifted type] | escapes_value_lam - , not (exprIsCheap expr) -- Boxing/unboxing isn't worth - -- it for cheap expressions - , not (exprOkForSpeculation expr && isTopLvl dest_lvl) -- Don't break let/app + , not expr_ok_for_spec -- Boxing/unboxing isn't worth it for cheap expressions + -- See Note [Test cheapness with exprOkForSpeculation] , Just (tc, _) <- splitTyConApp_maybe expr_ty , Just dc <- boxingDataCon_maybe tc , let dc_res_ty = dataConOrigResTy dc -- No free type variables @@ -650,6 +646,8 @@ lvlMFE env strict_ctxt ann_expr && floatConsts env && (not strict_ctxt || is_bot || exprIsHNF expr) + expr_ok_for_spec = exprOkForSpeculation expr + isBottomThunk :: Maybe (Arity, s) -> Bool -- See Note [Bottoming floats] (2) isBottomThunk (Just (0, _)) = True -- Zero arity @@ -741,6 +739,21 @@ It works fine, but it's 50% slower (based on some crude benchmarking). I suppose we could do it for types not covered by boxingDataCon_maybe, but it's more code and I'll wait to see if anyone wants it. +Note [Test cheapness with exprOkForSpeculation] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +We don't want to float very cheap expressions by boxing and unboxing. +But we use exprOkForSpeculation for the test, not exprIsCheap. +Why? Because it's important /not/ to transform + f (a /# 3) +to + f (case bx of I# a -> a /# 3) +and float bx = I# (a /# 3), because the application of f no +longer obeys the let/app invariant. But (a /# 3) is ok-for-spec +due to a special hack that says division operators can't fail +when the denominator is definitely no-zero. And yet that +same expression says False to exprIsCheap. Simplest way to +guarantee the let/app invariant is to use the same function! + Note [Bottoming floats] ~~~~~~~~~~~~~~~~~~~~~~~ If we see From git at git.haskell.org Mon Feb 27 18:25:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Feb 2017 18:25:40 +0000 (UTC) Subject: [commit: ghc] wip/rwbarton-float-unboxed: More comments and cleanup (28664d7) Message-ID: <20170227182540.332373A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rwbarton-float-unboxed Link : http://ghc.haskell.org/trac/ghc/changeset/28664d742eb0f790e5dbbcdd30d4dbc3bbec5412/ghc >--------------------------------------------------------------- commit 28664d742eb0f790e5dbbcdd30d4dbc3bbec5412 Author: Reid Barton Date: Mon Feb 27 13:16:31 2017 -0500 More comments and cleanup >--------------------------------------------------------------- 28664d742eb0f790e5dbbcdd30d4dbc3bbec5412 compiler/simplCore/SetLevels.hs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/compiler/simplCore/SetLevels.hs b/compiler/simplCore/SetLevels.hs index e51c6d0..94d5bcd 100644 --- a/compiler/simplCore/SetLevels.hs +++ b/compiler/simplCore/SetLevels.hs @@ -611,6 +611,7 @@ lvlMFE env strict_ctxt ann_expr mb_bot_str = exprBotStrictness_maybe expr -- See Note [Bottoming floats] -- esp Bottoming floats (2) + expr_ok_for_spec = exprOkForSpeculation expr dest_lvl = destLevel env fvs is_function is_bot need_join abs_vars = abstractVars dest_lvl env fvs @@ -646,8 +647,6 @@ lvlMFE env strict_ctxt ann_expr && floatConsts env && (not strict_ctxt || is_bot || exprIsHNF expr) - expr_ok_for_spec = exprOkForSpeculation expr - isBottomThunk :: Maybe (Arity, s) -> Bool -- See Note [Bottoming floats] (2) isBottomThunk (Just (0, _)) = True -- Zero arity @@ -720,6 +719,15 @@ float a boxed version and replace the original (f x) with case (case y of I# r -> r) of r -> blah +However if the expression to be floated (f x) is okay for speculation, +just float it without any boxing/unboxing. We'll evaluate it earlier, +but that's okay because the expression is okay for speculation. Simpler +and cheaper than boxing and unboxing. The only potential snag is that +we can't float an unlifted binding to top-level (unless it is an unboxed +string literal). In this case, we just don't float the expression at all. +No great loss since, by assumption, it is cheap to compute anyways. See +Note [Test cheapness with exprOkForSpeculation]. + Being able to float unboxed expressions is sometimes important; see Trac #12603. I'm not sure how /often/ it is important, but it's not hard to achieve. From git at git.haskell.org Mon Feb 27 18:25:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 27 Feb 2017 18:25:42 +0000 (UTC) Subject: [commit: ghc] wip/rwbarton-float-unboxed: WIP: Less floating out of unboxed strings (8f99cfa) Message-ID: <20170227182542.DCB523A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rwbarton-float-unboxed Link : http://ghc.haskell.org/trac/ghc/changeset/8f99cfa49be0fc0767f0c73967ff2472de5cfcd6/ghc >--------------------------------------------------------------- commit 8f99cfa49be0fc0767f0c73967ff2472de5cfcd6 Author: Reid Barton Date: Mon Feb 27 13:25:19 2017 -0500 WIP: Less floating out of unboxed strings >--------------------------------------------------------------- 8f99cfa49be0fc0767f0c73967ff2472de5cfcd6 compiler/simplCore/SetLevels.hs | 2 +- compiler/simplCore/Simplify.hs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/simplCore/SetLevels.hs b/compiler/simplCore/SetLevels.hs index 94d5bcd..6d6e38e 100644 --- a/compiler/simplCore/SetLevels.hs +++ b/compiler/simplCore/SetLevels.hs @@ -561,7 +561,7 @@ lvlMFE env strict_ctxt ann_expr = -- Don't float it out lvlExpr env ann_expr - | float_is_new_lam || need_join || exprIsTopLevelBindable expr expr_ty + | float_is_new_lam || need_join || not (isUnliftedType expr_ty) || expr_ok_for_spec && not (isTopLvl dest_lvl) -- No wrapping needed if the type is lifted, or is a literal string -- or if we are wrapping it in one or more value lambdas diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index 4ef2994..8d0fb56 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -682,7 +682,7 @@ bindingOk :: TopLevelFlag -> CoreExpr -> Type -> Bool -- True iff we can have a binding of this expression at this level -- Precondition: the type is the type of the expression bindingOk top_lvl expr expr_ty - | isTopLevel top_lvl = exprIsTopLevelBindable expr expr_ty + | isTopLevel top_lvl = not (isUnliftedType expr_ty) | otherwise = True {- From git at git.haskell.org Tue Feb 28 06:21:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 28 Feb 2017 06:21:45 +0000 (UTC) Subject: [commit: ghc] master: Fix windows build broken by D3080 (0d86aa5904e5a06c93632357122e57e4e118fd2a) (990f182) Message-ID: <20170228062145.0CEEB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/990f182ad0cd5f588453cfbbb5018aca205017eb/ghc >--------------------------------------------------------------- commit 990f182ad0cd5f588453cfbbb5018aca205017eb Author: Tamar Christina Date: Tue Feb 28 06:21:17 2017 +0000 Fix windows build broken by D3080 (0d86aa5904e5a06c93632357122e57e4e118fd2a) >--------------------------------------------------------------- 990f182ad0cd5f588453cfbbb5018aca205017eb libraries/base/GHC/IO/Handle/Lock.hsc | 1 - 1 file changed, 1 deletion(-) diff --git a/libraries/base/GHC/IO/Handle/Lock.hsc b/libraries/base/GHC/IO/Handle/Lock.hsc index 1da0308..d03e261 100644 --- a/libraries/base/GHC/IO/Handle/Lock.hsc +++ b/libraries/base/GHC/IO/Handle/Lock.hsc @@ -42,7 +42,6 @@ import Foreign.C.Error import Foreign.C.Types import Foreign.Marshal.Alloc import Foreign.Marshal.Utils -import GHC.IO.Exception import GHC.IO.FD import GHC.IO.Handle.FD import GHC.Ptr From git at git.haskell.org Tue Feb 28 06:58:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 28 Feb 2017 06:58:09 +0000 (UTC) Subject: [commit: ghc] master: Fix Mac OS X timestamp resolution bug. (c435402) Message-ID: <20170228065809.C06D03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c4354027ab73d2f9d04f1e352512eccd8ff09ab0/ghc >--------------------------------------------------------------- commit c4354027ab73d2f9d04f1e352512eccd8ff09ab0 Author: Edward Z. Yang Date: Mon Feb 27 15:15:37 2017 -0800 Fix Mac OS X timestamp resolution bug. Test Plan: validate Reviewers: bgamari, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3229 >--------------------------------------------------------------- c4354027ab73d2f9d04f1e352512eccd8ff09ab0 testsuite/tests/backpack/cabal/bkpcabal05/Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/testsuite/tests/backpack/cabal/bkpcabal05/Makefile b/testsuite/tests/backpack/cabal/bkpcabal05/Makefile index d4c116b..b5a7fa5 100644 --- a/testsuite/tests/backpack/cabal/bkpcabal05/Makefile +++ b/testsuite/tests/backpack/cabal/bkpcabal05/Makefile @@ -5,6 +5,10 @@ include $(TOP)/mk/test.mk SETUP='$(PWD)/Setup' -v0 CONFIGURE=$(SETUP) configure $(CABAL_MINIMAL_BUILD) --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' --package-db='$(PWD)/tmp.d' --prefix='$(PWD)/inst' +# This test checks if recompilation works correctly when we change an +# hsig file which modifies the set of exported instances. Makes sure +# we track dependencies on instances from signatures correctly. + bkpcabal05: clean $(MAKE) -s --no-print-directory clean '$(GHC_PKG)' init tmp.d @@ -13,6 +17,7 @@ bkpcabal05: clean cp A.hsig.in1 A.hsig # typecheck $(SETUP) build + sleep 1 cp A.hsig.in2 A.hsig ! $(SETUP) build ifneq "$(CLEANUP)" "" From git at git.haskell.org Tue Feb 28 07:01:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 28 Feb 2017 07:01:05 +0000 (UTC) Subject: [commit: ghc] master: Clear import path in --backpack mode to not accidentally pick up source files. (377bf37) Message-ID: <20170228070105.A11523A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/377bf3736bbeb5aacb0571a7863d1a4323514066/ghc >--------------------------------------------------------------- commit 377bf3736bbeb5aacb0571a7863d1a4323514066 Author: Edward Z. Yang Date: Thu Feb 23 23:35:42 2017 -0800 Clear import path in --backpack mode to not accidentally pick up source files. Signed-off-by: Edward Z. Yang >--------------------------------------------------------------- 377bf3736bbeb5aacb0571a7863d1a4323514066 compiler/backpack/DriverBkp.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compiler/backpack/DriverBkp.hs b/compiler/backpack/DriverBkp.hs index e14e2d8..38b9d4f 100644 --- a/compiler/backpack/DriverBkp.hs +++ b/compiler/backpack/DriverBkp.hs @@ -183,6 +183,8 @@ withBkpSession cid insts deps session_type do_this = do outputFile = if session_type == ExeSession then outputFile dflags else Nothing, + -- Clear the import path so we don't accidentally grab anything + importPaths = [], -- Synthesized the flags packageFlags = packageFlags dflags ++ map (\(uid0, rn) -> let uid = unwireUnitId dflags (improveUnitId (getPackageConfigMap dflags) $ renameHoleUnitId dflags (listToUFM insts) uid0) From git at git.haskell.org Tue Feb 28 15:19:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 28 Feb 2017 15:19:03 +0000 (UTC) Subject: [commit: ghc] wip/rwbarton-float-unboxed: WIP: Less floating out of unboxed strings (04ffaf5) Message-ID: <20170228151903.C67303A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rwbarton-float-unboxed Link : http://ghc.haskell.org/trac/ghc/changeset/04ffaf5efc08fbbd73fb3c957e11522a0d3c1eec/ghc >--------------------------------------------------------------- commit 04ffaf5efc08fbbd73fb3c957e11522a0d3c1eec Author: Reid Barton Date: Mon Feb 27 13:25:19 2017 -0500 WIP: Less floating out of unboxed strings >--------------------------------------------------------------- 04ffaf5efc08fbbd73fb3c957e11522a0d3c1eec compiler/simplCore/SetLevels.hs | 3 +-- compiler/simplCore/Simplify.hs | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/compiler/simplCore/SetLevels.hs b/compiler/simplCore/SetLevels.hs index 94d5bcd..2ab0cdc 100644 --- a/compiler/simplCore/SetLevels.hs +++ b/compiler/simplCore/SetLevels.hs @@ -66,7 +66,6 @@ import CoreSyn import CoreMonad ( FloatOutSwitches(..) ) import CoreUtils ( exprType, exprIsHNF , exprOkForSpeculation - , exprIsTopLevelBindable , isExprLevPoly , collectMakeStaticArgs ) @@ -561,7 +560,7 @@ lvlMFE env strict_ctxt ann_expr = -- Don't float it out lvlExpr env ann_expr - | float_is_new_lam || need_join || exprIsTopLevelBindable expr expr_ty + | float_is_new_lam || need_join || not (isUnliftedType expr_ty) || expr_ok_for_spec && not (isTopLvl dest_lvl) -- No wrapping needed if the type is lifted, or is a literal string -- or if we are wrapping it in one or more value lambdas diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index 4ef2994..0bdfb85 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -681,8 +681,8 @@ makeTrivialWithInfo top_lvl env context info expr bindingOk :: TopLevelFlag -> CoreExpr -> Type -> Bool -- True iff we can have a binding of this expression at this level -- Precondition: the type is the type of the expression -bindingOk top_lvl expr expr_ty - | isTopLevel top_lvl = exprIsTopLevelBindable expr expr_ty +bindingOk top_lvl _expr expr_ty + | isTopLevel top_lvl = not (isUnliftedType expr_ty) | otherwise = True {- From git at git.haskell.org Tue Feb 28 15:59:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 28 Feb 2017 15:59:12 +0000 (UTC) Subject: [commit: ghc] master: DmdAnal: Clarify reference to Cardinality Analysis paper (36b6e13) Message-ID: <20170228155912.613443A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/36b6e131d252814bca8bf7e684e50466dc12483b/ghc >--------------------------------------------------------------- commit 36b6e131d252814bca8bf7e684e50466dc12483b Author: Ben Gamari Date: Sun Feb 26 18:45:14 2017 -0500 DmdAnal: Clarify reference to Cardinality Analysis paper >--------------------------------------------------------------- 36b6e131d252814bca8bf7e684e50466dc12483b compiler/stranal/DmdAnal.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/stranal/DmdAnal.hs b/compiler/stranal/DmdAnal.hs index ee56d85..38dc6e3 100644 --- a/compiler/stranal/DmdAnal.hs +++ b/compiler/stranal/DmdAnal.hs @@ -111,7 +111,7 @@ dmdTransformThunkDmd e -- Do not process absent demands -- Otherwise act like in a normal demand analysis --- See |-* relation in the companion paper +-- See ↦* relation in the Cardinality Analysis paper dmdAnalStar :: AnalEnv -> Demand -- This one takes a *Demand* -> CoreExpr -> (BothDmdArg, CoreExpr) From git at git.haskell.org Tue Feb 28 15:59:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 28 Feb 2017 15:59:15 +0000 (UTC) Subject: [commit: ghc] master: base: Expose Module from Type.Reflection (1db71f5) Message-ID: <20170228155915.1DAD73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1db71f59de37987446487c7c6ee502020d34f42a/ghc >--------------------------------------------------------------- commit 1db71f59de37987446487c7c6ee502020d34f42a Author: Ben Gamari Date: Mon Feb 27 17:09:18 2017 -0500 base: Expose Module from Type.Reflection There is no reason why this can't be safely exported. Test Plan: Validate Reviewers: austin, hvr Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3226 >--------------------------------------------------------------- 1db71f59de37987446487c7c6ee502020d34f42a libraries/base/Data/Typeable/Internal.hs | 2 +- libraries/base/Type/Reflection.hs | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libraries/base/Data/Typeable/Internal.hs b/libraries/base/Data/Typeable/Internal.hs index c230d3a..aa8345b 100644 --- a/libraries/base/Data/Typeable/Internal.hs +++ b/libraries/base/Data/Typeable/Internal.hs @@ -40,7 +40,7 @@ module Data.Typeable.Internal ( -- * Module Module, -- Abstract - moduleName, modulePackage, + moduleName, modulePackage, rnfModule, -- * TyCon TyCon, -- Abstract diff --git a/libraries/base/Type/Reflection.hs b/libraries/base/Type/Reflection.hs index 37efcba..59f16ac 100644 --- a/libraries/base/Type/Reflection.hs +++ b/libraries/base/Type/Reflection.hs @@ -61,6 +61,10 @@ module Type.Reflection , I.tyConModule , I.tyConName , I.rnfTyCon + + -- * Module names + , I.Module + , I.moduleName, I.modulePackage, I.rnfModule ) where import qualified Data.Typeable.Internal as I From git at git.haskell.org Tue Feb 28 15:59:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 28 Feb 2017 15:59:17 +0000 (UTC) Subject: [commit: ghc] master: configure: detect whether -lpthreads is necessary for pthreads (e94bfb6) Message-ID: <20170228155917.E10CF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e94bfb677298de3c4b4e0d1223fbc589849b79be/ghc >--------------------------------------------------------------- commit e94bfb677298de3c4b4e0d1223fbc589849b79be Author: Ben Gamari Date: Sun Feb 26 19:28:08 2017 -0500 configure: detect whether -lpthreads is necessary for pthreads Some platforms have pthreads support available without linking against libpthread (and indeed don't even offer a libpthread to link against). One example of this is Android's bionic library. Teach the RTS about this case. Test Plan: Validate while cross-compiling targetting Android on aarch64 Reviewers: simonmar, austin, hvr, erikd, rwbarton Subscribers: danharaj, thomie, erikd, snowleopard Differential Revision: https://phabricator.haskell.org/D3149 >--------------------------------------------------------------- e94bfb677298de3c4b4e0d1223fbc589849b79be configure.ac | 25 +++++++++++++++++++++++++ rts/package.conf.in | 2 ++ 2 files changed, 27 insertions(+) diff --git a/configure.ac b/configure.ac index ec526d8..3c153c6 100644 --- a/configure.ac +++ b/configure.ac @@ -946,6 +946,31 @@ AC_TRY_LINK_FUNC(printf\$LDBLStub, [Define to 1 if we have printf$LDBLStub (Apple Mac OS >= 10.4, PPC).]) ]) +dnl Some platforms (e.g. Android's Bionic) have pthreads support available +dnl without linking against libpthread. Check whether -lpthread is necessary +dnl to use pthreads. +dnl +dnl Note that it is important that this happens before we AC_CHECK_LIB(thread) +AC_MSG_CHECKING(whether -lpthread is needed for pthreads) +AC_CHECK_FUNC(pthread_create, + [ + AC_MSG_RESULT(no) + need_lpthread=0 + ], + [ + AC_CHECK_LIB(pthread, pthread_create, + [ + AC_MSG_RESULT(yes) + need_lpthread=1 + ], + [ + AC_MSG_RESULT([no pthreads support found.]) + need_lpthread=0 + ]) + ]) +AC_DEFINE_UNQUOTED([NEED_PTHREAD_LIB], [$need_lpthread], + [Define 1 if we need to link code using pthreads with -lpthread]) + dnl ** pthread_setname_np is a recent addition to glibc, and OS X has dnl a different single-argument version. AC_CHECK_LIB(pthread, pthread_setname_np) diff --git a/rts/package.conf.in b/rts/package.conf.in index 338fcb1..02437ae 100644 --- a/rts/package.conf.in +++ b/rts/package.conf.in @@ -46,7 +46,9 @@ extra-libraries: ,"gdi32" /* for the linker */ ,"winmm" /* for the linker */ #endif +#if NEED_PTHREAD_LIB , "pthread" /* for pthread_getthreadid_np, pthread_create, etc. */ +#endif #if defined(DEBUG) && defined(HAVE_LIBBFD) ,"bfd", "iberty" /* for debugging */ #endif From git at git.haskell.org Tue Feb 28 15:59:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 28 Feb 2017 15:59:21 +0000 (UTC) Subject: [commit: ghc] master: When floating, don't box an expression that's okay for speculation (#13338) (d0508ef) Message-ID: <20170228155921.27C763A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d0508ef001e9c93920f6eb066cab5e79041cb886/ghc >--------------------------------------------------------------- commit d0508ef001e9c93920f6eb066cab5e79041cb886 Author: Reid Barton Date: Mon Feb 27 17:13:24 2017 -0500 When floating, don't box an expression that's okay for speculation (#13338) Commit 432f952e (Float unboxed expressions by boxing) lets the float-out pass turn, for example, ... (-# (remInt# x# 100000#) i#) ... into let lvl :: Int lvl = case remInt# x# 100000# of v { __DEFAULT__ -> I# v } in ... (-# (case lvl of { I# v -> v }) i#) ... But when, as in the example above, the expression that was floated out was the argument of an application, the resulting application may no longer satisfy the let/app invariant, because exprOkForSpeculation doesn't look far enough inside the definition of lvl. Solution: When the expression we floated out was okay for speculation, don't bother boxing it. It will be evaluated earlier, and that's okay by assumption. Fixes the let/app invariant and is cheaper too. Test Plan: make slowtest TEST=T13338 Reviewers: austin, bgamari, simonpj Reviewed By: bgamari, simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3217 >--------------------------------------------------------------- d0508ef001e9c93920f6eb066cab5e79041cb886 compiler/simplCore/SetLevels.hs | 36 +++++++++++++++++++--- testsuite/tests/simplCore/should_compile/T13338.hs | 12 ++++++++ testsuite/tests/simplCore/should_compile/all.T | 1 + 3 files changed, 45 insertions(+), 4 deletions(-) diff --git a/compiler/simplCore/SetLevels.hs b/compiler/simplCore/SetLevels.hs index 7b17c8d..b4bd0ba 100644 --- a/compiler/simplCore/SetLevels.hs +++ b/compiler/simplCore/SetLevels.hs @@ -64,7 +64,7 @@ module SetLevels ( import CoreSyn import CoreMonad ( FloatOutSwitches(..) ) -import CoreUtils ( exprType, exprIsCheap, exprIsHNF +import CoreUtils ( exprType, exprIsHNF , exprOkForSpeculation , exprIsTopLevelBindable , isExprLevPoly @@ -561,9 +561,12 @@ lvlMFE env strict_ctxt ann_expr = -- Don't float it out lvlExpr env ann_expr - | float_is_new_lam || need_join || exprIsTopLevelBindable expr expr_ty + | float_is_new_lam || need_join || exprIsTopLevelBindable expr expr_ty + || expr_ok_for_spec && not (isTopLvl dest_lvl) -- No wrapping needed if the type is lifted, or is a literal string -- or if we are wrapping it in one or more value lambdas + -- or is okay for speculation (we'll now evaluate it earlier). + -- But in the last case, we can't float an unlifted thing to top level = do { expr1 <- lvlFloatRhs abs_vars dest_lvl rhs_env NonRecursive join_arity_maybe ann_expr -- Treat the expr just like a right-hand side ; var <- newLvlVar expr1 join_arity_maybe is_mk_static @@ -576,8 +579,8 @@ lvlMFE env strict_ctxt ann_expr -- Try for the boxing strategy -- See Note [Floating MFEs of unlifted type] | escapes_value_lam - , not (exprIsCheap expr) -- Boxing/unboxing isn't worth - -- it for cheap expressions + , not expr_ok_for_spec -- Boxing/unboxing isn't worth it for cheap expressions + -- See Note [Test cheapness with exprOkForSpeculation] , Just (tc, _) <- splitTyConApp_maybe expr_ty , Just dc <- boxingDataCon_maybe tc , let dc_res_ty = dataConOrigResTy dc -- No free type variables @@ -608,6 +611,7 @@ lvlMFE env strict_ctxt ann_expr mb_bot_str = exprBotStrictness_maybe expr -- See Note [Bottoming floats] -- esp Bottoming floats (2) + expr_ok_for_spec = exprOkForSpeculation expr dest_lvl = destLevel env fvs is_function is_bot need_join abs_vars = abstractVars dest_lvl env fvs @@ -718,6 +722,15 @@ float a boxed version and replace the original (f x) with case (case y of I# r -> r) of r -> blah +However if the expression to be floated (f x) is okay for speculation, +just float it without any boxing/unboxing. We'll evaluate it earlier, +but that's okay because the expression is okay for speculation. Simpler +and cheaper than boxing and unboxing. The only potential snag is that +we can't float an unlifted binding to top-level (unless it is an unboxed +string literal). In this case, we just don't float the expression at all. +No great loss since, by assumption, it is cheap to compute anyways. See +Note [Test cheapness with exprOkForSpeculation]. + Being able to float unboxed expressions is sometimes important; see Trac #12603. I'm not sure how /often/ it is important, but it's not hard to achieve. @@ -737,6 +750,21 @@ It works fine, but it's 50% slower (based on some crude benchmarking). I suppose we could do it for types not covered by boxingDataCon_maybe, but it's more code and I'll wait to see if anyone wants it. +Note [Test cheapness with exprOkForSpeculation] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +We don't want to float very cheap expressions by boxing and unboxing. +But we use exprOkForSpeculation for the test, not exprIsCheap. +Why? Because it's important /not/ to transform + f (a /# 3) +to + f (case bx of I# a -> a /# 3) +and float bx = I# (a /# 3), because the application of f no +longer obeys the let/app invariant. But (a /# 3) is ok-for-spec +due to a special hack that says division operators can't fail +when the denominator is definitely no-zero. And yet that +same expression says False to exprIsCheap. Simplest way to +guarantee the let/app invariant is to use the same function! + Note [Bottoming floats] ~~~~~~~~~~~~~~~~~~~~~~~ If we see diff --git a/testsuite/tests/simplCore/should_compile/T13338.hs b/testsuite/tests/simplCore/should_compile/T13338.hs new file mode 100644 index 0000000..347a9d7 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T13338.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE MagicHash #-} + +module T13338 where + +import GHC.Exts + +magic# :: Int# -> Bool +magic# x# = True +{-# NOINLINE magic# #-} + +f :: Int# -> Int -> Int +f x# n = length [ i | i@(I# i#) <- [0..n], magic# (remInt# x# 100000# -# i#) ] diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index 3fbd4a8..11067e4 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -246,3 +246,4 @@ test('T13317', run_command, ['$MAKE -s --no-print-directory T13317']) test('T13340', expect_broken(13340), run_command, ['$MAKE -s --no-print-directory T13340']) +test('T13338', only_ways(['optasm']), compile, ['-dcore-lint']) From git at git.haskell.org Tue Feb 28 15:59:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 28 Feb 2017 15:59:23 +0000 (UTC) Subject: [commit: ghc] master: Add Eq instances for TrName, Module (5dc28ba) Message-ID: <20170228155923.D373D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5dc28ba5886cd64a864dbda5aa6989bb91838866/ghc >--------------------------------------------------------------- commit 5dc28ba5886cd64a864dbda5aa6989bb91838866 Author: Ben Gamari Date: Mon Feb 27 17:12:04 2017 -0500 Add Eq instances for TrName, Module Test Plan: Validate Reviewers: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3227 >--------------------------------------------------------------- 5dc28ba5886cd64a864dbda5aa6989bb91838866 libraries/ghc-prim/GHC/Classes.hs | 10 ++++++++++ testsuite/tests/typecheck/should_fail/T5095.stderr | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/libraries/ghc-prim/GHC/Classes.hs b/libraries/ghc-prim/GHC/Classes.hs index 3fd4bc0..4479ac0 100644 --- a/libraries/ghc-prim/GHC/Classes.hs +++ b/libraries/ghc-prim/GHC/Classes.hs @@ -58,6 +58,7 @@ import GHC.Magic () import GHC.IntWord64 import GHC.Prim import GHC.Tuple +import GHC.CString (unpackCString#) import GHC.Types #include "MachDeps.h" @@ -171,6 +172,15 @@ instance (Eq a) => Eq [a] where (x:xs) == (y:ys) = x == y && xs == ys _xs == _ys = False +deriving instance Eq Module + +instance Eq TrName where + TrNameS a == TrNameS b = isTrue# (a `eqAddr#` b) + a == b = toString a == toString b + where + toString (TrNameS s) = unpackCString# s + toString (TrNameD s) = s + deriving instance Eq Bool deriving instance Eq Ordering diff --git a/testsuite/tests/typecheck/should_fail/T5095.stderr b/testsuite/tests/typecheck/should_fail/T5095.stderr index a959811..14d864a 100644 --- a/testsuite/tests/typecheck/should_fail/T5095.stderr +++ b/testsuite/tests/typecheck/should_fail/T5095.stderr @@ -7,7 +7,7 @@ T5095.hs:9:9: error: instance Eq Integer -- Defined in ‘integer-gmp-1.0.0.1:GHC.Integer.Type’ ...plus 23 others - ...plus three instances involving out-of-scope types + ...plus five instances involving out-of-scope types (use -fprint-potential-instances to see them all) (The choice depends on the instantiation of ‘a’ To pick the first instance above, use IncoherentInstances From git at git.haskell.org Tue Feb 28 15:59:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 28 Feb 2017 15:59:26 +0000 (UTC) Subject: [commit: ghc] master: Small changes to expression sizing in CoreUnfold (c662d41) Message-ID: <20170228155926.8C2F23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c662d41e2006f5a45619d40d2369b24642348f1a/ghc >--------------------------------------------------------------- commit c662d41e2006f5a45619d40d2369b24642348f1a Author: Simon Peyton Jones Date: Mon Feb 27 17:14:32 2017 -0500 Small changes to expression sizing in CoreUnfold The only significant change here is that case e of {} should be treated like 'e', rather than like a case expression. We don't push a return address, for example, since 'e' is sure to diverge. I forget why I did this; but it will make these empty-case expressions (which are only there to satisfy the type checker) cost-free. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3204 >--------------------------------------------------------------- c662d41e2006f5a45619d40d2369b24642348f1a compiler/coreSyn/CoreUnfold.hs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/compiler/coreSyn/CoreUnfold.hs b/compiler/coreSyn/CoreUnfold.hs index bae6330..5844eb9 100644 --- a/compiler/coreSyn/CoreUnfold.hs +++ b/compiler/coreSyn/CoreUnfold.hs @@ -534,6 +534,11 @@ sizeExpr dflags bOMB_OUT_SIZE top_args expr pairs size_up (Case e _ _ alts) + | null alts + = size_up e -- case e of {} never returns, so take size of scrutinee + + size_up (Case e _ _ alts) + -- Now alts is non-empty | Just v <- is_top_arg e -- We are scrutinising an argument variable = let alt_sizes = map size_up_alt alts @@ -558,8 +563,8 @@ sizeExpr dflags bOMB_OUT_SIZE top_args expr alts_size tot_size _ = tot_size in - alts_size (foldr addAltSize sizeZero alt_sizes) - (foldr maxSize sizeZero alt_sizes) + alts_size (foldr1 addAltSize alt_sizes) -- alts is non-empty + (foldr1 maxSize alt_sizes) -- Good to inline if an arg is scrutinised, because -- that may eliminate allocation in the caller -- And it eliminates the case itself @@ -763,6 +768,7 @@ funSize dflags top_args fun n_val_args voids res_discount | idArity fun > n_val_args = ufFunAppDiscount dflags | otherwise = 0 -- If the function is partially applied, show a result discount +-- XXX maybe behave like ConSize for eval'd varaible conSize :: DataCon -> Int -> ExprSize conSize dc n_val_args @@ -774,6 +780,8 @@ conSize dc n_val_args -- See Note [Constructor size and result discount] | otherwise = SizeIs 10 emptyBag (10 * (1 + n_val_args)) +-- XXX still looks to large to me + {- Note [Constructor size and result discount] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From git at git.haskell.org Tue Feb 28 15:59:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 28 Feb 2017 15:59:29 +0000 (UTC) Subject: [commit: ghc] master: Add flag allowing convenient disabling of terminfo support (c686af5) Message-ID: <20170228155929.464783A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c686af5818686efb55cfd81ac104027c959d6277/ghc >--------------------------------------------------------------- commit c686af5818686efb55cfd81ac104027c959d6277 Author: Ben Gamari Date: Tue Feb 28 09:27:04 2017 -0500 Add flag allowing convenient disabling of terminfo support This is a common thing that users who cross-compile must fight against. It turns out that it's pretty straightforward to make is convenient. Test Plan: Cross compile without a target `ncurses` available Reviewers: danharaj, hvr, erikd, austin, rwbarton Subscribers: rwbarton, thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3177 >--------------------------------------------------------------- c686af5818686efb55cfd81ac104027c959d6277 compiler/ghc.mk | 4 ++++ ghc.mk | 4 +--- mk/config.mk.in | 9 +++++++++ mk/flavours/bench-cross.mk | 1 + mk/flavours/perf-cross.mk | 1 + mk/flavours/quick-cross.mk | 1 + utils/ghc-pkg/Main.hs | 12 ++++++++++-- utils/ghc-pkg/ghc-pkg.cabal | 11 +++++++++-- utils/ghc-pkg/ghc.mk | 4 ++++ 9 files changed, 40 insertions(+), 7 deletions(-) diff --git a/compiler/ghc.mk b/compiler/ghc.mk index ce41eca..36603a4 100644 --- a/compiler/ghc.mk +++ b/compiler/ghc.mk @@ -361,6 +361,10 @@ compiler_CONFIGURE_OPTS += --ghc-option=-DNOSMP compiler_CONFIGURE_OPTS += --ghc-option=-optc-DNOSMP endif +ifeq "$(WITH_TERMINFO)" "NO" +compiler_stage2_CONFIGURE_OPTS += --flags=-terminfo +endif + # Careful optimisation of the parser: we don't want to throw everything # at it, because that takes too long and doesn't buy much, but we do want # to inline certain key external functions, so we instruct GHC not to diff --git a/ghc.mk b/ghc.mk index b2888c0..578e031 100644 --- a/ghc.mk +++ b/ghc.mk @@ -431,9 +431,7 @@ else # CLEANING # compiler already has installed (or up-to-date enough). PACKAGES_STAGE0 = binary Cabal/Cabal hpc ghc-boot-th ghc-boot hoopl transformers template-haskell ghci -ifeq "$(Windows_Host)" "NO" PACKAGES_STAGE0 += terminfo -endif PACKAGES_STAGE1 += ghc-prim PACKAGES_STAGE1 += $(INTEGER_LIBRARY) @@ -469,7 +467,7 @@ ifeq "$(HADDOCK_DOCS)" "YES" PACKAGES_STAGE1 += xhtml endif -ifeq "$(Windows_Target)" "NO" +ifeq "$(WITH_TERMINFO)" "YES" PACKAGES_STAGE1 += terminfo endif PACKAGES_STAGE1 += haskeline diff --git a/mk/config.mk.in b/mk/config.mk.in index b90aca3..0fad90c 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -100,6 +100,15 @@ GhcDynamic=NO # GhcProfiled=YES means compile a profiled stage-2 compiler GhcProfiled=NO +# WITH_TERMINFO can be used to disable terminfo support throughout the compiler +# and its tools. This is handy in the case of cross-compilation, where we may +# not have an ncurses build for the target. +ifeq "$(Windows_Target)" "NO" +WITH_TERMINFO=YES +else +WITH_TERMINFO=NO +endif + ifeq "$(findstring $(TargetOS_CPP),linux freebsd dragonfly openbsd netbsd solaris2 kfreebsdgnu haiku linux-android)" "" TargetElf = NO else diff --git a/mk/flavours/bench-cross.mk b/mk/flavours/bench-cross.mk index 15b359e..90344fc 100644 --- a/mk/flavours/bench-cross.mk +++ b/mk/flavours/bench-cross.mk @@ -8,6 +8,7 @@ HADDOCK_DOCS = NO BUILD_SPHINX_HTML = NO BUILD_SPHINX_PDF = NO BUILD_MAN = NO +WITH_TERMINFO = NO INTEGER_LIBRARY = integer-simple Stage1Only = YES diff --git a/mk/flavours/perf-cross.mk b/mk/flavours/perf-cross.mk index 669b51a..f202642 100644 --- a/mk/flavours/perf-cross.mk +++ b/mk/flavours/perf-cross.mk @@ -8,6 +8,7 @@ HADDOCK_DOCS = NO BUILD_SPHINX_HTML = NO BUILD_SPHINX_PDF = NO BUILD_MAN = NO +WITH_TERMINFO = NO INTEGER_LIBRARY = integer-simple Stage1Only = YES diff --git a/mk/flavours/quick-cross.mk b/mk/flavours/quick-cross.mk index 92347ca..b886a8d 100644 --- a/mk/flavours/quick-cross.mk +++ b/mk/flavours/quick-cross.mk @@ -8,6 +8,7 @@ HADDOCK_DOCS = NO BUILD_SPHINX_HTML = NO BUILD_SPHINX_PDF = NO BUILD_MAN = NO +WITH_TERMINFO = NO INTEGER_LIBRARY = integer-simple Stage1Only = YES diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs index 44960ca..dd49180 100644 --- a/utils/ghc-pkg/Main.hs +++ b/utils/ghc-pkg/Main.hs @@ -9,6 +9,14 @@ {-# LANGUAGE TupleSections #-} {-# LANGUAGE ScopedTypeVariables #-} {-# OPTIONS_GHC -fno-warn-orphans #-} + +-- We never want to link against terminfo while bootstrapping. +#ifdef BOOTSTRAPPING +#ifdef WITH_TERMINFO +#undef WITH_TERMINFO +#endif +#endif + ----------------------------------------------------------------------------- -- -- (c) The University of Glasgow 2004-2009. @@ -80,7 +88,7 @@ import System.Posix hiding (fdToHandle) import qualified System.Info(os) #endif -#if !defined(mingw32_HOST_OS) && !defined(BOOTSTRAPPING) +#ifdef WITH_TERMINFO import System.Console.Terminfo as Terminfo #endif @@ -1429,7 +1437,7 @@ listPackages verbosity my_flags mPackageName mModuleName = do if simple_output then show_simple stack else do -#if defined(mingw32_HOST_OS) || defined(BOOTSTRAPPING) +#ifndef WITH_TERMINFO mapM_ show_normal stack #else let diff --git a/utils/ghc-pkg/ghc-pkg.cabal b/utils/ghc-pkg/ghc-pkg.cabal index 3511e36..8776cb9 100644 --- a/utils/ghc-pkg/ghc-pkg.cabal +++ b/utils/ghc-pkg/ghc-pkg.cabal @@ -15,6 +15,11 @@ Category: Development build-type: Simple cabal-version: >=1.10 +Flag terminfo + Description: Build GHC with terminfo support on non-Windows platforms. + Default: True + Manual: False + Executable ghc-pkg Default-Language: Haskell2010 Main-Is: Main.hs @@ -30,8 +35,10 @@ Executable ghc-pkg binary, ghc-boot, bytestring + if !os(windows) && flag(terminfo) + Build-Depends: terminfo + Cpp-Options: -DWITH_TERMINFO if !os(windows) - Build-Depends: unix, - terminfo + Build-Depends: unix if os(windows) c-sources: CRT_noglob.c diff --git a/utils/ghc-pkg/ghc.mk b/utils/ghc-pkg/ghc.mk index f7d97de..002c812 100644 --- a/utils/ghc-pkg/ghc.mk +++ b/utils/ghc-pkg/ghc.mk @@ -57,6 +57,10 @@ utils/ghc-pkg_dist_INSTALL = YES utils/ghc-pkg_dist_INSTALL_SHELL_WRAPPER_NAME = ghc-pkg-$(ProjectVersion) endif +ifeq "$(WITH_TERMINFO)" "NO" +utils/ghc-pkg_dist-install_CONFIGURE_OPTS += -f-terminfo +endif + $(eval $(call build-prog,utils/ghc-pkg,dist,0)) $(ghc-pkg_INPLACE) : | $(INPLACE_PACKAGE_CONF)/. From git at git.haskell.org Tue Feb 28 15:59:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 28 Feb 2017 15:59:31 +0000 (UTC) Subject: [commit: ghc] master: rts: Allow profile output path to be specified on RTS command line (db2a667) Message-ID: <20170228155932.007643A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/db2a667655506c43dd3c8260d29031bde55f1bee/ghc >--------------------------------------------------------------- commit db2a667655506c43dd3c8260d29031bde55f1bee Author: Ben Gamari Date: Tue Feb 28 09:31:06 2017 -0500 rts: Allow profile output path to be specified on RTS command line This introduces a RTS option, -po, which allows the user to override the stem used to form the output file names of the heap profile and cost center summary. It's a bit unclear to me whether this is really the interface we want. Alternatively we could just allow the user to specify the `.hp` and `.prof` file names separately. This would arguably be a bit more straightforward and would allow the user to name JSON output with an appropriate `.json` suffix if they so desired. However, this would come at the cost of taking more of the option space, which is a somewhat precious commodity. Test Plan: Validate, try using `-po` RTS option Reviewers: simonmar, austin, erikd Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3182 >--------------------------------------------------------------- db2a667655506c43dd3c8260d29031bde55f1bee docs/users_guide/profiling.rst | 13 ++++++++++++- includes/rts/Flags.h | 1 + rts/Profiling.c | 39 +++++++++++++++++++++++---------------- rts/RtsFlags.c | 14 ++++++++------ 4 files changed, 44 insertions(+), 23 deletions(-) diff --git a/docs/users_guide/profiling.rst b/docs/users_guide/profiling.rst index 764ee92..832464e 100644 --- a/docs/users_guide/profiling.rst +++ b/docs/users_guide/profiling.rst @@ -402,7 +402,8 @@ enclosed between ``+RTS ... -RTS`` as usual): single: time profile The :rts-flag:`-p` option produces a standard *time profile* report. It is - written into the file :file:`program.prof`. + written into the file :file:`.prof`; the stem is taken to be the program + name by default, but can be overridden by the :rts-flag:`-po` flag. The :rts-flag:`-P` option produces a more detailed report containing the actual time and allocation data as well. (Not used much.) @@ -415,6 +416,16 @@ enclosed between ``+RTS ... -RTS`` as usual): The :rts-flag:`-pj` option produces a time/allocation profile report in JSON format written into the file :file:`.prof`. +.. rts-flag:: -po ⟨stem⟩ + + The :rts-flag:`-po` option overrides the stem used to form the output file + paths for the cost-center profiler (see :rts-flag:`-p` and :rts-flag:`-pj` + flags above) and heap profiler (see :rts-flag:`-h`). + + For instance, running a program with ``+RTS -h -p -pohello-world`` would + produce a heap profile named :file:`hello-world.hp` and a cost-center + profile named :file:`hello-world.prof`. + .. rts-flag:: -V Sets the interval that the RTS clock ticks at, which is also the diff --git a/includes/rts/Flags.h b/includes/rts/Flags.h index ebcf973..c8f71d1 100644 --- a/includes/rts/Flags.h +++ b/includes/rts/Flags.h @@ -119,6 +119,7 @@ typedef struct _COST_CENTRE_FLAGS { int profilerTicks; /* derived */ int msecsPerTick; /* derived */ + char const *oututFileNameStem; } COST_CENTRE_FLAGS; /* See Note [Synchronization of flags and base APIs] */ diff --git a/rts/Profiling.c b/rts/Profiling.c index 0dc1e26..c0d60a5 100644 --- a/rts/Profiling.c +++ b/rts/Profiling.c @@ -228,32 +228,39 @@ CostCentre *mkCostCentre (char *label, char *module, char *srcloc) static void initProfilingLogFile(void) { - char *prog; + // Figure out output file name stem. + char const *stem; + if (RtsFlags.CcFlags.outputFileNameStem) { + stem = RtsFlags.CcFlags.outputFileNameStem; + } else { + char *prog; - prog = arenaAlloc(prof_arena, strlen(prog_name) + 1); - strcpy(prog, prog_name); + prog = arenaAlloc(prof_arena, strlen(prog_name) + 1); + strcpy(prog, prog_name); #ifdef mingw32_HOST_OS - // on Windows, drop the .exe suffix if there is one - { - char *suff; - suff = strrchr(prog,'.'); - if (suff != NULL && !strcmp(suff,".exe")) { - *suff = '\0'; + // on Windows, drop the .exe suffix if there is one + { + char *suff; + suff = strrchr(prog,'.'); + if (suff != NULL && !strcmp(suff,".exe")) { + *suff = '\0'; + } } - } #endif + stem = prog; + } if (RtsFlags.CcFlags.doCostCentres == 0 && !doingRetainerProfiling()) { - /* No need for the .prof file */ + /* No need for the .prof file */ prof_filename = NULL; prof_file = NULL; } else { /* Initialise the log file name */ - prof_filename = arenaAlloc(prof_arena, strlen(prog) + 6); - sprintf(prof_filename, "%s.prof", prog); + prof_filename = arenaAlloc(prof_arena, strlen(stem) + 6); + sprintf(prof_filename, "%s.prof", stem); /* open the log file */ if ((prof_file = fopen(prof_filename, "w")) == NULL) { @@ -269,13 +276,13 @@ initProfilingLogFile(void) if (RtsFlags.ProfFlags.doHeapProfile) { /* Initialise the log file name */ - hp_filename = arenaAlloc(prof_arena, strlen(prog) + 6); - sprintf(hp_filename, "%s.hp", prog); + hp_filename = arenaAlloc(prof_arena, strlen(stem) + 6); + sprintf(hp_filename, "%s.hp", stem); /* open the log file */ if ((hp_file = fopen(hp_filename, "w")) == NULL) { debugBelch("Can't open profiling report file %s\n", - hp_filename); + hp_filename); RtsFlags.ProfFlags.doHeapProfile = 0; } } diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c index 9cff810..8d71354 100644 --- a/rts/RtsFlags.c +++ b/rts/RtsFlags.c @@ -296,14 +296,16 @@ usage_text[] = { " -S[] Detailed GC statistics (if omitted, uses stderr)", "", "", -" -Z Don't squeeze out update frames on stack overflow", -" -B Sound the bell at the start of each garbage collection", +" -Z Don't squeeze out update frames on stack overflow", +" -B Sound the bell at the start of each garbage collection", #if defined(PROFILING) "", -" -p Time/allocation profile (output file .prof)", -" -P More detailed Time/Allocation profile", -" -Pa Give information about *all* cost centres", -" -pj Output cost-center profile in JSON format", +" -p Time/allocation profile in tree format ", +" (output file .prof)", +" -po Override profiling output file name prefix (program name by default)", +" -P More detailed Time/Allocation profile in tree format", +" -Pa Give information about *all* cost centres in tree format", +" -pj Output cost-center profile in JSON format", "", " -h Heap residency profile (hp2ps) (output file .hp)", " break-down: c = cost centre stack (default)", From git at git.haskell.org Tue Feb 28 16:06:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 28 Feb 2017 16:06:15 +0000 (UTC) Subject: [commit: ghc] master: Again disable stage0 terminfo on Windows (29b5723) Message-ID: <20170228160615.183E03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/29b57238e53ca7feae9257ed6fa1567b57aabe6a/ghc >--------------------------------------------------------------- commit 29b57238e53ca7feae9257ed6fa1567b57aabe6a Author: Ben Gamari Date: Tue Feb 28 11:04:40 2017 -0500 Again disable stage0 terminfo on Windows This accidentally regressed in D3177. >--------------------------------------------------------------- 29b57238e53ca7feae9257ed6fa1567b57aabe6a ghc.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ghc.mk b/ghc.mk index 578e031..caa6c38 100644 --- a/ghc.mk +++ b/ghc.mk @@ -431,7 +431,9 @@ else # CLEANING # compiler already has installed (or up-to-date enough). PACKAGES_STAGE0 = binary Cabal/Cabal hpc ghc-boot-th ghc-boot hoopl transformers template-haskell ghci +ifeq "$(Windows_Host)" "NO" PACKAGES_STAGE0 += terminfo +endif PACKAGES_STAGE1 += ghc-prim PACKAGES_STAGE1 += $(INTEGER_LIBRARY) From git at git.haskell.org Tue Feb 28 17:11:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 28 Feb 2017 17:11:47 +0000 (UTC) Subject: [commit: ghc] master: Make Specialise work with casts (1990bb0) Message-ID: <20170228171147.9385F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1990bb0df51250519b555ec271c693d289dd9802/ghc >--------------------------------------------------------------- commit 1990bb0df51250519b555ec271c693d289dd9802 Author: Simon Peyton Jones Date: Tue Feb 28 12:11:33 2017 -0500 Make Specialise work with casts With my upcoming early-inlining patch it turned out that Specialise was getting stuck on casts. This patch fixes it; see Note [Account for casts in binding] in Specialise. Reviewers: austin, goldfire, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3192 >--------------------------------------------------------------- 1990bb0df51250519b555ec271c693d289dd9802 compiler/coreSyn/CoreSubst.hs | 62 ++++++++++++++++++++++++++++++++++++--- compiler/specialise/Specialise.hs | 35 ++++++++++++++++------ compiler/types/Coercion.hs | 46 +++++++++++++++++++++++++---- compiler/types/Unify.hs | 2 +- 4 files changed, 126 insertions(+), 19 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 1990bb0df51250519b555ec271c693d289dd9802 From git at git.haskell.org Tue Feb 28 19:07:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 28 Feb 2017 19:07:32 +0000 (UTC) Subject: [commit: ghc] master: Inline data constructor wrappers in phase 2 only (fc6c222) Message-ID: <20170228190732.A36F93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fc6c222b90e68fed74a6bee6f087f47bf31f21c6/ghc >--------------------------------------------------------------- commit fc6c222b90e68fed74a6bee6f087f47bf31f21c6 Author: Simon Peyton Jones Date: Tue Feb 28 14:04:40 2017 -0500 Inline data constructor wrappers in phase 2 only This patch prepares for my upcoming early-inlining patch. It arranges that data constructor wrappers are not inlined until Phase 2 (the first of the "normal" phases.) That gives rules a chance to fire in the InitialPhase (aka "gentle"). This has been a bit of a problem for a while, so it's nice to have a fix. It should make no difference immediately, becuase currently nothing is inlined in the InitialPhase anyway. Reviewers: austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3193 >--------------------------------------------------------------- fc6c222b90e68fed74a6bee6f087f47bf31f21c6 compiler/basicTypes/MkId.hs | 22 +++- .../tests/deSugar/should_compile/T2431.stderr | 46 ++++---- .../tests/simplCore/should_compile/T7360.stderr | 120 ++++++++++----------- 3 files changed, 103 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 fc6c222b90e68fed74a6bee6f087f47bf31f21c6 From git at git.haskell.org Tue Feb 28 20:50:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 28 Feb 2017 20:50:40 +0000 (UTC) Subject: [commit: ghc] master: Add COMPLETE pragmas for TypeRep and ErrorCall pattern synonyms (122c677) Message-ID: <20170228205040.9AAAD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/122c67763bd73144bc6f3a6d86f275e6d1e297f9/ghc >--------------------------------------------------------------- commit 122c67763bd73144bc6f3a6d86f275e6d1e297f9 Author: Ryan Scott Date: Tue Feb 28 11:11:48 2017 -0500 Add COMPLETE pragmas for TypeRep and ErrorCall pattern synonyms When programming with the pattern synonyms for `TypeRep`, I noticed that I was receiving spurious non-exhaustive pattern-match warnings. This can be easily fixed by adding `COMPLETE` pragmas for them. Moreover, there's another pattern synonym in `base`: `ErrorCall`. In fact, in the original ticket for `COMPLETE` pragmas (#8779), someone requested that `ErrorCall` be given a `COMPLETE` pragma as well (https://ghc.haskell.org/trac/ghc/ticket/8779#comment:21). I decided to do that as well while I was in town. Reviewers: bgamari, mpickering, austin, hvr Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3231 >--------------------------------------------------------------- 122c67763bd73144bc6f3a6d86f275e6d1e297f9 libraries/base/Data/Typeable/Internal.hs | 3 +++ libraries/base/GHC/Exception.hs | 2 ++ libraries/base/changelog.md | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/libraries/base/Data/Typeable/Internal.hs b/libraries/base/Data/Typeable/Internal.hs index aa8345b..85a356c 100644 --- a/libraries/base/Data/Typeable/Internal.hs +++ b/libraries/base/Data/Typeable/Internal.hs @@ -290,6 +290,9 @@ pattern Con con <- TrTyCon _ con _ pattern Con' :: forall k (a :: k). TyCon -> [SomeTypeRep] -> TypeRep a pattern Con' con ks <- TrTyCon _ con ks +{-# COMPLETE Fun, App, Con #-} +{-# COMPLETE Fun, App, Con' #-} + ----------------- Observation --------------------- -- | Observe the type constructor of a quantified type representation. diff --git a/libraries/base/GHC/Exception.hs b/libraries/base/GHC/Exception.hs index be2ee3f..6a77e6e 100644 --- a/libraries/base/GHC/Exception.hs +++ b/libraries/base/GHC/Exception.hs @@ -176,6 +176,8 @@ pattern ErrorCall :: String -> ErrorCall pattern ErrorCall err <- ErrorCallWithLocation err _ where ErrorCall err = ErrorCallWithLocation err "" +{-# COMPLETE ErrorCall #-} + -- | @since 4.0.0.0 instance Exception ErrorCall diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index b8c246a..3bb60fe 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -69,6 +69,10 @@ replaced by `CostCentresJSON` due to the new JSON export format supported by the cost centre profiler. + * The `ErrorCall` pattern synonym has been given a `COMPLETE` pragma so that + functions which solely match again `ErrorCall` do not produce + non-exhaustive pattern-match warnings (#8779) + ## 4.9.0.0 *May 2016* * Bundled with GHC 8.0 From git at git.haskell.org Tue Feb 28 20:50:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 28 Feb 2017 20:50:43 +0000 (UTC) Subject: [commit: ghc] master: Improve documentation for CreateBCOs Message. (aa2143e) Message-ID: <20170228205043.523713A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/aa2143e0541908c6e168ae326e89216c49593d29/ghc >--------------------------------------------------------------- commit aa2143e0541908c6e168ae326e89216c49593d29 Author: Moritz Angermann Date: Tue Feb 28 11:08:55 2017 -0500 Improve documentation for CreateBCOs Message. After falling over the CreateBCOs message, and expecting it to contain ByteStrings encoding `ResolvedBCO`s instead of `[ResolvedBCO]`s, when deubbing issues with iserv, I'd like to extend the documentation here a bit, so the next one won't fall over it. Reviewers: simonmar, austin, rwbarton, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3234 >--------------------------------------------------------------- aa2143e0541908c6e168ae326e89216c49593d29 libraries/ghci/GHCi/Message.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libraries/ghci/GHCi/Message.hs b/libraries/ghci/GHCi/Message.hs index 80a495f..37db062 100644 --- a/libraries/ghci/GHCi/Message.hs +++ b/libraries/ghci/GHCi/Message.hs @@ -85,6 +85,9 @@ data Message a where -- Interpreter ------------------------------------------- -- | Create a set of BCO objects, and return HValueRefs to them + -- Note: Each ByteString contains a Binary-encoded [ResolvedBCO], not + -- a ResolvedBCO. The list is to allow us to serialise the ResolvedBCOs + -- in parallel. See @createBCOs@ in compiler/ghci/GHCi.hsc. CreateBCOs :: [LB.ByteString] -> Message [HValueRef] -- | Release 'HValueRef's From git at git.haskell.org Tue Feb 28 20:50:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 28 Feb 2017 20:50:49 +0000 (UTC) Subject: [commit: ghc] master: Drop copy step from the rts/ghc.mk (3e33d33) Message-ID: <20170228205049.04D943A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3e33d334f3a328f049eb2fdb10b04c36e8d6cbef/ghc >--------------------------------------------------------------- commit 3e33d334f3a328f049eb2fdb10b04c36e8d6cbef Author: Moritz Angermann Date: Tue Feb 28 11:09:22 2017 -0500 Drop copy step from the rts/ghc.mk Recently I've used a different build system for building the rts (Xcode). And in doing so, I looked through the rts/ghc.mk to figure out how to build the rts. In general it's quite straight forward to just compile all the c files with the proper flags. However there is one rather awkward copy step that copies some files for special handling for the rts way. I'm wondering if the proposed solution in this diff is better or worse than the current situation? The idea is to keep the files, but use #includes to produce identical files with just an additional define. It does however produce empty objects for non threaded ways. Reviewers: ezyang, bgamari, austin, erikd, simonmar, rwbarton Reviewed By: bgamari, simonmar, rwbarton Subscribers: rwbarton, thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3237 >--------------------------------------------------------------- 3e33d334f3a328f049eb2fdb10b04c36e8d6cbef rts/ghc.mk | 13 +------------ rts/sm/Evac_thr.c | 4 ++++ rts/sm/Scav_thr.c | 4 ++++ 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/rts/ghc.mk b/rts/ghc.mk index 89c5a0b..b756d94 100644 --- a/rts/ghc.mk +++ b/rts/ghc.mk @@ -68,10 +68,6 @@ rts_AUTO_APPLY_CMM = rts/dist/build/AutoApply.cmm $(rts_AUTO_APPLY_CMM): $$(genapply_INPLACE) "$(genapply_INPLACE)" >$@ -rts/dist/build/sm/Evac_thr.c : rts/sm/Evac.c | $$(dir $$@)/. - cp $< $@ -rts/dist/build/sm/Scav_thr.c : rts/sm/Scav.c | $$(dir $$@)/. - cp $< $@ rts_H_FILES := $(wildcard rts/*.h rts/*/*.h) @@ -157,9 +153,6 @@ endif rts_dist_$1_CC_OPTS += -DDYNAMIC endif -ifneq "$$(findstring thr, $1)" "" -rts_$1_EXTRA_C_SRCS = rts/dist/build/sm/Evac_thr.c rts/dist/build/sm/Scav_thr.c -endif $(call distdir-way-opts,rts,dist,$1,1) # 1 because the rts is built with stage1 $(call c-suffix-rules,rts,dist,$1,YES) @@ -452,12 +445,8 @@ endif # -O3 helps unroll some loops (especially in copy() with a constant argument). rts/sm/Evac_CC_OPTS += -funroll-loops -rts/dist/build/sm/Evac_thr_HC_OPTS += -optc-funroll-loops +rts/sm/Evac_thr_HC_OPTS += -optc-funroll-loops -# These files are just copies of sm/Evac.c and sm/Scav.c respectively, -# but compiled with -DPARALLEL_GC. -rts/dist/build/sm/Evac_thr_CC_OPTS += -DPARALLEL_GC -Irts/sm -rts/dist/build/sm/Scav_thr_CC_OPTS += -DPARALLEL_GC -Irts/sm #----------------------------------------------------------------------------- # Use system provided libffi diff --git a/rts/sm/Evac_thr.c b/rts/sm/Evac_thr.c new file mode 100644 index 0000000..4fff4ec --- /dev/null +++ b/rts/sm/Evac_thr.c @@ -0,0 +1,4 @@ +#ifdef THREADED_RTS +#define PARALLEL_GC +#include "Evac.c" +#endif diff --git a/rts/sm/Scav_thr.c b/rts/sm/Scav_thr.c new file mode 100644 index 0000000..372e779 --- /dev/null +++ b/rts/sm/Scav_thr.c @@ -0,0 +1,4 @@ +#ifdef THREADED_RTS +#define PARALLEL_GC +#include "Scav.c" +#endif From git at git.haskell.org Tue Feb 28 20:50:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 28 Feb 2017 20:50:46 +0000 (UTC) Subject: [commit: ghc] master: config.mk.in: Disable terminfo support on iOS (65c41cc) Message-ID: <20170228205046.0278A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/65c41cc58d341672f6e55b40488729c8f7b6fbf2/ghc >--------------------------------------------------------------- commit 65c41cc58d341672f6e55b40488729c8f7b6fbf2 Author: Ben Gamari Date: Tue Feb 28 11:01:01 2017 -0500 config.mk.in: Disable terminfo support on iOS Test Plan: Validate Reviewers: angerman, austin, rwbarton Subscribers: thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3242 >--------------------------------------------------------------- 65c41cc58d341672f6e55b40488729c8f7b6fbf2 mk/config.mk.in | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mk/config.mk.in b/mk/config.mk.in index 0fad90c..729abfa 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -103,10 +103,13 @@ GhcProfiled=NO # WITH_TERMINFO can be used to disable terminfo support throughout the compiler # and its tools. This is handy in the case of cross-compilation, where we may # not have an ncurses build for the target. -ifeq "$(Windows_Target)" "NO" -WITH_TERMINFO=YES -else +ifeq "$(TargetOS_CPP)" "ios" +# iOS has no terminfo support +WITH_TERMINFO=NO +else ifeq "$(Windows_Target)" "YES" WITH_TERMINFO=NO +else +WITH_TERMINFO=YES endif ifeq "$(findstring $(TargetOS_CPP),linux freebsd dragonfly openbsd netbsd solaris2 kfreebsdgnu haiku linux-android)" "" From git at git.haskell.org Tue Feb 28 20:50:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 28 Feb 2017 20:50:51 +0000 (UTC) Subject: [commit: ghc] master: iOS: shared objects have .dylib extension. (23aca13) Message-ID: <20170228205051.B199F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/23aca13255729a4649a800bbc36dc61e0816a05e/ghc >--------------------------------------------------------------- commit 23aca13255729a4649a800bbc36dc61e0816a05e Author: Moritz Angermann Date: Tue Feb 28 11:07:45 2017 -0500 iOS: shared objects have .dylib extension. Reviewers: austin, rwbarton, bgamari Reviewed By: rwbarton Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3241 >--------------------------------------------------------------- 23aca13255729a4649a800bbc36dc61e0816a05e compiler/main/HscTypes.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/main/HscTypes.hs b/compiler/main/HscTypes.hs index d729dcc..6473512 100644 --- a/compiler/main/HscTypes.hs +++ b/compiler/main/HscTypes.hs @@ -2548,6 +2548,7 @@ soExt :: Platform -> FilePath soExt platform = case platformOS platform of OSDarwin -> "dylib" + OSiOS -> "dylib" OSMinGW32 -> "dll" _ -> "so" From git at git.haskell.org Tue Feb 28 20:50:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 28 Feb 2017 20:50:54 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Bump down T5837 and T10370 allocations (defef52) Message-ID: <20170228205054.6E69D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/defef5276bf0997237ea5ecc448f686bb5e85940/ghc >--------------------------------------------------------------- commit defef5276bf0997237ea5ecc448f686bb5e85940 Author: Ben Gamari Date: Tue Feb 28 14:32:52 2017 -0500 testsuite: Bump down T5837 and T10370 allocations >--------------------------------------------------------------- defef5276bf0997237ea5ecc448f686bb5e85940 testsuite/tests/perf/compiler/all.T | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index 757bd36..7a8e04f 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -617,7 +617,7 @@ test('T5837', (platform('x86_64-unknown-mingw32'), 59161648, 7), # 2017-02-19 59161648 (x64/Windows) - Unknown - (wordsize(64), 58648600, 7)]) + (wordsize(64), 54151864, 7)]) # sample: 3926235424 (amd64/Linux, 15/2/2012) # 2012-10-02 81879216 # 2012-09-20 87254264 amd64/Linux @@ -651,6 +651,7 @@ test('T5837', # to be environmentally-dependent. # Also bumped acceptance threshold to 7%. # 2017-02-20 58648600 amd64/Linux Type-indexed Typeable + # 2017-02-28 54151864 amd64/Linux Likely drift due to recent simplifier improvements ], compile, ['-freduction-depth=50']) @@ -885,6 +886,7 @@ test('T10370', # 2016-10-20 38221184 Allow top-level string literals. # See the comment 16 on #8472. # 2017-02-17 51126304 Type-indexed Typeawble + # 2017-02-27 43455848 Likely drift from recent simplifier improvements (wordsize(32), 11371496, 15), # 2015-10-22 11371496 ]), From git at git.haskell.org Tue Feb 28 20:50:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 28 Feb 2017 20:50:57 +0000 (UTC) Subject: [commit: ghc] master: Try submodule bumps again (5fdb2b1) Message-ID: <20170228205057.2E4313A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5fdb2b14d221c6c2a166f4dee820e4fce619fed1/ghc >--------------------------------------------------------------- commit 5fdb2b14d221c6c2a166f4dee820e4fce619fed1 Author: Ben Gamari Date: Tue Feb 28 11:20:13 2017 -0500 Try submodule bumps again Bumps containers, time, and unix submodules. This reverts commit c347a121b07d22fb91172337407986b6541e319d. >--------------------------------------------------------------- 5fdb2b14d221c6c2a166f4dee820e4fce619fed1 compiler/ghc.cabal.in | 2 +- ghc/ghc-bin.cabal.in | 2 +- libraries/containers | 2 +- libraries/time | 2 +- libraries/unix | 2 +- testsuite/tests/backpack/should_run/bkprun05.stderr | 2 +- testsuite/tests/cabal/cabal08/all.T | 3 ++- testsuite/tests/driver/T10970.stdout | 2 +- testsuite/tests/ghci.debugger/scripts/print026.stdout | 11 +++++++---- testsuite/tests/package/package01e.stderr | 4 ++-- testsuite/tests/partial-sigs/should_fail/T10999.stderr | 3 +-- testsuite/tests/th/T10796b.stderr | 2 +- 12 files changed, 20 insertions(+), 17 deletions(-) diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in index f3d6711..b8b7106 100644 --- a/compiler/ghc.cabal.in +++ b/compiler/ghc.cabal.in @@ -55,7 +55,7 @@ Library process >= 1 && < 1.5, bytestring >= 0.9 && < 0.11, binary == 0.8.*, - time >= 1.4 && < 1.8, + time >= 1.4 && < 1.9, containers >= 0.5 && < 0.6, array >= 0.1 && < 0.6, filepath >= 1 && < 1.5, diff --git a/ghc/ghc-bin.cabal.in b/ghc/ghc-bin.cabal.in index 9c9ca0e..0f50453 100644 --- a/ghc/ghc-bin.cabal.in +++ b/ghc/ghc-bin.cabal.in @@ -52,7 +52,7 @@ Executable ghc deepseq == 1.4.*, ghci == @ProjectVersionMunged@, haskeline == 0.7.*, - time == 1.7.*, + time == 1.8.*, transformers == 0.5.* CPP-Options: -DGHCI GHC-Options: -fno-warn-name-shadowing diff --git a/libraries/containers b/libraries/containers index aa982fb..9e5d789 160000 --- a/libraries/containers +++ b/libraries/containers @@ -1 +1 @@ -Subproject commit aa982fb83f2561d3b27b89b46d36ffca21e072cc +Subproject commit 9e5d789c77b7252fb3fbf7a26f649b96ba20649c diff --git a/libraries/time b/libraries/time index b6098be..4eb06c0 160000 --- a/libraries/time +++ b/libraries/time @@ -1 +1 @@ -Subproject commit b6098be8a4facfa854c633f2a3a82ab8e72962ef +Subproject commit 4eb06c0e5381a5b5ad2186ac6ecff434cd711376 diff --git a/libraries/unix b/libraries/unix index d0b0e8c..821cb07 160000 --- a/libraries/unix +++ b/libraries/unix @@ -1 +1 @@ -Subproject commit d0b0e8cf5a7fa5b9dc500d2f623258200818cb16 +Subproject commit 821cb07ecf235625b4bb06626d30e4b15f28df30 diff --git a/testsuite/tests/backpack/should_run/bkprun05.stderr b/testsuite/tests/backpack/should_run/bkprun05.stderr index d9042b07..854de8b 100644 --- a/testsuite/tests/backpack/should_run/bkprun05.stderr +++ b/testsuite/tests/backpack/should_run/bkprun05.stderr @@ -1,4 +1,4 @@ bkprun05: Prelude.undefined CallStack (from HasCallStack): error, called at libraries/base/GHC/Err.hs:79:14 in base:GHC.Err - undefined, called at bkprun05.bkp:138:30 in app+app-9GMmly0OuEYHDXryaGD7sX:App + undefined, called at bkprun05.bkp:138:30 in app+app-89WS9ScvjQd9lPG2oW0wWM:App diff --git a/testsuite/tests/cabal/cabal08/all.T b/testsuite/tests/cabal/cabal08/all.T index 95864fd..d8bc444 100644 --- a/testsuite/tests/cabal/cabal08/all.T +++ b/testsuite/tests/cabal/cabal08/all.T @@ -4,6 +4,7 @@ else: cleanup = 'CLEANUP=0' test('cabal08', - extra_files(['Main.hs', 'Setup.hs', 'p1/', 'p2/']), + [extra_files(['Main.hs', 'Setup.hs', 'p1/', 'p2/']), + expect_broken(13313)], run_command, ['$MAKE -s --no-print-directory cabal08 ' + cleanup]) diff --git a/testsuite/tests/driver/T10970.stdout b/testsuite/tests/driver/T10970.stdout index fd35ddd..9636217 100644 --- a/testsuite/tests/driver/T10970.stdout +++ b/testsuite/tests/driver/T10970.stdout @@ -1,2 +1,2 @@ -0.5.7.1 +0.5.10.2 OK diff --git a/testsuite/tests/ghci.debugger/scripts/print026.stdout b/testsuite/tests/ghci.debugger/scripts/print026.stdout index decc3df..9ed900f 100644 --- a/testsuite/tests/ghci.debugger/scripts/print026.stdout +++ b/testsuite/tests/ghci.debugger/scripts/print026.stdout @@ -1,6 +1,9 @@ fromList "abc" -l = Data.Sequence.Seq (Data.Sequence.Deep - 3 (Data.Sequence.One (Data.Sequence.Elem 'a')) Data.Sequence.Empty - (Data.Sequence.Two - (Data.Sequence.Elem 'b') (Data.Sequence.Elem 'c'))) +l = Data.Sequence.Internal.Seq (Data.Sequence.Internal.Deep + 3 + (Data.Sequence.Internal.Two + (Data.Sequence.Internal.Elem 'a') + (Data.Sequence.Internal.Elem 'b')) + Data.Sequence.Internal.EmptyT + (Data.Sequence.Internal.One (Data.Sequence.Internal.Elem 'c'))) l = fromList "abc" diff --git a/testsuite/tests/package/package01e.stderr b/testsuite/tests/package/package01e.stderr index f34ee1d..cfde9a7 100644 --- a/testsuite/tests/package/package01e.stderr +++ b/testsuite/tests/package/package01e.stderr @@ -1,10 +1,10 @@ package01e.hs:2:1: error: Could not find module ‘Data.Map’ - It is a member of the hidden package ‘containers-0.5.7.1’. + It is a member of the hidden package ‘containers-0.5.10.2’. Use -v to see a list of the files searched for. package01e.hs:3:1: error: Could not find module ‘Data.IntMap’ - It is a member of the hidden package ‘containers-0.5.7.1’. + It is a member of the hidden package ‘containers-0.5.10.2’. Use -v to see a list of the files searched for. diff --git a/testsuite/tests/partial-sigs/should_fail/T10999.stderr b/testsuite/tests/partial-sigs/should_fail/T10999.stderr index 582cf1a..0b534b9 100644 --- a/testsuite/tests/partial-sigs/should_fail/T10999.stderr +++ b/testsuite/tests/partial-sigs/should_fail/T10999.stderr @@ -21,8 +21,7 @@ T10999.hs:8:28: error: Relevant bindings include g :: [b0] (bound at T10999.hs:8:1) Probable fix: use a type annotation to specify what ‘b0’ should be. These potential instances exist: - instance Ord a => Ord (Set.Set a) - -- Defined in ‘containers-0.5.7.1:Data.Set.Base’ + instance Ord a => Ord (Set.Set a) -- Defined in ‘Data.Set.Internal’ instance Ord Ordering -- Defined in ‘GHC.Classes’ instance Ord Integer -- Defined in ‘integer-gmp-1.0.0.1:GHC.Integer.Type’ diff --git a/testsuite/tests/th/T10796b.stderr b/testsuite/tests/th/T10796b.stderr index eff1f75..2491a8c 100644 --- a/testsuite/tests/th/T10796b.stderr +++ b/testsuite/tests/th/T10796b.stderr @@ -1,5 +1,5 @@ T10796b.hs:8:17: error: - • Can't construct a pattern from name Data.Set.Base.fromList + • Can't construct a pattern from name Data.Set.Internal.fromList • In the untyped splice: $(dataToPatQ (const Nothing) (fromList "test")) From git at git.haskell.org Tue Feb 28 21:01:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 28 Feb 2017 21:01:00 +0000 (UTC) Subject: [commit: ghc] master: Combine identical case alternatives in CSE (55efc97) Message-ID: <20170228210100.C58333A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/55efc9718b520ef354e32c15c4b49cdfecce412f/ghc >--------------------------------------------------------------- commit 55efc9718b520ef354e32c15c4b49cdfecce412f Author: Simon Peyton Jones Date: Tue Feb 28 16:00:49 2017 -0500 Combine identical case alternatives in CSE See Note [Combine case alternatives] in CSE. This opportunity surfaced when I was was studying early inlining. It's easy (and cheap) to exploit, and sometimes makes a worthwhile saving. Reviewers: austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3194 >--------------------------------------------------------------- 55efc9718b520ef354e32c15c4b49cdfecce412f compiler/simplCore/CSE.hs | 132 ++++++++++++++++++--- .../tests/numeric/should_compile/T7116.stdout | 16 +-- 2 files changed, 119 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 55efc9718b520ef354e32c15c4b49cdfecce412f From git at git.haskell.org Tue Feb 28 21:07:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 28 Feb 2017 21:07:31 +0000 (UTC) Subject: [commit: ghc] master: The Early Inline Patch (2effe18) Message-ID: <20170228210731.717633A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2effe18ab51d66474724d38b20e49cc1b8738f60/ghc >--------------------------------------------------------------- commit 2effe18ab51d66474724d38b20e49cc1b8738f60 Author: Simon Peyton Jones Date: Tue Feb 28 16:07:20 2017 -0500 The Early Inline Patch This very small patch switches on sm_inline even in the InitialPhase (aka "gentle" phase). There is no reason not to... and the results are astonishing. I think the peformance of GHC itself improves by about 5%; and some programs get much smaller, quicker. Result: across the board irmprovements in compile time performance. Here are the changes in perf/compiler; the numbers are decreases in compiler bytes-allocated: 3% T5837 7% parsing001 9% T12234 35% T9020 9% T3064 13% T9961 20% T13056 5% T9872d 5% T9872c 5% T9872b 7% T9872a 5% T783 35% T12227 20% T1969 Plus in perf/should_run 5% lazy-bs-alloc It wasn't as easy as it sounds: I did a raft of preparatory work in earlier patches. But it's great! Reviewers: austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3203 >--------------------------------------------------------------- 2effe18ab51d66474724d38b20e49cc1b8738f60 compiler/simplCore/SimplCore.hs | 38 +++++++- compiler/simplCore/SimplUtils.hs | 60 +++++------- .../tests/codeGen/should_compile/debug.stdout | 3 +- testsuite/tests/deriving/perf/all.T | 3 +- .../indexed-types/should_compile/T7837.stderr | 3 +- testsuite/tests/perf/compiler/T4007.stdout | 8 +- testsuite/tests/perf/compiler/all.T | 65 +++++++++---- testsuite/tests/perf/haddock/all.T | 3 +- testsuite/tests/perf/should_run/all.T | 2 + testsuite/tests/simplCore/should_compile/Makefile | 11 ++- testsuite/tests/simplCore/should_compile/T10181.hs | 5 + .../tests/simplCore/should_compile/T3772.stdout | 88 +++++++++--------- .../tests/simplCore/should_compile/T4138.stdout | 2 +- testsuite/tests/simplCore/should_compile/T7785.hs | 14 ++- testsuite/tests/simplCore/should_compile/T8848.hs | 13 ++- .../tests/simplCore/should_compile/T8848.stderr | 101 --------------------- .../tests/simplCore/should_compile/T9509.stdout | 1 + testsuite/tests/simplCore/should_compile/T9509a.hs | 4 +- testsuite/tests/simplCore/should_compile/all.T | 6 +- .../tests/simplCore/should_compile/rule2.stderr | 13 +-- testsuite/tests/simplCore/should_run/T7611.hs | 1 + .../tests/simplCore/should_run/simplrun002.hs | 8 +- .../tests/simplCore/should_run/simplrun008.hs | 6 +- testsuite/tests/th/TH_Roles2.stderr | 4 +- 24 files changed, 219 insertions(+), 243 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 2effe18ab51d66474724d38b20e49cc1b8738f60 From git at git.haskell.org Tue Feb 28 21:57:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 28 Feb 2017 21:57:39 +0000 (UTC) Subject: [commit: ghc] branch 'wip/T13351' created Message-ID: <20170228215739.E07183A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/T13351 Referencing: 339a1784efd9ebf08a30765e092eef53712970c3 From git at git.haskell.org Tue Feb 28 21:57:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 28 Feb 2017 21:57:42 +0000 (UTC) Subject: [commit: ghc] wip/T13351: Revise list fusion for and, or, all, any, elem, notElem (#13351) (339a178) Message-ID: <20170228215742.9FC1F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T13351 Link : http://ghc.haskell.org/trac/ghc/changeset/339a1784efd9ebf08a30765e092eef53712970c3/ghc >--------------------------------------------------------------- commit 339a1784efd9ebf08a30765e092eef53712970c3 Author: Joachim Breitner Date: Tue Feb 28 12:20:02 2017 -0800 Revise list fusion for and, or, all, any, elem, notElem (#13351) to make sure their list fusion is implemented in terms of foldr (and not build directly), with proper writing-back rules. This ensures that, for example, c `elem` "!@#$%^&*()" works without actual list code. Also, for good measure, add foldr fusion rules for short lists, and make the comment there more useful. Differential Revision: https://phabricator.haskell.org/D3246 >--------------------------------------------------------------- 339a1784efd9ebf08a30765e092eef53712970c3 libraries/base/GHC/Base.hs | 19 +++++++++++------ libraries/base/GHC/List.hs | 52 +++++++++++++++++++++++++++++++++------------- 2 files changed, 51 insertions(+), 20 deletions(-) diff --git a/libraries/base/GHC/Base.hs b/libraries/base/GHC/Base.hs index e07c077..b5fa91c 100644 --- a/libraries/base/GHC/Base.hs +++ b/libraries/base/GHC/Base.hs @@ -897,16 +897,23 @@ augment g xs = g (:) xs -- Only activate this from phase 1, because that's -- when we disable the rule that expands (++) into foldr +"foldr/nil" forall k z. foldr k z [] = z +"foldr/single" forall k z x. foldr k z [x] = k x z +"foldr/short2" forall k z x1 x2. foldr k z [x1,x2] = k x1 (k x2 z) +"foldr/short3" forall k z x1 x2 x3. foldr k z [x1,x2,x3] = k x1 (k x2 (k x3 z)) +"foldr/short4" forall k z x1 x2 x3 x4. foldr k z [x1,x2,x3,x4] = k x1 (k x2 (k x3 (k x4 z))) + +-- "foldr/cons" forall k z x xs. foldr k z (x:xs) = k x (foldr k z xs) -- The foldr/cons rule looks nice, but it can give disastrously -- bloated code when commpiling -- array (a,b) [(1,2), (2,2), (3,2), ...very long list... ] -- i.e. when there are very very long literal lists --- So I've disabled it for now. We could have special cases --- for short lists, I suppose. --- "foldr/cons" forall k z x xs. foldr k z (x:xs) = k x (foldr k z xs) - -"foldr/single" forall k z x. foldr k z [x] = k x z -"foldr/nil" forall k z. foldr k z [] = z +-- So we disabled it, but have special cases for short lists up +-- to a completely arbitrary limit of 4. +-- +-- Note that static lists that are explicitly entered as such in the source, +-- the compiler desugars them to build (if they are short), and then normal +-- foldr/build rule fires, see note [Desugaring explicit lists] in DsExpr "foldr/cons/build" forall k z x (g::forall b. (a->b->b) -> b -> b) . foldr k z (x:build g) = k x (g k z) diff --git a/libraries/base/GHC/List.hs b/libraries/base/GHC/List.hs index 3eab407..7b6c059 100644 --- a/libraries/base/GHC/List.hs +++ b/libraries/base/GHC/List.hs @@ -730,9 +730,13 @@ and [] = True and (x:xs) = x && and xs {-# NOINLINE [1] and #-} +andFB :: Bool -> Bool -> Bool +andFB x r = x && r +{-# NOINLINE [0] andFB #-} + {-# RULES -"and/build" forall (g::forall b.(Bool->b->b)->b->b) . - and (build g) = g (&&) True +"and" [~1] forall xs. and xs = foldr andFB True xs +"andList" [1] foldr andFB True = and #-} #endif @@ -747,9 +751,13 @@ or [] = False or (x:xs) = x || or xs {-# NOINLINE [1] or #-} +orFB :: Bool -> Bool -> Bool +orFB x r = x || r +{-# NOINLINE [0] orFB #-} + {-# RULES -"or/build" forall (g::forall b.(Bool->b->b)->b->b) . - or (build g) = g (||) False +"or" [~1] forall xs. or xs = foldr orFB False xs +"orList" [1] foldr orFB False = or #-} #endif @@ -764,12 +772,15 @@ any p = or . map p #else any _ [] = False any p (x:xs) = p x || any p xs - {-# NOINLINE [1] any #-} +anyFB :: (t -> Bool) -> t -> Bool -> Bool +anyFB p x r = p x || r +{-# NOINLINE [0] anyFB #-} + {-# RULES -"any/build" forall p (g::forall b.(a->b->b)->b->b) . - any p (build g) = g ((||) . p) False +"any" [~1] forall p xs. any p xs = foldr (anyFB p) False xs +"anyList" [1] forall p. foldr (anyFB p) False = any p #-} #endif @@ -783,12 +794,15 @@ all p = and . map p #else all _ [] = True all p (x:xs) = p x && all p xs - {-# NOINLINE [1] all #-} +allFB :: (t -> Bool) -> t -> Bool -> Bool +allFB p x r = p x && r +{-# NOINLINE [0] allFB #-} + {-# RULES -"all/build" forall p (g::forall b.(a->b->b)->b->b) . - all p (build g) = g ((&&) . p) True +"all" [~1] forall p xs. all p xs = foldr (allFB p) True xs +"allList" [1] forall p. foldr (allFB p) True = all p #-} #endif @@ -803,9 +817,14 @@ elem x = any (== x) elem _ [] = False elem x (y:ys) = x==y || elem x ys {-# NOINLINE [1] elem #-} + +elemFB :: Eq a => a -> a -> Bool -> Bool +elemFB x y r = (x == y) || r +{-# NOINLINE [0] elemFB #-} + {-# RULES -"elem/build" forall x (g :: forall b . Eq a => (a -> b -> b) -> b -> b) - . elem x (build g) = g (\ y r -> (x == y) || r) False +"elem" [~1] forall x xs. elem x xs = foldr (elemFB x) False xs +"elemList" [1] forall x. foldr (elemFB x) False = elem x #-} #endif @@ -817,9 +836,14 @@ notElem x = all (/= x) notElem _ [] = True notElem x (y:ys)= x /= y && notElem x ys {-# NOINLINE [1] notElem #-} + +notElemFB :: Eq a => a -> a -> Bool -> Bool +notElemFB x y r = (x /= y) && r +{-# NOINLINE [0] notElemFB #-} + {-# RULES -"notElem/build" forall x (g :: forall b . Eq a => (a -> b -> b) -> b -> b) - . notElem x (build g) = g (\ y r -> (x /= y) && r) True +"notElem" [~1] forall x xs. notElem x xs = foldr (notElemFB x) False xs +"notElemList" [1] forall x. foldr (notElemFB x) True = notElem x #-} #endif