From git at git.haskell.org Sat Apr 1 00:31:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 1 Apr 2017 00:31:15 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: KQueue: Eliminate redundant import (8728c14) Message-ID: <20170401003115.E2B013A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/8728c140214fd299d9497396948a12de2476df5d/ghc >--------------------------------------------------------------- commit 8728c140214fd299d9497396948a12de2476df5d Author: Ben Gamari Date: Sun Mar 12 18:06:34 2017 -0400 KQueue: Eliminate redundant import At long last fixes OS X build. (cherry picked from commit 2f2622c601136a62e465dcd3b3b02db8156734b6) >--------------------------------------------------------------- 8728c140214fd299d9497396948a12de2476df5d libraries/base/GHC/Event/KQueue.hsc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libraries/base/GHC/Event/KQueue.hsc b/libraries/base/GHC/Event/KQueue.hsc index 7476c93..f26d199 100644 --- a/libraries/base/GHC/Event/KQueue.hsc +++ b/libraries/base/GHC/Event/KQueue.hsc @@ -27,9 +27,8 @@ available = False #else import Data.Bits (Bits(..), FiniteBits(..)) -import qualified Data.Int as I +import Data.Int import Data.Word (Word16, Word32) -import Data.Int (Int16) import Foreign.C.Error (throwErrnoIfMinus1, eINTR, eINVAL, eNOTSUP, getErrno, throwErrno) import Foreign.C.Types @@ -189,9 +188,9 @@ newtype Flag = Flag Word16 } #if SIZEOF_KEV_FILTER == 4 /*kevent.filter: int32_t or int16_t. */ -newtype Filter = Filter I.Int32 +newtype Filter = Filter Int32 #else -newtype Filter = Filter I.Int16 +newtype Filter = Filter Int16 #endif deriving (Bits, FiniteBits, Eq, Num, Show, Storable) From git at git.haskell.org Sat Apr 1 02:21:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 1 Apr 2017 02:21:00 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: testsuite: Fix use of wc in T13340 (000feba) Message-ID: <20170401022100.EE55C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/000febac91bb5dada2414bcab04c05a7342ca1a4/ghc >--------------------------------------------------------------- commit 000febac91bb5dada2414bcab04c05a7342ca1a4 Author: Ben Gamari Date: Mon Mar 13 17:00:01 2017 -0400 testsuite: Fix use of wc in T13340 As previously documented (88f5add0280788d424c9df5f751a73e73a1a4284) wc's output is inconsistent between Linux and BSDs. Use grep -c instead. (cherry picked from commit cf74b677e8a328785a95bd0a7b094daf25e6868a) >--------------------------------------------------------------- 000febac91bb5dada2414bcab04c05a7342ca1a4 testsuite/tests/simplCore/should_compile/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/tests/simplCore/should_compile/Makefile b/testsuite/tests/simplCore/should_compile/Makefile index 3276723..b190dfc 100644 --- a/testsuite/tests/simplCore/should_compile/Makefile +++ b/testsuite/tests/simplCore/should_compile/Makefile @@ -211,4 +211,4 @@ str-rules: # 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 + '$(TEST_HC)' $(TEST_HC_OPTS) -c -O T13340.hs -ddump-simpl -dsuppress-all | grep -c '\+#' From git at git.haskell.org Sat Apr 1 02:33:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 1 Apr 2017 02:33:35 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Update Windows allocations for T12234 (546c2a1) Message-ID: <20170401023335.2B3813A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/546c2a17ae3b21448f7fd467cc47807ae977e51f/ghc >--------------------------------------------------------------- commit 546c2a17ae3b21448f7fd467cc47807ae977e51f Author: Ben Gamari Date: Fri Mar 31 22:32:21 2017 -0400 testsuite: Update Windows allocations for T12234 >--------------------------------------------------------------- 546c2a17ae3b21448f7fd467cc47807ae977e51f testsuite/tests/perf/compiler/all.T | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index 595fb59..e1d4552 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -1012,9 +1012,10 @@ test('T12425', test('T12234', [ only_ways(['optasm']), compiler_stats_num_field('bytes allocated', - [(platform('x86_64-unknown-mingw32'), 89180624, 5), + [(platform('x86_64-unknown-mingw32'), 79889200, 5), # initial: 83032768 - # 2017-02-19 89180624 (x64/Windows) - Unknown + # 2017-02-19 89180624 (x64/Windows) - Unknown + # 2017-02-25 79889200 (x64/Windows) - Early inline patch (wordsize(64), 80245640, 5), # initial: 72958288 # 2016-01-17: 76848856 (x86-64, Linux. drift?) From git at git.haskell.org Sat Apr 1 02:37:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 1 Apr 2017 02:37:47 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: testsuite: Update Windows allocations for T12234 (a08003e) Message-ID: <20170401023747.53FCE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/a08003e848a0d6e53272d96b12023857c0acfca5/ghc >--------------------------------------------------------------- commit a08003e848a0d6e53272d96b12023857c0acfca5 Author: Ben Gamari Date: Fri Mar 31 22:32:21 2017 -0400 testsuite: Update Windows allocations for T12234 (cherry picked from commit 546c2a17ae3b21448f7fd467cc47807ae977e51f) >--------------------------------------------------------------- a08003e848a0d6e53272d96b12023857c0acfca5 testsuite/tests/perf/compiler/all.T | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index 4b89906..c034e93 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -1014,9 +1014,10 @@ test('T12425', test('T12234', [ only_ways(['optasm']), compiler_stats_num_field('bytes allocated', - [(platform('x86_64-unknown-mingw32'), 89180624, 5), + [(platform('x86_64-unknown-mingw32'), 79889200, 5), # initial: 83032768 - # 2017-02-19 89180624 (x64/Windows) - Unknown + # 2017-02-19 89180624 (x64/Windows) - Unknown + # 2017-02-25 79889200 (x64/Windows) - Early inline patch (wordsize(64), 80245640, 5), # initial: 72958288 # 2016-01-17: 76848856 (x86-64, Linux. drift?) From git at git.haskell.org Sat Apr 1 03:21:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 1 Apr 2017 03:21:07 +0000 (UTC) Subject: [commit: ghc] master: Remove Core Lint pass on occurrence analysis output (#13220) (71916e1) Message-ID: <20170401032107.3FFFF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/71916e1c018dded2e68d6769a2dbb8777da12664/ghc >--------------------------------------------------------------- commit 71916e1c018dded2e68d6769a2dbb8777da12664 Author: Reid Barton Date: Fri Mar 31 22:48:14 2017 -0400 Remove Core Lint pass on occurrence analysis output (#13220) It was expensive, as the simplifier runs for many iterations, and probably not very useful. Test Plan: harbormaster Reviewers: austin, bgamari, dfeuer Reviewed By: dfeuer Subscribers: dfeuer, thomie Differential Revision: https://phabricator.haskell.org/D3391 >--------------------------------------------------------------- 71916e1c018dded2e68d6769a2dbb8777da12664 compiler/simplCore/SimplCore.hs | 1 - testsuite/tests/deriving/perf/all.T | 12 +++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/compiler/simplCore/SimplCore.hs b/compiler/simplCore/SimplCore.hs index 72e2795..bca9a33 100644 --- a/compiler/simplCore/SimplCore.hs +++ b/compiler/simplCore/SimplCore.hs @@ -738,7 +738,6 @@ simplifyPgmIO pass@(CoreDoSimplify max_iterations mode) } ; Err.dumpIfSet_dyn dflags Opt_D_dump_occur_anal "Occurrence analysis" (pprCoreBindings tagged_binds); - lintPassResult hsc_env CoreOccurAnal tagged_binds; -- Get any new rules, and extend the rule base -- See Note [Overall plumbing for rules] in Rules.hs diff --git a/testsuite/tests/deriving/perf/all.T b/testsuite/tests/deriving/perf/all.T index 4d88bc9..a711a50 100644 --- a/testsuite/tests/deriving/perf/all.T +++ b/testsuite/tests/deriving/perf/all.T @@ -1,13 +1,11 @@ test('T10858', [compiler_stats_num_field('bytes allocated', - [(platform('x86_64-unknown-mingw32'), 272402736, 8), - # 2017-02-19 272402736 (x64/Windows) - unknown - - (wordsize(64), 275357824, 8) ]), - # Initial: 476296112 + [(wordsize(64), 241242968, 8) ]), + # Initial: 222312440 # 2016-12-19 247768192 Join points (#19288) - # 2016-02-12 304094944 Type-indexed Typeable - # 2016-02-25 275357824 Early inline patch + # 2017-02-12 304094944 Type-indexed Typeable + # 2017-02-25 275357824 Early inline patch + # 2017-03-28 241242968 Run Core Lint less only_ways(['normal'])], compile, ['-O']) From git at git.haskell.org Sat Apr 1 03:21:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 1 Apr 2017 03:21:04 +0000 (UTC) Subject: [commit: ghc] master: askCc should be using the linker, not the compiler (3082879) Message-ID: <20170401032104.7EA043A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/308287999fcc929891fbcf1221525dd7cbb77860/ghc >--------------------------------------------------------------- commit 308287999fcc929891fbcf1221525dd7cbb77860 Author: Simon Marlow Date: Fri Mar 31 22:47:47 2017 -0400 askCc should be using the linker, not the compiler When GHCi tries to find a shared lib, it calls "gcc --print-file-name" to ask gcc where to find it. But since we're looking for libraries, we're really using the linker here, not the C compiler, so we should be respecting the values of -pgml and -optl rather than -pgmc and -optc. Test Plan: validate Reviewers: bgamari, niteria, austin, hvr, erikd Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3393 >--------------------------------------------------------------- 308287999fcc929891fbcf1221525dd7cbb77860 compiler/ghci/Linker.hs | 2 +- compiler/main/SysTools.hs | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/compiler/ghci/Linker.hs b/compiler/ghci/Linker.hs index edd947d..10e789a 100644 --- a/compiler/ghci/Linker.hs +++ b/compiler/ghci/Linker.hs @@ -1422,7 +1422,7 @@ searchForLibUsingGcc :: DynFlags -> String -> [FilePath] -> IO (Maybe FilePath) searchForLibUsingGcc dflags so dirs = do -- GCC does not seem to extend the library search path (using -L) when using -- --print-file-name. So instead pass it a new base location. - str <- askCc dflags (map (FileOption "-B") dirs + str <- askLd dflags (map (FileOption "-B") dirs ++ [Option "--print-file-name", Option so]) let file = case lines str of [] -> "" diff --git a/compiler/main/SysTools.hs b/compiler/main/SysTools.hs index 1b567e9..fd3faf1 100644 --- a/compiler/main/SysTools.hs +++ b/compiler/main/SysTools.hs @@ -31,7 +31,7 @@ module SysTools ( linkDynLib, - askCc, + askLd, touch, -- String -> String -> IO () copy, @@ -480,11 +480,12 @@ runCc dflags args = do isContainedIn :: String -> String -> Bool xs `isContainedIn` ys = any (xs `isPrefixOf`) (tails ys) -askCc :: DynFlags -> [Option] -> IO String -askCc dflags args = do - let (p,args0) = pgm_c dflags - args1 = map Option (getOpts dflags opt_c) - args2 = args0 ++ args1 ++ args +-- | Run the linker with some arguments and return the output +askLd :: DynFlags -> [Option] -> IO String +askLd dflags args = do + let (p,args0) = pgm_l dflags + args1 = map Option (getOpts dflags opt_l) + args2 = args0 ++ args1 ++ args mb_env <- getGccEnv args2 runSomethingWith dflags "gcc" p args2 $ \real_args -> readCreateProcessWithExitCode' (proc p real_args){ env = mb_env } From git at git.haskell.org Sat Apr 1 10:12:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 1 Apr 2017 10:12:21 +0000 (UTC) Subject: [commit: ghc] master: UNREG: ignore -fllvm (Trac #13495) (74615f4) Message-ID: <20170401101221.7A48D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/74615f412ad3de2910a156ff494bfe5497fada7e/ghc >--------------------------------------------------------------- commit 74615f412ad3de2910a156ff494bfe5497fada7e Author: Sergei Trofimovich Date: Sat Apr 1 10:35:52 2017 +0100 UNREG: ignore -fllvm (Trac #13495) Unregisterised GHC can only use C as a target backend (option used to be called -fvia-C). -fasm option was ignored with a warhing, but not -fllvm. jms noticed the failure when tried to use quick-cross build flavour. quick-cross enables -fllvm in makefile. "inplace/bin/ghc-stage1" ... -fllvm ghc-stage1: panic! (the 'impossible' happened) (GHC version 8.0.2 for powerpc-unknown-linux): LlvmCodeGen.Ppr: Cross compiling without valid target info. This change ignores -fllvm as well. Signed-off-by: Sergei Trofimovich >--------------------------------------------------------------- 74615f412ad3de2910a156ff494bfe5497fada7e compiler/main/DynFlags.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 2750ca6..dad1d6f 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -5151,7 +5151,7 @@ makeDynFlagsConsistent dflags = let dflags' = gopt_unset dflags Opt_Hpc warn = "Hpc can't be used with byte-code interpreter. Ignoring -fhpc." in loop dflags' warn - | hscTarget dflags == HscAsm && + | hscTarget dflags `elem` [HscAsm, HscLlvm] && platformUnregisterised (targetPlatform dflags) = loop (dflags { hscTarget = HscC }) "Compiler unregisterised, so compiling via C" From git at git.haskell.org Sat Apr 1 11:01:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 1 Apr 2017 11:01:51 +0000 (UTC) Subject: [commit: ghc] master: rts: print incorrect prev_what_next (a094aa7) Message-ID: <20170401110151.D69493A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a094aa7dcf92ecb7ddbb82128e279d434f5835ba/ghc >--------------------------------------------------------------- commit a094aa7dcf92ecb7ddbb82128e279d434f5835ba Author: Sergei Trofimovich Date: Sat Apr 1 11:58:55 2017 +0100 rts: print incorrect prev_what_next Moritz Angermann reports mysterious rts crash: A: link: internal error: schedule: invalid what_next field A: (GHC version 8.3.20170321 for arm_none_linux_android) This change prints actual prev_what_next value. Signed-off-by: Sergei Trofimovich >--------------------------------------------------------------- a094aa7dcf92ecb7ddbb82128e279d434f5835ba rts/Schedule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rts/Schedule.c b/rts/Schedule.c index a4d0c1d..b77e7a2 100644 --- a/rts/Schedule.c +++ b/rts/Schedule.c @@ -473,7 +473,7 @@ run_thread: break; default: - barf("schedule: invalid what_next field"); + barf("schedule: invalid prev_what_next=%u field", prev_what_next); } cap->in_haskell = false; From git at git.haskell.org Sat Apr 1 14:56:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 1 Apr 2017 14:56:32 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: askCc should be using the linker, not the compiler (14565d2) Message-ID: <20170401145632.666F73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/14565d22c63e1507c17f8e927507ff1a678aa975/ghc >--------------------------------------------------------------- commit 14565d22c63e1507c17f8e927507ff1a678aa975 Author: Simon Marlow Date: Fri Mar 31 22:47:47 2017 -0400 askCc should be using the linker, not the compiler When GHCi tries to find a shared lib, it calls "gcc --print-file-name" to ask gcc where to find it. But since we're looking for libraries, we're really using the linker here, not the C compiler, so we should be respecting the values of -pgml and -optl rather than -pgmc and -optc. Test Plan: validate Reviewers: bgamari, niteria, austin, hvr, erikd Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3393 (cherry picked from commit 308287999fcc929891fbcf1221525dd7cbb77860) >--------------------------------------------------------------- 14565d22c63e1507c17f8e927507ff1a678aa975 compiler/ghci/Linker.hs | 2 +- compiler/main/SysTools.hs | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/compiler/ghci/Linker.hs b/compiler/ghci/Linker.hs index 390d914..44d9f76 100644 --- a/compiler/ghci/Linker.hs +++ b/compiler/ghci/Linker.hs @@ -1422,7 +1422,7 @@ searchForLibUsingGcc :: DynFlags -> String -> [FilePath] -> IO (Maybe FilePath) searchForLibUsingGcc dflags so dirs = do -- GCC does not seem to extend the library search path (using -L) when using -- --print-file-name. So instead pass it a new base location. - str <- askCc dflags (map (FileOption "-B") dirs + str <- askLd dflags (map (FileOption "-B") dirs ++ [Option "--print-file-name", Option so]) let file = case lines str of [] -> "" diff --git a/compiler/main/SysTools.hs b/compiler/main/SysTools.hs index 9a9f899..a7e7993 100644 --- a/compiler/main/SysTools.hs +++ b/compiler/main/SysTools.hs @@ -31,7 +31,7 @@ module SysTools ( linkDynLib, - askCc, + askLd, touch, -- String -> String -> IO () copy, @@ -480,11 +480,12 @@ runCc dflags args = do isContainedIn :: String -> String -> Bool xs `isContainedIn` ys = any (xs `isPrefixOf`) (tails ys) -askCc :: DynFlags -> [Option] -> IO String -askCc dflags args = do - let (p,args0) = pgm_c dflags - args1 = map Option (getOpts dflags opt_c) - args2 = args0 ++ args1 ++ args +-- | Run the linker with some arguments and return the output +askLd :: DynFlags -> [Option] -> IO String +askLd dflags args = do + let (p,args0) = pgm_l dflags + args1 = map Option (getOpts dflags opt_l) + args2 = args0 ++ args1 ++ args mb_env <- getGccEnv args2 runSomethingWith dflags "gcc" p args2 $ \real_args -> readCreateProcessWithExitCode' (proc p real_args){ env = mb_env } From git at git.haskell.org Sat Apr 1 14:56:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 1 Apr 2017 14:56:35 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Remove Core Lint pass on occurrence analysis output (#13220) (52d14ba) Message-ID: <20170401145635.20FB63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/52d14ba3a0bafafee5620091a3c22717a883a2d7/ghc >--------------------------------------------------------------- commit 52d14ba3a0bafafee5620091a3c22717a883a2d7 Author: Reid Barton Date: Fri Mar 31 22:48:14 2017 -0400 Remove Core Lint pass on occurrence analysis output (#13220) It was expensive, as the simplifier runs for many iterations, and probably not very useful. Test Plan: harbormaster Reviewers: austin, bgamari, dfeuer Reviewed By: dfeuer Subscribers: dfeuer, thomie Differential Revision: https://phabricator.haskell.org/D3391 (cherry picked from commit 71916e1c018dded2e68d6769a2dbb8777da12664) >--------------------------------------------------------------- 52d14ba3a0bafafee5620091a3c22717a883a2d7 compiler/simplCore/SimplCore.hs | 1 - testsuite/tests/deriving/perf/all.T | 12 +++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/compiler/simplCore/SimplCore.hs b/compiler/simplCore/SimplCore.hs index 34f49ad..cd57705 100644 --- a/compiler/simplCore/SimplCore.hs +++ b/compiler/simplCore/SimplCore.hs @@ -738,7 +738,6 @@ simplifyPgmIO pass@(CoreDoSimplify max_iterations mode) } ; Err.dumpIfSet_dyn dflags Opt_D_dump_occur_anal "Occurrence analysis" (pprCoreBindings tagged_binds); - lintPassResult hsc_env CoreOccurAnal tagged_binds; -- Get any new rules, and extend the rule base -- See Note [Overall plumbing for rules] in Rules.hs diff --git a/testsuite/tests/deriving/perf/all.T b/testsuite/tests/deriving/perf/all.T index 4d88bc9..a711a50 100644 --- a/testsuite/tests/deriving/perf/all.T +++ b/testsuite/tests/deriving/perf/all.T @@ -1,13 +1,11 @@ test('T10858', [compiler_stats_num_field('bytes allocated', - [(platform('x86_64-unknown-mingw32'), 272402736, 8), - # 2017-02-19 272402736 (x64/Windows) - unknown - - (wordsize(64), 275357824, 8) ]), - # Initial: 476296112 + [(wordsize(64), 241242968, 8) ]), + # Initial: 222312440 # 2016-12-19 247768192 Join points (#19288) - # 2016-02-12 304094944 Type-indexed Typeable - # 2016-02-25 275357824 Early inline patch + # 2017-02-12 304094944 Type-indexed Typeable + # 2017-02-25 275357824 Early inline patch + # 2017-03-28 241242968 Run Core Lint less only_ways(['normal'])], compile, ['-O']) From git at git.haskell.org Sat Apr 1 15:01:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 1 Apr 2017 15:01:03 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Add regression test for #13474 (616a3b4) Message-ID: <20170401150103.E1CAD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/616a3b49f085c01ff676424a1c3297ce0888e7ae/ghc >--------------------------------------------------------------- commit 616a3b49f085c01ff676424a1c3297ce0888e7ae Author: Ben Gamari Date: Sat Apr 1 10:59:53 2017 -0400 testsuite: Add regression test for #13474 >--------------------------------------------------------------- 616a3b49f085c01ff676424a1c3297ce0888e7ae testsuite/tests/typecheck/should_compile/T13474.hs | 13 +++++++++++++ testsuite/tests/typecheck/should_compile/all.T | 1 + 2 files changed, 14 insertions(+) diff --git a/testsuite/tests/typecheck/should_compile/T13474.hs b/testsuite/tests/typecheck/should_compile/T13474.hs new file mode 100644 index 0000000..9775832 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T13474.hs @@ -0,0 +1,13 @@ +module T13474 where + +import qualified Data.Map as M + +class Default a where + def :: a + +foo :: Default a => b -> a +foo x = def + +mapdef :: Default v => M.Map k v -> M.Map k v +mapdef = M.map foo + diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index 6bd98ca..c6674c9 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -550,3 +550,4 @@ test('T13337', normal, compile, ['']) test('T13343', normal, compile, ['']) test('T13458', normal, compile, ['']) test('T13490', normal, compile, ['']) +test('T13474', normal, compile, ['']) From git at git.haskell.org Sat Apr 1 15:21:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 1 Apr 2017 15:21:45 +0000 (UTC) Subject: [commit: ghc] master: Don't derive showList (83ac462) Message-ID: <20170401152145.DB0973A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/83ac462449d9365ebd8b51f252f9cf81b35f119d/ghc >--------------------------------------------------------------- commit 83ac462449d9365ebd8b51f252f9cf81b35f119d Author: David Feuer Date: Sat Apr 1 11:12:31 2017 -0400 Don't derive showList There's no obvious reason to derive the definition of `showList`, manually inlining the default definition. Let's just use the default definition in the usual manner. Garbage collect a few unused `RdrNames` from `PrelNames`: `showList`, `showList__`, and `/=`. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: RyanGlScott, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3403 >--------------------------------------------------------------- 83ac462449d9365ebd8b51f252f9cf81b35f119d compiler/prelude/PrelNames.hs | 7 ++----- compiler/typecheck/TcGenDeriv.hs | 6 +----- testsuite/tests/deriving/should_compile/drv-empty-data.stderr | 1 - 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/compiler/prelude/PrelNames.hs b/compiler/prelude/PrelNames.hs index e3ebd6a..94c2d64 100644 --- a/compiler/prelude/PrelNames.hs +++ b/compiler/prelude/PrelNames.hs @@ -622,11 +622,10 @@ forall_tv_RDR, dot_tv_RDR :: RdrName forall_tv_RDR = mkUnqual tvName (fsLit "forall") dot_tv_RDR = mkUnqual tvName (fsLit ".") -eq_RDR, ge_RDR, ne_RDR, le_RDR, lt_RDR, gt_RDR, compare_RDR, +eq_RDR, ge_RDR, le_RDR, lt_RDR, gt_RDR, compare_RDR, ltTag_RDR, eqTag_RDR, gtTag_RDR :: RdrName eq_RDR = nameRdrName eqName ge_RDR = nameRdrName geName -ne_RDR = varQual_RDR gHC_CLASSES (fsLit "/=") le_RDR = varQual_RDR gHC_CLASSES (fsLit "<=") lt_RDR = varQual_RDR gHC_CLASSES (fsLit "<") gt_RDR = varQual_RDR gHC_CLASSES (fsLit ">") @@ -755,10 +754,8 @@ reset_RDR = varQual_RDR rEAD_PREC (fsLit "reset") prec_RDR = varQual_RDR rEAD_PREC (fsLit "prec") pfail_RDR = varQual_RDR rEAD_PREC (fsLit "pfail") -showList_RDR, showList___RDR, showsPrec_RDR, shows_RDR, showString_RDR, +showsPrec_RDR, shows_RDR, showString_RDR, showSpace_RDR, showCommaSpace_RDR, showParen_RDR :: RdrName -showList_RDR = varQual_RDR gHC_SHOW (fsLit "showList") -showList___RDR = varQual_RDR gHC_SHOW (fsLit "showList__") showsPrec_RDR = varQual_RDR gHC_SHOW (fsLit "showsPrec") shows_RDR = varQual_RDR gHC_SHOW (fsLit "shows") showString_RDR = varQual_RDR gHC_SHOW (fsLit "showString") diff --git a/compiler/typecheck/TcGenDeriv.hs b/compiler/typecheck/TcGenDeriv.hs index d21535e..96513da 100644 --- a/compiler/typecheck/TcGenDeriv.hs +++ b/compiler/typecheck/TcGenDeriv.hs @@ -1112,12 +1112,8 @@ Example gen_Show_binds :: (Name -> Fixity) -> SrcSpan -> TyCon -> (LHsBinds RdrName, BagDerivStuff) gen_Show_binds get_fixity loc tycon - = (listToBag [shows_prec, show_list], emptyBag) + = (unitBag shows_prec, emptyBag) where - ----------------------------------------------------------------------- - show_list = mkHsVarBind loc showList_RDR - (nlHsApp (nlHsVar showList___RDR) (nlHsPar (nlHsApp (nlHsVar showsPrec_RDR) (nlHsIntLit 0)))) - ----------------------------------------------------------------------- data_cons = tyConDataCons tycon shows_prec = mkFunBindSE 1 loc showsPrec_RDR (map pats_etc data_cons) comma_space = nlHsVar showCommaSpace_RDR diff --git a/testsuite/tests/deriving/should_compile/drv-empty-data.stderr b/testsuite/tests/deriving/should_compile/drv-empty-data.stderr index 502ba6c..47d5a98 100644 --- a/testsuite/tests/deriving/should_compile/drv-empty-data.stderr +++ b/testsuite/tests/deriving/should_compile/drv-empty-data.stderr @@ -9,7 +9,6 @@ Derived class instances: instance GHC.Show.Show (DrvEmptyData.Void a) where GHC.Show.showsPrec _ = GHC.Err.error "Void showsPrec" - GHC.Show.showList = GHC.Show.showList__ (GHC.Show.showsPrec 0) instance GHC.Classes.Ord (DrvEmptyData.Void a) where GHC.Classes.compare _ _ = GHC.Err.error "Void compare" From git at git.haskell.org Sat Apr 1 16:32:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 1 Apr 2017 16:32:16 +0000 (UTC) Subject: [commit: ghc] master: Stamp out space leaks from demand analysis (f2b10f3) Message-ID: <20170401163216.8AE2F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f2b10f35a053e595fd309f523c5e93f619d2ec3a/ghc >--------------------------------------------------------------- commit f2b10f35a053e595fd309f523c5e93f619d2ec3a Author: Reid Barton Date: Sat Apr 1 11:51:59 2017 -0400 Stamp out space leaks from demand analysis This reduces peak memory usage by ~30% on my test case (DynFlags), and (probably as a result of reduced GC work) decreases compilation time by a few percent as well. Also fix a bug in seqStrDmd so that demeand info is fully evaluated. Reviewers: simonpj, austin, bgamari Reviewed By: bgamari Subscribers: dfeuer, thomie Differential Revision: https://phabricator.haskell.org/D3400 >--------------------------------------------------------------- f2b10f35a053e595fd309f523c5e93f619d2ec3a compiler/basicTypes/Demand.hs | 2 +- compiler/stranal/DmdAnal.hs | 22 +++++++++++++++++++++- testsuite/tests/perf/compiler/all.T | 5 +++-- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/compiler/basicTypes/Demand.hs b/compiler/basicTypes/Demand.hs index 377fc3d..95c7b79 100644 --- a/compiler/basicTypes/Demand.hs +++ b/compiler/basicTypes/Demand.hs @@ -332,7 +332,7 @@ bothStr (SProd _) (SCall _) = HyperStr -- utility functions to deal with memory leaks seqStrDmd :: StrDmd -> () seqStrDmd (SProd ds) = seqStrDmdList ds -seqStrDmd (SCall s) = s `seq` () +seqStrDmd (SCall s) = seqStrDmd s seqStrDmd _ = () seqStrDmdList :: [ArgStr] -> () diff --git a/compiler/stranal/DmdAnal.hs b/compiler/stranal/DmdAnal.hs index 25a4f8b..2fc33a4 100644 --- a/compiler/stranal/DmdAnal.hs +++ b/compiler/stranal/DmdAnal.hs @@ -17,6 +17,7 @@ import DynFlags import WwLib ( findTypeShape, deepSplitProductType_maybe ) import Demand -- All of it import CoreSyn +import CoreSeq ( seqBinds ) import Outputable import VarEnv import BasicTypes @@ -52,7 +53,8 @@ dmdAnalProgram dflags fam_envs binds dumpIfSet_dyn dflags Opt_D_dump_str_signatures "Strictness signatures" $ dumpStrSig binds_plus_dmds ; - return binds_plus_dmds + -- See Note [Stamp out space leaks in demand analysis] + seqBinds binds_plus_dmds `seq` return binds_plus_dmds } where do_prog :: CoreProgram -> CoreProgram @@ -79,6 +81,24 @@ dmdAnalTopBind sigs (Rec pairs) -- We get two iterations automatically -- c.f. the NonRec case above +{- Note [Stamp out space leaks in demand analysis] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +The demand analysis pass outputs a new copy of the Core program in +which binders have been annotated with demand and strictness +information. It's tiresome to ensure that this information is fully +evaluated everywhere that we produce it, so we just run a single +seqBinds over the output before returning it, to ensure that there are +no references holding on to the input Core program. + +This is particularly important when we are doing late demand analysis, +since we don't do a seqBinds at any point thereafter. Hence code +generation would hold on to an extra copy of the Core program, via +unforced thunks in demand or strictness information; and it is the +most memory-intensive part of the compilation process, so this added +seqBinds makes a big difference in peak memory usage. +-} + + {- ************************************************************************ * * diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index e1d4552..aa7b811 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -736,7 +736,7 @@ test('T9020', test('T9675', [ only_ways(['optasm']), compiler_stats_num_field('max_bytes_used', # Note [residency] - [(wordsize(64), 38776008, 15), + [(wordsize(64), 29871032, 15), # 2014-10-13 29596552 # 2014-10-13 26570896 seq the DmdEnv in seqDmdType as well # 2014-10-13 18582472 different machines giving different results.. @@ -744,7 +744,8 @@ test('T9675', # 2015-06-21 28056344 switch to `+RTS -G1`, tighten bound to 15% # 2015-10-28 23776640 emit Typeable at definition site # 2015-12-11 30837312 TypeInType (see #11196) - # 2016-04-14 38776008 Final demand analyzer run + # 2016-03-14 38776008 Final demand analyzer run + # 2016-04-01 29871032 Fix leaks in demand analysis (wordsize(32), 18043224, 15) # 2015-07-11 15341228 (x86/Linux, 64-bit machine) use +RTS -G1 # 2016-04-06 18043224 (x86/Linux, 64-bit machine) From git at git.haskell.org Sat Apr 1 16:32:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 1 Apr 2017 16:32:19 +0000 (UTC) Subject: [commit: ghc] master: Optimise common cases of GHC.setProgramDynFlags (3b5f786) Message-ID: <20170401163219.5B1BD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3b5f786c7257298657fd34b3840d8cf6da968ef6/ghc >--------------------------------------------------------------- commit 3b5f786c7257298657fd34b3840d8cf6da968ef6 Author: Simon Marlow Date: Sat Apr 1 11:51:43 2017 -0400 Optimise common cases of GHC.setProgramDynFlags * If the package flags haven't changed, don't do initPackages (which might take multiple seconds in extreme cases) * Provide a way to change the log_action without invalidating the summary cache. Test Plan: validate Reviewers: niteria, bgamari, austin, erikd, ezyang Reviewed By: bgamari Subscribers: mpickering, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3392 >--------------------------------------------------------------- 3b5f786c7257298657fd34b3840d8cf6da968ef6 compiler/main/DriverPipeline.hs | 10 ++++++- compiler/main/DynFlags.hs | 64 +++++++++++++++++++++++++---------------- compiler/main/GHC.hs | 30 +++++++++++++++---- compiler/main/Packages.hs | 24 +++++++++++++--- ghc/GHCi/UI.hs | 7 ----- 5 files changed, 94 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 3b5f786c7257298657fd34b3840d8cf6da968ef6 From git at git.haskell.org Sun Apr 2 13:14:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 2 Apr 2017 13:14:29 +0000 (UTC) Subject: [commit: ghc] master: compiler/ghc.mk: fix GhcWithInterpreter=NO build failure (03e3425) Message-ID: <20170402131429.3D9D13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/03e34256e2cba964adf6dcdb1682618f26400b3a/ghc >--------------------------------------------------------------- commit 03e34256e2cba964adf6dcdb1682618f26400b3a Author: Sergei Trofimovich Date: Sun Apr 2 14:01:19 2017 +0100 compiler/ghc.mk: fix GhcWithInterpreter=NO build failure When GhcWithInterpreter=NO is set in mk/build.mk build fails as: $ inplace/bin/dll-split compiler/stage2/build/.depend-v-dyn.haskell "DynFlags" ... Reachable modules from DynFlags out of date Please fix compiler/ghc.mk, or building DLLs on Windows may break (#7780) Extra modules: ByteCodeTypes InteractiveEvalTypes Signed-off-by: Sergei Trofimovich >--------------------------------------------------------------- 03e34256e2cba964adf6dcdb1682618f26400b3a compiler/ghc.mk | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/compiler/ghc.mk b/compiler/ghc.mk index 28b0001..d5498c4 100644 --- a/compiler/ghc.mk +++ b/compiler/ghc.mk @@ -441,6 +441,7 @@ compiler_stage2_dll0_MODULES = \ BinFingerprint \ BooleanFormula \ BufWrite \ + ByteCodeTypes \ Class \ CmdLineParser \ CmmType \ @@ -494,12 +495,13 @@ compiler_stage2_dll0_MODULES = \ HsUtils \ HscTypes \ IOEnv \ - NameCache \ + NameCache \ Id \ IdInfo \ IfaceSyn \ IfaceType \ - Json \ + InteractiveEvalTypes \ + Json \ ToIface \ InstEnv \ Kind \ @@ -564,9 +566,7 @@ compiler_stage2_dll0_MODULES = \ ifeq "$(GhcWithInterpreter)" "YES" # These files are reacheable from DynFlags # only by GHCi-enabled code (see #9552) -compiler_stage2_dll0_MODULES += \ - ByteCodeTypes \ - InteractiveEvalTypes +compiler_stage2_dll0_MODULES += # none endif compiler_stage2_dll0_HS_OBJS = \ From git at git.haskell.org Sun Apr 2 15:13:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 2 Apr 2017 15:13:12 +0000 (UTC) Subject: [commit: ghc] master: FastMutInt: fix Int and Ptr sizes when crosscompiling (d89b047) Message-ID: <20170402151312.E8F8A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d89b0471888b15844b8bbf68159fe50830be8b24/ghc >--------------------------------------------------------------- commit d89b0471888b15844b8bbf68159fe50830be8b24 Author: Sergei Trofimovich Date: Sun Apr 2 16:12:18 2017 +0100 FastMutInt: fix Int and Ptr sizes when crosscompiling Similar to https://ghc.haskell.org/trac/ghc/ticket/13491 https://phabricator.haskell.org/D3122 SIZEOF_HSINT and SIZEOF_VOID_P are sizes of target platform. These values are usually not correct when stage1 is built. It means the code ```haskell newFastMutInt = IO $ \s -> case newByteArray# size s of { (# s, arr #) -> (# s, FastMutInt arr #) } where !(I# size) = SIZEOF_HSINT ``` would try to allocate only 4 bytes on 64-bit-host targeting 32-bit system. It does not matter in practice as newByteArray# implementation rounds up passed value to host's word size. But one day it might not. To prevent this class of problems in compiler/ directory 'MachDeps.h' contents is hidden when ghc-stage1 (-DSTAGE=1) is built. Signed-off-by: Sergei Trofimovich Reviewers: austin, rwbarton, simonmar, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3405 >--------------------------------------------------------------- d89b0471888b15844b8bbf68159fe50830be8b24 compiler/utils/FastMutInt.hs | 14 +++++--------- includes/MachDeps.h | 29 ++++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/compiler/utils/FastMutInt.hs b/compiler/utils/FastMutInt.hs index 4cde121..2a6e7b8 100644 --- a/compiler/utils/FastMutInt.hs +++ b/compiler/utils/FastMutInt.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE CPP, BangPatterns, MagicHash, UnboxedTuples #-} +{-# LANGUAGE BangPatterns, MagicHash, UnboxedTuples #-} {-# OPTIONS_GHC -O #-} -- We always optimise this, otherwise performance of a non-optimised -- compiler is severely affected @@ -15,12 +15,7 @@ module FastMutInt( readFastMutPtr, writeFastMutPtr ) where - -#include "../includes/MachDeps.h" -#ifndef SIZEOF_HSINT -#define SIZEOF_HSINT INT_SIZE_IN_BYTES -#endif - +import Data.Bits import GHC.Base import GHC.Ptr @@ -37,7 +32,7 @@ data FastMutInt = FastMutInt (MutableByteArray# RealWorld) newFastMutInt = IO $ \s -> case newByteArray# size s of { (# s, arr #) -> (# s, FastMutInt arr #) } - where !(I# size) = SIZEOF_HSINT + where !(I# size) = finiteBitSize (0 :: Int) readFastMutInt (FastMutInt arr) = IO $ \s -> case readIntArray# arr 0# s of { (# s, i #) -> @@ -52,7 +47,8 @@ data FastMutPtr = FastMutPtr (MutableByteArray# RealWorld) newFastMutPtr = IO $ \s -> case newByteArray# size s of { (# s, arr #) -> (# s, FastMutPtr arr #) } - where !(I# size) = SIZEOF_VOID_P + -- GHC assumes 'sizeof (Int) == sizeof (Ptr a)' + where !(I# size) = finiteBitSize (0 :: Int) readFastMutPtr (FastMutPtr arr) = IO $ \s -> case readAddrArray# arr 0# s of { (# s, i #) -> diff --git a/includes/MachDeps.h b/includes/MachDeps.h index 3a8371b..380b3fb 100644 --- a/includes/MachDeps.h +++ b/includes/MachDeps.h @@ -3,7 +3,7 @@ * (c) The University of Glasgow 2002 * * Definitions that characterise machine specific properties of basic - * types (C & Haskell). + * types (C & Haskell) of a target platform. * * NB: Keep in sync with HsFFI.h and StgTypes.h. * NB: THIS FILE IS INCLUDED IN HASKELL SOURCE! @@ -16,6 +16,31 @@ #ifndef MACHDEPS_H #define MACHDEPS_H +/* Don't allow stage1 (cross-)compiler embed assumptions about target + * platform. When ghc-stage1 is being built by ghc-stage0 is should not + * refer to target defines. A few past examples: + * - https://ghc.haskell.org/trac/ghc/ticket/13491 + * - https://phabricator.haskell.org/D3122 + * - https://phabricator.haskell.org/D3405 + * + * In those cases code change assumed target defines like SIZEOF_HSINT + * are applied to host platform, not target platform. + * + * So what should be used instead in STAGE=1? + * + * To get host's equivalent of SIZEOF_HSINT you can use Bits instances: + * Data.Bits.finiteBitSize (0 :: Int) + * + * To get target's values it is preferred to use runtime target + * configuration from 'targetPlatform :: DynFlags -> Platform' + * record. A few wrappers are already defined and used throughout GHC: + * wORD_SIZE :: DynFlags -> Int + * wORD_SIZE dflags = pc_WORD_SIZE (sPlatformConstants (settings dflags)) + * + * Hence we hide these macros from -DSTAGE=1 + */ +#if !defined(STAGE) || STAGE >= 2 + /* Sizes of C types come from here... */ #include "ghcautoconf.h" @@ -96,4 +121,6 @@ #define TAG_MASK ((1 << TAG_BITS) - 1) +#endif /* !defined(STAGE) || STAGE >= 2 */ + #endif /* MACHDEPS_H */ From git at git.haskell.org Sun Apr 2 16:02:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 2 Apr 2017 16:02:27 +0000 (UTC) Subject: [commit: ghc] master: Report heap overflow in the same way as stack overflow (61ba451) Message-ID: <20170402160227.9FAA33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/61ba4518a48727f8cd7b821bd41631da82d37425/ghc >--------------------------------------------------------------- commit 61ba4518a48727f8cd7b821bd41631da82d37425 Author: Simon Marlow Date: Sat Apr 1 19:52:40 2017 -0400 Report heap overflow in the same way as stack overflow Now that we throw an exception for heap overflow, we should only print the heap overflow message in the main thread when the HeapOverflow exception is caught, rather than as a side effect in the GC. Stack overflows were already done this way, I just made heap overflow consistent with stack overflow, and did some related cleanup. Fixes broken T2592(profasm) which was reporting the heap overflow message twice (you would only notice when building with profiling libs enabled). Test Plan: validate Reviewers: bgamari, niteria, austin, DemiMarie, hvr, erikd Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3394 >--------------------------------------------------------------- 61ba4518a48727f8cd7b821bd41631da82d37425 includes/Rts.h | 3 ++- libraries/base/GHC/Conc.hs | 2 +- libraries/base/GHC/Conc/Sync.hs | 11 +++++++---- libraries/base/GHC/TopHandler.hs | 5 +++-- rts/RtsSymbols.c | 3 ++- rts/RtsUtils.c | 20 ++++++-------------- rts/RtsUtils.h | 2 -- rts/sm/CNF.c | 4 ++-- rts/sm/GC.c | 11 +++++++++++ rts/sm/Storage.c | 2 +- testsuite/tests/rts/T1791/T1791.stderr | 3 --- 11 files changed, 35 insertions(+), 31 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 61ba4518a48727f8cd7b821bd41631da82d37425 From git at git.haskell.org Sun Apr 2 16:02:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 2 Apr 2017 16:02:30 +0000 (UTC) Subject: [commit: ghc] master: :cd affects the iserv process too (dfac365) Message-ID: <20170402160230.E7E973A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/dfac365f69a9380e3c3640b3bfaf9b9157f8d3b9/ghc >--------------------------------------------------------------- commit dfac365f69a9380e3c3640b3bfaf9b9157f8d3b9 Author: Simon Marlow Date: Sun Apr 2 10:43:32 2017 -0400 :cd affects the iserv process too Test Plan: validate Reviewers: angerman, austin, bgamari, erikd Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3395 >--------------------------------------------------------------- dfac365f69a9380e3c3640b3bfaf9b9157f8d3b9 ghc/GHCi/UI.hs | 5 +++++ testsuite/tests/ghci/scripts/GhciCurDir.script | 7 +++++++ testsuite/tests/ghci/scripts/all.T | 1 + 3 files changed, 13 insertions(+) diff --git a/ghc/GHCi/UI.hs b/ghc/GHCi/UI.hs index 71be20c..deee24a 100644 --- a/ghc/GHCi/UI.hs +++ b/ghc/GHCi/UI.hs @@ -1409,6 +1409,11 @@ changeDirectory dir = do GHC.workingDirectoryChanged dir' <- expandPath dir liftIO $ setCurrentDirectory dir' + dflags <- getDynFlags + -- With -fexternal-interpreter, we have to change the directory of the subprocess too. + -- (this gives consistent behaviour with and without -fexternal-interpreter) + when (gopt Opt_ExternalInterpreter dflags) $ + lift $ enqueueCommands ["System.Directory.setCurrentDirectory " ++ show dir'] trySuccess :: GHC.GhcMonad m => m SuccessFlag -> m SuccessFlag trySuccess act = diff --git a/testsuite/tests/ghci/scripts/GhciCurDir.script b/testsuite/tests/ghci/scripts/GhciCurDir.script new file mode 100644 index 0000000..785a773 --- /dev/null +++ b/testsuite/tests/ghci/scripts/GhciCurDir.script @@ -0,0 +1,7 @@ +import System.Directory +import Control.Monad + +createDirectory "test" +createDirectory "test/test1" +:cd test +unless ("test1" `elem` getDirectoryContents ".") $ putStrLn "Uh oh." diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T index 00d8d81..cde72e4 100755 --- a/testsuite/tests/ghci/scripts/all.T +++ b/testsuite/tests/ghci/scripts/all.T @@ -251,3 +251,4 @@ test('StaticPtr', normal, ghci_script, ['StaticPtr.script']) test('T13202', normal, ghci_script, ['T13202.script']) test('T13202a', normal, ghci_script, ['T13202a.script']) test('T13466', normal, ghci_script, ['T13466.script']) +test('GhciCurDir', normal, ghci_script, ['GhciCurDir.script']) From git at git.haskell.org Sun Apr 2 16:05:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 2 Apr 2017 16:05:36 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Fix GhciCurDir test (4ed3397) Message-ID: <20170402160536.862C83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4ed33975e85f567dc351a21e2f27f097db15b7c1/ghc >--------------------------------------------------------------- commit 4ed33975e85f567dc351a21e2f27f097db15b7c1 Author: Ben Gamari Date: Sun Apr 2 12:05:09 2017 -0400 testsuite: Fix GhciCurDir test This was horribly, horribly wrong. >--------------------------------------------------------------- 4ed33975e85f567dc351a21e2f27f097db15b7c1 testsuite/tests/ghci/scripts/GhciCurDir.script | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/ghci/scripts/GhciCurDir.script b/testsuite/tests/ghci/scripts/GhciCurDir.script index 785a773..cfeb1a4 100644 --- a/testsuite/tests/ghci/scripts/GhciCurDir.script +++ b/testsuite/tests/ghci/scripts/GhciCurDir.script @@ -4,4 +4,5 @@ import Control.Monad createDirectory "test" createDirectory "test/test1" :cd test -unless ("test1" `elem` getDirectoryContents ".") $ putStrLn "Uh oh." +fs <- getDirectoryContents "." +unless ("test1" `elem` fs) $ putStrLn "Uh oh." From git at git.haskell.org Sun Apr 2 16:48:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 2 Apr 2017 16:48:10 +0000 (UTC) Subject: [commit: ghc] master: Add a perf test for deriving null (d724ce3) Message-ID: <20170402164810.031C83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d724ce3cc96b521393e37f06252c196631fd3439/ghc >--------------------------------------------------------------- commit d724ce3cc96b521393e37f06252c196631fd3439 Author: David Feuer Date: Sun Apr 2 12:44:07 2017 -0400 Add a perf test for deriving null Deriving null even helps for a simple list-like type, presumably because we don't perform the static argument transformation. Adding this test before the null deriving patch should give a proper baseline. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3408 >--------------------------------------------------------------- d724ce3cc96b521393e37f06252c196631fd3439 testsuite/tests/perf/should_run/DeriveNull.hs | 23 ++++++++++++++++++++++ .../tests/perf/should_run/DeriveNull.stdout | 0 testsuite/tests/perf/should_run/all.T | 8 ++++++++ 3 files changed, 31 insertions(+) diff --git a/testsuite/tests/perf/should_run/DeriveNull.hs b/testsuite/tests/perf/should_run/DeriveNull.hs new file mode 100644 index 0000000..cb95b27 --- /dev/null +++ b/testsuite/tests/perf/should_run/DeriveNull.hs @@ -0,0 +1,23 @@ +{-# LANGUAGE DeriveFoldable #-} + +module Main where +import Data.Semigroup + +-- Just a list without any special fusion rules. +data List a = Nil | Cons a (List a) deriving Foldable + +instance Semigroup (List a) where + Nil <> ys = ys + Cons x xs <> ys = Cons x (xs <> ys) + +replicateList :: Int -> a -> List a +replicateList 0 x = Nil +replicateList n x = Cons x (replicateList (n - 1) x) + +newtype ListList a = ListList (List (List a)) deriving Foldable + +long :: Int -> Bool +long n = null $ ListList $ replicateList n Nil <> Cons (Cons () Nil) Nil + +main :: IO () +main = print $ long (10^(6 :: Int)) diff --git a/libraries/base/tests/dynamic003.stdout b/testsuite/tests/perf/should_run/DeriveNull.stdout similarity index 100% copy from libraries/base/tests/dynamic003.stdout copy to testsuite/tests/perf/should_run/DeriveNull.stdout diff --git a/testsuite/tests/perf/should_run/all.T b/testsuite/tests/perf/should_run/all.T index f0a8bec..a70cf38 100644 --- a/testsuite/tests/perf/should_run/all.T +++ b/testsuite/tests/perf/should_run/all.T @@ -526,3 +526,11 @@ test('T13218', only_ways(['normal'])], compile_and_run, ['-O']) + +test('DeriveNull', + [stats_num_field('bytes allocated', + [ (wordsize(64), 152083704, 5) ]), + # 2017-04-02 152083704 w/o derived null + only_ways(['normal'])], + compile_and_run, + ['-O']) From git at git.haskell.org Sun Apr 2 18:39:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 2 Apr 2017 18:39:14 +0000 (UTC) Subject: [commit: ghc] master: Update containers submodule to official 0.5.10.2 (115e7eb) Message-ID: <20170402183914.9ED5F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/115e7ebfaad36327b7b38f112282f6e84d267c88/ghc >--------------------------------------------------------------- commit 115e7ebfaad36327b7b38f112282f6e84d267c88 Author: David Feuer Date: Sun Apr 2 14:39:15 2017 -0400 Update containers submodule to official 0.5.10.2 Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3406 >--------------------------------------------------------------- 115e7ebfaad36327b7b38f112282f6e84d267c88 libraries/containers | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/containers b/libraries/containers index f42e932..6414704 160000 --- a/libraries/containers +++ b/libraries/containers @@ -1 +1 @@ -Subproject commit f42e9321dc1ba5f3bc58101b6dec9beb43a80a0a +Subproject commit 6414704b892a6dc56a1b17e3a530d777b70f56ae From git at git.haskell.org Sun Apr 2 18:42:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 2 Apr 2017 18:42:05 +0000 (UTC) Subject: [commit: packages/array] master: T9220: Only examine type roles (db07d53) Message-ID: <20170402184206.007E13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/array On branch : master Link : http://git.haskell.org/packages/array.git/commitdiff/db07d534feb267d5f81e1301f6a0cb726c4c2ea2 >--------------------------------------------------------------- commit db07d534feb267d5f81e1301f6a0cb726c4c2ea2 Author: Ben Gamari Date: Sun Apr 2 13:02:23 2017 -0400 T9220: Only examine type roles The ghc-8.2 and master branches disagree on the order of the instances. Normalise this difference away. >--------------------------------------------------------------- db07d534feb267d5f81e1301f6a0cb726c4c2ea2 tests/all.T | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/all.T b/tests/all.T index a5f92e7..298f19c 100644 --- a/tests/all.T +++ b/tests/all.T @@ -5,5 +5,5 @@ test('array001', [ ], compile_and_run, ['']) -test('T9220', normal, ghci_script, ['T9220.script']) +test('T9220', filter_stdout_lines('.*type role .*'), ghci_script, ['T9220.script']) test('T229', [exit_code(1)], compile_and_run, ['']) From git at git.haskell.org Sun Apr 2 18:46:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 2 Apr 2017 18:46:17 +0000 (UTC) Subject: [commit: ghc] master: configure.ac: fix NCG support in --target= (cb18447) Message-ID: <20170402184617.2C5B13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cb18447c75e7673d5f57056fbdaa370d11e4c05e/ghc >--------------------------------------------------------------- commit cb18447c75e7673d5f57056fbdaa370d11e4c05e Author: Sergei Trofimovich Date: Sun Apr 2 19:38:23 2017 +0100 configure.ac: fix NCG support in --target= Before this change attempt to build a crosscompiler on registerised platform (--host=x86_64-pc-linux-gnu) targeting UNREG platform failed: $ ./configure --target=ia64-unknown-linux-gnu utils/genapply/../../includes/stg/MachRegs.h:608:2: error: #error Cannot find platform to give register info for The change is to check --target= for NCG availability, not --host=. Signed-off-by: Sergei Trofimovich >--------------------------------------------------------------- cb18447c75e7673d5f57056fbdaa370d11e4c05e configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index c7eac4a..65430bf 100644 --- a/configure.ac +++ b/configure.ac @@ -241,7 +241,7 @@ AC_SUBST(SOLARIS_BROKEN_SHLD) dnl ** Do an unregisterised build? dnl -------------------------------------------------------------- -case "$HostArch" in +case "$TargetArch" in i386|x86_64|powerpc|powerpc64|powerpc64le|arm) UnregisterisedDefault=NO ;; From git at git.haskell.org Sun Apr 2 20:00:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 2 Apr 2017 20:00:25 +0000 (UTC) Subject: [commit: ghc] master: configure.ac: add aarch64 to list of registerised (9110556) Message-ID: <20170402200025.401483A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/911055689eca26c7c2713e251646fa35359acba3/ghc >--------------------------------------------------------------- commit 911055689eca26c7c2713e251646fa35359acba3 Author: Sergei Trofimovich Date: Sun Apr 2 20:56:40 2017 +0100 configure.ac: add aarch64 to list of registerised Similar to 'arm' 'aarch64' has working llvm codegen, no need to fallback to unregisterised buld by default. Signed-off-by: Sergei Trofimovich >--------------------------------------------------------------- 911055689eca26c7c2713e251646fa35359acba3 configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 65430bf..3086e03 100644 --- a/configure.ac +++ b/configure.ac @@ -242,7 +242,7 @@ AC_SUBST(SOLARIS_BROKEN_SHLD) dnl ** Do an unregisterised build? dnl -------------------------------------------------------------- case "$TargetArch" in - i386|x86_64|powerpc|powerpc64|powerpc64le|arm) + i386|x86_64|powerpc|powerpc64|powerpc64le|arm|aarch64) UnregisterisedDefault=NO ;; *) From git at git.haskell.org Sun Apr 2 20:24:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 2 Apr 2017 20:24:37 +0000 (UTC) Subject: [commit: ghc] master: Derive the definition of null (bf5e0ea) Message-ID: <20170402202437.65B703A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/bf5e0eab60a11d494671793740122e381a707c1a/ghc >--------------------------------------------------------------- commit bf5e0eab60a11d494671793740122e381a707c1a Author: David Feuer Date: Sun Apr 2 16:20:20 2017 -0400 Derive the definition of null We can sometimes produce much better code by deriving the definition of `null` rather than using the default. For example, given data SnocList a = Lin | Snoc (SnocList a) a the default definition of `null` will walk the whole list, but of course we can stop as soon as we see `Snoc`. Similarly, if a constructor contains some other `Foldable` type, we want to use its `null` rather than folding over the structure. Partially fixes Trac #13280 Reviewers: austin, bgamari, RyanGlScott Reviewed By: RyanGlScott Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3402 >--------------------------------------------------------------- bf5e0eab60a11d494671793740122e381a707c1a compiler/prelude/PrelNames.hs | 5 +- compiler/typecheck/TcGenFunctor.hs | 132 ++++++++++++++++++++- docs/users_guide/8.4.1-notes.rst | 50 ++++---- docs/users_guide/glasgow_exts.rst | 45 +++++-- .../tests/perf/should_run/DeriveNullTermination.hs | 17 +++ .../should_run/DeriveNullTermination.stdout} | 0 testsuite/tests/perf/should_run/all.T | 7 +- 7 files changed, 216 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 bf5e0eab60a11d494671793740122e381a707c1a From git at git.haskell.org Sun Apr 2 23:49:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 2 Apr 2017 23:49:32 +0000 (UTC) Subject: [commit: ghc] master: Fix recompilation avoidance bug for implementor of hsig. (5fb485a) Message-ID: <20170402234932.849133A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5fb485a3e1e83a1f5c6acf989be292940229e1a4/ghc >--------------------------------------------------------------- commit 5fb485a3e1e83a1f5c6acf989be292940229e1a4 Author: Edward Z. Yang Date: Sat Mar 25 22:50:55 2017 -0700 Fix recompilation avoidance bug for implementor of hsig. Summary: I observed a bug where if I modified the module which implemented an hsig in another package, GHC would not recompile the signature in this situation. The root cause was that we were conflating modules from user imports, and "system" module dependencies (from signature merging and instantiation.) So this patch handles them separately. Signed-off-by: Edward Z. Yang Test Plan: validate Reviewers: simonpj, bgamari, austin Subscribers: rwbarton, thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3381 >--------------------------------------------------------------- 5fb485a3e1e83a1f5c6acf989be292940229e1a4 compiler/deSugar/DsUsage.hs | 19 ++++++++++++----- compiler/iface/MkIface.hs | 10 +++++++-- compiler/main/HscMain.hs | 3 ++- compiler/main/HscTypes.hs | 17 +++++++++++++-- compiler/rename/RnEnv.hs | 2 +- compiler/rename/RnNames.hs | 9 ++++---- compiler/typecheck/TcBackpack.hs | 6 +++--- compiler/typecheck/TcRnExports.hs | 3 ++- .../tests/backpack/cabal/bkpcabal06/.gitignore | 1 + .../cabal/{bkpcabal05 => bkpcabal06}/Makefile | 9 ++++---- .../cabal/{bkpcabal01 => bkpcabal06}/Setup.hs | 0 testsuite/tests/backpack/cabal/bkpcabal06/all.T | 9 ++++++++ .../backpack/cabal/bkpcabal06/bkpcabal06.cabal | 24 ++++++++++++++++++++++ .../backpack/cabal/bkpcabal06/bkpcabal06.stderr | 4 ++++ .../cabal/bkpcabal06/impl/P.hs.in1} | 2 +- .../cabal/bkpcabal06/impl/P.hs.in2} | 1 - .../tests/backpack/cabal/bkpcabal06/sig/P.hsig | 2 ++ 17 files changed, 94 insertions(+), 27 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 5fb485a3e1e83a1f5c6acf989be292940229e1a4 From git at git.haskell.org Sun Apr 2 23:49:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 2 Apr 2017 23:49:35 +0000 (UTC) Subject: [commit: ghc] master: Minor comment updates on CSE. (d4e8ebc) Message-ID: <20170402234935.3D11E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d4e8ebcd04cc210bd15a1fd7677558e8b04b3da8/ghc >--------------------------------------------------------------- commit d4e8ebcd04cc210bd15a1fd7677558e8b04b3da8 Author: Edward Z. Yang Date: Wed Mar 22 19:22:02 2017 -0700 Minor comment updates on CSE. Signed-off-by: Edward Z. Yang >--------------------------------------------------------------- d4e8ebcd04cc210bd15a1fd7677558e8b04b3da8 compiler/simplCore/CSE.hs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/compiler/simplCore/CSE.hs b/compiler/simplCore/CSE.hs index ddc5b88..1495f18 100644 --- a/compiler/simplCore/CSE.hs +++ b/compiler/simplCore/CSE.hs @@ -154,7 +154,7 @@ For example: This is the main reason that addBinding is called with a trivial rhs. * Non-trivial scrutinee - case (f x) of y { pat -> ...let y = f x in ... } + case (f x) of y { pat -> ...let z = f x in ... } By using addBinding we'll add (f x :-> y) to the cs_map, and thereby CSE the inner (f x) to y. @@ -334,6 +334,11 @@ cseBind toplevel env (Rec pairs) do_one env (pr, b1) = cse_bind toplevel env pr b1 +-- | Given a binding of @in_id@ to @in_rhs@, and a fresh name to refer +-- to @in_id@ (@out_id@, created from addBinder or addRecBinders), +-- first try to CSE @in_rhs@, and then add the resulting (possibly CSE'd) +-- binding to the 'CSEnv', so that we attempt to CSE any expressions +-- which are equal to @out_rhs at . cse_bind :: TopLevelFlag -> CSEnv -> (InId, InExpr) -> OutId -> (CSEnv, (OutId, OutExpr)) cse_bind toplevel env (in_id, in_rhs) out_id | isTopLevel toplevel, exprIsLiteralString in_rhs @@ -474,9 +479,11 @@ cseCase env scrut bndr ty alts arg_tys :: [OutType] arg_tys = tyConAppArgs (idType bndr3) + -- Given case x of { K y z -> ...K y z... } + -- CSE K y z into x... cse_alt (DataAlt con, args, rhs) | not (null args) - -- Don't try CSE if there are no args; it just increases the number + -- ... but don't try CSE if there are no args; it just increases the number -- of live vars. E.g. -- case x of { True -> ....True.... } -- Don't replace True by x! @@ -508,7 +515,7 @@ combineAlts _ alts = alts -- Default case {- Note [Combine case alternatives] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ combineAlts is just a more heavyweight version of the use of -combineIdentialAlts in SimplUtils.prepareAlts. The basic idea is +combineIdenticalAlts in SimplUtils.prepareAlts. The basic idea is to transform DEFAULT -> e1 @@ -581,6 +588,9 @@ lookupSubst (CS { cs_subst = sub}) x = lookupIdSubst (text "CSE.lookupSubst") su extendCSSubst :: CSEnv -> Id -> CoreExpr -> CSEnv extendCSSubst cse x rhs = cse { cs_subst = extendSubst (cs_subst cse) x rhs } +-- | Add clones to the substitution to deal with shadowing. See +-- Note [Shadowing] for more details. You should call this whenever +-- you go under a binder. addBinder :: CSEnv -> Var -> (CSEnv, Var) addBinder cse v = (cse { cs_subst = sub' }, v') where From git at git.haskell.org Sun Apr 2 23:49:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 2 Apr 2017 23:49:37 +0000 (UTC) Subject: [commit: ghc] master: mk/boilerplate.mk defines STAGE1_GHC, not GHC_STAGE1. (5db4155) Message-ID: <20170402234937.EE9983A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5db415580e0738f934e35b7012fe35a79b7e97c7/ghc >--------------------------------------------------------------- commit 5db415580e0738f934e35b7012fe35a79b7e97c7 Author: Edward Z. Yang Date: Sun Mar 26 14:40:29 2017 -0700 mk/boilerplate.mk defines STAGE1_GHC, not GHC_STAGE1. Signed-off-by: Edward Z. Yang >--------------------------------------------------------------- 5db415580e0738f934e35b7012fe35a79b7e97c7 testsuite/timeout/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/timeout/Makefile b/testsuite/timeout/Makefile index b910a73..9626eae 100644 --- a/testsuite/timeout/Makefile +++ b/testsuite/timeout/Makefile @@ -51,7 +51,7 @@ boot all :: calibrate.out $(TIMEOUT_PROGRAM) calibrate.out: $(RM) -f TimeMe.o TimeMe.hi TimeMe TimeMe.exe - $(PYTHON) calibrate '$(GHC_STAGE1)' > $@ + $(PYTHON) calibrate '$(STAGE1_GHC)' > $@ # We use stage 1 to do the calibration, as stage 2 may not exist. # This isn't necessarily the compiler we'll be running the testsuite # with, but it's really the performance of the machine that we're From git at git.haskell.org Sun Apr 2 23:49:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 2 Apr 2017 23:49:40 +0000 (UTC) Subject: [commit: ghc] master: Extra docs on exports_from_avail. (71dadd7) Message-ID: <20170402234940.AB6883A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/71dadd71e7bb397a05b45c45d679139b08f76598/ghc >--------------------------------------------------------------- commit 71dadd71e7bb397a05b45c45d679139b08f76598 Author: Edward Z. Yang Date: Tue Mar 28 10:20:19 2017 -0700 Extra docs on exports_from_avail. Signed-off-by: Edward Z. Yang >--------------------------------------------------------------- 71dadd71e7bb397a05b45c45d679139b08f76598 compiler/typecheck/TcRnExports.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compiler/typecheck/TcRnExports.hs b/compiler/typecheck/TcRnExports.hs index 35e30a7..3c0b8d3 100644 --- a/compiler/typecheck/TcRnExports.hs +++ b/compiler/typecheck/TcRnExports.hs @@ -164,6 +164,9 @@ exports_from_avail :: Maybe (Located [LIE RdrName]) -- Nothing => no explicit export list -> GlobalRdrEnv -> ImportAvails + -- Imported modules; this is used to test if a + -- 'module Foo' export is valid (it's not valid + -- if we didn't import Foo!) -> Module -> RnM (Maybe [LIE Name], [AvailInfo]) From git at git.haskell.org Sun Apr 2 23:49:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 2 Apr 2017 23:49:43 +0000 (UTC) Subject: [commit: ghc] master: Add more documentation on mergeSignatures. (d2df718) Message-ID: <20170402234943.685223A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d2df718cfb9d55faafccf660e06c844418ed642b/ghc >--------------------------------------------------------------- commit d2df718cfb9d55faafccf660e06c844418ed642b Author: Edward Z. Yang Date: Mon Mar 27 20:00:53 2017 -0700 Add more documentation on mergeSignatures. Signed-off-by: Edward Z. Yang >--------------------------------------------------------------- d2df718cfb9d55faafccf660e06c844418ed642b compiler/typecheck/TcBackpack.hs | 98 ++++++++++++++++++++++++++++++++-------- 1 file changed, 80 insertions(+), 18 deletions(-) diff --git a/compiler/typecheck/TcBackpack.hs b/compiler/typecheck/TcBackpack.hs index 72c8652..2cc7424 100644 --- a/compiler/typecheck/TcBackpack.hs +++ b/compiler/typecheck/TcBackpack.hs @@ -555,37 +555,99 @@ mergeSignatures -- gen_subst (nsubst,oks,ifaces) (imod@(IndefModule iuid _), ireq_iface) = do let insts = indefUnitIdInsts iuid + isFromSignaturePackage = + let inst_uid = fst (splitUnitIdInsts (IndefiniteUnitId iuid)) + pkg = getInstalledPackageDetails dflags inst_uid + in null (exposedModules pkg) + -- 3(a). Rename the exports according to how the dependency + -- was instantiated. The resulting export list will be accurate + -- except for exports *from the signature itself* (which may + -- be subsequently updated by exports from other signatures in + -- the merge. as1 <- tcRnModExports insts ireq_iface - let inst_uid = fst (splitUnitIdInsts (IndefiniteUnitId iuid)) - pkg = getInstalledPackageDetails dflags inst_uid - -- Setup the import spec correctly, so that when we apply - -- IEModuleContents we pick up EVERYTHING - ispec = ImpSpec - ImpDeclSpec{ - is_mod = mod_name, - is_as = mod_name, - is_qual = False, - is_dloc = loc - } ImpAll - rdr_env = mkGlobalRdrEnv (gresFromAvails (Just ispec) as1) + -- 3(b). Thin the interface if it comes from a signature package. (thinned_iface, as2) <- case mb_exports of Just (L loc _) - | null (exposedModules pkg) -> setSrcSpan loc $ do - -- Suppress missing errors; we'll pick em up - -- when we test exports on the final thing - (msgs, mb_r) <- tryTc $ + -- Check if the package containing this signature is + -- a signature package (i.e., does not expose any + -- modules.) If so, we can thin it. + | isFromSignaturePackage + -> setSrcSpan loc $ do + -- Suppress missing errors; they might be used to refer + -- to entities from other signatures we are merging in. + -- If an identifier truly doesn't exist in any of the + -- signatures that are merged in, we will discover this + -- when we run exports_from_avail on the final merged + -- export list. + (msgs, mb_r) <- tryTc $ do + -- Suppose that we have written in a signature: + -- signature A ( module A ) where {- empty -} + -- If I am also inheriting a signature from a + -- signature package, does 'module A' scope over + -- all of its exports? + -- + -- There are two possible interpretations: + -- + -- 1. For non self-reexports, a module reexport + -- is interpreted only in terms of the local + -- signature module, and not any of the inherited + -- ones. The reason for this is because after + -- typechecking, module exports are completely + -- erased from the interface of a file, so we + -- have no way of "interpreting" a module reexport. + -- Thus, it's only useful for the local signature + -- module (where we have a useful GlobalRdrEnv.) + -- + -- 2. On the other hand, a common idiom when + -- you want to "export everything, plus a reexport" + -- in modules is to say module A ( module A, reex ). + -- This applies to signature modules too; and in + -- particular, you probably still want the entities + -- from the inherited signatures to be preserved + -- too. + -- + -- We think it's worth making a special case for + -- self reexports to make use case (2) work. To + -- do this, we take the exports of the inherited + -- signature @as1@, and bundle them into a + -- GlobalRdrEnv where we treat them as having come + -- from the import @import A at . Thus, we will + -- pick them up if they are referenced explicitly + -- (@foo@) or even if we do a module reexport + -- (@module A@). + let ispec = ImpSpec ImpDeclSpec{ + -- NB: This needs to be mod name + -- of the local signature, not + -- the (original) module name of + -- the inherited signature, + -- because we need module + -- LocalSig (from the local + -- export list) to match it! + is_mod = mod_name, + is_as = mod_name, + is_qual = False, + is_dloc = loc + } ImpAll + rdr_env = mkGlobalRdrEnv (gresFromAvails (Just ispec) as1) setGblEnv tcg_env { tcg_rdr_env = rdr_env } $ exports_from_avail mb_exports rdr_env - (tcg_imports tcg_env) (tcg_semantic_mod tcg_env) + -- NB: tcg_imports is also empty! + emptyImportAvails + (tcg_semantic_mod tcg_env) case mb_r of Just (_, as2) -> return (thinModIface as2 ireq_iface, as2) Nothing -> addMessages msgs >> failM + -- We can't think signatures from non signature packages _ -> return (ireq_iface, as1) - let oks' | null (exposedModules pkg) + -- 3(c). Only identifiers from signature packages are "ok" to + -- import (that is, they are safe from a PVP perspective.) + -- (NB: This code is actually dead right now.) + let oks' | isFromSignaturePackage = extendOccSetList oks (exportOccs as2) | otherwise = oks + -- 3(d). Extend the name substitution (performing shaping) mb_r <- extend_ns nsubst as2 case mb_r of Left err -> failWithTc err From git at git.haskell.org Sun Apr 2 23:49:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 2 Apr 2017 23:49:46 +0000 (UTC) Subject: [commit: ghc] master: Extra docs on tcg_imports. (0c333c8) Message-ID: <20170402234946.260B53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0c333c89ffce5c271d3123e612c7ae22a810649e/ghc >--------------------------------------------------------------- commit 0c333c89ffce5c271d3123e612c7ae22a810649e Author: Edward Z. Yang Date: Tue Mar 28 10:20:44 2017 -0700 Extra docs on tcg_imports. Signed-off-by: Edward Z. Yang >--------------------------------------------------------------- 0c333c89ffce5c271d3123e612c7ae22a810649e compiler/typecheck/TcRnTypes.hs | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/compiler/typecheck/TcRnTypes.hs b/compiler/typecheck/TcRnTypes.hs index b644334..90423e4 100644 --- a/compiler/typecheck/TcRnTypes.hs +++ b/compiler/typecheck/TcRnTypes.hs @@ -531,7 +531,31 @@ data TcGblEnv tcg_imports :: ImportAvails, -- ^ Information about what was imported from where, including -- things bound in this module. Also store Safe Haskell info - -- here about transative trusted packaage requirements. + -- here about transitive trusted package requirements. + -- + -- There are not many uses of this field, so you can grep for + -- all them. + -- + -- The ImportAvails records information about the following + -- things: + -- + -- 1. All of the modules you directly imported (tcRnImports) + -- 2. The orphans (only!) of all imported modules in a GHCi + -- session (runTcInteractive) + -- 3. The module that instantiated a signature + -- 4. Each of the signatures that merged in + -- + -- It is used in the following ways: + -- - imp_orphs is used to determine what orphan modules should be + -- visible in the context (tcVisibleOrphanMods) + -- - imp_finsts is used to determine what family instances should + -- be visible (tcExtendLocalFamInstEnv) + -- - To resolve the meaning of the export list of a module + -- (tcRnExports) + -- - imp_mods is used to compute usage info (mkIfaceTc, deSugar) + -- - imp_trust_own_pkg is used for Safe Haskell in interfaces + -- (mkIfaceTc, as well as in HscMain) + -- - To create the Dependencies field in interface (mkDependencies) tcg_dus :: DefUses, -- ^ What is defined in this module and what is used. tcg_used_gres :: TcRef [GlobalRdrElt], -- ^ Records occurrences of imported entities From git at git.haskell.org Sun Apr 2 23:49:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 2 Apr 2017 23:49:49 +0000 (UTC) Subject: [commit: ghc] master: Better test coverage for module reexports in signatures. (45d33f3) Message-ID: <20170402234949.8F94E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/45d33f35f689192fd74c9954d782e4cee04acfc8/ghc >--------------------------------------------------------------- commit 45d33f35f689192fd74c9954d782e4cee04acfc8 Author: Edward Z. Yang Date: Tue Mar 28 10:21:15 2017 -0700 Better test coverage for module reexports in signatures. Signed-off-by: Edward Z. Yang >--------------------------------------------------------------- 45d33f35f689192fd74c9954d782e4cee04acfc8 testsuite/tests/backpack/should_compile/all.T | 2 ++ testsuite/tests/backpack/should_compile/bkp54.bkp | 11 +++++++++++ testsuite/tests/backpack/should_compile/bkp54.stderr | 5 +++++ testsuite/tests/backpack/should_compile/bkp55.bkp | 11 +++++++++++ .../bkpreex09.stderr => should_compile/bkp55.stderr} | 2 +- testsuite/tests/backpack/should_fail/all.T | 2 ++ testsuite/tests/backpack/should_fail/bkpfail48.bkp | 7 +++++++ .../should_fail/{bkpfail33.stderr => bkpfail48.stderr} | 12 ++++++------ testsuite/tests/backpack/should_fail/bkpfail49.bkp | 11 +++++++++++ .../bkpreex09.stderr => should_fail/bkpfail49.stderr} | 4 ++++ 10 files changed, 60 insertions(+), 7 deletions(-) diff --git a/testsuite/tests/backpack/should_compile/all.T b/testsuite/tests/backpack/should_compile/all.T index 477c0fe..da6ea5f 100644 --- a/testsuite/tests/backpack/should_compile/all.T +++ b/testsuite/tests/backpack/should_compile/all.T @@ -45,6 +45,8 @@ test('bkp50', normal, backpack_compile, ['']) test('bkp51', normal, backpack_compile, ['']) test('bkp52', normal, backpack_compile, ['']) test('bkp53', normal, backpack_compile, ['']) +test('bkp54', normal, backpack_compile, ['']) +test('bkp55', normal, backpack_compile, ['']) test('T13140', normal, backpack_compile, ['']) test('T13149', expect_broken(13149), backpack_compile, ['']) diff --git a/testsuite/tests/backpack/should_compile/bkp54.bkp b/testsuite/tests/backpack/should_compile/bkp54.bkp new file mode 100644 index 0000000..6cf1270 --- /dev/null +++ b/testsuite/tests/backpack/should_compile/bkp54.bkp @@ -0,0 +1,11 @@ +unit q where + signature A (module N) where + import qualified Data.Bool as N +unit p where + dependency signature q[A=] + signature A (module A, module Data.Word) where + import Data.Word + module M where + import qualified A + x = A.otherwise + type T = A.Word diff --git a/testsuite/tests/backpack/should_compile/bkp54.stderr b/testsuite/tests/backpack/should_compile/bkp54.stderr new file mode 100644 index 0000000..f3aafc1 --- /dev/null +++ b/testsuite/tests/backpack/should_compile/bkp54.stderr @@ -0,0 +1,5 @@ +[1 of 2] Processing q + [1 of 1] Compiling A[sig] ( q/A.hsig, nothing ) +[2 of 2] Processing p + [1 of 2] Compiling A[sig] ( p/A.hsig, nothing ) + [2 of 2] Compiling M ( p/M.hs, nothing ) diff --git a/testsuite/tests/backpack/should_compile/bkp55.bkp b/testsuite/tests/backpack/should_compile/bkp55.bkp new file mode 100644 index 0000000..d9c7370 --- /dev/null +++ b/testsuite/tests/backpack/should_compile/bkp55.bkp @@ -0,0 +1,11 @@ +unit p where + signature A where + p :: Int + +unit q where + dependency signature p[A=] + signature B (module B) where + q :: Int + module M where + import B + f = p + q diff --git a/testsuite/tests/backpack/reexport/bkpreex09.stderr b/testsuite/tests/backpack/should_compile/bkp55.stderr similarity index 72% copy from testsuite/tests/backpack/reexport/bkpreex09.stderr copy to testsuite/tests/backpack/should_compile/bkp55.stderr index d4bedc3..9213c9c 100644 --- a/testsuite/tests/backpack/reexport/bkpreex09.stderr +++ b/testsuite/tests/backpack/should_compile/bkp55.stderr @@ -1,5 +1,5 @@ [1 of 2] Processing p [1 of 1] Compiling A[sig] ( p/A.hsig, nothing ) [2 of 2] Processing q - [1 of 2] Compiling A[sig] ( q/A.hsig, nothing ) + [1 of 2] Compiling B[sig] ( q/B.hsig, nothing ) [2 of 2] Compiling M ( q/M.hs, nothing ) diff --git a/testsuite/tests/backpack/should_fail/all.T b/testsuite/tests/backpack/should_fail/all.T index e1416fc..856733e 100644 --- a/testsuite/tests/backpack/should_fail/all.T +++ b/testsuite/tests/backpack/should_fail/all.T @@ -43,3 +43,5 @@ test('bkpfail44', normal, backpack_compile_fail, ['']) test('bkpfail45', normal, backpack_compile_fail, ['']) test('bkpfail46', normal, backpack_compile_fail, ['']) test('bkpfail47', normal, backpack_compile_fail, ['']) +test('bkpfail48', normal, backpack_compile_fail, ['']) +test('bkpfail49', normal, backpack_compile_fail, ['']) diff --git a/testsuite/tests/backpack/should_fail/bkpfail48.bkp b/testsuite/tests/backpack/should_fail/bkpfail48.bkp new file mode 100644 index 0000000..e66100d --- /dev/null +++ b/testsuite/tests/backpack/should_fail/bkpfail48.bkp @@ -0,0 +1,7 @@ +unit q where + signature A (module Data.Bool) where + import Data.Bool +unit p where + dependency signature q[A=] + signature A (module Data.Bool) where + -- This should not work: module is mandatory diff --git a/testsuite/tests/backpack/should_fail/bkpfail33.stderr b/testsuite/tests/backpack/should_fail/bkpfail48.stderr similarity index 57% copy from testsuite/tests/backpack/should_fail/bkpfail33.stderr copy to testsuite/tests/backpack/should_fail/bkpfail48.stderr index 4da8897..9c991d6 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail33.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail48.stderr @@ -1,10 +1,10 @@ -[1 of 2] Processing p - [1 of 1] Compiling A[sig] ( p/A.hsig, nothing ) -[2 of 2] Processing q +[1 of 2] Processing q [1 of 1] Compiling A[sig] ( q/A.hsig, nothing ) +[2 of 2] Processing p + [1 of 1] Compiling A[sig] ( p/A.hsig, nothing ) -bkpfail33.bkp:5:18: error: - • Not in scope: type constructor or class ‘T’ +bkpfail48.bkp:6:18: error: + • The export item `module Data.Bool' is not imported • while merging the signatures from: - • p[A=]:A + • q[A=]:A • ...and the local signature for A diff --git a/testsuite/tests/backpack/should_fail/bkpfail49.bkp b/testsuite/tests/backpack/should_fail/bkpfail49.bkp new file mode 100644 index 0000000..a30a1f8 --- /dev/null +++ b/testsuite/tests/backpack/should_fail/bkpfail49.bkp @@ -0,0 +1,11 @@ +unit p where + signature A (module Data.Bool) where + import Data.Bool + +unit q where + dependency signature p[A=] + signature A (module Data.Bool) where + import Data.Bool () + module M where + import qualified A + x = A.True -- should not exist! diff --git a/testsuite/tests/backpack/reexport/bkpreex09.stderr b/testsuite/tests/backpack/should_fail/bkpfail49.stderr similarity index 64% copy from testsuite/tests/backpack/reexport/bkpreex09.stderr copy to testsuite/tests/backpack/should_fail/bkpfail49.stderr index d4bedc3..c2236e5 100644 --- a/testsuite/tests/backpack/reexport/bkpreex09.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail49.stderr @@ -3,3 +3,7 @@ [2 of 2] Processing q [1 of 2] Compiling A[sig] ( q/A.hsig, nothing ) [2 of 2] Compiling M ( q/M.hs, nothing ) + +bkpfail49.bkp:11:13: error: + Not in scope: data constructor ‘A.True’ + Module ‘A’ does not export ‘True’. From git at git.haskell.org Sun Apr 2 23:49:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 2 Apr 2017 23:49:53 +0000 (UTC) Subject: [commit: ghc] master: Correctly handle wired in unit IDs in -instantiated-with (852a43f) Message-ID: <20170402234953.762703A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/852a43f360af09416d15777c8f10d704b5423a96/ghc >--------------------------------------------------------------- commit 852a43f360af09416d15777c8f10d704b5423a96 Author: Edward Z. Yang Date: Sun Mar 26 14:06:12 2017 -0700 Correctly handle wired in unit IDs in -instantiated-with Summary: To handle wired in packages, we must rewrite all occurrences of unit ids like base-4.9.0.0 to base. However, I forgot to do this on unit ids that occurred in unit identifiers passed via -instantiated-with. This patch handles that case, plus a test. Signed-off-by: Edward Z. Yang Test Plan: validate Reviewers: bgamari, austin Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3385 >--------------------------------------------------------------- 852a43f360af09416d15777c8f10d704b5423a96 compiler/main/Packages.hs | 54 ++++++++++++++-------- testsuite/tests/backpack/cabal/bkpcabal07/M.hs | 1 + .../cabal/{bkpcabal04 => bkpcabal07}/Makefile | 17 ++----- .../cabal/{bkpcabal06/sig => bkpcabal07}/P.hsig | 1 - .../cabal/{bkpcabal01 => bkpcabal07}/Setup.hs | 0 testsuite/tests/backpack/cabal/bkpcabal07/all.T | 9 ++++ .../bkpcabal07.cabal} | 15 ++---- 7 files changed, 54 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 852a43f360af09416d15777c8f10d704b5423a96 From git at git.haskell.org Mon Apr 3 01:13:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 3 Apr 2017 01:13:22 +0000 (UTC) Subject: [commit: ghc] master: array: Clear up inconsistency in T9220 output (60307cb) Message-ID: <20170403011322.C052F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/60307cb85abc8d53845598a430c0ee9264fb2d82/ghc >--------------------------------------------------------------- commit 60307cb85abc8d53845598a430c0ee9264fb2d82 Author: Ben Gamari Date: Sun Apr 2 13:04:26 2017 -0400 array: Clear up inconsistency in T9220 output ghc-8.2 and master disagreed on the order of the instances. Normalise this difference away. Updates array submodule. >--------------------------------------------------------------- 60307cb85abc8d53845598a430c0ee9264fb2d82 libraries/array | 2 +- testsuite/driver/testlib.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/libraries/array b/libraries/array index fc82074..db07d53 160000 --- a/libraries/array +++ b/libraries/array @@ -1 +1 @@ -Subproject commit fc82074a9076d650610d71a966d8714f5217257f +Subproject commit db07d534feb267d5f81e1301f6a0cb726c4c2ea2 diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index 7dedb33..a5da1e9 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -493,6 +493,13 @@ def no_check_hp(name, opts): # ---- +def filter_stdout_lines( regex ): + """ Filter lines of stdout with the given regular expression """ + import re + def f( name, opts ): + _normalise_fun(name, opts, lambda s: '\n'.join(re.findall(regex, s))) + return f + def normalise_slashes( name, opts ): _normalise_fun(name, opts, normalise_slashes_) From git at git.haskell.org Mon Apr 3 01:13:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 3 Apr 2017 01:13:25 +0000 (UTC) Subject: [commit: ghc] master: rts: Make out-of-memory errors more consistent (2301176) Message-ID: <20170403011325.7F6F83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/23011765244fe5a3c4583033e019a537278a45a9/ghc >--------------------------------------------------------------- commit 23011765244fe5a3c4583033e019a537278a45a9 Author: Ben Gamari Date: Sun Apr 2 19:15:45 2017 -0400 rts: Make out-of-memory errors more consistent This will make it a bit easier to maintain consistent output in the testsuite. >--------------------------------------------------------------- 23011765244fe5a3c4583033e019a537278a45a9 rts/hooks/OutOfHeap.c | 2 +- rts/win32/OSMem.c | 2 +- testsuite/tests/rts/overflow1.stderr | 2 +- testsuite/tests/rts/overflow2.stderr | 2 +- testsuite/tests/rts/overflow3.stderr | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rts/hooks/OutOfHeap.c b/rts/hooks/OutOfHeap.c index 3058cdd..20d9809 100644 --- a/rts/hooks/OutOfHeap.c +++ b/rts/hooks/OutOfHeap.c @@ -31,6 +31,6 @@ OutOfHeapHook (W_ request_size, W_ heap_size) /* both sizes in bytes */ } } else { - errorBelch("Out of memory.\n"); + errorBelch("Out of memory\n"); } } diff --git a/rts/win32/OSMem.c b/rts/win32/OSMem.c index 2a54235..ad72ffb 100644 --- a/rts/win32/OSMem.c +++ b/rts/win32/OSMem.c @@ -74,7 +74,7 @@ allocNew(uint32_t n) { rec=0; if (GetLastError() == ERROR_NOT_ENOUGH_MEMORY) { - errorBelch("Out of memory"); + errorBelch("Out of memory\n"); stg_exit(EXIT_HEAPOVERFLOW); } else { sysErrorBelch( diff --git a/testsuite/tests/rts/overflow1.stderr b/testsuite/tests/rts/overflow1.stderr index 77ef3ac..05ec796 100644 --- a/testsuite/tests/rts/overflow1.stderr +++ b/testsuite/tests/rts/overflow1.stderr @@ -1,2 +1,2 @@ -overflow1: Out of memory. +overflow1: Out of memory diff --git a/testsuite/tests/rts/overflow2.stderr b/testsuite/tests/rts/overflow2.stderr index 0e57a8e..9f6cb3b 100644 --- a/testsuite/tests/rts/overflow2.stderr +++ b/testsuite/tests/rts/overflow2.stderr @@ -1,2 +1,2 @@ -overflow2: Out of memory. +overflow2: Out of memory diff --git a/testsuite/tests/rts/overflow3.stderr b/testsuite/tests/rts/overflow3.stderr index aec2225..0526169 100644 --- a/testsuite/tests/rts/overflow3.stderr +++ b/testsuite/tests/rts/overflow3.stderr @@ -1,2 +1,2 @@ -overflow3: Out of memory. +overflow3: Out of memory From git at git.haskell.org Mon Apr 3 01:13:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 3 Apr 2017 01:13:31 +0000 (UTC) Subject: [commit: ghc] master: Various testsuite fixes for 32-bit Windows (f8ecc58) Message-ID: <20170403011331.5E8883A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f8ecc5847285d68055c3340ee4b4bb4a3052b966/ghc >--------------------------------------------------------------- commit f8ecc5847285d68055c3340ee4b4bb4a3052b966 Author: Ben Gamari Date: Sun Apr 2 17:10:48 2017 -0400 Various testsuite fixes for 32-bit Windows >--------------------------------------------------------------- f8ecc5847285d68055c3340ee4b4bb4a3052b966 testsuite/tests/perf/haddock/all.T | 6 ++++-- testsuite/tests/perf/should_run/all.T | 10 ++++++---- ...ngw32 => T11223_link_order_a_b_2_fail.stderr-ws-32-mingw32} | 4 ++-- ...ngw32 => T11223_link_order_a_b_2_fail.stderr-ws-64-mingw32} | 0 ...ingw32 => T11223_simple_duplicate_lib.stderr-ws-32-mingw32} | 4 ++-- ...ingw32 => T11223_simple_duplicate_lib.stderr-ws-64-mingw32} | 0 testsuite/tests/rts/T11223/all.T | 1 + testsuite/tests/rts/T7037_main.c | 2 +- 8 files changed, 16 insertions(+), 11 deletions(-) diff --git a/testsuite/tests/perf/haddock/all.T b/testsuite/tests/perf/haddock/all.T index 65e1644..4de07f4 100644 --- a/testsuite/tests/perf/haddock/all.T +++ b/testsuite/tests/perf/haddock/all.T @@ -40,12 +40,13 @@ test('haddock.base', # 2017-02-17: 38425793776 (x86_64/Linux) - Generalize kind of (->) # 2017-02-12: 25592972912 (x86_64/Linux) - Type-indexed Typeable - ,(platform('i386-unknown-mingw32'), 4434804940, 5) + ,(platform('i386-unknown-mingw32'), 2885173512, 5) # 2013-02-10: 3358693084 (x86/Windows) # 2013-11-13: 3097751052 (x86/Windows, 64bit machine) # 2014-04-04: 3548581572 (x86/Windows, 64bit machine) # 2014-12-01: 4202377432 (x86/Windows, 64bit machine) # 2015-01-20: 4434804940 (x86/Windows, 64bit machine) + # 2017-04-02: 2885173512 update ,(wordsize(32), 3819657568, 5)]) # 2012-08-14: 3046487920 (x86/OSX) @@ -150,12 +151,13 @@ test('haddock.compiler', # 2017-02-11: 62070477608 (amd64/Linux) OccurAnal / One-Shot (#13227) (and others) # 2017-02-25: 55777283352 (amd64/Linux) Early inline patch - ,(platform('i386-unknown-mingw32'), 902576468, 10) + ,(platform('i386-unknown-mingw32'), 367546388, 10) # 2012-10-30: 13773051312 (x86/Windows) # 2013-02-10: 14925262356 (x86/Windows) # 2013-11-13: 14328363592 (x86/Windows, 64bit machine) # 2014-12-01: 104140852 (x86/Windows, sudden shrinkage!) # 2014-12-10: 217933548 increased again + # 2017-04-02: 367546388 update ,(wordsize(32), 118738876, 5)]) # 2012-08-14: 13471797488 (x86/OSX) diff --git a/testsuite/tests/perf/should_run/all.T b/testsuite/tests/perf/should_run/all.T index 49a6656..0451348 100644 --- a/testsuite/tests/perf/should_run/all.T +++ b/testsuite/tests/perf/should_run/all.T @@ -111,6 +111,7 @@ test('T876', [(platform('x86_64-unknown-mingw32'), 66928, 5), # 2015-04-03: 71904 (amd64/Windows, unknown cause) # 2016-11-27: 66928 (amd64/Windows, unknown cause) + (wordsize(64), 58128, 5), # 2013-02-14: 1263712 (x86_64/Linux) # 2014-02-10: 63216 (x86_64/Linux), call arity analysis @@ -344,10 +345,11 @@ test('T7436', # 127000 (amd64/Linux) # 2013-02-07: 60360 (amd64/Linux) # 2015-04-03: Widen 1->4% (amd64/Windows was doing better) - (wordsize(32), 42772, 1)]), - # 2013-02-10: 58032 (x86/Windows) - # 2013-02-10: 58836 (x86/OSX) - # 2017-03-24: 42772 (x86/Linux, 64-bit machine) no idea why + (wordsize(32), 42772, 4)]), + # 2013-02-10: 58032 (x86/Windows) + # 2013-02-10: 58836 (x86/OSX) + # 2017-03-24: 42772 (x86/Linux, 64-bit machine) no idea why + # 2017-04-02: Widen 1->4% (i386/Windows was doing better) only_ways(['normal']) ], compile_and_run, 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-ws-32-mingw32 similarity index 92% copy from testsuite/tests/rts/T11223/T11223_link_order_a_b_2_fail.stderr-mingw32 copy to testsuite/tests/rts/T11223/T11223_link_order_a_b_2_fail.stderr-ws-32-mingw32 index 1fea3e2..73d736c 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-ws-32-mingw32 @@ -1,5 +1,5 @@ GHC runtime linker: fatal error: I found a duplicate definition for symbol - a + _a whilst processing object file 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 @@ -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.exe: ^^ Could not load 'c', dependency unresolved. See top entry above. +ghc-stage2.exe: ^^ 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-ws-64-mingw32 similarity index 100% rename from testsuite/tests/rts/T11223/T11223_link_order_a_b_2_fail.stderr-mingw32 rename to testsuite/tests/rts/T11223/T11223_link_order_a_b_2_fail.stderr-ws-64-mingw32 diff --git a/testsuite/tests/rts/T11223/T11223_simple_duplicate_lib.stderr-mingw32 b/testsuite/tests/rts/T11223/T11223_simple_duplicate_lib.stderr-ws-32-mingw32 similarity index 92% copy from testsuite/tests/rts/T11223/T11223_simple_duplicate_lib.stderr-mingw32 copy to testsuite/tests/rts/T11223/T11223_simple_duplicate_lib.stderr-ws-32-mingw32 index 4d4656f..48245cc 100644 --- a/testsuite/tests/rts/T11223/T11223_simple_duplicate_lib.stderr-mingw32 +++ b/testsuite/tests/rts/T11223/T11223_simple_duplicate_lib.stderr-ws-32-mingw32 @@ -1,5 +1,5 @@ GHC runtime linker: fatal error: I found a duplicate definition for symbol - a + _a whilst processing object file 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 @@ -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.exe: ^^ Could not load 'c', dependency unresolved. See top entry above. +ghc-stage2.exe: ^^ 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-ws-64-mingw32 similarity index 100% rename from testsuite/tests/rts/T11223/T11223_simple_duplicate_lib.stderr-mingw32 rename to testsuite/tests/rts/T11223/T11223_simple_duplicate_lib.stderr-ws-64-mingw32 diff --git a/testsuite/tests/rts/T11223/all.T b/testsuite/tests/rts/T11223/all.T index 0a578c0..6656e7f 100644 --- a/testsuite/tests/rts/T11223/all.T +++ b/testsuite/tests/rts/T11223/all.T @@ -34,6 +34,7 @@ test('T11223_simple_duplicate', test('T11223_simple_duplicate_lib', [extra_files(['bar.c', 'foo.c', 'foo.hs']), + when(platform('i386-unknown-mingw32'), expect_broken(13515)), when(ghc_dynamic(), skip), normalise_errmsg_fun(normalise_duplicate_errmsg)], run_command, ['$MAKE -s --no-print-directory t_11223_simple_duplicate_lib']) diff --git a/testsuite/tests/rts/T7037_main.c b/testsuite/tests/rts/T7037_main.c index ce7fa65..b85b98e 100644 --- a/testsuite/tests/rts/T7037_main.c +++ b/testsuite/tests/rts/T7037_main.c @@ -2,6 +2,6 @@ #include int main(int argc, char *argv[]) { - T7037_CONST char * args[2] = {"T7037", NULL}; + char * T7037_CONST args[2] = {"T7037", NULL}; execv("./T7037", args); } From git at git.haskell.org Mon Apr 3 01:13:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 3 Apr 2017 01:13:28 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Classify missing expected perf numbers as merely warnings (597ea1c) Message-ID: <20170403011328.3909F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/597ea1cdca4c127a0a9ad936645c416df80a907b/ghc >--------------------------------------------------------------- commit 597ea1cdca4c127a0a9ad936645c416df80a907b Author: Ben Gamari Date: Sun Apr 2 17:20:34 2017 -0400 testsuite: Classify missing expected perf numbers as merely warnings Previously these were considered to be framework failures, meaning that validate would fail. For better or worse, Windows lacks a good number of metrics and I don't see this changing any time soon. Let's consider these to be non-fatal. >--------------------------------------------------------------- 597ea1cdca4c127a0a9ad936645c416df80a907b testsuite/driver/testglobals.py | 1 + testsuite/driver/testlib.py | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/testsuite/driver/testglobals.py b/testsuite/driver/testglobals.py index 9f37e1a..fc050e6 100644 --- a/testsuite/driver/testglobals.py +++ b/testsuite/driver/testglobals.py @@ -138,6 +138,7 @@ class TestRun: self.missing_libs = [] self.framework_failures = [] + self.framework_warnings = [] self.unexpected_passes = [] self.unexpected_failures = [] diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index a5da1e9..457e380 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -324,7 +324,7 @@ def _stats_num_field( name, opts, field, expecteds ): if b: opts.stats_range_fields[field] = (expected, dev) return - framework_fail(name, 'numfield-no-expected', 'No expected value found for ' + field + ' in num_field check') + framework_warn(name, 'numfield-no-expected', 'No expected value found for ' + field + ' in num_field check') else: (expected, dev) = expecteds @@ -347,7 +347,7 @@ def _compiler_stats_num_field( name, opts, field, expecteds ): opts.compiler_stats_range_fields[field] = (expected, dev) return - framework_fail(name, 'numfield-no-expected', 'No expected value found for ' + field + ' in num_field check') + framework_warn(name, 'numfield-no-expected', 'No expected value found for ' + field + ' in num_field check') # ----- @@ -893,6 +893,13 @@ def framework_fail(name, way, reason): if_verbose(1, '*** framework failure for %s %s ' % (full_name, reason)) t.framework_failures.append((directory, name, way, reason)) +def framework_warn(name, way, reason): + opts = getTestOpts() + directory = re.sub('^\\.[/\\\\]', '', opts.testdir) + full_name = name + '(' + way + ')' + if_verbose(1, '*** framework warning for %s %s ' % (full_name, reason)) + t.framework_warnings.append((directory, name, way, reason)) + def badResult(result): try: if result['passFail'] == 'pass': @@ -1990,6 +1997,8 @@ def summary(t, file, short=False): + '\n' + repr(len(t.framework_failures)).rjust(8) + ' caused framework failures\n' + + repr(len(t.framework_warnings)).rjust(8) + + ' caused framework warnings\n' + repr(len(t.unexpected_passes)).rjust(8) + ' unexpected passes\n' + repr(len(t.unexpected_failures)).rjust(8) @@ -2014,6 +2023,10 @@ def summary(t, file, short=False): file.write('Framework failures:\n') printTestInfosSummary(file, t.framework_failures) + if t.framework_warnings: + file.write('Framework warnings:\n') + printTestInfosSummary(file, t.framework_warnings) + if stopping(): file.write('WARNING: Testsuite run was terminated early\n') From git at git.haskell.org Mon Apr 3 02:37:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 3 Apr 2017 02:37:40 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: UNREG: ignore -fllvm (Trac #13495) (70530b4) Message-ID: <20170403023740.DF5993A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/70530b42c41d97a8accd3e8565b4fa31ca80b5d6/ghc >--------------------------------------------------------------- commit 70530b42c41d97a8accd3e8565b4fa31ca80b5d6 Author: Sergei Trofimovich Date: Sat Apr 1 10:35:52 2017 +0100 UNREG: ignore -fllvm (Trac #13495) Unregisterised GHC can only use C as a target backend (option used to be called -fvia-C). -fasm option was ignored with a warhing, but not -fllvm. jms noticed the failure when tried to use quick-cross build flavour. quick-cross enables -fllvm in makefile. "inplace/bin/ghc-stage1" ... -fllvm ghc-stage1: panic! (the 'impossible' happened) (GHC version 8.0.2 for powerpc-unknown-linux): LlvmCodeGen.Ppr: Cross compiling without valid target info. This change ignores -fllvm as well. Signed-off-by: Sergei Trofimovich (cherry picked from commit 74615f412ad3de2910a156ff494bfe5497fada7e) >--------------------------------------------------------------- 70530b42c41d97a8accd3e8565b4fa31ca80b5d6 compiler/main/DynFlags.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index c001073..b8255e1 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -5129,7 +5129,7 @@ makeDynFlagsConsistent dflags = let dflags' = gopt_unset dflags Opt_Hpc warn = "Hpc can't be used with byte-code interpreter. Ignoring -fhpc." in loop dflags' warn - | hscTarget dflags == HscAsm && + | hscTarget dflags `elem` [HscAsm, HscLlvm] && platformUnregisterised (targetPlatform dflags) = loop (dflags { hscTarget = HscC }) "Compiler unregisterised, so compiling via C" From git at git.haskell.org Mon Apr 3 02:37:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 3 Apr 2017 02:37:46 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Introduce putLogMsg (902dd6e) Message-ID: <20170403023746.ECFD63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/902dd6e56acd651f9eab2df23ebc104f87a50939/ghc >--------------------------------------------------------------- commit 902dd6e56acd651f9eab2df23ebc104f87a50939 Author: Ben Gamari Date: Wed Mar 15 09:29:24 2017 -0400 Introduce putLogMsg This factors out the repetition of (log_action dflags dflags) and will hopefully allow us to someday better abstract log output. Test Plan: Validate Reviewers: austin, hvr, goldfire Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3334 (cherry picked from commit 086b514b199c122b638391f3aa2fbcf15cc10c06) >--------------------------------------------------------------- 902dd6e56acd651f9eab2df23ebc104f87a50939 compiler/coreSyn/CoreLint.hs | 64 ++++++++++++++--------------------------- compiler/deSugar/Coverage.hs | 2 +- compiler/ghci/Linker.hs | 17 ++++++----- compiler/iface/BinIface.hs | 13 ++++----- compiler/iface/LoadIface.hs | 2 +- compiler/main/DriverPipeline.hs | 4 +-- compiler/main/DynFlags.hs | 7 +++++ compiler/main/ErrUtils.hs | 24 +++++++--------- compiler/main/GhcMake.hs | 2 +- compiler/main/SysTools.hs | 4 +-- compiler/main/TidyPgm.hs | 2 +- compiler/simplCore/CoreMonad.hs | 3 +- compiler/simplCore/SimplCore.hs | 2 +- compiler/simplStg/SimplStg.hs | 2 +- compiler/typecheck/TcRnMonad.hs | 15 +++++----- 15 files changed, 70 insertions(+), 93 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 902dd6e56acd651f9eab2df23ebc104f87a50939 From git at git.haskell.org Mon Apr 3 02:37:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 3 Apr 2017 02:37:44 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: testsuite: Add regression test for #13474 (f7b19a6) Message-ID: <20170403023744.26E0D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/f7b19a66e64df5b89c65ccda8d6bc22f6b9a7b4d/ghc >--------------------------------------------------------------- commit f7b19a66e64df5b89c65ccda8d6bc22f6b9a7b4d Author: Ben Gamari Date: Sat Apr 1 10:59:53 2017 -0400 testsuite: Add regression test for #13474 (cherry picked from commit 6928d8019cd2cdd1c0b9d6e1fe1a0c8c07e57595) >--------------------------------------------------------------- f7b19a66e64df5b89c65ccda8d6bc22f6b9a7b4d testsuite/tests/typecheck/should_compile/T13474.hs | 13 +++++++++++++ testsuite/tests/typecheck/should_compile/all.T | 1 + 2 files changed, 14 insertions(+) diff --git a/testsuite/tests/typecheck/should_compile/T13474.hs b/testsuite/tests/typecheck/should_compile/T13474.hs new file mode 100644 index 0000000..9775832 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T13474.hs @@ -0,0 +1,13 @@ +module T13474 where + +import qualified Data.Map as M + +class Default a where + def :: a + +foo :: Default a => b -> a +foo x = def + +mapdef :: Default v => M.Map k v -> M.Map k v +mapdef = M.map foo + diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index 97a5350..33ffc4f 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -547,3 +547,4 @@ test('T13381', normal, compile_fail, ['']) test('T13337', normal, compile, ['']) test('T13343', normal, compile, ['']) test('T13458', normal, compile, ['']) +test('T13474', normal, compile, ['']) From git at git.haskell.org Mon Apr 3 02:37:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 3 Apr 2017 02:37:49 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Document the perplexing reversed nature of extraPkgConfs and friends. (24910e1) Message-ID: <20170403023749.A04483A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/24910e1940f5823c515810b859da709fb647e739/ghc >--------------------------------------------------------------- commit 24910e1940f5823c515810b859da709fb647e739 Author: Edward Z. Yang Date: Sun Mar 19 16:06:55 2017 -0700 Document the perplexing reversed nature of extraPkgConfs and friends. Signed-off-by: Edward Z. Yang (cherry picked from commit 40b65db4cd34c3566b9f6c53c086d53e97574217) >--------------------------------------------------------------- 24910e1940f5823c515810b859da709fb647e739 compiler/main/DynFlags.hs | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index f48e99e..99a41d9 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -806,16 +806,26 @@ data DynFlags = DynFlags { -- Package flags extraPkgConfs :: [PkgConfRef] -> [PkgConfRef], -- ^ The @-package-db@ flags given on the command line, in the order - -- they appeared. + -- they appeared. In *reverse* order that they're specified + -- on the command line. This is intended to be applied with the + -- list of "initial" package databases derived from @GHC_PACKAGE_PATH@; + -- see 'getPackageConfRefs'; this is a function because 'extraPkgConfs' + -- maybe configured to filter out certain flags from *either* the + -- user command line, or the base command; see for example + -- 'removeUserPkgConf'. ignorePackageFlags :: [IgnorePackageFlag], - -- ^ The @-ignore-package@ flags from the command line + -- ^ The @-ignore-package@ flags from the command line. + -- In *reverse* order that they're specified on the command line. packageFlags :: [PackageFlag], - -- ^ The @-package@ and @-hide-package@ flags from the command-line + -- ^ The @-package@ and @-hide-package@ flags from the command-line. + -- In *reverse* order that they're specified on the command line. pluginPackageFlags :: [PackageFlag], - -- ^ The @-plugin-package-id@ flags from command line + -- ^ The @-plugin-package-id@ flags from command line. + -- In *reverse* order that they're specified on the command line. trustFlags :: [TrustFlag], - -- ^ The @-trust@ and @-distrust@ flags + -- ^ The @-trust@ and @-distrust@ flags. + -- In *reverse* order that they're specified on the command line. packageEnv :: Maybe FilePath, -- ^ Filepath to the package environment file (if overriding default) From git at git.haskell.org Mon Apr 3 02:37:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 3 Apr 2017 02:37:52 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Optimise common cases of GHC.setProgramDynFlags (7724964) Message-ID: <20170403023752.61B8B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/77249644052c6f3309ff57f7db5c19eb19138d5b/ghc >--------------------------------------------------------------- commit 77249644052c6f3309ff57f7db5c19eb19138d5b Author: Simon Marlow Date: Sat Apr 1 11:51:43 2017 -0400 Optimise common cases of GHC.setProgramDynFlags * If the package flags haven't changed, don't do initPackages (which might take multiple seconds in extreme cases) * Provide a way to change the log_action without invalidating the summary cache. Test Plan: validate Reviewers: niteria, bgamari, austin, erikd, ezyang Reviewed By: bgamari Subscribers: mpickering, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3392 (cherry picked from commit f7cc1fdebd6aa8b5cb0498ae245a5e8cf3e38f6f) >--------------------------------------------------------------- 77249644052c6f3309ff57f7db5c19eb19138d5b compiler/main/DriverPipeline.hs | 10 ++++++- compiler/main/DynFlags.hs | 64 +++++++++++++++++++++++++---------------- compiler/main/GHC.hs | 30 +++++++++++++++---- compiler/main/Packages.hs | 24 +++++++++++++--- ghc/GHCi/UI.hs | 7 ----- 5 files changed, 94 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 77249644052c6f3309ff57f7db5c19eb19138d5b From git at git.haskell.org Mon Apr 3 02:37:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 3 Apr 2017 02:37:55 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: testsuite: Bump allocations for T4029 (50ff90b) Message-ID: <20170403023755.1C8843A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/50ff90b3590940b19dcb7168803a3ab750d2dea2/ghc >--------------------------------------------------------------- commit 50ff90b3590940b19dcb7168803a3ab750d2dea2 Author: Ben Gamari Date: Tue Mar 14 10:04:40 2017 -0400 testsuite: Bump allocations for T4029 Both the OS X build machine and my local builds have been failing. Unfortunately, our x86_64 Linux machine has been succeeding. (cherry picked from commit 34f9172fe456b4125ad527f9386aa23e2dfe98c6) >--------------------------------------------------------------- 50ff90b3590940b19dcb7168803a3ab750d2dea2 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 2481b05..3e37bf7 100644 --- a/testsuite/tests/perf/space_leaks/all.T +++ b/testsuite/tests/perf/space_leaks/all.T @@ -71,7 +71,7 @@ test('T4029', # 2017-03-03: 65 (amd64/Linux) Share Typeable KindReps or more # lazy interface file reading stats_num_field('max_bytes_used', - [(wordsize(64), 20476360, 5)]), + [(wordsize(64), 18208944, 5)]), # 2016-02-26: 24071720 (amd64/Linux) INITIAL # 2016-04-21: 25542832 (amd64/Linux) # 2016-05-23: 25247216 (amd64/Linux) Use -G1 @@ -87,6 +87,7 @@ test('T4029', # 2017-03-03: 19172360 (amd64/Linux) Share Typeable KindReps or more # lazy interface file reading # 2017-03-07: 20476360 (amd64/Linux) It's not entirely clear + # 2017-03-14: 18208944 (amd64/Darwin) Again, not clear extra_hc_opts('+RTS -G1 -RTS' ), ], ghci_script, From git at git.haskell.org Mon Apr 3 02:37:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 3 Apr 2017 02:37:57 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Stamp out space leaks from demand analysis (fb5c064) Message-ID: <20170403023757.D37743A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/fb5c064fc0ab7fcf2fc31bd3e49cc3f2ef78edfa/ghc >--------------------------------------------------------------- commit fb5c064fc0ab7fcf2fc31bd3e49cc3f2ef78edfa Author: Reid Barton Date: Sat Apr 1 11:51:59 2017 -0400 Stamp out space leaks from demand analysis This reduces peak memory usage by ~30% on my test case (DynFlags), and (probably as a result of reduced GC work) decreases compilation time by a few percent as well. Also fix a bug in seqStrDmd so that demeand info is fully evaluated. Reviewers: simonpj, austin, bgamari Reviewed By: bgamari Subscribers: dfeuer, thomie Differential Revision: https://phabricator.haskell.org/D3400 (cherry picked from commit f2b10f35a053e595fd309f523c5e93f619d2ec3a) >--------------------------------------------------------------- fb5c064fc0ab7fcf2fc31bd3e49cc3f2ef78edfa compiler/basicTypes/Demand.hs | 2 +- compiler/stranal/DmdAnal.hs | 22 +++++++++++++++++++++- testsuite/tests/perf/compiler/all.T | 5 +++-- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/compiler/basicTypes/Demand.hs b/compiler/basicTypes/Demand.hs index e3984d7..e343f39 100644 --- a/compiler/basicTypes/Demand.hs +++ b/compiler/basicTypes/Demand.hs @@ -332,7 +332,7 @@ bothStr (SProd _) (SCall _) = HyperStr -- utility functions to deal with memory leaks seqStrDmd :: StrDmd -> () seqStrDmd (SProd ds) = seqStrDmdList ds -seqStrDmd (SCall s) = s `seq` () +seqStrDmd (SCall s) = seqStrDmd s seqStrDmd _ = () seqStrDmdList :: [ArgStr] -> () diff --git a/compiler/stranal/DmdAnal.hs b/compiler/stranal/DmdAnal.hs index 25a4f8b..2fc33a4 100644 --- a/compiler/stranal/DmdAnal.hs +++ b/compiler/stranal/DmdAnal.hs @@ -17,6 +17,7 @@ import DynFlags import WwLib ( findTypeShape, deepSplitProductType_maybe ) import Demand -- All of it import CoreSyn +import CoreSeq ( seqBinds ) import Outputable import VarEnv import BasicTypes @@ -52,7 +53,8 @@ dmdAnalProgram dflags fam_envs binds dumpIfSet_dyn dflags Opt_D_dump_str_signatures "Strictness signatures" $ dumpStrSig binds_plus_dmds ; - return binds_plus_dmds + -- See Note [Stamp out space leaks in demand analysis] + seqBinds binds_plus_dmds `seq` return binds_plus_dmds } where do_prog :: CoreProgram -> CoreProgram @@ -79,6 +81,24 @@ dmdAnalTopBind sigs (Rec pairs) -- We get two iterations automatically -- c.f. the NonRec case above +{- Note [Stamp out space leaks in demand analysis] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +The demand analysis pass outputs a new copy of the Core program in +which binders have been annotated with demand and strictness +information. It's tiresome to ensure that this information is fully +evaluated everywhere that we produce it, so we just run a single +seqBinds over the output before returning it, to ensure that there are +no references holding on to the input Core program. + +This is particularly important when we are doing late demand analysis, +since we don't do a seqBinds at any point thereafter. Hence code +generation would hold on to an extra copy of the Core program, via +unforced thunks in demand or strictness information; and it is the +most memory-intensive part of the compilation process, so this added +seqBinds makes a big difference in peak memory usage. +-} + + {- ************************************************************************ * * diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index c034e93..e99808e 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -738,7 +738,7 @@ test('T9020', test('T9675', [ only_ways(['optasm']), compiler_stats_num_field('max_bytes_used', # Note [residency] - [(wordsize(64), 38776008, 15), + [(wordsize(64), 29871032, 15), # 2014-10-13 29596552 # 2014-10-13 26570896 seq the DmdEnv in seqDmdType as well # 2014-10-13 18582472 different machines giving different results.. @@ -746,7 +746,8 @@ test('T9675', # 2015-06-21 28056344 switch to `+RTS -G1`, tighten bound to 15% # 2015-10-28 23776640 emit Typeable at definition site # 2015-12-11 30837312 TypeInType (see #11196) - # 2016-04-14 38776008 Final demand analyzer run + # 2016-03-14 38776008 Final demand analyzer run + # 2016-04-01 29871032 Fix leaks in demand analysis (wordsize(32), 18043224, 15) # 2015-07-11 15341228 (x86/Linux, 64-bit machine) use +RTS -G1 # 2016-04-06 18043224 (x86/Linux, 64-bit machine) From git at git.haskell.org Mon Apr 3 02:38:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 3 Apr 2017 02:38:00 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Revert "Fix #13458" (d2f5ef9) Message-ID: <20170403023800.916AB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/d2f5ef97944c43a84459e5017e466d6d707578d3/ghc >--------------------------------------------------------------- commit d2f5ef97944c43a84459e5017e466d6d707578d3 Author: Ben Gamari Date: Sat Apr 1 18:01:22 2017 -0400 Revert "Fix #13458" This reverts commit 662c64226e302009175abfa7ed196ac905990486. >--------------------------------------------------------------- d2f5ef97944c43a84459e5017e466d6d707578d3 compiler/simplStg/RepType.hs | 4 ++++ testsuite/tests/typecheck/should_compile/T13458.hs | 11 ----------- testsuite/tests/typecheck/should_compile/all.T | 1 - 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/compiler/simplStg/RepType.hs b/compiler/simplStg/RepType.hs index 91e4285..79b1299 100644 --- a/compiler/simplStg/RepType.hs +++ b/compiler/simplStg/RepType.hs @@ -343,6 +343,10 @@ kindPrimRep doc (TyConApp typ [runtime_rep]) kindPrimRep doc ki = pprPanic "kindPrimRep" (ppr ki $$ doc) + -- TODO (RAE): Remove: + -- WARN( True, text "kindPrimRep defaulting to LiftedRep on" <+> ppr ki $$ doc ) + -- [LiftedRep] -- this can happen legitimately for, e.g., Any + -- | Take a type of kind RuntimeRep and extract the list of 'PrimRep' that -- it encodes. runtimeRepPrimRep :: HasDebugCallStack => SDoc -> Type -> [PrimRep] diff --git a/testsuite/tests/typecheck/should_compile/T13458.hs b/testsuite/tests/typecheck/should_compile/T13458.hs deleted file mode 100644 index 9b51378..0000000 --- a/testsuite/tests/typecheck/should_compile/T13458.hs +++ /dev/null @@ -1,11 +0,0 @@ -{-# LANGUAGE MagicHash, TypeInType, ScopedTypeVariables #-} -{-# OPTIONS_GHC -O #-} -module T13458 where -import GHC.Exts -import Data.Kind -import Unsafe.Coerce - -unsafeCoerce' :: forall (r :: RuntimeRep) - (a :: TYPE r) (b :: TYPE r). - a -> b -unsafeCoerce' = unsafeCoerce id diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index 33ffc4f..6ceb87d 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -546,5 +546,4 @@ test('T12926', normal, compile, ['']) test('T13381', normal, compile_fail, ['']) test('T13337', normal, compile, ['']) test('T13343', normal, compile, ['']) -test('T13458', normal, compile, ['']) test('T13474', normal, compile, ['']) From git at git.haskell.org Mon Apr 3 02:38:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 3 Apr 2017 02:38:03 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: FastMutInt: fix Int and Ptr sizes when crosscompiling (47c0801) Message-ID: <20170403023803.49CBF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/47c08016a247ec7ecb04622d158c0023a9cfc440/ghc >--------------------------------------------------------------- commit 47c08016a247ec7ecb04622d158c0023a9cfc440 Author: Sergei Trofimovich Date: Sun Apr 2 16:12:18 2017 +0100 FastMutInt: fix Int and Ptr sizes when crosscompiling Similar to https://ghc.haskell.org/trac/ghc/ticket/13491 https://phabricator.haskell.org/D3122 SIZEOF_HSINT and SIZEOF_VOID_P are sizes of target platform. These values are usually not correct when stage1 is built. It means the code ```haskell newFastMutInt = IO $ \s -> case newByteArray# size s of { (# s, arr #) -> (# s, FastMutInt arr #) } where !(I# size) = SIZEOF_HSINT ``` would try to allocate only 4 bytes on 64-bit-host targeting 32-bit system. It does not matter in practice as newByteArray# implementation rounds up passed value to host's word size. But one day it might not. To prevent this class of problems in compiler/ directory 'MachDeps.h' contents is hidden when ghc-stage1 (-DSTAGE=1) is built. Signed-off-by: Sergei Trofimovich Reviewers: austin, rwbarton, simonmar, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3405 (cherry picked from commit d89b0471888b15844b8bbf68159fe50830be8b24) >--------------------------------------------------------------- 47c08016a247ec7ecb04622d158c0023a9cfc440 compiler/utils/FastMutInt.hs | 14 +++++--------- includes/MachDeps.h | 29 ++++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/compiler/utils/FastMutInt.hs b/compiler/utils/FastMutInt.hs index 4cde121..2a6e7b8 100644 --- a/compiler/utils/FastMutInt.hs +++ b/compiler/utils/FastMutInt.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE CPP, BangPatterns, MagicHash, UnboxedTuples #-} +{-# LANGUAGE BangPatterns, MagicHash, UnboxedTuples #-} {-# OPTIONS_GHC -O #-} -- We always optimise this, otherwise performance of a non-optimised -- compiler is severely affected @@ -15,12 +15,7 @@ module FastMutInt( readFastMutPtr, writeFastMutPtr ) where - -#include "../includes/MachDeps.h" -#ifndef SIZEOF_HSINT -#define SIZEOF_HSINT INT_SIZE_IN_BYTES -#endif - +import Data.Bits import GHC.Base import GHC.Ptr @@ -37,7 +32,7 @@ data FastMutInt = FastMutInt (MutableByteArray# RealWorld) newFastMutInt = IO $ \s -> case newByteArray# size s of { (# s, arr #) -> (# s, FastMutInt arr #) } - where !(I# size) = SIZEOF_HSINT + where !(I# size) = finiteBitSize (0 :: Int) readFastMutInt (FastMutInt arr) = IO $ \s -> case readIntArray# arr 0# s of { (# s, i #) -> @@ -52,7 +47,8 @@ data FastMutPtr = FastMutPtr (MutableByteArray# RealWorld) newFastMutPtr = IO $ \s -> case newByteArray# size s of { (# s, arr #) -> (# s, FastMutPtr arr #) } - where !(I# size) = SIZEOF_VOID_P + -- GHC assumes 'sizeof (Int) == sizeof (Ptr a)' + where !(I# size) = finiteBitSize (0 :: Int) readFastMutPtr (FastMutPtr arr) = IO $ \s -> case readAddrArray# arr 0# s of { (# s, i #) -> diff --git a/includes/MachDeps.h b/includes/MachDeps.h index 3a8371b..380b3fb 100644 --- a/includes/MachDeps.h +++ b/includes/MachDeps.h @@ -3,7 +3,7 @@ * (c) The University of Glasgow 2002 * * Definitions that characterise machine specific properties of basic - * types (C & Haskell). + * types (C & Haskell) of a target platform. * * NB: Keep in sync with HsFFI.h and StgTypes.h. * NB: THIS FILE IS INCLUDED IN HASKELL SOURCE! @@ -16,6 +16,31 @@ #ifndef MACHDEPS_H #define MACHDEPS_H +/* Don't allow stage1 (cross-)compiler embed assumptions about target + * platform. When ghc-stage1 is being built by ghc-stage0 is should not + * refer to target defines. A few past examples: + * - https://ghc.haskell.org/trac/ghc/ticket/13491 + * - https://phabricator.haskell.org/D3122 + * - https://phabricator.haskell.org/D3405 + * + * In those cases code change assumed target defines like SIZEOF_HSINT + * are applied to host platform, not target platform. + * + * So what should be used instead in STAGE=1? + * + * To get host's equivalent of SIZEOF_HSINT you can use Bits instances: + * Data.Bits.finiteBitSize (0 :: Int) + * + * To get target's values it is preferred to use runtime target + * configuration from 'targetPlatform :: DynFlags -> Platform' + * record. A few wrappers are already defined and used throughout GHC: + * wORD_SIZE :: DynFlags -> Int + * wORD_SIZE dflags = pc_WORD_SIZE (sPlatformConstants (settings dflags)) + * + * Hence we hide these macros from -DSTAGE=1 + */ +#if !defined(STAGE) || STAGE >= 2 + /* Sizes of C types come from here... */ #include "ghcautoconf.h" @@ -96,4 +121,6 @@ #define TAG_MASK ((1 << TAG_BITS) - 1) +#endif /* !defined(STAGE) || STAGE >= 2 */ + #endif /* MACHDEPS_H */ From git at git.haskell.org Mon Apr 3 02:38:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 3 Apr 2017 02:38:06 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: testsuite: Bump margin of T4029 to 15% (298347d) Message-ID: <20170403023806.09F443A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/298347da57c8d2602589c25e853111c37a3c34e8/ghc >--------------------------------------------------------------- commit 298347da57c8d2602589c25e853111c37a3c34e8 Author: Ben Gamari Date: Wed Mar 15 13:34:48 2017 -0400 testsuite: Bump margin of T4029 to 15% This test has been fluctuating wildly recently. Moreover, it's not even clear to me that this is a particularly useful thing to be testing. (cherry picked from commit 899fb8808da875ef191da367de4ff35d079124e1) >--------------------------------------------------------------- 298347da57c8d2602589c25e853111c37a3c34e8 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 3e37bf7..7c6f564 100644 --- a/testsuite/tests/perf/space_leaks/all.T +++ b/testsuite/tests/perf/space_leaks/all.T @@ -71,7 +71,7 @@ test('T4029', # 2017-03-03: 65 (amd64/Linux) Share Typeable KindReps or more # lazy interface file reading stats_num_field('max_bytes_used', - [(wordsize(64), 18208944, 5)]), + [(wordsize(64), 18208944, 15)]), # 2016-02-26: 24071720 (amd64/Linux) INITIAL # 2016-04-21: 25542832 (amd64/Linux) # 2016-05-23: 25247216 (amd64/Linux) Use -G1 @@ -88,6 +88,7 @@ test('T4029', # lazy interface file reading # 2017-03-07: 20476360 (amd64/Linux) It's not entirely clear # 2017-03-14: 18208944 (amd64/Darwin) Again, not clear + # 2017-03-15: bumped margin to 15% due to instability extra_hc_opts('+RTS -G1 -RTS' ), ], ghci_script, From git at git.haskell.org Mon Apr 3 02:38:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 3 Apr 2017 02:38:08 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: compiler/ghc.mk: fix GhcWithInterpreter=NO build failure (ba0a8d8) Message-ID: <20170403023808.B7A903A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/ba0a8d81f4d9ab31f9cca4590a80cfc7e6a58fdd/ghc >--------------------------------------------------------------- commit ba0a8d81f4d9ab31f9cca4590a80cfc7e6a58fdd Author: Sergei Trofimovich Date: Sun Apr 2 14:01:19 2017 +0100 compiler/ghc.mk: fix GhcWithInterpreter=NO build failure When GhcWithInterpreter=NO is set in mk/build.mk build fails as: $ inplace/bin/dll-split compiler/stage2/build/.depend-v-dyn.haskell "DynFlags" ... Reachable modules from DynFlags out of date Please fix compiler/ghc.mk, or building DLLs on Windows may break (#7780) Extra modules: ByteCodeTypes InteractiveEvalTypes Signed-off-by: Sergei Trofimovich (cherry picked from commit 03e34256e2cba964adf6dcdb1682618f26400b3a) >--------------------------------------------------------------- ba0a8d81f4d9ab31f9cca4590a80cfc7e6a58fdd compiler/ghc.mk | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/compiler/ghc.mk b/compiler/ghc.mk index 3619c65..614d193 100644 --- a/compiler/ghc.mk +++ b/compiler/ghc.mk @@ -441,6 +441,7 @@ compiler_stage2_dll0_MODULES = \ BinFingerprint \ BooleanFormula \ BufWrite \ + ByteCodeTypes \ Class \ CmdLineParser \ CmmType \ @@ -493,12 +494,13 @@ compiler_stage2_dll0_MODULES = \ HsUtils \ HscTypes \ IOEnv \ - NameCache \ + NameCache \ Id \ IdInfo \ IfaceSyn \ IfaceType \ - Json \ + InteractiveEvalTypes \ + Json \ ToIface \ InstEnv \ Kind \ @@ -563,9 +565,7 @@ compiler_stage2_dll0_MODULES = \ ifeq "$(GhcWithInterpreter)" "YES" # These files are reacheable from DynFlags # only by GHCi-enabled code (see #9552) -compiler_stage2_dll0_MODULES += \ - ByteCodeTypes \ - InteractiveEvalTypes +compiler_stage2_dll0_MODULES += # none endif compiler_stage2_dll0_HS_OBJS = \ From git at git.haskell.org Mon Apr 3 02:38:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 3 Apr 2017 02:38:11 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: configure.ac: fix NCG support in --target= (0217621) Message-ID: <20170403023811.6FDA53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/021762134b8f853395516ae3ef9e58b77289229d/ghc >--------------------------------------------------------------- commit 021762134b8f853395516ae3ef9e58b77289229d Author: Sergei Trofimovich Date: Sun Apr 2 19:38:23 2017 +0100 configure.ac: fix NCG support in --target= Before this change attempt to build a crosscompiler on registerised platform (--host=x86_64-pc-linux-gnu) targeting UNREG platform failed: $ ./configure --target=ia64-unknown-linux-gnu utils/genapply/../../includes/stg/MachRegs.h:608:2: error: #error Cannot find platform to give register info for The change is to check --target= for NCG availability, not --host=. Signed-off-by: Sergei Trofimovich (cherry picked from commit cb18447c75e7673d5f57056fbdaa370d11e4c05e) >--------------------------------------------------------------- 021762134b8f853395516ae3ef9e58b77289229d configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 9ae97b8..2b1cc6d 100644 --- a/configure.ac +++ b/configure.ac @@ -241,7 +241,7 @@ AC_SUBST(SOLARIS_BROKEN_SHLD) dnl ** Do an unregisterised build? dnl -------------------------------------------------------------- -case "$HostArch" in +case "$TargetArch" in i386|x86_64|powerpc|powerpc64|powerpc64le|arm) UnregisterisedDefault=NO ;; From git at git.haskell.org Mon Apr 3 02:38:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 3 Apr 2017 02:38:16 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Report heap overflow in the same way as stack overflow (3a20ebe) Message-ID: <20170403023816.E4B7F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/3a20ebe05acf2ca30a620ca0bedbbe62b13c1843/ghc >--------------------------------------------------------------- commit 3a20ebe05acf2ca30a620ca0bedbbe62b13c1843 Author: Simon Marlow Date: Sat Apr 1 19:52:40 2017 -0400 Report heap overflow in the same way as stack overflow Now that we throw an exception for heap overflow, we should only print the heap overflow message in the main thread when the HeapOverflow exception is caught, rather than as a side effect in the GC. Stack overflows were already done this way, I just made heap overflow consistent with stack overflow, and did some related cleanup. Fixes broken T2592(profasm) which was reporting the heap overflow message twice (you would only notice when building with profiling libs enabled). Test Plan: validate Reviewers: bgamari, niteria, austin, DemiMarie, hvr, erikd Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3394 (cherry picked from commit 61ba4518a48727f8cd7b821bd41631da82d37425) >--------------------------------------------------------------- 3a20ebe05acf2ca30a620ca0bedbbe62b13c1843 includes/Rts.h | 3 ++- libraries/base/GHC/Conc.hs | 2 +- libraries/base/GHC/Conc/Sync.hs | 11 +++++++---- libraries/base/GHC/TopHandler.hs | 5 +++-- rts/RtsSymbols.c | 3 ++- rts/RtsUtils.c | 20 ++++++-------------- rts/RtsUtils.h | 2 -- rts/sm/CNF.c | 4 ++-- rts/sm/GC.c | 11 +++++++++++ rts/sm/Storage.c | 2 +- testsuite/tests/rts/T1791/T1791.stderr | 3 --- 11 files changed, 35 insertions(+), 31 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 3a20ebe05acf2ca30a620ca0bedbbe62b13c1843 From git at git.haskell.org Mon Apr 3 02:38:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 3 Apr 2017 02:38:19 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: testsuite: Fix GhciCurDir test (db6664f) Message-ID: <20170403023819.A2ABE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/db6664f0186ff2b58a2300dd00b54353c49f7649/ghc >--------------------------------------------------------------- commit db6664f0186ff2b58a2300dd00b54353c49f7649 Author: Ben Gamari Date: Sun Apr 2 12:05:09 2017 -0400 testsuite: Fix GhciCurDir test This was horribly, horribly wrong. (cherry picked from commit 4ed33975e85f567dc351a21e2f27f097db15b7c1) >--------------------------------------------------------------- db6664f0186ff2b58a2300dd00b54353c49f7649 testsuite/tests/ghci/scripts/GhciCurDir.script | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/ghci/scripts/GhciCurDir.script b/testsuite/tests/ghci/scripts/GhciCurDir.script index 785a773..cfeb1a4 100644 --- a/testsuite/tests/ghci/scripts/GhciCurDir.script +++ b/testsuite/tests/ghci/scripts/GhciCurDir.script @@ -4,4 +4,5 @@ import Control.Monad createDirectory "test" createDirectory "test/test1" :cd test -unless ("test1" `elem` getDirectoryContents ".") $ putStrLn "Uh oh." +fs <- getDirectoryContents "." +unless ("test1" `elem` fs) $ putStrLn "Uh oh." From git at git.haskell.org Mon Apr 3 02:38:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 3 Apr 2017 02:38:22 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: :cd affects the iserv process too (ba784bc) Message-ID: <20170403023822.DE3D03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/ba784bc32f1f033de32f4d7aa76d530a32a0c360/ghc >--------------------------------------------------------------- commit ba784bc32f1f033de32f4d7aa76d530a32a0c360 Author: Simon Marlow Date: Sun Apr 2 10:43:32 2017 -0400 :cd affects the iserv process too Test Plan: validate Reviewers: angerman, austin, bgamari, erikd Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3395 (cherry picked from commit dfac365f69a9380e3c3640b3bfaf9b9157f8d3b9) >--------------------------------------------------------------- ba784bc32f1f033de32f4d7aa76d530a32a0c360 ghc/GHCi/UI.hs | 5 +++++ testsuite/tests/ghci/scripts/GhciCurDir.script | 7 +++++++ testsuite/tests/ghci/scripts/all.T | 1 + 3 files changed, 13 insertions(+) diff --git a/ghc/GHCi/UI.hs b/ghc/GHCi/UI.hs index 593307b..e612b76 100644 --- a/ghc/GHCi/UI.hs +++ b/ghc/GHCi/UI.hs @@ -1409,6 +1409,11 @@ changeDirectory dir = do GHC.workingDirectoryChanged dir' <- expandPath dir liftIO $ setCurrentDirectory dir' + dflags <- getDynFlags + -- With -fexternal-interpreter, we have to change the directory of the subprocess too. + -- (this gives consistent behaviour with and without -fexternal-interpreter) + when (gopt Opt_ExternalInterpreter dflags) $ + lift $ enqueueCommands ["System.Directory.setCurrentDirectory " ++ show dir'] trySuccess :: GHC.GhcMonad m => m SuccessFlag -> m SuccessFlag trySuccess act = diff --git a/testsuite/tests/ghci/scripts/GhciCurDir.script b/testsuite/tests/ghci/scripts/GhciCurDir.script new file mode 100644 index 0000000..785a773 --- /dev/null +++ b/testsuite/tests/ghci/scripts/GhciCurDir.script @@ -0,0 +1,7 @@ +import System.Directory +import Control.Monad + +createDirectory "test" +createDirectory "test/test1" +:cd test +unless ("test1" `elem` getDirectoryContents ".") $ putStrLn "Uh oh." diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T index 00d8d81..cde72e4 100755 --- a/testsuite/tests/ghci/scripts/all.T +++ b/testsuite/tests/ghci/scripts/all.T @@ -251,3 +251,4 @@ test('StaticPtr', normal, ghci_script, ['StaticPtr.script']) test('T13202', normal, ghci_script, ['T13202.script']) test('T13202a', normal, ghci_script, ['T13202a.script']) test('T13466', normal, ghci_script, ['T13466.script']) +test('GhciCurDir', normal, ghci_script, ['GhciCurDir.script']) From git at git.haskell.org Mon Apr 3 02:38:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 3 Apr 2017 02:38:14 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: configure.ac: add aarch64 to list of registerised (c769130) Message-ID: <20170403023814.2E6183A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/c769130654805c28838a16d55a385b3b53ae329b/ghc >--------------------------------------------------------------- commit c769130654805c28838a16d55a385b3b53ae329b Author: Sergei Trofimovich Date: Sun Apr 2 20:56:40 2017 +0100 configure.ac: add aarch64 to list of registerised Similar to 'arm' 'aarch64' has working llvm codegen, no need to fallback to unregisterised buld by default. Signed-off-by: Sergei Trofimovich (cherry picked from commit 911055689eca26c7c2713e251646fa35359acba3) >--------------------------------------------------------------- c769130654805c28838a16d55a385b3b53ae329b configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 2b1cc6d..ec567ac 100644 --- a/configure.ac +++ b/configure.ac @@ -242,7 +242,7 @@ AC_SUBST(SOLARIS_BROKEN_SHLD) dnl ** Do an unregisterised build? dnl -------------------------------------------------------------- case "$TargetArch" in - i386|x86_64|powerpc|powerpc64|powerpc64le|arm) + i386|x86_64|powerpc|powerpc64|powerpc64le|arm|aarch64) UnregisterisedDefault=NO ;; *) From git at git.haskell.org Mon Apr 3 02:38:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 3 Apr 2017 02:38:25 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Update containers submodule to official 0.5.10.2 (64902e3) Message-ID: <20170403023825.966C93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/64902e34eb2aac82d6c92c2fba005ae56924707c/ghc >--------------------------------------------------------------- commit 64902e34eb2aac82d6c92c2fba005ae56924707c Author: David Feuer Date: Sun Apr 2 14:39:15 2017 -0400 Update containers submodule to official 0.5.10.2 Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3406 (cherry picked from commit 115e7ebfaad36327b7b38f112282f6e84d267c88) >--------------------------------------------------------------- 64902e34eb2aac82d6c92c2fba005ae56924707c libraries/containers | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/containers b/libraries/containers index f42e932..6414704 160000 --- a/libraries/containers +++ b/libraries/containers @@ -1 +1 @@ -Subproject commit f42e9321dc1ba5f3bc58101b6dec9beb43a80a0a +Subproject commit 6414704b892a6dc56a1b17e3a530d777b70f56ae From git at git.haskell.org Mon Apr 3 02:38:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 3 Apr 2017 02:38:29 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Correctly handle wired in unit IDs in -instantiated-with (55e1053) Message-ID: <20170403023829.7A3583A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/55e1053ef693f2bfcb2eba3d8cc150e03dc4e811/ghc >--------------------------------------------------------------- commit 55e1053ef693f2bfcb2eba3d8cc150e03dc4e811 Author: Edward Z. Yang Date: Sun Mar 26 14:06:12 2017 -0700 Correctly handle wired in unit IDs in -instantiated-with Summary: To handle wired in packages, we must rewrite all occurrences of unit ids like base-4.9.0.0 to base. However, I forgot to do this on unit ids that occurred in unit identifiers passed via -instantiated-with. This patch handles that case, plus a test. Signed-off-by: Edward Z. Yang Test Plan: validate Reviewers: bgamari, austin Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3385 (cherry picked from commit 852a43f360af09416d15777c8f10d704b5423a96) >--------------------------------------------------------------- 55e1053ef693f2bfcb2eba3d8cc150e03dc4e811 compiler/main/Packages.hs | 54 ++++++++++++++-------- testsuite/tests/backpack/cabal/bkpcabal07/M.hs | 1 + .../cabal/{bkpcabal04 => bkpcabal07}/Makefile | 17 ++----- testsuite/tests/backpack/cabal/bkpcabal07/P.hsig | 1 + .../cabal/{bkpcabal01 => bkpcabal07}/Setup.hs | 0 testsuite/tests/backpack/cabal/bkpcabal07/all.T | 9 ++++ .../backpack/cabal/bkpcabal07/bkpcabal07.cabal | 19 ++++++++ 7 files changed, 69 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 55e1053ef693f2bfcb2eba3d8cc150e03dc4e811 From git at git.haskell.org Mon Apr 3 02:38:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 3 Apr 2017 02:38:32 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: rts: Make out-of-memory errors more consistent (de436ff) Message-ID: <20170403023832.33D633A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/de436fff1b8190c3feae1ba3285d788b424e6b1b/ghc >--------------------------------------------------------------- commit de436fff1b8190c3feae1ba3285d788b424e6b1b Author: Ben Gamari Date: Sun Apr 2 19:15:45 2017 -0400 rts: Make out-of-memory errors more consistent This will make it a bit easier to maintain consistent output in the testsuite. (cherry picked from commit 23011765244fe5a3c4583033e019a537278a45a9) >--------------------------------------------------------------- de436fff1b8190c3feae1ba3285d788b424e6b1b rts/hooks/OutOfHeap.c | 2 +- rts/win32/OSMem.c | 2 +- testsuite/tests/rts/overflow1.stderr | 2 +- testsuite/tests/rts/overflow2.stderr | 2 +- testsuite/tests/rts/overflow3.stderr | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rts/hooks/OutOfHeap.c b/rts/hooks/OutOfHeap.c index 3058cdd..20d9809 100644 --- a/rts/hooks/OutOfHeap.c +++ b/rts/hooks/OutOfHeap.c @@ -31,6 +31,6 @@ OutOfHeapHook (W_ request_size, W_ heap_size) /* both sizes in bytes */ } } else { - errorBelch("Out of memory.\n"); + errorBelch("Out of memory\n"); } } diff --git a/rts/win32/OSMem.c b/rts/win32/OSMem.c index 2a54235..ad72ffb 100644 --- a/rts/win32/OSMem.c +++ b/rts/win32/OSMem.c @@ -74,7 +74,7 @@ allocNew(uint32_t n) { rec=0; if (GetLastError() == ERROR_NOT_ENOUGH_MEMORY) { - errorBelch("Out of memory"); + errorBelch("Out of memory\n"); stg_exit(EXIT_HEAPOVERFLOW); } else { sysErrorBelch( diff --git a/testsuite/tests/rts/overflow1.stderr b/testsuite/tests/rts/overflow1.stderr index 77ef3ac..05ec796 100644 --- a/testsuite/tests/rts/overflow1.stderr +++ b/testsuite/tests/rts/overflow1.stderr @@ -1,2 +1,2 @@ -overflow1: Out of memory. +overflow1: Out of memory diff --git a/testsuite/tests/rts/overflow2.stderr b/testsuite/tests/rts/overflow2.stderr index 0e57a8e..9f6cb3b 100644 --- a/testsuite/tests/rts/overflow2.stderr +++ b/testsuite/tests/rts/overflow2.stderr @@ -1,2 +1,2 @@ -overflow2: Out of memory. +overflow2: Out of memory diff --git a/testsuite/tests/rts/overflow3.stderr b/testsuite/tests/rts/overflow3.stderr index aec2225..0526169 100644 --- a/testsuite/tests/rts/overflow3.stderr +++ b/testsuite/tests/rts/overflow3.stderr @@ -1,2 +1,2 @@ -overflow3: Out of memory. +overflow3: Out of memory From git at git.haskell.org Mon Apr 3 02:38:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 3 Apr 2017 02:38:36 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Fix recompilation avoidance bug for implementor of hsig. (21b9729) Message-ID: <20170403023836.46C2F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/21b97298f15ae56121a9621c68ef02a7103052cf/ghc >--------------------------------------------------------------- commit 21b97298f15ae56121a9621c68ef02a7103052cf Author: Edward Z. Yang Date: Sat Mar 25 22:50:55 2017 -0700 Fix recompilation avoidance bug for implementor of hsig. Summary: I observed a bug where if I modified the module which implemented an hsig in another package, GHC would not recompile the signature in this situation. The root cause was that we were conflating modules from user imports, and "system" module dependencies (from signature merging and instantiation.) So this patch handles them separately. Signed-off-by: Edward Z. Yang Test Plan: validate Reviewers: simonpj, bgamari, austin Subscribers: rwbarton, thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3381 (cherry picked from commit 5fb485a3e1e83a1f5c6acf989be292940229e1a4) >--------------------------------------------------------------- 21b97298f15ae56121a9621c68ef02a7103052cf compiler/deSugar/DsUsage.hs | 18 +++++++++++++----- compiler/iface/MkIface.hs | 10 ++++++++-- compiler/main/HscMain.hs | 3 ++- compiler/main/HscTypes.hs | 17 +++++++++++++++-- compiler/rename/RnEnv.hs | 2 +- compiler/rename/RnNames.hs | 9 ++++----- compiler/typecheck/TcBackpack.hs | 6 +++--- compiler/typecheck/TcRnExports.hs | 3 ++- testsuite/tests/backpack/cabal/bkpcabal06/.gitignore | 1 + .../backpack/cabal/{bkpcabal05 => bkpcabal06}/Makefile | 9 ++++----- .../backpack/cabal/{bkpcabal01 => bkpcabal06}/Setup.hs | 0 testsuite/tests/backpack/cabal/bkpcabal06/all.T | 9 +++++++++ .../bkpcabal07.cabal => bkpcabal06/bkpcabal06.cabal} | 15 ++++++++++----- .../tests/backpack/cabal/bkpcabal06/bkpcabal06.stderr | 4 ++++ .../P.hs => backpack/cabal/bkpcabal06/impl/P.hs.in1} | 2 +- .../P.hs => backpack/cabal/bkpcabal06/impl/P.hs.in2} | 1 - .../cabal/{bkpcabal07 => bkpcabal06/sig}/P.hsig | 1 + 17 files changed, 78 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 21b97298f15ae56121a9621c68ef02a7103052cf From git at git.haskell.org Mon Apr 3 02:38:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 3 Apr 2017 02:38:38 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: array: Clear up inconsistency in T9220 output (dc71bfe) Message-ID: <20170403023839.0034E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/dc71bfe088f003d5a66010a13cf4d4b7b7f88700/ghc >--------------------------------------------------------------- commit dc71bfe088f003d5a66010a13cf4d4b7b7f88700 Author: Ben Gamari Date: Sun Apr 2 13:04:26 2017 -0400 array: Clear up inconsistency in T9220 output ghc-8.2 and master disagreed on the order of the instances. Normalise this difference away. Updates array submodule. (cherry picked from commit 60307cb85abc8d53845598a430c0ee9264fb2d82) >--------------------------------------------------------------- dc71bfe088f003d5a66010a13cf4d4b7b7f88700 libraries/array | 2 +- testsuite/driver/testlib.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/libraries/array b/libraries/array index 3a77ef5..db07d53 160000 --- a/libraries/array +++ b/libraries/array @@ -1 +1 @@ -Subproject commit 3a77ef51f0f3292a9a0bea25c5954e2e3f61521d +Subproject commit db07d534feb267d5f81e1301f6a0cb726c4c2ea2 diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index 7dedb33..a5da1e9 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -493,6 +493,13 @@ def no_check_hp(name, opts): # ---- +def filter_stdout_lines( regex ): + """ Filter lines of stdout with the given regular expression """ + import re + def f( name, opts ): + _normalise_fun(name, opts, lambda s: '\n'.join(re.findall(regex, s))) + return f + def normalise_slashes( name, opts ): _normalise_fun(name, opts, normalise_slashes_) From git at git.haskell.org Mon Apr 3 02:38:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 3 Apr 2017 02:38:42 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Various testsuite fixes for 32-bit Windows (7d9db0a) Message-ID: <20170403023842.0F7983A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/7d9db0a00ddaff3d5754c9a0c4f87a5bb01e404d/ghc >--------------------------------------------------------------- commit 7d9db0a00ddaff3d5754c9a0c4f87a5bb01e404d Author: Ben Gamari Date: Sun Apr 2 17:10:48 2017 -0400 Various testsuite fixes for 32-bit Windows (cherry picked from commit f8ecc5847285d68055c3340ee4b4bb4a3052b966) >--------------------------------------------------------------- 7d9db0a00ddaff3d5754c9a0c4f87a5bb01e404d testsuite/tests/perf/haddock/all.T | 6 ++++-- testsuite/tests/perf/should_run/all.T | 10 ++++++---- ...ngw32 => T11223_link_order_a_b_2_fail.stderr-ws-32-mingw32} | 4 ++-- ...ngw32 => T11223_link_order_a_b_2_fail.stderr-ws-64-mingw32} | 0 ...ingw32 => T11223_simple_duplicate_lib.stderr-ws-32-mingw32} | 4 ++-- ...ingw32 => T11223_simple_duplicate_lib.stderr-ws-64-mingw32} | 0 testsuite/tests/rts/T11223/all.T | 1 + testsuite/tests/rts/T7037_main.c | 2 +- 8 files changed, 16 insertions(+), 11 deletions(-) diff --git a/testsuite/tests/perf/haddock/all.T b/testsuite/tests/perf/haddock/all.T index 0ad07ec..7e53386 100644 --- a/testsuite/tests/perf/haddock/all.T +++ b/testsuite/tests/perf/haddock/all.T @@ -40,12 +40,13 @@ test('haddock.base', # 2017-02-17: 38425793776 (x86_64/Linux) - Generalize kind of (->) # 2017-02-12: 25592972912 (x86_64/Linux) - Type-indexed Typeable - ,(platform('i386-unknown-mingw32'), 4434804940, 5) + ,(platform('i386-unknown-mingw32'), 2885173512, 5) # 2013-02-10: 3358693084 (x86/Windows) # 2013-11-13: 3097751052 (x86/Windows, 64bit machine) # 2014-04-04: 3548581572 (x86/Windows, 64bit machine) # 2014-12-01: 4202377432 (x86/Windows, 64bit machine) # 2015-01-20: 4434804940 (x86/Windows, 64bit machine) + # 2017-04-02: 2885173512 update ,(wordsize(32), 3819657568, 5)]) # 2012-08-14: 3046487920 (x86/OSX) @@ -150,12 +151,13 @@ test('haddock.compiler', # 2017-02-11: 62070477608 (amd64/Linux) OccurAnal / One-Shot (#13227) (and others) # 2017-02-25: 55777283352 (amd64/Linux) Early inline patch - ,(platform('i386-unknown-mingw32'), 902576468, 10) + ,(platform('i386-unknown-mingw32'), 367546388, 10) # 2012-10-30: 13773051312 (x86/Windows) # 2013-02-10: 14925262356 (x86/Windows) # 2013-11-13: 14328363592 (x86/Windows, 64bit machine) # 2014-12-01: 104140852 (x86/Windows, sudden shrinkage!) # 2014-12-10: 217933548 increased again + # 2017-04-02: 367546388 update ,(wordsize(32), 137383060, 5)]) # 2012-08-14: 13471797488 (x86/OSX) diff --git a/testsuite/tests/perf/should_run/all.T b/testsuite/tests/perf/should_run/all.T index 1d169fa..52a0762 100644 --- a/testsuite/tests/perf/should_run/all.T +++ b/testsuite/tests/perf/should_run/all.T @@ -109,6 +109,7 @@ test('T876', [(platform('x86_64-unknown-mingw32'), 66928, 5), # 2015-04-03: 71904 (amd64/Windows, unknown cause) # 2016-11-27: 66928 (amd64/Windows, unknown cause) + (wordsize(64), 58128, 5), # 2013-02-14: 1263712 (x86_64/Linux) # 2014-02-10: 63216 (x86_64/Linux), call arity analysis @@ -342,10 +343,11 @@ test('T7436', # 127000 (amd64/Linux) # 2013-02-07: 60360 (amd64/Linux) # 2015-04-03: Widen 1->4% (amd64/Windows was doing better) - (wordsize(32), 42772, 1)]), - # 2013-02-10: 58032 (x86/Windows) - # 2013-02-10: 58836 (x86/OSX) - # 2017-03-24: 42772 (x86/Linux, 64-bit machine) no idea why + (wordsize(32), 42772, 4)]), + # 2013-02-10: 58032 (x86/Windows) + # 2013-02-10: 58836 (x86/OSX) + # 2017-03-24: 42772 (x86/Linux, 64-bit machine) no idea why + # 2017-04-02: Widen 1->4% (i386/Windows was doing better) only_ways(['normal']) ], compile_and_run, 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-ws-32-mingw32 similarity index 92% copy from testsuite/tests/rts/T11223/T11223_link_order_a_b_2_fail.stderr-mingw32 copy to testsuite/tests/rts/T11223/T11223_link_order_a_b_2_fail.stderr-ws-32-mingw32 index 1fea3e2..73d736c 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-ws-32-mingw32 @@ -1,5 +1,5 @@ GHC runtime linker: fatal error: I found a duplicate definition for symbol - a + _a whilst processing object file 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 @@ -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.exe: ^^ Could not load 'c', dependency unresolved. See top entry above. +ghc-stage2.exe: ^^ 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-ws-64-mingw32 similarity index 100% rename from testsuite/tests/rts/T11223/T11223_link_order_a_b_2_fail.stderr-mingw32 rename to testsuite/tests/rts/T11223/T11223_link_order_a_b_2_fail.stderr-ws-64-mingw32 diff --git a/testsuite/tests/rts/T11223/T11223_simple_duplicate_lib.stderr-mingw32 b/testsuite/tests/rts/T11223/T11223_simple_duplicate_lib.stderr-ws-32-mingw32 similarity index 92% copy from testsuite/tests/rts/T11223/T11223_simple_duplicate_lib.stderr-mingw32 copy to testsuite/tests/rts/T11223/T11223_simple_duplicate_lib.stderr-ws-32-mingw32 index 4d4656f..48245cc 100644 --- a/testsuite/tests/rts/T11223/T11223_simple_duplicate_lib.stderr-mingw32 +++ b/testsuite/tests/rts/T11223/T11223_simple_duplicate_lib.stderr-ws-32-mingw32 @@ -1,5 +1,5 @@ GHC runtime linker: fatal error: I found a duplicate definition for symbol - a + _a whilst processing object file 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 @@ -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.exe: ^^ Could not load 'c', dependency unresolved. See top entry above. +ghc-stage2.exe: ^^ 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-ws-64-mingw32 similarity index 100% rename from testsuite/tests/rts/T11223/T11223_simple_duplicate_lib.stderr-mingw32 rename to testsuite/tests/rts/T11223/T11223_simple_duplicate_lib.stderr-ws-64-mingw32 diff --git a/testsuite/tests/rts/T11223/all.T b/testsuite/tests/rts/T11223/all.T index 0a578c0..6656e7f 100644 --- a/testsuite/tests/rts/T11223/all.T +++ b/testsuite/tests/rts/T11223/all.T @@ -34,6 +34,7 @@ test('T11223_simple_duplicate', test('T11223_simple_duplicate_lib', [extra_files(['bar.c', 'foo.c', 'foo.hs']), + when(platform('i386-unknown-mingw32'), expect_broken(13515)), when(ghc_dynamic(), skip), normalise_errmsg_fun(normalise_duplicate_errmsg)], run_command, ['$MAKE -s --no-print-directory t_11223_simple_duplicate_lib']) diff --git a/testsuite/tests/rts/T7037_main.c b/testsuite/tests/rts/T7037_main.c index ce7fa65..b85b98e 100644 --- a/testsuite/tests/rts/T7037_main.c +++ b/testsuite/tests/rts/T7037_main.c @@ -2,6 +2,6 @@ #include int main(int argc, char *argv[]) { - T7037_CONST char * args[2] = {"T7037", NULL}; + char * T7037_CONST args[2] = {"T7037", NULL}; execv("./T7037", args); } From git at git.haskell.org Mon Apr 3 02:38:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 3 Apr 2017 02:38:44 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: testsuite: Classify missing expected perf numbers as merely warnings (dfe462b) Message-ID: <20170403023844.BD86E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/dfe462b71abacd60ece1c6fc783fbd26407f4370/ghc >--------------------------------------------------------------- commit dfe462b71abacd60ece1c6fc783fbd26407f4370 Author: Ben Gamari Date: Sun Apr 2 17:20:34 2017 -0400 testsuite: Classify missing expected perf numbers as merely warnings Previously these were considered to be framework failures, meaning that validate would fail. For better or worse, Windows lacks a good number of metrics and I don't see this changing any time soon. Let's consider these to be non-fatal. (cherry picked from commit 597ea1cdca4c127a0a9ad936645c416df80a907b) >--------------------------------------------------------------- dfe462b71abacd60ece1c6fc783fbd26407f4370 testsuite/driver/testglobals.py | 1 + testsuite/driver/testlib.py | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/testsuite/driver/testglobals.py b/testsuite/driver/testglobals.py index 9f37e1a..fc050e6 100644 --- a/testsuite/driver/testglobals.py +++ b/testsuite/driver/testglobals.py @@ -138,6 +138,7 @@ class TestRun: self.missing_libs = [] self.framework_failures = [] + self.framework_warnings = [] self.unexpected_passes = [] self.unexpected_failures = [] diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index a5da1e9..457e380 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -324,7 +324,7 @@ def _stats_num_field( name, opts, field, expecteds ): if b: opts.stats_range_fields[field] = (expected, dev) return - framework_fail(name, 'numfield-no-expected', 'No expected value found for ' + field + ' in num_field check') + framework_warn(name, 'numfield-no-expected', 'No expected value found for ' + field + ' in num_field check') else: (expected, dev) = expecteds @@ -347,7 +347,7 @@ def _compiler_stats_num_field( name, opts, field, expecteds ): opts.compiler_stats_range_fields[field] = (expected, dev) return - framework_fail(name, 'numfield-no-expected', 'No expected value found for ' + field + ' in num_field check') + framework_warn(name, 'numfield-no-expected', 'No expected value found for ' + field + ' in num_field check') # ----- @@ -893,6 +893,13 @@ def framework_fail(name, way, reason): if_verbose(1, '*** framework failure for %s %s ' % (full_name, reason)) t.framework_failures.append((directory, name, way, reason)) +def framework_warn(name, way, reason): + opts = getTestOpts() + directory = re.sub('^\\.[/\\\\]', '', opts.testdir) + full_name = name + '(' + way + ')' + if_verbose(1, '*** framework warning for %s %s ' % (full_name, reason)) + t.framework_warnings.append((directory, name, way, reason)) + def badResult(result): try: if result['passFail'] == 'pass': @@ -1990,6 +1997,8 @@ def summary(t, file, short=False): + '\n' + repr(len(t.framework_failures)).rjust(8) + ' caused framework failures\n' + + repr(len(t.framework_warnings)).rjust(8) + + ' caused framework warnings\n' + repr(len(t.unexpected_passes)).rjust(8) + ' unexpected passes\n' + repr(len(t.unexpected_failures)).rjust(8) @@ -2014,6 +2023,10 @@ def summary(t, file, short=False): file.write('Framework failures:\n') printTestInfosSummary(file, t.framework_failures) + if t.framework_warnings: + file.write('Framework warnings:\n') + printTestInfosSummary(file, t.framework_warnings) + if stopping(): file.write('WARNING: Testsuite run was terminated early\n') From git at git.haskell.org Mon Apr 3 09:21:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 3 Apr 2017 09:21:31 +0000 (UTC) Subject: [commit: ghc] master: Fix validate. (f541fc6) Message-ID: <20170403092131.0D69A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f541fc63060aa5806c18cbaa5ef05dd180c52ebb/ghc >--------------------------------------------------------------- commit f541fc63060aa5806c18cbaa5ef05dd180c52ebb Author: Edward Z. Yang Date: Mon Apr 3 02:21:09 2017 -0700 Fix validate. Signed-off-by: Edward Z. Yang >--------------------------------------------------------------- f541fc63060aa5806c18cbaa5ef05dd180c52ebb compiler/deSugar/DsUsage.hs | 1 - 1 file changed, 1 deletion(-) diff --git a/compiler/deSugar/DsUsage.hs b/compiler/deSugar/DsUsage.hs index aa9efd9..25d8254 100644 --- a/compiler/deSugar/DsUsage.hs +++ b/compiler/deSugar/DsUsage.hs @@ -185,7 +185,6 @@ mk_mod_usage_info pit hsc_env this_mod direct_imports used_names -- across all imports, why did the old code only look -- at the first import? Just bys -> (True, any by_is_safe bys) - Just _ -> pprPanic "mkUsage: empty direct import" Outputable.empty Nothing -> (False, safeImplicitImpsReq dflags) -- Nothing case is for references to entities which were -- not directly imported (NB: the "implicit" Prelude import From git at git.haskell.org Mon Apr 3 09:26:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 3 Apr 2017 09:26:04 +0000 (UTC) Subject: [commit: ghc] master: hp2ps: install shell wrapper (1e58efb) Message-ID: <20170403092604.CB9793A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1e58efb16f76b52c059d5e5d6c4c5d91c2abaad2/ghc >--------------------------------------------------------------- commit 1e58efb16f76b52c059d5e5d6c4c5d91c2abaad2 Author: Sergei Trofimovich Date: Mon Apr 3 08:55:04 2017 +0100 hp2ps: install shell wrapper Before this change we installed hp2ps both to inplace/bin/ and ${prefix}/bin/ In both cases we added $(CrossCompilePrefix) as a binary prefix. It's incorrect for inplace install as none of inplace binaries are prefixed. The change it to track 'hp2ps' as unprefixed binary. $(CrossCompilePrefix) prefix is only added to the installed shell wrapper. Now 'hp2ps' is handled in a similar way to 'hpc' and 'ghc-pkg'. Signed-off-by: Sergei Trofimovich >--------------------------------------------------------------- 1e58efb16f76b52c059d5e5d6c4c5d91c2abaad2 utils/hp2ps/ghc.mk | 5 +++-- utils/{hpc/hpc.wrapper => hp2ps/hp2ps.wrapper} | 0 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/utils/hp2ps/ghc.mk b/utils/hp2ps/ghc.mk index 64a3a6d..f6e01ec 100644 --- a/utils/hp2ps/ghc.mk +++ b/utils/hp2ps/ghc.mk @@ -16,11 +16,12 @@ utils/hp2ps_dist_C_SRCS = AreaBelow.c Curves.c Error.c Main.c \ Axes.c Dimensions.c Key.c PsFile.c Shade.c \ Utilities.c utils/hp2ps_dist_EXTRA_LIBRARIES = m -utils/hp2ps_dist_PROGNAME = $(CrossCompilePrefix)hp2ps +utils/hp2ps_dist_PROGNAME = hp2ps utils/hp2ps_dist_INSTALL = YES utils/hp2ps_dist_INSTALL_INPLACE = YES +utils/hp2ps_dist_SHELL_WRAPPER = YES +utils/hp2ps_dist_INSTALL_SHELL_WRAPPER_NAME = hp2ps utils/hp2ps_CC_OPTS += $(addprefix -I,$(GHC_INCLUDE_DIRS)) $(eval $(call build-prog,utils/hp2ps,dist,0)) - diff --git a/utils/hpc/hpc.wrapper b/utils/hp2ps/hp2ps.wrapper similarity index 100% copy from utils/hpc/hpc.wrapper copy to utils/hp2ps/hp2ps.wrapper From git at git.haskell.org Mon Apr 3 10:48:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 3 Apr 2017 10:48:04 +0000 (UTC) Subject: [commit: ghc] wip/mpickering-unfolding-discounts: Tweak unfolding defaults (9d6d205) Message-ID: <20170403104804.D57423A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/mpickering-unfolding-discounts Link : http://ghc.haskell.org/trac/ghc/changeset/9d6d205a4fdf36ecad50ba5fe88f956a7e3ce16a/ghc >--------------------------------------------------------------- commit 9d6d205a4fdf36ecad50ba5fe88f956a7e3ce16a Author: Matthew Pickering Date: Wed Mar 29 11:20:36 2017 +0100 Tweak unfolding defaults >--------------------------------------------------------------- 9d6d205a4fdf36ecad50ba5fe88f956a7e3ce16a compiler/main/DynFlags.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index a4095f1..97921c6 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -1675,8 +1675,8 @@ defaultDynFlags mySettings = -- E.g. 450 is not enough in 'fulsom' for Interval.sqr to inline -- into Csg.calc (The unfolding for sqr never makes it into the -- interface file.) - ufCreationThreshold = 750, - ufUseThreshold = 60, + ufCreationThreshold = 2000, + ufUseThreshold = 400, ufFunAppDiscount = 60, -- Be fairly keen to inline a function if that means -- we'll be able to pick the right method from a dictionary From git at git.haskell.org Mon Apr 3 10:48:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 3 Apr 2017 10:48:07 +0000 (UTC) Subject: [commit: ghc] wip/mpickering-unfolding-discounts's head updated: Tweak unfolding defaults (9d6d205) Message-ID: <20170403104807.65EEE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/mpickering-unfolding-discounts' now includes: 8674883 Allow unbound Refl binders in a RULE 60d338f Add a couple of HasDebugCallStack contexts f88ac37 Fix ASSERT failure in TcErrors 01e1298 cg057: accept output 5ebf83e Fix scc001 fb7e5bd testsuite: More 32-bit performance changes b04ded8 base: Check for path separators chars in openTempFile' template string 5856c56 Fixed error messages for RecursiveDo (#8501) 04ea4c3 Print module when dumping rules 154d224 Allow operators as record pattern synonym fields 81f5b6e Check TargetPlatform instead of HostPlatform for leading underscore 924a65f Various patches to support android cross compilation 26c95f4 Show valid substitutions for typed holes 01b062e unique: fix UNIQUE_BITS crosscompilation (Trac #13491) ff7094e Typos in comments [ci skip] 69f070d Deriving for phantom and empty types 03c7dd0 Disable bogus lint checks about levity polimorphic coerions 2964527 Refactor simplExpr (Type ty) 6575f4b Clean up coreView/tcView. e13419c Fix space leaks in simplifier (#13426) 546c2a1 testsuite: Update Windows allocations for T12234 3082879 askCc should be using the linker, not the compiler 71916e1 Remove Core Lint pass on occurrence analysis output (#13220) 74615f4 UNREG: ignore -fllvm (Trac #13495) a094aa7 rts: print incorrect prev_what_next 616a3b4 testsuite: Add regression test for #13474 83ac462 Don't derive showList 3b5f786 Optimise common cases of GHC.setProgramDynFlags f2b10f3 Stamp out space leaks from demand analysis 03e3425 compiler/ghc.mk: fix GhcWithInterpreter=NO build failure d89b047 FastMutInt: fix Int and Ptr sizes when crosscompiling 61ba451 Report heap overflow in the same way as stack overflow dfac365 :cd affects the iserv process too 4ed3397 testsuite: Fix GhciCurDir test d724ce3 Add a perf test for deriving null 115e7eb Update containers submodule to official 0.5.10.2 cb18447 configure.ac: fix NCG support in --target= 9d6d205 Tweak unfolding defaults From git at git.haskell.org Tue Apr 4 01:34:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 4 Apr 2017 01:34:54 +0000 (UTC) Subject: [commit: ghc] master: Bump Win32 submodule (e815901) Message-ID: <20170404013454.9FBD23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e815901d8f1d0e8c6916fcf0e87c68998475407e/ghc >--------------------------------------------------------------- commit e815901d8f1d0e8c6916fcf0e87c68998475407e Author: Ben Gamari Date: Mon Apr 3 19:00:33 2017 -0400 Bump Win32 submodule Fixes #13514. >--------------------------------------------------------------- e815901d8f1d0e8c6916fcf0e87c68998475407e libraries/Win32 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/Win32 b/libraries/Win32 index 67c5cc5..b5ebb64 160000 --- a/libraries/Win32 +++ b/libraries/Win32 @@ -1 +1 @@ -Subproject commit 67c5cc56f0faeacc553471c8a7d9b9b95e011731 +Subproject commit b5ebb64894cf166f9ee84ee91802486c76e480cf From git at git.haskell.org Tue Apr 4 01:34:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 4 Apr 2017 01:34:57 +0000 (UTC) Subject: [commit: ghc] master: compact: Clarify mutability restriction (38f9ead) Message-ID: <20170404013457.53C1A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/38f9eadd8e4746c2fabf83045073134f5a554a06/ghc >--------------------------------------------------------------- commit 38f9eadd8e4746c2fabf83045073134f5a554a06 Author: Ben Gamari Date: Mon Apr 3 19:27:59 2017 -0400 compact: Clarify mutability restriction Fixes #13508. [skip ci] Test Plan: Read it Reviewers: austin Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3407 >--------------------------------------------------------------- 38f9eadd8e4746c2fabf83045073134f5a554a06 libraries/ghc-compact/GHC/Compact.hs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/libraries/ghc-compact/GHC/Compact.hs b/libraries/ghc-compact/GHC/Compact.hs index 0464bc6..ea0663e 100644 --- a/libraries/ghc-compact/GHC/Compact.hs +++ b/libraries/ghc-compact/GHC/Compact.hs @@ -130,9 +130,9 @@ import GHC.Types -- address (the address might be stored in a C data structure, for -- example), so we can't make a copy of it to store in the 'Compact'. -- --- * Objects with mutable pointer fields also cannot be compacted, --- because subsequent mutation would destroy the property that a compact is --- self-contained. +-- * Objects with mutable pointer fields (e.g. 'Data.IORef.IORef', +-- 'GHC.Array.MutableArray') also cannot be compacted, because subsequent +-- mutation would destroy the property that a compact is self-contained. -- -- If compaction encounters any of the above, a 'CompactionFailed' -- exception will be thrown by the compaction operation. @@ -186,9 +186,10 @@ getCompact (Compact _ obj _) = obj -- not terminate if the structure contains cycles (use 'compactWithSharing' -- instead). -- --- The object in question must not contain any functions or mutable data; if it --- does, 'compact' will raise an exception. In the future, we may add a type --- class which will help statically check if this is the case or not. +-- The object in question must not contain any functions or data with mutable +-- pointers; if it does, 'compact' will raise an exception. In the future, we +-- may add a type class which will help statically check if this is the case or +-- not. -- compact :: a -> IO (Compact a) compact = compactSized 31268 False @@ -200,9 +201,10 @@ compact = compactSized 31268 False -- by maintaining a hash table mapping uncompacted objects to -- compacted objects. -- --- The object in question must not contain any functions or mutable data; if it --- does, 'compact' will raise an exception. In the future, we may add a type --- class which will help statically check if this is the case or not. +-- The object in question must not contain any functions or data with mutable +-- pointers; if it does, 'compact' will raise an exception. In the future, we +-- may add a type class which will help statically check if this is the case or +-- not. -- compactWithSharing :: a -> IO (Compact a) compactWithSharing = compactSized 31268 True From git at git.haskell.org Tue Apr 4 02:09:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 4 Apr 2017 02:09:08 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: hp2ps: install shell wrapper (5769f4c) Message-ID: <20170404020908.C3BBC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/5769f4c4c94e78f79ecded94cfdc95ebbcbcd28a/ghc >--------------------------------------------------------------- commit 5769f4c4c94e78f79ecded94cfdc95ebbcbcd28a Author: Sergei Trofimovich Date: Mon Apr 3 08:55:04 2017 +0100 hp2ps: install shell wrapper Before this change we installed hp2ps both to inplace/bin/ and ${prefix}/bin/ In both cases we added $(CrossCompilePrefix) as a binary prefix. It's incorrect for inplace install as none of inplace binaries are prefixed. The change it to track 'hp2ps' as unprefixed binary. $(CrossCompilePrefix) prefix is only added to the installed shell wrapper. Now 'hp2ps' is handled in a similar way to 'hpc' and 'ghc-pkg'. Signed-off-by: Sergei Trofimovich (cherry picked from commit 1e58efb16f76b52c059d5e5d6c4c5d91c2abaad2) >--------------------------------------------------------------- 5769f4c4c94e78f79ecded94cfdc95ebbcbcd28a utils/hp2ps/ghc.mk | 5 +++-- utils/{hpc/hpc.wrapper => hp2ps/hp2ps.wrapper} | 0 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/utils/hp2ps/ghc.mk b/utils/hp2ps/ghc.mk index 64a3a6d..f6e01ec 100644 --- a/utils/hp2ps/ghc.mk +++ b/utils/hp2ps/ghc.mk @@ -16,11 +16,12 @@ utils/hp2ps_dist_C_SRCS = AreaBelow.c Curves.c Error.c Main.c \ Axes.c Dimensions.c Key.c PsFile.c Shade.c \ Utilities.c utils/hp2ps_dist_EXTRA_LIBRARIES = m -utils/hp2ps_dist_PROGNAME = $(CrossCompilePrefix)hp2ps +utils/hp2ps_dist_PROGNAME = hp2ps utils/hp2ps_dist_INSTALL = YES utils/hp2ps_dist_INSTALL_INPLACE = YES +utils/hp2ps_dist_SHELL_WRAPPER = YES +utils/hp2ps_dist_INSTALL_SHELL_WRAPPER_NAME = hp2ps utils/hp2ps_CC_OPTS += $(addprefix -I,$(GHC_INCLUDE_DIRS)) $(eval $(call build-prog,utils/hp2ps,dist,0)) - diff --git a/utils/hpc/hpc.wrapper b/utils/hp2ps/hp2ps.wrapper similarity index 100% copy from utils/hpc/hpc.wrapper copy to utils/hp2ps/hp2ps.wrapper From git at git.haskell.org Tue Apr 4 02:09:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 4 Apr 2017 02:09:11 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Bump Win32 submodule (fb90e69) Message-ID: <20170404020911.85A933A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/fb90e692daf782bade1c8a040b1c32c5aba4f05d/ghc >--------------------------------------------------------------- commit fb90e692daf782bade1c8a040b1c32c5aba4f05d Author: Ben Gamari Date: Mon Apr 3 19:00:33 2017 -0400 Bump Win32 submodule Fixes #13514. (cherry picked from commit e815901d8f1d0e8c6916fcf0e87c68998475407e) >--------------------------------------------------------------- fb90e692daf782bade1c8a040b1c32c5aba4f05d libraries/Win32 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/Win32 b/libraries/Win32 index 67c5cc5..b5ebb64 160000 --- a/libraries/Win32 +++ b/libraries/Win32 @@ -1 +1 @@ -Subproject commit 67c5cc56f0faeacc553471c8a7d9b9b95e011731 +Subproject commit b5ebb64894cf166f9ee84ee91802486c76e480cf From git at git.haskell.org Tue Apr 4 02:09:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 4 Apr 2017 02:09:14 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: compact: Clarify mutability restriction (8134f7d) Message-ID: <20170404020914.3F0633A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/8134f7d4ba2c14b2f24d2f4c1f5260fcaff3304a/ghc >--------------------------------------------------------------- commit 8134f7d4ba2c14b2f24d2f4c1f5260fcaff3304a Author: Ben Gamari Date: Mon Apr 3 19:27:59 2017 -0400 compact: Clarify mutability restriction Fixes #13508. [skip ci] Test Plan: Read it Reviewers: austin Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3407 (cherry picked from commit 38f9eadd8e4746c2fabf83045073134f5a554a06) >--------------------------------------------------------------- 8134f7d4ba2c14b2f24d2f4c1f5260fcaff3304a libraries/ghc-compact/GHC/Compact.hs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/libraries/ghc-compact/GHC/Compact.hs b/libraries/ghc-compact/GHC/Compact.hs index d9581a5..fcb8c43 100644 --- a/libraries/ghc-compact/GHC/Compact.hs +++ b/libraries/ghc-compact/GHC/Compact.hs @@ -130,9 +130,9 @@ import GHC.Types -- address (the address might be stored in a C data structure, for -- example), so we can't make a copy of it to store in the 'Compact'. -- --- * Objects with mutable pointer fields also cannot be compacted, --- because subsequent mutation would destroy the property that a compact is --- self-contained. +-- * Objects with mutable pointer fields (e.g. 'Data.IORef.IORef', +-- 'GHC.Array.MutableArray') also cannot be compacted, because subsequent +-- mutation would destroy the property that a compact is self-contained. -- -- If compaction encounters any of the above, a 'CompactionFailed' -- exception will be thrown by the compaction operation. @@ -186,9 +186,10 @@ getCompact (Compact _ obj _) = obj -- not terminate if the structure contains cycles (use 'compactWithSharing' -- instead). -- --- The object in question must not contain any functions or mutable data; if it --- does, 'compact' will raise an exception. In the future, we may add a type --- class which will help statically check if this is the case or not. +-- The object in question must not contain any functions or data with mutable +-- pointers; if it does, 'compact' will raise an exception. In the future, we +-- may add a type class which will help statically check if this is the case or +-- not. -- compact :: a -> IO (Compact a) compact = compactSized 31268 False @@ -200,9 +201,10 @@ compact = compactSized 31268 False -- by maintaining a hash table mapping uncompacted objects to -- compacted objects. -- --- The object in question must not contain any functions or mutable data; if it --- does, 'compact' will raise an exception. In the future, we may add a type --- class which will help statically check if this is the case or not. +-- The object in question must not contain any functions or data with mutable +-- pointers; if it does, 'compact' will raise an exception. In the future, we +-- may add a type class which will help statically check if this is the case or +-- not. -- compactWithSharing :: a -> IO (Compact a) compactWithSharing = compactSized 31268 True From git at git.haskell.org Tue Apr 4 02:25:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 4 Apr 2017 02:25:53 +0000 (UTC) Subject: [commit: ghc] master: Revert "Make raiseIO# produce topRes" (e83af07) Message-ID: <20170404022553.0C2323A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e83af07e3d0b65fe6f37806e86d07f3e8dc1b01e/ghc >--------------------------------------------------------------- commit e83af07e3d0b65fe6f37806e86d07f3e8dc1b01e Author: David Feuer Date: Mon Apr 3 22:25:55 2017 -0400 Revert "Make raiseIO# produce topRes" This reverts commit da4687f63ffe5a6162e3d7856aa53de048dd0f42. It's not entirely trivial to clean up the dead code this patch introduced. In particular, when we see ``` case raiseIO# m s of s' -> e ``` we want to know that `e` is dead. For scrutinees that are properly bottom (which we don't want to consider `raiseIO# m s` to be, this is handled by rewriting `bot` to `case bot of {}`. But if we do that for `raiseIO#`, we end up with ``` case raiseIO# m s of {} ``` which looks a lot like bottom and could confuse demand analysis. I think we need to wait with this change until we have a more complete story. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3413 >--------------------------------------------------------------- e83af07e3d0b65fe6f37806e86d07f3e8dc1b01e compiler/prelude/primops.txt.pp | 10 ++++++---- testsuite/tests/stranal/should_run/all.T | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp index c16bc74..8c936c6 100644 --- a/compiler/prelude/primops.txt.pp +++ b/compiler/prelude/primops.txt.pp @@ -2019,9 +2019,11 @@ primop RaiseOp "raise#" GenPrimOp -- must be *precise* - we don't want the strictness analyser turning -- one kind of bottom into another, as it is allowed to do in pure code. -- --- We currently produce topRes, which is much too conservative (interfering --- with dead code elimination, unfortunately), but nothing else we currently --- have on tap is actually correct. +-- But we *do* want to know that it returns bottom after +-- being applied to two arguments, so that this function is strict in y +-- f x y | x>0 = raiseIO blah +-- | y>0 = return 1 +-- | otherwise = return 2 -- -- TODO Check that the above notes on @f@ are valid. The function successfully -- produces an IO exception when compiled without optimization. If we analyze @@ -2033,7 +2035,7 @@ primop RaiseOp "raise#" GenPrimOp primop RaiseIOOp "raiseIO#" GenPrimOp a -> State# RealWorld -> (# State# RealWorld, b #) with - strictness = { \ _arity -> mkClosedStrictSig [topDmd, topDmd] topRes } + strictness = { \ _arity -> mkClosedStrictSig [topDmd, topDmd] exnRes } out_of_line = True has_side_effects = True diff --git a/testsuite/tests/stranal/should_run/all.T b/testsuite/tests/stranal/should_run/all.T index a07900b..0764746 100644 --- a/testsuite/tests/stranal/should_run/all.T +++ b/testsuite/tests/stranal/should_run/all.T @@ -14,4 +14,4 @@ test('T11076', normal, multimod_compile_and_run, ['T11076.hs', 'T11076_prim.cmm' test('T11555a', normal, compile_and_run, ['']) test('T12368', exit_code(1), compile_and_run, ['']) test('T12368a', exit_code(1), compile_and_run, ['']) -test('T13380', exit_code(1), compile_and_run, ['']) +test('T13380', [expect_broken(13380), exit_code(1)], compile_and_run, ['']) From git at git.haskell.org Tue Apr 4 14:13:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 4 Apr 2017 14:13:56 +0000 (UTC) Subject: [commit: ghc] wip/cheap-build: Move forcing of enumFromT arguemnts inwards (e21eac3) Message-ID: <20170404141356.E9B653A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/cheap-build Link : http://ghc.haskell.org/trac/ghc/changeset/e21eac3a4f0503ea3f6e53eef62226cf4f53c574/ghc >--------------------------------------------------------------- commit e21eac3a4f0503ea3f6e53eef62226cf4f53c574 Author: Simon Peyton Jones Date: Tue Apr 4 15:13:02 2017 +0100 Move forcing of enumFromT arguemnts inwards Proof of concept. See comments on Trac #13422 >--------------------------------------------------------------- e21eac3a4f0503ea3f6e53eef62226cf4f53c574 libraries/base/GHC/Enum.hs | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/libraries/base/GHC/Enum.hs b/libraries/base/GHC/Enum.hs index 1df43b0..c65db90 100644 --- a/libraries/base/GHC/Enum.hs +++ b/libraries/base/GHC/Enum.hs @@ -435,12 +435,12 @@ instance Enum Int where fromEnum x = x {-# INLINE enumFrom #-} - enumFrom (I# x) = eftInt x maxInt# - where !(I# maxInt#) = maxInt + enumFrom x = eftInt x maxInt +-- where !(I# maxInt#) = maxInt -- Blarg: technically I guess enumFrom isn't strict! {-# INLINE enumFromTo #-} - enumFromTo (I# x) (I# y) = eftInt x y + enumFromTo x y = eftInt x y {-# INLINE enumFromThen #-} enumFromThen (I# x1) (I# x2) = efdInt x1 x2 @@ -467,24 +467,25 @@ instance Enum Int where -} {-# NOINLINE [1] eftInt #-} -eftInt :: Int# -> Int# -> [Int] +eftInt :: Int -> Int -> [Int] -- [x1..x2] -eftInt x0 y | isTrue# (x0 ># y) = [] - | otherwise = go x0 - where - go x = I# x : if isTrue# (x ==# y) - then [] - else go (x +# 1#) +eftInt (I# x0) (I# y) + | isTrue# (x0 ># y) = [] + | otherwise = go x0 + where + go x = I# x : if isTrue# (x ==# y) + then [] + else go (x +# 1#) {-# INLINE [0] eftIntFB #-} -- See Note [Inline FB functions] in GHC.List -eftIntFB :: (Int -> r -> r) -> r -> Int# -> Int# -> r -eftIntFB c n x0 y | isTrue# (x0 ># y) = n - | otherwise = go x0 - where - go x = I# x `c` if isTrue# (x ==# y) - then n - else go (x +# 1#) - -- Watch out for y=maxBound; hence ==, not > +eftIntFB :: (Int -> r -> r) -> r -> Int -> Int -> r +eftIntFB c n (I# x0) (I# y) + | isTrue# (x0 ># y) = n + | otherwise = go x0 + where + go x = I# x `c` if isTrue# (x ==# y) + then n -- Watch out for y=maxBound; hence ==, not > + else go (x +# 1#) -- Be very careful not to have more than one "c" -- so that when eftInfFB is inlined we can inline -- whatever is bound to "c" From git at git.haskell.org Tue Apr 4 16:08:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 4 Apr 2017 16:08:04 +0000 (UTC) Subject: [commit: ghc] master: HACKING: Update for Phabricator patch workflow (5e968f9) Message-ID: <20170404160804.41EFE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5e968f9261b798222a845ef38a54621b45013678/ghc >--------------------------------------------------------------- commit 5e968f9261b798222a845ef38a54621b45013678 Author: Ben Gamari Date: Tue Apr 4 12:07:25 2017 -0400 HACKING: Update for Phabricator patch workflow >--------------------------------------------------------------- 5e968f9261b798222a845ef38a54621b45013678 HACKING.md | 33 +++++++++------------------------ 1 file changed, 9 insertions(+), 24 deletions(-) diff --git a/HACKING.md b/HACKING.md index 6ed39ea..ecfd35b 100644 --- a/HACKING.md +++ b/HACKING.md @@ -49,13 +49,11 @@ $ cp mk/build.mk.sample mk/build.mk $ ... double-check mk/build.mk ... ``` -Now build. If you have multiple cores, **you should always use them to -speed up compilation**: +Now build. The convenient `validate` script will build the tree in a way which +is both quick to build and consistent with our testsuite, ``` -$ ./boot -$ ./configure -$ make -jN # is the number of cores you have. +$ ./validate --build-only ``` You can use the `./inplace/bin/ghc-stage2` binary to play with the @@ -63,26 +61,13 @@ newly built compiler. Now, hack on your copy and rebuild (with `make`) as necessary. -Then start by making your commits however you want. When you're done, you -can use `git format-patch` to create a series of `.patch` files you -can give to us. In this example, we'll assume I'm on a `bugfix` branch -and want to submit my patches: +Then start by making your commits however you want. When you're done, you'll +need to submit your patch to [Phabricator](https://phabricator.haskell.org/) for +code review. To do so you will need to +[install Arcanist](https://secure.phabricator.com/book/phabricator/article/arcanist/#installing-arcanist), +Phabricator's CLI tool. Once installed, you can submit your work for code review +using `arc diff`. -``` -$ git branch -* bugfix - master -$ git format-patch master -o patches -... -$ -``` - -Now create a trac ticket: - - - -And attach the files in your `patches/` directory. Set the status from -*new* to *patch* and we'll review it as soon as we can! Useful links: ============= From git at git.haskell.org Tue Apr 4 19:55:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 4 Apr 2017 19:55:59 +0000 (UTC) Subject: [commit: ghc] master: Enable new warning for fragile/incorrect CPP #if usage (7e340c2) Message-ID: <20170404195559.0C6593A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7e340c2bbf4a56959bd1e95cdd1cfdb2b7e537c2/ghc >--------------------------------------------------------------- commit 7e340c2bbf4a56959bd1e95cdd1cfdb2b7e537c2 Author: Erik de Castro Lopo Date: Wed Apr 5 05:53:46 2017 +1000 Enable new warning for fragile/incorrect CPP #if usage The C code in the RTS now gets built with `-Wundef` and the Haskell code (stages 1 and 2 only) with `-Wcpp-undef`. We now get warnings whereever `#if` is used on undefined identifiers. Test Plan: Validate on Linux and Windows Reviewers: austin, angerman, simonmar, bgamari, Phyx Reviewed By: bgamari Subscribers: thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3278 >--------------------------------------------------------------- 7e340c2bbf4a56959bd1e95cdd1cfdb2b7e537c2 compiler/utils/Util.hs | 2 +- ghc/GHCi/UI.hs | 2 +- includes/CodeGen.Platform.hs | 57 +++++++++++++++++++++++------------------- includes/Stg.h | 6 ++--- includes/rts/OSThreads.h | 4 +-- includes/stg/HaskellMachRegs.h | 36 ++++++++++++++++++++------ includes/stg/MachRegs.h | 14 +++++------ includes/stg/RtsMachRegs.h | 36 ++++++++++++++++++++------ includes/stg/SMP.h | 37 ++++++++++++++------------- libraries/ghci/GHCi/ObjLink.hs | 2 +- mk/warnings.mk | 4 +-- rts/LinkerInternals.h | 11 ++++---- rts/OldARMAtomic.c | 2 +- rts/PrimOps.cmm | 4 +-- rts/RtsUtils.c | 4 +-- rts/Schedule.c | 16 ++++++------ rts/Threads.c | 2 +- rts/ghc.mk | 3 +++ rts/linker/MachO.c | 10 +++++--- rts/posix/GetTime.c | 2 +- rts/posix/OSMem.c | 8 +++--- rts/posix/OSThreads.c | 2 +- rts/posix/itimer/Pthread.c | 6 ++--- rts/sm/CNF.c | 2 +- rts/sm/GCUtils.c | 2 +- rts/sm/GCUtils.h | 2 +- rts/sm/MBlock.c | 2 +- 27 files changed, 166 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 7e340c2bbf4a56959bd1e95cdd1cfdb2b7e537c2 From git at git.haskell.org Tue Apr 4 20:57:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 4 Apr 2017 20:57:26 +0000 (UTC) Subject: [commit: ghc] master: rts: Fix lingering #ifs (ff267f3) Message-ID: <20170404205726.2D3953A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ff267f37788eb47e1d9da15bf396eccec4297bf6/ghc >--------------------------------------------------------------- commit ff267f37788eb47e1d9da15bf396eccec4297bf6 Author: Ben Gamari Date: Tue Apr 4 16:15:32 2017 -0400 rts: Fix lingering #ifs These were missed in D3278. >--------------------------------------------------------------- ff267f37788eb47e1d9da15bf396eccec4297bf6 includes/rts/storage/InfoTables.h | 2 +- rts/Linker.c | 6 +++--- rts/LinkerInternals.h | 2 +- rts/linker/Elf.c | 4 ++-- rts/linker/SymbolExtras.c | 2 +- rts/linker/SymbolExtras.h | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/includes/rts/storage/InfoTables.h b/includes/rts/storage/InfoTables.h index 87d0410..307aac3 100644 --- a/includes/rts/storage/InfoTables.h +++ b/includes/rts/storage/InfoTables.h @@ -28,7 +28,7 @@ hackery can go away sometime. ------------------------------------------------------------------------- */ -#if x86_64_TARGET_ARCH +#ifdef x86_64_TARGET_ARCH #define OFFSET_FIELD(n) StgHalfInt n; StgHalfWord __pad_##n #else #define OFFSET_FIELD(n) StgInt n diff --git a/rts/Linker.c b/rts/Linker.c index 529af9a..7366904 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -1174,7 +1174,7 @@ void freeObjectCode (ObjectCode *oc) /* Free symbol_extras. On x86_64 Windows, symbol_extras are allocated * alongside the image, so we don't need to free. */ -#if NEED_SYMBOL_EXTRAS && (!defined(x86_64_HOST_ARCH) || !defined(mingw32_HOST_OS)) +#if defined(NEED_SYMBOL_EXTRAS) && (!defined(x86_64_HOST_ARCH) || !defined(mingw32_HOST_OS)) if (RTS_LINKER_USE_MMAP) { if (!USE_CONTIGUOUS_MMAP && oc->symbol_extras != NULL) { m32_free(oc->symbol_extras, @@ -1244,7 +1244,7 @@ mkOc( pathchar *path, char *image, int imageSize, oc->sections = NULL; oc->proddables = NULL; oc->stable_ptrs = NULL; -#if NEED_SYMBOL_EXTRAS +#if defined(NEED_SYMBOL_EXTRAS) oc->symbol_extras = NULL; #endif oc->imageMapped = mapped; @@ -1467,7 +1467,7 @@ HsInt loadOc (ObjectCode* oc) return r; } -#if NEED_SYMBOL_EXTRAS +#if defined(NEED_SYMBOL_EXTRAS) # if defined(OBJFORMAT_MACHO) r = ocAllocateSymbolExtras_MachO ( oc ); if (!r) { diff --git a/rts/LinkerInternals.h b/rts/LinkerInternals.h index a04db77..02fe167 100644 --- a/rts/LinkerInternals.h +++ b/rts/LinkerInternals.h @@ -175,7 +175,7 @@ typedef struct _ObjectCode { unsigned int pltIndex; #endif -#if NEED_SYMBOL_EXTRAS +#if defined(NEED_SYMBOL_EXTRAS) SymbolExtra *symbol_extras; unsigned long first_symbol_extra; unsigned long n_symbol_extras; diff --git a/rts/linker/Elf.c b/rts/linker/Elf.c index 73e34d3..77107a7 100644 --- a/rts/linker/Elf.c +++ b/rts/linker/Elf.c @@ -1445,7 +1445,7 @@ do_Elf_Rela_relocations ( ObjectCode* oc, char* ehdrC, break; # endif -#if x86_64_HOST_ARCH +#if defined(x86_64_HOST_ARCH) case R_X86_64_64: *(Elf64_Xword *)P = value; break; @@ -1673,7 +1673,7 @@ int ocRunInit_ELF( ObjectCode *oc ) * PowerPC & X86_64 ELF specifics */ -#if NEED_SYMBOL_EXTRAS +#if defined(NEED_SYMBOL_EXTRAS) int ocAllocateSymbolExtras_ELF( ObjectCode *oc ) { diff --git a/rts/linker/SymbolExtras.c b/rts/linker/SymbolExtras.c index 73f219f..0700033 100644 --- a/rts/linker/SymbolExtras.c +++ b/rts/linker/SymbolExtras.c @@ -11,7 +11,7 @@ #include "LinkerInternals.h" -#if NEED_SYMBOL_EXTRAS +#if defined(NEED_SYMBOL_EXTRAS) #if !defined(x86_64_HOST_ARCH) || !defined(mingw32_HOST_OS) #include "RtsUtils.h" diff --git a/rts/linker/SymbolExtras.h b/rts/linker/SymbolExtras.h index 5e2a6d0..25cb022 100644 --- a/rts/linker/SymbolExtras.h +++ b/rts/linker/SymbolExtras.h @@ -6,7 +6,7 @@ #include "BeginPrivate.h" -#if NEED_SYMBOL_EXTRAS +#if defined(NEED_SYMBOL_EXTRAS) int ocAllocateSymbolExtras( ObjectCode* oc, int count, int first ); From git at git.haskell.org Wed Apr 5 00:49:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 5 Apr 2017 00:49:39 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Bump up timeout multiplier on T11195 (932b469) Message-ID: <20170405004939.89C653A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/932b469687e17b7694f930314267899a10935cbe/ghc >--------------------------------------------------------------- commit 932b469687e17b7694f930314267899a10935cbe Author: Ben Gamari Date: Tue Apr 4 18:04:07 2017 -0400 testsuite: Bump up timeout multiplier on T11195 This has been failing a bit too often (on CI machines under load). >--------------------------------------------------------------- 932b469687e17b7694f930314267899a10935cbe testsuite/tests/pmcheck/should_compile/all.T | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/tests/pmcheck/should_compile/all.T b/testsuite/tests/pmcheck/should_compile/all.T index 8745358..a3c5e91 100644 --- a/testsuite/tests/pmcheck/should_compile/all.T +++ b/testsuite/tests/pmcheck/should_compile/all.T @@ -40,7 +40,7 @@ test('T11303', normal, compile, ['-fwarn-incomplete-patterns -fwarn-overlapping- test('T11276', compile_timeout_multiplier(0.01), compile, ['-fwarn-incomplete-patterns -fwarn-overlapping-patterns +RTS -M1G -RTS']) test('T11303b', compile_timeout_multiplier(0.01), compile, ['-fwarn-incomplete-patterns -fwarn-overlapping-patterns +RTS -M1G -RTS']) test('T11374', compile_timeout_multiplier(0.01), compile, ['-fwarn-incomplete-patterns -fwarn-overlapping-patterns +RTS -M1G -RTS']) -test('T11195', compile_timeout_multiplier(0.40), compile, ['-package ghc -fwarn-incomplete-patterns -fwarn-overlapping-patterns +RTS -M2G -RTS']) +test('T11195', compile_timeout_multiplier(0.50), compile, ['-package ghc -fwarn-incomplete-patterns -fwarn-overlapping-patterns +RTS -M2G -RTS']) # Other tests test('pmc001', [], compile, From git at git.haskell.org Wed Apr 5 00:49:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 5 Apr 2017 00:49:42 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Add test for #13524 (5b7f504) Message-ID: <20170405004942.AEC4A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5b7f504f3c190375903b57a541338bc939ca2dae/ghc >--------------------------------------------------------------- commit 5b7f504f3c190375903b57a541338bc939ca2dae Author: Ben Gamari Date: Tue Apr 4 20:47:20 2017 -0400 testsuite: Add test for #13524 Reviewers: austin Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3418 >--------------------------------------------------------------- 5b7f504f3c190375903b57a541338bc939ca2dae testsuite/tests/typecheck/should_compile/T13524.hs | 27 ++++++++++++++++++++++ testsuite/tests/typecheck/should_compile/all.T | 1 + 2 files changed, 28 insertions(+) diff --git a/testsuite/tests/typecheck/should_compile/T13524.hs b/testsuite/tests/typecheck/should_compile/T13524.hs new file mode 100644 index 0000000..0852468 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T13524.hs @@ -0,0 +1,27 @@ +{-# LANGUAGE PartialTypeSignatures #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeApplications #-} + +{-# OPTIONS_GHC -fno-warn-partial-type-signatures #-} + +type Empty a = () + +foo :: expr a -> expr a -> expr (Empty a) +foo = undefined + +newtype Expr a = SPT {run :: String} + +pt1 :: forall a ptexpr . ptexpr a -> ptexpr (Empty a) +pt1 a = foo a a + +pt2 :: forall a ptexpr . ptexpr a -> ptexpr _ +pt2 a = foo a a + +main :: IO () +main = do + -- This typechecks without any trouble. + putStrLn $ run $ pt1 @Int @Expr undefined + + -- This should also typecheck, but doesn't since GHC seems to mix up the + -- order of the type variables. + putStrLn $ run $ pt2 @Int @Expr undefined diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index c6674c9..2436a71 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -551,3 +551,4 @@ test('T13343', normal, compile, ['']) test('T13458', normal, compile, ['']) test('T13490', normal, compile, ['']) test('T13474', normal, compile, ['']) +test('T13524', expect_broken(13524), compile, ['']) From git at git.haskell.org Wed Apr 5 00:49:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 5 Apr 2017 00:49:45 +0000 (UTC) Subject: [commit: ghc] master: base: Add test for #13525 (3d523fd) Message-ID: <20170405004945.DA2523A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3d523fd990bbb31ca97ea22059ec9d53f0705d8c/ghc >--------------------------------------------------------------- commit 3d523fd990bbb31ca97ea22059ec9d53f0705d8c Author: Ben Gamari Date: Tue Apr 4 20:48:20 2017 -0400 base: Add test for #13525 Reviewers: austin, hvr Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3419 >--------------------------------------------------------------- 3d523fd990bbb31ca97ea22059ec9d53f0705d8c libraries/base/tests/T13525.hs | 7 +++++++ libraries/base/tests/all.T | 1 + 2 files changed, 8 insertions(+) diff --git a/libraries/base/tests/T13525.hs b/libraries/base/tests/T13525.hs new file mode 100644 index 0000000..1bb01b6 --- /dev/null +++ b/libraries/base/tests/T13525.hs @@ -0,0 +1,7 @@ +import System.IO +import System.Timeout + +main :: IO () +main = do + hWaitForInput stdin (5 * 1000) + return () diff --git a/libraries/base/tests/all.T b/libraries/base/tests/all.T index 13049f7..49298d3 100644 --- a/libraries/base/tests/all.T +++ b/libraries/base/tests/all.T @@ -211,3 +211,4 @@ test('T13191', , only_ways(['normal'])], compile_and_run, ['-O']) +test('T13525', expect_broken(13525), compile_and_run, ['']) From git at git.haskell.org Wed Apr 5 00:49:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 5 Apr 2017 00:49:49 +0000 (UTC) Subject: [commit: ghc] master: base: Add test for #8684 (37d7c15) Message-ID: <20170405004949.1C80F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/37d7c1596ee936ec6597a5c1898e1fdca7c04f77/ghc >--------------------------------------------------------------- commit 37d7c1596ee936ec6597a5c1898e1fdca7c04f77 Author: Ben Gamari Date: Tue Apr 4 20:48:35 2017 -0400 base: Add test for #8684 Reviewers: austin, hvr Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3420 >--------------------------------------------------------------- 37d7c1596ee936ec6597a5c1898e1fdca7c04f77 libraries/base/tests/T8684.hs | 16 ++++++++++++++++ libraries/base/tests/all.T | 1 + 2 files changed, 17 insertions(+) diff --git a/libraries/base/tests/T8684.hs b/libraries/base/tests/T8684.hs new file mode 100644 index 0000000..87a3769 --- /dev/null +++ b/libraries/base/tests/T8684.hs @@ -0,0 +1,16 @@ +import Control.Concurrent +import System.IO +import System.Timeout + +main :: IO () +main = do + forkIO $ do + threadDelay (5 * 1000000) + -- The timeout should terminate before we ever make it here + putStrLn "t=5 seconds: we shouldn't be here" + + timeout (1 * 1000000) $ do + hWaitForInput stdin (10 * 1000) + putStrLn "we shouldn't be here" + + return () diff --git a/libraries/base/tests/all.T b/libraries/base/tests/all.T index 49298d3..69705bc 100644 --- a/libraries/base/tests/all.T +++ b/libraries/base/tests/all.T @@ -189,6 +189,7 @@ test('T9681', normal, compile_fail, ['']) test('T8089', [exit_code(99), run_timeout_multiplier(0.01)], compile_and_run, ['']) +test('T8684', expect_broken(8684), compile_and_run, ['']) test('T9826',normal, compile_and_run,['']) test('T9848', [ stats_num_field('bytes allocated', From git at git.haskell.org Wed Apr 5 02:23:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 5 Apr 2017 02:23:08 +0000 (UTC) Subject: [commit: ghc] master: Use strict types and folds in CoreStats (09d7010) Message-ID: <20170405022308.2B7B83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/09d70107ac1634663ee09d6c0f98293dbb77db5f/ghc >--------------------------------------------------------------- commit 09d70107ac1634663ee09d6c0f98293dbb77db5f Author: Reid Barton Date: Tue Apr 4 21:46:45 2017 -0400 Use strict types and folds in CoreStats This only has a significant effect when compiling with -v (or -dshow-passes), but still there's no reason not to do it. Test Plan: harbormaster Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3401 >--------------------------------------------------------------- 09d70107ac1634663ee09d6c0f98293dbb77db5f compiler/coreSyn/CoreStats.hs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/compiler/coreSyn/CoreStats.hs b/compiler/coreSyn/CoreStats.hs index 4da81fd..dd29be7 100644 --- a/compiler/coreSyn/CoreStats.hs +++ b/compiler/coreSyn/CoreStats.hs @@ -20,11 +20,13 @@ import Type (Type, typeSize, seqType) import Id (idType, isJoinId) import CoreSeq (megaSeqIdInfo) -data CoreStats = CS { cs_tm :: Int -- Terms - , cs_ty :: Int -- Types - , cs_co :: Int -- Coercions - , cs_vb :: Int -- Local value bindings - , cs_jb :: Int } -- Local join bindings +import Data.List (foldl') + +data CoreStats = CS { cs_tm :: !Int -- Terms + , cs_ty :: !Int -- Types + , cs_co :: !Int -- Coercions + , cs_vb :: !Int -- Local value bindings + , cs_jb :: !Int } -- Local join bindings instance Outputable CoreStats where @@ -46,7 +48,7 @@ zeroCS = CS { cs_tm = 0, cs_ty = 0, cs_co = 0, cs_vb = 0, cs_jb = 0 } oneTM = zeroCS { cs_tm = 1 } sumCS :: (a -> CoreStats) -> [a] -> CoreStats -sumCS f = foldr (plusCS . f) zeroCS +sumCS f = foldl' (\s a -> plusCS s (f a)) zeroCS coreBindsStats :: [CoreBind] -> CoreStats coreBindsStats = sumCS (bindStats TopLevel) @@ -99,7 +101,7 @@ coreBindsSize :: [CoreBind] -> Int -- We use coreBindStats for user printout -- but this one is a quick and dirty basis for -- the simplifier's tick limit -coreBindsSize bs = foldr ((+) . bindSize) 0 bs +coreBindsSize bs = sum (map bindSize bs) exprSize :: CoreExpr -> Int -- ^ A measure of the size of the expressions, strictly greater than 0 @@ -111,7 +113,7 @@ exprSize (App f a) = exprSize f + exprSize a exprSize (Lam b e) = bndrSize b + exprSize e exprSize (Let b e) = bindSize b + exprSize e exprSize (Case e b t as) = seqType t `seq` - exprSize e + bndrSize b + 1 + foldr ((+) . altSize) 0 as + exprSize e + bndrSize b + 1 + sum (map altSize as) exprSize (Cast e co) = (seqCo co `seq` 1) + exprSize e exprSize (Tick n e) = tickSize n + exprSize e exprSize (Type t) = seqType t `seq` 1 @@ -132,7 +134,7 @@ bndrsSize = sum . map bndrSize bindSize :: CoreBind -> Int bindSize (NonRec b e) = bndrSize b + exprSize e -bindSize (Rec prs) = foldr ((+) . pairSize) 0 prs +bindSize (Rec prs) = sum (map pairSize prs) pairSize :: (Var, CoreExpr) -> Int pairSize (b,e) = bndrSize b + exprSize e From git at git.haskell.org Wed Apr 5 02:23:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 5 Apr 2017 02:23:17 +0000 (UTC) Subject: [commit: ghc] master: Replace Digraph's Node type synonym with a data type (1831aed) Message-ID: <20170405022317.2C4033A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1831aed16d9883b2845fa6997e38b9ac3d72f191/ghc >--------------------------------------------------------------- commit 1831aed16d9883b2845fa6997e38b9ac3d72f191 Author: Matthew Pickering Date: Tue Apr 4 21:47:29 2017 -0400 Replace Digraph's Node type synonym with a data type This refactoring makes it more obvious when we are constructing a Node for the digraph rather than a less useful 3-tuple. Reviewers: austin, goldfire, bgamari, simonmar, dfeuer Reviewed By: dfeuer Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3414 >--------------------------------------------------------------- 1831aed16d9883b2845fa6997e38b9ac3d72f191 compiler/basicTypes/NameEnv.hs | 3 ++- compiler/cmm/CmmBuildInfoTables.hs | 3 ++- compiler/codeGen/StgCmmUtils.hs | 4 +-- compiler/iface/MkIface.hs | 4 +-- compiler/main/GhcMake.hs | 15 ++++++----- compiler/nativeGen/AsmCodeGen.hs | 14 +++++----- .../nativeGen/RegAlloc/Linear/JoinToTargets.hs | 20 +++++++-------- compiler/nativeGen/RegAlloc/Liveness.hs | 20 +++++++-------- compiler/rename/RnSource.hs | 5 ++-- compiler/simplCore/OccurAnal.hs | 21 ++++++++------- compiler/typecheck/TcBinds.hs | 4 +-- compiler/typecheck/TcEvidence.hs | 6 ++--- compiler/typecheck/TcSMonad.hs | 4 +-- compiler/types/Type.hs | 12 +++++---- compiler/utils/Digraph.hs | 30 ++++++++++++---------- compiler/vectorise/Vectorise/Type/Classify.hs | 3 ++- .../tests/determinism/determ001/determinism001.hs | 4 ++- 17 files changed, 92 insertions(+), 80 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 1831aed16d9883b2845fa6997e38b9ac3d72f191 From git at git.haskell.org Wed Apr 5 02:23:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 5 Apr 2017 02:23:19 +0000 (UTC) Subject: [commit: ghc] master: Add Alternative instance for ZipList (fix #13520). (486b8db) Message-ID: <20170405022319.DF3993A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/486b8db05fefd1cfa916928c74958f8099b9f9f8/ghc >--------------------------------------------------------------- commit 486b8db05fefd1cfa916928c74958f8099b9f9f8 Author: Edvard Hübinette Date: Tue Apr 4 21:48:37 2017 -0400 Add Alternative instance for ZipList (fix #13520). Reviewers: austin, hvr, bgamari, RyanGlScott Reviewed By: RyanGlScott Subscribers: adamse, RyanGlScott, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3416 >--------------------------------------------------------------- 486b8db05fefd1cfa916928c74958f8099b9f9f8 libraries/base/Control/Applicative.hs | 7 ++++++- libraries/base/changelog.md | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/libraries/base/Control/Applicative.hs b/libraries/base/Control/Applicative.hs index 9045bcd..559cced 100644 --- a/libraries/base/Control/Applicative.hs +++ b/libraries/base/Control/Applicative.hs @@ -59,7 +59,7 @@ import Data.Functor.Const (Const(..)) import GHC.Base import GHC.Generics -import GHC.List (repeat, zipWith) +import GHC.List (repeat, zipWith, drop) import GHC.Read (Read) import GHC.Show (Show) @@ -121,6 +121,11 @@ instance Applicative ZipList where pure x = ZipList (repeat x) liftA2 f (ZipList xs) (ZipList ys) = ZipList (zipWith f xs ys) +-- | @since 4.11.0.0 +instance Alternative ZipList where + empty = ZipList [] + ZipList xs <|> ZipList ys = ZipList (xs ++ drop (length xs) ys) + -- extra functions -- | One or none. diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index f2ea265..854a9b8 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -1,5 +1,10 @@ # Changelog for [`base` package](http://hackage.haskell.org/package/base) +## 4.11.0.0 *TBA* + * Bundled with GHC *TBA* + + * Add `Alternative` instance for `ZipList` (#13520) + ## 4.10.0.0 *April 2017* * Bundled with GHC *TBA* From git at git.haskell.org Wed Apr 5 02:23:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 5 Apr 2017 02:23:14 +0000 (UTC) Subject: [commit: ghc] master: validate: Clean GMP trees (5315223) Message-ID: <20170405022314.292CE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5315223683b64c665959781112f8206fb8230a54/ghc >--------------------------------------------------------------- commit 5315223683b64c665959781112f8206fb8230a54 Author: Ben Gamari Date: Tue Apr 4 21:47:05 2017 -0400 validate: Clean GMP trees For reasons unknown `validate` passed `NO_CLEAN_GMP=YES` to `maintainer-clean`, leaving a stale `gmp.h` which causes the build to fail in the event that the uses a tree for validating for two different target platforms. This is quite unexpected, don't do it. Reviewers: hvr, austin, rwbarton, dfeuer Reviewed By: dfeuer Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3409 >--------------------------------------------------------------- 5315223683b64c665959781112f8206fb8230a54 validate | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/validate b/validate index 8caa0e2..09f4fd2 100755 --- a/validate +++ b/validate @@ -176,7 +176,7 @@ if [ $testsuite_only -eq 0 ]; then thisdir=`pwd` if [ $no_clean -eq 0 ]; then - $make maintainer-clean NO_CLEAN_GMP=YES + $make maintainer-clean INSTDIR="$thisdir/inst" From git at git.haskell.org Wed Apr 5 02:23:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 5 Apr 2017 02:23:11 +0000 (UTC) Subject: [commit: ghc] master: Add regression test for #7944 (af941a9) Message-ID: <20170405022311.717583A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/af941a96f62101a6539f3cc35d82df3fd964539c/ghc >--------------------------------------------------------------- commit af941a96f62101a6539f3cc35d82df3fd964539c Author: Ryan Scott Date: Tue Apr 4 21:46:55 2017 -0400 Add regression test for #7944 Commit b8b3e30a6eedf9f213b8a718573c4827cfa230ba happened to fix the bug reported in #7944. Let's add a regression test so that it stays that way. Fixes #7944. Test Plan: make test TEST=T7944 Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3404 >--------------------------------------------------------------- af941a96f62101a6539f3cc35d82df3fd964539c testsuite/tests/simplCore/should_compile/T7944.hs | 19 +++++++++++++++++++ testsuite/tests/simplCore/should_compile/all.T | 1 + 2 files changed, 20 insertions(+) diff --git a/testsuite/tests/simplCore/should_compile/T7944.hs b/testsuite/tests/simplCore/should_compile/T7944.hs new file mode 100644 index 0000000..bb62427 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T7944.hs @@ -0,0 +1,19 @@ +module T7944 where + +import GHC.Exts + +-- Force specialisation of "go" +data SPEC = SPEC | SPEC2 +{-# ANN type SPEC ForceSpecConstr #-} + +-- This is more or less just an ordinary fold +go :: SPEC -> [a] -> IntMap a -> IntMap a +go SPEC [] m = m +go SPEC (_:xs) m + = go SPEC xs + -- This would be the "worker function" of the fold + $ Unary m + + +-- Both constructors are necessary, despite only one being used +data IntMap a = Nil | Unary (IntMap a) diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index 2d87e24..1bf1f36 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -158,6 +158,7 @@ test('T7702', compile, ['-v0 -package-db T7702plugin/pkg.T7702/local.package.conf -fplugin T7702Plugin -package T7702plugin ' + config.plugin_way_flags]) +test('T7944', normal, compile, ['-O2']) test('T7995', # RULE doesn't seem to fire unless optimizations are turned on. # This seems reasonable, so I've required it for the test. -- EZY 20130720 From git at git.haskell.org Wed Apr 5 02:23:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 5 Apr 2017 02:23:22 +0000 (UTC) Subject: [commit: ghc] master: base: Mark unfold as deprecated (ce9b617) Message-ID: <20170405022322.9DFDE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ce9b6170b0ac9ff417000d8e7bdff7b2298f2978/ghc >--------------------------------------------------------------- commit ce9b6170b0ac9ff417000d8e7bdff7b2298f2978 Author: Ben Gamari Date: Tue Apr 4 21:48:49 2017 -0400 base: Mark unfold as deprecated Test Plan: Read it Reviewers: austin, hvr, RyanGlScott Reviewed By: RyanGlScott Subscribers: rwbarton, thomie, ekmett Differential Revision: https://phabricator.haskell.org/D3422 >--------------------------------------------------------------- ce9b6170b0ac9ff417000d8e7bdff7b2298f2978 libraries/base/Data/List/NonEmpty.hs | 2 ++ libraries/base/changelog.md | 3 +++ 2 files changed, 5 insertions(+) diff --git a/libraries/base/Data/List/NonEmpty.hs b/libraries/base/Data/List/NonEmpty.hs index 2f9f868..9a9de01 100644 --- a/libraries/base/Data/List/NonEmpty.hs +++ b/libraries/base/Data/List/NonEmpty.hs @@ -180,6 +180,8 @@ unfold :: (a -> (b, Maybe a)) -> a -> NonEmpty b unfold f a = case f a of (b, Nothing) -> b :| [] (b, Just c) -> b <| unfold f c +{-# DEPRECATED unfold "Use unfoldr" #-} +-- Deprecated in 8.2.1, remove in 8.4 -- | 'nonEmpty' efficiently turns a normal list into a 'NonEmpty' stream, -- producing 'Nothing' if the input is empty. diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index 854a9b8..e2e276a 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -89,6 +89,9 @@ * `mkTyCon3` is no longer exported by `Data.Typeable`. This function is replaced by `Type.Reflection.Unsafe.mkTyCon`. + * `Data.List.NonEmpty.unfold` has been deprecated in favor of `unfoldr`, + which is functionally equivalent. + ## 4.9.0.0 *May 2016* * Bundled with GHC 8.0 From git at git.haskell.org Wed Apr 5 15:24:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 5 Apr 2017 15:24:26 +0000 (UTC) Subject: [commit: ghc] master: Typos in comments [ci skip] (577f3da) Message-ID: <20170405152426.82A303A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/577f3da7b81920c427c394871c86a523627e14e9/ghc >--------------------------------------------------------------- commit 577f3da7b81920c427c394871c86a523627e14e9 Author: Gabor Greif Date: Tue Apr 4 10:49:51 2017 +0200 Typos in comments [ci skip] >--------------------------------------------------------------- 577f3da7b81920c427c394871c86a523627e14e9 compiler/hsSyn/HsExpr.hs | 2 +- compiler/llvmGen/LlvmCodeGen/CodeGen.hs | 2 +- compiler/nativeGen/RegAlloc/Graph/SpillCost.hs | 2 +- compiler/specialise/SpecConstr.hs | 2 +- compiler/typecheck/TcRnDriver.hs | 2 +- compiler/utils/Util.hs | 2 +- libraries/template-haskell/Language/Haskell/TH/Ppr.hs | 2 +- rts/STM.c | 4 ++-- testsuite/tests/deSugar/should_run/dsrun002.hs | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/compiler/hsSyn/HsExpr.hs b/compiler/hsSyn/HsExpr.hs index f627056..f3cc3d0 100644 --- a/compiler/hsSyn/HsExpr.hs +++ b/compiler/hsSyn/HsExpr.hs @@ -1612,7 +1612,7 @@ type GuardLStmt id = LStmt id (LHsExpr id) -- | Guard Statement type GuardStmt id = Stmt id (LHsExpr id) --- | Ghci Located Statemnt +-- | Ghci Located Statement type GhciLStmt id = LStmt id (LHsExpr id) -- | Ghci Statement diff --git a/compiler/llvmGen/LlvmCodeGen/CodeGen.hs b/compiler/llvmGen/LlvmCodeGen/CodeGen.hs index 40c5498..f1383c6 100644 --- a/compiler/llvmGen/LlvmCodeGen/CodeGen.hs +++ b/compiler/llvmGen/LlvmCodeGen/CodeGen.hs @@ -62,7 +62,7 @@ genLlvmProc _ = panic "genLlvmProc: case that shouldn't reach here!" -- -- | Generate code for a list of blocks that make up a complete --- procedure. The first block in the list is exepected to be the entry +-- procedure. The first block in the list is expected to be the entry -- point and will get the prologue. basicBlocksCodeGen :: LiveGlobalRegs -> [CmmBlock] -> LlvmM ([LlvmBasicBlock], [LlvmCmmDecl]) diff --git a/compiler/nativeGen/RegAlloc/Graph/SpillCost.hs b/compiler/nativeGen/RegAlloc/Graph/SpillCost.hs index 0817b39..82976c0 100644 --- a/compiler/nativeGen/RegAlloc/Graph/SpillCost.hs +++ b/compiler/nativeGen/RegAlloc/Graph/SpillCost.hs @@ -165,7 +165,7 @@ chooseSpill info graph -- cost = sum loadCost * freq (u) + sum storeCost * freq (d) -- u <- uses (v) d <- defs (v) -- --- There are no loops in our code at the momemnt, so we can set the freq's to 1. +-- There are no loops in our code at the moment, so we can set the freq's to 1. -- -- If we don't have live range splitting then Chaitins function performs badly -- if we have lots of nested live ranges and very few registers. diff --git a/compiler/specialise/SpecConstr.hs b/compiler/specialise/SpecConstr.hs index 7162841..cd5a90c 100644 --- a/compiler/specialise/SpecConstr.hs +++ b/compiler/specialise/SpecConstr.hs @@ -1749,7 +1749,7 @@ the passed-in RuleInfo, unless there are no calls at all to the function. The caller can, indeed must, assume this. He should not combine in rhs_usg himself, or he'll get rhs_usg twice -- and that can lead to an exponential blowup of duplicates in the CallEnv. This is what gave rise to the massive -performace loss in Trac #8852. +performance loss in Trac #8852. Note [Specialise original body] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/compiler/typecheck/TcRnDriver.hs b/compiler/typecheck/TcRnDriver.hs index b02fdf5..45df4ac 100644 --- a/compiler/typecheck/TcRnDriver.hs +++ b/compiler/typecheck/TcRnDriver.hs @@ -2012,7 +2012,7 @@ tcUserStmt (L loc (BodyStmt expr _ _ _)) ; when (isUnitTy $ it_ty) failM ; return stuff }, - -- Plan B; a naked bind statment + -- Plan B; a naked bind statement tcGhciStmts [bind_stmt], -- Plan C; check that the let-binding is typeable all by itself. diff --git a/compiler/utils/Util.hs b/compiler/utils/Util.hs index db6666c..1c519eb 100644 --- a/compiler/utils/Util.hs +++ b/compiler/utils/Util.hs @@ -309,7 +309,7 @@ splitEithers (e : es) = case e of where (xs,ys) = splitEithers es chkAppend :: [a] -> [a] -> [a] --- Checks for the second arguemnt being empty +-- Checks for the second argument being empty -- Used in situations where that situation is common chkAppend xs ys | null ys = xs diff --git a/libraries/template-haskell/Language/Haskell/TH/Ppr.hs b/libraries/template-haskell/Language/Haskell/TH/Ppr.hs index 78c6080..a851a22 100644 --- a/libraries/template-haskell/Language/Haskell/TH/Ppr.hs +++ b/libraries/template-haskell/Language/Haskell/TH/Ppr.hs @@ -150,7 +150,7 @@ pprExp i (LamCaseE ms) = parensIf (i > noPrec) pprExp _ (TupE es) = parens (commaSep es) pprExp _ (UnboxedTupE es) = hashParens (commaSep es) pprExp _ (UnboxedSumE e alt arity) = unboxedSumBars (ppr e) alt arity --- Nesting in Cond is to avoid potential problems in do statments +-- Nesting in Cond is to avoid potential problems in do statements pprExp i (CondE guard true false) = parensIf (i > noPrec) $ sep [text "if" <+> ppr guard, nest 1 $ text "then" <+> ppr true, diff --git a/rts/STM.c b/rts/STM.c index 0e09d7d..f845b11 100644 --- a/rts/STM.c +++ b/rts/STM.c @@ -1395,7 +1395,7 @@ StgBool stmCommitTransaction(Capability *cap, StgTRecHeader *trec) { } if (result) { - // We now know that all of the read-only locations held their exepcted values + // We now know that all of the read-only locations held their expected values // at the end of the call to validate_and_acquire_ownership. This forms the // linearization point of the commit. @@ -1472,7 +1472,7 @@ StgBool stmCommitNestedTransaction(Capability *cap, StgTRecHeader *trec) { result = check_read_only(trec); } if (result) { - // We now know that all of the read-only locations held their exepcted values + // We now know that all of the read-only locations held their expected values // at the end of the call to validate_and_acquire_ownership. This forms the // linearization point of the commit. diff --git a/testsuite/tests/deSugar/should_run/dsrun002.hs b/testsuite/tests/deSugar/should_run/dsrun002.hs index 09dc52d..169a0c1 100644 --- a/testsuite/tests/deSugar/should_run/dsrun002.hs +++ b/testsuite/tests/deSugar/should_run/dsrun002.hs @@ -1,4 +1,4 @@ -{- Tests let-expressions in do-statments -} +{- Tests let-expressions in do-statements -} module Main( main ) where From git at git.haskell.org Wed Apr 5 15:38:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 5 Apr 2017 15:38:50 +0000 (UTC) Subject: [commit: ghc] master: test for HAVE_CLOCK_GETTIME definedness (4a1eed4) Message-ID: <20170405153850.F239E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4a1eed40bec08d50634b9754448ae34666e71fb2/ghc >--------------------------------------------------------------- commit 4a1eed40bec08d50634b9754448ae34666e71fb2 Author: Gabor Greif Date: Wed Apr 5 17:37:53 2017 +0200 test for HAVE_CLOCK_GETTIME definedness >--------------------------------------------------------------- 4a1eed40bec08d50634b9754448ae34666e71fb2 libraries/base/include/HsBase.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/base/include/HsBase.h b/libraries/base/include/HsBase.h index cfe0464..cbbccbf 100644 --- a/libraries/base/include/HsBase.h +++ b/libraries/base/include/HsBase.h @@ -100,7 +100,7 @@ #elif HAVE_STDINT_H # include #endif -#if HAVE_CLOCK_GETTIME +#ifdef HAVE_CLOCK_GETTIME # ifdef _POSIX_MONOTONIC_CLOCK # define CLOCK_ID CLOCK_MONOTONIC # else From git at git.haskell.org Wed Apr 5 16:13:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 5 Apr 2017 16:13:04 +0000 (UTC) Subject: [commit: ghc] master: Revert "Enable new warning for fragile/incorrect CPP #if usage" (819c3db) Message-ID: <20170405161304.08CF03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/819c3db73acf5246cd332ad3062c61b7a2e8ee68/ghc >--------------------------------------------------------------- commit 819c3db73acf5246cd332ad3062c61b7a2e8ee68 Author: Ben Gamari Date: Wed Apr 5 12:01:12 2017 -0400 Revert "Enable new warning for fragile/incorrect CPP #if usage" This is causing too much platform dependent breakage at the moment. We will need a more rigorous testing strategy before this can be merged again. This reverts commit 7e340c2bbf4a56959bd1e95cdd1cfdb2b7e537c2. >--------------------------------------------------------------- 819c3db73acf5246cd332ad3062c61b7a2e8ee68 compiler/utils/Util.hs | 2 +- ghc/GHCi/UI.hs | 2 +- includes/CodeGen.Platform.hs | 57 +++++++++++++++++++----------------------- includes/Stg.h | 6 ++--- includes/rts/OSThreads.h | 4 +-- includes/stg/HaskellMachRegs.h | 36 ++++++-------------------- includes/stg/MachRegs.h | 14 +++++------ includes/stg/RtsMachRegs.h | 36 ++++++-------------------- includes/stg/SMP.h | 37 +++++++++++++-------------- libraries/ghci/GHCi/ObjLink.hs | 2 +- mk/warnings.mk | 4 +-- rts/LinkerInternals.h | 11 ++++---- rts/OldARMAtomic.c | 2 +- rts/PrimOps.cmm | 4 +-- rts/RtsUtils.c | 4 +-- rts/Schedule.c | 16 ++++++------ rts/Threads.c | 2 +- rts/ghc.mk | 3 --- rts/linker/MachO.c | 10 +++----- rts/posix/GetTime.c | 2 +- rts/posix/OSMem.c | 8 +++--- rts/posix/OSThreads.c | 2 +- rts/posix/itimer/Pthread.c | 6 ++--- rts/sm/CNF.c | 2 +- rts/sm/GCUtils.c | 2 +- rts/sm/GCUtils.h | 2 +- rts/sm/MBlock.c | 2 +- 27 files changed, 112 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 819c3db73acf5246cd332ad3062c61b7a2e8ee68 From git at git.haskell.org Thu Apr 6 09:11:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 6 Apr 2017 09:11:03 +0000 (UTC) Subject: [commit: ghc] master: config.mk.in: remove phase=0 hack for CrossCompilePrefix (6ff98b9) Message-ID: <20170406091103.290BB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6ff98b962db15d18eb1d082fe344cef692ecef8e/ghc >--------------------------------------------------------------- commit 6ff98b962db15d18eb1d082fe344cef692ecef8e Author: Sergei Trofimovich Date: Thu Apr 6 08:55:56 2017 +0100 config.mk.in: remove phase=0 hack for CrossCompilePrefix $(CrossCompilePrefix) is used only in 'make install' target filenames in $(DESTDIR). None of inplace (or boot) files contain $(CrossCompilePrefix). Thus we don't need to worry about phases. Signed-off-by: Sergei Trofimovich >--------------------------------------------------------------- 6ff98b962db15d18eb1d082fe344cef692ecef8e mk/config.mk.in | 4 ---- 1 file changed, 4 deletions(-) diff --git a/mk/config.mk.in b/mk/config.mk.in index 4e61eea..4d5d82a 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -530,11 +530,7 @@ SUPPORTS_THIS_UNIT_ID = @SUPPORTS_THIS_UNIT_ID@ # needs to know which gcc you're using in order to perform its tests. GccVersion = @GccVersion@ -ifeq "$(phase)" "0" -CrossCompilePrefix = -else CrossCompilePrefix = @CrossCompilePrefix@ -endif # TargetPlatformFull retains the string passed to configure so we have it in # the necessary format to pass to libffi's configure. TargetPlatformFull = @TargetPlatformFull@ From git at git.haskell.org Thu Apr 6 09:11:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 6 Apr 2017 09:11:05 +0000 (UTC) Subject: [commit: ghc] master: avoid $(CrossCompilerPrefix) for stage2 install (f2685df) Message-ID: <20170406091105.DB4683A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f2685df3b10e13f142736f28835e9064334bc143/ghc >--------------------------------------------------------------- commit f2685df3b10e13f142736f28835e9064334bc143 Author: Sergei Trofimovich Date: Wed Apr 5 22:31:37 2017 +0100 avoid $(CrossCompilerPrefix) for stage2 install Suppose we are crossbuilding ghc (when ghc-stage2 is a normal compiler for $target): For this case 'make install' should install unprefixed stage2 'ghc' and not '$(CorssCompilePrefix)-ghc'. That way cross-built ghc is installable and usable on target as if it would be built natively on a target. Signed-off-by: Sergei Trofimovich >--------------------------------------------------------------- f2685df3b10e13f142736f28835e9064334bc143 mk/config.mk.in | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mk/config.mk.in b/mk/config.mk.in index 4d5d82a..5e274bb 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -530,7 +530,7 @@ SUPPORTS_THIS_UNIT_ID = @SUPPORTS_THIS_UNIT_ID@ # needs to know which gcc you're using in order to perform its tests. GccVersion = @GccVersion@ -CrossCompilePrefix = @CrossCompilePrefix@ + # TargetPlatformFull retains the string passed to configure so we have it in # the necessary format to pass to libffi's configure. TargetPlatformFull = @TargetPlatformFull@ @@ -567,6 +567,11 @@ CrossCompiling = @CrossCompiling@ # See Note [Stage1Only vs stage=1] Stage1Only = NO +# Installed tools prefix: +# we add prefix to crosscompiler GHC only (ghc-stage1), +# not cross-built GHC (not ghc-stage2). +CrossCompilePrefix = $(if $(filter YES,$(Stage1Only)), at CrossCompilePrefix@,) + # Install stage 2 by default, or stage 1 in the cross compiler # case. Can be changed to 3 INSTALL_GHC_STAGE= $(if $(filter YES,$(Stage1Only)),1,2) From git at git.haskell.org Thu Apr 6 09:11:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 6 Apr 2017 09:11:08 +0000 (UTC) Subject: [commit: ghc] master: Use non-canocalized triple as cross-compiler prefix (844704b) Message-ID: <20170406091108.A0CD63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/844704b4883e1d603a5048ddc6cbad737ba8d9e8/ghc >--------------------------------------------------------------- commit 844704b4883e1d603a5048ddc6cbad737ba8d9e8 Author: Sergei Trofimovich Date: Thu Apr 6 08:51:22 2017 +0100 Use non-canocalized triple as cross-compiler prefix I've noticed the problem when tried to install cross-compiler using following configuration: $ ./configure --target=s390x-unknown-linux-gnu make install Stage1Only=YES Instead of expected tool prefix 's390x-unknown-linux-gnu-' Result was: 's390x-ibm-linux-gnu-' It's problematic as installed binaries appear in unpredictable location. The problem is caused by use of ${target} autoconf variable. ${target} contains a canocalized triplet. Luckily we already have non-canonucalized target triplet in ${TargetPlatformFull} variable. The change uses that instead. Signed-off-by: Sergei Trofimovich >--------------------------------------------------------------- 844704b4883e1d603a5048ddc6cbad737ba8d9e8 configure.ac | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index 3086e03..dd107e5 100644 --- a/configure.ac +++ b/configure.ac @@ -425,12 +425,6 @@ with a cross-compiler. To cross-compile GHC itself, set TARGET: stage GHC. ]) fi -if test "$CrossCompiling" = "YES" -then - CrossCompilePrefix="${target}-" -else - CrossCompilePrefix="" -fi # Despite its similarity in name to TargetPlatform, TargetPlatformFull is used # in calls to subproject configure scripts and thus must be set to the autoconf # triple, not the normalized GHC triple that TargetPlatform is set to. @@ -446,6 +440,8 @@ fi # all be taken care of for us if we configured the subprojects using # AC_CONFIG_DIR, but unfortunately Cabal needs to be the one to do the # configuration. +# +# We also use non-canonicalized triple when install stage1 crosscompiler if test -z "${target_alias}" then # --target wasn't given; use result from AC_CANONICAL_TARGET @@ -453,6 +449,13 @@ then else TargetPlatformFull="${target_alias}" fi +if test "$CrossCompiling" = "YES" +then + # Use value passed by user from --target= + CrossCompilePrefix="${TargetPlatformFull}-" +else + CrossCompilePrefix="" +fi AC_SUBST(CrossCompiling) AC_SUBST(CrossCompilePrefix) AC_SUBST(TargetPlatformFull) From git at git.haskell.org Thu Apr 6 09:11:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 6 Apr 2017 09:11:11 +0000 (UTC) Subject: [commit: ghc] master: config.mk.in: removed stray HaveLibDL assignment (4671e3c) Message-ID: <20170406091111.637013A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4671e3c17cb6f060c1068f4ab5e6bd5694b5ebcb/ghc >--------------------------------------------------------------- commit 4671e3c17cb6f060c1068f4ab5e6bd5694b5ebcb Author: Sergei Trofimovich Date: Thu Apr 6 09:57:36 2017 +0100 config.mk.in: removed stray HaveLibDL assignment HaveLibDL substitution was removed from configure.ac in 2014 with 9692393d7ba91a091c1e61b6754d79ad17c5f193 commit. Noticed when scrolled through 'config.mk' which contained unsunstituted assignment after './configure' run: HaveLibDL = @HaveLibDL@ Signed-off-by: Sergei Trofimovich >--------------------------------------------------------------- 4671e3c17cb6f060c1068f4ab5e6bd5694b5ebcb mk/config.mk.in | 2 -- 1 file changed, 2 deletions(-) diff --git a/mk/config.mk.in b/mk/config.mk.in index 5e274bb..5d1f94a 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -193,8 +193,6 @@ GhcWithNativeCodeGen := $(strip\ $(if $(filter YESYESNO,\ $(OsSupportsNCG)$(ArchSupportsNCG)$(GhcUnregisterised)),YES,NO)) -HaveLibDL = @HaveLibDL@ - # ArchSupportsSMP should be set iff there is support for that arch in # includes/stg/SMP.h ifeq "$(TargetArch_CPP)" "arm" From git at git.haskell.org Thu Apr 6 11:11:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 6 Apr 2017 11:11:24 +0000 (UTC) Subject: [commit: ghc] master: Update .mailmap [skip ci] (b5f6a93) Message-ID: <20170406111124.6C80E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b5f6a937b2d4e06dc1c396189996ee70c5b4b8c7/ghc >--------------------------------------------------------------- commit b5f6a937b2d4e06dc1c396189996ee70c5b4b8c7 Author: Erik de Castro Lopo Date: Thu Apr 6 21:09:55 2017 +1000 Update .mailmap [skip ci] >--------------------------------------------------------------- b5f6a937b2d4e06dc1c396189996ee70c5b4b8c7 .mailmap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.mailmap b/.mailmap index ed78978..cdfcf0e 100644 --- a/.mailmap +++ b/.mailmap @@ -99,7 +99,7 @@ Duncan Coutts Edward Z. Yang Eric Seidel -Erik de Castro Lopo +Erik de Castro Lopo Evan Hauck Fumiaki Kinoshita Gabor Greif From git at git.haskell.org Thu Apr 6 11:15:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 6 Apr 2017 11:15:16 +0000 (UTC) Subject: [commit: ghc] master: Fix markup (c600f3c) Message-ID: <20170406111516.3EE3A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c600f3cee57a31c0ac9e3d88e0519f6bf056f55d/ghc >--------------------------------------------------------------- commit c600f3cee57a31c0ac9e3d88e0519f6bf056f55d Author: Gabor Greif Date: Thu Apr 6 12:52:29 2017 +0200 Fix markup >--------------------------------------------------------------- c600f3cee57a31c0ac9e3d88e0519f6bf056f55d docs/users_guide/glasgow_exts.rst | 68 +++++++++++++++++++-------------------- 1 file 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 c600f3cee57a31c0ac9e3d88e0519f6bf056f55d From git at git.haskell.org Thu Apr 6 11:34:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 6 Apr 2017 11:34:19 +0000 (UTC) Subject: [commit: ghc] master: Add comments on DmdAnal space leak fix (dd228b6) Message-ID: <20170406113419.11FDA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/dd228b6eae18a05675b698fa309403d2310a269b/ghc >--------------------------------------------------------------- commit dd228b6eae18a05675b698fa309403d2310a269b Author: Simon Peyton Jones Date: Mon Apr 3 08:48:28 2017 +0100 Add comments on DmdAnal space leak fix >--------------------------------------------------------------- dd228b6eae18a05675b698fa309403d2310a269b compiler/stranal/DmdAnal.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compiler/stranal/DmdAnal.hs b/compiler/stranal/DmdAnal.hs index 2fc33a4..304a2be 100644 --- a/compiler/stranal/DmdAnal.hs +++ b/compiler/stranal/DmdAnal.hs @@ -90,6 +90,9 @@ evaluated everywhere that we produce it, so we just run a single seqBinds over the output before returning it, to ensure that there are no references holding on to the input Core program. +This makes a ~30% reduction in peak memory usage when compiling +DynFlags (cf Trac #9675 and #13426). + This is particularly important when we are doing late demand analysis, since we don't do a seqBinds at any point thereafter. Hence code generation would hold on to an extra copy of the Core program, via From git at git.haskell.org Thu Apr 6 11:34:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 6 Apr 2017 11:34:22 +0000 (UTC) Subject: [commit: ghc] master: Don't report fundep wanted/wanted errors (48daaaf) Message-ID: <20170406113422.A085F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/48daaaf0bba279b6e362ee5c632de69ed31ab65d/ghc >--------------------------------------------------------------- commit 48daaaf0bba279b6e362ee5c632de69ed31ab65d Author: Simon Peyton Jones Date: Wed Apr 5 13:37:28 2017 +0100 Don't report fundep wanted/wanted errors This makes GHC drop derived FunDep errors when they are come from wanted/wanted interactions. Much along the lines of "don't rewrite wanteds with wanteds". See TcRnTypes Note [Dropping derived constraints] and the new code in isDroppableDerivedLoc. Fixes Trac #13506. >--------------------------------------------------------------- 48daaaf0bba279b6e362ee5c632de69ed31ab65d compiler/typecheck/TcRnTypes.hs | 53 ++++++++++++---------- testsuite/tests/typecheck/should_fail/T13506.hs | 26 +++++++++++ .../tests/typecheck/should_fail/T13506.stderr | 8 ++++ testsuite/tests/typecheck/should_fail/all.T | 1 + 4 files changed, 64 insertions(+), 24 deletions(-) diff --git a/compiler/typecheck/TcRnTypes.hs b/compiler/typecheck/TcRnTypes.hs index 90423e4..c004052 100644 --- a/compiler/typecheck/TcRnTypes.hs +++ b/compiler/typecheck/TcRnTypes.hs @@ -1822,25 +1822,30 @@ isDroppableDerivedLoc loc HoleOrigin {} -> False KindEqOrigin {} -> False GivenOrigin {} -> False - FunDepOrigin1 {} -> False + + -- See Note [Dropping derived constraints + -- For fundeps, drop wanted/warnted interactions FunDepOrigin2 {} -> False - _ -> True + FunDepOrigin1 _ loc1 _ loc2 + | isGivenLoc loc1 || isGivenLoc loc2 -> False + | otherwise -> True + _ -> True arisesFromGivens :: Ct -> Bool arisesFromGivens ct = case ctEvidence ct of - CtGiven {} -> True - CtWanted {} -> False - CtDerived { ctev_loc = loc } -> from_given loc - where - from_given :: CtLoc -> Bool - from_given loc = from_given_origin (ctLocOrigin loc) + CtGiven {} -> True + CtWanted {} -> False + CtDerived { ctev_loc = loc } -> isGivenLoc loc - from_given_origin :: CtOrigin -> Bool - from_given_origin (GivenOrigin {}) = True - from_given_origin (FunDepOrigin1 _ l1 _ l2) = from_given l1 && from_given l2 - from_given_origin (FunDepOrigin2 _ o1 _ _) = from_given_origin o1 - from_given_origin _ = False +isGivenLoc :: CtLoc -> Bool +isGivenLoc loc = isGivenOrigin (ctLocOrigin loc) + +isGivenOrigin :: CtOrigin -> Bool +isGivenOrigin (GivenOrigin {}) = True +isGivenOrigin (FunDepOrigin1 _ l1 _ l2) = isGivenLoc l1 && isGivenLoc l2 +isGivenOrigin (FunDepOrigin2 _ o1 _ _) = isGivenOrigin o1 +isGivenOrigin _ = False {- Note [Dropping derived constraints] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1856,19 +1861,19 @@ see dropDerivedWC. For example But (tiresomely) we do keep *some* Derived insolubles: - * Insoluble kind equalities (e.g. [D] * ~ (* -> *)) may arise from - a type equality a ~ Int#, say. In future they'll be Wanted, not Derived, - but at the moment they are Derived. + * Type holes are derived constraints because they have no evidence + and we want to keep them so we get the error report * Insoluble derived equalities (e.g. [D] Int ~ Bool) may arise from - functional dependency interactions, either between Givens or - Wanteds. It seems sensible to retain these: - - For Givens they reflect unreachable code - - For Wanteds it is arguably better to get a fundep error than - a no-instance error (Trac #9612) + functional dependency interactions: + - Given or Wanted interacting with an instance declaration (FunDepOrigin2) + - Given/Given interactions (FunDepOrigin1); this reflects unreachable code + - Given/Wanted interactions (FunDepOrigin1); see Trac #9612 - * Type holes are derived constraints because they have no evidence - and we want to keep them so we get the error report + But for Wanted/Wanted interactions we do /not/ want to report an + error (Trac #13506). Consider [W] C Int Int, [W] C Int Bool, with + a fundep on class C. We don't want to report an insoluble Int~Bool; + c.f. "wanteds do not rewrite wanteds". Moreover, we keep *all* derived insolubles under some circumstances: @@ -1876,7 +1881,7 @@ Moreover, we keep *all* derived insolubles under some circumstances: generalise. Example: [W] a ~ Int, [W] a ~ Bool We get [D] Int ~ Bool, and indeed the constraints are insoluble, and we want simplifyInfer to see that, even though we don't - ultimately want to generate an (inexplicable) error message from + ultimately want to generate an (inexplicable) error message from it To distinguish these cases we use the CtOrigin. diff --git a/testsuite/tests/typecheck/should_fail/T13506.hs b/testsuite/tests/typecheck/should_fail/T13506.hs new file mode 100644 index 0000000..84e8fa9 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T13506.hs @@ -0,0 +1,26 @@ +{-# LANGUAGE FlexibleInstances, FunctionalDependencies, MultiParamTypeClasses #-} +module Bug where + +class FunDep lista a | lista -> a +instance FunDep [a] a + +singleton :: FunDep lista a => a -> lista +singleton _ = undefined + +-- this error is expected: +-- Couldn't match type 'Char' with '()' +-- arising from a functional dependency between +-- constraint 'FunDep [Char] ()' arising from a use of 'singleton' +-- instance 'FunDep [a] a' +illTyped :: [Char] +illTyped = singleton () + {- [W] FunDep [Char] () -} + +-- but this one is not: +-- Couldn't match type '()' with 'Char' +-- arising from a functional dependency between constraints: +-- 'FunDep [Char] Char' arising from a use of 'singleton' (in 'wellTyped') +-- 'FunDep [Char] ()' arising from a use of 'singleton' (in 'illTyped') +wellTyped :: [Char] +wellTyped = singleton 'a' + {- [W] FunDep [Char] Char -} diff --git a/testsuite/tests/typecheck/should_fail/T13506.stderr b/testsuite/tests/typecheck/should_fail/T13506.stderr new file mode 100644 index 0000000..50ea1b2 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T13506.stderr @@ -0,0 +1,8 @@ + +T13506.hs:16:12: error: + • Couldn't match type ‘Char’ with ‘()’ + arising from a functional dependency between: + constraint ‘FunDep [Char] ()’ arising from a use of ‘singleton’ + instance ‘FunDep [a] a’ at T13506.hs:5:10-21 + • In the expression: singleton () + In an equation for ‘illTyped’: illTyped = singleton () diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index 8fbe141..41c379e 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -431,3 +431,4 @@ test('T13292', normal, multimod_compile, ['T13292', '-v0 -fdefer-type-errors']) test('T13300', normal, compile_fail, ['']) test('T12709', normal, compile_fail, ['']) test('T13446', normal, compile_fail, ['']) +test('T13506', normal, compile_fail, ['']) From git at git.haskell.org Thu Apr 6 11:34:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 6 Apr 2017 11:34:26 +0000 (UTC) Subject: [commit: ghc] master: Add a missing addDeferredBinding (2f9f1f8) Message-ID: <20170406113426.2E1483A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2f9f1f86849ebc18af409c9b3fd809c9cd464021/ghc >--------------------------------------------------------------- commit 2f9f1f86849ebc18af409c9b3fd809c9cd464021 Author: Simon Peyton Jones Date: Wed Apr 5 13:39:51 2017 +0100 Add a missing addDeferredBinding I'd forgotten to add deferred bindings for user type errors. Fixes Trac #13487. >--------------------------------------------------------------- 2f9f1f86849ebc18af409c9b3fd809c9cd464021 compiler/typecheck/TcErrors.hs | 3 ++- testsuite/tests/typecheck/should_fail/T13487.hs | 19 +++++++++++++++++++ testsuite/tests/typecheck/should_fail/T13487.stderr | 5 +++++ testsuite/tests/typecheck/should_fail/all.T | 1 + 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/compiler/typecheck/TcErrors.hs b/compiler/typecheck/TcErrors.hs index 2ec11e8..ec33bc0 100644 --- a/compiler/typecheck/TcErrors.hs +++ b/compiler/typecheck/TcErrors.hs @@ -611,7 +611,8 @@ mkHoleReporter ctxt mkUserTypeErrorReporter :: Reporter mkUserTypeErrorReporter ctxt = mapM_ $ \ct -> do { err <- mkUserTypeError ctxt ct - ; maybeReportError ctxt err } + ; maybeReportError ctxt err + ; addDeferredBinding ctxt err ct } mkUserTypeError :: ReportErrCtxt -> Ct -> TcM ErrMsg mkUserTypeError ctxt ct = mkErrorMsgFromCt ctxt ct diff --git a/testsuite/tests/typecheck/should_fail/T13487.hs b/testsuite/tests/typecheck/should_fail/T13487.hs new file mode 100644 index 0000000..6b5462e --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T13487.hs @@ -0,0 +1,19 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE UndecidableInstances #-} +{-# OPTIONS_GHC -fdefer-type-errors #-} + +module T13487 where + +import Data.Kind (Constraint) +import GHC.TypeLits + +data Foo a b where + K :: Error a b => a -> b -> Foo a b + +type family Error a b :: Constraint where + Error Int Int = () + Error _ _ = TypeError ('Text "GHC panic in 3... 2... 1...") + +foo = K 'a' 'b' diff --git a/testsuite/tests/typecheck/should_fail/T13487.stderr b/testsuite/tests/typecheck/should_fail/T13487.stderr new file mode 100644 index 0000000..c6f6c26 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T13487.stderr @@ -0,0 +1,5 @@ + +T13487.hs:19:7: warning: [-Wdeferred-type-errors (in -Wdefault)] + • GHC panic in 3... 2... 1... + • In the expression: K 'a' 'b' + In an equation for ‘foo’: foo = K 'a' 'b' diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index 41c379e..fe69ce0 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -427,6 +427,7 @@ test('StrictBinds', normal, compile_fail, ['']) test('T13068', [extra_files(['T13068.hs', 'T13068a.hs', 'T13068.hs-boot', 'T13068m.hs'])], multimod_compile_fail, ['T13068m', '']) test('T13105', normal, compile_fail, ['']) test('LevPolyBounded', normal, compile_fail, ['']) +test('T13487', normal, compile, ['']) test('T13292', normal, multimod_compile, ['T13292', '-v0 -fdefer-type-errors']) test('T13300', normal, compile_fail, ['']) test('T12709', normal, compile_fail, ['']) From git at git.haskell.org Thu Apr 6 11:34:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 6 Apr 2017 11:34:29 +0000 (UTC) Subject: [commit: ghc] master: Comments and eta expand only (c90f833) Message-ID: <20170406113429.0C7D83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c90f8334fa99e8de1ecb7b135a2846bc4d2bf25a/ghc >--------------------------------------------------------------- commit c90f8334fa99e8de1ecb7b135a2846bc4d2bf25a Author: Simon Peyton Jones Date: Wed Apr 5 13:45:30 2017 +0100 Comments and eta expand only >--------------------------------------------------------------- c90f8334fa99e8de1ecb7b135a2846bc4d2bf25a compiler/typecheck/TcBinds.hs | 2 +- compiler/typecheck/TcType.hs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/typecheck/TcBinds.hs b/compiler/typecheck/TcBinds.hs index 1133e81..74f4b62 100644 --- a/compiler/typecheck/TcBinds.hs +++ b/compiler/typecheck/TcBinds.hs @@ -840,7 +840,7 @@ mkExport prag_fn qtvs theta ; wrap <- if sel_poly_ty `eqType` poly_ty -- NB: eqType ignores visibility then return idHsWrapper -- Fast path; also avoids complaint when we infer - -- an ambiguouse type and have AllowAmbiguousType + -- an ambiguous type and have AllowAmbiguousType -- e..g infer x :: forall a. F a -> Int else addErrCtxtM (mk_impedance_match_msg mono_info sel_poly_ty poly_ty) $ tcSubType_NC sig_ctxt sel_poly_ty poly_ty diff --git a/compiler/typecheck/TcType.hs b/compiler/typecheck/TcType.hs index 783b530..c76647c 100644 --- a/compiler/typecheck/TcType.hs +++ b/compiler/typecheck/TcType.hs @@ -1284,7 +1284,7 @@ mkSigmaTy bndrs theta tau = mkForAllTys bndrs (mkPhiTy theta tau) -- | Make a sigma ty where all type variables are 'Inferred'. That is, -- they cannot be used with visible type application. mkInfSigmaTy :: [TyVar] -> [PredType] -> Type -> Type -mkInfSigmaTy tyvars ty = mkSigmaTy (mkTyVarBinders Inferred tyvars) ty +mkInfSigmaTy tyvars theta ty = mkSigmaTy (mkTyVarBinders Inferred tyvars) theta ty -- | Make a sigma ty where all type variables are "specified". That is, -- they can be used with visible type application @@ -1889,7 +1889,7 @@ pickCapturedPreds -> TcThetaType -- Proposed constraints to quantify -> TcThetaType -- A subset that we can actually quantify -- A simpler version of pickQuantifiablePreds, used to winnow down --- the inferred constrains of a group of bindings, into those for +-- the inferred constraints of a group of bindings, into those for -- one particular identifier pickCapturedPreds qtvs theta = filter captured theta From git at git.haskell.org Thu Apr 6 11:34:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 6 Apr 2017 11:34:32 +0000 (UTC) Subject: [commit: ghc] master: Yet another attempt at inferring the right quantification (bac95f9) Message-ID: <20170406113432.77CC63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/bac95f9de5bd8d0a647a3a1e4492497603c2fda2/ghc >--------------------------------------------------------------- commit bac95f9de5bd8d0a647a3a1e4492497603c2fda2 Author: Simon Peyton Jones Date: Wed Apr 5 13:46:03 2017 +0100 Yet another attempt at inferring the right quantification TcSimplify.decideQuantification is truly a tricky function! Trac #13509 showed that we were being over-eager with defaulting of runtime-rep variables (levity polymorphism), which meant that a program was wrongly rejected, and with a very odd error message (c.f. Trac #13530) I spent an unreasonably long time figuring out how to fix this in a decent way, and ended up with a major refactoring of decideQuantification, with a kock-on effect in simplifyInfer. It is at least a bit more comprehensible now; but I still can't say I like it. >--------------------------------------------------------------- bac95f9de5bd8d0a647a3a1e4492497603c2fda2 compiler/typecheck/TcMType.hs | 95 +++---- compiler/typecheck/TcSimplify.hs | 306 ++++++++++++--------- .../indexed-types/should_fail/ExtraTcsUntch.stderr | 12 +- testsuite/tests/typecheck/should_compile/T13509.hs | 17 ++ testsuite/tests/typecheck/should_compile/all.T | 2 + 5 files changed, 255 insertions(+), 177 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc bac95f9de5bd8d0a647a3a1e4492497603c2fda2 From git at git.haskell.org Thu Apr 6 11:34:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 6 Apr 2017 11:34:35 +0000 (UTC) Subject: [commit: ghc] master: Comments only (2ab7f62) Message-ID: <20170406113435.5A6133A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2ab7f626b94a5da4b544e01072219a95cd588202/ghc >--------------------------------------------------------------- commit 2ab7f626b94a5da4b544e01072219a95cd588202 Author: Simon Peyton Jones Date: Thu Apr 6 08:26:18 2017 +0100 Comments only >--------------------------------------------------------------- 2ab7f626b94a5da4b544e01072219a95cd588202 compiler/typecheck/TcExpr.hs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/compiler/typecheck/TcExpr.hs b/compiler/typecheck/TcExpr.hs index 3bc6457..cbe94ea 100644 --- a/compiler/typecheck/TcExpr.hs +++ b/compiler/typecheck/TcExpr.hs @@ -607,6 +607,12 @@ tcExpr (HsProc pat cmd) res_ty -- Typechecks the static form and wraps it with a call to 'fromStaticPtr'. -- See Note [Grand plan for static forms] in StaticPtrTable for an overview. +-- To type check +-- (static e) :: p a +-- we want to check (e :: a), +-- and wrap (static e) in a call to +-- fromStaticPtr :: IsStatic p => StaticPtr a -> p a + tcExpr (HsStatic fvs expr) res_ty = do { res_ty <- expTypeToType res_ty ; (co, (p_ty, expr_ty)) <- matchExpectedAppTy res_ty @@ -615,6 +621,7 @@ tcExpr (HsStatic fvs expr) res_ty 2 (ppr expr) ) $ tcPolyExprNC expr expr_ty + -- Check that the free variables of the static form are closed. -- It's OK to use nonDetEltsUniqSet here as the only side effects of -- checkClosedInStaticForm are error messages. @@ -628,6 +635,7 @@ tcExpr (HsStatic fvs expr) res_ty ; _ <- emitWantedEvVar StaticOrigin $ mkTyConApp (classTyCon typeableClass) [liftedTypeKind, expr_ty] + -- Insert the constraints of the static form in a global list for later -- validation. ; emitStaticConstraints lie From git at git.haskell.org Thu Apr 6 11:34:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 6 Apr 2017 11:34:39 +0000 (UTC) Subject: [commit: ghc] master: Be less aggressive about fragile-context warrnings (65b185d) Message-ID: <20170406113439.383E53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/65b185d4886b4efa3efe3cc5ecc8dd6e07d89afe/ghc >--------------------------------------------------------------- commit 65b185d4886b4efa3efe3cc5ecc8dd6e07d89afe Author: Simon Peyton Jones Date: Thu Apr 6 12:27:43 2017 +0100 Be less aggressive about fragile-context warrnings In the implementation of WarnSimplifiableClassConstraints, be less aggressive about reporting a problem. We were complaining about a "fragile" case that in fact was not fragile. See Note [Simplifiable given constraints] in TcValidity. This fixes Trac #13526. >--------------------------------------------------------------- 65b185d4886b4efa3efe3cc5ecc8dd6e07d89afe compiler/typecheck/TcValidity.hs | 50 ++++++++++++++-------- .../should_compile/SomethingShowable.stderr | 10 +++-- testsuite/tests/typecheck/should_compile/T13526.hs | 22 ++++++++++ .../tests/typecheck/should_compile/T13526.stderr | 7 +++ testsuite/tests/typecheck/should_compile/all.T | 1 + 5 files changed, 69 insertions(+), 21 deletions(-) diff --git a/compiler/typecheck/TcValidity.hs b/compiler/typecheck/TcValidity.hs index 3023dfe..c28c21d 100644 --- a/compiler/typecheck/TcValidity.hs +++ b/compiler/typecheck/TcValidity.hs @@ -41,7 +41,7 @@ import HsSyn -- HsType import TcRnMonad -- TcType, amongst others import TcEnv ( tcGetInstEnvs ) import FunDeps -import InstEnv ( ClsInst, lookupInstEnv, isOverlappable ) +import InstEnv ( InstMatch, lookupInstEnv ) import FamInstEnv ( isDominatedBy, injectiveBranches, InjectivityCheckResult(..) ) import FamInst ( makeInjectivityErrors ) @@ -810,7 +810,8 @@ check_class_pred env dflags ctxt pred cls tys | otherwise = do { check_arity - ; check_simplifiable_class_constraint + ; warn_simp <- woptM Opt_WarnSimplifiableClassConstraints + ; when warn_simp check_simplifiable_class_constraint ; checkTcM arg_tys_ok (predTyVarErr env pred) } where check_arity = checkTc (classArity cls == length tys) @@ -833,25 +834,22 @@ check_class_pred env dflags ctxt pred cls tys | DataTyCtxt {} <- ctxt -- Don't do this check for the "stupid theta" = return () -- of a data type declaration | otherwise - = do { instEnvs <- tcGetInstEnvs - ; let (matches, _, _) = lookupInstEnv False instEnvs cls tys - bad_matches = [ inst | (inst,_) <- matches - , not (isOverlappable inst) ] - ; warnIf (Reason Opt_WarnSimplifiableClassConstraints) - (not (null bad_matches)) - (simplifiable_constraint_warn bad_matches) } - - simplifiable_constraint_warn :: [ClsInst] -> SDoc - simplifiable_constraint_warn (match : _) + = do { envs <- tcGetInstEnvs + ; case lookupInstEnv False envs cls tys of + ([m], [], _) -> addWarnTc (Reason Opt_WarnSimplifiableClassConstraints) + (simplifiable_constraint_warn m) + _ -> return () } + + simplifiable_constraint_warn :: InstMatch -> SDoc + simplifiable_constraint_warn (match, _) = vcat [ hang (text "The constraint" <+> quotes (ppr (tidyType env pred))) 2 (text "matches an instance declaration") , ppr match , hang (text "This makes type inference for inner bindings fragile;") 2 (text "either use MonoLocalBinds, or simplify it using the instance") ] - simplifiable_constraint_warn [] = pprPanic "check_class_pred" (ppr pred) {- Note [Simplifiable given constraints] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ A type signature like f :: Eq [(a,b)] => a -> b is very fragile, for reasons described at length in TcInteract @@ -862,9 +860,27 @@ fragility. But if we /infer/ the type of a local let-binding, things can go wrong (Trac #11948 is an example, discussed in the Note). So this warning is switched on only if we have NoMonoLocalBinds; in -that case the warning discourages uses from writing simplifiable class -constraints, at least unless the top-level instance is explicitly -declared as OVERLAPPABLE. +that case the warning discourages users from writing simplifiable +class constraints. + +The warning only fires if the constraint in the signature +matches the top-level instances in only one way, and with no +unifiers -- that is, under the same circumstances that +TcInteract.matchInstEnv fires an interaction with the top +level instances. For example (Trac #13526), consider + + instance {-# OVERLAPPABLE #-} Eq (T a) where ... + instance Eq (T Char) where .. + f :: Eq (T a) => ... + +We don't want to complain about this, even though the context +(Eq (T a)) matches an instance, because the user may be +deliberately deferring the choice so that the Eq (T Char) +has a chance to fire when 'f' is called. And the fragility +only matters when there's a risk that the instance might +fire instead of the local 'given'; and there is no such +risk in this case. Just use the same rules as for instance +firing! -} ------------------------- diff --git a/testsuite/tests/partial-sigs/should_compile/SomethingShowable.stderr b/testsuite/tests/partial-sigs/should_compile/SomethingShowable.stderr index 9f0ea1f..ca06301 100644 --- a/testsuite/tests/partial-sigs/should_compile/SomethingShowable.stderr +++ b/testsuite/tests/partial-sigs/should_compile/SomethingShowable.stderr @@ -7,7 +7,9 @@ Dependent packages: [base-4.10.0.0, ghc-prim-0.5.0.0, integer-gmp-1.0.0.1] SomethingShowable.hs:5:1: warning: [-Wsimplifiable-class-constraints (in -Wdefault)] - The constraint ‘Show Bool’ matches an instance declaration - instance Show Bool -- Defined in ‘GHC.Show’ - This makes type inference for inner bindings fragile; - either use MonoLocalBinds, or simplify it using the instance + • The constraint ‘Show Bool’ matches an instance declaration + instance Show Bool -- Defined in ‘GHC.Show’ + This makes type inference for inner bindings fragile; + either use MonoLocalBinds, or simplify it using the instance + • When checking the inferred type + somethingShowable :: Show Bool => Bool -> String diff --git a/testsuite/tests/typecheck/should_compile/T13526.hs b/testsuite/tests/typecheck/should_compile/T13526.hs new file mode 100644 index 0000000..efe32bd --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T13526.hs @@ -0,0 +1,22 @@ +{-# LANGUAGE FlexibleContexts, MultiParamTypeClasses, FlexibleInstances #-} + +module T13526 where + +class C a where + op :: a -> a + +instance {-# OVERLAPPING #-} C [Char] where + op x = x + +instance C a => C [a] where + op (x:xs) = [op x] + +instance C a => C (Maybe a) where + op x = error "urk" + +-- We should get no complaint +foo :: C [a] => a -> [a] +foo x = op [x] + +bar :: C (Maybe a) => a -> Maybe a +bar x = op (Just x) diff --git a/testsuite/tests/typecheck/should_compile/T13526.stderr b/testsuite/tests/typecheck/should_compile/T13526.stderr new file mode 100644 index 0000000..7a0f2ae --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T13526.stderr @@ -0,0 +1,7 @@ + +T13526.hs:21:8: warning: [-Wsimplifiable-class-constraints (in -Wdefault)] + • The constraint ‘C (Maybe a)’ matches an instance declaration + instance C a => C (Maybe a) -- Defined at T13526.hs:14:10 + This makes type inference for inner bindings fragile; + either use MonoLocalBinds, or simplify it using the instance + • In the type signature: bar :: C (Maybe a) => a -> Maybe a diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index bbf3ccd..c41da18 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -553,4 +553,5 @@ test('T13490', normal, compile, ['']) test('T13474', normal, compile, ['']) test('T13524', expect_broken(13524), compile, ['']) test('T13509', normal, compile, ['']) +test('T13526', normal, compile, ['']) From git at git.haskell.org Thu Apr 6 21:44:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 6 Apr 2017 21:44:30 +0000 (UTC) Subject: [commit: ghc] master: Fix name of Note (a8a7ca5) Message-ID: <20170406214430.48E483A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a8a7ca5e8a320028f984d808df1cbe6182fa27a7/ghc >--------------------------------------------------------------- commit a8a7ca5e8a320028f984d808df1cbe6182fa27a7 Author: Ben Gamari Date: Thu Apr 6 15:58:08 2017 -0400 Fix name of Note >--------------------------------------------------------------- a8a7ca5e8a320028f984d808df1cbe6182fa27a7 compiler/coreSyn/CoreUtils.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/coreSyn/CoreUtils.hs b/compiler/coreSyn/CoreUtils.hs index 3dfb52f..a319a7c 100644 --- a/compiler/coreSyn/CoreUtils.hs +++ b/compiler/coreSyn/CoreUtils.hs @@ -1279,7 +1279,7 @@ it's applied only to dictionaries. -- exprOkForSpeculation implies exprOkForSideEffects -- -- See Note [PrimOp can_fail and has_side_effects] in PrimOp --- and Note [Implementation: how can_fail/has_side_effects affect transformations] +-- and Note [Transformations affected by can_fail and has_side_effects] -- -- As an example of the considerations in this test, consider: -- From git at git.haskell.org Thu Apr 6 21:44:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 6 Apr 2017 21:44:33 +0000 (UTC) Subject: [commit: ghc] master: Enable lint checking of levity polymorphic coercions (f3af046) Message-ID: <20170406214433.012C83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f3af0463c81002a64a3b3e9a01351e64460c490f/ghc >--------------------------------------------------------------- commit f3af0463c81002a64a3b3e9a01351e64460c490f Author: Ben Gamari Date: Thu Apr 6 16:38:45 2017 -0400 Enable lint checking of levity polymorphic coercions This reverts commit 03c7dd0941fb4974be54026ef3e4bb97451c3b1f and fixes the coercions. >--------------------------------------------------------------- f3af0463c81002a64a3b3e9a01351e64460c490f compiler/coreSyn/CoreLint.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/compiler/coreSyn/CoreLint.hs b/compiler/coreSyn/CoreLint.hs index 16edcb8..8182272 100644 --- a/compiler/coreSyn/CoreLint.hs +++ b/compiler/coreSyn/CoreLint.hs @@ -1646,7 +1646,11 @@ lintCoercion co@(UnivCo prov r ty1 ty2) -- see #9122 for discussion of these checks checkTypes t1 t2 - = do { when (not (lev_poly1 || lev_poly2)) $ + = do { checkWarnL (not lev_poly1) + (report "left-hand type is levity-polymorphic") + ; checkWarnL (not lev_poly2) + (report "right-hand type is levity-polymorphic") + ; when (not (lev_poly1 || lev_poly2)) $ do { checkWarnL (reps1 `equalLength` reps2) (report "between values with different # of reps") ; zipWithM_ validateCoercion reps1 reps2 }} From git at git.haskell.org Thu Apr 6 21:44:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 6 Apr 2017 21:44:36 +0000 (UTC) Subject: [commit: ghc] master: Add regression test for #13538 (e61900c) Message-ID: <20170406214436.112133A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e61900c994334c209a9de763993716314abf9f6d/ghc >--------------------------------------------------------------- commit e61900c994334c209a9de763993716314abf9f6d Author: Ryan Scott Date: Thu Apr 6 16:42:39 2017 -0400 Add regression test for #13538 Commit 2b64e926a628fb2a3710b0360123ea73331166fe (#13135) ended up fixing #13538 as well. Let's add a regression test so that it stays fixed. Test Plan: make test TEST=T13538 Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #13538 Differential Revision: https://phabricator.haskell.org/D3426 >--------------------------------------------------------------- e61900c994334c209a9de763993716314abf9f6d testsuite/tests/dependent/should_compile/T13538.hs | 45 ++++++++++++++++++++++ testsuite/tests/dependent/should_compile/all.T | 1 + 2 files changed, 46 insertions(+) diff --git a/testsuite/tests/dependent/should_compile/T13538.hs b/testsuite/tests/dependent/should_compile/T13538.hs new file mode 100644 index 0000000..f9d904f --- /dev/null +++ b/testsuite/tests/dependent/should_compile/T13538.hs @@ -0,0 +1,45 @@ +{-# LANGUAGE UndecidableInstances #-} +{-# LANGUAGE TypeFamilies, TypeFamilyDependencies #-} +{-# LANGUAGE KindSignatures, DataKinds, PolyKinds #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE TypeApplications #-} +module T13538 where + +import GHC.TypeLits +import Data.Proxy + +-- | Synonym for a type-level snoc (injective!) +type (ns :: [k]) +: (n :: k) = GetList1 (SinkFirst (n ': ns)) +infixl 5 +: + + + +-- | A weird data type used to make `(+:)` operation injective. +-- `List k [k]` must have at least two elements. +data List1 k = L1Single k | L1Head k [k] + +-- | Sink first element of a list to the end of the list +type family SinkFirst (xs :: [k]) = (ys :: List1 k) | ys -> xs where + SinkFirst '[y] = 'L1Single y + -- SinkFirst (y ': x ': xs :: [Nat]) + -- = ('L1Head x (GetList1Nat (SinkFirst (y ': xs))) :: List1 Nat) + SinkFirst (y ': x ': xs :: [k]) + = ('L1Head x (GetList1 (SinkFirst (y ': xs))) :: List1 k) + +type family GetList1 (ts :: List1 k) = (rs :: [k]) | rs -> ts where + GetList1 ('L1Single x) = '[x] + GetList1 ('L1Head y (x ':xs)) = y ': x ': xs +type family GetList1Nat (ts :: List1 Nat) = (rs :: [Nat]) | rs -> ts where + GetList1Nat ('L1Single x) = '[x] + GetList1Nat ('L1Head y (x ': xs)) = y ': x ': xs + +type family (++) (as :: [k]) (bs :: [k]) :: [k] where + '[] ++ bs = bs + (a ': as) ++ bs = a ': (as ++ bs) + + +ff :: Proxy k -> Proxy (as +: k) -> Proxy (k ': bs) -> Proxy (as ++ bs) +ff _ _ _ = Proxy + +yy :: Proxy '[3,7,2] +yy = ff (Proxy @5) (Proxy @'[3,7,5]) (Proxy @'[5,2]) diff --git a/testsuite/tests/dependent/should_compile/all.T b/testsuite/tests/dependent/should_compile/all.T index 6d39e45..a921743 100644 --- a/testsuite/tests/dependent/should_compile/all.T +++ b/testsuite/tests/dependent/should_compile/all.T @@ -22,3 +22,4 @@ test('RaeJobTalk', normal, compile, ['']) test('T11635', normal, compile, ['']) test('T11719', normal, compile, ['']) test('T12442', normal, compile, ['']) +test('T13538', normal, compile, ['']) From git at git.haskell.org Thu Apr 6 21:44:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 6 Apr 2017 21:44:41 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Update expected performance numbers on 32-bit Linux (1d82e07) Message-ID: <20170406214441.826B13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1d82e0724a14f3f6587f64aa4d667eb6c4a0f25d/ghc >--------------------------------------------------------------- commit 1d82e0724a14f3f6587f64aa4d667eb6c4a0f25d Author: Ben Gamari Date: Thu Apr 6 17:22:28 2017 -0400 testsuite: Update expected performance numbers on 32-bit Linux The Harbormaster build seems to slightly disagree with my local build machine on a few of these. In the case of `haddock.compiler` the difference is nearly an order of magnitude. Odd. >--------------------------------------------------------------- 1d82e0724a14f3f6587f64aa4d667eb6c4a0f25d testsuite/tests/perf/compiler/all.T | 10 ++++++---- testsuite/tests/perf/haddock/all.T | 7 ++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index aa7b811..7b56f0b 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -62,14 +62,15 @@ test('T1969', # 2013-02-10 5030080 (x86/Windows) # 2013-11-13 7295012 (x86/Windows, 64bit machine) # 2014-04-24 5719436 (x86/Windows, 64bit machine) - (wordsize(32), 9261052, 1), + (wordsize(32), 9418680, 1), # 6707308 (x86/OS X) # 2009-12-31 6149572 (x86/Linux) # 2014-01-22 6429864 (x86/Linux) # 2014-06-29 5949188 (x86/Linux) - # 2015-07-11 6241108 (x86/Linux, 64bit machine) use +RTS -G1 - # 2016-04-06 9093608 (x86/Linux, 64bit machine) + # 2015-07-11 6241108 (x86/Linux, 64-bit machine) use +RTS -G1 + # 2016-04-06 9093608 (x86/Linux, 64-bit machine) # 2017-03-24 9261052 (x86/Linux, 64-bit machine) + # 2017-04-06 9418680 (x86/Linux, 64-bit machine) (wordsize(64), 16679176, 15)]), # 2014-09-10 10463640, 10 # post-AMP-update (somewhat stabelish) @@ -293,12 +294,13 @@ test('T4801', test('T3064', [compiler_stats_num_field('peak_megabytes_allocated',# Note [residency] - [(wordsize(32), 28, 20), + [(wordsize(32), 36, 20), # expected value: 14 (x86/Linux 28-06-2012): # 2013-11-13: 18 (x86/Windows, 64bit machine) # 2014-01-22: 23 (x86/Linux) # 2014-12-22: 23 (x86/Linux) death to silent superclasses # 2015-07-11: 28 (x86/Linux, 64-bit machine) use +RTS -G1 + # 2017-04-06: 36 (x86/Linux, 64-bit machine) it's unclear (wordsize(64), 66, 20)]), # (amd64/Linux): 18 diff --git a/testsuite/tests/perf/haddock/all.T b/testsuite/tests/perf/haddock/all.T index 4de07f4..bfce7ba 100644 --- a/testsuite/tests/perf/haddock/all.T +++ b/testsuite/tests/perf/haddock/all.T @@ -48,7 +48,7 @@ test('haddock.base', # 2015-01-20: 4434804940 (x86/Windows, 64bit machine) # 2017-04-02: 2885173512 update - ,(wordsize(32), 3819657568, 5)]) + ,(wordsize(32), 3445319728, 5)]) # 2012-08-14: 3046487920 (x86/OSX) # 2012-10-30: 2955470952 (x86/Windows) # 2013-02-10: 3146596848 (x86/OSX) @@ -56,6 +56,7 @@ test('haddock.base', # 2014-06-29: 3799130400 (x86/Linux) # 2016-04-06: 5509757068 (x86/Linux) # 2017-03-24: 3819657568 (x86/Linux) + # 2017-04-06: 3445319728 (x86/Linux) ], stats, ['haddock.t']) @@ -159,12 +160,12 @@ test('haddock.compiler', # 2014-12-10: 217933548 increased again # 2017-04-02: 367546388 update - ,(wordsize(32), 118738876, 5)]) + ,(wordsize(32), 3775852520, 5)]) # 2012-08-14: 13471797488 (x86/OSX) # 2014-01-22: 14581475024 (x86/Linux - new haddock) # 2014-06-29: 15110426000 (x86/Linux) # 2016-04-06: 16222702892 (x86/Linux) - # 2017-03-24: 118738876 (x86/Linux) + # 2017-03-24: 3775852520 (x86/Linux) ], stats, ['haddock.t']) From git at git.haskell.org Thu Apr 6 21:44:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 6 Apr 2017 21:44:38 +0000 (UTC) Subject: [commit: ghc] master: base: Run num009 with -msse2 on i386 (e5e07be) Message-ID: <20170406214438.C25DB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e5e07be2df1a0d6f1cb47e9d301053445020589c/ghc >--------------------------------------------------------------- commit e5e07be2df1a0d6f1cb47e9d301053445020589c Author: Ben Gamari Date: Thu Apr 6 17:14:47 2017 -0400 base: Run num009 with -msse2 on i386 x87's transcendental instructions are terribly imprecise and fail this test. Moreover, we really ouch to enable -mse2 on i386 by default as it is nearly universally supported at this point. See #13540. >--------------------------------------------------------------- e5e07be2df1a0d6f1cb47e9d301053445020589c libraries/base/tests/Numeric/all.T | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libraries/base/tests/Numeric/all.T b/libraries/base/tests/Numeric/all.T index 36b2d6f..a0a9d68 100644 --- a/libraries/base/tests/Numeric/all.T +++ b/libraries/base/tests/Numeric/all.T @@ -6,6 +6,12 @@ test('num005', normal, compile_and_run, ['']) test('num006', normal, compile_and_run, ['']) test('num007', normal, compile_and_run, ['']) test('num008', normal, compile_and_run, ['']) + +# On i386, we need -msse2 to get reliable floating point results +if config.arch == 'i386': + opts = '-msse2' +else: + opts = '' test('num009', [ when(fast(), skip) , when(platform('i386-apple-darwin'), expect_broken(2370)) , when(opsys('mingw32'), omit_ways(['ghci'])) ], @@ -14,7 +20,7 @@ test('num009', [ when(fast(), skip) # serious, since the results for lower numbers are all fine. # We also get another set of results for 1e02 with GHCi, so # I'm skipping that way altogether. - compile_and_run, ['']) + compile_and_run, [opts]) test('num010', when(platform('i386-apple-darwin'), expect_broken_for(7043, 'ghci')), compile_and_run, From git at git.haskell.org Thu Apr 6 21:44:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 6 Apr 2017 21:44:44 +0000 (UTC) Subject: [commit: ghc] master: More changes to fix a space leak in the simplifier (#13426) (59c925e) Message-ID: <20170406214444.45D373A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/59c925e88a1dcb98e62c2b5e0adaa299c3b15e44/ghc >--------------------------------------------------------------- commit 59c925e88a1dcb98e62c2b5e0adaa299c3b15e44 Author: Reid Barton Date: Thu Apr 6 17:44:08 2017 -0400 More changes to fix a space leak in the simplifier (#13426) Part of e13419c55 was accidentally lost during a rebase. This commit adds the missing change, along with some more improvements regarding where we do and don't use `seqType`. Also include a comment about where the space leak showed up and a Note explaining the strategy being used here. Test Plan: harbormaster, plus local testing on DynFlags Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3421 >--------------------------------------------------------------- 59c925e88a1dcb98e62c2b5e0adaa299c3b15e44 compiler/simplCore/Simplify.hs | 85 +++++++++++++++++++++++++++++++++++------- 1 file changed, 72 insertions(+), 13 deletions(-) diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index a518618..e2782d7 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -974,7 +974,7 @@ might do the same again. simplExpr :: SimplEnv -> CoreExpr -> SimplM CoreExpr simplExpr env (Type ty) - = do { ty' <- simplType env ty + = do { ty' <- simplType env ty -- See Note [Avoiding space leaks in OutType] ; return (Type ty') } simplExpr env expr @@ -1031,14 +1031,24 @@ simplExprF1 env (Tick t expr) cont = simplTick env t expr cont simplExprF1 env (Cast body co) cont = simplCast env body co cont simplExprF1 env (Coercion co) cont = simplCoercionF env co cont - simplExprF1 env (App fun arg) cont - = simplExprF env fun $ - case arg of - Type ty -> ApplyToTy { sc_arg_ty = substTy env ty - , sc_hole_ty = substTy env (exprType fun) - , sc_cont = cont } - _ -> ApplyToVal { sc_arg = arg, sc_env = env + = case arg of + Type ty -> do { -- The argument type will (almost) certainly be used + -- in the output program, so just force it now. + -- See Note [Avoiding space leaks in OutType] + arg' <- simplType env ty + + -- But use substTy, not simplType, to avoid forcing + -- the hole type; it will likely not be needed. + -- See Note [The hole type in ApplyToTy] + ; let hole' = substTy env (exprType fun) + + ; simplExprF env fun $ + ApplyToTy { sc_arg_ty = arg' + , sc_hole_ty = hole' + , sc_cont = cont } } + _ -> simplExprF env fun $ + ApplyToVal { sc_arg = arg, sc_env = env , sc_dup = NoDup, sc_cont = cont } simplExprF1 env expr@(Lam {}) cont @@ -1080,6 +1090,50 @@ simplExprF1 env (Let (NonRec bndr rhs) body) cont | otherwise = simplNonRecE env bndr (rhs, env) ([], body) cont +{- Note [Avoiding space leaks in OutType] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Since the simplifier is run for multiple iterations, we need to ensure +that any thunks in the output of one simplifier iteration are forced +by the evaluation of the next simplifier iteration. Otherwise we may +retain multiple copies of the Core program and leak a terrible amount +of memory (as in #13426). + +The simplifier is naturally strict in the entire "Expr part" of the +input Core program, because any expression may contain binders, which +we must find in order to extend the SimplEnv accordingly. But types +do not contain binders and so it is tempting to write things like + + simplExpr env (Type ty) = return (Type (substTy env ty)) -- Bad! + +This is Bad because the result includes a thunk (substTy env ty) which +retains a reference to the whole simplifier environment; and the next +simplifier iteration will not force this thunk either, because the +line above is not strict in ty. + +So instead our strategy is for the simplifier to fully evaluate +OutTypes when it emits them into the output Core program, for example + + simplExpr env (Type ty) = do { ty' <- simplType env ty -- Good + ; return (Type ty') } + +where the only difference from above is that simplType calls seqType +on the result of substTy. + +However, SimplCont can also contain OutTypes and it's not necessarily +a good idea to force types on the way in to SimplCont, because they +may end up not being used and forcing them could be a lot of wasted +work. T5631 is a good example of this. + +- For ApplyToTy's sc_arg_ty, we force the type on the way in because + the type will almost certainly appear as a type argument in the + output program. + +- For the hole types in Stop and ApplyToTy, we force the type when we + emit it into the output program, after obtaining it from + contResultType. (The hole type in ApplyToTy is only directly used + to form the result type in a new Stop continuation.) +-} + --------------------------------- -- Simplify a join point, adding the context. -- Context goes *inside* the lambdas. IOW, if the join point has arity n, we do: @@ -1101,6 +1155,7 @@ simplJoinRhs env bndr expr cont --------------------------------- simplType :: SimplEnv -> InType -> SimplM OutType -- Kept monadic just so we can do the seqType + -- See Note [Avoiding space leaks in OutType] simplType env ty = -- pprTrace "simplType" (ppr ty $$ ppr (seTvSubst env)) $ seqType new_ty `seq` return new_ty @@ -1659,8 +1714,11 @@ rebuildCall env (ArgInfo { ai_fun = fun, ai_args = rev_args, ai_strs = [] }) con -- the continuation, leaving just the bottoming expression. But the -- type might not be right, so we may have to add a coerce. | not (contIsTrivial cont) -- Only do this if there is a non-trivial - = return (env, castBottomExpr res cont_ty) -- continuation to discard, else we do it - where -- again and again! + -- continuation to discard, else we do it + -- again and again! + = seqType cont_ty `seq` -- See Note [Avoiding space leaks in OutType] + return (env, castBottomExpr res cont_ty) + where res = argInfoExpr fun rev_args cont_ty = contResultType cont @@ -2251,8 +2309,7 @@ reallyRebuildCase env scrut case_bndr alts cont ; dflags <- getDynFlags ; let alts_ty' = contResultType dup_cont - -- The seqType below is needed to avoid a space leak (#13426) - -- but I don't know why. + -- See Note [Avoiding space leaks in OutType] ; case_expr <- seqType alts_ty' `seq` mkCase dflags scrut' case_bndr' alts_ty' alts' @@ -2637,7 +2694,9 @@ missingAlt :: SimplEnv -> Id -> [InAlt] -> SimplCont -> SimplM (SimplEnv, OutExp -- inaccessible. So we simply put an error case here instead. missingAlt env case_bndr _ cont = WARN( True, text "missingAlt" <+> ppr case_bndr ) - return (env, mkImpossibleExpr (contResultType cont)) + -- See Note [Avoiding space leaks in OutType] + let cont_ty = contResultType cont + in seqType cont_ty `seq` return (env, mkImpossibleExpr cont_ty) {- ************************************************************************ From git at git.haskell.org Thu Apr 6 22:05:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 6 Apr 2017 22:05:05 +0000 (UTC) Subject: [commit: ghc] master: add $(CrossCompilePrefix) to 'runghc' and 'ghci' (732b3db) Message-ID: <20170406220505.AAF803A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/732b3dbbff194eb8650c75afd79d892801afa0dc/ghc >--------------------------------------------------------------- commit 732b3dbbff194eb8650c75afd79d892801afa0dc Author: Sergei Trofimovich Date: Thu Apr 6 22:48:13 2017 +0100 add $(CrossCompilePrefix) to 'runghc' and 'ghci' When Stage1Only=YES install mode is used one of rare tools that lack $(CrossCompilePrefix) prefix are 'runghc' and 'ghci'. This causes file collisions when multiple GHC crosscompilers are installed in system. Signed-off-by: Sergei Trofimovich >--------------------------------------------------------------- 732b3dbbff194eb8650c75afd79d892801afa0dc driver/ghci/ghc.mk | 8 ++++---- utils/runghc/ghc.mk | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/driver/ghci/ghc.mk b/driver/ghci/ghc.mk index 41d1f15..0f31884 100644 --- a/driver/ghci/ghc.mk +++ b/driver/ghci/ghc.mk @@ -16,16 +16,16 @@ ifneq "$(Windows_Host)" "YES" install: install_driver_ghci .PHONY: install_driver_ghci -install_driver_ghci: WRAPPER=$(DESTDIR)$(bindir)/ghci-$(ProjectVersion) +install_driver_ghci: WRAPPER=$(DESTDIR)$(bindir)/$(CrossCompilePrefix)ghci-$(ProjectVersion) install_driver_ghci: $(INSTALL_DIR) "$(DESTDIR)$(bindir)" $(call removeFiles, "$(WRAPPER)") $(CREATE_SCRIPT) "$(WRAPPER)" echo '#!$(SHELL)' >> "$(WRAPPER)" - echo 'exec "$(bindir)/ghc-$(ProjectVersion)" --interactive "$$@"' >> "$(WRAPPER)" + echo 'exec "$(bindir)/$(CrossCompilePrefix)ghc-$(ProjectVersion)" --interactive "$$@"' >> "$(WRAPPER)" $(EXECUTABLE_FILE) "$(WRAPPER)" - $(call removeFiles,"$(DESTDIR)$(bindir)/ghci") - $(LN_S) ghci-$(ProjectVersion) "$(DESTDIR)$(bindir)/ghci" + $(call removeFiles,"$(DESTDIR)$(bindir)/$(CrossCompilePrefix)ghci") + $(LN_S) $(CrossCompilePrefix)ghci-$(ProjectVersion) "$(DESTDIR)$(bindir)/$(CrossCompilePrefix)ghci" else # Windows_Host... diff --git a/utils/runghc/ghc.mk b/utils/runghc/ghc.mk index 9169ca2..50b11a6 100644 --- a/utils/runghc/ghc.mk +++ b/utils/runghc/ghc.mk @@ -34,11 +34,11 @@ install: install_runhaskell .PHONY: install_runhaskell ifeq "$(Windows_Host)" "YES" install_runhaskell: install_bins - "$(CP)" $(DESTDIR)$(bindir)/runghc$(exeext1) $(DESTDIR)$(bindir)/runhaskell$(exeext1) + "$(CP)" $(DESTDIR)$(bindir)/$(CrossCompilePrefix)runghc$(exeext1) $(DESTDIR)$(bindir)/$(CrossCompilePrefix)runhaskell$(exeext1) else install_runhaskell: - $(call removeFiles,"$(DESTDIR)$(bindir)/runhaskell") - $(LN_S) runghc "$(DESTDIR)$(bindir)/runhaskell" - $(call removeFiles,"$(DESTDIR)$(bindir)/runghc") - $(LN_S) runghc-$(ProjectVersion) "$(DESTDIR)$(bindir)/runghc" + $(call removeFiles,"$(DESTDIR)$(bindir)/$(CrossCompilePrefix)runhaskell") + $(LN_S) $(CrossCompilePrefix)runghc "$(DESTDIR)$(bindir)/$(CrossCompilePrefix)runhaskell" + $(call removeFiles,"$(DESTDIR)$(bindir)/$(CrossCompilePrefix)runghc") + $(LN_S) $(CrossCompilePrefix)runghc-$(ProjectVersion) "$(DESTDIR)$(bindir)/$(CrossCompilePrefix)runghc" endif From git at git.haskell.org Thu Apr 6 22:29:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 6 Apr 2017 22:29:14 +0000 (UTC) Subject: [commit: packages/binary] master: Class: Drop Data.Typeable import for GHC <8.2 (e3ee6ce) Message-ID: <20170406222914.18E513A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/e3ee6ce128f031b2be2cb71bfe23b8605ff433ff >--------------------------------------------------------------- commit e3ee6ce128f031b2be2cb71bfe23b8605ff433ff Author: Ben Gamari Date: Mon Mar 13 10:12:21 2017 -0400 Class: Drop Data.Typeable import for GHC <8.2 >--------------------------------------------------------------- e3ee6ce128f031b2be2cb71bfe23b8605ff433ff src/Data/Binary/Class.hs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Data/Binary/Class.hs b/src/Data/Binary/Class.hs index dd70f39..03396ba 100644 --- a/src/Data/Binary/Class.hs +++ b/src/Data/Binary/Class.hs @@ -78,8 +78,6 @@ import Type.Reflection import Type.Reflection.Unsafe import Data.Kind (Type) import GHC.Exts (RuntimeRep(..), VecCount, VecElem) -#else -import Data.Typeable #endif import qualified Data.ByteString as B #if MIN_VERSION_bytestring(0,10,4) From git at git.haskell.org Thu Apr 6 22:29:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 6 Apr 2017 22:29:16 +0000 (UTC) Subject: [commit: packages/binary] master: Merge pull request #135 from bgamari/master (2e55a24) Message-ID: <20170406222916.1E2E23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/2e55a24969f3be906ee0ae6532d110f82fd55fa3 >--------------------------------------------------------------- commit 2e55a24969f3be906ee0ae6532d110f82fd55fa3 Merge: 0147456 e3ee6ce Author: Lennart Kolmodin Date: Mon Mar 13 21:22:46 2017 +0100 Merge pull request #135 from bgamari/master Class: Drop Data.Typeable import for GHC <8.2 >--------------------------------------------------------------- 2e55a24969f3be906ee0ae6532d110f82fd55fa3 src/Data/Binary/Class.hs | 2 -- 1 file changed, 2 deletions(-) From git at git.haskell.org Thu Apr 6 22:29:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 6 Apr 2017 22:29:20 +0000 (UTC) Subject: [commit: packages/binary] master: Update changelog.md with news for 0.9.0.0. (1289670) Message-ID: <20170406222920.2B9A93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/128967065ab863654633fbda54fe7f467647abb5 >--------------------------------------------------------------- commit 128967065ab863654633fbda54fe7f467647abb5 Author: Lennart Kolmodin Date: Mon Mar 13 22:54:25 2017 +0100 Update changelog.md with news for 0.9.0.0. >--------------------------------------------------------------- 128967065ab863654633fbda54fe7f467647abb5 changelog.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/changelog.md b/changelog.md index 8cff85d..e12f096 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,11 @@ binary ====== +binary-0.9.0.0 +-------------- + +- Add Binary instances for Typeable TypeReps, #131. + binary-0.8.4.1 -------------- From git at git.haskell.org Thu Apr 6 22:29:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 6 Apr 2017 22:29:24 +0000 (UTC) Subject: [commit: packages/binary] master: Set version to 0.8.5.0. (64fd71c) Message-ID: <20170406222924.389E43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/64fd71cf8f093da566ad3865783e60f92dc5d70b >--------------------------------------------------------------- commit 64fd71cf8f093da566ad3865783e60f92dc5d70b Author: Lennart Kolmodin Date: Sun Apr 2 18:21:21 2017 +0200 Set version to 0.8.5.0. Same as version 0.9.0.0. There were no new breaking changes, so let's go back to major 0.8. >--------------------------------------------------------------- 64fd71cf8f093da566ad3865783e60f92dc5d70b binary.cabal | 2 +- changelog.md | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/binary.cabal b/binary.cabal index f181d77..f926e83 100644 --- a/binary.cabal +++ b/binary.cabal @@ -1,5 +1,5 @@ name: binary -version: 0.9.0.0 +version: 0.8.5.0 license: BSD3 license-file: LICENSE author: Lennart Kolmodin diff --git a/changelog.md b/changelog.md index e12f096..98afc48 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,14 @@ binary binary-0.9.0.0 -------------- +- `0.8.5.0` was first released as version `0.9.0.0`. It didn't have any + breaking changes though, so it was again released as version `0.8.5.0` + according to PVP. Next breaking release of `binary` will be version + `0.10.0.0`. + +binary-0.8.5.0 +-------------- + - Add Binary instances for Typeable TypeReps, #131. binary-0.8.4.1 From git at git.haskell.org Thu Apr 6 22:29:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 6 Apr 2017 22:29:18 +0000 (UTC) Subject: [commit: packages/binary] master: Test typeRep function to increase test coverage. (a5e9339) Message-ID: <20170406222918.2532E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/a5e9339ad87fb9a721b0984fe48891b44b946e5d >--------------------------------------------------------------- commit a5e9339ad87fb9a721b0984fe48891b44b946e5d Author: Lennart Kolmodin Date: Mon Mar 13 22:53:44 2017 +0100 Test typeRep function to increase test coverage. >--------------------------------------------------------------- a5e9339ad87fb9a721b0984fe48891b44b946e5d tests/QC.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/QC.hs b/tests/QC.hs index 6577ffe..7dc4275 100644 --- a/tests/QC.hs +++ b/tests/QC.hs @@ -175,6 +175,7 @@ atomicTypeReps = , typeRep (Proxy :: Proxy '[1,2,3,4]) , typeRep (Proxy :: Proxy ('Left Int)) , typeRep (Proxy :: Proxy (Either Int String)) + , typeRep (Proxy :: Proxy (() -> ())) ] instance Arbitrary TypeRep where From git at git.haskell.org Thu Apr 6 22:29:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 6 Apr 2017 22:29:22 +0000 (UTC) Subject: [commit: packages/binary] master: Bump version to 0.9.0.0. (71e8542) Message-ID: <20170406222922.3215A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/71e8542cecdb03fa0349cd3cbb04453695877951 >--------------------------------------------------------------- commit 71e8542cecdb03fa0349cd3cbb04453695877951 Author: Lennart Kolmodin Date: Mon Mar 13 22:54:47 2017 +0100 Bump version to 0.9.0.0. >--------------------------------------------------------------- 71e8542cecdb03fa0349cd3cbb04453695877951 binary.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/binary.cabal b/binary.cabal index 69ae150..f181d77 100644 --- a/binary.cabal +++ b/binary.cabal @@ -1,5 +1,5 @@ name: binary -version: 0.8.4.1 +version: 0.9.0.0 license: BSD3 license-file: LICENSE author: Lennart Kolmodin From git at git.haskell.org Thu Apr 6 22:29:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 6 Apr 2017 22:29:28 +0000 (UTC) Subject: [commit: packages/binary] master: Bump version to 0.8.5.1. (d4a030a) Message-ID: <20170406222928.47C013A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/d4a030ab448191f664fc734bfbee61450a6fa5af >--------------------------------------------------------------- commit d4a030ab448191f664fc734bfbee61450a6fa5af Author: Lennart Kolmodin Date: Sun Apr 2 18:48:09 2017 +0200 Bump version to 0.8.5.1. >--------------------------------------------------------------- d4a030ab448191f664fc734bfbee61450a6fa5af binary.cabal | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/binary.cabal b/binary.cabal index f926e83..aa1561c 100644 --- a/binary.cabal +++ b/binary.cabal @@ -1,5 +1,5 @@ name: binary -version: 0.8.5.0 +version: 0.8.5.1 license: BSD3 license-file: LICENSE author: Lennart Kolmodin @@ -18,7 +18,7 @@ category: Data, Parsing stability: provisional build-type: Simple cabal-version: >= 1.8 -tested-with: GHC == 7.4.2, GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.3 +tested-with: GHC == 7.4.2, GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.2 extra-source-files: README.md changelog.md docs/hcar/binary-Lb.tex tools/derive/*.hs From git at git.haskell.org Thu Apr 6 22:29:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 6 Apr 2017 22:29:26 +0000 (UTC) Subject: [commit: packages/binary] master: Fix comments. (6e1cb3b) Message-ID: <20170406222926.41A863A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary On branch : master Link : http://git.haskell.org/packages/binary.git/commitdiff/6e1cb3b10b344e82742d866605fbe33b0d55a172 >--------------------------------------------------------------- commit 6e1cb3b10b344e82742d866605fbe33b0d55a172 Author: Lennart Kolmodin Date: Sun Apr 2 18:47:27 2017 +0200 Fix comments. >--------------------------------------------------------------- 6e1cb3b10b344e82742d866605fbe33b0d55a172 src/Data/Binary/Class.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Data/Binary/Class.hs b/src/Data/Binary/Class.hs index 03396ba..4d1c436 100644 --- a/src/Data/Binary/Class.hs +++ b/src/Data/Binary/Class.hs @@ -849,17 +849,17 @@ instance Binary a => Binary (NE.NonEmpty a) where -- * 'SomeTypeRep' (also known as 'Data.Typeable.TypeRep') -- --- | @since 0.9.0.0. See #typeable-instances# +-- | @since 0.8.5.0. See #typeable-instances# instance Binary VecCount where put = putWord8 . fromIntegral . fromEnum get = toEnum . fromIntegral <$> getWord8 --- | @since 0.9.0.0. See #typeable-instances# +-- | @since 0.8.5.0. See #typeable-instances# instance Binary VecElem where put = putWord8 . fromIntegral . fromEnum get = toEnum . fromIntegral <$> getWord8 --- | @since 0.9.0.0. See #typeable-instances# +-- | @since 0.8.5.0. See #typeable-instances# instance Binary RuntimeRep where put (VecRep a b) = putWord8 0 >> put a >> put b put (TupleRep reps) = putWord8 1 >> put reps @@ -891,7 +891,7 @@ instance Binary RuntimeRep where 11 -> pure DoubleRep _ -> fail "GHCi.TH.Binary.putRuntimeRep: invalid tag" --- | @since 0.9.0.0. See #typeable-instances# +-- | @since 0.8.5.0. See #typeable-instances# instance Binary TyCon where put tc = do put (tyConPackage tc) @@ -901,7 +901,7 @@ instance Binary TyCon where put (tyConKindRep tc) get = mkTyCon <$> get <*> get <*> get <*> get <*> get --- | @since 0.9.0.0. See #typeable-instances# +-- | @since 0.8.5.0. See #typeable-instances# instance Binary KindRep where put (KindRepTyConApp tc k) = putWord8 0 >> put tc >> put k put (KindRepVar bndr) = putWord8 1 >> put bndr @@ -921,7 +921,7 @@ instance Binary KindRep where 5 -> KindRepTypeLit <$> get <*> get _ -> fail "GHCi.TH.Binary.putKindRep: invalid tag" --- | @since 0.9.0.0. See #typeable-instances# +-- | @since 0.8.5.0. See #typeable-instances# instance Binary TypeLitSort where put TypeLitSymbol = putWord8 0 put TypeLitNat = putWord8 1 From git at git.haskell.org Thu Apr 6 22:29:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 6 Apr 2017 22:29:30 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Revert "Make raiseIO# produce topRes" (d67f047) Message-ID: <20170406222930.707A03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/d67f0471cd3584c5a548ff30c9023b599b598d3e/ghc >--------------------------------------------------------------- commit d67f0471cd3584c5a548ff30c9023b599b598d3e Author: David Feuer Date: Mon Apr 3 22:25:55 2017 -0400 Revert "Make raiseIO# produce topRes" This reverts commit da4687f63ffe5a6162e3d7856aa53de048dd0f42. It's not entirely trivial to clean up the dead code this patch introduced. In particular, when we see ``` case raiseIO# m s of s' -> e ``` we want to know that `e` is dead. For scrutinees that are properly bottom (which we don't want to consider `raiseIO# m s` to be, this is handled by rewriting `bot` to `case bot of {}`. But if we do that for `raiseIO#`, we end up with ``` case raiseIO# m s of {} ``` which looks a lot like bottom and could confuse demand analysis. I think we need to wait with this change until we have a more complete story. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3413 (cherry picked from commit e83af07e3d0b65fe6f37806e86d07f3e8dc1b01e) >--------------------------------------------------------------- d67f0471cd3584c5a548ff30c9023b599b598d3e compiler/prelude/primops.txt.pp | 10 ++++++---- testsuite/tests/stranal/should_run/all.T | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp index 5d0a2a4..e9c844e 100644 --- a/compiler/prelude/primops.txt.pp +++ b/compiler/prelude/primops.txt.pp @@ -2005,9 +2005,11 @@ primop RaiseOp "raise#" GenPrimOp -- must be *precise* - we don't want the strictness analyser turning -- one kind of bottom into another, as it is allowed to do in pure code. -- --- We currently produce topRes, which is much too conservative (interfering --- with dead code elimination, unfortunately), but nothing else we currently --- have on tap is actually correct. +-- But we *do* want to know that it returns bottom after +-- being applied to two arguments, so that this function is strict in y +-- f x y | x>0 = raiseIO blah +-- | y>0 = return 1 +-- | otherwise = return 2 -- -- TODO Check that the above notes on @f@ are valid. The function successfully -- produces an IO exception when compiled without optimization. If we analyze @@ -2019,7 +2021,7 @@ primop RaiseOp "raise#" GenPrimOp primop RaiseIOOp "raiseIO#" GenPrimOp a -> State# RealWorld -> (# State# RealWorld, b #) with - strictness = { \ _arity -> mkClosedStrictSig [topDmd, topDmd] topRes } + strictness = { \ _arity -> mkClosedStrictSig [topDmd, topDmd] exnRes } out_of_line = True has_side_effects = True diff --git a/testsuite/tests/stranal/should_run/all.T b/testsuite/tests/stranal/should_run/all.T index a07900b..0764746 100644 --- a/testsuite/tests/stranal/should_run/all.T +++ b/testsuite/tests/stranal/should_run/all.T @@ -14,4 +14,4 @@ test('T11076', normal, multimod_compile_and_run, ['T11076.hs', 'T11076_prim.cmm' test('T11555a', normal, compile_and_run, ['']) test('T12368', exit_code(1), compile_and_run, ['']) test('T12368a', exit_code(1), compile_and_run, ['']) -test('T13380', exit_code(1), compile_and_run, ['']) +test('T13380', [expect_broken(13380), exit_code(1)], compile_and_run, ['']) From git at git.haskell.org Thu Apr 6 22:29:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 6 Apr 2017 22:29:33 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Bump binary submodule (82e22db) Message-ID: <20170406222933.2AC703A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/82e22db4bacfd243eabcfeea5e775f4c2498420d/ghc >--------------------------------------------------------------- commit 82e22db4bacfd243eabcfeea5e775f4c2498420d Author: Ben Gamari Date: Tue Apr 4 17:04:52 2017 -0400 Bump binary submodule >--------------------------------------------------------------- 82e22db4bacfd243eabcfeea5e775f4c2498420d libraries/binary | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/binary b/libraries/binary index 0147456..d4a030a 160000 --- a/libraries/binary +++ b/libraries/binary @@ -1 +1 @@ -Subproject commit 0147456b11c38d1121fd84a2b53effefde111240 +Subproject commit d4a030ab448191f664fc734bfbee61450a6fa5af From git at git.haskell.org Thu Apr 6 22:29:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 6 Apr 2017 22:29:36 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Add regression test for #7944 (72f1071) Message-ID: <20170406222936.6B5B43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/72f1071981cf5c969745070135cdd8b1657723eb/ghc >--------------------------------------------------------------- commit 72f1071981cf5c969745070135cdd8b1657723eb Author: Ryan Scott Date: Tue Apr 4 21:46:55 2017 -0400 Add regression test for #7944 Commit b8b3e30a6eedf9f213b8a718573c4827cfa230ba happened to fix the bug reported in #7944. Let's add a regression test so that it stays that way. Fixes #7944. Test Plan: make test TEST=T7944 Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3404 (cherry picked from commit af941a96f62101a6539f3cc35d82df3fd964539c) >--------------------------------------------------------------- 72f1071981cf5c969745070135cdd8b1657723eb testsuite/tests/simplCore/should_compile/T7944.hs | 19 +++++++++++++++++++ testsuite/tests/simplCore/should_compile/all.T | 1 + 2 files changed, 20 insertions(+) diff --git a/testsuite/tests/simplCore/should_compile/T7944.hs b/testsuite/tests/simplCore/should_compile/T7944.hs new file mode 100644 index 0000000..bb62427 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T7944.hs @@ -0,0 +1,19 @@ +module T7944 where + +import GHC.Exts + +-- Force specialisation of "go" +data SPEC = SPEC | SPEC2 +{-# ANN type SPEC ForceSpecConstr #-} + +-- This is more or less just an ordinary fold +go :: SPEC -> [a] -> IntMap a -> IntMap a +go SPEC [] m = m +go SPEC (_:xs) m + = go SPEC xs + -- This would be the "worker function" of the fold + $ Unary m + + +-- Both constructors are necessary, despite only one being used +data IntMap a = Nil | Unary (IntMap a) diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index 2d87e24..1bf1f36 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -158,6 +158,7 @@ test('T7702', compile, ['-v0 -package-db T7702plugin/pkg.T7702/local.package.conf -fplugin T7702Plugin -package T7702plugin ' + config.plugin_way_flags]) +test('T7944', normal, compile, ['-O2']) test('T7995', # RULE doesn't seem to fire unless optimizations are turned on. # This seems reasonable, so I've required it for the test. -- EZY 20130720 From git at git.haskell.org Thu Apr 6 22:29:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 6 Apr 2017 22:29:39 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: base: Mark unfold as deprecated (881793e) Message-ID: <20170406222939.26C283A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/881793ec8730a1c98da424bdac0d03dfe77e5c1f/ghc >--------------------------------------------------------------- commit 881793ec8730a1c98da424bdac0d03dfe77e5c1f Author: Ben Gamari Date: Tue Apr 4 21:48:49 2017 -0400 base: Mark unfold as deprecated Test Plan: Read it Reviewers: austin, hvr, RyanGlScott Reviewed By: RyanGlScott Subscribers: rwbarton, thomie, ekmett Differential Revision: https://phabricator.haskell.org/D3422 (cherry picked from commit ce9b6170b0ac9ff417000d8e7bdff7b2298f2978) >--------------------------------------------------------------- 881793ec8730a1c98da424bdac0d03dfe77e5c1f libraries/base/Data/List/NonEmpty.hs | 2 ++ libraries/base/changelog.md | 3 +++ 2 files changed, 5 insertions(+) diff --git a/libraries/base/Data/List/NonEmpty.hs b/libraries/base/Data/List/NonEmpty.hs index 2f9f868..9a9de01 100644 --- a/libraries/base/Data/List/NonEmpty.hs +++ b/libraries/base/Data/List/NonEmpty.hs @@ -180,6 +180,8 @@ unfold :: (a -> (b, Maybe a)) -> a -> NonEmpty b unfold f a = case f a of (b, Nothing) -> b :| [] (b, Just c) -> b <| unfold f c +{-# DEPRECATED unfold "Use unfoldr" #-} +-- Deprecated in 8.2.1, remove in 8.4 -- | 'nonEmpty' efficiently turns a normal list into a 'NonEmpty' stream, -- producing 'Nothing' if the input is empty. diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index f2ea265..97fdefd 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -84,6 +84,9 @@ * `mkTyCon3` is no longer exported by `Data.Typeable`. This function is replaced by `Type.Reflection.Unsafe.mkTyCon`. + * `Data.List.NonEmpty.unfold` has been deprecated in favor of `unfoldr`, + which is functionally equivalent. + ## 4.9.0.0 *May 2016* * Bundled with GHC 8.0 From git at git.haskell.org Thu Apr 6 22:29:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 6 Apr 2017 22:29:42 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Be less aggressive about fragile-context warrnings (da17a35) Message-ID: <20170406222942.6E2C33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/da17a35a80a2075a76163375175f15b3119b9711/ghc >--------------------------------------------------------------- commit da17a35a80a2075a76163375175f15b3119b9711 Author: Simon Peyton Jones Date: Thu Apr 6 12:27:43 2017 +0100 Be less aggressive about fragile-context warrnings In the implementation of WarnSimplifiableClassConstraints, be less aggressive about reporting a problem. We were complaining about a "fragile" case that in fact was not fragile. See Note [Simplifiable given constraints] in TcValidity. This fixes Trac #13526. (cherry picked from commit 65b185d4886b4efa3efe3cc5ecc8dd6e07d89afe) >--------------------------------------------------------------- da17a35a80a2075a76163375175f15b3119b9711 compiler/typecheck/TcValidity.hs | 50 ++++++++++++++-------- .../should_compile/SomethingShowable.stderr | 10 +++-- testsuite/tests/typecheck/should_compile/T13526.hs | 22 ++++++++++ .../tests/typecheck/should_compile/T13526.stderr | 7 +++ testsuite/tests/typecheck/should_compile/all.T | 1 + 5 files changed, 69 insertions(+), 21 deletions(-) diff --git a/compiler/typecheck/TcValidity.hs b/compiler/typecheck/TcValidity.hs index dda8b4f..48fd84d 100644 --- a/compiler/typecheck/TcValidity.hs +++ b/compiler/typecheck/TcValidity.hs @@ -41,7 +41,7 @@ import HsSyn -- HsType import TcRnMonad -- TcType, amongst others import TcEnv ( tcGetInstEnvs ) import FunDeps -import InstEnv ( ClsInst, lookupInstEnv, isOverlappable ) +import InstEnv ( InstMatch, lookupInstEnv ) import FamInstEnv ( isDominatedBy, injectiveBranches, InjectivityCheckResult(..) ) import FamInst ( makeInjectivityErrors ) @@ -810,7 +810,8 @@ check_class_pred env dflags ctxt pred cls tys | otherwise = do { check_arity - ; check_simplifiable_class_constraint + ; warn_simp <- woptM Opt_WarnSimplifiableClassConstraints + ; when warn_simp check_simplifiable_class_constraint ; checkTcM arg_tys_ok (predTyVarErr env pred) } where check_arity = checkTc (classArity cls == length tys) @@ -833,25 +834,22 @@ check_class_pred env dflags ctxt pred cls tys | DataTyCtxt {} <- ctxt -- Don't do this check for the "stupid theta" = return () -- of a data type declaration | otherwise - = do { instEnvs <- tcGetInstEnvs - ; let (matches, _, _) = lookupInstEnv False instEnvs cls tys - bad_matches = [ inst | (inst,_) <- matches - , not (isOverlappable inst) ] - ; warnIf (Reason Opt_WarnSimplifiableClassConstraints) - (not (null bad_matches)) - (simplifiable_constraint_warn bad_matches) } - - simplifiable_constraint_warn :: [ClsInst] -> SDoc - simplifiable_constraint_warn (match : _) + = do { envs <- tcGetInstEnvs + ; case lookupInstEnv False envs cls tys of + ([m], [], _) -> addWarnTc (Reason Opt_WarnSimplifiableClassConstraints) + (simplifiable_constraint_warn m) + _ -> return () } + + simplifiable_constraint_warn :: InstMatch -> SDoc + simplifiable_constraint_warn (match, _) = vcat [ hang (text "The constraint" <+> quotes (ppr (tidyType env pred))) 2 (text "matches an instance declaration") , ppr match , hang (text "This makes type inference for inner bindings fragile;") 2 (text "either use MonoLocalBinds, or simplify it using the instance") ] - simplifiable_constraint_warn [] = pprPanic "check_class_pred" (ppr pred) {- Note [Simplifiable given constraints] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ A type signature like f :: Eq [(a,b)] => a -> b is very fragile, for reasons described at length in TcInteract @@ -862,9 +860,27 @@ fragility. But if we /infer/ the type of a local let-binding, things can go wrong (Trac #11948 is an example, discussed in the Note). So this warning is switched on only if we have NoMonoLocalBinds; in -that case the warning discourages uses from writing simplifiable class -constraints, at least unless the top-level instance is explicitly -declared as OVERLAPPABLE. +that case the warning discourages users from writing simplifiable +class constraints. + +The warning only fires if the constraint in the signature +matches the top-level instances in only one way, and with no +unifiers -- that is, under the same circumstances that +TcInteract.matchInstEnv fires an interaction with the top +level instances. For example (Trac #13526), consider + + instance {-# OVERLAPPABLE #-} Eq (T a) where ... + instance Eq (T Char) where .. + f :: Eq (T a) => ... + +We don't want to complain about this, even though the context +(Eq (T a)) matches an instance, because the user may be +deliberately deferring the choice so that the Eq (T Char) +has a chance to fire when 'f' is called. And the fragility +only matters when there's a risk that the instance might +fire instead of the local 'given'; and there is no such +risk in this case. Just use the same rules as for instance +firing! -} ------------------------- diff --git a/testsuite/tests/partial-sigs/should_compile/SomethingShowable.stderr b/testsuite/tests/partial-sigs/should_compile/SomethingShowable.stderr index 9f0ea1f..ca06301 100644 --- a/testsuite/tests/partial-sigs/should_compile/SomethingShowable.stderr +++ b/testsuite/tests/partial-sigs/should_compile/SomethingShowable.stderr @@ -7,7 +7,9 @@ Dependent packages: [base-4.10.0.0, ghc-prim-0.5.0.0, integer-gmp-1.0.0.1] SomethingShowable.hs:5:1: warning: [-Wsimplifiable-class-constraints (in -Wdefault)] - The constraint ‘Show Bool’ matches an instance declaration - instance Show Bool -- Defined in ‘GHC.Show’ - This makes type inference for inner bindings fragile; - either use MonoLocalBinds, or simplify it using the instance + • The constraint ‘Show Bool’ matches an instance declaration + instance Show Bool -- Defined in ‘GHC.Show’ + This makes type inference for inner bindings fragile; + either use MonoLocalBinds, or simplify it using the instance + • When checking the inferred type + somethingShowable :: Show Bool => Bool -> String diff --git a/testsuite/tests/typecheck/should_compile/T13526.hs b/testsuite/tests/typecheck/should_compile/T13526.hs new file mode 100644 index 0000000..efe32bd --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T13526.hs @@ -0,0 +1,22 @@ +{-# LANGUAGE FlexibleContexts, MultiParamTypeClasses, FlexibleInstances #-} + +module T13526 where + +class C a where + op :: a -> a + +instance {-# OVERLAPPING #-} C [Char] where + op x = x + +instance C a => C [a] where + op (x:xs) = [op x] + +instance C a => C (Maybe a) where + op x = error "urk" + +-- We should get no complaint +foo :: C [a] => a -> [a] +foo x = op [x] + +bar :: C (Maybe a) => a -> Maybe a +bar x = op (Just x) diff --git a/testsuite/tests/typecheck/should_compile/T13526.stderr b/testsuite/tests/typecheck/should_compile/T13526.stderr new file mode 100644 index 0000000..7a0f2ae --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T13526.stderr @@ -0,0 +1,7 @@ + +T13526.hs:21:8: warning: [-Wsimplifiable-class-constraints (in -Wdefault)] + • The constraint ‘C (Maybe a)’ matches an instance declaration + instance C a => C (Maybe a) -- Defined at T13526.hs:14:10 + This makes type inference for inner bindings fragile; + either use MonoLocalBinds, or simplify it using the instance + • In the type signature: bar :: C (Maybe a) => a -> Maybe a diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index 6ceb87d..9d9c7de 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -547,3 +547,4 @@ test('T13381', normal, compile_fail, ['']) test('T13337', normal, compile, ['']) test('T13343', normal, compile, ['']) test('T13474', normal, compile, ['']) +test('T13526', normal, compile, ['']) From git at git.haskell.org Thu Apr 6 22:29:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 6 Apr 2017 22:29:45 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: More changes to fix a space leak in the simplifier (#13426) (f636599) Message-ID: <20170406222945.3ADB13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/f636599165a72a29830341049023651c6fbf38c9/ghc >--------------------------------------------------------------- commit f636599165a72a29830341049023651c6fbf38c9 Author: Reid Barton Date: Thu Apr 6 17:44:08 2017 -0400 More changes to fix a space leak in the simplifier (#13426) Part of e13419c55 was accidentally lost during a rebase. This commit adds the missing change, along with some more improvements regarding where we do and don't use `seqType`. Also include a comment about where the space leak showed up and a Note explaining the strategy being used here. Test Plan: harbormaster, plus local testing on DynFlags Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3421 (cherry picked from commit 59c925e88a1dcb98e62c2b5e0adaa299c3b15e44) >--------------------------------------------------------------- f636599165a72a29830341049023651c6fbf38c9 compiler/simplCore/Simplify.hs | 85 +++++++++++++++++++++++++++++++++++------- 1 file changed, 72 insertions(+), 13 deletions(-) diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index d04eff2..f5301cf 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -967,7 +967,7 @@ might do the same again. simplExpr :: SimplEnv -> CoreExpr -> SimplM CoreExpr simplExpr env (Type ty) - = do { ty' <- simplType env ty + = do { ty' <- simplType env ty -- See Note [Avoiding space leaks in OutType] ; return (Type ty') } simplExpr env expr @@ -1024,14 +1024,24 @@ simplExprF1 env (Tick t expr) cont = simplTick env t expr cont simplExprF1 env (Cast body co) cont = simplCast env body co cont simplExprF1 env (Coercion co) cont = simplCoercionF env co cont - simplExprF1 env (App fun arg) cont - = simplExprF env fun $ - case arg of - Type ty -> ApplyToTy { sc_arg_ty = substTy env ty - , sc_hole_ty = substTy env (exprType fun) - , sc_cont = cont } - _ -> ApplyToVal { sc_arg = arg, sc_env = env + = case arg of + Type ty -> do { -- The argument type will (almost) certainly be used + -- in the output program, so just force it now. + -- See Note [Avoiding space leaks in OutType] + arg' <- simplType env ty + + -- But use substTy, not simplType, to avoid forcing + -- the hole type; it will likely not be needed. + -- See Note [The hole type in ApplyToTy] + ; let hole' = substTy env (exprType fun) + + ; simplExprF env fun $ + ApplyToTy { sc_arg_ty = arg' + , sc_hole_ty = hole' + , sc_cont = cont } } + _ -> simplExprF env fun $ + ApplyToVal { sc_arg = arg, sc_env = env , sc_dup = NoDup, sc_cont = cont } simplExprF1 env expr@(Lam {}) cont @@ -1073,6 +1083,50 @@ simplExprF1 env (Let (NonRec bndr rhs) body) cont | otherwise = simplNonRecE env bndr (rhs, env) ([], body) cont +{- Note [Avoiding space leaks in OutType] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Since the simplifier is run for multiple iterations, we need to ensure +that any thunks in the output of one simplifier iteration are forced +by the evaluation of the next simplifier iteration. Otherwise we may +retain multiple copies of the Core program and leak a terrible amount +of memory (as in #13426). + +The simplifier is naturally strict in the entire "Expr part" of the +input Core program, because any expression may contain binders, which +we must find in order to extend the SimplEnv accordingly. But types +do not contain binders and so it is tempting to write things like + + simplExpr env (Type ty) = return (Type (substTy env ty)) -- Bad! + +This is Bad because the result includes a thunk (substTy env ty) which +retains a reference to the whole simplifier environment; and the next +simplifier iteration will not force this thunk either, because the +line above is not strict in ty. + +So instead our strategy is for the simplifier to fully evaluate +OutTypes when it emits them into the output Core program, for example + + simplExpr env (Type ty) = do { ty' <- simplType env ty -- Good + ; return (Type ty') } + +where the only difference from above is that simplType calls seqType +on the result of substTy. + +However, SimplCont can also contain OutTypes and it's not necessarily +a good idea to force types on the way in to SimplCont, because they +may end up not being used and forcing them could be a lot of wasted +work. T5631 is a good example of this. + +- For ApplyToTy's sc_arg_ty, we force the type on the way in because + the type will almost certainly appear as a type argument in the + output program. + +- For the hole types in Stop and ApplyToTy, we force the type when we + emit it into the output program, after obtaining it from + contResultType. (The hole type in ApplyToTy is only directly used + to form the result type in a new Stop continuation.) +-} + --------------------------------- -- Simplify a join point, adding the context. -- Context goes *inside* the lambdas. IOW, if the join point has arity n, we do: @@ -1094,6 +1148,7 @@ simplJoinRhs env bndr expr cont --------------------------------- simplType :: SimplEnv -> InType -> SimplM OutType -- Kept monadic just so we can do the seqType + -- See Note [Avoiding space leaks in OutType] simplType env ty = -- pprTrace "simplType" (ppr ty $$ ppr (seTvSubst env)) $ seqType new_ty `seq` return new_ty @@ -1652,8 +1707,11 @@ rebuildCall env (ArgInfo { ai_fun = fun, ai_args = rev_args, ai_strs = [] }) con -- the continuation, leaving just the bottoming expression. But the -- type might not be right, so we may have to add a coerce. | not (contIsTrivial cont) -- Only do this if there is a non-trivial - = return (env, castBottomExpr res cont_ty) -- continuation to discard, else we do it - where -- again and again! + -- continuation to discard, else we do it + -- again and again! + = seqType cont_ty `seq` -- See Note [Avoiding space leaks in OutType] + return (env, castBottomExpr res cont_ty) + where res = argInfoExpr fun rev_args cont_ty = contResultType cont @@ -2238,8 +2296,7 @@ reallyRebuildCase env scrut case_bndr alts cont ; dflags <- getDynFlags ; let alts_ty' = contResultType dup_cont - -- The seqType below is needed to avoid a space leak (#13426) - -- but I don't know why. + -- See Note [Avoiding space leaks in OutType] ; case_expr <- seqType alts_ty' `seq` mkCase dflags scrut' case_bndr' alts_ty' alts' @@ -2624,7 +2681,9 @@ missingAlt :: SimplEnv -> Id -> [InAlt] -> SimplCont -> SimplM (SimplEnv, OutExp -- inaccessible. So we simply put an error case here instead. missingAlt env case_bndr _ cont = WARN( True, text "missingAlt" <+> ppr case_bndr ) - return (env, mkImpossibleExpr (contResultType cont)) + -- See Note [Avoiding space leaks in OutType] + let cont_ty = contResultType cont + in seqType cont_ty `seq` return (env, mkImpossibleExpr cont_ty) {- ************************************************************************ From git at git.haskell.org Thu Apr 6 22:29:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 6 Apr 2017 22:29:48 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Add regression test for #13538 (4f9e73f) Message-ID: <20170406222948.4BCC63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/4f9e73f1529224d42c1d90c7bf8efad3c9e44cd8/ghc >--------------------------------------------------------------- commit 4f9e73f1529224d42c1d90c7bf8efad3c9e44cd8 Author: Ryan Scott Date: Thu Apr 6 16:42:39 2017 -0400 Add regression test for #13538 Commit 2b64e926a628fb2a3710b0360123ea73331166fe (#13135) ended up fixing #13538 as well. Let's add a regression test so that it stays fixed. Test Plan: make test TEST=T13538 Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #13538 Differential Revision: https://phabricator.haskell.org/D3426 (cherry picked from commit e61900c994334c209a9de763993716314abf9f6d) >--------------------------------------------------------------- 4f9e73f1529224d42c1d90c7bf8efad3c9e44cd8 testsuite/tests/dependent/should_compile/T13538.hs | 45 ++++++++++++++++++++++ testsuite/tests/dependent/should_compile/all.T | 1 + 2 files changed, 46 insertions(+) diff --git a/testsuite/tests/dependent/should_compile/T13538.hs b/testsuite/tests/dependent/should_compile/T13538.hs new file mode 100644 index 0000000..f9d904f --- /dev/null +++ b/testsuite/tests/dependent/should_compile/T13538.hs @@ -0,0 +1,45 @@ +{-# LANGUAGE UndecidableInstances #-} +{-# LANGUAGE TypeFamilies, TypeFamilyDependencies #-} +{-# LANGUAGE KindSignatures, DataKinds, PolyKinds #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE TypeApplications #-} +module T13538 where + +import GHC.TypeLits +import Data.Proxy + +-- | Synonym for a type-level snoc (injective!) +type (ns :: [k]) +: (n :: k) = GetList1 (SinkFirst (n ': ns)) +infixl 5 +: + + + +-- | A weird data type used to make `(+:)` operation injective. +-- `List k [k]` must have at least two elements. +data List1 k = L1Single k | L1Head k [k] + +-- | Sink first element of a list to the end of the list +type family SinkFirst (xs :: [k]) = (ys :: List1 k) | ys -> xs where + SinkFirst '[y] = 'L1Single y + -- SinkFirst (y ': x ': xs :: [Nat]) + -- = ('L1Head x (GetList1Nat (SinkFirst (y ': xs))) :: List1 Nat) + SinkFirst (y ': x ': xs :: [k]) + = ('L1Head x (GetList1 (SinkFirst (y ': xs))) :: List1 k) + +type family GetList1 (ts :: List1 k) = (rs :: [k]) | rs -> ts where + GetList1 ('L1Single x) = '[x] + GetList1 ('L1Head y (x ':xs)) = y ': x ': xs +type family GetList1Nat (ts :: List1 Nat) = (rs :: [Nat]) | rs -> ts where + GetList1Nat ('L1Single x) = '[x] + GetList1Nat ('L1Head y (x ': xs)) = y ': x ': xs + +type family (++) (as :: [k]) (bs :: [k]) :: [k] where + '[] ++ bs = bs + (a ': as) ++ bs = a ': (as ++ bs) + + +ff :: Proxy k -> Proxy (as +: k) -> Proxy (k ': bs) -> Proxy (as ++ bs) +ff _ _ _ = Proxy + +yy :: Proxy '[3,7,2] +yy = ff (Proxy @5) (Proxy @'[3,7,5]) (Proxy @'[5,2]) diff --git a/testsuite/tests/dependent/should_compile/all.T b/testsuite/tests/dependent/should_compile/all.T index 6d39e45..a921743 100644 --- a/testsuite/tests/dependent/should_compile/all.T +++ b/testsuite/tests/dependent/should_compile/all.T @@ -22,3 +22,4 @@ test('RaeJobTalk', normal, compile, ['']) test('T11635', normal, compile, ['']) test('T11719', normal, compile, ['']) test('T12442', normal, compile, ['']) +test('T13538', normal, compile, ['']) From git at git.haskell.org Fri Apr 7 01:14:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 7 Apr 2017 01:14:00 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: mk/boilerplate.mk defines STAGE1_GHC, not GHC_STAGE1. (7cd919f) Message-ID: <20170407011400.968193A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/7cd919f4af0ad05f89391616d940268fb71cb65e/ghc >--------------------------------------------------------------- commit 7cd919f4af0ad05f89391616d940268fb71cb65e Author: Edward Z. Yang Date: Sun Mar 26 14:40:29 2017 -0700 mk/boilerplate.mk defines STAGE1_GHC, not GHC_STAGE1. Signed-off-by: Edward Z. Yang (cherry picked from commit 5db415580e0738f934e35b7012fe35a79b7e97c7) >--------------------------------------------------------------- 7cd919f4af0ad05f89391616d940268fb71cb65e testsuite/timeout/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/timeout/Makefile b/testsuite/timeout/Makefile index b910a73..9626eae 100644 --- a/testsuite/timeout/Makefile +++ b/testsuite/timeout/Makefile @@ -51,7 +51,7 @@ boot all :: calibrate.out $(TIMEOUT_PROGRAM) calibrate.out: $(RM) -f TimeMe.o TimeMe.hi TimeMe TimeMe.exe - $(PYTHON) calibrate '$(GHC_STAGE1)' > $@ + $(PYTHON) calibrate '$(STAGE1_GHC)' > $@ # We use stage 1 to do the calibration, as stage 2 may not exist. # This isn't necessarily the compiler we'll be running the testsuite # with, but it's really the performance of the machine that we're From git at git.haskell.org Fri Apr 7 15:23:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 7 Apr 2017 15:23:58 +0000 (UTC) Subject: [commit: ghc] master: Do Note [Improving seq] always (f0d98fc) Message-ID: <20170407152358.6A1053A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f0d98fc6cdde26bf43a04d9f01b6ad2f4c88f0b9/ghc >--------------------------------------------------------------- commit f0d98fc6cdde26bf43a04d9f01b6ad2f4c88f0b9 Author: Simon Peyton Jones Date: Fri Apr 7 16:19:56 2017 +0100 Do Note [Improving seq] always This patch fixes Trac #13468, and at the same time makes the code simpler and more uniform. In particular, I've eliminated the awkward conflict between the old built-in rule for seq (which elimianted a cast), and the desire to make case scrutinse a data type by doing type-family reduction (which adds a cast). Nice. >--------------------------------------------------------------- f0d98fc6cdde26bf43a04d9f01b6ad2f4c88f0b9 compiler/basicTypes/MkId.hs | 40 +----- compiler/simplCore/Simplify.hs | 138 ++++++++++++--------- testsuite/tests/simplCore/should_compile/Makefile | 6 + testsuite/tests/simplCore/should_compile/T13468.hs | 12 ++ testsuite/tests/simplCore/should_compile/all.T | 4 + 5 files changed, 104 insertions(+), 96 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc f0d98fc6cdde26bf43a04d9f01b6ad2f4c88f0b9 From git at git.haskell.org Sat Apr 8 09:59:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 8 Apr 2017 09:59:14 +0000 (UTC) Subject: [commit: ghc] master: fix 'make install' for cross-stage2 (54895c9) Message-ID: <20170408095914.BA3023A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/54895c90440cb81f18657537b91f2aa35bd54173/ghc >--------------------------------------------------------------- commit 54895c90440cb81f18657537b91f2aa35bd54173 Author: Sergei Trofimovich Date: Fri Apr 7 10:08:58 2017 +0100 fix 'make install' for cross-stage2 When cross-built GHC is being installed one of latest steps is to register installed libraries with 'ghc-pkg'. GHC uses freshly installed 'ghc-pkg' and 'ghc-stage2' for that. Tested as: ./configure --target=aarch64-unknown-linux-gnu make install DESTDIR=$(pwd)/__s2 STRIP_CMD=: Before the change install failed on ghc-pkg execution phase: ".../ghc-cross/__s2/usr/local/lib/ghc-8.3.20170406/bin/ghc-pkg" \ --force \ --global-package-db \ ".../ghc-cross/__s2/usr/local/lib/ghc-8.3.20170406/package.conf.d" \ update rts/dist/package.conf.install /bin/sh: .../ghc-cross/__s2/usr/local/lib/ghc-8.3.20170406/bin/ghc-pkg: \ No such file or directory To avoid breakage we use 'ghc' and 'ghc-pkg' built by stage0. Signed-off-by: Sergei Trofimovich Test Plan: run 'make install' on stage2 crosscompiler Reviewers: rwbarton, austin, bgamari Subscribers: thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3432 >--------------------------------------------------------------- 54895c90440cb81f18657537b91f2aa35bd54173 ghc.mk | 7 +++++++ utils/ghc-pkg/ghc.mk | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/ghc.mk b/ghc.mk index caa6c38..8971f25 100644 --- a/ghc.mk +++ b/ghc.mk @@ -962,6 +962,12 @@ endif INSTALLED_PACKAGE_CONF=$(DESTDIR)$(topdir)/package.conf.d +ifeq "$(CrossCompiling)" "YES" +# when installing ghc-stage2 we can't run target's +# 'ghc-pkg' and 'ghc-stage2' but those are needed for registration. +INSTALLED_GHC_REAL=$(TOP)/inplace/bin/ghc-stage1 +INSTALLED_GHC_PKG_REAL=$(TOP)/$(ghc-pkg_DIST_BINARY) +else # CrossCompiling # Install packages in the right order, so that ghc-pkg doesn't complain. # Also, install ghc-pkg first. ifeq "$(Windows_Host)" "NO" @@ -971,6 +977,7 @@ else INSTALLED_GHC_REAL=$(DESTDIR)$(bindir)/ghc.exe INSTALLED_GHC_PKG_REAL=$(DESTDIR)$(bindir)/ghc-pkg.exe endif +endif # CrossCompiling # Set the INSTALL_DISTDIR_p for each package; compiler is special $(foreach p,$(filter-out compiler,$(INSTALL_PACKAGES)),\ diff --git a/utils/ghc-pkg/ghc.mk b/utils/ghc-pkg/ghc.mk index 002c812..4d5ef4e 100644 --- a/utils/ghc-pkg/ghc.mk +++ b/utils/ghc-pkg/ghc.mk @@ -49,6 +49,12 @@ utils/ghc-pkg_dist_PROGNAME = ghc-pkg utils/ghc-pkg_dist_SHELL_WRAPPER = YES utils/ghc-pkg_dist_INSTALL_INPLACE = YES +# When cross-built ghc-stage2 is installed 'make install' needs to call +# native ghc-pkg (not the cross-built one) to register installed packages +# 'ghc-pkg_DIST_BINARY' variable only refer to native binary. +ghc-pkg_DIST_BINARY_NAME = ghc-pkg$(exeext0) +ghc-pkg_DIST_BINARY = utils/ghc-pkg/dist/build/tmp/$(ghc-pkg_DIST_BINARY_NAME) + # See Note [Stage1Only vs stage=1] in mk/config.mk.in. ifeq "$(Stage1Only)" "YES" # Install the copy of ghc-pkg from the dist directory when running 'make From git at git.haskell.org Sat Apr 8 09:59:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 8 Apr 2017 09:59:17 +0000 (UTC) Subject: [commit: ghc] master: cross-build 'unlit' and 'hp2ps' for stage2 install (ff84d05) Message-ID: <20170408095917.70CD13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ff84d052850b637b03bbb98cf05202e44886257d/ghc >--------------------------------------------------------------- commit ff84d052850b637b03bbb98cf05202e44886257d Author: Sergei Trofimovich Date: Sat Apr 8 10:02:34 2017 +0100 cross-build 'unlit' and 'hp2ps' for stage2 install In navive build case it does not matter much if we build 'unlit' and 'hp2ps' tools with ghc-stage0 or ghc-stage1: both GHCs are native compilers and both tools are written in C (have no haskell code). But in cross-case the difference is substantial: In Stag1Only=YES case we need to install native tools built by ghc-stage0/${host}-cc. In Stag1Only=NO case we need to install cross-built tools built by ghc-stage1/${target}-cc. Before this change GHC did not have a rule to build cross-built 'unlit' and 'hp2ps'. The change adds cross-built 'unlit' and 'hp2ps' as 'dist-install' targets. 'inplace/lib/bin/unlit.bin' target is unchanged and still contains native binary. As a result this change allows cross-building and packaging whole GHC for target platform! Signed-off-by: Sergei Trofimovich >--------------------------------------------------------------- ff84d052850b637b03bbb98cf05202e44886257d utils/hp2ps/ghc.mk | 19 ++++++++++++++++++- utils/unlit/ghc.mk | 18 ++++++++++++++++-- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/utils/hp2ps/ghc.mk b/utils/hp2ps/ghc.mk index f6e01ec..21ce87d 100644 --- a/utils/hp2ps/ghc.mk +++ b/utils/hp2ps/ghc.mk @@ -10,6 +10,7 @@ # # ----------------------------------------------------------------------------- +# stage0 utils/hp2ps_dist_C_SRCS = AreaBelow.c Curves.c Error.c Main.c \ Reorder.c TopTwenty.c AuxFile.c Deviation.c \ HpFile.c Marks.c Scale.c TraceElement.c \ @@ -17,11 +18,27 @@ utils/hp2ps_dist_C_SRCS = AreaBelow.c Curves.c Error.c Main.c \ Utilities.c utils/hp2ps_dist_EXTRA_LIBRARIES = m utils/hp2ps_dist_PROGNAME = hp2ps -utils/hp2ps_dist_INSTALL = YES utils/hp2ps_dist_INSTALL_INPLACE = YES utils/hp2ps_dist_SHELL_WRAPPER = YES utils/hp2ps_dist_INSTALL_SHELL_WRAPPER_NAME = hp2ps utils/hp2ps_CC_OPTS += $(addprefix -I,$(GHC_INCLUDE_DIRS)) +# stage 1 +utils/hp2ps_dist-install_C_SRCS = $(utils/hp2ps_dist_C_SRCS) +utils/hp2ps_dist-install_EXTRA_LIBRARIES = $(utils/hp2ps_dist_EXTRA_LIBRARIES) +utils/hp2ps_dist-install_PROGNAME = $(utils/hp2ps_dist_PROGNAME) +utils/hp2ps_dist-install_INSTALL_INPLACE = NO +utils/hp2ps_dist-install_SHELL_WRAPPER = YES +utils/hp2ps_dist-install_INSTALL_SHELL_WRAPPER_NAME = $(utils/hp2ps_dist_INSTALL_SHELL_WRAPPER_NAME) + +ifeq "$(Stage1Only)" "YES" +utils/hp2ps_dist_INSTALL = YES +utils/hp2ps_dist-install_INSTALL = NO +else +utils/hp2ps_dist_INSTALL = NO +utils/hp2ps_dist-install_INSTALL = YES +endif + $(eval $(call build-prog,utils/hp2ps,dist,0)) +$(eval $(call build-prog,utils/hp2ps,dist-install,1)) diff --git a/utils/unlit/ghc.mk b/utils/unlit/ghc.mk index e947989..8911f4e 100644 --- a/utils/unlit/ghc.mk +++ b/utils/unlit/ghc.mk @@ -10,11 +10,25 @@ # # ----------------------------------------------------------------------------- +# built by ghc-stage0 utils/unlit_dist_C_SRCS = unlit.c utils/unlit_dist_PROGNAME = unlit utils/unlit_dist_TOPDIR = YES -utils/unlit_dist_INSTALL = YES utils/unlit_dist_INSTALL_INPLACE = YES -$(eval $(call build-prog,utils/unlit,dist,0)) +# built by ghc-stage1 +utils/unlit_dist-install_C_SRCS = $(utils/unlit_dist_C_SRCS) +utils/unlit_dist-install_PROGNAME = $(utils/unlit_dist_PROGNAME) +utils/unlit_dist-install_TOPDIR = $(utils/unlit_dist_TOPDIR) +utils/unlit_dist-install_INSTALL_INPLACE = NO + +ifeq "$(Stage1Only)" "YES" +utils/unlit_dist_INSTALL = YES +utils/unlit_dist-install_INSTALL = NO +else +utils/unlit_dist_INSTALL = NO +utils/unlit_dist-install_INSTALL = YES +endif +$(eval $(call build-prog,utils/unlit,dist,0)) +$(eval $(call build-prog,utils/unlit,dist-install,1)) From git at git.haskell.org Sun Apr 9 19:16:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 9 Apr 2017 19:16:16 +0000 (UTC) Subject: [commit: ghc] master: Parenthesize type/data families correctly for -ddump-splices (5282bb1) Message-ID: <20170409191616.6868B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5282bb1772ba3f1dc999a177965e543822f342a0/ghc >--------------------------------------------------------------- commit 5282bb1772ba3f1dc999a177965e543822f342a0 Author: Alan Zimmerman Date: Sun Apr 9 21:06:06 2017 +0200 Parenthesize type/data families correctly for -ddump-splices Fix a regression in the pretty-printed code for -ddump-splices, which regressed since 8.0. Closes trac issue #13550 >--------------------------------------------------------------- 5282bb1772ba3f1dc999a177965e543822f342a0 compiler/hsSyn/Convert.hs | 9 +++-- testsuite/tests/printer/Makefile | 4 ++ testsuite/tests/printer/T13550.hs | 69 +++++++++++++++++++++++++++++++++++ testsuite/tests/printer/T13550.stdout | 22 +++++++++++ testsuite/tests/printer/all.T | 1 + 5 files changed, 101 insertions(+), 4 deletions(-) diff --git a/compiler/hsSyn/Convert.hs b/compiler/hsSyn/Convert.hs index 921448e..8d90344 100644 --- a/compiler/hsSyn/Convert.hs +++ b/compiler/hsSyn/Convert.hs @@ -37,7 +37,7 @@ import Outputable import MonadUtils ( foldrM ) import qualified Data.ByteString as BS -import Control.Monad( unless, liftM, ap ) +import Control.Monad( unless, liftM, ap, (<=<) ) import Data.Maybe( catMaybes, fromMaybe, isNothing ) import Language.Haskell.TH as TH hiding (sigP) @@ -386,7 +386,7 @@ cvtDec (TH.PatSynSigD nm ty) ---------------- cvtTySynEqn :: Located RdrName -> TySynEqn -> CvtM (LTyFamInstEqn RdrName) cvtTySynEqn tc (TySynEqn lhs rhs) - = do { lhs' <- mapM cvtType lhs + = do { lhs' <- mapM (wrap_apps <=< cvtType) lhs ; rhs' <- cvtType rhs ; returnL $ TyFamEqn { tfe_tycon = tc , tfe_pats = mkHsImplicitBndrs lhs' @@ -433,7 +433,7 @@ cvt_tyinst_hdr :: TH.Cxt -> TH.Name -> [TH.Type] cvt_tyinst_hdr cxt tc tys = do { cxt' <- cvtContext cxt ; tc' <- tconNameL tc - ; tys' <- mapM cvtType tys + ; tys' <- mapM (wrap_apps <=< cvtType) tys ; return (cxt', tc', mkHsImplicitBndrs tys') } ---------------- @@ -552,7 +552,8 @@ cvtSrcStrictness SourceStrict = SrcStrict cvt_arg :: (TH.Bang, TH.Type) -> CvtM (LHsType RdrName) cvt_arg (Bang su ss, ty) - = do { ty' <- cvtType ty + = do { ty'' <- cvtType ty + ; ty' <- wrap_apps ty'' ; let su' = cvtSrcUnpackedness su ; let ss' = cvtSrcStrictness ss ; returnL $ HsBangTy (HsSrcBang NoSourceText su' ss') ty' } diff --git a/testsuite/tests/printer/Makefile b/testsuite/tests/printer/Makefile index 9f0eb23..9cb968f 100644 --- a/testsuite/tests/printer/Makefile +++ b/testsuite/tests/printer/Makefile @@ -205,3 +205,7 @@ T13199: .PHONY: T13050p T13050p: $(CHECK_PPR) "`'$(TEST_HC)' $(TEST_HC_OPTS) --print-libdir | tr -d '\r'`" T13050p.hs + +.PHONY: T13550 +T13550: + $(CHECK_PPR) "`'$(TEST_HC)' $(TEST_HC_OPTS) --print-libdir | tr -d '\r'`" T13550.hs diff --git a/testsuite/tests/printer/T13550.hs b/testsuite/tests/printer/T13550.hs new file mode 100644 index 0000000..90a70aa --- /dev/null +++ b/testsuite/tests/printer/T13550.hs @@ -0,0 +1,69 @@ +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE TypeFamilies #-} +{-# OPTIONS_GHC -ddump-splices -dsuppress-uniques #-} +module Bug where + +$([d| type family Foo a b + type instance Foo (Maybe a) b = Either (Maybe a) (Maybe b) + + data family Bar a b + data instance Bar (Maybe a) b = BarMaybe (Maybe a) (Maybe b) + |]) + +{- + type instance Foo (Maybe a) b = Either (Maybe a) (Maybe b) + +becomes + +[TySynInstD Bug.Foo + (TySynEqn + [AppT + (ConT GHC.Base.Maybe) + (VarT a_6989586621679027317) + ,VarT b_6989586621679027318] + (AppT + (AppT + (ConT Data.Either.Either) + (AppT + (ConT GHC.Base.Maybe) + (VarT a_6989586621679027317) + ) + ) + (AppT (ConT GHC.Base.Maybe) (VarT b_6989586621679027318)) + ) + ) +] + + data instance Bar (Maybe a) b = BarMaybe (Maybe a) (Maybe b) + +becomes + +[DataInstD [] Bug.Bar + [AppT + (ConT GHC.Base.Maybe) + (VarT a_6989586621679027707) + ,VarT b_6989586621679027708 + ] + Nothing + [NormalC + BarMaybe_6989586621679027706 + [(Bang + NoSourceUnpackedness + NoSourceStrictness + ,AppT + (ConT GHC.Base.Maybe) + (VarT a_6989586621679027707) + ) + ,(Bang + NoSourceUnpackedness + NoSourceStrictness + ,AppT + (ConT GHC.Base.Maybe) + (VarT b_6989586621679027708) + ) + ] + ] + []] + + +-} diff --git a/testsuite/tests/printer/T13550.stdout b/testsuite/tests/printer/T13550.stdout new file mode 100644 index 0000000..ff02835 --- /dev/null +++ b/testsuite/tests/printer/T13550.stdout @@ -0,0 +1,22 @@ +T13550.hs:(6,3)-(11,6): Splicing declarations + [d| type family Foo a b + data family Bar a b + + type instance Foo (Maybe a) b = Either (Maybe a) (Maybe b) + data instance Bar (Maybe a) b = BarMaybe (Maybe a) (Maybe b) |] + ======> + type family Foo a b + type instance Foo (Maybe a) b = Either (Maybe a) (Maybe b) + data family Bar a b + data instance Bar (Maybe a) b = BarMaybe (Maybe a) (Maybe b) +T13550.ppr.hs:(5,3)-(8,69): Splicing declarations + [d| type family Foo a b + data family Bar a b + + type instance Foo (Maybe a) b = Either (Maybe a) (Maybe b) + data instance Bar (Maybe a) b = BarMaybe (Maybe a) (Maybe b) |] + ======> + type family Foo a b + type instance Foo (Maybe a) b = Either (Maybe a) (Maybe b) + data family Bar a b + data instance Bar (Maybe a) b = BarMaybe (Maybe a) (Maybe b) diff --git a/testsuite/tests/printer/all.T b/testsuite/tests/printer/all.T index e5fd00f..c939e49 100644 --- a/testsuite/tests/printer/all.T +++ b/testsuite/tests/printer/all.T @@ -48,3 +48,4 @@ 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']) +test('T13550', ignore_stderr, run_command, ['$MAKE -s --no-print-directory T13550']) From git at git.haskell.org Sun Apr 9 22:44:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 9 Apr 2017 22:44:49 +0000 (UTC) Subject: [commit: ghc] master: Add a Note [Call Arity and Join Points] (87377f7) Message-ID: <20170409224449.AF9BF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/87377f74eec1567af741737b4b9034d06e3f0698/ghc >--------------------------------------------------------------- commit 87377f74eec1567af741737b4b9034d06e3f0698 Author: Joachim Breitner Date: Sun Apr 9 13:41:40 2017 -0400 Add a Note [Call Arity and Join Points] as discussed in #13479. >--------------------------------------------------------------- 87377f74eec1567af741737b4b9034d06e3f0698 compiler/simplCore/CallArity.hs | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/compiler/simplCore/CallArity.hs b/compiler/simplCore/CallArity.hs index 1eb4fa2..2e1de85 100644 --- a/compiler/simplCore/CallArity.hs +++ b/compiler/simplCore/CallArity.hs @@ -405,6 +405,26 @@ In practice, there are thunks that do a just little work, such as pattern-matching on a variable, and the benefits of eta-expansion likely oughtweigh the cost of doing that repeatedly. Therefore, this implementation of Call Arity considers everything that is not cheap (`exprIsCheap`) as a thunk. + +Note [Call Arity and Join Points] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The Call Arity analysis does not care about joint points, and treats them just +like normal functions. This is ok. + +The analysis *could* make use of the fact that join points are always evaluated +in the same context as the join-binding they are defined in and are always +one-shot, and handle join points separately, as suggested in +https://ghc.haskell.org/trac/ghc/ticket/13479#comment:10. +This *might* be more efficient (for example, join points would not have to be +considered interesting variables), but it would also add redundant code. So for +now we do not do that. + +The simplifier never eta-expands join points (it insteads pushes extra arguments from +an eta-expanded context into the join point’s RHS), so the call arity +annotation on join points is not actually used. As it would be equally valid +(though less efficient) to eta-expand join points, this is the simplifier's +choice, and hence Call Arity sets the call arity for join points as well. -} -- Main entry point @@ -627,7 +647,9 @@ callArityBind boring_vars ae_body int b@(Rec binds) | safe_arity == 0 = ae_rhs -- If it is not a function, its body is evaluated only once | otherwise = calledMultipleTimes ae_rhs - in (True, (i `setIdCallArity` trimmed_arity, Just (called_once, new_arity, ae_rhs'), rhs')) + i' = i `setIdCallArity` trimmed_arity + + in (True, (i', Just (called_once, new_arity, ae_rhs'), rhs')) where -- See Note [Taking boring variables into account] (new_arity, called_once) | i `elemVarSet` boring_vars = (0, False) From git at git.haskell.org Mon Apr 10 14:13:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 10 Apr 2017 14:13:10 +0000 (UTC) Subject: [commit: ghc] master: StgCse: Do not re-use trivial case scrutinees (b55f310) Message-ID: <20170410141310.97B1F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b55f310d06b8d3988d40aaccc0ff13601ee52b84/ghc >--------------------------------------------------------------- commit b55f310d06b8d3988d40aaccc0ff13601ee52b84 Author: Joachim Breitner Date: Sun Apr 9 19:40:02 2017 -0400 StgCse: Do not re-use trivial case scrutinees as they might be marked as one-shot, and suddenly we’d evaluate them multiple times. This came up in #13536 (test cases included). The solution was layed out by SPJ in ticket:13536#comment:12. Differential Revision: https://phabricator.haskell.org/D3437 >--------------------------------------------------------------- b55f310d06b8d3988d40aaccc0ff13601ee52b84 compiler/simplStg/StgCse.hs | 108 +++++++++++----------- testsuite/tests/simplStg/should_run/T13536.hs | 17 ++++ testsuite/tests/simplStg/should_run/T13536.stderr | 1 + testsuite/tests/simplStg/should_run/T13536.stdout | 1 + testsuite/tests/simplStg/should_run/all.T | 1 + 5 files changed, 75 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 b55f310d06b8d3988d40aaccc0ff13601ee52b84 From git at git.haskell.org Mon Apr 10 15:22:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 10 Apr 2017 15:22:56 +0000 (UTC) Subject: [commit: ghc] master: Add a second regression test for #13536 (ddc0591) Message-ID: <20170410152256.79ADE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ddc05912565aedd6ef46236906fa06cdb3e5e06c/ghc >--------------------------------------------------------------- commit ddc05912565aedd6ef46236906fa06cdb3e5e06c Author: Joachim Breitner Date: Mon Apr 10 11:21:52 2017 -0400 Add a second regression test for #13536 which counts allocations instead of observing recomputation directly. >--------------------------------------------------------------- ddc05912565aedd6ef46236906fa06cdb3e5e06c testsuite/tests/simplStg/should_run/T13536a.hs | 28 ++++++++++++++++++++++ .../tests/simplStg/should_run/T13536a.stdout | 0 testsuite/tests/simplStg/should_run/all.T | 9 +++++++ 3 files changed, 37 insertions(+) diff --git a/testsuite/tests/simplStg/should_run/T13536a.hs b/testsuite/tests/simplStg/should_run/T13536a.hs new file mode 100644 index 0000000..118c4c9 --- /dev/null +++ b/testsuite/tests/simplStg/should_run/T13536a.hs @@ -0,0 +1,28 @@ +{-# LANGUAGE TypeFamilies #-} +module Main where + +main :: IO () +main = do + let f :: (Bool, Bool) -> (Bool, Bool) -> (Bool, Bool) + f (True, False) (False, False) = (False, True) + f _ _ = (True, False) + ((i, b), v) = ((False,True),[(False,True),(False,False),(True,True),(True,False),(False,False),(False,True),(True,True),(True,True),(False,True),(True,False),(False,False),(True,True),(True,True),(False,False),(False,False),(False,True),(True,False),(True,False),(True,True),(True,True),(False,True),(True,False),(True,False),(True,True),(False,False),(True,True),(False,False),(True,False),(False,True),(True,True)]) + print $ foldlTest f (i, b) v + +type FoldlTest a = (a -> a -> a) -> a -> [a] -> Bool + +foldlTest :: FoldlTest (Bool, Bool) +foldlTest f (i, b) v = + foldl f (i, b) v == foldl (\x -> f (unmodel x)) (i, b) v + +class TestData a where + type Model a + unmodel :: Model a -> a + +instance TestData Bool where + type Model Bool = Bool + unmodel = id + +instance (Eq a, Eq b, TestData a, TestData b) => TestData (a,b) where + type Model (a,b) = (Model a, Model b) + unmodel (a,b) = (unmodel a, unmodel b) diff --git a/libraries/base/tests/IO/IOError002.stdout b/testsuite/tests/simplStg/should_run/T13536a.stdout similarity index 100% copy from libraries/base/tests/IO/IOError002.stdout copy to testsuite/tests/simplStg/should_run/T13536a.stdout diff --git a/testsuite/tests/simplStg/should_run/all.T b/testsuite/tests/simplStg/should_run/all.T index b24da84..d3aa937 100644 --- a/testsuite/tests/simplStg/should_run/all.T +++ b/testsuite/tests/simplStg/should_run/all.T @@ -11,3 +11,12 @@ setTestOpts(f) test('T9291', normal, compile_and_run, ['']) test('T13536', normal, compile_and_run, ['']) + +test('T13536a', + [stats_num_field('bytes allocated', + [ (wordsize(64), 86664, 5) ]), + # 2017-04-10 86664 -- 25769889696 if broken + only_ways(['optasm'])], + compile_and_run, + ['']) + From git at git.haskell.org Mon Apr 10 15:38:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 10 Apr 2017 15:38:53 +0000 (UTC) Subject: [commit: ghc] master: Typos in bang patterns user manual [skip ci] (b1acb16) Message-ID: <20170410153853.F3EB93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b1acb167b93f62eefab3f8cb24518eb0ce410d8c/ghc >--------------------------------------------------------------- commit b1acb167b93f62eefab3f8cb24518eb0ce410d8c Author: Ömer Sinan Ağacan Date: Mon Apr 10 18:38:31 2017 +0300 Typos in bang patterns user manual [skip ci] >--------------------------------------------------------------- b1acb167b93f62eefab3f8cb24518eb0ce410d8c docs/users_guide/glasgow_exts.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index e411c88..9d1ca19 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -12102,7 +12102,7 @@ Replace the "Translation" there with the following one. Given Replace any binding ``p = e``, where ``p`` is not a variable, with ``v = e; x1 = case v of p -> x1; ...; xn = case v of p -> xn``, where ``v`` is fresh and ``x1``.. ``xn`` are the bound variables of ``p``. - Again if ``e`` is a variable, you can optimised his by not introducing a + Again if ``e`` is a variable, this can be optimised by not introducing a fresh variable. The result will be a (possibly) recursive set of bindings, binding @@ -12112,7 +12112,7 @@ non-recursive using ``fix``, but we do not do so in Core, and it only obfuscates matters, so we do not do so here.) The translation is carefully crafted to make bang patterns meaningful -for reursive and polymorphic bindings as well as straightforward +for recursive and polymorphic bindings as well as straightforward non-recursive bindings. Here are some examples of how this translation works. The first From git at git.haskell.org Mon Apr 10 16:38:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 10 Apr 2017 16:38:17 +0000 (UTC) Subject: [commit: ghc] branch 'wip/spj-float-in' created Message-ID: <20170410163817.94C1E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/spj-float-in Referencing: a44b80bbb0dfe9bd3366eb2c0fb358742e2f6559 From git at git.haskell.org Mon Apr 10 16:38:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 10 Apr 2017 16:38:20 +0000 (UTC) Subject: [commit: ghc] wip/spj-float-in: Remove dead quantifyTyVars (eee097c) Message-ID: <20170410163820.5C1123A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-float-in Link : http://ghc.haskell.org/trac/ghc/changeset/eee097c76fbd5fc739739b67ee4e7585b5e78a99/ghc >--------------------------------------------------------------- commit eee097c76fbd5fc739739b67ee4e7585b5e78a99 Author: Simon Peyton Jones Date: Fri Apr 7 17:07:48 2017 +0100 Remove dead quantifyTyVars This patch * removes a function TcMType.quantifyTyVars that was never called * renames quantifyZonkedTyVars to quantifyTyVars Plus a few comments. No functional change at all >--------------------------------------------------------------- eee097c76fbd5fc739739b67ee4e7585b5e78a99 compiler/typecheck/TcHsType.hs | 2 +- compiler/typecheck/TcMType.hs | 28 +++++++--------------------- compiler/typecheck/TcRules.hs | 2 +- compiler/typecheck/TcSimplify.hs | 4 ++-- compiler/typecheck/TcTyClsDecls.hs | 23 ++++++++++++++++++----- 5 files changed, 29 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 eee097c76fbd5fc739739b67ee4e7585b5e78a99 From git at git.haskell.org Mon Apr 10 16:38:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 10 Apr 2017 16:38:26 +0000 (UTC) Subject: [commit: ghc] wip/spj-float-in: Improve demand analysis for join points (a44b80b) Message-ID: <20170410163826.9291E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-float-in Link : http://ghc.haskell.org/trac/ghc/changeset/a44b80bbb0dfe9bd3366eb2c0fb358742e2f6559/ghc >--------------------------------------------------------------- commit a44b80bbb0dfe9bd3366eb2c0fb358742e2f6559 Author: Simon Peyton Jones Date: Mon Apr 10 08:51:49 2017 +0100 Improve demand analysis for join points I realised (Trac #13543) that we can improve demand analysis for join point quite straightforwardly. The idea is explained in Note [Demand analysis for join points] in DmdAnal >--------------------------------------------------------------- a44b80bbb0dfe9bd3366eb2c0fb358742e2f6559 compiler/stranal/DmdAnal.hs | 82 ++++++++++++++++------ testsuite/tests/simplCore/should_compile/T13543.hs | 17 +++++ .../should_compile/T13543.stderr} | 0 testsuite/tests/simplCore/should_compile/all.T | 1 + 4 files changed, 80 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 a44b80bbb0dfe9bd3366eb2c0fb358742e2f6559 From git at git.haskell.org Mon Apr 10 16:38:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 10 Apr 2017 16:38:23 +0000 (UTC) Subject: [commit: ghc] wip/spj-float-in: Kill off complications in CoreFVs (cf8ac3e) Message-ID: <20170410163823.20F833A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/spj-float-in Link : http://ghc.haskell.org/trac/ghc/changeset/cf8ac3ea2b3c53a1b40f1b25914d98ed1a8446f6/ghc >--------------------------------------------------------------- commit cf8ac3ea2b3c53a1b40f1b25914d98ed1a8446f6 Author: Simon Peyton Jones Date: Fri Apr 7 17:10:07 2017 +0100 Kill off complications in CoreFVs When doing type-in-type, Richard introduce some substantial complications in CoreFVs, gathering types and free variables of type. In Trac #13160 we decided that this complication was unnecessary, so this patch removes it. Unfortnately I then fell down a twisty rabbit hole. Roughly: * An apparently-innocuous change in the AnnApp case of fiExpr made the fuction a little bit stricter, so we ended up peering into the arguments when we didn't before (namely when there are no bindings being floated inwards). I've rejigged it so that it's not fragile any more. * Peering into the arguments was sometimes expensive, becuase exprIsExpandable can be expensive because it looks deeply into the expression. * The combination of the two led to an combinatorial explosion of work when the argument of a function is a deeep nest of constructors. This bug has been lurking for ages. I solved it by replacing exprIsExpandable with exprIsHNF, which does a good enough job for the purpose here. Working all this out meant that I rewrote quite a bit of code, so it's now a reasonably substantial patch. But it's a net improvement. >--------------------------------------------------------------- cf8ac3ea2b3c53a1b40f1b25914d98ed1a8446f6 compiler/coreSyn/CoreFVs.hs | 105 +++++-------------- compiler/simplCore/FloatIn.hs | 235 ++++++++++++++++++++++++------------------ 2 files changed, 158 insertions(+), 182 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc cf8ac3ea2b3c53a1b40f1b25914d98ed1a8446f6 From git at git.haskell.org Mon Apr 10 17:37:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 10 Apr 2017 17:37:30 +0000 (UTC) Subject: [commit: ghc] master: Improve `readChan` documentation: (42ef084) Message-ID: <20170410173730.2E6873A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/42ef0845d0d2a7cc524e7048502f651d66f6a543/ghc >--------------------------------------------------------------- commit 42ef0845d0d2a7cc524e7048502f651d66f6a543 Author: Ömer Sinan Ağacan Date: Mon Apr 10 20:36:45 2017 +0300 Improve `readChan` documentation: - Mention that the read end is an `MVar`, so fairness guarantees are inherited. - Mention that it can throw `BlockedIndefinitelyOnMVar` exception. Reviewers: austin, hvr, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #5466 Differential Revision: https://phabricator.haskell.org/D3439 >--------------------------------------------------------------- 42ef0845d0d2a7cc524e7048502f651d66f6a543 libraries/base/Control/Concurrent/Chan.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libraries/base/Control/Concurrent/Chan.hs b/libraries/base/Control/Concurrent/Chan.hs index ed8e02b..ebbec7e 100644 --- a/libraries/base/Control/Concurrent/Chan.hs +++ b/libraries/base/Control/Concurrent/Chan.hs @@ -100,7 +100,13 @@ writeChan (Chan _ writeVar) val = do -- completes and before modifyMVar_ installs the new value, it will set the -- Chan's write end to a filled hole. --- |Read the next value from the 'Chan'. +-- |Read the next value from the 'Chan'. Blocks when the channel is empty. Since +-- the read end of a channel is an 'MVar', this operation inherits fairness +-- guarantees of 'MVar's (e.g. threads blocked in this operation are woken up in +-- FIFO order). +-- +-- Throws 'BlockedIndefinitelyOnMVar' when the channel is empty and no other +-- thread holds a reference to the channel. readChan :: Chan a -> IO a readChan (Chan readVar _) = do modifyMVarMasked readVar $ \read_end -> do -- Note [modifyMVarMasked] From git at git.haskell.org Mon Apr 10 23:30:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 10 Apr 2017 23:30:52 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Typos in bang patterns user manual [skip ci] (d4fa088) Message-ID: <20170410233052.81A9F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/d4fa088350913233520ffa7163ef188a63666262/ghc >--------------------------------------------------------------- commit d4fa088350913233520ffa7163ef188a63666262 Author: Ömer Sinan Ağacan Date: Mon Apr 10 18:38:31 2017 +0300 Typos in bang patterns user manual [skip ci] (cherry picked from commit b1acb167b93f62eefab3f8cb24518eb0ce410d8c) >--------------------------------------------------------------- d4fa088350913233520ffa7163ef188a63666262 docs/users_guide/glasgow_exts.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index 89b970c..cf8bb43 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -12007,7 +12007,7 @@ Replace the "Translation" there with the following one. Given Replace any binding ``p = e``, where ``p`` is not a variable, with ``v = e; x1 = case v of p -> x1; ...; xn = case v of p -> xn``, where ``v`` is fresh and ``x1``.. ``xn`` are the bound variables of ``p``. - Again if ``e`` is a variable, you can optimised his by not introducing a + Again if ``e`` is a variable, this can be optimised by not introducing a fresh variable. The result will be a (possibly) recursive set of bindings, binding @@ -12017,7 +12017,7 @@ non-recursive using ``fix``, but we do not do so in Core, and it only obfuscates matters, so we do not do so here.) The translation is carefully crafted to make bang patterns meaningful -for reursive and polymorphic bindings as well as straightforward +for recursive and polymorphic bindings as well as straightforward non-recursive bindings. Here are some examples of how this translation works. The first From git at git.haskell.org Mon Apr 10 23:30:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 10 Apr 2017 23:30:56 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Fix TcSimplify.decideQuantification for kind variables (a920404) Message-ID: <20170410233056.13F8A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/a920404fb12fb52a59e4f728cce4d662a418c5f8/ghc >--------------------------------------------------------------- commit a920404fb12fb52a59e4f728cce4d662a418c5f8 Author: Simon Peyton Jones Date: Fri Mar 10 11:20:00 2017 +0000 Fix TcSimplify.decideQuantification for kind variables TcSimplify.decideQuantification was doing the Wrong Thing when "growing" the type variables to quantify over. We were trying to do this on a tyvar set where we'd split off the dependent type varaibles; and we just got it wrong. A kind variable wasn't being generalised properly, with confusing knock on consequences. All this led to Trac #13371 and Trac #13393. This commit tidies it all up: * The type TcDepVars is renamed as CandidateQTvs; and splitDepVarsOfType to candidateQTyVarsOfType * The code in TcSimplify.decideQuantification is simpler. It no longer does the tricky "grow" stuff over TcDepVars. Instead it use ordinary VarSets (thereby eliminating the nasty growThetaTyVarsDSet) and uses that to filter the result of candidateQTyVarsOfType. * I documented that candidateQTyVarsOfType returns the type variables in a good order in which to quantify, and rewrote it to use an accumulator pattern, so that we would predicatably get left-to-right ordering. In doing all this I also made UniqDFM behave a little more nicely: * When inserting an element that is there already, keep the old tag, while still overwriting with the new value. * This means that when doing udfmToList we get back elements in the order they were originally inserted, rather than in reverse order. It's not a big deal, but in a subsequent commit I use it to improve the order of type variables in inferred types. All this led to a lot of error message wibbles: - changing the order of quantified variables - changing the order in which instances are listed in GHCi - changing the tidying of variables in typechecker erors There's a submodule update for 'array' because one of its tests has an error-message change. I may not have associated all of them with the correct commit. (cherry picked from commit 7e96526ac2ef5987ecb03217d3d616b6281c1441) >--------------------------------------------------------------- a920404fb12fb52a59e4f728cce4d662a418c5f8 compiler/typecheck/TcMType.hs | 16 +-- compiler/typecheck/TcSimplify.hs | 58 ++++------ compiler/typecheck/TcType.hs | 121 ++++++++++++--------- compiler/utils/UniqDFM.hs | 42 ++++--- testsuite/tests/ado/ado004.stderr | 24 ++-- .../tests/determinism/determ021/determ021.stdout | 4 +- testsuite/tests/driver/werror.stderr | 2 +- testsuite/tests/gadt/gadt7.stderr | 16 +-- .../tests/ghci.debugger/scripts/break026.stdout | 20 ++-- testsuite/tests/ghci/scripts/T11524a.stdout | 8 +- testsuite/tests/ghci/scripts/T11975.stdout | 2 +- testsuite/tests/ghci/scripts/T12550.stdout | 28 ++--- testsuite/tests/ghci/scripts/T13202a.stderr | 2 +- testsuite/tests/ghci/scripts/T4175.stdout | 32 +++--- testsuite/tests/ghci/scripts/T6018ghcifail.stderr | 8 +- testsuite/tests/ghci/scripts/T7627.stdout | 26 ++--- testsuite/tests/ghci/scripts/T7939.stdout | 4 +- testsuite/tests/ghci/scripts/T8469.stdout | 10 +- testsuite/tests/ghci/scripts/T8535.stdout | 2 +- testsuite/tests/ghci/scripts/T9881.stdout | 16 +-- testsuite/tests/ghci/scripts/ghci011.stdout | 38 +++---- testsuite/tests/ghci/scripts/ghci020.stdout | 2 +- testsuite/tests/ghci/should_run/T10145.stdout | 2 +- testsuite/tests/ghci/should_run/T12549.stdout | 2 +- .../indexed-types/should_compile/T3017.stderr | 2 +- .../tests/indexed-types/should_fail/T1897b.stderr | 2 +- .../tests/indexed-types/should_fail/T8518.stderr | 8 +- .../tests/indexed-types/should_fail/T9662.stderr | 4 +- testsuite/tests/module/mod72.stderr | 2 +- .../tests/parser/should_fail/readFail003.stderr | 6 +- .../should_compile/ExtraConstraints3.stderr | 86 +++++++-------- .../partial-sigs/should_compile/Meltdown.stderr | 2 +- .../partial-sigs/should_compile/NamedTyVar.stderr | 2 +- .../partial-sigs/should_compile/SkipMany.stderr | 2 +- .../partial-sigs/should_compile/T10438.stderr | 4 +- .../partial-sigs/should_compile/T11192.stderr | 10 +- .../partial-sigs/should_compile/Uncurry.stderr | 2 +- .../should_compile/UncurryNamed.stderr | 2 +- .../WarningWildcardInstantiations.stderr | 2 +- .../NamedExtraConstraintsWildcard.stderr | 4 +- .../should_fail/NamedWildcardsNotInMonotype.stderr | 4 +- .../tests/partial-sigs/should_fail/T10045.stderr | 10 +- .../partial-sigs/should_fail/TidyClash.stderr | 12 +- .../partial-sigs/should_fail/TidyClash2.stderr | 36 +++--- .../tests/patsyn/should_compile/T11213.stderr | 4 +- testsuite/tests/polykinds/T13371.hs | 42 +++++++ testsuite/tests/polykinds/T13393.hs | 66 +++++++++++ testsuite/tests/polykinds/T13393.stderr | 25 +++++ testsuite/tests/polykinds/T7438.stderr | 14 +-- testsuite/tests/polykinds/T7524.stderr | 2 +- testsuite/tests/polykinds/all.T | 2 + testsuite/tests/rename/should_fail/T2993.stderr | 2 +- .../tests/simplCore/should_compile/T3234.stderr | 2 +- .../tests/typecheck/should_compile/tc141.stderr | 12 +- .../tests/typecheck/should_compile/tc168.stderr | 8 +- .../tests/typecheck/should_compile/tc231.stderr | 2 +- .../tests/typecheck/should_fail/T12177.stderr | 16 +-- testsuite/tests/typecheck/should_fail/T2714.stderr | 8 +- .../tests/typecheck/should_fail/T6018fail.stderr | 10 +- .../typecheck/should_fail/T6018failclosed.stderr | 4 +- testsuite/tests/typecheck/should_fail/T7734.stderr | 12 +- testsuite/tests/typecheck/should_fail/T8142.stderr | 2 +- testsuite/tests/typecheck/should_fail/T8883.stderr | 2 +- testsuite/tests/typecheck/should_fail/mc25.stderr | 8 +- .../tests/typecheck/should_fail/tcfail049.stderr | 2 +- .../tests/typecheck/should_fail/tcfail050.stderr | 2 +- 66 files changed, 541 insertions(+), 393 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc a920404fb12fb52a59e4f728cce4d662a418c5f8 From git at git.haskell.org Mon Apr 10 23:30:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 10 Apr 2017 23:30:59 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Yet another attempt at inferring the right quantification (859dc65) Message-ID: <20170410233059.7BA073A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/859dc65369e8a9722514046246dd32b683c8b4a9/ghc >--------------------------------------------------------------- commit 859dc65369e8a9722514046246dd32b683c8b4a9 Author: Simon Peyton Jones Date: Wed Apr 5 13:46:03 2017 +0100 Yet another attempt at inferring the right quantification TcSimplify.decideQuantification is truly a tricky function! Trac #13509 showed that we were being over-eager with defaulting of runtime-rep variables (levity polymorphism), which meant that a program was wrongly rejected, and with a very odd error message (c.f. Trac #13530) I spent an unreasonably long time figuring out how to fix this in a decent way, and ended up with a major refactoring of decideQuantification, with a kock-on effect in simplifyInfer. It is at least a bit more comprehensible now; but I still can't say I like it. (cherry picked from commit bac95f9de5bd8d0a647a3a1e4492497603c2fda2) >--------------------------------------------------------------- 859dc65369e8a9722514046246dd32b683c8b4a9 compiler/typecheck/TcMType.hs | 95 +++---- compiler/typecheck/TcSimplify.hs | 306 ++++++++++++--------- .../indexed-types/should_fail/ExtraTcsUntch.stderr | 12 +- testsuite/tests/typecheck/should_compile/T13509.hs | 17 ++ testsuite/tests/typecheck/should_compile/all.T | 3 +- 5 files changed, 255 insertions(+), 178 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 859dc65369e8a9722514046246dd32b683c8b4a9 From git at git.haskell.org Tue Apr 11 02:19:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 11 Apr 2017 02:19:44 +0000 (UTC) Subject: [commit: ghc] master: base: Fix erroneous reference to Data.Reflection in documentation (40a2ed0) Message-ID: <20170411021944.DBEAC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/40a2ed058785d6caaf38d938f51659476622b29b/ghc >--------------------------------------------------------------- commit 40a2ed058785d6caaf38d938f51659476622b29b Author: Ben Gamari Date: Mon Apr 10 14:07:42 2017 -0400 base: Fix erroneous reference to Data.Reflection in documentation >--------------------------------------------------------------- 40a2ed058785d6caaf38d938f51659476622b29b libraries/base/Data/Typeable.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/base/Data/Typeable.hs b/libraries/base/Data/Typeable.hs index 4268619..6157e82 100644 --- a/libraries/base/Data/Typeable.hs +++ b/libraries/base/Data/Typeable.hs @@ -31,7 +31,7 @@ -- Since GHC 8.2, GHC has supported type-indexed type representations. -- "Data.Typeable" provides type representations which are qualified over this -- index, providing an interface very similar to the "Typeable" notion seen in --- previous releases. For the type-indexed interface, see "Data.Reflection". +-- previous releases. For the type-indexed interface, see "Type.Reflection". -- -- Since GHC 7.8, 'Typeable' is poly-kinded. The changes required for this might -- break some old programs involving 'Typeable'. More details on this, including From git at git.haskell.org Tue Apr 11 02:19:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 11 Apr 2017 02:19:47 +0000 (UTC) Subject: [commit: ghc] master: Fix form of note (3a0e5e0) Message-ID: <20170411021947.96D813A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3a0e5e0f1d9babf40d7fc372b2808da6947181e8/ghc >--------------------------------------------------------------- commit 3a0e5e0f1d9babf40d7fc372b2808da6947181e8 Author: Ben Gamari Date: Mon Apr 10 21:35:06 2017 -0400 Fix form of note >--------------------------------------------------------------- 3a0e5e0f1d9babf40d7fc372b2808da6947181e8 compiler/rename/RnPat.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/rename/RnPat.hs b/compiler/rename/RnPat.hs index 3417494..4590fc7 100644 --- a/compiler/rename/RnPat.hs +++ b/compiler/rename/RnPat.hs @@ -249,7 +249,8 @@ report unused variables at the binding level. So we must use bindLocalNames here, *not* bindLocalNameFV. Trac #3943. -Note: [Don't report shadowing for pattern synonyms] +Note [Don't report shadowing for pattern synonyms] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ There is one special context where a pattern doesn't introduce any new binders - pattern synonym declarations. Therefore we don't check to see if pattern variables shadow existing identifiers as they are never bound to anything From git at git.haskell.org Tue Apr 11 02:19:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 11 Apr 2017 02:19:54 +0000 (UTC) Subject: [commit: ghc] master: [MachO] Use OBJFORMAT_MACHO. (185834e) Message-ID: <20170411021954.06F863A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/185834e74f3c20f7ea727cc799436afd8e16cfa4/ghc >--------------------------------------------------------------- commit 185834e74f3c20f7ea727cc799436afd8e16cfa4 Author: Moritz Angermann Date: Mon Apr 10 21:39:02 2017 -0400 [MachO] Use OBJFORMAT_MACHO. Reviewers: bgamari, austin, erikd, simonmar, rwbarton Reviewed By: rwbarton Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3433 >--------------------------------------------------------------- 185834e74f3c20f7ea727cc799436afd8e16cfa4 rts/linker/LoadArchive.c | 2 +- rts/linker/MachOTypes.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rts/linker/LoadArchive.c b/rts/linker/LoadArchive.c index a33c00d..c83b3ba 100644 --- a/rts/linker/LoadArchive.c +++ b/rts/linker/LoadArchive.c @@ -13,7 +13,7 @@ /* Platform specific headers */ #if defined(OBJFORMAT_PEi386) # include "linker/PEi386.h" -#elif defined(darwin_HOST_OS) || defined(ios_HOST_OS) +#elif defined(OBJFORMAT_MACHO) # include "linker/MachO.h" # include # include diff --git a/rts/linker/MachOTypes.h b/rts/linker/MachOTypes.h index f78bfca..5b2dced 100644 --- a/rts/linker/MachOTypes.h +++ b/rts/linker/MachOTypes.h @@ -1,7 +1,7 @@ #ifndef MachOTypes_h #define MachOTypes_h -#if defined(darwin_HOST_OS) || defined(ios_HOST_OS) +#if defined(OBJFORMAT_MACHO) #include "ghcplatform.h" @@ -129,5 +129,5 @@ typedef struct _SectionFormatInfo { MachORelocationInfo * relocation_info; } SectionFormatInfo; -#endif /* darwin_HOST_OS || ios_HOST_OS */ +#endif /* OBJECTFORMAT_MACHO */ #endif /* MachOTypes_h */ From git at git.haskell.org Tue Apr 11 02:19:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 11 Apr 2017 02:19:51 +0000 (UTC) Subject: [commit: ghc] master: Enter iserv-proxy (d463107) Message-ID: <20170411021951.50D953A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d4631078ece3cfa4179c70f5937738be72659dba/ghc >--------------------------------------------------------------- commit d4631078ece3cfa4179c70f5937738be72659dba Author: Moritz Angermann Date: Mon Apr 10 21:38:45 2017 -0400 Enter iserv-proxy With the introduction of -fexternal-interpreter we are now able to compile template haskell via an extern iserv process. This however is restricted to the same host, and can therefore not be used with crosscompilers where the iserv slave process needs to run on a different machine than the cross compiling haskell compiler. This diff breaks up iserv into a library and the iserv-bin binary. It also introduces the iserv-proxy, a proxy instance that the haskell compiler can talk to, and which forwards the calls to the iserv slave on a different machine, as well as providing some extra functionarily (sending files that are not available on the machine the slave runs on), as well as forwarding from the slave to the haskell compiler, when the slave needs to interrogate the haskell compiler. The iserv library now also exports the startSlave function to be called by the application that implements the slave on the target. The simplest such app would probably look something like: ``` extern void startServ(bool, const char *); int main(int argc, char * argv[]) { hs_init(NULL, NULL); startServ(false,"/tmp"); while(1); } ``` Special thanks to Shea Levy for the first draft of the iserv-remote, from which I took some inspiration. The `Buildable` flags are due to ghc-cabal not being able to build more than a single target. Please note that only the stock iserv-bin is supposed to be built *with* ghc. The library and proxy are supposed to be built outside of ghc. Yet I believe that this code should live together with iserv. Reviewers: simonmar, ezyang, goldfire, austin, rwbarton, bgamari Reviewed By: simonmar Subscribers: luite, ryantrinkle, shlevy, thomie Differential Revision: https://phabricator.haskell.org/D3233 >--------------------------------------------------------------- d4631078ece3cfa4179c70f5937738be72659dba iserv/iserv-bin.cabal | 113 ++++++++++++++++++- iserv/proxy-src/Remote.hs | 255 ++++++++++++++++++++++++++++++++++++++++++ iserv/src/{Main.hs => Lib.hs} | 64 ++--------- iserv/src/Main.hs | 70 ++---------- iserv/src/Remote/Message.hs | 48 ++++++++ iserv/src/Remote/Slave.hs | 124 ++++++++++++++++++++ 6 files changed, 552 insertions(+), 122 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc d4631078ece3cfa4179c70f5937738be72659dba From git at git.haskell.org Tue Apr 11 02:19:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 11 Apr 2017 02:19:56 +0000 (UTC) Subject: [commit: ghc] master: [Elf/arm] Thumb indicator bit only for STT_FUNC (e662a6c) Message-ID: <20170411021956.B92D33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e662a6cb9fb6459e0a15abbff25ae7b80f91b281/ghc >--------------------------------------------------------------- commit e662a6cb9fb6459e0a15abbff25ae7b80f91b281 Author: Moritz Angermann Date: Mon Apr 10 21:39:19 2017 -0400 [Elf/arm] Thumb indicator bit only for STT_FUNC Reviewers: rwbarton, bgamari, austin, erikd, simonmar, trofi Reviewed By: trofi Subscribers: trofi, thomie Differential Revision: https://phabricator.haskell.org/D3438 >--------------------------------------------------------------- e662a6cb9fb6459e0a15abbff25ae7b80f91b281 rts/linker/Elf.c | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/rts/linker/Elf.c b/rts/linker/Elf.c index 77107a7..174fc47 100644 --- a/rts/linker/Elf.c +++ b/rts/linker/Elf.c @@ -992,15 +992,37 @@ do_Elf_Rel_relocations ( ObjectCode* oc, char* ehdrC, IF_DEBUG(linker,debugBelch( "`%s' resolves to %p\n", symbol, (void*)S )); #ifdef arm_HOST_ARCH - // Thumb instructions have bit 0 of symbol's st_value set - is_target_thm = S & 0x1; - - T = sym.st_info & STT_FUNC && is_target_thm; - - // Make sure we clear bit 0. Strictly speaking we should have done - // this to st_value above but I believe alignment requirements should - // ensure that no instructions start on an odd address - S &= ~1; + /* + * 4.5.3 Symbol Values + * + * In addition to the normal rules for symbol values the following + * rules shall also apply to symbols of type STT_FUNC: + * - If the symbol addresses an ARM instruction, its value is the + * address of the instruction (in a relocatable object, the + * offset of the instruction from the start of the section + * containing it). + * - If the symbol addresses a Thumb instruction, its value is the + * address of the instruction with bit zero set (in a relocatable + * object, the section offset with bit zero set). + * - For the purposes of relocation the value used shall be the + * address of the instruction (st_value & ~1). + * + * Note: This allows a linker to distinguish ARM and Thumb code + * symbols without having to refer to the map. An ARM symbol + * will always have an even value, while a Thumb symbol will + * always have an odd value. However, a linker should strip + * the discriminating bit from the value before using it for + * relocation. + * + * (source: ELF for the ARM Architecture + * ARM IHI 0044F, current through ABI release 2.10 + * 24th November 2015) + */ + if(ELF_ST_TYPE(sym.st_info) == STT_FUNC) { + is_target_thm = S & 0x1; + T = is_target_thm; + S &= ~1; + } #endif } From git at git.haskell.org Tue Apr 11 02:21:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 11 Apr 2017 02:21:47 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Improve `readChan` documentation: (f92b2f6) Message-ID: <20170411022147.320FB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/f92b2f6f31a029300324142b6a6f48d38428c518/ghc >--------------------------------------------------------------- commit f92b2f6f31a029300324142b6a6f48d38428c518 Author: Ömer Sinan Ağacan Date: Mon Apr 10 20:36:45 2017 +0300 Improve `readChan` documentation: - Mention that the read end is an `MVar`, so fairness guarantees are inherited. - Mention that it can throw `BlockedIndefinitelyOnMVar` exception. Reviewers: austin, hvr, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #5466 Differential Revision: https://phabricator.haskell.org/D3439 (cherry picked from commit 42ef0845d0d2a7cc524e7048502f651d66f6a543) >--------------------------------------------------------------- f92b2f6f31a029300324142b6a6f48d38428c518 libraries/base/Control/Concurrent/Chan.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libraries/base/Control/Concurrent/Chan.hs b/libraries/base/Control/Concurrent/Chan.hs index ed8e02b..ebbec7e 100644 --- a/libraries/base/Control/Concurrent/Chan.hs +++ b/libraries/base/Control/Concurrent/Chan.hs @@ -100,7 +100,13 @@ writeChan (Chan _ writeVar) val = do -- completes and before modifyMVar_ installs the new value, it will set the -- Chan's write end to a filled hole. --- |Read the next value from the 'Chan'. +-- |Read the next value from the 'Chan'. Blocks when the channel is empty. Since +-- the read end of a channel is an 'MVar', this operation inherits fairness +-- guarantees of 'MVar's (e.g. threads blocked in this operation are woken up in +-- FIFO order). +-- +-- Throws 'BlockedIndefinitelyOnMVar' when the channel is empty and no other +-- thread holds a reference to the channel. readChan :: Chan a -> IO a readChan (Chan readVar _) = do modifyMVarMasked readVar $ \read_end -> do -- Note [modifyMVarMasked] From git at git.haskell.org Tue Apr 11 02:21:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 11 Apr 2017 02:21:57 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Add a second regression test for #13536 (f412326) Message-ID: <20170411022157.1EC0D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/f4123268d23a1ded83a17d3c48c14ba9548b717c/ghc >--------------------------------------------------------------- commit f4123268d23a1ded83a17d3c48c14ba9548b717c Author: Joachim Breitner Date: Mon Apr 10 11:21:52 2017 -0400 Add a second regression test for #13536 which counts allocations instead of observing recomputation directly. (cherry picked from commit ddc05912565aedd6ef46236906fa06cdb3e5e06c) >--------------------------------------------------------------- f4123268d23a1ded83a17d3c48c14ba9548b717c testsuite/tests/simplStg/should_run/T13536a.hs | 28 ++++++++++++++++++++++ .../tests/simplStg/should_run/T13536a.stdout | 0 testsuite/tests/simplStg/should_run/all.T | 9 +++++++ 3 files changed, 37 insertions(+) diff --git a/testsuite/tests/simplStg/should_run/T13536a.hs b/testsuite/tests/simplStg/should_run/T13536a.hs new file mode 100644 index 0000000..118c4c9 --- /dev/null +++ b/testsuite/tests/simplStg/should_run/T13536a.hs @@ -0,0 +1,28 @@ +{-# LANGUAGE TypeFamilies #-} +module Main where + +main :: IO () +main = do + let f :: (Bool, Bool) -> (Bool, Bool) -> (Bool, Bool) + f (True, False) (False, False) = (False, True) + f _ _ = (True, False) + ((i, b), v) = ((False,True),[(False,True),(False,False),(True,True),(True,False),(False,False),(False,True),(True,True),(True,True),(False,True),(True,False),(False,False),(True,True),(True,True),(False,False),(False,False),(False,True),(True,False),(True,False),(True,True),(True,True),(False,True),(True,False),(True,False),(True,True),(False,False),(True,True),(False,False),(True,False),(False,True),(True,True)]) + print $ foldlTest f (i, b) v + +type FoldlTest a = (a -> a -> a) -> a -> [a] -> Bool + +foldlTest :: FoldlTest (Bool, Bool) +foldlTest f (i, b) v = + foldl f (i, b) v == foldl (\x -> f (unmodel x)) (i, b) v + +class TestData a where + type Model a + unmodel :: Model a -> a + +instance TestData Bool where + type Model Bool = Bool + unmodel = id + +instance (Eq a, Eq b, TestData a, TestData b) => TestData (a,b) where + type Model (a,b) = (Model a, Model b) + unmodel (a,b) = (unmodel a, unmodel b) diff --git a/libraries/base/tests/IO/IOError002.stdout b/testsuite/tests/simplStg/should_run/T13536a.stdout similarity index 100% copy from libraries/base/tests/IO/IOError002.stdout copy to testsuite/tests/simplStg/should_run/T13536a.stdout diff --git a/testsuite/tests/simplStg/should_run/all.T b/testsuite/tests/simplStg/should_run/all.T index b24da84..d3aa937 100644 --- a/testsuite/tests/simplStg/should_run/all.T +++ b/testsuite/tests/simplStg/should_run/all.T @@ -11,3 +11,12 @@ setTestOpts(f) test('T9291', normal, compile_and_run, ['']) test('T13536', normal, compile_and_run, ['']) + +test('T13536a', + [stats_num_field('bytes allocated', + [ (wordsize(64), 86664, 5) ]), + # 2017-04-10 86664 -- 25769889696 if broken + only_ways(['optasm'])], + compile_and_run, + ['']) + From git at git.haskell.org Tue Apr 11 02:21:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 11 Apr 2017 02:21:53 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: StgCse: Do not re-use trivial case scrutinees (687e79f) Message-ID: <20170411022153.F254C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/687e79fdf3d192cdc16bccb8b28eaec60ebb8abb/ghc >--------------------------------------------------------------- commit 687e79fdf3d192cdc16bccb8b28eaec60ebb8abb Author: Joachim Breitner Date: Sun Apr 9 19:40:02 2017 -0400 StgCse: Do not re-use trivial case scrutinees as they might be marked as one-shot, and suddenly we’d evaluate them multiple times. This came up in #13536 (test cases included). The solution was layed out by SPJ in ticket:13536#comment:12. Differential Revision: https://phabricator.haskell.org/D3437 (cherry picked from commit b55f310d06b8d3988d40aaccc0ff13601ee52b84) >--------------------------------------------------------------- 687e79fdf3d192cdc16bccb8b28eaec60ebb8abb compiler/simplStg/StgCse.hs | 108 +++++++++++----------- testsuite/tests/simplStg/should_run/T13536.hs | 17 ++++ testsuite/tests/simplStg/should_run/T13536.stderr | 1 + testsuite/tests/simplStg/should_run/T13536.stdout | 1 + testsuite/tests/simplStg/should_run/all.T | 1 + 5 files changed, 75 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 687e79fdf3d192cdc16bccb8b28eaec60ebb8abb From git at git.haskell.org Tue Apr 11 02:21:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 11 Apr 2017 02:21:59 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: base: Fix erroneous reference to Data.Reflection in documentation (1de6032) Message-ID: <20170411022159.D25713A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/1de6032e8ea61fdd7a0ff6c94ebed3649d40898c/ghc >--------------------------------------------------------------- commit 1de6032e8ea61fdd7a0ff6c94ebed3649d40898c Author: Ben Gamari Date: Mon Apr 10 14:07:42 2017 -0400 base: Fix erroneous reference to Data.Reflection in documentation (cherry picked from commit 40a2ed058785d6caaf38d938f51659476622b29b) >--------------------------------------------------------------- 1de6032e8ea61fdd7a0ff6c94ebed3649d40898c libraries/base/Data/Typeable.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/base/Data/Typeable.hs b/libraries/base/Data/Typeable.hs index 4268619..6157e82 100644 --- a/libraries/base/Data/Typeable.hs +++ b/libraries/base/Data/Typeable.hs @@ -31,7 +31,7 @@ -- Since GHC 8.2, GHC has supported type-indexed type representations. -- "Data.Typeable" provides type representations which are qualified over this -- index, providing an interface very similar to the "Typeable" notion seen in --- previous releases. For the type-indexed interface, see "Data.Reflection". +-- previous releases. For the type-indexed interface, see "Type.Reflection". -- -- Since GHC 7.8, 'Typeable' is poly-kinded. The changes required for this might -- break some old programs involving 'Typeable'. More details on this, including From git at git.haskell.org Tue Apr 11 02:21:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 11 Apr 2017 02:21:50 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Parenthesize type/data families correctly for -ddump-splices (a2de03a) Message-ID: <20170411022150.5C5D83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/a2de03a8d5448f085074af4d78db998386bd8a5a/ghc >--------------------------------------------------------------- commit a2de03a8d5448f085074af4d78db998386bd8a5a Author: Alan Zimmerman Date: Sun Apr 9 21:06:06 2017 +0200 Parenthesize type/data families correctly for -ddump-splices Fix a regression in the pretty-printed code for -ddump-splices, which regressed since 8.0. Closes trac issue #13550 (cherry picked from commit 5282bb1772ba3f1dc999a177965e543822f342a0) >--------------------------------------------------------------- a2de03a8d5448f085074af4d78db998386bd8a5a compiler/hsSyn/Convert.hs | 9 +++-- testsuite/tests/printer/Makefile | 4 ++ testsuite/tests/printer/T13550.hs | 69 +++++++++++++++++++++++++++++++++++ testsuite/tests/printer/T13550.stdout | 22 +++++++++++ testsuite/tests/printer/all.T | 1 + 5 files changed, 101 insertions(+), 4 deletions(-) diff --git a/compiler/hsSyn/Convert.hs b/compiler/hsSyn/Convert.hs index 921448e..8d90344 100644 --- a/compiler/hsSyn/Convert.hs +++ b/compiler/hsSyn/Convert.hs @@ -37,7 +37,7 @@ import Outputable import MonadUtils ( foldrM ) import qualified Data.ByteString as BS -import Control.Monad( unless, liftM, ap ) +import Control.Monad( unless, liftM, ap, (<=<) ) import Data.Maybe( catMaybes, fromMaybe, isNothing ) import Language.Haskell.TH as TH hiding (sigP) @@ -386,7 +386,7 @@ cvtDec (TH.PatSynSigD nm ty) ---------------- cvtTySynEqn :: Located RdrName -> TySynEqn -> CvtM (LTyFamInstEqn RdrName) cvtTySynEqn tc (TySynEqn lhs rhs) - = do { lhs' <- mapM cvtType lhs + = do { lhs' <- mapM (wrap_apps <=< cvtType) lhs ; rhs' <- cvtType rhs ; returnL $ TyFamEqn { tfe_tycon = tc , tfe_pats = mkHsImplicitBndrs lhs' @@ -433,7 +433,7 @@ cvt_tyinst_hdr :: TH.Cxt -> TH.Name -> [TH.Type] cvt_tyinst_hdr cxt tc tys = do { cxt' <- cvtContext cxt ; tc' <- tconNameL tc - ; tys' <- mapM cvtType tys + ; tys' <- mapM (wrap_apps <=< cvtType) tys ; return (cxt', tc', mkHsImplicitBndrs tys') } ---------------- @@ -552,7 +552,8 @@ cvtSrcStrictness SourceStrict = SrcStrict cvt_arg :: (TH.Bang, TH.Type) -> CvtM (LHsType RdrName) cvt_arg (Bang su ss, ty) - = do { ty' <- cvtType ty + = do { ty'' <- cvtType ty + ; ty' <- wrap_apps ty'' ; let su' = cvtSrcUnpackedness su ; let ss' = cvtSrcStrictness ss ; returnL $ HsBangTy (HsSrcBang NoSourceText su' ss') ty' } diff --git a/testsuite/tests/printer/Makefile b/testsuite/tests/printer/Makefile index 9f0eb23..9cb968f 100644 --- a/testsuite/tests/printer/Makefile +++ b/testsuite/tests/printer/Makefile @@ -205,3 +205,7 @@ T13199: .PHONY: T13050p T13050p: $(CHECK_PPR) "`'$(TEST_HC)' $(TEST_HC_OPTS) --print-libdir | tr -d '\r'`" T13050p.hs + +.PHONY: T13550 +T13550: + $(CHECK_PPR) "`'$(TEST_HC)' $(TEST_HC_OPTS) --print-libdir | tr -d '\r'`" T13550.hs diff --git a/testsuite/tests/printer/T13550.hs b/testsuite/tests/printer/T13550.hs new file mode 100644 index 0000000..90a70aa --- /dev/null +++ b/testsuite/tests/printer/T13550.hs @@ -0,0 +1,69 @@ +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE TypeFamilies #-} +{-# OPTIONS_GHC -ddump-splices -dsuppress-uniques #-} +module Bug where + +$([d| type family Foo a b + type instance Foo (Maybe a) b = Either (Maybe a) (Maybe b) + + data family Bar a b + data instance Bar (Maybe a) b = BarMaybe (Maybe a) (Maybe b) + |]) + +{- + type instance Foo (Maybe a) b = Either (Maybe a) (Maybe b) + +becomes + +[TySynInstD Bug.Foo + (TySynEqn + [AppT + (ConT GHC.Base.Maybe) + (VarT a_6989586621679027317) + ,VarT b_6989586621679027318] + (AppT + (AppT + (ConT Data.Either.Either) + (AppT + (ConT GHC.Base.Maybe) + (VarT a_6989586621679027317) + ) + ) + (AppT (ConT GHC.Base.Maybe) (VarT b_6989586621679027318)) + ) + ) +] + + data instance Bar (Maybe a) b = BarMaybe (Maybe a) (Maybe b) + +becomes + +[DataInstD [] Bug.Bar + [AppT + (ConT GHC.Base.Maybe) + (VarT a_6989586621679027707) + ,VarT b_6989586621679027708 + ] + Nothing + [NormalC + BarMaybe_6989586621679027706 + [(Bang + NoSourceUnpackedness + NoSourceStrictness + ,AppT + (ConT GHC.Base.Maybe) + (VarT a_6989586621679027707) + ) + ,(Bang + NoSourceUnpackedness + NoSourceStrictness + ,AppT + (ConT GHC.Base.Maybe) + (VarT b_6989586621679027708) + ) + ] + ] + []] + + +-} diff --git a/testsuite/tests/printer/T13550.stdout b/testsuite/tests/printer/T13550.stdout new file mode 100644 index 0000000..ff02835 --- /dev/null +++ b/testsuite/tests/printer/T13550.stdout @@ -0,0 +1,22 @@ +T13550.hs:(6,3)-(11,6): Splicing declarations + [d| type family Foo a b + data family Bar a b + + type instance Foo (Maybe a) b = Either (Maybe a) (Maybe b) + data instance Bar (Maybe a) b = BarMaybe (Maybe a) (Maybe b) |] + ======> + type family Foo a b + type instance Foo (Maybe a) b = Either (Maybe a) (Maybe b) + data family Bar a b + data instance Bar (Maybe a) b = BarMaybe (Maybe a) (Maybe b) +T13550.ppr.hs:(5,3)-(8,69): Splicing declarations + [d| type family Foo a b + data family Bar a b + + type instance Foo (Maybe a) b = Either (Maybe a) (Maybe b) + data instance Bar (Maybe a) b = BarMaybe (Maybe a) (Maybe b) |] + ======> + type family Foo a b + type instance Foo (Maybe a) b = Either (Maybe a) (Maybe b) + data family Bar a b + data instance Bar (Maybe a) b = BarMaybe (Maybe a) (Maybe b) diff --git a/testsuite/tests/printer/all.T b/testsuite/tests/printer/all.T index e5fd00f..c939e49 100644 --- a/testsuite/tests/printer/all.T +++ b/testsuite/tests/printer/all.T @@ -48,3 +48,4 @@ 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']) +test('T13550', ignore_stderr, run_command, ['$MAKE -s --no-print-directory T13550']) From git at git.haskell.org Tue Apr 11 02:22:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 11 Apr 2017 02:22:02 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: [Elf/arm] Thumb indicator bit only for STT_FUNC (df58be5) Message-ID: <20170411022202.936F43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/df58be5bd0d974175ff24cbdc062368c94d9c6cb/ghc >--------------------------------------------------------------- commit df58be5bd0d974175ff24cbdc062368c94d9c6cb Author: Moritz Angermann Date: Mon Apr 10 21:39:19 2017 -0400 [Elf/arm] Thumb indicator bit only for STT_FUNC Reviewers: rwbarton, bgamari, austin, erikd, simonmar, trofi Reviewed By: trofi Subscribers: trofi, thomie Differential Revision: https://phabricator.haskell.org/D3438 (cherry picked from commit e662a6cb9fb6459e0a15abbff25ae7b80f91b281) >--------------------------------------------------------------- df58be5bd0d974175ff24cbdc062368c94d9c6cb rts/linker/Elf.c | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/rts/linker/Elf.c b/rts/linker/Elf.c index 66b8f71..086a323 100644 --- a/rts/linker/Elf.c +++ b/rts/linker/Elf.c @@ -992,15 +992,37 @@ do_Elf_Rel_relocations ( ObjectCode* oc, char* ehdrC, IF_DEBUG(linker,debugBelch( "`%s' resolves to %p\n", symbol, (void*)S )); #ifdef arm_HOST_ARCH - // Thumb instructions have bit 0 of symbol's st_value set - is_target_thm = S & 0x1; - - T = sym.st_info & STT_FUNC && is_target_thm; - - // Make sure we clear bit 0. Strictly speaking we should have done - // this to st_value above but I believe alignment requirements should - // ensure that no instructions start on an odd address - S &= ~1; + /* + * 4.5.3 Symbol Values + * + * In addition to the normal rules for symbol values the following + * rules shall also apply to symbols of type STT_FUNC: + * - If the symbol addresses an ARM instruction, its value is the + * address of the instruction (in a relocatable object, the + * offset of the instruction from the start of the section + * containing it). + * - If the symbol addresses a Thumb instruction, its value is the + * address of the instruction with bit zero set (in a relocatable + * object, the section offset with bit zero set). + * - For the purposes of relocation the value used shall be the + * address of the instruction (st_value & ~1). + * + * Note: This allows a linker to distinguish ARM and Thumb code + * symbols without having to refer to the map. An ARM symbol + * will always have an even value, while a Thumb symbol will + * always have an odd value. However, a linker should strip + * the discriminating bit from the value before using it for + * relocation. + * + * (source: ELF for the ARM Architecture + * ARM IHI 0044F, current through ABI release 2.10 + * 24th November 2015) + */ + if(ELF_ST_TYPE(sym.st_info) == STT_FUNC) { + is_target_thm = S & 0x1; + T = is_target_thm; + S &= ~1; + } #endif } From git at git.haskell.org Tue Apr 11 18:51:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 11 Apr 2017 18:51:17 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: testsuite: Bump up timeout multiplier on T11195 (dea307b) Message-ID: <20170411185117.F110B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/dea307b6e1a9495244dff36c8c3681d25c6f21b2/ghc >--------------------------------------------------------------- commit dea307b6e1a9495244dff36c8c3681d25c6f21b2 Author: Ben Gamari Date: Tue Apr 4 18:04:07 2017 -0400 testsuite: Bump up timeout multiplier on T11195 This has been failing a bit too often (on CI machines under load). (cherry picked from commit 932b469687e17b7694f930314267899a10935cbe) >--------------------------------------------------------------- dea307b6e1a9495244dff36c8c3681d25c6f21b2 testsuite/tests/pmcheck/should_compile/all.T | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/tests/pmcheck/should_compile/all.T b/testsuite/tests/pmcheck/should_compile/all.T index 8745358..a3c5e91 100644 --- a/testsuite/tests/pmcheck/should_compile/all.T +++ b/testsuite/tests/pmcheck/should_compile/all.T @@ -40,7 +40,7 @@ test('T11303', normal, compile, ['-fwarn-incomplete-patterns -fwarn-overlapping- test('T11276', compile_timeout_multiplier(0.01), compile, ['-fwarn-incomplete-patterns -fwarn-overlapping-patterns +RTS -M1G -RTS']) test('T11303b', compile_timeout_multiplier(0.01), compile, ['-fwarn-incomplete-patterns -fwarn-overlapping-patterns +RTS -M1G -RTS']) test('T11374', compile_timeout_multiplier(0.01), compile, ['-fwarn-incomplete-patterns -fwarn-overlapping-patterns +RTS -M1G -RTS']) -test('T11195', compile_timeout_multiplier(0.40), compile, ['-package ghc -fwarn-incomplete-patterns -fwarn-overlapping-patterns +RTS -M2G -RTS']) +test('T11195', compile_timeout_multiplier(0.50), compile, ['-package ghc -fwarn-incomplete-patterns -fwarn-overlapping-patterns +RTS -M2G -RTS']) # Other tests test('pmc001', [], compile, From git at git.haskell.org Wed Apr 12 10:44:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 12 Apr 2017 10:44:18 +0000 (UTC) Subject: [commit: ghc] master: Typos in comments [ci skip] (fc2a96a) Message-ID: <20170412104418.254973A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fc2a96a1ea9cceba596cbd652b44bd830a4191e4/ghc >--------------------------------------------------------------- commit fc2a96a1ea9cceba596cbd652b44bd830a4191e4 Author: Gabor Greif Date: Thu Apr 6 15:13:55 2017 +0200 Typos in comments [ci skip] >--------------------------------------------------------------- fc2a96a1ea9cceba596cbd652b44bd830a4191e4 compiler/codeGen/StgCmmMonad.hs | 4 ++-- compiler/deSugar/Check.hs | 2 +- compiler/deSugar/Match.hs | 2 +- compiler/main/HscMain.hs | 2 +- compiler/simplCore/CallArity.hs | 4 ++-- compiler/simplCore/Simplify.hs | 2 +- compiler/simplStg/StgCse.hs | 2 +- compiler/typecheck/TcExpr.hs | 2 +- compiler/typecheck/TcInteract.hs | 2 +- compiler/typecheck/TcRnTypes.hs | 12 ++++++------ compiler/typecheck/TcSigs.hs | 2 +- compiler/typecheck/TcSimplify.hs | 4 ++-- compiler/typecheck/TcValidity.hs | 2 +- ghc/GHCi/UI/Tags.hs | 4 ++-- testsuite/README.md | 2 +- testsuite/tests/gadt/T9380.hs | 2 +- testsuite/tests/partial-sigs/should_fail/PatBind3.hs | 2 +- testsuite/tests/pmcheck/complete_sigs/completesig10.hs | 2 +- testsuite/tests/simplStg/should_run/T13536.hs | 2 +- testsuite/tests/simplStg/should_run/T13536.stderr | 2 +- 20 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 fc2a96a1ea9cceba596cbd652b44bd830a4191e4 From git at git.haskell.org Wed Apr 12 15:16:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 12 Apr 2017 15:16:40 +0000 (UTC) Subject: [commit: ghc] master: Kill off complications in CoreFVs (751996e) Message-ID: <20170412151640.461BF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/751996e90a964026a3f86853338f10c82db6b610/ghc >--------------------------------------------------------------- commit 751996e90a964026a3f86853338f10c82db6b610 Author: Simon Peyton Jones Date: Fri Apr 7 17:10:07 2017 +0100 Kill off complications in CoreFVs When doing type-in-type, Richard introduce some substantial complications in CoreFVs, gathering types and free variables of type. In Trac #13160 we decided that this complication was unnecessary, so this patch removes it. Unfortnately I then fell down a twisty rabbit hole. Roughly: * An apparently-innocuous change in the AnnApp case of fiExpr made the fuction a little bit stricter, so we ended up peering into the arguments when we didn't before (namely when there are no bindings being floated inwards). I've rejigged it so that it's not fragile any more. * Peering into the arguments was sometimes expensive, becuase exprIsExpandable can be expensive because it looks deeply into the expression. * The combination of the two led to a non-linear explosion of work when the argument of a function is a deeep nest of constructors. This bug has been lurking for ages. I solved it by replacing exprIsExpandable with exprIsHNF + exprIsTrivial; see Note [noFloatInto considerations] * The code around floating case-expressions turned out to be very delicate, because can_fail primops (which we want to float inwards) can't be floated outwards; so we have to be careful never to float them too far. Note [Floating primops] has the details * I ended up refactoring some rather opaque code in sepBindsByDropPoint. Working all this out meant that I rewrote quite a bit of code, so it's now a reasonably substantial patch. But it's a net improvement. >--------------------------------------------------------------- 751996e90a964026a3f86853338f10c82db6b610 compiler/coreSyn/CoreFVs.hs | 105 +++--------- compiler/simplCore/FloatIn.hs | 369 ++++++++++++++++++++++++++---------------- 2 files changed, 255 insertions(+), 219 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 751996e90a964026a3f86853338f10c82db6b610 From git at git.haskell.org Wed Apr 12 15:16:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 12 Apr 2017 15:16:43 +0000 (UTC) Subject: [commit: ghc] master: Improve demand analysis for join points (b5b7d82) Message-ID: <20170412151643.C94B23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b5b7d820afd8fca098bf1f4a7380d425ca6be31d/ghc >--------------------------------------------------------------- commit b5b7d820afd8fca098bf1f4a7380d425ca6be31d Author: Simon Peyton Jones Date: Mon Apr 10 08:51:49 2017 +0100 Improve demand analysis for join points I realised (Trac #13543) that we can improve demand analysis for join point quite straightforwardly. The idea is explained in Note [Demand analysis for join points] in DmdAnal >--------------------------------------------------------------- b5b7d820afd8fca098bf1f4a7380d425ca6be31d compiler/stranal/DmdAnal.hs | 82 ++++++++++++++++------ testsuite/tests/simplCore/should_compile/T13543.hs | 17 +++++ .../should_compile/T13543.stderr} | 0 testsuite/tests/simplCore/should_compile/all.T | 1 + 4 files changed, 80 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 b5b7d820afd8fca098bf1f4a7380d425ca6be31d From git at git.haskell.org Wed Apr 12 15:16:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 12 Apr 2017 15:16:46 +0000 (UTC) Subject: [commit: ghc] master: Fix another literal-string buglet (8346334) Message-ID: <20170412151646.818253A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8346334ef5ef3999c124a904f6915f75260eca9a/ghc >--------------------------------------------------------------- commit 8346334ef5ef3999c124a904f6915f75260eca9a Author: Simon Peyton Jones Date: Tue Apr 11 15:34:12 2017 +0100 Fix another literal-string buglet We were failing to float a nested binding x :: Addr# = "foo"# to top level, even though we /were/ floating string literals themselves. A small oversight, easily fixed. >--------------------------------------------------------------- 8346334ef5ef3999c124a904f6915f75260eca9a compiler/simplCore/SetLevels.hs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/compiler/simplCore/SetLevels.hs b/compiler/simplCore/SetLevels.hs index 90e1d53..afca7ae 100644 --- a/compiler/simplCore/SetLevels.hs +++ b/compiler/simplCore/SetLevels.hs @@ -84,7 +84,7 @@ import Literal ( litIsTrivial ) import Demand ( StrictSig, isStrictDmd, splitStrictSig, increaseStrictSigArity ) import Name ( getOccName, mkSystemVarName ) import OccName ( occNameString ) -import Type ( isUnliftedType, Type, mkLamTypes, splitTyConApp_maybe ) +import Type ( Type, mkLamTypes, splitTyConApp_maybe ) import BasicTypes ( Arity, RecFlag(..), isRec ) import DataCon ( dataConOrigResTy ) import TysWiredIn @@ -1001,10 +1001,10 @@ lvlBind env (AnnNonRec bndr rhs) || isCoVar bndr -- Difficult to fix up CoVar occurrences (see extendPolyLvlEnv) -- so we will ignore this case for now || not (profitableFloat env dest_lvl) - || (isTopLvl dest_lvl && isUnliftedType (idType bndr)) - -- We can't float an unlifted binding to top level, so we don't - -- float it at all. It's a bit brutal, but unlifted bindings - -- aren't expensive either + || (isTopLvl dest_lvl && not (exprIsTopLevelBindable deann_rhs (idType bndr))) + -- We can't float an unlifted binding to top level (except + -- literal strings), so we don't float it at all. It's a + -- bit brutal, but unlifted bindings aren't expensive either = -- No float do { rhs' <- lvlRhs env NonRecursive is_bot mb_join_arity rhs @@ -1035,7 +1035,8 @@ lvlBind env (AnnNonRec bndr rhs) abs_vars = abstractVars dest_lvl env bind_fvs dest_lvl = destLevel env bind_fvs (isFunction rhs) is_bot is_join - mb_bot_str = exprBotStrictness_maybe (deAnnotate rhs) + deann_rhs = deAnnotate rhs + mb_bot_str = exprBotStrictness_maybe deann_rhs is_bot = isJust mb_bot_str -- NB: not isBottomThunk! See Note [Bottoming floats] point (3) From git at git.haskell.org Wed Apr 12 15:16:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 12 Apr 2017 15:16:49 +0000 (UTC) Subject: [commit: ghc] master: Add Outputable instance for ArityType (ebb36b2) Message-ID: <20170412151649.4A5913A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ebb36b2c903abf20a955ea4e81f168b1ddf1a452/ghc >--------------------------------------------------------------- commit ebb36b2c903abf20a955ea4e81f168b1ddf1a452 Author: Simon Peyton Jones Date: Tue Apr 11 15:36:30 2017 +0100 Add Outputable instance for ArityType >--------------------------------------------------------------- ebb36b2c903abf20a955ea4e81f168b1ddf1a452 compiler/coreSyn/CoreArity.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/compiler/coreSyn/CoreArity.hs b/compiler/coreSyn/CoreArity.hs index 88c3a7a..dd70772 100644 --- a/compiler/coreSyn/CoreArity.hs +++ b/compiler/coreSyn/CoreArity.hs @@ -484,6 +484,10 @@ data ArityType = ATop [OneShotInfo] | ABot Arity -- There is always an explicit lambda -- to justify the [OneShot], or the Arity +instance Outputable ArityType where + ppr (ATop os) = text "ATop" <> parens (ppr (length os)) + ppr (ABot n) = text "ABot" <> parens (ppr n) + vanillaArityType :: ArityType vanillaArityType = ATop [] -- Totally uninformative From git at git.haskell.org Wed Apr 12 15:16:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 12 Apr 2017 15:16:52 +0000 (UTC) Subject: [commit: ghc] master: Make let and app consistent in exprIsCheapX (8d8d094) Message-ID: <20170412151652.092AD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8d8d094d45fc638e3fac332fbce8138a1c06b9c3/ghc >--------------------------------------------------------------- commit 8d8d094d45fc638e3fac332fbce8138a1c06b9c3 Author: Simon Peyton Jones Date: Tue Apr 11 15:39:09 2017 +0100 Make let and app consistent in exprIsCheapX This fixes Trac #13558, by making App and Let behave consistently; see Note [Arguments and let-bindings exprIsCheapX] I renamed the mysterious exprIsOk to exprIsCheapX. (The "X" is because it is parameterised over a CheapAppFun.) >--------------------------------------------------------------- 8d8d094d45fc638e3fac332fbce8138a1c06b9c3 compiler/coreSyn/CoreArity.hs | 4 ++-- compiler/coreSyn/CoreUtils.hs | 48 +++++++++++++++++++++++++++---------------- 2 files changed, 32 insertions(+), 20 deletions(-) diff --git a/compiler/coreSyn/CoreArity.hs b/compiler/coreSyn/CoreArity.hs index dd70772..3cf4743 100644 --- a/compiler/coreSyn/CoreArity.hs +++ b/compiler/coreSyn/CoreArity.hs @@ -512,9 +512,9 @@ getBotArity _ = Nothing mk_cheap_fn :: DynFlags -> CheapAppFun -> CheapFun mk_cheap_fn dflags cheap_app | not (gopt Opt_DictsCheap dflags) - = \e _ -> exprIsOk cheap_app e + = \e _ -> exprIsCheapX cheap_app e | otherwise - = \e mb_ty -> exprIsOk cheap_app e + = \e mb_ty -> exprIsCheapX cheap_app e || case mb_ty of Nothing -> False Just ty -> isDictLikeTy ty diff --git a/compiler/coreSyn/CoreUtils.hs b/compiler/coreSyn/CoreUtils.hs index a319a7c..cc2d172 100644 --- a/compiler/coreSyn/CoreUtils.hs +++ b/compiler/coreSyn/CoreUtils.hs @@ -25,7 +25,7 @@ module CoreUtils ( exprType, coreAltType, coreAltsType, isExprLevPoly, exprIsDupable, exprIsTrivial, getIdFromTrivialExpr, exprIsBottom, getIdFromTrivialExpr_maybe, - exprIsCheap, exprIsExpandable, exprIsOk, CheapAppFun, + exprIsCheap, exprIsExpandable, exprIsCheapX, CheapAppFun, exprIsHNF, exprOkForSpeculation, exprOkForSideEffects, exprIsWorkFree, exprIsBig, exprIsConLike, rhsIsStatic, isCheapApp, isExpandableApp, @@ -1095,31 +1095,43 @@ duplicate the (a +# b) primop, which we should not do lightly. (It's quite hard to trigger this bug, but T13155 does so for GHC 8.0.) -Note [Arguments in exprIsOk] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -What predicate should we apply to the argument of an application? We -used to say "exprIsTrivial arg" due to concerns about duplicating -nested constructor applications, but see #4978. The principle here is +Note [Arguments and let-bindings exprIsCheapX] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +What predicate should we apply to the argument of an application, or the +RHS of a let-binding? + +We used to say "exprIsTrivial arg" due to concerns about duplicating +nested constructor applications, but see #4978. So now we just recursively +use exprIsCheapX. + +We definitely want to treat let and app the same. The principle here is that - let x = a +# b in c *# x + let x = blah in f x should behave equivalently to - c *# (a +# b) -Since lets with cheap RHSs are accepted, so should paps with cheap arguments + f blah + +This in turn means that the 'letrec g' does not prevent eta expansion +in this (which it previously was): + f = \x. let v = case x of + True -> letrec g = \w. blah + in g + False -> \x. x + in \w. v True -} -------------------- exprIsCheap :: CoreExpr -> Bool -exprIsCheap = exprIsOk isCheapApp +exprIsCheap = exprIsCheapX isCheapApp exprIsExpandable :: CoreExpr -> Bool -- See Note [exprIsExpandable] -exprIsExpandable = exprIsOk isExpandableApp +exprIsExpandable = exprIsCheapX isExpandableApp exprIsWorkFree :: CoreExpr -> Bool -- See Note [exprIsWorkFree] -exprIsWorkFree = exprIsOk isWorkFreeApp +exprIsWorkFree = exprIsCheapX isWorkFreeApp -------------------- -exprIsOk :: CheapAppFun -> CoreExpr -> Bool -exprIsOk ok_app e +exprIsCheapX :: CheapAppFun -> CoreExpr -> Bool +exprIsCheapX ok_app e = ok e where ok e = go 0 e @@ -1138,11 +1150,11 @@ exprIsOk ok_app e | otherwise = go n e go n (App f e) | isRuntimeArg e = go (n+1) f && ok e | otherwise = go n f - go _ (Let {}) = False + go n (Let (NonRec _ r) e) = go n e && ok r + go n (Let (Rec prs) e) = go n e && all (ok . snd) prs -- Case: see Note [Case expressions are work-free] - -- App: see Note [Arguments in exprIsOk] - -- Let: the old exprIsCheap worked through lets + -- App, Let: see Note [Arguments and let-bindings exprIsCheapX] ------------------------------------- @@ -1157,7 +1169,7 @@ type CheapAppFun = Id -> Arity -> Bool -- NB: isCheapApp and isExpandableApp are called from outside -- this module, so don't be tempted to move the notRedex - -- stuff into the call site in exprIsOk, and remove it + -- stuff into the call site in exprIsCheapX, and remove it -- from the CheapAppFun implementations From git at git.haskell.org Wed Apr 12 15:16:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 12 Apr 2017 15:16:54 +0000 (UTC) Subject: [commit: ghc] master: Use -G1 for reliable peak mem usage (2d96edd) Message-ID: <20170412151654.B63133A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2d96edd01d3a31ad719a5f12d226a049b7b2dbae/ghc >--------------------------------------------------------------- commit 2d96edd01d3a31ad719a5f12d226a049b7b2dbae Author: Simon Peyton Jones Date: Tue Apr 11 16:09:42 2017 +0100 Use -G1 for reliable peak mem usage >--------------------------------------------------------------- 2d96edd01d3a31ad719a5f12d226a049b7b2dbae testsuite/tests/perf/space_leaks/all.T | 1 + 1 file changed, 1 insertion(+) diff --git a/testsuite/tests/perf/space_leaks/all.T b/testsuite/tests/perf/space_leaks/all.T index 7c6f564..a23796d 100644 --- a/testsuite/tests/perf/space_leaks/all.T +++ b/testsuite/tests/perf/space_leaks/all.T @@ -52,6 +52,7 @@ test('T2762', # 2016-08-31: 3 (allocation area size bumped to 1MB) # 2017-02-22: 2 (refactor fiBind) only_ways(['normal']), + extra_run_opts('+RTS -G1 -RTS' ), extra_clean(['T2762A.hi', 'T2762A.o'])], compile_and_run, ['-O']) From git at git.haskell.org Wed Apr 12 18:53:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 12 Apr 2017 18:53:22 +0000 (UTC) Subject: [commit: ghc] master: Suggest correct replacement flag name for -dppr-ticks (2fc9c3e) Message-ID: <20170412185322.E596F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2fc9c3e3df06cac9bdc1f109065f66a45fd78a9e/ghc >--------------------------------------------------------------- commit 2fc9c3e3df06cac9bdc1f109065f66a45fd78a9e Author: Reid Barton Date: Wed Apr 12 14:10:39 2017 -0400 Suggest correct replacement flag name for -dppr-ticks It told me to use -fno-suppress-ticks, but it should have been -dno-suppress-ticks. Test Plan: tested -dppr-ticks and -frewrite-rules manually Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3430 >--------------------------------------------------------------- 2fc9c3e3df06cac9bdc1f109065f66a45fd78a9e compiler/main/DynFlags.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index a4095f1..07e9517 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -3520,9 +3520,9 @@ deprecatedForExtension lang turn_on flag | turn_on = lang | otherwise = "No" ++ lang -useInstead :: String -> TurnOnFlag -> String -useInstead flag turn_on - = "Use -f" ++ no ++ flag ++ " instead" +useInstead :: String -> String -> TurnOnFlag -> String +useInstead prefix flag turn_on + = "Use " ++ prefix ++ no ++ flag ++ " instead" where no = if turn_on then "" else "no-" @@ -3642,7 +3642,7 @@ dFlagsDeps = [ -- Please keep the list of flags below sorted alphabetically flagSpec "ppr-case-as-let" Opt_PprCaseAsLet, depFlagSpec' "ppr-ticks" Opt_PprShowTicks - (\turn_on -> useInstead "suppress-ticks" (not turn_on)), + (\turn_on -> useInstead "-d" "suppress-ticks" (not turn_on)), flagSpec "suppress-ticks" Opt_SuppressTicks, flagSpec "suppress-coercions" Opt_SuppressCoercions, flagSpec "suppress-idinfo" Opt_SuppressIdInfo, @@ -3734,7 +3734,7 @@ fFlagsDeps = [ flagSpec "regs-graph" Opt_RegsGraph, flagSpec "regs-iterative" Opt_RegsIterative, depFlagSpec' "rewrite-rules" Opt_EnableRewriteRules - (useInstead "enable-rewrite-rules"), + (useInstead "-f" "enable-rewrite-rules"), flagSpec "shared-implib" Opt_SharedImplib, flagSpec "spec-constr" Opt_SpecConstr, flagSpec "spec-constr-keen" Opt_SpecConstrKeen, From git at git.haskell.org Wed Apr 12 18:53:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 12 Apr 2017 18:53:25 +0000 (UTC) Subject: [commit: ghc] master: RnEnv cleanup (bb3712b) Message-ID: <20170412185325.AC7A23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/bb3712bf772fecb965f56a356ccf61437d324dcf/ghc >--------------------------------------------------------------- commit bb3712bf772fecb965f56a356ccf61437d324dcf Author: Matthew Pickering Date: Wed Apr 12 14:06:15 2017 -0400 RnEnv cleanup unless (not ..) -> when Remove unused getLookupOccRn Remove lookupGreRn2 It was only called in one place in a very strange way. It is easier to just use lookupGreRn which has nearly the same implementation and then directly call `unboundName`. Remove unused function mapFvRnCPS Remove unused functions bindLocatedLocalsRn and bindLocatedLocalsFV Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3435 >--------------------------------------------------------------- bb3712bf772fecb965f56a356ccf61437d324dcf compiler/rename/RnEnv.hs | 141 ++++++++++++++++++++++------------------------- 1 file changed, 66 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 bb3712bf772fecb965f56a356ccf61437d324dcf From git at git.haskell.org Wed Apr 12 18:53:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 12 Apr 2017 18:53:29 +0000 (UTC) Subject: [commit: ghc] master: Allow qualified names to be children in export lists (fa5a73f) Message-ID: <20170412185329.257C83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fa5a73f0a86908da31ec72ce33d37a7a704a0600/ghc >--------------------------------------------------------------- commit fa5a73f0a86908da31ec72ce33d37a7a704a0600 Author: Matthew Pickering Date: Wed Apr 12 14:10:54 2017 -0400 Allow qualified names to be children in export lists When doing this I noticed a horrible amount of duplication between lookupSubBndrOcc and lookupExportChild (which I am responsible for). I opened #13545 to keep track of this. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #13528 Differential Revision: https://phabricator.haskell.org/D3434 >--------------------------------------------------------------- fa5a73f0a86908da31ec72ce33d37a7a704a0600 compiler/typecheck/TcRnExports.hs | 2 +- testsuite/tests/module/T13528.hs | 13 +++++++++++++ testsuite/tests/module/all.T | 2 ++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/compiler/typecheck/TcRnExports.hs b/compiler/typecheck/TcRnExports.hs index 3c0b8d3..b3d9317 100644 --- a/compiler/typecheck/TcRnExports.hs +++ b/compiler/typecheck/TcRnExports.hs @@ -478,7 +478,7 @@ lookupExportChild parent rdr_name | otherwise = do gre_env <- getGlobalRdrEnv - let original_gres = lookupGRE_RdrName rdr_name gre_env + let original_gres = lookupGlobalRdrEnv gre_env (rdrNameOcc rdr_name) -- Disambiguate the lookup based on the parent information. -- The remaining GREs are things that we *could* export here, note that -- this includes things which have `NoParent`. Those are sorted in diff --git a/testsuite/tests/module/T13528.hs b/testsuite/tests/module/T13528.hs new file mode 100644 index 0000000..60363eb --- /dev/null +++ b/testsuite/tests/module/T13528.hs @@ -0,0 +1,13 @@ +{-# LANGUAGE NoImplicitPrelude #-} + +module T13528 ( + GHC.Exts.IsList( + Item + , fromList + , toList + ) + , Data.Bool.Bool(True, False) +) where + +import qualified GHC.Exts (IsList(..)) +import qualified Data.Bool (Bool(..)) diff --git a/testsuite/tests/module/all.T b/testsuite/tests/module/all.T index d7e6b74..6d05c77 100644 --- a/testsuite/tests/module/all.T +++ b/testsuite/tests/module/all.T @@ -282,3 +282,5 @@ test('T11970', normal, compile_fail, ['']) test('T11970A', [], multimod_compile, ['T11970A','-Wunused-imports']) test('T11970B', normal, compile_fail, ['']) test('MultiExport', normal, compile, ['']) +test('T13528', normal, compile, ['']) + From git at git.haskell.org Wed Apr 12 18:53:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 12 Apr 2017 18:53:32 +0000 (UTC) Subject: [commit: ghc] master: arc-linters: Add linting of #ifdef x and #if defined x (0ecd7fa) Message-ID: <20170412185332.1448F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0ecd7fae57cfe0849b5efcce1ec14df9bbd3292e/ghc >--------------------------------------------------------------- commit 0ecd7fae57cfe0849b5efcce1ec14df9bbd3292e Author: Ben Gamari Date: Wed Apr 12 14:10:01 2017 -0400 arc-linters: Add linting of #ifdef x and #if defined x Reviewers: austin, erikd Reviewed By: erikd Subscribers: rwbarton, thomie, erikd Differential Revision: https://phabricator.haskell.org/D3423 >--------------------------------------------------------------- 0ecd7fae57cfe0849b5efcce1ec14df9bbd3292e .arc-linters/check-cpp.py | 77 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 61 insertions(+), 16 deletions(-) diff --git a/.arc-linters/check-cpp.py b/.arc-linters/check-cpp.py index d81e58b..7115488 100755 --- a/.arc-linters/check-cpp.py +++ b/.arc-linters/check-cpp.py @@ -23,19 +23,64 @@ logger = logging.getLogger() #setup_logging(logger) logger.debug(sys.argv) -path = sys.argv[1] -warnings = [] -r = re.compile(br'ASSERT\s+\(') -if os.path.isfile(path): - with open(path, 'rb') as f: - for lineno, line in enumerate(f): - if r.search(line): - warning = { - 'severity': 'warning', - 'message': 'CPP macros should not have a space between the macro name and their argument list', - 'line': lineno+1, - } - warnings.append(warning) - -logger.debug(warnings) -print(json.dumps(warnings)) +def add_warning(severity, message, line): + entry = { + 'severity': severity, + 'message': message, + 'line': line + } + warnings.append(entry) + +class Linter(object): + def __init__(self): + self.warnings = [] + + def add_warning(self, **entry): + self.warnings.append(entry) + + def lint(self, path): + pass + +class LineLinter(Linter): + def lint(self, path): + if os.path.isfile(path): + with open(path, 'rb') as f: + for lineno, line in enumerate(f): + self.lint_line(lineno+1, line) + + def lint_line(self, lineno, line): + pass + +class RegexpLinter(LineLinter): + def __init__(self, regex, **warning): + LineLinter.__init__(self) + self.re = re.compile(regex) + self.warning = warning + + def lint_line(self, lineno, line): + if self.re.search(line): + warning = { + 'line': lineno, + } + warning.update(self.warning) + self.add_warning(**warning) + +linters = [ + RegexpLinter(br'ASSERT\s+\(', + message='CPP macros should not have a space between the macro name and their argument list'), + RegexpLinter(br'#ifdef\s+', + message='`#if defined(x)` is preferred to `#ifdef x`'), + RegexpLinter(br'#if\s+defined\s+', + message='`#if defined(x)` is preferred to `#if defined x`'), +] + +if __name__ == '__main__': + path = sys.argv[1] + for linter in linters: + linter.lint(path) + + warnings = [warning + for linter in linters + for warning in linter.warnings] + logger.debug(warnings) + print(json.dumps(warnings)) From git at git.haskell.org Wed Apr 12 18:53:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 12 Apr 2017 18:53:34 +0000 (UTC) Subject: [commit: ghc] master: Remove GhcDynamic (in favor of DYNAMIC_GHC_PROGRAMS) (2c1312b) Message-ID: <20170412185334.CADD63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2c1312bdf93e0c6fc64236c404f3664271f3b0f6/ghc >--------------------------------------------------------------- commit 2c1312bdf93e0c6fc64236c404f3664271f3b0f6 Author: Reid Barton Date: Wed Apr 12 14:10:12 2017 -0400 Remove GhcDynamic (in favor of DYNAMIC_GHC_PROGRAMS) DYNAMIC_GHC_PROGRAMS and GhcDynamic both tried to control whether the ghc binary was built as a dynamic executable, with confusing results. In particular, setting GhcDynamic=NO has no effect on systems where DYNAMIC_GHC_PROGRAMS defaults to YES. DYNAMIC_GHC_PROGRAMS is more fully-featured (it ensures that the correct flavor of the libraries is built, for example) so let's keep it and remove GhcDynamic to reduce confusion. This effectively reverts commit 3c6190b0. Test Plan: tested locally; harbormaster Reviewers: simonmar, austin, bgamari Reviewed By: bgamari Subscribers: thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3428 >--------------------------------------------------------------- 2c1312bdf93e0c6fc64236c404f3664271f3b0f6 ghc/ghc.mk | 5 ++--- mk/config.mk.in | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/ghc/ghc.mk b/ghc/ghc.mk index 8d4c1df..319f969 100644 --- a/ghc/ghc.mk +++ b/ghc/ghc.mk @@ -53,9 +53,8 @@ ghc_stage2_MORE_HC_OPTS += -debug ghc_stage3_MORE_HC_OPTS += -debug endif -ifeq "$(GhcDynamic)" "YES" -ghc_stage2_MORE_HC_OPTS += -dynamic -ghc_stage3_MORE_HC_OPTS += -dynamic +ifneq "$(GhcDynamic)" "" +$(error GhcDynamic is no longer supported, use DYNAMIC_GHC_PROGRAMS instead) endif ifeq "$(GhcThreaded)" "YES" diff --git a/mk/config.mk.in b/mk/config.mk.in index 5d1f94a..1f7353c 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -95,7 +95,6 @@ endif # The stage number refers to the compiler stage the options are passed to. GhcDebugged=NO -GhcDynamic=NO # GhcProfiled=YES means compile a profiled stage-2 compiler GhcProfiled=NO From git at git.haskell.org Wed Apr 12 18:53:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 12 Apr 2017 18:53:41 +0000 (UTC) Subject: [commit: ghc] master: [linker] Remove dead code (ELF_FUNCTION_DESC) (210b43f) Message-ID: <20170412185341.3142D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/210b43fe95e83bbe602c5cdac0e63823fc36ae40/ghc >--------------------------------------------------------------- commit 210b43fe95e83bbe602c5cdac0e63823fc36ae40 Author: Moritz Angermann Date: Wed Apr 12 14:11:41 2017 -0400 [linker] Remove dead code (ELF_FUNCTION_DESC) Reviewers: bgamari, austin, erikd, simonmar, rwbarton Reviewed By: bgamari, rwbarton Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3444 >--------------------------------------------------------------- 210b43fe95e83bbe602c5cdac0e63823fc36ae40 rts/linker/Elf.c | 107 ------------------------------------------------------- 1 file changed, 107 deletions(-) diff --git a/rts/linker/Elf.c b/rts/linker/Elf.c index 174fc47..36941b2 100644 --- a/rts/linker/Elf.c +++ b/rts/linker/Elf.c @@ -188,99 +188,6 @@ #endif -/* - * Functions to allocate entries in dynamic sections. Currently we simply - * preallocate a large number, and we don't check if a entry for the given - * target already exists (a linear search is too slow). Ideally these - * entries would be associated with symbols. - */ - -/* These sizes sufficient to load HSbase + HShaskell98 + a few modules */ -#define GOT_SIZE 0x20000 -#define FUNCTION_TABLE_SIZE 0x10000 -#define PLT_SIZE 0x08000 - -#ifdef ELF_NEED_GOT -static Elf_Addr got[GOT_SIZE]; -static unsigned int gotIndex; -static Elf_Addr gp_val = (Elf_Addr)got; - -static Elf_Addr -allocateGOTEntry(Elf_Addr target) -{ - Elf_Addr *entry; - - if (gotIndex >= GOT_SIZE) - barf("Global offset table overflow"); - - entry = &got[gotIndex++]; - *entry = target; - return (Elf_Addr)entry; -} -#endif - -#ifdef ELF_FUNCTION_DESC -typedef struct { - Elf_Addr ip; - Elf_Addr gp; -} FunctionDesc; - -static FunctionDesc functionTable[FUNCTION_TABLE_SIZE]; -static unsigned int functionTableIndex; - -static Elf_Addr -allocateFunctionDesc(Elf_Addr target) -{ - FunctionDesc *entry; - - if (functionTableIndex >= FUNCTION_TABLE_SIZE) - barf("Function table overflow"); - - entry = &functionTable[functionTableIndex++]; - entry->ip = target; - entry->gp = (Elf_Addr)gp_val; - return (Elf_Addr)entry; -} - -static Elf_Addr -copyFunctionDesc(Elf_Addr target) -{ - FunctionDesc *olddesc = (FunctionDesc *)target; - FunctionDesc *newdesc; - - newdesc = (FunctionDesc *)allocateFunctionDesc(olddesc->ip); - newdesc->gp = olddesc->gp; - return (Elf_Addr)newdesc; -} -#endif - -#ifdef ELF_NEED_PLT - -typedef struct { - unsigned char code[sizeof(plt_code)]; -} PLTEntry; - -static Elf_Addr -allocatePLTEntry(Elf_Addr target, ObjectCode *oc) -{ - PLTEntry *plt = (PLTEntry *)oc->plt; - PLTEntry *entry; - - if (oc->pltIndex >= PLT_SIZE) - barf("Procedure table overflow"); - - entry = &plt[oc->pltIndex++]; - memcpy(entry->code, plt_code, sizeof(entry->code)); - PLT_RELOC(entry->code, target); - return (Elf_Addr)entry; -} - -static unsigned int -PLTSize(void) -{ - return (PLT_SIZE * sizeof(PLTEntry)); -} -#endif /* @@ -1324,25 +1231,11 @@ do_Elf_Rela_relocations ( ObjectCode* oc, char* ehdrC, #endif S = (Elf_Addr)oc->sections[secno].start + stab[ELF_R_SYM(info)].st_value; -#ifdef ELF_FUNCTION_DESC - /* Make a function descriptor for this function */ - if (S && ELF_ST_TYPE(sym.st_info) == STT_FUNC) { - S = allocateFunctionDesc(S + A); - A = 0; - } -#endif } else { /* No, so look up the name in our global table. */ symbol = strtab + sym.st_name; S_tmp = lookupSymbol_( symbol ); S = (Elf_Addr)S_tmp; - -#ifdef ELF_FUNCTION_DESC - /* If a function, already a function descriptor - we would - have to copy it to add an offset. */ - if (S && (ELF_ST_TYPE(sym.st_info) == STT_FUNC) && (A != 0)) - errorBelch("%s: function %s with addend %p", oc->fileName, symbol, (void *)A); -#endif } if (!S) { errorBelch("%s: unknown symbol `%s'", oc->fileName, symbol); From git at git.haskell.org Wed Apr 12 18:53:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 12 Apr 2017 18:53:38 +0000 (UTC) Subject: [commit: ghc] master: base: Implement bit casts between word and float types (aa20634) Message-ID: <20170412185338.6C5263A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/aa206346e6f12c9f88fdf051185741761ea88fbb/ghc >--------------------------------------------------------------- commit aa206346e6f12c9f88fdf051185741761ea88fbb Author: Erik de Castro Lopo Date: Wed Apr 12 14:09:49 2017 -0400 base: Implement bit casts between word and float types Test Plan: Test on x86 and x86_64 Reviewers: duncan, trofi, simonmar, tibbe, hvr, austin, rwbarton, bgamari Reviewed By: duncan Subscribers: Phyx, DemiMarie, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3358 >--------------------------------------------------------------- aa206346e6f12c9f88fdf051185741761ea88fbb compiler/prelude/primops.txt.pp | 5 +- libraries/base/GHC/Float.hs | 91 ++++++++- libraries/base/cbits/CastFloatWord.cmm | 69 +++++++ testsuite/tests/codeGen/should_run/all.T | 2 + .../tests/codeGen/should_run/castFloatWord.hs | 28 +++ .../tests/codeGen/should_run/castFloatWord.stdout | 204 +++++++++++++++++++++ 6 files changed, 396 insertions(+), 3 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc aa206346e6f12c9f88fdf051185741761ea88fbb From git at git.haskell.org Wed Apr 12 18:53:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 12 Apr 2017 18:53:46 +0000 (UTC) Subject: [commit: ghc] master: Fix typo in ReadP (succeds -> succeeds) (8121748) Message-ID: <20170412185346.A59D43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8121748dd79d648342fca2704122197c406a18e9/ghc >--------------------------------------------------------------- commit 8121748dd79d648342fca2704122197c406a18e9 Author: Chris Martin Date: Wed Apr 12 14:12:05 2017 -0400 Fix typo in ReadP (succeds -> succeeds) Reviewers: austin, hvr, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3452 >--------------------------------------------------------------- 8121748dd79d648342fca2704122197c406a18e9 libraries/base/Text/ParserCombinators/ReadP.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/base/Text/ParserCombinators/ReadP.hs b/libraries/base/Text/ParserCombinators/ReadP.hs index cc68974..fd7c677 100644 --- a/libraries/base/Text/ParserCombinators/ReadP.hs +++ b/libraries/base/Text/ParserCombinators/ReadP.hs @@ -286,7 +286,7 @@ string this = do s <- look; scan this s munch :: (Char -> Bool) -> ReadP String -- ^ Parses the first zero or more characters satisfying the predicate. --- Always succeds, exactly once having consumed all the characters +-- Always succeeds, exactly once having consumed all the characters -- Hence NOT the same as (many (satisfy p)) munch p = do s <- look From git at git.haskell.org Wed Apr 12 18:53:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 12 Apr 2017 18:53:43 +0000 (UTC) Subject: [commit: ghc] master: Drop special handling of iOS (68c00a1) Message-ID: <20170412185343.E22F23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/68c00a1b38707b2a5c813cbe3da3ffb7d97893b6/ghc >--------------------------------------------------------------- commit 68c00a1b38707b2a5c813cbe3da3ffb7d97893b6 Author: Moritz Angermann Date: Wed Apr 12 14:12:33 2017 -0400 Drop special handling of iOS iOS at least since iOS8 (we are currently at iOS10.3), allows for dynamic libaries, hence any artificail restriction on dyanmic libraries should be lifted. Please ping me with any iOS related issues that should potentially resurface. The iOS toolchain has considerably changed over the years, and I'm willing to drop work arounds in good faith. Reviewers: bgamari, austin Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #13559, #7722 Differential Revision: https://phabricator.haskell.org/D3451 >--------------------------------------------------------------- 68c00a1b38707b2a5c813cbe3da3ffb7d97893b6 compiler/main/DriverPipeline.hs | 9 +-------- compiler/main/DynFlags.hs | 9 --------- compiler/main/SysTools.hs | 3 +-- compiler/utils/Platform.hs | 9 +-------- 4 files changed, 3 insertions(+), 27 deletions(-) diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index df1ffd5..8e21b09 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -378,7 +378,7 @@ link' dflags batch_attempt_linking hpt let staticLink = case ghcLink dflags of LinkStaticLib -> True - _ -> platformBinariesAreStaticLibs (targetPlatform dflags) + _ -> False home_mod_infos = eltsHpt hpt @@ -1953,13 +1953,6 @@ linkBinary' staticLink dflags o_files dep_packages = do then ["-Wl,-no_compact_unwind"] else []) - -- '-no_pie' - -- iOS uses 'dynamic-no-pic', so we must pass this to ld to suppress a warning; see #7722 - ++ (if platformOS platform == OSiOS && - not staticLink - then ["-Wl,-no_pie"] - else []) - -- '-Wl,-read_only_relocs,suppress' -- ld gives loads of warnings like: -- ld: warning: text reloc in _base_GHCziArr_unsafeArray_info to _base_GHCziArr_unsafeArray_closure diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 07e9517..70efc54 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -5176,15 +5176,6 @@ makeDynFlagsConsistent dflags = let dflags' = dflags { hscTarget = HscLlvm } warn = "No native code generator, so using LLVM" in loop dflags' warn - | hscTarget dflags == HscLlvm && - not ((arch == ArchX86_64) && (os == OSLinux || os == OSDarwin || os == OSFreeBSD)) && - not ((isARM arch) && (os == OSLinux)) && - (gopt Opt_PIC dflags || WayDyn `elem` ways dflags) - = if cGhcWithNativeCodeGen == "YES" - then let dflags' = dflags { hscTarget = HscAsm } - warn = "Using native code generator rather than LLVM, as LLVM is incompatible with -fPIC and -dynamic on this platform" - in loop dflags' warn - else throwGhcException $ CmdLineError "Can't use -fPIC or -dynamic on this platform" | os == OSDarwin && arch == ArchX86_64 && not (gopt Opt_PIC dflags) diff --git a/compiler/main/SysTools.hs b/compiler/main/SysTools.hs index fd3faf1..16f8d1a 100644 --- a/compiler/main/SysTools.hs +++ b/compiler/main/SysTools.hs @@ -1663,7 +1663,7 @@ linkDynLib dflags0 o_files dep_packages ++ pkg_lib_path_opts ++ pkg_link_opts )) - OSDarwin -> do + _ | os `elem` [OSDarwin, OSiOS] -> do ------------------------------------------------------------------- -- Making a darwin dylib ------------------------------------------------------------------- @@ -1723,7 +1723,6 @@ linkDynLib dflags0 o_files dep_packages ++ map Option pkg_link_opts ++ map Option pkg_framework_opts ) - OSiOS -> throwGhcExceptionIO (ProgramError "dynamic libraries are not supported on iOS target") _ -> do ------------------------------------------------------------------- -- Making a DSO diff --git a/compiler/utils/Platform.hs b/compiler/utils/Platform.hs index 86c70a9..7f74970 100644 --- a/compiler/utils/Platform.hs +++ b/compiler/utils/Platform.hs @@ -16,7 +16,6 @@ module Platform ( osMachOTarget, osSubsectionsViaSymbols, platformUsesFrameworks, - platformBinariesAreStaticLibs, ) where @@ -148,6 +147,7 @@ osElfTarget OSUnknown = False -- | This predicate tells us whether the OS support Mach-O shared libraries. osMachOTarget :: OS -> Bool osMachOTarget OSDarwin = True +osMachOTarget OSiOS = True osMachOTarget _ = False osUsesFrameworks :: OS -> Bool @@ -158,15 +158,8 @@ osUsesFrameworks _ = False platformUsesFrameworks :: Platform -> Bool platformUsesFrameworks = osUsesFrameworks . platformOS -osBinariesAreStaticLibs :: OS -> Bool -osBinariesAreStaticLibs OSiOS = True -osBinariesAreStaticLibs _ = False - osSubsectionsViaSymbols :: OS -> Bool osSubsectionsViaSymbols OSDarwin = True osSubsectionsViaSymbols OSiOS = True osSubsectionsViaSymbols _ = False -platformBinariesAreStaticLibs :: Platform -> Bool -platformBinariesAreStaticLibs = osBinariesAreStaticLibs . platformOS - From git at git.haskell.org Wed Apr 12 18:57:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 12 Apr 2017 18:57:23 +0000 (UTC) Subject: [commit: ghc] master: Split up RnEnv into 4 modules, RnUnbound, RnUtils and RnFixity (e07cd50) Message-ID: <20170412185723.E3A183A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e07cd507ff879a5afc382e1a28af0f5f17fa7ce6/ghc >--------------------------------------------------------------- commit e07cd507ff879a5afc382e1a28af0f5f17fa7ce6 Author: Matthew Pickering Date: Sat Apr 8 16:42:32 2017 +0100 Split up RnEnv into 4 modules, RnUnbound, RnUtils and RnFixity Summary: RnEnv contains functions which convertn RdrNames into Names. RnUnbound contains helper functions for reporting and creating unbound variables. RnFixity contains code which maintains the fixity environent whilst renaming. RnUtils contains the other stuff in RnEnv. Reviewers: austin, goldfire, bgamari Subscribers: goldfire, rwbarton, thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3436 >--------------------------------------------------------------- e07cd507ff879a5afc382e1a28af0f5f17fa7ce6 compiler/ghc.cabal.in | 3 + compiler/rename/RnBinds.hs | 4 + compiler/rename/RnEnv.hs | 937 +------------------------------------ compiler/rename/RnExpr.hs | 6 + compiler/rename/RnFixity.hs | 209 +++++++++ compiler/rename/RnNames.hs | 2 + compiler/rename/RnPat.hs | 5 + compiler/rename/RnSource.hs | 5 + compiler/rename/RnSplice.hs | 2 + compiler/rename/RnTypes.hs | 6 + compiler/rename/RnUnbound.hs | 340 ++++++++++++++ compiler/rename/RnUtils.hs | 410 ++++++++++++++++ compiler/typecheck/TcBackpack.hs | 2 +- compiler/typecheck/TcDeriv.hs | 1 + compiler/typecheck/TcErrors.hs | 2 +- compiler/typecheck/TcExpr.hs | 4 +- compiler/typecheck/TcRnDriver.hs | 2 + compiler/typecheck/TcRnExports.hs | 2 + compiler/typecheck/TcRnTypes.hs | 36 +- compiler/typecheck/TcSplice.hs | 2 + compiler/typecheck/TcTyClsDecls.hs | 3 +- compiler/typecheck/TcTyDecls.hs | 1 - 22 files changed, 1060 insertions(+), 924 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc e07cd507ff879a5afc382e1a28af0f5f17fa7ce6 From git at git.haskell.org Thu Apr 13 08:27:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 13 Apr 2017 08:27:10 +0000 (UTC) Subject: [commit: ghc] master: Yet more work on TcSimplify.simplifyInfer (0ae7251) Message-ID: <20170413082710.06E4E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0ae72512255ba66ef89bdfeea65a23ea6eb35124/ghc >--------------------------------------------------------------- commit 0ae72512255ba66ef89bdfeea65a23ea6eb35124 Author: Simon Peyton Jones Date: Wed Apr 12 15:09:37 2017 +0100 Yet more work on TcSimplify.simplifyInfer The proximate cause for this patch is Trac #13482, which pointed out further subtle interactions between - Inferring the most general type of a function - A partial type signature for that function That led me into /further/ changes to the shiny new stuff in TcSimplify.simplifyInfer, decideQuantification, decideMonoTyVars, and related functions. Happily, I was able to make some of it quite a bit simpler, notably the bit about promoting free tyvars. I'm happy with the result. Moreover I fixed Trac #13524 at the same time. Happy days. >--------------------------------------------------------------- 0ae72512255ba66ef89bdfeea65a23ea6eb35124 compiler/typecheck/TcBinds.hs | 30 ++- compiler/typecheck/TcRnTypes.hs | 4 +- compiler/typecheck/TcSimplify.hs | 272 +++++++++++---------- .../partial-sigs/should_compile/NamedTyVar.stderr | 2 +- .../tests/partial-sigs/should_compile/T13482.hs | 22 ++ .../partial-sigs/should_compile/T13482.stderr | 31 +++ testsuite/tests/partial-sigs/should_compile/all.T | 1 + testsuite/tests/typecheck/should_compile/all.T | 2 +- 8 files changed, 225 insertions(+), 139 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 0ae72512255ba66ef89bdfeea65a23ea6eb35124 From git at git.haskell.org Thu Apr 13 08:27:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 13 Apr 2017 08:27:12 +0000 (UTC) Subject: [commit: ghc] master: Fix a couple of user-manual typos (037c249) Message-ID: <20170413082712.C94D13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/037c2495d83bb7da7f15c8e076df2c575500d0fd/ghc >--------------------------------------------------------------- commit 037c2495d83bb7da7f15c8e076df2c575500d0fd Author: Simon Peyton Jones Date: Tue Apr 11 15:24:42 2017 +0100 Fix a couple of user-manual typos >--------------------------------------------------------------- 037c2495d83bb7da7f15c8e076df2c575500d0fd docs/users_guide/glasgow_exts.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index 9d1ca19..40e3f82 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -5241,7 +5241,7 @@ you can specify a default method that uses that generic implementation: :: We reuse the keyword ``default`` to signal that a signature applies to the default method only; when defining instances of the ``Enum`` class, the original type ``[a]`` of ``enum`` still applies. When giving an -empty instance, however, the default implementation ``map to genum`` is +empty instance, however, the default implementation ``(map to genum)`` is filled-in, and type-checked with the type ``(Generic a, GEnum (Rep a)) => [a]``. @@ -13970,7 +13970,7 @@ exposed to the user: :: class Serialize a where put :: a -> [Bin] - default put :: (Generic a, GSerialize (Rep a)) => a -> [Bit] + default put :: (Generic a, GSerialize (Rep a)) => a -> [Bin] put = gput . from Here we use a `default signature <#class-default-signatures>`__ to From git at git.haskell.org Thu Apr 13 08:27:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 13 Apr 2017 08:27:15 +0000 (UTC) Subject: [commit: ghc] master: Remove dead quantifyTyVars (fbb27d7) Message-ID: <20170413082715.985AB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fbb27d77b9c707008344f4c49fbb8d1015efb739/ghc >--------------------------------------------------------------- commit fbb27d77b9c707008344f4c49fbb8d1015efb739 Author: Simon Peyton Jones Date: Wed Apr 12 16:20:13 2017 +0100 Remove dead quantifyTyVars This patch * removes a function TcMType.quantifyTyVars that was never called * renames quantifyZonkedTyVars to quantifyTyVars Plus a few comments. No functional change at all >--------------------------------------------------------------- fbb27d77b9c707008344f4c49fbb8d1015efb739 compiler/typecheck/TcHsType.hs | 2 +- compiler/typecheck/TcMType.hs | 76 +++++++++++++++----------------------- compiler/typecheck/TcRules.hs | 2 +- compiler/typecheck/TcSimplify.hs | 6 +-- compiler/typecheck/TcTyClsDecls.hs | 24 +++++++++--- 5 files changed, 54 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 fbb27d77b9c707008344f4c49fbb8d1015efb739 From git at git.haskell.org Thu Apr 13 08:27:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 13 Apr 2017 08:27:18 +0000 (UTC) Subject: [commit: ghc] master: Comments only in Type.isPredTy (87078ef) Message-ID: <20170413082718.514FF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/87078efd7d517a69f6737b4c40a73c063684c5cf/ghc >--------------------------------------------------------------- commit 87078efd7d517a69f6737b4c40a73c063684c5cf Author: Simon Peyton Jones Date: Thu Apr 13 09:23:39 2017 +0100 Comments only in Type.isPredTy >--------------------------------------------------------------- 87078efd7d517a69f6737b4c40a73c063684c5cf compiler/types/Type.hs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/compiler/types/Type.hs b/compiler/types/Type.hs index 56fa938..0b01f1d 100644 --- a/compiler/types/Type.hs +++ b/compiler/types/Type.hs @@ -1662,6 +1662,7 @@ isPredTy ty = go ty [] -- -- 1. There is actually a kind error. Example in which this showed up: -- polykinds/T11399 + -- -- 2. A type constructor application appears to be oversaturated. An -- example of this occurred in GHC Trac #13187: -- @@ -1669,11 +1670,14 @@ isPredTy ty = go ty [] -- type Const a b = b -- f :: Const Int (,) Bool Char -> Char -- - -- This code is actually fine, since Const is polymorphic in its - -- return kind. It does show that isPredTy could possibly report a - -- false negative if a constraint is similarly oversaturated, but + -- We call isPredTy (Const k1 k2 Int (,) Bool Char + -- where k1,k2 are unification variables that have been + -- unified to *, and (*->*->*) resp, /but not zonked/. + -- This shows that isPredTy can report a false negative + -- if a constraint is similarly oversaturated, but -- it's hard to do better than isPredTy currently does without - -- zonking, so we punt on such cases for now. + -- zonking, so we punt on such cases for now. This only happens + -- during debug-printing, so it doesn't matter. isClassPred, isEqPred, isNomEqPred, isIPPred :: PredType -> Bool isClassPred ty = case tyConAppTyCon_maybe ty of From git at git.haskell.org Thu Apr 13 11:27:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 13 Apr 2017 11:27:15 +0000 (UTC) Subject: [commit: ghc] branch 'wip/mpickering/rn-env' created Message-ID: <20170413112715.32B993A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/mpickering/rn-env Referencing: 54e622b46f542ed3a2ecb262d1ef6af1023b31f3 From git at git.haskell.org Thu Apr 13 11:27:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 13 Apr 2017 11:27:20 +0000 (UTC) Subject: [commit: ghc] wip/mpickering/rn-env: Remove new name logic from renamer (54e622b) Message-ID: <20170413112720.A5C153A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/mpickering/rn-env Link : http://ghc.haskell.org/trac/ghc/changeset/54e622b46f542ed3a2ecb262d1ef6af1023b31f3/ghc >--------------------------------------------------------------- commit 54e622b46f542ed3a2ecb262d1ef6af1023b31f3 Author: Matthew Pickering Date: Thu Apr 13 12:26:23 2017 +0100 Remove new name logic from renamer >--------------------------------------------------------------- 54e622b46f542ed3a2ecb262d1ef6af1023b31f3 compiler/rename/RnEnv.hs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/compiler/rename/RnEnv.hs b/compiler/rename/RnEnv.hs index 5ca8050..8feea01 100644 --- a/compiler/rename/RnEnv.hs +++ b/compiler/rename/RnEnv.hs @@ -260,9 +260,7 @@ lookupTopBndrRn_maybe rdr_name -- This deals with the case of derived bindings, where -- we don't bother to call newTopSrcBinder first -- We assume there is no "parent" name - = do { loc <- getSrcSpanM - ; n <- newGlobalBinder rdr_mod rdr_occ loc - ; return (Just n)} + = do { Just <$> lookupOrig rdr_mod rdr_occ } -- MP: This looks dodgy, why not just make sure the calls are inserted.. From git at git.haskell.org Thu Apr 13 11:27:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 13 Apr 2017 11:27:17 +0000 (UTC) Subject: [commit: ghc] wip/mpickering/rn-env: Comments (a7bebaa) Message-ID: <20170413112717.EA7F23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/mpickering/rn-env Link : http://ghc.haskell.org/trac/ghc/changeset/a7bebaa50fe8f87e88d2ca5bb56caef1211e23e0/ghc >--------------------------------------------------------------- commit a7bebaa50fe8f87e88d2ca5bb56caef1211e23e0 Author: Matthew Pickering Date: Sat Apr 8 16:00:38 2017 +0100 Comments >--------------------------------------------------------------- a7bebaa50fe8f87e88d2ca5bb56caef1211e23e0 compiler/rename/RnEnv.hs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/compiler/rename/RnEnv.hs b/compiler/rename/RnEnv.hs index 3aa9472..5ca8050 100644 --- a/compiler/rename/RnEnv.hs +++ b/compiler/rename/RnEnv.hs @@ -223,6 +223,8 @@ OccName. We use OccName.isSymOcc to detect that case, which isn't terribly efficient, but there seems to be no better way. -} +-- Can be made to not be exposed +-- Only used unwrapped in rnAnnProvenance lookupTopBndrRn :: RdrName -> RnM Name lookupTopBndrRn n = do nopt <- lookupTopBndrRn_maybe n case nopt of @@ -262,6 +264,8 @@ lookupTopBndrRn_maybe rdr_name ; n <- newGlobalBinder rdr_mod rdr_occ loc ; return (Just n)} +-- MP: This looks dodgy, why not just make sure the calls are inserted.. + | otherwise = do { -- Check for operators in type or class declarations -- See Note [Type and class operator definitions] @@ -388,6 +392,8 @@ lookupInstDeclBndr cls what rdr where doc = what <+> text "of class" <+> quotes (ppr cls) +-- MP: This looks good enough + ----------------------------------------------- lookupFamInstName :: Maybe Name -> Located RdrName -> RnM (Located Name) @@ -445,6 +451,8 @@ lookupRecFieldOcc parent doc rdr_name Right n -> return n } | otherwise + -- This use of Global is right as we are looking up a selector which + -- can only be defined at the top level. = lookupGlobalOccRn rdr_name lookupSubBndrOcc :: Bool @@ -834,6 +842,8 @@ lookupGlobalOccRn_maybe rdr_name lookupGlobalOccRn :: RdrName -> RnM Name -- lookupGlobalOccRn is like lookupOccRn, except that it looks in the global -- environment. Adds an error message if the RdrName is not in scope. +-- You usually want to use "lookupOccRn" which also looks in the local +-- environment. lookupGlobalOccRn rdr_name = do { mb_name <- lookupGlobalOccRn_maybe rdr_name ; case mb_name of From git at git.haskell.org Thu Apr 13 16:24:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 13 Apr 2017 16:24:00 +0000 (UTC) Subject: [commit: ghc] master: Doc typo (1c6ce33) Message-ID: <20170413162400.864DB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1c6ce33d0a30d43c1e6276380900382cb57dee7d/ghc >--------------------------------------------------------------- commit 1c6ce33d0a30d43c1e6276380900382cb57dee7d Author: Alex Biehl Date: Wed Mar 22 10:25:24 2017 +0100 Doc typo >--------------------------------------------------------------- 1c6ce33d0a30d43c1e6276380900382cb57dee7d docs/users_guide/8.2.1-notes.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/users_guide/8.2.1-notes.rst b/docs/users_guide/8.2.1-notes.rst index 7d87ad3..37fdabb 100644 --- a/docs/users_guide/8.2.1-notes.rst +++ b/docs/users_guide/8.2.1-notes.rst @@ -112,7 +112,7 @@ Compiler directive on undefined identifiers. - GHC will no longer automatically infer the kind of higher-rank type synonyms; - you must explicitly explicitly annotate the synonym with a kind signature. + you must explicitly annotate the synonym with a kind signature. For example, given:: data T :: (forall k. k -> Type) -> Type From git at git.haskell.org Thu Apr 13 16:24:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 13 Apr 2017 16:24:03 +0000 (UTC) Subject: [commit: ghc] master: Fix typo in TcErrors.hs (13131ce) Message-ID: <20170413162403.440263A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/13131ce9165b4e5e5193dc381f6f3d021e53792f/ghc >--------------------------------------------------------------- commit 13131ce9165b4e5e5193dc381f6f3d021e53792f Author: Matthías Páll Gissurarson Date: Fri Mar 17 01:46:58 2017 +0100 Fix typo in TcErrors.hs This fixes a very simple typo in TcErrors.hs. I hope this is small enough in scope to be accepted through GitHub. >--------------------------------------------------------------- 13131ce9165b4e5e5193dc381f6f3d021e53792f compiler/typecheck/TcErrors.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/typecheck/TcErrors.hs b/compiler/typecheck/TcErrors.hs index adbf3b2..eacdbb6 100644 --- a/compiler/typecheck/TcErrors.hs +++ b/compiler/typecheck/TcErrors.hs @@ -430,7 +430,7 @@ they can give rise to improvement. Example (Trac #10100): instance Add Zero b b instance Add a b ab => Add (Succ a) b (Succ ab) The context (Add a b ab) for the instance is clearly unused in terms -of evidence, since the dictionary has no feilds. But it is still +of evidence, since the dictionary has no fields. But it is still needed! With the context, a wanted constraint Add (Succ Zero) beta (Succ Zero) we will reduce to (Add Zero beta Zero), and thence we get beta := Zero. From git at git.haskell.org Thu Apr 13 19:56:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 13 Apr 2017 19:56:47 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Typos in manual and comments (34fe61a) Message-ID: <20170413195647.E0A793A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/34fe61a805edec71926bb45180dec6aaa2817a46/ghc >--------------------------------------------------------------- commit 34fe61a805edec71926bb45180dec6aaa2817a46 Author: Gabor Greif Date: Tue Mar 14 12:38:50 2017 +0100 Typos in manual and comments (cherry picked from commit 50512c6b2bd878f0be5e1c7b85cadf22094aaa5a) >--------------------------------------------------------------- 34fe61a805edec71926bb45180dec6aaa2817a46 compiler/basicTypes/Demand.hs | 2 +- compiler/ghci/ByteCodeGen.hs | 2 +- compiler/nativeGen/RegAlloc/Graph/Stats.hs | 4 ++-- compiler/rename/RnPat.hs | 3 ++- compiler/simplCore/SimplEnv.hs | 2 +- compiler/typecheck/FunDeps.hs | 2 +- compiler/typecheck/TcBinds.hs | 12 ++++++------ compiler/typecheck/TcPat.hs | 2 +- compiler/typecheck/TcRules.hs | 2 +- compiler/typecheck/TcSigs.hs | 2 +- compiler/typecheck/TcTypeable.hs | 2 +- compiler/typecheck/TcValidity.hs | 2 +- compiler/types/TyCoRep.hs | 2 +- compiler/utils/GraphColor.hs | 2 +- compiler/utils/GraphOps.hs | 2 +- docs/rts/rts.tex | 2 +- libraries/ghc-compact/GHC/Compact.hs | 2 +- testsuite/tests/profiling/should_run/heapprof001.hs | 2 +- testsuite/tests/safeHaskell/overlapping/SH_Overlap3.hs | 2 +- 19 files changed, 26 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 34fe61a805edec71926bb45180dec6aaa2817a46 From git at git.haskell.org Thu Apr 13 19:56:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 13 Apr 2017 19:56:51 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: testsuite: Add test for #13524 (7c896c2) Message-ID: <20170413195651.0A6CD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/7c896c255cb850b9e63c3f7a151ef6a72432a854/ghc >--------------------------------------------------------------- commit 7c896c255cb850b9e63c3f7a151ef6a72432a854 Author: Ben Gamari Date: Tue Apr 4 20:47:20 2017 -0400 testsuite: Add test for #13524 Reviewers: austin Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3418 (cherry picked from commit 5b7f504f3c190375903b57a541338bc939ca2dae) >--------------------------------------------------------------- 7c896c255cb850b9e63c3f7a151ef6a72432a854 testsuite/tests/typecheck/should_compile/T13524.hs | 27 ++++++++++++++++++++++ testsuite/tests/typecheck/should_compile/all.T | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/typecheck/should_compile/T13524.hs b/testsuite/tests/typecheck/should_compile/T13524.hs new file mode 100644 index 0000000..0852468 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T13524.hs @@ -0,0 +1,27 @@ +{-# LANGUAGE PartialTypeSignatures #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeApplications #-} + +{-# OPTIONS_GHC -fno-warn-partial-type-signatures #-} + +type Empty a = () + +foo :: expr a -> expr a -> expr (Empty a) +foo = undefined + +newtype Expr a = SPT {run :: String} + +pt1 :: forall a ptexpr . ptexpr a -> ptexpr (Empty a) +pt1 a = foo a a + +pt2 :: forall a ptexpr . ptexpr a -> ptexpr _ +pt2 a = foo a a + +main :: IO () +main = do + -- This typechecks without any trouble. + putStrLn $ run $ pt1 @Int @Expr undefined + + -- This should also typecheck, but doesn't since GHC seems to mix up the + -- order of the type variables. + putStrLn $ run $ pt2 @Int @Expr undefined diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index 09335f0..3ddda1c 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -548,4 +548,4 @@ test('T13337', normal, compile, ['']) test('T13343', normal, compile, ['']) test('T13474', normal, compile, ['']) test('T13509', normal, compile, ['']) - +test('T13524', expect_broken(13524), compile, ['']) From git at git.haskell.org Thu Apr 13 19:56:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 13 Apr 2017 19:56:54 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Yet more work on TcSimplify.simplifyInfer (4db9fd7) Message-ID: <20170413195654.8CA793A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/4db9fd73cd452cf235117598ec13daae851e9cd7/ghc >--------------------------------------------------------------- commit 4db9fd73cd452cf235117598ec13daae851e9cd7 Author: Simon Peyton Jones Date: Wed Apr 12 15:09:37 2017 +0100 Yet more work on TcSimplify.simplifyInfer The proximate cause for this patch is Trac #13482, which pointed out further subtle interactions between - Inferring the most general type of a function - A partial type signature for that function That led me into /further/ changes to the shiny new stuff in TcSimplify.simplifyInfer, decideQuantification, decideMonoTyVars, and related functions. Happily, I was able to make some of it quite a bit simpler, notably the bit about promoting free tyvars. I'm happy with the result. Moreover I fixed Trac #13524 at the same time. Happy days. (cherry picked from commit 0ae72512255ba66ef89bdfeea65a23ea6eb35124) >--------------------------------------------------------------- 4db9fd73cd452cf235117598ec13daae851e9cd7 compiler/typecheck/TcBinds.hs | 30 ++- compiler/typecheck/TcRnTypes.hs | 4 +- compiler/typecheck/TcSimplify.hs | 272 +++++++++++---------- .../partial-sigs/should_compile/NamedTyVar.stderr | 2 +- .../tests/partial-sigs/should_compile/T13482.hs | 22 ++ .../partial-sigs/should_compile/T13482.stderr | 31 +++ testsuite/tests/partial-sigs/should_compile/all.T | 1 + testsuite/tests/typecheck/should_compile/all.T | 2 +- 8 files changed, 225 insertions(+), 139 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 4db9fd73cd452cf235117598ec13daae851e9cd7 From git at git.haskell.org Fri Apr 14 02:06:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 14 Apr 2017 02:06:24 +0000 (UTC) Subject: [commit: ghc] master: linters/cpp: Catch #ifndef (8a54a4f) Message-ID: <20170414020624.BE5EB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8a54a4ff5565a2130f5c122ce5368446bfb2f22e/ghc >--------------------------------------------------------------- commit 8a54a4ff5565a2130f5c122ce5368446bfb2f22e Author: Ben Gamari Date: Thu Apr 13 22:04:48 2017 -0400 linters/cpp: Catch #ifndef >--------------------------------------------------------------- 8a54a4ff5565a2130f5c122ce5368446bfb2f22e .arc-linters/check-cpp.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.arc-linters/check-cpp.py b/.arc-linters/check-cpp.py index 7115488..1bbcbbd 100755 --- a/.arc-linters/check-cpp.py +++ b/.arc-linters/check-cpp.py @@ -72,6 +72,8 @@ linters = [ message='`#if defined(x)` is preferred to `#ifdef x`'), RegexpLinter(br'#if\s+defined\s+', message='`#if defined(x)` is preferred to `#if defined x`'), + RegexpLinter(br'#ifndef\s+', + message='`#if !defined(x)` is preferred to `#ifndef x`'), ] if __name__ == '__main__': From git at git.haskell.org Sun Apr 16 01:30:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 16 Apr 2017 01:30:46 +0000 (UTC) Subject: [commit: ghc] master: linker/mach-o: Catch the case where there is no symCmd (6c05b27) Message-ID: <20170416013046.4F10C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6c05b27e5bafe9f232e7014f4760335f5e3ba591/ghc >--------------------------------------------------------------- commit 6c05b27e5bafe9f232e7014f4760335f5e3ba591 Author: Moritz Angermann Date: Sat Apr 15 21:30:10 2017 -0400 linker/mach-o: Catch the case where there is no symCmd We do check for symCmd, to set the info->nlist value, but forgot to do the same check for info->names. Thus when trying to extract stroff from symCmd, we hit a segfault. Reviewers: bgamari, adinapoli, austin, erikd, simonmar Reviewed By: bgamari, adinapoli Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3459 >--------------------------------------------------------------- 6c05b27e5bafe9f232e7014f4760335f5e3ba591 rts/Linker.c | 2 ++ rts/linker/MachO.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/rts/Linker.c b/rts/Linker.c index 7366904..b214e9c 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -1215,6 +1215,8 @@ mkOc( pathchar *path, char *image, int imageSize, IF_DEBUG(linker, debugBelch("mkOc: start\n")); oc = stgMallocBytes(sizeof(ObjectCode), "mkOc(oc)"); + oc->info = NULL; + # if defined(OBJFORMAT_ELF) oc->formatName = "ELF"; # elif defined(OBJFORMAT_PEi386) diff --git a/rts/linker/MachO.c b/rts/linker/MachO.c index 16b712a..e09d151 100644 --- a/rts/linker/MachO.c +++ b/rts/linker/MachO.c @@ -130,7 +130,9 @@ ocInit_MachO(ObjectCode * oc) oc->info->nlist = oc->info->symCmd == NULL ? NULL : (MachONList *)(oc->image + oc->info->symCmd->symoff); - oc->info->names = oc->image + oc->info->symCmd->stroff; + oc->info->names = oc->info->symCmd == NULL + ? NULL + : (oc->image + oc->info->symCmd->stroff); /* If we have symbols, allocate and fill the macho_symbols * This will make relocation easier. From git at git.haskell.org Sun Apr 16 10:15:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 16 Apr 2017 10:15:33 +0000 (UTC) Subject: [commit: ghc] master: rts/RtsUtils.c: drop stale comments (295f97f) Message-ID: <20170416101533.25FC33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/295f97f74dcfc22067b6550f3cbb361c982d5042/ghc >--------------------------------------------------------------- commit 295f97f74dcfc22067b6550f3cbb361c982d5042 Author: Sergei Trofimovich Date: Sun Apr 16 10:45:00 2017 +0100 rts/RtsUtils.c: drop stale comments Signed-off-by: Sergei Trofimovich >--------------------------------------------------------------- 295f97f74dcfc22067b6550f3cbb361c982d5042 rts/RtsUtils.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rts/RtsUtils.c b/rts/RtsUtils.c index 85f951a..695d5a1 100644 --- a/rts/RtsUtils.c +++ b/rts/RtsUtils.c @@ -76,7 +76,7 @@ stgMallocBytes (size_t n, char *msg) if (n == 0) return NULL; /* don't fflush(stdout); WORKAROUND bug in Linux glibc */ - rtsConfig.mallocFailHook((W_) n, msg); /*msg*/ + rtsConfig.mallocFailHook((W_) n, msg); stg_exit(EXIT_INTERNAL_ERROR); } IF_DEBUG(sanity, memset(space, 0xbb, n)); @@ -90,7 +90,7 @@ stgReallocBytes (void *p, size_t n, char *msg) if ((space = realloc(p, n)) == NULL) { /* don't fflush(stdout); WORKAROUND bug in Linux glibc */ - rtsConfig.mallocFailHook((W_) n, msg); /*msg*/ + rtsConfig.mallocFailHook((W_) n, msg); stg_exit(EXIT_INTERNAL_ERROR); } return space; @@ -103,7 +103,7 @@ stgCallocBytes (size_t n, size_t m, char *msg) if ((space = calloc(n, m)) == NULL) { /* don't fflush(stdout); WORKAROUND bug in Linux glibc */ - rtsConfig.mallocFailHook((W_) n*m, msg); /*msg*/ + rtsConfig.mallocFailHook((W_) n*m, msg); stg_exit(EXIT_INTERNAL_ERROR); } return space; From git at git.haskell.org Sun Apr 16 16:52:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 16 Apr 2017 16:52:00 +0000 (UTC) Subject: [commit: ghc] master: UNREG: remove dead code around -split-objs (5fd75d7) Message-ID: <20170416165200.CB0BF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5fd75d737decbca787a9d6d92785a6525001d5f2/ghc >--------------------------------------------------------------- commit 5fd75d737decbca787a9d6d92785a6525001d5f2 Author: Sergei Trofimovich Date: Sun Apr 16 17:20:54 2017 +0100 UNREG: remove dead code around -split-objs Signed-off-by: Sergei Trofimovich >--------------------------------------------------------------- 5fd75d737decbca787a9d6d92785a6525001d5f2 compiler/cmm/PprC.hs | 12 ++++-------- compiler/main/DriverPipeline.hs | 5 ----- includes/Stg.h | 14 -------------- 3 files changed, 4 insertions(+), 27 deletions(-) diff --git a/compiler/cmm/PprC.hs b/compiler/cmm/PprC.hs index aa21174..56de940 100644 --- a/compiler/cmm/PprC.hs +++ b/compiler/cmm/PprC.hs @@ -62,17 +62,13 @@ import Data.Array.ST -- -------------------------------------------------------------------------- -- Top level -pprCs :: DynFlags -> [RawCmmGroup] -> SDoc -pprCs dflags cmms - = pprCode CStyle (vcat $ map (\c -> split_marker $$ pprC c) cmms) - where - split_marker - | gopt Opt_SplitObjs dflags = text "__STG_SPLIT_MARKER" - | otherwise = empty +pprCs :: [RawCmmGroup] -> SDoc +pprCs cmms + = pprCode CStyle (vcat $ map pprC cmms) writeCs :: DynFlags -> Handle -> [RawCmmGroup] -> IO () writeCs dflags handle cmms - = printForC dflags handle (pprCs dflags cmms) + = printForC dflags handle (pprCs cmms) -- -------------------------------------------------------------------------- -- Now do some real work diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index 8e21b09..474fd8c 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -1148,10 +1148,6 @@ runPhase (RealPhase cc_phase) input_fn dflags (cmdlineFrameworkPaths ++ pkgFrameworkPaths) else return [] - let split_objs = gopt Opt_SplitObjs dflags - split_opt | hcc && split_objs = [ "-DUSE_SPLIT_MARKERS" ] - | otherwise = [ ] - let cc_opt | optLevel dflags >= 2 = [ "-O2" ] | optLevel dflags >= 1 = [ "-O" ] | otherwise = [] @@ -1230,7 +1226,6 @@ runPhase (RealPhase cc_phase) input_fn dflags ++ cc_opt ++ [ "-include", ghcVersionH ] ++ framework_paths - ++ split_opt ++ include_paths ++ pkg_extra_cc_opts )) diff --git a/includes/Stg.h b/includes/Stg.h index 939bed6..619984d 100644 --- a/includes/Stg.h +++ b/includes/Stg.h @@ -493,20 +493,6 @@ INLINE_HEADER StgInt64 PK_Int64(W_ p_src[]) #endif /* SIZEOF_HSWORD == 4 */ /* ----------------------------------------------------------------------------- - Split markers - -------------------------------------------------------------------------- */ - -#if defined(USE_SPLIT_MARKERS) -#if defined(LEADING_UNDERSCORE) -#define __STG_SPLIT_MARKER __asm__("\n___stg_split_marker:"); -#else -#define __STG_SPLIT_MARKER __asm__("\n__stg_split_marker:"); -#endif -#else -#define __STG_SPLIT_MARKER /* nothing */ -#endif - -/* ----------------------------------------------------------------------------- Integer multiply with overflow -------------------------------------------------------------------------- */ From git at git.haskell.org Sun Apr 16 17:26:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 16 Apr 2017 17:26:25 +0000 (UTC) Subject: [commit: ghc] master: UNREG: fix spelling of '-split-objs' in warning (29ef714) Message-ID: <20170416172625.5EC1B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/29ef71412af48e1bbf7739d1dbc4c4feb3b9a86a/ghc >--------------------------------------------------------------- commit 29ef71412af48e1bbf7739d1dbc4c4feb3b9a86a Author: Sergei Trofimovich Date: Sun Apr 16 17:56:35 2017 +0100 UNREG: fix spelling of '-split-objs' in warning Spelling if warning message slightly mismathed passed commandline: $ ghc-stage2 -split-objs -C N.hs on the commandline: warning: ignoring -fsplit-objs Signed-off-by: Sergei Trofimovich >--------------------------------------------------------------- 29ef71412af48e1bbf7739d1dbc4c4feb3b9a86a compiler/main/DynFlags.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 70efc54..020ee50 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -2702,7 +2702,7 @@ dynamic_flags_deps = [ , make_ord_flag defGhcFlag "split-objs" (NoArg (if can_split then setGeneralFlag Opt_SplitObjs - else addWarn "ignoring -fsplit-objs")) + else addWarn "ignoring -split-objs")) , make_ord_flag defGhcFlag "split-sections" (noArgM (\dflags -> do From git at git.haskell.org Mon Apr 17 12:57:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 12:57:05 +0000 (UTC) Subject: [commit: ghc] master: hs_add_root() RTS API removal (a92ff5d) Message-ID: <20170417125705.EEC993A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a92ff5d66182d992d02dfaad4c446ad074582368/ghc >--------------------------------------------------------------- commit a92ff5d66182d992d02dfaad4c446ad074582368 Author: Sergei Trofimovich Date: Mon Apr 17 12:56:20 2017 +0100 hs_add_root() RTS API removal Before ghc-7.2 hs_add_root() had to be used to initialize haskell modules when haskell was called from FFI. commit a52ff7619e8b7d74a9d933d922eeea49f580bca8 ("Change the way module initialisation is done (#3252, #4417)") removed needs for hs_add_root() and made function a no-op. For backward compatibility '__stginit_' symbol was not removed. This change removes no-op hs_add_root() function and unused '__stginit_' symbol from each haskell module. Signed-off-by: Sergei Trofimovich Test Plan: ./validate Reviewers: simonmar, austin, bgamari, erikd Reviewed By: simonmar Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3460 >--------------------------------------------------------------- a92ff5d66182d992d02dfaad4c446ad074582368 compiler/cmm/CLabel.hs | 19 ------------ compiler/codeGen/StgCmm.hs | 37 ----------------------- docs/users_guide/8.4.1-notes.rst | 3 ++ includes/HsFFI.h | 1 - includes/stg/MiscClosures.h | 3 -- rts/RtsStartup.c | 11 ------- rts/RtsSymbols.c | 1 - rts/StgStartup.cmm | 22 -------------- testsuite/tests/concurrent/should_run/conc059_c.c | 3 -- testsuite/tests/dynlibs/T3807-export.c | 3 -- 10 files changed, 3 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 a92ff5d66182d992d02dfaad4c446ad074582368 From git at git.haskell.org Mon Apr 17 12:57:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 12:57:11 +0000 (UTC) Subject: [commit: ghc] master: aclocal.m4: respect user's --with-ar= choice (79848f1) Message-ID: <20170417125711.B84433A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/79848f18805ad8eba48c9897c5d53afbd17ab44d/ghc >--------------------------------------------------------------- commit 79848f18805ad8eba48c9897c5d53afbd17ab44d Author: Sergei Trofimovich Date: Mon Apr 17 09:41:49 2017 +0100 aclocal.m4: respect user's --with-ar= choice 'FP_PROG_AR' macro has a minor bug: it ignores already existing value stored in '$fp_prog_ar'. I've noticed it when tried to built UNREG ghc using thin LTO: $ ./configure --enable-unregisterised \ --with-nm=gcc-nm \ --with-ar=gcc-ar \ --with-ranlib=gcc-ranlib \ ./configure refused to use 'gcc-ar' (LTO-aware variant of 'ar') and kept using 'ar'. '$fp_prog_ar' is initialized (in a complex manner) in 'configure.ac' as: FP_ARG_WITH_PATH_GNU_PROG([AR], [ar], [ar]) ArCmd="$AR" fp_prog_ar="$AR" AC_SUBST([ArCmd]) The change keeps that value. Signed-off-by: Sergei Trofimovich >--------------------------------------------------------------- 79848f18805ad8eba48c9897c5d53afbd17ab44d aclocal.m4 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/aclocal.m4 b/aclocal.m4 index 2062b0d..ed26a89 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1130,7 +1130,9 @@ AC_SUBST([LdHasFilelist]) # ---------- # Sets fp_prog_ar to a path to ar. Exits if no ar can be found AC_DEFUN([FP_PROG_AR], -[AC_PATH_PROG([fp_prog_ar], [ar]) +[if test -z "$fp_prog_ar"; then + AC_PATH_PROG([fp_prog_ar], [ar]) +fi if test -z "$fp_prog_ar"; then AC_MSG_ERROR([cannot find ar in your PATH, no idea how to make a library]) fi From git at git.haskell.org Mon Apr 17 12:57:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 12:57:09 +0000 (UTC) Subject: [commit: ghc] master: configure.ac: print resolved 'ar' and 'ranlib' tools (1ca188c) Message-ID: <20170417125709.0668F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1ca188c74e70661419499e78be5b0a4998c85dea/ghc >--------------------------------------------------------------- commit 1ca188c74e70661419499e78be5b0a4998c85dea Author: Sergei Trofimovich Date: Mon Apr 17 09:40:17 2017 +0100 configure.ac: print resolved 'ar' and 'ranlib' tools Signed-off-by: Sergei Trofimovich >--------------------------------------------------------------- 1ca188c74e70661419499e78be5b0a4998c85dea configure.ac | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure.ac b/configure.ac index dd107e5..83e692f 100644 --- a/configure.ac +++ b/configure.ac @@ -1237,9 +1237,11 @@ echo "\ Unregisterised : $Unregisterised hs-cpp : $HaskellCPPCmd hs-cpp-flags : $HaskellCPPArgs + ar : $ArCmd ld : $LdCmd nm : $NmCmd objdump : $ObjdumpCmd + ranlib : $RanlibCmd Happy : $HappyCmd ($HappyVersion) Alex : $AlexCmd ($AlexVersion) Perl : $PerlCmd From git at git.haskell.org Mon Apr 17 21:26:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:26:47 +0000 (UTC) Subject: [commit: packages/Win32] branch 'fix-appveyor-curl-ussue' created Message-ID: <20170417212647.2DCB33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 New branch : fix-appveyor-curl-ussue Referencing: 44be2dd09dc2a6432f3e6956b95561f7a5b90320 From git at git.haskell.org Mon Apr 17 21:26:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:26:49 +0000 (UTC) Subject: [commit: packages/Win32] branch 'add-readme-and-changelog' created Message-ID: <20170417212649.2DD043A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 New branch : add-readme-and-changelog Referencing: d287bda6db8f4dbd5985fefc715ecf48263b2c5f From git at git.haskell.org Mon Apr 17 21:26:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:26:51 +0000 (UTC) Subject: [commit: packages/Win32] branch 'Mistuke-fix-build' created Message-ID: <20170417212651.2F0053A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 New branch : Mistuke-fix-build Referencing: f64f61548f5f36dfbb9d9bbb18f528a7aab395ec From git at git.haskell.org Mon Apr 17 21:26:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:26:53 +0000 (UTC) Subject: [commit: packages/Win32] branch 'issue-8-add-getUserName' created Message-ID: <20170417212653.2FF343A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 New branch : issue-8-add-getUserName Referencing: ab7a817d1837342ef140654b32257f51312d1710 From git at git.haskell.org Mon Apr 17 21:26:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:26:55 +0000 (UTC) Subject: [commit: packages/Win32] branch 'win32-prepare-release-2.4.0.0' created Message-ID: <20170417212655.306893A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 New branch : win32-prepare-release-2.4.0.0 Referencing: 3a7eff2d5ac5f91fc471152dd0397dc1cb583f6c From git at git.haskell.org Mon Apr 17 21:26:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:26:59 +0000 (UTC) Subject: [commit: packages/Win32] branch 'depend-os-windows' created Message-ID: <20170417212659.323D33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 New branch : depend-os-windows Referencing: 01de99fd3324914dfd5df9900b0ee9e9e1727679 From git at git.haskell.org Mon Apr 17 21:26:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:26:57 +0000 (UTC) Subject: [commit: packages/Win32] branch 'remove-hg-files' created Message-ID: <20170417212657.3213E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 New branch : remove-hg-files Referencing: 2af093f1e99c5a850fdd98ed159a94635539c7a2 From git at git.haskell.org Mon Apr 17 21:27:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:27:03 +0000 (UTC) Subject: [commit: packages/Win32] tag 'v2.5.3.0' created Message-ID: <20170417212703.340003A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 New tag : v2.5.3.0 Referencing: 7338abf2fee20490e4b6453afb37a1155be3b67d From git at git.haskell.org Mon Apr 17 21:27:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:27:01 +0000 (UTC) Subject: [commit: packages/Win32] branch 'win32-2.5.4.1-ghc-8.2' created Message-ID: <20170417212701.32E193A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 New branch : win32-2.5.4.1-ghc-8.2 Referencing: 147a0af92ac74ec58b209e16aeb1cf03bddf9482 From git at git.haskell.org Mon Apr 17 21:27:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:27:05 +0000 (UTC) Subject: [commit: packages/Win32] Mistuke-fix-build, depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2, win32-prepare-release-2.4.0.0: Add FILE_ATTRIBUTE_REPARSE_POINT (61ea800) Message-ID: <20170417212705.3B45D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: Mistuke-fix-build,depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2,win32-prepare-release-2.4.0.0 Link : http://git.haskell.org/packages/Win32.git/commitdiff/61ea80036c21aafa971ec094f0a93a9ae2a8dd3a >--------------------------------------------------------------- commit 61ea80036c21aafa971ec094f0a93a9ae2a8dd3a Author: Phil Ruffwind Date: Sat May 2 04:30:42 2015 -0400 Add FILE_ATTRIBUTE_REPARSE_POINT >--------------------------------------------------------------- 61ea80036c21aafa971ec094f0a93a9ae2a8dd3a System/Win32/File.hsc | 1 + 1 file changed, 1 insertion(+) diff --git a/System/Win32/File.hsc b/System/Win32/File.hsc index 54d243b..8c03488 100644 --- a/System/Win32/File.hsc +++ b/System/Win32/File.hsc @@ -104,6 +104,7 @@ type FileAttributeOrFlag = UINT , fILE_ATTRIBUTE_NORMAL = FILE_ATTRIBUTE_NORMAL , fILE_ATTRIBUTE_TEMPORARY = FILE_ATTRIBUTE_TEMPORARY , fILE_ATTRIBUTE_COMPRESSED = FILE_ATTRIBUTE_COMPRESSED + , fILE_ATTRIBUTE_REPARSE_POINT = FILE_ATTRIBUTE_REPARSE_POINT , fILE_FLAG_WRITE_THROUGH = FILE_FLAG_WRITE_THROUGH , fILE_FLAG_OVERLAPPED = FILE_FLAG_OVERLAPPED , fILE_FLAG_NO_BUFFERING = FILE_FLAG_NO_BUFFERING From git at git.haskell.org Mon Apr 17 21:27:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:27:09 +0000 (UTC) Subject: [commit: packages/Win32] Mistuke-fix-build, depend-os-windows, fix-appveyor-curl-ussue, issue-8-add-getUserName, master, win32-2.5.4.1-ghc-8.2, win32-prepare-release-2.4.0.0: Issue-8: Added getUserName (b53e40a) Message-ID: <20170417212709.479153A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: Mistuke-fix-build,depend-os-windows,fix-appveyor-curl-ussue,issue-8-add-getUserName,master,win32-2.5.4.1-ghc-8.2,win32-prepare-release-2.4.0.0 Link : http://git.haskell.org/packages/Win32.git/commitdiff/b53e40ae3dcd1147e4fafaf40f2e4db6f2d24961 >--------------------------------------------------------------- commit b53e40ae3dcd1147e4fafaf40f2e4db6f2d24961 Author: Tamar Christina Date: Sat May 14 21:00:17 2016 +0200 Issue-8: Added getUserName >--------------------------------------------------------------- b53e40ae3dcd1147e4fafaf40f2e4db6f2d24961 System/Win32/Info.hsc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/System/Win32/Info.hsc b/System/Win32/Info.hsc index 81da6b2..3d725dd 100644 --- a/System/Win32/Info.hsc +++ b/System/Win32/Info.hsc @@ -21,12 +21,13 @@ module System.Win32.Info where import Control.Exception (catch) import Foreign.Marshal.Alloc (alloca) +import Foreign.Marshal.Utils (with) import Foreign.Marshal.Array (allocaArray) import Foreign.Ptr (Ptr, nullPtr) import Foreign.Storable (Storable(..)) import System.IO.Error (isDoesNotExistError) -import System.Win32.Types (DWORD, LPCTSTR, LPTSTR, LPVOID, UINT, WORD) -import System.Win32.Types (failIfZero, peekTStringLen, withTString) +import System.Win32.Types (DWORD, LPDWORD, LPCTSTR, LPTSTR, LPVOID, UINT, WORD) +import System.Win32.Types (failIfZero, failIfFalse_, peekTStringLen, withTString) #if !MIN_VERSION_base(4,6,0) import Prelude hiding (catch) @@ -352,6 +353,17 @@ type SMSetting = UINT -- %fun GetUserName :: IO String +foreign import WINDOWS_CCONV unsafe "windows.h GetUserNameW" + c_GetUserName :: LPTSTR -> LPDWORD -> IO Bool + +getUserName :: IO String +getUserName = + allocaArray 512 $ \ c_str -> + with 512 $ \ c_len -> do + failIfFalse_ "GetUserName" $ c_GetUserName c_str c_len + len <- peek c_len + peekTStringLen (c_str, fromIntegral len - 1) + ---------------------------------------------------------------- -- Version Info ---------------------------------------------------------------- From git at git.haskell.org Mon Apr 17 21:27:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:27:07 +0000 (UTC) Subject: [commit: packages/Win32] Mistuke-fix-build, add-readme-and-changelog, depend-os-windows, fix-appveyor-curl-ussue, issue-8-add-getUserName, master, win32-2.5.4.1-ghc-8.2, win32-prepare-release-2.4.0.0: Win32: Added README and changelog (d287bda) Message-ID: <20170417212707.425163A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: Mistuke-fix-build,add-readme-and-changelog,depend-os-windows,fix-appveyor-curl-ussue,issue-8-add-getUserName,master,win32-2.5.4.1-ghc-8.2,win32-prepare-release-2.4.0.0 Link : http://git.haskell.org/packages/Win32.git/commitdiff/d287bda6db8f4dbd5985fefc715ecf48263b2c5f >--------------------------------------------------------------- commit d287bda6db8f4dbd5985fefc715ecf48263b2c5f Author: Tamar Christina Date: Sat May 14 21:05:43 2016 +0200 Win32: Added README and changelog >--------------------------------------------------------------- d287bda6db8f4dbd5985fefc715ecf48263b2c5f README.md | 12 ++++++++++++ changelog.md | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/README.md b/README.md new file mode 100644 index 0000000..02710c8 --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +The `Win32` Package [![Hackage](https://img.shields.io/hackage/v/Win32.svg)](https://hackage.haskell.org/package/Win32) ) +===================== + +See [`Win32` on Hackage](http://hackage.haskell.org/package/Win32) for +more information. + +Installing from Git +------------------- + +This package requires no special installation instructions. + +To install use `cabal install` diff --git a/changelog.md b/changelog.md new file mode 100644 index 0000000..099c6ac --- /dev/null +++ b/changelog.md @@ -0,0 +1,5 @@ +# Changelog for [`Win32` package](http://hackage.haskell.org/package/Win32) + +## 2.3.1.1 *May 2016* + +* Release for GHC 8.0.1 From git at git.haskell.org Mon Apr 17 21:27:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:27:11 +0000 (UTC) Subject: [commit: packages/Win32] Mistuke-fix-build, depend-os-windows, fix-appveyor-curl-ussue, issue-8-add-getUserName, master, win32-2.5.4.1-ghc-8.2, win32-prepare-release-2.4.0.0: Issue-8: Updated changelog (ab7a817) Message-ID: <20170417212711.4CCB63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: Mistuke-fix-build,depend-os-windows,fix-appveyor-curl-ussue,issue-8-add-getUserName,master,win32-2.5.4.1-ghc-8.2,win32-prepare-release-2.4.0.0 Link : http://git.haskell.org/packages/Win32.git/commitdiff/ab7a817d1837342ef140654b32257f51312d1710 >--------------------------------------------------------------- commit ab7a817d1837342ef140654b32257f51312d1710 Author: Tamar Christina Date: Sat May 14 21:07:17 2016 +0200 Issue-8: Updated changelog >--------------------------------------------------------------- ab7a817d1837342ef140654b32257f51312d1710 changelog.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/changelog.md b/changelog.md index 099c6ac..c8c27a7 100644 --- a/changelog.md +++ b/changelog.md @@ -3,3 +3,7 @@ ## 2.3.1.1 *May 2016* * Release for GHC 8.0.1 + +## GIT HEAD (Unknown version) + +* Added function `getUserName` \ No newline at end of file From git at git.haskell.org Mon Apr 17 21:27:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:27:13 +0000 (UTC) Subject: [commit: packages/Win32] Mistuke-fix-build, depend-os-windows, fix-appveyor-curl-ussue, master, remove-hg-files, win32-2.5.4.1-ghc-8.2, win32-prepare-release-2.4.0.0: Win32: Removed mercurial file (2af093f) Message-ID: <20170417212713.5263E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: Mistuke-fix-build,depend-os-windows,fix-appveyor-curl-ussue,master,remove-hg-files,win32-2.5.4.1-ghc-8.2,win32-prepare-release-2.4.0.0 Link : http://git.haskell.org/packages/Win32.git/commitdiff/2af093f1e99c5a850fdd98ed159a94635539c7a2 >--------------------------------------------------------------- commit 2af093f1e99c5a850fdd98ed159a94635539c7a2 Author: Tamar Christina Date: Sat May 14 21:09:23 2016 +0200 Win32: Removed mercurial file >--------------------------------------------------------------- 2af093f1e99c5a850fdd98ed159a94635539c7a2 .hgignore | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.hgignore b/.hgignore deleted file mode 100644 index 4f96a31..0000000 --- a/.hgignore +++ /dev/null @@ -1,8 +0,0 @@ -^(?:dist|tests/benchmarks/dist|tests/tests/dist)$ -^tests/benchmarks/.*\.txt$ -^tests/text-testdata.tar.bz2$ -^tests/(?:\.hpc|bm|qc|qc-hpc|stdio-hpc|text/test)$ -\.(?:aux|eventlog|h[ip]|log|[oa]|orig|prof|ps|rej|swp)$ -~$ -syntax: glob -.\#* From git at git.haskell.org Mon Apr 17 21:27:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:27:15 +0000 (UTC) Subject: [commit: packages/Win32] Mistuke-fix-build, depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2, win32-prepare-release-2.4.0.0: Merge pull request #47 from haskell/add-readme-and-changelog (fb605a5) Message-ID: <20170417212715.59DFD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: Mistuke-fix-build,depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2,win32-prepare-release-2.4.0.0 Link : http://git.haskell.org/packages/Win32.git/commitdiff/fb605a58536af639ca21ef5382e721da1de04795 >--------------------------------------------------------------- commit fb605a58536af639ca21ef5382e721da1de04795 Merge: bb9469e d287bda Author: Tamar Christina Date: Sat May 14 21:10:59 2016 +0200 Merge pull request #47 from haskell/add-readme-and-changelog Win32: Added README and changelog >--------------------------------------------------------------- fb605a58536af639ca21ef5382e721da1de04795 README.md | 12 ++++++++++++ changelog.md | 5 +++++ 2 files changed, 17 insertions(+) From git at git.haskell.org Mon Apr 17 21:27:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:27:17 +0000 (UTC) Subject: [commit: packages/Win32] Mistuke-fix-build, depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2, win32-prepare-release-2.4.0.0: Merge pull request #46 from haskell/remove-hg-files (b5a6fad) Message-ID: <20170417212717.6175C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: Mistuke-fix-build,depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2,win32-prepare-release-2.4.0.0 Link : http://git.haskell.org/packages/Win32.git/commitdiff/b5a6fad60428d45f0713b67fb1660ddedbf07e75 >--------------------------------------------------------------- commit b5a6fad60428d45f0713b67fb1660ddedbf07e75 Merge: fb605a5 2af093f Author: Tamar Christina Date: Sat May 14 21:11:11 2016 +0200 Merge pull request #46 from haskell/remove-hg-files Win32: Removed mercurial file >--------------------------------------------------------------- b5a6fad60428d45f0713b67fb1660ddedbf07e75 .hgignore | 8 -------- 1 file changed, 8 deletions(-) From git at git.haskell.org Mon Apr 17 21:27:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:27:19 +0000 (UTC) Subject: [commit: packages/Win32] Mistuke-fix-build, depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2, win32-prepare-release-2.4.0.0: Merge pull request #48 from haskell/issue-8-add-getUserName (d9fa393) Message-ID: <20170417212719.674B33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: Mistuke-fix-build,depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2,win32-prepare-release-2.4.0.0 Link : http://git.haskell.org/packages/Win32.git/commitdiff/d9fa393b97b69a2c0c18695364eee252bda7eb3a >--------------------------------------------------------------- commit d9fa393b97b69a2c0c18695364eee252bda7eb3a Merge: b5a6fad ab7a817 Author: Tamar Christina Date: Sat May 14 21:12:17 2016 +0200 Merge pull request #48 from haskell/issue-8-add-getUserName Add `getUserName` >--------------------------------------------------------------- d9fa393b97b69a2c0c18695364eee252bda7eb3a System/Win32/Info.hsc | 16 ++++++++++++++-- changelog.md | 4 ++++ 2 files changed, 18 insertions(+), 2 deletions(-) From git at git.haskell.org Mon Apr 17 21:27:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:27:21 +0000 (UTC) Subject: [commit: packages/Win32] Mistuke-fix-build, depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2, win32-prepare-release-2.4.0.0: Merge pull request #36 from Rufflewind/master (8b10cc5) Message-ID: <20170417212721.6EC253A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: Mistuke-fix-build,depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2,win32-prepare-release-2.4.0.0 Link : http://git.haskell.org/packages/Win32.git/commitdiff/8b10cc515b2817372427a6121432412fc4fdcb40 >--------------------------------------------------------------- commit 8b10cc515b2817372427a6121432412fc4fdcb40 Merge: d9fa393 61ea800 Author: Tamar Christina Date: Sat May 14 21:17:09 2016 +0200 Merge pull request #36 from Rufflewind/master Add FILE_ATTRIBUTE_REPARSE_POINT >--------------------------------------------------------------- 8b10cc515b2817372427a6121432412fc4fdcb40 System/Win32/File.hsc | 1 + 1 file changed, 1 insertion(+) From git at git.haskell.org Mon Apr 17 21:27:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:27:23 +0000 (UTC) Subject: [commit: packages/Win32] Mistuke-fix-build, depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2, win32-prepare-release-2.4.0.0: Win32: Updated Readme after merging pull request 36 (ebbd850) Message-ID: <20170417212723.74BD43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: Mistuke-fix-build,depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2,win32-prepare-release-2.4.0.0 Link : http://git.haskell.org/packages/Win32.git/commitdiff/ebbd8505124c991136e52d84b928f3f1b0c5a247 >--------------------------------------------------------------- commit ebbd8505124c991136e52d84b928f3f1b0c5a247 Author: Tamar Christina Date: Sat May 14 21:18:28 2016 +0200 Win32: Updated Readme after merging pull request 36 >--------------------------------------------------------------- ebbd8505124c991136e52d84b928f3f1b0c5a247 changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.md b/changelog.md index c8c27a7..fd55c6c 100644 --- a/changelog.md +++ b/changelog.md @@ -7,3 +7,4 @@ ## GIT HEAD (Unknown version) * Added function `getUserName` +* Added file attribute `fILE_ATTRIBUTE_REPARSE_POINT` \ No newline at end of file From git at git.haskell.org Mon Apr 17 21:27:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:27:25 +0000 (UTC) Subject: [commit: packages/Win32] Mistuke-fix-build, depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2, win32-prepare-release-2.4.0.0: Merge pull request #49 from Mistuke/update-readme-after-merging-36 (49c55ce) Message-ID: <20170417212725.7AA5F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: Mistuke-fix-build,depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2,win32-prepare-release-2.4.0.0 Link : http://git.haskell.org/packages/Win32.git/commitdiff/49c55ce6a389dd29642976feabeeba2b4319981f >--------------------------------------------------------------- commit 49c55ce6a389dd29642976feabeeba2b4319981f Merge: 8b10cc5 ebbd850 Author: Tamar Christina Date: Sat May 14 21:19:35 2016 +0200 Merge pull request #49 from Mistuke/update-readme-after-merging-36 Win32: Updated Readme after merging pull request 36 >--------------------------------------------------------------- 49c55ce6a389dd29642976feabeeba2b4319981f changelog.md | 1 + 1 file changed, 1 insertion(+) From git at git.haskell.org Mon Apr 17 21:27:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:27:27 +0000 (UTC) Subject: [commit: packages/Win32] Mistuke-fix-build, depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2, win32-prepare-release-2.4.0.0: Win32: Updated readme documentation (7afacde) Message-ID: <20170417212727.7FEE53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: Mistuke-fix-build,depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2,win32-prepare-release-2.4.0.0 Link : http://git.haskell.org/packages/Win32.git/commitdiff/7afacde508f4e223f80fdff33c0aa130e041fd4f >--------------------------------------------------------------- commit 7afacde508f4e223f80fdff33c0aa130e041fd4f Author: Tamar Christina Date: Sat May 14 22:14:29 2016 +0200 Win32: Updated readme documentation >--------------------------------------------------------------- 7afacde508f4e223f80fdff33c0aa130e041fd4f README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 02710c8..d4a0286 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -The `Win32` Package [![Hackage](https://img.shields.io/hackage/v/Win32.svg)](https://hackage.haskell.org/package/Win32) ) +The `Win32` Package [![Hackage](https://img.shields.io/hackage/v/Win32.svg)](https://hackage.haskell.org/package/Win32) ===================== See [`Win32` on Hackage](http://hackage.haskell.org/package/Win32) for @@ -10,3 +10,10 @@ Installing from Git This package requires no special installation instructions. To install use `cabal install` + +Documentation +------------------- +This library is just a direct binding to Windows API calls and +as such contains no documentation. The documentation for functions +can be find in the equivalently named function in MSDN +https://msdn.microsoft.com/library/windows/desktop/hh920508.aspx From git at git.haskell.org Mon Apr 17 21:27:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:27:29 +0000 (UTC) Subject: [commit: packages/Win32] Mistuke-fix-build, depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2, win32-prepare-release-2.4.0.0: Win32: Added file access rights (84b9663) Message-ID: <20170417212729.859883A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: Mistuke-fix-build,depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2,win32-prepare-release-2.4.0.0 Link : http://git.haskell.org/packages/Win32.git/commitdiff/84b96632627f758f8af96c340a161b138dae9cde >--------------------------------------------------------------- commit 84b96632627f758f8af96c340a161b138dae9cde Author: Tamar Christina Date: Thu Jun 16 13:13:15 2016 +0200 Win32: Added file access rights >--------------------------------------------------------------- 84b96632627f758f8af96c340a161b138dae9cde System/Win32/File.hsc | 49 ++++++++++++++++++++++++++++++++----------------- changelog.md | 1 + 2 files changed, 33 insertions(+), 17 deletions(-) diff --git a/System/Win32/File.hsc b/System/Win32/File.hsc index 7b13a01..48f728a 100644 --- a/System/Win32/File.hsc +++ b/System/Win32/File.hsc @@ -47,23 +47,38 @@ gENERIC_NONE :: AccessMode gENERIC_NONE = 0 #{enum AccessMode, - , gENERIC_READ = GENERIC_READ - , gENERIC_WRITE = GENERIC_WRITE - , gENERIC_EXECUTE = GENERIC_EXECUTE - , gENERIC_ALL = GENERIC_ALL - , dELETE = DELETE - , rEAD_CONTROL = READ_CONTROL - , wRITE_DAC = WRITE_DAC - , wRITE_OWNER = WRITE_OWNER - , sYNCHRONIZE = SYNCHRONIZE - , sTANDARD_RIGHTS_REQUIRED = STANDARD_RIGHTS_REQUIRED - , sTANDARD_RIGHTS_READ = STANDARD_RIGHTS_READ - , sTANDARD_RIGHTS_WRITE = STANDARD_RIGHTS_WRITE - , sTANDARD_RIGHTS_EXECUTE = STANDARD_RIGHTS_EXECUTE - , sTANDARD_RIGHTS_ALL = STANDARD_RIGHTS_ALL - , sPECIFIC_RIGHTS_ALL = SPECIFIC_RIGHTS_ALL - , aCCESS_SYSTEM_SECURITY = ACCESS_SYSTEM_SECURITY - , mAXIMUM_ALLOWED = MAXIMUM_ALLOWED + , gENERIC_READ = GENERIC_READ + , gENERIC_WRITE = GENERIC_WRITE + , gENERIC_EXECUTE = GENERIC_EXECUTE + , gENERIC_ALL = GENERIC_ALL + , dELETE = DELETE + , rEAD_CONTROL = READ_CONTROL + , wRITE_DAC = WRITE_DAC + , wRITE_OWNER = WRITE_OWNER + , sYNCHRONIZE = SYNCHRONIZE + , sTANDARD_RIGHTS_REQUIRED = STANDARD_RIGHTS_REQUIRED + , sTANDARD_RIGHTS_READ = STANDARD_RIGHTS_READ + , sTANDARD_RIGHTS_WRITE = STANDARD_RIGHTS_WRITE + , sTANDARD_RIGHTS_EXECUTE = STANDARD_RIGHTS_EXECUTE + , sTANDARD_RIGHTS_ALL = STANDARD_RIGHTS_ALL + , sPECIFIC_RIGHTS_ALL = SPECIFIC_RIGHTS_ALL + , aCCESS_SYSTEM_SECURITY = ACCESS_SYSTEM_SECURITY + , mAXIMUM_ALLOWED = MAXIMUM_ALLOWED + , fILE_ADD_FILE = FILE_ADD_FILE + , fILE_ADD_SUBDIRECTORY = FILE_ADD_SUBDIRECTORY + , fILE_ALL_ACCESS = FILE_ALL_ACCESS + , fILE_APPEND_DATA = FILE_APPEND_DATA + , fILE_CREATE_PIPE_INSTANCE = FILE_CREATE_PIPE_INSTANCE + , fILE_DELETE_CHILD = FILE_DELETE_CHILD + , fILE_EXECUTE = FILE_EXECUTE + , fILE_LIST_DIRECTORY = FILE_LIST_DIRECTORY + , fILE_READ_ATTRIBUTES = FILE_READ_ATTRIBUTES + , fILE_READ_DATA = FILE_READ_DATA + , fILE_READ_EA = FILE_READ_EA + , fILE_TRAVERSE = FILE_TRAVERSE + , fILE_WRITE_ATTRIBUTES = FILE_WRITE_ATTRIBUTES + , fILE_WRITE_DATA = FILE_WRITE_DATA + , fILE_WRITE_EA = FILE_WRITE_EA } ---------------------------------------------------------------- diff --git a/changelog.md b/changelog.md index fd55c6c..438539e 100644 --- a/changelog.md +++ b/changelog.md @@ -8,3 +8,4 @@ * Added function `getUserName` * Added file attribute `fILE_ATTRIBUTE_REPARSE_POINT` +* Added more [`File Access Rights` constants](https://msdn.microsoft.com/en-us/library/windows/desktop/gg258116%28v=vs.85%29.aspx) \ No newline at end of file From git at git.haskell.org Mon Apr 17 21:27:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:27:31 +0000 (UTC) Subject: [commit: packages/Win32] Mistuke-fix-build, depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2, win32-prepare-release-2.4.0.0: Merge pull request #50 from Mistuke/win32-add-file-access-rights (bf19ad4) Message-ID: <20170417212731.8B1573A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: Mistuke-fix-build,depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2,win32-prepare-release-2.4.0.0 Link : http://git.haskell.org/packages/Win32.git/commitdiff/bf19ad46d8370a691a86e5f6a90d6ca8bfbcc158 >--------------------------------------------------------------- commit bf19ad46d8370a691a86e5f6a90d6ca8bfbcc158 Merge: 7afacde 84b9663 Author: Tamar Christina Date: Sat Jun 18 10:10:43 2016 +0200 Merge pull request #50 from Mistuke/win32-add-file-access-rights Add more file access rights >--------------------------------------------------------------- bf19ad46d8370a691a86e5f6a90d6ca8bfbcc158 System/Win32/File.hsc | 49 ++++++++++++++++++++++++++++++++----------------- changelog.md | 1 + 2 files changed, 33 insertions(+), 17 deletions(-) From git at git.haskell.org Mon Apr 17 21:27:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:27:33 +0000 (UTC) Subject: [commit: packages/Win32] Mistuke-fix-build, depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2, win32-prepare-release-2.4.0.0: Adds getLongPathName binding (07d2c09) Message-ID: <20170417212733.908BE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: Mistuke-fix-build,depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2,win32-prepare-release-2.4.0.0 Link : http://git.haskell.org/packages/Win32.git/commitdiff/07d2c0947e4f99e9a60bbb11820bdbc8234efda1 >--------------------------------------------------------------- commit 07d2c0947e4f99e9a60bbb11820bdbc8234efda1 Author: Nick Partridge Date: Wed Jul 20 11:29:57 2016 +1000 Adds getLongPathName binding >--------------------------------------------------------------- 07d2c0947e4f99e9a60bbb11820bdbc8234efda1 System/Win32/Info.hsc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/System/Win32/Info.hsc b/System/Win32/Info.hsc index 3d725dd..536744f 100644 --- a/System/Win32/Info.hsc +++ b/System/Win32/Info.hsc @@ -119,6 +119,12 @@ getFullPathName name = do try "getFullPathName" (\buf len -> c_GetFullPathName c_name len buf nullPtr) 512 +getLongPathName :: FilePath -> IO FilePath +getLongPathName name = do + withTString name $ \ c_name -> + try "getLongPathName" + (c_GetLongPathName c_name) 512 + searchPath :: Maybe String -> FilePath -> String -> IO (Maybe FilePath) searchPath path filename ext = maybe ($ nullPtr) withTString path $ \p_path -> @@ -161,6 +167,9 @@ foreign import WINDOWS_CCONV unsafe "GetTempPathW" foreign import WINDOWS_CCONV unsafe "GetFullPathNameW" c_GetFullPathName :: LPCTSTR -> DWORD -> LPTSTR -> Ptr LPTSTR -> IO DWORD +foreign import WINDOWS_CCONV unsafe "GetLongPathNameW" + c_GetLongPathName :: LPCTSTR -> LPTSTR -> DWORD -> IO DWORD + foreign import WINDOWS_CCONV unsafe "SearchPathW" c_SearchPath :: LPCTSTR -> LPCTSTR -> LPCTSTR -> DWORD -> LPTSTR -> Ptr LPTSTR -> IO DWORD From git at git.haskell.org Mon Apr 17 21:27:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:27:35 +0000 (UTC) Subject: [commit: packages/Win32] Mistuke-fix-build, depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2, win32-prepare-release-2.4.0.0: Adds getShortPathName binding (1813e24) Message-ID: <20170417212735.96D2B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: Mistuke-fix-build,depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2,win32-prepare-release-2.4.0.0 Link : http://git.haskell.org/packages/Win32.git/commitdiff/1813e24a54c545363c63d95e414ba464c7a31bd4 >--------------------------------------------------------------- commit 1813e24a54c545363c63d95e414ba464c7a31bd4 Author: Nick Partridge Date: Wed Jul 20 11:30:09 2016 +1000 Adds getShortPathName binding >--------------------------------------------------------------- 1813e24a54c545363c63d95e414ba464c7a31bd4 System/Win32/Info.hsc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/System/Win32/Info.hsc b/System/Win32/Info.hsc index 536744f..f9df863 100644 --- a/System/Win32/Info.hsc +++ b/System/Win32/Info.hsc @@ -125,6 +125,12 @@ getLongPathName name = do try "getLongPathName" (c_GetLongPathName c_name) 512 +getShortPathName :: FilePath -> IO FilePath +getShortPathName name = do + withTString name $ \ c_name -> + try "getShortPathName" + (c_GetShortPathName c_name) 512 + searchPath :: Maybe String -> FilePath -> String -> IO (Maybe FilePath) searchPath path filename ext = maybe ($ nullPtr) withTString path $ \p_path -> @@ -170,6 +176,9 @@ foreign import WINDOWS_CCONV unsafe "GetFullPathNameW" foreign import WINDOWS_CCONV unsafe "GetLongPathNameW" c_GetLongPathName :: LPCTSTR -> LPTSTR -> DWORD -> IO DWORD +foreign import WINDOWS_CCONV unsafe "GetShortPathNameW" + c_GetShortPathName :: LPCTSTR -> LPTSTR -> DWORD -> IO DWORD + foreign import WINDOWS_CCONV unsafe "SearchPathW" c_SearchPath :: LPCTSTR -> LPCTSTR -> LPCTSTR -> DWORD -> LPTSTR -> Ptr LPTSTR -> IO DWORD From git at git.haskell.org Mon Apr 17 21:27:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:27:37 +0000 (UTC) Subject: [commit: packages/Win32] Mistuke-fix-build, depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2, win32-prepare-release-2.4.0.0: updated changelog (de743fd) Message-ID: <20170417212737.9C9223A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: Mistuke-fix-build,depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2,win32-prepare-release-2.4.0.0 Link : http://git.haskell.org/packages/Win32.git/commitdiff/de743fdcdb8cc36dd853d1d2028fcbeb7daf4c91 >--------------------------------------------------------------- commit de743fdcdb8cc36dd853d1d2028fcbeb7daf4c91 Author: Nick Partridge Date: Thu Jul 28 14:13:38 2016 +1000 updated changelog >--------------------------------------------------------------- de743fdcdb8cc36dd853d1d2028fcbeb7daf4c91 changelog.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/changelog.md b/changelog.md index 438539e..f8f6df1 100644 --- a/changelog.md +++ b/changelog.md @@ -6,6 +6,8 @@ ## GIT HEAD (Unknown version) +* Added function `getLongPathName` +* Added function `getShortPathName` * Added function `getUserName` * Added file attribute `fILE_ATTRIBUTE_REPARSE_POINT` * Added more [`File Access Rights` constants](https://msdn.microsoft.com/en-us/library/windows/desktop/gg258116%28v=vs.85%29.aspx) From git at git.haskell.org Mon Apr 17 21:27:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:27:39 +0000 (UTC) Subject: [commit: packages/Win32] Mistuke-fix-build, depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2, win32-prepare-release-2.4.0.0: Merge pull request #52 from nkpart/nkpart/GetLongPathName (ef34680) Message-ID: <20170417212739.A258D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: Mistuke-fix-build,depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2,win32-prepare-release-2.4.0.0 Link : http://git.haskell.org/packages/Win32.git/commitdiff/ef346800b3ba17f148b289eb622bca77c6e04ae1 >--------------------------------------------------------------- commit ef346800b3ba17f148b289eb622bca77c6e04ae1 Merge: bf19ad4 de743fd Author: Tamar Christina Date: Thu Jul 28 18:56:43 2016 +0100 Merge pull request #52 from nkpart/nkpart/GetLongPathName Adds Long/Short path name conversion bindings >--------------------------------------------------------------- ef346800b3ba17f148b289eb622bca77c6e04ae1 System/Win32/Info.hsc | 18 ++++++++++++++++++ changelog.md | 2 ++ 2 files changed, 20 insertions(+) From git at git.haskell.org Mon Apr 17 21:27:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:27:41 +0000 (UTC) Subject: [commit: packages/Win32] Mistuke-fix-build, depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2, win32-prepare-release-2.4.0.0: Added some badges to readme (bfefef0) Message-ID: <20170417212741.A82B83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: Mistuke-fix-build,depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2,win32-prepare-release-2.4.0.0 Link : http://git.haskell.org/packages/Win32.git/commitdiff/bfefef083637e48e164696cdd560c59e2d6883c5 >--------------------------------------------------------------- commit bfefef083637e48e164696cdd560c59e2d6883c5 Author: Tamar Christina Date: Tue Aug 23 19:31:53 2016 +0100 Added some badges to readme >--------------------------------------------------------------- bfefef083637e48e164696cdd560c59e2d6883c5 README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d4a0286..03f934a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ -The `Win32` Package [![Hackage](https://img.shields.io/hackage/v/Win32.svg)](https://hackage.haskell.org/package/Win32) +The `Win32` Package ===================== +[![Hackage](https://img.shields.io/hackage/v/Win32.svg)](https://hackage.haskell.org/package/Win32) [![Code Climate](https://codeclimate.com/github/haskell/win32/badges/gpa.svg)](https://codeclimate.com/github/haskell/win32) [![Test Coverage](https://codeclimate.com/github/haskell/win32/badges/coverage.svg)](https://codeclimate.com/github/haskell/win32/coverage) [![Issue Count](https://codeclimate.com/github/haskell/win32/badges/issue_count.svg)](https://codeclimate.com/github/haskell/win32) [![License] (https://img.shields.io/packagist/l/doctrine/orm.svg)]() + See [`Win32` on Hackage](http://hackage.haskell.org/package/Win32) for more information. From git at git.haskell.org Mon Apr 17 21:27:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:27:43 +0000 (UTC) Subject: [commit: packages/Win32] Mistuke-fix-build, depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2, win32-prepare-release-2.4.0.0: Put windows_cconv.h in install-includes (#55) (7f91a92) Message-ID: <20170417212743.AD5F03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: Mistuke-fix-build,depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2,win32-prepare-release-2.4.0.0 Link : http://git.haskell.org/packages/Win32.git/commitdiff/7f91a92f74b7d93081df49d01b408ae1cd9c2ff9 >--------------------------------------------------------------- commit 7f91a92f74b7d93081df49d01b408ae1cd9c2ff9 Author: Ryan Scott Date: Wed Sep 14 19:50:24 2016 -0400 Put windows_cconv.h in install-includes (#55) * Put windows_cconv.h in install-includes * Changelog note >--------------------------------------------------------------- 7f91a92f74b7d93081df49d01b408ae1cd9c2ff9 Win32.cabal | 4 ++-- changelog.md | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Win32.cabal b/Win32.cabal index 21f1666..6e8a4c8 100644 --- a/Win32.cabal +++ b/Win32.cabal @@ -14,7 +14,7 @@ build-type: Simple cabal-version: >=1.6 extra-source-files: include/diatemp.h include/dumpBMP.h include/ellipse.h include/errors.h - include/Win32Aux.h include/win32debug.h include/windows_cconv.h + include/Win32Aux.h include/win32debug.h Library build-depends: base >= 4.5 && < 5, bytestring @@ -66,7 +66,7 @@ Library "user32", "gdi32", "winmm", "advapi32", "shell32", "shfolder" include-dirs: include includes: "HsWin32.h", "HsGDI.h", "WndProc.h" - install-includes: "HsWin32.h", "HsGDI.h", "WndProc.h" + install-includes: "HsWin32.h", "HsGDI.h", "WndProc.h", "windows_cconv.h" c-sources: cbits/HsGDI.c cbits/HsWin32.c diff --git a/changelog.md b/changelog.md index f8f6df1..43e5bf4 100644 --- a/changelog.md +++ b/changelog.md @@ -6,6 +6,10 @@ ## GIT HEAD (Unknown version) +* Add `windows_cconv.h` to the `install-includes` field of `Win32.cabal`, + allowing packages that transitively depend on `Win32` to use the + `WINDOWS_CCONV` CPP macro (which expands to `stdcall` or `ccall` + appropriately depending on the system architecture) * Added function `getLongPathName` * Added function `getShortPathName` * Added function `getUserName` From git at git.haskell.org Mon Apr 17 21:27:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:27:45 +0000 (UTC) Subject: [commit: packages/Win32] Mistuke-fix-build, depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2, win32-prepare-release-2.4.0.0: Add getCurrentProcessId function (#56) (bcada7d) Message-ID: <20170417212745.B2B173A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: Mistuke-fix-build,depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2,win32-prepare-release-2.4.0.0 Link : http://git.haskell.org/packages/Win32.git/commitdiff/bcada7df8f846acc0fe0319f28d4745433a7cd84 >--------------------------------------------------------------- commit bcada7df8f846acc0fe0319f28d4745433a7cd84 Author: Alex Biehl Date: Mon Oct 24 20:10:09 2016 +0200 Add getCurrentProcessId function (#56) >--------------------------------------------------------------- bcada7df8f846acc0fe0319f28d4745433a7cd84 System/Win32/Process.hsc | 6 ++++++ changelog.md | 1 + 2 files changed, 7 insertions(+) diff --git a/System/Win32/Process.hsc b/System/Win32/Process.hsc index 7820f0f..e07403b 100644 --- a/System/Win32/Process.hsc +++ b/System/Win32/Process.hsc @@ -69,6 +69,12 @@ foreign import WINDOWS_CCONV unsafe "windows.h GetProcessId" getProcessId :: ProcessHandle -> IO ProcessId getProcessId h = failIfZero "GetProcessId" $ c_GetProcessId h +foreign import WINDOWS_CCONV unsafe "windows.h GetCurrentProcessId" + c_GetCurrentProcessId :: IO ProcessId + +getCurrentProcessId :: IO ProcessId +getCurrentProcessId = c_GetCurrentProcessId + type Th32SnapHandle = HANDLE type Th32SnapFlags = DWORD -- | ProcessId, number of threads, parent ProcessId, process base priority, path of executable file diff --git a/changelog.md b/changelog.md index 43e5bf4..a7eacd8 100644 --- a/changelog.md +++ b/changelog.md @@ -15,3 +15,4 @@ * Added function `getUserName` * Added file attribute `fILE_ATTRIBUTE_REPARSE_POINT` * Added more [`File Access Rights` constants](https://msdn.microsoft.com/en-us/library/windows/desktop/gg258116%28v=vs.85%29.aspx) +* Added function `getCurrentProcessId` From git at git.haskell.org Mon Apr 17 21:27:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:27:49 +0000 (UTC) Subject: [commit: packages/Win32] Mistuke-fix-build, depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2, win32-prepare-release-2.4.0.0: GitHub 53 haskell win32 issues (#57) (612e93c) Message-ID: <20170417212749.C07AB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: Mistuke-fix-build,depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2,win32-prepare-release-2.4.0.0 Link : http://git.haskell.org/packages/Win32.git/commitdiff/612e93cdd68a4be3bf6dca83b475d1bca880a85d >--------------------------------------------------------------- commit 612e93cdd68a4be3bf6dca83b475d1bca880a85d Author: Tamar Christina Date: Mon Oct 24 22:42:30 2016 +0100 GitHub 53 haskell win32 issues (#57) * Win32: Corrected 64bit types. * Win32: Updated changelog. >--------------------------------------------------------------- 612e93cdd68a4be3bf6dca83b475d1bca880a85d Graphics/Win32/Window.hsc | 1 + System/Win32/FileMapping.hsc | 1 + System/Win32/Types.hs | 14 ++++++++------ changelog.md | 1 + 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Graphics/Win32/Window.hsc b/Graphics/Win32/Window.hsc index e5bd152..0138b13 100644 --- a/Graphics/Win32/Window.hsc +++ b/Graphics/Win32/Window.hsc @@ -25,6 +25,7 @@ import Foreign.ForeignPtr (withForeignPtr) import Foreign.Marshal.Alloc (allocaBytes) import Foreign.Ptr (FunPtr, Ptr, castFunPtrToPtr, castPtr, nullPtr) import Foreign.Storable (pokeByteOff) +import Foreign.C.Types (CIntPtr(..)) import Graphics.Win32.GDI.Types (HBITMAP, HCURSOR, HDC, HDWP, HRGN, HWND, PRGN) import Graphics.Win32.GDI.Types (HBRUSH, HICON, HMENU, prim_ChildWindowFromPoint) import Graphics.Win32.GDI.Types (LPRECT, RECT, allocaRECT, peekRECT, withRECT) diff --git a/System/Win32/FileMapping.hsc b/System/Win32/FileMapping.hsc index 9bfd6e4..df603cb 100644 --- a/System/Win32/FileMapping.hsc +++ b/System/Win32/FileMapping.hsc @@ -28,6 +28,7 @@ import Data.ByteString ( ByteString ) import Data.ByteString.Internal ( fromForeignPtr ) import Foreign ( Ptr, nullPtr, plusPtr, maybeWith, FunPtr , ForeignPtr, newForeignPtr ) +import Foreign.C.Types (CUIntPtr(..)) ##include "windows_cconv.h" diff --git a/System/Win32/Types.hs b/System/Win32/Types.hs index 7b53370..8340564 100755 --- a/System/Win32/Types.hs +++ b/System/Win32/Types.hs @@ -29,7 +29,7 @@ import Data.Word (Word8, Word16, Word32, Word64) import Foreign.C.Error (getErrno, errnoToIOError) import Foreign.C.String (newCWString, withCWStringLen) import Foreign.C.String (peekCWString, peekCWStringLen, withCWString) -import Foreign.C.Types (CChar, CUChar, CWchar) +import Foreign.C.Types (CChar, CUChar, CWchar, CIntPtr, CUIntPtr) import Foreign.ForeignPtr (ForeignPtr, newForeignPtr, newForeignPtr_) import Foreign.Ptr (FunPtr, Ptr, nullPtr) import Foreign (allocaArray) @@ -73,6 +73,8 @@ type FLOAT = Float type LARGE_INTEGER = Int64 type UINT_PTR = Word +type LONG_PTR = CIntPtr +type ULONG_PTR = CUIntPtr -- Not really a basic type, but used in many places type DDWORD = Word64 @@ -82,11 +84,11 @@ type DDWORD = Word64 type MbString = Maybe String type MbINT = Maybe INT -type ATOM = UINT -type WPARAM = UINT -type LPARAM = LONG -type LRESULT = LONG -type SIZE_T = DWORD +type ATOM = WORD +type WPARAM = UINT_PTR +type LPARAM = LONG_PTR +type LRESULT = LONG_PTR +type SIZE_T = ULONG_PTR type MbATOM = Maybe ATOM diff --git a/changelog.md b/changelog.md index 303dee5..39a157d 100644 --- a/changelog.md +++ b/changelog.md @@ -18,3 +18,4 @@ * Added function `getCurrentProcessId` * Added function `filepathRelativePathTo` * Added function `pathRelativePathTo` +* Corrected 64 bit types (See #53) From git at git.haskell.org Mon Apr 17 21:27:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:27:47 +0000 (UTC) Subject: [commit: packages/Win32] Mistuke-fix-build, depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2, win32-prepare-release-2.4.0.0: Paths: Added new module and functions (#54) (b4c6102) Message-ID: <20170417212747.BA4573A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: Mistuke-fix-build,depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2,win32-prepare-release-2.4.0.0 Link : http://git.haskell.org/packages/Win32.git/commitdiff/b4c6102c8c6f2bec3c0c35c6fff88b3027eef87c >--------------------------------------------------------------- commit b4c6102c8c6f2bec3c0c35c6fff88b3027eef87c Author: Tamar Christina Date: Mon Oct 24 22:32:07 2016 +0100 Paths: Added new module and functions (#54) * Paths: Added new module and functions * Path: Add new module to cabal and c dependecies updated * Path: remove trailing whitespace >--------------------------------------------------------------- b4c6102c8c6f2bec3c0c35c6fff88b3027eef87c System/Win32/Info.hsc | 16 +-------------- System/Win32/Path.hsc | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++ System/Win32/Types.hs | 15 ++++++++++++++ Win32.cabal | 3 ++- changelog.md | 2 ++ 5 files changed, 77 insertions(+), 16 deletions(-) diff --git a/System/Win32/Info.hsc b/System/Win32/Info.hsc index f9df863..58051d5 100644 --- a/System/Win32/Info.hsc +++ b/System/Win32/Info.hsc @@ -27,7 +27,7 @@ import Foreign.Ptr (Ptr, nullPtr) import Foreign.Storable (Storable(..)) import System.IO.Error (isDoesNotExistError) import System.Win32.Types (DWORD, LPDWORD, LPCTSTR, LPTSTR, LPVOID, UINT, WORD) -import System.Win32.Types (failIfZero, failIfFalse_, peekTStringLen, withTString) +import System.Win32.Types (failIfFalse_, peekTStringLen, withTString, try) #if !MIN_VERSION_base(4,6,0) import Prelude hiding (catch) @@ -144,20 +144,6 @@ searchPath path filename ext = then return Nothing else ioError e --- Support for API calls that are passed a fixed-size buffer and tell --- you via the return value if the buffer was too small. In that --- case, we double the buffer size and try again. -try :: String -> (LPTSTR -> UINT -> IO UINT) -> UINT -> IO String -try loc f n = do - e <- allocaArray (fromIntegral n) $ \lptstr -> do - r <- failIfZero loc $ f lptstr n - if (r > n) then return (Left r) else do - str <- peekTStringLen (lptstr, fromIntegral r) - return (Right str) - case e of - Left n -> try loc f n - Right str -> return str - foreign import WINDOWS_CCONV unsafe "GetWindowsDirectoryW" c_getWindowsDirectory :: LPTSTR -> UINT -> IO UINT diff --git a/System/Win32/Path.hsc b/System/Win32/Path.hsc new file mode 100644 index 0000000..4be9f42 --- /dev/null +++ b/System/Win32/Path.hsc @@ -0,0 +1,57 @@ +#if __GLASGOW_HASKELL__ >= 709 +{-# LANGUAGE Safe #-} +#elif __GLASGOW_HASKELL__ >= 701 +{-# LANGUAGE Trustworthy #-} +#endif +----------------------------------------------------------------------------- +-- | +-- Module : System.Win32.Path +-- Copyright : (c) Tamar Christina, 1997-2003 +-- License : BSD-style (see the file libraries/base/LICENSE) +-- +-- Maintainer : Tamar Christina +-- Stability : provisional +-- Portability : portable +-- +-- A collection of FFI declarations for interfacing with Win32. +-- +----------------------------------------------------------------------------- + +module System.Win32.Path ( + filepathRelativePathTo + , pathRelativePathTo + ) where + +import System.Win32.Types +import System.Win32.File + +import Foreign + +##include "windows_cconv.h" + +#include + +filepathRelativePathTo :: FilePath -> FilePath -> IO FilePath +filepathRelativePathTo from to = + withTString from $ \p_from -> + withTString to $ \p_to -> + allocaArray ((#const MAX_PATH) * (#size TCHAR)) $ \p_AbsPath -> do + _ <- failIfZero "PathRelativePathTo" (c_pathRelativePathTo p_AbsPath p_from fILE_ATTRIBUTE_DIRECTORY + p_to fILE_ATTRIBUTE_NORMAL) + path <- peekTString p_AbsPath + _ <- localFree p_AbsPath + return path + +pathRelativePathTo :: FilePath -> FileAttributeOrFlag -> FilePath -> FileAttributeOrFlag -> IO FilePath +pathRelativePathTo from from_attr to to_attr = + withTString from $ \p_from -> + withTString to $ \p_to -> + allocaArray ((#const MAX_PATH) * (#size TCHAR)) $ \p_AbsPath -> do + _ <- failIfZero "PathRelativePathTo" (c_pathRelativePathTo p_AbsPath p_from from_attr + p_to to_attr) + path <- peekTString p_AbsPath + _ <- localFree p_AbsPath + return path + +foreign import WINDOWS_CCONV unsafe "Shlwapi.h PathRelativePathToW" + c_pathRelativePathTo :: LPTSTR -> LPCTSTR -> DWORD -> LPCTSTR -> DWORD -> IO UINT diff --git a/System/Win32/Types.hs b/System/Win32/Types.hs index 094a594..7b53370 100755 --- a/System/Win32/Types.hs +++ b/System/Win32/Types.hs @@ -32,6 +32,7 @@ import Foreign.C.String (peekCWString, peekCWStringLen, withCWString) import Foreign.C.Types (CChar, CUChar, CWchar) import Foreign.ForeignPtr (ForeignPtr, newForeignPtr, newForeignPtr_) import Foreign.Ptr (FunPtr, Ptr, nullPtr) +import Foreign (allocaArray) import Numeric (showHex) import System.IO.Error (ioeSetErrorString) import System.IO.Unsafe (unsafePerformIO) @@ -264,6 +265,20 @@ ddwordToDwords n = dwordsToDdword:: (DWORD,DWORD) -> DDWORD dwordsToDdword (hi,low) = (fromIntegral low) .|. (fromIntegral hi `shiftL` finiteBitSize hi) +-- Support for API calls that are passed a fixed-size buffer and tell +-- you via the return value if the buffer was too small. In that +-- case, we double the buffer size and try again. +try :: String -> (LPTSTR -> UINT -> IO UINT) -> UINT -> IO String +try loc f n = do + e <- allocaArray (fromIntegral n) $ \lptstr -> do + r <- failIfZero loc $ f lptstr n + if (r > n) then return (Left r) else do + str <- peekTStringLen (lptstr, fromIntegral r) + return (Right str) + case e of + Left n -> try loc f n + Right str -> return str + ---------------------------------------------------------------- -- Primitives ---------------------------------------------------------------- diff --git a/Win32.cabal b/Win32.cabal index 6e8a4c8..dc5fc4c 100644 --- a/Win32.cabal +++ b/Win32.cabal @@ -49,6 +49,7 @@ Library System.Win32.File System.Win32.FileMapping System.Win32.Info + System.Win32.Path System.Win32.Mem System.Win32.NLS System.Win32.Process @@ -63,7 +64,7 @@ Library if impl(ghc >= 7.1) extensions: NondecreasingIndentation extra-libraries: - "user32", "gdi32", "winmm", "advapi32", "shell32", "shfolder" + "user32", "gdi32", "winmm", "advapi32", "shell32", "shfolder", "shlwapi" include-dirs: include includes: "HsWin32.h", "HsGDI.h", "WndProc.h" install-includes: "HsWin32.h", "HsGDI.h", "WndProc.h", "windows_cconv.h" diff --git a/changelog.md b/changelog.md index a7eacd8..303dee5 100644 --- a/changelog.md +++ b/changelog.md @@ -16,3 +16,5 @@ * Added file attribute `fILE_ATTRIBUTE_REPARSE_POINT` * Added more [`File Access Rights` constants](https://msdn.microsoft.com/en-us/library/windows/desktop/gg258116%28v=vs.85%29.aspx) * Added function `getCurrentProcessId` +* Added function `filepathRelativePathTo` +* Added function `pathRelativePathTo` From git at git.haskell.org Mon Apr 17 21:27:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:27:51 +0000 (UTC) Subject: [commit: packages/Win32] win32-prepare-release-2.4.0.0: Win32: Bumped version and release notes. (3a7eff2) Message-ID: <20170417212751.C6D453A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branch : win32-prepare-release-2.4.0.0 Link : http://git.haskell.org/packages/Win32.git/commitdiff/3a7eff2d5ac5f91fc471152dd0397dc1cb583f6c >--------------------------------------------------------------- commit 3a7eff2d5ac5f91fc471152dd0397dc1cb583f6c Author: Tamar Christina Date: Sat Nov 5 13:44:52 2016 +0000 Win32: Bumped version and release notes. >--------------------------------------------------------------- 3a7eff2d5ac5f91fc471152dd0397dc1cb583f6c Win32.cabal | 2 +- changelog.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Win32.cabal b/Win32.cabal index dc5fc4c..645d906 100644 --- a/Win32.cabal +++ b/Win32.cabal @@ -1,5 +1,5 @@ name: Win32 -version: 2.3.1.1 +version: 2.4.0.0 license: BSD3 license-file: LICENSE author: Alastair Reid diff --git a/changelog.md b/changelog.md index 39a157d..6df5356 100644 --- a/changelog.md +++ b/changelog.md @@ -4,7 +4,7 @@ * Release for GHC 8.0.1 -## GIT HEAD (Unknown version) +## 2.4.0.0 *Nov 2016* * Add `windows_cconv.h` to the `install-includes` field of `Win32.cabal`, allowing packages that transitively depend on `Win32` to use the From git at git.haskell.org Mon Apr 17 21:27:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:27:53 +0000 (UTC) Subject: [commit: packages/Win32] Mistuke-fix-build, depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2: Win32: Bumped version and release notes. (#58) (f6f61e8) Message-ID: <20170417212753.CC0393A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: Mistuke-fix-build,depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2 Link : http://git.haskell.org/packages/Win32.git/commitdiff/f6f61e8464f6e739be5b7b64935e735a3094a69d >--------------------------------------------------------------- commit f6f61e8464f6e739be5b7b64935e735a3094a69d Author: Tamar Christina Date: Sat Nov 5 14:09:01 2016 +0000 Win32: Bumped version and release notes. (#58) >--------------------------------------------------------------- f6f61e8464f6e739be5b7b64935e735a3094a69d Win32.cabal | 2 +- changelog.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Win32.cabal b/Win32.cabal index dc5fc4c..645d906 100644 --- a/Win32.cabal +++ b/Win32.cabal @@ -1,5 +1,5 @@ name: Win32 -version: 2.3.1.1 +version: 2.4.0.0 license: BSD3 license-file: LICENSE author: Alastair Reid diff --git a/changelog.md b/changelog.md index 39a157d..6df5356 100644 --- a/changelog.md +++ b/changelog.md @@ -4,7 +4,7 @@ * Release for GHC 8.0.1 -## GIT HEAD (Unknown version) +## 2.4.0.0 *Nov 2016* * Add `windows_cconv.h` to the `install-includes` field of `Win32.cabal`, allowing packages that transitively depend on `Win32` to use the From git at git.haskell.org Mon Apr 17 21:27:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:27:55 +0000 (UTC) Subject: [commit: packages/Win32] Mistuke-fix-build, depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2: Added changelog to Hackage (#59) (680255f) Message-ID: <20170417212755.D22D53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: Mistuke-fix-build,depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2 Link : http://git.haskell.org/packages/Win32.git/commitdiff/680255f7d4bc4687b88ae571fb7608dc91351419 >--------------------------------------------------------------- commit 680255f7d4bc4687b88ae571fb7608dc91351419 Author: Andrés Sicard-Ramírez Date: Sun Nov 6 07:09:15 2016 -0500 Added changelog to Hackage (#59) * [ changelog ] Put first the latest version. * [ cabal ] Added changelog to Hackage. Hackage supports a changelog field. I populated this field with the changelog.md file. >--------------------------------------------------------------- 680255f7d4bc4687b88ae571fb7608dc91351419 Win32.cabal | 1 + changelog.md | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Win32.cabal b/Win32.cabal index 645d906..e8bf02f 100644 --- a/Win32.cabal +++ b/Win32.cabal @@ -15,6 +15,7 @@ cabal-version: >=1.6 extra-source-files: include/diatemp.h include/dumpBMP.h include/ellipse.h include/errors.h include/Win32Aux.h include/win32debug.h + changelog.md Library build-depends: base >= 4.5 && < 5, bytestring diff --git a/changelog.md b/changelog.md index 6df5356..501833d 100644 --- a/changelog.md +++ b/changelog.md @@ -1,9 +1,5 @@ # Changelog for [`Win32` package](http://hackage.haskell.org/package/Win32) -## 2.3.1.1 *May 2016* - -* Release for GHC 8.0.1 - ## 2.4.0.0 *Nov 2016* * Add `windows_cconv.h` to the `install-includes` field of `Win32.cabal`, @@ -19,3 +15,7 @@ * Added function `filepathRelativePathTo` * Added function `pathRelativePathTo` * Corrected 64 bit types (See #53) + +## 2.3.1.1 *May 2016* + +* Release for GHC 8.0.1 From git at git.haskell.org Mon Apr 17 21:27:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:27:57 +0000 (UTC) Subject: [commit: packages/Win32] Mistuke-fix-build, depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2: Add new unreleased header. (aae202a) Message-ID: <20170417212757.D6C8A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: Mistuke-fix-build,depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2 Link : http://git.haskell.org/packages/Win32.git/commitdiff/aae202ae1f3a25fc8d4499f2710070b5948e804b >--------------------------------------------------------------- commit aae202ae1f3a25fc8d4499f2710070b5948e804b Author: Tamar Christina Date: Tue Nov 15 22:37:18 2016 +0000 Add new unreleased header. >--------------------------------------------------------------- aae202ae1f3a25fc8d4499f2710070b5948e804b changelog.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/changelog.md b/changelog.md index 501833d..6966ac6 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,7 @@ # Changelog for [`Win32` package](http://hackage.haskell.org/package/Win32) +## Unreleased GIT version + ## 2.4.0.0 *Nov 2016* * Add `windows_cconv.h` to the `install-includes` field of `Win32.cabal`, From git at git.haskell.org Mon Apr 17 21:28:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:28:01 +0000 (UTC) Subject: [commit: packages/Win32] Mistuke-fix-build, depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2: Implement isMinTTY (#63) (1f20e12) Message-ID: <20170417212801.EAFF53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: Mistuke-fix-build,depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2 Link : http://git.haskell.org/packages/Win32.git/commitdiff/1f20e120fbb9f0306b3b175ece1ba5e132c54a9f >--------------------------------------------------------------- commit 1f20e120fbb9f0306b3b175ece1ba5e132c54a9f Author: Ryan Scott Date: Thu Dec 22 03:24:06 2016 -0600 Implement isMinTTY (#63) * Implement isMinTTY * Address some of Mistuke's comments * Make FILE_NAME_INFO an explicit data structure * Use concrete struct for UNICODE_STRING * No need to hide void * Null-terminate wide strings properly * Suggestions from review * Use size of OBJECT_NAME_INFORMATION directly * Minor spacing fixes * Use return instead of pure * Old 32-bit Windows compatibility >--------------------------------------------------------------- 1f20e120fbb9f0306b3b175ece1ba5e132c54a9f System/Win32.hs | 2 + System/Win32/MinTTY.hsc | 229 ++++++++++++++++++++++++++++++++++++++++++++++ System/Win32/Types.hs | 4 + Win32.cabal | 7 +- changelog.md | 4 + include/winternl_compat.h | 39 ++++++++ 6 files changed, 282 insertions(+), 3 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 1f20e120fbb9f0306b3b175ece1ba5e132c54a9f From git at git.haskell.org Mon Apr 17 21:27:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:27:59 +0000 (UTC) Subject: [commit: packages/Win32] Mistuke-fix-build, depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2: Call SetLastError before maperrno (#60) (bf54fa7) Message-ID: <20170417212759.DC33C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: Mistuke-fix-build,depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2 Link : http://git.haskell.org/packages/Win32.git/commitdiff/bf54fa7134eb9b1366f827426f050d833b2cda54 >--------------------------------------------------------------- commit bf54fa7134eb9b1366f827426f050d833b2cda54 Author: Egor Tensin Date: Wed Nov 16 05:26:43 2016 +0300 Call SetLastError before maperrno (#60) * Call SetLastError before maperrno * Use maperrno_func instead of the stateful maperrno * Added a changelog entry on `failWith` >--------------------------------------------------------------- bf54fa7134eb9b1366f827426f050d833b2cda54 System/Win32/Types.hs | 18 ++++++++++-------- changelog.md | 3 +++ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/System/Win32/Types.hs b/System/Win32/Types.hs index 8340564..0ff7f34 100755 --- a/System/Win32/Types.hs +++ b/System/Win32/Types.hs @@ -26,10 +26,10 @@ import Data.Char (isSpace) import Data.Int (Int32, Int64) import Data.Maybe (fromMaybe) import Data.Word (Word8, Word16, Word32, Word64) -import Foreign.C.Error (getErrno, errnoToIOError) +import Foreign.C.Error (Errno(..), errnoToIOError) import Foreign.C.String (newCWString, withCWStringLen) import Foreign.C.String (peekCWString, peekCWStringLen, withCWString) -import Foreign.C.Types (CChar, CUChar, CWchar, CIntPtr, CUIntPtr) +import Foreign.C.Types (CChar, CUChar, CWchar, CInt(..), CIntPtr, CUIntPtr) import Foreign.ForeignPtr (ForeignPtr, newForeignPtr, newForeignPtr_) import Foreign.Ptr (FunPtr, Ptr, nullPtr) import Foreign (allocaArray) @@ -242,18 +242,17 @@ failWith fn_name err_code = do -- We ignore failure of freeing c_msg, given we're already failing _ <- localFree c_msg return msg - c_maperrno -- turn GetLastError() into errno, which errnoToIOError knows - -- how to convert to an IOException we can throw. - -- XXX we should really do this directly. - errno <- getErrno + -- turn GetLastError() into errno, which errnoToIOError knows how to convert + -- to an IOException we can throw. + errno <- c_maperrno_func err_code let msg' = reverse $ dropWhile isSpace $ reverse msg -- drop trailing \n ioerror = errnoToIOError fn_name errno Nothing Nothing `ioeSetErrorString` msg' throwIO ioerror -foreign import ccall unsafe "maperrno" -- in base/cbits/Win32Utils.c - c_maperrno :: IO () +foreign import ccall unsafe "maperrno_func" -- in base/cbits/Win32Utils.c + c_maperrno_func :: ErrCode -> IO Errno ---------------------------------------------------------------- -- Misc helpers @@ -295,6 +294,9 @@ foreign import WINDOWS_CCONV unsafe "windows.h LocalFree" foreign import WINDOWS_CCONV unsafe "windows.h GetLastError" getLastError :: IO ErrCode +foreign import WINDOWS_CCONV unsafe "windows.h SetLastError" + setLastError :: ErrCode -> IO () + {-# CFILES cbits/errors.c #-} foreign import ccall unsafe "errors.h" diff --git a/changelog.md b/changelog.md index 6966ac6..d538387 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,9 @@ ## Unreleased GIT version +* `failWith` (and the API calls that use it) now throw `IOError`s with proper + `IOErrorType`s. + ## 2.4.0.0 *Nov 2016* * Add `windows_cconv.h` to the `install-includes` field of `Win32.cabal`, From git at git.haskell.org Mon Apr 17 21:28:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:28:03 +0000 (UTC) Subject: [commit: packages/Win32] Mistuke-fix-build, depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2: Fix poke implementation for TIME_ZONE_INFORMATION (#65) (e330708) Message-ID: <20170417212803.F27093A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: Mistuke-fix-build,depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2 Link : http://git.haskell.org/packages/Win32.git/commitdiff/e330708577a0508eecd045715afa0655a3ab0301 >--------------------------------------------------------------- commit e330708577a0508eecd045715afa0655a3ab0301 Author: Ryan Scott Date: Thu Dec 22 03:25:40 2016 -0600 Fix poke implementation for TIME_ZONE_INFORMATION (#65) * Fix poke implementation for TIME_ZONE_INFORMATION * Add test >--------------------------------------------------------------- e330708577a0508eecd045715afa0655a3ab0301 System/Win32/Time.hsc | 9 +++++---- changelog.md | 2 ++ tests/PokeTZI.hs | 15 +++++++++++++++ tests/all.T | 1 + 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/System/Win32/Time.hsc b/System/Win32/Time.hsc index 978a915..acabee1 100644 --- a/System/Win32/Time.hsc +++ b/System/Win32/Time.hsc @@ -111,10 +111,11 @@ instance Storable TIME_ZONE_INFORMATION where where write buf offset str = withCWStringLen str $ \(str,len) -> do when (len>31) $ fail "Storable TIME_ZONE_INFORMATION.poke: Too long string." - let start = (advancePtr (castPtr buf) offset) - end = advancePtr start len - copyArray (castPtr str :: Ptr Word8) start len - poke end 0 + let len' = len * sizeOf (undefined :: CWchar) + start = (advancePtr (castPtr buf) offset) + end = advancePtr start len' + copyArray start (castPtr str :: Ptr Word8) len' + poke (castPtr end) (0 :: CWchar) peek buf = do bias <- (#peek TIME_ZONE_INFORMATION, Bias) buf sdat <- (#peek TIME_ZONE_INFORMATION, StandardDate) buf diff --git a/changelog.md b/changelog.md index 050addb..2e5fc37 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,8 @@ * `failWith` (and the API calls that use it) now throw `IOError`s with proper `IOErrorType`s. +* Fix a bug in the implementation of `poke` for `TIME_ZONE_INFORMATION` which + would cause it to be marshalled incorrectly. * Add `System.Win32.MinTTY` module for detecting the presence of MinTTY. * Add `ULONG` type to `System.Win32.Types`. * Add function `failIfNeg` to `System.Win32.Types`, which fails if a negative diff --git a/tests/PokeTZI.hs b/tests/PokeTZI.hs new file mode 100644 index 0000000..0853ffe --- /dev/null +++ b/tests/PokeTZI.hs @@ -0,0 +1,15 @@ +module Main where + +import Control.Exception (assert) +import Foreign +import System.Win32.Time + +main :: IO () +main = do + (_, tzi) <- getTimeZoneInformation + alloca $ \buf -> do + poke buf tzi + tzi' <- peek buf + print tzi + print tzi' + assert (tzi == tzi') $ return () diff --git a/tests/all.T b/tests/all.T index 07d030b..e541f3c 100644 --- a/tests/all.T +++ b/tests/all.T @@ -6,3 +6,4 @@ test('helloworld', skip, compile_and_run, ['-package lang -package win32']) test('lasterror', normal, compile_and_run, ['-package Win32']) test('T4452', normal, compile_and_run, ['-package Win32']) +test('PokeTZI', normal, compile_and_run, ['-package Win32']) From git at git.haskell.org Mon Apr 17 21:28:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:28:06 +0000 (UTC) Subject: [commit: packages/Win32] Mistuke-fix-build, depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2: Add function to find window by name only (#69) (d1c4a93) Message-ID: <20170417212806.0469F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: Mistuke-fix-build,depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2 Link : http://git.haskell.org/packages/Win32.git/commitdiff/d1c4a935673b9f36ab46cff05f1cc67d2f9c1009 >--------------------------------------------------------------- commit d1c4a935673b9f36ab46cff05f1cc67d2f9c1009 Author: Jason Shipman Date: Thu Dec 22 04:27:01 2016 -0500 Add function to find window by name only (#69) >--------------------------------------------------------------- d1c4a935673b9f36ab46cff05f1cc67d2f9c1009 Graphics/Win32/Window.hsc | 5 +++++ changelog.md | 1 + 2 files changed, 6 insertions(+) diff --git a/Graphics/Win32/Window.hsc b/Graphics/Win32/Window.hsc index 0138b13..90fb2d2 100644 --- a/Graphics/Win32/Window.hsc +++ b/Graphics/Win32/Window.hsc @@ -475,6 +475,11 @@ findWindow cname wname = withTString cname $ \ c_cname -> withTString wname $ \ c_wname -> liftM ptrToMaybe $ c_FindWindow c_cname c_wname + +findWindowByName :: String -> IO (Maybe HWND) +findWindowByName wname = withTString wname $ \ c_wname -> + liftM ptrToMaybe $ c_FindWindow nullPtr c_wname + foreign import WINDOWS_CCONV unsafe "windows.h FindWindowW" c_FindWindow :: LPCTSTR -> LPCTSTR -> IO HWND diff --git a/changelog.md b/changelog.md index 2e5fc37..61d899e 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,7 @@ * `failWith` (and the API calls that use it) now throw `IOError`s with proper `IOErrorType`s. +* Add function `findWindowByName` * Fix a bug in the implementation of `poke` for `TIME_ZONE_INFORMATION` which would cause it to be marshalled incorrectly. * Add `System.Win32.MinTTY` module for detecting the presence of MinTTY. From git at git.haskell.org Mon Apr 17 21:28:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:28:08 +0000 (UTC) Subject: [commit: packages/Win32] Mistuke-fix-build, depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2: Merge win32 extras (#67) (399d21a) Message-ID: <20170417212808.1A98F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: Mistuke-fix-build,depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2 Link : http://git.haskell.org/packages/Win32.git/commitdiff/399d21ab77d652436fe71d7cb580b160f32d10f3 >--------------------------------------------------------------- commit 399d21ab77d652436fe71d7cb580b160f32d10f3 Author: Tamar Christina Date: Sat Jan 7 19:35:04 2017 +0000 Merge win32 extras (#67) * Win32: Initial merge * Win32: Finish merging Win32. * Win32: Merge finally done. * Win32: Update includes * Win32: Fix build * Win32: Define WINVER level. * Win32: Define WINVER level again. * Win32: GHC compat support. * Merge: Finally rebased. * Merge: Added GHC compat. * Merge: Add compat with layered window. * Merge: Compat with AnimateWindow * Merge: Compat with Input * Merge: Missing structs. * Merge: remove attribute * Merge: include header more places. * Merge: fix remaining issues. * More compat changes for mouse. * Merge: Missing mouse defines. * Merge: So random.. * Merge: such a big mess.. * Merge: such a big mess.. * Merge: such a big mess.. >--------------------------------------------------------------- 399d21ab77d652436fe71d7cb580b160f32d10f3 Graphics/Win32.hs | 12 +- Graphics/Win32/GDI/AlphaBlend.hsc | 73 ++++++++ Graphics/Win32/GDI/Clip.hsc | 12 ++ Graphics/Win32/Key.hsc | 294 ++++++++++++++++++++++-------- Graphics/Win32/LayeredWindow.hsc | 62 +++++++ Graphics/Win32/Misc.hsc | 2 +- Graphics/Win32/Window/AnimateWindow.hsc | 40 ++++ Graphics/Win32/Window/ForegroundWindow.hs | 47 +++++ Graphics/Win32/Window/HotKey.hsc | 65 +++++++ Graphics/Win32/Window/IMM.hsc | 110 +++++++++++ Graphics/Win32/Window/PostMessage.hsc | 48 +++++ LICENSE | 1 + Media/Win32.hs | 48 +++++ System/Win32.hs | 11 ++ System/Win32/Automation.hs | 15 ++ System/Win32/Automation/Input.hsc | 121 ++++++++++++ System/Win32/Automation/Input/Key.hsc | 54 ++++++ System/Win32/Automation/Input/Mouse.hsc | 75 ++++++++ System/Win32/Console/CtrlHandler.hs | 52 ++++++ System/Win32/Console/HWND.hs | 34 ++++ System/Win32/Console/Title.hsc | 43 +++++ System/Win32/DLL.hsc | 8 + System/Win32/DebugApi.hsc | 82 ++++----- System/Win32/Encoding.hs | 99 ++++++++++ System/Win32/Exception/Unsupported.hs | 70 +++++++ System/Win32/FileMapping.hsc | 8 +- System/Win32/HardLink.hs | 96 ++++++++++ System/Win32/Info.hsc | 39 ---- System/Win32/Info/Computer.hsc | 236 ++++++++++++++++++++++++ System/Win32/Info/Version.hsc | 163 +++++++++++++++++ System/Win32/NLS.hsc | 4 +- System/Win32/Process.hsc | 6 + System/Win32/Registry.hsc | 44 ++--- System/Win32/SimpleMAPI.hsc | 40 ++-- System/Win32/String.hs | 51 ++++++ System/Win32/SymbolicLink.hsc | 63 +++++++ System/Win32/Thread.hs | 46 +++++ System/Win32/Time.hsc | 69 +++---- System/Win32/{Types.hs => Types.hsc} | 39 +++- System/Win32/Utils.hs | 76 ++++++++ System/Win32/Word.hs | 23 +++ Win32.cabal | 45 ++++- cbits/alphablend.c | 15 ++ changelog.md | 2 + include/alphablend.h | 10 + include/winuser_compat.h | 113 ++++++++++++ 46 files changed, 2419 insertions(+), 247 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 399d21ab77d652436fe71d7cb580b160f32d10f3 From git at git.haskell.org Mon Apr 17 21:28:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:28:10 +0000 (UTC) Subject: [commit: packages/Win32] Mistuke-fix-build, depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2: Fix wrong alignments (#68) (2a56e45) Message-ID: <20170417212810.25F313A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: Mistuke-fix-build,depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2 Link : http://git.haskell.org/packages/Win32.git/commitdiff/2a56e451262473de3c5efbbd3725633650e57471 >--------------------------------------------------------------- commit 2a56e451262473de3c5efbbd3725633650e57471 Author: Tamar Christina Date: Sat Jan 7 19:45:45 2017 +0000 Fix wrong alignments (#68) * Win32: Correct alignments * Win32: alignment * Win32: fix alignments. >--------------------------------------------------------------- 2a56e451262473de3c5efbbd3725633650e57471 Graphics/Win32/GDI/AlphaBlend.hsc | 3 ++- System/Win32/Automation/Input.hsc | 5 +++-- System/Win32/Automation/Input/Key.hsc | 3 ++- System/Win32/Automation/Input/Mouse.hsc | 3 ++- System/Win32/File.hsc | 5 +++-- System/Win32/Info.hsc | 3 ++- System/Win32/Info/Computer.hsc | 3 ++- System/Win32/Info/Version.hsc | 3 ++- System/Win32/Mem.hsc | 3 ++- System/Win32/Time.hsc | 9 +++++---- Win32.cabal | 2 +- changelog.md | 2 ++ include/alignment.h | 3 +++ 13 files changed, 31 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 2a56e451262473de3c5efbbd3725633650e57471 From git at git.haskell.org Mon Apr 17 21:28:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:28:12 +0000 (UTC) Subject: [commit: packages/Win32] Mistuke-fix-build, depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2: Release: Bumping to version 2.5.0.0 (7dd582b) Message-ID: <20170417212812.2C53D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: Mistuke-fix-build,depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2 Link : http://git.haskell.org/packages/Win32.git/commitdiff/7dd582b06a3658326682050c23a59d38ba8aede7 >--------------------------------------------------------------- commit 7dd582b06a3658326682050c23a59d38ba8aede7 Author: Tamar Christina Date: Sat Jan 7 20:54:55 2017 +0000 Release: Bumping to version 2.5.0.0 >--------------------------------------------------------------- 7dd582b06a3658326682050c23a59d38ba8aede7 Win32.cabal | 2 +- changelog.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Win32.cabal b/Win32.cabal index 785ff2c..d685355 100644 --- a/Win32.cabal +++ b/Win32.cabal @@ -1,5 +1,5 @@ name: Win32 -version: 2.4.0.0 +version: 2.5.0.0 license: BSD3 license-file: LICENSE author: Alastair Reid, shelarcy diff --git a/changelog.md b/changelog.md index 8f5c8f1..0c94c59 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,6 @@ # Changelog for [`Win32` package](http://hackage.haskell.org/package/Win32) -## Unreleased GIT version +## 2.5.0.0 *Jan 2017* * `failWith` (and the API calls that use it) now throw `IOError`s with proper `IOErrorType`s. From git at git.haskell.org Mon Apr 17 21:28:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:28:14 +0000 (UTC) Subject: [commit: packages/Win32] Mistuke-fix-build, depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2: Remove optimization flag (04ff7c0) Message-ID: <20170417212814.3205E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: Mistuke-fix-build,depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2 Link : http://git.haskell.org/packages/Win32.git/commitdiff/04ff7c018cc72b64dc6ca78d763d76992bad1c07 >--------------------------------------------------------------- commit 04ff7c018cc72b64dc6ca78d763d76992bad1c07 Author: Tamar Christina Date: Sat Jan 7 21:22:25 2017 +0000 Remove optimization flag >--------------------------------------------------------------- 04ff7c018cc72b64dc6ca78d763d76992bad1c07 Win32.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Win32.cabal b/Win32.cabal index d685355..97b4a2f 100644 --- a/Win32.cabal +++ b/Win32.cabal @@ -108,7 +108,7 @@ Library cbits/ellipse.c cbits/errors.c cbits/alphablend.c - cc-options: -O3 -Wall + cc-options: -Wall source-repository head type: git From git at git.haskell.org Mon Apr 17 21:28:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:28:16 +0000 (UTC) Subject: [commit: packages/Win32] Mistuke-fix-build, depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2: Fix release sdist. (ba0b7a2) Message-ID: <20170417212816.381E23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: Mistuke-fix-build,depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2 Link : http://git.haskell.org/packages/Win32.git/commitdiff/ba0b7a2cdad702b8a6a2a2f780fd9a249db957fd >--------------------------------------------------------------- commit ba0b7a2cdad702b8a6a2a2f780fd9a249db957fd Author: Tamar Christina Date: Sat Jan 7 21:30:31 2017 +0000 Fix release sdist. >--------------------------------------------------------------- ba0b7a2cdad702b8a6a2a2f780fd9a249db957fd Win32.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Win32.cabal b/Win32.cabal index 97b4a2f..580f364 100644 --- a/Win32.cabal +++ b/Win32.cabal @@ -14,7 +14,7 @@ build-type: Simple cabal-version: >=1.6 extra-source-files: include/diatemp.h include/dumpBMP.h include/ellipse.h include/errors.h - include/Win32Aux.h include/win32debug.h + include/Win32Aux.h include/win32debug.h include/alignment.h changelog.md Library From git at git.haskell.org Mon Apr 17 21:28:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:28:18 +0000 (UTC) Subject: [commit: packages/Win32] Mistuke-fix-build, depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2: Add withHandleToHANDLE from ansi-terminal (#70) (729f902) Message-ID: <20170417212818.3FD0C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: Mistuke-fix-build,depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2 Link : http://git.haskell.org/packages/Win32.git/commitdiff/729f9029e7a1fb8274c0b7f8065dec45f003405a >--------------------------------------------------------------- commit 729f9029e7a1fb8274c0b7f8065dec45f003405a Author: Ryan Scott Date: Thu Jan 12 11:26:38 2017 -0500 Add withHandleToHANDLE from ansi-terminal (#70) * Add withHandleToHANDLE from ansi-terminal Fixes #51. * Add hANDLEToHandle >--------------------------------------------------------------- 729f9029e7a1fb8274c0b7f8065dec45f003405a System/Win32/Types.hsc | 68 +++++++++++++++++++++++++++++++++++++++++-- changelog.md | 4 +++ tests/HandleConversion.hs | 16 ++++++++++ tests/HandleConversion.stdout | 3 ++ tests/all.T | 1 + 5 files changed, 89 insertions(+), 3 deletions(-) diff --git a/System/Win32/Types.hsc b/System/Win32/Types.hsc index f13f033..afefb50 100755 --- a/System/Win32/Types.hsc +++ b/System/Win32/Types.hsc @@ -21,20 +21,27 @@ module System.Win32.Types , nullPtr ) where -import Control.Exception (throwIO) +import Control.Concurrent.MVar (readMVar) +import Control.Exception (bracket, throwIO) import Data.Bits (shiftL, shiftR, (.|.), (.&.)) import Data.Char (isSpace) import Data.Int (Int32, Int64, Int16) import Data.Maybe (fromMaybe) +import Data.Typeable (cast) import Data.Word (Word8, Word16, Word32, Word64) import Foreign.C.Error (Errno(..), errnoToIOError) import Foreign.C.String (newCWString, withCWStringLen) import Foreign.C.String (peekCWString, peekCWStringLen, withCWString) -import Foreign.C.Types (CChar, CUChar, CWchar, CInt(..), CIntPtr, CUIntPtr) +import Foreign.C.Types (CChar, CUChar, CWchar, CInt(..), CIntPtr(..), CUIntPtr) import Foreign.ForeignPtr (ForeignPtr, newForeignPtr, newForeignPtr_) -import Foreign.Ptr (FunPtr, Ptr, nullPtr) +import Foreign.Ptr (FunPtr, Ptr, nullPtr, ptrToIntPtr) +import Foreign.StablePtr (StablePtr, freeStablePtr, newStablePtr) import Foreign (allocaArray) +import GHC.IO.FD (FD(..)) +import GHC.IO.Handle.FD (fdToHandle) +import GHC.IO.Handle.Types (Handle(..), Handle__(..)) import Numeric (showHex) +import qualified System.IO as IO () import System.IO.Error (ioeSetErrorString) import System.IO.Unsafe (unsafePerformIO) @@ -51,6 +58,7 @@ finiteBitSize :: (Bits a) => a -> Int finiteBitSize = bitSize #endif +#include #include ##include "windows_cconv.h" @@ -213,6 +221,60 @@ nullFinalHANDLE = unsafePerformIO (newForeignPtr_ nullPtr) iNVALID_HANDLE_VALUE :: HANDLE iNVALID_HANDLE_VALUE = castUINTPtrToPtr (-1) +foreign import ccall "_open_osfhandle" + _open_osfhandle :: CIntPtr -> CInt -> IO CInt + +-- | Create a Haskell 'Handle' from a Windows 'HANDLE'. +-- +-- Beware that this function allocates a new file descriptor. A consequence of +-- this is that calling 'hANDLEToHandle' on the standard Windows handles will +-- not give you 'IO.stdin', 'IO.stdout', or 'IO.stderr'. For example, if you +-- run this code: +-- +-- @ +-- import Graphics.Win32.Misc +-- stdoutHANDLE <- getStdHandle sTD_OUTPUT_HANDLE +-- stdout2 <- 'hANDLEToHandle' stdoutHANDLE +-- @ +-- +-- Then although you can use @stdout2@ to write to standard output, it is not +-- the case that @'IO.stdout' == stdout2 at . +hANDLEToHandle :: HANDLE -> IO Handle +hANDLEToHandle handle = + _open_osfhandle (fromIntegral (ptrToIntPtr handle)) (#const _O_BINARY) >>= fdToHandle + +foreign import ccall unsafe "_get_osfhandle" + c_get_osfhandle :: CInt -> IO HANDLE + +-- | Extract a Windows 'HANDLE' from a Haskell 'Handle' and perform +-- an action on it. + +-- Originally authored by Max Bolingbroke in the ansi-terminal library +withHandleToHANDLE :: Handle -> (HANDLE -> IO a) -> IO a +withHandleToHANDLE haskell_handle action = + -- Create a stable pointer to the Handle. This prevents the garbage collector + -- getting to it while we are doing horrible manipulations with it, and hence + -- stops it being finalized (and closed). + withStablePtr haskell_handle $ const $ do + -- Grab the write handle variable from the Handle + let write_handle_mvar = case haskell_handle of + FileHandle _ handle_mvar -> handle_mvar + DuplexHandle _ _ handle_mvar -> handle_mvar + -- This is "write" MVar, we could also take the "read" one + + -- Get the FD from the algebraic data type + Just fd <- fmap (\(Handle__ { haDevice = dev }) -> fmap fdFD (cast dev)) + $ readMVar write_handle_mvar + + -- Finally, turn that (C-land) FD into a HANDLE using msvcrt + windows_handle <- c_get_osfhandle fd + + -- Do what the user originally wanted + action windows_handle + +withStablePtr :: a -> (StablePtr a -> IO b) -> IO b +withStablePtr value = bracket (newStablePtr value) freeStablePtr + ---------------------------------------------------------------- -- Errors ---------------------------------------------------------------- diff --git a/changelog.md b/changelog.md index 0c94c59..6f86b44 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ # Changelog for [`Win32` package](http://hackage.haskell.org/package/Win32) +## Unreleased GIT version + +* Add `withHandleToHANDLE` (originally found in the `ansi-terminal` library) + ## 2.5.0.0 *Jan 2017* * `failWith` (and the API calls that use it) now throw `IOError`s with proper diff --git a/tests/HandleConversion.hs b/tests/HandleConversion.hs new file mode 100644 index 0000000..55483fe --- /dev/null +++ b/tests/HandleConversion.hs @@ -0,0 +1,16 @@ +module Main where + +import Graphics.Win32.Misc +import System.IO +import System.Win32.Types + +testStdHandle :: Handle -> StdHandleId -> IO () +testStdHandle haskHandle winStdHandle = do + winHandle <- getStdHandle winStdHandle + withHandleToHANDLE haskHandle $ print . (== winHandle) + +main :: IO () +main = do + testStdHandle stdin sTD_INPUT_HANDLE + testStdHandle stdout sTD_OUTPUT_HANDLE + testStdHandle stderr sTD_ERROR_HANDLE diff --git a/tests/HandleConversion.stdout b/tests/HandleConversion.stdout new file mode 100644 index 0000000..b8ca7e7 --- /dev/null +++ b/tests/HandleConversion.stdout @@ -0,0 +1,3 @@ +True +True +True diff --git a/tests/all.T b/tests/all.T index e541f3c..93531ae 100644 --- a/tests/all.T +++ b/tests/all.T @@ -7,3 +7,4 @@ test('helloworld', skip, compile_and_run, ['-package lang -package win32']) test('lasterror', normal, compile_and_run, ['-package Win32']) test('T4452', normal, compile_and_run, ['-package Win32']) test('PokeTZI', normal, compile_and_run, ['-package Win32']) +test('HandleConversion', normal, compile_and_run, ['-package Win32']) From git at git.haskell.org Mon Apr 17 21:28:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:28:20 +0000 (UTC) Subject: [commit: packages/Win32] Mistuke-fix-build, depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2: tests: Remove defintion of SetLastError (2da0a49) Message-ID: <20170417212820.44EB93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: Mistuke-fix-build,depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2 Link : http://git.haskell.org/packages/Win32.git/commitdiff/2da0a493acf84e1dd2936b4cca668483cba08032 >--------------------------------------------------------------- commit 2da0a493acf84e1dd2936b4cca668483cba08032 Author: Ben Gamari Date: Tue Jan 24 14:04:39 2017 -0500 tests: Remove defintion of SetLastError It is now provided by System.Win32.Types. >--------------------------------------------------------------- 2da0a493acf84e1dd2936b4cca668483cba08032 tests/lasterror.hs | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/lasterror.hs b/tests/lasterror.hs index 0b57985..21fcbae 100644 --- a/tests/lasterror.hs +++ b/tests/lasterror.hs @@ -14,6 +14,3 @@ main = do takeMVar m r <- getLastError when (r /= 42) $ fail ("wrong: " ++ show r) - -foreign import stdcall unsafe "windows.h SetLastError" - setLastError :: ErrCode -> IO () From git at git.haskell.org Mon Apr 17 21:28:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:28:22 +0000 (UTC) Subject: [commit: packages/Win32] Mistuke-fix-build, depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2: Add missing test output for PokeTZI (8d3f144) Message-ID: <20170417212822.4CAE93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: Mistuke-fix-build,depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2 Link : http://git.haskell.org/packages/Win32.git/commitdiff/8d3f144a902bd13e1c6192e62ac1b2cf7cef595d >--------------------------------------------------------------- commit 8d3f144a902bd13e1c6192e62ac1b2cf7cef595d Author: Ben Gamari Date: Tue Jan 24 14:28:30 2017 -0500 Add missing test output for PokeTZI >--------------------------------------------------------------- 8d3f144a902bd13e1c6192e62ac1b2cf7cef595d tests/PokeTZI.stdout | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/PokeTZI.stdout b/tests/PokeTZI.stdout new file mode 100644 index 0000000..6d88353 --- /dev/null +++ b/tests/PokeTZI.stdout @@ -0,0 +1,2 @@ +TIME_ZONE_INFORMATION {tziBias = 300, tziStandardName = "Eastern Standard Time", tziStandardDate = SYSTEMTIME {wYear = 0, wMonth = 11, wDayOfWeek = 0, wDay = 1, wHour = 2, wMinute = 0, wSecond = 0, wMilliseconds = 0}, tziStandardBias = 0, tziDaylightName = "Eastern Daylight Time", tziDaylightDate = SYSTEMTIME {wYear = 0, wMonth = 3, wDayOfWeek = 0, wDay = 2, wHour = 2, wMinute = 0, wSecond = 0, wMilliseconds = 0}, tziDaylightBias = -60} +TIME_ZONE_INFORMATION {tziBias = 300, tziStandardName = "Eastern Standard Time", tziStandardDate = SYSTEMTIME {wYear = 0, wMonth = 11, wDayOfWeek = 0, wDay = 1, wHour = 2, wMinute = 0, wSecond = 0, wMilliseconds = 0}, tziStandardBias = 0, tziDaylightName = "Eastern Daylight Time", tziDaylightDate = SYSTEMTIME {wYear = 0, wMonth = 3, wDayOfWeek = 0, wDay = 2, wHour = 2, wMinute = 0, wSecond = 0, wMilliseconds = 0}, tziDaylightBias = -60} From git at git.haskell.org Mon Apr 17 21:28:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:28:24 +0000 (UTC) Subject: [commit: packages/Win32] Mistuke-fix-build, depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2: Merge pull request #71 from bgamari/master (8d6e9af) Message-ID: <20170417212824.541573A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: Mistuke-fix-build,depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2 Link : http://git.haskell.org/packages/Win32.git/commitdiff/8d6e9af8f1d89bbd2cbbca6dc8fc0b4e9e98614d >--------------------------------------------------------------- commit 8d6e9af8f1d89bbd2cbbca6dc8fc0b4e9e98614d Merge: 729f902 8d3f144 Author: Ben Gamari Date: Tue Jan 24 21:44:30 2017 +0000 Merge pull request #71 from bgamari/master tests: Fix various issues >--------------------------------------------------------------- 8d6e9af8f1d89bbd2cbbca6dc8fc0b4e9e98614d tests/PokeTZI.stdout | 2 ++ tests/lasterror.hs | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) From git at git.haskell.org Mon Apr 17 21:28:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:28:26 +0000 (UTC) Subject: [commit: packages/Win32] Mistuke-fix-build: Update Input.hsc (f64f615) Message-ID: <20170417212826.5986B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branch : Mistuke-fix-build Link : http://git.haskell.org/packages/Win32.git/commitdiff/f64f61548f5f36dfbb9d9bbb18f528a7aab395ec >--------------------------------------------------------------- commit f64f61548f5f36dfbb9d9bbb18f528a7aab395ec Author: Tamar Christina Date: Wed Jan 25 12:37:18 2017 +0000 Update Input.hsc remove redundant import >--------------------------------------------------------------- f64f61548f5f36dfbb9d9bbb18f528a7aab395ec System/Win32/Automation/Input.hsc | 1 - 1 file changed, 1 deletion(-) diff --git a/System/Win32/Automation/Input.hsc b/System/Win32/Automation/Input.hsc index a1b36fc..7f6dd59 100644 --- a/System/Win32/Automation/Input.hsc +++ b/System/Win32/Automation/Input.hsc @@ -25,7 +25,6 @@ import Graphics.Win32.Key ( VKey, c_MapVirtualKey ) import System.Win32.Automation.Input.Key import System.Win32.Automation.Input.Mouse ( MOUSEINPUT ) import System.Win32.Automation.Input.Mouse hiding ( MOUSEINPUT(..) ) -import qualified System.Win32.Automation.Input.Mouse import System.Win32.Types ( UINT, LPARAM, failIfZero ) import System.Win32.Word ( DWORD, WORD ) From git at git.haskell.org Mon Apr 17 21:28:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:28:28 +0000 (UTC) Subject: [commit: packages/Win32] depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2: Update Input.hsc (#72) (716c9a3) Message-ID: <20170417212828.5EB283A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2 Link : http://git.haskell.org/packages/Win32.git/commitdiff/716c9a3e97611aea3a0a907ba80fe9c11e1afc7f >--------------------------------------------------------------- commit 716c9a3e97611aea3a0a907ba80fe9c11e1afc7f Author: Tamar Christina Date: Wed Jan 25 12:46:52 2017 +0000 Update Input.hsc (#72) remove redundant import >--------------------------------------------------------------- 716c9a3e97611aea3a0a907ba80fe9c11e1afc7f System/Win32/Automation/Input.hsc | 1 - 1 file changed, 1 deletion(-) diff --git a/System/Win32/Automation/Input.hsc b/System/Win32/Automation/Input.hsc index a1b36fc..7f6dd59 100644 --- a/System/Win32/Automation/Input.hsc +++ b/System/Win32/Automation/Input.hsc @@ -25,7 +25,6 @@ import Graphics.Win32.Key ( VKey, c_MapVirtualKey ) import System.Win32.Automation.Input.Key import System.Win32.Automation.Input.Mouse ( MOUSEINPUT ) import System.Win32.Automation.Input.Mouse hiding ( MOUSEINPUT(..) ) -import qualified System.Win32.Automation.Input.Mouse import System.Win32.Types ( UINT, LPARAM, failIfZero ) import System.Win32.Word ( DWORD, WORD ) From git at git.haskell.org Mon Apr 17 21:28:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:28:30 +0000 (UTC) Subject: [commit: packages/Win32] depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2: Remove output check. (#73) (651b97e) Message-ID: <20170417212830.647A63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2 Link : http://git.haskell.org/packages/Win32.git/commitdiff/651b97e22ca4bd4c56136a3fa01c94332c448db2 >--------------------------------------------------------------- commit 651b97e22ca4bd4c56136a3fa01c94332c448db2 Author: Tamar Christina Date: Sat Jan 28 17:06:38 2017 +0000 Remove output check. (#73) >--------------------------------------------------------------- 651b97e22ca4bd4c56136a3fa01c94332c448db2 tests/PokeTZI.hs | 2 -- tests/PokeTZI.stdout | 2 -- 2 files changed, 4 deletions(-) diff --git a/tests/PokeTZI.hs b/tests/PokeTZI.hs index 0853ffe..72e893e 100644 --- a/tests/PokeTZI.hs +++ b/tests/PokeTZI.hs @@ -10,6 +10,4 @@ main = do alloca $ \buf -> do poke buf tzi tzi' <- peek buf - print tzi - print tzi' assert (tzi == tzi') $ return () diff --git a/tests/PokeTZI.stdout b/tests/PokeTZI.stdout deleted file mode 100644 index 6d88353..0000000 --- a/tests/PokeTZI.stdout +++ /dev/null @@ -1,2 +0,0 @@ -TIME_ZONE_INFORMATION {tziBias = 300, tziStandardName = "Eastern Standard Time", tziStandardDate = SYSTEMTIME {wYear = 0, wMonth = 11, wDayOfWeek = 0, wDay = 1, wHour = 2, wMinute = 0, wSecond = 0, wMilliseconds = 0}, tziStandardBias = 0, tziDaylightName = "Eastern Daylight Time", tziDaylightDate = SYSTEMTIME {wYear = 0, wMonth = 3, wDayOfWeek = 0, wDay = 2, wHour = 2, wMinute = 0, wSecond = 0, wMilliseconds = 0}, tziDaylightBias = -60} -TIME_ZONE_INFORMATION {tziBias = 300, tziStandardName = "Eastern Standard Time", tziStandardDate = SYSTEMTIME {wYear = 0, wMonth = 11, wDayOfWeek = 0, wDay = 1, wHour = 2, wMinute = 0, wSecond = 0, wMilliseconds = 0}, tziStandardBias = 0, tziDaylightName = "Eastern Daylight Time", tziDaylightDate = SYSTEMTIME {wYear = 0, wMonth = 3, wDayOfWeek = 0, wDay = 2, wHour = 2, wMinute = 0, wSecond = 0, wMilliseconds = 0}, tziDaylightBias = -60} From git at git.haskell.org Mon Apr 17 21:28:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:28:32 +0000 (UTC) Subject: [commit: packages/Win32] depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2: PokeTZI: Ignore stdout (#74) (2ffd9a1) Message-ID: <20170417212832.6AD473A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2 Link : http://git.haskell.org/packages/Win32.git/commitdiff/2ffd9a14270ef0be81f7abf65027cc48846cdf4c >--------------------------------------------------------------- commit 2ffd9a14270ef0be81f7abf65027cc48846cdf4c Author: Ben Gamari Date: Wed Feb 8 23:29:03 2017 +0000 PokeTZI: Ignore stdout (#74) The output of this test is timezone dependent and it already asserts that the result is reasonable. >--------------------------------------------------------------- 2ffd9a14270ef0be81f7abf65027cc48846cdf4c tests/all.T | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/all.T b/tests/all.T index 93531ae..3a1b41b 100644 --- a/tests/all.T +++ b/tests/all.T @@ -6,5 +6,5 @@ test('helloworld', skip, compile_and_run, ['-package lang -package win32']) test('lasterror', normal, compile_and_run, ['-package Win32']) test('T4452', normal, compile_and_run, ['-package Win32']) -test('PokeTZI', normal, compile_and_run, ['-package Win32']) +test('PokeTZI', ignore_stdout, compile_and_run, ['-package Win32']) test('HandleConversion', normal, compile_and_run, ['-package Win32']) From git at git.haskell.org Mon Apr 17 21:28:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:28:34 +0000 (UTC) Subject: [commit: packages/Win32] depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2: Updated for release. (#75) (a410b4e) Message-ID: <20170417212834.70DE23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2 Link : http://git.haskell.org/packages/Win32.git/commitdiff/a410b4e8276d118273d3205dc58fdc632803a71a >--------------------------------------------------------------- commit a410b4e8276d118273d3205dc58fdc632803a71a Author: Tamar Christina Date: Sat Feb 11 21:04:06 2017 +0000 Updated for release. (#75) * Updated for release. * correct version. >--------------------------------------------------------------- a410b4e8276d118273d3205dc58fdc632803a71a Win32.cabal | 2 +- changelog.md | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Win32.cabal b/Win32.cabal index 580f364..3dd32bf 100644 --- a/Win32.cabal +++ b/Win32.cabal @@ -1,5 +1,5 @@ name: Win32 -version: 2.5.0.0 +version: 2.5.1.0 license: BSD3 license-file: LICENSE author: Alastair Reid, shelarcy diff --git a/changelog.md b/changelog.md index 6f86b44..e7e4297 100644 --- a/changelog.md +++ b/changelog.md @@ -1,8 +1,9 @@ # Changelog for [`Win32` package](http://hackage.haskell.org/package/Win32) -## Unreleased GIT version +## 2.5.1.0 *Feb 2017* * Add `withHandleToHANDLE` (originally found in the `ansi-terminal` library) +* fixed `PokeTZI` test ## 2.5.0.0 *Jan 2017* From git at git.haskell.org Mon Apr 17 21:28:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:28:36 +0000 (UTC) Subject: [commit: packages/Win32] depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2: Add commandline arguments splitting. (#76) (2567e43) Message-ID: <20170417212836.7883E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2 Link : http://git.haskell.org/packages/Win32.git/commitdiff/2567e4395be97ee2bdb11c622cfbf2c549931c13 >--------------------------------------------------------------- commit 2567e4395be97ee2bdb11c622cfbf2c549931c13 Author: Tamar Christina Date: Sat Feb 18 18:07:14 2017 +0000 Add commandline arguments splitting. (#76) >--------------------------------------------------------------- 2567e4395be97ee2bdb11c622cfbf2c549931c13 System/Win32/Console.hsc | 27 +++++++++++++++++++++++++-- changelog.md | 4 ++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/System/Win32/Console.hsc b/System/Win32/Console.hsc index a40887f..42b162f 100644 --- a/System/Win32/Console.hsc +++ b/System/Win32/Console.hsc @@ -25,13 +25,22 @@ module System.Win32.Console ( setConsoleOutputCP, -- * Ctrl events CtrlEvent, cTRL_C_EVENT, cTRL_BREAK_EVENT, - generateConsoleCtrlEvent + generateConsoleCtrlEvent, + -- * Command line + commandLineToArgv ) where ##include "windows_cconv.h" import System.Win32.Types +import Foreign.C.Types (CInt(..)) +import Foreign.C.String (withCWString, CWString) +import Foreign.Ptr (Ptr) +import Foreign.Storable (peek) +import Foreign.Marshal.Array (peekArray) +import Foreign.Marshal.Alloc (alloca) + foreign import WINDOWS_CCONV unsafe "windows.h GetConsoleCP" getConsoleCP :: IO UINT @@ -59,4 +68,18 @@ generateConsoleCtrlEvent e p foreign import WINDOWS_CCONV safe "windows.h GenerateConsoleCtrlEvent" c_GenerateConsoleCtrlEvent :: CtrlEvent -> DWORD -> IO BOOL --- ToDo: lots more +foreign import WINDOWS_CCONV unsafe "Shellapi.h CommandLineToArgvW" + c_CommandLineToArgvW :: CWString -> Ptr CInt -> IO (Ptr CWString) + +-- | This function can be used to parse commandline arguments and return +-- the split up arguments as elements in a list. +commandLineToArgv :: String -> IO [String] +commandLineToArgv [] = return [] +commandLineToArgv arg = + do withCWString arg $ \c_arg -> do + alloca $ \c_size -> do + res <- c_CommandLineToArgvW c_arg c_size + size <- peek c_size + args <- peekArray (fromIntegral size) res + _ <- localFree res + mapM peekTString args \ No newline at end of file diff --git a/changelog.md b/changelog.md index e7e4297..d3069b6 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ # Changelog for [`Win32` package](http://hackage.haskell.org/package/Win32) +## Unreleased GIT version + +* Add `commandLineToArgv` + ## 2.5.1.0 *Feb 2017* * Add `withHandleToHANDLE` (originally found in the `ansi-terminal` library) From git at git.haskell.org Mon Apr 17 21:28:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:28:38 +0000 (UTC) Subject: [commit: packages/Win32] depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2: Respect signedness of literals (#78) (06d5849) Message-ID: <20170417212838.7E30E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2 Link : http://git.haskell.org/packages/Win32.git/commitdiff/06d584916a4c32e6d31b60499afd52e32e4281ef >--------------------------------------------------------------- commit 06d584916a4c32e6d31b60499afd52e32e4281ef Author: Tamar Christina Date: Tue Mar 7 22:03:17 2017 +0000 Respect signedness of literals (#78) * Use maxBound instead of (-1) to define iNVALID_HANDLE_VALUE The former results in an out-of-bounds literal warning (introduced in GHC 8.2). * Menu: Use maxBound instead of (-1) to discern error The value being compared against is unsigned so (-1) is technically out of range. * Window: Define cW_USE_DEFAULT as Int, not Word Since its value is signed. * Using NegativeLiterals * use negative number to fit bit pattern. * use negative number to fit bit pattern * Weird convoluted way to get a value with the top bit set.. * Add clarifying comment. * Mark for release. >--------------------------------------------------------------- 06d584916a4c32e6d31b60499afd52e32e4281ef Graphics/Win32/Menu.hsc | 10 +++++----- Graphics/Win32/Window.hsc | 8 ++++++-- System/Win32/Types.hsc | 2 +- Win32.cabal | 2 +- changelog.md | 3 ++- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/Graphics/Win32/Menu.hsc b/Graphics/Win32/Menu.hsc index 45e7a9e..58eef5c 100644 --- a/Graphics/Win32/Menu.hsc +++ b/Graphics/Win32/Menu.hsc @@ -79,7 +79,7 @@ type MenuName = LPCTSTR checkMenuItem :: HMENU -> MenuItem -> MenuFlag -> IO Bool checkMenuItem menu item check = do - rv <- failIf (== -1) "CheckMenuItem" $ c_CheckMenuItem menu item check + rv <- failIf (== maxBound) "CheckMenuItem" $ c_CheckMenuItem menu item check return (rv == mF_CHECKED) foreign import WINDOWS_CCONV unsafe "windows.h CheckMenuItem" c_CheckMenuItem :: HMENU -> UINT -> UINT -> IO DWORD @@ -230,13 +230,13 @@ foreign import WINDOWS_CCONV unsafe "windows.h GetMenu" getMenuDefaultItem :: HMENU -> Bool -> GMDIFlag -> IO MenuItem getMenuDefaultItem menu bypos flags = - failIf (== -1) "GetMenuDefaultItem" $ c_GetMenuDefaultItem menu bypos flags + failIf (== maxBound) "GetMenuDefaultItem" $ c_GetMenuDefaultItem menu bypos flags foreign import WINDOWS_CCONV unsafe "windows.h GetMenuDefaultItem" c_GetMenuDefaultItem :: HMENU -> Bool -> UINT -> IO UINT getMenuState :: HMENU -> MenuItem -> MenuFlag -> IO MenuState getMenuState menu item flags = - failIf (== -1) "GetMenuState" $ c_GetMenuState menu item flags + failIf (== maxBound) "GetMenuState" $ c_GetMenuState menu item flags foreign import WINDOWS_CCONV unsafe "windows.h GetMenuState" c_GetMenuState :: HMENU -> UINT -> UINT -> IO MenuState @@ -254,7 +254,7 @@ foreign import WINDOWS_CCONV unsafe "windows.h SetMenu" getMenuItemCount :: HMENU -> IO Int getMenuItemCount menu = - failIf (== -1) "GetMenuItemCount" $ c_GetMenuItemCount menu + failIf (== maxBound) "GetMenuItemCount" $ c_GetMenuItemCount menu foreign import WINDOWS_CCONV unsafe "windows.h GetMenuItemCount" c_GetMenuItemCount :: HMENU -> IO Int @@ -262,7 +262,7 @@ type MenuID = UINT getMenuItemID :: HMENU -> MenuItem -> IO MenuID getMenuItemID menu item = - failIf (== -1) "GetMenuItemID" $ c_GetMenuItemID menu item + failIf (== maxBound) "GetMenuItemID" $ c_GetMenuItemID menu item foreign import WINDOWS_CCONV unsafe "windows.h GetMenuItemID" c_GetMenuItemID :: HMENU -> UINT -> IO MenuID diff --git a/Graphics/Win32/Window.hsc b/Graphics/Win32/Window.hsc index 90fb2d2..b3abd54 100644 --- a/Graphics/Win32/Window.hsc +++ b/Graphics/Win32/Window.hsc @@ -1,4 +1,5 @@ {-# LANGUAGE CApiFFI #-} +{-# LANGUAGE NegativeLiterals #-} #if __GLASGOW_HASKELL__ >= 701 {-# LANGUAGE Trustworthy #-} #endif @@ -20,7 +21,7 @@ module Graphics.Win32.Window where import Control.Monad (liftM) import Data.Maybe (fromMaybe) -import Data.Word (Word32) +import Data.Int (Int32) import Foreign.ForeignPtr (withForeignPtr) import Foreign.Marshal.Alloc (allocaBytes) import Foreign.Ptr (FunPtr, Ptr, castFunPtrToPtr, castPtr, nullPtr) @@ -185,7 +186,10 @@ type WindowStyleEx = DWORD cW_USEDEFAULT :: Pos -- See Note [Overflow checking and fromIntegral] in Graphics/Win32/GDI/HDC.hs -cW_USEDEFAULT = fromIntegral (#{const CW_USEDEFAULT} :: Word32) +-- Weird way to essentially get a value with the top bit set. But GHC 7.8.4 was +-- rejecting all other sane attempts. +cW_USEDEFAULT = let val = negate (#{const CW_USEDEFAULT}) :: Integer + in fromIntegral (fromIntegral val :: Int32) :: Pos type Pos = Int diff --git a/System/Win32/Types.hsc b/System/Win32/Types.hsc index afefb50..0402e8e 100755 --- a/System/Win32/Types.hsc +++ b/System/Win32/Types.hsc @@ -219,7 +219,7 @@ nullFinalHANDLE :: ForeignPtr a nullFinalHANDLE = unsafePerformIO (newForeignPtr_ nullPtr) iNVALID_HANDLE_VALUE :: HANDLE -iNVALID_HANDLE_VALUE = castUINTPtrToPtr (-1) +iNVALID_HANDLE_VALUE = castUINTPtrToPtr maxBound foreign import ccall "_open_osfhandle" _open_osfhandle :: CIntPtr -> CInt -> IO CInt diff --git a/Win32.cabal b/Win32.cabal index 3dd32bf..8cbd3cb 100644 --- a/Win32.cabal +++ b/Win32.cabal @@ -1,5 +1,5 @@ name: Win32 -version: 2.5.1.0 +version: 2.5.2.0 license: BSD3 license-file: LICENSE author: Alastair Reid, shelarcy diff --git a/changelog.md b/changelog.md index d3069b6..2fff272 100644 --- a/changelog.md +++ b/changelog.md @@ -1,7 +1,8 @@ # Changelog for [`Win32` package](http://hackage.haskell.org/package/Win32) -## Unreleased GIT version +## 2.5.2.0 *March 2017* +* Fix constant underflows with (-1) and unsigned numbers. * Add `commandLineToArgv` ## 2.5.1.0 *Feb 2017* From git at git.haskell.org Mon Apr 17 21:28:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:28:40 +0000 (UTC) Subject: [commit: packages/Win32] depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2: regSetValue wasn't null terminated (#39) (4e76f05) Message-ID: <20170417212840.839B43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2 Link : http://git.haskell.org/packages/Win32.git/commitdiff/4e76f0517137239dcdbc1bb1766d876e9a9505b0 >--------------------------------------------------------------- commit 4e76f0517137239dcdbc1bb1766d876e9a9505b0 Author: Ilan Godik Date: Mon Mar 13 14:53:52 2017 -0700 regSetValue wasn't null terminated (#39) >--------------------------------------------------------------- 4e76f0517137239dcdbc1bb1766d876e9a9505b0 System/Win32/Registry.hsc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/System/Win32/Registry.hsc b/System/Win32/Registry.hsc index a345544..09fdcb8 100644 --- a/System/Win32/Registry.hsc +++ b/System/Win32/Registry.hsc @@ -72,7 +72,7 @@ import System.Win32.File (LPSECURITY_ATTRIBUTES) import System.Win32.Time (FILETIME) import System.Win32.Types (DWORD, ErrCode, HKEY, LPCTSTR, PKEY, withTString) import System.Win32.Types (HANDLE, LONG, LPBYTE, newForeignHANDLE, peekTString) -import System.Win32.Types (LPTSTR, TCHAR, failUnlessSuccess, withTStringLen) +import System.Win32.Types (LPTSTR, TCHAR, failUnlessSuccess) import System.Win32.Types (castUINTPtrToPtr, failUnlessSuccessOr, maybePtr) ##include "windows_cconv.h" @@ -477,9 +477,9 @@ regSetValue :: HKEY -> String -> String -> IO () regSetValue key subkey value = withForeignPtr key $ \ p_key -> withTString subkey $ \ c_subkey -> - withTStringLen value $ \ (c_value, value_len) -> + withTString value $ \ c_value -> failUnlessSuccess "RegSetValue" $ - c_RegSetValue p_key c_subkey rEG_SZ c_value value_len + c_RegSetValue p_key c_subkey rEG_SZ c_value 0 -- cbData is ignored, value needs to be null terminated. foreign import WINDOWS_CCONV unsafe "windows.h RegSetValueW" c_RegSetValue :: PKEY -> LPCTSTR -> DWORD -> LPCTSTR -> Int -> IO ErrCode From git at git.haskell.org Mon Apr 17 21:28:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:28:42 +0000 (UTC) Subject: [commit: packages/Win32] depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2: Add getpixel (#37) (b80b6bd) Message-ID: <20170417212842.89C683A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2 Link : http://git.haskell.org/packages/Win32.git/commitdiff/b80b6bd4eb0da179a00e102ec508b0e975cf69b9 >--------------------------------------------------------------- commit b80b6bd4eb0da179a00e102ec508b0e975cf69b9 Author: ralphmorton Date: Mon Mar 13 23:58:41 2017 +0200 Add getpixel (#37) >--------------------------------------------------------------- b80b6bd4eb0da179a00e102ec508b0e975cf69b9 Graphics/Win32/GDI/HDC.hs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Graphics/Win32/GDI/HDC.hs b/Graphics/Win32/GDI/HDC.hs index bee7572..0ed398e 100644 --- a/Graphics/Win32/GDI/HDC.hs +++ b/Graphics/Win32/GDI/HDC.hs @@ -43,6 +43,17 @@ efficient (fromIntegral is optimized away,) and conveys the idea we simply want the same representational value. -} +---------------------- +-- Implement GetPixel +---------------------- + +getPixel :: HDC -> Int -> Int -> IO COLORREF +getPixel dc x y = c_GetPixel dc x y +foreign import WINDOWS_CCONV unsafe "windows.h GetPixel" + c_GetPixel :: HDC -> Int -> Int -> IO COLORREF + +---------------------- + setArcDirection :: HDC -> ArcDirection -> IO ArcDirection setArcDirection dc dir = failIfZero "SetArcDirection" $ c_SetArcDirection dc dir From git at git.haskell.org Mon Apr 17 21:28:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:28:44 +0000 (UTC) Subject: [commit: packages/Win32] depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2: Update changelog.md (4cde0a4) Message-ID: <20170417212844.8FA823A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2 Link : http://git.haskell.org/packages/Win32.git/commitdiff/4cde0a4f121a40ab2e6bf4e7c8ca0555cbb65b9d >--------------------------------------------------------------- commit 4cde0a4f121a40ab2e6bf4e7c8ca0555cbb65b9d Author: Tamar Christina Date: Mon Mar 13 21:59:30 2017 +0000 Update changelog.md Update changelog for recent merges. >--------------------------------------------------------------- 4cde0a4f121a40ab2e6bf4e7c8ca0555cbb65b9d changelog.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/changelog.md b/changelog.md index 2fff272..f8106bd 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,10 @@ # Changelog for [`Win32` package](http://hackage.haskell.org/package/Win32) +## Unreleased GIT Version + +* Fix buffer overflow in `regSetValue`. (See #39) +* Added `getPixel`. (See #37) + ## 2.5.2.0 *March 2017* * Fix constant underflows with (-1) and unsigned numbers. From git at git.haskell.org Mon Apr 17 21:28:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:28:46 +0000 (UTC) Subject: [commit: packages/Win32] depend-os-windows, fix-appveyor-curl-ussue, master, win32-2.5.4.1-ghc-8.2: Drop ntdll dependency (#79) (67c5cc5) Message-ID: <20170417212846.963393A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: depend-os-windows,fix-appveyor-curl-ussue,master,win32-2.5.4.1-ghc-8.2 Link : http://git.haskell.org/packages/Win32.git/commitdiff/67c5cc56f0faeacc553471c8a7d9b9b95e011731 >--------------------------------------------------------------- commit 67c5cc56f0faeacc553471c8a7d9b9b95e011731 Author: Tamar Christina Date: Sat Mar 18 09:23:44 2017 +0000 Drop ntdll dependency (#79) * Drop ntdll * Expand changelog. * Make this a release. * Correct version. >--------------------------------------------------------------- 67c5cc56f0faeacc553471c8a7d9b9b95e011731 System/Win32/MinTTY.hsc | 13 +++++++++---- Win32.cabal | 4 ++-- changelog.md | 3 ++- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/System/Win32/MinTTY.hsc b/System/Win32/MinTTY.hsc index 7b1f41a..aff29d8 100644 --- a/System/Win32/MinTTY.hsc +++ b/System/Win32/MinTTY.hsc @@ -134,6 +134,9 @@ ntQueryObjectNameInformation h = do bufSize = sizeOfONI + mAX_PATH * sizeOfTCHAR allocaBytes bufSize $ \buf -> alloca $ \p_len -> do + hwnd <- getModuleHandle (Just "ntdll.exe") + addr <- getProcAddress hwnd "NtQueryObject" + let c_NtQueryObject = mk_NtQueryObject (castPtrToFunPtr addr) _ <- failIfNeg "NtQueryObject" $ c_NtQueryObject h objectNameInformation buf (fromIntegral bufSize) p_len oni <- peek buf @@ -148,6 +151,12 @@ mAX_PATH = #const MAX_PATH objectNameInformation :: CInt objectNameInformation = #const ObjectNameInformation +type F_NtQueryObject = HANDLE -> CInt -> Ptr OBJECT_NAME_INFORMATION + -> ULONG -> Ptr ULONG -> IO NTSTATUS + +foreign import WINDOWS_CCONV "dynamic" + mk_NtQueryObject :: FunPtr F_NtQueryObject -> F_NtQueryObject + type F_GetFileInformationByHandleEx = HANDLE -> CInt -> Ptr FILE_NAME_INFO -> DWORD -> IO BOOL @@ -179,10 +188,6 @@ instance Storable FILE_NAME_INFO where , fniFileName = vfniFileName } -foreign import WINDOWS_CCONV "winternl.h NtQueryObject" - c_NtQueryObject :: HANDLE -> CInt -> Ptr OBJECT_NAME_INFORMATION - -> ULONG -> Ptr ULONG -> IO NTSTATUS - type NTSTATUS = #type NTSTATUS newtype OBJECT_NAME_INFORMATION = OBJECT_NAME_INFORMATION diff --git a/Win32.cabal b/Win32.cabal index 8cbd3cb..5e144cc 100644 --- a/Win32.cabal +++ b/Win32.cabal @@ -1,5 +1,5 @@ name: Win32 -version: 2.5.2.0 +version: 2.5.3.0 license: BSD3 license-file: LICENSE author: Alastair Reid, shelarcy @@ -94,7 +94,7 @@ Library if impl(ghc >= 7.1) extensions: NondecreasingIndentation extra-libraries: - "user32", "gdi32", "winmm", "advapi32", "shell32", "shfolder", "shlwapi", "msimg32", "imm32", "ntdll" + "user32", "gdi32", "winmm", "advapi32", "shell32", "shfolder", "shlwapi", "msimg32", "imm32" ghc-options: -Wall include-dirs: include includes: "alphablend.h", "diatemp.h", "dumpBMP.h", "ellipse.h", "errors.h", "HsGDI.h", "HsWin32.h", "Win32Aux.h", "win32debug.h", "windows_cconv.h", "WndProc.h", "alignment.h" diff --git a/changelog.md b/changelog.md index f8106bd..222bd0d 100644 --- a/changelog.md +++ b/changelog.md @@ -1,9 +1,10 @@ # Changelog for [`Win32` package](http://hackage.haskell.org/package/Win32) -## Unreleased GIT Version +## 2.5.3.0 *March 2017* * Fix buffer overflow in `regSetValue`. (See #39) * Added `getPixel`. (See #37) +* Drop dependency on `ntdll` because of incorrect import library on x86. (See #79) ## 2.5.2.0 *March 2017* From git at git.haskell.org Mon Apr 17 21:28:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:28:50 +0000 (UTC) Subject: [commit: packages/Win32] fix-appveyor-curl-ussue, master: Encode platform requirement in cabal meta-data (#80) (6832841) Message-ID: <20170417212850.A20EA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: fix-appveyor-curl-ussue,master Link : http://git.haskell.org/packages/Win32.git/commitdiff/6832841df4499d30b04f012c90f12f30350a3857 >--------------------------------------------------------------- commit 6832841df4499d30b04f012c90f12f30350a3857 Author: Herbert Valerio Riedel Date: Sat Mar 18 11:23:58 2017 +0100 Encode platform requirement in cabal meta-data (#80) This mirrors a similar provision made in the `unix` recent package versions which contain the dual `if !os(windows)`-unbuildable construct. >--------------------------------------------------------------- 6832841df4499d30b04f012c90f12f30350a3857 Win32.cabal | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Win32.cabal b/Win32.cabal index 5e144cc..691625d 100644 --- a/Win32.cabal +++ b/Win32.cabal @@ -18,6 +18,11 @@ extra-source-files: changelog.md Library + if !os(windows) + -- This package requires Windows to build + build-depends: unbuildable<0 + buildable: False + build-depends: base >= 4.5 && < 5, bytestring, filepath ghc-options: -Wall -fno-warn-name-shadowing cc-options: -fno-strict-aliasing From git at git.haskell.org Mon Apr 17 21:28:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:28:48 +0000 (UTC) Subject: [commit: packages/Win32] depend-os-windows: Encode platform requirement in cabal meta-data (01de99f) Message-ID: <20170417212848.9C33B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branch : depend-os-windows Link : http://git.haskell.org/packages/Win32.git/commitdiff/01de99fd3324914dfd5df9900b0ee9e9e1727679 >--------------------------------------------------------------- commit 01de99fd3324914dfd5df9900b0ee9e9e1727679 Author: Herbert Valerio Riedel Date: Sat Mar 18 11:01:12 2017 +0100 Encode platform requirement in cabal meta-data This mirrors a similar provision made in the `unix` recent package versions which contain the dual `if !os(windows)`-unbuildable construct. >--------------------------------------------------------------- 01de99fd3324914dfd5df9900b0ee9e9e1727679 Win32.cabal | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Win32.cabal b/Win32.cabal index 5e144cc..691625d 100644 --- a/Win32.cabal +++ b/Win32.cabal @@ -18,6 +18,11 @@ extra-source-files: changelog.md Library + if !os(windows) + -- This package requires Windows to build + build-depends: unbuildable<0 + buildable: False + build-depends: base >= 4.5 && < 5, bytestring, filepath ghc-options: -Wall -fno-warn-name-shadowing cc-options: -fno-strict-aliasing From git at git.haskell.org Mon Apr 17 21:28:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:28:52 +0000 (UTC) Subject: [commit: packages/Win32] fix-appveyor-curl-ussue, master: Update README.md (a1f33d5) Message-ID: <20170417212852.A77403A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: fix-appveyor-curl-ussue,master Link : http://git.haskell.org/packages/Win32.git/commitdiff/a1f33d535341126eba5ecdfe74ba2b3c38a973ab >--------------------------------------------------------------- commit a1f33d535341126eba5ecdfe74ba2b3c38a973ab Author: Tamar Christina Date: Tue Mar 21 07:59:58 2017 +0000 Update README.md Fix license badge >--------------------------------------------------------------- a1f33d535341126eba5ecdfe74ba2b3c38a973ab README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 03f934a..3b5588c 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ The `Win32` Package ===================== -[![Hackage](https://img.shields.io/hackage/v/Win32.svg)](https://hackage.haskell.org/package/Win32) [![Code Climate](https://codeclimate.com/github/haskell/win32/badges/gpa.svg)](https://codeclimate.com/github/haskell/win32) [![Test Coverage](https://codeclimate.com/github/haskell/win32/badges/coverage.svg)](https://codeclimate.com/github/haskell/win32/coverage) [![Issue Count](https://codeclimate.com/github/haskell/win32/badges/issue_count.svg)](https://codeclimate.com/github/haskell/win32) [![License] (https://img.shields.io/packagist/l/doctrine/orm.svg)]() +[![Hackage](https://img.shields.io/hackage/v/Win32.svg)](https://hackage.haskell.org/package/Win32) [![Code Climate](https://codeclimate.com/github/haskell/win32/badges/gpa.svg)](https://codeclimate.com/github/haskell/win32) [![Test Coverage](https://codeclimate.com/github/haskell/win32/badges/coverage.svg)](https://codeclimate.com/github/haskell/win32/coverage) [![Issue Count](https://codeclimate.com/github/haskell/win32/badges/issue_count.svg)](https://codeclimate.com/github/haskell/win32) [![PyPI](https://img.shields.io/pypi/l/Django.svg)]() See [`Win32` on Hackage](http://hackage.haskell.org/package/Win32) for more information. From git at git.haskell.org Mon Apr 17 21:28:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:28:54 +0000 (UTC) Subject: [commit: packages/Win32] fix-appveyor-curl-ussue, master: Update cabal file to 1.10 format (#81) (41d4bff) Message-ID: <20170417212854.C39EB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: fix-appveyor-curl-ussue,master Link : http://git.haskell.org/packages/Win32.git/commitdiff/41d4bff11de78456160b8cebba7f2fce68aa8682 >--------------------------------------------------------------- commit 41d4bff11de78456160b8cebba7f2fce68aa8682 Author: Herbert Valerio Riedel Date: Tue Mar 21 12:10:29 2017 +0100 Update cabal file to 1.10 format (#81) >--------------------------------------------------------------- 41d4bff11de78456160b8cebba7f2fce68aa8682 Win32.cabal | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Win32.cabal b/Win32.cabal index 691625d..b36a223 100644 --- a/Win32.cabal +++ b/Win32.cabal @@ -11,13 +11,18 @@ category: System, Graphics synopsis: A binding to part of the Win32 library description: A binding to part of the Win32 library. build-type: Simple -cabal-version: >=1.6 +cabal-version: >=1.10 extra-source-files: include/diatemp.h include/dumpBMP.h include/ellipse.h include/errors.h include/Win32Aux.h include/win32debug.h include/alignment.h changelog.md Library + default-language: Haskell2010 + default-extensions: ForeignFunctionInterface, CPP + if impl(ghc >= 7.1) + default-extensions: NondecreasingIndentation + if !os(windows) -- This package requires Windows to build build-depends: unbuildable<0 @@ -95,9 +100,6 @@ Library System.Win32.Utils System.Win32.Word - extensions: ForeignFunctionInterface, CPP - if impl(ghc >= 7.1) - extensions: NondecreasingIndentation extra-libraries: "user32", "gdi32", "winmm", "advapi32", "shell32", "shfolder", "shlwapi", "msimg32", "imm32" ghc-options: -Wall From git at git.haskell.org Mon Apr 17 21:28:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:28:56 +0000 (UTC) Subject: [commit: packages/Win32] fix-appveyor-curl-ussue, master: Update changelog.md (3c10120) Message-ID: <20170417212856.CA2BC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branches: fix-appveyor-curl-ussue,master Link : http://git.haskell.org/packages/Win32.git/commitdiff/3c101206dc42eb0986da6c4977cd66255e285581 >--------------------------------------------------------------- commit 3c101206dc42eb0986da6c4977cd66255e285581 Author: Tamar Christina Date: Tue Mar 21 11:12:55 2017 +0000 Update changelog.md Add recent changes. >--------------------------------------------------------------- 3c101206dc42eb0986da6c4977cd66255e285581 changelog.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/changelog.md b/changelog.md index 222bd0d..24abe6d 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,11 @@ # Changelog for [`Win32` package](http://hackage.haskell.org/package/Win32) +## Unreleased GIT version + +* Make cabal error out on compilation on non-Windows OSes. (See #80) +* Update cabal format to 1.10 and set language + default to Haskell2010. (See #81) + ## 2.5.3.0 *March 2017* * Fix buffer overflow in `regSetValue`. (See #39) From git at git.haskell.org Mon Apr 17 21:28:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:28:58 +0000 (UTC) Subject: [commit: packages/Win32] fix-appveyor-curl-ussue: Fix AppVeyor CURL error (44be2dd) Message-ID: <20170417212858.D11383A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branch : fix-appveyor-curl-ussue Link : http://git.haskell.org/packages/Win32.git/commitdiff/44be2dd09dc2a6432f3e6956b95561f7a5b90320 >--------------------------------------------------------------- commit 44be2dd09dc2a6432f3e6956b95561f7a5b90320 Author: Tamar Christina Date: Tue Mar 21 11:42:21 2017 +0000 Fix AppVeyor CURL error http://help.appveyor.com/discussions/problems/6312-curl-command-not-found#comment_42195491 >--------------------------------------------------------------- 44be2dd09dc2a6432f3e6956b95561f7a5b90320 appveyor.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index a76c9fa..52d63f9 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -16,3 +16,6 @@ test_script: - stack init - stack setup > nul - echo "" | stack --no-terminal build + +install: +- set PATH=C:\Program Files\Git\mingw64\bin;%PATH% From git at git.haskell.org Mon Apr 17 21:29:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:29:00 +0000 (UTC) Subject: [commit: packages/Win32] master: Fix AppVeyor CURL error (#82) (2a21bb1) Message-ID: <20170417212900.D6C8C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branch : master Link : http://git.haskell.org/packages/Win32.git/commitdiff/2a21bb1d0310ae64d51a4e99068e46d306926c9f >--------------------------------------------------------------- commit 2a21bb1d0310ae64d51a4e99068e46d306926c9f Author: Tamar Christina Date: Tue Mar 21 12:07:34 2017 +0000 Fix AppVeyor CURL error (#82) http://help.appveyor.com/discussions/problems/6312-curl-command-not-found#comment_42195491 >--------------------------------------------------------------- 2a21bb1d0310ae64d51a4e99068e46d306926c9f appveyor.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index a76c9fa..52d63f9 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -16,3 +16,6 @@ test_script: - stack init - stack setup > nul - echo "" | stack --no-terminal build + +install: +- set PATH=C:\Program Files\Git\mingw64\bin;%PATH% From git at git.haskell.org Mon Apr 17 21:29:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:29:02 +0000 (UTC) Subject: [commit: packages/Win32] master: Update author and copyright (af23d52) Message-ID: <20170417212902.DD0343A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branch : master Link : http://git.haskell.org/packages/Win32.git/commitdiff/af23d52f8cba3b4b0f07db2400b681906cc32518 >--------------------------------------------------------------- commit af23d52f8cba3b4b0f07db2400b681906cc32518 Author: Tamar Christina Date: Thu Mar 23 18:52:37 2017 +0000 Update author and copyright >--------------------------------------------------------------- af23d52f8cba3b4b0f07db2400b681906cc32518 Win32.cabal | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Win32.cabal b/Win32.cabal index b36a223..11afa40 100644 --- a/Win32.cabal +++ b/Win32.cabal @@ -2,8 +2,8 @@ name: Win32 version: 2.5.3.0 license: BSD3 license-file: LICENSE -author: Alastair Reid, shelarcy -copyright: Alastair Reid, 1999-2003; shelarcy, 2012-2013 +author: Alastair Reid, shelarcy, Tamar Christina +copyright: Alastair Reid, 1999-2003; shelarcy, 2012-2013; Tamar Christina, 2016-2017 maintainer: Haskell Libraries bug-reports: https://github.com/haskell/win32/issues homepage: https://github.com/haskell/win32 From git at git.haskell.org Mon Apr 17 21:29:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:29:04 +0000 (UTC) Subject: [commit: packages/Win32] master: Nullable pointers now wrapped in Maybe (#83) (73a7b78) Message-ID: <20170417212904.E68E83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branch : master Link : http://git.haskell.org/packages/Win32.git/commitdiff/73a7b785c0683f0a3354ddf54d8d5eeeca909370 >--------------------------------------------------------------- commit 73a7b785c0683f0a3354ddf54d8d5eeeca909370 Author: Ahmad Fatoum Date: Tue Mar 28 08:06:41 2017 +0200 Nullable pointers now wrapped in Maybe (#83) A fix for Issue #24 A number of WinAPI functions have a default action, when NULL is passed in place of a valid pointer, mostly strings. We now use Maybe wrapped types for these arguments. This breaks API. In total 15 functions were amended: appendMenu insertMenu modifyMenu messageBox findWindow findWindowEx moveFileEx setDllDirectory defineDosDevice setVolumeLabel getVolumeInformation searchPath regCreateKeyEx regReplaceKey getTimeFormat And 2 functions' Maybe was removed because passing in Nothing was equal to Just "": RegQueryValue RegQueryValueKey createWindow[Ex] can also have NULL as HINSTANCE. As HINSTANCE is a pointer anyway, we'll provide a nullHINSTANCE instead of breaking this function's API too >--------------------------------------------------------------- 73a7b785c0683f0a3354ddf54d8d5eeeca909370 Graphics/Win32/Menu.hsc | 12 ++++++------ Graphics/Win32/Misc.hsc | 4 ++-- Graphics/Win32/Window.hsc | 19 ++++++++++--------- System/Win32/DLL.hsc | 7 ++++--- System/Win32/File.hsc | 14 +++++++------- System/Win32/HardLink.hs | 6 +++--- System/Win32/Info.hsc | 6 +++--- System/Win32/Registry.hsc | 24 ++++++++++++------------ System/Win32/Time.hsc | 7 ++++--- System/Win32/Types.hsc | 3 +++ changelog.md | 1 + tests/registry001.hs | 2 +- 12 files changed, 56 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 73a7b785c0683f0a3354ddf54d8d5eeeca909370 From git at git.haskell.org Mon Apr 17 21:29:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:29:06 +0000 (UTC) Subject: [commit: packages/Win32] master: Fixed pull request ID in changelog (#84) (fdb4f77) Message-ID: <20170417212906.EC71C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branch : master Link : http://git.haskell.org/packages/Win32.git/commitdiff/fdb4f773922445917889de70951a8bac74a6100f >--------------------------------------------------------------- commit fdb4f773922445917889de70951a8bac74a6100f Author: Ahmad Fatoum Date: Tue Mar 28 16:43:46 2017 +0200 Fixed pull request ID in changelog (#84) >--------------------------------------------------------------- fdb4f773922445917889de70951a8bac74a6100f changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 01a141c..916c757 100644 --- a/changelog.md +++ b/changelog.md @@ -5,7 +5,7 @@ * Make cabal error out on compilation on non-Windows OSes. (See #80) * Update cabal format to 1.10 and set language default to Haskell2010. (See #81) -* Use `Maybe` in wrappers for functions with nullable pointer parameters (See #84) +* Use `Maybe` in wrappers for functions with nullable pointer parameters (See #83) ## 2.5.3.0 *March 2017* From git at git.haskell.org Mon Apr 17 21:29:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:29:08 +0000 (UTC) Subject: [commit: packages/Win32] win32-2.5.4.1-ghc-8.2: GH85: Fix 32bit long ptr (f4f2512) Message-ID: <20170417212908.F1D4F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branch : win32-2.5.4.1-ghc-8.2 Link : http://git.haskell.org/packages/Win32.git/commitdiff/f4f2512ba9618c40fb911ab386996a3dbbd609be >--------------------------------------------------------------- commit f4f2512ba9618c40fb911ab386996a3dbbd609be Author: Tamar Christina Date: Mon Apr 3 20:50:14 2017 +0100 GH85: Fix 32bit long ptr >--------------------------------------------------------------- f4f2512ba9618c40fb911ab386996a3dbbd609be Graphics/Win32/LayeredWindow.hsc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Graphics/Win32/LayeredWindow.hsc b/Graphics/Win32/LayeredWindow.hsc index b811150..9bd9906 100644 --- a/Graphics/Win32/LayeredWindow.hsc +++ b/Graphics/Win32/LayeredWindow.hsc @@ -52,8 +52,13 @@ foreign import WINDOWS_CCONV unsafe "windows.h GetLayeredWindowAttributes" foreign import WINDOWS_CCONV unsafe "windows.h UpdateLayeredWindow" c_UpdateLayeredWindow :: HANDLE -> HDC -> Ptr POINT -> Ptr SIZE -> HDC -> Ptr POINT -> COLORREF -> Ptr BLENDFUNCTION -> DWORD -> IO BOOL +#if defined(x86_64_HOST_ARCH) foreign import WINDOWS_CCONV "windows.h GetWindowLongPtrW" c_GetWindowLongPtr :: HANDLE -> INT -> IO LONG_PTR +#else +foreign import WINDOWS_CCONV "windows.h GetWindowLongW" + c_GetWindowLongPtr :: HANDLE -> INT -> IO LONG_PTR +#endif #{enum DWORD, , uLW_ALPHA = ULW_ALPHA From git at git.haskell.org Mon Apr 17 21:29:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:29:11 +0000 (UTC) Subject: [commit: packages/Win32] win32-2.5.4.1-ghc-8.2: bump cabal file. (c34b33c) Message-ID: <20170417212911.03F793A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branch : win32-2.5.4.1-ghc-8.2 Link : http://git.haskell.org/packages/Win32.git/commitdiff/c34b33c59a7a833f459380aa26fede13678d478c >--------------------------------------------------------------- commit c34b33c59a7a833f459380aa26fede13678d478c Author: Tamar Christina Date: Mon Apr 3 20:59:05 2017 +0100 bump cabal file. >--------------------------------------------------------------- c34b33c59a7a833f459380aa26fede13678d478c Win32.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Win32.cabal b/Win32.cabal index 5e144cc..baaf5ba 100644 --- a/Win32.cabal +++ b/Win32.cabal @@ -1,5 +1,5 @@ name: Win32 -version: 2.5.3.0 +version: 2.5.4.0 license: BSD3 license-file: LICENSE author: Alastair Reid, shelarcy From git at git.haskell.org Mon Apr 17 21:29:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:29:13 +0000 (UTC) Subject: [commit: packages/Win32] win32-2.5.4.1-ghc-8.2: Update changelog. (0ea7f56) Message-ID: <20170417212913.09C273A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branch : win32-2.5.4.1-ghc-8.2 Link : http://git.haskell.org/packages/Win32.git/commitdiff/0ea7f56b9019dbb4eeb9b5594636e1e45ccad060 >--------------------------------------------------------------- commit 0ea7f56b9019dbb4eeb9b5594636e1e45ccad060 Author: Tamar Christina Date: Mon Apr 3 21:25:41 2017 +0100 Update changelog. >--------------------------------------------------------------- 0ea7f56b9019dbb4eeb9b5594636e1e45ccad060 changelog.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/changelog.md b/changelog.md index 222bd0d..c98fe74 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ # Changelog for [`Win32` package](http://hackage.haskell.org/package/Win32) +## 2.5.4.0 *April 2017* + +* Fixed GetWindowLong on 32-bit Windows + ## 2.5.3.0 *March 2017* * Fix buffer overflow in `regSetValue`. (See #39) From git at git.haskell.org Mon Apr 17 21:29:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:29:15 +0000 (UTC) Subject: [commit: packages/Win32] win32-2.5.4.1-ghc-8.2: mark update to package. (b5ebb64) Message-ID: <20170417212915.0F7593A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branch : win32-2.5.4.1-ghc-8.2 Link : http://git.haskell.org/packages/Win32.git/commitdiff/b5ebb64894cf166f9ee84ee91802486c76e480cf >--------------------------------------------------------------- commit b5ebb64894cf166f9ee84ee91802486c76e480cf Author: Tamar Christina Date: Mon Apr 3 23:14:59 2017 +0100 mark update to package. >--------------------------------------------------------------- b5ebb64894cf166f9ee84ee91802486c76e480cf Win32.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Win32.cabal b/Win32.cabal index baaf5ba..b646e45 100644 --- a/Win32.cabal +++ b/Win32.cabal @@ -1,5 +1,5 @@ name: Win32 -version: 2.5.4.0 +version: 2.5.4.1 license: BSD3 license-file: LICENSE author: Alastair Reid, shelarcy From git at git.haskell.org Mon Apr 17 21:29:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:29:19 +0000 (UTC) Subject: [commit: packages/Win32] win32-2.5.4.1-ghc-8.2: Update version in changelog. (147a0af) Message-ID: <20170417212919.1AF793A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branch : win32-2.5.4.1-ghc-8.2 Link : http://git.haskell.org/packages/Win32.git/commitdiff/147a0af92ac74ec58b209e16aeb1cf03bddf9482 >--------------------------------------------------------------- commit 147a0af92ac74ec58b209e16aeb1cf03bddf9482 Author: Team City CI agent Date: Tue Apr 4 00:41:32 2017 +0100 Update version in changelog. >--------------------------------------------------------------- 147a0af92ac74ec58b209e16aeb1cf03bddf9482 changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index c98fe74..44b791c 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,6 @@ # Changelog for [`Win32` package](http://hackage.haskell.org/package/Win32) -## 2.5.4.0 *April 2017* +## 2.5.4.1 *April 2017* * Fixed GetWindowLong on 32-bit Windows From git at git.haskell.org Mon Apr 17 21:29:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:29:17 +0000 (UTC) Subject: [commit: packages/Win32] master: Pick Win32 2.5.4.1 to master. (9cd8da7) Message-ID: <20170417212917.156DB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branch : master Link : http://git.haskell.org/packages/Win32.git/commitdiff/9cd8da76146ef50f0834c129a38472d48009ba66 >--------------------------------------------------------------- commit 9cd8da76146ef50f0834c129a38472d48009ba66 Author: Tamar Christina Date: Tue Apr 4 00:10:31 2017 +0100 Pick Win32 2.5.4.1 to master. >--------------------------------------------------------------- 9cd8da76146ef50f0834c129a38472d48009ba66 Graphics/Win32/LayeredWindow.hsc | 5 +++++ changelog.md | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/Graphics/Win32/LayeredWindow.hsc b/Graphics/Win32/LayeredWindow.hsc index b811150..9bd9906 100644 --- a/Graphics/Win32/LayeredWindow.hsc +++ b/Graphics/Win32/LayeredWindow.hsc @@ -52,8 +52,13 @@ foreign import WINDOWS_CCONV unsafe "windows.h GetLayeredWindowAttributes" foreign import WINDOWS_CCONV unsafe "windows.h UpdateLayeredWindow" c_UpdateLayeredWindow :: HANDLE -> HDC -> Ptr POINT -> Ptr SIZE -> HDC -> Ptr POINT -> COLORREF -> Ptr BLENDFUNCTION -> DWORD -> IO BOOL +#if defined(x86_64_HOST_ARCH) foreign import WINDOWS_CCONV "windows.h GetWindowLongPtrW" c_GetWindowLongPtr :: HANDLE -> INT -> IO LONG_PTR +#else +foreign import WINDOWS_CCONV "windows.h GetWindowLongW" + c_GetWindowLongPtr :: HANDLE -> INT -> IO LONG_PTR +#endif #{enum DWORD, , uLW_ALPHA = ULW_ALPHA diff --git a/changelog.md b/changelog.md index 916c757..567c357 100644 --- a/changelog.md +++ b/changelog.md @@ -7,6 +7,10 @@ default to Haskell2010. (See #81) * Use `Maybe` in wrappers for functions with nullable pointer parameters (See #83) +## 2.5.4.1 *April 2017* + +* Fixed GetWindowLong on 32-bit Windows + ## 2.5.3.0 *March 2017* * Fix buffer overflow in `regSetValue`. (See #39) From git at git.haskell.org Mon Apr 17 21:30:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:30:00 +0000 (UTC) Subject: [commit: packages/binary] tag 'binary-0.8.5.1-release' created Message-ID: <20170417213000.340643A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/binary New tag : binary-0.8.5.1-release Referencing: e849f0afc181ae02caad32cbe707d9e4f43df0bd From git at git.haskell.org Mon Apr 17 21:30:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:30:58 +0000 (UTC) Subject: [commit: packages/bytestring] tag '0.10.8.2' created Message-ID: <20170417213058.D1C533A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring New tag : 0.10.8.2 Referencing: 5428b61e27c02c3ce369a67d22ef207a0a6789e1 From git at git.haskell.org Mon Apr 17 21:31:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:31:00 +0000 (UTC) Subject: [commit: packages/bytestring] master: travis: Use Cabal 1.24 when building for GHC HEAD (acc6924) Message-ID: <20170417213100.DC3343A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : master Link : http://git.haskell.org/packages/bytestring.git/commitdiff/acc6924029822965a3d2fac2d975e5623fa3f1c4 >--------------------------------------------------------------- commit acc6924029822965a3d2fac2d975e5623fa3f1c4 Author: Ben Gamari Date: Mon May 16 13:32:23 2016 +0200 travis: Use Cabal 1.24 when building for GHC HEAD >--------------------------------------------------------------- acc6924029822965a3d2fac2d975e5623fa3f1c4 .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 421cfff..6d47092 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,11 +7,11 @@ env: - GHCVER=7.6.3 CABALVER=1.16 - GHCVER=7.8.2 CABALVER=1.18 - GHCVER=7.8.3 CABALVER=1.18 - - GHCVER=head CABALVER=1.20 + - GHCVER=head CABALVER=1.24 matrix: allow_failures: - - env: GHCVER=head CABALVER=1.20 + - env: GHCVER=head CABALVER=1.24 before_install: - travis_retry sudo add-apt-repository -y ppa:hvr/ghc From git at git.haskell.org Mon Apr 17 21:31:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:31:02 +0000 (UTC) Subject: [commit: packages/bytestring] master: Merge pull request #75 from bgamari/fix-travis-head (664e61f) Message-ID: <20170417213102.E65D43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : master Link : http://git.haskell.org/packages/bytestring.git/commitdiff/664e61f5b60dec1b07916592569ba3c9661f131c >--------------------------------------------------------------- commit 664e61f5b60dec1b07916592569ba3c9661f131c Merge: 84253da acc6924 Author: Duncan Coutts Date: Mon May 16 15:45:17 2016 +0100 Merge pull request #75 from bgamari/fix-travis-head travis: Use Cabal 1.24 when building for GHC HEAD >--------------------------------------------------------------- 664e61f5b60dec1b07916592569ba3c9661f131c .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) From git at git.haskell.org Mon Apr 17 21:31:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:31:04 +0000 (UTC) Subject: [commit: packages/bytestring] master: Fix: #12084 deprecate old profiling flags (afde4e4) Message-ID: <20170417213104.EE2D33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : master Link : http://git.haskell.org/packages/bytestring.git/commitdiff/afde4e45af0353209a61c3efa5cb6033f6449f5b >--------------------------------------------------------------- commit afde4e45af0353209a61c3efa5cb6033f6449f5b Author: Seraphime Kirkovski Date: Sun May 22 17:43:14 2016 +0200 Fix: #12084 deprecate old profiling flags >--------------------------------------------------------------- afde4e45af0353209a61c3efa5cb6033f6449f5b tests/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Makefile b/tests/Makefile index ffd6115..858f830 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -112,12 +112,12 @@ fusionbench:: prof:: @if [ ! -f "bigdata" ] ; then ln -s data bigdata ; fi - ${GHC} ${PKG} ${GHCFLAGS} -prof -auto-all --make Bench.hs -o bench + ${GHC} ${PKG} ${GHCFLAGS} -prof -fprof-auto --make Bench.hs -o bench ./bench +RTS -H64m -p fusionprof:: @if [ ! -f "bigdata" ] ; then ln -s data bigdata ; fi - ${GHC} ${PKG} ${GHCFLAGS} -prof -auto-all --make FusionBench.hs -o fusionbench + ${GHC} ${PKG} ${GHCFLAGS} -prof -fprof-auto --make FusionBench.hs -o fusionbench ./bench +RTS -H64m -p # --------------------------------------------------------- From git at git.haskell.org Mon Apr 17 21:31:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:31:07 +0000 (UTC) Subject: [commit: packages/bytestring] master: Merge pull request #76 from Seraphime/trac-fix-12084 (2dd8462) Message-ID: <20170417213107.0310F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : master Link : http://git.haskell.org/packages/bytestring.git/commitdiff/2dd846268e97a5ade0f68af341d760b96873cdf0 >--------------------------------------------------------------- commit 2dd846268e97a5ade0f68af341d760b96873cdf0 Merge: 664e61f afde4e4 Author: Duncan Coutts Date: Wed Jun 1 14:07:18 2016 +0100 Merge pull request #76 from Seraphime/trac-fix-12084 Fix: #12084 deprecate old profiling flags >--------------------------------------------------------------- 2dd846268e97a5ade0f68af341d760b96873cdf0 tests/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) From git at git.haskell.org Mon Apr 17 21:31:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:31:09 +0000 (UTC) Subject: [commit: packages/bytestring] master: Add documentation for Lazy hPut (ff9ea20) Message-ID: <20170417213109.0CD8B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : master Link : http://git.haskell.org/packages/bytestring.git/commitdiff/ff9ea20972b82df46f5e0c49960a9c2d3c3f9282 >--------------------------------------------------------------- commit ff9ea20972b82df46f5e0c49960a9c2d3c3f9282 Author: Nicolas Mattia Date: Sun Jun 12 21:30:35 2016 +0100 Add documentation for Lazy hPut >--------------------------------------------------------------- ff9ea20972b82df46f5e0c49960a9c2d3c3f9282 Data/ByteString/Lazy.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Data/ByteString/Lazy.hs b/Data/ByteString/Lazy.hs index 01d4c1c..9cf3ac5 100644 --- a/Data/ByteString/Lazy.hs +++ b/Data/ByteString/Lazy.hs @@ -1261,7 +1261,9 @@ appendFile f txt = bracket (openBinaryFile f AppendMode) hClose getContents :: IO ByteString getContents = hGetContents stdin --- | Outputs a 'ByteString' to the specified 'Handle'. +-- | Outputs a 'ByteString' to the specified 'Handle'. The chunks will be +-- written one at a time. Other threads might write to the 'Handle' between the +-- writes, and hence 'hPut' alone might not be suitable for concurrent writes. -- hPut :: Handle -> ByteString -> IO () hPut h cs = foldrChunks (\c rest -> S.hPut h c >> rest) (return ()) cs From git at git.haskell.org Mon Apr 17 21:31:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:31:11 +0000 (UTC) Subject: [commit: packages/bytestring] master: Bump test-builder dlist upper bound to 0.9 (71e5326) Message-ID: <20170417213111.151913A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : master Link : http://git.haskell.org/packages/bytestring.git/commitdiff/71e53265590b41aecd658523320b082477a570fd >--------------------------------------------------------------- commit 71e53265590b41aecd658523320b082477a570fd Author: Sean Leather Date: Mon Jul 18 08:36:32 2016 +0200 Bump test-builder dlist upper bound to 0.9 >--------------------------------------------------------------- 71e53265590b41aecd658523320b082477a570fd bytestring.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bytestring.cabal b/bytestring.cabal index 5890959..b47bc9f 100644 --- a/bytestring.cabal +++ b/bytestring.cabal @@ -200,7 +200,7 @@ test-suite test-builder deepseq, QuickCheck >= 2.4, byteorder == 1.0.*, - dlist >= 0.5 && < 0.8, + dlist >= 0.5 && < 0.9, directory, mtl >= 2.0 && < 2.3, HUnit, From git at git.haskell.org Mon Apr 17 21:31:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:31:13 +0000 (UTC) Subject: [commit: packages/bytestring] master: travis: Fix for newer GHC/Cabal (ed766dd) Message-ID: <20170417213113.1E7393A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : master Link : http://git.haskell.org/packages/bytestring.git/commitdiff/ed766dd060d00a6c13c4ef760b5572e6dc80a24b >--------------------------------------------------------------- commit ed766dd060d00a6c13c4ef760b5572e6dc80a24b Author: Sean Leather Date: Mon Jul 18 09:34:10 2016 +0200 travis: Fix for newer GHC/Cabal >--------------------------------------------------------------- ed766dd060d00a6c13c4ef760b5572e6dc80a24b .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6d47092..2c1c793 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,7 +23,7 @@ before_install: install: - travis_retry cabal update # can't use "cabal install --only-dependencies --enable-tests" due to dep-cycle - - cabal install "QuickCheck >=2.4" "byteorder ==1.0.*" "dlist ==0.5.*" "mtl >=2.0 && <2.2" deepseq test-framework-hunit test-framework-quickcheck2 + - cabal install "QuickCheck >=2.4" "byteorder ==1.0.*" "dlist >=0.5 && <0.8" "mtl >=2.0 && <2.3" deepseq test-framework-hunit test-framework-quickcheck2 script: - cabal configure --enable-tests -v2 @@ -39,7 +39,7 @@ script: - export SRC_TGZ=$(cabal info . | awk '{print $2 ".tar.gz";exit}') ; cd dist/; if [ -f "$SRC_TGZ" ]; then - cabal install "$SRC_TGZ"; + cabal install --force-reinstalls "$SRC_TGZ"; else echo "expected '$SRC_TGZ' not found"; exit 1; From git at git.haskell.org Mon Apr 17 21:31:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:31:15 +0000 (UTC) Subject: [commit: packages/bytestring] master: travis: Add GHC 8.0.1 (b87a07e) Message-ID: <20170417213115.27D943A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : master Link : http://git.haskell.org/packages/bytestring.git/commitdiff/b87a07e4c7a3c79e6260b15b2475c426e71f165f >--------------------------------------------------------------- commit b87a07e4c7a3c79e6260b15b2475c426e71f165f Author: Sean Leather Date: Mon Jul 18 10:48:39 2016 +0200 travis: Add GHC 8.0.1 >--------------------------------------------------------------- b87a07e4c7a3c79e6260b15b2475c426e71f165f .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 2c1c793..4eab416 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,7 @@ env: - GHCVER=7.6.3 CABALVER=1.16 - GHCVER=7.8.2 CABALVER=1.18 - GHCVER=7.8.3 CABALVER=1.18 + - GHCVER=8.0.1 CABALVER=1.24 - GHCVER=head CABALVER=1.24 matrix: From git at git.haskell.org Mon Apr 17 21:31:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:31:17 +0000 (UTC) Subject: [commit: packages/bytestring] master: Merge pull request #84 from spl/patch-1 (11a3561) Message-ID: <20170417213117.30E8C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : master Link : http://git.haskell.org/packages/bytestring.git/commitdiff/11a35610369467837ed71db0c542abacad3970f7 >--------------------------------------------------------------- commit 11a35610369467837ed71db0c542abacad3970f7 Merge: 2dd8462 71e5326 Author: Duncan Coutts Date: Thu Sep 1 14:14:33 2016 +0100 Merge pull request #84 from spl/patch-1 Bump test-builder dlist upper bound to 0.9 >--------------------------------------------------------------- 11a35610369467837ed71db0c542abacad3970f7 bytestring.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) From git at git.haskell.org Mon Apr 17 21:31:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:31:19 +0000 (UTC) Subject: [commit: packages/bytestring] master: Merge pull request #85 from spl/patch-2 (41ede5f) Message-ID: <20170417213119.39D4B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : master Link : http://git.haskell.org/packages/bytestring.git/commitdiff/41ede5ff33720540047eb480283707e8cbd9abed >--------------------------------------------------------------- commit 41ede5ff33720540047eb480283707e8cbd9abed Merge: 11a3561 b87a07e Author: Duncan Coutts Date: Thu Sep 1 14:16:07 2016 +0100 Merge pull request #85 from spl/patch-2 travis: Fix for newer GHC/Cabal >--------------------------------------------------------------- 41ede5ff33720540047eb480283707e8cbd9abed .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) From git at git.haskell.org Mon Apr 17 21:31:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:31:21 +0000 (UTC) Subject: [commit: packages/bytestring] master: Merge pull request #82 from nmattia/document-concurrent-hput (acff189) Message-ID: <20170417213121.4565A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : master Link : http://git.haskell.org/packages/bytestring.git/commitdiff/acff1898d6de16014eb6ad492260aa0ef8076705 >--------------------------------------------------------------- commit acff1898d6de16014eb6ad492260aa0ef8076705 Merge: 41ede5f ff9ea20 Author: Duncan Coutts Date: Thu Sep 1 14:17:35 2016 +0100 Merge pull request #82 from nmattia/document-concurrent-hput Add documentation for Lazy hPut >--------------------------------------------------------------- acff1898d6de16014eb6ad492260aa0ef8076705 Data/ByteString/Lazy.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) From git at git.haskell.org Mon Apr 17 21:31:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:31:23 +0000 (UTC) Subject: [commit: packages/bytestring] master: Various small refactorings. (5dd1ccc) Message-ID: <20170417213123.567313A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : master Link : http://git.haskell.org/packages/bytestring.git/commitdiff/5dd1ccc79f1500e01e0c1108bcbe0405bc853ac9 >--------------------------------------------------------------- commit 5dd1ccc79f1500e01e0c1108bcbe0405bc853ac9 Author: Sean Date: Mon May 23 14:21:52 2016 +0100 Various small refactorings. Including: Fix tests. Incorporate feedback. >--------------------------------------------------------------- 5dd1ccc79f1500e01e0c1108bcbe0405bc853ac9 Data/ByteString.hs | 49 +++++++++++++++++-------------------- Data/ByteString/Builder/Internal.hs | 4 +-- Data/ByteString/Char8.hs | 29 +++++++++++----------- Data/ByteString/Internal.hs | 32 ++++++++++++------------ Data/ByteString/Lazy.hs | 36 +++++++++++++-------------- Data/ByteString/Lazy/Char8.hs | 28 ++++++--------------- Data/ByteString/Lazy/Internal.hs | 11 ++++----- Data/ByteString/Short/Internal.hs | 16 +++++------- tests/Properties.hs | 4 +-- 9 files changed, 92 insertions(+), 117 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 5dd1ccc79f1500e01e0c1108bcbe0405bc853ac9 From git at git.haskell.org Mon Apr 17 21:31:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:31:25 +0000 (UTC) Subject: [commit: packages/bytestring] master: Merge branch 'SeanRBurton-master' (18115dd) Message-ID: <20170417213125.630BF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : master Link : http://git.haskell.org/packages/bytestring.git/commitdiff/18115dd82d05b95545c8547691294c1354fcf73a >--------------------------------------------------------------- commit 18115dd82d05b95545c8547691294c1354fcf73a Merge: acff189 5dd1ccc Author: Duncan Coutts Date: Thu Sep 1 14:31:24 2016 +0100 Merge branch 'SeanRBurton-master' >--------------------------------------------------------------- 18115dd82d05b95545c8547691294c1354fcf73a Data/ByteString.hs | 49 +++++++++++++++++-------------------- Data/ByteString/Builder/Internal.hs | 4 +-- Data/ByteString/Char8.hs | 29 +++++++++++----------- Data/ByteString/Internal.hs | 32 ++++++++++++------------ Data/ByteString/Lazy.hs | 36 +++++++++++++-------------- Data/ByteString/Lazy/Char8.hs | 28 ++++++--------------- Data/ByteString/Lazy/Internal.hs | 11 ++++----- Data/ByteString/Short/Internal.hs | 16 +++++------- tests/Properties.hs | 4 +-- 9 files changed, 92 insertions(+), 117 deletions(-) From git at git.haskell.org Mon Apr 17 21:31:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:31:27 +0000 (UTC) Subject: [commit: packages/bytestring] master: Catch IOException from hFileSize in readFile (7223f8f) Message-ID: <20170417213127.6CA943A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : master Link : http://git.haskell.org/packages/bytestring.git/commitdiff/7223f8f6d921e4c2fb118de95e65ab9f27307238 >--------------------------------------------------------------- commit 7223f8f6d921e4c2fb118de95e65ab9f27307238 Author: Ossi Herrala Date: Thu Sep 1 17:16:34 2016 +0300 Catch IOException from hFileSize in readFile hFileSize only works for regular files and fails for example with /dev/null. However, hFileSize is only used as a hint for how much to read. It should be safe to ignore the exception and try reading the given file anyway. Fixes #67 >--------------------------------------------------------------- 7223f8f6d921e4c2fb118de95e65ab9f27307238 Data/ByteString.hs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Data/ByteString.hs b/Data/ByteString.hs index 99c7e38..0b74c64 100644 --- a/Data/ByteString.hs +++ b/Data/ByteString.hs @@ -217,7 +217,7 @@ import Prelude hiding (reverse,head,tail,last,init,null ,scanl,scanl1,scanr,scanr1 ,readFile,writeFile,appendFile,replicate ,getContents,getLine,putStr,putStrLn,interact - ,zip,zipWith,unzip,notElem) + ,zip,zipWith,unzip,notElem,catch) #if MIN_VERSION_base(4,7,0) import Data.Bits (finiteBitSize, shiftL, (.|.), (.&.)) @@ -233,7 +233,7 @@ import qualified Data.List as List import Data.Word (Word8) import Data.Maybe (isJust) -import Control.Exception (finally, assert, throwIO) +import Control.Exception (IOException, catch, finally, assert, throwIO) import Control.Monad (when) import Foreign.C.String (CString, CStringLen) @@ -1817,13 +1817,18 @@ interact transformer = putStr . transformer =<< getContents readFile :: FilePath -> IO ByteString readFile f = withBinaryFile f ReadMode $ \h -> do - filesz <- hFileSize h + -- hFileSize fails if file is not regular file (like + -- /dev/null). Catch exception and try reading anyway. + filesz <- catch (hFileSize h) useZeroIfNotRegularFile let readsz = (fromIntegral filesz `max` 0) + 1 hGetContentsSizeHint h readsz (readsz `max` 255) -- Our initial size is one bigger than the file size so that in the -- typical case we will read the whole file in one go and not have -- to allocate any more chunks. We'll still do the right thing if the -- file size is 0 or is changed before we do the read. + where + useZeroIfNotRegularFile :: IOException -> IO Integer + useZeroIfNotRegularFile _ = return 0 modifyFile :: IOMode -> FilePath -> ByteString -> IO () modifyFile mode f txt = withBinaryFile f mode (`hPut` txt) From git at git.haskell.org Mon Apr 17 21:31:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:31:29 +0000 (UTC) Subject: [commit: packages/bytestring] master: Add GHC 7.10.3 and GHC 7.8.4 to Travis. Drop other GHC 7.8.x (e9daf2c) Message-ID: <20170417213129.75F153A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : master Link : http://git.haskell.org/packages/bytestring.git/commitdiff/e9daf2cf1f3f10daba9ab87c40c0ec04a321fed0 >--------------------------------------------------------------- commit e9daf2cf1f3f10daba9ab87c40c0ec04a321fed0 Author: Ossi Herrala Date: Thu Sep 1 20:28:19 2016 +0300 Add GHC 7.10.3 and GHC 7.8.4 to Travis. Drop other GHC 7.8.x >--------------------------------------------------------------- e9daf2cf1f3f10daba9ab87c40c0ec04a321fed0 .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4eab416..f421a73 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,8 +5,8 @@ env: - GHCVER=7.2.2 CABALVER=1.16 - GHCVER=7.4.2 CABALVER=1.16 - GHCVER=7.6.3 CABALVER=1.16 - - GHCVER=7.8.2 CABALVER=1.18 - - GHCVER=7.8.3 CABALVER=1.18 + - GHCVER=7.8.4 CABALVER=1.18 + - GHCVER=7.10.3 CABALVER=1.22 - GHCVER=8.0.1 CABALVER=1.24 - GHCVER=head CABALVER=1.24 From git at git.haskell.org Mon Apr 17 21:31:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:31:31 +0000 (UTC) Subject: [commit: packages/bytestring] master: Fix #86, remark on lifetime properties of CString. (00902c5) Message-ID: <20170417213131.7FFCD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : master Link : http://git.haskell.org/packages/bytestring.git/commitdiff/00902c50959f801f1f014ee16aac2de90fb16874 >--------------------------------------------------------------- commit 00902c50959f801f1f014ee16aac2de90fb16874 Author: Edward Z. Yang Date: Thu Sep 1 21:36:57 2016 -0700 Fix #86, remark on lifetime properties of CString. Signed-off-by: Edward Z. Yang >--------------------------------------------------------------- 00902c50959f801f1f014ee16aac2de90fb16874 Data/ByteString.hs | 4 +++- Data/ByteString/Unsafe.hs | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Data/ByteString.hs b/Data/ByteString.hs index 99c7e38..8c9462b 100644 --- a/Data/ByteString.hs +++ b/Data/ByteString.hs @@ -1533,7 +1533,8 @@ sort (PS input s l) = unsafeCreate l $ \p -> allocaArray 256 $ \arr -> do -- | /O(n) construction/ Use a @ByteString@ with a function requiring a -- null-terminated @CString at . The @CString@ is a copy and will be freed --- automatically. +-- automatically; it must not be stored or used after the +-- subcomputation finishes. useAsCString :: ByteString -> (CString -> IO a) -> IO a useAsCString (PS fp o l) action = allocaBytes (l+1) $ \buf -> @@ -1544,6 +1545,7 @@ useAsCString (PS fp o l) action = -- | /O(n) construction/ Use a @ByteString@ with a function requiring a @CStringLen at . -- As for @useAsCString@ this function makes a copy of the original @ByteString at . +-- It must not be stored or used after the subcomputation finishes. useAsCStringLen :: ByteString -> (CStringLen -> IO a) -> IO a useAsCStringLen p@(PS _ _ l) f = useAsCString p $ \cstr -> f (cstr,l) diff --git a/Data/ByteString/Unsafe.hs b/Data/ByteString/Unsafe.hs index a0a1da8..782a42d 100644 --- a/Data/ByteString/Unsafe.hs +++ b/Data/ByteString/Unsafe.hs @@ -260,6 +260,10 @@ unsafePackMallocCStringLen (cstr, len) = do -- to guarantee that the @ByteString@ is indeed null terminated. If in -- doubt, use @useAsCString at . -- +-- * The memory may freed at any point after the subcomputation +-- terminates, so the pointer to the storage must *not* be used +-- after this. +-- unsafeUseAsCString :: ByteString -> (CString -> IO a) -> IO a unsafeUseAsCString (PS ps s _) ac = withForeignPtr ps $ \p -> ac (castPtr p `plusPtr` s) From git at git.haskell.org Mon Apr 17 21:31:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:31:33 +0000 (UTC) Subject: [commit: packages/bytestring] master: Fix GHC 7.0.1 build by working around Trac #4498 (0671e33) Message-ID: <20170417213133.8A48E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : master Link : http://git.haskell.org/packages/bytestring.git/commitdiff/0671e336d222b547b0c82974990f5aacddff963f >--------------------------------------------------------------- commit 0671e336d222b547b0c82974990f5aacddff963f Author: Ryan Scott Date: Sun Sep 4 12:05:24 2016 -0400 Fix GHC 7.0.1 build by working around Trac #4498 >--------------------------------------------------------------- 0671e336d222b547b0c82974990f5aacddff963f Data/ByteString/Builder/Internal.hs | 4 ++++ Data/ByteString/Builder/Prim.hs | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/Data/ByteString/Builder/Internal.hs b/Data/ByteString/Builder/Internal.hs index 970928d..90b35c6 100644 --- a/Data/ByteString/Builder/Internal.hs +++ b/Data/ByteString/Builder/Internal.hs @@ -1,4 +1,8 @@ {-# LANGUAGE ScopedTypeVariables, CPP, BangPatterns, RankNTypes #-} +#if __GLASGOW_HASKELL__ == 700 +-- This is needed as a workaround for an old bug in GHC 7.0.1 (Trac #4498) +{-# LANGUAGE MonoPatBinds #-} +#endif #if __GLASGOW_HASKELL__ >= 703 {-# LANGUAGE Unsafe #-} #endif diff --git a/Data/ByteString/Builder/Prim.hs b/Data/ByteString/Builder/Prim.hs index 22a4b8f..777b309 100644 --- a/Data/ByteString/Builder/Prim.hs +++ b/Data/ByteString/Builder/Prim.hs @@ -1,5 +1,9 @@ {-# LANGUAGE CPP, BangPatterns, ScopedTypeVariables #-} {-# OPTIONS_GHC -fno-warn-unused-imports #-} +#if __GLASGOW_HASKELL__ == 700 +-- This is needed as a workaround for an old bug in GHC 7.0.1 (Trac #4498) +{-# LANGUAGE MonoPatBinds #-} +#endif #if __GLASGOW_HASKELL__ >= 701 {-# LANGUAGE Trustworthy #-} #endif From git at git.haskell.org Mon Apr 17 21:31:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:31:35 +0000 (UTC) Subject: [commit: packages/bytestring] master: Data.ByteString.Char8 uses IO functions exported from Data.ByteString (2fba115) Message-ID: <20170417213135.9623C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : master Link : http://git.haskell.org/packages/bytestring.git/commitdiff/2fba115881b2da32ce076c1114ad6fe8d893086b >--------------------------------------------------------------- commit 2fba115881b2da32ce076c1114ad6fe8d893086b Author: Travis Whitaker Date: Tue Sep 20 17:09:59 2016 -0400 Data.ByteString.Char8 uses IO functions exported from Data.ByteString >--------------------------------------------------------------- 2fba115881b2da32ce076c1114ad6fe8d893086b Data/ByteString/Char8.hs | 38 +++----------------------------------- 1 file changed, 3 insertions(+), 35 deletions(-) diff --git a/Data/ByteString/Char8.hs b/Data/ByteString/Char8.hs index 5959c75..f548a5e 100644 --- a/Data/ByteString/Char8.hs +++ b/Data/ByteString/Char8.hs @@ -248,9 +248,10 @@ import Data.ByteString (empty,null,length,tail,init,append ,findSubstring,findSubstrings,breakSubstring,copy,group ,getLine, getContents, putStr, interact + ,readFile, writeFile, appendFile ,hGetContents, hGet, hGetSome, hPut, hPutStr - ,hGetLine, hGetNonBlocking, hPutNonBlocking - ,packCString,packCStringLen + ,hPutStrLn, putStrLn, hGetLine, hGetNonBlocking + ,hPutNonBlocking, packCString, packCStringLen ,useAsCString,useAsCStringLen ) @@ -263,7 +264,6 @@ import GHC.Char (eqChar) #endif import qualified Data.List as List (intersperse) -import System.IO (Handle,stdout,withBinaryFile,hFileSize,IOMode(..)) import Foreign @@ -963,35 +963,3 @@ readInteger as combine2 b (n:m:ns) = let t = m*b + n in t `seq` (t : combine2 b ns) combine2 _ ns = ns - ------------------------------------------------------------------------- --- For non-binary text processing: - --- | Read an entire file strictly into a 'ByteString'. This is far more --- efficient than reading the characters into a 'String' and then using --- 'pack'. It also may be more efficient than opening the file and --- reading it using hGet. -readFile :: FilePath -> IO ByteString -readFile f = withBinaryFile f ReadMode - (\h -> hFileSize h >>= hGet h . fromIntegral) - -modifyFile :: IOMode -> FilePath -> ByteString -> IO () -modifyFile mode f txt = withBinaryFile f mode (`hPut` txt) - --- | Write a 'ByteString' to a file. -writeFile :: FilePath -> ByteString -> IO () -writeFile = modifyFile WriteMode - --- | Append a 'ByteString' to a file. -appendFile :: FilePath -> ByteString -> IO () -appendFile = modifyFile AppendMode - --- | Write a ByteString to a handle, appending a newline byte -hPutStrLn :: Handle -> ByteString -> IO () -hPutStrLn h ps - | length ps < 1024 = hPut h (ps `B.snoc` 0x0a) - | otherwise = hPut h ps >> hPut h (B.singleton 0x0a) -- don't copy - --- | Write a ByteString to stdout, appending a newline byte -putStrLn :: ByteString -> IO () -putStrLn = hPutStrLn stdout From git at git.haskell.org Mon Apr 17 21:31:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:31:37 +0000 (UTC) Subject: [commit: packages/bytestring] master: Merge pull request #93 from TravisWhitaker/char8_readfile_fix (49f2a67) Message-ID: <20170417213137.9F34D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : master Link : http://git.haskell.org/packages/bytestring.git/commitdiff/49f2a67631df59c1bc58185289f819b21812a0bd >--------------------------------------------------------------- commit 49f2a67631df59c1bc58185289f819b21812a0bd Merge: 18115dd 2fba115 Author: Duncan Coutts Date: Tue Oct 11 21:36:00 2016 +0100 Merge pull request #93 from TravisWhitaker/char8_readfile_fix Data.ByteString.Char8 uses IO functions exported from Data.ByteString >--------------------------------------------------------------- 49f2a67631df59c1bc58185289f819b21812a0bd Data/ByteString/Char8.hs | 38 +++----------------------------------- 1 file changed, 3 insertions(+), 35 deletions(-) From git at git.haskell.org Mon Apr 17 21:31:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:31:39 +0000 (UTC) Subject: [commit: packages/bytestring] master: Merge pull request #90 from ezyang/pr/cstring-docs (98baea1) Message-ID: <20170417213139.A8F033A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : master Link : http://git.haskell.org/packages/bytestring.git/commitdiff/98baea1577b38c80a1a23e97e9df96b10b40dc97 >--------------------------------------------------------------- commit 98baea1577b38c80a1a23e97e9df96b10b40dc97 Merge: 49f2a67 00902c5 Author: Duncan Coutts Date: Tue Oct 11 21:36:56 2016 +0100 Merge pull request #90 from ezyang/pr/cstring-docs Fix #86, remark on lifetime properties of CString. >--------------------------------------------------------------- 98baea1577b38c80a1a23e97e9df96b10b40dc97 Data/ByteString.hs | 4 +++- Data/ByteString/Unsafe.hs | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) From git at git.haskell.org Mon Apr 17 21:31:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:31:41 +0000 (UTC) Subject: [commit: packages/bytestring] master: Merge pull request #91 from RyanGlScott/master (8904ca8) Message-ID: <20170417213141.B35ED3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : master Link : http://git.haskell.org/packages/bytestring.git/commitdiff/8904ca83faa668e8fc59224f79fd3e37fc4ddec2 >--------------------------------------------------------------- commit 8904ca83faa668e8fc59224f79fd3e37fc4ddec2 Merge: 98baea1 0671e33 Author: Duncan Coutts Date: Tue Oct 11 21:47:58 2016 +0100 Merge pull request #91 from RyanGlScott/master Fix GHC 7.0.1 build by working around Trac #4498 >--------------------------------------------------------------- 8904ca83faa668e8fc59224f79fd3e37fc4ddec2 Data/ByteString/Builder/Internal.hs | 4 ++++ Data/ByteString/Builder/Prim.hs | 4 ++++ 2 files changed, 8 insertions(+) From git at git.haskell.org Mon Apr 17 21:31:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:31:43 +0000 (UTC) Subject: [commit: packages/bytestring] master: Merge pull request #89 from oherrala/travis-ghc710 (e671c4b) Message-ID: <20170417213143.BD37C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : master Link : http://git.haskell.org/packages/bytestring.git/commitdiff/e671c4bf1818b7c239a35caa74cd5e5c11ced6e4 >--------------------------------------------------------------- commit e671c4bf1818b7c239a35caa74cd5e5c11ced6e4 Merge: 8904ca8 e9daf2c Author: Duncan Coutts Date: Tue Oct 11 21:48:29 2016 +0100 Merge pull request #89 from oherrala/travis-ghc710 Update .travis.yml >--------------------------------------------------------------- e671c4bf1818b7c239a35caa74cd5e5c11ced6e4 .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) From git at git.haskell.org Mon Apr 17 21:31:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:31:45 +0000 (UTC) Subject: [commit: packages/bytestring] master: Merge pull request #79 from oherrala/fix-issue67 (b922a7b) Message-ID: <20170417213145.C71413A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : master Link : http://git.haskell.org/packages/bytestring.git/commitdiff/b922a7b4a97c02d880f9c053e065c02aa3d2d1ca >--------------------------------------------------------------- commit b922a7b4a97c02d880f9c053e065c02aa3d2d1ca Merge: e671c4b 7223f8f Author: Duncan Coutts Date: Tue Oct 11 21:59:29 2016 +0100 Merge pull request #79 from oherrala/fix-issue67 Catch IOException from hFileSize in readFile >--------------------------------------------------------------- b922a7b4a97c02d880f9c053e065c02aa3d2d1ca Data/ByteString.hs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) From git at git.haskell.org Mon Apr 17 21:31:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:31:47 +0000 (UTC) Subject: [commit: packages/bytestring] master: Add ‘since’ notes to relatively new functions (e338e7a) Message-ID: <20170417213147.D0EA13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : master Link : http://git.haskell.org/packages/bytestring.git/commitdiff/e338e7aa50d3908f7c402b4ada7c6aded7cd4fe2 >--------------------------------------------------------------- commit e338e7aa50d3908f7c402b4ada7c6aded7cd4fe2 Author: mrkkrp Date: Fri Nov 4 00:37:51 2016 +0300 Add ‘since’ notes to relatively new functions >--------------------------------------------------------------- e338e7aa50d3908f7c402b4ada7c6aded7cd4fe2 Data/ByteString.hs | 2 ++ Data/ByteString/Lazy.hs | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Data/ByteString.hs b/Data/ByteString.hs index 743bc86..af4e889 100644 --- a/Data/ByteString.hs +++ b/Data/ByteString.hs @@ -1273,6 +1273,8 @@ isPrefixOf (PS x1 s1 l1) (PS x2 s2 l2) -- | /O(n)/ The 'stripPrefix' function takes two ByteStrings and returns 'Just' -- the remainder of the second iff the first is its prefix, and otherwise -- 'Nothing'. +-- +-- @since 0.10.8.0 stripPrefix :: ByteString -> ByteString -> Maybe ByteString stripPrefix bs1@(PS _ _ l1) bs2 | bs1 `isPrefixOf` bs2 = Just (unsafeDrop l1 bs2) diff --git a/Data/ByteString/Lazy.hs b/Data/ByteString/Lazy.hs index 5b1cf5a..5b1d546 100644 --- a/Data/ByteString/Lazy.hs +++ b/Data/ByteString/Lazy.hs @@ -890,7 +890,8 @@ elemIndex w cs0 = elemIndex' 0 cs0 -- -- > elemIndexEnd c xs == -- > (-) (length xs - 1) `fmap` elemIndex c (reverse xs) - +-- +-- @since 0.10.6.0 elemIndexEnd :: Word8 -> ByteString -> Maybe Int64 elemIndexEnd w = elemIndexEnd' 0 where @@ -1037,6 +1038,8 @@ isPrefixOf (Chunk x xs) (Chunk y ys) -- | /O(n)/ The 'stripPrefix' function takes two ByteStrings and returns 'Just' -- the remainder of the second iff the first is its prefix, and otherwise -- 'Nothing'. +-- +-- @since 0.10.8.0 stripPrefix :: ByteString -> ByteString -> Maybe ByteString stripPrefix Empty bs = Just bs stripPrefix _ Empty = Nothing From git at git.haskell.org Mon Apr 17 21:31:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:31:49 +0000 (UTC) Subject: [commit: packages/bytestring] master: Avoid copying if possible in `concat` (3c97952) Message-ID: <20170417213149.DBBCE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : master Link : http://git.haskell.org/packages/bytestring.git/commitdiff/3c97952002593ee3b3d7cc00a9ae32fb12fa8a55 >--------------------------------------------------------------- commit 3c97952002593ee3b3d7cc00a9ae32fb12fa8a55 Author: Ben Gamari Date: Sun May 15 23:37:51 2016 +0200 Avoid copying if possible in `concat` The `binary` package revealed a rather obvious missing optimization here when it forced extraneous copies with the evaluation of `concat [a,b]` where `a` is empty and `b` is large. Here we rework `Data.ByteString.concat` and `Data.ByteString.Lazy.concat` to more aggressively avoid unnecessary copies in the face of concatentations of lists with empty chunks. This rework has the nice advantage of avoiding allocation during computation of the final buffer length in the case where a copy is necessary (whereas previously `checkedSum` would fail to fuse and therefore require allocation for its list argument). >--------------------------------------------------------------- 3c97952002593ee3b3d7cc00a9ae32fb12fa8a55 Data/ByteString/Internal.hs | 75 ++++++++++++++++++++++++++++++---------- Data/ByteString/Lazy.hs | 41 +++++++++++++++++----- Data/ByteString/Lazy/Internal.hs | 1 + 3 files changed, 90 insertions(+), 27 deletions(-) diff --git a/Data/ByteString/Internal.hs b/Data/ByteString/Internal.hs index 4a9983b..031403e 100644 --- a/Data/ByteString/Internal.hs +++ b/Data/ByteString/Internal.hs @@ -34,7 +34,6 @@ module Data.ByteString.Internal ( unpackBytes, unpackAppendBytesLazy, unpackAppendBytesStrict, unpackChars, unpackAppendCharsLazy, unpackAppendCharsStrict, unsafePackAddress, - checkedSum, -- * Low level imperative construction create, -- :: Int -> (Ptr Word8 -> IO ()) -> IO ByteString @@ -51,6 +50,7 @@ module Data.ByteString.Internal ( -- * Utilities nullForeignPtr, -- :: ForeignPtr Word8 + checkedAdd, -- :: String -> Int -> Int -> Int -- * Standard C Functions c_strlen, -- :: CString -> IO CInt @@ -76,7 +76,7 @@ module Data.ByteString.Internal ( inlinePerformIO -- :: IO a -> a ) where -import Prelude hiding (concat) +import Prelude hiding (concat, null) import qualified Data.List as List import Foreign.ForeignPtr (ForeignPtr, withForeignPtr) @@ -461,24 +461,63 @@ append (PS fp1 off1 len1) (PS fp2 off2 len2) = withForeignPtr fp2 $ \p2 -> memcpy destptr2 (p2 `plusPtr` off2) len2 concat :: [ByteString] -> ByteString -concat [] = mempty -concat [bs] = bs -concat bss0 = unsafeCreate totalLen $ \ptr -> go bss0 ptr +concat = \bss0 -> goLen0 bss0 bss0 + -- The idea here is we first do a pass over the input list to determine: + -- + -- 1. is a copy necessary? e.g. @concat []@, @concat [mempty, "hello"]@, + -- and @concat ["hello", mempty, mempty]@ can all be handled without + -- copying. + -- 2. if a copy is necessary, how large is the result going to be? + -- + -- If a copy is necessary then we create a buffer of the appropriate size + -- and do another pass over the input list, copying the chunks into the + -- buffer. Also, since foreign calls aren't entirely free we skip over + -- empty chunks while copying. + -- + -- We pass the original [ByteString] (bss0) through as an argument through + -- goLen0, goLen1, and goLen since we will need it again in goCopy. Passing + -- it as an explicit argument avoids capturing it in these functions' + -- closures which would result in unnecessary closure allocation. where - totalLen = checkedSum "concat" [ len | (PS _ _ len) <- bss0 ] - go [] !_ = return () - go (PS fp off len:bss) !ptr = do + -- It's still possible that the result is empty + goLen0 _ [] = mempty + goLen0 bss0 (PS _ _ 0 :bss) = goLen0 bss0 bss + goLen0 bss0 (bs :bss) = goLen1 bss0 bs bss + + -- It's still possible that the result is a single chunk + goLen1 _ bs [] = bs + goLen1 bss0 bs (PS _ _ 0 :bss) = goLen1 bss0 bs bss + goLen1 bss0 bs (PS _ _ len:bss) = goLen bss0 (checkedAdd "concat" len' len) bss + where PS _ _ len' = bs + + -- General case, just find the total length we'll need + goLen bss0 !total (PS _ _ len:bss) = goLen bss0 total' bss + where total' = checkedAdd "concat" total len + goLen bss0 total [] = + unsafeCreate total $ \ptr -> goCopy bss0 ptr + + -- Copy the data + goCopy [] !_ = return () + goCopy (PS _ _ 0 :bss) !ptr = goCopy bss ptr + goCopy (PS fp off len:bss) !ptr = do withForeignPtr fp $ \p -> memcpy ptr (p `plusPtr` off) len - go bss (ptr `plusPtr` len) - --- | Add a list of non-negative numbers. Errors out on overflow. -checkedSum :: String -> [Int] -> Int -checkedSum fun = go 0 - where go !a (x:xs) - | ax >= 0 = go ax xs - | otherwise = overflowError fun - where ax = a + x - go a _ = a + goCopy bss (ptr `plusPtr` len) +{-# NOINLINE concat #-} + +{-# RULES +"ByteString concat [] -> mempty" + concat [] = mempty +"ByteString concat [bs] -> bs" forall x. + concat [x] = x + #-} + +-- | Add two non-negative numbers. Errors out on overflow. +checkedAdd :: String -> Int -> Int -> Int +checkedAdd fun x y + | r >= 0 = r + | otherwise = overflowError fun + where r = x + y +{-# INLINE checkedAdd #-} ------------------------------------------------------------------------ diff --git a/Data/ByteString/Lazy.hs b/Data/ByteString/Lazy.hs index 5b1cf5a..329b4d8 100644 --- a/Data/ByteString/Lazy.hs +++ b/Data/ByteString/Lazy.hs @@ -282,17 +282,40 @@ fromStrict bs | S.null bs = Empty -- avoid converting back and forth between strict and lazy bytestrings. -- toStrict :: ByteString -> S.ByteString -toStrict Empty = S.empty -toStrict (Chunk c Empty) = c -toStrict cs0 = S.unsafeCreate totalLen $ \ptr -> go cs0 ptr +toStrict = \cs -> goLen0 cs cs + -- We pass the original [ByteString] (bss0) through as an argument through + -- goLen0, goLen1, and goLen since we will need it again in goCopy. Passing + -- it as an explicit argument avoids capturing it in these functions' + -- closures which would result in unnecessary closure allocation. where - totalLen = S.checkedSum "Lazy.toStrict" . L.map S.length . toChunks $ cs0 - - go Empty !_ = return () - go (Chunk (S.PS fp off len) cs) !destptr = + -- It's still possible that the result is empty + goLen0 _ Empty = S.empty + goLen0 cs0 (Chunk c cs) | S.null c = goLen0 cs0 cs + goLen0 cs0 (Chunk c cs) = goLen1 cs0 c cs + + -- It's still possible that the result is a single chunk + goLen1 _ bs Empty = bs + goLen1 cs0 bs (Chunk c cs) + | S.null c = goLen1 cs0 bs cs + | otherwise = + goLen cs0 (S.checkedAdd "Lazy.concat" (S.length bs) (S.length c)) cs + + -- General case, just find the total length we'll need + goLen cs0 !total (Chunk c cs) = goLen cs0 total' cs + where + total' = S.checkedAdd "Lazy.concat" total (S.length c) + goLen cs0 total Empty = + S.unsafeCreate total $ \ptr -> goCopy cs0 ptr + + -- Copy the data + goCopy Empty !_ = return () + goCopy (Chunk (S.PS _ _ 0 ) cs) !ptr = goCopy cs ptr + goCopy (Chunk (S.PS fp off len) cs) !ptr = do withForeignPtr fp $ \p -> do - S.memcpy destptr (p `plusPtr` off) len - go cs (destptr `plusPtr` len) + S.memcpy ptr (p `plusPtr` off) len + goCopy cs (ptr `plusPtr` len) +-- See the comment on Data.ByteString.Internal.concat for some background on +-- this implementation. ------------------------------------------------------------------------ diff --git a/Data/ByteString/Lazy/Internal.hs b/Data/ByteString/Lazy/Internal.hs index a292cfb..fcf6cc6 100644 --- a/Data/ByteString/Lazy/Internal.hs +++ b/Data/ByteString/Lazy/Internal.hs @@ -73,6 +73,7 @@ import Data.Data (Data(..), mkNoRepType) -- data ByteString = Empty | Chunk {-# UNPACK #-} !S.ByteString ByteString deriving (Typeable) +-- See 'invariant' function later in this module for internal invariants. instance Eq ByteString where (==) = eq From git at git.haskell.org Mon Apr 17 21:31:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:31:51 +0000 (UTC) Subject: [commit: packages/bytestring] master: Merge branch 'bgamari-needless-copies' (0f3775c) Message-ID: <20170417213151.E5B1C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : master Link : http://git.haskell.org/packages/bytestring.git/commitdiff/0f3775c60a0bd8800181d46e5cc10a89a806275b >--------------------------------------------------------------- commit 0f3775c60a0bd8800181d46e5cc10a89a806275b Merge: b922a7b 3c97952 Author: Duncan Coutts Date: Sun Nov 13 20:59:34 2016 +0000 Merge branch 'bgamari-needless-copies' >--------------------------------------------------------------- 0f3775c60a0bd8800181d46e5cc10a89a806275b Data/ByteString/Internal.hs | 75 ++++++++++++++++++++++++++++++---------- Data/ByteString/Lazy.hs | 41 +++++++++++++++++----- Data/ByteString/Lazy/Internal.hs | 1 + 3 files changed, 90 insertions(+), 27 deletions(-) From git at git.haskell.org Mon Apr 17 21:31:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:31:53 +0000 (UTC) Subject: [commit: packages/bytestring] master: Merge pull request #96 from mrkkrp/add-since-notes (29928ae) Message-ID: <20170417213153.F07713A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : master Link : http://git.haskell.org/packages/bytestring.git/commitdiff/29928aea9c2f864a57846c02879c5d55979ed834 >--------------------------------------------------------------- commit 29928aea9c2f864a57846c02879c5d55979ed834 Merge: 0f3775c e338e7a Author: Duncan Coutts Date: Sun Nov 13 21:03:39 2016 +0000 Merge pull request #96 from mrkkrp/add-since-notes Add ‘since’ notes to relatively new functions >--------------------------------------------------------------- 29928aea9c2f864a57846c02879c5d55979ed834 Data/ByteString.hs | 2 ++ Data/ByteString/Lazy.hs | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) From git at git.haskell.org Mon Apr 17 21:31:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:31:56 +0000 (UTC) Subject: [commit: packages/bytestring] master: Bump to 0.10.8.2 and update changelog (ab2baae) Message-ID: <20170417213156.081D93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : master Link : http://git.haskell.org/packages/bytestring.git/commitdiff/ab2baae16f8a357e0d791d8e81f71f14dd7c76c9 >--------------------------------------------------------------- commit ab2baae16f8a357e0d791d8e81f71f14dd7c76c9 Author: Duncan Coutts Date: Sun Nov 13 21:13:24 2016 +0000 Bump to 0.10.8.2 and update changelog >--------------------------------------------------------------- ab2baae16f8a357e0d791d8e81f71f14dd7c76c9 Changelog.md | 9 +++++++++ bytestring.cabal | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index f044365..78d4304 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,12 @@ +0.10.8.2 (current dev version) + + * Make readFile work for files with no size like /dev/null + * Extend the cases in which concat and toStrict can avoid copying data + * Fix building with ghc-7.0 + * Minor documentation improvements + * Internal code cleanups + + 0.10.8.1 Duncan Coutts May 2016 * Fix Builder output on big-endian architectures diff --git a/bytestring.cabal b/bytestring.cabal index b47bc9f..53d4edf 100644 --- a/bytestring.cabal +++ b/bytestring.cabal @@ -1,5 +1,5 @@ Name: bytestring -Version: 0.10.8.1 +Version: 0.10.8.2 Synopsis: Fast, compact, strict and lazy byte strings with a list interface Description: An efficient compact, immutable byte string type (both strict and lazy) From git at git.haskell.org Mon Apr 17 21:31:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:31:58 +0000 (UTC) Subject: [commit: packages/bytestring] master: Haddock fixup. (d5f5b6b) Message-ID: <20170417213158.110843A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : master Link : http://git.haskell.org/packages/bytestring.git/commitdiff/d5f5b6bcf3077259bdbe3e845a9c72f6b05ad69b >--------------------------------------------------------------- commit d5f5b6bcf3077259bdbe3e845a9c72f6b05ad69b Author: Edward Z. Yang Date: Wed Dec 7 11:26:13 2016 -0800 Haddock fixup. Signed-off-by: Edward Z. Yang >--------------------------------------------------------------- d5f5b6bcf3077259bdbe3e845a9c72f6b05ad69b Data/ByteString.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Data/ByteString.hs b/Data/ByteString.hs index af4e889..d23ffb6 100644 --- a/Data/ByteString.hs +++ b/Data/ByteString.hs @@ -316,14 +316,14 @@ singleton c = unsafeCreate 1 $ \p -> poke p c -- -- --- | /O(n)/ Convert a '[Word8]' into a 'ByteString'. +-- | /O(n)/ Convert a @['Word8']@ into a 'ByteString'. -- -- For applications with large numbers of string literals, pack can be a -- bottleneck. In such cases, consider using packAddress (GHC only). pack :: [Word8] -> ByteString pack = packBytes --- | /O(n)/ Converts a 'ByteString' to a '[Word8]'. +-- | /O(n)/ Converts a 'ByteString' to a @['Word8']@. unpack :: ByteString -> [Word8] unpack bs = build (unpackFoldr bs) {-# INLINE unpack #-} From git at git.haskell.org Mon Apr 17 21:32:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:32:00 +0000 (UTC) Subject: [commit: packages/bytestring] master: Merge pull request #99 from ezyang/pr/haddock-fix (1e27a95) Message-ID: <20170417213200.1A89E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : master Link : http://git.haskell.org/packages/bytestring.git/commitdiff/1e27a95cabfc6ed8e6687ba5ab315315586006e0 >--------------------------------------------------------------- commit 1e27a95cabfc6ed8e6687ba5ab315315586006e0 Merge: ab2baae d5f5b6b Author: Duncan Coutts Date: Wed Feb 8 22:14:37 2017 +0000 Merge pull request #99 from ezyang/pr/haddock-fix Haddock fixup. >--------------------------------------------------------------- 1e27a95cabfc6ed8e6687ba5ab315315586006e0 Data/ByteString.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) From git at git.haskell.org Mon Apr 17 21:32:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:32:02 +0000 (UTC) Subject: [commit: packages/bytestring] master: Update changelog for 0.10.8.2 release (2c4bba2) Message-ID: <20170417213202.240B23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : master Link : http://git.haskell.org/packages/bytestring.git/commitdiff/2c4bba2d85e77c4bbf8de7eeb614eb0217d11dc0 >--------------------------------------------------------------- commit 2c4bba2d85e77c4bbf8de7eeb614eb0217d11dc0 Author: Duncan Coutts Date: Wed Feb 8 22:18:27 2017 +0000 Update changelog for 0.10.8.2 release >--------------------------------------------------------------- 2c4bba2d85e77c4bbf8de7eeb614eb0217d11dc0 Changelog.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Changelog.md b/Changelog.md index 78d4304..4f2ab4a 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,4 +1,4 @@ -0.10.8.2 (current dev version) +0.10.8.2 Duncan Coutts Feb 2017 * Make readFile work for files with no size like /dev/null * Extend the cases in which concat and toStrict can avoid copying data @@ -6,7 +6,6 @@ * Minor documentation improvements * Internal code cleanups - 0.10.8.1 Duncan Coutts May 2016 * Fix Builder output on big-endian architectures From git at git.haskell.org Mon Apr 17 21:32:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:32:04 +0000 (UTC) Subject: [commit: packages/bytestring] master: CPP-guard hiding of catch from Prelude (969f079) Message-ID: <20170417213204.2E3C33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : master Link : http://git.haskell.org/packages/bytestring.git/commitdiff/969f0797e2455ddc03c10123ff21ea2dbe578e01 >--------------------------------------------------------------- commit 969f0797e2455ddc03c10123ff21ea2dbe578e01 Author: Ben Gamari Date: Wed Feb 8 19:17:54 2017 -0500 CPP-guard hiding of catch from Prelude Prelude no longer exports catch, resulting in a warning which kills the GHC build due to -Werror. >--------------------------------------------------------------- 969f0797e2455ddc03c10123ff21ea2dbe578e01 Data/ByteString.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Data/ByteString.hs b/Data/ByteString.hs index d23ffb6..79b96d5 100644 --- a/Data/ByteString.hs +++ b/Data/ByteString.hs @@ -217,7 +217,11 @@ import Prelude hiding (reverse,head,tail,last,init,null ,scanl,scanl1,scanr,scanr1 ,readFile,writeFile,appendFile,replicate ,getContents,getLine,putStr,putStrLn,interact - ,zip,zipWith,unzip,notElem,catch) + ,zip,zipWith,unzip,notElem +#if !MIN_VERSION_base(4,6,0) + ,catch +#endif + ) #if MIN_VERSION_base(4,7,0) import Data.Bits (finiteBitSize, shiftL, (.|.), (.&.)) From git at git.haskell.org Mon Apr 17 21:32:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:32:06 +0000 (UTC) Subject: [commit: packages/bytestring] master: Partially Revert "Data.ByteString.Char8 uses IO functions exported from Data.ByteString" (56a4016) Message-ID: <20170417213206.36E473A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : master Link : http://git.haskell.org/packages/bytestring.git/commitdiff/56a40166e3c2279ba729a84819fc63a5ecc1db29 >--------------------------------------------------------------- commit 56a40166e3c2279ba729a84819fc63a5ecc1db29 Author: Ben Gamari Date: Wed Feb 8 19:27:59 2017 -0500 Partially Revert "Data.ByteString.Char8 uses IO functions exported from Data.ByteString" While several of these functions are indeed exported from Data.ByteString, they are justifiably marked as deprecated there. Ultimately it is the Data.ByteString functions that ought to be removed, not those in Data.ByteString.Char8. Namely, hPutStrLn and putStrLn rightly belong in Data.ByteString.Char8. This partially reverts commit 2fba115881b2da32ce076c1114ad6fe8d893086b. >--------------------------------------------------------------- 56a40166e3c2279ba729a84819fc63a5ecc1db29 Data/ByteString/Char8.hs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Data/ByteString/Char8.hs b/Data/ByteString/Char8.hs index f548a5e..9b0793c 100644 --- a/Data/ByteString/Char8.hs +++ b/Data/ByteString/Char8.hs @@ -250,8 +250,8 @@ import Data.ByteString (empty,null,length,tail,init,append ,getLine, getContents, putStr, interact ,readFile, writeFile, appendFile ,hGetContents, hGet, hGetSome, hPut, hPutStr - ,hPutStrLn, putStrLn, hGetLine, hGetNonBlocking - ,hPutNonBlocking, packCString, packCStringLen + ,hGetLine, hGetNonBlocking, hPutNonBlocking + ,packCString,packCStringLen ,useAsCString,useAsCStringLen ) @@ -264,6 +264,7 @@ import GHC.Char (eqChar) #endif import qualified Data.List as List (intersperse) +import System.IO (Handle,stdout) import Foreign @@ -963,3 +964,16 @@ readInteger as combine2 b (n:m:ns) = let t = m*b + n in t `seq` (t : combine2 b ns) combine2 _ ns = ns + +------------------------------------------------------------------------ +-- For non-binary text processing: + +-- | Write a ByteString to a handle, appending a newline byte +hPutStrLn :: Handle -> ByteString -> IO () +hPutStrLn h ps + | length ps < 1024 = hPut h (ps `B.snoc` 0x0a) + | otherwise = hPut h ps >> hPut h (B.singleton 0x0a) -- don't copy + +-- | Write a ByteString to stdout, appending a newline byte +putStrLn :: ByteString -> IO () +putStrLn = hPutStrLn stdout From git at git.haskell.org Mon Apr 17 21:32:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:32:08 +0000 (UTC) Subject: [commit: packages/bytestring] master: Merge pull request #111 from bgamari/master (ce3c6a0) Message-ID: <20170417213208.406643A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : master Link : http://git.haskell.org/packages/bytestring.git/commitdiff/ce3c6a01cd9e2438358108e3e4b515304b5ce5a6 >--------------------------------------------------------------- commit ce3c6a01cd9e2438358108e3e4b515304b5ce5a6 Merge: 2c4bba2 56a4016 Author: Duncan Coutts Date: Thu Feb 9 19:24:36 2017 +0000 Merge pull request #111 from bgamari/master Fix all the build warnings >--------------------------------------------------------------- ce3c6a01cd9e2438358108e3e4b515304b5ce5a6 Data/ByteString.hs | 6 +++++- Data/ByteString/Char8.hs | 18 ++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) From git at git.haskell.org Mon Apr 17 21:32:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:32:10 +0000 (UTC) Subject: [commit: packages/bytestring] master: Fix typo in `lazyByteString` documentation (a78a466) Message-ID: <20170417213210.4A3563A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : master Link : http://git.haskell.org/packages/bytestring.git/commitdiff/a78a466881e210353a99819d7a07f62276a04c9e >--------------------------------------------------------------- commit a78a466881e210353a99819d7a07f62276a04c9e Author: Hardy Jones Date: Sat Apr 15 21:35:45 2017 -0700 Fix typo in `lazyByteString` documentation This was linking to the strict `ByteString` rather than the lazy `ByteString` in the haddocks. >--------------------------------------------------------------- a78a466881e210353a99819d7a07f62276a04c9e Data/ByteString/Builder/Internal.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Data/ByteString/Builder/Internal.hs b/Data/ByteString/Builder/Internal.hs index 90b35c6..268cb6a 100644 --- a/Data/ByteString/Builder/Internal.hs +++ b/Data/ByteString/Builder/Internal.hs @@ -968,7 +968,7 @@ byteString :: S.ByteString -> Builder byteString = byteStringThreshold maximalCopySize -- | Create a 'Builder' denoting the same sequence of bytes as a lazy --- 'S.ByteString'. +-- 'L.ByteString'. -- The 'Builder' inserts large chunks of the lazy 'L.ByteString' directly, -- but copies small ones to ensure that the generated chunks are large on -- average. From git at git.haskell.org Mon Apr 17 21:32:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:32:12 +0000 (UTC) Subject: [commit: packages/bytestring] master: Fix markup of identifier link and a typo (#118) (a1c6a8b) Message-ID: <20170417213212.541043A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : master Link : http://git.haskell.org/packages/bytestring.git/commitdiff/a1c6a8b09125b77cc179c14da5837f1cfc9d75bd >--------------------------------------------------------------- commit a1c6a8b09125b77cc179c14da5837f1cfc9d75bd Author: Edward Z. Yang Date: Sun Apr 16 01:49:17 2017 -0700 Fix markup of identifier link and a typo (#118) Signed-off-by: Edward Z. Yang >--------------------------------------------------------------- a1c6a8b09125b77cc179c14da5837f1cfc9d75bd Data/ByteString.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Data/ByteString.hs b/Data/ByteString.hs index 79b96d5..1d8475b 100644 --- a/Data/ByteString.hs +++ b/Data/ByteString.hs @@ -565,7 +565,7 @@ foldr1 f ps | otherwise = foldr f (unsafeLast ps) (unsafeInit ps) {-# INLINE foldr1 #-} --- | 'foldr1\'' is a variant of 'foldr1', but is strict in the +-- | 'foldr1'' is a variant of 'foldr1', but is strict in the -- accumulator. foldr1' :: (Word8 -> Word8 -> Word8) -> ByteString -> Word8 foldr1' f ps @@ -1413,7 +1413,7 @@ findSubstring pat src {-# DEPRECATED findSubstring "findSubstring is deprecated in favour of breakSubstring." #-} --- | Find the indexes of all (possibly overlapping) occurances of a +-- | Find the indexes of all (possibly overlapping) occurences of a -- substring in a string. -- findSubstrings :: ByteString -- ^ String to search for. From git at git.haskell.org Mon Apr 17 21:32:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:32:43 +0000 (UTC) Subject: [commit: packages/containers] branch 'changelog-foldtree' created Message-ID: <20170417213243.CE2163A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers New branch : changelog-foldtree Referencing: 5b9dad54dbef5fde80c62b36d1ddf68f6a1843d5 From git at git.haskell.org Mon Apr 17 21:32:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:32:45 +0000 (UTC) Subject: [commit: packages/containers] branch 'strict-tuples' created Message-ID: <20170417213245.CF2A63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers New branch : strict-tuples Referencing: cd8d45fb8c4132a5bf56b140a40d9f37f04cfd56 From git at git.haskell.org Mon Apr 17 21:32:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:32:47 +0000 (UTC) Subject: [commit: packages/containers] branch 'develop' created Message-ID: <20170417213247.D00C03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers New branch : develop Referencing: b44b6a727c123c0ec33e8ac0f1299ac73ee1d0ef From git at git.haskell.org Mon Apr 17 21:32:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:32:49 +0000 (UTC) Subject: [commit: packages/containers] branch 'cleaned_bugfix394' created Message-ID: <20170417213249.D13233A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers New branch : cleaned_bugfix394 Referencing: c1dddc638cb041e01c425349ab7836e3c9314897 From git at git.haskell.org Mon Apr 17 21:32:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:32:51 +0000 (UTC) Subject: [commit: packages/containers] branch 'merge-doc-target' created Message-ID: <20170417213251.D1CBF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers New branch : merge-doc-target Referencing: 6c0355a9d3f6a9fe53e21a3aa585dd9f4bd32ba0 From git at git.haskell.org Mon Apr 17 21:32:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:32:53 +0000 (UTC) Subject: [commit: packages/containers] branch 'zip-devel' created Message-ID: <20170417213253.D2CD73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers New branch : zip-devel Referencing: ce7f531605b5f2bb350f36c51a74d9ebd84ff8b6 From git at git.haskell.org Mon Apr 17 21:32:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:32:55 +0000 (UTC) Subject: [commit: packages/containers] branch 'merge-restrict-fix-5.8' created Message-ID: <20170417213255.D38C73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers New branch : merge-restrict-fix-5.8 Referencing: b859e651af318f6a7e0e3838d4d45fef8b59c0d3 From git at git.haskell.org Mon Apr 17 21:32:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:32:57 +0000 (UTC) Subject: [commit: packages/containers] branch 'merge-fixes-5.9' created Message-ID: <20170417213257.D48413A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers New branch : merge-fixes-5.9 Referencing: 5741cafa295a44e3046e0956790f6e54fcb0ef9b From git at git.haskell.org Mon Apr 17 21:32:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:32:59 +0000 (UTC) Subject: [commit: packages/containers] branch 'develop-0.6' created Message-ID: <20170417213259.D5A563A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers New branch : develop-0.6 Referencing: 7ab1c399726c5a4a562cff3f56017ff5852ac82e From git at git.haskell.org Mon Apr 17 21:33:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:33:01 +0000 (UTC) Subject: [commit: packages/containers] branch 'revert-184-generic' created Message-ID: <20170417213301.D695C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers New branch : revert-184-generic Referencing: c26240ed176ebe72755f31541651177cc1aa355a From git at git.haskell.org Mon Apr 17 21:33:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:33:03 +0000 (UTC) Subject: [commit: packages/containers] branch 'revert-408-bugfix_394' created Message-ID: <20170417213303.D862F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers New branch : revert-408-bugfix_394 Referencing: ecd71335670a1b45f16c38a7d16bc099daaffe5e From git at git.haskell.org Mon Apr 17 21:33:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:33:05 +0000 (UTC) Subject: [commit: packages/containers] branch 'develop-0.6-questionable' created Message-ID: <20170417213305.D861D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers New branch : develop-0.6-questionable Referencing: 2bf686d3dd0706eef416590100f8d1ebaa3eb80b From git at git.haskell.org Mon Apr 17 21:33:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:33:07 +0000 (UTC) Subject: [commit: packages/containers] branch 'ghc-head' deleted Message-ID: <20170417213307.D97943A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers Deleted branch: ghc-head From git at git.haskell.org Mon Apr 17 21:33:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:33:09 +0000 (UTC) Subject: [commit: packages/containers] tag 'containers-0.5.7.0-release' created Message-ID: <20170417213309.DA6D83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers New tag : containers-0.5.7.0-release Referencing: d06b845316672e4b6a123048702668c220acea03 From git at git.haskell.org Mon Apr 17 21:33:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:33:11 +0000 (UTC) Subject: [commit: packages/containers] tag 'containers-0.5.6.2-release' created Message-ID: <20170417213311.DB92A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers New tag : containers-0.5.6.2-release Referencing: ab15b1f50d85199aebbe58c7e8efb7f3f1f09eda From git at git.haskell.org Mon Apr 17 21:33:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:33:13 +0000 (UTC) Subject: [commit: packages/containers] tag 'v0.5.7.1' created Message-ID: <20170417213313.DC4E53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers New tag : v0.5.7.1 Referencing: 6d73570e85db8b0dabc27b4f92518b0d013f8a84 From git at git.haskell.org Mon Apr 17 21:33:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:33:15 +0000 (UTC) Subject: [commit: packages/containers] tag 'v0.5.10.1' created Message-ID: <20170417213315.DD45B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers New tag : v0.5.10.1 Referencing: 7a7eb05688279bc60f1a2a8d3cd5645df74d2c89 From git at git.haskell.org Mon Apr 17 21:33:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:33:17 +0000 (UTC) Subject: [commit: packages/containers] tag 'containers-0.5.6.3-release' created Message-ID: <20170417213317.DE1B23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers New tag : containers-0.5.6.3-release Referencing: a401400fa89b2f942a2e2d22610c21259b45d016 From git at git.haskell.org Mon Apr 17 21:33:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:33:19 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Add IsList instances for OverloadedLists (0e99ba8) Message-ID: <20170417213319.F0FE63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/0e99ba8851f875c4b44631c7afad3b70e74842c2 >--------------------------------------------------------------- commit 0e99ba8851f875c4b44631c7afad3b70e74842c2 Author: Konstantine Rybnikov Date: Sun Apr 13 22:27:39 2014 +0200 Add IsList instances for OverloadedLists >--------------------------------------------------------------- 0e99ba8851f875c4b44631c7afad3b70e74842c2 Data/IntMap/Base.hs | 16 +++++++++++++++- Data/IntSet/Base.hs | 13 +++++++++++++ Data/Map/Base.hs | 13 +++++++++++++ Data/Set/Base.hs | 13 +++++++++++++ 4 files changed, 54 insertions(+), 1 deletion(-) diff --git a/Data/IntMap/Base.hs b/Data/IntMap/Base.hs index 34a263a..75b3ae9 100644 --- a/Data/IntMap/Base.hs +++ b/Data/IntMap/Base.hs @@ -5,6 +5,10 @@ #if !defined(TESTING) && __GLASGOW_HASKELL__ >= 703 {-# LANGUAGE Trustworthy #-} #endif +{-# LANGUAGE ScopedTypeVariables #-} +#if __GLASGOW_HASKELL__ >= 708 +{-# LANGUAGE TypeFamilies #-} +#endif ----------------------------------------------------------------------------- -- | -- Module : Data.IntMap.Base @@ -231,6 +235,9 @@ import Data.StrictPair import Data.Data (Data(..), Constr, mkConstr, constrIndex, Fixity(Prefix), DataType, mkDataType) import GHC.Exts (build) +#if __GLASGOW_HASKELL__ >= 708 +import qualified GHC.Exts as GHCExts +#endif import Text.Read #endif @@ -1770,6 +1777,13 @@ fromSet f (IntSet.Tip kx bm) = buildTree f kx bm (IntSet.suffixBitMask + 1) {-------------------------------------------------------------------- Lists --------------------------------------------------------------------} +#if __GLASGOW_HASKELL__ >= 708 +instance GHCExts.IsList (IntMap a) where + type Item (IntMap a) = (Key,a) + fromList = fromList + toList = toList +#endif + -- | /O(n)/. Convert the map to a list of key\/value pairs. Subject to list -- fusion. -- @@ -1907,7 +1921,7 @@ fromAscListWithKey f (x0 : xs0) = fromDistinctAscList (combineEq x0 xs0) -- -- > fromDistinctAscList [(3,"b"), (5,"a")] == fromList [(3, "b"), (5, "a")] -fromDistinctAscList :: [(Key,a)] -> IntMap a +fromDistinctAscList :: forall a. [(Key,a)] -> IntMap a fromDistinctAscList [] = Nil fromDistinctAscList (z0 : zs0) = work z0 zs0 Nada where diff --git a/Data/IntSet/Base.hs b/Data/IntSet/Base.hs index be41db5..0063c3f 100644 --- a/Data/IntSet/Base.hs +++ b/Data/IntSet/Base.hs @@ -5,6 +5,9 @@ #if !defined(TESTING) && __GLASGOW_HASKELL__ >= 703 {-# LANGUAGE Trustworthy #-} #endif +#if __GLASGOW_HASKELL__ >= 708 +{-# LANGUAGE TypeFamilies #-} +#endif ----------------------------------------------------------------------------- -- | -- Module : Data.IntSet.Base @@ -198,6 +201,9 @@ import Text.Read #if __GLASGOW_HASKELL__ import GHC.Exts (Int(..), build) +#if __GLASGOW_HASKELL__ >= 708 +import qualified GHC.Exts as GHCExts +#endif import GHC.Prim (indexInt8OffAddr#) #endif @@ -936,6 +942,13 @@ elems {-------------------------------------------------------------------- Lists --------------------------------------------------------------------} +#if __GLASGOW_HASKELL__ >= 708 +instance GHCExts.IsList IntSet where + type Item IntSet = Key + fromList = fromList + toList = toList +#endif + -- | /O(n)/. Convert the set to a list of elements. Subject to list fusion. toList :: IntSet -> [Key] toList diff --git a/Data/Map/Base.hs b/Data/Map/Base.hs index 6a93a73..69f8276 100644 --- a/Data/Map/Base.hs +++ b/Data/Map/Base.hs @@ -5,6 +5,9 @@ #if !defined(TESTING) && __GLASGOW_HASKELL__ >= 703 {-# LANGUAGE Trustworthy #-} #endif +#if __GLASGOW_HASKELL__ >= 708 +{-# LANGUAGE TypeFamilies #-} +#endif ----------------------------------------------------------------------------- -- | -- Module : Data.Map.Base @@ -278,6 +281,9 @@ import qualified Data.Set.Base as Set #if __GLASGOW_HASKELL__ import GHC.Exts ( build ) +#if __GLASGOW_HASKELL__ >= 708 +import qualified GHC.Exts as GHCExts +#endif import Text.Read import Data.Data #endif @@ -1948,6 +1954,13 @@ fromSet f (Set.Bin sz x l r) = Bin sz x (f x) (fromSet f l) (fromSet f r) Lists use [foldlStrict] to reduce demand on the control-stack --------------------------------------------------------------------} +#if __GLASGOW_HASKELL__ >= 708 +instance (Ord k) => GHCExts.IsList (Map k v) where + type Item (Map k v) = (k,v) + fromList = fromList + toList = toList +#endif + -- | /O(n*log n)/. Build a map from a list of key\/value pairs. See also 'fromAscList'. -- If the list contains more than one value for the same key, the last value -- for the key is retained. diff --git a/Data/Set/Base.hs b/Data/Set/Base.hs index f863d17..94372df 100644 --- a/Data/Set/Base.hs +++ b/Data/Set/Base.hs @@ -5,6 +5,9 @@ #if !defined(TESTING) && __GLASGOW_HASKELL__ >= 703 {-# LANGUAGE Trustworthy #-} #endif +#if __GLASGOW_HASKELL__ >= 708 +{-# LANGUAGE TypeFamilies #-} +#endif ----------------------------------------------------------------------------- -- | -- Module : Data.Set.Base @@ -194,6 +197,9 @@ import Data.StrictPair #if __GLASGOW_HASKELL__ import GHC.Exts ( build ) +#if __GLASGOW_HASKELL__ >= 708 +import qualified GHC.Exts as GHCExts +#endif import Text.Read import Data.Data #endif @@ -763,6 +769,13 @@ elems = toAscList {-------------------------------------------------------------------- Lists --------------------------------------------------------------------} +#if __GLASGOW_HASKELL__ >= 708 +instance (Ord a) => GHCExts.IsList (Set a) where + type Item (Set a) = a + fromList = fromList + toList = toList +#endif + -- | /O(n)/. Convert the set to a list of elements. Subject to list fusion. toList :: Set a -> [a] toList = toAscList From git at git.haskell.org Mon Apr 17 21:33:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:33:22 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Add LANGUAGE RoleAnnotations for ghc 7.8 (cb08a7e) Message-ID: <20170417213322.0689D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/cb08a7e06676d38f2f5deb35d0035429c1c10eb1 >--------------------------------------------------------------- commit cb08a7e06676d38f2f5deb35d0035429c1c10eb1 Author: Konstantine Rybnikov Date: Sun Apr 13 23:52:57 2014 +0200 Add LANGUAGE RoleAnnotations for ghc 7.8 >--------------------------------------------------------------- cb08a7e06676d38f2f5deb35d0035429c1c10eb1 Data/Map/Base.hs | 3 +++ Data/Set/Base.hs | 3 +++ 2 files changed, 6 insertions(+) diff --git a/Data/Map/Base.hs b/Data/Map/Base.hs index 6a93a73..95f7b91 100644 --- a/Data/Map/Base.hs +++ b/Data/Map/Base.hs @@ -5,6 +5,9 @@ #if !defined(TESTING) && __GLASGOW_HASKELL__ >= 703 {-# LANGUAGE Trustworthy #-} #endif +#if __GLASGOW_HASKELL__ >= 708 +{-# LANGUAGE RoleAnnotations #-} +#endif ----------------------------------------------------------------------------- -- | -- Module : Data.Map.Base diff --git a/Data/Set/Base.hs b/Data/Set/Base.hs index f863d17..da3b21d 100644 --- a/Data/Set/Base.hs +++ b/Data/Set/Base.hs @@ -5,6 +5,9 @@ #if !defined(TESTING) && __GLASGOW_HASKELL__ >= 703 {-# LANGUAGE Trustworthy #-} #endif +#if __GLASGOW_HASKELL__ >= 708 +{-# LANGUAGE RoleAnnotations #-} +#endif ----------------------------------------------------------------------------- -- | -- Module : Data.Set.Base From git at git.haskell.org Mon Apr 17 21:33:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:33:24 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Merge pull request #42 from k-bx/add-role-annotations-lang (0098d41) Message-ID: <20170417213324.0FB953A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/0098d41f0aa0460f96eb2251ac743bb7fa137a68 >--------------------------------------------------------------- commit 0098d41f0aa0460f96eb2251ac743bb7fa137a68 Merge: e787f05 cb08a7e Author: Johan Tibell Date: Mon Apr 14 07:01:33 2014 +0100 Merge pull request #42 from k-bx/add-role-annotations-lang Add LANGUAGE RoleAnnotations for ghc 7.8 >--------------------------------------------------------------- 0098d41f0aa0460f96eb2251ac743bb7fa137a68 Data/Map/Base.hs | 3 +++ Data/Set/Base.hs | 3 +++ 2 files changed, 6 insertions(+) From git at git.haskell.org Mon Apr 17 21:33:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:33:26 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Merge language pragmas (bae098f) Message-ID: <20170417213326.1B6D63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/bae098fb0a3994bc2b0ec3313004b40cd097ed8d >--------------------------------------------------------------- commit bae098fb0a3994bc2b0ec3313004b40cd097ed8d Merge: 0098d41 0e99ba8 Author: Johan Tibell Date: Mon Apr 14 08:20:44 2014 +0200 Merge language pragmas >--------------------------------------------------------------- bae098fb0a3994bc2b0ec3313004b40cd097ed8d Data/IntMap/Base.hs | 16 +++++++++++++++- Data/IntSet/Base.hs | 13 +++++++++++++ Data/Map/Base.hs | 11 +++++++++++ Data/Set/Base.hs | 11 +++++++++++ 4 files changed, 50 insertions(+), 1 deletion(-) diff --cc Data/Map/Base.hs index 95f7b91,69f8276..db9549f --- a/Data/Map/Base.hs +++ b/Data/Map/Base.hs @@@ -6,7 -6,7 +6,8 @@@ {-# LANGUAGE Trustworthy #-} #endif #if __GLASGOW_HASKELL__ >= 708 +{-# LANGUAGE RoleAnnotations #-} + {-# LANGUAGE TypeFamilies #-} #endif ----------------------------------------------------------------------------- -- | diff --cc Data/Set/Base.hs index da3b21d,94372df..ffcdfd0 --- a/Data/Set/Base.hs +++ b/Data/Set/Base.hs @@@ -6,7 -6,7 +6,8 @@@ {-# LANGUAGE Trustworthy #-} #endif #if __GLASGOW_HASKELL__ >= 708 +{-# LANGUAGE RoleAnnotations #-} + {-# LANGUAGE TypeFamilies #-} #endif ----------------------------------------------------------------------------- -- | From git at git.haskell.org Mon Apr 17 21:33:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:33:28 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Don't have tests depend on library to avoid dep conflicts (53da0d5) Message-ID: <20170417213328.237133A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/53da0d55d8592d86772691322cc7eebae511e29e >--------------------------------------------------------------- commit 53da0d55d8592d86772691322cc7eebae511e29e Author: Johan Tibell Date: Wed Apr 23 08:50:44 2014 +0200 Don't have tests depend on library to avoid dep conflicts >--------------------------------------------------------------- 53da0d55d8592d86772691322cc7eebae511e29e containers.cabal | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/containers.cabal b/containers.cabal index 8abca7a..640cb5e 100644 --- a/containers.cabal +++ b/containers.cabal @@ -211,14 +211,13 @@ Test-suite seq-properties test-framework-quickcheck2 test-suite map-strictness-properties - hs-source-dirs: tests + hs-source-dirs: tests, . main-is: MapStrictness.hs type: exitcode-stdio-1.0 build-depends: base, ChasingBottoms, - containers, QuickCheck >= 2.4.0.1, test-framework >= 0.3.3, test-framework-quickcheck2 >= 0.2.9 @@ -226,14 +225,13 @@ test-suite map-strictness-properties ghc-options: -Wall test-suite intmap-strictness-properties - hs-source-dirs: tests + hs-source-dirs: tests, . main-is: IntMapStrictness.hs type: exitcode-stdio-1.0 build-depends: base, ChasingBottoms, - containers, QuickCheck >= 2.4.0.1, test-framework >= 0.3.3, test-framework-quickcheck2 >= 0.2.9 From git at git.haskell.org Mon Apr 17 21:33:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:33:30 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Add missing test dependencies (c17cfaf) Message-ID: <20170417213330.2B8633A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/c17cfaf7996942ed305dc1db55ea82da40ed47e4 >--------------------------------------------------------------- commit c17cfaf7996942ed305dc1db55ea82da40ed47e4 Author: Johan Tibell Date: Wed Apr 23 09:25:40 2014 +0200 Add missing test dependencies >--------------------------------------------------------------- c17cfaf7996942ed305dc1db55ea82da40ed47e4 containers.cabal | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/containers.cabal b/containers.cabal index 640cb5e..209589b 100644 --- a/containers.cabal +++ b/containers.cabal @@ -216,9 +216,12 @@ test-suite map-strictness-properties type: exitcode-stdio-1.0 build-depends: - base, + array, + base >= 4.2 && < 5, ChasingBottoms, + deepseq >= 1.2 && < 1.4, QuickCheck >= 2.4.0.1, + ghc-prim, test-framework >= 0.3.3, test-framework-quickcheck2 >= 0.2.9 @@ -230,9 +233,12 @@ test-suite intmap-strictness-properties type: exitcode-stdio-1.0 build-depends: - base, + array, + base >= 4.2 && < 5, ChasingBottoms, + deepseq >= 1.2 && < 1.4, QuickCheck >= 2.4.0.1, + ghc-prim, test-framework >= 0.3.3, test-framework-quickcheck2 >= 0.2.9 From git at git.haskell.org Mon Apr 17 21:33:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:33:32 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Add Travis-CI job control file (234896a) Message-ID: <20170417213332.34E513A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/234896a2bb2c1f57f033b1f19f38ef039e99fe1e >--------------------------------------------------------------- commit 234896a2bb2c1f57f033b1f19f38ef039e99fe1e Author: Herbert Valerio Riedel Date: Tue Apr 22 22:48:36 2014 +0200 Add Travis-CI job control file This builds and tests containers with GHC 7.0, 7.4, 7.6, 7.8, and GHC HEAD (Once haskell/cabal#1806 is fixed we can use CABALVER=1.20 w/ GHCVER=7.8.2) >--------------------------------------------------------------- 234896a2bb2c1f57f033b1f19f38ef039e99fe1e .travis.yml | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..67d893c --- /dev/null +++ b/.travis.yml @@ -0,0 +1,60 @@ +# NB: don't set `language: haskell` here + +# See also https://github.com/hvr/multi-ghc-travis for more information +env: + - GHCVER=7.0.4 CABALVER=1.16 + # we have to use CABALVER=1.16 for GHC<7.6 as well, as there's + # no package for earlier cabal versions in the PPA + - GHCVER=7.4.2 CABALVER=1.16 + - GHCVER=7.6.3 CABALVER=1.16 + - GHCVER=7.8.2 CABALVER=1.18 + # NOTE: we can't use Cabal 1.20 yet due to + # https://github.com/haskell/cabal/issues/1806 + - GHCVER=head CABALVER=1.18 + +matrix: + allow_failures: + - env: GHCVER=head CABALVER=1.18 + +# Note: the distinction between `before_install` and `install` is not +# important. +before_install: + - travis_retry sudo add-apt-repository -y ppa:hvr/ghc + - travis_retry sudo apt-get update + - travis_retry sudo apt-get install cabal-install-$CABALVER ghc-$GHCVER + - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH + - cabal --version + +install: + - travis_retry cabal update + - cabal install --only-dependencies + # we need to install the test-suite deps manually as the cabal solver would + # otherwise complaing about cyclic deps + - cabal install 'test-framework >= 0.3.3' 'test-framework-quickcheck2 >= 0.2.9' 'QuickCheck >= 2.4.0.1' 'ChasingBottoms' 'HUnit' 'test-framework-hunit' + +# 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: + # -v2 provides useful information for debugging + - cabal configure -v2 --enable-tests + + # this builds all libraries and executables + # (including tests/benchmarks) + - cabal build + - cabal test + + # tests that a source-distribution can be generated + - cabal sdist + + # check that the generated source-distribution can be built & installed + - export SRC_TGZ=$(cabal info . | awk '{print $2 ".tar.gz";exit}') ; + cd dist/; + if [ -f "$SRC_TGZ" ]; then + cabal install --force-reinstalls "$SRC_TGZ"; + else + echo "expected '$SRC_TGZ' not found"; + exit 1; + fi + +# EOF From git at git.haskell.org Mon Apr 17 21:33:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:33:34 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Markdownify and extend README (7d8360a) Message-ID: <20170417213334.3CA0A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/7d8360ac1e3a484bae714b5253e287a0f77b80c3 >--------------------------------------------------------------- commit 7d8360ac1e3a484bae714b5253e287a0f77b80c3 Author: Herbert Valerio Riedel Date: Wed Apr 23 12:42:06 2014 +0200 Markdownify and extend README >--------------------------------------------------------------- 7d8360ac1e3a484bae714b5253e287a0f77b80c3 README | 6 ------ README.md | 12 ++++++++++++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/README b/README deleted file mode 100644 index 1fb326b..0000000 --- a/README +++ /dev/null @@ -1,6 +0,0 @@ -POTENTIAL CONTRIBUTORS -====================== - -Please follow the guidelines outlined on the Haskell Wiki when proposing an API change. - -http://www.haskell.org/haskellwiki/Library_submissions#Guidance_for_proposers diff --git a/README.md b/README.md new file mode 100644 index 0000000..0eab2ca --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +The `containers` Package [![Build Status](https://travis-ci.org/haskell/containers.svg?branch=master)](https://travis-ci.org/haskell/containers) +======================== + +See [`containers` on Hackage](http://hackage.haskell.org/package/containers) for more information. + + +Contributing +------------ + +For reporting bugs (and maybe even the respective fix), please use the [GitHub issue tracker](https://github.com/haskell/containers/issues). + +For proposing API changes/enhancements, please follow the [guidelines outlined on the Haskell Wiki](http://www.haskell.org/haskellwiki/Library_submissions#Guidance_for_proposers) (but use the GitHub facilities instead of GHC's Trac for submitting patches). From git at git.haskell.org Mon Apr 17 21:33:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:33:35 +0000 (UTC) Subject: [commit: packages/directory] branch 'cbits' created Message-ID: <20170417213335.218423A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory New branch : cbits Referencing: 3f54c1f54484c5e5cbc481b3c2e73ae7f47b3d91 From git at git.haskell.org Mon Apr 17 21:33:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:33:36 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Try to use CABALVER=1.20 again (e5d74fa) Message-ID: <20170417213336.448213A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/e5d74fa883ef2d66511d12cdb62b9586abff14c5 >--------------------------------------------------------------- commit e5d74fa883ef2d66511d12cdb62b9586abff14c5 Author: Herbert Valerio Riedel Date: Sat May 3 17:45:13 2014 +0200 Try to use CABALVER=1.20 again ...hoping that haskell/cabal#1806 has been resolved for good >--------------------------------------------------------------- e5d74fa883ef2d66511d12cdb62b9586abff14c5 .travis.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 67d893c..8af3116 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,13 +8,11 @@ env: - GHCVER=7.4.2 CABALVER=1.16 - GHCVER=7.6.3 CABALVER=1.16 - GHCVER=7.8.2 CABALVER=1.18 - # NOTE: we can't use Cabal 1.20 yet due to - # https://github.com/haskell/cabal/issues/1806 - - GHCVER=head CABALVER=1.18 + - GHCVER=head CABALVER=1.20 matrix: allow_failures: - - env: GHCVER=head CABALVER=1.18 + - env: GHCVER=head CABALVER=1.20 # Note: the distinction between `before_install` and `install` is not # important. From git at git.haskell.org Mon Apr 17 21:33:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:33:37 +0000 (UTC) Subject: [commit: packages/directory] branch 'Mistuke-bump-win32-version-bounds' created Message-ID: <20170417213337.226383A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory New branch : Mistuke-bump-win32-version-bounds Referencing: 9b60f34f60d8f6af4bdd20015beb5a35356f12d5 From git at git.haskell.org Mon Apr 17 21:33:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:33:38 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: tree: Fix imports for the Applicative/Monad change (c40e6dd) Message-ID: <20170417213338.4BF0F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/c40e6dd40861d788ee0cc337775d803d8907b6ff >--------------------------------------------------------------- commit c40e6dd40861d788ee0cc337775d803d8907b6ff Author: Austin Seipp Date: Mon May 12 07:31:59 2014 -0500 tree: Fix imports for the Applicative/Monad change Due to various problems with orphans and cycles in base, while implementing the Applicative/Monad Proposal, Alternative joined MonadPlus in Control.Monad. A knock-on effect of this is that Control.Monad now exports 'empty', which conflicts with Data.Sequence in this case. Luckily the fix is actually quite easy: just restrict the imports to liftM, since that's all we use anyway. Signed-off-by: Austin Seipp >--------------------------------------------------------------- c40e6dd40861d788ee0cc337775d803d8907b6ff Data/Tree.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Data/Tree.hs b/Data/Tree.hs index 56af20f..dab25c2 100644 --- a/Data/Tree.hs +++ b/Data/Tree.hs @@ -32,7 +32,7 @@ module Data.Tree( ) where import Control.Applicative (Applicative(..), (<$>)) -import Control.Monad +import Control.Monad (liftM) import Data.Monoid (Monoid(..)) import Data.Sequence (Seq, empty, singleton, (<|), (|>), fromList, ViewL(..), ViewR(..), viewl, viewr) From git at git.haskell.org Mon Apr 17 21:33:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:33:39 +0000 (UTC) Subject: [commit: packages/directory] branch 'bgamari-patch-1' created Message-ID: <20170417213339.237D43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory New branch : bgamari-patch-1 Referencing: 5b3cd946b1d1b2cca57ad49f8ed8e76877dff2f9 From git at git.haskell.org Mon Apr 17 21:33:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:33:40 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Merge pull request #44 from thoughtpolice/amp (e84c5d2) Message-ID: <20170417213340.545243A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/e84c5d2145415cb0beacce0909a551ae5e28d396 >--------------------------------------------------------------- commit e84c5d2145415cb0beacce0909a551ae5e28d396 Merge: e5d74fa c40e6dd Author: Milan Straka Date: Mon May 12 15:05:18 2014 +0200 Merge pull request #44 from thoughtpolice/amp tree: Fix imports for the Applicative/Monad change >--------------------------------------------------------------- e84c5d2145415cb0beacce0909a551ae5e28d396 Data/Tree.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) From git at git.haskell.org Mon Apr 17 21:33:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:33:41 +0000 (UTC) Subject: [commit: packages/directory] tag 'v1.3.0.2' created Message-ID: <20170417213341.244263A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory New tag : v1.3.0.2 Referencing: 441fa663df3cd29fe4403f78875722b6e75a1e10 From git at git.haskell.org Mon Apr 17 21:33:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:33:42 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Added fixity declarations for member, notMember, union, and intersection. (3999b51) Message-ID: <20170417213342.6033D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/3999b512f5aa28a7b119a18b286a8485d1285319 >--------------------------------------------------------------- commit 3999b512f5aa28a7b119a18b286a8485d1285319 Author: Peter Selinger Date: Fri Jul 4 10:31:20 2014 -0300 Added fixity declarations for member, notMember, union, and intersection. >--------------------------------------------------------------- 3999b512f5aa28a7b119a18b286a8485d1285319 Data/IntMap/Base.hs | 8 ++++++++ Data/IntSet/Base.hs | 7 +++++++ Data/Map/Base.hs | 8 ++++++++ Data/Set/Base.hs | 8 ++++++++ 4 files changed, 31 insertions(+) diff --git a/Data/IntMap/Base.hs b/Data/IntMap/Base.hs index 75b3ae9..9f7be70 100644 --- a/Data/IntMap/Base.hs +++ b/Data/IntMap/Base.hs @@ -395,6 +395,8 @@ member k = k `seq` go go (Tip kx _) = k == kx go Nil = False +infix 4 member + -- | /O(min(n,W))/. Is the key not a member of the map? -- -- > notMember 5 (fromList [(5,'a'), (3,'b')]) == False @@ -403,6 +405,8 @@ member k = k `seq` go notMember :: Key -> IntMap a -> Bool notMember k m = not $ member k m +infix 4 notMember + -- | /O(min(n,W))/. Lookup the value at a key in the map. See also 'Data.Map.lookup'. -- See Note: Local 'go' functions and capturing] @@ -818,6 +822,8 @@ union :: IntMap a -> IntMap a -> IntMap a union m1 m2 = mergeWithKey' Bin const id id m1 m2 +infixl 5 union + -- | /O(n+m)/. The union with a combining function. -- -- > unionWith (++) (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == fromList [(3, "b"), (5, "aA"), (7, "C")] @@ -881,6 +887,8 @@ intersection :: IntMap a -> IntMap b -> IntMap a intersection m1 m2 = mergeWithKey' bin const (const Nil) (const Nil) m1 m2 +infixl 5 intersection + -- | /O(n+m)/. The intersection with a combining function. -- -- > intersectionWith (++) (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "aA" diff --git a/Data/IntSet/Base.hs b/Data/IntSet/Base.hs index 0063c3f..9719de1 100644 --- a/Data/IntSet/Base.hs +++ b/Data/IntSet/Base.hs @@ -332,10 +332,14 @@ member x = x `seq` go go (Tip y bm) = prefixOf x == y && bitmapOf x .&. bm /= 0 go Nil = False +infix 4 member + -- | /O(min(n,W))/. Is the element not in the set? notMember :: Key -> IntSet -> Bool notMember k = not . member k +infix 4 notMember + -- | /O(log n)/. Find largest element smaller than the given one. -- -- > lookupLT 3 (fromList [3, 5]) == Nothing @@ -523,6 +527,7 @@ union t@(Bin _ _ _ _) Nil = t union (Tip kx bm) t = insertBM kx bm t union Nil t = t +infixl 5 union {-------------------------------------------------------------------- Difference @@ -597,6 +602,8 @@ intersection (Tip kx1 bm1) t2 = intersectBM t2 intersection Nil _ = Nil +infixl 5 intersection + {-------------------------------------------------------------------- Subset --------------------------------------------------------------------} diff --git a/Data/Map/Base.hs b/Data/Map/Base.hs index db9549f..9d066fa 100644 --- a/Data/Map/Base.hs +++ b/Data/Map/Base.hs @@ -456,6 +456,8 @@ member = go {-# INLINE member #-} #endif +infix 4 member + -- | /O(log n)/. Is the key not a member of the map? See also 'member'. -- -- > notMember 5 (fromList [(5,'a'), (3,'b')]) == False @@ -469,6 +471,8 @@ notMember k m = not $ member k m {-# INLINE notMember #-} #endif +infix 4 notMember + -- | /O(log n)/. Find the value at a key. -- Calls 'error' when the element can not be found. find :: Ord k => k -> Map k a -> a @@ -1230,6 +1234,8 @@ union t1 t2 = hedgeUnion NothingS NothingS t1 t2 {-# INLINABLE union #-} #endif +infixl 5 union + -- left-biased hedge union hedgeUnion :: Ord a => MaybeS a -> MaybeS a -> Map a b -> Map a b -> Map a b hedgeUnion _ _ t1 Tip = t1 @@ -1350,6 +1356,8 @@ intersection t1 t2 = hedgeInt NothingS NothingS t1 t2 {-# INLINABLE intersection #-} #endif +infixl 5 intersection + hedgeInt :: Ord k => MaybeS k -> MaybeS k -> Map k a -> Map k b -> Map k a hedgeInt _ _ _ Tip = Tip hedgeInt _ _ Tip _ = Tip diff --git a/Data/Set/Base.hs b/Data/Set/Base.hs index ffcdfd0..5727de6 100644 --- a/Data/Set/Base.hs +++ b/Data/Set/Base.hs @@ -318,6 +318,8 @@ member = go {-# INLINE member #-} #endif +infix 4 member + -- | /O(log n)/. Is the element not in the set? notMember :: Ord a => a -> Set a -> Bool notMember a t = not $ member a t @@ -327,6 +329,8 @@ notMember a t = not $ member a t {-# INLINE notMember #-} #endif +infix 4 notMember + -- | /O(log n)/. Find largest element smaller than the given one. -- -- > lookupLT 3 (fromList [3, 5]) == Nothing @@ -578,6 +582,8 @@ union t1 t2 = hedgeUnion NothingS NothingS t1 t2 {-# INLINABLE union #-} #endif +infixl 5 union + hedgeUnion :: Ord a => MaybeS a -> MaybeS a -> Set a -> Set a -> Set a hedgeUnion _ _ t1 Tip = t1 hedgeUnion blo bhi Tip (Bin _ x l r) = link x (filterGt blo l) (filterLt bhi r) @@ -636,6 +642,8 @@ intersection t1 t2 = hedgeInt NothingS NothingS t1 t2 {-# INLINABLE intersection #-} #endif +infixl 5 intersection + hedgeInt :: Ord a => MaybeS a -> MaybeS a -> Set a -> Set a -> Set a hedgeInt _ _ _ Tip = Tip hedgeInt _ _ Tip _ = Tip From git at git.haskell.org Mon Apr 17 21:33:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:33:43 +0000 (UTC) Subject: [commit: packages/directory] Mistuke-bump-win32-version-bounds, bgamari-patch-1, cbits, master: Remove tests/Makefile (192091c) Message-ID: <20170417213343.2D3F63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: Mistuke-bump-win32-version-bounds,bgamari-patch-1,cbits,master Link : http://ghc.haskell.org/trac/ghc/changeset/192091c82ac09de71144328e04dce8d59fa527a3/directory >--------------------------------------------------------------- commit 192091c82ac09de71144328e04dce8d59fa527a3 Author: Phil Ruffwind Date: Tue Apr 19 03:44:07 2016 -0400 Remove tests/Makefile Forgot to delete it when tests were migrated from GHC's test framework. >--------------------------------------------------------------- 192091c82ac09de71144328e04dce8d59fa527a3 tests/Makefile | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tests/Makefile b/tests/Makefile deleted file mode 100644 index 6a0abcf..0000000 --- a/tests/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# This Makefile runs the tests using GHC's testsuite framework. It -# assumes the package is part of a GHC build tree with the testsuite -# installed in ../../../testsuite. - -TOP=../../../testsuite -include $(TOP)/mk/boilerplate.mk -include $(TOP)/mk/test.mk From git at git.haskell.org Mon Apr 17 21:33:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:33:44 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Fixed syntax of fixity declarations. (07ab0fa) Message-ID: <20170417213344.6C4E43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/07ab0fa052843dc8fd4c874876d03d8a71525f87 >--------------------------------------------------------------- commit 07ab0fa052843dc8fd4c874876d03d8a71525f87 Author: Peter Selinger Date: Fri Jul 4 10:47:35 2014 -0300 Fixed syntax of fixity declarations. >--------------------------------------------------------------- 07ab0fa052843dc8fd4c874876d03d8a71525f87 Data/IntMap/Base.hs | 8 ++++---- Data/IntSet/Base.hs | 8 ++++---- Data/Map/Base.hs | 8 ++++---- Data/Set/Base.hs | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Data/IntMap/Base.hs b/Data/IntMap/Base.hs index 9f7be70..237aea8 100644 --- a/Data/IntMap/Base.hs +++ b/Data/IntMap/Base.hs @@ -395,7 +395,7 @@ member k = k `seq` go go (Tip kx _) = k == kx go Nil = False -infix 4 member +infix 4 `member` -- | /O(min(n,W))/. Is the key not a member of the map? -- @@ -405,7 +405,7 @@ infix 4 member notMember :: Key -> IntMap a -> Bool notMember k m = not $ member k m -infix 4 notMember +infix 4 `notMember` -- | /O(min(n,W))/. Lookup the value at a key in the map. See also 'Data.Map.lookup'. @@ -822,7 +822,7 @@ union :: IntMap a -> IntMap a -> IntMap a union m1 m2 = mergeWithKey' Bin const id id m1 m2 -infixl 5 union +infixl 5 `union` -- | /O(n+m)/. The union with a combining function. -- @@ -887,7 +887,7 @@ intersection :: IntMap a -> IntMap b -> IntMap a intersection m1 m2 = mergeWithKey' bin const (const Nil) (const Nil) m1 m2 -infixl 5 intersection +infixl 5 `intersection` -- | /O(n+m)/. The intersection with a combining function. -- diff --git a/Data/IntSet/Base.hs b/Data/IntSet/Base.hs index 9719de1..5aee4ef 100644 --- a/Data/IntSet/Base.hs +++ b/Data/IntSet/Base.hs @@ -332,13 +332,13 @@ member x = x `seq` go go (Tip y bm) = prefixOf x == y && bitmapOf x .&. bm /= 0 go Nil = False -infix 4 member +infix 4 `member` -- | /O(min(n,W))/. Is the element not in the set? notMember :: Key -> IntSet -> Bool notMember k = not . member k -infix 4 notMember +infix 4 `notMember` -- | /O(log n)/. Find largest element smaller than the given one. -- @@ -527,7 +527,7 @@ union t@(Bin _ _ _ _) Nil = t union (Tip kx bm) t = insertBM kx bm t union Nil t = t -infixl 5 union +infixl 5 `union` {-------------------------------------------------------------------- Difference @@ -602,7 +602,7 @@ intersection (Tip kx1 bm1) t2 = intersectBM t2 intersection Nil _ = Nil -infixl 5 intersection +infixl 5 `intersection` {-------------------------------------------------------------------- Subset diff --git a/Data/Map/Base.hs b/Data/Map/Base.hs index 9d066fa..bc2fd47 100644 --- a/Data/Map/Base.hs +++ b/Data/Map/Base.hs @@ -456,7 +456,7 @@ member = go {-# INLINE member #-} #endif -infix 4 member +infix 4 `member` -- | /O(log n)/. Is the key not a member of the map? See also 'member'. -- @@ -471,7 +471,7 @@ notMember k m = not $ member k m {-# INLINE notMember #-} #endif -infix 4 notMember +infix 4 `notMember` -- | /O(log n)/. Find the value at a key. -- Calls 'error' when the element can not be found. @@ -1234,7 +1234,7 @@ union t1 t2 = hedgeUnion NothingS NothingS t1 t2 {-# INLINABLE union #-} #endif -infixl 5 union +infixl 5 `union` -- left-biased hedge union hedgeUnion :: Ord a => MaybeS a -> MaybeS a -> Map a b -> Map a b -> Map a b @@ -1356,7 +1356,7 @@ intersection t1 t2 = hedgeInt NothingS NothingS t1 t2 {-# INLINABLE intersection #-} #endif -infixl 5 intersection +infixl 5 `intersection` hedgeInt :: Ord k => MaybeS k -> MaybeS k -> Map k a -> Map k b -> Map k a hedgeInt _ _ _ Tip = Tip diff --git a/Data/Set/Base.hs b/Data/Set/Base.hs index 5727de6..d0533f5 100644 --- a/Data/Set/Base.hs +++ b/Data/Set/Base.hs @@ -318,7 +318,7 @@ member = go {-# INLINE member #-} #endif -infix 4 member +infix 4 `member` -- | /O(log n)/. Is the element not in the set? notMember :: Ord a => a -> Set a -> Bool @@ -329,7 +329,7 @@ notMember a t = not $ member a t {-# INLINE notMember #-} #endif -infix 4 notMember +infix 4 `notMember` -- | /O(log n)/. Find largest element smaller than the given one. -- @@ -582,7 +582,7 @@ union t1 t2 = hedgeUnion NothingS NothingS t1 t2 {-# INLINABLE union #-} #endif -infixl 5 union +infixl 5 `union` hedgeUnion :: Ord a => MaybeS a -> MaybeS a -> Set a -> Set a -> Set a hedgeUnion _ _ t1 Tip = t1 @@ -642,7 +642,7 @@ intersection t1 t2 = hedgeInt NothingS NothingS t1 t2 {-# INLINABLE intersection #-} #endif -infixl 5 intersection +infixl 5 `intersection` hedgeInt :: Ord a => MaybeS a -> MaybeS a -> Set a -> Set a -> Set a hedgeInt _ _ _ Tip = Tip From git at git.haskell.org Mon Apr 17 21:33:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:33:45 +0000 (UTC) Subject: [commit: packages/directory] Mistuke-bump-win32-version-bounds, bgamari-patch-1, cbits, master: Change AppVeyor badge in README.md to SVG (7d36863) Message-ID: <20170417213345.343DD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: Mistuke-bump-win32-version-bounds,bgamari-patch-1,cbits,master Link : http://ghc.haskell.org/trac/ghc/changeset/7d36863a833c6a69f76d727460f9e8695f2b4dd3/directory >--------------------------------------------------------------- commit 7d36863a833c6a69f76d727460f9e8695f2b4dd3 Author: Phil Ruffwind Date: Mon Apr 25 23:56:57 2016 -0400 Change AppVeyor badge in README.md to SVG >--------------------------------------------------------------- 7d36863a833c6a69f76d727460f9e8695f2b4dd3 README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 060337d..febdafd 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,6 @@ configure` does that automatically. [hl]: https://hackage.haskell.org/package/directory [bi]: https://travis-ci.org/haskell/directory.svg?branch=master [bl]: https://travis-ci.org/haskell/directory -[wi]: https://ci.appveyor.com/api/projects/status/github/haskell/directory +[wi]: https://ci.appveyor.com/api/projects/status/github/haskell/directory?svg=true [wl]: https://ci.appveyor.com/project/Rufflewind/directory [ac]: https://gnu.org/software/autoconf From git at git.haskell.org Mon Apr 17 21:33:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:33:46 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Revert "Fixed syntax of fixity declarations." (fa2c888) Message-ID: <20170417213346.7789B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/fa2c8880efd7adf81e33de72f1a38a0c2b31e90b >--------------------------------------------------------------- commit fa2c8880efd7adf81e33de72f1a38a0c2b31e90b Author: Johan Tibell Date: Tue Jul 22 17:09:30 2014 +0200 Revert "Fixed syntax of fixity declarations." This reverts commit 07ab0fa052843dc8fd4c874876d03d8a71525f87. >--------------------------------------------------------------- fa2c8880efd7adf81e33de72f1a38a0c2b31e90b Data/IntMap/Base.hs | 8 ++++---- Data/IntSet/Base.hs | 8 ++++---- Data/Map/Base.hs | 8 ++++---- Data/Set/Base.hs | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Data/IntMap/Base.hs b/Data/IntMap/Base.hs index 237aea8..9f7be70 100644 --- a/Data/IntMap/Base.hs +++ b/Data/IntMap/Base.hs @@ -395,7 +395,7 @@ member k = k `seq` go go (Tip kx _) = k == kx go Nil = False -infix 4 `member` +infix 4 member -- | /O(min(n,W))/. Is the key not a member of the map? -- @@ -405,7 +405,7 @@ infix 4 `member` notMember :: Key -> IntMap a -> Bool notMember k m = not $ member k m -infix 4 `notMember` +infix 4 notMember -- | /O(min(n,W))/. Lookup the value at a key in the map. See also 'Data.Map.lookup'. @@ -822,7 +822,7 @@ union :: IntMap a -> IntMap a -> IntMap a union m1 m2 = mergeWithKey' Bin const id id m1 m2 -infixl 5 `union` +infixl 5 union -- | /O(n+m)/. The union with a combining function. -- @@ -887,7 +887,7 @@ intersection :: IntMap a -> IntMap b -> IntMap a intersection m1 m2 = mergeWithKey' bin const (const Nil) (const Nil) m1 m2 -infixl 5 `intersection` +infixl 5 intersection -- | /O(n+m)/. The intersection with a combining function. -- diff --git a/Data/IntSet/Base.hs b/Data/IntSet/Base.hs index 5aee4ef..9719de1 100644 --- a/Data/IntSet/Base.hs +++ b/Data/IntSet/Base.hs @@ -332,13 +332,13 @@ member x = x `seq` go go (Tip y bm) = prefixOf x == y && bitmapOf x .&. bm /= 0 go Nil = False -infix 4 `member` +infix 4 member -- | /O(min(n,W))/. Is the element not in the set? notMember :: Key -> IntSet -> Bool notMember k = not . member k -infix 4 `notMember` +infix 4 notMember -- | /O(log n)/. Find largest element smaller than the given one. -- @@ -527,7 +527,7 @@ union t@(Bin _ _ _ _) Nil = t union (Tip kx bm) t = insertBM kx bm t union Nil t = t -infixl 5 `union` +infixl 5 union {-------------------------------------------------------------------- Difference @@ -602,7 +602,7 @@ intersection (Tip kx1 bm1) t2 = intersectBM t2 intersection Nil _ = Nil -infixl 5 `intersection` +infixl 5 intersection {-------------------------------------------------------------------- Subset diff --git a/Data/Map/Base.hs b/Data/Map/Base.hs index bc2fd47..9d066fa 100644 --- a/Data/Map/Base.hs +++ b/Data/Map/Base.hs @@ -456,7 +456,7 @@ member = go {-# INLINE member #-} #endif -infix 4 `member` +infix 4 member -- | /O(log n)/. Is the key not a member of the map? See also 'member'. -- @@ -471,7 +471,7 @@ notMember k m = not $ member k m {-# INLINE notMember #-} #endif -infix 4 `notMember` +infix 4 notMember -- | /O(log n)/. Find the value at a key. -- Calls 'error' when the element can not be found. @@ -1234,7 +1234,7 @@ union t1 t2 = hedgeUnion NothingS NothingS t1 t2 {-# INLINABLE union #-} #endif -infixl 5 `union` +infixl 5 union -- left-biased hedge union hedgeUnion :: Ord a => MaybeS a -> MaybeS a -> Map a b -> Map a b -> Map a b @@ -1356,7 +1356,7 @@ intersection t1 t2 = hedgeInt NothingS NothingS t1 t2 {-# INLINABLE intersection #-} #endif -infixl 5 `intersection` +infixl 5 intersection hedgeInt :: Ord k => MaybeS k -> MaybeS k -> Map k a -> Map k b -> Map k a hedgeInt _ _ _ Tip = Tip diff --git a/Data/Set/Base.hs b/Data/Set/Base.hs index d0533f5..5727de6 100644 --- a/Data/Set/Base.hs +++ b/Data/Set/Base.hs @@ -318,7 +318,7 @@ member = go {-# INLINE member #-} #endif -infix 4 `member` +infix 4 member -- | /O(log n)/. Is the element not in the set? notMember :: Ord a => a -> Set a -> Bool @@ -329,7 +329,7 @@ notMember a t = not $ member a t {-# INLINE notMember #-} #endif -infix 4 `notMember` +infix 4 notMember -- | /O(log n)/. Find largest element smaller than the given one. -- @@ -582,7 +582,7 @@ union t1 t2 = hedgeUnion NothingS NothingS t1 t2 {-# INLINABLE union #-} #endif -infixl 5 `union` +infixl 5 union hedgeUnion :: Ord a => MaybeS a -> MaybeS a -> Set a -> Set a -> Set a hedgeUnion _ _ t1 Tip = t1 @@ -642,7 +642,7 @@ intersection t1 t2 = hedgeInt NothingS NothingS t1 t2 {-# INLINABLE intersection #-} #endif -infixl 5 `intersection` +infixl 5 intersection hedgeInt :: Ord a => MaybeS a -> MaybeS a -> Set a -> Set a -> Set a hedgeInt _ _ _ Tip = Tip From git at git.haskell.org Mon Apr 17 21:33:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:33:47 +0000 (UTC) Subject: [commit: packages/directory] Mistuke-bump-win32-version-bounds, bgamari-patch-1, cbits, master: Remove dependence on HsDirectory.h in configure.ac (e938629) Message-ID: <20170417213347.39E093A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: Mistuke-bump-win32-version-bounds,bgamari-patch-1,cbits,master Link : http://ghc.haskell.org/trac/ghc/changeset/e938629f39ec089d63c28354bc67be65ca682a16/directory >--------------------------------------------------------------- commit e938629f39ec089d63c28354bc67be65ca682a16 Author: Phil Ruffwind Date: Wed Apr 27 00:04:49 2016 -0400 Remove dependence on HsDirectory.h in configure.ac >--------------------------------------------------------------- e938629f39ec089d63c28354bc67be65ca682a16 configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index a620ec4..68a1cf9 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ AC_INIT([Haskell directory package], [1.0], [libraries at haskell.org], [directory]) # Safety check: Ensure that we are in the correct source directory. -AC_CONFIG_SRCDIR([include/HsDirectory.h]) +AC_CONFIG_SRCDIR([System/Directory.hs]) AC_CONFIG_HEADERS([include/HsDirectoryConfig.h]) From git at git.haskell.org Mon Apr 17 21:33:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:33:48 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Revert "Added fixity declarations for member, notMember, union, and intersection." (3b1eee5) Message-ID: <20170417213348.8314D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/3b1eee514581edcc51c3c4304087e2dff30e05cd >--------------------------------------------------------------- commit 3b1eee514581edcc51c3c4304087e2dff30e05cd Author: Johan Tibell Date: Tue Jul 22 17:09:50 2014 +0200 Revert "Added fixity declarations for member, notMember, union, and intersection." This reverts commit 3999b512f5aa28a7b119a18b286a8485d1285319. >--------------------------------------------------------------- 3b1eee514581edcc51c3c4304087e2dff30e05cd Data/IntMap/Base.hs | 8 -------- Data/IntSet/Base.hs | 7 ------- Data/Map/Base.hs | 8 -------- Data/Set/Base.hs | 8 -------- 4 files changed, 31 deletions(-) diff --git a/Data/IntMap/Base.hs b/Data/IntMap/Base.hs index 9f7be70..75b3ae9 100644 --- a/Data/IntMap/Base.hs +++ b/Data/IntMap/Base.hs @@ -395,8 +395,6 @@ member k = k `seq` go go (Tip kx _) = k == kx go Nil = False -infix 4 member - -- | /O(min(n,W))/. Is the key not a member of the map? -- -- > notMember 5 (fromList [(5,'a'), (3,'b')]) == False @@ -405,8 +403,6 @@ infix 4 member notMember :: Key -> IntMap a -> Bool notMember k m = not $ member k m -infix 4 notMember - -- | /O(min(n,W))/. Lookup the value at a key in the map. See also 'Data.Map.lookup'. -- See Note: Local 'go' functions and capturing] @@ -822,8 +818,6 @@ union :: IntMap a -> IntMap a -> IntMap a union m1 m2 = mergeWithKey' Bin const id id m1 m2 -infixl 5 union - -- | /O(n+m)/. The union with a combining function. -- -- > unionWith (++) (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == fromList [(3, "b"), (5, "aA"), (7, "C")] @@ -887,8 +881,6 @@ intersection :: IntMap a -> IntMap b -> IntMap a intersection m1 m2 = mergeWithKey' bin const (const Nil) (const Nil) m1 m2 -infixl 5 intersection - -- | /O(n+m)/. The intersection with a combining function. -- -- > intersectionWith (++) (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "aA" diff --git a/Data/IntSet/Base.hs b/Data/IntSet/Base.hs index 9719de1..0063c3f 100644 --- a/Data/IntSet/Base.hs +++ b/Data/IntSet/Base.hs @@ -332,14 +332,10 @@ member x = x `seq` go go (Tip y bm) = prefixOf x == y && bitmapOf x .&. bm /= 0 go Nil = False -infix 4 member - -- | /O(min(n,W))/. Is the element not in the set? notMember :: Key -> IntSet -> Bool notMember k = not . member k -infix 4 notMember - -- | /O(log n)/. Find largest element smaller than the given one. -- -- > lookupLT 3 (fromList [3, 5]) == Nothing @@ -527,7 +523,6 @@ union t@(Bin _ _ _ _) Nil = t union (Tip kx bm) t = insertBM kx bm t union Nil t = t -infixl 5 union {-------------------------------------------------------------------- Difference @@ -602,8 +597,6 @@ intersection (Tip kx1 bm1) t2 = intersectBM t2 intersection Nil _ = Nil -infixl 5 intersection - {-------------------------------------------------------------------- Subset --------------------------------------------------------------------} diff --git a/Data/Map/Base.hs b/Data/Map/Base.hs index 9d066fa..db9549f 100644 --- a/Data/Map/Base.hs +++ b/Data/Map/Base.hs @@ -456,8 +456,6 @@ member = go {-# INLINE member #-} #endif -infix 4 member - -- | /O(log n)/. Is the key not a member of the map? See also 'member'. -- -- > notMember 5 (fromList [(5,'a'), (3,'b')]) == False @@ -471,8 +469,6 @@ notMember k m = not $ member k m {-# INLINE notMember #-} #endif -infix 4 notMember - -- | /O(log n)/. Find the value at a key. -- Calls 'error' when the element can not be found. find :: Ord k => k -> Map k a -> a @@ -1234,8 +1230,6 @@ union t1 t2 = hedgeUnion NothingS NothingS t1 t2 {-# INLINABLE union #-} #endif -infixl 5 union - -- left-biased hedge union hedgeUnion :: Ord a => MaybeS a -> MaybeS a -> Map a b -> Map a b -> Map a b hedgeUnion _ _ t1 Tip = t1 @@ -1356,8 +1350,6 @@ intersection t1 t2 = hedgeInt NothingS NothingS t1 t2 {-# INLINABLE intersection #-} #endif -infixl 5 intersection - hedgeInt :: Ord k => MaybeS k -> MaybeS k -> Map k a -> Map k b -> Map k a hedgeInt _ _ _ Tip = Tip hedgeInt _ _ Tip _ = Tip diff --git a/Data/Set/Base.hs b/Data/Set/Base.hs index 5727de6..ffcdfd0 100644 --- a/Data/Set/Base.hs +++ b/Data/Set/Base.hs @@ -318,8 +318,6 @@ member = go {-# INLINE member #-} #endif -infix 4 member - -- | /O(log n)/. Is the element not in the set? notMember :: Ord a => a -> Set a -> Bool notMember a t = not $ member a t @@ -329,8 +327,6 @@ notMember a t = not $ member a t {-# INLINE notMember #-} #endif -infix 4 notMember - -- | /O(log n)/. Find largest element smaller than the given one. -- -- > lookupLT 3 (fromList [3, 5]) == Nothing @@ -582,8 +578,6 @@ union t1 t2 = hedgeUnion NothingS NothingS t1 t2 {-# INLINABLE union #-} #endif -infixl 5 union - hedgeUnion :: Ord a => MaybeS a -> MaybeS a -> Set a -> Set a -> Set a hedgeUnion _ _ t1 Tip = t1 hedgeUnion blo bhi Tip (Bin _ x l r) = link x (filterGt blo l) (filterLt bhi r) @@ -642,8 +636,6 @@ intersection t1 t2 = hedgeInt NothingS NothingS t1 t2 {-# INLINABLE intersection #-} #endif -infixl 5 intersection - hedgeInt :: Ord a => MaybeS a -> MaybeS a -> Set a -> Set a -> Set a hedgeInt _ _ _ Tip = Tip hedgeInt _ _ Tip _ = Tip From git at git.haskell.org Mon Apr 17 21:33:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:33:50 +0000 (UTC) Subject: [commit: packages/containers] develop: Fixed syntax of fixity declarations. (6ec9b1b) Message-ID: <20170417213350.8E4D83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branch : develop Link : http://git.haskell.org/packages/containers.git/commitdiff/6ec9b1b4be2d7c264ebd2aa9d6ed06c98029cf8f >--------------------------------------------------------------- commit 6ec9b1b4be2d7c264ebd2aa9d6ed06c98029cf8f Author: Peter Selinger Date: Fri Jul 4 10:47:35 2014 -0300 Fixed syntax of fixity declarations. >--------------------------------------------------------------- 6ec9b1b4be2d7c264ebd2aa9d6ed06c98029cf8f Data/IntMap/Base.hs | 8 ++++---- Data/IntSet/Base.hs | 8 ++++---- Data/Map/Base.hs | 8 ++++---- Data/Set/Base.hs | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Data/IntMap/Base.hs b/Data/IntMap/Base.hs index 9f7be70..237aea8 100644 --- a/Data/IntMap/Base.hs +++ b/Data/IntMap/Base.hs @@ -395,7 +395,7 @@ member k = k `seq` go go (Tip kx _) = k == kx go Nil = False -infix 4 member +infix 4 `member` -- | /O(min(n,W))/. Is the key not a member of the map? -- @@ -405,7 +405,7 @@ infix 4 member notMember :: Key -> IntMap a -> Bool notMember k m = not $ member k m -infix 4 notMember +infix 4 `notMember` -- | /O(min(n,W))/. Lookup the value at a key in the map. See also 'Data.Map.lookup'. @@ -822,7 +822,7 @@ union :: IntMap a -> IntMap a -> IntMap a union m1 m2 = mergeWithKey' Bin const id id m1 m2 -infixl 5 union +infixl 5 `union` -- | /O(n+m)/. The union with a combining function. -- @@ -887,7 +887,7 @@ intersection :: IntMap a -> IntMap b -> IntMap a intersection m1 m2 = mergeWithKey' bin const (const Nil) (const Nil) m1 m2 -infixl 5 intersection +infixl 5 `intersection` -- | /O(n+m)/. The intersection with a combining function. -- diff --git a/Data/IntSet/Base.hs b/Data/IntSet/Base.hs index 9719de1..5aee4ef 100644 --- a/Data/IntSet/Base.hs +++ b/Data/IntSet/Base.hs @@ -332,13 +332,13 @@ member x = x `seq` go go (Tip y bm) = prefixOf x == y && bitmapOf x .&. bm /= 0 go Nil = False -infix 4 member +infix 4 `member` -- | /O(min(n,W))/. Is the element not in the set? notMember :: Key -> IntSet -> Bool notMember k = not . member k -infix 4 notMember +infix 4 `notMember` -- | /O(log n)/. Find largest element smaller than the given one. -- @@ -527,7 +527,7 @@ union t@(Bin _ _ _ _) Nil = t union (Tip kx bm) t = insertBM kx bm t union Nil t = t -infixl 5 union +infixl 5 `union` {-------------------------------------------------------------------- Difference @@ -602,7 +602,7 @@ intersection (Tip kx1 bm1) t2 = intersectBM t2 intersection Nil _ = Nil -infixl 5 intersection +infixl 5 `intersection` {-------------------------------------------------------------------- Subset diff --git a/Data/Map/Base.hs b/Data/Map/Base.hs index 9d066fa..bc2fd47 100644 --- a/Data/Map/Base.hs +++ b/Data/Map/Base.hs @@ -456,7 +456,7 @@ member = go {-# INLINE member #-} #endif -infix 4 member +infix 4 `member` -- | /O(log n)/. Is the key not a member of the map? See also 'member'. -- @@ -471,7 +471,7 @@ notMember k m = not $ member k m {-# INLINE notMember #-} #endif -infix 4 notMember +infix 4 `notMember` -- | /O(log n)/. Find the value at a key. -- Calls 'error' when the element can not be found. @@ -1234,7 +1234,7 @@ union t1 t2 = hedgeUnion NothingS NothingS t1 t2 {-# INLINABLE union #-} #endif -infixl 5 union +infixl 5 `union` -- left-biased hedge union hedgeUnion :: Ord a => MaybeS a -> MaybeS a -> Map a b -> Map a b -> Map a b @@ -1356,7 +1356,7 @@ intersection t1 t2 = hedgeInt NothingS NothingS t1 t2 {-# INLINABLE intersection #-} #endif -infixl 5 intersection +infixl 5 `intersection` hedgeInt :: Ord k => MaybeS k -> MaybeS k -> Map k a -> Map k b -> Map k a hedgeInt _ _ _ Tip = Tip diff --git a/Data/Set/Base.hs b/Data/Set/Base.hs index 5727de6..d0533f5 100644 --- a/Data/Set/Base.hs +++ b/Data/Set/Base.hs @@ -318,7 +318,7 @@ member = go {-# INLINE member #-} #endif -infix 4 member +infix 4 `member` -- | /O(log n)/. Is the element not in the set? notMember :: Ord a => a -> Set a -> Bool @@ -329,7 +329,7 @@ notMember a t = not $ member a t {-# INLINE notMember #-} #endif -infix 4 notMember +infix 4 `notMember` -- | /O(log n)/. Find largest element smaller than the given one. -- @@ -582,7 +582,7 @@ union t1 t2 = hedgeUnion NothingS NothingS t1 t2 {-# INLINABLE union #-} #endif -infixl 5 union +infixl 5 `union` hedgeUnion :: Ord a => MaybeS a -> MaybeS a -> Set a -> Set a -> Set a hedgeUnion _ _ t1 Tip = t1 @@ -642,7 +642,7 @@ intersection t1 t2 = hedgeInt NothingS NothingS t1 t2 {-# INLINABLE intersection #-} #endif -infixl 5 intersection +infixl 5 `intersection` hedgeInt :: Ord a => MaybeS a -> MaybeS a -> Set a -> Set a -> Set a hedgeInt _ _ _ Tip = Tip From git at git.haskell.org Mon Apr 17 21:33:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:33:49 +0000 (UTC) Subject: [commit: packages/directory] Mistuke-bump-win32-version-bounds, bgamari-patch-1, cbits, master: Move HsDirectoryConfig.h to root directory (1d94ce6) Message-ID: <20170417213349.41EED3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: Mistuke-bump-win32-version-bounds,bgamari-patch-1,cbits,master Link : http://ghc.haskell.org/trac/ghc/changeset/1d94ce6a4b594e6d01666d1326993d612d35c9eb/directory >--------------------------------------------------------------- commit 1d94ce6a4b594e6d01666d1326993d612d35c9eb Author: Phil Ruffwind Date: Wed Apr 27 00:59:11 2016 -0400 Move HsDirectoryConfig.h to root directory This is avoids the need to create the "include" directory whenever autoreconf is initially run from a fresh repo, as once HsDirectory.h is removed later on there will no longer be an "include" directory in the Git repo. (We could of course create a dummy file to keep the "include" directory, but that adds unnecessary clutter to the Git tree.) >--------------------------------------------------------------- 1d94ce6a4b594e6d01666d1326993d612d35c9eb .gitignore | 4 ++-- configure.ac | 2 +- directory.cabal | 6 +++--- tools/testscript | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index ad4e1bf..590cba3 100644 --- a/.gitignore +++ b/.gitignore @@ -5,8 +5,8 @@ config.log config.status configure dist/ -include/HsDirectoryConfig.h -include/HsDirectoryConfig.h.in +HsDirectoryConfig.h +HsDirectoryConfig.h.in *~ # In GHC build tree: diff --git a/configure.ac b/configure.ac index 68a1cf9..3999681 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ AC_INIT([Haskell directory package], [1.0], [libraries at haskell.org], [directory] # Safety check: Ensure that we are in the correct source directory. AC_CONFIG_SRCDIR([System/Directory.hs]) -AC_CONFIG_HEADERS([include/HsDirectoryConfig.h]) +AC_CONFIG_HEADERS([HsDirectoryConfig.h]) # Autoconf chokes on spaces, but we may receive a path from Cabal containing # spaces. In that case, we just ignore Cabal's suggestion. diff --git a/directory.cabal b/directory.cabal index a03cb67..27f528f 100644 --- a/directory.cabal +++ b/directory.cabal @@ -18,7 +18,7 @@ extra-tmp-files: autom4te.cache config.log config.status - include/HsDirectoryConfig.h + HsDirectoryConfig.h extra-source-files: changelog.md @@ -26,7 +26,7 @@ extra-source-files: configure configure.ac directory.buildinfo - include/HsDirectoryConfig.h.in + HsDirectoryConfig.h.in tests/*.hs tests/util.inl @@ -51,7 +51,7 @@ Library c-sources: cbits/directory.c - include-dirs: include + include-dirs: . include includes: HsDirectory.h install-includes: diff --git a/tools/testscript b/tools/testscript index e71aac0..1df340d 100755 --- a/tools/testscript +++ b/tools/testscript @@ -6,7 +6,7 @@ testflags="CreateDirectoryIfMissing001.num-repeats=100000 +RTS -N2" post_configure() { if [ "${DISABLE_UTIMENSAT+x}" ]; then - sed -i "s/#define HAVE_UTIMENSAT 1//" include/HsDirectoryConfig.h + sed -i "s/#define HAVE_UTIMENSAT 1//" HsDirectoryConfig.h fi } From git at git.haskell.org Mon Apr 17 21:33:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:33:51 +0000 (UTC) Subject: [commit: packages/directory] Mistuke-bump-win32-version-bounds, bgamari-patch-1, cbits, master: Move Windows-specific foreign entities to Internal modules (d05d7fd) Message-ID: <20170417213351.483243A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: Mistuke-bump-win32-version-bounds,bgamari-patch-1,cbits,master Link : http://ghc.haskell.org/trac/ghc/changeset/d05d7fdb27cc5c1e54e0ebb5e5a96335efc785a8/directory >--------------------------------------------------------------- commit d05d7fdb27cc5c1e54e0ebb5e5a96335efc785a8 Author: Phil Ruffwind Date: Wed Apr 27 01:24:49 2016 -0400 Move Windows-specific foreign entities to Internal modules >--------------------------------------------------------------- d05d7fdb27cc5c1e54e0ebb5e5a96335efc785a8 System/Directory.hs | 20 +------------------- System/Directory/Internal/C_utimensat.hsc | 6 ++---- System/Directory/Internal/Posix.hsc | 6 ++---- System/Directory/Internal/Windows.hsc | 30 ++++++++++++++++++++++++++---- 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/System/Directory.hs b/System/Directory.hs index 4e41e14..bec9149 100644 --- a/System/Directory.hs +++ b/System/Directory.hs @@ -161,18 +161,6 @@ import System.Posix.Internals ( withFilePath ) import System.Directory.Internal -#ifdef mingw32_HOST_OS -win32_cSIDL_LOCAL_APPDATA :: Win32.CSIDL -win32_fILE_SHARE_DELETE :: Win32.ShareMode -#if MIN_VERSION_Win32(2, 3, 1) -win32_cSIDL_LOCAL_APPDATA = Win32.cSIDL_LOCAL_APPDATA -- only on HEAD atm -win32_fILE_SHARE_DELETE = Win32.fILE_SHARE_DELETE -- added in 2.3.0.2 -#else -win32_cSIDL_LOCAL_APPDATA = 0x001c -win32_fILE_SHARE_DELETE = 0x00000004 -#endif -#endif - {- $intro A directory contains a series of entries, each of which is a named reference to a file system object (file, directory etc.). Some @@ -336,11 +324,6 @@ setPermissions name (Permissions r w e s) = modifyBit True m b = m .|. b #endif -#ifdef mingw32_HOST_OS -foreign import ccall unsafe "_wchmod" - c_wchmod :: CWString -> CMode -> IO CInt -#endif - copyPermissions :: FilePath -> FilePath -> IO () copyPermissions source dest = #ifdef mingw32_HOST_OS @@ -1375,8 +1358,7 @@ isSymbolicLink path = #ifdef mingw32_HOST_OS isReparsePoint <$> Win32.getFileAttributes path where - fILE_ATTRIBUTE_REPARSE_POINT = 0x400 - isReparsePoint attr = attr .&. fILE_ATTRIBUTE_REPARSE_POINT /= 0 + isReparsePoint attr = attr .&. win32_fILE_ATTRIBUTE_REPARSE_POINT /= 0 #else Posix.isSymbolicLink <$> Posix.getSymbolicLinkStatus path #endif diff --git a/System/Directory/Internal/C_utimensat.hsc b/System/Directory/Internal/C_utimensat.hsc index cc3295b..7182393 100644 --- a/System/Directory/Internal/C_utimensat.hsc +++ b/System/Directory/Internal/C_utimensat.hsc @@ -1,5 +1,6 @@ +module System.Directory.Internal.C_utimensat where #include - +#ifdef HAVE_UTIMENSAT #ifdef HAVE_FCNTL_H # include #endif @@ -9,9 +10,6 @@ #ifdef HAVE_SYS_STAT_H # include #endif - -module System.Directory.Internal.C_utimensat where -#ifdef HAVE_UTIMENSAT import Foreign import Foreign.C import Data.Time.Clock.POSIX (POSIXTime) diff --git a/System/Directory/Internal/Posix.hsc b/System/Directory/Internal/Posix.hsc index 8dfd6fb..1cea4b0 100644 --- a/System/Directory/Internal/Posix.hsc +++ b/System/Directory/Internal/Posix.hsc @@ -1,11 +1,9 @@ +module System.Directory.Internal.Posix where #include - +#ifndef mingw32_HOST_OS #ifdef HAVE_LIMITS_H # include #endif - -module System.Directory.Internal.Posix where -#ifndef mingw32_HOST_OS import Control.Monad ((>=>)) import Control.Exception (bracket) import Foreign diff --git a/System/Directory/Internal/Windows.hsc b/System/Directory/Internal/Windows.hsc index 5eb36fc..25521fe 100644 --- a/System/Directory/Internal/Windows.hsc +++ b/System/Directory/Internal/Windows.hsc @@ -1,12 +1,34 @@ +module System.Directory.Internal.Windows where #include - +#ifdef mingw32_HOST_OS +#include +#include #ifdef HAVE_SYS_STAT_H # include #endif - -module System.Directory.Internal.Windows where -#ifdef mingw32_HOST_OS +import Foreign.C import System.Posix.Types +import qualified System.Win32 as Win32 + +win32_cSIDL_LOCAL_APPDATA :: Win32.CSIDL +#if MIN_VERSION_Win32(2, 3, 1) +win32_cSIDL_LOCAL_APPDATA = Win32.cSIDL_LOCAL_APPDATA +#else +win32_cSIDL_LOCAL_APPDATA = (#const CSIDL_LOCAL_APPDATA) +#endif + +win32_fILE_ATTRIBUTE_REPARSE_POINT :: Win32.FileAttributeOrFlag +win32_fILE_ATTRIBUTE_REPARSE_POINT = (#const FILE_ATTRIBUTE_REPARSE_POINT) + +win32_fILE_SHARE_DELETE :: Win32.ShareMode +#if MIN_VERSION_Win32(2, 3, 1) +win32_fILE_SHARE_DELETE = Win32.fILE_SHARE_DELETE -- added in 2.3.0.2 +#else +win32_fILE_SHARE_DELETE = (#const FILE_SHARE_DELETE) +#endif + +foreign import ccall unsafe "_wchmod" + c_wchmod :: CWString -> CMode -> IO CInt s_IRUSR :: CMode s_IRUSR = (#const S_IRUSR) From git at git.haskell.org Mon Apr 17 21:33:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:33:52 +0000 (UTC) Subject: [commit: packages/containers] develop: Added fixity declarations for member, notMember, union, and intersection. (4dd6e01) Message-ID: <20170417213352.9A2073A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branch : develop Link : http://git.haskell.org/packages/containers.git/commitdiff/4dd6e01a78774de5e5dd6639b55a2902e610e0cc >--------------------------------------------------------------- commit 4dd6e01a78774de5e5dd6639b55a2902e610e0cc Author: Peter Selinger Date: Fri Jul 4 10:31:20 2014 -0300 Added fixity declarations for member, notMember, union, and intersection. >--------------------------------------------------------------- 4dd6e01a78774de5e5dd6639b55a2902e610e0cc Data/IntMap/Base.hs | 8 ++++++++ Data/IntSet/Base.hs | 7 +++++++ Data/Map/Base.hs | 8 ++++++++ Data/Set/Base.hs | 8 ++++++++ 4 files changed, 31 insertions(+) diff --git a/Data/IntMap/Base.hs b/Data/IntMap/Base.hs index 75b3ae9..9f7be70 100644 --- a/Data/IntMap/Base.hs +++ b/Data/IntMap/Base.hs @@ -395,6 +395,8 @@ member k = k `seq` go go (Tip kx _) = k == kx go Nil = False +infix 4 member + -- | /O(min(n,W))/. Is the key not a member of the map? -- -- > notMember 5 (fromList [(5,'a'), (3,'b')]) == False @@ -403,6 +405,8 @@ member k = k `seq` go notMember :: Key -> IntMap a -> Bool notMember k m = not $ member k m +infix 4 notMember + -- | /O(min(n,W))/. Lookup the value at a key in the map. See also 'Data.Map.lookup'. -- See Note: Local 'go' functions and capturing] @@ -818,6 +822,8 @@ union :: IntMap a -> IntMap a -> IntMap a union m1 m2 = mergeWithKey' Bin const id id m1 m2 +infixl 5 union + -- | /O(n+m)/. The union with a combining function. -- -- > unionWith (++) (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == fromList [(3, "b"), (5, "aA"), (7, "C")] @@ -881,6 +887,8 @@ intersection :: IntMap a -> IntMap b -> IntMap a intersection m1 m2 = mergeWithKey' bin const (const Nil) (const Nil) m1 m2 +infixl 5 intersection + -- | /O(n+m)/. The intersection with a combining function. -- -- > intersectionWith (++) (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "aA" diff --git a/Data/IntSet/Base.hs b/Data/IntSet/Base.hs index 0063c3f..9719de1 100644 --- a/Data/IntSet/Base.hs +++ b/Data/IntSet/Base.hs @@ -332,10 +332,14 @@ member x = x `seq` go go (Tip y bm) = prefixOf x == y && bitmapOf x .&. bm /= 0 go Nil = False +infix 4 member + -- | /O(min(n,W))/. Is the element not in the set? notMember :: Key -> IntSet -> Bool notMember k = not . member k +infix 4 notMember + -- | /O(log n)/. Find largest element smaller than the given one. -- -- > lookupLT 3 (fromList [3, 5]) == Nothing @@ -523,6 +527,7 @@ union t@(Bin _ _ _ _) Nil = t union (Tip kx bm) t = insertBM kx bm t union Nil t = t +infixl 5 union {-------------------------------------------------------------------- Difference @@ -597,6 +602,8 @@ intersection (Tip kx1 bm1) t2 = intersectBM t2 intersection Nil _ = Nil +infixl 5 intersection + {-------------------------------------------------------------------- Subset --------------------------------------------------------------------} diff --git a/Data/Map/Base.hs b/Data/Map/Base.hs index db9549f..9d066fa 100644 --- a/Data/Map/Base.hs +++ b/Data/Map/Base.hs @@ -456,6 +456,8 @@ member = go {-# INLINE member #-} #endif +infix 4 member + -- | /O(log n)/. Is the key not a member of the map? See also 'member'. -- -- > notMember 5 (fromList [(5,'a'), (3,'b')]) == False @@ -469,6 +471,8 @@ notMember k m = not $ member k m {-# INLINE notMember #-} #endif +infix 4 notMember + -- | /O(log n)/. Find the value at a key. -- Calls 'error' when the element can not be found. find :: Ord k => k -> Map k a -> a @@ -1230,6 +1234,8 @@ union t1 t2 = hedgeUnion NothingS NothingS t1 t2 {-# INLINABLE union #-} #endif +infixl 5 union + -- left-biased hedge union hedgeUnion :: Ord a => MaybeS a -> MaybeS a -> Map a b -> Map a b -> Map a b hedgeUnion _ _ t1 Tip = t1 @@ -1350,6 +1356,8 @@ intersection t1 t2 = hedgeInt NothingS NothingS t1 t2 {-# INLINABLE intersection #-} #endif +infixl 5 intersection + hedgeInt :: Ord k => MaybeS k -> MaybeS k -> Map k a -> Map k b -> Map k a hedgeInt _ _ _ Tip = Tip hedgeInt _ _ Tip _ = Tip diff --git a/Data/Set/Base.hs b/Data/Set/Base.hs index ffcdfd0..5727de6 100644 --- a/Data/Set/Base.hs +++ b/Data/Set/Base.hs @@ -318,6 +318,8 @@ member = go {-# INLINE member #-} #endif +infix 4 member + -- | /O(log n)/. Is the element not in the set? notMember :: Ord a => a -> Set a -> Bool notMember a t = not $ member a t @@ -327,6 +329,8 @@ notMember a t = not $ member a t {-# INLINE notMember #-} #endif +infix 4 notMember + -- | /O(log n)/. Find largest element smaller than the given one. -- -- > lookupLT 3 (fromList [3, 5]) == Nothing @@ -578,6 +582,8 @@ union t1 t2 = hedgeUnion NothingS NothingS t1 t2 {-# INLINABLE union #-} #endif +infixl 5 union + hedgeUnion :: Ord a => MaybeS a -> MaybeS a -> Set a -> Set a -> Set a hedgeUnion _ _ t1 Tip = t1 hedgeUnion blo bhi Tip (Bin _ x l r) = link x (filterGt blo l) (filterLt bhi r) @@ -636,6 +642,8 @@ intersection t1 t2 = hedgeInt NothingS NothingS t1 t2 {-# INLINABLE intersection #-} #endif +infixl 5 intersection + hedgeInt :: Ord a => MaybeS a -> MaybeS a -> Set a -> Set a -> Set a hedgeInt _ _ _ Tip = Tip hedgeInt _ _ Tip _ = Tip From git at git.haskell.org Mon Apr 17 21:33:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:33:53 +0000 (UTC) Subject: [commit: packages/directory] Mistuke-bump-win32-version-bounds, bgamari-patch-1, cbits, master: Rename Internal.hsc to Internal.hs (bb7e90a) Message-ID: <20170417213353.4FD2C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: Mistuke-bump-win32-version-bounds,bgamari-patch-1,cbits,master Link : http://ghc.haskell.org/trac/ghc/changeset/bb7e90a1b8ab9db3430e27b5594f241f10d21aab/directory >--------------------------------------------------------------- commit bb7e90a1b8ab9db3430e27b5594f241f10d21aab Author: Phil Ruffwind Date: Wed Apr 27 00:20:30 2016 -0400 Rename Internal.hsc to Internal.hs The file doesn't use any hsc features. >--------------------------------------------------------------- bb7e90a1b8ab9db3430e27b5594f241f10d21aab System/Directory/{Internal.hsc => Internal.hs} | 1 + 1 file changed, 1 insertion(+) diff --git a/System/Directory/Internal.hsc b/System/Directory/Internal.hs similarity index 96% rename from System/Directory/Internal.hsc rename to System/Directory/Internal.hs index e6bd979..64a340b 100644 --- a/System/Directory/Internal.hsc +++ b/System/Directory/Internal.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} #include module System.Directory.Internal From git at git.haskell.org Mon Apr 17 21:33:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:33:54 +0000 (UTC) Subject: [commit: packages/containers] develop: Merge branch 'selinger-master' into develop. (f8629a2) Message-ID: <20170417213354.A3ED43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branch : develop Link : http://git.haskell.org/packages/containers.git/commitdiff/f8629a228545896ed9133fd72ebbcf97336767da >--------------------------------------------------------------- commit f8629a228545896ed9133fd72ebbcf97336767da Merge: 3b1eee5 6ec9b1b Author: Milan Straka Date: Fri Aug 8 11:06:49 2014 +0200 Merge branch 'selinger-master' into develop. PVP: Major version bump is needed. >--------------------------------------------------------------- f8629a228545896ed9133fd72ebbcf97336767da Data/IntMap/Base.hs | 8 ++++++++ Data/IntSet/Base.hs | 7 +++++++ Data/Map/Base.hs | 8 ++++++++ Data/Set/Base.hs | 8 ++++++++ 4 files changed, 31 insertions(+) From git at git.haskell.org Mon Apr 17 21:33:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:33:55 +0000 (UTC) Subject: [commit: packages/directory] Mistuke-bump-win32-version-bounds, bgamari-patch-1, cbits, master: Import (<*>) on Windows when base < 4.8 (ba68962) Message-ID: <20170417213355.568A03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: Mistuke-bump-win32-version-bounds,bgamari-patch-1,cbits,master Link : http://ghc.haskell.org/trac/ghc/changeset/ba689623323720f0ee1f8d0dbcf7c5499e8c3e06/directory >--------------------------------------------------------------- commit ba689623323720f0ee1f8d0dbcf7c5499e8c3e06 Author: Phil Ruffwind Date: Sat Apr 30 13:48:25 2016 -0400 Import (<*>) on Windows when base < 4.8 Fixes #53. >--------------------------------------------------------------- ba689623323720f0ee1f8d0dbcf7c5499e8c3e06 System/Directory.hs | 3 +++ changelog.md | 5 +++++ directory.cabal | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/System/Directory.hs b/System/Directory.hs index bec9149..19a322a 100644 --- a/System/Directory.hs +++ b/System/Directory.hs @@ -100,6 +100,9 @@ module System.Directory import Control.Exception (bracket, mask, onException) import Control.Monad ( when, unless ) #ifdef mingw32_HOST_OS +#if !MIN_VERSION_base(4, 8, 0) +import Control.Applicative ((<*>)) +#endif import Data.Function (on) #endif #if !MIN_VERSION_base(4, 8, 0) diff --git a/changelog.md b/changelog.md index 83e1a4a..0d36c1a 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,11 @@ Changelog for the [`directory`][1] package ========================================== +## 1.2.6.3 (April 2015) + + * Add missing import of `(<*>)` on Windows for `base` earlier than 4.8.0.0 + ([#53](https://github.com/haskell/directory/issues/53)) + ## 1.2.6.2 (April 2015) * Fix typo in file time functions when `utimensat` is not available and diff --git a/directory.cabal b/directory.cabal index 27f528f..18f0094 100644 --- a/directory.cabal +++ b/directory.cabal @@ -1,5 +1,5 @@ name: directory -version: 1.2.6.2 +version: 1.2.6.3 -- NOTE: Don't forget to update ./changelog.md license: BSD3 license-file: LICENSE From git at git.haskell.org Mon Apr 17 21:33:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:33:56 +0000 (UTC) Subject: [commit: packages/containers] develop: Make types of the drawing functions more generic, i.e. Show s => Tree s instead of Tree String (2c85f08) Message-ID: <20170417213356.AB2983A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branch : develop Link : http://git.haskell.org/packages/containers.git/commitdiff/2c85f0823848ef7f70a27944bc4741c91ca1c0ef >--------------------------------------------------------------- commit 2c85f0823848ef7f70a27944bc4741c91ca1c0ef Author: jonasc Date: Fri Aug 8 00:15:10 2014 +0200 Make types of the drawing functions more generic, i.e. Show s => Tree s instead of Tree String >--------------------------------------------------------------- 2c85f0823848ef7f70a27944bc4741c91ca1c0ef Data/Tree.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Data/Tree.hs b/Data/Tree.hs index dab25c2..7cfba42 100644 --- a/Data/Tree.hs +++ b/Data/Tree.hs @@ -83,15 +83,15 @@ instance NFData a => NFData (Tree a) where rnf (Node x ts) = rnf x `seq` rnf ts -- | Neat 2-dimensional drawing of a tree. -drawTree :: Tree String -> String +drawTree :: Show a => Tree a -> String drawTree = unlines . draw -- | Neat 2-dimensional drawing of a forest. -drawForest :: Forest String -> String +drawForest :: Show a => Forest a -> String drawForest = unlines . map drawTree -draw :: Tree String -> [String] -draw (Node x ts0) = x : drawSubTrees ts0 +draw :: Show a => Tree a -> [String] +draw (Node x ts0) = show x : drawSubTrees ts0 where drawSubTrees [] = [] drawSubTrees [t] = From git at git.haskell.org Mon Apr 17 21:33:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:33:57 +0000 (UTC) Subject: [commit: packages/directory] Mistuke-bump-win32-version-bounds, bgamari-patch-1, cbits, master: Add LTS 2 to AppVeyor to test against GHC 7.8 (595f519) Message-ID: <20170417213357.5CA773A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: Mistuke-bump-win32-version-bounds,bgamari-patch-1,cbits,master Link : http://ghc.haskell.org/trac/ghc/changeset/595f519d6f44191c52d00577568c6910635bb3d6/directory >--------------------------------------------------------------- commit 595f519d6f44191c52d00577568c6910635bb3d6 Author: Phil Ruffwind Date: Sat Apr 30 13:57:41 2016 -0400 Add LTS 2 to AppVeyor to test against GHC 7.8 >--------------------------------------------------------------- 595f519d6f44191c52d00577568c6910635bb3d6 appveyor.yml | 3 ++- tools/testscript | 22 +++++++++++++++++----- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 8db1c30..fc53613 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,11 +5,12 @@ build: false environment: global: # use a short path prefix to avoid running into path-length limitations - STACK: stack --resolver lts-5 --skip-msys STACK_ROOT: C:\sr matrix: - DEPS: + STACK: stack --skip-msys --resolver lts-5 - DEPS: Win32-2.3.0.1 + STACK: stack --skip-msys --resolver lts-2 cache: - "%STACK_ROOT%" install: diff --git a/tools/testscript b/tools/testscript index 1df340d..a09f300 100755 --- a/tools/testscript +++ b/tools/testscript @@ -4,9 +4,18 @@ set -eu ghcflags="-rtsopts -threaded -Werror" testflags="CreateDirectoryIfMissing001.num-repeats=100000 +RTS -N2" -post_configure() { +before_build() { + # workaround for https://github.com/haskell/cabal/issues/2375 + if grep "^resolver: lts-2" stack.yaml >/dev/null 2>&1; then + sed -i.bak 's/WithHooks autoconfUserHooks//' Setup.hs + stack exec sh ./configure + fi +} + +after_cabal_configure() { + # this hook is only executed in the Cabal case if [ "${DISABLE_UTIMENSAT+x}" ]; then - sed -i "s/#define HAVE_UTIMENSAT 1//" HsDirectoryConfig.h + sed -i.bak "s/#define HAVE_UTIMENSAT 1//" HsDirectoryConfig.h fi } @@ -39,9 +48,11 @@ prepare() { tools/retry $stack setup >/dev/null $stack ghc -- --version $stack --version + for dep in ${DEPS-}; do + url=https://hackage.haskell.org/package/${dep}/${dep}.tar.gz + curl --retry 3 -fsLS "$url" | tar xzf - + done $stack init - sed "s/^\(extra-deps:\).*/\1 [${DEPS-}]/" stack.yaml >stack.yaml.tmp - mv stack.yaml.tmp stack.yaml $stack test --install-ghc --only-dependencies $stack list-dependencies @@ -59,6 +70,7 @@ prepare() { } build() { + before_build if [ "${STACK+x}" ]; then stack="$STACK --no-terminal" @@ -103,7 +115,7 @@ build() { testflags=`printf " %s" "$testflags" | sed "s/ / --test-option=/g"` cabal configure -v2 --enable-tests --ghc-options="$ghcflags" - post_configure + after_cabal_configure cabal build cabal check cabal sdist From git at git.haskell.org Mon Apr 17 21:33:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:33:58 +0000 (UTC) Subject: [commit: packages/containers] develop: Merge branch 'jonasc-master' into develop (b44b6a7) Message-ID: <20170417213358.B337E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branch : develop Link : http://git.haskell.org/packages/containers.git/commitdiff/b44b6a727c123c0ec33e8ac0f1299ac73ee1d0ef >--------------------------------------------------------------- commit b44b6a727c123c0ec33e8ac0f1299ac73ee1d0ef Merge: f8629a2 2c85f08 Author: Milan Straka Date: Fri Aug 8 11:07:42 2014 +0200 Merge branch 'jonasc-master' into develop PVP: Major version bump is needed. >--------------------------------------------------------------- b44b6a727c123c0ec33e8ac0f1299ac73ee1d0ef Data/Tree.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) From git at git.haskell.org Mon Apr 17 21:33:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:33:59 +0000 (UTC) Subject: [commit: packages/directory] Mistuke-bump-win32-version-bounds, bgamari-patch-1, cbits, master: Make test script more idempotent (8a550bb) Message-ID: <20170417213359.63A8E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: Mistuke-bump-win32-version-bounds,bgamari-patch-1,cbits,master Link : http://ghc.haskell.org/trac/ghc/changeset/8a550bb4a758bd1846eaca96d2b7139c43f8654c/directory >--------------------------------------------------------------- commit 8a550bb4a758bd1846eaca96d2b7139c43f8654c Author: Phil Ruffwind Date: Sun May 1 02:24:14 2016 -0400 Make test script more idempotent >--------------------------------------------------------------- 8a550bb4a758bd1846eaca96d2b7139c43f8654c tools/testscript | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testscript b/tools/testscript index a09f300..93e30d7 100755 --- a/tools/testscript +++ b/tools/testscript @@ -38,7 +38,7 @@ prepare() { MSYS*) url=https://www.stackage.org/stack/windows-x86_64 curl --retry 3 -fsLSo stack.zip "$url" - 7z x stack.zip stack.exe;; + 7z x -aoa stack.zip stack.exe;; *) printf >&2 "unknown uname: %s\n" "`uname`" return 1;; @@ -52,7 +52,7 @@ prepare() { url=https://hackage.haskell.org/package/${dep}/${dep}.tar.gz curl --retry 3 -fsLS "$url" | tar xzf - done - $stack init + $stack init && : $stack test --install-ghc --only-dependencies $stack list-dependencies From git at git.haskell.org Mon Apr 17 21:34:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:00 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Use defensive `Data.Foldable` import (74f9b89) Message-ID: <20170417213400.BC3553A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/74f9b89a542240e7ab510ee4fb73a4d46035b8ea >--------------------------------------------------------------- commit 74f9b89a542240e7ab510ee4fb73a4d46035b8ea Author: Herbert Valerio Riedel Date: Sat Sep 27 15:12:33 2014 +0200 Use defensive `Data.Foldable` import With this `import`-style containers will compile warning free with existing GHC versions as well as GHC HEAD (in its current form) This change is also needed because `Data.Foldable` is planned to export `null` and `length` which will otherwise clash with `Data.Sequence` >--------------------------------------------------------------- 74f9b89a542240e7ab510ee4fb73a4d46035b8ea Data/Sequence.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 9bfd6f9..6bbebdb 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -149,7 +149,7 @@ import Control.DeepSeq (NFData(rnf)) import Control.Monad (MonadPlus(..), ap) import Data.Monoid (Monoid(..)) import Data.Functor (Functor(..)) -import Data.Foldable +import Data.Foldable (Foldable(foldl, foldl1, foldr, foldr1), foldl', toList) import Data.Traversable import Data.Typeable From git at git.haskell.org Mon Apr 17 21:34:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:01 +0000 (UTC) Subject: [commit: packages/directory] Mistuke-bump-win32-version-bounds, bgamari-patch-1, cbits, master: Update changelog because it's May now (e28fca3) Message-ID: <20170417213401.6A00D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: Mistuke-bump-win32-version-bounds,bgamari-patch-1,cbits,master Link : http://ghc.haskell.org/trac/ghc/changeset/e28fca394cdd433e6918c97ce66abd7d6f46c925/directory >--------------------------------------------------------------- commit e28fca394cdd433e6918c97ce66abd7d6f46c925 Author: Phil Ruffwind Date: Sun May 1 03:52:41 2016 -0400 Update changelog because it's May now >--------------------------------------------------------------- e28fca394cdd433e6918c97ce66abd7d6f46c925 changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 0d36c1a..273413d 100644 --- a/changelog.md +++ b/changelog.md @@ -1,7 +1,7 @@ Changelog for the [`directory`][1] package ========================================== -## 1.2.6.3 (April 2015) +## 1.2.6.3 (May 2015) * Add missing import of `(<*>)` on Windows for `base` earlier than 4.8.0.0 ([#53](https://github.com/haskell/directory/issues/53)) From git at git.haskell.org Mon Apr 17 21:34:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:02 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Merge pull request #54 from hvr/pr-foldable (085e1b8) Message-ID: <20170417213402.C56B03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/085e1b8b2cfbd1159bbc9f8cbf6a4127cc32227b >--------------------------------------------------------------- commit 085e1b8b2cfbd1159bbc9f8cbf6a4127cc32227b Merge: 3b1eee5 74f9b89 Author: Milan Straka Date: Sun Sep 28 12:45:42 2014 +0200 Merge pull request #54 from hvr/pr-foldable Use defensive `Data.Foldable` import >--------------------------------------------------------------- 085e1b8b2cfbd1159bbc9f8cbf6a4127cc32227b Data/Sequence.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) From git at git.haskell.org Mon Apr 17 21:34:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:03 +0000 (UTC) Subject: [commit: packages/directory] Mistuke-bump-win32-version-bounds, bgamari-patch-1, cbits, master: Update AppVeyor badge in README (a7d0008) Message-ID: <20170417213403.701813A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: Mistuke-bump-win32-version-bounds,bgamari-patch-1,cbits,master Link : http://ghc.haskell.org/trac/ghc/changeset/a7d000818e5bd7b18ec446b0c042ac63fcba8857/directory >--------------------------------------------------------------- commit a7d000818e5bd7b18ec446b0c042ac63fcba8857 Author: Phil Ruffwind Date: Tue May 10 01:26:59 2016 -0400 Update AppVeyor badge in README >--------------------------------------------------------------- a7d000818e5bd7b18ec446b0c042ac63fcba8857 README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index febdafd..f12b636 100644 --- a/README.md +++ b/README.md @@ -25,5 +25,5 @@ configure` does that automatically. [bi]: https://travis-ci.org/haskell/directory.svg?branch=master [bl]: https://travis-ci.org/haskell/directory [wi]: https://ci.appveyor.com/api/projects/status/github/haskell/directory?svg=true -[wl]: https://ci.appveyor.com/project/Rufflewind/directory +[wl]: https://ci.appveyor.com/project/hvr/directory [ac]: https://gnu.org/software/autoconf From git at git.haskell.org Mon Apr 17 21:34:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:04 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Move foldlStrict (defined 4 times) to Data.StrictFold. (27a5da9) Message-ID: <20170417213404.D28873A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/27a5da9e0a99b2df2cfb267eed2dae8167c746a2 >--------------------------------------------------------------- commit 27a5da9e0a99b2df2cfb267eed2dae8167c746a2 Author: Milan Straka Date: Sun Oct 12 11:06:53 2014 +0200 Move foldlStrict (defined 4 times) to Data.StrictFold. The foldlStrict is Data.List.foldl' which is always inlined, which allows more optimizations. Also, foldl' is not Haskell 98, although it is Haskell 2010. >--------------------------------------------------------------- 27a5da9e0a99b2df2cfb267eed2dae8167c746a2 Data/IntMap/Base.hs | 9 +-------- Data/IntMap/Strict.hs | 1 + Data/IntSet/Base.hs | 7 +------ Data/Map/Base.hs | 9 +-------- Data/Map/Strict.hs | 2 ++ Data/Set/Base.hs | 7 +------ Data/StrictFold.hs | 16 ++++++++++++++++ containers.cabal | 1 + 8 files changed, 24 insertions(+), 28 deletions(-) diff --git a/Data/IntMap/Base.hs b/Data/IntMap/Base.hs index 75b3ae9..8d04bfa 100644 --- a/Data/IntMap/Base.hs +++ b/Data/IntMap/Base.hs @@ -211,7 +211,6 @@ module Data.IntMap.Base ( , shorter , branchMask , highestBitMask - , foldlStrict ) where import Control.Applicative (Applicative(pure, (<*>)), (<$>)) @@ -229,6 +228,7 @@ import Prelude hiding (lookup, map, filter, foldr, foldl, null) import Data.BitUtil import Data.IntSet.Base (Key) import qualified Data.IntSet.Base as IntSet +import Data.StrictFold import Data.StrictPair #if __GLASGOW_HASKELL__ @@ -2085,13 +2085,6 @@ branchMask p1 p2 Utilities --------------------------------------------------------------------} -foldlStrict :: (a -> b -> a) -> a -> [b] -> a -foldlStrict f = go - where - go z [] = z - go z (x:xs) = let z' = f z x in z' `seq` go z' xs -{-# INLINE foldlStrict #-} - -- | /O(1)/. Decompose a map into pieces based on the structure of the underlying -- tree. This function is useful for consuming a map in parallel. -- diff --git a/Data/IntMap/Strict.hs b/Data/IntMap/Strict.hs index 2ca3707..f19682e 100644 --- a/Data/IntMap/Strict.hs +++ b/Data/IntMap/Strict.hs @@ -258,6 +258,7 @@ import Data.IntMap.Base hiding import Data.BitUtil import qualified Data.IntSet.Base as IntSet +import Data.StrictFold import Data.StrictPair -- $strictness diff --git a/Data/IntSet/Base.hs b/Data/IntSet/Base.hs index 0063c3f..c843d46 100644 --- a/Data/IntSet/Base.hs +++ b/Data/IntSet/Base.hs @@ -192,6 +192,7 @@ import Data.Word (Word) import Prelude hiding (filter, foldr, foldl, null, map) import Data.BitUtil +import Data.StrictFold import Data.StrictPair #if __GLASGOW_HASKELL__ @@ -1491,12 +1492,6 @@ bitcount a0 x0 = go a0 x0 {-------------------------------------------------------------------- Utilities --------------------------------------------------------------------} -foldlStrict :: (a -> b -> a) -> a -> [b] -> a -foldlStrict f = go - where - go z [] = z - go z (x:xs) = let z' = f z x in z' `seq` go z' xs -{-# INLINE foldlStrict #-} -- | /O(1)/. Decompose a set into pieces based on the structure of the underlying -- tree. This function is useful for consuming a set in parallel. diff --git a/Data/Map/Base.hs b/Data/Map/Base.hs index db9549f..650e003 100644 --- a/Data/Map/Base.hs +++ b/Data/Map/Base.hs @@ -262,7 +262,6 @@ module Data.Map.Base ( , glue , trim , trimLookupLo - , foldlStrict , MaybeS(..) , filterGt , filterLt @@ -279,6 +278,7 @@ import Data.Typeable import Prelude hiding (lookup, map, filter, foldr, foldl, null) import qualified Data.Set.Base as Set +import Data.StrictFold #if __GLASGOW_HASKELL__ import GHC.Exts ( build ) @@ -2826,13 +2826,6 @@ validsize t {-------------------------------------------------------------------- Utilities --------------------------------------------------------------------} -foldlStrict :: (a -> b -> a) -> a -> [b] -> a -foldlStrict f = go - where - go z [] = z - go z (x:xs) = let z' = f z x in z' `seq` go z' xs -{-# INLINE foldlStrict #-} - -- | /O(1)/. Decompose a map into pieces based on the structure of the underlying -- tree. This function is useful for consuming a map in parallel. diff --git a/Data/Map/Strict.hs b/Data/Map/Strict.hs index 75a29c8..4e0d820 100644 --- a/Data/Map/Strict.hs +++ b/Data/Map/Strict.hs @@ -269,7 +269,9 @@ import Data.Map.Base hiding , updateMaxWithKey ) import qualified Data.Set.Base as Set +import Data.StrictFold import Data.StrictPair + import Data.Bits (shiftL, shiftR) -- Use macros to define strictness of functions. STRICT_x_OF_y diff --git a/Data/Set/Base.hs b/Data/Set/Base.hs index ffcdfd0..3a2c938 100644 --- a/Data/Set/Base.hs +++ b/Data/Set/Base.hs @@ -194,6 +194,7 @@ import qualified Data.Foldable as Foldable import Data.Typeable import Control.DeepSeq (NFData(rnf)) +import Data.StrictFold import Data.StrictPair #if __GLASGOW_HASKELL__ @@ -1416,12 +1417,6 @@ bin x l r {-------------------------------------------------------------------- Utilities --------------------------------------------------------------------} -foldlStrict :: (a -> b -> a) -> a -> [b] -> a -foldlStrict f = go - where - go z [] = z - go z (x:xs) = let z' = f z x in z' `seq` go z' xs -{-# INLINE foldlStrict #-} -- | /O(1)/. Decompose a set into pieces based on the structure of the underlying -- tree. This function is useful for consuming a set in parallel. diff --git a/Data/StrictFold.hs b/Data/StrictFold.hs new file mode 100644 index 0000000..9c90a66 --- /dev/null +++ b/Data/StrictFold.hs @@ -0,0 +1,16 @@ +{-# LANGUAGE CPP #-} +#if !defined(TESTING) && __GLASGOW_HASKELL__ >= 703 +{-# LANGUAGE Trustworthy #-} +#endif +module Data.StrictFold (foldlStrict) where + +-- | Same as regular 'Data.List.foldl'', but marked INLINE so that it is always +-- inlined. This allows further optimization of the call to f, which can be +-- optimized/specialised/inlined. + +foldlStrict :: (a -> b -> a) -> a -> [b] -> a +foldlStrict f = go + where + go z [] = z + go z (x:xs) = let z' = f z x in z' `seq` go z' xs +{-# INLINE foldlStrict #-} diff --git a/containers.cabal b/containers.cabal index 209589b..a952a77 100644 --- a/containers.cabal +++ b/containers.cabal @@ -57,6 +57,7 @@ Library Data.IntSet.Base Data.Map.Base Data.Set.Base + Data.StrictFold Data.StrictPair include-dirs: include From git at git.haskell.org Mon Apr 17 21:34:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:05 +0000 (UTC) Subject: [commit: packages/directory] cbits: Remove deprecated C bits (3f54c1f) Message-ID: <20170417213405.76FE33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : cbits Link : http://ghc.haskell.org/trac/ghc/changeset/3f54c1f54484c5e5cbc481b3c2e73ae7f47b3d91/directory >--------------------------------------------------------------- commit 3f54c1f54484c5e5cbc481b3c2e73ae7f47b3d91 Author: Phil Ruffwind Date: Wed Apr 27 00:09:45 2016 -0400 Remove deprecated C bits See also: 7d36863a833c6a69f76d727460f9e8695f2b4dd3 Fixes #50. >--------------------------------------------------------------- 3f54c1f54484c5e5cbc481b3c2e73ae7f47b3d91 cbits/directory.c | 9 ------- changelog.md | 6 +++++ directory.cabal | 10 ++------ include/HsDirectory.h | 70 --------------------------------------------------- 4 files changed, 8 insertions(+), 87 deletions(-) diff --git a/cbits/directory.c b/cbits/directory.c deleted file mode 100644 index 7f853f1..0000000 --- a/cbits/directory.c +++ /dev/null @@ -1,9 +0,0 @@ -/* - * (c) The University of Glasgow 2002 - * - */ - -/* [DEPRECATED] This file may be removed in future versions. */ - -#define INLINE -#include "HsDirectory.h" diff --git a/changelog.md b/changelog.md index 273413d..48fd651 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,12 @@ Changelog for the [`directory`][1] package ========================================== +## 1.2.7.0 (May 2015) + + * Remove deprecated C bits. This means `HsDirectory.h` and its functions + are no longer available. + ([#50](https://github.com/haskell/directory/issues/50)) + ## 1.2.6.3 (May 2015) * Add missing import of `(<*>)` on Windows for `base` earlier than 4.8.0.0 diff --git a/directory.cabal b/directory.cabal index 18f0094..f9a79bf 100644 --- a/directory.cabal +++ b/directory.cabal @@ -1,5 +1,5 @@ name: directory -version: 1.2.6.3 +version: 1.2.7.0 -- NOTE: Don't forget to update ./changelog.md license: BSD3 license-file: LICENSE @@ -49,13 +49,7 @@ Library System.Directory.Internal.Posix System.Directory.Internal.Windows - c-sources: - cbits/directory.c - include-dirs: . include - includes: - HsDirectory.h - install-includes: - HsDirectory.h + include-dirs: . build-depends: base >= 4.5 && < 4.10, diff --git a/include/HsDirectory.h b/include/HsDirectory.h deleted file mode 100644 index 46b7c51..0000000 --- a/include/HsDirectory.h +++ /dev/null @@ -1,70 +0,0 @@ -/* ----------------------------------------------------------------------------- - * - * (c) The University of Glasgow 2001-2004 - * - * Definitions for package `directory' which are visible in Haskell land. - * - * ---------------------------------------------------------------------------*/ - -/* [DEPRECATED] Do not include this header nor HsDirectoryConfig.h. They are - for internal use only and may be removed in future versions. */ - -#ifndef __HSDIRECTORY_H__ -#define __HSDIRECTORY_H__ - -// On Solaris we have to make sure _FILE_OFFSET_BITS is defined -// before including below, because that header -// will try and define it if it isn't already. -#include "HsFFI.h" - -#include "HsDirectoryConfig.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_SYS_STAT_H -#include -#endif - -#if HAVE_SYS_TYPES_H -#include -#endif - -#include "HsFFI.h" - -/* ----------------------------------------------------------------------------- - INLINE functions. - - These functions are given as inlines here for when compiling via C, - but we also generate static versions into the cbits library for - when compiling to native code. - -------------------------------------------------------------------------- */ - -#ifndef INLINE -# if defined(_MSC_VER) -# define INLINE extern __inline -# else -# define INLINE static inline -# endif -#endif - -/* Do not use: it may give the wrong value on systems where PATH_MAX is not - defined (e.g. Hurd). Instead, use System.Directory.Internal.c_PATH_MAX. */ -INLINE HsInt __hscore_long_path_size(void) { -#ifdef PATH_MAX - return PATH_MAX; -#else - return 4096; -#endif -} - -INLINE mode_t __hscore_S_IRUSR(void) { return S_IRUSR; } -INLINE mode_t __hscore_S_IWUSR(void) { return S_IWUSR; } -INLINE mode_t __hscore_S_IXUSR(void) { return S_IXUSR; } -INLINE mode_t __hscore_S_IFDIR(void) { return S_IFDIR; } - -#endif /* __HSDIRECTORY_H__ */ From git at git.haskell.org Mon Apr 17 21:34:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:06 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Move utilities (BitUtils, Strict{Fold, Pair}) to Utils directory. (9cfe43a) Message-ID: <20170417213406.E2ED83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/9cfe43a9790f8c8511f93f380e7d7168bb1c1a88 >--------------------------------------------------------------- commit 9cfe43a9790f8c8511f93f380e7d7168bb1c1a88 Author: Milan Straka Date: Sun Oct 12 11:13:13 2014 +0200 Move utilities (BitUtils,Strict{Fold,Pair}) to Utils directory. The Data directory was becoming a little too crowded. >--------------------------------------------------------------- 9cfe43a9790f8c8511f93f380e7d7168bb1c1a88 Data/IntMap/Base.hs | 6 +++--- Data/IntMap/Strict.hs | 6 +++--- Data/IntSet/Base.hs | 6 +++--- Data/Map/Base.hs | 4 ++-- Data/Map/Strict.hs | 4 ++-- Data/Set/Base.hs | 4 ++-- Data/{ => Utils}/BitUtil.hs | 4 ++-- Data/{ => Utils}/StrictFold.hs | 2 +- Data/{ => Utils}/StrictPair.hs | 2 +- containers.cabal | 6 +++--- 10 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Data/IntMap/Base.hs b/Data/IntMap/Base.hs index 8d04bfa..fec5abe 100644 --- a/Data/IntMap/Base.hs +++ b/Data/IntMap/Base.hs @@ -225,11 +225,11 @@ import Data.Typeable import Data.Word (Word) import Prelude hiding (lookup, map, filter, foldr, foldl, null) -import Data.BitUtil import Data.IntSet.Base (Key) import qualified Data.IntSet.Base as IntSet -import Data.StrictFold -import Data.StrictPair +import Data.Utils.BitUtil +import Data.Utils.StrictFold +import Data.Utils.StrictPair #if __GLASGOW_HASKELL__ import Data.Data (Data(..), Constr, mkConstr, constrIndex, Fixity(Prefix), diff --git a/Data/IntMap/Strict.hs b/Data/IntMap/Strict.hs index f19682e..3a7dde8 100644 --- a/Data/IntMap/Strict.hs +++ b/Data/IntMap/Strict.hs @@ -256,10 +256,10 @@ import Data.IntMap.Base hiding , fromDistinctAscList ) -import Data.BitUtil import qualified Data.IntSet.Base as IntSet -import Data.StrictFold -import Data.StrictPair +import Data.Utils.BitUtil +import Data.Utils.StrictFold +import Data.Utils.StrictPair -- $strictness -- diff --git a/Data/IntSet/Base.hs b/Data/IntSet/Base.hs index c843d46..309ab42 100644 --- a/Data/IntSet/Base.hs +++ b/Data/IntSet/Base.hs @@ -191,9 +191,9 @@ import Data.Typeable import Data.Word (Word) import Prelude hiding (filter, foldr, foldl, null, map) -import Data.BitUtil -import Data.StrictFold -import Data.StrictPair +import Data.Utils.BitUtil +import Data.Utils.StrictFold +import Data.Utils.StrictPair #if __GLASGOW_HASKELL__ import Data.Data (Data(..), Constr, mkConstr, constrIndex, Fixity(Prefix), DataType, mkDataType) diff --git a/Data/Map/Base.hs b/Data/Map/Base.hs index 650e003..d1d8ffe 100644 --- a/Data/Map/Base.hs +++ b/Data/Map/Base.hs @@ -272,13 +272,13 @@ import Control.DeepSeq (NFData(rnf)) import Data.Bits (shiftL, shiftR) import qualified Data.Foldable as Foldable import Data.Monoid (Monoid(..)) -import Data.StrictPair import Data.Traversable (Traversable(traverse)) import Data.Typeable import Prelude hiding (lookup, map, filter, foldr, foldl, null) import qualified Data.Set.Base as Set -import Data.StrictFold +import Data.Utils.StrictFold +import Data.Utils.StrictPair #if __GLASGOW_HASKELL__ import GHC.Exts ( build ) diff --git a/Data/Map/Strict.hs b/Data/Map/Strict.hs index 4e0d820..5f286b9 100644 --- a/Data/Map/Strict.hs +++ b/Data/Map/Strict.hs @@ -269,8 +269,8 @@ import Data.Map.Base hiding , updateMaxWithKey ) import qualified Data.Set.Base as Set -import Data.StrictFold -import Data.StrictPair +import Data.Utils.StrictFold +import Data.Utils.StrictPair import Data.Bits (shiftL, shiftR) diff --git a/Data/Set/Base.hs b/Data/Set/Base.hs index 3a2c938..6c39a8e 100644 --- a/Data/Set/Base.hs +++ b/Data/Set/Base.hs @@ -194,8 +194,8 @@ import qualified Data.Foldable as Foldable import Data.Typeable import Control.DeepSeq (NFData(rnf)) -import Data.StrictFold -import Data.StrictPair +import Data.Utils.StrictFold +import Data.Utils.StrictPair #if __GLASGOW_HASKELL__ import GHC.Exts ( build ) diff --git a/Data/BitUtil.hs b/Data/Utils/BitUtil.hs similarity index 97% rename from Data/BitUtil.hs rename to Data/Utils/BitUtil.hs index 848bac1..bea078e 100644 --- a/Data/BitUtil.hs +++ b/Data/Utils/BitUtil.hs @@ -7,7 +7,7 @@ #endif ----------------------------------------------------------------------------- -- | --- Module : Data.BitUtil +-- Module : Data.Utils.BitUtil -- Copyright : (c) Clark Gaebel 2012 -- (c) Johan Tibel 2012 -- License : BSD-style @@ -16,7 +16,7 @@ -- Portability : portable ----------------------------------------------------------------------------- -module Data.BitUtil +module Data.Utils.BitUtil ( highestBitMask , shiftLL , shiftRL diff --git a/Data/StrictFold.hs b/Data/Utils/StrictFold.hs similarity index 90% rename from Data/StrictFold.hs rename to Data/Utils/StrictFold.hs index 9c90a66..953c9f1 100644 --- a/Data/StrictFold.hs +++ b/Data/Utils/StrictFold.hs @@ -2,7 +2,7 @@ #if !defined(TESTING) && __GLASGOW_HASKELL__ >= 703 {-# LANGUAGE Trustworthy #-} #endif -module Data.StrictFold (foldlStrict) where +module Data.Utils.StrictFold (foldlStrict) where -- | Same as regular 'Data.List.foldl'', but marked INLINE so that it is always -- inlined. This allows further optimization of the call to f, which can be diff --git a/Data/StrictPair.hs b/Data/Utils/StrictPair.hs similarity index 77% rename from Data/StrictPair.hs rename to Data/Utils/StrictPair.hs index 48609b3..6ae7ded 100644 --- a/Data/StrictPair.hs +++ b/Data/Utils/StrictPair.hs @@ -2,7 +2,7 @@ #if !defined(TESTING) && __GLASGOW_HASKELL__ >= 703 {-# LANGUAGE Trustworthy #-} #endif -module Data.StrictPair (StrictPair(..), toPair) where +module Data.Utils.StrictPair (StrictPair(..), toPair) where -- | Same as regular Haskell pairs, but (x :*: _|_) = (_|_ :*: y) = -- _|_ diff --git a/containers.cabal b/containers.cabal index a952a77..dcf36fd 100644 --- a/containers.cabal +++ b/containers.cabal @@ -52,13 +52,13 @@ Library Data.Sequence Data.Tree other-modules: - Data.BitUtil Data.IntMap.Base Data.IntSet.Base Data.Map.Base Data.Set.Base - Data.StrictFold - Data.StrictPair + Data.Utils.BitUtil + Data.Utils.StrictFold + Data.Utils.StrictPair include-dirs: include From git at git.haskell.org Mon Apr 17 21:34:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:07 +0000 (UTC) Subject: [commit: packages/directory] Mistuke-bump-win32-version-bounds, bgamari-patch-1, master: Fix dates in changelog (6d2e72d) Message-ID: <20170417213407.7DFF13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: Mistuke-bump-win32-version-bounds,bgamari-patch-1,master Link : http://ghc.haskell.org/trac/ghc/changeset/6d2e72dba88cb5aef7490e5a1a5acb040f10730e/directory >--------------------------------------------------------------- commit 6d2e72dba88cb5aef7490e5a1a5acb040f10730e Author: Simon Jakobi Date: Sun May 22 15:22:18 2016 +0200 Fix dates in changelog >--------------------------------------------------------------- 6d2e72dba88cb5aef7490e5a1a5acb040f10730e changelog.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/changelog.md b/changelog.md index 273413d..c91eb20 100644 --- a/changelog.md +++ b/changelog.md @@ -1,24 +1,24 @@ Changelog for the [`directory`][1] package ========================================== -## 1.2.6.3 (May 2015) +## 1.2.6.3 (May 2016) * Add missing import of `(<*>)` on Windows for `base` earlier than 4.8.0.0 ([#53](https://github.com/haskell/directory/issues/53)) -## 1.2.6.2 (April 2015) +## 1.2.6.2 (April 2016) * Fix typo in file time functions when `utimensat` is not available and version of `unix` package is lower than 2.7.0.0 -## 1.2.6.1 (April 2015) +## 1.2.6.1 (April 2016) * Bundled with GHC 8.0.1 * Fix mistake in file time functions when `utimensat` is not available ([#47](https://github.com/haskell/directory/pull/47)) -## 1.2.6.0 (April 2015) +## 1.2.6.0 (April 2016) * Make `findExecutable`, `findExecutables`, `findExecutablesInDirectories`, `findFile`, and `findFilesWith` lazier @@ -36,7 +36,7 @@ Changelog for the [`directory`][1] package * Drop support for Hugs. -## 1.2.5.1 (February 2015) +## 1.2.5.1 (February 2016) * Improve error message of `getCurrentDirectory` when the current working directory no longer exists From git at git.haskell.org Mon Apr 17 21:34:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:08 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Fix subtle bug in binary search (46b3b9d) Message-ID: <20170417213408.EAED63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/46b3b9d4b34e761aa6f75335c717742bc89d922d >--------------------------------------------------------------- commit 46b3b9d4b34e761aa6f75335c717742bc89d922d Author: Josh Acay Date: Tue Oct 14 14:42:17 2014 -0400 Fix subtle bug in binary search >--------------------------------------------------------------- 46b3b9d4b34e761aa6f75335c717742bc89d922d Data/Graph.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Data/Graph.hs b/Data/Graph.hs index c5cdf4b..65f3fb1 100644 --- a/Data/Graph.hs +++ b/Data/Graph.hs @@ -244,7 +244,7 @@ graphFromEdges edges0 EQ -> Just mid GT -> findVertex (mid+1) b where - mid = (a + b) `div` 2 + mid = a + (b - a) `div` 2 ------------------------------------------------------------------------- -- - From git at git.haskell.org Mon Apr 17 21:34:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:09 +0000 (UTC) Subject: [commit: packages/directory] Mistuke-bump-win32-version-bounds, bgamari-patch-1, master: Remove deprecated C bits (c87be99) Message-ID: <20170417213409.84BEF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: Mistuke-bump-win32-version-bounds,bgamari-patch-1,master Link : http://ghc.haskell.org/trac/ghc/changeset/c87be9908023896a7f270bb076731ffba6c151b5/directory >--------------------------------------------------------------- commit c87be9908023896a7f270bb076731ffba6c151b5 Author: Phil Ruffwind Date: Wed Apr 27 00:09:45 2016 -0400 Remove deprecated C bits See also: 7d36863a833c6a69f76d727460f9e8695f2b4dd3 Fixes #50. >--------------------------------------------------------------- c87be9908023896a7f270bb076731ffba6c151b5 cbits/directory.c | 9 ------- changelog.md | 6 +++++ directory.cabal | 10 ++------ include/HsDirectory.h | 70 --------------------------------------------------- 4 files changed, 8 insertions(+), 87 deletions(-) diff --git a/cbits/directory.c b/cbits/directory.c deleted file mode 100644 index 7f853f1..0000000 --- a/cbits/directory.c +++ /dev/null @@ -1,9 +0,0 @@ -/* - * (c) The University of Glasgow 2002 - * - */ - -/* [DEPRECATED] This file may be removed in future versions. */ - -#define INLINE -#include "HsDirectory.h" diff --git a/changelog.md b/changelog.md index c91eb20..081f125 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,12 @@ Changelog for the [`directory`][1] package ========================================== +## 1.2.7.0 (June 2016) + + * Remove deprecated C bits. This means `HsDirectory.h` and its functions + are no longer available. + ([#50](https://github.com/haskell/directory/issues/50)) + ## 1.2.6.3 (May 2016) * Add missing import of `(<*>)` on Windows for `base` earlier than 4.8.0.0 diff --git a/directory.cabal b/directory.cabal index 18f0094..f9a79bf 100644 --- a/directory.cabal +++ b/directory.cabal @@ -1,5 +1,5 @@ name: directory -version: 1.2.6.3 +version: 1.2.7.0 -- NOTE: Don't forget to update ./changelog.md license: BSD3 license-file: LICENSE @@ -49,13 +49,7 @@ Library System.Directory.Internal.Posix System.Directory.Internal.Windows - c-sources: - cbits/directory.c - include-dirs: . include - includes: - HsDirectory.h - install-includes: - HsDirectory.h + include-dirs: . build-depends: base >= 4.5 && < 4.10, diff --git a/include/HsDirectory.h b/include/HsDirectory.h deleted file mode 100644 index 46b7c51..0000000 --- a/include/HsDirectory.h +++ /dev/null @@ -1,70 +0,0 @@ -/* ----------------------------------------------------------------------------- - * - * (c) The University of Glasgow 2001-2004 - * - * Definitions for package `directory' which are visible in Haskell land. - * - * ---------------------------------------------------------------------------*/ - -/* [DEPRECATED] Do not include this header nor HsDirectoryConfig.h. They are - for internal use only and may be removed in future versions. */ - -#ifndef __HSDIRECTORY_H__ -#define __HSDIRECTORY_H__ - -// On Solaris we have to make sure _FILE_OFFSET_BITS is defined -// before including below, because that header -// will try and define it if it isn't already. -#include "HsFFI.h" - -#include "HsDirectoryConfig.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_SYS_STAT_H -#include -#endif - -#if HAVE_SYS_TYPES_H -#include -#endif - -#include "HsFFI.h" - -/* ----------------------------------------------------------------------------- - INLINE functions. - - These functions are given as inlines here for when compiling via C, - but we also generate static versions into the cbits library for - when compiling to native code. - -------------------------------------------------------------------------- */ - -#ifndef INLINE -# if defined(_MSC_VER) -# define INLINE extern __inline -# else -# define INLINE static inline -# endif -#endif - -/* Do not use: it may give the wrong value on systems where PATH_MAX is not - defined (e.g. Hurd). Instead, use System.Directory.Internal.c_PATH_MAX. */ -INLINE HsInt __hscore_long_path_size(void) { -#ifdef PATH_MAX - return PATH_MAX; -#else - return 4096; -#endif -} - -INLINE mode_t __hscore_S_IRUSR(void) { return S_IRUSR; } -INLINE mode_t __hscore_S_IWUSR(void) { return S_IWUSR; } -INLINE mode_t __hscore_S_IXUSR(void) { return S_IXUSR; } -INLINE mode_t __hscore_S_IFDIR(void) { return S_IFDIR; } - -#endif /* __HSDIRECTORY_H__ */ From git at git.haskell.org Mon Apr 17 21:34:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:10 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Merge pull request #58 from cacay/master (828b60d) Message-ID: <20170417213410.F36B73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/828b60d394418132eb86993bbde29538b066aed8 >--------------------------------------------------------------- commit 828b60d394418132eb86993bbde29538b066aed8 Merge: 9cfe43a 46b3b9d Author: Milan Straka Date: Tue Oct 14 21:52:28 2014 +0200 Merge pull request #58 from cacay/master Fix bug in binary search >--------------------------------------------------------------- 828b60d394418132eb86993bbde29538b066aed8 Data/Graph.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) From git at git.haskell.org Mon Apr 17 21:34:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:11 +0000 (UTC) Subject: [commit: packages/directory] Mistuke-bump-win32-version-bounds, bgamari-patch-1, master: Change AppVeyor badge to show only master branch (0fd3fbb) Message-ID: <20170417213411.8A9EE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: Mistuke-bump-win32-version-bounds,bgamari-patch-1,master Link : http://ghc.haskell.org/trac/ghc/changeset/0fd3fbb32078e3b4a631b25b8b027a0537a800ed/directory >--------------------------------------------------------------- commit 0fd3fbb32078e3b4a631b25b8b027a0537a800ed Author: Phil Ruffwind Date: Sun Jun 12 00:41:23 2016 -0400 Change AppVeyor badge to show only master branch >--------------------------------------------------------------- 0fd3fbb32078e3b4a631b25b8b027a0537a800ed README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f12b636..d56fb37 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,6 @@ configure` does that automatically. [hl]: https://hackage.haskell.org/package/directory [bi]: https://travis-ci.org/haskell/directory.svg?branch=master [bl]: https://travis-ci.org/haskell/directory -[wi]: https://ci.appveyor.com/api/projects/status/github/haskell/directory?svg=true +[wi]: https://ci.appveyor.com/api/projects/status/github/haskell/directory?branch=master&svg=true [wl]: https://ci.appveyor.com/project/hvr/directory [ac]: https://gnu.org/software/autoconf From git at git.haskell.org Mon Apr 17 21:34:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:13 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Minor documentation fix. (864ebff) Message-ID: <20170417213413.0824F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/864ebff7995e7d4358475f8808f10329a832b78b >--------------------------------------------------------------- commit 864ebff7995e7d4358475f8808f10329a832b78b Author: strout Date: Tue Oct 14 22:53:42 2014 -0500 Minor documentation fix. Completed a sentence in maxView documentation. >--------------------------------------------------------------- 864ebff7995e7d4358475f8808f10329a832b78b Data/Map/Base.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/Data/Map/Base.hs b/Data/Map/Base.hs index d1d8ffe..eafab03 100644 --- a/Data/Map/Base.hs +++ b/Data/Map/Base.hs @@ -1171,6 +1171,7 @@ minView x = Just (first snd $ deleteFindMin x) -- | /O(log n)/. Retrieves the value associated with maximal key of the -- map, and the map stripped of that element, or 'Nothing' if passed an +-- empty map. -- -- > maxView (fromList [(5,"a"), (3,"b")]) == Just ("a", singleton 3 "b") -- > maxView empty == Nothing From git at git.haskell.org Mon Apr 17 21:34:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:13 +0000 (UTC) Subject: [commit: packages/directory] Mistuke-bump-win32-version-bounds, bgamari-patch-1, master: Add doesPathExist (435e635) Message-ID: <20170417213413.937633A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: Mistuke-bump-win32-version-bounds,bgamari-patch-1,master Link : http://ghc.haskell.org/trac/ghc/changeset/435e6353582aa5a93c7448292731785e73aa5251/directory >--------------------------------------------------------------- commit 435e6353582aa5a93c7448292731785e73aa5251 Author: Phil Ruffwind Date: Sun Jun 12 00:04:21 2016 -0400 Add doesPathExist See #57. >--------------------------------------------------------------- 435e6353582aa5a93c7448292731785e73aa5251 System/Directory.hs | 16 +++++++++++++--- changelog.md | 3 +++ directory.cabal | 1 + tests/DoesDirectoryExist001.hs | 8 ++++++++ tests/DoesPathExist.hs | 30 ++++++++++++++++++++++++++++++ tests/Main.hs | 2 ++ 6 files changed, 57 insertions(+), 3 deletions(-) diff --git a/System/Directory.hs b/System/Directory.hs index 19a322a..4ce0a86 100644 --- a/System/Directory.hs +++ b/System/Directory.hs @@ -64,6 +64,7 @@ module System.Directory , exeExtension -- * Existence tests + , doesPathExist , doesFileExist , doesDirectoryExist @@ -965,9 +966,6 @@ canonicalizePath = \ path -> realpath encoding path = GHC.withCString encoding path (`withRealpath` GHC.peekCString encoding) - - doesPathExist path = (Posix.getFileStatus path >> return True) - `catchIOError` \ _ -> return False #endif -- | Convert a path into an absolute path. If the given path is relative, the @@ -1322,6 +1320,18 @@ withCurrentDirectory dir action = setCurrentDirectory dir action +-- | Test whether the given path points to an existing filesystem object. If +-- the user lacks necessary permissions to search the parent directories, this +-- function may return false even if the file does actually exist. +doesPathExist :: FilePath -> IO Bool +doesPathExist path = +#ifdef mingw32_HOST_OS + (withFileStatus "" path $ \ _ -> return True) +#else + (Posix.getFileStatus path >> return True) +#endif + `catchIOError` \ _ -> return False + {- |The operation 'doesDirectoryExist' returns 'True' if the argument file exists and is either a directory or a symbolic link to a directory, and 'False' otherwise. diff --git a/changelog.md b/changelog.md index 081f125..f6bf91c 100644 --- a/changelog.md +++ b/changelog.md @@ -7,6 +7,9 @@ Changelog for the [`directory`][1] package are no longer available. ([#50](https://github.com/haskell/directory/issues/50)) + * Add `doesPathExist` + ([#57](https://github.com/haskell/directory/issues/57)) + ## 1.2.6.3 (May 2016) * Add missing import of `(<*>)` on Windows for `base` earlier than 4.8.0.0 diff --git a/directory.cabal b/directory.cabal index f9a79bf..628ec06 100644 --- a/directory.cabal +++ b/directory.cabal @@ -87,6 +87,7 @@ test-suite test CurrentDirectory001 Directory001 DoesDirectoryExist001 + DoesPathExist FileTime FindFile001 GetDirContents001 diff --git a/tests/DoesDirectoryExist001.hs b/tests/DoesDirectoryExist001.hs index b5a1aa9..38522d6 100644 --- a/tests/DoesDirectoryExist001.hs +++ b/tests/DoesDirectoryExist001.hs @@ -9,6 +9,14 @@ main _t = do -- [regression test] "/" was not recognised as a directory prior to GHC 6.1 T(expect) () =<< doesDirectoryExist rootDir + createDirectory "somedir" + + T(expect) () . not =<< doesDirectoryExist "nonexistent" + T(expect) () =<< doesDirectoryExist "somedir" +#ifdef mingw32_HOST_OS + T(expect) () =<< doesDirectoryExist "SoMeDiR" +#endif + where #ifdef mingw32_HOST_OS rootDir = "C:\\" diff --git a/tests/DoesPathExist.hs b/tests/DoesPathExist.hs new file mode 100644 index 0000000..b7b8bc9 --- /dev/null +++ b/tests/DoesPathExist.hs @@ -0,0 +1,30 @@ +{-# LANGUAGE CPP #-} +module DoesPathExist where +#include "util.inl" +import System.Directory + +main :: TestEnv -> IO () +main _t = do + + T(expect) () =<< doesPathExist rootDir + + createDirectory "somedir" + writeFile "somefile" "somedata" + writeFile "\x3c0\x42f\x97f3\xe6\x221e" "somedata" + + T(expect) () . not =<< doesPathExist "nonexistent" + T(expect) () =<< doesPathExist "somedir" + T(expect) () =<< doesPathExist "somefile" + T(expect) () =<< doesPathExist "./somefile" +#ifdef mingw32_HOST_OS + T(expect) () =<< doesPathExist "SoMeDiR" + T(expect) () =<< doesPathExist "sOmEfIlE" +#endif + T(expect) () =<< doesPathExist "\x3c0\x42f\x97f3\xe6\x221e" + + where +#ifdef mingw32_HOST_OS + rootDir = "C:\\" +#else + rootDir = "/" +#endif diff --git a/tests/Main.hs b/tests/Main.hs index 3a5a02d..da8b50b 100644 --- a/tests/Main.hs +++ b/tests/Main.hs @@ -9,6 +9,7 @@ import qualified CreateDirectoryIfMissing001 import qualified CurrentDirectory001 import qualified Directory001 import qualified DoesDirectoryExist001 +import qualified DoesPathExist import qualified FileTime import qualified FindFile001 import qualified GetDirContents001 @@ -34,6 +35,7 @@ main = T.testMain $ \ _t -> do T.isolatedRun _t "CurrentDirectory001" CurrentDirectory001.main T.isolatedRun _t "Directory001" Directory001.main T.isolatedRun _t "DoesDirectoryExist001" DoesDirectoryExist001.main + T.isolatedRun _t "DoesPathExist" DoesPathExist.main T.isolatedRun _t "FileTime" FileTime.main T.isolatedRun _t "FindFile001" FindFile001.main T.isolatedRun _t "GetDirContents001" GetDirContents001.main From git at git.haskell.org Mon Apr 17 21:34:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:15 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Merge pull request #59 from strout/patch-1 (b9bd228) Message-ID: <20170417213415.1105A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/b9bd228149bfb61fe9f87a6ca9858ce1df1aee9e >--------------------------------------------------------------- commit b9bd228149bfb61fe9f87a6ca9858ce1df1aee9e Merge: 828b60d 864ebff Author: Milan Straka Date: Wed Oct 15 08:48:37 2014 +0200 Merge pull request #59 from strout/patch-1 Minor documentation fix. >--------------------------------------------------------------- b9bd228149bfb61fe9f87a6ca9858ce1df1aee9e Data/Map/Base.hs | 1 + 1 file changed, 1 insertion(+) From git at git.haskell.org Mon Apr 17 21:34:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:15 +0000 (UTC) Subject: [commit: packages/directory] Mistuke-bump-win32-version-bounds, bgamari-patch-1, master: Add getFileSize (1ec1ea8) Message-ID: <20170417213415.9D1833A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: Mistuke-bump-win32-version-bounds,bgamari-patch-1,master Link : http://ghc.haskell.org/trac/ghc/changeset/1ec1ea8e4210d55d8d6e0e5fc8dd543340004b92/directory >--------------------------------------------------------------- commit 1ec1ea8e4210d55d8d6e0e5fc8dd543340004b92 Author: Phil Ruffwind Date: Mon Jun 13 06:56:32 2016 -0400 Add getFileSize Fixes #57. >--------------------------------------------------------------- 1ec1ea8e4210d55d8d6e0e5fc8dd543340004b92 System/Directory.hs | 12 ++++++++++++ changelog.md | 2 +- directory.cabal | 1 + tests/GetFileSize.hs | 19 +++++++++++++++++++ tests/Main.hs | 2 ++ 5 files changed, 35 insertions(+), 1 deletion(-) diff --git a/System/Directory.hs b/System/Directory.hs index 4ce0a86..f33ba7c 100644 --- a/System/Directory.hs +++ b/System/Directory.hs @@ -63,6 +63,8 @@ module System.Directory , findFilesWith , exeExtension + , getFileSize + -- * Existence tests , doesPathExist , doesFileExist @@ -1320,6 +1322,16 @@ withCurrentDirectory dir action = setCurrentDirectory dir action +-- | Obtain the size of a file in bytes. +getFileSize :: FilePath -> IO Integer +getFileSize path = + (`ioeSetLocation` "getFileSize") `modifyIOError` do +#ifdef mingw32_HOST_OS + fromIntegral <$> withFileStatus "" path st_size +#else + fromIntegral . Posix.fileSize <$> Posix.getFileStatus path +#endif + -- | Test whether the given path points to an existing filesystem object. If -- the user lacks necessary permissions to search the parent directories, this -- function may return false even if the file does actually exist. diff --git a/changelog.md b/changelog.md index f6bf91c..cfd6fc4 100644 --- a/changelog.md +++ b/changelog.md @@ -7,7 +7,7 @@ Changelog for the [`directory`][1] package are no longer available. ([#50](https://github.com/haskell/directory/issues/50)) - * Add `doesPathExist` + * Add `doesPathExist` and `getFileSize` ([#57](https://github.com/haskell/directory/issues/57)) ## 1.2.6.3 (May 2016) diff --git a/directory.cabal b/directory.cabal index 628ec06..b7bdf17 100644 --- a/directory.cabal +++ b/directory.cabal @@ -92,6 +92,7 @@ test-suite test FindFile001 GetDirContents001 GetDirContents002 + GetFileSize GetHomeDirectory001 GetPermissions001 IsSymbolicLink diff --git a/tests/GetFileSize.hs b/tests/GetFileSize.hs new file mode 100644 index 0000000..413fd16 --- /dev/null +++ b/tests/GetFileSize.hs @@ -0,0 +1,19 @@ +{-# LANGUAGE CPP #-} +module GetFileSize where +#include "util.inl" +import System.Directory +import qualified System.IO as IO + +main :: TestEnv -> IO () +main _t = do + + IO.withBinaryFile "emptyfile" IO.WriteMode $ \ _ -> do + return () + IO.withBinaryFile "testfile" IO.WriteMode $ \ h -> do + IO.hPutStr h string + + T(expectEq) () 0 =<< getFileSize "emptyfile" + T(expectEq) () (fromIntegral (length string)) =<< getFileSize "testfile" + + where + string = "The quick brown fox jumps over the lazy dog." diff --git a/tests/Main.hs b/tests/Main.hs index da8b50b..2b9227f 100644 --- a/tests/Main.hs +++ b/tests/Main.hs @@ -14,6 +14,7 @@ import qualified FileTime import qualified FindFile001 import qualified GetDirContents001 import qualified GetDirContents002 +import qualified GetFileSize import qualified GetHomeDirectory001 import qualified GetPermissions001 import qualified IsSymbolicLink @@ -40,6 +41,7 @@ main = T.testMain $ \ _t -> do T.isolatedRun _t "FindFile001" FindFile001.main T.isolatedRun _t "GetDirContents001" GetDirContents001.main T.isolatedRun _t "GetDirContents002" GetDirContents002.main + T.isolatedRun _t "GetFileSize" GetFileSize.main T.isolatedRun _t "GetHomeDirectory001" GetHomeDirectory001.main T.isolatedRun _t "GetPermissions001" GetPermissions001.main T.isolatedRun _t "IsSymbolicLink" IsSymbolicLink.main From git at git.haskell.org Mon Apr 17 21:34:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:17 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Define some new Foldable methods for containers (61b9066) Message-ID: <20170417213417.1D8AF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/61b9066d79ac346743dfe56425307e27e2e5d060 >--------------------------------------------------------------- commit 61b9066d79ac346743dfe56425307e27e2e5d060 Author: Herbert Valerio Riedel Date: Tue Oct 14 20:25:29 2014 +0200 Define some new Foldable methods for containers This is a first attempt at addressing #56 >--------------------------------------------------------------- 61b9066d79ac346743dfe56425307e27e2e5d060 Data/IntMap/Base.hs | 15 +++++++++++++++ Data/Map/Base.hs | 15 +++++++++++++++ Data/Sequence.hs | 7 +++++++ Data/Set/Base.hs | 20 ++++++++++++++++++++ Data/Tree.hs | 7 +++++++ 5 files changed, 64 insertions(+) diff --git a/Data/IntMap/Base.hs b/Data/IntMap/Base.hs index fec5abe..0de3e5b 100644 --- a/Data/IntMap/Base.hs +++ b/Data/IntMap/Base.hs @@ -320,6 +320,21 @@ instance Foldable.Foldable IntMap where go (Bin _ _ l r) = go l `mappend` go r {-# INLINE foldMap #-} +#if MIN_VERSION_base(4,6,0) + foldl' = foldl' + {-# INLINE foldl' #-} + foldr' = foldr' + {-# INLINE foldr' #-} +#endif +#if MIN_VERSION_base(4,8,0) + length = size + {-# INLINE length #-} + null = null + {-# INLINE null #-} + toList = elems -- NB: Foldable.toList /= IntMap.toList + {-# INLINE toList #-} +#endif + instance Traversable IntMap where traverse f = traverseWithKey (\_ -> f) {-# INLINE traverse #-} diff --git a/Data/Map/Base.hs b/Data/Map/Base.hs index d1d8ffe..d01367b 100644 --- a/Data/Map/Base.hs +++ b/Data/Map/Base.hs @@ -2653,6 +2653,21 @@ instance Foldable.Foldable (Map k) where go (Bin _ _ v l r) = go l `mappend` (f v `mappend` go r) {-# INLINE foldMap #-} +#if MIN_VERSION_base(4,6,0) + foldl' = foldl' + {-# INLINE foldl' #-} + foldr' = foldr' + {-# INLINE foldr' #-} +#endif +#if MIN_VERSION_base(4,8,0) + length = size + {-# INLINE length #-} + null = null + {-# INLINE null #-} + toList = elems -- NB: Foldable.toList /= Map.toList + {-# INLINE toList #-} +#endif + instance (NFData k, NFData a) => NFData (Map k a) where rnf Tip = () rnf (Bin _ kx x l r) = rnf kx `seq` rnf x `seq` rnf l `seq` rnf r diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 6bbebdb..f1385f5 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -189,6 +189,13 @@ instance Foldable Seq where foldl1 f (Seq xs) = getElem (foldl1 f' xs) where f' (Elem x) (Elem y) = Elem (f x y) +#if MIN_VERSION_base(4,8,0) + length = length + {-# INLINE length #-} + null = null + {-# INLINE null #-} +#endif + instance Traversable Seq where traverse f (Seq xs) = Seq <$> traverse (traverse f) xs diff --git a/Data/Set/Base.hs b/Data/Set/Base.hs index 6c39a8e..9260aeb 100644 --- a/Data/Set/Base.hs +++ b/Data/Set/Base.hs @@ -262,6 +262,26 @@ instance Foldable.Foldable Set where go (Bin _ k l r) = go l `mappend` (f k `mappend` go r) {-# INLINE foldMap #-} +#if MIN_VERSION_base(4,6,0) + foldl' = foldl' + {-# INLINE foldl' #-} + foldr' = foldr' + {-# INLINE foldr' #-} +#endif +#if MIN_VERSION_base(4,8,0) + length = size + {-# INLINE length #-} + null = null + {-# INLINE null #-} + toList = toList + {-# INLINE toList #-} + minimum = findMin + {-# INLINE minimum #-} + maximum = findMax + {-# INLINE maximum #-} +#endif + + #if __GLASGOW_HASKELL__ {-------------------------------------------------------------------- diff --git a/Data/Tree.hs b/Data/Tree.hs index dab25c2..2f18c68 100644 --- a/Data/Tree.hs +++ b/Data/Tree.hs @@ -79,6 +79,13 @@ instance Traversable Tree where instance Foldable Tree where foldMap f (Node x ts) = f x `mappend` foldMap (foldMap f) ts +#if MIN_VERSION_base(4,8,0) + null _ = False + {-# INLINE null #-} + toList = flatten + {-# INLINE toList #-} +#endif + instance NFData a => NFData (Tree a) where rnf (Node x ts) = rnf x `seq` rnf ts From git at git.haskell.org Mon Apr 17 21:34:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:17 +0000 (UTC) Subject: [commit: packages/directory] Mistuke-bump-win32-version-bounds, bgamari-patch-1, master: Add renamePath (de6a440) Message-ID: <20170417213417.A65193A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: Mistuke-bump-win32-version-bounds,bgamari-patch-1,master Link : http://ghc.haskell.org/trac/ghc/changeset/de6a440288d85d4804aceecf8b73344d9a59555d/directory >--------------------------------------------------------------- commit de6a440288d85d4804aceecf8b73344d9a59555d Author: Phil Ruffwind Date: Thu Jul 14 00:31:01 2016 -0400 Add renamePath Fixes #58. >--------------------------------------------------------------- de6a440288d85d4804aceecf8b73344d9a59555d System/Directory.hs | 64 ++++++++++++++++++++++++++----- changelog.md | 3 ++ directory.cabal | 1 + tests/Main.hs | 2 + tests/{RenameFile001.hs => RenamePath.hs} | 13 +++++-- 5 files changed, 70 insertions(+), 13 deletions(-) diff --git a/System/Directory.hs b/System/Directory.hs index f33ba7c..f20cc74 100644 --- a/System/Directory.hs +++ b/System/Directory.hs @@ -48,6 +48,7 @@ module System.Directory -- * Actions on files , removeFile , renameFile + , renamePath , copyFile , copyFileWithMetadata @@ -674,11 +675,7 @@ renameDirectory opath npath = when (not is_dir) $ do ioError . (`ioeSetErrorString` "not a directory") $ (mkIOError InappropriateType "renameDirectory" Nothing (Just opath)) -#ifdef mingw32_HOST_OS - Win32.moveFileEx opath npath Win32.mOVEFILE_REPLACE_EXISTING -#else - Posix.rename opath npath -#endif + renamePath opath npath {- |@'renameFile' old new@ changes the name of an existing file system object from /old/ to /new/. If the /new/ object already @@ -728,11 +725,7 @@ renameFile :: FilePath -> FilePath -> IO () renameFile opath npath = (`ioeSetLocation` "renameFile") `modifyIOError` do -- XXX the tests are not performed atomically with the rename checkNotDir opath -#ifdef mingw32_HOST_OS - Win32.moveFileEx opath npath Win32.mOVEFILE_REPLACE_EXISTING -#else - Posix.rename opath npath -#endif + renamePath opath npath -- The underlying rename implementation can throw odd exceptions when the -- destination is a directory. For example, Windows typically throws a -- permission error, while POSIX systems may throw a resource busy error @@ -752,6 +745,57 @@ renameFile opath npath = (`ioeSetLocation` "renameFile") `modifyIOError` do errIsDir path = ioError . (`ioeSetErrorString` "is a directory") $ mkIOError InappropriateType "" Nothing (Just path) +-- | Rename a file or directory. If the destination path already exists, it +-- is replaced atomically. The destination path must not point to an existing +-- directory. A conformant implementation need not support renaming files in +-- all situations (e.g. renaming across different physical devices), but the +-- constraints must be documented. +-- +-- The operation may fail with: +-- +-- * 'HardwareFault' +-- A physical I\/O error has occurred. +-- @[EIO]@ +-- +-- * 'InvalidArgument' +-- Either operand is not a valid file name. +-- @[ENAMETOOLONG, ELOOP]@ +-- +-- * 'isDoesNotExistError' \/ 'NoSuchThing' +-- The original file does not exist, or there is no path to the target. +-- @[ENOENT, ENOTDIR]@ +-- +-- * 'isPermissionError' \/ 'PermissionDenied' +-- The process has insufficient privileges to perform the operation. +-- @[EROFS, EACCES, EPERM]@ +-- +-- * 'ResourceExhausted' +-- Insufficient resources are available to perform the operation. +-- @[EDQUOT, ENOSPC, ENOMEM, EMLINK]@ +-- +-- * 'UnsatisfiedConstraints' +-- Implementation-dependent constraints are not satisfied. +-- @[EBUSY]@ +-- +-- * 'UnsupportedOperation' +-- The implementation does not support renaming in this situation. +-- @[EXDEV]@ +-- +-- * 'InappropriateType' +-- Either the destination path refers to an existing directory, or one of the +-- parent segments in the destination path is not a directory. +-- @[ENOTDIR, EISDIR, EINVAL, EEXIST, ENOTEMPTY]@ +-- +renamePath :: FilePath -- ^ Old path + -> FilePath -- ^ New path + -> IO () +renamePath opath npath = (`ioeSetLocation` "renamePath") `modifyIOError` do +#ifdef mingw32_HOST_OS + Win32.moveFileEx opath npath Win32.mOVEFILE_REPLACE_EXISTING +#else + Posix.rename opath npath +#endif + -- | Copy a file with its permissions. If the destination file already exists, -- it is replaced atomically. Neither path may refer to an existing -- directory. No exceptions are thrown if the permissions could not be diff --git a/changelog.md b/changelog.md index cfd6fc4..a053b88 100644 --- a/changelog.md +++ b/changelog.md @@ -10,6 +10,9 @@ Changelog for the [`directory`][1] package * Add `doesPathExist` and `getFileSize` ([#57](https://github.com/haskell/directory/issues/57)) + * Add `renamePath` + ([#58](https://github.com/haskell/directory/issues/58)) + ## 1.2.6.3 (May 2016) * Add missing import of `(<*>)` on Windows for `base` earlier than 4.8.0.0 diff --git a/directory.cabal b/directory.cabal index b7bdf17..419b7f8 100644 --- a/directory.cabal +++ b/directory.cabal @@ -99,6 +99,7 @@ test-suite test RemoveDirectoryRecursive001 RenameDirectory RenameFile001 + RenamePath Safe T8482 WithCurrentDirectory diff --git a/tests/Main.hs b/tests/Main.hs index 2b9227f..be178ca 100644 --- a/tests/Main.hs +++ b/tests/Main.hs @@ -21,6 +21,7 @@ import qualified IsSymbolicLink import qualified RemoveDirectoryRecursive001 import qualified RenameDirectory import qualified RenameFile001 +import qualified RenamePath import qualified Safe import qualified T8482 import qualified WithCurrentDirectory @@ -48,6 +49,7 @@ main = T.testMain $ \ _t -> do T.isolatedRun _t "RemoveDirectoryRecursive001" RemoveDirectoryRecursive001.main T.isolatedRun _t "RenameDirectory" RenameDirectory.main T.isolatedRun _t "RenameFile001" RenameFile001.main + T.isolatedRun _t "RenamePath" RenamePath.main T.isolatedRun _t "Safe" Safe.main T.isolatedRun _t "T8482" T8482.main T.isolatedRun _t "WithCurrentDirectory" WithCurrentDirectory.main diff --git a/tests/RenameFile001.hs b/tests/RenamePath.hs similarity index 62% copy from tests/RenameFile001.hs copy to tests/RenamePath.hs index f20bfb7..fe3fd35 100644 --- a/tests/RenameFile001.hs +++ b/tests/RenamePath.hs @@ -1,16 +1,23 @@ {-# LANGUAGE CPP #-} -module RenameFile001 where +module RenamePath where #include "util.inl" import System.Directory main :: TestEnv -> IO () main _t = do + + createDirectory "a" + T(expectEq) () ["a"] =<< listDirectory "." + renamePath "a" "b" + T(expectEq) () ["b"] =<< listDirectory "." + writeFile tmp1 contents1 - renameFile tmp1 tmp2 + renamePath tmp1 tmp2 T(expectEq) () contents1 =<< readFile tmp2 writeFile tmp1 contents2 - renameFile tmp2 tmp1 + renamePath tmp2 tmp1 T(expectEq) () contents1 =<< readFile tmp1 + where tmp1 = "tmp1" tmp2 = "tmp2" From git at git.haskell.org Mon Apr 17 21:34:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:19 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Replace `MIN_VERSION_base_4_[57]_0` by `MIN_VERSION_base()` (3582252) Message-ID: <20170417213419.265DC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/3582252bda944421c0a38c86684657e59dbe81be >--------------------------------------------------------------- commit 3582252bda944421c0a38c86684657e59dbe81be Author: Herbert Valerio Riedel Date: Thu Oct 16 22:35:13 2014 +0200 Replace `MIN_VERSION_base_4_[57]_0` by `MIN_VERSION_base()` >--------------------------------------------------------------- 3582252bda944421c0a38c86684657e59dbe81be Data/IntSet/Base.hs | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/Data/IntSet/Base.hs b/Data/IntSet/Base.hs index 309ab42..c8e70f6 100644 --- a/Data/IntSet/Base.hs +++ b/Data/IntSet/Base.hs @@ -162,26 +162,6 @@ module Data.IntSet.Base ( , bitmapOf ) where --- We want to be able to compile without cabal. Nevertheless --- #if defined(MIN_VERSION_base) && MIN_VERSION_base(4,5,0) --- does not work, because if MIN_VERSION_base is undefined, --- the last condition is syntactically wrong. -#define MIN_VERSION_base_4_5_0 0 -#ifdef MIN_VERSION_base -#if MIN_VERSION_base(4,5,0) -#undef MIN_VERSION_base_4_5_0 -#define MIN_VERSION_base_4_5_0 1 -#endif -#endif - -#define MIN_VERSION_base_4_7_0 0 -#ifdef MIN_VERSION_base -#if MIN_VERSION_base(4,7,0) -#undef MIN_VERSION_base_4_7_0 -#define MIN_VERSION_base_4_7_0 1 -#endif -#endif - import Control.DeepSeq (NFData) import Data.Bits import qualified Data.List as List @@ -1228,7 +1208,7 @@ tip kx bm = Tip kx bm ----------------------------------------------------------------------} suffixBitMask :: Int -#if MIN_VERSION_base_4_7_0 +#if MIN_VERSION_base(4,7,0) suffixBitMask = finiteBitSize (undefined::Word) - 1 #else suffixBitMask = bitSize (undefined::Word) - 1 @@ -1479,7 +1459,7 @@ foldr'Bits prefix f z bm = let lb = lowestBitSet bm ----------------------------------------------------------------------} bitcount :: Int -> Word -> Int -#if MIN_VERSION_base_4_5_0 +#if MIN_VERSION_base(4,5,0) bitcount a x = a + popCount x #else bitcount a0 x0 = go a0 x0 From git at git.haskell.org Mon Apr 17 21:34:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:19 +0000 (UTC) Subject: [commit: packages/directory] Mistuke-bump-win32-version-bounds, bgamari-patch-1, master: Add removePathForcibly (7f40ee3) Message-ID: <20170417213419.B040A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: Mistuke-bump-win32-version-bounds,bgamari-patch-1,master Link : http://ghc.haskell.org/trac/ghc/changeset/7f40ee38064c9eb8def5f3d7cdc90e15fec322d8/directory >--------------------------------------------------------------- commit 7f40ee38064c9eb8def5f3d7cdc90e15fec322d8 Author: Phil Ruffwind Date: Thu Aug 4 01:07:30 2016 -0400 Add removePathForcibly Fixes #59. >--------------------------------------------------------------- 7f40ee38064c9eb8def5f3d7cdc90e15fec322d8 System/Directory.hs | 28 +++++++++++++++++++++ changelog.md | 5 +++- directory.cabal | 1 + tests/Main.hs | 2 ++ ...ectoryRecursive001.hs => RemovePathForcibly.hs} | 29 +++++++++++----------- tests/Util.hs | 27 ++++++-------------- 6 files changed, 56 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 7f40ee38064c9eb8def5f3d7cdc90e15fec322d8 From git at git.haskell.org Mon Apr 17 21:34:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:21 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Merge pull request #57 from hvr/pr-foldable (daf640e) Message-ID: <20170417213421.31C0A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/daf640ec6c0c189a6c570a1dff4e958e2fa8d697 >--------------------------------------------------------------- commit daf640ec6c0c189a6c570a1dff4e958e2fa8d697 Merge: b9bd228 3582252 Author: Milan Straka Date: Sun Oct 19 10:24:41 2014 +0200 Merge pull request #57 from hvr/pr-foldable Define some new Foldable methods for containers >--------------------------------------------------------------- daf640ec6c0c189a6c570a1dff4e958e2fa8d697 Data/IntMap/Base.hs | 15 +++++++++++++++ Data/IntSet/Base.hs | 24 ++---------------------- Data/Map/Base.hs | 15 +++++++++++++++ Data/Sequence.hs | 7 +++++++ Data/Set/Base.hs | 20 ++++++++++++++++++++ Data/Tree.hs | 7 +++++++ 6 files changed, 66 insertions(+), 22 deletions(-) From git at git.haskell.org Mon Apr 17 21:34:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:21 +0000 (UTC) Subject: [commit: packages/directory] Mistuke-bump-win32-version-bounds, bgamari-patch-1, master: Correct changelog regarding GHC 8.0.1 (331ded9) Message-ID: <20170417213421.B6FB63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: Mistuke-bump-win32-version-bounds,bgamari-patch-1,master Link : http://ghc.haskell.org/trac/ghc/changeset/331ded9ad385dbba166d003d4424a470dddd7036/directory >--------------------------------------------------------------- commit 331ded9ad385dbba166d003d4424a470dddd7036 Author: Phil Ruffwind Date: Sat Aug 6 18:09:41 2016 -0400 Correct changelog regarding GHC 8.0.1 >--------------------------------------------------------------- 331ded9ad385dbba166d003d4424a470dddd7036 changelog.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 84e2e4c..41f6b36 100644 --- a/changelog.md +++ b/changelog.md @@ -23,13 +23,13 @@ Changelog for the [`directory`][1] package ## 1.2.6.2 (April 2016) + * Bundled with GHC 8.0.1 + * Fix typo in file time functions when `utimensat` is not available and version of `unix` package is lower than 2.7.0.0 ## 1.2.6.1 (April 2016) - * Bundled with GHC 8.0.1 - * Fix mistake in file time functions when `utimensat` is not available ([#47](https://github.com/haskell/directory/pull/47)) From git at git.haskell.org Mon Apr 17 21:34:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:23 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Provide default MIN_VERSION_base if not available. (0762786) Message-ID: <20170417213423.3E7103A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/076278627b6b3fda9522a9ca971f2467947527d6 >--------------------------------------------------------------- commit 076278627b6b3fda9522a9ca971f2467947527d6 Author: Milan Straka Date: Sun Oct 19 10:43:09 2014 +0200 Provide default MIN_VERSION_base if not available. After #56, we use MIN_VERSION_base in many places. We now provide trivial MIN_VERSION_base if not available to allow compiling without cabal. >--------------------------------------------------------------- 076278627b6b3fda9522a9ca971f2467947527d6 Data/IntMap/Base.hs | 8 ++++++++ Data/IntSet/Base.hs | 8 ++++++++ Data/Map/Base.hs | 8 ++++++++ Data/Sequence.hs | 8 ++++++++ Data/Set/Base.hs | 8 ++++++++ Data/Tree.hs | 8 ++++++++ 6 files changed, 48 insertions(+) diff --git a/Data/IntMap/Base.hs b/Data/IntMap/Base.hs index 0de3e5b..8f2e32f 100644 --- a/Data/IntMap/Base.hs +++ b/Data/IntMap/Base.hs @@ -247,6 +247,14 @@ import Text.Read -- want the compilers to be compiled by as many compilers as possible. #define STRICT_1_OF_2(fn) fn arg _ | arg `seq` False = undefined +-- We use cabal-generated MIN_VERSION_base to adapt to changes of base. +-- Nevertheless, as a convenience, we also allow compiling without cabal by +-- defining trivial MIN_VERSION_base if needed. +#ifndef MIN_VERSION_base +#define MIN_VERSION_base(major1,major2,minor) 0 +#endif + + -- A "Nat" is a natural machine word (an unsigned Int) type Nat = Word diff --git a/Data/IntSet/Base.hs b/Data/IntSet/Base.hs index c8e70f6..b6f8014 100644 --- a/Data/IntSet/Base.hs +++ b/Data/IntSet/Base.hs @@ -202,6 +202,14 @@ import GHC.Prim (indexInt8OffAddr#) #define STRICT_1_OF_3(fn) fn arg _ _ | arg `seq` False = undefined #define STRICT_2_OF_3(fn) fn _ arg _ | arg `seq` False = undefined +-- We use cabal-generated MIN_VERSION_base to adapt to changes of base. +-- Nevertheless, as a convenience, we also allow compiling without cabal by +-- defining trivial MIN_VERSION_base if needed. +#ifndef MIN_VERSION_base +#define MIN_VERSION_base(major1,major2,minor) 0 +#endif + + infixl 9 \\{-This comment teaches CPP correct behaviour -} -- A "Nat" is a natural machine word (an unsigned Int) diff --git a/Data/Map/Base.hs b/Data/Map/Base.hs index 72934e9..edcfdb7 100644 --- a/Data/Map/Base.hs +++ b/Data/Map/Base.hs @@ -299,6 +299,14 @@ import Data.Data #define STRICT_1_OF_4(fn) fn arg _ _ _ | arg `seq` False = undefined #define STRICT_2_OF_4(fn) fn _ arg _ _ | arg `seq` False = undefined +-- We use cabal-generated MIN_VERSION_base to adapt to changes of base. +-- Nevertheless, as a convenience, we also allow compiling without cabal by +-- defining trivial MIN_VERSION_base if needed. +#ifndef MIN_VERSION_base +#define MIN_VERSION_base(major1,major2,minor) 0 +#endif + + {-------------------------------------------------------------------- Operators --------------------------------------------------------------------} diff --git a/Data/Sequence.hs b/Data/Sequence.hs index f1385f5..a2b4844 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -160,6 +160,14 @@ import Text.Read (Lexeme(Ident), lexP, parens, prec, import Data.Data #endif +-- We use cabal-generated MIN_VERSION_base to adapt to changes of base. +-- Nevertheless, as a convenience, we also allow compiling without cabal by +-- defining trivial MIN_VERSION_base if needed. +#ifndef MIN_VERSION_base +#define MIN_VERSION_base(major1,major2,minor) 0 +#endif + + infixr 5 `consTree` infixl 5 `snocTree` diff --git a/Data/Set/Base.hs b/Data/Set/Base.hs index 9260aeb..e676a6f 100644 --- a/Data/Set/Base.hs +++ b/Data/Set/Base.hs @@ -214,6 +214,14 @@ import Data.Data #define STRICT_1_OF_3(fn) fn arg _ _ | arg `seq` False = undefined #define STRICT_2_OF_3(fn) fn _ arg _ | arg `seq` False = undefined +-- We use cabal-generated MIN_VERSION_base to adapt to changes of base. +-- Nevertheless, as a convenience, we also allow compiling without cabal by +-- defining trivial MIN_VERSION_base if needed. +#ifndef MIN_VERSION_base +#define MIN_VERSION_base(major1,major2,minor) 0 +#endif + + {-------------------------------------------------------------------- Operators --------------------------------------------------------------------} diff --git a/Data/Tree.hs b/Data/Tree.hs index 2f18c68..c880213 100644 --- a/Data/Tree.hs +++ b/Data/Tree.hs @@ -45,6 +45,14 @@ import Control.DeepSeq (NFData(rnf)) import Data.Data (Data) #endif +-- We use cabal-generated MIN_VERSION_base to adapt to changes of base. +-- Nevertheless, as a convenience, we also allow compiling without cabal by +-- defining trivial MIN_VERSION_base if needed. +#ifndef MIN_VERSION_base +#define MIN_VERSION_base(major1,major2,minor) 0 +#endif + + -- | Multi-way trees, also known as /rose trees/. data Tree a = Node { rootLabel :: a, -- ^ label value From git at git.haskell.org Mon Apr 17 21:34:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:23 +0000 (UTC) Subject: [commit: packages/directory] Mistuke-bump-win32-version-bounds, bgamari-patch-1, master: Add missing "since" annotations (b392965) Message-ID: <20170417213423.BDDAF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: Mistuke-bump-win32-version-bounds,bgamari-patch-1,master Link : http://ghc.haskell.org/trac/ghc/changeset/b3929651dab11a505cb7c056d1c18d79d70638c7/directory >--------------------------------------------------------------- commit b3929651dab11a505cb7c056d1c18d79d70638c7 Author: Phil Ruffwind Date: Thu Sep 8 15:49:29 2016 -0400 Add missing "since" annotations https://github.com/haskell/directory/commit/1ec1ea8e4210d55d8d6e0e5fc8dd543340004b92#commitcomment-18942758 >--------------------------------------------------------------- b3929651dab11a505cb7c056d1c18d79d70638c7 System/Directory.hs | 7 +++++++ changelog.md | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/System/Directory.hs b/System/Directory.hs index 2d519f1..2646bde 100644 --- a/System/Directory.hs +++ b/System/Directory.hs @@ -578,6 +578,8 @@ removeContentsRecursive path = -- files marked as read-only or otherwise made unremovable due to permissions. -- As a result, if the removal is incomplete, the permissions or attributes on -- the remaining files may be altered. +-- +-- @since 1.2.7.0 removePathForcibly :: FilePath -> IO () removePathForcibly path = (`ioeSetLocation` "removePathForcibly") `modifyIOError` do @@ -814,6 +816,7 @@ renameFile opath npath = (`ioeSetLocation` "renameFile") `modifyIOError` do -- parent segments in the destination path is not a directory. -- @[ENOTDIR, EISDIR, EINVAL, EEXIST, ENOTEMPTY]@ -- +-- @since 1.2.7.0 renamePath :: FilePath -- ^ Old path -> FilePath -- ^ New path -> IO () @@ -1395,6 +1398,8 @@ withCurrentDirectory dir action = action -- | Obtain the size of a file in bytes. +-- +-- @since 1.2.7.0 getFileSize :: FilePath -> IO Integer getFileSize path = (`ioeSetLocation` "getFileSize") `modifyIOError` do @@ -1407,6 +1412,8 @@ getFileSize path = -- | Test whether the given path points to an existing filesystem object. If -- the user lacks necessary permissions to search the parent directories, this -- function may return false even if the file does actually exist. +-- +-- @since 1.2.7.0 doesPathExist :: FilePath -> IO Bool doesPathExist path = #ifdef mingw32_HOST_OS diff --git a/changelog.md b/changelog.md index 41f6b36..ea31890 100644 --- a/changelog.md +++ b/changelog.md @@ -41,7 +41,7 @@ Changelog for the [`directory`][1] package * Add `findFileWith` - * Add `copyFileWithAttrs`, which copies additional metadata + * Add `copyFileWithMetadata`, which copies additional metadata ([#40](https://github.com/haskell/directory/issues/40)) * Improve error message of `removeDirectoryRecursive` when used on a From git at git.haskell.org Mon Apr 17 21:34:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:25 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Remove RoleAnnotations extension from containers.cabal. (1d555a4) Message-ID: <20170417213425.4692E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/1d555a4d7d2b902808d73c2fad4314672241e81d >--------------------------------------------------------------- commit 1d555a4d7d2b902808d73c2fad4314672241e81d Author: Milan Straka Date: Sun Oct 19 10:46:13 2014 +0200 Remove RoleAnnotations extension from containers.cabal. We switch the language extensions in specific files. We only provide extensions for GHC pre 7.0, as it cannot enable extensions conditionally using CPP. >--------------------------------------------------------------- 1d555a4d7d2b902808d73c2fad4314672241e81d containers.cabal | 2 -- 1 file changed, 2 deletions(-) diff --git a/containers.cabal b/containers.cabal index dcf36fd..815882e 100644 --- a/containers.cabal +++ b/containers.cabal @@ -64,8 +64,6 @@ Library if impl(ghc<7.0) extensions: MagicHash, DeriveDataTypeable, StandaloneDeriving, Rank2Types - if impl(ghc >= 7.8) - extensions: RoleAnnotations ------------------- -- T E S T I N G -- From git at git.haskell.org Mon Apr 17 21:34:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:25 +0000 (UTC) Subject: [commit: packages/directory] Mistuke-bump-win32-version-bounds, bgamari-patch-1, master: Fix CPP usage (0500f25) Message-ID: <20170417213425.C4AA43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: Mistuke-bump-win32-version-bounds,bgamari-patch-1,master Link : http://ghc.haskell.org/trac/ghc/changeset/0500f253ec77f3dd9b4432b0b83895f6fa08bb12/directory >--------------------------------------------------------------- commit 0500f253ec77f3dd9b4432b0b83895f6fa08bb12 Author: Erik de Castro Lopo Date: Sun Oct 23 12:42:59 2016 +1100 Fix CPP usage The code had a a mixture of `#ifdef mingw32_HOST_OS` and `#if ..`. The later works, but is not really correct. GHC HEAD now has a `-Wcpp-undef` warning that we would like to turn on and hence need this fixed. >--------------------------------------------------------------- 0500f253ec77f3dd9b4432b0b83895f6fa08bb12 System/Directory.hs | 2 +- tests/TestUtils.hs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/System/Directory.hs b/System/Directory.hs index 2646bde..9cc9d03 100644 --- a/System/Directory.hs +++ b/System/Directory.hs @@ -635,7 +635,7 @@ The operand refers to an existing directory. removeFile :: FilePath -> IO () removeFile path = -#if mingw32_HOST_OS +#ifdef mingw32_HOST_OS Win32.deleteFile path #else Posix.removeLink path diff --git a/tests/TestUtils.hs b/tests/TestUtils.hs index b04cbb0..80dda16 100644 --- a/tests/TestUtils.hs +++ b/tests/TestUtils.hs @@ -52,7 +52,7 @@ modifyPermissions path modify = do permissions <- getPermissions path setPermissions path (modify permissions) -#if mingw32_HOST_OS +#ifdef mingw32_HOST_OS createSymbolicLink :: String -> String -> IO () createSymbolicLink target link = (`ioeSetLocation` "createSymbolicLink") `modifyIOError` do From git at git.haskell.org Mon Apr 17 21:34:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:27 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Make Foldable.fold be INLINABLE without an argument. (398e466) Message-ID: <20170417213427.50FBC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/398e46672e498f83f28733f3a7a188651e9576b8 >--------------------------------------------------------------- commit 398e46672e498f83f28733f3a7a188651e9576b8 Author: Milan Straka Date: Sun Oct 19 14:07:13 2014 +0200 Make Foldable.fold be INLINABLE without an argument. >--------------------------------------------------------------- 398e46672e498f83f28733f3a7a188651e9576b8 Data/IntMap/Base.hs | 2 +- Data/Map/Base.hs | 2 +- Data/Set/Base.hs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Data/IntMap/Base.hs b/Data/IntMap/Base.hs index 8f2e32f..c1b2f4d 100644 --- a/Data/IntMap/Base.hs +++ b/Data/IntMap/Base.hs @@ -313,7 +313,7 @@ instance Monoid (IntMap a) where mconcat = unions instance Foldable.Foldable IntMap where - fold t = go t + fold = go where go Nil = mempty go (Tip _ v) = v go (Bin _ _ l r) = go l `mappend` go r diff --git a/Data/Map/Base.hs b/Data/Map/Base.hs index edcfdb7..781ac3a 100644 --- a/Data/Map/Base.hs +++ b/Data/Map/Base.hs @@ -2647,7 +2647,7 @@ instance Traversable (Map k) where {-# INLINE traverse #-} instance Foldable.Foldable (Map k) where - fold t = go t + fold = go where go Tip = mempty go (Bin 1 _ v _ _) = v go (Bin _ _ v l r) = go l `mappend` (v `mappend` go r) diff --git a/Data/Set/Base.hs b/Data/Set/Base.hs index e676a6f..67ade4e 100644 --- a/Data/Set/Base.hs +++ b/Data/Set/Base.hs @@ -255,7 +255,7 @@ instance Ord a => Monoid (Set a) where mconcat = unions instance Foldable.Foldable Set where - fold t = go t + fold = go where go Tip = mempty go (Bin 1 k _ _) = k go (Bin _ k l r) = go l `mappend` (k `mappend` go r) From git at git.haskell.org Mon Apr 17 21:34:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:27 +0000 (UTC) Subject: [commit: packages/directory] Mistuke-bump-win32-version-bounds, bgamari-patch-1, master: Improve robustness of removePathForcibly (1a5edff) Message-ID: <20170417213427.CBEAD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: Mistuke-bump-win32-version-bounds,bgamari-patch-1,master Link : http://ghc.haskell.org/trac/ghc/changeset/1a5edff2b6fc1620bab7ec3ebe9c0aa49a76fbc8/directory >--------------------------------------------------------------- commit 1a5edff2b6fc1620bab7ec3ebe9c0aa49a76fbc8 Author: Phil Ruffwind Date: Wed Oct 19 05:13:22 2016 -0400 Improve robustness of removePathForcibly Fixes #60. >--------------------------------------------------------------- 1a5edff2b6fc1620bab7ec3ebe9c0aa49a76fbc8 System/Directory.hs | 55 ++++++++++++++++++++++++++++++++++++++++++----------- changelog.md | 6 ++++++ directory.cabal | 2 +- 3 files changed, 51 insertions(+), 12 deletions(-) diff --git a/System/Directory.hs b/System/Directory.hs index 9cc9d03..3ab645e 100644 --- a/System/Directory.hs +++ b/System/Directory.hs @@ -570,35 +570,68 @@ removeContentsRecursive path = mapM_ removePathRecursive [path x | x <- cont] removeDirectory path --- | @'removePathForcibly@ removes a file or directory at /path/ together with --- its contents and subdirectories. Symbolic links are removed without --- affecting their the targets. If the path does not exist, nothing happens. +-- | Removes a file or directory at /path/ together with its contents and +-- subdirectories. Symbolic links are removed without affecting their +-- targets. If the path does not exist, nothing happens. -- -- Unlike other removal functions, this function will also attempt to delete -- files marked as read-only or otherwise made unremovable due to permissions. -- As a result, if the removal is incomplete, the permissions or attributes on -- the remaining files may be altered. -- +-- If an entry within the directory vanishes while @removePathForcibly@ is +-- running, it is silently ignored. +-- +-- If an exception occurs while removing an entry, @removePathForcibly@ will +-- still try to remove as many entries as it can before failing with an +-- exception. The first exception that it encountered is re-thrown. +-- -- @since 1.2.7.0 removePathForcibly :: FilePath -> IO () removePathForcibly path = (`ioeSetLocation` "removePathForcibly") `modifyIOError` do makeRemovable path `catchIOError` \ _ -> return () - dirType <- tryIOErrorType isDoesNotExistError (getDirectoryType path) - case dirType of - Left _ -> return () - Right NotDirectory -> removeFile path - Right DirectoryLink -> removeDirectory path - Right Directory -> do - mapM_ (removePathForcibly . (path )) =<< listDirectory path - removeDirectory path + ignoreDoesNotExistError $ do + dirType <- getDirectoryType path + case dirType of + NotDirectory -> removeFile path + DirectoryLink -> removeDirectory path + Directory -> do + names <- listDirectory path + sequenceWithIOErrors_ $ + [ removePathForcibly (path name) | name <- names ] ++ + [ removeDirectory path ] where + + ignoreDoesNotExistError :: IO () -> IO () + ignoreDoesNotExistError action = do + _ <- tryIOErrorType isDoesNotExistError action + return () + + makeRemovable :: FilePath -> IO () makeRemovable p = do perms <- getPermissions p setPermissions path perms{ readable = True , searchable = True , writable = True } +sequenceWithIOErrors_ :: [IO ()] -> IO () +sequenceWithIOErrors_ actions = go (Right ()) actions + where + + go :: Either IOError () -> [IO ()] -> IO () + go (Left e) [] = ioError e + go (Right ()) [] = return () + go s (m : ms) = s `seq` do + r <- tryIOError m + go (thenEither s r) ms + + -- equivalent to (*>) for Either, defined here to retain compatibility + -- with base prior to 4.3 + thenEither :: Either b a -> Either b a -> Either b a + thenEither x@(Left _) _ = x + thenEither _ y = y + {- |'removeFile' /file/ removes the directory entry for an existing file /file/, where /file/ is not itself a directory. The implementation may specify additional constraints which must be diff --git a/changelog.md b/changelog.md index ea31890..a0bf189 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,12 @@ Changelog for the [`directory`][1] package ========================================== +## 1.2.7.1 (November 2016) + + * Don't abort `removePathForcibly` if files or directories go missing. + In addition, keep going even if an exception occurs. + ([#60](https://github.com/haskell/directory/issues/60)) + ## 1.2.7.0 (August 2016) * Remove deprecated C bits. This means `HsDirectory.h` and its functions diff --git a/directory.cabal b/directory.cabal index e9e6108..248e840 100644 --- a/directory.cabal +++ b/directory.cabal @@ -1,5 +1,5 @@ name: directory -version: 1.2.7.0 +version: 1.2.7.1 -- NOTE: Don't forget to update ./changelog.md license: BSD3 license-file: LICENSE From git at git.haskell.org Mon Apr 17 21:34:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:29 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Add Foldable.{elem, maximum, minimum, sum, product} specializations. (530fc76) Message-ID: <20170417213429.5C5AC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/530fc76bdd17089fcaaa655d66156abbc2092c2c >--------------------------------------------------------------- commit 530fc76bdd17089fcaaa655d66156abbc2092c2c Author: Milan Straka Date: Sun Oct 19 14:07:42 2014 +0200 Add Foldable.{elem,maximum,minimum,sum,product} specializations. Following #56, add specializations for other base-4.8 Foldable methods, using strict folds and shortcircuiting. The Set.elem uses only Eq a, so it runs in linear time. >--------------------------------------------------------------- 530fc76bdd17089fcaaa655d66156abbc2092c2c Data/IntMap/Base.hs | 30 ++++++++++++++++++++++++++++++ Data/Map/Base.hs | 25 +++++++++++++++++++++++++ Data/Set/Base.hs | 9 +++++++++ 3 files changed, 64 insertions(+) diff --git a/Data/IntMap/Base.hs b/Data/IntMap/Base.hs index c1b2f4d..007e41e 100644 --- a/Data/IntMap/Base.hs +++ b/Data/IntMap/Base.hs @@ -341,6 +341,36 @@ instance Foldable.Foldable IntMap where {-# INLINE null #-} toList = elems -- NB: Foldable.toList /= IntMap.toList {-# INLINE toList #-} + elem = go + where STRICT_1_OF_2(go) + go _ Nil = False + go x (Tip _ y) = x == y + go x (Bin _ _ l r) = go x l || go x r + {-# INLINABLE elem #-} + maximum = start + where start Nil = error "IntMap.Foldable.maximum: called with empty map" + start (Tip _ y) = y + start (Bin _ _ l r) = go (start l) r + + STRICT_1_OF_2(go) + go m Nil = m + go m (Tip _ y) = max m y + go m (Bin _ _ l r) = go (go m l) r + {-# INLINABLE maximum #-} + minimum = start + where start Nil = error "IntMap.Foldable.minimum: called with empty map" + start (Tip _ y) = y + start (Bin _ _ l r) = go (start l) r + + STRICT_1_OF_2(go) + go m Nil = m + go m (Tip _ y) = min m y + go m (Bin _ _ l r) = go (go m l) r + {-# INLINABLE minimum #-} + sum = foldl' (+) 0 + {-# INLINABLE sum #-} + product = foldl' (*) 1 + {-# INLINABLE product #-} #endif instance Traversable IntMap where diff --git a/Data/Map/Base.hs b/Data/Map/Base.hs index 781ac3a..de074f4 100644 --- a/Data/Map/Base.hs +++ b/Data/Map/Base.hs @@ -2675,6 +2675,31 @@ instance Foldable.Foldable (Map k) where {-# INLINE null #-} toList = elems -- NB: Foldable.toList /= Map.toList {-# INLINE toList #-} + elem = go + where STRICT_1_OF_2(go) + go _ Tip = False + go x (Bin _ _ v l r) = x == v || go x l || go x r + {-# INLINABLE elem #-} + maximum = start + where start Tip = error "Map.Foldable.maximum: called with empty map" + start (Bin _ _ v l r) = go (go v l) r + + STRICT_1_OF_2(go) + go m Tip = m + go m (Bin _ _ v l r) = go (go (max m v) l) r + {-# INLINABLE maximum #-} + minimum = start + where start Tip = error "Map.Foldable.minumum: called with empty map" + start (Bin _ _ v l r) = go (go v l) r + + STRICT_1_OF_2(go) + go m Tip = m + go m (Bin _ _ v l r) = go (go (min m v) l) r + {-# INLINABLE minimum #-} + sum = foldl' (+) 0 + {-# INLINABLE sum #-} + product = foldl' (*) 1 + {-# INLINABLE product #-} #endif instance (NFData k, NFData a) => NFData (Map k a) where diff --git a/Data/Set/Base.hs b/Data/Set/Base.hs index 67ade4e..7e792f4 100644 --- a/Data/Set/Base.hs +++ b/Data/Set/Base.hs @@ -283,10 +283,19 @@ instance Foldable.Foldable Set where {-# INLINE null #-} toList = toList {-# INLINE toList #-} + elem = go + where STRICT_1_OF_2(go) + go _ Tip = False + go x (Bin _ y l r) = x == y || go x l || go x r + {-# INLINABLE elem #-} minimum = findMin {-# INLINE minimum #-} maximum = findMax {-# INLINE maximum #-} + sum = foldl' (+) 0 + {-# INLINABLE sum #-} + product = foldl' (*) 1 + {-# INLINABLE product #-} #endif From git at git.haskell.org Mon Apr 17 21:34:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:29 +0000 (UTC) Subject: [commit: packages/directory] Mistuke-bump-win32-version-bounds, bgamari-patch-1, master: Bump upper bound on base (2311dd5) Message-ID: <20170417213429.D23133A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: Mistuke-bump-win32-version-bounds,bgamari-patch-1,master Link : http://ghc.haskell.org/trac/ghc/changeset/2311dd5e1610e2cac6fc5ae3f6eb7595bd389cdf/directory >--------------------------------------------------------------- commit 2311dd5e1610e2cac6fc5ae3f6eb7595bd389cdf Author: Ben Gamari Date: Tue Nov 15 12:53:11 2016 -0500 Bump upper bound on base >--------------------------------------------------------------- 2311dd5e1610e2cac6fc5ae3f6eb7595bd389cdf directory.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/directory.cabal b/directory.cabal index 248e840..e74c3f0 100644 --- a/directory.cabal +++ b/directory.cabal @@ -52,7 +52,7 @@ Library include-dirs: . build-depends: - base >= 4.5 && < 4.10, + base >= 4.5 && < 4.11, time >= 1.4 && < 1.7, filepath >= 1.3 && < 1.5 if os(windows) From git at git.haskell.org Mon Apr 17 21:34:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:31 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Force prefix and suffix before middle (7dfdc33) Message-ID: <20170417213431.64AAB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/7dfdc33f8cc740036cee5a5e94c5603722d6fd02 >--------------------------------------------------------------- commit 7dfdc33f8cc740036cee5a5e94c5603722d6fd02 Author: treeowl Date: Sat Nov 8 22:08:19 2014 -0500 Force prefix and suffix before middle This should be slightly more efficient. Probably very slightly, but there doesn't seem to be a good reason not to. >--------------------------------------------------------------- 7dfdc33f8cc740036cee5a5e94c5603722d6fd02 Data/Sequence.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index a2b4844..1952b1c 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -346,7 +346,7 @@ instance Traversable FingerTree where instance NFData a => NFData (FingerTree a) where rnf (Empty) = () rnf (Single x) = rnf x - rnf (Deep _ pr m sf) = rnf pr `seq` rnf m `seq` rnf sf + rnf (Deep _ pr m sf) = rnf pr `seq` rnf sf `seq` rnf m {-# INLINE deep #-} deep :: Sized a => Digit a -> FingerTree (Node a) -> Digit a -> FingerTree a From git at git.haskell.org Mon Apr 17 21:34:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:31 +0000 (UTC) Subject: [commit: packages/directory] Mistuke-bump-win32-version-bounds, bgamari-patch-1, master: Relax upper bounds on time and Win32 (63c6784) Message-ID: <20170417213431.D8F383A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: Mistuke-bump-win32-version-bounds,bgamari-patch-1,master Link : http://ghc.haskell.org/trac/ghc/changeset/63c67848fff17c774c0319b34105dddb2503c11f/directory >--------------------------------------------------------------- commit 63c67848fff17c774c0319b34105dddb2503c11f Author: Phil Ruffwind Date: Sun Nov 20 22:01:02 2016 -0500 Relax upper bounds on time and Win32 Fixes #62. >--------------------------------------------------------------- 63c67848fff17c774c0319b34105dddb2503c11f directory.cabal | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/directory.cabal b/directory.cabal index e74c3f0..75163dc 100644 --- a/directory.cabal +++ b/directory.cabal @@ -53,10 +53,10 @@ Library build-depends: base >= 4.5 && < 4.11, - time >= 1.4 && < 1.7, + time >= 1.4 && < 1.8, filepath >= 1.3 && < 1.5 if os(windows) - build-depends: Win32 >= 2.2.2 && < 2.4 + build-depends: Win32 >= 2.2.2 && < 2.5 else build-depends: unix >= 2.5.1 && < 2.8 From git at git.haskell.org Mon Apr 17 21:34:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:33 +0000 (UTC) Subject: [commit: packages/directory] Mistuke-bump-win32-version-bounds, bgamari-patch-1, master: Add GHC 8.0.1 to CI (6899583) Message-ID: <20170417213433.DF39B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: Mistuke-bump-win32-version-bounds,bgamari-patch-1,master Link : http://ghc.haskell.org/trac/ghc/changeset/6899583edf3abc7180d595798b5d68df818335bc/directory >--------------------------------------------------------------- commit 6899583edf3abc7180d595798b5d68df818335bc Author: Phil Ruffwind Date: Mon Nov 28 02:20:06 2016 -0500 Add GHC 8.0.1 to CI >--------------------------------------------------------------- 6899583edf3abc7180d595798b5d68df818335bc .travis.yml | 5 +++++ appveyor.yml | 2 ++ 2 files changed, 7 insertions(+) diff --git a/.travis.yml b/.travis.yml index ea94fca..77b1e51 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,6 +30,11 @@ matrix: apt: packages: [ghc-7.10.1, cabal-install-1.22] sources: [hvr-ghc] + - env: GHCVER=8.0.1 CABALVER=1.24 + addons: + apt: + packages: [ghc-8.0.1, cabal-install-1.24] + sources: [hvr-ghc] - env: GHCVER=head CABALVER=head addons: apt: diff --git a/appveyor.yml b/appveyor.yml index fc53613..04370e4 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,6 +8,8 @@ environment: STACK_ROOT: C:\sr matrix: - DEPS: + STACK: stack --skip-msys --resolver lts-7 + - DEPS: STACK: stack --skip-msys --resolver lts-5 - DEPS: Win32-2.3.0.1 STACK: stack --skip-msys --resolver lts-2 From git at git.haskell.org Mon Apr 17 21:34:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:33 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Merge pull request #61 from treeowl/master (f9c23af) Message-ID: <20170417213433.6CC553A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/f9c23af0c7396aaf457ce9916392c7f949b60384 >--------------------------------------------------------------- commit f9c23af0c7396aaf457ce9916392c7f949b60384 Merge: 530fc76 7dfdc33 Author: Milan Straka Date: Sun Nov 9 07:11:13 2014 +0100 Merge pull request #61 from treeowl/master Force prefix and suffix before middle >--------------------------------------------------------------- f9c23af0c7396aaf457ce9916392c7f949b60384 Data/Sequence.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) From git at git.haskell.org Mon Apr 17 21:34:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:35 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Tighten Safe Haskell bounds, fixes new warning in GHC 7.10. (245ef13) Message-ID: <20170417213435.781063A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/245ef135eb8701fcd139770e564f25e774d26422 >--------------------------------------------------------------- commit 245ef135eb8701fcd139770e564f25e774d26422 Author: David Terei Date: Wed Nov 12 18:19:51 2014 -0800 Tighten Safe Haskell bounds, fixes new warning in GHC 7.10. >--------------------------------------------------------------- 245ef135eb8701fcd139770e564f25e774d26422 Data/IntMap.hs | 2 +- Data/IntMap/Lazy.hs | 2 +- Data/IntMap/Strict.hs | 4 +++- Data/Utils/StrictFold.hs | 2 +- Data/Utils/StrictPair.hs | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Data/IntMap.hs b/Data/IntMap.hs index 29ca3f5..52b05c2 100644 --- a/Data/IntMap.hs +++ b/Data/IntMap.hs @@ -1,6 +1,6 @@ {-# LANGUAGE CPP #-} #if !defined(TESTING) && __GLASGOW_HASKELL__ >= 703 -{-# LANGUAGE Trustworthy #-} +{-# LANGUAGE Safe #-} #endif ----------------------------------------------------------------------------- -- | diff --git a/Data/IntMap/Lazy.hs b/Data/IntMap/Lazy.hs index ab89e1a..62bf835 100644 --- a/Data/IntMap/Lazy.hs +++ b/Data/IntMap/Lazy.hs @@ -1,6 +1,6 @@ {-# LANGUAGE CPP #-} #if !defined(TESTING) && __GLASGOW_HASKELL__ >= 703 -{-# LANGUAGE Trustworthy #-} +{-# LANGUAGE Safe #-} #endif ----------------------------------------------------------------------------- -- | diff --git a/Data/IntMap/Strict.hs b/Data/IntMap/Strict.hs index 3a7dde8..f1c363c 100644 --- a/Data/IntMap/Strict.hs +++ b/Data/IntMap/Strict.hs @@ -1,5 +1,7 @@ {-# LANGUAGE CPP #-} -#if !defined(TESTING) && __GLASGOW_HASKELL__ >= 703 +#if !defined(TESTING) && __GLASGOW_HASKELL__ >= 709 +{-# LANGUAGE Safe #-} +#elif !defined(TESTING) && __GLASGOW_HASKELL__ >= 703 {-# LANGUAGE Trustworthy #-} #endif ----------------------------------------------------------------------------- diff --git a/Data/Utils/StrictFold.hs b/Data/Utils/StrictFold.hs index 953c9f1..b080e8a 100644 --- a/Data/Utils/StrictFold.hs +++ b/Data/Utils/StrictFold.hs @@ -1,6 +1,6 @@ {-# LANGUAGE CPP #-} #if !defined(TESTING) && __GLASGOW_HASKELL__ >= 703 -{-# LANGUAGE Trustworthy #-} +{-# LANGUAGE Safe #-} #endif module Data.Utils.StrictFold (foldlStrict) where diff --git a/Data/Utils/StrictPair.hs b/Data/Utils/StrictPair.hs index 6ae7ded..0c01ca4 100644 --- a/Data/Utils/StrictPair.hs +++ b/Data/Utils/StrictPair.hs @@ -1,6 +1,6 @@ {-# LANGUAGE CPP #-} #if !defined(TESTING) && __GLASGOW_HASKELL__ >= 703 -{-# LANGUAGE Trustworthy #-} +{-# LANGUAGE Safe #-} #endif module Data.Utils.StrictPair (StrictPair(..), toPair) where From git at git.haskell.org Mon Apr 17 21:34:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:35 +0000 (UTC) Subject: [commit: packages/directory] Mistuke-bump-win32-version-bounds, bgamari-patch-1, master: canonicalizePath: Drop trailing slashes (43488ba) Message-ID: <20170417213435.E82DA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: Mistuke-bump-win32-version-bounds,bgamari-patch-1,master Link : http://ghc.haskell.org/trac/ghc/changeset/43488ba64da36df921bc0a5ecec21a8bd69db6ed/directory >--------------------------------------------------------------- commit 43488ba64da36df921bc0a5ecec21a8bd69db6ed Author: Phil Ruffwind Date: Mon Nov 28 22:39:46 2016 -0500 canonicalizePath: Drop trailing slashes After discussion with Duncan Coutts, it was found that the trailing slash-preserving behavior was actually a bug on Windows. This means there is really no reason for the current, somewhat quirky behavior of preserving trailing slashes. However, it has been a while since the change was made, so it would be safer to introduce this as a major version bump. The internal prependCurrentDirectory function has been reworked slightly with regards to the behavior on empty paths, but this not have any visible effect on the public API since they always end up normalizing the result of prependCurrentDirectory in some way or another. Fixes #63. >--------------------------------------------------------------- 43488ba64da36df921bc0a5ecec21a8bd69db6ed System/Directory.hs | 27 ++++++++++++----------- changelog.md | 5 +++++ directory.cabal | 2 +- tests/CanonicalizePath.hs | 56 +++++++++++++++++++++++++++++++++++++++-------- 4 files changed, 67 insertions(+), 23 deletions(-) diff --git a/System/Directory.hs b/System/Directory.hs index 3ab645e..a4f8ba1 100644 --- a/System/Directory.hs +++ b/System/Directory.hs @@ -1038,26 +1038,31 @@ copyFileTimesFromStatus st dst = do -- returned path due to the presence of hard links, mount points, etc. -- -- Similar to 'normalise', passing an empty path is equivalent to passing the --- current directory. The function preserves the presence or absence of the --- trailing path separator unless the path refers to the root directory @/@. +-- current directory. The function drops trailing path separators where +-- possible (via 'dropTrailingPathSeparator'). -- --- /Known bug(s)/: on Windows, the function does not resolve symbolic links. +-- /Known bug(s)/: on Windows, the function does not resolve symbolic links +-- and the letter case of filenames is not canonicalized. -- -- /Changes since 1.2.3.0:/ The function has been altered to be more robust -- and has the same exception behavior as 'makeAbsolute'. -- +-- /Changes since 1.3.0.0:/ The function no longer preserves the trailing path +-- separator. +-- canonicalizePath :: FilePath -> IO FilePath canonicalizePath = \ path -> modifyIOError ((`ioeSetLocation` "canonicalizePath") . (`ioeSetFileName` path)) $ -- normalise does more stuff, like upper-casing the drive letter - normalise <$> (transform =<< prependCurrentDirectory path) + dropTrailingPathSeparator . normalise <$> + (transform =<< prependCurrentDirectory path) where #if defined(mingw32_HOST_OS) transform path = Win32.getFullPathName path `catchIOError` \ _ -> return path #else - transform path = matchTrailingSeparator path <$> do + transform path = do encoding <- getFileSystemEncoding realpathPrefix encoding (reverse (zip prefixes suffixes)) path where segments = splitPath path @@ -1088,6 +1093,7 @@ canonicalizePath = \ path -> -- operation may fail with the same exceptions as 'getCurrentDirectory'. -- -- @since 1.2.2.0 +-- makeAbsolute :: FilePath -> IO FilePath makeAbsolute path = modifyIOError ((`ioeSetLocation` "makeAbsolute") . @@ -1107,14 +1113,9 @@ prependCurrentDirectory :: FilePath -> IO FilePath prependCurrentDirectory path = modifyIOError ((`ioeSetLocation` "prependCurrentDirectory") . (`ioeSetFileName` path)) $ - case path of - "" -> -- avoid trailing path separator - prependCurrentDirectory "." - _ -- avoid the call to `getCurrentDirectory` if we can - | isRelative path -> - ( path) . addTrailingPathSeparator <$> getCurrentDirectory - | otherwise -> - return path + if isRelative path -- avoid the call to `getCurrentDirectory` if we can + then ( path) <$> getCurrentDirectory + else return path -- | Add or remove the trailing path separator in the second path so as to -- match its presence in the first path. diff --git a/changelog.md b/changelog.md index a0bf189..e2a370b 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,11 @@ Changelog for the [`directory`][1] package ========================================== +## 1.3.0.0 (November 2016) + + * Drop trailing slashes in `canonicalizePath` + ([#63](https://github.com/haskell/directory/issues/63)) + ## 1.2.7.1 (November 2016) * Don't abort `removePathForcibly` if files or directories go missing. diff --git a/directory.cabal b/directory.cabal index 75163dc..86652a4 100644 --- a/directory.cabal +++ b/directory.cabal @@ -1,5 +1,5 @@ name: directory -version: 1.2.7.1 +version: 1.3.0.0 -- NOTE: Don't forget to update ./changelog.md license: BSD3 license-file: LICENSE diff --git a/tests/CanonicalizePath.hs b/tests/CanonicalizePath.hs index e9d3672..60294e2 100644 --- a/tests/CanonicalizePath.hs +++ b/tests/CanonicalizePath.hs @@ -2,25 +2,63 @@ module CanonicalizePath where #include "util.inl" import System.Directory -import System.FilePath ((), hasTrailingPathSeparator, normalise) +import System.FilePath ((), dropTrailingPathSeparator, normalise) main :: TestEnv -> IO () main _t = do - dot' <- canonicalizePath "./" - dot <- canonicalizePath "." - nul <- canonicalizePath "" - T(expectEq) () dot nul - T(expect) dot (not (hasTrailingPathSeparator dot)) - T(expect) dot' (hasTrailingPathSeparator dot') + dot <- canonicalizePath "" + dot2 <- canonicalizePath "." + dot3 <- canonicalizePath "./" + dot4 <- canonicalizePath "./." + T(expectEq) () dot (dropTrailingPathSeparator dot) + T(expectEq) () dot dot2 + T(expectEq) () dot dot3 + T(expectEq) () dot dot4 writeFile "bar" "" bar <- canonicalizePath "bar" + bar2 <- canonicalizePath "bar/" + bar3 <- canonicalizePath "bar/." + bar4 <- canonicalizePath "bar/./" + bar5 <- canonicalizePath "./bar" + bar6 <- canonicalizePath "./bar/" + bar7 <- canonicalizePath "./bar/." T(expectEq) () bar (normalise (dot "bar")) + T(expectEq) () bar bar2 + T(expectEq) () bar bar3 + T(expectEq) () bar bar4 + T(expectEq) () bar bar5 + T(expectEq) () bar bar6 + T(expectEq) () bar bar7 createDirectory "foo" - foo <- canonicalizePath "foo/" - T(expectEq) () foo (normalise (dot "foo/")) + foo <- canonicalizePath "foo" + foo2 <- canonicalizePath "foo/" + foo3 <- canonicalizePath "foo/." + foo4 <- canonicalizePath "foo/./" + foo5 <- canonicalizePath "./foo" + foo6 <- canonicalizePath "./foo/" + T(expectEq) () foo (normalise (dot "foo")) + T(expectEq) () foo foo2 + T(expectEq) () foo foo3 + T(expectEq) () foo foo4 + T(expectEq) () foo foo5 + T(expectEq) () foo foo6 -- should not fail for non-existent paths fooNon <- canonicalizePath "foo/non-existent" + fooNon2 <- canonicalizePath "foo/non-existent/" + fooNon3 <- canonicalizePath "foo/non-existent/." + fooNon4 <- canonicalizePath "foo/non-existent/./" + fooNon5 <- canonicalizePath "./foo/non-existent" + fooNon6 <- canonicalizePath "./foo/non-existent/" + fooNon7 <- canonicalizePath "./foo/./non-existent" + fooNon8 <- canonicalizePath "./foo/./non-existent/" T(expectEq) () fooNon (normalise (foo "non-existent")) + T(expectEq) () fooNon fooNon2 + T(expectEq) () fooNon fooNon3 + T(expectEq) () fooNon fooNon4 + T(expectEq) () fooNon fooNon5 + T(expectEq) () fooNon fooNon6 + T(expectEq) () fooNon fooNon7 + T(expectEq) () fooNon fooNon8 From git at git.haskell.org Mon Apr 17 21:34:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:37 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Add support for `deepseq-1.4` (667cf94) Message-ID: <20170417213437.7FCFB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/667cf94c6826738429485b806354d1e92136ba56 >--------------------------------------------------------------- commit 667cf94c6826738429485b806354d1e92136ba56 Author: Herbert Valerio Riedel Date: Fri Nov 14 16:09:27 2014 +0100 Add support for `deepseq-1.4` This change avoids relying on `rnf`'s default method implementation which has changed in `deepseq-1.4.0.0` >--------------------------------------------------------------- 667cf94c6826738429485b806354d1e92136ba56 Data/IntSet/Base.hs | 4 ++-- containers.cabal | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Data/IntSet/Base.hs b/Data/IntSet/Base.hs index b6f8014..6333eea 100644 --- a/Data/IntSet/Base.hs +++ b/Data/IntSet/Base.hs @@ -162,7 +162,7 @@ module Data.IntSet.Base ( , bitmapOf ) where -import Control.DeepSeq (NFData) +import Control.DeepSeq (NFData(rnf)) import Data.Bits import qualified Data.List as List import Data.Maybe (fromMaybe) @@ -1099,7 +1099,7 @@ INSTANCE_TYPEABLE0(IntSet,intSetTc,"IntSet") -- The IntSet constructors consist only of strict fields of Ints and -- IntSets, thus the default NFData instance which evaluates to whnf -- should suffice -instance NFData IntSet +instance NFData IntSet where rnf x = seq x () {-------------------------------------------------------------------- Debugging diff --git a/containers.cabal b/containers.cabal index 815882e..050257c 100644 --- a/containers.cabal +++ b/containers.cabal @@ -31,7 +31,7 @@ source-repository head location: http://github.com/haskell/containers.git Library - build-depends: base >= 4.2 && < 5, array, deepseq >= 1.2 && < 1.4 + build-depends: base >= 4.2 && < 5, array, deepseq >= 1.2 && < 1.5 if impl(ghc>=6.10) build-depends: ghc-prim @@ -83,7 +83,7 @@ Test-suite map-lazy-properties type: exitcode-stdio-1.0 cpp-options: -DTESTING - build-depends: base >= 4.2 && < 5, array, deepseq >= 1.2 && < 1.4, ghc-prim + build-depends: base >= 4.2 && < 5, array, deepseq >= 1.2 && < 1.5, ghc-prim ghc-options: -O2 extensions: MagicHash, DeriveDataTypeable, StandaloneDeriving, Rank2Types @@ -100,7 +100,7 @@ Test-suite map-strict-properties type: exitcode-stdio-1.0 cpp-options: -DTESTING -DSTRICT - build-depends: base >= 4.2 && < 5, array, deepseq >= 1.2 && < 1.4, ghc-prim + build-depends: base >= 4.2 && < 5, array, deepseq >= 1.2 && < 1.5, ghc-prim ghc-options: -O2 extensions: MagicHash, DeriveDataTypeable, StandaloneDeriving, Rank2Types @@ -117,7 +117,7 @@ Test-suite set-properties type: exitcode-stdio-1.0 cpp-options: -DTESTING - build-depends: base >= 4.2 && < 5, array, deepseq >= 1.2 && < 1.4, ghc-prim + build-depends: base >= 4.2 && < 5, array, deepseq >= 1.2 && < 1.5, ghc-prim ghc-options: -O2 extensions: MagicHash, DeriveDataTypeable, StandaloneDeriving, Rank2Types @@ -134,7 +134,7 @@ Test-suite intmap-lazy-properties type: exitcode-stdio-1.0 cpp-options: -DTESTING - build-depends: base >= 4.2 && < 5, array, deepseq >= 1.2 && < 1.4, ghc-prim + build-depends: base >= 4.2 && < 5, array, deepseq >= 1.2 && < 1.5, ghc-prim ghc-options: -O2 extensions: MagicHash, DeriveDataTypeable, StandaloneDeriving, Rank2Types @@ -151,7 +151,7 @@ Test-suite intmap-strict-properties type: exitcode-stdio-1.0 cpp-options: -DTESTING -DSTRICT - build-depends: base >= 4.2 && < 5, array, deepseq >= 1.2 && < 1.4, ghc-prim + build-depends: base >= 4.2 && < 5, array, deepseq >= 1.2 && < 1.5, ghc-prim ghc-options: -O2 extensions: MagicHash, DeriveDataTypeable, StandaloneDeriving, Rank2Types @@ -168,7 +168,7 @@ Test-suite intset-properties type: exitcode-stdio-1.0 cpp-options: -DTESTING - build-depends: base >= 4.2 && < 5, array, deepseq >= 1.2 && < 1.4, ghc-prim + build-depends: base >= 4.2 && < 5, array, deepseq >= 1.2 && < 1.5, ghc-prim ghc-options: -O2 extensions: MagicHash, DeriveDataTypeable, StandaloneDeriving, Rank2Types @@ -185,7 +185,7 @@ Test-suite deprecated-properties type: exitcode-stdio-1.0 cpp-options: -DTESTING - build-depends: base >= 4.2 && < 5, array, deepseq >= 1.2 && < 1.4, ghc-prim + build-depends: base >= 4.2 && < 5, array, deepseq >= 1.2 && < 1.5, ghc-prim ghc-options: -O2 extensions: MagicHash, DeriveDataTypeable, StandaloneDeriving, Rank2Types @@ -200,7 +200,7 @@ Test-suite seq-properties type: exitcode-stdio-1.0 cpp-options: -DTESTING - build-depends: base >= 4.2 && < 5, array, deepseq >= 1.2 && < 1.4, ghc-prim + build-depends: base >= 4.2 && < 5, array, deepseq >= 1.2 && < 1.5, ghc-prim ghc-options: -O2 extensions: MagicHash, DeriveDataTypeable, StandaloneDeriving, Rank2Types @@ -218,7 +218,7 @@ test-suite map-strictness-properties array, base >= 4.2 && < 5, ChasingBottoms, - deepseq >= 1.2 && < 1.4, + deepseq >= 1.2 && < 1.5, QuickCheck >= 2.4.0.1, ghc-prim, test-framework >= 0.3.3, @@ -235,7 +235,7 @@ test-suite intmap-strictness-properties array, base >= 4.2 && < 5, ChasingBottoms, - deepseq >= 1.2 && < 1.4, + deepseq >= 1.2 && < 1.5, QuickCheck >= 2.4.0.1, ghc-prim, test-framework >= 0.3.3, From git at git.haskell.org Mon Apr 17 21:34:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:37 +0000 (UTC) Subject: [commit: packages/directory] Mistuke-bump-win32-version-bounds, bgamari-patch-1, master: Use PREBUILD scripts in CI (a22238b) Message-ID: <20170417213437.EE62D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: Mistuke-bump-win32-version-bounds,bgamari-patch-1,master Link : http://ghc.haskell.org/trac/ghc/changeset/a22238bdf93ac94f4ccbfe70779c33f10d52fdba/directory >--------------------------------------------------------------- commit a22238bdf93ac94f4ccbfe70779c33f10d52fdba Author: Phil Ruffwind Date: Tue Nov 29 22:12:25 2016 -0500 Use PREBUILD scripts in CI The PREBUILD environment variable is executed as a script before the build, allowing modifications to configure.ac to emulate missing features. >--------------------------------------------------------------- a22238bdf93ac94f4ccbfe70779c33f10d52fdba .travis.yml | 3 ++- appveyor.yml | 1 + tools/testscript | 11 ++--------- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 77b1e51..f75bbfa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,8 @@ matrix: # CABALVER=1.16 is the earliest available in the PPA - env: STACK="stack --resolver lts-5" os: osx - - env: GHCVER=7.4.2 CABALVER=1.16 DISABLE_UTIMENSAT=t + - env: GHCVER=7.4.2 CABALVER=1.16 + PREBUILD="sed -i.bak /utimensat/d configure.ac" addons: apt: packages: [ghc-7.4.2, cabal-install-1.16] diff --git a/appveyor.yml b/appveyor.yml index ece24a1..17cba1e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -13,6 +13,7 @@ environment: STACK: stack --skip-msys --resolver lts-5 - DEPS: Win32-2.3.0.1 STACK: stack --skip-msys --resolver lts-2 + PREBUILD: sed -i.bak /GetFinalPathNameByHandleW/d configure.ac cache: - "%STACK_ROOT%" install: diff --git a/tools/testscript b/tools/testscript index 93e30d7..85799bd 100755 --- a/tools/testscript +++ b/tools/testscript @@ -12,14 +12,8 @@ before_build() { fi } -after_cabal_configure() { - # this hook is only executed in the Cabal case - if [ "${DISABLE_UTIMENSAT+x}" ]; then - sed -i.bak "s/#define HAVE_UTIMENSAT 1//" HsDirectoryConfig.h - fi -} - prepare() { + eval "${PREBUILD-}" if [ "${STACK+x}" ]; then stack="$STACK --no-terminal" @@ -115,12 +109,11 @@ build() { testflags=`printf " %s" "$testflags" | sed "s/ / --test-option=/g"` cabal configure -v2 --enable-tests --ghc-options="$ghcflags" - after_cabal_configure cabal build + cabal test --show-details="$streaming" $testflags cabal check cabal sdist cabal copy - cabal test --show-details="$streaming" $testflags cabal_install_run_tests dist/*-*.tar.gz --force-reinstalls fi From git at git.haskell.org Mon Apr 17 21:34:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:39 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Merge pull request #65 from dterei/safe710fixes (09ae752) Message-ID: <20170417213439.885143A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/09ae752eeffd06e24ffb4abeabcd6511dea0e68e >--------------------------------------------------------------- commit 09ae752eeffd06e24ffb4abeabcd6511dea0e68e Merge: f9c23af 245ef13 Author: Milan Straka Date: Fri Nov 14 16:15:41 2014 +0100 Merge pull request #65 from dterei/safe710fixes Tighten Safe Haskell bounds, fixes new warning in GHC 7.10. >--------------------------------------------------------------- 09ae752eeffd06e24ffb4abeabcd6511dea0e68e Data/IntMap.hs | 2 +- Data/IntMap/Lazy.hs | 2 +- Data/IntMap/Strict.hs | 4 +++- Data/Utils/StrictFold.hs | 2 +- Data/Utils/StrictPair.hs | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) From git at git.haskell.org Mon Apr 17 21:34:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:40 +0000 (UTC) Subject: [commit: packages/directory] Mistuke-bump-win32-version-bounds, bgamari-patch-1, master: Add tests for makeAbsolute (4366a08) Message-ID: <20170417213440.018A43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: Mistuke-bump-win32-version-bounds,bgamari-patch-1,master Link : http://ghc.haskell.org/trac/ghc/changeset/4366a08895bff22a16151f9e43055ac2937bc5ab/directory >--------------------------------------------------------------- commit 4366a08895bff22a16151f9e43055ac2937bc5ab Author: Phil Ruffwind Date: Mon Nov 28 22:46:00 2016 -0500 Add tests for makeAbsolute Precaution to make sure nothing was broken by the previous commit. >--------------------------------------------------------------- 4366a08895bff22a16151f9e43055ac2937bc5ab directory.cabal | 1 + tests/Main.hs | 2 ++ tests/MakeAbsolute.hs | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+) diff --git a/directory.cabal b/directory.cabal index 86652a4..06c4d0d 100644 --- a/directory.cabal +++ b/directory.cabal @@ -96,6 +96,7 @@ test-suite test GetHomeDirectory001 GetPermissions001 IsSymbolicLink + MakeAbsolute RemoveDirectoryRecursive001 RemovePathForcibly RenameDirectory diff --git a/tests/Main.hs b/tests/Main.hs index e4a867a..6fb34dc 100644 --- a/tests/Main.hs +++ b/tests/Main.hs @@ -18,6 +18,7 @@ import qualified GetFileSize import qualified GetHomeDirectory001 import qualified GetPermissions001 import qualified IsSymbolicLink +import qualified MakeAbsolute import qualified RemoveDirectoryRecursive001 import qualified RemovePathForcibly import qualified RenameDirectory @@ -47,6 +48,7 @@ main = T.testMain $ \ _t -> do T.isolatedRun _t "GetHomeDirectory001" GetHomeDirectory001.main T.isolatedRun _t "GetPermissions001" GetPermissions001.main T.isolatedRun _t "IsSymbolicLink" IsSymbolicLink.main + T.isolatedRun _t "MakeAbsolute" MakeAbsolute.main T.isolatedRun _t "RemoveDirectoryRecursive001" RemoveDirectoryRecursive001.main T.isolatedRun _t "RemovePathForcibly" RemovePathForcibly.main T.isolatedRun _t "RenameDirectory" RenameDirectory.main diff --git a/tests/MakeAbsolute.hs b/tests/MakeAbsolute.hs new file mode 100644 index 0000000..4303017 --- /dev/null +++ b/tests/MakeAbsolute.hs @@ -0,0 +1,34 @@ +{-# LANGUAGE CPP #-} +module MakeAbsolute where +#include "util.inl" +import System.Directory +import System.FilePath ((), addTrailingPathSeparator, + dropTrailingPathSeparator, normalise) + +main :: TestEnv -> IO () +main _t = do + dot <- makeAbsolute "" + dot2 <- makeAbsolute "." + dot3 <- makeAbsolute "./." + T(expectEq) () dot (dropTrailingPathSeparator dot) + T(expectEq) () dot dot2 + T(expectEq) () dot dot3 + + sdot <- makeAbsolute "./" + sdot2 <- makeAbsolute "././" + T(expectEq) () sdot (addTrailingPathSeparator sdot) + T(expectEq) () sdot sdot2 + + foo <- makeAbsolute "foo" + foo2 <- makeAbsolute "foo/." + foo3 <- makeAbsolute "./foo" + T(expectEq) () foo (normalise (dot "foo")) + T(expectEq) () foo foo2 + T(expectEq) () foo foo3 + + sfoo <- makeAbsolute "foo/" + sfoo2 <- makeAbsolute "foo/./" + sfoo3 <- makeAbsolute "./foo/" + T(expectEq) () sfoo (normalise (dot "foo/")) + T(expectEq) () sfoo sfoo2 + T(expectEq) () sfoo sfoo3 From git at git.haskell.org Mon Apr 17 21:34:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:41 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Merge pull request #67 from hvr/pr-deepseq-14 (c802c36) Message-ID: <20170417213441.90E723A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/c802c36dbed4b800d8c2131181f5af3db837aded >--------------------------------------------------------------- commit c802c36dbed4b800d8c2131181f5af3db837aded Merge: 09ae752 667cf94 Author: Milan Straka Date: Fri Nov 14 16:27:16 2014 +0100 Merge pull request #67 from hvr/pr-deepseq-14 Add support for `deepseq-1.4` >--------------------------------------------------------------- c802c36dbed4b800d8c2131181f5af3db837aded Data/IntSet/Base.hs | 4 ++-- containers.cabal | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-) From git at git.haskell.org Mon Apr 17 21:34:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:42 +0000 (UTC) Subject: [commit: packages/directory] Mistuke-bump-win32-version-bounds, bgamari-patch-1, master: Add Win32-2.4.0.0 to appveyor.yml (f0c4272) Message-ID: <20170417213442.0812F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: Mistuke-bump-win32-version-bounds,bgamari-patch-1,master Link : http://ghc.haskell.org/trac/ghc/changeset/f0c42720341b16857d57079d8b2ecd27bc958120/directory >--------------------------------------------------------------- commit f0c42720341b16857d57079d8b2ecd27bc958120 Author: Phil Ruffwind Date: Tue Nov 29 06:15:24 2016 -0500 Add Win32-2.4.0.0 to appveyor.yml >--------------------------------------------------------------- f0c42720341b16857d57079d8b2ecd27bc958120 appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 04370e4..ece24a1 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -7,7 +7,7 @@ environment: # use a short path prefix to avoid running into path-length limitations STACK_ROOT: C:\sr matrix: - - DEPS: + - DEPS: Win32-2.4.0.0 STACK: stack --skip-msys --resolver lts-7 - DEPS: STACK: stack --skip-msys --resolver lts-5 From git at git.haskell.org Mon Apr 17 21:34:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:43 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Improve Foldable methods (c4884ad) Message-ID: <20170417213443.99C463A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/c4884ad0d7310e62c48ebd23600d73230718ae45 >--------------------------------------------------------------- commit c4884ad0d7310e62c48ebd23600d73230718ae45 Author: David Feuer Date: Mon Nov 17 17:48:10 2014 -0500 Improve Foldable methods Define foldMap for Seq directly, instead of relying on the default based on foldr. Define length and null for ViewR directly, instead of relying on (inappropriate) defaults. >--------------------------------------------------------------- c4884ad0d7310e62c48ebd23600d73230718ae45 Data/Sequence.hs | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 1952b1c..0c2be04 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -149,7 +149,7 @@ import Control.DeepSeq (NFData(rnf)) import Control.Monad (MonadPlus(..), ap) import Data.Monoid (Monoid(..)) import Data.Functor (Functor(..)) -import Data.Foldable (Foldable(foldl, foldl1, foldr, foldr1), foldl', toList) +import Data.Foldable (Foldable(foldl, foldl1, foldr, foldr1, foldMap), foldl', foldr', toList) import Data.Traversable import Data.Typeable @@ -188,6 +188,7 @@ instance Functor Seq where #endif instance Foldable Seq where + foldMap f (Seq xs) = foldMap (foldMap f) xs foldr f z (Seq xs) = foldr (flip (foldr f)) z xs foldl f z (Seq xs) = foldl (foldl f) z xs @@ -310,6 +311,11 @@ instance Sized a => Sized (FingerTree a) where size (Deep v _ _ _) = v instance Foldable FingerTree where + foldMap _ Empty = mempty + foldMap f (Single x) = f x + foldMap f (Deep _ pr m sf) = + foldMap f pr `mappend` (foldMap (foldMap f) m `mappend` foldMap f sf) + foldr _ z Empty = z foldr f z (Single x) = x `f` z foldr f z (Deep _ pr m sf) = @@ -388,6 +394,11 @@ data Digit a #endif instance Foldable Digit where + foldMap f (One a) = f a + foldMap f (Two a b) = f a `mappend` f b + foldMap f (Three a b c) = f a `mappend` (f b `mappend` f c) + foldMap f (Four a b c d) = f a `mappend` (f b `mappend` (f c `mappend` f d)) + foldr f z (One a) = a `f` z foldr f z (Two a b) = a `f` (b `f` z) foldr f z (Three a b c) = a `f` (b `f` (c `f` z)) @@ -458,6 +469,9 @@ data Node a #endif instance Foldable Node where + foldMap f (Node2 _ a b) = f a `mappend` f b + foldMap f (Node3 _ a b c) = f a `mappend` (f b `mappend` f c) + foldr f z (Node2 _ a b) = a `f` (b `f` z) foldr f z (Node3 _ a b c) = a `f` (b `f` (c `f` z)) @@ -508,6 +522,7 @@ instance Functor Elem where fmap f (Elem x) = Elem (f x) instance Foldable Elem where + foldMap f (Elem x) = f x foldr f z (Elem x) = f x z foldl f z (Elem x) = f z x @@ -1009,6 +1024,9 @@ instance Functor ViewR where fmap f (xs :> x) = fmap f xs :> f x instance Foldable ViewR where + foldMap _ EmptyR = mempty + foldMap f (xs :> x) = foldMap f xs `mappend` f x + foldr _ z EmptyR = z foldr f z (xs :> x) = foldr f (f x z) xs @@ -1017,6 +1035,14 @@ instance Foldable ViewR where foldr1 _ EmptyR = error "foldr1: empty view" foldr1 f (xs :> x) = foldr f x xs +#if MIN_VERSION_base(4,8,0) + -- The default definitions are sensible for ViewL, but not so much for + -- ViewR. + null EmptyR = True + null (_ :> _) = False + + length = foldr' (\_ k -> k+1) 0 +#endif instance Traversable ViewR where traverse _ EmptyR = pure EmptyR From git at git.haskell.org Mon Apr 17 21:34:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:44 +0000 (UTC) Subject: [commit: packages/directory] Mistuke-bump-win32-version-bounds, bgamari-patch-1, master: Fix AppVeyor (e09aaa6) Message-ID: <20170417213444.0EB783A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: Mistuke-bump-win32-version-bounds,bgamari-patch-1,master Link : http://ghc.haskell.org/trac/ghc/changeset/e09aaa635f4855cc4c58ee138563ec70d65b49ae/directory >--------------------------------------------------------------- commit e09aaa635f4855cc4c58ee138563ec70d65b49ae Author: Phil Ruffwind Date: Sat Dec 3 12:53:22 2016 -0500 Fix AppVeyor Seems that Stack is now distributed via tar.gz instead of zip. >--------------------------------------------------------------- e09aaa635f4855cc4c58ee138563ec70d65b49ae appveyor.yml | 2 -- tools/testscript | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 17cba1e..18209a5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -18,8 +18,6 @@ cache: - "%STACK_ROOT%" install: - set PATH=%CD%\_stack;C:\msys64\usr\bin;%PATH% - # might have to retry due to reliability issues with SourceForge -- sh tools/retry -n 32 pacman -S --needed --noconfirm autoconf automake tar - sh tools/testscript prepare test_script: - sh tools/testscript build diff --git a/tools/testscript b/tools/testscript index 85799bd..71a3840 100755 --- a/tools/testscript +++ b/tools/testscript @@ -31,8 +31,8 @@ prepare() { mv */stack .;; MSYS*) url=https://www.stackage.org/stack/windows-x86_64 - curl --retry 3 -fsLSo stack.zip "$url" - 7z x -aoa stack.zip stack.exe;; + curl --retry 3 -fsLS "$url" | tar xzf - + mv */stack.exe .;; *) printf >&2 "unknown uname: %s\n" "`uname`" return 1;; From git at git.haskell.org Mon Apr 17 21:34:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:45 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Merge pull request #68 from treeowl/foldmapseq (94fa013) Message-ID: <20170417213445.A27273A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/94fa01318f3a575eb3045956415827b582ac9fb8 >--------------------------------------------------------------- commit 94fa01318f3a575eb3045956415827b582ac9fb8 Merge: c802c36 c4884ad Author: Milan Straka Date: Tue Nov 18 10:31:01 2014 +0100 Merge pull request #68 from treeowl/foldmapseq Improve Foldable methods >--------------------------------------------------------------- 94fa01318f3a575eb3045956415827b582ac9fb8 Data/Sequence.hs | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) From git at git.haskell.org Mon Apr 17 21:34:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:46 +0000 (UTC) Subject: [commit: packages/directory] Mistuke-bump-win32-version-bounds, bgamari-patch-1, master: Rename isSymbolicLink to pathIsSymbolicLink (ccf402c) Message-ID: <20170417213446.191793A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: Mistuke-bump-win32-version-bounds,bgamari-patch-1,master Link : http://ghc.haskell.org/trac/ghc/changeset/ccf402c687eb0a7982507c7451706f2ddaabbab2/directory >--------------------------------------------------------------- commit ccf402c687eb0a7982507c7451706f2ddaabbab2 Author: Phil Ruffwind Date: Tue Nov 29 03:05:59 2016 -0500 Rename isSymbolicLink to pathIsSymbolicLink A step toward fixing #52. >--------------------------------------------------------------- ccf402c687eb0a7982507c7451706f2ddaabbab2 System/Directory.hs | 17 ++++++++++++----- changelog.md | 6 +++++- directory.cabal | 2 +- tests/Main.hs | 4 ++-- tests/{IsSymbolicLink.hs => PathIsSymbolicLink.hs} | 4 ++-- tests/Util.hs | 4 ++-- 6 files changed, 24 insertions(+), 13 deletions(-) diff --git a/System/Directory.hs b/System/Directory.hs index a4f8ba1..9477e55 100644 --- a/System/Directory.hs +++ b/System/Directory.hs @@ -73,7 +73,7 @@ module System.Directory , doesDirectoryExist -- * Symbolic links - , isSymbolicLink + , pathIsSymbolicLink -- * Permissions @@ -101,6 +101,9 @@ module System.Directory , setAccessTime , setModificationTime + -- * Deprecated + , isSymbolicLink + ) where import Control.Exception (bracket, mask, onException) import Control.Monad ( when, unless ) @@ -468,7 +471,7 @@ getDirectoryType path = isDir <- withFileStatus "getDirectoryType" path isDirectory if isDir then do - isLink <- isSymbolicLink path + isLink <- pathIsSymbolicLink path if isLink then return DirectoryLink else return Directory @@ -1489,9 +1492,9 @@ doesFileExist name = -- | Check whether the path refers to a symbolic link. On Windows, this tests -- for @FILE_ATTRIBUTE_REPARSE_POINT at . -- --- @since 1.2.6.0 -isSymbolicLink :: FilePath -> IO Bool -isSymbolicLink path = +-- @since 1.3.0.0 +pathIsSymbolicLink :: FilePath -> IO Bool +pathIsSymbolicLink path = (`ioeSetLocation` "getDirectoryType") `modifyIOError` do #ifdef mingw32_HOST_OS isReparsePoint <$> Win32.getFileAttributes path @@ -1501,6 +1504,10 @@ isSymbolicLink path = Posix.isSymbolicLink <$> Posix.getSymbolicLinkStatus path #endif +{-# DEPRECATED isSymbolicLink "Use pathIsSymbolicLink instead" #-} +isSymbolicLink :: FilePath -> IO Bool +isSymbolicLink = pathIsSymbolicLink + #ifdef mingw32_HOST_OS -- | Open the handle of an existing file or directory. openFileHandle :: String -> Win32.AccessMode -> IO Win32.HANDLE diff --git a/changelog.md b/changelog.md index e2a370b..823f225 100644 --- a/changelog.md +++ b/changelog.md @@ -1,11 +1,15 @@ Changelog for the [`directory`][1] package ========================================== -## 1.3.0.0 (November 2016) +## 1.3.0.0 (December 2016) * Drop trailing slashes in `canonicalizePath` ([#63](https://github.com/haskell/directory/issues/63)) + * Rename `isSymbolicLink` to `pathIsSymbolicLink`. The old name will remain + available but may be removed in the next major release. + ([#52](https://github.com/haskell/directory/issues/52)) + ## 1.2.7.1 (November 2016) * Don't abort `removePathForcibly` if files or directories go missing. diff --git a/directory.cabal b/directory.cabal index 06c4d0d..ef9903c 100644 --- a/directory.cabal +++ b/directory.cabal @@ -95,8 +95,8 @@ test-suite test GetFileSize GetHomeDirectory001 GetPermissions001 - IsSymbolicLink MakeAbsolute + PathIsSymbolicLink RemoveDirectoryRecursive001 RemovePathForcibly RenameDirectory diff --git a/tests/Main.hs b/tests/Main.hs index 6fb34dc..1e17b68 100644 --- a/tests/Main.hs +++ b/tests/Main.hs @@ -17,8 +17,8 @@ import qualified GetDirContents002 import qualified GetFileSize import qualified GetHomeDirectory001 import qualified GetPermissions001 -import qualified IsSymbolicLink import qualified MakeAbsolute +import qualified PathIsSymbolicLink import qualified RemoveDirectoryRecursive001 import qualified RemovePathForcibly import qualified RenameDirectory @@ -47,8 +47,8 @@ main = T.testMain $ \ _t -> do T.isolatedRun _t "GetFileSize" GetFileSize.main T.isolatedRun _t "GetHomeDirectory001" GetHomeDirectory001.main T.isolatedRun _t "GetPermissions001" GetPermissions001.main - T.isolatedRun _t "IsSymbolicLink" IsSymbolicLink.main T.isolatedRun _t "MakeAbsolute" MakeAbsolute.main + T.isolatedRun _t "PathIsSymbolicLink" PathIsSymbolicLink.main T.isolatedRun _t "RemoveDirectoryRecursive001" RemoveDirectoryRecursive001.main T.isolatedRun _t "RemovePathForcibly" RemovePathForcibly.main T.isolatedRun _t "RenameDirectory" RenameDirectory.main diff --git a/tests/IsSymbolicLink.hs b/tests/PathIsSymbolicLink.hs similarity index 87% rename from tests/IsSymbolicLink.hs rename to tests/PathIsSymbolicLink.hs index 3f39e55..ea4fd16 100644 --- a/tests/IsSymbolicLink.hs +++ b/tests/PathIsSymbolicLink.hs @@ -1,5 +1,5 @@ {-# LANGUAGE CPP #-} -module IsSymbolicLink where +module PathIsSymbolicLink where #include "util.inl" import System.Directory import Control.Monad (when) @@ -20,4 +20,4 @@ main _t = do else ioError e #endif when success $ - T(expect) () =<< isSymbolicLink "y" + T(expect) () =<< pathIsSymbolicLink "y" diff --git a/tests/Util.hs b/tests/Util.hs index 8ec2040..453854a 100644 --- a/tests/Util.hs +++ b/tests/Util.hs @@ -17,7 +17,7 @@ import Control.Concurrent.MVar (newEmptyMVar, putMVar, readMVar) import Control.Exception (SomeException, bracket_, mask, onException, try) import Control.Monad (Monad(..), unless, when) import System.Directory (createDirectoryIfMissing, doesDirectoryExist, - isSymbolicLink, listDirectory, makeAbsolute, + pathIsSymbolicLink, listDirectory, makeAbsolute, removePathForcibly, withCurrentDirectory) import System.Environment (getArgs) import System.Exit (exitFailure) @@ -137,7 +137,7 @@ preprocessPathRecursive f path = do dirExists <- doesDirectoryExist path if dirExists then do - isLink <- isSymbolicLink path + isLink <- pathIsSymbolicLink path f path when (not isLink) $ do names <- listDirectory path From git at git.haskell.org Mon Apr 17 21:34:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:47 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Implement fmap/coerce rules (ad24ce6) Message-ID: <20170417213447.B0D493A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/ad24ce6e10d2a0168dcb4d68765b4a25ae22ad88 >--------------------------------------------------------------- commit ad24ce6e10d2a0168dcb4d68765b4a25ae22ad88 Author: David Feuer Date: Thu Nov 13 00:16:28 2014 -0500 Implement fmap/coerce rules Implement fmap/coerce rules for Map, Sequence, and Tree. One concern: unfortunately, implementing the RULES forces the LANGUAGE to be turned from Safe to Trustworthy. This is rather sad. An alternative would be to do this in another module, but orphan rules are not so lovely either. >--------------------------------------------------------------- ad24ce6e10d2a0168dcb4d68765b4a25ae22ad88 Data/Map/Base.hs | 24 +++++++++++++++++------- Data/Map/Strict.hs | 19 ++++++++++++++++++- Data/Sequence.hs | 27 ++++++++++++++++++++------- Data/Tree.hs | 29 ++++++++++++++++++++++------- tests-ghc/all.T | 3 +++ tests-ghc/mapcoercemap.hs | 25 +++++++++++++++++++++++++ tests-ghc/mapcoercemap.stdout | 3 +++ tests-ghc/mapcoerceseq.hs | 25 +++++++++++++++++++++++++ tests-ghc/mapcoerceseq.stdout | 3 +++ tests-ghc/mapcoercesmap.hs | 25 +++++++++++++++++++++++++ tests-ghc/mapcoercesmap.stdout | 3 +++ 11 files changed, 164 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 ad24ce6e10d2a0168dcb4d68765b4a25ae22ad88 From git at git.haskell.org Mon Apr 17 21:34:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:48 +0000 (UTC) Subject: [commit: packages/directory] Mistuke-bump-win32-version-bounds, bgamari-patch-1, master: Create Internal.Prelude module (9c30cfc) Message-ID: <20170417213448.25CC13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: Mistuke-bump-win32-version-bounds,bgamari-patch-1,master Link : http://ghc.haskell.org/trac/ghc/changeset/9c30cfc5b83309cb823042a620c1992059e45d02/directory >--------------------------------------------------------------- commit 9c30cfc5b83309cb823042a620c1992059e45d02 Author: Phil Ruffwind Date: Sun Dec 4 09:22:40 2016 -0500 Create Internal.Prelude module Hopefully this will reduce the amount of boilerplate in each module. The Internal and Internal.Prelude modules are exposed to allow the test suite to use them as well. >--------------------------------------------------------------- 9c30cfc5b83309cb823042a620c1992059e45d02 System/Directory.hs | 62 ++---------- System/Directory/Internal.hs | 1 + System/Directory/Internal/C_utimensat.hsc | 5 +- System/Directory/Internal/Posix.hsc | 6 +- System/Directory/Internal/Prelude.hs | 162 ++++++++++++++++++++++++++++++ System/Directory/Internal/Windows.hsc | 4 +- directory.cabal | 3 +- tests/CanonicalizePath.hs | 1 - tests/CopyFile001.hs | 7 +- tests/CopyFile002.hs | 7 +- tests/CopyFileWithMetadata.hs | 10 +- tests/CreateDirectory001.hs | 2 - tests/CreateDirectoryIfMissing001.hs | 14 +-- tests/CurrentDirectory001.hs | 5 +- tests/Directory001.hs | 1 - tests/DoesDirectoryExist001.hs | 1 - tests/DoesPathExist.hs | 1 - tests/FileTime.hs | 11 +- tests/FindFile001.hs | 3 +- tests/GetDirContents001.hs | 19 ++-- tests/GetDirContents002.hs | 2 - tests/GetFileSize.hs | 8 +- tests/GetHomeDirectory001.hs | 1 - tests/GetPermissions001.hs | 1 - tests/MakeAbsolute.hs | 1 - tests/PathIsSymbolicLink.hs | 5 - tests/RemoveDirectoryRecursive001.hs | 34 +++---- tests/RemovePathForcibly.hs | 34 +++---- tests/RenameDirectory.hs | 1 - tests/RenameFile001.hs | 1 - tests/RenamePath.hs | 1 - tests/T8482.hs | 3 - tests/TestUtils.hs | 15 ++- tests/Util.hs | 48 +++------ tests/WithCurrentDirectory.hs | 7 +- tests/util.inl | 3 + 36 files changed, 267 insertions(+), 223 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 9c30cfc5b83309cb823042a620c1992059e45d02 From git at git.haskell.org Mon Apr 17 21:34:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:49 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Merge pull request #66 from treeowl/seqfmapcoerce (e083f68) Message-ID: <20170417213449.BC0FA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/e083f683d833d6ffd98b7b91f27c1e10a2cded97 >--------------------------------------------------------------- commit e083f683d833d6ffd98b7b91f27c1e10a2cded97 Merge: 94fa013 ad24ce6 Author: Milan Straka Date: Tue Nov 18 14:50:46 2014 +0100 Merge pull request #66 from treeowl/seqfmapcoerce Implement fmap/coerce rules >--------------------------------------------------------------- e083f683d833d6ffd98b7b91f27c1e10a2cded97 Data/Map/Base.hs | 24 +++++++++++++++++------- Data/Map/Strict.hs | 19 ++++++++++++++++++- Data/Sequence.hs | 27 ++++++++++++++++++++------- Data/Tree.hs | 29 ++++++++++++++++++++++------- tests-ghc/all.T | 3 +++ tests-ghc/mapcoercemap.hs | 25 +++++++++++++++++++++++++ tests-ghc/mapcoercemap.stdout | 3 +++ tests-ghc/mapcoerceseq.hs | 25 +++++++++++++++++++++++++ tests-ghc/mapcoerceseq.stdout | 3 +++ tests-ghc/mapcoercesmap.hs | 25 +++++++++++++++++++++++++ tests-ghc/mapcoercesmap.stdout | 3 +++ 11 files changed, 164 insertions(+), 22 deletions(-) diff --cc Data/Sequence.hs index 0c2be04,0bef765..1c4e143 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@@ -187,8 -189,18 +189,19 @@@ instance Functor Seq wher x <$ s = replicate (length s) x #endif + fmapSeq :: (a -> b) -> Seq a -> Seq b + fmapSeq f (Seq xs) = Seq (fmap (fmap f) xs) + #if MIN_VERSION_base(4,8,0) + -- Safe coercions were introduced in 4.7.0, but I am not sure if they played + -- well enough with RULES to do what we want. + {-# NOINLINE [1] fmapSeq #-} + {-# RULES + "fmapSeq/coerce" fmapSeq coerce = coerce + #-} + #endif + instance Foldable Seq where + foldMap f (Seq xs) = foldMap (foldMap f) xs foldr f z (Seq xs) = foldr (flip (foldr f)) z xs foldl f z (Seq xs) = foldl (foldl f) z xs From git at git.haskell.org Mon Apr 17 21:34:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:50 +0000 (UTC) Subject: [commit: packages/directory] Mistuke-bump-win32-version-bounds, bgamari-patch-1, master: Deduce correct alignment in CTimeSpec using hsc2hs (d4b9980) Message-ID: <20170417213450.2ECA43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: Mistuke-bump-win32-version-bounds,bgamari-patch-1,master Link : http://ghc.haskell.org/trac/ghc/changeset/d4b9980ad6d63e7ca7e712d25d861eb9f51a98cf/directory >--------------------------------------------------------------- commit d4b9980ad6d63e7ca7e712d25d861eb9f51a98cf Author: Phil Ruffwind Date: Sun Dec 4 14:17:20 2016 -0500 Deduce correct alignment in CTimeSpec using hsc2hs Can't use #{alignment} because that was only added recently (GHC 8.0), so we have to resort to some trickery. >--------------------------------------------------------------- d4b9980ad6d63e7ca7e712d25d861eb9f51a98cf System/Directory/Internal/C_utimensat.hsc | 8 +++++--- System/Directory/Internal/utility.h | 6 ++++++ directory.cabal | 5 +++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/System/Directory/Internal/C_utimensat.hsc b/System/Directory/Internal/C_utimensat.hsc index 23f844c..f10c659 100644 --- a/System/Directory/Internal/C_utimensat.hsc +++ b/System/Directory/Internal/C_utimensat.hsc @@ -10,6 +10,7 @@ module System.Directory.Internal.C_utimensat where #ifdef HAVE_SYS_STAT_H # include #endif +#include import Prelude () import System.Directory.Internal.Prelude import Data.Time.Clock.POSIX (POSIXTime) @@ -17,10 +18,11 @@ import Data.Time.Clock.POSIX (POSIXTime) data CTimeSpec = CTimeSpec EpochTime CLong instance Storable CTimeSpec where - sizeOf _ = #size struct timespec - alignment _ = alignment (undefined :: CInt) + sizeOf _ = #{size struct timespec} + -- workaround (hsc2hs for GHC < 8.0 doesn't support #{alignment ...}) + alignment _ = #{size char[alignof(struct timespec)] } poke p (CTimeSpec sec nsec) = do - (#poke struct timespec, tv_sec ) p sec + (#poke struct timespec, tv_sec) p sec (#poke struct timespec, tv_nsec) p nsec peek p = do sec <- #{peek struct timespec, tv_sec } p diff --git a/System/Directory/Internal/utility.h b/System/Directory/Internal/utility.h new file mode 100644 index 0000000..cae92a4 --- /dev/null +++ b/System/Directory/Internal/utility.h @@ -0,0 +1,6 @@ +#if !defined alignof && __cplusplus < 201103L +# ifdef STDC_HEADERS +# include +# endif +# define alignof(x) offsetof(struct { char c; x m; }, m) +#endif diff --git a/directory.cabal b/directory.cabal index c1bc655..7200487 100644 --- a/directory.cabal +++ b/directory.cabal @@ -21,12 +21,13 @@ extra-tmp-files: HsDirectoryConfig.h extra-source-files: - changelog.md + HsDirectoryConfig.h.in README.md + System/Directory/Internal/*.h + changelog.md configure configure.ac directory.buildinfo - HsDirectoryConfig.h.in tests/*.hs tests/util.inl From git at git.haskell.org Mon Apr 17 21:34:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:51 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Add fmap/fmap rules (352c73d) Message-ID: <20170417213451.C7D193A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/352c73dca04572fc843417518b9f5dd684c1792c >--------------------------------------------------------------- commit 352c73dca04572fc843417518b9f5dd684c1792c Author: David Feuer Date: Tue Nov 18 09:41:29 2014 -0500 Add fmap/fmap rules Specifically, fuse map, mapWithIndex, mapWithKey, etc., with each other. >--------------------------------------------------------------- 352c73dca04572fc843417518b9f5dd684c1792c Data/IntMap/Base.hs | 19 +++++++++++++++++++ Data/IntMap/Strict.hs | 19 +++++++++++++++++++ Data/Map/Base.hs | 19 ++++++++++++++++++- Data/Map/Strict.hs | 24 +++++++++++++++++++++--- Data/Sequence.hs | 19 ++++++++++++++++++- 5 files changed, 95 insertions(+), 5 deletions(-) diff --git a/Data/IntMap/Base.hs b/Data/IntMap/Base.hs index 007e41e..3832e1c 100644 --- a/Data/IntMap/Base.hs +++ b/Data/IntMap/Base.hs @@ -1301,6 +1301,13 @@ map f t Tip k x -> Tip k (f x) Nil -> Nil +#ifdef __GLASGOW_HASKELL__ +{-# NOINLINE [1] map #-} +{-# RULES +"map/map" forall f g xs . map f (map g xs) = map (f . g) xs + #-} +#endif + -- | /O(n)/. Map a function over all values in the map. -- -- > let f key x = (show key) ++ ":" ++ x @@ -1313,6 +1320,18 @@ mapWithKey f t Tip k x -> Tip k (f k x) Nil -> Nil +#ifdef __GLASGOW_HASKELL__ +{-# NOINLINE [1] mapWithKey #-} +{-# RULES +"mapWithKey/mapWithKey" forall f g xs . mapWithKey f (mapWithKey g xs) = + mapWithKey (\k a -> f k (g k a)) xs +"mapWithKey/map" forall f g xs . mapWithKey f (map g xs) = + mapWithKey (\k a -> f k (g a)) xs +"map/mapWithKey" forall f g xs . map f (mapWithKey g xs) = + mapWithKey (\k a -> f (g k a)) xs + #-} +#endif + -- | /O(n)/. -- @'traverseWithKey' f s == 'fromList' <$> 'traverse' (\(k, v) -> (,) k <$> f k v) ('toList' m)@ -- That is, behaves exactly like a regular 'traverse' except that the traversing diff --git a/Data/IntMap/Strict.hs b/Data/IntMap/Strict.hs index f1c363c..af44b2a 100644 --- a/Data/IntMap/Strict.hs +++ b/Data/IntMap/Strict.hs @@ -718,6 +718,13 @@ map f t Tip k x -> Tip k $! f x Nil -> Nil +#ifdef __GLASGOW_HASKELL__ +{-# NOINLINE [1] map #-} +{-# RULES +"map/map" forall f g xs . map f (map g xs) = map (f . g) xs + #-} +#endif + -- | /O(n)/. Map a function over all values in the map. -- -- > let f key x = (show key) ++ ":" ++ x @@ -730,6 +737,18 @@ mapWithKey f t Tip k x -> Tip k $! f k x Nil -> Nil +#ifdef __GLASGOW_HASKELL__ +{-# NOINLINE [1] mapWithKey #-} +{-# RULES +"mapWithKey/mapWithKey" forall f g xs . mapWithKey f (mapWithKey g xs) = + mapWithKey (\k a -> f k (g k a)) xs +"mapWithKey/map" forall f g xs . mapWithKey f (map g xs) = + mapWithKey (\k a -> f k (g a)) xs +"map/mapWithKey" forall f g xs . map f (mapWithKey g xs) = + mapWithKey (\k a -> f (g k a)) xs + #-} +#endif + -- | /O(n)/. The function @'mapAccum'@ threads an accumulating -- argument through the map in ascending order of keys. -- diff --git a/Data/Map/Base.hs b/Data/Map/Base.hs index 89b851e..3911125 100644 --- a/Data/Map/Base.hs +++ b/Data/Map/Base.hs @@ -1662,10 +1662,15 @@ mapEitherWithKey f0 t0 = toPair $ go f0 t0 map :: (a -> b) -> Map k a -> Map k b map _ Tip = Tip map f (Bin sx kx x l r) = Bin sx kx (f x) (map f l) (map f r) +#ifdef __GLASGOW_HASKELL__ +{-# NOINLINE [1] map #-} +{-# RULES +"map/map" forall f g xs . map f (map g xs) = map (f . g) xs + #-} +#endif #if MIN_VERSION_base(4,8,0) -- Safe coercions were introduced in 4.7.0, but I am not sure if they played -- well enough with RULES to do what we want. -{-# NOINLINE [1] map #-} {-# RULES "map/coerce" map coerce = coerce #-} @@ -1680,6 +1685,18 @@ mapWithKey :: (k -> a -> b) -> Map k a -> Map k b mapWithKey _ Tip = Tip mapWithKey f (Bin sx kx x l r) = Bin sx kx (f kx x) (mapWithKey f l) (mapWithKey f r) +#ifdef __GLASGOW_HASKELL__ +{-# NOINLINE [1] mapWithKey #-} +{-# RULES +"mapWithKey/mapWithKey" forall f g xs . mapWithKey f (mapWithKey g xs) = + mapWithKey (\k a -> f k (g k a)) xs +"mapWithKey/map" forall f g xs . mapWithKey f (map g xs) = + mapWithKey (\k a -> f k (g a)) xs +"map/mapWithKey" forall f g xs . map f (mapWithKey g xs) = + mapWithKey (\k a -> f (g k a)) xs + #-} +#endif + -- | /O(n)/. -- @'traverseWithKey' f s == 'fromList' <$> 'traverse' (\(k, v) -> (,) k <$> f k v) ('toList' m)@ -- That is, behaves exactly like a regular 'traverse' except that the traversing diff --git a/Data/Map/Strict.hs b/Data/Map/Strict.hs index 8c7ea0f..6255e91 100644 --- a/Data/Map/Strict.hs +++ b/Data/Map/Strict.hs @@ -935,10 +935,15 @@ mapEitherWithKey f0 t0 = toPair $ go f0 t0 map :: (a -> b) -> Map k a -> Map k b map _ Tip = Tip map f (Bin sx kx x l r) = let x' = f x in x' `seq` Bin sx kx x' (map f l) (map f r) +#ifdef __GLASGOW_HASKELL__ +{-# NOINLINE [1] map #-} +{-# RULES +"map/map" forall f g xs . map f (map g xs) = map (f . g) xs + #-} +#endif #if MIN_VERSION_base(4,8,0) -- Safe coercions were introduced in 4.7.0, but I am not sure if they played -- well enough with RULES to do what we want. -{-# NOINLINE [1] map #-} {-# RULES "mapSeq/coerce" map coerce = coerce #-} @@ -951,8 +956,21 @@ map f (Bin sx kx x l r) = let x' = f x in x' `seq` Bin sx kx x' (map f l) (map f mapWithKey :: (k -> a -> b) -> Map k a -> Map k b mapWithKey _ Tip = Tip -mapWithKey f (Bin sx kx x l r) = let x' = f kx x - in x' `seq` Bin sx kx x' (mapWithKey f l) (mapWithKey f r) +mapWithKey f (Bin sx kx x l r) = + let x' = f kx x + in x' `seq` Bin sx kx x' (mapWithKey f l) (mapWithKey f r) + +#ifdef __GLASGOW_HASKELL__ +{-# NOINLINE [1] mapWithKey #-} +{-# RULES +"mapWithKey/mapWithKey" forall f g xs . mapWithKey f (mapWithKey g xs) = + mapWithKey (\k a -> f k (g k a)) xs +"mapWithKey/map" forall f g xs . mapWithKey f (map g xs) = + mapWithKey (\k a -> f k (g a)) xs +"map/mapWithKey" forall f g xs . map f (mapWithKey g xs) = + mapWithKey (\k a -> f (g k a)) xs + #-} +#endif -- | /O(n)/. The function 'mapAccum' threads an accumulating -- argument through the map in ascending order of keys. diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 1c4e143..fe59172 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -191,10 +191,15 @@ instance Functor Seq where fmapSeq :: (a -> b) -> Seq a -> Seq b fmapSeq f (Seq xs) = Seq (fmap (fmap f) xs) +#ifdef __GLASGOW_HASKELL__ +{-# NOINLINE [1] fmapSeq #-} +{-# RULES +"fmapSeq/fmapSeq" forall f g xs . fmapSeq f (fmapSeq g xs) = fmapSeq (f . g) xs + #-} +#endif #if MIN_VERSION_base(4,8,0) -- Safe coercions were introduced in 4.7.0, but I am not sure if they played -- well enough with RULES to do what we want. -{-# NOINLINE [1] fmapSeq #-} {-# RULES "fmapSeq/coerce" fmapSeq coerce = coerce #-} @@ -1265,6 +1270,18 @@ adjustDigit f i (Four a b c d) mapWithIndex :: (Int -> a -> b) -> Seq a -> Seq b mapWithIndex f xs = snd (mapAccumL' (\ i x -> (i + 1, f i x)) 0 xs) +#ifdef __GLASGOW_HASKELL__ +{-# NOINLINE [1] mapWithIndex #-} +{-# RULES +"mapWithIndex/mapWithIndex" forall f g xs . mapWithIndex f (mapWithIndex g xs) = + mapWithIndex (\k a -> f k (g k a)) xs +"mapWithIndex/fmapSeq" forall f g xs . mapWithIndex f (fmapSeq g xs) = + mapWithIndex (\k a -> f k (g a)) xs +"fmapSeq/mapWithIndex" forall f g xs . fmapSeq f (mapWithIndex g xs) = + mapWithIndex (\k a -> f (g k a)) xs + #-} +#endif + -- Splitting -- | /O(log(min(i,n-i)))/. The first @i@ elements of a sequence. From git at git.haskell.org Mon Apr 17 21:34:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:52 +0000 (UTC) Subject: [commit: packages/directory] Mistuke-bump-win32-version-bounds, bgamari-patch-1, master: canonicalizePath: Deref file symlinks even if not last segment (c2e17be) Message-ID: <20170417213452.361FC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: Mistuke-bump-win32-version-bounds,bgamari-patch-1,master Link : http://ghc.haskell.org/trac/ghc/changeset/c2e17befd6afc7bcddc460776004b9f602fe1ee4/directory >--------------------------------------------------------------- commit c2e17befd6afc7bcddc460776004b9f602fe1ee4 Author: Phil Ruffwind Date: Tue Dec 6 06:55:02 2016 -0500 canonicalizePath: Deref file symlinks even if not last segment Due to the use of splitPath instead of splitDirectories, this means that if a symbolic link segment in the middle of the path points to a file, doesPathExist will report that it does not exist, thus the symbolic link will not be dereferenced. The behavior is now changed to dereference as much as possible. >--------------------------------------------------------------- c2e17befd6afc7bcddc460776004b9f602fe1ee4 System/Directory.hs | 11 +++++++---- changelog.md | 3 +++ tests/CanonicalizePath.hs | 28 ++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/System/Directory.hs b/System/Directory.hs index 7dc9435..11cd56a 100644 --- a/System/Directory.hs +++ b/System/Directory.hs @@ -994,14 +994,17 @@ copyFileTimesFromStatus st dst = do -- current directory. The function drops trailing path separators where -- possible (via 'dropTrailingPathSeparator'). -- --- /Known bug(s)/: on Windows, the function does not resolve symbolic links --- and the letter case of filenames is not canonicalized. +-- /Known bugs/: When the path contains an existing symbolic link, but the +-- target of the link does not exist, then the path is not dereferenced (bug +-- #64). On Windows, the function does not resolve symbolic links and the +-- letter case of filenames is not canonicalized. -- -- /Changes since 1.2.3.0:/ The function has been altered to be more robust -- and has the same exception behavior as 'makeAbsolute'. -- -- /Changes since 1.3.0.0:/ The function no longer preserves the trailing path --- separator. +-- separator. File symbolic links that appear in the middle of a path are +-- properly dereferenced. -- canonicalizePath :: FilePath -> IO FilePath canonicalizePath = \ path -> @@ -1018,7 +1021,7 @@ canonicalizePath = \ path -> transform path = do encoding <- getFileSystemEncoding realpathPrefix encoding (reverse (zip prefixes suffixes)) path - where segments = splitPath path + where segments = splitDirectories path prefixes = scanl1 () segments suffixes = tail (scanr () "" segments) diff --git a/changelog.md b/changelog.md index 823f225..ba288fa 100644 --- a/changelog.md +++ b/changelog.md @@ -10,6 +10,9 @@ Changelog for the [`directory`][1] package available but may be removed in the next major release. ([#52](https://github.com/haskell/directory/issues/52)) + * Changed `canonicalizePath` to dereference symbolic links even if it points + to a file and is not the last path segment + ## 1.2.7.1 (November 2016) * Don't abort `removePathForcibly` if files or directories go missing. diff --git a/tests/CanonicalizePath.hs b/tests/CanonicalizePath.hs index 895fa49..0f3ea2e 100644 --- a/tests/CanonicalizePath.hs +++ b/tests/CanonicalizePath.hs @@ -2,6 +2,7 @@ module CanonicalizePath where #include "util.inl" import System.FilePath ((), dropTrailingPathSeparator, normalise) +import TestUtils main :: TestEnv -> IO () main _t = do @@ -61,3 +62,30 @@ main _t = do T(expectEq) () fooNon fooNon6 T(expectEq) () fooNon fooNon7 T(expectEq) () fooNon fooNon8 + + supportsSymbolicLinks <- do +#ifdef mingw32_HOST_OS + -- FIXME: canonicalizePath doesn't yet support symlinks on Windows + pure False +#else + pure True +#endif + + when supportsSymbolicLinks $ do + + let barQux = dot "bar" "qux" + + createSymbolicLink "../bar" "foo/bar" + T(expectEq) () bar =<< canonicalizePath "foo/bar" + T(expectEq) () barQux =<< canonicalizePath "foo/bar/qux" + + createSymbolicLink "foo" "lfoo" + T(expectEq) () foo =<< canonicalizePath "lfoo" + T(expectEq) () foo =<< canonicalizePath "lfoo/" + T(expectEq) () bar =<< canonicalizePath "lfoo/bar" + T(expectEq) () barQux =<< canonicalizePath "lfoo/bar/qux" + + -- FIXME: uncomment this test once #64 is fixed + -- createSymbolicLink "../foo/non-existent" "foo/qux" + -- qux <- canonicalizePath "foo/qux" + -- T(expectEq) () qux (dot "../foo/non-existent") From git at git.haskell.org Mon Apr 17 21:34:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:53 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Merge pull request #69 from treeowl/fmapfmap (b2c1c79) Message-ID: <20170417213453.D29D33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/b2c1c79893c4b112d98f82dccb006b7453dc4f21 >--------------------------------------------------------------- commit b2c1c79893c4b112d98f82dccb006b7453dc4f21 Merge: e083f68 352c73d Author: Milan Straka Date: Tue Nov 18 16:44:20 2014 +0100 Merge pull request #69 from treeowl/fmapfmap Add fmap/fmap rules >--------------------------------------------------------------- b2c1c79893c4b112d98f82dccb006b7453dc4f21 Data/IntMap/Base.hs | 19 +++++++++++++++++++ Data/IntMap/Strict.hs | 19 +++++++++++++++++++ Data/Map/Base.hs | 19 ++++++++++++++++++- Data/Map/Strict.hs | 24 +++++++++++++++++++++--- Data/Sequence.hs | 19 ++++++++++++++++++- 5 files changed, 95 insertions(+), 5 deletions(-) From git at git.haskell.org Mon Apr 17 21:34:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:54 +0000 (UTC) Subject: [commit: packages/directory] Mistuke-bump-win32-version-bounds, bgamari-patch-1, master: canonicalizePath: Canonicalize case on Windows (bc1d6b1) Message-ID: <20170417213454.3EBE13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: Mistuke-bump-win32-version-bounds,bgamari-patch-1,master Link : http://ghc.haskell.org/trac/ghc/changeset/bc1d6b17287e93fa7f28228b4ae210eb2a0aa174/directory >--------------------------------------------------------------- commit bc1d6b17287e93fa7f28228b4ae210eb2a0aa174 Author: Phil Ruffwind Date: Tue Nov 29 02:07:45 2016 -0500 canonicalizePath: Canonicalize case on Windows Use GetShortPathName and GetLongPathName to find the correct letter case of the path. This only works on existing paths, so it behaves similar to realpath on POSIX systems and we can therefore reuse the same trick codified in attemptRealpath. >--------------------------------------------------------------- bc1d6b17287e93fa7f28228b4ae210eb2a0aa174 System/Directory.hs | 35 ++++++++++++--------- System/Directory/Internal/Prelude.hs | 6 +++- System/Directory/Internal/Windows.hsc | 58 +++++++++++++++++++++++++++++++++++ changelog.md | 2 ++ tests/CanonicalizePath.hs | 51 +++++++++++++++++++++++++++++- tests/Util.hs | 8 +++++ 6 files changed, 143 insertions(+), 17 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc bc1d6b17287e93fa7f28228b4ae210eb2a0aa174 From git at git.haskell.org Mon Apr 17 21:34:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:55 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Implement map/coerce for IntMap (ee3eb5f) Message-ID: <20170417213455.DD3723A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/ee3eb5f19dbbd193e7c8b991c861f8568c7106d9 >--------------------------------------------------------------- commit ee3eb5f19dbbd193e7c8b991c861f8568c7106d9 Author: David Feuer Date: Tue Nov 18 17:39:18 2014 -0500 Implement map/coerce for IntMap I realized what I was doing with MIN_VERSION was kind of silly. The easy/sane thing to do is really to use __GLASGOW_HASKELL__ for the coercion stuff. >--------------------------------------------------------------- ee3eb5f19dbbd193e7c8b991c861f8568c7106d9 Data/IntMap/Base.hs | 23 +++++++++++++++------- Data/IntMap/Strict.hs | 12 ++++++++--- tests-ghc/all.T | 2 ++ tests-ghc/{mapcoercemap.hs => mapcoerceintmap.hs} | 8 ++++---- ...{mapcoercemap.stdout => mapcoerceintmap.stdout} | 0 .../{mapcoercemap.hs => mapcoerceintmapstrict.hs} | 14 ++++++------- ...emap.stdout => mapcoerceintmapstrict.hs.stdout} | 0 7 files changed, 38 insertions(+), 21 deletions(-) diff --git a/Data/IntMap/Base.hs b/Data/IntMap/Base.hs index 3832e1c..d5fd75a 100644 --- a/Data/IntMap/Base.hs +++ b/Data/IntMap/Base.hs @@ -9,6 +9,13 @@ #if __GLASGOW_HASKELL__ >= 708 {-# LANGUAGE TypeFamilies #-} #endif +-- We use cabal-generated MIN_VERSION_base to adapt to changes of base. +-- Nevertheless, as a convenience, we also allow compiling without cabal by +-- defining trivial MIN_VERSION_base if needed. +#ifndef MIN_VERSION_base +#define MIN_VERSION_base(major1,major2,minor) 0 +#endif + ----------------------------------------------------------------------------- -- | -- Module : Data.IntMap.Base @@ -240,6 +247,9 @@ import qualified GHC.Exts as GHCExts #endif import Text.Read #endif +#if __GLASGOW_HASKELL__ >= 709 +import Data.Coerce +#endif -- Use macros to define strictness of functions. -- STRICT_x_OF_y denotes an y-ary function strict in the x-th parameter. @@ -247,13 +257,6 @@ import Text.Read -- want the compilers to be compiled by as many compilers as possible. #define STRICT_1_OF_2(fn) fn arg _ | arg `seq` False = undefined --- We use cabal-generated MIN_VERSION_base to adapt to changes of base. --- Nevertheless, as a convenience, we also allow compiling without cabal by --- defining trivial MIN_VERSION_base if needed. -#ifndef MIN_VERSION_base -#define MIN_VERSION_base(major1,major2,minor) 0 -#endif - -- A "Nat" is a natural machine word (an unsigned Int) type Nat = Word @@ -1307,6 +1310,12 @@ map f t "map/map" forall f g xs . map f (map g xs) = map (f . g) xs #-} #endif +#if __GLASGOW_HASKELL__ >= 709 +-- Safe coercions were introduced in 7.8, but did not play well with RULES yet. +{-# RULES +"map/coerce" map coerce = coerce + #-} +#endif -- | /O(n)/. Map a function over all values in the map. -- diff --git a/Data/IntMap/Strict.hs b/Data/IntMap/Strict.hs index af44b2a..d7f45f7 100644 --- a/Data/IntMap/Strict.hs +++ b/Data/IntMap/Strict.hs @@ -1,7 +1,5 @@ {-# LANGUAGE CPP #-} -#if !defined(TESTING) && __GLASGOW_HASKELL__ >= 709 -{-# LANGUAGE Safe #-} -#elif !defined(TESTING) && __GLASGOW_HASKELL__ >= 703 +#if !defined(TESTING) && __GLASGOW_HASKELL__ >= 703 {-# LANGUAGE Trustworthy #-} #endif ----------------------------------------------------------------------------- @@ -262,6 +260,9 @@ import qualified Data.IntSet.Base as IntSet import Data.Utils.BitUtil import Data.Utils.StrictFold import Data.Utils.StrictPair +#if __GLASGOW_HASKELL__ >= 709 +import Data.Coerce +#endif -- $strictness -- @@ -724,6 +725,11 @@ map f t "map/map" forall f g xs . map f (map g xs) = map (f . g) xs #-} #endif +#if __GLASGOW_HASKELL__ >= 709 +{-# RULES +"map/coerce" map coerce = coerce + #-} +#endif -- | /O(n)/. Map a function over all values in the map. -- diff --git a/tests-ghc/all.T b/tests-ghc/all.T index 6a8a339..eba1dcc 100644 --- a/tests-ghc/all.T +++ b/tests-ghc/all.T @@ -8,3 +8,5 @@ test('sequence001', normal, compile_and_run, ['-package containers']) test('mapcoerceseq', when(compiler_ge('ghc','7.9')), compile_and_run, ['-package containers']) test('mapcoercemap', when(compiler_ge('ghc','7.9')), compile_and_run, ['-package containers']) test('mapcoercesmap', when(compiler_ge('ghc','7.9')), compile_and_run, ['-package containers']) +test('mapcoerceintmap', when(compiler_ge('ghc','7.9')), compile_and_run, ['-package containers']) +test('mapcoerceintmapstrict', when(compiler_ge('ghc','7.9')), compile_and_run, ['-package containers']) diff --git a/tests-ghc/mapcoercemap.hs b/tests-ghc/mapcoerceintmap.hs similarity index 76% copy from tests-ghc/mapcoercemap.hs copy to tests-ghc/mapcoerceintmap.hs index 6dd336d..ded48c7 100644 --- a/tests-ghc/mapcoercemap.hs +++ b/tests-ghc/mapcoerceintmap.hs @@ -2,15 +2,15 @@ import GHC.Exts hiding (fromList) import Unsafe.Coerce -import Data.Map +import Data.IntMap.Lazy newtype Age = Age Int -fooAge :: Map Int Int -> Map Int Age +fooAge :: IntMap Int -> IntMap Age fooAge = fmap Age -fooCoerce :: Map Int Int -> Map Int Age +fooCoerce :: IntMap Int -> IntMap Age fooCoerce = fmap coerce -fooUnsafeCoerce :: Map Int Int -> Map Int Age +fooUnsafeCoerce :: IntMap Int -> IntMap Age fooUnsafeCoerce = fmap unsafeCoerce same :: a -> b -> IO () diff --git a/tests-ghc/mapcoercemap.stdout b/tests-ghc/mapcoerceintmap.stdout similarity index 100% copy from tests-ghc/mapcoercemap.stdout copy to tests-ghc/mapcoerceintmap.stdout diff --git a/tests-ghc/mapcoercemap.hs b/tests-ghc/mapcoerceintmapstrict.hs similarity index 61% copy from tests-ghc/mapcoercemap.hs copy to tests-ghc/mapcoerceintmapstrict.hs index 6dd336d..2e97004 100644 --- a/tests-ghc/mapcoercemap.hs +++ b/tests-ghc/mapcoerceintmapstrict.hs @@ -2,16 +2,16 @@ import GHC.Exts hiding (fromList) import Unsafe.Coerce -import Data.Map +import Data.IntMap.Strict as IM newtype Age = Age Int -fooAge :: Map Int Int -> Map Int Age -fooAge = fmap Age -fooCoerce :: Map Int Int -> Map Int Age -fooCoerce = fmap coerce -fooUnsafeCoerce :: Map Int Int -> Map Int Age -fooUnsafeCoerce = fmap unsafeCoerce +fooAge :: IntMap Int -> IntMap Age +fooAge = IM.map Age +fooCoerce :: IntMap Int -> IntMap Age +fooCoerce = IM.map coerce +fooUnsafeCoerce :: IntMap Int -> IntMap Age +fooUnsafeCoerce = IM.map unsafeCoerce same :: a -> b -> IO () same x y = case reallyUnsafePtrEquality# (unsafeCoerce x) y of diff --git a/tests-ghc/mapcoercemap.stdout b/tests-ghc/mapcoerceintmapstrict.hs.stdout similarity index 100% copy from tests-ghc/mapcoercemap.stdout copy to tests-ghc/mapcoerceintmapstrict.hs.stdout From git at git.haskell.org Mon Apr 17 21:34:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:57 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Optimize *> and >> for Seq (22ef7de) Message-ID: <20170417213457.E5FD23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/22ef7de71a5de7f9447f3fdcf16fa8f786cb84c0 >--------------------------------------------------------------- commit 22ef7de71a5de7f9447f3fdcf16fa8f786cb84c0 Author: David Feuer Date: Wed Nov 19 15:14:01 2014 -0500 Optimize *> and >> for Seq Based on a discussion with Ross Paterson, use a multiplication- by-doubling algorithm to improve asymptotic time and space performance. >--------------------------------------------------------------- 22ef7de71a5de7f9447f3fdcf16fa8f786cb84c0 Data/Sequence.hs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 1c4e143..2cfa9c7 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -228,11 +228,13 @@ instance Monad Seq where return = singleton xs >>= f = foldl' add empty xs where add ys x = ys >< f x + (>>) = (*>) instance Applicative Seq where pure = singleton fs <*> xs = foldl' add empty fs where add ys f = ys >< fmap f xs + xs *> ys = replicateSeq (length xs) ys instance MonadPlus Seq where mzero = empty @@ -655,6 +657,19 @@ replicateM n x | n >= 0 = unwrapMonad (replicateA n (WrapMonad x)) | otherwise = error "replicateM takes a nonnegative integer argument" +-- | @'replicateSeq' n xs@ concatenates @n@ copies of @xs at . +replicateSeq :: Int -> Seq a -> Seq a +replicateSeq n xs + | n < 0 = error "replicateSeq takes a nonnegative integer argument" + | n == 0 = empty + | otherwise = go n xs + where + -- Invariant: k >= 1 + go 1 xs = xs + go k xs | even k = kxs + | otherwise = xs >< kxs + where kxs = go (k `quot` 2) $! (xs >< xs) + -- | /O(1)/. Add an element to the left end of a sequence. -- Mnemonic: a triangle with the single element at the pointy end. (<|) :: a -> Seq a -> Seq a From git at git.haskell.org Mon Apr 17 21:34:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:56 +0000 (UTC) Subject: [commit: packages/directory] Mistuke-bump-win32-version-bounds, bgamari-patch-1, master: canonicalizePath: Use GetFinalPathName when available (1e8bb7c) Message-ID: <20170417213456.472553A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: Mistuke-bump-win32-version-bounds,bgamari-patch-1,master Link : http://ghc.haskell.org/trac/ghc/changeset/1e8bb7cd81c73cf4d87c9e08d56a0a359874e19b/directory >--------------------------------------------------------------- commit 1e8bb7cd81c73cf4d87c9e08d56a0a359874e19b Author: Phil Ruffwind Date: Tue Nov 29 06:48:57 2016 -0500 canonicalizePath: Use GetFinalPathName when available GetFinalPathName can be used to remove symbolic link indirections in paths. It has been available since Windows Vista. >--------------------------------------------------------------- 1e8bb7cd81c73cf4d87c9e08d56a0a359874e19b System/Directory.hs | 72 +++++++++++++++++++++------------ System/Directory/Internal/Prelude.hs | 8 +++- System/Directory/Internal/Windows.hsc | 76 +++++++++++++++++++++++++++++++++++ changelog.md | 2 + configure.ac | 1 + tests/CanonicalizePath.hs | 23 ++++++++++- tests/TestUtils.hs | 9 +++-- 7 files changed, 160 insertions(+), 31 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 1e8bb7cd81c73cf4d87c9e08d56a0a359874e19b From git at git.haskell.org Mon Apr 17 21:34:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:58 +0000 (UTC) Subject: [commit: packages/directory] Mistuke-bump-win32-version-bounds, bgamari-patch-1, master: Prepend instead of overwrite error locations (65d1d85) Message-ID: <20170417213458.4F9FB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: Mistuke-bump-win32-version-bounds,bgamari-patch-1,master Link : http://ghc.haskell.org/trac/ghc/changeset/65d1d85a3fc3373a425a0298d572da9cd9ee3d86/directory >--------------------------------------------------------------- commit 65d1d85a3fc3373a425a0298d572da9cd9ee3d86 Author: Phil Ruffwind Date: Wed Nov 30 01:28:14 2016 -0500 Prepend instead of overwrite error locations Improve IOError locations by prepending the error location, separated by a colon. >--------------------------------------------------------------- 65d1d85a3fc3373a425a0298d572da9cd9ee3d86 System/Directory.hs | 69 +++++++++++++++++++++++++++++------------------------ changelog.md | 3 +++ 2 files changed, 41 insertions(+), 31 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 65d1d85a3fc3373a425a0298d572da9cd9ee3d86 From git at git.haskell.org Mon Apr 17 21:34:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:34:59 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Merge pull request #71 from treeowl/fmapcoerceintmap (bcebc7a) Message-ID: <20170417213459.EFC373A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/bcebc7af8d347d6229836847cd09ce6971dd6db4 >--------------------------------------------------------------- commit bcebc7af8d347d6229836847cd09ce6971dd6db4 Merge: b2c1c79 ee3eb5f Author: Milan Straka Date: Fri Nov 21 07:56:17 2014 +0100 Merge pull request #71 from treeowl/fmapcoerceintmap Implement map/coerce for IntMap >--------------------------------------------------------------- bcebc7af8d347d6229836847cd09ce6971dd6db4 Data/IntMap/Base.hs | 23 +++++++++++++++------- Data/IntMap/Strict.hs | 12 ++++++++--- tests-ghc/all.T | 2 ++ tests-ghc/{mapcoercemap.hs => mapcoerceintmap.hs} | 8 ++++---- ...{mapcoercemap.stdout => mapcoerceintmap.stdout} | 0 .../{mapcoercemap.hs => mapcoerceintmapstrict.hs} | 14 ++++++------- ...emap.stdout => mapcoerceintmapstrict.hs.stdout} | 0 7 files changed, 38 insertions(+), 21 deletions(-) From git at git.haskell.org Mon Apr 17 21:35:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:00 +0000 (UTC) Subject: [commit: packages/directory] bgamari-patch-1, master: changelog.md: highlight important changes (0fbffe7) Message-ID: <20170417213500.561423A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: bgamari-patch-1,master Link : http://ghc.haskell.org/trac/ghc/changeset/0fbffe7fde6297f14c54ca20f5e3a3376e92231f/directory >--------------------------------------------------------------- commit 0fbffe7fde6297f14c54ca20f5e3a3376e92231f Author: Phil Ruffwind Date: Wed Dec 21 02:24:16 2016 -0500 changelog.md: highlight important changes >--------------------------------------------------------------- 0fbffe7fde6297f14c54ca20f5e3a3376e92231f README.md | 1 + changelog.md | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d56fb37..49803e1 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ [![Windows build status][wi]][wl] Documentation can be found on [Hackage][hl]. +Changes between versions are recorded in the [change log](changelog.md). Building from Git repository ---------------------------- diff --git a/changelog.md b/changelog.md index 296551b..22f93a5 100644 --- a/changelog.md +++ b/changelog.md @@ -3,11 +3,12 @@ Changelog for the [`directory`][1] package ## 1.3.0.0 (December 2016) - * Drop trailing slashes in `canonicalizePath` + * **[breaking]** Drop trailing slashes in `canonicalizePath` ([#63](https://github.com/haskell/directory/issues/63)) - * Rename `isSymbolicLink` to `pathIsSymbolicLink`. The old name will remain - available but may be removed in the next major release. + * **[deprecation]** Rename `isSymbolicLink` to `pathIsSymbolicLink`. The + old name will remain available but may be removed in the next major + release. ([#52](https://github.com/haskell/directory/issues/52)) * Changed `canonicalizePath` to dereference symbolic links even if it points From git at git.haskell.org Mon Apr 17 21:35:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:02 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Merge pull request #72 from treeowl/then (dde7a53) Message-ID: <20170417213502.0655D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/dde7a531b506096ae32b358c2dc83f3edac91ec2 >--------------------------------------------------------------- commit dde7a531b506096ae32b358c2dc83f3edac91ec2 Merge: bcebc7a 22ef7de Author: Milan Straka Date: Fri Nov 21 08:06:03 2014 +0100 Merge pull request #72 from treeowl/then Optimize *> and >> for Seq >--------------------------------------------------------------- dde7a531b506096ae32b358c2dc83f3edac91ec2 Data/Sequence.hs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) From git at git.haskell.org Mon Apr 17 21:35:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:02 +0000 (UTC) Subject: [commit: packages/directory] bgamari-patch-1, master: testscript: Stack on Windows switched back to .zip (8a34b64) Message-ID: <20170417213502.5CE0A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: bgamari-patch-1,master Link : http://ghc.haskell.org/trac/ghc/changeset/8a34b640ff006b5176d7cb50660cef188a888ba3/directory >--------------------------------------------------------------- commit 8a34b640ff006b5176d7cb50660cef188a888ba3 Author: Phil Ruffwind Date: Wed Dec 21 03:40:53 2016 -0500 testscript: Stack on Windows switched back to .zip >--------------------------------------------------------------- 8a34b640ff006b5176d7cb50660cef188a888ba3 tools/testscript | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/testscript b/tools/testscript index 71a3840..95f720e 100755 --- a/tools/testscript +++ b/tools/testscript @@ -31,8 +31,12 @@ prepare() { mv */stack .;; MSYS*) url=https://www.stackage.org/stack/windows-x86_64 - curl --retry 3 -fsLS "$url" | tar xzf - - mv */stack.exe .;; + curl --retry 3 -fsLSo stack.zip "$url" + # download could be either .zip or .tar.gz + 7z x -aoa stack.zip stack.exe || { + tar xzf stack.zip + mv */stack.exe . + };; *) printf >&2 "unknown uname: %s\n" "`uname`" return 1;; From git at git.haskell.org Mon Apr 17 21:35:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:04 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Use GHC version for coercion rules (8da46db) Message-ID: <20170417213504.1073B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/8da46dbc4598062397c6a6b684f7bae9931f3d80 >--------------------------------------------------------------- commit 8da46dbc4598062397c6a6b684f7bae9931f3d80 Author: David Feuer Date: Fri Nov 21 10:14:38 2014 -0500 Use GHC version for coercion rules Using the library version didn't make much sense, especially since the tests-ghc tests had to switch on compiler version anyway, but also because compiling without cabal would prevent the code from being used. The conditional fake MIN_VERSION_base definition should probably stay up top where I moved it, though, in case someone needs to use it to adjust imports or exports in the future--the top seems an inherently better place for that. >--------------------------------------------------------------- 8da46dbc4598062397c6a6b684f7bae9931f3d80 Data/Map/Base.hs | 7 +++---- Data/Map/Strict.hs | 7 +++---- Data/Sequence.hs | 7 +++---- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/Data/Map/Base.hs b/Data/Map/Base.hs index 3911125..e582e16 100644 --- a/Data/Map/Base.hs +++ b/Data/Map/Base.hs @@ -294,7 +294,7 @@ import qualified GHC.Exts as GHCExts import Text.Read import Data.Data #endif -#if MIN_VERSION_base(4,8,0) +#if __GLASGOW_HASKELL__ >= 709 import Data.Coerce #endif @@ -1668,9 +1668,8 @@ map f (Bin sx kx x l r) = Bin sx kx (f x) (map f l) (map f r) "map/map" forall f g xs . map f (map g xs) = map (f . g) xs #-} #endif -#if MIN_VERSION_base(4,8,0) --- Safe coercions were introduced in 4.7.0, but I am not sure if they played --- well enough with RULES to do what we want. +#if __GLASGOW_HASKELL__ >= 709 +-- Safe coercions were introduced in 7.8, but did not work well with RULES yet. {-# RULES "map/coerce" map coerce = coerce #-} diff --git a/Data/Map/Strict.hs b/Data/Map/Strict.hs index 6255e91..88f494e 100644 --- a/Data/Map/Strict.hs +++ b/Data/Map/Strict.hs @@ -279,7 +279,7 @@ import Data.Utils.StrictFold import Data.Utils.StrictPair import Data.Bits (shiftL, shiftR) -#if MIN_VERSION_base(4,8,0) +#if __GLASGOW_HASKELL__ >= 709 import Data.Coerce #endif @@ -941,9 +941,8 @@ map f (Bin sx kx x l r) = let x' = f x in x' `seq` Bin sx kx x' (map f l) (map f "map/map" forall f g xs . map f (map g xs) = map (f . g) xs #-} #endif -#if MIN_VERSION_base(4,8,0) --- Safe coercions were introduced in 4.7.0, but I am not sure if they played --- well enough with RULES to do what we want. +#if __GLASGOW_HASKELL__ >= 709 +-- Safe coercions were introduced in 7.8, but did not work well with RULES yet. {-# RULES "mapSeq/coerce" map coerce = coerce #-} diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 331ac30..4799056 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -165,7 +165,7 @@ import Text.Read (Lexeme(Ident), lexP, parens, prec, readPrec, readListPrec, readListPrecDefault) import Data.Data #endif -#if MIN_VERSION_base(4,8,0) +#if __GLASGOW_HASKELL__ >= 709 import Data.Coerce #endif @@ -197,9 +197,8 @@ fmapSeq f (Seq xs) = Seq (fmap (fmap f) xs) "fmapSeq/fmapSeq" forall f g xs . fmapSeq f (fmapSeq g xs) = fmapSeq (f . g) xs #-} #endif -#if MIN_VERSION_base(4,8,0) --- Safe coercions were introduced in 4.7.0, but I am not sure if they played --- well enough with RULES to do what we want. +#if __GLASGOW_HASKELL__ >= 709 +-- Safe coercions were introduced in 7.8, but did not work well with RULES yet. {-# RULES "fmapSeq/coerce" fmapSeq coerce = coerce #-} From git at git.haskell.org Mon Apr 17 21:35:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:04 +0000 (UTC) Subject: [commit: packages/directory] bgamari-patch-1, master: Add dependencies status to README (5c45693) Message-ID: <20170417213504.635613A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: bgamari-patch-1,master Link : http://ghc.haskell.org/trac/ghc/changeset/5c45693521e7ab94e638c507e2b05029d2c48b7f/directory >--------------------------------------------------------------- commit 5c45693521e7ab94e638c507e2b05029d2c48b7f Author: Phil Ruffwind Date: Sun Dec 25 00:28:47 2016 -0500 Add dependencies status to README >--------------------------------------------------------------- 5c45693521e7ab94e638c507e2b05029d2c48b7f README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 49803e1..10c1120 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ [![Hackage][hi]][hl] [![Build status][bi]][bl] [![Windows build status][wi]][wl] +[![Dependencies status][di]][dl] Documentation can be found on [Hackage][hl]. Changes between versions are recorded in the [change log](changelog.md). @@ -27,4 +28,6 @@ configure` does that automatically. [bl]: https://travis-ci.org/haskell/directory [wi]: https://ci.appveyor.com/api/projects/status/github/haskell/directory?branch=master&svg=true [wl]: https://ci.appveyor.com/project/hvr/directory +[di]: https://img.shields.io/hackage-deps/v/directory.svg +[dl]: http://packdeps.haskellers.com/feed?needle=directory [ac]: https://gnu.org/software/autoconf From git at git.haskell.org Mon Apr 17 21:35:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:06 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Merge pull request #75 from treeowl/coerce-version (ddf12fd) Message-ID: <20170417213506.196B93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/ddf12fd51a0611cba8250bdbde9fdcbb66211b1d >--------------------------------------------------------------- commit ddf12fd51a0611cba8250bdbde9fdcbb66211b1d Merge: dde7a53 8da46db Author: Milan Straka Date: Fri Nov 21 18:50:11 2014 +0100 Merge pull request #75 from treeowl/coerce-version Use GHC version for coercion rules >--------------------------------------------------------------- ddf12fd51a0611cba8250bdbde9fdcbb66211b1d Data/Map/Base.hs | 7 +++---- Data/Map/Strict.hs | 7 +++---- Data/Sequence.hs | 7 +++---- 3 files changed, 9 insertions(+), 12 deletions(-) From git at git.haskell.org Mon Apr 17 21:35:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:06 +0000 (UTC) Subject: [commit: packages/directory] Mistuke-bump-win32-version-bounds: Win32: bump to 2.6 (9b60f34) Message-ID: <20170417213506.6A9233A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : Mistuke-bump-win32-version-bounds Link : http://ghc.haskell.org/trac/ghc/changeset/9b60f34f60d8f6af4bdd20015beb5a35356f12d5/directory >--------------------------------------------------------------- commit 9b60f34f60d8f6af4bdd20015beb5a35356f12d5 Author: Tamar Christina Date: Tue Jan 17 23:12:05 2017 +0000 Win32: bump to 2.6 >--------------------------------------------------------------- 9b60f34f60d8f6af4bdd20015beb5a35356f12d5 directory.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/directory.cabal b/directory.cabal index 7200487..7640aaf 100644 --- a/directory.cabal +++ b/directory.cabal @@ -58,7 +58,7 @@ Library time >= 1.4 && < 1.8, filepath >= 1.3 && < 1.5 if os(windows) - build-depends: Win32 >= 2.2.2 && < 2.5 + build-depends: Win32 >= 2.2.2 && < 2.6 else build-depends: unix >= 2.5.1 && < 2.8 From git at git.haskell.org Mon Apr 17 21:35:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:07 +0000 (UTC) Subject: [commit: packages/filepath] branch 'bgamari-patch-1' created Message-ID: <20170417213507.B9AF33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/filepath New branch : bgamari-patch-1 Referencing: 004ff903e0cfaa1a89c59b0ca76cd832a2f40bbb From git at git.haskell.org Mon Apr 17 21:35:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:08 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Use Data.Functor.Identity (bd7b470) Message-ID: <20170417213508.22BB93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/bd7b470abda94c486c784fd7d6c69dd91e0ae2be >--------------------------------------------------------------- commit bd7b470abda94c486c784fd7d6c69dd91e0ae2be Author: David Feuer Date: Fri Nov 21 11:25:58 2014 -0500 Use Data.Functor.Identity This has just entered base, and includes some optimizations that may or may not be relevant. For older versions, don't bother making Identity a Monad instance--it's not exported, and that instance is never used. Make applicativeTree slightly more readable. >--------------------------------------------------------------- bd7b470abda94c486c784fd7d6c69dd91e0ae2be Data/Sequence.hs | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 4799056..4e37dbf 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -168,6 +168,9 @@ import Data.Data #if __GLASGOW_HASKELL__ >= 709 import Data.Coerce #endif +#if MIN_VERSION_base(4,8,0) +import Data.Functor.Identity (Identity(..)) +#endif infixr 5 `consTree` @@ -554,19 +557,16 @@ instance NFData a => NFData (Elem a) where ------------------------------------------------------- -- Applicative construction ------------------------------------------------------- +#if !MIN_VERSION_base(4,8,0) +newtype Identity a = Identity {runIdentity :: a} -newtype Id a = Id {runId :: a} - -instance Functor Id where - fmap f (Id x) = Id (f x) - -instance Monad Id where - return = Id - m >>= k = k (runId m) +instance Functor Identity where + fmap f (Identity x) = Identity (f x) -instance Applicative Id where - pure = return - (<*>) = ap +instance Applicative Identity where + pure = Identity + Identity f <*> Identity x = Identity (f x) +#endif -- | This is essentially a clone of Control.Monad.State.Strict. newtype State s a = State {runState :: s -> (s, a)} @@ -598,13 +598,13 @@ mapAccumL' f s t = runState (traverse (State . flip f) t) s -- specified. This is a generalization of 'replicateA', which itself -- is a generalization of many Data.Sequence methods. {-# SPECIALIZE applicativeTree :: Int -> Int -> State s a -> State s (FingerTree a) #-} -{-# SPECIALIZE applicativeTree :: Int -> Int -> Id a -> Id (FingerTree a) #-} --- Special note: the Id specialization automatically does node sharing, +{-# SPECIALIZE applicativeTree :: Int -> Int -> Identity a -> Identity (FingerTree a) #-} +-- Special note: the Identity specialization automatically does node sharing, -- reducing memory usage of the resulting tree to /O(log n)/. applicativeTree :: Applicative f => Int -> Int -> f a -> f (FingerTree a) applicativeTree n mSize m = mSize `seq` case n of 0 -> pure Empty - 1 -> liftA Single m + 1 -> fmap Single m 2 -> deepA one emptyTree one 3 -> deepA two emptyTree one 4 -> deepA two emptyTree two @@ -612,12 +612,12 @@ applicativeTree n mSize m = mSize `seq` case n of 6 -> deepA three emptyTree three 7 -> deepA four emptyTree three 8 -> deepA four emptyTree four - _ -> let (q, r) = n `quotRem` 3 in q `seq` case r of - 0 -> deepA three (applicativeTree (q - 2) mSize' n3) three - 1 -> deepA four (applicativeTree (q - 2) mSize' n3) three - _ -> deepA four (applicativeTree (q - 2) mSize' n3) four + _ -> case n `quotRem` 3 of + (q,0) -> deepA three (applicativeTree (q - 2) mSize' n3) three + (q,1) -> deepA four (applicativeTree (q - 2) mSize' n3) three + (q,_) -> deepA four (applicativeTree (q - 2) mSize' n3) four where - one = liftA One m + one = fmap One m two = liftA2 Two m m three = liftA3 Three m m m four = liftA3 Four m m m <*> m @@ -641,7 +641,7 @@ singleton x = Seq (Single (Elem x)) -- | /O(log n)/. @replicate n x@ is a sequence consisting of @n@ copies of @x at . replicate :: Int -> a -> Seq a replicate n x - | n >= 0 = runId (replicateA n (Id x)) + | n >= 0 = runIdentity (replicateA n (Identity x)) | otherwise = error "replicate takes a nonnegative integer argument" -- | 'replicateA' is an 'Applicative' version of 'replicate', and makes From git at git.haskell.org Mon Apr 17 21:35:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:08 +0000 (UTC) Subject: [commit: packages/directory] bgamari-patch-1, master: Win32: bump to 2.6 (ee807bc) Message-ID: <20170417213508.70A113A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: bgamari-patch-1,master Link : http://ghc.haskell.org/trac/ghc/changeset/ee807bcfd483a219df14904ccba5cafbffaf1404/directory >--------------------------------------------------------------- commit ee807bcfd483a219df14904ccba5cafbffaf1404 Author: Tamar Christina Date: Tue Jan 17 23:12:05 2017 +0000 Win32: bump to 2.6 >--------------------------------------------------------------- ee807bcfd483a219df14904ccba5cafbffaf1404 directory.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/directory.cabal b/directory.cabal index 7200487..7640aaf 100644 --- a/directory.cabal +++ b/directory.cabal @@ -58,7 +58,7 @@ Library time >= 1.4 && < 1.8, filepath >= 1.3 && < 1.5 if os(windows) - build-depends: Win32 >= 2.2.2 && < 2.5 + build-depends: Win32 >= 2.2.2 && < 2.6 else build-depends: unix >= 2.5.1 && < 2.8 From git at git.haskell.org Mon Apr 17 21:35:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:09 +0000 (UTC) Subject: [commit: packages/filepath] tag 'v1.4.1.1' created Message-ID: <20170417213509.BA91A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/filepath New tag : v1.4.1.1 Referencing: c69e5e62484ca279689a863df07a9a916537b21d From git at git.haskell.org Mon Apr 17 21:35:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:10 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Merge pull request #76 from treeowl/identity (c138008) Message-ID: <20170417213510.2C75E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/c1380089319e24ce1373b6cd0a027f7447b45d32 >--------------------------------------------------------------- commit c1380089319e24ce1373b6cd0a027f7447b45d32 Merge: ddf12fd bd7b470 Author: Milan Straka Date: Fri Nov 21 19:56:10 2014 +0100 Merge pull request #76 from treeowl/identity Use Data.Functor.Identity >--------------------------------------------------------------- c1380089319e24ce1373b6cd0a027f7447b45d32 Data/Sequence.hs | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) From git at git.haskell.org Mon Apr 17 21:35:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:10 +0000 (UTC) Subject: [commit: packages/directory] bgamari-patch-1, master: Update changelog for previous commit (83e0f2f) Message-ID: <20170417213510.77C303A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branches: bgamari-patch-1,master Link : http://ghc.haskell.org/trac/ghc/changeset/83e0f2f6163cbeabf079bf70ff57958bffe22a7e/directory >--------------------------------------------------------------- commit 83e0f2f6163cbeabf079bf70ff57958bffe22a7e Author: Phil Ruffwind Date: Wed Jan 18 18:46:23 2017 -0500 Update changelog for previous commit >--------------------------------------------------------------- 83e0f2f6163cbeabf079bf70ff57958bffe22a7e changelog.md | 5 +++++ directory.cabal | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 22f93a5..44cc261 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,11 @@ Changelog for the [`directory`][1] package ========================================== +## 1.3.0.1 (January 2017) + + * Relax Win32 version bounds to support 2.6. + ([#67](https://github.com/haskell/directory/pull/67)) + ## 1.3.0.0 (December 2016) * **[breaking]** Drop trailing slashes in `canonicalizePath` diff --git a/directory.cabal b/directory.cabal index 7640aaf..ce79c32 100644 --- a/directory.cabal +++ b/directory.cabal @@ -1,5 +1,5 @@ name: directory -version: 1.3.0.0 +version: 1.3.0.1 -- NOTE: Don't forget to update ./changelog.md license: BSD3 license-file: LICENSE From git at git.haskell.org Mon Apr 17 21:35:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:11 +0000 (UTC) Subject: [commit: packages/filepath] bgamari-patch-1, master: Update the copyright year (48b0768) Message-ID: <20170417213511.C20EF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/filepath On branches: bgamari-patch-1,master Link : http://git.haskell.org/packages/filepath.git/commitdiff/48b0768279cb5693e7291453b7acc95917928e29 >--------------------------------------------------------------- commit 48b0768279cb5693e7291453b7acc95917928e29 Author: Neil Mitchell Date: Sun Sep 18 06:10:02 2016 +0100 Update the copyright year >--------------------------------------------------------------- 48b0768279cb5693e7291453b7acc95917928e29 LICENSE | 2 +- filepath.cabal | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/LICENSE b/LICENSE index 86a4451..29e1408 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright Neil Mitchell 2005-2015. +Copyright Neil Mitchell 2005-2016. All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/filepath.cabal b/filepath.cabal index 5d4e771..499de88 100644 --- a/filepath.cabal +++ b/filepath.cabal @@ -5,7 +5,7 @@ license: BSD3 license-file: LICENSE author: Neil Mitchell maintainer: Neil Mitchell -copyright: Neil Mitchell 2005-2015 +copyright: Neil Mitchell 2005-2016 bug-reports: https://github.com/haskell/filepath/issues homepage: https://github.com/haskell/filepath#readme category: System From git at git.haskell.org Mon Apr 17 21:35:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:12 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Make index middle-lazy (aedfe3f) Message-ID: <20170417213512.3621E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/aedfe3f327f781484ec6fb4718156919791c4979 >--------------------------------------------------------------- commit aedfe3f327f781484ec6fb4718156919791c4979 Author: David Feuer Date: Sun Nov 23 15:36:39 2014 -0500 Make index middle-lazy `index` should not descend the finger tree spine unless it needs to. >--------------------------------------------------------------- aedfe3f327f781484ec6fb4718156919791c4979 Data/Sequence.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 4e37dbf..511cad9 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -1159,14 +1159,14 @@ data Place a = Place {-# UNPACK #-} !Int a lookupTree :: Sized a => Int -> FingerTree a -> Place a lookupTree _ Empty = error "lookupTree of empty tree" lookupTree i (Single x) = Place i x -lookupTree i (Deep _ pr m sf) +lookupTree i (Deep totalSize pr m sf) | i < spr = lookupDigit i pr | i < spm = case lookupTree (i - spr) m of Place i' xs -> lookupNode i' xs | otherwise = lookupDigit (i - spm) sf where spr = size pr - spm = spr + size m + spm = totalSize - size sf {-# SPECIALIZE lookupNode :: Int -> Node (Elem a) -> Place (Elem a) #-} {-# SPECIALIZE lookupNode :: Int -> Node (Node a) -> Place (Node a) #-} From git at git.haskell.org Mon Apr 17 21:35:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:12 +0000 (UTC) Subject: [commit: packages/directory] master: changelog.md: 2.5, not 2.6 (4a4a19d) Message-ID: <20170417213512.7D9843A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4a4a19d1c46c70ffd9a3e1c4c283e2e16214258f/directory >--------------------------------------------------------------- commit 4a4a19d1c46c70ffd9a3e1c4c283e2e16214258f Author: Phil Ruffwind Date: Wed Jan 18 19:04:12 2017 -0500 changelog.md: 2.5, not 2.6 >--------------------------------------------------------------- 4a4a19d1c46c70ffd9a3e1c4c283e2e16214258f changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 44cc261..9d32573 100644 --- a/changelog.md +++ b/changelog.md @@ -3,7 +3,7 @@ Changelog for the [`directory`][1] package ## 1.3.0.1 (January 2017) - * Relax Win32 version bounds to support 2.6. + * Relax Win32 version bounds to support 2.5. ([#67](https://github.com/haskell/directory/pull/67)) ## 1.3.0.0 (December 2016) From git at git.haskell.org Mon Apr 17 21:35:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:13 +0000 (UTC) Subject: [commit: packages/filepath] bgamari-patch-1, master: Include GHC 8.0 on the test matrix (709c4af) Message-ID: <20170417213513.C7E183A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/filepath On branches: bgamari-patch-1,master Link : http://git.haskell.org/packages/filepath.git/commitdiff/709c4afcfcc8bd665801224e71b30042da6265bb >--------------------------------------------------------------- commit 709c4afcfcc8bd665801224e71b30042da6265bb Author: Neil Mitchell Date: Sun Sep 18 06:10:15 2016 +0100 Include GHC 8.0 on the test matrix >--------------------------------------------------------------- 709c4afcfcc8bd665801224e71b30042da6265bb .travis.yml | 4 ++-- filepath.cabal | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 20d31e0..6519f1e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,9 @@ env: - - GHCVER=7.2.2 - GHCVER=7.4.2 - GHCVER=7.6.3 - GHCVER=7.8.4 - - GHCVER=7.10.1 + - GHCVER=7.10.3 + - GHCVER=8.0.1 - GHCVER=head matrix: diff --git a/filepath.cabal b/filepath.cabal index 499de88..41ec208 100644 --- a/filepath.cabal +++ b/filepath.cabal @@ -12,7 +12,7 @@ category: System build-type: Simple synopsis: Library for manipulating FilePaths in a cross platform way. cabal-version: >=1.10 -tested-with: GHC==7.10.1, GHC==7.8.4, GHC==7.6.3, GHC==7.4.2, GHC==7.2.2 +tested-with: GHC==8.0.1, GHC==7.10.3, GHC==7.8.4, GHC==7.6.3, GHC==7.4.2 description: This package provides functionality for manipulating @FilePath@ values, and is shipped with both and the . It provides three modules: . From git at git.haskell.org Mon Apr 17 21:35:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:14 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Merge pull request #80 from treeowl/fix-index (e1e75b8) Message-ID: <20170417213514.3E5833A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/e1e75b83e3f4bd4bf4031d01d3cec56428c2be33 >--------------------------------------------------------------- commit e1e75b83e3f4bd4bf4031d01d3cec56428c2be33 Merge: c138008 aedfe3f Author: Milan Straka Date: Sun Nov 23 23:05:14 2014 +0100 Merge pull request #80 from treeowl/fix-index Make index middle-lazy >--------------------------------------------------------------- e1e75b83e3f4bd4bf4031d01d3cec56428c2be33 Data/Sequence.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) From git at git.haskell.org Mon Apr 17 21:35:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:14 +0000 (UTC) Subject: [commit: packages/directory] bgamari-patch-1: Bump upper bound to allow time 1.8 (5b3cd94) Message-ID: <20170417213514.83DDD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : bgamari-patch-1 Link : http://ghc.haskell.org/trac/ghc/changeset/5b3cd946b1d1b2cca57ad49f8ed8e76877dff2f9/directory >--------------------------------------------------------------- commit 5b3cd946b1d1b2cca57ad49f8ed8e76877dff2f9 Author: Ben Gamari Date: Thu Jan 19 16:18:47 2017 -0500 Bump upper bound to allow time 1.8 >--------------------------------------------------------------- 5b3cd946b1d1b2cca57ad49f8ed8e76877dff2f9 directory.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/directory.cabal b/directory.cabal index ce79c32..74f2b4d 100644 --- a/directory.cabal +++ b/directory.cabal @@ -55,7 +55,7 @@ Library build-depends: base >= 4.5 && < 4.11, - time >= 1.4 && < 1.8, + time >= 1.4 && < 1.9, filepath >= 1.3 && < 1.5 if os(windows) build-depends: Win32 >= 2.2.2 && < 2.6 From git at git.haskell.org Mon Apr 17 21:35:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:15 +0000 (UTC) Subject: [commit: packages/filepath] bgamari-patch-1, master: Require cabal 1.18 for extra-doc-files (07b334b) Message-ID: <20170417213515.CD6823A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/filepath On branches: bgamari-patch-1,master Link : http://git.haskell.org/packages/filepath.git/commitdiff/07b334b406a45057a80e821e72c4b973117caae9 >--------------------------------------------------------------- commit 07b334b406a45057a80e821e72c4b973117caae9 Author: Neil Mitchell Date: Sun Sep 18 06:10:35 2016 +0100 Require cabal 1.18 for extra-doc-files >--------------------------------------------------------------- 07b334b406a45057a80e821e72c4b973117caae9 filepath.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/filepath.cabal b/filepath.cabal index 41ec208..dc62dfd 100644 --- a/filepath.cabal +++ b/filepath.cabal @@ -11,7 +11,7 @@ homepage: https://github.com/haskell/filepath#readme category: System build-type: Simple synopsis: Library for manipulating FilePaths in a cross platform way. -cabal-version: >=1.10 +cabal-version: >=1.18 tested-with: GHC==8.0.1, GHC==7.10.3, GHC==7.8.4, GHC==7.6.3, GHC==7.4.2 description: This package provides functionality for manipulating @FilePath@ values, and is shipped with both and the . It provides three modules: From git at git.haskell.org Mon Apr 17 21:35:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:16 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Add an IsList instance for Data.Sequence.Seq (1931ecf) Message-ID: <20170417213516.46AED3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/1931ecf7da3d4e4ead4bd1ef5f5ed07807893339 >--------------------------------------------------------------- commit 1931ecf7da3d4e4ead4bd1ef5f5ed07807893339 Author: David Feuer Date: Wed Dec 3 17:16:39 2014 -0500 Add an IsList instance for Data.Sequence.Seq >--------------------------------------------------------------- 1931ecf7da3d4e4ead4bd1ef5f5ed07807893339 Data/Sequence.hs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 511cad9..757f677 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -5,6 +5,9 @@ #if __GLASGOW_HASKELL__ >= 703 {-# LANGUAGE Trustworthy #-} #endif +#if __GLASGOW_HASKELL__ >= 708 +{-# LANGUAGE TypeFamilies #-} +#endif -- We use cabal-generated MIN_VERSION_base to adapt to changes of base. -- Nevertheless, as a convenience, we also allow compiling without cabal by -- defining trivial MIN_VERSION_base if needed. @@ -171,7 +174,9 @@ import Data.Coerce #if MIN_VERSION_base(4,8,0) import Data.Functor.Identity (Identity(..)) #endif - +#if __GLASGOW_HASKELL__ >= 708 +import qualified GHC.Exts +#endif infixr 5 `consTree` infixl 5 `snocTree` @@ -1655,6 +1660,13 @@ findIndicesR p xs = foldlWithIndex g [] xs fromList :: [a] -> Seq a fromList = Data.List.foldl' (|>) empty +#if __GLASGOW_HASKELL__ >= 708 +instance GHC.Exts.IsList (Seq a) where + type Item (Seq a) = a + fromList = fromList + toList = toList +#endif + ------------------------------------------------------------------------ -- Reverse ------------------------------------------------------------------------ From git at git.haskell.org Mon Apr 17 21:35:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:16 +0000 (UTC) Subject: [commit: packages/directory] master: Reduce system call overhead of `copyFile` by increasing the buffer size to 128 KiB. (51a0f72) Message-ID: <20170417213516.8B94C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/51a0f72dc2dbed33d9ce47d9d5073973cd9a0d2a/directory >--------------------------------------------------------------- commit 51a0f72dc2dbed33d9ce47d9d5073973cd9a0d2a Author: Niklas Hambüchen Date: Wed Feb 8 04:03:27 2017 +0100 Reduce system call overhead of `copyFile` by increasing the buffer size to 128 KiB. 128 KiB is what coreutils `cp` uses, based on a benchmark provided here: http://git.savannah.gnu.org/cgit/coreutils.git/tree/src/ioblksize.h?id=c0a79542fb5c2c22cf0a250db94af6f8581ca342#n23 The benchmarks report speedups of factor 5x to 30x depending on the hardware. >--------------------------------------------------------------- 51a0f72dc2dbed33d9ce47d9d5073973cd9a0d2a System/Directory.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/System/Directory.hs b/System/Directory.hs index be98632..7829ecf 100644 --- a/System/Directory.hs +++ b/System/Directory.hs @@ -896,7 +896,7 @@ copyHandleData hFrom hTo = (`ioeAddLocation` "copyData") `modifyIOError` do allocaBytes bufferSize go where - bufferSize = 1024 + bufferSize = 131072 -- 128 KiB, as coreutils `cp` uses as of May 2014 (see ioblksize.h) go buffer = do count <- hGetBuf hFrom buffer bufferSize when (count > 0) $ do From git at git.haskell.org Mon Apr 17 21:35:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:17 +0000 (UTC) Subject: [commit: packages/filepath] bgamari-patch-1, master: Reset the Cabal version to 1.10, so as not to unnecessarily burden people (a2fbd61) Message-ID: <20170417213517.D35423A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/filepath On branches: bgamari-patch-1,master Link : http://git.haskell.org/packages/filepath.git/commitdiff/a2fbd618c209e530ec9470f6d083a781f52e8543 >--------------------------------------------------------------- commit a2fbd618c209e530ec9470f6d083a781f52e8543 Author: Neil Mitchell Date: Sun Sep 25 21:32:30 2016 +0100 Reset the Cabal version to 1.10, so as not to unnecessarily burden people >--------------------------------------------------------------- a2fbd618c209e530ec9470f6d083a781f52e8543 filepath.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/filepath.cabal b/filepath.cabal index dc62dfd..41ec208 100644 --- a/filepath.cabal +++ b/filepath.cabal @@ -11,7 +11,7 @@ homepage: https://github.com/haskell/filepath#readme category: System build-type: Simple synopsis: Library for manipulating FilePaths in a cross platform way. -cabal-version: >=1.18 +cabal-version: >=1.10 tested-with: GHC==8.0.1, GHC==7.10.3, GHC==7.8.4, GHC==7.6.3, GHC==7.4.2 description: This package provides functionality for manipulating @FilePath@ values, and is shipped with both and the . It provides three modules: From git at git.haskell.org Mon Apr 17 21:35:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:18 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Merge pull request #85 from treeowl/islist (cd5a854) Message-ID: <20170417213518.4F38E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/cd5a854691c34dbea4a7fddd166095b7d2f0b3e0 >--------------------------------------------------------------- commit cd5a854691c34dbea4a7fddd166095b7d2f0b3e0 Merge: e1e75b8 1931ecf Author: Milan Straka Date: Thu Dec 4 10:01:51 2014 +0100 Merge pull request #85 from treeowl/islist Add an IsList instance for Data.Sequence.Seq >--------------------------------------------------------------- cd5a854691c34dbea4a7fddd166095b7d2f0b3e0 Data/Sequence.hs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) From git at git.haskell.org Mon Apr 17 21:35:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:18 +0000 (UTC) Subject: [commit: packages/directory] master: Warn about effects of removePathForcibly on hard links (30d5e2d) Message-ID: <20170417213518.933F93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/30d5e2ddac84a008d914b278dcbc11077c7240ed/directory >--------------------------------------------------------------- commit 30d5e2ddac84a008d914b278dcbc11077c7240ed Author: Phil Ruffwind Date: Thu Jan 19 18:18:30 2017 -0500 Warn about effects of removePathForcibly on hard links >--------------------------------------------------------------- 30d5e2ddac84a008d914b278dcbc11077c7240ed System/Directory.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/System/Directory.hs b/System/Directory.hs index 7829ecf..f4475c4 100644 --- a/System/Directory.hs +++ b/System/Directory.hs @@ -530,7 +530,8 @@ removeContentsRecursive path = -- Unlike other removal functions, this function will also attempt to delete -- files marked as read-only or otherwise made unremovable due to permissions. -- As a result, if the removal is incomplete, the permissions or attributes on --- the remaining files may be altered. +-- the remaining files may be altered. If there are hard links in the +-- directory, then permissions on all related hard links may be altered. -- -- If an entry within the directory vanishes while @removePathForcibly@ is -- running, it is silently ignored. From git at git.haskell.org Mon Apr 17 21:35:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:19 +0000 (UTC) Subject: [commit: packages/filepath] bgamari-patch-1, master: Allow QuickCheck-2.9 (267802e) Message-ID: <20170417213519.D944B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/filepath On branches: bgamari-patch-1,master Link : http://git.haskell.org/packages/filepath.git/commitdiff/267802e86284bb256266638f21c4c4ecaf7d1480 >--------------------------------------------------------------- commit 267802e86284bb256266638f21c4c4ecaf7d1480 Author: Neil Mitchell Date: Sun Sep 25 21:32:49 2016 +0100 Allow QuickCheck-2.9 >--------------------------------------------------------------- 267802e86284bb256266638f21c4c4ecaf7d1480 changelog.md | 2 ++ filepath.cabal | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 074905f..eeee736 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,8 @@ _Note: below all `FilePath` values are unquoted, so `\\` really means two backslashes._ + * Allow QuickCheck-2.9 + ## 1.4.1.0 *Dec 2015* * Bundled with GHC 8.0.1 diff --git a/filepath.cabal b/filepath.cabal index 41ec208..097fc29 100644 --- a/filepath.cabal +++ b/filepath.cabal @@ -64,4 +64,4 @@ test-suite filepath-tests build-depends: filepath, base, - QuickCheck >= 2.7 && < 2.9 + QuickCheck >= 2.7 && < 2.10 From git at git.haskell.org Mon Apr 17 21:35:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:20 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Make version-appropriate Foldable imports (39e9ee9) Message-ID: <20170417213520.58DEF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/39e9ee9992269eb2ad3a9b7e608457c6d1a92b04 >--------------------------------------------------------------- commit 39e9ee9992269eb2ad3a9b7e608457c6d1a92b04 Author: David Feuer Date: Thu Dec 4 10:59:22 2014 -0500 Make version-appropriate Foldable imports foldl' and foldr' moved into the Foldable class, then toList. This gets rid of a warning about the imports. >--------------------------------------------------------------- 39e9ee9992269eb2ad3a9b7e608457c6d1a92b04 Data/Sequence.hs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 511cad9..88faf62 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -155,7 +155,15 @@ import Control.DeepSeq (NFData(rnf)) import Control.Monad (MonadPlus(..), ap) import Data.Monoid (Monoid(..)) import Data.Functor (Functor(..)) +#if MIN_VERSION_base(4,8,0) +import Data.Foldable (Foldable(foldl, foldl1, foldr, foldr1, foldMap, foldl', foldr', toList)) +#else +#if MIN_VERSION_base(4,6,0) +import Data.Foldable (Foldable(foldl, foldl1, foldr, foldr1, foldMap, foldl', foldr'), toList) +#else import Data.Foldable (Foldable(foldl, foldl1, foldr, foldr1, foldMap), foldl', foldr', toList) +#endif +#endif import Data.Traversable import Data.Typeable From git at git.haskell.org Mon Apr 17 21:35:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:20 +0000 (UTC) Subject: [commit: packages/directory] master: Update changelog for #69 (56de0b3) Message-ID: <20170417213520.99AE33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/56de0b3cee76bf9f7e9b7184409656ec0cd0db02/directory >--------------------------------------------------------------- commit 56de0b3cee76bf9f7e9b7184409656ec0cd0db02 Author: Phil Ruffwind Date: Thu Feb 9 21:35:56 2017 -0500 Update changelog for #69 >--------------------------------------------------------------- 56de0b3cee76bf9f7e9b7184409656ec0cd0db02 changelog.md | 5 +++++ directory.cabal | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 9d32573..f696f4f 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,11 @@ Changelog for the [`directory`][1] package ========================================== +## 1.3.0.2 (February 2017) + + * [optimization] Increase internal buffer size of `copyFile` + ([#69](https://github.com/haskell/directory/pull/69)) + ## 1.3.0.1 (January 2017) * Relax Win32 version bounds to support 2.5. diff --git a/directory.cabal b/directory.cabal index ce79c32..5b0b183 100644 --- a/directory.cabal +++ b/directory.cabal @@ -1,5 +1,5 @@ name: directory -version: 1.3.0.1 +version: 1.3.0.2 -- NOTE: Don't forget to update ./changelog.md license: BSD3 license-file: LICENSE From git at git.haskell.org Mon Apr 17 21:35:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:22 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Merge pull request #86 from treeowl/foldableimports (f22d14b) Message-ID: <20170417213522.64ACC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/f22d14b56e2c70d6525436a178912c7010bd5169 >--------------------------------------------------------------- commit f22d14b56e2c70d6525436a178912c7010bd5169 Merge: cd5a854 39e9ee9 Author: Milan Straka Date: Fri Dec 5 07:12:40 2014 +0100 Merge pull request #86 from treeowl/foldableimports Make version-appropriate Foldable imports >--------------------------------------------------------------- f22d14b56e2c70d6525436a178912c7010bd5169 Data/Sequence.hs | 8 ++++++++ 1 file changed, 8 insertions(+) From git at git.haskell.org Mon Apr 17 21:35:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:21 +0000 (UTC) Subject: [commit: packages/filepath] bgamari-patch-1, master: Move the cabal-version to the top of the file, feels safest (fb553fe) Message-ID: <20170417213521.DF2053A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/filepath On branches: bgamari-patch-1,master Link : http://git.haskell.org/packages/filepath.git/commitdiff/fb553fe912639913a83619947bc60819f39bd711 >--------------------------------------------------------------- commit fb553fe912639913a83619947bc60819f39bd711 Author: Neil Mitchell Date: Sun Sep 25 21:34:19 2016 +0100 Move the cabal-version to the top of the file, feels safest >--------------------------------------------------------------- fb553fe912639913a83619947bc60819f39bd711 filepath.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/filepath.cabal b/filepath.cabal index 097fc29..e097c07 100644 --- a/filepath.cabal +++ b/filepath.cabal @@ -1,3 +1,4 @@ +cabal-version: >= 1.10 name: filepath version: 1.4.1.0 -- NOTE: Don't forget to update ./changelog.md @@ -11,7 +12,6 @@ homepage: https://github.com/haskell/filepath#readme category: System build-type: Simple synopsis: Library for manipulating FilePaths in a cross platform way. -cabal-version: >=1.10 tested-with: GHC==8.0.1, GHC==7.10.3, GHC==7.8.4, GHC==7.6.3, GHC==7.4.2 description: This package provides functionality for manipulating @FilePath@ values, and is shipped with both and the . It provides three modules: From git at git.haskell.org Mon Apr 17 21:35:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:22 +0000 (UTC) Subject: [commit: packages/directory] master: Support time-1.8 (af307f5) Message-ID: <20170417213522.A037C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/af307f52ca94ed232d1372fc6760a4b3efa243c7/directory >--------------------------------------------------------------- commit af307f52ca94ed232d1372fc6760a4b3efa243c7 Author: Phil Ruffwind Date: Wed Feb 15 02:13:29 2017 -0500 Support time-1.8 >--------------------------------------------------------------- af307f52ca94ed232d1372fc6760a4b3efa243c7 changelog.md | 4 +++- directory.cabal | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index f696f4f..50ba956 100644 --- a/changelog.md +++ b/changelog.md @@ -6,9 +6,11 @@ Changelog for the [`directory`][1] package * [optimization] Increase internal buffer size of `copyFile` ([#69](https://github.com/haskell/directory/pull/69)) + * Relax `time` version bounds to support 1.8. + ## 1.3.0.1 (January 2017) - * Relax Win32 version bounds to support 2.5. + * Relax `Win32` version bounds to support 2.5. ([#67](https://github.com/haskell/directory/pull/67)) ## 1.3.0.0 (December 2016) diff --git a/directory.cabal b/directory.cabal index 5b0b183..84d36fe 100644 --- a/directory.cabal +++ b/directory.cabal @@ -55,7 +55,7 @@ Library build-depends: base >= 4.5 && < 4.11, - time >= 1.4 && < 1.8, + time >= 1.4 && < 1.9, filepath >= 1.3 && < 1.5 if os(windows) build-depends: Win32 >= 2.2.2 && < 2.6 From git at git.haskell.org Mon Apr 17 21:35:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:23 +0000 (UTC) Subject: [commit: packages/filepath] bgamari-patch-1, master: Switch to default-language: 2010 (e2dba71) Message-ID: <20170417213523.E589F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/filepath On branches: bgamari-patch-1,master Link : http://git.haskell.org/packages/filepath.git/commitdiff/e2dba717b8056baa356600c173fb7aa608a9c40f >--------------------------------------------------------------- commit e2dba717b8056baa356600c173fb7aa608a9c40f Author: Neil Mitchell Date: Sun Sep 25 21:35:21 2016 +0100 Switch to default-language: 2010 >--------------------------------------------------------------- e2dba717b8056baa356600c173fb7aa608a9c40f filepath.cabal | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/filepath.cabal b/filepath.cabal index e097c07..aff6526 100644 --- a/filepath.cabal +++ b/filepath.cabal @@ -35,7 +35,7 @@ source-repository head location: https://github.com/haskell/filepath.git library - default-language: Haskell98 + default-language: Haskell2010 other-extensions: CPP PatternGuards @@ -54,7 +54,7 @@ library test-suite filepath-tests type: exitcode-stdio-1.0 - default-language: Haskell98 + default-language: Haskell2010 main-is: Test.hs ghc-options: -main-is Test hs-source-dirs: tests From git at git.haskell.org Mon Apr 17 21:35:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:24 +0000 (UTC) Subject: [commit: packages/containers] zip-devel: Nix the Splittable class; add fromFunction (4abaee4) Message-ID: <20170417213524.6EEA03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branch : zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/4abaee4c2edadc13413a78848c6eea0558ec06c8 >--------------------------------------------------------------- commit 4abaee4c2edadc13413a78848c6eea0558ec06c8 Author: David Feuer Date: Sat Dec 6 00:23:44 2014 -0500 Nix the Splittable class; add fromFunction Also export splitTraverse, and write mapWithIndex using a hand-unboxed mapWithIndex#. >--------------------------------------------------------------- 4abaee4c2edadc13413a78848c6eea0558ec06c8 Data/Sequence.hs | 220 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 142 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 4abaee4c2edadc13413a78848c6eea0558ec06c8 From git at git.haskell.org Mon Apr 17 21:35:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:24 +0000 (UTC) Subject: [commit: packages/directory] master: findFile et al: ignore dirs when abs path is given (1adba7a) Message-ID: <20170417213524.A8CDF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1adba7a37c448f0275e92c21c69916b0ac2c0bc4/directory >--------------------------------------------------------------- commit 1adba7a37c448f0275e92c21c69916b0ac2c0bc4 Author: Phil Ruffwind Date: Tue Feb 28 01:22:41 2017 -0500 findFile et al: ignore dirs when abs path is given When an absolute path is given, the list of search directories is now completely ignored by findFile. Previously, if the list was empty, findFile would always fail regardless of whether the absolute path was found. This behavior extends to similar functions as well. Fixes #72. >--------------------------------------------------------------- 1adba7a37c448f0275e92c21c69916b0ac2c0bc4 System/Directory.hs | 193 ++++++++++++++++++++++++++++++++------------------- changelog.md | 7 ++ directory.cabal | 2 +- tests/FindFile001.hs | 45 +++++++++++- 4 files changed, 174 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 1adba7a37c448f0275e92c21c69916b0ac2c0bc4 From git at git.haskell.org Mon Apr 17 21:35:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:25 +0000 (UTC) Subject: [commit: packages/filepath] bgamari-patch-1, master: Avoid the redundant Test which just wraps a Property (cd72f48) Message-ID: <20170417213525.ED9853A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/filepath On branches: bgamari-patch-1,master Link : http://git.haskell.org/packages/filepath.git/commitdiff/cd72f48869052c01d23d801feac2bd111253a7b2 >--------------------------------------------------------------- commit cd72f48869052c01d23d801feac2bd111253a7b2 Author: Neil Mitchell Date: Mon Nov 14 21:28:53 2016 +0000 Avoid the redundant Test which just wraps a Property >--------------------------------------------------------------- cd72f48869052c01d23d801feac2bd111253a7b2 Generate.hs | 4 +- tests/TestGen.hs | 878 +++++++++++++++++++++++++++--------------------------- tests/TestUtil.hs | 11 - 3 files changed, 441 insertions(+), 452 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc cd72f48869052c01d23d801feac2bd111253a7b2 From git at git.haskell.org Mon Apr 17 21:35:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:26 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Add comments explaining the splitting traversal (c0e8c7d) Message-ID: <20170417213526.779DD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/c0e8c7d9e135527a188c5a932cab1e96c11c1de5 >--------------------------------------------------------------- commit c0e8c7d9e135527a188c5a932cab1e96c11c1de5 Author: David Feuer Date: Thu Dec 4 11:50:20 2014 -0500 Add comments explaining the splitting traversal Why it's a good idea, how it works, and what the benchmarks say. >--------------------------------------------------------------- c0e8c7d9e135527a188c5a932cab1e96c11c1de5 Data/Sequence.hs | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 9955584..212c926 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -128,6 +128,7 @@ module Data.Sequence ( foldlWithIndex, -- :: (b -> Int -> a -> b) -> b -> Seq a -> b foldrWithIndex, -- :: (Int -> a -> b -> b) -> b -> Seq a -> b -- * Transformations + genSplitTraverseSeq, mapWithIndex, -- :: (Int -> a -> b) -> Seq a -> Seq b reverse, -- :: Seq a -> Seq a -- ** Zips @@ -1709,7 +1710,7 @@ reverseNode f (Node3 s a b c) = Node3 s (f c) (f b) (f a) -- For zipping, and probably also for (<*>), it is useful to build a result by -- traversing a sequence while splitting up something else. For zipping, we -- traverse the first sequence while splitting up the second [and third [and --- fourth]]. For fs <*> xs, we expect soon to traverse +-- fourth]]. For fs <*> xs, we hope to traverse -- -- > replicate (length fs * length xs) () -- @@ -1717,6 +1718,51 @@ reverseNode f (Node3 s a b c) = Node3 s (f c) (f b) (f a) -- -- > fmap (\f -> fmap f xs) fs -- +-- What makes all this crazy code a good idea: +-- +-- Suppose we zip together two sequences of the same length: +-- +-- zs = zip xs ys +-- +-- We want to get reasonably fast indexing into zs immediately, rather than +-- needing to construct the entire thing first, as the previous implementation +-- required. The first aspect is that we build the result "outside-in" or +-- "top-down", rather than left to right. That gives us access to both ends +-- quickly. But that's not enough, by itself, to give immediate access to the +-- center of zs. For that, we need to be able to skip over larger segments of +-- zs, delaying their construction until we actually need them. The way we do +-- this is to traverse xs, while splitting up ys according to the structure of +-- xs. If we have a Deep _ pr m sf, we split ys into three pieces, and hand off +-- one piece to the prefix, one to the middle, and one to the suffix of the +-- result. The key point is that we don't need to actually do anything further +-- with those pieces until we actually need them; the computations to split +-- them up further and zip them with their matching pieces can be delayed until +-- they're actually needed. We do the same thing for Digits (splitting into +-- between one and four pieces) and Nodes (splitting into two or three). The +-- ultimate result is that we can index, or split at, any location in zs in +-- O(log(min{i,n-i})) time *immediately*, with only a constant-factor slowdown +-- as thunks are forced along the path. +-- +-- Benchmark info, and alternatives: +-- +-- The old zipping code used mapAccumL to traverse the first sequence while +-- cutting down the second sequence one piece at a time. +-- +-- An alternative way to express that basic idea is to convert both sequences +-- to lists, zip the lists, and then convert the result back to a sequence. +-- I'll call this the "listy" implementation. +-- +-- I benchmarked two operations: Each started by zipping two sequences +-- constructed with replicate and/or fromList. The first would then immediately +-- index into the result. The second would apply deepseq to force the entire +-- result. The new implementation worked much better than either of the others +-- on the immediate indexing test, as expected. It also worked better than the +-- old implementation for all the deepseq tests. For short sequences, the listy +-- implementation outperformed all the others on the deepseq test. However, the +-- splitting implementation caught up and surpassed it once the sequences grew +-- long enough. It seems likely that by avoiding rebuilding, it interacts +-- better with the cache hierarchy. +-- -- David Feuer, with excellent guidance from Carter Schonwald, December 2014 class Splittable s where @@ -1731,6 +1777,16 @@ instance (Splittable a, Splittable b) => Splittable (a, b) where (al, ar) = splitState i a (bl, br) = splitState i b +data GenSplittable s = GenSplittable s (Int -> s -> (s,s)) +instance Splittable (GenSplittable s) where + splitState i (GenSplittable s spl) = (GenSplittable l spl, GenSplittable r spl) + where + (l,r) = spl i s + +{-# INLINE genSplitTraverseSeq #-} +genSplitTraverseSeq :: (Int -> s -> (s, s)) -> (s -> a -> b) -> s -> Seq a -> Seq b +genSplitTraverseSeq spl f s = splitTraverseSeq (\(GenSplittable s _) -> f s) (GenSplittable s spl) + {-# SPECIALIZE splitTraverseSeq :: (Seq x -> a -> b) -> Seq x -> Seq a -> Seq b #-} {-# SPECIALIZE splitTraverseSeq :: ((Seq x, Seq y) -> a -> b) -> (Seq x, Seq y) -> Seq a -> Seq b #-} splitTraverseSeq :: (Splittable s) => (s -> a -> b) -> s -> Seq a -> Seq b From git at git.haskell.org Mon Apr 17 21:35:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:26 +0000 (UTC) Subject: [commit: packages/directory] master: Make internal modules visible (4f9c05a) Message-ID: <20170417213526.B03BC3A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4f9c05a6a50a028f2a3c9ee61eaa61b6dd20140f/directory >--------------------------------------------------------------- commit 4f9c05a6a50a028f2a3c9ee61eaa61b6dd20140f Author: Phil Ruffwind Date: Tue Feb 28 04:30:43 2017 -0500 Make internal modules visible Some of them were already available (as required by tests), but they had their documentation hidden. Hackage insists on showing the module names anyway. There's not really anything to hide here: the only reason they are internal is because they have no API stability guarantees, so may as well just make everything public. The only exception is Config because there is nothing useful in there and the presence of exeExtension may mislead users into thinking that it's not available in the public API. There is a blank line in C_utimensat and Posix. They are needed because hsc's {-# LINE ... #-} pragmas break the Haddock documentation. >--------------------------------------------------------------- 4f9c05a6a50a028f2a3c9ee61eaa61b6dd20140f System/Directory.hs | 8 ++++++++ System/Directory/Internal.hs | 22 +++++++++++++--------- System/Directory/Internal/C_utimensat.hsc | 9 +++++++++ System/Directory/Internal/Config.hs | 4 ---- System/Directory/Internal/Posix.hsc | 9 +++++++++ System/Directory/Internal/Prelude.hs | 13 ++++++++++--- System/Directory/Internal/Windows.hsc | 8 ++++++++ directory.cabal | 6 +++--- 8 files changed, 60 insertions(+), 19 deletions(-) diff --git a/System/Directory.hs b/System/Directory.hs index c0a2a45..3d895c8 100644 --- a/System/Directory.hs +++ b/System/Directory.hs @@ -115,6 +115,7 @@ import Data.Time.Clock.POSIX , utcTimeToPOSIXSeconds , POSIXTime ) +import qualified System.Directory.Internal.Config as Cfg #ifdef mingw32_HOST_OS import qualified System.Win32 as Win32 #else @@ -1293,6 +1294,13 @@ findFilesWithLazy f dirs path then return (Just (p, ListT (find ds))) else find ds +-- | Filename extension for executable files (including the dot if any) +-- (usually @\"\"@ on POSIX systems and @\".exe\"@ on Windows or OS\/2). +-- +-- @since 1.2.4.0 +exeExtension :: String +exeExtension = Cfg.exeExtension + -- | Similar to 'listDirectory', but always includes the special entries (@.@ -- and @..@). (This applies to Windows as well.) -- diff --git a/System/Directory/Internal.hs b/System/Directory/Internal.hs index 0ce6aca..b9cc4cf 100644 --- a/System/Directory/Internal.hs +++ b/System/Directory/Internal.hs @@ -1,22 +1,26 @@ {-# LANGUAGE CPP #-} -{-# OPTIONS_HADDOCK hide #-} +-- | +-- Stability: unstable +-- Portability: unportable +-- +-- Internal modules are always subject to change from version to version. + #include module System.Directory.Internal - ( module System.Directory.Internal.Config - -#ifdef HAVE_UTIMENSAT - , module System.Directory.Internal.C_utimensat -#endif + ( #ifdef mingw32_HOST_OS - , module System.Directory.Internal.Windows + module System.Directory.Internal.Windows #else - , module System.Directory.Internal.Posix + module System.Directory.Internal.Posix +#endif + +#ifdef HAVE_UTIMENSAT + , module System.Directory.Internal.C_utimensat #endif ) where -import System.Directory.Internal.Config #ifdef HAVE_UTIMENSAT import System.Directory.Internal.C_utimensat diff --git a/System/Directory/Internal/C_utimensat.hsc b/System/Directory/Internal/C_utimensat.hsc index f10c659..0d20e84 100644 --- a/System/Directory/Internal/C_utimensat.hsc +++ b/System/Directory/Internal/C_utimensat.hsc @@ -1,3 +1,12 @@ + +-- | +-- Stability: unstable +-- Portability: unportable +-- +-- Internal modules are always subject to change from version to version. +-- Since this is a platform-specific module, the contents shown in the Hackage +-- documentation may differ from what is actually available on your system. + module System.Directory.Internal.C_utimensat where #include #ifdef HAVE_UTIMENSAT diff --git a/System/Directory/Internal/Config.hs b/System/Directory/Internal/Config.hs index 5cc1b3e..54d1064 100644 --- a/System/Directory/Internal/Config.hs +++ b/System/Directory/Internal/Config.hs @@ -2,10 +2,6 @@ #include module System.Directory.Internal.Config where --- | Filename extension for executable files (including the dot if any) --- (usually @\"\"@ on POSIX systems and @\".exe\"@ on Windows or OS\/2). --- --- @since 1.2.4.0 exeExtension :: String exeExtension = EXE_EXTENSION -- We avoid using #const_str from hsc because it breaks cross-compilation diff --git a/System/Directory/Internal/Posix.hsc b/System/Directory/Internal/Posix.hsc index 669e5c0..15f1f86 100644 --- a/System/Directory/Internal/Posix.hsc +++ b/System/Directory/Internal/Posix.hsc @@ -1,3 +1,12 @@ + +-- | +-- Stability: unstable +-- Portability: unportable +-- +-- Internal modules are always subject to change from version to version. +-- Since this is a platform-specific module, the contents shown in the Hackage +-- documentation may differ from what is actually available on your system. + module System.Directory.Internal.Posix where #include #ifndef mingw32_HOST_OS diff --git a/System/Directory/Internal/Prelude.hs b/System/Directory/Internal/Prelude.hs index 7f77851..8d28e3e 100644 --- a/System/Directory/Internal/Prelude.hs +++ b/System/Directory/Internal/Prelude.hs @@ -1,10 +1,18 @@ {-# LANGUAGE CPP #-} -{-# OPTIONS_HADDOCK hide #-} +-- | +-- Stability: unstable +-- Portability: unportable +-- +-- Internal modules are always subject to change from version to version. + module System.Directory.Internal.Prelude ( module Prelude -#if !MIN_VERSION_base(4, 8, 0) +#if MIN_VERSION_base(4, 8, 0) + , module Data.Void +#else , module Control.Applicative , module Data.Functor + , Void #endif , module Control.Arrow , module Control.Concurrent @@ -29,7 +37,6 @@ module System.Directory.Internal.Prelude , module System.Posix.Internals , module System.Posix.Types , module System.Timeout - , Void ) where #if !MIN_VERSION_base(4, 6, 0) import Prelude hiding (catch) diff --git a/System/Directory/Internal/Windows.hsc b/System/Directory/Internal/Windows.hsc index 63d88f8..2f53264 100644 --- a/System/Directory/Internal/Windows.hsc +++ b/System/Directory/Internal/Windows.hsc @@ -1,4 +1,12 @@ {-# LANGUAGE CPP #-} +-- | +-- Stability: unstable +-- Portability: unportable +-- +-- Internal modules are always subject to change from version to version. +-- Since this is a platform-specific module, the contents shown in the Hackage +-- documentation may differ from what is actually available on your system. + module System.Directory.Internal.Windows where #include #ifdef mingw32_HOST_OS diff --git a/directory.cabal b/directory.cabal index f5d8d7e..886fb0b 100644 --- a/directory.cabal +++ b/directory.cabal @@ -44,12 +44,12 @@ Library exposed-modules: System.Directory System.Directory.Internal - System.Directory.Internal.Prelude - other-modules: - System.Directory.Internal.Config System.Directory.Internal.C_utimensat System.Directory.Internal.Posix + System.Directory.Internal.Prelude System.Directory.Internal.Windows + other-modules: + System.Directory.Internal.Config include-dirs: . From git at git.haskell.org Mon Apr 17 21:35:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:27 +0000 (UTC) Subject: [commit: packages/filepath] bgamari-patch-1, master: #54, document the behaviour of <.> with an empty extension (52cb8fd) Message-ID: <20170417213528.003AD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/filepath On branches: bgamari-patch-1,master Link : http://git.haskell.org/packages/filepath.git/commitdiff/52cb8fd3003fa1c91324ced300d865f6168c6f4f >--------------------------------------------------------------- commit 52cb8fd3003fa1c91324ced300d865f6168c6f4f Author: Neil Mitchell Date: Mon Nov 14 21:29:34 2016 +0000 #54, document the behaviour of <.> with an empty extension >--------------------------------------------------------------- 52cb8fd3003fa1c91324ced300d865f6168c6f4f System/FilePath/Internal.hs | 1 + changelog.md | 2 ++ tests/TestGen.hs | 2 ++ 3 files changed, 5 insertions(+) diff --git a/System/FilePath/Internal.hs b/System/FilePath/Internal.hs index df4b39c..4a376b3 100644 --- a/System/FilePath/Internal.hs +++ b/System/FilePath/Internal.hs @@ -292,6 +292,7 @@ dropExtension = fst . splitExtension -- > addExtension "file." ".bib" == "file..bib" -- > addExtension "file" ".bib" == "file.bib" -- > addExtension "/" "x" == "/.x" +-- > addExtension x "" == x -- > Valid x => takeFileName (addExtension (addTrailingPathSeparator x) "ext") == ".ext" -- > Windows: addExtension "\\\\share" ".txt" == "\\\\share\\.txt" addExtension :: FilePath -> String -> FilePath diff --git a/changelog.md b/changelog.md index eeee736..038f72e 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,8 @@ _Note: below all `FilePath` values are unquoted, so `\\` really means two backslashes._ + * Documentation improvements + * Allow QuickCheck-2.9 ## 1.4.1.0 *Dec 2015* diff --git a/tests/TestGen.hs b/tests/TestGen.hs index e01a55d..848ae5b 100755 --- a/tests/TestGen.hs +++ b/tests/TestGen.hs @@ -96,6 +96,8 @@ tests = ,("W.addExtension \"file\" \".bib\" == \"file.bib\"", property $ W.addExtension "file" ".bib" == "file.bib") ,("P.addExtension \"/\" \"x\" == \"/.x\"", property $ P.addExtension "/" "x" == "/.x") ,("W.addExtension \"/\" \"x\" == \"/.x\"", property $ W.addExtension "/" "x" == "/.x") + ,("P.addExtension x \"\" == x", property $ \(QFilePath x) -> P.addExtension x "" == x) + ,("W.addExtension x \"\" == x", property $ \(QFilePath x) -> W.addExtension x "" == x) ,("P.takeFileName (P.addExtension (P.addTrailingPathSeparator x) \"ext\") == \".ext\"", property $ \(QFilePathValidP x) -> P.takeFileName (P.addExtension (P.addTrailingPathSeparator x) "ext") == ".ext") ,("W.takeFileName (W.addExtension (W.addTrailingPathSeparator x) \"ext\") == \".ext\"", property $ \(QFilePathValidW x) -> W.takeFileName (W.addExtension (W.addTrailingPathSeparator x) "ext") == ".ext") ,("W.addExtension \"\\\\\\\\share\" \".txt\" == \"\\\\\\\\share\\\\.txt\"", property $ W.addExtension "\\\\share" ".txt" == "\\\\share\\.txt") From git at git.haskell.org Mon Apr 17 21:35:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:28 +0000 (UTC) Subject: [commit: packages/directory] master: Implement readSymbolicLink for Windows (8bf22f3) Message-ID: <20170417213528.BA0783A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8bf22f381041d86c338ee000dd04b1b5d8031950/directory >--------------------------------------------------------------- commit 8bf22f381041d86c338ee000dd04b1b5d8031950 Author: Phil Ruffwind Date: Wed Nov 30 13:56:55 2016 -0500 Implement readSymbolicLink for Windows >--------------------------------------------------------------- 8bf22f381041d86c338ee000dd04b1b5d8031950 System/Directory/Internal/Prelude.hs | 2 + System/Directory/Internal/Windows.hsc | 143 ++++++++++++++++++++++++++++++++++ System/Directory/Internal/windows.h | 29 +++++++ 3 files changed, 174 insertions(+) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 8bf22f381041d86c338ee000dd04b1b5d8031950 From git at git.haskell.org Mon Apr 17 21:35:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:28 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Make zipWith faster (31e1234) Message-ID: <20170417213528.80A263A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/31e1234435ae734bbf3d33a79e9cce89d06ac738 >--------------------------------------------------------------- commit 31e1234435ae734bbf3d33a79e9cce89d06ac738 Author: David Feuer Date: Tue Dec 2 17:09:49 2014 -0500 Make zipWith faster Make `zipWith` build its result with the structure of its first argument, splitting up its second argument as it goes. This allows fast random access to the elements of the results immediately, without having to build large portions of the structure. It also seems to be slightly faster than the old implementation when the entire result is used, presumably by avoiding rebalancing costs. I believe most of this code will also help implement a fast `(<*>)`. Use the same approach to implement `zipWith3` and `zipWith4`. Clean up a couple warnings. Many thanks to Carter Schonwald for suggesting that I use the structure of the first sequence to structure the result, and for helping me come up with the splitTraverse approach. Benchmarks: Zipping two 100000 element lists and extracting the 50000th element takes about 11.4ms with the new implementation, as opposed to 88ms with the old. Zipping two 10000 element sequences and forcing the result to normal form takes 4.0ms now rather than 19.7ms. The indexing gains show up for even very short sequences, but the new implementation really starts to look good once the size gets to around 1000--presumably it handles cache effects better than the old one. Note that the naive approach of converting sequences to lists, zipping them, and then converting back, actually works very well for forcing short sequences to normal form, even better than the new implementation. But it starts to lose a lot of ground by the time the size gets to around 10000, and its performance on the indexing tests is bad. >--------------------------------------------------------------- 31e1234435ae734bbf3d33a79e9cce89d06ac738 Data/Sequence.hs | 106 +++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 92 insertions(+), 14 deletions(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index b54f1e6..10d3a92 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -676,10 +676,10 @@ replicateM n x -- | @'replicateSeq' n xs@ concatenates @n@ copies of @xs at . replicateSeq :: Int -> Seq a -> Seq a -replicateSeq n xs +replicateSeq n s | n < 0 = error "replicateSeq takes a nonnegative integer argument" | n == 0 = empty - | otherwise = go n xs + | otherwise = go n s where -- Invariant: k >= 1 go 1 xs = xs @@ -1703,6 +1703,75 @@ reverseNode f (Node2 s a b) = Node2 s (f b) (f a) reverseNode f (Node3 s a b c) = Node3 s (f c) (f b) (f a) ------------------------------------------------------------------------ +-- Traversing with splittable "state" +------------------------------------------------------------------------ + +-- For zipping, and probably also for (<*>), it is useful to build a result by +-- traversing a sequence while splitting up something else. For zipping, we +-- traverse the first sequence while splitting up the second [and third [and +-- fourth]]. For fs <*> xs, we expect soon to traverse +-- +-- > replicate (length fs * length xs) () +-- +-- while splitting something essentially equivalent to +-- +-- > fmap (\f -> fmap f xs) fs +-- +-- David Feuer, with excellent guidance from Carter Schonwald, December 2014 + +class Splittable s where + splitState :: Int -> s -> (s,s) + +instance Splittable (Seq a) where + splitState = splitAt + +instance (Splittable a, Splittable b) => Splittable (a, b) where + splitState i (a, b) = ((al, bl), (ar, br)) + where + (al, ar) = splitState i a + (bl, br) = splitState i b + +splitTraverseSeq :: (Splittable s) => (s -> a -> b) -> s -> Seq a -> Seq b +splitTraverseSeq f s (Seq xs) = Seq $ splitTraverseTree (\s' (Elem a) -> Elem (f s' a)) s xs + +splitTraverseTree :: (Sized a, Splittable s) => (s -> a -> b) -> s -> FingerTree a -> FingerTree b +splitTraverseTree _f _s Empty = Empty +splitTraverseTree f s (Single xs) = Single $ f s xs +splitTraverseTree f s (Deep n pr m sf) = Deep n (splitTraverseDigit f prs pr) (splitTraverseTree (splitTraverseNode f) ms m) (splitTraverseDigit f sfs sf) + where + (prs, r) = splitState (size pr) s + (ms, sfs) = splitState (n - size pr - size sf) r + +splitTraverseDigit :: (Sized a, Splittable s) => (s -> a -> b) -> s -> Digit a -> Digit b +splitTraverseDigit f s (One a) = One (f s a) +splitTraverseDigit f s (Two a b) = Two (f first a) (f second b) + where + (first, second) = splitState (size a) s +splitTraverseDigit f s (Three a b c) = Three (f first a) (f second b) (f third c) + where + (first, r) = splitState (size a) s + (second, third) = splitState (size b) r +splitTraverseDigit f s (Four a b c d) = Four (f first a) (f second b) (f third c) (f fourth d) + where + (first, s') = splitState (size a) s + (middle, fourth) = splitState (size b + size c) s' + (second, third) = splitState (size b) middle + +splitTraverseNode :: (Sized a, Splittable s) => (s -> a -> b) -> s -> Node a -> Node b +splitTraverseNode f s (Node2 ns a b) = Node2 ns (f first a) (f second b) + where + (first, second) = splitState (size a) s +splitTraverseNode f s (Node3 ns a b c) = Node3 ns (f first a) (f second b) (f third c) + where + (first, r) = splitState (size a) s + (second, third) = splitState (size b) r + +getSingleton :: Seq a -> a +getSingleton (Seq (Single (Elem a))) = a +getSingleton (Seq Empty) = error "getSingleton: Empty" +getSingleton _ = error "getSingleton: Not a singleton." + +------------------------------------------------------------------------ -- Zipping ------------------------------------------------------------------------ @@ -1717,17 +1786,11 @@ zip = zipWith (,) -- For example, @zipWith (+)@ is applied to two sequences to take the -- sequence of corresponding sums. zipWith :: (a -> b -> c) -> Seq a -> Seq b -> Seq c -zipWith f xs ys - | length xs <= length ys = zipWith' f xs ys - | otherwise = zipWith' (flip f) ys xs - --- like 'zipWith', but assumes length xs <= length ys -zipWith' :: (a -> b -> c) -> Seq a -> Seq b -> Seq c -zipWith' f xs ys = snd (mapAccumL k ys xs) +zipWith f s1 s2 = splitTraverseSeq (\s a -> f a (getSingleton s)) s2' s1' where - k kys x = case viewl kys of - (z :< zs) -> (zs, f x z) - EmptyL -> error "zipWith': unexpected EmptyL" + minLen = min (length s1) (length s2) + s1' = take minLen s1 + s2' = take minLen s2 -- | /O(min(n1,n2,n3))/. 'zip3' takes three sequences and returns a -- sequence of triples, analogous to 'zip'. @@ -1738,7 +1801,14 @@ zip3 = zipWith3 (,,) -- three elements, as well as three sequences and returns a sequence of -- their point-wise combinations, analogous to 'zipWith'. zipWith3 :: (a -> b -> c -> d) -> Seq a -> Seq b -> Seq c -> Seq d -zipWith3 f s1 s2 s3 = zipWith ($) (zipWith f s1 s2) s3 +zipWith3 f s1 s2 s3 = splitTraverseSeq (\s a -> + case s of + (b, c) -> f a (getSingleton b) (getSingleton c)) (s2', s3') s1' + where + minLen = minimum [length s1, length s2, length s3] + s1' = take minLen s1 + s2' = take minLen s2 + s3' = take minLen s3 -- | /O(min(n1,n2,n3,n4))/. 'zip4' takes four sequences and returns a -- sequence of quadruples, analogous to 'zip'. @@ -1749,7 +1819,15 @@ zip4 = zipWith4 (,,,) -- four elements, as well as four sequences and returns a sequence of -- their point-wise combinations, analogous to 'zipWith'. zipWith4 :: (a -> b -> c -> d -> e) -> Seq a -> Seq b -> Seq c -> Seq d -> Seq e -zipWith4 f s1 s2 s3 s4 = zipWith ($) (zipWith ($) (zipWith f s1 s2) s3) s4 +zipWith4 f s1 s2 s3 s4 = splitTraverseSeq (\s a -> + case s of + (b, (c, d)) -> f a (getSingleton b) (getSingleton c) (getSingleton d)) (s2', (s3', s4')) s1' + where + minLen = minimum [length s1, length s2, length s3, length s4] + s1' = take minLen s1 + s2' = take minLen s2 + s3' = take minLen s3 + s4' = take minLen s4 ------------------------------------------------------------------------ -- Sorting From git at git.haskell.org Mon Apr 17 21:35:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:30 +0000 (UTC) Subject: [commit: packages/filepath] bgamari-patch-1, master: Version 1.4.1.1 (f6068dd) Message-ID: <20170417213530.06CEE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/filepath On branches: bgamari-patch-1,master Link : http://git.haskell.org/packages/filepath.git/commitdiff/f6068dde9b62ce51900a4e303b1cb14a2a3f5651 >--------------------------------------------------------------- commit f6068dde9b62ce51900a4e303b1cb14a2a3f5651 Author: Neil Mitchell Date: Mon Nov 14 21:42:37 2016 +0000 Version 1.4.1.1 >--------------------------------------------------------------- f6068dde9b62ce51900a4e303b1cb14a2a3f5651 changelog.md | 4 ++++ filepath.cabal | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 038f72e..cf3cfef 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,10 @@ _Note: below all `FilePath` values are unquoted, so `\\` really means two backslashes._ +## 1.4.1.1 *Nov 2016* + + * Bundled with GHC 8.0.2 + * Documentation improvements * Allow QuickCheck-2.9 diff --git a/filepath.cabal b/filepath.cabal index aff6526..abaa97c 100644 --- a/filepath.cabal +++ b/filepath.cabal @@ -1,6 +1,6 @@ cabal-version: >= 1.10 name: filepath -version: 1.4.1.0 +version: 1.4.1.1 -- NOTE: Don't forget to update ./changelog.md license: BSD3 license-file: LICENSE From git at git.haskell.org Mon Apr 17 21:35:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:30 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394, zip-devel: Add zip benchmarks (cdf173f) Message-ID: <20170417213530.892753A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/cdf173f4cb1f792a4ac54b939bf197c214abcd43 >--------------------------------------------------------------- commit cdf173f4cb1f792a4ac54b939bf197c214abcd43 Author: David Feuer Date: Wed Dec 3 12:31:45 2014 -0500 Add zip benchmarks >--------------------------------------------------------------- cdf173f4cb1f792a4ac54b939bf197c214abcd43 benchmarks/Sequence.hs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/benchmarks/Sequence.hs b/benchmarks/Sequence.hs index 8c18582..ccaca6c 100644 --- a/benchmarks/Sequence.hs +++ b/benchmarks/Sequence.hs @@ -20,10 +20,16 @@ main = do r1000 = rlist 1000 rnf [r10, r100, r1000] `seq` return () defaultMain - [ bench "splitAt/append 10" $ nf (shuffle r10) s10 - , bench "splitAt/append 100" $ nf (shuffle r100) s100 - , bench "splitAt/append 1000" $ nf (shuffle r1000) s1000 - ] + [ bgroup "splitAt/append" + [ bench "10" $ nf (shuffle r10) s10 + , bench "100" $ nf (shuffle r100) s100 + , bench "1000" $ nf (shuffle r1000) s1000 + ] + , bgroup "zip" + [ bench "ix10000/5000" $ nf (\(xs,ys) -> S.zip xs ys `S.index` 5000) (S.replicate 10000 (), S.fromList [1..10000::Int]) + , bench "nf150" $ nf (uncurry S.zip) (S.fromList [1..150::Int], S.replicate 150 ()) + , bench "nf10000" $ nf (uncurry S.zip) (S.fromList [1..10000::Int], S.replicate 10000 ()) + ] ] -- splitAt+append: repeatedly cut the sequence at a random point -- and rejoin the pieces in the opposite order. From git at git.haskell.org Mon Apr 17 21:35:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:30 +0000 (UTC) Subject: [commit: packages/directory] master: Add full suite of symbolic link functions (245e07c) Message-ID: <20170417213530.C644D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/245e07c4cef4368bb45d408513cb6d2ddd49b463/directory >--------------------------------------------------------------- commit 245e07c4cef4368bb45d408513cb6d2ddd49b463 Author: Phil Ruffwind Date: Tue Feb 28 23:17:11 2017 -0500 Add full suite of symbolic link functions - createFileLink - createDirectoryLink - removeDirectoryLink - getSymbolicLinkTarget TestUtils is now slightly simpler as a result. Also fixed some symlink-related bugs (see changelog). >--------------------------------------------------------------- 245e07c4cef4368bb45d408513cb6d2ddd49b463 System/Directory.hs | 139 ++++++++++++++++++++++++++++++++-- System/Directory/Internal/Windows.hsc | 63 ++++++++++++++- appveyor.yml | 3 +- changelog.md | 18 ++++- configure.ac | 1 + directory.cabal | 2 +- tests/CanonicalizePath.hs | 34 ++------- tests/PathIsSymbolicLink.hs | 35 ++++++--- tests/RemoveDirectoryRecursive001.hs | 6 +- tests/RemovePathForcibly.hs | 6 +- tests/TestUtils.hs | 105 +++++++++++++------------ tests/Util.hs | 1 + tools/testctl | 4 +- 13 files changed, 311 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 245e07c4cef4368bb45d408513cb6d2ddd49b463 From git at git.haskell.org Mon Apr 17 21:35:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:32 +0000 (UTC) Subject: [commit: packages/filepath] bgamari-patch-1, master: Spelling fix (004ff90) Message-ID: <20170417213532.0D4C53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/filepath On branches: bgamari-patch-1,master Link : http://git.haskell.org/packages/filepath.git/commitdiff/004ff903e0cfaa1a89c59b0ca76cd832a2f40bbb >--------------------------------------------------------------- commit 004ff903e0cfaa1a89c59b0ca76cd832a2f40bbb Author: Ben Gamari Date: Mon Nov 14 17:39:10 2016 -0500 Spelling fix >--------------------------------------------------------------- 004ff903e0cfaa1a89c59b0ca76cd832a2f40bbb README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6c3ca0c..f059998 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ All three modules provide the same API, and the same documentation (calling out The answer for this library is "no". While an abstract `FilePath` has some advantages (mostly type safety), it also has some disadvantages: -* In Haskell the definition is `type FilePath = String`, and all file-orientated functions operate on this type alias, e.g. `readFile`/`writeFile`. Any abstract type would require wrappers for these functions or lots of casts between `String` and the abstraction. +* In Haskell the definition is `type FilePath = String`, and all file-oriented functions operate on this type alias, e.g. `readFile`/`writeFile`. Any abstract type would require wrappers for these functions or lots of casts between `String` and the abstraction. * It is not immediately obvious what a `FilePath` is, and what is just a pure `String`. For example, `/path/file.ext` is a `FilePath`. Is `/`? `/path`? `path`? `file.ext`? `.ext`? `file`? * Often it is useful to represent invalid files, e.g. `/foo/*.txt` probably isn't an actual file, but a glob pattern. Other programs use `foo//bar` for globs, which is definitely not a file, but might want to be stored as a `FilePath`. * Some programs use syntactic non-semantic details of the `FilePath` to change their behaviour. For example, `foo`, `foo/` and `foo/.` are all similar, and refer to the same location on disk, but may behave differently when passed to command-line tools. From git at git.haskell.org Mon Apr 17 21:35:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:32 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel: Specialize splitTraverse; strictify pair splitting (7e6d75f) Message-ID: <20170417213532.921A53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394,zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/7e6d75f9cfb524ccb3c7dfd149c6f7f74e276285 >--------------------------------------------------------------- commit 7e6d75f9cfb524ccb3c7dfd149c6f7f74e276285 Author: David Feuer Date: Wed Dec 3 13:27:41 2014 -0500 Specialize splitTraverse; strictify pair splitting Explicitly specialize `splitTraverse` functions to the necessary types. This has no immediate performance impact, but makes it clearer what the functions are about. Make splitting pairs a bit stricter; we don't need that much laziness. >--------------------------------------------------------------- 7e6d75f9cfb524ccb3c7dfd149c6f7f74e276285 Data/Sequence.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 10d3a92..9955584 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -1726,14 +1726,18 @@ instance Splittable (Seq a) where splitState = splitAt instance (Splittable a, Splittable b) => Splittable (a, b) where - splitState i (a, b) = ((al, bl), (ar, br)) + splitState i (a, b) = (al `seq` bl `seq` (al, bl), ar `seq` br `seq` (ar, br)) where (al, ar) = splitState i a (bl, br) = splitState i b +{-# SPECIALIZE splitTraverseSeq :: (Seq x -> a -> b) -> Seq x -> Seq a -> Seq b #-} +{-# SPECIALIZE splitTraverseSeq :: ((Seq x, Seq y) -> a -> b) -> (Seq x, Seq y) -> Seq a -> Seq b #-} splitTraverseSeq :: (Splittable s) => (s -> a -> b) -> s -> Seq a -> Seq b splitTraverseSeq f s (Seq xs) = Seq $ splitTraverseTree (\s' (Elem a) -> Elem (f s' a)) s xs +{-# SPECIALIZE splitTraverseTree :: (Seq x -> Elem y -> b) -> Seq x -> FingerTree (Elem y) -> FingerTree b #-} +{-# SPECIALIZE splitTraverseTree :: (Seq x -> Node y -> b) -> Seq x -> FingerTree (Node y) -> FingerTree b #-} splitTraverseTree :: (Sized a, Splittable s) => (s -> a -> b) -> s -> FingerTree a -> FingerTree b splitTraverseTree _f _s Empty = Empty splitTraverseTree f s (Single xs) = Single $ f s xs @@ -1742,6 +1746,8 @@ splitTraverseTree f s (Deep n pr m sf) = Deep n (splitTraverseDigit f prs pr) (s (prs, r) = splitState (size pr) s (ms, sfs) = splitState (n - size pr - size sf) r +{-# SPECIALIZE splitTraverseDigit :: (Seq x -> Elem y -> b) -> Seq x -> Digit (Elem y) -> Digit b #-} +{-# SPECIALIZE splitTraverseDigit :: (Seq x -> Node y -> b) -> Seq x -> Digit (Node y) -> Digit b #-} splitTraverseDigit :: (Sized a, Splittable s) => (s -> a -> b) -> s -> Digit a -> Digit b splitTraverseDigit f s (One a) = One (f s a) splitTraverseDigit f s (Two a b) = Two (f first a) (f second b) @@ -1757,6 +1763,8 @@ splitTraverseDigit f s (Four a b c d) = Four (f first a) (f second b) (f third c (middle, fourth) = splitState (size b + size c) s' (second, third) = splitState (size b) middle +{-# SPECIALIZE splitTraverseNode :: (Seq x -> Elem y -> b) -> Seq x -> Node (Elem y) -> Node b #-} +{-# SPECIALIZE splitTraverseNode :: (Seq x -> Node y -> b) -> Seq x -> Node (Node y) -> Node b #-} splitTraverseNode :: (Sized a, Splittable s) => (s -> a -> b) -> s -> Node a -> Node b splitTraverseNode f s (Node2 ns a b) = Node2 ns (f first a) (f second b) where From git at git.haskell.org Mon Apr 17 21:35:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:32 +0000 (UTC) Subject: [commit: packages/directory] master: canonicalizePath can now resolve broken symlinks (936d66c) Message-ID: <20170417213532.CF04F3A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/936d66c1eb033d16e77fdf779a64a68a7162ea7a/directory >--------------------------------------------------------------- commit 936d66c1eb033d16e77fdf779a64a68a7162ea7a Author: Phil Ruffwind Date: Wed Mar 1 23:04:30 2017 -0500 canonicalizePath can now resolve broken symlinks Fixes #64. >--------------------------------------------------------------- 936d66c1eb033d16e77fdf779a64a68a7162ea7a System/Directory.hs | 116 +++++++++++++++++++++++++++++++++------------- changelog.md | 3 ++ tests/CanonicalizePath.hs | 16 +++++-- 3 files changed, 99 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 936d66c1eb033d16e77fdf779a64a68a7162ea7a From git at git.haskell.org Mon Apr 17 21:35:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:34 +0000 (UTC) Subject: [commit: packages/filepath] master: Merge pull request #55 from haskell/bgamari-patch-1 (c4a740e) Message-ID: <20170417213534.131A93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/filepath On branch : master Link : http://git.haskell.org/packages/filepath.git/commitdiff/c4a740e11d990ff0ed132d59c12eda18cce17b51 >--------------------------------------------------------------- commit c4a740e11d990ff0ed132d59c12eda18cce17b51 Merge: f6068dd 004ff90 Author: Neil Mitchell Date: Tue Nov 15 07:59:16 2016 +0000 Merge pull request #55 from haskell/bgamari-patch-1 Spelling fix >--------------------------------------------------------------- c4a740e11d990ff0ed132d59c12eda18cce17b51 README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) From git at git.haskell.org Mon Apr 17 21:35:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:34 +0000 (UTC) Subject: [commit: packages/containers] zip-devel: Make <*> fast (73c06d4) Message-ID: <20170417213534.9B0F13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branch : zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/73c06d4421aaca2dc3c06d07d452d3e8f586ecf4 >--------------------------------------------------------------- commit 73c06d4421aaca2dc3c06d07d452d3e8f586ecf4 Author: David Feuer Date: Sat Dec 6 18:46:49 2014 -0500 Make <*> fast Use the `splitTraverse` mechanism to implement `<*>` with optimal incremental performance. Stop exporting `splitTraverse`. Many thanks to Joachim Breitner for writing the splitting code for this. >--------------------------------------------------------------- 73c06d4421aaca2dc3c06d07d452d3e8f586ecf4 Data/Sequence.hs | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 57 insertions(+), 4 deletions(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 9e78ce1..f7d551c 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -133,7 +133,6 @@ module Data.Sequence ( -- * Transformations mapWithIndex, -- :: (Int -> a -> b) -> Seq a -> Seq b reverse, -- :: Seq a -> Seq a - splitTraverse, -- :: (Int -> s -> (s, s)) -> (s -> a -> b) -> s -> Seq a -> Seq b -- ** Zips zip, -- :: Seq a -> Seq b -> Seq (a, b) zipWith, -- :: (a -> b -> c) -> Seq a -> Seq b -> Seq c @@ -257,10 +256,65 @@ instance Monad Seq where instance Applicative Seq where pure = singleton - fs <*> xs = foldl' add empty fs - where add ys f = ys >< fmap f xs + + Seq Empty <*> _ = empty + _ <*> Seq Empty = empty + Seq (Single (Elem f)) <*> xs = fmap f xs + fs <*> Seq (Single (Elem x)) = fmap ($x) fs + fs <*> xs = splitTraverse splitCPs + (\s _ -> uncurry ($) (getSingletonCPs s)) + (createCPs fs xs) + (replicate (length fs * length xs) ()) + xs *> ys = replicateSeq (length xs) ys +-- The splitCPs code below, for splitting ragged-ended Cartesian products, +-- was generously provided by Joachim Breitner. + +data CPs x y = + CPs (Seq x) + (Seq y) + {-# UNPACK #-} !Int {- beginning column -} + {-# UNPACK #-} !Int {- last column -} + | SingleCPs x (Seq y) +#ifdef TESTING + deriving Show +#endif + +-- Note: The total length of CPs xs ys fc lc is +-- (length xs - 1) * length ys - fc + lc + 1 + +-- Create a non-trivial Cps given two sequences +createCPs :: Seq x -> Seq y -> CPs x y +createCPs xs ys = CPs xs ys 0 (length ys - 1) + +-- Smart constructor +mkCPs :: Seq x -> Seq y -> Int -> Int -> CPs x y +mkCPs (Seq (Single (Elem x))) ys fc lc = SingleCPs x (drop fc $ take (lc+1) ys) +mkCPs xs ys fc lc = CPs xs ys fc lc + +splitCPs:: Int -> CPs x y -> (CPs x y, CPs x y) +splitCPs n (SingleCPs x ys) + = ( SingleCPs x ys1, SingleCPs x ys2 ) + where (ys1, ys2) = splitAt n ys +splitCPs n (CPs xs ys fc lc) + = ( mkCPs (take r_end xs) ys fc c_end + , mkCPs (drop r_begin xs) ys c_begin lc + ) + where + -- Coordinates of the beginning of the second chunk + (r_begin, -- number of rows that do not go into the second chunk + c_begin) = (n + fc) `quotRem` length ys + + -- Coordinates of the end of the first chunk + r_end | c_begin == 0 = r_begin -- cut nicely along rows, keep the other rows + | otherwise = r_begin + 1 -- we need to keep one row in both chunks + c_end = (c_begin - 1 + length ys) `rem` length ys + +getSingletonCPs :: CPs x y -> (x, y) +getSingletonCPs (SingleCPs x ys) = (x, getSingleton ys) +getSingletonCPs _ = error "getSingletonCPs: Not a singleton" + instance MonadPlus Seq where mzero = empty mplus = (><) @@ -1370,7 +1424,6 @@ mapWithIndex# f (Seq xs) = Seq $ mapWithIndexTree# (\s (Elem a) -> Elem (f s a)) !(I# sb) = size b !sPsa = s +# sa !sPsab = sPsa +# sb - #endif -- | /O(n)/. Convert a given sequence length and a function representing that From git at git.haskell.org Mon Apr 17 21:35:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:34 +0000 (UTC) Subject: [commit: packages/directory] master: Re-hide unnecessary internal modules (cdd480f) Message-ID: <20170417213534.D614F3A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cdd480fe06725694e2d02524d72a51c7d80dfb54/directory >--------------------------------------------------------------- commit cdd480fe06725694e2d02524d72a51c7d80dfb54 Author: Phil Ruffwind Date: Thu Mar 2 00:45:53 2017 -0500 Re-hide unnecessary internal modules The C_utimensat, Posix, and Windows modules are all re-exported in Internal, so there is no point in exposing those three. >--------------------------------------------------------------- cdd480fe06725694e2d02524d72a51c7d80dfb54 System/Directory/Internal.hs | 3 +++ System/Directory/Internal/C_utimensat.hsc | 9 --------- System/Directory/Internal/Posix.hsc | 9 --------- System/Directory/Internal/Prelude.hs | 2 +- System/Directory/Internal/Windows.hsc | 8 -------- directory.cabal | 6 +++--- 6 files changed, 7 insertions(+), 30 deletions(-) diff --git a/System/Directory/Internal.hs b/System/Directory/Internal.hs index b9cc4cf..f85d6d6 100644 --- a/System/Directory/Internal.hs +++ b/System/Directory/Internal.hs @@ -4,6 +4,9 @@ -- Portability: unportable -- -- Internal modules are always subject to change from version to version. +-- The contents of this module are also platform-dependent, hence what is +-- shown in the Hackage documentation may differ from what is actually +-- available on your system. #include diff --git a/System/Directory/Internal/C_utimensat.hsc b/System/Directory/Internal/C_utimensat.hsc index 0d20e84..f10c659 100644 --- a/System/Directory/Internal/C_utimensat.hsc +++ b/System/Directory/Internal/C_utimensat.hsc @@ -1,12 +1,3 @@ - --- | --- Stability: unstable --- Portability: unportable --- --- Internal modules are always subject to change from version to version. --- Since this is a platform-specific module, the contents shown in the Hackage --- documentation may differ from what is actually available on your system. - module System.Directory.Internal.C_utimensat where #include #ifdef HAVE_UTIMENSAT diff --git a/System/Directory/Internal/Posix.hsc b/System/Directory/Internal/Posix.hsc index 15f1f86..669e5c0 100644 --- a/System/Directory/Internal/Posix.hsc +++ b/System/Directory/Internal/Posix.hsc @@ -1,12 +1,3 @@ - --- | --- Stability: unstable --- Portability: unportable --- --- Internal modules are always subject to change from version to version. --- Since this is a platform-specific module, the contents shown in the Hackage --- documentation may differ from what is actually available on your system. - module System.Directory.Internal.Posix where #include #ifndef mingw32_HOST_OS diff --git a/System/Directory/Internal/Prelude.hs b/System/Directory/Internal/Prelude.hs index 81e216c..f128870 100644 --- a/System/Directory/Internal/Prelude.hs +++ b/System/Directory/Internal/Prelude.hs @@ -1,7 +1,7 @@ {-# LANGUAGE CPP #-} -- | -- Stability: unstable --- Portability: unportable +-- Portability: portable -- -- Internal modules are always subject to change from version to version. diff --git a/System/Directory/Internal/Windows.hsc b/System/Directory/Internal/Windows.hsc index 1f238d0..c44cfc6 100644 --- a/System/Directory/Internal/Windows.hsc +++ b/System/Directory/Internal/Windows.hsc @@ -1,12 +1,4 @@ {-# LANGUAGE CPP #-} --- | --- Stability: unstable --- Portability: unportable --- --- Internal modules are always subject to change from version to version. --- Since this is a platform-specific module, the contents shown in the Hackage --- documentation may differ from what is actually available on your system. - module System.Directory.Internal.Windows where #include #ifdef mingw32_HOST_OS diff --git a/directory.cabal b/directory.cabal index 2def487..3f73c9a 100644 --- a/directory.cabal +++ b/directory.cabal @@ -44,12 +44,12 @@ Library exposed-modules: System.Directory System.Directory.Internal - System.Directory.Internal.C_utimensat - System.Directory.Internal.Posix System.Directory.Internal.Prelude - System.Directory.Internal.Windows other-modules: + System.Directory.Internal.C_utimensat System.Directory.Internal.Config + System.Directory.Internal.Posix + System.Directory.Internal.Windows include-dirs: . From git at git.haskell.org Mon Apr 17 21:35:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:36 +0000 (UTC) Subject: [commit: packages/containers] zip-devel: Update benchmark running script to new Criterion options. (83f32bc) Message-ID: <20170417213536.A67183A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branch : zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/83f32bcf58a43dfec32a4151d2f677635da7e5cd >--------------------------------------------------------------- commit 83f32bcf58a43dfec32a4151d2f677635da7e5cd Author: Milan Straka Date: Sun Dec 7 14:57:04 2014 +0100 Update benchmark running script to new Criterion options. >--------------------------------------------------------------- 83f32bcf58a43dfec32a4151d2f677635da7e5cd benchmarks/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benchmarks/Makefile b/benchmarks/Makefile index 1539a2a..ff45493 100644 --- a/benchmarks/Makefile +++ b/benchmarks/Makefile @@ -4,7 +4,7 @@ bench-%: %.hs force ghc -O2 -DTESTING $< -i../$(TOP) -o $@ -outputdir tmp -rtsopts bench-%.csv: bench-% - ./bench-$* $(BENCHMARK) -v -u bench-$*.csv + ./bench-$* $(BENCHMARK) -v 2 --csv bench-$*.csv .PHONY: force clean veryclean force: From git at git.haskell.org Mon Apr 17 21:35:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:36 +0000 (UTC) Subject: [commit: packages/filepath] master: Bump upper bound on base (f30f714) Message-ID: <20170417213536.1A0EF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/filepath On branch : master Link : http://git.haskell.org/packages/filepath.git/commitdiff/f30f71404c8aff38eec7188746f40f4c5853be96 >--------------------------------------------------------------- commit f30f71404c8aff38eec7188746f40f4c5853be96 Author: Ben Gamari Date: Tue Nov 15 12:16:32 2016 -0500 Bump upper bound on base >--------------------------------------------------------------- f30f71404c8aff38eec7188746f40f4c5853be96 filepath.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/filepath.cabal b/filepath.cabal index abaa97c..971e8b7 100644 --- a/filepath.cabal +++ b/filepath.cabal @@ -48,7 +48,7 @@ library System.FilePath.Windows build-depends: - base >= 4 && < 4.10 + base >= 4 && < 4.11 ghc-options: -Wall From git at git.haskell.org Mon Apr 17 21:35:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:36 +0000 (UTC) Subject: [commit: packages/directory] master: Add more canonicalizePath tests (cdcc450) Message-ID: <20170417213536.DD47F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cdcc45059b02f2ddabae04aee5ee14759d9d83bb/directory >--------------------------------------------------------------- commit cdcc45059b02f2ddabae04aee5ee14759d9d83bb Author: Phil Ruffwind Date: Thu Mar 2 03:22:36 2017 -0500 Add more canonicalizePath tests >--------------------------------------------------------------- cdcc45059b02f2ddabae04aee5ee14759d9d83bb tests/CanonicalizePath.hs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/CanonicalizePath.hs b/tests/CanonicalizePath.hs index 07ba771..ab74c7b 100644 --- a/tests/CanonicalizePath.hs +++ b/tests/CanonicalizePath.hs @@ -81,10 +81,18 @@ main _t = do T(expectEq) () bar =<< canonicalizePath "lfoo/bar" T(expectEq) () barQux =<< canonicalizePath "lfoo/bar/qux" + -- create a haphazard chain of links + createDirectoryLink "./../foo/../foo/." "./foo/./somelink3" + createDirectoryLink ".././foo/somelink3" "foo/somelink2" + createDirectoryLink "./foo/somelink2" "somelink" + T(expectEq) () foo =<< canonicalizePath "somelink" + -- regression test for #64 createFileLink "../foo/non-existent" "foo/qux" + removeDirectoryLink "foo/somelink3" -- break the chain made earlier qux <- canonicalizePath "foo/qux" T(expectEq) () qux =<< canonicalizePath "foo/non-existent" + T(expectEq) () (foo "somelink3") =<< canonicalizePath "somelink" -- make sure it can handle loops createFileLink "loop1" "loop2" From git at git.haskell.org Mon Apr 17 21:35:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:38 +0000 (UTC) Subject: [commit: packages/filepath] master: Require cabal 1.18 (1462d21) Message-ID: <20170417213538.1F9F33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/filepath On branch : master Link : http://git.haskell.org/packages/filepath.git/commitdiff/1462d2106e0748efd4cfc1aa3316863a06f94562 >--------------------------------------------------------------- commit 1462d2106e0748efd4cfc1aa3316863a06f94562 Author: Neil Mitchell Date: Fri Nov 18 21:48:49 2016 +0000 Require cabal 1.18 >--------------------------------------------------------------- 1462d2106e0748efd4cfc1aa3316863a06f94562 filepath.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/filepath.cabal b/filepath.cabal index 971e8b7..61723ad 100644 --- a/filepath.cabal +++ b/filepath.cabal @@ -1,4 +1,4 @@ -cabal-version: >= 1.10 +cabal-version: >= 1.18 name: filepath version: 1.4.1.1 -- NOTE: Don't forget to update ./changelog.md From git at git.haskell.org Mon Apr 17 21:35:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:38 +0000 (UTC) Subject: [commit: packages/containers] zip-devel: Add simple fromFunction benchmark. (fc87eee) Message-ID: <20170417213538.AE1853A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branch : zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/fc87eeefa5907559b2669a16baed03db79f82981 >--------------------------------------------------------------- commit fc87eeefa5907559b2669a16baed03db79f82981 Author: Milan Straka Date: Sun Dec 7 14:57:24 2014 +0100 Add simple fromFunction benchmark. >--------------------------------------------------------------- fc87eeefa5907559b2669a16baed03db79f82981 benchmarks/Sequence.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/benchmarks/Sequence.hs b/benchmarks/Sequence.hs index ccaca6c..58e1114 100644 --- a/benchmarks/Sequence.hs +++ b/benchmarks/Sequence.hs @@ -29,7 +29,13 @@ main = do [ bench "ix10000/5000" $ nf (\(xs,ys) -> S.zip xs ys `S.index` 5000) (S.replicate 10000 (), S.fromList [1..10000::Int]) , bench "nf150" $ nf (uncurry S.zip) (S.fromList [1..150::Int], S.replicate 150 ()) , bench "nf10000" $ nf (uncurry S.zip) (S.fromList [1..10000::Int], S.replicate 10000 ()) - ] ] + ] + , bgroup "fromFunction" + [ bench "ix10000/5000" $ nf (\size -> S.fromFunction size id `S.index` (size `div` 2)) 10000 + , bench "nf100" $ nf (\size -> S.fromFunction size id) 100 + , bench "nf10000" $ nf (\size -> S.fromFunction size id) 10000 + ] + ] -- splitAt+append: repeatedly cut the sequence at a random point -- and rejoin the pieces in the opposite order. From git at git.haskell.org Mon Apr 17 21:35:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:38 +0000 (UTC) Subject: [commit: packages/directory] master: Improve path normalisation on Windows (b82ca01) Message-ID: <20170417213538.E40D73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b82ca0194767bf418330bd1ed89ea541716e596a/directory >--------------------------------------------------------------- commit b82ca0194767bf418330bd1ed89ea541716e596a Author: Phil Ruffwind Date: Sun Mar 5 00:36:19 2017 -0500 Improve path normalisation on Windows Previously it did not handle ".." properly, nor did it remove extra slashes after the drive. >--------------------------------------------------------------- b82ca0194767bf418330bd1ed89ea541716e596a System/Directory/Internal/Windows.hsc | 69 ++++++++++++++++++++++++++++++----- changelog.md | 5 +++ tests/CanonicalizePath.hs | 10 +++++ 3 files changed, 74 insertions(+), 10 deletions(-) diff --git a/System/Directory/Internal/Windows.hsc b/System/Directory/Internal/Windows.hsc index c44cfc6..b46e8f8 100644 --- a/System/Directory/Internal/Windows.hsc +++ b/System/Directory/Internal/Windows.hsc @@ -18,8 +18,10 @@ module System.Directory.Internal.Windows where #include import Prelude () import System.Directory.Internal.Prelude -import System.FilePath (isPathSeparator, isRelative, normalise, - pathSeparator, splitDirectories) +import System.FilePath (addTrailingPathSeparator, hasTrailingPathSeparator, + isPathSeparator, isRelative, joinDrive, joinPath, + normalise, pathSeparator, pathSeparators, + splitDirectories, splitDrive) import qualified Data.List as List import qualified System.Win32 as Win32 @@ -251,25 +253,72 @@ readSymbolicLink path = modifyIOError (`ioeSetFileName` path) $ do Win32.fILE_SHARE_WRITE strip sn = fromMaybe sn (List.stripPrefix "\\??\\" sn) +-- | Given a list of path segments, expand @.@ and @.. at . The path segments +-- must not contain path separators. +expandDots :: [FilePath] -> [FilePath] +expandDots = reverse . go [] + where + go ys' xs' = + case xs' of + [] -> ys' + x : xs -> + case x of + "." -> go ys' xs + ".." -> + case ys' of + _ : ys -> go ys xs + [] -> go (x : ys') xs + _ -> go (x : ys') xs + +-- | Remove redundant trailing slashes and pick the right kind of slash. +normaliseTrailingSep :: FilePath -> FilePath +normaliseTrailingSep path = do + let path' = reverse path + let (sep, path'') = span isPathSeparator path' + let addSep = if null sep then id else (pathSeparator :) + reverse (addSep path'') + +-- | A variant of 'normalise' to handle Windows paths a little better. It +-- +-- * deduplicates trailing slashes after the drive, +-- * expands parent dirs (@..@), and +-- * preserves paths with @\\\\?\\@. +normaliseW :: FilePath -> FilePath +normaliseW path@('\\' : '\\' : '?' : '\\' : _) = path +normaliseW path = normalise (joinDrive drive' subpath') + where + (drive, subpath) = splitDrive path + drive' = normaliseTrailingSep drive + subpath' = appendSep . prependSep . joinPath . + stripPardirs . expandDots . skipSeps . + splitDirectories $ subpath + + skipSeps = filter (not . (`elem` (pure <$> pathSeparators))) + stripPardirs | not (isRelative path) = dropWhile (== "..") + | otherwise = id + prependSep | any isPathSeparator (take 1 subpath) = (pathSeparator :) + | otherwise = id + appendSep | hasTrailingPathSeparator subpath = addTrailingPathSeparator + | otherwise = id + -- | Normalise the path separators and prepend the @"\\\\?\\"@ prefix if --- necessary or possible. +-- necessary or possible. This is used for symbolic links targets because +-- they can't handle forward slashes. normaliseSeparators :: FilePath -> FilePath normaliseSeparators path | isRelative path = normaliseSep <$> path | otherwise = toExtendedLengthPath path where normaliseSep c = if isPathSeparator c then pathSeparator else c --- | Add the @"\\\\?\\"@ prefix if necessary or possible. --- The path remains unchanged if the prefix is not added. +-- | Add the @"\\\\?\\"@ prefix if necessary or possible. The path remains +-- unchanged if the prefix is not added. This function can sometimes be used +-- to bypass the @MAX_PATH@ length restriction in Windows API calls. toExtendedLengthPath :: FilePath -> FilePath toExtendedLengthPath path | isRelative path = path | otherwise = - case normalise path of - -- note: as of filepath-1.4.1.0 normalise doesn't honor \\?\ - -- https://github.com/haskell/filepath/issues/56 - -- this means we cannot trust the result of normalise on - -- paths that start with \\?\ + case normaliseW path of + '\\' : '?' : '?' : '\\' : _ -> path '\\' : '\\' : '?' : '\\' : _ -> path '\\' : '\\' : '.' : '\\' : _ -> path '\\' : subpath@('\\' : _) -> "\\\\?\\UNC" <> subpath diff --git a/changelog.md b/changelog.md index d98bbd3..f528faf 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,11 @@ Changelog for the [`directory`][1] package ========================================== +## 1.3.1.1 (April 2017) + + * Fix a bug where `createFileLink` and `createDirectoryLink` failed to + handle `..` in absolute paths. + ## 1.3.1.0 (March 2017) * `findFile` (and similar functions): when an absolute path is given, the diff --git a/tests/CanonicalizePath.hs b/tests/CanonicalizePath.hs index ab74c7b..fe3631a 100644 --- a/tests/CanonicalizePath.hs +++ b/tests/CanonicalizePath.hs @@ -64,6 +64,11 @@ main _t = do T(expectEq) () fooNon fooNon7 T(expectEq) () fooNon fooNon8 + -- make sure ".." gets expanded properly by 'toExtendedLengthPath' + -- (turns out this test won't detect the problem because GetFullPathName + -- would expand them for us if we don't, but leaving it here anyway) + T(expectEq) () foo =<< canonicalizePath (foo ".." "foo") + supportsSymbolicLinks <- supportsSymlinks when supportsSymbolicLinks $ do @@ -102,6 +107,11 @@ main _t = do T(expectEq) () loop1 (normalise (dot "loop1")) T(expectEq) () loop2 (normalise (dot "loop2")) + -- make sure ".." gets expanded properly by 'toExtendedLengthPath' + createDirectoryLink (foo ".." "foo") "foolink" + _ <- listDirectory "foolink" -- make sure directory is accessible + T(expectEq) () foo =<< canonicalizePath "foolink" + caseInsensitive <- (False <$ createDirectory "FOO") `catch` \ e -> From git at git.haskell.org Mon Apr 17 21:35:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:40 +0000 (UTC) Subject: [commit: packages/filepath] master: Update the copyright year (af7caae) Message-ID: <20170417213540.253C43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/filepath On branch : master Link : http://git.haskell.org/packages/filepath.git/commitdiff/af7caae7e90484022b4e656d6d1f9b5e1d1614c7 >--------------------------------------------------------------- commit af7caae7e90484022b4e656d6d1f9b5e1d1614c7 Author: Neil Mitchell Date: Thu Feb 2 22:09:27 2017 +0000 Update the copyright year >--------------------------------------------------------------- af7caae7e90484022b4e656d6d1f9b5e1d1614c7 LICENSE | 2 +- filepath.cabal | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/LICENSE b/LICENSE index 29e1408..e385554 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright Neil Mitchell 2005-2016. +Copyright Neil Mitchell 2005-2017. All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/filepath.cabal b/filepath.cabal index 61723ad..30ea4c3 100644 --- a/filepath.cabal +++ b/filepath.cabal @@ -6,7 +6,7 @@ license: BSD3 license-file: LICENSE author: Neil Mitchell maintainer: Neil Mitchell -copyright: Neil Mitchell 2005-2016 +copyright: Neil Mitchell 2005-2017 bug-reports: https://github.com/haskell/filepath/issues homepage: https://github.com/haskell/filepath#readme category: System From git at git.haskell.org Mon Apr 17 21:35:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:40 +0000 (UTC) Subject: [commit: packages/containers] zip-devel: Add simple mapWithIndex benchmark. (0f3ac0b) Message-ID: <20170417213540.B5E293A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branch : zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/0f3ac0b3e48f49e5565b692f2abcb2219895d145 >--------------------------------------------------------------- commit 0f3ac0b3e48f49e5565b692f2abcb2219895d145 Author: Milan Straka Date: Sun Dec 7 15:43:09 2014 +0100 Add simple mapWithIndex benchmark. >--------------------------------------------------------------- 0f3ac0b3e48f49e5565b692f2abcb2219895d145 benchmarks/Sequence.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/benchmarks/Sequence.hs b/benchmarks/Sequence.hs index 58e1114..5ae2cd3 100644 --- a/benchmarks/Sequence.hs +++ b/benchmarks/Sequence.hs @@ -12,7 +12,8 @@ main = do let s10 = S.fromList [1..10] :: S.Seq Int s100 = S.fromList [1..100] :: S.Seq Int s1000 = S.fromList [1..1000] :: S.Seq Int - rnf [s10, s100, s1000] `seq` return () + s10000 = S.fromList [1..10000] :: S.Seq Int + rnf [s10, s100, s1000, s10000] `seq` return () let g = mkStdGen 1 let rlist n = map (`mod` (n+1)) (take 10000 (randoms g)) :: [Int] r10 = rlist 10 @@ -35,6 +36,11 @@ main = do , bench "nf100" $ nf (\size -> S.fromFunction size id) 100 , bench "nf10000" $ nf (\size -> S.fromFunction size id) 10000 ] + , bgroup "mapWithIndex" + [ bench "ix10000/5000" $ nf (S.mapWithIndex (+)) s10000 + , bench "nf100" $ nf (S.mapWithIndex (+)) s100 + , bench "nf10000" $ nf (S.mapWithIndex (+)) s10000 + ] ] -- splitAt+append: repeatedly cut the sequence at a random point From git at git.haskell.org Mon Apr 17 21:35:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:40 +0000 (UTC) Subject: [commit: packages/directory] master: Improve support for long paths on Windows (f77655a) Message-ID: <20170417213540.EB92D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f77655a2e17c6f7076c7cf9d7de83f5b7f585b63/directory >--------------------------------------------------------------- commit f77655a2e17c6f7076c7cf9d7de83f5b7f585b63 Author: Phil Ruffwind Date: Sun Mar 5 06:03:15 2017 -0500 Improve support for long paths on Windows It's still incomplete. The main problem seems to be functions that use the Windows POSIX interface (c_stat). Testing may be difficult since the file system itself may not support long paths (e.g. FAT). Note that if setCurrentDirectory receives \\?\ then getCurrentDirectory will return the same. This can break other things if they didn't expect \\?\, so we will try to strip the prefix if possible. >--------------------------------------------------------------- f77655a2e17c6f7076c7cf9d7de83f5b7f585b63 System/Directory.hs | 44 +++++++++++++++++++++++------------ System/Directory/Internal/Windows.hsc | 11 +++++---- changelog.md | 10 ++++++++ 3 files changed, 46 insertions(+), 19 deletions(-) diff --git a/System/Directory.hs b/System/Directory.hs index 0f32863..ec5a656 100644 --- a/System/Directory.hs +++ b/System/Directory.hs @@ -376,7 +376,8 @@ The path refers to an existing non-directory object. createDirectory :: FilePath -> IO () createDirectory path = do #ifdef mingw32_HOST_OS - Win32.createDirectory path Nothing + (`ioeSetFileName` path) `modifyIOError` do + Win32.createDirectory (toExtendedLengthPath path) Nothing #else Posix.createDirectory path 0o777 #endif @@ -505,7 +506,8 @@ The operand refers to an existing non-directory object. removeDirectory :: FilePath -> IO () removeDirectory path = #ifdef mingw32_HOST_OS - Win32.removeDirectory path + (`ioeSetFileName` path) `modifyIOError` do + Win32.removeDirectory (toExtendedLengthPath path) #else Posix.removeDirectory path #endif @@ -650,7 +652,8 @@ The operand refers to an existing directory. removeFile :: FilePath -> IO () removeFile path = #ifdef mingw32_HOST_OS - Win32.deleteFile path + (`ioeSetFileName` path) `modifyIOError` do + Win32.deleteFile (toExtendedLengthPath path) #else Posix.removeLink path #endif @@ -836,7 +839,10 @@ renamePath :: FilePath -- ^ Old path -> IO () renamePath opath npath = (`ioeAddLocation` "renamePath") `modifyIOError` do #ifdef mingw32_HOST_OS - Win32.moveFileEx opath npath Win32.mOVEFILE_REPLACE_EXISTING + (`ioeSetFileName` opath) `modifyIOError` do + Win32.moveFileEx (toExtendedLengthPath opath) + (toExtendedLengthPath npath) + Win32.mOVEFILE_REPLACE_EXISTING #else Posix.rename opath npath #endif @@ -956,7 +962,10 @@ copyFileWithMetadata src dst = (`ioeAddLocation` "copyFileWithMetadata") `modifyIOError` doCopy where #ifdef mingw32_HOST_OS - doCopy = Win32.copyFile src dst False + doCopy = (`ioeSetFileName` src) `modifyIOError` do + Win32.copyFile (toExtendedLengthPath src) + (toExtendedLengthPath dst) + False #else doCopy = do st <- Posix.getFileStatus src @@ -1074,7 +1083,8 @@ canonicalizePath = \ path -> transform = attemptRealpath getFinalPathName simplify path = - Win32.getFullPathName path + (fromExtendedLengthPath <$> + Win32.getFullPathName (toExtendedLengthPath path)) `catchIOError` \ _ -> return path #else @@ -1381,7 +1391,7 @@ getDirectoryContents path = else loop (acc . (e:)) #else bracket - (Win32.findFirstFile (path "*")) + (Win32.findFirstFile (toExtendedLengthPath (path "*"))) (\(h,_) -> Win32.findClose h) (\(h,fdat) -> loop h fdat []) where @@ -1469,7 +1479,7 @@ getCurrentDirectory = getCwd where #ifdef mingw32_HOST_OS - getCwd = Win32.getCurrentDirectory + getCwd = fromExtendedLengthPath <$> Win32.getCurrentDirectory #else getCwd = Posix.getWorkingDirectory #endif @@ -1508,11 +1518,12 @@ getCurrentDirectory = -- @[ENOTDIR]@ -- setCurrentDirectory :: FilePath -> IO () -setCurrentDirectory = +setCurrentDirectory path = do #ifdef mingw32_HOST_OS - Win32.setCurrentDirectory + (`ioeSetFileName` path) `modifyIOError` do + Win32.setCurrentDirectory (toExtendedLengthPath path) #else - Posix.changeWorkingDirectory + Posix.changeWorkingDirectory path #endif -- | Run an 'IO' action with the given working directory and restore the @@ -1688,9 +1699,10 @@ removeDirectoryLink path = -- @since 1.3.0.0 pathIsSymbolicLink :: FilePath -> IO Bool pathIsSymbolicLink path = - (`ioeAddLocation` "pathIsSymbolicLink") `modifyIOError` do + ((`ioeAddLocation` "pathIsSymbolicLink") . + (`ioeSetFileName` path)) `modifyIOError` do #ifdef mingw32_HOST_OS - isReparsePoint <$> Win32.getFileAttributes path + isReparsePoint <$> Win32.getFileAttributes (toExtendedLengthPath path) where isReparsePoint attr = attr .&. win32_fILE_ATTRIBUTE_REPARSE_POINT /= 0 #else @@ -1726,8 +1738,10 @@ getSymbolicLinkTarget path = #ifdef mingw32_HOST_OS -- | Open the handle of an existing file or directory. openFileHandle :: String -> Win32.AccessMode -> IO Win32.HANDLE -openFileHandle path mode = Win32.createFile path mode share Nothing - Win32.oPEN_EXISTING flags Nothing +openFileHandle path mode = + (`ioeSetFileName` path) `modifyIOError` do + Win32.createFile (toExtendedLengthPath path) mode share Nothing + Win32.oPEN_EXISTING flags Nothing where share = win32_fILE_SHARE_DELETE .|. Win32.fILE_SHARE_READ .|. Win32.fILE_SHARE_WRITE diff --git a/System/Directory/Internal/Windows.hsc b/System/Directory/Internal/Windows.hsc index b46e8f8..98dc6d1 100644 --- a/System/Directory/Internal/Windows.hsc +++ b/System/Directory/Internal/Windows.hsc @@ -407,10 +407,13 @@ foreign import WINAPI unsafe "windows.h CreateSymbolicLinkW" where unsupportedErrorMsg = "Not supported on Windows XP or older" #endif -createSymbolicLink :: Bool -> String -> String -> IO () -createSymbolicLink isDir target link = do - -- toExtendedLengthPath ensures the target gets normalised properly - win32_createSymbolicLink link (normaliseSeparators target) isDir +createSymbolicLink :: Bool -> FilePath -> FilePath -> IO () +createSymbolicLink isDir target link = + (`ioeSetFileName` link) `modifyIOError` do + -- normaliseSeparators ensures the target gets normalised properly + win32_createSymbolicLink (toExtendedLengthPath link) + (normaliseSeparators target) + isDir foreign import ccall unsafe "_wchmod" c_wchmod :: CWString -> CMode -> IO CInt diff --git a/changelog.md b/changelog.md index f528faf..30ba3c7 100644 --- a/changelog.md +++ b/changelog.md @@ -6,6 +6,16 @@ Changelog for the [`directory`][1] package * Fix a bug where `createFileLink` and `createDirectoryLink` failed to handle `..` in absolute paths. + * Improve support (partially) for paths longer than 260 characters on + Windows. To achieve this, many functions will now automatically prepend + `\\?\` before calling the Windows API. Side effects of this change: + * After calling `setCurrentDirectory`, calls to the Windows API function + `GetCurrentDirectory` will return a path with the `\\?\` prefix. The + Haskell function `getCurrentDirectory` mitigates this problem by + automatically stripping the prefix. + * The `\\?\` prefix may show up in the error messages of the affected + functions. + ## 1.3.1.0 (March 2017) * `findFile` (and similar functions): when an absolute path is given, the From git at git.haskell.org Mon Apr 17 21:35:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:42 +0000 (UTC) Subject: [commit: packages/filepath] master: New release for GHC 8.2.1 (e8adbcd) Message-ID: <20170417213542.2B9223A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/filepath On branch : master Link : http://git.haskell.org/packages/filepath.git/commitdiff/e8adbcddda9f1efb65f97e61e905da3ce3874d31 >--------------------------------------------------------------- commit e8adbcddda9f1efb65f97e61e905da3ce3874d31 Author: Neil Mitchell Date: Thu Feb 2 22:10:47 2017 +0000 New release for GHC 8.2.1 >--------------------------------------------------------------- e8adbcddda9f1efb65f97e61e905da3ce3874d31 changelog.md | 4 ++++ filepath.cabal | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index cf3cfef..edecd17 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,10 @@ _Note: below all `FilePath` values are unquoted, so `\\` really means two backslashes._ +## 1.4.1.2 *Feb 2017* + + * Bundled with GHC 8.2.1 + ## 1.4.1.1 *Nov 2016* * Bundled with GHC 8.0.2 diff --git a/filepath.cabal b/filepath.cabal index 30ea4c3..51e845b 100644 --- a/filepath.cabal +++ b/filepath.cabal @@ -1,6 +1,6 @@ cabal-version: >= 1.18 name: filepath -version: 1.4.1.1 +version: 1.4.1.2 -- NOTE: Don't forget to update ./changelog.md license: BSD3 license-file: LICENSE From git at git.haskell.org Mon Apr 17 21:35:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:42 +0000 (UTC) Subject: [commit: packages/containers] zip-devel: Direct implementation of fromFunction. (ce7f531) Message-ID: <20170417213542.BECF83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branch : zip-devel Link : http://git.haskell.org/packages/containers.git/commitdiff/ce7f531605b5f2bb350f36c51a74d9ebd84ff8b6 >--------------------------------------------------------------- commit ce7f531605b5f2bb350f36c51a74d9ebd84ff8b6 Author: Milan Straka Date: Sun Dec 7 16:16:59 2014 +0100 Direct implementation of fromFunction. We avoid using Four Digit, so that elements can be added to the new Seq without forcing a large rebuild. >--------------------------------------------------------------- ce7f531605b5f2bb350f36c51a74d9ebd84ff8b6 Data/Sequence.hs | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index f7d551c..4f7eb86 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -1429,7 +1429,28 @@ mapWithIndex# f (Seq xs) = Seq $ mapWithIndexTree# (\s (Elem a) -> Elem (f s a)) -- | /O(n)/. Convert a given sequence length and a function representing that -- sequence into a sequence. fromFunction :: Int -> (Int -> a) -> Seq a -fromFunction len f = mapWithIndex (\i _ -> f i) (replicate len ()) +fromFunction len f | len < 0 = error "Data.Sequence.fromFunction called with negative len" + | len == 0 = empty + | otherwise = Seq $ create (Elem . f) 1 0 len + where + create :: (Int -> a) -> Int -> Int -> Int -> FingerTree a + create b{-tree_builder-} s{-tree_size-} i{-start_index-} trees = case trees of + 1 -> Single $ b i + 2 -> Deep (2*s) (One (b i)) Empty (One (b (i+s))) + 3 -> Deep (3*s) (Two (b i) (b (i+s))) Empty (One (b (i+2*s))) + 4 -> Deep (4*s) (Two (b i) (b (i+s))) Empty (Two (b (i+2*s)) (b (i+3*s))) + 5 -> Deep (5*s) (Three (b i) (b (i+s)) (b (i+2*s))) Empty (Two (b (i+3*s)) (b (i+4*s))) + 6 -> Deep (5*s) (Three (b i) (b (i+s)) (b (i+2*s))) Empty (Three (b (i+3*s)) (b (i+4*s)) (b (i+5*s))) + _ -> case trees `quotRem` 3 of + (trees',1) -> Deep (trees*s) (Two (b i) (b (i+s))) + (create (\j -> Node3 (3*s) (b j) (b (j+s)) (b (j+2*s))) (3*s) (i+2*s) (trees'-1)) + (Two (b (i+(2+3*(trees'-1))*s)) (b (i+(3+3*(trees'-1))*s))) + (trees',2) -> Deep (trees*s) (Three (b i) (b (i+s)) (b (i+2*s))) + (create (\j -> Node3 (3*s) (b j) (b (j+s)) (b (j+2*s))) (3*s) (i+3*s) (trees'-1)) + (Two (b (i+(3+3*(trees'-1))*s)) (b (i+(4+3*(trees'-1))*s))) + (trees',0) -> Deep (trees*s) (Three (b i) (b (i+s)) (b (i+2*s))) + (create (\j -> Node3 (3*s) (b j) (b (j+s)) (b (j+2*s))) (3*s) (i+3*s) (trees'-2)) + (Three (b (i+(3+3*(trees'-2))*s)) (b (i+(4+3*(trees'-2))*s)) (b (i+(5+3*(trees'-2))*s))) -- Splitting From git at git.haskell.org Mon Apr 17 21:35:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:42 +0000 (UTC) Subject: [commit: packages/directory] master: Bump .cabal version (b6da28b) Message-ID: <20170417213542.F13183A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b6da28b99d56a8d11a72fea7ae1ec2ddcf33dc28/directory >--------------------------------------------------------------- commit b6da28b99d56a8d11a72fea7ae1ec2ddcf33dc28 Author: Phil Ruffwind Date: Sun Mar 5 06:43:01 2017 -0500 Bump .cabal version >--------------------------------------------------------------- b6da28b99d56a8d11a72fea7ae1ec2ddcf33dc28 directory.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/directory.cabal b/directory.cabal index 3f73c9a..0fabc6a 100644 --- a/directory.cabal +++ b/directory.cabal @@ -1,5 +1,5 @@ name: directory -version: 1.3.1.0 +version: 1.3.1.1 -- NOTE: Don't forget to update ./changelog.md license: BSD3 license-file: LICENSE From git at git.haskell.org Mon Apr 17 21:35:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:44 +0000 (UTC) Subject: [commit: packages/filepath] master: Test with GHC 8.0.2 (141cddb) Message-ID: <20170417213544.31B743A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/filepath On branch : master Link : http://git.haskell.org/packages/filepath.git/commitdiff/141cddb606fd6f6a60f730fed3d57502b93c14ae >--------------------------------------------------------------- commit 141cddb606fd6f6a60f730fed3d57502b93c14ae Author: Neil Mitchell Date: Thu Feb 2 22:13:54 2017 +0000 Test with GHC 8.0.2 >--------------------------------------------------------------- 141cddb606fd6f6a60f730fed3d57502b93c14ae .travis.yml | 2 +- filepath.cabal | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6519f1e..02bdaf0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ env: - GHCVER=7.6.3 - GHCVER=7.8.4 - GHCVER=7.10.3 - - GHCVER=8.0.1 + - GHCVER=8.0.2 - GHCVER=head matrix: diff --git a/filepath.cabal b/filepath.cabal index 51e845b..93d6405 100644 --- a/filepath.cabal +++ b/filepath.cabal @@ -12,7 +12,7 @@ homepage: https://github.com/haskell/filepath#readme category: System build-type: Simple synopsis: Library for manipulating FilePaths in a cross platform way. -tested-with: GHC==8.0.1, GHC==7.10.3, GHC==7.8.4, GHC==7.6.3, GHC==7.4.2 +tested-with: GHC==8.0.2, GHC==7.10.3, GHC==7.8.4, GHC==7.6.3, GHC==7.4.2 description: This package provides functionality for manipulating @FilePath@ values, and is shipped with both and the . It provides three modules: . From git at git.haskell.org Mon Apr 17 21:35:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:44 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394: Nix the Splittable class; add fromFunction (41cc152) Message-ID: <20170417213544.C8BD63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/41cc1523f99cecfd93efed16abab28eebd873abb >--------------------------------------------------------------- commit 41cc1523f99cecfd93efed16abab28eebd873abb Author: David Feuer Date: Sat Dec 6 00:23:44 2014 -0500 Nix the Splittable class; add fromFunction Write mapWithIndex using a hand-unboxed mapWithIndex#. Make `split` strict, and add an internal strict `splitAt'`. This helps `zipWith` a little. >--------------------------------------------------------------- 41cc1523f99cecfd93efed16abab28eebd873abb Data/Sequence.hs | 249 +++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 167 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 41cc1523f99cecfd93efed16abab28eebd873abb From git at git.haskell.org Mon Apr 17 21:35:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:45 +0000 (UTC) Subject: [commit: packages/directory] master: Remove withFileStatus to avoid long path restrictions (bb4ebeb) Message-ID: <20170417213545.07A093A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/bb4ebeb3f75c11d2211972d7e7511e51ecdd54c1/directory >--------------------------------------------------------------- commit bb4ebeb3f75c11d2211972d7e7511e51ecdd54c1 Author: Phil Ruffwind Date: Sun Mar 5 08:38:04 2017 -0500 Remove withFileStatus to avoid long path restrictions The implementations have been refactored to use a "Metadata"-based interface, inspired by the Rust standard library. It's essentially a portable version of 'stat'. So far, this interface will remain internal, but it might become public someday. The permissions-related functions still need to be cleaned up, however. They are one of the last remaining places that do not support long paths on Windows. >--------------------------------------------------------------- bb4ebeb3f75c11d2211972d7e7511e51ecdd54c1 System/Directory.hs | 163 ++++++++++------------------------ System/Directory/Internal.hs | 14 +-- System/Directory/Internal/Common.hs | 7 ++ System/Directory/Internal/Posix.hsc | 22 +++++ System/Directory/Internal/Windows.hsc | 57 +++++++++--- directory.cabal | 1 + 6 files changed, 128 insertions(+), 136 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc bb4ebeb3f75c11d2211972d7e7511e51ecdd54c1 From git at git.haskell.org Mon Apr 17 21:35:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:46 +0000 (UTC) Subject: [commit: packages/filepath] master: Find curl in appveyor (f981a21) Message-ID: <20170417213546.37E313A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/filepath On branch : master Link : http://git.haskell.org/packages/filepath.git/commitdiff/f981a217e5555488e9cb06d9a76c24573de15859 >--------------------------------------------------------------- commit f981a217e5555488e9cb06d9a76c24573de15859 Author: Neil Mitchell Date: Wed Mar 22 20:34:34 2017 +0000 Find curl in appveyor >--------------------------------------------------------------- f981a217e5555488e9cb06d9a76c24573de15859 appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index fe96cbd..7108552 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,6 +4,7 @@ cache: build: off before_test: +- set PATH=C:\Program Files\Git\mingw64\bin;%PATH% # for curl - curl -ostack.zip -L --insecure http://www.stackage.org/stack/windows-i386 - 7z x stack.zip stack.exe From git at git.haskell.org Mon Apr 17 21:35:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:46 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Simplify zipWith3 and zipWith4 to reduce code size (58f3597) Message-ID: <20170417213546.D18603A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/58f359787438f18dc7fbfe25f115654bd28ac94b >--------------------------------------------------------------- commit 58f359787438f18dc7fbfe25f115654bd28ac94b Author: David Feuer Date: Wed Dec 10 18:33:27 2014 -0500 Simplify zipWith3 and zipWith4 to reduce code size The performance impact isn't worth the code blowup. Also, fix a bug in `fromFunction`. >--------------------------------------------------------------- 58f359787438f18dc7fbfe25f115654bd28ac94b Data/Sequence.hs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 29a19b3..62d76b3 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -1382,7 +1382,7 @@ fromFunction len f | len < 0 = error "Data.Sequence.fromFunction called with neg 3 -> Deep (3*s) (Two (b i) (b (i+s))) Empty (One (b (i+2*s))) 4 -> Deep (4*s) (Two (b i) (b (i+s))) Empty (Two (b (i+2*s)) (b (i+3*s))) 5 -> Deep (5*s) (Three (b i) (b (i+s)) (b (i+2*s))) Empty (Two (b (i+3*s)) (b (i+4*s))) - 6 -> Deep (5*s) (Three (b i) (b (i+s)) (b (i+2*s))) Empty (Three (b (i+3*s)) (b (i+4*s)) (b (i+5*s))) + 6 -> Deep (6*s) (Three (b i) (b (i+s)) (b (i+2*s))) Empty (Three (b (i+3*s)) (b (i+4*s)) (b (i+5*s))) _ -> case trees `quotRem` 3 of (trees',1) -> Deep (trees*s) (Two (b i) (b (i+s))) (create (\j -> Node3 (3*s) (b j) (b (j+s)) (b (j+2*s))) (3*s) (i+2*s) (trees'-1)) @@ -1937,12 +1937,16 @@ zip = zipWith (,) -- For example, @zipWith (+)@ is applied to two sequences to take the -- sequence of corresponding sums. zipWith :: (a -> b -> c) -> Seq a -> Seq b -> Seq c -zipWith f s1 s2 = splitMap splitAt' (\s a -> f a (getSingleton s)) s2' s1' +zipWith f s1 s2 = zipWith' f s1' s2' where minLen = min (length s1) (length s2) s1' = take minLen s1 s2' = take minLen s2 +-- | A version of zipWith that assumes the sequences have the same length. +zipWith' :: (a -> b -> c) -> Seq a -> Seq b -> Seq c +zipWith' f s1 s2 = splitMap splitAt' (\s a -> f a (getSingleton s)) s2 s1 + -- | /O(min(n1,n2,n3))/. 'zip3' takes three sequences and returns a -- sequence of triples, analogous to 'zip'. zip3 :: Seq a -> Seq b -> Seq c -> Seq (a,b,c) @@ -1952,14 +1956,16 @@ zip3 = zipWith3 (,,) -- three elements, as well as three sequences and returns a sequence of -- their point-wise combinations, analogous to 'zipWith'. zipWith3 :: (a -> b -> c -> d) -> Seq a -> Seq b -> Seq c -> Seq d -zipWith3 f s1 s2 s3 = splitMap (\i (s,t) -> case (splitAt' i s, splitAt' i t) of ((s', s''), (t', t'')) -> ((s',t'),(s'',t''))) - (\(b,c) a -> f a (getSingleton b) (getSingleton c)) (s2',s3') s1' +zipWith3 f s1 s2 s3 = zipWith' ($) (zipWith' f s1' s2') s3' where minLen = minimum [length s1, length s2, length s3] s1' = take minLen s1 s2' = take minLen s2 s3' = take minLen s3 +zipWith3' :: (a -> b -> c -> d) -> Seq a -> Seq b -> Seq c -> Seq d +zipWith3' f s1 s2 s3 = zipWith' ($) (zipWith' f s1 s2) s3 + -- | /O(min(n1,n2,n3,n4))/. 'zip4' takes four sequences and returns a -- sequence of quadruples, analogous to 'zip'. zip4 :: Seq a -> Seq b -> Seq c -> Seq d -> Seq (a,b,c,d) @@ -1969,8 +1975,7 @@ zip4 = zipWith4 (,,,) -- four elements, as well as four sequences and returns a sequence of -- their point-wise combinations, analogous to 'zipWith'. zipWith4 :: (a -> b -> c -> d -> e) -> Seq a -> Seq b -> Seq c -> Seq d -> Seq e -zipWith4 f s1 s2 s3 s4 = splitMap (\i (s,t,u) -> case (splitAt' i s, splitAt' i t, splitAt' i u) of ((s',s''),(t',t''),(u',u'')) -> ((s',t',u'),(s'',t'',u''))) - (\(b, c, d) a -> f a (getSingleton b) (getSingleton c) (getSingleton d)) (s2',s3',s4') s1' +zipWith4 f s1 s2 s3 s4 = zipWith' ($) (zipWith3' f s1' s2' s3') s4' where minLen = minimum [length s1, length s2, length s3, length s4] s1' = take minLen s1 From git at git.haskell.org Mon Apr 17 21:35:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:47 +0000 (UTC) Subject: [commit: packages/directory] master: Revert long path support for setCurrentDirectory (2d43c13) Message-ID: <20170417213547.0E6483A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2d43c136586505e85b46d21f9ed1a46788411ae7/directory >--------------------------------------------------------------- commit 2d43c136586505e85b46d21f9ed1a46788411ae7 Author: Phil Ruffwind Date: Mon Mar 6 02:06:03 2017 -0500 Revert long path support for setCurrentDirectory SetCurrentDirectoryW does not accept long paths even with the \\?\ prefix, despite what the MSDN says. It's probably best to revert the change to reduce the risk of breakage. Still, getCurrentDirectory gets to keep the fromExtendedLengthPath postprocessing, in case the user sets to a path with \\?\. The presence of \\?\ in paths can cause surprises so it's best to strip it. https://ghc.haskell.org/trac/ghc/ticket/13373#comment:6 >--------------------------------------------------------------- 2d43c136586505e85b46d21f9ed1a46788411ae7 System/Directory.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/System/Directory.hs b/System/Directory.hs index f83838f..94c7549 100644 --- a/System/Directory.hs +++ b/System/Directory.hs @@ -1479,8 +1479,9 @@ getCurrentDirectory = setCurrentDirectory :: FilePath -> IO () setCurrentDirectory path = do #ifdef mingw32_HOST_OS - (`ioeSetFileName` path) `modifyIOError` do - Win32.setCurrentDirectory (toExtendedLengthPath path) + -- SetCurrentDirectory does not support long paths even with the \\?\ prefix + -- https://ghc.haskell.org/trac/ghc/ticket/13373#comment:6 + Win32.setCurrentDirectory path #else Posix.changeWorkingDirectory path #endif From git at git.haskell.org Mon Apr 17 21:35:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:48 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Revert the fromFunction shallowing (d8c9008) Message-ID: <20170417213548.DB1AC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/d8c90085755397b0180a349385fdd1b1820ae1aa >--------------------------------------------------------------- commit d8c90085755397b0180a349385fdd1b1820ae1aa Author: David Feuer Date: Thu Dec 11 21:21:38 2014 -0500 Revert the fromFunction shallowing I don't actually know whether we want it shallower or "safer". Make `fromFunction` easier to read. >--------------------------------------------------------------- d8c90085755397b0180a349385fdd1b1820ae1aa Data/Sequence.hs | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 62d76b3..f3fbbe7 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -1374,25 +1374,29 @@ fromFunction len f | len < 0 = error "Data.Sequence.fromFunction called with neg #else | otherwise = Seq $ create (Elem . f) 1 0 len #endif - where - create :: (Int -> a) -> Int -> Int -> Int -> FingerTree a - create b{-tree_builder-} s{-tree_size-} i{-start_index-} trees = i `seq` s `seq` case trees of - 1 -> Single $ b i - 2 -> Deep (2*s) (One (b i)) Empty (One (b (i+s))) - 3 -> Deep (3*s) (Two (b i) (b (i+s))) Empty (One (b (i+2*s))) - 4 -> Deep (4*s) (Two (b i) (b (i+s))) Empty (Two (b (i+2*s)) (b (i+3*s))) - 5 -> Deep (5*s) (Three (b i) (b (i+s)) (b (i+2*s))) Empty (Two (b (i+3*s)) (b (i+4*s))) - 6 -> Deep (6*s) (Three (b i) (b (i+s)) (b (i+2*s))) Empty (Three (b (i+3*s)) (b (i+4*s)) (b (i+5*s))) - _ -> case trees `quotRem` 3 of - (trees',1) -> Deep (trees*s) (Two (b i) (b (i+s))) - (create (\j -> Node3 (3*s) (b j) (b (j+s)) (b (j+2*s))) (3*s) (i+2*s) (trees'-1)) - (Two (b (i+(2+3*(trees'-1))*s)) (b (i+(3+3*(trees'-1))*s))) - (trees',2) -> Deep (trees*s) (Three (b i) (b (i+s)) (b (i+2*s))) - (create (\j -> Node3 (3*s) (b j) (b (j+s)) (b (j+2*s))) (3*s) (i+3*s) (trees'-1)) - (Two (b (i+(3+3*(trees'-1))*s)) (b (i+(4+3*(trees'-1))*s))) - (trees',0) -> Deep (trees*s) (Three (b i) (b (i+s)) (b (i+2*s))) - (create (\j -> Node3 (3*s) (b j) (b (j+s)) (b (j+2*s))) (3*s) (i+3*s) (trees'-2)) - (Three (b (i+(3+3*(trees'-2))*s)) (b (i+(4+3*(trees'-2))*s)) (b (i+(5+3*(trees'-2))*s))) + where + create :: (Int -> a) -> Int -> Int -> Int -> FingerTree a + create b{-tree_builder-} s{-tree_size-} i{-start_index-} trees = i `seq` s `seq` case trees of + 1 -> Single $ b i + 2 -> Deep (2*s) (One (b i)) Empty (One (b (i+s))) + 3 -> Deep (3*s) (createTwo b s i) Empty (One (b (i+2*s))) + 4 -> Deep (4*s) (createTwo b s i) Empty (createTwo b s (i+2*s)) + 5 -> Deep (5*s) (createThree b s i) Empty (createTwo b s (i+3*s)) + 6 -> Deep (6*s) (createThree b s i) Empty (createThree b s (i+3*s)) + _ -> case trees `quotRem` 3 of + (trees', 1) -> Deep (trees*s) (createTwo b s i) + (create mb (3*s) (i+2*s) (trees'-1)) + (createTwo b s (i+(2+3*(trees'-1))*s)) + (trees', 2) -> Deep (trees*s) (createThree b s i) + (create mb (3*s) (i+3*s) (trees'-1)) + (createTwo b s (i+(3+3*(trees'-1))*s)) + (trees', 0) -> Deep (trees*s) (createThree b s i) + (create mb (3*s) (i+3*s) (trees'-2)) + (createThree b s (i+(3+3*(trees'-2))*s)) + where + createTwo b s i = Two (b i) (b (i + s)) + createThree b s i = Three (b i) (b (i + s)) (b (i + s + s)) + mb j = Node3 (3*s) (b j) (b (j + s)) (b (j + 2*s)) -- Splitting From git at git.haskell.org Mon Apr 17 21:35:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:49 +0000 (UTC) Subject: [commit: packages/directory] master: Add tests for long path support (b580ff4) Message-ID: <20170417213549.163A13A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b580ff43d570595a155b67964b882ef02c3f491f/directory >--------------------------------------------------------------- commit b580ff43d570595a155b67964b882ef02c3f491f Author: Phil Ruffwind Date: Mon Mar 6 02:05:12 2017 -0500 Add tests for long path support >--------------------------------------------------------------- b580ff43d570595a155b67964b882ef02c3f491f directory.cabal | 1 + tests/LongPaths.hs | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/Main.hs | 2 ++ 3 files changed, 56 insertions(+) diff --git a/directory.cabal b/directory.cabal index 6847b71..c1df9af 100644 --- a/directory.cabal +++ b/directory.cabal @@ -98,6 +98,7 @@ test-suite test GetFileSize GetHomeDirectory001 GetPermissions001 + LongPaths MakeAbsolute PathIsSymbolicLink RemoveDirectoryRecursive001 diff --git a/tests/LongPaths.hs b/tests/LongPaths.hs new file mode 100644 index 0000000..cfec3ee --- /dev/null +++ b/tests/LongPaths.hs @@ -0,0 +1,53 @@ +{-# LANGUAGE CPP #-} +module LongPaths where +#include "util.inl" +import TestUtils +import System.FilePath (()) + +main :: TestEnv -> IO () +main _t = do + let longName = mconcat (replicate 5 "thisisaverylongdirectoryname") + longDir <- makeAbsolute (longName longName) + + supportsLongPaths <- do + -- create 2 dirs because 1 path segment by itself can't exceed MAX_PATH + -- tests: [createDirectory] + createDirectory =<< makeAbsolute longName + createDirectory longDir + return True + `catchIOError` \ _ -> + return False + + -- skip tests on file systems that do not support long paths + when supportsLongPaths $ do + + writeFile "foobar.txt" "^.^" -- writeFile does not support long paths yet + + -- tests: [renamePath], [copyFileWithMetadata] + renamePath "foobar.txt" (longDir "foobar_tmp.txt") + renamePath (longDir "foobar_tmp.txt") (longDir "foobar.txt") + copyFileWithMetadata (longDir "foobar.txt") + (longDir "foobar_copy.txt") + + -- tests: [doesDirectoryExist], [doesFileExist], [doesPathExist] + T(expect) () =<< doesDirectoryExist longDir + T(expect) () =<< doesFileExist (longDir "foobar.txt") + T(expect) () =<< doesPathExist longDir + T(expect) () =<< doesPathExist (longDir "foobar.txt") + + -- tests: [getFileSize], [getModificationTime] + T(expectEq) () 3 =<< getFileSize (longDir "foobar.txt") + _ <- getModificationTime (longDir "foobar.txt") + + supportsSymbolicLinks <- supportsSymlinks + when supportsSymbolicLinks $ do + + -- tests: [createDirectoryLink], [getSymbolicLinkTarget] + -- also tests expansion of "." and ".." + createDirectoryLink "." (longDir "link") + _ <- listDirectory (longDir ".." longName "link") + T(expectEq) () "." =<< getSymbolicLinkTarget (longDir "." "link") + + return () + + -- [removeFile], [removeDirectory] are automatically tested by the cleanup diff --git a/tests/Main.hs b/tests/Main.hs index 1e17b68..52cf0fb 100644 --- a/tests/Main.hs +++ b/tests/Main.hs @@ -17,6 +17,7 @@ import qualified GetDirContents002 import qualified GetFileSize import qualified GetHomeDirectory001 import qualified GetPermissions001 +import qualified LongPaths import qualified MakeAbsolute import qualified PathIsSymbolicLink import qualified RemoveDirectoryRecursive001 @@ -47,6 +48,7 @@ main = T.testMain $ \ _t -> do T.isolatedRun _t "GetFileSize" GetFileSize.main T.isolatedRun _t "GetHomeDirectory001" GetHomeDirectory001.main T.isolatedRun _t "GetPermissions001" GetPermissions001.main + T.isolatedRun _t "LongPaths" LongPaths.main T.isolatedRun _t "MakeAbsolute" MakeAbsolute.main T.isolatedRun _t "PathIsSymbolicLink" PathIsSymbolicLink.main T.isolatedRun _t "RemoveDirectoryRecursive001" RemoveDirectoryRecursive001.main From git at git.haskell.org Mon Apr 17 21:35:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:50 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Rename strictness tests to match other test names. (7e42d81) Message-ID: <20170417213550.E31733A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/7e42d81350aac6db1aa52180572a117e67b168b3 >--------------------------------------------------------------- commit 7e42d81350aac6db1aa52180572a117e67b168b3 Author: Milan Straka Date: Sun Dec 14 15:56:15 2014 +0100 Rename strictness tests to match other test names. >--------------------------------------------------------------- 7e42d81350aac6db1aa52180572a117e67b168b3 containers.cabal | 4 ++-- tests/{IntMapStrictness.hs => intmap-strictness.hs} | 0 tests/{MapStrictness.hs => map-strictness.hs} | 0 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/containers.cabal b/containers.cabal index 050257c..ae7e247 100644 --- a/containers.cabal +++ b/containers.cabal @@ -211,7 +211,7 @@ Test-suite seq-properties test-suite map-strictness-properties hs-source-dirs: tests, . - main-is: MapStrictness.hs + main-is: map-strictness.hs type: exitcode-stdio-1.0 build-depends: @@ -228,7 +228,7 @@ test-suite map-strictness-properties test-suite intmap-strictness-properties hs-source-dirs: tests, . - main-is: IntMapStrictness.hs + main-is: intmap-strictness.hs type: exitcode-stdio-1.0 build-depends: diff --git a/tests/IntMapStrictness.hs b/tests/intmap-strictness.hs similarity index 100% rename from tests/IntMapStrictness.hs rename to tests/intmap-strictness.hs diff --git a/tests/MapStrictness.hs b/tests/map-strictness.hs similarity index 100% rename from tests/MapStrictness.hs rename to tests/map-strictness.hs From git at git.haskell.org Mon Apr 17 21:35:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:51 +0000 (UTC) Subject: [commit: packages/directory] master: Use fILE_ATTRIBUTE_REPARSE_POINT from Win32 when available (e6b3ac7) Message-ID: <20170417213551.1CD1E3A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e6b3ac7f73d6e20a98e61623994f1fb782897621/directory >--------------------------------------------------------------- commit e6b3ac7f73d6e20a98e61623994f1fb782897621 Author: Phil Ruffwind Date: Mon Mar 6 22:51:55 2017 -0500 Use fILE_ATTRIBUTE_REPARSE_POINT from Win32 when available Could also use createSymbolicLink from Win32, but then it would be hard figure out what the error code was :/ >--------------------------------------------------------------- e6b3ac7f73d6e20a98e61623994f1fb782897621 System/Directory/Internal/Windows.hsc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/System/Directory/Internal/Windows.hsc b/System/Directory/Internal/Windows.hsc index 338db8b..b3da63e 100644 --- a/System/Directory/Internal/Windows.hsc +++ b/System/Directory/Internal/Windows.hsc @@ -39,7 +39,11 @@ win32_eRROR_INVALID_FUNCTION :: Win32.ErrCode win32_eRROR_INVALID_FUNCTION = 0x1 win32_fILE_ATTRIBUTE_REPARSE_POINT :: Win32.FileAttributeOrFlag +#if MIN_VERSION_Win32(2, 4, 0) +win32_fILE_ATTRIBUTE_REPARSE_POINT = Win32.fILE_ATTRIBUTE_REPARSE_POINT +#else win32_fILE_ATTRIBUTE_REPARSE_POINT = (#const FILE_ATTRIBUTE_REPARSE_POINT) +#endif win32_fILE_SHARE_DELETE :: Win32.ShareMode #if MIN_VERSION_Win32(2, 3, 1) From git at git.haskell.org Mon Apr 17 21:35:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:52 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Use pre-evaluated sequences in benchmarks. (999851e) Message-ID: <20170417213552.EAF133A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/999851e33acde2db08b06cf8d0331f37bbeb3c0b >--------------------------------------------------------------- commit 999851e33acde2db08b06cf8d0331f37bbeb3c0b Author: Milan Straka Date: Sun Dec 14 16:26:42 2014 +0100 Use pre-evaluated sequences in benchmarks. >--------------------------------------------------------------- 999851e33acde2db08b06cf8d0331f37bbeb3c0b benchmarks/Sequence.hs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/benchmarks/Sequence.hs b/benchmarks/Sequence.hs index ccaca6c..8fd1fcf 100644 --- a/benchmarks/Sequence.hs +++ b/benchmarks/Sequence.hs @@ -12,13 +12,20 @@ main = do let s10 = S.fromList [1..10] :: S.Seq Int s100 = S.fromList [1..100] :: S.Seq Int s1000 = S.fromList [1..1000] :: S.Seq Int - rnf [s10, s100, s1000] `seq` return () + s10000 = S.fromList [1..10000] :: S.Seq Int + rnf [s10, s100, s1000, s10000] `seq` return () let g = mkStdGen 1 let rlist n = map (`mod` (n+1)) (take 10000 (randoms g)) :: [Int] r10 = rlist 10 r100 = rlist 100 r1000 = rlist 1000 - rnf [r10, r100, r1000] `seq` return () + r10000 = rlist 10000 + rnf [r10, r100, r1000, r10000] `seq` return () + let u10 = S.replicate 10 () :: S.Seq () + u100 = S.replicate 100 () :: S.Seq () + u1000 = S.replicate 1000 () :: S.Seq () + u10000 = S.replicate 10000 () :: S.Seq () + rnf [u10, u100, u1000, u10000] `seq` return () defaultMain [ bgroup "splitAt/append" [ bench "10" $ nf (shuffle r10) s10 @@ -26,9 +33,9 @@ main = do , bench "1000" $ nf (shuffle r1000) s1000 ] , bgroup "zip" - [ bench "ix10000/5000" $ nf (\(xs,ys) -> S.zip xs ys `S.index` 5000) (S.replicate 10000 (), S.fromList [1..10000::Int]) - , bench "nf150" $ nf (uncurry S.zip) (S.fromList [1..150::Int], S.replicate 150 ()) - , bench "nf10000" $ nf (uncurry S.zip) (S.fromList [1..10000::Int], S.replicate 10000 ()) + [ bench "ix10000/5000" $ nf (\(xs,ys) -> S.zip xs ys `S.index` 5000) (s10000, u10000) + , bench "nf100" $ nf (uncurry S.zip) (s100, u100) + , bench "nf10000" $ nf (uncurry S.zip) (s10000, u10000) ] ] -- splitAt+append: repeatedly cut the sequence at a random point From git at git.haskell.org Mon Apr 17 21:35:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:53 +0000 (UTC) Subject: [commit: packages/directory] master: Migrate getFileTimes to the Metadata interface (5eb35cf) Message-ID: <20170417213553.282F53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5eb35cfd7068a13aedb0222177b1f7d31606eaa6/directory >--------------------------------------------------------------- commit 5eb35cfd7068a13aedb0222177b1f7d31606eaa6 Author: Phil Ruffwind Date: Mon Mar 6 22:29:08 2017 -0500 Migrate getFileTimes to the Metadata interface >--------------------------------------------------------------- 5eb35cfd7068a13aedb0222177b1f7d31606eaa6 System/Directory.hs | 81 ++++++----------------------------- System/Directory/Internal/Posix.hsc | 27 +++++++++++- System/Directory/Internal/Windows.hsc | 40 +++++++++++++++-- 3 files changed, 75 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 5eb35cfd7068a13aedb0222177b1f7d31606eaa6 From git at git.haskell.org Mon Apr 17 21:35:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:54 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Update URL of the fingertree paper. (7ffc123) Message-ID: <20170417213554.F3BE03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/7ffc123000d82a676a23e0ce5e916a871598610f >--------------------------------------------------------------- commit 7ffc123000d82a676a23e0ce5e916a871598610f Author: Milan Straka Date: Sun Dec 14 16:40:11 2014 +0100 Update URL of the fingertree paper. >--------------------------------------------------------------- 7ffc123000d82a676a23e0ce5e916a871598610f Data/Sequence.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index f3fbbe7..9f3f543 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -40,7 +40,7 @@ -- * Ralf Hinze and Ross Paterson, -- \"Finger trees: a simple general-purpose data structure\", -- /Journal of Functional Programming/ 16:2 (2006) pp 197-217. --- +-- -- -- /Note/: Many of these operations have the same names as similar -- operations on lists in the "Prelude". The ambiguity may be resolved From git at git.haskell.org Mon Apr 17 21:35:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:55 +0000 (UTC) Subject: [commit: packages/directory] master: Add tests for setPermissions (b03d55f) Message-ID: <20170417213555.2E15E3A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b03d55f8815a1ae2bc406d5da99c825f63a91a52/directory >--------------------------------------------------------------- commit b03d55f8815a1ae2bc406d5da99c825f63a91a52 Author: Phil Ruffwind Date: Tue Mar 7 00:51:51 2017 -0500 Add tests for setPermissions >--------------------------------------------------------------- b03d55f8815a1ae2bc406d5da99c825f63a91a52 tests/GetPermissions001.hs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/GetPermissions001.hs b/tests/GetPermissions001.hs index 045d35d..c94288f 100644 --- a/tests/GetPermissions001.hs +++ b/tests/GetPermissions001.hs @@ -1,6 +1,7 @@ {-# LANGUAGE CPP #-} module GetPermissions001 where #include "util.inl" +import TestUtils main :: TestEnv -> IO () main _t = do @@ -10,6 +11,20 @@ main _t = do checkOrdinary checkTrailingSlash + -- 'writable' is the only permission that can be changed on Windows + writeFile "foo.txt" "" + foo <- makeAbsolute "foo.txt" + modifyPermissions "foo.txt" (\ p -> p { writable = False }) + T(expect) () =<< not . writable <$> getPermissions "foo.txt" + modifyPermissions "foo.txt" (\ p -> p { writable = True }) + T(expect) () =<< writable <$> getPermissions "foo.txt" + modifyPermissions "foo.txt" (\ p -> p { writable = False }) + T(expect) () =<< not . writable <$> getPermissions "foo.txt" + modifyPermissions foo (\ p -> p { writable = True }) + T(expect) () =<< writable <$> getPermissions foo + modifyPermissions foo (\ p -> p { writable = False }) + T(expect) () =<< not . writable <$> getPermissions foo + where checkCurrentDir = do From git at git.haskell.org Mon Apr 17 21:35:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:57 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Add test for fromFunction. (61eeeec) Message-ID: <20170417213557.089E13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/61eeeec856e39108ba3d5cb4251b249acc782305 >--------------------------------------------------------------- commit 61eeeec856e39108ba3d5cb4251b249acc782305 Author: Milan Straka Date: Sun Dec 14 16:49:49 2014 +0100 Add test for fromFunction. >--------------------------------------------------------------- 61eeeec856e39108ba3d5cb4251b249acc782305 tests/seq-properties.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/seq-properties.hs b/tests/seq-properties.hs index 74b2e9c..14d5a5f 100644 --- a/tests/seq-properties.hs +++ b/tests/seq-properties.hs @@ -36,6 +36,7 @@ main = defaultMain , testProperty "(|>)" prop_snoc , testProperty "(><)" prop_append , testProperty "fromList" prop_fromList + , testProperty "fromFunction" prop_fromFunction , testProperty "replicate" prop_replicate , testProperty "replicateA" prop_replicateA , testProperty "replicateM" prop_replicateM @@ -270,6 +271,10 @@ prop_fromList :: [A] -> Bool prop_fromList xs = toList' (fromList xs) ~= xs +prop_fromFunction :: [A] -> Bool +prop_fromFunction xs = + toList' (fromFunction (Prelude.length xs) (xs!!)) ~= xs + -- ** Repetition prop_replicate :: NonNegative Int -> A -> Bool From git at git.haskell.org Mon Apr 17 21:35:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:57 +0000 (UTC) Subject: [commit: packages/directory] master: Refactor permissions implementation (00e4eda) Message-ID: <20170417213557.382853A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/00e4edaac522bd74f8f1e049997b50596f57ce5a/directory >--------------------------------------------------------------- commit 00e4edaac522bd74f8f1e049997b50596f57ce5a Author: Phil Ruffwind Date: Tue Mar 7 04:20:50 2017 -0500 Refactor permissions implementation Permissions on Windows have been simplified to use the underlying Windows API calls rather than the pseudo-POSIX interface (which chokes on long paths). The metadata API has been extended slightly to allow handling of raw permission bits (Mode). Unfortunately, we can't take full advantage of it because the existing permissions API is really quirky and inconsistent and we have to maintain compatibility. It's also unclear what the ideal mapping between "rwes" and "rwxrwxrwx" should be. No changes in the semantics of the permissions have been introduced. >--------------------------------------------------------------- 00e4edaac522bd74f8f1e049997b50596f57ce5a System/Directory.hs | 171 ++++++++++------------------------ System/Directory/Internal/Common.hs | 16 ++++ System/Directory/Internal/Posix.hsc | 50 ++++++++++ System/Directory/Internal/Prelude.hs | 12 +-- System/Directory/Internal/Windows.hsc | 59 ++++++++---- 5 files changed, 160 insertions(+), 148 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 00e4edaac522bd74f8f1e049997b50596f57ce5a From git at git.haskell.org Mon Apr 17 21:35:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:57 +0000 (UTC) Subject: [commit: packages/filepath] tag 'v1.4.1.2' created Message-ID: <20170417213557.6C8783A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/filepath New tag : v1.4.1.2 Referencing: 2ace409df35bb9b40bd75254c5975ff4dab97dd1 From git at git.haskell.org Mon Apr 17 21:35:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:59 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Fix warnings. (610ebfb) Message-ID: <20170417213559.111873A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/610ebfbe4eecfb04886ed87691aeb65869ee0445 >--------------------------------------------------------------- commit 610ebfbe4eecfb04886ed87691aeb65869ee0445 Author: Milan Straka Date: Mon Dec 15 07:41:55 2014 +0100 Fix warnings. >--------------------------------------------------------------- 610ebfbe4eecfb04886ed87691aeb65869ee0445 Data/Sequence.hs | 48 ++++++++++++++++++++++-------------------------- 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 9f3f543..d85cab6 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -164,9 +164,9 @@ import Data.Functor (Functor(..)) import Data.Foldable (Foldable(foldl, foldl1, foldr, foldr1, foldMap, foldl', foldr', toList)) #else #if MIN_VERSION_base(4,6,0) -import Data.Foldable (Foldable(foldl, foldl1, foldr, foldr1, foldMap, foldl', foldr'), toList) +import Data.Foldable (Foldable(foldl, foldl1, foldr, foldr1, foldMap, foldl'), toList) #else -import Data.Foldable (Foldable(foldl, foldl1, foldr, foldr1, foldMap), foldl', foldr', toList) +import Data.Foldable (Foldable(foldl, foldl1, foldr, foldr1, foldMap), foldl', toList) #endif #endif import Data.Traversable @@ -180,6 +180,7 @@ import Data.Data #endif #if __GLASGOW_HASKELL__ >= 708 import Data.Coerce +import qualified GHC.Exts #define COERCE coerce #else #ifdef __GLASGOW_HASKELL__ @@ -192,9 +193,6 @@ import qualified Unsafe.Coerce #if MIN_VERSION_base(4,8,0) import Data.Functor.Identity (Identity(..)) #endif -#ifdef __GLASGOW_HASKELL__ -import qualified GHC.Exts -#endif infixr 5 `consTree` infixl 5 `snocTree` @@ -246,6 +244,8 @@ instance Foldable Seq where {-# INLINE length #-} null = null {-# INLINE null #-} + toList = toList + {-# INLINE toList #-} #endif instance Traversable Seq where @@ -611,10 +611,6 @@ instance Applicative (State s) where execState :: State s a -> s -> a execState m x = snd (runState m x) --- | A helper method: a strict version of mapAccumL. -mapAccumL' :: Traversable t => (a -> b -> (a, c)) -> a -> t b -> (a, t c) -mapAccumL' f s t = runState (traverse (State . flip f) t) s - -- | 'applicativeTree' takes an Applicative-wrapped construction of a -- piece of a FingerTree, assumed to always have the same size (which -- is put in the second argument), and replicates it as many times as @@ -1305,12 +1301,12 @@ adjustDigit f i (Four a b c d) -- function that also depends on the element's index, and applies it to every -- element in the sequence. mapWithIndex :: (Int -> a -> b) -> Seq a -> Seq b -mapWithIndex f (Seq xs) = Seq $ mapWithIndexTree (\s (Elem a) -> Elem (f s a)) 0 xs +mapWithIndex f' (Seq xs') = Seq $ mapWithIndexTree (\s (Elem a) -> Elem (f' s a)) 0 xs' where {-# SPECIALIZE mapWithIndexTree :: (Int -> Elem y -> b) -> Int -> FingerTree (Elem y) -> FingerTree b #-} {-# SPECIALIZE mapWithIndexTree :: (Int -> Node y -> b) -> Int -> FingerTree (Node y) -> FingerTree b #-} mapWithIndexTree :: Sized a => (Int -> a -> b) -> Int -> FingerTree a -> FingerTree b - mapWithIndexTree _f s Empty = s `seq` Empty + mapWithIndexTree _ s Empty = s `seq` Empty mapWithIndexTree f s (Single xs) = Single $ f s xs mapWithIndexTree f s (Deep n pr m sf) = sPspr `seq` sPsprm `seq` Deep n @@ -1379,23 +1375,23 @@ fromFunction len f | len < 0 = error "Data.Sequence.fromFunction called with neg create b{-tree_builder-} s{-tree_size-} i{-start_index-} trees = i `seq` s `seq` case trees of 1 -> Single $ b i 2 -> Deep (2*s) (One (b i)) Empty (One (b (i+s))) - 3 -> Deep (3*s) (createTwo b s i) Empty (One (b (i+2*s))) - 4 -> Deep (4*s) (createTwo b s i) Empty (createTwo b s (i+2*s)) - 5 -> Deep (5*s) (createThree b s i) Empty (createTwo b s (i+3*s)) - 6 -> Deep (6*s) (createThree b s i) Empty (createThree b s (i+3*s)) + 3 -> Deep (3*s) (createTwo i) Empty (One (b (i+2*s))) + 4 -> Deep (4*s) (createTwo i) Empty (createTwo (i+2*s)) + 5 -> Deep (5*s) (createThree i) Empty (createTwo (i+3*s)) + 6 -> Deep (6*s) (createThree i) Empty (createThree (i+3*s)) _ -> case trees `quotRem` 3 of - (trees', 1) -> Deep (trees*s) (createTwo b s i) + (trees', 1) -> Deep (trees*s) (createTwo i) (create mb (3*s) (i+2*s) (trees'-1)) - (createTwo b s (i+(2+3*(trees'-1))*s)) - (trees', 2) -> Deep (trees*s) (createThree b s i) + (createTwo (i+(2+3*(trees'-1))*s)) + (trees', 2) -> Deep (trees*s) (createThree i) (create mb (3*s) (i+3*s) (trees'-1)) - (createTwo b s (i+(3+3*(trees'-1))*s)) - (trees', 0) -> Deep (trees*s) (createThree b s i) + (createTwo (i+(3+3*(trees'-1))*s)) + (trees', _) -> Deep (trees*s) (createThree i) (create mb (3*s) (i+3*s) (trees'-2)) - (createThree b s (i+(3+3*(trees'-2))*s)) + (createThree (i+(3+3*(trees'-2))*s)) where - createTwo b s i = Two (b i) (b (i + s)) - createThree b s i = Three (b i) (b (i + s)) (b (i + s + s)) + createTwo j = Two (b j) (b (j + s)) + createThree j = Three (b j) (b (j + s)) (b (j + 2*s)) mb j = Node3 (3*s) (b j) (b (j + s)) (b (j + 2*s)) -- Splitting @@ -1884,8 +1880,8 @@ splitMap splt' = go {-# SPECIALIZE splitMapTree :: (Int -> s -> (s,s)) -> (s -> Elem y -> b) -> s -> FingerTree (Elem y) -> FingerTree b #-} {-# SPECIALIZE splitMapTree :: (Int -> s -> (s,s)) -> (s -> Node y -> b) -> s -> FingerTree (Node y) -> FingerTree b #-} splitMapTree :: Sized a => (Int -> s -> (s,s)) -> (s -> a -> b) -> s -> FingerTree a -> FingerTree b - splitMapTree splt _f _s Empty = Empty - splitMapTree splt f s (Single xs) = Single $ f s xs + splitMapTree _ _ _ Empty = Empty + splitMapTree _ f s (Single xs) = Single $ f s xs splitMapTree splt f s (Deep n pr m sf) = Deep n (splitMapDigit splt f prs pr) (splitMapTree splt (splitMapNode splt f) ms m) (splitMapDigit splt f sfs sf) where (prs, r) = splt (size pr) s @@ -1894,7 +1890,7 @@ splitMap splt' = go {-# SPECIALIZE splitMapDigit :: (Int -> s -> (s,s)) -> (s -> Elem y -> b) -> s -> Digit (Elem y) -> Digit b #-} {-# SPECIALIZE splitMapDigit :: (Int -> s -> (s,s)) -> (s -> Node y -> b) -> s -> Digit (Node y) -> Digit b #-} splitMapDigit :: Sized a => (Int -> s -> (s,s)) -> (s -> a -> b) -> s -> Digit a -> Digit b - splitMapDigit splt f s (One a) = One (f s a) + splitMapDigit _ f s (One a) = One (f s a) splitMapDigit splt f s (Two a b) = Two (f first a) (f second b) where (first, second) = splt (size a) s From git at git.haskell.org Mon Apr 17 21:35:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:35:59 +0000 (UTC) Subject: [commit: packages/directory] master: makeAbsolute: handle drive-relative paths (09656a7) Message-ID: <20170417213559.3F7163A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/09656a77a8bb5970a358310836188fd41cc6e8fd/directory >--------------------------------------------------------------- commit 09656a77a8bb5970a358310836188fd41cc6e8fd Author: Phil Ruffwind Date: Tue Mar 7 05:24:29 2017 -0500 makeAbsolute: handle drive-relative paths >--------------------------------------------------------------- 09656a77a8bb5970a358310836188fd41cc6e8fd System/Directory.hs | 11 ++++++++++- System/Directory/Internal/Prelude.hs | 2 +- changelog.md | 2 ++ tests/MakeAbsolute.hs | 13 +++++++++++++ 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/System/Directory.hs b/System/Directory.hs index 19be2dd..ef92b28 100644 --- a/System/Directory.hs +++ b/System/Directory.hs @@ -1074,7 +1074,16 @@ prependCurrentDirectory path = modifyIOError ((`ioeAddLocation` "prependCurrentDirectory") . (`ioeSetFileName` path)) $ if isRelative path -- avoid the call to `getCurrentDirectory` if we can - then ( path) <$> getCurrentDirectory + then do + cwd <- getCurrentDirectory + let curDrive = takeWhile (not . isPathSeparator) (takeDrive cwd) + let (drive, subpath) = splitDrive path + -- handle drive-relative paths (Windows only) + return . ( subpath) $ + case drive of + _ : _ | (toUpper <$> drive) /= (toUpper <$> curDrive) -> + drive <> [pathSeparator] + _ -> cwd else return path -- | Add or remove the trailing path separator in the second path so as to diff --git a/System/Directory/Internal/Prelude.hs b/System/Directory/Internal/Prelude.hs index f6ce7be..51c8067 100644 --- a/System/Directory/Internal/Prelude.hs +++ b/System/Directory/Internal/Prelude.hs @@ -69,7 +69,7 @@ import Control.Exception ) import Control.Monad ((>=>), (<=<), unless, when, replicateM_) import Data.Bits ((.&.), (.|.), complement) -import Data.Char (isAlpha, isAscii, toLower) +import Data.Char (isAlpha, isAscii, toLower, toUpper) import Data.Foldable (for_, traverse_) import Data.Function (on) import Data.Maybe (catMaybes, fromMaybe, maybeToList) diff --git a/changelog.md b/changelog.md index 30ba3c7..bb56c86 100644 --- a/changelog.md +++ b/changelog.md @@ -16,6 +16,8 @@ Changelog for the [`directory`][1] package * The `\\?\` prefix may show up in the error messages of the affected functions. + * `makeAbsolute` can now handle drive-relative paths on Windows. + ## 1.3.1.0 (March 2017) * `findFile` (and similar functions): when an absolute path is given, the diff --git a/tests/MakeAbsolute.hs b/tests/MakeAbsolute.hs index abb99c2..d3996ba 100644 --- a/tests/MakeAbsolute.hs +++ b/tests/MakeAbsolute.hs @@ -3,6 +3,9 @@ module MakeAbsolute where #include "util.inl" import System.FilePath ((), addTrailingPathSeparator, dropTrailingPathSeparator, normalise) +#ifdef mingw32_HOST_OS +import System.FilePath (takeDrive) +#endif main :: TestEnv -> IO () main _t = do @@ -31,3 +34,13 @@ main _t = do T(expectEq) () sfoo (normalise (dot "foo/")) T(expectEq) () sfoo sfoo2 T(expectEq) () sfoo sfoo3 + +#ifdef mingw32_HOST_OS + cwd <- getCurrentDirectory + let driveLetter = toUpper (head (takeDrive cwd)) + let driveLetter' = if driveLetter == 'Z' then 'A' else succ driveLetter + drp1 <- makeAbsolute (driveLetter : ":foobar") + drp2 <- makeAbsolute (driveLetter' : ":foobar") + T(expectEq) () drp1 =<< makeAbsolute "foobar" + T(expectEq) () drp2 (driveLetter' : ":\\foobar") +#endif From git at git.haskell.org Mon Apr 17 21:36:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:36:01 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Make sure the helper functions are inlined. (3e60f3a) Message-ID: <20170417213601.18F1B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/3e60f3aa337ddf670a3f20586353c539f6b49eb4 >--------------------------------------------------------------- commit 3e60f3aa337ddf670a3f20586353c539f6b49eb4 Author: Milan Straka Date: Mon Dec 15 08:15:42 2014 +0100 Make sure the helper functions are inlined. >--------------------------------------------------------------- 3e60f3aa337ddf670a3f20586353c539f6b49eb4 Data/Sequence.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index d85cab6..fa80b3f 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -1391,8 +1391,11 @@ fromFunction len f | len < 0 = error "Data.Sequence.fromFunction called with neg (createThree (i+(3+3*(trees'-2))*s)) where createTwo j = Two (b j) (b (j + s)) + {-# INLINE createTwo #-} createThree j = Three (b j) (b (j + s)) (b (j + 2*s)) + {-# INLINE createThree #-} mb j = Node3 (3*s) (b j) (b (j + s)) (b (j + 2*s)) + {-# INLINE mb #-} -- Splitting From git at git.haskell.org Mon Apr 17 21:36:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:36:01 +0000 (UTC) Subject: [commit: packages/directory] master: Refactor pathIsSymbolicLink to use Metadata interface (7794e23) Message-ID: <20170417213601.46C7B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7794e2388491059ba2d8cdce606eabbdef83b1fe/directory >--------------------------------------------------------------- commit 7794e2388491059ba2d8cdce606eabbdef83b1fe Author: Phil Ruffwind Date: Tue Mar 7 05:38:20 2017 -0500 Refactor pathIsSymbolicLink to use Metadata interface >--------------------------------------------------------------- 7794e2388491059ba2d8cdce606eabbdef83b1fe System/Directory.hs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/System/Directory.hs b/System/Directory.hs index ef92b28..7f314d5 100644 --- a/System/Directory.hs +++ b/System/Directory.hs @@ -1591,13 +1591,12 @@ pathIsSymbolicLink :: FilePath -> IO Bool pathIsSymbolicLink path = ((`ioeAddLocation` "pathIsSymbolicLink") . (`ioeSetFileName` path)) `modifyIOError` do -#ifdef mingw32_HOST_OS - isReparsePoint <$> Win32.getFileAttributes (toExtendedLengthPath path) - where - isReparsePoint attr = attr .&. win32_fILE_ATTRIBUTE_REPARSE_POINT /= 0 -#else - Posix.isSymbolicLink <$> Posix.getSymbolicLinkStatus path -#endif + m <- getSymbolicLinkMetadata path + return $ + case fileTypeFromMetadata m of + DirectoryLink -> True + SymbolicLink -> True + _ -> False {-# DEPRECATED isSymbolicLink "Use 'pathIsSymbolicLink' instead" #-} isSymbolicLink :: FilePath -> IO Bool From git at git.haskell.org Mon Apr 17 21:36:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:36:03 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Move the closing parent to a separate line. (97599c0) Message-ID: <20170417213603.210053A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/97599c082e5388551d2f8f767045b807194083fa >--------------------------------------------------------------- commit 97599c082e5388551d2f8f767045b807194083fa Author: Milan Straka Date: Mon Dec 15 08:24:34 2014 +0100 Move the closing parent to a separate line. >--------------------------------------------------------------- 97599c082e5388551d2f8f767045b807194083fa benchmarks/Sequence.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/benchmarks/Sequence.hs b/benchmarks/Sequence.hs index 8fd1fcf..8bc2d74 100644 --- a/benchmarks/Sequence.hs +++ b/benchmarks/Sequence.hs @@ -36,7 +36,8 @@ main = do [ bench "ix10000/5000" $ nf (\(xs,ys) -> S.zip xs ys `S.index` 5000) (s10000, u10000) , bench "nf100" $ nf (uncurry S.zip) (s100, u100) , bench "nf10000" $ nf (uncurry S.zip) (s10000, u10000) - ] ] + ] + ] -- splitAt+append: repeatedly cut the sequence at a random point -- and rejoin the pieces in the opposite order. From git at git.haskell.org Mon Apr 17 21:36:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:36:03 +0000 (UTC) Subject: [commit: packages/directory] master: Update changelog.md (5cbbf50) Message-ID: <20170417213603.4CFE03A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5cbbf502b369328b07795cb15aa60d4ca2c82be3/directory >--------------------------------------------------------------- commit 5cbbf502b369328b07795cb15aa60d4ca2c82be3 Author: Phil Ruffwind Date: Tue Mar 7 06:43:27 2017 -0500 Update changelog.md >--------------------------------------------------------------- 5cbbf502b369328b07795cb15aa60d4ca2c82be3 changelog.md | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/changelog.md b/changelog.md index bb56c86..b06db0f 100644 --- a/changelog.md +++ b/changelog.md @@ -8,15 +8,11 @@ Changelog for the [`directory`][1] package * Improve support (partially) for paths longer than 260 characters on Windows. To achieve this, many functions will now automatically prepend - `\\?\` before calling the Windows API. Side effects of this change: - * After calling `setCurrentDirectory`, calls to the Windows API function - `GetCurrentDirectory` will return a path with the `\\?\` prefix. The - Haskell function `getCurrentDirectory` mitigates this problem by - automatically stripping the prefix. - * The `\\?\` prefix may show up in the error messages of the affected - functions. - - * `makeAbsolute` can now handle drive-relative paths on Windows. + `\\?\` before calling the Windows API. As a side effect, the `\\?\` + prefix may show up in the error messages of the affected functions. + + * `makeAbsolute` can now handle drive-relative paths on Windows such as + `C:foobar` ## 1.3.1.0 (March 2017) From git at git.haskell.org Mon Apr 17 21:36:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:36:05 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Remove unsafeCoerce, use only coerce on GHC 7.8 and later. (b38f240) Message-ID: <20170417213605.2A2A73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/b38f240ab4bec53c5f5800cc1b621a00b4604b2d >--------------------------------------------------------------- commit b38f240ab4bec53c5f5800cc1b621a00b4604b2d Author: Milan Straka Date: Mon Dec 15 09:02:37 2014 +0100 Remove unsafeCoerce, use only coerce on GHC 7.8 and later. Also, move the conditional compilation to a local where definition. On my GHC 7.6.3, there is no heap allocation in the cmm in fromFunction for the (Elem . f) closure, so there is no penalty of not using `coerce`. Nevertheless, GHC 7.8.3 and GHC-head (15 Dec 2014) do heap-allocate trivial closure for (Elem . f), so `coerce` helps. Back to GHC 7.6.3, I found that the following does not allocate in GHC 7.6.3: newtype Elem a = Elem a elemMap :: Int -> (Int -> b) -> [Elem b] elemMap s f = go (Elem . f) 0 where go :: (Int -> b) -> Int -> [b] go f i | i >= s = [] | otherwise = f i : go f (i+1) Nevertheless, the following does heap-allocate trivial closure for f: newtype Elem a = Elem a elemMap :: [Int] -> (Int -> b) -> [Elem b] elemMap xs f = go (Elem . f) xs where go :: (Int -> b) -> [Int] -> [b] go f [] = [] go f (x:xs) = f x : go f xs I am not sure what the difference is, but the current fromFunction does not allocate too (on 7.6.3). >--------------------------------------------------------------- b38f240ab4bec53c5f5800cc1b621a00b4604b2d Data/Sequence.hs | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index fa80b3f..4c281fc 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -181,14 +181,7 @@ import Data.Data #if __GLASGOW_HASKELL__ >= 708 import Data.Coerce import qualified GHC.Exts -#define COERCE coerce #else -#ifdef __GLASGOW_HASKELL__ -import qualified Unsafe.Coerce --- Note that by compiling this file with GHC 7.8 or later, we prove that --- it is safe to use COERCE with earlier GHC versions. -#define COERCE Unsafe.Coerce.unsafeCoerce -#endif #endif #if MIN_VERSION_base(4,8,0) import Data.Functor.Identity (Identity(..)) @@ -1365,11 +1358,7 @@ mapWithIndex f' (Seq xs') = Seq $ mapWithIndexTree (\s (Elem a) -> Elem (f' s a) fromFunction :: Int -> (Int -> a) -> Seq a fromFunction len f | len < 0 = error "Data.Sequence.fromFunction called with negative len" | len == 0 = empty -#ifdef __GLASGOW_HASKELL__ - | otherwise = Seq $ create (COERCE f) 1 0 len -#else - | otherwise = Seq $ create (Elem . f) 1 0 len -#endif + | otherwise = Seq $ create (lift_elem f) 1 0 len where create :: (Int -> a) -> Int -> Int -> Int -> FingerTree a create b{-tree_builder-} s{-tree_size-} i{-start_index-} trees = i `seq` s `seq` case trees of @@ -1397,6 +1386,14 @@ fromFunction len f | len < 0 = error "Data.Sequence.fromFunction called with neg mb j = Node3 (3*s) (b j) (b (j + s)) (b (j + 2*s)) {-# INLINE mb #-} + lift_elem :: (Int -> a) -> (Int -> Elem a) +#if __GLASGOW_HASKELL__ >= 708 + lift_elem g = coerce g +#else + lift_elem g = Elem . g +#endif + {-# INLINE lift_elem #-} + -- Splitting -- | /O(log(min(i,n-i)))/. The first @i@ elements of a sequence. From git at git.haskell.org Mon Apr 17 21:36:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:36:05 +0000 (UTC) Subject: [commit: packages/directory] master: Absolutize paths on Windows when possible (68837ad) Message-ID: <20170417213605.5682E3A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/68837ad2508602bf9d5d75cdd690108a5a299ebe/directory >--------------------------------------------------------------- commit 68837ad2508602bf9d5d75cdd690108a5a299ebe Author: Phil Ruffwind Date: Tue Mar 7 07:26:00 2017 -0500 Absolutize paths on Windows when possible Many Windows API calls will fail if current directory + relative path exceeds MAX_PATH, so it's better to just use absolute paths for everything. This change required moving a few functions into the Common module to avoid recursive imports. >--------------------------------------------------------------- 68837ad2508602bf9d5d75cdd690108a5a299ebe System/Directory.hs | 117 +++++----------------------------- System/Directory/Internal/Common.hs | 97 ++++++++++++++++++++++++++++ System/Directory/Internal/Windows.hsc | 22 ++++--- tests/LongPaths.hs | 12 +++- 4 files changed, 135 insertions(+), 113 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 68837ad2508602bf9d5d75cdd690108a5a299ebe From git at git.haskell.org Mon Apr 17 21:36:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:36:07 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Add simple fromFunction benchmarks. (a556ef2) Message-ID: <20170417213607.3199A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/a556ef225952c27731a00b24b6417b6a057507ce >--------------------------------------------------------------- commit a556ef225952c27731a00b24b6417b6a057507ce Author: Milan Straka Date: Mon Dec 15 14:47:20 2014 +0100 Add simple fromFunction benchmarks. >--------------------------------------------------------------- a556ef225952c27731a00b24b6417b6a057507ce benchmarks/Sequence.hs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/benchmarks/Sequence.hs b/benchmarks/Sequence.hs index 8bc2d74..b6b82fa 100644 --- a/benchmarks/Sequence.hs +++ b/benchmarks/Sequence.hs @@ -37,6 +37,13 @@ main = do , bench "nf100" $ nf (uncurry S.zip) (s100, u100) , bench "nf10000" $ nf (uncurry S.zip) (s10000, u10000) ] + , bgroup "fromFunction" + [ bench "ix10000/5000" $ nf (\s -> S.fromFunction s (+1) `S.index` (s `div` 2)) 10000 + , bench "nf10" $ nf (\s -> S.fromFunction s (+1)) 10 + , bench "nf100" $ nf (\s -> S.fromFunction s (+1)) 100 + , bench "nf1000" $ nf (\s -> S.fromFunction s (+1)) 1000 + , bench "nf10000" $ nf (\s -> S.fromFunction s (+1)) 10000 + ] ] -- splitAt+append: repeatedly cut the sequence at a random point From git at git.haskell.org Mon Apr 17 21:36:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:36:07 +0000 (UTC) Subject: [commit: packages/directory] master: Update changelog date (010c986) Message-ID: <20170417213607.5C9133A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/directory On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/010c986ecfde3f1f4dab4454d54a2c6a4f0c0078/directory >--------------------------------------------------------------- commit 010c986ecfde3f1f4dab4454d54a2c6a4f0c0078 Author: Phil Ruffwind Date: Mon Mar 13 20:20:10 2017 -0400 Update changelog date >--------------------------------------------------------------- 010c986ecfde3f1f4dab4454d54a2c6a4f0c0078 changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index b06db0f..1aa8fad 100644 --- a/changelog.md +++ b/changelog.md @@ -1,7 +1,7 @@ Changelog for the [`directory`][1] package ========================================== -## 1.3.1.1 (April 2017) +## 1.3.1.1 (March 2017) * Fix a bug where `createFileLink` and `createDirectoryLink` failed to handle `..` in absolute paths. From git at git.haskell.org Mon Apr 17 21:36:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:36:09 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Use a top-down version of fromList (51a1f7c) Message-ID: <20170417213609.3A0EF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/51a1f7c6670058ed4feefd1ef86170ddef173e63 >--------------------------------------------------------------- commit 51a1f7c6670058ed4feefd1ef86170ddef173e63 Author: David Feuer Date: Tue Dec 9 14:56:53 2014 -0500 Use a top-down version of fromList Ross Paterson came up with a version of fromList that avoids the tree rebuilding inherent in the `(|>)`-based approach. This version is somewhat strictified and rearranged. It reduces allocation substantially over the old version. Mutator time goes down too, but for some reason GC time rises to match it. >--------------------------------------------------------------- 51a1f7c6670058ed4feefd1ef86170ddef173e63 Data/Sequence.hs | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 4c281fc..651dd5e 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -1752,11 +1752,34 @@ findIndicesR p xs = foldlWithIndex g [] xs -- Lists ------------------------------------------------------------------------ +-- The implementation below, by Ross Paterson, avoids the rebuilding +-- the previous (|>)-based implementation suffered from. + -- | /O(n)/. Create a sequence from a finite list of elements. -- There is a function 'toList' in the opposite direction for all -- instances of the 'Foldable' class, including 'Seq'. fromList :: [a] -> Seq a -fromList = Data.List.foldl' (|>) empty +fromList xs = Seq $ mkTree 1 $ Data.List.map Elem xs + where + {-# SPECIALIZE mkTree :: Int -> [Elem a] -> FingerTree (Elem a) #-} + {-# SPECIALIZE mkTree :: Int -> [Node a] -> FingerTree (Node a) #-} + mkTree :: (Sized a) => Int -> [a] -> FingerTree a + mkTree s [] = s `seq` Empty + mkTree s [x1] = s `seq` Single x1 + mkTree s [x1, x2] = Deep (2*s) (One x1) Empty (One x2) + mkTree s [x1, x2, x3] = Deep (3*s) (One x1) Empty (Two x2 x3) + mkTree s (x1:x2:x3:xs) = s `seq` case getNodes (3*s) xs of + (ns, sf) -> m `seq` deep' (Three x1 x2 x3) m sf + where m = mkTree (3*s) ns + + deep' pr@(Three x1 _ _) m sf = Deep (3*size x1 + size m + size sf) pr m sf + + getNodes :: Int -> [a] -> ([Node a], Digit a) + getNodes s [x1] = s `seq` ([], One x1) + getNodes s [x1, x2] = s `seq` ([], Two x1 x2) + getNodes s [x1, x2, x3] = s `seq` ([], Three x1 x2 x3) + getNodes s (x1:x2:x3:xs) = s `seq` (Node3 s x1 x2 x3:ns, d) + where (ns, d) = getNodes s xs #if __GLASGOW_HASKELL__ >= 708 instance GHC.Exts.IsList (Seq a) where From git at git.haskell.org Mon Apr 17 21:36:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:36:11 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Remove trailing whitespace. (a1d613b) Message-ID: <20170417213611.43A1B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/a1d613b50c2e0e15e01159ab2fa1b377a49e2a38 >--------------------------------------------------------------- commit a1d613b50c2e0e15e01159ab2fa1b377a49e2a38 Author: Milan Straka Date: Mon Dec 15 17:30:58 2014 +0100 Remove trailing whitespace. >--------------------------------------------------------------- a1d613b50c2e0e15e01159ab2fa1b377a49e2a38 Data/Sequence.hs | 0 1 file changed, 0 insertions(+), 0 deletions(-) From git at git.haskell.org Mon Apr 17 21:36:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:36:13 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Use coerce for [a]->[Elem a] convertion in fromList. (9b37d5a) Message-ID: <20170417213613.4BFB63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/9b37d5a262e8070abce1f51d4913d9312a630acd >--------------------------------------------------------------- commit 9b37d5a262e8070abce1f51d4913d9312a630acd Author: Milan Straka Date: Mon Dec 15 17:37:18 2014 +0100 Use coerce for [a]->[Elem a] convertion in fromList. >--------------------------------------------------------------- 9b37d5a262e8070abce1f51d4913d9312a630acd Data/Sequence.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 1b6dea2..71ded95 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -1759,7 +1759,7 @@ findIndicesR p xs = foldlWithIndex g [] xs -- There is a function 'toList' in the opposite direction for all -- instances of the 'Foldable' class, including 'Seq'. fromList :: [a] -> Seq a -fromList xs = Seq $ mkTree 1 $ Data.List.map Elem xs +fromList xs = Seq $ mkTree 1 $ map_elem xs where {-# SPECIALIZE mkTree :: Int -> [Elem a] -> FingerTree (Elem a) #-} {-# SPECIALIZE mkTree :: Int -> [Node a] -> FingerTree (Node a) #-} @@ -1781,6 +1781,14 @@ fromList xs = Seq $ mkTree 1 $ Data.List.map Elem xs getNodes s (x1:x2:x3:xs) = s `seq` (Node3 s x1 x2 x3:ns, d) where (ns, d) = getNodes s xs + map_elem :: [a] -> [Elem a] +#if __GLASGOW_HASKELL__ >= 708 + map_elem xs = coerce xs +#else + map_elem xs = Data.List.map Elem xs +#endif + {-# INLINE map_elem #-} + #if __GLASGOW_HASKELL__ >= 708 instance GHC.Exts.IsList (Seq a) where type Item (Seq a) = a From git at git.haskell.org Mon Apr 17 21:36:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:36:15 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Comment various conditional imports. (9df67f5) Message-ID: <20170417213615.54BA83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/9df67f5121ef14c865b4fae9db96aebf083dfb6c >--------------------------------------------------------------- commit 9df67f5121ef14c865b4fae9db96aebf083dfb6c Author: Milan Straka Date: Mon Dec 15 17:57:20 2014 +0100 Comment various conditional imports. >--------------------------------------------------------------- 9df67f5121ef14c865b4fae9db96aebf083dfb6c Data/Sequence.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 71ded95..2e8f84c 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -172,17 +172,22 @@ import Data.Foldable (Foldable(foldl, foldl1, foldr, foldr1, foldMap), foldl', t import Data.Traversable import Data.Typeable +-- GHC specific stuff #ifdef __GLASGOW_HASKELL__ import GHC.Exts (build) import Text.Read (Lexeme(Ident), lexP, parens, prec, readPrec, readListPrec, readListPrecDefault) import Data.Data #endif + +-- Coercion on GHC 7.8+ #if __GLASGOW_HASKELL__ >= 708 import Data.Coerce import qualified GHC.Exts #else #endif + +-- Identity functor on base 4.8 (GHC 7.10+) #if MIN_VERSION_base(4,8,0) import Data.Functor.Identity (Identity(..)) #endif From git at git.haskell.org Mon Apr 17 21:36:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:36:17 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, develop-0.6, develop-0.6-questionable, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Add Data.Sequence.fromArray. (52ba9e5) Message-ID: <20170417213617.5E6D23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,develop-0.6,develop-0.6-questionable,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/52ba9e5d9c85d4bd11236c1e43b4847a50a3b771 >--------------------------------------------------------------- commit 52ba9e5d9c85d4bd11236c1e43b4847a50a3b771 Author: Milan Straka Date: Mon Dec 15 17:58:46 2014 +0100 Add Data.Sequence.fromArray. Sugested by David Feuer in #88. The implementation on GHC uses GHC.Arr module and is considerably faster than on non-GHC compilers. >--------------------------------------------------------------- 52ba9e5d9c85d4bd11236c1e43b4847a50a3b771 Data/Sequence.hs | 19 +++++++++++++++++++ tests/seq-properties.hs | 6 ++++++ 2 files changed, 25 insertions(+) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 2e8f84c..690a9fe 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -62,6 +62,7 @@ module Data.Sequence ( (><), -- :: Seq a -> Seq a -> Seq a fromList, -- :: [a] -> Seq a fromFunction, -- :: Int -> (Int -> a) -> Seq a + fromArray, -- :: Ix i => Array i a -> Seq a -- ** Repetition replicate, -- :: Int -> a -> Seq a replicateA, -- :: Applicative f => Int -> f a -> f (Seq a) @@ -180,6 +181,13 @@ import Text.Read (Lexeme(Ident), lexP, parens, prec, import Data.Data #endif +-- Array stuff, with GHC.Arr on GHC +import Data.Array (Ix, Array) +import qualified Data.Array +#ifdef __GLASGOW_HASKELL__ +import qualified GHC.Arr +#endif + -- Coercion on GHC 7.8+ #if __GLASGOW_HASKELL__ >= 708 import Data.Coerce @@ -1399,6 +1407,17 @@ fromFunction len f | len < 0 = error "Data.Sequence.fromFunction called with neg #endif {-# INLINE lift_elem #-} +-- | /O(n)/. Create a sequence consisting of the elements of an 'Array'. +-- Note that the resulting sequence elements may be evaluated lazily (as on GHC), +-- so you must force the entire structure to be sure that the original array +-- can be garbage-collected. +fromArray :: Ix i => Array i a -> Seq a +#ifdef __GLASGOW_HASKELL__ +fromArray a = fromFunction (GHC.Arr.numElements a) (GHC.Arr.unsafeAt a) +#else +fromArray a = fromList2 (Data.Array.rangeSize (Data.Array.bounds a)) (Data.Array.elems a) +#endif + -- Splitting -- | /O(log(min(i,n-i)))/. The first @i@ elements of a sequence. diff --git a/tests/seq-properties.hs b/tests/seq-properties.hs index 14d5a5f..a64e66d 100644 --- a/tests/seq-properties.hs +++ b/tests/seq-properties.hs @@ -2,6 +2,7 @@ import Data.Sequence -- needs to be compiled with -DTESTING for use here import Control.Applicative (Applicative(..)) import Control.Arrow ((***)) +import Data.Array (listArray) import Data.Foldable (Foldable(..), toList, all, sum) import Data.Functor ((<$>), (<$)) import Data.Maybe @@ -37,6 +38,7 @@ main = defaultMain , testProperty "(><)" prop_append , testProperty "fromList" prop_fromList , testProperty "fromFunction" prop_fromFunction + , testProperty "fromArray" prop_fromArray , testProperty "replicate" prop_replicate , testProperty "replicateA" prop_replicateA , testProperty "replicateM" prop_replicateM @@ -275,6 +277,10 @@ prop_fromFunction :: [A] -> Bool prop_fromFunction xs = toList' (fromFunction (Prelude.length xs) (xs!!)) ~= xs +prop_fromArray :: [A] -> Bool +prop_fromArray xs = + toList' (fromArray (listArray (42, 42+Prelude.length xs-1) xs)) ~= xs + -- ** Repetition prop_replicate :: NonNegative Int -> A -> Bool From git at git.haskell.org Mon Apr 17 21:36:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:36:19 +0000 (UTC) Subject: [commit: packages/containers] develop-0.6: Make types of the drawing functions more generic, i.e. Show s => Tree s instead of Tree String (7ab1c39) Message-ID: <20170417213619.667F13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branch : develop-0.6 Link : http://git.haskell.org/packages/containers.git/commitdiff/7ab1c399726c5a4a562cff3f56017ff5852ac82e >--------------------------------------------------------------- commit 7ab1c399726c5a4a562cff3f56017ff5852ac82e Author: jonasc Date: Fri Aug 8 00:15:10 2014 +0200 Make types of the drawing functions more generic, i.e. Show s => Tree s instead of Tree String >--------------------------------------------------------------- 7ab1c399726c5a4a562cff3f56017ff5852ac82e Data/Tree.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Data/Tree.hs b/Data/Tree.hs index 57a4324..1642c3b 100644 --- a/Data/Tree.hs +++ b/Data/Tree.hs @@ -113,15 +113,15 @@ instance NFData a => NFData (Tree a) where rnf (Node x ts) = rnf x `seq` rnf ts -- | Neat 2-dimensional drawing of a tree. -drawTree :: Tree String -> String +drawTree :: Show a => Tree a -> String drawTree = unlines . draw -- | Neat 2-dimensional drawing of a forest. -drawForest :: Forest String -> String +drawForest :: Show a => Forest a -> String drawForest = unlines . map drawTree -draw :: Tree String -> [String] -draw (Node x ts0) = x : drawSubTrees ts0 +draw :: Show a => Tree a -> [String] +draw (Node x ts0) = show x : drawSubTrees ts0 where drawSubTrees [] = [] drawSubTrees [t] = From git at git.haskell.org Mon Apr 17 21:36:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:36:21 +0000 (UTC) Subject: [commit: packages/containers] develop-0.6-questionable: Added fixity declarations for member, notMember, union, and intersection. (de85ae9) Message-ID: <20170417213621.725473A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branch : develop-0.6-questionable Link : http://git.haskell.org/packages/containers.git/commitdiff/de85ae9eccb84284873d419c899743a85bd4e66a >--------------------------------------------------------------- commit de85ae9eccb84284873d419c899743a85bd4e66a Author: Peter Selinger Date: Fri Jul 4 10:31:20 2014 -0300 Added fixity declarations for member, notMember, union, and intersection. Milan Straka: It is quite unlikely that this ever gets merged, as it can cause build failures (it broke the testing suite for example) and offers in my opinion little benefit. >--------------------------------------------------------------- de85ae9eccb84284873d419c899743a85bd4e66a Data/IntMap/Base.hs | 8 ++++++++ Data/IntSet/Base.hs | 7 +++++++ Data/Map/Base.hs | 8 ++++++++ Data/Set/Base.hs | 8 ++++++++ 4 files changed, 31 insertions(+) diff --git a/Data/IntMap/Base.hs b/Data/IntMap/Base.hs index d5fd75a..2a912d9 100644 --- a/Data/IntMap/Base.hs +++ b/Data/IntMap/Base.hs @@ -451,6 +451,8 @@ member k = k `seq` go go (Tip kx _) = k == kx go Nil = False +infix 4 member + -- | /O(min(n,W))/. Is the key not a member of the map? -- -- > notMember 5 (fromList [(5,'a'), (3,'b')]) == False @@ -459,6 +461,8 @@ member k = k `seq` go notMember :: Key -> IntMap a -> Bool notMember k m = not $ member k m +infix 4 notMember + -- | /O(min(n,W))/. Lookup the value at a key in the map. See also 'Data.Map.lookup'. -- See Note: Local 'go' functions and capturing] @@ -874,6 +878,8 @@ union :: IntMap a -> IntMap a -> IntMap a union m1 m2 = mergeWithKey' Bin const id id m1 m2 +infixl 5 union + -- | /O(n+m)/. The union with a combining function. -- -- > unionWith (++) (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == fromList [(3, "b"), (5, "aA"), (7, "C")] @@ -937,6 +943,8 @@ intersection :: IntMap a -> IntMap b -> IntMap a intersection m1 m2 = mergeWithKey' bin const (const Nil) (const Nil) m1 m2 +infixl 5 intersection + -- | /O(n+m)/. The intersection with a combining function. -- -- > intersectionWith (++) (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "aA" diff --git a/Data/IntSet/Base.hs b/Data/IntSet/Base.hs index 6333eea..f2dfb90 100644 --- a/Data/IntSet/Base.hs +++ b/Data/IntSet/Base.hs @@ -321,10 +321,14 @@ member x = x `seq` go go (Tip y bm) = prefixOf x == y && bitmapOf x .&. bm /= 0 go Nil = False +infix 4 member + -- | /O(min(n,W))/. Is the element not in the set? notMember :: Key -> IntSet -> Bool notMember k = not . member k +infix 4 notMember + -- | /O(log n)/. Find largest element smaller than the given one. -- -- > lookupLT 3 (fromList [3, 5]) == Nothing @@ -512,6 +516,7 @@ union t@(Bin _ _ _ _) Nil = t union (Tip kx bm) t = insertBM kx bm t union Nil t = t +infixl 5 union {-------------------------------------------------------------------- Difference @@ -586,6 +591,8 @@ intersection (Tip kx1 bm1) t2 = intersectBM t2 intersection Nil _ = Nil +infixl 5 intersection + {-------------------------------------------------------------------- Subset --------------------------------------------------------------------} diff --git a/Data/Map/Base.hs b/Data/Map/Base.hs index e582e16..92ff096 100644 --- a/Data/Map/Base.hs +++ b/Data/Map/Base.hs @@ -466,6 +466,8 @@ member = go {-# INLINE member #-} #endif +infix 4 member + -- | /O(log n)/. Is the key not a member of the map? See also 'member'. -- -- > notMember 5 (fromList [(5,'a'), (3,'b')]) == False @@ -479,6 +481,8 @@ notMember k m = not $ member k m {-# INLINE notMember #-} #endif +infix 4 notMember + -- | /O(log n)/. Find the value at a key. -- Calls 'error' when the element can not be found. find :: Ord k => k -> Map k a -> a @@ -1241,6 +1245,8 @@ union t1 t2 = hedgeUnion NothingS NothingS t1 t2 {-# INLINABLE union #-} #endif +infixl 5 union + -- left-biased hedge union hedgeUnion :: Ord a => MaybeS a -> MaybeS a -> Map a b -> Map a b -> Map a b hedgeUnion _ _ t1 Tip = t1 @@ -1361,6 +1367,8 @@ intersection t1 t2 = hedgeInt NothingS NothingS t1 t2 {-# INLINABLE intersection #-} #endif +infixl 5 intersection + hedgeInt :: Ord k => MaybeS k -> MaybeS k -> Map k a -> Map k b -> Map k a hedgeInt _ _ _ Tip = Tip hedgeInt _ _ Tip _ = Tip diff --git a/Data/Set/Base.hs b/Data/Set/Base.hs index 7e792f4..0c4f62b 100644 --- a/Data/Set/Base.hs +++ b/Data/Set/Base.hs @@ -356,6 +356,8 @@ member = go {-# INLINE member #-} #endif +infix 4 member + -- | /O(log n)/. Is the element not in the set? notMember :: Ord a => a -> Set a -> Bool notMember a t = not $ member a t @@ -365,6 +367,8 @@ notMember a t = not $ member a t {-# INLINE notMember #-} #endif +infix 4 notMember + -- | /O(log n)/. Find largest element smaller than the given one. -- -- > lookupLT 3 (fromList [3, 5]) == Nothing @@ -616,6 +620,8 @@ union t1 t2 = hedgeUnion NothingS NothingS t1 t2 {-# INLINABLE union #-} #endif +infixl 5 union + hedgeUnion :: Ord a => MaybeS a -> MaybeS a -> Set a -> Set a -> Set a hedgeUnion _ _ t1 Tip = t1 hedgeUnion blo bhi Tip (Bin _ x l r) = link x (filterGt blo l) (filterLt bhi r) @@ -674,6 +680,8 @@ intersection t1 t2 = hedgeInt NothingS NothingS t1 t2 {-# INLINABLE intersection #-} #endif +infixl 5 intersection + hedgeInt :: Ord a => MaybeS a -> MaybeS a -> Set a -> Set a -> Set a hedgeInt _ _ _ Tip = Tip hedgeInt _ _ Tip _ = Tip From git at git.haskell.org Mon Apr 17 21:36:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:36:23 +0000 (UTC) Subject: [commit: packages/containers] develop-0.6-questionable: Fixed syntax of fixity declarations. (2bf686d) Message-ID: <20170417213623.7D95C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branch : develop-0.6-questionable Link : http://git.haskell.org/packages/containers.git/commitdiff/2bf686d3dd0706eef416590100f8d1ebaa3eb80b >--------------------------------------------------------------- commit 2bf686d3dd0706eef416590100f8d1ebaa3eb80b Author: Peter Selinger Date: Fri Jul 4 10:47:35 2014 -0300 Fixed syntax of fixity declarations. >--------------------------------------------------------------- 2bf686d3dd0706eef416590100f8d1ebaa3eb80b Data/IntMap/Base.hs | 8 ++++---- Data/IntSet/Base.hs | 8 ++++---- Data/Map/Base.hs | 8 ++++---- Data/Set/Base.hs | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Data/IntMap/Base.hs b/Data/IntMap/Base.hs index 2a912d9..8afb60c 100644 --- a/Data/IntMap/Base.hs +++ b/Data/IntMap/Base.hs @@ -451,7 +451,7 @@ member k = k `seq` go go (Tip kx _) = k == kx go Nil = False -infix 4 member +infix 4 `member` -- | /O(min(n,W))/. Is the key not a member of the map? -- @@ -461,7 +461,7 @@ infix 4 member notMember :: Key -> IntMap a -> Bool notMember k m = not $ member k m -infix 4 notMember +infix 4 `notMember` -- | /O(min(n,W))/. Lookup the value at a key in the map. See also 'Data.Map.lookup'. @@ -878,7 +878,7 @@ union :: IntMap a -> IntMap a -> IntMap a union m1 m2 = mergeWithKey' Bin const id id m1 m2 -infixl 5 union +infixl 5 `union` -- | /O(n+m)/. The union with a combining function. -- @@ -943,7 +943,7 @@ intersection :: IntMap a -> IntMap b -> IntMap a intersection m1 m2 = mergeWithKey' bin const (const Nil) (const Nil) m1 m2 -infixl 5 intersection +infixl 5 `intersection` -- | /O(n+m)/. The intersection with a combining function. -- diff --git a/Data/IntSet/Base.hs b/Data/IntSet/Base.hs index f2dfb90..bd78790 100644 --- a/Data/IntSet/Base.hs +++ b/Data/IntSet/Base.hs @@ -321,13 +321,13 @@ member x = x `seq` go go (Tip y bm) = prefixOf x == y && bitmapOf x .&. bm /= 0 go Nil = False -infix 4 member +infix 4 `member` -- | /O(min(n,W))/. Is the element not in the set? notMember :: Key -> IntSet -> Bool notMember k = not . member k -infix 4 notMember +infix 4 `notMember` -- | /O(log n)/. Find largest element smaller than the given one. -- @@ -516,7 +516,7 @@ union t@(Bin _ _ _ _) Nil = t union (Tip kx bm) t = insertBM kx bm t union Nil t = t -infixl 5 union +infixl 5 `union` {-------------------------------------------------------------------- Difference @@ -591,7 +591,7 @@ intersection (Tip kx1 bm1) t2 = intersectBM t2 intersection Nil _ = Nil -infixl 5 intersection +infixl 5 `intersection` {-------------------------------------------------------------------- Subset diff --git a/Data/Map/Base.hs b/Data/Map/Base.hs index 92ff096..ae291c7 100644 --- a/Data/Map/Base.hs +++ b/Data/Map/Base.hs @@ -466,7 +466,7 @@ member = go {-# INLINE member #-} #endif -infix 4 member +infix 4 `member` -- | /O(log n)/. Is the key not a member of the map? See also 'member'. -- @@ -481,7 +481,7 @@ notMember k m = not $ member k m {-# INLINE notMember #-} #endif -infix 4 notMember +infix 4 `notMember` -- | /O(log n)/. Find the value at a key. -- Calls 'error' when the element can not be found. @@ -1245,7 +1245,7 @@ union t1 t2 = hedgeUnion NothingS NothingS t1 t2 {-# INLINABLE union #-} #endif -infixl 5 union +infixl 5 `union` -- left-biased hedge union hedgeUnion :: Ord a => MaybeS a -> MaybeS a -> Map a b -> Map a b -> Map a b @@ -1367,7 +1367,7 @@ intersection t1 t2 = hedgeInt NothingS NothingS t1 t2 {-# INLINABLE intersection #-} #endif -infixl 5 intersection +infixl 5 `intersection` hedgeInt :: Ord k => MaybeS k -> MaybeS k -> Map k a -> Map k b -> Map k a hedgeInt _ _ _ Tip = Tip diff --git a/Data/Set/Base.hs b/Data/Set/Base.hs index 0c4f62b..732e973 100644 --- a/Data/Set/Base.hs +++ b/Data/Set/Base.hs @@ -356,7 +356,7 @@ member = go {-# INLINE member #-} #endif -infix 4 member +infix 4 `member` -- | /O(log n)/. Is the element not in the set? notMember :: Ord a => a -> Set a -> Bool @@ -367,7 +367,7 @@ notMember a t = not $ member a t {-# INLINE notMember #-} #endif -infix 4 notMember +infix 4 `notMember` -- | /O(log n)/. Find largest element smaller than the given one. -- @@ -620,7 +620,7 @@ union t1 t2 = hedgeUnion NothingS NothingS t1 t2 {-# INLINABLE union #-} #endif -infixl 5 union +infixl 5 `union` hedgeUnion :: Ord a => MaybeS a -> MaybeS a -> Set a -> Set a -> Set a hedgeUnion _ _ t1 Tip = t1 @@ -680,7 +680,7 @@ intersection t1 t2 = hedgeInt NothingS NothingS t1 t2 {-# INLINABLE intersection #-} #endif -infixl 5 intersection +infixl 5 `intersection` hedgeInt :: Ord a => MaybeS a -> MaybeS a -> Set a -> Set a -> Set a hedgeInt _ _ _ Tip = Tip From git at git.haskell.org Mon Apr 17 21:36:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:36:25 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Bump version number to 0.5.6.0 (b9e4e22) Message-ID: <20170417213625.862A83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/b9e4e22d6e37150dcf5c04e4c4beabfba5342576 >--------------------------------------------------------------- commit b9e4e22d6e37150dcf5c04e4c4beabfba5342576 Author: Johan Tibell Date: Mon Dec 15 19:57:52 2014 +0100 Bump version number to 0.5.6.0 >--------------------------------------------------------------- b9e4e22d6e37150dcf5c04e4c4beabfba5342576 containers.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/containers.cabal b/containers.cabal index ae7e247..bbf5913 100644 --- a/containers.cabal +++ b/containers.cabal @@ -1,5 +1,5 @@ name: containers -version: 0.5.5.1 +version: 0.5.6.0 license: BSD3 license-file: LICENSE maintainer: fox at ucw.cz From git at git.haskell.org Mon Apr 17 21:36:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:36:27 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Add Ross Paterson to 2014 copyright statement (302d6b4) Message-ID: <20170417213627.8E2FD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/302d6b4839702ce6e18fd1908240b920efb1b04a >--------------------------------------------------------------- commit 302d6b4839702ce6e18fd1908240b920efb1b04a Author: David Feuer Date: Mon Dec 15 15:54:22 2014 -0500 Add Ross Paterson to 2014 copyright statement He wrote the first draft of the new `fromList` code. >--------------------------------------------------------------- 302d6b4839702ce6e18fd1908240b920efb1b04a Data/Sequence.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 690a9fe..9a23f77 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -19,7 +19,7 @@ -- Module : Data.Sequence -- Copyright : (c) Ross Paterson 2005 -- (c) Louis Wasserman 2009 --- (c) David Feuer and Milan Straka 2014 +-- (c) David Feuer, Ross Paterson, and Milan Straka 2014 -- License : BSD-style -- Maintainer : libraries at haskell.org -- Stability : experimental From git at git.haskell.org Mon Apr 17 21:36:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:36:29 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Merge pull request #97 from treeowl/add-credit (33e65be) Message-ID: <20170417213629.96BF63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/33e65bea1713e1720857fb1c1f982631b872913f >--------------------------------------------------------------- commit 33e65bea1713e1720857fb1c1f982631b872913f Merge: b9e4e22 302d6b4 Author: Milan Straka Date: Mon Dec 15 22:01:23 2014 +0100 Merge pull request #97 from treeowl/add-credit Add Ross Paterson to 2014 copyright statement >--------------------------------------------------------------- 33e65bea1713e1720857fb1c1f982631b872913f Data/Sequence.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) From git at git.haskell.org Mon Apr 17 21:36:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:36:31 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Fix warnings. (2bdc5f3) Message-ID: <20170417213631.9F4C43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/2bdc5f38f740f43b49bad0a53c81b9d4a25a56bd >--------------------------------------------------------------- commit 2bdc5f38f740f43b49bad0a53c81b9d4a25a56bd Author: Milan Straka Date: Mon Dec 15 22:47:28 2014 +0100 Fix warnings. In getNodes, pass (a, [a]) instead of an [a] which we know is nonempty. This way we do not have to create void pattern-match case for empty list. Also use STRICT_x_OF_y macros instead of `seq`-ing in every pattern-match case. >--------------------------------------------------------------- 2bdc5f38f740f43b49bad0a53c81b9d4a25a56bd Data/Sequence.hs | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 9a23f77..1f19c62 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -183,7 +183,6 @@ import Data.Data -- Array stuff, with GHC.Arr on GHC import Data.Array (Ix, Array) -import qualified Data.Array #ifdef __GLASGOW_HASKELL__ import qualified GHC.Arr #endif @@ -200,6 +199,15 @@ import qualified GHC.Exts import Data.Functor.Identity (Identity(..)) #endif + +-- Use macros to define strictness of functions. +-- STRICT_x_OF_y denotes an y-ary function strict in the x-th parameter. +-- We do not use BangPatterns, because they are not in any standard and we +-- want the compilers to be compiled by as many compilers as possible. +#define STRICT_1_OF_2(fn) fn arg _ | arg `seq` False = undefined +#define STRICT_1_OF_3(fn) fn arg _ _ | arg `seq` False = undefined + + infixr 5 `consTree` infixl 5 `snocTree` @@ -1783,27 +1791,27 @@ findIndicesR p xs = foldlWithIndex g [] xs -- There is a function 'toList' in the opposite direction for all -- instances of the 'Foldable' class, including 'Seq'. fromList :: [a] -> Seq a -fromList xs = Seq $ mkTree 1 $ map_elem xs +fromList = Seq . mkTree 1 . map_elem where {-# SPECIALIZE mkTree :: Int -> [Elem a] -> FingerTree (Elem a) #-} {-# SPECIALIZE mkTree :: Int -> [Node a] -> FingerTree (Node a) #-} mkTree :: (Sized a) => Int -> [a] -> FingerTree a - mkTree s [] = s `seq` Empty - mkTree s [x1] = s `seq` Single x1 + STRICT_1_OF_2(mkTree) + mkTree _ [] = Empty + mkTree _ [x1] = Single x1 mkTree s [x1, x2] = Deep (2*s) (One x1) Empty (One x2) mkTree s [x1, x2, x3] = Deep (3*s) (One x1) Empty (Two x2 x3) - mkTree s (x1:x2:x3:xs) = s `seq` case getNodes (3*s) xs of - (ns, sf) -> m `seq` deep' (Three x1 x2 x3) m sf - where m = mkTree (3*s) ns - - deep' pr@(Three x1 _ _) m sf = Deep (3*size x1 + size m + size sf) pr m sf - - getNodes :: Int -> [a] -> ([Node a], Digit a) - getNodes s [x1] = s `seq` ([], One x1) - getNodes s [x1, x2] = s `seq` ([], Two x1 x2) - getNodes s [x1, x2, x3] = s `seq` ([], Three x1 x2 x3) - getNodes s (x1:x2:x3:xs) = s `seq` (Node3 s x1 x2 x3:ns, d) - where (ns, d) = getNodes s xs + mkTree s (x1:x2:x3:x4:xs) = case getNodes (3*s) x4 xs of + (ns, sf) -> case mkTree (3*s) ns of + m -> m `seq` Deep (3*size x1 + size m + size sf) (Three x1 x2 x3) m sf + + getNodes :: Int -> a -> [a] -> ([Node a], Digit a) + STRICT_1_OF_3(getNodes) + getNodes _ x1 [] = ([], One x1) + getNodes _ x1 [x2] = ([], Two x1 x2) + getNodes _ x1 [x2, x3] = ([], Three x1 x2 x3) + getNodes s x1 (x2:x3:x4:xs) = (Node3 s x1 x2 x3:ns, d) + where (ns, d) = getNodes s x4 xs map_elem :: [a] -> [Elem a] #if __GLASGOW_HASKELL__ >= 708 From git at git.haskell.org Mon Apr 17 21:36:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:36:33 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Nuke include/Typeable.h, create include/containers.h instead. (b3257c8) Message-ID: <20170417213633.B62AA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/b3257c8b59a9f4dec03be19b6d2cd7a562691e04 >--------------------------------------------------------------- commit b3257c8b59a9f4dec03be19b6d2cd7a562691e04 Author: Milan Straka Date: Mon Dec 15 23:48:18 2014 +0100 Nuke include/Typeable.h, create include/containers.h instead. The "Typeable.h" collides with the header of same name in base. The new "containers.h" is now used in every Haskell source. It contains more stuff used across the containers codebase: - INSTANCE_TYPEABLE[0-2] (was in Typeable.h) - include MachDeps on __GLASGOW_HASKELL__ to define WORD_SIZE_IN_BITS - define STRICT_x_OF_y macros - define MIN_VERSION_base if not defined by cabal (during cabal-less build) >--------------------------------------------------------------- b3257c8b59a9f4dec03be19b6d2cd7a562691e04 Data/Graph.hs | 3 +++ Data/IntMap.hs | 3 +++ Data/IntMap/Base.hs | 15 ++--------- Data/IntMap/Lazy.hs | 3 +++ Data/IntMap/Strict.hs | 3 +++ Data/IntSet.hs | 3 +++ Data/IntSet/Base.hs | 25 +++---------------- Data/Map.hs | 3 +++ Data/Map/Base.hs | 20 +++------------ Data/Map/Lazy.hs | 3 +++ Data/Map/Strict.hs | 23 ++++------------- Data/Sequence.hs | 18 +++----------- Data/Set.hs | 3 +++ Data/Set/Base.hs | 19 +++----------- Data/Tree.hs | 9 ++----- Data/Utils/BitUtil.hs | 8 +++--- Data/Utils/StrictFold.hs | 3 +++ Data/Utils/StrictPair.hs | 3 +++ containers.cabal | 2 +- include/Typeable.h | 65 ------------------------------------------------ include/containers.h | 61 +++++++++++++++++++++++++++++++++++++++++++++ 21 files changed, 116 insertions(+), 179 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc b3257c8b59a9f4dec03be19b6d2cd7a562691e04 From git at git.haskell.org Mon Apr 17 21:36:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:36:35 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Add the include dir also to tests. (040309f) Message-ID: <20170417213635.BFF5C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/040309f6915306cc7aa7da02f144fe026e4fb6fe >--------------------------------------------------------------- commit 040309f6915306cc7aa7da02f144fe026e4fb6fe Author: Milan Straka Date: Tue Dec 16 00:24:50 2014 +0100 Add the include dir also to tests. This worked with Typeable because Typeable from `base` instead of `containers` was used. >--------------------------------------------------------------- 040309f6915306cc7aa7da02f144fe026e4fb6fe containers.cabal | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/containers.cabal b/containers.cabal index afd2e34..6c77693 100644 --- a/containers.cabal +++ b/containers.cabal @@ -85,6 +85,7 @@ Test-suite map-lazy-properties build-depends: base >= 4.2 && < 5, array, deepseq >= 1.2 && < 1.5, ghc-prim ghc-options: -O2 + include-dirs: include extensions: MagicHash, DeriveDataTypeable, StandaloneDeriving, Rank2Types build-depends: @@ -102,6 +103,7 @@ Test-suite map-strict-properties build-depends: base >= 4.2 && < 5, array, deepseq >= 1.2 && < 1.5, ghc-prim ghc-options: -O2 + include-dirs: include extensions: MagicHash, DeriveDataTypeable, StandaloneDeriving, Rank2Types build-depends: @@ -119,6 +121,7 @@ Test-suite set-properties build-depends: base >= 4.2 && < 5, array, deepseq >= 1.2 && < 1.5, ghc-prim ghc-options: -O2 + include-dirs: include extensions: MagicHash, DeriveDataTypeable, StandaloneDeriving, Rank2Types build-depends: @@ -136,6 +139,7 @@ Test-suite intmap-lazy-properties build-depends: base >= 4.2 && < 5, array, deepseq >= 1.2 && < 1.5, ghc-prim ghc-options: -O2 + include-dirs: include extensions: MagicHash, DeriveDataTypeable, StandaloneDeriving, Rank2Types build-depends: @@ -153,6 +157,7 @@ Test-suite intmap-strict-properties build-depends: base >= 4.2 && < 5, array, deepseq >= 1.2 && < 1.5, ghc-prim ghc-options: -O2 + include-dirs: include extensions: MagicHash, DeriveDataTypeable, StandaloneDeriving, Rank2Types build-depends: @@ -170,6 +175,7 @@ Test-suite intset-properties build-depends: base >= 4.2 && < 5, array, deepseq >= 1.2 && < 1.5, ghc-prim ghc-options: -O2 + include-dirs: include extensions: MagicHash, DeriveDataTypeable, StandaloneDeriving, Rank2Types build-depends: @@ -187,6 +193,7 @@ Test-suite deprecated-properties build-depends: base >= 4.2 && < 5, array, deepseq >= 1.2 && < 1.5, ghc-prim ghc-options: -O2 + include-dirs: include extensions: MagicHash, DeriveDataTypeable, StandaloneDeriving, Rank2Types build-depends: @@ -202,6 +209,7 @@ Test-suite seq-properties build-depends: base >= 4.2 && < 5, array, deepseq >= 1.2 && < 1.5, ghc-prim ghc-options: -O2 + include-dirs: include extensions: MagicHash, DeriveDataTypeable, StandaloneDeriving, Rank2Types build-depends: @@ -225,6 +233,7 @@ test-suite map-strictness-properties test-framework-quickcheck2 >= 0.2.9 ghc-options: -Wall + include-dirs: include test-suite intmap-strictness-properties hs-source-dirs: tests, . @@ -242,3 +251,4 @@ test-suite intmap-strictness-properties test-framework-quickcheck2 >= 0.2.9 ghc-options: -Wall + include-dirs: include From git at git.haskell.org Mon Apr 17 21:36:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:36:37 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Disable coercion tests for the time being. (bc74f91) Message-ID: <20170417213637.C96823A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/bc74f915a5c223ae976290161b1b2f4ef7ea5b41 >--------------------------------------------------------------- commit bc74f915a5c223ae976290161b1b2f4ef7ea5b41 Author: Milan Straka Date: Tue Dec 16 09:38:16 2014 +0100 Disable coercion tests for the time being. >--------------------------------------------------------------- bc74f915a5c223ae976290161b1b2f4ef7ea5b41 tests-ghc/all.T | 5 ----- tests-ghc/unreliable/README | 2 ++ tests-ghc/{all.T => unreliable/coerce_tests} | 7 ------- tests-ghc/{ => unreliable}/mapcoerceintmap.hs | 0 tests-ghc/{ => unreliable}/mapcoerceintmap.stdout | 0 tests-ghc/{ => unreliable}/mapcoerceintmapstrict.hs | 0 tests-ghc/{ => unreliable}/mapcoerceintmapstrict.hs.stdout | 0 tests-ghc/{ => unreliable}/mapcoercemap.hs | 0 tests-ghc/{ => unreliable}/mapcoercemap.stdout | 0 tests-ghc/{ => unreliable}/mapcoerceseq.hs | 0 tests-ghc/{ => unreliable}/mapcoerceseq.stdout | 0 tests-ghc/{ => unreliable}/mapcoercesmap.hs | 0 tests-ghc/{ => unreliable}/mapcoercesmap.stdout | 0 13 files changed, 2 insertions(+), 12 deletions(-) diff --git a/tests-ghc/all.T b/tests-ghc/all.T index eba1dcc..b7887dc 100644 --- a/tests-ghc/all.T +++ b/tests-ghc/all.T @@ -5,8 +5,3 @@ test('datamap001', normal, compile_and_run, ['-package containers']) test('datamap002', normal, compile_and_run, ['-package containers']) test('dataintset001', normal, compile_and_run, ['-package containers']) test('sequence001', normal, compile_and_run, ['-package containers']) -test('mapcoerceseq', when(compiler_ge('ghc','7.9')), compile_and_run, ['-package containers']) -test('mapcoercemap', when(compiler_ge('ghc','7.9')), compile_and_run, ['-package containers']) -test('mapcoercesmap', when(compiler_ge('ghc','7.9')), compile_and_run, ['-package containers']) -test('mapcoerceintmap', when(compiler_ge('ghc','7.9')), compile_and_run, ['-package containers']) -test('mapcoerceintmapstrict', when(compiler_ge('ghc','7.9')), compile_and_run, ['-package containers']) diff --git a/tests-ghc/unreliable/README b/tests-ghc/unreliable/README new file mode 100644 index 0000000..23240fe --- /dev/null +++ b/tests-ghc/unreliable/README @@ -0,0 +1,2 @@ +These coerce tests depend on whether RULES are fired or not, +so adding them to general GHC suite might cause testing failures. diff --git a/tests-ghc/all.T b/tests-ghc/unreliable/coerce_tests similarity index 55% copy from tests-ghc/all.T copy to tests-ghc/unreliable/coerce_tests index eba1dcc..5cc72d0 100644 --- a/tests-ghc/all.T +++ b/tests-ghc/unreliable/coerce_tests @@ -1,10 +1,3 @@ -# This is a test script for use with GHC's testsuite framework, see -# http://darcs.haskell.org/testsuite - -test('datamap001', normal, compile_and_run, ['-package containers']) -test('datamap002', normal, compile_and_run, ['-package containers']) -test('dataintset001', normal, compile_and_run, ['-package containers']) -test('sequence001', normal, compile_and_run, ['-package containers']) test('mapcoerceseq', when(compiler_ge('ghc','7.9')), compile_and_run, ['-package containers']) test('mapcoercemap', when(compiler_ge('ghc','7.9')), compile_and_run, ['-package containers']) test('mapcoercesmap', when(compiler_ge('ghc','7.9')), compile_and_run, ['-package containers']) diff --git a/tests-ghc/mapcoerceintmap.hs b/tests-ghc/unreliable/mapcoerceintmap.hs similarity index 100% rename from tests-ghc/mapcoerceintmap.hs rename to tests-ghc/unreliable/mapcoerceintmap.hs diff --git a/tests-ghc/mapcoerceintmap.stdout b/tests-ghc/unreliable/mapcoerceintmap.stdout similarity index 100% rename from tests-ghc/mapcoerceintmap.stdout rename to tests-ghc/unreliable/mapcoerceintmap.stdout diff --git a/tests-ghc/mapcoerceintmapstrict.hs b/tests-ghc/unreliable/mapcoerceintmapstrict.hs similarity index 100% rename from tests-ghc/mapcoerceintmapstrict.hs rename to tests-ghc/unreliable/mapcoerceintmapstrict.hs diff --git a/tests-ghc/mapcoerceintmapstrict.hs.stdout b/tests-ghc/unreliable/mapcoerceintmapstrict.hs.stdout similarity index 100% rename from tests-ghc/mapcoerceintmapstrict.hs.stdout rename to tests-ghc/unreliable/mapcoerceintmapstrict.hs.stdout diff --git a/tests-ghc/mapcoercemap.hs b/tests-ghc/unreliable/mapcoercemap.hs similarity index 100% rename from tests-ghc/mapcoercemap.hs rename to tests-ghc/unreliable/mapcoercemap.hs diff --git a/tests-ghc/mapcoercemap.stdout b/tests-ghc/unreliable/mapcoercemap.stdout similarity index 100% rename from tests-ghc/mapcoercemap.stdout rename to tests-ghc/unreliable/mapcoercemap.stdout diff --git a/tests-ghc/mapcoerceseq.hs b/tests-ghc/unreliable/mapcoerceseq.hs similarity index 100% rename from tests-ghc/mapcoerceseq.hs rename to tests-ghc/unreliable/mapcoerceseq.hs diff --git a/tests-ghc/mapcoerceseq.stdout b/tests-ghc/unreliable/mapcoerceseq.stdout similarity index 100% rename from tests-ghc/mapcoerceseq.stdout rename to tests-ghc/unreliable/mapcoerceseq.stdout diff --git a/tests-ghc/mapcoercesmap.hs b/tests-ghc/unreliable/mapcoercesmap.hs similarity index 100% rename from tests-ghc/mapcoercesmap.hs rename to tests-ghc/unreliable/mapcoercesmap.hs diff --git a/tests-ghc/mapcoercesmap.stdout b/tests-ghc/unreliable/mapcoercesmap.stdout similarity index 100% rename from tests-ghc/mapcoercesmap.stdout rename to tests-ghc/unreliable/mapcoercesmap.stdout From git at git.haskell.org Mon Apr 17 21:36:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:36:39 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Remove circular `toList` definition. (446e295) Message-ID: <20170417213639.D268D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/446e295ee0db08bb10f6e5dca6f930669b565ffc >--------------------------------------------------------------- commit 446e295ee0db08bb10f6e5dca6f930669b565ffc Author: Milan Straka Date: Tue Dec 16 11:11:07 2014 +0100 Remove circular `toList` definition. When writing this, I assumed we have explicit `toList` as we have in other containers. We do not have `toList`, and even if we did, the code would not compile, as the two `toList`s (ours and `Foldable`) would collide. >--------------------------------------------------------------- 446e295ee0db08bb10f6e5dca6f930669b565ffc Data/Sequence.hs | 2 -- 1 file changed, 2 deletions(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 800ec46..b540978 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -247,8 +247,6 @@ instance Foldable Seq where {-# INLINE length #-} null = null {-# INLINE null #-} - toList = toList - {-# INLINE toList #-} #endif instance Traversable Seq where From git at git.haskell.org Mon Apr 17 21:36:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:36:41 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Import only used class methods of Foldable. (6b026a7) Message-ID: <20170417213641.DA1CC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/6b026a7a730569d21b27ad2a8c18961cd8662a35 >--------------------------------------------------------------- commit 6b026a7a730569d21b27ad2a8c18961cd8662a35 Author: Milan Straka Date: Tue Dec 16 14:12:37 2014 +0100 Import only used class methods of Foldable. On GHC 7.8, the Foldable class contains also null and length, which conflicts with Data.Sequence{null,length}. >--------------------------------------------------------------- 6b026a7a730569d21b27ad2a8c18961cd8662a35 tests/seq-properties.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/seq-properties.hs b/tests/seq-properties.hs index a64e66d..4cf0876 100644 --- a/tests/seq-properties.hs +++ b/tests/seq-properties.hs @@ -3,7 +3,7 @@ import Data.Sequence -- needs to be compiled with -DTESTING for use here import Control.Applicative (Applicative(..)) import Control.Arrow ((***)) import Data.Array (listArray) -import Data.Foldable (Foldable(..), toList, all, sum) +import Data.Foldable (Foldable(foldl, foldl1, foldr, foldr1), toList, all, sum) import Data.Functor ((<$>), (<$)) import Data.Maybe import Data.Monoid (Monoid(..)) From git at git.haskell.org Mon Apr 17 21:36:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:36:43 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: It is perfectly fine to import class methods... (d288dc7) Message-ID: <20170417213643.E2F493A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/d288dc750949e476af221a832dea8d8c053808a4 >--------------------------------------------------------------- commit d288dc750949e476af221a832dea8d8c053808a4 Author: Milan Straka Date: Tue Dec 16 14:16:20 2014 +0100 It is perfectly fine to import class methods... ...without specifying the class, see Haskell 2010 5.2.1. That allows us to get rid of some conditional includes. Nevetheless, we still conditionally include foldr', as we do not use it for base <4.8. >--------------------------------------------------------------- d288dc750949e476af221a832dea8d8c053808a4 Data/Sequence.hs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index b540978..7d31f79 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -158,14 +158,9 @@ import Control.DeepSeq (NFData(rnf)) import Control.Monad (MonadPlus(..), ap) import Data.Monoid (Monoid(..)) import Data.Functor (Functor(..)) -#if MIN_VERSION_base(4,8,0) -import Data.Foldable (Foldable(foldl, foldl1, foldr, foldr1, foldMap, foldl', foldr', toList)) -#else -#if MIN_VERSION_base(4,6,0) -import Data.Foldable (Foldable(foldl, foldl1, foldr, foldr1, foldMap, foldl'), toList) -#else import Data.Foldable (Foldable(foldl, foldl1, foldr, foldr1, foldMap), foldl', toList) -#endif +#if MIN_VERSION_base(4,8,0) +import Data.Foldable (foldr') #endif import Data.Traversable import Data.Typeable From git at git.haskell.org Mon Apr 17 21:36:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:36:45 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Add forgotten foldMap to the imports. (4a6bbb1) Message-ID: <20170417213645.EB8393A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/4a6bbb14e6d982825235a521510afd55c565cc59 >--------------------------------------------------------------- commit 4a6bbb14e6d982825235a521510afd55c565cc59 Author: Milan Straka Date: Tue Dec 16 14:32:23 2014 +0100 Add forgotten foldMap to the imports. The foldMap is in Prelude on base 4.8, that is why I missed it. >--------------------------------------------------------------- 4a6bbb14e6d982825235a521510afd55c565cc59 tests/seq-properties.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/seq-properties.hs b/tests/seq-properties.hs index 4cf0876..4f4f468 100644 --- a/tests/seq-properties.hs +++ b/tests/seq-properties.hs @@ -3,7 +3,7 @@ import Data.Sequence -- needs to be compiled with -DTESTING for use here import Control.Applicative (Applicative(..)) import Control.Arrow ((***)) import Data.Array (listArray) -import Data.Foldable (Foldable(foldl, foldl1, foldr, foldr1), toList, all, sum) +import Data.Foldable (Foldable(foldl, foldl1, foldr, foldr1, foldMap), toList, all, sum) import Data.Functor ((<$>), (<$)) import Data.Maybe import Data.Monoid (Monoid(..)) From git at git.haskell.org Mon Apr 17 21:36:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:36:47 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Bump version number to 0.5.6.1 (ddf4e4a) Message-ID: <20170417213647.F39073A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/ddf4e4a7abbfb81161251437a6a5bbe8167a7cde >--------------------------------------------------------------- commit ddf4e4a7abbfb81161251437a6a5bbe8167a7cde Author: Milan Straka Date: Tue Dec 16 14:41:17 2014 +0100 Bump version number to 0.5.6.1 >--------------------------------------------------------------- ddf4e4a7abbfb81161251437a6a5bbe8167a7cde containers.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/containers.cabal b/containers.cabal index 6c77693..169507a 100644 --- a/containers.cabal +++ b/containers.cabal @@ -1,5 +1,5 @@ name: containers -version: 0.5.6.0 +version: 0.5.6.1 license: BSD3 license-file: LICENSE maintainer: fox at ucw.cz From git at git.haskell.org Mon Apr 17 21:36:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:36:50 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Fix efficiency claim for zipWith. (107ec12) Message-ID: <20170417213650.08C943A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/107ec12d17aa98d8fd552276b81a94fe6f44224b >--------------------------------------------------------------- commit 107ec12d17aa98d8fd552276b81a94fe6f44224b Author: David Feuer Date: Thu Dec 18 11:19:53 2014 -0500 Fix efficiency claim for zipWith. >--------------------------------------------------------------- 107ec12d17aa98d8fd552276b81a94fe6f44224b Data/Sequence.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 7d31f79..7675698 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -1872,9 +1872,9 @@ reverseNode f (Node3 s a b c) = Node3 s (f c) (f b) (f a) -- them up further and zip them with their matching pieces can be delayed until -- they're actually needed. We do the same thing for Digits (splitting into -- between one and four pieces) and Nodes (splitting into two or three). The --- ultimate result is that we can index, or split at, any location in zs in --- O(log(min{i,n-i})) time *immediately*, with only a constant-factor slowdown --- as thunks are forced along the path. +-- ultimate result is that we can index into, or split at, any location in zs +-- in O((log(min{i,n-i}))^2) time *immediately*, while still being able to +-- force all the thunks in O(n) time. -- -- Benchmark info, and alternatives: -- From git at git.haskell.org Mon Apr 17 21:36:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:36:52 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Merge pull request #101 from treeowl/zipdocfix (314f798) Message-ID: <20170417213652.114153A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/314f7983819861c68e77f0f5798c86812b23fa39 >--------------------------------------------------------------- commit 314f7983819861c68e77f0f5798c86812b23fa39 Merge: ddf4e4a 107ec12 Author: Milan Straka Date: Thu Dec 18 22:59:51 2014 +0100 Merge pull request #101 from treeowl/zipdocfix Fix efficiency claim for zipWith. >--------------------------------------------------------------- 314f7983819861c68e77f0f5798c86812b23fa39 Data/Sequence.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) From git at git.haskell.org Mon Apr 17 21:36:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:36:54 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Use fromList2 to implement fromListN in IsList (ace8f7f) Message-ID: <20170417213654.1AE4E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/ace8f7fd88e5458a8401804e32a2d921d653fdfa >--------------------------------------------------------------- commit ace8f7fd88e5458a8401804e32a2d921d653fdfa Author: David Feuer Date: Fri Dec 19 15:09:03 2014 -0500 Use fromList2 to implement fromListN in IsList >--------------------------------------------------------------- ace8f7fd88e5458a8401804e32a2d921d653fdfa Data/Sequence.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 7d31f79..b216b12 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -1806,6 +1806,7 @@ fromList = Seq . mkTree 1 . map_elem instance GHC.Exts.IsList (Seq a) where type Item (Seq a) = a fromList = fromList + fromListN = fromList2 toList = toList #endif From git at git.haskell.org Mon Apr 17 21:36:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:36:56 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Fix Arbitrary instance for FingerTree (0086aa7) Message-ID: <20170417213656.21F893A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/0086aa753795237cec28be6d2a261708eb7dacf6 >--------------------------------------------------------------- commit 0086aa753795237cec28be6d2a261708eb7dacf6 Author: Ross Paterson Date: Fri Dec 19 23:24:20 2014 +0000 Fix Arbitrary instance for FingerTree The previous version never generated deep trees containing Empty. Also tweaked the size handling so that the tree size is closer to the specified size (though it can still run over a bit). >--------------------------------------------------------------- 0086aa753795237cec28be6d2a261708eb7dacf6 tests/seq-properties.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/seq-properties.hs b/tests/seq-properties.hs index 4f4f468..def17b3 100644 --- a/tests/seq-properties.hs +++ b/tests/seq-properties.hs @@ -112,7 +112,15 @@ instance (Arbitrary a, Sized a) => Arbitrary (FingerTree a) where arb :: (Arbitrary a, Sized a) => Int -> Gen (FingerTree a) arb 0 = return Empty arb 1 = Single <$> arbitrary - arb n = deep <$> arbitrary <*> arb (n `div` 2) <*> arbitrary + arb n = do + pr <- arbitrary + sf <- arbitrary + let n_pr = Prelude.length (toList pr) + let n_sf = Prelude.length (toList sf) + -- adding n `div` 7 ensures that n_m >= 0, and makes more Singles + let n_m = max (n `div` 7) ((n - n_pr - n_sf) `div` 3) + m <- arb n_m + return $ deep pr m sf shrink (Deep _ (One a) Empty (One b)) = [Single a, Single b] shrink (Deep _ pr m sf) = From git at git.haskell.org Mon Apr 17 21:36:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:36:58 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Merge pull request #108 from RossPaterson/master (54c3603) Message-ID: <20170417213658.2A05B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/54c36030839949659b9dd4d12b6e92ec22698d40 >--------------------------------------------------------------- commit 54c36030839949659b9dd4d12b6e92ec22698d40 Merge: 314f798 0086aa7 Author: Milan Straka Date: Sat Dec 20 00:50:39 2014 +0100 Merge pull request #108 from RossPaterson/master Fix Arbitrary instance for FingerTree >--------------------------------------------------------------- 54c36030839949659b9dd4d12b6e92ec22698d40 tests/seq-properties.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) From git at git.haskell.org Mon Apr 17 21:37:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:00 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Add tests for Applicative and Monad instances (0decaa1) Message-ID: <20170417213700.31D973A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/0decaa120039ff4bafbfd4cc62306925a2c31475 >--------------------------------------------------------------- commit 0decaa120039ff4bafbfd4cc62306925a2c31475 Author: David Feuer Date: Thu Dec 18 12:44:57 2014 -0500 Add tests for Applicative and Monad instances Unfortunately, these tests are rather slow, so I hid them behind a SLOW_TESTS macro. I don't know nearly enough about cabal to know how to arrange for tests to be run conditionally, so hopefully someone else can set that up properly. >--------------------------------------------------------------- 0decaa120039ff4bafbfd4cc62306925a2c31475 tests/seq-properties.hs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/seq-properties.hs b/tests/seq-properties.hs index def17b3..2b4774d 100644 --- a/tests/seq-properties.hs +++ b/tests/seq-properties.hs @@ -17,6 +17,9 @@ import qualified Prelude import qualified Data.List import Test.QuickCheck hiding ((><)) import Test.QuickCheck.Poly +#ifdef SLOW_TESTS +import Test.QuickCheck.Function +#endif import Test.Framework import Test.Framework.Providers.QuickCheck2 @@ -93,6 +96,11 @@ main = defaultMain , testProperty "zipWith3" prop_zipWith3 , testProperty "zip4" prop_zip4 , testProperty "zipWith4" prop_zipWith4 +#ifdef SLOW_TESTS + , testProperty "<*>" prop_ap + , testProperty "*>" prop_then + , testProperty ">>=" prop_bind +#endif ] ------------------------------------------------------------------------ @@ -588,6 +596,26 @@ prop_zipWith4 xs ys zs ts = toList' (zipWith4 f xs ys zs ts) ~= Data.List.zipWith4 f (toList xs) (toList ys) (toList zs) (toList ts) where f = (,,,) +-- Applicative operations + +#ifdef SLOW_TESTS +prop_ap :: Seq A -> Seq B -> Bool +prop_ap xs ys = + toList' ((,) <$> xs <*> ys) ~= ( (,) <$> toList xs <*> toList ys ) + +prop_then :: Seq A -> Seq B -> Bool +prop_then xs ys = + toList' (xs *> ys) ~= (toList xs *> toList ys) +#endif + +-- Monad operations + +#ifdef SLOW_TESTS +prop_bind :: Seq A -> Fun A (Seq B) -> Bool +prop_bind xs (Fun _ f) = + toList' (xs >>= f) ~= (toList xs >>= toList . f) +#endif + -- Simple test monad data M a = Action Int a From git at git.haskell.org Mon Apr 17 21:37:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:02 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Remove CPP (b2b55b0) Message-ID: <20170417213702.3AE343A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/b2b55b01aa985bb190a3f1580bf55eb2c83eb18f >--------------------------------------------------------------- commit b2b55b01aa985bb190a3f1580bf55eb2c83eb18f Author: David Feuer Date: Fri Dec 19 23:49:35 2014 -0500 Remove CPP >--------------------------------------------------------------- b2b55b01aa985bb190a3f1580bf55eb2c83eb18f tests/seq-properties.hs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tests/seq-properties.hs b/tests/seq-properties.hs index 2b4774d..880d772 100644 --- a/tests/seq-properties.hs +++ b/tests/seq-properties.hs @@ -17,9 +17,7 @@ import qualified Prelude import qualified Data.List import Test.QuickCheck hiding ((><)) import Test.QuickCheck.Poly -#ifdef SLOW_TESTS import Test.QuickCheck.Function -#endif import Test.Framework import Test.Framework.Providers.QuickCheck2 @@ -96,11 +94,9 @@ main = defaultMain , testProperty "zipWith3" prop_zipWith3 , testProperty "zip4" prop_zip4 , testProperty "zipWith4" prop_zipWith4 -#ifdef SLOW_TESTS , testProperty "<*>" prop_ap , testProperty "*>" prop_then , testProperty ">>=" prop_bind -#endif ] ------------------------------------------------------------------------ @@ -598,7 +594,6 @@ prop_zipWith4 xs ys zs ts = -- Applicative operations -#ifdef SLOW_TESTS prop_ap :: Seq A -> Seq B -> Bool prop_ap xs ys = toList' ((,) <$> xs <*> ys) ~= ( (,) <$> toList xs <*> toList ys ) @@ -606,15 +601,12 @@ prop_ap xs ys = prop_then :: Seq A -> Seq B -> Bool prop_then xs ys = toList' (xs *> ys) ~= (toList xs *> toList ys) -#endif -- Monad operations -#ifdef SLOW_TESTS prop_bind :: Seq A -> Fun A (Seq B) -> Bool prop_bind xs (Fun _ f) = toList' (xs >>= f) ~= (toList xs >>= toList . f) -#endif -- Simple test monad From git at git.haskell.org Mon Apr 17 21:37:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:04 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Merge pull request #102 from treeowl/validation (5482318) Message-ID: <20170417213704.434603A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/5482318831df6f67bb3dffca98dfc72d1dcefc7a >--------------------------------------------------------------- commit 5482318831df6f67bb3dffca98dfc72d1dcefc7a Merge: 54c3603 b2b55b0 Author: Milan Straka Date: Sat Dec 20 12:59:45 2014 +0100 Merge pull request #102 from treeowl/validation Add tests for Applicative and Monad instances >--------------------------------------------------------------- 5482318831df6f67bb3dffca98dfc72d1dcefc7a tests/seq-properties.hs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) From git at git.haskell.org Mon Apr 17 21:37:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:06 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Merge pull request #107 from treeowl/fromListN (ae97ceb) Message-ID: <20170417213706.4D5D73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/ae97ceb44766fb5e78f23670e09a20a9625b0963 >--------------------------------------------------------------- commit ae97ceb44766fb5e78f23670e09a20a9625b0963 Merge: 5482318 ace8f7f Author: Milan Straka Date: Sat Dec 20 13:06:44 2014 +0100 Merge pull request #107 from treeowl/fromListN Use fromList2 to implement fromListN in IsList >--------------------------------------------------------------- ae97ceb44766fb5e78f23670e09a20a9625b0963 Data/Sequence.hs | 1 + 1 file changed, 1 insertion(+) From git at git.haskell.org Mon Apr 17 21:37:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:08 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Reimplement `<*>` (38b1b81) Message-ID: <20170417213708.588093A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/38b1b81c8b5536525d0daad9bd8ee9821a3fb929 >--------------------------------------------------------------- commit 38b1b81c8b5536525d0daad9bd8ee9821a3fb929 Author: David Feuer Date: Thu Dec 18 16:31:10 2014 -0500 Reimplement `<*>` Use `coerce` for the `Functor` instance of `Elem` Using `fmap = coerce` for `Elem` speeds up `<*>` by somewhere around 20%. Benchmark results: OLD: benchmarking <*>/ix1000/500000 time 11.47 ms (11.37 ms .. 11.59 ms) 0.999 R² (0.998 R² .. 1.000 R²) mean 11.61 ms (11.52 ms .. 11.73 ms) std dev 279.9 μs (209.5 μs .. 385.6 μs) benchmarking <*>/nf100/2500/rep time 8.530 ms (8.499 ms .. 8.568 ms) 1.000 R² (1.000 R² .. 1.000 R²) mean 8.511 ms (8.498 ms .. 8.528 ms) std dev 40.40 μs (28.55 μs .. 63.84 μs) benchmarking <*>/nf100/2500/ff time 27.13 ms (26.16 ms .. 28.70 ms) 0.994 R² (0.988 R² .. 1.000 R²) mean 26.49 ms (26.29 ms .. 27.43 ms) std dev 697.1 μs (153.0 μs .. 1.443 ms) benchmarking <*>/nf500/500/rep time 8.421 ms (8.331 ms .. 8.491 ms) 0.991 R² (0.967 R² .. 1.000 R²) mean 8.518 ms (8.417 ms .. 9.003 ms) std dev 529.9 μs (40.37 μs .. 1.176 ms) variance introduced by outliers: 32% (moderately inflated) benchmarking <*>/nf500/500/ff time 33.71 ms (33.58 ms .. 33.86 ms) 1.000 R² (1.000 R² .. 1.000 R²) mean 33.69 ms (33.62 ms .. 33.76 ms) std dev 150.0 μs (119.0 μs .. 191.0 μs) benchmarking <*>/nf2500/100/rep time 8.390 ms (8.259 ms .. 8.456 ms) 0.997 R² (0.992 R² .. 1.000 R²) mean 8.544 ms (8.441 ms .. 8.798 ms) std dev 402.6 μs (21.25 μs .. 714.9 μs) variance introduced by outliers: 23% (moderately inflated) benchmarking <*>/nf2500/100/ff time 53.69 ms (53.33 ms .. 54.08 ms) 1.000 R² (1.000 R² .. 1.000 R²) mean 53.59 ms (53.38 ms .. 53.75 ms) std dev 341.2 μs (231.7 μs .. 473.9 μs) NEW benchmarking <*>/ix1000/500000 time 2.688 μs (2.607 μs .. 2.798 μs) 0.994 R² (0.988 R² .. 1.000 R²) mean 2.632 μs (2.607 μs .. 2.715 μs) std dev 129.9 ns (65.93 ns .. 242.8 ns) variance introduced by outliers: 64% (severely inflated) benchmarking <*>/nf100/2500/rep time 8.371 ms (8.064 ms .. 8.535 ms) 0.983 R² (0.947 R² .. 1.000 R²) mean 8.822 ms (8.590 ms .. 9.463 ms) std dev 991.2 μs (381.3 μs .. 1.809 ms) variance introduced by outliers: 61% (severely inflated) benchmarking <*>/nf100/2500/ff time 22.84 ms (22.74 ms .. 22.94 ms) 1.000 R² (1.000 R² .. 1.000 R²) mean 22.78 ms (22.71 ms .. 22.86 ms) std dev 183.3 μs (116.3 μs .. 291.3 μs) benchmarking <*>/nf500/500/rep time 8.320 ms (8.102 ms .. 8.514 ms) 0.995 R² (0.990 R² .. 0.999 R²) mean 8.902 ms (8.675 ms .. 9.407 ms) std dev 952.4 μs (435.5 μs .. 1.672 ms) variance introduced by outliers: 58% (severely inflated) benchmarking <*>/nf500/500/ff time 24.50 ms (24.41 ms .. 24.58 ms) 1.000 R² (1.000 R² .. 1.000 R²) mean 24.44 ms (24.41 ms .. 24.48 ms) std dev 75.08 μs (50.16 μs .. 111.3 μs) benchmarking <*>/nf2500/100/rep time 8.419 ms (8.366 ms .. 8.458 ms) 1.000 R² (1.000 R² .. 1.000 R²) mean 8.571 ms (8.525 ms .. 8.670 ms) std dev 179.5 μs (112.0 μs .. 278.1 μs) benchmarking <*>/nf2500/100/ff time 24.14 ms (24.07 ms .. 24.26 ms) 1.000 R² (1.000 R² .. 1.000 R²) mean 24.11 ms (24.07 ms .. 24.17 ms) std dev 103.8 μs (68.34 μs .. 142.0 μs) >--------------------------------------------------------------- 38b1b81c8b5536525d0daad9bd8ee9821a3fb929 Data/Sequence.hs | 261 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 258 insertions(+), 3 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 38b1b81c8b5536525d0daad9bd8ee9821a3fb929 From git at git.haskell.org Mon Apr 17 21:37:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:10 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Add Applicative benchmarks (8b47db3) Message-ID: <20170417213710.6053D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/8b47db3af79c31fe5434e95143242a2ef3e1e184 >--------------------------------------------------------------- commit 8b47db3af79c31fe5434e95143242a2ef3e1e184 Author: David Feuer Date: Sat Dec 20 15:02:05 2014 -0500 Add Applicative benchmarks >--------------------------------------------------------------- 8b47db3af79c31fe5434e95143242a2ef3e1e184 benchmarks/Sequence.hs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/benchmarks/Sequence.hs b/benchmarks/Sequence.hs index b6b82fa..a152c3b 100644 --- a/benchmarks/Sequence.hs +++ b/benchmarks/Sequence.hs @@ -1,6 +1,7 @@ -- > ghc -DTESTING --make -O2 -fforce-recomp -i.. Sequence.hs module Main where +import Control.Applicative import Control.DeepSeq import Criterion.Main import Data.List (foldl') @@ -44,6 +45,22 @@ main = do , bench "nf1000" $ nf (\s -> S.fromFunction s (+1)) 1000 , bench "nf10000" $ nf (\s -> S.fromFunction s (+1)) 10000 ] + , bgroup "<*>" + [ bench "ix1000/500000" $ + nf (\s -> ((+) <$> s <*> s) `S.index` (S.length s `div` 2)) (S.fromFunction 1000 (+1)) + , bench "nf100/2500/rep" $ + nf (\(s,t) -> (,) <$> replicate s () <*> replicate t ()) (100,2500) + , bench "nf100/2500/ff" $ + nf (\(s,t) -> (,) <$> S.fromFunction s (+1) <*> S.fromFunction t (*2)) (100,2500) + , bench "nf500/500/rep" $ + nf (\(s,t) -> (,) <$> replicate s () <*> replicate t ()) (500,500) + , bench "nf500/500/ff" $ + nf (\(s,t) -> (,) <$> S.fromFunction s (+1) <*> S.fromFunction t (*2)) (500,500) + , bench "nf2500/100/rep" $ + nf (\(s,t) -> (,) <$> replicate s () <*> replicate t ()) (2500,100) + , bench "nf2500/100/ff" $ + nf (\(s,t) -> (,) <$> S.fromFunction s (+1) <*> S.fromFunction t (*2)) (2500,100) + ] ] -- splitAt+append: repeatedly cut the sequence at a random point From git at git.haskell.org Mon Apr 17 21:37:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:10 +0000 (UTC) Subject: [commit: packages/hoopl] branch 'pr/coverage' created Message-ID: <20170417213710.717AD3A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hoopl New branch : pr/coverage Referencing: 4478ec0b6d38bcd26c66ad09eb512e6952ab7e19 From git at git.haskell.org Mon Apr 17 21:37:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:12 +0000 (UTC) Subject: [commit: packages/hoopl] tag 'v3.10.2.2' created Message-ID: <20170417213712.72B3B3A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hoopl New tag : v3.10.2.2 Referencing: baedc3e5b24a0d37b5a86ad8e26832970a61e5a8 From git at git.haskell.org Mon Apr 17 21:37:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:12 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Exploit some invariants (41b7cb4) Message-ID: <20170417213712.6A1123A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/41b7cb48a1f61911651fc4ea40ac552332de9e96 >--------------------------------------------------------------- commit 41b7cb48a1f61911651fc4ea40ac552332de9e96 Author: Bertram Felgenhauer Date: Sun Dec 21 16:37:11 2014 +0100 Exploit some invariants Consequently, get rid of ApState. This speeds up the immediate-indexing test substantially: Old: benchmarking <*>/ix1000/500000 time 2.688 μs (2.607 μs .. 2.798 μs) 0.994 R² (0.988 R² .. 1.000 R²) mean 2.632 μs (2.607 μs .. 2.715 μs) std dev 129.9 ns (65.93 ns .. 242.8 ns) variance introduced by outliers: 64% (severely inflated) New: benchmarking <*>/ix1000/500000 time 1.410 μs (1.402 μs .. 1.417 μs) 1.000 R² (1.000 R² .. 1.000 R²) mean 1.417 μs (1.411 μs .. 1.425 μs) std dev 21.45 ns (16.80 ns .. 31.73 ns) variance introduced by outliers: 14% (moderately inflated) >--------------------------------------------------------------- 41b7cb48a1f61911651fc4ea40ac552332de9e96 Data/Sequence.hs | 120 ++++++++++++++++++++++--------------------------------- 1 file changed, 47 insertions(+), 73 deletions(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 7a2de82..0a64c3e 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -277,7 +277,7 @@ apShort :: Seq (a -> b) -> Seq a -> Seq b apShort (Seq fs) xs = Seq $ case toList xs of [a,b] -> ap2FT fs (a,b) [a,b,c] -> ap3FT fs (a,b,c) - _ -> error "apShort: not 2-6" + _ -> error "apShort: not 2-3" ap2FT :: FingerTree (Elem (a->b)) -> (a,a) -> FingerTree (Elem b) ap2FT fs (x,y) = Deep (size fs * 2) @@ -298,104 +298,85 @@ ap3FT fs (x,y,z) = Deep (size fs * 3) -- <*> when the length of each argument is at least four. apty :: Seq (a -> b) -> Seq a -> Seq b apty (Seq fs) (Seq xs at Deep{}) = Seq $ - runApState (fmap firstf) (fmap lastf) fmap fs' (ApState xs' xs' xs') + Deep (s' * size fs) + (fmap (fmap firstf) pr') + (aptyMiddle (fmap firstf) (fmap lastf) fmap fs' xs') + (fmap (fmap lastf) sf') where (Elem firstf, fs', Elem lastf) = trimTree fs - xs' = rigidify xs + xs'@(Deep s' pr' _m' sf') = rigidify xs apty _ _ = error "apty: expects a Deep constructor" -data ApState a = ApState (FingerTree a) (FingerTree a) (FingerTree a) - --- | 'runApState' uses three copies of the @xs@ tree to produce the @fs<*>xs@ --- tree. It pulls left digits off the left tree, right digits off the right tree, --- and squashes down the other four digits. Once it gets to the bottom, it turns --- the middle tree into a 2-3 tree, applies 'mapMulFT' to produce the main body, --- and glues all the pieces together. -runApState +-- | 'aptyMiddle' does most of the hard work of computing @fs<*>xs at . +-- It produces the center part of a finger tree, with a prefix corresponding +-- to the prefix of @xs@ and a suffix corresponding to the suffix of @xs@ +-- omitted; the missing suffix and prefix are added by the caller. +-- For the recursive call, it squashes the prefix and the suffix into +-- the center tree. Once it gets to the bottom, it turns the tree into +-- a 2-3 tree, applies 'mapMulFT' to produce the main body, and glues all +-- the pieces together. +aptyMiddle :: Sized c => (c -> d) -> (c -> d) -> ((a -> b) -> c -> d) -> FingerTree (Elem (a -> b)) - -> ApState c - -> FingerTree d + -> FingerTree c + -> FingerTree (Node d) -- Not at the bottom yet -runApState firstf +aptyMiddle firstf lastf map23 fs - (ApState - (Deep sl - prl - (Deep sml prml mml sfml) - sfl) - (Deep sm - prm - (Deep _smm prmm mmm sfmm) - sfm) - (Deep sr - prr - (Deep smr prmr mmr sfmr) - sfr)) - = Deep (sl + sr + sm * size fs) - (fmap firstf prl) - (runApState (fmap firstf) + (Deep s pr (Deep sm prm mm sfm) sf) + = Deep (sm + s * (size fs + 1)) -- note: sm = s - size pr - size sf + (fmap (fmap firstf) prm) + (aptyMiddle (fmap firstf) (fmap lastf) (\f -> fmap (map23 f)) fs - nextState) - (fmap lastf sfr) - where nextState = - ApState - (Deep (sml + size sfl) prml mml (squashR sfml sfl)) - (Deep sm (squashL prm prmm) mmm (squashR sfmm sfm)) - (Deep (smr + size prr) (squashL prr prmr) mmr sfmr) + (Deep s (squashL pr prm) mm (squashR sfm sf))) + (fmap (fmap lastf) sfm) -- At the bottom -runApState firstf +aptyMiddle firstf lastf map23 fs - (ApState - (Deep sl prl ml sfl) - (Deep sm prm mm sfm) - (Deep sr prr mr sfr)) - = Deep (sl + sr + sm * size fs) - (fmap firstf prl) - ((fmap (fmap firstf) ml `snocTree` fmap firstf (digitToNode sfl)) - `appendTree0` middle `appendTree0` - (fmap lastf (digitToNode prr) `consTree` fmap (fmap lastf) mr)) - (fmap lastf sfr) - where middle = case trimTree $ mapMulFT sm (\(Elem f) -> fmap (fmap (map23 f)) converted) fs of + (Deep s pr m sf) + = (fmap (fmap firstf) m `snocTree` fmap firstf (digitToNode sf)) + `appendTree0` middle `appendTree0` + (fmap lastf (digitToNode pr) `consTree` fmap (fmap lastf) m) + where middle = case trimTree $ mapMulFT s (\(Elem f) -> fmap (fmap (map23 f)) converted) fs of (firstMapped, restMapped, lastMapped) -> Deep (size firstMapped + size restMapped + size lastMapped) (nodeToDigit firstMapped) restMapped (nodeToDigit lastMapped) - converted = case mm of - Empty -> Node2 sm lconv rconv - Single q -> Node3 sm lconv q rconv - Deep{} -> error "runApState: a tree is shallower than the middle tree" - lconv = digitToNode prm - rconv = digitToNode sfm + converted = case m of + Empty -> Node2 s lconv rconv + Single q -> Node3 s lconv q rconv + Deep{} -> error "aptyMiddle: impossible" + lconv = digitToNode pr + rconv = digitToNode sf -runApState _ _ _ _ _ = error "runApState: ApState must hold Deep finger trees of the same depth" +aptyMiddle _ _ _ _ _ = error "aptyMiddle: expected Deep finger tree" {-# SPECIALIZE - runApState + aptyMiddle :: (Node c -> d) -> (Node c -> d) -> ((a -> b) -> Node c -> d) -> FingerTree (Elem (a -> b)) - -> ApState (Node c) - -> FingerTree d + -> FingerTree (Node c) + -> FingerTree (Node d) #-} {-# SPECIALIZE - runApState + aptyMiddle :: (Elem c -> d) -> (Elem c -> d) -> ((a -> b) -> Elem c -> d) -> FingerTree (Elem (a -> b)) - -> ApState (Elem c) - -> FingerTree d + -> FingerTree (Elem c) + -> FingerTree (Node d) #-} digitToNode :: Sized a => Digit a -> Node a @@ -2096,16 +2077,9 @@ reverseNode f (Node3 s a b c) = Node3 s (f c) (f b) (f a) -- Mapping with a splittable value ------------------------------------------------------------------------ --- For zipping, and probably also for (<*>), it is useful to build a result by +-- For zipping, it is useful to build a result by -- traversing a sequence while splitting up something else. For zipping, we --- traverse the first sequence while splitting up the second [and third [and --- fourth]]. For fs <*> xs, we hope to traverse --- --- > replicate (length fs * length xs) () --- --- while splitting something essentially equivalent to --- --- > fmap (\f -> fmap f xs) fs +-- traverse the first sequence while splitting up the second. -- -- What makes all this crazy code a good idea: -- @@ -2129,8 +2103,8 @@ reverseNode f (Node3 s a b c) = Node3 s (f c) (f b) (f a) -- they're actually needed. We do the same thing for Digits (splitting into -- between one and four pieces) and Nodes (splitting into two or three). The -- ultimate result is that we can index into, or split at, any location in zs --- in O((log(min{i,n-i}))^2) time *immediately*, while still being able to --- force all the thunks in O(n) time. +-- in polylogarithmic time *immediately*, while still being able to force all +-- the thunks in O(n) time. -- -- Benchmark info, and alternatives: -- From git at git.haskell.org Mon Apr 17 21:37:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:14 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Merge pull request #104 from treeowl/ap (2546efe) Message-ID: <20170417213714.72A613A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/2546efeadaca6c078b5ddc23557af71fd3d6966d >--------------------------------------------------------------- commit 2546efeadaca6c078b5ddc23557af71fd3d6966d Merge: ae97ceb 41b7cb4 Author: Milan Straka Date: Mon Dec 22 11:13:16 2014 +0100 Merge pull request #104 from treeowl/ap Make <*> fast >--------------------------------------------------------------- 2546efeadaca6c078b5ddc23557af71fd3d6966d Data/Sequence.hs | 257 ++++++++++++++++++++++++++++++++++++++++++++++--- benchmarks/Sequence.hs | 17 ++++ 2 files changed, 260 insertions(+), 14 deletions(-) From git at git.haskell.org Mon Apr 17 21:37:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:14 +0000 (UTC) Subject: [commit: packages/hoopl] master, pr/coverage: Repo cleanup. Fixes #6 (26a429c) Message-ID: <20170417213714.824B93A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hoopl On branches: master,pr/coverage Link : http://git.haskell.org/packages/hoopl.git/commitdiff/26a429c02ab6333b7194bddcc91b35a4d994f3ff >--------------------------------------------------------------- commit 26a429c02ab6333b7194bddcc91b35a4d994f3ff Author: Alexander Pankiv Date: Fri Dec 25 16:56:45 2015 +0100 Repo cleanup. Fixes #6 * remove unused modules * delete unnecessary tex comments * delete paper * update .gitignore: we no longer need to ignore LaTeX build artifacts, as the paper has been removed from the repository. We also ignore cabal sandboxes * update readme to link to the paper. >--------------------------------------------------------------- 26a429c02ab6333b7194bddcc91b35a4d994f3ff .gitignore | 36 +- HOWTO-BRANCHES | 15 - PROBLEMS | 68 - README.md | 16 +- hoopl.cabal | 2 - hoopl.pdf | Bin 279781 -> 0 bytes paper/.gitignore | 46 - paper/Makefile | 63 - paper/NOTES | 197 -- paper/Rew.hs | 46 - paper/TODO | 26 - paper/bbl.dias.mk | 5 - paper/bbl.nr.mk | 6 - paper/bbl.simonpj.mk | 2 - paper/bitly.dias.mk | 3 - paper/bitly.nr.mk | 3 - paper/bitly.simonpj.mk | 3 - paper/code.sty | 94 - paper/defuse | 463 ---- paper/dfopt.bib | 250 -- paper/dfopt.tex | 4043 --------------------------------- paper/haskell-reviews.txt | 222 -- paper/hsprelude | 60 - paper/icfp2010response.txt | 70 - paper/icfp2010reviews.html | 424 ---- paper/latex.mk | 18 - paper/mkfile | 82 - paper/notes-relatedwork | 57 - paper/old-implementation-sections.tex | 344 --- paper/onepage.tex | 610 ----- paper/proto-response.txt | 87 - paper/refs.txt | 78 - paper/spell.mk | 21 - paper/xsource | 75 - src/Compiler/Hoopl/Combinators.hs | 6 - src/Compiler/Hoopl/Dataflow.hs | 57 +- src/Compiler/Hoopl/DataflowFold.hs | 712 ------ src/Compiler/Hoopl/OldDataflow.hs | 698 ------ 38 files changed, 34 insertions(+), 8974 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 26a429c02ab6333b7194bddcc91b35a4d994f3ff From git at git.haskell.org Mon Apr 17 21:37:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:16 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Bump version number to 0.5.6.2 (924fafe) Message-ID: <20170417213716.7A8633A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/924fafe1030301ee1d62d7acd576e86b50251157 >--------------------------------------------------------------- commit 924fafe1030301ee1d62d7acd576e86b50251157 Author: Milan Straka Date: Mon Dec 22 11:54:05 2014 +0100 Bump version number to 0.5.6.2 >--------------------------------------------------------------- 924fafe1030301ee1d62d7acd576e86b50251157 containers.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/containers.cabal b/containers.cabal index 169507a..c5d7523 100644 --- a/containers.cabal +++ b/containers.cabal @@ -1,5 +1,5 @@ name: containers -version: 0.5.6.1 +version: 0.5.6.2 license: BSD3 license-file: LICENSE maintainer: fox at ucw.cz From git at git.haskell.org Mon Apr 17 21:37:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:16 +0000 (UTC) Subject: [commit: packages/hoopl] master, pr/coverage: Update Travis to build with GHC 8.0.1 (2d7c9ae) Message-ID: <20170417213716.87B893A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hoopl On branches: master,pr/coverage Link : http://git.haskell.org/packages/hoopl.git/commitdiff/2d7c9ae93ecf145bca2b82012f89f93ab543098a >--------------------------------------------------------------- commit 2d7c9ae93ecf145bca2b82012f89f93ab543098a Author: Jan Stolarek Date: Mon Jan 18 17:26:32 2016 +0100 Update Travis to build with GHC 8.0.1 >--------------------------------------------------------------- 2d7c9ae93ecf145bca2b82012f89f93ab543098a .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 7d29550..67253fb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,7 @@ env: - CABALVER=1.16 GHCVER=7.6.3 - CABALVER=1.18 GHCVER=7.8.4 - CABALVER=1.22 GHCVER=7.10.1 + - CABALVER=1.24 GHCVER=8.0.1 - CABALVER=head GHCVER=head matrix: From git at git.haskell.org Mon Apr 17 21:37:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:18 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: update benchmarks Makefile (5f9af63) Message-ID: <20170417213718.823273A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/5f9af637de232236abf1890f1e05a3df4421ef15 >--------------------------------------------------------------- commit 5f9af637de232236abf1890f1e05a3df4421ef15 Author: Bertram Felgenhauer Date: Sun Dec 21 21:01:11 2014 +0100 update benchmarks Makefile >--------------------------------------------------------------- 5f9af637de232236abf1890f1e05a3df4421ef15 benchmarks/Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/benchmarks/Makefile b/benchmarks/Makefile index 1539a2a..aacccef 100644 --- a/benchmarks/Makefile +++ b/benchmarks/Makefile @@ -1,10 +1,12 @@ all: bench-%: %.hs force - ghc -O2 -DTESTING $< -i../$(TOP) -o $@ -outputdir tmp -rtsopts + ghc -O2 -DTESTING $< -I../include -i../$(TOP) -o $@ -outputdir tmp -rtsopts + +.PRECIOUS: bench-% bench-%.csv: bench-% - ./bench-$* $(BENCHMARK) -v -u bench-$*.csv + ./bench-$* "$(BENCHMARK)" -v1 --csv bench-$*.csv .PHONY: force clean veryclean force: From git at git.haskell.org Mon Apr 17 21:37:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:18 +0000 (UTC) Subject: [commit: packages/hoopl] master, pr/coverage: Remove unused files (6aa3938) Message-ID: <20170417213718.8E3B83A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hoopl On branches: master,pr/coverage Link : http://git.haskell.org/packages/hoopl.git/commitdiff/6aa393880e4a5d9997d92c528d102ae18ce447de >--------------------------------------------------------------- commit 6aa393880e4a5d9997d92c528d102ae18ce447de Author: Jan Stolarek Date: Mon Jan 18 17:37:34 2016 +0100 Remove unused files >--------------------------------------------------------------- 6aa393880e4a5d9997d92c528d102ae18ce447de src/LOOPS | 45 --------------------------------------------- src/mkfile | 55 ------------------------------------------------------- src/subdir.mk | 11 ----------- 3 files changed, 111 deletions(-) diff --git a/src/LOOPS b/src/LOOPS deleted file mode 100644 index ba72bf0..0000000 --- a/src/LOOPS +++ /dev/null @@ -1,45 +0,0 @@ -Thoughts about loop-based analyses -================================== - -A loop analysis will want to have certain inputs, perhaps including - - - A set of loop headers - - The dominance relation - - The reachability relation - -Let's assume - - type Header = Label - type Headers = LabelSet - -We can imagine doing loop analyses as follows: - - - The dataflow fact is `Map Header f` where `f` is a lattice of - facts. - - - If at a given point (edge) in the flow graph, header `H` is a key in the - map, then that point is reachable from `H`, and the fact stored in - the map is true on all paths that originate at `H` and terminate - at that point. - - - If a given point (edge) in the flow graph cannot reach `H`, it is - safe (but not necessary) to delete `H` from the map. It is - probably worth deleting `H` if possible, because if nothing else - it will keep the program from allocating one thunk per node `N` - that is reachable from `H` but does not reach `H`. - - - If at a given point in the flow graph, `H` is not a key in the map, - then we expect either the point is not reachable from `H` or it - does not reach `H`. That is, we want `H` to be a key at exactly - those points that are in a loop containing `H`. - - - If a join function gets two maps and `H` is a key in just one of - them, the map without `H` can be ignored, since that edge is not - yet known to be reachable from `H`. We can therefore use the - empty map as a bottom element. - - - If `join` is the join function on `f`, the join function on maps - can *almost* be defined using `Data.Map.unionWithKey f`, but - unfortunately not, because of the beastly `ChangeFlag`. - A person like Chris Rice should explore a suitable higher-order - function for lifting joins into finite maps. diff --git a/src/mkfile b/src/mkfile deleted file mode 100644 index 01e2543..0000000 --- a/src/mkfile +++ /dev/null @@ -1,55 +0,0 @@ -PKG=hoopl -SRC=Graph Label GraphUtil Fuel MkGraph Dataflow -VERSION=`awk '$1 == "Version:" { print $2 }' $PKG.cabal` -HOOPL=Compiler/Hoopl -HS=${SRC:%=$HOOPL/%.hs} -O=${SRC:%=$HOOPL/%.o} -CABAL=hoopl -CONFIG=.config.$CABAL - -all:V: $O hoopl.pdf - -dist:V: hoopl.pdf - cabal sdist - -hoopl.pdf: ../paper/dfopt.pdf - cp -a -v $prereq $target - -test:V: - cabal install --enable-documentation - (cd ../testing && mk test) - -install:V: $CONFIG - cabal install --enable-documentation - -build:V: $CONFIG - cabal build - -check:V: $CONFIG - cabal check - -upload:V: hoopl.pdf $CONFIG - cabal build - cabal sdist - cabal upload dist/$PKG-$VERSION.tar.gz - -config:V: $CONFIG - -.config.&:D: &.cabal - cabal configure --user > $target - -clean:V: - rm -f `find [A-Z]* ../testing -name '*.o' -o '*.hi'` - -%.pdf: %.tex - (cd `dirname $prereq`; mk `basename $target`) - - -%.o: %.hs - ghc --make -c $prereq - - -clean:V: - rm -f $HOOPL/*.o - rm -f $HOOPL/*.hi - rm -f *~ $HOOPL/*~ diff --git a/src/subdir.mk b/src/subdir.mk deleted file mode 100644 index 04b65b6..0000000 --- a/src/subdir.mk +++ /dev/null @@ -1,11 +0,0 @@ - -all:V: obj - -obj:V: - ghc -i$TOP --make *.hs - -clean:V: - rm -f *.o *.hi *~ - -test install build check:V: - (cd $TOP && mk $target) From git at git.haskell.org Mon Apr 17 21:37:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:20 +0000 (UTC) Subject: [commit: packages/hoopl] master, pr/coverage: Update .cabal file (bfb8c94) Message-ID: <20170417213720.93AE83A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hoopl On branches: master,pr/coverage Link : http://git.haskell.org/packages/hoopl.git/commitdiff/bfb8c944c6ca89acf59cd463504babeb29326463 >--------------------------------------------------------------- commit bfb8c944c6ca89acf59cd463504babeb29326463 Author: Jan Stolarek Date: Mon Jan 18 18:17:15 2016 +0100 Update .cabal file >--------------------------------------------------------------- bfb8c944c6ca89acf59cd463504babeb29326463 hoopl.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hoopl.cabal b/hoopl.cabal index cbd604c..d023d6e 100644 --- a/hoopl.cabal +++ b/hoopl.cabal @@ -18,7 +18,7 @@ Cabal-Version: >=1.10 Synopsis: A library to support dataflow analysis and optimization Category: Compilers/Interpreters Tested-With: GHC>=7.0.1 -Extra-Source-Files: README.md, hoopl.pdf, changelog.md +Extra-Source-Files: README.md, changelog.md Source-repository head Type: git From git at git.haskell.org Mon Apr 17 21:37:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:20 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: update benchmarks to work with criterion-1.0 (5364bea) Message-ID: <20170417213720.8A60F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/5364beaa69609ba3c0868cec4380b9c36105b740 >--------------------------------------------------------------- commit 5364beaa69609ba3c0868cec4380b9c36105b740 Author: Bertram Felgenhauer Date: Mon Dec 22 17:08:21 2014 +0100 update benchmarks to work with criterion-1.0 >--------------------------------------------------------------- 5364beaa69609ba3c0868cec4380b9c36105b740 benchmarks/IntMap.hs | 6 ++---- benchmarks/IntSet.hs | 6 ++---- benchmarks/Map.hs | 6 ++---- benchmarks/Sequence.hs | 7 ++++--- benchmarks/Set.hs | 6 ++---- 5 files changed, 12 insertions(+), 19 deletions(-) diff --git a/benchmarks/IntMap.hs b/benchmarks/IntMap.hs index 87465a7..38104c0 100644 --- a/benchmarks/IntMap.hs +++ b/benchmarks/IntMap.hs @@ -4,7 +4,6 @@ module Main where import Control.DeepSeq import Control.Exception (evaluate) import Control.Monad.Trans (liftIO) -import Criterion.Config import Criterion.Main import Data.List (foldl') import qualified Data.IntMap as M @@ -13,9 +12,8 @@ import Prelude hiding (lookup) main = do let m = M.fromAscList elems :: M.IntMap Int - defaultMainWith - defaultConfig - (liftIO . evaluate $ rnf [m]) + evaluate $ rnf [m] + defaultMain [ bench "lookup" $ whnf (lookup keys) m , bench "insert" $ whnf (ins elems) M.empty , bench "insertWith empty" $ whnf (insWith elems) M.empty diff --git a/benchmarks/IntSet.hs b/benchmarks/IntSet.hs index 7c16c91..a768a32 100644 --- a/benchmarks/IntSet.hs +++ b/benchmarks/IntSet.hs @@ -5,7 +5,6 @@ module Main where import Control.DeepSeq import Control.Exception (evaluate) import Control.Monad.Trans (liftIO) -import Criterion.Config import Criterion.Main import Data.List (foldl') import qualified Data.IntSet as S @@ -14,9 +13,8 @@ main = do let s = S.fromAscList elems :: S.IntSet s_even = S.fromAscList elems_even :: S.IntSet s_odd = S.fromAscList elems_odd :: S.IntSet - defaultMainWith - defaultConfig - (liftIO . evaluate $ rnf [s, s_even, s_odd]) + evaluate $ rnf [s, s_even, s_odd] + defaultMain [ bench "member" $ whnf (member elems) s , bench "insert" $ whnf (ins elems) S.empty , bench "map" $ whnf (S.map (+ 1)) s diff --git a/benchmarks/Map.hs b/benchmarks/Map.hs index d0d539a..60e7ace 100644 --- a/benchmarks/Map.hs +++ b/benchmarks/Map.hs @@ -4,7 +4,6 @@ module Main where import Control.DeepSeq import Control.Exception (evaluate) import Control.Monad.Trans (liftIO) -import Criterion.Config import Criterion.Main import Data.List (foldl') import qualified Data.Map as M @@ -15,9 +14,8 @@ main = do let m = M.fromAscList elems :: M.Map Int Int m_even = M.fromAscList elems_even :: M.Map Int Int m_odd = M.fromAscList elems_odd :: M.Map Int Int - defaultMainWith - defaultConfig - (liftIO . evaluate $ rnf [m, m_even, m_odd]) + evaluate $ rnf [m, m_even, m_odd] + defaultMain [ bench "lookup absent" $ whnf (lookup evens) m_odd , bench "lookup present" $ whnf (lookup evens) m_even , bench "insert absent" $ whnf (ins elems_even) m_odd diff --git a/benchmarks/Sequence.hs b/benchmarks/Sequence.hs index a152c3b..7ccede9 100644 --- a/benchmarks/Sequence.hs +++ b/benchmarks/Sequence.hs @@ -3,6 +3,7 @@ module Main where import Control.Applicative import Control.DeepSeq +import Control.Exception (evaluate) import Criterion.Main import Data.List (foldl') import qualified Data.Sequence as S @@ -14,19 +15,19 @@ main = do s100 = S.fromList [1..100] :: S.Seq Int s1000 = S.fromList [1..1000] :: S.Seq Int s10000 = S.fromList [1..10000] :: S.Seq Int - rnf [s10, s100, s1000, s10000] `seq` return () + evaluate $ rnf [s10, s100, s1000, s10000] let g = mkStdGen 1 let rlist n = map (`mod` (n+1)) (take 10000 (randoms g)) :: [Int] r10 = rlist 10 r100 = rlist 100 r1000 = rlist 1000 r10000 = rlist 10000 - rnf [r10, r100, r1000, r10000] `seq` return () + evaluate $ rnf [r10, r100, r1000, r10000] let u10 = S.replicate 10 () :: S.Seq () u100 = S.replicate 100 () :: S.Seq () u1000 = S.replicate 1000 () :: S.Seq () u10000 = S.replicate 10000 () :: S.Seq () - rnf [u10, u100, u1000, u10000] `seq` return () + evaluate $ rnf [u10, u100, u1000, u10000] defaultMain [ bgroup "splitAt/append" [ bench "10" $ nf (shuffle r10) s10 diff --git a/benchmarks/Set.hs b/benchmarks/Set.hs index e21001c..3a6e8aa 100644 --- a/benchmarks/Set.hs +++ b/benchmarks/Set.hs @@ -6,7 +6,6 @@ module Main where import Control.DeepSeq import Control.Exception (evaluate) import Control.Monad.Trans (liftIO) -import Criterion.Config import Criterion.Main import Data.List (foldl') import qualified Data.Set as S @@ -15,9 +14,8 @@ main = do let s = S.fromAscList elems :: S.Set Int s_even = S.fromAscList elems_even :: S.Set Int s_odd = S.fromAscList elems_odd :: S.Set Int - defaultMainWith - defaultConfig - (liftIO . evaluate $ rnf [s, s_even, s_odd]) + evaluate $ rnf [s, s_even, s_odd] + defaultMain [ bench "member" $ whnf (member elems) s , bench "insert" $ whnf (ins elems) S.empty , bench "map" $ whnf (S.map (+ 1)) s From git at git.haskell.org Mon Apr 17 21:37:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:22 +0000 (UTC) Subject: [commit: packages/hoopl] master, pr/coverage: Update webpage link in .cabal file. Fixes #27 (b08f17c) Message-ID: <20170417213722.9A4B93A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hoopl On branches: master,pr/coverage Link : http://git.haskell.org/packages/hoopl.git/commitdiff/b08f17c3c4f505bb31b20320079446247ac0515d >--------------------------------------------------------------- commit b08f17c3c4f505bb31b20320079446247ac0515d Author: Jan Stolarek Date: Mon Jan 18 22:03:04 2016 +0100 Update webpage link in .cabal file. Fixes #27 >--------------------------------------------------------------- b08f17c3c4f505bb31b20320079446247ac0515d hoopl.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hoopl.cabal b/hoopl.cabal index d023d6e..68dbba7 100644 --- a/hoopl.cabal +++ b/hoopl.cabal @@ -11,7 +11,7 @@ License: BSD3 License-File: LICENSE Author: Norman Ramsey, Joao Dias, Simon Marlow and Simon Peyton Jones Maintainer: nr at cs.tufts.edu, andreas.voellmy at gmail.com, email at ningwang.org -Homepage: http://ghc.cs.tufts.edu/hoopl/ +Homepage: https://github.com/haskell/hoopl Bug-Reports: https://github.com/haskell/hoopl/issues/ Build-Type: Simple Cabal-Version: >=1.10 From git at git.haskell.org Mon Apr 17 21:37:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:22 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Merge pull request #110 from int-e/bench (55f65cd) Message-ID: <20170417213722.939263A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/55f65cddc15bb30149795de2c5498e428381f2d2 >--------------------------------------------------------------- commit 55f65cddc15bb30149795de2c5498e428381f2d2 Merge: 924fafe 5364bea Author: Milan Straka Date: Mon Dec 22 17:56:05 2014 +0100 Merge pull request #110 from int-e/bench update benchmarks for criterion-1.0 >--------------------------------------------------------------- 55f65cddc15bb30149795de2c5498e428381f2d2 benchmarks/IntMap.hs | 6 ++---- benchmarks/IntSet.hs | 6 ++---- benchmarks/Makefile | 6 ++++-- benchmarks/Map.hs | 6 ++---- benchmarks/Sequence.hs | 7 ++++--- benchmarks/Set.hs | 6 ++---- 6 files changed, 16 insertions(+), 21 deletions(-) From git at git.haskell.org Mon Apr 17 21:37:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:24 +0000 (UTC) Subject: [commit: packages/hoopl] master, pr/coverage: Update maintainers (fixes #26) (619bc24) Message-ID: <20170417213724.A090C3A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hoopl On branches: master,pr/coverage Link : http://git.haskell.org/packages/hoopl.git/commitdiff/619bc246e1f871d20333a1244216e12dd3e052e4 >--------------------------------------------------------------- commit 619bc246e1f871d20333a1244216e12dd3e052e4 Author: Jan Stolarek Date: Mon Feb 1 08:34:42 2016 +0100 Update maintainers (fixes #26) * Ning Wang is primary maintainer * Michal Terepeta is secondary maintainer * Andreas Voellmy is no longer a maintainer >--------------------------------------------------------------- 619bc246e1f871d20333a1244216e12dd3e052e4 hoopl.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hoopl.cabal b/hoopl.cabal index 68dbba7..19a725f 100644 --- a/hoopl.cabal +++ b/hoopl.cabal @@ -10,7 +10,7 @@ Description: License: BSD3 License-File: LICENSE Author: Norman Ramsey, Joao Dias, Simon Marlow and Simon Peyton Jones -Maintainer: nr at cs.tufts.edu, andreas.voellmy at gmail.com, email at ningwang.org +Maintainer: Ning Wang , Michal Terepeta , Norman Ramsey Homepage: https://github.com/haskell/hoopl Bug-Reports: https://github.com/haskell/hoopl/issues/ Build-Type: Simple From git at git.haskell.org Mon Apr 17 21:37:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:24 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Make applicativeTree aim for safe digits (1e962fc) Message-ID: <20170417213724.9C90B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/1e962fc2772008512509955316fb4d6eab2766e3 >--------------------------------------------------------------- commit 1e962fc2772008512509955316fb4d6eab2766e3 Author: David Feuer Date: Wed Dec 24 22:03:29 2014 -0500 Make applicativeTree aim for safe digits As previously discussed, this gives the tree more flexibility and matches what other functions do. >--------------------------------------------------------------- 1e962fc2772008512509955316fb4d6eab2766e3 Data/Sequence.hs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 0a64c3e..c256a53 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -856,17 +856,14 @@ applicativeTree n mSize m = mSize `seq` case n of 4 -> deepA two emptyTree two 5 -> deepA three emptyTree two 6 -> deepA three emptyTree three - 7 -> deepA four emptyTree three - 8 -> deepA four emptyTree four _ -> case n `quotRem` 3 of (q,0) -> deepA three (applicativeTree (q - 2) mSize' n3) three - (q,1) -> deepA four (applicativeTree (q - 2) mSize' n3) three - (q,_) -> deepA four (applicativeTree (q - 2) mSize' n3) four + (q,1) -> deepA two (applicativeTree (q - 1) mSize' n3) two + (q,_) -> deepA three (applicativeTree (q - 1) mSize' n3) two where one = fmap One m two = liftA2 Two m m three = liftA3 Three m m m - four = liftA3 Four m m m <*> m deepA = liftA3 (Deep (n * mSize)) mSize' = 3 * mSize n3 = liftA3 (Node3 mSize') m m m @@ -2335,7 +2332,7 @@ unstableSortBy cmp (Seq xs) = toPQ cmp (\ (Elem x) -> PQueue x Nil) xs -- | fromList2, given a list and its length, constructs a completely --- balanced Seq whose elements are that list using the applicativeTree +-- balanced Seq whose elements are that list using the replicateA -- generalization. fromList2 :: Int -> [a] -> Seq a fromList2 n = execState (replicateA n (State ht)) From git at git.haskell.org Mon Apr 17 21:37:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:28 +0000 (UTC) Subject: [commit: packages/hoopl] master, pr/coverage: Add Functor, Foldable, Traversable instances for LabelMap (dccbc3a) Message-ID: <20170417213728.AC53D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hoopl On branches: master,pr/coverage Link : http://git.haskell.org/packages/hoopl.git/commitdiff/dccbc3aa74d70a5cca118a2735bda1bc09cdffe5 >--------------------------------------------------------------- commit dccbc3aa74d70a5cca118a2735bda1bc09cdffe5 Author: Ben Gamari Date: Mon Mar 28 15:23:44 2016 +0200 Add Functor, Foldable, Traversable instances for LabelMap >--------------------------------------------------------------- dccbc3aa74d70a5cca118a2735bda1bc09cdffe5 src/Compiler/Hoopl/Label.hs | 8 +++++++- src/Compiler/Hoopl/Unique.hs | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Compiler/Hoopl/Label.hs b/src/Compiler/Hoopl/Label.hs index a1c890a..0f6c753 100644 --- a/src/Compiler/Hoopl/Label.hs +++ b/src/Compiler/Hoopl/Label.hs @@ -1,4 +1,5 @@ {-# LANGUAGE CPP, TypeFamilies #-} +{-# LANGUAGE DeriveFunctor, DeriveFoldable, DeriveTraversable #-} #if __GLASGOW_HASKELL__ >= 701 {-# LANGUAGE Safe #-} #endif @@ -17,6 +18,10 @@ where import Compiler.Hoopl.Collections import Compiler.Hoopl.Unique +#if !MIN_VERSION_base(4,8,0) +import Data.Traversable (Traversable) +import Data.Foldable (Foldable) +#endif ----------------------------------------------------------------------------- -- Label @@ -64,7 +69,8 @@ instance IsSet LabelSet where ----------------------------------------------------------------------------- -- LabelMap -newtype LabelMap v = LM (UniqueMap v) deriving (Eq, Ord, Show) +newtype LabelMap v = LM (UniqueMap v) + deriving (Eq, Ord, Show, Functor, Foldable, Traversable) instance IsMap LabelMap where type KeyOf LabelMap = Label diff --git a/src/Compiler/Hoopl/Unique.hs b/src/Compiler/Hoopl/Unique.hs index 79a7c7c..ca2ca7a 100644 --- a/src/Compiler/Hoopl/Unique.hs +++ b/src/Compiler/Hoopl/Unique.hs @@ -1,4 +1,5 @@ {-# LANGUAGE CPP, TypeFamilies #-} +{-# LANGUAGE DeriveFunctor, DeriveFoldable, DeriveTraversable #-} #if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-} #elif __GLASGOW_HASKELL__ >= 701 @@ -26,6 +27,10 @@ import qualified Data.IntSet as S import Control.Applicative as AP import Control.Monad (ap,liftM) +#if !MIN_VERSION_base(4,8,0) +import Data.Traversable (Traversable) +import Data.Foldable (Foldable) +#endif ----------------------------------------------------------------------------- -- Unique @@ -69,7 +74,8 @@ instance IsSet UniqueSet where ----------------------------------------------------------------------------- -- UniqueMap -newtype UniqueMap v = UM (M.IntMap v) deriving (Eq, Ord, Show) +newtype UniqueMap v = UM (M.IntMap v) + deriving (Eq, Ord, Show, Functor, Foldable, Traversable) instance IsMap UniqueMap where type KeyOf UniqueMap = Unique From git at git.haskell.org Mon Apr 17 21:37:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:26 +0000 (UTC) Subject: [commit: packages/hoopl] master, pr/coverage: Update README with the style guide information (218c272) Message-ID: <20170417213726.A624C3A583@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hoopl On branches: master,pr/coverage Link : http://git.haskell.org/packages/hoopl.git/commitdiff/218c27269422501afa1db2c4b4941b37d85e08a0 >--------------------------------------------------------------- commit 218c27269422501afa1db2c4b4941b37d85e08a0 Author: Michal Terepeta Date: Sun Jan 24 15:44:32 2016 +0100 Update README with the style guide information As decided in #24 let's follow tibbe's style for all new or modified code. Hopefully, with time, we'll end up with code that's a bit more pleasant to read. >--------------------------------------------------------------- 218c27269422501afa1db2c4b4941b37d85e08a0 README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index e7b0cda..0004a3c 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,8 @@ Transformation"](http://research.microsoft.com/en-us/um/people/simonpj/Papers/c- ### Development Notes +#### Building and testing + To build the library run: cabal configure @@ -35,6 +37,12 @@ To run the tests with the test coverage report run: You'll need a Haskell Platform, which should include appropriate versions of Cabal and GHC. +#### Coding style + +Please follow Johan Tibell's +[Haskell Style Guide](https://github.com/tibbe/haskell-style-guide/blob/master/haskell-style.md) +for all new/modified code. + ### Checklist for Making Releases In order to facilitate GHC development's workflow, the version in [`hoopl.cabal`](hoopl.cabal) is to be bumped as soon as a change requires a respective version bump (according to the PVP) relative to the last released `hoopl` version. From git at git.haskell.org Mon Apr 17 21:37:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:26 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Clean up <*> development artifacts (f1e0f8e) Message-ID: <20170417213726.A5BFB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/f1e0f8e2b5df2be6852fb35ff2dd9559aaa4c830 >--------------------------------------------------------------- commit f1e0f8e2b5df2be6852fb35ff2dd9559aaa4c830 Author: David Feuer Date: Sat Dec 27 21:35:36 2014 -0500 Clean up <*> development artifacts Some silly remnants of my thought process remained in the code. Remove them. >--------------------------------------------------------------- f1e0f8e2b5df2be6852fb35ff2dd9559aaa4c830 Data/Sequence.hs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 0a64c3e..34504f5 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -338,15 +338,18 @@ aptyMiddle firstf (Deep s (squashL pr prm) mm (squashR sfm sf))) (fmap (fmap lastf) sfm) --- At the bottom +-- At the bottom. Note that these appendTree0 calls are very cheap, because in +-- each case, one of the arguments is guaranteed to be Empty or Single. aptyMiddle firstf lastf map23 fs (Deep s pr m sf) - = (fmap (fmap firstf) m `snocTree` fmap firstf (digitToNode sf)) - `appendTree0` middle `appendTree0` - (fmap lastf (digitToNode pr) `consTree` fmap (fmap lastf) m) + = fmap (fmap firstf) m `appendTree0` + ((fmap firstf (digitToNode sf) + `consTree` middle) + `snocTree` fmap lastf (digitToNode pr)) + `appendTree0` fmap (fmap lastf) m where middle = case trimTree $ mapMulFT s (\(Elem f) -> fmap (fmap (map23 f)) converted) fs of (firstMapped, restMapped, lastMapped) -> Deep (size firstMapped + size restMapped + size lastMapped) @@ -469,17 +472,16 @@ rigidify Single{} = error "rigidify: singleton" -- | /O(log n)/ (incremental) Rejigger a finger tree so the digits are all ones -- and twos. thin :: Sized a => FingerTree a -> FingerTree a --- Note that 'thin' may call itself at most once before passing the job on to --- 'thin12'. 'thin12' will produce a 'Deep' constructor immediately before --- calling 'thin'. +-- Note that 'thin12' will produce a 'Deep' constructor immediately before +-- recursively calling 'thin'. thin Empty = Empty thin (Single a) = Single a thin t@(Deep s pr m sf) = case pr of One{} -> thin12 t Two{} -> thin12 t - Three a b c -> thin $ Deep s (One a) (node2 b c `consTree` m) sf - Four a b c d -> thin $ Deep s (Two a b) (node2 c d `consTree` m) sf + Three a b c -> thin12 $ Deep s (One a) (node2 b c `consTree` m) sf + Four a b c d -> thin12 $ Deep s (Two a b) (node2 c d `consTree` m) sf thin12 :: Sized a => FingerTree a -> FingerTree a thin12 (Deep s pr m sf at One{}) = Deep s pr (thin m) sf From git at git.haskell.org Mon Apr 17 21:37:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:28 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Make `-Wall`-clean for base-4.8.0.0 (71f53cb) Message-ID: <20170417213728.B3F553A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/71f53cb8ea10cd2b50dbc0a7429e1f790fb62a0f >--------------------------------------------------------------- commit 71f53cb8ea10cd2b50dbc0a7429e1f790fb62a0f Author: Herbert Valerio Riedel Date: Sun Dec 28 09:36:44 2014 +0100 Make `-Wall`-clean for base-4.8.0.0 >--------------------------------------------------------------- 71f53cb8ea10cd2b50dbc0a7429e1f790fb62a0f Data/Graph.hs | 2 ++ Data/IntMap/Base.hs | 11 ++++++++--- Data/IntSet/Base.hs | 4 +++- Data/Map/Base.hs | 9 +++++++-- Data/Sequence.hs | 3 +++ Data/Set/Base.hs | 2 ++ Data/Tree.hs | 13 +++++++++---- 7 files changed, 34 insertions(+), 10 deletions(-) diff --git a/Data/Graph.hs b/Data/Graph.hs index 5f2bc15..c02b3e3 100644 --- a/Data/Graph.hs +++ b/Data/Graph.hs @@ -75,7 +75,9 @@ import qualified Data.IntSet as Set import Data.Tree (Tree(Node), Forest) -- std interfaces +#if !MIN_VERSION_base(4,8,0) import Control.Applicative +#endif import Control.DeepSeq (NFData(rnf)) import Data.Maybe import Data.Array diff --git a/Data/IntMap/Base.hs b/Data/IntMap/Base.hs index d25cb9e..e15ed76 100644 --- a/Data/IntMap/Base.hs +++ b/Data/IntMap/Base.hs @@ -216,16 +216,21 @@ module Data.IntMap.Base ( , highestBitMask ) where +#if MIN_VERSION_base(4,8,0) +import Control.Applicative ((<$>)) +#else import Control.Applicative (Applicative(pure, (<*>)), (<$>)) +import Data.Monoid (Monoid(..)) +import Data.Traversable (Traversable(traverse)) +import Data.Word (Word) +#endif + import Control.DeepSeq (NFData(rnf)) import Control.Monad (liftM) import Data.Bits import qualified Data.Foldable as Foldable import Data.Maybe (fromMaybe) -import Data.Monoid (Monoid(..)) -import Data.Traversable (Traversable(traverse)) import Data.Typeable -import Data.Word (Word) import Prelude hiding (lookup, map, filter, foldr, foldl, null) import Data.IntSet.Base (Key) diff --git a/Data/IntSet/Base.hs b/Data/IntSet/Base.hs index 6ddd0fb..c89bd18 100644 --- a/Data/IntSet/Base.hs +++ b/Data/IntSet/Base.hs @@ -169,9 +169,11 @@ import Control.DeepSeq (NFData(rnf)) import Data.Bits import qualified Data.List as List import Data.Maybe (fromMaybe) +#if !MIN_VERSION_base(4,8,0) import Data.Monoid (Monoid(..)) -import Data.Typeable import Data.Word (Word) +#endif +import Data.Typeable import Prelude hiding (filter, foldr, foldl, null, map) import Data.Utils.BitUtil diff --git a/Data/Map/Base.hs b/Data/Map/Base.hs index 815e54b..965a258 100644 --- a/Data/Map/Base.hs +++ b/Data/Map/Base.hs @@ -270,12 +270,17 @@ module Data.Map.Base ( , filterLt ) where +#if MIN_VERSION_base(4,8,0) +import Control.Applicative ((<$>)) +#else import Control.Applicative (Applicative(..), (<$>)) +import Data.Monoid (Monoid(..)) +import Data.Traversable (Traversable(traverse)) +#endif + import Control.DeepSeq (NFData(rnf)) import Data.Bits (shiftL, shiftR) import qualified Data.Foldable as Foldable -import Data.Monoid (Monoid(..)) -import Data.Traversable (Traversable(traverse)) import Data.Typeable import Prelude hiding (lookup, map, filter, foldr, foldl, null) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 0a64c3e..6b11266 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -147,6 +147,9 @@ module Data.Sequence ( import Prelude hiding ( Functor(..), +#if MIN_VERSION_base(4,8,0) + Applicative, foldMap, Monoid, +#endif null, length, take, drop, splitAt, foldl, foldl1, foldr, foldr1, scanl, scanl1, scanr, scanr1, replicate, zip, zipWith, zip3, zipWith3, takeWhile, dropWhile, iterate, reverse, filter, mapM, sum, all) diff --git a/Data/Set/Base.hs b/Data/Set/Base.hs index 0dbc569..e1ebad3 100644 --- a/Data/Set/Base.hs +++ b/Data/Set/Base.hs @@ -192,7 +192,9 @@ module Data.Set.Base ( import Prelude hiding (filter,foldl,foldr,null,map) import qualified Data.List as List import Data.Bits (shiftL, shiftR) +#if !MIN_VERSION_base(4,8,0) import Data.Monoid (Monoid(..)) +#endif import qualified Data.Foldable as Foldable import Data.Typeable import Control.DeepSeq (NFData(rnf)) diff --git a/Data/Tree.hs b/Data/Tree.hs index 4ee935b..abc9902 100644 --- a/Data/Tree.hs +++ b/Data/Tree.hs @@ -34,13 +34,19 @@ module Data.Tree( unfoldTreeM_BF, unfoldForestM_BF, ) where +#if MIN_VERSION_base(4,8,0) +import Control.Applicative ((<$>)) +import Data.Foldable (toList) +#else import Control.Applicative (Applicative(..), (<$>)) -import Control.Monad (liftM) +import Data.Foldable (Foldable(foldMap), toList) import Data.Monoid (Monoid(..)) +import Data.Traversable (Traversable(traverse)) +#endif + +import Control.Monad (liftM) import Data.Sequence (Seq, empty, singleton, (<|), (|>), fromList, ViewL(..), ViewR(..), viewl, viewr) -import Data.Foldable (Foldable(foldMap), toList) -import Data.Traversable (Traversable(traverse)) import Data.Typeable import Control.DeepSeq (NFData(rnf)) @@ -52,7 +58,6 @@ import Data.Data (Data) import Data.Coerce #endif - -- | Multi-way trees, also known as /rose trees/. data Tree a = Node { rootLabel :: a, -- ^ label value From git at git.haskell.org Mon Apr 17 21:37:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:30 +0000 (UTC) Subject: [commit: packages/hoopl] master, pr/coverage: Merge pull request #31 from bgamari/master (674934e) Message-ID: <20170417213730.B349E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hoopl On branches: master,pr/coverage Link : http://git.haskell.org/packages/hoopl.git/commitdiff/674934e12d52d3a7afd80c1d85a31727e5a9b3b1 >--------------------------------------------------------------- commit 674934e12d52d3a7afd80c1d85a31727e5a9b3b1 Merge: 218c272 dccbc3a Author: Ning Wang Date: Mon Apr 4 04:37:36 2016 -0700 Merge pull request #31 from bgamari/master Add Functor, Foldable, Traversable instances for maps >--------------------------------------------------------------- 674934e12d52d3a7afd80c1d85a31727e5a9b3b1 src/Compiler/Hoopl/Label.hs | 8 +++++++- src/Compiler/Hoopl/Unique.hs | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) From git at git.haskell.org Mon Apr 17 21:37:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:30 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Merge pull request #119 from hvr/pr-base48 (a4df7f3) Message-ID: <20170417213730.BED553A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/a4df7f35d859634f321c05f574e268a1c47792be >--------------------------------------------------------------- commit a4df7f35d859634f321c05f574e268a1c47792be Merge: 55f65cd 71f53cb Author: Milan Straka Date: Tue Dec 30 14:42:22 2014 +0100 Merge pull request #119 from hvr/pr-base48 Make `-Wall`-clean for base-4.8.0.0 >--------------------------------------------------------------- a4df7f35d859634f321c05f574e268a1c47792be Data/Graph.hs | 2 ++ Data/IntMap/Base.hs | 11 ++++++++--- Data/IntSet/Base.hs | 4 +++- Data/Map/Base.hs | 9 +++++++-- Data/Sequence.hs | 3 +++ Data/Set/Base.hs | 2 ++ Data/Tree.hs | 13 +++++++++---- 7 files changed, 34 insertions(+), 10 deletions(-) From git at git.haskell.org Mon Apr 17 21:37:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:32 +0000 (UTC) Subject: [commit: packages/hoopl] master, pr/coverage: Remove crufty testcoverage flag for --enable-coverage. (4478ec0) Message-ID: <20170417213732.B9B0C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hoopl On branches: master,pr/coverage Link : http://git.haskell.org/packages/hoopl.git/commitdiff/4478ec0b6d38bcd26c66ad09eb512e6952ab7e19 >--------------------------------------------------------------- commit 4478ec0b6d38bcd26c66ad09eb512e6952ab7e19 Author: Edward Z. Yang Date: Thu Jul 28 12:00:18 2016 -0700 Remove crufty testcoverage flag for --enable-coverage. Signed-off-by: Edward Z. Yang >--------------------------------------------------------------- 4478ec0b6d38bcd26c66ad09eb512e6952ab7e19 README.md | 2 +- hoopl.cabal | 8 -------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/README.md b/README.md index 0004a3c..a8eb3c0 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ To run the tests in the `testing/` folder run: To run the tests with the test coverage report run: - cabal configure --enable-tests -f testcoverage + cabal configure --enable-tests --enable-coverage cabal test You'll need a Haskell Platform, which should include appropriate diff --git a/hoopl.cabal b/hoopl.cabal index 19a725f..fc117a0 100644 --- a/hoopl.cabal +++ b/hoopl.cabal @@ -24,11 +24,6 @@ Source-repository head Type: git Location: http://git.haskell.org/packages/hoopl.git -flag testcoverage - description: Enable test coverage report - default: False - - Library Default-Language: Haskell2010 Other-Extensions: CPP @@ -84,6 +79,3 @@ Test-Suite hoopl-test test-framework < 0.9, test-framework-hunit < 0.4, mtl >= 2.1.3.1 - - if flag(testcoverage) - Ghc-Options: -fhpc From git at git.haskell.org Mon Apr 17 21:37:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:32 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Merge pull request #116 from treeowl/balanceReplicate (e0cfb50) Message-ID: <20170417213732.C85963A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/e0cfb504ce356f75e59ca2b392dee3f93eae0e4b >--------------------------------------------------------------- commit e0cfb504ce356f75e59ca2b392dee3f93eae0e4b Merge: a4df7f3 1e962fc Author: Milan Straka Date: Tue Dec 30 14:49:36 2014 +0100 Merge pull request #116 from treeowl/balanceReplicate Make applicativeTree aim for safe digits >--------------------------------------------------------------- e0cfb504ce356f75e59ca2b392dee3f93eae0e4b Data/Sequence.hs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) From git at git.haskell.org Mon Apr 17 21:37:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:34 +0000 (UTC) Subject: [commit: packages/hoopl] master: Ignore GNUmakefile, which GHC build system produces. (67dff9a) Message-ID: <20170417213734.BF99F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hoopl On branch : master Link : http://git.haskell.org/packages/hoopl.git/commitdiff/67dff9a7db8e103d379068df0323bbc97452e769 >--------------------------------------------------------------- commit 67dff9a7db8e103d379068df0323bbc97452e769 Author: Edward Z. Yang Date: Sat Aug 6 13:55:20 2016 -0700 Ignore GNUmakefile, which GHC build system produces. Signed-off-by: Edward Z. Yang >--------------------------------------------------------------- 67dff9a7db8e103d379068df0323bbc97452e769 .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index eefe95e..87f98a3 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,9 @@ *.bak *~ +# GHC build system produces these +GNUmakefile + dist dist-install dist-boot From git at git.haskell.org Mon Apr 17 21:37:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:34 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Merge pull request #118 from treeowl/apcleanup (202e2f2) Message-ID: <20170417213734.D185A3A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/202e2f2a28d1d914d19e177bc4b6e64597cf62f2 >--------------------------------------------------------------- commit 202e2f2a28d1d914d19e177bc4b6e64597cf62f2 Merge: e0cfb50 f1e0f8e Author: Milan Straka Date: Tue Dec 30 14:55:09 2014 +0100 Merge pull request #118 from treeowl/apcleanup Clean up <*> development artifacts >--------------------------------------------------------------- 202e2f2a28d1d914d19e177bc4b6e64597cf62f2 Data/Sequence.hs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) From git at git.haskell.org Mon Apr 17 21:37:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:36 +0000 (UTC) Subject: [commit: packages/hoopl] master: Bump upper bound on base (d2f1175) Message-ID: <20170417213736.C5BEE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hoopl On branch : master Link : http://git.haskell.org/packages/hoopl.git/commitdiff/d2f117557ea08bb7cf062573d0e39f523bb1a4d0 >--------------------------------------------------------------- commit d2f117557ea08bb7cf062573d0e39f523bb1a4d0 Author: Ben Gamari Date: Tue Nov 15 14:26:51 2016 -0500 Bump upper bound on base >--------------------------------------------------------------- d2f117557ea08bb7cf062573d0e39f523bb1a4d0 hoopl.cabal | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hoopl.cabal b/hoopl.cabal index fc117a0..0beb1c5 100644 --- a/hoopl.cabal +++ b/hoopl.cabal @@ -40,7 +40,8 @@ Library Other-Extensions: Safe Trustworthy Hs-Source-Dirs: src - Build-Depends: base >= 4.3 && < 4.10, containers >= 0.4 && < 0.6 + Build-Depends: base >= 4.3 && < 4.11, + containers >= 0.4 && < 0.6 Exposed-Modules: Compiler.Hoopl, Compiler.Hoopl.Internals, Compiler.Hoopl.Wrappers, From git at git.haskell.org Mon Apr 17 21:37:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:38 +0000 (UTC) Subject: [commit: packages/hoopl] master: Fix dominator join function. (a833a36) Message-ID: <20170417213738.CC0643A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hoopl On branch : master Link : http://git.haskell.org/packages/hoopl.git/commitdiff/a833a369dd387d6fcadfa010b91ead6ea9c08932 >--------------------------------------------------------------- commit a833a369dd387d6fcadfa010b91ead6ea9c08932 Author: Ben Karel Date: Sun Dec 25 08:55:51 2016 -0500 Fix dominator join function. >--------------------------------------------------------------- a833a369dd387d6fcadfa010b91ead6ea9c08932 src/Compiler/Hoopl/Passes/Dominator.hs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/Compiler/Hoopl/Passes/Dominator.hs b/src/Compiler/Hoopl/Passes/Dominator.hs index 19fc833..1926cb1 100644 --- a/src/Compiler/Hoopl/Passes/Dominator.hs +++ b/src/Compiler/Hoopl/Passes/Dominator.hs @@ -13,6 +13,7 @@ module Compiler.Hoopl.Passes.Dominator where import Data.Maybe +import qualified Data.Set as Set import Compiler.Hoopl @@ -47,15 +48,8 @@ domLattice = addPoints "dominators" extend extend :: JoinFun DPath extend _ (OldFact (DPath l)) (NewFact (DPath l')) = (changeIf (l `lengthDiffers` j), DPath j) - where j = lcs l l' - lcs :: [Label] -> [Label] -> [Label] -- longest common suffix - lcs l l' | length l > length l' = lcs (drop (length l - length l') l) l' - | length l < length l' = lcs l' l - | otherwise = dropUnlike l l' l - dropUnlike [] [] maybe_like = maybe_like - dropUnlike (x:xs) (y:ys) maybe_like = - dropUnlike xs ys (if x == y then maybe_like else xs) - dropUnlike _ _ _ = error "this can't happen" + where j = filter (\elem -> Set.member elem common) l + common = Set.intersection (Set.fromList l) (Set.fromList l') lengthDiffers [] [] = False lengthDiffers (_:xs) (_:ys) = lengthDiffers xs ys From git at git.haskell.org Mon Apr 17 21:37:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:38 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Merge pull request #122 from treeowl/dangerdoc (d5f5582) Message-ID: <20170417213738.E6E633A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/d5f5582709630c2a40ef998ffd727b8f739534df >--------------------------------------------------------------- commit d5f5582709630c2a40ef998ffd727b8f739534df Merge: 202e2f2 74afe96 Author: Milan Straka Date: Sun Jan 4 22:16:07 2015 +0100 Merge pull request #122 from treeowl/dangerdoc Add warning about Seq size. >--------------------------------------------------------------- d5f5582709630c2a40ef998ffd727b8f739534df Data/Map.hs | 4 ++++ Data/Map/Lazy.hs | 4 ++++ Data/Map/Strict.hs | 4 ++++ Data/Sequence.hs | 14 +++++++++++--- Data/Set.hs | 4 ++++ Data/Set/Base.hs | 4 ++++ 6 files changed, 31 insertions(+), 3 deletions(-) From git at git.haskell.org Mon Apr 17 21:37:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:36 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Add warning about Seq size. (74afe96) Message-ID: <20170417213736.DD8C53A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/74afe969cc792ab30715f6ad7399bddb492a1b66 >--------------------------------------------------------------- commit 74afe969cc792ab30715f6ad7399bddb492a1b66 Author: David Feuer Date: Wed Dec 31 01:24:48 2014 -0500 Add warning about Seq size. >--------------------------------------------------------------- 74afe969cc792ab30715f6ad7399bddb492a1b66 Data/Map.hs | 4 ++++ Data/Map/Lazy.hs | 4 ++++ Data/Map/Strict.hs | 4 ++++ Data/Sequence.hs | 14 +++++++++++--- Data/Set.hs | 4 ++++ Data/Set/Base.hs | 4 ++++ 6 files changed, 31 insertions(+), 3 deletions(-) diff --git a/Data/Map.hs b/Data/Map.hs index 1281f2f..e4af46a 100644 --- a/Data/Map.hs +++ b/Data/Map.hs @@ -45,6 +45,10 @@ -- first argument are always preferred to the second, for example in -- 'union' or 'insert'. -- +-- /Warning/: The size of the map must not exceed @maxBound::Int at . Violation of +-- this condition is not detected and if the size limit is exceeded, its +-- behaviour is undefined. +-- -- Operation comments contain the operation time complexity in -- the Big-O notation (). ----------------------------------------------------------------------------- diff --git a/Data/Map/Lazy.hs b/Data/Map/Lazy.hs index 2705de5..17fa6fe 100644 --- a/Data/Map/Lazy.hs +++ b/Data/Map/Lazy.hs @@ -44,6 +44,10 @@ -- first argument are always preferred to the second, for example in -- 'union' or 'insert'. -- +-- /Warning/: The size of the map must not exceed @maxBound::Int at . Violation of +-- this condition is not detected and if the size limit is exceeded, its +-- behaviour is undefined. +-- -- Operation comments contain the operation time complexity in -- the Big-O notation (). ----------------------------------------------------------------------------- diff --git a/Data/Map/Strict.hs b/Data/Map/Strict.hs index 7309041..623b1df 100644 --- a/Data/Map/Strict.hs +++ b/Data/Map/Strict.hs @@ -44,6 +44,10 @@ -- first argument are always preferred to the second, for example in -- 'union' or 'insert'. -- +-- /Warning/: The size of the map must not exceed @maxBound::Int at . Violation of +-- this condition is not detected and if the size limit is exceeded, its +-- behaviour is undefined. +-- -- Operation comments contain the operation time complexity in -- the Big-O notation (). -- diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 11f1880..21c54d3 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -16,7 +16,8 @@ -- Module : Data.Sequence -- Copyright : (c) Ross Paterson 2005 -- (c) Louis Wasserman 2009 --- (c) David Feuer, Ross Paterson, and Milan Straka 2014 +-- (c) Bertram Felgenhauer, David Feuer, Ross Paterson, and +-- Milan Straka 2014 -- License : BSD-style -- Maintainer : libraries at haskell.org -- Stability : experimental @@ -29,7 +30,7 @@ -- -- An amortized running time is given for each operation, with /n/ referring -- to the length of the sequence and /i/ being the integral index used by --- some operations. These bounds hold even in a persistent (shared) setting. +-- some operations. These bounds hold even in a persistent (shared) setting. -- -- The implementation uses 2-3 finger trees annotated with sizes, -- as described in section 4.2 of @@ -40,9 +41,16 @@ -- -- -- /Note/: Many of these operations have the same names as similar --- operations on lists in the "Prelude". The ambiguity may be resolved +-- operations on lists in the "Prelude". The ambiguity may be resolved -- using either qualification or the @hiding@ clause. -- +-- /Warning/: The size of a 'Seq' must not exceed @maxBound::Int at . Violation +-- of this condition is not detected and if the size limit is exceeded, the +-- behaviour of the sequence is undefined. This is unlikely to occur in most +-- applications, but some care may be required when using '><', '<*>', '*>', or +-- '>>', particularly repeatedly and particularly in combination with +-- 'replicate' or 'fromFunction'. +-- ----------------------------------------------------------------------------- module Data.Sequence ( diff --git a/Data/Set.hs b/Data/Set.hs index 37366fe..fd8c8b9 100644 --- a/Data/Set.hs +++ b/Data/Set.hs @@ -38,6 +38,10 @@ -- 'union' or 'insert'. Of course, left-biasing can only be observed -- when equality is an equivalence relation instead of structural -- equality. +-- +-- /Warning/: The size of the set must not exceed @maxBound::Int at . Violation of +-- this condition is not detected and if the size limit is exceeded, its +-- behaviour is undefined. ----------------------------------------------------------------------------- module Data.Set ( diff --git a/Data/Set/Base.hs b/Data/Set/Base.hs index e1ebad3..616d0eb 100644 --- a/Data/Set/Base.hs +++ b/Data/Set/Base.hs @@ -45,6 +45,10 @@ -- 'union' or 'insert'. Of course, left-biasing can only be observed -- when equality is an equivalence relation instead of structural -- equality. +-- +-- /Warning/: The size of the set must not exceed @maxBound::Int at . Violation of +-- this condition is not detected and if the size limit is exceeded, its +-- behaviour is undefined. ----------------------------------------------------------------------------- -- [Note: Using INLINABLE] From git at git.haskell.org Mon Apr 17 21:37:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:42 +0000 (UTC) Subject: [commit: packages/hoopl] master: Fix deprecation warnings from containers (8ee2ae0) Message-ID: <20170417213742.D94803A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hoopl On branch : master Link : http://git.haskell.org/packages/hoopl.git/commitdiff/8ee2ae077a3ae1b75a882396a4a1822f53be4388 >--------------------------------------------------------------- commit 8ee2ae077a3ae1b75a882396a4a1822f53be4388 Author: Erik de Castro Lopo Date: Sat Jan 28 16:58:27 2017 +1100 Fix deprecation warnings from containers Also bumps the lower bound on containers to `>= 0.5` which should be fine since `0.5.0.0` ws released in 2012. >--------------------------------------------------------------- 8ee2ae077a3ae1b75a882396a4a1822f53be4388 hoopl.cabal | 4 ++-- src/Compiler/Hoopl/Unique.hs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hoopl.cabal b/hoopl.cabal index 0beb1c5..9bfda89 100644 --- a/hoopl.cabal +++ b/hoopl.cabal @@ -41,7 +41,7 @@ Library Hs-Source-Dirs: src Build-Depends: base >= 4.3 && < 4.11, - containers >= 0.4 && < 0.6 + containers >= 0.5 && < 0.6 Exposed-Modules: Compiler.Hoopl, Compiler.Hoopl.Internals, Compiler.Hoopl.Wrappers, @@ -73,7 +73,7 @@ Test-Suite hoopl-test Main-Is: Main.hs Hs-Source-Dirs: testing src Build-Depends: base >= 4.3 && < 4.10, - containers >= 0.4 && < 0.6, + containers >= 0.5 && < 0.6, filepath, mtl >= 2.1.3.1, parsec >= 3.1.7, diff --git a/src/Compiler/Hoopl/Unique.hs b/src/Compiler/Hoopl/Unique.hs index ca2ca7a..fd647ea 100644 --- a/src/Compiler/Hoopl/Unique.hs +++ b/src/Compiler/Hoopl/Unique.hs @@ -100,8 +100,8 @@ instance IsMap UniqueMap where mapMap f (UM m) = UM (M.map f m) mapMapWithKey f (UM m) = UM (M.mapWithKey (f . intToUnique) m) - mapFold k z (UM m) = M.fold k z m - mapFoldWithKey k z (UM m) = M.foldWithKey (k . intToUnique) z m + mapFold k z (UM m) = M.foldr k z m + mapFoldWithKey k z (UM m) = M.foldrWithKey (k . intToUnique) z m mapFilter f (UM m) = UM (M.filter f m) mapElems (UM m) = M.elems m From git at git.haskell.org Mon Apr 17 21:37:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:43 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Remove unnecessary (Sized *) constraints. (5f519e6) Message-ID: <20170417213743.042F53A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/5f519e641aa7099c0dc6b12d3df08920e8496d04 >--------------------------------------------------------------- commit 5f519e641aa7099c0dc6b12d3df08920e8496d04 Author: Milan Straka Date: Sat Jan 10 14:29:34 2015 +0100 Remove unnecessary (Sized *) constraints. >--------------------------------------------------------------- 5f519e641aa7099c0dc6b12d3df08920e8496d04 Data/Sequence.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index b62b16a..491dd6d 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -640,13 +640,13 @@ deep :: Sized a => Digit a -> FingerTree (Node a) -> Digit a -> Finge deep pr m sf = Deep (size pr + size m + size sf) pr m sf {-# INLINE pullL #-} -pullL :: Sized a => Int -> FingerTree (Node a) -> Digit a -> FingerTree a +pullL :: Int -> FingerTree (Node a) -> Digit a -> FingerTree a pullL s m sf = case viewLTree m of Nothing2 -> digitToTree' s sf Just2 pr m' -> Deep s (nodeToDigit pr) m' sf {-# INLINE pullR #-} -pullR :: Sized a => Int -> Digit a -> FingerTree (Node a) -> FingerTree a +pullR :: Int -> Digit a -> FingerTree (Node a) -> FingerTree a pullR s pr m = case viewRTree m of Nothing2 -> digitToTree' s pr Just2 m' sf -> Deep s pr m' (nodeToDigit sf) @@ -1840,7 +1840,7 @@ initsNode (Node3 s a b c) = Node3 s (One a) (Two a b) (Three a b c) {-# SPECIALIZE tailsTree :: (FingerTree (Node a) -> Node b) -> FingerTree (Node a) -> FingerTree (Node b) #-} -- | Given a function to apply to tails of a tree, applies that function -- to every tail of the specified tree. -tailsTree :: (Sized a, Sized b) => (FingerTree a -> b) -> FingerTree a -> FingerTree b +tailsTree :: Sized a => (FingerTree a -> b) -> FingerTree a -> FingerTree b tailsTree _ Empty = Empty tailsTree f (Single x) = Single (f (Single x)) tailsTree f (Deep n pr m sf) = @@ -1855,7 +1855,7 @@ tailsTree f (Deep n pr m sf) = {-# SPECIALIZE initsTree :: (FingerTree (Node a) -> Node b) -> FingerTree (Node a) -> FingerTree (Node b) #-} -- | Given a function to apply to inits of a tree, applies that function -- to every init of the specified tree. -initsTree :: (Sized a, Sized b) => (FingerTree a -> b) -> FingerTree a -> FingerTree b +initsTree :: Sized a => (FingerTree a -> b) -> FingerTree a -> FingerTree b initsTree _ Empty = Empty initsTree f (Single x) = Single (f (Single x)) initsTree f (Deep n pr m sf) = From git at git.haskell.org Mon Apr 17 21:37:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:44 +0000 (UTC) Subject: [commit: packages/hoopl] master: .travis.yml: Drop support for ghc 7.0.1 (f661f91) Message-ID: <20170417213744.E03983A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hoopl On branch : master Link : http://git.haskell.org/packages/hoopl.git/commitdiff/f661f91f44c9291f0a3fe5b5787d5065b24e13d5 >--------------------------------------------------------------- commit f661f91f44c9291f0a3fe5b5787d5065b24e13d5 Author: Erik de Castro Lopo Date: Sat Feb 4 21:14:24 2017 +1100 .travis.yml: Drop support for ghc 7.0.1 >--------------------------------------------------------------- f661f91f44c9291f0a3fe5b5787d5065b24e13d5 .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 67253fb..bdff2cd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,6 @@ language: c sudo: required env: - - CABALVER=1.16 GHCVER=7.0.1 - CABALVER=1.16 GHCVER=7.0.4 - CABALVER=1.16 GHCVER=7.2.2 - CABALVER=1.16 GHCVER=7.4.2 From git at git.haskell.org Mon Apr 17 21:37:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:40 +0000 (UTC) Subject: [commit: packages/hoopl] master: Apply Safe Haskell flag for newer GHCs only. (b4ed37c) Message-ID: <20170417213740.D28703A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hoopl On branch : master Link : http://git.haskell.org/packages/hoopl.git/commitdiff/b4ed37c2af594f3e4de393a146a5b9a8210395af >--------------------------------------------------------------- commit b4ed37c2af594f3e4de393a146a5b9a8210395af Author: brk Date: Mon Dec 26 09:16:52 2016 -0500 Apply Safe Haskell flag for newer GHCs only. Apparently with GHC 7.2.2 and Cabal 1.16, the Data.Set module is not marked as being Safe. >--------------------------------------------------------------- b4ed37c2af594f3e4de393a146a5b9a8210395af src/Compiler/Hoopl/Passes/Dominator.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Compiler/Hoopl/Passes/Dominator.hs b/src/Compiler/Hoopl/Passes/Dominator.hs index 1926cb1..7cd8b7e 100644 --- a/src/Compiler/Hoopl/Passes/Dominator.hs +++ b/src/Compiler/Hoopl/Passes/Dominator.hs @@ -1,6 +1,6 @@ {-# LANGUAGE CPP, GADTs #-} {-# OPTIONS_GHC -Wall -fno-warn-name-shadowing #-} -#if __GLASGOW_HASKELL__ >= 701 +#if __GLASGOW_HASKELL__ >= 723 {-# LANGUAGE Safe #-} #endif From git at git.haskell.org Mon Apr 17 21:37:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:45 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Update .travis.yml per hvr's advice (d1c257a) Message-ID: <20170417213745.0B9FD3A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/d1c257aa1385ebe6801a296e5b5decfb3b6e84f3 >--------------------------------------------------------------- commit d1c257aa1385ebe6801a296e5b5decfb3b6e84f3 Author: David Feuer Date: Wed Jan 14 22:47:19 2015 -0500 Update .travis.yml per hvr's advice We want it to be able to build with 7.10 and head. >--------------------------------------------------------------- d1c257aa1385ebe6801a296e5b5decfb3b6e84f3 .travis.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8af3116..9505f69 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,12 +7,13 @@ env: # no package for earlier cabal versions in the PPA - GHCVER=7.4.2 CABALVER=1.16 - GHCVER=7.6.3 CABALVER=1.16 - - GHCVER=7.8.2 CABALVER=1.18 - - GHCVER=head CABALVER=1.20 + - GHCVER=7.8.4 CABALVER=1.18 + - GHCVER=7.10.1 CABALVER=1.22 + - GHCVER=head CABALVER=head matrix: allow_failures: - - env: GHCVER=head CABALVER=1.20 + - env: GHCVER=head CABALVER=head # Note: the distinction between `before_install` and `install` is not # important. From git at git.haskell.org Mon Apr 17 21:37:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:40 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Add unnecessary call in fromArray to make (Ix i) constraint look needed. (6004065) Message-ID: <20170417213740.EF87F3A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/6004065c646a578fee51c8b6a35fb20514579507 >--------------------------------------------------------------- commit 6004065c646a578fee51c8b6a35fb20514579507 Author: Milan Straka Date: Sat Jan 10 14:25:35 2015 +0100 Add unnecessary call in fromArray to make (Ix i) constraint look needed. >--------------------------------------------------------------- 6004065c646a578fee51c8b6a35fb20514579507 Data/Sequence.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 21c54d3..b62b16a 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -186,6 +186,7 @@ import Data.Data -- Array stuff, with GHC.Arr on GHC import Data.Array (Ix, Array) +import qualified Data.Array #ifdef __GLASGOW_HASKELL__ import qualified GHC.Arr #endif @@ -1649,6 +1650,10 @@ fromFunction len f | len < 0 = error "Data.Sequence.fromFunction called with neg fromArray :: Ix i => Array i a -> Seq a #ifdef __GLASGOW_HASKELL__ fromArray a = fromFunction (GHC.Arr.numElements a) (GHC.Arr.unsafeAt a) + where + -- The following definition uses (Ix i) constraing, which is needed for the + -- other fromArray definition. + _ = Data.Array.rangeSize (Data.Array.bounds a) #else fromArray a = fromList2 (Data.Array.rangeSize (Data.Array.bounds a)) (Data.Array.elems a) #endif From git at git.haskell.org Mon Apr 17 21:37:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:46 +0000 (UTC) Subject: [commit: packages/hoopl] master: Use non-deprecated Map and Set folds (46d43d4) Message-ID: <20170417213746.E5D483A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hoopl On branch : master Link : http://git.haskell.org/packages/hoopl.git/commitdiff/46d43d439c30a237edd78b0bd7d86a31fe3efca9 >--------------------------------------------------------------- commit 46d43d439c30a237edd78b0bd7d86a31fe3efca9 Author: David Feuer Date: Tue Feb 7 02:42:53 2017 -0500 Use non-deprecated Map and Set folds `fold` and `foldWithKey` are now deprecated in `containers`. This package's use causes GHC validation to fail with `containers-0.5.10.1`. >--------------------------------------------------------------- 46d43d439c30a237edd78b0bd7d86a31fe3efca9 src/Compiler/Hoopl/Unique.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Compiler/Hoopl/Unique.hs b/src/Compiler/Hoopl/Unique.hs index fd647ea..e840e99 100644 --- a/src/Compiler/Hoopl/Unique.hs +++ b/src/Compiler/Hoopl/Unique.hs @@ -66,7 +66,7 @@ instance IsSet UniqueSet where setIntersection (US x) (US y) = US (S.intersection x y) setIsSubsetOf (US x) (US y) = S.isSubsetOf x y - setFold k z (US s) = S.fold k z s + setFold k z (US s) = S.foldr k z s setElems (US s) = S.elems s setFromList ks = US (S.fromList ks) From git at git.haskell.org Mon Apr 17 21:37:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:47 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Merge pull request #132 from treeowl/travis-update (25c3fee) Message-ID: <20170417213747.132563A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/25c3fee44aa39b17ac3e74382591260c5edce1fa >--------------------------------------------------------------- commit 25c3fee44aa39b17ac3e74382591260c5edce1fa Merge: 5f519e6 d1c257a Author: Milan Straka Date: Thu Jan 15 12:26:15 2015 +0100 Merge pull request #132 from treeowl/travis-update Update .travis.yml per hvr's advice >--------------------------------------------------------------- 25c3fee44aa39b17ac3e74382591260c5edce1fa .travis.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) From git at git.haskell.org Mon Apr 17 21:37:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:48 +0000 (UTC) Subject: [commit: packages/hoopl] master: Improve fix to handle irreducible CFGs. (ef24795) Message-ID: <20170417213748.EC57D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hoopl On branch : master Link : http://git.haskell.org/packages/hoopl.git/commitdiff/ef24795cdc25415ffa79e8bcefe8ea1f5d6d151c >--------------------------------------------------------------- commit ef24795cdc25415ffa79e8bcefe8ea1f5d6d151c Author: Ben Karel Date: Sat Feb 11 16:57:12 2017 -0500 Improve fix to handle irreducible CFGs. >--------------------------------------------------------------- ef24795cdc25415ffa79e8bcefe8ea1f5d6d151c src/Compiler/Hoopl/Passes/Dominator.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Compiler/Hoopl/Passes/Dominator.hs b/src/Compiler/Hoopl/Passes/Dominator.hs index 7cd8b7e..2d87962 100644 --- a/src/Compiler/Hoopl/Passes/Dominator.hs +++ b/src/Compiler/Hoopl/Passes/Dominator.hs @@ -48,8 +48,10 @@ domLattice = addPoints "dominators" extend extend :: JoinFun DPath extend _ (OldFact (DPath l)) (NewFact (DPath l')) = (changeIf (l `lengthDiffers` j), DPath j) - where j = filter (\elem -> Set.member elem common) l + where lx = filter (\elem -> Set.member elem common) l + rx = filter (\elem -> Set.member elem common) l' common = Set.intersection (Set.fromList l) (Set.fromList l') + j = [x | (x, y) <- zip lx rx, x == y] lengthDiffers [] [] = False lengthDiffers (_:xs) (_:ys) = lengthDiffers xs ys From git at git.haskell.org Mon Apr 17 21:37:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:49 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Bump version number to 0.5.6.3 (fabde6b) Message-ID: <20170417213749.1A2CA3A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/fabde6b6381e459a49dee4ba1ac8b96848348542 >--------------------------------------------------------------- commit fabde6b6381e459a49dee4ba1ac8b96848348542 Author: Milan Straka Date: Thu Jan 15 12:41:01 2015 +0100 Bump version number to 0.5.6.3 >--------------------------------------------------------------- fabde6b6381e459a49dee4ba1ac8b96848348542 containers.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/containers.cabal b/containers.cabal index c5d7523..d7db653 100644 --- a/containers.cabal +++ b/containers.cabal @@ -1,5 +1,5 @@ name: containers -version: 0.5.6.2 +version: 0.5.6.3 license: BSD3 license-file: LICENSE maintainer: fox at ucw.cz From git at git.haskell.org Mon Apr 17 21:37:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:50 +0000 (UTC) Subject: [commit: packages/hoopl] master: Merge branch 'fixdom' of https://github.com/brk/hoopl into brk-fixdom (fa3eb05) Message-ID: <20170417213750.F298D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hoopl On branch : master Link : http://git.haskell.org/packages/hoopl.git/commitdiff/fa3eb055f558d28a951c0fbd26dccde766a731d3 >--------------------------------------------------------------- commit fa3eb055f558d28a951c0fbd26dccde766a731d3 Merge: 46d43d4 ef24795 Author: Ning Wang Date: Sat Feb 11 14:47:11 2017 -0800 Merge branch 'fixdom' of https://github.com/brk/hoopl into brk-fixdom >--------------------------------------------------------------- fa3eb055f558d28a951c0fbd26dccde766a731d3 src/Compiler/Hoopl/Passes/Dominator.hs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) From git at git.haskell.org Mon Apr 17 21:37:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:51 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Improve MIN_VERSION_base fall-back (3dddb04) Message-ID: <20170417213751.21B273A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/3dddb04bf514e37a87d7f8c5fd7ac58cda89d94f >--------------------------------------------------------------- commit 3dddb04bf514e37a87d7f8c5fd7ac58cda89d94f Author: David Feuer Date: Fri Jan 16 13:51:06 2015 -0500 Improve MIN_VERSION_base fall-back Guess the base library version based on `__GLASGOW_HASKELL__` when compiling without Cabal. >--------------------------------------------------------------- 3dddb04bf514e37a87d7f8c5fd7ac58cda89d94f include/containers.h | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/include/containers.h b/include/containers.h index ea895d1..b075799 100644 --- a/include/containers.h +++ b/include/containers.h @@ -51,11 +51,30 @@ /* * We use cabal-generated MIN_VERSION_base to adapt to changes of base. * Nevertheless, as a convenience, we also allow compiling without cabal by - * defining trivial MIN_VERSION_base if needed. + * defining an approximate MIN_VERSION_base if needed. The alternative version + * guesses the version of base using the version of GHC. This is usually + * sufficiently accurate. However, it completely ignores minor version numbers, + * and it makes the assumption that a pre-release version of GHC will ship with + * base libraries with the same version numbers as the final release. This + * assumption is violated in certain stages of GHC development, but in practice + * this should very rarely matter, and will not affect any released version. */ #ifndef MIN_VERSION_base -#define MIN_VERSION_base(major1,major2,minor) 0 +#if __GLASGOW_HASKELL__ >= 709 +#define MIN_VERSION_base(major1,major2,minor) (((major1)<4)||(((major1) == 4)&&((major2)<=8))) +#elif __GLASGOW_HASKELL__ >= 707 +#define MIN_VERSION_base(major1,major2,minor) (((major1)<4)||(((major1) == 4)&&((major2)<=7))) +#elif __GLASGOW_HASKELL__ >= 705 +#define MIN_VERSION_base(major1,major2,minor) (((major1)<4)||(((major1) == 4)&&((major2)<=6))) +#elif __GLASGOW_HASKELL__ >= 703 +#define MIN_VERSION_base(major1,major2,minor) (((major1)<4)||(((major1) == 4)&&((major2)<=5))) +#elif __GLASGOW_HASKELL__ >= 701 +#define MIN_VERSION_base(major1,major2,minor) (((major1)<4)||(((major1) == 4)&&((major2)<=4))) +#elif __GLASGOW_HASKELL__ >= 700 +#define MIN_VERSION_base(major1,major2,minor) (((major1)<4)||(((major1) == 4)&&((major2)<=3))) +#else +#define MIN_VERSION_base(major1,major2,minor) (0) #endif +#endif // MIN_VERSION_base was not defined - -#endif +#endif // This file was already included From git at git.haskell.org Mon Apr 17 21:37:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:53 +0000 (UTC) Subject: [commit: packages/hoopl] master: Update changelog for v3.10.2.2 release (1ece401) Message-ID: <20170417213753.056823A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hoopl On branch : master Link : http://git.haskell.org/packages/hoopl.git/commitdiff/1ece4019205daf47d23c881dc79039a683ae9837 >--------------------------------------------------------------- commit 1ece4019205daf47d23c881dc79039a683ae9837 Author: Ning Wang Date: Sat Feb 11 15:00:59 2017 -0800 Update changelog for v3.10.2.2 release >--------------------------------------------------------------- 1ece4019205daf47d23c881dc79039a683ae9837 changelog.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/changelog.md b/changelog.md index 8685e9b..c7ecc7b 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,19 @@ # Changelog for [`hoopl` package](http://hackage.haskell.org/package/hoopl) +## 3.10.2.2 *Feb 2017* + This release includes non-API changes. + + - Use cabal builtin options to enable test coverage + + - Move up the constraints of base and containers + + - Refactor the references of the fold family functions to their equivalant foldr functions. + + - Drop the support for 7.0.1 + + - Fix a bug that drops out dominators when joined DPATHs have non-shared nodes in the middle. + + ## 3.10.2.1 *Dec 2015* This release includes only non-functional changes. From git at git.haskell.org Mon Apr 17 21:37:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:53 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Merge pull request #133 from treeowl/minversionbase (414bd0e) Message-ID: <20170417213753.299B93A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/414bd0e566a7025d24678bee556f610b1f5637f5 >--------------------------------------------------------------- commit 414bd0e566a7025d24678bee556f610b1f5637f5 Merge: fabde6b 3dddb04 Author: Milan Straka Date: Mon Jan 19 09:49:31 2015 +0100 Merge pull request #133 from treeowl/minversionbase Improve MIN_VERSION_base fall-back >--------------------------------------------------------------- 414bd0e566a7025d24678bee556f610b1f5637f5 include/containers.h | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) From git at git.haskell.org Mon Apr 17 21:37:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:55 +0000 (UTC) Subject: [commit: packages/hoopl] master: dump up the version # in hoopl.cabal (ac24864) Message-ID: <20170417213755.0B2233A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hoopl On branch : master Link : http://git.haskell.org/packages/hoopl.git/commitdiff/ac24864c2db7951a6f34674e2b11b69d37ef84ff >--------------------------------------------------------------- commit ac24864c2db7951a6f34674e2b11b69d37ef84ff Author: Ning Wang Date: Sat Feb 11 15:05:07 2017 -0800 dump up the version # in hoopl.cabal >--------------------------------------------------------------- ac24864c2db7951a6f34674e2b11b69d37ef84ff hoopl.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hoopl.cabal b/hoopl.cabal index 9bfda89..4da4cb1 100644 --- a/hoopl.cabal +++ b/hoopl.cabal @@ -1,5 +1,5 @@ Name: hoopl -Version: 3.10.2.1 +Version: 3.10.2.2 -- NOTE: Don't forget to update ./changelog.md Description: Higher-order optimization library From git at git.haskell.org Mon Apr 17 21:37:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:55 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: typo in the doc for Data.Map.Base (72448b3) Message-ID: <20170417213755.327923A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/72448b3272fd758ea3613f984f192c6a99ec7982 >--------------------------------------------------------------- commit 72448b3272fd758ea3613f984f192c6a99ec7982 Author: G. Allais Date: Thu Feb 19 21:29:53 2015 +0000 typo in the doc for Data.Map.Base >--------------------------------------------------------------- 72448b3272fd758ea3613f984f192c6a99ec7982 Data/Map/Base.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Data/Map/Base.hs b/Data/Map/Base.hs index 965a258..fccd6e0 100644 --- a/Data/Map/Base.hs +++ b/Data/Map/Base.hs @@ -1689,7 +1689,7 @@ mapWithKey f (Bin sx kx x l r) = Bin sx kx (f kx x) (mapWithKey f l) (mapWithKey #endif -- | /O(n)/. --- @'traverseWithKey' f s == 'fromList' <$> 'traverse' (\(k, v) -> (,) k <$> f k v) ('toList' m)@ +-- @'traverseWithKey' f m == 'fromList' <$> 'traverse' (\(k, v) -> (,) k <$> f k v) ('toList' m)@ -- That is, behaves exactly like a regular 'traverse' except that the traversing -- function also has access to the key associated with a value. -- From git at git.haskell.org Mon Apr 17 21:37:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:57 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Merge pull request #139 from gallais/patch-1 (3fafcf9) Message-ID: <20170417213757.3BD483A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/3fafcf96417473492fc411924c5c79d15440e76b >--------------------------------------------------------------- commit 3fafcf96417473492fc411924c5c79d15440e76b Merge: 414bd0e 72448b3 Author: Milan Straka Date: Fri Feb 20 06:00:59 2015 +0100 Merge pull request #139 from gallais/patch-1 typo in the doc for Data.Map.Base >--------------------------------------------------------------- 3fafcf96417473492fc411924c5c79d15440e76b Data/Map/Base.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) From git at git.haskell.org Mon Apr 17 21:37:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:37:59 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Update the API changes/enhancements guide. (c0a076d) Message-ID: <20170417213759.43AE43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/c0a076d4b3d48481fc7dc7a4aed9b3c57260c327 >--------------------------------------------------------------- commit c0a076d4b3d48481fc7dc7a4aed9b3c57260c327 Author: Milan Straka Date: Fri Mar 6 23:15:51 2015 +0100 Update the API changes/enhancements guide. Fix link to Library submission guide and also explictly mention the discussion on libraries at haskell.org mailing list. >--------------------------------------------------------------- c0a076d4b3d48481fc7dc7a4aed9b3c57260c327 README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0eab2ca..de90d35 100644 --- a/README.md +++ b/README.md @@ -9,4 +9,4 @@ Contributing For reporting bugs (and maybe even the respective fix), please use the [GitHub issue tracker](https://github.com/haskell/containers/issues). -For proposing API changes/enhancements, please follow the [guidelines outlined on the Haskell Wiki](http://www.haskell.org/haskellwiki/Library_submissions#Guidance_for_proposers) (but use the GitHub facilities instead of GHC's Trac for submitting patches). +For proposing API changes/enhancements, please follow the [guidelines outlined on the Haskell Wiki](https://wiki.haskell.org/Library_submissions#Guide_to_proposers). Especially note that all API changes/enhancements should be discussed on libraries at haskell.org mailing list. From git at git.haskell.org Mon Apr 17 21:38:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:38:01 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Remove comments after #endif. (dade165) Message-ID: <20170417213801.4C7AB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/dade1658363660395c0f00b951cfcd71acee5b8c >--------------------------------------------------------------- commit dade1658363660395c0f00b951cfcd71acee5b8c Author: Milan Straka Date: Tue Mar 10 23:08:17 2015 +0100 Remove comments after #endif. They cause a lot of compilation warnings. >--------------------------------------------------------------- dade1658363660395c0f00b951cfcd71acee5b8c include/containers.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/containers.h b/include/containers.h index b075799..89f82d2 100644 --- a/include/containers.h +++ b/include/containers.h @@ -75,6 +75,6 @@ #else #define MIN_VERSION_base(major1,major2,minor) (0) #endif -#endif // MIN_VERSION_base was not defined +#endif -#endif // This file was already included +#endif From git at git.haskell.org Mon Apr 17 21:38:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:38:03 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Improve *> (c2b2048) Message-ID: <20170417213803.557873A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/c2b20485f22202dc7227ef00ae28d706c8df8d4d >--------------------------------------------------------------- commit c2b20485f22202dc7227ef00ae28d706c8df8d4d Author: David Feuer Date: Tue Mar 10 19:57:49 2015 -0400 Improve *> Use `applicativeTree` and techniques from `<*>` to make `*>` share as much as possible and offer immediate access with correct time bounds. >--------------------------------------------------------------- c2b20485f22202dc7227ef00ae28d706c8df8d4d Data/Sequence.hs | 89 +++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 75 insertions(+), 14 deletions(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 9de2228..91c62d8 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -271,13 +271,13 @@ instance Monad Seq where instance Applicative Seq where pure = singleton - xs *> ys = replicateSeq (length xs) ys + xs *> ys = cycleN (length xs) ys - fs <*> xs = case viewl fs of + fs <*> xs@(Seq xsFT) = case viewl fs of EmptyL -> empty firstf :< fs' -> case viewr fs' of EmptyR -> fmap firstf xs - Seq fs''FT :> lastf -> case (rigidify . (\(Seq a) -> a)) xs of + Seq fs''FT :> lastf -> case rigidify xsFT of RigidEmpty -> empty RigidOne (Elem x) -> fmap ($x) fs RigidTwo (Elem x1) (Elem x2) -> @@ -933,18 +933,79 @@ replicateM n x | n >= 0 = unwrapMonad (replicateA n (WrapMonad x)) | otherwise = error "replicateM takes a nonnegative integer argument" --- | @'replicateSeq' n xs@ concatenates @n@ copies of @xs at . -replicateSeq :: Int -> Seq a -> Seq a -replicateSeq n s - | n < 0 = error "replicateSeq takes a nonnegative integer argument" +-- | @'cycleN' n xs@ concatenates @n@ copies of @xs at . +cycleN :: Int -> Seq a -> Seq a +cycleN n xs + | n < 0 = error "cycleN takes a nonnegative integer argument" | n == 0 = empty - | otherwise = go n s - where - -- Invariant: k >= 1 - go 1 xs = xs - go k xs | even k = kxs - | otherwise = xs >< kxs - where kxs = go (k `quot` 2) $! (xs >< xs) + | n == 1 = xs +cycleN n (Seq xsFT) = case rigidify xsFT of + RigidEmpty -> empty + RigidOne (Elem x) -> replicate n x + RigidTwo x1 x2 -> Seq $ + Deep (n*2) pair + (runIdentity $ applicativeTree (n-2) 2 (Identity (node2 x1 x2))) + pair + where pair = Two x1 x2 + RigidThree x1 x2 x3 -> Seq $ + Deep (n*3) triple + (runIdentity $ applicativeTree (n-2) 3 (Identity (node3 x1 x2 x3))) + triple + where triple = Three x1 x2 x3 + RigidFull r@(Rigid s pr _m sf) -> Seq $ + Deep (n*s) + (nodeToDigit pr) + (cycleNMiddle (n-2) r) + (nodeToDigit sf) + +cycleNMiddle + :: Sized c => Int + -> Rigid c + -> FingerTree (Node c) + +STRICT_1_OF_2(cycleNMiddle) + +-- Not at the bottom yet + +cycleNMiddle n + (Rigid s pr (DeepTh sm prm mm sfm) sf) + = Deep (sm + s * (n + 1)) -- note: sm = s - size pr - size sf + (digit12ToDigit prm) + (cycleNMiddle n + (Rigid s (squashL pr prm) mm (squashR sfm sf))) + (digit12ToDigit sfm) + +-- At the bottom + +cycleNMiddle n + (Rigid s pr EmptyTh sf) + = deep + (One sf) + (runIdentity $ applicativeTree n s (Identity converted)) + (One pr) + where converted = node2 pr sf + +cycleNMiddle n + (Rigid s pr (SingleTh q) sf) + = deep + (Two q sf) + (runIdentity $ applicativeTree n s (Identity converted)) + (Two pr q) + where converted = node3 pr q sf + +{-# SPECIALIZE + cycleNMiddle + :: Int + -> Rigid (Node c) + -> FingerTree (Node (Node c)) + #-} +{-# SPECIALIZE + cycleNMiddle + :: Int + -> Rigid (Elem c) + -> FingerTree (Node (Elem c)) + #-} + -- | /O(1)/. Add an element to the left end of a sequence. -- Mnemonic: a triangle with the single element at the pointy end. From git at git.haskell.org Mon Apr 17 21:38:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:38:05 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Clean up <*> some more (3a177c7) Message-ID: <20170417213805.5FFDE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/3a177c7610201ed14f7de3142f3e1285c55c73bb >--------------------------------------------------------------- commit 3a177c7610201ed14f7de3142f3e1285c55c73bb Author: David Feuer Date: Tue Mar 10 11:30:10 2015 -0400 Clean up <*> some more 1. Remove all partial functions and all "impossible" errors. 2. Simplify the way the sequence pieces are put together at the bottom. The immediate-indexing `<*>` test improves from 1.44 microseconds to 1.24 microseconds. The other `<*>` tests improve very slightly. >--------------------------------------------------------------- 3a177c7610201ed14f7de3142f3e1285c55c73bb Data/Sequence.hs | 269 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 141 insertions(+), 128 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 3a177c7610201ed14f7de3142f3e1285c55c73bb From git at git.haskell.org Mon Apr 17 21:38:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:38:07 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Add header to bench-cmp.sh. (f6930e6) Message-ID: <20170417213807.675693A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/f6930e698853c46d2ed56ece4602fe88fc6e27bf >--------------------------------------------------------------- commit f6930e698853c46d2ed56ece4602fe88fc6e27bf Author: Milan Straka Date: Wed Mar 11 10:33:47 2015 +0100 Add header to bench-cmp.sh. Also remove the less command, it can be easily added manually. >--------------------------------------------------------------- f6930e698853c46d2ed56ece4602fe88fc6e27bf benchmarks/bench-cmp.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benchmarks/bench-cmp.sh b/benchmarks/bench-cmp.sh index 157b578..32f2b9c 100755 --- a/benchmarks/bench-cmp.sh +++ b/benchmarks/bench-cmp.sh @@ -1,3 +1,3 @@ #!/bin/sh -./bench-cmp.pl "$@" | column -nts\; | less -SR +(echo 'Benchmark;Runtime change;Original runtime'; ./bench-cmp.pl "$@") | column -nts\; From git at git.haskell.org Mon Apr 17 21:38:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:38:09 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Make rigidify non-recursive (2562a65) Message-ID: <20170417213809.7262E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/2562a659d8ca66cf7c0e814fc0e7f354a8261a42 >--------------------------------------------------------------- commit 2562a659d8ca66cf7c0e814fc0e7f354a8261a42 Author: David Feuer Date: Tue Mar 10 22:42:28 2015 -0400 Make rigidify non-recursive `rigidify` would previously call itself at most once before producing a constructor. This made it somewhat hard to see that it had no infinite loops, and increased the number of tests required. Improve internal documentation. Rename the small immediate indexing benchmark to make some kind of sense. Add more and better immediate indexing benchmarks. Benchmarks: <*>/ix500/1000^2 -13.81% 1.40e-06 <*>/ix500000/1000^2 -38.91% 5.14e-06 <*>/ixBIG -17.96% 1.61e-05 <*>/nf100/2500/rep +0.23% 8.58e-03 <*>/nf100/2500/ff -1.82% 2.37e-02 <*>/nf500/500/rep +0.01% 8.48e-03 <*>/nf500/500/ff -0.94% 2.46e-02 <*>/nf2500/100/rep -0.46% 8.53e-03 <*>/nf2500/100/ff -1.22% 2.45e-02 >--------------------------------------------------------------- 2562a659d8ca66cf7c0e814fc0e7f354a8261a42 Data/Sequence.hs | 108 +++++++++++++++++++++++++------------------------ benchmarks/Sequence.hs | 7 +++- 2 files changed, 61 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 2562a659d8ca66cf7c0e814fc0e7f354a8261a42 From git at git.haskell.org Mon Apr 17 21:38:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:38:11 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Remove Debian-specific -n column option. (98a4d50) Message-ID: <20170417213811.7A75E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/98a4d503442b8a309de8bb09936272ee08249898 >--------------------------------------------------------------- commit 98a4d503442b8a309de8bb09936272ee08249898 Author: Milan Straka Date: Wed Mar 11 15:41:22 2015 +0100 Remove Debian-specific -n column option. It is not needed anyway here. >--------------------------------------------------------------- 98a4d503442b8a309de8bb09936272ee08249898 benchmarks/bench-cmp.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benchmarks/bench-cmp.sh b/benchmarks/bench-cmp.sh index 32f2b9c..b72d0d0 100755 --- a/benchmarks/bench-cmp.sh +++ b/benchmarks/bench-cmp.sh @@ -1,3 +1,3 @@ #!/bin/sh -(echo 'Benchmark;Runtime change;Original runtime'; ./bench-cmp.pl "$@") | column -nts\; +(echo 'Benchmark;Runtime change;Original runtime'; ./bench-cmp.pl "$@") | column -ts\; From git at git.haskell.org Mon Apr 17 21:38:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:38:13 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Merge pull request #141 from treeowl/newapbottomtry (1d3156b) Message-ID: <20170417213813.823873A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/1d3156b65e2ca43cc1968ebde5bdd9880a1dfc30 >--------------------------------------------------------------- commit 1d3156b65e2ca43cc1968ebde5bdd9880a1dfc30 Merge: 98a4d50 2562a65 Author: Milan Straka Date: Wed Mar 11 15:50:08 2015 +0100 Merge pull request #141 from treeowl/newapbottomtry Clean up <*> some more >--------------------------------------------------------------- 1d3156b65e2ca43cc1968ebde5bdd9880a1dfc30 Data/Sequence.hs | 414 +++++++++++++++++++++++++++++-------------------- benchmarks/Sequence.hs | 7 +- 2 files changed, 251 insertions(+), 170 deletions(-) From git at git.haskell.org Mon Apr 17 21:38:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:38:15 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Minor typo fix in Data.Set.Base (6297b7b) Message-ID: <20170417213815.8AF523A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/6297b7bad0a78c34c7336c74c69b1a0f9d7f3691 >--------------------------------------------------------------- commit 6297b7bad0a78c34c7336c74c69b1a0f9d7f3691 Author: Louis Wasserman Date: Wed Mar 11 10:31:58 2015 -0700 Minor typo fix in Data.Set.Base >--------------------------------------------------------------- 6297b7bad0a78c34c7336c74c69b1a0f9d7f3691 Data/Set/Base.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Data/Set/Base.hs b/Data/Set/Base.hs index 616d0eb..02eb82c 100644 --- a/Data/Set/Base.hs +++ b/Data/Set/Base.hs @@ -853,7 +853,7 @@ foldlFB = foldl -- | /O(n*log n)/. Create a set from a list of elements. -- --- If the elemens are ordered, linear-time implementation is used, +-- If the elements are ordered, a linear-time implementation is used, -- with the performance equal to 'fromDistinctAscList'. -- For some reason, when 'singleton' is used in fromList or in From git at git.haskell.org Mon Apr 17 21:38:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:38:17 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Merge pull request #142 from lowasser/patch-1 (08ca8ab) Message-ID: <20170417213817.93F6B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/08ca8ab2aad9ea2995f1a54ff0cb1b8242f789a9 >--------------------------------------------------------------- commit 08ca8ab2aad9ea2995f1a54ff0cb1b8242f789a9 Merge: 1d3156b 6297b7b Author: Milan Straka Date: Wed Mar 11 22:23:39 2015 +0100 Merge pull request #142 from lowasser/patch-1 Minor typo fix in Data.Set.Base >--------------------------------------------------------------- 08ca8ab2aad9ea2995f1a54ff0cb1b8242f789a9 Data/Set/Base.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) From git at git.haskell.org Mon Apr 17 21:38:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:38:19 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Add IsString instance (7615e42) Message-ID: <20170417213819.9D5073A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/7615e4238cd7968d4abc27539974afe9b0b5024b >--------------------------------------------------------------- commit 7615e4238cd7968d4abc27539974afe9b0b5024b Author: David Feuer Date: Sun Mar 15 21:27:31 2015 -0400 Add IsString instance Add `instance IsString (Seq Char)` when compiling with GHC. >--------------------------------------------------------------- 7615e4238cd7968d4abc27539974afe9b0b5024b Data/Sequence.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index db333c3..c06931b 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -1,6 +1,8 @@ {-# LANGUAGE CPP #-} #if __GLASGOW_HASKELL__ -{-# LANGUAGE DeriveDataTypeable, StandaloneDeriving #-} +{-# LANGUAGE DeriveDataTypeable #-} +{-# LANGUAGE StandaloneDeriving #-} +{-# LANGUAGE FlexibleInstances #-} #endif #if __GLASGOW_HASKELL__ >= 703 {-# LANGUAGE Trustworthy #-} @@ -182,6 +184,7 @@ import GHC.Exts (build) import Text.Read (Lexeme(Ident), lexP, parens, prec, readPrec, readListPrec, readListPrecDefault) import Data.Data +import Data.String (IsString(..)) #endif -- Array stuff, with GHC.Arr on GHC @@ -2137,6 +2140,11 @@ instance GHC.Exts.IsList (Seq a) where toList = toList #endif +#ifdef __GLASGOW_HASKELL__ +instance IsString (Seq Char) where + fromString = fromList +#endif + ------------------------------------------------------------------------ -- Reverse ------------------------------------------------------------------------ From git at git.haskell.org Mon Apr 17 21:38:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:38:21 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Merge pull request #147 from treeowl/IsString (10f0a88) Message-ID: <20170417213821.A59F63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/10f0a88088f0cdf5ea660c3340424cce4d34cecd >--------------------------------------------------------------- commit 10f0a88088f0cdf5ea660c3340424cce4d34cecd Merge: 08ca8ab 7615e42 Author: Milan Straka Date: Mon Mar 16 16:02:26 2015 +0100 Merge pull request #147 from treeowl/IsString Add IsString instance >--------------------------------------------------------------- 10f0a88088f0cdf5ea660c3340424cce4d34cecd Data/Sequence.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) From git at git.haskell.org Mon Apr 17 21:38:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:38:23 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Removed unnecessary strictness in IntSet.foldl accumulator. (bdd7b33) Message-ID: <20170417213823.AF0343A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/bdd7b3378ebd218d935b62fdf980f76fd7d98a4b >--------------------------------------------------------------- commit bdd7b3378ebd218d935b62fdf980f76fd7d98a4b Author: Anton Dubovik Date: Fri May 15 00:45:50 2015 +0300 Removed unnecessary strictness in IntSet.foldl accumulator. >--------------------------------------------------------------- bdd7b3378ebd218d935b62fdf980f76fd7d98a4b Data/IntSet/Base.hs | 1 - containers.cabal | 18 ++++++++++++++++++ tests/intset-strictness.hs | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 1 deletion(-) diff --git a/Data/IntSet/Base.hs b/Data/IntSet/Base.hs index c89bd18..3dc473c 100644 --- a/Data/IntSet/Base.hs +++ b/Data/IntSet/Base.hs @@ -882,7 +882,6 @@ foldl f z = \t -> -- Use lambda t to be inlinable with two arguments only. | otherwise -> go (go z l) r _ -> go z t where - STRICT_1_OF_2(go) go z' Nil = z' go z' (Tip kx bm) = foldlBits kx f z' bm go z' (Bin _ _ l r) = go (go z' l) r diff --git a/containers.cabal b/containers.cabal index d7db653..6f4baaf 100644 --- a/containers.cabal +++ b/containers.cabal @@ -252,3 +252,21 @@ test-suite intmap-strictness-properties ghc-options: -Wall include-dirs: include + +test-suite intset-strictness-properties + hs-source-dirs: tests, . + main-is: intset-strictness.hs + type: exitcode-stdio-1.0 + + build-depends: + array, + base >= 4.2 && < 5, + ChasingBottoms, + deepseq >= 1.2 && < 1.5, + QuickCheck >= 2.4.0.1, + ghc-prim, + test-framework >= 0.3.3, + test-framework-quickcheck2 >= 0.2.9 + + ghc-options: -Wall + include-dirs: include diff --git a/tests/intset-strictness.hs b/tests/intset-strictness.hs new file mode 100644 index 0000000..b7c4097 --- /dev/null +++ b/tests/intset-strictness.hs @@ -0,0 +1,46 @@ +{-# LANGUAGE FlexibleInstances, GeneralizedNewtypeDeriving #-} +{-# OPTIONS_GHC -fno-warn-orphans #-} + +module Main (main) where + +import Prelude hiding (foldl) + +import Test.ChasingBottoms.IsBottom +import Test.Framework (Test, defaultMain, testGroup) +import Test.Framework.Providers.QuickCheck2 (testProperty) + +import Data.IntSet + +------------------------------------------------------------------------ +-- * Properties + +------------------------------------------------------------------------ +-- ** Lazy module + +pFoldlAccLazy :: Int -> Bool +pFoldlAccLazy k = + isn'tBottom $ foldl (\_ x -> x) (bottom :: Int) (singleton k) + +------------------------------------------------------------------------ +-- * Test list + +tests :: [Test] +tests = + [ + -- Basic interface + testGroup "IntSet" + [ testProperty "foldl is lazy in accumulator" pFoldlAccLazy + ] + ] + +------------------------------------------------------------------------ +-- * Test harness + +main :: IO () +main = defaultMain tests + +------------------------------------------------------------------------ +-- * Utilities + +isn'tBottom :: a -> Bool +isn'tBottom = not . isBottom From git at git.haskell.org Mon Apr 17 21:38:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:38:25 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Merge pull request #156 from adubovik/master (77e94c8) Message-ID: <20170417213825.B8F743A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/77e94c8966c24b65b2736bf84e3a2f7072e1c1b4 >--------------------------------------------------------------- commit 77e94c8966c24b65b2736bf84e3a2f7072e1c1b4 Merge: 10f0a88 bdd7b33 Author: Milan Straka Date: Tue May 19 23:28:27 2015 +0200 Merge pull request #156 from adubovik/master Removed unnecessary strictness in IntSet.foldl accumulator. >--------------------------------------------------------------- 77e94c8966c24b65b2736bf84e3a2f7072e1c1b4 Data/IntSet/Base.hs | 1 - containers.cabal | 18 ++++++++++++++++++ tests/intset-strictness.hs | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 1 deletion(-) From git at git.haskell.org Mon Apr 17 21:38:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:38:27 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Fix copy-paste typos. (32df5aa) Message-ID: <20170417213827.C21B13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/32df5aa4bc89111d2baf912df742df7324889920 >--------------------------------------------------------------- commit 32df5aa4bc89111d2baf912df742df7324889920 Author: Milan Straka Date: Tue May 19 23:32:51 2015 +0200 Fix copy-paste typos. >--------------------------------------------------------------- 32df5aa4bc89111d2baf912df742df7324889920 Data/Map/Base.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Data/Map/Base.hs b/Data/Map/Base.hs index fccd6e0..41c3611 100644 --- a/Data/Map/Base.hs +++ b/Data/Map/Base.hs @@ -80,7 +80,7 @@ -- [Note: Local 'go' functions and capturing] -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- As opposed to IntMap, when 'go' function captures an argument, increased +-- As opposed to Map, when 'go' function captures an argument, increased -- heap-allocation can occur: sometimes in a polymorphic function, the 'go' -- floats out of its enclosing function and then it heap-allocates the -- dictionary and the argument. Maybe it floats out too late and strictness @@ -1413,7 +1413,7 @@ intersectionWithKey f t1 t2 = mergeWithKey (\k x1 x2 -> Just $ f k x1 x2) (const -- > myIntersectionWithKey f m1 m2 = mergeWithKey (\k x1 x2 -> Just (f k x1 x2)) (const empty) (const empty) m1 m2 -- -- When calling @'mergeWithKey' combine only1 only2@, a function combining two --- 'IntMap's is created, such that +-- 'Map's is created, such that -- -- * if a key is present in both maps, it is passed with both corresponding -- values to the @combine@ function. Depending on the result, the key is either From git at git.haskell.org Mon Apr 17 21:38:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:38:29 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Fix wrong complexity of IntMap.alter. (4634081) Message-ID: <20170417213829.CA21D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/4634081498663590925938663c0223d5e02eb8ff >--------------------------------------------------------------- commit 4634081498663590925938663c0223d5e02eb8ff Author: Milan Straka Date: Wed Aug 26 14:11:49 2015 +0200 Fix wrong complexity of IntMap.alter. This resolves #165. >--------------------------------------------------------------- 4634081498663590925938663c0223d5e02eb8ff Data/IntMap/Strict.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Data/IntMap/Strict.hs b/Data/IntMap/Strict.hs index 48ce1be..5165de0 100644 --- a/Data/IntMap/Strict.hs +++ b/Data/IntMap/Strict.hs @@ -505,7 +505,7 @@ updateLookupWithKey f0 k0 t0 = k0 `seq` toPair $ go f0 k0 t0 --- | /O(log n)/. The expression (@'alter' f k map@) alters the value @x@ at @k@, or absence thereof. +-- | /O(min(n,W))/. The expression (@'alter' f k map@) alters the value @x@ at @k@, or absence thereof. -- 'alter' can be used to insert, delete, or update a value in an 'IntMap'. -- In short : @'lookup' k ('alter' f k m) = f ('lookup' k m)@. alter :: (Maybe a -> Maybe a) -> Key -> IntMap a -> IntMap a From git at git.haskell.org Mon Apr 17 21:38:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:38:31 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: canonicalise Monad instances (318bca7) Message-ID: <20170417213831.D38A33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/318bca71efa8eecf0e67c1da97eb2fca73da182e >--------------------------------------------------------------- commit 318bca71efa8eecf0e67c1da97eb2fca73da182e Author: Herbert Valerio Riedel Date: Wed Nov 25 08:25:42 2015 +0100 canonicalise Monad instances >--------------------------------------------------------------- 318bca71efa8eecf0e67c1da97eb2fca73da182e Data/Graph.hs | 2 +- Data/Sequence.hs | 7 ++++--- Data/Tree.hs | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Data/Graph.hs b/Data/Graph.hs index c02b3e3..71d82c8 100644 --- a/Data/Graph.hs +++ b/Data/Graph.hs @@ -295,7 +295,7 @@ chop (Node v ts : us) newtype SetM s a = SetM { runSetM :: STArray s Vertex Bool -> ST s a } instance Monad (SetM s) where - return x = SetM $ const (return x) + return = pure {-# INLINE return #-} SetM v >>= f = SetM $ \s -> do { x <- v s; runSetM (f x) s } {-# INLINE (>>=) #-} diff --git a/Data/Sequence.hs b/Data/Sequence.hs index c06931b..8fc2baf 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -267,7 +267,7 @@ instance NFData a => NFData (Seq a) where rnf (Seq xs) = rnf xs instance Monad Seq where - return = singleton + return = pure xs >>= f = foldl' add empty xs where add ys x = ys >< f x (>>) = (*>) @@ -861,12 +861,13 @@ instance Functor (State s) where instance Monad (State s) where {-# INLINE return #-} {-# INLINE (>>=) #-} - return x = State $ \ s -> (s, x) + return = pure m >>= k = State $ \ s -> case runState m s of (s', x) -> runState (k x) s' instance Applicative (State s) where - pure = return + {-# INLINE pure #-} + pure x = State $ \ s -> (s, x) (<*>) = ap execState :: State s a -> s -> a diff --git a/Data/Tree.hs b/Data/Tree.hs index abc9902..c1b9d34 100644 --- a/Data/Tree.hs +++ b/Data/Tree.hs @@ -92,7 +92,7 @@ instance Applicative Tree where Node (f x) (map (f <$>) txs ++ map (<*> tx) tfs) instance Monad Tree where - return x = Node x [] + return = pure Node x ts >>= f = Node x' (ts' ++ map (>>= f) ts) where Node x' ts' = f x From git at git.haskell.org Mon Apr 17 21:38:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:38:33 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Make `-Wall` clean (5f232df) Message-ID: <20170417213833.DF7C23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/5f232df9781bc66dfd6e8aecc59c63e937df660d >--------------------------------------------------------------- commit 5f232df9781bc66dfd6e8aecc59c63e937df660d Author: Herbert Valerio Riedel Date: Wed Nov 25 08:37:20 2015 +0100 Make `-Wall` clean Get rid of left-over redundant-import warnings from the last minute AMP-changes that occured in GHC 7.10 >--------------------------------------------------------------- 5f232df9781bc66dfd6e8aecc59c63e937df660d Data/IntMap/Base.hs | 4 +--- Data/Map/Base.hs | 4 +--- Data/Sequence.hs | 2 +- Data/Tree.hs | 1 - 4 files changed, 3 insertions(+), 8 deletions(-) diff --git a/Data/IntMap/Base.hs b/Data/IntMap/Base.hs index e15ed76..0a840f5 100644 --- a/Data/IntMap/Base.hs +++ b/Data/IntMap/Base.hs @@ -216,9 +216,7 @@ module Data.IntMap.Base ( , highestBitMask ) where -#if MIN_VERSION_base(4,8,0) -import Control.Applicative ((<$>)) -#else +#if !(MIN_VERSION_base(4,8,0)) import Control.Applicative (Applicative(pure, (<*>)), (<$>)) import Data.Monoid (Monoid(..)) import Data.Traversable (Traversable(traverse)) diff --git a/Data/Map/Base.hs b/Data/Map/Base.hs index 41c3611..569b602 100644 --- a/Data/Map/Base.hs +++ b/Data/Map/Base.hs @@ -270,9 +270,7 @@ module Data.Map.Base ( , filterLt ) where -#if MIN_VERSION_base(4,8,0) -import Control.Applicative ((<$>)) -#else +#if !(MIN_VERSION_base(4,8,0)) import Control.Applicative (Applicative(..), (<$>)) import Data.Monoid (Monoid(..)) import Data.Traversable (Traversable(traverse)) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 8fc2baf..bb86c95 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -158,7 +158,7 @@ module Data.Sequence ( import Prelude hiding ( Functor(..), #if MIN_VERSION_base(4,8,0) - Applicative, foldMap, Monoid, + Applicative, (<$>), foldMap, Monoid, #endif null, length, take, drop, splitAt, foldl, foldl1, foldr, foldr1, scanl, scanl1, scanr, scanr1, replicate, zip, zipWith, zip3, zipWith3, diff --git a/Data/Tree.hs b/Data/Tree.hs index c1b9d34..a6f64f9 100644 --- a/Data/Tree.hs +++ b/Data/Tree.hs @@ -35,7 +35,6 @@ module Data.Tree( ) where #if MIN_VERSION_base(4,8,0) -import Control.Applicative ((<$>)) import Data.Foldable (toList) #else import Control.Applicative (Applicative(..), (<$>)) From git at git.haskell.org Mon Apr 17 21:38:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:38:35 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Remove redundant constraints (e024991) Message-ID: <20170417213835.E87DE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/e02499103d1c4e95f5f57c7e6571f8e3040712ca >--------------------------------------------------------------- commit e02499103d1c4e95f5f57c7e6571f8e3040712ca Author: Herbert Valerio Riedel Date: Wed Nov 25 08:45:50 2015 +0100 Remove redundant constraints GHC HEAD warns about those: ``` Data/Sequence.hs:432:12: warning: • Redundant constraint: Sized a • In the type signature for: squashL :: Sized a => Digit23 a -> Digit12 (Node a) -> Digit23 (Node a) Data/Sequence.hs:437:12: warning: • Redundant constraint: Sized a • In the type signature for: squashR :: Sized a => Digit12 (Node a) -> Digit23 a -> Digit23 (Node a) ``` >--------------------------------------------------------------- e02499103d1c4e95f5f57c7e6571f8e3040712ca Data/Sequence.hs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index bb86c95..6b42841 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -357,8 +357,7 @@ type Digit23 a = Node a -- class, but as it is we have to build up 'map23' explicitly through the -- recursion. aptyMiddle - :: Sized c => - (c -> d) + :: (c -> d) -> (c -> d) -> ((a -> b) -> c -> d) -> FingerTree (Elem (a -> b)) @@ -429,12 +428,12 @@ digit12ToDigit (One12 a) = One a digit12ToDigit (Two12 a b) = Two a b -- Squash the first argument down onto the left side of the second. -squashL :: Sized a => Digit23 a -> Digit12 (Node a) -> Digit23 (Node a) +squashL :: Digit23 a -> Digit12 (Node a) -> Digit23 (Node a) squashL m (One12 n) = node2 m n squashL m (Two12 n1 n2) = node3 m n1 n2 -- Squash the second argument down onto the right side of the first -squashR :: Sized a => Digit12 (Node a) -> Digit23 a -> Digit23 (Node a) +squashR :: Digit12 (Node a) -> Digit23 a -> Digit23 (Node a) squashR (One12 n) m = node2 n m squashR (Two12 n1 n2) m = node3 n1 n2 m @@ -965,7 +964,7 @@ cycleN n (Seq xsFT) = case rigidify xsFT of (nodeToDigit sf) cycleNMiddle - :: Sized c => Int + :: Int -> Rigid c -> FingerTree (Node c) From git at git.haskell.org Mon Apr 17 21:38:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:38:37 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Drop seemingly ineffective SPECIALISE pragmas (2e3802f) Message-ID: <20170417213837.F1A563A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/2e3802f1aa8eb8c5769b6f00697048485cb9abb2 >--------------------------------------------------------------- commit 2e3802f1aa8eb8c5769b6f00697048485cb9abb2 Author: Herbert Valerio Riedel Date: Wed Nov 25 08:49:03 2015 +0100 Drop seemingly ineffective SPECIALISE pragmas GHC HEAD warns about these: ``` Data/Sequence.hs:407:1: warning: SPECIALISE pragma for non-overloaded function ‘aptyMiddle’ Data/Sequence.hs:416:1: warning: SPECIALISE pragma for non-overloaded function ‘aptyMiddle’ Data/Sequence.hs:1001:1: warning: SPECIALISE pragma for non-overloaded function ‘cycleNMiddle’ Data/Sequence.hs:1007:1: warning: SPECIALISE pragma for non-overloaded function ‘cycleNMiddle’ ``` >--------------------------------------------------------------- 2e3802f1aa8eb8c5769b6f00697048485cb9abb2 Data/Sequence.hs | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 6b42841..089b292 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -404,25 +404,6 @@ aptyMiddle firstf (Two (fmap lastf pr) (fmap lastf q)) where converted = node3 pr q sf -{-# SPECIALIZE - aptyMiddle - :: (Node c -> d) - -> (Node c -> d) - -> ((a -> b) -> Node c -> d) - -> FingerTree (Elem (a -> b)) - -> Rigid (Node c) - -> FingerTree (Node d) - #-} -{-# SPECIALIZE - aptyMiddle - :: (Elem c -> d) - -> (Elem c -> d) - -> ((a -> b) -> Elem c -> d) - -> FingerTree (Elem (a -> b)) - -> Rigid (Elem c) - -> FingerTree (Node d) - #-} - digit12ToDigit :: Digit12 a -> Digit a digit12ToDigit (One12 a) = One a digit12ToDigit (Two12 a b) = Two a b @@ -998,19 +979,6 @@ cycleNMiddle n (Two pr q) where converted = node3 pr q sf -{-# SPECIALIZE - cycleNMiddle - :: Int - -> Rigid (Node c) - -> FingerTree (Node (Node c)) - #-} -{-# SPECIALIZE - cycleNMiddle - :: Int - -> Rigid (Elem c) - -> FingerTree (Node (Elem c)) - #-} - -- | /O(1)/. Add an element to the left end of a sequence. -- Mnemonic: a triangle with the single element at the pointy end. From git at git.haskell.org Mon Apr 17 21:38:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:38:40 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Merge pull request #168 from hvr/pr/minor-cleanups (94d1638) Message-ID: <20170417213840.07CA13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/94d163808b0cc7facdd31de781b79839b1934546 >--------------------------------------------------------------- commit 94d163808b0cc7facdd31de781b79839b1934546 Merge: 4634081 5f232df Author: Milan Straka Date: Wed Nov 25 09:30:03 2015 +0100 Merge pull request #168 from hvr/pr/minor-cleanups Minor cleanups >--------------------------------------------------------------- 94d163808b0cc7facdd31de781b79839b1934546 Data/Graph.hs | 2 +- Data/IntMap/Base.hs | 4 +--- Data/Map/Base.hs | 4 +--- Data/Sequence.hs | 9 +++++---- Data/Tree.hs | 3 +-- 5 files changed, 9 insertions(+), 13 deletions(-) From git at git.haskell.org Mon Apr 17 21:38:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:38:42 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Merge pull request #169 from hvr/pr/ghc-head-wall-clean (ce65000) Message-ID: <20170417213842.109003A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/ce65000b92c71da6ae2bea664c13ba855bbe2d1d >--------------------------------------------------------------- commit ce65000b92c71da6ae2bea664c13ba855bbe2d1d Merge: 94d1638 2e3802f Author: Milan Straka Date: Wed Nov 25 09:31:26 2015 +0100 Merge pull request #169 from hvr/pr/ghc-head-wall-clean GHC HEAD -Wall cleanups >--------------------------------------------------------------- ce65000b92c71da6ae2bea664c13ba855bbe2d1d Data/Sequence.hs | 41 ++++------------------------------------- 1 file changed, 4 insertions(+), 37 deletions(-) From git at git.haskell.org Mon Apr 17 21:38:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:38:44 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Define Semigroup instances for base>=4.9 (e0cfcea) Message-ID: <20170417213844.1D3043A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/e0cfceaf3b8d410343151bdc57f527515ecc94b5 >--------------------------------------------------------------- commit e0cfceaf3b8d410343151bdc57f527515ecc94b5 Author: Herbert Valerio Riedel Date: Sat Nov 28 22:13:54 2015 +0100 Define Semigroup instances for base>=4.9 See https://github.com/ekmett/semigroups/issues/56 for more details >--------------------------------------------------------------- e0cfceaf3b8d410343151bdc57f527515ecc94b5 Data/IntMap/Base.hs | 13 ++++++++++++- Data/IntSet/Base.hs | 13 ++++++++++++- Data/Map/Base.hs | 13 ++++++++++++- Data/Sequence.hs | 10 ++++++++++ Data/Set/Base.hs | 14 +++++++++++++- 5 files changed, 59 insertions(+), 4 deletions(-) diff --git a/Data/IntMap/Base.hs b/Data/IntMap/Base.hs index 0a840f5..e22c46b 100644 --- a/Data/IntMap/Base.hs +++ b/Data/IntMap/Base.hs @@ -222,6 +222,9 @@ import Data.Monoid (Monoid(..)) import Data.Traversable (Traversable(traverse)) import Data.Word (Word) #endif +#if MIN_VERSION_base(4,9,0) +import Data.Semigroup (Semigroup((<>), stimes), stimesIdempotentMonoid) +#endif import Control.DeepSeq (NFData(rnf)) import Control.Monad (liftM) @@ -305,8 +308,16 @@ infixl 9 \\{-This comment teaches CPP correct behaviour -} instance Monoid (IntMap a) where mempty = empty - mappend = union mconcat = unions +#if !(MIN_VERSION_base(4,9,0)) + mappend = union +#else + mappend = (<>) + +instance Semigroup (IntMap a) where + (<>) = union + stimes = stimesIdempotentMonoid +#endif instance Foldable.Foldable IntMap where fold = go diff --git a/Data/IntSet/Base.hs b/Data/IntSet/Base.hs index 3dc473c..3df44cb 100644 --- a/Data/IntSet/Base.hs +++ b/Data/IntSet/Base.hs @@ -173,6 +173,9 @@ import Data.Maybe (fromMaybe) import Data.Monoid (Monoid(..)) import Data.Word (Word) #endif +#if MIN_VERSION_base(4,9,0) +import Data.Semigroup (Semigroup((<>), stimes), stimesIdempotentMonoid) +#endif import Data.Typeable import Prelude hiding (filter, foldr, foldl, null, map) @@ -247,8 +250,16 @@ type Key = Int instance Monoid IntSet where mempty = empty - mappend = union mconcat = unions +#if !(MIN_VERSION_base(4,9,0)) + mappend = union +#else + mappend = (<>) + +instance Semigroup IntSet where + (<>) = union + stimes = stimesIdempotentMonoid +#endif #if __GLASGOW_HASKELL__ diff --git a/Data/Map/Base.hs b/Data/Map/Base.hs index 569b602..5d80efe 100644 --- a/Data/Map/Base.hs +++ b/Data/Map/Base.hs @@ -275,6 +275,9 @@ import Control.Applicative (Applicative(..), (<$>)) import Data.Monoid (Monoid(..)) import Data.Traversable (Traversable(traverse)) #endif +#if MIN_VERSION_base(4,9,0) +import Data.Semigroup (Semigroup((<>), stimes), stimesIdempotentMonoid) +#endif import Control.DeepSeq (NFData(rnf)) import Data.Bits (shiftL, shiftR) @@ -340,8 +343,16 @@ type role Map nominal representational instance (Ord k) => Monoid (Map k v) where mempty = empty - mappend = union mconcat = unions +#if !(MIN_VERSION_base(4,9,0)) + mappend = union +#else + mappend = (<>) + +instance (Ord k) => Semigroup (Map k v) where + (<>) = union + stimes = stimesIdempotentMonoid +#endif #if __GLASGOW_HASKELL__ diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 089b292..447688d 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -175,6 +175,9 @@ import Data.Foldable (Foldable(foldl, foldl1, foldr, foldr1, foldMap), foldl', t #if MIN_VERSION_base(4,8,0) import Data.Foldable (foldr') #endif +#if MIN_VERSION_base(4,9,0) +import Data.Semigroup (Semigroup((<>))) +#endif import Data.Traversable import Data.Typeable @@ -543,7 +546,14 @@ instance Read a => Read (Seq a) where instance Monoid (Seq a) where mempty = empty +#if !(MIN_VERSION_base(4,9,0)) mappend = (><) +#else + mappend = (<>) + +instance Semigroup (Seq a) where + (<>) = (><) +#endif INSTANCE_TYPEABLE1(Seq,seqTc,"Seq") diff --git a/Data/Set/Base.hs b/Data/Set/Base.hs index 02eb82c..01c343a 100644 --- a/Data/Set/Base.hs +++ b/Data/Set/Base.hs @@ -199,6 +199,9 @@ import Data.Bits (shiftL, shiftR) #if !MIN_VERSION_base(4,8,0) import Data.Monoid (Monoid(..)) #endif +#if MIN_VERSION_base(4,9,0) +import Data.Semigroup (Semigroup((<>), stimes), stimesIdempotentMonoid) +#endif import qualified Data.Foldable as Foldable import Data.Typeable import Control.DeepSeq (NFData(rnf)) @@ -245,8 +248,17 @@ type role Set nominal instance Ord a => Monoid (Set a) where mempty = empty - mappend = union mconcat = unions +#if !(MIN_VERSION_base(4,9,0)) + mappend = union +#else + mappend = (<>) + +instance Ord a => Semigroup (Set a) where + (<>) = union + stimes = stimesIdempotentMonoid +#endif + instance Foldable.Foldable Set where fold = go From git at git.haskell.org Mon Apr 17 21:38:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:38:46 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Rename local binding to avoid clash with `(<>)` (f9e530a) Message-ID: <20170417213846.266EC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/f9e530ab014bbb78411d7f7660dcd4e78502dea4 >--------------------------------------------------------------- commit f9e530ab014bbb78411d7f7660dcd4e78502dea4 Author: Herbert Valerio Riedel Date: Sat Nov 28 22:14:16 2015 +0100 Rename local binding to avoid clash with `(<>)` >--------------------------------------------------------------- f9e530ab014bbb78411d7f7660dcd4e78502dea4 Data/Sequence.hs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 447688d..c3a1e1d 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -2459,28 +2459,28 @@ unrollPQ cmp = unrollPQ' where {-# INLINE unrollPQ' #-} unrollPQ' (PQueue x ts) = x:mergePQs0 ts - (<>) = mergePQ cmp + (<+>) = mergePQ cmp mergePQs0 Nil = [] mergePQs0 (t :& Nil) = unrollPQ' t - mergePQs0 (t1 :& t2 :& ts) = mergePQs (t1 <> t2) ts + mergePQs0 (t1 :& t2 :& ts) = mergePQs (t1 <+> t2) ts mergePQs t ts = t `seq` case ts of Nil -> unrollPQ' t - t1 :& Nil -> unrollPQ' (t <> t1) - t1 :& t2 :& ts' -> mergePQs (t <> (t1 <> t2)) ts' + t1 :& Nil -> unrollPQ' (t <+> t1) + t1 :& t2 :& ts' -> mergePQs (t <+> (t1 <+> t2)) ts' -- | 'toPQ', given an ordering function and a mechanism for queueifying -- elements, converts a 'FingerTree' to a 'PQueue'. toPQ :: (e -> e -> Ordering) -> (a -> PQueue e) -> FingerTree a -> Maybe (PQueue e) toPQ _ _ Empty = Nothing toPQ _ f (Single x) = Just (f x) -toPQ cmp f (Deep _ pr m sf) = Just (maybe (pr' <> sf') ((pr' <> sf') <>) (toPQ cmp fNode m)) +toPQ cmp f (Deep _ pr m sf) = Just (maybe (pr' <+> sf') ((pr' <+> sf') <+>) (toPQ cmp fNode m)) where fDigit digit = case fmap f digit of One a -> a - Two a b -> a <> b - Three a b c -> a <> b <> c - Four a b c d -> (a <> b) <> (c <> d) - (<>) = mergePQ cmp + Two a b -> a <+> b + Three a b c -> a <+> b <+> c + Four a b c d -> (a <+> b) <+> (c <+> d) + (<+>) = mergePQ cmp fNode = fDigit . nodeToDigit pr' = fDigit pr sf' = fDigit sf From git at git.haskell.org Mon Apr 17 21:38:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:38:48 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Merge pull request #171 from hvr/pr/semigroups (6405653) Message-ID: <20170417213848.317CE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/6405653480afa675eec804616547b8625244bc7c >--------------------------------------------------------------- commit 6405653480afa675eec804616547b8625244bc7c Merge: ce65000 f9e530a Author: Milan Straka Date: Sun Nov 29 13:24:03 2015 +0100 Merge pull request #171 from hvr/pr/semigroups Semigroup instances >--------------------------------------------------------------- 6405653480afa675eec804616547b8625244bc7c Data/IntMap/Base.hs | 13 ++++++++++++- Data/IntSet/Base.hs | 13 ++++++++++++- Data/Map/Base.hs | 13 ++++++++++++- Data/Sequence.hs | 28 +++++++++++++++++++--------- Data/Set/Base.hs | 14 +++++++++++++- 5 files changed, 68 insertions(+), 13 deletions(-) From git at git.haskell.org Mon Apr 17 21:38:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:38:50 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Bump version to v0.5.7.0. (d86ba69) Message-ID: <20170417213850.3985A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/d86ba69819e716d9ee021cf3b34ba7244f2e1649 >--------------------------------------------------------------- commit d86ba69819e716d9ee021cf3b34ba7244f2e1649 Author: Milan Straka Date: Thu Dec 17 20:35:04 2015 +0100 Bump version to v0.5.7.0. >--------------------------------------------------------------- d86ba69819e716d9ee021cf3b34ba7244f2e1649 containers.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/containers.cabal b/containers.cabal index 6f4baaf..281ced4 100644 --- a/containers.cabal +++ b/containers.cabal @@ -1,5 +1,5 @@ name: containers -version: 0.5.6.3 +version: 0.5.7.0 license: BSD3 license-file: LICENSE maintainer: fox at ucw.cz From git at git.haskell.org Mon Apr 17 21:38:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:38:52 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Add changelog. (32addff) Message-ID: <20170417213852.426123A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/32addff0b2a65fbcca98deb69f6661cd41374515 >--------------------------------------------------------------- commit 32addff0b2a65fbcca98deb69f6661cd41374515 Author: Milan Straka Date: Sun Dec 20 11:14:01 2015 +0100 Add changelog. >--------------------------------------------------------------- 32addff0b2a65fbcca98deb69f6661cd41374515 changelog.md | 154 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 154 insertions(+) diff --git a/changelog.md b/changelog.md new file mode 100644 index 0000000..d8c6d2b --- /dev/null +++ b/changelog.md @@ -0,0 +1,154 @@ +# Changelog for [`containers` package](http://github.com/haskell/containers) + +## 0.5.7.1 *Dec 2015* + + * Planned to bundle with GHC 8.0.1. + + * Add `IsString` instance to `Data.Sequence`. + + * Define `Semigroup` instances for ``Data.Map`, `Data.Set`, `Data.IntMap`, + `Data.IntSet` and `Data.Sequence`. + +## 0.5.6.2 *Dec 2014* + + * Bundled with GHC 7.10.1. + + * Add role annotations for `Data.Map` and `Data.Set`. + + * Add `IsList` instances for `Data.Map`, `Data.Set`, `Data.IntMap` and + `Data.IntSet`. + + * Several performance improvements for `Data.Sequence`. + + * Add `Data.Sequence.fromFunction` and `Data.Sequence.fromArray`. + +## 0.5.4.0 *Jan 2014* + + * Bundled with GHC 7.8.1. + + * The `Data.Map.fromList` and `Data.Set.fromList` now use linear-time + algorithm if the input is sorted, without need to call `fromDistinctAscList`. + + * Implement indexing operations (`lookupIndex`, `findIndex`, `elemAt`, + `deletaAt`) for `Data.Set` too. + + * Add `Applicative` and `Alternative` instances for `Data.Sequence`. + + * Add `foldMapWithKey` to `Data.Map` and `Data.IntMap`. + + * Implement poly-kinded `Typeable`. + + * Add `Functor` instance for `Data.Graph.SCC`. + + * Add `Data.Map.splitRoot` and `Data.Set.splitRoot`. + +## 0.5.0.0 *May 2012* + + * Bundled with GHC 7.6.1. + + * Major improvements since last release: + * a clearer distinction between value-lazy and value-strict containers, + * performance improvements across the board, + * a big internal clean-up, and + * new functions for e.g. merging, updating, and searching containers. + + * While the old `Data.Map` and + `Data.IntMap` modules will continue to exist for the foreseeable future, we've + abandoned the practice of having the strict and lazy versions of each + function distinguished by an apostrophe. The distinction is instead made at + the module level, by introducing four new modules: + * Data.Map.Strict + * Data.Map.Lazy + * Data.IntMap.Strict + * Data.IntMap.Lazy + + This split has three benefits: + * It makes the choice between value-strict and value-lazy containers + more declarative; you pick once at import time, instead of having to + remember to use the strict or lazy versions of a function every time + you modify the container. + * It alleviates a common source of performance issues, by forcing the + user to think about the strictness properties upfront. For example, + using insertWith instead of insertWith' is a common source of + containers-related performance bugs. + * There are fewer functions per module, making it easier to get an + overview of each module. + + * Note that the types used in the strict and lazy APIs are the same, so + you can still use the same container in a "mixed" manner, if needed. + + * The `Data.IntSet` representation changed to store small sets using + bits in an `Word`. Larger sets are stored as a collection of such + dense small sets, connected together by a prefix trie. + +## 0.4.2.1 *Feb 2012* + + * Bundled with GHC 7.4.1. + + * `Data.Map now exports `foldr`, `foldr'`, `foldl` and `foldl'`. + + * `Data.Set now exports `foldr`, `foldr'`, `foldl` and `foldl'`. + + * `Data.IntMap now exports `foldr`, `foldr'`, `foldl`, `foldl'`, `foldrWithKey`, `foldrWithKey'`, `foldlWithKey` and `foldlWithKey'`. + + * `Data.IntSet now exports `foldr`, `foldr'`, `foldl` and `foldl'`. + + * `Data.Map.foldWithKey` is no longer deprecated, although it is expected to be deprecated again in the future. + + * There are now `NFData` instance for `Data.Map.Map`, `Data.Set.Set`, `Data.IntMap.IntMap`, `Data.IntSet.IntSet` and `Data.Tree.Tree`. + +## 0.4.1.0 *Aug 2011* + + * Bundled with GHC 7.2.1. + + * `Data.Map` now exports new functions `foldrWithKey'` and `foldlWithKey'`, which are strict variants of `foldrWithKey` and `foldlWithKey` respectively. + + * `Data.IntMap` now exports new functions `insertWith'` and `insertWithKey'`, which are strict variants of `insertWith` and `insertWithKey` respectively. + +## 0.4.0.0 *Nov 2010* + + * Bundled with GHC 7.0.1. + + * Strictness is now more consistent, with containers being strict in their elements even in singleton cases. + + * There is a new function `insertLookupWithKey'` in `Data.Map`. + + * The `foldWithKey` function in `Data.Map` has been deprecated in favour of `foldrWithKey`. + +## 0.3.0.0 *Dec 2009* + + * Bundled with GHC 6.12.1. + + * `mapAccumRWithKey` has been added to `Data.IntMap`. + + * A `Traversable` instance has been added to `Data.IntMap.IntMap`. + + * The types of `Data.IntMap.intersectionWith` and `Data.IntMap.intersectionWithKey` have been changed from + `intersectionWith :: (a -> b -> a) -> IntMap a -> IntMap b -> IntMap a` + `intersectionWithKey :: (Key -> a -> b -> a) -> IntMap a -> IntMap b -> IntMap a` + to + `intersectionWith :: (a -> b -> c) -> IntMap a -> IntMap b -> IntMap c` + `intersectionWithKey :: (Key -> a -> b -> c) -> IntMap a -> IntMap b -> IntMap c` + + * The types of `Data.IntMap.findMin` and `Data.IntMap.findMax` have been changed from + `findMin :: IntMap a -> a` + `findMax :: IntMap a -> a` + to + `findMin :: IntMap a -> (Int,a)` + `findMax :: IntMap a -> (Int,a)` + + * `Data.Map` now exports `mapAccumRWithKey`, `foldrWithKey`, `foldlWithKey` and `toDescList`. + + * `Data.Sequence` now exports `replicate`, `replicateA`, `replicateM`, `iterateN`, `unfoldr`, `unfoldl`, `scanl`, `scanl1`, `scanr`, `scanr1`, `tails`, `inits`, `takeWhileL`, `takeWhileR`, `dropWhileL`, `dropWhileR`, `spanl`, `spanr`, `breakl`, `breakr`, `partition`, `filter`, `sort`, `sortBy`, `unstableSort`, `unstableSortBy`, `elemIndexL`, `elemIndicesL`, `elemIndexR`, `elemIndicesR`, `findIndexL`, `findIndicesL`, `findIndexR`, `findIndicesR`, `foldlWithIndex`, `foldrWithIndex`, `mapWithIndex`, `zip`, `zipWith`, `zip3`, `zipWith3`, `zip4` and `zipWith4`. + +## 0.2.0.0 *Nov 2008* + + * Bundled with GHC 6.10.1. + + * Various result type now use `Maybe` rather than allowing any `Monad`. + +## 0.1.0.0 *Nov 2007* + + * Bundled with GHC 6.8.1. + + * Initial split off from GHC base. From git at git.haskell.org Mon Apr 17 21:38:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:38:54 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Bump to version v0.5.7.1. (d08e47b) Message-ID: <20170417213854.4A5643A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/d08e47bf6895da8c8b5a7dd62496a2f4fe73631e >--------------------------------------------------------------- commit d08e47bf6895da8c8b5a7dd62496a2f4fe73631e Author: Milan Straka Date: Sun Dec 20 16:54:41 2015 +0100 Bump to version v0.5.7.1. >--------------------------------------------------------------- d08e47bf6895da8c8b5a7dd62496a2f4fe73631e containers.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/containers.cabal b/containers.cabal index 281ced4..0f60736 100644 --- a/containers.cabal +++ b/containers.cabal @@ -1,5 +1,5 @@ name: containers -version: 0.5.7.0 +version: 0.5.7.1 license: BSD3 license-file: LICENSE maintainer: fox at ucw.cz From git at git.haskell.org Mon Apr 17 21:38:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:38:56 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Add changelog.md to extra-source-files. (91fff04) Message-ID: <20170417213856.53E553A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/91fff043dd82ca1039c19f0d31b344e63c911f0b >--------------------------------------------------------------- commit 91fff043dd82ca1039c19f0d31b344e63c911f0b Author: Milan Straka Date: Sun Dec 20 17:14:30 2015 +0100 Add changelog.md to extra-source-files. >--------------------------------------------------------------- 91fff043dd82ca1039c19f0d31b344e63c911f0b containers.cabal | 1 + 1 file changed, 1 insertion(+) diff --git a/containers.cabal b/containers.cabal index 0f60736..6e3ff8d 100644 --- a/containers.cabal +++ b/containers.cabal @@ -25,6 +25,7 @@ extra-source-files: benchmarks/SetOperations/*.hs benchmarks/LookupGE/Makefile benchmarks/LookupGE/*.hs + changelog.md source-repository head type: git From git at git.haskell.org Mon Apr 17 21:38:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:38:58 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Make reverse helpers polymorphic (32478c0) Message-ID: <20170417213858.5CE563A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/32478c093ae17ba5f9295012eb1580764d15ad8a >--------------------------------------------------------------- commit 32478c093ae17ba5f9295012eb1580764d15ad8a Author: David Feuer Date: Tue Jan 19 02:14:53 2016 -0500 Make reverse helpers polymorphic Lean a bit harder on the type system to ensure that the reversing function is called everywhere it's supposed to be. Yes, this should all be covered by the test suite anyway, but it can't hurt. >--------------------------------------------------------------- 32478c093ae17ba5f9295012eb1580764d15ad8a Data/Sequence.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index c3a1e1d..2915d90 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -2131,7 +2131,7 @@ instance IsString (Seq Char) where reverse :: Seq a -> Seq a reverse (Seq xs) = Seq (reverseTree id xs) -reverseTree :: (a -> a) -> FingerTree a -> FingerTree a +reverseTree :: (a -> b) -> FingerTree a -> FingerTree b reverseTree _ Empty = Empty reverseTree f (Single x) = Single (f x) reverseTree f (Deep s pr m sf) = @@ -2140,13 +2140,13 @@ reverseTree f (Deep s pr m sf) = (reverseDigit f pr) {-# INLINE reverseDigit #-} -reverseDigit :: (a -> a) -> Digit a -> Digit a +reverseDigit :: (a -> b) -> Digit a -> Digit b reverseDigit f (One a) = One (f a) reverseDigit f (Two a b) = Two (f b) (f a) reverseDigit f (Three a b c) = Three (f c) (f b) (f a) reverseDigit f (Four a b c d) = Four (f d) (f c) (f b) (f a) -reverseNode :: (a -> a) -> Node a -> Node a +reverseNode :: (a -> b) -> Node a -> Node b reverseNode f (Node2 s a b) = Node2 s (f b) (f a) reverseNode f (Node3 s a b c) = Node3 s (f c) (f b) (f a) From git at git.haskell.org Mon Apr 17 21:39:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:39:00 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Merge pull request #178 from treeowl/polyreverse (bf0bee9) Message-ID: <20170417213900.65A203A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/bf0bee97635fd9b0662b65a9cad2ae42bcbf6128 >--------------------------------------------------------------- commit bf0bee97635fd9b0662b65a9cad2ae42bcbf6128 Merge: 91fff04 32478c0 Author: Milan Straka Date: Tue Jan 19 09:05:34 2016 +0100 Merge pull request #178 from treeowl/polyreverse Make reverse helpers polymorphic >--------------------------------------------------------------- bf0bee97635fd9b0662b65a9cad2ae42bcbf6128 Data/Sequence.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) From git at git.haskell.org Mon Apr 17 21:39:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:39:02 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Add traverseWithIndex (29919f2) Message-ID: <20170417213902.71F2A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/29919f25522f7ef007efea31996e2cf143227463 >--------------------------------------------------------------- commit 29919f25522f7ef007efea31996e2cf143227463 Author: David Feuer Date: Tue Jan 19 16:30:37 2016 -0500 Add traverseWithIndex Hack Milan's `mapWithIndex` into `traverseWithIndex`. Add some RULES for it. Add tests. >--------------------------------------------------------------- 29919f25522f7ef007efea31996e2cf143227463 Data/Sequence.hs | 119 ++++++++++++++++++++++++++++++++++++++++++++++++ containers.cabal | 3 +- tests/seq-properties.hs | 9 +++- 3 files changed, 129 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 29919f25522f7ef007efea31996e2cf143227463 From git at git.haskell.org Mon Apr 17 21:39:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:39:04 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Merge pull request #179 from treeowl/traverseWithIndex (27b9277) Message-ID: <20170417213904.7ACCC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/27b9277f83fda3d333d3964d4810fe0ba71215ea >--------------------------------------------------------------- commit 27b9277f83fda3d333d3964d4810fe0ba71215ea Merge: bf0bee9 29919f2 Author: Milan Straka Date: Sat Jan 23 10:47:41 2016 +0100 Merge pull request #179 from treeowl/traverseWithIndex Add traverseWithIndex >--------------------------------------------------------------- 27b9277f83fda3d333d3964d4810fe0ba71215ea Data/Sequence.hs | 119 ++++++++++++++++++++++++++++++++++++++++++++++++ containers.cabal | 3 +- tests/seq-properties.hs | 9 +++- 3 files changed, 129 insertions(+), 2 deletions(-) From git at git.haskell.org Mon Apr 17 21:39:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:39:06 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: repair broken URL in IntMap documentation (625f94f) Message-ID: <20170417213906.8285B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/625f94f851633c620122350e902e9370aa1da3de >--------------------------------------------------------------- commit 625f94f851633c620122350e902e9370aa1da3de Author: Johannes Waldmann <@> Date: Wed Feb 10 16:38:49 2016 +0100 repair broken URL in IntMap documentation >--------------------------------------------------------------- 625f94f851633c620122350e902e9370aa1da3de Data/IntMap.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Data/IntMap.hs b/Data/IntMap.hs index 5a704da..7867e67 100644 --- a/Data/IntMap.hs +++ b/Data/IntMap.hs @@ -39,7 +39,7 @@ -- -- * Chris Okasaki and Andy Gill, \"/Fast Mergeable Integer Maps/\", -- Workshop on ML, September 1998, pages 77-86, --- +-- -- -- * D.R. Morrison, \"/PATRICIA -- Practical Algorithm To Retrieve -- Information Coded In Alphanumeric/\", Journal of the ACM, 15(4), From git at git.haskell.org Mon Apr 17 21:39:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:39:08 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Merge pull request #181 from jwaldmann/master (8f206a5) Message-ID: <20170417213908.89CB83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/8f206a5837e5724cb37cb9e941d61d7e416c8dc7 >--------------------------------------------------------------- commit 8f206a5837e5724cb37cb9e941d61d7e416c8dc7 Merge: 27b9277 625f94f Author: Milan Straka Date: Wed Feb 10 21:30:22 2016 +0100 Merge pull request #181 from jwaldmann/master repair broken URL in IntMap documentation >--------------------------------------------------------------- 8f206a5837e5724cb37cb9e941d61d7e416c8dc7 Data/IntMap.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) From git at git.haskell.org Mon Apr 17 21:39:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:39:10 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: fix typo in documentation (497e6a4) Message-ID: <20170417213910.94D1E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/497e6a405b45da548e94bf184ef5a85523c6f4b8 >--------------------------------------------------------------- commit 497e6a405b45da548e94bf184ef5a85523c6f4b8 Author: Johannes Waldmann <@> Date: Wed Feb 10 23:46:56 2016 +0100 fix typo in documentation >--------------------------------------------------------------- 497e6a405b45da548e94bf184ef5a85523c6f4b8 Data/Map/Strict.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Data/Map/Strict.hs b/Data/Map/Strict.hs index 623b1df..1b8816f 100644 --- a/Data/Map/Strict.hs +++ b/Data/Map/Strict.hs @@ -819,7 +819,7 @@ intersectionWithKey f t1 t2 = mergeWithKey (\k x1 x2 -> Just $ f k x1 x2) (const -- > myIntersectionWithKey f m1 m2 = mergeWithKey (\k x1 x2 -> Just (f k x1 x2)) (const empty) (const empty) m1 m2 -- -- When calling @'mergeWithKey' combine only1 only2@, a function combining two --- 'IntMap's is created, such that +-- 'Map's is created, such that -- -- * if a key is present in both maps, it is passed with both corresponding -- values to the @combine@ function. Depending on the result, the key is either From git at git.haskell.org Mon Apr 17 21:39:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:39:12 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Merge pull request #182 from jwaldmann/master (b263e4a) Message-ID: <20170417213912.9BE123A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/b263e4a26746d1e27c69d732e5c9abe44ca7b96c >--------------------------------------------------------------- commit b263e4a26746d1e27c69d732e5c9abe44ca7b96c Merge: 8f206a5 497e6a4 Author: Milan Straka Date: Thu Feb 11 06:54:02 2016 +0100 Merge pull request #182 from jwaldmann/master fix typo in documentation >--------------------------------------------------------------- b263e4a26746d1e27c69d732e5c9abe44ca7b96c Data/Map/Strict.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) From git at git.haskell.org Mon Apr 17 21:39:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:39:14 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Fix compilation. (5dbf09a) Message-ID: <20170417213914.A4F6C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/5dbf09a19f938e9821391aec682691d3b4ce24ad >--------------------------------------------------------------- commit 5dbf09a19f938e9821391aec682691d3b4ce24ad Author: Milan Straka Date: Thu Feb 11 08:12:46 2016 +0100 Fix compilation. >--------------------------------------------------------------- 5dbf09a19f938e9821391aec682691d3b4ce24ad benchmarks/Makefile | 2 +- benchmarks/SetOperations/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/benchmarks/Makefile b/benchmarks/Makefile index aacccef..f6a8909 100644 --- a/benchmarks/Makefile +++ b/benchmarks/Makefile @@ -1,7 +1,7 @@ all: bench-%: %.hs force - ghc -O2 -DTESTING $< -I../include -i../$(TOP) -o $@ -outputdir tmp -rtsopts + ghc -O2 -DTESTING $< -I$(TOP)../include -i$(TOP).. -o $@ -outputdir tmp -rtsopts .PRECIOUS: bench-% diff --git a/benchmarks/SetOperations/Makefile b/benchmarks/SetOperations/Makefile index 019967b..e662979 100644 --- a/benchmarks/SetOperations/Makefile +++ b/benchmarks/SetOperations/Makefile @@ -1,3 +1,3 @@ -TOP = .. +TOP = ../ include ../Makefile From git at git.haskell.org Mon Apr 17 21:39:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:39:16 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Make sure arguments are in correct order. (e9ec4c2) Message-ID: <20170417213916.AD9633A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/e9ec4c273fd36ac517078f4495fa6b0ae8ef4015 >--------------------------------------------------------------- commit e9ec4c273fd36ac517078f4495fa6b0ae8ef4015 Author: Milan Straka Date: Thu Feb 11 08:13:08 2016 +0100 Make sure arguments are in correct order. >--------------------------------------------------------------- e9ec4c273fd36ac517078f4495fa6b0ae8ef4015 benchmarks/SetOperations/SetOperations.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/benchmarks/SetOperations/SetOperations.hs b/benchmarks/SetOperations/SetOperations.hs index 0eced65..eb3465c 100644 --- a/benchmarks/SetOperations/SetOperations.hs +++ b/benchmarks/SetOperations/SetOperations.hs @@ -19,7 +19,7 @@ benchmark fromList swap methods = do | (mode_str, (left, right)) <- [ ("disj_nn", disj_nn), ("disj_ns", disj_ns), ("disj_nt", disj_nt) , ("common_nn", common_nn), ("common_ns", common_ns), ("common_nt", common_nt) , ("mix_nn", mix_nn), ("mix_ns", mix_ns), ("mix_nt", mix_nt) - , ("block_nn", block_nn), ("block_sn", block_ns) + , ("block_nn", block_nn), ("block_ns", block_ns) ] , (mode_str, left, right) <- replicate 2 (mode_str, left, right) ++ @@ -35,11 +35,11 @@ benchmark fromList swap methods = do !common_nn = seqPair $ (all_n, fromList [2,4..n]) !common_ns = seqPair $ (all_n, fromList [0,1+n`div`s..n]) !common_nt = seqPair $ (all_n, fromList [0,1+n`div`t..n]) - !mix_nn = seqPair $ fromLists $ partition ((== 0) . (`mod` 2)) [1..n+n] - !mix_ns = seqPair $ fromLists $ partition ((== 0) . (`mod` (1 + n`div`s))) [1..s+n] - !mix_nt = seqPair $ fromLists $ partition ((== 0) . (`mod` (1 + n`div`t))) [1..t+n] - !block_nn = seqPair $ fromLists $ partition ((< t) . (`mod` (t * 2))) [1..n+n] - !block_ns = seqPair $ fromLists $ partition ((< t) . (`mod` (t * (1 + n`div`s)))) [1..s+n] + !mix_nn = seqPair $ fromLists $ partition ((/= 0) . (`mod` 2)) [1..n+n] + !mix_ns = seqPair $ fromLists $ partition ((/= 0) . (`mod` (1 + n`div`s))) [1..s+n] + !mix_nt = seqPair $ fromLists $ partition ((/= 0) . (`mod` (1 + n`div`t))) [1..t+n] + !block_nn = seqPair $ fromLists $ partition ((>= t) . (`mod` (t * 2))) [1..n+n] + !block_ns = seqPair $ fromLists $ partition ((>= t) . (`mod` (t * (1 + n`div`s)))) [1..s+n] fromLists (xs, ys) = (fromList xs, fromList ys) seqPair pair@(xs, ys) = xs `seq` ys `seq` pair From git at git.haskell.org Mon Apr 17 21:39:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:39:18 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Merge branch 'master' of github:haskell/containers (d0adc21) Message-ID: <20170417213918.B656C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/d0adc21f9ad9d64f6af92e46feade67404962516 >--------------------------------------------------------------- commit d0adc21f9ad9d64f6af92e46feade67404962516 Merge: e9ec4c2 b263e4a Author: Milan Straka Date: Thu Feb 11 08:14:14 2016 +0100 Merge branch 'master' of github:haskell/containers >--------------------------------------------------------------- d0adc21f9ad9d64f6af92e46feade67404962516 Data/IntMap.hs | 2 +- Data/Map/Strict.hs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) From git at git.haskell.org Mon Apr 17 21:39:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:39:20 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Delete tests-ghc (aa982fb) Message-ID: <20170417213920.BF0D93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/aa982fb83f2561d3b27b89b46d36ffca21e072cc >--------------------------------------------------------------- commit aa982fb83f2561d3b27b89b46d36ffca21e072cc Author: Thomas Miedema Date: Wed Feb 10 22:39:28 2016 +0100 Delete tests-ghc `containers` received its own testsuite in 38743e394dd19fcd7983a1f726482d04e64111ec (2010). That commit mentions: "It includes unit tests for known past bugs (balancing)." I think it's safe to delete the old ghc tests. >--------------------------------------------------------------- aa982fb83f2561d3b27b89b46d36ffca21e072cc tests-ghc/Makefile | 7 ------ tests-ghc/all.T | 7 ------ tests-ghc/dataintset001.hs | 11 ---------- tests-ghc/dataintset001.stdout | 1 - tests-ghc/datamap001.hs | 14 ------------ tests-ghc/datamap001.stdout | 1 - tests-ghc/datamap002.hs | 11 ---------- tests-ghc/datamap002.stdout | 1 - tests-ghc/sequence001.hs | 9 -------- tests-ghc/sequence001.stdout | 2 -- tests-ghc/unreliable/README | 2 -- tests-ghc/unreliable/coerce_tests | 5 ----- tests-ghc/unreliable/mapcoerceintmap.hs | 25 ---------------------- tests-ghc/unreliable/mapcoerceintmap.stdout | 3 --- tests-ghc/unreliable/mapcoerceintmapstrict.hs | 25 ---------------------- .../unreliable/mapcoerceintmapstrict.hs.stdout | 3 --- tests-ghc/unreliable/mapcoercemap.hs | 25 ---------------------- tests-ghc/unreliable/mapcoercemap.stdout | 3 --- tests-ghc/unreliable/mapcoerceseq.hs | 25 ---------------------- tests-ghc/unreliable/mapcoerceseq.stdout | 3 --- tests-ghc/unreliable/mapcoercesmap.hs | 25 ---------------------- tests-ghc/unreliable/mapcoercesmap.stdout | 3 --- 22 files changed, 211 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc aa982fb83f2561d3b27b89b46d36ffca21e072cc From git at git.haskell.org Mon Apr 17 21:39:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:39:22 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Merge pull request #183 from thomie/ghc-tests (8a62517) Message-ID: <20170417213922.C78B63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/8a62517f3b33f48613a818ca6e5ffea04b246f0c >--------------------------------------------------------------- commit 8a62517f3b33f48613a818ca6e5ffea04b246f0c Merge: d0adc21 aa982fb Author: Milan Straka Date: Wed Feb 17 13:58:06 2016 +0100 Merge pull request #183 from thomie/ghc-tests Delete tests-ghc >--------------------------------------------------------------- 8a62517f3b33f48613a818ca6e5ffea04b246f0c tests-ghc/Makefile | 7 ------ tests-ghc/all.T | 7 ------ tests-ghc/dataintset001.hs | 11 ---------- tests-ghc/dataintset001.stdout | 1 - tests-ghc/datamap001.hs | 14 ------------ tests-ghc/datamap001.stdout | 1 - tests-ghc/datamap002.hs | 11 ---------- tests-ghc/datamap002.stdout | 1 - tests-ghc/sequence001.hs | 9 -------- tests-ghc/sequence001.stdout | 2 -- tests-ghc/unreliable/README | 2 -- tests-ghc/unreliable/coerce_tests | 5 ----- tests-ghc/unreliable/mapcoerceintmap.hs | 25 ---------------------- tests-ghc/unreliable/mapcoerceintmap.stdout | 3 --- tests-ghc/unreliable/mapcoerceintmapstrict.hs | 25 ---------------------- .../unreliable/mapcoerceintmapstrict.hs.stdout | 3 --- tests-ghc/unreliable/mapcoercemap.hs | 25 ---------------------- tests-ghc/unreliable/mapcoercemap.stdout | 3 --- tests-ghc/unreliable/mapcoerceseq.hs | 25 ---------------------- tests-ghc/unreliable/mapcoerceseq.stdout | 3 --- tests-ghc/unreliable/mapcoercesmap.hs | 25 ---------------------- tests-ghc/unreliable/mapcoercesmap.stdout | 3 --- 22 files changed, 211 deletions(-) From git at git.haskell.org Mon Apr 17 21:39:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:39:24 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: add Generics instance for Map, Set, IntMap, and IntSet (729cb1a) Message-ID: <20170417213924.D34233A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/729cb1ac4e28cb665c7613e3a791cce9bcfcaa23 >--------------------------------------------------------------- commit 729cb1ac4e28cb665c7613e3a791cce9bcfcaa23 Author: Kubo Kovac Date: Thu Feb 18 17:21:57 2016 +0000 add Generics instance for Map, Set, IntMap, and IntSet we want Generics for everything (otherwise we can't derive Generics for any data types which contain these without creating orphan instances) >--------------------------------------------------------------- 729cb1ac4e28cb665c7613e3a791cce9bcfcaa23 Data/IntMap/Base.hs | 38 ++++++++++++++++++++++++++++++++++++++ Data/IntSet/Base.hs | 27 +++++++++++++++++++++++++++ Data/Map/Base.hs | 36 ++++++++++++++++++++++++++++++++++++ Data/Set/Base.hs | 26 ++++++++++++++++++++++++++ 4 files changed, 127 insertions(+) diff --git a/Data/IntMap/Base.hs b/Data/IntMap/Base.hs index e22c46b..f83cb14 100644 --- a/Data/IntMap/Base.hs +++ b/Data/IntMap/Base.hs @@ -8,6 +8,8 @@ {-# LANGUAGE ScopedTypeVariables #-} #if __GLASGOW_HASKELL__ >= 708 {-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE EmptyDataDecls #-} #endif #include "containers.h" @@ -246,6 +248,9 @@ import Data.Data (Data(..), Constr, mkConstr, constrIndex, Fixity(Prefix), import GHC.Exts (build) #if __GLASGOW_HASKELL__ >= 708 import qualified GHC.Exts as GHCExts +import GHC.Generics hiding (Prefix, prec, (:*:)) +import qualified GHC.Generics as Generics + #endif import Text.Read #endif @@ -415,6 +420,39 @@ intMapDataType = mkDataType "Data.IntMap.Base.IntMap" [fromListConstr] #endif +#if __GLASGOW_HASKELL__ >= 708 + +{-------------------------------------------------------------------- + A Generic instance +--------------------------------------------------------------------} + +-- list of pairs; LP k v ~ [(k, v)] so LP k ~ [(k, *)] +type LP k = [] Generics.:.: Rec1 ((,) k) +type Rep1IntMap = D1 D1IntMap (C1 C1IntMap (S1 NoSelector (LP Key))) + +instance Generic1 IntMap where + type Rep1 IntMap = Rep1IntMap + from1 m = M1 (M1 (M1 (Comp1 (Rec1 <$> toList m)))) + to1 (M1 (M1 (M1 l))) = fromList (unRec1 <$> unComp1 l) + +data D1IntMap +data C1IntMap + +instance Datatype D1IntMap where + datatypeName _ = "IntMap" + moduleName _ = "Data.IntMap.Base" + +instance Constructor C1IntMap where + conName _ = "IntMap.fromList" + +type Rep0IntMap a = D1 D1IntMap (C1 C1IntMap (S1 NoSelector (Rec0 [(Key, a)]))) + +instance Generic (IntMap a) where + type Rep (IntMap a) = Rep0IntMap a + from m = M1 (M1 (M1 (K1 $ toList m))) + to (M1 (M1 (M1 (K1 l)))) = fromList l +#endif + {-------------------------------------------------------------------- Query --------------------------------------------------------------------} diff --git a/Data/IntSet/Base.hs b/Data/IntSet/Base.hs index 3df44cb..1efed08 100644 --- a/Data/IntSet/Base.hs +++ b/Data/IntSet/Base.hs @@ -7,6 +7,7 @@ #endif #if __GLASGOW_HASKELL__ >= 708 {-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE EmptyDataDecls #-} #endif #include "containers.h" @@ -192,6 +193,7 @@ import Text.Read import GHC.Exts (Int(..), build) #if __GLASGOW_HASKELL__ >= 708 import qualified GHC.Exts as GHCExts +import GHC.Generics hiding (Prefix, prec, (:*:)) #endif import GHC.Prim (indexInt8OffAddr#) #endif @@ -286,6 +288,31 @@ intSetDataType = mkDataType "Data.IntSet.Base.IntSet" [fromListConstr] #endif +#if __GLASGOW_HASKELL__ >= 708 + +{-------------------------------------------------------------------- + A Generic instance +--------------------------------------------------------------------} + +type Rep0IntSet = D1 D1IntSet (C1 C1IntSet (S1 NoSelector (Rec0 [Key]))) + +instance Generic IntSet where + type Rep IntSet = Rep0IntSet + from s = M1 (M1 (M1 (K1 $ toList s))) + to (M1 (M1 (M1 (K1 t)))) = fromList t + +data D1IntSet +data C1IntSet + +instance Datatype D1IntSet where + datatypeName _ = "IntSet" + moduleName _ = "Data.IntSet.Base" + +instance Constructor C1IntSet where + conName _ = "IntSet" + conIsRecord _ = False +#endif + {-------------------------------------------------------------------- Query --------------------------------------------------------------------} diff --git a/Data/Map/Base.hs b/Data/Map/Base.hs index 5d80efe..10d952f 100644 --- a/Data/Map/Base.hs +++ b/Data/Map/Base.hs @@ -8,6 +8,8 @@ #if __GLASGOW_HASKELL__ >= 708 {-# LANGUAGE RoleAnnotations #-} {-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE EmptyDataDecls #-} #endif #include "containers.h" @@ -293,6 +295,8 @@ import Data.Utils.StrictPair import GHC.Exts ( build ) #if __GLASGOW_HASKELL__ >= 708 import qualified GHC.Exts as GHCExts +import GHC.Generics hiding (Prefix, prec, (:*:)) +import qualified GHC.Generics as Generics #endif import Text.Read import Data.Data @@ -377,7 +381,39 @@ fromListConstr = mkConstr mapDataType "fromList" [] Prefix mapDataType :: DataType mapDataType = mkDataType "Data.Map.Base.Map" [fromListConstr] +#endif + +#if __GLASGOW_HASKELL__ >= 708 + +{-------------------------------------------------------------------- + A Generic instance +--------------------------------------------------------------------} + +-- list of pairs; LP k v ~ [(k, v)] so LP k ~ [(k, *)] +type LP k = [] Generics.:.: Rec1 ((,) k) +type Rep1Map k = D1 D1Map (C1 C1Map (S1 NoSelector (LP k))) + +instance (Eq k, Ord k) => Generic1 (Map k) where + type Rep1 (Map k) = Rep1Map k + from1 m = M1 (M1 (M1 (Comp1 (Rec1 <$> toList m)))) + to1 (M1 (M1 (M1 l))) = fromList (unRec1 <$> unComp1 l) + +data D1Map +data C1Map + +instance Datatype D1Map where + datatypeName _ = "Map" + moduleName _ = "Data.Map.Base" + +instance Constructor C1Map where + conName _ = "Map.fromList" + +type Rep0Map k v = D1 D1Map (C1 C1Map (S1 NoSelector (Rec0 [(k, v)]))) +instance (Eq k, Ord k) => Generic (Map k v) where + type Rep (Map k v) = Rep0Map k v + from m = M1 (M1 (M1 (K1 $ toList m))) + to (M1 (M1 (M1 (K1 l)))) = fromList l #endif {-------------------------------------------------------------------- diff --git a/Data/Set/Base.hs b/Data/Set/Base.hs index 01c343a..bf38e01 100644 --- a/Data/Set/Base.hs +++ b/Data/Set/Base.hs @@ -8,6 +8,8 @@ #if __GLASGOW_HASKELL__ >= 708 {-# LANGUAGE RoleAnnotations #-} {-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE EmptyDataDecls #-} #endif #include "containers.h" @@ -213,6 +215,7 @@ import Data.Utils.StrictPair import GHC.Exts ( build ) #if __GLASGOW_HASKELL__ >= 708 import qualified GHC.Exts as GHCExts +import GHC.Generics hiding (Prefix, prec, (:*:)) #endif import Text.Read import Data.Data @@ -331,6 +334,29 @@ setDataType = mkDataType "Data.Set.Base.Set" [fromListConstr] #endif +#if __GLASGOW_HASKELL__ >= 708 + +{-------------------------------------------------------------------- + A Generic instance +--------------------------------------------------------------------} +data D1Set +data C1Set + +instance Datatype D1Set where + datatypeName _ = "Set" + moduleName _ = "Data.Set.Base" + +instance Constructor C1Set where + conName _ = "Set.fromList" + +type Rep0Set a = D1 D1Set (C1 C1Set (S1 NoSelector (Rec0 [a]))) + +instance (Eq a, Ord a) => Generic (Set a) where + type Rep (Set a) = Rep0Set a + from s = M1 (M1 (M1 (K1 $ toList s))) + to (M1 (M1 (M1 (K1 l)))) = fromList l +#endif + {-------------------------------------------------------------------- Query --------------------------------------------------------------------} From git at git.haskell.org Mon Apr 17 21:39:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:39:26 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Merge pull request #184 from kuk0/generic (984c8b1) Message-ID: <20170417213926.DD69D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/984c8b1a72223bdb7ed5aecac5b7c73093744d1f >--------------------------------------------------------------- commit 984c8b1a72223bdb7ed5aecac5b7c73093744d1f Merge: 8a62517 729cb1a Author: Milan Straka Date: Fri Feb 19 13:30:41 2016 +0100 Merge pull request #184 from kuk0/generic add Generics instance for Map, Set, IntMap, and IntSet >--------------------------------------------------------------- 984c8b1a72223bdb7ed5aecac5b7c73093744d1f Data/IntMap/Base.hs | 38 ++++++++++++++++++++++++++++++++++++++ Data/IntSet/Base.hs | 27 +++++++++++++++++++++++++++ Data/Map/Base.hs | 36 ++++++++++++++++++++++++++++++++++++ Data/Set/Base.hs | 26 ++++++++++++++++++++++++++ 4 files changed, 127 insertions(+) From git at git.haskell.org Mon Apr 17 21:39:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:39:28 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Remove wrong document in {Set, Map}.hs related to key comparison (7103ac6) Message-ID: <20170417213928.E75F23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/7103ac63adbda03924f92fc5ea36a9b31c90c597 >--------------------------------------------------------------- commit 7103ac63adbda03924f92fc5ea36a9b31c90c597 Author: Masaru Nomura Date: Mon Mar 21 17:56:07 2016 +0900 Remove wrong document in {Set, Map}.hs related to key comparison As we no longer use (<=) comparison but use (<) comparison instead since this commit[1], the document is not correct to explain the current implementation. [1] https://github.com/haskell/containers/commit/4193a09336772748bdec0cdab5da4257d224c814 >--------------------------------------------------------------- 7103ac63adbda03924f92fc5ea36a9b31c90c597 Data/Map/Base.hs | 7 ------- Data/Set/Base.hs | 7 ------- 2 files changed, 14 deletions(-) diff --git a/Data/Map/Base.hs b/Data/Map/Base.hs index 10d952f..4fdbc58 100644 --- a/Data/Map/Base.hs +++ b/Data/Map/Base.hs @@ -2436,13 +2436,6 @@ splitLookup k t = k `seq` [glue l r] Glues [l] and [r] together. Assumes that [l] and [r] are already balanced with respect to each other. [merge l r] Merges two trees and restores balance. - - Note: in contrast to Adam's paper, we use (<=) comparisons instead - of (<) comparisons in [link], [merge] and [balance]. - Quickcheck (on [difference]) showed that this was necessary in order - to maintain the invariants. It is quite unsatisfactory that I haven't - been able to find out why this is actually the case! Fortunately, it - doesn't hurt to be a bit more conservative. --------------------------------------------------------------------} {-------------------------------------------------------------------- diff --git a/Data/Set/Base.hs b/Data/Set/Base.hs index bf38e01..47efe85 100644 --- a/Data/Set/Base.hs +++ b/Data/Set/Base.hs @@ -1259,13 +1259,6 @@ deleteAt i t = i `seq` [glue l r] Glues [l] and [r] together. Assumes that [l] and [r] are already balanced with respect to each other. [merge l r] Merges two trees and restores balance. - - Note: in contrast to Adam's paper, we use (<=) comparisons instead - of (<) comparisons in [link], [merge] and [balance]. - Quickcheck (on [difference]) showed that this was necessary in order - to maintain the invariants. It is quite unsatisfactory that I haven't - been able to find out why this is actually the case! Fortunately, it - doesn't hurt to be a bit more conservative. --------------------------------------------------------------------} {-------------------------------------------------------------------- From git at git.haskell.org Mon Apr 17 21:39:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:39:30 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Merge pull request #191 from monkey-mas/remove-wrong-document-related-to-bounded-balance-tree (0abd9a0) Message-ID: <20170417213930.F03E93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/0abd9a0ed4d917d09f80b1c6848d05447e860bdb >--------------------------------------------------------------- commit 0abd9a0ed4d917d09f80b1c6848d05447e860bdb Merge: 984c8b1 7103ac6 Author: Milan Straka Date: Mon Mar 21 13:44:01 2016 +0100 Merge pull request #191 from monkey-mas/remove-wrong-document-related-to-bounded-balance-tree Remove wrong document in {Set, Map}.hs related to key comparison >--------------------------------------------------------------- 0abd9a0ed4d917d09f80b1c6848d05447e860bdb Data/Map/Base.hs | 7 ------- Data/Set/Base.hs | 7 ------- 2 files changed, 14 deletions(-) From git at git.haskell.org Mon Apr 17 21:39:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:39:33 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Fix performance of Data.Sequence.filter (fixes #176) (199e1ce) Message-ID: <20170417213933.0497C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/199e1ce65a13d67e89a30dd6b7aa0bc0a6a4f734 >--------------------------------------------------------------- commit 199e1ce65a13d67e89a30dd6b7aa0bc0a6a4f734 Author: Michael Snoyman Date: Thu Mar 31 20:16:56 2016 +0300 Fix performance of Data.Sequence.filter (fixes #176) >--------------------------------------------------------------- 199e1ce65a13d67e89a30dd6b7aa0bc0a6a4f734 Data/Sequence.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 89616b6..c0986e5 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -2130,7 +2130,7 @@ partition p = foldl part (empty, empty) -- @xs@ and returns a sequence of those elements which satisfy the -- predicate. filter :: (a -> Bool) -> Seq a -> Seq a -filter p = foldl (\ xs x -> if p x then xs |> x else xs) empty +filter p = foldl' (\ xs x -> if p x then xs |> x else xs) empty -- Indexing sequences From git at git.haskell.org Mon Apr 17 21:39:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:39:35 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Merge pull request #193 from fpco/176-better-seq-filter (509d598) Message-ID: <20170417213935.0D0F23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/509d598a64a574ac7602c5b1dc95d53c6cb86350 >--------------------------------------------------------------- commit 509d598a64a574ac7602c5b1dc95d53c6cb86350 Merge: 0abd9a0 199e1ce Author: Milan Straka Date: Thu Mar 31 20:57:09 2016 +0200 Merge pull request #193 from fpco/176-better-seq-filter Fix performance of Data.Sequence.filter (fixes #176) >--------------------------------------------------------------- 509d598a64a574ac7602c5b1dc95d53c6cb86350 Data/Sequence.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) From git at git.haskell.org Mon Apr 17 21:39:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:39:37 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Rename Empty constructor to EmptyT (d0105d2) Message-ID: <20170417213937.180993A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/d0105d2117967c1b7de60b1246188b20cc3e5cc2 >--------------------------------------------------------------- commit d0105d2117967c1b7de60b1246188b20cc3e5cc2 Author: David Feuer Date: Wed Apr 20 19:03:59 2016 -0400 Rename Empty constructor to EmptyT `Empty` will be a pattern synonym. To avoid confusion and an extra module, move the actual `FingerTree` constructor out of the way. >--------------------------------------------------------------- d0105d2117967c1b7de60b1246188b20cc3e5cc2 Data/Sequence.hs | 134 +++++++++++++++++++++++++++---------------------------- 1 file changed, 67 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 d0105d2117967c1b7de60b1246188b20cc3e5cc2 From git at git.haskell.org Mon Apr 17 21:39:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:39:41 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Merge pull request #194 from treeowl/sequence-patterns (0c5408d) Message-ID: <20170417213941.2A8423A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/0c5408df6ed33fd925c5d983fa330353814bd033 >--------------------------------------------------------------- commit 0c5408df6ed33fd925c5d983fa330353814bd033 Merge: 509d598 fa85383 Author: David Feuer Date: Wed Apr 20 22:33:47 2016 -0400 Merge pull request #194 from treeowl/sequence-patterns Sequence pattern synonyms >--------------------------------------------------------------- 0c5408df6ed33fd925c5d983fa330353814bd033 .gitignore | 1 + Data/Sequence.hs | 200 +++++++++++++++++++++++++++++++----------------- tests/seq-properties.hs | 8 +- 3 files changed, 135 insertions(+), 74 deletions(-) From git at git.haskell.org Mon Apr 17 21:39:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:39:39 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Add pattern synonyms for sequences (fa85383) Message-ID: <20170417213939.210963A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/fa85383c542841883aa50aac1a0335e20481c6d6 >--------------------------------------------------------------- commit fa85383c542841883aa50aac1a0335e20481c6d6 Author: David Feuer Date: Wed Apr 20 21:35:17 2016 -0400 Add pattern synonyms for sequences Allow `Seq` to be matched with `Empty`, `:<|`, and `:|>`. Unfortunately, there's quite a lot of CPP noise resulting from various developments in pattern synonyms in different versions. Also unfortunately, there's not yet any way to let GHC know that matching on `Empty` and `:<|`, or on `Empty` and `:|>`, will be exhaustive. >--------------------------------------------------------------- fa85383c542841883aa50aac1a0335e20481c6d6 .gitignore | 1 + Data/Sequence.hs | 66 ++++++++++++++++++++++++++++++++++++++++++++++--- tests/seq-properties.hs | 8 +++--- 3 files changed, 68 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index f5c7aee..fb03447 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ GNUmakefile dist-install ghc.mk +.stack-work diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 0103d71..2a90928 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -1,4 +1,7 @@ {-# LANGUAGE CPP #-} +#if __GLASGOW_HASKELL__ >= 708 +#define DEFINE_PATTERN_SYNONYMS 1 +#endif #if __GLASGOW_HASKELL__ {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE StandaloneDeriving #-} @@ -10,6 +13,10 @@ #if __GLASGOW_HASKELL__ >= 708 {-# LANGUAGE TypeFamilies #-} #endif +#ifdef DEFINE_PATTERN_SYNONYMS +{-# LANGUAGE PatternSynonyms #-} +{-# LANGUAGE ViewPatterns #-} +#endif #include "containers.h" @@ -56,10 +63,24 @@ ----------------------------------------------------------------------------- module Data.Sequence ( -#if !defined(TESTING) - Seq, +#if defined(TESTING) + Elem(..), FingerTree(..), Node(..), Digit(..), +#if __GLASGOW_HASKELL__ >= 800 + Seq (.., Empty, (:<|), (:|>)), +#else + Seq (..), +#endif + +#elif __GLASGOW_HASKELL__ >= 800 + Seq (Empty, (:<|), (:|>)), #else - Seq(..), Elem(..), FingerTree(..), Node(..), Digit(..), + Seq, +#if defined(DEFINE_PATTERN_SYNONYMS) + -- * Pattern synonyms + pattern Empty, -- :: Seq a + pattern (:<|), -- :: a -> Seq a -> Seq a + pattern (:|>), -- :: Seq a -> a -> Seq a +#endif #endif -- * Construction empty, -- :: Seq a @@ -220,6 +241,45 @@ infixr 5 >< infixr 5 <|, :< infixl 5 |>, :> +#ifdef DEFINE_PATTERN_SYNONYMS +infixr 5 :<| +infixl 5 :|> + +-- TODO: Once GHC implements some way to prevent non-exhaustive +-- pattern match warnings for pattern synonyms, we should be +-- sure to take advantage of that. + +-- Unfortunately, there's some extra noise here because +-- pattern synonyms could not have signatures until 7.10, +-- but 8.0 at least will warn if they're missing. +#if __GLASGOW_HASKELL__ >= 710 +pattern Empty :: Seq a +#endif +pattern Empty = Seq EmptyT + +-- Non-trivial bidirectional pattern synonyms are only +-- available in GHC >= 7.10. In earlier versions, these +-- can be used to match, but not to construct. + +#if __GLASGOW_HASKELL__ >= 710 +pattern (:<|) :: a -> Seq a -> Seq a +#endif +pattern x :<| xs <- (viewl -> x :< xs) +#if __GLASGOW_HASKELL__ >= 710 + where + x :<| xs = x <| xs +#endif + +#if __GLASGOW_HASKELL__ >= 710 +pattern (:|>) :: Seq a -> a -> Seq a +#endif +pattern xs :|> x <- (viewr -> xs :> x) +#if __GLASGOW_HASKELL__ >= 710 + where + xs :|> x = xs |> x +#endif +#endif + class Sized a where size :: a -> Int diff --git a/tests/seq-properties.hs b/tests/seq-properties.hs index c70a8a2..64c84fe 100644 --- a/tests/seq-properties.hs +++ b/tests/seq-properties.hs @@ -116,7 +116,7 @@ instance (Arbitrary a, Sized a) => Arbitrary (FingerTree a) where arbitrary = sized arb where arb :: (Arbitrary b, Sized b) => Int -> Gen (FingerTree b) - arb 0 = return Empty + arb 0 = return EmptyT arb 1 = Single <$> arbitrary arb n = do pr <- arbitrary @@ -128,13 +128,13 @@ instance (Arbitrary a, Sized a) => Arbitrary (FingerTree a) where m <- arb n_m return $ deep pr m sf - shrink (Deep _ (One a) Empty (One b)) = [Single a, Single b] + shrink (Deep _ (One a) EmptyT (One b)) = [Single a, Single b] shrink (Deep _ pr m sf) = [deep pr' m sf | pr' <- shrink pr] ++ [deep pr m' sf | m' <- shrink m] ++ [deep pr m sf' | sf' <- shrink sf] shrink (Single x) = map Single (shrink x) - shrink Empty = [] + shrink EmptyT = [] instance (Arbitrary a, Sized a) => Arbitrary (Node a) where arbitrary = oneof [ @@ -176,7 +176,7 @@ instance Valid (Seq a) where valid (Seq xs) = valid xs instance (Sized a, Valid a) => Valid (FingerTree a) where - valid Empty = True + valid EmptyT = True valid (Single x) = valid x valid (Deep s pr m sf) = s == size pr + size m + size sf && valid pr && valid m && valid sf From git at git.haskell.org Mon Apr 17 21:39:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:39:43 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Add changelog entry for sequence pattern synonyms (daae76b) Message-ID: <20170417213943.3284F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/daae76baf9460d40f2dcf0c37fb172942ed5b098 >--------------------------------------------------------------- commit daae76baf9460d40f2dcf0c37fb172942ed5b098 Author: David Feuer Date: Thu Apr 21 13:37:35 2016 -0400 Add changelog entry for sequence pattern synonyms >--------------------------------------------------------------- daae76baf9460d40f2dcf0c37fb172942ed5b098 changelog.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index d8c6d2b..eac87bb 100644 --- a/changelog.md +++ b/changelog.md @@ -6,9 +6,11 @@ * Add `IsString` instance to `Data.Sequence`. - * Define `Semigroup` instances for ``Data.Map`, `Data.Set`, `Data.IntMap`, + * Define `Semigroup` instances for `Data.Map`, `Data.Set`, `Data.IntMap`, `Data.IntSet` and `Data.Sequence`. + * Add `Empty`, `:<|`, and `:|>` pattern synonyms for `Seq`. + ## 0.5.6.2 *Dec 2014* * Bundled with GHC 7.10.1. From git at git.haskell.org Mon Apr 17 21:39:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:39:45 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Merge pull request #196 from treeowl/changelog-patterns (d195ff2) Message-ID: <20170417213945.39B2E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/d195ff234992a2f1dfddf58c1125ea4a759a8a96 >--------------------------------------------------------------- commit d195ff234992a2f1dfddf58c1125ea4a759a8a96 Merge: 0c5408d daae76b Author: David Feuer Date: Thu Apr 21 13:42:09 2016 -0400 Merge pull request #196 from treeowl/changelog-patterns Add changelog entry for sequence pattern synonyms >--------------------------------------------------------------- d195ff234992a2f1dfddf58c1125ea4a759a8a96 changelog.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) From git at git.haskell.org Mon Apr 17 21:39:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:39:47 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-184-generic, revert-408-bugfix_394: Revert "add Generics instance for Map, Set, IntMap, and IntSet" (c26240e) Message-ID: <20170417213947.476103A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-184-generic,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/c26240ed176ebe72755f31541651177cc1aa355a >--------------------------------------------------------------- commit c26240ed176ebe72755f31541651177cc1aa355a Author: David Feuer Date: Thu Apr 21 14:42:42 2016 -0400 Revert "add Generics instance for Map, Set, IntMap, and IntSet" >--------------------------------------------------------------- c26240ed176ebe72755f31541651177cc1aa355a Data/IntMap/Base.hs | 38 -------------------------------------- Data/IntSet/Base.hs | 27 --------------------------- Data/Map/Base.hs | 36 ------------------------------------ Data/Set/Base.hs | 26 -------------------------- 4 files changed, 127 deletions(-) diff --git a/Data/IntMap/Base.hs b/Data/IntMap/Base.hs index f83cb14..e22c46b 100644 --- a/Data/IntMap/Base.hs +++ b/Data/IntMap/Base.hs @@ -8,8 +8,6 @@ {-# LANGUAGE ScopedTypeVariables #-} #if __GLASGOW_HASKELL__ >= 708 {-# LANGUAGE TypeFamilies #-} -{-# LANGUAGE TypeOperators #-} -{-# LANGUAGE EmptyDataDecls #-} #endif #include "containers.h" @@ -248,9 +246,6 @@ import Data.Data (Data(..), Constr, mkConstr, constrIndex, Fixity(Prefix), import GHC.Exts (build) #if __GLASGOW_HASKELL__ >= 708 import qualified GHC.Exts as GHCExts -import GHC.Generics hiding (Prefix, prec, (:*:)) -import qualified GHC.Generics as Generics - #endif import Text.Read #endif @@ -420,39 +415,6 @@ intMapDataType = mkDataType "Data.IntMap.Base.IntMap" [fromListConstr] #endif -#if __GLASGOW_HASKELL__ >= 708 - -{-------------------------------------------------------------------- - A Generic instance ---------------------------------------------------------------------} - --- list of pairs; LP k v ~ [(k, v)] so LP k ~ [(k, *)] -type LP k = [] Generics.:.: Rec1 ((,) k) -type Rep1IntMap = D1 D1IntMap (C1 C1IntMap (S1 NoSelector (LP Key))) - -instance Generic1 IntMap where - type Rep1 IntMap = Rep1IntMap - from1 m = M1 (M1 (M1 (Comp1 (Rec1 <$> toList m)))) - to1 (M1 (M1 (M1 l))) = fromList (unRec1 <$> unComp1 l) - -data D1IntMap -data C1IntMap - -instance Datatype D1IntMap where - datatypeName _ = "IntMap" - moduleName _ = "Data.IntMap.Base" - -instance Constructor C1IntMap where - conName _ = "IntMap.fromList" - -type Rep0IntMap a = D1 D1IntMap (C1 C1IntMap (S1 NoSelector (Rec0 [(Key, a)]))) - -instance Generic (IntMap a) where - type Rep (IntMap a) = Rep0IntMap a - from m = M1 (M1 (M1 (K1 $ toList m))) - to (M1 (M1 (M1 (K1 l)))) = fromList l -#endif - {-------------------------------------------------------------------- Query --------------------------------------------------------------------} diff --git a/Data/IntSet/Base.hs b/Data/IntSet/Base.hs index 1efed08..3df44cb 100644 --- a/Data/IntSet/Base.hs +++ b/Data/IntSet/Base.hs @@ -7,7 +7,6 @@ #endif #if __GLASGOW_HASKELL__ >= 708 {-# LANGUAGE TypeFamilies #-} -{-# LANGUAGE EmptyDataDecls #-} #endif #include "containers.h" @@ -193,7 +192,6 @@ import Text.Read import GHC.Exts (Int(..), build) #if __GLASGOW_HASKELL__ >= 708 import qualified GHC.Exts as GHCExts -import GHC.Generics hiding (Prefix, prec, (:*:)) #endif import GHC.Prim (indexInt8OffAddr#) #endif @@ -288,31 +286,6 @@ intSetDataType = mkDataType "Data.IntSet.Base.IntSet" [fromListConstr] #endif -#if __GLASGOW_HASKELL__ >= 708 - -{-------------------------------------------------------------------- - A Generic instance ---------------------------------------------------------------------} - -type Rep0IntSet = D1 D1IntSet (C1 C1IntSet (S1 NoSelector (Rec0 [Key]))) - -instance Generic IntSet where - type Rep IntSet = Rep0IntSet - from s = M1 (M1 (M1 (K1 $ toList s))) - to (M1 (M1 (M1 (K1 t)))) = fromList t - -data D1IntSet -data C1IntSet - -instance Datatype D1IntSet where - datatypeName _ = "IntSet" - moduleName _ = "Data.IntSet.Base" - -instance Constructor C1IntSet where - conName _ = "IntSet" - conIsRecord _ = False -#endif - {-------------------------------------------------------------------- Query --------------------------------------------------------------------} diff --git a/Data/Map/Base.hs b/Data/Map/Base.hs index 4fdbc58..63931aa 100644 --- a/Data/Map/Base.hs +++ b/Data/Map/Base.hs @@ -8,8 +8,6 @@ #if __GLASGOW_HASKELL__ >= 708 {-# LANGUAGE RoleAnnotations #-} {-# LANGUAGE TypeFamilies #-} -{-# LANGUAGE TypeOperators #-} -{-# LANGUAGE EmptyDataDecls #-} #endif #include "containers.h" @@ -295,8 +293,6 @@ import Data.Utils.StrictPair import GHC.Exts ( build ) #if __GLASGOW_HASKELL__ >= 708 import qualified GHC.Exts as GHCExts -import GHC.Generics hiding (Prefix, prec, (:*:)) -import qualified GHC.Generics as Generics #endif import Text.Read import Data.Data @@ -381,39 +377,7 @@ fromListConstr = mkConstr mapDataType "fromList" [] Prefix mapDataType :: DataType mapDataType = mkDataType "Data.Map.Base.Map" [fromListConstr] -#endif - -#if __GLASGOW_HASKELL__ >= 708 - -{-------------------------------------------------------------------- - A Generic instance ---------------------------------------------------------------------} - --- list of pairs; LP k v ~ [(k, v)] so LP k ~ [(k, *)] -type LP k = [] Generics.:.: Rec1 ((,) k) -type Rep1Map k = D1 D1Map (C1 C1Map (S1 NoSelector (LP k))) - -instance (Eq k, Ord k) => Generic1 (Map k) where - type Rep1 (Map k) = Rep1Map k - from1 m = M1 (M1 (M1 (Comp1 (Rec1 <$> toList m)))) - to1 (M1 (M1 (M1 l))) = fromList (unRec1 <$> unComp1 l) - -data D1Map -data C1Map - -instance Datatype D1Map where - datatypeName _ = "Map" - moduleName _ = "Data.Map.Base" - -instance Constructor C1Map where - conName _ = "Map.fromList" - -type Rep0Map k v = D1 D1Map (C1 C1Map (S1 NoSelector (Rec0 [(k, v)]))) -instance (Eq k, Ord k) => Generic (Map k v) where - type Rep (Map k v) = Rep0Map k v - from m = M1 (M1 (M1 (K1 $ toList m))) - to (M1 (M1 (M1 (K1 l)))) = fromList l #endif {-------------------------------------------------------------------- diff --git a/Data/Set/Base.hs b/Data/Set/Base.hs index 47efe85..0be2af2 100644 --- a/Data/Set/Base.hs +++ b/Data/Set/Base.hs @@ -8,8 +8,6 @@ #if __GLASGOW_HASKELL__ >= 708 {-# LANGUAGE RoleAnnotations #-} {-# LANGUAGE TypeFamilies #-} -{-# LANGUAGE TypeOperators #-} -{-# LANGUAGE EmptyDataDecls #-} #endif #include "containers.h" @@ -215,7 +213,6 @@ import Data.Utils.StrictPair import GHC.Exts ( build ) #if __GLASGOW_HASKELL__ >= 708 import qualified GHC.Exts as GHCExts -import GHC.Generics hiding (Prefix, prec, (:*:)) #endif import Text.Read import Data.Data @@ -334,29 +331,6 @@ setDataType = mkDataType "Data.Set.Base.Set" [fromListConstr] #endif -#if __GLASGOW_HASKELL__ >= 708 - -{-------------------------------------------------------------------- - A Generic instance ---------------------------------------------------------------------} -data D1Set -data C1Set - -instance Datatype D1Set where - datatypeName _ = "Set" - moduleName _ = "Data.Set.Base" - -instance Constructor C1Set where - conName _ = "Set.fromList" - -type Rep0Set a = D1 D1Set (C1 C1Set (S1 NoSelector (Rec0 [a]))) - -instance (Eq a, Ord a) => Generic (Set a) where - type Rep (Set a) = Rep0Set a - from s = M1 (M1 (M1 (K1 $ toList s))) - to (M1 (M1 (M1 (K1 l)))) = fromList l -#endif - {-------------------------------------------------------------------- Query --------------------------------------------------------------------} From git at git.haskell.org Mon Apr 17 21:39:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:39:49 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Derive Generic and Generic1 for Data.Tree (630bedc) Message-ID: <20170417213949.4F0623A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/630bedcc2bf95eb8764b7565c33279737565bfa6 >--------------------------------------------------------------- commit 630bedcc2bf95eb8764b7565c33279737565bfa6 Author: David Feuer Date: Thu Apr 21 22:27:33 2016 -0400 Derive Generic and Generic1 for Data.Tree Unlike the other container types, `Data.Tree.Tree` is fully exposed. Therefore, we can and should derive `Generic` and `Generic1` instances for it. >--------------------------------------------------------------- 630bedcc2bf95eb8764b7565c33279737565bfa6 Data/Tree.hs | 14 ++++++++++++++ changelog.md | 2 ++ 2 files changed, 16 insertions(+) diff --git a/Data/Tree.hs b/Data/Tree.hs index a6f64f9..acfc8c2 100644 --- a/Data/Tree.hs +++ b/Data/Tree.hs @@ -2,6 +2,9 @@ #if __GLASGOW_HASKELL__ {-# LANGUAGE DeriveDataTypeable, StandaloneDeriving #-} #endif +#if __GLASGOW_HASKELL__ >= 702 +{-# LANGUAGE DeriveGeneric #-} +#endif #if __GLASGOW_HASKELL__ >= 703 {-# LANGUAGE Trustworthy #-} #endif @@ -52,6 +55,11 @@ import Control.DeepSeq (NFData(rnf)) #ifdef __GLASGOW_HASKELL__ import Data.Data (Data) #endif +#if __GLASGOW_HASKELL__ >= 706 +import GHC.Generics (Generic, Generic1) +#elif __GLASGOW_HASKELL__ >= 702 +import GHC.Generics (Generic) +#endif #if MIN_VERSION_base(4,8,0) import Data.Coerce @@ -63,7 +71,13 @@ data Tree a = Node { subForest :: Forest a -- ^ zero or more child trees } #ifdef __GLASGOW_HASKELL__ +#if __GLASGOW_HASKELL__ >= 706 + deriving (Eq, Read, Show, Data, Generic, Generic1) +#elif __GLASGOW_HASKELL__ >= 702 + deriving (Eq, Read, Show, Data, Generic) +#else deriving (Eq, Read, Show, Data) +#endif #else deriving (Eq, Read, Show) #endif diff --git a/changelog.md b/changelog.md index eac87bb..1ee6eb5 100644 --- a/changelog.md +++ b/changelog.md @@ -11,6 +11,8 @@ * Add `Empty`, `:<|`, and `:|>` pattern synonyms for `Seq`. + * Derive `Generic` and `Generic1` for `Data.Tree.Tree`. + ## 0.5.6.2 *Dec 2014* * Bundled with GHC 7.10.1. From git at git.haskell.org Mon Apr 17 21:39:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:39:51 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #200 from treeowl/generic-tree (b8204a6) Message-ID: <20170417213951.56DF33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/b8204a6e29a7d3f12b3e64bda192fed549210d8b >--------------------------------------------------------------- commit b8204a6e29a7d3f12b3e64bda192fed549210d8b Merge: d195ff2 630bedc Author: David Feuer Date: Fri Apr 22 02:01:44 2016 -0400 Merge pull request #200 from treeowl/generic-tree Derive Generic and Generic1 for Data.Tree >--------------------------------------------------------------- b8204a6e29a7d3f12b3e64bda192fed549210d8b Data/Tree.hs | 14 ++++++++++++++ changelog.md | 2 ++ 2 files changed, 16 insertions(+) From git at git.haskell.org Mon Apr 17 21:39:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:39:53 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #197 from haskell/revert-184-generic (d62482a) Message-ID: <20170417213953.606C33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/d62482a7d04c039d990c26e38df38cd44ddbc0b6 >--------------------------------------------------------------- commit d62482a7d04c039d990c26e38df38cd44ddbc0b6 Merge: b8204a6 c26240e Author: David Feuer Date: Fri Apr 22 02:02:24 2016 -0400 Merge pull request #197 from haskell/revert-184-generic Revert "add Generics instance for Map, Set, IntMap, and IntSet" >--------------------------------------------------------------- d62482a7d04c039d990c26e38df38cd44ddbc0b6 Data/IntMap/Base.hs | 38 -------------------------------------- Data/IntSet/Base.hs | 27 --------------------------- Data/Map/Base.hs | 36 ------------------------------------ Data/Set/Base.hs | 26 -------------------------- 4 files changed, 127 deletions(-) From git at git.haskell.org Mon Apr 17 21:39:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:39:55 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Add intersperse for Seq (2e6f6de) Message-ID: <20170417213955.6B3DB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/2e6f6dedc15ca19fff292f7151693cdb2cde0ab3 >--------------------------------------------------------------- commit 2e6f6dedc15ca19fff292f7151693cdb2cde0ab3 Author: David Feuer Date: Sat Dec 27 21:09:28 2014 -0500 Add intersperse for Seq `intersperse` is just like the one in `Data.List`. It is implemented using `<**>` for optimal performance. >--------------------------------------------------------------- 2e6f6dedc15ca19fff292f7151693cdb2cde0ab3 Data/Sequence.hs | 10 +++++++++- changelog.md | 2 ++ tests/seq-properties.hs | 5 +++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 2a90928..fa7dd18 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -162,6 +162,7 @@ module Data.Sequence ( mapWithIndex, -- :: (Int -> a -> b) -> Seq a -> Seq b traverseWithIndex, -- :: Applicative f => (Int -> a -> f b) -> Seq a -> f (Seq b) reverse, -- :: Seq a -> Seq a + intersperse, -- :: a -> Seq a -> Seq a -- ** Zips zip, -- :: Seq a -> Seq b -> Seq (a, b) zipWith, -- :: (a -> b -> c) -> Seq a -> Seq b -> Seq c @@ -186,7 +187,7 @@ import Prelude hiding ( scanl, scanl1, scanr, scanr1, replicate, zip, zipWith, zip3, zipWith3, takeWhile, dropWhile, iterate, reverse, filter, mapM, sum, all) import qualified Data.List -import Control.Applicative (Applicative(..), (<$>), Alternative, +import Control.Applicative (Applicative(..), (<$>), (<**>), Alternative, WrappedMonad(..), liftA, liftA2, liftA3) import qualified Control.Applicative as Applicative (Alternative(..)) import Control.DeepSeq (NFData(rnf)) @@ -567,6 +568,13 @@ thin12 s pr m (Two a b) = DeepTh s pr (thin m) (Two12 a b) thin12 s pr m (Three a b c) = DeepTh s pr (thin $ m `snocTree` node2 a b) (One12 c) thin12 s pr m (Four a b c d) = DeepTh s pr (thin $ m `snocTree` node2 a b) (Two12 c d) +-- | Intersperse an element between the elements of a sequence. +-- > intersperse a empty = empty +-- > intersperse a (singleton x) = singleton x +-- > intersperse a (fromList [x,y]) = fromList [x,a,y] +-- > intersperse a (fromList [x,y,z]) = fromList [x,a,y,a,z] +intersperse :: a -> Seq a -> Seq a +intersperse y xs = drop 1 $ xs <**> (const y <| singleton id) instance MonadPlus Seq where mzero = empty diff --git a/changelog.md b/changelog.md index 1ee6eb5..cb686b3 100644 --- a/changelog.md +++ b/changelog.md @@ -13,6 +13,8 @@ * Derive `Generic` and `Generic1` for `Data.Tree.Tree`. + * Add `intersperse` for sequences. + ## 0.5.6.2 *Dec 2014* * Bundled with GHC 7.10.1. diff --git a/tests/seq-properties.hs b/tests/seq-properties.hs index 64c84fe..f9fb071 100644 --- a/tests/seq-properties.hs +++ b/tests/seq-properties.hs @@ -98,6 +98,7 @@ main = defaultMain , testProperty "zipWith4" prop_zipWith4 , testProperty "<*>" prop_ap , testProperty "*>" prop_then + , testProperty "intersperse" prop_intersperse , testProperty ">>=" prop_bind ] @@ -609,6 +610,10 @@ prop_then :: Seq A -> Seq B -> Bool prop_then xs ys = toList' (xs *> ys) ~= (toList xs *> toList ys) +prop_intersperse :: A -> Seq A -> Bool +prop_intersperse x xs = + toList' (intersperse x xs) ~= Data.List.intersperse x (toList xs) + -- Monad operations prop_bind :: Seq A -> Fun A (Seq B) -> Bool From git at git.haskell.org Mon Apr 17 21:39:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:39:57 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #121 from treeowl/intersperse (c22ce14) Message-ID: <20170417213957.7462B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/c22ce14d9af8e693f5951016c2b326be9b86a103 >--------------------------------------------------------------- commit c22ce14d9af8e693f5951016c2b326be9b86a103 Merge: d62482a 2e6f6de Author: David Feuer Date: Fri Apr 22 03:07:40 2016 -0400 Merge pull request #121 from treeowl/intersperse Add intersperse for sequences >--------------------------------------------------------------- c22ce14d9af8e693f5951016c2b326be9b86a103 Data/Sequence.hs | 10 +++++++++- changelog.md | 2 ++ tests/seq-properties.hs | 5 +++++ 3 files changed, 16 insertions(+), 1 deletion(-) From git at git.haskell.org Mon Apr 17 21:39:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:39:59 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394: Use bang patterns for Data.Sequence; unbox (ab9562e) Message-ID: <20170417213959.7FC093A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/ab9562e569c542135a9c7263c99e7ebae9761f45 >--------------------------------------------------------------- commit ab9562e569c542135a9c7263c99e7ebae9761f45 Author: David Feuer Date: Sun Apr 24 19:43:50 2016 -0400 Use bang patterns for Data.Sequence; unbox Use `BangPatterns` to reduce clutter in `Data.Sequence`. When partially applying a `Deep`, `Node2`, or `Node3` constructor in `traverse`, `traverseWithIndex`, and `applicativeTree`, avoid boxing up the size argument. >--------------------------------------------------------------- ab9562e569c542135a9c7263c99e7ebae9761f45 Data/Sequence.hs | 188 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 104 insertions(+), 84 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc ab9562e569c542135a9c7263c99e7ebae9761f45 From git at git.haskell.org Mon Apr 17 21:40:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:40:01 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Add benchmarks (daa37c8) Message-ID: <20170417214001.86F5A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/daa37c845b19c7e23cf6daec2910c75e20890b88 >--------------------------------------------------------------- commit daa37c845b19c7e23cf6daec2910c75e20890b88 Author: David Feuer Date: Mon Apr 25 00:11:42 2016 -0400 Add benchmarks Add replicateA, traverse, and traverseWithIndex benchmarks. >--------------------------------------------------------------- daa37c845b19c7e23cf6daec2910c75e20890b88 benchmarks/Sequence.hs | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/benchmarks/Sequence.hs b/benchmarks/Sequence.hs index bfb3c2d..ec2e95c 100644 --- a/benchmarks/Sequence.hs +++ b/benchmarks/Sequence.hs @@ -4,10 +4,12 @@ module Main where import Control.Applicative import Control.DeepSeq import Control.Exception (evaluate) +import Control.Monad.Trans.State.Strict import Criterion.Main import Data.List (foldl') import qualified Data.Sequence as S import qualified Data.Foldable +import Data.Traversable (traverse) import System.Random main = do @@ -34,6 +36,21 @@ main = do , bench "100" $ nf (shuffle r100) s100 , bench "1000" $ nf (shuffle r1000) s1000 ] + , bgroup "traverseWithIndex/State" + [ bench "10" $ nf multiplyDown s10 + , bench "100" $ nf multiplyDown s100 + , bench "1000" $ nf multiplyDown s1000 + ] + , bgroup "traverse/State" + [ bench "10" $ nf multiplyUp s10 + , bench "100" $ nf multiplyUp s100 + , bench "1000" $ nf multiplyUp s1000 + ] + , bgroup "replicateA/State" + [ bench "10" $ nf stateReplicate 10 + , bench "100" $ nf stateReplicate 100 + , bench "1000" $ nf stateReplicate 1000 + ] , bgroup "zip" [ bench "ix10000/5000" $ nf (\(xs,ys) -> S.zip xs ys `S.index` 5000) (s10000, u10000) , bench "nf100" $ nf (uncurry S.zip) (s100, u100) @@ -76,3 +93,23 @@ shuffle :: [Int] -> S.Seq Int -> Int shuffle ps s = case S.viewl (S.drop (S.length s `div` 2) (foldl' cut s ps)) of x S.:< _ -> x where cut xs p = let (front, back) = S.splitAt p xs in back S.>< front + +stateReplicate :: Int -> S.Seq Char +stateReplicate n = flip evalState 0 . S.replicateA n $ do + old <- get + if old > (10 :: Int) then put 0 else put (old + 1) + return $ toEnum old + +multiplyUp :: S.Seq Int -> S.Seq Int +multiplyUp = flip evalState 0 . traverse go where + go x = do + s <- get + put (s + 1) + return (s * x) + +multiplyDown :: S.Seq Int -> S.Seq Int +multiplyDown = flip evalState 0 . S.traverseWithIndex go where + go i x = do + s <- get + put (s - 1) + return (s * i * x) From git at git.haskell.org Mon Apr 17 21:40:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:40:03 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #202 from treeowl/bang-sequences (89069ae) Message-ID: <20170417214003.90FBE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/89069ae3754f1571115e684ad6d5ea94fa890b7b >--------------------------------------------------------------- commit 89069ae3754f1571115e684ad6d5ea94fa890b7b Merge: c22ce14 daa37c8 Author: David Feuer Date: Mon Apr 25 00:31:16 2016 -0400 Merge pull request #202 from treeowl/bang-sequences Use bang patterns for Data.Sequence; avoid boxing >--------------------------------------------------------------- 89069ae3754f1571115e684ad6d5ea94fa890b7b Data/Sequence.hs | 188 +++++++++++++++++++++++++++---------------------- benchmarks/Sequence.hs | 37 ++++++++++ 2 files changed, 141 insertions(+), 84 deletions(-) From git at git.haskell.org Mon Apr 17 21:40:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:40:05 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Fix silly changelog mistake (d1b4d61) Message-ID: <20170417214005.98F703A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/d1b4d61283f2d32aca1d5104229192073fabd8c8 >--------------------------------------------------------------- commit d1b4d61283f2d32aca1d5104229192073fabd8c8 Author: David Feuer Date: Mon Apr 25 08:22:37 2016 -0400 Fix silly changelog mistake >--------------------------------------------------------------- d1b4d61283f2d32aca1d5104229192073fabd8c8 changelog.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/changelog.md b/changelog.md index cb686b3..d43b842 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,13 @@ # Changelog for [`containers` package](http://github.com/haskell/containers) +## 0.5.8.1 + + * Add `Empty`, `:<|`, and `:|>` pattern synonyms for `Seq`. + + * Derive `Generic` and `Generic1` for `Data.Tree.Tree`. + + * Add `intersperse` for sequences. + ## 0.5.7.1 *Dec 2015* * Planned to bundle with GHC 8.0.1. @@ -9,12 +17,6 @@ * Define `Semigroup` instances for `Data.Map`, `Data.Set`, `Data.IntMap`, `Data.IntSet` and `Data.Sequence`. - * Add `Empty`, `:<|`, and `:|>` pattern synonyms for `Seq`. - - * Derive `Generic` and `Generic1` for `Data.Tree.Tree`. - - * Add `intersperse` for sequences. - ## 0.5.6.2 *Dec 2014* * Bundled with GHC 7.10.1. From git at git.haskell.org Mon Apr 17 21:40:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:40:07 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Add missing changelog info (66f440b) Message-ID: <20170417214007.A18DD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/66f440b3d465e4d2218586b5230bf3d766285996 >--------------------------------------------------------------- commit 66f440b3d465e4d2218586b5230bf3d766285996 Author: David Feuer Date: Mon Apr 25 08:26:25 2016 -0400 Add missing changelog info >--------------------------------------------------------------- 66f440b3d465e4d2218586b5230bf3d766285996 changelog.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/changelog.md b/changelog.md index d43b842..dc6f9a4 100644 --- a/changelog.md +++ b/changelog.md @@ -2,11 +2,13 @@ ## 0.5.8.1 - * Add `Empty`, `:<|`, and `:|>` pattern synonyms for `Seq`. + * Add `Empty`, `:<|`, and `:|>` pattern synonyms for `Data.Sequence`. - * Derive `Generic` and `Generic1` for `Data.Tree.Tree`. + * Add `intersperse` and `traverseWithIndex` for `Data.Sequence`. - * Add `intersperse` for sequences. + * Slightly optimize `replicateA` and `traverse` for `Data.Sequence`. + + * Derive `Generic` and `Generic1` for `Data.Tree`. ## 0.5.7.1 *Dec 2015* From git at git.haskell.org Mon Apr 17 21:40:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:40:09 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Use bang patterns to reduce clutter in Data.Map (b0aaa5a) Message-ID: <20170417214009.AD6413A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/b0aaa5a5422b7fcfb919888b5b6f0bb6fef6c64b >--------------------------------------------------------------- commit b0aaa5a5422b7fcfb919888b5b6f0bb6fef6c64b Author: David Feuer Date: Mon Apr 25 15:22:23 2016 -0400 Use bang patterns to reduce clutter in Data.Map >--------------------------------------------------------------- b0aaa5a5422b7fcfb919888b5b6f0bb6fef6c64b Data/Map/Base.hs | 123 +++++++++++++++++++---------------------------------- Data/Map/Strict.hs | 38 +++++++---------- 2 files changed, 59 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 b0aaa5a5422b7fcfb919888b5b6f0bb6fef6c64b From git at git.haskell.org Mon Apr 17 21:40:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:40:11 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #203 from treeowl/bang-map (6a2156f) Message-ID: <20170417214011.B5EE43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/6a2156f16dadd8e09043ffb0088d5ae3d4189557 >--------------------------------------------------------------- commit 6a2156f16dadd8e09043ffb0088d5ae3d4189557 Merge: 66f440b b0aaa5a Author: David Feuer Date: Mon Apr 25 16:17:47 2016 -0400 Merge pull request #203 from treeowl/bang-map Use bang patterns to reduce clutter in Data.Map >--------------------------------------------------------------- 6a2156f16dadd8e09043ffb0088d5ae3d4189557 Data/Map/Base.hs | 123 +++++++++++++++++++---------------------------------- Data/Map/Strict.hs | 38 +++++++---------- 2 files changed, 59 insertions(+), 102 deletions(-) From git at git.haskell.org Mon Apr 17 21:40:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:40:13 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Use bang patterns to reduce clutter in Data.Set (da05991) Message-ID: <20170417214013.BFC433A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/da05991366498ca2a617c24fe62b356f849d3331 >--------------------------------------------------------------- commit da05991366498ca2a617c24fe62b356f849d3331 Author: David Feuer Date: Mon Apr 25 16:25:05 2016 -0400 Use bang patterns to reduce clutter in Data.Set >--------------------------------------------------------------- da05991366498ca2a617c24fe62b356f849d3331 Data/Set/Base.hs | 79 ++++++++++++++++++++------------------------------------ 1 file changed, 28 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 da05991366498ca2a617c24fe62b356f849d3331 From git at git.haskell.org Mon Apr 17 21:40:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:40:15 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #204 from treeowl/bang-set (897504a) Message-ID: <20170417214015.C7FBC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/897504ad112b5968df61d461fc7e23056529cef5 >--------------------------------------------------------------- commit 897504ad112b5968df61d461fc7e23056529cef5 Merge: 6a2156f da05991 Author: David Feuer Date: Mon Apr 25 20:24:30 2016 -0400 Merge pull request #204 from treeowl/bang-set Use bang patterns to reduce clutter in Data.Set >--------------------------------------------------------------- 897504ad112b5968df61d461fc7e23056529cef5 Data/Set/Base.hs | 79 ++++++++++++++++++++------------------------------------ 1 file changed, 28 insertions(+), 51 deletions(-) From git at git.haskell.org Mon Apr 17 21:40:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:40:17 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Use BangPatterns to reduce clutter in Data.IntMap (a65e1da) Message-ID: <20170417214017.D3C153A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/a65e1da2ece7660e73e36cbdc439aafa04bd86a0 >--------------------------------------------------------------- commit a65e1da2ece7660e73e36cbdc439aafa04bd86a0 Author: David Feuer Date: Mon Apr 25 20:41:01 2016 -0400 Use BangPatterns to reduce clutter in Data.IntMap >--------------------------------------------------------------- a65e1da2ece7660e73e36cbdc439aafa04bd86a0 Data/IntMap/Base.hs | 79 +++++++++++++++++++++++---------------------------- Data/IntMap/Strict.hs | 57 +++++++++++++++++++------------------ 2 files changed, 65 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 a65e1da2ece7660e73e36cbdc439aafa04bd86a0 From git at git.haskell.org Mon Apr 17 21:40:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:40:19 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #205 from treeowl/bang-intmap (f17ee69) Message-ID: <20170417214019.DC4C33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/f17ee69186bdde3f73b06e21f862f28157cfeb26 >--------------------------------------------------------------- commit f17ee69186bdde3f73b06e21f862f28157cfeb26 Merge: 897504a a65e1da Author: David Feuer Date: Mon Apr 25 23:43:14 2016 -0400 Merge pull request #205 from treeowl/bang-intmap Use BangPatterns to reduce clutter in Data.IntMap >--------------------------------------------------------------- f17ee69186bdde3f73b06e21f862f28157cfeb26 Data/IntMap/Base.hs | 79 +++++++++++++++++++++++---------------------------- Data/IntMap/Strict.hs | 57 +++++++++++++++++++------------------ 2 files changed, 65 insertions(+), 71 deletions(-) From git at git.haskell.org Mon Apr 17 21:40:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:40:21 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Use BangPatterns to clean up Data.IntSet (b58271b) Message-ID: <20170417214021.E63CB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/b58271b885a850e6790257d64fdc994ebdfbf4b9 >--------------------------------------------------------------- commit b58271b885a850e6790257d64fdc994ebdfbf4b9 Author: David Feuer Date: Tue Apr 26 00:43:54 2016 -0400 Use BangPatterns to clean up Data.IntSet Also remove some `case` expressions in favor of argument patterns. Remove strictness CPP macros from `containers.h`. >--------------------------------------------------------------- b58271b885a850e6790257d64fdc994ebdfbf4b9 Data/IntSet/Base.hs | 160 +++++++++++++++++++++++---------------------------- include/containers.h | 13 ----- 2 files changed, 72 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 b58271b885a850e6790257d64fdc994ebdfbf4b9 From git at git.haskell.org Mon Apr 17 21:40:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:40:23 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Replace some case exprs with argument patterns (fdea40a) Message-ID: <20170417214023.F03443A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/fdea40a268ef0ae25f3fd2f4195928884aa93f8e >--------------------------------------------------------------- commit fdea40a268ef0ae25f3fd2f4195928884aa93f8e Author: David Feuer Date: Tue Apr 26 01:14:09 2016 -0400 Replace some case exprs with argument patterns >--------------------------------------------------------------- fdea40a268ef0ae25f3fd2f4195928884aa93f8e Data/IntMap/Base.hs | 154 +++++++++++++++++++++++----------------------------- 1 file changed, 69 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 fdea40a268ef0ae25f3fd2f4195928884aa93f8e From git at git.haskell.org Mon Apr 17 21:40:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:40:26 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #206 from treeowl/bang-intset (a95429d) Message-ID: <20170417214026.04CDA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/a95429dd435c8ee3744bd0483a5ae3f7e2c678d2 >--------------------------------------------------------------- commit a95429dd435c8ee3744bd0483a5ae3f7e2c678d2 Merge: f17ee69 b58271b Author: David Feuer Date: Tue Apr 26 01:42:14 2016 -0400 Merge pull request #206 from treeowl/bang-intset Use BangPatterns to clean up Data.IntSet >--------------------------------------------------------------- a95429dd435c8ee3744bd0483a5ae3f7e2c678d2 Data/IntSet/Base.hs | 160 +++++++++++++++++++++++---------------------------- include/containers.h | 13 ----- 2 files changed, 72 insertions(+), 101 deletions(-) From git at git.haskell.org Mon Apr 17 21:40:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:40:28 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #207 from treeowl/uncase-intmap (0f6ce1b) Message-ID: <20170417214028.0CE323A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/0f6ce1bd45b545e7aeae25a808df393f77be4694 >--------------------------------------------------------------- commit 0f6ce1bd45b545e7aeae25a808df393f77be4694 Merge: a95429d fdea40a Author: David Feuer Date: Tue Apr 26 01:42:54 2016 -0400 Merge pull request #207 from treeowl/uncase-intmap Replace some case exprs with argument patterns >--------------------------------------------------------------- 0f6ce1bd45b545e7aeae25a808df393f77be4694 Data/IntMap/Base.hs | 154 +++++++++++++++++++++++----------------------------- 1 file changed, 69 insertions(+), 85 deletions(-) From git at git.haskell.org Mon Apr 17 21:40:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:40:30 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Remove all support for nhc98 and GHC <7 (8723301) Message-ID: <20170417214030.19F273A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/8723301c6141905d70a2c1be90dd72ca87272efe >--------------------------------------------------------------- commit 8723301c6141905d70a2c1be90dd72ca87272efe Author: David Feuer Date: Tue Apr 26 02:01:49 2016 -0400 Remove all support for nhc98 and GHC <7 We no longer make any effort whatsoever to support any version of nhc98 or any version of GHC before 7.0. We cannot properly support implementations our continuous integration does not test, and these ones are fairly rare. Bump version number >--------------------------------------------------------------- 8723301c6141905d70a2c1be90dd72ca87272efe Data/Map.hs | 6 +-- Data/Map/Base.hs | 116 ++++++++++++++++++++++++++--------------------------- Data/Map/Strict.hs | 50 +++++++++++------------ Data/Set/Base.hs | 60 +++++++++++++-------------- Data/Tree.hs | 2 - changelog.md | 6 +++ containers.cabal | 41 +++++++++---------- 7 files changed, 140 insertions(+), 141 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 8723301c6141905d70a2c1be90dd72ca87272efe From git at git.haskell.org Mon Apr 17 21:40:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:40:32 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #208 from treeowl/dump-ancient-impls (8b0bc01) Message-ID: <20170417214032.242333A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/8b0bc012604dd067af4781238ec4d74a0a75bafa >--------------------------------------------------------------- commit 8b0bc012604dd067af4781238ec4d74a0a75bafa Merge: 0f6ce1b 8723301 Author: David Feuer Date: Tue Apr 26 11:35:14 2016 -0400 Merge pull request #208 from treeowl/dump-ancient-impls Remove all support for nhc98 and GHC <7 >--------------------------------------------------------------- 8b0bc012604dd067af4781238ec4d74a0a75bafa Data/Map.hs | 6 +-- Data/Map/Base.hs | 116 ++++++++++++++++++++++++++--------------------------- Data/Map/Strict.hs | 50 +++++++++++------------ Data/Set/Base.hs | 60 +++++++++++++-------------- Data/Tree.hs | 2 - changelog.md | 6 +++ containers.cabal | 41 +++++++++---------- 7 files changed, 140 insertions(+), 141 deletions(-) From git at git.haskell.org Mon Apr 17 21:40:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:40:34 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Clean up traverseWithIndex (2202cc3) Message-ID: <20170417214034.2F7413A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/2202cc3f43f2562ebf9cd91808910d076293920e >--------------------------------------------------------------- commit 2202cc3f43f2562ebf9cd91808910d076293920e Author: David Feuer Date: Tue Apr 26 14:42:01 2016 -0400 Clean up traverseWithIndex Instead of copying the code over, use polymorphic `traverseWithIndexDigit` and `traverseWithIndexNode`, inlined, to implement `traverseWithIndexDigitE`, etc. This gives us the desired specialization with less source code. >--------------------------------------------------------------- 2202cc3f43f2562ebf9cd91808910d076293920e Data/Sequence.hs | 49 +++++++++++++++++++------------------------------ 1 file changed, 19 insertions(+), 30 deletions(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index e6a8dda..388bc46 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -1758,7 +1758,8 @@ traverseWithIndex f' (Seq xs') = Seq <$> traverseWithIndexTreeE (\s (Elem a) -> where -- We have to specialize these functions by hand, unfortunately, because -- GHC does not specialize until *all* instances are determined. --- If we tried to used the Sized trick, it would likely leak to runtime. +-- Although the Sized instance is known at compile time, the Applicative +-- instance generally is not. traverseWithIndexTreeE :: Applicative f => (Int -> Elem a -> f b) -> Int -> FingerTree (Elem a) -> f (FingerTree b) traverseWithIndexTreeE _ !_s EmptyT = pure EmptyT traverseWithIndexTreeE f s (Single xs) = Single <$> f s xs @@ -1784,33 +1785,23 @@ traverseWithIndex f' (Seq xs') = Seq <$> traverseWithIndexTreeE (\s (Elem a) -> !sPsprm = s + n - size sf traverseWithIndexDigitE :: Applicative f => (Int -> Elem a -> f b) -> Int -> Digit (Elem a) -> f (Digit b) - traverseWithIndexDigitE f !s (One a) = One <$> f s a - traverseWithIndexDigitE f s (Two a b) = Two <$> f s a <*> f sPsa b - where - !sPsa = s + size a - traverseWithIndexDigitE f s (Three a b c) = - Three <$> f s a <*> f sPsa b <*> f sPsab c - where - !sPsa = s + size a - !sPsab = sPsa + size b - traverseWithIndexDigitE f s (Four a b c d) = - Four <$> f s a <*> f sPsa b <*> f sPsab c <*> f sPsabc d - where - !sPsa = s + size a - !sPsab = sPsa + size b - !sPsabc = sPsab + size c + traverseWithIndexDigitE f i t = traverseWithIndexDigit f i t traverseWithIndexDigitN :: Applicative f => (Int -> Node a -> f b) -> Int -> Digit (Node a) -> f (Digit b) - traverseWithIndexDigitN f !s (One a) = One <$> f s a - traverseWithIndexDigitN f s (Two a b) = Two <$> f s a <*> f sPsa b + traverseWithIndexDigitN f i t = traverseWithIndexDigit f i t + + {-# INLINE traverseWithIndexDigit #-} + traverseWithIndexDigit :: (Applicative f, Sized a) => (Int -> a -> f b) -> Int -> Digit a -> f (Digit b) + traverseWithIndexDigit f !s (One a) = One <$> f s a + traverseWithIndexDigit f s (Two a b) = Two <$> f s a <*> f sPsa b where !sPsa = s + size a - traverseWithIndexDigitN f s (Three a b c) = + traverseWithIndexDigit f s (Three a b c) = Three <$> f s a <*> f sPsa b <*> f sPsab c where !sPsa = s + size a !sPsab = sPsa + size b - traverseWithIndexDigitN f s (Four a b c d) = + traverseWithIndexDigit f s (Four a b c d) = Four <$> f s a <*> f sPsa b <*> f sPsab c <*> f sPsabc d where !sPsa = s + size a @@ -1818,25 +1809,23 @@ traverseWithIndex f' (Seq xs') = Seq <$> traverseWithIndexTreeE (\s (Elem a) -> !sPsabc = sPsab + size c traverseWithIndexNodeE :: Applicative f => (Int -> Elem a -> f b) -> Int -> Node (Elem a) -> f (Node b) - traverseWithIndexNodeE f !s (Node2 ns a b) = node2' ns <$> f s a <*> f sPsa b - where - !sPsa = s + size a - traverseWithIndexNodeE f s (Node3 ns a b c) = - node3' ns <$> f s a <*> f sPsa b <*> f sPsab c - where - !sPsa = s + size a - !sPsab = sPsa + size b + traverseWithIndexNodeE f i t = traverseWithIndexNode f i t traverseWithIndexNodeN :: Applicative f => (Int -> Node a -> f b) -> Int -> Node (Node a) -> f (Node b) - traverseWithIndexNodeN f !s (Node2 ns a b) = node2' ns <$> f s a <*> f sPsa b + traverseWithIndexNodeN f i t = traverseWithIndexNode f i t + + {-# INLINE traverseWithIndexNode #-} + traverseWithIndexNode :: (Applicative f, Sized a) => (Int -> a -> f b) -> Int -> Node a -> f (Node b) + traverseWithIndexNode f !s (Node2 ns a b) = node2' ns <$> f s a <*> f sPsa b where !sPsa = s + size a - traverseWithIndexNodeN f s (Node3 ns a b c) = + traverseWithIndexNode f s (Node3 ns a b c) = node3' ns <$> f s a <*> f sPsa b <*> f sPsab c where !sPsa = s + size a !sPsab = sPsa + size b + {-# NOINLINE [1] traverseWithIndex #-} #ifdef __GLASGOW_HASKELL__ {-# RULES From git at git.haskell.org Mon Apr 17 21:40:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:40:36 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #212 from treeowl/clean-twi (d0ad235) Message-ID: <20170417214036.37F323A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/d0ad23555326ff02342fdbbaad45b071e81b58c3 >--------------------------------------------------------------- commit d0ad23555326ff02342fdbbaad45b071e81b58c3 Merge: 8b0bc01 2202cc3 Author: David Feuer Date: Tue Apr 26 15:17:37 2016 -0400 Merge pull request #212 from treeowl/clean-twi Clean up traverseWithIndex >--------------------------------------------------------------- d0ad23555326ff02342fdbbaad45b071e81b58c3 Data/Sequence.hs | 49 +++++++++++++++++++------------------------------ 1 file changed, 19 insertions(+), 30 deletions(-) From git at git.haskell.org Mon Apr 17 21:40:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:40:38 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Speed up adjust and adjustWithKey (2988826) Message-ID: <20170417214038.420623A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/2988826ffd37bb69fb02061ce7981c9482a8ccbb >--------------------------------------------------------------- commit 2988826ffd37bb69fb02061ce7981c9482a8ccbb Author: David Feuer Date: Mon May 2 13:07:19 2016 -0400 Speed up adjust and adjustWithKey Previously, `adjustWithKey` was implemented using `updateWithKey`. `updateWithKey` needs to rebalance as it builds the result tree. `adjustWithKey` never changes the shape of the tree, so rebalancing on the way up is a waste of time. >--------------------------------------------------------------- 2988826ffd37bb69fb02061ce7981c9482a8ccbb Data/Map/Base.hs | 10 +++++++++- Data/Map/Strict.hs | 11 ++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Data/Map/Base.hs b/Data/Map/Base.hs index 6401c0c..789b4a7 100644 --- a/Data/Map/Base.hs +++ b/Data/Map/Base.hs @@ -810,7 +810,15 @@ adjust f = adjustWithKey (\_ x -> f x) -- > adjustWithKey f 7 empty == empty adjustWithKey :: Ord k => (k -> a -> a) -> k -> Map k a -> Map k a -adjustWithKey f = updateWithKey (\k' x' -> Just (f k' x')) +adjustWithKey = go + where + go :: Ord k => (k -> a -> a) -> k -> Map k a -> Map k a + go _ !_ Tip = Tip + go f k (Bin sx kx x l r) = + case compare k kx of + LT -> Bin sx kx x (go f k l) r + GT -> Bin sx kx x l (go f k r) + EQ -> Bin sx kx (f kx x) l r #if __GLASGOW_HASKELL__ {-# INLINABLE adjustWithKey #-} #else diff --git a/Data/Map/Strict.hs b/Data/Map/Strict.hs index c061cab..7b82e2e 100644 --- a/Data/Map/Strict.hs +++ b/Data/Map/Strict.hs @@ -488,7 +488,16 @@ adjust f = adjustWithKey (\_ x -> f x) -- > adjustWithKey f 7 empty == empty adjustWithKey :: Ord k => (k -> a -> a) -> k -> Map k a -> Map k a -adjustWithKey f = updateWithKey (\k' x' -> Just (f k' x')) +adjustWithKey = go + where + go :: Ord k => (k -> a -> a) -> k -> Map k a -> Map k a + go _ !_ Tip = Tip + go f k (Bin sx kx x l r) = + case compare k kx of + LT -> Bin sx kx x (go f k l) r + GT -> Bin sx kx x l (go f k r) + EQ -> Bin sx kx x' l r + where !x' = f kx x #if __GLASGOW_HASKELL__ {-# INLINABLE adjustWithKey #-} #else From git at git.haskell.org Mon Apr 17 21:40:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:40:40 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #213 from treeowl/adjust-maps-faster (cefe44a) Message-ID: <20170417214040.4A9FD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/cefe44a536cd0c7fa300bd78e37ee1b518aa252f >--------------------------------------------------------------- commit cefe44a536cd0c7fa300bd78e37ee1b518aa252f Merge: d0ad235 2988826 Author: David Feuer Date: Mon May 2 13:53:23 2016 -0400 Merge pull request #213 from treeowl/adjust-maps-faster Speed up adjust and adjustWithKey >--------------------------------------------------------------- cefe44a536cd0c7fa300bd78e37ee1b518aa252f Data/Map/Base.hs | 10 +++++++++- Data/Map/Strict.hs | 11 ++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) From git at git.haskell.org Mon Apr 17 21:40:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:40:42 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Speed up IntMap (51e7b00) Message-ID: <20170417214042.555033A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/51e7b00716a7ae090094d59afa4a58dfac4b26ef >--------------------------------------------------------------- commit 51e7b00716a7ae090094d59afa4a58dfac4b26ef Author: David Feuer Date: Sat May 7 20:54:24 2016 -0400 Speed up IntMap `delete`, `alter`, `update`, etc., used a `bin` smart constructor to avoid installing any non-root `Nil`s. Now only the ones that could have become `Nil` are checked, which is a good bit cheaper since they're in cache. `adjustWithKey` was implemented using `updateWithKey`, but in fact it never needs to worry about `Nil`s, so implementing it directly eliminates all such checks. Make `updateLookupWithKey` in `Data.IntMap.Lazy` strict in its recursive call to avoid essentially useless lazy pair allocation. >--------------------------------------------------------------- 51e7b00716a7ae090094d59afa4a58dfac4b26ef Data/IntMap/Base.hs | 56 ++++++++++++++++++++++++++++++++++----------------- Data/IntMap/Strict.hs | 32 ++++++++++++++++++----------- 2 files changed, 58 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 51e7b00716a7ae090094d59afa4a58dfac4b26ef From git at git.haskell.org Mon Apr 17 21:40:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:40:44 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #219 from treeowl/intmap-binbetter (0abcf6f) Message-ID: <20170417214044.5DA173A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/0abcf6faa0b685d6bf449dbb68ce130be2fcd3a5 >--------------------------------------------------------------- commit 0abcf6faa0b685d6bf449dbb68ce130be2fcd3a5 Merge: cefe44a 51e7b00 Author: David Feuer Date: Sun May 8 15:46:55 2016 -0400 Merge pull request #219 from treeowl/intmap-binbetter Speed up IntMap >--------------------------------------------------------------- 0abcf6faa0b685d6bf449dbb68ce130be2fcd3a5 Data/IntMap/Base.hs | 56 ++++++++++++++++++++++++++++++++++----------------- Data/IntMap/Strict.hs | 32 ++++++++++++++++++----------- 2 files changed, 58 insertions(+), 30 deletions(-) From git at git.haskell.org Mon Apr 17 21:40:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:40:46 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: add a catamorphism on Trees (ce4435b) Message-ID: <20170417214046.6579B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/ce4435be2207942cf1d8419d1a014b1a56a5a4a4 >--------------------------------------------------------------- commit ce4435be2207942cf1d8419d1a014b1a56a5a4a4 Author: Daniel Wagner Date: Tue May 17 10:21:07 2016 -0700 add a catamorphism on Trees >--------------------------------------------------------------- ce4435be2207942cf1d8419d1a014b1a56a5a4a4 Data/Tree.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Data/Tree.hs b/Data/Tree.hs index 4cd05a5..c35d0ed 100644 --- a/Data/Tree.hs +++ b/Data/Tree.hs @@ -30,7 +30,7 @@ module Data.Tree( -- * Two-dimensional drawing drawTree, drawForest, -- * Extraction - flatten, levels, + flatten, levels, foldTree, -- * Building trees unfoldTree, unfoldForest, unfoldTreeM, unfoldForestM, @@ -156,6 +156,11 @@ levels t = takeWhile (not . null) $ iterate (concatMap subForest) [t] +-- | Catamorphism on trees. +foldTree :: (a -> [b] -> b) -> Tree a -> b +foldTree f = go where + go (Node x ts) = f x (map go ts) + -- | Build a tree from a seed value unfoldTree :: (b -> (a, [b])) -> b -> Tree a unfoldTree f b = let (a, bs) = f b in Node a (unfoldForest f bs) From git at git.haskell.org Mon Apr 17 21:40:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:40:48 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #232 from dmwit/master (1fe5358) Message-ID: <20170417214048.6E44F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/1fe53588e47e48a59e2f0990a177af0bffebcf31 >--------------------------------------------------------------- commit 1fe53588e47e48a59e2f0990a177af0bffebcf31 Merge: 0abcf6f ce4435b Author: David Feuer Date: Wed May 18 15:24:30 2016 -0400 Merge pull request #232 from dmwit/master Add a catamorphism on Trees >--------------------------------------------------------------- 1fe53588e47e48a59e2f0990a177af0bffebcf31 Data/Tree.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) From git at git.haskell.org Mon Apr 17 21:40:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:40:50 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Implement lens-compatible `at` function (73ba96a) Message-ID: <20170417214050.7BF293A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/73ba96ade09b2e1720d529566c7bf834cd54853c >--------------------------------------------------------------- commit 73ba96ade09b2e1720d529566c7bf834cd54853c Author: Phil Ruffwind Date: Sun Mar 27 20:49:35 2016 -0400 Implement lens-compatible `at` function Akin to `alter` but allows an arbitrary Functor. Add benchmarks for `at` Add tests for `at` Add `at` from Lens to benchmarks for comparison >--------------------------------------------------------------- 73ba96ade09b2e1720d529566c7bf834cd54853c Data/Map/Base.hs | 22 ++++++++++++++++++++++ Data/Map/Lazy.hs | 1 + Data/Map/Strict.hs | 1 + benchmarks/Map.hs | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ containers.cabal | 4 ++++ tests/map-properties.hs | 25 +++++++++++++++++++++++++ 6 files changed, 102 insertions(+) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 73ba96ade09b2e1720d529566c7bf834cd54853c From git at git.haskell.org Mon Apr 17 21:40:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:40:52 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Add `alterF` for Data.Map (7d03d76) Message-ID: <20170417214052.8E2333A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/7d03d76b7647dc731da2e75dcdd45f6c2e667682 >--------------------------------------------------------------- commit 7d03d76b7647dc731da2e75dcdd45f6c2e667682 Author: David Feuer Date: Mon May 2 14:29:36 2016 -0400 Add `alterF` for Data.Map Use a bit queue to implement `alterF` for `Data.Map`. This is fairly competitive with the simple implementation in `Control.Lens.At` even with `Int` keys. For keys that are more expensive to compare, it should be substantially better. In case of extremely large maps that would overflow the bit queue, this falls back to a slower, Yoneda-based, implementation. This code is disabled when the word size is at least 61, as maps with nearly a quadrillion entries seem somewhat unlikely. Add rules to specialize to `Const` and `Identity` functors. Add QuickCheck properties to supplement the unit tests, including ones that should trigger the rewrite rules and ones that should not. Remove some more pre-7.0 junk. >--------------------------------------------------------------- 7d03d76b7647dc731da2e75dcdd45f6c2e667682 .gitignore | 5 + Data/Map/Base.hs | 308 ++++++++++++++++++++++++++++++++++++++++--- Data/Map/Lazy.hs | 2 +- Data/Map/Strict.hs | 72 +++++++++- Data/Sequence.hs | 6 +- Data/Utils/BitQueue.hs | 130 ++++++++++++++++++ Data/Utils/BitUtil.hs | 19 ++- benchmarks/Map.hs | 108 ++++++++------- changelog.md | 8 +- containers.cabal | 38 +++--- tests/bitqueue-properties.hs | 33 +++++ tests/map-properties.hs | 46 ++++++- 12 files changed, 684 insertions(+), 91 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 7d03d76b7647dc731da2e75dcdd45f6c2e667682 From git at git.haskell.org Mon Apr 17 21:40:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:40:54 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #234 from treeowl/alterF (ced8e95) Message-ID: <20170417214054.9A3BD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/ced8e956eee254494831e61faead78733d3507c9 >--------------------------------------------------------------- commit ced8e956eee254494831e61faead78733d3507c9 Merge: 1fe5358 7d03d76 Author: David Feuer Date: Wed May 18 19:12:57 2016 -0400 Merge pull request #234 from treeowl/alterF Add alterF to Data.Map >--------------------------------------------------------------- ced8e956eee254494831e61faead78733d3507c9 .gitignore | 5 + Data/Map/Base.hs | 296 ++++++++++++++++++++++++++++++++++++++++++- Data/Map/Lazy.hs | 1 + Data/Map/Strict.hs | 71 +++++++++++ Data/Sequence.hs | 6 +- Data/Utils/BitQueue.hs | 130 +++++++++++++++++++ Data/Utils/BitUtil.hs | 19 ++- benchmarks/Map.hs | 77 ++++++++++- changelog.md | 8 +- containers.cabal | 36 ++++-- tests/bitqueue-properties.hs | 33 +++++ tests/map-properties.hs | 67 ++++++++++ 12 files changed, 722 insertions(+), 27 deletions(-) From git at git.haskell.org Mon Apr 17 21:40:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:40:56 +0000 (UTC) Subject: [commit: packages/containers] changelog-foldtree, cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Update changelog.md (5b9dad5) Message-ID: <20170417214056.A1ECC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: changelog-foldtree,cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/5b9dad54dbef5fde80c62b36d1ddf68f6a1843d5 >--------------------------------------------------------------- commit 5b9dad54dbef5fde80c62b36d1ddf68f6a1843d5 Author: David Feuer Date: Wed May 18 19:25:50 2016 -0400 Update changelog.md >--------------------------------------------------------------- 5b9dad54dbef5fde80c62b36d1ddf68f6a1843d5 changelog.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/changelog.md b/changelog.md index 9a7f28c..9e83fee 100644 --- a/changelog.md +++ b/changelog.md @@ -16,6 +16,8 @@ * Derive `Generic` and `Generic1` for `Data.Tree`. + * Add `foldTree` for `Data.Tree`. + * Slightly optimize `replicateA` and `traverse` for `Data.Sequence`. * Speed up `adjust` for `Data.Map`. From git at git.haskell.org Mon Apr 17 21:40:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:40:58 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #235 from haskell/changelog-foldtree (56f290c) Message-ID: <20170417214058.AADDE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/56f290cf92d93fd4a872213f99344f8930805337 >--------------------------------------------------------------- commit 56f290cf92d93fd4a872213f99344f8930805337 Merge: ced8e95 5b9dad5 Author: David Feuer Date: Wed May 18 19:30:12 2016 -0400 Merge pull request #235 from haskell/changelog-foldtree Update changelog.md >--------------------------------------------------------------- 56f290cf92d93fd4a872213f99344f8930805337 changelog.md | 2 ++ 1 file changed, 2 insertions(+) From git at git.haskell.org Mon Apr 17 21:41:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:41:00 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Remove a bunch of unnecessary laziness (164ea00) Message-ID: <20170417214100.B3CE13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/164ea0054e9ada397f698b782fd9084a93e5a4f9 >--------------------------------------------------------------- commit 164ea0054e9ada397f698b782fd9084a93e5a4f9 Author: David Feuer Date: Thu May 12 18:20:18 2016 -0400 Remove a bunch of unnecessary laziness Lots of functions in `Data.Map.Base` used lazy pairs and such for no obviously good reason. As a result, they sometimes did strange things like building up chains of suspensions to rebuild trees. >--------------------------------------------------------------- 164ea0054e9ada397f698b782fd9084a93e5a4f9 Data/Map/Base.hs | 42 +++++++++++++++++++++++++++--------------- changelog.md | 2 ++ 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/Data/Map/Base.hs b/Data/Map/Base.hs index fb4b08d..92ecda0 100644 --- a/Data/Map/Base.hs +++ b/Data/Map/Base.hs @@ -772,10 +772,12 @@ insertLookupWithKey = go go _ !kx x Tip = (Nothing, singleton kx x) go f kx x (Bin sy ky y l r) = case compare kx ky of - LT -> let (found, l') = go f kx x l - in (found, balanceL ky y l' r) - GT -> let (found, r') = go f kx x r - in (found, balanceR ky y l r') + LT -> let !(found, l') = go f kx x l + !t' = balanceL ky y l' r + in (found, t') + GT -> let !(found, r') = go f kx x r + !t' = balanceR ky y l r' + in (found, t') EQ -> (Just y, Bin sy kx (f kx x y) l r) #if __GLASGOW_HASKELL__ {-# INLINABLE insertLookupWithKey #-} @@ -913,11 +915,16 @@ updateLookupWithKey = go go _ !_ Tip = (Nothing,Tip) go f k (Bin sx kx x l r) = case compare k kx of - LT -> let (found,l') = go f k l in (found,balanceR kx x l' r) - GT -> let (found,r') = go f k r in (found,balanceL kx x l r') + LT -> let !(found,l') = go f k l + !t' = balanceR kx x l' r + in (found, t') + GT -> let !(found,r') = go f k r + !t' = balanceL kx x l r' + in (found, t') EQ -> case f kx x of - Just x' -> (Just x',Bin sx kx x' l r) - Nothing -> (Just x,glue l r) + Just x' -> (Just x', Bin sx kx x' l r) + Nothing -> let !glued = glue l r + in (Just x, glued) #if __GLASGOW_HASKELL__ {-# INLINABLE updateLookupWithKey #-} #else @@ -1429,7 +1436,7 @@ updateMaxWithKey f (Bin _ kx x l r) = balanceL kx x l (updateMaxWithKey f r) minViewWithKey :: Map k a -> Maybe ((k,a), Map k a) minViewWithKey Tip = Nothing -minViewWithKey x = Just (deleteFindMin x) +minViewWithKey x = Just $! deleteFindMin x -- | /O(log n)/. Retrieves the maximal (key,value) pair of the map, and -- the map stripped of that element, or 'Nothing' if passed an empty map. @@ -1439,7 +1446,7 @@ minViewWithKey x = Just (deleteFindMin x) maxViewWithKey :: Map k a -> Maybe ((k,a), Map k a) maxViewWithKey Tip = Nothing -maxViewWithKey x = Just (deleteFindMax x) +maxViewWithKey x = Just $! deleteFindMax x -- | /O(log n)/. Retrieves the value associated with minimal key of the -- map, and the map stripped of that element, or 'Nothing' if passed an @@ -1450,7 +1457,7 @@ maxViewWithKey x = Just (deleteFindMax x) minView :: Map k a -> Maybe (a, Map k a) minView Tip = Nothing -minView x = Just (first snd $ deleteFindMin x) +minView x = Just $! (first snd $ deleteFindMin x) -- | /O(log n)/. Retrieves the value associated with maximal key of the -- map, and the map stripped of that element, or 'Nothing' if passed an @@ -1461,9 +1468,10 @@ minView x = Just (first snd $ deleteFindMin x) maxView :: Map k a -> Maybe (a, Map k a) maxView Tip = Nothing -maxView x = Just (first snd $ deleteFindMax x) +maxView x = Just $! (first snd $ deleteFindMax x) --- Update the 1st component of a tuple (special case of Control.Arrow.first) +-- Update the 1st component of a tuple (stricter version of +-- Control.Arrow.first) first :: (a -> b) -> (a,c) -> (b,c) first f (x,y) = (f x, y) @@ -2724,7 +2732,9 @@ deleteFindMin :: Map k a -> ((k,a),Map k a) deleteFindMin t = case t of Bin _ k x Tip r -> ((k,x),r) - Bin _ k x l r -> let (km,l') = deleteFindMin l in (km,balanceR k x l' r) + Bin _ k x l r -> let !(km,l') = deleteFindMin l + !t' = balanceR k x l' r + in (km, t') Tip -> (error "Map.deleteFindMin: can not return the minimal element of an empty map", Tip) -- | /O(log n)/. Delete and find the maximal element. @@ -2736,7 +2746,9 @@ deleteFindMax :: Map k a -> ((k,a),Map k a) deleteFindMax t = case t of Bin _ k x l Tip -> ((k,x),l) - Bin _ k x l r -> let (km,r') = deleteFindMax r in (km,balanceL k x l r') + Bin _ k x l r -> let !(km,r') = deleteFindMax r + !t' = balanceL k x l r' + in (km, t') Tip -> (error "Map.deleteFindMax: can not return the maximal element of an empty map", Tip) diff --git a/changelog.md b/changelog.md index 9e83fee..01e7f79 100644 --- a/changelog.md +++ b/changelog.md @@ -22,6 +22,8 @@ * Speed up `adjust` for `Data.Map`. + * Remove non-essential laziness in `Data.Map.Lazy` implementation. + * Speed up deletion and alteration functions for `Data.IntMap`. ## 0.5.7.1 *Dec 2015* From git at git.haskell.org Mon Apr 17 21:41:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:41:02 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #223 from treeowl/strictify-pairs (1c92e2e) Message-ID: <20170417214102.BD10D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/1c92e2e2830df82f198bc477d2224d26449041e8 >--------------------------------------------------------------- commit 1c92e2e2830df82f198bc477d2224d26449041e8 Merge: 56f290c 164ea00 Author: David Feuer Date: Wed May 18 20:03:32 2016 -0400 Merge pull request #223 from treeowl/strictify-pairs Remove a bunch of unnecessary laziness from Data.Map >--------------------------------------------------------------- 1c92e2e2830df82f198bc477d2224d26449041e8 Data/Map/Base.hs | 42 +++++++++++++++++++++++++++--------------- changelog.md | 2 ++ 2 files changed, 29 insertions(+), 15 deletions(-) From git at git.haskell.org Mon Apr 17 21:41:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:41:04 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Speed up Data.Sequence.splitAt and zipWith (aaf5408) Message-ID: <20170417214104.C7A273A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/aaf54086fda866eb0f3b36607884b984a37962d4 >--------------------------------------------------------------- commit aaf54086fda866eb0f3b36607884b984a37962d4 Author: David Feuer Date: Wed May 18 21:45:29 2016 -0400 Speed up Data.Sequence.splitAt and zipWith Previously, `splitAt` returned a lazy pair, and was pretty much lazy throughout. Now it's about as strict as it's allowed to be. Avoid allocating anything extra when splitting at or before the beginning of a sequence. Fix misplaced bang annotation (my fault). Hand-inline and reduce the splitting of the top of the tree. This avoids a separate cons step at the end, saving some time when splitting small sequences. This is particularly helpful for zip performance. Note: `zip` performance is, for some reason, rather sensitive to how the inliner handles `deepL`. I don't know why. I also don't really know how to fix it. Splitting in general is rather complicated and hard to follow. It would be nice to fix that. Rewrite `take` and `drop` so they don't build the parts of the tree they don't actually use. Previously, they were written using `splitAt`. Use custom left and right views for `FingerTree`s. This was a side effect of something I thought I wanted to do, but it's a good idea anyway. >--------------------------------------------------------------- aaf54086fda866eb0f3b36607884b984a37962d4 Data/Sequence.hs | 513 ++++++++++++++++++++++++++++++++++--------- Data/Utils/BitQueue.hs | 2 + changelog.md | 3 + tests/bitqueue-properties.hs | 2 + 4 files changed, 415 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 aaf54086fda866eb0f3b36607884b984a37962d4 From git at git.haskell.org Mon Apr 17 21:41:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:41:08 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Only use ScopedTypeVariables for GHC (a26fd17) Message-ID: <20170417214108.D99103A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/a26fd17e33eb16caa9331a31f9cad32ad23641c9 >--------------------------------------------------------------- commit a26fd17e33eb16caa9331a31f9cad32ad23641c9 Author: David Feuer Date: Tue May 17 16:58:25 2016 -0400 Only use ScopedTypeVariables for GHC This isn't (yet) standard, and we don't absolutely need it. It is nice, however, to be able to give the type signature it enables, so we can use it when compiling with GHC. >--------------------------------------------------------------- a26fd17e33eb16caa9331a31f9cad32ad23641c9 Data/IntMap/Base.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Data/IntMap/Base.hs b/Data/IntMap/Base.hs index e0a462c..6a4c0dc 100644 --- a/Data/IntMap/Base.hs +++ b/Data/IntMap/Base.hs @@ -2,11 +2,11 @@ {-# LANGUAGE BangPatterns #-} #if __GLASGOW_HASKELL__ {-# LANGUAGE MagicHash, DeriveDataTypeable, StandaloneDeriving #-} +{-# LANGUAGE ScopedTypeVariables #-} #endif #if !defined(TESTING) && __GLASGOW_HASKELL__ >= 703 {-# LANGUAGE Trustworthy #-} #endif -{-# LANGUAGE ScopedTypeVariables #-} #if __GLASGOW_HASKELL__ >= 708 {-# LANGUAGE TypeFamilies #-} #endif @@ -1992,14 +1992,20 @@ fromAscListWithKey f (x0 : xs0) = fromDistinctAscList (combineEq x0 xs0) -- -- > fromDistinctAscList [(3,"b"), (5,"a")] == fromList [(3, "b"), (5, "a")] +#if __GLASGOW_HASKELL__ fromDistinctAscList :: forall a. [(Key,a)] -> IntMap a +#else +fromDistinctAscList :: [(Key,a)] -> IntMap a +#endif fromDistinctAscList [] = Nil fromDistinctAscList (z0 : zs0) = work z0 zs0 Nada where work (kx,vx) [] stk = finish kx (Tip kx vx) stk work (kx,vx) (z@(kz,_):zs) stk = reduce z zs (branchMask kx kz) kx (Tip kx vx) stk +#if __GLASGOW_HASKELL__ reduce :: (Key,a) -> [(Key,a)] -> Mask -> Prefix -> IntMap a -> Stack a -> IntMap a +#endif reduce z zs _ px tx Nada = work z zs (Push px tx Nada) reduce z zs m px tx stk@(Push py ty stk') = let mxy = branchMask px py From git at git.haskell.org Mon Apr 17 21:41:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:41:06 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #236 from treeowl/strictify-seq-splitat (653f597) Message-ID: <20170417214106.D070E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/653f5972c25dac8bfb3c9c8c17faedd0c93fad52 >--------------------------------------------------------------- commit 653f5972c25dac8bfb3c9c8c17faedd0c93fad52 Merge: 1c92e2e aaf5408 Author: David Feuer Date: Thu May 19 19:02:38 2016 -0400 Merge pull request #236 from treeowl/strictify-seq-splitat Speed up Data.Sequence.splitAt and zipWith >--------------------------------------------------------------- 653f5972c25dac8bfb3c9c8c17faedd0c93fad52 Data/Sequence.hs | 513 ++++++++++++++++++++++++++++++++++--------- Data/Utils/BitQueue.hs | 2 + changelog.md | 3 + tests/bitqueue-properties.hs | 2 + 4 files changed, 415 insertions(+), 105 deletions(-) From git at git.haskell.org Mon Apr 17 21:41:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:41:10 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #233 from treeowl/unscope-nonghc (548b3fa) Message-ID: <20170417214110.E1F553A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/548b3faa94746ab5f2caecd319d7d851c94beb92 >--------------------------------------------------------------- commit 548b3faa94746ab5f2caecd319d7d851c94beb92 Merge: 653f597 a26fd17 Author: David Feuer Date: Thu May 19 19:43:15 2016 -0400 Merge pull request #233 from treeowl/unscope-nonghc Only use ScopedTypeVariables for GHC >--------------------------------------------------------------- 548b3faa94746ab5f2caecd319d7d851c94beb92 Data/IntMap/Base.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) From git at git.haskell.org Mon Apr 17 21:41:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:41:12 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Let Cabal know that we use CPP and BangPatterns (826727c) Message-ID: <20170417214112.EA2C53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/826727c13f773e35af1946d843c17e2881a4c352 >--------------------------------------------------------------- commit 826727c13f773e35af1946d843c17e2881a4c352 Author: David Feuer Date: Thu May 19 19:51:41 2016 -0400 Let Cabal know that we use CPP and BangPatterns Use `other-extensions` to indicate this. I'm not convinced it's worth the trouble to try to get real specific about what extensions we use for each GHC version. >--------------------------------------------------------------- 826727c13f773e35af1946d843c17e2881a4c352 containers.cabal | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/containers.cabal b/containers.cabal index f5411b9..96c58dc 100644 --- a/containers.cabal +++ b/containers.cabal @@ -38,6 +38,8 @@ Library ghc-options: -O2 -Wall + other-extensions: CPP, BangPatterns + exposed-modules: Data.IntMap Data.IntMap.Lazy @@ -77,6 +79,7 @@ Test-suite map-lazy-properties build-depends: base >= 4.3 && < 5, array, deepseq >= 1.2 && < 1.5, ghc-prim ghc-options: -O2 + other-extensions: CPP, BangPatterns include-dirs: include build-depends: @@ -97,6 +100,7 @@ Test-suite map-strict-properties build-depends: base >= 4.3 && < 5, array, deepseq >= 1.2 && < 1.5, ghc-prim ghc-options: -O2 + other-extensions: CPP, BangPatterns include-dirs: include build-depends: @@ -118,6 +122,7 @@ Test-suite bitqueue-properties build-depends: base >= 4.3 && < 5, ghc-prim ghc-options: -O2 + other-extensions: CPP, BangPatterns include-dirs: include build-depends: @@ -133,6 +138,7 @@ Test-suite set-properties build-depends: base >= 4.3 && < 5, array, deepseq >= 1.2 && < 1.5, ghc-prim ghc-options: -O2 + other-extensions: CPP, BangPatterns include-dirs: include build-depends: @@ -150,6 +156,7 @@ Test-suite intmap-lazy-properties build-depends: base >= 4.3 && < 5, array, deepseq >= 1.2 && < 1.5, ghc-prim ghc-options: -O2 + other-extensions: CPP, BangPatterns include-dirs: include build-depends: @@ -167,6 +174,7 @@ Test-suite intmap-strict-properties build-depends: base >= 4.3 && < 5, array, deepseq >= 1.2 && < 1.5, ghc-prim ghc-options: -O2 + other-extensions: CPP, BangPatterns include-dirs: include build-depends: @@ -184,6 +192,7 @@ Test-suite intset-properties build-depends: base >= 4.3 && < 5, array, deepseq >= 1.2 && < 1.5, ghc-prim ghc-options: -O2 + other-extensions: CPP, BangPatterns include-dirs: include build-depends: @@ -201,6 +210,7 @@ Test-suite deprecated-properties build-depends: base >= 4.3 && < 5, array, deepseq >= 1.2 && < 1.5, ghc-prim ghc-options: -O2 + other-extensions: CPP, BangPatterns include-dirs: include build-depends: @@ -216,6 +226,7 @@ Test-suite seq-properties build-depends: base >= 4.3 && < 5, array, deepseq >= 1.2 && < 1.5, ghc-prim ghc-options: -O2 + other-extensions: CPP, BangPatterns include-dirs: include build-depends: @@ -240,12 +251,14 @@ test-suite map-strictness-properties test-framework-quickcheck2 >= 0.2.9 ghc-options: -Wall + other-extensions: CPP, BangPatterns include-dirs: include test-suite intmap-strictness-properties hs-source-dirs: tests, . main-is: intmap-strictness.hs type: exitcode-stdio-1.0 + other-extensions: CPP, BangPatterns build-depends: array, @@ -264,6 +277,7 @@ test-suite intset-strictness-properties hs-source-dirs: tests, . main-is: intset-strictness.hs type: exitcode-stdio-1.0 + other-extensions: CPP, BangPatterns build-depends: array, From git at git.haskell.org Mon Apr 17 21:41:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:41:14 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Note Data.Sequence performance improvements (ee0fcab) Message-ID: <20170417214114.F248A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/ee0fcabb971cb60f473e0684fcd702e885af018f >--------------------------------------------------------------- commit ee0fcabb971cb60f473e0684fcd702e885af018f Author: David Feuer Date: Thu May 19 20:19:28 2016 -0400 Note Data.Sequence performance improvements >--------------------------------------------------------------- ee0fcabb971cb60f473e0684fcd702e885af018f changelog.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/changelog.md b/changelog.md index b13b131..f054005 100644 --- a/changelog.md +++ b/changelog.md @@ -23,6 +23,11 @@ * Slightly optimize `replicateA` and `traverse` for `Data.Sequence`. + * Substantially speed up `splitAt` and (consequently) `zipWith` for + `Data.Sequence` by building the result sequences eagerly. The improvements + are greatest for small sequences, but meaningful even for long ones. + Reimplement `take` and `drop` to avoid building and then discarding trees. + * Speed up `adjust` for `Data.Map`. * Remove non-essential laziness in `Data.Map.Lazy` implementation. From git at git.haskell.org Mon Apr 17 21:41:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:41:17 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #237 from treeowl/other-extensions (d658522) Message-ID: <20170417214117.05EC63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/d65852249c11c9dda40812e40653259fff5209f8 >--------------------------------------------------------------- commit d65852249c11c9dda40812e40653259fff5209f8 Merge: ee0fcab 826727c Author: David Feuer Date: Thu May 19 20:43:26 2016 -0400 Merge pull request #237 from treeowl/other-extensions Let Cabal know that we use CPP and BangPatterns >--------------------------------------------------------------- d65852249c11c9dda40812e40653259fff5209f8 containers.cabal | 14 ++++++++++++++ 1 file changed, 14 insertions(+) From git at git.haskell.org Mon Apr 17 21:41:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:41:19 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Make Data.Map.Strict.traverseWithKey strict enough (26624a2) Message-ID: <20170417214119.0E4BF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/26624a2007f217140a45b4803d322dd3f3feb3fb >--------------------------------------------------------------- commit 26624a2007f217140a45b4803d322dd3f3feb3fb Author: David Feuer Date: Thu May 19 22:29:24 2016 -0400 Make Data.Map.Strict.traverseWithKey strict enough Previously, `Data.Map.Strict` re-exported `traverseWithKey` from `Data.Map.Base`. That function could produce a map containing bottoms. >--------------------------------------------------------------- 26624a2007f217140a45b4803d322dd3f3feb3fb Data/Map/Strict.hs | 20 ++++++++++++++++++++ changelog.md | 3 +++ 2 files changed, 23 insertions(+) diff --git a/Data/Map/Strict.hs b/Data/Map/Strict.hs index 39775f7..fe3a55e 100644 --- a/Data/Map/Strict.hs +++ b/Data/Map/Strict.hs @@ -272,6 +272,7 @@ import Data.Map.Base hiding , mapMaybeWithKey , mapEither , mapEitherWithKey + , traverseWithKey , updateAt , updateMin , updateMax @@ -279,6 +280,9 @@ import Data.Map.Base hiding , updateMaxWithKey ) import Control.Applicative (Const (..)) +#if !MIN_VERSION_base(4,8,0) +import Control.Applicative (Applicative (..), (<$>)) +#endif import qualified Data.Set.Base as Set import Data.Utils.StrictFold import Data.Utils.StrictPair @@ -1038,6 +1042,22 @@ mapWithKey f (Bin sx kx x l r) = #-} #endif +-- | /O(n)/. +-- @'traverseWithKey' f m == 'fromList' <$> 'traverse' (\(k, v) -> (\v' -> v' `seq` (k,v')) <$> f k v) ('toList' m)@ +-- That is, it behaves much like a regular 'traverse' except that the traversing +-- function also has access to the key associated with a value and the values are +-- forced before they are installed in the result map. +-- +-- > traverseWithKey (\k v -> if odd k then Just (succ v) else Nothing) (fromList [(1, 'a'), (5, 'e')]) == Just (fromList [(1, 'b'), (5, 'f')]) +-- > traverseWithKey (\k v -> if odd k then Just (succ v) else Nothing) (fromList [(2, 'c')]) == Nothing +traverseWithKey :: Applicative t => (k -> a -> t b) -> Map k a -> t (Map k b) +traverseWithKey f = go + where + go Tip = pure Tip + go (Bin 1 k v _ _) = (\ !v' -> Bin 1 k v' Tip Tip) <$> f k v + go (Bin s k v l r) = (\ l' !v' r' -> Bin s k v' l' r') <$> go l <*> f k v <*> go r +{-# INLINE traverseWithKey #-} + -- | /O(n)/. The function 'mapAccum' threads an accumulating -- argument through the map in ascending order of keys. -- diff --git a/changelog.md b/changelog.md index f054005..6d67bc1 100644 --- a/changelog.md +++ b/changelog.md @@ -10,6 +10,9 @@ * Add `alterF` for `Data.Map`. + * Make `Data.Map.Strict.traverseWithKey` force result values before + installing them in the new map. + * Add `Empty`, `:<|`, and `:|>` pattern synonyms for `Data.Sequence`. * Add `intersperse` and `traverseWithIndex` for `Data.Sequence`. From git at git.haskell.org Mon Apr 17 21:41:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:41:21 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #239 from treeowl/map-strict-trav (cd4b3f1) Message-ID: <20170417214121.16F353A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/cd4b3f15d82f3524ba50d4521dc680154069760e >--------------------------------------------------------------- commit cd4b3f15d82f3524ba50d4521dc680154069760e Merge: d658522 26624a2 Author: David Feuer Date: Thu May 19 22:54:27 2016 -0400 Merge pull request #239 from treeowl/map-strict-trav Make Data.Map.Strict.traverseWithKey strict enough >--------------------------------------------------------------- cd4b3f15d82f3524ba50d4521dc680154069760e Data/Map/Strict.hs | 20 ++++++++++++++++++++ changelog.md | 3 +++ 2 files changed, 23 insertions(+) From git at git.haskell.org Mon Apr 17 21:41:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:41:23 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Fuse fmap with reverse for Data.Sequence (1a48b85) Message-ID: <20170417214123.1FC973A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/1a48b85c309c30242a7c9729d0fc8b89cae4fc75 >--------------------------------------------------------------- commit 1a48b85c309c30242a7c9729d0fc8b89cae4fc75 Author: David Feuer Date: Thu May 19 23:11:43 2016 -0400 Fuse fmap with reverse for Data.Sequence Add rules fusing `fmap f . reverse` and `reverse . fmap f` for `Data.Sequence`. These make mapping over a sequence and reversing it simultaneously as cheap as just mapping over it. Closes #238. >--------------------------------------------------------------- 1a48b85c309c30242a7c9729d0fc8b89cae4fc75 Data/Sequence.hs | 35 +++++++++++++++++++++++++++++------ changelog.md | 2 ++ 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index fdc0c42..0003062 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -2632,14 +2632,37 @@ instance IsString (Seq Char) where -- | /O(n)/. The reverse of a sequence. reverse :: Seq a -> Seq a -reverse (Seq xs) = Seq (reverseTree id xs) +reverse (Seq xs) = Seq (fmapReverseTree id xs) -reverseTree :: (a -> b) -> FingerTree a -> FingerTree b -reverseTree _ EmptyT = EmptyT -reverseTree f (Single x) = Single (f x) -reverseTree f (Deep s pr m sf) = +#ifdef __GLASGOW_HASKELL__ +{-# NOINLINE [1] reverse #-} + +-- | /O(n)/. Reverse a sequence while mapping over it. This is not +-- currently experted, but is used in rewrite rules. +fmapReverse :: (a -> b) -> Seq a -> Seq b +fmapReverse f (Seq xs) = Seq (fmapReverseTree (lift_elem f) xs) + where + lift_elem :: (a -> b) -> (Elem a -> Elem b) +#if __GLASGOW_HASKELL__ >= 708 + lift_elem = coerce +#else + lift_elem f (Elem a) = Elem (f a) +#endif + +-- If we're mapping over a sequence, we can reverse it at the same time +-- at no extra charge. +{-# RULES +"fmapSeq/reverse" forall f xs . fmapSeq f (reverse xs) = fmapReverse f xs +"reverse/fmapSeq" forall f xs . reverse (fmapSeq f xs) = fmapReverse f xs + #-} +#endif + +fmapReverseTree :: (a -> b) -> FingerTree a -> FingerTree b +fmapReverseTree _ EmptyT = EmptyT +fmapReverseTree f (Single x) = Single (f x) +fmapReverseTree f (Deep s pr m sf) = Deep s (reverseDigit f sf) - (reverseTree (reverseNode f) m) + (fmapReverseTree (reverseNode f) m) (reverseDigit f pr) {-# INLINE reverseDigit #-} diff --git a/changelog.md b/changelog.md index 6d67bc1..faa69e6 100644 --- a/changelog.md +++ b/changelog.md @@ -31,6 +31,8 @@ are greatest for small sequences, but meaningful even for long ones. Reimplement `take` and `drop` to avoid building and then discarding trees. + * Add rewrite rules to fuse `fmap` with `reverse` for `Data.Sequence`. + * Speed up `adjust` for `Data.Map`. * Remove non-essential laziness in `Data.Map.Lazy` implementation. From git at git.haskell.org Mon Apr 17 21:41:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:41:25 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #240 from treeowl/fmapreverse (0dc7f63) Message-ID: <20170417214125.280983A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/0dc7f630a44ab2c3f48d2efd8a5583b4fcb5a5ec >--------------------------------------------------------------- commit 0dc7f630a44ab2c3f48d2efd8a5583b4fcb5a5ec Merge: cd4b3f1 1a48b85 Author: David Feuer Date: Thu May 19 23:23:02 2016 -0400 Merge pull request #240 from treeowl/fmapreverse Fuse fmap with reverse for Data.Sequence >--------------------------------------------------------------- 0dc7f630a44ab2c3f48d2efd8a5583b4fcb5a5ec Data/Sequence.hs | 35 +++++++++++++++++++++++++++++------ changelog.md | 2 ++ 2 files changed, 31 insertions(+), 6 deletions(-) From git at git.haskell.org Mon Apr 17 21:41:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:41:27 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Fix spelling error in comment (383b237) Message-ID: <20170417214127.30CF53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/383b237caccbdbc42917c0c2f6dc940ca2030c98 >--------------------------------------------------------------- commit 383b237caccbdbc42917c0c2f6dc940ca2030c98 Author: David Feuer Date: Fri May 20 00:03:06 2016 -0400 Fix spelling error in comment >--------------------------------------------------------------- 383b237caccbdbc42917c0c2f6dc940ca2030c98 Data/Sequence.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 0003062..8e7a704 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -2638,7 +2638,7 @@ reverse (Seq xs) = Seq (fmapReverseTree id xs) {-# NOINLINE [1] reverse #-} -- | /O(n)/. Reverse a sequence while mapping over it. This is not --- currently experted, but is used in rewrite rules. +-- currently exported, but is used in rewrite rules. fmapReverse :: (a -> b) -> Seq a -> Seq b fmapReverse f (Seq xs) = Seq (fmapReverseTree (lift_elem f) xs) where From git at git.haskell.org Mon Apr 17 21:41:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:41:29 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Speed up sequence splitting and zipping some more (8e4be55) Message-ID: <20170417214129.3C84A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/8e4be55514dde91eb0cfbe548bafff21cfa6dd5e >--------------------------------------------------------------- commit 8e4be55514dde91eb0cfbe548bafff21cfa6dd5e Author: David Feuer Date: Sat May 21 02:01:50 2016 -0400 Speed up sequence splitting and zipping some more Rewrite `splitAt`, `take`, and `drop` helper functions to build full results instead of returning pieces, and to build their results eagerly, instead of (unnecessarily) suspending them lazily. This has a major impact on performance. GHC specialization can't help us, because we're now treating the top layer of the tree differently in every helper. As a result, there's a lot of source code, but that's our problem. Benchmark results, compared to containers 0.5.7.1: Old: benchmarking splitAt/append/10 time 1.950 ms (1.946 ms .. 1.954 ms) 1.000 R² (1.000 R² .. 1.000 R²) mean 1.952 ms (1.949 ms .. 1.958 ms) std dev 53 12.41 μs (7.154 μs .. 19.01 μs) New: benchmarking splitAt/append/10 time 1.056 ms (1.050 ms .. 1.065 ms) 0.995 R² (0.983 R² .. 1.000 R²) mean 1.073 ms (1.057 ms .. 1.147 ms) std dev 97.06 μs (9.638 μs .. 221.7 μs) variance introduced by outliers: 68% (severely inflated) Old: benchmarking splitAt/append/100 time 13.81 ms (13.76 ms .. 13.84 ms) 1.000 R² (1.000 R² .. 1.000 R²) mean 13.88 ms (13.84 ms .. 13.95 ms) std dev 119.1 μs (48.84 μs .. 204.2 μs) New: benchmarking splitAt/append/100 time 8.028 ms (8.014 ms .. 8.046 ms) 1.000 R² (1.000 R² .. 1.000 R²) mean 8.041 ms (8.029 ms .. 8.075 ms) std dev 51.02 μs (16.07 μs .. 94.69 μs) Old: benchmarking splitAt/append/1000 time 25.58 ms (25.44 ms .. 25.75 ms) 1.000 R² (1.000 R² .. 1.000 R²) mean 25. ms (25.47 ms .. 25.63 ms) std dev 184.0 μs (128.7 μs .. 272.0 μs) New: benchmarking splitAt/append/1000 time 15.30 ms (15.20 ms .. 15.41 ms) 1.000 R² (1.000 R² .. 1.000 R²) mean 15.32 ms (15.26 ms .. 15.45 ms) std dev 190.0 μs (89.60 μs .. 351.1 μs) Old: benchmarking zip/ix10000/5000 time 13.52 μs (13.41 μs .. 13.77 μs) 0.996 R² (0.987 R² .. 1.000 R²) mean 13.65 μs (13.50 μs .. 14.19 μs) std dev 882.1 ns (174.4 ns .. 1.839 μs) variance introduced by outliers: 72% (severely inflated) New: benchmarking zip/ix10000/5000 time 8.806 μs (8.768 μs .. 8.857 μs) 1.000 R² (1.000 R² .. 1.000 R²) mean 8.787 μs (8.766 μs .. 8.879 μs) std dev 113.3 ns (30.31 ns .. 244.0 ns) Old: benchmarking zip/nf100 time 19.99 μs (19.96 μs .. 20.04 μs) 1.000 R² (1.000 R² .. 1.000 R²) mean 19.98 μs (19.96 μs .. 20.00 μs) std dev 64.04 ns (34.52 ns .. 100.9 ns) New: benchmarking zip/nf100 time 13.19 μs (13.15 μs .. 13.24 μs) 1.000 R² (1.000 R² .. 1.000 R²) mean 13.19 μs (13.15 μs .. 13.28 μs) std dev 157.8 ns (86.36 ns .. 288.1 ns) Old: benchmarking zip/nf10000 time 2.578 ms (2.567 ms .. 2.591 ms) 1.000 R² (1.000 R² .. 1.000 R²) mean 2.584 ms (2.574 ms .. 2.598 ms) std dev 40.16 μs (30.17 μs .. 57.04 μs) New: benchmarking zip/nf10000 time 1.768 ms (1.764 ms .. 1.774 ms) 1.000 R² (1.000 R² .. 1.000 R²) mean 1.778 ms (1.772 ms .. 1.793 ms) std dev 29.50 μs (16.59 μs .. 56.72 μs) >--------------------------------------------------------------- 8e4be55514dde91eb0cfbe548bafff21cfa6dd5e .gitignore | 2 + Data/Sequence.hs | 599 +++++++++++++++++++++++++++++++++---------------------- 2 files changed, 359 insertions(+), 242 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 8e4be55514dde91eb0cfbe548bafff21cfa6dd5e From git at git.haskell.org Mon Apr 17 21:41:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:41:31 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #242 from treeowl/clean-split (0c667a6) Message-ID: <20170417214131.458AC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/0c667a69e2dde08501ef315d166bf065bfa95e2c >--------------------------------------------------------------- commit 0c667a69e2dde08501ef315d166bf065bfa95e2c Merge: 383b237 8e4be55 Author: David Feuer Date: Sat May 21 17:35:12 2016 -0400 Merge pull request #242 from treeowl/clean-split Speed up sequence splitting and zipping some more >--------------------------------------------------------------- 0c667a69e2dde08501ef315d166bf065bfa95e2c .gitignore | 2 + Data/Sequence.hs | 599 +++++++++++++++++++++++++++++++++---------------------- 2 files changed, 359 insertions(+), 242 deletions(-) From git at git.haskell.org Mon Apr 17 21:41:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:41:33 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Update changelog.md (d44ab6a) Message-ID: <20170417214133.4D6983A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/d44ab6a0a911c20654baabab632c5ca8866e4f1b >--------------------------------------------------------------- commit d44ab6a0a911c20654baabab632c5ca8866e4f1b Author: David Feuer Date: Sat May 21 17:43:53 2016 -0400 Update changelog.md >--------------------------------------------------------------- d44ab6a0a911c20654baabab632c5ca8866e4f1b changelog.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/changelog.md b/changelog.md index faa69e6..dffe090 100644 --- a/changelog.md +++ b/changelog.md @@ -27,9 +27,10 @@ * Slightly optimize `replicateA` and `traverse` for `Data.Sequence`. * Substantially speed up `splitAt` and (consequently) `zipWith` for - `Data.Sequence` by building the result sequences eagerly. The improvements - are greatest for small sequences, but meaningful even for long ones. - Reimplement `take` and `drop` to avoid building and then discarding trees. + `Data.Sequence` by building the result sequences eagerly and rearranging + code to avoid allocating unnecessary intermediate structures. The + improvements are greatest for small sequences, but large even for long + ones. Reimplement `take` and `drop` to avoid building trees only to discard them. * Add rewrite rules to fuse `fmap` with `reverse` for `Data.Sequence`. From git at git.haskell.org Mon Apr 17 21:41:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:41:35 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Add chunksOf to Data.Sequence (32d1ba3) Message-ID: <20170417214135.56E313A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/32d1ba300729ebe5cdfbde12ab0b73e03fb9bf3f >--------------------------------------------------------------- commit 32d1ba300729ebe5cdfbde12ab0b73e03fb9bf3f Author: David Feuer Date: Sun Mar 15 20:50:40 2015 -0400 Add chunksOf to Data.Sequence Break up a sequence into pieces of a given size. Based on `Data.List.Split.chunksOf` and implemented using `splitMap`. Also add an appropriate QuickCheck property. >--------------------------------------------------------------- 32d1ba300729ebe5cdfbde12ab0b73e03fb9bf3f Data/Sequence.hs | 20 ++++++++++++++++---- tests/seq-properties.hs | 13 +++++++++++-- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index b42a5b2..95029e3 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -126,6 +126,7 @@ module Data.Sequence ( -- * Sublists tails, -- :: Seq a -> Seq (Seq a) inits, -- :: Seq a -> Seq (Seq a) + chunksOf, -- :: Int -> Seq a -> Seq (Seq a) -- ** Sequential searches takeWhileL, -- :: (a -> Bool) -> Seq a -> Seq a takeWhileR, -- :: (a -> Bool) -> Seq a -> Seq a @@ -2271,10 +2272,9 @@ splitAt' i (Seq xs) = case splitTreeE i xs of -- enhance sharing when the split point is less than or equal to 0, and that -- gives completely wrong answers when the split point is at least the length -- of the sequence, unless the sequence is a singleton. This is used to --- implement zipWith, which hits the first case at most once, only hits the --- second with singletons, and is extremely sensitive to the cost of splitting --- very short sequences. There is just enough of a speed increase to make this --- worth the trouble. +-- implement zipWith and chunksOf, which are extremely sensitive to the cost of +-- splitting very short sequences. There is just enough of a speed increase to +-- make this worth the trouble. uncheckedSplitAt :: Int -> Seq a -> (Seq a, Seq a) uncheckedSplitAt i (Seq xs) = case splitTreeE i xs of l :*: r -> (Seq l, Seq r) @@ -2435,6 +2435,18 @@ splitSuffixN i s pr m (Four a b c d) scd = size c + sd sbcd = size b + scd +-- | /O(n)/. @chunksOf n xs@ splits @xs@ into chunks of size @n>0 at . +-- If @n@ does not divide the length of @xs@ evenly, then the last element +-- of the result will be short. +chunksOf :: Int -> Seq a -> Seq (Seq a) +chunksOf n _ | n <= 0 = error "chunksOf takes a positive integer argument" +chunksOf 1 s = fmap singleton s +chunksOf n s = splitMap (uncheckedSplitAt . (*n)) const most (replicate numReps ()) + >< if null end then empty else singleton end + where + (numReps, endLength) = length s `quotRem` n + (most, end) = splitAt' (length s - endLength) s + -- | /O(n)/. Returns a sequence of all suffixes of this sequence, -- longest first. For example, -- diff --git a/tests/seq-properties.hs b/tests/seq-properties.hs index f9fb071..e075a4e 100644 --- a/tests/seq-properties.hs +++ b/tests/seq-properties.hs @@ -4,10 +4,10 @@ import Control.Applicative (Applicative(..)) import Control.Arrow ((***)) import Control.Monad.Trans.State.Strict import Data.Array (listArray) -import Data.Foldable (Foldable(foldl, foldl1, foldr, foldr1, foldMap), toList, all, sum) +import Data.Foldable (Foldable(foldl, foldl1, foldr, foldr1, foldMap, fold), toList, all, sum) import Data.Functor ((<$>), (<$)) import Data.Maybe -import Data.Monoid (Monoid(..)) +import Data.Monoid (Monoid(..), All (..)) import Data.Traversable (Traversable(traverse), sequenceA) import Prelude hiding ( null, length, take, drop, splitAt, @@ -77,6 +77,7 @@ main = defaultMain , testProperty "take" prop_take , testProperty "drop" prop_drop , testProperty "splitAt" prop_splitAt + , testProperty "chunksOf" prop_chunksOf , testProperty "elemIndexL" prop_elemIndexL , testProperty "elemIndicesL" prop_elemIndicesL , testProperty "elemIndexR" prop_elemIndexR @@ -499,6 +500,14 @@ prop_splitAt :: Int -> Seq A -> Bool prop_splitAt n xs = toListPair' (splitAt n xs) ~= Prelude.splitAt n (toList xs) +prop_chunksOf :: Positive Int -> Seq A -> Bool +prop_chunksOf (Positive n') xs = + valid chunks && + getAll (foldMap (All . (\c -> valid c && length c <= n)) chunks) && + fold chunks == xs + where chunks = chunksOf n xs + n = max 1 (n' `rem` (length xs + 3)) + adjustList :: (a -> a) -> Int -> [a] -> [a] adjustList f i xs = [if j == i then f x else x | (j, x) <- Prelude.zip [0..] xs] From git at git.haskell.org Mon Apr 17 21:41:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:41:37 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #146 from treeowl/chunks (a7657bc) Message-ID: <20170417214137.6008A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/a7657bc4da68270902ce19e2056ed02a73efe3ab >--------------------------------------------------------------- commit a7657bc4da68270902ce19e2056ed02a73efe3ab Merge: d44ab6a 32d1ba3 Author: David Feuer Date: Sat May 21 23:21:23 2016 -0400 Merge pull request #146 from treeowl/chunks Add chunksOf to Data.Sequence >--------------------------------------------------------------- a7657bc4da68270902ce19e2056ed02a73efe3ab Data/Sequence.hs | 20 ++++++++++++++++---- tests/seq-properties.hs | 13 +++++++++++-- 2 files changed, 27 insertions(+), 6 deletions(-) From git at git.haskell.org Mon Apr 17 21:41:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:41:39 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Integrate benchmarks with `cabal`. Fixes #188 (1c1f44d) Message-ID: <20170417214139.69B573A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/1c1f44decc8027d5549ee545cee754347c181dc3 >--------------------------------------------------------------- commit 1c1f44decc8027d5549ee545cee754347c181dc3 Author: Gabriel Gonzalez Date: Sat May 21 21:04:14 2016 -0700 Integrate benchmarks with `cabal`. Fixes #188 >--------------------------------------------------------------- 1c1f44decc8027d5549ee545cee754347c181dc3 benchmarks/IntMap.hs | 5 +- benchmarks/IntSet.hs | 5 +- benchmarks/LookupGE/IntMap.hs | 12 +-- benchmarks/LookupGE/LookupGE_IntMap.hs | 3 - benchmarks/LookupGE/LookupGE_Map.hs | 3 - benchmarks/LookupGE/Map.hs | 12 +-- benchmarks/Map.hs | 5 +- benchmarks/Sequence.hs | 7 +- benchmarks/Set.hs | 6 +- benchmarks/SetOperations/SetOperations.hs | 2 +- containers.cabal | 131 ++++++++++++++++++++++++++++++ 11 files changed, 151 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 1c1f44decc8027d5549ee545cee754347c181dc3 From git at git.haskell.org Mon Apr 17 21:41:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:41:41 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #245 from Gabriel439/gabriel/cabal_bench_2 (b41c6b3) Message-ID: <20170417214141.728C03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/b41c6b3f2355ecbcce7df919c62c7cd6b9a274ad >--------------------------------------------------------------- commit b41c6b3f2355ecbcce7df919c62c7cd6b9a274ad Merge: a7657bc 1c1f44d Author: David Feuer Date: Sun May 22 00:27:10 2016 -0400 Merge pull request #245 from Gabriel439/gabriel/cabal_bench_2 Integrate benchmarks with `cabal`. Fixes #188 >--------------------------------------------------------------- b41c6b3f2355ecbcce7df919c62c7cd6b9a274ad benchmarks/IntMap.hs | 5 +- benchmarks/IntSet.hs | 5 +- benchmarks/LookupGE/IntMap.hs | 12 +-- benchmarks/LookupGE/LookupGE_IntMap.hs | 3 - benchmarks/LookupGE/LookupGE_Map.hs | 3 - benchmarks/LookupGE/Map.hs | 12 +-- benchmarks/Map.hs | 5 +- benchmarks/Sequence.hs | 7 +- benchmarks/Set.hs | 6 +- benchmarks/SetOperations/SetOperations.hs | 2 +- containers.cabal | 131 ++++++++++++++++++++++++++++++ 11 files changed, 151 insertions(+), 40 deletions(-) From git at git.haskell.org Mon Apr 17 21:41:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:41:43 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Add foldMapWithIndex for Data.Sequence (0a9285c) Message-ID: <20170417214143.7F34B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/0a9285c748e175f3e6092570231a52fa340d654c >--------------------------------------------------------------- commit 0a9285c748e175f3e6092570231a52fa340d654c Author: David Feuer Date: Thu May 12 20:19:01 2016 -0400 Add foldMapWithIndex for Data.Sequence This finishes the indexed folds. Implementing `foldrWithIndex` using this function gives wretched performance, unfortunately. It would be nice to know why, and whether anything can be done about that. Also, clean up some monoid syntax and import `Data.Semigroup` qualified (we only need it to write one instance). >--------------------------------------------------------------- 0a9285c748e175f3e6092570231a52fa340d654c Data/Sequence.hs | 126 ++++++++++++++++++++++++++++++++++++++++++------ tests/seq-properties.hs | 14 +++++- 2 files changed, 125 insertions(+), 15 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 0a9285c748e175f3e6092570231a52fa340d654c From git at git.haskell.org Mon Apr 17 21:41:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:41:45 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #222 from treeowl/foldMapWithIndexSequence (0612f1c) Message-ID: <20170417214145.8736C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/0612f1c0338f2150bde10cc80e761e83f56cf91b >--------------------------------------------------------------- commit 0612f1c0338f2150bde10cc80e761e83f56cf91b Merge: b41c6b3 0a9285c Author: David Feuer Date: Sun May 22 14:31:49 2016 -0400 Merge pull request #222 from treeowl/foldMapWithIndexSequence Add foldMapWithIndex for Data.Sequence >--------------------------------------------------------------- 0612f1c0338f2150bde10cc80e761e83f56cf91b Data/Sequence.hs | 126 ++++++++++++++++++++++++++++++++++++++++++------ tests/seq-properties.hs | 14 +++++- 2 files changed, 125 insertions(+), 15 deletions(-) From git at git.haskell.org Mon Apr 17 21:41:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:41:47 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Changelog update (c72ab15) Message-ID: <20170417214147.8E0AB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/c72ab151e20510801de735a7e457b5025b6fca4c >--------------------------------------------------------------- commit c72ab151e20510801de735a7e457b5025b6fca4c Author: David Feuer Date: Sun May 22 14:34:23 2016 -0400 Changelog update >--------------------------------------------------------------- c72ab151e20510801de735a7e457b5025b6fca4c changelog.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index dffe090..6619c91 100644 --- a/changelog.md +++ b/changelog.md @@ -15,7 +15,8 @@ * Add `Empty`, `:<|`, and `:|>` pattern synonyms for `Data.Sequence`. - * Add `intersperse` and `traverseWithIndex` for `Data.Sequence`. + * Add `chunksOf`, `intersperse`, `foldMapWithIndex`, and + `traverseWithIndex` for `Data.Sequence`. * Make `splitAt` in `Data.Sequence` strict in its arguments. Previously, it returned a lazy pair. From git at git.haskell.org Mon Apr 17 21:41:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:41:49 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Add rewrite rule for alterF with pairs (83f5c7d) Message-ID: <20170417214149.998443A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/83f5c7daa41bae03c0d79716e5be8c38885e4faa >--------------------------------------------------------------- commit 83f5c7daa41bae03c0d79716e5be8c38885e4faa Author: David Feuer Date: Sun May 22 18:27:57 2016 -0400 Add rewrite rule for alterF with pairs Also fix alterF documentation formatting. >--------------------------------------------------------------- 83f5c7daa41bae03c0d79716e5be8c38885e4faa Data/Map/Base.hs | 63 +++++++++++++++++++++++++++++++++++++++++++++++------- Data/Map/Strict.hs | 20 +++++++++++------ benchmarks/Map.hs | 39 +++++++++++++++++++++++++++------ 3 files changed, 100 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 83f5c7daa41bae03c0d79716e5be8c38885e4faa From git at git.haskell.org Mon Apr 17 21:41:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:41:51 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #246 from treeowl/alterF-pair (85970ec) Message-ID: <20170417214151.A32EC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/85970ec8368620b9ed2b7f349880199f91eff436 >--------------------------------------------------------------- commit 85970ec8368620b9ed2b7f349880199f91eff436 Merge: c72ab15 83f5c7d Author: David Feuer Date: Sun May 22 19:21:57 2016 -0400 Merge pull request #246 from treeowl/alterF-pair Add rewrite rule for alterF with pairs >--------------------------------------------------------------- 85970ec8368620b9ed2b7f349880199f91eff436 Data/Map/Base.hs | 63 +++++++++++++++++++++++++++++++++++++++++++++++------- Data/Map/Strict.hs | 20 +++++++++++------ benchmarks/Map.hs | 39 +++++++++++++++++++++++++++------ 3 files changed, 100 insertions(+), 22 deletions(-) From git at git.haskell.org Mon Apr 17 21:41:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:41:53 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Remove redundant Eq constraint (29077e3) Message-ID: <20170417214153.AAEE03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/29077e30ae3bfe6b2e138fc6f2564219c33b5de2 >--------------------------------------------------------------- commit 29077e30ae3bfe6b2e138fc6f2564219c33b5de2 Author: David Feuer Date: Sun May 22 19:26:35 2016 -0400 Remove redundant Eq constraint The `Arbitrary (Map k v)` had a totally redundant `Eq k` constraint for some reason. >--------------------------------------------------------------- 29077e30ae3bfe6b2e138fc6f2564219c33b5de2 tests/map-strictness.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/map-strictness.hs b/tests/map-strictness.hs index 3efea61..ab28757 100644 --- a/tests/map-strictness.hs +++ b/tests/map-strictness.hs @@ -11,7 +11,7 @@ import Test.QuickCheck (Arbitrary(arbitrary)) import Data.Map.Strict (Map) import qualified Data.Map.Strict as M -instance (Arbitrary k, Arbitrary v, Eq k, Ord k) => +instance (Arbitrary k, Arbitrary v, Ord k) => Arbitrary (Map k v) where arbitrary = M.fromList `fmap` arbitrary From git at git.haskell.org Mon Apr 17 21:41:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:41:55 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Fix strictness of alterF rewrite target (05c65b9) Message-ID: <20170417214155.B4BA23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/05c65b90d7444c2bd3f1a83775a10684131a9681 >--------------------------------------------------------------- commit 05c65b90d7444c2bd3f1a83775a10684131a9681 Author: David Feuer Date: Sun May 22 21:10:38 2016 -0400 Fix strictness of alterF rewrite target The strict `alterF` rewrite target for `(,) b` was too strict. I *think* it now has the correct semantics. >--------------------------------------------------------------- 05c65b90d7444c2bd3f1a83775a10684131a9681 Data/Map/Base.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Data/Map/Base.hs b/Data/Map/Base.hs index 2e0bead..8fb7f11 100644 --- a/Data/Map/Base.hs +++ b/Data/Map/Base.hs @@ -1219,7 +1219,7 @@ atKeyWithLookup strict k0 f0 t = case go k0 f0 t of (b, Nothing) -> AltSameLook b (b, Just x) -> case strict of Lazy -> AltBiggerLook b (singleton k x) - Strict -> x `seq` (AltBiggerLook b $ singleton k x) + Strict -> (AltBiggerLook b $ singleton k $! x) go k f (Bin sx kx x l r) = case compare k kx of LT -> case go k f l of @@ -1235,7 +1235,7 @@ atKeyWithLookup strict k0 f0 t = case go k0 f0 t of EQ -> case f (Just x) of (b, Just x') -> case strict of Lazy -> AltAdjLook b $ Bin sx kx x' l r - Strict -> x' `seq` (AltAdjLook b $ Bin sx kx x' l r) + Strict -> AltAdjLook b (x' `seq` Bin sx kx x' l r) (b, Nothing) -> AltSmallerLook b $ glue l r {-# INLINE atKeyWithLookup #-} From git at git.haskell.org Mon Apr 17 21:41:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:41:57 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #247 from treeowl/fix-at-strictness (745a8b5) Message-ID: <20170417214157.BD9D93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/745a8b525415571b34797c89a14f0fddc8d6a236 >--------------------------------------------------------------- commit 745a8b525415571b34797c89a14f0fddc8d6a236 Merge: 85970ec 05c65b9 Author: David Feuer Date: Sun May 22 21:28:34 2016 -0400 Merge pull request #247 from treeowl/fix-at-strictness Fix strictness of alterF rewrite target >--------------------------------------------------------------- 745a8b525415571b34797c89a14f0fddc8d6a236 Data/Map/Base.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) From git at git.haskell.org Mon Apr 17 21:41:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:41:59 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #248 from treeowl/remove-redundant-eq (c7eb951) Message-ID: <20170417214159.C57F93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/c7eb951a91d3445041a404a4ea8af410bb6f2b14 >--------------------------------------------------------------- commit c7eb951a91d3445041a404a4ea8af410bb6f2b14 Merge: 745a8b5 29077e3 Author: David Feuer Date: Sun May 22 21:31:35 2016 -0400 Merge pull request #248 from treeowl/remove-redundant-eq Remove redundant Eq constraint >--------------------------------------------------------------- c7eb951a91d3445041a404a4ea8af410bb6f2b14 tests/map-strictness.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) From git at git.haskell.org Mon Apr 17 21:42:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:42:01 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Stop fearing the middle (5b589cc) Message-ID: <20170417214201.CF63F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/5b589cc61cc5beca55373c8d3d6700ff18fe6b71 >--------------------------------------------------------------- commit 5b589cc61cc5beca55373c8d3d6700ff18fe6b71 Author: David Feuer Date: Sun May 22 22:33:39 2016 -0400 Stop fearing the middle A couple years ago I thought it *must* be a good idea to ever look down the middle if it could possibly be avoided, but I never had any benchmarks to support it, and it seems pretty silly in retrospect. Reverting pending some numbers demonstrating it's really the way to go. >--------------------------------------------------------------- 5b589cc61cc5beca55373c8d3d6700ff18fe6b71 Data/Sequence.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 0f1f2ec..00b1d2b 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -1584,14 +1584,14 @@ data Place a = Place {-# UNPACK #-} !Int a lookupTree :: Sized a => Int -> FingerTree a -> Place a lookupTree _ EmptyT = error "lookupTree of empty tree" lookupTree i (Single x) = Place i x -lookupTree i (Deep totalSize pr m sf) +lookupTree i (Deep _ pr m sf) | i < spr = lookupDigit i pr | i < spm = case lookupTree (i - spr) m of Place i' xs -> lookupNode i' xs | otherwise = lookupDigit (i - spm) sf where spr = size pr - spm = totalSize - size sf + spm = spr + size m {-# SPECIALIZE lookupNode :: Int -> Node (Elem a) -> Place (Elem a) #-} {-# SPECIALIZE lookupNode :: Int -> Node (Node a) -> Place (Node a) #-} @@ -1721,7 +1721,7 @@ mapWithIndex f' (Seq xs') = Seq $ mapWithIndexTree (\s (Elem a) -> Elem (f' s a) (mapWithIndexDigit f sPsprm sf) where !sPspr = s + size pr - !sPsprm = s + n - size sf + !sPsprm = sPspr + size m {-# SPECIALIZE mapWithIndexDigit :: (Int -> Elem y -> b) -> Int -> Digit (Elem y) -> Digit b #-} {-# SPECIALIZE mapWithIndexDigit :: (Int -> Node y -> b) -> Int -> Digit (Node y) -> Digit b #-} From git at git.haskell.org Mon Apr 17 21:42:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:42:03 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #249 from treeowl/direct-middle (6cb982c) Message-ID: <20170417214203.D7E813A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/6cb982c2b9d3aefc2a21bcf5f0b746434d4a5c0b >--------------------------------------------------------------- commit 6cb982c2b9d3aefc2a21bcf5f0b746434d4a5c0b Merge: c7eb951 5b589cc Author: David Feuer Date: Sun May 22 22:52:10 2016 -0400 Merge pull request #249 from treeowl/direct-middle Stop fearing the middle >--------------------------------------------------------------- 6cb982c2b9d3aefc2a21bcf5f0b746434d4a5c0b Data/Sequence.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) From git at git.haskell.org Mon Apr 17 21:42:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:42:05 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Nix splitAt' (e8b1f66) Message-ID: <20170417214205.E0F5E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/e8b1f664a631e3795dfd14f2d8c2b39c906284cf >--------------------------------------------------------------- commit e8b1f664a631e3795dfd14f2d8c2b39c906284cf Author: David Feuer Date: Sun May 22 23:11:20 2016 -0400 Nix splitAt' `splitAt'` wasn't really doing anything good, and certainly wasn't worth the extra source code. >--------------------------------------------------------------- e8b1f664a631e3795dfd14f2d8c2b39c906284cf Data/Sequence.hs | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 00b1d2b..04f9578 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -2359,14 +2359,6 @@ splitAt i xs@(Seq t) | otherwise = (xs, empty) -- | /O(log(min(i,n-i))) A version of 'splitAt' that does not attempt to --- enhance sharing when the split point is less than or equal to 0. --- Used to implement breakl and breakr, which very rarely hit that case. -splitAt' :: Int -> Seq a -> (Seq a, Seq a) -splitAt' i xs | i >= length xs = (xs, empty) -splitAt' i (Seq xs) = case splitTreeE i xs of - l :*: r -> (Seq l, Seq r) - --- | /O(log(min(i,n-i))) A version of 'splitAt' that does not attempt to -- enhance sharing when the split point is less than or equal to 0, and that -- gives completely wrong answers when the split point is at least the length -- of the sequence, unless the sequence is a singleton. This is used to @@ -2543,7 +2535,7 @@ chunksOf n s = splitMap (uncheckedSplitAt . (*n)) const most (replicate numReps >< if null end then empty else singleton end where (numReps, endLength) = length s `quotRem` n - (most, end) = splitAt' (length s - endLength) s + (most, end) = splitAt (length s - endLength) s -- | /O(n)/. Returns a sequence of all suffixes of this sequence, -- longest first. For example, @@ -2719,12 +2711,12 @@ spanr p = breakr (not . p) -- -- @'breakl' p@ is equivalent to @'spanl' (not . p)@. breakl :: (a -> Bool) -> Seq a -> (Seq a, Seq a) -breakl p xs = foldr (\ i _ -> splitAt' i xs) (xs, empty) (findIndicesL p xs) +breakl p xs = foldr (\ i _ -> splitAt i xs) (xs, empty) (findIndicesL p xs) {-# INLINE breakr #-} -- | @'breakr' p@ is equivalent to @'spanr' (not . p)@. breakr :: (a -> Bool) -> Seq a -> (Seq a, Seq a) -breakr p xs = foldr (\ i _ -> flipPair (splitAt' (i + 1) xs)) (xs, empty) (findIndicesR p xs) +breakr p xs = foldr (\ i _ -> flipPair (splitAt (i + 1) xs)) (xs, empty) (findIndicesR p xs) where flipPair (x, y) = (y, x) -- | /O(n)/. The 'partition' function takes a predicate @p@ and a From git at git.haskell.org Mon Apr 17 21:42:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:42:07 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #251 from treeowl/nix-splitAt-prime (ab41e49) Message-ID: <20170417214207.EA3A23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/ab41e499713fc4d73de460d686e1c688fbdbb1ac >--------------------------------------------------------------- commit ab41e499713fc4d73de460d686e1c688fbdbb1ac Merge: 6cb982c e8b1f66 Author: David Feuer Date: Sun May 22 23:13:33 2016 -0400 Merge pull request #251 from treeowl/nix-splitAt-prime Nix splitAt' >--------------------------------------------------------------- ab41e499713fc4d73de460d686e1c688fbdbb1ac Data/Sequence.hs | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) From git at git.haskell.org Mon Apr 17 21:42:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:42:10 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Remove pair rules (#253) (df3d647) Message-ID: <20170417214210.029D83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/df3d64797a6c3ed812a9331707f6600dd0168d4e >--------------------------------------------------------------- commit df3d64797a6c3ed812a9331707f6600dd0168d4e Author: David Feuer Date: Mon May 23 17:27:07 2016 -0400 Remove pair rules (#253) * Scrap alterF pair rewrite rules The rules rewrote to an overly strict implementation. Specifically, if the function gives us ```haskell (b, undefined :: Maybe a) ``` then we need to produce ```haskell (b, undefined :: Map k a) ``` Making the rules correct greatly reduces their benefit even when they're beneficial, and introduces situations where they may be harmful. So sadly I'm scrapping them. * Re-fix Haddock markup for alterF That was bundled with the reverted commits. >--------------------------------------------------------------- df3d64797a6c3ed812a9331707f6600dd0168d4e Data/Map/Base.hs | 61 +++++++----------------------------------------------- Data/Map/Strict.hs | 19 +++++++---------- benchmarks/Map.hs | 39 +++++++--------------------------- 3 files changed, 22 insertions(+), 97 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc df3d64797a6c3ed812a9331707f6600dd0168d4e From git at git.haskell.org Mon Apr 17 21:42:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:42:12 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Use pattern matching in splitAt (549a347) Message-ID: <20170417214212.0CC153A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/549a347c23de636fd037e57761f83df67fc1f543 >--------------------------------------------------------------- commit 549a347c23de636fd037e57761f83df67fc1f543 Author: David Feuer Date: Mon May 23 23:29:55 2016 -0400 Use pattern matching in splitAt At the top of the tree, we can match on specific numbers instead of using comparisons. >--------------------------------------------------------------- 549a347c23de636fd037e57761f83df67fc1f543 Data/Sequence.hs | 60 +++++++++++++++++++++++++++----------------------------- 1 file changed, 29 insertions(+), 31 deletions(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 04f9578..aa840b5 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -2431,10 +2431,10 @@ splitMiddleE i s spr pr ml (Node2 _ a b) mr sf where sprml = spr + size ml sprmla = 1 + sprml -splitMiddleE i s spr pr ml (Node3 _ a b c) mr sf - | i < 1 = pullR sprml pr ml :*: Deep (s - sprml) (Three a b c) mr sf - | i < 2 = Deep sprmla pr ml (One a) :*: Deep (s - sprmla) (Two b c) mr sf - | otherwise = Deep sprmlab pr ml (Two a b) :*: Deep (s - sprmlab) (One c) mr sf +splitMiddleE i s spr pr ml (Node3 _ a b c) mr sf = case i of + 0 -> pullR sprml pr ml :*: Deep (s - sprml) (Three a b c) mr sf + 1 -> Deep sprmla pr ml (One a) :*: Deep (s - sprmla) (Two b c) mr sf + _ -> Deep sprmlab pr ml (Two a b) :*: Deep (s - sprmlab) (One c) mr sf where sprml = spr + size ml sprmla = 1 + sprml @@ -2443,18 +2443,18 @@ splitMiddleE i s spr pr ml (Node3 _ a b c) mr sf splitPrefixE :: Int -> Int -> Digit (Elem a) -> FingerTree (Node (Elem a)) -> Digit (Elem a) -> StrictPair (FingerTree (Elem a)) (FingerTree (Elem a)) splitPrefixE !_i !s (One a) m sf = EmptyT :*: Deep s (One a) m sf -splitPrefixE i s (Two a b) m sf - | i < 1 = EmptyT :*: Deep s (Two a b) m sf - | otherwise = Single a :*: Deep (s - 1) (One b) m sf -splitPrefixE i s (Three a b c) m sf - | i < 1 = EmptyT :*: Deep s (Three a b c) m sf - | i < 2 = Single a :*: Deep (s - 1) (Two b c) m sf - | otherwise = Deep 2 (One a) EmptyT (One b) :*: Deep (s - 2) (One c) m sf -splitPrefixE i s (Four a b c d) m sf - | i < 1 = EmptyT :*: Deep s (Four a b c d) m sf - | i < 2 = Single a :*: Deep (s - 1) (Three b c d) m sf - | i < 3 = Deep 2 (One a) EmptyT (One b) :*: Deep (s - 2) (Two c d) m sf - | otherwise = Deep 3 (Two a b) EmptyT (One c) :*: Deep (s - 3) (One d) m sf +splitPrefixE i s (Two a b) m sf = case i of + 0 -> EmptyT :*: Deep s (Two a b) m sf + _ -> Single a :*: Deep (s - 1) (One b) m sf +splitPrefixE i s (Three a b c) m sf = case i of + 0 -> EmptyT :*: Deep s (Three a b c) m sf + 1 -> Single a :*: Deep (s - 1) (Two b c) m sf + _ -> Deep 2 (One a) EmptyT (One b) :*: Deep (s - 2) (One c) m sf +splitPrefixE i s (Four a b c d) m sf = case i of + 0 -> EmptyT :*: Deep s (Four a b c d) m sf + 1 -> Single a :*: Deep (s - 1) (Three b c d) m sf + 2 -> Deep 2 (One a) EmptyT (One b) :*: Deep (s - 2) (Two c d) m sf + _ -> Deep 3 (Two a b) EmptyT (One c) :*: Deep (s - 3) (One d) m sf splitPrefixN :: Int -> Int -> Digit (Node a) -> FingerTree (Node (Node a)) -> Digit (Node a) -> Split (FingerTree (Node a)) (Node a) @@ -2484,18 +2484,18 @@ splitPrefixN i s (Four a b c d) m sf splitSuffixE :: Int -> Int -> Digit (Elem a) -> FingerTree (Node (Elem a)) -> Digit (Elem a) -> StrictPair (FingerTree (Elem a)) (FingerTree (Elem a)) splitSuffixE !_i !s pr m (One a) = pullR (s - 1) pr m :*: Single a -splitSuffixE i s pr m (Two a b) - | i < 1 = pullR (s - 2) pr m :*: Deep 2 (One a) EmptyT (One b) - | otherwise = Deep (s - 1) pr m (One a) :*: Single b -splitSuffixE i s pr m (Three a b c) - | i < 1 = pullR (s - 3) pr m :*: Deep 3 (Two a b) EmptyT (One c) - | i < 2 = Deep (s - 2) pr m (One a) :*: Deep 2 (One b) EmptyT (One c) - | otherwise = Deep (s - 1) pr m (Two a b) :*: Single c -splitSuffixE i s pr m (Four a b c d) - | i < 1 = pullR (s - 4) pr m :*: Deep 4 (Two a b) EmptyT (Two c d) - | i < 2 = Deep (s - 3) pr m (One a) :*: Deep 3 (Two b c) EmptyT (One d) - | i < 3 = Deep (s - 2) pr m (Two a b) :*: Deep 2 (One c) EmptyT (One d) - | otherwise = Deep (s - 1) pr m (Three a b c) :*: Single d +splitSuffixE i s pr m (Two a b) = case i of + 0 -> pullR (s - 2) pr m :*: Deep 2 (One a) EmptyT (One b) + _ -> Deep (s - 1) pr m (One a) :*: Single b +splitSuffixE i s pr m (Three a b c) = case i of + 0 -> pullR (s - 3) pr m :*: Deep 3 (Two a b) EmptyT (One c) + 1 -> Deep (s - 2) pr m (One a) :*: Deep 2 (One b) EmptyT (One c) + _ -> Deep (s - 1) pr m (Two a b) :*: Single c +splitSuffixE i s pr m (Four a b c d) = case i of + 0 -> pullR (s - 4) pr m :*: Deep 4 (Two a b) EmptyT (Two c d) + 1 -> Deep (s - 3) pr m (One a) :*: Deep 3 (Two b c) EmptyT (One d) + 2 -> Deep (s - 2) pr m (Two a b) :*: Deep 2 (One c) EmptyT (One d) + _ -> Deep (s - 1) pr m (Three a b c) :*: Single d splitSuffixN :: Int -> Int -> Digit (Node a) -> FingerTree (Node (Node a)) -> Digit (Node a) -> Split (FingerTree (Node a)) (Node a) @@ -2967,10 +2967,8 @@ reverseNode f (Node3 s a b c) = Node3 s (f c) (f b) (f a) -- > mapWithIndex :: (Int -> a -> b) -> Seq a -> Seq b -- > mapWithIndex f = splitMap (\n i -> (i, n+i)) f 0 splitMap :: (Int -> s -> (s,s)) -> (s -> a -> b) -> s -> Seq a -> Seq b -splitMap splt' = go +splitMap splt' f0 s0 (Seq xs0) = Seq $ splitMapTree splt' (\s' (Elem a) -> Elem (f0 s' a)) s0 xs0 where - go f s (Seq xs) = Seq $ splitMapTree splt' (\s' (Elem a) -> Elem (f s' a)) s xs - {-# SPECIALIZE splitMapTree :: (Int -> s -> (s,s)) -> (s -> Elem y -> b) -> s -> FingerTree (Elem y) -> FingerTree b #-} {-# SPECIALIZE splitMapTree :: (Int -> s -> (s,s)) -> (s -> Node y -> b) -> s -> FingerTree (Node y) -> FingerTree b #-} splitMapTree :: Sized a => (Int -> s -> (s,s)) -> (s -> a -> b) -> s -> FingerTree a -> FingerTree b From git at git.haskell.org Mon Apr 17 21:42:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:42:14 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Speed up zipWith some more (e8f34b5) Message-ID: <20170417214214.15B383A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/e8f34b52aafa59feab40395fcacfc4dca50157d5 >--------------------------------------------------------------- commit e8f34b52aafa59feab40395fcacfc4dca50157d5 Author: David Feuer Date: Tue May 24 00:26:00 2016 -0400 Speed up zipWith some more This one's all about making nice to GHC by pulling local functions to the top level and marking them inline, as well as eta-expanding at a recursive call site. Old (after recent `splitAt` improvements): benchmarking zip/ix10000/5000 time 8.806 μs (8.768 μs .. 8.857 μs) 1.000 R² (1.000 R² .. 1.000 R²) mean 8.787 μs (8.766 μs .. 8.879 μs) std dev 113.3 ns (30.31 ns .. 244.0 ns) benchmarking zip/nf100 time 13.19 μs (13.15 μs .. 13.24 μs) 1.000 R² (1.000 R² .. 1.000 R²) mean 13.19 μs (13.15 μs .. 13.28 μs) std dev 157.8 ns (86.36 ns .. 288.1 ns) benchmarking zip/nf10000 time 1.768 ms (1.764 ms .. 1.774 ms) 1.000 R² (1.000 R² .. 1.000 R²) mean 1.778 ms (1.772 ms .. 1.793 ms) std dev 29.50 μs (16.59 μs .. 56.72 μs) New: benchmarking zip/ix10000/5000 time 7.684 μs (7.668 μs .. 7.704 μs) 1.000 R² (1.000 R² .. 1.000 R²) mean 7.685 μs (7.675 μs .. 7.707 μs) std dev 46.68 ns (27.98 ns .. 73.76 ns) benchmarking zip/nf100 time 9.152 μs (9.139 μs .. 9.170 μs) 1.000 R² (1.000 R² .. 1.000 R²) mean 9.166 μs (9.148 μs .. 9.197 μs) std dev 76.90 ns (42.73 ns .. 140.9 ns) benchmarking zip/nf10000 time 1.294 ms (1.291 ms .. 1.298 ms) 1.000 R² (1.000 R² .. 1.000 R²) mean 1.295 ms (1.292 ms .. 1.298 ms) std dev 10.51 μs (7.936 μs .. 14.12 μs) >--------------------------------------------------------------- e8f34b52aafa59feab40395fcacfc4dca50157d5 Data/Sequence.hs | 91 +++++++++++++++++++++++++++++++------------------------- 1 file changed, 51 insertions(+), 40 deletions(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index aa840b5..033d6e0 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -2966,48 +2966,59 @@ reverseNode f (Node3 s a b c) = Node3 s (f c) (f b) (f a) -- -- > mapWithIndex :: (Int -> a -> b) -> Seq a -> Seq b -- > mapWithIndex f = splitMap (\n i -> (i, n+i)) f 0 +{-# INLINE splitMap #-} splitMap :: (Int -> s -> (s,s)) -> (s -> a -> b) -> s -> Seq a -> Seq b -splitMap splt' f0 s0 (Seq xs0) = Seq $ splitMapTree splt' (\s' (Elem a) -> Elem (f0 s' a)) s0 xs0 - where - {-# SPECIALIZE splitMapTree :: (Int -> s -> (s,s)) -> (s -> Elem y -> b) -> s -> FingerTree (Elem y) -> FingerTree b #-} - {-# SPECIALIZE splitMapTree :: (Int -> s -> (s,s)) -> (s -> Node y -> b) -> s -> FingerTree (Node y) -> FingerTree b #-} - splitMapTree :: Sized a => (Int -> s -> (s,s)) -> (s -> a -> b) -> s -> FingerTree a -> FingerTree b - splitMapTree _ _ _ EmptyT = EmptyT - splitMapTree _ f s (Single xs) = Single $ f s xs - splitMapTree splt f s (Deep n pr m sf) = Deep n (splitMapDigit splt f prs pr) (splitMapTree splt (splitMapNode splt f) ms m) (splitMapDigit splt f sfs sf) - where - (prs, r) = splt (size pr) s - (ms, sfs) = splt (n - size pr - size sf) r - - {-# SPECIALIZE splitMapDigit :: (Int -> s -> (s,s)) -> (s -> Elem y -> b) -> s -> Digit (Elem y) -> Digit b #-} - {-# SPECIALIZE splitMapDigit :: (Int -> s -> (s,s)) -> (s -> Node y -> b) -> s -> Digit (Node y) -> Digit b #-} - splitMapDigit :: Sized a => (Int -> s -> (s,s)) -> (s -> a -> b) -> s -> Digit a -> Digit b - splitMapDigit _ f s (One a) = One (f s a) - splitMapDigit splt f s (Two a b) = Two (f first a) (f second b) - where - (first, second) = splt (size a) s - splitMapDigit splt f s (Three a b c) = Three (f first a) (f second b) (f third c) - where - (first, r) = splt (size a) s - (second, third) = splt (size b) r - splitMapDigit splt f s (Four a b c d) = Four (f first a) (f second b) (f third c) (f fourth d) - where - (first, s') = splt (size a) s - (middle, fourth) = splt (size b + size c) s' - (second, third) = splt (size b) middle - - {-# SPECIALIZE splitMapNode :: (Int -> s -> (s,s)) -> (s -> Elem y -> b) -> s -> Node (Elem y) -> Node b #-} - {-# SPECIALIZE splitMapNode :: (Int -> s -> (s,s)) -> (s -> Node y -> b) -> s -> Node (Node y) -> Node b #-} - splitMapNode :: Sized a => (Int -> s -> (s,s)) -> (s -> a -> b) -> s -> Node a -> Node b - splitMapNode splt f s (Node2 ns a b) = Node2 ns (f first a) (f second b) - where - (first, second) = splt (size a) s - splitMapNode splt f s (Node3 ns a b c) = Node3 ns (f first a) (f second b) (f third c) - where - (first, r) = splt (size a) s - (second, third) = splt (size b) r +splitMap splt' f0 s0 (Seq xs0) = Seq $ splitMapTreeE splt' (\s' (Elem a) -> Elem (f0 s' a)) s0 xs0 + +-- Note: We end up boxing and unboxing Ints here. +-- If we wanted, we could manually unbox them all. +-- However, benchmarks indicate the performance gains +-- are small, and maintaining an entirely separate copy of +-- all the splitMap helpers specially for GHC seems +-- an unreasonable maintenance burden. +{-# INLINE splitMapTreeE #-} +splitMapTreeE :: (Int -> s -> (s,s)) -> (s -> Elem y -> b) -> s -> FingerTree (Elem y) -> FingerTree b +splitMapTreeE _ _ _ EmptyT = EmptyT +splitMapTreeE _ f s (Single xs) = Single $ f s xs +splitMapTreeE splt f s (Deep n pr m sf) = Deep n (splitMapDigit splt f prs pr) (splitMapTreeN splt (\eta1 eta2 -> splitMapNode splt f eta1 eta2) ms m) (splitMapDigit splt f sfs sf) + where + (prs, r) = splt (size pr) s + (ms, sfs) = splt (n - size pr - size sf) r + +splitMapTreeN :: (Int -> s -> (s,s)) -> (s -> Node a -> b) -> s -> FingerTree (Node a) -> FingerTree b +splitMapTreeN _ _ _ EmptyT = EmptyT +splitMapTreeN _ f s (Single xs) = Single $ f s xs +splitMapTreeN splt f s (Deep n pr m sf) = Deep n (splitMapDigit splt f prs pr) (splitMapTreeN splt (\eta1 eta2 -> splitMapNode splt f eta1 eta2) ms m) (splitMapDigit splt f sfs sf) + where + (prs, r) = splt (size pr) s + (ms, sfs) = splt (n - size pr - size sf) r + +{-# INLINE splitMapDigit #-} +splitMapDigit :: Sized a => (Int -> s -> (s,s)) -> (s -> a -> b) -> s -> Digit a -> Digit b +splitMapDigit _ f s (One a) = One (f s a) +splitMapDigit splt f s (Two a b) = Two (f first a) (f second b) + where + (first, second) = splt (size a) s +splitMapDigit splt f s (Three a b c) = Three (f first a) (f second b) (f third c) + where + (first, r) = splt (size a) s + (second, third) = splt (size b) r +splitMapDigit splt f s (Four a b c d) = Four (f first a) (f second b) (f third c) (f fourth d) + where + (first, s') = splt (size a) s + (middle, fourth) = splt (size b + size c) s' + (second, third) = splt (size b) middle + +{-# INLINE splitMapNode #-} +splitMapNode :: Sized a => (Int -> s -> (s,s)) -> (s -> a -> b) -> s -> Node a -> Node b +splitMapNode splt f s (Node2 ns a b) = Node2 ns (f first a) (f second b) + where + (first, second) = splt (size a) s +splitMapNode splt f s (Node3 ns a b c) = Node3 ns (f first a) (f second b) (f third c) + where + (first, r) = splt (size a) s + (second, third) = splt (size b) r -{-# INLINE splitMap #-} getSingleton :: Seq a -> a getSingleton (Seq (Single (Elem a))) = a From git at git.haskell.org Mon Apr 17 21:42:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:42:16 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #254 from treeowl/inline-zip (7369256) Message-ID: <20170417214216.1EC3F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/736925657dae49833f8046e9b1b09c15e8a99ffb >--------------------------------------------------------------- commit 736925657dae49833f8046e9b1b09c15e8a99ffb Merge: df3d647 e8f34b5 Author: David Feuer Date: Tue May 24 00:58:21 2016 -0400 Merge pull request #254 from treeowl/inline-zip Speed up zipWith some more >--------------------------------------------------------------- 736925657dae49833f8046e9b1b09c15e8a99ffb Data/Sequence.hs | 149 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 79 insertions(+), 70 deletions(-) From git at git.haskell.org Mon Apr 17 21:42:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:42:18 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Remove unnecessary extensions from tests (db430be) Message-ID: <20170417214218.262673A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/db430beb2287f7db34975bc25c3e0ac759db5b39 >--------------------------------------------------------------- commit db430beb2287f7db34975bc25c3e0ac759db5b39 Author: David Feuer Date: Tue May 24 02:03:13 2016 -0400 Remove unnecessary extensions from tests Use `Text.Show.Functions` (blech!) to avoid declaring our own, similar instances and using `FlexibleInstances` to do so (double blech!). Remove unused invocation of `GeneralizedNewtypeDeriving`. >--------------------------------------------------------------- db430beb2287f7db34975bc25c3e0ac759db5b39 tests/bitqueue-properties.hs | 1 - tests/intmap-strictness.hs | 12 ++---------- tests/intset-strictness.hs | 3 --- tests/map-strictness.hs | 12 ++---------- 4 files changed, 4 insertions(+), 24 deletions(-) diff --git a/tests/bitqueue-properties.hs b/tests/bitqueue-properties.hs index c533839..06ab54a 100644 --- a/tests/bitqueue-properties.hs +++ b/tests/bitqueue-properties.hs @@ -1,6 +1,5 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE BangPatterns #-} -{-# OPTIONS_GHC -Wall #-} #if !MIN_VERSION_base(4,8,0) import Control.Applicative ((<$>)) diff --git a/tests/intmap-strictness.hs b/tests/intmap-strictness.hs index bae93ac..7dc9d3a 100644 --- a/tests/intmap-strictness.hs +++ b/tests/intmap-strictness.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE FlexibleInstances, GeneralizedNewtypeDeriving #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Main (main) where @@ -8,21 +7,14 @@ import Test.Framework (Test, defaultMain, testGroup) import Test.Framework.Providers.QuickCheck2 (testProperty) import Test.QuickCheck (Arbitrary(arbitrary)) +import Text.Show.Functions () + import Data.IntMap.Strict (IntMap) import qualified Data.IntMap.Strict as M instance Arbitrary v => Arbitrary (IntMap v) where arbitrary = M.fromList `fmap` arbitrary -instance Show (Int -> Int) where - show _ = "" - -instance Show (Int -> Int -> Int) where - show _ = "" - -instance Show (Int -> Int -> Int -> Int) where - show _ = "" - ------------------------------------------------------------------------ -- * Properties diff --git a/tests/intset-strictness.hs b/tests/intset-strictness.hs index b7c4097..c31aca1 100644 --- a/tests/intset-strictness.hs +++ b/tests/intset-strictness.hs @@ -1,6 +1,3 @@ -{-# LANGUAGE FlexibleInstances, GeneralizedNewtypeDeriving #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} - module Main (main) where import Prelude hiding (foldl) diff --git a/tests/map-strictness.hs b/tests/map-strictness.hs index ab28757..c5ef8bc 100644 --- a/tests/map-strictness.hs +++ b/tests/map-strictness.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE FlexibleInstances, GeneralizedNewtypeDeriving #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Main (main) where @@ -8,6 +7,8 @@ import Test.Framework (Test, defaultMain, testGroup) import Test.Framework.Providers.QuickCheck2 (testProperty) import Test.QuickCheck (Arbitrary(arbitrary)) +import Text.Show.Functions () + import Data.Map.Strict (Map) import qualified Data.Map.Strict as M @@ -15,15 +16,6 @@ instance (Arbitrary k, Arbitrary v, Ord k) => Arbitrary (Map k v) where arbitrary = M.fromList `fmap` arbitrary -instance Show (Int -> Int) where - show _ = "" - -instance Show (Int -> Int -> Int) where - show _ = "" - -instance Show (Int -> Int -> Int -> Int) where - show _ = "" - ------------------------------------------------------------------------ -- * Properties From git at git.haskell.org Mon Apr 17 21:42:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:42:20 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #255 from treeowl/cabal-more-exts (ad54f55) Message-ID: <20170417214220.2F1473A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/ad54f55f482a2a2683ecce2958cf9a17001082b8 >--------------------------------------------------------------- commit ad54f55f482a2a2683ecce2958cf9a17001082b8 Merge: 7369256 db430be Author: David Feuer Date: Tue May 24 11:56:31 2016 -0400 Merge pull request #255 from treeowl/cabal-more-exts Remove unnecessary extensions from tests >--------------------------------------------------------------- ad54f55f482a2a2683ecce2958cf9a17001082b8 tests/bitqueue-properties.hs | 1 - tests/intmap-strictness.hs | 12 ++---------- tests/intset-strictness.hs | 3 --- tests/map-strictness.hs | 12 ++---------- 4 files changed, 4 insertions(+), 24 deletions(-) From git at git.haskell.org Mon Apr 17 21:42:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:42:22 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Use QuickCheck function support (a77a692) Message-ID: <20170417214222.3A32D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/a77a6929ca8bc4bbb96e04e821777da503c5a83c >--------------------------------------------------------------- commit a77a6929ca8bc4bbb96e04e821777da503c5a83c Author: David Feuer Date: Tue May 24 13:01:22 2016 -0400 Use QuickCheck function support Previously, a number of tests used functions directly as arguments to QuickCheck properties. As a result, they needed to include the horrifying `Text.Show.Functions`. Now the properties requiring functions use `Test.QuickCheck.Function.Fun`, which has both a meaningful `Show` instance and proper shrinks. >--------------------------------------------------------------- a77a6929ca8bc4bbb96e04e821777da503c5a83c tests/deprecated-properties.hs | 27 +++++++++++++---------- tests/intmap-properties.hs | 29 ++++++++++++++---------- tests/intmap-strictness.hs | 29 ++++++++++++++---------- tests/map-properties.hs | 50 +++++++++++++++++++++++------------------- tests/map-strictness.hs | 29 ++++++++++++++---------- 5 files changed, 96 insertions(+), 68 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc a77a6929ca8bc4bbb96e04e821777da503c5a83c From git at git.haskell.org Mon Apr 17 21:42:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:42:24 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #256 from treeowl/use-quickcheck-fun (da8c312) Message-ID: <20170417214224.432DF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/da8c312494a122943315ad48159d2ee034284fde >--------------------------------------------------------------- commit da8c312494a122943315ad48159d2ee034284fde Merge: ad54f55 a77a692 Author: David Feuer Date: Tue May 24 14:49:54 2016 -0400 Merge pull request #256 from treeowl/use-quickcheck-fun Use QuickCheck function support. >--------------------------------------------------------------- da8c312494a122943315ad48159d2ee034284fde tests/deprecated-properties.hs | 27 +++++++++++++---------- tests/intmap-properties.hs | 29 ++++++++++++++---------- tests/intmap-strictness.hs | 29 ++++++++++++++---------- tests/map-properties.hs | 50 +++++++++++++++++++++++------------------- tests/map-strictness.hs | 29 ++++++++++++++---------- 5 files changed, 96 insertions(+), 68 deletions(-) From git at git.haskell.org Mon Apr 17 21:42:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:42:26 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Update changelog.md (653bea7) Message-ID: <20170417214226.4BF9B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/653bea723dca81cd3a70f97ae46f39e587fb9899 >--------------------------------------------------------------- commit 653bea723dca81cd3a70f97ae46f39e587fb9899 Author: David Feuer Date: Tue May 24 14:59:10 2016 -0400 Update changelog.md >--------------------------------------------------------------- 653bea723dca81cd3a70f97ae46f39e587fb9899 changelog.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/changelog.md b/changelog.md index 6619c91..8617f17 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,13 @@ * Remove all attempts to support nhc98 and any versions of GHC before 7.0. + * Integrate benchmarks with Cabal. (Thanks, Gabriel Gonzalez!) + + * Make Cabal report required extensions properly, and stop using + default extensions. Note that we do *not* report extensions conditionally enabled + based on GHC version, as doing so would lead to a maintenance nightmare + with no obvious benefits. + * Use `BangPatterns` throughout to reduce noise. This extension is now *required* to compile `containers`. @@ -41,6 +48,10 @@ * Speed up deletion and alteration functions for `Data.IntMap`. + * Improve QuickCheck properties taking arbitrary functions by using + `Test.QuickCheck.Function.Fun` instead of evil `Show` instances + for functions. + ## 0.5.7.1 *Dec 2015* * Planned to bundle with GHC 8.0.1. From git at git.haskell.org Mon Apr 17 21:42:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:42:28 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Export cycleN (eca298c) Message-ID: <20170417214228.55BED3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/eca298c6b92aec583ee35c1c13fd27593113e772 >--------------------------------------------------------------- commit eca298c6b92aec583ee35c1c13fd27593113e772 Author: David Feuer Date: Mon Mar 16 11:20:56 2015 -0400 Export cycleN Export `cycleN` and document its performance. >--------------------------------------------------------------- eca298c6b92aec583ee35c1c13fd27593113e772 Data/Sequence.hs | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 033d6e0..f042cdf 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -102,6 +102,7 @@ module Data.Sequence ( replicate, -- :: Int -> a -> Seq a replicateA, -- :: Applicative f => Int -> f a -> f (Seq a) replicateM, -- :: Monad m => Int -> m a -> m (Seq a) + cycleN, -- :: Int -> Seq a -> Seq a -- ** Iterative construction iterateN, -- :: Int -> (a -> a) -> a -> Seq a unfoldr, -- :: (b -> Maybe (a, b)) -> b -> Seq a @@ -367,7 +368,7 @@ instance Monad Seq where instance Applicative Seq where pure = singleton - xs *> ys = cycleN (length xs) ys + xs *> ys = cycleNTimes (length xs) ys fs <*> xs@(Seq xsFT) = case viewl fs of EmptyL -> empty @@ -1032,13 +1033,30 @@ replicateM n x | n >= 0 = unwrapMonad (replicateA n (WrapMonad x)) | otherwise = error "replicateM takes a nonnegative integer argument" --- | @'cycleN' n xs@ concatenates @n@ copies of @xs at . +-- | /O(log(n))/ incremental. @'cycleN' n xs@ forms a sequence of length @n@ by +-- repeatedly concatenating @xs@ with itself. @xs@ must not be empty and +-- @n@ must not be negative. +-- +-- prop> cycleN n = fromList . take n . cycle . toList + +-- If you wish to concatenate a non-empty sequence @xs@ with itself precisely +-- @k@ times, you can use @cycleN (k * length xs)@ or just +-- @replicate k () *> xs at . cycleN :: Int -> Seq a -> Seq a -cycleN n xs - | n < 0 = error "cycleN takes a nonnegative integer argument" - | n == 0 = empty +cycleN n !_xs | n < 0 = error "cycleN takes a non-negative argument" +cycleN n xs | null xs = error "cycleN takes a non-empty sequence" +cycleN n xs = cycleNTimes reps xs >< take final xs + where + (reps, final) = n `quotRem` length xs + +-- | /O(log(kn))/. @'cycleNTimes' k xs@ concatenates @k@ copies of @xs at . This +-- operation uses time and additional space logarithmic in the size of its +-- result. +cycleNTimes :: Int -> Seq a -> Seq a +cycleNTimes n !xs + | n <= 0 = empty | n == 1 = xs -cycleN n (Seq xsFT) = case rigidify xsFT of +cycleNTimes n (Seq xsFT) = case rigidify xsFT of RigidEmpty -> empty RigidOne (Elem x) -> replicate n x RigidTwo x1 x2 -> Seq $ From git at git.haskell.org Mon Apr 17 21:42:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:42:30 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #148 from treeowl/cycleN (fce84ad) Message-ID: <20170417214230.5F3CC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/fce84ad39190a5d3bd5d26726afcd9275abf44ce >--------------------------------------------------------------- commit fce84ad39190a5d3bd5d26726afcd9275abf44ce Merge: 653bea7 eca298c Author: David Feuer Date: Tue May 24 17:44:11 2016 -0400 Merge pull request #148 from treeowl/cycleN Export cycleN >--------------------------------------------------------------- fce84ad39190a5d3bd5d26726afcd9275abf44ce Data/Sequence.hs | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) From git at git.haskell.org Mon Apr 17 21:42:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:42:32 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394: Add cycleN to changelog; fix up its documentation. (81d4802) Message-ID: <20170417214232.6863A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/81d4802ace02dafe8d4709fc923d14d197e306f6 >--------------------------------------------------------------- commit 81d4802ace02dafe8d4709fc923d14d197e306f6 Author: David Feuer Date: Tue May 24 18:55:18 2016 -0400 Add cycleN to changelog; fix up its documentation. >--------------------------------------------------------------- 81d4802ace02dafe8d4709fc923d14d197e306f6 Data/Sequence.hs | 8 +++++--- changelog.md | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index f042cdf..f08be99 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -1033,15 +1033,17 @@ replicateM n x | n >= 0 = unwrapMonad (replicateA n (WrapMonad x)) | otherwise = error "replicateM takes a nonnegative integer argument" --- | /O(log(n))/ incremental. @'cycleN' n xs@ forms a sequence of length @n@ by +-- | /O(log(k))/ incremental. @'cycleN' k xs@ forms a sequence of length @k@ by -- repeatedly concatenating @xs@ with itself. @xs@ must not be empty and --- @n@ must not be negative. +-- @k@ must not be negative. -- --- prop> cycleN n = fromList . take n . cycle . toList +-- prop> cycleN k = fromList . take k . cycle . toList -- If you wish to concatenate a non-empty sequence @xs@ with itself precisely -- @k@ times, you can use @cycleN (k * length xs)@ or just -- @replicate k () *> xs at . +-- +-- @since 0.5.8 cycleN :: Int -> Seq a -> Seq a cycleN n !_xs | n < 0 = error "cycleN takes a non-negative argument" cycleN n xs | null xs = error "cycleN takes a non-empty sequence" diff --git a/changelog.md b/changelog.md index 8617f17..e98c588 100644 --- a/changelog.md +++ b/changelog.md @@ -22,7 +22,7 @@ * Add `Empty`, `:<|`, and `:|>` pattern synonyms for `Data.Sequence`. - * Add `chunksOf`, `intersperse`, `foldMapWithIndex`, and + * Add `chunksOf`, `cycleN`, `intersperse`, `foldMapWithIndex`, and `traverseWithIndex` for `Data.Sequence`. * Make `splitAt` in `Data.Sequence` strict in its arguments. Previously, From git at git.haskell.org Mon Apr 17 21:42:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:42:34 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #258 from treeowl/cycleNlog (9b6276d) Message-ID: <20170417214234.710383A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/9b6276d9100c666721ca7eed21ce9a63d8fdc92d >--------------------------------------------------------------- commit 9b6276d9100c666721ca7eed21ce9a63d8fdc92d Merge: fce84ad 81d4802 Author: David Feuer Date: Tue May 24 18:57:19 2016 -0400 Merge pull request #258 from treeowl/cycleNlog Add cycleN to changelog; fix up its documentation. >--------------------------------------------------------------- 9b6276d9100c666721ca7eed21ce9a63d8fdc92d Data/Sequence.hs | 8 +++++--- changelog.md | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) From git at git.haskell.org Mon Apr 17 21:42:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:42:36 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Make Data.Sequence.adjust helpers stricter (91fc860) Message-ID: <20170417214236.7C66B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/91fc860f0092b8bafda69f2778d80f38950b5c2b >--------------------------------------------------------------- commit 91fc860f0092b8bafda69f2778d80f38950b5c2b Author: David Feuer Date: Wed May 25 00:38:40 2016 -0400 Make Data.Sequence.adjust helpers stricter The helper functions now use bang patterns to ensure strictness in their `Int` arguments. Use a single unsigned comparison instead of two signed ones for `adjust` and `index`. >--------------------------------------------------------------- 91fc860f0092b8bafda69f2778d80f38950b5c2b Data/Sequence.hs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index f08be99..03267ed 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -1590,7 +1590,8 @@ scanr1 f xs = case viewr xs of -- If the position is out of range, 'index' fails with an error. index :: Seq a -> Int -> a index (Seq xs) i - | 0 <= i && i < size xs = case lookupTree i xs of + -- See note on unsigned arithmetic in splitAt + | fromIntegral i < (fromIntegral (size xs) :: Word) = case lookupTree i xs of Place _ (Elem x) -> x | otherwise = error "index out of bounds" @@ -1602,7 +1603,7 @@ data Place a = Place {-# UNPACK #-} !Int a {-# SPECIALIZE lookupTree :: Int -> FingerTree (Elem a) -> Place (Elem a) #-} {-# SPECIALIZE lookupTree :: Int -> FingerTree (Node a) -> Place (Node a) #-} lookupTree :: Sized a => Int -> FingerTree a -> Place a -lookupTree _ EmptyT = error "lookupTree of empty tree" +lookupTree !_ EmptyT = error "lookupTree of empty tree" lookupTree i (Single x) = Place i x lookupTree i (Deep _ pr m sf) | i < spr = lookupDigit i pr @@ -1664,14 +1665,15 @@ update i x = adjust (const x) i -- If the position is out of range, the original sequence is returned. adjust :: (a -> a) -> Int -> Seq a -> Seq a adjust f i (Seq xs) - | 0 <= i && i < size xs = Seq (adjustTree (const (fmap f)) i xs) + -- See note on unsigned arithmetic in splitAt + | fromIntegral i < (fromIntegral (size xs) :: Word) = Seq (adjustTree (`seq` fmap f) i xs) | otherwise = Seq xs {-# SPECIALIZE adjustTree :: (Int -> Elem a -> Elem a) -> Int -> FingerTree (Elem a) -> FingerTree (Elem a) #-} {-# SPECIALIZE adjustTree :: (Int -> Node a -> Node a) -> Int -> FingerTree (Node a) -> FingerTree (Node a) #-} adjustTree :: Sized a => (Int -> a -> a) -> - Int -> FingerTree a -> FingerTree a -adjustTree _ _ EmptyT = error "adjustTree of empty tree" + Int -> FingerTree a -> FingerTree a +adjustTree _ !_ EmptyT = EmptyT -- Unreachable adjustTree f i (Single x) = Single (f i x) adjustTree f i (Deep s pr m sf) | i < spr = Deep s (adjustDigit f i pr) m sf @@ -1700,7 +1702,7 @@ adjustNode f i (Node3 s a b c) {-# SPECIALIZE adjustDigit :: (Int -> Elem a -> Elem a) -> Int -> Digit (Elem a) -> Digit (Elem a) #-} {-# SPECIALIZE adjustDigit :: (Int -> Node a -> Node a) -> Int -> Digit (Node a) -> Digit (Node a) #-} adjustDigit :: Sized a => (Int -> a -> a) -> Int -> Digit a -> Digit a -adjustDigit f i (One a) = One (f i a) +adjustDigit f !i (One a) = One (f i a) adjustDigit f i (Two a b) | i < sa = Two (f i a) b | otherwise = Two a (f (i - sa) b) From git at git.haskell.org Mon Apr 17 21:42:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:42:38 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #259 from treeowl/strictify-seq-adjust (57be384) Message-ID: <20170417214238.8507E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/57be38463cefa81e61f14c4d7a866c1079e724b8 >--------------------------------------------------------------- commit 57be38463cefa81e61f14c4d7a866c1079e724b8 Merge: 9b6276d 91fc860 Author: David Feuer Date: Wed May 25 01:07:00 2016 -0400 Merge pull request #259 from treeowl/strictify-seq-adjust Make Data.Sequence.adjust helpers stricter >--------------------------------------------------------------- 57be38463cefa81e61f14c4d7a866c1079e724b8 Data/Sequence.hs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) From git at git.haskell.org Mon Apr 17 21:42:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:42:40 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Add insertAt to Data.Sequence (c9481a8) Message-ID: <20170417214240.9275D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/c9481a8b51c16ac46d8384d890c0afd84096e193 >--------------------------------------------------------------- commit c9481a8b51c16ac46d8384d890c0afd84096e193 Author: David Feuer Date: Sun May 29 16:28:22 2016 -0400 Add insertAt to Data.Sequence >--------------------------------------------------------------- c9481a8b51c16ac46d8384d890c0afd84096e193 Data/Sequence.hs | 150 ++++++++++++++++++++++++++++++++++++++++++++++++ changelog.md | 2 +- tests/seq-properties.hs | 10 ++++ 3 files changed, 161 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 c9481a8b51c16ac46d8384d890c0afd84096e193 From git at git.haskell.org Mon Apr 17 21:42:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:42:42 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #265 from treeowl/seq-insert (85d9480) Message-ID: <20170417214242.9B6C23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/85d94808104737eecfce2c2f9c0d1f261ea1b5c5 >--------------------------------------------------------------- commit 85d94808104737eecfce2c2f9c0d1f261ea1b5c5 Merge: 57be384 c9481a8 Author: David Feuer Date: Sun May 29 22:41:04 2016 -0400 Merge pull request #265 from treeowl/seq-insert Add insertAt to Data.Sequence >--------------------------------------------------------------- 85d94808104737eecfce2c2f9c0d1f261ea1b5c5 Data/Sequence.hs | 150 ++++++++++++++++++++++++++++++++++++++++++++++++ changelog.md | 2 +- tests/seq-properties.hs | 10 ++++ 3 files changed, 161 insertions(+), 1 deletion(-) From git at git.haskell.org Mon Apr 17 21:42:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:42:44 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Add lookup and (!?) to Data.Sequence (e60c648) Message-ID: <20170417214244.A53C33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/e60c64814d9553a57d12786d584988bc83a4f105 >--------------------------------------------------------------- commit e60c64814d9553a57d12786d584988bc83a4f105 Author: David Feuer Date: Sun May 29 22:12:16 2016 -0400 Add lookup and (!?) to Data.Sequence Also improve the QuickCheck properties for `chunksOf` and `insertAt`, and add pattern synonym documentation. >--------------------------------------------------------------- e60c64814d9553a57d12786d584988bc83a4f105 Data/Sequence.hs | 38 +++++++++++++++++++++++++++++++++++++- changelog.md | 4 ++-- tests/seq-properties.hs | 34 +++++++++++++++++++--------------- 3 files changed, 58 insertions(+), 18 deletions(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 46ae543..5457f7f 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -145,6 +145,8 @@ module Data.Sequence ( unstableSort, -- :: Ord a => Seq a -> Seq a unstableSortBy, -- :: (a -> a -> Ordering) -> Seq a -> Seq a -- * Indexing + lookup, -- :: Int -> Seq a -> Maybe a + (!?), -- :: Seq a -> Int -> Maybe a index, -- :: Seq a -> Int -> a adjust, -- :: (a -> a) -> Int -> Seq a -> Seq a update, -- :: Int -> a -> Seq a -> Seq a @@ -194,7 +196,7 @@ import Prelude hiding ( #if MIN_VERSION_base(4,8,0) Applicative, (<$>), foldMap, Monoid, #endif - null, length, take, drop, splitAt, foldl, foldl1, foldr, foldr1, + null, length, lookup, take, drop, splitAt, foldl, foldl1, foldr, foldr1, scanl, scanl1, scanr, scanr1, replicate, zip, zipWith, zip3, zipWith3, takeWhile, dropWhile, iterate, reverse, filter, mapM, sum, all) import qualified Data.List @@ -282,8 +284,11 @@ infixl 5 :|> -- Unfortunately, there's some extra noise here because -- pattern synonyms could not have signatures until 7.10, -- but 8.0 at least will warn if they're missing. + +-- | A pattern synonym matching an empty sequence. #if __GLASGOW_HASKELL__ >= 710 pattern Empty :: Seq a +#else #endif pattern Empty = Seq EmptyT @@ -291,6 +296,8 @@ pattern Empty = Seq EmptyT -- available in GHC >= 7.10. In earlier versions, these -- can be used to match, but not to construct. +-- | A pattern synonym viewing the front of a non-empty +-- sequence. #if __GLASGOW_HASKELL__ >= 710 pattern (:<|) :: a -> Seq a -> Seq a #endif @@ -300,6 +307,8 @@ pattern x :<| xs <- (viewl -> x :< xs) x :<| xs = x <| xs #endif +-- | A pattern synonym viewing the rear of a non-empty +-- sequence. #if __GLASGOW_HASKELL__ >= 710 pattern (:|>) :: Seq a -> a -> Seq a #endif @@ -1589,6 +1598,8 @@ scanr1 f xs = case viewr xs of -- counting from 0. The argument should thus be a non-negative -- integer less than the size of the sequence. -- If the position is out of range, 'index' fails with an error. +-- +-- prop> xs `index` i = toList xs !! i index :: Seq a -> Int -> a index (Seq xs) i -- See note on unsigned arithmetic in splitAt @@ -1596,6 +1607,31 @@ index (Seq xs) i Place _ (Elem x) -> x | otherwise = error "index out of bounds" +-- | /O(log(min(i,n-i)))/. The element at the specified position, +-- counting from 0. If the specified position is negative or at +-- least the length of the sequence, 'lookup' returns 'Nothing'. +-- +-- prop> 0 <= i < length xs ==> lookup i xs == Just (toList xs !! i) +-- prop> i < 0 || i >= length xs ==> lookup i xs = Nothing +-- +-- @since 0.5.8 +lookup :: Int -> Seq a -> Maybe a +lookup i (Seq xs) + -- Note: we perform the lookup *before* applying the Just constructor + -- to ensure that we don't hold a reference to the whole sequence in + -- a thunk. If we applied the Just constructor around the case, the + -- actual lookup wouldn't be performed unless and until the value was + -- forced. + | fromIntegral i < (fromIntegral (size xs) :: Word) = case lookupTree i xs of + Place _ (Elem x) -> Just x + | otherwise = Nothing + +-- | /O(log(min(i,n-i)))/. A flipped, infix version of `lookup`. +-- +-- @since 0.5.8 +(!?) :: Seq a -> Int -> Maybe a +(!?) = flip lookup + data Place a = Place {-# UNPACK #-} !Int a #if TESTING deriving Show diff --git a/changelog.md b/changelog.md index af5f88c..6a755ce 100644 --- a/changelog.md +++ b/changelog.md @@ -22,8 +22,8 @@ * Add `Empty`, `:<|`, and `:|>` pattern synonyms for `Data.Sequence`. - * Add `chunksOf`, `cycleN`, `insertAt`, `intersperse`, `foldMapWithIndex`, and - `traverseWithIndex` for `Data.Sequence`. + * Add (!?), `lookup`, `chunksOf`, `cycleN`, `insertAt`, `intersperse`, + `foldMapWithIndex`, and `traverseWithIndex` for `Data.Sequence`. * Make `splitAt` in `Data.Sequence` strict in its arguments. Previously, it returned a lazy pair. diff --git a/tests/seq-properties.hs b/tests/seq-properties.hs index 1a72312..2b9745b 100644 --- a/tests/seq-properties.hs +++ b/tests/seq-properties.hs @@ -10,7 +10,7 @@ import Data.Maybe import Data.Monoid (Monoid(..), All(..), Endo(..), Dual(..)) import Data.Traversable (Traversable(traverse), sequenceA) import Prelude hiding ( - null, length, take, drop, splitAt, + lookup, null, length, take, drop, splitAt, foldl, foldl1, foldr, foldr1, scanl, scanl1, scanr, scanr1, filter, reverse, replicate, zip, zipWith, zip3, zipWith3, all, sum) @@ -72,6 +72,7 @@ main = defaultMain , testProperty "unstableSort" prop_unstableSort , testProperty "unstableSortBy" prop_unstableSortBy , testProperty "index" prop_index + , testProperty "(!?)" prop_safeIndex , testProperty "adjust" prop_adjust , testProperty "insertAt" prop_insertAt , testProperty "update" prop_update @@ -482,14 +483,17 @@ prop_index xs = not (null xs) ==> forAll (choose (0, length xs-1)) $ \ i -> index xs i == toList xs !! i --- We take an element and a sequence, and make sure we can insert --- the element anywhere in or near the sequence. +prop_safeIndex :: Seq A -> Property +prop_safeIndex xs = + forAll (choose (-3, length xs + 3)) $ \i -> + ((i < 0 || i >= length xs) .&&. lookup i xs === Nothing) .||. + lookup i xs === Just (toList xs !! i) + prop_insertAt :: A -> Seq A -> Property -prop_insertAt x xs = conjoin [insertAt_index i | i <- [(-3)..(length xs + 3)]] - where - insertAt_index i = - valid res .&&. res === case splitAt i xs of (front, back) -> front >< x <| back - where res = insertAt i x xs +prop_insertAt x xs = + forAll (choose (-3, length xs + 3)) $ \i -> + let res = insertAt i x xs + in valid res .&&. res === case splitAt i xs of (front, back) -> front >< x <| back prop_adjust :: Int -> Int -> Seq Int -> Bool prop_adjust n i xs = @@ -512,13 +516,13 @@ prop_splitAt :: Int -> Seq A -> Bool prop_splitAt n xs = toListPair' (splitAt n xs) ~= Prelude.splitAt n (toList xs) -prop_chunksOf :: Positive Int -> Seq A -> Bool -prop_chunksOf (Positive n') xs = - valid chunks && - getAll (foldMap (All . (\c -> valid c && length c <= n)) chunks) && - fold chunks == xs - where chunks = chunksOf n xs - n = max 1 (n' `rem` (length xs + 3)) +prop_chunksOf :: Seq A -> Property +prop_chunksOf xs = + forAll (choose (1, length xs + 3)) $ \n -> + let chunks = chunksOf n xs + in valid chunks .&&. + conjoin [valid c .&&. 1 <= length c && length c <= n | c <- toList chunks] .&&. + fold chunks === xs adjustList :: (a -> a) -> Int -> [a] -> [a] adjustList f i xs = From git at git.haskell.org Mon Apr 17 21:42:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:42:46 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Add alterF for Data.IntMap (e04d19c) Message-ID: <20170417214246.B16733A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/e04d19c29532757d4880f72a74cf676c43ffaaaf >--------------------------------------------------------------- commit e04d19c29532757d4880f72a74cf676c43ffaaaf Author: David Feuer Date: Wed May 25 03:17:14 2016 -0400 Add alterF for Data.IntMap The implementation is just taken from `Control.Lens.At`, because `IntMap` lookup is so fast there's no point in trying to be clever about it. Clear up unused-binding warning in `Data.Sequence`. >--------------------------------------------------------------- e04d19c29532757d4880f72a74cf676c43ffaaaf Data/IntMap/Base.hs | 37 +++++++++++++++++++++++++++++++++++++ Data/IntMap/Lazy.hs | 1 + Data/IntMap/Strict.hs | 41 +++++++++++++++++++++++++++++++++++++++++ Data/Sequence.hs | 2 +- changelog.md | 2 +- 5 files changed, 81 insertions(+), 2 deletions(-) diff --git a/Data/IntMap/Base.hs b/Data/IntMap/Base.hs index 6a4c0dc..a585328 100644 --- a/Data/IntMap/Base.hs +++ b/Data/IntMap/Base.hs @@ -90,6 +90,7 @@ module Data.IntMap.Base ( , updateWithKey , updateLookupWithKey , alter + , alterF -- * Combine @@ -835,6 +836,42 @@ alter f k Nil = case f Nothing of Just x -> Tip k x Nothing -> Nil +-- | /O(log n)/. The expression (@'alterF' f k map@) alters the value @x@ at +-- @k@, or absence thereof. 'alterF' can be used to inspect, insert, delete, +-- or update a value in an 'IntMap'. In short : @'lookup' k <$> 'alterF' f k m = f +-- ('lookup' k m)@. +-- +-- Example: +-- +-- @ +-- interactiveAlter :: Int -> IntMap String -> IO (IntMap String) +-- interactiveAlter k m = alterF f k m where +-- f Nothing -> do +-- putStrLn $ show k ++ +-- " was not found in the map. Would you like to add it?" +-- getUserResponse1 :: IO (Maybe String) +-- f (Just old) -> do +-- putStrLn "The key is currently bound to " ++ show old ++ +-- ". Would you like to change or delete it?" +-- getUserresponse2 :: IO (Maybe String) +-- @ +-- +-- 'alterF' is the most general operation for working with an individual +-- key that may or may not be in a given map. +-- +-- Note: 'alterF' is a flipped version of the 'at' combinator from +-- 'Control.Lens.At'. +-- +-- @since 0.5.8 + +alterF :: Functor f + => (Maybe a -> f (Maybe a)) -> Key -> IntMap a -> f (IntMap a) +-- This implementation was stolen from 'Control.Lens.At'. +alterF f k m = (<$> f mv) $ \fres -> + case fres of + Nothing -> maybe m (const (delete k m)) mv + Just v' -> insert k v' m + where mv = lookup k m {-------------------------------------------------------------------- Union diff --git a/Data/IntMap/Lazy.hs b/Data/IntMap/Lazy.hs index d3c0c1d..8283017 100644 --- a/Data/IntMap/Lazy.hs +++ b/Data/IntMap/Lazy.hs @@ -96,6 +96,7 @@ module Data.IntMap.Lazy ( , updateWithKey , updateLookupWithKey , alter + , alterF -- * Combine diff --git a/Data/IntMap/Strict.hs b/Data/IntMap/Strict.hs index 64fdd9d..b084d01 100644 --- a/Data/IntMap/Strict.hs +++ b/Data/IntMap/Strict.hs @@ -228,6 +228,7 @@ import Data.IntMap.Base hiding , updateWithKey , updateLookupWithKey , alter + , alterF , unionsWith , unionWith , unionWithKey @@ -267,6 +268,9 @@ import Data.Utils.StrictPair #if __GLASGOW_HASKELL__ >= 709 import Data.Coerce #endif +#if !MIN_VERSION_base(4,8,0) +import Data.Functor((<$>)) +#endif -- $strictness -- @@ -537,6 +541,43 @@ alter f !k t = Just !x -> Tip k x Nothing -> Nil +-- | /O(log n)/. The expression (@'alterF' f k map@) alters the value @x@ at +-- @k@, or absence thereof. 'alterF' can be used to inspect, insert, delete, +-- or update a value in an 'IntMap'. In short : @'lookup' k <$> 'alterF' f k m = f +-- ('lookup' k m)@. +-- +-- Example: +-- +-- @ +-- interactiveAlter :: Int -> IntMap String -> IO (IntMap String) +-- interactiveAlter k m = alterF f k m where +-- f Nothing -> do +-- putStrLn $ show k ++ +-- " was not found in the map. Would you like to add it?" +-- getUserResponse1 :: IO (Maybe String) +-- f (Just old) -> do +-- putStrLn "The key is currently bound to " ++ show old ++ +-- ". Would you like to change or delete it?" +-- getUserresponse2 :: IO (Maybe String) +-- @ +-- +-- 'alterF' is the most general operation for working with an individual +-- key that may or may not be in a given map. + +-- Note: 'alterF' is a flipped version of the 'at' combinator from +-- 'Control.Lens.At'. +-- +-- @since 0.5.8 + +alterF :: Functor f + => (Maybe a -> f (Maybe a)) -> Key -> IntMap a -> f (IntMap a) +-- This implementation was modified from 'Control.Lens.At'. +alterF f k m = (<$> f mv) $ \fres -> + case fres of + Nothing -> maybe m (const (delete k m)) mv + Just !v' -> insert k v' m + where mv = lookup k m + {-------------------------------------------------------------------- Union diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 46ae543..85d255c 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -1047,7 +1047,7 @@ replicateM n x -- @since 0.5.8 cycleN :: Int -> Seq a -> Seq a cycleN n !_xs | n < 0 = error "cycleN takes a non-negative argument" -cycleN n xs | null xs = error "cycleN takes a non-empty sequence" +cycleN _n xs | null xs = error "cycleN takes a non-empty sequence" cycleN n xs = cycleNTimes reps xs >< take final xs where (reps, final) = n `quotRem` length xs diff --git a/changelog.md b/changelog.md index af5f88c..2b889b5 100644 --- a/changelog.md +++ b/changelog.md @@ -15,7 +15,7 @@ * Use `BangPatterns` throughout to reduce noise. This extension is now *required* to compile `containers`. - * Add `alterF` for `Data.Map`. + * Add `alterF` for `Data.Map` and `Data.IntMap`. * Make `Data.Map.Strict.traverseWithKey` force result values before installing them in the new map. From git at git.haskell.org Mon Apr 17 21:42:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:42:48 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #260 from treeowl/alterF-IntMap (99bda3f) Message-ID: <20170417214248.BC4913A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/99bda3ff73afaef88de99de032efe0af0ed0b3f2 >--------------------------------------------------------------- commit 99bda3ff73afaef88de99de032efe0af0ed0b3f2 Merge: 85d9480 e04d19c Author: David Feuer Date: Sun May 29 23:49:00 2016 -0400 Merge pull request #260 from treeowl/alterF-IntMap Add alterF for Data.IntMap >--------------------------------------------------------------- 99bda3ff73afaef88de99de032efe0af0ed0b3f2 Data/IntMap/Base.hs | 37 +++++++++++++++++++++++++++++++++++++ Data/IntMap/Lazy.hs | 1 + Data/IntMap/Strict.hs | 41 +++++++++++++++++++++++++++++++++++++++++ Data/Sequence.hs | 2 +- changelog.md | 2 +- 5 files changed, 81 insertions(+), 2 deletions(-) From git at git.haskell.org Mon Apr 17 21:42:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:42:50 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #266 from treeowl/seq-safe-index (30b639f) Message-ID: <20170417214250.C71173A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/30b639f1f6288b4a0a9e2e70785ec59b472280c7 >--------------------------------------------------------------- commit 30b639f1f6288b4a0a9e2e70785ec59b472280c7 Merge: 99bda3f e60c648 Author: David Feuer Date: Sun May 29 23:49:35 2016 -0400 Merge pull request #266 from treeowl/seq-safe-index Add lookup and (!?) to Data.Sequence >--------------------------------------------------------------- 30b639f1f6288b4a0a9e2e70785ec59b472280c7 Data/Sequence.hs | 38 +++++++++++++++++++++++++++++++++++++- changelog.md | 4 ++-- tests/seq-properties.hs | 34 +++++++++++++++++++--------------- 3 files changed, 58 insertions(+), 18 deletions(-) From git at git.haskell.org Mon Apr 17 21:42:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:42:52 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Rename cycleN to cycleTaking (1dbe8b3) Message-ID: <20170417214252.D2B413A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/1dbe8b3af0cbe08eb8d22b34dc9db4b09f09cece >--------------------------------------------------------------- commit 1dbe8b3af0cbe08eb8d22b34dc9db4b09f09cece Author: David Feuer Date: Mon May 30 00:03:11 2016 -0400 Rename cycleN to cycleTaking Make cycleTaking more tolerant of edge cases to match list equivalent. Add QuickCheck property. >--------------------------------------------------------------- 1dbe8b3af0cbe08eb8d22b34dc9db4b09f09cece Data/Sequence.hs | 20 ++++++++++---------- changelog.md | 2 +- tests/seq-properties.hs | 5 +++++ 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 6a00472..335df84 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -102,7 +102,7 @@ module Data.Sequence ( replicate, -- :: Int -> a -> Seq a replicateA, -- :: Applicative f => Int -> f a -> f (Seq a) replicateM, -- :: Monad m => Int -> m a -> m (Seq a) - cycleN, -- :: Int -> Seq a -> Seq a + cycleTaking, -- :: Int -> Seq a -> Seq a -- ** Iterative construction iterateN, -- :: Int -> (a -> a) -> a -> Seq a unfoldr, -- :: (b -> Maybe (a, b)) -> b -> Seq a @@ -1043,21 +1043,21 @@ replicateM n x | n >= 0 = unwrapMonad (replicateA n (WrapMonad x)) | otherwise = error "replicateM takes a nonnegative integer argument" --- | /O(log(k))/ incremental. @'cycleN' k xs@ forms a sequence of length @k@ by --- repeatedly concatenating @xs@ with itself. @xs@ must not be empty and --- @k@ must not be negative. +-- | /O(log(k))/ incremental. @'cycleTaking' k xs@ forms a sequence of length @k@ by +-- repeatedly concatenating @xs@ with itself. @xs@ may only be empty if +-- @k@ is 0. -- --- prop> cycleN k = fromList . take k . cycle . toList +-- prop> cycleTaking k = fromList . take k . cycle . toList -- If you wish to concatenate a non-empty sequence @xs@ with itself precisely --- @k@ times, you can use @cycleN (k * length xs)@ or just +-- @k@ times, you can use @cycleTaking (k * length xs)@ or just -- @replicate k () *> xs at . -- -- @since 0.5.8 -cycleN :: Int -> Seq a -> Seq a -cycleN n !_xs | n < 0 = error "cycleN takes a non-negative argument" -cycleN _n xs | null xs = error "cycleN takes a non-empty sequence" -cycleN n xs = cycleNTimes reps xs >< take final xs +cycleTaking :: Int -> Seq a -> Seq a +cycleTaking n !_xs | n <= 0 = empty +cycleTaking _n xs | null xs = error "cycleTaking cannot take a positive number of elements from an empty cycle." +cycleTaking n xs = cycleNTimes reps xs >< take final xs where (reps, final) = n `quotRem` length xs diff --git a/changelog.md b/changelog.md index 8ce2061..6a83c08 100644 --- a/changelog.md +++ b/changelog.md @@ -22,7 +22,7 @@ * Add `Empty`, `:<|`, and `:|>` pattern synonyms for `Data.Sequence`. - * Add (!?), `lookup`, `chunksOf`, `cycleN`, `insertAt`, `intersperse`, + * Add (!?), `lookup`, `chunksOf`, `cycleTaking`, `insertAt`, `intersperse`, `foldMapWithIndex`, and `traverseWithIndex` for `Data.Sequence`. * Make `splitAt` in `Data.Sequence` strict in its arguments. Previously, diff --git a/tests/seq-properties.hs b/tests/seq-properties.hs index 2b9745b..c24c7e8 100644 --- a/tests/seq-properties.hs +++ b/tests/seq-properties.hs @@ -103,6 +103,7 @@ main = defaultMain , testProperty "zipWith4" prop_zipWith4 , testProperty "<*>" prop_ap , testProperty "*>" prop_then + , testProperty "cycleTaking" prop_cycleTaking , testProperty "intersperse" prop_intersperse , testProperty ">>=" prop_bind ] @@ -649,6 +650,10 @@ prop_intersperse :: A -> Seq A -> Bool prop_intersperse x xs = toList' (intersperse x xs) ~= Data.List.intersperse x (toList xs) +prop_cycleTaking :: Int -> Seq A -> Property +prop_cycleTaking n xs = + (n <= 0 || not (null xs)) ==> toList' (cycleTaking n xs) ~= Data.List.take n (Data.List.cycle (toList xs)) + -- Monad operations prop_bind :: Seq A -> Fun A (Seq B) -> Bool From git at git.haskell.org Mon Apr 17 21:42:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:42:54 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #267 from treeowl/rename-cycleN (d4a1ce8) Message-ID: <20170417214254.DAA913A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/d4a1ce8506a20c13fc2963b0bced972c49e17d05 >--------------------------------------------------------------- commit d4a1ce8506a20c13fc2963b0bced972c49e17d05 Merge: 30b639f 1dbe8b3 Author: David Feuer Date: Mon May 30 00:51:38 2016 -0400 Merge pull request #267 from treeowl/rename-cycleN Rename cycleN to cycleTaking >--------------------------------------------------------------- d4a1ce8506a20c13fc2963b0bced972c49e17d05 Data/Sequence.hs | 20 ++++++++++---------- changelog.md | 2 +- tests/seq-properties.hs | 5 +++++ 3 files changed, 16 insertions(+), 11 deletions(-) From git at git.haskell.org Mon Apr 17 21:42:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:42:56 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Add insertAt benchmark (a3f3921) Message-ID: <20170417214256.E66F93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/a3f39212419df9e74b4a0f489a01b55a00db664e >--------------------------------------------------------------- commit a3f39212419df9e74b4a0f489a01b55a00db664e Author: David Feuer Date: Mon May 30 00:46:58 2016 -0400 Add insertAt benchmark Make `insertAt` rebuild the tree eagerly, which saves a little time and avoids the possibility that large thunks will build up at the root of the tree when multiple elements are inserted. For long sequences `insertAt` is around 4.6 times as fast as splitting the sequence and re-forming it around the new element. >--------------------------------------------------------------- a3f39212419df9e74b4a0f489a01b55a00db664e Data/Sequence.hs | 5 +++-- benchmarks/Sequence.hs | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 335df84..46a6e0f 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -1788,8 +1788,9 @@ insTree f i (Single x) = case f i x of insTree f i (Deep s pr m sf) | i < spr = case insLeftDigit f i pr of InsLeftDig pr' -> Deep (s + 1) pr' m sf - InsDigNode pr' n -> Deep (s + 1) pr' (consTree n m) sf - | i < spm = Deep (s + 1) pr (insTree (insNode f) (i - spr) m) sf + InsDigNode pr' n -> Deep (s + 1) pr' (n `consTree` m) sf + | i < spm = let !m' = insTree (insNode f) (i - spr) m + in Deep (s + 1) pr m' sf | otherwise = case insRightDigit f (i - spm) sf of InsRightDig sf' -> Deep (s + 1) pr m sf' InsNodeDig n sf' -> Deep (s + 1) pr (m `snocTree` n) sf' diff --git a/benchmarks/Sequence.hs b/benchmarks/Sequence.hs index dd30067..717daf9 100644 --- a/benchmarks/Sequence.hs +++ b/benchmarks/Sequence.hs @@ -35,6 +35,11 @@ main = do , bench "100" $ nf (shuffle r100) s100 , bench "1000" $ nf (shuffle r1000) s1000 ] + , bgroup "insertAt" + [ bench "10" $ nf (insertAtPoints r10 10) s10 + , bench "100" $ nf (insertAtPoints r100 10) s100 + , bench "1000" $ nf (insertAtPoints r1000 10) s1000 + ] , bgroup "traverseWithIndex/State" [ bench "10" $ nf multiplyDown s10 , bench "100" $ nf multiplyDown s100 @@ -85,6 +90,17 @@ main = do ] ] +{- +-- This is around 4.6 times as slow as insertAt +fakeInsertAt :: Int -> a -> S.Seq a -> S.Seq a +fakeInsertAt i x xs = case S.splitAt i xs of + (before, after) -> before S.>< x S.<| after +-} + +insertAtPoints :: [Int] -> a -> S.Seq a -> S.Seq a +insertAtPoints points x xs = + foldl' (\acc k -> S.insertAt k x acc) xs points + -- splitAt+append: repeatedly cut the sequence at a random point -- and rejoin the pieces in the opposite order. -- Finally getting the middle element forces the whole spine. From git at git.haskell.org Mon Apr 17 21:42:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:42:58 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #268 from treeowl/bench-insertAt (ad9a50c) Message-ID: <20170417214258.EE5CC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/ad9a50c73bf63333051493d353de1349335e1a00 >--------------------------------------------------------------- commit ad9a50c73bf63333051493d353de1349335e1a00 Merge: d4a1ce8 a3f3921 Author: David Feuer Date: Mon May 30 00:54:51 2016 -0400 Merge pull request #268 from treeowl/bench-insertAt Add insertAt benchmark >--------------------------------------------------------------- ad9a50c73bf63333051493d353de1349335e1a00 Data/Sequence.hs | 5 +++-- benchmarks/Sequence.hs | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) From git at git.haskell.org Mon Apr 17 21:43:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:43:01 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Add deleteAt to Data.Sequence (40c8190) Message-ID: <20170417214301.060BE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/40c8190d2fff0b3ba2985454668642315f6a2c53 >--------------------------------------------------------------- commit 40c8190d2fff0b3ba2985454668642315f6a2c53 Author: David Feuer Date: Mon May 30 18:44:00 2016 -0400 Add deleteAt to Data.Sequence This is messy, and may remain so, but it would be nice to find some way to clean it up a bit. Also, we can and should be more eager about rebuilding and should look for opportunities to use arithmetic to figure out sizes. >--------------------------------------------------------------- 40c8190d2fff0b3ba2985454668642315f6a2c53 Data/Sequence.hs | 238 ++++++++++++++++++++++++++++++++++++++++++++++++ benchmarks/Sequence.hs | 19 ++++ tests/seq-properties.hs | 9 ++ 3 files changed, 266 insertions(+) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 40c8190d2fff0b3ba2985454668642315f6a2c53 From git at git.haskell.org Mon Apr 17 21:43:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:43:03 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #270 from treeowl/seq-delete (1adb22c) Message-ID: <20170417214303.109F73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/1adb22cd3fd85a330fbfe1c642edcd7d38b24a33 >--------------------------------------------------------------- commit 1adb22cd3fd85a330fbfe1c642edcd7d38b24a33 Merge: ad9a50c 40c8190 Author: David Feuer Date: Mon May 30 19:34:20 2016 -0400 Merge pull request #270 from treeowl/seq-delete Add deleteAt to Data.Sequence >--------------------------------------------------------------- 1adb22cd3fd85a330fbfe1c642edcd7d38b24a33 Data/Sequence.hs | 238 ++++++++++++++++++++++++++++++++++++++++++++++++ benchmarks/Sequence.hs | 19 ++++ tests/seq-properties.hs | 9 ++ 3 files changed, 266 insertions(+) From git at git.haskell.org Mon Apr 17 21:43:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:43:05 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Update changelog.md (4ae483e) Message-ID: <20170417214305.1825D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/4ae483ece23611349fca38f39309a47890b677ce >--------------------------------------------------------------- commit 4ae483ece23611349fca38f39309a47890b677ce Author: David Feuer Date: Mon May 30 19:36:56 2016 -0400 Update changelog.md >--------------------------------------------------------------- 4ae483ece23611349fca38f39309a47890b677ce changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 6a83c08..e51dbe2 100644 --- a/changelog.md +++ b/changelog.md @@ -22,7 +22,7 @@ * Add `Empty`, `:<|`, and `:|>` pattern synonyms for `Data.Sequence`. - * Add (!?), `lookup`, `chunksOf`, `cycleTaking`, `insertAt`, `intersperse`, + * Add (!?), `lookup`, `chunksOf`, `cycleTaking`, `insertAt`, `deleteAt`, `intersperse`, `foldMapWithIndex`, and `traverseWithIndex` for `Data.Sequence`. * Make `splitAt` in `Data.Sequence` strict in its arguments. Previously, From git at git.haskell.org Mon Apr 17 21:43:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:43:07 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Some cleanup of deleteAt (06c5430) Message-ID: <20170417214307.243643A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/06c543022c73aa5ea842b2391f795003d9d9eebd >--------------------------------------------------------------- commit 06c543022c73aa5ea842b2391f795003d9d9eebd Author: David Feuer Date: Mon May 30 23:58:23 2016 -0400 Some cleanup of deleteAt Use arithmetic to avoid inspecting nodes and build some things more eagerly. >--------------------------------------------------------------- 06c543022c73aa5ea842b2391f795003d9d9eebd Data/Sequence.hs | 286 ++++++++++++++++++++++++++++--------------------- benchmarks/Sequence.hs | 4 + 2 files changed, 170 insertions(+), 120 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 06c543022c73aa5ea842b2391f795003d9d9eebd From git at git.haskell.org Mon Apr 17 21:43:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:43:09 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #272 from treeowl/seq-delete-cleanup (b8f7e92) Message-ID: <20170417214309.2CE5C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/b8f7e92fb8b9be4f69a9f7d0c23c190fd835a151 >--------------------------------------------------------------- commit b8f7e92fb8b9be4f69a9f7d0c23c190fd835a151 Merge: 4ae483e 06c5430 Author: David Feuer Date: Tue May 31 01:20:13 2016 -0400 Merge pull request #272 from treeowl/seq-delete-cleanup Some cleanup of deleteAt >--------------------------------------------------------------- b8f7e92fb8b9be4f69a9f7d0c23c190fd835a151 Data/Sequence.hs | 286 ++++++++++++++++++++++++++++--------------------- benchmarks/Sequence.hs | 4 + 2 files changed, 170 insertions(+), 120 deletions(-) From git at git.haskell.org Mon Apr 17 21:43:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:43:11 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394: Sequences: strictify adjust; reimplement update (fc8c1aa) Message-ID: <20170417214311.392553A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/fc8c1aadf43220a6db5728cec9a3b4551ee83228 >--------------------------------------------------------------- commit fc8c1aadf43220a6db5728cec9a3b4551ee83228 Author: David Feuer Date: Tue May 31 09:55:52 2016 -0400 Sequences: strictify adjust; reimplement update Previously, `adjust` would place a thunk at the top of the tree. Now, it pushes that thunk all the way down to the appropriate leaf. This way, performing multiple adjustments to different locations will not lead to a thunk clog at the top. Adjusting the *same* location many times, however, can lead to a thunk clog at the leaf. This is generally unavoidable. `update` used to be implemented as ```haskell update i x = adjust (const x) i ``` which is subject to the thunk clog problem. By implementing the `Elem` layer of `update` directly (duplicating code), we can avoid subjecting `update` to this problem at all. Also, bring all the insertion code together. It got separated by mistake. Actually export `alterF` from `Data.IntMap.Strict`. >--------------------------------------------------------------- fc8c1aadf43220a6db5728cec9a3b4551ee83228 Data/IntMap/Strict.hs | 1 + Data/Sequence.hs | 305 +++++++++++++++++++++++++++++++------------------ benchmarks/Sequence.hs | 26 +++++ 3 files changed, 222 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 fc8c1aadf43220a6db5728cec9a3b4551ee83228 From git at git.haskell.org Mon Apr 17 21:43:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:43:13 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #273 from treeowl/eager-adjust (c5728d6) Message-ID: <20170417214313.42A0B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/c5728d605db21b5ab8b93e4cea92156f10e9b475 >--------------------------------------------------------------- commit c5728d605db21b5ab8b93e4cea92156f10e9b475 Merge: b8f7e92 fc8c1aa Author: David Feuer Date: Tue May 31 11:35:19 2016 -0400 Merge pull request #273 from treeowl/eager-adjust Sequences: strictify adjust; reimplement update >--------------------------------------------------------------- c5728d605db21b5ab8b93e4cea92156f10e9b475 Data/IntMap/Strict.hs | 1 + Data/Sequence.hs | 305 +++++++++++++++++++++++++++++++------------------ benchmarks/Sequence.hs | 26 +++++ 3 files changed, 222 insertions(+), 110 deletions(-) From git at git.haskell.org Mon Apr 17 21:43:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:43:15 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Make `intersperse` work right up to the edge (#276) (af1e36e) Message-ID: <20170417214315.4B8B53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/af1e36e5fd48ef4111e00f607dbcc794071d79b0 >--------------------------------------------------------------- commit af1e36e5fd48ef4111e00f607dbcc794071d79b0 Author: David Feuer Date: Tue May 31 13:29:20 2016 -0400 Make `intersperse` work right up to the edge (#276) Previously, `intersperse` would fail if passed a sequence of length ```haskell ((maxBound :: Int) `quot` 2) + 1 ``` Now it should be able to produce results of lengths right up to `maxBound :: Int`. >--------------------------------------------------------------- af1e36e5fd48ef4111e00f607dbcc794071d79b0 Data/Sequence.hs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 2899fc3..11c0ca8 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -640,7 +640,18 @@ thin12 s pr m (Four a b c d) = DeepTh s pr (thin $ m `snocTree` node2 a b) (Two1 -- -- @since 0.5.8 intersperse :: a -> Seq a -> Seq a -intersperse y xs = drop 1 $ xs <**> (const y <| singleton id) +intersperse y xs = case viewl xs of + EmptyL -> empty + p :< ps -> p <| (ps <**> (const y <| singleton id)) +-- We used to use +-- +-- intersperse y xs = drop 1 $ xs <**> (const y <| singleton id) +-- +-- but if length xs = ((maxBound :: Int) `quot` 2) + 1 then +-- +-- length (xs <**> (const y <| singleton id)) will wrap around to negative +-- and the drop won't work. The new implementation can produce a result +-- right up to maxBound :: Int instance MonadPlus Seq where mzero = empty From git at git.haskell.org Mon Apr 17 21:43:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:43:17 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Make >< build its result eagerly (#277) (068c970) Message-ID: <20170417214317.57EFD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/068c970370ad467fc042423f377a842866ff5e57 >--------------------------------------------------------------- commit 068c970370ad467fc042423f377a842866ff5e57 Author: David Feuer Date: Tue May 31 13:55:37 2016 -0400 Make >< build its result eagerly (#277) Previously, `><` only built the top of the tree, leaving the rest suspended lazily. Now it rebuilds eagerly, using the full time allocated to it. The improvements on the `splitAt/append` benchmark are modest but meaningful. More importantly, it should no longer be possible to use `><` to produce large chains of thunks. Fixes #274 Old: benchmarking splitAt/append/10 time 1.056 ms (1.050 ms .. 1.065 ms) 0.995 R² (0.983 R² .. 1.000 R²) mean 1.073 ms (1.057 ms .. 1.147 ms) std dev 97.06 μs (9.638 μs .. 221.7 μs) variance introduced by outliers: 68% (severely inflated) New: benchmarking splitAt/append/10 time 987.8 μs (982.7 μs .. 992.3 μs) 1.000 R² (0.999 R² .. 1.000 R²) mean 995.5 μs (994.6 μs .. 997.2 μs) std dev 3.845 μs (1.988 μs .. 6.390 μs) Old: benchmarking splitAt/append/100 time 8.028 ms (8.014 ms .. 8.046 ms) 1.000 R² (1.000 R² .. 1.000 R²) mean 8.041 ms (8.029 ms .. 8.075 ms) std dev 51.02 μs (16.07 μs .. 94.69 μs) New: benchmarking splitAt/append/100 time 7.382 ms (7.346 ms .. 7.427 ms) 1.000 R² (0.999 R² .. 1.000 R²) mean 7.374 ms (7.357 ms .. 7.430 ms) std dev 75.55 μs (41.64 μs .. 135.4 μs) Old: benchmarking splitAt/append/1000 time 15.30 ms (15.20 ms .. 15.41 ms) 1.000 R² (1.000 R² .. 1.000 R²) mean 15.32 ms (15.26 ms .. 15.45 ms) std dev 190.0 μs (89.60 μs .. 351.1 μs) New: benchmarking splitAt/append/1000 time 13.68 ms (13.61 ms .. 13.77 ms) 1.000 R² (1.000 R² .. 1.000 R²) mean 13.64 ms (13.59 ms .. 13.69 ms) std dev 118.9 μs (89.45 μs .. 154.4 μs) >--------------------------------------------------------------- 068c970370ad467fc042423f377a842866ff5e57 Data/Sequence.hs | 63 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 33 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 068c970370ad467fc042423f377a842866ff5e57 From git at git.haskell.org Mon Apr 17 21:43:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:43:19 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Use ScopedTypeVariables to optimize zipping (#280) (c37a5bb) Message-ID: <20170417214319.61E813A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/c37a5bb59228f7976792dc1a2013a2442f39b41b >--------------------------------------------------------------- commit c37a5bb59228f7976792dc1a2013a2442f39b41b Author: David Feuer Date: Wed Jun 1 19:37:28 2016 -0400 Use ScopedTypeVariables to optimize zipping (#280) `splitMap` was annoyingly sensitive to any minor change anywhere, presumably because it was tough on the inliner. Using `ScopedTypeVariables` when compiling with GHC, we can pull the splitting function out of the polymorphic recursion. Suddenly GHC starts unboxing `Int`s and generally acting like a happier compiler. I'm hopeful that `ScopedTypeVariables` will be in the next standard so we can eventually drop the other code. Also, modify the `Split` type to make it more obvious that we only force things we're allowed to. Also also, make `chunksOf` a bit more tolerant. Now it only complains if it's asked to produce non-positive-sized chunks of a non-empty sequence. >--------------------------------------------------------------- c37a5bb59228f7976792dc1a2013a2442f39b41b Data/Sequence.hs | 101 ++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 82 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 c37a5bb59228f7976792dc1a2013a2442f39b41b From git at git.haskell.org Mon Apr 17 21:43:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:43:21 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Write custom strict folds (#281) (4e4d4e9) Message-ID: <20170417214321.6F1CB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/4e4d4e9b6b3eff25b443dbabc913239632295f51 >--------------------------------------------------------------- commit 4e4d4e9b6b3eff25b443dbabc913239632295f51 Author: David Feuer Date: Wed Jun 1 22:20:50 2016 -0400 Write custom strict folds (#281) Writing `foldl'` and `foldr'` by hand, instead of using the default definitions, makes them about twice as fast. Fix completely bogus definition of `length` for `ViewR`. >--------------------------------------------------------------- 4e4d4e9b6b3eff25b443dbabc913239632295f51 Data/Sequence.hs | 75 +++++++++++++++++++++++++++++++++++++++++++++---- benchmarks/Sequence.hs | 14 ++++++++- changelog.md | 5 ++++ tests/seq-properties.hs | 26 +++++++++++++---- 4 files changed, 108 insertions(+), 12 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 4e4d4e9b6b3eff25b443dbabc913239632295f51 From git at git.haskell.org Mon Apr 17 21:43:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:43:23 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Update .travis.yml with new GHC versions (#282) (c002e0f) Message-ID: <20170417214323.76BF23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/c002e0fbd2b327f26b3c0eeb3c9424d4d1657434 >--------------------------------------------------------------- commit c002e0fbd2b327f26b3c0eeb3c9424d4d1657434 Author: Ossi Herrala Date: Sun Jun 5 00:41:40 2016 +0300 Update .travis.yml with new GHC versions (#282) Add GHC 8.0.1 and replace 7.10.1 with 7.10.3. Fixes #269 >--------------------------------------------------------------- c002e0fbd2b327f26b3c0eeb3c9424d4d1657434 .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9505f69..c8cd29f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,8 @@ env: - GHCVER=7.4.2 CABALVER=1.16 - GHCVER=7.6.3 CABALVER=1.16 - GHCVER=7.8.4 CABALVER=1.18 - - GHCVER=7.10.1 CABALVER=1.22 + - GHCVER=7.10.3 CABALVER=1.22 + - GHCVER=8.0.1 CABALVER=1.24 - GHCVER=head CABALVER=head matrix: From git at git.haskell.org Mon Apr 17 21:43:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:43:25 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Corrected drawTree to render multi-line String values in a palatable manner. (10e41ec) Message-ID: <20170417214325.7DD413A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/10e41ecce2bb55a491dee31356b41acac1e2a4db >--------------------------------------------------------------- commit 10e41ecce2bb55a491dee31356b41acac1e2a4db Author: recursion-ninja Date: Thu Jun 9 19:39:19 2016 -0400 Corrected drawTree to render multi-line String values in a palatable manner. >--------------------------------------------------------------- 10e41ecce2bb55a491dee31356b41acac1e2a4db Data/Tree.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Data/Tree.hs b/Data/Tree.hs index c35d0ed..f4cf2e9 100644 --- a/Data/Tree.hs +++ b/Data/Tree.hs @@ -134,7 +134,7 @@ drawForest :: Forest String -> String drawForest = unlines . map drawTree draw :: Tree String -> [String] -draw (Node x ts0) = x : drawSubTrees ts0 +draw (Node x ts0) = lines x ++ drawSubTrees ts0 where drawSubTrees [] = [] drawSubTrees [t] = From git at git.haskell.org Mon Apr 17 21:43:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:43:27 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Make traverse fmap less (2726d15) Message-ID: <20170417214327.876913A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/2726d15e6f66e0c1b863075655841d040d6fa540 >--------------------------------------------------------------- commit 2726d15e6f66e0c1b863075655841d040d6fa540 Author: David Feuer Date: Fri Jun 10 00:42:11 2016 -0400 Make traverse fmap less Use safe coercions to avoid `fmap` at the leaves to deal with `Elem` and at the root to deal with `Seq`. This should speed things up for non-trivial functors. >--------------------------------------------------------------- 2726d15e6f66e0c1b863075655841d040d6fa540 Data/Sequence.hs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 82afd61..0bd3bbe 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -404,8 +404,29 @@ instance Foldable Seq where {-# INLINE null #-} #endif +#if __GLASGOW_HASKELL__ >= 708 +-- The natural definition of traverse, used for implementations that don't +-- support coercions, `fmap`s into each `Elem`, then `fmap`s again over the +-- result to turn it from a `FingerTree` to a `Seq`. None of this mapping is +-- necessary! We could avoid it without coercions, I believe, by writing a +-- bunch of traversal functions to deal with the `Elem` stuff specially (for +-- FingerTrees, Digits, and Nodes), but using coercions we only need to +-- duplicate code at the FingerTree level. We coerce the `Seq a` to a +-- `FingerTree a`, stripping off all the Elem junk, then use a weird FingerTree +-- traversing function that coerces back to Seq within the functor. +instance Traversable Seq where + traverse f (Seq xs) = traverseFTE f (coerce xs) + +traverseFTE :: Applicative f => (a -> f b) -> FingerTree a -> f (Seq b) +traverseFTE _f EmptyT = pure empty +traverseFTE f (Single x) = Seq . Single . Elem <$> f x +traverseFTE f (Deep s pr m sf) = + (\pr' m' sf' -> coerce $ Deep s pr' m' sf') <$> + traverse f pr <*> traverse (traverse f) m <*> traverse f sf +#else instance Traversable Seq where traverse f (Seq xs) = Seq <$> traverse (traverse f) xs +#endif instance NFData a => NFData (Seq a) where rnf (Seq xs) = rnf xs From git at git.haskell.org Mon Apr 17 21:43:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:43:29 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #284 from treeowl/seq-traverse-map-less (88b60ad) Message-ID: <20170417214329.9096C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/88b60adec7f446fcddfd9c5ab4ee637fcad28c8f >--------------------------------------------------------------- commit 88b60adec7f446fcddfd9c5ab4ee637fcad28c8f Merge: c002e0f 2726d15 Author: David Feuer Date: Fri Jun 10 01:05:50 2016 -0400 Merge pull request #284 from treeowl/seq-traverse-map-less Make traverse fmap less >--------------------------------------------------------------- 88b60adec7f446fcddfd9c5ab4ee637fcad28c8f Data/Sequence.hs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) From git at git.haskell.org Mon Apr 17 21:43:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:43:31 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Be more eager about building by consing (74034b3) Message-ID: <20170417214331.9AE243A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/74034b3244fa4817c7bef1202e639b887a975d9e >--------------------------------------------------------------- commit 74034b3244fa4817c7bef1202e639b887a975d9e Author: David Feuer Date: Fri Jun 10 15:17:46 2016 -0400 Be more eager about building by consing Also make `partition` build things much more eagerly. >--------------------------------------------------------------- 74034b3244fa4817c7bef1202e639b887a975d9e Data/Sequence.hs | 59 +++++++++++++++++++++++++++++++++++++++++++------- benchmarks/Sequence.hs | 6 +++++ 2 files changed, 57 insertions(+), 8 deletions(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 0bd3bbe..4ea1c57 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -253,7 +253,7 @@ import Data.Functor.Identity (Identity(..)) import Data.Word (Word) #endif -import Data.Utils.StrictPair (StrictPair (..)) +import Data.Utils.StrictPair (StrictPair (..), toPair) default () @@ -1259,6 +1259,32 @@ consTree a (Deep s (Two b c) m sf) = consTree a (Deep s (One b) m sf) = Deep (size a + s) (Two a b) m sf +cons' :: a -> Seq a -> Seq a +cons' x (Seq xs) = Seq (Elem x `consTree'` xs) + +snoc' :: Seq a -> a -> Seq a +snoc' (Seq xs) x = Seq (xs `snocTree'` Elem x) + +{-# SPECIALIZE consTree' :: Elem a -> FingerTree (Elem a) -> FingerTree (Elem a) #-} +{-# SPECIALIZE consTree' :: Node a -> FingerTree (Node a) -> FingerTree (Node a) #-} +consTree' :: Sized a => a -> FingerTree a -> FingerTree a +consTree' a EmptyT = Single a +consTree' a (Single b) = deep (One a) EmptyT (One b) +-- As described in the paper, we force the middle of a tree +-- *before* consing onto it; this preserves the amortized +-- bounds but prevents repeated consing from building up +-- gigantic suspensions. +consTree' a (Deep s (Four b c d e) m sf) = + Deep (size a + s) (Two a b) m' sf + where !m' = abc `consTree'` m + !abc = node3 c d e +consTree' a (Deep s (Three b c d) m sf) = + Deep (size a + s) (Four a b c d) m sf +consTree' a (Deep s (Two b c) m sf) = + Deep (size a + s) (Three a b c) m sf +consTree' a (Deep s (One b) m sf) = + Deep (size a + s) (Two a b) m sf + -- | /O(1)/. Add an element to the right end of a sequence. -- Mnemonic: a triangle with the single element at the pointy end. (|>) :: Seq a -> a -> Seq a @@ -1279,6 +1305,23 @@ snocTree (Deep s pr m (Two a b)) c = snocTree (Deep s pr m (One a)) b = Deep (s + size b) pr m (Two a b) +{-# SPECIALIZE snocTree' :: FingerTree (Elem a) -> Elem a -> FingerTree (Elem a) #-} +{-# SPECIALIZE snocTree' :: FingerTree (Node a) -> Node a -> FingerTree (Node a) #-} +snocTree' :: Sized a => FingerTree a -> a -> FingerTree a +snocTree' EmptyT a = Single a +snocTree' (Single a) b = deep (One a) EmptyT (One b) +-- See note on `seq` in `consTree`. +snocTree' (Deep s pr m (Four a b c d)) e = + Deep (s + size e) pr m' (Two d e) + where !m' = m `snocTree'` abc + !abc = node3 a b c +snocTree' (Deep s pr m (Three a b c)) d = + Deep (s + size d) pr m (Four a b c d) +snocTree' (Deep s pr m (Two a b)) c = + Deep (s + size c) pr m (Three a b c) +snocTree' (Deep s pr m (One a)) b = + Deep (s + size b) pr m (Two a b) + -- | /O(log(min(n1,n2)))/. Concatenate two sequences. (><) :: Seq a -> Seq a -> Seq a Seq xs >< Seq ys = Seq (appendTree0 xs ys) @@ -1526,12 +1569,12 @@ addDigits4 m1 (Four a b c d) !e !f !g !h (Four i j k l) m2 = unfoldr :: (b -> Maybe (a, b)) -> b -> Seq a unfoldr f = unfoldr' empty -- uses tail recursion rather than, for instance, the List implementation. - where unfoldr' as b = maybe as (\ (a, b') -> unfoldr' (as |> a) b') (f b) + where unfoldr' !as b = maybe as (\ (a, b') -> unfoldr' (as `snoc'` a) b') (f b) -- | @'unfoldl' f x@ is equivalent to @'reverse' ('unfoldr' ('fmap' swap . f) x)@. unfoldl :: (b -> Maybe (b, a)) -> b -> Seq a unfoldl f = unfoldl' empty - where unfoldl' as b = maybe as (\ (b', a) -> unfoldl' (a <| as) b') (f b) + where unfoldl' !as b = maybe as (\ (b', a) -> unfoldl' (a `cons'` as) b') (f b) -- | /O(n)/. Constructs a sequence by repeated application of a function -- to a seed value. @@ -3408,17 +3451,17 @@ breakr p xs = foldr (\ i _ -> flipPair (splitAt (i + 1) xs)) (xs, empty) (findIn -- sequence @xs@ and returns sequences of those elements which do and -- do not satisfy the predicate. partition :: (a -> Bool) -> Seq a -> (Seq a, Seq a) -partition p = foldl part (empty, empty) +partition p = toPair . foldl' part (empty :*: empty) where - part (xs, ys) x - | p x = (xs |> x, ys) - | otherwise = (xs, ys |> x) + part (xs :*: ys) x + | p x = (xs `snoc'` x) :*: ys + | otherwise = xs :*: (ys `snoc'` x) -- | /O(n)/. The 'filter' function takes a predicate @p@ and a sequence -- @xs@ and returns a sequence of those elements which satisfy the -- predicate. filter :: (a -> Bool) -> Seq a -> Seq a -filter p = foldl' (\ xs x -> if p x then xs |> x else xs) empty +filter p = foldl' (\ xs x -> if p x then xs `snoc'` x else xs) empty -- Indexing sequences diff --git a/benchmarks/Sequence.hs b/benchmarks/Sequence.hs index f8437e2..1d23929 100644 --- a/benchmarks/Sequence.hs +++ b/benchmarks/Sequence.hs @@ -35,6 +35,12 @@ main = do , bench "100" $ nf (shuffle r100) s100 , bench "1000" $ nf (shuffle r1000) s1000 ] + , bgroup "partition" + [ bench "10" $ nf (S.partition even) s10 + , bench "100" $ nf (S.partition even) s100 + , bench "1000" $ nf (S.partition even) s1000 + , bench "10000" $ nf (S.partition even) s10000 + ] , bgroup "foldl'" [ bench "10" $ nf (foldl' (+) 0) s10 , bench "100" $ nf (foldl' (+) 0) s100 From git at git.haskell.org Mon Apr 17 21:43:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:43:33 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #285 from treeowl/strictify-more-sequence (9102c06) Message-ID: <20170417214333.A43E43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/9102c062ea7f6523518d98b46a6fd47db72bab43 >--------------------------------------------------------------- commit 9102c062ea7f6523518d98b46a6fd47db72bab43 Merge: 88b60ad 74034b3 Author: David Feuer Date: Fri Jun 10 21:22:36 2016 -0400 Merge pull request #285 from treeowl/strictify-more-sequence Be more eager about building by consing >--------------------------------------------------------------- 9102c062ea7f6523518d98b46a6fd47db72bab43 Data/Sequence.hs | 59 +++++++++++++++++++++++++++++++++++++++++++------- benchmarks/Sequence.hs | 6 +++++ 2 files changed, 57 insertions(+), 8 deletions(-) From git at git.haskell.org Mon Apr 17 21:43:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:43:35 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #283 from recursion-ninja/master (ed43239) Message-ID: <20170417214335.AC7D03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/ed43239058dc02decf07ab144acde5dbb0aa1d53 >--------------------------------------------------------------- commit ed43239058dc02decf07ab144acde5dbb0aa1d53 Merge: 9102c06 10e41ec Author: David Feuer Date: Fri Jun 10 21:30:47 2016 -0400 Merge pull request #283 from recursion-ninja/master Corrected drawTree & drawForest to render multiline String values in a palatable manner. >--------------------------------------------------------------- ed43239058dc02decf07ab144acde5dbb0aa1d53 Data/Tree.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) From git at git.haskell.org Mon Apr 17 21:43:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:43:39 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #286 from treeowl/strictify-seq-fromList (4e45f42) Message-ID: <20170417214339.BF8B93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/4e45f427d59c58f8e5c24c489e1f7269ce7ff863 >--------------------------------------------------------------- commit 4e45f427d59c58f8e5c24c489e1f7269ce7ff863 Merge: ed43239 3731bd3 Author: David Feuer Date: Fri Jun 10 23:37:21 2016 -0400 Merge pull request #286 from treeowl/strictify-seq-fromList Make Data.Sequence.fromList more eager >--------------------------------------------------------------- 4e45f427d59c58f8e5c24c489e1f7269ce7ff863 Data/Sequence.hs | 55 ++++++++++++++++++++++++++++++++++---------------- benchmarks/Sequence.hs | 6 ++++++ changelog.md | 20 ++++++++++++------ 3 files changed, 58 insertions(+), 23 deletions(-) From git at git.haskell.org Mon Apr 17 21:43:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:43:37 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Make Data.Sequence.fromList more eager (3731bd3) Message-ID: <20170417214337.B59EF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/3731bd34720e9c41c052f8e725399f5c10a3b56c >--------------------------------------------------------------- commit 3731bd34720e9c41c052f8e725399f5c10a3b56c Author: David Feuer Date: Fri Jun 10 21:41:39 2016 -0400 Make Data.Sequence.fromList more eager `fromList` previously suspended most of its work, storing the structure in thunks rather than trees. Now it builds everything. Old: benchmarking fromList/10 time 175.2 ns (174.7 ns .. 175.7 ns) 1.000 R² (1.000 R² .. 1.000 R²) mean 175.2 ns (174.8 ns .. 175.6 ns) std dev 1.383 ns (1.124 ns .. 1.775 ns) benchmarking fromList/100 time 2.712 μs (2.707 μs .. 2.720 μs) 1.000 R² (1.000 R² .. 1.000 R²) mean 2.732 μs (2.717 μs .. 2.779 μs) std dev 76.64 ns (40.38 ns .. 147.1 ns) variance introduced by outliers: 35% (moderately inflated) benchmarking fromList/1000 time 32.24 μs (32.18 μs .. 32.33 μs) 1.000 R² (1.000 R² .. 1.000 R²) mean 32.26 μs (32.22 μs .. 32.35 μs) std dev 194.7 ns (100.0 ns .. 371.4 ns) benchmarking fromList/10000 time 510.3 μs (508.2 μs .. 511.9 μs) 1.000 R² (1.000 R² .. 1.000 R²) mean 508.1 μs (506.2 μs .. 509.8 μs) std dev 5.787 μs (4.788 μs .. 7.175 μs) New: benchmarking fromList/10 time 139.8 ns (139.5 ns .. 140.2 ns) 1.000 R² (1.000 R² .. 1.000 R²) mean 139.8 ns (139.6 ns .. 140.3 ns) std dev 1.023 ns (547.5 ps .. 1.573 ns) benchmarking fromList/100 time 1.520 μs (1.517 μs .. 1.525 μs) 1.000 R² (1.000 R² .. 1.000 R²) mean 1.522 μs (1.518 μs .. 1.529 μs) std dev 16.53 ns (10.57 ns .. 24.26 ns) benchmarking fromList/1000 time 16.00 μs (15.97 μs .. 16.05 μs) 1.000 R² (1.000 R² .. 1.000 R²) mean 15.99 μs (15.97 μs .. 16.04 μs) std dev 89.39 ns (39.63 ns .. 151.2 ns) benchmarking fromList/10000 time 262.8 μs (262.3 μs .. 263.5 μs) 1.000 R² (1.000 R² .. 1.000 R²) mean 262.8 μs (262.4 μs .. 264.7 μs) std dev 2.559 μs (757.4 ns .. 5.482 μs) >--------------------------------------------------------------- 3731bd34720e9c41c052f8e725399f5c10a3b56c Data/Sequence.hs | 55 ++++++++++++++++++++++++++++++++++---------------- benchmarks/Sequence.hs | 6 ++++++ changelog.md | 20 ++++++++++++------ 3 files changed, 58 insertions(+), 23 deletions(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 4ea1c57..d0d7ff1 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -3530,25 +3530,42 @@ findIndicesR p xs = foldlWithIndex g [] xs -- There is a function 'toList' in the opposite direction for all -- instances of the 'Foldable' class, including 'Seq'. fromList :: [a] -> Seq a -fromList = Seq . mkTree 1 . map_elem - where - {-# SPECIALIZE mkTree :: Int -> [Elem a] -> FingerTree (Elem a) #-} - {-# SPECIALIZE mkTree :: Int -> [Node a] -> FingerTree (Node a) #-} - mkTree :: (Sized a) => Int -> [a] -> FingerTree a - mkTree !_ [] = EmptyT - mkTree _ [x1] = Single x1 - mkTree s [x1, x2] = Deep (2*s) (One x1) EmptyT (One x2) - mkTree s [x1, x2, x3] = Deep (3*s) (One x1) EmptyT (Two x2 x3) - mkTree s (x1:x2:x3:x4:xs) = case getNodes (3*s) x4 xs of - (ns, sf) -> case mkTree (3*s) ns of +-- Note: we can avoid map_elem if we wish by scattering +-- Elem applications throughout mkTreeE and getNodesE, but +-- it gets a bit hard to read. +fromList = Seq . mkTreeE 1 . map_elem + where + mkTreeE :: Int -> [Elem a] -> FingerTree (Elem a) + mkTreeE !_ [] = EmptyT + mkTreeE _ [x1] = Single x1 + mkTreeE s [x1, x2] = Deep (2*s) (One x1) EmptyT (One x2) + mkTreeE s [x1, x2, x3] = Deep (3*s) (One x1) EmptyT (Two x2 x3) + mkTreeE s (x1:x2:x3:x4:xs) = case getNodesE (3*s) x4 xs of + ns :*: sf -> case mkTreeN (3*s) ns of !m -> Deep (3*size x1 + size m + size sf) (Three x1 x2 x3) m sf - getNodes :: Int -> a -> [a] -> ([Node a], Digit a) - getNodes !_ x1 [] = ([], One x1) - getNodes _ x1 [x2] = ([], Two x1 x2) - getNodes _ x1 [x2, x3] = ([], Three x1 x2 x3) - getNodes s x1 (x2:x3:x4:xs) = (Node3 s x1 x2 x3:ns, d) - where (ns, d) = getNodes s x4 xs + mkTreeN :: Int -> SList (Node a) -> FingerTree (Node a) + mkTreeN !_ SNil = EmptyT + mkTreeN _ (SCons x1 SNil) = Single x1 + mkTreeN s (SCons x1 (SCons x2 SNil)) = Deep (2*s) (One x1) EmptyT (One x2) + mkTreeN s (SCons x1 (SCons x2 (SCons x3 SNil))) = Deep (3*s) (One x1) EmptyT (Two x2 x3) + mkTreeN s (SCons x1 (SCons x2 (SCons x3 (SCons x4 xs)))) = case getNodesN (3*s) x4 xs of + ns :*: sf -> case mkTreeN (3*s) ns of + !m -> Deep (3*size x1 + size m + size sf) (Three x1 x2 x3) m sf + + getNodesE :: Int -> a -> [a] -> StrictPair (SList (Node a)) (Digit a) + getNodesE !_ x1 [] = SNil :*: One x1 + getNodesE _ x1 [x2] = SNil :*: Two x1 x2 + getNodesE _ x1 [x2, x3] = SNil :*: Three x1 x2 x3 + getNodesE s x1 (x2:x3:x4:xs) = SCons (Node3 s x1 x2 x3) ns :*: d + where !(ns :*: d) = getNodesE s x4 xs + + getNodesN :: Int -> Node a -> SList (Node a) -> StrictPair (SList (Node (Node a))) (Digit (Node a)) + getNodesN !_ x1 SNil = SNil :*: One x1 + getNodesN _ x1 (SCons x2 SNil) = SNil :*: Two x1 x2 + getNodesN _ x1 (SCons x2 (SCons x3 SNil)) = SNil :*: Three x1 x2 x3 + getNodesN s x1 (SCons x2 (SCons x3 (SCons x4 xs))) = SCons (Node3 s x1 x2 x3) ns :*: d + where !(ns :*: d) = getNodesN s x4 xs map_elem :: [a] -> [Elem a] #if __GLASGOW_HASKELL__ >= 708 @@ -3558,6 +3575,10 @@ fromList = Seq . mkTree 1 . map_elem #endif {-# INLINE map_elem #-} +-- A list strict in both its spine and elements. This seems to help +-- GHC avoid forcing things that are already forced in fromList. +data SList a = SNil | SCons !a !(SList a) + #if __GLASGOW_HASKELL__ >= 708 instance GHC.Exts.IsList (Seq a) where type Item (Seq a) = a diff --git a/benchmarks/Sequence.hs b/benchmarks/Sequence.hs index 1d23929..527020b 100644 --- a/benchmarks/Sequence.hs +++ b/benchmarks/Sequence.hs @@ -35,6 +35,12 @@ main = do , bench "100" $ nf (shuffle r100) s100 , bench "1000" $ nf (shuffle r1000) s1000 ] + , bgroup "fromList" + [ bench "10" $ nf S.fromList [(0 :: Int)..9] + , bench "100" $ nf S.fromList [(0 :: Int)..99] + , bench "1000" $ nf S.fromList [(0 :: Int)..999] + , bench "10000" $ nf S.fromList [(0 :: Int)..9999] + ] , bgroup "partition" [ bench "10" $ nf (S.partition even) s10 , bench "100" $ nf (S.partition even) s100 diff --git a/changelog.md b/changelog.md index 9200dae..d520020 100644 --- a/changelog.md +++ b/changelog.md @@ -32,15 +32,23 @@ * Derive `Generic` and `Generic1` for `Data.Tree`. - * Add `foldTree` for `Data.Tree`. + * Add `foldTree` for `Data.Tree`. (Thanks, Daniel Wagner!) + + * Make `drawTree` handle newlines better. (Thanks, recursion-ninja!) * Slightly optimize `replicateA` and `traverse` for `Data.Sequence`. - * Substantially speed up `splitAt` and (consequently) `zipWith` for - `Data.Sequence` by building the result sequences eagerly and rearranging - code to avoid allocating unnecessary intermediate structures. The - improvements are greatest for small sequences, but large even for long - ones. Reimplement `take` and `drop` to avoid building trees only to discard them. + * Substantially speed up `splitAt`, `zipWith`, `take`, `drop`, + `fromList`, and `partition` in `Data.Sequence`. + + * Most operations in `Data.Sequence` advertised as taking logarithmic + time (including `><` and `adjust`) now use their full allotted time + to avoid potentially building up chains of thunks in the tree. In general, + the only remaining operations that avoid doing more than they + really need are bulk creation and transformation functions that + really benefit from the extra laziness. There are some situations + where this change may slow programs down, but I think having more + predictable and usually better performance more than makes up for that. * Roughly double the speeds of `foldl'` and `foldr'` for `Data.Sequence` by writing custom definitions instead of using the defaults. From git at git.haskell.org Mon Apr 17 21:43:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:43:41 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Update and organize changelog (8fb8075) Message-ID: <20170417214341.C82DB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/8fb8075a9bdac116b88e82b4c8651cf02c02e29e >--------------------------------------------------------------- commit 8fb8075a9bdac116b88e82b4c8651cf02c02e29e Author: David Feuer Date: Fri Jun 10 23:52:59 2016 -0400 Update and organize changelog >--------------------------------------------------------------- 8fb8075a9bdac116b88e82b4c8651cf02c02e29e changelog.md | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/changelog.md b/changelog.md index d520020..874f13a 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,8 @@ ## 0.5.8.1 +### General package changes + * Remove all attempts to support nhc98 and any versions of GHC before 7.0. @@ -15,31 +17,41 @@ * Use `BangPatterns` throughout to reduce noise. This extension is now *required* to compile `containers`. - * Add `alterF` for `Data.Map` and `Data.IntMap`. + * Improve QuickCheck properties taking arbitrary functions by using + `Test.QuickCheck.Function.Fun` instead of evil `Show` instances + for functions. - * Make `Data.Map.Strict.traverseWithKey` force result values before - installing them in the new map. +### New exports and instances + + * Add `alterF` for `Data.Map` and `Data.IntMap`. * Add `Empty`, `:<|`, and `:|>` pattern synonyms for `Data.Sequence`. - * Add (!?), `lookup`, `chunksOf`, `cycleTaking`, `insertAt`, `deleteAt`, `intersperse`, + * Add `(!?)`, `lookup`, `chunksOf`, `cycleTaking`, `insertAt`, `deleteAt`, `intersperse`, `foldMapWithIndex`, and `traverseWithIndex` for `Data.Sequence`. - * Make `splitAt` in `Data.Sequence` strict in its arguments. Previously, - it returned a lazy pair. - - * Fix completely erroneous definition of `length` for `ViewR`. - * Derive `Generic` and `Generic1` for `Data.Tree`. * Add `foldTree` for `Data.Tree`. (Thanks, Daniel Wagner!) +### Semantic changes + + * Make `Data.Sequence.splitAt` strict in its arguments. Previously, + it returned a lazy pair. + + * Fix completely erroneous definition of `length` for `Data.Sequence.ViewR`. + + * Make `Data.Map.Strict.traverseWithKey` force result values before + installing them in the new map. + * Make `drawTree` handle newlines better. (Thanks, recursion-ninja!) - * Slightly optimize `replicateA` and `traverse` for `Data.Sequence`. +### Performance changes * Substantially speed up `splitAt`, `zipWith`, `take`, `drop`, - `fromList`, and `partition` in `Data.Sequence`. + `fromList`, `partition`, `foldl'`, and `foldr'` for `Data.Sequence`. + Slightly optimize `replicateA`. Stop `traverse` from performing many + unnecessary `fmap` operations. * Most operations in `Data.Sequence` advertised as taking logarithmic time (including `><` and `adjust`) now use their full allotted time @@ -50,9 +62,6 @@ where this change may slow programs down, but I think having more predictable and usually better performance more than makes up for that. - * Roughly double the speeds of `foldl'` and `foldr'` for `Data.Sequence` - by writing custom definitions instead of using the defaults. - * Add rewrite rules to fuse `fmap` with `reverse` for `Data.Sequence`. * Speed up `adjust` for `Data.Map`. @@ -61,9 +70,6 @@ * Speed up deletion and alteration functions for `Data.IntMap`. - * Improve QuickCheck properties taking arbitrary functions by using - `Test.QuickCheck.Function.Fun` instead of evil `Show` instances - for functions. ## 0.5.7.1 *Dec 2015* From git at git.haskell.org Mon Apr 17 21:43:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:43:43 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394: Clean up Typeable; derive more Generic (9f54bd0) Message-ID: <20170417214343.D74003A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/9f54bd0d59f2a1dcb19d73e40f8d6eeb7f028fa7 >--------------------------------------------------------------- commit 9f54bd0d59f2a1dcb19d73e40f8d6eeb7f028fa7 Author: David Feuer Date: Sat Jun 11 00:02:58 2016 -0400 Clean up Typeable; derive more Generic * Remove gunk apparently intended to support `Typeable` for Hugs. * Derive `Generic` and `Generic1` for `Data.Sequence.ViewL` and `Data.Sequence.ViewR`. >--------------------------------------------------------------- 9f54bd0d59f2a1dcb19d73e40f8d6eeb7f028fa7 Data/IntMap/Base.hs | 2 +- Data/IntSet/Base.hs | 2 +- Data/Map/Base.hs | 2 +- Data/Sequence.hs | 38 +++++++++++++++++++++++++++++--------- Data/Set/Base.hs | 2 +- Data/Tree.hs | 2 +- changelog.md | 3 ++- include/containers.h | 24 +++++++++--------------- 8 files changed, 45 insertions(+), 30 deletions(-) diff --git a/Data/IntMap/Base.hs b/Data/IntMap/Base.hs index a585328..845a590 100644 --- a/Data/IntMap/Base.hs +++ b/Data/IntMap/Base.hs @@ -2126,7 +2126,7 @@ instance (Read e) => Read (IntMap e) where Typeable --------------------------------------------------------------------} -INSTANCE_TYPEABLE1(IntMap,intMapTc,"IntMap") +INSTANCE_TYPEABLE1(IntMap) {-------------------------------------------------------------------- Helpers diff --git a/Data/IntSet/Base.hs b/Data/IntSet/Base.hs index 3ceb303..aa94471 100644 --- a/Data/IntSet/Base.hs +++ b/Data/IntSet/Base.hs @@ -1075,7 +1075,7 @@ instance Read IntSet where Typeable --------------------------------------------------------------------} -INSTANCE_TYPEABLE0(IntSet,intSetTc,"IntSet") +INSTANCE_TYPEABLE0(IntSet) {-------------------------------------------------------------------- NFData diff --git a/Data/Map/Base.hs b/Data/Map/Base.hs index b86df31..8febcbf 100644 --- a/Data/Map/Base.hs +++ b/Data/Map/Base.hs @@ -3124,7 +3124,7 @@ withEmpty bars = " ":bars Typeable --------------------------------------------------------------------} -INSTANCE_TYPEABLE2(Map,mapTc,"Map") +INSTANCE_TYPEABLE2(Map) {-------------------------------------------------------------------- Assertions diff --git a/Data/Sequence.hs b/Data/Sequence.hs index d0d7ff1..9b8ce23 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -12,6 +12,9 @@ #if __GLASGOW_HASKELL__ >= 703 {-# LANGUAGE Trustworthy #-} #endif +#if __GLASGOW_HASKELL__ >= 702 +{-# LANGUAGE DeriveGeneric #-} +#endif #if __GLASGOW_HASKELL__ >= 708 {-# LANGUAGE TypeFamilies #-} #endif @@ -229,6 +232,11 @@ import Text.Read (Lexeme(Ident), lexP, parens, prec, import Data.Data import Data.String (IsString(..)) #endif +#if __GLASGOW_HASKELL__ >= 706 +import GHC.Generics (Generic, Generic1) +#elif __GLASGOW_HASKELL__ >= 702 +import GHC.Generics (Generic) +#endif -- Array stuff, with GHC.Arr on GHC import Data.Array (Ix, Array) @@ -735,7 +743,7 @@ instance Semigroup.Semigroup (Seq a) where (<>) = (><) #endif -INSTANCE_TYPEABLE1(Seq,seqTc,"Seq") +INSTANCE_TYPEABLE1(Seq) #if __GLASGOW_HASKELL__ instance Data a => Data (Seq a) where @@ -1607,13 +1615,19 @@ data ViewRTree a = SnocRTree (FingerTree a) a | EmptyRTree data ViewL a = EmptyL -- ^ empty sequence | a :< Seq a -- ^ leftmost element and the rest of the sequence -#if __GLASGOW_HASKELL__ - deriving (Eq, Ord, Show, Read, Data) -#else deriving (Eq, Ord, Show, Read) + +#if __GLASGOW_HASKELL__ +deriving instance Data a => Data (ViewL a) +#endif +#if __GLASGOW_HASKELL__ >= 706 +deriving instance Generic1 ViewL +#endif +#if __GLASGOW_HASKELL__ >= 702 +deriving instance Generic (ViewL a) #endif -INSTANCE_TYPEABLE1(ViewL,viewLTc,"ViewL") +INSTANCE_TYPEABLE1(ViewL) instance Functor ViewL where {-# INLINE fmap #-} @@ -1666,13 +1680,19 @@ data ViewR a = EmptyR -- ^ empty sequence | Seq a :> a -- ^ the sequence minus the rightmost element, -- and the rightmost element -#if __GLASGOW_HASKELL__ - deriving (Eq, Ord, Show, Read, Data) -#else deriving (Eq, Ord, Show, Read) + +#if __GLASGOW_HASKELL__ +deriving instance Data a => Data (ViewR a) +#endif +#if __GLASGOW_HASKELL__ >= 706 +deriving instance Generic1 ViewR +#endif +#if __GLASGOW_HASKELL__ >= 702 +deriving instance Generic (ViewR a) #endif -INSTANCE_TYPEABLE1(ViewR,viewRTc,"ViewR") +INSTANCE_TYPEABLE1(ViewR) instance Functor ViewR where {-# INLINE fmap #-} diff --git a/Data/Set/Base.hs b/Data/Set/Base.hs index b141022..92bfc1d 100644 --- a/Data/Set/Base.hs +++ b/Data/Set/Base.hs @@ -988,7 +988,7 @@ instance (Read a, Ord a) => Read (Set a) where Typeable/Data --------------------------------------------------------------------} -INSTANCE_TYPEABLE1(Set,setTc,"Set") +INSTANCE_TYPEABLE1(Set) {-------------------------------------------------------------------- NFData diff --git a/Data/Tree.hs b/Data/Tree.hs index f4cf2e9..d6d2726 100644 --- a/Data/Tree.hs +++ b/Data/Tree.hs @@ -83,7 +83,7 @@ data Tree a = Node { #endif type Forest a = [Tree a] -INSTANCE_TYPEABLE1(Tree,treeTc,"Tree") +INSTANCE_TYPEABLE1(Tree) instance Functor Tree where fmap = fmapTree diff --git a/changelog.md b/changelog.md index 874f13a..4afe114 100644 --- a/changelog.md +++ b/changelog.md @@ -30,7 +30,8 @@ * Add `(!?)`, `lookup`, `chunksOf`, `cycleTaking`, `insertAt`, `deleteAt`, `intersperse`, `foldMapWithIndex`, and `traverseWithIndex` for `Data.Sequence`. - * Derive `Generic` and `Generic1` for `Data.Tree`. + * Derive `Generic` and `Generic1` for `Data.Tree.Tree`, `Data.Sequence.ViewL`, + and `Data.Sequence.ViewR`. * Add `foldTree` for `Data.Tree`. (Thanks, Daniel Wagner!) diff --git a/include/containers.h b/include/containers.h index b2d6e63..273c1b2 100644 --- a/include/containers.h +++ b/include/containers.h @@ -16,23 +16,17 @@ * Define INSTANCE_TYPEABLE[0-2] */ #if __GLASGOW_HASKELL__ >= 707 -#define INSTANCE_TYPEABLE0(tycon,tcname,str) deriving instance Typeable tycon -#define INSTANCE_TYPEABLE1(tycon,tcname,str) deriving instance Typeable tycon -#define INSTANCE_TYPEABLE2(tycon,tcname,str) deriving instance Typeable tycon +#define INSTANCE_TYPEABLE0(tycon) deriving instance Typeable tycon +#define INSTANCE_TYPEABLE1(tycon) deriving instance Typeable tycon +#define INSTANCE_TYPEABLE2(tycon) deriving instance Typeable tycon #elif defined(__GLASGOW_HASKELL__) -#define INSTANCE_TYPEABLE0(tycon,tcname,str) deriving instance Typeable tycon -#define INSTANCE_TYPEABLE1(tycon,tcname,str) deriving instance Typeable1 tycon -#define INSTANCE_TYPEABLE2(tycon,tcname,str) deriving instance Typeable2 tycon +#define INSTANCE_TYPEABLE0(tycon) deriving instance Typeable tycon +#define INSTANCE_TYPEABLE1(tycon) deriving instance Typeable1 tycon +#define INSTANCE_TYPEABLE2(tycon) deriving instance Typeable2 tycon #else -#define INSTANCE_TYPEABLE0(tycon,tcname,str) tcname :: TyCon; tcname = mkTyCon str; \ - instance Typeable tycon where { typeOf _ = mkTyConApp tcname [] } -#define INSTANCE_TYPEABLE1(tycon,tcname,str) tcname :: TyCon; tcname = mkTyCon str; \ - instance Typeable1 tycon where { typeOf1 _ = mkTyConApp tcname [] }; \ - instance Typeable a => Typeable (tycon a) where { typeOf = typeOfDefault } -#define INSTANCE_TYPEABLE2(tycon,tcname,str) tcname :: TyCon; tcname = mkTyCon str; \ - instance Typeable2 tycon where { typeOf2 _ = mkTyConApp tcname [] }; \ - instance Typeable a => Typeable1 (tycon a) where { typeOf1 = typeOf1Default }; \ - instance (Typeable a, Typeable b) => Typeable (tycon a b) where { typeOf = typeOfDefault } +#define INSTANCE_TYPEABLE0(tycon) +#define INSTANCE_TYPEABLE1(tycon) +#define INSTANCE_TYPEABLE2(tycon) #endif /* From git at git.haskell.org Mon Apr 17 21:43:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:43:45 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #287 from treeowl/clean-typeable (feddced) Message-ID: <20170417214345.E1D243A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/feddcedc65933f620a941167ebd6af4372bd8215 >--------------------------------------------------------------- commit feddcedc65933f620a941167ebd6af4372bd8215 Merge: 8fb8075 9f54bd0 Author: David Feuer Date: Sat Jun 11 00:54:41 2016 -0400 Merge pull request #287 from treeowl/clean-typeable Clean up Typeable; derive more Generic >--------------------------------------------------------------- feddcedc65933f620a941167ebd6af4372bd8215 Data/IntMap/Base.hs | 2 +- Data/IntSet/Base.hs | 2 +- Data/Map/Base.hs | 2 +- Data/Sequence.hs | 38 +++++++++++++++++++++++++++++--------- Data/Set/Base.hs | 2 +- Data/Tree.hs | 2 +- changelog.md | 3 ++- include/containers.h | 24 +++++++++--------------- 8 files changed, 45 insertions(+), 30 deletions(-) From git at git.haskell.org Mon Apr 17 21:43:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:43:47 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Add longer fromList benchmark (b21431e) Message-ID: <20170417214347.E9E343A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/b21431e6a5065de692bedf93d22b09a02394291e >--------------------------------------------------------------- commit b21431e6a5065de692bedf93d22b09a02394291e Author: David Feuer Date: Tue Jun 14 18:33:14 2016 -0400 Add longer fromList benchmark The previous benchmarks weren't big enough to reveal certain cache effects. >--------------------------------------------------------------- b21431e6a5065de692bedf93d22b09a02394291e benchmarks/Sequence.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/benchmarks/Sequence.hs b/benchmarks/Sequence.hs index 527020b..99d1ca4 100644 --- a/benchmarks/Sequence.hs +++ b/benchmarks/Sequence.hs @@ -40,6 +40,7 @@ main = do , bench "100" $ nf S.fromList [(0 :: Int)..99] , bench "1000" $ nf S.fromList [(0 :: Int)..999] , bench "10000" $ nf S.fromList [(0 :: Int)..9999] + , bench "100000" $ nf S.fromList [(0 :: Int)..99999] ] , bgroup "partition" [ bench "10" $ nf (S.partition even) s10 From git at git.haskell.org Mon Apr 17 21:43:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:43:50 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Data.Sequence.fromList: Apply 3->9 loop unrolling (590a8ec) Message-ID: <20170417214350.00F173A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/590a8ecb9c1bdf6c43b844a236a82ded99ff7112 >--------------------------------------------------------------- commit 590a8ecb9c1bdf6c43b844a236a82ded99ff7112 Author: Lennart Spitzner Date: Mon Jun 13 19:17:03 2016 +0200 Data.Sequence.fromList: Apply 3->9 loop unrolling >--------------------------------------------------------------- 590a8ecb9c1bdf6c43b844a236a82ded99ff7112 Data/Sequence.hs | 105 ++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 81 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 590a8ecb9c1bdf6c43b844a236a82ded99ff7112 From git at git.haskell.org Mon Apr 17 21:43:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:43:52 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Data.Sequence.fromList: Reimplement using FinalList (099a2c1) Message-ID: <20170417214352.0B9403A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/099a2c18edac207041dc313c1cc5deac9e2e70a6 >--------------------------------------------------------------- commit 099a2c18edac207041dc313c1cc5deac9e2e70a6 Author: Lennart Spitzner Date: Mon Jun 13 16:40:16 2016 +0200 Data.Sequence.fromList: Reimplement using FinalList >--------------------------------------------------------------- 099a2c18edac207041dc313c1cc5deac9e2e70a6 Data/Sequence.hs | 80 +++++++++++++++++++++++++++++++------------------------- 1 file changed, 44 insertions(+), 36 deletions(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 9b8ce23..799e167 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -3553,39 +3553,49 @@ fromList :: [a] -> Seq a -- Note: we can avoid map_elem if we wish by scattering -- Elem applications throughout mkTreeE and getNodesE, but -- it gets a bit hard to read. -fromList = Seq . mkTreeE 1 . map_elem - where - mkTreeE :: Int -> [Elem a] -> FingerTree (Elem a) - mkTreeE !_ [] = EmptyT - mkTreeE _ [x1] = Single x1 - mkTreeE s [x1, x2] = Deep (2*s) (One x1) EmptyT (One x2) - mkTreeE s [x1, x2, x3] = Deep (3*s) (One x1) EmptyT (Two x2 x3) - mkTreeE s (x1:x2:x3:x4:xs) = case getNodesE (3*s) x4 xs of - ns :*: sf -> case mkTreeN (3*s) ns of - !m -> Deep (3*size x1 + size m + size sf) (Three x1 x2 x3) m sf - - mkTreeN :: Int -> SList (Node a) -> FingerTree (Node a) - mkTreeN !_ SNil = EmptyT - mkTreeN _ (SCons x1 SNil) = Single x1 - mkTreeN s (SCons x1 (SCons x2 SNil)) = Deep (2*s) (One x1) EmptyT (One x2) - mkTreeN s (SCons x1 (SCons x2 (SCons x3 SNil))) = Deep (3*s) (One x1) EmptyT (Two x2 x3) - mkTreeN s (SCons x1 (SCons x2 (SCons x3 (SCons x4 xs)))) = case getNodesN (3*s) x4 xs of - ns :*: sf -> case mkTreeN (3*s) ns of - !m -> Deep (3*size x1 + size m + size sf) (Three x1 x2 x3) m sf - - getNodesE :: Int -> a -> [a] -> StrictPair (SList (Node a)) (Digit a) - getNodesE !_ x1 [] = SNil :*: One x1 - getNodesE _ x1 [x2] = SNil :*: Two x1 x2 - getNodesE _ x1 [x2, x3] = SNil :*: Three x1 x2 x3 - getNodesE s x1 (x2:x3:x4:xs) = SCons (Node3 s x1 x2 x3) ns :*: d - where !(ns :*: d) = getNodesE s x4 xs - - getNodesN :: Int -> Node a -> SList (Node a) -> StrictPair (SList (Node (Node a))) (Digit (Node a)) - getNodesN !_ x1 SNil = SNil :*: One x1 - getNodesN _ x1 (SCons x2 SNil) = SNil :*: Two x1 x2 - getNodesN _ x1 (SCons x2 (SCons x3 SNil)) = SNil :*: Three x1 x2 x3 - getNodesN s x1 (SCons x2 (SCons x3 (SCons x4 xs))) = SCons (Node3 s x1 x2 x3) ns :*: d - where !(ns :*: d) = getNodesN s x4 xs +fromList = Seq . mkTree 1 . map_elem + where + mkTree :: Int -> [Elem a] -> FingerTree (Elem a) + mkTree !_ [] = EmptyT + mkTree _ [x1] = Single x1 + mkTree s [x1, x2] = Deep (2*s) (One x1) EmptyT (One x2) + mkTree s [x1, x2, x3] = Deep (3*s) (One x1) EmptyT (Two x2 x3) + mkTree s (x1:x2:x3:x4:xs) = mkTreeC cont (3*s) (getNodes (3*s) x4 xs) + where + -- cont :: Digit (Elem a) -> FingerTree (Node (Elem a)) -> FingerTree (Elem a) + cont d sub = Deep (3*size x1 + size d + size sub) (Three x1 x2 x3) sub d + + getNodes :: Int + -> a + -> [a] + -> ListFinal (Node a) (Digit a) + getNodes !_ x1 [] = LFinal (One x1) + getNodes _ x1 [x2] = LFinal (Two x1 x2) + getNodes _ x1 [x2, x3] = LFinal (Three x1 x2 x3) + getNodes s x1 (x2:x3:x4:xs) = LCons (Node3 s x1 x2 x3) (getNodes s x4 xs) + + mkTreeC :: (b -> FingerTree (Node a) -> c) + -> Int + -> ListFinal (Node a) b + -> c + mkTreeC cont !_ (LFinal b) = cont b EmptyT + mkTreeC cont _ (LCons x1 (LFinal b)) = cont b (Single x1) + mkTreeC cont s (LCons x1 (LCons x2 (LFinal b))) = cont b (Deep (2*s) (One x1) EmptyT (One x2)) + mkTreeC cont s (LCons x1 (LCons x2 (LCons x3 (LFinal b)))) = cont b (Deep (3*s) (One x1) EmptyT (Two x2 x3)) + mkTreeC cont s (LCons x1 (LCons x2 (LCons x3 (LCons x4 xs)))) = mkTreeC cont2 (3*s) (getNodesC (3*s) x4 xs) + where + d1 = Three x1 x2 x3 + -- cont2 :: (b, Digit (Node a)) -> FingerTree (Node (Node a)) -> c + cont2 (b, !d) !sub = cont b $ Deep (3*size x1 + size d + size sub) d1 sub d + + getNodesC :: Int + -> a + -> ListFinal a b + -> ListFinal (Node a) (b, Digit a) + getNodesC !_ x1 (LFinal b) = LFinal (b, (One x1)) + getNodesC _ x1 (LCons x2 (LFinal b)) = LFinal (b, (Two x1 x2)) + getNodesC _ x1 (LCons x2 (LCons x3 (LFinal b))) = LFinal (b, (Three x1 x2 x3)) + getNodesC s x1 (LCons x2 (LCons x3 (LCons x4 xs))) = LCons (Node3 s x1 x2 x3) (getNodesC s x4 xs) map_elem :: [a] -> [Elem a] #if __GLASGOW_HASKELL__ >= 708 @@ -3595,9 +3605,7 @@ fromList = Seq . mkTreeE 1 . map_elem #endif {-# INLINE map_elem #-} --- A list strict in both its spine and elements. This seems to help --- GHC avoid forcing things that are already forced in fromList. -data SList a = SNil | SCons !a !(SList a) +data ListFinal a cont = LFinal !cont | LCons !a (ListFinal a cont) #if __GLASGOW_HASKELL__ >= 708 instance GHC.Exts.IsList (Seq a) where From git at git.haskell.org Mon Apr 17 21:43:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:43:54 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Clean up fromList (56c1faf) Message-ID: <20170417214354.17CDC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/56c1fafbb31d48ee0b1dbf5e071a68e491a2058b >--------------------------------------------------------------- commit 56c1fafbb31d48ee0b1dbf5e071a68e491a2058b Author: David Feuer Date: Wed Jun 15 17:55:41 2016 -0400 Clean up fromList Remove unnecessary `s` parameter for tree top. Remove unnecessary `let`s, and generally make things neater. Make trees lean left. Use local type signatures under GHC, where scoped type variables are available. Remove unnecessary bang patterns. Begin to document design. >--------------------------------------------------------------- 56c1fafbb31d48ee0b1dbf5e071a68e491a2058b Data/Sequence.hs | 250 +++++++++++++++++++++++++++++++++++++++---------------- changelog.md | 10 ++- 2 files changed, 185 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 56c1fafbb31d48ee0b1dbf5e071a68e491a2058b From git at git.haskell.org Mon Apr 17 21:43:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:43:56 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #292 from treeowl/spitzner-nines (5cb8b26) Message-ID: <20170417214356.218853A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/5cb8b2634de7b285cc6a3b5afbc5eb9d5a7eb7c8 >--------------------------------------------------------------- commit 5cb8b2634de7b285cc6a3b5afbc5eb9d5a7eb7c8 Merge: b21431e 56c1faf Author: David Feuer Date: Tue Jun 28 23:40:12 2016 -0400 Merge pull request #292 from treeowl/spitzner-nines Use Lennart Spitzner's implementation of `fromList`. >--------------------------------------------------------------- 5cb8b2634de7b285cc6a3b5afbc5eb9d5a7eb7c8 Data/Sequence.hs | 249 ++++++++++++++++++++++++++++++++++++++++++++++--------- changelog.md | 10 ++- 2 files changed, 217 insertions(+), 42 deletions(-) From git at git.haskell.org Mon Apr 17 21:43:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:43:58 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Add Data.Sequence.adjust' (1e227a3) Message-ID: <20170417214358.2D4E13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/1e227a342ef4125cf2c068acc2a1060a9104798c >--------------------------------------------------------------- commit 1e227a342ef4125cf2c068acc2a1060a9104798c Author: David Feuer Date: Thu Jul 7 13:09:03 2016 -0400 Add Data.Sequence.adjust' * Add `adjust'`, which forces the new value before installing it in the sequence. * Improve the documentation for `lookup`. * Cut out some unnecessary code from `traverse`. >--------------------------------------------------------------- 1e227a342ef4125cf2c068acc2a1060a9104798c Data/Sequence.hs | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++--- changelog.md | 2 +- 2 files changed, 62 insertions(+), 4 deletions(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index e7fe97d..374e2a2 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -153,6 +153,7 @@ module Data.Sequence ( (!?), -- :: Seq a -> Int -> Maybe a index, -- :: Seq a -> Int -> a adjust, -- :: (a -> a) -> Int -> Seq a -> Seq a + adjust', -- :: (a -> a) -> Int -> Seq a -> Seq a update, -- :: Int -> a -> Seq a -> Seq a take, -- :: Int -> Seq a -> Seq a drop, -- :: Int -> Seq a -> Seq a @@ -359,6 +360,13 @@ instance MaybeForce (Node a) where maybeRwhnf !_ = () {-# INLINE maybeRwhnf #-} +-- A wrapper making mseq = seq +newtype ForceBox a = ForceBox a +instance MaybeForce (ForceBox a) where + maybeRwhnf !_ = () +instance Sized (ForceBox a) where + size _ = 1 + -- | General-purpose finite sequences. newtype Seq a = Seq (FingerTree (Elem a)) @@ -423,7 +431,7 @@ instance Foldable Seq where -- `FingerTree a`, stripping off all the Elem junk, then use a weird FingerTree -- traversing function that coerces back to Seq within the functor. instance Traversable Seq where - traverse f (Seq xs) = traverseFTE f (coerce xs) + traverse f xs = traverseFTE f (coerce xs) traverseFTE :: Applicative f => (a -> f b) -> FingerTree a -> f (Seq b) traverseFTE _f EmptyT = pure empty @@ -1788,6 +1796,11 @@ scanr1 f xs = case viewr xs of -- If the position is out of range, 'index' fails with an error. -- -- prop> xs `index` i = toList xs !! i +-- +-- Caution: 'index' necessarily delays retrieving the requested +-- element until the result is forced. It can therefore lead to a space +-- leak if the result is stored, unforced, in another structure. To retrieve +-- an element immediately without forcing it, use 'lookup' or '(!?)'. index :: Seq a -> Int -> a index (Seq xs) i -- See note on unsigned arithmetic in splitAt @@ -1802,6 +1815,16 @@ index (Seq xs) i -- prop> 0 <= i < length xs ==> lookup i xs == Just (toList xs !! i) -- prop> i < 0 || i >= length xs ==> lookup i xs = Nothing -- +-- Unlike 'index', this can be used to retrieve an element without +-- forcing it. For example, to insert the fifth element of a sequence +-- @xs@ into a 'Data.Map.Lazy.Map' @m@ at key @k@, you could use +-- +-- @ +-- case lookup 5 xs of +-- Nothing -> m +-- Just x -> 'Data.Map.Lazy.insert' k x m +-- @ +-- -- @since 0.5.8 lookup :: Int -> Seq a -> Maybe a lookup i (Seq xs) @@ -1945,14 +1968,49 @@ updateDigit v i (Four a b c d) sab = sa + size b sabc = sab + size c --- | /O(log(min(i,n-i)))/. Update the element at the specified position. --- If the position is out of range, the original sequence is returned. +-- | /O(log(min(i,n-i)))/. Update the element at the specified position. If +-- the position is out of range, the original sequence is returned. 'adjust' +-- can lead to poor performance and even memory leaks, because it does not +-- force the new value before installing it in the sequence. 'adjust'' should +-- usually be preferred. adjust :: (a -> a) -> Int -> Seq a -> Seq a adjust f i (Seq xs) -- See note on unsigned arithmetic in splitAt | fromIntegral i < (fromIntegral (size xs) :: Word) = Seq (adjustTree (`seq` fmap f) i xs) | otherwise = Seq xs +-- | /O(log(min(i,n-i)))/. Update the element at the specified position. +-- If the position is out of range, the original sequence is returned. +-- The new value is forced before it is installed in the sequence. +-- +-- @ +-- adjust' f i xs = +-- case xs !? i of +-- Nothing -> xs +-- Just x -> let !x' = f x +-- in update i x' xs +-- @ +-- +-- @since 0.5.8 +adjust' :: forall a . (a -> a) -> Int -> Seq a -> Seq a +#if __GLASGOW_HASKELL__ >= 708 +adjust' f i xs + -- See note on unsigned arithmetic in splitAt + | fromIntegral i < (fromIntegral (length xs) :: Word) = + coerce $ adjustTree (\ !_k (ForceBox a) -> ForceBox (f a)) i (coerce xs) + | otherwise = xs +#else +-- This is inefficient, but fixing it would take a lot of fuss and bother +-- for little immediate gain. We can deal with that when we have another +-- Haskell implementation to worry about. +adjust' f i xs = + case xs !? i of + Nothing -> xs + Just x -> let !x' = f x + in update i x' xs +#endif + +{-# SPECIALIZE adjustTree :: (Int -> ForceBox a -> ForceBox a) -> Int -> FingerTree (ForceBox a) -> FingerTree (ForceBox a) #-} {-# SPECIALIZE adjustTree :: (Int -> Elem a -> Elem a) -> Int -> FingerTree (Elem a) -> FingerTree (Elem a) #-} {-# SPECIALIZE adjustTree :: (Int -> Node a -> Node a) -> Int -> FingerTree (Node a) -> FingerTree (Node a) #-} adjustTree :: (Sized a, MaybeForce a) => (Int -> a -> a) -> diff --git a/changelog.md b/changelog.md index a03b23c..fe4507a 100644 --- a/changelog.md +++ b/changelog.md @@ -27,7 +27,7 @@ * Add `Empty`, `:<|`, and `:|>` pattern synonyms for `Data.Sequence`. - * Add `(!?)`, `lookup`, `chunksOf`, `cycleTaking`, `insertAt`, `deleteAt`, `intersperse`, + * Add `adjust'`, `(!?)`, `lookup`, `chunksOf`, `cycleTaking`, `insertAt`, `deleteAt`, `intersperse`, `foldMapWithIndex`, and `traverseWithIndex` for `Data.Sequence`. * Derive `Generic` and `Generic1` for `Data.Tree.Tree`, `Data.Sequence.ViewL`, From git at git.haskell.org Mon Apr 17 21:44:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:44:00 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #294 from treeowl/sequence-adjust (ffd9be0) Message-ID: <20170417214400.3747D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/ffd9be0ec7d315062e2ba77608b3b755c35596dc >--------------------------------------------------------------- commit ffd9be0ec7d315062e2ba77608b3b755c35596dc Merge: 5cb8b26 1e227a3 Author: David Feuer Date: Thu Jul 7 13:49:26 2016 -0400 Merge pull request #294 from treeowl/sequence-adjust Add Data.Sequence.adjust' >--------------------------------------------------------------- ffd9be0ec7d315062e2ba77608b3b755c35596dc Data/Sequence.hs | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++--- changelog.md | 2 +- 2 files changed, 62 insertions(+), 4 deletions(-) From git at git.haskell.org Mon Apr 17 21:44:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:44:02 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Add fromDesc functions for Data.Map (aed266b) Message-ID: <20170417214402.4403B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/aed266bd4707c86038591dcdd30781e86d3bc642 >--------------------------------------------------------------- commit aed266bd4707c86038591dcdd30781e86d3bc642 Author: David Feuer Date: Thu Jul 7 15:46:13 2016 -0400 Add fromDesc functions for Data.Map Add functions to convert descending lists to maps. >--------------------------------------------------------------- aed266bd4707c86038591dcdd30781e86d3bc642 Data/Map/Base.hs | 84 ++++++++++++++++++++++++++++++++++++++++++ Data/Map/Lazy.hs | 4 ++ Data/Map/Strict.hs | 97 ++++++++++++++++++++++++++++++++++++++++++++++++- changelog.md | 3 ++ tests/map-properties.hs | 21 +++++++++++ 5 files changed, 207 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 aed266bd4707c86038591dcdd30781e86d3bc642 From git at git.haskell.org Mon Apr 17 21:44:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:44:04 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #295 from treeowl/map-fromDescending (a42a606) Message-ID: <20170417214404.4CAD03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/a42a6062c3c1cfd69a980963ba25d08453208e84 >--------------------------------------------------------------- commit a42a6062c3c1cfd69a980963ba25d08453208e84 Merge: ffd9be0 aed266b Author: David Feuer Date: Thu Jul 7 16:50:20 2016 -0400 Merge pull request #295 from treeowl/map-fromDescending Add fromDesc functions for Data.Map >--------------------------------------------------------------- a42a6062c3c1cfd69a980963ba25d08453208e84 Data/Map/Base.hs | 84 ++++++++++++++++++++++++++++++++++++++++++ Data/Map/Lazy.hs | 4 ++ Data/Map/Strict.hs | 97 ++++++++++++++++++++++++++++++++++++++++++++++++- changelog.md | 3 ++ tests/map-properties.hs | 21 +++++++++++ 5 files changed, 207 insertions(+), 2 deletions(-) From git at git.haskell.org Mon Apr 17 21:44:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:44:06 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Add fromDescList and fromDistinctDescList (90b3248) Message-ID: <20170417214406.57DF73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/90b324845fef2cd5986bdeccc819ab92a5e678b6 >--------------------------------------------------------------- commit 90b324845fef2cd5986bdeccc819ab92a5e678b6 Author: David Feuer Date: Fri Jul 8 14:08:49 2016 -0400 Add fromDescList and fromDistinctDescList The set versions are just like the map versions, pretty much. >--------------------------------------------------------------- 90b324845fef2cd5986bdeccc819ab92a5e678b6 Data/Set.hs | 2 ++ Data/Set/Base.hs | 73 +++++++++++++++++++++++++++++++++++-------------- changelog.md | 2 ++ tests/set-properties.hs | 32 ++++++++++++++++------ 4 files changed, 80 insertions(+), 29 deletions(-) diff --git a/Data/Set.hs b/Data/Set.hs index fd8c8b9..297cee2 100644 --- a/Data/Set.hs +++ b/Data/Set.hs @@ -129,7 +129,9 @@ module Data.Set ( , toAscList , toDescList , fromAscList + , fromDescList , fromDistinctAscList + , fromDistinctDescList -- * Debugging , showTree diff --git a/Data/Set/Base.hs b/Data/Set/Base.hs index 92bfc1d..8aabd08 100644 --- a/Data/Set/Base.hs +++ b/Data/Set/Base.hs @@ -181,6 +181,8 @@ module Data.Set.Base ( , toDescList , fromAscList , fromDistinctAscList + , fromDescList + , fromDistinctDescList -- * Debugging , showTree @@ -719,7 +721,7 @@ map f = fromList . List.map f . toList -- | /O(n)/. The -- --- @'mapMonotonic' f s == 'map' f s@, but works only when @f@ is monotonic. +-- @'mapMonotonic' f s == 'map' f s@, but works only when @f@ is strictly increasing. -- /The precondition is not checked./ -- Semi-formally, we have: -- @@ -904,24 +906,32 @@ fromList (x0 : xs0) | not_ordered x0 xs0 = fromList' (Bin 1 x0 Tip Tip) xs0 -- | /O(n)/. Build a set from an ascending list in linear time. -- /The precondition (input list is ascending) is not checked./ fromAscList :: Eq a => [a] -> Set a -fromAscList xs - = fromDistinctAscList (combineEq xs) - where - -- [combineEq xs] combines equal elements with [const] in an ordered list [xs] - combineEq xs' - = case xs' of - [] -> [] - [x] -> [x] - (x:xx) -> combineEq' x xx - - combineEq' z [] = [z] - combineEq' z (x:xs') - | z==x = combineEq' z xs' - | otherwise = z:combineEq' x xs' +fromAscList xs = fromDistinctAscList (combineEq xs) #if __GLASGOW_HASKELL__ {-# INLINABLE fromAscList #-} #endif +-- | /O(n)/. Build a set from a descending list in linear time. +-- /The precondition (input list is descending) is not checked./ +fromDescList :: Eq a => [a] -> Set a +fromDescList xs = fromDistinctDescList (combineEq xs) +#if __GLASGOW_HASKELL__ +{-# INLINABLE fromDescList #-} +#endif + +-- [combineEq xs] combines equal elements with [const] in an ordered list [xs] +-- +-- TODO: combineEq allocates an intermediate list. It *should* be better to +-- make fromAscListBy and fromDescListBy the fundamental operations, and to +-- implement the rest using those. +combineEq :: Eq a => [a] -> [a] +combineEq [] = [] +combineEq (x : xs) = combineEq' x xs + where + combineEq' z [] = [z] + combineEq' z (y:ys) + | z == y = combineEq' z ys + | otherwise = z : combineEq' y ys -- | /O(n)/. Build a set from an ascending list of distinct elements in linear time. -- /The precondition (input list is strictly ascending) is not checked./ @@ -934,15 +944,36 @@ fromDistinctAscList (x0 : xs0) = go (1::Int) (Bin 1 x0 Tip Tip) xs0 where go !_ t [] = t go s l (x : xs) = case create s xs of - (r, ys) -> go (s `shiftL` 1) (link x l r) ys + (r :*: ys) -> go (s `shiftL` 1) (link x l r) ys + + create !_ [] = (Tip :*: []) + create s xs@(x : xs') + | s == 1 = (Bin 1 x Tip Tip :*: xs') + | otherwise = case create (s `shiftR` 1) xs of + res@(_ :*: []) -> res + (l :*: (y:ys)) -> case create (s `shiftR` 1) ys of + (r :*: zs) -> (link y l r :*: zs) + +-- | /O(n)/. Build a set from a descending list of distinct elements in linear time. +-- /The precondition (input list is strictly descending) is not checked./ + +-- For some reason, when 'singleton' is used in fromDistinctDescList or in +-- create, it is not inlined, so we inline it manually. +fromDistinctDescList :: [a] -> Set a +fromDistinctDescList [] = Tip +fromDistinctDescList (x0 : xs0) = go (1::Int) (Bin 1 x0 Tip Tip) xs0 + where + go !_ t [] = t + go s r (x : xs) = case create s xs of + (l :*: ys) -> go (s `shiftL` 1) (link x l r) ys - create !_ [] = (Tip, []) + create !_ [] = (Tip :*: []) create s xs@(x : xs') - | s == 1 = (Bin 1 x Tip Tip, xs') + | s == 1 = (Bin 1 x Tip Tip :*: xs') | otherwise = case create (s `shiftR` 1) xs of - res@(_, []) -> res - (l, y:ys) -> case create (s `shiftR` 1) ys of - (r, zs) -> (link y l r, zs) + res@(_ :*: []) -> res + (r :*: (y:ys)) -> case create (s `shiftR` 1) ys of + (l :*: zs) -> (link y l r :*: zs) {-------------------------------------------------------------------- Eq converts the set to a list. In a lazy setting, this diff --git a/changelog.md b/changelog.md index 79c926b..9f3913e 100644 --- a/changelog.md +++ b/changelog.md @@ -28,6 +28,8 @@ * Add `fromDescList`, `fromDescListWith`, `fromDescListWithKey`, and `fromDistinctDescList` to `Data.Map`. + * Add `fromDescList` and `fromDistinctDescList` to `Data.Set`. + * Add `Empty`, `:<|`, and `:|>` pattern synonyms for `Data.Sequence`. * Add `adjust'`, `(!?)`, `lookup`, `chunksOf`, `cycleTaking`, `insertAt`, `deleteAt`, `intersperse`, diff --git a/tests/set-properties.hs b/tests/set-properties.hs index 694437c..029110d 100644 --- a/tests/set-properties.hs +++ b/tests/set-properties.hs @@ -42,10 +42,12 @@ main = defaultMain [ testCase "lookupLT" test_lookupLT , testProperty "prop_IntValid" prop_IntValid , testProperty "prop_Int" prop_Int , testProperty "prop_Ordered" prop_Ordered + , testProperty "prop_DescendingOrdered" prop_DescendingOrdered , testProperty "prop_List" prop_List , testProperty "prop_DescList" prop_DescList , testProperty "prop_AscDescList" prop_AscDescList , testProperty "prop_fromList" prop_fromList + , testProperty "prop_fromListDesc" prop_fromListDesc , testProperty "prop_isProperSubsetOf" prop_isProperSubsetOf , testProperty "prop_isProperSubsetOf2" prop_isProperSubsetOf2 , testProperty "prop_isSubsetOf" prop_isSubsetOf @@ -268,7 +270,12 @@ prop_Int xs ys = toAscList (intersection (fromList xs) (fromList ys)) prop_Ordered :: Property prop_Ordered = forAll (choose (5,100)) $ \n -> let xs = [0..n::Int] - in fromAscList xs == fromList xs + in fromAscList xs === fromList xs + +prop_DescendingOrdered :: Property +prop_DescendingOrdered = forAll (choose (5,100)) $ \n -> + let xs = [n,n-1..0::Int] + in fromDescList xs === fromList xs prop_List :: [Int] -> Bool prop_List xs = (sort (nub xs) == toList (fromList xs)) @@ -280,13 +287,22 @@ prop_AscDescList :: [Int] -> Bool prop_AscDescList xs = toAscList s == reverse (toDescList s) where s = fromList xs -prop_fromList :: [Int] -> Bool -prop_fromList xs - = case fromList xs of - t -> t == fromAscList sort_xs && - t == fromDistinctAscList nub_sort_xs && - t == List.foldr insert empty xs - where sort_xs = sort xs +prop_fromList :: [Int] -> Property +prop_fromList xs = + t === fromAscList sort_xs .&&. + t === fromDistinctAscList nub_sort_xs .&&. + t === List.foldr insert empty xs + where t = fromList xs + sort_xs = sort xs + nub_sort_xs = List.map List.head $ List.group sort_xs + +prop_fromListDesc :: [Int] -> Property +prop_fromListDesc xs = + t === fromDescList sort_xs .&&. + t === fromDistinctDescList nub_sort_xs .&&. + t === List.foldr insert empty xs + where t = fromList xs + sort_xs = reverse (sort xs) nub_sort_xs = List.map List.head $ List.group sort_xs {-------------------------------------------------------------------- From git at git.haskell.org Mon Apr 17 21:44:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:44:08 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #296 from treeowl/fromDescList (1b0cd4b) Message-ID: <20170417214408.5FE353A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/1b0cd4b4572e741db8f46502d1cdf247b7d5aa3e >--------------------------------------------------------------- commit 1b0cd4b4572e741db8f46502d1cdf247b7d5aa3e Merge: a42a606 90b3248 Author: David Feuer Date: Fri Jul 8 14:42:07 2016 -0400 Merge pull request #296 from treeowl/fromDescList Add fromDescList and fromDistinctDescList >--------------------------------------------------------------- 1b0cd4b4572e741db8f46502d1cdf247b7d5aa3e Data/Set.hs | 2 ++ Data/Set/Base.hs | 73 +++++++++++++++++++++++++++++++++++-------------- changelog.md | 2 ++ tests/set-properties.hs | 32 ++++++++++++++++------ 4 files changed, 80 insertions(+), 29 deletions(-) From git at git.haskell.org Mon Apr 17 21:44:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:44:10 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Define pattern synonyms only for GHC >=8 (98cb19f) Message-ID: <20170417214410.6A4303A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/98cb19f263aa0a064fb67161ef7f19039c28ae59 >--------------------------------------------------------------- commit 98cb19f263aa0a064fb67161ef7f19039c28ae59 Author: David Feuer Date: Wed Jul 13 22:24:05 2016 -0400 Define pattern synonyms only for GHC >=8 The CPP required to support pattern synonyms with earlier GHC versions produces too much clutter. It's bad enough having to deal with exports with and without testing and with and without pattern synonyms. Having two different export mechanisms goes too far. If users demand support very strenuously, we can put some of it back. Until then, I don't want to commit to supporting it indefinitely. Fixes #297 >--------------------------------------------------------------- 98cb19f263aa0a064fb67161ef7f19039c28ae59 Data/Sequence.hs | 37 +++---------------------------------- 1 file changed, 3 insertions(+), 34 deletions(-) diff --git a/Data/Sequence.hs b/Data/Sequence.hs index 374e2a2..1219ef6 100644 --- a/Data/Sequence.hs +++ b/Data/Sequence.hs @@ -1,6 +1,6 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE BangPatterns #-} -#if __GLASGOW_HASKELL__ >= 708 +#if __GLASGOW_HASKELL__ >= 800 #define DEFINE_PATTERN_SYNONYMS 1 #endif #if __GLASGOW_HASKELL__ @@ -70,28 +70,16 @@ module Data.Sequence ( #if defined(TESTING) Elem(..), FingerTree(..), Node(..), Digit(..), -#if __GLASGOW_HASKELL__ >= 800 +#if defined(DEFINE_PATTERN_SYNONYMS) Seq (.., Empty, (:<|), (:|>)), #else Seq (..), -#if defined(DEFINE_PATTERN_SYNONYMS) - -- * Pattern synonyms - pattern Empty, -- :: Seq a - pattern (:<|), -- :: a -> Seq a -> Seq a - pattern (:|>), -- :: Seq a -> a -> Seq a -#endif #endif -#elif __GLASGOW_HASKELL__ >= 800 +#elif defined(DEFINE_PATTERN_SYNONYMS) Seq (Empty, (:<|), (:|>)), #else Seq, -#if defined(DEFINE_PATTERN_SYNONYMS) - -- * Pattern synonyms - pattern Empty, -- :: Seq a - pattern (:<|), -- :: a -> Seq a -> Seq a - pattern (:|>), -- :: Seq a -> a -> Seq a -#endif #endif -- * Construction empty, -- :: Seq a @@ -294,43 +282,24 @@ infixl 5 :|> -- pattern match warnings for pattern synonyms, we should be -- sure to take advantage of that. --- Unfortunately, there's some extra noise here because --- pattern synonyms could not have signatures until 7.10, --- but 8.0 at least will warn if they're missing. - -- | A pattern synonym matching an empty sequence. -#if __GLASGOW_HASKELL__ >= 710 pattern Empty :: Seq a -#else -#endif pattern Empty = Seq EmptyT --- Non-trivial bidirectional pattern synonyms are only --- available in GHC >= 7.10. In earlier versions, these --- can be used to match, but not to construct. - -- | A pattern synonym viewing the front of a non-empty -- sequence. -#if __GLASGOW_HASKELL__ >= 710 pattern (:<|) :: a -> Seq a -> Seq a -#endif pattern x :<| xs <- (viewl -> x :< xs) -#if __GLASGOW_HASKELL__ >= 710 where x :<| xs = x <| xs -#endif -- | A pattern synonym viewing the rear of a non-empty -- sequence. -#if __GLASGOW_HASKELL__ >= 710 pattern (:|>) :: Seq a -> a -> Seq a -#endif pattern xs :|> x <- (viewr -> xs :> x) -#if __GLASGOW_HASKELL__ >= 710 where xs :|> x = xs |> x #endif -#endif class Sized a where size :: a -> Int From git at git.haskell.org Mon Apr 17 21:44:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:44:12 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #298 from treeowl/narrow-pattern-synonyms (878ea13) Message-ID: <20170417214412.730D23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/878ea13bb95ae69d71986822e8d7d2a5326cca00 >--------------------------------------------------------------- commit 878ea13bb95ae69d71986822e8d7d2a5326cca00 Merge: 1b0cd4b 98cb19f Author: David Feuer Date: Wed Jul 13 22:47:36 2016 -0400 Merge pull request #298 from treeowl/narrow-pattern-synonyms Define pattern synonyms only for GHC >=8 >--------------------------------------------------------------- 878ea13bb95ae69d71986822e8d7d2a5326cca00 Data/Sequence.hs | 37 +++---------------------------------- 1 file changed, 3 insertions(+), 34 deletions(-) From git at git.haskell.org Mon Apr 17 21:44:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:44:14 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394: Inline Map.map; define Map <$ (1a60452) Message-ID: <20170417214414.7DA413A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/1a604529e2b7d9c67ef98605baac061e94203518 >--------------------------------------------------------------- commit 1a604529e2b7d9c67ef98605baac061e94203518 Author: David Feuer Date: Mon Jul 25 10:45:18 2016 -0400 Inline Map.map; define Map <$ Previously, `<$` would fill a map with thunks. Rewriting `map` so it can inline fixes this. Defined a custom `<$` anyway. Fixes #300 >--------------------------------------------------------------- 1a604529e2b7d9c67ef98605baac061e94203518 Data/Map/Base.hs | 13 +++++++++++-- Data/Map/Strict.hs | 9 +++++++-- benchmarks/Map.hs | 8 ++++++-- changelog.md | 4 +++- 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/Data/Map/Base.hs b/Data/Map/Base.hs index aa641f2..4157c17 100644 --- a/Data/Map/Base.hs +++ b/Data/Map/Base.hs @@ -1947,8 +1947,13 @@ mapEitherWithKey f0 t0 = toPair $ go f0 t0 -- > map (++ "x") (fromList [(5,"a"), (3,"b")]) == fromList [(3, "bx"), (5, "ax")] map :: (a -> b) -> Map k a -> Map k b -map _ Tip = Tip -map f (Bin sx kx x l r) = Bin sx kx (f x) (map f l) (map f r) +map f = go where + go Tip = Tip + go (Bin sx kx x l r) = Bin sx kx (f x) (go l) (go r) +-- We use a `go` function to allow `map` to inline. This makes +-- a big difference if someone uses `map (const x) m` instead +-- of `x <$ m`; it doesn't seem to do any harm. + #ifdef __GLASGOW_HASKELL__ {-# NOINLINE [1] map #-} {-# RULES @@ -3023,6 +3028,10 @@ instance (Ord k, Ord v) => Ord (Map k v) where --------------------------------------------------------------------} instance Functor (Map k) where fmap f m = map f m +#if __GLASGOW_HASKELL__ +a <$ Tip = Tip +a <$ (Bin sx kx _ l r) = Bin sx kx a (a <$ l) (a <$ r) +#endif instance Traversable (Map k) where traverse f = traverseWithKey (\_ -> f) diff --git a/Data/Map/Strict.hs b/Data/Map/Strict.hs index 21141fb..2258931 100644 --- a/Data/Map/Strict.hs +++ b/Data/Map/Strict.hs @@ -1013,8 +1013,13 @@ mapEitherWithKey f0 t0 = toPair $ go f0 t0 -- > map (++ "x") (fromList [(5,"a"), (3,"b")]) == fromList [(3, "bx"), (5, "ax")] map :: (a -> b) -> Map k a -> Map k b -map _ Tip = Tip -map f (Bin sx kx x l r) = let x' = f x in x' `seq` Bin sx kx x' (map f l) (map f r) +map f = go + where + go Tip = Tip + go (Bin sx kx x l r) = let !x' = f x in Bin sx kx x' (go l) (go r) +-- We use `go` to let `map` inline. This is important if `f` is a constant +-- function. + #ifdef __GLASGOW_HASKELL__ {-# NOINLINE [1] map #-} {-# RULES diff --git a/benchmarks/Map.hs b/benchmarks/Map.hs index f0ba0b4..1376e62 100644 --- a/benchmarks/Map.hs +++ b/benchmarks/Map.hs @@ -5,12 +5,13 @@ module Main where import Control.Applicative (Const(Const, getConst), pure) import Control.DeepSeq (rnf) import Control.Exception (evaluate) -import Criterion.Main (bench, defaultMain, whnf) +import Criterion.Main (bench, defaultMain, whnf, nf) import Data.Functor.Identity (Identity(..)) import Data.List (foldl') import qualified Data.Map as M import Data.Map (alterF) import Data.Maybe (fromMaybe) +import Data.Functor ((<$)) #if __GLASGOW_HASKELL__ >= 708 import Data.Coerce #endif @@ -24,6 +25,10 @@ main = do defaultMain [ bench "lookup absent" $ whnf (lookup evens) m_odd , bench "lookup present" $ whnf (lookup evens) m_even + , bench "map" $ whnf (M.map (+ 1)) m + , bench "map really" $ nf (M.map (+ 2)) m + , bench "<$" $ whnf ((1 :: Int) <$) m + , bench "<$ really" $ nf ((2 :: Int) <$) m , bench "alterF lookup absent" $ whnf (atLookup evens) m_odd , bench "alterF lookup present" $ whnf (atLookup evens) m_even , bench "alterF no rules lookup absent" $ whnf (atLookupNoRules evens) m_odd @@ -64,7 +69,6 @@ main = do , bench "insertLookupWithKey present" $ whnf (insLookupWithKey elems_even) m_even , bench "insertLookupWithKey' absent" $ whnf (insLookupWithKey' elems_even) m_odd , bench "insertLookupWithKey' present" $ whnf (insLookupWithKey' elems_even) m_even - , bench "map" $ whnf (M.map (+ 1)) m , bench "mapWithKey" $ whnf (M.mapWithKey (+)) m , bench "foldlWithKey" $ whnf (ins elems) m -- , bench "foldlWithKey'" $ whnf (M.foldlWithKey' sum 0) m diff --git a/changelog.md b/changelog.md index 9f3913e..a714e79 100644 --- a/changelog.md +++ b/changelog.md @@ -72,7 +72,9 @@ * Add rewrite rules to fuse `fmap` with `reverse` for `Data.Sequence`. - * Speed up `adjust` for `Data.Map`. + * Speed up `adjust` for `Data.Map`. Allow `map` to inline, and + define a custom `(<$)`. This considerably improves mapping with + a constant function. * Remove non-essential laziness in `Data.Map.Lazy` implementation. From git at git.haskell.org Mon Apr 17 21:44:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:44:16 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #301 from treeowl/map-inline-map (b2280fc) Message-ID: <20170417214416.872CF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/b2280fc71f318af9fd996a3bc4149b0b6cf7178e >--------------------------------------------------------------- commit b2280fc71f318af9fd996a3bc4149b0b6cf7178e Merge: 878ea13 1a60452 Author: David Feuer Date: Mon Jul 25 11:22:15 2016 -0400 Merge pull request #301 from treeowl/map-inline-map Inline Map.map; define Map <$ >--------------------------------------------------------------- b2280fc71f318af9fd996a3bc4149b0b6cf7178e Data/Map/Base.hs | 13 +++++++++++-- Data/Map/Strict.hs | 9 +++++++-- benchmarks/Map.hs | 8 ++++++-- changelog.md | 4 +++- 4 files changed, 27 insertions(+), 7 deletions(-) From git at git.haskell.org Mon Apr 17 21:44:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:44:18 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394: Rewrite IntMap map so it can inline; define <$ (a4f439c) Message-ID: <20170417214418.908313A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/a4f439cb7e0c038f49ca186863a25ae0319429e8 >--------------------------------------------------------------- commit a4f439cb7e0c038f49ca186863a25ae0319429e8 Author: David Feuer Date: Mon Jul 25 11:34:38 2016 -0400 Rewrite IntMap map so it can inline; define <$ Previously, mapping a constant function would fill an `IntMap` with thunks. >--------------------------------------------------------------- a4f439cb7e0c038f49ca186863a25ae0319429e8 Data/IntMap/Base.hs | 17 ++++++++++++----- Data/IntMap/Strict.hs | 10 +++++----- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/Data/IntMap/Base.hs b/Data/IntMap/Base.hs index 845a590..2a735bb 100644 --- a/Data/IntMap/Base.hs +++ b/Data/IntMap/Base.hs @@ -248,6 +248,7 @@ import Data.Utils.StrictPair import Data.Data (Data(..), Constr, mkConstr, constrIndex, Fixity(Prefix), DataType, mkDataType) import GHC.Exts (build) +import Data.Functor ((<$)) #if __GLASGOW_HASKELL__ >= 708 import qualified GHC.Exts as GHCExts #endif @@ -1330,11 +1331,11 @@ isSubmapOfBy _ Nil _ = True -- > map (++ "x") (fromList [(5,"a"), (3,"b")]) == fromList [(3, "bx"), (5, "ax")] map :: (a -> b) -> IntMap a -> IntMap b -map f t - = case t of - Bin p m l r -> Bin p m (map f l) (map f r) - Tip k x -> Tip k (f x) - Nil -> Nil +map f = go + where + go (Bin p m l r) = Bin p m (go l) (go r) + go (Tip k x) = Tip k (f x) + go Nil = Nil #ifdef __GLASGOW_HASKELL__ {-# NOINLINE [1] map #-} @@ -2096,6 +2097,12 @@ instance Ord a => Ord (IntMap a) where instance Functor IntMap where fmap = map +#ifdef __GLASGOW_HASKELL__ + a <$ Bin p m l r = Bin p m (a <$ l) (a <$ r) + a <$ Tip k _ = Tip k a + a <$ Nil = Nil +#endif + {-------------------------------------------------------------------- Show --------------------------------------------------------------------} diff --git a/Data/IntMap/Strict.hs b/Data/IntMap/Strict.hs index 42d2340..d020e9f 100644 --- a/Data/IntMap/Strict.hs +++ b/Data/IntMap/Strict.hs @@ -767,11 +767,11 @@ updateMin f = updateMinWithKey (const f) -- > map (++ "x") (fromList [(5,"a"), (3,"b")]) == fromList [(3, "bx"), (5, "ax")] map :: (a -> b) -> IntMap a -> IntMap b -map f t - = case t of - Bin p m l r -> Bin p m (map f l) (map f r) - Tip k x -> Tip k $! f x - Nil -> Nil +map f = go + where + go (Bin p m l r) = Bin p m (go l) (go r) + go (Tip k x) = Tip k $! f x + go Nil = Nil #ifdef __GLASGOW_HASKELL__ {-# NOINLINE [1] map #-} From git at git.haskell.org Mon Apr 17 21:44:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:44:20 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #302 from treeowl/intmap-inline-map (2c8b669) Message-ID: <20170417214420.994FD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/2c8b6690ff5cea651d7a22612a796153306b6d91 >--------------------------------------------------------------- commit 2c8b6690ff5cea651d7a22612a796153306b6d91 Merge: b2280fc a4f439c Author: David Feuer Date: Mon Jul 25 11:49:37 2016 -0400 Merge pull request #302 from treeowl/intmap-inline-map Rewrite IntMap map so it can inline; define <$ >--------------------------------------------------------------- 2c8b6690ff5cea651d7a22612a796153306b6d91 Data/IntMap/Base.hs | 17 ++++++++++++----- Data/IntMap/Strict.hs | 10 +++++----- 2 files changed, 17 insertions(+), 10 deletions(-) From git at git.haskell.org Mon Apr 17 21:44:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:44:22 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Actually define the (<$) method (ec0fdbb) Message-ID: <20170417214422.A51E33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/ec0fdbbeda7bd0265935ecb073c4e2544d4a9799 >--------------------------------------------------------------- commit ec0fdbbeda7bd0265935ecb073c4e2544d4a9799 Author: David Feuer Date: Mon Jul 25 12:01:26 2016 -0400 Actually define the (<$) method Accidentally defined a separate `(<$)` function for `Data.Map`. Also, fix unused binding warnings. >--------------------------------------------------------------- ec0fdbbeda7bd0265935ecb073c4e2544d4a9799 Data/IntMap/Base.hs | 2 +- Data/Map/Base.hs | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Data/IntMap/Base.hs b/Data/IntMap/Base.hs index 2a735bb..6fcca50 100644 --- a/Data/IntMap/Base.hs +++ b/Data/IntMap/Base.hs @@ -2100,7 +2100,7 @@ instance Functor IntMap where #ifdef __GLASGOW_HASKELL__ a <$ Bin p m l r = Bin p m (a <$ l) (a <$ r) a <$ Tip k _ = Tip k a - a <$ Nil = Nil + _ <$ Nil = Nil #endif {-------------------------------------------------------------------- diff --git a/Data/Map/Base.hs b/Data/Map/Base.hs index 4157c17..792206b 100644 --- a/Data/Map/Base.hs +++ b/Data/Map/Base.hs @@ -318,6 +318,7 @@ import Data.Utils.BitUtil (wordSize) #if __GLASGOW_HASKELL__ import GHC.Exts (build) +import Data.Functor ((<$)) #if USE_MAGIC_PROXY import GHC.Exts (Proxy#, proxy# ) #endif @@ -3028,9 +3029,9 @@ instance (Ord k, Ord v) => Ord (Map k v) where --------------------------------------------------------------------} instance Functor (Map k) where fmap f m = map f m -#if __GLASGOW_HASKELL__ -a <$ Tip = Tip -a <$ (Bin sx kx _ l r) = Bin sx kx a (a <$ l) (a <$ r) +#ifdef __GLASGOW_HASKELL__ + _ <$ Tip = Tip + a <$ (Bin sx kx _ l r) = Bin sx kx a (a <$ l) (a <$ r) #endif instance Traversable (Map k) where From git at git.haskell.org Mon Apr 17 21:44:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:44:24 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #303 from treeowl/fix-replace (f24a6f4) Message-ID: <20170417214424.AEA333A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/f24a6f4a32f08810c0f46b72ffe66188caf83d68 >--------------------------------------------------------------- commit f24a6f4a32f08810c0f46b72ffe66188caf83d68 Merge: 2c8b669 ec0fdbb Author: David Feuer Date: Mon Jul 25 12:06:00 2016 -0400 Merge pull request #303 from treeowl/fix-replace Actually define the (<$) method >--------------------------------------------------------------- f24a6f4a32f08810c0f46b72ffe66188caf83d68 Data/IntMap/Base.hs | 2 +- Data/Map/Base.hs | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) From git at git.haskell.org Mon Apr 17 21:44:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:44:26 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Add restrictKeys and withoutKeys (f90ab2f) Message-ID: <20170417214426.C1C9A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/f90ab2ff8b78fd16a7486f643b54ff0d11a0c021 >--------------------------------------------------------------- commit f90ab2ff8b78fd16a7486f643b54ff0d11a0c021 Author: David Feuer Date: Tue Jul 26 00:05:06 2016 -0400 Add restrictKeys and withoutKeys * Add `restrictKeys` and `withoutKeys` to `Data.Map` and `Data.IntMap`. * Add tests for the defining properties of these operations. >--------------------------------------------------------------- f90ab2ff8b78fd16a7486f643b54ff0d11a0c021 Data/IntMap/Base.hs | 89 ++++++++++++++++++++++++++++++++++++++++++++++ Data/IntMap/Lazy.hs | 2 ++ Data/IntMap/Strict.hs | 2 ++ Data/Map/Base.hs | 60 +++++++++++++++++++++++++++++-- Data/Map/Lazy.hs | 2 ++ Data/Map/Strict.hs | 2 ++ Data/Set/Base.hs | 6 ++-- Data/Utils/StrictMaybe.hs | 21 +++++++++++ changelog.md | 3 +- containers.cabal | 1 + tests/intmap-properties.hs | 26 ++++++++++---- tests/map-properties.hs | 28 +++++++++++---- 12 files changed, 222 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 f90ab2ff8b78fd16a7486f643b54ff0d11a0c021 From git at git.haskell.org Mon Apr 17 21:44:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:44:28 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #305 from treeowl/restriction (1d2807a) Message-ID: <20170417214428.CD75C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/1d2807a6e537f1de2e10bfef58d44229e225dc4e >--------------------------------------------------------------- commit 1d2807a6e537f1de2e10bfef58d44229e225dc4e Merge: f24a6f4 f90ab2f Author: David Feuer Date: Tue Jul 26 01:36:09 2016 -0400 Merge pull request #305 from treeowl/restriction Add restrictKeys and withoutKeys >--------------------------------------------------------------- 1d2807a6e537f1de2e10bfef58d44229e225dc4e Data/IntMap/Base.hs | 89 ++++++++++++++++++++++++++++++++++++++++++++++ Data/IntMap/Lazy.hs | 2 ++ Data/IntMap/Strict.hs | 2 ++ Data/Map/Base.hs | 60 +++++++++++++++++++++++++++++-- Data/Map/Lazy.hs | 2 ++ Data/Map/Strict.hs | 2 ++ Data/Set/Base.hs | 6 ++-- Data/Utils/StrictMaybe.hs | 21 +++++++++++ changelog.md | 3 +- containers.cabal | 1 + tests/intmap-properties.hs | 26 ++++++++++---- tests/map-properties.hs | 28 +++++++++++---- 12 files changed, 222 insertions(+), 20 deletions(-) From git at git.haskell.org Mon Apr 17 21:44:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:44:30 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Stop using hedge algorithms (c3083cf) Message-ID: <20170417214430.DD2283A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/c3083cfceb4fa1370e764698019e97faadee44e7 >--------------------------------------------------------------- commit c3083cfceb4fa1370e764698019e97faadee44e7 Author: David Feuer Date: Thu Jul 28 21:52:08 2016 -0400 Stop using hedge algorithms Replace hedge algorithms with divide and conquer algorithms for unions, intersections, differences, and merges in `Data.Set` and `Data.Map`. The divide and conquer algorithms * are much simpler, * have recently been proven asymptotically optimal, and * are faster on most benchmarks, sometimes much faster, and never much slower. >--------------------------------------------------------------- c3083cfceb4fa1370e764698019e97faadee44e7 .gitignore | 1 + Data/IntMap/Base.hs | 2 + Data/Map/Base.hs | 307 +++++++++++++++------------------------------- Data/Map/Strict.hs | 53 ++++---- Data/Set/Base.hs | 161 +++++------------------- Data/Utils/StrictMaybe.hs | 7 ++ changelog.md | 5 + 7 files changed, 169 insertions(+), 367 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc c3083cfceb4fa1370e764698019e97faadee44e7 From git at git.haskell.org Mon Apr 17 21:44:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:44:32 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #310 from treeowl/set-div-conq (2a8f77c) Message-ID: <20170417214432.E6FA13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/2a8f77cd916fd85d00b528d87383f3a1505e9734 >--------------------------------------------------------------- commit 2a8f77cd916fd85d00b528d87383f3a1505e9734 Merge: 1d2807a c3083cf Author: David Feuer Date: Mon Aug 1 02:41:32 2016 -0400 Merge pull request #310 from treeowl/set-div-conq Stop using hedge algorithms >--------------------------------------------------------------- 2a8f77cd916fd85d00b528d87383f3a1505e9734 .gitignore | 1 + Data/IntMap/Base.hs | 2 + Data/Map/Base.hs | 307 +++++++++++++++------------------------------- Data/Map/Strict.hs | 53 ++++---- Data/Set/Base.hs | 161 +++++------------------- Data/Utils/StrictMaybe.hs | 7 ++ changelog.md | 5 + 7 files changed, 169 insertions(+), 367 deletions(-) From git at git.haskell.org Mon Apr 17 21:44:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:44:37 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #311 from treeowl/set-ptr-equality (60f4f76) Message-ID: <20170417214437.05E8B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/60f4f76a61cbd0feeb4d71f062c2b8387e1a0d57 >--------------------------------------------------------------- commit 60f4f76a61cbd0feeb4d71f062c2b8387e1a0d57 Merge: 2a8f77c b5fb21e Author: David Feuer Date: Mon Aug 1 13:32:58 2016 -0400 Merge pull request #311 from treeowl/set-ptr-equality Use pointer equality to enhance sharing for Sets >--------------------------------------------------------------- 60f4f76a61cbd0feeb4d71f062c2b8387e1a0d57 Data/Set/Base.hs | 67 +++++++++++++++++++++++++++++++++-------------- Data/Utils/PtrEquality.hs | 26 ++++++++++++++++++ containers.cabal | 1 + 3 files changed, 75 insertions(+), 19 deletions(-) From git at git.haskell.org Mon Apr 17 21:44:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:44:34 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Use pointer equality to enhance sharing for Sets (b5fb21e) Message-ID: <20170417214434.F044E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/b5fb21e73392c5c0077e8eb62f0ff7093e2199f0 >--------------------------------------------------------------- commit b5fb21e73392c5c0077e8eb62f0ff7093e2199f0 Author: David Feuer Date: Mon Aug 1 13:10:00 2016 -0400 Use pointer equality to enhance sharing for Sets Use pointer equality to avoid allocating new copies of existing structures. This helps a number of benchmarks a *lot*. Unfortunately, it hurts some others a little. >--------------------------------------------------------------- b5fb21e73392c5c0077e8eb62f0ff7093e2199f0 Data/Set/Base.hs | 67 +++++++++++++++++++++++++++++++++-------------- Data/Utils/PtrEquality.hs | 26 ++++++++++++++++++ containers.cabal | 1 + 3 files changed, 75 insertions(+), 19 deletions(-) diff --git a/Data/Set/Base.hs b/Data/Set/Base.hs index 1885be7..487db12 100644 --- a/Data/Set/Base.hs +++ b/Data/Set/Base.hs @@ -212,6 +212,7 @@ import Control.DeepSeq (NFData(rnf)) import Data.Utils.StrictFold import Data.Utils.StrictPair +import Data.Utils.PtrEquality #if __GLASGOW_HASKELL__ import GHC.Exts ( build ) @@ -485,10 +486,15 @@ insert = go where go :: Ord a => a -> Set a -> Set a go !x Tip = singleton x - go x (Bin sz y l r) = case compare x y of - LT -> balanceL y (go x l) r - GT -> balanceR y l (go x r) - EQ -> Bin sz x l r + go !x t@(Bin sz y l r) = case compare x y of + LT | l' `ptrEq` l -> t + | otherwise -> balanceL y l' r + where !l' = go x l + GT | r' `ptrEq` r -> t + | otherwise -> balanceR y l r' + where !r' = go x r + EQ | x `ptrEq` y -> t + | otherwise -> Bin sz x l r #if __GLASGOW_HASKELL__ {-# INLINABLE insert #-} #else @@ -504,9 +510,13 @@ insertR = go where go :: Ord a => a -> Set a -> Set a go !x Tip = singleton x - go x t@(Bin _ y l r) = case compare x y of - LT -> balanceL y (go x l) r - GT -> balanceR y l (go x r) + go !x t@(Bin _ y l r) = case compare x y of + LT | l' `ptrEq` l -> t + | otherwise -> balanceL y l' r + where !l' = go x l + GT | r' `ptrEq` r -> t + | otherwise -> balanceR y l r' + where !r' = go x r EQ -> t #if __GLASGOW_HASKELL__ {-# INLINABLE insertR #-} @@ -522,9 +532,13 @@ delete = go where go :: Ord a => a -> Set a -> Set a go !_ Tip = Tip - go x (Bin _ y l r) = case compare x y of - LT -> balanceR y (go x l) r - GT -> balanceL y l (go x r) + go x t@(Bin _ y l r) = case compare x y of + LT | l' `ptrEq` l -> t + | otherwise -> balanceR y l' r + where !l' = go x l + GT | r' `ptrEq` r -> t + | otherwise -> balanceL y l r' + where !r' = go x r EQ -> glue l r #if __GLASGOW_HASKELL__ {-# INLINABLE delete #-} @@ -609,8 +623,12 @@ union t1 Tip = t1 union t1 (Bin _ x Tip Tip) = insertR x t1 union (Bin _ x Tip Tip) t2 = insert x t2 union Tip t2 = t2 -union (Bin _ x l r) t2 = case splitS x t2 of - (l2 :*: r2) -> link x (union l l2) (union r r2) +union t1@(Bin _ x l1 r1) t2 = case splitS x t2 of + (l2 :*: r2) + | l1l2 `ptrEq` l1 && r1r2 `ptrEq` r1 -> t1 + | otherwise -> link x l1l2 r1r2 + where !l1l2 = union l1 l2 + !r1r2 = union r1 r2 #if __GLASGOW_HASKELL__ {-# INLINABLE union #-} #endif @@ -622,8 +640,12 @@ union (Bin _ x l r) t2 = case splitS x t2 of difference :: Ord a => Set a -> Set a -> Set a difference Tip _ = Tip difference t1 Tip = t1 -difference t1 (Bin _ x l2 r2) = case splitS x t1 of - (l1 :*: r1) -> merge (difference l1 l2) (difference r1 r2) +difference t1 (Bin _ x l2 r2) = case splitMember x t1 of + (l1, b, r1) + | not b && l1l2 `ptrEq` l1 && r1r2 `ptrEq` r1 -> t1 + | otherwise -> merge l1l2 r1r2 + where !l1l2 = difference l1 l2 + !r1r2 = difference r1 r2 #if __GLASGOW_HASKELL__ {-# INLINABLE difference #-} #endif @@ -645,8 +667,10 @@ difference t1 (Bin _ x l2 r2) = case splitS x t1 of intersection :: Ord a => Set a -> Set a -> Set a intersection Tip _ = Tip intersection _ Tip = Tip -intersection (Bin _ x l1 r1) t2 - | b = link x l1l2 r1r2 +intersection t1@(Bin _ x l1 r1) t2 + | b = if l1l2 `ptrEq` l1 && r1r2 `ptrEq` r1 + then t1 + else link x l1l2 r1r2 | otherwise = merge l1l2 r1r2 where !(l2, b, r2) = splitMember x t2 @@ -662,9 +686,14 @@ intersection (Bin _ x l1 r1) t2 -- | /O(n)/. Filter all elements that satisfy the predicate. filter :: (a -> Bool) -> Set a -> Set a filter _ Tip = Tip -filter p (Bin _ x l r) - | p x = link x (filter p l) (filter p r) - | otherwise = merge (filter p l) (filter p r) +filter p t@(Bin _ x l r) + | p x = if l `ptrEq` l' && r `ptrEq` r' + then t + else link x l' r' + | otherwise = merge l' r' + where + !l' = filter p l + !r' = filter p r -- | /O(n)/. Partition the set into two sets, one with all elements that satisfy -- the predicate and one with all elements that don't satisfy the predicate. diff --git a/Data/Utils/PtrEquality.hs b/Data/Utils/PtrEquality.hs new file mode 100644 index 0000000..5ab38fa --- /dev/null +++ b/Data/Utils/PtrEquality.hs @@ -0,0 +1,26 @@ +{-# LANGUAGE CPP #-} +#ifdef __GLASGOW_HASKELL__ +{-# LANGUAGE MagicHash #-} +#endif + +module Data.Utils.PtrEquality (ptrEq) where + +#ifdef __GLASGOW_HASKELL__ +import GHC.Exts ( reallyUnsafePtrEquality# ) + +-- | Checks if two pointers are equal. Yes means yes; +-- no means maybe. The values should be forced to at least +-- WHNF before comparison to get moderately reliable results. +ptrEq :: a -> a -> Bool +ptrEq x y = case reallyUnsafePtrEquality# x y of + 1# -> True + _ -> False + +#else +ptrEq :: a -> a -> Bool +ptrEq _ _ = False +#endif + +{-# INLINE ptrEq #-} + +infix 4 `ptrEq` diff --git a/containers.cabal b/containers.cabal index a4200e3..fa593d0 100644 --- a/containers.cabal +++ b/containers.cabal @@ -62,6 +62,7 @@ Library Data.Utils.StrictFold Data.Utils.StrictPair Data.Utils.StrictMaybe + Data.Utils.PtrEquality include-dirs: include From git at git.haskell.org Mon Apr 17 21:44:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:44:39 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Use isTrue# for pointer equality (110a6c4) Message-ID: <20170417214439.0DD053A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/110a6c435e3389c065cd1bcb353c3b8335e356f2 >--------------------------------------------------------------- commit 110a6c435e3389c065cd1bcb353c3b8335e356f2 Author: David Feuer Date: Mon Aug 1 13:56:31 2016 -0400 Use isTrue# for pointer equality Edward Kmett says it's better to do that and take the load off core-to-core. Currently, that gets shifted to codegen, I think. >--------------------------------------------------------------- 110a6c435e3389c065cd1bcb353c3b8335e356f2 Data/Utils/PtrEquality.hs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Data/Utils/PtrEquality.hs b/Data/Utils/PtrEquality.hs index 5ab38fa..324ef40 100644 --- a/Data/Utils/PtrEquality.hs +++ b/Data/Utils/PtrEquality.hs @@ -7,14 +7,21 @@ module Data.Utils.PtrEquality (ptrEq) where #ifdef __GLASGOW_HASKELL__ import GHC.Exts ( reallyUnsafePtrEquality# ) +#if __GLASGOW_HASKELL__ < 707 +import GHC.Exts ( (==#) ) +#else +import GHC.Exts ( isTrue# ) +#endif -- | Checks if two pointers are equal. Yes means yes; -- no means maybe. The values should be forced to at least -- WHNF before comparison to get moderately reliable results. ptrEq :: a -> a -> Bool -ptrEq x y = case reallyUnsafePtrEquality# x y of - 1# -> True - _ -> False +#if __GLASGOW_HASKELL__ < 707 +ptrEq x y = reallyUnsafePtrEquality# x y ==# 1# +#else +ptrEq x y = isTrue# (reallyUnsafePtrEquality# x y) +#endif #else ptrEq :: a -> a -> Bool From git at git.haskell.org Mon Apr 17 21:44:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:44:41 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #312 from treeowl/isTrue (45bfe23) Message-ID: <20170417214441.171F53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/45bfe23ba21bb43b8c48ca8600c3becf5284cc1c >--------------------------------------------------------------- commit 45bfe23ba21bb43b8c48ca8600c3becf5284cc1c Merge: 60f4f76 110a6c4 Author: David Feuer Date: Mon Aug 1 14:29:31 2016 -0400 Merge pull request #312 from treeowl/isTrue Use isTrue# for pointer equality >--------------------------------------------------------------- 45bfe23ba21bb43b8c48ca8600c3becf5284cc1c Data/Utils/PtrEquality.hs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) From git at git.haskell.org Mon Apr 17 21:44:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:44:43 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Continue to improve map functions (11cd73c) Message-ID: <20170417214443.2629C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/11cd73c643c4dd1854c18abeea0738862168971c >--------------------------------------------------------------- commit 11cd73c643c4dd1854c18abeea0738862168971c Author: David Feuer Date: Mon Aug 1 17:40:14 2016 -0400 Continue to improve map functions Rewrite `unionWith`, `intersectionWithKey`, etc., as independent functions. Writing either in terms of the other leads to closures being allocated with extra indirection for the passed function. `mergeWithKey` misses singleton optimizations for unions. For the rest, I think `mergeWithKey` is hard to understand, and it's not immediately obvious how the parts are supposed to fit together. Since it's used only to reduce *source* code size, and not actual *generated* code size, I'd rather avoid it for the most part. I've left `differenceWith` and `differenceWithKey` alone, as they appear to be rather deeply tied to the concepts in `mergeWithKey`. >--------------------------------------------------------------- 11cd73c643c4dd1854c18abeea0738862168971c Data/Map/Base.hs | 295 +++++++++++++++++++++++++++++++++++----------- Data/Map/Strict.hs | 92 ++++++++++++++- Data/Set/Base.hs | 11 +- Data/Utils/PtrEquality.hs | 6 +- tests/map-properties.hs | 32 ++++- tests/set-properties.hs | 27 +++++ 6 files changed, 382 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 11cd73c643c4dd1854c18abeea0738862168971c From git at git.haskell.org Mon Apr 17 21:44:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:44:45 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Bunch of changes (93fd868) Message-ID: <20170417214445.300613A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/93fd868c443a20e1ae4a674fe0cfc01f51aeca4e >--------------------------------------------------------------- commit 93fd868c443a20e1ae4a674fe0cfc01f51aeca4e Author: David Feuer Date: Sat Aug 6 14:20:25 2016 -0400 Bunch of changes * Continue set and map combination rewrites. * Add bias tests to `Data.Set` suite. * Replace `Arbitrary` instance for sets. * Use specialized function to produce pairs of sets for combination tests. This is a horribly large and incomplete commit, but it all works and I need to move on to some other things. Sorry, world. >--------------------------------------------------------------- 93fd868c443a20e1ae4a674fe0cfc01f51aeca4e containers.cabal | 16 ++-- tests/map-properties.hs | 29 ++----- tests/set-properties.hs | 211 ++++++++++++++++++++++++++++++++++++++---------- 3 files changed, 182 insertions(+), 74 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 93fd868c443a20e1ae4a674fe0cfc01f51aeca4e From git at git.haskell.org Mon Apr 17 21:44:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:44:47 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #315 from treeowl/map-combination-update (66d8bec) Message-ID: <20170417214447.39E143A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/66d8bec7422e72a4619db90edee5f8b36c59d739 >--------------------------------------------------------------- commit 66d8bec7422e72a4619db90edee5f8b36c59d739 Merge: 45bfe23 93fd868 Author: David Feuer Date: Sat Aug 6 15:38:08 2016 -0400 Merge pull request #315 from treeowl/map-combination-update Continue to improve map functions >--------------------------------------------------------------- 66d8bec7422e72a4619db90edee5f8b36c59d739 Data/Map/Base.hs | 295 +++++++++++++++++++++++++++++++++++----------- Data/Map/Strict.hs | 92 ++++++++++++++- Data/Set/Base.hs | 11 +- Data/Utils/PtrEquality.hs | 6 +- containers.cabal | 16 +-- tests/map-properties.hs | 17 ++- tests/set-properties.hs | 230 ++++++++++++++++++++++++++++++------ 7 files changed, 538 insertions(+), 129 deletions(-) From git at git.haskell.org Mon Apr 17 21:44:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:44:49 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Kill a bunch of silly warnings. (51bc08c) Message-ID: <20170417214449.447443A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/51bc08cbcb17faacb5ed687241ab93116ff3b8ad >--------------------------------------------------------------- commit 51bc08cbcb17faacb5ed687241ab93116ff3b8ad Author: David Feuer Date: Wed Aug 10 16:39:04 2016 -0400 Kill a bunch of silly warnings. Just name shadowing and unused binding nonsense. >--------------------------------------------------------------- 51bc08cbcb17faacb5ed687241ab93116ff3b8ad Data/Map/Base.hs | 18 +++++++++--------- Data/Map/Strict.hs | 12 ++++++------ Data/Utils/PtrEquality.hs | 1 - 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/Data/Map/Base.hs b/Data/Map/Base.hs index 07b7127..ff52b10 100644 --- a/Data/Map/Base.hs +++ b/Data/Map/Base.hs @@ -704,7 +704,7 @@ insertR = go where go :: Ord k => k -> a -> Map k a -> Map k a go !kx x Tip = singleton kx x - go kx x t@(Bin sz ky y l r) = + go kx x t@(Bin _ ky y l r) = case compare kx ky of LT | l' `ptrEq` l -> t | otherwise -> balanceL ky y l' r @@ -1781,9 +1781,9 @@ restrictKeys m@(Bin _ k x l1 r1) s intersectionWith :: Ord k => (a -> b -> c) -> Map k a -> Map k b -> Map k c -- We have no hope of pointer equality tricks here because every single -- element in the result will be a thunk. -intersectionWith f Tip _ = Tip -intersectionWith f _ Tip = Tip -intersectionWith f t1@(Bin _ k x1 l1 r1) t2 = case mb of +intersectionWith _f Tip _ = Tip +intersectionWith _f _ Tip = Tip +intersectionWith f (Bin _ k x1 l1 r1) t2 = case mb of Just x2 -> link k (f x1 x2) l1l2 r1r2 Nothing -> merge l1l2 r1r2 where @@ -1800,9 +1800,9 @@ intersectionWith f t1@(Bin _ k x1 l1 r1) t2 = case mb of -- > intersectionWithKey f (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "5:a|A" intersectionWithKey :: Ord k => (k -> a -> b -> c) -> Map k a -> Map k b -> Map k c -intersectionWithKey f Tip _ = Tip -intersectionWithKey f _ Tip = Tip -intersectionWithKey f t1@(Bin _ k x1 l1 r1) t2 = case mb of +intersectionWithKey _f Tip _ = Tip +intersectionWithKey _f _ Tip = Tip +intersectionWithKey f (Bin _ k x1 l1 r1) t2 = case mb of Just x2 -> link k (f k x1 x2) l1l2 r1r2 Nothing -> merge l1l2 r1r2 where @@ -2797,7 +2797,7 @@ split !k0 t0 = toPair $ go k0 t0 -- > splitLookup 5 (fromList [(5,"a"), (3,"b")]) == (singleton 3 "b", Just "a", empty) -- > splitLookup 6 (fromList [(5,"a"), (3,"b")]) == (fromList [(3,"b"), (5,"a")], Nothing, empty) splitLookup :: Ord k => k -> Map k a -> (Map k a,Maybe a,Map k a) -splitLookup k m = case go k m of +splitLookup k0 m = case go k0 m of StrictTriple l mv r -> (l, mv, r) where go :: Ord k => k -> Map k a -> StrictTriple (Map k a) (Maybe a) (Map k a) @@ -2821,7 +2821,7 @@ splitLookup k m = case go k m of -- implement 'intersection' to avoid allocating unnecessary 'Just' -- constructors. splitMember :: Ord k => k -> Map k a -> (Map k a,Bool,Map k a) -splitMember k m = case go k m of +splitMember k0 m = case go k0 m of StrictTriple l mv r -> (l, mv, r) where go :: Ord k => k -> Map k a -> StrictTriple (Map k a) Bool (Map k a) diff --git a/Data/Map/Strict.hs b/Data/Map/Strict.hs index ba059ec..6e1f6e0 100644 --- a/Data/Map/Strict.hs +++ b/Data/Map/Strict.hs @@ -928,9 +928,9 @@ differenceWithKey f t1 t2 = mergeWithKey f id (const Tip) t1 t2 -- > intersectionWith (++) (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "aA" intersectionWith :: Ord k => (a -> b -> c) -> Map k a -> Map k b -> Map k c -intersectionWith f Tip _ = Tip -intersectionWith f _ Tip = Tip -intersectionWith f t1@(Bin _ k x1 l1 r1) t2 = case mb of +intersectionWith _f Tip _ = Tip +intersectionWith _f _ Tip = Tip +intersectionWith f (Bin _ k x1 l1 r1) t2 = case mb of Just x2 -> let !x1' = f x1 x2 in link k x1' l1l2 r1r2 Nothing -> merge l1l2 r1r2 where @@ -947,9 +947,9 @@ intersectionWith f t1@(Bin _ k x1 l1 r1) t2 = case mb of -- > intersectionWithKey f (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "5:a|A" intersectionWithKey :: Ord k => (k -> a -> b -> c) -> Map k a -> Map k b -> Map k c -intersectionWithKey f Tip _ = Tip -intersectionWithKey f _ Tip = Tip -intersectionWithKey f t1@(Bin _ k x1 l1 r1) t2 = case mb of +intersectionWithKey _f Tip _ = Tip +intersectionWithKey _f _ Tip = Tip +intersectionWithKey f (Bin _ k x1 l1 r1) t2 = case mb of Just x2 -> let !x1' = f k x1 x2 in link k x1' l1l2 r1r2 Nothing -> merge l1l2 r1r2 where diff --git a/Data/Utils/PtrEquality.hs b/Data/Utils/PtrEquality.hs index ca89af5..bdbb87d 100644 --- a/Data/Utils/PtrEquality.hs +++ b/Data/Utils/PtrEquality.hs @@ -7,7 +7,6 @@ module Data.Utils.PtrEquality (ptrEq) where #ifdef __GLASGOW_HASKELL__ import GHC.Exts ( reallyUnsafePtrEquality# ) -import Unsafe.Coerce (unsafeCoerce) #if __GLASGOW_HASKELL__ < 707 import GHC.Exts ( (==#) ) #else From git at git.haskell.org Mon Apr 17 21:44:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:44:51 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #318 from treeowl/kill-warnings (96a2e22) Message-ID: <20170417214451.4E1B33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/96a2e22767850e9da80aa83299fc692136f9854b >--------------------------------------------------------------- commit 96a2e22767850e9da80aa83299fc692136f9854b Merge: 66d8bec 51bc08c Author: David Feuer Date: Wed Aug 10 17:35:35 2016 -0400 Merge pull request #318 from treeowl/kill-warnings Kill a bunch of silly warnings. >--------------------------------------------------------------- 96a2e22767850e9da80aa83299fc692136f9854b Data/Map/Base.hs | 18 +++++++++--------- Data/Map/Strict.hs | 12 ++++++------ Data/Utils/PtrEquality.hs | 1 - 3 files changed, 15 insertions(+), 16 deletions(-) From git at git.haskell.org Mon Apr 17 21:44:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:44:53 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Add general merge functions for maps (9fc8b45) Message-ID: <20170417214453.74EC73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/9fc8b45b71879b040cdb101ba4bd1fd923b4ae1a >--------------------------------------------------------------- commit 9fc8b45b71879b040cdb101ba4bd1fd923b4ae1a Author: David Feuer Date: Mon Aug 8 11:52:23 2016 -0400 Add general merge functions for maps * Add `merge` and `mergeA` for `Data.Map`, in the new modules `Data.Map.Lazy.Merge` and `Data.Map.Strict.Merge`. * Expose internal modules per Ed Kmett's request * Make `difference` for maps and sets conform more closely to the algorithm in Blelloch et al so we can rely on their proof. >--------------------------------------------------------------- 9fc8b45b71879b040cdb101ba4bd1fd923b4ae1a Data/IntMap/Base.hs | 15 + Data/IntSet/Base.hs | 15 + Data/Map.hs | 8 +- Data/Map/Base.hs | 731 ++++- Data/Map/Lazy.hs | 17 +- Data/Map/Lazy/Merge.hs | 103 + Data/Map/Strict.hs | 1250 +-------- Data/Map/{Strict.hs => Strict/Internal.hs} | 403 ++- Data/Map/Strict/Merge.hs | 99 + Data/Sequence.hs | 4120 +--------------------------- Data/{Sequence.hs => Sequence/Base.hs} | 30 +- Data/Set.hs | 8 +- Data/Set/Base.hs | 19 +- Data/Utils/BitQueue.hs | 16 + Data/Utils/BitUtil.hs | 13 + Data/Utils/PtrEquality.hs | 30 +- Data/Utils/StrictFold.hs | 13 + Data/Utils/StrictMaybe.hs | 15 + Data/Utils/StrictPair.hs | 16 + changelog.md | 7 + containers.cabal | 15 +- tests/map-properties.hs | 27 +- tests/seq-properties.hs | 2 +- 23 files changed, 1446 insertions(+), 5526 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 9fc8b45b71879b040cdb101ba4bd1fd923b4ae1a From git at git.haskell.org Mon Apr 17 21:44:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:44:55 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #319 from treeowl/generalMerge2 (e268e62) Message-ID: <20170417214455.8D3593A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/e268e62fcc45dc37742d9f5c9ca1b95f96e38661 >--------------------------------------------------------------- commit e268e62fcc45dc37742d9f5c9ca1b95f96e38661 Merge: 96a2e22 9fc8b45 Author: David Feuer Date: Thu Aug 25 16:13:02 2016 -0400 Merge pull request #319 from treeowl/generalMerge2 Add general merge functions for maps >--------------------------------------------------------------- e268e62fcc45dc37742d9f5c9ca1b95f96e38661 Data/IntMap/Base.hs | 15 + Data/IntSet/Base.hs | 15 + Data/Map.hs | 8 +- Data/Map/Base.hs | 731 ++++- Data/Map/Lazy.hs | 17 +- Data/Map/Lazy/Merge.hs | 103 + Data/Map/Strict.hs | 1250 +-------- Data/Map/{Strict.hs => Strict/Internal.hs} | 403 ++- Data/Map/Strict/Merge.hs | 99 + Data/Sequence.hs | 4120 +--------------------------- Data/{Sequence.hs => Sequence/Base.hs} | 30 +- Data/Set.hs | 8 +- Data/Set/Base.hs | 19 +- Data/Utils/BitQueue.hs | 16 + Data/Utils/BitUtil.hs | 13 + Data/Utils/PtrEquality.hs | 30 +- Data/Utils/StrictFold.hs | 13 + Data/Utils/StrictMaybe.hs | 15 + Data/Utils/StrictPair.hs | 16 + changelog.md | 7 + containers.cabal | 15 +- tests/map-properties.hs | 27 +- tests/seq-properties.hs | 2 +- 23 files changed, 1446 insertions(+), 5526 deletions(-) From git at git.haskell.org Mon Apr 17 21:44:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:44:57 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Add more indexed and unsafe functions for Data.Map (251084a) Message-ID: <20170417214457.9A98B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/251084a69d7321571e9ef8567a88a75778a570b2 >--------------------------------------------------------------- commit 251084a69d7321571e9ef8567a88a75778a570b2 Author: David Feuer Date: Thu Aug 25 17:44:51 2016 -0400 Add more indexed and unsafe functions for Data.Map * Offer `take`, `drop`, and `splitAt` by index. * Offer 'takeWhileAntitone`, `dropWhileAntitone`, and `spanAntitone`. >--------------------------------------------------------------- 251084a69d7321571e9ef8567a88a75778a570b2 Data/Map/Base.hs | 124 +++++++++++++++++++++++++++++++++++++++++++- Data/Map/Lazy.hs | 24 ++++----- Data/Map/Strict.hs | 7 +++ Data/Map/Strict/Internal.hs | 14 ++++- tests/map-properties.hs | 58 +++++++++++++++++++-- 5 files changed, 206 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 251084a69d7321571e9ef8567a88a75778a570b2 From git at git.haskell.org Mon Apr 17 21:44:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:44:59 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #321 from treeowl/more-monotonic (8dcda44) Message-ID: <20170417214459.A43AD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/8dcda44a0a80289fad74411421402dde500981c6 >--------------------------------------------------------------- commit 8dcda44a0a80289fad74411421402dde500981c6 Merge: e268e62 251084a Author: David Feuer Date: Tue Aug 30 22:02:08 2016 -0400 Merge pull request #321 from treeowl/more-monotonic Add more indexed and unsafe functions for Data.Map >--------------------------------------------------------------- 8dcda44a0a80289fad74411421402dde500981c6 Data/Map/Base.hs | 124 +++++++++++++++++++++++++++++++++++++++++++- Data/Map/Lazy.hs | 24 ++++----- Data/Map/Strict.hs | 7 +++ Data/Map/Strict/Internal.hs | 14 ++++- tests/map-properties.hs | 58 +++++++++++++++++++-- 5 files changed, 206 insertions(+), 21 deletions(-) From git at git.haskell.org Mon Apr 17 21:45:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:45:01 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Update changelog.md (69fec5f) Message-ID: <20170417214501.AC6C83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/69fec5fcb2a0037cac428ef905703abe30cd43e5 >--------------------------------------------------------------- commit 69fec5fcb2a0037cac428ef905703abe30cd43e5 Author: David Feuer Date: Tue Aug 30 22:25:00 2016 -0400 Update changelog.md >--------------------------------------------------------------- 69fec5fcb2a0037cac428ef905703abe30cd43e5 changelog.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/changelog.md b/changelog.md index a05bdf9..b21e18f 100644 --- a/changelog.md +++ b/changelog.md @@ -29,6 +29,10 @@ * Add `alterF`, `restrictKeys`, and `withoutKeys` to `Data.Map` and `Data.IntMap`. + * Add `take`, `drop`, `splitAt`, `takeWhileAntitone`, `dropWhileAntitone`, + and `spanAntitone` for `Data.Map`. Thanks to Cale Gibbard for suggesting + these. + * Add `merge`, `mergeA`, and associated merge tactics for `Data.Map`. Many thanks to Cale Gibbard, Ryan Trinkle, and Dan Doel for inspiring the merge idea and helping refine the interface. From git at git.haskell.org Mon Apr 17 21:45:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:45:03 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Add new index-based and unsafe Set functions (5d857d9) Message-ID: <20170417214503.B79EA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/5d857d9ebc89de3681a9dd88d21c7196a8283ead >--------------------------------------------------------------- commit 5d857d9ebc89de3681a9dd88d21c7196a8283ead Author: David Feuer Date: Tue Aug 30 22:48:12 2016 -0400 Add new index-based and unsafe Set functions These match the ones just added for maps. >--------------------------------------------------------------- 5d857d9ebc89de3681a9dd88d21c7196a8283ead Data/Set.hs | 6 +++ Data/Set/Base.hs | 119 +++++++++++++++++++++++++++++++++++++++++++++++- changelog.md | 4 +- tests/set-properties.hs | 52 ++++++++++++++++++++- 4 files changed, 177 insertions(+), 4 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 5d857d9ebc89de3681a9dd88d21c7196a8283ead From git at git.haskell.org Mon Apr 17 21:45:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:45:05 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #322 from treeowl/set-extras (122ddc7) Message-ID: <20170417214505.BFB743A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/122ddc728ea26c9663b37c570c41bd72db756430 >--------------------------------------------------------------- commit 122ddc728ea26c9663b37c570c41bd72db756430 Merge: 69fec5f 5d857d9 Author: David Feuer Date: Tue Aug 30 23:13:09 2016 -0400 Merge pull request #322 from treeowl/set-extras Add new index-based and unsafe Set functions >--------------------------------------------------------------- 122ddc728ea26c9663b37c570c41bd72db756430 Data/Set.hs | 6 +++ Data/Set/Base.hs | 119 +++++++++++++++++++++++++++++++++++++++++++++++- changelog.md | 4 +- tests/set-properties.hs | 52 ++++++++++++++++++++- 4 files changed, 177 insertions(+), 4 deletions(-) From git at git.haskell.org Mon Apr 17 21:45:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:45:07 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Deprecate some functions in Data.Map (989017b) Message-ID: <20170417214507.CACA03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/989017b5029b886c36ead0addad8773b8ff4bed2 >--------------------------------------------------------------- commit 989017b5029b886c36ead0addad8773b8ff4bed2 Author: David Feuer Date: Tue Aug 30 23:13:18 2016 -0400 Deprecate some functions in Data.Map * `Data.Map` has had several functions documented as deprecated, but without actual `DEPRECATED` pragmas, for years. Add the pragmas so we can move toward removal in a couple more major versions. * The `showTree` and `showTreeWith` functions don't seem like a good fit for the public API. I'm deprecating them, but they will remain available for the foreseeable future in `Data.Map.Base` or some other internal module. >--------------------------------------------------------------- 989017b5029b886c36ead0addad8773b8ff4bed2 Data/Map.hs | 30 ++++++++++-------------------- Data/Map/Base.hs | 2 ++ changelog.md | 10 ++++++++++ 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/Data/Map.hs b/Data/Map.hs index ec0326f..dfb0797 100644 --- a/Data/Map.hs +++ b/Data/Map.hs @@ -72,16 +72,14 @@ import Prelude hiding (foldr) import Data.Map.Lazy import qualified Data.Map.Strict as Strict --- | /Deprecated./ As of version 0.5, replaced by 'Data.Map.Strict.insertWith'. --- --- /O(log n)/. Same as 'insertWith', but the value being inserted to the map is +-- | /O(log n)/. Same as 'insertWith', but the value being inserted to the map is -- evaluated to WHNF beforehand. -- -- For example, to update a counter: -- -- > insertWith' (+) k 1 m -- - +{-# DEPRECATED insertWith' "As of version 0.5, replaced by 'Data.Map.Strict.insertWith'." #-} insertWith' :: Ord k => (a -> a -> a) -> k -> a -> Map k a -> Map k a insertWith' = Strict.insertWith #if __GLASGOW_HASKELL__ @@ -90,12 +88,9 @@ insertWith' = Strict.insertWith {-# INLINE insertWith' #-} #endif --- | /Deprecated./ As of version 0.5, replaced by --- 'Data.Map.Strict.insertWithKey'. --- --- /O(log n)/. Same as 'insertWithKey', but the value being inserted to the map is +-- | /O(log n)/. Same as 'insertWithKey', but the value being inserted to the map is -- evaluated to WHNF beforehand. - +{-# DEPRECATED insertWithKey' "As of version 0.5, replaced by 'Data.Map.Strict.insertWithKey'." #-} insertWithKey' :: Ord k => (k -> a -> a -> a) -> k -> a -> Map k a -> Map k a -- We do not reuse Data.Map.Strict.insertWithKey, because it is stricter -- it -- forces evaluation of the given value. @@ -106,12 +101,9 @@ insertWithKey' = Strict.insertWithKey {-# INLINE insertWithKey' #-} #endif --- | /Deprecated./ As of version 0.5, replaced by --- 'Data.Map.Strict.insertLookupWithKey'. --- --- /O(log n)/. Same as 'insertLookupWithKey', but the value being inserted to +-- | /O(log n)/. Same as 'insertLookupWithKey', but the value being inserted to -- the map is evaluated to WHNF beforehand. - +{-# DEPRECATED insertLookupWithKey' "As of version 0.5, replaced by 'Data.Map.Strict.insertLookupWithKey'." #-} insertLookupWithKey' :: Ord k => (k -> a -> a -> a) -> k -> a -> Map k a -> (Maybe a, Map k a) -- We do not reuse Data.Map.Strict.insertLookupWithKey, because it is stricter -- it @@ -123,20 +115,18 @@ insertLookupWithKey' = Strict.insertLookupWithKey {-# INLINE insertLookupWithKey' #-} #endif --- | /Deprecated./ As of version 0.5, replaced by 'foldr'. --- --- /O(n)/. Fold the values in the map using the given right-associative +-- | /O(n)/. Fold the values in the map using the given right-associative -- binary operator. This function is an equivalent of 'foldr' and is present -- for compatibility only. +{-# DEPRECATED fold "As of version 0.5, replaced by 'foldr'." #-} fold :: (a -> b -> b) -> b -> Map k a -> b fold = foldr {-# INLINE fold #-} --- | /Deprecated./ As of version 0.4, replaced by 'foldrWithKey'. --- --- /O(n)/. Fold the keys and values in the map using the given right-associative +-- | /O(n)/. Fold the keys and values in the map using the given right-associative -- binary operator. This function is an equivalent of 'foldrWithKey' and is present -- for compatibility only. +{-# DEPRECATED foldWithKey "As of version 0.4, replaced by 'foldrWithKey'." #-} foldWithKey :: (k -> a -> b -> b) -> b -> Map k a -> b foldWithKey = foldrWithKey {-# INLINE foldWithKey #-} diff --git a/Data/Map/Base.hs b/Data/Map/Base.hs index 9ebae06..c31a576 100644 --- a/Data/Map/Base.hs +++ b/Data/Map/Base.hs @@ -3965,6 +3965,7 @@ instance (Show k, Show a) => Show (Map k a) where -- | /O(n)/. Show the tree that implements the map. The tree is shown -- in a compressed, hanging format. See 'showTreeWith'. +{-# DEPRECATED showTree "This function is being removed from the public API." #-} showTree :: (Show k,Show a) => Map k a -> String showTree m = showTreeWith showElem True False m @@ -4008,6 +4009,7 @@ showTree m > +--(1,()) -} +{-# DEPRECATED showTreeWith "This function is being removed from the public API." #-} showTreeWith :: (k -> a -> String) -> Bool -> Bool -> Map k a -> String showTreeWith showelem hang wide t | hang = (showsTreeHang showelem wide [] t) "" diff --git a/changelog.md b/changelog.md index 8abdb54..d180353 100644 --- a/changelog.md +++ b/changelog.md @@ -64,6 +64,16 @@ * Make `drawTree` handle newlines better. (Thanks, recursion-ninja!) +### Deprecations + + * All functions in `Data.Map` proper that have been documented as deprecated since + version 0.5 or before now have `DEPRECATED` pragmas and will actually be + removed after another cycle or two. + + * Tree printing functions in `Data.Map` intended for library debugging are now + deprecated. They will continue to be available for the foreseeable future in + an internal module. + ### Performance changes * Substantially speed up `splitAt`, `zipWith`, `take`, `drop`, From git at git.haskell.org Mon Apr 17 21:45:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:45:09 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Merge pull request #323 from treeowl/deprecate-ancient (eed0db8) Message-ID: <20170417214509.D3F003A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/eed0db8fda243a3030fe5f97b3ce8577c09e8351 >--------------------------------------------------------------- commit eed0db8fda243a3030fe5f97b3ce8577c09e8351 Merge: 122ddc7 989017b Author: David Feuer Date: Tue Aug 30 23:55:26 2016 -0400 Merge pull request #323 from treeowl/deprecate-ancient Deprecate some functions in Data.Map >--------------------------------------------------------------- eed0db8fda243a3030fe5f97b3ce8577c09e8351 Data/Map.hs | 30 ++++++++++-------------------- Data/Map/Base.hs | 2 ++ changelog.md | 10 ++++++++++ 3 files changed, 22 insertions(+), 20 deletions(-) From git at git.haskell.org Mon Apr 17 21:45:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:45:11 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Fix documentation formatting (860be17) Message-ID: <20170417214511.E11C23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/860be17647b836d8a74f714bb3518dc3958755b0 >--------------------------------------------------------------- commit 860be17647b836d8a74f714bb3518dc3958755b0 Author: David Feuer Date: Wed Aug 31 00:58:58 2016 -0400 Fix documentation formatting >--------------------------------------------------------------- 860be17647b836d8a74f714bb3518dc3958755b0 Data/Map/Base.hs | 2 +- Data/Map/Strict/Internal.hs | 2 +- Data/Sequence/Base.hs | 11 +++++++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Data/Map/Base.hs b/Data/Map/Base.hs index c31a576..6020b51 100644 --- a/Data/Map/Base.hs +++ b/Data/Map/Base.hs @@ -1124,7 +1124,7 @@ data AreWeStrict = Strict | Lazy -- | /O(log n)/. The expression (@'alterF' f k map@) alters the value @x@ at -- @k@, or absence thereof. 'alterF' can be used to inspect, insert, delete, --- or update a value in a 'Map'. In short : @'lookup' k <$> 'alterF' f k m = f +-- or update a value in a 'Map'. In short: @'lookup' k \<$\> 'alterF' f k m = f -- ('lookup' k m)@. -- -- Example: diff --git a/Data/Map/Strict/Internal.hs b/Data/Map/Strict/Internal.hs index 0b0a34e..08cadcb 100644 --- a/Data/Map/Strict/Internal.hs +++ b/Data/Map/Strict/Internal.hs @@ -804,7 +804,7 @@ alter = go -- | /O(log n)/. The expression (@'alterF' f k map@) alters the value @x@ at @k@, or absence thereof. -- 'alterF' can be used to inspect, insert, delete, or update a value in a 'Map'. --- In short : @'lookup' k <$> 'alterF' f k m = f ('lookup' k m)@. +-- In short: @'lookup' k \<$\> 'alterF' f k m = f ('lookup' k m)@. -- -- Example: -- diff --git a/Data/Sequence/Base.hs b/Data/Sequence/Base.hs index 103fe89..c79bd6c 100644 --- a/Data/Sequence/Base.hs +++ b/Data/Sequence/Base.hs @@ -663,10 +663,13 @@ thin12 s pr m (Three a b c) = DeepTh s pr (thin $ m `snocTree` node2 a b) (One12 thin12 s pr m (Four a b c d) = DeepTh s pr (thin $ m `snocTree` node2 a b) (Two12 c d) -- | Intersperse an element between the elements of a sequence. --- > intersperse a empty = empty --- > intersperse a (singleton x) = singleton x --- > intersperse a (fromList [x,y]) = fromList [x,a,y] --- > intersperse a (fromList [x,y,z]) = fromList [x,a,y,a,z] +-- +-- @ +-- intersperse a empty = empty +-- intersperse a (singleton x) = singleton x +-- intersperse a (fromList [x,y]) = fromList [x,a,y] +-- intersperse a (fromList [x,y,z]) = fromList [x,a,y,a,z] +-- @ -- -- @since 0.5.8 intersperse :: a -> Seq a -> Seq a From git at git.haskell.org Mon Apr 17 21:45:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:45:13 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, merge-restrict-fix-5.8, revert-408-bugfix_394: Bump version in containers.cabal (5bea87d) Message-ID: <20170417214513.E89113A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,merge-restrict-fix-5.8,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/5bea87dd4a89304c3caa6db2e7e572aa8b260f19 >--------------------------------------------------------------- commit 5bea87dd4a89304c3caa6db2e7e572aa8b260f19 Author: David Feuer Date: Wed Aug 31 01:27:56 2016 -0400 Bump version in containers.cabal >--------------------------------------------------------------- 5bea87dd4a89304c3caa6db2e7e572aa8b260f19 containers.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/containers.cabal b/containers.cabal index 4242a88..46b4556 100644 --- a/containers.cabal +++ b/containers.cabal @@ -1,5 +1,5 @@ name: containers -version: 0.5.8.0 +version: 0.5.8.1 license: BSD3 license-file: LICENSE maintainer: libraries at haskell.org From git at git.haskell.org Mon Apr 17 21:45:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:45:15 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Update changelog.md (14e5f2b) Message-ID: <20170417214515.F02A53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/14e5f2b92f87862537d75208c114693b578e414a >--------------------------------------------------------------- commit 14e5f2b92f87862537d75208c114693b578e414a Author: David Feuer Date: Wed Aug 31 02:49:34 2016 -0400 Update changelog.md >--------------------------------------------------------------- 14e5f2b92f87862537d75208c114693b578e414a changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index d180353..8909fad 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,6 @@ # Changelog for [`containers` package](http://github.com/haskell/containers) -## 0.5.8.1 +## 0.5.8.1 *Aug 2016* ### General package changes From git at git.haskell.org Mon Apr 17 21:45:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:45:18 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Refactor internal modules (#324) (576fe49) Message-ID: <20170417214518.236623A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/576fe4934880406e0657151ee4200fcb3aca5d78 >--------------------------------------------------------------- commit 576fe4934880406e0657151ee4200fcb3aca5d78 Author: Ertugrul Söylemez Date: Wed Aug 31 16:50:01 2016 +0200 Refactor internal modules (#324) * Ignore more dev files. * Rename .Base modules to .Internal. * Data.IntMap.Base -> Data.IntMap.Internal * Data.IntSet.Base -> Data.IntSet.Internal * Data.Map.Base -> Data.Map.Internal * Data.Sequence.Base -> Data.Sequence.Internal * Data.Set.Base -> Data.Set.Internal * Unhide internal modules, add missing warning. * Unexpose utility modules except for .Utils.BitUtil and .Utils.BitQueue. >--------------------------------------------------------------- 576fe4934880406e0657151ee4200fcb3aca5d78 .gitignore | 3 +++ Data/IntMap/{Base.hs => Internal.hs} | 11 +++++------ Data/IntMap/Lazy.hs | 2 +- Data/IntMap/Strict.hs | 8 ++++---- Data/IntSet.hs | 2 +- Data/IntSet/{Base.hs => Internal.hs} | 7 +++---- Data/Map/{Base.hs => Internal.hs} | 12 +++++------- Data/Map/Lazy.hs | 2 +- Data/Map/Lazy/Merge.hs | 2 +- Data/Map/Strict.hs | 2 +- Data/Map/Strict/Internal.hs | 24 +++++++++++------------- Data/Sequence.hs | 2 +- Data/Sequence/{Base.hs => Internal.hs} | 6 ++---- Data/Set.hs | 2 +- Data/Set/{Base.hs => Internal.hs} | 22 +++++++++++++++++----- benchmarks/LookupGE/LookupGE_IntMap.hs | 2 +- benchmarks/LookupGE/LookupGE_Map.hs | 2 +- containers.cabal | 16 +++++++++------- tests/map-properties.hs | 2 +- tests/seq-properties.hs | 2 +- 20 files changed, 70 insertions(+), 61 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 576fe4934880406e0657151ee4200fcb3aca5d78 From git at git.haskell.org Mon Apr 17 21:45:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:45:20 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: General package stuff, mostly (2eb64f5) Message-ID: <20170417214520.3F3D03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/2eb64f5f513b3209880713c88ab53eb4f528c0f8 >--------------------------------------------------------------- commit 2eb64f5f513b3209880713c88ab53eb4f528c0f8 Author: David Feuer Date: Thu Sep 1 23:59:12 2016 -0400 General package stuff, mostly * Rename the internals again. I think they're getting close to reasonable now. Get the cabal benchmarks running again. Deprecate the "deprecated" `IntMap` stuff. Make a `Debug` module for the `Data.Map` debugging functions. * Rewrite `Data.Map.Internal.Debug.validSize` to use the `Monad Maybe` instance for clarity. >--------------------------------------------------------------- 2eb64f5f513b3209880713c88ab53eb4f528c0f8 .travis.yml | 10 +- Data/IntMap.hs | 23 ++- Data/IntMap/Internal.hs | 6 +- Data/IntMap/Strict.hs | 6 +- Data/IntSet/Internal.hs | 6 +- Data/Map/Internal.hs | 154 +-------------------- Data/Map/Internal/Debug.hs | 144 +++++++++++++++++++ Data/Map/Internal/DeprecatedShowTree.hs | 56 ++++++++ Data/Map/Lazy.hs | 16 ++- Data/Map/Strict/Internal.hs | 15 +- Data/Sequence/Internal.hs | 2 +- Data/Set/Internal.hs | 6 +- Data/Utils/StrictPair.hs | 32 ----- .../Containers/Internal}/BitQueue.hs | 8 +- .../Utils => Utils/Containers/Internal}/BitUtil.hs | 5 +- .../Containers/Internal}/PtrEquality.hs | 15 +- .../Containers/Internal}/StrictFold.hs | 14 +- .../Containers/Internal}/StrictMaybe.hs | 16 +-- Utils/Containers/Internal/StrictPair.hs | 22 +++ benchmarks/IntMap.hs | 5 +- benchmarks/Map.hs | 7 +- containers.cabal | 17 ++- tests/bitqueue-properties.hs | 4 +- tests/deprecated-properties.hs | 1 + tests/map-properties.hs | 7 +- 25 files changed, 304 insertions(+), 293 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 2eb64f5f513b3209880713c88ab53eb4f528c0f8 From git at git.haskell.org Mon Apr 17 21:45:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:45:22 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Merge pull request #329 from treeowl/rename-internals (0b6cd9e) Message-ID: <20170417214522.50FD33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/0b6cd9ed1e8800fb1ba2aac842089db23d159b16 >--------------------------------------------------------------- commit 0b6cd9ed1e8800fb1ba2aac842089db23d159b16 Merge: 576fe49 2eb64f5 Author: David Feuer Date: Fri Sep 2 12:02:59 2016 -0400 Merge pull request #329 from treeowl/rename-internals General package stuff, mostly >--------------------------------------------------------------- 0b6cd9ed1e8800fb1ba2aac842089db23d159b16 .travis.yml | 10 +- Data/IntMap.hs | 23 ++- Data/IntMap/Internal.hs | 6 +- Data/IntMap/Strict.hs | 6 +- Data/IntSet/Internal.hs | 6 +- Data/Map/Internal.hs | 154 +-------------------- Data/Map/Internal/Debug.hs | 144 +++++++++++++++++++ Data/Map/Internal/DeprecatedShowTree.hs | 56 ++++++++ Data/Map/Lazy.hs | 16 ++- Data/Map/Strict/Internal.hs | 15 +- Data/Sequence/Internal.hs | 2 +- Data/Set/Internal.hs | 6 +- Data/Utils/StrictPair.hs | 32 ----- .../Containers/Internal}/BitQueue.hs | 8 +- .../Utils => Utils/Containers/Internal}/BitUtil.hs | 5 +- .../Containers/Internal}/PtrEquality.hs | 15 +- .../Containers/Internal}/StrictFold.hs | 14 +- .../Containers/Internal}/StrictMaybe.hs | 16 +-- Utils/Containers/Internal/StrictPair.hs | 22 +++ benchmarks/IntMap.hs | 5 +- benchmarks/Map.hs | 7 +- containers.cabal | 17 ++- tests/bitqueue-properties.hs | 4 +- tests/deprecated-properties.hs | 1 + tests/map-properties.hs | 7 +- 25 files changed, 304 insertions(+), 293 deletions(-) From git at git.haskell.org Mon Apr 17 21:45:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:45:24 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Make Data.Map.fromDistinct{Asc, Desc}List eager (4fcf139) Message-ID: <20170417214524.5C1473A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/4fcf139d54bb0b872317f239267024e341555646 >--------------------------------------------------------------- commit 4fcf139d54bb0b872317f239267024e341555646 Author: David Feuer Date: Sun Sep 4 03:28:39 2016 -0400 Make Data.Map.fromDistinct{Asc,Desc}List eager * `Data.Map.fromDistinctAscList` and `fromDistinctDescList` were accumulating thunks for no good reason. Make them build their structures eagerly. This cuts time by a good bit (a third, maybe). * Make the same functions in `Data.Set` just a tad more eager as well. >--------------------------------------------------------------- 4fcf139d54bb0b872317f239267024e341555646 Data/Map/Internal.hs | 26 ++++++++++++++------------ Data/Map/Strict/Internal.hs | 32 ++++++++++++++++++-------------- Data/Set/Internal.hs | 6 ++++-- Utils/Containers/Internal/StrictPair.hs | 2 ++ 4 files changed, 38 insertions(+), 28 deletions(-) diff --git a/Data/Map/Internal.hs b/Data/Map/Internal.hs index a3bc550..0b8202f 100644 --- a/Data/Map/Internal.hs +++ b/Data/Map/Internal.hs @@ -3431,15 +3431,16 @@ fromDistinctAscList ((kx0, x0) : xs0) = go (1::Int) (Bin 1 kx0 x0 Tip Tip) xs0 where go !_ t [] = t go s l ((kx, x) : xs) = case create s xs of - (r, ys) -> go (s `shiftL` 1) (link kx x l r) ys + (r :*: ys) -> let !t' = link kx x l r + in go (s `shiftL` 1) t' ys - create !_ [] = (Tip, []) + create !_ [] = (Tip :*: []) create s xs@(x' : xs') - | s == 1 = case x' of (kx, x) -> (Bin 1 kx x Tip Tip, xs') + | s == 1 = case x' of (kx, x) -> (Bin 1 kx x Tip Tip :*: xs') | otherwise = case create (s `shiftR` 1) xs of - res@(_, []) -> res - (l, (ky, y):ys) -> case create (s `shiftR` 1) ys of - (r, zs) -> (link ky y l r, zs) + res@(_ :*: []) -> res + (l :*: (ky, y):ys) -> case create (s `shiftR` 1) ys of + (r :*: zs) -> (link ky y l r :*: zs) -- | /O(n)/. Build a map from a descending list of distinct elements in linear time. -- /The precondition is not checked./ @@ -3456,15 +3457,16 @@ fromDistinctDescList ((kx0, x0) : xs0) = go (1 :: Int) (Bin 1 kx0 x0 Tip Tip) xs where go !_ t [] = t go s r ((kx, x) : xs) = case create s xs of - (l, ys) -> go (s `shiftL` 1) (link kx x l r) ys + (l :*: ys) -> let !t' = link kx x l r + in go (s `shiftL` 1) t' ys - create !_ [] = (Tip, []) + create !_ [] = (Tip :*: []) create s xs@(x' : xs') - | s == 1 = case x' of (kx, x) -> (Bin 1 kx x Tip Tip, xs') + | s == 1 = case x' of (kx, x) -> (Bin 1 kx x Tip Tip :*: xs') | otherwise = case create (s `shiftR` 1) xs of - res@(_, []) -> res - (r, (ky, y):ys) -> case create (s `shiftR` 1) ys of - (l, zs) -> (link ky y l r, zs) + res@(_ :*: []) -> res + (r :*: (ky, y):ys) -> case create (s `shiftR` 1) ys of + (l :*: zs) -> (link ky y l r :*: zs) {- -- Functions very similar to these were used to implement diff --git a/Data/Map/Strict/Internal.hs b/Data/Map/Strict/Internal.hs index 5ed14b3..c8882a0 100644 --- a/Data/Map/Strict/Internal.hs +++ b/Data/Map/Strict/Internal.hs @@ -1670,16 +1670,18 @@ fromDistinctAscList [] = Tip fromDistinctAscList ((kx0, x0) : xs0) = x0 `seq` go (1::Int) (Bin 1 kx0 x0 Tip Tip) xs0 where go !_ t [] = t - go s l ((kx, x) : xs) = case create s xs of - (r, ys) -> x `seq` go (s `shiftL` 1) (link kx x l r) ys + go s l ((kx, x) : xs) = + case create s xs of + (r :*: ys) -> x `seq` let !t' = link kx x l r + in go (s `shiftL` 1) t' ys - create !_ [] = (Tip, []) + create !_ [] = (Tip :*: []) create s xs@(x' : xs') - | s == 1 = case x' of (kx, x) -> x `seq` (Bin 1 kx x Tip Tip, xs') + | s == 1 = case x' of (kx, x) -> x `seq` (Bin 1 kx x Tip Tip :*: xs') | otherwise = case create (s `shiftR` 1) xs of - res@(_, []) -> res - (l, (ky, y):ys) -> case create (s `shiftR` 1) ys of - (r, zs) -> y `seq` (link ky y l r, zs) + res@(_ :*: []) -> res + (l :*: (ky, y):ys) -> case create (s `shiftR` 1) ys of + (r :*: zs) -> y `seq` (link ky y l r :*: zs) -- | /O(n)/. Build a map from a descending list of distinct elements in linear time. -- /The precondition is not checked./ @@ -1695,13 +1697,15 @@ fromDistinctDescList [] = Tip fromDistinctDescList ((kx0, x0) : xs0) = x0 `seq` go (1::Int) (Bin 1 kx0 x0 Tip Tip) xs0 where go !_ t [] = t - go s r ((kx, x) : xs) = case create s xs of - (l, ys) -> x `seq` go (s `shiftL` 1) (link kx x l r) ys + go s r ((kx, x) : xs) = + case create s xs of + (l :*: ys) -> x `seq` let !t' = link kx x l r + in go (s `shiftL` 1) t' ys - create !_ [] = (Tip, []) + create !_ [] = (Tip :*: []) create s xs@(x' : xs') - | s == 1 = case x' of (kx, x) -> x `seq` (Bin 1 kx x Tip Tip, xs') + | s == 1 = case x' of (kx, x) -> x `seq` (Bin 1 kx x Tip Tip :*: xs') | otherwise = case create (s `shiftR` 1) xs of - res@(_, []) -> res - (r, (ky, y):ys) -> case create (s `shiftR` 1) ys of - (l, zs) -> y `seq` (link ky y l r, zs) + res@(_ :*: []) -> res + (r :*: (ky, y):ys) -> case create (s `shiftR` 1) ys of + (l :*: zs) -> y `seq` (link ky y l r :*: zs) diff --git a/Data/Set/Internal.hs b/Data/Set/Internal.hs index 2fefcb6..c0b6160 100644 --- a/Data/Set/Internal.hs +++ b/Data/Set/Internal.hs @@ -974,7 +974,8 @@ fromDistinctAscList (x0 : xs0) = go (1::Int) (Bin 1 x0 Tip Tip) xs0 where go !_ t [] = t go s l (x : xs) = case create s xs of - (r :*: ys) -> go (s `shiftL` 1) (link x l r) ys + (r :*: ys) -> let !t' = link x l r + in go (s `shiftL` 1) t' ys create !_ [] = (Tip :*: []) create s xs@(x : xs') @@ -995,7 +996,8 @@ fromDistinctDescList (x0 : xs0) = go (1::Int) (Bin 1 x0 Tip Tip) xs0 where go !_ t [] = t go s r (x : xs) = case create s xs of - (l :*: ys) -> go (s `shiftL` 1) (link x l r) ys + (l :*: ys) -> let !t' = link x l r + in go (s `shiftL` 1) t' ys create !_ [] = (Tip :*: []) create s xs@(x : xs') diff --git a/Utils/Containers/Internal/StrictPair.hs b/Utils/Containers/Internal/StrictPair.hs index 2ffd740..09b1e83 100644 --- a/Utils/Containers/Internal/StrictPair.hs +++ b/Utils/Containers/Internal/StrictPair.hs @@ -16,6 +16,8 @@ module Utils.Containers.Internal.StrictPair (StrictPair(..), toPair) where -- @ data StrictPair a b = !a :*: !b +infixr 1 :*: + -- | Convert a strict pair to a standard pair. toPair :: StrictPair a b -> (a, b) toPair (x :*: y) = (x, y) From git at git.haskell.org Mon Apr 17 21:45:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:45:26 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Merge pull request #331 from treeowl/map-fromAscList-strictify (8df75c7) Message-ID: <20170417214526.65F543A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/8df75c7e88347d8331cbfa712003d8b3ef78d94a >--------------------------------------------------------------- commit 8df75c7e88347d8331cbfa712003d8b3ef78d94a Merge: 0b6cd9e 4fcf139 Author: David Feuer Date: Sun Sep 4 04:31:35 2016 -0400 Merge pull request #331 from treeowl/map-fromAscList-strictify Make Data.Map.fromDistinct{Asc,Desc}List eager >--------------------------------------------------------------- 8df75c7e88347d8331cbfa712003d8b3ef78d94a Data/Map/Internal.hs | 26 ++++++++++++++------------ Data/Map/Strict/Internal.hs | 32 ++++++++++++++++++-------------- Data/Set/Internal.hs | 6 ++++-- Utils/Containers/Internal/StrictPair.hs | 2 ++ 4 files changed, 38 insertions(+), 28 deletions(-) From git at git.haskell.org Mon Apr 17 21:45:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:45:28 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Implement fromAscList independently (79b6aaa) Message-ID: <20170417214528.6F3123A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/79b6aaa75d5a8d6d60466e530de1da6ce6c2f9f6 >--------------------------------------------------------------- commit 79b6aaa75d5a8d6d60466e530de1da6ce6c2f9f6 Author: David Feuer Date: Sun Sep 4 04:38:11 2016 -0400 Implement fromAscList independently Implementing the lazy version of `fromAscList` in terms of `fromAscListWithKey` leaks memory if there are many repeated keys. Inlining `fromAscListWithKey` into `fromAscList` manually should fix this. The same goes for `fromDescList`. >--------------------------------------------------------------- 79b6aaa75d5a8d6d60466e530de1da6ce6c2f9f6 Data/Map/Internal.hs | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/Data/Map/Internal.hs b/Data/Map/Internal.hs index 0b8202f..8ed1d08 100644 --- a/Data/Map/Internal.hs +++ b/Data/Map/Internal.hs @@ -3312,7 +3312,19 @@ foldlFB = foldlWithKey fromAscList :: Eq k => [(k,a)] -> Map k a fromAscList xs - = fromAscListWithKey (\_ x _ -> x) xs + = fromDistinctAscList (combineEq xs) + where + -- [combineEq f xs] combines equal elements with function [f] in an ordered list [xs] + combineEq xs' + = case xs' of + [] -> [] + [x] -> [x] + (x:xx) -> combineEq' x xx + + combineEq' z [] = [z] + combineEq' z@(kz,zz) (x@(kx,xx):xs') + | kx==kz = combineEq' (kx,xx) xs' + | otherwise = z:combineEq' x xs' #if __GLASGOW_HASKELL__ {-# INLINABLE fromAscList #-} #endif @@ -3326,8 +3338,19 @@ fromAscList xs -- > valid (fromDescList [(5,"a"), (3,"b"), (5,"b")]) == False fromDescList :: Eq k => [(k,a)] -> Map k a -fromDescList xs - = fromDescListWithKey (\_ x _ -> x) xs +fromDescList xs = fromDistinctDescList (combineEq xs) + where + -- [combineEq f xs] combines equal elements with function [f] in an ordered list [xs] + combineEq xs' + = case xs' of + [] -> [] + [x] -> [x] + (x:xx) -> combineEq' x xx + + combineEq' z [] = [z] + combineEq' z@(kz,zz) (x@(kx,xx):xs') + | kx==kz = combineEq' (kx,xx) xs' + | otherwise = z:combineEq' x xs' #if __GLASGOW_HASKELL__ {-# INLINABLE fromDescList #-} #endif From git at git.haskell.org Mon Apr 17 21:45:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:45:30 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Merge pull request #332 from treeowl/fromAscListWithout (bc5fe21) Message-ID: <20170417214530.78A633A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/bc5fe21ac898a96fff27fa9d38dd07fe1a291705 >--------------------------------------------------------------- commit bc5fe21ac898a96fff27fa9d38dd07fe1a291705 Merge: 8df75c7 79b6aaa Author: David Feuer Date: Sun Sep 4 21:15:33 2016 -0400 Merge pull request #332 from treeowl/fromAscListWithout Implement fromAscList independently >--------------------------------------------------------------- bc5fe21ac898a96fff27fa9d38dd07fe1a291705 Data/Map/Internal.hs | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) From git at git.haskell.org Mon Apr 17 21:45:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:45:32 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Update changelog.md (b5b9d1e) Message-ID: <20170417214532.810B53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/b5b9d1ed03108959a5672a9974e33412ee3eec7a >--------------------------------------------------------------- commit b5b9d1ed03108959a5672a9974e33412ee3eec7a Author: David Feuer Date: Mon Sep 5 11:44:31 2016 -0400 Update changelog.md >--------------------------------------------------------------- b5b9d1ed03108959a5672a9974e33412ee3eec7a changelog.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/changelog.md b/changelog.md index 8909fad..197e5b4 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,20 @@ # Changelog for [`containers` package](http://github.com/haskell/containers) +## 0.5.9.1 + +* Planned for GHC 8.2. + +* Properly deprecate functions in `Data.IntMap` long documented as deprecated. + +* Rename several internal modules for clarity. Thanks to esoeylemez for starting + this process. + +* Make `Data.Map.fromDistinctAscList` and `Data.Map.fromDistinctDescList` more + eager, improving performance. + +* Plug space leaks in `Data.Map.Lazy.fromAscList` and + `Data.Map.Lazy.fromDescList` by manually inlining constant functions. + ## 0.5.8.1 *Aug 2016* ### General package changes From git at git.haskell.org Mon Apr 17 21:45:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:45:34 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Actually expose Data.Sequence pattern synonyms (5f316c4) Message-ID: <20170417214534.8DE803A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/5f316c4dd6daa5f1b42dba0d513f527d4e89de61 >--------------------------------------------------------------- commit 5f316c4dd6daa5f1b42dba0d513f527d4e89de61 Author: David Feuer Date: Mon Sep 5 12:14:51 2016 -0400 Actually expose Data.Sequence pattern synonyms * Expose `Data.Sequence` pattern synonyms for real. * Add tests for the pattern synonyms. * Kill a couple silly warnings in `Data.Map.Internal`. >--------------------------------------------------------------- 5f316c4dd6daa5f1b42dba0d513f527d4e89de61 Data/Map/Internal.hs | 4 ++-- Data/Sequence/Internal.hs | 6 +----- include/containers.h | 4 ++++ tests/seq-properties.hs | 52 +++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 59 insertions(+), 7 deletions(-) diff --git a/Data/Map/Internal.hs b/Data/Map/Internal.hs index 8ed1d08..7d09eb9 100644 --- a/Data/Map/Internal.hs +++ b/Data/Map/Internal.hs @@ -3322,7 +3322,7 @@ fromAscList xs (x:xx) -> combineEq' x xx combineEq' z [] = [z] - combineEq' z@(kz,zz) (x@(kx,xx):xs') + combineEq' z@(kz,_) (x@(kx,xx):xs') | kx==kz = combineEq' (kx,xx) xs' | otherwise = z:combineEq' x xs' #if __GLASGOW_HASKELL__ @@ -3348,7 +3348,7 @@ fromDescList xs = fromDistinctDescList (combineEq xs) (x:xx) -> combineEq' x xx combineEq' z [] = [z] - combineEq' z@(kz,zz) (x@(kx,xx):xs') + combineEq' z@(kz,_) (x@(kx,xx):xs') | kx==kz = combineEq' (kx,xx) xs' | otherwise = z:combineEq' x xs' #if __GLASGOW_HASKELL__ diff --git a/Data/Sequence/Internal.hs b/Data/Sequence/Internal.hs index 40a7fc9..95c143e 100644 --- a/Data/Sequence/Internal.hs +++ b/Data/Sequence/Internal.hs @@ -1,8 +1,6 @@ {-# LANGUAGE CPP #-} +#include "containers.h" {-# LANGUAGE BangPatterns #-} -#if __GLASGOW_HASKELL__ >= 800 -#define DEFINE_PATTERN_SYNONYMS 1 -#endif #if __GLASGOW_HASKELL__ {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE StandaloneDeriving #-} @@ -23,8 +21,6 @@ {-# LANGUAGE ViewPatterns #-} #endif -#include "containers.h" - ----------------------------------------------------------------------------- -- | -- Module : Data.Sequence.Internal diff --git a/include/containers.h b/include/containers.h index 273c1b2..83cea82 100644 --- a/include/containers.h +++ b/include/containers.h @@ -29,6 +29,10 @@ #define INSTANCE_TYPEABLE2(tycon) #endif +#if __GLASGOW_HASKELL__ >= 800 +#define DEFINE_PATTERN_SYNONYMS 1 +#endif + /* * We use cabal-generated MIN_VERSION_base to adapt to changes of base. * Nevertheless, as a convenience, we also allow compiling without cabal by diff --git a/tests/seq-properties.hs b/tests/seq-properties.hs index ca2f627..f325f3f 100644 --- a/tests/seq-properties.hs +++ b/tests/seq-properties.hs @@ -1,4 +1,18 @@ +{-# LANGUAGE CPP #-} +{-# LANGUAGE PatternGuards #-} + import Data.Sequence.Internal + ( Sized (..) + , Seq (Seq) + , FingerTree(..) + , Node(..) + , Elem(..) + , Digit (..) + , node2 + , node3 + , deep ) + +import Data.Sequence import Control.Applicative (Applicative(..)) import Control.Arrow ((***)) @@ -18,6 +32,9 @@ import qualified Prelude import qualified Data.List import Test.QuickCheck hiding ((><)) import Test.QuickCheck.Poly +#if __GLASGOW_HASKELL__ >= 800 +import Test.QuickCheck.Property +#endif import Test.QuickCheck.Function import Test.Framework import Test.Framework.Providers.QuickCheck2 @@ -109,6 +126,14 @@ main = defaultMain , testProperty "cycleTaking" prop_cycleTaking , testProperty "intersperse" prop_intersperse , testProperty ">>=" prop_bind +#if __GLASGOW_HASKELL__ >= 800 + , testProperty "Empty pattern" prop_empty_pat + , testProperty "Empty constructor" prop_empty_con + , testProperty "Left view pattern" prop_viewl_pat + , testProperty "Left view constructor" prop_viewl_con + , testProperty "Right view pattern" prop_viewr_pat + , testProperty "Right view constructor" prop_viewr_con +#endif ] ------------------------------------------------------------------------ @@ -679,6 +704,33 @@ prop_cycleTaking :: Int -> Seq A -> Property prop_cycleTaking n xs = (n <= 0 || not (null xs)) ==> toList' (cycleTaking n xs) ~= Data.List.take n (Data.List.cycle (toList xs)) +#if __GLASGOW_HASKELL__ >= 800 +prop_empty_pat :: Seq A -> Bool +prop_empty_pat xs at Empty = null xs +prop_empty_pat xs = not (null xs) + +prop_empty_con :: Bool +prop_empty_con = null Empty + +prop_viewl_pat :: Seq A -> Property +prop_viewl_pat xs@(y :<| ys) + | z :< zs <- viewl xs = y === z .&&. ys === zs + | otherwise = property failed +prop_viewl_pat xs = property . liftBool $ null xs + +prop_viewl_con :: A -> Seq A -> Property +prop_viewl_con x xs = x :<| xs === x <| xs + +prop_viewr_pat :: Seq A -> Property +prop_viewr_pat xs@(ys :|> y) + | zs :> z <- viewr xs = y === z .&&. ys === zs + | otherwise = property failed +prop_viewr_pat xs = property . liftBool $ null xs + +prop_viewr_con :: Seq A -> A -> Property +prop_viewr_con xs x = xs :|> x === xs |> x +#endif + -- Monad operations prop_bind :: Seq A -> Fun A (Seq B) -> Bool From git at git.haskell.org Mon Apr 17 21:45:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:45:36 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Merge pull request #334 from treeowl/expose-patsyms (273578b) Message-ID: <20170417214536.9979A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/273578bdabf26400067e04b0481b77856a993966 >--------------------------------------------------------------- commit 273578bdabf26400067e04b0481b77856a993966 Merge: b5b9d1e 5f316c4 Author: David Feuer Date: Mon Sep 5 14:02:04 2016 -0400 Merge pull request #334 from treeowl/expose-patsyms Actually expose Data.Sequence pattern synonyms >--------------------------------------------------------------- 273578bdabf26400067e04b0481b77856a993966 Data/Map/Internal.hs | 4 ++-- Data/Sequence/Internal.hs | 6 +----- include/containers.h | 4 ++++ tests/seq-properties.hs | 52 +++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 59 insertions(+), 7 deletions(-) From git at git.haskell.org Mon Apr 17 21:45:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:45:38 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Rename merge modules (cc0904d) Message-ID: <20170417214538.A46863A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/cc0904da428ceca2991cad2aa072a19a558ddd09 >--------------------------------------------------------------- commit cc0904da428ceca2991cad2aa072a19a558ddd09 Author: David Feuer Date: Mon Sep 5 14:43:29 2016 -0400 Rename merge modules I think it's more consistent with the rest of the API to name them `Data.Map.Merge.Lazy` and `Data.Map.Merge.Strict`. This also gives us the option to add further merge-related modules in the `Merge` hierarchy. The original names still work for now, but they are deprecated and hidden from Haddock. >--------------------------------------------------------------- cc0904da428ceca2991cad2aa072a19a558ddd09 Data/Map/Lazy/Merge.hs | 73 ++------------------------- Data/Map/{Lazy/Merge.hs => Merge/Lazy.hs} | 4 +- Data/Map/{Strict/Merge.hs => Merge/Strict.hs} | 4 +- Data/Map/Strict/Merge.hs | 69 ++----------------------- containers.cabal | 2 + tests/map-properties.hs | 4 +- 6 files changed, 18 insertions(+), 138 deletions(-) diff --git a/Data/Map/Lazy/Merge.hs b/Data/Map/Lazy/Merge.hs index 4d54014..603697c 100644 --- a/Data/Map/Lazy/Merge.hs +++ b/Data/Map/Lazy/Merge.hs @@ -1,23 +1,12 @@ {-# LANGUAGE CPP #-} -{-# LANGUAGE BangPatterns #-} -#if __GLASGOW_HASKELL__ -{-# LANGUAGE DeriveDataTypeable, StandaloneDeriving #-} -#endif #if !defined(TESTING) && __GLASGOW_HASKELL__ >= 703 {-# LANGUAGE Safe #-} #endif -#if __GLASGOW_HASKELL__ >= 708 -{-# LANGUAGE RoleAnnotations #-} -{-# LANGUAGE TypeFamilies #-} -#define USE_MAGIC_PROXY 1 -#endif - -#if USE_MAGIC_PROXY -{-# LANGUAGE MagicHash #-} -#endif #include "containers.h" +{-# OPTIONS_HADDOCK hide #-} + ----------------------------------------------------------------------------- -- | -- Module : Data.Map.Lazy.Merge @@ -45,59 +34,7 @@ -- inefficient in many cases and should usually be avoided. The instances -- for 'WhenMatched' tactics should not pose any major efficiency problems. -module Data.Map.Lazy.Merge ( - -- ** Simple merge tactic types - SimpleWhenMissing - , SimpleWhenMatched - - -- ** General combining function - , merge - - -- *** @WhenMatched@ tactics - , zipWithMaybeMatched - , zipWithMatched - - -- *** @WhenMissing@ tactics - , mapMaybeMissing - , dropMissing - , preserveMissing - , mapMissing - , filterMissing - - -- ** Applicative merge tactic types - , WhenMissing - , WhenMatched - - -- ** Applicative general combining function - , mergeA - - -- *** @WhenMatched@ tactics - -- | The tactics described for 'merge' work for - -- 'mergeA' as well. Furthermore, the following - -- are available. - , zipWithMaybeAMatched - , zipWithAMatched - - -- *** @WhenMissing@ tactics - -- | The tactics described for 'merge' work for - -- 'mergeA' as well. Furthermore, the following - -- are available. - , traverseMaybeMissing - , traverseMissing - , filterAMissing - - -- *** Covariant maps for tactics - , mapWhenMissing - , mapWhenMatched - - -- *** Contravariant maps for tactics - , lmapWhenMissing - , contramapFirstWhenMatched - , contramapSecondWhenMatched - - -- *** Miscellaneous tactic functions - , runWhenMatched - , runWhenMissing - ) where +module Data.Map.Lazy.Merge {-# DEPRECATED "Use \"Data.Map.Merge.Lazy\"." #-} + ( module Data.Map.Merge.Lazy ) where -import Data.Map.Internal +import Data.Map.Merge.Lazy diff --git a/Data/Map/Lazy/Merge.hs b/Data/Map/Merge/Lazy.hs similarity index 97% copy from Data/Map/Lazy/Merge.hs copy to Data/Map/Merge/Lazy.hs index 4d54014..ae4f139 100644 --- a/Data/Map/Lazy/Merge.hs +++ b/Data/Map/Merge/Lazy.hs @@ -20,7 +20,7 @@ ----------------------------------------------------------------------------- -- | --- Module : Data.Map.Lazy.Merge +-- Module : Data.Map.Merge.Lazy -- Copyright : (c) David Feuer 2016 -- License : BSD-style -- Maintainer : libraries at haskell.org @@ -45,7 +45,7 @@ -- inefficient in many cases and should usually be avoided. The instances -- for 'WhenMatched' tactics should not pose any major efficiency problems. -module Data.Map.Lazy.Merge ( +module Data.Map.Merge.Lazy ( -- ** Simple merge tactic types SimpleWhenMissing , SimpleWhenMatched diff --git a/Data/Map/Strict/Merge.hs b/Data/Map/Merge/Strict.hs similarity index 97% copy from Data/Map/Strict/Merge.hs copy to Data/Map/Merge/Strict.hs index f71447e..6fcfaf8 100644 --- a/Data/Map/Strict/Merge.hs +++ b/Data/Map/Merge/Strict.hs @@ -20,7 +20,7 @@ ----------------------------------------------------------------------------- -- | --- Module : Data.Map.Strict.Merge +-- Module : Data.Map.Merge.Strict -- Copyright : (c) David Feuer 2016 -- License : BSD-style -- Maintainer : libraries at haskell.org @@ -45,7 +45,7 @@ -- inefficient in many cases and should usually be avoided. The instances -- for 'WhenMatched' tactics should not pose any major efficiency problems. -module Data.Map.Strict.Merge ( +module Data.Map.Merge.Strict ( -- ** Simple merge tactic types SimpleWhenMissing , SimpleWhenMatched diff --git a/Data/Map/Strict/Merge.hs b/Data/Map/Strict/Merge.hs index f71447e..73d4c5e 100644 --- a/Data/Map/Strict/Merge.hs +++ b/Data/Map/Strict/Merge.hs @@ -1,23 +1,12 @@ {-# LANGUAGE CPP #-} -{-# LANGUAGE BangPatterns #-} -#if __GLASGOW_HASKELL__ -{-# LANGUAGE DeriveDataTypeable, StandaloneDeriving #-} -#endif #if !defined(TESTING) && __GLASGOW_HASKELL__ >= 703 {-# LANGUAGE Safe #-} #endif -#if __GLASGOW_HASKELL__ >= 708 -{-# LANGUAGE RoleAnnotations #-} -{-# LANGUAGE TypeFamilies #-} -#define USE_MAGIC_PROXY 1 -#endif - -#if USE_MAGIC_PROXY -{-# LANGUAGE MagicHash #-} -#endif #include "containers.h" +{-# OPTIONS_HADDOCK hide #-} + ----------------------------------------------------------------------------- -- | -- Module : Data.Map.Strict.Merge @@ -45,55 +34,7 @@ -- inefficient in many cases and should usually be avoided. The instances -- for 'WhenMatched' tactics should not pose any major efficiency problems. -module Data.Map.Strict.Merge ( - -- ** Simple merge tactic types - SimpleWhenMissing - , SimpleWhenMatched - - -- ** General combining function - , merge - - -- *** @WhenMatched@ tactics - , zipWithMaybeMatched - , zipWithMatched - - -- *** @WhenMissing@ tactics - , mapMaybeMissing - , dropMissing - , preserveMissing - , mapMissing - , filterMissing - - -- ** Applicative merge tactic types - , WhenMissing - , WhenMatched - - -- ** Applicative general combining function - , mergeA - - -- *** @WhenMatched@ tactics - -- | The tactics described for 'merge' work for - -- 'mergeA' as well. Furthermore, the following - -- are available. - , zipWithMaybeAMatched - , zipWithAMatched - - -- *** @WhenMissing@ tactics - -- | The tactics described for 'merge' work for - -- 'mergeA' as well. Furthermore, the following - -- are available. - , traverseMaybeMissing - , traverseMissing - , filterAMissing - - -- ** Covariant maps for tactics - , mapWhenMissing - , mapWhenMatched - - -- ** Miscellaneous functions on tactics - - , runWhenMatched - , runWhenMissing - ) where +module Data.Map.Strict.Merge {-# DEPRECATED "Use \"Data.Map.Merge.Strict\"." #-} + ( module Data.Map.Merge.Strict ) where -import Data.Map.Strict.Internal +import Data.Map.Merge.Strict diff --git a/containers.cabal b/containers.cabal index b8ab295..6671ebf 100644 --- a/containers.cabal +++ b/containers.cabal @@ -50,9 +50,11 @@ Library Data.Map Data.Map.Lazy Data.Map.Lazy.Merge + Data.Map.Merge.Lazy Data.Map.Strict.Internal Data.Map.Strict Data.Map.Strict.Merge + Data.Map.Merge.Strict Data.Map.Internal Data.Map.Internal.Debug Data.Set.Internal diff --git a/tests/map-properties.hs b/tests/map-properties.hs index 5647292..703f88f 100644 --- a/tests/map-properties.hs +++ b/tests/map-properties.hs @@ -2,10 +2,10 @@ #ifdef STRICT import Data.Map.Strict as Data.Map hiding (showTree, showTreeWith) -import Data.Map.Strict.Merge +import Data.Map.Merge.Strict #else import Data.Map.Lazy as Data.Map hiding (showTree, showTreeWith) -import Data.Map.Lazy.Merge +import Data.Map.Merge.Lazy #endif import Data.Map.Internal (Map (..), link2, link, bin) import Data.Map.Internal.Debug (showTree, showTreeWith, balanced) From git at git.haskell.org Mon Apr 17 21:45:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:45:40 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Merge pull request #335 from treeowl/move-merge (4f70ddd) Message-ID: <20170417214540.AFFCF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/4f70dddee24e800e40318eb271193456d6e444ac >--------------------------------------------------------------- commit 4f70dddee24e800e40318eb271193456d6e444ac Merge: 273578b cc0904d Author: David Feuer Date: Mon Sep 5 15:04:26 2016 -0400 Merge pull request #335 from treeowl/move-merge Rename merge modules >--------------------------------------------------------------- 4f70dddee24e800e40318eb271193456d6e444ac Data/Map/Lazy/Merge.hs | 73 ++------------------------- Data/Map/{Lazy/Merge.hs => Merge/Lazy.hs} | 4 +- Data/Map/{Strict/Merge.hs => Merge/Strict.hs} | 4 +- Data/Map/Strict/Merge.hs | 69 ++----------------------- containers.cabal | 2 + tests/map-properties.hs | 4 +- 6 files changed, 18 insertions(+), 138 deletions(-) From git at git.haskell.org Mon Apr 17 21:45:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:45:42 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Data.IntMap.Internal: cleaning up whitespace (2e7d9ae) Message-ID: <20170417214542.BABB13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/2e7d9aea052212f424c5dd955d01e75bc0dcb8f8 >--------------------------------------------------------------- commit 2e7d9aea052212f424c5dd955d01e75bc0dcb8f8 Author: wren gayle romano Date: Mon Sep 5 14:33:04 2016 -0700 Data.IntMap.Internal: cleaning up whitespace >--------------------------------------------------------------- 2e7d9aea052212f424c5dd955d01e75bc0dcb8f8 Data/IntMap/Internal.hs | 450 ++++++++++++++++++++++++++++-------------------- 1 file changed, 266 insertions(+), 184 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 2e7d9aea052212f424c5dd955d01e75bc0dcb8f8 From git at git.haskell.org Mon Apr 17 21:45:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:45:44 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Data.Map.Internal.mergeA: floated out the missingSubtree progection of g1 (c3bd2be) Message-ID: <20170417214544.C48BF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/c3bd2bebeb14db03da8e64f141141838ebc9da25 >--------------------------------------------------------------- commit c3bd2bebeb14db03da8e64f141141838ebc9da25 Author: wren gayle romano Date: Mon Sep 5 14:55:35 2016 -0700 Data.Map.Internal.mergeA: floated out the missingSubtree progection of g1 >--------------------------------------------------------------- c3bd2bebeb14db03da8e64f141141838ebc9da25 Data/Map/Internal.hs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Data/Map/Internal.hs b/Data/Map/Internal.hs index 7d09eb9..8787f63 100644 --- a/Data/Map/Internal.hs +++ b/Data/Map/Internal.hs @@ -2457,14 +2457,17 @@ mergeA :: (Applicative f, Ord k) -> Map k a -- ^ Map @m1@ -> Map k b -- ^ Map @m2@ -> f (Map k c) -mergeA g1 WhenMissing{missingSubtree = g2} (WhenMatched f) = go +mergeA + WhenMissing{missingSubtree = g1} + WhenMissing{missingSubtree = g2} + (WhenMatched f) = go where - go t1 Tip = missingSubtree g1 t1 + go t1 Tip = g1 t1 go Tip t2 = g2 t2 go (Bin _ kx x1 l1 r1) t2 = case splitLookup kx t2 of (l2, mx2, r2) -> case mx2 of Nothing -> (\l' mx' r' -> maybe link2 (link kx) mx' l' r') - <$> l1l2 <*> missingKey g1 kx x1 <*> r1r2 + <$> l1l2 <*> g1 kx x1 <*> r1r2 Just x2 -> (\l' mx' r' -> maybe link2 (link kx) mx' l' r') <$> l1l2 <*> f kx x1 x2 <*> r1r2 where From git at git.haskell.org Mon Apr 17 21:45:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:45:46 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Data.Map.Internal.mergeA: corrected the floating out of g1 (e6fc53d) Message-ID: <20170417214546.CE3723A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/e6fc53dec18dfab2efc9e5bc281834117b930ec8 >--------------------------------------------------------------- commit e6fc53dec18dfab2efc9e5bc281834117b930ec8 Author: wren gayle romano Date: Mon Sep 5 15:46:22 2016 -0700 Data.Map.Internal.mergeA: corrected the floating out of g1 >--------------------------------------------------------------- e6fc53dec18dfab2efc9e5bc281834117b930ec8 Data/Map/Internal.hs | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/Data/Map/Internal.hs b/Data/Map/Internal.hs index 8787f63..a888b44 100644 --- a/Data/Map/Internal.hs +++ b/Data/Map/Internal.hs @@ -2450,24 +2450,25 @@ merge g1 g2 f m1 m2 = runIdentity $ -- 'mergeA' to define custom combining functions. -- -- @since 0.5.8 -mergeA :: (Applicative f, Ord k) - => WhenMissing f k a c -- ^ What to do with keys in @m1@ but not @m2@ - -> WhenMissing f k b c -- ^ What to do with keys in @m2@ but not @m1@ - -> WhenMatched f k a b c -- ^ What to do with keys in both @m1@ and @m2@ - -> Map k a -- ^ Map @m1@ - -> Map k b -- ^ Map @m2@ - -> f (Map k c) mergeA - WhenMissing{missingSubtree = g1} - WhenMissing{missingSubtree = g2} + :: (Applicative f, Ord k) + => WhenMissing f k a c -- ^ What to do with keys in @m1@ but not @m2@ + -> WhenMissing f k b c -- ^ What to do with keys in @m2@ but not @m1@ + -> WhenMatched f k a b c -- ^ What to do with keys in both @m1@ and @m2@ + -> Map k a -- ^ Map @m1@ + -> Map k b -- ^ Map @m2@ + -> f (Map k c) +mergeA + WhenMissing{missingSubtree = g1t, missingKey = g1k} + WhenMissing{missingSubtree = g2t} (WhenMatched f) = go where - go t1 Tip = g1 t1 - go Tip t2 = g2 t2 + go t1 Tip = g1t t1 + go Tip t2 = g2t t2 go (Bin _ kx x1 l1 r1) t2 = case splitLookup kx t2 of (l2, mx2, r2) -> case mx2 of Nothing -> (\l' mx' r' -> maybe link2 (link kx) mx' l' r') - <$> l1l2 <*> g1 kx x1 <*> r1r2 + <$> l1l2 <*> g1k kx x1 <*> r1r2 Just x2 -> (\l' mx' r' -> maybe link2 (link kx) mx' l' r') <$> l1l2 <*> f kx x1 x2 <*> r1r2 where From git at git.haskell.org Mon Apr 17 21:45:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:45:48 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Data.Map.Internal: initial copy & paste of {merge, mergeA} stuff (83a3908) Message-ID: <20170417214548.D8E883A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/83a390888f7f5d1994db839f4cd6c29515893411 >--------------------------------------------------------------- commit 83a390888f7f5d1994db839f4cd6c29515893411 Author: wren gayle romano Date: Mon Sep 5 16:14:09 2016 -0700 Data.Map.Internal: initial copy & paste of {merge,mergeA} stuff >--------------------------------------------------------------- 83a390888f7f5d1994db839f4cd6c29515893411 Data/IntMap/Internal.hs | 563 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 563 insertions(+) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 83a390888f7f5d1994db839f4cd6c29515893411 From git at git.haskell.org Mon Apr 17 21:45:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:45:50 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Data.IntMap.Internal: first pass of getting {merge, mergeA} to typecheck (8d6fcee) Message-ID: <20170417214550.E42583A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/8d6fcee199bfa01a31abec852a6b6ffbcc606e58 >--------------------------------------------------------------- commit 8d6fcee199bfa01a31abec852a6b6ffbcc606e58 Author: wren gayle romano Date: Mon Sep 5 16:39:28 2016 -0700 Data.IntMap.Internal: first pass of getting {merge,mergeA} to typecheck >--------------------------------------------------------------- 8d6fcee199bfa01a31abec852a6b6ffbcc606e58 Data/IntMap/Internal.hs | 148 +++++++++++++++++++++++++++++++----------------- 1 file changed, 95 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 8d6fcee199bfa01a31abec852a6b6ffbcc606e58 From git at git.haskell.org Mon Apr 17 21:45:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:45:52 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Quit using deleteFindMin and deleteFindMax (3f6786b) Message-ID: <20170417214552.F3FAA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/3f6786b0d7bb90544a266ec792de9a9492d6337c >--------------------------------------------------------------- commit 3f6786b0d7bb90544a266ec792de9a9492d6337c Author: David Feuer Date: Tue Sep 6 19:37:34 2016 -0400 Quit using deleteFindMin and deleteFindMax Stop using `deleteFindMin` or `deleteFindMax` internally, in both `Data.Set` and `Data.Map`. * The `deleteFindMin` and `deleteFindMax` functions are partial, and also rather ugly. Reimplement `minView`, `minViewWithKey`, `glue`, etc., using total functions. With manual call-pattern specialization, this produces pretty core, and slight performance improvements as well. I'm not sure why GHC doesn't do that specialization for us, but I couldn't seem to convince it to. * Add `lookupMin` and `lookupMax`, total versions of `findMin` and `findMax`, to both `Data.Set` and `Data.Map`. Add `!?`, a total version of `!`, to `Data.Map`. >--------------------------------------------------------------- 3f6786b0d7bb90544a266ec792de9a9492d6337c Data/Map/Internal.hs | 134 +++++++++++++++++++++++++++++++------------- Data/Map/Lazy.hs | 4 +- Data/Map/Strict.hs | 4 +- Data/Map/Strict/Internal.hs | 7 ++- Data/Set.hs | 2 + Data/Set/Internal.hs | 82 ++++++++++++++++++++------- changelog.md | 9 +++ tests/map-properties.hs | 8 +++ tests/set-properties.hs | 8 +++ 9 files changed, 197 insertions(+), 61 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 3f6786b0d7bb90544a266ec792de9a9492d6337c From git at git.haskell.org Mon Apr 17 21:45:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:45:55 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Merge pull request #337 from treeowl/map-min-max (71e293e) Message-ID: <20170417214555.0AE963A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/71e293eb0849dee89dbabc6bd7fa258094b4db6c >--------------------------------------------------------------- commit 71e293eb0849dee89dbabc6bd7fa258094b4db6c Merge: 4f70ddd 3f6786b Author: David Feuer Date: Wed Sep 7 01:09:48 2016 -0400 Merge pull request #337 from treeowl/map-min-max Quit using deleteFindMin and deleteFindMax >--------------------------------------------------------------- 71e293eb0849dee89dbabc6bd7fa258094b4db6c Data/Map/Internal.hs | 134 +++++++++++++++++++++++++++++++------------- Data/Map/Lazy.hs | 4 +- Data/Map/Strict.hs | 4 +- Data/Map/Strict/Internal.hs | 7 ++- Data/Set.hs | 2 + Data/Set/Internal.hs | 82 ++++++++++++++++++++------- changelog.md | 9 +++ tests/map-properties.hs | 8 +++ tests/set-properties.hs | 8 +++ 9 files changed, 197 insertions(+), 61 deletions(-) From git at git.haskell.org Mon Apr 17 21:45:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:45:57 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Data.Sequence.Internal: Fix CPP usage (c5f2897) Message-ID: <20170417214557.152063A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/c5f289788373ac85bd3739a1e5a92ac7323cbd2e >--------------------------------------------------------------- commit c5f289788373ac85bd3739a1e5a92ac7323cbd2e Author: Erik de Castro Lopo Date: Sun Oct 23 12:15:42 2016 +1100 Data.Sequence.Internal: Fix CPP usage There was a mixture of `#ifdef TESTING` and `#if TESTING`. The later works, but is not really correct. GHC HEAD now has a `-Wcpp-undef` warning that we would like to turn on and hence need this fixed. >--------------------------------------------------------------- c5f289788373ac85bd3739a1e5a92ac7323cbd2e Data/Sequence/Internal.hs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Data/Sequence/Internal.hs b/Data/Sequence/Internal.hs index 95c143e..9cacb39 100644 --- a/Data/Sequence/Internal.hs +++ b/Data/Sequence/Internal.hs @@ -182,7 +182,7 @@ module Data.Sequence.Internal ( zipWith3, -- :: (a -> b -> c -> d) -> Seq a -> Seq b -> Seq c -> Seq d zip4, -- :: Seq a -> Seq b -> Seq c -> Seq d -> Seq (a, b, c, d) zipWith4, -- :: (a -> b -> c -> d -> e) -> Seq a -> Seq b -> Seq c -> Seq d -> Seq e -#if TESTING +#ifdef TESTING deep, node2, node3, @@ -694,7 +694,7 @@ instance Eq a => Eq (Seq a) where instance Ord a => Ord (Seq a) where compare xs ys = compare (toList xs) (toList ys) -#if TESTING +#ifdef TESTING instance Show a => Show (Seq a) where showsPrec p (Seq x) = showsPrec p x #else @@ -762,7 +762,7 @@ data FingerTree a = EmptyT | Single a | Deep {-# UNPACK #-} !Int !(Digit a) (FingerTree (Node a)) !(Digit a) -#if TESTING +#ifdef TESTING deriving Show #endif @@ -854,7 +854,7 @@ data Digit a | Two a a | Three a a a | Four a a a a -#if TESTING +#ifdef TESTING deriving Show #endif @@ -941,7 +941,7 @@ digitToTree' !_n (One a) = Single a data Node a = Node2 {-# UNPACK #-} !Int a a | Node3 {-# UNPACK #-} !Int a a a -#if TESTING +#ifdef TESTING deriving Show #endif @@ -1014,7 +1014,7 @@ nodeToDigit (Node3 _ a b c) = Three a b c -- Elements newtype Elem a = Elem { getElem :: a } -#if TESTING +#ifdef TESTING deriving Show #endif @@ -1820,7 +1820,7 @@ lookup i (Seq xs) (!?) = flip lookup data Place a = Place {-# UNPACK #-} !Int a -#if TESTING +#ifdef TESTING deriving Show #endif @@ -3149,7 +3149,7 @@ uncheckedSplitAt i (Seq xs) = case splitTreeE i xs of l :*: r -> (Seq l, Seq r) data Split a = Split !(FingerTree (Node a)) !(Node a) !(FingerTree (Node a)) -#if TESTING +#ifdef TESTING deriving Show #endif @@ -4208,7 +4208,7 @@ data PQL e = Nil | {-# UNPACK #-} !(PQueue e) :& PQL e infixr 8 :& -#if TESTING +#ifdef TESTING instance Functor PQueue where fmap f (PQueue x ts) = PQueue (f x) (fmap f ts) From git at git.haskell.org Mon Apr 17 21:45:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:45:59 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Merge pull request #352 from erikd/master (1e6bb29) Message-ID: <20170417214559.1E1E13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/1e6bb29cc24ec54c1cd729b76f3b5f1eb98f04bf >--------------------------------------------------------------- commit 1e6bb29cc24ec54c1cd729b76f3b5f1eb98f04bf Merge: 71e293e c5f2897 Author: David Feuer Date: Sun Oct 30 08:16:40 2016 -0400 Merge pull request #352 from erikd/master Data.Sequence.Internal: Fix CPP usage >--------------------------------------------------------------- 1e6bb29cc24ec54c1cd729b76f3b5f1eb98f04bf Data/Sequence/Internal.hs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) From git at git.haskell.org Mon Apr 17 21:46:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:46:01 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Data.IntMap.Internal: rebasing and minor adjustments (06e0146) Message-ID: <20170417214601.27B0D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/06e01467a269528a91660142007413600907169a >--------------------------------------------------------------- commit 06e01467a269528a91660142007413600907169a Author: wren gayle romano Date: Mon Sep 5 16:39:28 2016 -0700 Data.IntMap.Internal: rebasing and minor adjustments >--------------------------------------------------------------- 06e01467a269528a91660142007413600907169a Data/IntMap/Internal.hs | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/Data/IntMap/Internal.hs b/Data/IntMap/Internal.hs index 3d7de1d..3fb30e9 100644 --- a/Data/IntMap/Internal.hs +++ b/Data/IntMap/Internal.hs @@ -1538,7 +1538,7 @@ preserveMissing = WhenMissing mapMissing :: Applicative f => (Key -> x -> y) -> WhenMissing f x y mapMissing f = WhenMissing { missingSubtree = \m -> pure $! mapWithKey f m - , missingKey = \ k x -> pure $ Just (f k x) } + , missingKey = \k x -> pure $ Just (f k x) } {-# INLINE mapMissing #-} @@ -1594,16 +1594,29 @@ filterAMissing f = WhenMissing filterWithKeyA :: Applicative f => (Key -> a -> f Bool) -> IntMap a -> f (IntMap a) filterWithKeyA _ Nil = pure Nil -filterWithKeyA f (Tip k x) = error "TODO: filterWithKeyA" +filterWithKeyA f t@(Tip k x) = (\b -> if b then t else Nil) <$> f k x filterWithKeyA f t@(Bin p m l r) = error "TODO: filterWithKeyA" - {- +{- +-- Implementation Idea 1: combine <$> f p m <*> filterWithKeyA f l <*> filterWithKeyA f r where combine True l' r' | l' `ptrEq` l && r' `ptrEq` r = t | otherwise = link p m l' r' combine False l' r' = link2 l' r' - -} + +-- Implementation Idea 2: + combine p m <$> filterWithKeyA f l <*> filterWithKeyA f r + where + combine _ _ Nil r' = r' + combine _ _ l' Nil = l' + combine p m l' r' + | l' `ptrEq` l && r' `ptrEq` r = t + | otherwise = link pl l' pr r' + combine p m l' r' = link2 l' r' + +link k (Tip k x) p t@(Bin p m _ _ \/ Tip p _) | nomatch k p m \/ k/=p +-} -- | This wasn't in Data.Bool until 4.7.0, so we define it here bool :: a -> a -> Bool -> a From git at git.haskell.org Mon Apr 17 21:46:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:46:03 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Merge branch 'refs/heads/master' into IntMapGeneralMerge (b1c36d0) Message-ID: <20170417214603.36DF13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/b1c36d0e0a6e83df68ceeca067cf74a77912d653 >--------------------------------------------------------------- commit b1c36d0e0a6e83df68ceeca067cf74a77912d653 Merge: 06e0146 1e6bb29 Author: wren romano Date: Sun Nov 6 17:15:00 2016 -0800 Merge branch 'refs/heads/master' into IntMapGeneralMerge >--------------------------------------------------------------- b1c36d0e0a6e83df68ceeca067cf74a77912d653 Data/Map/Internal.hs | 134 +++++++++++++++++++++++++++++++------------- Data/Map/Lazy.hs | 4 +- Data/Map/Strict.hs | 4 +- Data/Map/Strict/Internal.hs | 7 ++- Data/Sequence/Internal.hs | 18 +++--- Data/Set.hs | 2 + Data/Set/Internal.hs | 82 ++++++++++++++++++++------- changelog.md | 9 +++ tests/map-properties.hs | 8 +++ tests/set-properties.hs | 8 +++ 10 files changed, 206 insertions(+), 70 deletions(-) From git at git.haskell.org Mon Apr 17 21:46:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:46:05 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Data.IntMap.Internal: preliminary version of mergeA (2d31250) Message-ID: <20170417214605.400743A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/2d312508b9cd2dd527fbc914d60b1e7f33bd8461 >--------------------------------------------------------------- commit 2d312508b9cd2dd527fbc914d60b1e7f33bd8461 Author: wren romano Date: Sun Nov 6 23:17:09 2016 -0800 Data.IntMap.Internal: preliminary version of mergeA This version fills in all the todos, and the code matches the pure version fairly well, but (a) the outputs have not been debugged, and (b) the order of effects is known to be wrong. >--------------------------------------------------------------- 2d312508b9cd2dd527fbc914d60b1e7f33bd8461 Data/IntMap/Internal.hs | 133 ++++++++++++++++++++++++++---------------------- 1 file changed, 72 insertions(+), 61 deletions(-) diff --git a/Data/IntMap/Internal.hs b/Data/IntMap/Internal.hs index 3fb30e9..6947dfe 100644 --- a/Data/IntMap/Internal.hs +++ b/Data/IntMap/Internal.hs @@ -1595,28 +1595,8 @@ filterWithKeyA :: Applicative f => (Key -> a -> f Bool) -> IntMap a -> f (IntMap a) filterWithKeyA _ Nil = pure Nil filterWithKeyA f t@(Tip k x) = (\b -> if b then t else Nil) <$> f k x -filterWithKeyA f t@(Bin p m l r) = error "TODO: filterWithKeyA" -{- --- Implementation Idea 1: - combine <$> f p m <*> filterWithKeyA f l <*> filterWithKeyA f r - where - combine True l' r' - | l' `ptrEq` l && r' `ptrEq` r = t - | otherwise = link p m l' r' - combine False l' r' = link2 l' r' - --- Implementation Idea 2: - combine p m <$> filterWithKeyA f l <*> filterWithKeyA f r - where - combine _ _ Nil r' = r' - combine _ _ l' Nil = l' - combine p m l' r' - | l' `ptrEq` l && r' `ptrEq` r = t - | otherwise = link pl l' pr r' - combine p m l' r' = link2 l' r' - -link k (Tip k x) p t@(Bin p m _ _ \/ Tip p _) | nomatch k p m \/ k/=p --} +filterWithKeyA f t@(Bin p m l r) = + bin p m <$> filterWithKeyA f l <*> filterWithKeyA f r -- | This wasn't in Data.Bool until 4.7.0, so we define it here bool :: a -> a -> Bool -> a @@ -1649,20 +1629,11 @@ traverseMaybeMissing f = WhenMissing -- | /O(n)/. Traverse keys\/values and collect the 'Just' results. traverseMaybeWithKey :: Applicative f => (Key -> a -> f (Maybe b)) -> IntMap a -> f (IntMap b) -traverseMaybeWithKey = error "TODO: traverseMaybeWithKey" - {- - where - go _ Nil = pure Nil - go f (Bin _ kx x Nil Nil) = - maybe Tip (\x' -> Bin 1 kx x' Nil Nil) <$> f kx x - go f (Bin _ kx x l r) = - combine <$> go f l <*> f kx x <*> go f r - where - combine !l' mx !r' = - case mx of - Nothing -> link2 l' r' - Just x' -> link kx x' l' r' - -} +traverseMaybeWithKey f = go + where + go Nil = pure Nil + go (Tip k x) = maybe Nil (Tip k) <$> f k x + go (Bin p m l r) = bin p m <$> go l <*> go r -- | Merge two maps. @@ -1820,25 +1791,68 @@ mergeA -> f (IntMap c) mergeA WhenMissing{missingSubtree = g1t, missingKey = g1k} - WhenMissing{missingSubtree = g2t} - (WhenMatched f) = go + WhenMissing{missingSubtree = g2t, missingKey = g2k} + WhenMatched{matchedKey = f} + = go where - go t1 Nil = g1t t1 - go Nil t2 = g2t t2 - go (Tip k x) t2 = error "TODO: mergeA" - go (Bin p m l1 r1) t2 = error "TODO: mergeA" - {- - case splitLookup kx t2 of - (l2, mx2, r2) -> - case mx2 of - Nothing -> (\l' mx' r' -> maybe link2 (link kx) mx' l' r') - <$> l1l2 <*> g1k kx x1 <*> r1r2 - Just x2 -> (\l' mx' r' -> maybe link2 (link kx) mx' l' r') - <$> l1l2 <*> f kx x1 x2 <*> r1r2 + go t1 Nil = g1t t1 + go Nil t2 = g2t t2 + + -- This case is already covered below. + -- go (Tip k1 x1) (Tip k2 x2) = mergeTips k1 x1 k2 x2 + + go (Tip k1 x1) t2' = merge2 t2' where - !l1l2 = go l1 l2 - !r1r2 = go r1 r2 - -} + merge2 t2@(Bin p2 m2 l2 r2) + | nomatch k1 p2 m2 = link_ k1 p2 <$> subsingletonBy g1k k1 x1 <*> g2t t2 + | zero k1 m2 = bin p2 m2 <$> merge2 l2 <*> g2t r2 + | otherwise = bin p2 m2 <$> g2t l2 <*> merge2 r2 + merge2 (Tip k2 x2) = mergeTips k1 x1 k2 x2 + merge2 Nil = subsingletonBy g1k k1 x1 + + go t1' (Tip k2 x2) = merge1 t1' + where + merge1 t1@(Bin p1 m1 l1 r1) + | nomatch k2 p1 m1 = link_ p1 k2 <$> g1t t1 <*> subsingletonBy g2k k2 x2 + | zero k2 m1 = bin p1 m1 <$> merge1 l1 <*> g1t r1 + | otherwise = bin p1 m1 <$> g1t l1 <*> merge1 r1 + merge1 (Tip k1 x1) = mergeTips k1 x1 k2 x2 + merge1 Nil = subsingletonBy g2k k2 x2 + + go t1@(Bin p1 m1 l1 r1) t2@(Bin p2 m2 l2 r2) + | shorter m1 m2 = merge1 + | shorter m2 m1 = merge2 + | p1 == p2 = bin p1 m1 <$> go l1 l2 <*> go r1 r2 + | otherwise = link_ p1 p2 <$> g1t t1 <*> g2t t2 + where + merge1 | nomatch p2 p1 m1 = link_ p1 p2 <$> g1t t1 <*> g2t t2 + | zero p2 m1 = bin p1 m1 <$> go l1 t2 <*> g1t r1 + | otherwise = bin p1 m1 <$> g1t l1 <*> go r1 t2 + merge2 | nomatch p1 p2 m2 = link_ p1 p2 <$> g1t t1 <*> g2t t2 + | zero p1 m2 = bin p2 m2 <$> go t1 l2 <*> g2t r2 + | otherwise = bin p2 m2 <$> g2t l2 <*> go t1 r2 + + subsingletonBy gk k x = maybe Nil (Tip k) <$> gk k x + {-# INLINE subsingletonBy #-} + + mergeTips k1 x1 k2 x2 + | k1 == k2 = maybe Nil (Tip k1) <$> f k1 x1 x2 + | otherwise = subdoubleton k1 k2 <$> g1k k1 x1 <*> g2k k2 x2 + {- + = link_ k1 k2 <$> subsingletonBy g1k k1 x1 <*> subsingletonBy g2k k2 x2 + -} + {-# INLINE mergeTips #-} + + subdoubleton _ _ Nothing Nothing = Nil + subdoubleton _ k2 Nothing (Just y2) = Tip k2 y2 + subdoubleton k1 _ (Just y1) Nothing = Tip k1 y1 + subdoubleton k1 k2 (Just y1) (Just y2) = link k1 (Tip k1 y1) k2 (Tip k2 y2) + {-# INLINE subdoubleton #-} + + link_ _ _ Nil t2 = t2 + link_ _ _ t1 Nil = t1 + link_ p1 p2 t1 t2 = link p1 t1 p2 t2 + {-# INLINE link_ #-} {-# INLINE mergeA #-} @@ -2256,14 +2270,11 @@ filter p m -- > filterWithKey (\k _ -> k > 4) (fromList [(5,"a"), (3,"b")]) == singleton 5 "a" filterWithKey :: (Key -> a -> Bool) -> IntMap a -> IntMap a -filterWithKey predicate t - = case t of - Bin p m l r - -> bin p m (filterWithKey predicate l) (filterWithKey predicate r) - Tip k x - | predicate k x -> t - | otherwise -> Nil - Nil -> Nil +filterWithKey predicate = go + where + go Nil = Nil + go t@(Tip k x) = if predicate k x then t else Nil + go (Bin p m l r) = bin p m (go l) (go r) -- | /O(n)/. Partition the map according to some predicate. The first -- map contains all elements that satisfy the predicate, the second all From git at git.haskell.org Mon Apr 17 21:46:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:46:07 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Data.IntMap.Internal: corrected order of effects in mergeA (dec40ee) Message-ID: <20170417214607.48FE43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/dec40eeadd401168226029ef74b6eb1738c36785 >--------------------------------------------------------------- commit dec40eeadd401168226029ef74b6eb1738c36785 Author: wren romano Date: Sun Nov 6 23:36:17 2016 -0800 Data.IntMap.Internal: corrected order of effects in mergeA That is, corrected the order for the Tip vs Bin cases. Still haven't tested everything all together. >--------------------------------------------------------------- dec40eeadd401168226029ef74b6eb1738c36785 Data/IntMap/Internal.hs | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/Data/IntMap/Internal.hs b/Data/IntMap/Internal.hs index 6947dfe..9da7140 100644 --- a/Data/IntMap/Internal.hs +++ b/Data/IntMap/Internal.hs @@ -1593,9 +1593,9 @@ filterAMissing f = WhenMissing -- | /O(n)/. Filter keys and values using an 'Applicative' predicate. filterWithKeyA :: Applicative f => (Key -> a -> f Bool) -> IntMap a -> f (IntMap a) -filterWithKeyA _ Nil = pure Nil -filterWithKeyA f t@(Tip k x) = (\b -> if b then t else Nil) <$> f k x -filterWithKeyA f t@(Bin p m l r) = +filterWithKeyA _ Nil = pure Nil +filterWithKeyA f t@(Tip k x) = (\b -> if b then t else Nil) <$> f k x +filterWithKeyA f (Bin p m l r) = bin p m <$> filterWithKeyA f l <*> filterWithKeyA f r -- | This wasn't in Data.Bool until 4.7.0, so we define it here @@ -1804,7 +1804,15 @@ mergeA go (Tip k1 x1) t2' = merge2 t2' where merge2 t2@(Bin p2 m2 l2 r2) - | nomatch k1 p2 m2 = link_ k1 p2 <$> subsingletonBy g1k k1 x1 <*> g2t t2 + | nomatch k1 p2 m2 = + -- The obvious implementation, but wrong order of effects. + -- > link_ k1 p2 <$> subsingletonBy g1k k1 x1 <*> g2t t2 + -- The right order of effects, but needs optimizing: + let (lts2, gts2) = split k1 t2 in + (\lt' t' gt' -> lt' `union` t' `union` gt') + <$> g2t lts2 + <*> subsingletonBy g1k k1 x1 + <*> g2t gts2 | zero k1 m2 = bin p2 m2 <$> merge2 l2 <*> g2t r2 | otherwise = bin p2 m2 <$> g2t l2 <*> merge2 r2 merge2 (Tip k2 x2) = mergeTips k1 x1 k2 x2 @@ -1813,7 +1821,15 @@ mergeA go t1' (Tip k2 x2) = merge1 t1' where merge1 t1@(Bin p1 m1 l1 r1) - | nomatch k2 p1 m1 = link_ p1 k2 <$> g1t t1 <*> subsingletonBy g2k k2 x2 + | nomatch k2 p1 m1 = + -- The obvious implementation, but wrong order of effects. + -- > link_ p1 k2 <$> g1t t1 <*> subsingletonBy g2k k2 x2 + -- The right order of effects, but needs optimizing: + let (lts1, gts1) = split k2 t1 in + (\lt' t' gt' -> lt' `union` t' `union` gt') + <$> g1t lts1 + <*> subsingletonBy g2k k2 x2 + <*> g1t gts1 | zero k2 m1 = bin p1 m1 <$> merge1 l1 <*> g1t r1 | otherwise = bin p1 m1 <$> g1t l1 <*> merge1 r1 merge1 (Tip k1 x1) = mergeTips k1 x1 k2 x2 @@ -1837,10 +1853,11 @@ mergeA mergeTips k1 x1 k2 x2 | k1 == k2 = maybe Nil (Tip k1) <$> f k1 x1 x2 - | otherwise = subdoubleton k1 k2 <$> g1k k1 x1 <*> g2k k2 x2 + | k1 < k2 = subdoubleton k1 k2 <$> g1k k1 x1 <*> g2k k2 x2 {- = link_ k1 k2 <$> subsingletonBy g1k k1 x1 <*> subsingletonBy g2k k2 x2 -} + | otherwise = subdoubleton k2 k1 <$> g2k k2 x2 <*> g1k k1 x1 {-# INLINE mergeTips #-} subdoubleton _ _ Nothing Nothing = Nil From git at git.haskell.org Mon Apr 17 21:46:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:46:09 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Data.IntMap.Internal: fixed the Tip vs Bin case of MergeA (e8d9038) Message-ID: <20170417214609.52F663A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/e8d9038418ce7fa595c408692483f11e2835d84b >--------------------------------------------------------------- commit e8d9038418ce7fa595c408692483f11e2835d84b Author: wren romano Date: Mon Nov 7 18:15:38 2016 -0800 Data.IntMap.Internal: fixed the Tip vs Bin case of MergeA >--------------------------------------------------------------- e8d9038418ce7fa595c408692483f11e2835d84b Data/IntMap/Internal.hs | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/Data/IntMap/Internal.hs b/Data/IntMap/Internal.hs index 9da7140..bd67a5e 100644 --- a/Data/IntMap/Internal.hs +++ b/Data/IntMap/Internal.hs @@ -1804,15 +1804,7 @@ mergeA go (Tip k1 x1) t2' = merge2 t2' where merge2 t2@(Bin p2 m2 l2 r2) - | nomatch k1 p2 m2 = - -- The obvious implementation, but wrong order of effects. - -- > link_ k1 p2 <$> subsingletonBy g1k k1 x1 <*> g2t t2 - -- The right order of effects, but needs optimizing: - let (lts2, gts2) = split k1 t2 in - (\lt' t' gt' -> lt' `union` t' `union` gt') - <$> g2t lts2 - <*> subsingletonBy g1k k1 x1 - <*> g2t gts2 + | nomatch k1 p2 m2 = linkA k1 (subsingletonBy g1k k1 x1) p2 (g2t t2) | zero k1 m2 = bin p2 m2 <$> merge2 l2 <*> g2t r2 | otherwise = bin p2 m2 <$> g2t l2 <*> merge2 r2 merge2 (Tip k2 x2) = mergeTips k1 x1 k2 x2 @@ -1821,15 +1813,7 @@ mergeA go t1' (Tip k2 x2) = merge1 t1' where merge1 t1@(Bin p1 m1 l1 r1) - | nomatch k2 p1 m1 = - -- The obvious implementation, but wrong order of effects. - -- > link_ p1 k2 <$> g1t t1 <*> subsingletonBy g2k k2 x2 - -- The right order of effects, but needs optimizing: - let (lts1, gts1) = split k2 t1 in - (\lt' t' gt' -> lt' `union` t' `union` gt') - <$> g1t lts1 - <*> subsingletonBy g2k k2 x2 - <*> g1t gts1 + | nomatch k2 p1 m1 = linkA p1 (g1t t1) k2 (subsingletonBy g2k k2 x2) | zero k2 m1 = bin p1 m1 <$> merge1 l1 <*> g1t r1 | otherwise = bin p1 m1 <$> g1t l1 <*> merge1 r1 merge1 (Tip k1 x1) = mergeTips k1 x1 k2 x2 @@ -1870,6 +1854,21 @@ mergeA link_ _ _ t1 Nil = t1 link_ p1 p2 t1 t2 = link p1 t1 p2 t2 {-# INLINE link_ #-} + + -- | A variant of 'link_' which makes sure to execute side-effects + -- in the right order. + linkA + :: Applicative f + => Prefix -> f (IntMap a) + -> Prefix -> f (IntMap a) + -> f (IntMap a) + linkA p1 t1 p2 t2 + | zero p1 m = bin p m <$> t1 <*> t2 + | otherwise = bin p m <$> t2 <*> t1 + where + m = branchMask p1 p2 + p = mask p1 m + {-# INLINE linkA #-} {-# INLINE mergeA #-} From git at git.haskell.org Mon Apr 17 21:46:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:46:11 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: IntMap: adding intermediate data structures to strictify recursion (44ea388) Message-ID: <20170417214611.5C4613A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/44ea388898a5ca39774b9e3e4cf10cb5f2673966 >--------------------------------------------------------------- commit 44ea388898a5ca39774b9e3e4cf10cb5f2673966 Author: wren romano Date: Sat Nov 26 20:11:59 2016 -0800 IntMap: adding intermediate data structures to strictify recursion >--------------------------------------------------------------- 44ea388898a5ca39774b9e3e4cf10cb5f2673966 Data/IntMap/Internal.hs | 93 ++++++++++++++++++++++++++++--------------------- 1 file changed, 54 insertions(+), 39 deletions(-) diff --git a/Data/IntMap/Internal.hs b/Data/IntMap/Internal.hs index bd67a5e..b11d6a4 100644 --- a/Data/IntMap/Internal.hs +++ b/Data/IntMap/Internal.hs @@ -1353,6 +1353,17 @@ contramapSecondWhenMatched f t = {-# INLINE contramapSecondWhenMatched #-} +#if !MIN_VERSION_base(4,8,0) +newtype Identity a = Identity {runIdentity :: a} + +instance Functor Identity where + fmap f (Identity x) = Identity (f x) + +instance Applicative Identity where + pure = Identity + Identity f <*> Identity x = Identity (f x) +#endif + -- | A tactic for dealing with keys present in one map but not the -- other in 'merge'. -- @@ -1908,6 +1919,9 @@ updateMaxWithKey f t = Nothing -> Nil go _ Nil = error "updateMaxWithKey Nil" + +data View a = View {-# UNPACK #-} !Key a !(IntMap a) + -- | /O(min(n,W))/. Retrieves the maximal (key,value) pair of the map, and -- the map stripped of that element, or 'Nothing' if passed an empty map. -- @@ -1919,11 +1933,12 @@ maxViewWithKey t = case t of Nil -> Nothing Bin p m l r | m < 0 -> - case go l of (result, l') -> Just (result, binCheckLeft p m l' r) - _ -> Just (go t) + Just $ case go l of View k a l' -> ((k, a), binCheckLeft p m l' r) + _ -> Just $ case go t of View k a t' -> ((k, a), t') where - go (Bin p m l r) = case go r of (result, r') -> (result, binCheckRight p m l r') - go (Tip k y) = ((k, y), Nil) + go (Bin p m l r) = + case go r of View k a r' -> View k a (binCheckRight p m l r') + go (Tip k y) = View k y Nil go Nil = error "maxViewWithKey Nil" -- | /O(min(n,W))/. Retrieves the minimal (key,value) pair of the map, and @@ -1937,11 +1952,12 @@ minViewWithKey t = case t of Nil -> Nothing Bin p m l r | m < 0 -> - case go r of (result, r') -> Just (result, binCheckRight p m l r') - _ -> Just (go t) + Just $ case go r of View k a r' -> ((k, a), binCheckRight p m l r') + _ -> Just $ case go t of View k a t' -> ((k, a), t') where - go (Bin p m l r) = case go l of (result, l') -> (result, binCheckLeft p m l' r) - go (Tip k y) = ((k, y), Nil) + go (Bin p m l r) = + case go l of View k a l' -> View k a (binCheckLeft p m l' r) + go (Tip k y) = View k y Nil go Nil = error "minViewWithKey Nil" -- | /O(min(n,W))/. Update the value at the maximal key. @@ -2421,6 +2437,17 @@ split k t = | otherwise = (Nil :*: Nil) go _ Nil = (Nil :*: Nil) + +data SplitLookup a = SplitLookup !(IntMap a) !(Maybe a) !(IntMap a) + +mapLT :: (IntMap a -> IntMap a) -> SplitLookup a -> SplitLookup a +mapLT f (SplitLookup lt fnd gt) = SplitLookup (f lt) fnd gt +{-# INLINE mapLT #-} + +mapGT :: (IntMap a -> IntMap a) -> SplitLookup a -> SplitLookup a +mapGT f (SplitLookup lt fnd gt) = SplitLookup lt fnd (f gt) +{-# INLINE mapGT #-} + -- | /O(min(n,W))/. Performs a 'split' but also returns whether the pivot -- key was found in the original map. -- @@ -2432,40 +2459,28 @@ split k t = splitLookup :: Key -> IntMap a -> (IntMap a, Maybe a, IntMap a) splitLookup k t = - case t of - Bin _ m l r - | m < 0 -> - if k >= 0 -- handle negative numbers. - then - case go k l of - (lt, fnd, gt) -> - let !lt' = union r lt - in (lt', fnd, gt) - else - case go k r of - (lt, fnd, gt) -> - let !gt' = union gt l - in (lt, fnd, gt') - _ -> go k t + case + case t of + Bin _ m l r + | m < 0 -> + if k >= 0 -- handle negative numbers. + then mapLT (union r) (go k l) + else mapGT (`union` l) (go k r) + _ -> go k t + of SplitLookup lt fnd gt -> (lt, fnd, gt) where go k' t'@(Bin p m l r) - | nomatch k' p m = - if k' > p then (t', Nothing, Nil) else (Nil, Nothing, t') - | zero k' m = - case go k' l of - (lt, fnd, gt) -> - let !gt' = union gt r - in (lt, fnd, gt') - | otherwise = - case go k' r of - (lt, fnd, gt) -> - let !lt' = union l lt - in (lt', fnd, gt) + | nomatch k' p m = + if k' > p + then SplitLookup t' Nothing Nil + else SplitLookup Nil Nothing t' + | zero k' m = mapGT (`union` r) (go k' l) + | otherwise = mapLT (union l) (go k' r) go k' t'@(Tip ky y) - | k' > ky = (t', Nothing, Nil) - | k' < ky = (Nil, Nothing, t') - | otherwise = (Nil, Just y, Nil) - go _ Nil = (Nil, Nothing, Nil) + | k' > ky = SplitLookup t' Nothing Nil + | k' < ky = SplitLookup Nil Nothing t' + | otherwise = SplitLookup Nil (Just y) Nil + go _ Nil = SplitLookup Nil Nothing Nil {-------------------------------------------------------------------- Fold From git at git.haskell.org Mon Apr 17 21:46:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:46:13 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: IntMap: added deprecation for debugging functions (86a50ab) Message-ID: <20170417214613.659FF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/86a50abbe709eec4b91b7ba422ca1336b31e5b04 >--------------------------------------------------------------- commit 86a50abbe709eec4b91b7ba422ca1336b31e5b04 Author: wren romano Date: Sat Nov 26 20:14:48 2016 -0800 IntMap: added deprecation for debugging functions >--------------------------------------------------------------- 86a50abbe709eec4b91b7ba422ca1336b31e5b04 Data/IntMap/Internal.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Data/IntMap/Internal.hs b/Data/IntMap/Internal.hs index b11d6a4..ba8efb6 100644 --- a/Data/IntMap/Internal.hs +++ b/Data/IntMap/Internal.hs @@ -3094,6 +3094,10 @@ splitRoot orig = {-------------------------------------------------------------------- Debugging --------------------------------------------------------------------} +{-# DEPRECATED showTree, showTreeWith + "These debugging functions will be moved to a separate module in future versions" + #-} + -- | /O(n)/. Show the tree that implements the map. The tree is shown -- in a compressed, hanging format. showTree :: Show a => IntMap a -> String From git at git.haskell.org Mon Apr 17 21:46:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:46:15 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Data.Map.Internal: Fix CPP usage (0491f23) Message-ID: <20170417214615.6F9C53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/0491f235a7fcf72d85bc7bffef4b4c009c9448ea >--------------------------------------------------------------- commit 0491f235a7fcf72d85bc7bffef4b4c009c9448ea Author: Erik de Castro Lopo Date: Sat Dec 3 10:12:14 2016 +1100 Data.Map.Internal: Fix CPP usage Switch from `#if` to `#ifdef` on conditionally defined values. >--------------------------------------------------------------- 0491f235a7fcf72d85bc7bffef4b4c009c9448ea Data/Map/Internal.hs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Data/Map/Internal.hs b/Data/Map/Internal.hs index ac6bbac..78001db 100644 --- a/Data/Map/Internal.hs +++ b/Data/Map/Internal.hs @@ -13,7 +13,7 @@ #define USE_MAGIC_PROXY 1 #endif -#if USE_MAGIC_PROXY +#ifdef USE_MAGIC_PROXY {-# LANGUAGE MagicHash #-} #endif @@ -382,7 +382,7 @@ import Utils.Containers.Internal.StrictFold import Utils.Containers.Internal.StrictPair import Utils.Containers.Internal.StrictMaybe import Utils.Containers.Internal.BitQueue -#if DEFINE_ALTERF_FALLBACK +#ifdef DEFINE_ALTERF_FALLBACK import Utils.Containers.Internal.BitUtil (wordSize) #endif @@ -391,7 +391,7 @@ import GHC.Exts (build) #if !MIN_VERSION_base(4,8,0) import Data.Functor ((<$)) #endif -#if USE_MAGIC_PROXY +#ifdef USE_MAGIC_PROXY import GHC.Exts (Proxy#, proxy# ) #endif #if __GLASGOW_HASKELL__ >= 708 @@ -1196,7 +1196,7 @@ alterF f k m = atKeyImpl Lazy k f m atKeyImpl :: (Functor f, Ord k) => AreWeStrict -> k -> (Maybe a -> f (Maybe a)) -> Map k a -> f (Map k a) -#if DEFINE_ALTERF_FALLBACK +#ifdef DEFINE_ALTERF_FALLBACK atKeyImpl strict !k f m -- It doesn't seem sensible to worry about overflowing the queue -- if the word size is 61 or more. If I calculate it correctly, @@ -1219,7 +1219,7 @@ atKeyImpl strict !k f m = case lookupTrace k m of {-# INLINE atKeyImpl #-} -#if DEFINE_ALTERF_FALLBACK +#ifdef DEFINE_ALTERF_FALLBACK alterFCutoff :: Int #if WORD_SIZE_IN_BITS == 32 alterFCutoff = 55744454 @@ -1286,7 +1286,7 @@ insertAlong q kx x (Bin sz ky y l r) = -- proxy that's ultimately erased. deleteAlong :: any -> BitQueue -> Map k a -> Map k a deleteAlong old !q0 !m = go (bogus old) q0 m where -#if USE_MAGIC_PROXY +#ifdef USE_MAGIC_PROXY go :: Proxy# () -> BitQueue -> Map k a -> Map k a #else go :: any -> BitQueue -> Map k a -> Map k a @@ -1298,7 +1298,7 @@ deleteAlong old !q0 !m = go (bogus old) q0 m where Just (True, tl) -> balanceL ky y l (go foom tl r) Nothing -> glue l r -#if USE_MAGIC_PROXY +#ifdef USE_MAGIC_PROXY {-# NOINLINE bogus #-} bogus :: a -> Proxy# () bogus _ = proxy# @@ -1359,7 +1359,7 @@ atKeyPlain strict k0 f0 t = case go k0 f0 t of data Altered k a = AltSmaller !(Map k a) | AltBigger !(Map k a) | AltAdj !(Map k a) | AltSame #endif -#if DEFINE_ALTERF_FALLBACK +#ifdef DEFINE_ALTERF_FALLBACK -- When the map is too large to use a bit queue, we fall back to -- this much slower version which uses a more "natural" implementation -- improved with Yoneda to avoid repeated fmaps. This works okayish for From git at git.haskell.org Mon Apr 17 21:46:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:46:17 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Merge pull request #358 from wrengr/IntMapGeneralMerge (8b21238) Message-ID: <20170417214617.794E93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/8b21238136403506c1c3ed1f6bdbb319ad5c3f80 >--------------------------------------------------------------- commit 8b21238136403506c1c3ed1f6bdbb319ad5c3f80 Merge: 1e6bb29 86a50ab Author: wren romano Date: Sun Dec 11 14:02:45 2016 -0800 Merge pull request #358 from wrengr/IntMapGeneralMerge IntMap general merge >--------------------------------------------------------------- 8b21238136403506c1c3ed1f6bdbb319ad5c3f80 Data/IntMap/Internal.hs | 1152 ++++++++++++++++++++++++++++++++++++++--------- Data/Map/Internal.hs | 28 +- 2 files changed, 965 insertions(+), 215 deletions(-) From git at git.haskell.org Mon Apr 17 21:46:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:46:19 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Data.IntMap.Internal: actually exporting mergeA etc (f6ceb8c) Message-ID: <20170417214619.8586C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/f6ceb8ce04e08bbdc3bb7a023879a589ae01a7e5 >--------------------------------------------------------------- commit f6ceb8ce04e08bbdc3bb7a023879a589ae01a7e5 Author: wren romano Date: Sun Dec 11 14:17:55 2016 -0800 Data.IntMap.Internal: actually exporting mergeA etc >--------------------------------------------------------------- f6ceb8ce04e08bbdc3bb7a023879a589ae01a7e5 Data/IntMap/Internal.hs | 36 +++++++++++++++++++++++++++++++++++- Data/Map/Internal.hs | 0 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/Data/IntMap/Internal.hs b/Data/IntMap/Internal.hs index ba8efb6..e909338 100644 --- a/Data/IntMap/Internal.hs +++ b/Data/IntMap/Internal.hs @@ -125,7 +125,41 @@ module Data.IntMap.Internal ( , intersectionWith , intersectionWithKey - -- ** Universal combining function + -- ** General combining function + , SimpleWhenMissing + , SimpleWhenMatched + , runWhenMatched + , runWhenMissing + , merge + -- *** @WhenMatched@ tactics + , zipWithMaybeMatched + , zipWithMatched + -- *** @WhenMissing@ tactics + , mapMaybeMissing + , dropMissing + , preserveMissing + , mapMissing + , filterMissing + + -- ** Applicative general combining function + , WhenMissing (..) + , WhenMatched (..) + , mergeA + -- *** @WhenMatched@ tactics + -- | The tactics described for 'merge' work for + -- 'mergeA' as well. Furthermore, the following + -- are available. + , zipWithMaybeAMatched + , zipWithAMatched + -- *** @WhenMissing@ tactics + -- | The tactics described for 'merge' work for + -- 'mergeA' as well. Furthermore, the following + -- are available. + , traverseMaybeMissing + , traverseMissing + , filterAMissing + + -- ** Deprecated general combining function , mergeWithKey , mergeWithKey' From git at git.haskell.org Mon Apr 17 21:46:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:46:21 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Merge branch 'master' into IntMapGeneralMerge (4ebbf29) Message-ID: <20170417214621.8CE783A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/4ebbf29ba195010a692e74ab00f467cd5610465a >--------------------------------------------------------------- commit 4ebbf29ba195010a692e74ab00f467cd5610465a Merge: f6ceb8c 8b21238 Author: wren romano Date: Sun Dec 11 14:19:44 2016 -0800 Merge branch 'master' into IntMapGeneralMerge >--------------------------------------------------------------- 4ebbf29ba195010a692e74ab00f467cd5610465a From git at git.haskell.org Mon Apr 17 21:46:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:46:23 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Merge pull request #362 from wrengr/IntMapGeneralMerge (342423d) Message-ID: <20170417214623.976783A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/342423dd60f42b448e2c10027e3e0478135f697a >--------------------------------------------------------------- commit 342423dd60f42b448e2c10027e3e0478135f697a Merge: 8b21238 4ebbf29 Author: wren romano Date: Sun Dec 11 14:21:34 2016 -0800 Merge pull request #362 from wrengr/IntMapGeneralMerge Int map general merge >--------------------------------------------------------------- 342423dd60f42b448e2c10027e3e0478135f697a Data/IntMap/Internal.hs | 36 +++++++++++++++++++++++++++++++++++- Data/Map/Internal.hs | 0 2 files changed, 35 insertions(+), 1 deletion(-) From git at git.haskell.org Mon Apr 17 21:46:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:46:25 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Add lifted instances for Data.Sequence (c25272e) Message-ID: <20170417214625.A0E743A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/c25272e0c58bfa2b6deaa90cb24c4ab4565ad901 >--------------------------------------------------------------- commit c25272e0c58bfa2b6deaa90cb24c4ab4565ad901 Author: David Feuer Date: Tue Dec 13 12:50:57 2016 -0500 Add lifted instances for Data.Sequence Add instances of `Eq1`, `Ord1`, `Show1`, and `Read1` for `Data.Sequence`. >--------------------------------------------------------------- c25272e0c58bfa2b6deaa90cb24c4ab4565ad901 Data/Sequence/Internal.hs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Data/Sequence/Internal.hs b/Data/Sequence/Internal.hs index 9cacb39..d2bfa04 100644 --- a/Data/Sequence/Internal.hs +++ b/Data/Sequence/Internal.hs @@ -213,6 +213,7 @@ import Data.Foldable (Foldable(foldl, foldl1, foldr, foldr1, foldMap), foldl', t #if MIN_VERSION_base(4,9,0) import qualified Data.Semigroup as Semigroup +import Data.Functor.Classes #endif import Data.Traversable import Data.Typeable @@ -703,6 +704,18 @@ instance Show a => Show (Seq a) where showString "fromList " . shows (toList xs) #endif +#if MIN_VERSION_base(4,9,0) +instance Show1 Seq where + liftShowsPrec _shwsPrc shwList p xs = showParen (p > 10) $ + showString "fromList " . shwList (toList xs) + +instance Eq1 Seq where + liftEq eq xs ys = length xs == length ys && liftEq eq (toList xs) (toList ys) + +instance Ord1 Seq where + liftCompare cmp xs ys = liftCompare cmp (toList xs) (toList ys) +#endif + instance Read a => Read (Seq a) where #ifdef __GLASGOW_HASKELL__ readPrec = parens $ prec 10 $ do @@ -718,6 +731,14 @@ instance Read a => Read (Seq a) where return (fromList xs,t) #endif +#if MIN_VERSION_base(4,9,0) +instance Read1 Seq where + liftReadsPrec _rp readLst p = readParen (p > 10) $ \r -> do + ("fromList",s) <- lex r + (xs,t) <- readLst s + pure (fromList xs, t) +#endif + instance Monoid (Seq a) where mempty = empty mappend = (><) From git at git.haskell.org Mon Apr 17 21:46:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:46:27 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Merge pull request #364 from treeowl/lift-sequence (e4fc597) Message-ID: <20170417214627.A9E0A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/e4fc597abbc57dae0c1d4f09d562c0beeedb6bde >--------------------------------------------------------------- commit e4fc597abbc57dae0c1d4f09d562c0beeedb6bde Merge: 342423d c25272e Author: David Feuer Date: Tue Dec 13 20:03:02 2016 -0500 Merge pull request #364 from treeowl/lift-sequence Add lifted instances for Data.Sequence >--------------------------------------------------------------- e4fc597abbc57dae0c1d4f09d562c0beeedb6bde Data/Sequence/Internal.hs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) From git at git.haskell.org Mon Apr 17 21:46:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:46:29 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Add instances for Data.Set (0063b9a) Message-ID: <20170417214629.B27C43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/0063b9aa8b371f0eb00c9357bdd55b7ceb0a0a4c >--------------------------------------------------------------- commit 0063b9aa8b371f0eb00c9357bdd55b7ceb0a0a4c Author: Oleg Grenrus Date: Tue Dec 13 20:43:15 2016 -0500 Add instances for Data.Set Add `Eq1`, `Ord1`, and `Show1` instances for `Data.Set`. >--------------------------------------------------------------- 0063b9aa8b371f0eb00c9357bdd55b7ceb0a0a4c Data/Set/Internal.hs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Data/Set/Internal.hs b/Data/Set/Internal.hs index fa00711..e3eea79 100644 --- a/Data/Set/Internal.hs +++ b/Data/Set/Internal.hs @@ -229,6 +229,7 @@ import Data.Monoid (Monoid(..)) #endif #if MIN_VERSION_base(4,9,0) import Data.Semigroup (Semigroup((<>), stimes), stimesIdempotentMonoid) +import Data.Functor.Classes #endif import qualified Data.Foldable as Foldable import Data.Typeable @@ -1061,6 +1062,20 @@ instance Show a => Show (Set a) where showsPrec p xs = showParen (p > 10) $ showString "fromList " . shows (toList xs) +#if MIN_VERSION_base(4,9,0) +instance Eq1 Set where + liftEq eq m n = + size m == size n && liftEq eq (toList m) (toList n) + +instance Ord1 Set where + liftCompare cmp m n = + liftCompare cmp (toList m) (toList n) + +instance Show1 Set where + liftShowsPrec sp sl d m = + showsUnaryWith (liftShowsPrec sp sl) "fromList" d (toList m) +#endif + {-------------------------------------------------------------------- Read --------------------------------------------------------------------} From git at git.haskell.org Mon Apr 17 21:46:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:46:31 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Merge pull request #365 from treeowl/lift-set (8005bbe) Message-ID: <20170417214631.BB7113A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/8005bbefaeb9aaf1d26819ad935fb35b21e4cab1 >--------------------------------------------------------------- commit 8005bbefaeb9aaf1d26819ad935fb35b21e4cab1 Merge: e4fc597 0063b9a Author: David Feuer Date: Wed Dec 14 13:30:02 2016 -0500 Merge pull request #365 from treeowl/lift-set Add instances for Data.Set >--------------------------------------------------------------- 8005bbefaeb9aaf1d26819ad935fb35b21e4cab1 Data/Set/Internal.hs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) From git at git.haskell.org Mon Apr 17 21:46:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:46:33 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Add lifted instances for Data.Tree (949f55e) Message-ID: <20170417214633.C42933A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/949f55ecdde35ee6aef1aa4069876f39823cac06 >--------------------------------------------------------------- commit 949f55ecdde35ee6aef1aa4069876f39823cac06 Author: David Feuer Date: Wed Dec 14 20:52:08 2016 -0500 Add lifted instances for Data.Tree Add `Eq1`, `Show1`, `Eq1`, and `Ord1` instances for `Data.Tree`. >--------------------------------------------------------------- 949f55ecdde35ee6aef1aa4069876f39823cac06 Data/Tree.hs | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/Data/Tree.hs b/Data/Tree.hs index d6d2726..89dd42b 100644 --- a/Data/Tree.hs +++ b/Data/Tree.hs @@ -65,6 +65,11 @@ import GHC.Generics (Generic) import Data.Coerce #endif +#if MIN_VERSION_base(4,9,0) +import Data.Functor.Classes +import Data.Semigroup (Semigroup (..)) +#endif + -- | Multi-way trees, also known as /rose trees/. data Tree a = Node { rootLabel :: a, -- ^ label value @@ -83,6 +88,39 @@ data Tree a = Node { #endif type Forest a = [Tree a] +#if MIN_VERSION_base(4,9,0) +instance Eq1 Tree where + liftEq eq = leq + where + leq (Node a fr) (Node a' fr') = eq a a' && liftEq leq fr fr' + +instance Ord1 Tree where + liftCompare cmp = lcomp + where + lcomp (Node a fr) (Node a' fr') = cmp a a' <> liftCompare lcomp fr fr' + +instance Show1 Tree where + liftShowsPrec shw shwl _p (Node a fr) = + showString "Node {rootLabel = " . shw 0 a . showString ", " . + showString "subForest = " . liftShowList shw shwl fr . + showString "}" + +instance Read1 Tree where + liftReadsPrec rd rdl _p = readParen False $ + \s -> do + ("Node", s1) <- lex s + ("{", s2) <- lex s1 + ("rootLabel", s3) <- lex s2 + ("=", s4) <- lex s3 + (a, s5) <- rd 0 s4 + (",", s6) <- lex s5 + ("subForest", s7) <- lex s6 + ("=", s8) <- lex s7 + (fr, s9) <- liftReadList rd rdl s8 + ("}", s10) <- lex s9 + pure (Node a fr, s10) +#endif + INSTANCE_TYPEABLE1(Tree) instance Functor Tree where From git at git.haskell.org Mon Apr 17 21:46:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:46:35 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Merge pull request #366 from treeowl/lift-tree (9f1e21c) Message-ID: <20170417214635.CD9333A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/9f1e21cd0cd8181cd76df5e3660084ab5892ba08 >--------------------------------------------------------------- commit 9f1e21cd0cd8181cd76df5e3660084ab5892ba08 Merge: 8005bbe 949f55e Author: David Feuer Date: Wed Dec 14 21:05:38 2016 -0500 Merge pull request #366 from treeowl/lift-tree Add lifted instances for Data.Tree >--------------------------------------------------------------- 9f1e21cd0cd8181cd76df5e3660084ab5892ba08 Data/Tree.hs | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) From git at git.haskell.org Mon Apr 17 21:46:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:46:37 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Add lifted instances for Data.Map (fa1d670) Message-ID: <20170417214637.D6F5C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/fa1d67005d7011d8daf70047896cf5c34a7ebf42 >--------------------------------------------------------------- commit fa1d67005d7011d8daf70047896cf5c34a7ebf42 Author: Oleg Grenrus Date: Wed Dec 14 21:51:28 2016 -0500 Add lifted instances for Data.Map >--------------------------------------------------------------- fa1d67005d7011d8daf70047896cf5c34a7ebf42 Data/Map/Internal.hs | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/Data/Map/Internal.hs b/Data/Map/Internal.hs index 3433444..1a1f231 100644 --- a/Data/Map/Internal.hs +++ b/Data/Map/Internal.hs @@ -366,6 +366,7 @@ import Data.Monoid (Monoid(..)) import Data.Traversable (Traversable(traverse)) #endif #if MIN_VERSION_base(4,9,0) +import Data.Functor.Classes import Data.Semigroup (Semigroup((<>), stimes), stimesIdempotentMonoid) #endif import Control.Applicative (Const (..)) @@ -3944,6 +3945,43 @@ instance (Eq k,Eq a) => Eq (Map k a) where instance (Ord k, Ord v) => Ord (Map k v) where compare m1 m2 = compare (toAscList m1) (toAscList m2) +#if MIN_VERSION_base(4,9,0) +{-------------------------------------------------------------------- + Lifted instances +--------------------------------------------------------------------} + +instance Eq2 Map where + liftEq2 eqk eqv m n = + size m == size n && liftEq (liftEq2 eqk eqv) (toList m) (toList n) + +instance Eq k => Eq1 (Map k) where + liftEq = liftEq2 (==) + +instance Ord2 Map where + liftCompare2 cmpk cmpv m n = + liftCompare (liftCompare2 cmpk cmpv) (toList m) (toList n) + +instance Ord k => Ord1 (Map k) where + liftCompare = liftCompare2 compare + +instance Show2 Map where + liftShowsPrec2 spk slk spv slv d m = + showsUnaryWith (liftShowsPrec sp sl) "fromList" d (toList m) + where + sp = liftShowsPrec2 spk slk spv slv + sl = liftShowList2 spk slk spv slv + +instance Show k => Show1 (Map k) where + liftShowsPrec = liftShowsPrec2 showsPrec showList + +instance (Ord k, Read k) => Read1 (Map k) where + liftReadsPrec rp rl = readsData $ + readsUnaryWith (liftReadsPrec rp' rl') "fromList" fromList + where + rp' = liftReadsPrec rp rl + rl' = liftReadList rp rl +#endif + {-------------------------------------------------------------------- Functor --------------------------------------------------------------------} From git at git.haskell.org Mon Apr 17 21:46:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:46:39 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Merge pull request #367 from treeowl/lift-map (b786c3d) Message-ID: <20170417214639.E6D5E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/b786c3dc15686a4ea1fd4a271451c648faadf95b >--------------------------------------------------------------- commit b786c3dc15686a4ea1fd4a271451c648faadf95b Merge: 9f1e21c fa1d670 Author: David Feuer Date: Wed Dec 14 22:23:45 2016 -0500 Merge pull request #367 from treeowl/lift-map Add lifted instances for Data.Map >--------------------------------------------------------------- b786c3dc15686a4ea1fd4a271451c648faadf95b Data/Map/Internal.hs | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) From git at git.haskell.org Mon Apr 17 21:46:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:46:41 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Update changelog (28668bb) Message-ID: <20170417214641.EF08D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/28668bbfdd2a1f339a7e49470d4f47f08d80225c >--------------------------------------------------------------- commit 28668bbfdd2a1f339a7e49470d4f47f08d80225c Author: David Feuer Date: Wed Dec 14 23:52:10 2016 -0500 Update changelog >--------------------------------------------------------------- 28668bbfdd2a1f339a7e49470d4f47f08d80225c changelog.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/changelog.md b/changelog.md index f040035..fdbc6fb 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,15 @@ * Planned for GHC 8.2. +* Add `merge` and `mergeA` for `Data.IntMap`. + +* Add instances for `Data.Graph.SCC`: `Foldable`, `Traversable`, `Data`, + `Generic`, `Generic1`, `Eq`, `Eq1`, `Show`, `Show1`, `Read`, and `Read1`. + +* Add lifted instances (from `Data.Functor.Classes`) for `Data.Sequence`, + `Data.Map`, `Data.Set`, `Data.IntMap`, and `Data.Tree`. (Thanks to + Oleg Grenrus for doing a lot of this work.) + * Properly deprecate functions in `Data.IntMap` long documented as deprecated. * Rename several internal modules for clarity. Thanks to esoeylemez for starting From git at git.haskell.org Mon Apr 17 21:46:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:46:44 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Add lifted instances for Data.IntMap (59dbb62) Message-ID: <20170417214644.043983A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/59dbb629498fce1f2a079636a341a3613ffe87f0 >--------------------------------------------------------------- commit 59dbb629498fce1f2a079636a341a3613ffe87f0 Author: Oleg Grenrus Date: Wed Dec 14 22:44:59 2016 -0500 Add lifted instances for Data.IntMap Add `Eq1`, `Ord1`, `Show1`, and `Read1` instances for `Data.IntMap`. The `Eq1` instance was written by David Feuer; the rest were written by Oleg Grenrus. >--------------------------------------------------------------- 59dbb629498fce1f2a079636a341a3613ffe87f0 Data/IntMap/Internal.hs | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/Data/IntMap/Internal.hs b/Data/IntMap/Internal.hs index e909338..bca468f 100644 --- a/Data/IntMap/Internal.hs +++ b/Data/IntMap/Internal.hs @@ -280,6 +280,7 @@ import Data.Word (Word) #endif #if MIN_VERSION_base(4,9,0) import Data.Semigroup (Semigroup((<>), stimes), stimesIdempotentMonoid) +import Data.Functor.Classes #endif import Control.DeepSeq (NFData(rnf)) @@ -2964,6 +2965,16 @@ nequal (Tip kx x) (Tip ky y) nequal Nil Nil = False nequal _ _ = True +#if MIN_VERSION_base(4,9,0) +instance Eq1 IntMap where + liftEq eq (Bin p1 m1 l1 r1) (Bin p2 m2 l2 r2) + = (m1 == m2) && (p1 == p2) && (liftEq eq l1 l2) && (liftEq eq r1 r2) + liftEq eq (Tip kx x) (Tip ky y) + = (kx == ky) && (eq x y) + liftEq _eq Nil Nil = True + liftEq _eq _ _ = False +#endif + {-------------------------------------------------------------------- Ord --------------------------------------------------------------------} @@ -2971,6 +2982,12 @@ nequal _ _ = True instance Ord a => Ord (IntMap a) where compare m1 m2 = compare (toList m1) (toList m2) +#if MIN_VERSION_base(4,9,0) +instance Ord1 IntMap where + liftCompare cmp m n = + liftCompare (liftCompare cmp) (toList m) (toList n) +#endif + {-------------------------------------------------------------------- Functor --------------------------------------------------------------------} @@ -2992,6 +3009,15 @@ instance Show a => Show (IntMap a) where showsPrec d m = showParen (d > 10) $ showString "fromList " . shows (toList m) +#if MIN_VERSION_base(4,9,0) +instance Show1 IntMap where + liftShowsPrec sp sl d m = + showsUnaryWith (liftShowsPrec sp' sl') "fromList" d (toList m) + where + sp' = liftShowsPrec sp sl + sl' = liftShowList sp sl +#endif + {-------------------------------------------------------------------- Read --------------------------------------------------------------------} @@ -3010,6 +3036,15 @@ instance (Read e) => Read (IntMap e) where return (fromList xs,t) #endif +#if MIN_VERSION_base(4,9,0) +instance Read1 IntMap where + liftReadsPrec rp rl = readsData $ + readsUnaryWith (liftReadsPrec rp' rl') "fromList" fromList + where + rp' = liftReadsPrec rp rl + rl' = liftReadList rp rl +#endif + {-------------------------------------------------------------------- Typeable --------------------------------------------------------------------} From git at git.haskell.org Mon Apr 17 21:46:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:46:46 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Merge pull request #368 from treeowl/lift-intmap (e711dbc) Message-ID: <20170417214646.0D4CF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/e711dbcd9e1d3e53548ebab458182b778d4ea6c0 >--------------------------------------------------------------- commit e711dbcd9e1d3e53548ebab458182b778d4ea6c0 Merge: b786c3d 59dbb62 Author: David Feuer Date: Thu Dec 15 00:06:56 2016 -0500 Merge pull request #368 from treeowl/lift-intmap Add lifted instances for Data.IntMap >--------------------------------------------------------------- e711dbcd9e1d3e53548ebab458182b778d4ea6c0 Data/IntMap/Internal.hs | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) From git at git.haskell.org Mon Apr 17 21:46:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:46:48 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Add instances for Data.Graph.SCC (61ee51e) Message-ID: <20170417214648.158A13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/61ee51e66f39fdeb7be8c487fbd77436c3c51c37 >--------------------------------------------------------------- commit 61ee51e66f39fdeb7be8c487fbd77436c3c51c37 Author: David Feuer Date: Wed Dec 14 23:33:34 2016 -0500 Add instances for Data.Graph.SCC Add `Generic`, `Generic2`, `Data`, `Eq`, `Show`, `Read`, `Foldable`, `Traversable`, `Eq1`, `Show1`, `Read1`, and `Typeable` instances for `Data.Graph.SCC`. Fixes #51 >--------------------------------------------------------------- 61ee51e66f39fdeb7be8c487fbd77436c3c51c37 Data/Graph.hs | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/Data/Graph.hs b/Data/Graph.hs index 71d82c8..f3cfc4a 100644 --- a/Data/Graph.hs +++ b/Data/Graph.hs @@ -1,10 +1,16 @@ {-# LANGUAGE CPP #-} #if __GLASGOW_HASKELL__ {-# LANGUAGE Rank2Types #-} +{-# LANGUAGE DeriveDataTypeable #-} +{-# LANGUAGE StandaloneDeriving #-} #endif #if __GLASGOW_HASKELL__ >= 703 {-# LANGUAGE Trustworthy #-} #endif +#if __GLASGOW_HASKELL__ >= 702 +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE StandaloneDeriving #-} +#endif #include "containers.h" @@ -77,11 +83,29 @@ import Data.Tree (Tree(Node), Forest) -- std interfaces #if !MIN_VERSION_base(4,8,0) import Control.Applicative +import qualified Data.Foldable as F +import Data.Traversable +#else +import Data.Foldable as F #endif import Control.DeepSeq (NFData(rnf)) import Data.Maybe import Data.Array import Data.List +#if MIN_VERSION_base(4,9,0) +import Data.Functor.Classes +import Data.Semigroup (Semigroup (..)) +#endif +#if __GLASGOW_HASKELL__ >= 706 +import GHC.Generics (Generic, Generic1) +#elif __GLASGOW_HASKELL__ >= 702 +import GHC.Generics (Generic) +#endif +#ifdef __GLASGOW_HASKELL__ +import Data.Data (Data) +#endif +import Data.Typeable + ------------------------------------------------------------------------- -- - @@ -94,6 +118,47 @@ data SCC vertex = AcyclicSCC vertex -- ^ A single vertex that is not -- in any cycle. | CyclicSCC [vertex] -- ^ A maximal set of mutually -- reachable vertices. + deriving (Eq, Show, Read) + +INSTANCE_TYPEABLE1(SCC) + +#ifdef __GLASGOW_HASKELL__ +deriving instance Data vertex => Data (SCC vertex) +#endif + +#if __GLASGOW_HASKELL__ >= 706 +deriving instance Generic1 SCC +#endif + +#if __GLASGOW_HASKELL__ >= 702 +deriving instance Generic (SCC vertex) +#endif + +#if MIN_VERSION_base(4,9,0) +instance Eq1 SCC where + liftEq eq (AcyclicSCC v1) (AcyclicSCC v2) = eq v1 v2 + liftEq eq (CyclicSCC vs1) (CyclicSCC vs2) = liftEq eq vs1 vs2 + liftEq _ _ _ = False +instance Show1 SCC where + liftShowsPrec sp _sl d (AcyclicSCC v) = showsUnaryWith sp "AcyclicSCC" d v + liftShowsPrec _sp sl d (CyclicSCC vs) = showsUnaryWith (const sl) "CyclicSCC" d vs +instance Read1 SCC where + liftReadsPrec rp rl = readsData $ + readsUnaryWith rp "AcyclicSCC" AcyclicSCC <> + readsUnaryWith (const rl) "CyclicSCC" CyclicSCC +#endif + +instance F.Foldable SCC where + foldr c n (AcyclicSCC v) = c v n + foldr c n (CyclicSCC vs) = foldr c n vs + +instance Traversable SCC where + -- We treat the non-empty cyclic case specially to cut one + -- fmap application. + traverse f (AcyclicSCC vertex) = AcyclicSCC <$> f vertex + traverse _f (CyclicSCC []) = pure (CyclicSCC []) + traverse f (CyclicSCC (x : xs)) = + (\x' xs' -> CyclicSCC (x' : xs')) <$> f x <*> traverse f xs instance NFData a => NFData (SCC a) where rnf (AcyclicSCC v) = rnf v From git at git.haskell.org Mon Apr 17 21:46:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:46:50 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Merge pull request #369 from treeowl/scc-instances (f42cb61) Message-ID: <20170417214650.1E4BE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/f42cb61c1a3d24095dfa237492ec0bef672604cc >--------------------------------------------------------------- commit f42cb61c1a3d24095dfa237492ec0bef672604cc Merge: e711dbc 61ee51e Author: David Feuer Date: Thu Dec 15 00:22:34 2016 -0500 Merge pull request #369 from treeowl/scc-instances Add instances for Data.Graph.SCC >--------------------------------------------------------------- f42cb61c1a3d24095dfa237492ec0bef672604cc Data/Graph.hs | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) From git at git.haskell.org Mon Apr 17 21:46:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:46:52 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Merge pull request #370 from treeowl/update-changelog-morestuff (5a63b21) Message-ID: <20170417214652.274053A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/5a63b215a656e72ff4aa2b7642f60c0fcbdb456a >--------------------------------------------------------------- commit 5a63b215a656e72ff4aa2b7642f60c0fcbdb456a Merge: f42cb61 28668bb Author: David Feuer Date: Thu Dec 15 00:22:50 2016 -0500 Merge pull request #370 from treeowl/update-changelog-morestuff Update changelog >--------------------------------------------------------------- 5a63b215a656e72ff4aa2b7642f60c0fcbdb456a changelog.md | 9 +++++++++ 1 file changed, 9 insertions(+) From git at git.haskell.org Mon Apr 17 21:46:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:46:54 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Bump version to 0.5.9.1 (4dab9e9) Message-ID: <20170417214654.302563A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/4dab9e96d167e6ec359be8a370d972108fa7a2ce >--------------------------------------------------------------- commit 4dab9e96d167e6ec359be8a370d972108fa7a2ce Author: David Feuer Date: Thu Dec 15 00:25:21 2016 -0500 Bump version to 0.5.9.1 >--------------------------------------------------------------- 4dab9e96d167e6ec359be8a370d972108fa7a2ce containers.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/containers.cabal b/containers.cabal index 6671ebf..85ede60 100644 --- a/containers.cabal +++ b/containers.cabal @@ -1,5 +1,5 @@ name: containers -version: 0.5.8.1 +version: 0.5.9.1 license: BSD3 license-file: LICENSE maintainer: libraries at haskell.org From git at git.haskell.org Mon Apr 17 21:46:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:46:56 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Merge pull request #360 from erikd/master (30b0fe7) Message-ID: <20170417214656.3CCFB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/30b0fe71f52657ff360b577521dbd67a2051c37f >--------------------------------------------------------------- commit 30b0fe71f52657ff360b577521dbd67a2051c37f Merge: 4dab9e9 0491f23 Author: David Feuer Date: Thu Dec 15 00:33:08 2016 -0500 Merge pull request #360 from erikd/master Data.Map.Internal: Fix CPP usage >--------------------------------------------------------------- 30b0fe71f52657ff360b577521dbd67a2051c37f Data/Map/Internal.hs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) From git at git.haskell.org Mon Apr 17 21:46:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:46:58 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Added Data.IntMap.Merge.{Lazy, Strict} modules. (6d86a74) Message-ID: <20170417214658.48CD23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/6d86a74b3553f2241f3d75e03474f4cf1a55c602 >--------------------------------------------------------------- commit 6d86a74b3553f2241f3d75e03474f4cf1a55c602 Author: wren romano Date: Sun Dec 18 21:12:43 2016 -0800 Added Data.IntMap.Merge.{Lazy,Strict} modules. >--------------------------------------------------------------- 6d86a74b3553f2241f3d75e03474f4cf1a55c602 Data/IntMap/Internal.hs | 10 ++++++++++ Data/{Map => IntMap}/Merge/Lazy.hs | 10 +++++----- Data/{Map => IntMap}/Merge/Strict.hs | 10 +++++----- Data/Map/Merge/Lazy.hs | 2 +- Data/Map/Merge/Strict.hs | 2 +- containers.cabal | 2 ++ 6 files changed, 24 insertions(+), 12 deletions(-) diff --git a/Data/IntMap/Internal.hs b/Data/IntMap/Internal.hs index e909338..6077986 100644 --- a/Data/IntMap/Internal.hs +++ b/Data/IntMap/Internal.hs @@ -18,6 +18,7 @@ -- Module : Data.IntMap.Internal -- Copyright : (c) Daan Leijen 2002 -- (c) Andriy Palamarchuk 2008 +-- (c) wren romano 2016 -- License : BSD-style -- Maintainer : libraries at haskell.org -- Stability : provisional @@ -268,6 +269,15 @@ module Data.IntMap.Internal ( , shorter , branchMask , highestBitMask + + -- * Used by "IntMap.Merge.Lazy" and "IntMap.Merge.Strict" + , mapWhenMissing + , mapWhenMatched + , lmapWhenMissing + , contramapFirstWhenMatched + , contramapSecondWhenMatched + , mapGentlyWhenMissing + , mapGentlyWhenMatched ) where #if MIN_VERSION_base(4,8,0) diff --git a/Data/Map/Merge/Lazy.hs b/Data/IntMap/Merge/Lazy.hs similarity index 92% copy from Data/Map/Merge/Lazy.hs copy to Data/IntMap/Merge/Lazy.hs index ae4f139..869c9fa 100644 --- a/Data/Map/Merge/Lazy.hs +++ b/Data/IntMap/Merge/Lazy.hs @@ -20,8 +20,8 @@ ----------------------------------------------------------------------------- -- | --- Module : Data.Map.Merge.Lazy --- Copyright : (c) David Feuer 2016 +-- Module : Data.IntMap.Merge.Lazy +-- Copyright : (c) wren romano 2016 -- License : BSD-style -- Maintainer : libraries at haskell.org -- Stability : provisional @@ -29,7 +29,7 @@ -- -- This module defines an API for writing functions that merge two -- maps. The key functions are 'merge' and 'mergeA'. --- Each of these can be used with several different "merge tactics". +-- Each of these can be used with several different \"merge tactics\". -- -- The 'merge' and 'mergeA' functions are shared by -- the lazy and strict modules. Only the choice of merge tactics @@ -45,7 +45,7 @@ -- inefficient in many cases and should usually be avoided. The instances -- for 'WhenMatched' tactics should not pose any major efficiency problems. -module Data.Map.Merge.Lazy ( +module Data.IntMap.Merge.Lazy ( -- ** Simple merge tactic types SimpleWhenMissing , SimpleWhenMatched @@ -100,4 +100,4 @@ module Data.Map.Merge.Lazy ( , runWhenMissing ) where -import Data.Map.Internal +import Data.IntMap.Internal diff --git a/Data/Map/Merge/Strict.hs b/Data/IntMap/Merge/Strict.hs similarity index 92% copy from Data/Map/Merge/Strict.hs copy to Data/IntMap/Merge/Strict.hs index 6fcfaf8..7a82557 100644 --- a/Data/Map/Merge/Strict.hs +++ b/Data/IntMap/Merge/Strict.hs @@ -20,8 +20,8 @@ ----------------------------------------------------------------------------- -- | --- Module : Data.Map.Merge.Strict --- Copyright : (c) David Feuer 2016 +-- Module : Data.IntMap.Merge.Strict +-- Copyright : (c) wren romano 2016 -- License : BSD-style -- Maintainer : libraries at haskell.org -- Stability : provisional @@ -29,7 +29,7 @@ -- -- This module defines an API for writing functions that merge two -- maps. The key functions are 'merge' and 'mergeA'. --- Each of these can be used with several different "merge tactics". +-- Each of these can be used with several different \"merge tactics\". -- -- The 'merge' and 'mergeA' functions are shared by -- the lazy and strict modules. Only the choice of merge tactics @@ -45,7 +45,7 @@ -- inefficient in many cases and should usually be avoided. The instances -- for 'WhenMatched' tactics should not pose any major efficiency problems. -module Data.Map.Merge.Strict ( +module Data.IntMap.Merge.Strict ( -- ** Simple merge tactic types SimpleWhenMissing , SimpleWhenMatched @@ -96,4 +96,4 @@ module Data.Map.Merge.Strict ( , runWhenMissing ) where -import Data.Map.Strict.Internal +import Data.IntMap.Internal diff --git a/Data/Map/Merge/Lazy.hs b/Data/Map/Merge/Lazy.hs index ae4f139..466f150 100644 --- a/Data/Map/Merge/Lazy.hs +++ b/Data/Map/Merge/Lazy.hs @@ -29,7 +29,7 @@ -- -- This module defines an API for writing functions that merge two -- maps. The key functions are 'merge' and 'mergeA'. --- Each of these can be used with several different "merge tactics". +-- Each of these can be used with several different \"merge tactics\". -- -- The 'merge' and 'mergeA' functions are shared by -- the lazy and strict modules. Only the choice of merge tactics diff --git a/Data/Map/Merge/Strict.hs b/Data/Map/Merge/Strict.hs index 6fcfaf8..f068c84 100644 --- a/Data/Map/Merge/Strict.hs +++ b/Data/Map/Merge/Strict.hs @@ -29,7 +29,7 @@ -- -- This module defines an API for writing functions that merge two -- maps. The key functions are 'merge' and 'mergeA'. --- Each of these can be used with several different "merge tactics". +-- Each of these can be used with several different \"merge tactics\". -- -- The 'merge' and 'mergeA' functions are shared by -- the lazy and strict modules. Only the choice of merge tactics diff --git a/containers.cabal b/containers.cabal index 6671ebf..ded0854 100644 --- a/containers.cabal +++ b/containers.cabal @@ -45,6 +45,8 @@ Library Data.IntMap.Lazy Data.IntMap.Strict Data.IntMap.Internal + Data.IntMap.Merge.Lazy + Data.IntMap.Merge.Strict Data.IntSet.Internal Data.IntSet Data.Map From git at git.haskell.org Mon Apr 17 21:47:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:47:00 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Merge branch 'master' into IntMapGeneralMerge (323f708) Message-ID: <20170417214700.57DEE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/323f708acb461cd38f12febfcdd134396902e346 >--------------------------------------------------------------- commit 323f708acb461cd38f12febfcdd134396902e346 Merge: 6d86a74 30b0fe7 Author: wren romano Date: Mon Dec 19 09:48:38 2016 -0800 Merge branch 'master' into IntMapGeneralMerge >--------------------------------------------------------------- 323f708acb461cd38f12febfcdd134396902e346 Data/Graph.hs | 65 +++++++++++++++++++++++++++++++++++++++++++++++ Data/IntMap/Internal.hs | 35 +++++++++++++++++++++++++ Data/Map/Internal.hs | 54 +++++++++++++++++++++++++++++++++------ Data/Sequence/Internal.hs | 21 +++++++++++++++ Data/Set/Internal.hs | 15 +++++++++++ Data/Tree.hs | 38 +++++++++++++++++++++++++++ changelog.md | 9 +++++++ containers.cabal | 2 +- 8 files changed, 230 insertions(+), 9 deletions(-) From git at git.haskell.org Mon Apr 17 21:47:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:47:02 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, merge-fixes-5.9, revert-408-bugfix_394: Merge pull request #372 from wrengr/IntMapGeneralMerge (71c6474) Message-ID: <20170417214702.632413A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,merge-fixes-5.9,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/71c64747120c3cd1b91f06731167009b0e5b2454 >--------------------------------------------------------------- commit 71c64747120c3cd1b91f06731167009b0e5b2454 Merge: 30b0fe7 323f708 Author: wren romano Date: Mon Dec 19 11:15:55 2016 -0800 Merge pull request #372 from wrengr/IntMapGeneralMerge IntMap general merge >--------------------------------------------------------------- 71c64747120c3cd1b91f06731167009b0e5b2454 Data/IntMap/Internal.hs | 10 ++++++++++ Data/{Map => IntMap}/Merge/Lazy.hs | 10 +++++----- Data/{Map => IntMap}/Merge/Strict.hs | 10 +++++----- Data/Map/Merge/Lazy.hs | 2 +- Data/Map/Merge/Strict.hs | 2 +- containers.cabal | 2 ++ 6 files changed, 24 insertions(+), 12 deletions(-) From git at git.haskell.org Mon Apr 17 21:47:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:47:04 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, revert-408-bugfix_394: Fix typo in error message for minimum (#350) (c027280) Message-ID: <20170417214704.6DB433A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/c027280354d6c13044ec6d8b0f2a5aa6de77867b >--------------------------------------------------------------- commit c027280354d6c13044ec6d8b0f2a5aa6de77867b Author: Charles Cooper Date: Fri Dec 23 18:40:39 2016 -0500 Fix typo in error message for minimum (#350) * Fix typo in error message for minimum * Change the error messages for maximum and minimum This message mirrors the error messages in Data.Foldable, while prefixing the module name to help the user a little bit. * Increase message verbosity >--------------------------------------------------------------- c027280354d6c13044ec6d8b0f2a5aa6de77867b Data/IntMap/Internal.hs | 4 ++-- Data/Map/Internal.hs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Data/IntMap/Internal.hs b/Data/IntMap/Internal.hs index 6c0efd2..0576b1e 100644 --- a/Data/IntMap/Internal.hs +++ b/Data/IntMap/Internal.hs @@ -425,7 +425,7 @@ instance Foldable.Foldable IntMap where go x (Bin _ _ l r) = go x l || go x r {-# INLINABLE elem #-} maximum = start - where start Nil = error "IntMap.Foldable.maximum: called with empty map" + where start Nil = error "Data.Foldable.maximum (for Data.IntMap): empty map" start (Tip _ y) = y start (Bin _ _ l r) = go (start l) r @@ -434,7 +434,7 @@ instance Foldable.Foldable IntMap where go m (Bin _ _ l r) = go (go m l) r {-# INLINABLE maximum #-} minimum = start - where start Nil = error "IntMap.Foldable.minimum: called with empty map" + where start Nil = error "Data.Foldable.minimum (for Data.IntMap): empty map" start (Tip _ y) = y start (Bin _ _ l r) = go (start l) r diff --git a/Data/Map/Internal.hs b/Data/Map/Internal.hs index ca21117..8fc766d 100644 --- a/Data/Map/Internal.hs +++ b/Data/Map/Internal.hs @@ -4030,14 +4030,14 @@ instance Foldable.Foldable (Map k) where go x (Bin _ _ v l r) = x == v || go x l || go x r {-# INLINABLE elem #-} maximum = start - where start Tip = error "Map.Foldable.maximum: called with empty map" + where start Tip = error "Data.Foldable.maximum (for Data.Map): empty map" start (Bin _ _ v l r) = go (go v l) r go !m Tip = m go m (Bin _ _ v l r) = go (go (max m v) l) r {-# INLINABLE maximum #-} minimum = start - where start Tip = error "Map.Foldable.minumum: called with empty map" + where start Tip = error "Data.Foldable.minimum (for Data.Map): empty map" start (Bin _ _ v l r) = go (go v l) r go !m Tip = m From git at git.haskell.org Mon Apr 17 21:47:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:47:06 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, revert-408-bugfix_394: Kill getSingleton (dbed0dd) Message-ID: <20170417214706.76F363A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/dbed0dd3e41cfcf3a38e9ea111a49f0ae8cddc76 >--------------------------------------------------------------- commit dbed0dd3e41cfcf3a38e9ea111a49f0ae8cddc76 Author: David Feuer Date: Thu Dec 29 21:20:09 2016 -0500 Kill getSingleton It's partial, and was used in a silly way for no particularly good reason. We still need a partial function, but we can write it where we use it. >--------------------------------------------------------------- dbed0dd3e41cfcf3a38e9ea111a49f0ae8cddc76 Data/Sequence/Internal.hs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Data/Sequence/Internal.hs b/Data/Sequence/Internal.hs index d2bfa04..5ec5a07 100644 --- a/Data/Sequence/Internal.hs +++ b/Data/Sequence/Internal.hs @@ -4072,10 +4072,6 @@ splitMapNode splt f s (Node3 ns a b c) = Node3 ns (f first a) (f second b) (f th (second, third) = splt (size b) r #endif -getSingleton :: Seq a -> a -getSingleton (Seq (Single (Elem a))) = a -getSingleton _ = error "getSingleton: Not a singleton." - ------------------------------------------------------------------------ -- Zipping ------------------------------------------------------------------------ @@ -4099,7 +4095,10 @@ zipWith f s1 s2 = zipWith' f s1' s2' -- | A version of zipWith that assumes the sequences have the same length. zipWith' :: (a -> b -> c) -> Seq a -> Seq b -> Seq c -zipWith' f s1 s2 = splitMap uncheckedSplitAt (\s a -> f a (getSingleton s)) s2 s1 +zipWith' f s1 s2 = splitMap uncheckedSplitAt goLeaf s2 s1 + where + goLeaf (Seq (Single (Elem b))) a = f a b + goLeaf _ _ = error "Data.Sequence.zipWith'.goLeaf internal error: not a singleton" -- | /O(min(n1,n2,n3))/. 'zip3' takes three sequences and returns a -- sequence of triples, analogous to 'zip'. From git at git.haskell.org Mon Apr 17 21:47:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:47:08 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, revert-408-bugfix_394: Add MonadZip Seq and Tree instances (5c88f63) Message-ID: <20170417214708.845173A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/5c88f634b14f6cff39a85201dababccc70672daf >--------------------------------------------------------------- commit 5c88f634b14f6cff39a85201dababccc70672daf Author: David Feuer Date: Wed Dec 28 11:41:56 2016 -0500 Add MonadZip Seq and Tree instances Add `MonadZip` instances for `Data.Sequence.Seq` and `Data.Tree.Tree`. Fixes #374 >--------------------------------------------------------------- 5c88f634b14f6cff39a85201dababccc70672daf Data/Sequence/Internal.hs | 106 ++++++++++++++++++++++++++++++++++++++++++++++ Data/Tree.hs | 13 ++++++ tests/seq-properties.hs | 54 +++++++++++++++++++++++ 3 files changed, 173 insertions(+) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 5c88f634b14f6cff39a85201dababccc70672daf From git at git.haskell.org Mon Apr 17 21:47:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:47:10 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, revert-408-bugfix_394: Merge pull request #375 from treeowl/monadzip-seq (d3ca45a) Message-ID: <20170417214710.8E3353A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/d3ca45a5cbd48edc172894b30bb757c817ab9552 >--------------------------------------------------------------- commit d3ca45a5cbd48edc172894b30bb757c817ab9552 Merge: c027280 5c88f63 Author: David Feuer Date: Fri Dec 30 08:11:04 2016 -0500 Merge pull request #375 from treeowl/monadzip-seq Add MonadZip Seq instance >--------------------------------------------------------------- d3ca45a5cbd48edc172894b30bb757c817ab9552 Data/Sequence/Internal.hs | 106 ++++++++++++++++++++++++++++++++++++++++++++++ Data/Tree.hs | 13 ++++++ tests/seq-properties.hs | 54 +++++++++++++++++++++++ 3 files changed, 173 insertions(+) From git at git.haskell.org Mon Apr 17 21:47:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:47:12 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, revert-408-bugfix_394: Merge pull request #376 from treeowl/kill-getSingleton (9253dc6) Message-ID: <20170417214712.99CB63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/9253dc6ffdb988636d5e01be038d9483255bf3ec >--------------------------------------------------------------- commit 9253dc6ffdb988636d5e01be038d9483255bf3ec Merge: d3ca45a dbed0dd Author: David Feuer Date: Fri Jan 6 01:21:28 2017 -0500 Merge pull request #376 from treeowl/kill-getSingleton Kill getSingleton >--------------------------------------------------------------- 9253dc6ffdb988636d5e01be038d9483255bf3ec Data/Sequence/Internal.hs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) From git at git.haskell.org Mon Apr 17 21:47:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:47:14 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, revert-408-bugfix_394: Fix Read1 and Show1 instance for Tree (9170603) Message-ID: <20170417214714.A20BF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/917060374023a525a4c136f5c7d8a82feb2a67b0 >--------------------------------------------------------------- commit 917060374023a525a4c136f5c7d8a82feb2a67b0 Author: Ryan Scott Date: Sat Jan 7 22:34:32 2017 -0500 Fix Read1 and Show1 instance for Tree >--------------------------------------------------------------- 917060374023a525a4c136f5c7d8a82feb2a67b0 Data/Tree.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Data/Tree.hs b/Data/Tree.hs index 5a9ad20..538d2f3 100644 --- a/Data/Tree.hs +++ b/Data/Tree.hs @@ -104,13 +104,13 @@ instance Ord1 Tree where lcomp (Node a fr) (Node a' fr') = cmp a a' <> liftCompare lcomp fr fr' instance Show1 Tree where - liftShowsPrec shw shwl _p (Node a fr) = + liftShowsPrec shw shwl p (Node a fr) = showParen (p > 10) $ showString "Node {rootLabel = " . shw 0 a . showString ", " . showString "subForest = " . liftShowList shw shwl fr . showString "}" instance Read1 Tree where - liftReadsPrec rd rdl _p = readParen False $ + liftReadsPrec rd rdl p = readParen (p > 10) $ \s -> do ("Node", s1) <- lex s ("{", s2) <- lex s1 From git at git.haskell.org Mon Apr 17 21:47:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:47:16 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, merge-doc-target, revert-408-bugfix_394: Merge pull request #381 from RyanGlScott/master (f88850a) Message-ID: <20170417214716.AA43D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,merge-doc-target,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/f88850adcd9dc6b2e29c476e9e40ef2191da47eb >--------------------------------------------------------------- commit f88850adcd9dc6b2e29c476e9e40ef2191da47eb Merge: 9253dc6 9170603 Author: David Feuer Date: Sun Jan 8 01:59:02 2017 -0500 Merge pull request #381 from RyanGlScott/master Fix Read1 and Show1 instances for Tree >--------------------------------------------------------------- f88850adcd9dc6b2e29c476e9e40ef2191da47eb Data/Tree.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) From git at git.haskell.org Mon Apr 17 21:47:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:47:18 +0000 (UTC) Subject: [commit: packages/containers] merge-doc-target: Retarget Haddocks to point to new merge modules (6c0355a) Message-ID: <20170417214718.B694E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branch : merge-doc-target Link : http://git.haskell.org/packages/containers.git/commitdiff/6c0355a9d3f6a9fe53e21a3aa585dd9f4bd32ba0 >--------------------------------------------------------------- commit 6c0355a9d3f6a9fe53e21a3aa585dd9f4bd32ba0 Author: David Feuer Date: Tue Jan 10 18:19:09 2017 -0500 Retarget Haddocks to point to new merge modules We had a bunch of stale links to `Strict.Merge` and `Lazy.Merge`. Fix them all, hopefully. >--------------------------------------------------------------- 6c0355a9d3f6a9fe53e21a3aa585dd9f4bd32ba0 Data/IntMap/Internal.hs | 6 +++--- Data/IntMap/Merge/Lazy.hs | 6 +++--- Data/IntMap/Merge/Strict.hs | 6 +++--- Data/Map/Internal.hs | 8 ++++---- Data/Map/Lazy.hs | 2 +- Data/Map/Merge/Lazy.hs | 6 +++--- Data/Map/Merge/Strict.hs | 6 +++--- Data/Map/Strict.hs | 2 +- Data/Map/Strict/Internal.hs | 4 ++-- 9 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Data/IntMap/Internal.hs b/Data/IntMap/Internal.hs index 0576b1e..5433dc8 100644 --- a/Data/IntMap/Internal.hs +++ b/Data/IntMap/Internal.hs @@ -1574,7 +1574,7 @@ dropMissing = WhenMissing -- -- > preserveMissing :: SimpleWhenMissing x x -- --- prop> preserveMissing = Lazy.Merge.mapMaybeMissing (\_ x -> Just x) +-- prop> preserveMissing = Merge.Lazy.mapMaybeMissing (\_ x -> Just x) -- -- but @preserveMissing@ is much faster. preserveMissing :: Applicative f => WhenMissing f x x @@ -1620,7 +1620,7 @@ mapMaybeMissing f = WhenMissing -- -- > filterMissing :: (k -> x -> Bool) -> SimpleWhenMissing x x -- --- prop> filterMissing f = Lazy.Merge.mapMaybeMissing $ \k x -> guard (f k x) *> Just x +-- prop> filterMissing f = Merge.Lazy.mapMaybeMissing $ \k x -> guard (f k x) *> Just x -- -- but this should be a little faster. filterMissing @@ -1634,7 +1634,7 @@ filterMissing f = WhenMissing -- | Filter the entries whose keys are missing from the other map -- using some 'Applicative' action. -- --- > filterAMissing f = Lazy.Merge.traverseMaybeMissing $ +-- > filterAMissing f = Merge.Lazy.traverseMaybeMissing $ -- > \k x -> (\b -> guard b *> Just x) <$> f k x -- -- but this should be a little faster. diff --git a/Data/IntMap/Merge/Lazy.hs b/Data/IntMap/Merge/Lazy.hs index 869c9fa..37394f6 100644 --- a/Data/IntMap/Merge/Lazy.hs +++ b/Data/IntMap/Merge/Lazy.hs @@ -33,9 +33,9 @@ -- -- The 'merge' and 'mergeA' functions are shared by -- the lazy and strict modules. Only the choice of merge tactics --- determines strictness. If you use 'Data.Map.Strict.Merge.mapMissing' --- from "Data.Map.Strict.Merge" then the results will be forced before --- they are inserted. If you use 'Data.Map.Lazy.Merge.mapMissing' from +-- determines strictness. If you use 'Data.Map.Merge.Strict.mapMissing' +-- from "Data.Map.Merge.Strict" then the results will be forced before +-- they are inserted. If you use 'Data.Map.Merge.Lazy.mapMissing' from -- this module then they will not. -- -- == Efficiency note diff --git a/Data/IntMap/Merge/Strict.hs b/Data/IntMap/Merge/Strict.hs index 7a82557..0643439 100644 --- a/Data/IntMap/Merge/Strict.hs +++ b/Data/IntMap/Merge/Strict.hs @@ -33,10 +33,10 @@ -- -- The 'merge' and 'mergeA' functions are shared by -- the lazy and strict modules. Only the choice of merge tactics --- determines strictness. If you use 'Data.Map.Strict.Merge.mapMissing' +-- determines strictness. If you use 'Data.Map.Merge.Strict.mapMissing' -- from this module then the results will be forced before they are --- inserted. If you use 'Data.Map.Lazy.Merge.mapMissing' from --- "Data.Map.Lazy.Merge" then they will not. +-- inserted. If you use 'Data.Map.Merge.Lazy.mapMissing' from +-- "Data.Map.Merge.Lazy" then they will not. -- -- == Efficiency note -- diff --git a/Data/Map/Internal.hs b/Data/Map/Internal.hs index 8fc766d..82f4652 100644 --- a/Data/Map/Internal.hs +++ b/Data/Map/Internal.hs @@ -348,7 +348,7 @@ module Data.Map.Internal ( , MaybeS(..) , Identity(..) - -- Used by Map.Lazy.Merge + -- Used by Map.Merge.Lazy , mapWhenMissing , mapWhenMatched , lmapWhenMissing @@ -2257,7 +2257,7 @@ dropMissing = WhenMissing -- preserveMissing :: SimpleWhenMissing k x x -- @ -- --- prop> preserveMissing = Lazy.Merge.mapMaybeMissing (\_ x -> Just x) +-- prop> preserveMissing = Merge.Lazy.mapMaybeMissing (\_ x -> Just x) -- -- but @preserveMissing@ is much faster. preserveMissing :: Applicative f => WhenMissing f k x x @@ -2304,7 +2304,7 @@ mapMaybeMissing f = WhenMissing -- filterMissing :: (k -> x -> Bool) -> SimpleWhenMissing k x x -- @ -- --- prop> filterMissing f = Lazy.Merge.mapMaybeMissing $ \k x -> guard (f k x) *> Just x +-- prop> filterMissing f = Merge.Lazy.mapMaybeMissing $ \k x -> guard (f k x) *> Just x -- -- but this should be a little faster. filterMissing :: Applicative f @@ -2318,7 +2318,7 @@ filterMissing f = WhenMissing -- using some 'Applicative' action. -- -- @ --- filterAMissing f = Lazy.Merge.traverseMaybeMissing $ +-- filterAMissing f = Merge.Lazy.traverseMaybeMissing $ -- \k x -> (\b -> guard b *> Just x) <$> f k x -- @ -- diff --git a/Data/Map/Lazy.hs b/Data/Map/Lazy.hs index 00ff3f4..7712cef 100644 --- a/Data/Map/Lazy.hs +++ b/Data/Map/Lazy.hs @@ -120,7 +120,7 @@ module Data.Map.Lazy ( , intersectionWithKey -- ** General combining functions - -- | See "Data.Map.Lazy.Merge" + -- | See "Data.Map.Merge.Lazy" -- ** Unsafe general combining function diff --git a/Data/Map/Merge/Lazy.hs b/Data/Map/Merge/Lazy.hs index 466f150..028acab 100644 --- a/Data/Map/Merge/Lazy.hs +++ b/Data/Map/Merge/Lazy.hs @@ -33,9 +33,9 @@ -- -- The 'merge' and 'mergeA' functions are shared by -- the lazy and strict modules. Only the choice of merge tactics --- determines strictness. If you use 'Data.Map.Strict.Merge.mapMissing' --- from "Data.Map.Strict.Merge" then the results will be forced before --- they are inserted. If you use 'Data.Map.Lazy.Merge.mapMissing' from +-- determines strictness. If you use 'Data.Map.Merge.Strict.mapMissing' +-- from "Data.Map.Merge.Strict" then the results will be forced before +-- they are inserted. If you use 'Data.Map.Merge.Lazy.mapMissing' from -- this module then they will not. -- -- == Efficiency note diff --git a/Data/Map/Merge/Strict.hs b/Data/Map/Merge/Strict.hs index f068c84..f8804a8 100644 --- a/Data/Map/Merge/Strict.hs +++ b/Data/Map/Merge/Strict.hs @@ -33,10 +33,10 @@ -- -- The 'merge' and 'mergeA' functions are shared by -- the lazy and strict modules. Only the choice of merge tactics --- determines strictness. If you use 'Data.Map.Strict.Merge.mapMissing' +-- determines strictness. If you use 'Data.Map.Merge.Strict.mapMissing' -- from this module then the results will be forced before they are --- inserted. If you use 'Data.Map.Lazy.Merge.mapMissing' from --- "Data.Map.Lazy.Merge" then they will not. +-- inserted. If you use 'Data.Map.Merge.Lazy.mapMissing' from +-- "Data.Map.Merge.Lazy" then they will not. -- -- == Efficiency note -- diff --git a/Data/Map/Strict.hs b/Data/Map/Strict.hs index fd77f84..70f41a8 100644 --- a/Data/Map/Strict.hs +++ b/Data/Map/Strict.hs @@ -128,7 +128,7 @@ module Data.Map.Strict , intersectionWithKey -- ** General combining functions - -- | See "Data.Map.Strict.Merge" + -- | See "Data.Map.Merge.Strict" -- ** Deprecated general combining function diff --git a/Data/Map/Strict/Internal.hs b/Data/Map/Strict/Internal.hs index 7a5abf6..928efc1 100644 --- a/Data/Map/Strict/Internal.hs +++ b/Data/Map/Strict/Internal.hs @@ -1193,8 +1193,8 @@ forceMaybe m@(Just !_) = m -- -- WARNING: This function can produce corrupt maps and its results -- may depend on the internal structures of its inputs. Users should --- prefer 'Data.Map.Strict.Merge.merge' or --- 'Data.Map.Strict.Merge.mergeA'. +-- prefer 'Data.Map.Merge.Strict.merge' or +-- 'Data.Map.Merge.Strict.mergeA'. -- -- When 'mergeWithKey' is given three arguments, it is inlined to the call -- site. You should therefore use 'mergeWithKey' only to define custom From git at git.haskell.org Mon Apr 17 21:47:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:47:20 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, revert-408-bugfix_394: Retarget Haddocks to point to new merge modules (#384) (edcf7c9) Message-ID: <20170417214720.C3BDC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/edcf7c914f75d6072730ff6f8c62b90aa586880b >--------------------------------------------------------------- commit edcf7c914f75d6072730ff6f8c62b90aa586880b Author: David Feuer Date: Tue Jan 10 22:01:19 2017 -0500 Retarget Haddocks to point to new merge modules (#384) We had a bunch of stale links to `Strict.Merge` and `Lazy.Merge`. Fix them all, hopefully. >--------------------------------------------------------------- edcf7c914f75d6072730ff6f8c62b90aa586880b Data/IntMap/Internal.hs | 6 +++--- Data/IntMap/Merge/Lazy.hs | 6 +++--- Data/IntMap/Merge/Strict.hs | 6 +++--- Data/Map/Internal.hs | 8 ++++---- Data/Map/Lazy.hs | 2 +- Data/Map/Merge/Lazy.hs | 6 +++--- Data/Map/Merge/Strict.hs | 6 +++--- Data/Map/Strict.hs | 2 +- Data/Map/Strict/Internal.hs | 4 ++-- 9 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Data/IntMap/Internal.hs b/Data/IntMap/Internal.hs index 0576b1e..5433dc8 100644 --- a/Data/IntMap/Internal.hs +++ b/Data/IntMap/Internal.hs @@ -1574,7 +1574,7 @@ dropMissing = WhenMissing -- -- > preserveMissing :: SimpleWhenMissing x x -- --- prop> preserveMissing = Lazy.Merge.mapMaybeMissing (\_ x -> Just x) +-- prop> preserveMissing = Merge.Lazy.mapMaybeMissing (\_ x -> Just x) -- -- but @preserveMissing@ is much faster. preserveMissing :: Applicative f => WhenMissing f x x @@ -1620,7 +1620,7 @@ mapMaybeMissing f = WhenMissing -- -- > filterMissing :: (k -> x -> Bool) -> SimpleWhenMissing x x -- --- prop> filterMissing f = Lazy.Merge.mapMaybeMissing $ \k x -> guard (f k x) *> Just x +-- prop> filterMissing f = Merge.Lazy.mapMaybeMissing $ \k x -> guard (f k x) *> Just x -- -- but this should be a little faster. filterMissing @@ -1634,7 +1634,7 @@ filterMissing f = WhenMissing -- | Filter the entries whose keys are missing from the other map -- using some 'Applicative' action. -- --- > filterAMissing f = Lazy.Merge.traverseMaybeMissing $ +-- > filterAMissing f = Merge.Lazy.traverseMaybeMissing $ -- > \k x -> (\b -> guard b *> Just x) <$> f k x -- -- but this should be a little faster. diff --git a/Data/IntMap/Merge/Lazy.hs b/Data/IntMap/Merge/Lazy.hs index 869c9fa..37394f6 100644 --- a/Data/IntMap/Merge/Lazy.hs +++ b/Data/IntMap/Merge/Lazy.hs @@ -33,9 +33,9 @@ -- -- The 'merge' and 'mergeA' functions are shared by -- the lazy and strict modules. Only the choice of merge tactics --- determines strictness. If you use 'Data.Map.Strict.Merge.mapMissing' --- from "Data.Map.Strict.Merge" then the results will be forced before --- they are inserted. If you use 'Data.Map.Lazy.Merge.mapMissing' from +-- determines strictness. If you use 'Data.Map.Merge.Strict.mapMissing' +-- from "Data.Map.Merge.Strict" then the results will be forced before +-- they are inserted. If you use 'Data.Map.Merge.Lazy.mapMissing' from -- this module then they will not. -- -- == Efficiency note diff --git a/Data/IntMap/Merge/Strict.hs b/Data/IntMap/Merge/Strict.hs index 7a82557..0643439 100644 --- a/Data/IntMap/Merge/Strict.hs +++ b/Data/IntMap/Merge/Strict.hs @@ -33,10 +33,10 @@ -- -- The 'merge' and 'mergeA' functions are shared by -- the lazy and strict modules. Only the choice of merge tactics --- determines strictness. If you use 'Data.Map.Strict.Merge.mapMissing' +-- determines strictness. If you use 'Data.Map.Merge.Strict.mapMissing' -- from this module then the results will be forced before they are --- inserted. If you use 'Data.Map.Lazy.Merge.mapMissing' from --- "Data.Map.Lazy.Merge" then they will not. +-- inserted. If you use 'Data.Map.Merge.Lazy.mapMissing' from +-- "Data.Map.Merge.Lazy" then they will not. -- -- == Efficiency note -- diff --git a/Data/Map/Internal.hs b/Data/Map/Internal.hs index 8fc766d..82f4652 100644 --- a/Data/Map/Internal.hs +++ b/Data/Map/Internal.hs @@ -348,7 +348,7 @@ module Data.Map.Internal ( , MaybeS(..) , Identity(..) - -- Used by Map.Lazy.Merge + -- Used by Map.Merge.Lazy , mapWhenMissing , mapWhenMatched , lmapWhenMissing @@ -2257,7 +2257,7 @@ dropMissing = WhenMissing -- preserveMissing :: SimpleWhenMissing k x x -- @ -- --- prop> preserveMissing = Lazy.Merge.mapMaybeMissing (\_ x -> Just x) +-- prop> preserveMissing = Merge.Lazy.mapMaybeMissing (\_ x -> Just x) -- -- but @preserveMissing@ is much faster. preserveMissing :: Applicative f => WhenMissing f k x x @@ -2304,7 +2304,7 @@ mapMaybeMissing f = WhenMissing -- filterMissing :: (k -> x -> Bool) -> SimpleWhenMissing k x x -- @ -- --- prop> filterMissing f = Lazy.Merge.mapMaybeMissing $ \k x -> guard (f k x) *> Just x +-- prop> filterMissing f = Merge.Lazy.mapMaybeMissing $ \k x -> guard (f k x) *> Just x -- -- but this should be a little faster. filterMissing :: Applicative f @@ -2318,7 +2318,7 @@ filterMissing f = WhenMissing -- using some 'Applicative' action. -- -- @ --- filterAMissing f = Lazy.Merge.traverseMaybeMissing $ +-- filterAMissing f = Merge.Lazy.traverseMaybeMissing $ -- \k x -> (\b -> guard b *> Just x) <$> f k x -- @ -- diff --git a/Data/Map/Lazy.hs b/Data/Map/Lazy.hs index 00ff3f4..7712cef 100644 --- a/Data/Map/Lazy.hs +++ b/Data/Map/Lazy.hs @@ -120,7 +120,7 @@ module Data.Map.Lazy ( , intersectionWithKey -- ** General combining functions - -- | See "Data.Map.Lazy.Merge" + -- | See "Data.Map.Merge.Lazy" -- ** Unsafe general combining function diff --git a/Data/Map/Merge/Lazy.hs b/Data/Map/Merge/Lazy.hs index 466f150..028acab 100644 --- a/Data/Map/Merge/Lazy.hs +++ b/Data/Map/Merge/Lazy.hs @@ -33,9 +33,9 @@ -- -- The 'merge' and 'mergeA' functions are shared by -- the lazy and strict modules. Only the choice of merge tactics --- determines strictness. If you use 'Data.Map.Strict.Merge.mapMissing' --- from "Data.Map.Strict.Merge" then the results will be forced before --- they are inserted. If you use 'Data.Map.Lazy.Merge.mapMissing' from +-- determines strictness. If you use 'Data.Map.Merge.Strict.mapMissing' +-- from "Data.Map.Merge.Strict" then the results will be forced before +-- they are inserted. If you use 'Data.Map.Merge.Lazy.mapMissing' from -- this module then they will not. -- -- == Efficiency note diff --git a/Data/Map/Merge/Strict.hs b/Data/Map/Merge/Strict.hs index f068c84..f8804a8 100644 --- a/Data/Map/Merge/Strict.hs +++ b/Data/Map/Merge/Strict.hs @@ -33,10 +33,10 @@ -- -- The 'merge' and 'mergeA' functions are shared by -- the lazy and strict modules. Only the choice of merge tactics --- determines strictness. If you use 'Data.Map.Strict.Merge.mapMissing' +-- determines strictness. If you use 'Data.Map.Merge.Strict.mapMissing' -- from this module then the results will be forced before they are --- inserted. If you use 'Data.Map.Lazy.Merge.mapMissing' from --- "Data.Map.Lazy.Merge" then they will not. +-- inserted. If you use 'Data.Map.Merge.Lazy.mapMissing' from +-- "Data.Map.Merge.Lazy" then they will not. -- -- == Efficiency note -- diff --git a/Data/Map/Strict.hs b/Data/Map/Strict.hs index fd77f84..70f41a8 100644 --- a/Data/Map/Strict.hs +++ b/Data/Map/Strict.hs @@ -128,7 +128,7 @@ module Data.Map.Strict , intersectionWithKey -- ** General combining functions - -- | See "Data.Map.Strict.Merge" + -- | See "Data.Map.Merge.Strict" -- ** Deprecated general combining function diff --git a/Data/Map/Strict/Internal.hs b/Data/Map/Strict/Internal.hs index 7a5abf6..928efc1 100644 --- a/Data/Map/Strict/Internal.hs +++ b/Data/Map/Strict/Internal.hs @@ -1193,8 +1193,8 @@ forceMaybe m@(Just !_) = m -- -- WARNING: This function can produce corrupt maps and its results -- may depend on the internal structures of its inputs. Users should --- prefer 'Data.Map.Strict.Merge.merge' or --- 'Data.Map.Strict.Merge.mergeA'. +-- prefer 'Data.Map.Merge.Strict.merge' or +-- 'Data.Map.Merge.Strict.mergeA'. -- -- When 'mergeWithKey' is given three arguments, it is inlined to the call -- site. You should therefore use 'mergeWithKey' only to define custom From git at git.haskell.org Mon Apr 17 21:47:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:47:22 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, revert-408-bugfix_394: Remove 'stability' annotations (73ffe99) Message-ID: <20170417214722.DAC043A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/73ffe99d192ecfef6745e4e87183e74bc8bdb2c2 >--------------------------------------------------------------- commit 73ffe99d192ecfef6745e4e87183e74bc8bdb2c2 Author: Simon Jakobi Date: Wed Feb 1 21:35:24 2017 +0100 Remove 'stability' annotations Fixes https://github.com/haskell/containers/issues/389. >--------------------------------------------------------------- 73ffe99d192ecfef6745e4e87183e74bc8bdb2c2 Data/Graph.hs | 1 - Data/IntMap.hs | 1 - Data/IntMap/Internal.hs | 1 - Data/IntMap/Lazy.hs | 1 - Data/IntMap/Merge/Lazy.hs | 1 - Data/IntMap/Merge/Strict.hs | 1 - Data/IntMap/Strict.hs | 1 - Data/IntSet.hs | 1 - Data/IntSet/Internal.hs | 1 - Data/Map.hs | 1 - Data/Map/Internal.hs | 1 - Data/Map/Lazy.hs | 1 - Data/Map/Lazy/Merge.hs | 1 - Data/Map/Merge/Lazy.hs | 1 - Data/Map/Merge/Strict.hs | 1 - Data/Map/Strict.hs | 1 - Data/Map/Strict/Internal.hs | 1 - Data/Map/Strict/Merge.hs | 1 - Data/Sequence.hs | 1 - Data/Sequence/Internal.hs | 1 - Data/Set.hs | 1 - Data/Set/Internal.hs | 1 - Data/Tree.hs | 1 - Utils/Containers/Internal/BitQueue.hs | 1 - Utils/Containers/Internal/BitUtil.hs | 1 - 25 files changed, 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 73ffe99d192ecfef6745e4e87183e74bc8bdb2c2 From git at git.haskell.org Mon Apr 17 21:47:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:47:24 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, revert-408-bugfix_394: Fix buggy restrictKeys and withoutKeys (#393) (de8766e) Message-ID: <20170417214724.E48B43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/de8766eb9f5e148bb3b0145232e00816dbd2414a >--------------------------------------------------------------- commit de8766eb9f5e148bb3b0145232e00816dbd2414a Author: David Feuer Date: Mon Feb 6 16:07:33 2017 -0500 Fix buggy restrictKeys and withoutKeys (#393) `restrictKeys` and `withoutKeys` for `Data.IntMap` were completely wrong. The QuickCheck properties that should have caught this were never actually run. * Fix the implementations * Make the tests actually run. Fixes #392 >--------------------------------------------------------------- de8766eb9f5e148bb3b0145232e00816dbd2414a Data/IntMap/Internal.hs | 53 +++++++++------------------------------------- tests/intmap-properties.hs | 2 ++ 2 files changed, 12 insertions(+), 43 deletions(-) diff --git a/Data/IntMap/Internal.hs b/Data/IntMap/Internal.hs index b42aab1..c3fe437 100644 --- a/Data/IntMap/Internal.hs +++ b/Data/IntMap/Internal.hs @@ -1058,30 +1058,14 @@ withoutKeys = go | zero p1 m2 = bin p2 m2 (go t1 l2) Nil | otherwise = bin p2 m2 Nil (go t1 r2) - go t1'@(Bin _ _ _ _) t2'@(IntSet.Tip k2' _) = merge0 t2' k2' t1' - where - merge0 t2 k2 t1@(Bin p1 m1 l1 r1) - | nomatch k2 p1 m1 = t1 - | zero k2 m1 = binCheckLeft p1 m1 (merge0 t2 k2 l1) r1 - | otherwise = binCheckRight p1 m1 l1 (merge0 t2 k2 r1) - merge0 _ k2 t1@(Tip k1 _) - | k1 == k2 = Nil - | otherwise = t1 - merge0 _ _ Nil = Nil + go t1'@(Bin _ _ _ _) t2'@(IntSet.Tip _ _) = + filterWithKey (\k _ -> k `IntSet.notMember` t2') t1' go t1@(Bin _ _ _ _) IntSet.Nil = t1 - go t1'@(Tip k1' _) t2' = merge0 t1' k1' t2' - where - merge0 t1 k1 (IntSet.Bin p2 m2 l2 r2) - | nomatch k1 p2 m2 = t1 - | zero k1 m2 = bin p2 m2 (merge0 t1 k1 l2) Nil - | otherwise = bin p2 m2 Nil (merge0 t1 k1 r2) - merge0 t1 k1 (IntSet.Tip k2 _) - | k1 == k2 = Nil - | otherwise = t1 - merge0 t1 _ IntSet.Nil = t1 - + go t1'@(Tip k1' _) t2' + | k1' `IntSet.member` t2' = Nil + | otherwise = t1' go Nil _ = Nil @@ -1119,30 +1103,13 @@ restrictKeys = go | zero p1 m2 = bin p2 m2 (go t1 l2) Nil | otherwise = bin p2 m2 Nil (go t1 r2) - go t1'@(Bin _ _ _ _) t2'@(IntSet.Tip k2' _) = merge0 t2' k2' t1' - where - merge0 t2 k2 (Bin p1 m1 l1 r1) - | nomatch k2 p1 m1 = Nil - | zero k2 m1 = bin p1 m1 (merge0 t2 k2 l1) Nil - | otherwise = bin p1 m1 Nil (merge0 t2 k2 r1) - merge0 _ k2 t1@(Tip k1 _) - | k1 == k2 = t1 - | otherwise = Nil - merge0 _ _ Nil = Nil - + go t1'@(Bin _ _ _ _) t2'@(IntSet.Tip _ _) = + filterWithKey (\k _ -> k `IntSet.member` t2') t1' go (Bin _ _ _ _) IntSet.Nil = Nil - go t1'@(Tip k1' _) t2' = merge0 t1' k1' t2' - where - merge0 t1 k1 (IntSet.Bin p2 m2 l2 r2) - | nomatch k1 p2 m2 = Nil - | zero k1 m2 = bin p2 m2 (merge0 t1 k1 l2) Nil - | otherwise = bin p2 m2 Nil (merge0 t1 k1 r2) - merge0 t1 k1 (IntSet.Tip k2 _) - | k1 == k2 = t1 - | otherwise = Nil - merge0 _ _ IntSet.Nil = Nil - + go t1'@(Tip k1' _) t2' + | k1' `IntSet.member` t2' = t1' + | otherwise = Nil go Nil _ = Nil -- | /O(n+m)/. The intersection with a combining function. diff --git a/tests/intmap-properties.hs b/tests/intmap-properties.hs index 21ee9f6..a6fbe2f 100644 --- a/tests/intmap-properties.hs +++ b/tests/intmap-properties.hs @@ -167,6 +167,8 @@ main = defaultMain , testProperty "foldl'" prop_foldl' , testProperty "keysSet" prop_keysSet , testProperty "fromSet" prop_fromSet + , testProperty "restrictKeys" prop_restrictKeys + , testProperty "withoutKeys" prop_withoutKeys ] apply2 :: Fun (a, b) c -> a -> b -> c From git at git.haskell.org Mon Apr 17 21:47:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:47:26 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, revert-408-bugfix_394: Update changelog (1fbd3f7) Message-ID: <20170417214726.ECD173A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/1fbd3f7a631a85e6195ad4fe45a36444fa1cd94f >--------------------------------------------------------------- commit 1fbd3f7a631a85e6195ad4fe45a36444fa1cd94f Author: David Feuer Date: Mon Feb 6 16:17:34 2017 -0500 Update changelog >--------------------------------------------------------------- 1fbd3f7a631a85e6195ad4fe45a36444fa1cd94f changelog.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index fdbc6fb..039f127 100644 --- a/changelog.md +++ b/changelog.md @@ -1,9 +1,17 @@ # Changelog for [`containers` package](http://github.com/haskell/containers) -## 0.5.9.1 +## 0.5.9.2 * Planned for GHC 8.2. +* Fix completely incorrect implementations of `Data.IntMap.restrictKeys` and + `Data.IntMap.withoutKeys`. Make the tests for these actually run. + +* Fix a minor bug in the `Show1` instance of `Data.Tree`. This produced valid + output, but with fewer parentheses than `Show`. + +## 0.5.9.1 + * Add `merge` and `mergeA` for `Data.IntMap`. * Add instances for `Data.Graph.SCC`: `Foldable`, `Traversable`, `Data`, From git at git.haskell.org Mon Apr 17 21:47:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:47:28 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, revert-408-bugfix_394: Bump version (83f5f34) Message-ID: <20170417214728.F3BE73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/83f5f3473da2d6fe973900b2eb40e5e0635aa6ee >--------------------------------------------------------------- commit 83f5f3473da2d6fe973900b2eb40e5e0635aa6ee Author: David Feuer Date: Mon Feb 6 16:18:14 2017 -0500 Bump version >--------------------------------------------------------------- 83f5f3473da2d6fe973900b2eb40e5e0635aa6ee containers.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/containers.cabal b/containers.cabal index 71e6cd5..e25dfa5 100644 --- a/containers.cabal +++ b/containers.cabal @@ -1,5 +1,5 @@ name: containers -version: 0.5.9.1 +version: 0.5.9.2 license: BSD3 license-file: LICENSE maintainer: libraries at haskell.org From git at git.haskell.org Mon Apr 17 21:47:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:47:31 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, revert-408-bugfix_394: Update changelog and version (eeb3921) Message-ID: <20170417214731.07F223A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/eeb3921a1b9ef9c31cb83c6136940bab64ed0150 >--------------------------------------------------------------- commit eeb3921a1b9ef9c31cb83c6136940bab64ed0150 Author: David Feuer Date: Mon Feb 6 16:36:25 2017 -0500 Update changelog and version I realized we need a new minor version because we've added an instance. Whoops! Fix up the changelog some more. >--------------------------------------------------------------- eeb3921a1b9ef9c31cb83c6136940bab64ed0150 changelog.md | 11 ++++++++--- containers.cabal | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/changelog.md b/changelog.md index 039f127..fa9abbb 100644 --- a/changelog.md +++ b/changelog.md @@ -1,14 +1,19 @@ # Changelog for [`containers` package](http://github.com/haskell/containers) -## 0.5.9.2 +## 0.5.10.1 * Planned for GHC 8.2. * Fix completely incorrect implementations of `Data.IntMap.restrictKeys` and - `Data.IntMap.withoutKeys`. Make the tests for these actually run. + `Data.IntMap.withoutKeys`. Make the tests for these actually run. (Thanks + to Tom Smalley for reporting this.) * Fix a minor bug in the `Show1` instance of `Data.Tree`. This produced valid - output, but with fewer parentheses than `Show`. + output, but with fewer parentheses than `Show`. (Thanks, Ryan Scott.) + +* Add `MonadZip` instance for `Data.Sequence`. + +* Remove meaningless stability annotations (Thanks, Simon Jakobi.) ## 0.5.9.1 diff --git a/containers.cabal b/containers.cabal index e25dfa5..e5571c2 100644 --- a/containers.cabal +++ b/containers.cabal @@ -1,5 +1,5 @@ name: containers -version: 0.5.9.2 +version: 0.5.10.1 license: BSD3 license-file: LICENSE maintainer: libraries at haskell.org From git at git.haskell.org Mon Apr 17 21:47:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:47:33 +0000 (UTC) Subject: [commit: packages/containers] merge-restrict-fix-5.8: Fix restrictKeys and withoutKeys for IntMap (f362acc) Message-ID: <20170417214733.1174B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branch : merge-restrict-fix-5.8 Link : http://git.haskell.org/packages/containers.git/commitdiff/f362acca46327011dad0f8dc05a8656d8a8162ef >--------------------------------------------------------------- commit f362acca46327011dad0f8dc05a8656d8a8162ef Author: David Feuer Date: Mon Feb 6 18:16:43 2017 -0500 Fix restrictKeys and withoutKeys for IntMap Merges the fix from master. >--------------------------------------------------------------- f362acca46327011dad0f8dc05a8656d8a8162ef Data/IntMap/Base.hs | 42 ++++++++++-------------------------------- tests/intmap-properties.hs | 2 ++ 2 files changed, 12 insertions(+), 32 deletions(-) diff --git a/Data/IntMap/Base.hs b/Data/IntMap/Base.hs index 1f26af7..60ad0d1 100644 --- a/Data/IntMap/Base.hs +++ b/Data/IntMap/Base.hs @@ -1000,24 +1000,14 @@ withoutKeys = go | zero p1 m2 = bin p2 m2 (go t1 l2) Nil | otherwise = bin p2 m2 Nil (go t1 r2) - go t1'@(Bin _ _ _ _) t2'@(IntSet.Tip k2' _) = merge t2' k2' t1' - where merge t2 k2 t1@(Bin p1 m1 l1 r1) | nomatch k2 p1 m1 = t1 - | zero k2 m1 = binCheckLeft p1 m1 (merge t2 k2 l1) r1 - | otherwise = binCheckRight p1 m1 l1 (merge t2 k2 r1) - merge _ k2 t1@(Tip k1 _) | k1 == k2 = Nil - | otherwise = t1 - merge _ _ Nil = Nil + go t1'@(Bin _ _ _ _) t2'@(IntSet.Tip _ _) = + filterWithKey (\k _ -> k `IntSet.notMember` t2') t1' go t1@(Bin _ _ _ _) IntSet.Nil = t1 - go t1'@(Tip k1' _) t2' = merge t1' k1' t2' - where merge t1 k1 (IntSet.Bin p2 m2 l2 r2) | nomatch k1 p2 m2 = t1 - | zero k1 m2 = bin p2 m2 (merge t1 k1 l2) Nil - | otherwise = bin p2 m2 Nil (merge t1 k1 r2) - merge t1 k1 (IntSet.Tip k2 _) | k1 == k2 = Nil - | otherwise = t1 - merge t1 _ IntSet.Nil = t1 - + go t1'@(Tip k1' _) t2' + | k1' `IntSet.member` t2' = Nil + | otherwise = t1' go Nil _ = Nil @@ -1055,25 +1045,13 @@ restrictKeys = go | zero p1 m2 = bin p2 m2 (go t1 l2) Nil | otherwise = bin p2 m2 Nil (go t1 r2) - go t1'@(Bin _ _ _ _) t2'@(IntSet.Tip k2' _) = merge t2' k2' t1' - where merge t2 k2 (Bin p1 m1 l1 r1) | nomatch k2 p1 m1 = Nil - | zero k2 m1 = bin p1 m1 (merge t2 k2 l1) Nil - | otherwise = bin p1 m1 Nil (merge t2 k2 r1) - merge _ k2 t1@(Tip k1 _) | k1 == k2 = t1 - | otherwise = Nil - merge _ _ Nil = Nil - + go t1'@(Bin _ _ _ _) t2'@(IntSet.Tip _ _) = + filterWithKey (\k _ -> k `IntSet.member` t2') t1' go (Bin _ _ _ _) IntSet.Nil = Nil - go t1'@(Tip k1' _) t2' = merge t1' k1' t2' - where merge t1 k1 (IntSet.Bin p2 m2 l2 r2) - | nomatch k1 p2 m2 = Nil - | zero k1 m2 = bin p2 m2 (merge t1 k1 l2) Nil - | otherwise = bin p2 m2 Nil (merge t1 k1 r2) - merge t1 k1 (IntSet.Tip k2 _) | k1 == k2 = t1 - | otherwise = Nil - merge _ _ IntSet.Nil = Nil - + go t1'@(Tip k1' _) t2' + | k1' `IntSet.member` t2' = t1' + | otherwise = Nil go Nil _ = Nil -- | /O(n+m)/. The intersection with a combining function. diff --git a/tests/intmap-properties.hs b/tests/intmap-properties.hs index 21ee9f6..a6fbe2f 100644 --- a/tests/intmap-properties.hs +++ b/tests/intmap-properties.hs @@ -167,6 +167,8 @@ main = defaultMain , testProperty "foldl'" prop_foldl' , testProperty "keysSet" prop_keysSet , testProperty "fromSet" prop_fromSet + , testProperty "restrictKeys" prop_restrictKeys + , testProperty "withoutKeys" prop_withoutKeys ] apply2 :: Fun (a, b) c -> a -> b -> c From git at git.haskell.org Mon Apr 17 21:47:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:47:35 +0000 (UTC) Subject: [commit: packages/containers] merge-restrict-fix-5.8: Adjust changelog (b859e65) Message-ID: <20170417214735.1A3813A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branch : merge-restrict-fix-5.8 Link : http://git.haskell.org/packages/containers.git/commitdiff/b859e651af318f6a7e0e3838d4d45fef8b59c0d3 >--------------------------------------------------------------- commit b859e651af318f6a7e0e3838d4d45fef8b59c0d3 Author: David Feuer Date: Mon Feb 6 18:30:18 2017 -0500 Adjust changelog >--------------------------------------------------------------- b859e651af318f6a7e0e3838d4d45fef8b59c0d3 changelog.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/changelog.md b/changelog.md index d180353..40d55e2 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,10 @@ # Changelog for [`containers` package](http://github.com/haskell/containers) +## 0.5.8.2 + + * Fix completely incorrect implementations of `restrictKeys` and + `withoutKeys`. + ## 0.5.8.1 ### General package changes From git at git.haskell.org Mon Apr 17 21:47:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:47:37 +0000 (UTC) Subject: [commit: packages/containers] merge-restrict-fix-5.8: Fix restrictKeys and withoutKeys for IntMap (39515c0) Message-ID: <20170417214737.2294B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branch : merge-restrict-fix-5.8 Link : http://git.haskell.org/packages/containers.git/commitdiff/39515c0a7d1518a9be30de1753452bf308c1ed8d >--------------------------------------------------------------- commit 39515c0a7d1518a9be30de1753452bf308c1ed8d Author: David Feuer Date: Mon Feb 6 18:16:43 2017 -0500 Fix restrictKeys and withoutKeys for IntMap Merges the fix from master. >--------------------------------------------------------------- 39515c0a7d1518a9be30de1753452bf308c1ed8d containers.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/containers.cabal b/containers.cabal index 46b4556..a2606d2 100644 --- a/containers.cabal +++ b/containers.cabal @@ -1,5 +1,5 @@ name: containers -version: 0.5.8.1 +version: 0.5.8.2 license: BSD3 license-file: LICENSE maintainer: libraries at haskell.org From git at git.haskell.org Mon Apr 17 21:47:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:47:39 +0000 (UTC) Subject: [commit: packages/containers] merge-fixes-5.9: Fix buggy restrictKeys and withoutKeys (#393) (477cd98) Message-ID: <20170417214739.2D02E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branch : merge-fixes-5.9 Link : http://git.haskell.org/packages/containers.git/commitdiff/477cd98375e77bb2581c2bff4501b8e2e1b00850 >--------------------------------------------------------------- commit 477cd98375e77bb2581c2bff4501b8e2e1b00850 Author: David Feuer Date: Mon Feb 6 16:07:33 2017 -0500 Fix buggy restrictKeys and withoutKeys (#393) `restrictKeys` and `withoutKeys` for `Data.IntMap` were completely wrong. The QuickCheck properties that should have caught this were never actually run. * Fix the implementations * Make the tests actually run. Fixes #392 >--------------------------------------------------------------- 477cd98375e77bb2581c2bff4501b8e2e1b00850 Data/IntMap/Internal.hs | 53 +++++++++------------------------------------- tests/intmap-properties.hs | 2 ++ 2 files changed, 12 insertions(+), 43 deletions(-) diff --git a/Data/IntMap/Internal.hs b/Data/IntMap/Internal.hs index 690bc73..37cf8c4 100644 --- a/Data/IntMap/Internal.hs +++ b/Data/IntMap/Internal.hs @@ -1059,30 +1059,14 @@ withoutKeys = go | zero p1 m2 = bin p2 m2 (go t1 l2) Nil | otherwise = bin p2 m2 Nil (go t1 r2) - go t1'@(Bin _ _ _ _) t2'@(IntSet.Tip k2' _) = merge0 t2' k2' t1' - where - merge0 t2 k2 t1@(Bin p1 m1 l1 r1) - | nomatch k2 p1 m1 = t1 - | zero k2 m1 = binCheckLeft p1 m1 (merge0 t2 k2 l1) r1 - | otherwise = binCheckRight p1 m1 l1 (merge0 t2 k2 r1) - merge0 _ k2 t1@(Tip k1 _) - | k1 == k2 = Nil - | otherwise = t1 - merge0 _ _ Nil = Nil + go t1'@(Bin _ _ _ _) t2'@(IntSet.Tip _ _) = + filterWithKey (\k _ -> k `IntSet.notMember` t2') t1' go t1@(Bin _ _ _ _) IntSet.Nil = t1 - go t1'@(Tip k1' _) t2' = merge0 t1' k1' t2' - where - merge0 t1 k1 (IntSet.Bin p2 m2 l2 r2) - | nomatch k1 p2 m2 = t1 - | zero k1 m2 = bin p2 m2 (merge0 t1 k1 l2) Nil - | otherwise = bin p2 m2 Nil (merge0 t1 k1 r2) - merge0 t1 k1 (IntSet.Tip k2 _) - | k1 == k2 = Nil - | otherwise = t1 - merge0 t1 _ IntSet.Nil = t1 - + go t1'@(Tip k1' _) t2' + | k1' `IntSet.member` t2' = Nil + | otherwise = t1' go Nil _ = Nil @@ -1120,30 +1104,13 @@ restrictKeys = go | zero p1 m2 = bin p2 m2 (go t1 l2) Nil | otherwise = bin p2 m2 Nil (go t1 r2) - go t1'@(Bin _ _ _ _) t2'@(IntSet.Tip k2' _) = merge0 t2' k2' t1' - where - merge0 t2 k2 (Bin p1 m1 l1 r1) - | nomatch k2 p1 m1 = Nil - | zero k2 m1 = bin p1 m1 (merge0 t2 k2 l1) Nil - | otherwise = bin p1 m1 Nil (merge0 t2 k2 r1) - merge0 _ k2 t1@(Tip k1 _) - | k1 == k2 = t1 - | otherwise = Nil - merge0 _ _ Nil = Nil - + go t1'@(Bin _ _ _ _) t2'@(IntSet.Tip _ _) = + filterWithKey (\k _ -> k `IntSet.member` t2') t1' go (Bin _ _ _ _) IntSet.Nil = Nil - go t1'@(Tip k1' _) t2' = merge0 t1' k1' t2' - where - merge0 t1 k1 (IntSet.Bin p2 m2 l2 r2) - | nomatch k1 p2 m2 = Nil - | zero k1 m2 = bin p2 m2 (merge0 t1 k1 l2) Nil - | otherwise = bin p2 m2 Nil (merge0 t1 k1 r2) - merge0 t1 k1 (IntSet.Tip k2 _) - | k1 == k2 = t1 - | otherwise = Nil - merge0 _ _ IntSet.Nil = Nil - + go t1'@(Tip k1' _) t2' + | k1' `IntSet.member` t2' = t1' + | otherwise = Nil go Nil _ = Nil -- | /O(n+m)/. The intersection with a combining function. diff --git a/tests/intmap-properties.hs b/tests/intmap-properties.hs index 21ee9f6..a6fbe2f 100644 --- a/tests/intmap-properties.hs +++ b/tests/intmap-properties.hs @@ -167,6 +167,8 @@ main = defaultMain , testProperty "foldl'" prop_foldl' , testProperty "keysSet" prop_keysSet , testProperty "fromSet" prop_fromSet + , testProperty "restrictKeys" prop_restrictKeys + , testProperty "withoutKeys" prop_withoutKeys ] apply2 :: Fun (a, b) c -> a -> b -> c From git at git.haskell.org Mon Apr 17 21:47:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:47:41 +0000 (UTC) Subject: [commit: packages/containers] merge-fixes-5.9: Fix Read1 and Show1 instance for Tree (58f68bb) Message-ID: <20170417214741.352433A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branch : merge-fixes-5.9 Link : http://git.haskell.org/packages/containers.git/commitdiff/58f68bb25dbefc71ba48a9369e018afb194ec6aa >--------------------------------------------------------------- commit 58f68bb25dbefc71ba48a9369e018afb194ec6aa Author: Ryan Scott Date: Sat Jan 7 22:34:32 2017 -0500 Fix Read1 and Show1 instance for Tree >--------------------------------------------------------------- 58f68bb25dbefc71ba48a9369e018afb194ec6aa Data/Tree.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Data/Tree.hs b/Data/Tree.hs index 89dd42b..bd9d58a 100644 --- a/Data/Tree.hs +++ b/Data/Tree.hs @@ -100,13 +100,13 @@ instance Ord1 Tree where lcomp (Node a fr) (Node a' fr') = cmp a a' <> liftCompare lcomp fr fr' instance Show1 Tree where - liftShowsPrec shw shwl _p (Node a fr) = + liftShowsPrec shw shwl p (Node a fr) = showParen (p > 10) $ showString "Node {rootLabel = " . shw 0 a . showString ", " . showString "subForest = " . liftShowList shw shwl fr . showString "}" instance Read1 Tree where - liftReadsPrec rd rdl _p = readParen False $ + liftReadsPrec rd rdl p = readParen (p > 10) $ \s -> do ("Node", s1) <- lex s ("{", s2) <- lex s1 From git at git.haskell.org Mon Apr 17 21:47:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:47:43 +0000 (UTC) Subject: [commit: packages/containers] merge-fixes-5.9: Retarget Haddocks to point to new merge modules (#384) (38b20d1) Message-ID: <20170417214743.418EE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branch : merge-fixes-5.9 Link : http://git.haskell.org/packages/containers.git/commitdiff/38b20d165f9816f3fbc7ff144ce65192d39695d1 >--------------------------------------------------------------- commit 38b20d165f9816f3fbc7ff144ce65192d39695d1 Author: David Feuer Date: Tue Jan 10 22:01:19 2017 -0500 Retarget Haddocks to point to new merge modules (#384) We had a bunch of stale links to `Strict.Merge` and `Lazy.Merge`. Fix them all, hopefully. >--------------------------------------------------------------- 38b20d165f9816f3fbc7ff144ce65192d39695d1 Data/IntMap/Internal.hs | 6 +++--- Data/IntMap/Merge/Lazy.hs | 6 +++--- Data/IntMap/Merge/Strict.hs | 6 +++--- Data/Map/Internal.hs | 8 ++++---- Data/Map/Lazy.hs | 2 +- Data/Map/Merge/Lazy.hs | 6 +++--- Data/Map/Merge/Strict.hs | 6 +++--- Data/Map/Strict.hs | 2 +- Data/Map/Strict/Internal.hs | 4 ++-- 9 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Data/IntMap/Internal.hs b/Data/IntMap/Internal.hs index 6c0efd2..690bc73 100644 --- a/Data/IntMap/Internal.hs +++ b/Data/IntMap/Internal.hs @@ -1574,7 +1574,7 @@ dropMissing = WhenMissing -- -- > preserveMissing :: SimpleWhenMissing x x -- --- prop> preserveMissing = Lazy.Merge.mapMaybeMissing (\_ x -> Just x) +-- prop> preserveMissing = Merge.Lazy.mapMaybeMissing (\_ x -> Just x) -- -- but @preserveMissing@ is much faster. preserveMissing :: Applicative f => WhenMissing f x x @@ -1620,7 +1620,7 @@ mapMaybeMissing f = WhenMissing -- -- > filterMissing :: (k -> x -> Bool) -> SimpleWhenMissing x x -- --- prop> filterMissing f = Lazy.Merge.mapMaybeMissing $ \k x -> guard (f k x) *> Just x +-- prop> filterMissing f = Merge.Lazy.mapMaybeMissing $ \k x -> guard (f k x) *> Just x -- -- but this should be a little faster. filterMissing @@ -1634,7 +1634,7 @@ filterMissing f = WhenMissing -- | Filter the entries whose keys are missing from the other map -- using some 'Applicative' action. -- --- > filterAMissing f = Lazy.Merge.traverseMaybeMissing $ +-- > filterAMissing f = Merge.Lazy.traverseMaybeMissing $ -- > \k x -> (\b -> guard b *> Just x) <$> f k x -- -- but this should be a little faster. diff --git a/Data/IntMap/Merge/Lazy.hs b/Data/IntMap/Merge/Lazy.hs index 869c9fa..37394f6 100644 --- a/Data/IntMap/Merge/Lazy.hs +++ b/Data/IntMap/Merge/Lazy.hs @@ -33,9 +33,9 @@ -- -- The 'merge' and 'mergeA' functions are shared by -- the lazy and strict modules. Only the choice of merge tactics --- determines strictness. If you use 'Data.Map.Strict.Merge.mapMissing' --- from "Data.Map.Strict.Merge" then the results will be forced before --- they are inserted. If you use 'Data.Map.Lazy.Merge.mapMissing' from +-- determines strictness. If you use 'Data.Map.Merge.Strict.mapMissing' +-- from "Data.Map.Merge.Strict" then the results will be forced before +-- they are inserted. If you use 'Data.Map.Merge.Lazy.mapMissing' from -- this module then they will not. -- -- == Efficiency note diff --git a/Data/IntMap/Merge/Strict.hs b/Data/IntMap/Merge/Strict.hs index 7a82557..0643439 100644 --- a/Data/IntMap/Merge/Strict.hs +++ b/Data/IntMap/Merge/Strict.hs @@ -33,10 +33,10 @@ -- -- The 'merge' and 'mergeA' functions are shared by -- the lazy and strict modules. Only the choice of merge tactics --- determines strictness. If you use 'Data.Map.Strict.Merge.mapMissing' +-- determines strictness. If you use 'Data.Map.Merge.Strict.mapMissing' -- from this module then the results will be forced before they are --- inserted. If you use 'Data.Map.Lazy.Merge.mapMissing' from --- "Data.Map.Lazy.Merge" then they will not. +-- inserted. If you use 'Data.Map.Merge.Lazy.mapMissing' from +-- "Data.Map.Merge.Lazy" then they will not. -- -- == Efficiency note -- diff --git a/Data/Map/Internal.hs b/Data/Map/Internal.hs index ca21117..afe9d8f 100644 --- a/Data/Map/Internal.hs +++ b/Data/Map/Internal.hs @@ -348,7 +348,7 @@ module Data.Map.Internal ( , MaybeS(..) , Identity(..) - -- Used by Map.Lazy.Merge + -- Used by Map.Merge.Lazy , mapWhenMissing , mapWhenMatched , lmapWhenMissing @@ -2257,7 +2257,7 @@ dropMissing = WhenMissing -- preserveMissing :: SimpleWhenMissing k x x -- @ -- --- prop> preserveMissing = Lazy.Merge.mapMaybeMissing (\_ x -> Just x) +-- prop> preserveMissing = Merge.Lazy.mapMaybeMissing (\_ x -> Just x) -- -- but @preserveMissing@ is much faster. preserveMissing :: Applicative f => WhenMissing f k x x @@ -2304,7 +2304,7 @@ mapMaybeMissing f = WhenMissing -- filterMissing :: (k -> x -> Bool) -> SimpleWhenMissing k x x -- @ -- --- prop> filterMissing f = Lazy.Merge.mapMaybeMissing $ \k x -> guard (f k x) *> Just x +-- prop> filterMissing f = Merge.Lazy.mapMaybeMissing $ \k x -> guard (f k x) *> Just x -- -- but this should be a little faster. filterMissing :: Applicative f @@ -2318,7 +2318,7 @@ filterMissing f = WhenMissing -- using some 'Applicative' action. -- -- @ --- filterAMissing f = Lazy.Merge.traverseMaybeMissing $ +-- filterAMissing f = Merge.Lazy.traverseMaybeMissing $ -- \k x -> (\b -> guard b *> Just x) <$> f k x -- @ -- diff --git a/Data/Map/Lazy.hs b/Data/Map/Lazy.hs index 00ff3f4..7712cef 100644 --- a/Data/Map/Lazy.hs +++ b/Data/Map/Lazy.hs @@ -120,7 +120,7 @@ module Data.Map.Lazy ( , intersectionWithKey -- ** General combining functions - -- | See "Data.Map.Lazy.Merge" + -- | See "Data.Map.Merge.Lazy" -- ** Unsafe general combining function diff --git a/Data/Map/Merge/Lazy.hs b/Data/Map/Merge/Lazy.hs index 466f150..028acab 100644 --- a/Data/Map/Merge/Lazy.hs +++ b/Data/Map/Merge/Lazy.hs @@ -33,9 +33,9 @@ -- -- The 'merge' and 'mergeA' functions are shared by -- the lazy and strict modules. Only the choice of merge tactics --- determines strictness. If you use 'Data.Map.Strict.Merge.mapMissing' --- from "Data.Map.Strict.Merge" then the results will be forced before --- they are inserted. If you use 'Data.Map.Lazy.Merge.mapMissing' from +-- determines strictness. If you use 'Data.Map.Merge.Strict.mapMissing' +-- from "Data.Map.Merge.Strict" then the results will be forced before +-- they are inserted. If you use 'Data.Map.Merge.Lazy.mapMissing' from -- this module then they will not. -- -- == Efficiency note diff --git a/Data/Map/Merge/Strict.hs b/Data/Map/Merge/Strict.hs index f068c84..f8804a8 100644 --- a/Data/Map/Merge/Strict.hs +++ b/Data/Map/Merge/Strict.hs @@ -33,10 +33,10 @@ -- -- The 'merge' and 'mergeA' functions are shared by -- the lazy and strict modules. Only the choice of merge tactics --- determines strictness. If you use 'Data.Map.Strict.Merge.mapMissing' +-- determines strictness. If you use 'Data.Map.Merge.Strict.mapMissing' -- from this module then the results will be forced before they are --- inserted. If you use 'Data.Map.Lazy.Merge.mapMissing' from --- "Data.Map.Lazy.Merge" then they will not. +-- inserted. If you use 'Data.Map.Merge.Lazy.mapMissing' from +-- "Data.Map.Merge.Lazy" then they will not. -- -- == Efficiency note -- diff --git a/Data/Map/Strict.hs b/Data/Map/Strict.hs index fd77f84..70f41a8 100644 --- a/Data/Map/Strict.hs +++ b/Data/Map/Strict.hs @@ -128,7 +128,7 @@ module Data.Map.Strict , intersectionWithKey -- ** General combining functions - -- | See "Data.Map.Strict.Merge" + -- | See "Data.Map.Merge.Strict" -- ** Deprecated general combining function diff --git a/Data/Map/Strict/Internal.hs b/Data/Map/Strict/Internal.hs index 7a5abf6..928efc1 100644 --- a/Data/Map/Strict/Internal.hs +++ b/Data/Map/Strict/Internal.hs @@ -1193,8 +1193,8 @@ forceMaybe m@(Just !_) = m -- -- WARNING: This function can produce corrupt maps and its results -- may depend on the internal structures of its inputs. Users should --- prefer 'Data.Map.Strict.Merge.merge' or --- 'Data.Map.Strict.Merge.mergeA'. +-- prefer 'Data.Map.Merge.Strict.merge' or +-- 'Data.Map.Merge.Strict.mergeA'. -- -- When 'mergeWithKey' is given three arguments, it is inlined to the call -- site. You should therefore use 'mergeWithKey' only to define custom From git at git.haskell.org Mon Apr 17 21:47:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:47:45 +0000 (UTC) Subject: [commit: packages/containers] merge-fixes-5.9: Merge bug fixes from master (5741caf) Message-ID: <20170417214745.496C13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branch : merge-fixes-5.9 Link : http://git.haskell.org/packages/containers.git/commitdiff/5741cafa295a44e3046e0956790f6e54fcb0ef9b >--------------------------------------------------------------- commit 5741cafa295a44e3046e0956790f6e54fcb0ef9b Author: David Feuer Date: Mon Feb 6 18:52:30 2017 -0500 Merge bug fixes from master >--------------------------------------------------------------- 5741cafa295a44e3046e0956790f6e54fcb0ef9b changelog.md | 11 +++++++++-- containers.cabal | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/changelog.md b/changelog.md index fdbc6fb..5646720 100644 --- a/changelog.md +++ b/changelog.md @@ -1,8 +1,15 @@ # Changelog for [`containers` package](http://github.com/haskell/containers) -## 0.5.9.1 +## 0.5.9.2 + +* Fix completely broken implementations of `restrictKeys` and `withoutKeys` +in `Data.IntMap`. + +* Fix minor bug in `Show1` instance for `Data.Tree`. -* Planned for GHC 8.2. +* Fix broken documentation links. + +## 0.5.9.1 * Add `merge` and `mergeA` for `Data.IntMap`. diff --git a/containers.cabal b/containers.cabal index 71e6cd5..e25dfa5 100644 --- a/containers.cabal +++ b/containers.cabal @@ -1,5 +1,5 @@ name: containers -version: 0.5.9.1 +version: 0.5.9.2 license: BSD3 license-file: LICENSE maintainer: libraries at haskell.org From git at git.haskell.org Mon Apr 17 21:47:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:47:47 +0000 (UTC) Subject: [commit: packages/containers] master, revert-408-bugfix_394: Optimized IntMap's withoutKeys (0ec279b) Message-ID: <20170417214747.52A163A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: master,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/0ec279b318b7cb367df2b9ad8e4a7a957234ad53 >--------------------------------------------------------------- commit 0ec279b318b7cb367df2b9ad8e4a7a957234ad53 Author: wren romano Date: Tue Feb 7 22:38:58 2017 -0800 Optimized IntMap's withoutKeys >--------------------------------------------------------------- 0ec279b318b7cb367df2b9ad8e4a7a957234ad53 Data/IntMap/Internal.hs | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/Data/IntMap/Internal.hs b/Data/IntMap/Internal.hs index c3fe437..081d106 100644 --- a/Data/IntMap/Internal.hs +++ b/Data/IntMap/Internal.hs @@ -1046,26 +1046,39 @@ withoutKeys :: IntMap a -> IntSet.IntSet -> IntMap a withoutKeys = go where go t1@(Bin p1 m1 l1 r1) t2@(IntSet.Bin p2 m2 l2 r2) - | shorter m1 m2 = merge1 - | shorter m2 m1 = merge2 + | shorter m1 m2 = difference1 + | shorter m2 m1 = difference2 | p1 == p2 = bin p1 m1 (go l1 l2) (go r1 r2) | otherwise = t1 where - merge1 | nomatch p2 p1 m1 = t1 - | zero p2 m1 = binCheckLeft p1 m1 (go l1 t2) r1 - | otherwise = binCheckRight p1 m1 l1 (go r1 t2) - merge2 | nomatch p1 p2 m2 = t1 - | zero p1 m2 = bin p2 m2 (go t1 l2) Nil - | otherwise = bin p2 m2 Nil (go t1 r2) - - go t1'@(Bin _ _ _ _) t2'@(IntSet.Tip _ _) = - filterWithKey (\k _ -> k `IntSet.notMember` t2') t1' + difference1 + | nomatch p2 p1 m1 = t1 + | zero p2 m1 = binCheckLeft p1 m1 (go l1 t2) r1 + | otherwise = binCheckRight p1 m1 l1 (go r1 t2) + difference2 + | nomatch p1 p2 m2 = t1 + | zero p1 m2 = go t1 l2 + | otherwise = go t1 r2 + + -- TODO(wrengr): should we inline the top-level 'deleteBM' here? + go t1@(Bin _ _ _ _) (IntSet.Tip kx' bm') = deleteBM kx' bm' t1 + where + deleteBM !kx !bm t@(Bin p m l r) + | nomatch kx p m = t + | zero kx m = binCheckLeft p m (deleteBM kx bm l) r + | otherwise = binCheckRight p m l (deleteBM kx bm r) + deleteBM kx bm t@(Tip ky _) + -- TODO(wrengr): should we inline 'IntSet.member' here? + | ky `IntSet.member` IntSet.Tip kx bm = Nil + | otherwise = t + deleteBM _ _ Nil = Nil go t1@(Bin _ _ _ _) IntSet.Nil = t1 - go t1'@(Tip k1' _) t2' - | k1' `IntSet.member` t2' = Nil - | otherwise = t1' + go t1@(Tip k1 _) t2 + | k1 `IntSet.member` t2 = Nil + | otherwise = t1 + go Nil _ = Nil From git at git.haskell.org Mon Apr 17 21:47:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:47:49 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, revert-408-bugfix_394: Write a liftA2 for Seq (#397) (0e81245) Message-ID: <20170417214749.5CF443A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/0e81245960e1af5ddce78cd5d3f4f73aa7e70d3e >--------------------------------------------------------------- commit 0e81245960e1af5ddce78cd5d3f4f73aa7e70d3e Author: David Feuer Date: Wed Feb 8 13:21:22 2017 -0500 Write a liftA2 for Seq (#397) * Use a custom `liftA2` implementation for Data.Sequence for base 4.10. * Write RULES for `liftA2`. >--------------------------------------------------------------- 0e81245960e1af5ddce78cd5d3f4f73aa7e70d3e Data/Sequence/Internal.hs | 102 ++++++++++++++++++++++++++++++++++++---------- tests/Makefile | 4 +- tests/seq-properties.hs | 18 +++++++- 3 files changed, 99 insertions(+), 25 deletions(-) diff --git a/Data/Sequence/Internal.hs b/Data/Sequence/Internal.hs index 30cab4c..865c9e8 100644 --- a/Data/Sequence/Internal.hs +++ b/Data/Sequence/Internal.hs @@ -174,6 +174,7 @@ module Data.Sequence.Internal ( traverseWithIndex, -- :: Applicative f => (Int -> a -> f b) -> Seq a -> f (Seq b) reverse, -- :: Seq a -> Seq a intersperse, -- :: a -> Seq a -> Seq a + liftA2Seq, -- :: (a -> b -> c) -> Seq a -> Seq b -> Seq c -- ** Zips zip, -- :: Seq a -> Seq b -> Seq (a, b) zipWith, -- :: (a -> b -> c) -> Seq a -> Seq b -> Seq c @@ -432,24 +433,41 @@ instance Monad Seq where instance Applicative Seq where pure = singleton xs *> ys = cycleNTimes (length xs) ys + (<*>) = apSeq +#if MIN_VERSION_base(4,10,0) + liftA2 = liftA2Seq +#endif - fs <*> xs@(Seq xsFT) = case viewl fs of - EmptyL -> empty - firstf :< fs' -> case viewr fs' of - EmptyR -> fmap firstf xs - Seq fs''FT :> lastf -> case rigidify xsFT of - RigidEmpty -> empty - RigidOne (Elem x) -> fmap ($x) fs - RigidTwo (Elem x1) (Elem x2) -> - Seq $ ap2FT firstf fs''FT lastf (x1, x2) - RigidThree (Elem x1) (Elem x2) (Elem x3) -> - Seq $ ap3FT firstf fs''FT lastf (x1, x2, x3) - RigidFull r@(Rigid s pr _m sf) -> Seq $ - Deep (s * length fs) - (fmap (fmap firstf) (nodeToDigit pr)) - (aptyMiddle (fmap firstf) (fmap lastf) fmap fs''FT r) - (fmap (fmap lastf) (nodeToDigit sf)) +apSeq :: Seq (a -> b) -> Seq a -> Seq b +apSeq fs xs@(Seq xsFT) = case viewl fs of + EmptyL -> empty + firstf :< fs' -> case viewr fs' of + EmptyR -> fmap firstf xs + Seq fs''FT :> lastf -> case rigidify xsFT of + RigidEmpty -> empty + RigidOne (Elem x) -> fmap ($x) fs + RigidTwo (Elem x1) (Elem x2) -> + Seq $ ap2FT firstf fs''FT lastf (x1, x2) + RigidThree (Elem x1) (Elem x2) (Elem x3) -> + Seq $ ap3FT firstf fs''FT lastf (x1, x2, x3) + RigidFull r@(Rigid s pr _m sf) -> Seq $ + Deep (s * length fs) + (fmap (fmap firstf) (nodeToDigit pr)) + (aptyMiddle (fmap firstf) (fmap lastf) fmap fs''FT r) + (fmap (fmap lastf) (nodeToDigit sf)) +{-# NOINLINE [1] apSeq #-} +{-# RULES +"ap/fmap" forall f xs ys . apSeq (fmapSeq f xs) ys = liftA2Seq f xs ys +"fmap/ap" forall f gs xs . fmapSeq f (gs `apSeq` xs) = + liftA2Seq (\g x -> f (g x)) gs xs +"fmap/liftA2" forall f g m n . fmapSeq f (liftA2Seq g m n) = + liftA2Seq (\x y -> f (g x y)) m n +"liftA2/fmap1" forall f g m n . liftA2Seq f (fmapSeq g m) n = + liftA2Seq (\x y -> f (g x) y) m n +"liftA2/fmap2" forall f g m n . liftA2Seq f m (fmapSeq g n) = + liftA2Seq (\x y -> f x (g y)) m n + #-} ap2FT :: (a -> b) -> FingerTree (Elem (a->b)) -> (a -> b) -> (a,a) -> FingerTree (Elem b) ap2FT firstf fs lastf (x,y) = @@ -464,6 +482,46 @@ ap3FT firstf fs lastf (x,y,z) = Deep (size fs * 3 + 6) (mapMulFT 3 (\(Elem f) -> Node3 3 (Elem (f x)) (Elem (f y)) (Elem (f z))) fs) (Three (Elem $ lastf x) (Elem $ lastf y) (Elem $ lastf z)) +lift2FT :: (a -> b -> c) -> a -> FingerTree (Elem a) -> a -> (b,b) -> FingerTree (Elem c) +lift2FT f firstx xs lastx (y1,y2) = + Deep (size xs * 2 + 4) + (Two (Elem $ f firstx y1) (Elem $ f firstx y2)) + (mapMulFT 2 (\(Elem x) -> Node2 2 (Elem (f x y1)) (Elem (f x y2))) xs) + (Two (Elem $ f lastx y1) (Elem $ f lastx y2)) + +lift3FT :: (a -> b -> c) -> a -> FingerTree (Elem a) -> a -> (b,b,b) -> FingerTree (Elem c) +lift3FT f firstx xs lastx (y1,y2,y3) = + Deep (size xs * 3 + 6) + (Three (Elem $ f firstx y1) (Elem $ f firstx y2) (Elem $ f firstx y3)) + (mapMulFT 3 (\(Elem x) -> Node3 3 (Elem (f x y1)) (Elem (f x y2)) (Elem (f x y3))) xs) + (Three (Elem $ f lastx y1) (Elem $ f lastx y2) (Elem $ f lastx y3)) + +liftA2Seq :: (a -> b -> c) -> Seq a -> Seq b -> Seq c +liftA2Seq f xs ys@(Seq ysFT) = case viewl xs of + EmptyL -> empty + firstx :< xs' -> case viewr xs' of + EmptyR -> f firstx <$> ys + Seq xs''FT :> lastx -> case rigidify ysFT of + RigidEmpty -> empty + RigidOne (Elem y) -> fmap (\x -> f x y) xs + RigidTwo (Elem y1) (Elem y2) -> + Seq $ lift2FT f firstx xs''FT lastx (y1, y2) + RigidThree (Elem y1) (Elem y2) (Elem y3) -> + Seq $ lift3FT f firstx xs''FT lastx (y1, y2, y3) + RigidFull r@(Rigid s pr _m sf) -> Seq $ + Deep (s * length xs) + (fmap (fmap (f firstx)) (nodeToDigit pr)) + (aptyMiddle (fmap (f firstx)) (fmap (f lastx)) (lift_elem f) xs''FT r) + (fmap (fmap (f lastx)) (nodeToDigit sf)) + where + lift_elem :: (a -> b -> c) -> a -> Elem b -> Elem c +#if __GLASGOW_HASKELL__ >= 708 + lift_elem = coerce +#else + lift_elem f x (Elem y) = Elem (f x y) +#endif +{-# NOINLINE [1] liftA2Seq #-} + data Rigidified a = RigidEmpty | RigidOne a @@ -514,12 +572,12 @@ type Digit23 a = Node a -- class, but as it is we have to build up 'map23' explicitly through the -- recursion. aptyMiddle - :: (c -> d) - -> (c -> d) - -> ((a -> b) -> c -> d) - -> FingerTree (Elem (a -> b)) - -> Rigid c - -> FingerTree (Node d) + :: (b -> c) + -> (b -> c) + -> (a -> b -> c) + -> FingerTree (Elem a) + -> Rigid b + -> FingerTree (Node c) -- Not at the bottom yet diff --git a/tests/Makefile b/tests/Makefile index 69d08ed..231c863 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -8,10 +8,10 @@ all: %-properties: %-properties.hs force - ghc -O2 -DTESTING $< -i.. -o $@ -outputdir tmp + ghc -I../include -O2 -DTESTING $< -i.. -o $@ -outputdir tmp %-strict-properties: %-properties.hs force - ghc -O2 -DTESTING -DSTRICT $< -o $@ -i.. -outputdir tmp + ghc -I../include -O2 -DTESTING -DSTRICT $< -o $@ -i.. -outputdir tmp .PHONY: force clean force: diff --git a/tests/seq-properties.hs b/tests/seq-properties.hs index e162bc4..35cdab2 100644 --- a/tests/seq-properties.hs +++ b/tests/seq-properties.hs @@ -16,7 +16,7 @@ import Data.Sequence.Internal import Data.Sequence -import Control.Applicative (Applicative(..)) +import Control.Applicative (Applicative(..), liftA2) import Control.Arrow ((***)) import Control.Monad.Trans.State.Strict import Data.Array (listArray) @@ -133,6 +133,8 @@ main = defaultMain , testProperty "munzip-lazy" prop_munzipLazy #endif , testProperty "<*>" prop_ap + , testProperty "<*> NOINLINE" prop_ap_NOINLINE + , testProperty "liftA2" prop_liftA2 , testProperty "*>" prop_then , testProperty "cycleTaking" prop_cycleTaking , testProperty "intersperse" prop_intersperse @@ -746,6 +748,20 @@ prop_ap :: Seq A -> Seq B -> Bool prop_ap xs ys = toList' ((,) <$> xs <*> ys) ~= ( (,) <$> toList xs <*> toList ys ) +prop_ap_NOINLINE :: Seq A -> Seq B -> Bool +prop_ap_NOINLINE xs ys = + toList' (((,) <$> xs) `apNOINLINE` ys) ~= ( (,) <$> toList xs <*> toList ys ) + +{-# NOINLINE apNOINLINE #-} +apNOINLINE :: Seq (a -> b) -> Seq a -> Seq b +apNOINLINE fs xs = fs <*> xs + +prop_liftA2 :: Seq A -> Seq B -> Property +prop_liftA2 xs ys = valid q .&&. + toList q === liftA2 (,) (toList xs) (toList ys) + where + q = liftA2 (,) xs ys + prop_then :: Seq A -> Seq B -> Bool prop_then xs ys = toList' (xs *> ys) ~= (toList xs *> toList ys) From git at git.haskell.org Mon Apr 17 21:47:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:47:51 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, revert-408-bugfix_394: liftA2 traverse seq (#398) (31a661c) Message-ID: <20170417214751.6A5E73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/31a661c087e2dcbe29ab638c58e623950574fa9e >--------------------------------------------------------------- commit 31a661c087e2dcbe29ab638c58e623950574fa9e Author: David Feuer Date: Wed Feb 8 13:22:38 2017 -0500 liftA2 traverse seq (#398) * Use a custom `liftA2` implementation for Data.Sequence for base 4.10. * Write RULES for `liftA2`. * Use liftA2 where reasonable in Data.Sequence * Use `liftA2` for `Traversable`, etc. * Scrap `deep'`, `node2'`, and `node3'`. These should no longer be necessary as GHC now inlines unsaturated wrappers. >--------------------------------------------------------------- 31a661c087e2dcbe29ab638c58e623950574fa9e Data/Sequence/Internal.hs | 72 ++++++++++++++++++----------------------------- 1 file changed, 27 insertions(+), 45 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 31a661c087e2dcbe29ab638c58e623950574fa9e From git at git.haskell.org Mon Apr 17 21:47:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:47:53 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, revert-408-bugfix_394: Add ap/fmap2 rule for sequences (53fd934) Message-ID: <20170417214753.749FC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/53fd9342fd8a7ab5d00deb2919593fc9887f44d7 >--------------------------------------------------------------- commit 53fd9342fd8a7ab5d00deb2919593fc9887f44d7 Author: David Feuer Date: Wed Feb 8 14:47:26 2017 -0500 Add ap/fmap2 rule for sequences >--------------------------------------------------------------- 53fd9342fd8a7ab5d00deb2919593fc9887f44d7 Data/Sequence/Internal.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Data/Sequence/Internal.hs b/Data/Sequence/Internal.hs index 7cc5048..71279a8 100644 --- a/Data/Sequence/Internal.hs +++ b/Data/Sequence/Internal.hs @@ -458,7 +458,9 @@ apSeq fs xs@(Seq xsFT) = case viewl fs of {-# NOINLINE [1] apSeq #-} {-# RULES -"ap/fmap" forall f xs ys . apSeq (fmapSeq f xs) ys = liftA2Seq f xs ys +"ap/fmap1" forall f xs ys . apSeq (fmapSeq f xs) ys = liftA2Seq f xs ys +"ap/fmap2" forall f gs xs . apSeq gs (fmapSeq f xs) = + liftA2Seq (\g x -> g (f x)) gs xs "fmap/ap" forall f gs xs . fmapSeq f (gs `apSeq` xs) = liftA2Seq (\g x -> f (g x)) gs xs "fmap/liftA2" forall f g m n . fmapSeq f (liftA2Seq g m n) = From git at git.haskell.org Mon Apr 17 21:47:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:47:55 +0000 (UTC) Subject: [commit: packages/containers] master, revert-408-bugfix_394: Optimized IntMap's restrictKeys (0d3b13f) Message-ID: <20170417214755.7DEFD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: master,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/0d3b13f554b001f4631beb59fa3bcdede9344d02 >--------------------------------------------------------------- commit 0d3b13f554b001f4631beb59fa3bcdede9344d02 Author: wren romano Date: Wed Feb 8 17:03:44 2017 -0800 Optimized IntMap's restrictKeys >--------------------------------------------------------------- 0d3b13f554b001f4631beb59fa3bcdede9344d02 Data/IntMap/Internal.hs | 123 +++++++++++++++++++++++++----------------------- 1 file changed, 63 insertions(+), 60 deletions(-) diff --git a/Data/IntMap/Internal.hs b/Data/IntMap/Internal.hs index 081d106..9f2e35d 100644 --- a/Data/IntMap/Internal.hs +++ b/Data/IntMap/Internal.hs @@ -1043,43 +1043,37 @@ differenceWithKey f m1 m2 -- -- @since 0.5.8 withoutKeys :: IntMap a -> IntSet.IntSet -> IntMap a -withoutKeys = go - where - go t1@(Bin p1 m1 l1 r1) t2@(IntSet.Bin p2 m2 l2 r2) - | shorter m1 m2 = difference1 - | shorter m2 m1 = difference2 - | p1 == p2 = bin p1 m1 (go l1 l2) (go r1 r2) - | otherwise = t1 - where - difference1 - | nomatch p2 p1 m1 = t1 - | zero p2 m1 = binCheckLeft p1 m1 (go l1 t2) r1 - | otherwise = binCheckRight p1 m1 l1 (go r1 t2) - difference2 - | nomatch p1 p2 m2 = t1 - | zero p1 m2 = go t1 l2 - | otherwise = go t1 r2 - - -- TODO(wrengr): should we inline the top-level 'deleteBM' here? - go t1@(Bin _ _ _ _) (IntSet.Tip kx' bm') = deleteBM kx' bm' t1 - where - deleteBM !kx !bm t@(Bin p m l r) - | nomatch kx p m = t - | zero kx m = binCheckLeft p m (deleteBM kx bm l) r - | otherwise = binCheckRight p m l (deleteBM kx bm r) - deleteBM kx bm t@(Tip ky _) - -- TODO(wrengr): should we inline 'IntSet.member' here? - | ky `IntSet.member` IntSet.Tip kx bm = Nil - | otherwise = t - deleteBM _ _ Nil = Nil - - go t1@(Bin _ _ _ _) IntSet.Nil = t1 - - go t1@(Tip k1 _) t2 - | k1 `IntSet.member` t2 = Nil - | otherwise = t1 - - go Nil _ = Nil +withoutKeys t1@(Bin p1 m1 l1 r1) t2@(IntSet.Bin p2 m2 l2 r2) + | shorter m1 m2 = difference1 + | shorter m2 m1 = difference2 + | p1 == p2 = bin p1 m1 (withoutKeys l1 l2) (withoutKeys r1 r2) + | otherwise = t1 + where + difference1 + | nomatch p2 p1 m1 = t1 + | zero p2 m1 = binCheckLeft p1 m1 (withoutKeys l1 t2) r1 + | otherwise = binCheckRight p1 m1 l1 (withoutKeys r1 t2) + difference2 + | nomatch p1 p2 m2 = t1 + | zero p1 m2 = withoutKeys t1 l2 + | otherwise = withoutKeys t1 r2 +-- TODO(wrengr): should we inline the top-level 'withoutBM' here? +withoutKeys t1@(Bin _ _ _ _) (IntSet.Tip kx' bm') = withoutBM kx' bm' t1 + where + withoutBM !kx !bm t@(Bin p m l r) + | nomatch kx p m = t + | zero kx m = binCheckLeft p m (withoutBM kx bm l) r + | otherwise = binCheckRight p m l (withoutBM kx bm r) + withoutBM kx bm t@(Tip ky _) + -- TODO(wrengr): should we inline 'IntSet.member' here? + | ky `IntSet.member` IntSet.Tip kx bm = Nil + | otherwise = t + withoutBM _ _ Nil = Nil +withoutKeys t1@(Bin _ _ _ _) IntSet.Nil = t1 +withoutKeys t1@(Tip k1 _) t2 + | k1 `IntSet.member` t2 = Nil + | otherwise = t1 +withoutKeys Nil _ = Nil {-------------------------------------------------------------------- @@ -1101,29 +1095,38 @@ intersection m1 m2 -- -- @since 0.5.8 restrictKeys :: IntMap a -> IntSet.IntSet -> IntMap a -restrictKeys = go - where - go t1@(Bin p1 m1 l1 r1) t2@(IntSet.Bin p2 m2 l2 r2) - | shorter m1 m2 = merge1 - | shorter m2 m1 = merge2 - | p1 == p2 = bin p1 m1 (go l1 l2) (go r1 r2) - | otherwise = Nil - where - merge1 | nomatch p2 p1 m1 = Nil - | zero p2 m1 = bin p1 m1 (go l1 t2) Nil - | otherwise = bin p1 m1 Nil (go r1 t2) - merge2 | nomatch p1 p2 m2 = Nil - | zero p1 m2 = bin p2 m2 (go t1 l2) Nil - | otherwise = bin p2 m2 Nil (go t1 r2) - - go t1'@(Bin _ _ _ _) t2'@(IntSet.Tip _ _) = - filterWithKey (\k _ -> k `IntSet.member` t2') t1' - go (Bin _ _ _ _) IntSet.Nil = Nil - - go t1'@(Tip k1' _) t2' - | k1' `IntSet.member` t2' = t1' - | otherwise = Nil - go Nil _ = Nil +restrictKeys t1@(Bin p1 m1 l1 r1) t2@(IntSet.Bin p2 m2 l2 r2) + | shorter m1 m2 = intersection1 + | shorter m2 m1 = intersection2 + | p1 == p2 = bin p1 m1 (restrictKeys l1 l2) (restrictKeys r1 r2) + | otherwise = Nil + where + intersection1 + | nomatch p2 p1 m1 = Nil + | zero p2 m1 = restrictKeys l1 t2 + | otherwise = restrictKeys r1 t2 + intersection2 + | nomatch p1 p2 m2 = Nil + | zero p1 m2 = restrictKeys t1 l2 + | otherwise = restrictKeys t1 r2 +-- TODO(wrengr): should we inline the top-level 'restrictBM' here? +restrictKeys t1@(Bin _ _ _ _) (IntSet.Tip kx' bm') = restrictBM kx' bm' t1 + where + restrictBM !kx !bm (Bin p1 m1 l1 r1) + | nomatch kx p1 m1 = Nil + | zero kx m1 = restrictBM kx bm l1 + | otherwise = restrictBM kx bm r1 + restrictBM kx bm t@(Tip ky _) + -- TODO(wrengr): should we inline 'IntSet.member' here? + | ky `IntSet.member` IntSet.Tip kx bm = t + | otherwise = Nil + restrictBM _ _ Nil = Nil +restrictKeys (Bin _ _ _ _) IntSet.Nil = Nil +restrictKeys t1@(Tip k1 _) t2 + | k1 `IntSet.member` t2 = t1 + | otherwise = Nil +restrictKeys Nil _ = Nil + -- | /O(n+m)/. The intersection with a combining function. -- From git at git.haskell.org Mon Apr 17 21:47:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:47:57 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, revert-408-bugfix_394: LiftA2 some more, etc. (#399) (71833cf) Message-ID: <20170417214757.85D5E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/71833cf44e7a8c584f03ccf8eae1cec2d93c2c26 >--------------------------------------------------------------- commit 71833cf44e7a8c584f03ccf8eae1cec2d93c2c26 Author: David Feuer Date: Wed Feb 8 20:31:33 2017 -0500 LiftA2 some more, etc. (#399) * Define custom `<$`, `liftA2`, `<*`, and `*>` for `Data.Tree`. * Use `liftA2` as appropriate in `Data.Tree` and `Data.Graph`. >--------------------------------------------------------------- 71833cf44e7a8c584f03ccf8eae1cec2d93c2c26 Data/Graph.hs | 4 ++-- Data/Tree.hs | 18 ++++++++++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Data/Graph.hs b/Data/Graph.hs index ab9e24f..c7f5497 100644 --- a/Data/Graph.hs +++ b/Data/Graph.hs @@ -80,8 +80,8 @@ import qualified Data.IntSet as Set import Data.Tree (Tree(Node), Forest) -- std interfaces -#if !MIN_VERSION_base(4,8,0) import Control.Applicative +#if !MIN_VERSION_base(4,8,0) import qualified Data.Foldable as F import Data.Traversable #else @@ -157,7 +157,7 @@ instance Traversable SCC where traverse f (AcyclicSCC vertex) = AcyclicSCC <$> f vertex traverse _f (CyclicSCC []) = pure (CyclicSCC []) traverse f (CyclicSCC (x : xs)) = - (\x' xs' -> CyclicSCC (x' : xs')) <$> f x <*> traverse f xs + liftA2 (\x' xs' -> CyclicSCC (x' : xs')) (f x) (traverse f xs) instance NFData a => NFData (SCC a) where rnf (AcyclicSCC v) = rnf v diff --git a/Data/Tree.hs b/Data/Tree.hs index bf567d8..83e70e0 100644 --- a/Data/Tree.hs +++ b/Data/Tree.hs @@ -38,8 +38,9 @@ module Data.Tree( #if MIN_VERSION_base(4,8,0) import Data.Foldable (toList) +import Control.Applicative (Applicative(..), liftA2) #else -import Control.Applicative (Applicative(..), (<$>)) +import Control.Applicative (Applicative(..), liftA2, (<$>)) import Data.Foldable (Foldable(foldMap), toList) import Data.Monoid (Monoid(..)) import Data.Traversable (Traversable(traverse)) @@ -73,6 +74,10 @@ import Data.Functor.Classes import Data.Semigroup (Semigroup (..)) #endif +#if !MIN_VERSION_base(4,8,0) +import Data.Functor ((<$)) +#endif + -- | Multi-way trees, also known as /rose trees/. data Tree a = Node { rootLabel :: a, -- ^ label value @@ -128,6 +133,7 @@ INSTANCE_TYPEABLE1(Tree) instance Functor Tree where fmap = fmapTree + x <$ Node _ ts = Node x (map (x <$) ts) fmapTree :: (a -> b) -> Tree a -> Tree b fmapTree f (Node x ts) = Node (f x) (map (fmapTree f) ts) @@ -144,6 +150,14 @@ instance Applicative Tree where pure x = Node x [] Node f tfs <*> tx@(Node x txs) = Node (f x) (map (f <$>) txs ++ map (<*> tx) tfs) +#if MIN_VERSION_base(4,10,0) + liftA2 f (Node x txs) ty@(Node y tys) = + Node (f x y) (map (f x <$>) tys ++ map (\tx -> liftA2 f tx ty) txs) +#endif + Node x txs <* ty@(Node _ tys) = + Node x (map (x <$) tys ++ map (<* ty) txs) + Node _ txs *> ty@(Node y tys) = + Node y (tys ++ map (*> ty) txs) instance Monad Tree where return = pure @@ -151,7 +165,7 @@ instance Monad Tree where where Node x' ts' = f x instance Traversable Tree where - traverse f (Node x ts) = Node <$> f x <*> traverse (traverse f) ts + traverse f (Node x ts) = liftA2 Node (f x) (traverse (traverse f) ts) instance Foldable Tree where foldMap f (Node x ts) = f x `mappend` foldMap (foldMap f) ts From git at git.haskell.org Mon Apr 17 21:47:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:47:59 +0000 (UTC) Subject: [commit: packages/containers] master, revert-408-bugfix_394: Fixed the bugs in restrictKeys/withoutKeys (acc1581) Message-ID: <20170417214759.8EF353A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: master,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/acc158123dde87ca32603d67a4c9a348fa94eb29 >--------------------------------------------------------------- commit acc158123dde87ca32603d67a4c9a348fa94eb29 Author: wren romano Date: Wed Feb 8 19:04:28 2017 -0800 Fixed the bugs in restrictKeys/withoutKeys >--------------------------------------------------------------- acc158123dde87ca32603d67a4c9a348fa94eb29 Data/IntMap/Internal.hs | 56 ++++++++++++++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 22 deletions(-) diff --git a/Data/IntMap/Internal.hs b/Data/IntMap/Internal.hs index 9f2e35d..262b1a9 100644 --- a/Data/IntMap/Internal.hs +++ b/Data/IntMap/Internal.hs @@ -1057,18 +1057,23 @@ withoutKeys t1@(Bin p1 m1 l1 r1) t2@(IntSet.Bin p2 m2 l2 r2) | nomatch p1 p2 m2 = t1 | zero p1 m2 = withoutKeys t1 l2 | otherwise = withoutKeys t1 r2 --- TODO(wrengr): should we inline the top-level 'withoutBM' here? -withoutKeys t1@(Bin _ _ _ _) (IntSet.Tip kx' bm') = withoutBM kx' bm' t1 +withoutKeys t1@(Bin _ _ _ _) (IntSet.Tip kx' bm') = + withoutBM t1 kx' bm' (IntSet.suffixBitMask + 1) where - withoutBM !kx !bm t@(Bin p m l r) - | nomatch kx p m = t - | zero kx m = binCheckLeft p m (withoutBM kx bm l) r - | otherwise = binCheckRight p m l (withoutBM kx bm r) - withoutBM kx bm t@(Tip ky _) - -- TODO(wrengr): should we inline 'IntSet.member' here? - | ky `IntSet.member` IntSet.Tip kx bm = Nil - | otherwise = t - withoutBM _ _ Nil = Nil + -- TODO(wrengr): this is still pretty naive. It could be improved by restricting @t@ on the recursive calls, so that the 'delete' in the basis case is faster. As is, this is linear in the size of the IntSet (as opposed to the previous version which was linear in the size of the IntMap; we want /O(n+m)/ at worst, just like for 'intersection'). + withoutBM t !prefix !_ 0 = delete prefix t + withoutBM t prefix bmask bits = + case intFromNat (natFromInt bits `shiftRL` 1) of + bits2 + | bmask .&. (shiftLL 1 bits2 - 1) == 0 -> + withoutBM t (prefix + bits2) (shiftRL bmask bits2) bits2 + | shiftRL bmask bits2 .&. (shiftLL 1 bits2 - 1) == 0 -> + withoutBM t prefix bmask bits2 + | otherwise -> + -- withoutKeys t (bin prefix bits2 _ _) + withoutBM + (withoutBM t (prefix + bits2) (shiftRL bmask bits2) bits2) + prefix bmask bits2 withoutKeys t1@(Bin _ _ _ _) IntSet.Nil = t1 withoutKeys t1@(Tip k1 _) t2 | k1 `IntSet.member` t2 = Nil @@ -1109,18 +1114,25 @@ restrictKeys t1@(Bin p1 m1 l1 r1) t2@(IntSet.Bin p2 m2 l2 r2) | nomatch p1 p2 m2 = Nil | zero p1 m2 = restrictKeys t1 l2 | otherwise = restrictKeys t1 r2 --- TODO(wrengr): should we inline the top-level 'restrictBM' here? -restrictKeys t1@(Bin _ _ _ _) (IntSet.Tip kx' bm') = restrictBM kx' bm' t1 +restrictKeys t1@(Bin _ _ _ _) (IntSet.Tip kx' bm') = + restrictBM t1 kx' bm' (IntSet.suffixBitMask + 1) where - restrictBM !kx !bm (Bin p1 m1 l1 r1) - | nomatch kx p1 m1 = Nil - | zero kx m1 = restrictBM kx bm l1 - | otherwise = restrictBM kx bm r1 - restrictBM kx bm t@(Tip ky _) - -- TODO(wrengr): should we inline 'IntSet.member' here? - | ky `IntSet.member` IntSet.Tip kx bm = t - | otherwise = Nil - restrictBM _ _ Nil = Nil + -- TODO(wrengr): this is still pretty naive. It could be improved by restricting @t@ on the recursive calls, so that the 'lookup' in the basis case is faster. As is, this is linear in the size of the IntSet (as opposed to the previous version which was linear in the size of the IntMap; we want /O(n+m)/ at worst, just like for 'intersection'). + restrictBM t !prefix !_ 0 = + case lookup prefix t of + Nothing -> Nil + Just x -> Tip prefix x + restrictBM t prefix bmask bits = + case intFromNat (natFromInt bits `shiftRL` 1) of + bits2 + | bmask .&. (shiftLL 1 bits2 - 1) == 0 -> + restrictBM t (prefix + bits2) (shiftRL bmask bits2) bits2 + | shiftRL bmask bits2 .&. (shiftLL 1 bits2 - 1) == 0 -> + restrictBM t prefix bmask bits2 + | otherwise -> + bin prefix bits2 + (restrictBM t prefix bmask bits2) + (restrictBM t (prefix + bits2) (shiftRL bmask bits2) bits2) restrictKeys (Bin _ _ _ _) IntSet.Nil = Nil restrictKeys t1@(Tip k1 _) t2 | k1 `IntSet.member` t2 = t1 From git at git.haskell.org Mon Apr 17 21:48:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:48:01 +0000 (UTC) Subject: [commit: packages/containers] master, revert-408-bugfix_394: Adding comments, and un-nesting restrictBM and withoutBM (60b9812) Message-ID: <20170417214801.987C23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: master,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/60b98128c95804367eee5c7d29250ff15700adef >--------------------------------------------------------------- commit 60b98128c95804367eee5c7d29250ff15700adef Author: wren romano Date: Wed Feb 8 19:29:56 2017 -0800 Adding comments, and un-nesting restrictBM and withoutBM The un-nesting is to guarantee that we don't accidentally close over things. >--------------------------------------------------------------- 60b98128c95804367eee5c7d29250ff15700adef Data/IntMap/Internal.hs | 96 ++++++++++++++++++++++++++++++------------------- 1 file changed, 60 insertions(+), 36 deletions(-) diff --git a/Data/IntMap/Internal.hs b/Data/IntMap/Internal.hs index 262b1a9..15d83a4 100644 --- a/Data/IntMap/Internal.hs +++ b/Data/IntMap/Internal.hs @@ -1057,23 +1057,8 @@ withoutKeys t1@(Bin p1 m1 l1 r1) t2@(IntSet.Bin p2 m2 l2 r2) | nomatch p1 p2 m2 = t1 | zero p1 m2 = withoutKeys t1 l2 | otherwise = withoutKeys t1 r2 -withoutKeys t1@(Bin _ _ _ _) (IntSet.Tip kx' bm') = - withoutBM t1 kx' bm' (IntSet.suffixBitMask + 1) - where - -- TODO(wrengr): this is still pretty naive. It could be improved by restricting @t@ on the recursive calls, so that the 'delete' in the basis case is faster. As is, this is linear in the size of the IntSet (as opposed to the previous version which was linear in the size of the IntMap; we want /O(n+m)/ at worst, just like for 'intersection'). - withoutBM t !prefix !_ 0 = delete prefix t - withoutBM t prefix bmask bits = - case intFromNat (natFromInt bits `shiftRL` 1) of - bits2 - | bmask .&. (shiftLL 1 bits2 - 1) == 0 -> - withoutBM t (prefix + bits2) (shiftRL bmask bits2) bits2 - | shiftRL bmask bits2 .&. (shiftLL 1 bits2 - 1) == 0 -> - withoutBM t prefix bmask bits2 - | otherwise -> - -- withoutKeys t (bin prefix bits2 _ _) - withoutBM - (withoutBM t (prefix + bits2) (shiftRL bmask bits2) bits2) - prefix bmask bits2 +withoutKeys t1@(Bin _ _ _ _) (IntSet.Tip p2 bm2) = + withoutBM t1 p2 bm2 (IntSet.suffixBitMask + 1) withoutKeys t1@(Bin _ _ _ _) IntSet.Nil = t1 withoutKeys t1@(Tip k1 _) t2 | k1 `IntSet.member` t2 = Nil @@ -1081,6 +1066,31 @@ withoutKeys t1@(Tip k1 _) t2 withoutKeys Nil _ = Nil +-- TODO(wrengr): Right now this is still pretty naive. It essentially +-- unpacks the 'IntSetBitMap' into a tree-representation, and then +-- calls 'delete' on each element of the set; thus, it is +-- /O(min(m,W) * min(n,W)/. While technically that degenerates to +-- /O(1)/ for a fixed /W/, it's morally equivalent to /O(m * log n)/. +-- Really, we should be able to get this down to /O(n+m)/ just like +-- 'difference' is. One way to do this would be to restrict @t@ +-- on the recursive calls, so that the 'lookup's are cheaper. But +-- we should be able to do even better by avoiding the call to +-- 'lookup' entirely. +withoutBM :: IntMap a -> IntSetPrefix -> IntSetBitMap -> Key -> IntMap a +withoutBM t !prefix !_ 0 = delete prefix t +withoutBM t prefix bmask bits = + case intFromNat (natFromInt bits `shiftRL` 1) of + bits2 + | bmask .&. (shiftLL 1 bits2 - 1) == 0 -> + withoutBM t (prefix + bits2) (shiftRL bmask bits2) bits2 + | shiftRL bmask bits2 .&. (shiftLL 1 bits2 - 1) == 0 -> + withoutBM t prefix bmask bits2 + | otherwise -> + -- withoutKeys t (bin prefix bits2 _ _) + withoutBM + (withoutBM t (prefix + bits2) (shiftRL bmask bits2) bits2) + prefix bmask bits2 + {-------------------------------------------------------------------- Intersection --------------------------------------------------------------------} @@ -1114,25 +1124,8 @@ restrictKeys t1@(Bin p1 m1 l1 r1) t2@(IntSet.Bin p2 m2 l2 r2) | nomatch p1 p2 m2 = Nil | zero p1 m2 = restrictKeys t1 l2 | otherwise = restrictKeys t1 r2 -restrictKeys t1@(Bin _ _ _ _) (IntSet.Tip kx' bm') = - restrictBM t1 kx' bm' (IntSet.suffixBitMask + 1) - where - -- TODO(wrengr): this is still pretty naive. It could be improved by restricting @t@ on the recursive calls, so that the 'lookup' in the basis case is faster. As is, this is linear in the size of the IntSet (as opposed to the previous version which was linear in the size of the IntMap; we want /O(n+m)/ at worst, just like for 'intersection'). - restrictBM t !prefix !_ 0 = - case lookup prefix t of - Nothing -> Nil - Just x -> Tip prefix x - restrictBM t prefix bmask bits = - case intFromNat (natFromInt bits `shiftRL` 1) of - bits2 - | bmask .&. (shiftLL 1 bits2 - 1) == 0 -> - restrictBM t (prefix + bits2) (shiftRL bmask bits2) bits2 - | shiftRL bmask bits2 .&. (shiftLL 1 bits2 - 1) == 0 -> - restrictBM t prefix bmask bits2 - | otherwise -> - bin prefix bits2 - (restrictBM t prefix bmask bits2) - (restrictBM t (prefix + bits2) (shiftRL bmask bits2) bits2) +restrictKeys t1@(Bin _ _ _ _) (IntSet.Tip p2 bm2) = + restrictBM t1 p2 bm2 (IntSet.suffixBitMask + 1) restrictKeys (Bin _ _ _ _) IntSet.Nil = Nil restrictKeys t1@(Tip k1 _) t2 | k1 `IntSet.member` t2 = t1 @@ -1140,6 +1133,37 @@ restrictKeys t1@(Tip k1 _) t2 restrictKeys Nil _ = Nil +type IntSetPrefix = Int +type IntSetBitMap = Word + +-- TODO(wrengr): Right now this is still pretty naive. It essentially +-- unpacks the 'IntSetBitMap' into a tree-representation, and then +-- calls 'lookup' on each element of the set; thus, it is +-- /O(min(m,W) * min(n,W)/. While technically that degenerates to +-- /O(1)/ for a fixed /W/, it's morally equivalent to /O(m * log n)/. +-- Really, we should be able to get this down to /O(n+m)/ just like +-- 'intersection' is. One way to do this would be to restrict @t@ +-- on the recursive calls, so that the 'lookup's are cheaper. But +-- we should be able to do even better by avoiding the call to +-- 'lookup' entirely. +restrictBM :: IntMap a -> IntSetPrefix -> IntSetBitMap -> Key -> IntMap a +restrictBM t !prefix !_ 0 = + case lookup prefix t of + Nothing -> Nil + Just x -> Tip prefix x +restrictBM t prefix bmask bits = + case intFromNat (natFromInt bits `shiftRL` 1) of + bits2 + | bmask .&. (shiftLL 1 bits2 - 1) == 0 -> + restrictBM t (prefix + bits2) (shiftRL bmask bits2) bits2 + | shiftRL bmask bits2 .&. (shiftLL 1 bits2 - 1) == 0 -> + restrictBM t prefix bmask bits2 + | otherwise -> + bin prefix bits2 + (restrictBM t prefix bmask bits2) + (restrictBM t (prefix + bits2) (shiftRL bmask bits2) bits2) + + -- | /O(n+m)/. The intersection with a combining function. -- -- > intersectionWith (++) (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "aA" From git at git.haskell.org Mon Apr 17 21:48:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:48:03 +0000 (UTC) Subject: [commit: packages/containers] master, revert-408-bugfix_394: defined lookupPrefix as part of optimizing restrictKeys (af7bb60) Message-ID: <20170417214803.A0A423A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: master,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/af7bb60b941468ec6785eeab3dc61a837ceda4e9 >--------------------------------------------------------------- commit af7bb60b941468ec6785eeab3dc61a837ceda4e9 Author: wren romano Date: Wed Feb 8 22:09:06 2017 -0800 defined lookupPrefix as part of optimizing restrictKeys >--------------------------------------------------------------- af7bb60b941468ec6785eeab3dc61a837ceda4e9 Data/IntMap/Internal.hs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/Data/IntMap/Internal.hs b/Data/IntMap/Internal.hs index 15d83a4..95e5259 100644 --- a/Data/IntMap/Internal.hs +++ b/Data/IntMap/Internal.hs @@ -1125,7 +1125,7 @@ restrictKeys t1@(Bin p1 m1 l1 r1) t2@(IntSet.Bin p2 m2 l2 r2) | zero p1 m2 = restrictKeys t1 l2 | otherwise = restrictKeys t1 r2 restrictKeys t1@(Bin _ _ _ _) (IntSet.Tip p2 bm2) = - restrictBM t1 p2 bm2 (IntSet.suffixBitMask + 1) + restrictBM (lookupPrefix p2 bm2 t1) p2 bm2 (IntSet.suffixBitMask + 1) restrictKeys (Bin _ _ _ _) IntSet.Nil = Nil restrictKeys t1@(Tip k1 _) t2 | k1 `IntSet.member` t2 = t1 @@ -1136,6 +1136,21 @@ restrictKeys Nil _ = Nil type IntSetPrefix = Int type IntSetBitMap = Word +-- | Find the sub-tree of @t@ which matches the prefix @kp at . +lookupPrefix :: IntSetPrefix -> IntSetBitMap -> IntMap a -> IntMap a +lookupPrefix !kp !bm t@(Bin p m l r) + | m .&. IntSet.suffixBitMask /= 0 = + if p .&. IntSet.prefixBitMask == kp then t else Nil + | nomatch kp p m = Nil + | zero kp m = lookupPrefix kp bm l + | otherwise = lookupPrefix kp bm r +lookupPrefix kp bm t@(Tip kx x) + -- TODO(wrengr): need we manually inline 'IntSet.Member' here? + | kx `IntSet.member` IntSet.Tip kp bm = t + | otherwise = Nil +lookupPrefix _ _ Nil = Nil + + -- TODO(wrengr): Right now this is still pretty naive. It essentially -- unpacks the 'IntSetBitMap' into a tree-representation, and then -- calls 'lookup' on each element of the set; thus, it is @@ -1146,6 +1161,11 @@ type IntSetBitMap = Word -- on the recursive calls, so that the 'lookup's are cheaper. But -- we should be able to do even better by avoiding the call to -- 'lookup' entirely. +-- +-- | The initial value passed for the final argument should be +-- @(IntSet.suffixBitMask + 1)@. We don't set that here via +-- worker/wrapper, because this is the worker floated to the +-- top-level. restrictBM :: IntMap a -> IntSetPrefix -> IntSetBitMap -> Key -> IntMap a restrictBM t !prefix !_ 0 = case lookup prefix t of From git at git.haskell.org Mon Apr 17 21:48:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:48:05 +0000 (UTC) Subject: [commit: packages/containers] master, revert-408-bugfix_394: improved the call to restrictBM by pruning the BitMap first (b3a8d85) Message-ID: <20170417214805.AA8983A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: master,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/b3a8d85028c750a9e468938dfcf2719129693046 >--------------------------------------------------------------- commit b3a8d85028c750a9e468938dfcf2719129693046 Author: wren romano Date: Wed Feb 8 22:44:41 2017 -0800 improved the call to restrictBM by pruning the BitMap first >--------------------------------------------------------------- b3a8d85028c750a9e468938dfcf2719129693046 Data/IntMap/Internal.hs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Data/IntMap/Internal.hs b/Data/IntMap/Internal.hs index 95e5259..07d8171 100644 --- a/Data/IntMap/Internal.hs +++ b/Data/IntMap/Internal.hs @@ -1125,7 +1125,19 @@ restrictKeys t1@(Bin p1 m1 l1 r1) t2@(IntSet.Bin p2 m2 l2 r2) | zero p1 m2 = restrictKeys t1 l2 | otherwise = restrictKeys t1 r2 restrictKeys t1@(Bin _ _ _ _) (IntSet.Tip p2 bm2) = - restrictBM (lookupPrefix p2 bm2 t1) p2 bm2 (IntSet.suffixBitMask + 1) + case lookupPrefix p2 bm2 t1 of + t1'@(Bin p1 _ _ _) -> + -- Get the IntSet.BitMap for the IntSet-suffix of @p1 at . We + -- know this corresponds to the smallest possible key in + -- @t1'@, so we generate a mask for all the bitmaps of keys + -- greater than or equal to this smallest-possible-key and + -- only look at that subset of @bm2 at . + let p1_bit = shiftLL 1 (p1 .&. IntSet.suffixBitMask) + bitsLT = p1_bit - 1 + bitsGE = complement bitsLT + bm2' = bm2 .&. bitsGE + in restrictBM t1' p2 bm2' (IntSet.suffixBitMask + 1) + t1' -> t1' restrictKeys (Bin _ _ _ _) IntSet.Nil = Nil restrictKeys t1@(Tip k1 _) t2 | k1 `IntSet.member` t2 = t1 @@ -1144,7 +1156,7 @@ lookupPrefix !kp !bm t@(Bin p m l r) | nomatch kp p m = Nil | zero kp m = lookupPrefix kp bm l | otherwise = lookupPrefix kp bm r -lookupPrefix kp bm t@(Tip kx x) +lookupPrefix kp bm t@(Tip kx _) -- TODO(wrengr): need we manually inline 'IntSet.Member' here? | kx `IntSet.member` IntSet.Tip kp bm = t | otherwise = Nil From git at git.haskell.org Mon Apr 17 21:48:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:48:07 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, revert-408-bugfix_394: liftA2 update for Data.Map and Data.IntMap (#403) (48a1aa2) Message-ID: <20170417214807.B94D03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/48a1aa2851f497921632afb22a7ed56e3cb40d84 >--------------------------------------------------------------- commit 48a1aa2851f497921632afb22a7ed56e3cb40d84 Author: David Feuer Date: Thu Feb 9 18:19:26 2017 -0500 liftA2 update for Data.Map and Data.IntMap (#403) * liftA2 update for `Data.Map` and `Data.IntMap`. * Changelog update and fixes. >--------------------------------------------------------------- 48a1aa2851f497921632afb22a7ed56e3cb40d84 Data/IntMap/Internal.hs | 41 +++++++++++++++++++++-------------------- Data/Map/Internal.hs | 20 +++++++++++--------- Data/Map/Strict/Internal.hs | 8 +++++--- changelog.md | 21 ++++++++++++++++++--- 4 files changed, 55 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 48a1aa2851f497921632afb22a7ed56e3cb40d84 From git at git.haskell.org Mon Apr 17 21:48:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:48:09 +0000 (UTC) Subject: [commit: packages/containers] master, revert-408-bugfix_394: reverted buggy optimization (bb06c50) Message-ID: <20170417214809.C301C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: master,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/bb06c501932f9c469b4794bb2bacefc0bcc2b5c0 >--------------------------------------------------------------- commit bb06c501932f9c469b4794bb2bacefc0bcc2b5c0 Author: wren romano Date: Mon Feb 13 20:29:24 2017 -0800 reverted buggy optimization >--------------------------------------------------------------- bb06c501932f9c469b4794bb2bacefc0bcc2b5c0 Data/IntMap/Internal.hs | 18 +++++++++++++----- tests/intmap-properties.hs | 12 ++++++++---- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/Data/IntMap/Internal.hs b/Data/IntMap/Internal.hs index 07d8171..4277eac 100644 --- a/Data/IntMap/Internal.hs +++ b/Data/IntMap/Internal.hs @@ -1132,11 +1132,19 @@ restrictKeys t1@(Bin _ _ _ _) (IntSet.Tip p2 bm2) = -- @t1'@, so we generate a mask for all the bitmaps of keys -- greater than or equal to this smallest-possible-key and -- only look at that subset of @bm2 at . - let p1_bit = shiftLL 1 (p1 .&. IntSet.suffixBitMask) - bitsLT = p1_bit - 1 - bitsGE = complement bitsLT - bm2' = bm2 .&. bitsGE - in restrictBM t1' p2 bm2' (IntSet.suffixBitMask + 1) + let s1 :: IntSetPrefix + s1 = p1 .&. IntSet.suffixBitMask + s1_bitmap :: IntSetBitMap + s1_bitmap = shiftLL 1 s1 + bitsLT_s1 :: IntSetBitMap + bitsLT_s1 = s1_bitmap - 1 + bitsGE_s1 :: IntSetBitMap + bitsGE_s1 = complement bitsLT_s1 + + -- TODO(wrengr): in principle this should be sound to use in place of @bm2 at . But why isn't it working? + bm2' :: IntSetBitMap + bm2' = bm2 .&. bitsGE_s1 + in restrictBM t1' p2 bm2 (IntSet.suffixBitMask + 1) t1' -> t1' restrictKeys (Bin _ _ _ _) IntSet.Nil = Nil restrictKeys t1@(Tip k1 _) t2 diff --git a/tests/intmap-properties.hs b/tests/intmap-properties.hs index a6fbe2f..7cad004 100644 --- a/tests/intmap-properties.hs +++ b/tests/intmap-properties.hs @@ -805,17 +805,21 @@ prop_intersectionWithKeyModel xs ys ys' = List.nubBy ((==) `on` fst) ys f k l r = k + 2 * l + 3 * r +-- TODO: the second argument should be simply an 'IntSet', but that +-- runs afoul of our orphan instance. prop_restrictKeys :: IMap -> IMap -> Property -prop_restrictKeys m s0 = m `restrictKeys` s === filterWithKey (\k _ -> k `IntSet.member` s) m +prop_restrictKeys m s0 = + m `restrictKeys` s === filterWithKey (\k _ -> k `IntSet.member` s) m where s = keysSet s0 - restricted = restrictKeys m s +-- TODO: the second argument should be simply an 'IntSet', but that +-- runs afoul of our orphan instance. prop_withoutKeys :: IMap -> IMap -> Property -prop_withoutKeys m s0 = m `withoutKeys` s === filterWithKey (\k _ -> k `IntSet.notMember` s) m +prop_withoutKeys m s0 = + m `withoutKeys` s === filterWithKey (\k _ -> k `IntSet.notMember` s) m where s = keysSet s0 - reduced = withoutKeys m s prop_mergeWithKeyModel :: [(Int,Int)] -> [(Int,Int)] -> Bool prop_mergeWithKeyModel xs ys From git at git.haskell.org Mon Apr 17 21:48:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:48:11 +0000 (UTC) Subject: [commit: packages/containers] master, revert-408-bugfix_394: Fixed the restrictKeys optimization! (1a73639) Message-ID: <20170417214811.CBF9D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: master,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/1a73639a347b2a7a9005aa2f7d3b122c2da8de1b >--------------------------------------------------------------- commit 1a73639a347b2a7a9005aa2f7d3b122c2da8de1b Author: wren romano Date: Mon Feb 13 20:46:59 2017 -0800 Fixed the restrictKeys optimization! >--------------------------------------------------------------- 1a73639a347b2a7a9005aa2f7d3b122c2da8de1b Data/IntMap/Internal.hs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/Data/IntMap/Internal.hs b/Data/IntMap/Internal.hs index 4277eac..fd02e19 100644 --- a/Data/IntMap/Internal.hs +++ b/Data/IntMap/Internal.hs @@ -1126,22 +1126,23 @@ restrictKeys t1@(Bin p1 m1 l1 r1) t2@(IntSet.Bin p2 m2 l2 r2) | otherwise = restrictKeys t1 r2 restrictKeys t1@(Bin _ _ _ _) (IntSet.Tip p2 bm2) = case lookupPrefix p2 bm2 t1 of - t1'@(Bin p1 _ _ _) -> - -- Get the IntSet.BitMap for the IntSet-suffix of @p1 at . We - -- know this corresponds to the smallest possible key in - -- @t1'@, so we generate a mask for all the bitmaps of keys - -- greater than or equal to this smallest-possible-key and - -- only look at that subset of @bm2 at . - let s1 :: IntSetPrefix - s1 = p1 .&. IntSet.suffixBitMask + t1'@(Bin p1 m1 _ _) -> + let + -- The bitmap-index of the smallest key possibly in @t1'@. + -- N.B., we must mask @p1@ because the low bits aren't + -- guaranteed to be clear! + s1 :: Int + s1 = mask p1 m1 .&. IntSet.suffixBitMask + -- @s1@ as a bitmap. s1_bitmap :: IntSetBitMap s1_bitmap = shiftLL 1 s1 + -- Bitmap of all keys strictly less than @s1 at . bitsLT_s1 :: IntSetBitMap bitsLT_s1 = s1_bitmap - 1 + -- Bitmap of all keys greater than or equal to @s1 at . bitsGE_s1 :: IntSetBitMap bitsGE_s1 = complement bitsLT_s1 - - -- TODO(wrengr): in principle this should be sound to use in place of @bm2 at . But why isn't it working? + -- Restrict @bm2@ to keys which could possibly occur in @t1'@. bm2' :: IntSetBitMap bm2' = bm2 .&. bitsGE_s1 in restrictBM t1' p2 bm2 (IntSet.suffixBitMask + 1) From git at git.haskell.org Mon Apr 17 21:48:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:48:13 +0000 (UTC) Subject: [commit: packages/containers] master, revert-408-bugfix_394: enhanced the bitmap restriction in restrictKeys to also mask out too-large keys (c61287f) Message-ID: <20170417214813.D61C03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: master,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/c61287fa7255ae7e63f12f883def3fc80a2b2f36 >--------------------------------------------------------------- commit c61287fa7255ae7e63f12f883def3fc80a2b2f36 Author: wren romano Date: Mon Feb 13 21:23:59 2017 -0800 enhanced the bitmap restriction in restrictKeys to also mask out too-large keys >--------------------------------------------------------------- c61287fa7255ae7e63f12f883def3fc80a2b2f36 Data/IntMap/Internal.hs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Data/IntMap/Internal.hs b/Data/IntMap/Internal.hs index fd02e19..26c42b3 100644 --- a/Data/IntMap/Internal.hs +++ b/Data/IntMap/Internal.hs @@ -1131,20 +1131,20 @@ restrictKeys t1@(Bin _ _ _ _) (IntSet.Tip p2 bm2) = -- The bitmap-index of the smallest key possibly in @t1'@. -- N.B., we must mask @p1@ because the low bits aren't -- guaranteed to be clear! - s1 :: Int - s1 = mask p1 m1 .&. IntSet.suffixBitMask - -- @s1@ as a bitmap. - s1_bitmap :: IntSetBitMap - s1_bitmap = shiftLL 1 s1 - -- Bitmap of all keys strictly less than @s1 at . - bitsLT_s1 :: IntSetBitMap - bitsLT_s1 = s1_bitmap - 1 - -- Bitmap of all keys greater than or equal to @s1 at . - bitsGE_s1 :: IntSetBitMap - bitsGE_s1 = complement bitsLT_s1 + minkey :: Prefix + minkey = mask p1 m1 .&. IntSet.suffixBitMask + -- Bitmap of all keys greater than or equal to @minkey at . + largeEnoughKeys :: IntSetBitMap + largeEnoughKeys = complement (shiftLL 1 minkey - 1) + -- The bitmap for the largest key possibly in @t1'@. + maxbit :: IntSetBitMap + maxbit = shiftLL 1 (m1 .|. (minkey - 1)) + -- Bitmap of all keys less than or equal to @maxkey at . + smallEnoughKeys :: IntSetBitMap + smallEnoughKeys = maxbit .|. (maxbit - 1) -- Restrict @bm2@ to keys which could possibly occur in @t1'@. bm2' :: IntSetBitMap - bm2' = bm2 .&. bitsGE_s1 + bm2' = bm2 .&. largeEnoughKeys .&. smallEnoughKeys in restrictBM t1' p2 bm2 (IntSet.suffixBitMask + 1) t1' -> t1' restrictKeys (Bin _ _ _ _) IntSet.Nil = Nil From git at git.haskell.org Mon Apr 17 21:48:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:48:15 +0000 (UTC) Subject: [commit: packages/containers] master, revert-408-bugfix_394: floated out bitmapForBin from restrictKeys (c277357) Message-ID: <20170417214815.DEF3A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: master,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/c2773575bab5909f2e0b4739cd76790cf377948c >--------------------------------------------------------------- commit c2773575bab5909f2e0b4739cd76790cf377948c Author: wren romano Date: Mon Feb 13 21:56:22 2017 -0800 floated out bitmapForBin from restrictKeys The previous version only appeared non-buggy because we forgot a prime mark on @bm@ when calling `restrictBM`. This version is buggy because it corrects that oversight. >--------------------------------------------------------------- c2773575bab5909f2e0b4739cd76790cf377948c Data/IntMap/Internal.hs | 48 +++++++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/Data/IntMap/Internal.hs b/Data/IntMap/Internal.hs index 26c42b3..8390a2a 100644 --- a/Data/IntMap/Internal.hs +++ b/Data/IntMap/Internal.hs @@ -1127,25 +1127,10 @@ restrictKeys t1@(Bin p1 m1 l1 r1) t2@(IntSet.Bin p2 m2 l2 r2) restrictKeys t1@(Bin _ _ _ _) (IntSet.Tip p2 bm2) = case lookupPrefix p2 bm2 t1 of t1'@(Bin p1 m1 _ _) -> - let - -- The bitmap-index of the smallest key possibly in @t1'@. - -- N.B., we must mask @p1@ because the low bits aren't - -- guaranteed to be clear! - minkey :: Prefix - minkey = mask p1 m1 .&. IntSet.suffixBitMask - -- Bitmap of all keys greater than or equal to @minkey at . - largeEnoughKeys :: IntSetBitMap - largeEnoughKeys = complement (shiftLL 1 minkey - 1) - -- The bitmap for the largest key possibly in @t1'@. - maxbit :: IntSetBitMap - maxbit = shiftLL 1 (m1 .|. (minkey - 1)) - -- Bitmap of all keys less than or equal to @maxkey at . - smallEnoughKeys :: IntSetBitMap - smallEnoughKeys = maxbit .|. (maxbit - 1) - -- Restrict @bm2@ to keys which could possibly occur in @t1'@. - bm2' :: IntSetBitMap - bm2' = bm2 .&. largeEnoughKeys .&. smallEnoughKeys - in restrictBM t1' p2 bm2 (IntSet.suffixBitMask + 1) + -- TODO(wrengr): start with a value for @bits@ based off @minkey@, so `restrictBM` can avoid needing to scan past the known-zero bits for too-small keys. + restrictBM t1' p2 + (bm2 .&. bitmapForBin p1 m1) + (IntSet.suffixBitMask + 1) t1' -> t1' restrictKeys (Bin _ _ _ _) IntSet.Nil = Nil restrictKeys t1@(Tip k1 _) t2 @@ -1172,6 +1157,31 @@ lookupPrefix kp bm t@(Tip kx _) lookupPrefix _ _ Nil = Nil +-- | Return an `IntSet`-bitmap for all keys that could possibly be +-- contained in an `IntMap`-`Bin`. +bitmapForBin :: Prefix -> Mask -> IntSetBitMap +bitmapForBin p m = + largeEnough .&. smallEnough + where + -- The bitmap containing only the smallest key possibly in the tree. + minbit :: IntSetBitMap + minbit = bitmapOf p + -- Bitmap of all keys greater than or equal to @minkey at . + largeEnough :: IntSetBitMap + largeEnough = complement (minbit - 1) + -- The bitmap containing only the largest key possibly in the tree. + maxbit :: IntSetBitMap + maxbit = bitmapOf (p .|. m .|. (m - 1)) + -- Bitmap of all keys less than or equal to @maxkey at . + smallEnough :: IntSetBitMap + smallEnough = maxbit .|. (maxbit - 1) + + bitmapOf :: Int -> IntSetBitMap + bitmapOf i = shiftLL 1 (i .&. IntSet.suffixBitMask) + {-# INLINE bitmapOf #-} +{-# INLINE bitmapForBin #-} + + -- TODO(wrengr): Right now this is still pretty naive. It essentially -- unpacks the 'IntSetBitMap' into a tree-representation, and then -- calls 'lookup' on each element of the set; thus, it is From git at git.haskell.org Mon Apr 17 21:48:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:48:17 +0000 (UTC) Subject: [commit: packages/containers] master, revert-408-bugfix_394: greatly improved restrictBM. bitmapForBin is still buggy though. (b272994) Message-ID: <20170417214817.E93673A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: master,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/b27299481fff36cc91b16240e8755cc6ca70ae4b >--------------------------------------------------------------- commit b27299481fff36cc91b16240e8755cc6ca70ae4b Author: wren romano Date: Wed Feb 15 23:04:17 2017 -0800 greatly improved restrictBM. bitmapForBin is still buggy though. >--------------------------------------------------------------- b27299481fff36cc91b16240e8755cc6ca70ae4b Data/IntMap/Internal.hs | 96 ++++++++++++++++++++++++------------------------- 1 file changed, 46 insertions(+), 50 deletions(-) diff --git a/Data/IntMap/Internal.hs b/Data/IntMap/Internal.hs index 8390a2a..cd0bb65 100644 --- a/Data/IntMap/Internal.hs +++ b/Data/IntMap/Internal.hs @@ -1125,13 +1125,9 @@ restrictKeys t1@(Bin p1 m1 l1 r1) t2@(IntSet.Bin p2 m2 l2 r2) | zero p1 m2 = restrictKeys t1 l2 | otherwise = restrictKeys t1 r2 restrictKeys t1@(Bin _ _ _ _) (IntSet.Tip p2 bm2) = - case lookupPrefix p2 bm2 t1 of - t1'@(Bin p1 m1 _ _) -> - -- TODO(wrengr): start with a value for @bits@ based off @minkey@, so `restrictBM` can avoid needing to scan past the known-zero bits for too-small keys. - restrictBM t1' p2 - (bm2 .&. bitmapForBin p1 m1) - (IntSet.suffixBitMask + 1) - t1' -> t1' + -- TODO(wrengr): should we manually inline/unroll 'lookupPrefix' + -- and 'restrictBM' here, in order to avoid redundant case analyses? + restrictBM bm2 (lookupPrefix p2 t1) restrictKeys (Bin _ _ _ _) IntSet.Nil = Nil restrictKeys t1@(Tip k1 _) t2 | k1 `IntSet.member` t2 = t1 @@ -1143,22 +1139,38 @@ type IntSetPrefix = Int type IntSetBitMap = Word -- | Find the sub-tree of @t@ which matches the prefix @kp at . -lookupPrefix :: IntSetPrefix -> IntSetBitMap -> IntMap a -> IntMap a -lookupPrefix !kp !bm t@(Bin p m l r) +lookupPrefix :: IntSetPrefix -> IntMap a -> IntMap a +lookupPrefix !kp t@(Bin p m l r) | m .&. IntSet.suffixBitMask /= 0 = if p .&. IntSet.prefixBitMask == kp then t else Nil | nomatch kp p m = Nil - | zero kp m = lookupPrefix kp bm l - | otherwise = lookupPrefix kp bm r -lookupPrefix kp bm t@(Tip kx _) + | zero kp m = lookupPrefix kp l + | otherwise = lookupPrefix kp r +lookupPrefix kp t@(Tip kx _) + | (kx .&. IntSet.prefixBitMask) == kp = t + | otherwise = Nil +lookupPrefix _ Nil = Nil + + +restrictBM :: IntSetBitMap -> IntMap a -> IntMap a +restrictBM 0 _ = Nil +restrictBM bm (Bin p m l r) = + -- Assuming 'bitmapForBin' actually works correctly... + let m' = intFromNat (natFromInt m `shiftRL` 1) + bmL = bitmapForBin p m' + bmR = bitmapForBin (p .|. m) m' + in bin p m (restrictBM bmL l) (restrictBM bmR r) +restrictBM bm t@(Tip k _) -- TODO(wrengr): need we manually inline 'IntSet.Member' here? - | kx `IntSet.member` IntSet.Tip kp bm = t + | k `IntSet.member` IntSet.Tip (k .&. IntSet.prefixBitMask) bm = t | otherwise = Nil -lookupPrefix _ _ Nil = Nil +restrictBM _ Nil = Nil +-- TODO(wrengr): this is buggy somehow. -- | Return an `IntSet`-bitmap for all keys that could possibly be --- contained in an `IntMap`-`Bin`. +-- contained in an `IntMap`-`Bin` with the given prefix and switching +-- bit. bitmapForBin :: Prefix -> Mask -> IntSetBitMap bitmapForBin p m = largeEnough .&. smallEnough @@ -1182,39 +1194,6 @@ bitmapForBin p m = {-# INLINE bitmapForBin #-} --- TODO(wrengr): Right now this is still pretty naive. It essentially --- unpacks the 'IntSetBitMap' into a tree-representation, and then --- calls 'lookup' on each element of the set; thus, it is --- /O(min(m,W) * min(n,W)/. While technically that degenerates to --- /O(1)/ for a fixed /W/, it's morally equivalent to /O(m * log n)/. --- Really, we should be able to get this down to /O(n+m)/ just like --- 'intersection' is. One way to do this would be to restrict @t@ --- on the recursive calls, so that the 'lookup's are cheaper. But --- we should be able to do even better by avoiding the call to --- 'lookup' entirely. --- --- | The initial value passed for the final argument should be --- @(IntSet.suffixBitMask + 1)@. We don't set that here via --- worker/wrapper, because this is the worker floated to the --- top-level. -restrictBM :: IntMap a -> IntSetPrefix -> IntSetBitMap -> Key -> IntMap a -restrictBM t !prefix !_ 0 = - case lookup prefix t of - Nothing -> Nil - Just x -> Tip prefix x -restrictBM t prefix bmask bits = - case intFromNat (natFromInt bits `shiftRL` 1) of - bits2 - | bmask .&. (shiftLL 1 bits2 - 1) == 0 -> - restrictBM t (prefix + bits2) (shiftRL bmask bits2) bits2 - | shiftRL bmask bits2 .&. (shiftLL 1 bits2 - 1) == 0 -> - restrictBM t prefix bmask bits2 - | otherwise -> - bin prefix bits2 - (restrictBM t prefix bmask bits2) - (restrictBM t (prefix + bits2) (shiftRL bmask bits2) bits2) - - -- | /O(n+m)/. The intersection with a combining function. -- -- > intersectionWith (++) (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "aA" @@ -3169,20 +3148,31 @@ binCheckRight p m l r = Bin p m l r {-------------------------------------------------------------------- Endian independent bit twiddling --------------------------------------------------------------------} + +-- | Should this key follow the left subtree of a 'Bin' with switching +-- bit @m@? N.B., the answer is only valid when @match i p m@ is true. zero :: Key -> Mask -> Bool zero i m = (natFromInt i) .&. (natFromInt m) == 0 {-# INLINE zero #-} nomatch,match :: Key -> Prefix -> Mask -> Bool + +-- | Does the key @i@ differ from the prefix @p@ before getting to +-- the switching bit @m@? nomatch i p m = (mask i m) /= p {-# INLINE nomatch #-} +-- | Does the key @i@ match the prefix @p@ (up to but not including +-- bit @m@)? match i p m = (mask i m) == p {-# INLINE match #-} + +-- | The prefix of key @i@ up to (but not including) the switching +-- bit @m at . mask :: Key -> Mask -> Prefix mask i m = maskW (natFromInt i) (natFromInt m) @@ -3192,16 +3182,21 @@ mask i m {-------------------------------------------------------------------- Big endian operations --------------------------------------------------------------------} + +-- | The prefix of key @i@ up to (but not including) the switching +-- bit @m at . maskW :: Nat -> Nat -> Prefix maskW i m = intFromNat (i .&. (complement (m-1) `xor` m)) {-# INLINE maskW #-} +-- | Does the left switching bit specify a shorter prefix? shorter :: Mask -> Mask -> Bool shorter m1 m2 = (natFromInt m1) > (natFromInt m2) {-# INLINE shorter #-} +-- | The first switching bit where the two prefixes disagree. branchMask :: Prefix -> Prefix -> Mask branchMask p1 p2 = intFromNat (highestBitMask (natFromInt p1 `xor` natFromInt p2)) @@ -3211,8 +3206,9 @@ branchMask p1 p2 Utilities --------------------------------------------------------------------} --- | /O(1)/. Decompose a map into pieces based on the structure of the underlying --- tree. This function is useful for consuming a map in parallel. +-- | /O(1)/. Decompose a map into pieces based on the structure +-- of the underlying tree. This function is useful for consuming a +-- map in parallel. -- -- No guarantee is made as to the sizes of the pieces; an internal, but -- deterministic process determines this. However, it is guaranteed that the From git at git.haskell.org Mon Apr 17 21:48:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:48:19 +0000 (UTC) Subject: [commit: packages/containers] master, revert-408-bugfix_394: commenting out bitmapForBin for now, so things work. (ff975b7) Message-ID: <20170417214819.F26EB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: master,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/ff975b713a04c8ede2238df65c6c0f06d52b19f4 >--------------------------------------------------------------- commit ff975b713a04c8ede2238df65c6c0f06d52b19f4 Author: wren romano Date: Wed Feb 15 23:07:59 2017 -0800 commenting out bitmapForBin for now, so things work. >--------------------------------------------------------------- ff975b713a04c8ede2238df65c6c0f06d52b19f4 Data/IntMap/Internal.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Data/IntMap/Internal.hs b/Data/IntMap/Internal.hs index cd0bb65..c987bdd 100644 --- a/Data/IntMap/Internal.hs +++ b/Data/IntMap/Internal.hs @@ -1153,13 +1153,19 @@ lookupPrefix _ Nil = Nil restrictBM :: IntSetBitMap -> IntMap a -> IntMap a +{- +-- See note below about 'bitmapForBin'. restrictBM 0 _ = Nil +-} restrictBM bm (Bin p m l r) = - -- Assuming 'bitmapForBin' actually works correctly... + {- + -- Assuming 'bitmapForBin' actually worked correctly, this would let us short-circuit by hitting the 0 case above. let m' = intFromNat (natFromInt m `shiftRL` 1) bmL = bitmapForBin p m' bmR = bitmapForBin (p .|. m) m' in bin p m (restrictBM bmL l) (restrictBM bmR r) + -} + bin p m (restrictBM bm l) (restrictBM bm r) restrictBM bm t@(Tip k _) -- TODO(wrengr): need we manually inline 'IntSet.Member' here? | k `IntSet.member` IntSet.Tip (k .&. IntSet.prefixBitMask) bm = t @@ -1167,6 +1173,7 @@ restrictBM bm t@(Tip k _) restrictBM _ Nil = Nil +{- -- TODO(wrengr): this is buggy somehow. -- | Return an `IntSet`-bitmap for all keys that could possibly be -- contained in an `IntMap`-`Bin` with the given prefix and switching @@ -1192,6 +1199,7 @@ bitmapForBin p m = bitmapOf i = shiftLL 1 (i .&. IntSet.suffixBitMask) {-# INLINE bitmapOf #-} {-# INLINE bitmapForBin #-} +-} -- | /O(n+m)/. The intersection with a combining function. From git at git.haskell.org Mon Apr 17 21:48:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:48:22 +0000 (UTC) Subject: [commit: packages/containers] master, revert-408-bugfix_394: Finally fixed restrictBM! (36ea2ed) Message-ID: <20170417214822.0740A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: master,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/36ea2edbdd85d191d4de026c7ba6a02460864c0b >--------------------------------------------------------------- commit 36ea2edbdd85d191d4de026c7ba6a02460864c0b Author: wren romano Date: Thu Feb 16 17:51:16 2017 -0800 Finally fixed restrictBM! >--------------------------------------------------------------- 36ea2edbdd85d191d4de026c7ba6a02460864c0b Data/IntMap/Internal.hs | 46 ++++++---------------------------------------- 1 file changed, 6 insertions(+), 40 deletions(-) diff --git a/Data/IntMap/Internal.hs b/Data/IntMap/Internal.hs index c987bdd..0dc0a47 100644 --- a/Data/IntMap/Internal.hs +++ b/Data/IntMap/Internal.hs @@ -1127,6 +1127,8 @@ restrictKeys t1@(Bin p1 m1 l1 r1) t2@(IntSet.Bin p2 m2 l2 r2) restrictKeys t1@(Bin _ _ _ _) (IntSet.Tip p2 bm2) = -- TODO(wrengr): should we manually inline/unroll 'lookupPrefix' -- and 'restrictBM' here, in order to avoid redundant case analyses? + -- TODO(wrengr): mask out the too-small and too-large keys + -- before entering 'restrictBM', for better IH. restrictBM bm2 (lookupPrefix p2 t1) restrictKeys (Bin _ _ _ _) IntSet.Nil = Nil restrictKeys t1@(Tip k1 _) t2 @@ -1153,19 +1155,12 @@ lookupPrefix _ Nil = Nil restrictBM :: IntSetBitMap -> IntMap a -> IntMap a -{- --- See note below about 'bitmapForBin'. restrictBM 0 _ = Nil --} restrictBM bm (Bin p m l r) = - {- - -- Assuming 'bitmapForBin' actually worked correctly, this would let us short-circuit by hitting the 0 case above. - let m' = intFromNat (natFromInt m `shiftRL` 1) - bmL = bitmapForBin p m' - bmR = bitmapForBin (p .|. m) m' - in bin p m (restrictBM bmL l) (restrictBM bmR r) - -} - bin p m (restrictBM bm l) (restrictBM bm r) + let leftBits = shiftLL 1 ((p .|. m) .&. IntSet.suffixBitMask) - 1 + bmL = bm .&. leftBits + bmR = bm `xor` bmL -- = (bm .&. complement leftBits) + in bin p m (restrictBM bmL l) (restrictBM bmR r) restrictBM bm t@(Tip k _) -- TODO(wrengr): need we manually inline 'IntSet.Member' here? | k `IntSet.member` IntSet.Tip (k .&. IntSet.prefixBitMask) bm = t @@ -1173,35 +1168,6 @@ restrictBM bm t@(Tip k _) restrictBM _ Nil = Nil -{- --- TODO(wrengr): this is buggy somehow. --- | Return an `IntSet`-bitmap for all keys that could possibly be --- contained in an `IntMap`-`Bin` with the given prefix and switching --- bit. -bitmapForBin :: Prefix -> Mask -> IntSetBitMap -bitmapForBin p m = - largeEnough .&. smallEnough - where - -- The bitmap containing only the smallest key possibly in the tree. - minbit :: IntSetBitMap - minbit = bitmapOf p - -- Bitmap of all keys greater than or equal to @minkey at . - largeEnough :: IntSetBitMap - largeEnough = complement (minbit - 1) - -- The bitmap containing only the largest key possibly in the tree. - maxbit :: IntSetBitMap - maxbit = bitmapOf (p .|. m .|. (m - 1)) - -- Bitmap of all keys less than or equal to @maxkey at . - smallEnough :: IntSetBitMap - smallEnough = maxbit .|. (maxbit - 1) - - bitmapOf :: Int -> IntSetBitMap - bitmapOf i = shiftLL 1 (i .&. IntSet.suffixBitMask) - {-# INLINE bitmapOf #-} -{-# INLINE bitmapForBin #-} --} - - -- | /O(n+m)/. The intersection with a combining function. -- -- > intersectionWith (++) (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "aA" From git at git.haskell.org Mon Apr 17 21:48:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:48:24 +0000 (UTC) Subject: [commit: packages/containers] master, revert-408-bugfix_394: cleaning up (5ce1687) Message-ID: <20170417214824.0FA983A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: master,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/5ce1687f163a24f8f13bc5d8054bfa42591772ef >--------------------------------------------------------------- commit 5ce1687f163a24f8f13bc5d8054bfa42591772ef Author: wren romano Date: Thu Feb 16 18:07:29 2017 -0800 cleaning up >--------------------------------------------------------------- 5ce1687f163a24f8f13bc5d8054bfa42591772ef Data/IntMap/Internal.hs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Data/IntMap/Internal.hs b/Data/IntMap/Internal.hs index 0dc0a47..17741b0 100644 --- a/Data/IntMap/Internal.hs +++ b/Data/IntMap/Internal.hs @@ -1124,12 +1124,14 @@ restrictKeys t1@(Bin p1 m1 l1 r1) t2@(IntSet.Bin p2 m2 l2 r2) | nomatch p1 p2 m2 = Nil | zero p1 m2 = restrictKeys t1 l2 | otherwise = restrictKeys t1 r2 -restrictKeys t1@(Bin _ _ _ _) (IntSet.Tip p2 bm2) = +restrictKeys t1@(Bin p1 m1 _ _) (IntSet.Tip p2 bm2) = + let minbit = bitmapOf p1 + ge_minbit = complement (minbit - 1) + maxbit = bitmapOf (p1 .|. (m1 .|. (m1 - 1))) + le_maxbit = maxbit .|. (maxbit - 1) -- TODO(wrengr): should we manually inline/unroll 'lookupPrefix' -- and 'restrictBM' here, in order to avoid redundant case analyses? - -- TODO(wrengr): mask out the too-small and too-large keys - -- before entering 'restrictBM', for better IH. - restrictBM bm2 (lookupPrefix p2 t1) + in restrictBM (bm2 .&. ge_minbit .&. le_maxbit) (lookupPrefix p2 t1) restrictKeys (Bin _ _ _ _) IntSet.Nil = Nil restrictKeys t1@(Tip k1 _) t2 | k1 `IntSet.member` t2 = t1 @@ -1157,7 +1159,7 @@ lookupPrefix _ Nil = Nil restrictBM :: IntSetBitMap -> IntMap a -> IntMap a restrictBM 0 _ = Nil restrictBM bm (Bin p m l r) = - let leftBits = shiftLL 1 ((p .|. m) .&. IntSet.suffixBitMask) - 1 + let leftBits = bitmapOf (p .|. m) - 1 bmL = bm .&. leftBits bmR = bm `xor` bmL -- = (bm .&. complement leftBits) in bin p m (restrictBM bmL l) (restrictBM bmR r) @@ -1168,6 +1170,11 @@ restrictBM bm t@(Tip k _) restrictBM _ Nil = Nil +bitmapOf :: Int -> IntSetBitMap +bitmapOf x = shiftLL 1 (x .&. IntSet.suffixBitMask) +{-# INLINE bitmapOf #-} + + -- | /O(n+m)/. The intersection with a combining function. -- -- > intersectionWith (++) (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "aA" From git at git.haskell.org Mon Apr 17 21:48:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:48:26 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394, master, revert-408-bugfix_394: Optimize withoutKeys and restrictKeys for IntMap (#400) (6d7d49c) Message-ID: <20170417214826.1B3CB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/6d7d49c7755f6f4d036d8b4431b60d173ac572d9 >--------------------------------------------------------------- commit 6d7d49c7755f6f4d036d8b4431b60d173ac572d9 Author: wren romano Date: Sun Feb 19 21:39:42 2017 -0800 Optimize withoutKeys and restrictKeys for IntMap (#400) * Optimized IntMap's withoutKeys * Optimized IntMap's restrictKeys * Defined lookupPrefix as part of optimizing restrictKeys >--------------------------------------------------------------- 6d7d49c7755f6f4d036d8b4431b60d173ac572d9 Data/IntMap/Internal.hs | 180 ++++++++++++++++++++++++++++++++------------- tests/intmap-properties.hs | 12 ++- 2 files changed, 138 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 6d7d49c7755f6f4d036d8b4431b60d173ac572d9 From git at git.haskell.org Mon Apr 17 21:48:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:48:28 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394,master,revert-408-bugfix_394: Bump version; update changelog (1ba6bb5) Message-ID: <20170417214828.23C0F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: cleaned_bugfix394,master,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/1ba6bb512b39ed73631e8680ee59fdabad849045 >--------------------------------------------------------------- commit 1ba6bb512b39ed73631e8680ee59fdabad849045 Author: David Feuer Date: Mon Feb 20 00:44:12 2017 -0500 Bump version; update changelog >--------------------------------------------------------------- 1ba6bb512b39ed73631e8680ee59fdabad849045 changelog.md | 5 ++++- containers.cabal | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 36a3b35..14324ff 100644 --- a/changelog.md +++ b/changelog.md @@ -4,7 +4,10 @@ * Planned for GHC 8.2. -* Define custom `liftA2` in `Applicative` instances for base 4.10, and use +* Optimize `Data.IntMap.restrictKeys` (the semantic fix in 0.5.10.1 left it + rather slow in certain cases). Partially optimize `Data.IntMap.withoutKeys`. + +* Define a custom `liftA2` in `Applicative` instances for base 4.10, and use `liftA2` rather than `<*>` whenever it may be beneficial. * Add `liftA2`-related `RULES` for `Data.Sequence`. diff --git a/containers.cabal b/containers.cabal index e5571c2..99341a9 100644 --- a/containers.cabal +++ b/containers.cabal @@ -1,5 +1,5 @@ name: containers -version: 0.5.10.1 +version: 0.5.10.2 license: BSD3 license-file: LICENSE maintainer: libraries at haskell.org From git at git.haskell.org Mon Apr 17 21:48:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:48:30 +0000 (UTC) Subject: [commit: packages/containers] master, revert-408-bugfix_394: Updated withoutKeys to work efficiently (8ebea94) Message-ID: <20170417214830.2E9383A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: master,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/8ebea94675a67b6132fcc9ca4e2c254dcd0caaee >--------------------------------------------------------------- commit 8ebea94675a67b6132fcc9ca4e2c254dcd0caaee Author: wren romano Date: Mon Feb 20 09:31:20 2017 -0800 Updated withoutKeys to work efficiently >--------------------------------------------------------------- 8ebea94675a67b6132fcc9ca4e2c254dcd0caaee Data/IntMap/Internal.hs | 88 +++++++++++++++++++++++++++++-------------------- 1 file changed, 52 insertions(+), 36 deletions(-) diff --git a/Data/IntMap/Internal.hs b/Data/IntMap/Internal.hs index 17741b0..f2a480b 100644 --- a/Data/IntMap/Internal.hs +++ b/Data/IntMap/Internal.hs @@ -353,6 +353,16 @@ data IntMap a = Bin {-# UNPACK #-} !Prefix type Prefix = Int type Mask = Int + +-- Some stuff from "Data.IntSet.Internal", for 'restrictKeys' and +-- 'withoutKeys' to use. +type IntSetPrefix = Int +type IntSetBitMap = Word + +bitmapOf :: Int -> IntSetBitMap +bitmapOf x = shiftLL 1 (x .&. IntSet.suffixBitMask) +{-# INLINE bitmapOf #-} + {-------------------------------------------------------------------- Operators --------------------------------------------------------------------} @@ -1035,7 +1045,9 @@ differenceWithKey :: (Key -> a -> b -> Maybe a) -> IntMap a -> IntMap b -> IntMa differenceWithKey f m1 m2 = mergeWithKey f id (const Nil) m1 m2 --- | Remove all the keys in a given set from a map. + +-- TODO(wrengr): re-verify that asymptotic bound +-- | /O(n+m)/. Remove all the keys in a given set from a map. -- -- @ -- m `withoutKeys` s = 'filterWithKey' (\k _ -> k `'IntSet.notMember'` s) m @@ -1057,8 +1069,14 @@ withoutKeys t1@(Bin p1 m1 l1 r1) t2@(IntSet.Bin p2 m2 l2 r2) | nomatch p1 p2 m2 = t1 | zero p1 m2 = withoutKeys t1 l2 | otherwise = withoutKeys t1 r2 -withoutKeys t1@(Bin _ _ _ _) (IntSet.Tip p2 bm2) = - withoutBM t1 p2 bm2 (IntSet.suffixBitMask + 1) +withoutKeys t1@(Bin p1 m1 _ _) (IntSet.Tip p2 bm2) = + let minbit = bitmapOf p1 + lt_minbit = minbit - 1 + maxbit = bitmapOf (p1 .|. (m1 .|. (m1 - 1))) + gt_maxbit = maxbit `xor` complement (maxbit - 1) + -- TODO(wrengr): should we manually inline/unroll 'updatePrefix' + -- and 'withoutBM' here, in order to avoid redundant case analyses? + in updatePrefix p2 t1 $ withoutBM (bm2 .|. lt_minbit .|. gt_maxbit) withoutKeys t1@(Bin _ _ _ _) IntSet.Nil = t1 withoutKeys t1@(Tip k1 _) t2 | k1 `IntSet.member` t2 = Nil @@ -1066,30 +1084,33 @@ withoutKeys t1@(Tip k1 _) t2 withoutKeys Nil _ = Nil --- TODO(wrengr): Right now this is still pretty naive. It essentially --- unpacks the 'IntSetBitMap' into a tree-representation, and then --- calls 'delete' on each element of the set; thus, it is --- /O(min(m,W) * min(n,W)/. While technically that degenerates to --- /O(1)/ for a fixed /W/, it's morally equivalent to /O(m * log n)/. --- Really, we should be able to get this down to /O(n+m)/ just like --- 'difference' is. One way to do this would be to restrict @t@ --- on the recursive calls, so that the 'lookup's are cheaper. But --- we should be able to do even better by avoiding the call to --- 'lookup' entirely. -withoutBM :: IntMap a -> IntSetPrefix -> IntSetBitMap -> Key -> IntMap a -withoutBM t !prefix !_ 0 = delete prefix t -withoutBM t prefix bmask bits = - case intFromNat (natFromInt bits `shiftRL` 1) of - bits2 - | bmask .&. (shiftLL 1 bits2 - 1) == 0 -> - withoutBM t (prefix + bits2) (shiftRL bmask bits2) bits2 - | shiftRL bmask bits2 .&. (shiftLL 1 bits2 - 1) == 0 -> - withoutBM t prefix bmask bits2 - | otherwise -> - -- withoutKeys t (bin prefix bits2 _ _) - withoutBM - (withoutBM t (prefix + bits2) (shiftRL bmask bits2) bits2) - prefix bmask bits2 +updatePrefix + :: IntSetPrefix -> IntMap a -> (IntMap a -> IntMap a) -> IntMap a +updatePrefix !kp t@(Bin p m l r) f + | m .&. IntSet.suffixBitMask /= 0 = + if p .&. IntSet.prefixBitMask == kp then f t else t + | nomatch kp p m = t + | zero kp m = binCheckLeft p m (updatePrefix kp l f) r + | otherwise = binCheckRight p m l (updatePrefix kp r f) +updatePrefix kp t@(Tip kx _) f + | kx .&. IntSet.prefixBitMask == kp = f t + | otherwise = t +updatePrefix _ Nil _ = Nil + + +withoutBM :: IntSetBitMap -> IntMap a -> IntMap a +withoutBM 0 t = t +withoutBM bm (Bin p m l r) = + let leftBits = bitmapOf (p .|. m) - 1 + bmL = bm .&. leftBits + bmR = bm `xor` bmL -- = (bm .&. complement leftBits) + in bin p m (withoutBM bmL l) (withoutBM bmR r) +withoutBM bm t@(Tip k _) + -- TODO(wrengr): need we manually inline 'IntSet.Member' here? + | k `IntSet.member` IntSet.Tip (k .&. IntSet.prefixBitMask) bm = Nil + | otherwise = t +withoutBM _ Nil = Nil + {-------------------------------------------------------------------- Intersection @@ -1102,6 +1123,8 @@ intersection :: IntMap a -> IntMap b -> IntMap a intersection m1 m2 = mergeWithKey' bin const (const Nil) (const Nil) m1 m2 + +-- TODO(wrengr): re-verify that asymptotic bound -- | /O(n+m)/. The restriction of a map to the keys in a set. -- -- @ @@ -1139,10 +1162,8 @@ restrictKeys t1@(Tip k1 _) t2 restrictKeys Nil _ = Nil -type IntSetPrefix = Int -type IntSetBitMap = Word - --- | Find the sub-tree of @t@ which matches the prefix @kp at . +-- | /O(min(n,W))/. Restrict to the sub-map with all keys matching +-- a key prefix. lookupPrefix :: IntSetPrefix -> IntMap a -> IntMap a lookupPrefix !kp t@(Bin p m l r) | m .&. IntSet.suffixBitMask /= 0 = @@ -1170,11 +1191,6 @@ restrictBM bm t@(Tip k _) restrictBM _ Nil = Nil -bitmapOf :: Int -> IntSetBitMap -bitmapOf x = shiftLL 1 (x .&. IntSet.suffixBitMask) -{-# INLINE bitmapOf #-} - - -- | /O(n+m)/. The intersection with a combining function. -- -- > intersectionWith (++) (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "aA" From git at git.haskell.org Mon Apr 17 21:48:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:48:32 +0000 (UTC) Subject: [commit: packages/containers] master, revert-408-bugfix_394: Merge branch 'master' into bugfix_394 (cfe5fe3) Message-ID: <20170417214832.3C08E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: master,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/cfe5fe39ce06ff16f1f492e69acac80d3a5d3a16 >--------------------------------------------------------------- commit cfe5fe39ce06ff16f1f492e69acac80d3a5d3a16 Merge: 8ebea94 1ba6bb5 Author: wren romano Date: Mon Feb 20 09:46:29 2017 -0800 Merge branch 'master' into bugfix_394 >--------------------------------------------------------------- cfe5fe39ce06ff16f1f492e69acac80d3a5d3a16 Data/Graph.hs | 4 +- Data/IntMap/Internal.hs | 41 ++++++----- Data/Map/Internal.hs | 20 ++--- Data/Map/Strict/Internal.hs | 8 +- Data/Sequence/Internal.hs | 176 +++++++++++++++++++++++++++----------------- Data/Tree.hs | 18 ++++- changelog.md | 24 +++++- containers.cabal | 2 +- tests/Makefile | 4 +- tests/seq-properties.hs | 18 ++++- 10 files changed, 205 insertions(+), 110 deletions(-) From git at git.haskell.org Mon Apr 17 21:48:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:48:34 +0000 (UTC) Subject: [commit: packages/containers] master, revert-408-bugfix_394: Merge pull request #408 from wrengr/bugfix_394 (1bb2030) Message-ID: <20170417214834.43E4A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branches: master,revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/1bb20305151c643358319d9224e3686cd394092e >--------------------------------------------------------------- commit 1bb20305151c643358319d9224e3686cd394092e Merge: 1ba6bb5 cfe5fe3 Author: wren romano Date: Mon Feb 20 10:33:59 2017 -0800 Merge pull request #408 from wrengr/bugfix_394 Optimize IntMap's withoutKeys >--------------------------------------------------------------- 1bb20305151c643358319d9224e3686cd394092e Data/IntMap/Internal.hs | 88 +++++++++++++++++++++++++++++-------------------- 1 file changed, 52 insertions(+), 36 deletions(-) From git at git.haskell.org Mon Apr 17 21:48:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:48:36 +0000 (UTC) Subject: [commit: packages/containers] revert-408-bugfix_394: Revert "Optimize IntMap's withoutKeys" (ecd7133) Message-ID: <20170417214836.4EBC23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branch : revert-408-bugfix_394 Link : http://git.haskell.org/packages/containers.git/commitdiff/ecd71335670a1b45f16c38a7d16bc099daaffe5e >--------------------------------------------------------------- commit ecd71335670a1b45f16c38a7d16bc099daaffe5e Author: wren romano Date: Mon Feb 20 10:51:38 2017 -0800 Revert "Optimize IntMap's withoutKeys" >--------------------------------------------------------------- ecd71335670a1b45f16c38a7d16bc099daaffe5e Data/IntMap/Internal.hs | 88 ++++++++++++++++++++----------------------------- 1 file changed, 36 insertions(+), 52 deletions(-) diff --git a/Data/IntMap/Internal.hs b/Data/IntMap/Internal.hs index 620ffa8..38468f6 100644 --- a/Data/IntMap/Internal.hs +++ b/Data/IntMap/Internal.hs @@ -354,16 +354,6 @@ data IntMap a = Bin {-# UNPACK #-} !Prefix type Prefix = Int type Mask = Int - --- Some stuff from "Data.IntSet.Internal", for 'restrictKeys' and --- 'withoutKeys' to use. -type IntSetPrefix = Int -type IntSetBitMap = Word - -bitmapOf :: Int -> IntSetBitMap -bitmapOf x = shiftLL 1 (x .&. IntSet.suffixBitMask) -{-# INLINE bitmapOf #-} - {-------------------------------------------------------------------- Operators --------------------------------------------------------------------} @@ -1046,9 +1036,7 @@ differenceWithKey :: (Key -> a -> b -> Maybe a) -> IntMap a -> IntMap b -> IntMa differenceWithKey f m1 m2 = mergeWithKey f id (const Nil) m1 m2 - --- TODO(wrengr): re-verify that asymptotic bound --- | /O(n+m)/. Remove all the keys in a given set from a map. +-- | Remove all the keys in a given set from a map. -- -- @ -- m `withoutKeys` s = 'filterWithKey' (\k _ -> k `'IntSet.notMember'` s) m @@ -1070,14 +1058,8 @@ withoutKeys t1@(Bin p1 m1 l1 r1) t2@(IntSet.Bin p2 m2 l2 r2) | nomatch p1 p2 m2 = t1 | zero p1 m2 = withoutKeys t1 l2 | otherwise = withoutKeys t1 r2 -withoutKeys t1@(Bin p1 m1 _ _) (IntSet.Tip p2 bm2) = - let minbit = bitmapOf p1 - lt_minbit = minbit - 1 - maxbit = bitmapOf (p1 .|. (m1 .|. (m1 - 1))) - gt_maxbit = maxbit `xor` complement (maxbit - 1) - -- TODO(wrengr): should we manually inline/unroll 'updatePrefix' - -- and 'withoutBM' here, in order to avoid redundant case analyses? - in updatePrefix p2 t1 $ withoutBM (bm2 .|. lt_minbit .|. gt_maxbit) +withoutKeys t1@(Bin _ _ _ _) (IntSet.Tip p2 bm2) = + withoutBM t1 p2 bm2 (IntSet.suffixBitMask + 1) withoutKeys t1@(Bin _ _ _ _) IntSet.Nil = t1 withoutKeys t1@(Tip k1 _) t2 | k1 `IntSet.member` t2 = Nil @@ -1085,33 +1067,30 @@ withoutKeys t1@(Tip k1 _) t2 withoutKeys Nil _ = Nil -updatePrefix - :: IntSetPrefix -> IntMap a -> (IntMap a -> IntMap a) -> IntMap a -updatePrefix !kp t@(Bin p m l r) f - | m .&. IntSet.suffixBitMask /= 0 = - if p .&. IntSet.prefixBitMask == kp then f t else t - | nomatch kp p m = t - | zero kp m = binCheckLeft p m (updatePrefix kp l f) r - | otherwise = binCheckRight p m l (updatePrefix kp r f) -updatePrefix kp t@(Tip kx _) f - | kx .&. IntSet.prefixBitMask == kp = f t - | otherwise = t -updatePrefix _ Nil _ = Nil - - -withoutBM :: IntSetBitMap -> IntMap a -> IntMap a -withoutBM 0 t = t -withoutBM bm (Bin p m l r) = - let leftBits = bitmapOf (p .|. m) - 1 - bmL = bm .&. leftBits - bmR = bm `xor` bmL -- = (bm .&. complement leftBits) - in bin p m (withoutBM bmL l) (withoutBM bmR r) -withoutBM bm t@(Tip k _) - -- TODO(wrengr): need we manually inline 'IntSet.Member' here? - | k `IntSet.member` IntSet.Tip (k .&. IntSet.prefixBitMask) bm = Nil - | otherwise = t -withoutBM _ Nil = Nil - +-- TODO(wrengr): Right now this is still pretty naive. It essentially +-- unpacks the 'IntSetBitMap' into a tree-representation, and then +-- calls 'delete' on each element of the set; thus, it is +-- /O(min(m,W) * min(n,W)/. While technically that degenerates to +-- /O(1)/ for a fixed /W/, it's morally equivalent to /O(m * log n)/. +-- Really, we should be able to get this down to /O(n+m)/ just like +-- 'difference' is. One way to do this would be to restrict @t@ +-- on the recursive calls, so that the 'lookup's are cheaper. But +-- we should be able to do even better by avoiding the call to +-- 'lookup' entirely. +withoutBM :: IntMap a -> IntSetPrefix -> IntSetBitMap -> Key -> IntMap a +withoutBM t !prefix !_ 0 = delete prefix t +withoutBM t prefix bmask bits = + case intFromNat (natFromInt bits `shiftRL` 1) of + bits2 + | bmask .&. (shiftLL 1 bits2 - 1) == 0 -> + withoutBM t (prefix + bits2) (shiftRL bmask bits2) bits2 + | shiftRL bmask bits2 .&. (shiftLL 1 bits2 - 1) == 0 -> + withoutBM t prefix bmask bits2 + | otherwise -> + -- withoutKeys t (bin prefix bits2 _ _) + withoutBM + (withoutBM t (prefix + bits2) (shiftRL bmask bits2) bits2) + prefix bmask bits2 {-------------------------------------------------------------------- Intersection @@ -1124,8 +1103,6 @@ intersection :: IntMap a -> IntMap b -> IntMap a intersection m1 m2 = mergeWithKey' bin const (const Nil) (const Nil) m1 m2 - --- TODO(wrengr): re-verify that asymptotic bound -- | /O(n+m)/. The restriction of a map to the keys in a set. -- -- @ @@ -1163,8 +1140,10 @@ restrictKeys t1@(Tip k1 _) t2 restrictKeys Nil _ = Nil --- | /O(min(n,W))/. Restrict to the sub-map with all keys matching --- a key prefix. +type IntSetPrefix = Int +type IntSetBitMap = Word + +-- | Find the sub-tree of @t@ which matches the prefix @kp at . lookupPrefix :: IntSetPrefix -> IntMap a -> IntMap a lookupPrefix !kp t@(Bin p m l r) | m .&. IntSet.suffixBitMask /= 0 = @@ -1192,6 +1171,11 @@ restrictBM bm t@(Tip k _) restrictBM _ Nil = Nil +bitmapOf :: Int -> IntSetBitMap +bitmapOf x = shiftLL 1 (x .&. IntSet.suffixBitMask) +{-# INLINE bitmapOf #-} + + -- | /O(n+m)/. The intersection with a combining function. -- -- > intersectionWith (++) (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "aA" From git at git.haskell.org Mon Apr 17 21:48:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:48:40 +0000 (UTC) Subject: [commit: packages/containers] master: Merge pull request #410 from haskell/revert-408-bugfix_394 (059eaae) Message-ID: <20170417214840.6175C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branch : master Link : http://git.haskell.org/packages/containers.git/commitdiff/059eaae7720bb66bb668de6c6d8dbd6c907dc162 >--------------------------------------------------------------- commit 059eaae7720bb66bb668de6c6d8dbd6c907dc162 Merge: 1bb2030 6dcb45c Author: wren romano Date: Mon Feb 20 11:12:37 2017 -0800 Merge pull request #410 from haskell/revert-408-bugfix_394 Revert "Optimize IntMap's withoutKeys", in order to squash things first (I hope) >--------------------------------------------------------------- 059eaae7720bb66bb668de6c6d8dbd6c907dc162 Data/IntMap/Internal.hs | 88 ++++++++++++++++++++----------------------------- 1 file changed, 36 insertions(+), 52 deletions(-) From git at git.haskell.org Mon Apr 17 21:48:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:48:38 +0000 (UTC) Subject: [commit: packages/containers] master: Revert "Optimize IntMap's withoutKeys" (6dcb45c) Message-ID: <20170417214838.57EEA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branch : master Link : http://git.haskell.org/packages/containers.git/commitdiff/6dcb45c122674df71560d88d214eca23b14431de >--------------------------------------------------------------- commit 6dcb45c122674df71560d88d214eca23b14431de Author: wren romano Date: Mon Feb 20 11:12:14 2017 -0800 Revert "Optimize IntMap's withoutKeys" >--------------------------------------------------------------- 6dcb45c122674df71560d88d214eca23b14431de Data/IntMap/Internal.hs | 88 ++++++++++++++++++++----------------------------- 1 file changed, 36 insertions(+), 52 deletions(-) diff --git a/Data/IntMap/Internal.hs b/Data/IntMap/Internal.hs index 620ffa8..38468f6 100644 --- a/Data/IntMap/Internal.hs +++ b/Data/IntMap/Internal.hs @@ -354,16 +354,6 @@ data IntMap a = Bin {-# UNPACK #-} !Prefix type Prefix = Int type Mask = Int - --- Some stuff from "Data.IntSet.Internal", for 'restrictKeys' and --- 'withoutKeys' to use. -type IntSetPrefix = Int -type IntSetBitMap = Word - -bitmapOf :: Int -> IntSetBitMap -bitmapOf x = shiftLL 1 (x .&. IntSet.suffixBitMask) -{-# INLINE bitmapOf #-} - {-------------------------------------------------------------------- Operators --------------------------------------------------------------------} @@ -1046,9 +1036,7 @@ differenceWithKey :: (Key -> a -> b -> Maybe a) -> IntMap a -> IntMap b -> IntMa differenceWithKey f m1 m2 = mergeWithKey f id (const Nil) m1 m2 - --- TODO(wrengr): re-verify that asymptotic bound --- | /O(n+m)/. Remove all the keys in a given set from a map. +-- | Remove all the keys in a given set from a map. -- -- @ -- m `withoutKeys` s = 'filterWithKey' (\k _ -> k `'IntSet.notMember'` s) m @@ -1070,14 +1058,8 @@ withoutKeys t1@(Bin p1 m1 l1 r1) t2@(IntSet.Bin p2 m2 l2 r2) | nomatch p1 p2 m2 = t1 | zero p1 m2 = withoutKeys t1 l2 | otherwise = withoutKeys t1 r2 -withoutKeys t1@(Bin p1 m1 _ _) (IntSet.Tip p2 bm2) = - let minbit = bitmapOf p1 - lt_minbit = minbit - 1 - maxbit = bitmapOf (p1 .|. (m1 .|. (m1 - 1))) - gt_maxbit = maxbit `xor` complement (maxbit - 1) - -- TODO(wrengr): should we manually inline/unroll 'updatePrefix' - -- and 'withoutBM' here, in order to avoid redundant case analyses? - in updatePrefix p2 t1 $ withoutBM (bm2 .|. lt_minbit .|. gt_maxbit) +withoutKeys t1@(Bin _ _ _ _) (IntSet.Tip p2 bm2) = + withoutBM t1 p2 bm2 (IntSet.suffixBitMask + 1) withoutKeys t1@(Bin _ _ _ _) IntSet.Nil = t1 withoutKeys t1@(Tip k1 _) t2 | k1 `IntSet.member` t2 = Nil @@ -1085,33 +1067,30 @@ withoutKeys t1@(Tip k1 _) t2 withoutKeys Nil _ = Nil -updatePrefix - :: IntSetPrefix -> IntMap a -> (IntMap a -> IntMap a) -> IntMap a -updatePrefix !kp t@(Bin p m l r) f - | m .&. IntSet.suffixBitMask /= 0 = - if p .&. IntSet.prefixBitMask == kp then f t else t - | nomatch kp p m = t - | zero kp m = binCheckLeft p m (updatePrefix kp l f) r - | otherwise = binCheckRight p m l (updatePrefix kp r f) -updatePrefix kp t@(Tip kx _) f - | kx .&. IntSet.prefixBitMask == kp = f t - | otherwise = t -updatePrefix _ Nil _ = Nil - - -withoutBM :: IntSetBitMap -> IntMap a -> IntMap a -withoutBM 0 t = t -withoutBM bm (Bin p m l r) = - let leftBits = bitmapOf (p .|. m) - 1 - bmL = bm .&. leftBits - bmR = bm `xor` bmL -- = (bm .&. complement leftBits) - in bin p m (withoutBM bmL l) (withoutBM bmR r) -withoutBM bm t@(Tip k _) - -- TODO(wrengr): need we manually inline 'IntSet.Member' here? - | k `IntSet.member` IntSet.Tip (k .&. IntSet.prefixBitMask) bm = Nil - | otherwise = t -withoutBM _ Nil = Nil - +-- TODO(wrengr): Right now this is still pretty naive. It essentially +-- unpacks the 'IntSetBitMap' into a tree-representation, and then +-- calls 'delete' on each element of the set; thus, it is +-- /O(min(m,W) * min(n,W)/. While technically that degenerates to +-- /O(1)/ for a fixed /W/, it's morally equivalent to /O(m * log n)/. +-- Really, we should be able to get this down to /O(n+m)/ just like +-- 'difference' is. One way to do this would be to restrict @t@ +-- on the recursive calls, so that the 'lookup's are cheaper. But +-- we should be able to do even better by avoiding the call to +-- 'lookup' entirely. +withoutBM :: IntMap a -> IntSetPrefix -> IntSetBitMap -> Key -> IntMap a +withoutBM t !prefix !_ 0 = delete prefix t +withoutBM t prefix bmask bits = + case intFromNat (natFromInt bits `shiftRL` 1) of + bits2 + | bmask .&. (shiftLL 1 bits2 - 1) == 0 -> + withoutBM t (prefix + bits2) (shiftRL bmask bits2) bits2 + | shiftRL bmask bits2 .&. (shiftLL 1 bits2 - 1) == 0 -> + withoutBM t prefix bmask bits2 + | otherwise -> + -- withoutKeys t (bin prefix bits2 _ _) + withoutBM + (withoutBM t (prefix + bits2) (shiftRL bmask bits2) bits2) + prefix bmask bits2 {-------------------------------------------------------------------- Intersection @@ -1124,8 +1103,6 @@ intersection :: IntMap a -> IntMap b -> IntMap a intersection m1 m2 = mergeWithKey' bin const (const Nil) (const Nil) m1 m2 - --- TODO(wrengr): re-verify that asymptotic bound -- | /O(n+m)/. The restriction of a map to the keys in a set. -- -- @ @@ -1163,8 +1140,10 @@ restrictKeys t1@(Tip k1 _) t2 restrictKeys Nil _ = Nil --- | /O(min(n,W))/. Restrict to the sub-map with all keys matching --- a key prefix. +type IntSetPrefix = Int +type IntSetBitMap = Word + +-- | Find the sub-tree of @t@ which matches the prefix @kp at . lookupPrefix :: IntSetPrefix -> IntMap a -> IntMap a lookupPrefix !kp t@(Bin p m l r) | m .&. IntSet.suffixBitMask /= 0 = @@ -1192,6 +1171,11 @@ restrictBM bm t@(Tip k _) restrictBM _ Nil = Nil +bitmapOf :: Int -> IntSetBitMap +bitmapOf x = shiftLL 1 (x .&. IntSet.suffixBitMask) +{-# INLINE bitmapOf #-} + + -- | /O(n+m)/. The intersection with a combining function. -- -- > intersectionWith (++) (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "aA" From git at git.haskell.org Mon Apr 17 21:48:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:48:42 +0000 (UTC) Subject: [commit: packages/containers] master: Revert "Revert "Optimize IntMap's withoutKeys", in order to squash things first (I hope)" (a22f348) Message-ID: <20170417214842.6B0853A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branch : master Link : http://git.haskell.org/packages/containers.git/commitdiff/a22f3480e569826197b44d3e096ac98d6b36ac5c >--------------------------------------------------------------- commit a22f3480e569826197b44d3e096ac98d6b36ac5c Author: wren romano Date: Mon Feb 20 11:14:37 2017 -0800 Revert "Revert "Optimize IntMap's withoutKeys", in order to squash things first (I hope)" >--------------------------------------------------------------- a22f3480e569826197b44d3e096ac98d6b36ac5c Data/IntMap/Internal.hs | 88 +++++++++++++++++++++++++++++-------------------- 1 file changed, 52 insertions(+), 36 deletions(-) diff --git a/Data/IntMap/Internal.hs b/Data/IntMap/Internal.hs index 38468f6..620ffa8 100644 --- a/Data/IntMap/Internal.hs +++ b/Data/IntMap/Internal.hs @@ -354,6 +354,16 @@ data IntMap a = Bin {-# UNPACK #-} !Prefix type Prefix = Int type Mask = Int + +-- Some stuff from "Data.IntSet.Internal", for 'restrictKeys' and +-- 'withoutKeys' to use. +type IntSetPrefix = Int +type IntSetBitMap = Word + +bitmapOf :: Int -> IntSetBitMap +bitmapOf x = shiftLL 1 (x .&. IntSet.suffixBitMask) +{-# INLINE bitmapOf #-} + {-------------------------------------------------------------------- Operators --------------------------------------------------------------------} @@ -1036,7 +1046,9 @@ differenceWithKey :: (Key -> a -> b -> Maybe a) -> IntMap a -> IntMap b -> IntMa differenceWithKey f m1 m2 = mergeWithKey f id (const Nil) m1 m2 --- | Remove all the keys in a given set from a map. + +-- TODO(wrengr): re-verify that asymptotic bound +-- | /O(n+m)/. Remove all the keys in a given set from a map. -- -- @ -- m `withoutKeys` s = 'filterWithKey' (\k _ -> k `'IntSet.notMember'` s) m @@ -1058,8 +1070,14 @@ withoutKeys t1@(Bin p1 m1 l1 r1) t2@(IntSet.Bin p2 m2 l2 r2) | nomatch p1 p2 m2 = t1 | zero p1 m2 = withoutKeys t1 l2 | otherwise = withoutKeys t1 r2 -withoutKeys t1@(Bin _ _ _ _) (IntSet.Tip p2 bm2) = - withoutBM t1 p2 bm2 (IntSet.suffixBitMask + 1) +withoutKeys t1@(Bin p1 m1 _ _) (IntSet.Tip p2 bm2) = + let minbit = bitmapOf p1 + lt_minbit = minbit - 1 + maxbit = bitmapOf (p1 .|. (m1 .|. (m1 - 1))) + gt_maxbit = maxbit `xor` complement (maxbit - 1) + -- TODO(wrengr): should we manually inline/unroll 'updatePrefix' + -- and 'withoutBM' here, in order to avoid redundant case analyses? + in updatePrefix p2 t1 $ withoutBM (bm2 .|. lt_minbit .|. gt_maxbit) withoutKeys t1@(Bin _ _ _ _) IntSet.Nil = t1 withoutKeys t1@(Tip k1 _) t2 | k1 `IntSet.member` t2 = Nil @@ -1067,30 +1085,33 @@ withoutKeys t1@(Tip k1 _) t2 withoutKeys Nil _ = Nil --- TODO(wrengr): Right now this is still pretty naive. It essentially --- unpacks the 'IntSetBitMap' into a tree-representation, and then --- calls 'delete' on each element of the set; thus, it is --- /O(min(m,W) * min(n,W)/. While technically that degenerates to --- /O(1)/ for a fixed /W/, it's morally equivalent to /O(m * log n)/. --- Really, we should be able to get this down to /O(n+m)/ just like --- 'difference' is. One way to do this would be to restrict @t@ --- on the recursive calls, so that the 'lookup's are cheaper. But --- we should be able to do even better by avoiding the call to --- 'lookup' entirely. -withoutBM :: IntMap a -> IntSetPrefix -> IntSetBitMap -> Key -> IntMap a -withoutBM t !prefix !_ 0 = delete prefix t -withoutBM t prefix bmask bits = - case intFromNat (natFromInt bits `shiftRL` 1) of - bits2 - | bmask .&. (shiftLL 1 bits2 - 1) == 0 -> - withoutBM t (prefix + bits2) (shiftRL bmask bits2) bits2 - | shiftRL bmask bits2 .&. (shiftLL 1 bits2 - 1) == 0 -> - withoutBM t prefix bmask bits2 - | otherwise -> - -- withoutKeys t (bin prefix bits2 _ _) - withoutBM - (withoutBM t (prefix + bits2) (shiftRL bmask bits2) bits2) - prefix bmask bits2 +updatePrefix + :: IntSetPrefix -> IntMap a -> (IntMap a -> IntMap a) -> IntMap a +updatePrefix !kp t@(Bin p m l r) f + | m .&. IntSet.suffixBitMask /= 0 = + if p .&. IntSet.prefixBitMask == kp then f t else t + | nomatch kp p m = t + | zero kp m = binCheckLeft p m (updatePrefix kp l f) r + | otherwise = binCheckRight p m l (updatePrefix kp r f) +updatePrefix kp t@(Tip kx _) f + | kx .&. IntSet.prefixBitMask == kp = f t + | otherwise = t +updatePrefix _ Nil _ = Nil + + +withoutBM :: IntSetBitMap -> IntMap a -> IntMap a +withoutBM 0 t = t +withoutBM bm (Bin p m l r) = + let leftBits = bitmapOf (p .|. m) - 1 + bmL = bm .&. leftBits + bmR = bm `xor` bmL -- = (bm .&. complement leftBits) + in bin p m (withoutBM bmL l) (withoutBM bmR r) +withoutBM bm t@(Tip k _) + -- TODO(wrengr): need we manually inline 'IntSet.Member' here? + | k `IntSet.member` IntSet.Tip (k .&. IntSet.prefixBitMask) bm = Nil + | otherwise = t +withoutBM _ Nil = Nil + {-------------------------------------------------------------------- Intersection @@ -1103,6 +1124,8 @@ intersection :: IntMap a -> IntMap b -> IntMap a intersection m1 m2 = mergeWithKey' bin const (const Nil) (const Nil) m1 m2 + +-- TODO(wrengr): re-verify that asymptotic bound -- | /O(n+m)/. The restriction of a map to the keys in a set. -- -- @ @@ -1140,10 +1163,8 @@ restrictKeys t1@(Tip k1 _) t2 restrictKeys Nil _ = Nil -type IntSetPrefix = Int -type IntSetBitMap = Word - --- | Find the sub-tree of @t@ which matches the prefix @kp at . +-- | /O(min(n,W))/. Restrict to the sub-map with all keys matching +-- a key prefix. lookupPrefix :: IntSetPrefix -> IntMap a -> IntMap a lookupPrefix !kp t@(Bin p m l r) | m .&. IntSet.suffixBitMask /= 0 = @@ -1171,11 +1192,6 @@ restrictBM bm t@(Tip k _) restrictBM _ Nil = Nil -bitmapOf :: Int -> IntSetBitMap -bitmapOf x = shiftLL 1 (x .&. IntSet.suffixBitMask) -{-# INLINE bitmapOf #-} - - -- | /O(n+m)/. The intersection with a combining function. -- -- > intersectionWith (++) (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "aA" From git at git.haskell.org Mon Apr 17 21:48:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:48:44 +0000 (UTC) Subject: [commit: packages/containers] master: Merge pull request #411 from haskell/revert-410-revert-408-bugfix_394 (8168eee) Message-ID: <20170417214844.73B713A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branch : master Link : http://git.haskell.org/packages/containers.git/commitdiff/8168eeedf18cafb280e05fefb3eb41a4e4c09efc >--------------------------------------------------------------- commit 8168eeedf18cafb280e05fefb3eb41a4e4c09efc Merge: 059eaae a22f348 Author: wren romano Date: Mon Feb 20 11:14:55 2017 -0800 Merge pull request #411 from haskell/revert-410-revert-408-bugfix_394 Revert "Revert "Optimize IntMap's withoutKeys", in order to squash things first (I hope)" >--------------------------------------------------------------- 8168eeedf18cafb280e05fefb3eb41a4e4c09efc Data/IntMap/Internal.hs | 88 +++++++++++++++++++++++++++++-------------------- 1 file changed, 52 insertions(+), 36 deletions(-) From git at git.haskell.org Mon Apr 17 21:48:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:48:46 +0000 (UTC) Subject: [commit: packages/containers] cleaned_bugfix394: Updated withoutKeys to work efficiently (c1dddc6) Message-ID: <20170417214846.7CBFD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branch : cleaned_bugfix394 Link : http://git.haskell.org/packages/containers.git/commitdiff/c1dddc638cb041e01c425349ab7836e3c9314897 >--------------------------------------------------------------- commit c1dddc638cb041e01c425349ab7836e3c9314897 Author: David Feuer Date: Wed Feb 8 13:21:22 2017 -0500 Updated withoutKeys to work efficiently >--------------------------------------------------------------- c1dddc638cb041e01c425349ab7836e3c9314897 Data/IntMap/Internal.hs | 88 +++++++++++++++++++++++++++++-------------------- 1 file changed, 52 insertions(+), 36 deletions(-) diff --git a/Data/IntMap/Internal.hs b/Data/IntMap/Internal.hs index 38468f6..620ffa8 100644 --- a/Data/IntMap/Internal.hs +++ b/Data/IntMap/Internal.hs @@ -354,6 +354,16 @@ data IntMap a = Bin {-# UNPACK #-} !Prefix type Prefix = Int type Mask = Int + +-- Some stuff from "Data.IntSet.Internal", for 'restrictKeys' and +-- 'withoutKeys' to use. +type IntSetPrefix = Int +type IntSetBitMap = Word + +bitmapOf :: Int -> IntSetBitMap +bitmapOf x = shiftLL 1 (x .&. IntSet.suffixBitMask) +{-# INLINE bitmapOf #-} + {-------------------------------------------------------------------- Operators --------------------------------------------------------------------} @@ -1036,7 +1046,9 @@ differenceWithKey :: (Key -> a -> b -> Maybe a) -> IntMap a -> IntMap b -> IntMa differenceWithKey f m1 m2 = mergeWithKey f id (const Nil) m1 m2 --- | Remove all the keys in a given set from a map. + +-- TODO(wrengr): re-verify that asymptotic bound +-- | /O(n+m)/. Remove all the keys in a given set from a map. -- -- @ -- m `withoutKeys` s = 'filterWithKey' (\k _ -> k `'IntSet.notMember'` s) m @@ -1058,8 +1070,14 @@ withoutKeys t1@(Bin p1 m1 l1 r1) t2@(IntSet.Bin p2 m2 l2 r2) | nomatch p1 p2 m2 = t1 | zero p1 m2 = withoutKeys t1 l2 | otherwise = withoutKeys t1 r2 -withoutKeys t1@(Bin _ _ _ _) (IntSet.Tip p2 bm2) = - withoutBM t1 p2 bm2 (IntSet.suffixBitMask + 1) +withoutKeys t1@(Bin p1 m1 _ _) (IntSet.Tip p2 bm2) = + let minbit = bitmapOf p1 + lt_minbit = minbit - 1 + maxbit = bitmapOf (p1 .|. (m1 .|. (m1 - 1))) + gt_maxbit = maxbit `xor` complement (maxbit - 1) + -- TODO(wrengr): should we manually inline/unroll 'updatePrefix' + -- and 'withoutBM' here, in order to avoid redundant case analyses? + in updatePrefix p2 t1 $ withoutBM (bm2 .|. lt_minbit .|. gt_maxbit) withoutKeys t1@(Bin _ _ _ _) IntSet.Nil = t1 withoutKeys t1@(Tip k1 _) t2 | k1 `IntSet.member` t2 = Nil @@ -1067,30 +1085,33 @@ withoutKeys t1@(Tip k1 _) t2 withoutKeys Nil _ = Nil --- TODO(wrengr): Right now this is still pretty naive. It essentially --- unpacks the 'IntSetBitMap' into a tree-representation, and then --- calls 'delete' on each element of the set; thus, it is --- /O(min(m,W) * min(n,W)/. While technically that degenerates to --- /O(1)/ for a fixed /W/, it's morally equivalent to /O(m * log n)/. --- Really, we should be able to get this down to /O(n+m)/ just like --- 'difference' is. One way to do this would be to restrict @t@ --- on the recursive calls, so that the 'lookup's are cheaper. But --- we should be able to do even better by avoiding the call to --- 'lookup' entirely. -withoutBM :: IntMap a -> IntSetPrefix -> IntSetBitMap -> Key -> IntMap a -withoutBM t !prefix !_ 0 = delete prefix t -withoutBM t prefix bmask bits = - case intFromNat (natFromInt bits `shiftRL` 1) of - bits2 - | bmask .&. (shiftLL 1 bits2 - 1) == 0 -> - withoutBM t (prefix + bits2) (shiftRL bmask bits2) bits2 - | shiftRL bmask bits2 .&. (shiftLL 1 bits2 - 1) == 0 -> - withoutBM t prefix bmask bits2 - | otherwise -> - -- withoutKeys t (bin prefix bits2 _ _) - withoutBM - (withoutBM t (prefix + bits2) (shiftRL bmask bits2) bits2) - prefix bmask bits2 +updatePrefix + :: IntSetPrefix -> IntMap a -> (IntMap a -> IntMap a) -> IntMap a +updatePrefix !kp t@(Bin p m l r) f + | m .&. IntSet.suffixBitMask /= 0 = + if p .&. IntSet.prefixBitMask == kp then f t else t + | nomatch kp p m = t + | zero kp m = binCheckLeft p m (updatePrefix kp l f) r + | otherwise = binCheckRight p m l (updatePrefix kp r f) +updatePrefix kp t@(Tip kx _) f + | kx .&. IntSet.prefixBitMask == kp = f t + | otherwise = t +updatePrefix _ Nil _ = Nil + + +withoutBM :: IntSetBitMap -> IntMap a -> IntMap a +withoutBM 0 t = t +withoutBM bm (Bin p m l r) = + let leftBits = bitmapOf (p .|. m) - 1 + bmL = bm .&. leftBits + bmR = bm `xor` bmL -- = (bm .&. complement leftBits) + in bin p m (withoutBM bmL l) (withoutBM bmR r) +withoutBM bm t@(Tip k _) + -- TODO(wrengr): need we manually inline 'IntSet.Member' here? + | k `IntSet.member` IntSet.Tip (k .&. IntSet.prefixBitMask) bm = Nil + | otherwise = t +withoutBM _ Nil = Nil + {-------------------------------------------------------------------- Intersection @@ -1103,6 +1124,8 @@ intersection :: IntMap a -> IntMap b -> IntMap a intersection m1 m2 = mergeWithKey' bin const (const Nil) (const Nil) m1 m2 + +-- TODO(wrengr): re-verify that asymptotic bound -- | /O(n+m)/. The restriction of a map to the keys in a set. -- -- @ @@ -1140,10 +1163,8 @@ restrictKeys t1@(Tip k1 _) t2 restrictKeys Nil _ = Nil -type IntSetPrefix = Int -type IntSetBitMap = Word - --- | Find the sub-tree of @t@ which matches the prefix @kp at . +-- | /O(min(n,W))/. Restrict to the sub-map with all keys matching +-- a key prefix. lookupPrefix :: IntSetPrefix -> IntMap a -> IntMap a lookupPrefix !kp t@(Bin p m l r) | m .&. IntSet.suffixBitMask /= 0 = @@ -1171,11 +1192,6 @@ restrictBM bm t@(Tip k _) restrictBM _ Nil = Nil -bitmapOf :: Int -> IntSetBitMap -bitmapOf x = shiftLL 1 (x .&. IntSet.suffixBitMask) -{-# INLINE bitmapOf #-} - - -- | /O(n+m)/. The intersection with a combining function. -- -- > intersectionWith (++) (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "aA" From git at git.haskell.org Mon Apr 17 21:48:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:48:48 +0000 (UTC) Subject: [commit: packages/containers] master: Escape slashes in Haddock (1f10dce) Message-ID: <20170417214848.86D953A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branch : master Link : http://git.haskell.org/packages/containers.git/commitdiff/1f10dcec6116bc598840fb08947d3be36facace2 >--------------------------------------------------------------- commit 1f10dcec6116bc598840fb08947d3be36facace2 Author: David Feuer Date: Mon Feb 20 15:55:51 2017 -0500 Escape slashes in Haddock Fixes #388 >--------------------------------------------------------------- 1f10dcec6116bc598840fb08947d3be36facace2 Data/Map/Internal.hs | 12 ++++++------ Data/Set/Internal.hs | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Data/Map/Internal.hs b/Data/Map/Internal.hs index 861e8f1..d953722 100644 --- a/Data/Map/Internal.hs +++ b/Data/Map/Internal.hs @@ -1851,7 +1851,7 @@ difference t1 (Bin _ k _ l2 r2) = case split k t1 of {-# INLINABLE difference #-} #endif --- | /O(m*log(n/m + 1)), m <= n/. Remove all keys in a 'Set' from a 'Map'. +-- | /O(m*log(n\/m + 1)), m <= n/. Remove all keys in a 'Set' from a 'Map'. -- -- @ -- m `withoutKeys` s = 'filterWithKey' (\k _ -> k `'Set.notMember'` s) m @@ -1931,7 +1931,7 @@ intersection t1@(Bin _ k x l1 r1) t2 {-# INLINABLE intersection #-} #endif --- | /O(m*log(n/m + 1)), m <= n/. Restrict a 'Map' to only those keys +-- | /O(m*log(n\/m + 1)), m <= n/. Restrict a 'Map' to only those keys -- found in a 'Set'. -- -- @ @@ -2589,7 +2589,7 @@ mergeWithKey f g1 g2 = go {-------------------------------------------------------------------- Submap --------------------------------------------------------------------} --- | /O(m*log(n/m + 1)), m <= n/. +-- | /O(m*log(n\/m + 1)), m <= n/. -- This function is defined as (@'isSubmapOf' = 'isSubmapOfBy' (==)@). -- isSubmapOf :: (Ord k,Eq a) => Map k a -> Map k a -> Bool @@ -2598,7 +2598,7 @@ isSubmapOf m1 m2 = isSubmapOfBy (==) m1 m2 {-# INLINABLE isSubmapOf #-} #endif -{- | /O(m*log(n/m + 1)), m <= n/. +{- | /O(m*log(n\/m + 1)), m <= n/. The expression (@'isSubmapOfBy' f t1 t2@) returns 'True' if all keys in @t1@ are in tree @t2@, and when @f@ returns 'True' when applied to their respective values. For example, the following @@ -2636,7 +2636,7 @@ submap' f (Bin _ kx x l r) t {-# INLINABLE submap' #-} #endif --- | /O(m*log(n/m + 1)), m <= n/. Is this a proper submap? (ie. a submap but not equal). +-- | /O(m*log(n\/m + 1)), m <= n/. Is this a proper submap? (ie. a submap but not equal). -- Defined as (@'isProperSubmapOf' = 'isProperSubmapOfBy' (==)@). isProperSubmapOf :: (Ord k,Eq a) => Map k a -> Map k a -> Bool isProperSubmapOf m1 m2 @@ -2645,7 +2645,7 @@ isProperSubmapOf m1 m2 {-# INLINABLE isProperSubmapOf #-} #endif -{- | /O(m*log(n/m + 1)), m <= n/. Is this a proper submap? (ie. a submap but not equal). +{- | /O(m*log(n\/m + 1)), m <= n/. Is this a proper submap? (ie. a submap but not equal). The expression (@'isProperSubmapOfBy' f m1 m2@) returns 'True' when @m1@ and @m2@ are not equal, all keys in @m1@ are in @m2@, and when @f@ returns 'True' when diff --git a/Data/Set/Internal.hs b/Data/Set/Internal.hs index f1a68a0..c2407f1 100644 --- a/Data/Set/Internal.hs +++ b/Data/Set/Internal.hs @@ -669,7 +669,7 @@ unions = foldlStrict union empty {-# INLINABLE unions #-} #endif --- | /O(m*log(n/m + 1)), m <= n/. The union of two sets, preferring the first set when +-- | /O(m*log(n\/m + 1)), m <= n/. The union of two sets, preferring the first set when -- equal elements are encountered. union :: Ord a => Set a -> Set a -> Set a union t1 Tip = t1 @@ -689,7 +689,7 @@ union t1@(Bin _ x l1 r1) t2 = case splitS x t2 of {-------------------------------------------------------------------- Difference --------------------------------------------------------------------} --- | /O(m*log(n/m + 1)), m <= n/. Difference of two sets. +-- | /O(m*log(n\/m + 1)), m <= n/. Difference of two sets. difference :: Ord a => Set a -> Set a -> Set a difference Tip _ = Tip difference t1 Tip = t1 @@ -706,7 +706,7 @@ difference t1 (Bin _ x l2 r2) = case split x t1 of {-------------------------------------------------------------------- Intersection --------------------------------------------------------------------} --- | /O(m*log(n/m + 1)), m <= n/. The intersection of two sets. +-- | /O(m*log(n\/m + 1)), m <= n/. The intersection of two sets. -- Elements of the result come from the first set, so for example -- -- > import qualified Data.Set as S From git at git.haskell.org Mon Apr 17 21:48:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:48:50 +0000 (UTC) Subject: [commit: packages/containers] master: Fix lots of strictness bugs (#412) (7db1d2f) Message-ID: <20170417214850.919AF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branch : master Link : http://git.haskell.org/packages/containers.git/commitdiff/7db1d2fdee5f4c7bc8800142944aa1fac1bdc089 >--------------------------------------------------------------- commit 7db1d2fdee5f4c7bc8800142944aa1fac1bdc089 Author: David Feuer Date: Mon Feb 20 23:01:00 2017 -0500 Fix lots of strictness bugs (#412) * `Data.IntMap.Strict` previously re-exported the lazy `traverseWithKey`. Implement a strict one. * `Data.IntMap.Strict` and `Data.Map.Strict` previously had a number of rewrite rules with strictness bugs. Remove `map/coerce` rules from each and fix the other rules. >--------------------------------------------------------------- 7db1d2fdee5f4c7bc8800142944aa1fac1bdc089 Data/IntMap/Strict.hs | 169 ++++++++++++++++++++++++++++++-------------- Data/Map/Strict/Internal.hs | 16 +++-- changelog.md | 16 ++++- 3 files changed, 138 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 7db1d2fdee5f4c7bc8800142944aa1fac1bdc089 From git at git.haskell.org Mon Apr 17 21:48:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:48:52 +0000 (UTC) Subject: [commit: packages/containers] master: Fix up IntMap showTree deprecation story (#413) (8791f59) Message-ID: <20170417214852.9E9673A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branch : master Link : http://git.haskell.org/packages/containers.git/commitdiff/8791f5915f1cc05573dc4e902e5122bfb5fad7d3 >--------------------------------------------------------------- commit 8791f5915f1cc05573dc4e902e5122bfb5fad7d3 Author: David Feuer Date: Tue Feb 21 00:08:52 2017 -0500 Fix up IntMap showTree deprecation story (#413) Export deprecated copies from the places we don't want them, and non-deprecated originals from internal places we do want them. This allows the test suite to run without warnings, and gives users a way to avoid them when using these functions. >--------------------------------------------------------------- 8791f5915f1cc05573dc4e902e5122bfb5fad7d3 Data/IntMap/Internal.hs | 3 --- Data/IntMap/Internal/Debug.hs | 6 ++++++ Data/IntMap/Internal/DeprecatedDebug.hs | 20 ++++++++++++++++++++ Data/IntMap/Lazy.hs | 3 ++- Data/IntMap/Strict.hs | 7 +++---- containers.cabal | 2 ++ tests/intmap-properties.hs | 5 +++-- 7 files changed, 36 insertions(+), 10 deletions(-) diff --git a/Data/IntMap/Internal.hs b/Data/IntMap/Internal.hs index 620ffa8..9271ba1 100644 --- a/Data/IntMap/Internal.hs +++ b/Data/IntMap/Internal.hs @@ -3236,9 +3236,6 @@ splitRoot orig = {-------------------------------------------------------------------- Debugging --------------------------------------------------------------------} -{-# DEPRECATED showTree, showTreeWith - "These debugging functions will be moved to a separate module in future versions" - #-} -- | /O(n)/. Show the tree that implements the map. The tree is shown -- in a compressed, hanging format. diff --git a/Data/IntMap/Internal/Debug.hs b/Data/IntMap/Internal/Debug.hs new file mode 100644 index 0000000..a30dc69 --- /dev/null +++ b/Data/IntMap/Internal/Debug.hs @@ -0,0 +1,6 @@ +module Data.IntMap.Internal.Debug + ( showTree + , showTreeWith + ) where + +import Data.IntMap.Internal diff --git a/Data/IntMap/Internal/DeprecatedDebug.hs b/Data/IntMap/Internal/DeprecatedDebug.hs new file mode 100644 index 0000000..2894999 --- /dev/null +++ b/Data/IntMap/Internal/DeprecatedDebug.hs @@ -0,0 +1,20 @@ +module Data.IntMap.Internal.DeprecatedDebug where +import qualified Data.IntMap.Internal as IM +import Data.IntMap.Internal (IntMap) + +{-# DEPRECATED showTree, showTreeWith + "These debugging functions will be removed from this module. They are available from Data.IntMap.Internal.Debug." + #-} + +-- | /O(n)/. Show the tree that implements the map. The tree is shown +-- in a compressed, hanging format. +showTree :: Show a => IntMap a -> String +showTree = IM.showTree + +{- | /O(n)/. The expression (@'showTreeWith' hang wide map@) shows + the tree that implements the map. If @hang@ is + 'True', a /hanging/ tree is shown otherwise a rotated tree is shown. If + @wide@ is 'True', an extra wide version is shown. +-} +showTreeWith :: Show a => Bool -> Bool -> IntMap a -> String +showTreeWith = IM.showTreeWith diff --git a/Data/IntMap/Lazy.hs b/Data/IntMap/Lazy.hs index 4fcc168..949ca66 100644 --- a/Data/IntMap/Lazy.hs +++ b/Data/IntMap/Lazy.hs @@ -207,7 +207,8 @@ module Data.IntMap.Lazy ( , showTreeWith ) where -import Data.IntMap.Internal as IM +import Data.IntMap.Internal as IM hiding (showTree, showTreeWith) +import Data.IntMap.Internal.DeprecatedDebug -- $strictness -- diff --git a/Data/IntMap/Strict.hs b/Data/IntMap/Strict.hs index 8f033c5..6106cf9 100644 --- a/Data/IntMap/Strict.hs +++ b/Data/IntMap/Strict.hs @@ -284,8 +284,6 @@ import Data.IntMap.Internal , partition , partitionWithKey , restrictKeys - , showTree - , showTreeWith , size , split , splitLookup @@ -295,8 +293,9 @@ import Data.IntMap.Internal , toList , union , unions - , withoutKeys) - + , withoutKeys + ) +import Data.IntMap.Internal.DeprecatedDebug (showTree, showTreeWith) import qualified Data.IntSet.Internal as IntSet import Utils.Containers.Internal.BitUtil import Utils.Containers.Internal.StrictFold diff --git a/containers.cabal b/containers.cabal index 99341a9..987755d 100644 --- a/containers.cabal +++ b/containers.cabal @@ -45,6 +45,7 @@ Library Data.IntMap.Lazy Data.IntMap.Strict Data.IntMap.Internal + Data.IntMap.Internal.Debug Data.IntMap.Merge.Lazy Data.IntMap.Merge.Strict Data.IntSet.Internal @@ -74,6 +75,7 @@ Library Utils.Containers.Internal.StrictMaybe Utils.Containers.Internal.PtrEquality Data.Map.Internal.DeprecatedShowTree + Data.IntMap.Internal.DeprecatedDebug include-dirs: include diff --git a/tests/intmap-properties.hs b/tests/intmap-properties.hs index 7cad004..db95338 100644 --- a/tests/intmap-properties.hs +++ b/tests/intmap-properties.hs @@ -1,10 +1,11 @@ {-# LANGUAGE CPP #-} #ifdef STRICT -import Data.IntMap.Strict as Data.IntMap +import Data.IntMap.Strict as Data.IntMap hiding (showTree) #else -import Data.IntMap.Lazy as Data.IntMap +import Data.IntMap.Lazy as Data.IntMap hiding (showTree) #endif +import Data.IntMap.Internal.Debug (showTree) import Data.Monoid import Data.Maybe hiding (mapMaybe) From git at git.haskell.org Mon Apr 17 21:48:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:48:54 +0000 (UTC) Subject: [commit: packages/containers] master: Update changelog.md (1a84cc6) Message-ID: <20170417214854.A66443A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branch : master Link : http://git.haskell.org/packages/containers.git/commitdiff/1a84cc6b920a05533f5789d41a5d5d888351cb31 >--------------------------------------------------------------- commit 1a84cc6b920a05533f5789d41a5d5d888351cb31 Author: David Feuer Date: Tue Feb 21 00:10:07 2017 -0500 Update changelog.md >--------------------------------------------------------------- 1a84cc6b920a05533f5789d41a5d5d888351cb31 changelog.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/changelog.md b/changelog.md index e9bbc3d..8ee717e 100644 --- a/changelog.md +++ b/changelog.md @@ -24,6 +24,9 @@ * Add `liftA2`-related `RULES` for `Data.Sequence`. +* Export non-deprecated versions of `showTree` and `showTreeWith` from + `Data.IntMap.Internal.Debug`. + ## 0.5.10.1 * Fix completely incorrect implementations of `Data.IntMap.restrictKeys` and From git at git.haskell.org Mon Apr 17 21:48:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:48:56 +0000 (UTC) Subject: [commit: packages/containers] master: Fix insert worker/wrapper issues (#416) (1fd160a) Message-ID: <20170417214856.B146B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branch : master Link : http://git.haskell.org/packages/containers.git/commitdiff/1fd160a481a7768f287e9f84d8525a354fa75092 >--------------------------------------------------------------- commit 1fd160a481a7768f287e9f84d8525a354fa75092 Author: David Feuer Date: Wed Feb 22 16:56:49 2017 -0500 Fix insert worker/wrapper issues (#416) The new pointer equality version of `insert` in `Data.Map` led to a severe regression in the `last-piece` benchmark of `nofib`. It turned out that worker/wrapper was doing absolutely horrible things to `insert`, breaking the pointer equality tests and also leading to completely unnecessary allocation. This commit adds horrible hacks that seem to prevent this from happening. >--------------------------------------------------------------- 1fd160a481a7768f287e9f84d8525a354fa75092 Data/Map/Internal.hs | 49 +++++++++++++++++++++++++++++++++++++------------ Data/Set/Internal.hs | 24 +++++++++++++++--------- 2 files changed, 52 insertions(+), 21 deletions(-) diff --git a/Data/Map/Internal.hs b/Data/Map/Internal.hs index d953722..55f8544 100644 --- a/Data/Map/Internal.hs +++ b/Data/Map/Internal.hs @@ -388,7 +388,7 @@ import Utils.Containers.Internal.BitUtil (wordSize) #endif #if __GLASGOW_HASKELL__ -import GHC.Exts (build) +import GHC.Exts (build, lazy) #if !MIN_VERSION_base(4,8,0) import Data.Functor ((<$)) #endif @@ -755,32 +755,51 @@ singleton k x = Bin 1 k x Tip Tip -- > insert 5 'x' empty == singleton 5 'x' -- See Note: Type of local 'go' function +-- See Note: Avoiding worker/wrapper insert :: Ord k => k -> a -> Map k a -> Map k a -insert = go +insert kx0 = go kx0 kx0 where -- Unlike insertR, we only get sharing here -- when the inserted value is at the same address - -- as the present value. We try anyway. If we decide - -- not to, then Data.Map.Strict should probably - -- get its own union implementation. - go :: Ord k => k -> a -> Map k a -> Map k a - go !kx x Tip = singleton kx x - go !kx x t@(Bin sz ky y l r) = + -- as the present value. We try anyway; this condition + -- seems particularly likely to occur in 'union'. + go :: Ord k => k -> k -> a -> Map k a -> Map k a + go orig !kx x Tip = singleton (lazy orig) x + go orig !kx x t@(Bin sz ky y l r) = case compare kx ky of LT | l' `ptrEq` l -> t | otherwise -> balanceL ky y l' r - where !l' = go kx x l + where !l' = go orig kx x l GT | r' `ptrEq` r -> t | otherwise -> balanceR ky y l r' - where !r' = go kx x r - EQ | kx `ptrEq` ky && x `ptrEq` y -> t - | otherwise -> Bin sz kx x l r + where !r' = go orig kx x r + EQ | x `ptrEq` y && (lazy orig `seq` (orig `ptrEq` ky)) -> t + | otherwise -> Bin sz (lazy orig) x l r #if __GLASGOW_HASKELL__ {-# INLINABLE insert #-} #else {-# INLINE insert #-} #endif +#ifndef __GLASGOW_HASKELL__ +lazy :: a -> a +lazy a = a +#endif + +-- [Note: Avoiding worker/wrapper] +-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +-- 'insert' has to go to great lengths to get pointer equality right and +-- to prevent unnecessary allocation. The trouble is that GHC *really* wants +-- to unbox the key and throw away the boxed one. This is bad for us, because +-- we want to compare the pointer of the box we are given to the one already +-- present if they compare EQ. It's also bad for us because it leads to the +-- key being *reboxed* if it's actually stored in the map. Ugh! So we pass the +-- 'go' function *two copies* of the key we're given. One of them we use for +-- comparisons; the other we keep in our pocket. To prevent worker/wrapper from +-- messing with the copy in our pocket, we sprinkle about calls to the magical +-- function 'lazy'. This is all horrible, but it seems to work okay. + + -- Insert a new key and value in the map if it is not already present. -- Used by `union`. @@ -1832,6 +1851,12 @@ unionWithKey f (Bin _ k1 x1 l1 r1) t2 = case splitLookup k1 t2 of Difference --------------------------------------------------------------------} +-- We don't currently attempt to use any pointer equality tricks for +-- 'difference'. To do so, we'd have to match on the first argument +-- and split the second. Unfortunately, the proof of the time bound +-- relies on doing it the way we do, and it's not clear whether that +-- bound holds the other way. + -- | /O(m*log(n\/m + 1)), m <= n/. Difference of two maps. -- Return elements of the first map not existing in the second map. -- diff --git a/Data/Set/Internal.hs b/Data/Set/Internal.hs index c2407f1..d0d4394 100644 --- a/Data/Set/Internal.hs +++ b/Data/Set/Internal.hs @@ -239,7 +239,7 @@ import Utils.Containers.Internal.StrictPair import Utils.Containers.Internal.PtrEquality #if __GLASGOW_HASKELL__ -import GHC.Exts ( build ) +import GHC.Exts ( build, lazy ) #if __GLASGOW_HASKELL__ >= 708 import qualified GHC.Exts as GHCExts #endif @@ -505,26 +505,32 @@ singleton x = Bin 1 x Tip Tip -- it is replaced with the new value. -- See Note: Type of local 'go' function +-- See Note: Avoiding worker/wrapper (in Data.Map.Internal) insert :: Ord a => a -> Set a -> Set a -insert = go +insert x0 = go x0 x0 where - go :: Ord a => a -> Set a -> Set a - go !x Tip = singleton x - go !x t@(Bin sz y l r) = case compare x y of + go :: Ord a => a -> a -> Set a -> Set a + go orig !x Tip = singleton (lazy orig) + go orig !x t@(Bin sz y l r) = case compare x y of LT | l' `ptrEq` l -> t | otherwise -> balanceL y l' r - where !l' = go x l + where !l' = go orig x l GT | r' `ptrEq` r -> t | otherwise -> balanceR y l r' - where !r' = go x r - EQ | x `ptrEq` y -> t - | otherwise -> Bin sz x l r + where !r' = go orig x r + EQ | lazy orig `seq` (orig `ptrEq` y) -> t + | otherwise -> Bin sz (lazy orig) l r #if __GLASGOW_HASKELL__ {-# INLINABLE insert #-} #else {-# INLINE insert #-} #endif +#ifndef __GLASGOW_HASKELL__ +lazy :: a -> a +lazy a = a +#endif + -- Insert an element to the set only if it is not in the set. -- Used by `union`. From git at git.haskell.org Mon Apr 17 21:48:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:48:58 +0000 (UTC) Subject: [commit: packages/containers] master: Defeat worker/wrapper in insertR too (#417) (3b7edae) Message-ID: <20170417214858.BB6D03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branch : master Link : http://git.haskell.org/packages/containers.git/commitdiff/3b7edae004997234b433f0986d1180f7401e3d98 >--------------------------------------------------------------- commit 3b7edae004997234b433f0986d1180f7401e3d98 Author: David Feuer Date: Fri Feb 24 12:51:11 2017 -0500 Defeat worker/wrapper in insertR too (#417) >--------------------------------------------------------------- 3b7edae004997234b433f0986d1180f7401e3d98 Data/Map/Internal.hs | 13 +++++++------ Data/Set/Internal.hs | 13 +++++++------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Data/Map/Internal.hs b/Data/Map/Internal.hs index 55f8544..aa1bfcb 100644 --- a/Data/Map/Internal.hs +++ b/Data/Map/Internal.hs @@ -804,19 +804,20 @@ lazy a = a -- Used by `union`. -- See Note: Type of local 'go' function +-- See Note: Avoiding worker/wrapper insertR :: Ord k => k -> a -> Map k a -> Map k a -insertR = go +insertR kx0 = go kx0 kx0 where - go :: Ord k => k -> a -> Map k a -> Map k a - go !kx x Tip = singleton kx x - go kx x t@(Bin _ ky y l r) = + go :: Ord k => k -> k -> a -> Map k a -> Map k a + go orig !kx x Tip = singleton (lazy orig) x + go orig !kx x t@(Bin sz ky y l r) = case compare kx ky of LT | l' `ptrEq` l -> t | otherwise -> balanceL ky y l' r - where !l' = go kx x l + where !l' = go orig kx x l GT | r' `ptrEq` r -> t | otherwise -> balanceR ky y l r' - where !r' = go kx x r + where !r' = go orig kx x r EQ -> t #if __GLASGOW_HASKELL__ {-# INLINABLE insertR #-} diff --git a/Data/Set/Internal.hs b/Data/Set/Internal.hs index d0d4394..3fc47ef 100644 --- a/Data/Set/Internal.hs +++ b/Data/Set/Internal.hs @@ -535,18 +535,19 @@ lazy a = a -- Used by `union`. -- See Note: Type of local 'go' function +-- See Note: Avoiding worker/wrapper (in Data.Map.Internal) insertR :: Ord a => a -> Set a -> Set a -insertR = go +insertR x0 = go x0 x0 where - go :: Ord a => a -> Set a -> Set a - go !x Tip = singleton x - go !x t@(Bin _ y l r) = case compare x y of + go :: Ord a => a -> a -> Set a -> Set a + go orig !x Tip = singleton (lazy orig) + go orig !x t@(Bin sz y l r) = case compare x y of LT | l' `ptrEq` l -> t | otherwise -> balanceL y l' r - where !l' = go x l + where !l' = go orig x l GT | r' `ptrEq` r -> t | otherwise -> balanceR y l r' - where !r' = go x r + where !r' = go orig x r EQ -> t #if __GLASGOW_HASKELL__ {-# INLINABLE insertR #-} From git at git.haskell.org Mon Apr 17 21:49:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:49:00 +0000 (UTC) Subject: [commit: packages/containers] master: Fix unused pattern match warnings (#418) (9e5d789) Message-ID: <20170417214900.C561C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branch : master Link : http://git.haskell.org/packages/containers.git/commitdiff/9e5d789c77b7252fb3fbf7a26f649b96ba20649c >--------------------------------------------------------------- commit 9e5d789c77b7252fb3fbf7a26f649b96ba20649c Author: Ben Gamari Date: Tue Feb 28 13:56:58 2017 -0500 Fix unused pattern match warnings (#418) >--------------------------------------------------------------- 9e5d789c77b7252fb3fbf7a26f649b96ba20649c Data/Map/Internal.hs | 6 +++--- Data/Set/Internal.hs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Data/Map/Internal.hs b/Data/Map/Internal.hs index aa1bfcb..425397e 100644 --- a/Data/Map/Internal.hs +++ b/Data/Map/Internal.hs @@ -764,7 +764,7 @@ insert kx0 = go kx0 kx0 -- as the present value. We try anyway; this condition -- seems particularly likely to occur in 'union'. go :: Ord k => k -> k -> a -> Map k a -> Map k a - go orig !kx x Tip = singleton (lazy orig) x + go orig !_ x Tip = singleton (lazy orig) x go orig !kx x t@(Bin sz ky y l r) = case compare kx ky of LT | l' `ptrEq` l -> t @@ -809,8 +809,8 @@ insertR :: Ord k => k -> a -> Map k a -> Map k a insertR kx0 = go kx0 kx0 where go :: Ord k => k -> k -> a -> Map k a -> Map k a - go orig !kx x Tip = singleton (lazy orig) x - go orig !kx x t@(Bin sz ky y l r) = + go orig !_ x Tip = singleton (lazy orig) x + go orig !kx x t@(Bin _ ky y l r) = case compare kx ky of LT | l' `ptrEq` l -> t | otherwise -> balanceL ky y l' r diff --git a/Data/Set/Internal.hs b/Data/Set/Internal.hs index 3fc47ef..674bf4b 100644 --- a/Data/Set/Internal.hs +++ b/Data/Set/Internal.hs @@ -510,7 +510,7 @@ insert :: Ord a => a -> Set a -> Set a insert x0 = go x0 x0 where go :: Ord a => a -> a -> Set a -> Set a - go orig !x Tip = singleton (lazy orig) + go orig !_ Tip = singleton (lazy orig) go orig !x t@(Bin sz y l r) = case compare x y of LT | l' `ptrEq` l -> t | otherwise -> balanceL y l' r @@ -540,8 +540,8 @@ insertR :: Ord a => a -> Set a -> Set a insertR x0 = go x0 x0 where go :: Ord a => a -> a -> Set a -> Set a - go orig !x Tip = singleton (lazy orig) - go orig !x t@(Bin sz y l r) = case compare x y of + go orig !_ Tip = singleton (lazy orig) + go orig !x t@(Bin _ y l r) = case compare x y of LT | l' `ptrEq` l -> t | otherwise -> balanceL y l' r where !l' = go orig x l From git at git.haskell.org Mon Apr 17 21:49:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:49:02 +0000 (UTC) Subject: [commit: packages/containers] master: Add COMPLETE pragmas for Data.Sequence (f42e932) Message-ID: <20170417214902.D1BDC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branch : master Link : http://git.haskell.org/packages/containers.git/commitdiff/f42e9321dc1ba5f3bc58101b6dec9beb43a80a0a >--------------------------------------------------------------- commit f42e9321dc1ba5f3bc58101b6dec9beb43a80a0a Author: David Feuer Date: Tue Feb 28 21:52:36 2017 -0500 Add COMPLETE pragmas for Data.Sequence GHC 8.2 allows us to declare sets of pattern synonyms complete. We happily do so! >--------------------------------------------------------------- f42e9321dc1ba5f3bc58101b6dec9beb43a80a0a Data/Sequence/Internal.hs | 7 ++++--- changelog.md | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Data/Sequence/Internal.hs b/Data/Sequence/Internal.hs index 71279a8..9879321 100644 --- a/Data/Sequence/Internal.hs +++ b/Data/Sequence/Internal.hs @@ -286,9 +286,10 @@ infixl 5 |>, :> infixr 5 :<| infixl 5 :|> --- TODO: Once GHC implements some way to prevent non-exhaustive --- pattern match warnings for pattern synonyms, we should be --- sure to take advantage of that. +#if __GLASGOW_HASKELL__ >= 801 +{-# COMPLETE (:<|), Empty #-} +{-# COMPLETE (:|>), Empty #-} +#endif -- | A pattern synonym matching an empty sequence. pattern Empty :: Seq a diff --git a/changelog.md b/changelog.md index 8ee717e..418406a 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,9 @@ * Planned for GHC 8.2. +* Use `COMPLETE` pragmas to declare complete sets of pattern synonyms + for `Data.Sequence`. At last! + * Make `Data.IntMap.Strict.traverseWithKey` force the values before installing them in the result. Previously, this function could be used to produce an `IntMap` containing undefined values. From git at git.haskell.org Mon Apr 17 21:49:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:49:04 +0000 (UTC) Subject: [commit: packages/containers] master: faster IntMap.size (9be1604) Message-ID: <20170417214904.DB8C93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branch : master Link : http://git.haskell.org/packages/containers.git/commitdiff/9be1604fd2b4cd146de02962c9b94baa80e99d15 >--------------------------------------------------------------- commit 9be1604fd2b4cd146de02962c9b94baa80e99d15 Author: Mike Ledger Date: Wed Mar 29 15:34:20 2017 +1100 faster IntMap.size >--------------------------------------------------------------- 9be1604fd2b4cd146de02962c9b94baa80e99d15 Data/IntMap/Internal.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Data/IntMap/Internal.hs b/Data/IntMap/Internal.hs index 9271ba1..c7d1180 100644 --- a/Data/IntMap/Internal.hs +++ b/Data/IntMap/Internal.hs @@ -512,9 +512,11 @@ null _ = False -- > size (singleton 1 'a') == 1 -- > size (fromList([(1,'a'), (2,'c'), (3,'b')])) == 3 size :: IntMap a -> Int -size (Bin _ _ l r) = size l + size r -size (Tip _ _) = 1 -size Nil = 0 +size = go 0 + where + go !acc (Bin _ _ l r) = go (go acc l) r + go acc (Tip _ _) = 1 + acc + go acc Nil = acc -- | /O(min(n,W))/. Is the key a member of the map? -- From git at git.haskell.org Mon Apr 17 21:49:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:49:06 +0000 (UTC) Subject: [commit: packages/containers] master: faster IntSet.size (492e7fd) Message-ID: <20170417214906.E43F13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branch : master Link : http://git.haskell.org/packages/containers.git/commitdiff/492e7fd0b7b7cbe7a01075f75678e0449fcc3f95 >--------------------------------------------------------------- commit 492e7fd0b7b7cbe7a01075f75678e0449fcc3f95 Author: Mike Ledger Date: Wed Mar 29 15:35:47 2017 +1100 faster IntSet.size >--------------------------------------------------------------- 492e7fd0b7b7cbe7a01075f75678e0449fcc3f95 Data/IntSet/Internal.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Data/IntSet/Internal.hs b/Data/IntSet/Internal.hs index f6a1296..7eece21 100644 --- a/Data/IntSet/Internal.hs +++ b/Data/IntSet/Internal.hs @@ -311,9 +311,11 @@ null _ = False -- | /O(n)/. Cardinality of the set. size :: IntSet -> Int -size (Bin _ _ l r) = size l + size r -size (Tip _ bm) = bitcount 0 bm -size Nil = 0 +size = go 0 + where + go !acc (Bin _ _ l r) = go (go acc l) r + go acc (Tip _ bm) = acc + bitcount 0 bm + go acc Nil = acc -- | /O(min(n,W))/. Is the value a member of the set? From git at git.haskell.org Mon Apr 17 21:49:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:49:08 +0000 (UTC) Subject: [commit: packages/containers] master: quickcheck size for intmap (a56916e) Message-ID: <20170417214908.ED0653A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branch : master Link : http://git.haskell.org/packages/containers.git/commitdiff/a56916e36b6fcc828c741d7620617e782145de87 >--------------------------------------------------------------- commit a56916e36b6fcc828c741d7620617e782145de87 Author: Mike Ledger Date: Wed Mar 29 17:08:57 2017 +1100 quickcheck size for intmap >--------------------------------------------------------------- a56916e36b6fcc828c741d7620617e782145de87 tests/intmap-properties.hs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/intmap-properties.hs b/tests/intmap-properties.hs index db95338..1c37cc9 100644 --- a/tests/intmap-properties.hs +++ b/tests/intmap-properties.hs @@ -142,6 +142,7 @@ main = defaultMain , testProperty "alter" prop_alter , testProperty "index" prop_index , testProperty "null" prop_null + , testProperty "size" prop_size , testProperty "member" prop_member , testProperty "notmember" prop_notmember , testProperty "lookup" prop_lookup @@ -906,6 +907,11 @@ prop_index xs = length xs > 0 ==> prop_null :: IMap -> Bool prop_null m = null m == (size m == 0) +prop_size :: UMap -> Property +prop_size im = sz === foldl' (\i _ -> i + 1) (0 :: Int) im .&&. + sz === List.length (toList im) + where sz = size im + prop_member :: [Int] -> Int -> Bool prop_member xs n = let m = fromList (zip xs xs) From git at git.haskell.org Mon Apr 17 21:49:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:49:11 +0000 (UTC) Subject: [commit: packages/containers] master: quickcheck size using foldl for intset (300af25) Message-ID: <20170417214911.016903A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branch : master Link : http://git.haskell.org/packages/containers.git/commitdiff/300af2500379b4f4a15b595e79eec248ffd9b3b4 >--------------------------------------------------------------- commit 300af2500379b4f4a15b595e79eec248ffd9b3b4 Author: Mike Ledger Date: Wed Mar 29 17:09:07 2017 +1100 quickcheck size using foldl for intset >--------------------------------------------------------------- 300af2500379b4f4a15b595e79eec248ffd9b3b4 tests/intset-properties.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/intset-properties.hs b/tests/intset-properties.hs index 1671967..0cf2504 100644 --- a/tests/intset-properties.hs +++ b/tests/intset-properties.hs @@ -261,8 +261,10 @@ prop_isSubsetOf a b = isSubsetOf a b == Set.isSubsetOf (toSet a) (toSet b) prop_isSubsetOf2 :: IntSet -> IntSet -> Bool prop_isSubsetOf2 a b = isSubsetOf a (union a b) -prop_size :: IntSet -> Bool -prop_size s = size s == List.length (toList s) +prop_size :: IntSet -> Property +prop_size s = sz === foldl' (\i _ -> i + 1) (0 :: Int) s .&&. + sz === List.length (toList s) + where sz = size s prop_findMax :: IntSet -> Property prop_findMax s = not (null s) ==> findMax s == maximum (toList s) From git at git.haskell.org Mon Apr 17 21:49:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:49:13 +0000 (UTC) Subject: [commit: packages/containers] master: Merge pull request #421 from mikeplus64/master (f072317) Message-ID: <20170417214913.0C8283A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branch : master Link : http://git.haskell.org/packages/containers.git/commitdiff/f072317c6198c08ac99e828d7faeaeebc9a2b412 >--------------------------------------------------------------- commit f072317c6198c08ac99e828d7faeaeebc9a2b412 Merge: f42e932 300af25 Author: David Feuer Date: Sat Apr 1 11:54:08 2017 -0400 Merge pull request #421 from mikeplus64/master faster {IntMap,IntSet} size functions >--------------------------------------------------------------- f072317c6198c08ac99e828d7faeaeebc9a2b412 Data/IntMap/Internal.hs | 8 +++++--- Data/IntSet/Internal.hs | 8 +++++--- tests/intmap-properties.hs | 6 ++++++ tests/intset-properties.hs | 6 ++++-- 4 files changed, 20 insertions(+), 8 deletions(-) From git at git.haskell.org Mon Apr 17 21:49:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:49:15 +0000 (UTC) Subject: [commit: packages/containers] master: Update changelog (6414704) Message-ID: <20170417214915.1425F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/containers On branch : master Link : http://git.haskell.org/packages/containers.git/commitdiff/6414704b892a6dc56a1b17e3a530d777b70f56ae >--------------------------------------------------------------- commit 6414704b892a6dc56a1b17e3a530d777b70f56ae Author: David Feuer Date: Sat Apr 1 12:01:22 2017 -0400 Update changelog >--------------------------------------------------------------- 6414704b892a6dc56a1b17e3a530d777b70f56ae changelog.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/changelog.md b/changelog.md index 418406a..42b4b33 100644 --- a/changelog.md +++ b/changelog.md @@ -22,6 +22,8 @@ * Optimize `Data.IntMap.restrictKeys` and `Data.IntMap.withoutKeys`. The semantic fix in 0.5.10.1 left them rather slow in certain cases. +* Speed up `size` for `IntSet` and `IntMap` (thanks, Mike Ledger!). + * Define a custom `liftA2` in `Applicative` instances for base 4.10, and use `liftA2` rather than `<*>` whenever it may be beneficial. From git at git.haskell.org Mon Apr 17 21:51:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 17 Apr 2017 21:51:19 +0000 (UTC) Subject: [commit: packages/haskeline] tag '0.7.3.1' created Message-ID: <20170417215119.E91AD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/haskeline New tag : 0.7.3.1 Referencing: ebee02644e121085a9cf3f9adb5e8cd7d6d76491 From git at git.haskell.org Tue Apr 18 00:35:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 18 Apr 2017 00:35:26 +0000 (UTC) Subject: [commit: ghc] master: Remove redundant flag (-O) registration (fixes #13392) (b894f02) Message-ID: <20170418003526.D6FC13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b894f02058a10b5b0a4074020feae2771e793577/ghc >--------------------------------------------------------------- commit b894f02058a10b5b0a4074020feae2771e793577 Author: Santiago Munin Date: Mon Apr 17 12:44:52 2017 -0400 Remove redundant flag (-O) registration (fixes #13392) Reviewers: austin, bgamari, dfeuer Reviewed By: bgamari, dfeuer Subscribers: rwbarton, thomie GHC Trac Issues: #13392 Differential Revision: https://phabricator.haskell.org/D3461 >--------------------------------------------------------------- b894f02058a10b5b0a4074020feae2771e793577 compiler/main/DynFlags.hs | 1 - testsuite/tests/{cabal/pkg02 => driver/T13392}/Makefile | 2 ++ testsuite/tests/{arityanal/Makefile => driver/T13392/T13392.stdout} | 0 testsuite/tests/driver/T13392/all.T | 3 +++ 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 020ee50..b3600b8 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -3141,7 +3141,6 @@ dynamic_flags_deps = [ , make_ord_flag defGhcFlag "ffrontend-opt" (hasArg addFrontendPluginOption) ------ Optimisation flags ------------------------------------------ - , make_ord_flag defGhcFlag "O" (noArgM (setOptLevel 1)) , make_dep_flag defGhcFlag "Onot" (noArgM $ setOptLevel 0 ) "Use -O0 instead" , make_ord_flag defGhcFlag "Odph" (noArgM setDPHOpt) diff --git a/testsuite/tests/cabal/pkg02/Makefile b/testsuite/tests/driver/T13392/Makefile similarity index 51% copy from testsuite/tests/cabal/pkg02/Makefile copy to testsuite/tests/driver/T13392/Makefile index 4a26853..9d3c125 100644 --- a/testsuite/tests/cabal/pkg02/Makefile +++ b/testsuite/tests/driver/T13392/Makefile @@ -2,3 +2,5 @@ TOP=../../.. include $(TOP)/mk/boilerplate.mk include $(TOP)/mk/test.mk +T13392: + '$(TEST_HC)' $(TEST_HC_OPTS) --show-options | sort | uniq -d diff --git a/testsuite/tests/arityanal/Makefile b/testsuite/tests/driver/T13392/T13392.stdout similarity index 100% copy from testsuite/tests/arityanal/Makefile copy to testsuite/tests/driver/T13392/T13392.stdout diff --git a/testsuite/tests/driver/T13392/all.T b/testsuite/tests/driver/T13392/all.T new file mode 100644 index 0000000..1f2bd40 --- /dev/null +++ b/testsuite/tests/driver/T13392/all.T @@ -0,0 +1,3 @@ +# Test for #13392, it makes sure 'ghc --show-options' does not print each flag more than once. + +test('T13392', normal, run_command, ['$MAKE -s --no-print-directory T13392']) From git at git.haskell.org Tue Apr 18 00:35:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 18 Apr 2017 00:35:35 +0000 (UTC) Subject: [commit: ghc] master: utils: Lazily decode UTF8 strings (1cc82d3) Message-ID: <20170418003535.1C9603A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1cc82d38759c7a5f527ccc6cb514b8ba576cc3d1/ghc >--------------------------------------------------------------- commit 1cc82d38759c7a5f527ccc6cb514b8ba576cc3d1 Author: Ben Gamari Date: Mon Apr 17 12:26:56 2017 -0400 utils: Lazily decode UTF8 strings Reviewers: austin, hvr Subscribers: rwbarton, thomie GHC Trac Issues: #13527 Differential Revision: https://phabricator.haskell.org/D3442 >--------------------------------------------------------------- 1cc82d38759c7a5f527ccc6cb514b8ba576cc3d1 compiler/utils/Encoding.hs | 34 +++++++++++++++++++++++----------- compiler/utils/FastString.hs | 4 +--- compiler/utils/StringBuffer.hs | 4 +--- ghc/GHCi/UI.hs | 3 +-- 4 files changed, 26 insertions(+), 19 deletions(-) diff --git a/compiler/utils/Encoding.hs b/compiler/utils/Encoding.hs index 712de6c..f2b0979 100644 --- a/compiler/utils/Encoding.hs +++ b/compiler/utils/Encoding.hs @@ -17,7 +17,8 @@ module Encoding ( utf8PrevChar, utf8CharStart, utf8DecodeChar, - utf8DecodeString, + utf8DecodeByteString, + utf8DecodeStringLazy, utf8EncodeChar, utf8EncodeString, utf8EncodedLength, @@ -33,9 +34,15 @@ module Encoding ( ) where import Foreign +import Foreign.ForeignPtr.Unsafe import Data.Char import qualified Data.Char as Char import Numeric +import GHC.IO + +import Data.ByteString (ByteString) +import qualified Data.ByteString.Internal as BS + import GHC.Exts -- ----------------------------------------------------------------------------- @@ -115,19 +122,24 @@ utf8CharStart p = go p then go (p `plusPtr` (-1)) else return p -utf8DecodeString :: Ptr Word8 -> Int -> IO [Char] -utf8DecodeString ptr len - = unpack ptr +utf8DecodeByteString :: ByteString -> [Char] +utf8DecodeByteString (BS.PS ptr offset len) + = utf8DecodeStringLazy ptr offset len + +utf8DecodeStringLazy :: ForeignPtr Word8 -> Int -> Int -> [Char] +utf8DecodeStringLazy fptr offset len + = unsafeDupablePerformIO $ unpack start where - !end = ptr `plusPtr` len + !start = unsafeForeignPtrToPtr fptr `plusPtr` offset + !end = start `plusPtr` len unpack p - | p >= end = return [] - | otherwise = - case utf8DecodeChar# (unPtr p) of - (# c#, nBytes# #) -> do - chs <- unpack (p `plusPtr#` nBytes#) - return (C# c# : chs) + | p >= end = touchForeignPtr fptr >> return [] + | otherwise = + case utf8DecodeChar# (unPtr p) of + (# c#, nBytes# #) -> do + rest <- unsafeDupableInterleaveIO $ unpack (p `plusPtr#` nBytes#) + return (C# c# : rest) countUTF8Chars :: Ptr Word8 -> Int -> IO Int countUTF8Chars ptr len = go ptr 0 diff --git a/compiler/utils/FastString.hs b/compiler/utils/FastString.hs index 8d1bbb5..8653485 100644 --- a/compiler/utils/FastString.hs +++ b/compiler/utils/FastString.hs @@ -485,9 +485,7 @@ nullFS f = BS.null (fs_bs f) -- | Unpacks and decodes the FastString unpackFS :: FastString -> String -unpackFS (FastString _ _ bs _) = - inlinePerformIO $ BS.unsafeUseAsCStringLen bs $ \(ptr, len) -> - utf8DecodeString (castPtr ptr) len +unpackFS (FastString _ _ bs _) = utf8DecodeByteString bs -- | Gives the UTF-8 encoded bytes corresponding to a 'FastString' bytesFS :: FastString -> [Word8] diff --git a/compiler/utils/StringBuffer.hs b/compiler/utils/StringBuffer.hs index ec5184a..fcc3445 100644 --- a/compiler/utils/StringBuffer.hs +++ b/compiler/utils/StringBuffer.hs @@ -251,9 +251,7 @@ lexemeToString :: StringBuffer -> String lexemeToString _ 0 = "" lexemeToString (StringBuffer buf _ cur) bytes = - inlinePerformIO $ - withForeignPtr buf $ \ptr -> - utf8DecodeString (ptr `plusPtr` cur) bytes + utf8DecodeStringLazy buf cur bytes lexemeToFastString :: StringBuffer -> Int -- ^ @n@, the number of bytes diff --git a/ghc/GHCi/UI.hs b/ghc/GHCi/UI.hs index deee24a..aeab85b 100644 --- a/ghc/GHCi/UI.hs +++ b/ghc/GHCi/UI.hs @@ -3525,8 +3525,7 @@ listAround pan do_highlight = do prefixed = zipWith ($) highlighted bs_line_nos output = BS.intercalate (BS.pack "\n") prefixed - utf8Decoded <- liftIO $ BS.useAsCStringLen output - $ \(p,n) -> utf8DecodeString (castPtr p) n + let utf8Decoded = utf8DecodeByteString output liftIO $ putStrLn utf8Decoded where file = GHC.srcSpanFile pan From git at git.haskell.org Tue Apr 18 00:35:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 18 Apr 2017 00:35:37 +0000 (UTC) Subject: [commit: ghc] master: Fix "Glasgow Haskell Compiler Users Guide" (f58176f) Message-ID: <20170418003537.CC8803A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f58176fe731e0412a04239be620443d63f067adf/ghc >--------------------------------------------------------------- commit f58176fe731e0412a04239be620443d63f067adf Author: Bartosz Nitka Date: Mon Apr 17 12:49:34 2017 -0400 Fix "Glasgow Haskell Compiler Users Guide" If you go to https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/index.html the window title has `` in it. I don't understand how it all works, but inspired by the line below which produces a correct string in the docs I just blindly changed it in the same way. Cabal appears to have the same problem. Test Plan: it'd be nice if I could check the result on harbormaster, can I? Reviewers: thomie, bgamari, austin Reviewed By: bgamari Subscribers: rwbarton, simonmar Differential Revision: https://phabricator.haskell.org/D3458 >--------------------------------------------------------------- f58176fe731e0412a04239be620443d63f067adf docs/users_guide/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/users_guide/conf.py b/docs/users_guide/conf.py index b48505c..8a4c18f 100644 --- a/docs/users_guide/conf.py +++ b/docs/users_guide/conf.py @@ -37,7 +37,7 @@ exclude_patterns = ['.build', "*.gen.rst"] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". -html_title = "Glasgow Haskell Compiler User's Guide" +html_title = "Glasgow Haskell Compiler %s User's Guide" % release html_short_title = "GHC %s User's Guide" % release html_theme_path = ['.'] html_theme = 'ghc-theme' From git at git.haskell.org Tue Apr 18 00:35:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 18 Apr 2017 00:35:29 +0000 (UTC) Subject: [commit: ghc] master: Use intersect and minus instead of filter (c87584f) Message-ID: <20170418003529.9E0AC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c87584f167ae6aee7b75d6ee4a39586b291543a0/ghc >--------------------------------------------------------------- commit c87584f167ae6aee7b75d6ee4a39586b291543a0 Author: Bartosz Nitka Date: Mon Apr 17 12:50:10 2017 -0400 Use intersect and minus instead of filter These are asymptotically better and convey the intent a bit better. Test Plan: ./validate Reviewers: simonpj, bgamari, austin, goldfire Reviewed By: bgamari Subscribers: rwbarton, thomie, simonmar Differential Revision: https://phabricator.haskell.org/D3455 >--------------------------------------------------------------- c87584f167ae6aee7b75d6ee4a39586b291543a0 compiler/basicTypes/VarSet.hs | 6 +++++- compiler/typecheck/TcSimplify.hs | 2 +- compiler/typecheck/TcType.hs | 2 +- compiler/utils/UniqDFM.hs | 2 +- compiler/utils/UniqDSet.hs | 7 +++++-- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/compiler/basicTypes/VarSet.hs b/compiler/basicTypes/VarSet.hs index 8877f64..e4f0d25 100644 --- a/compiler/basicTypes/VarSet.hs +++ b/compiler/basicTypes/VarSet.hs @@ -32,7 +32,8 @@ module VarSet ( extendDVarSet, extendDVarSetList, elemDVarSet, dVarSetElems, subDVarSet, unionDVarSet, unionDVarSets, mapUnionDVarSet, - intersectDVarSet, intersectsDVarSet, disjointDVarSet, + intersectDVarSet, dVarSetIntersectVarSet, + intersectsDVarSet, disjointDVarSet, isEmptyDVarSet, delDVarSet, delDVarSetList, minusDVarSet, foldDVarSet, filterDVarSet, dVarSetMinusVarSet, anyDVarSet, allDVarSet, @@ -259,6 +260,9 @@ mapUnionDVarSet get_set xs = foldr (unionDVarSet . get_set) emptyDVarSet xs intersectDVarSet :: DVarSet -> DVarSet -> DVarSet intersectDVarSet = intersectUniqDSets +dVarSetIntersectVarSet :: DVarSet -> VarSet -> DVarSet +dVarSetIntersectVarSet = uniqDSetIntersectUniqSet + -- | True if empty intersection disjointDVarSet :: DVarSet -> DVarSet -> Bool disjointDVarSet s1 s2 = disjointUDFM s1 s2 diff --git a/compiler/typecheck/TcSimplify.hs b/compiler/typecheck/TcSimplify.hs index e5f3fe9..2822985 100644 --- a/compiler/typecheck/TcSimplify.hs +++ b/compiler/typecheck/TcSimplify.hs @@ -956,7 +956,7 @@ decideQuantifiedTyVars mono_tvs name_taus psigs candidates ; let DV {dv_kvs = cand_kvs, dv_tvs = cand_tvs} = candidateQTyVarsOfTypes $ psig_tys ++ candidates ++ tau_tys - pick = filterDVarSet (`elemVarSet` grown_tvs) + pick = (`dVarSetIntersectVarSet` grown_tvs) dvs_plus = DV { dv_kvs = pick cand_kvs, dv_tvs = pick cand_tvs } ; mono_tvs <- TcM.zonkTyCoVarsAndFV mono_tvs diff --git a/compiler/typecheck/TcType.hs b/compiler/typecheck/TcType.hs index c76647c..ab2f843 100644 --- a/compiler/typecheck/TcType.hs +++ b/compiler/typecheck/TcType.hs @@ -1092,7 +1092,7 @@ split_dvs bound dvs ty kill_bound free | isEmptyVarSet bound = free - | otherwise = filterDVarSet (not . (`elemVarSet` bound)) free + | otherwise = free `dVarSetMinusVarSet` bound -- | Like 'splitDepVarsOfType', but over a list of types candidateQTyVarsOfTypes :: [Type] -> CandidatesQTvs diff --git a/compiler/utils/UniqDFM.hs b/compiler/utils/UniqDFM.hs index 9f81e4d..17f2747 100644 --- a/compiler/utils/UniqDFM.hs +++ b/compiler/utils/UniqDFM.hs @@ -294,7 +294,7 @@ intersectUDFM (UDFM x i) (UDFM y _j) = UDFM (M.intersection x y) i -- M.intersection is left biased, that means the result will only have -- a subset of elements from the left set, so `i` is a good upper bound. -udfmIntersectUFM :: UniqDFM elt -> UniqFM elt -> UniqDFM elt +udfmIntersectUFM :: UniqDFM elt1 -> UniqFM elt2 -> UniqDFM elt1 udfmIntersectUFM (UDFM x i) y = UDFM (M.intersection x (ufmToIntMap y)) i -- M.intersection is left biased, that means the result will only have -- a subset of elements from the left set, so `i` is a good upper bound. diff --git a/compiler/utils/UniqDSet.hs b/compiler/utils/UniqDSet.hs index 4e8c7ed..eef545e 100644 --- a/compiler/utils/UniqDSet.hs +++ b/compiler/utils/UniqDSet.hs @@ -20,7 +20,7 @@ module UniqDSet ( addOneToUniqDSet, addListToUniqDSet, unionUniqDSets, unionManyUniqDSets, minusUniqDSet, uniqDSetMinusUniqSet, - intersectUniqDSets, + intersectUniqDSets, uniqDSetIntersectUniqSet, intersectsUniqDSets, foldUniqDSet, elementOfUniqDSet, @@ -69,12 +69,15 @@ unionManyUniqDSets sets = foldr1 unionUniqDSets sets minusUniqDSet :: UniqDSet a -> UniqDSet a -> UniqDSet a minusUniqDSet = minusUDFM -uniqDSetMinusUniqSet :: UniqDSet a -> UniqSet a -> UniqDSet a +uniqDSetMinusUniqSet :: UniqDSet a -> UniqSet b -> UniqDSet a uniqDSetMinusUniqSet xs ys = udfmMinusUFM xs (getUniqSet ys) intersectUniqDSets :: UniqDSet a -> UniqDSet a -> UniqDSet a intersectUniqDSets = intersectUDFM +uniqDSetIntersectUniqSet :: UniqDSet a -> UniqSet b -> UniqDSet a +uniqDSetIntersectUniqSet xs ys = xs `udfmIntersectUFM` getUniqSet ys + intersectsUniqDSets :: UniqDSet a -> UniqDSet a -> Bool intersectsUniqDSets = intersectsUDFM From git at git.haskell.org Tue Apr 18 00:35:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 18 Apr 2017 00:35:32 +0000 (UTC) Subject: [commit: ghc] master: Fix space leak in sortBy (3d3975f) Message-ID: <20170418003532.59D603A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3d3975f2f4caf3af76a7ea27d2882ddaee7db3c9/ghc >--------------------------------------------------------------- commit 3d3975f2f4caf3af76a7ea27d2882ddaee7db3c9 Author: Gregory Date: Mon Apr 17 11:24:31 2017 -0400 Fix space leak in sortBy This makes yields a small improvement in sort performance: around 3.5% in runtime on random Ints. Reviewers: austin, hvr, mpickering Subscribers: siddhanathan, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3454 >--------------------------------------------------------------- 3d3975f2f4caf3af76a7ea27d2882ddaee7db3c9 libraries/base/Data/OldList.hs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libraries/base/Data/OldList.hs b/libraries/base/Data/OldList.hs index 428d3bd..ec937e7 100644 --- a/libraries/base/Data/OldList.hs +++ b/libraries/base/Data/OldList.hs @@ -1,5 +1,6 @@ {-# LANGUAGE Trustworthy #-} -{-# LANGUAGE CPP, NoImplicitPrelude, ScopedTypeVariables, MagicHash #-} +{-# LANGUAGE CPP, NoImplicitPrelude, ScopedTypeVariables, + MagicHash, BangPatterns #-} ----------------------------------------------------------------------------- -- | @@ -854,12 +855,14 @@ sortBy cmp = mergeAll . sequences ascending a as (b:bs) | a `cmp` b /= GT = ascending b (\ys -> as (a:ys)) bs - ascending a as bs = as [a]: sequences bs + ascending a as bs = let !x = as [a] + in x : sequences bs mergeAll [x] = x mergeAll xs = mergeAll (mergePairs xs) - mergePairs (a:b:xs) = merge a b: mergePairs xs + mergePairs (a:b:xs) = let !x = merge a b + in x : mergePairs xs mergePairs xs = xs merge as@(a:as') bs@(b:bs') From git at git.haskell.org Tue Apr 18 00:35:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 18 Apr 2017 00:35:23 +0000 (UTC) Subject: [commit: ghc] master: base: Track timer PSQ timeouts as Word64 instead of Double (ab2dcb1) Message-ID: <20170418003523.8EB343A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ab2dcb1c474d918efdc875f3cca7ef5b6ebdce1a/ghc >--------------------------------------------------------------- commit ab2dcb1c474d918efdc875f3cca7ef5b6ebdce1a Author: Ben Gamari Date: Mon Apr 17 11:17:00 2017 -0400 base: Track timer PSQ timeouts as Word64 instead of Double Test Plan: Validate on all the platforms Reviewers: nh2, hvr, austin Subscribers: Phyx, nh2, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3417 >--------------------------------------------------------------- ab2dcb1c474d918efdc875f3cca7ef5b6ebdce1a libraries/base/GHC/Event/Clock.hsc | 10 +++++++--- libraries/base/GHC/Event/EPoll.hsc | 6 ++++-- libraries/base/GHC/Event/Internal.hs | 5 +++-- libraries/base/GHC/Event/KQueue.hsc | 12 ++++++------ libraries/base/GHC/Event/PSQ.hs | 4 ++-- libraries/base/GHC/Event/Poll.hsc | 6 ++++-- libraries/base/GHC/Event/TimerManager.hs | 14 +++++++------- 7 files changed, 33 insertions(+), 24 deletions(-) diff --git a/libraries/base/GHC/Event/Clock.hsc b/libraries/base/GHC/Event/Clock.hsc index 5dbdb67..7f98a03 100644 --- a/libraries/base/GHC/Event/Clock.hsc +++ b/libraries/base/GHC/Event/Clock.hsc @@ -1,7 +1,10 @@ {-# LANGUAGE Trustworthy #-} {-# LANGUAGE NoImplicitPrelude #-} -module GHC.Event.Clock (getMonotonicTime) where +module GHC.Event.Clock + ( getMonotonicTime + , getMonotonicTimeNSec + ) where import GHC.Base import GHC.Real @@ -9,9 +12,10 @@ import Data.Word -- | Return monotonic time in seconds, since some unspecified starting point getMonotonicTime :: IO Double -getMonotonicTime = do w <- getMonotonicNSec +getMonotonicTime = do w <- getMonotonicTimeNSec return (fromIntegral w / 1000000000) +-- | Return monotonic time in nanoseconds, since some unspecified starting point foreign import ccall unsafe "getMonotonicNSec" - getMonotonicNSec :: IO Word64 + getMonotonicTimeNSec :: IO Word64 diff --git a/libraries/base/GHC/Event/EPoll.hsc b/libraries/base/GHC/Event/EPoll.hsc index 47e69a6..32bfc39 100644 --- a/libraries/base/GHC/Event/EPoll.hsc +++ b/libraries/base/GHC/Event/EPoll.hsc @@ -48,7 +48,7 @@ import Foreign.Ptr (Ptr) import Foreign.Storable (Storable(..)) import GHC.Base import GHC.Num (Num(..)) -import GHC.Real (ceiling, fromIntegral) +import GHC.Real (fromIntegral, div) import GHC.Show (Show) import System.Posix.Internals (c_close) import System.Posix.Internals (setCloseOnExec) @@ -223,7 +223,9 @@ toEvent e = remap (epollIn .|. epollErr .|. epollHup) E.evtRead `mappend` fromTimeout :: Timeout -> Int fromTimeout Forever = -1 -fromTimeout (Timeout s) = ceiling $ 1000 * s +fromTimeout (Timeout s) = fromIntegral $ s `divRoundUp` 1000000 + where + divRoundUp num denom = (num + denom - 1) `div` denom foreign import ccall unsafe "sys/epoll.h epoll_create" c_epoll_create :: CInt -> IO CInt diff --git a/libraries/base/GHC/Event/Internal.hs b/libraries/base/GHC/Event/Internal.hs index f6eb8ef..9b8230c 100644 --- a/libraries/base/GHC/Event/Internal.hs +++ b/libraries/base/GHC/Event/Internal.hs @@ -33,6 +33,7 @@ import Data.OldList (foldl', filter, intercalate, null) import Foreign.C.Error (eINTR, getErrno, throwErrno) import System.Posix.Types (Fd) import GHC.Base +import GHC.Word (Word64) import GHC.Num (Num(..)) import GHC.Show (Show(..)) @@ -133,8 +134,8 @@ elEvent :: EventLifetime -> Event elEvent (EL x) = Event (x .&. 0x7) {-# INLINE elEvent #-} --- | A type alias for timeouts, specified in seconds. -data Timeout = Timeout {-# UNPACK #-} !Double +-- | A type alias for timeouts, specified in nanoseconds. +data Timeout = Timeout {-# UNPACK #-} !Word64 | Forever deriving (Show) diff --git a/libraries/base/GHC/Event/KQueue.hsc b/libraries/base/GHC/Event/KQueue.hsc index f26d199..a76cc51 100644 --- a/libraries/base/GHC/Event/KQueue.hsc +++ b/libraries/base/GHC/Event/KQueue.hsc @@ -38,7 +38,7 @@ import Foreign.Storable (Storable(..)) import GHC.Base import GHC.Enum (toEnum) import GHC.Num (Num(..)) -import GHC.Real (ceiling, floor, fromIntegral) +import GHC.Real (quotRem, fromIntegral) import GHC.Show (Show(show)) import GHC.Event.Internal (Timeout(..)) import System.Posix.Internals (c_close) @@ -265,13 +265,13 @@ withTimeSpec ts f fromTimeout :: Timeout -> TimeSpec fromTimeout Forever = TimeSpec (-1) (-1) -fromTimeout (Timeout s) = TimeSpec (toEnum sec) (toEnum nanosec) +fromTimeout (Timeout s) = TimeSpec (toEnum sec') (toEnum nanosec') where - sec :: Int - sec = floor s + (sec, nanosec) = s `quotRem` 1000000000 - nanosec :: Int - nanosec = ceiling $ (s - fromIntegral sec) * 1000000000 + nanosec', sec' :: Int + sec' = fromIntegral sec + nanosec' = fromIntegral nanosec toEvent :: Filter -> E.Event toEvent (Filter f) diff --git a/libraries/base/GHC/Event/PSQ.hs b/libraries/base/GHC/Event/PSQ.hs index b03bc9c..26ab531 100644 --- a/libraries/base/GHC/Event/PSQ.hs +++ b/libraries/base/GHC/Event/PSQ.hs @@ -89,7 +89,7 @@ module GHC.Event.PSQ ) where import GHC.Base hiding (empty) -import GHC.Float () -- for Show Double instance +import GHC.Word (Word64) import GHC.Num (Num(..)) import GHC.Show (Show(showsPrec)) import GHC.Event.Unique (Unique) @@ -104,7 +104,7 @@ data Elem a = E ------------------------------------------------------------------------ -- | A mapping from keys @k@ to priorites @p at . -type Prio = Double +type Prio = Word64 type Key = Unique data PSQ a = Void diff --git a/libraries/base/GHC/Event/Poll.hsc b/libraries/base/GHC/Event/Poll.hsc index 330007c..5c5ad49 100644 --- a/libraries/base/GHC/Event/Poll.hsc +++ b/libraries/base/GHC/Event/Poll.hsc @@ -35,7 +35,7 @@ import GHC.Base import GHC.Conc.Sync (withMVar) import GHC.Enum (maxBound) import GHC.Num (Num(..)) -import GHC.Real (ceiling, fromIntegral) +import GHC.Real (fromIntegral, div) import GHC.Show (Show) import System.Posix.Types (Fd(..)) @@ -143,7 +143,9 @@ poll p mtout f = do fromTimeout :: E.Timeout -> Int fromTimeout E.Forever = -1 -fromTimeout (E.Timeout s) = ceiling $ 1000 * s +fromTimeout (E.Timeout s) = fromIntegral $ s `divRoundUp` 1000000 + where + divRoundUp num denom = (num + denom - 1) `div` denom data PollFd = PollFd { pfdFd :: {-# UNPACK #-} !Fd diff --git a/libraries/base/GHC/Event/TimerManager.hs b/libraries/base/GHC/Event/TimerManager.hs index 93b1766..10baa3b 100644 --- a/libraries/base/GHC/Event/TimerManager.hs +++ b/libraries/base/GHC/Event/TimerManager.hs @@ -45,9 +45,9 @@ import Data.IORef (IORef, atomicModifyIORef', mkWeakIORef, newIORef, readIORef, import GHC.Base import GHC.Conc.Signal (runHandlers) import GHC.Num (Num(..)) -import GHC.Real ((/), fromIntegral ) +import GHC.Real (fromIntegral) import GHC.Show (Show(..)) -import GHC.Event.Clock (getMonotonicTime) +import GHC.Event.Clock (getMonotonicTimeNSec) import GHC.Event.Control import GHC.Event.Internal (Backend, Event, evtRead, Timeout(..)) import GHC.Event.Unique (Unique, UniqueSource, newSource, newUnique) @@ -186,7 +186,7 @@ step mgr = do -- next timeout. mkTimeout :: IO Timeout mkTimeout = do - now <- getMonotonicTime + now <- getMonotonicTimeNSec (expired, timeout) <- atomicModifyIORef' (emTimeouts mgr) $ \tq -> let (expired, tq') = Q.atMost now tq timeout = case Q.minView tq' of @@ -215,8 +215,8 @@ registerTimeout mgr us cb = do !key <- newUnique (emUniqueSource mgr) if us <= 0 then cb else do - now <- getMonotonicTime - let expTime = fromIntegral us / 1000000.0 + now + now <- getMonotonicTimeNSec + let expTime = fromIntegral us * 1000 + now editTimeouts mgr (Q.insert key expTime cb) wakeManager mgr @@ -232,8 +232,8 @@ unregisterTimeout mgr (TK key) = do -- microseconds. updateTimeout :: TimerManager -> TimeoutKey -> Int -> IO () updateTimeout mgr (TK key) us = do - now <- getMonotonicTime - let expTime = fromIntegral us / 1000000.0 + now + now <- getMonotonicTimeNSec + let expTime = fromIntegral us * 1000 + now editTimeouts mgr (Q.adjust (const expTime) key) wakeManager mgr From git at git.haskell.org Tue Apr 18 00:35:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 18 Apr 2017 00:35:40 +0000 (UTC) Subject: [commit: ghc] master: [iserv] drop cryptonite dependency. (5a21003) Message-ID: <20170418003540.8B0103A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5a210032d4b9dcc644a5557eb4144445f660ea27/ghc >--------------------------------------------------------------- commit 5a210032d4b9dcc644a5557eb4144445f660ea27 Author: Moritz Angermann Date: Mon Apr 17 12:28:22 2017 -0400 [iserv] drop cryptonite dependency. Reviewers: bgamari, austin Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3462 >--------------------------------------------------------------- 5a210032d4b9dcc644a5557eb4144445f660ea27 iserv/iserv-bin.cabal | 5 ++--- iserv/proxy-src/Remote.hs | 3 ++- iserv/src/Remote/Message.hs | 16 +++------------- iserv/src/Remote/Slave.hs | 7 ++++--- 4 files changed, 11 insertions(+), 20 deletions(-) diff --git a/iserv/iserv-bin.cabal b/iserv/iserv-bin.cabal index f0abf54..8da0c28 100644 --- a/iserv/iserv-bin.cabal +++ b/iserv/iserv-bin.cabal @@ -85,8 +85,7 @@ Library bytestring >= 0.10 && < 0.11, containers >= 0.5 && < 0.6, deepseq >= 1.4 && < 1.5, - cryptonite >= 0.22, - ghci == 8.1, + ghci == 8.3, network >= 2.6 && < 2.7, directory >= 1.3 && < 1.4, filepath >= 1.4 && < 1.5 @@ -134,6 +133,6 @@ Executable iserv-proxy bytestring >= 0.10 && < 0.11, containers >= 0.5 && < 0.6, deepseq >= 1.4 && < 1.5, - ghci == 8.1, + ghci == 8.3, network >= 2.6, iserv-bin diff --git a/iserv/proxy-src/Remote.hs b/iserv/proxy-src/Remote.hs index 6b1d528..481d6ac 100644 --- a/iserv/proxy-src/Remote.hs +++ b/iserv/proxy-src/Remote.hs @@ -58,6 +58,7 @@ import Control.Monad import System.Environment import System.Exit import Text.Printf +import GHC.Fingerprint (getFileHash) import Data.Binary import qualified Data.ByteString as BS @@ -182,7 +183,7 @@ fwdLoadCall verbose _ remote msg = do reply =<< BS.readFile path loopLoad Have path remoteHash -> do - localHash <- sha256sum path + localHash <- getFileHash path reply =<< if localHash == remoteHash then return Nothing else Just <$> BS.readFile path diff --git a/iserv/src/Remote/Message.hs b/iserv/src/Remote/Message.hs index faef45d..f174530 100644 --- a/iserv/src/Remote/Message.hs +++ b/iserv/src/Remote/Message.hs @@ -3,29 +3,19 @@ module Remote.Message ( SlaveMessage(..) , SlaveMsg(..) - , sha256sum , putSlaveMessage , getSlaveMessage ) where +import GHC.Fingerprint (Fingerprint) import Data.Binary -import Data.ByteString as BS (ByteString, readFile) - -import Crypto.Hash - -type Sha256Hash = String - -sha256 :: ByteString -> Digest SHA256 -sha256 = hash - -sha256sum :: FilePath -> IO Sha256Hash -sha256sum path = (show . sha256) <$> BS.readFile path +import Data.ByteString (ByteString) -- | A @SlaveMessage a@ is message from the iserv process on the -- target, requesting something from the Proxy of with result type @a at . data SlaveMessage a where -- sends either a new file, or nothing if the file is acceptable. - Have :: FilePath -> Sha256Hash -> SlaveMessage (Maybe ByteString) + Have :: FilePath -> Fingerprint -> SlaveMessage (Maybe ByteString) Missing :: FilePath -> SlaveMessage ByteString Done :: SlaveMessage () diff --git a/iserv/src/Remote/Slave.hs b/iserv/src/Remote/Slave.hs index 2d47a34..e7ff3f2 100644 --- a/iserv/src/Remote/Slave.hs +++ b/iserv/src/Remote/Slave.hs @@ -19,6 +19,7 @@ import GHCi.Message (Pipe(..), Msg(..), Message(..), readPipe, writePipe) import Foreign.C.String import Data.Binary +import GHC.Fingerprint (getFileHash) import qualified Data.ByteString as BS @@ -59,16 +60,16 @@ startSlave' verbose base_path port = do -- -- If we however already have the requested file we need to make -- sure that this file is the same one ghc sees. Hence we --- calculate the sha256sum of the file and send it back to the +-- calculate the Fingerprint of the file and send it back to the -- host for comparison. The proxy will then send back either @Nothing@ --- indicating that the file on the host has the same sha256sum, or +-- indicating that the file on the host has the same Fingerprint, or -- Maybe ByteString containing the payload to replace the existing -- file with. handleLoad :: Pipe -> FilePath -> FilePath -> IO () handleLoad pipe path localPath = do exists <- doesFileExist localPath if exists - then sha256sum localPath >>= \hash -> proxyCall (Have path hash) >>= \case + then getFileHash localPath >>= \hash -> proxyCall (Have path hash) >>= \case Nothing -> return () Just bs -> BS.writeFile localPath bs else do From git at git.haskell.org Tue Apr 18 00:35:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 18 Apr 2017 00:35:43 +0000 (UTC) Subject: [commit: ghc] master: Caret diag.: Avoid decoding whole module if only specific line is needed (065be6e) Message-ID: <20170418003543.4B8C53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/065be6e9eb5114c5f0e3a20626ec93042ce47f13/ghc >--------------------------------------------------------------- commit 065be6e9eb5114c5f0e3a20626ec93042ce47f13 Author: alexbiehl Date: Mon Apr 17 12:51:10 2017 -0400 Caret diag.: Avoid decoding whole module if only specific line is needed Before we were decoding the whole file to get to the desired line. This patch introduces a fast function which searches a StringBuffer for the desired line so we only need to utf8 decode a little portion. This is especially interesting if we have big modules with lots of warnings. Reviewers: austin, bgamari, Rufflewind, trofi Reviewed By: Rufflewind, trofi Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3440 >--------------------------------------------------------------- 065be6e9eb5114c5f0e3a20626ec93042ce47f13 compiler/main/ErrUtils.hs | 27 +++++++++++++-------------- compiler/utils/StringBuffer.hs | 40 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 52 insertions(+), 15 deletions(-) diff --git a/compiler/main/ErrUtils.hs b/compiler/main/ErrUtils.hs index 180d18d..ded7085 100644 --- a/compiler/main/ErrUtils.hs +++ b/compiler/main/ErrUtils.hs @@ -64,7 +64,7 @@ import qualified PprColour as Col import SrcLoc import DynFlags import FastString (unpackFS) -import StringBuffer (hGetStringBuffer, len, lexemeToString) +import StringBuffer (atLine, hGetStringBuffer, len, lexemeToString) import Json import System.Directory @@ -231,27 +231,26 @@ getSeverityColour _ = const mempty getCaretDiagnostic :: Severity -> SrcSpan -> IO MsgDoc getCaretDiagnostic _ (UnhelpfulSpan _) = pure empty getCaretDiagnostic severity (RealSrcSpan span) = do - caretDiagnostic <$> getSrcLine (srcSpanFile span) (row - 1) + caretDiagnostic <$> getSrcLine (srcSpanFile span) row where - - getSrcLine fn i = do - (getLine i <$> readFile' (unpackFS fn)) - `catchIOError` \ _ -> + getSrcLine fn i = + getLine i (unpackFS fn) + `catchIOError` \_ -> pure Nothing - getLine i contents = - case drop i (lines contents) of - srcLine : _ -> Just srcLine - [] -> Nothing - - readFile' fn = do + getLine i fn = do -- StringBuffer has advantages over readFile: -- (a) no lazy IO, otherwise IO exceptions may occur in pure code -- (b) always UTF-8, rather than some system-dependent encoding -- (Haskell source code must be UTF-8 anyway) - buf <- hGetStringBuffer fn - pure (fix <$> lexemeToString buf (len buf)) + content <- hGetStringBuffer fn + case atLine i content of + Just at_line -> pure $ + case lines (fix <$> lexemeToString at_line (len at_line)) of + srcLine : _ -> Just srcLine + _ -> Nothing + _ -> pure Nothing -- allow user to visibly see that their code is incorrectly encoded -- (StringBuffer.nextChar uses \0 to represent undecodable characters) diff --git a/compiler/utils/StringBuffer.hs b/compiler/utils/StringBuffer.hs index fcc3445..d75e537 100644 --- a/compiler/utils/StringBuffer.hs +++ b/compiler/utils/StringBuffer.hs @@ -6,7 +6,7 @@ Buffers for scanning string input stored in external arrays. -} -{-# LANGUAGE CPP, MagicHash, UnboxedTuples #-} +{-# LANGUAGE BangPatterns, CPP, MagicHash, UnboxedTuples #-} {-# OPTIONS_GHC -O #-} -- We always optimise this, otherwise performance of a non-optimised -- compiler is severely affected @@ -32,6 +32,7 @@ module StringBuffer stepOn, offsetBytes, byteDiff, + atLine, -- * Conversion lexemeToString, @@ -240,6 +241,43 @@ byteDiff s1 s2 = cur s2 - cur s1 atEnd :: StringBuffer -> Bool atEnd (StringBuffer _ l c) = l == c +-- | Computes a 'StringBuffer' which points to the first character of the +-- wanted line. Lines begin at 1. +atLine :: Int -> StringBuffer -> Maybe StringBuffer +atLine line sb@(StringBuffer buf len _) = + inlinePerformIO $ + withForeignPtr buf $ \p -> do + p' <- skipToLine line len p + if p' == nullPtr + then return Nothing + else + let + delta = p' `minusPtr` p + in return $ Just (sb { cur = delta + , len = len - delta + }) + +skipToLine :: Int -> Int -> Ptr Word8 -> IO (Ptr Word8) +skipToLine !line !len !op0 = go 1 op0 + where + !opend = op0 `plusPtr` len + + go !i_line !op + | op >= opend = pure nullPtr + | i_line == line = pure op + | otherwise = do + w <- peek op :: IO Word8 + case w of + 10 -> go (i_line + 1) (plusPtr op 1) + 13 -> do + -- this is safe because a 'StringBuffer' is + -- guaranteed to have 3 bytes sentinel values. + w' <- peek (plusPtr op 1) :: IO Word8 + case w' of + 10 -> go (i_line + 1) (plusPtr op 2) + _ -> go (i_line + 1) (plusPtr op 1) + _ -> go i_line (plusPtr op 1) + -- ----------------------------------------------------------------------------- -- Conversion From git at git.haskell.org Tue Apr 18 03:11:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 18 Apr 2017 03:11:04 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Allow qualified names to be children in export lists (fd6b7f5) Message-ID: <20170418031104.D36703A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/fd6b7f5619a17aca531e3d8908e36d5961beffd2/ghc >--------------------------------------------------------------- commit fd6b7f5619a17aca531e3d8908e36d5961beffd2 Author: Matthew Pickering Date: Wed Apr 12 14:10:54 2017 -0400 Allow qualified names to be children in export lists When doing this I noticed a horrible amount of duplication between lookupSubBndrOcc and lookupExportChild (which I am responsible for). I opened #13545 to keep track of this. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #13528 Differential Revision: https://phabricator.haskell.org/D3434 (cherry picked from commit fa5a73f0a86908da31ec72ce33d37a7a704a0600) >--------------------------------------------------------------- fd6b7f5619a17aca531e3d8908e36d5961beffd2 compiler/typecheck/TcRnExports.hs | 2 +- testsuite/tests/module/T13528.hs | 13 +++++++++++++ testsuite/tests/module/all.T | 2 ++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/compiler/typecheck/TcRnExports.hs b/compiler/typecheck/TcRnExports.hs index 35e30a7..322de93 100644 --- a/compiler/typecheck/TcRnExports.hs +++ b/compiler/typecheck/TcRnExports.hs @@ -475,7 +475,7 @@ lookupExportChild parent rdr_name | otherwise = do gre_env <- getGlobalRdrEnv - let original_gres = lookupGRE_RdrName rdr_name gre_env + let original_gres = lookupGlobalRdrEnv gre_env (rdrNameOcc rdr_name) -- Disambiguate the lookup based on the parent information. -- The remaining GREs are things that we *could* export here, note that -- this includes things which have `NoParent`. Those are sorted in diff --git a/testsuite/tests/module/T13528.hs b/testsuite/tests/module/T13528.hs new file mode 100644 index 0000000..60363eb --- /dev/null +++ b/testsuite/tests/module/T13528.hs @@ -0,0 +1,13 @@ +{-# LANGUAGE NoImplicitPrelude #-} + +module T13528 ( + GHC.Exts.IsList( + Item + , fromList + , toList + ) + , Data.Bool.Bool(True, False) +) where + +import qualified GHC.Exts (IsList(..)) +import qualified Data.Bool (Bool(..)) diff --git a/testsuite/tests/module/all.T b/testsuite/tests/module/all.T index d7e6b74..6d05c77 100644 --- a/testsuite/tests/module/all.T +++ b/testsuite/tests/module/all.T @@ -282,3 +282,5 @@ test('T11970', normal, compile_fail, ['']) test('T11970A', [], multimod_compile, ['T11970A','-Wunused-imports']) test('T11970B', normal, compile_fail, ['']) test('MultiExport', normal, compile, ['']) +test('T13528', normal, compile, ['']) + From git at git.haskell.org Tue Apr 18 15:23:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 18 Apr 2017 15:23:39 +0000 (UTC) Subject: [commit: ghc] master: Update xhtml submodule to potential 3000.2.2 release commit (765a2e7) Message-ID: <20170418152339.D7FA03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/765a2e71f3dcc35fbe4b70677a67613c285dce60/ghc >--------------------------------------------------------------- commit 765a2e71f3dcc35fbe4b70677a67613c285dce60 Author: Herbert Valerio Riedel Date: Tue Apr 18 17:22:50 2017 +0200 Update xhtml submodule to potential 3000.2.2 release commit >--------------------------------------------------------------- 765a2e71f3dcc35fbe4b70677a67613c285dce60 libraries/xhtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/xhtml b/libraries/xhtml index 45e5cb8..8a8c8a4 160000 --- a/libraries/xhtml +++ b/libraries/xhtml @@ -1 +1 @@ -Subproject commit 45e5cb820a129780407bc37968364e4f64174f7d +Subproject commit 8a8c8a48bac2d3ed306b610a2e9fa393b5a7ffa5 From git at git.haskell.org Tue Apr 18 15:29:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 18 Apr 2017 15:29:45 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Update xhtml submodule to potential 3000.2.2 release commit (28802ac) Message-ID: <20170418152945.DA4693A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/28802acf2690a111e34ba1bd8a1e054fcce2cf93/ghc >--------------------------------------------------------------- commit 28802acf2690a111e34ba1bd8a1e054fcce2cf93 Author: Herbert Valerio Riedel Date: Tue Apr 18 17:22:50 2017 +0200 Update xhtml submodule to potential 3000.2.2 release commit (cherry picked from commit 765a2e71f3dcc35fbe4b70677a67613c285dce60) >--------------------------------------------------------------- 28802acf2690a111e34ba1bd8a1e054fcce2cf93 libraries/xhtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/xhtml b/libraries/xhtml index 45e5cb8..8a8c8a4 160000 --- a/libraries/xhtml +++ b/libraries/xhtml @@ -1 +1 @@ -Subproject commit 45e5cb820a129780407bc37968364e4f64174f7d +Subproject commit 8a8c8a48bac2d3ed306b610a2e9fa393b5a7ffa5 From git at git.haskell.org Tue Apr 18 20:19:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 18 Apr 2017 20:19:28 +0000 (UTC) Subject: [commit: ghc] master: Fix LaTeX in core-spec (60699e1) Message-ID: <20170418201928.B25D33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/60699e120bfd3455fbdb957b28667e6ba9b4df0a/ghc >--------------------------------------------------------------- commit 60699e120bfd3455fbdb957b28667e6ba9b4df0a Author: Joachim Breitner Date: Tue Apr 18 16:18:33 2017 -0400 Fix LaTeX in core-spec where d49b2bb21691892ca6ac8f2403e31f2a5e53feb3 introduced some TeX breakage, and re-generate core-spec.pdf. >--------------------------------------------------------------- 60699e120bfd3455fbdb957b28667e6ba9b4df0a docs/core-spec/core-spec.mng | 2 +- docs/core-spec/core-spec.pdf | Bin 348416 -> 349621 bytes 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core-spec/core-spec.mng b/docs/core-spec/core-spec.mng index 623ba0e..0b147f9 100644 --- a/docs/core-spec/core-spec.mng +++ b/docs/core-spec/core-spec.mng @@ -101,7 +101,7 @@ There are a few key invariants about expressions: \begin{itemize} \item The right-hand sides of all top-level and recursive $[[let]]$s must be of lifted type, with one exception: the right-hand side of a top-level -$[[let]]$ may be of type \texttt{Addr#} if it's a primitive string literal. +$[[let]]$ may be of type \texttt{Addr\#} if it's a primitive string literal. See \verb|#top_level_invariant#| in \ghcfile{coreSyn/CoreSyn.hs}. \item The right-hand side of a non-recursive $[[let]]$ and the argument of an application may be of unlifted type, but only if the expression diff --git a/docs/core-spec/core-spec.pdf b/docs/core-spec/core-spec.pdf index a06ffd0..f45e871 100644 Binary files a/docs/core-spec/core-spec.pdf and b/docs/core-spec/core-spec.pdf differ From git at git.haskell.org Tue Apr 18 21:06:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 18 Apr 2017 21:06:18 +0000 (UTC) Subject: [commit: ghc] master: Add failing test case for #13588 (ebb780f) Message-ID: <20170418210618.9E9263A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ebb780f1b384b0d2fa2517c1b8093930ea12b6de/ghc >--------------------------------------------------------------- commit ebb780f1b384b0d2fa2517c1b8093930ea12b6de Author: Joachim Breitner Date: Tue Apr 18 17:05:10 2017 -0400 Add failing test case for #13588 >--------------------------------------------------------------- ebb780f1b384b0d2fa2517c1b8093930ea12b6de .../should_compile/Makefile | 0 testsuite/tests/simplStg/should_compile/T13588.hs | 11 ++ .../tests/simplStg/should_compile/T13588.stderr | 194 +++++++++++++++++++++ testsuite/tests/simplStg/should_compile/all.T | 22 +++ 4 files changed, 227 insertions(+) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc ebb780f1b384b0d2fa2517c1b8093930ea12b6de From git at git.haskell.org Tue Apr 18 22:58:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 18 Apr 2017 22:58:09 +0000 (UTC) Subject: [commit: ghc] master: Revert "linker/mach-o: Catch the case where there is no symCmd" (fc7601c) Message-ID: <20170418225809.5068A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fc7601c5dc9fb826db13c5a644b3a64e7594d0b5/ghc >--------------------------------------------------------------- commit fc7601c5dc9fb826db13c5a644b3a64e7594d0b5 Author: Ben Gamari Date: Mon Apr 17 21:02:07 2017 -0400 Revert "linker/mach-o: Catch the case where there is no symCmd" This causes validation failures on Windows. This reverts commit 6c05b27e5bafe9f232e7014f4760335f5e3ba591. >--------------------------------------------------------------- fc7601c5dc9fb826db13c5a644b3a64e7594d0b5 rts/Linker.c | 2 -- rts/linker/MachO.c | 4 +--- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/rts/Linker.c b/rts/Linker.c index b214e9c..7366904 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -1215,8 +1215,6 @@ mkOc( pathchar *path, char *image, int imageSize, IF_DEBUG(linker, debugBelch("mkOc: start\n")); oc = stgMallocBytes(sizeof(ObjectCode), "mkOc(oc)"); - oc->info = NULL; - # if defined(OBJFORMAT_ELF) oc->formatName = "ELF"; # elif defined(OBJFORMAT_PEi386) diff --git a/rts/linker/MachO.c b/rts/linker/MachO.c index e09d151..16b712a 100644 --- a/rts/linker/MachO.c +++ b/rts/linker/MachO.c @@ -130,9 +130,7 @@ ocInit_MachO(ObjectCode * oc) oc->info->nlist = oc->info->symCmd == NULL ? NULL : (MachONList *)(oc->image + oc->info->symCmd->symoff); - oc->info->names = oc->info->symCmd == NULL - ? NULL - : (oc->image + oc->info->symCmd->stroff); + oc->info->names = oc->image + oc->info->symCmd->stroff; /* If we have symbols, allocate and fill the macho_symbols * This will make relocation easier. From git at git.haskell.org Tue Apr 18 22:59:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 18 Apr 2017 22:59:24 +0000 (UTC) Subject: [commit: ghc] branch 'wip/T13588' created Message-ID: <20170418225924.7365B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/T13588 Referencing: 94e31735f3d45d839e48e44cb58fcdd65ad3ba23 From git at git.haskell.org Tue Apr 18 22:59:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 18 Apr 2017 22:59:27 +0000 (UTC) Subject: [commit: ghc] wip/T13588: core-spec: Simplify the handling of LetRec (2572e82) Message-ID: <20170418225927.336AE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T13588 Link : http://ghc.haskell.org/trac/ghc/changeset/2572e820b9d1f0d7f4c32b3d8ebace4b12d494ee/ghc >--------------------------------------------------------------- commit 2572e820b9d1f0d7f4c32b3d8ebace4b12d494ee Author: Joachim Breitner Date: Tue Apr 18 16:33:38 2017 -0400 core-spec: Simplify the handling of LetRec We do not need to keep an enrivonment around to implement letrec, as long as we only do call-by-name. Instead, evaluate letrec by substituting for all the variables with their RHS wrapped in the letrec binding. Since nothing adds to the enrivonment any more, there is no need for a S_Var rule. >--------------------------------------------------------------- 2572e820b9d1f0d7f4c32b3d8ebace4b12d494ee docs/core-spec/OpSem.ott | 62 +++++++++++++++---------------------------- docs/core-spec/core-spec.mng | 18 +++---------- docs/core-spec/core-spec.pdf | Bin 349621 -> 346103 bytes 3 files changed, 24 insertions(+), 56 deletions(-) diff --git a/docs/core-spec/OpSem.ott b/docs/core-spec/OpSem.ott index b833b74..8fb9b0e 100644 --- a/docs/core-spec/OpSem.ott +++ b/docs/core-spec/OpSem.ott @@ -19,92 +19,72 @@ grammar defns OpSem :: '' ::= -defn S |- e --> e' :: :: step :: 'S_' {{ com Single step semantics }} -{{ tex \begin{array}{l} [[S]] \labeledjudge{op} [[e]] [[-->]] [[e']] \end{array} }} +defn e --> e' :: :: step :: 'S_' {{ com Single step semantics }} +{{ tex \begin{array}{l} [[e]] [[-->]] [[e']] \end{array} }} by -S(n) = e ------------------ :: Var -S |- n --> e - -S |- e1 --> e1' +e1 --> e1' ------------------- :: App -S |- e1 e2 --> e1' e2 +e1 e2 --> e1' e2 ----------------------------- :: Beta -S |- (\n.e1) e2 --> e1[n |-> e2] +(\n.e1) e2 --> e1[n |-> e2] g0 = sym (nth 0 g) g1 = nth 1 g not e2 is_a_type not e2 is_a_coercion ----------------------------------------------- :: Push -S |- ((\n.e1) |> g) e2 --> (\n.e1 |> g1) (e2 |> g0) +((\n.e1) |> g) e2 --> (\n.e1 |> g1) (e2 |> g0) ---------------------------------------- :: TPush -S |- ((\n.e) |> g) t --> (\n.(e |> g n)) t +((\n.e) |> g) t --> (\n.(e |> g n)) t g0 = nth 1 (nth 0 g) g1 = sym (nth 2 (nth 0 g)) g2 = nth 1 g ------------------------------- :: CPush -S |- ((\n.e) |> g) g' --> (\n.e |> g2) (g0 ; g' ; g1) +((\n.e) |> g) g' --> (\n.e |> g2) (g0 ; g' ; g1) --------------------------------------- :: Trans -S |- (e |> g1) |> g2 --> e |> (g1 ; g2) +(e |> g1) |> g2 --> e |> (g1 ; g2) -S |- e --> e' +e --> e' ------------------------ :: Cast -S |- e |> g --> e' |> g +e |> g --> e' |> g -S |- e --> e' +e --> e' ------------------------------ :: Tick -S |- e { tick } --> e' { tick } +e { tick } --> e' { tick } -S |- e --> e' +e --> e' --------------------------------------- :: Case -S |- case e as n return t of --> case e' as n return t of +case e as n return t of --> case e' as n return t of altj = K -> u e = K u' = u[n |-> e] sbb] // bb /> ecc] // cc /> -------------------------------------------------------------- :: MatchData -S |- case e as n return t of --> u' +case e as n return t of --> u' altj = lit -> u ---------------------------------------------------------------- :: MatchLit -S |- case lit as n return t of --> u[n |-> lit] +case lit as n return t of --> u[n |-> lit] altj = _ -> u no other case matches ------------------------------------------------------------ :: MatchDefault -S |- case e as n return t of --> u[n |-> e] +case e as n return t of --> u[n |-> e] T k'~#k T = coercionKind g forall . forall . $ -> T = dataConRepType K (t1cc $ nth aa g] // aa /> _Nom] // bb />) // cc /> --------------------------- :: CasePush -S |- case (K ) |> g as n return t2 of --> \\ case K as n return t2 of +case (K ) |> g as n return t2 of --> \\ case K as n return t2 of ----------------- :: LetNonRec -S |- let n = e1 in e2 --> e2[n |-> e1] +let n = e1 in e2 --> e2[n |-> e1] -S, ei] // i /> |- u --> u' ------------------------------------ :: LetRec -S |- let rec in u --> let rec in u' - ---------------- :: LetRecApp -S |- (let rec in u) e' --> let rec in (u e') - ----------------- :: LetRecCast -S |- (let rec in u) |> g --> let rec in (u |> g) - ---------------- :: LetRecCase -S |- case (let rec in u) as n0 return t of --> \\ let rec in (case u as n0 return t of ) - ---------------- :: LetRecFlat -S |- let rec in (let rec in u) --> let rec ;; in u +let rec in u --> u let rec in ei ] // i /> -fv(u) \inter = empty ---------------------------------- :: LetRecReturn -S |- let rec in u --> u diff --git a/docs/core-spec/core-spec.mng b/docs/core-spec/core-spec.mng index 0b147f9..d1d8905 100644 --- a/docs/core-spec/core-spec.mng +++ b/docs/core-spec/core-spec.mng @@ -473,14 +473,9 @@ analogously to \texttt{CoreLint.lhs}. Nevertheless, these rules are included in this document to help the reader understand System FC. -\subsection{The context $[[S]]$} -We use a context $[[S]]$ to keep track of the values of variables in a (mutually) -recursive group. Its definition is as follows: -\[ -[[S]] \quad ::= \quad [[ empty ]] \ |\ [[S]], [[ [n |-> e] ]] -\] -The presence of the context $[[S]]$ is solely to deal with recursion. If your -use of FC does not require modeling recursion, you will not need to track $[[S]]$. +Also note that this semantics implements call-by-name, not call-by-need. So +while it describes the operational meaning of a term, it does not describe what +subexpressions are shared, and when. \subsection{Operational semantics rules} @@ -489,13 +484,6 @@ use of FC does not require modeling recursion, you will not need to track $[[S]] \subsection{Notes} \begin{itemize} -\item The \ottdrulename{S\_LetRec} rules -implement recursion. \ottdrulename{S\_LetRec} adds to the context $[[S]]$ bindings -for all of the mutually recursive equations. Then, after perhaps many steps, -when the body of the $[[let]]\ [[rec]]$ contains no variables that are bound -in the $[[let]]\ [[rec]]$, the context is popped in \ottdrulename{S\_LetRecReturn}. -The other \ottdrulename{S\_LetRecXXX} -rules are there to prevent reduction from getting stuck. \item In the $[[case]]$ rules, a constructor $[[K]]$ is written taking three lists of arguments: two lists of types and a list of terms. The types passed in are the universally and, respectively, existentially quantified type variables diff --git a/docs/core-spec/core-spec.pdf b/docs/core-spec/core-spec.pdf index f45e871..dde6c9e 100644 Binary files a/docs/core-spec/core-spec.pdf and b/docs/core-spec/core-spec.pdf differ From git at git.haskell.org Tue Apr 18 22:59:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 18 Apr 2017 22:59:29 +0000 (UTC) Subject: [commit: ghc] wip/T13588: Simplify StgCases when all alts refer to the case binder (94e3173) Message-ID: <20170418225929.DF3B13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T13588 Link : http://ghc.haskell.org/trac/ghc/changeset/94e31735f3d45d839e48e44cb58fcdd65ad3ba23/ghc >--------------------------------------------------------------- commit 94e31735f3d45d839e48e44cb58fcdd65ad3ba23 Author: Joachim Breitner Date: Tue Apr 18 17:20:59 2017 -0400 Simplify StgCases when all alts refer to the case binder as proposed in #13588. Differential Revision: https://phabricator.haskell.org/D3467 >--------------------------------------------------------------- 94e31735f3d45d839e48e44cb58fcdd65ad3ba23 compiler/simplStg/StgCse.hs | 31 ++++++++++++++++++++++++++- testsuite/tests/simplStg/should_compile/all.T | 2 +- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/compiler/simplStg/StgCse.hs b/compiler/simplStg/StgCse.hs index 1ee6a9a..ec4b188 100644 --- a/compiler/simplStg/StgCse.hs +++ b/compiler/simplStg/StgCse.hs @@ -293,7 +293,7 @@ stgCseExpr env (StgTick tick body) = let body' = stgCseExpr env body in StgTick tick body' stgCseExpr env (StgCase scrut bndr ty alts) - = StgCase scrut' bndr' ty alts' + = mkStgCase scrut' bndr' ty alts' where scrut' = stgCseExpr env scrut (env1, bndr') = substBndr env bndr @@ -381,6 +381,17 @@ stgCseRhs env bndr (StgRhsClosure ccs info occs upd args body) in (Just (substVar env bndr, StgRhsClosure ccs info occs' upd args' body'), env) where occs' = substVars env occs + +mkStgCase :: StgExpr -> OutId -> AltType -> [StgAlt] -> StgExpr +mkStgCase scrut bndr ty alts | all isBndr alts = scrut + | otherwise = StgCase scrut bndr ty alts + + where + -- see Note [All alternatives are the binder] + isBndr (_, _, StgApp f []) = f == bndr + isBndr _ = False + + -- Utilities -- | This function short-cuts let-bindings that are now obsolete @@ -390,6 +401,24 @@ mkStgLet stgLet (Just binds) body = stgLet binds body {- +Note [All alternatives are the binder] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +When all alternatives simply refer to the case binder, then we do not have +to bother with the case expression at all (#13588). CoreSTG does this as well, +but sometimes, types get into the way: + + newtype T = MkT Int + f :: (Int, Int) -> (T, Int) + f (x, y) = (MkT x, y) + +Core cannot just turn this into + + f p = p + +as this would not be well-typed. But to STG, where MkT is no longer in the way, +we can. + Note [Trivial case scrutinee] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ We want to be able to handle nested reconstruction of constructors as in diff --git a/testsuite/tests/simplStg/should_compile/all.T b/testsuite/tests/simplStg/should_compile/all.T index 559d357..19fa513 100644 --- a/testsuite/tests/simplStg/should_compile/all.T +++ b/testsuite/tests/simplStg/should_compile/all.T @@ -19,4 +19,4 @@ def checkStgString(needle): -test('T13588', [ checkStgString('case'), expect_broken(13588) ] , compile, ['-ddump-stg']) +test('T13588', [ checkStgString('case') ] , compile, ['-ddump-stg']) From git at git.haskell.org Wed Apr 19 00:17:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 19 Apr 2017 00:17:25 +0000 (UTC) Subject: [commit: ghc] branch 'wip/T13588' deleted Message-ID: <20170419001725.4C3C03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Deleted branch: wip/T13588 From git at git.haskell.org Wed Apr 19 00:18:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 19 Apr 2017 00:18:16 +0000 (UTC) Subject: [commit: ghc] master: Simplify StgCases when all alts refer to the case binder (21c35bd) Message-ID: <20170419001816.161243A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/21c35bda8e435cfba1998fa8375a52a73fe570f4/ghc >--------------------------------------------------------------- commit 21c35bda8e435cfba1998fa8375a52a73fe570f4 Author: Joachim Breitner Date: Tue Apr 18 17:20:59 2017 -0400 Simplify StgCases when all alts refer to the case binder as proposed in #13588. Differential Revision: https://phabricator.haskell.org/D3467 >--------------------------------------------------------------- 21c35bda8e435cfba1998fa8375a52a73fe570f4 compiler/simplStg/StgCse.hs | 31 ++++++++++++++++++++++++++- testsuite/tests/simplStg/should_compile/all.T | 2 +- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/compiler/simplStg/StgCse.hs b/compiler/simplStg/StgCse.hs index 1ee6a9a..ec4b188 100644 --- a/compiler/simplStg/StgCse.hs +++ b/compiler/simplStg/StgCse.hs @@ -293,7 +293,7 @@ stgCseExpr env (StgTick tick body) = let body' = stgCseExpr env body in StgTick tick body' stgCseExpr env (StgCase scrut bndr ty alts) - = StgCase scrut' bndr' ty alts' + = mkStgCase scrut' bndr' ty alts' where scrut' = stgCseExpr env scrut (env1, bndr') = substBndr env bndr @@ -381,6 +381,17 @@ stgCseRhs env bndr (StgRhsClosure ccs info occs upd args body) in (Just (substVar env bndr, StgRhsClosure ccs info occs' upd args' body'), env) where occs' = substVars env occs + +mkStgCase :: StgExpr -> OutId -> AltType -> [StgAlt] -> StgExpr +mkStgCase scrut bndr ty alts | all isBndr alts = scrut + | otherwise = StgCase scrut bndr ty alts + + where + -- see Note [All alternatives are the binder] + isBndr (_, _, StgApp f []) = f == bndr + isBndr _ = False + + -- Utilities -- | This function short-cuts let-bindings that are now obsolete @@ -390,6 +401,24 @@ mkStgLet stgLet (Just binds) body = stgLet binds body {- +Note [All alternatives are the binder] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +When all alternatives simply refer to the case binder, then we do not have +to bother with the case expression at all (#13588). CoreSTG does this as well, +but sometimes, types get into the way: + + newtype T = MkT Int + f :: (Int, Int) -> (T, Int) + f (x, y) = (MkT x, y) + +Core cannot just turn this into + + f p = p + +as this would not be well-typed. But to STG, where MkT is no longer in the way, +we can. + Note [Trivial case scrutinee] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ We want to be able to handle nested reconstruction of constructors as in diff --git a/testsuite/tests/simplStg/should_compile/all.T b/testsuite/tests/simplStg/should_compile/all.T index 559d357..19fa513 100644 --- a/testsuite/tests/simplStg/should_compile/all.T +++ b/testsuite/tests/simplStg/should_compile/all.T @@ -19,4 +19,4 @@ def checkStgString(needle): -test('T13588', [ checkStgString('case'), expect_broken(13588) ] , compile, ['-ddump-stg']) +test('T13588', [ checkStgString('case') ] , compile, ['-ddump-stg']) From git at git.haskell.org Thu Apr 20 19:20:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 20 Apr 2017 19:20:51 +0000 (UTC) Subject: [commit: ghc] master: testsuite: disable 'optllvm' for unregisterised compiler (a18f58d) Message-ID: <20170420192051.A94D63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a18f58d2290c5d5d44c7850ea04de279110d228b/ghc >--------------------------------------------------------------- commit a18f58d2290c5d5d44c7850ea04de279110d228b Author: Sergei Trofimovich Date: Thu Apr 20 20:13:25 2017 +0100 testsuite: disable 'optllvm' for unregisterised compiler commit 74615f412ad3de2910a156ff494bfe5497fada7e ("UNREG: ignore -fllvm (Trac #13495)") enabled 'optllvm' tests to be ran in 'make fulltest' mode. As a result many (~1000) tests fail due to stderr misamatch: +when making flags consistent: warning: + Compiler unregisterised, so compiling via C The change removes 'optllvm' tests for unregisterised compiler. Signed-off-by: Sergei Trofimovich >--------------------------------------------------------------- a18f58d2290c5d5d44c7850ea04de279110d228b testsuite/config/ghc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/config/ghc b/testsuite/config/ghc index 959422e..6a368e8 100644 --- a/testsuite/config/ghc +++ b/testsuite/config/ghc @@ -62,7 +62,7 @@ else: if (config.have_profiling and ghc_with_threaded_rts == 1): config.run_ways.append('profthreaded') -if (ghc_with_llvm == 1): +if (ghc_with_llvm == 1 and not config.unregisterised): config.compile_ways.append('optllvm') config.run_ways.append('optllvm') From git at git.haskell.org Thu Apr 20 20:14:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 20 Apr 2017 20:14:47 +0000 (UTC) Subject: [commit: ghc] master: pprDebugCLabel: drop duplicate trailing ')' (526d2eb) Message-ID: <20170420201447.8191E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/526d2ebc218fc289771eedb4a1d5a5477967ed5b/ghc >--------------------------------------------------------------- commit 526d2ebc218fc289771eedb4a1d5a5477967ed5b Author: Sergei Trofimovich Date: Thu Apr 20 20:49:26 2017 +0100 pprDebugCLabel: drop duplicate trailing ')' Signed-off-by: Sergei Trofimovich >--------------------------------------------------------------- 526d2ebc218fc289771eedb4a1d5a5477967ed5b compiler/cmm/CLabel.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/cmm/CLabel.hs b/compiler/cmm/CLabel.hs index d7051f7..3ba4f76 100644 --- a/compiler/cmm/CLabel.hs +++ b/compiler/cmm/CLabel.hs @@ -360,7 +360,7 @@ pprDebugCLabel lbl <+> ppr src <+> ppr funOrData) - _ -> ppr lbl <> (parens $ text "other CLabel)") + _ -> ppr lbl <> (parens $ text "other CLabel") data IdLabelInfo @@ -416,7 +416,7 @@ data RtsLabelInfo -- Determines the suffix appended to the name when a CLabel.CmmLabel -- is pretty printed. data CmmLabelInfo - = CmmInfo -- ^ misc rts info tabless, suffix _info + = CmmInfo -- ^ misc rts info tables, suffix _info | CmmEntry -- ^ misc rts entry points, suffix _entry | CmmRetInfo -- ^ misc rts ret info tables, suffix _info | CmmRet -- ^ misc rts return points, suffix _ret From git at git.haskell.org Fri Apr 21 06:41:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 06:41:40 +0000 (UTC) Subject: [commit: packages/haskeline] master: Add MonadExcept IdentityT instance (cfaeafa) Message-ID: <20170421064140.6E98A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/haskeline On branch : master Link : http://git.haskell.org/packages/haskeline.git/commitdiff/cfaeafae9d4a2bf957d2a683a69a95bfc146f2fc >--------------------------------------------------------------- commit cfaeafae9d4a2bf957d2a683a69a95bfc146f2fc Author: Vladislav Zavialov Date: Mon Apr 3 17:38:50 2017 +0300 Add MonadExcept IdentityT instance >--------------------------------------------------------------- cfaeafae9d4a2bf957d2a683a69a95bfc146f2fc System/Console/Haskeline/MonadException.hs | 3 ++- haskeline.cabal | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/System/Console/Haskeline/MonadException.hs b/System/Console/Haskeline/MonadException.hs index 372557d..b796bf0 100644 --- a/System/Console/Haskeline/MonadException.hs +++ b/System/Console/Haskeline/MonadException.hs @@ -33,6 +33,7 @@ import Prelude hiding (catch) #endif import Control.Monad(liftM, join) import Control.Monad.IO.Class +import Control.Monad.Trans.Identity import Control.Monad.Trans.Reader import Control.Monad.Trans.State.Strict import Control.Monad.Trans.Error @@ -179,4 +180,4 @@ instance (Monoid w, MonadException m) => MonadException (RWST r w s m) where . run . (\m -> runRWST m r s)) in fmap (\m -> runRWST m r s) $ f run' - +deriving instance MonadException m => MonadException (IdentityT m) diff --git a/haskeline.cabal b/haskeline.cabal index 11d280c..ace63ec 100644 --- a/haskeline.cabal +++ b/haskeline.cabal @@ -52,6 +52,7 @@ Library TypeSynonymInstances FlexibleContexts, ExistentialQuantification ScopedTypeVariables, GeneralizedNewtypeDeriving + StandaloneDeriving MultiParamTypeClasses, OverlappingInstances UndecidableInstances ScopedTypeVariables, CPP, DeriveDataTypeable, From git at git.haskell.org Fri Apr 21 06:41:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 06:41:42 +0000 (UTC) Subject: [commit: packages/haskeline] master: Merge pull request #59 from int-index/monadexception-identityt (d6b5bbb) Message-ID: <20170421064142.738583A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/haskeline On branch : master Link : http://git.haskell.org/packages/haskeline.git/commitdiff/d6b5bbbad3c90c65f61b72a26ff40722b7a2a006 >--------------------------------------------------------------- commit d6b5bbbad3c90c65f61b72a26ff40722b7a2a006 Merge: 91f6afd cfaeafa Author: Judah Jacobson Date: Mon Apr 3 09:34:59 2017 -0700 Merge pull request #59 from int-index/monadexception-identityt Add MonadException IdentityT instance >--------------------------------------------------------------- d6b5bbbad3c90c65f61b72a26ff40722b7a2a006 System/Console/Haskeline/MonadException.hs | 3 ++- haskeline.cabal | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) From git at git.haskell.org Fri Apr 21 06:41:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 06:41:48 +0000 (UTC) Subject: [commit: packages/haskeline] master: Merge pull request #62 from hvr/pr/simple-buildtype (5b27278) Message-ID: <20170421064148.8599D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/haskeline On branch : master Link : http://git.haskell.org/packages/haskeline.git/commitdiff/5b27278d26e1e72742b47c7bb02f854cd3d93934 >--------------------------------------------------------------- commit 5b27278d26e1e72742b47c7bb02f854cd3d93934 Merge: d6b5bbb d98ba27 Author: Judah Jacobson Date: Thu Apr 20 15:01:49 2017 -0700 Merge pull request #62 from hvr/pr/simple-buildtype Change to simple build-type & minor ver increment >--------------------------------------------------------------- 5b27278d26e1e72742b47c7bb02f854cd3d93934 Setup.hs | 30 +----------------------------- haskeline.cabal | 5 +++-- 2 files changed, 4 insertions(+), 31 deletions(-) From git at git.haskell.org Fri Apr 21 06:41:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 06:41:46 +0000 (UTC) Subject: [commit: packages/haskeline] master: Increment package version to 0.7.4.0 (d98ba27) Message-ID: <20170421064146.7F6F83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/haskeline On branch : master Link : http://git.haskell.org/packages/haskeline.git/commitdiff/d98ba27107bb15e690d72840c11b53a711af8ab0 >--------------------------------------------------------------- commit d98ba27107bb15e690d72840c11b53a711af8ab0 Author: Herbert Valerio Riedel Date: Thu Apr 20 23:00:06 2017 +0200 Increment package version to 0.7.4.0 A minor version increment is required relative to 0.7.3.1 due to the recent API addition of the `MonadExcept IdentityT` instance >--------------------------------------------------------------- d98ba27107bb15e690d72840c11b53a711af8ab0 haskeline.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/haskeline.cabal b/haskeline.cabal index c031c2f..808b4e0 100644 --- a/haskeline.cabal +++ b/haskeline.cabal @@ -1,6 +1,6 @@ Name: haskeline Cabal-Version: >=1.10 -Version: 0.7.3.1 +Version: 0.7.4.0 Category: User Interfaces License: BSD3 License-File: LICENSE From git at git.haskell.org Fri Apr 21 06:41:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 06:41:44 +0000 (UTC) Subject: [commit: packages/haskeline] master: Convert to simple build-type (43d7fa1) Message-ID: <20170421064144.793DD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/haskeline On branch : master Link : http://git.haskell.org/packages/haskeline.git/commitdiff/43d7fa106027fcd4ec7f443923a8dd5b8c169f9c >--------------------------------------------------------------- commit 43d7fa106027fcd4ec7f443923a8dd5b8c169f9c Author: Herbert Valerio Riedel Date: Thu Apr 20 22:50:40 2017 +0200 Convert to simple build-type The logic in Setup.hs doesn't affect the build per-se, but rather prints out a purely informational warning on non-windows systems in case `terminfo` is disabled. However, the upcoming Cabal 2.0 API breaks the Setup.hs script so it's easier to just convert to simple build-type and avoid the additional complexity and overhead. >--------------------------------------------------------------- 43d7fa106027fcd4ec7f443923a8dd5b8c169f9c Setup.hs | 30 +----------------------------- haskeline.cabal | 3 ++- 2 files changed, 3 insertions(+), 30 deletions(-) diff --git a/Setup.hs b/Setup.hs index 68ce844..9a994af 100644 --- a/Setup.hs +++ b/Setup.hs @@ -1,30 +1,2 @@ -import Distribution.System -import Distribution.PackageDescription import Distribution.Simple -import Distribution.Simple.Setup - -import Control.Monad(when) - -main :: IO () -main = defaultMainWithHooks myHooks - -myHooks :: UserHooks -myHooks - | buildOS == Windows = simpleUserHooks - | otherwise = simpleUserHooks { - confHook = \genericDescript flags -> do - warnIfNotTerminfo flags - confHook simpleUserHooks genericDescript flags - } - -warnIfNotTerminfo flags = when (not (hasFlagSet flags (FlagName "terminfo"))) - $ mapM_ putStrLn - [ "*** Warning: running on POSIX but not building the terminfo backend. ***" - , "You may need to install the terminfo package manually, e.g. with" - , "\"cabal install terminfo\"; or, use \"-fterminfo\" when configuring or" - , "installing this package." - ,"" - ] - -hasFlagSet :: ConfigFlags -> FlagName -> Bool -hasFlagSet cflags flag = Just True == lookup flag (configConfigurationsFlags cflags) +main = defaultMain diff --git a/haskeline.cabal b/haskeline.cabal index ace63ec..c031c2f 100644 --- a/haskeline.cabal +++ b/haskeline.cabal @@ -19,7 +19,7 @@ Description: Homepage: http://trac.haskell.org/haskeline Bug-Reports: https://github.com/judah/haskeline/issues Stability: Stable -Build-Type: Custom +Build-Type: Simple extra-source-files: examples/Test.hs Changelog includes/*.h source-repository head @@ -37,6 +37,7 @@ source-repository head flag terminfo Description: Use the terminfo package for POSIX consoles. Default: True + Manual: True Library -- We require ghc>=7.4.1 (base>=4.5) to use the base library encodings, even From git at git.haskell.org Fri Apr 21 06:41:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 06:41:50 +0000 (UTC) Subject: [commit: packages/haskeline] master: Update Changelog for 0.7.4.0. (d5ef581) Message-ID: <20170421064150.8BB193A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/haskeline On branch : master Link : http://git.haskell.org/packages/haskeline.git/commitdiff/d5ef581a19218b96946921c5f092bafe1739e30b >--------------------------------------------------------------- commit d5ef581a19218b96946921c5f092bafe1739e30b Author: Judah Jacobson Date: Thu Apr 20 15:05:03 2017 -0700 Update Changelog for 0.7.4.0. >--------------------------------------------------------------- d5ef581a19218b96946921c5f092bafe1739e30b Changelog | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Changelog b/Changelog index 388e339..e3e6d05 100644 --- a/Changelog +++ b/Changelog @@ -1,8 +1,12 @@ -next: +Changed in version 0.7.4.0: * Properly process Unicode key events on Windows. + * Add an instance MonadExcept IdentityT. + * Remove custom Setup logic to support Cabal 2.0. + Changed in version 0.7.3.1: * Properly disable echoing in getPassword when running in MinTTY. * Use `cast` from Data.Typeable instead of Data.Dynamic. + 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 From git at git.haskell.org Fri Apr 21 06:42:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 06:42:00 +0000 (UTC) Subject: [commit: packages/haskeline] tag '0.7.4.0' created Message-ID: <20170421064200.BDFFA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/haskeline New tag : 0.7.4.0 Referencing: 20c82294e563ffe7bebb4f446f9afd963c1fa672 From git at git.haskell.org Fri Apr 21 07:29:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 07:29:42 +0000 (UTC) Subject: [commit: ghc] master: utils/debugNCG: remove old tool (24cf688) Message-ID: <20170421072942.5CF7E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/24cf688b4882a931241e707a97926dcd11de0039/ghc >--------------------------------------------------------------- commit 24cf688b4882a931241e707a97926dcd11de0039 Author: Sergei Trofimovich Date: Fri Apr 21 08:27:58 2017 +0100 utils/debugNCG: remove old tool Signed-off-by: Sergei Trofimovich Reviewers: simonmar, austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3476 >--------------------------------------------------------------- 24cf688b4882a931241e707a97926dcd11de0039 utils/debugNCG/Diff_Gcc_Nat.hs | 380 ----------------------------------------- utils/debugNCG/Makefile | 19 --- utils/debugNCG/README | 46 ----- 3 files changed, 445 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 24cf688b4882a931241e707a97926dcd11de0039 From git at git.haskell.org Fri Apr 21 09:18:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 09:18:41 +0000 (UTC) Subject: [commit: ghc] master: Sync up haskeline submodule to 0.7.4.0 release tag (a1ffd70) Message-ID: <20170421091841.58AA13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a1ffd70835fba3aeb5be5c5d526e068cafe277be/ghc >--------------------------------------------------------------- commit a1ffd70835fba3aeb5be5c5d526e068cafe277be Author: Herbert Valerio Riedel Date: Fri Apr 21 01:44:03 2017 +0200 Sync up haskeline submodule to 0.7.4.0 release tag >--------------------------------------------------------------- a1ffd70835fba3aeb5be5c5d526e068cafe277be libraries/haskeline | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/haskeline b/libraries/haskeline index 91f6afd..d5ef581 160000 --- a/libraries/haskeline +++ b/libraries/haskeline @@ -1 +1 @@ -Subproject commit 91f6afd971fde46423237bfa5215e95365017f99 +Subproject commit d5ef581a19218b96946921c5f092bafe1739e30b From git at git.haskell.org Fri Apr 21 16:31:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:31:10 +0000 (UTC) Subject: [commit: packages/terminfo] master: Bump upper bound on base (315b1ee) Message-ID: <20170421163110.31E6C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/terminfo On branch : master Link : http://git.haskell.org/packages/terminfo.git/commitdiff/315b1ee9b7b53219075b5d779a0fd747d087f799 >--------------------------------------------------------------- commit 315b1ee9b7b53219075b5d779a0fd747d087f799 Author: Ben Gamari Date: Tue Dec 13 16:43:00 2016 -0500 Bump upper bound on base base 4.10 will ship with GHC 8.2.1. >--------------------------------------------------------------- 315b1ee9b7b53219075b5d779a0fd747d087f799 terminfo.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terminfo.cabal b/terminfo.cabal index 2dfbee9..745aa12 100644 --- a/terminfo.cabal +++ b/terminfo.cabal @@ -29,7 +29,7 @@ Library other-extensions: CPP, DeriveDataTypeable, FlexibleInstances, ScopedTypeVariables if impl(ghc>=7.3) other-extensions: Safe, Trustworthy - build-depends: base >= 4.3 && < 4.10 + build-depends: base >= 4.3 && < 4.11 ghc-options: -Wall exposed-modules: System.Console.Terminfo From git at git.haskell.org Fri Apr 21 16:31:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:31:12 +0000 (UTC) Subject: [commit: packages/terminfo] master: Minor version bump to 0.4.1.0 (052e13e) Message-ID: <20170421163112.35E793A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/terminfo On branch : master Link : http://git.haskell.org/packages/terminfo.git/commitdiff/052e13ee441b9a1d49a255d00a75bd6ad0483526 >--------------------------------------------------------------- commit 052e13ee441b9a1d49a255d00a75bd6ad0483526 Author: Herbert Valerio Riedel Date: Tue Apr 18 10:20:11 2017 +0200 Minor version bump to 0.4.1.0 Due to new added instance via 19500c702f87680a5f143331286bd4755912ec05 / #13 since version 0.4.0.2 >--------------------------------------------------------------- 052e13ee441b9a1d49a255d00a75bd6ad0483526 terminfo.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terminfo.cabal b/terminfo.cabal index 745aa12..79bb367 100644 --- a/terminfo.cabal +++ b/terminfo.cabal @@ -1,6 +1,6 @@ Name: terminfo Cabal-Version: >=1.10 -Version: 0.4.0.2 +Version: 0.4.1.0 Category: User Interfaces License: BSD3 License-File: LICENSE From git at git.haskell.org Fri Apr 21 16:31:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:31:14 +0000 (UTC) Subject: [commit: packages/terminfo] master: Merge Git history with upstream again (e4bab81) Message-ID: <20170421163114.3AB483A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/terminfo On branch : master Link : http://git.haskell.org/packages/terminfo.git/commitdiff/e4bab81c683ce271a177c9d6b386c6ada3985997 >--------------------------------------------------------------- commit e4bab81c683ce271a177c9d6b386c6ada3985997 Merge: 052e13e 315b1ee Author: Herbert Valerio Riedel Date: Tue Apr 18 10:22:11 2017 +0200 Merge Git history with upstream again >--------------------------------------------------------------- e4bab81c683ce271a177c9d6b386c6ada3985997 From git at git.haskell.org Fri Apr 21 16:31:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:31:16 +0000 (UTC) Subject: [commit: packages/terminfo] master: Merge pull request #20 from hvr/pr/for-ghc-8.2.1 (c39f12c) Message-ID: <20170421163116.403893A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/terminfo On branch : master Link : http://git.haskell.org/packages/terminfo.git/commitdiff/c39f12cf41fc47b54723d9e9a08487e8e9dd119e >--------------------------------------------------------------- commit c39f12cf41fc47b54723d9e9a08487e8e9dd119e Merge: 315b1ee e4bab81 Author: Judah Jacobson Date: Tue Apr 18 06:23:32 2017 -0700 Merge pull request #20 from hvr/pr/for-ghc-8.2.1 Minor version bump to 0.4.1.0 and Git-branch sync-up >--------------------------------------------------------------- c39f12cf41fc47b54723d9e9a08487e8e9dd119e terminfo.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) From git at git.haskell.org Fri Apr 21 16:31:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:31:20 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Caret diag.: Avoid decoding whole module if only specific line is needed (ec5a49f) Message-ID: <20170421163120.610563A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/ec5a49fe34180da0adcd7956ad60a9f8ba04c775/ghc >--------------------------------------------------------------- commit ec5a49fe34180da0adcd7956ad60a9f8ba04c775 Author: alexbiehl Date: Mon Apr 17 12:51:10 2017 -0400 Caret diag.: Avoid decoding whole module if only specific line is needed Before we were decoding the whole file to get to the desired line. This patch introduces a fast function which searches a StringBuffer for the desired line so we only need to utf8 decode a little portion. This is especially interesting if we have big modules with lots of warnings. Reviewers: austin, bgamari, Rufflewind, trofi Reviewed By: Rufflewind, trofi Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3440 (cherry picked from commit 065be6e9eb5114c5f0e3a20626ec93042ce47f13) >--------------------------------------------------------------- ec5a49fe34180da0adcd7956ad60a9f8ba04c775 compiler/main/ErrUtils.hs | 27 +++++++++++++-------------- compiler/utils/StringBuffer.hs | 40 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 52 insertions(+), 15 deletions(-) diff --git a/compiler/main/ErrUtils.hs b/compiler/main/ErrUtils.hs index 180d18d..ded7085 100644 --- a/compiler/main/ErrUtils.hs +++ b/compiler/main/ErrUtils.hs @@ -64,7 +64,7 @@ import qualified PprColour as Col import SrcLoc import DynFlags import FastString (unpackFS) -import StringBuffer (hGetStringBuffer, len, lexemeToString) +import StringBuffer (atLine, hGetStringBuffer, len, lexemeToString) import Json import System.Directory @@ -231,27 +231,26 @@ getSeverityColour _ = const mempty getCaretDiagnostic :: Severity -> SrcSpan -> IO MsgDoc getCaretDiagnostic _ (UnhelpfulSpan _) = pure empty getCaretDiagnostic severity (RealSrcSpan span) = do - caretDiagnostic <$> getSrcLine (srcSpanFile span) (row - 1) + caretDiagnostic <$> getSrcLine (srcSpanFile span) row where - - getSrcLine fn i = do - (getLine i <$> readFile' (unpackFS fn)) - `catchIOError` \ _ -> + getSrcLine fn i = + getLine i (unpackFS fn) + `catchIOError` \_ -> pure Nothing - getLine i contents = - case drop i (lines contents) of - srcLine : _ -> Just srcLine - [] -> Nothing - - readFile' fn = do + getLine i fn = do -- StringBuffer has advantages over readFile: -- (a) no lazy IO, otherwise IO exceptions may occur in pure code -- (b) always UTF-8, rather than some system-dependent encoding -- (Haskell source code must be UTF-8 anyway) - buf <- hGetStringBuffer fn - pure (fix <$> lexemeToString buf (len buf)) + content <- hGetStringBuffer fn + case atLine i content of + Just at_line -> pure $ + case lines (fix <$> lexemeToString at_line (len at_line)) of + srcLine : _ -> Just srcLine + _ -> Nothing + _ -> pure Nothing -- allow user to visibly see that their code is incorrectly encoded -- (StringBuffer.nextChar uses \0 to represent undecodable characters) diff --git a/compiler/utils/StringBuffer.hs b/compiler/utils/StringBuffer.hs index bac752a..2c16428 100644 --- a/compiler/utils/StringBuffer.hs +++ b/compiler/utils/StringBuffer.hs @@ -6,7 +6,7 @@ Buffers for scanning string input stored in external arrays. -} -{-# LANGUAGE CPP, MagicHash, UnboxedTuples #-} +{-# LANGUAGE BangPatterns, CPP, MagicHash, UnboxedTuples #-} {-# OPTIONS_GHC -O #-} -- We always optimise this, otherwise performance of a non-optimised -- compiler is severely affected @@ -32,6 +32,7 @@ module StringBuffer stepOn, offsetBytes, byteDiff, + atLine, -- * Conversion lexemeToString, @@ -239,6 +240,43 @@ byteDiff s1 s2 = cur s2 - cur s1 atEnd :: StringBuffer -> Bool atEnd (StringBuffer _ l c) = l == c +-- | Computes a 'StringBuffer' which points to the first character of the +-- wanted line. Lines begin at 1. +atLine :: Int -> StringBuffer -> Maybe StringBuffer +atLine line sb@(StringBuffer buf len _) = + inlinePerformIO $ + withForeignPtr buf $ \p -> do + p' <- skipToLine line len p + if p' == nullPtr + then return Nothing + else + let + delta = p' `minusPtr` p + in return $ Just (sb { cur = delta + , len = len - delta + }) + +skipToLine :: Int -> Int -> Ptr Word8 -> IO (Ptr Word8) +skipToLine !line !len !op0 = go 1 op0 + where + !opend = op0 `plusPtr` len + + go !i_line !op + | op >= opend = pure nullPtr + | i_line == line = pure op + | otherwise = do + w <- peek op :: IO Word8 + case w of + 10 -> go (i_line + 1) (plusPtr op 1) + 13 -> do + -- this is safe because a 'StringBuffer' is + -- guaranteed to have 3 bytes sentinel values. + w' <- peek (plusPtr op 1) :: IO Word8 + case w' of + 10 -> go (i_line + 1) (plusPtr op 2) + _ -> go (i_line + 1) (plusPtr op 1) + _ -> go i_line (plusPtr op 1) + -- ----------------------------------------------------------------------------- -- Conversion From git at git.haskell.org Fri Apr 21 16:31:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:31:23 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: utils: Lazily decode UTF8 strings (0eb5004) Message-ID: <20170421163123.203AA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/0eb5004ae3d58032bb48d77a19bed556af7c4f72/ghc >--------------------------------------------------------------- commit 0eb5004ae3d58032bb48d77a19bed556af7c4f72 Author: Ben Gamari Date: Mon Apr 17 12:26:56 2017 -0400 utils: Lazily decode UTF8 strings Reviewers: austin, hvr Subscribers: rwbarton, thomie GHC Trac Issues: #13527 Differential Revision: https://phabricator.haskell.org/D3442 (cherry picked from commit 1cc82d38759c7a5f527ccc6cb514b8ba576cc3d1) >--------------------------------------------------------------- 0eb5004ae3d58032bb48d77a19bed556af7c4f72 compiler/utils/Encoding.hs | 34 +++++++++++++++++++++++----------- compiler/utils/FastString.hs | 4 +--- compiler/utils/StringBuffer.hs | 4 +--- ghc/GHCi/UI.hs | 3 +-- 4 files changed, 26 insertions(+), 19 deletions(-) diff --git a/compiler/utils/Encoding.hs b/compiler/utils/Encoding.hs index 712de6c..f2b0979 100644 --- a/compiler/utils/Encoding.hs +++ b/compiler/utils/Encoding.hs @@ -17,7 +17,8 @@ module Encoding ( utf8PrevChar, utf8CharStart, utf8DecodeChar, - utf8DecodeString, + utf8DecodeByteString, + utf8DecodeStringLazy, utf8EncodeChar, utf8EncodeString, utf8EncodedLength, @@ -33,9 +34,15 @@ module Encoding ( ) where import Foreign +import Foreign.ForeignPtr.Unsafe import Data.Char import qualified Data.Char as Char import Numeric +import GHC.IO + +import Data.ByteString (ByteString) +import qualified Data.ByteString.Internal as BS + import GHC.Exts -- ----------------------------------------------------------------------------- @@ -115,19 +122,24 @@ utf8CharStart p = go p then go (p `plusPtr` (-1)) else return p -utf8DecodeString :: Ptr Word8 -> Int -> IO [Char] -utf8DecodeString ptr len - = unpack ptr +utf8DecodeByteString :: ByteString -> [Char] +utf8DecodeByteString (BS.PS ptr offset len) + = utf8DecodeStringLazy ptr offset len + +utf8DecodeStringLazy :: ForeignPtr Word8 -> Int -> Int -> [Char] +utf8DecodeStringLazy fptr offset len + = unsafeDupablePerformIO $ unpack start where - !end = ptr `plusPtr` len + !start = unsafeForeignPtrToPtr fptr `plusPtr` offset + !end = start `plusPtr` len unpack p - | p >= end = return [] - | otherwise = - case utf8DecodeChar# (unPtr p) of - (# c#, nBytes# #) -> do - chs <- unpack (p `plusPtr#` nBytes#) - return (C# c# : chs) + | p >= end = touchForeignPtr fptr >> return [] + | otherwise = + case utf8DecodeChar# (unPtr p) of + (# c#, nBytes# #) -> do + rest <- unsafeDupableInterleaveIO $ unpack (p `plusPtr#` nBytes#) + return (C# c# : rest) countUTF8Chars :: Ptr Word8 -> Int -> IO Int countUTF8Chars ptr len = go ptr 0 diff --git a/compiler/utils/FastString.hs b/compiler/utils/FastString.hs index 8d1bbb5..8653485 100644 --- a/compiler/utils/FastString.hs +++ b/compiler/utils/FastString.hs @@ -485,9 +485,7 @@ nullFS f = BS.null (fs_bs f) -- | Unpacks and decodes the FastString unpackFS :: FastString -> String -unpackFS (FastString _ _ bs _) = - inlinePerformIO $ BS.unsafeUseAsCStringLen bs $ \(ptr, len) -> - utf8DecodeString (castPtr ptr) len +unpackFS (FastString _ _ bs _) = utf8DecodeByteString bs -- | Gives the UTF-8 encoded bytes corresponding to a 'FastString' bytesFS :: FastString -> [Word8] diff --git a/compiler/utils/StringBuffer.hs b/compiler/utils/StringBuffer.hs index 2c16428..1b50d59 100644 --- a/compiler/utils/StringBuffer.hs +++ b/compiler/utils/StringBuffer.hs @@ -288,9 +288,7 @@ lexemeToString :: StringBuffer -> String lexemeToString _ 0 = "" lexemeToString (StringBuffer buf _ cur) bytes = - inlinePerformIO $ - withForeignPtr buf $ \ptr -> - utf8DecodeString (ptr `plusPtr` cur) bytes + utf8DecodeStringLazy buf cur bytes lexemeToFastString :: StringBuffer -> Int -- ^ @n@, the number of bytes diff --git a/ghc/GHCi/UI.hs b/ghc/GHCi/UI.hs index e612b76..14de6bf 100644 --- a/ghc/GHCi/UI.hs +++ b/ghc/GHCi/UI.hs @@ -3525,8 +3525,7 @@ listAround pan do_highlight = do prefixed = zipWith ($) highlighted bs_line_nos output = BS.intercalate (BS.pack "\n") prefixed - utf8Decoded <- liftIO $ BS.useAsCStringLen output - $ \(p,n) -> utf8DecodeString (castPtr p) n + let utf8Decoded = utf8DecodeByteString output liftIO $ putStrLn utf8Decoded where file = GHC.srcSpanFile pan From git at git.haskell.org Fri Apr 21 16:31:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:31:25 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: testsuite: disable 'optllvm' for unregisterised compiler (b4c8ed7) Message-ID: <20170421163125.D24963A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/b4c8ed7578558da906d08e8e320cccd524ff8ff3/ghc >--------------------------------------------------------------- commit b4c8ed7578558da906d08e8e320cccd524ff8ff3 Author: Sergei Trofimovich Date: Thu Apr 20 20:13:25 2017 +0100 testsuite: disable 'optllvm' for unregisterised compiler commit 74615f412ad3de2910a156ff494bfe5497fada7e ("UNREG: ignore -fllvm (Trac #13495)") enabled 'optllvm' tests to be ran in 'make fulltest' mode. As a result many (~1000) tests fail due to stderr misamatch: +when making flags consistent: warning: + Compiler unregisterised, so compiling via C The change removes 'optllvm' tests for unregisterised compiler. Signed-off-by: Sergei Trofimovich (cherry picked from commit a18f58d2290c5d5d44c7850ea04de279110d228b) >--------------------------------------------------------------- b4c8ed7578558da906d08e8e320cccd524ff8ff3 testsuite/config/ghc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/config/ghc b/testsuite/config/ghc index 959422e..6a368e8 100644 --- a/testsuite/config/ghc +++ b/testsuite/config/ghc @@ -62,7 +62,7 @@ else: if (config.have_profiling and ghc_with_threaded_rts == 1): config.run_ways.append('profthreaded') -if (ghc_with_llvm == 1): +if (ghc_with_llvm == 1 and not config.unregisterised): config.compile_ways.append('optllvm') config.run_ways.append('optllvm') From git at git.haskell.org Fri Apr 21 16:31:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:31:28 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Bump haskeline and terminfo submodules (9febdd5) Message-ID: <20170421163128.8AB653A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/9febdd5703695b9b133f12c6c1acf63698dc97c9/ghc >--------------------------------------------------------------- commit 9febdd5703695b9b133f12c6c1acf63698dc97c9 Author: Ben Gamari Date: Fri Apr 21 11:33:47 2017 -0400 Bump haskeline and terminfo submodules >--------------------------------------------------------------- 9febdd5703695b9b133f12c6c1acf63698dc97c9 libraries/haskeline | 2 +- libraries/terminfo | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/haskeline b/libraries/haskeline index 91f6afd..d5ef581 160000 --- a/libraries/haskeline +++ b/libraries/haskeline @@ -1 +1 @@ -Subproject commit 91f6afd971fde46423237bfa5215e95365017f99 +Subproject commit d5ef581a19218b96946921c5f092bafe1739e30b diff --git a/libraries/terminfo b/libraries/terminfo index 6ab1dff..c39f12c 160000 --- a/libraries/terminfo +++ b/libraries/terminfo @@ -1 +1 @@ -Subproject commit 6ab1dffebc0665dd347eba351a495dd80032d0e5 +Subproject commit c39f12cf41fc47b54723d9e9a08487e8e9dd119e From git at git.haskell.org Fri Apr 21 16:42:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:42:41 +0000 (UTC) Subject: [commit: packages/time] branch 'posix-perf' created Message-ID: <20170421164241.7858F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time New branch : posix-perf Referencing: f37d418745e0ba95788dfbba355ef3cf87d16b0f From git at git.haskell.org Fri Apr 21 16:42:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:42:43 +0000 (UTC) Subject: [commit: packages/time] branch 'tasty' created Message-ID: <20170421164243.785353A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time New branch : tasty Referencing: c9756f78625e0a1aa5247d97ed3ff85f4df94d75 From git at git.haskell.org Fri Apr 21 16:42:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:42:45 +0000 (UTC) Subject: [commit: packages/time] branch 'improve-leapseconds' created Message-ID: <20170421164245.792CD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time New branch : improve-leapseconds Referencing: 7b1dddd9d1d0fe4bc3c82d8dedb9ca3232b556b1 From git at git.haskell.org Fri Apr 21 16:42:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:42:47 +0000 (UTC) Subject: [commit: packages/time] branch 'ghc' created Message-ID: <20170421164247.7A16B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time New branch : ghc Referencing: d03429e1913b6babd3b59d0bfdd7d3904b1b6f0b From git at git.haskell.org Fri Apr 21 16:42:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:42:49 +0000 (UTC) Subject: [commit: packages/time] branch 'format-widths' created Message-ID: <20170421164249.7AF813A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time New branch : format-widths Referencing: 85904c55ecce05534fc5b5341fca0611350e3591 From git at git.haskell.org Fri Apr 21 16:42:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:42:51 +0000 (UTC) Subject: [commit: packages/time] branch 'ghc-7.8' created Message-ID: <20170421164251.7C1BB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time New branch : ghc-7.8 Referencing: adafac26307cffab0be20c126385ab161c259237 From git at git.haskell.org Fri Apr 21 16:42:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:42:53 +0000 (UTC) Subject: [commit: packages/time] branch 'wip/travis' created Message-ID: <20170421164253.7CFCB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time New branch : wip/travis Referencing: b837d6c1a7ba651fe67043a27d2bd0ffea2235fa From git at git.haskell.org Fri Apr 21 16:42:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:42:55 +0000 (UTC) Subject: [commit: packages/time] branch 'ghc-head' deleted Message-ID: <20170421164255.7DC953A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time Deleted branch: ghc-head From git at git.haskell.org Fri Apr 21 16:42:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:42:57 +0000 (UTC) Subject: [commit: packages/time] branch 'ezyang-scrap' deleted Message-ID: <20170421164257.7F12B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time Deleted branch: ezyang-scrap From git at git.haskell.org Fri Apr 21 16:42:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:42:59 +0000 (UTC) Subject: [commit: packages/time] tag '1.8.0.1' created Message-ID: <20170421164259.7FC9B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time New tag : 1.8.0.1 Referencing: 79842db7069734842519145fbff17531d7bd82b2 From git at git.haskell.org Fri Apr 21 16:43:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:43:01 +0000 (UTC) Subject: [commit: packages/time] tag 'time-1.5.0.1-release' created Message-ID: <20170421164301.80E013A584@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 Fri Apr 21 16:43:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:43:03 +0000 (UTC) Subject: [commit: packages/time] tag '1.8' created Message-ID: <20170421164303.8169C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time New tag : 1.8 Referencing: 72728f2151aa207bce94fc0da4d6b28b2bac17df From git at git.haskell.org Fri Apr 21 16:43:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:43:05 +0000 (UTC) Subject: [commit: packages/time] tag 'time-1.6-release' created Message-ID: <20170421164305.8253E3A584@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 Fri Apr 21 16:43:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:43:07 +0000 (UTC) Subject: [commit: packages/time] tag 'time-1.6.0.1-release' created Message-ID: <20170421164307.82F0B3A584@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 Fri Apr 21 16:43:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:43:09 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: initial revision, including draft of Clock and outlines of TAI and Calendar (239f07b) Message-ID: <20170421164309.8F9E33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:43:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:43:11 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: make diff times instances of Num (7339f64) Message-ID: <20170421164311.96ADF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:43:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:43:13 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: export addUTCTime and diffUTCTime (3dfb0c3) Message-ID: <20170421164313.9D41B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:43:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:43:15 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: get TAI to compile (cf576d3) Message-ID: <20170421164315.A42CF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:43:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:43:17 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: clean up Makefile (cc4d5c2) Message-ID: <20170421164317.AA9483A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:43:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:43:19 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, 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: <20170421164319.B2BAD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:43:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:43:21 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: more haddock comments, timezone conversion functions (3ad0923) Message-ID: <20170421164321.BA6793A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:43:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:43:23 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: add dayToCalendar function, with test (266f005) Message-ID: <20170421164323.C1EBD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:43:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:43:25 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: more calendar functions, plus test for UTC - Calendar conversion (70e1b39) Message-ID: <20170421164325.C857A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:43:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:43:27 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: UT1 calendar functions, with test (49c8b0d) Message-ID: <20170421164327.CFA9B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:43:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:43:29 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: clean up Makefile (b1c2cb6) Message-ID: <20170421164329.D610B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:43:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:43:31 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: remove -fglasgow-exts, add -Wall -Werror to all library modules (8ae7ab8) Message-ID: <20170421164331.DE1573A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:43:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:43:33 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: new Data.Fixed module with test, move System.Time.* to Fixed arithmetic (fd8f5d0) Message-ID: <20170421164333.E511A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:43:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:43:35 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: use realToFrac (dfadfd1) Message-ID: <20170421164335.EBED03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:43:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:43:37 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: getCurrentTimezone, with test (cb6d14e) Message-ID: <20170421164337.F35113A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:43:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:43:40 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: fix Enums to conform with Haskell 98 (and GHC 6.4) (59ab29a) Message-ID: <20170421164340.069513A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:43:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:43:42 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: use correct time C header (0d51531) Message-ID: <20170421164342.0D9673A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:43:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:43:44 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Makefile to clean properly (0a170a3) Message-ID: <20170421164344.13AEE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:43:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:43:46 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: convert to Cabal (a352b22) Message-ID: <20170421164346.1B23C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:43:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:43:48 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: time-zone test (3317848) Message-ID: <20170421164348.224C63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:43:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:43:50 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: correct time-zone handling (066e6ee) Message-ID: <20170421164350.28ADA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:43:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:43:52 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: fix posixToCTime for compile on 6.4 (81468e1) Message-ID: <20170421164352.2F27A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:43:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:43:54 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: expose getTimeZone (51caf03) Message-ID: <20170421164354.35C623A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:43:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:43:56 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: rename id to Timezone (126e42f) Message-ID: <20170421164356.3CBEC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:43:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:43:58 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: midnight and midday (5564e25) Message-ID: <20170421164358.440E13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:44:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:44:00 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Eq and Ord instances for UTCTime (2ba76c8) Message-ID: <20170421164400.4A63C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:44:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:44:02 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: add ShowDST test program (445ae81) Message-ID: <20170421164402.51FB13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:44:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:44:04 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: generalise calendar type, split Calendar module (78c7468) Message-ID: <20170421164404.5B0353A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:44:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:44:06 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: first attempt at formatting (with failing test) (2678bff) Message-ID: <20170421164406.64C1A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:44:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:44:08 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: add DST field to Timezone (471f5ea) Message-ID: <20170421164408.6B96C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:44:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:44:10 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: add GNU and other extensions to formatting (ce92c0a) Message-ID: <20170421164410.72B873A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:44:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:44:12 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: generalise types with classes, introduce zoned time (1c076bc) Message-ID: <20170421164412.7AC1B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:44:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:44:14 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: fix for Makefile (86fca98) Message-ID: <20170421164414.8194B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:44:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:44:16 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: add %s format option to ZonedTime (18b9d5a) Message-ID: <20170421164416.88B1A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:44:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:44:20 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: build/test target fiddling in Makefile (1c01493) Message-ID: <20170421164420.9618E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:44:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:44:18 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: add name to Timezone (d028ced) Message-ID: <20170421164418.8FA543A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:44:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:44:22 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: better type for formatCharacter (a55e303) Message-ID: <20170421164422.9E6073A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:44:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:44:24 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, 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: <20170421164424.A8AA33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:44:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:44:26 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Clock documentation (622d6b5) Message-ID: <20170421164426.AF0943A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:44:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:44:28 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: TAI documentation (0782592) Message-ID: <20170421164428.B5A4D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:44:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:44:30 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: test in Makefile (e12e45e) Message-ID: <20170421164430.BBF933A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:44:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:44:32 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: fix decodeDay in ISOWeek, with improved ConvertBack test (899a104) Message-ID: <20170421164432.C29823A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:44:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:44:34 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: remove maybeDecodeDay (7ece834) Message-ID: <20170421164434.C952E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:44:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:44:36 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: fix week-based formatting chars, with more testing (f61178d) Message-ID: <20170421164436.D07F93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:44:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:44:38 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: organise week functions (73c160c) Message-ID: <20170421164438.D79723A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:44:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:44:40 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: clean up some type names, more doc (23be1cb) Message-ID: <20170421164440.E10BB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:44:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:44:42 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: CalendarTime synonym with convenience functions (f853253) Message-ID: <20170421164442.E846E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:44:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:44:44 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: better tz for test (865557b) Message-ID: <20170421164444.EE4423A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:44:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:44:47 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: better C type for name param (7a52230) Message-ID: <20170421164447.015403A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:44:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:44:49 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: XCode 2.0 project (1ecbd6c) Message-ID: <20170421164449.09EF53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:44:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:44:51 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: clean up XCode project & makefile (0bb6871) Message-ID: <20170421164451.10F2E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:44:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:44:53 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: hide submodules in Haddock docs (e128961) Message-ID: <20170421164453.185E33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:44:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:44:55 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: use "time" for package name (f323ece) Message-ID: <20170421164455.1F1063A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:44:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:44:57 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: put doc index in project (c2214f5) Message-ID: <20170421164457.266CB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:44:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:44:59 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: split up System.Time.Clock (462818f) Message-ID: <20170421164459.300DF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:45:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:45:01 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: migrate to XCode 2.1 (64d9973) Message-ID: <20170421164501.388E13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:45:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:45:03 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: use BSD license (02e4b6b) Message-ID: <20170421164503.3FAD13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:45:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:45:05 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: fix cabal file private mods (1a29bf0) Message-ID: <20170421164505.462633A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:45:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:45:07 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: add missing Current file (bcb1ac3) Message-ID: <20170421164507.4D68A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:45:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:45:09 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: fix exposed/hidden module lists in cabal file (53e4437) Message-ID: <20170421164509.549043A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:45:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:45:11 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: difftime doc seconds (cdfb558) Message-ID: <20170421164511.5B5163A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:45:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:45:13 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: rename ISOWeek to ISOWeekDay (3ccb9bf) Message-ID: <20170421164513.63FAB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:45:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:45:15 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Separate out DayEncoding into Days.hs (0fdf95f) Message-ID: <20170421164515.6EC453A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:45:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:45:17 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Major simplification of calendar types (3cec8f8) Message-ID: <20170421164517.773673A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:45:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:45:19 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: move from System to Data (64ab015) Message-ID: <20170421164519.82D7B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:45:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:45:21 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: correct showing of years before 1000 CE, with test (869ebcc) Message-ID: <20170421164521.8ABBC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:45:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:45:23 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: clip incorrect values in converters, with tests (b107508) Message-ID: <20170421164523.95D113A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:45:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:45:25 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: new gregorianMonthLength function (cfab0ea) Message-ID: <20170421164525.9C3B63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:45:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:45:27 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: conversion documentation (c2ff391) Message-ID: <20170421164527.A301D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:45:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:45:29 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: more time doc (8cea925) Message-ID: <20170421164529.A9C963A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:45:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:45:31 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: rename names in Data.Time.Calendar.Calendar (f35dd9e) Message-ID: <20170421164531.B35A13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:45:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:45:33 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: reorg modules with new LocalTime hier (ce92c8a) Message-ID: <20170421164533.BEBED3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:45:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:45:35 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Timezone -> TimeZone (3db5c8e) Message-ID: <20170421164535.C78713A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:45:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:45:37 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: fix TimeLib.cabal (aba753e) Message-ID: <20170421164537.CEA983A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:45:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:45:39 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: tiny doc fix (e2b7e0f) Message-ID: <20170421164539.D5F243A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:45:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:45:41 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: rename to-converter functions (f783b6b) Message-ID: <20170421164541.DD7D33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:45:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:45:43 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: rename Date to Day (9c5fedd) Message-ID: <20170421164543.E5DFF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:45:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:45:45 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: reorder modules in Makefile (bbbc983) Message-ID: <20170421164545.ECF4F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:45:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:45:48 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: add months (with test) (853190e) Message-ID: <20170421164548.02E793A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:45:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:45:50 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: clean up deps (957955c) Message-ID: <20170421164550.095AB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:45:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:45:52 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: rename ISOWeekDay to ISO8601Week (8723c5f) Message-ID: <20170421164552.12FDE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:45:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:45:54 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: utcToLocalZonedTime (5f330c5) Message-ID: <20170421164554.19E393A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:45:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:45:56 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: rename UTCDiffTime to NominalDiffTime (6a21693) Message-ID: <20170421164556.20FC73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:45:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:45:58 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: use cases (as test) (68e172c) Message-ID: <20170421164558.295713A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:46:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:46:00 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: add missing file (70544be) Message-ID: <20170421164600.302EC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:46:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:46:02 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: add missing file (e3f3a03) Message-ID: <20170421164602.375B03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:46:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:46:04 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: get taiToUTCTime working (with test) (db06886) Message-ID: <20170421164604.4245D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:46:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:46:06 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: comments (cae9a55) Message-ID: <20170421164606.48DF83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:46:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:46:08 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: set cabal to 0.2 (e1f3f24) Message-ID: <20170421164608.4FC1F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:46:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:46:10 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: instance Show UTCTime (c03ad77) Message-ID: <20170421164610.567DA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:46:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:46:12 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: more sensible identifer names (acc1fc8) Message-ID: <20170421164612.5D9423A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:46:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:46:14 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: version 0.2.1 (68b10d9) Message-ID: <20170421164614.637A83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:46:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:46:16 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: ZonedTime id names (e0937c8) Message-ID: <20170421164616.6A6A23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:46:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:46:18 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: new MonthDay module (f4e177d) Message-ID: <20170421164618.766863A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:46:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:46:20 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Julian and Easter calendars (869b07f) Message-ID: <20170421164620.810043A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:46:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:46:22 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: move ISO8601Week to separate module space (b802476) Message-ID: <20170421164622.879C23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:46:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:46:24 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: fix identifier in UseCases.lhs (0e3dd85) Message-ID: <20170421164624.8E43F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:46:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:46:26 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: move out MonthDay and YearDay (6f8d525) Message-ID: <20170421164626.9509F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:46:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:46:28 +0000 (UTC) Subject: [commit: packages/time] format-widths,ghc,improve-leapseconds,master,posix-perf,tasty,wip/travis: fix tests; rename ISO 8601 modules (be389b5) Message-ID: <20170421164628.A09F83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:46:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:46:30 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: more sensible WeekDate and OrdinalDate names (4752044) Message-ID: <20170421164630.A95DD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:46:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:46:32 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: version 0.3 (90f8854) Message-ID: <20170421164632.B02B33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:46:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:46:34 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: haddock comments for formatTime and others (8573895) Message-ID: <20170421164634.B6CDD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:46:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:46:36 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: move Data.Time.TAI to Data.Time.Clock.TAI (f99b7a1) Message-ID: <20170421164636.BFBEB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:46:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:46:38 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: sort out POSIX module mess (4bfc389) Message-ID: <20170421164638.C91C53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:46:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:46:40 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Big Split into separate fixed and time packages (f82aac1) Message-ID: <20170421164640.D8D0F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:46:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:46:42 +0000 (UTC) Subject: [commit: packages/time] format-widths,ghc,improve-leapseconds,master,posix-perf,tasty,wip/travis: add missing file; README file; root Makefile clean fix (76b8ca2) Message-ID: <20170421164642.E02353A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:46:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:46:44 +0000 (UTC) Subject: [commit: packages/time] format-widths,ghc,improve-leapseconds,master,posix-perf,tasty,wip/travis: export isLeapYear in Calendar; new version (eb6d142) Message-ID: <20170421164644.E768D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:46:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:46:46 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: remove everything not part of time package (df1c341) Message-ID: <20170421164646.EFE143A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:46:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:46:49 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: move time files to proper place (e29bc42) Message-ID: <20170421164649.04CF53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:46:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:46:51 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: make suitable for build process (7d86eaa) Message-ID: <20170421164651.0C25B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:46:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:46:53 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: haddock working with time package (021cdd7) Message-ID: <20170421164653.132913A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:46:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:46:55 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: set up boringfile (706483e) Message-ID: <20170421164655.1AFCA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:46:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:46:57 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: XCode build and temp files are boring (e5ea873) Message-ID: <20170421164657.20F7E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:46:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:46:59 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Various fixes to make this build & work on Windows (4b425ec) Message-ID: <20170421164659.2A9F03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:47:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:47:01 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: fix build breakage on Linux (a499f3f) Message-ID: <20170421164701.317B63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:47:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:47:03 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: CFILES directive for the benefit of Hugs (76bf7f8) Message-ID: <20170421164703.388C83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:47:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:47:05 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: remove dependency on ghcconfig.h (f67b546) Message-ID: <20170421164705.3FA7F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:47:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:47:09 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: fix typo (3721982) Message-ID: <20170421164709.4D12B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:47:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:47:07 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: extra Cabal fields for clean and sdist (37fd2cd) Message-ID: <20170421164707.469793A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:47:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:47:11 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: re-add #include "ghcconfig.h", conditional on __GLASGOW_HASKELL__ (17faab4) Message-ID: <20170421164711.5396A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:47:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:47:13 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: remove debugging code (580b6d2) Message-ID: <20170421164713.5A5613A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:47:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:47:15 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: use non-GHC-specific #ifdef test for Windows (d65e1de) Message-ID: <20170421164715.60F193A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:47:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:47:17 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: no need to include ghcconfig.h any more (cecf1ab) Message-ID: <20170421164717.67ECF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:47:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:47:19 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: eliminate the other mingw32_HOST_OS test (0108ad0) Message-ID: <20170421164719.6EA1A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:47:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:47:21 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Set version to 1.0 stable (0908d41) Message-ID: <20170421164721.74D6C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:47:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:47:23 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: add aclocal.m4 to extra sources (4def2c0) Message-ID: <20170421164723.7C0883A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:47:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:47:25 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: includes -> install-includes (ca25b1b) Message-ID: <20170421164725.830BE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:47:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:47:27 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: fix C-Sources (#893) (3b0c7d3) Message-ID: <20170421164727.8979E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:47:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:47:29 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: note CPP extension (0323c8c) Message-ID: <20170421164729.8FF7C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:47:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:47:31 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: fix up XCode project file for added files (b50f0c7) Message-ID: <20170421164731.985503A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:47:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:47:33 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: add Setup.hs (de08f7e) Message-ID: <20170421164733.9F9B83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:47:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:47:35 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, 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: <20170421164735.A5D7D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:47:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:47:37 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Fixed typo: s/propleptic/proleptic/. (927eb34) Message-ID: <20170421164737.AC41A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:47:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:47:39 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Added missing example for showWeekDate. (147381b) Message-ID: <20170421164739.B34A73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:47:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:47:41 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, 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: <20170421164741.BAA823A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:47:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:47:43 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Add secondsToDiffTime and picosecondsToDiffTime. (96ec994) Message-ID: <20170421164743.C1FF33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:47:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:47:45 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Added fromMondayStartWeek and fromSundayStartWeek to Data.Time.Calendar.OrdinalDate. (04282fe) Message-ID: <20170421164745.C83263A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:47:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:47:47 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Some haddock formatting for fromMondayStartWeek and fromSundayStartWeek. (c2bc34a) Message-ID: <20170421164747.CF3323A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:47:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:47:49 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Added Data.Time.LocalTime.Parse, UNIX-style time parsing. (06ad028) Message-ID: <20170421164749.D86B23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:47:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:47:51 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Updated SRC and dependencies in time/Makefile to include Data.Time.LocalTime.Parse. (d6ff855) Message-ID: <20170421164751.DF2363A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:47:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:47:53 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, 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: <20170421164753.E58BC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:47:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:47:55 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Added quickcheck properties for time parsing. (ad26aa5) Message-ID: <20170421164755.EF20D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:47:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:47:58 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, 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: <20170421164758.0145A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:48:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:48:00 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, 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: <20170421164800.079B93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:48:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:48:02 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, 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: <20170421164802.0F8543A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:48:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:48:04 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Fixed taiEpoch Haddock comment to include the epoch time. (1632436) Message-ID: <20170421164804.15EDE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:48:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:48:06 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: move test dir up, remove old junk (9b6744e) Message-ID: <20170421164806.200B13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:48:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:48:08 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: HsTime.h should be installed (acf02ec) Message-ID: <20170421164808.271D03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:48:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:48:10 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: clean up .xcodeproj to use cabal (5892926) Message-ID: <20170421164810.3095C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:48:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:48:12 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: improve error reporting in XCode (a4b8812) Message-ID: <20170421164812.389AF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:48:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:48:14 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: XCode tweak (ef08a05) Message-ID: <20170421164814.3F9253A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:48:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:48:16 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: xcodeproj cleanup (49451d6) Message-ID: <20170421164816.4686B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:48:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:48:18 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: attempt to get cabal test working (843ed89) Message-ID: <20170421164818.4CD283A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:48:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:48:20 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: get "runhaskell Setup.hs test" to work (ab61764) Message-ID: <20170421164820.540C63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:48:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:48:22 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Changed %S to return whole seconds, and added %Q and %q. (f73da90) Message-ID: <20170421164822.5B89F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:48:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:48:24 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: QuickCheck properties for the new %S, %q and %Q. (fcf3460) Message-ID: <20170421164824.61BB73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:48:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:48:28 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, 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: <20170421164828.700353A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:48:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:48:26 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Added %f: The century part of the week date year. (5ac1884) Message-ID: <20170421164826.68C263A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:48:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:48:30 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Cleaned up date parsing QuickCheck properties. (3750abf) Message-ID: <20170421164830.76E553A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:48:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:48:32 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: move parsing and formatting into new module (48535e6) Message-ID: <20170421164832.8044F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:48:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:48:34 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: README about building from darcs (09c85ef) Message-ID: <20170421164834.88D073A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:48:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:48:36 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: version 1.1 (28d5ef3) Message-ID: <20170421164836.8E9383A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:48:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:48:38 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: clean up HsTime (696f384) Message-ID: <20170421164838.95D5A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:48:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:48:40 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: build/license/boring cleanup (cc9a460) Message-ID: <20170421164840.9E0093A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:48:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:48:42 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Fixed hyperlinks to formatTime (7053937) Message-ID: <20170421164842.A4BFA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:48:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:48:44 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Added missing directory (a293612) Message-ID: <20170421164844.ABD5F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:48:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:48:46 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Make Setup.hs suitable for building in a GHC tree (2f507d7) Message-ID: <20170421164846.B2CE63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:48:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:48:48 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Fix -Wall warnings (ae16651) Message-ID: <20170421164848.B98783A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:48:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:48:50 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Hack due to time needing Win32 on Windows (dbd2265) Message-ID: <20170421164850.C01773A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:48:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:48:52 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Follow Cabal changes in Setup.*hs (fae8a55) Message-ID: <20170421164852.C7F383A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:48:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:48:54 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: We now need to check the exitcode of the tests (ccb1264) Message-ID: <20170421164854.CF34C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:48:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:48:56 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Bump version to 1.1.1 (9eb62d6) Message-ID: <20170421164856.D66883A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:48:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:48:58 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Remove Makefile and package.conf.in (used in the old GHC build system) (ef82b6f) Message-ID: <20170421164858.DD1883A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:49:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:49:00 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Follow base split (now dep on old-locale) (c0d8daf) Message-ID: <20170421164900.E3F523A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:49:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:49:02 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: --configure-option and --ghc-option are now provided by Cabal (a9edca5) Message-ID: <20170421164902.EB1783A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:49:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:49:04 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: #undef PACKAGE_NAME and friends to avoid clashes (2f36990) Message-ID: <20170421164904.F1CC43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:49:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:49:07 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Provide a configure flag to set which C compiler is used (96f1b36) Message-ID: <20170421164907.04D3C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:49:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:49:09 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: FIX #1486: timezone offset has the wrong sign on Windows (8e487ba) Message-ID: <20170421164909.0B64C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:49:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:49:11 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Use configurations rather than Setup.hs hacks (5b0af2b) Message-ID: <20170421164911.138C23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:49:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:49:13 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Track .cabal syntax changes once again (8b0d7b8) Message-ID: <20170421164913.1B0873A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:49:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:49:15 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Fixed Cabal-induced breakage, once again... (635d902) Message-ID: <20170421164915.21F543A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:49:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:49:17 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, 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: <20170421164917.286683A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:49:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:49:19 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Document the format used for output with %z. (894b1f8) Message-ID: <20170421164919.2F3A33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:49:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:49:21 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Haddock for parseTime and friends. (0f2e21b) Message-ID: <20170421164921.35A903A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:49:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:49:23 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Use configurations to allow building with ghc-6.6, 6.8 (eff99ca) Message-ID: <20170421164923.3D0513A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:49:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:49:25 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Bump version number (39c0eef) Message-ID: <20170421164925.448623A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:49:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:49:27 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: document how to get a POSIXTime from an EpochTime or CTime. (2869c91) Message-ID: <20170421164927.4D2563A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:49:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:49:29 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Figure out timezone offset from timezone name (3c404c3) Message-ID: <20170421164929.532293A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:49:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:49:31 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Bump version to 1.1.2.1 (71f2aa9) Message-ID: <20170421164931.59C323A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:49:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:49:33 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Remove -Wall and -Werror, they don't belong here (c46f680) Message-ID: <20170421164933.614BB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:49:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:49:35 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Change "accuracy" to "precision". (cc3dae0) Message-ID: <20170421164935.689B53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:49:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:49:37 +0000 (UTC) Subject: [commit: packages/time] format-widths,ghc,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: <20170421164937.6F9C93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:49:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:49:39 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: remove -ffi options (in favour of -XForeignFunctionInterface) (e581e9c) Message-ID: <20170421164939.776133A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:49:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:49:41 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Add x-follows-version-policy tag (230f9ee) Message-ID: <20170421164941.7DC0A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:49:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:49:43 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Bump version number to 1.1.2.2 (3f174bc) Message-ID: <20170421164943.852733A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:49:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:49:45 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Improve meta-data (989fc61) Message-ID: <20170421164945.8C2823A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:49:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:49:47 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, 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: <20170421164947.92A183A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:49:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:49:49 +0000 (UTC) Subject: [commit: packages/time] format-widths,ghc,improve-leapseconds,master,posix-perf,tasty,wip/travis: fix warnings; fix tests; remove GHC cruft; bump to 1.1.2.3 (578a832) Message-ID: <20170421164949.9B4883A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:49:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:49:51 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: fix Julian haddock docs (6a4e1ea) Message-ID: <20170421164951.A1F123A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:49:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:49:53 +0000 (UTC) Subject: [commit: packages/time] format-widths,ghc,improve-leapseconds,master,posix-perf,tasty,wip/travis: add Makefile for development building; remove OPTIONS -Wall -Werror in each file (a8f5da7) Message-ID: <20170421164953.AB1DA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:49:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:49:55 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: prop_name helper for defining named properties. (c8bba9b) Message-ID: <20170421164955.B173B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:49:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:49:57 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Properties for testing case-insensitivity. (bd8607f) Message-ID: <20170421164957.B80F53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:49:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:49:59 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Case-insensitive parsing. (781548a) Message-ID: <20170421164959.BEE6F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:50:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:50:03 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: get building on Windows (89e52b0) Message-ID: <20170421165003.CCDF93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:50:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:50:01 +0000 (UTC) Subject: [commit: packages/time] format-widths,ghc,improve-leapseconds,master,posix-perf,tasty,wip/travis: clean up .cabal; first attempt at Windows compilability (1e426ff) Message-ID: <20170421165001.C62863A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:50:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:50:05 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: next version will be 1.1.3 (1b7d9c2) Message-ID: <20170421165005.D36B83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:50:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:50:07 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Typeable instances for all types (1b0f97e) Message-ID: <20170421165007.DB7173A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:50:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:50:09 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: cap in .cabal (6d9856b) Message-ID: <20170421165009.E1B773A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:50:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:50:11 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: add validating converters (0cf7847) Message-ID: <20170421165011.EA37B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:50:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:50:13 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: use base==4.* (1a31e47) Message-ID: <20170421165013.F09C63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:50:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:50:16 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: add validating constructors (9884b31) Message-ID: <20170421165016.033DD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:50:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:50:18 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: version 1.1.4 (2c8d2f1) Message-ID: <20170421165018.0A90E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:50:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:50:20 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: formatTime: glibc-style modifier flags (2dc3703) Message-ID: <20170421165020.1434B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:50:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:50:22 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: update cabal-version constraint (2084584) Message-ID: <20170421165022.1A96D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:50:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:50:24 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: copyright date (f071372) Message-ID: <20170421165024.21AC23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:50:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:50:26 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: sort out GHC 6.12 warnings (66ee658) Message-ID: <20170421165026.288E93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:50:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:50:28 +0000 (UTC) Subject: [commit: packages/time] format-widths,ghc,improve-leapseconds,master,posix-perf,tasty,wip/travis: version 1.2; add Data instance, conditional on support (1bf713f) Message-ID: <20170421165028.302193A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:50:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:50:30 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: fix tests (cec60a0) Message-ID: <20170421165030.370453A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:50:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:50:32 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: get working with both GHC 6.10 and 6.12 (f4a0fd3) Message-ID: <20170421165032.4024B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:50:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:50:34 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: 1.2.0.1, include missing HsConfigure in sdist (bfa764f) Message-ID: <20170421165034.46A2B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:50:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:50:36 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: include test files in package (5c73538) Message-ID: <20170421165036.4FBE33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:50:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:50:38 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Fixed loss of accuracy in timeOfDayToDayFraction. (2677235) Message-ID: <20170421165038.546C33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:50:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:50:40 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: set version to 1.2.1 (5c06110) Message-ID: <20170421165040.5BEBD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:50:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:50:42 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: version 1.2.0.3 is more appropriate than 1.2.1. (aeb4c0e) Message-ID: <20170421165042.632143A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:50:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:50:44 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: test says Success (f3d2c2a) Message-ID: <20170421165044.68DE53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:50:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:50:46 +0000 (UTC) Subject: [commit: packages/time] format-widths,ghc,improve-leapseconds,master,posix-perf,tasty,wip/travis: fix parse "undefined" bug; added TestParseTime into tests (c5041a7) Message-ID: <20170421165046.70BE63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:50:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:50:48 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: .run files are boring (ff06923) Message-ID: <20170421165048.770E13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:50:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:50:50 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: specify QuickCheck version (1c69e66) Message-ID: <20170421165050.7E5DA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:50:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:50:52 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: test for %y parse to 1969 - 2068 (ac3fc0b) Message-ID: <20170421165052.84B6B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:50:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:50:54 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: test parse %C %y (c3d1c28) Message-ID: <20170421165054.8BF093A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:50:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:50:56 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: parse %y range 1969 - 2068, bug #2671 (84f1505) Message-ID: <20170421165056.92DDB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:50:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:50:58 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: test for parse %m single digit (3dd4c2c) Message-ID: <20170421165058.99E753A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:51:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:51:00 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: test parse %d %e single digit (8028949) Message-ID: <20170421165100.A11AD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:51:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:51:02 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: test parse %-m single digit (7cef519) Message-ID: <20170421165102.A85063A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:51:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:51:04 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: allow - _ 0 modifiers in % parsing (b2902c9) Message-ID: <20170421165104.AF9913A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:51:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:51:06 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: version 1.2.0.5 (c8c840a) Message-ID: <20170421165106.B68363A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:51:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:51:08 +0000 (UTC) Subject: [commit: packages/time] format-widths,ghc,improve-leapseconds,master,posix-perf,tasty,wip/travis: correct padding in parse; doc (83ec536) Message-ID: <20170421165108.BCF2F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:51:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:51:12 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: NFData instances, contributed by Herbert Valerio Riedel (4466857) Message-ID: <20170421165112.CA48B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:51:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:51:10 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: version 1.3: instance RealFrac DiffTime (234e6ce) Message-ID: <20170421165110.C38943A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:51:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:51:14 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: remove upper bound on deepseq dependency (e395b77) Message-ID: <20170421165114.D1DCC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:51:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:51:16 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: RULES for realToFrac, for speed, contributed by Liyang HU (8eee78e) Message-ID: <20170421165116.D95A53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:51:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:51:18 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: fix for latest GHC (1674b5d) Message-ID: <20170421165118.E048D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:51:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:51:20 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: changed uses of mkTyCon to mkTyCon3 (8f9b7ae) Message-ID: <20170421165120.E6EBF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:51:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:51:23 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: revamped tests to use the new cabal testing interface (df3fc69) Message-ID: <20170421165123.062B23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:51:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:51:25 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: removed unneccesary Makefile (b317b99) Message-ID: <20170421165125.0C6C73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:51:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:51:27 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: added Test.Tests and Test.TestUtil modules (46ce767) Message-ID: <20170421165127.146283A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:51:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:51:29 +0000 (UTC) Subject: [commit: packages/time] format-widths,ghc,improve-leapseconds,master,posix-perf,tasty,wip/travis: get working with Cabal 1.16; fix up build process (2fa30f7) Message-ID: <20170421165129.1BAC33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:51:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:51:31 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: clean up tests (54a7b3b) Message-ID: <20170421165131.235373A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:51:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:51:33 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: clean up cabal (f3549c0) Message-ID: <20170421165133.2A66C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:51:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:51:35 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: more TestInstance clean-up (0417890) Message-ID: <20170421165135.3175C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:51:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:51:37 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: %C not restricted to two characters in format (295c172) Message-ID: <20170421165137.395363A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:51:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:51:39 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: fix up test infrastructure (500ca20) Message-ID: <20170421165139.4324D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:51:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:51:41 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: more test infrastructure (b85fefa) Message-ID: <20170421165141.4A6663A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:51:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:51:43 +0000 (UTC) Subject: [commit: packages/time] format-widths,ghc,improve-leapseconds,master,posix-perf,tasty,wip/travis: fixed some parsing issues; more test sorting out (3d0480a) Message-ID: <20170421165143.53EC73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:51:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:51:45 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: fix format modifiers for YCGf (fc49f3e) Message-ID: <20170421165145.5C2DB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:51:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:51:47 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: test warning on 32-bit systems (63896a3) Message-ID: <20170421165147.62A663A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:51:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:51:49 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: update haddock for format & parse (9b3c6c7) Message-ID: <20170421165149.6B0F23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:51:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:51:51 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: fix time.cabal (c5f3fdc) Message-ID: <20170421165151.71F4E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:51:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:51:53 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: more fixing of time.cabal (d452222) Message-ID: <20170421165153.78B423A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:51:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:51:55 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Derive Typeable instances (222f71c) Message-ID: <20170421165155.805A23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:51:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:51:57 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: use throwErrnoIfMinus1 gettimeofday for consistency in error handling (d575902) Message-ID: <20170421165157.869F93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:51:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:51:59 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Make getTimeZone cross-platform consistent by always considering the TZ environment variable. (9926c4a) Message-ID: <20170421165159.8DDA83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:52:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:52:01 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Regression test for getTimeZone. (27173fc) Message-ID: <20170421165201.95A753A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:52:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:52:03 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: detabify cbits (a4fbbed) Message-ID: <20170421165203.9C2C33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:52:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:52:05 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Changes for Safe Haskell (7cc0d01) Message-ID: <20170421165205.A34553A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:52:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:52:07 +0000 (UTC) Subject: [commit: packages/time] format-widths,ghc,improve-leapseconds,master,posix-perf,tasty,wip/travis: version 1.4.2; improve Makefile (1e92867) Message-ID: <20170421165207.AA9B83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:52:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:52:09 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: tzset regardless of HAVE_LOCALTIME_R (a22e848) Message-ID: <20170421165209.B18213A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:52:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:52:11 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: use latest test library (656b250) Message-ID: <20170421165211.B8CB83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:52:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:52:13 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: .gitignore (08a0531) Message-ID: <20170421165213.C01E03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:52:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:52:15 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: time.cabal: note homepage and source-repository (dff2fcf) Message-ID: <20170421165215.C66583A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:52:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:52:17 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: more parse tests (757c5c4) Message-ID: <20170421165217.CDDBA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:52:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:52:19 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, 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: <20170421165219.D50EF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:52:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:52:21 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: .Format.Parse: add parseTimeM parseTimeOrError readSTime readPTime, deprecate parseTime readTime readsTime (1a633e6) Message-ID: <20170421165221.DD3543A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:52:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:52:23 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: clean up source (50ddcf7) Message-ID: <20170421165223.E4AB33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:52:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:52:25 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: TestParseTime: more tests (c732e4d) Message-ID: <20170421165225.EBF453A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:52:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:52:28 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: move lib/test sources to separate directories (ad32d01) Message-ID: <20170421165228.052ED3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:52:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:52:30 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: further file moves and .cabal fixes (0939180) Message-ID: <20170421165230.0BE523A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:52:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:52:32 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: remove odd file (185cb99) Message-ID: <20170421165232.131873A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:52:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:52:34 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Makefile: slight fix (077665f) Message-ID: <20170421165234.197413A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:52:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:52:36 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: .Format.Parse: be cleverer about skipping spaces (42afd39) Message-ID: <20170421165236.213833A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:52:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:52:38 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: .Format.Parse: fix spaces parsing (f964074) Message-ID: <20170421165238.27E673A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:52:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:52:40 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: remove dependency on old-locale (907cbc2) Message-ID: <20170421165240.311133A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:52:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:52:42 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: LICENSE: some code U. Glasgow (635917c) Message-ID: <20170421165242.37FC83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:52:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:52:44 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: remove System.Locale (e4ea1d9) Message-ID: <20170421165244.3EBE13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:52:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:52:46 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: allow user control of parsing of time-zone names (dc4157a) Message-ID: <20170421165246.471583A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:52:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:52:48 +0000 (UTC) Subject: [commit: packages/time] format-widths,ghc,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: <20170421165248.4F8123A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:52:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:52:50 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, 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: <20170421165250.57CAA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:52:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:52:52 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: remove "intervals" from TimeLocale (2be4631) Message-ID: <20170421165252.5DBDC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:52:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:52:54 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: doc quote cleanup (2a14cb0) Message-ID: <20170421165254.64AE63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:52:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:52:56 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Added bug-reports line to time.cabal (892717c) Message-ID: <20170421165256.6BE763A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:52:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:52:58 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Removed autogenerated HsTimeConfig.h* from repository, updated .gitignore. (82e0256) Message-ID: <20170421165258.72E4A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:53:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:53:00 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Use `_tzset()` for non-POSIX Windows environments (9f12261) Message-ID: <20170421165300.79B4B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:53:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:53:02 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Merge pull request #4 from hvr/pr-tzset (7633c67) Message-ID: <20170421165302.814423A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:53:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:53:04 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Merge pull request #3 from gintas/master (991e6be) Message-ID: <20170421165304.887D03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:53:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:53:06 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Add `Setup.hs` file (5511b80) Message-ID: <20170421165306.8F8F13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:53:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:53:08 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Remove an extra division (52523fb) Message-ID: <20170421165308.95FF73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:53:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:53:10 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Merge pull request #10 from treeowl/master (b55b3c2) Message-ID: <20170421165310.9CD513A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:53:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:53:12 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Add support for `deepseq-1.4.0.0` (e6d887a) Message-ID: <20170421165312.A49353A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:53:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:53:14 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Merge pull request #11 from hvr/pr-deepseq14 (982ea8f) Message-ID: <20170421165314.AB9593A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:53:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:53:16 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Merge pull request #5 from hvr/pr-setuphs (ab6475c) Message-ID: <20170421165316.B28BD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:53:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:53:18 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: fix deprecation of base 4.8 (7513fad) Message-ID: <20170421165318.B93883A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:53:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:53:20 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Merge pull request #12 from dterei/base48-foreign-fix (8c7c106) Message-ID: <20170421165320.C15B23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:53:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:53:22 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Improve documentation of wdays in TimeLocale (9366adb) Message-ID: <20170421165322.C79023A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:53:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:53:24 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Merge pull request #14 from lubomir/document-locale (968ec05) Message-ID: <20170421165324.D06CA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:53:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:53:26 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: version 1.5.0.1 (8d3c90a) Message-ID: <20170421165326.D6FD73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:53:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:53:28 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Fix note about `%Y` padding. (a52561a) Message-ID: <20170421165328.DE84D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:53:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:53:30 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Merge pull request #17 from bjornbm/patch-1 (ba160e5) Message-ID: <20170421165330.E5E5F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:53:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:53:32 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: De-tabify all Haskell source files. (63d2c82) Message-ID: <20170421165332.EFCD93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:53:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:53:35 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Merge pull request #19 from erikd/master (b0c04d9) Message-ID: <20170421165335.038DD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:53:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:53:37 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Convert README file to markdown. (5808f3e) Message-ID: <20170421165337.0B7F83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:53:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:53:39 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Document that the show instance for UTCTime is elsewhere. (5bcf96f) Message-ID: <20170421165339.12B753A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:53:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:53:41 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Merge pull request #21 from tomjaguarpaw/master (acc5478) Message-ID: <20170421165341.19CDA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:53:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:53:43 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: document orphan Read instances (0a8946c) Message-ID: <20170421165343.215573A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:53:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:53:45 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Days: remove unused code (1749892) Message-ID: <20170421165345.285E03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:53:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:53:47 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: instance Show UniversalTime (7b06a35) Message-ID: <20170421165347.2EE4C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:53:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:53:49 +0000 (UTC) Subject: [commit: packages/time] format-widths,ghc,improve-leapseconds,master,posix-perf,tasty,wip/travis: instance FormatTime UniversalTime; instance ParseTime UniversalTime; instance Read UniversalTime (1ca245b) Message-ID: <20170421165349.371E83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:53:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:53:51 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Ensure Read/Show instances are always provided with UTCTime and Universal (34c255e) Message-ID: <20170421165351.43CC93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:53:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:53:53 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Loosen required cabal-version (85cf1aa) Message-ID: <20170421165353.4A7FD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:53:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:53:55 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Merge pull request #32 from bergmark/patch-1 (7875368) Message-ID: <20170421165355.526E13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:53:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:53:57 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Merge pull request #20 from erikd/master (ad3ee77) Message-ID: <20170421165357.5AE4E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:53:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:53:59 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: ensure read instances for additional types -- TimeZone, Day, LocalTime, ZonedTime, TimeOfDay (60408b8) Message-ID: <20170421165359.6218F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:54:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:54:01 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: newline (76bd850) Message-ID: <20170421165401.68A6F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:54:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:54:03 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: remove tabs and trailing spaces (dd6dce8) Message-ID: <20170421165403.72D5E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:54:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:54:05 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: clean up .cabal (e1246f4) Message-ID: <20170421165405.794BF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:54:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:54:07 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: bump version (3a3bbe0) Message-ID: <20170421165407.80D643A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:54:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:54:09 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: bump version (5b4f363) Message-ID: <20170421165409.881DF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:54:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:54:11 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Merge pull request #26 from gbaz/instances (80a554c) Message-ID: <20170421165411.9173A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:54:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:54:13 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: test sdist (ccd0609) Message-ID: <20170421165413.97F583A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:54:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:54:15 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Test.TestTimeZone was missing in time.cabal, added (4c63614) Message-ID: <20170421165415.9E7973A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:54:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:54:17 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Added diffTimeToPicoseconds (also cleaned up picosecondsToDiffTime) (020ce40) Message-ID: <20170421165417.A4ED63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:54:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:54:19 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Fix compilation on GHC 7.0 by not using Trustworthy (603b058) Message-ID: <20170421165419.AC1563A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:54:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:54:21 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: use clock_gettime to implement getPOSIXTime if available (1b74336) Message-ID: <20170421165421.B51183A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:54:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:54:23 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Merge pull request #38 from redneb/clock_gettime (882305f) Message-ID: <20170421165423.BDC2B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:54:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:54:25 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Merge pull request #35 from bergmark/ghc70 (45c652b) Message-ID: <20170421165425.C6ECC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:54:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:54:27 +0000 (UTC) Subject: [commit: packages/time] format-widths,ghc,improve-leapseconds,master,posix-perf,tasty,wip/travis: use stack; include autotools stuff (899f339) Message-ID: <20170421165427.D3E6F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:54:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:54:29 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: fix bug in fromSundayStartWeekValid, with tests (1732b96) Message-ID: <20170421165429.DF9133A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:54:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:54:31 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: make parsing reject invalid dates and the like (e9cd141) Message-ID: <20170421165431.E83EA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:54:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:54:36 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: remove trailing space (b31cee9) Message-ID: <20170421165436.020F73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:54:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:54:33 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: bump version (05ae57a) Message-ID: <20170421165433.EEFF63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:54:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:54:38 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: added changelog.md (346ced4) Message-ID: <20170421165438.0A0003A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:54:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:54:40 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Remove autogenerated artifacts from Git (409d7a0) Message-ID: <20170421165440.1777F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:54:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:54:42 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Restore compat for GHC 7.8 (5cd5490) Message-ID: <20170421165442.1F56B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:54:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:54:44 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Merge pull request #42 from hvr/pr/ghc-78-fix (cc7f64b) Message-ID: <20170421165444.26A5E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:54:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:54:46 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Remove obsolete `--with-cc` flag from configure.ac (2d939c9) Message-ID: <20170421165446.2DEDE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:54:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:54:48 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Enable AC_USE_SYSTEM_EXTENSIONS (716033d) Message-ID: <20170421165448.352373A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:54:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:54:50 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Merge pull request #44 from hvr/pr/configure (a73564c) Message-ID: <20170421165450.3BB513A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:54:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:54:52 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: version 1.6.0.1 (1eb323b) Message-ID: <20170421165452.4279E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:54:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:54:54 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty, wip/travis: Add Travis-CI job config (393e6e2) Message-ID: <20170421165454.4CE1A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:54:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:54:58 +0000 (UTC) Subject: [commit: packages/time] wip/travis: force-reinstalls (f18e3c3) Message-ID: <20170421165458.5B23C3A584@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 Fri Apr 21 16:54:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:54:56 +0000 (UTC) Subject: [commit: packages/time] wip/travis: Disable travis caching logic for now (6c35d3a) Message-ID: <20170421165456.53FF03A584@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 Fri Apr 21 16:55:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:55:00 +0000 (UTC) Subject: [commit: packages/time] wip/travis: disable tests (b837d6c) Message-ID: <20170421165500.6232B3A584@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 Fri Apr 21 16:55:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:55:04 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty: remove stack.yaml for the time being (52e0f5e) Message-ID: <20170421165504.70EAF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:55:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:55:02 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty: Disable travis caching logic for now (16a36e4) Message-ID: <20170421165502.69D873A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:55:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:55:06 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty: added stack.yaml (171ee88) Message-ID: <20170421165506.78A2B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:55:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:55:08 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty: Better leap-second handling (d6863ff) Message-ID: <20170421165508.80AD23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:55:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:55:10 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty: tests for leap-second conversion (7c29ef7) Message-ID: <20170421165510.8B2B63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:55:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:55:12 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, improve-leapseconds, master, posix-perf, tasty: Simplify LeapSecondMap type (7b1dddd) Message-ID: <20170421165512.931E33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:55:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:55:14 +0000 (UTC) Subject: [commit: packages/time] format-widths,ghc,master,posix-perf,tasty: set version to 1.7; changelog (df8a5e4) Message-ID: <20170421165514.99B4B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:55:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:55:16 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master, posix-perf, tasty: add bench, improve getCurrentTime (9008175) Message-ID: <20170421165516.A1F013A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:55:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:55:18 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master, posix-perf, tasty: fix import with POSIX time (572a72e) Message-ID: <20170421165518.A8AE83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:55:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:55:20 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master, posix-perf, tasty: Replace benchmark stanza with separate time-bench package (fe018aa) Message-ID: <20170421165520.B1D673A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:55:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:55:22 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master, posix-perf, tasty: Change type of POSIX time for performance improvement (827c26c) Message-ID: <20170421165522.B8C4C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:55:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:55:24 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master, posix-perf, tasty: set version to 1.8 (b662090) Message-ID: <20170421165524.C00DA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:55:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:55:26 +0000 (UTC) Subject: [commit: packages/time] format-widths,ghc,master,posix-perf,tasty: stack.yaml: update resolver; allow-newer (0240be7) Message-ID: <20170421165526.C63DB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:55:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:55:28 +0000 (UTC) Subject: [commit: packages/time] format-widths,ghc,master,posix-perf,tasty: Use Word32 for ptNanoSeconds; replace normalizePosix with makePOSIXTime (c04bf45) Message-ID: <20170421165528.CD7353A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:55:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:55:30 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master, posix-perf, tasty: Get testing working (e63859c) Message-ID: <20170421165530.D46A33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:55:32 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:55:32 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master, posix-perf, tasty: workaround for test unix dependency (91e345b) Message-ID: <20170421165532.DB53C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:55:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:55:34 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master, posix-perf, tasty: expose posixToUTCTime (1e18026) Message-ID: <20170421165534.E24083A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:55:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:55:36 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master, posix-perf, tasty: Get benchmark working (08bb154) Message-ID: <20170421165536.E9F823A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:55:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:55:38 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master, posix-perf, tasty: Rewrite NFData instances using rnf (f37d418) Message-ID: <20170421165538.F194E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:55:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:55:41 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master, tasty: POSIX: clean up definitions, fix posixToUTCTime (255aa53) Message-ID: <20170421165541.050133A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:55:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:55:43 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master, tasty: benchmark getTimeZone and getCurrentTime (08f8296) Message-ID: <20170421165543.0B4933A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:55:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:55:45 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master, tasty: faster getCurrentTimeZone (a6cedc9) Message-ID: <20170421165545.1242A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:55:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:55:47 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master, tasty: Remove useless version bound on time. (bc8c7a2) Message-ID: <20170421165547.18C563A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:55:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:55:49 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master, tasty: Merge pull request #58 from ezyang/master (ee8fe45) Message-ID: <20170421165549.208693A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:55:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:55:51 +0000 (UTC) Subject: [commit: packages/time] format-widths,ghc,master,tasty: Move getPOSIXTime to new module; support other clocks in CTimeSpec (285cc1e) Message-ID: <20170421165551.2C3343A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:55:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:55:53 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master, tasty: add clockResolution (d7969bd) Message-ID: <20170421165553.351083A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:55:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:55:55 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master, tasty: add taiClock (d04325a) Message-ID: <20170421165555.3BC5E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:55:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:55:57 +0000 (UTC) Subject: [commit: packages/time] format-widths,ghc,master,tasty: added RawTime; restored old POSIXTime (880c2a2) Message-ID: <20170421165557.482093A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:55:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:55:59 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master, tasty: Remove useless version bounds on time (1ee953d) Message-ID: <20170421165559.4F0E73A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:56:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:56:01 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master, tasty: Set version to 1.7.0.1 (b6098be) Message-ID: <20170421165601.566303A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:56:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:56:03 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master, tasty: Merge branch 'update' (cd5704b) Message-ID: <20170421165603.601DA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:56:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:56:05 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master, tasty: rename some modules (0dff8b1) Message-ID: <20170421165605.6E45C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:56:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:56:07 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master, tasty: Align modules/API with 1.7 (6322f2e) Message-ID: <20170421165607.79A403A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:56:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:56:09 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master, tasty: put package in Time category (7c5c1fa) Message-ID: <20170421165609.8114A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:56:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:56:11 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master, tasty: rename internal Clock modules (5a27173) Message-ID: <20170421165611.911663A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:56:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:56:13 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master, tasty: rename RawTime to SystemTime (286d6dd) Message-ID: <20170421165613.9EF8F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:56:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:56:15 +0000 (UTC) Subject: [commit: packages/time] format-widths,ghc,master,tasty: add utcToSystemTime; add tests (5aae9ff) Message-ID: <20170421165615.A74233A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:56:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:56:17 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master, tasty: rename GetTime module to SystemTime (099e676) Message-ID: <20170421165617.B0A563A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:56:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:56:19 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master, tasty: get TAI clock working (e4ca1b0) Message-ID: <20170421165619.B7F6A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:56:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:56:21 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master, tasty: rename internal LocalTime modules (3ab6c4c) Message-ID: <20170421165621.C5D0C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:56:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:56:23 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master, tasty: rename unixEpochDay to systemEpochDay (a634d25) Message-ID: <20170421165623.CC2773A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:56:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:56:25 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master, tasty: haddock for Data.Time.Clock.System (2a35a49) Message-ID: <20170421165625.D44643A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:56:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:56:27 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master, tasty: benchmark: fix (04c34a6) Message-ID: <20170421165627.DB27A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:56:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:56:29 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master, tasty: benchmark: regroup tests, add getSystemTime (da99ca7) Message-ID: <20170421165629.E233E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,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 Fri Apr 21 16:56:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:56:31 +0000 (UTC) Subject: [commit: packages/time] ghc, master: SystemTime: fix for Win32 (6e202ed) Message-ID: <20170421165631.E97F63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: ghc,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 Fri Apr 21 16:56:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:56:33 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master, tasty: SystemTime: fix for Win32 (d30f427) Message-ID: <20170421165633.F19AE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,master,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 Fri Apr 21 16:56:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:56:36 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master, tasty: SystemTime: -fno-warn-trustworthy-safe (c53e19e) Message-ID: <20170421165636.039AF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,master,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 Fri Apr 21 16:56:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:56:38 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master, tasty: get building with GHC 7.8 (df4fa15) Message-ID: <20170421165638.0B2003A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,master,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 Fri Apr 21 16:56:40 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:56:40 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master, tasty: test: switch from test-framework to tasty (6aba903) Message-ID: <20170421165640.151623A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,master,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 Fri Apr 21 16:56:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:56:42 +0000 (UTC) Subject: [commit: packages/time] format-widths,ghc,master,tasty: test: clean up TestUtil; group tests properly (ee4907c) Message-ID: <20170421165642.1E7843A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,master,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 Fri Apr 21 16:56:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:56:44 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master, tasty: test: TestValid: fix rejected cases problem (c9756f7) Message-ID: <20170421165644.24FAD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,master,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 Fri Apr 21 16:56:46 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:56:46 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master: test: reorganise module hierarchy (87ccd8c) Message-ID: <20170421165646.385473A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,master 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 Fri Apr 21 16:56:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:56:48 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master: test: minor clean-up (e71ecc3) Message-ID: <20170421165648.3F6A43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,master 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 Fri Apr 21 16:56:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:56:50 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master: test: separate Unix-specific test stanza (b13119e) Message-ID: <20170421165650.47A893A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,master 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 Fri Apr 21 16:56:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:56:52 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master: test: don't build test-unix on Windows (155227f) Message-ID: <20170421165652.4E6753A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,master 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 Fri Apr 21 16:56:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:56:54 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master: test: cabal: fix flag (a8b3255) Message-ID: <20170421165654.560E83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,master 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 Fri Apr 21 16:56:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:56:56 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master: test: move Unix formatting comparison tests to test-unix stanza (a285183) Message-ID: <20170421165656.6085E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,master 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 Fri Apr 21 16:56:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:56:58 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master: test: prevent building unix on Windows (1e3893c) Message-ID: <20170421165658.67B673A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,master 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 Fri Apr 21 16:57:00 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:57:00 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master: Fix SystemTime on Windows (ad27c60) Message-ID: <20170421165700.6EFE83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,master 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 Fri Apr 21 16:57:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:57:02 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master: Format: widths for format specifiers (bd85cb0) Message-ID: <20170421165702.76B473A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,master 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 Fri Apr 21 16:57:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:57:04 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master: test: unix: Format: use QuickCheck (dd86365) Message-ID: <20170421165704.7CAAA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,master 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 Fri Apr 21 16:57:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:57:06 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master: Merge branch 'master' into format-widths (c763435) Message-ID: <20170421165706.843153A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,master 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 Fri Apr 21 16:57:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:57:08 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master: test: formatting widths: fix most tests (789a32c) Message-ID: <20170421165708.8CD993A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,master 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 Fri Apr 21 16:57:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:57:10 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master: document formatting padding widths change (80ee35c) Message-ID: <20170421165710.AA7FC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,master 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 Fri Apr 21 16:57:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:57:12 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master: mention test changes in changelog.md (d7ed24e) Message-ID: <20170421165712.B15ED3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,master 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 Fri Apr 21 16:57:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:57:14 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master: Merge branch 'master' into format-widths (7767c80) Message-ID: <20170421165714.B896C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,master 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 Fri Apr 21 16:57:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:57:16 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master: test: fix formatting "z" with widths tests (19f02fa) Message-ID: <20170421165716.BFC8A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,master 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 Fri Apr 21 16:57:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:57:18 +0000 (UTC) Subject: [commit: packages/time] format-widths, ghc, master: format widths: fix %q and %Q specifiers, with tests (85904c5) Message-ID: <20170421165718.C8A293A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: format-widths,ghc,master 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 Fri Apr 21 16:57:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:57:20 +0000 (UTC) Subject: [commit: packages/time] ghc,master: stack: lts-8.0 (28a2fe8) Message-ID: <20170421165720.CFF6C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: ghc,master 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 Fri Apr 21 16:57:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:57:22 +0000 (UTC) Subject: [commit: packages/time] ghc,master: Update haddock (f408d96) Message-ID: <20170421165722.D95D83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: ghc,master 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 Fri Apr 21 16:57:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:57:24 +0000 (UTC) Subject: [commit: packages/time] ghc, master: fix type of exposed function timeZoneOffsetString' (94777bd) Message-ID: <20170421165724.E12493A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: ghc,master 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 Fri Apr 21 16:57:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:57:26 +0000 (UTC) Subject: [commit: packages/time] ghc,master: Update changelog.md (9e92f65) Message-ID: <20170421165726.E89463A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: ghc,master 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 Fri Apr 21 16:57:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:57:28 +0000 (UTC) Subject: [commit: packages/time] ghc, master: Add pre-release checklist (098d907) Message-ID: <20170421165728.F0B7A3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: ghc,master 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 Fri Apr 21 16:57:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:57:31 +0000 (UTC) Subject: [commit: packages/time] ghc, master: Merge orphan commit into branch 'upstream/master' (c951971) Message-ID: <20170421165731.0C6673A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: ghc,master Link : http://git.haskell.org/packages/time.git/commitdiff/c95197103ff5a3e3d49dd58a9662591cb2c8e1da >--------------------------------------------------------------- commit c95197103ff5a3e3d49dd58a9662591cb2c8e1da Merge: 6e202ed 098d907 Author: Ben Gamari Date: Tue Feb 21 09:17:28 2017 -0500 Merge orphan commit into branch 'upstream/master' Sometime in mid-January there was a force-push to upstream's `master` repository, making 6e202edc1b0e32c25bc13194e6496c2c18198463 an orphan commit. Unfortunately, there was a period of time when GHC's `time` submodule referred to this commit, which means that we need to ensure it remains accessible in the history. This merge folds this commit into the `master` branch. >--------------------------------------------------------------- c95197103ff5a3e3d49dd58a9662591cb2c8e1da Checklist | 61 +++++ benchmark/stack.yaml | 2 +- changelog.md | 4 + lib/Data/Time/Calendar/Gregorian.hs | 10 +- lib/Data/Time/Calendar/Julian.hs | 10 +- lib/Data/Time/Calendar/JulianYearDay.hs | 10 +- lib/Data/Time/Calendar/MonthDay.hs | 16 +- lib/Data/Time/Calendar/OrdinalDate.hs | 40 ++-- lib/Data/Time/Calendar/Private.hs | 40 ++-- lib/Data/Time/Calendar/WeekDate.hs | 10 +- lib/Data/Time/Clock/Internal/SystemTime.hs | 12 +- lib/Data/Time/Clock/Internal/UTCTime.hs | 2 +- lib/Data/Time/Clock/System.hs | 1 + lib/Data/Time/Format.hs | 247 ++++++++++++++------- lib/Data/Time/Format/Parse.hs | 4 +- lib/Data/Time/LocalTime.hs | 9 +- lib/Data/Time/LocalTime/Internal/LocalTime.hs | 8 +- lib/Data/Time/LocalTime/Internal/TimeOfDay.hs | 16 +- lib/Data/Time/LocalTime/Internal/TimeZone.hs | 34 +-- lib/Data/Time/LocalTime/Internal/ZonedTime.hs | 2 +- stack.yaml | 2 +- test/{Test => }/CurrentTime.hs | 0 test/{Test => }/RealToFracBenchmark.hs | 0 test/{Test => }/ShowDST.hs | 0 test/Test/Resolution.hs | 39 ---- test/Test/TestFormat.hs | 185 --------------- test/Test/TestTimeZone.hs | 17 -- test/Test/TestUtil.hs | 62 ------ test/Test/TestValid.hs | 61 ----- test/Test/Tests.hs | 36 --- test/{Test => }/TimeZone.hs | 0 test/{Test => }/UseCases.lhs | 0 test/main/Main.hs | 52 +++++ test/{Test => main/Test/Calendar}/AddDays.hs | 13 +- test/{Test => main/Test/Calendar}/AddDaysRef.hs | 2 +- .../Test/Calendar/Calendars.hs} | 13 +- .../Test/Calendar/CalendarsRef.hs} | 2 +- test/{Test => main/Test/Calendar}/ClipDates.hs | 13 +- test/{Test => main/Test/Calendar}/ClipDatesRef.hs | 2 +- test/{Test => main/Test/Calendar}/ConvertBack.hs | 11 +- .../TestEaster.hs => main/Test/Calendar/Easter.hs} | 13 +- .../Test/Calendar/EasterRef.hs} | 2 +- test/{Test => main/Test/Calendar}/LongWeekYears.hs | 13 +- .../Test/Calendar}/LongWeekYearsRef.hs | 2 +- .../Test/Calendar/MonthDay.hs} | 13 +- .../Test/Calendar/MonthDayRef.hs} | 2 +- test/main/Test/Calendar/Valid.hs | 95 ++++++++ .../Test/Clock/Conversion.hs} | 5 +- test/main/Test/Clock/Resolution.hs | 52 +++++ test/{Test/TestTAI.hs => main/Test/Clock/TAI.hs} | 4 +- test/main/Test/Format/Format.hs | 73 ++++++ .../Test/Format/ParseTime.hs} | 244 +++++++++----------- .../TestTime.hs => main/Test/LocalTime/Time.hs} | 13 +- .../Test/LocalTime/TimeRef.hs} | 2 +- test/main/Test/TestUtil.hs | 37 +++ test/{Test.hs => unix/Main.hs} | 17 +- test/unix/Test/Format/Format.hs | 190 ++++++++++++++++ .../Test/Format/FormatStuff.c} | 2 +- .../Test/Format/FormatStuff.h} | 0 test/unix/Test/LocalTime/TimeZone.hs | 17 ++ test/unix/Test/TestUtil.hs | 45 ++++ time.cabal | 97 +++++--- 62 files changed, 1161 insertions(+), 825 deletions(-) From git at git.haskell.org Fri Apr 21 16:57:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:57:33 +0000 (UTC) Subject: [commit: packages/time] ghc, master: Merge pull request #63 from bgamari/master (4eb06c0) Message-ID: <20170421165733.138EF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: ghc,master Link : http://git.haskell.org/packages/time.git/commitdiff/4eb06c0e5381a5b5ad2186ac6ecff434cd711376 >--------------------------------------------------------------- commit 4eb06c0e5381a5b5ad2186ac6ecff434cd711376 Merge: 098d907 c951971 Author: Ashley Yakeley Date: Tue Feb 21 15:33:20 2017 -0800 Merge pull request #63 from bgamari/master Merge orphan commit into branch 'upstream/master' >--------------------------------------------------------------- 4eb06c0e5381a5b5ad2186ac6ecff434cd711376 From git at git.haskell.org Fri Apr 21 16:57:35 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:57:35 +0000 (UTC) Subject: [commit: packages/time] ghc, master: Checklist: update ghc branch step (1198ae4) Message-ID: <20170421165735.1AFB23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: ghc,master Link : http://git.haskell.org/packages/time.git/commitdiff/1198ae4ebbef101e1dbe32d802c3ae0cbbf12fb6 >--------------------------------------------------------------- commit 1198ae4ebbef101e1dbe32d802c3ae0cbbf12fb6 Author: Ashley Yakeley Date: Tue Feb 21 15:36:25 2017 -0800 Checklist: update ghc branch step >--------------------------------------------------------------- 1198ae4ebbef101e1dbe32d802c3ae0cbbf12fb6 Checklist | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Checklist b/Checklist index 876b2cc..1bc2c44 100644 --- a/Checklist +++ b/Checklist @@ -59,3 +59,9 @@ Before release: git tag -a -s [TAG] git push --tags + +13. Update ghc branch + + git checkout ghc + git merge master + git push From git at git.haskell.org Fri Apr 21 16:57:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:57:37 +0000 (UTC) Subject: [commit: packages/time] ghc,master: get building on 32-bit (5615013) Message-ID: <20170421165737.21A153A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: ghc,master Link : http://git.haskell.org/packages/time.git/commitdiff/5615013af73347f0260038e9618370efe21f8e5f >--------------------------------------------------------------- commit 5615013af73347f0260038e9618370efe21f8e5f Author: Ashley Yakeley Date: Fri Mar 10 11:09:40 2017 -0800 get building on 32-bit >--------------------------------------------------------------- 5615013af73347f0260038e9618370efe21f8e5f lib/Data/Time/LocalTime/Internal/TimeZone.hs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/Data/Time/LocalTime/Internal/TimeZone.hs b/lib/Data/Time/LocalTime/Internal/TimeZone.hs index fe434b7..e09a248 100644 --- a/lib/Data/Time/LocalTime/Internal/TimeZone.hs +++ b/lib/Data/Time/LocalTime/Internal/TimeZone.hs @@ -96,13 +96,24 @@ getTimeZoneCTime ctime = with 0 (\pdst -> with nullPtr (\pcname -> do return (TimeZone (div (fromIntegral secs) 60) (dst == 1) name) )) +toCTime :: Int64 -> IO CTime +toCTime t = let + tt = fromIntegral t + t' = fromIntegral tt + -- there's no instance Bounded CTime, so this is the easiest way to check for overflow + in if t' == t then return $ CTime tt else fail "Data.Time.LocalTime.Internal.TimeZone.toCTime: Overflow" where + -- | Get the local time-zone for a given time (varying as per summertime adjustments). getTimeZoneSystem :: SystemTime -> IO TimeZone -getTimeZoneSystem = getTimeZoneCTime . CTime . systemSeconds +getTimeZoneSystem t = do + ctime <- toCTime $ systemSeconds t + getTimeZoneCTime ctime -- | Get the local time-zone for a given time (varying as per summertime adjustments). getTimeZone :: UTCTime -> IO TimeZone -getTimeZone = getTimeZoneCTime . fromInteger . floor . utcTimeToPOSIXSeconds +getTimeZone t = do + ctime <- toCTime $ floor $ utcTimeToPOSIXSeconds t + getTimeZoneCTime ctime -- | Get the current time-zone. getCurrentTimeZone :: IO TimeZone From git at git.haskell.org Fri Apr 21 16:57:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:57:39 +0000 (UTC) Subject: [commit: packages/time] ghc, master: test unix: fix time-zone test (231ea48) Message-ID: <20170421165739.28A2C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: ghc,master Link : http://git.haskell.org/packages/time.git/commitdiff/231ea4820159f247a1536abc9e9a2861c103ea3b >--------------------------------------------------------------- commit 231ea4820159f247a1536abc9e9a2861c103ea3b Author: Ashley Yakeley Date: Fri Mar 10 11:33:31 2017 -0800 test unix: fix time-zone test >--------------------------------------------------------------- 231ea4820159f247a1536abc9e9a2861c103ea3b lib/Data/Time/LocalTime/Internal/TimeZone.hs | 2 +- test/unix/Test/LocalTime/TimeZone.hs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Data/Time/LocalTime/Internal/TimeZone.hs b/lib/Data/Time/LocalTime/Internal/TimeZone.hs index e09a248..e2b2f49 100644 --- a/lib/Data/Time/LocalTime/Internal/TimeZone.hs +++ b/lib/Data/Time/LocalTime/Internal/TimeZone.hs @@ -101,7 +101,7 @@ toCTime t = let tt = fromIntegral t t' = fromIntegral tt -- there's no instance Bounded CTime, so this is the easiest way to check for overflow - in if t' == t then return $ CTime tt else fail "Data.Time.LocalTime.Internal.TimeZone.toCTime: Overflow" where + in if t' == t then return $ CTime tt else fail "Data.Time.LocalTime.Internal.TimeZone.toCTime: Overflow" -- | Get the local time-zone for a given time (varying as per summertime adjustments). getTimeZoneSystem :: SystemTime -> IO TimeZone diff --git a/test/unix/Test/LocalTime/TimeZone.hs b/test/unix/Test/LocalTime/TimeZone.hs index 22a5bbb..ca55b25 100644 --- a/test/unix/Test/LocalTime/TimeZone.hs +++ b/test/unix/Test/LocalTime/TimeZone.hs @@ -9,7 +9,7 @@ import Test.Tasty.HUnit testTimeZone :: TestTree testTimeZone = testCase "getTimeZone respects TZ env var" $ do - let epoch = UTCTime (ModifiedJulianDay 0) 0 + let epoch = UTCTime (ModifiedJulianDay 57000) 0 putEnv "TZ=UTC+0" zone1 <- getTimeZone epoch putEnv "TZ=EST+5" From git at git.haskell.org Fri Apr 21 16:57:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:57:41 +0000 (UTC) Subject: [commit: packages/time] ghc,master: Update version to 1.8.0.1; update Checklist (4a4e2ce) Message-ID: <20170421165741.300493A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: ghc,master Link : http://git.haskell.org/packages/time.git/commitdiff/4a4e2ce6a1bf099393772737d848d900832ee84d >--------------------------------------------------------------- commit 4a4e2ce6a1bf099393772737d848d900832ee84d Author: Ashley Yakeley Date: Fri Mar 10 11:53:01 2017 -0800 Update version to 1.8.0.1; update Checklist >--------------------------------------------------------------- 4a4e2ce6a1bf099393772737d848d900832ee84d Checklist | 18 ++++++++++++------ benchmark/time-bench.cabal | 2 +- changelog.md | 3 +++ configure.ac | 2 +- stack.yaml | 2 +- time.cabal | 2 +- 6 files changed, 19 insertions(+), 10 deletions(-) diff --git a/Checklist b/Checklist index 1bc2c44..9f3d6a1 100644 --- a/Checklist +++ b/Checklist @@ -18,8 +18,8 @@ Before release: 4. Use latest LTS resolver https://www.stackage.org/lts - time.cabal - (not necessarily benchmark/time-bench.cabal) + stack.yaml + (not necessarily benchmark/stack.yaml) 5. Build & test @@ -45,22 +45,28 @@ Before release: https://travis-ci.org/haskell/time -10. Build and test on Windows +10. Build and test on 32-bit Linux machine + + git pull + stack build --pedantic --test --haddock && echo OK + (ignore errors) + +11. Build and test on Windows git pull stack build --pedantic --test --haddock && echo OK -11. Upload to Hackage +12. Upload to Hackage stack upload . http://hackage.haskell.org/package/time -12. Tag commit +13. Tag commit git tag -a -s [TAG] git push --tags -13. Update ghc branch +14. Update ghc branch git checkout ghc git merge master diff --git a/benchmark/time-bench.cabal b/benchmark/time-bench.cabal index 4cc6559..2e0598f 100644 --- a/benchmark/time-bench.cabal +++ b/benchmark/time-bench.cabal @@ -4,7 +4,7 @@ author: Winter homepage: https://github.com/haskell/time bug-reports: https://github.com/haskell/time/issues cabal-version: >=1.10 -build-type: Simple +build-type: Simple executable time-bench diff --git a/changelog.md b/changelog.md index 87b9659..9852afe 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,8 @@ # Change Log +## [1.8.0.1] +- Get building on 32 bit machine + ## [1.8] - Added SystemTime - Data.Time.Format: allow padding widths in specifiers for formatting (but not parsing) diff --git a/configure.ac b/configure.ac index 02104dc..8baf740 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([Haskell time package], [1.8], [ashley at semantic.org], [time]) +AC_INIT([Haskell time package], [1.8.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/stack.yaml b/stack.yaml index 01d8752..819c851 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,4 +1,4 @@ -resolver: lts-8.0 +resolver: lts-8.4 packages: - '.' allow-newer: true diff --git a/time.cabal b/time.cabal index 6fb2731..a3a9bf7 100644 --- a/time.cabal +++ b/time.cabal @@ -1,5 +1,5 @@ name: time -version: 1.8 +version: 1.8.0.1 stability: stable license: BSD3 license-file: LICENSE From git at git.haskell.org Fri Apr 21 16:57:43 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:57:43 +0000 (UTC) Subject: [commit: packages/time] ghc, master: test: fix most failures on 32 bit (50265a9) Message-ID: <20170421165743.36E563A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: ghc,master Link : http://git.haskell.org/packages/time.git/commitdiff/50265a94bf83fb8ed10fbc2a2dee6b9015e1d49a >--------------------------------------------------------------- commit 50265a94bf83fb8ed10fbc2a2dee6b9015e1d49a Author: Ashley Yakeley Date: Sat Mar 11 09:43:13 2017 -0800 test: fix most failures on 32 bit >--------------------------------------------------------------- 50265a94bf83fb8ed10fbc2a2dee6b9015e1d49a test/main/Main.hs | 6 +----- test/unix/Main.hs | 6 +----- test/unix/Test/Format/Format.hs | 11 ++++++++++- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/test/main/Main.hs b/test/main/Main.hs index 5c40256..2d02b4a 100644 --- a/test/main/Main.hs +++ b/test/main/Main.hs @@ -45,8 +45,4 @@ tests = testGroup "Time" [ ] 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 +main = defaultMain tests diff --git a/test/unix/Main.hs b/test/unix/Main.hs index f2bac52..eac8ac0 100644 --- a/test/unix/Main.hs +++ b/test/unix/Main.hs @@ -17,8 +17,4 @@ tests = testGroup "Time" [ ] 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 +main = defaultMain tests diff --git a/test/unix/Test/Format/Format.hs b/test/unix/Test/Format/Format.hs index 1f8ec4a..753371c 100644 --- a/test/unix/Test/Format/Format.hs +++ b/test/unix/Test/Format/Format.hs @@ -56,7 +56,16 @@ times :: Gen UTCTime times = do day <- choose (-25000,75000) time <- return midnight - return $ localTimeToUTC utc $ LocalTime (ModifiedJulianDay day) time + let + -- verify that the created time can fit in the local CTime + localT = LocalTime (ModifiedJulianDay day) time + utcT = localTimeToUTC utc localT + secondsInteger = truncate (utcTimeToPOSIXSeconds utcT) + CTime secondsCTime = fromInteger secondsInteger + secondsInteger' = toInteger secondsCTime + if secondsInteger == secondsInteger' + then return utcT + else times padN :: Int -> Char -> String -> String padN n _ s | n <= (length s) = s From git at git.haskell.org Fri Apr 21 16:57:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:57:45 +0000 (UTC) Subject: [commit: packages/time] ghc, master: test: remove unnecessary pragmas (a03e04c) Message-ID: <20170421165745.3E8B23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: ghc,master Link : http://git.haskell.org/packages/time.git/commitdiff/a03e04cfdec877c2a79560ed296b5009cf90aba4 >--------------------------------------------------------------- commit a03e04cfdec877c2a79560ed296b5009cf90aba4 Author: Ashley Yakeley Date: Sat Mar 11 10:14:33 2017 -0800 test: remove unnecessary pragmas >--------------------------------------------------------------- a03e04cfdec877c2a79560ed296b5009cf90aba4 test/CurrentTime.hs | 2 -- test/ShowDST.hs | 2 -- test/TimeZone.hs | 2 -- test/main/Main.hs | 1 - test/main/Test/Calendar/ClipDates.hs | 2 -- test/main/Test/Calendar/Easter.hs | 2 -- test/main/Test/Format/ParseTime.hs | 10 ++++------ test/main/Test/TestUtil.hs | 1 - test/unix/Main.hs | 1 - test/unix/Test/Format/Format.hs | 2 -- test/unix/Test/LocalTime/TimeZone.hs | 2 -- test/unix/Test/TestUtil.hs | 1 - time.cabal | 1 + 13 files changed, 5 insertions(+), 24 deletions(-) diff --git a/test/CurrentTime.hs b/test/CurrentTime.hs index 981bf83..3ea641e 100644 --- a/test/CurrentTime.hs +++ b/test/CurrentTime.hs @@ -1,5 +1,3 @@ -{-# OPTIONS -Wall -Werror #-} - module Main where import Data.Time diff --git a/test/ShowDST.hs b/test/ShowDST.hs index e19f3dd..8b00014 100644 --- a/test/ShowDST.hs +++ b/test/ShowDST.hs @@ -1,5 +1,3 @@ -{-# OPTIONS -Wall -Werror #-} - module Main where import Data.Time diff --git a/test/TimeZone.hs b/test/TimeZone.hs index b582f53..05e56fd 100644 --- a/test/TimeZone.hs +++ b/test/TimeZone.hs @@ -1,5 +1,3 @@ -{-# OPTIONS -Wall -Werror #-} - module Main where import Data.Time diff --git a/test/main/Main.hs b/test/main/Main.hs index 2d02b4a..23621d3 100644 --- a/test/main/Main.hs +++ b/test/main/Main.hs @@ -1,6 +1,5 @@ module Main where -import Foreign.C.Types import Test.Tasty import Test.Calendar.AddDays import Test.Calendar.Calendars diff --git a/test/main/Test/Calendar/ClipDates.hs b/test/main/Test/Calendar/ClipDates.hs index 848c4db..246c437 100644 --- a/test/main/Test/Calendar/ClipDates.hs +++ b/test/main/Test/Calendar/ClipDates.hs @@ -1,5 +1,3 @@ -{-# Language TupleSections #-} - module Test.Calendar.ClipDates(clipDates) where import Data.Time.Calendar.OrdinalDate diff --git a/test/main/Test/Calendar/Easter.hs b/test/main/Test/Calendar/Easter.hs index 8c7e6d4..1901835 100644 --- a/test/main/Test/Calendar/Easter.hs +++ b/test/main/Test/Calendar/Easter.hs @@ -1,5 +1,3 @@ -{-# OPTIONS -Wall -Werror #-} - module Test.Calendar.Easter(testEaster) where import Data.Time.Calendar.Easter diff --git a/test/main/Test/Format/ParseTime.hs b/test/main/Test/Format/ParseTime.hs index 8be9528..340f319 100644 --- a/test/main/Test/Format/ParseTime.hs +++ b/test/main/Test/Format/ParseTime.hs @@ -1,6 +1,4 @@ -{-# OPTIONS -fno-warn-type-defaults -fno-warn-orphans #-} -{-# LANGUAGE FlexibleInstances, ExistentialQuantification #-} - +{-# OPTIONS -fno-warn-orphans #-} module Test.Format.ParseTime(testParseTime,test_parse_format) where import Control.Monad @@ -82,7 +80,7 @@ readTestsParensSpaces expected target = testGroup target readOtherTypesTest :: TestTree readOtherTypesTest = testGroup "read other types" [ - readTestsParensSpaces 3 "3", + readTestsParensSpaces (3 :: Integer) "3", readTestsParensSpaces "a" "\"a\"" ] @@ -244,11 +242,11 @@ instance CoArbitrary 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) + fracSecs = liftM picosecondsToDiffTime' $ choose (0, 86400 * 10^(12::Int)) secondsToDiffTime' :: Integer -> DiffTime secondsToDiffTime' = fromInteger picosecondsToDiffTime' :: Integer -> DiffTime - picosecondsToDiffTime' x = fromRational (x % 10^12) + picosecondsToDiffTime' x = fromRational (x % 10^(12::Int)) instance CoArbitrary DiffTime where coarbitrary t = coarbitrary (fromEnum t) diff --git a/test/main/Test/TestUtil.hs b/test/main/Test/TestUtil.hs index c306893..e5493f8 100644 --- a/test/main/Test/TestUtil.hs +++ b/test/main/Test/TestUtil.hs @@ -1,4 +1,3 @@ -{-# OPTIONS -fno-warn-overlapping-patterns #-} module Test.TestUtil where import Test.QuickCheck.Property diff --git a/test/unix/Main.hs b/test/unix/Main.hs index eac8ac0..068b4ee 100644 --- a/test/unix/Main.hs +++ b/test/unix/Main.hs @@ -1,6 +1,5 @@ module Main where -import Foreign.C.Types import Test.Tasty import Test.Format.Format import Test.LocalTime.TimeZone diff --git a/test/unix/Test/Format/Format.hs b/test/unix/Test/Format/Format.hs index 753371c..a6ea8a5 100644 --- a/test/unix/Test/Format/Format.hs +++ b/test/unix/Test/Format/Format.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE ForeignFunctionInterface #-} - module Test.Format.Format(testFormat) where import Data.Time diff --git a/test/unix/Test/LocalTime/TimeZone.hs b/test/unix/Test/LocalTime/TimeZone.hs index ca55b25..d6e20d6 100644 --- a/test/unix/Test/LocalTime/TimeZone.hs +++ b/test/unix/Test/LocalTime/TimeZone.hs @@ -1,5 +1,3 @@ -{-# OPTIONS -Wall -Werror #-} - module Test.LocalTime.TimeZone(testTimeZone) where import Data.Time diff --git a/test/unix/Test/TestUtil.hs b/test/unix/Test/TestUtil.hs index 4a3b42d..8599c0c 100644 --- a/test/unix/Test/TestUtil.hs +++ b/test/unix/Test/TestUtil.hs @@ -1,4 +1,3 @@ -{-# OPTIONS -fno-warn-overlapping-patterns #-} module Test.TestUtil where import Test.QuickCheck.Property diff --git a/time.cabal b/time.cabal index a3a9bf7..ae82f16 100644 --- a/time.cabal +++ b/time.cabal @@ -124,6 +124,7 @@ test-suite test-main FlexibleInstances UndecidableInstances ScopedTypeVariables + TupleSections ghc-options: -Wall -fwarn-tabs build-depends: base, From git at git.haskell.org Fri Apr 21 16:57:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:57:47 +0000 (UTC) Subject: [commit: packages/time] ghc, master: Use floor instead of truncate (2060aed) Message-ID: <20170421165747.473233A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: ghc,master Link : http://git.haskell.org/packages/time.git/commitdiff/2060aed5608eeee73efa7691df2dfc7e2a4d4e3c >--------------------------------------------------------------- commit 2060aed5608eeee73efa7691df2dfc7e2a4d4e3c Author: Ashley Yakeley Date: Sat Mar 11 11:39:17 2017 -0800 Use floor instead of truncate >--------------------------------------------------------------- 2060aed5608eeee73efa7691df2dfc7e2a4d4e3c lib/Data/Time/Format.hs | 2 +- lib/Data/Time/Format/Parse.hs | 4 +- test/main/Test/Format/ParseTime.hs | 6 +-- test/unix/Test/Format/Format.hs | 75 +++++++++++++++++++++++--------------- time.cabal | 1 + 5 files changed, 53 insertions(+), 35 deletions(-) diff --git a/lib/Data/Time/Format.hs b/lib/Data/Time/Format.hs index 7cea584..bb03e24 100644 --- a/lib/Data/Time/Format.hs +++ b/lib/Data/Time/Format.hs @@ -273,7 +273,7 @@ instance FormatTime TimeOfDay where -- Minute formatCharacter 'M' = Just $ padNum True 2 '0' todMin -- Second - formatCharacter 'S' = Just $ padNum True 2 '0' $ (truncate . todSec :: TimeOfDay -> Int) + formatCharacter 'S' = Just $ padNum True 2 '0' $ (floor . todSec :: TimeOfDay -> Int) formatCharacter 'q' = Just $ padGeneral True True 12 '0' $ \_ pado -> showPaddedFixedFraction pado . todSec formatCharacter 'Q' = Just $ padGeneral True False 12 '0' $ \_ pado -> ('.':) . showPaddedFixedFraction pado . todSec diff --git a/lib/Data/Time/Format/Parse.hs b/lib/Data/Time/Format/Parse.hs index d12291b..2c47d2b 100644 --- a/lib/Data/Time/Format/Parse.hs +++ b/lib/Data/Time/Format/Parse.hs @@ -510,10 +510,10 @@ instance ParseTime TimeOfDay where return $ TimeOfDay h m (fromInteger a) 'q' -> do a <- ra - return $ TimeOfDay h m (mkPico (truncate s) a) + return $ TimeOfDay h m (mkPico (floor s) a) 'Q' -> if null x then Just t else do ps <- readMaybe $ take 12 $ rpad 12 '0' $ drop 1 x - return $ TimeOfDay h m (mkPico (truncate s) ps) + return $ TimeOfDay h m (mkPico (floor s) ps) _ -> Just t in mfoldl f (Just midnight) diff --git a/test/main/Test/Format/ParseTime.hs b/test/main/Test/Format/ParseTime.hs index 340f319..4ba383d 100644 --- a/test/main/Test/Format/ParseTime.hs +++ b/test/main/Test/Format/ParseTime.hs @@ -261,7 +261,7 @@ instance Arbitrary LocalTime where arbitrary = liftM2 LocalTime arbitrary arbitrary instance CoArbitrary LocalTime where - coarbitrary t = coarbitrary (truncate (utcTimeToPOSIXSeconds (localTimeToUTC utc t)) :: Integer) + coarbitrary t = coarbitrary (floor (utcTimeToPOSIXSeconds (localTimeToUTC utc t)) :: Integer) instance Arbitrary TimeZone where arbitrary = liftM minutesToTimeZone $ choose (-720,720) @@ -273,13 +273,13 @@ instance Arbitrary ZonedTime where arbitrary = liftM2 ZonedTime arbitrary arbitrary instance CoArbitrary ZonedTime where - coarbitrary t = coarbitrary (truncate (utcTimeToPOSIXSeconds (zonedTimeToUTC t)) :: Integer) + coarbitrary t = coarbitrary (floor (utcTimeToPOSIXSeconds (zonedTimeToUTC t)) :: Integer) instance Arbitrary UTCTime where arbitrary = liftM2 UTCTime arbitrary arbitrary instance CoArbitrary UTCTime where - coarbitrary t = coarbitrary (truncate (utcTimeToPOSIXSeconds t) :: Integer) + coarbitrary t = coarbitrary (floor (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 diff --git a/test/unix/Test/Format/Format.hs b/test/unix/Test/Format/Format.hs index a6ea8a5..49ea218 100644 --- a/test/unix/Test/Format/Format.hs +++ b/test/unix/Test/Format/Format.hs @@ -1,11 +1,13 @@ +{-# OPTIONS -fno-warn-orphans #-} module Test.Format.Format(testFormat) where import Data.Time import Data.Time.Clock.POSIX import Data.Char -import Data.Fixed +import Data.Fixed as F import Foreign import Foreign.C +import System.Random import Test.QuickCheck hiding (Result) import Test.QuickCheck.Property import Test.Tasty @@ -34,36 +36,51 @@ unixFormatTime fmt zone time = unsafePerformIO $ withCString fmt (\pfmt -> withC (if timeZoneSummerOnly zone then 1 else 0) (fromIntegral (timeZoneMinutes zone * 60)) pzonename - (fromInteger (truncate (utcTimeToPOSIXSeconds time))) + (fromInteger (floor (utcTimeToPOSIXSeconds time))) ) )) locale :: TimeLocale locale = defaultTimeLocale {dateTimeFmt = "%a %b %e %H:%M:%S %Y"} -zones :: Gen TimeZone -zones = do - mins <- choose (-2000,2000) - dst <- arbitrary - hasName <- arbitrary - let - name = if hasName then "ZONE" else "" - return $ TimeZone mins dst name - -times :: Gen UTCTime -times = do - day <- choose (-25000,75000) - time <- return midnight - let - -- verify that the created time can fit in the local CTime - localT = LocalTime (ModifiedJulianDay day) time - utcT = localTimeToUTC utc localT - secondsInteger = truncate (utcTimeToPOSIXSeconds utcT) - CTime secondsCTime = fromInteger secondsInteger - secondsInteger' = toInteger secondsCTime - if secondsInteger == secondsInteger' - then return utcT - else times +instance Random (F.Fixed res) where + randomR (MkFixed lo,MkFixed hi) oldgen = let + (v,newgen) = randomR (lo,hi) oldgen + in (MkFixed v,newgen) + random oldgen = let + (v,newgen) = random oldgen + in (MkFixed v,newgen) + +instance Arbitrary TimeZone where + arbitrary = do + mins <- choose (-2000,2000) + dst <- arbitrary + hasName <- arbitrary + let + name = if hasName then "ZONE" else "" + return $ TimeZone mins dst name + +instance Arbitrary TimeOfDay where + arbitrary = do + h <- choose (0,23) + m <- choose (0,59) + s <- choose (0,59.999999999999) -- don't allow leap-seconds + return $ TimeOfDay h m s + +instance Arbitrary UTCTime where + arbitrary = do + day <- choose (-25000,75000) + time <- arbitrary + let + -- verify that the created time can fit in the local CTime + localT = LocalTime (ModifiedJulianDay day) time + utcT = localTimeToUTC utc localT + secondsInteger = floor (utcTimeToPOSIXSeconds utcT) + CTime secondsCTime = fromInteger secondsInteger + secondsInteger' = toInteger secondsCTime + if secondsInteger == secondsInteger' + then return utcT + else arbitrary padN :: Int -> Char -> String -> String padN n _ s | n <= (length s) = s @@ -124,14 +141,14 @@ hashformats = do testCompareFormat :: [TestTree] testCompareFormat = tgroup formats $ \fmt -> do - time <- times - zone <- zones + time <- arbitrary + zone <- arbitrary return $ compareFormat id fmt zone time testCompareHashFormat :: [TestTree] testCompareHashFormat = tgroup hashformats $ \fmt -> do - time <- times - zone <- zones + time <- arbitrary + zone <- arbitrary return $ compareFormat (fmap toLower) fmt zone time formatUnitTest :: String -> Pico -> String -> TestTree diff --git a/time.cabal b/time.cabal index ae82f16..e93c857 100644 --- a/time.cabal +++ b/time.cabal @@ -181,6 +181,7 @@ test-suite test-unix base, deepseq, time, + random, QuickCheck, tasty, tasty-hunit, From git at git.haskell.org Fri Apr 21 16:57:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:57:49 +0000 (UTC) Subject: [commit: packages/time] ghc,master: Fix tests on 32 bit (d03429e) Message-ID: <20170421165749.4DB0F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: ghc,master Link : http://git.haskell.org/packages/time.git/commitdiff/d03429e1913b6babd3b59d0bfdd7d3904b1b6f0b >--------------------------------------------------------------- commit d03429e1913b6babd3b59d0bfdd7d3904b1b6f0b Author: Ashley Yakeley Date: Sat Mar 11 12:45:30 2017 -0800 Fix tests on 32 bit >--------------------------------------------------------------- d03429e1913b6babd3b59d0bfdd7d3904b1b6f0b Checklist | 1 - test/unix/Test/Format/Format.hs | 16 +++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Checklist b/Checklist index 9f3d6a1..8fef7e8 100644 --- a/Checklist +++ b/Checklist @@ -49,7 +49,6 @@ Before release: git pull stack build --pedantic --test --haddock && echo OK - (ignore errors) 11. Build and test on Windows diff --git a/test/unix/Test/Format/Format.hs b/test/unix/Test/Format/Format.hs index 49ea218..fa7d5b8 100644 --- a/test/unix/Test/Format/Format.hs +++ b/test/unix/Test/Format/Format.hs @@ -12,6 +12,7 @@ import Test.QuickCheck hiding (Result) import Test.QuickCheck.Property import Test.Tasty import Test.Tasty.HUnit +import Test.Tasty.QuickCheck import Test.TestUtil import System.IO.Unsafe @@ -67,6 +68,13 @@ instance Arbitrary TimeOfDay where s <- choose (0,59.999999999999) -- don't allow leap-seconds return $ TimeOfDay h m s +-- | The size of 'CTime' is platform-dependent. +secondsFitInCTime :: Integer -> Bool +secondsFitInCTime sec = let + CTime ct = fromInteger sec + sec' = toInteger ct + in sec == sec' + instance Arbitrary UTCTime where arbitrary = do day <- choose (-25000,75000) @@ -76,9 +84,7 @@ instance Arbitrary UTCTime where localT = LocalTime (ModifiedJulianDay day) time utcT = localTimeToUTC utc localT secondsInteger = floor (utcTimeToPOSIXSeconds utcT) - CTime secondsCTime = fromInteger secondsInteger - secondsInteger' = toInteger secondsCTime - if secondsInteger == secondsInteger' + if secondsFitInCTime (secondsInteger + 2*86400) && secondsFitInCTime (secondsInteger - 2*86400) -- two days slop each way then return utcT else arbitrary @@ -108,7 +114,7 @@ compareFormat modUnix fmt zone time = let haskellText = formatTime locale fmt ctime unixText = unixFormatTime fmt zone time expectedText = unixWorkarounds fmt (modUnix unixText) - in assertEqualQC "" expectedText haskellText + in assertEqualQC (show time ++ " with " ++ show zone) expectedText haskellText -- as found in http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html -- plus FgGklz @@ -211,4 +217,4 @@ testQs = [ ] testFormat :: TestTree -testFormat = testGroup "testFormat" $ testCompareFormat ++ testCompareHashFormat ++ testQs +testFormat = localOption (QuickCheckTests 10000) $ testGroup "testFormat" $ testCompareFormat ++ testCompareHashFormat ++ testQs From git at git.haskell.org Fri Apr 21 16:57:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:57:51 +0000 (UTC) Subject: [commit: packages/time] master: test using "#ifdef" for HAVE_CLOCK_GETTIME (d9e3430) Message-ID: <20170421165751.548363A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branch : master Link : http://git.haskell.org/packages/time.git/commitdiff/d9e34309a9f57cddb1d3806998a62a15795ff4b1 >--------------------------------------------------------------- commit d9e34309a9f57cddb1d3806998a62a15795ff4b1 Author: Gabor Greif Date: Wed Apr 5 17:55:09 2017 +0200 test using "#ifdef" for HAVE_CLOCK_GETTIME GHC has recently tightened preprocessor checks, so this "#elif" started to fail. >--------------------------------------------------------------- d9e34309a9f57cddb1d3806998a62a15795ff4b1 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 6027cdf..b87d302 100644 --- a/lib/Data/Time/Clock/Internal/SystemTime.hs +++ b/lib/Data/Time/Clock/Internal/SystemTime.hs @@ -19,7 +19,7 @@ import Data.Time.Clock.Internal.DiffTime #ifdef mingw32_HOST_OS import qualified System.Win32.Time as Win32 -#elif HAVE_CLOCK_GETTIME +#elif defined(HAVE_CLOCK_GETTIME) import Data.Time.Clock.Internal.CTimespec import Foreign.C.Types (CTime(..), CLong(..)) #else @@ -67,7 +67,7 @@ getSystemTime = do getTime_resolution = 100E-9 -- 100ns getTAISystemTime = Nothing -#elif HAVE_CLOCK_GETTIME +#elif defined(HAVE_CLOCK_GETTIME) -- Use hi-res clock_gettime timespecToSystemTime :: CTimespec -> SystemTime From git at git.haskell.org Fri Apr 21 16:57:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 16:57:53 +0000 (UTC) Subject: [commit: packages/time] master: Merge pull request #71 from bgamari/master (fbf90b6) Message-ID: <20170421165753.5B92D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branch : master Link : http://git.haskell.org/packages/time.git/commitdiff/fbf90b66f9f51bad41d6c1f070b879b1bc860b28 >--------------------------------------------------------------- commit fbf90b66f9f51bad41d6c1f070b879b1bc860b28 Merge: d03429e d9e3430 Author: Ashley Yakeley Date: Wed Apr 5 17:07:43 2017 -0700 Merge pull request #71 from bgamari/master test using "#ifdef" for HAVE_CLOCK_GETTIME >--------------------------------------------------------------- fbf90b66f9f51bad41d6c1f070b879b1bc860b28 lib/Data/Time/Clock/Internal/SystemTime.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) From git at git.haskell.org Fri Apr 21 17:24:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 17:24:08 +0000 (UTC) Subject: [commit: ghc] master: base: Fix offset initialization of Windows hLock implementation (e134af0) Message-ID: <20170421172408.778703A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e134af010bdd0d2a94fbfd68e0605dc55e1be3a8/ghc >--------------------------------------------------------------- commit e134af010bdd0d2a94fbfd68e0605dc55e1be3a8 Author: Ben Gamari Date: Fri Apr 21 12:10:33 2017 -0400 base: Fix offset initialization of Windows hLock implementation The previous implementation swapped the buffer size with the byte to be set, essentially resulting in an uninitialized buffer. Test Plan: Validate on Windows Reviewers: austin, hvr Subscribers: rwbarton, thomie GHC Trac Issues: #13599 Differential Revision: https://phabricator.haskell.org/D3478 >--------------------------------------------------------------- e134af010bdd0d2a94fbfd68e0605dc55e1be3a8 libraries/base/GHC/IO/Handle/Lock.hsc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libraries/base/GHC/IO/Handle/Lock.hsc b/libraries/base/GHC/IO/Handle/Lock.hsc index 5608c18..ebb3ce4 100644 --- a/libraries/base/GHC/IO/Handle/Lock.hsc +++ b/libraries/base/GHC/IO/Handle/Lock.hsc @@ -45,7 +45,6 @@ import Foreign.Marshal.Utils import GHC.IO.FD import GHC.IO.Handle.FD import GHC.Ptr -import GHC.Real import GHC.Windows #endif @@ -123,7 +122,7 @@ lockImpl h ctx mode block = do FD{fdFD = fd} <- handleToFd h wh <- throwErrnoIf (== iNVALID_HANDLE_VALUE) ctx $ c_get_osfhandle fd allocaBytes sizeof_OVERLAPPED $ \ovrlpd -> do - fillBytes ovrlpd (fromIntegral sizeof_OVERLAPPED) 0 + fillBytes ovrlpd 0 sizeof_OVERLAPPED let flags = cmode .|. (if block then 0 else #{const LOCKFILE_FAIL_IMMEDIATELY}) -- We want to lock the whole file without looking up its size to be -- consistent with what flock does. According to documentation of LockFileEx @@ -131,7 +130,7 @@ lockImpl h ctx mode block = do -- not an error", however some versions of Windows seem to have issues with -- large regions and set ERROR_INVALID_LOCK_RANGE in such case for -- mysterious reasons. Work around that by setting only low 32 bits. - fix $ \retry -> c_LockFileEx wh flags 0 0xffffffff 0x0 ovrlpd >>= \case + fix $ \retry -> c_LockFileEx wh flags 0 0xffffffff 0xffffffff ovrlpd >>= \case True -> return True False -> getLastError >>= \err -> if | not block && err == #{const ERROR_LOCK_VIOLATION} -> return False From git at git.haskell.org Fri Apr 21 17:24:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 17:24:11 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Bump timeout multiplier for T11195 (3672cf6) Message-ID: <20170421172411.3CBBB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3672cf6d0962dd6bf0a05e6e3433c81bbdf04a11/ghc >--------------------------------------------------------------- commit 3672cf6d0962dd6bf0a05e6e3433c81bbdf04a11 Author: Ben Gamari Date: Thu Apr 20 22:34:21 2017 -0400 testsuite: Bump timeout multiplier for T11195 This test has been occassionally failing on the Darwin build bot for some time now. (cherry picked from commit b3a4dd1152884ff1240824137eca0a49cb6e5a2c) >--------------------------------------------------------------- 3672cf6d0962dd6bf0a05e6e3433c81bbdf04a11 testsuite/tests/pmcheck/should_compile/all.T | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/tests/pmcheck/should_compile/all.T b/testsuite/tests/pmcheck/should_compile/all.T index a3c5e91..f44034b 100644 --- a/testsuite/tests/pmcheck/should_compile/all.T +++ b/testsuite/tests/pmcheck/should_compile/all.T @@ -40,7 +40,7 @@ test('T11303', normal, compile, ['-fwarn-incomplete-patterns -fwarn-overlapping- test('T11276', compile_timeout_multiplier(0.01), compile, ['-fwarn-incomplete-patterns -fwarn-overlapping-patterns +RTS -M1G -RTS']) test('T11303b', compile_timeout_multiplier(0.01), compile, ['-fwarn-incomplete-patterns -fwarn-overlapping-patterns +RTS -M1G -RTS']) test('T11374', compile_timeout_multiplier(0.01), compile, ['-fwarn-incomplete-patterns -fwarn-overlapping-patterns +RTS -M1G -RTS']) -test('T11195', compile_timeout_multiplier(0.50), compile, ['-package ghc -fwarn-incomplete-patterns -fwarn-overlapping-patterns +RTS -M2G -RTS']) +test('T11195', compile_timeout_multiplier(0.60), compile, ['-package ghc -fwarn-incomplete-patterns -fwarn-overlapping-patterns +RTS -M2G -RTS']) # Other tests test('pmc001', [], compile, From git at git.haskell.org Fri Apr 21 17:24:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 17:24:14 +0000 (UTC) Subject: [commit: ghc] master: base: Fix hWaitForInput with timeout on POSIX (e5732d2) Message-ID: <20170421172414.009ED3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e5732d2a28dfb8a754ee73e124e3558222a543bb/ghc >--------------------------------------------------------------- commit e5732d2a28dfb8a754ee73e124e3558222a543bb Author: Ben Gamari Date: Fri Apr 21 12:11:28 2017 -0400 base: Fix hWaitForInput with timeout on POSIX This was previously broken (#13252) by f46369b8a1bf90a3bdc30f2b566c3a7e03672518, which ported the fdReady function from `select` to `poll` and in so doing dropping support for timeouts. Unfortunately, while `select` tells us the amount of time not slept (on Linux anyways; it turns out this is implementation dependent), `poll` does not give us this luxury. Consequently, we manually need to track time slept in this case. Unfortunately, portably measuring time is hard. Ideally we would use `clock_gettime` with the monotonic clock here, but sadly this isn't supported on most versions of Darwin. Consequently, we instead use `gettimeofday`, running the risk of system time changes messing us up. Test Plan: Validate Reviewers: simonmar, austin, hvr Reviewed By: simonmar Subscribers: rwbarton, thomie GHC Trac Issues: #13252 Differential Revision: https://phabricator.haskell.org/D3473 >--------------------------------------------------------------- e5732d2a28dfb8a754ee73e124e3558222a543bb libraries/base/cbits/inputReady.c | 40 +++++++++++++++++++++++++++++---------- libraries/base/tests/T13525.hs | 5 ++++- libraries/base/tests/all.T | 2 +- 3 files changed, 35 insertions(+), 12 deletions(-) diff --git a/libraries/base/cbits/inputReady.c b/libraries/base/cbits/inputReady.c index 230e592..1530d5b 100644 --- a/libraries/base/cbits/inputReady.c +++ b/libraries/base/cbits/inputReady.c @@ -9,11 +9,13 @@ #include "HsBase.h" #if !defined(_WIN32) #include +#include #endif /* * inputReady(fd) checks to see whether input is available on the file - * descriptor 'fd'. Input meaning 'can I safely read at least a + * descriptor 'fd' within 'msecs' milliseconds (or indefinitely if 'msecs' is + * negative). "Input is available" is defined as 'can I safely read at least a * *character* from this file object without blocking?' */ int @@ -21,23 +23,41 @@ fdReady(int fd, int write, int msecs, int isSock) { #if !defined(_WIN32) + struct pollfd fds[1]; - // We only handle msecs == 0 on non-Windows, because this is the - // only case we need. Non-zero waiting is handled by the IO manager. - if (msecs != 0) { - fprintf(stderr, "fdReady: msecs != 0, this shouldn't happen"); - abort(); + // if we need to track the then record the current time in case we are + // interrupted. + struct timeval tv0; + if (msecs > 0) { + if (gettimeofday(&tv0, NULL) != 0) { + fprintf(stderr, "fdReady: gettimeofday failed: %s\n", + strerror(errno)); + abort(); + } } - struct pollfd fds[1]; - fds[0].fd = fd; fds[0].events = write ? POLLOUT : POLLIN; fds[0].revents = 0; int res; - while ((res = poll(fds, 1, 0)) < 0) { - if (errno != EINTR) { + while ((res = poll(fds, 1, msecs)) < 0) { + if (errno == EINTR) { + if (msecs > 0) { + struct timeval tv; + if (gettimeofday(&tv, NULL) != 0) { + fprintf(stderr, "fdReady: gettimeofday failed: %s\n", + strerror(errno)); + abort(); + } + + int elapsed = 1000 * (tv.tv_sec - tv0.tv_sec) + + (tv.tv_usec - tv0.tv_usec) / 1000; + msecs -= elapsed; + if (msecs <= 0) return 0; + tv0 = tv; + } + } else { return (-1); } } diff --git a/libraries/base/tests/T13525.hs b/libraries/base/tests/T13525.hs index 1bb01b6..b4b589e 100644 --- a/libraries/base/tests/T13525.hs +++ b/libraries/base/tests/T13525.hs @@ -1,7 +1,10 @@ +import System.Posix.Files import System.IO import System.Timeout main :: IO () main = do - hWaitForInput stdin (5 * 1000) + createNamedPipe "test" accessModes + h <- openFile "test" ReadMode + hWaitForInput h (5 * 1000) return () diff --git a/libraries/base/tests/all.T b/libraries/base/tests/all.T index 69705bc..f3cdeaa 100644 --- a/libraries/base/tests/all.T +++ b/libraries/base/tests/all.T @@ -212,4 +212,4 @@ test('T13191', , only_ways(['normal'])], compile_and_run, ['-O']) -test('T13525', expect_broken(13525), compile_and_run, ['']) +test('T13525', normal, compile_and_run, ['']) From git at git.haskell.org Fri Apr 21 17:24:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 17:24:16 +0000 (UTC) Subject: [commit: ghc] master: Fix build on DragonflyBSD (cfff183) Message-ID: <20170421172416.B0BF03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cfff183f9ebcbe8ec4df9dcf39e95ac077d6e312/ghc >--------------------------------------------------------------- commit cfff183f9ebcbe8ec4df9dcf39e95ac077d6e312 Author: Ben Gamari Date: Fri Apr 21 12:11:41 2017 -0400 Fix build on DragonflyBSD Test Plan: Validate on DragonflyBSD Reviewers: austin, erikd, simonmar Reviewed By: erikd Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3480 >--------------------------------------------------------------- cfff183f9ebcbe8ec4df9dcf39e95ac077d6e312 rts/linker/Elf.c | 3 +++ rts/posix/OSThreads.c | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/rts/linker/Elf.c b/rts/linker/Elf.c index 36941b2..e41c066 100644 --- a/rts/linker/Elf.c +++ b/rts/linker/Elf.c @@ -26,6 +26,9 @@ #ifdef HAVE_FCNTL_H #include #endif +#if defined(dragonfly_HOST_OS) +#include +#endif /* on x86_64 we have a problem with relocating symbol references in * code that was compiled without -fPIC. By default, the small memory diff --git a/rts/posix/OSThreads.c b/rts/posix/OSThreads.c index 45f3942..c9adf4e 100644 --- a/rts/posix/OSThreads.c +++ b/rts/posix/OSThreads.c @@ -9,9 +9,9 @@ #include "PosixSource.h" -#if defined(freebsd_HOST_OS) -/* Inclusion of system headers usually requires __BSD_VISIBLE on FreeBSD, - * because of some specific types, like u_char, u_int, etc. */ +#if defined(freebsd_HOST_OS) || defined(dragonfly_HOST_OS) +/* Inclusion of system headers usually requires __BSD_VISIBLE on FreeBSD and + * DragonflyBSD, because of some specific types, like u_char, u_int, etc. */ #define __BSD_VISIBLE 1 #endif #if defined(darwin_HOST_OS) From git at git.haskell.org Fri Apr 21 17:24:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 17:24:19 +0000 (UTC) Subject: [commit: ghc] master: catch the case where there is no symCmd (69d5ad0) Message-ID: <20170421172419.6DD7B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/69d5ad068b4ddf96c1497712ee8e7cdfe1d765df/ghc >--------------------------------------------------------------- commit 69d5ad068b4ddf96c1497712ee8e7cdfe1d765df Author: Moritz Angermann Date: Fri Apr 21 12:12:01 2017 -0400 catch the case where there is no symCmd We do check for symCmd, to set the info->nlist value, but forgot to do the same check for info->names. Thus when trying to extract stroff from symCmd, we hit a segfault. Test Plan: The validation failure on windows is rather suspicious... let's try this one Reviewers: bgamari, adinapoli, austin, erikd, simonmar Reviewed By: adinapoli Subscribers: thomie, rwbarton Differential Revision: https://phabricator.haskell.org/D3468 >--------------------------------------------------------------- 69d5ad068b4ddf96c1497712ee8e7cdfe1d765df rts/Linker.c | 2 ++ rts/linker/MachO.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/rts/Linker.c b/rts/Linker.c index 7366904..b214e9c 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -1215,6 +1215,8 @@ mkOc( pathchar *path, char *image, int imageSize, IF_DEBUG(linker, debugBelch("mkOc: start\n")); oc = stgMallocBytes(sizeof(ObjectCode), "mkOc(oc)"); + oc->info = NULL; + # if defined(OBJFORMAT_ELF) oc->formatName = "ELF"; # elif defined(OBJFORMAT_PEi386) diff --git a/rts/linker/MachO.c b/rts/linker/MachO.c index 16b712a..e09d151 100644 --- a/rts/linker/MachO.c +++ b/rts/linker/MachO.c @@ -130,7 +130,9 @@ ocInit_MachO(ObjectCode * oc) oc->info->nlist = oc->info->symCmd == NULL ? NULL : (MachONList *)(oc->image + oc->info->symCmd->symoff); - oc->info->names = oc->image + oc->info->symCmd->stroff; + oc->info->names = oc->info->symCmd == NULL + ? NULL + : (oc->image + oc->info->symCmd->stroff); /* If we have symbols, allocate and fill the macho_symbols * This will make relocation easier. From git at git.haskell.org Fri Apr 21 17:24:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 17:24:22 +0000 (UTC) Subject: [commit: ghc] master: linters/check-cpp: Demote #if lints to warnings (ed5fd53) Message-ID: <20170421172422.29CCC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ed5fd5378dafb65bd12a16a4e02b6dae0639b83d/ghc >--------------------------------------------------------------- commit ed5fd5378dafb65bd12a16a4e02b6dae0639b83d Author: Ben Gamari Date: Fri Apr 21 12:27:51 2017 -0400 linters/check-cpp: Demote #if lints to warnings Errors trigger even for lines which the author didn't touch, which is undesired. >--------------------------------------------------------------- ed5fd5378dafb65bd12a16a4e02b6dae0639b83d .arc-linters/check-cpp.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.arc-linters/check-cpp.py b/.arc-linters/check-cpp.py index 1bbcbbd..a442e26 100755 --- a/.arc-linters/check-cpp.py +++ b/.arc-linters/check-cpp.py @@ -69,11 +69,14 @@ linters = [ RegexpLinter(br'ASSERT\s+\(', message='CPP macros should not have a space between the macro name and their argument list'), RegexpLinter(br'#ifdef\s+', - message='`#if defined(x)` is preferred to `#ifdef x`'), + message='`#if defined(x)` is preferred to `#ifdef x`', + severity='warning'), RegexpLinter(br'#if\s+defined\s+', - message='`#if defined(x)` is preferred to `#if defined x`'), + message='`#if defined(x)` is preferred to `#if defined x`', + severity='warning'), RegexpLinter(br'#ifndef\s+', - message='`#if !defined(x)` is preferred to `#ifndef x`'), + message='`#if !defined(x)` is preferred to `#ifndef x`', + severity='warning'), ] if __name__ == '__main__': From git at git.haskell.org Fri Apr 21 17:24:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 17:24:24 +0000 (UTC) Subject: [commit: ghc] master: Bump haskeline and terminfo submodules (f0751d9) Message-ID: <20170421172424.D9DCD3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f0751d9bedbe293af0dedecf63e65524fd4fda7f/ghc >--------------------------------------------------------------- commit f0751d9bedbe293af0dedecf63e65524fd4fda7f Author: Ben Gamari Date: Fri Apr 21 11:33:47 2017 -0400 Bump haskeline and terminfo submodules >--------------------------------------------------------------- f0751d9bedbe293af0dedecf63e65524fd4fda7f libraries/terminfo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/terminfo b/libraries/terminfo index 6ab1dff..c39f12c 160000 --- a/libraries/terminfo +++ b/libraries/terminfo @@ -1 +1 @@ -Subproject commit 6ab1dffebc0665dd347eba351a495dd80032d0e5 +Subproject commit c39f12cf41fc47b54723d9e9a08487e8e9dd119e From git at git.haskell.org Fri Apr 21 18:51:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 18:51:45 +0000 (UTC) Subject: [commit: ghc] branch 'wip/jenkins' created Message-ID: <20170421185145.6FBC43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/jenkins Referencing: 3ed0bbcd309725ba1dd68d254de0553db8ee24d8 From git at git.haskell.org Fri Apr 21 18:51:48 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 18:51:48 +0000 (UTC) Subject: [commit: ghc] wip/jenkins: Testing simpler Jenkinsfile (3ed0bbc) Message-ID: <20170421185148.CAFC03A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/jenkins Link : http://ghc.haskell.org/trac/ghc/changeset/3ed0bbcd309725ba1dd68d254de0553db8ee24d8/ghc >--------------------------------------------------------------- commit 3ed0bbcd309725ba1dd68d254de0553db8ee24d8 Author: Ben Gamari Date: Fri Apr 21 14:29:34 2017 -0400 Testing simpler Jenkinsfile >--------------------------------------------------------------- 3ed0bbcd309725ba1dd68d254de0553db8ee24d8 Jenkinsfile | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..ceb5359 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,15 @@ +pipeline { + agent any + stages { + stage('Build') { + steps { + sh ''' + ./boot + ./configure --enable-tarballs-autodownload + make -j$THREADS + make THREADS=$THREADS test + ''' + } + } + } +} From git at git.haskell.org Fri Apr 21 18:53:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 18:53:31 +0000 (UTC) Subject: [commit: ghc] wip/jenkins: Testing simpler Jenkinsfile (cdb65ee) Message-ID: <20170421185331.52F2C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/jenkins Link : http://ghc.haskell.org/trac/ghc/changeset/cdb65ee0c5f72edd84ff2f98af574c4fef277357/ghc >--------------------------------------------------------------- commit cdb65ee0c5f72edd84ff2f98af574c4fef277357 Author: Ben Gamari Date: Fri Apr 21 14:29:34 2017 -0400 Testing simpler Jenkinsfile >--------------------------------------------------------------- cdb65ee0c5f72edd84ff2f98af574c4fef277357 Jenkinsfile | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..7ff08f0 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,16 @@ +pipeline { + agent any + stages { + stage('Build') { + steps { + sh 'git submodule update --init --recursive' + sh ''' + ./boot + ./configure --enable-tarballs-autodownload + make -j$THREADS + make THREADS=$THREADS test + ''' + } + } + } +} From git at git.haskell.org Fri Apr 21 21:03:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 21:03:13 +0000 (UTC) Subject: [commit: ghc] branch 'wip/faster-stats' created Message-ID: <20170421210313.037743A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/faster-stats Referencing: 5cdeddd006a7aa569b937373dd622bc515dd0de3 From git at git.haskell.org Fri Apr 21 21:03:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 21:03:15 +0000 (UTC) Subject: [commit: ghc] wip/faster-stats: Speed up core size and core stats (5cdeddd) Message-ID: <20170421210315.CBDD63A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/faster-stats Link : http://ghc.haskell.org/trac/ghc/changeset/5cdeddd006a7aa569b937373dd622bc515dd0de3/ghc >--------------------------------------------------------------- commit 5cdeddd006a7aa569b937373dd622bc515dd0de3 Author: David Feuer Date: Fri Apr 21 16:59:55 2017 -0400 Speed up core size and core stats Summary: When calculating core size and core stats, we previously calculated sizes/stats for sub-parts and then added them. It should be faster to thread an accumulator through. Reviewers: austin, bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3483 >--------------------------------------------------------------- 5cdeddd006a7aa569b937373dd622bc515dd0de3 compiler/coreSyn/CoreStats.hs | 77 ++++++++++++++++++++++++------------------ compiler/types/TyCoRep.hs | 78 ++++++++++++++++++++++++++----------------- 2 files changed, 91 insertions(+), 64 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 5cdeddd006a7aa569b937373dd622bc515dd0de3 From git at git.haskell.org Fri Apr 21 21:33:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 21:33:09 +0000 (UTC) Subject: [commit: ghc] master: Build system: fix bindist for cross-build GHC (32a5ba9) Message-ID: <20170421213309.AD1173A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/32a5ba993de4a8c88d4738d7386ba8afbaa84e78/ghc >--------------------------------------------------------------- commit 32a5ba993de4a8c88d4738d7386ba8afbaa84e78 Author: Fangrui Song Date: Thu Apr 20 17:03:30 2017 -0700 Build system: fix bindist for cross-build GHC The change fixes case of installing cross-built GHC from bindist (BINDIST=YES) on TARGET. In this case we need to use TARGET tools in `INSTALLED_GHC{,_PKG}_REAL`. The original change is provided by Fangrui Song as pull request https://github.com/ghc/ghc/pull/34 Signed-off-by: Sergei Trofimovich >--------------------------------------------------------------- 32a5ba993de4a8c88d4738d7386ba8afbaa84e78 ghc.mk | 2 +- mk/config.mk.in | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ghc.mk b/ghc.mk index 8971f25..d1dbb9e 100644 --- a/ghc.mk +++ b/ghc.mk @@ -962,7 +962,7 @@ endif INSTALLED_PACKAGE_CONF=$(DESTDIR)$(topdir)/package.conf.d -ifeq "$(CrossCompiling)" "YES" +ifeq "$(BINDIST) $(CrossCompiling)" "NO YES" # when installing ghc-stage2 we can't run target's # 'ghc-pkg' and 'ghc-stage2' but those are needed for registration. INSTALLED_GHC_REAL=$(TOP)/inplace/bin/ghc-stage1 diff --git a/mk/config.mk.in b/mk/config.mk.in index 1f7353c..8901137 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -415,6 +415,7 @@ GhcRtsWithLibdw=$(strip $(if $(filter $(TargetArch_CPP),i386 x86_64), at UseLibdw@, # ################################################################################ +BINDIST = NO BIN_DIST_NAME = ghc-$(ProjectVersion) BIN_DIST_PREP_DIR = bindistprep/$(BIN_DIST_NAME) BIN_DIST_PREP_TAR = bindistprep/$(BIN_DIST_NAME)-$(TARGETPLATFORM).tar From git at git.haskell.org Fri Apr 21 22:46:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 22:46:08 +0000 (UTC) Subject: [commit: packages/terminfo] master: Remove the configure logic around detecting (n)curses.h. (02ebf00) Message-ID: <20170421224608.BB3E33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/terminfo On branch : master Link : http://git.haskell.org/packages/terminfo.git/commitdiff/02ebf00cb2ab59d7924909306b7a791c7959f703 >--------------------------------------------------------------- commit 02ebf00cb2ab59d7924909306b7a791c7959f703 Author: Judah Jacobson Date: Thu Apr 20 18:38:46 2017 -0700 Remove the configure logic around detecting (n)curses.h. It's complicated (see e.g. PR #21), and we don't actually need it for the build. >--------------------------------------------------------------- 02ebf00cb2ab59d7924909306b7a791c7959f703 configure.ac | 23 ----------------------- terminfo.buildinfo.in | 2 -- 2 files changed, 25 deletions(-) diff --git a/configure.ac b/configure.ac index 82f5015..0689aa7 100644 --- a/configure.ac +++ b/configure.ac @@ -1,11 +1,5 @@ AC_INIT([Haskell terminfo package], [0.2], [judah dot jacobson at gmail dot com], [terminfo]) -AC_ARG_WITH([curses-includes], - [AC_HELP_STRING([--with-curses-includes], - [directory containing curses.h])], - [curses_includes=$withval], - [curses_includes=NONE]) - AC_ARG_WITH([curses-libraries], [AC_HELP_STRING([--with-curses-libraries], [directory containing curses library])], @@ -13,32 +7,17 @@ AC_ARG_WITH([curses-libraries], [curses_libraries=NONE]) -TERMINFO_INCLUDE_DIRS= TERMINFO_LIB_DIRS= if test "x$curses_libraries" != "xNONE"; then LDFLAGS="-L$curses_libraries $LDFLAGS" TERMINFO_LIB_DIRS=$curses_libraries fi -if test "x$curses_includes" != "xNONE"; then - CPPFLAGS="-I$curses_includes $CPPFLAGS" - TERMINFO_INCLUDE_DIRS=$curses_includes -fi AC_ARG_WITH([cc], [C compiler], [CC=$withval]) AC_PROG_CC() -AC_CHECK_HEADER(ncurses.h, CursesIncludes='ncurses.h', - [AC_CHECK_HEADER(curses.h, CursesIncludes='curses.h', HaveCursesH=NO)]) - -# on Solaris, curses.h must be imported before term.h. -if test "x$HaveCursesH" = xNO ; then - AC_MSG_FAILURE([curses headers could not be found, so this package cannot be built]) -else - TERMINFO_INCLUDES="$CursesIncludes term.h" -fi - AC_CHECK_LIB(tinfo, setupterm, HaveLibCurses=YES; LibCurses=tinfo, [AC_CHECK_LIB(ncursesw, setupterm, HaveLibCurses=YES; LibCurses=ncursesw, [AC_CHECK_LIB(ncurses, setupterm, HaveLibCurses=YES; LibCurses=ncurses, @@ -52,8 +31,6 @@ else fi -AC_SUBST(TERMINFO_INCLUDES) -AC_SUBST(TERMINFO_INCLUDE_DIRS) AC_SUBST(TERMINFO_LIB_DIRS) AC_SUBST(TERMINFO_LIB) diff --git a/terminfo.buildinfo.in b/terminfo.buildinfo.in index c75566a..4c8bbd1 100644 --- a/terminfo.buildinfo.in +++ b/terminfo.buildinfo.in @@ -1,4 +1,2 @@ -includes: @TERMINFO_INCLUDES@ -include-dirs: @TERMINFO_INCLUDE_DIRS@ extra-lib-dirs: @TERMINFO_LIB_DIRS@ extra-libraries: @TERMINFO_LIB@ From git at git.haskell.org Fri Apr 21 22:46:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 22:46:27 +0000 (UTC) Subject: [commit: packages/terminfo] tag '0.4.1.0' created Message-ID: <20170421224627.3BE7E3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/terminfo New tag : 0.4.1.0 Referencing: 0561ec7cbf45f9c8663ffce0635fbed5d4821dab From git at git.haskell.org Fri Apr 21 22:51:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 22:51:12 +0000 (UTC) Subject: [commit: ghc] master: Sync up terminfo submodule to 0.4.1.0 release tag (58a59d0) Message-ID: <20170421225112.6364F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/58a59d035102c01472cec8ebace21c7ced6f2a06/ghc >--------------------------------------------------------------- commit 58a59d035102c01472cec8ebace21c7ced6f2a06 Author: Herbert Valerio Riedel Date: Sat Apr 22 00:50:26 2017 +0200 Sync up terminfo submodule to 0.4.1.0 release tag >--------------------------------------------------------------- 58a59d035102c01472cec8ebace21c7ced6f2a06 libraries/terminfo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/terminfo b/libraries/terminfo index c39f12c..02ebf00 160000 --- a/libraries/terminfo +++ b/libraries/terminfo @@ -1 +1 @@ -Subproject commit c39f12cf41fc47b54723d9e9a08487e8e9dd119e +Subproject commit 02ebf00cb2ab59d7924909306b7a791c7959f703 From git at git.haskell.org Fri Apr 21 23:35:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 21 Apr 2017 23:35:14 +0000 (UTC) Subject: [commit: ghc] master: Edit eventlog-formats.rst to match implementation (9dd20a3) Message-ID: <20170421233514.C84203A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9dd20a3fa523a9986a29f538dee7a570be72a677/ghc >--------------------------------------------------------------- commit 9dd20a3fa523a9986a29f538dee7a570be72a677 Author: Mitsutoshi Aoe Date: Mon Apr 17 06:08:25 2017 +0900 Edit eventlog-formats.rst to match implementation * Add missing filters in EVENT_HEAP_PROF_BEGIN and reorder them * EVENT_HEAP_PROF_SAMPLE_COST_CENTRE isn't used in retainer profiling * Modify EVENT_HEAP_PROF_SAMPLE_STRING's format * Biography break-down isn't implemented >--------------------------------------------------------------- 9dd20a3fa523a9986a29f538dee7a570be72a677 docs/users_guide/eventlog-formats.rst | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/docs/users_guide/eventlog-formats.rst b/docs/users_guide/eventlog-formats.rst index 74a62f2..8d53f92 100644 --- a/docs/users_guide/eventlog-formats.rst +++ b/docs/users_guide/eventlog-formats.rst @@ -38,11 +38,13 @@ A single fixed-width event emitted during program start-up describing the sample * ``SAMPLE_TYPE_MODULE`` (output from ``-hm``) * ``SAMPLE_TYPE_TYPE_DESCR`` (output from ``-hy``) * ``SAMPLE_TYPE_BIOGRAPHY`` (output from ``-hb``) - * ``String``: Cost centre filter - * ``String``: Closure description filter - * ``String``: Retainer filter * ``String``: Module filter + * ``String``: Closure description filter * ``String``: Type description filter + * ``String``: Cost centre filter + * ``String``: Cost centre stack filter + * ``String``: Retainer filter + * ``String``: Biography filter Cost center definitions ^^^^^^^^^^^^^^^^^^^^^^^ @@ -81,9 +83,8 @@ Cost-center break-down A variable-length packet encoding a heap profile sample broken down by, * cost-center (``-hc``) - * retainer (``-hr``) - * ``EVENT_HEAP_PROF_SAMPLE`` + * ``EVENT_HEAP_PROF_SAMPLE_COST_CENTRE`` * ``Word8``: Profile ID * ``Word64``: heap residency in bytes * ``Word8``: stack depth @@ -98,22 +99,7 @@ A variable-length event encoding a heap sample broken down by, * closure description (``-hd``) * module (``-hm``) - * ``EVENT_HEAP_PROF_SAMPLE`` + * ``EVENT_HEAP_PROF_SAMPLE_STRING`` * ``Word8``: Profile ID - * The event shall contain packed pairs of, - * ``String``: type description - * ``Word64``: heap residency in bytes - - -Biography break-down -^^^^^^^^^^^^^^^^^^^^ - -A fixed-length event encoding a biography heap sample. - - * ``EVENT_HEAP_PROF_SAMPLE`` - * ``Word8``: Profile ID - * ``Word64``: Void - * ``Word64``: Lag - * ``Word64``: Use - * ``Word64``: Inherent use - * ``Word64``: Drag + * ``Word64``: heap residency in bytes + * ``String``: type or closure description, or module name From git at git.haskell.org Sat Apr 22 02:04:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 22 Apr 2017 02:04:19 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Update performance metrics (363f7fd) Message-ID: <20170422020419.369B23A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/363f7fd4183a302b3616233c5996dfadf345fb01/ghc >--------------------------------------------------------------- commit 363f7fd4183a302b3616233c5996dfadf345fb01 Author: Ben Gamari Date: Fri Apr 21 20:06:27 2017 -0400 testsuite: Update performance metrics >--------------------------------------------------------------- 363f7fd4183a302b3616233c5996dfadf345fb01 testsuite/tests/perf/compiler/all.T | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index 7b56f0b..0bbc479 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -105,7 +105,7 @@ test('T1969', # 2015-07-11 288699104 (x86/Linux, 64-bit machine) use +RTS -G1 # 2016-04-06 344730660 (x86/Linux, 64-bit machine) # 2017-03-24 324586096 (x86/Linux, 64-bit machine) - (wordsize(64), 695354904, 5)]), + (wordsize(64), 659863176, 5)]), # 2009-11-17 434845560 (amd64/Linux) # 2009-12-08 459776680 (amd64/Linux) # 2010-05-17 519377728 (amd64/Linux) @@ -128,6 +128,7 @@ test('T1969', # 2015-10-28 756138176 (x86_64/Linux) inst-decl defaults go via typechecker (#12220) # 2017-02-17 831733376 (x86_64/Linux) Type-indexed Typeable # 2017-02-25 695354904 (x86_64/Linux) Early inlining patch + # 2017-04-21 659863176 (x86_64/Linux) Unknown only_ways(['normal']), extra_hc_opts('-dcore-lint -static'), @@ -644,7 +645,8 @@ test('T5837', # 2017-03-24: 27028956 (x86/Linux, 64-bit machine) (platform('x86_64-unknown-mingw32'), 59161648, 7), - # 2017-02-19 59161648 (x64/Windows) - Unknown + # 2017-02-19 59161648 (x64/Windows) - Unknown + # 2017-04-21 54985248 (x64/Windows) - Unknown (wordsize(64), 52625920, 7)]) # sample: 3926235424 (amd64/Linux, 15/2/2012) @@ -1054,6 +1056,7 @@ test('T13056', # 2017-01-31 546800240 Join points (#12988) # 2017-02-07 524611224 new SetLevels # 2017-02-14 440548592 Early inline patch: 16% improvement + # 2017-04-21 417860736 Unknown ]), ], compile, From git at git.haskell.org Sat Apr 22 02:04:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 22 Apr 2017 02:04:21 +0000 (UTC) Subject: [commit: ghc] master: base: update comment to match the change from e134af01 (3d7c489) Message-ID: <20170422020421.E3F703A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3d7c489404a0b08c35a1547bff6ab04cb1c30b00/ghc >--------------------------------------------------------------- commit 3d7c489404a0b08c35a1547bff6ab04cb1c30b00 Author: Andrzej Rybczak Date: Fri Apr 21 20:11:35 2017 -0400 base: update comment to match the change from e134af01 Reviewers: austin, hvr, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3484 >--------------------------------------------------------------- 3d7c489404a0b08c35a1547bff6ab04cb1c30b00 libraries/base/GHC/IO/Handle/Lock.hsc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libraries/base/GHC/IO/Handle/Lock.hsc b/libraries/base/GHC/IO/Handle/Lock.hsc index ebb3ce4..b2c64c4 100644 --- a/libraries/base/GHC/IO/Handle/Lock.hsc +++ b/libraries/base/GHC/IO/Handle/Lock.hsc @@ -127,9 +127,8 @@ lockImpl h ctx mode block = do -- We want to lock the whole file without looking up its size to be -- consistent with what flock does. According to documentation of LockFileEx -- "locking a region that goes beyond the current end-of-file position is - -- not an error", however some versions of Windows seem to have issues with - -- large regions and set ERROR_INVALID_LOCK_RANGE in such case for - -- mysterious reasons. Work around that by setting only low 32 bits. + -- not an error", hence we pass maximum value as the number of bytes to + -- lock. fix $ \retry -> c_LockFileEx wh flags 0 0xffffffff 0xffffffff ovrlpd >>= \case True -> return True False -> getLastError >>= \err -> if From git at git.haskell.org Sat Apr 22 02:04:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 22 Apr 2017 02:04:24 +0000 (UTC) Subject: [commit: ghc] master: Bump filepath submodule (bf67dc7) Message-ID: <20170422020424.9D0EC3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/bf67dc70e4f8c61465c4fe3167b3f5f7b3d46826/ghc >--------------------------------------------------------------- commit bf67dc70e4f8c61465c4fe3167b3f5f7b3d46826 Author: Ben Gamari Date: Fri Apr 21 12:39:35 2017 -0400 Bump filepath submodule >--------------------------------------------------------------- bf67dc70e4f8c61465c4fe3167b3f5f7b3d46826 libraries/filepath | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/filepath b/libraries/filepath index 1462d21..141cddb 160000 --- a/libraries/filepath +++ b/libraries/filepath @@ -1 +1 @@ -Subproject commit 1462d2106e0748efd4cfc1aa3316863a06f94562 +Subproject commit 141cddb606fd6f6a60f730fed3d57502b93c14ae From git at git.haskell.org Sat Apr 22 02:04:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 22 Apr 2017 02:04:27 +0000 (UTC) Subject: [commit: ghc] master: Bump time submodule (5eebb11) Message-ID: <20170422020427.5BAA93A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5eebb11e5ae069614ea021b4e19d61482bacf594/ghc >--------------------------------------------------------------- commit 5eebb11e5ae069614ea021b4e19d61482bacf594 Author: Ben Gamari Date: Fri Apr 21 12:42:50 2017 -0400 Bump time submodule >--------------------------------------------------------------- 5eebb11e5ae069614ea021b4e19d61482bacf594 libraries/time | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/time b/libraries/time index 4a4e2ce..d03429e 160000 --- a/libraries/time +++ b/libraries/time @@ -1 +1 @@ -Subproject commit 4a4e2ce6a1bf099393772737d848d900832ee84d +Subproject commit d03429e1913b6babd3b59d0bfdd7d3904b1b6f0b From git at git.haskell.org Sat Apr 22 02:04:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 22 Apr 2017 02:04:30 +0000 (UTC) Subject: [commit: ghc] master: Bump deepseeq submodule (c35d63b) Message-ID: <20170422020430.19E893A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c35d63b97904d0ece0e017b373367f95744c52d9/ghc >--------------------------------------------------------------- commit c35d63b97904d0ece0e017b373367f95744c52d9 Author: Ben Gamari Date: Fri Apr 21 12:36:33 2017 -0400 Bump deepseeq submodule >--------------------------------------------------------------- c35d63b97904d0ece0e017b373367f95744c52d9 libraries/deepseq | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/deepseq b/libraries/deepseq index 418856a..65dd864 160000 --- a/libraries/deepseq +++ b/libraries/deepseq @@ -1 +1 @@ -Subproject commit 418856afb4e70127d9dce309a198b18dc47bd7d9 +Subproject commit 65dd864d0d2f5cf415064fc214261b9270a924cf From git at git.haskell.org Sat Apr 22 02:29:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 22 Apr 2017 02:29:05 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Bump deepseeq submodule (c1a73ff) Message-ID: <20170422022905.76BFA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/c1a73ffcfa18d388b619918b5c24783eefd2ea32/ghc >--------------------------------------------------------------- commit c1a73ffcfa18d388b619918b5c24783eefd2ea32 Author: Ben Gamari Date: Fri Apr 21 12:36:33 2017 -0400 Bump deepseeq submodule >--------------------------------------------------------------- c1a73ffcfa18d388b619918b5c24783eefd2ea32 libraries/deepseq | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/deepseq b/libraries/deepseq index 418856a..65dd864 160000 --- a/libraries/deepseq +++ b/libraries/deepseq @@ -1 +1 @@ -Subproject commit 418856afb4e70127d9dce309a198b18dc47bd7d9 +Subproject commit 65dd864d0d2f5cf415064fc214261b9270a924cf From git at git.haskell.org Sat Apr 22 02:29:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 22 Apr 2017 02:29:10 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Bump time submodule (a15204b) Message-ID: <20170422022910.EDAAA3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/a15204b29e8a2e7cd5369defdc60f881eb2c32be/ghc >--------------------------------------------------------------- commit a15204b29e8a2e7cd5369defdc60f881eb2c32be Author: Ben Gamari Date: Fri Apr 21 12:42:50 2017 -0400 Bump time submodule >--------------------------------------------------------------- a15204b29e8a2e7cd5369defdc60f881eb2c32be libraries/time | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/time b/libraries/time index 4a4e2ce..d03429e 160000 --- a/libraries/time +++ b/libraries/time @@ -1 +1 @@ -Subproject commit 4a4e2ce6a1bf099393772737d848d900832ee84d +Subproject commit d03429e1913b6babd3b59d0bfdd7d3904b1b6f0b From git at git.haskell.org Sat Apr 22 02:29:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 22 Apr 2017 02:29:13 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: base: Fix offset initialization of Windows hLock implementation (6ba1dd5) Message-ID: <20170422022913.A82793A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/6ba1dd57c9bab29d66c0c8a892c867d4890e64e6/ghc >--------------------------------------------------------------- commit 6ba1dd57c9bab29d66c0c8a892c867d4890e64e6 Author: Ben Gamari Date: Fri Apr 21 12:10:33 2017 -0400 base: Fix offset initialization of Windows hLock implementation The previous implementation swapped the buffer size with the byte to be set, essentially resulting in an uninitialized buffer. Test Plan: Validate on Windows Reviewers: austin, hvr Subscribers: rwbarton, thomie GHC Trac Issues: #13599 Differential Revision: https://phabricator.haskell.org/D3478 (cherry picked from commit e134af010bdd0d2a94fbfd68e0605dc55e1be3a8) >--------------------------------------------------------------- 6ba1dd57c9bab29d66c0c8a892c867d4890e64e6 libraries/base/GHC/IO/Handle/Lock.hsc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libraries/base/GHC/IO/Handle/Lock.hsc b/libraries/base/GHC/IO/Handle/Lock.hsc index 5608c18..ebb3ce4 100644 --- a/libraries/base/GHC/IO/Handle/Lock.hsc +++ b/libraries/base/GHC/IO/Handle/Lock.hsc @@ -45,7 +45,6 @@ import Foreign.Marshal.Utils import GHC.IO.FD import GHC.IO.Handle.FD import GHC.Ptr -import GHC.Real import GHC.Windows #endif @@ -123,7 +122,7 @@ lockImpl h ctx mode block = do FD{fdFD = fd} <- handleToFd h wh <- throwErrnoIf (== iNVALID_HANDLE_VALUE) ctx $ c_get_osfhandle fd allocaBytes sizeof_OVERLAPPED $ \ovrlpd -> do - fillBytes ovrlpd (fromIntegral sizeof_OVERLAPPED) 0 + fillBytes ovrlpd 0 sizeof_OVERLAPPED let flags = cmode .|. (if block then 0 else #{const LOCKFILE_FAIL_IMMEDIATELY}) -- We want to lock the whole file without looking up its size to be -- consistent with what flock does. According to documentation of LockFileEx @@ -131,7 +130,7 @@ lockImpl h ctx mode block = do -- not an error", however some versions of Windows seem to have issues with -- large regions and set ERROR_INVALID_LOCK_RANGE in such case for -- mysterious reasons. Work around that by setting only low 32 bits. - fix $ \retry -> c_LockFileEx wh flags 0 0xffffffff 0x0 ovrlpd >>= \case + fix $ \retry -> c_LockFileEx wh flags 0 0xffffffff 0xffffffff ovrlpd >>= \case True -> return True False -> getLastError >>= \err -> if | not block && err == #{const ERROR_LOCK_VIOLATION} -> return False From git at git.haskell.org Sat Apr 22 02:29:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 22 Apr 2017 02:29:16 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Fix build on DragonflyBSD (3d468a9) Message-ID: <20170422022916.8507C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/3d468a99cb9e5aaea8bce576bc0a64b7acc7e5be/ghc >--------------------------------------------------------------- commit 3d468a99cb9e5aaea8bce576bc0a64b7acc7e5be Author: Ben Gamari Date: Fri Apr 21 12:11:41 2017 -0400 Fix build on DragonflyBSD Test Plan: Validate on DragonflyBSD Reviewers: austin, erikd, simonmar Reviewed By: erikd Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3480 (cherry picked from commit cfff183f9ebcbe8ec4df9dcf39e95ac077d6e312) >--------------------------------------------------------------- 3d468a99cb9e5aaea8bce576bc0a64b7acc7e5be rts/linker/Elf.c | 3 +++ rts/posix/OSThreads.c | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/rts/linker/Elf.c b/rts/linker/Elf.c index 086a323..df35604 100644 --- a/rts/linker/Elf.c +++ b/rts/linker/Elf.c @@ -26,6 +26,9 @@ #ifdef HAVE_FCNTL_H #include #endif +#if defined(dragonfly_HOST_OS) +#include +#endif /* on x86_64 we have a problem with relocating symbol references in * code that was compiled without -fPIC. By default, the small memory diff --git a/rts/posix/OSThreads.c b/rts/posix/OSThreads.c index 45f3942..c9adf4e 100644 --- a/rts/posix/OSThreads.c +++ b/rts/posix/OSThreads.c @@ -9,9 +9,9 @@ #include "PosixSource.h" -#if defined(freebsd_HOST_OS) -/* Inclusion of system headers usually requires __BSD_VISIBLE on FreeBSD, - * because of some specific types, like u_char, u_int, etc. */ +#if defined(freebsd_HOST_OS) || defined(dragonfly_HOST_OS) +/* Inclusion of system headers usually requires __BSD_VISIBLE on FreeBSD and + * DragonflyBSD, because of some specific types, like u_char, u_int, etc. */ #define __BSD_VISIBLE 1 #endif #if defined(darwin_HOST_OS) From git at git.haskell.org Sat Apr 22 02:29:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 22 Apr 2017 02:29:08 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Bump filepath submodule (7dfe822) Message-ID: <20170422022908.330D13A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/7dfe82298144bfd05ef036d144970d91378a53a0/ghc >--------------------------------------------------------------- commit 7dfe82298144bfd05ef036d144970d91378a53a0 Author: Ben Gamari Date: Fri Apr 21 12:39:35 2017 -0400 Bump filepath submodule >--------------------------------------------------------------- 7dfe82298144bfd05ef036d144970d91378a53a0 libraries/filepath | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/filepath b/libraries/filepath index 1462d21..141cddb 160000 --- a/libraries/filepath +++ b/libraries/filepath @@ -1 +1 @@ -Subproject commit 1462d2106e0748efd4cfc1aa3316863a06f94562 +Subproject commit 141cddb606fd6f6a60f730fed3d57502b93c14ae From git at git.haskell.org Sat Apr 22 02:29:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 22 Apr 2017 02:29:19 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: base: Add test for #13525 (febdca9) Message-ID: <20170422022919.C96043A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/febdca91fc813eae8d72a6305c704a80a37656c4/ghc >--------------------------------------------------------------- commit febdca91fc813eae8d72a6305c704a80a37656c4 Author: Ben Gamari Date: Tue Apr 4 20:48:20 2017 -0400 base: Add test for #13525 Reviewers: austin, hvr Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3419 (cherry picked from commit 3d523fd990bbb31ca97ea22059ec9d53f0705d8c) >--------------------------------------------------------------- febdca91fc813eae8d72a6305c704a80a37656c4 libraries/base/tests/T13525.hs | 7 +++++++ libraries/base/tests/all.T | 1 + 2 files changed, 8 insertions(+) diff --git a/libraries/base/tests/T13525.hs b/libraries/base/tests/T13525.hs new file mode 100644 index 0000000..1bb01b6 --- /dev/null +++ b/libraries/base/tests/T13525.hs @@ -0,0 +1,7 @@ +import System.IO +import System.Timeout + +main :: IO () +main = do + hWaitForInput stdin (5 * 1000) + return () diff --git a/libraries/base/tests/all.T b/libraries/base/tests/all.T index 13049f7..49298d3 100644 --- a/libraries/base/tests/all.T +++ b/libraries/base/tests/all.T @@ -211,3 +211,4 @@ test('T13191', , only_ways(['normal'])], compile_and_run, ['-O']) +test('T13525', expect_broken(13525), compile_and_run, ['']) From git at git.haskell.org Sat Apr 22 02:29:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 22 Apr 2017 02:29:25 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Bump parallel submodule (942848e) Message-ID: <20170422022925.3A0363A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/942848e9966c6d55327216485ce28741c79ec4c4/ghc >--------------------------------------------------------------- commit 942848e9966c6d55327216485ce28741c79ec4c4 Author: Ben Gamari Date: Fri Apr 21 13:16:43 2017 -0400 Bump parallel submodule >--------------------------------------------------------------- 942848e9966c6d55327216485ce28741c79ec4c4 libraries/parallel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/parallel b/libraries/parallel index 040c4f0..d2e2a5e 160000 --- a/libraries/parallel +++ b/libraries/parallel @@ -1 +1 @@ -Subproject commit 040c4f0226a5a9a1e720d89a9e1239028d9f62d9 +Subproject commit d2e2a5e630fdfa0e9bc8c2d8c7d134ad3500b5de From git at git.haskell.org Sat Apr 22 02:29:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 22 Apr 2017 02:29:22 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Edit eventlog-formats.rst to match implementation (5b42eb0) Message-ID: <20170422022922.7F7AE3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/5b42eb019b663a9cf7d7cedbd6506c59ef4737b1/ghc >--------------------------------------------------------------- commit 5b42eb019b663a9cf7d7cedbd6506c59ef4737b1 Author: Mitsutoshi Aoe Date: Mon Apr 17 06:08:25 2017 +0900 Edit eventlog-formats.rst to match implementation * Add missing filters in EVENT_HEAP_PROF_BEGIN and reorder them * EVENT_HEAP_PROF_SAMPLE_COST_CENTRE isn't used in retainer profiling * Modify EVENT_HEAP_PROF_SAMPLE_STRING's format * Biography break-down isn't implemented (cherry picked from commit 9dd20a3fa523a9986a29f538dee7a570be72a677) >--------------------------------------------------------------- 5b42eb019b663a9cf7d7cedbd6506c59ef4737b1 docs/users_guide/eventlog-formats.rst | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/docs/users_guide/eventlog-formats.rst b/docs/users_guide/eventlog-formats.rst index 74a62f2..8d53f92 100644 --- a/docs/users_guide/eventlog-formats.rst +++ b/docs/users_guide/eventlog-formats.rst @@ -38,11 +38,13 @@ A single fixed-width event emitted during program start-up describing the sample * ``SAMPLE_TYPE_MODULE`` (output from ``-hm``) * ``SAMPLE_TYPE_TYPE_DESCR`` (output from ``-hy``) * ``SAMPLE_TYPE_BIOGRAPHY`` (output from ``-hb``) - * ``String``: Cost centre filter - * ``String``: Closure description filter - * ``String``: Retainer filter * ``String``: Module filter + * ``String``: Closure description filter * ``String``: Type description filter + * ``String``: Cost centre filter + * ``String``: Cost centre stack filter + * ``String``: Retainer filter + * ``String``: Biography filter Cost center definitions ^^^^^^^^^^^^^^^^^^^^^^^ @@ -81,9 +83,8 @@ Cost-center break-down A variable-length packet encoding a heap profile sample broken down by, * cost-center (``-hc``) - * retainer (``-hr``) - * ``EVENT_HEAP_PROF_SAMPLE`` + * ``EVENT_HEAP_PROF_SAMPLE_COST_CENTRE`` * ``Word8``: Profile ID * ``Word64``: heap residency in bytes * ``Word8``: stack depth @@ -98,22 +99,7 @@ A variable-length event encoding a heap sample broken down by, * closure description (``-hd``) * module (``-hm``) - * ``EVENT_HEAP_PROF_SAMPLE`` + * ``EVENT_HEAP_PROF_SAMPLE_STRING`` * ``Word8``: Profile ID - * The event shall contain packed pairs of, - * ``String``: type description - * ``Word64``: heap residency in bytes - - -Biography break-down -^^^^^^^^^^^^^^^^^^^^ - -A fixed-length event encoding a biography heap sample. - - * ``EVENT_HEAP_PROF_SAMPLE`` - * ``Word8``: Profile ID - * ``Word64``: Void - * ``Word64``: Lag - * ``Word64``: Use - * ``Word64``: Inherent use - * ``Word64``: Drag + * ``Word64``: heap residency in bytes + * ``String``: type or closure description, or module name From git at git.haskell.org Sat Apr 22 02:29:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 22 Apr 2017 02:29:27 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Bump unix submodule (6c3e744) Message-ID: <20170422022927.EDCE33A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/6c3e7442a3c48601e29f39e83cb162fc1756374d/ghc >--------------------------------------------------------------- commit 6c3e7442a3c48601e29f39e83cb162fc1756374d Author: Ben Gamari Date: Fri Apr 21 13:11:07 2017 -0400 Bump unix submodule >--------------------------------------------------------------- 6c3e7442a3c48601e29f39e83cb162fc1756374d libraries/unix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/unix b/libraries/unix index 821cb07..19aaa0f 160000 --- a/libraries/unix +++ b/libraries/unix @@ -1 +1 @@ -Subproject commit 821cb07ecf235625b4bb06626d30e4b15f28df30 +Subproject commit 19aaa0fcca3427e4006a967972eb16a570ca43b1 From git at git.haskell.org Sat Apr 22 02:29:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 22 Apr 2017 02:29:30 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: base: Fix hWaitForInput with timeout on POSIX (ae69eae) Message-ID: <20170422022930.A86A43A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/ae69eaed6e2a5dff7f3a61d4373b7c52e715e3ad/ghc >--------------------------------------------------------------- commit ae69eaed6e2a5dff7f3a61d4373b7c52e715e3ad Author: Ben Gamari Date: Fri Apr 21 12:11:28 2017 -0400 base: Fix hWaitForInput with timeout on POSIX This was previously broken (#13252) by f46369b8a1bf90a3bdc30f2b566c3a7e03672518, which ported the fdReady function from `select` to `poll` and in so doing dropping support for timeouts. Unfortunately, while `select` tells us the amount of time not slept (on Linux anyways; it turns out this is implementation dependent), `poll` does not give us this luxury. Consequently, we manually need to track time slept in this case. Unfortunately, portably measuring time is hard. Ideally we would use `clock_gettime` with the monotonic clock here, but sadly this isn't supported on most versions of Darwin. Consequently, we instead use `gettimeofday`, running the risk of system time changes messing us up. Test Plan: Validate Reviewers: simonmar, austin, hvr Reviewed By: simonmar Subscribers: rwbarton, thomie GHC Trac Issues: #13252 Differential Revision: https://phabricator.haskell.org/D3473 (cherry picked from commit e5732d2a28dfb8a754ee73e124e3558222a543bb) >--------------------------------------------------------------- ae69eaed6e2a5dff7f3a61d4373b7c52e715e3ad libraries/base/cbits/inputReady.c | 40 +++++++++++++++++++++++++++++---------- libraries/base/tests/T13525.hs | 5 ++++- libraries/base/tests/all.T | 2 +- 3 files changed, 35 insertions(+), 12 deletions(-) diff --git a/libraries/base/cbits/inputReady.c b/libraries/base/cbits/inputReady.c index 230e592..1530d5b 100644 --- a/libraries/base/cbits/inputReady.c +++ b/libraries/base/cbits/inputReady.c @@ -9,11 +9,13 @@ #include "HsBase.h" #if !defined(_WIN32) #include +#include #endif /* * inputReady(fd) checks to see whether input is available on the file - * descriptor 'fd'. Input meaning 'can I safely read at least a + * descriptor 'fd' within 'msecs' milliseconds (or indefinitely if 'msecs' is + * negative). "Input is available" is defined as 'can I safely read at least a * *character* from this file object without blocking?' */ int @@ -21,23 +23,41 @@ fdReady(int fd, int write, int msecs, int isSock) { #if !defined(_WIN32) + struct pollfd fds[1]; - // We only handle msecs == 0 on non-Windows, because this is the - // only case we need. Non-zero waiting is handled by the IO manager. - if (msecs != 0) { - fprintf(stderr, "fdReady: msecs != 0, this shouldn't happen"); - abort(); + // if we need to track the then record the current time in case we are + // interrupted. + struct timeval tv0; + if (msecs > 0) { + if (gettimeofday(&tv0, NULL) != 0) { + fprintf(stderr, "fdReady: gettimeofday failed: %s\n", + strerror(errno)); + abort(); + } } - struct pollfd fds[1]; - fds[0].fd = fd; fds[0].events = write ? POLLOUT : POLLIN; fds[0].revents = 0; int res; - while ((res = poll(fds, 1, 0)) < 0) { - if (errno != EINTR) { + while ((res = poll(fds, 1, msecs)) < 0) { + if (errno == EINTR) { + if (msecs > 0) { + struct timeval tv; + if (gettimeofday(&tv, NULL) != 0) { + fprintf(stderr, "fdReady: gettimeofday failed: %s\n", + strerror(errno)); + abort(); + } + + int elapsed = 1000 * (tv.tv_sec - tv0.tv_sec) + + (tv.tv_usec - tv0.tv_usec) / 1000; + msecs -= elapsed; + if (msecs <= 0) return 0; + tv0 = tv; + } + } else { return (-1); } } diff --git a/libraries/base/tests/T13525.hs b/libraries/base/tests/T13525.hs index 1bb01b6..b4b589e 100644 --- a/libraries/base/tests/T13525.hs +++ b/libraries/base/tests/T13525.hs @@ -1,7 +1,10 @@ +import System.Posix.Files import System.IO import System.Timeout main :: IO () main = do - hWaitForInput stdin (5 * 1000) + createNamedPipe "test" accessModes + h <- openFile "test" ReadMode + hWaitForInput h (5 * 1000) return () diff --git a/libraries/base/tests/all.T b/libraries/base/tests/all.T index 49298d3..b4bb74a 100644 --- a/libraries/base/tests/all.T +++ b/libraries/base/tests/all.T @@ -211,4 +211,4 @@ test('T13191', , only_ways(['normal'])], compile_and_run, ['-O']) -test('T13525', expect_broken(13525), compile_and_run, ['']) +test('T13525', normal, compile_and_run, ['']) From git at git.haskell.org Sun Apr 23 03:39:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 23 Apr 2017 03:39:44 +0000 (UTC) Subject: [commit: ghc] master: Haddock submodule update. (6cffee6) Message-ID: <20170423033944.825943A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6cffee6a567a60a85792a5eb7c899b2878c7192d/ghc >--------------------------------------------------------------- commit 6cffee6a567a60a85792a5eb7c899b2878c7192d Author: Edward Z. Yang Date: Sat Apr 22 20:39:18 2017 -0700 Haddock submodule update. Signed-off-by: Edward Z. Yang >--------------------------------------------------------------- 6cffee6a567a60a85792a5eb7c899b2878c7192d utils/haddock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/haddock b/utils/haddock index 07272c7..a0c4790 160000 --- a/utils/haddock +++ b/utils/haddock @@ -1 +1 @@ -Subproject commit 07272c70c1cc72cd631177796a1b5b332bcc579b +Subproject commit a0c4790e15a2d3fab8d830eee8fcd639fe6d39c9 From git at git.haskell.org Sun Apr 23 09:58:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 23 Apr 2017 09:58:51 +0000 (UTC) Subject: [commit: ghc] master: skip T13525 when running on Windows. (8e93799) Message-ID: <20170423095851.817893A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8e93799418b8056abdb1c9e40d73afb95666cd23/ghc >--------------------------------------------------------------- commit 8e93799418b8056abdb1c9e40d73afb95666cd23 Author: Tamar Christina Date: Sun Apr 23 10:44:54 2017 +0100 skip T13525 when running on Windows. >--------------------------------------------------------------- 8e93799418b8056abdb1c9e40d73afb95666cd23 libraries/base/tests/all.T | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/base/tests/all.T b/libraries/base/tests/all.T index f3cdeaa..33055f3 100644 --- a/libraries/base/tests/all.T +++ b/libraries/base/tests/all.T @@ -212,4 +212,4 @@ test('T13191', , only_ways(['normal'])], compile_and_run, ['-O']) -test('T13525', normal, compile_and_run, ['']) +test('T13525', when(opsys('mingw32'), skip), compile_and_run, ['']) From git at git.haskell.org Sun Apr 23 10:36:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 23 Apr 2017 10:36:15 +0000 (UTC) Subject: [commit: ghc] master: First update mingw-w64 packages for 8.4 (f446f6a) Message-ID: <20170423103615.BE1BB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f446f6a3cff21bb709ea501c5be87b0282d5da1c/ghc >--------------------------------------------------------------- commit f446f6a3cff21bb709ea501c5be87b0282d5da1c Author: Tamar Christina Date: Sun Apr 23 11:21:18 2017 +0100 First update mingw-w64 packages for 8.4 Summary: Updating to get latest binutils etc. Test Plan: ./validate Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie, snowleopard GHC Trac Issues: #12913 Differential Revision: https://phabricator.haskell.org/D3382 >--------------------------------------------------------------- f446f6a3cff21bb709ea501c5be87b0282d5da1c mk/get-win32-tarballs.sh | 20 ++++++------- mk/win32-tarballs.md5sum | 78 ++++++++++++++++++++++++------------------------ 2 files changed, 49 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 f446f6a3cff21bb709ea501c5be87b0282d5da1c From git at git.haskell.org Sun Apr 23 12:55:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 23 Apr 2017 12:55:01 +0000 (UTC) Subject: [commit: ghc] master: aclocal.m4: treat '*-w64-mingw32' targets as windows (fe37e2c) Message-ID: <20170423125501.9A76B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fe37e2c6ab9dae6a522735114fea4dde9509250f/ghc >--------------------------------------------------------------- commit fe37e2c6ab9dae6a522735114fea4dde9509250f Author: Sergei Trofimovich Date: Sun Apr 23 11:25:29 2017 +0100 aclocal.m4: treat '*-w64-mingw32' targets as windows Noticed when tried to cross-compile GHC from x86_64-linux to --target=i686-w64-mingw32. Final ghc executables did not have '.exe' extensions. Signed-off-by: Sergei Trofimovich >--------------------------------------------------------------- fe37e2c6ab9dae6a522735114fea4dde9509250f aclocal.m4 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/aclocal.m4 b/aclocal.m4 index ed26a89..fc7b24c 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -14,7 +14,8 @@ AC_DEFUN([GHC_SELECT_FILE_EXTENSIONS], AC_MSG_WARN([I'm assuming you wanted to build for i386-unknown-mingw32]) exit 1 ;; - *-unknown-mingw32) + # examples: i386-unknown-mingw32, i686-w64-mingw32, x86_64-w64-mingw32 + *-mingw32) windows=YES $2='.exe' $3='.dll' From git at git.haskell.org Sun Apr 23 12:55:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 23 Apr 2017 12:55:07 +0000 (UTC) Subject: [commit: ghc] master: rts: tweak cross-compilation to mingw32 (745032d) Message-ID: <20170423125507.16EA83A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/745032dd02da511067c2939259ed212852187e0f/ghc >--------------------------------------------------------------- commit 745032dd02da511067c2939259ed212852187e0f Author: Sergei Trofimovich Date: Sun Apr 23 11:44:45 2017 +0100 rts: tweak cross-compilation to mingw32 Found the problem on x86_64-linux host where I tried to cross-compile GHC to windows as: $ ./configure --target=i686-w64-mingw32 \ Windres=i686-w64-mingw32-windres \ DllWrap=i686-w64-mingw32-dllwrap As a result build failed as POSIX bits of RTS. For example 'rts/posix/OSMem.c' contains unix-specific mmap() syscalls and constants and thus can't be compiled by i686-w64-mingw32 toolchain. It's caused by the following part of 'rts/ghc.mk': ifeq "$(HostOS_CPP)" "mingw32" ALL_DIRS += win32 else ALL_DIRS += posix endif In our case _CPP variables are defined this way (project.mk): BuildOS_CPP = linux HostOS_CPP = linux TargetOS_CPP = mingw32 RTS should never be built for 'BuildOS' or 'HostOS' as it's always built by ghc-stage1 (targeted at TargetOS). The change is to flip 'HostOS_CPP' to 'TargetOS_CPP' in 'rts/ghc.mk'. Signed-off-by: Sergei Trofimovich >--------------------------------------------------------------- 745032dd02da511067c2939259ed212852187e0f rts/ghc.mk | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rts/ghc.mk b/rts/ghc.mk index b756d94..4842c34 100644 --- a/rts/ghc.mk +++ b/rts/ghc.mk @@ -39,7 +39,7 @@ $(eval $(call all-target,rts,$(ALL_RTS_LIBS))) ALL_DIRS = hooks sm eventlog linker -ifeq "$(HostOS_CPP)" "mingw32" +ifeq "$(TargetOS_CPP)" "mingw32" ALL_DIRS += win32 else ALL_DIRS += posix @@ -92,7 +92,7 @@ rts/dist/libs.depend : $$(ghc-pkg_INPLACE) | $$(dir $$@)/. # These are made from rts/win32/libHS*.def which contain lists of # all the symbols in those libraries used by the RTS. # -ifeq "$(HostOS_CPP)" "mingw32" +ifeq "$(TargetOS_CPP)" "mingw32" ALL_RTS_DEF_LIBNAMES = base ghc-prim ALL_RTS_DEF_LIBS = \ @@ -116,7 +116,7 @@ endif ifneq "$(BINDIST)" "YES" ifneq "$(UseSystemLibFFI)" "YES" -ifeq "$(HostOS_CPP)" "mingw32" +ifeq "$(TargetOS_CPP)" "mingw32" rts/dist/build/$(LIBFFI_DLL): libffi/build/inst/bin/$(LIBFFI_DLL) cp $< $@ else @@ -147,7 +147,7 @@ rts_dist_$1_CC_OPTS += -fno-omit-frame-pointer -g -O0 endif ifneq "$$(findstring dyn, $1)" "" -ifeq "$$(HostOS_CPP)" "mingw32" +ifeq "$$(TargetOS_CPP)" "mingw32" rts_dist_$1_CC_OPTS += -DCOMPILING_WINDOWS_DLL endif rts_dist_$1_CC_OPTS += -DDYNAMIC @@ -197,7 +197,7 @@ endif # Making a shared library for the RTS. ifneq "$$(findstring dyn, $1)" "" -ifeq "$$(HostOS_CPP)" "mingw32" +ifeq "$$(TargetOS_CPP)" "mingw32" $$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(ALL_RTS_DEF_LIBS) rts/dist/libs.depend rts/dist/build/$$(LIBFFI_DLL) "$$(RM)" $$(RM_OPTS) $$@ "$$(rts_dist_HC)" -this-unit-id rts -shared -dynamic -dynload deploy \ From git at git.haskell.org Sun Apr 23 12:55:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 23 Apr 2017 12:55:04 +0000 (UTC) Subject: [commit: ghc] master: configure.ac: print paths to dllwrap and windres (58a6569) Message-ID: <20170423125504.581143A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/58a656956f707719a76654f7f2c45e8b8a108c9b/ghc >--------------------------------------------------------------- commit 58a656956f707719a76654f7f2c45e8b8a108c9b Author: Sergei Trofimovich Date: Sun Apr 23 11:22:44 2017 +0100 configure.ac: print paths to dllwrap and windres Signed-off-by: Sergei Trofimovich >--------------------------------------------------------------- 58a656956f707719a76654f7f2c45e8b8a108c9b configure.ac | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure.ac b/configure.ac index 83e692f..5606080 100644 --- a/configure.ac +++ b/configure.ac @@ -1242,6 +1242,8 @@ echo "\ nm : $NmCmd objdump : $ObjdumpCmd ranlib : $RanlibCmd + windres : $Windres + dllwrap : $DllWrap Happy : $HappyCmd ($HappyVersion) Alex : $AlexCmd ($AlexVersion) Perl : $PerlCmd From git at git.haskell.org Sun Apr 23 13:32:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 23 Apr 2017 13:32:36 +0000 (UTC) Subject: [commit: ghc] master: Minor reordering of `#include`s fixing compilation on AIX (0d975a6) Message-ID: <20170423133236.786763A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0d975a623d6ad51ceb34bdb218a2d0f4a0448de6/ghc >--------------------------------------------------------------- commit 0d975a623d6ad51ceb34bdb218a2d0f4a0448de6 Author: Herbert Valerio Riedel Date: Sun Apr 23 15:28:52 2017 +0200 Minor reordering of `#include`s fixing compilation on AIX This helps ensure that system includes on some more fragile platforms (like e.g. AIX) see a more consistent set of CPP defines, and consequently reduce the risk of conflicting typdefs/prototypes being exposed. >--------------------------------------------------------------- 0d975a623d6ad51ceb34bdb218a2d0f4a0448de6 rts/PathUtils.c | 6 +++--- rts/linker/LoadArchive.c | 5 ++--- rts/sm/CNF.c | 3 ++- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/rts/PathUtils.c b/rts/PathUtils.c index f27e03f..1b0b729 100644 --- a/rts/PathUtils.c +++ b/rts/PathUtils.c @@ -1,10 +1,10 @@ -#include -#include - #include #include "RtsUtils.h" #include "PathUtils.h" +#include +#include + #include #include diff --git a/rts/linker/LoadArchive.c b/rts/linker/LoadArchive.c index c83b3ba..006d63d 100644 --- a/rts/linker/LoadArchive.c +++ b/rts/linker/LoadArchive.c @@ -1,6 +1,3 @@ -#include -#include - #include #include "PathUtils.h" @@ -20,6 +17,8 @@ # include #endif +#include +#include #include #define FAIL(...) do {\ diff --git a/rts/sm/CNF.c b/rts/sm/CNF.c index 624dba3..ed9460e 100644 --- a/rts/sm/CNF.c +++ b/rts/sm/CNF.c @@ -11,7 +11,6 @@ #define _GNU_SOURCE #include "PosixSource.h" -#include #include "Rts.h" #include "RtsUtils.h" @@ -25,6 +24,8 @@ #include "Trace.h" #include "sm/ShouldCompact.h" +#include + #ifdef HAVE_UNISTD_H #include #endif From git at git.haskell.org Sun Apr 23 13:42:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 23 Apr 2017 13:42:54 +0000 (UTC) Subject: [commit: ghc] master: Fix compilation for !HAVE_FLOCK (2fa6873) Message-ID: <20170423134254.A03473A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2fa6873faf16a0f3b23742222a00f0647554395b/ghc >--------------------------------------------------------------- commit 2fa6873faf16a0f3b23742222a00f0647554395b Author: Herbert Valerio Riedel Date: Sun Apr 23 15:41:50 2017 +0200 Fix compilation for !HAVE_FLOCK >--------------------------------------------------------------- 2fa6873faf16a0f3b23742222a00f0647554395b libraries/base/GHC/IO/Handle/Lock.hsc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libraries/base/GHC/IO/Handle/Lock.hsc b/libraries/base/GHC/IO/Handle/Lock.hsc index b2c64c4..ec62f86 100644 --- a/libraries/base/GHC/IO/Handle/Lock.hsc +++ b/libraries/base/GHC/IO/Handle/Lock.hsc @@ -47,6 +47,10 @@ import GHC.IO.Handle.FD import GHC.Ptr import GHC.Windows +#else + +import GHC.IO (throwIO) + #endif import Data.Functor From git at git.haskell.org Sun Apr 23 14:20:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 23 Apr 2017 14:20:09 +0000 (UTC) Subject: [commit: ghc] master: ghc: tweak cross-compilation to mingw32 (8908ba3) Message-ID: <20170423142009.7DE9B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8908ba31c4dcb6ce619ec46e88fbbac78651a04b/ghc >--------------------------------------------------------------- commit 8908ba31c4dcb6ce619ec46e88fbbac78651a04b Author: Sergei Trofimovich Date: Sun Apr 23 15:10:26 2017 +0100 ghc: tweak cross-compilation to mingw32 The build failure when cross-compiling from linux to windows looks like: HC [stage 1] ghc/stage2/build/tmp/ghc-stage2.exe Call hs_init_ghc() from your main() function to set these options. /usr/libexec/gcc/i686-w64-mingw32/ld: cannot find -lHSghc-8.3-0 Similar to commit 745032dd02da511067c2939259ed212852187e0f ("rts: tweak cross-compilation to mingw32") decision to split stage2 should be done based based on TargetOS, not HostOS. Signed-off-by: Sergei Trofimovich >--------------------------------------------------------------- 8908ba31c4dcb6ce619ec46e88fbbac78651a04b rules/build-package-way.mk | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rules/build-package-way.mk b/rules/build-package-way.mk index f230ef5..7775856 100644 --- a/rules/build-package-way.mk +++ b/rules/build-package-way.mk @@ -27,7 +27,7 @@ $1_$2_$3_LIB_FILE = libHS$$($1_$2_COMPONENT_ID)$$($3_libsuf) $1_$2_$3_LIB = $1/$2/build/$$($1_$2_$3_LIB_FILE) $$($1_$2_COMPONENT_ID)_$2_$3_LIB = $$($1_$2_$3_LIB) -ifeq "$$(HostOS_CPP)" "mingw32" +ifeq "$$(TargetOS_CPP)" "mingw32" ifneq "$$($1_$2_dll0_HS_OBJS)" "" $1_$2_$3_LIB0_ROOT = HS$$($1_$2_COMPONENT_ID)-0$$($3_libsuf) $1_$2_$3_LIB0_NAME = lib$$($1_$2_$3_LIB0_ROOT) @@ -75,7 +75,7 @@ $1/$2/dll-split.stamp: $$($1_$2_depfile_haskell) $$$$(dll-split_INPLACE) # Link a dynamic library # On windows we have to supply the extra libs this one links to when building it. -ifeq "$$(HostOS_CPP)" "mingw32" +ifeq "$$(TargetOS_CPP)" "mingw32" $$($1_$2_$3_LIB) : $$($1_$2_$3_ALL_OBJS) $$(ALL_RTS_LIBS) $$($1_$2_$3_DEPS_LIBS) ifneq "$$($1_$2_$3_LIB0)" "" $$(call build-dll,$1,$2,$3,-L$1/$2/build -l$$($1_$2_$3_LIB0_ROOT),$$(filter-out $$($1_$2_dll0_HS_OBJS),$$($1_$2_$3_HS_OBJS)) $$($1_$2_$3_NON_HS_OBJS),$$@) @@ -89,14 +89,14 @@ $$($1_$2_$3_LIB0) : $$($1_$2_$3_ALL_OBJS) $$(ALL_RTS_LIBS) $$($1_$2_$3_DEPS_LIBS $$(call build-dll,$1,$2,$3,,$$($1_$2_dll0_HS_OBJS) $$($1_$2_$3_NON_HS_OBJS),$$($1_$2_$3_LIB0)) endif -else # ifneq "$$(HostOS_CPP)" "mingw32" +else # ifneq "$$(TargetOS_CPP)" "mingw32" $$($1_$2_$3_LIB) : $$($1_$2_$3_ALL_OBJS) $$(ALL_RTS_LIBS) $$($1_$2_$3_DEPS_LIBS) $$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) $$($1_$2_$3_GHC_LD_OPTS) $$($1_$2_$3_ALL_OBJS) \ -shared -dynamic -dynload deploy \ $$(addprefix -l,$$($1_$2_EXTRA_LIBRARIES)) $$(addprefix -L,$$($1_$2_EXTRA_LIBDIRS)) \ -no-auto-link-packages \ -o $$@ -endif # "$$(HostOS_CPP)" "mingw32" +endif # "$$(TargetOS_CPP)" "mingw32" else # ifneq "$3" "dyn" @@ -116,7 +116,7 @@ else endif $$(call removeFiles,$$@.contents) -ifeq "$$(HostOS_CPP)" "mingw32" +ifeq "$$(TargetOS_CPP)" "mingw32" ifneq "$$($1_$2_$3_LIB0)" "" $$($1_$2_$3_LIB) : $$($1_$2_$3_LIB0) $$($1_$2_$3_LIB0) : From git at git.haskell.org Sun Apr 23 14:40:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 23 Apr 2017 14:40:18 +0000 (UTC) Subject: [commit: ghc] master: ghc.mk: fix 'make install' for cross-mingw32 (74e5ec9) Message-ID: <20170423144018.1725C3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/74e5ec9e63ff40bb8d52041cdc2f602d9bf12eb8/ghc >--------------------------------------------------------------- commit 74e5ec9e63ff40bb8d52041cdc2f602d9bf12eb8 Author: Sergei Trofimovich Date: Sun Apr 23 15:31:13 2017 +0100 ghc.mk: fix 'make install' for cross-mingw32 Attempt to install cross-compiled mingw32 GHC built on linux failed as: $ make install DESTDIR=$(pwd)/__i__ "mv" "$(pwd)/__i__/usr/local/lib/ghc-8.3.20170422/bin/ghc-stage2" \ "$(pwd)/__i__/usr/local/lib/ghc-8.3.20170422/bin/ghc" mv: failed to stat '$(pwd)/__i__/usr/local/lib/ghc-8.3.20170422/bin/ghc-stage2': \ No such file or directory The rename should not be performed for windows targets. Signed-off-by: Sergei Trofimovich >--------------------------------------------------------------- 74e5ec9e63ff40bb8d52041cdc2f602d9bf12eb8 ghc.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ghc.mk b/ghc.mk index d1dbb9e..a6354ad 100644 --- a/ghc.mk +++ b/ghc.mk @@ -924,7 +924,7 @@ ifneq "$(INSTALL_LIBEXECS)" "" done # We rename ghc-stage2, so that the right program name is used in error # messages etc. -ifeq "$(Windows_Host)" "NO" +ifeq "$(Windows_Target)" "NO" "$(MV)" "$(DESTDIR)$(ghclibexecdir)/bin/ghc-stage$(INSTALL_GHC_STAGE)" "$(DESTDIR)$(ghclibexecdir)/bin/ghc" endif endif From git at git.haskell.org Sun Apr 23 15:06:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 23 Apr 2017 15:06:10 +0000 (UTC) Subject: [commit: ghc] master: win32/Ticker: Stop ticker on exit (87fbf39) Message-ID: <20170423150610.6B6733A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/87fbf39a61d2535a172fbcecec098730eba1777f/ghc >--------------------------------------------------------------- commit 87fbf39a61d2535a172fbcecec098730eba1777f Author: Ben Gamari Date: Sat Apr 22 09:33:31 2017 -0400 win32/Ticker: Stop ticker on exit While debugging an unrelated issue I noticed that we leak a TimerQueueTimer on exit since we don't necessarily call stopTicker before exitTicker. Fix this. Test Plan: Validate on Windows Reviewers: simonmar, austin, erikd Reviewed By: simonmar Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3477 >--------------------------------------------------------------- 87fbf39a61d2535a172fbcecec098730eba1777f rts/win32/Ticker.c | 1 + 1 file changed, 1 insertion(+) diff --git a/rts/win32/Ticker.c b/rts/win32/Ticker.c index 7bc5ed5..27c9070 100644 --- a/rts/win32/Ticker.c +++ b/rts/win32/Ticker.c @@ -73,6 +73,7 @@ stopTicker(void) void exitTicker (bool wait) { + stopTicker(); if (timer_queue != NULL) { DeleteTimerQueueEx(timer_queue, wait ? INVALID_HANDLE_VALUE : NULL); timer_queue = NULL; From git at git.haskell.org Sun Apr 23 15:06:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 23 Apr 2017 15:06:13 +0000 (UTC) Subject: [commit: ghc] master: Document the kind generalization behavior observed in #13555 (18c3a7e) Message-ID: <20170423150613.BDCEF3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/18c3a7ea0f7577514721feadefd9a62c228edb60/ghc >--------------------------------------------------------------- commit 18c3a7ea0f7577514721feadefd9a62c228edb60 Author: Ryan Scott Date: Sun Apr 23 10:02:45 2017 -0400 Document the kind generalization behavior observed in #13555 The conclusion of #13555 was that a program which began to fail to typecheck (starting in GHC 8.2) was never correct to begin with. Let's document why this is the case with respect to `MonoLocalBinds`' interaction with kind generalization. Also adds the reported program as a `compile_fail` testcase. Test Plan: make test TEST=T13555 # Also, read the docs Reviewers: goldfire, simonpj, austin, bgamari Reviewed By: goldfire, simonpj, bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #13555 Differential Revision: https://phabricator.haskell.org/D3472 >--------------------------------------------------------------- 18c3a7ea0f7577514721feadefd9a62c228edb60 docs/users_guide/8.2.1-notes.rst | 5 ++++ docs/users_guide/glasgow_exts.rst | 43 +++++++++++++++++++++++++++++++++ testsuite/tests/polykinds/T13555.hs | 26 ++++++++++++++++++++ testsuite/tests/polykinds/T13555.stderr | 40 ++++++++++++++++++++++++++++++ testsuite/tests/polykinds/all.T | 1 + 5 files changed, 115 insertions(+) diff --git a/docs/users_guide/8.2.1-notes.rst b/docs/users_guide/8.2.1-notes.rst index 37fdabb..3b1a1f1 100644 --- a/docs/users_guide/8.2.1-notes.rst +++ b/docs/users_guide/8.2.1-notes.rst @@ -196,6 +196,11 @@ Compiler See the section on `associated type family instances ` for more information. +- A bug involving the interaction between :ghc-flag:`-XMonoLocalBinds` and + :ghc-flag:`-XPolyKinds` has been fixed. This can cause some programs to fail + to typecheck in case explicit kind signatures are not provided. See + :ref:`kind-generalisation` for an example. + GHCi ~~~~ diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index 40e3f82..c45fbec 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -9332,6 +9332,49 @@ and :ghc-flag:`-XGADTs`. You can switch it off again with :ghc-flag:`-XNoMonoLocalBinds <-XMonoLocalBinds>` but type inference becomes less predicatable if you do so. (Read the papers!) +.. _kind-generalisation: + +Kind generalisation +------------------- + +Just as :ghc-flag:`-XMonoLocalBinds` places limitations on when the *type* of a +*term* is generalised (see :ref:`mono-local-binds`), it also limits when the +*kind* of a *type signature* is generalised. Here is an example involving +:ref:`type signatures on instance declarations `: :: + + data Proxy a = Proxy + newtype Tagged s b = Tagged b + + class C b where + c :: forall (s :: k). Tagged s b + + instance C (Proxy a) where + c :: forall s. Tagged s (Proxy a) + c = Tagged Proxy + +With :ghc-flag:`-XMonoLocalBinds` enabled, this ``C (Proxy a)`` instance will +fail to typecheck. The reason is that the type signature for ``c`` captures +``a``, an outer-scoped type variable, which means the type signature is not +closed. Therefore, the inferred kind for ``s`` will *not* be generalised, and +as a result, it will fail to unify with the kind variable ``k`` which is +specified in the declaration of ``c``. This can be worked around by specifying +an explicit kind variable for ``s``, e.g., :: + + instance C (Proxy a) where + c :: forall (s :: k). Tagged s (Proxy a) + c = Tagged Proxy + +or, alternatively: :: + + instance C (Proxy a) where + c :: forall k (s :: k). Tagged s (Proxy a) + c = Tagged Proxy + +This declarations are equivalent using Haskell's implicit "add implicit +foralls" rules (see :ref:`implicit-quantification`). The implicit foralls rules +are purely syntactic and are quite separate from the kind generalisation +described here. + .. _visible-type-application: Visible type application diff --git a/testsuite/tests/polykinds/T13555.hs b/testsuite/tests/polykinds/T13555.hs new file mode 100644 index 0000000..e71023e --- /dev/null +++ b/testsuite/tests/polykinds/T13555.hs @@ -0,0 +1,26 @@ +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE InstanceSigs #-} +{-# LANGUAGE MonoLocalBinds #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE PolyKinds #-} +{-# LANGUAGE RankNTypes #-} +module T13555 where + +import Data.Functor.Identity (Identity(..)) + +data T a +type Polynomial a = T a +newtype GF fp d = GF (Polynomial fp) +type CRTInfo r = (Int -> r, r) +type Tagged s b = TaggedT s Identity b +newtype TaggedT s m b = TagT { untagT :: m b } + +class Reflects a i where + value :: Tagged a i + +class CRTrans mon r where + crtInfo :: Reflects m Int => TaggedT m mon (CRTInfo r) + +instance CRTrans Maybe (GF fp d) where + crtInfo :: forall m . (Reflects m Int) => TaggedT m Maybe (CRTInfo (GF fp d)) + crtInfo = undefined diff --git a/testsuite/tests/polykinds/T13555.stderr b/testsuite/tests/polykinds/T13555.stderr new file mode 100644 index 0000000..eaea033 --- /dev/null +++ b/testsuite/tests/polykinds/T13555.stderr @@ -0,0 +1,40 @@ + +T13555.hs:25:14: error: + • Couldn't match type ‘k0’ with ‘k2’ + because type variable ‘k2’ would escape its scope + This (rigid, skolem) type variable is bound by + the type signature for: + crtInfo :: forall k2 (m :: k2). + Reflects m Int => + TaggedT m Maybe (CRTInfo (GF fp d)) + at T13555.hs:25:14-79 + Expected type: TaggedT m Maybe (CRTInfo (GF fp d)) + Actual type: TaggedT m Maybe (CRTInfo (GF fp d)) + • When checking that instance signature for ‘crtInfo’ + is more general than its signature in the class + Instance sig: forall (m :: k0). + Reflects m Int => + TaggedT m Maybe (CRTInfo (GF fp d)) + Class sig: forall k2 (m :: k2). + Reflects m Int => + TaggedT m Maybe (CRTInfo (GF fp d)) + In the instance declaration for ‘CRTrans Maybe (GF fp d)’ + +T13555.hs:25:14: error: + • Could not deduce (Reflects m Int) + from the context: Reflects m Int + bound by the type signature for: + crtInfo :: forall k2 (m :: k2). + Reflects m Int => + TaggedT m Maybe (CRTInfo (GF fp d)) + at T13555.hs:25:14-79 + The type variable ‘k0’ is ambiguous + • When checking that instance signature for ‘crtInfo’ + is more general than its signature in the class + Instance sig: forall (m :: k0). + Reflects m Int => + TaggedT m Maybe (CRTInfo (GF fp d)) + Class sig: forall k2 (m :: k2). + Reflects m Int => + TaggedT m Maybe (CRTInfo (GF fp d)) + In the instance declaration for ‘CRTrans Maybe (GF fp d)’ diff --git a/testsuite/tests/polykinds/all.T b/testsuite/tests/polykinds/all.T index eb5b09a..e534e08 100644 --- a/testsuite/tests/polykinds/all.T +++ b/testsuite/tests/polykinds/all.T @@ -159,3 +159,4 @@ test('T13394a', normal, compile, ['']) test('T13394', normal, compile, ['']) test('T13371', normal, compile, ['']) test('T13393', normal, compile_fail, ['']) +test('T13555', normal, compile_fail, ['']) From git at git.haskell.org Sun Apr 23 15:06:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 23 Apr 2017 15:06:16 +0000 (UTC) Subject: [commit: ghc] master: [linker] Adds ElfTypes (e5e8646) Message-ID: <20170423150616.ED1103A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e5e8646d3c6af82549b55fbee6764b087144a7ec/ghc >--------------------------------------------------------------- commit e5e8646d3c6af82549b55fbee6764b087144a7ec Author: Moritz Angermann Date: Sun Apr 23 10:02:02 2017 -0400 [linker] Adds ElfTypes This diff introduces ElfTypes similar to provide the linker code with a richer data structure, similar to the approach taken for mach-o already. Reviewers: bgamari, austin, erikd, simonmar Reviewed By: simonmar Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3445 >--------------------------------------------------------------- e5e8646d3c6af82549b55fbee6764b087144a7ec rts/LinkerInternals.h | 15 +++-- rts/linker/Elf.c | 95 +++++----------------------- rts/linker/ElfTypes.h | 171 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 195 insertions(+), 86 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc e5e8646d3c6af82549b55fbee6764b087144a7ec From git at git.haskell.org Sun Apr 23 15:06:19 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 23 Apr 2017 15:06:19 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Increase T13056 window size to +/-10% (3efa5be) Message-ID: <20170423150619.A3F6D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3efa5be4f343716fbeda524451aca5a03de3e2b6/ghc >--------------------------------------------------------------- commit 3efa5be4f343716fbeda524451aca5a03de3e2b6 Author: Ben Gamari Date: Sat Apr 22 10:18:23 2017 -0400 testsuite: Increase T13056 window size to +/-10% >--------------------------------------------------------------- 3efa5be4f343716fbeda524451aca5a03de3e2b6 testsuite/tests/perf/compiler/all.T | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index 0bbc479..ec41b4d 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -1051,12 +1051,13 @@ test('T13035', test('T13056', [ only_ways(['optasm']), compiler_stats_num_field('bytes allocated', - [(wordsize(64), 440548592, 5), + [(wordsize(64), 440548592, 10), # 2017-01-06 520166912 initial # 2017-01-31 546800240 Join points (#12988) # 2017-02-07 524611224 new SetLevels # 2017-02-14 440548592 Early inline patch: 16% improvement - # 2017-04-21 417860736 Unknown + # 2017-04-21 417860736 (darwin) + # 2017-04-22 Increase to +/- 10% (Darwin and Linux differ significantly) ]), ], compile, From git at git.haskell.org Sun Apr 23 15:06:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 23 Apr 2017 15:06:22 +0000 (UTC) Subject: [commit: ghc] master: cpp: Use #pragma once instead of #ifndef guards (f13eebc) Message-ID: <20170423150622.7C9463A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f13eebcc9b1407e5aeaf010536fcb5e469dbfe71/ghc >--------------------------------------------------------------- commit f13eebcc9b1407e5aeaf010536fcb5e469dbfe71 Author: Ben Gamari Date: Sat Apr 22 09:34:18 2017 -0400 cpp: Use #pragma once instead of #ifndef guards This both says what we mean and silences a bunch of spurious CPP linting warnings. This pragma is supported by all CPP implementations which we support. Reviewers: austin, erikd, simonmar, hvr Reviewed By: simonmar Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3482 >--------------------------------------------------------------- f13eebcc9b1407e5aeaf010536fcb5e469dbfe71 compiler/HsVersions.h | 6 +----- compiler/nativeGen/NCG.h | 5 +---- compiler/utils/md5.h | 8 +------- driver/utils/isMinTTY.h | 5 +---- includes/Cmm.h | 5 +---- includes/HsFFI.h | 5 +---- includes/MachDeps.h | 5 +---- includes/Rts.h | 5 +---- includes/RtsAPI.h | 5 +---- includes/Stg.h | 5 +---- includes/ghcconfig.h | 5 +---- includes/rts/Adjustor.h | 5 +---- includes/rts/BlockSignals.h | 5 +---- includes/rts/Config.h | 5 +---- includes/rts/Constants.h | 5 +---- includes/rts/EventLogFormat.h | 5 +---- includes/rts/EventLogWriter.h | 5 +---- includes/rts/FileLock.h | 5 +---- includes/rts/Flags.h | 5 +---- includes/rts/GetTime.h | 5 +---- includes/rts/Globals.h | 5 +---- includes/rts/Hpc.h | 5 +---- includes/rts/IOManager.h | 5 +---- includes/rts/Libdw.h | 7 +------ includes/rts/LibdwPool.h | 5 +---- includes/rts/Linker.h | 5 +---- includes/rts/Main.h | 5 +---- includes/rts/Messages.h | 5 +---- includes/rts/OSThreads.h | 5 +---- includes/rts/Parallel.h | 5 +---- includes/rts/PrimFloat.h | 5 +---- includes/rts/Signals.h | 5 +---- includes/rts/SpinLock.h | 6 +----- includes/rts/Stable.h | 5 +---- includes/rts/StaticPtrTable.h | 5 +---- includes/rts/TTY.h | 5 +---- includes/rts/Threads.h | 5 +---- includes/rts/Ticky.h | 5 +---- includes/rts/Time.h | 5 +---- includes/rts/Timer.h | 5 +---- includes/rts/Types.h | 5 +---- includes/rts/Utils.h | 5 +---- includes/rts/prof/CCS.h | 5 +---- includes/rts/prof/LDV.h | 5 +---- includes/rts/storage/Block.h | 4 +--- includes/rts/storage/ClosureMacros.h | 5 +---- includes/rts/storage/ClosureTypes.h | 5 +---- includes/rts/storage/Closures.h | 6 +----- includes/rts/storage/FunTypes.h | 5 +---- includes/rts/storage/GC.h | 5 +---- includes/rts/storage/InfoTables.h | 5 +---- includes/rts/storage/MBlock.h | 5 +---- includes/rts/storage/TSO.h | 5 +---- includes/stg/DLL.h | 5 +---- includes/stg/HaskellMachRegs.h | 5 +---- includes/stg/MachRegs.h | 5 +---- includes/stg/MiscClosures.h | 5 +---- includes/stg/Prim.h | 5 +---- includes/stg/Regs.h | 5 +---- includes/stg/RtsMachRegs.h | 5 +---- includes/stg/SMP.h | 5 +---- includes/stg/Ticky.h | 6 +----- includes/stg/Types.h | 5 +---- libraries/base/include/CTypes.h | 5 +---- libraries/base/include/HsBase.h | 6 +----- libraries/base/include/HsEvent.h | 4 +--- libraries/base/include/WCsubst.h | 7 +------ libraries/base/include/consUtils.h | 5 ++--- libraries/base/include/md5.h | 8 +------- libraries/integer-gmp/include/HsIntegerGmp.h.in | 5 +---- rts/Apply.h | 5 +---- rts/Arena.h | 5 +---- rts/AutoApply.h | 6 +----- rts/AwaitEvent.h | 5 +---- rts/Capability.h | 5 +---- rts/CheckUnload.h | 5 +---- rts/Disassembler.h | 5 +---- rts/Excn.h | 6 +----- rts/FileLock.h | 5 +---- rts/GetEnv.h | 5 +---- rts/GetTime.h | 5 +---- rts/Globals.h | 5 +---- rts/Hash.h | 5 +---- rts/Interpreter.h | 5 +---- rts/LdvProfile.h | 5 +---- rts/Libdw.h | 5 +---- rts/LibdwPool.h | 5 +---- rts/LinkerInternals.h | 4 +--- rts/Messages.h | 2 ++ rts/PathUtils.h | 5 +---- rts/PosixSource.h | 5 +---- rts/Prelude.h | 5 +---- rts/Printer.h | 6 +----- rts/ProfHeap.h | 5 +---- rts/ProfilerReport.h | 5 +---- rts/ProfilerReportJson.h | 5 +---- rts/Profiling.h | 5 +---- rts/Proftimer.h | 5 +---- rts/RaiseAsync.h | 5 +---- rts/RetainerProfile.h | 5 +---- rts/RetainerSet.h | 4 +--- rts/RtsFlags.h | 5 +---- rts/RtsSignals.h | 5 +---- rts/RtsSymbolInfo.h | 5 +---- rts/RtsSymbols.h | 5 +---- rts/RtsUtils.h | 5 +---- rts/SMPClosureOps.h | 5 +---- rts/STM.h | 6 +----- rts/Schedule.h | 5 +---- rts/Sparks.h | 5 +---- rts/Stable.h | 5 +---- rts/StaticPtrTable.h | 5 +---- rts/Stats.h | 5 +---- rts/StgPrimFloat.h | 5 +---- rts/StgRun.h | 5 +---- rts/Task.h | 5 +---- rts/ThreadLabels.h | 5 +---- rts/ThreadPaused.h | 5 +---- rts/Threads.h | 5 +---- rts/Ticker.h | 5 +---- rts/Ticky.h | 5 +---- rts/Timer.h | 5 +---- rts/TopHandler.h | 4 ++++ rts/Trace.h | 5 +---- rts/Updates.h | 5 +---- rts/WSDeque.h | 5 +---- rts/Weak.h | 6 +----- rts/eventlog/EventLog.h | 5 +---- rts/hooks/Hooks.h | 5 +---- rts/linker/CacheFlush.h | 5 +---- rts/linker/Elf.h | 5 +---- rts/linker/M32Alloc.h | 5 +---- rts/linker/MachO.h | 5 +---- rts/linker/MachOTypes.h | 4 +--- rts/linker/PEi386.h | 5 +---- rts/linker/SymbolExtras.h | 5 +---- rts/posix/Clock.h | 5 +---- rts/posix/Select.h | 5 +---- rts/posix/Signals.h | 5 +---- rts/posix/TTY.h | 5 +---- rts/sm/BlockAlloc.h | 5 +---- rts/sm/CNF.h | 5 +---- rts/sm/Compact.h | 5 +---- rts/sm/Evac.h | 6 +----- rts/sm/GC.h | 5 +---- rts/sm/GCTDecl.h | 5 +---- rts/sm/GCThread.h | 5 +---- rts/sm/GCUtils.h | 5 +---- rts/sm/HeapAlloc.h | 5 +---- rts/sm/MarkStack.h | 5 +---- rts/sm/MarkWeak.h | 5 +---- rts/sm/OSMem.h | 5 +---- rts/sm/Sanity.h | 5 +---- rts/sm/Scav.h | 6 +----- rts/sm/ShouldCompact.h | 5 +---- rts/sm/Storage.h | 5 +---- rts/sm/Sweep.h | 5 +---- rts/win32/AsyncIO.h | 5 +---- rts/win32/ConsoleHandler.h | 6 ++---- rts/win32/IOManager.h | 5 +---- rts/win32/WorkQueue.h | 6 ++---- rts/win32/veh_excn.h | 6 +----- utils/hp2ps/AreaBelow.h | 5 +---- utils/hp2ps/AuxFile.h | 5 +---- utils/hp2ps/Axes.h | 5 +---- utils/hp2ps/Curves.h | 5 +---- utils/hp2ps/Defines.h | 5 +---- utils/hp2ps/Deviation.h | 5 +---- utils/hp2ps/Dimensions.h | 5 +---- utils/hp2ps/Error.h | 5 +---- utils/hp2ps/HpFile.h | 5 +---- utils/hp2ps/Key.h | 5 +---- utils/hp2ps/Main.h | 5 +---- utils/hp2ps/Marks.h | 5 +---- utils/hp2ps/PsFile.h | 5 +---- utils/hp2ps/Reorder.h | 5 +---- utils/hp2ps/Scale.h | 5 +---- utils/hp2ps/Shade.h | 5 +---- utils/hp2ps/TopTwenty.h | 5 +---- utils/hp2ps/TraceElement.h | 5 +---- utils/hp2ps/Utilities.h | 5 +---- utils/lndir/lndir-Xos.h | 5 +---- utils/lndir/lndir-Xosdefs.h | 5 +---- 183 files changed, 190 insertions(+), 741 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc f13eebcc9b1407e5aeaf010536fcb5e469dbfe71 From git at git.haskell.org Sun Apr 23 15:06:25 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 23 Apr 2017 15:06:25 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Add testcase for #13075 (868bdcc) Message-ID: <20170423150625.B8A473A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/868bdcc8f152935803f6ff133766719ada077bdb/ghc >--------------------------------------------------------------- commit 868bdcc8f152935803f6ff133766719ada077bdb Author: Ben Gamari Date: Sun Apr 23 10:59:02 2017 -0400 testsuite: Add testcase for #13075 >--------------------------------------------------------------- 868bdcc8f152935803f6ff133766719ada077bdb testsuite/tests/typecheck/should_fail/T13075.hs | 7 +++++++ testsuite/tests/typecheck/should_fail/all.T | 1 + 2 files changed, 8 insertions(+) diff --git a/testsuite/tests/typecheck/should_fail/T13075.hs b/testsuite/tests/typecheck/should_fail/T13075.hs new file mode 100644 index 0000000..9c76434 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T13075.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE BangPatterns #-} + +module Main where + +!(Just x) = Nothing + +main = putStrLn "hi there!" diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index fe69ce0..e70f255 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -425,6 +425,7 @@ test('T12921', normal, compile_fail, ['']) test('T12973', normal, compile_fail, ['']) test('StrictBinds', normal, compile_fail, ['']) test('T13068', [extra_files(['T13068.hs', 'T13068a.hs', 'T13068.hs-boot', 'T13068m.hs'])], multimod_compile_fail, ['T13068m', '']) +test('T13075', normal, compile_fail, ['']) test('T13105', normal, compile_fail, ['']) test('LevPolyBounded', normal, compile_fail, ['']) test('T13487', normal, compile, ['']) From git at git.haskell.org Sun Apr 23 15:06:28 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 23 Apr 2017 15:06:28 +0000 (UTC) Subject: [commit: ghc] master: rts: Fix "ASSERT ("s (1d66f10) Message-ID: <20170423150628.73F793A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1d66f1051933ca3dedbf04da9ce38687dbfd8f05/ghc >--------------------------------------------------------------- commit 1d66f1051933ca3dedbf04da9ce38687dbfd8f05 Author: Ben Gamari Date: Sun Apr 23 10:00:19 2017 -0400 rts: Fix "ASSERT ("s Reviewers: austin, erikd, simonmar Reviewed By: erikd Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3486 >--------------------------------------------------------------- 1d66f1051933ca3dedbf04da9ce38687dbfd8f05 rts/Compact.cmm | 8 ++++---- rts/sm/CNF.c | 22 +++++++++++----------- rts/sm/CNF.h | 4 ++-- rts/sm/Sanity.c | 10 +++++----- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/rts/Compact.cmm b/rts/Compact.cmm index 0b98f39..5290d95 100644 --- a/rts/Compact.cmm +++ b/rts/Compact.cmm @@ -358,7 +358,7 @@ stg_compactGetFirstBlockzh ( P_ str ) W_ size; block = str - SIZEOF_StgCompactNFDataBlock::W_; - ASSERT (StgCompactNFDataBlock_owner(block) == str); + ASSERT(StgCompactNFDataBlock_owner(block) == str); // We have to save Hp back to the nursery, otherwise the size will // be wrong. @@ -367,7 +367,7 @@ stg_compactGetFirstBlockzh ( P_ str ) bd = Bdescr(str); size = bdescr_free(bd) - bdescr_start(bd); - ASSERT (size <= TO_W_(bdescr_blocks(bd)) * BLOCK_SIZE); + ASSERT(size <= TO_W_(bdescr_blocks(bd)) * BLOCK_SIZE); return (block, size); } @@ -396,12 +396,12 @@ stg_compactGetNextBlockzh ( P_ str, W_ block ) return (0::W_, 0::W_); } - ASSERT (StgCompactNFDataBlock_owner(next_block) == str || + ASSERT(StgCompactNFDataBlock_owner(next_block) == str || StgCompactNFDataBlock_owner(next_block) == NULL); bd = Bdescr(next_block); size = bdescr_free(bd) - bdescr_start(bd); - ASSERT (size <= TO_W_(bdescr_blocks(bd)) * BLOCK_SIZE); + ASSERT(size <= TO_W_(bdescr_blocks(bd)) * BLOCK_SIZE); return (next_block, size); } diff --git a/rts/sm/CNF.c b/rts/sm/CNF.c index ed9460e..b81fd2b 100644 --- a/rts/sm/CNF.c +++ b/rts/sm/CNF.c @@ -203,8 +203,8 @@ compactAllocateBlockInternal(Capability *cap, block = allocGroup(n_blocks); switch (operation) { case ALLOCATE_NEW: - ASSERT (first == NULL); - ASSERT (g == g0); + ASSERT(first == NULL); + ASSERT(g == g0); dbl_link_onto(block, &g0->compact_objects); g->n_compact_blocks += block->blocks; g->n_new_large_words += aligned_size / sizeof(StgWord); @@ -214,8 +214,8 @@ compactAllocateBlockInternal(Capability *cap, dbl_link_onto(block, &g0->compact_blocks_in_import); /* fallthrough */ case ALLOCATE_IMPORT_APPEND: - ASSERT (first == NULL); - ASSERT (g == g0); + ASSERT(first == NULL); + ASSERT(g == g0); g->n_compact_blocks_in_import += block->blocks; g->n_new_large_words += aligned_size / sizeof(StgWord); break; @@ -307,7 +307,7 @@ countCompactBlocks(bdescr *outer) block = (StgCompactNFDataBlock*)(outer->start); do { inner = Bdescr((P_)block); - ASSERT (inner->flags & BF_COMPACT); + ASSERT(inner->flags & BF_COMPACT); count += inner->blocks; block = block->next; @@ -335,7 +335,7 @@ countAllocdCompactBlocks(bdescr *outer) block = (StgCompactNFDataBlock*)(outer->start); do { inner = Bdescr((P_)block); - ASSERT (inner->flags & BF_COMPACT); + ASSERT(inner->flags & BF_COMPACT); count += inner->blocks; // See BlockAlloc.c:countAllocdBlocks() @@ -407,13 +407,13 @@ compactAppendBlock (Capability *cap, block->owner = str; block->next = NULL; - ASSERT (str->last->next == NULL); + ASSERT(str->last->next == NULL); str->last->next = block; str->last = block; bd = Bdescr((P_)block); bd->free = (StgPtr)((W_)block + sizeof(StgCompactNFDataBlock)); - ASSERT (bd->free == (StgPtr)block + sizeofW(StgCompactNFDataBlock)); + ASSERT(bd->free == (StgPtr)block + sizeofW(StgCompactNFDataBlock)); str->totalW += bd->blocks * BLOCK_SIZE_W; @@ -920,7 +920,7 @@ fixup_block(StgCompactNFDataBlock *block, StgWord *fixup_table, uint32_t count) bd = Bdescr((P_)block); p = bd->start + sizeofW(StgCompactNFDataBlock); while (p < bd->free) { - ASSERT (LOOKS_LIKE_CLOSURE_PTR(p)); + ASSERT(LOOKS_LIKE_CLOSURE_PTR(p)); info = get_itbl((StgClosure*)p); switch (info->type) { @@ -1163,8 +1163,8 @@ compactFixupPointers(StgCompactNFData *str, total_blocks = str->totalW / BLOCK_SIZE_W; ACQUIRE_SM_LOCK; - ASSERT (bd->gen == g0); - ASSERT (g0->n_compact_blocks_in_import >= total_blocks); + ASSERT(bd->gen == g0); + ASSERT(g0->n_compact_blocks_in_import >= total_blocks); g0->n_compact_blocks_in_import -= total_blocks; g0->n_compact_blocks += total_blocks; dbl_link_remove(bd, &g0->compact_blocks_in_import); diff --git a/rts/sm/CNF.h b/rts/sm/CNF.h index a01c153..c4655dc 100644 --- a/rts/sm/CNF.h +++ b/rts/sm/CNF.h @@ -48,14 +48,14 @@ INLINE_HEADER StgCompactNFDataBlock *objectGetCompactBlock (StgClosure *closure) object_block = Bdescr((StgPtr)closure); - ASSERT ((object_block->flags & BF_COMPACT) != 0); + ASSERT((object_block->flags & BF_COMPACT) != 0); if (object_block->blocks == 0) head_block = object_block->link; else head_block = object_block; - ASSERT ((head_block->flags & BF_COMPACT) != 0); + ASSERT((head_block->flags & BF_COMPACT) != 0); return (StgCompactNFDataBlock*)(head_block->start); } diff --git a/rts/sm/Sanity.c b/rts/sm/Sanity.c index 625b12e..2b91540 100644 --- a/rts/sm/Sanity.c +++ b/rts/sm/Sanity.c @@ -484,22 +484,22 @@ checkCompactObjects(bdescr *bd) StgCompactNFData *str; StgWord totalW; - ASSERT (bd->flags & BF_COMPACT); + ASSERT(bd->flags & BF_COMPACT); block = (StgCompactNFDataBlock*)bd->start; str = block->owner; - ASSERT ((W_)str == (W_)block + sizeof(StgCompactNFDataBlock)); + ASSERT((W_)str == (W_)block + sizeof(StgCompactNFDataBlock)); totalW = 0; for ( ; block ; block = block->next) { last = block; - ASSERT (block->owner == str); + ASSERT(block->owner == str); totalW += Bdescr((P_)block)->blocks * BLOCK_SIZE_W; } - ASSERT (str->totalW == totalW); - ASSERT (str->last == last); + ASSERT(str->totalW == totalW); + ASSERT(str->last == last); } } From git at git.haskell.org Sun Apr 23 15:06:31 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 23 Apr 2017 15:06:31 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Add testcase for #13587 (907b0f3) Message-ID: <20170423150631.E352D3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/907b0f3da6f8fafaa39caba92a5611040f5de786/ghc >--------------------------------------------------------------- commit 907b0f3da6f8fafaa39caba92a5611040f5de786 Author: Ben Gamari Date: Sun Apr 23 10:04:03 2017 -0400 testsuite: Add testcase for #13587 Test Plan: Validate Reviewers: austin Subscribers: rwbarton, thomie GHC Trac Issues: #13587 Differential Revision: https://phabricator.haskell.org/D3474 >--------------------------------------------------------------- 907b0f3da6f8fafaa39caba92a5611040f5de786 testsuite/tests/th/T13587.hs | 12 ++++++++++++ testsuite/tests/th/T13587A.hs | 14 ++++++++++++++ testsuite/tests/th/all.T | 1 + 3 files changed, 27 insertions(+) diff --git a/testsuite/tests/th/T13587.hs b/testsuite/tests/th/T13587.hs new file mode 100644 index 0000000..2986fd2 --- /dev/null +++ b/testsuite/tests/th/T13587.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE TemplateHaskell #-} + +import T13587A + +main :: IO () +main = do + let sin' = $$(importDoubleToDouble "sin") + cos' = $$(importDoubleToDouble "cos") + -- + print (sin' 0) + print (cos' pi) + diff --git a/testsuite/tests/th/T13587A.hs b/testsuite/tests/th/T13587A.hs new file mode 100644 index 0000000..b144cc2 --- /dev/null +++ b/testsuite/tests/th/T13587A.hs @@ -0,0 +1,14 @@ +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE QuasiQuotes #-} + +module T13587A where + +import Language.Haskell.TH +import Language.Haskell.TH.Syntax + +importDoubleToDouble :: String -> Q (TExp (Double -> Double)) +importDoubleToDouble fname = do + n <- newName fname + d <- forImpD CCall unsafe fname n [t|Double -> Double|] + addTopDecls [d] + unsafeTExpCoerce (varE n) diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index e4d4731..7c98d13 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -381,3 +381,4 @@ test('T13123', normal, compile, ['-v0']) test('T13098', normal, compile, ['-v0']) test('T11046', normal, multimod_compile, ['T11046','-v0']) test('T13366', normal, compile_and_run, ['-lstdc++ -v0']) +test('T13587', expect_broken(13587), compile_and_run, ['-v0']) From git at git.haskell.org Sun Apr 23 15:06:34 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 23 Apr 2017 15:06:34 +0000 (UTC) Subject: [commit: ghc] master: Only build iserv with -threaded if GhcThreaded is set (317ceb4) Message-ID: <20170423150634.A0BBB3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/317ceb41e1efe0566178090fa077c4e6f4f03f10/ghc >--------------------------------------------------------------- commit 317ceb41e1efe0566178090fa077c4e6f4f03f10 Author: Reid Barton Date: Sun Apr 23 10:03:22 2017 -0400 Only build iserv with -threaded if GhcThreaded is set By default GhcThreaded is set by ``` GhcThreaded = $(if $(findstring thr,$(GhcRTSWays)),YES,NO) ``` so it seems incorrect to try to build iserv with -threaded when GhcThreaded is not set. This came up when I was building GHC with some strange combination of flavours (debugged and profiled but not threaded). Test Plan: harbormaster Reviewers: simonmar, austin, bgamari Reviewed By: bgamari Subscribers: thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3429 >--------------------------------------------------------------- 317ceb41e1efe0566178090fa077c4e6f4f03f10 iserv/ghc.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/iserv/ghc.mk b/iserv/ghc.mk index 8497313..ff8b153 100644 --- a/iserv/ghc.mk +++ b/iserv/ghc.mk @@ -20,9 +20,11 @@ iserv_stage2_p_MORE_HC_OPTS += -debug iserv_stage2_dyn_MORE_HC_OPTS += -debug endif +ifeq "$(GhcThreaded)" "YES" iserv_stage2_MORE_HC_OPTS += -threaded iserv_stage2_p_MORE_HC_OPTS += -threaded iserv_stage2_dyn_MORE_HC_OPTS += -threaded +endif # Add -Wl,--export-dynamic enables GHCi to load dynamic objects that # refer to the RTS. This is harmless if you don't use it (adds a bit From git at git.haskell.org Sun Apr 23 15:06:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 23 Apr 2017 15:06:37 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Add test for #13591 (f6eaf01) Message-ID: <20170423150637.CCE7B3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f6eaf01c14960f9d600d5e4c743efc59c37bd4e3/ghc >--------------------------------------------------------------- commit f6eaf01c14960f9d600d5e4c743efc59c37bd4e3 Author: Ben Gamari Date: Sun Apr 23 10:03:46 2017 -0400 testsuite: Add test for #13591 Reviewers: austin Subscribers: rwbarton, thomie GHC Trac Issues: #13591 Differential Revision: https://phabricator.haskell.org/D3470 >--------------------------------------------------------------- f6eaf01c14960f9d600d5e4c743efc59c37bd4e3 testsuite/tests/ghci/scripts/T13591.script | 1 + testsuite/tests/ghci/scripts/T13591A.hs | 4 ++++ testsuite/tests/ghci/scripts/T13591A.hs-boot | 2 ++ testsuite/tests/ghci/scripts/T13591B.hs | 4 ++++ testsuite/tests/ghci/scripts/all.T | 1 + 5 files changed, 12 insertions(+) diff --git a/testsuite/tests/ghci/scripts/T13591.script b/testsuite/tests/ghci/scripts/T13591.script new file mode 100644 index 0000000..1143153 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T13591.script @@ -0,0 +1 @@ +:l T13591A diff --git a/testsuite/tests/ghci/scripts/T13591A.hs b/testsuite/tests/ghci/scripts/T13591A.hs new file mode 100644 index 0000000..4d77e90 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T13591A.hs @@ -0,0 +1,4 @@ +module T13591A where +import Second +one :: Int +one = _ diff --git a/testsuite/tests/ghci/scripts/T13591A.hs-boot b/testsuite/tests/ghci/scripts/T13591A.hs-boot new file mode 100644 index 0000000..7f18059 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T13591A.hs-boot @@ -0,0 +1,2 @@ +module T13591A where +one :: Int diff --git a/testsuite/tests/ghci/scripts/T13591B.hs b/testsuite/tests/ghci/scripts/T13591B.hs new file mode 100644 index 0000000..25f348f --- /dev/null +++ b/testsuite/tests/ghci/scripts/T13591B.hs @@ -0,0 +1,4 @@ +module T13591B where +import {-# SOURCE #-} First +two :: Int +two = one + 1 diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T index cde72e4..16c9ab2 100755 --- a/testsuite/tests/ghci/scripts/all.T +++ b/testsuite/tests/ghci/scripts/all.T @@ -252,3 +252,4 @@ test('T13202', normal, ghci_script, ['T13202.script']) test('T13202a', normal, ghci_script, ['T13202a.script']) test('T13466', normal, ghci_script, ['T13466.script']) test('GhciCurDir', normal, ghci_script, ['GhciCurDir.script']) +test('T13591', expect_broken(13591), ghci_script, ['T13591.script']) From git at git.haskell.org Sun Apr 23 15:06:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 23 Apr 2017 15:06:42 +0000 (UTC) Subject: [commit: ghc] master: [linker] Adds elf_compat.h, util.h, elf_util.h (9eea43f) Message-ID: <20170423150642.3925F3A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9eea43f9528a49194c25889bbfe3b49fe189cc6f/ghc >--------------------------------------------------------------- commit 9eea43f9528a49194c25889bbfe3b49fe189cc6f Author: Moritz Angermann Date: Sun Apr 23 10:02:21 2017 -0400 [linker] Adds elf_compat.h, util.h, elf_util.h Further cleanup of the linker, we'll add elf_compat.h for a more complete set of relocations. Also Util.h has been added as suggested in the code already. Depends on D3444, D3445 Reviewers: bgamari, austin, erikd, simonmar Reviewed By: simonmar Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3446 >--------------------------------------------------------------- 9eea43f9528a49194c25889bbfe3b49fe189cc6f rts/linker/ELFRelocs/AArch64.def | 201 ++++++++++++++++++++++++++++++++++ rts/linker/ELFRelocs/ARM.def | 138 +++++++++++++++++++++++ rts/linker/ELFRelocs/LICENSE-LLVM.TXT | 68 ++++++++++++ rts/linker/ELFRelocs/i386.def | 47 ++++++++ rts/linker/ELFRelocs/x86_64.def | 45 ++++++++ rts/linker/Elf.c | 177 +++++++++++------------------- rts/linker/elf_compat.h | 35 ++++++ rts/linker/elf_util.c | 24 ++++ rts/linker/elf_util.h | 18 +++ rts/linker/util.h | 30 +++++ 10 files changed, 671 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 9eea43f9528a49194c25889bbfe3b49fe189cc6f From git at git.haskell.org Sun Apr 23 16:58:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 23 Apr 2017 16:58:33 +0000 (UTC) Subject: [commit: ghc] master: Export function for use in GHC API (1f4fd37) Message-ID: <20170423165833.472A53A584@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1f4fd37efac4795493677d5df81c83d22eac5f74/ghc >--------------------------------------------------------------- commit 1f4fd37efac4795493677d5df81c83d22eac5f74 Author: Alan Zimmerman Date: Sun Apr 23 18:53:33 2017 +0200 Export function for use in GHC API >--------------------------------------------------------------- 1f4fd37efac4795493677d5df81c83d22eac5f74 compiler/main/GhcMake.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/main/GhcMake.hs b/compiler/main/GhcMake.hs index 25b6467..7cc5276 100644 --- a/compiler/main/GhcMake.hs +++ b/compiler/main/GhcMake.hs @@ -26,7 +26,8 @@ module GhcMake( findExtraSigImports, implicitRequirements, - noModError, cyclicModuleErr + noModError, cyclicModuleErr, + moduleGraphNodes, SummaryNode ) where #include "HsVersions.h" From git at git.haskell.org Sun Apr 23 22:53:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 23 Apr 2017 22:53:20 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Mark T13075 as broken due to #13075 (f799df5) Message-ID: <20170423225320.537B73A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f799df59d5f7e9fb683f2c71e25b65412afc53a7/ghc >--------------------------------------------------------------- commit f799df59d5f7e9fb683f2c71e25b65412afc53a7 Author: Ben Gamari Date: Sun Apr 23 18:52:46 2017 -0400 testsuite: Mark T13075 as broken due to #13075 >--------------------------------------------------------------- f799df59d5f7e9fb683f2c71e25b65412afc53a7 testsuite/tests/typecheck/should_fail/all.T | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index e70f255..c8d5869 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -425,7 +425,7 @@ test('T12921', normal, compile_fail, ['']) test('T12973', normal, compile_fail, ['']) test('StrictBinds', normal, compile_fail, ['']) test('T13068', [extra_files(['T13068.hs', 'T13068a.hs', 'T13068.hs-boot', 'T13068m.hs'])], multimod_compile_fail, ['T13068m', '']) -test('T13075', normal, compile_fail, ['']) +test('T13075', expect_broken(13075), compile_fail, ['']) test('T13105', normal, compile_fail, ['']) test('LevPolyBounded', normal, compile_fail, ['']) test('T13487', normal, compile, ['']) From git at git.haskell.org Mon Apr 24 14:48:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 24 Apr 2017 14:48:53 +0000 (UTC) Subject: [commit: ghc] master: Add regression test for #13603 (ab27fdc) Message-ID: <20170424144853.94DC73A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ab27fdcfe26759f3e4cd7e2105e7e7e83e269e48/ghc >--------------------------------------------------------------- commit ab27fdcfe26759f3e4cd7e2105e7e7e83e269e48 Author: Ryan Scott Date: Mon Apr 24 10:47:51 2017 -0400 Add regression test for #13603 Summary: Commit b207b536ded40156f9adb168565ca78e1eef2c74 (#11714) happened to fix #13603 as well. Let's add a regression test so that it stays fixed. Test Plan: make test TEST=T13603 Reviewers: bgamari, austin, simonpj Reviewed By: bgamari, simonpj Subscribers: simonpj, rwbarton, thomie GHC Trac Issues: #13603 Differential Revision: https://phabricator.haskell.org/D3489 >--------------------------------------------------------------- ab27fdcfe26759f3e4cd7e2105e7e7e83e269e48 testsuite/tests/typecheck/should_compile/T13603.hs | 10 ++++++++++ testsuite/tests/typecheck/should_compile/all.T | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/typecheck/should_compile/T13603.hs b/testsuite/tests/typecheck/should_compile/T13603.hs new file mode 100644 index 0000000..d0c1975 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T13603.hs @@ -0,0 +1,10 @@ +{-# Language PolyKinds, TypeInType, UndecidableInstances #-} +module T13603 where + +import GHC.Exts (TYPE, RuntimeRep) + +class A (a :: TYPE rep) +class A a => B (a :: TYPE rep) + +instance A b => A (a -> (b :: TYPE rep)) +instance B b => B (a -> (b :: TYPE rep)) diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index 9d9e102..fcb80da 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -554,4 +554,4 @@ test('T13474', normal, compile, ['']) test('T13524', normal, compile, ['']) test('T13509', normal, compile, ['']) test('T13526', normal, compile, ['']) - +test('T13603', normal, compile, ['']) From git at git.haskell.org Mon Apr 24 16:53:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 24 Apr 2017 16:53:59 +0000 (UTC) Subject: [commit: ghc] master: Disable terminfo, if we don’t build it. (d5cb4d2) Message-ID: <20170424165359.1B92D3A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d5cb4d2b7fab89ea1c3fc74da2317f86e75816ea/ghc >--------------------------------------------------------------- commit d5cb4d2b7fab89ea1c3fc74da2317f86e75816ea Author: Moritz Angermann Date: Mon Apr 24 09:38:14 2017 -0400 Disable terminfo, if we don’t build it. This is a derivation of a patch from @jophish. This is necessary due to `haskeline`'s `terminfo` flag being marked as `Manual` as of 43d7fa106027fcd4ec7f443923a8dd5b8c169f9c. Reviewers: jophish, bgamari, austin Reviewed By: bgamari Subscribers: rwbarton, thomie, jophish Differential Revision: https://phabricator.haskell.org/D3493 >--------------------------------------------------------------- d5cb4d2b7fab89ea1c3fc74da2317f86e75816ea ghc.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ghc.mk b/ghc.mk index a6354ad..d36e681 100644 --- a/ghc.mk +++ b/ghc.mk @@ -471,7 +471,10 @@ endif ifeq "$(WITH_TERMINFO)" "YES" PACKAGES_STAGE1 += terminfo +else +libraries/haskeline_CONFIGURE_OPTS += --flags=-terminfo endif + PACKAGES_STAGE1 += haskeline PACKAGES_STAGE1 += ghci From git at git.haskell.org Mon Apr 24 16:54:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 24 Apr 2017 16:54:04 +0000 (UTC) Subject: [commit: ghc] master: testsuite/driver: Fix deletion retry logic on Windows (6f9f5ff) Message-ID: <20170424165404.9EA2A3A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6f9f5ff16599814d8b10869be6dd424a5f7645d8/ghc >--------------------------------------------------------------- commit 6f9f5ff16599814d8b10869be6dd424a5f7645d8 Author: Ben Gamari Date: Mon Apr 24 09:41:56 2017 -0400 testsuite/driver: Fix deletion retry logic on Windows Previously rmtree's error callback would throw an exception, breaking out of the retry loop. Test Plan: Validate on Windows Reviewers: Phyx, austin Reviewed By: Phyx Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3492 >--------------------------------------------------------------- 6f9f5ff16599814d8b10869be6dd424a5f7645d8 testsuite/driver/testlib.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index 457e380..1f08f5b 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -767,7 +767,10 @@ def test_common_work(watcher, name, opts, func, args): t.n_tests_skipped += len(set(all_ways) - set(do_ways)) if config.cleanup and do_ways: - cleanup() + try: + cleanup() + except Exception as e: + framework_fail(name, 'runTest', 'Unhandled exception during cleanup: ' + str(e)) package_conf_cache_file_end_timestamp = get_package_cache_timestamp(); @@ -1910,8 +1913,8 @@ if config.msys: import time def cleanup(): testdir = getTestOpts().testdir - max_attemps = 5 - retries = max_attemps + max_attempts = 5 + retries = max_attempts def on_error(function, path, excinfo): # At least one test (T11489) removes the write bit from a file it # produces. Windows refuses to delete read-only files with a @@ -1935,13 +1938,18 @@ if config.msys: # with an even more cryptic error. # # See Trac #13162 + exception = None while retries > 0 and os.path.exists(testdir): - time.sleep((max_attemps-retries)*6) - shutil.rmtree(testdir, onerror=on_error, ignore_errors=False) - retries=-1 + time.sleep((max_attempts-retries)*6) + try: + shutil.rmtree(testdir, onerror=on_error, ignore_errors=False) + except Exception as e: + exception = e + retries -= 1 if retries == 0 and os.path.exists(testdir): - raise Exception("Unable to remove folder '" + testdir + "'. Unable to start current test.") + raise Exception("Unable to remove folder '%s': %s\nUnable to start current test." + % (testdir, exception)) else: def cleanup(): testdir = getTestOpts().testdir From git at git.haskell.org Mon Apr 24 16:54:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 24 Apr 2017 16:54:01 +0000 (UTC) Subject: [commit: ghc] master: compiler/cmm/PprC.hs: constify labels in .rodata (b68697e) Message-ID: <20170424165401.E28B63A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b68697e579d38ca29c2b84377dc2affa04659a28/ghc >--------------------------------------------------------------- commit b68697e579d38ca29c2b84377dc2affa04659a28 Author: Sergei Trofimovich Date: Mon Apr 24 09:41:35 2017 -0400 compiler/cmm/PprC.hs: constify labels in .rodata Consider one-line module module B (v) where v = "hello" in -fvia-C mode it generates code like static char gibberish_str[] = "hello"; It resides in data section (precious resource on ia64!). The patch switches genrator to emit: static const char gibberish_str[] = "hello"; Other types if symbols that gained 'const' qualifier are: - info tables (from haskell and CMM) - static reference tables (from haskell and CMM) Cleanups along the way: - fixed info tables defined in .cmm to reside in .rodata - split out closure declaration into 'IC_' / 'EC_' - added label declaration (based on label type) right before each label definition (based on section type) so that C compiler could check if declaration and definition matches at definition site. Signed-off-by: Sergei Trofimovich Test Plan: ran testsuite on unregisterised x86_64 compiler Reviewers: simonmar, ezyang, austin, bgamari, erikd Reviewed By: bgamari, erikd Subscribers: rwbarton, thomie GHC Trac Issues: #8996 Differential Revision: https://phabricator.haskell.org/D3481 >--------------------------------------------------------------- b68697e579d38ca29c2b84377dc2affa04659a28 compiler/cmm/CLabel.hs | 24 ++++++++++++++ compiler/cmm/Cmm.hs | 13 ++++++++ compiler/cmm/CmmInfo.hs | 2 +- compiler/cmm/PprC.hs | 62 +++++++++++++++++++++++------------- compiler/llvmGen/LlvmCodeGen/Data.hs | 12 ------- includes/Stg.h | 22 +++++++++---- includes/rts/storage/InfoTables.h | 2 +- includes/stg/MiscClosures.h | 14 ++++---- 8 files changed, 102 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 b68697e579d38ca29c2b84377dc2affa04659a28 From git at git.haskell.org Mon Apr 24 17:16:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 24 Apr 2017 17:16:37 +0000 (UTC) Subject: [commit: ghc] master: Add failing test case for T13611 (1c27e5b) Message-ID: <20170424171637.0DD693A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1c27e5b3932cb0b7c3fe2fa3b43a0eae9253b833/ghc >--------------------------------------------------------------- commit 1c27e5b3932cb0b7c3fe2fa3b43a0eae9253b833 Author: Joachim Breitner Date: Mon Apr 24 13:15:47 2017 -0400 Add failing test case for T13611 this program should be rejected, but is not (and segfaults). >--------------------------------------------------------------- 1c27e5b3932cb0b7c3fe2fa3b43a0eae9253b833 testsuite/tests/typecheck/should_fail/T13611.hs | 9 +++++++++ testsuite/tests/typecheck/should_fail/all.T | 1 + 2 files changed, 10 insertions(+) diff --git a/testsuite/tests/typecheck/should_fail/T13611.hs b/testsuite/tests/typecheck/should_fail/T13611.hs new file mode 100644 index 0000000..ea22791 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T13611.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE MagicHash, UnboxedTuples #-} +import GHC.Prim +import GHC.Types + +main = do + let local = () + let null = 0## :: Word# + let triple = (# local, null, null #) + IO (\s -> case mkWeakNoFinalizer# triple () s of (# s, r #) -> (# s, () #)) diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index c8d5869..8bbb671 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -434,3 +434,4 @@ test('T13300', normal, compile_fail, ['']) test('T12709', normal, compile_fail, ['']) test('T13446', normal, compile_fail, ['']) test('T13506', normal, compile_fail, ['']) +test('T13611', expect_broken(13611), compile_fail, ['']) From git at git.haskell.org Mon Apr 24 20:25:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 24 Apr 2017 20:25:02 +0000 (UTC) Subject: [commit: ghc] master: Guard yet another /bin/sh `for in` loop against empty vars (cd10a23) Message-ID: <20170424202502.3BB633A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cd10a23282499b474cedeb4f63f92e70ed9718f3/ghc >--------------------------------------------------------------- commit cd10a23282499b474cedeb4f63f92e70ed9718f3 Author: Herbert Valerio Riedel Date: Mon Apr 24 22:22:32 2017 +0200 Guard yet another /bin/sh `for in` loop against empty vars This is a follow-up to df6794035f1e4397d89896f329525e5368b7d1cc which missed `INSTALL_BINS` >--------------------------------------------------------------- cd10a23282499b474cedeb4f63f92e70ed9718f3 ghc.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ghc.mk b/ghc.mk index d36e681..ce71a55 100644 --- a/ghc.mk +++ b/ghc.mk @@ -907,9 +907,11 @@ endef install_bins: $(INSTALL_BINS) $(INSTALL_SCRIPTS) $(INSTALL_DIR) "$(DESTDIR)$(bindir)" +ifneq "$(INSTALL_BINS)" "" for i in $(INSTALL_BINS); do \ $(INSTALL_PROGRAM) $(INSTALL_BIN_OPTS) $$i "$(DESTDIR)$(bindir)" ; \ done +endif ifneq "$(INSTALL_SCRIPTS)" "" for i in $(INSTALL_SCRIPTS); do \ $(INSTALL_SCRIPT) $(INSTALL_OPTS) $$i "$(DESTDIR)$(bindir)" ; \ From git at git.haskell.org Mon Apr 24 20:34:37 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 24 Apr 2017 20:34:37 +0000 (UTC) Subject: [commit: ghc] master: core-spec: Simplify the handling of LetRec (583fa9e) Message-ID: <20170424203437.94BD43A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/583fa9e3687b49d8c779e6d53a75af9276e4f5cf/ghc >--------------------------------------------------------------- commit 583fa9e3687b49d8c779e6d53a75af9276e4f5cf Author: Joachim Breitner Date: Tue Apr 18 16:33:38 2017 -0400 core-spec: Simplify the handling of LetRec We do not need to keep an enrivonment around to implement letrec, as long as we only do call-by-name. Instead, evaluate letrec by substituting for all the variables with their RHS wrapped in the letrec binding. Since nothing adds to the enrivonment any more, there is no need for a S_Var rule. Differential Revision: https://phabricator.haskell.org/D3466 >--------------------------------------------------------------- 583fa9e3687b49d8c779e6d53a75af9276e4f5cf docs/core-spec/OpSem.ott | 62 +++++++++++++++---------------------------- docs/core-spec/core-spec.mng | 18 +++---------- docs/core-spec/core-spec.pdf | Bin 349621 -> 346103 bytes 3 files changed, 24 insertions(+), 56 deletions(-) diff --git a/docs/core-spec/OpSem.ott b/docs/core-spec/OpSem.ott index b833b74..8fb9b0e 100644 --- a/docs/core-spec/OpSem.ott +++ b/docs/core-spec/OpSem.ott @@ -19,92 +19,72 @@ grammar defns OpSem :: '' ::= -defn S |- e --> e' :: :: step :: 'S_' {{ com Single step semantics }} -{{ tex \begin{array}{l} [[S]] \labeledjudge{op} [[e]] [[-->]] [[e']] \end{array} }} +defn e --> e' :: :: step :: 'S_' {{ com Single step semantics }} +{{ tex \begin{array}{l} [[e]] [[-->]] [[e']] \end{array} }} by -S(n) = e ------------------ :: Var -S |- n --> e - -S |- e1 --> e1' +e1 --> e1' ------------------- :: App -S |- e1 e2 --> e1' e2 +e1 e2 --> e1' e2 ----------------------------- :: Beta -S |- (\n.e1) e2 --> e1[n |-> e2] +(\n.e1) e2 --> e1[n |-> e2] g0 = sym (nth 0 g) g1 = nth 1 g not e2 is_a_type not e2 is_a_coercion ----------------------------------------------- :: Push -S |- ((\n.e1) |> g) e2 --> (\n.e1 |> g1) (e2 |> g0) +((\n.e1) |> g) e2 --> (\n.e1 |> g1) (e2 |> g0) ---------------------------------------- :: TPush -S |- ((\n.e) |> g) t --> (\n.(e |> g n)) t +((\n.e) |> g) t --> (\n.(e |> g n)) t g0 = nth 1 (nth 0 g) g1 = sym (nth 2 (nth 0 g)) g2 = nth 1 g ------------------------------- :: CPush -S |- ((\n.e) |> g) g' --> (\n.e |> g2) (g0 ; g' ; g1) +((\n.e) |> g) g' --> (\n.e |> g2) (g0 ; g' ; g1) --------------------------------------- :: Trans -S |- (e |> g1) |> g2 --> e |> (g1 ; g2) +(e |> g1) |> g2 --> e |> (g1 ; g2) -S |- e --> e' +e --> e' ------------------------ :: Cast -S |- e |> g --> e' |> g +e |> g --> e' |> g -S |- e --> e' +e --> e' ------------------------------ :: Tick -S |- e { tick } --> e' { tick } +e { tick } --> e' { tick } -S |- e --> e' +e --> e' --------------------------------------- :: Case -S |- case e as n return t of --> case e' as n return t of +case e as n return t of --> case e' as n return t of altj = K -> u e = K u' = u[n |-> e] sbb] // bb /> ecc] // cc /> -------------------------------------------------------------- :: MatchData -S |- case e as n return t of --> u' +case e as n return t of --> u' altj = lit -> u ---------------------------------------------------------------- :: MatchLit -S |- case lit as n return t of --> u[n |-> lit] +case lit as n return t of --> u[n |-> lit] altj = _ -> u no other case matches ------------------------------------------------------------ :: MatchDefault -S |- case e as n return t of --> u[n |-> e] +case e as n return t of --> u[n |-> e] T k'~#k T = coercionKind g forall . forall . $ -> T = dataConRepType K (t1cc $ nth aa g] // aa /> _Nom] // bb />) // cc /> --------------------------- :: CasePush -S |- case (K ) |> g as n return t2 of --> \\ case K as n return t2 of +case (K ) |> g as n return t2 of --> \\ case K as n return t2 of ----------------- :: LetNonRec -S |- let n = e1 in e2 --> e2[n |-> e1] +let n = e1 in e2 --> e2[n |-> e1] -S, ei] // i /> |- u --> u' ------------------------------------ :: LetRec -S |- let rec in u --> let rec in u' - ---------------- :: LetRecApp -S |- (let rec in u) e' --> let rec in (u e') - ----------------- :: LetRecCast -S |- (let rec in u) |> g --> let rec in (u |> g) - ---------------- :: LetRecCase -S |- case (let rec in u) as n0 return t of --> \\ let rec in (case u as n0 return t of ) - ---------------- :: LetRecFlat -S |- let rec in (let rec in u) --> let rec ;; in u +let rec in u --> u let rec in ei ] // i /> -fv(u) \inter = empty ---------------------------------- :: LetRecReturn -S |- let rec in u --> u diff --git a/docs/core-spec/core-spec.mng b/docs/core-spec/core-spec.mng index 0b147f9..d1d8905 100644 --- a/docs/core-spec/core-spec.mng +++ b/docs/core-spec/core-spec.mng @@ -473,14 +473,9 @@ analogously to \texttt{CoreLint.lhs}. Nevertheless, these rules are included in this document to help the reader understand System FC. -\subsection{The context $[[S]]$} -We use a context $[[S]]$ to keep track of the values of variables in a (mutually) -recursive group. Its definition is as follows: -\[ -[[S]] \quad ::= \quad [[ empty ]] \ |\ [[S]], [[ [n |-> e] ]] -\] -The presence of the context $[[S]]$ is solely to deal with recursion. If your -use of FC does not require modeling recursion, you will not need to track $[[S]]$. +Also note that this semantics implements call-by-name, not call-by-need. So +while it describes the operational meaning of a term, it does not describe what +subexpressions are shared, and when. \subsection{Operational semantics rules} @@ -489,13 +484,6 @@ use of FC does not require modeling recursion, you will not need to track $[[S]] \subsection{Notes} \begin{itemize} -\item The \ottdrulename{S\_LetRec} rules -implement recursion. \ottdrulename{S\_LetRec} adds to the context $[[S]]$ bindings -for all of the mutually recursive equations. Then, after perhaps many steps, -when the body of the $[[let]]\ [[rec]]$ contains no variables that are bound -in the $[[let]]\ [[rec]]$, the context is popped in \ottdrulename{S\_LetRecReturn}. -The other \ottdrulename{S\_LetRecXXX} -rules are there to prevent reduction from getting stuck. \item In the $[[case]]$ rules, a constructor $[[K]]$ is written taking three lists of arguments: two lists of types and a list of terms. The types passed in are the universally and, respectively, existentially quantified type variables diff --git a/docs/core-spec/core-spec.pdf b/docs/core-spec/core-spec.pdf index f45e871..dde6c9e 100644 Binary files a/docs/core-spec/core-spec.pdf and b/docs/core-spec/core-spec.pdf differ From git at git.haskell.org Tue Apr 25 14:34:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 25 Apr 2017 14:34:21 +0000 (UTC) Subject: [commit: ghc] master: Don't setProgramDynFlags on every :load (914842e) Message-ID: <20170425143421.204163A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/914842e518bccafac16b3495bcec56be58b0387a/ghc >--------------------------------------------------------------- commit 914842e518bccafac16b3495bcec56be58b0387a Author: Simon Marlow Date: Thu Mar 30 10:31:08 2017 +0100 Don't setProgramDynFlags on every :load Summary: setProgramDynFlags invalidates the whole module graph, forcing everything to be re-summarised (including preprocessing) on every :reload. Looks like this was a bad regression in 8.0, but we didn't notice because there was no test for it. Now there is! Test Plan: * validate * new unit test Reviewers: bgamari, triple, austin, niteria, erikd, jme Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3398 >--------------------------------------------------------------- 914842e518bccafac16b3495bcec56be58b0387a ghc/GHCi/UI.hs | 46 +++++++++++++++++------------ testsuite/tests/ghci/scripts/all.T | 1 + testsuite/tests/ghci/scripts/ghci063.script | 18 +++++++++++ 3 files changed, 46 insertions(+), 19 deletions(-) diff --git a/ghc/GHCi/UI.hs b/ghc/GHCi/UI.hs index aeab85b..99786b5 100644 --- a/ghc/GHCi/UI.hs +++ b/ghc/GHCi/UI.hs @@ -104,7 +104,7 @@ import Data.Time.Format ( formatTime, defaultTimeLocale ) import Data.Version ( showVersion ) import Exception hiding (catch) -import Foreign +import Foreign hiding (void) import GHC.Stack hiding (SrcLoc(..)) import System.Directory @@ -186,15 +186,15 @@ ghciCommands = map mkCmd [ ("issafe", keepGoing' isSafeCmd, completeModule), ("kind", keepGoing' (kindOfType False), completeIdentifier), ("kind!", keepGoing' (kindOfType True), completeIdentifier), - ("load", keepGoingPaths (loadModule_ False), completeHomeModuleOrFile), - ("load!", keepGoingPaths (loadModule_ True), completeHomeModuleOrFile), + ("load", keepGoingPaths loadModule_, completeHomeModuleOrFile), + ("load!", keepGoingPaths loadModuleDefer, completeHomeModuleOrFile), ("list", keepGoing' listCmd, noCompletion), ("module", keepGoing moduleCmd, completeSetModule), ("main", keepGoing runMain, completeFilename), ("print", keepGoing printCmd, completeExpression), ("quit", quit, noCompletion), - ("reload", keepGoing' (reloadModule False), noCompletion), - ("reload!", keepGoing' (reloadModule True), noCompletion), + ("reload", keepGoing' reloadModule, noCompletion), + ("reload!", keepGoing' reloadModuleDefer, noCompletion), ("run", keepGoing runRun, completeFilename), ("script", keepGoing' scriptCmd, completeFilename), ("set", keepGoing setCmd, completeSetOptions), @@ -1444,7 +1444,7 @@ editFile str = code <- liftIO $ system (cmd ++ cmdArgs) when (code == ExitSuccess) - $ reloadModule False "" + $ reloadModule "" -- The user didn't specify a file so we pick one for them. -- Our strategy is to pick the first module that failed to load, @@ -1604,21 +1604,27 @@ checkModule m = do -- | Sets '-fdefer-type-errors' if 'defer' is true, executes 'load' and unsets -- '-fdefer-type-errors' again if it has not been set before. -deferredLoad :: Bool -> InputT GHCi SuccessFlag -> InputT GHCi () -deferredLoad defer load = do - -- Force originalFlags to avoid leaking the associated HscEnv - !originalFlags <- getDynFlags - when defer $ Monad.void $ - GHC.setProgramDynFlags $ setGeneralFlag' Opt_DeferTypeErrors originalFlags - Monad.void $ load - Monad.void $ GHC.setProgramDynFlags $ originalFlags +wrapDeferTypeErrors :: InputT GHCi a -> InputT GHCi a +wrapDeferTypeErrors load = + gbracket + (do + -- Force originalFlags to avoid leaking the associated HscEnv + !originalFlags <- getDynFlags + void $ GHC.setProgramDynFlags $ + setGeneralFlag' Opt_DeferTypeErrors originalFlags + return originalFlags) + (\originalFlags -> void $ GHC.setProgramDynFlags originalFlags) + (\_ -> load) loadModule :: [(FilePath, Maybe Phase)] -> InputT GHCi SuccessFlag loadModule fs = timeIt (const Nothing) (loadModule' fs) -- | @:load@ command -loadModule_ :: Bool -> [FilePath] -> InputT GHCi () -loadModule_ defer fs = deferredLoad defer (loadModule (zip fs (repeat Nothing))) +loadModule_ :: [FilePath] -> InputT GHCi () +loadModule_ fs = void $ loadModule (zip fs (repeat Nothing)) + +loadModuleDefer :: [FilePath] -> InputT GHCi () +loadModuleDefer = wrapDeferTypeErrors . loadModule_ loadModule' :: [(FilePath, Maybe Phase)] -> InputT GHCi SuccessFlag loadModule' files = do @@ -1654,13 +1660,15 @@ addModule files = do return () -- | @:reload@ command -reloadModule :: Bool -> String -> InputT GHCi () -reloadModule defer m = deferredLoad defer $ - doLoadAndCollectInfo True loadTargets +reloadModule :: String -> InputT GHCi () +reloadModule m = void $ doLoadAndCollectInfo True loadTargets where loadTargets | null m = LoadAllTargets | otherwise = LoadUpTo (GHC.mkModuleName m) +reloadModuleDefer :: String -> InputT GHCi () +reloadModuleDefer = wrapDeferTypeErrors . reloadModule + -- | Load/compile targets and (optionally) collect module-info -- -- This collects the necessary SrcSpan annotated type information (via diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T index 16c9ab2..917537b 100755 --- a/testsuite/tests/ghci/scripts/all.T +++ b/testsuite/tests/ghci/scripts/all.T @@ -97,6 +97,7 @@ test('ghci061', normal, ghci_script, ['ghci061.script']) test('ghci062', [extra_files(['ghci062/', 'ghci062/Test.hs']), when(config.have_ext_interp, extra_ways(['ghci-ext']))], ghci_script, ['ghci062.script']) +test('ghci063', normal, ghci_script, ['ghci063.script']) test('T2452', normal, ghci_script, ['T2452.script']) test('T2766', normal, ghci_script, ['T2766.script']) diff --git a/testsuite/tests/ghci/scripts/ghci063.script b/testsuite/tests/ghci/scripts/ghci063.script new file mode 100644 index 0000000..87a19ba --- /dev/null +++ b/testsuite/tests/ghci/scripts/ghci063.script @@ -0,0 +1,18 @@ +:! echo module A where {} >A.hs +:! echo module B where { import A } >B.hs + +:load B + +-- We're going to replace B.hs with an invalid module but without +-- changing its timestamp. A :reload should *not* look at the +-- contents of the file, because the timestamp hasn't changed. +:! cp B.hs B.hs-copy +:! touch -r B.hs B.hs-copy +:! echo "*** INVALID ***" >B.hs +:! touch -r B.hs-copy B.hs + +:reload + +-- Put the original file back, now it should work +:! cp B.hs-copy B.hs +:reload From git at git.haskell.org Tue Apr 25 18:20:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 25 Apr 2017 18:20:52 +0000 (UTC) Subject: [commit: ghc] branch 'wip/T13594' created Message-ID: <20170425182052.CD53D3A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/T13594 Referencing: 1e9535fa07179c547f75aa6a7a7258e3b0cac883 From git at git.haskell.org Tue Apr 25 18:20:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 25 Apr 2017 18:20:56 +0000 (UTC) Subject: [commit: ghc] wip/T13594: Fix #13594 (7b8ba36) Message-ID: <20170425182056.649C03A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T13594 Link : http://ghc.haskell.org/trac/ghc/changeset/7b8ba36eea15a929d08af0fbd82a8408a58f17b0/ghc >--------------------------------------------------------------- commit 7b8ba36eea15a929d08af0fbd82a8408a58f17b0 Author: Ben Gamari Date: Fri Apr 21 16:32:36 2017 -0400 Fix #13594 >--------------------------------------------------------------- 7b8ba36eea15a929d08af0fbd82a8408a58f17b0 compiler/deSugar/Check.hs | 6 +++--- compiler/deSugar/DsBinds.hs | 4 ++-- compiler/deSugar/DsExpr.hs | 2 +- compiler/hsSyn/Convert.hs | 6 +++--- compiler/hsSyn/HsBinds.hs | 4 ++++ compiler/hsSyn/HsExpr.hs | 16 +++++++++------- compiler/hsSyn/HsUtils.hs | 2 +- compiler/parser/Parser.y | 22 ++++++++++++---------- compiler/parser/RdrHsSyn.hs | 16 +++++++++------- compiler/rename/RnBinds.hs | 8 ++++---- compiler/typecheck/TcGenDeriv.hs | 10 +++++----- compiler/typecheck/TcGenFunctor.hs | 12 ++++++------ compiler/typecheck/TcInstDcls.hs | 2 +- compiler/typecheck/TcMatches.hs | 2 +- compiler/typecheck/TcPatSyn.hs | 4 ++-- compiler/typecheck/TcRnDriver.hs | 2 +- compiler/typecheck/TcTyDecls.hs | 4 ++-- testsuite/tests/parser/should_compile/T13594.hs | 7 +++++++ testsuite/tests/parser/should_compile/all.T | 1 + 19 files changed, 74 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 7b8ba36eea15a929d08af0fbd82a8408a58f17b0 From git at git.haskell.org Tue Apr 25 18:20:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 25 Apr 2017 18:20:59 +0000 (UTC) Subject: [commit: ghc] wip/T13594: Edit eventlog-formats.rst to match implementation (1e9535f) Message-ID: <20170425182059.251D93A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T13594 Link : http://ghc.haskell.org/trac/ghc/changeset/1e9535fa07179c547f75aa6a7a7258e3b0cac883/ghc >--------------------------------------------------------------- commit 1e9535fa07179c547f75aa6a7a7258e3b0cac883 Author: Mitsutoshi Aoe Date: Mon Apr 17 06:08:25 2017 +0900 Edit eventlog-formats.rst to match implementation * Add missing filters in EVENT_HEAP_PROF_BEGIN and reorder them * EVENT_HEAP_PROF_SAMPLE_COST_CENTRE isn't used in retainer profiling * Modify EVENT_HEAP_PROF_SAMPLE_STRING's format * Biography break-down isn't implemented >--------------------------------------------------------------- 1e9535fa07179c547f75aa6a7a7258e3b0cac883 docs/users_guide/eventlog-formats.rst | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/docs/users_guide/eventlog-formats.rst b/docs/users_guide/eventlog-formats.rst index 74a62f2..8d53f92 100644 --- a/docs/users_guide/eventlog-formats.rst +++ b/docs/users_guide/eventlog-formats.rst @@ -38,11 +38,13 @@ A single fixed-width event emitted during program start-up describing the sample * ``SAMPLE_TYPE_MODULE`` (output from ``-hm``) * ``SAMPLE_TYPE_TYPE_DESCR`` (output from ``-hy``) * ``SAMPLE_TYPE_BIOGRAPHY`` (output from ``-hb``) - * ``String``: Cost centre filter - * ``String``: Closure description filter - * ``String``: Retainer filter * ``String``: Module filter + * ``String``: Closure description filter * ``String``: Type description filter + * ``String``: Cost centre filter + * ``String``: Cost centre stack filter + * ``String``: Retainer filter + * ``String``: Biography filter Cost center definitions ^^^^^^^^^^^^^^^^^^^^^^^ @@ -81,9 +83,8 @@ Cost-center break-down A variable-length packet encoding a heap profile sample broken down by, * cost-center (``-hc``) - * retainer (``-hr``) - * ``EVENT_HEAP_PROF_SAMPLE`` + * ``EVENT_HEAP_PROF_SAMPLE_COST_CENTRE`` * ``Word8``: Profile ID * ``Word64``: heap residency in bytes * ``Word8``: stack depth @@ -98,22 +99,7 @@ A variable-length event encoding a heap sample broken down by, * closure description (``-hd``) * module (``-hm``) - * ``EVENT_HEAP_PROF_SAMPLE`` + * ``EVENT_HEAP_PROF_SAMPLE_STRING`` * ``Word8``: Profile ID - * The event shall contain packed pairs of, - * ``String``: type description - * ``Word64``: heap residency in bytes - - -Biography break-down -^^^^^^^^^^^^^^^^^^^^ - -A fixed-length event encoding a biography heap sample. - - * ``EVENT_HEAP_PROF_SAMPLE`` - * ``Word8``: Profile ID - * ``Word64``: Void - * ``Word64``: Lag - * ``Word64``: Use - * ``Word64``: Inherent use - * ``Word64``: Drag + * ``Word64``: heap residency in bytes + * ``String``: type or closure description, or module name From git at git.haskell.org Wed Apr 26 01:05:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 26 Apr 2017 01:05:33 +0000 (UTC) Subject: [commit: ghc] branch 'wip/dfeuer-T13397' created Message-ID: <20170426010533.7F1DB3A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/dfeuer-T13397 Referencing: a2df49f25cd8c332d0e9bb409428db566378eee2 From git at git.haskell.org Wed Apr 26 01:05:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 26 Apr 2017 01:05:39 +0000 (UTC) Subject: [commit: ghc] wip/dfeuer-T13397: Re-engineer caseRules to add tagToEnum/dataToTag (6f40dd5) Message-ID: <20170426010539.0760E3A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/dfeuer-T13397 Link : http://ghc.haskell.org/trac/ghc/changeset/6f40dd596ec7875efac9824399846de5180aea65/ghc >--------------------------------------------------------------- commit 6f40dd596ec7875efac9824399846de5180aea65 Author: Simon Peyton Jones Date: Wed Mar 8 10:26:47 2017 +0000 Re-engineer caseRules to add tagToEnum/dataToTag See Note [Scrutinee Constant Folding] in SimplUtils * Add cases for tagToEnum and dataToTag. This is the main new bit. It allows the simplifier to remove the pervasive uses of case tagToEnum (a > b) of False -> e1 True -> e2 and replace it by the simpler case a > b of DEFAULT -> e1 1# -> e2 See Note [caseRules for tagToEnum] and Note [caseRules for dataToTag] in PrelRules. * This required some changes to the API of caseRules, and hence to code in SimplUtils. See Note [Scrutinee Constant Folding] in SimplUtils. * Avoid duplication of work in the (unusual) case of case BIG + 3# of b DEFAULT -> e1 6# -> e2 Previously we got case BIG of DEFAULT -> let b = BIG + 3# in e1 3# -> let b = 6# in e2 Now we get case BIG of b# DEFAULT -> let b = b' + 3# in e1 3# -> let b = 6# in e2 * Avoid duplicated code in caseRules A knock-on refactoring: * Move Note [Word/Int underflow/overflow] to Literal, as documentation to accompany mkMachIntWrap etc; and get rid of PrelRuls.intResult' in favour of mkMachIntWrap >--------------------------------------------------------------- 6f40dd596ec7875efac9824399846de5180aea65 compiler/basicTypes/Literal.hs | 21 ++ compiler/coreSyn/CoreSyn.hs | 2 + compiler/prelude/PrelRules.hs | 231 +++++++++++++-------- compiler/simplCore/SimplUtils.hs | 177 +++++++++++----- .../tests/simplCore/should_compile/T3772.stdout | 10 +- .../tests/simplCore/should_compile/T4930.stderr | 30 +-- .../simplCore/should_compile/spec-inline.stderr | 152 +++++++------- 7 files changed, 391 insertions(+), 232 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 6f40dd596ec7875efac9824399846de5180aea65 From git at git.haskell.org Wed Apr 26 01:05:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 26 Apr 2017 01:05:41 +0000 (UTC) Subject: [commit: ghc] wip/dfeuer-T13397: Improve code generation for conditionals (a2df49f) Message-ID: <20170426010541.BCFC53A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/dfeuer-T13397 Link : http://ghc.haskell.org/trac/ghc/changeset/a2df49f25cd8c332d0e9bb409428db566378eee2/ghc >--------------------------------------------------------------- commit a2df49f25cd8c332d0e9bb409428db566378eee2 Author: Simon Peyton Jones Date: Wed Mar 8 11:05:53 2017 +0000 Improve code generation for conditionals This patch in in preparation for the fix to Trac #13397 The code generator has a special case for case tagToEnum (a>#b) of False -> e1 True -> e2 but it was not doing nearly so well on case a>#b of DEFAULT -> e1 1# -> e2 This patch arranges to behave essentially identically in both cases. In due course we can eliminate the special case for tagToEnum#, once we've completed Trac #13397. The changes are: * Make CmmSink swizzle the order of a conditional where necessary; see Note [Improving conditionals] in CmmSink * Hack the general case of StgCmmExpr.cgCase so that it use NoGcInAlts for conditionals. This doesn't seem right, but it's the same choice as the tagToEnum version. Without it, code size increases a lot (more heap checks). There's a loose end here. * Add comments in CmmOpt.cmmMachOpFoldM >--------------------------------------------------------------- a2df49f25cd8c332d0e9bb409428db566378eee2 compiler/cmm/CmmOpt.hs | 83 +++++++++++++++++++++++++++------------ compiler/cmm/CmmSink.hs | 39 +++++++++++++++--- compiler/codeGen/StgCmmClosure.hs | 2 +- compiler/codeGen/StgCmmExpr.hs | 28 +++++++++++-- compiler/prelude/PrimOp.hs | 7 +++- 5 files changed, 121 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 a2df49f25cd8c332d0e9bb409428db566378eee2 From git at git.haskell.org Wed Apr 26 01:05:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 26 Apr 2017 01:05:36 +0000 (UTC) Subject: [commit: ghc] wip/dfeuer-T13397: Move dataConTagZ to DataCon (15505c6) Message-ID: <20170426010536.409FD3A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/dfeuer-T13397 Link : http://ghc.haskell.org/trac/ghc/changeset/15505c6ad55f456939f9cfbdd44ea8e8ae958f12/ghc >--------------------------------------------------------------- commit 15505c6ad55f456939f9cfbdd44ea8e8ae958f12 Author: Simon Peyton Jones Date: Tue Mar 7 13:28:34 2017 +0000 Move dataConTagZ to DataCon Just a simple refactoring to remove duplication >--------------------------------------------------------------- 15505c6ad55f456939f9cfbdd44ea8e8ae958f12 compiler/basicTypes/DataCon.hs | 8 ++++++-- compiler/cmm/SMRep.hs | 4 ++-- compiler/codeGen/StgCmmClosure.hs | 12 ++++-------- compiler/codeGen/StgCmmMonad.hs | 1 + compiler/vectorise/Vectorise/Utils/Base.hs | 5 +---- 5 files changed, 14 insertions(+), 16 deletions(-) diff --git a/compiler/basicTypes/DataCon.hs b/compiler/basicTypes/DataCon.hs index c6bb8eb..acd2865 100644 --- a/compiler/basicTypes/DataCon.hs +++ b/compiler/basicTypes/DataCon.hs @@ -28,8 +28,9 @@ module DataCon ( -- ** Type deconstruction dataConRepType, dataConSig, dataConInstSig, dataConFullSig, - dataConName, dataConIdentity, dataConTag, dataConTyCon, - dataConOrigTyCon, dataConUserType, + dataConName, dataConIdentity, dataConTag, dataConTagZ, + dataConTyCon, dataConOrigTyCon, + dataConUserType, dataConUnivTyVars, dataConUnivTyVarBinders, dataConExTyVars, dataConExTyVarBinders, dataConAllTyVars, @@ -861,6 +862,9 @@ dataConName = dcName dataConTag :: DataCon -> ConTag dataConTag = dcTag +dataConTagZ :: DataCon -> ConTagZ +dataConTagZ con = dataConTag con - fIRST_TAG + -- | The type constructor that we are building via this data constructor dataConTyCon :: DataCon -> TyCon dataConTyCon = dcRepTyCon diff --git a/compiler/cmm/SMRep.hs b/compiler/cmm/SMRep.hs index 83ddf18..d40af4f 100644 --- a/compiler/cmm/SMRep.hs +++ b/compiler/cmm/SMRep.hs @@ -50,6 +50,7 @@ module SMRep ( #include "../HsVersions.h" #include "../includes/MachDeps.h" +import BasicTypes( ConTagZ ) import DynFlags import Outputable import Platform @@ -185,14 +186,13 @@ type IsStatic = Bool -- rtsClosureType below. data ClosureTypeInfo - = Constr ConstrTag ConstrDescription + = Constr ConTagZ ConstrDescription | Fun FunArity ArgDescr | Thunk | ThunkSelector SelectorOffset | BlackHole | IndStatic -type ConstrTag = Int type ConstrDescription = [Word8] -- result of dataConIdentity type FunArity = Int type SelectorOffset = Int diff --git a/compiler/codeGen/StgCmmClosure.hs b/compiler/codeGen/StgCmmClosure.hs index e799ea6..bc5e473 100644 --- a/compiler/codeGen/StgCmmClosure.hs +++ b/compiler/codeGen/StgCmmClosure.hs @@ -13,7 +13,6 @@ module StgCmmClosure ( DynTag, tagForCon, isSmallFamily, - ConTagZ, dataConTagZ, idPrimRep, isVoidRep, isGcPtrRep, addIdReps, addArgReps, argPrimRep, @@ -360,17 +359,12 @@ type DynTag = Int -- The tag on a *pointer* isSmallFamily :: DynFlags -> Int -> Bool isSmallFamily dflags fam_size = fam_size <= mAX_PTR_TAG dflags --- We keep the *zero-indexed* tag in the srt_len field of the info --- table of a data constructor. -dataConTagZ :: DataCon -> ConTagZ -dataConTagZ con = dataConTag con - fIRST_TAG - tagForCon :: DynFlags -> DataCon -> DynTag tagForCon dflags con - | isSmallFamily dflags fam_size = con_tag + 1 + | isSmallFamily dflags fam_size = con_tag | otherwise = 1 where - con_tag = dataConTagZ con + con_tag = dataConTag con -- NB: 1-indexed fam_size = tyConFamilySize (dataConTyCon con) tagForArity :: DynFlags -> RepArity -> DynTag @@ -1050,6 +1044,8 @@ mkDataConInfoTable dflags data_con is_static ptr_wds nonptr_wds info_lbl = mkConInfoTableLabel name NoCafRefs sm_rep = mkHeapRep dflags is_static ptr_wds nonptr_wds cl_type cl_type = Constr (dataConTagZ data_con) (dataConIdentity data_con) + -- We keep the *zero-indexed* tag in the srt_len field + -- of the info table of a data constructor. prof | not (gopt Opt_SccProfilingOn dflags) = NoProfilingInfo | otherwise = ProfilingInfo ty_descr val_descr diff --git a/compiler/codeGen/StgCmmMonad.hs b/compiler/codeGen/StgCmmMonad.hs index cf78269..754cbfb 100644 --- a/compiler/codeGen/StgCmmMonad.hs +++ b/compiler/codeGen/StgCmmMonad.hs @@ -74,6 +74,7 @@ import Module import Id import VarEnv import OrdList +import BasicTypes( ConTagZ ) import Unique import UniqSupply import FastString diff --git a/compiler/vectorise/Vectorise/Utils/Base.hs b/compiler/vectorise/Vectorise/Utils/Base.hs index 4227109..88058e2 100644 --- a/compiler/vectorise/Vectorise/Utils/Base.hs +++ b/compiler/vectorise/Vectorise/Utils/Base.hs @@ -4,7 +4,7 @@ module Vectorise.Utils.Base ( voidType , newLocalVVar - , mkDataConTag, dataConTagZ + , mkDataConTag , mkWrapType , mkClosureTypes , mkPReprType @@ -66,9 +66,6 @@ newLocalVVar fs vty mkDataConTag :: DynFlags -> DataCon -> CoreExpr mkDataConTag dflags = mkIntLitInt dflags . dataConTagZ -dataConTagZ :: DataCon -> Int -dataConTagZ con = dataConTag con - fIRST_TAG - -- Type Construction ---------------------------------------------------------- From git at git.haskell.org Wed Apr 26 01:11:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 26 Apr 2017 01:11:42 +0000 (UTC) Subject: [commit: ghc] master: Don't describe tuple sections as "Python-style" (688272b) Message-ID: <20170426011142.3C88C3A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/688272ba31df7bd0a094c3d86d60f7b77b9f5268/ghc >--------------------------------------------------------------- commit 688272ba31df7bd0a094c3d86d60f7b77b9f5268 Author: Chris Martin Date: Sat Apr 22 18:26:22 2017 -0400 Don't describe tuple sections as "Python-style" (cherry picked from commit 960589e89da3dbf60e88042d7e064ad4a98fb2ff) >--------------------------------------------------------------- 688272ba31df7bd0a094c3d86d60f7b77b9f5268 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 c45fbec..0a09c7c 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -1570,7 +1570,7 @@ Tuple sections Allow the use of tuple section syntax -The :ghc-flag:`-XTupleSections` flag enables Python-style partially applied +The :ghc-flag:`-XTupleSections` flag enables partially applied tuple constructors. For example, the following program :: (, True) From git at git.haskell.org Wed Apr 26 01:11:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 26 Apr 2017 01:11:47 +0000 (UTC) Subject: [commit: ghc] master: configure: Kill off FP_ARG_WITH_* (9373994) Message-ID: <20170426011147.B43D63A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9373994acaf1b73fe0e7cf8e03594c63cec8d235/ghc >--------------------------------------------------------------- commit 9373994acaf1b73fe0e7cf8e03594c63cec8d235 Author: Ben Gamari Date: Tue Apr 25 18:32:24 2017 -0400 configure: Kill off FP_ARG_WITH_* This replaces the --with-* configure flags with the usual autoconf environment variables, as suggested by #13583. Test Plan: Configure on various platforms Reviewers: hvr, trofi, thomie, austin Reviewed By: trofi Subscribers: rwbarton, erikd GHC Trac Issues: #13583 Differential Revision: https://phabricator.haskell.org/D3499 >--------------------------------------------------------------- 9373994acaf1b73fe0e7cf8e03594c63cec8d235 aclocal.m4 | 101 ++++++--------------------------------- configure.ac | 47 ++++++++++-------- distrib/configure.ac.in | 4 +- docs/users_guide/8.4.1-notes.rst | 6 +++ 4 files changed, 49 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 9373994acaf1b73fe0e7cf8e03594c63cec8d235 From git at git.haskell.org Wed Apr 26 01:11:45 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 26 Apr 2017 01:11:45 +0000 (UTC) Subject: [commit: ghc] master: Revert "Remove special casing of Windows in generic files" (6610886) Message-ID: <20170426011145.0368D3A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/66108864540601837ad77847f4062a670362361f/ghc >--------------------------------------------------------------- commit 66108864540601837ad77847f4062a670362361f Author: Ben Gamari Date: Tue Apr 25 09:28:40 2017 -0400 Revert "Remove special casing of Windows in generic files" This commit didn't consider the fact that binary distributions on Windows must have relative toolchain paths. This caused #13560. This reverts commit 48385cb2fc295eb8af9188cbe140142c1807d5a7 (except for a helpful comment). >--------------------------------------------------------------- 66108864540601837ad77847f4062a670362361f aclocal.m4 | 49 ++++++++++++++++++------------------------------- configure.ac | 13 ++++++++----- 2 files changed, 26 insertions(+), 36 deletions(-) diff --git a/aclocal.m4 b/aclocal.m4 index fc7b24c..545a15a 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -459,55 +459,42 @@ AC_DEFUN([GET_ARM_ISA], # Set the variables used in the settings file AC_DEFUN([FP_SETTINGS], [ - SettingsCCompilerCommand="$CC" - SettingsHaskellCPPCommand="$HaskellCPPCmd" - SettingsHaskellCPPFlags="$HaskellCPPArgs" - SettingsLdCommand="$LdCmd" - SettingsArCommand="$ArCmd" - SettingsPerlCommand="$PerlCmd" - - if test -z "$DllWrap" + if test "$windows" = YES then - SettingsDllWrapCommand="/bin/false" + mingw_bin_prefix=mingw/bin/ + SettingsCCompilerCommand="\$topdir/../${mingw_bin_prefix}gcc.exe" + SettingsHaskellCPPCommand="\$topdir/../${mingw_bin_prefix}gcc.exe" + SettingsHaskellCPPFlags="$HaskellCPPArgs" + SettingsLdCommand="\$topdir/../${mingw_bin_prefix}ld.exe" + SettingsArCommand="\$topdir/../${mingw_bin_prefix}ar.exe" + SettingsPerlCommand='$topdir/../perl/perl.exe' + SettingsDllWrapCommand="\$topdir/../${mingw_bin_prefix}dllwrap.exe" + SettingsWindresCommand="\$topdir/../${mingw_bin_prefix}windres.exe" + SettingsTouchCommand='$topdir/bin/touchy.exe' else - SettingsDllWrapCommand="$DllWrap" - fi - - if test -z "$Windres" - then + SettingsCCompilerCommand="$CC" + SettingsHaskellCPPCommand="$HaskellCPPCmd" + SettingsHaskellCPPFlags="$HaskellCPPArgs" + SettingsLdCommand="$LdCmd" + SettingsArCommand="$ArCmd" + SettingsPerlCommand="$PerlCmd" + SettingsDllWrapCommand="/bin/false" SettingsWindresCommand="/bin/false" - else - SettingsWindresCommand="$Windres" - fi - - if test -z "$Libtool" - then SettingsLibtoolCommand="libtool" - else - SettingsLibtoolCommand="$Libtool" - fi - - if test -z "$Touch" - then SettingsTouchCommand='touch' - else - SettingsTouchCommand='$Touch' fi - if test -z "$LlcCmd" then SettingsLlcCommand="llc" else SettingsLlcCommand="$LlcCmd" fi - if test -z "$OptCmd" then SettingsOptCommand="opt" else SettingsOptCommand="$OptCmd" fi - SettingsCCompilerFlags="$CONF_CC_OPTS_STAGE2" SettingsCCompilerLinkFlags="$CONF_GCC_LINKER_OPTS_STAGE2" SettingsCCompilerSupportsNoPie="$CONF_GCC_SUPPORTS_NO_PIE" diff --git a/configure.ac b/configure.ac index 5606080..194d37b 100644 --- a/configure.ac +++ b/configure.ac @@ -177,9 +177,13 @@ then if test "$ghc_host_os" = "mingw32" then - # Canonicalise to :/path/to/ghc - WithGhc=`cygpath -m "${WithGhc}"` - + if test "${OSTYPE}" = "msys" + then + WithGhc=`echo "${WithGhc}" | sed "s#^/\([a-zA-Z]\)/#\1:/#"` + else + # Canonicalise to :/path/to/ghc + WithGhc=`cygpath -m "${WithGhc}"` + fi echo "GHC path canonicalised to: ${WithGhc}" fi fi @@ -374,8 +378,6 @@ then NM="${mingwbin}nm.exe" RANLIB="${mingwbin}ranlib.exe" OBJDUMP="${mingwbin}objdump.exe" - Windres="${mingwbin}windres.exe" - DllWrap="${mingwbin}dllwrap.exe" fp_prog_ar="${mingwbin}ar.exe" # NB. Download the perl binaries if required @@ -727,6 +729,7 @@ AC_SUBST(HaveDtrace) AC_PATH_PROG(HSCOLOUR,HsColour) # HsColour is passed to Cabal, so we need a native path if test "$HostOS" = "mingw32" && \ + test "${OSTYPE}" != "msys" && \ test "${HSCOLOUR}" != "" then # Canonicalise to :/path/to/gcc From git at git.haskell.org Wed Apr 26 01:11:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 26 Apr 2017 01:11:50 +0000 (UTC) Subject: [commit: ghc] master: PPC NCG: Implement callish prim ops (89a3241) Message-ID: <20170426011150.795CB3A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/89a3241f708502e8fbcfaddbbe634790ad9cd02a/ghc >--------------------------------------------------------------- commit 89a3241f708502e8fbcfaddbbe634790ad9cd02a Author: Peter Trommler Date: Tue Apr 25 18:37:16 2017 -0400 PPC NCG: Implement callish prim ops Provide PowerPC optimised implementations of callish prim ops. MO_?_QuotRem The generic implementation of quotient remainder prim ops uses a division and a remainder operation. There is no remainder on PowerPC and so we need to implement remainder "by hand" which results in a duplication of the divide operation when using the generic code. Avoid this duplication by implementing the prim op in the native code generator. MO_U_Mul2 Use PowerPC's instructions for long multiplication. Addition and subtraction Use PowerPC add/subtract with carry/overflow instructions MO_Clz and MO_Ctz Use PowerPC's CNTLZ instruction and implement count trailing zeros using count leading zeros MO_QuotRem2 Implement an algorithm given by Henry Warren in "Hacker's Delight" using PowerPC divide instruction. TODO: Use long division instructions when available (POWER7 and later). Test Plan: validate on AIX and 32-bit Linux Reviewers: simonmar, erikd, hvr, austin, bgamari Reviewed By: erikd, hvr, bgamari Subscribers: trofi, kgardas, thomie Differential Revision: https://phabricator.haskell.org/D2973 >--------------------------------------------------------------- 89a3241f708502e8fbcfaddbbe634790ad9cd02a compiler/codeGen/StgCmmPrim.hs | 28 ++- compiler/nativeGen/PIC.hs | 5 +- compiler/nativeGen/PPC/CodeGen.hs | 464 ++++++++++++++++++++++++++++++++------ compiler/nativeGen/PPC/Instr.hs | 102 ++++----- compiler/nativeGen/PPC/Ppr.hs | 196 +++++++++++----- 5 files changed, 611 insertions(+), 184 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 89a3241f708502e8fbcfaddbbe634790ad9cd02a From git at git.haskell.org Wed Apr 26 01:11:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 26 Apr 2017 01:11:53 +0000 (UTC) Subject: [commit: ghc] master: Add backup url and sync support for Win32 tarball script (71c3cea) Message-ID: <20170426011153.396803A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/71c3cea60c74054b6ba9ed918a58814aa91e01c2/ghc >--------------------------------------------------------------- commit 71c3cea60c74054b6ba9ed918a58814aa91e01c2 Author: Tamar Christina Date: Tue Apr 25 18:38:14 2017 -0400 Add backup url and sync support for Win32 tarball script This imports @bgamari's sync script into the mirror script and adds a backup url for packages. The idea is that the URLs won't need updating when updating the tarballs from now on. It will first try haskell.org, failing that it'll try repo.msys2.org Test Plan: try new command `mk/get-win32-tarballs.sh sync` Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie, bgamari Differential Revision: https://phabricator.haskell.org/D3488 >--------------------------------------------------------------- 71c3cea60c74054b6ba9ed918a58814aa91e01c2 mk/get-win32-tarballs.sh | 72 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 59 insertions(+), 13 deletions(-) diff --git a/mk/get-win32-tarballs.sh b/mk/get-win32-tarballs.sh index 2fd8144..a21cc62 100755 --- a/mk/get-win32-tarballs.sh +++ b/mk/get-win32-tarballs.sh @@ -14,11 +14,18 @@ download_file() { local dest_file="$2" local description="$3" local extra_curl_opts="$4" + local backup_url="$5" local dest_dir="$(dirname $dest_file)" if ! test -f "${dest_file}" then local curl_cmd="curl -L ${file_url} -o ${dest_file} --create-dirs -# ${extra_curl_opts}" + if test -n "${backup_url}"; then + local curl_cmd_bnk="curl -L ${backup_url} -o ${dest_file} --create-dirs -# ${extra_curl_opts}" + else + local curl_cmd_bnk="echo 1" + fi + if test "$download" = "0" then echo "ERROR: Missing ${description}" >&2 @@ -27,7 +34,7 @@ download_file() { return else echo "Downloading ${description} to ${dest_dir}..." - $curl_cmd || { + $curl_cmd || $curl_cmd_bnk || { rm -f "${dest_file}" fail "ERROR: Download failed." } @@ -53,19 +60,24 @@ download_file() { } download_mingw() { + local mingw_base_url_primary="https://downloads.haskell.org/~ghc/mingw" + local mingw_base_url_secondary="http://repo.msys2.org/mingw" + if test "$mingw_arch" = "sources" then - local mingw_url=`echo "$1" | sed -e 's/-any\.pkg\.tar\.xz/\.src\.tar\.gz/' \ - -e 's/-sources-/-/' \ - -e 's/-libwinpthread-git-/-winpthreads-git-/' ` + mingw_url_tmp=`echo "$1" | sed -e 's/-any\.pkg\.tar\.xz/\.src\.tar\.gz/' \ + -e 's/-sources-/-/' \ + -e 's/-libwinpthread-git-/-winpthreads-git-/' ` + local mingw_url="${mingw_base_url_primary}/${mingw_url_tmp}" else - local mingw_url="$1" + local mingw_url="${mingw_base_url_primary}/$1" + local mingw_url_backup="${mingw_base_url_secondary}/$1" fi local mingw_toolchain="$(basename $mingw_url)" local mingw_w64="${tarball_dir}/${tarball_dest_dir}/${mingw_toolchain}" - download_file "${mingw_url}" "${mingw_w64}" "${mingw_toolchain}" + download_file "${mingw_url}" "${mingw_w64}" "${mingw_toolchain}" "" "${mingw_url_backup}" # Mark the tree as needing updates by deleting the folder if test -d inplace/mingw && test inplace/mingw -ot "$mingw_w64" ; then @@ -75,10 +87,8 @@ download_mingw() { } download_tarballs() { - #local mingw_base_url="http://repo.msys2.org/mingw" - local mingw_base_url="https://downloads.haskell.org/~ghc/mingw" local package_prefix="mingw-w64" - local format_url="${mingw_base_url}/${mingw_arch}/${package_prefix}-${mingw_arch}" + local format_url="/${mingw_arch}/${package_prefix}-${mingw_arch}" download_mingw "${format_url}-crt-git-5.0.0.4795.e3d96cb1-1-any.pkg.tar.xz" download_mingw "${format_url}-winpthreads-git-5.0.0.4761.02bea78-1-any.pkg.tar.xz" @@ -128,15 +138,42 @@ download_sources() { download_tarballs } +sync_binaries_and_sources() { + gpg --recv-key 5F92EFC1A47D45A1 + + # ensure sources are downloaded + sigs=1 + download_i386 + download_x86_64 + verify=0 + download_sources + + for f in $(find ghc-tarballs/mingw-w64 -iname '*.sig'); do + echo "Verifying $f" + gpg --verify $f + done + + md5sum `find ghc-tarballs -type f -a -not -iname '*.sig'` >| mk/win32-tarballs.md5sum + chmod -R ugo+rX ghc-tarballs + + rsync -av ghc-tarballs/mingw-w64/* downloads.haskell.org:public_html/mingw + for f in $(find ghc-tarballs/mingw-w64); do + curl -XPURGE http://downloads.haskell.org/~ghc/mingw/$f + done +} + usage() { echo "$0 - Download GHC mingw toolchain tarballs" echo - echo "Usage: $0 " + echo "Usage: $0 []" echo echo "Where is one of," + echo "" echo " download download the necessary tarballs for the given architecture" - echo " fetch download the necessary tarballs for the given architecture but doesn't verify their md5."d + echo " fetch download the necessary tarballs for the given architecture but doesn't verify their md5." echo " verify verify the existence and correctness of the necessary tarballs" + echo " sync upload packages downloaded with 'fetch mirror' to haskell.org" + echo "" echo "and is one of i386, x86_64,all or mirror (which includes sources)" } @@ -154,6 +191,11 @@ case $1 in download=0 verify=1 ;; + sync) + download=1 + verify=0 + sync=1 + ;; *) usage exit 1 @@ -179,7 +221,11 @@ case $2 in download_sources ;; *) - usage - exit 1 + if test "$sync" = "1"; then + sync_binaries_and_sources + else + usage + exit 1 + fi ;; esac From git at git.haskell.org Wed Apr 26 01:11:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 26 Apr 2017 01:11:56 +0000 (UTC) Subject: [commit: ghc] master: Only pretty-print binders in closed type families with -fprint-explicit-foralls (da792e4) Message-ID: <20170426011156.786F63A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/da792e47981f65b2dba4fc76ce51dc3fb9c4c02d/ghc >--------------------------------------------------------------- commit da792e47981f65b2dba4fc76ce51dc3fb9c4c02d Author: Ryan Scott Date: Tue Apr 25 18:38:34 2017 -0400 Only pretty-print binders in closed type families with -fprint-explicit-foralls Previously, we were unconditionally pretty-printing all type variable binders when pretty-printing closed type families (e.g., in the output of `:info` in GHCi). This threw me for a loop, so let's guard this behind the `-fprint-explicit-foralls` flag. Test Plan: make test TEST=T13420 Reviewers: goldfire, austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #13420 Differential Revision: https://phabricator.haskell.org/D3497 >--------------------------------------------------------------- da792e47981f65b2dba4fc76ce51dc3fb9c4c02d compiler/iface/IfaceSyn.hs | 6 +++++- testsuite/tests/backpack/should_fail/bkpfail42.stderr | 4 ++-- testsuite/tests/ghci/scripts/T13420.hs | 7 +++++++ testsuite/tests/ghci/scripts/T13420.script | 2 ++ testsuite/tests/ghci/scripts/T13420.stdout | 6 ++++++ testsuite/tests/ghci/scripts/T7939.stdout | 8 ++++---- testsuite/tests/ghci/scripts/all.T | 1 + .../should_compile/NamedWildcardInTypeFamilyInstanceLHS.stderr | 2 +- 8 files changed, 28 insertions(+), 8 deletions(-) diff --git a/compiler/iface/IfaceSyn.hs b/compiler/iface/IfaceSyn.hs index 5db8c99..047ed25 100644 --- a/compiler/iface/IfaceSyn.hs +++ b/compiler/iface/IfaceSyn.hs @@ -67,6 +67,7 @@ import TyCon ( Role (..), Injectivity(..) ) import Util( filterOut, filterByList ) import DataCon (SrcStrictness(..), SrcUnpackedness(..)) import Lexeme (isLexSym) +import DynFlags import Control.Monad import System.IO.Unsafe @@ -554,7 +555,10 @@ pprAxBranch pp_tc (IfaceAxBranch { ifaxbTyVars = tvs $+$ nest 2 maybe_incomps where - ppr_binders + ppr_binders = sdocWithDynFlags $ \dflags -> + ppWhen (gopt Opt_PrintExplicitForalls dflags) ppr_binders' + + ppr_binders' | null tvs && null cvs = empty | null cvs = brackets (pprWithCommas (pprIfaceTvBndr True) tvs) diff --git a/testsuite/tests/backpack/should_fail/bkpfail42.stderr b/testsuite/tests/backpack/should_fail/bkpfail42.stderr index 5a9e1aa..467ab71 100644 --- a/testsuite/tests/backpack/should_fail/bkpfail42.stderr +++ b/testsuite/tests/backpack/should_fail/bkpfail42.stderr @@ -7,9 +7,9 @@ bkpfail42.bkp:9:9: error: • Type constructor ‘F’ has conflicting definitions in the module and its hsig file Main module: type family F a :: * - where [a] F a = Int + where F a = Int Hsig file: type family F a :: * - where [a] F a = Bool + where F a = Bool • while merging the signatures from: • p[A=]:A • ...and the local signature for A diff --git a/testsuite/tests/ghci/scripts/T13420.hs b/testsuite/tests/ghci/scripts/T13420.hs new file mode 100644 index 0000000..6b84e65 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T13420.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE TypeFamilies #-} +module T13420 where + +type family F a where + F [Int] = Bool + F [a] = Double + F (a b) = Char diff --git a/testsuite/tests/ghci/scripts/T13420.script b/testsuite/tests/ghci/scripts/T13420.script new file mode 100644 index 0000000..aba31bf --- /dev/null +++ b/testsuite/tests/ghci/scripts/T13420.script @@ -0,0 +1,2 @@ +:load T13420 +:i F diff --git a/testsuite/tests/ghci/scripts/T13420.stdout b/testsuite/tests/ghci/scripts/T13420.stdout new file mode 100644 index 0000000..e6b81ad --- /dev/null +++ b/testsuite/tests/ghci/scripts/T13420.stdout @@ -0,0 +1,6 @@ +type family F a :: * + where + F [Int] = Bool + F [a] = Double + F (a b) = Char + -- Defined at T13420.hs:4:1 diff --git a/testsuite/tests/ghci/scripts/T7939.stdout b/testsuite/tests/ghci/scripts/T7939.stdout index 2b2c8b7..db2590c 100644 --- a/testsuite/tests/ghci/scripts/T7939.stdout +++ b/testsuite/tests/ghci/scripts/T7939.stdout @@ -15,13 +15,13 @@ type family H (a :: Bool) :: Bool H :: Bool -> Bool type family J (a :: [k]) :: Bool where - [k] J k '[] = 'False - [k, (h :: k), (t :: [k])] J k (h : t) = 'True + J k '[] = 'False + J k (h : t) = 'True -- Defined at T7939.hs:17:1 J :: [k] -> Bool type family K (a1 :: [a]) :: Maybe a where - [a] K a '[] = 'Nothing - [a, (h :: a), (t :: [a])] K a (h : t) = 'Just h + K a '[] = 'Nothing + K a (h : t) = 'Just h -- Defined at T7939.hs:21:1 K :: [a] -> Maybe a diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T index 917537b..ae0a528 100755 --- a/testsuite/tests/ghci/scripts/all.T +++ b/testsuite/tests/ghci/scripts/all.T @@ -251,6 +251,7 @@ test('T12550', normal, ghci_script, ['T12550.script']) test('StaticPtr', normal, ghci_script, ['StaticPtr.script']) test('T13202', normal, ghci_script, ['T13202.script']) test('T13202a', normal, ghci_script, ['T13202a.script']) +test('T13420', normal, ghci_script, ['T13420.script']) test('T13466', normal, ghci_script, ['T13466.script']) test('GhciCurDir', normal, ghci_script, ['GhciCurDir.script']) test('T13591', expect_broken(13591), ghci_script, ['T13591.script']) diff --git a/testsuite/tests/partial-sigs/should_compile/NamedWildcardInTypeFamilyInstanceLHS.stderr b/testsuite/tests/partial-sigs/should_compile/NamedWildcardInTypeFamilyInstanceLHS.stderr index 4fb8877..9d7618d 100644 --- a/testsuite/tests/partial-sigs/should_compile/NamedWildcardInTypeFamilyInstanceLHS.stderr +++ b/testsuite/tests/partial-sigs/should_compile/NamedWildcardInTypeFamilyInstanceLHS.stderr @@ -2,7 +2,7 @@ TYPE SIGNATURES TYPE CONSTRUCTORS type family F a :: * where - [_t] F _t = Int + F _t = Int axiom NamedWildcardInTypeFamilyInstanceLHS.D:R:F COERCION AXIOMS axiom NamedWildcardInTypeFamilyInstanceLHS.D:R:F :: From git at git.haskell.org Wed Apr 26 01:11:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 26 Apr 2017 01:11:59 +0000 (UTC) Subject: [commit: ghc] master: Document mkWeak# (2446026) Message-ID: <20170426011159.352D83A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/244602697c30e03ba63076941e4742ceeb78dd7c/ghc >--------------------------------------------------------------- commit 244602697c30e03ba63076941e4742ceeb78dd7c Author: Ben Gamari Date: Tue Apr 25 18:39:58 2017 -0400 Document mkWeak# Reviewers: simonmar, austin Reviewed By: simonmar Subscribers: RyanGlScott, rwbarton, thomie GHC Trac Issues: #10640, #13611 Differential Revision: https://phabricator.haskell.org/D3498 >--------------------------------------------------------------- 244602697c30e03ba63076941e4742ceeb78dd7c compiler/prelude/primops.txt.pp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp index 8c9cc92..255235a 100644 --- a/compiler/prelude/primops.txt.pp +++ b/compiler/prelude/primops.txt.pp @@ -2382,6 +2382,11 @@ primtype Weak# b primop MkWeakOp "mkWeak#" GenPrimOp o -> b -> (State# RealWorld -> (# State# RealWorld, c #)) -> State# RealWorld -> (# State# RealWorld, Weak# b #) + { {\tt mkWeak# k v finalizer s} creates a weak reference to value {\tt k}, + with an associated reference to some value {\tt v}. If {\tt k} is still + alive then {\tt v} can be retrieved using {\tt deRefWeak#}. Note that + the type of {\tt k} must be represented by a pointer (i.e. of kind {\tt + TYPE 'LiftedRep} or {\tt TYPE 'UnliftedRep}). } with has_side_effects = True out_of_line = True From git at git.haskell.org Wed Apr 26 01:12:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 26 Apr 2017 01:12:02 +0000 (UTC) Subject: [commit: ghc] master: Add instances for Data.Ord.Down (47be644) Message-ID: <20170426011202.764FF3A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/47be6444d35783eea7dc3ab8b2f11626777cdbd8/ghc >--------------------------------------------------------------- commit 47be6444d35783eea7dc3ab8b2f11626777cdbd8 Author: Adam Sandberg Eriksson Date: Tue Apr 25 18:41:28 2017 -0400 Add instances for Data.Ord.Down Namely `Num`, `Functor`, `Applicative`, `Monad`, `Semigroup` and `Monoid` for `Data.Ord.Down` (#13097). Reviewers: austin, hvr, bgamari, RyanGlScott Reviewed By: bgamari, RyanGlScott Subscribers: RyanGlScott, rwbarton, thomie GHC Trac Issues: #13097 Differential Revision: https://phabricator.haskell.org/D3500 >--------------------------------------------------------------- 47be6444d35783eea7dc3ab8b2f11626777cdbd8 libraries/base/Data/Ord.hs | 26 +++++++++++++++++++--- libraries/base/Data/Semigroup.hs | 6 +++++ libraries/base/changelog.md | 4 ++++ libraries/base/tests/T13097.hs | 7 ++++++ .../base/tests/T13097.stdout | 0 libraries/base/tests/all.T | 1 + 6 files changed, 41 insertions(+), 3 deletions(-) diff --git a/libraries/base/Data/Ord.hs b/libraries/base/Data/Ord.hs index 767d7b3..11d6967 100644 --- a/libraries/base/Data/Ord.hs +++ b/libraries/base/Data/Ord.hs @@ -1,5 +1,6 @@ {-# LANGUAGE Trustworthy #-} {-# LANGUAGE NoImplicitPrelude #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} ----------------------------------------------------------------------------- -- | @@ -25,6 +26,7 @@ module Data.Ord ( import GHC.Base import GHC.Show import GHC.Read +import GHC.Num -- | -- > comparing p x y = compare (p x) (p y) @@ -43,11 +45,29 @@ comparing p x y = compare (p x) (p y) -- This is particularly useful when sorting in generalised list comprehensions, -- as in: @then sortWith by 'Down' x@ -- --- Provides 'Show' and 'Read' instances (/since: 4.7.0.0/). --- -- @since 4.6.0.0 -newtype Down a = Down a deriving (Eq, Show, Read) +newtype Down a = Down a + deriving + ( Eq + , Show -- ^ @since 4.7.0.0 + , Read -- ^ @since 4.7.0.0 + , Num -- ^ @since 4.11.0.0 + , Monoid -- ^ @since 4.11.0.0 + ) -- | @since 4.6.0.0 instance Ord a => Ord (Down a) where compare (Down x) (Down y) = y `compare` x + +-- | @since 4.11.0.0 +instance Functor Down where + fmap = coerce + +-- | @since 4.11.0.0 +instance Applicative Down where + pure = Down + (<*>) = coerce + +-- | @since 4.11.0.0 +instance Monad Down where + Down a >>= k = k a diff --git a/libraries/base/Data/Semigroup.hs b/libraries/base/Data/Semigroup.hs index e6bc314..ec68683 100644 --- a/libraries/base/Data/Semigroup.hs +++ b/libraries/base/Data/Semigroup.hs @@ -83,6 +83,7 @@ import Data.Monoid (All (..), Any (..), Dual (..), Endo (..), Product (..), Sum (..)) import Data.Monoid (Alt (..)) import qualified Data.Monoid as Monoid +import Data.Ord (Down(..)) import Data.Void #ifndef mingw32_HOST_OS import GHC.Event (Event, Lifetime) @@ -238,6 +239,11 @@ instance Semigroup Any where (<>) = coerce (||) stimes = stimesIdempotentMonoid +-- | @since 4.11.0.0 +instance Semigroup a => Semigroup (Down a) where + Down a <> Down b = Down (a <> b) + stimes n (Down a) = Down (stimes n a) + -- | @since 4.9.0.0 instance Num a => Semigroup (Sum a) where diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index e2e276a..69baab3 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -5,6 +5,10 @@ * Add `Alternative` instance for `ZipList` (#13520) + * Add instances `Num`, `Functor`, `Applicative`, `Monad`, `Semigroup` + and `Monoid` for `Data.Ord.Down` (#13097). + + ## 4.10.0.0 *April 2017* * Bundled with GHC *TBA* diff --git a/libraries/base/tests/T13097.hs b/libraries/base/tests/T13097.hs new file mode 100644 index 0000000..f51b7cf --- /dev/null +++ b/libraries/base/tests/T13097.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE TypeApplications #-} +import Data.Ord + +main :: IO () +main = do + print ((<) 10 20) + print ((<) @(Down _) 10 20) diff --git a/testsuite/tests/driver/recomp008/recomp008.stdout b/libraries/base/tests/T13097.stdout similarity index 100% copy from testsuite/tests/driver/recomp008/recomp008.stdout copy to libraries/base/tests/T13097.stdout diff --git a/libraries/base/tests/all.T b/libraries/base/tests/all.T index 33055f3..4bd8084 100644 --- a/libraries/base/tests/all.T +++ b/libraries/base/tests/all.T @@ -213,3 +213,4 @@ test('T13191', compile_and_run, ['-O']) test('T13525', when(opsys('mingw32'), skip), compile_and_run, ['']) +test('T13097', normal, compile_and_run, ['']) From git at git.haskell.org Wed Apr 26 16:27:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 26 Apr 2017 16:27:07 +0000 (UTC) Subject: [commit: hsc2hs] master: Bump upper bound on process (869942b) Message-ID: <20170426162707.6FA4E3A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hsc2hs On branch : master Link : http://git.haskell.org/hsc2hs.git/commitdiff/869942b831542a17614c1585b930495839f59146 >--------------------------------------------------------------- commit 869942b831542a17614c1585b930495839f59146 Author: Ben Gamari Date: Fri Apr 21 14:20:47 2017 -0400 Bump upper bound on process >--------------------------------------------------------------- 869942b831542a17614c1585b930495839f59146 hsc2hs.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hsc2hs.cabal b/hsc2hs.cabal index e76559b..e92d202 100644 --- a/hsc2hs.cabal +++ b/hsc2hs.cabal @@ -47,5 +47,5 @@ Executable hsc2hs containers >= 0.2 && < 0.6, directory >= 1 && < 1.4, filepath >= 1 && < 1.5, - process >= 1.1 && < 1.5 + process >= 1.1 && < 1.7 From git at git.haskell.org Wed Apr 26 16:57:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 26 Apr 2017 16:57:04 +0000 (UTC) Subject: [commit: hsc2hs] master: Bump version to 0.68.2 and prepare for release (e51c44d) Message-ID: <20170426165704.5008D3A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hsc2hs On branch : master Link : http://git.haskell.org/hsc2hs.git/commitdiff/e51c44d22a335e21fefe6f0148d2d43dfa482f28 >--------------------------------------------------------------- commit e51c44d22a335e21fefe6f0148d2d43dfa482f28 Author: Herbert Valerio Riedel Date: Wed Apr 26 18:56:21 2017 +0200 Bump version to 0.68.2 and prepare for release >--------------------------------------------------------------- e51c44d22a335e21fefe6f0148d2d43dfa482f28 changelog.md | 11 ++++++++++- hsc2hs.cabal | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 87cea62..7a211bc 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,13 @@ +## 0.68.2 + + - Support GHC 8.2.1 + + - Make `hsc_alignment` macro work in clang + ([D3346](https://phabricator.haskell.org/D3346)) + + - Track column numbers to improve GHC's caret diagnostic display + ([#13388](https://ghc.haskell.org/trac/ghc/ticket/13388)) + ## 0.68.1 - Fix type signature of generated `main` test function @@ -6,4 +16,3 @@ - Double-escape paths used to build call to `hsc_line` ([#12504](http://ghc.haskell.org/ticket/12504)) - diff --git a/hsc2hs.cabal b/hsc2hs.cabal index e92d202..0e17e71 100644 --- a/hsc2hs.cabal +++ b/hsc2hs.cabal @@ -1,5 +1,5 @@ Name: hsc2hs -Version: 0.68.1 +Version: 0.68.2 Copyright: 2000, Marcin Kowalczyk License: BSD3 License-File: LICENSE From git at git.haskell.org Wed Apr 26 17:02:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 26 Apr 2017 17:02:57 +0000 (UTC) Subject: [commit: hsc2hs] master: Use http:// git repo url (936b088) Message-ID: <20170426170257.58BA23A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hsc2hs On branch : master Link : http://git.haskell.org/hsc2hs.git/commitdiff/936b0885ee794db83dc8473e17e153936e56d62f >--------------------------------------------------------------- commit 936b0885ee794db83dc8473e17e153936e56d62f Author: Herbert Valerio Riedel Date: Wed Apr 26 19:02:28 2017 +0200 Use http:// git repo url >--------------------------------------------------------------- 936b0885ee794db83dc8473e17e153936e56d62f hsc2hs.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hsc2hs.cabal b/hsc2hs.cabal index 0e17e71..e8e2322 100644 --- a/hsc2hs.cabal +++ b/hsc2hs.cabal @@ -27,7 +27,7 @@ extra-source-files: changelog.md source-repository head Type: git - Location: git://git.haskell.org/hsc2hs + Location: http://git.haskell.org/hsc2hs.git Executable hsc2hs Default-Language: Haskell2010 From git at git.haskell.org Wed Apr 26 17:05:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 26 Apr 2017 17:05:02 +0000 (UTC) Subject: [commit: hsc2hs] tag 'v0.68.2' created Message-ID: <20170426170502.27E063A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hsc2hs New tag : v0.68.2 Referencing: 56e6b53a64f2586d98858ead2813e9bdb37a05c8 From git at git.haskell.org Wed Apr 26 18:16:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 26 Apr 2017 18:16:01 +0000 (UTC) Subject: [commit: ghc] master: Update hsc2hs submodule to 0.68.2 (350d268) Message-ID: <20170426181601.F29B93A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/350d268aa62543097d8ae3f81a7adf0d635d6688/ghc >--------------------------------------------------------------- commit 350d268aa62543097d8ae3f81a7adf0d635d6688 Author: Ben Gamari Date: Wed Apr 26 13:05:57 2017 -0400 Update hsc2hs submodule to 0.68.2 >--------------------------------------------------------------- 350d268aa62543097d8ae3f81a7adf0d635d6688 utils/hsc2hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/hsc2hs b/utils/hsc2hs index d7e49a6..936b088 160000 --- a/utils/hsc2hs +++ b/utils/hsc2hs @@ -1 +1 @@ -Subproject commit d7e49a6d90dbd3d8d0bbace9410fe8411a1c77bb +Subproject commit 936b0885ee794db83dc8473e17e153936e56d62f From git at git.haskell.org Wed Apr 26 20:04:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 26 Apr 2017 20:04:10 +0000 (UTC) Subject: [commit: ghc] master: Update Cabal submodule, with necessary wibbles. (579bb76) Message-ID: <20170426200410.37F913A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/579bb7669f40ed01841dd197ee535cf26fa19580/ghc >--------------------------------------------------------------- commit 579bb7669f40ed01841dd197ee535cf26fa19580 Author: Edward Z. Yang Date: Wed Apr 26 15:26:56 2017 -0400 Update Cabal submodule, with necessary wibbles. Test Plan: validate Reviewers: bgamari, austin Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3501 >--------------------------------------------------------------- 579bb7669f40ed01841dd197ee535cf26fa19580 compiler/backpack/DriverBkp.hs | 3 +-- compiler/main/Packages.hs | 2 +- libraries/Cabal | 2 +- libraries/ghc-boot/GHC/PackageDb.hs | 17 ++++++----------- .../tests/backpack/cabal/bkpcabal06/bkpcabal06.stderr | 4 ++-- utils/ghc-cabal/Main.hs | 3 ++- utils/ghc-pkg/Main.hs | 11 ++--------- 7 files changed, 15 insertions(+), 27 deletions(-) diff --git a/compiler/backpack/DriverBkp.hs b/compiler/backpack/DriverBkp.hs index d85b80d..db7b5f6 100644 --- a/compiler/backpack/DriverBkp.hs +++ b/compiler/backpack/DriverBkp.hs @@ -308,8 +308,7 @@ buildUnit session cid insts lunit = do packageName = compat_pn, packageVersion = makeVersion [0], unitId = toInstalledUnitId (thisPackage dflags), - mungedPackageName = Nothing, - libName = Nothing, + sourceLibName = Nothing, componentId = cid, instantiatedWith = insts, -- Slight inefficiency here haha diff --git a/compiler/main/Packages.hs b/compiler/main/Packages.hs index 10ef0d4..2c5833f 100644 --- a/compiler/main/Packages.hs +++ b/compiler/main/Packages.hs @@ -1940,7 +1940,7 @@ componentIdString :: DynFlags -> ComponentId -> Maybe String componentIdString dflags cid = do conf <- lookupInstalledPackage dflags (componentIdToInstalledUnitId cid) return $ - case libName conf of + case sourceLibName conf of Nothing -> sourcePackageIdString conf Just (PackageName libname) -> packageNameString conf diff --git a/libraries/Cabal b/libraries/Cabal index e4c36b9..41f416b 160000 --- a/libraries/Cabal +++ b/libraries/Cabal @@ -1 +1 @@ -Subproject commit e4c36b9dd51820f2380ce7a66f980c4e7b2e96fc +Subproject commit 41f416bc27796a3dc87037b66b6fef6f5810bc77 diff --git a/libraries/ghc-boot/GHC/PackageDb.hs b/libraries/ghc-boot/GHC/PackageDb.hs index ecd82dd..bf83d25 100644 --- a/libraries/ghc-boot/GHC/PackageDb.hs +++ b/libraries/ghc-boot/GHC/PackageDb.hs @@ -98,8 +98,7 @@ data InstalledPackageInfo compid srcpkgid srcpkgname instunitid unitid modulenam sourcePackageId :: srcpkgid, packageName :: srcpkgname, packageVersion :: Version, - mungedPackageName :: Maybe srcpkgname, - libName :: Maybe srcpkgname, + sourceLibName :: Maybe srcpkgname, abiHash :: String, depends :: [instunitid], -- | Like 'depends', but each dependency is annotated with the @@ -184,8 +183,7 @@ emptyInstalledPackageInfo = sourcePackageId = fromStringRep BS.empty, packageName = fromStringRep BS.empty, packageVersion = Version [] [], - mungedPackageName = Nothing, - libName = Nothing, + sourceLibName = Nothing, abiHash = "", depends = [], abiDepends = [], @@ -444,7 +442,7 @@ instance (RepInstalledPackageInfo a b c d e f g) => put (InstalledPackageInfo unitId componentId instantiatedWith sourcePackageId packageName packageVersion - mungedPackageName libName + sourceLibName abiHash depends abiDepends importDirs hsLibraries extraLibraries extraGHCiLibraries libraryDirs libraryDynDirs @@ -457,8 +455,7 @@ instance (RepInstalledPackageInfo a b c d e f g) => put (toStringRep sourcePackageId) put (toStringRep packageName) put packageVersion - put (fmap toStringRep mungedPackageName) - put (fmap toStringRep libName) + put (fmap toStringRep sourceLibName) put (toStringRep unitId) put (toStringRep componentId) put (map (\(mod_name, mod) -> (toStringRep mod_name, toDbModule mod)) @@ -491,8 +488,7 @@ instance (RepInstalledPackageInfo a b c d e f g) => sourcePackageId <- get packageName <- get packageVersion <- get - mungedPackageName <- get - libName <- get + sourceLibName <- get unitId <- get componentId <- get instantiatedWith <- get @@ -525,8 +521,7 @@ instance (RepInstalledPackageInfo a b c d e f g) => instantiatedWith) (fromStringRep sourcePackageId) (fromStringRep packageName) packageVersion - (fmap fromStringRep mungedPackageName) - (fmap fromStringRep libName) + (fmap fromStringRep sourceLibName) abiHash (map fromStringRep depends) (map (\(k,v) -> (fromStringRep k, v)) abiDepends) diff --git a/testsuite/tests/backpack/cabal/bkpcabal06/bkpcabal06.stderr b/testsuite/tests/backpack/cabal/bkpcabal06/bkpcabal06.stderr index 8998e65..937ec2f 100644 --- a/testsuite/tests/backpack/cabal/bkpcabal06/bkpcabal06.stderr +++ b/testsuite/tests/backpack/cabal/bkpcabal06/bkpcabal06.stderr @@ -1,4 +1,4 @@ sig/P.hsig:1:1: error: - • ‘p’ is exported by the hsig file, but not exported by the implementing module ‘z-bkpcabal06-z-impl-0.1.0.0:P’ - • while checking that z-bkpcabal06-z-impl-0.1.0.0:P implements signature P in bkpcabal06-0.1.0.0:sig[P=z-bkpcabal06-z-impl-0.1.0.0:P] + • ‘p’ is exported by the hsig file, but not exported by the implementing module ‘bkpcabal06-0.1.0.0:P’ + • while checking that bkpcabal06-0.1.0.0:P implements signature P in bkpcabal06-0.1.0.0:sig[P=bkpcabal06-0.1.0.0:P] diff --git a/utils/ghc-cabal/Main.hs b/utils/ghc-cabal/Main.hs index 608517e..8a1c2c1 100644 --- a/utils/ghc-cabal/Main.hs +++ b/utils/ghc-cabal/Main.hs @@ -20,6 +20,7 @@ import Distribution.Simple.Utils (defaultPackageDesc, writeFileAtomic, toUTF8) import Distribution.Simple.Build (writeAutogenFiles) import Distribution.Simple.Register import Distribution.Text +import Distribution.Types.MungedPackageId import Distribution.Verbosity import qualified Distribution.InstalledPackageInfo as Installed import qualified Distribution.Simple.PackageIndex as PackageIndex @@ -383,7 +384,7 @@ generate directory distdir dll0Modules config_args depLibNames | packageKeySupported comp = dep_ipids | otherwise = deps - depNames = map (display . packageName) dep_ids + depNames = map (display . mungedName) dep_ids transitive_dep_ids = map Installed.sourcePackageId dep_pkgs transitiveDeps = map display transitive_dep_ids diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs index ed73c29..9e18c97 100644 --- a/utils/ghc-pkg/Main.hs +++ b/utils/ghc-pkg/Main.hs @@ -1236,16 +1236,9 @@ convertPackageInfoToCacheFormat pkg = GhcPkg.componentId = installedComponentId pkg, GhcPkg.instantiatedWith = instantiatedWith pkg, GhcPkg.sourcePackageId = sourcePackageId pkg, - GhcPkg.packageName = - case sourcePackageName pkg of - Nothing -> packageName pkg - Just pn -> pn, + GhcPkg.packageName = packageName pkg, GhcPkg.packageVersion = Version.Version (versionNumbers (packageVersion pkg)) [], - GhcPkg.mungedPackageName = - case sourcePackageName pkg of - Nothing -> Nothing - Just _ -> Just (packageName pkg), - GhcPkg.libName = + GhcPkg.sourceLibName = fmap (mkPackageName . unUnqualComponentName) (sourceLibName pkg), GhcPkg.depends = depends pkg, GhcPkg.abiDepends = map (\(AbiDependency k v) -> (k,unAbiHash v)) (abiDepends pkg), From git at git.haskell.org Wed Apr 26 21:20:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 26 Apr 2017 21:20:41 +0000 (UTC) Subject: [commit: ghc] branch 'wip/rwbarton-dump' created Message-ID: <20170426212041.884483A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/rwbarton-dump Referencing: 36f12d183f8039c2e2ce7887ead867f82d17d7db From git at git.haskell.org Wed Apr 26 21:20:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 26 Apr 2017 21:20:44 +0000 (UTC) Subject: [commit: ghc] wip/rwbarton-dump: Revert "More fixes for #5654" (922f0ac) Message-ID: <20170426212044.550EF3A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rwbarton-dump Link : http://ghc.haskell.org/trac/ghc/changeset/922f0ac945e013342bd66e33c766ffc179260ce3/ghc >--------------------------------------------------------------- commit 922f0ac945e013342bd66e33c766ffc179260ce3 Author: Reid Barton Date: Fri Mar 24 15:20:38 2017 -0400 Revert "More fixes for #5654" This reverts commit 3a18baff06abc193569b1b76358da26375b3c8d6. >--------------------------------------------------------------- 922f0ac945e013342bd66e33c766ffc179260ce3 includes/stg/MiscClosures.h | 1 - rts/Apply.cmm | 27 -------- rts/Interpreter.c | 72 ++-------------------- rts/Printer.c | 5 -- rts/Profiling.c | 6 +- rts/StgMiscClosures.cmm | 10 --- testsuite/tests/codeGen/should_run/cgrun057.stderr | 2 +- .../tests/profiling/should_run/T680.prof.sample | 65 +++++++++---------- testsuite/tests/profiling/should_run/all.T | 3 +- .../should_run/toplevel_scc_1.prof.sample | 41 ++++++------ 10 files changed, 62 insertions(+), 170 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 922f0ac945e013342bd66e33c766ffc179260ce3 From git at git.haskell.org Wed Apr 26 21:20:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 26 Apr 2017 21:20:47 +0000 (UTC) Subject: [commit: ghc] wip/rwbarton-dump: Revert "Fix bug in previous fix for #5654" (98c6839) Message-ID: <20170426212047.0EA003A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rwbarton-dump Link : http://ghc.haskell.org/trac/ghc/changeset/98c6839fa056d25b2d6598193345897e77e352be/ghc >--------------------------------------------------------------- commit 98c6839fa056d25b2d6598193345897e77e352be Author: Reid Barton Date: Fri Mar 24 15:20:46 2017 -0400 Revert "Fix bug in previous fix for #5654" This reverts commit 2a02040b2e23daa4f791afc290c33c9bbe3c620c. >--------------------------------------------------------------- 98c6839fa056d25b2d6598193345897e77e352be rts/Apply.cmm | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/rts/Apply.cmm b/rts/Apply.cmm index b18c347..3a73ce0 100644 --- a/rts/Apply.cmm +++ b/rts/Apply.cmm @@ -57,7 +57,6 @@ stg_ap_0_fast ( P_ fun ) again: W_ info; W_ untaggedfun; - W_ arity; untaggedfun = UNTAG(fun); info = %INFO_PTR(untaggedfun); switch [INVALID_OBJECT .. N_CLOSURE_TYPES] @@ -69,11 +68,6 @@ again: fun = StgInd_indirectee(fun); goto again; } - case BCO: - { - arity = TO_W_(StgBCO_arity(untaggedfun)); - goto dofun; - } case FUN, FUN_1_0, @@ -81,10 +75,9 @@ again: FUN_2_0, FUN_1_1, FUN_0_2, - FUN_STATIC: + FUN_STATIC, + BCO: { - arity = TO_W_(StgFunInfoExtra_arity(%FUN_INFO(info))); - dofun: if (CCCS == StgHeader_ccs(untaggedfun)) { return (fun); } else { @@ -99,8 +92,10 @@ again: // attribute this allocation to the "overhead of profiling" CCS_ALLOC(BYTES_TO_WDS(SIZEOF_StgPAP), CCS_OVERHEAD); P_ pap; + W_ arity; pap = Hp - SIZEOF_StgPAP + WDS(1); SET_HDR(pap, stg_PAP_info, CCCS); + arity = TO_W_(StgFunInfoExtra_arity(%FUN_INFO(info))); StgPAP_arity(pap) = arity; StgPAP_fun(pap) = fun; StgPAP_n_args(pap) = 0; From git at git.haskell.org Wed Apr 26 21:20:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 26 Apr 2017 21:20:50 +0000 (UTC) Subject: [commit: ghc] wip/rwbarton-dump: Revert "Fix cost-centre-stacks bug (#5654)" (5e5679d) Message-ID: <20170426212050.555D43A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rwbarton-dump Link : http://ghc.haskell.org/trac/ghc/changeset/5e5679d1a55e1255a1d96d8dffdf1e08d3855675/ghc >--------------------------------------------------------------- commit 5e5679d1a55e1255a1d96d8dffdf1e08d3855675 Author: Reid Barton Date: Fri Mar 24 15:20:52 2017 -0400 Revert "Fix cost-centre-stacks bug (#5654)" This reverts commit 394231b301efb6b56654b0a480ab794fe3b7e4db. >--------------------------------------------------------------- 5e5679d1a55e1255a1d96d8dffdf1e08d3855675 compiler/codeGen/StgCmmClosure.hs | 6 +- includes/Cmm.h | 6 -- rts/Apply.cmm | 107 --------------------- .../profiling/should_run/T5654-O0.prof.sample | 28 ------ testsuite/tests/profiling/should_run/T5654-O1.hs | 14 --- .../profiling/should_run/T5654-O1.prof.sample | 27 ------ .../profiling/should_run/{T5654-O0.hs => T5654.hs} | 0 .../tests/profiling/should_run/T5654.prof.sample | 28 ++++++ .../tests/profiling/should_run/T680.prof.sample | 50 +++++----- testsuite/tests/profiling/should_run/all.T | 4 +- 10 files changed, 56 insertions(+), 214 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 5e5679d1a55e1255a1d96d8dffdf1e08d3855675 From git at git.haskell.org Wed Apr 26 21:20:53 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 26 Apr 2017 21:20:53 +0000 (UTC) Subject: [commit: ghc] wip/rwbarton-dump: RTS Printer tweaks (bc66c91) Message-ID: <20170426212053.0B8A93A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rwbarton-dump Link : http://ghc.haskell.org/trac/ghc/changeset/bc66c9139b1f4a8a3f96e0bb27fd781de101592a/ghc >--------------------------------------------------------------- commit bc66c9139b1f4a8a3f96e0bb27fd781de101592a Author: Reid Barton Date: Wed Apr 26 17:18:00 2017 -0400 RTS Printer tweaks >--------------------------------------------------------------- bc66c9139b1f4a8a3f96e0bb27fd781de101592a rts/Printer.c | 48 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 9 deletions(-) diff --git a/rts/Printer.c b/rts/Printer.c index f23e0b0..c0d79ab 100644 --- a/rts/Printer.c +++ b/rts/Printer.c @@ -22,11 +22,13 @@ #endif #include +#include #ifdef DEBUG #include "Disassembler.h" #include "Apply.h" +#include "Libdw.h" /* -------------------------------------------------------------------------- * local function decls @@ -56,11 +58,31 @@ void printObj( StgClosure *obj ) printClosure(obj); } +static void printFunInfo(StgPtr info) +{ +#if USE_LIBDW + static LibdwSession *session = NULL; + static HashTable *ht = NULL; + if (session == NULL) + session = libdwInit(); + if (ht == NULL) + ht = allocHashTable(); + Location *l; + if (!(l = lookupHashTable(ht, (StgWord)info))) { + l = malloc(sizeof(Location)); + libdwLookupLocation(session, l, info); + insertHashTable(ht, (StgWord)info, l); + } + debugBelch("<%s %d:%d>", l->source_file ? l->source_file : "?", l->lineno, l->colno); +#endif +} + STATIC_INLINE void printStdObjHdr( const StgClosure *obj, char* tag ) { debugBelch("%s(",tag); printPtr((StgPtr)obj->header.info); + printFunInfo((StgPtr)obj->header.info); #ifdef PROFILING debugBelch(", %s", obj->header.prof.ccs->cc->label); #endif @@ -78,7 +100,7 @@ printStdObjPayload( const StgClosure *obj ) printPtr((StgPtr)obj->payload[i]); } for (j = 0; j < info->layout.payload.nptrs; ++j) { - debugBelch(", %pd#",obj->payload[i+j]); + debugBelch(", %p#",obj->payload[i+j]); } debugBelch(")\n"); } @@ -95,7 +117,7 @@ printThunkPayload( StgThunk *obj ) printPtr((StgPtr)obj->payload[i]); } for (j = 0; j < info->layout.payload.nptrs; ++j) { - debugBelch(", %pd#",obj->payload[i+j]); + debugBelch(", %p#",obj->payload[i+j]); } debugBelch(")\n"); } @@ -146,6 +168,7 @@ printClosure( const StgClosure *obj ) case FUN_STATIC: debugBelch("FUN/%d(",(int)itbl_to_fun_itbl(info)->f.arity); printPtr((StgPtr)obj->header.info); + printFunInfo((StgPtr)obj->header.info); #ifdef PROFILING debugBelch(", %s", obj->header.prof.ccs->cc->label); #endif @@ -169,14 +192,10 @@ printClosure( const StgClosure *obj ) case THUNK_1_1: case THUNK_0_2: case THUNK_2_0: case THUNK_STATIC: /* ToDo: will this work for THUNK_STATIC too? */ -#ifdef PROFILING - printThunkObject((StgThunk *)obj,GET_PROF_DESC(info)); -#else printThunkObject((StgThunk *)obj,"THUNK"); -#endif break; - case THUNK_SELECTOR: + case THUNK_SELECTOR: /* TODO: Print which field we are selecting */ printStdObjHdr(obj, "THUNK_SELECTOR"); debugBelch(", %p)\n", ((StgSelector *)obj)->selectee); break; @@ -294,8 +313,10 @@ printClosure( const StgClosure *obj ) { StgWord i; debugBelch("ARR_WORDS(\""); - for (i=0; ipayload[i]); + for (i=0; ipayload))[i]; + debugBelch("%c", (iscntrl(c) || isspace(c)) ? '.' : c); + } debugBelch("\")\n"); break; } @@ -312,6 +333,10 @@ printClosure( const StgClosure *obj ) debugBelch("MUT_ARR_PTRS_FROZEN(size=%" FMT_Word ")\n", (W_)((StgMutArrPtrs *)obj)->ptrs); break; + case MUT_ARR_PTRS_FROZEN0: + debugBelch("MUT_ARR_PTRS_FROZEN0(size=%" FMT_Word ")\n", (W_)((StgMutArrPtrs *)obj)->ptrs); + break; + case SMALL_MUT_ARR_PTRS_CLEAN: debugBelch("SMALL_MUT_ARR_PTRS_CLEAN(size=%" FMT_Word ")\n", (W_)((StgSmallMutArrPtrs *)obj)->ptrs); @@ -327,6 +352,11 @@ printClosure( const StgClosure *obj ) (W_)((StgSmallMutArrPtrs *)obj)->ptrs); break; + case SMALL_MUT_ARR_PTRS_FROZEN0: + debugBelch("SMALL_MUT_ARR_PTRS_FROZEN0(size=%" FMT_Word ")\n", + (W_)((StgSmallMutArrPtrs *)obj)->ptrs); + break; + case MVAR_CLEAN: case MVAR_DIRTY: { From git at git.haskell.org Wed Apr 26 21:20:57 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 26 Apr 2017 21:20:57 +0000 (UTC) Subject: [commit: ghc] wip/rwbarton-dump: WIP: Recursively dump heap objects (36f12d1) Message-ID: <20170426212057.1972B3A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rwbarton-dump Link : http://ghc.haskell.org/trac/ghc/changeset/36f12d183f8039c2e2ce7887ead867f82d17d7db/ghc >--------------------------------------------------------------- commit 36f12d183f8039c2e2ce7887ead867f82d17d7db Author: Reid Barton Date: Wed Apr 26 17:19:36 2017 -0400 WIP: Recursively dump heap objects The new files are copies of Scav.* with minimal changes. dump_closure is the entry point to dump a heap object. >--------------------------------------------------------------- 36f12d183f8039c2e2ce7887ead867f82d17d7db rts/sm/{Scav.c => Trav.c} | 581 +++++++++++++++++++--------------------------- rts/sm/{Scav.h => Trav.h} | 15 +- 2 files changed, 246 insertions(+), 350 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 36f12d183f8039c2e2ce7887ead867f82d17d7db From git at git.haskell.org Thu Apr 27 19:05:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 27 Apr 2017 19:05:22 +0000 (UTC) Subject: [commit: ghc] master: Bump process to 1.6 (2744c94) Message-ID: <20170427190522.6AF693A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2744c94124a0cfe18e589974e77b0283b28f210f/ghc >--------------------------------------------------------------- commit 2744c94124a0cfe18e589974e77b0283b28f210f Author: Ben Gamari Date: Fri Apr 21 12:45:40 2017 -0400 Bump process to 1.6 Also bumps Cabal submodule due to version bound bump. >--------------------------------------------------------------- 2744c94124a0cfe18e589974e77b0283b28f210f compiler/ghc.cabal.in | 2 +- ghc/ghc-bin.cabal.in | 2 +- libraries/process | 2 +- utils/ghc-pkg/ghc-pkg.cabal | 2 +- utils/runghc/runghc.cabal.in | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in index 1c9c6c6..e1d44c1 100644 --- a/compiler/ghc.cabal.in +++ b/compiler/ghc.cabal.in @@ -52,7 +52,7 @@ Library Build-Depends: base >= 4 && < 5, deepseq >= 1.4 && < 1.5, directory >= 1 && < 1.4, - process >= 1 && < 1.5, + process >= 1 && < 1.7, bytestring >= 0.9 && < 0.11, binary == 0.8.*, time >= 1.4 && < 1.9, diff --git a/ghc/ghc-bin.cabal.in b/ghc/ghc-bin.cabal.in index 0f50453..b04c13a 100644 --- a/ghc/ghc-bin.cabal.in +++ b/ghc/ghc-bin.cabal.in @@ -32,7 +32,7 @@ Executable ghc array >= 0.1 && < 0.6, bytestring >= 0.9 && < 0.11, directory >= 1 && < 1.4, - process >= 1 && < 1.5, + process >= 1 && < 1.7, filepath >= 1 && < 1.5, ghc-boot == @ProjectVersionMunged@, ghc == @ProjectVersionMunged@ diff --git a/libraries/process b/libraries/process index 0524859..88547b0 160000 --- a/libraries/process +++ b/libraries/process @@ -1 +1 @@ -Subproject commit 0524859137fc01bdb2a4833fd0aa6b23a48c6b15 +Subproject commit 88547b0fae8644f8f69be32c7ee5a3b76051c82f diff --git a/utils/ghc-pkg/ghc-pkg.cabal b/utils/ghc-pkg/ghc-pkg.cabal index 8776cb9..4b1aae7 100644 --- a/utils/ghc-pkg/ghc-pkg.cabal +++ b/utils/ghc-pkg/ghc-pkg.cabal @@ -28,7 +28,7 @@ Executable ghc-pkg Build-Depends: base >= 4 && < 5, directory >= 1 && < 1.4, - process >= 1 && < 1.5, + process >= 1 && < 1.7, containers, filepath, Cabal, diff --git a/utils/runghc/runghc.cabal.in b/utils/runghc/runghc.cabal.in index 3be9f26..ffe7575 100644 --- a/utils/runghc/runghc.cabal.in +++ b/utils/runghc/runghc.cabal.in @@ -28,7 +28,7 @@ Executable runghc Build-Depends: base >= 3 && < 5, directory >= 1 && < 1.4, - process >= 1 && < 1.5, + process >= 1 && < 1.7, filepath if !os(windows) From git at git.haskell.org Thu Apr 27 20:09:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 27 Apr 2017 20:09:51 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Update haddock submodule (7d73ec6) Message-ID: <20170427200951.80BBD3A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/7d73ec674e1a420a4ffa0a62f59e2609d9e4dec6/ghc >--------------------------------------------------------------- commit 7d73ec674e1a420a4ffa0a62f59e2609d9e4dec6 Author: Ben Gamari Date: Sun Apr 23 09:49:33 2017 -0400 Update haddock submodule >--------------------------------------------------------------- 7d73ec674e1a420a4ffa0a62f59e2609d9e4dec6 utils/haddock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/haddock b/utils/haddock index 0567d93..7ec72d3 160000 --- a/utils/haddock +++ b/utils/haddock @@ -1 +1 @@ -Subproject commit 0567d936e02dcbc41c62b4dd63c7aaafc3383844 +Subproject commit 7ec72d3ad81657f5a5298ac1465229fa7cafb35c From git at git.haskell.org Thu Apr 27 20:09:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 27 Apr 2017 20:09:54 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Minor reordering of `#include`s fixing compilation on AIX (fe80c31) Message-ID: <20170427200954.3DA0B3A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/fe80c3128bb0ccf861e355f60bf332469320f210/ghc >--------------------------------------------------------------- commit fe80c3128bb0ccf861e355f60bf332469320f210 Author: Herbert Valerio Riedel Date: Sun Apr 23 15:28:52 2017 +0200 Minor reordering of `#include`s fixing compilation on AIX This helps ensure that system includes on some more fragile platforms (like e.g. AIX) see a more consistent set of CPP defines, and consequently reduce the risk of conflicting typdefs/prototypes being exposed. (cherry picked from commit 0d975a623d6ad51ceb34bdb218a2d0f4a0448de6) >--------------------------------------------------------------- fe80c3128bb0ccf861e355f60bf332469320f210 rts/PathUtils.c | 6 +++--- rts/linker/LoadArchive.c | 5 ++--- rts/sm/CNF.c | 3 ++- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/rts/PathUtils.c b/rts/PathUtils.c index f27e03f..1b0b729 100644 --- a/rts/PathUtils.c +++ b/rts/PathUtils.c @@ -1,10 +1,10 @@ -#include -#include - #include #include "RtsUtils.h" #include "PathUtils.h" +#include +#include + #include #include diff --git a/rts/linker/LoadArchive.c b/rts/linker/LoadArchive.c index f9997cf..4d6b2fe 100644 --- a/rts/linker/LoadArchive.c +++ b/rts/linker/LoadArchive.c @@ -1,6 +1,3 @@ -#include -#include - #include #include "PathUtils.h" @@ -20,6 +17,8 @@ # include #endif +#include +#include #include #define FAIL(...) do {\ diff --git a/rts/sm/CNF.c b/rts/sm/CNF.c index 624dba3..ed9460e 100644 --- a/rts/sm/CNF.c +++ b/rts/sm/CNF.c @@ -11,7 +11,6 @@ #define _GNU_SOURCE #include "PosixSource.h" -#include #include "Rts.h" #include "RtsUtils.h" @@ -25,6 +24,8 @@ #include "Trace.h" #include "sm/ShouldCompact.h" +#include + #ifdef HAVE_UNISTD_H #include #endif From git at git.haskell.org Thu Apr 27 20:09:56 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 27 Apr 2017 20:09:56 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: aclocal.m4: treat '*-w64-mingw32' targets as windows (9fa02be) Message-ID: <20170427200957.003FF3A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/9fa02bebfb0636160610dbef217ba03419cf004e/ghc >--------------------------------------------------------------- commit 9fa02bebfb0636160610dbef217ba03419cf004e Author: Sergei Trofimovich Date: Sun Apr 23 11:25:29 2017 +0100 aclocal.m4: treat '*-w64-mingw32' targets as windows Noticed when tried to cross-compile GHC from x86_64-linux to --target=i686-w64-mingw32. Final ghc executables did not have '.exe' extensions. Signed-off-by: Sergei Trofimovich (cherry picked from commit fe37e2c6ab9dae6a522735114fea4dde9509250f) >--------------------------------------------------------------- 9fa02bebfb0636160610dbef217ba03419cf004e aclocal.m4 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/aclocal.m4 b/aclocal.m4 index 2062b0d..fa32b6d 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -14,7 +14,8 @@ AC_DEFUN([GHC_SELECT_FILE_EXTENSIONS], AC_MSG_WARN([I'm assuming you wanted to build for i386-unknown-mingw32]) exit 1 ;; - *-unknown-mingw32) + # examples: i386-unknown-mingw32, i686-w64-mingw32, x86_64-w64-mingw32 + *-mingw32) windows=YES $2='.exe' $3='.dll' From git at git.haskell.org Thu Apr 27 20:09:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 27 Apr 2017 20:09:59 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: rts: tweak cross-compilation to mingw32 (d8d810e) Message-ID: <20170427200959.B71593A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/d8d810e281b94e387e541bcd0747e2d0474de908/ghc >--------------------------------------------------------------- commit d8d810e281b94e387e541bcd0747e2d0474de908 Author: Sergei Trofimovich Date: Sun Apr 23 11:44:45 2017 +0100 rts: tweak cross-compilation to mingw32 Found the problem on x86_64-linux host where I tried to cross-compile GHC to windows as: $ ./configure --target=i686-w64-mingw32 \ Windres=i686-w64-mingw32-windres \ DllWrap=i686-w64-mingw32-dllwrap As a result build failed as POSIX bits of RTS. For example 'rts/posix/OSMem.c' contains unix-specific mmap() syscalls and constants and thus can't be compiled by i686-w64-mingw32 toolchain. It's caused by the following part of 'rts/ghc.mk': ifeq "$(HostOS_CPP)" "mingw32" ALL_DIRS += win32 else ALL_DIRS += posix endif In our case _CPP variables are defined this way (project.mk): BuildOS_CPP = linux HostOS_CPP = linux TargetOS_CPP = mingw32 RTS should never be built for 'BuildOS' or 'HostOS' as it's always built by ghc-stage1 (targeted at TargetOS). The change is to flip 'HostOS_CPP' to 'TargetOS_CPP' in 'rts/ghc.mk'. Signed-off-by: Sergei Trofimovich (cherry picked from commit 745032dd02da511067c2939259ed212852187e0f) >--------------------------------------------------------------- d8d810e281b94e387e541bcd0747e2d0474de908 rts/ghc.mk | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rts/ghc.mk b/rts/ghc.mk index b756d94..4842c34 100644 --- a/rts/ghc.mk +++ b/rts/ghc.mk @@ -39,7 +39,7 @@ $(eval $(call all-target,rts,$(ALL_RTS_LIBS))) ALL_DIRS = hooks sm eventlog linker -ifeq "$(HostOS_CPP)" "mingw32" +ifeq "$(TargetOS_CPP)" "mingw32" ALL_DIRS += win32 else ALL_DIRS += posix @@ -92,7 +92,7 @@ rts/dist/libs.depend : $$(ghc-pkg_INPLACE) | $$(dir $$@)/. # These are made from rts/win32/libHS*.def which contain lists of # all the symbols in those libraries used by the RTS. # -ifeq "$(HostOS_CPP)" "mingw32" +ifeq "$(TargetOS_CPP)" "mingw32" ALL_RTS_DEF_LIBNAMES = base ghc-prim ALL_RTS_DEF_LIBS = \ @@ -116,7 +116,7 @@ endif ifneq "$(BINDIST)" "YES" ifneq "$(UseSystemLibFFI)" "YES" -ifeq "$(HostOS_CPP)" "mingw32" +ifeq "$(TargetOS_CPP)" "mingw32" rts/dist/build/$(LIBFFI_DLL): libffi/build/inst/bin/$(LIBFFI_DLL) cp $< $@ else @@ -147,7 +147,7 @@ rts_dist_$1_CC_OPTS += -fno-omit-frame-pointer -g -O0 endif ifneq "$$(findstring dyn, $1)" "" -ifeq "$$(HostOS_CPP)" "mingw32" +ifeq "$$(TargetOS_CPP)" "mingw32" rts_dist_$1_CC_OPTS += -DCOMPILING_WINDOWS_DLL endif rts_dist_$1_CC_OPTS += -DDYNAMIC @@ -197,7 +197,7 @@ endif # Making a shared library for the RTS. ifneq "$$(findstring dyn, $1)" "" -ifeq "$$(HostOS_CPP)" "mingw32" +ifeq "$$(TargetOS_CPP)" "mingw32" $$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(ALL_RTS_DEF_LIBS) rts/dist/libs.depend rts/dist/build/$$(LIBFFI_DLL) "$$(RM)" $$(RM_OPTS) $$@ "$$(rts_dist_HC)" -this-unit-id rts -shared -dynamic -dynload deploy \ From git at git.haskell.org Thu Apr 27 20:10:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 27 Apr 2017 20:10:02 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: configure.ac: print resolved 'ar' and 'ranlib' tools (45912ea) Message-ID: <20170427201002.71DBB3A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/45912ea62008eca95ef375bf119040fb294c42d5/ghc >--------------------------------------------------------------- commit 45912ea62008eca95ef375bf119040fb294c42d5 Author: Sergei Trofimovich Date: Mon Apr 17 09:40:17 2017 +0100 configure.ac: print resolved 'ar' and 'ranlib' tools Signed-off-by: Sergei Trofimovich (cherry picked from commit 1ca188c74e70661419499e78be5b0a4998c85dea) >--------------------------------------------------------------- 45912ea62008eca95ef375bf119040fb294c42d5 configure.ac | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure.ac b/configure.ac index 38eb5ee..22972c3 100644 --- a/configure.ac +++ b/configure.ac @@ -1237,9 +1237,11 @@ echo "\ Unregisterised : $Unregisterised hs-cpp : $HaskellCPPCmd hs-cpp-flags : $HaskellCPPArgs + ar : $ArCmd ld : $LdCmd nm : $NmCmd objdump : $ObjdumpCmd + ranlib : $RanlibCmd Happy : $HappyCmd ($HappyVersion) Alex : $AlexCmd ($AlexVersion) Perl : $PerlCmd From git at git.haskell.org Thu Apr 27 20:10:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 27 Apr 2017 20:10:05 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: configure.ac: print paths to dllwrap and windres (fa0110b) Message-ID: <20170427201005.2AE483A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/fa0110b5d6d0b4d518309ebc0fe5d309d97447d6/ghc >--------------------------------------------------------------- commit fa0110b5d6d0b4d518309ebc0fe5d309d97447d6 Author: Sergei Trofimovich Date: Sun Apr 23 11:22:44 2017 +0100 configure.ac: print paths to dllwrap and windres Signed-off-by: Sergei Trofimovich (cherry picked from commit 58a656956f707719a76654f7f2c45e8b8a108c9b) >--------------------------------------------------------------- fa0110b5d6d0b4d518309ebc0fe5d309d97447d6 configure.ac | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure.ac b/configure.ac index 22972c3..5ff54d8 100644 --- a/configure.ac +++ b/configure.ac @@ -1242,6 +1242,8 @@ echo "\ nm : $NmCmd objdump : $ObjdumpCmd ranlib : $RanlibCmd + windres : $Windres + dllwrap : $DllWrap Happy : $HappyCmd ($HappyVersion) Alex : $AlexCmd ($AlexVersion) Perl : $PerlCmd From git at git.haskell.org Thu Apr 27 20:10:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 27 Apr 2017 20:10:10 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: ghc.mk: fix 'make install' for cross-mingw32 (c82add7) Message-ID: <20170427201010.9D8B83A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/c82add780b048943b3fac9a096eb2aaf838cc10a/ghc >--------------------------------------------------------------- commit c82add780b048943b3fac9a096eb2aaf838cc10a Author: Sergei Trofimovich Date: Sun Apr 23 15:31:13 2017 +0100 ghc.mk: fix 'make install' for cross-mingw32 Attempt to install cross-compiled mingw32 GHC built on linux failed as: $ make install DESTDIR=$(pwd)/__i__ "mv" "$(pwd)/__i__/usr/local/lib/ghc-8.3.20170422/bin/ghc-stage2" \ "$(pwd)/__i__/usr/local/lib/ghc-8.3.20170422/bin/ghc" mv: failed to stat '$(pwd)/__i__/usr/local/lib/ghc-8.3.20170422/bin/ghc-stage2': \ No such file or directory The rename should not be performed for windows targets. Signed-off-by: Sergei Trofimovich (cherry picked from commit 74e5ec9e63ff40bb8d52041cdc2f602d9bf12eb8) >--------------------------------------------------------------- c82add780b048943b3fac9a096eb2aaf838cc10a ghc.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ghc.mk b/ghc.mk index caa6c38..813b3f5 100644 --- a/ghc.mk +++ b/ghc.mk @@ -924,7 +924,7 @@ ifneq "$(INSTALL_LIBEXECS)" "" done # We rename ghc-stage2, so that the right program name is used in error # messages etc. -ifeq "$(Windows_Host)" "NO" +ifeq "$(Windows_Target)" "NO" "$(MV)" "$(DESTDIR)$(ghclibexecdir)/bin/ghc-stage$(INSTALL_GHC_STAGE)" "$(DESTDIR)$(ghclibexecdir)/bin/ghc" endif endif From git at git.haskell.org Thu Apr 27 20:10:07 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 27 Apr 2017 20:10:07 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Use non-canocalized triple as cross-compiler prefix (83b7f9f) Message-ID: <20170427201007.DB9143A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/83b7f9f5d2e1bffb1181f4ccad19678120a3cac6/ghc >--------------------------------------------------------------- commit 83b7f9f5d2e1bffb1181f4ccad19678120a3cac6 Author: Sergei Trofimovich Date: Thu Apr 6 08:51:22 2017 +0100 Use non-canocalized triple as cross-compiler prefix I've noticed the problem when tried to install cross-compiler using following configuration: $ ./configure --target=s390x-unknown-linux-gnu make install Stage1Only=YES Instead of expected tool prefix 's390x-unknown-linux-gnu-' Result was: 's390x-ibm-linux-gnu-' It's problematic as installed binaries appear in unpredictable location. The problem is caused by use of ${target} autoconf variable. ${target} contains a canocalized triplet. Luckily we already have non-canonucalized target triplet in ${TargetPlatformFull} variable. The change uses that instead. Signed-off-by: Sergei Trofimovich (cherry picked from commit 844704b4883e1d603a5048ddc6cbad737ba8d9e8) >--------------------------------------------------------------- 83b7f9f5d2e1bffb1181f4ccad19678120a3cac6 configure.ac | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index ec567ac..38eb5ee 100644 --- a/configure.ac +++ b/configure.ac @@ -425,12 +425,6 @@ with a cross-compiler. To cross-compile GHC itself, set TARGET: stage GHC. ]) fi -if test "$CrossCompiling" = "YES" -then - CrossCompilePrefix="${target}-" -else - CrossCompilePrefix="" -fi # Despite its similarity in name to TargetPlatform, TargetPlatformFull is used # in calls to subproject configure scripts and thus must be set to the autoconf # triple, not the normalized GHC triple that TargetPlatform is set to. @@ -446,6 +440,8 @@ fi # all be taken care of for us if we configured the subprojects using # AC_CONFIG_DIR, but unfortunately Cabal needs to be the one to do the # configuration. +# +# We also use non-canonicalized triple when install stage1 crosscompiler if test -z "${target_alias}" then # --target wasn't given; use result from AC_CANONICAL_TARGET @@ -453,6 +449,13 @@ then else TargetPlatformFull="${target_alias}" fi +if test "$CrossCompiling" = "YES" +then + # Use value passed by user from --target= + CrossCompilePrefix="${TargetPlatformFull}-" +else + CrossCompilePrefix="" +fi AC_SUBST(CrossCompiling) AC_SUBST(CrossCompilePrefix) AC_SUBST(TargetPlatformFull) From git at git.haskell.org Thu Apr 27 20:10:13 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 27 Apr 2017 20:10:13 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Export function for use in GHC API (2201cfb) Message-ID: <20170427201013.562613A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/2201cfbc230128f0b4c6aca32890989c63e737c6/ghc >--------------------------------------------------------------- commit 2201cfbc230128f0b4c6aca32890989c63e737c6 Author: Alan Zimmerman Date: Sun Apr 23 18:53:33 2017 +0200 Export function for use in GHC API (cherry picked from commit 1f4fd37efac4795493677d5df81c83d22eac5f74) >--------------------------------------------------------------- 2201cfbc230128f0b4c6aca32890989c63e737c6 compiler/main/GhcMake.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/main/GhcMake.hs b/compiler/main/GhcMake.hs index 3912ac5..f234391 100644 --- a/compiler/main/GhcMake.hs +++ b/compiler/main/GhcMake.hs @@ -26,7 +26,8 @@ module GhcMake( findExtraSigImports, implicitRequirements, - noModError, cyclicModuleErr + noModError, cyclicModuleErr, + moduleGraphNodes, SummaryNode ) where #include "HsVersions.h" From git at git.haskell.org Thu Apr 27 20:10:16 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 27 Apr 2017 20:10:16 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: ghc: tweak cross-compilation to mingw32 (0992af5) Message-ID: <20170427201016.11FE63A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/0992af5f68bdcfa82ee02a1047ffd19a09468736/ghc >--------------------------------------------------------------- commit 0992af5f68bdcfa82ee02a1047ffd19a09468736 Author: Sergei Trofimovich Date: Sun Apr 23 15:10:26 2017 +0100 ghc: tweak cross-compilation to mingw32 The build failure when cross-compiling from linux to windows looks like: HC [stage 1] ghc/stage2/build/tmp/ghc-stage2.exe Call hs_init_ghc() from your main() function to set these options. /usr/libexec/gcc/i686-w64-mingw32/ld: cannot find -lHSghc-8.3-0 Similar to commit 745032dd02da511067c2939259ed212852187e0f ("rts: tweak cross-compilation to mingw32") decision to split stage2 should be done based based on TargetOS, not HostOS. Signed-off-by: Sergei Trofimovich (cherry picked from commit 8908ba31c4dcb6ce619ec46e88fbbac78651a04b) >--------------------------------------------------------------- 0992af5f68bdcfa82ee02a1047ffd19a09468736 rules/build-package-way.mk | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rules/build-package-way.mk b/rules/build-package-way.mk index 8f61a35..24961a0 100644 --- a/rules/build-package-way.mk +++ b/rules/build-package-way.mk @@ -27,7 +27,7 @@ $1_$2_$3_LIB_FILE = libHS$$($1_$2_COMPONENT_ID)$$($3_libsuf) $1_$2_$3_LIB = $1/$2/build/$$($1_$2_$3_LIB_FILE) $$($1_$2_COMPONENT_ID)_$2_$3_LIB = $$($1_$2_$3_LIB) -ifeq "$$(HostOS_CPP)" "mingw32" +ifeq "$$(TargetOS_CPP)" "mingw32" ifneq "$$($1_$2_dll0_HS_OBJS)" "" $1_$2_$3_LIB0_ROOT = HS$$($1_$2_COMPONENT_ID)-0$$($3_libsuf) $1_$2_$3_LIB0_NAME = lib$$($1_$2_$3_LIB0_ROOT) @@ -75,7 +75,7 @@ $1/$2/dll-split.stamp: $$($1_$2_depfile_haskell) $$$$(dll-split_INPLACE) # Link a dynamic library # On windows we have to supply the extra libs this one links to when building it. -ifeq "$$(HostOS_CPP)" "mingw32" +ifeq "$$(TargetOS_CPP)" "mingw32" $$($1_$2_$3_LIB) : $$($1_$2_$3_ALL_OBJS) $$(ALL_RTS_LIBS) $$($1_$2_$3_DEPS_LIBS) ifneq "$$($1_$2_$3_LIB0)" "" $$(call build-dll,$1,$2,$3,-L$1/$2/build -l$$($1_$2_$3_LIB0_ROOT),$$(filter-out $$($1_$2_dll0_HS_OBJS),$$($1_$2_$3_HS_OBJS)) $$($1_$2_$3_NON_HS_OBJS),$$@) @@ -89,14 +89,14 @@ $$($1_$2_$3_LIB0) : $$($1_$2_$3_ALL_OBJS) $$(ALL_RTS_LIBS) $$($1_$2_$3_DEPS_LIBS $$(call build-dll,$1,$2,$3,,$$($1_$2_dll0_HS_OBJS) $$($1_$2_$3_NON_HS_OBJS),$$($1_$2_$3_LIB0)) endif -else # ifneq "$$(HostOS_CPP)" "mingw32" +else # ifneq "$$(TargetOS_CPP)" "mingw32" $$($1_$2_$3_LIB) : $$($1_$2_$3_ALL_OBJS) $$(ALL_RTS_LIBS) $$($1_$2_$3_DEPS_LIBS) $$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) $$($1_$2_$3_GHC_LD_OPTS) $$($1_$2_$3_ALL_OBJS) \ -shared -dynamic -dynload deploy \ $$(addprefix -l,$$($1_$2_EXTRA_LIBRARIES)) $$(addprefix -L,$$($1_$2_EXTRA_LIBDIRS)) \ -no-auto-link-packages \ -o $$@ -endif # "$$(HostOS_CPP)" "mingw32" +endif # "$$(TargetOS_CPP)" "mingw32" else # ifneq "$3" "dyn" @@ -116,7 +116,7 @@ else endif $$(call removeFiles,$$@.contents) -ifeq "$$(HostOS_CPP)" "mingw32" +ifeq "$$(TargetOS_CPP)" "mingw32" ifneq "$$($1_$2_$3_LIB0)" "" $$($1_$2_$3_LIB) : $$($1_$2_$3_LIB0) $$($1_$2_$3_LIB0) : From git at git.haskell.org Thu Apr 27 20:10:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 27 Apr 2017 20:10:22 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Document the kind generalization behavior observed in #13555 (3b4af97) Message-ID: <20170427201022.2A5E03A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/3b4af97b77a0ca21a29cc9829ccfab6871be035f/ghc >--------------------------------------------------------------- commit 3b4af97b77a0ca21a29cc9829ccfab6871be035f Author: Ryan Scott Date: Sun Apr 23 10:02:45 2017 -0400 Document the kind generalization behavior observed in #13555 The conclusion of #13555 was that a program which began to fail to typecheck (starting in GHC 8.2) was never correct to begin with. Let's document why this is the case with respect to `MonoLocalBinds`' interaction with kind generalization. Also adds the reported program as a `compile_fail` testcase. Test Plan: make test TEST=T13555 # Also, read the docs Reviewers: goldfire, simonpj, austin, bgamari Reviewed By: goldfire, simonpj, bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #13555 Differential Revision: https://phabricator.haskell.org/D3472 (cherry picked from commit 18c3a7ea0f7577514721feadefd9a62c228edb60) >--------------------------------------------------------------- 3b4af97b77a0ca21a29cc9829ccfab6871be035f docs/users_guide/8.2.1-notes.rst | 5 ++++ docs/users_guide/glasgow_exts.rst | 43 +++++++++++++++++++++++++++++++++ testsuite/tests/polykinds/T13555.hs | 26 ++++++++++++++++++++ testsuite/tests/polykinds/T13555.stderr | 40 ++++++++++++++++++++++++++++++ testsuite/tests/polykinds/all.T | 1 + 5 files changed, 115 insertions(+) diff --git a/docs/users_guide/8.2.1-notes.rst b/docs/users_guide/8.2.1-notes.rst index 7d87ad3..d4b7045 100644 --- a/docs/users_guide/8.2.1-notes.rst +++ b/docs/users_guide/8.2.1-notes.rst @@ -196,6 +196,11 @@ Compiler See the section on `associated type family instances ` for more information. +- A bug involving the interaction between :ghc-flag:`-XMonoLocalBinds` and + :ghc-flag:`-XPolyKinds` has been fixed. This can cause some programs to fail + to typecheck in case explicit kind signatures are not provided. See + :ref:`kind-generalisation` for an example. + GHCi ~~~~ diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index cf8bb43..de39298 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -9237,6 +9237,49 @@ and :ghc-flag:`-XGADTs`. You can switch it off again with :ghc-flag:`-XNoMonoLocalBinds <-XMonoLocalBinds>` but type inference becomes less predicatable if you do so. (Read the papers!) +.. _kind-generalisation: + +Kind generalisation +------------------- + +Just as :ghc-flag:`-XMonoLocalBinds` places limitations on when the *type* of a +*term* is generalised (see :ref:`mono-local-binds`), it also limits when the +*kind* of a *type signature* is generalised. Here is an example involving +:ref:`type signatures on instance declarations `: :: + + data Proxy a = Proxy + newtype Tagged s b = Tagged b + + class C b where + c :: forall (s :: k). Tagged s b + + instance C (Proxy a) where + c :: forall s. Tagged s (Proxy a) + c = Tagged Proxy + +With :ghc-flag:`-XMonoLocalBinds` enabled, this ``C (Proxy a)`` instance will +fail to typecheck. The reason is that the type signature for ``c`` captures +``a``, an outer-scoped type variable, which means the type signature is not +closed. Therefore, the inferred kind for ``s`` will *not* be generalised, and +as a result, it will fail to unify with the kind variable ``k`` which is +specified in the declaration of ``c``. This can be worked around by specifying +an explicit kind variable for ``s``, e.g., :: + + instance C (Proxy a) where + c :: forall (s :: k). Tagged s (Proxy a) + c = Tagged Proxy + +or, alternatively: :: + + instance C (Proxy a) where + c :: forall k (s :: k). Tagged s (Proxy a) + c = Tagged Proxy + +This declarations are equivalent using Haskell's implicit "add implicit +foralls" rules (see :ref:`implicit-quantification`). The implicit foralls rules +are purely syntactic and are quite separate from the kind generalisation +described here. + .. _visible-type-application: Visible type application diff --git a/testsuite/tests/polykinds/T13555.hs b/testsuite/tests/polykinds/T13555.hs new file mode 100644 index 0000000..e71023e --- /dev/null +++ b/testsuite/tests/polykinds/T13555.hs @@ -0,0 +1,26 @@ +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE InstanceSigs #-} +{-# LANGUAGE MonoLocalBinds #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE PolyKinds #-} +{-# LANGUAGE RankNTypes #-} +module T13555 where + +import Data.Functor.Identity (Identity(..)) + +data T a +type Polynomial a = T a +newtype GF fp d = GF (Polynomial fp) +type CRTInfo r = (Int -> r, r) +type Tagged s b = TaggedT s Identity b +newtype TaggedT s m b = TagT { untagT :: m b } + +class Reflects a i where + value :: Tagged a i + +class CRTrans mon r where + crtInfo :: Reflects m Int => TaggedT m mon (CRTInfo r) + +instance CRTrans Maybe (GF fp d) where + crtInfo :: forall m . (Reflects m Int) => TaggedT m Maybe (CRTInfo (GF fp d)) + crtInfo = undefined diff --git a/testsuite/tests/polykinds/T13555.stderr b/testsuite/tests/polykinds/T13555.stderr new file mode 100644 index 0000000..eaea033 --- /dev/null +++ b/testsuite/tests/polykinds/T13555.stderr @@ -0,0 +1,40 @@ + +T13555.hs:25:14: error: + • Couldn't match type ‘k0’ with ‘k2’ + because type variable ‘k2’ would escape its scope + This (rigid, skolem) type variable is bound by + the type signature for: + crtInfo :: forall k2 (m :: k2). + Reflects m Int => + TaggedT m Maybe (CRTInfo (GF fp d)) + at T13555.hs:25:14-79 + Expected type: TaggedT m Maybe (CRTInfo (GF fp d)) + Actual type: TaggedT m Maybe (CRTInfo (GF fp d)) + • When checking that instance signature for ‘crtInfo’ + is more general than its signature in the class + Instance sig: forall (m :: k0). + Reflects m Int => + TaggedT m Maybe (CRTInfo (GF fp d)) + Class sig: forall k2 (m :: k2). + Reflects m Int => + TaggedT m Maybe (CRTInfo (GF fp d)) + In the instance declaration for ‘CRTrans Maybe (GF fp d)’ + +T13555.hs:25:14: error: + • Could not deduce (Reflects m Int) + from the context: Reflects m Int + bound by the type signature for: + crtInfo :: forall k2 (m :: k2). + Reflects m Int => + TaggedT m Maybe (CRTInfo (GF fp d)) + at T13555.hs:25:14-79 + The type variable ‘k0’ is ambiguous + • When checking that instance signature for ‘crtInfo’ + is more general than its signature in the class + Instance sig: forall (m :: k0). + Reflects m Int => + TaggedT m Maybe (CRTInfo (GF fp d)) + Class sig: forall k2 (m :: k2). + Reflects m Int => + TaggedT m Maybe (CRTInfo (GF fp d)) + In the instance declaration for ‘CRTrans Maybe (GF fp d)’ diff --git a/testsuite/tests/polykinds/all.T b/testsuite/tests/polykinds/all.T index 850cb51..8684ec4 100644 --- a/testsuite/tests/polykinds/all.T +++ b/testsuite/tests/polykinds/all.T @@ -158,3 +158,4 @@ test('T13267', normal, compile_fail, ['']) test('T13394', normal, compile, ['']) test('T13371', normal, compile, ['']) test('T13393', normal, compile_fail, ['']) +test('T13555', normal, compile_fail, ['']) From git at git.haskell.org Thu Apr 27 20:10:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 27 Apr 2017 20:10:18 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Fix compilation for !HAVE_FLOCK (1a472f1) Message-ID: <20170427201018.BFD983A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/1a472f18e2ab446c76c38c9ff3d55f8931369c74/ghc >--------------------------------------------------------------- commit 1a472f18e2ab446c76c38c9ff3d55f8931369c74 Author: Herbert Valerio Riedel Date: Sun Apr 23 15:41:50 2017 +0200 Fix compilation for !HAVE_FLOCK (cherry picked from commit 2fa6873faf16a0f3b23742222a00f0647554395b) >--------------------------------------------------------------- 1a472f18e2ab446c76c38c9ff3d55f8931369c74 libraries/base/GHC/IO/Handle/Lock.hsc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libraries/base/GHC/IO/Handle/Lock.hsc b/libraries/base/GHC/IO/Handle/Lock.hsc index ebb3ce4..cbef5e4 100644 --- a/libraries/base/GHC/IO/Handle/Lock.hsc +++ b/libraries/base/GHC/IO/Handle/Lock.hsc @@ -47,6 +47,10 @@ import GHC.IO.Handle.FD import GHC.Ptr import GHC.Windows +#else + +import GHC.IO (throwIO) + #endif import Data.Functor From git at git.haskell.org Thu Apr 27 20:10:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 27 Apr 2017 20:10:24 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Disable terminfo, if we don’t build it. (f38e76a) Message-ID: <20170427201024.D86B43A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/f38e76a3a8d9fa905c1664a53358bea51d57d206/ghc >--------------------------------------------------------------- commit f38e76a3a8d9fa905c1664a53358bea51d57d206 Author: Moritz Angermann Date: Mon Apr 24 09:38:14 2017 -0400 Disable terminfo, if we don’t build it. This is a derivation of a patch from @jophish. This is necessary due to `haskeline`'s `terminfo` flag being marked as `Manual` as of 43d7fa106027fcd4ec7f443923a8dd5b8c169f9c. Reviewers: jophish, bgamari, austin Reviewed By: bgamari Subscribers: rwbarton, thomie, jophish Differential Revision: https://phabricator.haskell.org/D3493 (cherry picked from commit d5cb4d2b7fab89ea1c3fc74da2317f86e75816ea) >--------------------------------------------------------------- f38e76a3a8d9fa905c1664a53358bea51d57d206 ghc.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ghc.mk b/ghc.mk index 813b3f5..ca2aa95 100644 --- a/ghc.mk +++ b/ghc.mk @@ -471,7 +471,10 @@ endif ifeq "$(WITH_TERMINFO)" "YES" PACKAGES_STAGE1 += terminfo +else +libraries/haskeline_CONFIGURE_OPTS += --flags=-terminfo endif + PACKAGES_STAGE1 += haskeline PACKAGES_STAGE1 += ghci From git at git.haskell.org Thu Apr 27 20:10:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 27 Apr 2017 20:10:27 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: testsuite/driver: Fix deletion retry logic on Windows (5b0058e) Message-ID: <20170427201027.970D93A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/5b0058e13910d74983375898036eec2201c32aba/ghc >--------------------------------------------------------------- commit 5b0058e13910d74983375898036eec2201c32aba Author: Ben Gamari Date: Mon Apr 24 09:41:56 2017 -0400 testsuite/driver: Fix deletion retry logic on Windows Previously rmtree's error callback would throw an exception, breaking out of the retry loop. Test Plan: Validate on Windows Reviewers: Phyx, austin Reviewed By: Phyx Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3492 (cherry picked from commit 6f9f5ff16599814d8b10869be6dd424a5f7645d8) >--------------------------------------------------------------- 5b0058e13910d74983375898036eec2201c32aba testsuite/driver/testlib.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index 457e380..1f08f5b 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -767,7 +767,10 @@ def test_common_work(watcher, name, opts, func, args): t.n_tests_skipped += len(set(all_ways) - set(do_ways)) if config.cleanup and do_ways: - cleanup() + try: + cleanup() + except Exception as e: + framework_fail(name, 'runTest', 'Unhandled exception during cleanup: ' + str(e)) package_conf_cache_file_end_timestamp = get_package_cache_timestamp(); @@ -1910,8 +1913,8 @@ if config.msys: import time def cleanup(): testdir = getTestOpts().testdir - max_attemps = 5 - retries = max_attemps + max_attempts = 5 + retries = max_attempts def on_error(function, path, excinfo): # At least one test (T11489) removes the write bit from a file it # produces. Windows refuses to delete read-only files with a @@ -1935,13 +1938,18 @@ if config.msys: # with an even more cryptic error. # # See Trac #13162 + exception = None while retries > 0 and os.path.exists(testdir): - time.sleep((max_attemps-retries)*6) - shutil.rmtree(testdir, onerror=on_error, ignore_errors=False) - retries=-1 + time.sleep((max_attempts-retries)*6) + try: + shutil.rmtree(testdir, onerror=on_error, ignore_errors=False) + except Exception as e: + exception = e + retries -= 1 if retries == 0 and os.path.exists(testdir): - raise Exception("Unable to remove folder '" + testdir + "'. Unable to start current test.") + raise Exception("Unable to remove folder '%s': %s\nUnable to start current test." + % (testdir, exception)) else: def cleanup(): testdir = getTestOpts().testdir From git at git.haskell.org Thu Apr 27 20:10:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 27 Apr 2017 20:10:33 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Add regression test for #13603 (1bc7429) Message-ID: <20170427201033.A8DDE3A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/1bc7429d921ae8a1c82773b9c6dde0395d1514d4/ghc >--------------------------------------------------------------- commit 1bc7429d921ae8a1c82773b9c6dde0395d1514d4 Author: Ryan Scott Date: Mon Apr 24 10:47:51 2017 -0400 Add regression test for #13603 Commit b207b536ded40156f9adb168565ca78e1eef2c74 (#11714) happened to fix #13603 as well. Let's add a regression test so that it stays fixed. Test Plan: make test TEST=T13603 Reviewers: bgamari, austin, simonpj Reviewed By: bgamari, simonpj Subscribers: simonpj, rwbarton, thomie GHC Trac Issues: #13603 Differential Revision: https://phabricator.haskell.org/D3489 (cherry picked from commit ab27fdcfe26759f3e4cd7e2105e7e7e83e269e48) >--------------------------------------------------------------- 1bc7429d921ae8a1c82773b9c6dde0395d1514d4 testsuite/tests/typecheck/should_compile/T13603.hs | 10 ++++++++++ testsuite/tests/typecheck/should_compile/all.T | 1 + 2 files changed, 11 insertions(+) diff --git a/testsuite/tests/typecheck/should_compile/T13603.hs b/testsuite/tests/typecheck/should_compile/T13603.hs new file mode 100644 index 0000000..d0c1975 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T13603.hs @@ -0,0 +1,10 @@ +{-# Language PolyKinds, TypeInType, UndecidableInstances #-} +module T13603 where + +import GHC.Exts (TYPE, RuntimeRep) + +class A (a :: TYPE rep) +class A a => B (a :: TYPE rep) + +instance A b => A (a -> (b :: TYPE rep)) +instance B b => B (a -> (b :: TYPE rep)) diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index 03a2e73..1e98ec5 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -549,3 +549,4 @@ test('T13343', normal, compile, ['']) test('T13474', normal, compile, ['']) test('T13509', normal, compile, ['']) test('T13524', normal, compile, ['']) +test('T13603', normal, compile, ['']) From git at git.haskell.org Thu Apr 27 20:10:39 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 27 Apr 2017 20:10:39 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Document mkWeak# (933fb44) Message-ID: <20170427201039.1FE463A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/933fb440ad4adba542975fc5d8b46c1f666ff2ce/ghc >--------------------------------------------------------------- commit 933fb440ad4adba542975fc5d8b46c1f666ff2ce Author: Ben Gamari Date: Tue Apr 25 18:39:58 2017 -0400 Document mkWeak# Reviewers: simonmar, austin Reviewed By: simonmar Subscribers: RyanGlScott, rwbarton, thomie GHC Trac Issues: #10640, #13611 Differential Revision: https://phabricator.haskell.org/D3498 (cherry picked from commit 244602697c30e03ba63076941e4742ceeb78dd7c) >--------------------------------------------------------------- 933fb440ad4adba542975fc5d8b46c1f666ff2ce compiler/prelude/primops.txt.pp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp index e9c844e..ef83efb 100644 --- a/compiler/prelude/primops.txt.pp +++ b/compiler/prelude/primops.txt.pp @@ -2368,6 +2368,11 @@ primtype Weak# b primop MkWeakOp "mkWeak#" GenPrimOp o -> b -> (State# RealWorld -> (# State# RealWorld, c #)) -> State# RealWorld -> (# State# RealWorld, Weak# b #) + { {\tt mkWeak# k v finalizer s} creates a weak reference to value {\tt k}, + with an associated reference to some value {\tt v}. If {\tt k} is still + alive then {\tt v} can be retrieved using {\tt deRefWeak#}. Note that + the type of {\tt k} must be represented by a pointer (i.e. of kind {\tt + TYPE 'LiftedRep} or {\tt TYPE 'UnliftedRep}). } with has_side_effects = True out_of_line = True From git at git.haskell.org Thu Apr 27 20:10:36 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 27 Apr 2017 20:10:36 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Revert "Remove special casing of Windows in generic files" (8ef9716) Message-ID: <20170427201036.627D83A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/8ef9716f8f085a4276e95d099e0ffb7343388639/ghc >--------------------------------------------------------------- commit 8ef9716f8f085a4276e95d099e0ffb7343388639 Author: Ben Gamari Date: Tue Apr 25 09:28:40 2017 -0400 Revert "Remove special casing of Windows in generic files" This commit didn't consider the fact that binary distributions on Windows must have relative toolchain paths. This caused #13560. This reverts commit 48385cb2fc295eb8af9188cbe140142c1807d5a7 (except for a helpful comment). (cherry picked from commit 66108864540601837ad77847f4062a670362361f) >--------------------------------------------------------------- 8ef9716f8f085a4276e95d099e0ffb7343388639 aclocal.m4 | 49 ++++++++++++++++++------------------------------- configure.ac | 13 ++++++++----- 2 files changed, 26 insertions(+), 36 deletions(-) diff --git a/aclocal.m4 b/aclocal.m4 index fa32b6d..2b12c0f 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -459,55 +459,42 @@ AC_DEFUN([GET_ARM_ISA], # Set the variables used in the settings file AC_DEFUN([FP_SETTINGS], [ - SettingsCCompilerCommand="$CC" - SettingsHaskellCPPCommand="$HaskellCPPCmd" - SettingsHaskellCPPFlags="$HaskellCPPArgs" - SettingsLdCommand="$LdCmd" - SettingsArCommand="$ArCmd" - SettingsPerlCommand="$PerlCmd" - - if test -z "$DllWrap" + if test "$windows" = YES then - SettingsDllWrapCommand="/bin/false" + mingw_bin_prefix=mingw/bin/ + SettingsCCompilerCommand="\$topdir/../${mingw_bin_prefix}gcc.exe" + SettingsHaskellCPPCommand="\$topdir/../${mingw_bin_prefix}gcc.exe" + SettingsHaskellCPPFlags="$HaskellCPPArgs" + SettingsLdCommand="\$topdir/../${mingw_bin_prefix}ld.exe" + SettingsArCommand="\$topdir/../${mingw_bin_prefix}ar.exe" + SettingsPerlCommand='$topdir/../perl/perl.exe' + SettingsDllWrapCommand="\$topdir/../${mingw_bin_prefix}dllwrap.exe" + SettingsWindresCommand="\$topdir/../${mingw_bin_prefix}windres.exe" + SettingsTouchCommand='$topdir/bin/touchy.exe' else - SettingsDllWrapCommand="$DllWrap" - fi - - if test -z "$Windres" - then + SettingsCCompilerCommand="$CC" + SettingsHaskellCPPCommand="$HaskellCPPCmd" + SettingsHaskellCPPFlags="$HaskellCPPArgs" + SettingsLdCommand="$LdCmd" + SettingsArCommand="$ArCmd" + SettingsPerlCommand="$PerlCmd" + SettingsDllWrapCommand="/bin/false" SettingsWindresCommand="/bin/false" - else - SettingsWindresCommand="$Windres" - fi - - if test -z "$Libtool" - then SettingsLibtoolCommand="libtool" - else - SettingsLibtoolCommand="$Libtool" - fi - - if test -z "$Touch" - then SettingsTouchCommand='touch' - else - SettingsTouchCommand='$Touch' fi - if test -z "$LlcCmd" then SettingsLlcCommand="llc" else SettingsLlcCommand="$LlcCmd" fi - if test -z "$OptCmd" then SettingsOptCommand="opt" else SettingsOptCommand="$OptCmd" fi - SettingsCCompilerFlags="$CONF_CC_OPTS_STAGE2" SettingsCCompilerLinkFlags="$CONF_GCC_LINKER_OPTS_STAGE2" SettingsCCompilerSupportsNoPie="$CONF_GCC_SUPPORTS_NO_PIE" diff --git a/configure.ac b/configure.ac index 5ff54d8..9a47524 100644 --- a/configure.ac +++ b/configure.ac @@ -177,9 +177,13 @@ then if test "$ghc_host_os" = "mingw32" then - # Canonicalise to :/path/to/ghc - WithGhc=`cygpath -m "${WithGhc}"` - + if test "${OSTYPE}" = "msys" + then + WithGhc=`echo "${WithGhc}" | sed "s#^/\([a-zA-Z]\)/#\1:/#"` + else + # Canonicalise to :/path/to/ghc + WithGhc=`cygpath -m "${WithGhc}"` + fi echo "GHC path canonicalised to: ${WithGhc}" fi fi @@ -374,8 +378,6 @@ then NM="${mingwbin}nm.exe" RANLIB="${mingwbin}ranlib.exe" OBJDUMP="${mingwbin}objdump.exe" - Windres="${mingwbin}windres.exe" - DllWrap="${mingwbin}dllwrap.exe" fp_prog_ar="${mingwbin}ar.exe" # NB. Download the perl binaries if required @@ -727,6 +729,7 @@ AC_SUBST(HaveDtrace) AC_PATH_PROG(HSCOLOUR,HsColour) # HsColour is passed to Cabal, so we need a native path if test "$HostOS" = "mingw32" && \ + test "${OSTYPE}" != "msys" && \ test "${HSCOLOUR}" != "" then # Canonicalise to :/path/to/gcc From git at git.haskell.org Thu Apr 27 20:10:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 27 Apr 2017 20:10:30 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Update Cabal submodule, with necessary wibbles. (5eb185a) Message-ID: <20170427201030.579253A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/5eb185a3dd09cba956a006b2c464663b55d20dd3/ghc >--------------------------------------------------------------- commit 5eb185a3dd09cba956a006b2c464663b55d20dd3 Author: Edward Z. Yang Date: Wed Apr 26 15:26:56 2017 -0400 Update Cabal submodule, with necessary wibbles. Test Plan: validate Reviewers: bgamari, austin Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3501 (cherry picked from commit 579bb7669f40ed01841dd197ee535cf26fa19580) >--------------------------------------------------------------- 5eb185a3dd09cba956a006b2c464663b55d20dd3 compiler/backpack/DriverBkp.hs | 3 +-- compiler/main/Packages.hs | 2 +- libraries/Cabal | 2 +- libraries/ghc-boot/GHC/PackageDb.hs | 17 ++++++----------- .../tests/backpack/cabal/bkpcabal06/bkpcabal06.stderr | 4 ++-- utils/ghc-cabal/Main.hs | 3 ++- utils/ghc-pkg/Main.hs | 11 ++--------- 7 files changed, 15 insertions(+), 27 deletions(-) diff --git a/compiler/backpack/DriverBkp.hs b/compiler/backpack/DriverBkp.hs index d85b80d..db7b5f6 100644 --- a/compiler/backpack/DriverBkp.hs +++ b/compiler/backpack/DriverBkp.hs @@ -308,8 +308,7 @@ buildUnit session cid insts lunit = do packageName = compat_pn, packageVersion = makeVersion [0], unitId = toInstalledUnitId (thisPackage dflags), - mungedPackageName = Nothing, - libName = Nothing, + sourceLibName = Nothing, componentId = cid, instantiatedWith = insts, -- Slight inefficiency here haha diff --git a/compiler/main/Packages.hs b/compiler/main/Packages.hs index 10ef0d4..2c5833f 100644 --- a/compiler/main/Packages.hs +++ b/compiler/main/Packages.hs @@ -1940,7 +1940,7 @@ componentIdString :: DynFlags -> ComponentId -> Maybe String componentIdString dflags cid = do conf <- lookupInstalledPackage dflags (componentIdToInstalledUnitId cid) return $ - case libName conf of + case sourceLibName conf of Nothing -> sourcePackageIdString conf Just (PackageName libname) -> packageNameString conf diff --git a/libraries/Cabal b/libraries/Cabal index e4c36b9..41f416b 160000 --- a/libraries/Cabal +++ b/libraries/Cabal @@ -1 +1 @@ -Subproject commit e4c36b9dd51820f2380ce7a66f980c4e7b2e96fc +Subproject commit 41f416bc27796a3dc87037b66b6fef6f5810bc77 diff --git a/libraries/ghc-boot/GHC/PackageDb.hs b/libraries/ghc-boot/GHC/PackageDb.hs index ecd82dd..bf83d25 100644 --- a/libraries/ghc-boot/GHC/PackageDb.hs +++ b/libraries/ghc-boot/GHC/PackageDb.hs @@ -98,8 +98,7 @@ data InstalledPackageInfo compid srcpkgid srcpkgname instunitid unitid modulenam sourcePackageId :: srcpkgid, packageName :: srcpkgname, packageVersion :: Version, - mungedPackageName :: Maybe srcpkgname, - libName :: Maybe srcpkgname, + sourceLibName :: Maybe srcpkgname, abiHash :: String, depends :: [instunitid], -- | Like 'depends', but each dependency is annotated with the @@ -184,8 +183,7 @@ emptyInstalledPackageInfo = sourcePackageId = fromStringRep BS.empty, packageName = fromStringRep BS.empty, packageVersion = Version [] [], - mungedPackageName = Nothing, - libName = Nothing, + sourceLibName = Nothing, abiHash = "", depends = [], abiDepends = [], @@ -444,7 +442,7 @@ instance (RepInstalledPackageInfo a b c d e f g) => put (InstalledPackageInfo unitId componentId instantiatedWith sourcePackageId packageName packageVersion - mungedPackageName libName + sourceLibName abiHash depends abiDepends importDirs hsLibraries extraLibraries extraGHCiLibraries libraryDirs libraryDynDirs @@ -457,8 +455,7 @@ instance (RepInstalledPackageInfo a b c d e f g) => put (toStringRep sourcePackageId) put (toStringRep packageName) put packageVersion - put (fmap toStringRep mungedPackageName) - put (fmap toStringRep libName) + put (fmap toStringRep sourceLibName) put (toStringRep unitId) put (toStringRep componentId) put (map (\(mod_name, mod) -> (toStringRep mod_name, toDbModule mod)) @@ -491,8 +488,7 @@ instance (RepInstalledPackageInfo a b c d e f g) => sourcePackageId <- get packageName <- get packageVersion <- get - mungedPackageName <- get - libName <- get + sourceLibName <- get unitId <- get componentId <- get instantiatedWith <- get @@ -525,8 +521,7 @@ instance (RepInstalledPackageInfo a b c d e f g) => instantiatedWith) (fromStringRep sourcePackageId) (fromStringRep packageName) packageVersion - (fmap fromStringRep mungedPackageName) - (fmap fromStringRep libName) + (fmap fromStringRep sourceLibName) abiHash (map fromStringRep depends) (map (\(k,v) -> (fromStringRep k, v)) abiDepends) diff --git a/testsuite/tests/backpack/cabal/bkpcabal06/bkpcabal06.stderr b/testsuite/tests/backpack/cabal/bkpcabal06/bkpcabal06.stderr index 8998e65..937ec2f 100644 --- a/testsuite/tests/backpack/cabal/bkpcabal06/bkpcabal06.stderr +++ b/testsuite/tests/backpack/cabal/bkpcabal06/bkpcabal06.stderr @@ -1,4 +1,4 @@ sig/P.hsig:1:1: error: - • ‘p’ is exported by the hsig file, but not exported by the implementing module ‘z-bkpcabal06-z-impl-0.1.0.0:P’ - • while checking that z-bkpcabal06-z-impl-0.1.0.0:P implements signature P in bkpcabal06-0.1.0.0:sig[P=z-bkpcabal06-z-impl-0.1.0.0:P] + • ‘p’ is exported by the hsig file, but not exported by the implementing module ‘bkpcabal06-0.1.0.0:P’ + • while checking that bkpcabal06-0.1.0.0:P implements signature P in bkpcabal06-0.1.0.0:sig[P=bkpcabal06-0.1.0.0:P] diff --git a/utils/ghc-cabal/Main.hs b/utils/ghc-cabal/Main.hs index 608517e..8a1c2c1 100644 --- a/utils/ghc-cabal/Main.hs +++ b/utils/ghc-cabal/Main.hs @@ -20,6 +20,7 @@ import Distribution.Simple.Utils (defaultPackageDesc, writeFileAtomic, toUTF8) import Distribution.Simple.Build (writeAutogenFiles) import Distribution.Simple.Register import Distribution.Text +import Distribution.Types.MungedPackageId import Distribution.Verbosity import qualified Distribution.InstalledPackageInfo as Installed import qualified Distribution.Simple.PackageIndex as PackageIndex @@ -383,7 +384,7 @@ generate directory distdir dll0Modules config_args depLibNames | packageKeySupported comp = dep_ipids | otherwise = deps - depNames = map (display . packageName) dep_ids + depNames = map (display . mungedName) dep_ids transitive_dep_ids = map Installed.sourcePackageId dep_pkgs transitiveDeps = map display transitive_dep_ids diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs index ed73c29..9e18c97 100644 --- a/utils/ghc-pkg/Main.hs +++ b/utils/ghc-pkg/Main.hs @@ -1236,16 +1236,9 @@ convertPackageInfoToCacheFormat pkg = GhcPkg.componentId = installedComponentId pkg, GhcPkg.instantiatedWith = instantiatedWith pkg, GhcPkg.sourcePackageId = sourcePackageId pkg, - GhcPkg.packageName = - case sourcePackageName pkg of - Nothing -> packageName pkg - Just pn -> pn, + GhcPkg.packageName = packageName pkg, GhcPkg.packageVersion = Version.Version (versionNumbers (packageVersion pkg)) [], - GhcPkg.mungedPackageName = - case sourcePackageName pkg of - Nothing -> Nothing - Just _ -> Just (packageName pkg), - GhcPkg.libName = + GhcPkg.sourceLibName = fmap (mkPackageName . unUnqualComponentName) (sourceLibName pkg), GhcPkg.depends = depends pkg, GhcPkg.abiDepends = map (\(AbiDependency k v) -> (k,unAbiHash v)) (abiDepends pkg), From git at git.haskell.org Thu Apr 27 20:10:41 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 27 Apr 2017 20:10:41 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Don't describe tuple sections as "Python-style" (768f02d) Message-ID: <20170427201041.CFFA13A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/768f02d0cb4c590f72f9b146a546d4a56536205a/ghc >--------------------------------------------------------------- commit 768f02d0cb4c590f72f9b146a546d4a56536205a Author: Chris Martin Date: Sat Apr 22 18:26:22 2017 -0400 Don't describe tuple sections as "Python-style" (cherry picked from commit 960589e89da3dbf60e88042d7e064ad4a98fb2ff) (cherry picked from commit 688272ba31df7bd0a094c3d86d60f7b77b9f5268) >--------------------------------------------------------------- 768f02d0cb4c590f72f9b146a546d4a56536205a 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 de39298..19951c4 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -1570,7 +1570,7 @@ Tuple sections Allow the use of tuple section syntax -The :ghc-flag:`-XTupleSections` flag enables Python-style partially applied +The :ghc-flag:`-XTupleSections` flag enables partially applied tuple constructors. For example, the following program :: (, True) From git at git.haskell.org Thu Apr 27 20:10:44 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 27 Apr 2017 20:10:44 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Bump process to 1.6 (d213ef3) Message-ID: <20170427201044.890F43A585@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/d213ef3643213ed7b35fe84cef8ce627165e0444/ghc >--------------------------------------------------------------- commit d213ef3643213ed7b35fe84cef8ce627165e0444 Author: Ben Gamari Date: Fri Apr 21 12:45:40 2017 -0400 Bump process to 1.6 Also bumps hsc2hs submodule due to version bound bump. (cherry picked from commit 2744c94124a0cfe18e589974e77b0283b28f210f) >--------------------------------------------------------------- d213ef3643213ed7b35fe84cef8ce627165e0444 compiler/ghc.cabal.in | 2 +- ghc/ghc-bin.cabal.in | 2 +- libraries/process | 2 +- utils/ghc-pkg/ghc-pkg.cabal | 2 +- utils/hsc2hs | 2 +- utils/runghc/runghc.cabal.in | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in index 07a94fd..2c837fd 100644 --- a/compiler/ghc.cabal.in +++ b/compiler/ghc.cabal.in @@ -52,7 +52,7 @@ Library Build-Depends: base >= 4 && < 5, deepseq >= 1.4 && < 1.5, directory >= 1 && < 1.4, - process >= 1 && < 1.5, + process >= 1 && < 1.7, bytestring >= 0.9 && < 0.11, binary == 0.8.*, time >= 1.4 && < 1.9, diff --git a/ghc/ghc-bin.cabal.in b/ghc/ghc-bin.cabal.in index 0f50453..b04c13a 100644 --- a/ghc/ghc-bin.cabal.in +++ b/ghc/ghc-bin.cabal.in @@ -32,7 +32,7 @@ Executable ghc array >= 0.1 && < 0.6, bytestring >= 0.9 && < 0.11, directory >= 1 && < 1.4, - process >= 1 && < 1.5, + process >= 1 && < 1.7, filepath >= 1 && < 1.5, ghc-boot == @ProjectVersionMunged@, ghc == @ProjectVersionMunged@ diff --git a/libraries/process b/libraries/process index 0524859..88547b0 160000 --- a/libraries/process +++ b/libraries/process @@ -1 +1 @@ -Subproject commit 0524859137fc01bdb2a4833fd0aa6b23a48c6b15 +Subproject commit 88547b0fae8644f8f69be32c7ee5a3b76051c82f diff --git a/utils/ghc-pkg/ghc-pkg.cabal b/utils/ghc-pkg/ghc-pkg.cabal index 8776cb9..4b1aae7 100644 --- a/utils/ghc-pkg/ghc-pkg.cabal +++ b/utils/ghc-pkg/ghc-pkg.cabal @@ -28,7 +28,7 @@ Executable ghc-pkg Build-Depends: base >= 4 && < 5, directory >= 1 && < 1.4, - process >= 1 && < 1.5, + process >= 1 && < 1.7, containers, filepath, Cabal, diff --git a/utils/hsc2hs b/utils/hsc2hs index d7e49a6..936b088 160000 --- a/utils/hsc2hs +++ b/utils/hsc2hs @@ -1 +1 @@ -Subproject commit d7e49a6d90dbd3d8d0bbace9410fe8411a1c77bb +Subproject commit 936b0885ee794db83dc8473e17e153936e56d62f diff --git a/utils/runghc/runghc.cabal.in b/utils/runghc/runghc.cabal.in index 3be9f26..ffe7575 100644 --- a/utils/runghc/runghc.cabal.in +++ b/utils/runghc/runghc.cabal.in @@ -28,7 +28,7 @@ Executable runghc Build-Depends: base >= 3 && < 5, directory >= 1 && < 1.4, - process >= 1 && < 1.5, + process >= 1 && < 1.7, filepath if !os(windows) From git at git.haskell.org Fri Apr 28 11:04:18 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 28 Apr 2017 11:04:18 +0000 (UTC) Subject: [commit: ghc] master: Comments only (03ec792) Message-ID: <20170428110418.A0A7D3A587@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/03ec7927f050c203a43843d95938ededf6d2c8f9/ghc >--------------------------------------------------------------- commit 03ec7927f050c203a43843d95938ededf6d2c8f9 Author: Simon Peyton Jones Date: Wed Apr 26 16:56:33 2017 +0100 Comments only >--------------------------------------------------------------- 03ec7927f050c203a43843d95938ededf6d2c8f9 compiler/coreSyn/CoreOpt.hs | 2 +- compiler/coreSyn/CoreUnfold.hs | 12 ++++++------ testsuite/tests/perf/should_run/T7257.hs | 0 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/compiler/coreSyn/CoreOpt.hs b/compiler/coreSyn/CoreOpt.hs index da58a4b..4a19605 100644 --- a/compiler/coreSyn/CoreOpt.hs +++ b/compiler/coreSyn/CoreOpt.hs @@ -479,7 +479,7 @@ subst_opt_id_bndr (SOE { soe_subst = subst, soe_inl = inl }) old_id id1 = uniqAway in_scope old_id id2 = setIdType id1 (substTy subst (idType old_id)) new_id = zapFragileIdInfo id2 - -- Zaps rules, worker-info, unfolding, and fragile OccInfo + -- Zaps rules, unfolding, and fragile OccInfo -- The unfolding and rules will get added back later, by add_info new_in_scope = in_scope `extendInScopeSet` new_id diff --git a/compiler/coreSyn/CoreUnfold.hs b/compiler/coreSyn/CoreUnfold.hs index e629467..811ddad 100644 --- a/compiler/coreSyn/CoreUnfold.hs +++ b/compiler/coreSyn/CoreUnfold.hs @@ -1472,15 +1472,15 @@ computeDiscount dflags arg_discounts res_discount arg_infos cont_info = res_discount -- Over-saturated | otherwise = case cont_info of - BoringCtxt -> 0 - CaseCtxt -> res_discount -- Presumably a constructor - ValAppCtxt -> res_discount -- Presumably a function - _ -> 40 `min` res_discount + BoringCtxt -> 0 + CaseCtxt -> res_discount -- Presumably a constructor + ValAppCtxt -> res_discount -- Presumably a function + _ -> 40 `min` res_discount -- ToDo: this 40 `min` res_discount doesn't seem right -- for DiscArgCtxt it shouldn't matter because the function will - -- get the arg discount for any non-triv arg + -- get the arg discount for any non-triv arg -- for RuleArgCtxt we do want to be keener to inline; but not only - -- constructor results + -- constructor results -- for RhsCtxt I suppose that exposing a data con is good in general -- And 40 seems very arbitrary -- From git at git.haskell.org Fri Apr 28 11:04:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 28 Apr 2017 11:04:21 +0000 (UTC) Subject: [commit: ghc] master: A bit more tcTrace (6c2d917) Message-ID: <20170428110421.61A8C3A587@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6c2d9175c70d735834f0bd1673647d00f0a483b5/ghc >--------------------------------------------------------------- commit 6c2d9175c70d735834f0bd1673647d00f0a483b5 Author: Simon Peyton Jones Date: Tue Apr 25 13:15:04 2017 +0100 A bit more tcTrace >--------------------------------------------------------------- 6c2d9175c70d735834f0bd1673647d00f0a483b5 compiler/typecheck/TcUnify.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compiler/typecheck/TcUnify.hs b/compiler/typecheck/TcUnify.hs index 6d39169..6bb81d9 100644 --- a/compiler/typecheck/TcUnify.hs +++ b/compiler/typecheck/TcUnify.hs @@ -1161,7 +1161,8 @@ unifyType :: Outputable a => Maybe a -- ^ If present, has type 'ty1' -> TcTauType -> TcTauType -> TcM TcCoercionN -- Actual and expected types -- Returns a coercion : ty1 ~ ty2 -unifyType thing ty1 ty2 = uType origin TypeLevel ty1 ty2 +unifyType thing ty1 ty2 = traceTc "utype" (ppr ty1 $$ ppr ty2 $$ ppr thing) >> + uType origin TypeLevel ty1 ty2 where origin = TypeEqOrigin { uo_actual = ty1, uo_expected = ty2 , uo_thing = mkErrorThing <$> thing } @@ -1173,7 +1174,8 @@ noThing :: Maybe (HsExpr Name) noThing = Nothing unifyKind :: Outputable a => Maybe a -> TcKind -> TcKind -> TcM CoercionN -unifyKind thing ty1 ty2 = uType origin KindLevel ty1 ty2 +unifyKind thing ty1 ty2 = traceTc "ukind" (ppr ty1 $$ ppr ty2 $$ ppr thing) >> + uType origin KindLevel ty1 ty2 where origin = TypeEqOrigin { uo_actual = ty1, uo_expected = ty2 , uo_thing = mkErrorThing <$> thing } From git at git.haskell.org Fri Apr 28 11:04:15 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 28 Apr 2017 11:04:15 +0000 (UTC) Subject: [commit: ghc] master: Eta expansion and join points (25754c8) Message-ID: <20170428110415.CCB203A587@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/25754c83c9be3bf843310b1c7877c42fa3f9f3c7/ghc >--------------------------------------------------------------- commit 25754c83c9be3bf843310b1c7877c42fa3f9f3c7 Author: Simon Peyton Jones Date: Wed Apr 26 16:57:15 2017 +0100 Eta expansion and join points CoreArity.etaExpand tried to deal with eta-expanding expressions with join points. For example let j x = e in \y. b But it is hard to eta-expand this in the "no-crap" way described in Note [No crap in eta-expanded code], becuase it would mean pushing the "apply to y" into the join RHS, and changing its type. And the join might be recursive, and it might have an unfolding. Moreover in elaborate cases like this I don't think we need the no-crap thing. So for now I'm simplifying the code by generating \z. (let j x = e in \y. b) z Let's see if that gives rise to any problems. See Note [Eta expansion for join points] >--------------------------------------------------------------- 25754c83c9be3bf843310b1c7877c42fa3f9f3c7 compiler/coreSyn/CoreArity.hs | 139 +++++++++++++----------------------------- 1 file changed, 43 insertions(+), 96 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 25754c83c9be3bf843310b1c7877c42fa3f9f3c7 From git at git.haskell.org Fri Apr 28 11:04:24 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 28 Apr 2017 11:04:24 +0000 (UTC) Subject: [commit: ghc] master: Be a bit more eager to inline in a strict context (29d88ee) Message-ID: <20170428110424.2906A3A587@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/29d88ee173bc9b04245a33d5268dda032f5dc331/ghc >--------------------------------------------------------------- commit 29d88ee173bc9b04245a33d5268dda032f5dc331 Author: Simon Peyton Jones Date: Thu Apr 27 17:42:01 2017 +0100 Be a bit more eager to inline in a strict context If we see f (g x), and f is strict, we want to be a bit more eager to inline g, because it may well expose an eval (on x perhaps) that can be eliminated or shared. I saw this in nofib boyer2, function RewriteFuns.onewayunify1. It showed up as a consequence of the preceding patch that makes the simplifier do less work (Trac #13379). We had f d (g x) where f was a class-op. Previously we simplified both d and (g x) with a RuleArgCtxt (making g a bit more eager to inline). But now we simplify only d that way, then fire the rule, and only then simplify (g x). Firing the rule produces a strict funciion, so we want to make a strict function encourage inlining a bit. >--------------------------------------------------------------- 29d88ee173bc9b04245a33d5268dda032f5dc331 compiler/simplCore/SimplUtils.hs | 2 ++ compiler/simplCore/Simplify.hs | 26 +++++++++++++++++----- .../tests/simplCore/should_compile/T12603.stdout | 2 +- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/compiler/simplCore/SimplUtils.hs b/compiler/simplCore/SimplUtils.hs index 3ebdae4..a2c7b8b 100644 --- a/compiler/simplCore/SimplUtils.hs +++ b/compiler/simplCore/SimplUtils.hs @@ -551,6 +551,8 @@ interestingCallContext cont -- If f has an INLINE prag we need to give it some -- motivation to inline. See Note [Cast then apply] -- in CoreUnfold + + interesting (StrictArg _ BoringCtxt _) = RhsCtxt interesting (StrictArg _ cci _) = cci interesting (StrictBind {}) = BoringCtxt interesting (Stop _ cci) = cci diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index 4f41d0d..9bfdd1e 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -1807,7 +1807,7 @@ rebuildCall env info@(ArgInfo { ai_encl = encl_rules, ai_type = fun_ty | str -- Strict argument = -- pprTrace "Strict Arg" (ppr arg $$ ppr (seIdSubst env) $$ ppr (seInScope env)) $ simplExprF (arg_se `setFloats` env) arg - (StrictArg info' cci cont) + (StrictArg info' cci_strict cont) -- Note [Shadowing] | otherwise -- Lazy argument @@ -1816,13 +1816,27 @@ rebuildCall env info@(ArgInfo { ai_encl = encl_rules, ai_type = fun_ty -- have to be very careful about bogus strictness through -- floating a demanded let. = do { arg' <- simplExprC (arg_se `setInScopeAndZapFloats` env) arg - (mkLazyArgStop (funArgTy fun_ty) cci) + (mkLazyArgStop arg_ty cci_lazy) ; rebuildCall env (addValArgTo info' arg') cont } where - info' = info { ai_strs = strs, ai_discs = discs } - cci | encl_rules = RuleArgCtxt - | disc > 0 = DiscArgCtxt -- Be keener here - | otherwise = BoringCtxt -- Nothing interesting + info' = info { ai_strs = strs, ai_discs = discs } + arg_ty = funArgTy fun_ty + + -- Use this for lazy arguments + cci_lazy | encl_rules = RuleArgCtxt + | disc > 0 = DiscArgCtxt -- Be keener here + | otherwise = BoringCtxt -- Nothing interesting + + -- ..and this for strict arguments + cci_strict | encl_rules = RuleArgCtxt + | disc > 0 = DiscArgCtxt + | otherwise = RhsCtxt + -- Why RhsCtxt? if we see f (g x) (h x), and f is strict, we + -- want to be a bit more eager to inline g, because it may + -- expose an eval (on x perhaps) that can be eliminated or + -- shared. I saw this in nofib 'boyer2', RewriteFuns.onewayunify1 + -- It's worth an 18% improvement in allocation for this + -- particular benchmark; 5% on 'mate' and 1.3% on 'multiplier' ---------- No further useful info, revert to generic rebuild ------------ rebuildCall env (ArgInfo { ai_fun = fun, ai_args = rev_args }) cont diff --git a/testsuite/tests/simplCore/should_compile/T12603.stdout b/testsuite/tests/simplCore/should_compile/T12603.stdout index 277aa18..57a2a24 100644 --- a/testsuite/tests/simplCore/should_compile/T12603.stdout +++ b/testsuite/tests/simplCore/should_compile/T12603.stdout @@ -1 +1 @@ -lvl = case GHC.Real.$wf1 2# 8# of v { __DEFAULT -> GHC.Types.I# v } + = case GHC.Real.$wf1 2# 8# of ww4 { __DEFAULT -> GHC.Types.I# ww4 } From git at git.haskell.org Fri Apr 28 11:04:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 28 Apr 2017 11:04:30 +0000 (UTC) Subject: [commit: ghc] master: Comments only (4d5ab1f) Message-ID: <20170428110430.8B1693A587@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4d5ab1f89ab4c082c10f67616ca4308d67923486/ghc >--------------------------------------------------------------- commit 4d5ab1f89ab4c082c10f67616ca4308d67923486 Author: Simon Peyton Jones Date: Tue Apr 25 13:15:44 2017 +0100 Comments only >--------------------------------------------------------------- 4d5ab1f89ab4c082c10f67616ca4308d67923486 compiler/typecheck/TcRnTypes.hs | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/compiler/typecheck/TcRnTypes.hs b/compiler/typecheck/TcRnTypes.hs index 76184be..4d399e6 100644 --- a/compiler/typecheck/TcRnTypes.hs +++ b/compiler/typecheck/TcRnTypes.hs @@ -85,7 +85,7 @@ module TcRnTypes( andWC, unionsWC, mkSimpleWC, mkImplicWC, addInsols, getInsolubles, insolublesOnly, addSimples, addImplics, tyCoVarsOfWC, dropDerivedWC, dropDerivedSimples, dropDerivedInsols, - tyCoVarsOfWCList, + tyCoVarsOfWCList, trulyInsoluble, isDroppableDerivedLoc, insolubleImplic, arisesFromGivens, @@ -2409,7 +2409,11 @@ So a Given has EvVar inside it rather than (as previously) an EvTerm. -- EvVarDest. data TcEvDest = EvVarDest EvVar -- ^ bind this var to the evidence + -- EvVarDest is always used for non-type-equalities + -- e.g. class constraints + | HoleDest CoercionHole -- ^ fill in this hole with the evidence + -- HoleDest is always used for type-equalities -- See Note [Coercion holes] in TyCoRep data CtEvidence @@ -2456,12 +2460,16 @@ ctEvTerm ev@(CtWanted { ctev_dest = HoleDest _ }) = EvCoercion $ ctEvCoercion ev ctEvTerm ev = EvId (ctEvId ev) ctEvCoercion :: CtEvidence -> Coercion -ctEvCoercion ev@(CtWanted { ctev_dest = HoleDest hole, ctev_pred = pred }) - = case getEqPredTys_maybe pred of - Just (role, ty1, ty2) -> mkHoleCo hole role ty1 ty2 - _ -> pprPanic "ctEvTerm" (ppr ev) -ctEvCoercion (CtGiven { ctev_evar = ev_id }) = mkTcCoVarCo ev_id -ctEvCoercion ev = pprPanic "ctEvCoercion" (ppr ev) +ctEvCoercion (CtGiven { ctev_evar = ev_id }) + = mkTcCoVarCo ev_id +ctEvCoercion (CtWanted { ctev_dest = dest, ctev_pred = pred }) + | HoleDest hole <- dest + , Just (role, ty1, ty2) <- getEqPredTys_maybe pred + = -- ctEvCoercion is only called on type equalities + -- and they always have HoleDests + mkHoleCo hole role ty1 ty2 +ctEvCoercion ev + = pprPanic "ctEvCoercion" (ppr ev) ctEvId :: CtEvidence -> TcId ctEvId (CtWanted { ctev_dest = EvVarDest ev }) = ev From git at git.haskell.org Fri Apr 28 11:04:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 28 Apr 2017 11:04:27 +0000 (UTC) Subject: [commit: ghc] master: Cure exponential behaviour in the simplifier (a1b753e) Message-ID: <20170428110427.C59413A587@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a1b753e8b1475659440f524b3e66dfbea31c5787/ghc >--------------------------------------------------------------- commit a1b753e8b1475659440f524b3e66dfbea31c5787 Author: Simon Peyton Jones Date: Wed Apr 26 17:31:36 2017 +0100 Cure exponential behaviour in the simplifier This patch nails a Bad Bug exposed in Trac #13379. Roughly, a deeply-nested application like f (f (f ....) ) ) could make the simplifier go exponential -- without producing an exponential-sized result! The reason was that we - simplified a (big) function argument - then decided to inline the function - then preInilneUnconditionally the argument - and then re-simplified the big argument And if the "big argument" itself had a similar structure things could get very bad. Once I'd understood, it was easy to fix: * See Note Note [Avoiding exponential behaviour] for an overview * The key change is that Simplify.simplLam now as a case for (isSimplified dup). This is what removes the perf bug. * But I also made simplCast more parsimonious about simplifying, avoiding doing so when the coercion is Refl * And similarly I now try to avoid simplifying arguments where possible before applying rules. See Note [Trying rewrite rules] The latter two points tackle common cases, and in those cases make the simplifier take fewer iterations. >--------------------------------------------------------------- a1b753e8b1475659440f524b3e66dfbea31c5787 compiler/simplCore/SimplUtils.hs | 35 +- compiler/simplCore/Simplify.hs | 175 +++++++--- testsuite/tests/perf/compiler/T13379.hs | 372 +++++++++++++++++++++ testsuite/tests/perf/compiler/T4007.stdout | 2 +- testsuite/tests/perf/compiler/all.T | 16 +- .../tests/simplCore/should_compile/T3234.stderr | 20 +- 6 files changed, 549 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 a1b753e8b1475659440f524b3e66dfbea31c5787 From git at git.haskell.org Fri Apr 28 11:04:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 28 Apr 2017 11:04:33 +0000 (UTC) Subject: [commit: ghc] master: Comments and tiny refactoring (7f6674d) Message-ID: <20170428110433.5157C3A587@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7f6674d62e760d2afa53ff57bb4a115eed58901d/ghc >--------------------------------------------------------------- commit 7f6674d62e760d2afa53ff57bb4a115eed58901d Author: Simon Peyton Jones Date: Fri Apr 21 13:12:15 2017 +0100 Comments and tiny refactoring >--------------------------------------------------------------- 7f6674d62e760d2afa53ff57bb4a115eed58901d compiler/deSugar/DsBinds.hs | 1 + compiler/typecheck/TcBinds.hs | 7 ++----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/compiler/deSugar/DsBinds.hs b/compiler/deSugar/DsBinds.hs index 1ff04b2..73ae913 100644 --- a/compiler/deSugar/DsBinds.hs +++ b/compiler/deSugar/DsBinds.hs @@ -536,6 +536,7 @@ thought! Note [Desugar Strict binds] ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +See https://ghc.haskell.org/trac/ghc/wiki/StrictPragma Desugaring strict variable bindings looks as follows (core below ==>) diff --git a/compiler/typecheck/TcBinds.hs b/compiler/typecheck/TcBinds.hs index a9c6f6c..f3874ab 100644 --- a/compiler/typecheck/TcBinds.hs +++ b/compiler/typecheck/TcBinds.hs @@ -1651,12 +1651,9 @@ decideGeneralisationPlan dflags lbinds closed sig_fn restricted (VarBind { var_id = v }) = no_sig v restricted (FunBind { fun_id = v, fun_matches = m }) = restricted_match m && no_sig (unLoc v) - restricted (PatSynBind {}) = panic "isRestrictedGroup/unrestricted PatSynBind" - restricted (AbsBinds {}) = panic "isRestrictedGroup/unrestricted AbsBinds" - restricted (AbsBindsSig {}) = panic "isRestrictedGroup/unrestricted AbsBindsSig" + restricted b = pprPanic "isRestrictedGroup/unrestricted" (ppr b) - restricted_match (MG { mg_alts = L _ (L _ (Match _ [] _ _) : _ )}) = True - restricted_match _ = False + restricted_match mg = matchGroupArity mg == 0 -- No args => like a pattern binding -- Some args => a function binding From git at git.haskell.org Fri Apr 28 17:22:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 28 Apr 2017 17:22:12 +0000 (UTC) Subject: [commit: ghc] master: get-win32-tarballs: Grab perl tarball from haskell.org, not GitHub (ba597c1) Message-ID: <20170428172212.1DA363A587@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ba597c1dd1daf9643b72dc7aeace8d6b3fce84eb/ghc >--------------------------------------------------------------- commit ba597c1dd1daf9643b72dc7aeace8d6b3fce84eb Author: Ben Gamari Date: Fri Apr 28 13:20:14 2017 -0400 get-win32-tarballs: Grab perl tarball from haskell.org, not GitHub Reviewers: austin, dfeuer Reviewed By: dfeuer Subscribers: Phyx, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3509 >--------------------------------------------------------------- ba597c1dd1daf9643b72dc7aeace8d6b3fce84eb mk/get-win32-tarballs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mk/get-win32-tarballs.sh b/mk/get-win32-tarballs.sh index a21cc62..7f3b544 100755 --- a/mk/get-win32-tarballs.sh +++ b/mk/get-win32-tarballs.sh @@ -112,7 +112,7 @@ download_tarballs() { download_mingw "${format_url}-x86_64-mpc-1.0.3-2.src.tar.gz" fi - download_file "https://github.com/ghc/ghc-tarballs/blob/master/perl/ghc-perl-1.tar.gz?raw=true" "ghc-tarballs/perl/ghc-perl-1.tar.gz" "Windows Perl binary distributions" "--insecure" + download_file "https://downloads.haskell.org/~ghc/mingw/ghc-perl-1.tar.gz" "ghc-tarballs/perl/ghc-perl-1.tar.gz" "Windows Perl binary distributions" if ! test "$missing_files" = "0" then From git at git.haskell.org Fri Apr 28 17:26:27 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 28 Apr 2017 17:26:27 +0000 (UTC) Subject: [commit: ghc] branch 'wip/spj-early-inline2' deleted Message-ID: <20170428172627.910183A587@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Deleted branch: wip/spj-early-inline2 From git at git.haskell.org Fri Apr 28 17:27:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 28 Apr 2017 17:27:01 +0000 (UTC) Subject: [commit: ghc] branch 'wip/spj-early-inline' deleted Message-ID: <20170428172701.5DFAE3A587@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Deleted branch: wip/spj-early-inline From git at git.haskell.org Fri Apr 28 17:28:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 28 Apr 2017 17:28:49 +0000 (UTC) Subject: [commit: ghc] branch 'wip/eventlog-heap-profile' deleted Message-ID: <20170428172849.7EED73A587@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Deleted branch: wip/eventlog-heap-profile From git at git.haskell.org Fri Apr 28 17:29:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 28 Apr 2017 17:29:08 +0000 (UTC) Subject: [commit: ghc] branch 'wip/spj-early-inline4' deleted Message-ID: <20170428172908.44F3B3A587@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Deleted branch: wip/spj-early-inline4 From git at git.haskell.org Fri Apr 28 17:29:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 28 Apr 2017 17:29:21 +0000 (UTC) Subject: [commit: ghc] branch 'wip/ttypeable' deleted Message-ID: <20170428172921.6EB703A587@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Deleted branch: wip/ttypeable From git at git.haskell.org Fri Apr 28 17:29:29 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 28 Apr 2017 17:29:29 +0000 (UTC) Subject: [commit: ghc] branch 'wip/ttypeable-builtin-kindreps' deleted Message-ID: <20170428172929.85DCB3A587@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Deleted branch: wip/ttypeable-builtin-kindreps From git at git.haskell.org Fri Apr 28 17:30:01 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 28 Apr 2017 17:30:01 +0000 (UTC) Subject: [commit: ghc] branch 'wip/typeable-unwired' deleted Message-ID: <20170428173001.47E9F3A587@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Deleted branch: wip/typeable-unwired From git at git.haskell.org Fri Apr 28 17:31:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 28 Apr 2017 17:31:26 +0000 (UTC) Subject: [commit: ghc] branch 'wip/static-pointers' deleted Message-ID: <20170428173126.5DA313A587@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Deleted branch: wip/static-pointers From git at git.haskell.org Fri Apr 28 17:31:42 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 28 Apr 2017 17:31:42 +0000 (UTC) Subject: [commit: ghc] branch 'wip/llvm-3.6' deleted Message-ID: <20170428173142.CDB813A587@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Deleted branch: wip/llvm-3.6 From git at git.haskell.org Fri Apr 28 17:32:38 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 28 Apr 2017 17:32:38 +0000 (UTC) Subject: [commit: ghc] branch 'wip/exp-types' deleted Message-ID: <20170428173238.4EF5B3A587@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Deleted branch: wip/exp-types From git at git.haskell.org Fri Apr 28 17:33:04 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 28 Apr 2017 17:33:04 +0000 (UTC) Subject: [commit: ghc] branch 'wip/iface-type-pretty' deleted Message-ID: <20170428173304.57FE03A587@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Deleted branch: wip/iface-type-pretty From git at git.haskell.org Fri Apr 28 17:33:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 28 Apr 2017 17:33:21 +0000 (UTC) Subject: [commit: ghc] branch 'wip/inline-ioenv' deleted Message-ID: <20170428173321.441993A587@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Deleted branch: wip/inline-ioenv From git at git.haskell.org Fri Apr 28 17:33:33 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 28 Apr 2017 17:33:33 +0000 (UTC) Subject: [commit: ghc] branch 'wip/generalized-arrow' deleted Message-ID: <20170428173333.8F9463A587@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Deleted branch: wip/generalized-arrow From git at git.haskell.org Fri Apr 28 17:34:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 28 Apr 2017 17:34:02 +0000 (UTC) Subject: [commit: ghc] branch 'wip/gadtpm' deleted Message-ID: <20170428173402.D3E1B3A587@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Deleted branch: wip/gadtpm From git at git.haskell.org Fri Apr 28 17:35:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 28 Apr 2017 17:35:49 +0000 (UTC) Subject: [commit: ghc] branch 'wip/occname' deleted Message-ID: <20170428173549.6A33E3A587@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Deleted branch: wip/occname From git at git.haskell.org Fri Apr 28 17:35:59 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 28 Apr 2017 17:35:59 +0000 (UTC) Subject: [commit: ghc] branch 'wip/names3' deleted Message-ID: <20170428173559.A1F7B3A587@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Deleted branch: wip/names3 From git at git.haskell.org Fri Apr 28 17:36:10 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 28 Apr 2017 17:36:10 +0000 (UTC) Subject: [commit: ghc] branch 'wip/python3' deleted Message-ID: <20170428173610.456103A587@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Deleted branch: wip/python3 From git at git.haskell.org Fri Apr 28 17:36:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 28 Apr 2017 17:36:20 +0000 (UTC) Subject: [commit: ghc] branch 'wip/python3-new' deleted Message-ID: <20170428173620.638803A587@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Deleted branch: wip/python3-new From git at git.haskell.org Fri Apr 28 17:36:50 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 28 Apr 2017 17:36:50 +0000 (UTC) Subject: [commit: ghc] branch 'wip/small-ord' deleted Message-ID: <20170428173650.4B2873A587@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Deleted branch: wip/small-ord From git at git.haskell.org Fri Apr 28 17:39:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 28 Apr 2017 17:39:03 +0000 (UTC) Subject: [commit: ghc] branch 'wip/amp' deleted Message-ID: <20170428173903.9B2F63A587@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Deleted branch: wip/amp From git at git.haskell.org Fri Apr 28 18:19:03 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 28 Apr 2017 18:19:03 +0000 (UTC) Subject: [commit: ghc] master: Add regression test for #12104 (69b9b85) Message-ID: <20170428181903.823113A588@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/69b9b853e3e68191cdfa8aec0e4da966298a2659/ghc >--------------------------------------------------------------- commit 69b9b853e3e68191cdfa8aec0e4da966298a2659 Author: Ryan Scott Date: Fri Apr 28 13:24:11 2017 -0400 Add regression test for #12104 Commit 2f9f1f86849ebc18af409c9b3fd809c9cd464021 (#13487) fixes #12104 as well. This adds a regression test for the program reported in #12104 to keep it fixed. Test Plan: make test TEST=T12104 Reviewers: bgamari, austin Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #12104 Differential Revision: https://phabricator.haskell.org/D3495 >--------------------------------------------------------------- 69b9b853e3e68191cdfa8aec0e4da966298a2659 testsuite/tests/typecheck/should_compile/T12104.hs | 11 +++++++++++ testsuite/tests/typecheck/should_compile/T12104.stderr | 5 +++++ testsuite/tests/typecheck/should_compile/all.T | 1 + 3 files changed, 17 insertions(+) diff --git a/testsuite/tests/typecheck/should_compile/T12104.hs b/testsuite/tests/typecheck/should_compile/T12104.hs new file mode 100644 index 0000000..12c309c --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T12104.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE TypeFamilies, DataKinds, UndecidableInstances #-} + +module T12104 where + +import GHC.TypeLits + +type family F a where + F a = TypeError (Text "error") + +err :: F () +err = () diff --git a/testsuite/tests/typecheck/should_compile/T12104.stderr b/testsuite/tests/typecheck/should_compile/T12104.stderr new file mode 100644 index 0000000..7848551 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T12104.stderr @@ -0,0 +1,5 @@ + +T12104.hs:11:7: warning: [-Wdeferred-type-errors (in -Wdefault)] + • error + • In the expression: () + In an equation for ‘err’: err = () diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index fcb80da..67fe104 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -512,6 +512,7 @@ test('T11339c', normal, compile, ['']) test('T11339d', normal, compile, ['']) test('T11974', normal, compile, ['']) test('T12067', [], multimod_compile, ['T12067', '-v0']) +test('T12104', normal, compile, ['-fdefer-type-errors']) test('T12185', normal, compile, ['']) test('T12133', normal, compile, ['']) test('T12381', normal, compile, ['']) From git at git.haskell.org Fri Apr 28 18:19:06 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 28 Apr 2017 18:19:06 +0000 (UTC) Subject: [commit: ghc] master: Make the tyvars in TH-reified data family instances uniform (b2c38d6) Message-ID: <20170428181906.A04343A588@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b2c38d6b4003d3dda60d15204283da5aab15c2ec/ghc >--------------------------------------------------------------- commit b2c38d6b4003d3dda60d15204283da5aab15c2ec Author: Ryan Scott Date: Fri Apr 28 13:24:31 2017 -0400 Make the tyvars in TH-reified data family instances uniform It turns out we were using two different sets of type variables when reifying data family instances in Template Haskell. We were using the tyvars quantifying over the instance itself for the LHS, but using the tyvars quantifying over the data family instance constructor for the RHS. This commit uses the instance tyvars for both the LHS and the RHS, fixing #13618. Test Plan: make test TEST=T13618 Reviewers: goldfire, austin, bgamari Reviewed By: goldfire, bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #13618 Differential Revision: https://phabricator.haskell.org/D3505 >--------------------------------------------------------------- b2c38d6b4003d3dda60d15204283da5aab15c2ec compiler/typecheck/TcSplice.hs | 13 ++++++----- testsuite/tests/th/T13618.hs | 25 ++++++++++++++++++++++ .../tests/th/T13618.stdout | 0 testsuite/tests/th/all.T | 1 + 4 files changed, 34 insertions(+), 5 deletions(-) diff --git a/compiler/typecheck/TcSplice.hs b/compiler/typecheck/TcSplice.hs index 007f825..1e4ec40 100644 --- a/compiler/typecheck/TcSplice.hs +++ b/compiler/typecheck/TcSplice.hs @@ -1628,6 +1628,7 @@ reifyFamilyInstance :: [Bool] -- True <=> the corresponding tv is poly-kinded -> FamInst -> TcM TH.Dec reifyFamilyInstance is_poly_tvs inst@(FamInst { fi_flavor = flavor , fi_fam = fam + , fi_tvs = fam_tvs , fi_tys = lhs , fi_rhs = rhs }) = case flavor of @@ -1642,7 +1643,7 @@ reifyFamilyInstance is_poly_tvs inst@(FamInst { fi_flavor = flavor (TH.TySynEqn annot_th_lhs th_rhs)) } DataFamilyInst rep_tc -> - do { let tvs = tyConTyVars rep_tc + do { let rep_tvs = tyConTyVars rep_tc fam' = reifyName fam -- eta-expand lhs types, because sometimes data/newtype @@ -1650,12 +1651,14 @@ reifyFamilyInstance is_poly_tvs inst@(FamInst { fi_flavor = flavor -- See Note [Eta reduction for data family axioms] -- in TcInstDcls (_rep_tc, rep_tc_args) = splitTyConApp rhs - etad_tyvars = dropList rep_tc_args tvs - eta_expanded_lhs = lhs `chkAppend` mkTyVarTys etad_tyvars - dataCons = tyConDataCons rep_tc + etad_tyvars = dropList rep_tc_args rep_tvs + etad_tys = mkTyVarTys etad_tyvars + eta_expanded_tvs = mkTyVarTys fam_tvs `chkAppend` etad_tys + eta_expanded_lhs = lhs `chkAppend` etad_tys + dataCons = tyConDataCons rep_tc -- see Note [Reifying GADT data constructors] isGadt = any (not . null . dataConEqSpec) dataCons - ; cons <- mapM (reifyDataCon isGadt (mkTyVarTys tvs)) dataCons + ; cons <- mapM (reifyDataCon isGadt eta_expanded_tvs) dataCons ; let types_only = filterOutInvisibleTypes fam_tc eta_expanded_lhs ; th_tys <- reifyTypes types_only ; annot_th_tys <- zipWith3M annotThType is_poly_tvs types_only th_tys diff --git a/testsuite/tests/th/T13618.hs b/testsuite/tests/th/T13618.hs new file mode 100644 index 0000000..487b5e4 --- /dev/null +++ b/testsuite/tests/th/T13618.hs @@ -0,0 +1,25 @@ +{-# LANGUAGE LambdaCase #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE TypeFamilies #-} +module Main where + +import Language.Haskell.TH +import Language.Haskell.TH.Syntax (lift) + +data family DF a +data instance DF [a] = DFList a +newtype instance DF (Maybe a) = DFMaybe a + +$(return []) + +main :: IO () +main = print + $(do FamilyI (DataFamilyD _ _ _) insts <- reify ''DF + lift $ all (\case DataInstD _ _ [AppT _ (VarT v1)] _ + [NormalC _ [(_, VarT v2)]] _ + -> v1 == v2 + NewtypeInstD _ _ [AppT _ (VarT v1)] _ + (NormalC _ [(_, VarT v2)]) _ + -> v1 == v2 + _ -> error "Not a data or newtype instance") + insts) diff --git a/libraries/base/tests/IO/IOError002.stdout b/testsuite/tests/th/T13618.stdout similarity index 100% copy from libraries/base/tests/IO/IOError002.stdout copy to testsuite/tests/th/T13618.stdout diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index 7c98d13..9dadeb6 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -382,3 +382,4 @@ test('T13098', normal, compile, ['-v0']) test('T11046', normal, multimod_compile, ['T11046','-v0']) test('T13366', normal, compile_and_run, ['-lstdc++ -v0']) test('T13587', expect_broken(13587), compile_and_run, ['-v0']) +test('T13618', normal, compile_and_run, ['-v0']) From git at git.haskell.org Fri Apr 28 18:19:09 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 28 Apr 2017 18:19:09 +0000 (UTC) Subject: [commit: ghc] master: Use memcpy in cloneArray (228d467) Message-ID: <20170428181909.5FD473A588@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/228d4670e98e4fd998c847aac38c11ad85aa35a7/ghc >--------------------------------------------------------------- commit 228d4670e98e4fd998c847aac38c11ad85aa35a7 Author: Ben Gamari Date: Fri Apr 28 13:24:47 2017 -0400 Use memcpy in cloneArray While looking at #13615 I noticed that there was this strange open-coded memcpy in the definition of the cloneArray macro. I don't see why this should be preferable to memcpy. Test Plan: Validate, particularly focusing on array operations Reviewers: simonmar, tibbe, austin, alexbiehl Reviewed By: tibbe, alexbiehl Subscribers: alexbiehl, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3504 >--------------------------------------------------------------- 228d4670e98e4fd998c847aac38c11ad85aa35a7 includes/Cmm.h | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/includes/Cmm.h b/includes/Cmm.h index 779416b..3c90307 100644 --- a/includes/Cmm.h +++ b/includes/Cmm.h @@ -849,14 +849,7 @@ \ dst_p = dst + SIZEOF_StgMutArrPtrs; \ src_p = src + SIZEOF_StgMutArrPtrs + WDS(offset); \ - while: \ - if (n != 0) { \ - n = n - 1; \ - W_[dst_p] = W_[src_p]; \ - dst_p = dst_p + WDS(1); \ - src_p = src_p + WDS(1); \ - goto while; \ - } \ + prim %memcpy(dst_p, src_p, n * SIZEOF_W, SIZEOF_W); \ \ return (dst); @@ -931,13 +924,6 @@ \ dst_p = dst + SIZEOF_StgSmallMutArrPtrs; \ src_p = src + SIZEOF_StgSmallMutArrPtrs + WDS(offset); \ - while: \ - if (n != 0) { \ - n = n - 1; \ - W_[dst_p] = W_[src_p]; \ - dst_p = dst_p + WDS(1); \ - src_p = src_p + WDS(1); \ - goto while; \ - } \ + prim %memcpy(dst_p, src_p, n * SIZEOF_W, SIZEOF_W); \ \ return (dst); From git at git.haskell.org Fri Apr 28 18:19:12 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 28 Apr 2017 18:19:12 +0000 (UTC) Subject: [commit: ghc] master: CSE: Fix cut and paste error (9f9b90f) Message-ID: <20170428181912.193EC3A588@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9f9b90f1fb85fef568f535664f55c4674603e65b/ghc >--------------------------------------------------------------- commit 9f9b90f1fb85fef568f535664f55c4674603e65b Author: Ben Gamari Date: Fri Apr 28 13:25:17 2017 -0400 CSE: Fix cut and paste error extendCSRecEnv took the map to be extended from cs_map instead of cs_rec_map. Oops! Test Plan: Validate Reviewers: simonpj, austin Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3510 >--------------------------------------------------------------- 9f9b90f1fb85fef568f535664f55c4674603e65b compiler/simplCore/CSE.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/simplCore/CSE.hs b/compiler/simplCore/CSE.hs index 1495f18..95df5f8 100644 --- a/compiler/simplCore/CSE.hs +++ b/compiler/simplCore/CSE.hs @@ -282,7 +282,7 @@ with mutual recursion it's quite hard; but for self-recursive bindings 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 + Bingo we get a hit. So we can replace the 'g' binding with g = f We can't use cs_map for this, because the key isn't an expression of @@ -572,7 +572,7 @@ extendCSEnv cse expr triv_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 } + = cse { cs_rec_map = extendCoreMap (cs_rec_map cse) (Lam bndr expr) triv_expr } lookupCSRecEnv :: CSEnv -> OutId -> OutExpr -> Maybe OutExpr -- See Note [CSE for recursive bindings] From git at git.haskell.org Fri Apr 28 18:27:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 28 Apr 2017 18:27:55 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Print module when dumping rules (3ccdf40) Message-ID: <20170428182755.5BBDA3A588@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/3ccdf40fd141ae10f54c0a28a228f2d1e4dc5f53/ghc >--------------------------------------------------------------- commit 3ccdf40fd141ae10f54c0a28a228f2d1e4dc5f53 Author: Matthew Pickering Date: Wed Mar 29 16:08:40 2017 -0400 Print module when dumping rules It is sometimes hard to find where a rule is defined. Printing the module where it comes from will make it much easier to find. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3378 (cherry picked from commit 04ea4c3f86db4e2cc7b2683f58f2076233039ebf) >--------------------------------------------------------------- 3ccdf40fd141ae10f54c0a28a228f2d1e4dc5f53 compiler/coreSyn/CoreSyn.hs | 7 ++++++- compiler/simplCore/Simplify.hs | 13 ++++++++++--- compiler/specialise/Rules.hs | 4 ++-- .../tests/indexed-types/should_compile/T7837.stderr | 10 +++++----- testsuite/tests/perf/compiler/T4007.stdout | 16 ++++++++-------- testsuite/tests/simplCore/should_compile/T6056.stderr | 10 +++++----- testsuite/tests/simplCore/should_compile/T8848.stdout | 4 ++-- 7 files changed, 38 insertions(+), 26 deletions(-) diff --git a/compiler/coreSyn/CoreSyn.hs b/compiler/coreSyn/CoreSyn.hs index 309b9fd..0590b19 100644 --- a/compiler/coreSyn/CoreSyn.hs +++ b/compiler/coreSyn/CoreSyn.hs @@ -4,6 +4,7 @@ -} {-# LANGUAGE CPP, DeriveDataTypeable, FlexibleContexts #-} +{-# LANGUAGE NamedFieldPuns #-} -- | CoreSyn holds all the main data types for use by for the Glasgow Haskell Compiler midsection module CoreSyn ( @@ -89,7 +90,7 @@ module CoreSyn ( -- ** Operations on 'CoreRule's ruleArity, ruleName, ruleIdName, ruleActivation, - setRuleIdName, + setRuleIdName, ruleModule, isBuiltinRule, isLocalRule, isAutoRule, -- * Core vectorisation declarations data type @@ -1234,6 +1235,10 @@ ruleArity (Rule {ru_args = args}) = length args ruleName :: CoreRule -> RuleName ruleName = ru_name +ruleModule :: CoreRule -> Maybe Module +ruleModule Rule { ru_origin } = Just ru_origin +ruleModule BuiltinRule {} = Nothing + ruleActivation :: CoreRule -> Activation ruleActivation (BuiltinRule { }) = AlwaysActive ruleActivation (Rule { ru_act = act }) = act diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index f5301cf..36f5477 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -51,6 +51,7 @@ import FastString import Pair import Util import ErrUtils +import Module ( moduleName, pprModuleName ) {- The guts of the simplifier is in this module, but the driver loop for @@ -1858,7 +1859,7 @@ tryRules env rules fn args call_cont do { nodump dflags -- This ensures that an empty file is written ; return Nothing } ; -- No rule matches Just (rule, rule_rhs) -> - do { checkedTick (RuleFired (ru_name rule)) + do { checkedTick (RuleFired (ruleName rule)) ; let cont' = pushSimplifiedArgs env (drop (ruleArity rule) args) call_cont @@ -1870,17 +1871,23 @@ tryRules env rules fn args call_cont ; dump dflags rule rule_rhs ; return (Just (occ_anald_rhs, cont')) }}} where + printRuleModule rule = + parens + (maybe (text "BUILTIN") (pprModuleName . moduleName) (ruleModule rule)) + dump dflags rule rule_rhs | dopt Opt_D_dump_rule_rewrites dflags = log_rule dflags Opt_D_dump_rule_rewrites "Rule fired" $ vcat - [ text "Rule:" <+> ftext (ru_name rule) + [ text "Rule:" <+> ftext (ruleName rule) + , text "Module:" <+> printRuleModule rule , text "Before:" <+> hang (ppr fn) 2 (sep (map ppr args)) , text "After: " <+> pprCoreExpr rule_rhs , text "Cont: " <+> ppr call_cont ] | dopt Opt_D_dump_rule_firings dflags = log_rule dflags Opt_D_dump_rule_firings "Rule fired:" $ - ftext (ru_name rule) + ftext (ruleName rule) + <+> printRuleModule rule | otherwise = return () diff --git a/compiler/specialise/Rules.hs b/compiler/specialise/Rules.hs index 1dcff82..83b4e8d 100644 --- a/compiler/specialise/Rules.hs +++ b/compiler/specialise/Rules.hs @@ -263,7 +263,7 @@ pprRulesForUser :: DynFlags -> [CoreRule] -> SDoc pprRulesForUser dflags rules = withPprStyle (defaultUserStyle dflags) $ pprRules $ - sortBy (comparing ru_name) $ + sortBy (comparing ruleName) $ tidyRules emptyTidyEnv rules {- @@ -420,7 +420,7 @@ findBest target (rule1,ans1) ((rule2,ans2):prs) | rule2 `isMoreSpecific` rule1 = findBest target (rule2,ans2) prs | debugIsOn = let pp_rule rule = sdocWithPprDebug $ \dbg -> if dbg then ppr rule - else doubleQuotes (ftext (ru_name rule)) + else doubleQuotes (ftext (ruleName rule)) in pprTrace "Rules.findBest: rule overlap (Rule 1 wins)" (vcat [ sdocWithPprDebug $ \dbg -> if dbg then text "Expression to match:" <+> ppr fn diff --git a/testsuite/tests/indexed-types/should_compile/T7837.stderr b/testsuite/tests/indexed-types/should_compile/T7837.stderr index 7fd0a48..eb68261 100644 --- a/testsuite/tests/indexed-types/should_compile/T7837.stderr +++ b/testsuite/tests/indexed-types/should_compile/T7837.stderr @@ -1,5 +1,5 @@ -Rule fired: Class op signum -Rule fired: Class op abs -Rule fired: Class op HEq_sc -Rule fired: normalize/Double -Rule fired: Class op HEq_sc +Rule fired: Class op signum (BUILTIN) +Rule fired: Class op abs (BUILTIN) +Rule fired: Class op HEq_sc (BUILTIN) +Rule fired: normalize/Double (T7837) +Rule fired: Class op HEq_sc (BUILTIN) diff --git a/testsuite/tests/perf/compiler/T4007.stdout b/testsuite/tests/perf/compiler/T4007.stdout index 59c81d9..7cbc345 100644 --- a/testsuite/tests/perf/compiler/T4007.stdout +++ b/testsuite/tests/perf/compiler/T4007.stdout @@ -1,8 +1,8 @@ -Rule fired: Class op >> -Rule fired: Class op return -Rule fired: unpack -Rule fired: Class op foldr -Rule fired: fold/build -Rule fired: <# -Rule fired: tagToEnum# -Rule fired: unpack-list +Rule fired: Class op >> (BUILTIN) +Rule fired: Class op return (BUILTIN) +Rule fired: unpack (GHC.Base) +Rule fired: Class op foldr (BUILTIN) +Rule fired: fold/build (GHC.Base) +Rule fired: <# (BUILTIN) +Rule fired: tagToEnum# (BUILTIN) +Rule fired: unpack-list (GHC.Base) diff --git a/testsuite/tests/simplCore/should_compile/T6056.stderr b/testsuite/tests/simplCore/should_compile/T6056.stderr index 5ef76c0..a1f022e 100644 --- a/testsuite/tests/simplCore/should_compile/T6056.stderr +++ b/testsuite/tests/simplCore/should_compile/T6056.stderr @@ -1,5 +1,5 @@ -Rule fired: SPEC/T6056 $wsmallerAndRest @ Int -Rule fired: Class op < -Rule fired: SPEC/T6056 $wsmallerAndRest @ Int -Rule fired: SPEC/T6056 $wsmallerAndRest @ Int -Rule fired: SPEC/T6056 $wsmallerAndRest @ Int +Rule fired: SPEC/T6056 $wsmallerAndRest @ Int (T6056) +Rule fired: Class op < (BUILTIN) +Rule fired: SPEC/T6056 $wsmallerAndRest @ Int (T6056) +Rule fired: SPEC/T6056 $wsmallerAndRest @ Int (T6056) +Rule fired: SPEC/T6056 $wsmallerAndRest @ Int (T6056) diff --git a/testsuite/tests/simplCore/should_compile/T8848.stdout b/testsuite/tests/simplCore/should_compile/T8848.stdout index de0d424..c4a33ad 100644 --- a/testsuite/tests/simplCore/should_compile/T8848.stdout +++ b/testsuite/tests/simplCore/should_compile/T8848.stdout @@ -1,2 +1,2 @@ -Rule fired: SPEC map2 -Rule fired: SPEC map2 +Rule fired: SPEC map2 (T8848) +Rule fired: SPEC map2 (T8848) From git at git.haskell.org Fri Apr 28 18:28:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 28 Apr 2017 18:28:02 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Cure exponential behaviour in the simplifier (9b58c63) Message-ID: <20170428182802.9D54E3A588@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/9b58c6360b9c2dc5b15c17ba83f5dc729efb84dc/ghc >--------------------------------------------------------------- commit 9b58c6360b9c2dc5b15c17ba83f5dc729efb84dc Author: Simon Peyton Jones Date: Wed Apr 26 17:31:36 2017 +0100 Cure exponential behaviour in the simplifier This patch nails a Bad Bug exposed in Trac #13379. Roughly, a deeply-nested application like f (f (f ....) ) ) could make the simplifier go exponential -- without producing an exponential-sized result! The reason was that we - simplified a (big) function argument - then decided to inline the function - then preInilneUnconditionally the argument - and then re-simplified the big argument And if the "big argument" itself had a similar structure things could get very bad. Once I'd understood, it was easy to fix: * See Note Note [Avoiding exponential behaviour] for an overview * The key change is that Simplify.simplLam now as a case for (isSimplified dup). This is what removes the perf bug. * But I also made simplCast more parsimonious about simplifying, avoiding doing so when the coercion is Refl * And similarly I now try to avoid simplifying arguments where possible before applying rules. See Note [Trying rewrite rules] The latter two points tackle common cases, and in those cases make the simplifier take fewer iterations. (cherry picked from commit a1b753e8b1475659440f524b3e66dfbea31c5787) >--------------------------------------------------------------- 9b58c6360b9c2dc5b15c17ba83f5dc729efb84dc compiler/simplCore/SimplUtils.hs | 35 +- compiler/simplCore/Simplify.hs | 175 +++++++--- testsuite/tests/perf/compiler/T13379.hs | 372 +++++++++++++++++++++ testsuite/tests/perf/compiler/T4007.stdout | 2 +- testsuite/tests/perf/compiler/all.T | 16 +- .../tests/simplCore/should_compile/T3234.stderr | 20 +- 6 files changed, 549 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 9b58c6360b9c2dc5b15c17ba83f5dc729efb84dc From git at git.haskell.org Fri Apr 28 18:27:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 28 Apr 2017 18:27:58 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Do Note [Improving seq] always (09249f9) Message-ID: <20170428182758.DFA563A588@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/09249f93089517ace8aae6d0652716f6fac18e3e/ghc >--------------------------------------------------------------- commit 09249f93089517ace8aae6d0652716f6fac18e3e Author: Simon Peyton Jones Date: Fri Apr 7 16:19:56 2017 +0100 Do Note [Improving seq] always This patch fixes Trac #13468, and at the same time makes the code simpler and more uniform. In particular, I've eliminated the awkward conflict between the old built-in rule for seq (which elimianted a cast), and the desire to make case scrutinse a data type by doing type-family reduction (which adds a cast). Nice. (cherry picked from commit f0d98fc6cdde26bf43a04d9f01b6ad2f4c88f0b9) >--------------------------------------------------------------- 09249f93089517ace8aae6d0652716f6fac18e3e compiler/basicTypes/MkId.hs | 40 +----- compiler/simplCore/Simplify.hs | 138 ++++++++++++--------- testsuite/tests/simplCore/should_compile/Makefile | 6 + testsuite/tests/simplCore/should_compile/T13468.hs | 12 ++ testsuite/tests/simplCore/should_compile/all.T | 4 + 5 files changed, 104 insertions(+), 96 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 09249f93089517ace8aae6d0652716f6fac18e3e From git at git.haskell.org Fri Apr 28 18:28:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 28 Apr 2017 18:28:05 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Be a bit more eager to inline in a strict context (f9aa658) Message-ID: <20170428182805.5FFBD3A588@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/f9aa658ba8293832a6622323b58063a379b16901/ghc >--------------------------------------------------------------- commit f9aa658ba8293832a6622323b58063a379b16901 Author: Simon Peyton Jones Date: Thu Apr 27 17:42:01 2017 +0100 Be a bit more eager to inline in a strict context If we see f (g x), and f is strict, we want to be a bit more eager to inline g, because it may well expose an eval (on x perhaps) that can be eliminated or shared. I saw this in nofib boyer2, function RewriteFuns.onewayunify1. It showed up as a consequence of the preceding patch that makes the simplifier do less work (Trac #13379). We had f d (g x) where f was a class-op. Previously we simplified both d and (g x) with a RuleArgCtxt (making g a bit more eager to inline). But now we simplify only d that way, then fire the rule, and only then simplify (g x). Firing the rule produces a strict funciion, so we want to make a strict function encourage inlining a bit. (cherry picked from commit 29d88ee173bc9b04245a33d5268dda032f5dc331) >--------------------------------------------------------------- f9aa658ba8293832a6622323b58063a379b16901 compiler/simplCore/SimplUtils.hs | 2 ++ compiler/simplCore/Simplify.hs | 26 +++++++++++++++++----- .../tests/simplCore/should_compile/T12603.stdout | 2 +- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/compiler/simplCore/SimplUtils.hs b/compiler/simplCore/SimplUtils.hs index 3ebdae4..a2c7b8b 100644 --- a/compiler/simplCore/SimplUtils.hs +++ b/compiler/simplCore/SimplUtils.hs @@ -551,6 +551,8 @@ interestingCallContext cont -- If f has an INLINE prag we need to give it some -- motivation to inline. See Note [Cast then apply] -- in CoreUnfold + + interesting (StrictArg _ BoringCtxt _) = RhsCtxt interesting (StrictArg _ cci _) = cci interesting (StrictBind {}) = BoringCtxt interesting (Stop _ cci) = cci diff --git a/compiler/simplCore/Simplify.hs b/compiler/simplCore/Simplify.hs index 74f8e0e..66208b3 100644 --- a/compiler/simplCore/Simplify.hs +++ b/compiler/simplCore/Simplify.hs @@ -1801,7 +1801,7 @@ rebuildCall env info@(ArgInfo { ai_encl = encl_rules, ai_type = fun_ty | str -- Strict argument = -- pprTrace "Strict Arg" (ppr arg $$ ppr (seIdSubst env) $$ ppr (seInScope env)) $ simplExprF (arg_se `setFloats` env) arg - (StrictArg info' cci cont) + (StrictArg info' cci_strict cont) -- Note [Shadowing] | otherwise -- Lazy argument @@ -1810,13 +1810,27 @@ rebuildCall env info@(ArgInfo { ai_encl = encl_rules, ai_type = fun_ty -- have to be very careful about bogus strictness through -- floating a demanded let. = do { arg' <- simplExprC (arg_se `setInScopeAndZapFloats` env) arg - (mkLazyArgStop (funArgTy fun_ty) cci) + (mkLazyArgStop arg_ty cci_lazy) ; rebuildCall env (addValArgTo info' arg') cont } where - info' = info { ai_strs = strs, ai_discs = discs } - cci | encl_rules = RuleArgCtxt - | disc > 0 = DiscArgCtxt -- Be keener here - | otherwise = BoringCtxt -- Nothing interesting + info' = info { ai_strs = strs, ai_discs = discs } + arg_ty = funArgTy fun_ty + + -- Use this for lazy arguments + cci_lazy | encl_rules = RuleArgCtxt + | disc > 0 = DiscArgCtxt -- Be keener here + | otherwise = BoringCtxt -- Nothing interesting + + -- ..and this for strict arguments + cci_strict | encl_rules = RuleArgCtxt + | disc > 0 = DiscArgCtxt + | otherwise = RhsCtxt + -- Why RhsCtxt? if we see f (g x) (h x), and f is strict, we + -- want to be a bit more eager to inline g, because it may + -- expose an eval (on x perhaps) that can be eliminated or + -- shared. I saw this in nofib 'boyer2', RewriteFuns.onewayunify1 + -- It's worth an 18% improvement in allocation for this + -- particular benchmark; 5% on 'mate' and 1.3% on 'multiplier' ---------- No further useful info, revert to generic rebuild ------------ rebuildCall env (ArgInfo { ai_fun = fun, ai_args = rev_args }) cont diff --git a/testsuite/tests/simplCore/should_compile/T12603.stdout b/testsuite/tests/simplCore/should_compile/T12603.stdout index 277aa18..57a2a24 100644 --- a/testsuite/tests/simplCore/should_compile/T12603.stdout +++ b/testsuite/tests/simplCore/should_compile/T12603.stdout @@ -1 +1 @@ -lvl = case GHC.Real.$wf1 2# 8# of v { __DEFAULT -> GHC.Types.I# v } + = case GHC.Real.$wf1 2# 8# of ww4 { __DEFAULT -> GHC.Types.I# ww4 } From git at git.haskell.org Fri Apr 28 19:01:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 28 Apr 2017 19:01:47 +0000 (UTC) Subject: [commit: ghc] master: nativeGen: Use SSE2 SQRT instruction (9ac2218) Message-ID: <20170428190147.79BD33A588@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9ac22183e405773ea7147728e593edd78f30a025/ghc >--------------------------------------------------------------- commit 9ac22183e405773ea7147728e593edd78f30a025 Author: Ben Gamari Date: Fri Apr 28 14:24:53 2017 -0400 nativeGen: Use SSE2 SQRT instruction Reviewers: austin, dfeuer Subscribers: dfeuer, rwbarton, thomie GHC Trac Issues: #13629 Differential Revision: https://phabricator.haskell.org/D3508 >--------------------------------------------------------------- 9ac22183e405773ea7147728e593edd78f30a025 compiler/nativeGen/X86/CodeGen.hs | 17 +++++++++++------ compiler/nativeGen/X86/Instr.hs | 4 +++- compiler/nativeGen/X86/Ppr.hs | 1 + libraries/base/tests/Numeric/num009.hs | 5 +++++ 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/compiler/nativeGen/X86/CodeGen.hs b/compiler/nativeGen/X86/CodeGen.hs index 562303c..baa5c8f 100644 --- a/compiler/nativeGen/X86/CodeGen.hs +++ b/compiler/nativeGen/X86/CodeGen.hs @@ -2057,13 +2057,15 @@ genCCall _ is32Bit target dest_regs args = do MO_F64_Fabs -> case args of [x] -> sse2FabsCode W64 x _ -> panic "genCCall: Wrong number of arguments for fabs" + + MO_F32_Sqrt -> actuallyInlineSSE2Op (\fmt r -> SQRT fmt (OpReg r)) FF32 args + MO_F64_Sqrt -> actuallyInlineSSE2Op (\fmt r -> SQRT fmt (OpReg r)) FF64 args _other_op -> outOfLineCmmOp op (Just r) args | otherwise -> do l1 <- getNewLabelNat l2 <- getNewLabelNat if sse2 - then - outOfLineCmmOp op (Just r) args + then outOfLineCmmOp op (Just r) args else case op of MO_F32_Sqrt -> actuallyInlineFloatOp GSQRT FF32 args MO_F64_Sqrt -> actuallyInlineFloatOp GSQRT FF64 args @@ -2080,13 +2082,16 @@ genCCall _ is32Bit target dest_regs args = do _other_op -> outOfLineCmmOp op (Just r) args where - actuallyInlineFloatOp instr format [x] + actuallyInlineFloatOp = actuallyInlineFloatOp' False + actuallyInlineSSE2Op = actuallyInlineFloatOp' True + + actuallyInlineFloatOp' usesSSE instr format [x] = do res <- trivialUFCode format (instr format) x any <- anyReg res - return (any (getRegisterReg platform False (CmmLocal r))) + return (any (getRegisterReg platform usesSSE (CmmLocal r))) - actuallyInlineFloatOp _ _ args - = panic $ "genCCall.actuallyInlineFloatOp: bad number of arguments! (" + actuallyInlineFloatOp' _ _ _ args + = panic $ "genCCall.actuallyInlineFloatOp': bad number of arguments! (" ++ show (length args) ++ ")" sse2FabsCode :: Width -> CmmExpr -> NatM InstrBlock diff --git a/compiler/nativeGen/X86/Instr.hs b/compiler/nativeGen/X86/Instr.hs index f4ac55c..16e08f3 100644 --- a/compiler/nativeGen/X86/Instr.hs +++ b/compiler/nativeGen/X86/Instr.hs @@ -289,7 +289,7 @@ data Instr | CVTSI2SS Format Operand Reg -- I32/I64 to F32 | CVTSI2SD Format Operand Reg -- I32/I64 to F64 - -- use ADD & SUB for arithmetic. In both cases, operands + -- use ADD, SUB, and SQRT for arithmetic. In both cases, operands -- are Operand Reg. -- SSE2 floating-point division: @@ -447,6 +447,7 @@ x86_regUsageOfInstr platform instr CVTSI2SS _ src dst -> mkRU (use_R src []) [dst] CVTSI2SD _ src dst -> mkRU (use_R src []) [dst] FDIV _ src dst -> usageRM src dst + SQRT _ src dst -> mkRU (use_R src []) [dst] FETCHGOT reg -> mkRU [] [reg] FETCHPC reg -> mkRU [] [reg] @@ -617,6 +618,7 @@ x86_patchRegsOfInstr instr env CVTSI2SS fmt src dst -> CVTSI2SS fmt (patchOp src) (env dst) CVTSI2SD fmt src dst -> CVTSI2SD fmt (patchOp src) (env dst) FDIV fmt src dst -> FDIV fmt (patchOp src) (patchOp dst) + SQRT fmt src dst -> SQRT fmt (patchOp src) (env dst) CALL (Left _) _ -> instr CALL (Right reg) p -> CALL (Right (env reg)) p diff --git a/compiler/nativeGen/X86/Ppr.hs b/compiler/nativeGen/X86/Ppr.hs index 5044c83..bd957b4 100644 --- a/compiler/nativeGen/X86/Ppr.hs +++ b/compiler/nativeGen/X86/Ppr.hs @@ -724,6 +724,7 @@ pprInstr (MUL format op1 op2) = pprFormatOpOp (sLit "mul") format op1 op2 pprInstr (MUL2 format op) = pprFormatOp (sLit "mul") format op pprInstr (FDIV format op1 op2) = pprFormatOpOp (sLit "div") format op1 op2 +pprInstr (SQRT format op1 op2) = pprFormatOpReg (sLit "sqrt") format op1 op2 pprInstr (CVTSS2SD from to) = pprRegReg (sLit "cvtss2sd") from to pprInstr (CVTSD2SS from to) = pprRegReg (sLit "cvtsd2ss") from to diff --git a/libraries/base/tests/Numeric/num009.hs b/libraries/base/tests/Numeric/num009.hs index c0dec43..e405ddf 100644 --- a/libraries/base/tests/Numeric/num009.hs +++ b/libraries/base/tests/Numeric/num009.hs @@ -17,6 +17,9 @@ main = do let d = [0, pi, pi/2, pi/3, 1e10, 1e20] :: [Double] mapM_ (test "cosf" cosf cos) f mapM_ (test "tand" tand tan) d mapM_ (test "tanf" tanf tan) f + -- added to test #13629 + mapM_ (test "sqrtd" sqrtd sqrt) f + mapM_ (test "sqrtf" sqrtf sqrt) f putStrLn "Done" test :: (RealFloat a, Floating a, RealFloat b, Floating b, Show b) @@ -39,3 +42,5 @@ foreign import ccall "math.h cosf" cosf :: CFloat -> CFloat foreign import ccall "math.h tan" tand :: CDouble -> CDouble foreign import ccall "math.h tanf" tanf :: CFloat -> CFloat +foreign import ccall "math.h sqrt" sqrtd :: CDouble -> CDouble +foreign import ccall "math.h sqrtf" sqrtf :: CFloat -> CFloat From git at git.haskell.org Fri Apr 28 22:07:55 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 28 Apr 2017 22:07:55 +0000 (UTC) Subject: [commit: ghc] master: Re-engineer caseRules to add tagToEnum/dataToTag (193664d) Message-ID: <20170428220755.7C3883A588@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/193664d42dbceadaa1e4689dfa17ff1cf5a405a0/ghc >--------------------------------------------------------------- commit 193664d42dbceadaa1e4689dfa17ff1cf5a405a0 Author: Simon Peyton Jones Date: Wed Mar 8 10:26:47 2017 +0000 Re-engineer caseRules to add tagToEnum/dataToTag See Note [Scrutinee Constant Folding] in SimplUtils * Add cases for tagToEnum and dataToTag. This is the main new bit. It allows the simplifier to remove the pervasive uses of case tagToEnum (a > b) of False -> e1 True -> e2 and replace it by the simpler case a > b of DEFAULT -> e1 1# -> e2 See Note [caseRules for tagToEnum] and Note [caseRules for dataToTag] in PrelRules. * This required some changes to the API of caseRules, and hence to code in SimplUtils. See Note [Scrutinee Constant Folding] in SimplUtils. * Avoid duplication of work in the (unusual) case of case BIG + 3# of b DEFAULT -> e1 6# -> e2 Previously we got case BIG of DEFAULT -> let b = BIG + 3# in e1 3# -> let b = 6# in e2 Now we get case BIG of b# DEFAULT -> let b = b' + 3# in e1 3# -> let b = 6# in e2 * Avoid duplicated code in caseRules A knock-on refactoring: * Move Note [Word/Int underflow/overflow] to Literal, as documentation to accompany mkMachIntWrap etc; and get rid of PrelRuls.intResult' in favour of mkMachIntWrap >--------------------------------------------------------------- 193664d42dbceadaa1e4689dfa17ff1cf5a405a0 compiler/basicTypes/Literal.hs | 21 ++ compiler/coreSyn/CoreSyn.hs | 2 + compiler/prelude/PrelRules.hs | 231 +++++++++++++-------- compiler/simplCore/SimplUtils.hs | 177 +++++++++++----- .../tests/simplCore/should_compile/T3772.stdout | 10 +- .../tests/simplCore/should_compile/T4930.stderr | 30 +-- .../simplCore/should_compile/spec-inline.stderr | 152 +++++++------- 7 files changed, 391 insertions(+), 232 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 193664d42dbceadaa1e4689dfa17ff1cf5a405a0 From git at git.haskell.org Fri Apr 28 22:07:52 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 28 Apr 2017 22:07:52 +0000 (UTC) Subject: [commit: ghc] master: Improve code generation for conditionals (6d14c14) Message-ID: <20170428220752.B5A833A588@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6d14c1485cb570cbd183bcdc0f858d9a6dc1eb31/ghc >--------------------------------------------------------------- commit 6d14c1485cb570cbd183bcdc0f858d9a6dc1eb31 Author: Simon Peyton Jones Date: Wed Mar 8 11:05:53 2017 +0000 Improve code generation for conditionals This patch in in preparation for the fix to Trac #13397 The code generator has a special case for case tagToEnum (a>#b) of False -> e1 True -> e2 but it was not doing nearly so well on case a>#b of DEFAULT -> e1 1# -> e2 This patch arranges to behave essentially identically in both cases. In due course we can eliminate the special case for tagToEnum#, once we've completed Trac #13397. The changes are: * Make CmmSink swizzle the order of a conditional where necessary; see Note [Improving conditionals] in CmmSink * Hack the general case of StgCmmExpr.cgCase so that it use NoGcInAlts for conditionals. This doesn't seem right, but it's the same choice as the tagToEnum version. Without it, code size increases a lot (more heap checks). There's a loose end here. * Add comments in CmmOpt.cmmMachOpFoldM >--------------------------------------------------------------- 6d14c1485cb570cbd183bcdc0f858d9a6dc1eb31 compiler/cmm/CmmOpt.hs | 83 +++++++++++++++++++++++++++------------ compiler/cmm/CmmSink.hs | 39 +++++++++++++++--- compiler/codeGen/StgCmmClosure.hs | 2 +- compiler/codeGen/StgCmmExpr.hs | 28 +++++++++++-- compiler/prelude/PrimOp.hs | 7 +++- 5 files changed, 121 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 6d14c1485cb570cbd183bcdc0f858d9a6dc1eb31 From git at git.haskell.org Fri Apr 28 22:07:49 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 28 Apr 2017 22:07:49 +0000 (UTC) Subject: [commit: ghc] master: Move dataConTagZ to DataCon (1cae73a) Message-ID: <20170428220749.EB1E73A588@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1cae73aa7a1bf934e3dcae943d0d1686e8b12c26/ghc >--------------------------------------------------------------- commit 1cae73aa7a1bf934e3dcae943d0d1686e8b12c26 Author: Simon Peyton Jones Date: Tue Mar 7 13:28:34 2017 +0000 Move dataConTagZ to DataCon Just a simple refactoring to remove duplication >--------------------------------------------------------------- 1cae73aa7a1bf934e3dcae943d0d1686e8b12c26 compiler/basicTypes/DataCon.hs | 8 ++++++-- compiler/cmm/SMRep.hs | 4 ++-- compiler/codeGen/StgCmmClosure.hs | 12 ++++-------- compiler/codeGen/StgCmmMonad.hs | 1 + compiler/vectorise/Vectorise/Utils/Base.hs | 5 +---- 5 files changed, 14 insertions(+), 16 deletions(-) diff --git a/compiler/basicTypes/DataCon.hs b/compiler/basicTypes/DataCon.hs index c6bb8eb..acd2865 100644 --- a/compiler/basicTypes/DataCon.hs +++ b/compiler/basicTypes/DataCon.hs @@ -28,8 +28,9 @@ module DataCon ( -- ** Type deconstruction dataConRepType, dataConSig, dataConInstSig, dataConFullSig, - dataConName, dataConIdentity, dataConTag, dataConTyCon, - dataConOrigTyCon, dataConUserType, + dataConName, dataConIdentity, dataConTag, dataConTagZ, + dataConTyCon, dataConOrigTyCon, + dataConUserType, dataConUnivTyVars, dataConUnivTyVarBinders, dataConExTyVars, dataConExTyVarBinders, dataConAllTyVars, @@ -861,6 +862,9 @@ dataConName = dcName dataConTag :: DataCon -> ConTag dataConTag = dcTag +dataConTagZ :: DataCon -> ConTagZ +dataConTagZ con = dataConTag con - fIRST_TAG + -- | The type constructor that we are building via this data constructor dataConTyCon :: DataCon -> TyCon dataConTyCon = dcRepTyCon diff --git a/compiler/cmm/SMRep.hs b/compiler/cmm/SMRep.hs index 83ddf18..d40af4f 100644 --- a/compiler/cmm/SMRep.hs +++ b/compiler/cmm/SMRep.hs @@ -50,6 +50,7 @@ module SMRep ( #include "../HsVersions.h" #include "../includes/MachDeps.h" +import BasicTypes( ConTagZ ) import DynFlags import Outputable import Platform @@ -185,14 +186,13 @@ type IsStatic = Bool -- rtsClosureType below. data ClosureTypeInfo - = Constr ConstrTag ConstrDescription + = Constr ConTagZ ConstrDescription | Fun FunArity ArgDescr | Thunk | ThunkSelector SelectorOffset | BlackHole | IndStatic -type ConstrTag = Int type ConstrDescription = [Word8] -- result of dataConIdentity type FunArity = Int type SelectorOffset = Int diff --git a/compiler/codeGen/StgCmmClosure.hs b/compiler/codeGen/StgCmmClosure.hs index e799ea6..bc5e473 100644 --- a/compiler/codeGen/StgCmmClosure.hs +++ b/compiler/codeGen/StgCmmClosure.hs @@ -13,7 +13,6 @@ module StgCmmClosure ( DynTag, tagForCon, isSmallFamily, - ConTagZ, dataConTagZ, idPrimRep, isVoidRep, isGcPtrRep, addIdReps, addArgReps, argPrimRep, @@ -360,17 +359,12 @@ type DynTag = Int -- The tag on a *pointer* isSmallFamily :: DynFlags -> Int -> Bool isSmallFamily dflags fam_size = fam_size <= mAX_PTR_TAG dflags --- We keep the *zero-indexed* tag in the srt_len field of the info --- table of a data constructor. -dataConTagZ :: DataCon -> ConTagZ -dataConTagZ con = dataConTag con - fIRST_TAG - tagForCon :: DynFlags -> DataCon -> DynTag tagForCon dflags con - | isSmallFamily dflags fam_size = con_tag + 1 + | isSmallFamily dflags fam_size = con_tag | otherwise = 1 where - con_tag = dataConTagZ con + con_tag = dataConTag con -- NB: 1-indexed fam_size = tyConFamilySize (dataConTyCon con) tagForArity :: DynFlags -> RepArity -> DynTag @@ -1050,6 +1044,8 @@ mkDataConInfoTable dflags data_con is_static ptr_wds nonptr_wds info_lbl = mkConInfoTableLabel name NoCafRefs sm_rep = mkHeapRep dflags is_static ptr_wds nonptr_wds cl_type cl_type = Constr (dataConTagZ data_con) (dataConIdentity data_con) + -- We keep the *zero-indexed* tag in the srt_len field + -- of the info table of a data constructor. prof | not (gopt Opt_SccProfilingOn dflags) = NoProfilingInfo | otherwise = ProfilingInfo ty_descr val_descr diff --git a/compiler/codeGen/StgCmmMonad.hs b/compiler/codeGen/StgCmmMonad.hs index cf78269..754cbfb 100644 --- a/compiler/codeGen/StgCmmMonad.hs +++ b/compiler/codeGen/StgCmmMonad.hs @@ -74,6 +74,7 @@ import Module import Id import VarEnv import OrdList +import BasicTypes( ConTagZ ) import Unique import UniqSupply import FastString diff --git a/compiler/vectorise/Vectorise/Utils/Base.hs b/compiler/vectorise/Vectorise/Utils/Base.hs index 4227109..88058e2 100644 --- a/compiler/vectorise/Vectorise/Utils/Base.hs +++ b/compiler/vectorise/Vectorise/Utils/Base.hs @@ -4,7 +4,7 @@ module Vectorise.Utils.Base ( voidType , newLocalVVar - , mkDataConTag, dataConTagZ + , mkDataConTag , mkWrapType , mkClosureTypes , mkPReprType @@ -66,9 +66,6 @@ newLocalVVar fs vty mkDataConTag :: DynFlags -> DataCon -> CoreExpr mkDataConTag dflags = mkIntLitInt dflags . dataConTagZ -dataConTagZ :: DataCon -> Int -dataConTagZ con = dataConTag con - fIRST_TAG - -- Type Construction ---------------------------------------------------------- From git at git.haskell.org Sat Apr 29 02:35:22 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 29 Apr 2017 02:35:22 +0000 (UTC) Subject: [commit: ghc] master: Enable new warning for fragile/incorrect CPP #if usage (e5b3492) Message-ID: <20170429023522.EF9E43A588@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e5b3492f23c2296d0d8221e1787ee585331f726e/ghc >--------------------------------------------------------------- commit e5b3492f23c2296d0d8221e1787ee585331f726e Author: Erik de Castro Lopo Date: Wed Apr 5 05:53:46 2017 +1000 Enable new warning for fragile/incorrect CPP #if usage The C code in the RTS now gets built with `-Wundef` and the Haskell code (stages 1 and 2 only) with `-Wcpp-undef`. We now get warnings whereever `#if` is used on undefined identifiers. Test Plan: Validate on Linux and Windows Reviewers: austin, angerman, simonmar, bgamari, Phyx Reviewed By: bgamari Subscribers: thomie, snowleopard Differential Revision: https://phabricator.haskell.org/D3278 >--------------------------------------------------------------- e5b3492f23c2296d0d8221e1787ee585331f726e compiler/utils/Util.hs | 2 +- ghc/GHCi/UI.hs | 2 +- includes/CodeGen.Platform.hs | 52 +++++++++++++++++++++++------------------- includes/Stg.h | 6 ++--- includes/rts/OSThreads.h | 4 ++-- includes/stg/HaskellMachRegs.h | 36 ++++++++++++++++++++++------- includes/stg/MachRegs.h | 14 ++++++------ includes/stg/RtsMachRegs.h | 36 ++++++++++++++++++++++------- includes/stg/SMP.h | 37 ++++++++++++++++-------------- libraries/ghci/GHCi/ObjLink.hs | 2 +- mk/warnings.mk | 4 ++-- rts/LinkerInternals.h | 3 ++- rts/OldARMAtomic.c | 2 +- rts/PrimOps.cmm | 4 ++-- rts/RtsUtils.c | 4 ++-- rts/Schedule.c | 16 ++++++------- rts/Threads.c | 2 +- rts/ghc.mk | 3 +++ rts/linker/MachO.c | 10 ++++---- rts/posix/GetTime.c | 2 +- rts/posix/OSMem.c | 8 +++---- rts/posix/OSThreads.c | 2 +- rts/posix/itimer/Pthread.c | 6 ++--- rts/sm/CNF.c | 2 +- rts/sm/GCUtils.c | 2 +- rts/sm/GCUtils.h | 2 +- rts/sm/MBlock.c | 2 +- 27 files changed, 159 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 e5b3492f23c2296d0d8221e1787ee585331f726e From git at git.haskell.org Sat Apr 29 02:35:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 29 Apr 2017 02:35:26 +0000 (UTC) Subject: [commit: ghc] master: Prefer #if defined to #ifdef (945c45a) Message-ID: <20170429023526.042A13A588@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/945c45ad50ed31e3acb96fdaafb21640c4669f12/ghc >--------------------------------------------------------------- commit 945c45ad50ed31e3acb96fdaafb21640c4669f12 Author: Ben Gamari Date: Fri Apr 21 09:16:48 2017 -0400 Prefer #if defined to #ifdef Our new CPP linter enforces this. >--------------------------------------------------------------- 945c45ad50ed31e3acb96fdaafb21640c4669f12 compiler/basicTypes/RdrName.hs | 2 +- compiler/cmm/MkGraph.hs | 2 +- compiler/coreSyn/CoreArity.hs | 2 +- compiler/deSugar/Desugar.hs | 2 +- compiler/ghci/GHCi.hsc | 14 +- compiler/iface/MkIface.hs | 2 +- compiler/llvmGen/Llvm/Types.hs | 2 +- compiler/llvmGen/LlvmCodeGen/CodeGen.hs | 2 +- compiler/main/DynFlags.hs | 6 +- compiler/main/DynamicLoading.hs | 6 +- compiler/main/SysTools.hs | 6 +- compiler/parser/cutils.c | 2 +- compiler/prelude/primops.txt.pp | 2 +- compiler/simplCore/SimplCore.hs | 6 +- compiler/specialise/Rules.hs | 2 +- compiler/typecheck/TcMType.hs | 2 +- compiler/typecheck/TcPluginM.hs | 4 +- compiler/typecheck/TcRnDriver.hs | 4 +- compiler/typecheck/TcSMonad.hs | 8 +- compiler/utils/Panic.hs | 2 +- compiler/utils/Util.hs | 20 +- driver/gcc/gcc.c | 2 +- ghc/GHCi/UI.hs | 8 +- ghc/Main.hs | 12 +- ghc/hschooks.c | 2 +- includes/Cmm.h | 18 +- includes/CodeGen.Platform.hs | 410 ++++++++++++------------- includes/HsFFI.h | 4 +- includes/MachDeps.h | 4 +- includes/Rts.h | 30 +- includes/RtsAPI.h | 6 +- includes/Stg.h | 6 +- includes/rts/EventLogFormat.h | 2 +- includes/rts/Flags.h | 2 +- includes/rts/OSThreads.h | 14 +- includes/rts/Threads.h | 2 +- includes/rts/prof/LDV.h | 4 +- includes/rts/storage/Block.h | 12 +- includes/rts/storage/ClosureMacros.h | 8 +- includes/rts/storage/Closures.h | 4 +- includes/rts/storage/InfoTables.h | 24 +- includes/rts/storage/MBlock.h | 2 +- includes/rts/storage/TSO.h | 6 +- includes/stg/DLL.h | 4 +- includes/stg/HaskellMachRegs.h | 14 +- includes/stg/MachRegs.h | 18 +- includes/stg/MiscClosures.h | 6 +- includes/stg/RtsMachRegs.h | 18 +- includes/stg/Ticky.h | 4 +- libraries/base/Control/Concurrent.hs | 12 +- libraries/base/Data/Bits.hs | 2 +- libraries/base/Data/OldList.hs | 10 +- libraries/base/Data/Semigroup.hs | 4 +- libraries/base/Foreign/C/String.hs | 2 +- libraries/base/GHC/Conc.hs | 8 +- libraries/base/GHC/Conc/IO.hs | 22 +- libraries/base/GHC/Conc/Windows.hs | 2 +- libraries/base/GHC/Environment.hs | 4 +- libraries/base/GHC/Event/KQueue.hsc | 4 +- libraries/base/GHC/Event/Poll.hsc | 2 +- libraries/base/GHC/IO/Buffer.hs | 12 +- libraries/base/GHC/IO/Encoding/CodePage.hs | 2 +- libraries/base/GHC/IO/Encoding/CodePage/API.hs | 10 +- libraries/base/GHC/IO/Encoding/Iconv.hs | 2 +- libraries/base/GHC/IO/FD.hs | 30 +- libraries/base/GHC/IO/Handle.hs | 2 +- libraries/base/GHC/IO/Handle/FD.hs | 6 +- libraries/base/GHC/IO/Handle/Text.hs | 2 +- libraries/base/GHC/IO/Handle/Types.hs | 6 +- libraries/base/GHC/List.hs | 28 +- libraries/base/GHC/Real.hs | 4 +- libraries/base/GHC/TopHandler.hs | 6 +- libraries/base/System/Environment.hs | 28 +- libraries/base/System/IO.hs | 8 +- libraries/base/System/Posix/Internals.hs | 6 +- libraries/base/System/Timeout.hs | 4 +- libraries/base/cbits/SetEnv.c | 4 +- libraries/base/cbits/iconv.c | 2 +- libraries/base/cbits/primFloat.c | 2 +- libraries/base/include/HsBase.h | 54 ++-- libraries/base/include/ieee-flpt.h | 14 +- libraries/ghci/GHCi/ObjLink.hs | 4 +- libraries/ghci/GHCi/Signals.hs | 2 +- rts/Adjustor.c | 6 +- rts/AdjustorAsm.S | 4 +- rts/Apply.cmm | 8 +- rts/Apply.h | 4 +- rts/AutoApply.h | 2 +- rts/Capability.c | 10 +- rts/Capability.h | 4 +- rts/CheckUnload.c | 4 +- rts/Compact.cmm | 4 +- rts/Disassembler.c | 2 +- rts/Disassembler.h | 2 +- rts/FileLock.c | 6 +- rts/Globals.c | 10 +- rts/HeapStackCheck.cmm | 10 +- rts/Hpc.c | 8 +- rts/Interpreter.c | 62 ++-- rts/LdvProfile.c | 2 +- rts/LdvProfile.h | 2 +- rts/Libdw.c | 2 +- rts/Linker.c | 20 +- rts/Messages.c | 10 +- rts/Messages.h | 2 +- rts/Pool.c | 12 +- rts/Prelude.h | 2 +- rts/PrimOps.cmm | 34 +- rts/Printer.c | 14 +- rts/Printer.h | 2 +- rts/ProfHeap.c | 64 ++-- rts/ProfHeap.h | 2 +- rts/ProfilerReport.c | 2 +- rts/ProfilerReport.h | 2 +- rts/ProfilerReportJson.c | 2 +- rts/ProfilerReportJson.h | 2 +- rts/Profiling.c | 16 +- rts/Profiling.h | 6 +- rts/Proftimer.c | 8 +- rts/RaiseAsync.c | 8 +- rts/RaiseAsync.h | 2 +- rts/RetainerProfile.c | 82 ++--- rts/RetainerProfile.h | 4 +- rts/RetainerSet.c | 14 +- rts/RetainerSet.h | 14 +- rts/RtsAPI.c | 2 +- rts/RtsDllMain.c | 2 +- rts/RtsDllMain.h | 2 +- rts/RtsFlags.c | 48 +-- rts/RtsMain.c | 4 +- rts/RtsMessages.c | 4 +- rts/RtsProbes.d | 2 +- rts/RtsStartup.c | 18 +- rts/RtsSymbols.c | 4 +- rts/RtsSymbols.h | 2 +- rts/RtsUtils.c | 16 +- rts/RtsUtils.h | 2 +- rts/SMPClosureOps.h | 2 +- rts/STM.c | 2 +- rts/STM.h | 2 +- rts/Schedule.c | 62 ++-- rts/Stable.c | 6 +- rts/Stable.h | 2 +- rts/StaticPtrTable.c | 6 +- rts/Stats.c | 26 +- rts/Stats.h | 4 +- rts/StgCRun.c | 24 +- rts/StgStartup.cmm | 2 +- rts/StgStdThunks.cmm | 4 +- rts/Task.c | 8 +- rts/ThreadPaused.c | 4 +- rts/Threads.c | 6 +- rts/Threads.h | 4 +- rts/Timer.c | 4 +- rts/TopHandler.c | 6 +- rts/Trace.c | 66 ++-- rts/Trace.h | 12 +- rts/Updates.h | 6 +- rts/Weak.c | 2 +- rts/eventlog/EventLog.c | 14 +- rts/eventlog/EventLog.h | 4 +- rts/eventlog/EventLogWriter.c | 6 +- rts/linker/LoadArchive.c | 2 +- rts/linker/M32Alloc.h | 2 +- rts/linker/MachO.c | 22 +- rts/linker/MachO.h | 2 +- rts/linker/PEi386.c | 6 +- rts/linker/PEi386.h | 2 +- rts/linker/SymbolExtras.c | 8 +- rts/linker/SymbolExtras.h | 2 +- rts/package.conf.in | 20 +- rts/posix/Clock.h | 10 +- rts/posix/GetTime.c | 4 +- rts/posix/OSMem.c | 26 +- rts/posix/OSThreads.c | 8 +- rts/posix/Signals.c | 22 +- rts/posix/Signals.h | 2 +- rts/posix/TTY.c | 4 +- rts/posix/itimer/Pthread.c | 12 +- rts/posix/itimer/Setitimer.c | 6 +- rts/posix/itimer/TimerCreate.c | 2 +- rts/sm/BlockAlloc.c | 2 +- rts/sm/BlockAlloc.h | 2 +- rts/sm/CNF.c | 16 +- rts/sm/CNF.h | 2 +- rts/sm/Compact.c | 2 +- rts/sm/Evac.c | 16 +- rts/sm/Evac_thr.c | 2 +- rts/sm/GC.c | 28 +- rts/sm/GC.h | 2 +- rts/sm/GCThread.h | 2 +- rts/sm/GCUtils.c | 6 +- rts/sm/GCUtils.h | 2 +- rts/sm/HeapAlloc.h | 2 +- rts/sm/MBlock.c | 10 +- rts/sm/MarkWeak.c | 4 +- rts/sm/OSMem.h | 2 +- rts/sm/Sanity.c | 6 +- rts/sm/Sanity.h | 2 +- rts/sm/Scav.c | 6 +- rts/sm/Scav.h | 2 +- rts/sm/Scav_thr.c | 2 +- rts/sm/ShouldCompact.h | 2 +- rts/sm/Storage.c | 16 +- rts/win32/AsyncIO.c | 2 +- rts/win32/ConsoleHandler.c | 2 +- rts/win32/GetTime.c | 2 +- rts/win32/OSMem.c | 2 +- rts/win32/OSThreads.c | 6 +- rts/win32/ThrIOManager.c | 2 +- rts/win32/veh_excn.c | 2 +- utils/genapply/Main.hs | 4 +- utils/ghc-pkg/Main.hs | 10 +- utils/hp2ps/HpFile.c | 2 +- utils/hp2ps/Main.c | 2 +- utils/hp2ps/Main.h | 6 +- utils/lndir/lndir-Xos.h | 30 +- utils/lndir/lndir-Xosdefs.h | 32 +- utils/lndir/lndir.c | 40 +-- utils/unlit/unlit.c | 6 +- 220 files changed, 1184 insertions(+), 1184 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 945c45ad50ed31e3acb96fdaafb21640c4669f12 From git at git.haskell.org Sun Apr 30 09:26:30 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 30 Apr 2017 09:26:30 +0000 (UTC) Subject: [commit: ghc] master: Remove unused tidyOccNames and update Note (41d9a79) Message-ID: <20170430092630.A26BC3A588@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/41d9a79078b48b0e308be1fc61b9bd1b616c76c5/ghc >--------------------------------------------------------------- commit 41d9a79078b48b0e308be1fc61b9bd1b616c76c5 Author: Joachim Breitner Date: Sun Apr 30 09:29:49 2017 +0200 Remove unused tidyOccNames and update Note addressing rwbarton’s concerns in https://phabricator.haskell.org/rGHC18ac80ff729e#66197 Differential Revision: https://phabricator.haskell.org/D3511 >--------------------------------------------------------------- 41d9a79078b48b0e308be1fc61b9bd1b616c76c5 compiler/basicTypes/OccName.hs | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/compiler/basicTypes/OccName.hs b/compiler/basicTypes/OccName.hs index cde7cc5..f9c875e 100644 --- a/compiler/basicTypes/OccName.hs +++ b/compiler/basicTypes/OccName.hs @@ -99,8 +99,7 @@ module OccName ( -- * Tidying up TidyOccEnv, emptyTidyOccEnv, initTidyOccEnv, - tidyOccName, - tidyOccNames, avoidClashesOccEnv, + tidyOccName, avoidClashesOccEnv, -- FsEnv FastStringEnv, emptyFsEnv, lookupFsEnv, extendFsEnv, mkFsEnv @@ -117,7 +116,6 @@ import Outputable import Lexeme import Binary import Control.DeepSeq -import Data.List (mapAccumL) import Data.Char import Data.Data @@ -854,15 +852,13 @@ would like to see is (id,id,id) :: (a3 -> a3, a2 -> a2, a1 -> a1) -This is achieved in tidyOccNames. It still uses tidyOccName to rename each name -on its own, but it prepares the TidyEnv (using avoidClashesOccEnv), by “blocking” every -name that occurs twice in the map. This way, none of the "a"s will get the -priviledge of keeping this name, and all of them will get a suitable numbery by -tidyOccName. +To achieve this, the function avoidClashesOccEnv can be used to prepare the +TidyEnv, by “blocking” every name that occurs twice in the map. This way, none +of the "a"s will get the priviledge of keeping this name, and all of them will +get a suitable number by tidyOccName. -It may be inappropriate to use tidyOccNames if the caller needs access to the -intermediate environments (e.g. to tidy the tyVarKind of a type variable). In that -case, avoidClashesOccEnv should be used directly, and tidyOccName afterwards. +This prepared TidyEnv can then be used with tidyOccName. See tidyTyCoVarBndrs +for an example where this is used. This is #12382. @@ -880,11 +876,6 @@ initTidyOccEnv = foldl add emptyUFM add env (OccName _ fs) = addToUFM env fs 1 -- see Note [Tidying multiple names at once] -tidyOccNames :: TidyOccEnv -> [OccName] -> (TidyOccEnv, [OccName]) -tidyOccNames env occs = mapAccumL tidyOccName env' occs - where - env' = avoidClashesOccEnv env occs - avoidClashesOccEnv :: TidyOccEnv -> [OccName] -> TidyOccEnv avoidClashesOccEnv env occs = go env emptyUFM occs where From git at git.haskell.org Sun Apr 30 17:25:58 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 30 Apr 2017 17:25:58 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: get-win32-tarballs: Grab perl tarball from haskell.org, not GitHub (041463b) Message-ID: <20170430172558.AEC2E3A588@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/041463b2ebc215bacf4146cb9a9f57c5f1a4be6e/ghc >--------------------------------------------------------------- commit 041463b2ebc215bacf4146cb9a9f57c5f1a4be6e Author: Ben Gamari Date: Fri Apr 28 13:20:14 2017 -0400 get-win32-tarballs: Grab perl tarball from haskell.org, not GitHub Reviewers: austin, dfeuer Reviewed By: dfeuer Subscribers: Phyx, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3509 (cherry picked from commit ba597c1dd1daf9643b72dc7aeace8d6b3fce84eb) >--------------------------------------------------------------- 041463b2ebc215bacf4146cb9a9f57c5f1a4be6e mk/get-win32-tarballs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mk/get-win32-tarballs.sh b/mk/get-win32-tarballs.sh index f51a304..88e3d05 100755 --- a/mk/get-win32-tarballs.sh +++ b/mk/get-win32-tarballs.sh @@ -102,7 +102,7 @@ download_tarballs() { download_mingw "${format_url}-x86_64-mpc-1.0.3-2.src.tar.gz" fi - download_file "https://github.com/ghc/ghc-tarballs/blob/master/perl/ghc-perl-1.tar.gz?raw=true" "ghc-tarballs/perl/ghc-perl-1.tar.gz" "Windows Perl binary distributions" "--insecure" + download_file "https://downloads.haskell.org/~ghc/mingw/ghc-perl-1.tar.gz" "ghc-tarballs/perl/ghc-perl-1.tar.gz" "Windows Perl binary distributions" if ! test "$missing_files" = "0" then From git at git.haskell.org Sun Apr 30 17:26:05 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 30 Apr 2017 17:26:05 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Add regression test for #12104 (477e7d2) Message-ID: <20170430172605.C08F03A588@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/477e7d2860b2c68c820db004e4ad094f162632ea/ghc >--------------------------------------------------------------- commit 477e7d2860b2c68c820db004e4ad094f162632ea Author: Ryan Scott Date: Fri Apr 28 13:24:11 2017 -0400 Add regression test for #12104 Commit 2f9f1f86849ebc18af409c9b3fd809c9cd464021 (#13487) fixes #12104 as well. This adds a regression test for the program reported in #12104 to keep it fixed. Test Plan: make test TEST=T12104 Reviewers: bgamari, austin Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #12104 Differential Revision: https://phabricator.haskell.org/D3495 (cherry picked from commit 69b9b853e3e68191cdfa8aec0e4da966298a2659) >--------------------------------------------------------------- 477e7d2860b2c68c820db004e4ad094f162632ea testsuite/tests/typecheck/should_compile/T12104.hs | 11 +++++++++++ testsuite/tests/typecheck/should_compile/T12104.stderr | 5 +++++ testsuite/tests/typecheck/should_compile/all.T | 1 + 3 files changed, 17 insertions(+) diff --git a/testsuite/tests/typecheck/should_compile/T12104.hs b/testsuite/tests/typecheck/should_compile/T12104.hs new file mode 100644 index 0000000..12c309c --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T12104.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE TypeFamilies, DataKinds, UndecidableInstances #-} + +module T12104 where + +import GHC.TypeLits + +type family F a where + F a = TypeError (Text "error") + +err :: F () +err = () diff --git a/testsuite/tests/typecheck/should_compile/T12104.stderr b/testsuite/tests/typecheck/should_compile/T12104.stderr new file mode 100644 index 0000000..7848551 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T12104.stderr @@ -0,0 +1,5 @@ + +T12104.hs:11:7: warning: [-Wdeferred-type-errors (in -Wdefault)] + • error + • In the expression: () + In an equation for ‘err’: err = () diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index 1e98ec5..29832d9 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -510,6 +510,7 @@ test('T11339c', normal, compile, ['']) test('T11339d', normal, compile, ['']) test('T11974', normal, compile, ['']) test('T12067', [], multimod_compile, ['T12067', '-v0']) +test('T12104', normal, compile, ['-fdefer-type-errors']) test('T12185', normal, compile, ['']) test('T12133', normal, compile, ['']) test('T12381', normal, compile, ['']) From git at git.haskell.org Sun Apr 30 17:26:08 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 30 Apr 2017 17:26:08 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: CSE: Fix cut and paste error (70b235c) Message-ID: <20170430172608.7D0D53A588@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/70b235c26bae131fdf4f19d6fcf5ddf98dfce2bb/ghc >--------------------------------------------------------------- commit 70b235c26bae131fdf4f19d6fcf5ddf98dfce2bb Author: Ben Gamari Date: Fri Apr 28 13:25:17 2017 -0400 CSE: Fix cut and paste error extendCSRecEnv took the map to be extended from cs_map instead of cs_rec_map. Oops! Test Plan: Validate Reviewers: simonpj, austin Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3510 (cherry picked from commit 9f9b90f1fb85fef568f535664f55c4674603e65b) >--------------------------------------------------------------- 70b235c26bae131fdf4f19d6fcf5ddf98dfce2bb compiler/simplCore/CSE.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/simplCore/CSE.hs b/compiler/simplCore/CSE.hs index ddc5b88..6312a9d 100644 --- a/compiler/simplCore/CSE.hs +++ b/compiler/simplCore/CSE.hs @@ -282,7 +282,7 @@ with mutual recursion it's quite hard; but for self-recursive bindings 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 + Bingo we get a hit. So we can replace the 'g' binding with g = f We can't use cs_map for this, because the key isn't an expression of @@ -565,7 +565,7 @@ extendCSEnv cse expr triv_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 } + = cse { cs_rec_map = extendCoreMap (cs_rec_map cse) (Lam bndr expr) triv_expr } lookupCSRecEnv :: CSEnv -> OutId -> OutExpr -> Maybe OutExpr -- See Note [CSE for recursive bindings] From git at git.haskell.org Sun Apr 30 17:26:11 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 30 Apr 2017 17:26:11 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Make the tyvars in TH-reified data family instances uniform (f977b76) Message-ID: <20170430172611.9FF963A588@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/f977b76340aa0924a63592b9262203a7b13dc5b6/ghc >--------------------------------------------------------------- commit f977b76340aa0924a63592b9262203a7b13dc5b6 Author: Ryan Scott Date: Fri Apr 28 13:24:31 2017 -0400 Make the tyvars in TH-reified data family instances uniform It turns out we were using two different sets of type variables when reifying data family instances in Template Haskell. We were using the tyvars quantifying over the instance itself for the LHS, but using the tyvars quantifying over the data family instance constructor for the RHS. This commit uses the instance tyvars for both the LHS and the RHS, fixing #13618. Test Plan: make test TEST=T13618 Reviewers: goldfire, austin, bgamari Reviewed By: goldfire, bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #13618 Differential Revision: https://phabricator.haskell.org/D3505 (cherry picked from commit b2c38d6b4003d3dda60d15204283da5aab15c2ec) >--------------------------------------------------------------- f977b76340aa0924a63592b9262203a7b13dc5b6 compiler/typecheck/TcSplice.hs | 13 ++++++----- testsuite/tests/th/T13618.hs | 25 ++++++++++++++++++++++ .../tests/th/T13618.stdout | 0 testsuite/tests/th/all.T | 1 + 4 files changed, 34 insertions(+), 5 deletions(-) diff --git a/compiler/typecheck/TcSplice.hs b/compiler/typecheck/TcSplice.hs index 8e9fd22..c5eeb4b 100644 --- a/compiler/typecheck/TcSplice.hs +++ b/compiler/typecheck/TcSplice.hs @@ -1627,6 +1627,7 @@ reifyFamilyInstance :: [Bool] -- True <=> the corresponding tv is poly-kinded -> FamInst -> TcM TH.Dec reifyFamilyInstance is_poly_tvs inst@(FamInst { fi_flavor = flavor , fi_fam = fam + , fi_tvs = fam_tvs , fi_tys = lhs , fi_rhs = rhs }) = case flavor of @@ -1641,7 +1642,7 @@ reifyFamilyInstance is_poly_tvs inst@(FamInst { fi_flavor = flavor (TH.TySynEqn annot_th_lhs th_rhs)) } DataFamilyInst rep_tc -> - do { let tvs = tyConTyVars rep_tc + do { let rep_tvs = tyConTyVars rep_tc fam' = reifyName fam -- eta-expand lhs types, because sometimes data/newtype @@ -1649,12 +1650,14 @@ reifyFamilyInstance is_poly_tvs inst@(FamInst { fi_flavor = flavor -- See Note [Eta reduction for data family axioms] -- in TcInstDcls (_rep_tc, rep_tc_args) = splitTyConApp rhs - etad_tyvars = dropList rep_tc_args tvs - eta_expanded_lhs = lhs `chkAppend` mkTyVarTys etad_tyvars - dataCons = tyConDataCons rep_tc + etad_tyvars = dropList rep_tc_args rep_tvs + etad_tys = mkTyVarTys etad_tyvars + eta_expanded_tvs = mkTyVarTys fam_tvs `chkAppend` etad_tys + eta_expanded_lhs = lhs `chkAppend` etad_tys + dataCons = tyConDataCons rep_tc -- see Note [Reifying GADT data constructors] isGadt = any (not . null . dataConEqSpec) dataCons - ; cons <- mapM (reifyDataCon isGadt (mkTyVarTys tvs)) dataCons + ; cons <- mapM (reifyDataCon isGadt eta_expanded_tvs) dataCons ; let types_only = filterOutInvisibleTypes fam_tc eta_expanded_lhs ; th_tys <- reifyTypes types_only ; annot_th_tys <- zipWith3M annotThType is_poly_tvs types_only th_tys diff --git a/testsuite/tests/th/T13618.hs b/testsuite/tests/th/T13618.hs new file mode 100644 index 0000000..487b5e4 --- /dev/null +++ b/testsuite/tests/th/T13618.hs @@ -0,0 +1,25 @@ +{-# LANGUAGE LambdaCase #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE TypeFamilies #-} +module Main where + +import Language.Haskell.TH +import Language.Haskell.TH.Syntax (lift) + +data family DF a +data instance DF [a] = DFList a +newtype instance DF (Maybe a) = DFMaybe a + +$(return []) + +main :: IO () +main = print + $(do FamilyI (DataFamilyD _ _ _) insts <- reify ''DF + lift $ all (\case DataInstD _ _ [AppT _ (VarT v1)] _ + [NormalC _ [(_, VarT v2)]] _ + -> v1 == v2 + NewtypeInstD _ _ [AppT _ (VarT v1)] _ + (NormalC _ [(_, VarT v2)]) _ + -> v1 == v2 + _ -> error "Not a data or newtype instance") + insts) diff --git a/libraries/base/tests/IO/IOError002.stdout b/testsuite/tests/th/T13618.stdout similarity index 100% copy from libraries/base/tests/IO/IOError002.stdout copy to testsuite/tests/th/T13618.stdout diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index e4d4731..e5a285a 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -381,3 +381,4 @@ test('T13123', normal, compile, ['-v0']) test('T13098', normal, compile, ['-v0']) test('T11046', normal, multimod_compile, ['T11046','-v0']) test('T13366', normal, compile_and_run, ['-lstdc++ -v0']) +test('T13618', normal, compile_and_run, ['-v0']) From git at git.haskell.org Sun Apr 30 17:26:02 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 30 Apr 2017 17:26:02 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Add a missing addDeferredBinding (a97406e) Message-ID: <20170430172602.5846F3A588@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/a97406e978de9bbc333da48cb36d2b65da85dc7a/ghc >--------------------------------------------------------------- commit a97406e978de9bbc333da48cb36d2b65da85dc7a Author: Simon Peyton Jones Date: Wed Apr 5 13:39:51 2017 +0100 Add a missing addDeferredBinding I'd forgotten to add deferred bindings for user type errors. Fixes Trac #13487. (cherry picked from commit 2f9f1f86849ebc18af409c9b3fd809c9cd464021) >--------------------------------------------------------------- a97406e978de9bbc333da48cb36d2b65da85dc7a compiler/typecheck/TcErrors.hs | 3 ++- testsuite/tests/typecheck/should_fail/T13487.hs | 19 +++++++++++++++++++ testsuite/tests/typecheck/should_fail/T13487.stderr | 5 +++++ testsuite/tests/typecheck/should_fail/all.T | 1 + 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/compiler/typecheck/TcErrors.hs b/compiler/typecheck/TcErrors.hs index fc59920..a58620e 100644 --- a/compiler/typecheck/TcErrors.hs +++ b/compiler/typecheck/TcErrors.hs @@ -599,7 +599,8 @@ mkHoleReporter ctxt mkUserTypeErrorReporter :: Reporter mkUserTypeErrorReporter ctxt = mapM_ $ \ct -> do { err <- mkUserTypeError ctxt ct - ; maybeReportError ctxt err } + ; maybeReportError ctxt err + ; addDeferredBinding ctxt err ct } mkUserTypeError :: ReportErrCtxt -> Ct -> TcM ErrMsg mkUserTypeError ctxt ct = mkErrorMsgFromCt ctxt ct diff --git a/testsuite/tests/typecheck/should_fail/T13487.hs b/testsuite/tests/typecheck/should_fail/T13487.hs new file mode 100644 index 0000000..6b5462e --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T13487.hs @@ -0,0 +1,19 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE UndecidableInstances #-} +{-# OPTIONS_GHC -fdefer-type-errors #-} + +module T13487 where + +import Data.Kind (Constraint) +import GHC.TypeLits + +data Foo a b where + K :: Error a b => a -> b -> Foo a b + +type family Error a b :: Constraint where + Error Int Int = () + Error _ _ = TypeError ('Text "GHC panic in 3... 2... 1...") + +foo = K 'a' 'b' diff --git a/testsuite/tests/typecheck/should_fail/T13487.stderr b/testsuite/tests/typecheck/should_fail/T13487.stderr new file mode 100644 index 0000000..c6f6c26 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T13487.stderr @@ -0,0 +1,5 @@ + +T13487.hs:19:7: warning: [-Wdeferred-type-errors (in -Wdefault)] + • GHC panic in 3... 2... 1... + • In the expression: K 'a' 'b' + In an equation for ‘foo’: foo = K 'a' 'b' diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index 8fbe141..e5c5e71 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -427,6 +427,7 @@ test('StrictBinds', normal, compile_fail, ['']) test('T13068', [extra_files(['T13068.hs', 'T13068a.hs', 'T13068.hs-boot', 'T13068m.hs'])], multimod_compile_fail, ['T13068m', '']) test('T13105', normal, compile_fail, ['']) test('LevPolyBounded', normal, compile_fail, ['']) +test('T13487', normal, compile, ['']) test('T13292', normal, multimod_compile, ['T13292', '-v0 -fdefer-type-errors']) test('T13300', normal, compile_fail, ['']) test('T12709', normal, compile_fail, ['']) From git at git.haskell.org Sun Apr 30 17:26:14 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 30 Apr 2017 17:26:14 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: PPC NCG: Implement callish prim ops (f6289e7) Message-ID: <20170430172614.63BFD3A588@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/f6289e72b266620606ca8d92658f429b584ffb61/ghc >--------------------------------------------------------------- commit f6289e72b266620606ca8d92658f429b584ffb61 Author: Peter Trommler Date: Tue Apr 25 18:37:16 2017 -0400 PPC NCG: Implement callish prim ops Provide PowerPC optimised implementations of callish prim ops. MO_?_QuotRem The generic implementation of quotient remainder prim ops uses a division and a remainder operation. There is no remainder on PowerPC and so we need to implement remainder "by hand" which results in a duplication of the divide operation when using the generic code. Avoid this duplication by implementing the prim op in the native code generator. MO_U_Mul2 Use PowerPC's instructions for long multiplication. Addition and subtraction Use PowerPC add/subtract with carry/overflow instructions MO_Clz and MO_Ctz Use PowerPC's CNTLZ instruction and implement count trailing zeros using count leading zeros MO_QuotRem2 Implement an algorithm given by Henry Warren in "Hacker's Delight" using PowerPC divide instruction. TODO: Use long division instructions when available (POWER7 and later). Test Plan: validate on AIX and 32-bit Linux Reviewers: simonmar, erikd, hvr, austin, bgamari Reviewed By: erikd, hvr, bgamari Subscribers: trofi, kgardas, thomie Differential Revision: https://phabricator.haskell.org/D2973 (cherry picked from commit 89a3241f708502e8fbcfaddbbe634790ad9cd02a) >--------------------------------------------------------------- f6289e72b266620606ca8d92658f429b584ffb61 compiler/codeGen/StgCmmPrim.hs | 28 ++- compiler/nativeGen/PIC.hs | 5 +- compiler/nativeGen/PPC/CodeGen.hs | 464 ++++++++++++++++++++++++++++++++------ compiler/nativeGen/PPC/Instr.hs | 102 ++++----- compiler/nativeGen/PPC/Ppr.hs | 196 +++++++++++----- 5 files changed, 611 insertions(+), 184 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc f6289e72b266620606ca8d92658f429b584ffb61 From git at git.haskell.org Sun Apr 30 17:26:17 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 30 Apr 2017 17:26:17 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Don't setProgramDynFlags on every :load (d30ccd4) Message-ID: <20170430172617.9E9F13A588@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/d30ccd45705ca5b613a6282e63ebf48c67369b4d/ghc >--------------------------------------------------------------- commit d30ccd45705ca5b613a6282e63ebf48c67369b4d Author: Simon Marlow Date: Thu Mar 30 10:31:08 2017 +0100 Don't setProgramDynFlags on every :load Summary: setProgramDynFlags invalidates the whole module graph, forcing everything to be re-summarised (including preprocessing) on every :reload. Looks like this was a bad regression in 8.0, but we didn't notice because there was no test for it. Now there is! Test Plan: * validate * new unit test Reviewers: bgamari, triple, austin, niteria, erikd, jme Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3398 (cherry picked from commit 914842e518bccafac16b3495bcec56be58b0387a) >--------------------------------------------------------------- d30ccd45705ca5b613a6282e63ebf48c67369b4d ghc/GHCi/UI.hs | 46 +++++++++++++++++------------ testsuite/tests/ghci/scripts/all.T | 1 + testsuite/tests/ghci/scripts/ghci063.script | 18 +++++++++++ 3 files changed, 46 insertions(+), 19 deletions(-) diff --git a/ghc/GHCi/UI.hs b/ghc/GHCi/UI.hs index 14de6bf..44f0935 100644 --- a/ghc/GHCi/UI.hs +++ b/ghc/GHCi/UI.hs @@ -104,7 +104,7 @@ import Data.Time.Format ( formatTime, defaultTimeLocale ) import Data.Version ( showVersion ) import Exception hiding (catch) -import Foreign +import Foreign hiding (void) import GHC.Stack hiding (SrcLoc(..)) import System.Directory @@ -186,15 +186,15 @@ ghciCommands = map mkCmd [ ("issafe", keepGoing' isSafeCmd, completeModule), ("kind", keepGoing' (kindOfType False), completeIdentifier), ("kind!", keepGoing' (kindOfType True), completeIdentifier), - ("load", keepGoingPaths (loadModule_ False), completeHomeModuleOrFile), - ("load!", keepGoingPaths (loadModule_ True), completeHomeModuleOrFile), + ("load", keepGoingPaths loadModule_, completeHomeModuleOrFile), + ("load!", keepGoingPaths loadModuleDefer, completeHomeModuleOrFile), ("list", keepGoing' listCmd, noCompletion), ("module", keepGoing moduleCmd, completeSetModule), ("main", keepGoing runMain, completeFilename), ("print", keepGoing printCmd, completeExpression), ("quit", quit, noCompletion), - ("reload", keepGoing' (reloadModule False), noCompletion), - ("reload!", keepGoing' (reloadModule True), noCompletion), + ("reload", keepGoing' reloadModule, noCompletion), + ("reload!", keepGoing' reloadModuleDefer, noCompletion), ("run", keepGoing runRun, completeFilename), ("script", keepGoing' scriptCmd, completeFilename), ("set", keepGoing setCmd, completeSetOptions), @@ -1444,7 +1444,7 @@ editFile str = code <- liftIO $ system (cmd ++ cmdArgs) when (code == ExitSuccess) - $ reloadModule False "" + $ reloadModule "" -- The user didn't specify a file so we pick one for them. -- Our strategy is to pick the first module that failed to load, @@ -1604,21 +1604,27 @@ checkModule m = do -- | Sets '-fdefer-type-errors' if 'defer' is true, executes 'load' and unsets -- '-fdefer-type-errors' again if it has not been set before. -deferredLoad :: Bool -> InputT GHCi SuccessFlag -> InputT GHCi () -deferredLoad defer load = do - -- Force originalFlags to avoid leaking the associated HscEnv - !originalFlags <- getDynFlags - when defer $ Monad.void $ - GHC.setProgramDynFlags $ setGeneralFlag' Opt_DeferTypeErrors originalFlags - Monad.void $ load - Monad.void $ GHC.setProgramDynFlags $ originalFlags +wrapDeferTypeErrors :: InputT GHCi a -> InputT GHCi a +wrapDeferTypeErrors load = + gbracket + (do + -- Force originalFlags to avoid leaking the associated HscEnv + !originalFlags <- getDynFlags + void $ GHC.setProgramDynFlags $ + setGeneralFlag' Opt_DeferTypeErrors originalFlags + return originalFlags) + (\originalFlags -> void $ GHC.setProgramDynFlags originalFlags) + (\_ -> load) loadModule :: [(FilePath, Maybe Phase)] -> InputT GHCi SuccessFlag loadModule fs = timeIt (const Nothing) (loadModule' fs) -- | @:load@ command -loadModule_ :: Bool -> [FilePath] -> InputT GHCi () -loadModule_ defer fs = deferredLoad defer (loadModule (zip fs (repeat Nothing))) +loadModule_ :: [FilePath] -> InputT GHCi () +loadModule_ fs = void $ loadModule (zip fs (repeat Nothing)) + +loadModuleDefer :: [FilePath] -> InputT GHCi () +loadModuleDefer = wrapDeferTypeErrors . loadModule_ loadModule' :: [(FilePath, Maybe Phase)] -> InputT GHCi SuccessFlag loadModule' files = do @@ -1654,13 +1660,15 @@ addModule files = do return () -- | @:reload@ command -reloadModule :: Bool -> String -> InputT GHCi () -reloadModule defer m = deferredLoad defer $ - doLoadAndCollectInfo True loadTargets +reloadModule :: String -> InputT GHCi () +reloadModule m = void $ doLoadAndCollectInfo True loadTargets where loadTargets | null m = LoadAllTargets | otherwise = LoadUpTo (GHC.mkModuleName m) +reloadModuleDefer :: String -> InputT GHCi () +reloadModuleDefer = wrapDeferTypeErrors . reloadModule + -- | Load/compile targets and (optionally) collect module-info -- -- This collects the necessary SrcSpan annotated type information (via diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T index cde72e4..77b611a 100755 --- a/testsuite/tests/ghci/scripts/all.T +++ b/testsuite/tests/ghci/scripts/all.T @@ -97,6 +97,7 @@ test('ghci061', normal, ghci_script, ['ghci061.script']) test('ghci062', [extra_files(['ghci062/', 'ghci062/Test.hs']), when(config.have_ext_interp, extra_ways(['ghci-ext']))], ghci_script, ['ghci062.script']) +test('ghci063', normal, ghci_script, ['ghci063.script']) test('T2452', normal, ghci_script, ['T2452.script']) test('T2766', normal, ghci_script, ['T2766.script']) diff --git a/testsuite/tests/ghci/scripts/ghci063.script b/testsuite/tests/ghci/scripts/ghci063.script new file mode 100644 index 0000000..87a19ba --- /dev/null +++ b/testsuite/tests/ghci/scripts/ghci063.script @@ -0,0 +1,18 @@ +:! echo module A where {} >A.hs +:! echo module B where { import A } >B.hs + +:load B + +-- We're going to replace B.hs with an invalid module but without +-- changing its timestamp. A :reload should *not* look at the +-- contents of the file, because the timestamp hasn't changed. +:! cp B.hs B.hs-copy +:! touch -r B.hs B.hs-copy +:! echo "*** INVALID ***" >B.hs +:! touch -r B.hs-copy B.hs + +:reload + +-- Put the original file back, now it should work +:! cp B.hs-copy B.hs +:reload From git at git.haskell.org Sun Apr 30 17:26:20 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 30 Apr 2017 17:26:20 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Bump haddock submodule (af73f39) Message-ID: <20170430172620.60C953A588@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/af73f39b3d472f4b2de50f481b61578102d6704a/ghc >--------------------------------------------------------------- commit af73f39b3d472f4b2de50f481b61578102d6704a Author: Ben Gamari Date: Sun Apr 30 12:53:38 2017 -0400 Bump haddock submodule >--------------------------------------------------------------- af73f39b3d472f4b2de50f481b61578102d6704a utils/haddock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/haddock b/utils/haddock index 7ec72d3..0278700 160000 --- a/utils/haddock +++ b/utils/haddock @@ -1 +1 @@ -Subproject commit 7ec72d3ad81657f5a5298ac1465229fa7cafb35c +Subproject commit 02787004ffeb16c9d848b77b6e23598b58596348 From git at git.haskell.org Sun Apr 30 21:29:21 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 30 Apr 2017 21:29:21 +0000 (UTC) Subject: [commit: packages/array] master: Drop support for GHC prior to GHC 7.8 (1244242) Message-ID: <20170430212921.7DFCE3A588@ghc.haskell.org> Repository : ssh://git at git.haskell.org/array On branch : master Link : http://git.haskell.org/packages/array.git/commitdiff/1244242d895724ae53b13104ca225455ff08259c >--------------------------------------------------------------- commit 1244242d895724ae53b13104ca225455ff08259c Author: Herbert Valerio Riedel Date: Sun Apr 30 23:25:05 2017 +0200 Drop support for GHC prior to GHC 7.8 The recent overflow check made the code stop working w/ prior versions of GHC. But there's little benefit in support much older GHCs, so it's easier to just cut the support window. >--------------------------------------------------------------- 1244242d895724ae53b13104ca225455ff08259c .travis.yml | 27 +++++++++++++-------------- Data/Array/Base.hs | 21 --------------------- Data/Array/IO/Internals.hs | 4 ---- Data/Array/Storable/Internals.hs | 7 +------ array.cabal | 4 ++-- changelog.md | 5 +++-- 6 files changed, 19 insertions(+), 49 deletions(-) diff --git a/.travis.yml b/.travis.yml index e42cee5..cfffef3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,8 @@ env: - - GHCVER=7.4.1 - - GHCVER=7.4.2 - - GHCVER=7.6.1 - - GHCVER=7.6.2 - - GHCVER=7.6.3 + - GHCVER=7.8.4 + - GHCVER=7.10.3 + - GHCVER=8.0.2 + - GHCVER=8.2.1 - GHCVER=head matrix: @@ -13,22 +12,22 @@ matrix: before_install: - sudo add-apt-repository -y ppa:hvr/ghc - sudo apt-get update - - sudo apt-get install cabal-install-1.18 ghc-$GHCVER - - export PATH=/opt/ghc/$GHCVER/bin:$PATH + - sudo apt-get install cabal-install-head ghc-$GHCVER + - export PATH=/opt/ghc/bin:$PATH install: - - cabal-1.18 update + - cabal update - ghc --version script: - - cabal-1.18 configure -v2 - - cabal-1.18 build - - cabal-1.18 check - - cabal-1.18 sdist - - export SRC_TGZ=$(cabal-1.18 info . | awk '{print $2 ".tar.gz";exit}') ; + - cabal configure -v2 + - cabal build + - cabal check + - cabal sdist + - export SRC_TGZ=$(cabal info . | awk '{print $2 ".tar.gz";exit}') ; cd dist/; if [ -f "$SRC_TGZ" ]; then - cabal-1.18 install "$SRC_TGZ"; + cabal install "$SRC_TGZ"; else echo "expected '$SRC_TGZ' not found"; exit 1; diff --git a/Data/Array/Base.hs b/Data/Array/Base.hs index 36db53f..8cc319c 100644 --- a/Data/Array/Base.hs +++ b/Data/Array/Base.hs @@ -1,7 +1,5 @@ {-# LANGUAGE BangPatterns, CPP, RankNTypes, MagicHash, UnboxedTuples, MultiParamTypeClasses, FlexibleInstances, FlexibleContexts, DeriveDataTypeable, UnliftedFFITypes #-} -#if __GLASGOW_HASKELL__ >= 708 {-# LANGUAGE RoleAnnotations #-} -#endif {-# OPTIONS_HADDOCK hide #-} ----------------------------------------------------------------------------- @@ -36,9 +34,6 @@ import GHC.Base ( IO(..), divInt# ) import GHC.Exts import GHC.Ptr ( nullPtr, nullFunPtr ) import GHC.Stable ( StablePtr(..) ) -#if !MIN_VERSION_base(4,6,0) -import GHC.Exts ( Word(..) ) -#endif import GHC.Int ( Int8(..), Int16(..), Int32(..), Int64(..) ) import GHC.Word ( Word8(..), Word16(..), Word32(..), Word64(..) ) import GHC.IO ( stToIO ) @@ -404,10 +399,8 @@ instance IArray Arr.Array e where -- data UArray i e = UArray !i !i !Int ByteArray# deriving Typeable -#if __GLASGOW_HASKELL__ >= 708 -- There are class-based invariants on both parameters. See also #9220. type role UArray nominal nominal -#endif {-# INLINE unsafeArrayUArray #-} unsafeArrayUArray :: (MArray (STUArray s) e (ST s), Ix i) @@ -504,11 +497,7 @@ instance IArray UArray Bool where {-# INLINE unsafeArray #-} unsafeArray lu ies = runST (unsafeArrayUArray lu ies False) {-# INLINE unsafeAt #-} -#if __GLASGOW_HASKELL__ > 706 unsafeAt (UArray _ _ _ arr#) (I# i#) = isTrue# -#else - unsafeAt (UArray _ _ _ arr#) (I# i#) = -#endif ((indexWordArray# arr# (bOOL_INDEX i#) `and#` bOOL_BIT i#) `neWord#` int2Word# 0#) @@ -991,19 +980,13 @@ instance MArray (STArray s) e (Lazy.ST s) where -- 'STArray' provides. data STUArray s i e = STUArray !i !i !Int (MutableByteArray# s) deriving Typeable -#if __GLASGOW_HASKELL__ >= 708 -- The "ST" parameter must be nominal for the safety of the ST trick. -- The other parameters have class constraints. See also #9220. type role STUArray nominal nominal nominal -#endif instance Eq (STUArray s i e) where STUArray _ _ _ arr1# == STUArray _ _ _ arr2# = -#if __GLASGOW_HASKELL__ > 706 isTrue# (sameMutableByteArray# arr1# arr2#) -#else - sameMutableByteArray# arr1# arr2# -#endif {-# INLINE unsafeNewArraySTUArray_ #-} unsafeNewArraySTUArray_ :: Ix i @@ -1037,11 +1020,7 @@ instance MArray (STUArray s) Bool (ST s) where {-# INLINE unsafeRead #-} unsafeRead (STUArray _ _ _ marr#) (I# i#) = ST $ \s1# -> case readWordArray# marr# (bOOL_INDEX i#) s1# of { (# s2#, e# #) -> -#if __GLASGOW_HASKELL__ > 706 (# s2#, isTrue# ((e# `and#` bOOL_BIT i#) `neWord#` int2Word# 0#) :: Bool #) } -#else - (# s2#, (e# `and#` bOOL_BIT i# `neWord#` int2Word# 0#) :: Bool #) } -#endif {-# INLINE unsafeWrite #-} unsafeWrite (STUArray _ _ _ marr#) (I# i#) e = ST $ \s1# -> case bOOL_INDEX i# of { j# -> diff --git a/Data/Array/IO/Internals.hs b/Data/Array/IO/Internals.hs index c934cc5..4f784de 100644 --- a/Data/Array/IO/Internals.hs +++ b/Data/Array/IO/Internals.hs @@ -1,8 +1,6 @@ {-# LANGUAGE DeriveDataTypeable, FlexibleInstances, MultiParamTypeClasses, CPP #-} -#if __GLASGOW_HASKELL__ >= 708 {-# LANGUAGE RoleAnnotations #-} -#endif {-# OPTIONS_HADDOCK hide #-} ----------------------------------------------------------------------------- @@ -54,10 +52,8 @@ import GHC.IOArray (IOArray(..)) -- newtype IOUArray i e = IOUArray (STUArray RealWorld i e) deriving Typeable -#if __GLASGOW_HASKELL__ >= 708 -- Both parameters have class-based invariants. See also #9220. type role IOUArray nominal nominal -#endif instance Eq (IOUArray i e) where IOUArray s1 == IOUArray s2 = s1 == s2 diff --git a/Data/Array/Storable/Internals.hs b/Data/Array/Storable/Internals.hs index 6741bb1..3fcd73a 100644 --- a/Data/Array/Storable/Internals.hs +++ b/Data/Array/Storable/Internals.hs @@ -1,7 +1,4 @@ -{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses, CPP #-} -#if __GLASGOW_HASKELL__ >= 708 -{-# LANGUAGE RoleAnnotations #-} -#endif +{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses, RoleAnnotations #-} {-# OPTIONS_HADDOCK hide #-} ----------------------------------------------------------------------------- -- | @@ -31,10 +28,8 @@ import Foreign hiding (newArray) -- |The array type data StorableArray i e = StorableArray !i !i Int !(ForeignPtr e) -#if __GLASGOW_HASKELL__ >= 708 -- Both parameters have class-based invariants. See also #9220. type role StorableArray nominal nominal -#endif instance Storable e => MArray StorableArray e IO where getBounds (StorableArray l u _ _) = return (l,u) diff --git a/array.cabal b/array.cabal index f52e562..58b8cf1 100644 --- a/array.cabal +++ b/array.cabal @@ -9,7 +9,7 @@ synopsis: Mutable and immutable arrays category: Data Structures build-type: Simple cabal-version: >=1.10 -tested-with: GHC==7.6.3, GHC==7.6.2, GHC==7.6.1, GHC==7.4.2, GHC==7.4.1 +tested-with: GHC==8.2.1, GHC==8.0.2, GHC==7.10.3, GHC==7.8.4 description: In addition to providing the "Data.Array" module , @@ -37,7 +37,7 @@ library Trustworthy, UnboxedTuples, UnliftedFFITypes - build-depends: base >= 4.5 && < 4.11 + build-depends: base >= 4.7 && < 4.11 ghc-options: -Wall exposed-modules: Data.Array diff --git a/changelog.md b/changelog.md index 8421c23..209f2f0 100644 --- a/changelog.md +++ b/changelog.md @@ -1,9 +1,10 @@ # Changelog for [`array` package](http://hackage.haskell.org/package/array) -## 0.5.1.2 *TBD* +## 0.5.1.2 *May 2017* * Bundled with GHC 8.2.1 - * Overflow check in `unsafeNewArray` + * Overflow check in `unsafeNewArray` (#229) + * Drop support for GHC versions prior to GHC 7.8 ## 0.5.1.1 *Apr 2016* From git at git.haskell.org Sun Apr 30 23:45:23 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 30 Apr 2017 23:45:23 +0000 (UTC) Subject: [commit: ghc] branch 'wip/rwbarton-D3516' created Message-ID: <20170430234523.C36973A588@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/rwbarton-D3516 Referencing: 888a606978740cf9d5069f3dcddfc48929e32eac From git at git.haskell.org Sun Apr 30 23:45:26 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 30 Apr 2017 23:45:26 +0000 (UTC) Subject: [commit: ghc] wip/rwbarton-D3516: Avoid excessive space usage from unfoldings in CoreTidy (888a606) Message-ID: <20170430234526.808EE3A588@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rwbarton-D3516 Link : http://ghc.haskell.org/trac/ghc/changeset/888a606978740cf9d5069f3dcddfc48929e32eac/ghc >--------------------------------------------------------------- commit 888a606978740cf9d5069f3dcddfc48929e32eac Author: Reid Barton Date: Sun Apr 30 19:43:03 2017 -0400 Avoid excessive space usage from unfoldings in CoreTidy Test Plan: validate Reviewers: austin, bgamari Subscribers: thomie GHC Trac Issues: #13564 Differential Revision: https://phabricator.haskell.org/D3516 >--------------------------------------------------------------- 888a606978740cf9d5069f3dcddfc48929e32eac compiler/coreSyn/CoreTidy.hs | 8 +++++++- compiler/main/TidyPgm.hs | 5 ++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/compiler/coreSyn/CoreTidy.hs b/compiler/coreSyn/CoreTidy.hs index 7f82bec..89ce692 100644 --- a/compiler/coreSyn/CoreTidy.hs +++ b/compiler/coreSyn/CoreTidy.hs @@ -15,6 +15,7 @@ module CoreTidy ( #include "HsVersions.h" import CoreSyn +import CoreSeq ( seqUnfolding ) import CoreArity import Id import IdInfo @@ -223,9 +224,14 @@ tidyUnfolding tidy_env unf@(CoreUnfolding { uf_tmpl = unf_rhs, uf_src = src }) unf_from_rhs | isStableSource src - = unf { uf_tmpl = tidyExpr tidy_env unf_rhs } -- Preserves OccInfo + = seqIt $ unf { uf_tmpl = tidyExpr tidy_env unf_rhs } -- Preserves OccInfo + -- This seqIt avoids a space leak: otherwise the uf_is_value, + -- uf_is_conlike, ... fields may retain a reference to the + -- pre-tidied expression forever (ToIface doesn't look at them) + | otherwise = unf_from_rhs + where seqIt unf = seqUnfolding unf `seq` unf tidyUnfolding _ unf _ = unf -- NoUnfolding or OtherCon {- diff --git a/compiler/main/TidyPgm.hs b/compiler/main/TidyPgm.hs index 21d0208..4b9fbae 100644 --- a/compiler/main/TidyPgm.hs +++ b/compiler/main/TidyPgm.hs @@ -22,6 +22,7 @@ import CoreMonad import CorePrep import CoreUtils (rhsIsStatic) import CoreStats (coreBindsStats, CoreStats(..)) +import CoreSeq (seqBinds) import CoreLint import Literal import Rules @@ -1134,7 +1135,9 @@ tidyTopBinds hsc_env this_mod unfold_env init_occ_env binds = do mkIntegerId <- lookupMkIntegerName dflags hsc_env integerSDataCon <- lookupIntegerSDataConName dflags hsc_env let cvt_integer = cvtLitInteger dflags mkIntegerId integerSDataCon - return $ tidy cvt_integer init_env binds + result = tidy cvt_integer init_env binds + seqBinds (snd result) `seq` return result + -- This seqBinds avoids a spike in space usage (see #13564) where dflags = hsc_dflags hsc_env From git at git.haskell.org Sun Apr 30 23:54:47 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 30 Apr 2017 23:54:47 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Bump Cabal submodule (4e676be) Message-ID: <20170430235447.CF6C73A588@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/4e676beb5633a32b76b7a7454075b7a87fb7a493/ghc >--------------------------------------------------------------- commit 4e676beb5633a32b76b7a7454075b7a87fb7a493 Author: Ben Gamari Date: Sun Apr 30 19:14:33 2017 -0400 Bump Cabal submodule >--------------------------------------------------------------- 4e676beb5633a32b76b7a7454075b7a87fb7a493 libraries/Cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/Cabal b/libraries/Cabal index 41f416b..b399b57 160000 --- a/libraries/Cabal +++ b/libraries/Cabal @@ -1 +1 @@ -Subproject commit 41f416bc27796a3dc87037b66b6fef6f5810bc77 +Subproject commit b399b57bdfc0e3691148b441920298dd7ce28520 From git at git.haskell.org Sun Apr 30 23:54:51 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 30 Apr 2017 23:54:51 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Bump array submodule (9adf17e) Message-ID: <20170430235451.105453A588@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/9adf17e2da9045b294999cf5a8936da90f67417d/ghc >--------------------------------------------------------------- commit 9adf17e2da9045b294999cf5a8936da90f67417d Author: Ben Gamari Date: Sun Apr 30 19:15:06 2017 -0400 Bump array submodule >--------------------------------------------------------------- 9adf17e2da9045b294999cf5a8936da90f67417d libraries/array | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/array b/libraries/array index db07d53..1244242 160000 --- a/libraries/array +++ b/libraries/array @@ -1 +1 @@ -Subproject commit db07d534feb267d5f81e1301f6a0cb726c4c2ea2 +Subproject commit 1244242d895724ae53b13104ca225455ff08259c From git at git.haskell.org Sun Apr 30 23:54:54 2017 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 30 Apr 2017 23:54:54 +0000 (UTC) Subject: [commit: ghc] ghc-8.2: Bump unix submodule (74c0bf2) Message-ID: <20170430235454.369CB3A588@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.2 Link : http://ghc.haskell.org/trac/ghc/changeset/74c0bf2fddcb13c8fba6bfa800d6b052b3af0067/ghc >--------------------------------------------------------------- commit 74c0bf2fddcb13c8fba6bfa800d6b052b3af0067 Author: Ben Gamari Date: Sun Apr 30 19:15:27 2017 -0400 Bump unix submodule >--------------------------------------------------------------- 74c0bf2fddcb13c8fba6bfa800d6b052b3af0067 libraries/unix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/unix b/libraries/unix index 19aaa0f..db8be85 160000 --- a/libraries/unix +++ b/libraries/unix @@ -1 +1 @@ -Subproject commit 19aaa0fcca3427e4006a967972eb16a570ca43b1 +Subproject commit db8be857ba0d1e25e8d30c53ea7338cb9929b9b4