From git at git.haskell.org Sun May 1 07:12:19 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 1 May 2016 07:12:19 +0000 (UTC) Subject: [commit: ghc] master: Typos in DmdAnal (f69e707) Message-ID: <20160501071219.ADB0B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f69e7078930ea0f80dbd3a0d1a4b89db83a32a32/ghc >--------------------------------------------------------------- commit f69e7078930ea0f80dbd3a0d1a4b89db83a32a32 Author: ?mer Sinan A?acan Date: Sun May 1 03:14:29 2016 -0400 Typos in DmdAnal >--------------------------------------------------------------- f69e7078930ea0f80dbd3a0d1a4b89db83a32a32 compiler/stranal/DmdAnal.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/stranal/DmdAnal.hs b/compiler/stranal/DmdAnal.hs index 9a8999a..53144ff 100644 --- a/compiler/stranal/DmdAnal.hs +++ b/compiler/stranal/DmdAnal.hs @@ -1301,7 +1301,7 @@ See section 9.2 (Finding fixpoints) of the paper. Our basic plan is to initialise the strictness of each Id in a recursive group to "bottom", and find a fixpoint from there. However, -this group B might be inside an *enclosing* recursiveb group A, in +this group B might be inside an *enclosing* recursive group A, in which case we'll do the entire fixpoint shebang on for each iteration of A. This can be illustrated by the following example: @@ -1345,7 +1345,7 @@ which is quite a lie. The once-used information is (currently) only used by the code generator, though. So: - * We zap the used-once info in the woker-wrapper; + * We zap the used-once info in the worker-wrapper; see Note [Zapping Used Once info in WorkWrap] in WorkWrap. If it's not reliable, it's better not to have it at all. From git at git.haskell.org Sun May 1 17:24:20 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 1 May 2016 17:24:20 +0000 (UTC) Subject: [commit: ghc] master: Fix aggressive cleanup of T1407 (e6627d1) Message-ID: <20160501172420.05C3D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e6627d1f8964807f19f8773f09cfaacae7ca8ab8/ghc >--------------------------------------------------------------- commit e6627d1f8964807f19f8773f09cfaacae7ca8ab8 Author: Tamar Christina Date: Sun May 1 17:25:48 2016 +0200 Fix aggressive cleanup of T1407 Summary: The aggressive cleanup routine of T1407 is removing files that don't belong to it. Constrain the test to only removing files it should by putting all it's generated binaries in it's own output folder. Test Plan: make test -C testsuite/tests/ghci/linking/dyn Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie, #ghc_windows_task_force Differential Revision: https://phabricator.haskell.org/D2165 GHC Trac Issues: #1407 >--------------------------------------------------------------- e6627d1f8964807f19f8773f09cfaacae7ca8ab8 testsuite/tests/ghci/linking/dyn/Makefile | 22 +++++++++++++++++----- testsuite/tests/ghci/linking/dyn/all.T | 6 +++--- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/testsuite/tests/ghci/linking/dyn/Makefile b/testsuite/tests/ghci/linking/dyn/Makefile index b37fdea..38721dd 100644 --- a/testsuite/tests/ghci/linking/dyn/Makefile +++ b/testsuite/tests/ghci/linking/dyn/Makefile @@ -26,6 +26,16 @@ endif MY_TEST_HC_OPTS = $(filter-out -rtsopts,$(TEST_HC_OPTS)) $(CFLAGS) +# -------------------------------------------------------------- +# Note: libAS.def is not used directly in these tests but is +# included for completeness. libAS.def is the input to +# the Microsoft tool "lib.exe" that can be used to +# create the import libraries using the short format +# that the `compile_libAS_impl_msvc' target uses. +# +# See #11072 +# -------------------------------------------------------------- + .PHONY: load_short_name load_short_name: rm -rf bin_short @@ -34,10 +44,12 @@ load_short_name: rm -f bin_short/*.a echo ":q" | "$(TEST_HC)" --interactive -ignore-dot-ghci -L"./bin_short" -lA -v0 -.PHONY: compile_libAS -compile_libAS: - '$(TEST_HC)' $(MY_TEST_HC_OPTS) -shared A.c -o $(call DLL,AS) - rm -f libAS*.a +.PHONY: compile_libT1407 +compile_libT1407: + rm -rf T1407dir + mkdir T1407dir + '$(TEST_HC)' $(MY_TEST_HC_OPTS) -odir "T1407dir" -shared A.c -o "T1407dir/$(call DLL,AS)" + rm -f T1407dir/libAS*.a .PHONY: compile_libT10458 compile_libT10458: @@ -82,7 +94,7 @@ compile_libAS_impl_msvc: .PHONY: T1407 T1407: - cat T1407.script | LD_LIBRARY_PATH=. "$(TEST_HC)" $(TEST_HC_OPTS) -ignore-dot-ghci -v0 --interactive -L. + cat T1407.script | LD_LIBRARY_PATH=. "$(TEST_HC)" $(TEST_HC_OPTS) -ignore-dot-ghci -v0 --interactive -L"T1407dir" .PHONY: T3242 echo ":q" | '$(TEST_HC)' $(TEST_HC_OPTS) --interactive -ignore-dot-ghci -v0 -lm diff --git a/testsuite/tests/ghci/linking/dyn/all.T b/testsuite/tests/ghci/linking/dyn/all.T index d54c84e..b8ef670 100644 --- a/testsuite/tests/ghci/linking/dyn/all.T +++ b/testsuite/tests/ghci/linking/dyn/all.T @@ -6,9 +6,9 @@ test('load_short_name', test('T1407', [unless(doing_ghci, skip), - extra_clean(['libAS.*']), - pre_cmd('$MAKE -s --no-print-directory compile_libAS'), - extra_hc_opts('-L.')], + extra_clean(['T1407dir/libAS.*']), + pre_cmd('$MAKE -s --no-print-directory compile_libT1407'), + extra_hc_opts('-L$PWD/T1407dir')], run_command, ['$MAKE --no-print-directory -s T1407']) test('T3242', From git at git.haskell.org Sun May 1 20:12:12 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 1 May 2016 20:12:12 +0000 (UTC) Subject: [commit: ghc] master: rts: Remove deprecated C type `lnat` (868d2c4) Message-ID: <20160501201212.A14283A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/868d2c473d6faeb23d8626fd21fa342e29b582f4/ghc >--------------------------------------------------------------- commit 868d2c473d6faeb23d8626fd21fa342e29b582f4 Author: Erik de Castro Lopo Date: Sun May 1 21:59:50 2016 +1000 rts: Remove deprecated C type `lnat` Summary: The `lnat` type was deprecated in 2012 in commit 41737f12f9 with a note to use `StgWord` instead. Test Plan: Validate on Linux and OS X Reviewers: simonmar, austin, Phyx, hvr, bgamari Reviewed By: simonmar, Phyx, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2164 >--------------------------------------------------------------- 868d2c473d6faeb23d8626fd21fa342e29b582f4 includes/rts/Types.h | 3 --- testsuite/tests/rts/testblockalloc.c | 2 +- testsuite/tests/rts/testheapalloced.c | 2 +- testsuite/tests/rts/testmblockalloc.c | 2 +- 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/includes/rts/Types.h b/includes/rts/Types.h index 88d0b34..1791b88 100644 --- a/includes/rts/Types.h +++ b/includes/rts/Types.h @@ -18,9 +18,6 @@ typedef unsigned int nat; /* at least 32 bits (like int) */ -// Deprecated; just use StgWord instead -typedef StgWord lnat; - /* ullong (64|128-bit) type: only include if needed (not ANSI) */ #if defined(__GNUC__) #define LL(x) (x##LL) diff --git a/testsuite/tests/rts/testblockalloc.c b/testsuite/tests/rts/testblockalloc.c index b49ae00..bde81d3 100644 --- a/testsuite/tests/rts/testblockalloc.c +++ b/testsuite/tests/rts/testblockalloc.c @@ -11,7 +11,7 @@ const int MAXALLOC = ((8 * 1024 * 1024) / BLOCK_SIZE - 1); //const int MAXALLOC = ((64 * 1024 * 1024) / BLOCK_SIZE - 1); const int SEED = 0xf00f00; -extern lnat mblocks_allocated; +extern StgWord mblocks_allocated; int main (int argc, char *argv[]) { diff --git a/testsuite/tests/rts/testheapalloced.c b/testsuite/tests/rts/testheapalloced.c index 3d8fa05..e827ae2 100644 --- a/testsuite/tests/rts/testheapalloced.c +++ b/testsuite/tests/rts/testheapalloced.c @@ -21,7 +21,7 @@ const int MAXALLOC = ((8 * 1024 * 1024) / BLOCK_SIZE - 1); //const int MAXALLOC = ((4 * 1024 * 1024) / BLOCK_SIZE - 1); const int SEED = 0xf00f00; -extern lnat mblocks_allocated; +extern StgWord mblocks_allocated; int main (int argc, char *argv[]) { diff --git a/testsuite/tests/rts/testmblockalloc.c b/testsuite/tests/rts/testmblockalloc.c index df03658..cbfd050 100644 --- a/testsuite/tests/rts/testmblockalloc.c +++ b/testsuite/tests/rts/testmblockalloc.c @@ -9,7 +9,7 @@ const int ARRSIZE = 64; const int LOOPS = 1000; const int SEED = 0xf00f00; -extern lnat mblocks_allocated; +extern StgWord mblocks_allocated; int main (int argc, char *argv[]) { From git at git.haskell.org Sun May 1 21:56:00 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 1 May 2016 21:56:00 +0000 (UTC) Subject: [commit: ghc] master: Catch errors from timerfd_settime (df9b772) Message-ID: <20160501215600.02F3D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/df9b772a40d7cbbad260f29211fe6cd0bb119908/ghc >--------------------------------------------------------------- commit df9b772a40d7cbbad260f29211fe6cd0bb119908 Author: Ben Gamari Date: Thu Apr 21 13:57:18 2016 +0200 Catch errors from timerfd_settime >--------------------------------------------------------------- df9b772a40d7cbbad260f29211fe6cd0bb119908 rts/posix/itimer/Pthread.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rts/posix/itimer/Pthread.c b/rts/posix/itimer/Pthread.c index e84a53a..2133a5b4 100644 --- a/rts/posix/itimer/Pthread.c +++ b/rts/posix/itimer/Pthread.c @@ -105,7 +105,10 @@ static void *itimer_thread_func(void *_handle_tick) if (!TFD_CLOEXEC) { fcntl(timerfd, F_SETFD, FD_CLOEXEC); } - int ret = timerfd_settime(timerfd, 0, &it, NULL); + if (timerfd_settime(timerfd, 0, &it, NULL)) { + sysErrorBelch("timerfd_settime"); + stg_exit(EXIT_FAILURE); + } #endif while (1) { From git at git.haskell.org Sun May 1 21:56:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 1 May 2016 21:56:03 +0000 (UTC) Subject: [commit: ghc] master: Greater customization of GHCi prompt (533037c) Message-ID: <20160501215603.DB6E63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/533037cc58a7c50e1c014e27e8b971d53e7b47bd/ghc >--------------------------------------------------------------- commit 533037cc58a7c50e1c014e27e8b971d53e7b47bd Author: niksaz Date: Sun May 1 13:34:45 2016 +0200 Greater customization of GHCi prompt This patch is trying to redesign the :set prompt option to take not a String but a Haskell function, like [String] -> Int -> IO String, where [String] is the list of the names of the currently loaded modules and Int is the line number. Currently you may set prompt function with **:set promt-function [String] -> Int -> IO String** option and old version is also available - :set prompt String. So, it looks like I've almost completed this patch: 1) Now we have a lot of escape sequences - 13 to be exact. Most of them are similar to bash prompt escape sequences. Thus they are quite handy. 2) We may use the special escape sequence to call shell functions, for example "%call(ls -l -a)". 3) We may use :set prompt-function to set PFunction to handle prompt. It is just [String] -> Int -> IO String. Reviewers: erikd, austin, mpickering, bgamari Reviewed By: mpickering, bgamari Subscribers: mpickering, thomie Differential Revision: https://phabricator.haskell.org/D2084 GHC Trac Issues: #5850 >--------------------------------------------------------------- 533037cc58a7c50e1c014e27e8b971d53e7b47bd docs/users_guide/ghci.rst | 48 +++++- ghc/GHCi/UI.hs | 257 ++++++++++++++++++++++------ ghc/GHCi/UI/Monad.hs | 9 +- testsuite/tests/ghci/scripts/all.T | 3 + testsuite/tests/ghci/scripts/ghci060.script | 7 + testsuite/tests/ghci/scripts/ghci060.stderr | 5 + testsuite/tests/ghci/scripts/ghci061.hs | 5 + testsuite/tests/ghci/scripts/ghci061.script | 5 + testsuite/tests/ghci/scripts/ghci061.stderr | 16 ++ 9 files changed, 292 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 533037cc58a7c50e1c014e27e8b971d53e7b47bd From git at git.haskell.org Sun May 1 21:56:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 1 May 2016 21:56:06 +0000 (UTC) Subject: [commit: ghc] master: users-guide: Add index entry for "environment file" (eac6967) Message-ID: <20160501215606.9ADD23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/eac69673d76f6147fa3a8f4c25112947a4a7aa14/ghc >--------------------------------------------------------------- commit eac69673d76f6147fa3a8f4c25112947a4a7aa14 Author: Ben Gamari Date: Sun May 1 13:21:55 2016 +0200 users-guide: Add index entry for "environment file" >--------------------------------------------------------------- eac69673d76f6147fa3a8f4c25112947a4a7aa14 docs/users_guide/packages.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/users_guide/packages.rst b/docs/users_guide/packages.rst index c9e2ea4..77f23c5 100644 --- a/docs/users_guide/packages.rst +++ b/docs/users_guide/packages.rst @@ -1279,6 +1279,7 @@ Package environments .. index:: single: package environments + single: environment file A *package environment file* is a file that tells ``ghc`` precisely which packages should be visible. It can be used to create environments for ``ghc`` From git at git.haskell.org Sun May 1 21:56:09 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 1 May 2016 21:56:09 +0000 (UTC) Subject: [commit: ghc] master: Remove unused getScopedTyVarBinds (116d3fe) Message-ID: <20160501215609.4B1793A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/116d3fe67f0f45d1e3e98e3c091eb4d14a121305/ghc >--------------------------------------------------------------- commit 116d3fe67f0f45d1e3e98e3c091eb4d14a121305 Author: Bartosz Nitka Date: Sun May 1 17:56:39 2016 +0200 Remove unused getScopedTyVarBinds Test Plan: it compiles Reviewers: simonpj, austin, goldfire, bgamari, simonmar Reviewed By: simonmar Subscribers: thomie, simonmar Differential Revision: https://phabricator.haskell.org/D2160 GHC Trac Issues: #4012 >--------------------------------------------------------------- 116d3fe67f0f45d1e3e98e3c091eb4d14a121305 compiler/typecheck/TcEnv.hs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/compiler/typecheck/TcEnv.hs b/compiler/typecheck/TcEnv.hs index 5bc3d00..006a2f9 100644 --- a/compiler/typecheck/TcEnv.hs +++ b/compiler/typecheck/TcEnv.hs @@ -33,7 +33,7 @@ module TcEnv( tcLookup, tcLookupLocated, tcLookupLocalIds, tcLookupId, tcLookupTyVar, tcLookupLcl_maybe, - getScopedTyVarBinds, getInLocalScope, + getInLocalScope, wrongThingErr, pprBinders, tcAddDataFamConPlaceholders, tcAddPatSynPlaceholders, @@ -404,11 +404,6 @@ tcExtendTyVarEnv2 binds thing_inside tyvar' = setTyVarName tyvar name' name' = tidyNameOcc name occ' -getScopedTyVarBinds :: TcM [(Name, TcTyVar)] -getScopedTyVarBinds - = do { lcl_env <- getLclEnv - ; return [(name, tv) | ATyVar name tv <- nameEnvElts (tcl_env lcl_env)] } - isTypeClosedLetBndr :: Id -> TopLevelFlag -- See Note [Bindings with closed types] in TcRnTypes -- Note that we decided if a let-bound variable is closed by From git at git.haskell.org Sun May 1 21:56:11 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 1 May 2016 21:56:11 +0000 (UTC) Subject: [commit: ghc] master: rts/itimer/pthread: Stop timer when ticker is stopped (999c464) Message-ID: <20160501215611.EBD913A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/999c464da36e925bd4ffea34c94d3a7b3ab0135c/ghc >--------------------------------------------------------------- commit 999c464da36e925bd4ffea34c94d3a7b3ab0135c Author: Ben Gamari Date: Sun May 1 17:41:05 2016 +0200 rts/itimer/pthread: Stop timer when ticker is stopped This reworks the pthread-based itimer implementation to disarm the timer when events aren't needed. Thanks to hsyl20 for the nice design. Test Plan: Validate Reviewers: hsyl20, simonmar, austin Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2131 GHC Trac Issues: #1623, #11965 >--------------------------------------------------------------- 999c464da36e925bd4ffea34c94d3a7b3ab0135c rts/RtsStartup.c | 7 ++- rts/posix/itimer/Pthread.c | 103 ++++++++++++++++++++++++++++++--------------- 2 files changed, 74 insertions(+), 36 deletions(-) diff --git a/rts/RtsStartup.c b/rts/RtsStartup.c index 4b9d947..6d774f4 100644 --- a/rts/RtsStartup.c +++ b/rts/RtsStartup.c @@ -340,7 +340,12 @@ hs_exit_(rtsBool wait_foreign) /* stop the ticker */ stopTimer(); - exitTimer(wait_foreign); + /* + * it is quite important that we wait here as some timer implementations + * (e.g. pthread) may fire even after we exit, which may segfault as we've + * already freed the capabilities. + */ + exitTimer(rtsTrue); // set the terminal settings back to what they were #if !defined(mingw32_HOST_OS) diff --git a/rts/posix/itimer/Pthread.c b/rts/posix/itimer/Pthread.c index 3117b9f..4f0d750 100644 --- a/rts/posix/itimer/Pthread.c +++ b/rts/posix/itimer/Pthread.c @@ -81,8 +81,19 @@ #endif static Time itimer_interval = DEFAULT_TICK_INTERVAL; -enum ItimerState {STOPPED, RUNNING, STOPPING, EXITED}; -static volatile enum ItimerState itimer_state = STOPPED; + +// Should we be firing ticks? +// Writers to this must hold the mutex below. +static volatile HsBool stopped = 0; + +// should the ticker thread exit? +// This can be set without holding the mutex. +static volatile HsBool exited = 1; + +// Signaled when we want to (re)start the timer +static Condition start_cond; +static Mutex mutex; +static OSThreadId thread; static void *itimer_thread_func(void *_handle_tick) { @@ -110,7 +121,7 @@ static void *itimer_thread_func(void *_handle_tick) } #endif - while (1) { + while (!exited) { if (USE_TIMERFD_FOR_ITIMER) { if (read(timerfd, &nticks, sizeof(nticks)) != sizeof(nticks)) { if (errno != EINTR) { @@ -122,64 +133,86 @@ static void *itimer_thread_func(void *_handle_tick) sysErrorBelch("usleep(TimeToUS(itimer_interval) failed"); } } - switch (itimer_state) { - case RUNNING: - handle_tick(0); - break; - case STOPPED: - break; - case STOPPING: - itimer_state = STOPPED; - break; - case EXITED: - if (USE_TIMERFD_FOR_ITIMER) - close(timerfd); - return NULL; + + // first try a cheap test + if (stopped) { + ACQUIRE_LOCK(&mutex); + // should we really stop? + if (stopped) { + waitCondition(&start_cond, &mutex); + } + RELEASE_LOCK(&mutex); + } else { + handle_tick(0); } } - return NULL; // Never reached. + + if (USE_TIMERFD_FOR_ITIMER) + close(timerfd); + closeMutex(&mutex); + closeCondition(&start_cond); + return NULL; } void initTicker (Time interval, TickProc handle_tick) { itimer_interval = interval; + stopped = 0; + exited = 0; - pthread_t tid; - int r = pthread_create(&tid, NULL, itimer_thread_func, (void*)handle_tick); - if (!r) { - pthread_detach(tid); + initCondition(&start_cond); + initMutex(&mutex); + + /* + * We can't use the RTS's createOSThread here as we need to remain attached + * to the thread we create so we can later join to it if requested + */ + if (! pthread_create(&thread, NULL, itimer_thread_func, (void*)handle_tick)) { #if HAVE_PTHREAD_SETNAME_NP - pthread_setname_np(tid, "ghc_ticker"); + pthread_setname_np(thread, "ghc_ticker"); #endif + } else { + sysErrorBelch("Itimer: Failed to spawn thread"); + stg_exit(EXIT_FAILURE); } } void startTicker(void) { - // sanity check - if (itimer_state == EXITED) { - sysErrorBelch("ITimer: Tried to start a dead timer!\n"); - stg_exit(EXIT_FAILURE); - } - itimer_state = RUNNING; + ACQUIRE_LOCK(&mutex); + stopped = 0; + signalCondition(&start_cond); + RELEASE_LOCK(&mutex); } +/* There may be at most one additional tick fired after a call to this */ void stopTicker(void) { - if (itimer_state == RUNNING) { - itimer_state = STOPPING; - // Note that the timer may fire once more, but that's okay; - // handle_tick is only called when itimer_state == RUNNING - } + ACQUIRE_LOCK(&mutex); + stopped = 1; + RELEASE_LOCK(&mutex); } +/* There may be at most one additional tick fired after a call to this */ void -exitTicker (rtsBool wait STG_UNUSED) +exitTicker (rtsBool wait) { - itimer_state = EXITED; + ASSERT(!exited); + exited = 1; + // ensure that ticker wakes up if stopped + startTicker(); + + // wait for ticker to terminate if necessary + if (wait) { + if (pthread_join(thread, NULL)) { + sysErrorBelch("Itimer: Failed to join"); + } + } else { + pthread_detach(thread); + } } int From git at git.haskell.org Sun May 1 21:56:14 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 1 May 2016 21:56:14 +0000 (UTC) Subject: [commit: ghc] master: Kill Itimer.h (55f4009) Message-ID: <20160501215614.9E93F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/55f4009ed610ed236f306bff0c33b0efc5a99e48/ghc >--------------------------------------------------------------- commit 55f4009ed610ed236f306bff0c33b0efc5a99e48 Author: Ben Gamari Date: Thu Apr 21 12:01:12 2016 +0200 Kill Itimer.h It declared nothing. >--------------------------------------------------------------- 55f4009ed610ed236f306bff0c33b0efc5a99e48 rts/posix/Itimer.h | 12 ------------ rts/posix/Select.c | 1 - rts/posix/itimer/Pthread.c | 1 - rts/posix/itimer/Setitimer.c | 1 - rts/posix/itimer/TimerCreate.c | 1 - 5 files changed, 16 deletions(-) diff --git a/rts/posix/Itimer.h b/rts/posix/Itimer.h deleted file mode 100644 index 7996da7..0000000 --- a/rts/posix/Itimer.h +++ /dev/null @@ -1,12 +0,0 @@ -/* ----------------------------------------------------------------------------- - * - * (c) The GHC Team 1998-2005 - * - * Interval timer for profiling and pre-emptive scheduling. - * - * ---------------------------------------------------------------------------*/ - -#ifndef ITIMER_H -#define ITIMER_H - -#endif /* ITIMER_H */ diff --git a/rts/posix/Select.c b/rts/posix/Select.c index d5c9b55..bd9ddfa 100644 --- a/rts/posix/Select.c +++ b/rts/posix/Select.c @@ -17,7 +17,6 @@ #include "Prelude.h" #include "RaiseAsync.h" #include "RtsUtils.h" -#include "Itimer.h" #include "Capability.h" #include "Select.h" #include "AwaitEvent.h" diff --git a/rts/posix/itimer/Pthread.c b/rts/posix/itimer/Pthread.c index 2133a5b4..3117b9f 100644 --- a/rts/posix/itimer/Pthread.c +++ b/rts/posix/itimer/Pthread.c @@ -39,7 +39,6 @@ #include "Rts.h" #include "Ticker.h" -#include "posix/Itimer.h" #include "Proftimer.h" #include "Schedule.h" #include "posix/Clock.h" diff --git a/rts/posix/itimer/Setitimer.c b/rts/posix/itimer/Setitimer.c index c44e8d8..30dfa21 100644 --- a/rts/posix/itimer/Setitimer.c +++ b/rts/posix/itimer/Setitimer.c @@ -10,7 +10,6 @@ #include "Rts.h" #include "Ticker.h" -#include "posix/Itimer.h" #include "Proftimer.h" #include "Schedule.h" #include "posix/Clock.h" diff --git a/rts/posix/itimer/TimerCreate.c b/rts/posix/itimer/TimerCreate.c index a4fb2b5..a5fe8ce 100644 --- a/rts/posix/itimer/TimerCreate.c +++ b/rts/posix/itimer/TimerCreate.c @@ -10,7 +10,6 @@ #include "Rts.h" #include "Ticker.h" -#include "posix/Itimer.h" #include "Proftimer.h" #include "Schedule.h" #include "posix/Clock.h" From git at git.haskell.org Sun May 1 21:56:17 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 1 May 2016 21:56:17 +0000 (UTC) Subject: [commit: ghc] master: deriveConstants: Fix nm advice one last time (ecc0603) Message-ID: <20160501215617.52FBD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ecc060302b13d5a6ffb0fdfb0625b90f2fbfca0f/ghc >--------------------------------------------------------------- commit ecc060302b13d5a6ffb0fdfb0625b90f2fbfca0f Author: Ben Gamari Date: Sun May 1 18:05:28 2016 +0200 deriveConstants: Fix nm advice one last time Missing a close paren. >--------------------------------------------------------------- ecc060302b13d5a6ffb0fdfb0625b90f2fbfca0f utils/deriveConstants/Main.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/deriveConstants/Main.hs b/utils/deriveConstants/Main.hs index 6cd48d4..1878fd9 100644 --- a/utils/deriveConstants/Main.hs +++ b/utils/deriveConstants/Main.hs @@ -693,7 +693,7 @@ getWanted verbose os tmpdir gccProgram gccFlags nmProgram mobjdumpProgram Just 0x292 -> die $ "broken 'nm' detected, see https://ghc.haskell.org/ticket/11744.\n" ++ "\n" ++ "Workaround: You may want to pass\n" - ++ " --with-nm=$(xcrun --find nm-classic\n" + ++ " --with-nm=$(xcrun --find nm-classic)\n" ++ "to 'configure'.\n" Just x -> die ("unexpected value round-tripped for CONTROL_GROUP_CONST_291: " ++ show x) From git at git.haskell.org Sun May 1 21:56:20 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 1 May 2016 21:56:20 +0000 (UTC) Subject: [commit: ghc] master: rts: Close livelock window due to rapid ticker enable/disable (16a51a6) Message-ID: <20160501215620.0995B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/16a51a6c2f265f8670355be03d42b773d93e0684/ghc >--------------------------------------------------------------- commit 16a51a6c2f265f8670355be03d42b773d93e0684 Author: Ben Gamari Date: Sun May 1 13:38:38 2016 +0200 rts: Close livelock window due to rapid ticker enable/disable This fixes #11830, where the RTS would livelock if run with `-I0` due to a regression introduced by bbdc52f3a6e6a28e209fb8f65699121d4ef3a4e3. The reason for this is that the new codepath introduced a subtle race condition: 1. one thread could request that the ticker stop and would block until the ticker in fact stopped 2. meanwhile, another thread could sneak in and restart the ticker this was implemented in such a way where thread (1) would end up blocked forever. The solution here is to simply not block. The worst that will happen is that timer fires again, but is ignored since the ticker is stopped. Test Plan: Validate, try reproduction case in #11830. Need to find a nice testcase. Reviewers: simonmar, erikd, hsyl20, austin Reviewed By: erikd, hsyl20 Subscribers: erikd, thomie Differential Revision: https://phabricator.haskell.org/D2129 GHC Trac Issues: #11830 >--------------------------------------------------------------- 16a51a6c2f265f8670355be03d42b773d93e0684 rts/posix/Itimer.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/rts/posix/Itimer.c b/rts/posix/Itimer.c index 8915446..770ff20 100644 --- a/rts/posix/Itimer.c +++ b/rts/posix/Itimer.c @@ -177,6 +177,7 @@ static void install_vtalrm_handler(TickProc handle_tick) #if defined(USE_PTHREAD_FOR_ITIMER) enum ItimerState {STOPPED, RUNNING, STOPPING, EXITED}; static volatile enum ItimerState itimer_state = STOPPED; + static void *itimer_thread_func(void *_handle_tick) { TickProc handle_tick = _handle_tick; @@ -189,7 +190,7 @@ static void *itimer_thread_func(void *_handle_tick) it.it_value.tv_nsec = TimeToNS(itimer_interval) % 1000000000; it.it_interval = it.it_value; - timerfd = timerfd_create(CLOCK_MONOTONIC,TFD_CLOEXEC); + timerfd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC); if (timerfd == -1) { sysErrorBelch("timerfd_create"); stg_exit(EXIT_FAILURE); @@ -197,7 +198,7 @@ static void *itimer_thread_func(void *_handle_tick) if (!TFD_CLOEXEC) { fcntl(timerfd, F_SETFD, FD_CLOEXEC); } - timerfd_settime(timerfd,0,&it,NULL); + int ret = timerfd_settime(timerfd, 0, &it, NULL); #endif while (1) { @@ -270,6 +271,11 @@ void startTicker(void) { #if defined(USE_PTHREAD_FOR_ITIMER) + // sanity check + if (itimer_state == EXITED) { + sysErrorBelch("ITimer: Tried to start a dead timer!\n"); + stg_exit(EXIT_FAILURE); + } itimer_state = RUNNING; #elif defined(USE_TIMER_CREATE) { @@ -306,10 +312,8 @@ stopTicker(void) #if defined(USE_PTHREAD_FOR_ITIMER) if (itimer_state == RUNNING) { itimer_state = STOPPING; - /* Wait for the thread to confirm it won't generate another tick. */ - write_barrier(); - while (itimer_state != STOPPED) - sched_yield(); + // Note that the timer may fire once more, but that's okay; + // handle_tick is only called when itimer_state == RUNNING } #elif defined(USE_TIMER_CREATE) struct itimerspec it; From git at git.haskell.org Sun May 1 21:56:22 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 1 May 2016 21:56:22 +0000 (UTC) Subject: [commit: ghc] master: Bump haddock submodule (18676a4) Message-ID: <20160501215622.AEFB83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/18676a4a0dfe79e2704e48be5c8716a656825efe/ghc >--------------------------------------------------------------- commit 18676a4a0dfe79e2704e48be5c8716a656825efe Author: Ben Gamari Date: Sun May 1 13:22:14 2016 +0200 Bump haddock submodule Fixes documentation installation. >--------------------------------------------------------------- 18676a4a0dfe79e2704e48be5c8716a656825efe utils/haddock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/haddock b/utils/haddock index 56dbfe1..609018d 160000 --- a/utils/haddock +++ b/utils/haddock @@ -1 +1 @@ -Subproject commit 56dbfe17d272670e5f2d082401c025755796950d +Subproject commit 609018dd09c4ffe27f9248b2d8b50f6196cd42b9 From git at git.haskell.org Sun May 1 21:56:25 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 1 May 2016 21:56:25 +0000 (UTC) Subject: [commit: ghc] master: Add T11747 as a test (1161932) Message-ID: <20160501215625.D9F0F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/116193225465186ceb8471a007eff15692af903a/ghc >--------------------------------------------------------------- commit 116193225465186ceb8471a007eff15692af903a Author: ?mer Sinan A?acan Date: Sun May 1 18:03:05 2016 +0200 Add T11747 as a test Reviewers: bgamari, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2163 GHC Trac Issues: #11747 >--------------------------------------------------------------- 116193225465186ceb8471a007eff15692af903a testsuite/tests/deSugar/should_run/T11747.hs | 12 ++++++++++++ .../T1735.stdout => deSugar/should_run/T11747.stdout} | 0 testsuite/tests/deSugar/should_run/all.T | 1 + 3 files changed, 13 insertions(+) diff --git a/testsuite/tests/deSugar/should_run/T11747.hs b/testsuite/tests/deSugar/should_run/T11747.hs new file mode 100644 index 0000000..a0085b7 --- /dev/null +++ b/testsuite/tests/deSugar/should_run/T11747.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE GADTs, RankNTypes, ScopedTypeVariables, Strict, TypeApplications + #-} + +import Data.Typeable + +zero :: forall x. Typeable x => Maybe x +zero = do + Refl <- eqT @Int @x + pure 0 + +main :: IO () +main = print (zero @()) diff --git a/testsuite/tests/typecheck/should_run/T1735.stdout b/testsuite/tests/deSugar/should_run/T11747.stdout similarity index 100% copy from testsuite/tests/typecheck/should_run/T1735.stdout copy to testsuite/tests/deSugar/should_run/T11747.stdout diff --git a/testsuite/tests/deSugar/should_run/all.T b/testsuite/tests/deSugar/should_run/all.T index c8a9c93..7bc911e 100644 --- a/testsuite/tests/deSugar/should_run/all.T +++ b/testsuite/tests/deSugar/should_run/all.T @@ -52,3 +52,4 @@ test('DsStrictLet', normal, compile_and_run, ['-O']) test('T11193', exit_code(1), compile_and_run, ['']) test('T11572', exit_code(1), compile_and_run, ['']) test('T11601', exit_code(1), compile_and_run, ['']) +test('T11747', normal, compile_and_run, ['-dcore-lint']) From git at git.haskell.org Sun May 1 21:56:29 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 1 May 2016 21:56:29 +0000 (UTC) Subject: [commit: ghc] master: rts: Split up Itimer.c (65e13f6) Message-ID: <20160501215629.4397F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/65e13f66c595ad75bd6e9a55496f1372ead2731d/ghc >--------------------------------------------------------------- commit 65e13f66c595ad75bd6e9a55496f1372ead2731d Author: Ben Gamari Date: Sun May 1 13:39:23 2016 +0200 rts: Split up Itimer.c This shouldn't have any functional changes. It merely splits up what are essentially three distinct codepaths which are melding together with CPP. At the moment I merely #include the implementation to use with CPP although this really feels very yucky. Reviewers: erikd, austin, simonmar Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2130 >--------------------------------------------------------------- 65e13f66c595ad75bd6e9a55496f1372ead2731d rts/posix/Itimer.c | 305 +---------------------------------------- rts/posix/Signals.c | 29 ++++ rts/posix/Signals.h | 4 + rts/posix/itimer/Pthread.c | 187 +++++++++++++++++++++++++ rts/posix/itimer/Setitimer.c | 88 ++++++++++++ rts/posix/itimer/TimerCreate.c | 93 +++++++++++++ 6 files changed, 407 insertions(+), 299 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 65e13f66c595ad75bd6e9a55496f1372ead2731d From git at git.haskell.org Sun May 1 22:12:13 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 1 May 2016 22:12:13 +0000 (UTC) Subject: [commit: ghc] branch 'wip/erikd/remove-nat' created Message-ID: <20160501221213.9A8CA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/erikd/remove-nat Referencing: dc71c3184c31706f54d8d23e1644d1ad8016eb80 From git at git.haskell.org Sun May 1 22:12:16 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 1 May 2016 22:12:16 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: rts: Replace `nat` with `uint32_t` (dc71c31) Message-ID: <20160501221216.76D933A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/dc71c3184c31706f54d8d23e1644d1ad8016eb80/ghc >--------------------------------------------------------------- commit dc71c3184c31706f54d8d23e1644d1ad8016eb80 Author: Erik de Castro Lopo Date: Mon May 2 06:37:14 2016 +1000 rts: Replace `nat` with `uint32_t` The `nat` type was an alias for `unsigned int` with a comment saying it was at least 32 bits. We keep the typedef in case client code is using it but mark it as deprecated. >--------------------------------------------------------------- dc71c3184c31706f54d8d23e1644d1ad8016eb80 includes/rts/Flags.h | 44 ++++++++++----------- includes/rts/IOManager.h | 2 +- includes/rts/OSThreads.h | 4 +- includes/rts/SpinLock.h | 4 +- includes/rts/Threads.h | 4 +- includes/rts/Types.h | 3 +- includes/rts/prof/CCS.h | 2 +- includes/rts/storage/Block.h | 4 +- includes/rts/storage/ClosureMacros.h | 36 +++++++++--------- includes/rts/storage/GC.h | 8 ++-- includes/rts/storage/MBlock.h | 4 +- includes/rts/storage/SMPClosureOps.h | 2 +- rts/Adjustor.c | 4 +- rts/Arena.c | 4 +- rts/Capability.c | 34 ++++++++--------- rts/Capability.h | 22 +++++------ rts/CheckUnload.c | 4 +- rts/Disassembler.c | 6 +-- rts/Globals.c | 4 +- rts/Hpc.c | 10 ++--- rts/Interpreter.c | 16 ++++---- rts/LdvProfile.c | 6 +-- rts/LdvProfile.h | 2 +- rts/LibdwPool.c | 2 +- rts/Linker.c | 10 ++--- rts/Messages.c | 6 +-- rts/Messages.h | 2 +- rts/Pool.c | 22 +++++------ rts/Pool.h | 10 ++--- rts/Printer.c | 12 +++--- rts/ProfHeap.c | 30 +++++++-------- rts/ProfHeap.h | 2 +- rts/Profiling.c | 46 +++++++++++----------- rts/Proftimer.c | 4 +- rts/RaiseAsync.c | 12 +++--- rts/RaiseAsync.h | 2 +- rts/RetainerProfile.c | 60 ++++++++++++++--------------- rts/RetainerSet.c | 28 +++++++------- rts/RetainerSet.h | 6 +-- rts/RtsFlags.c | 18 ++++----- rts/RtsStartup.c | 2 +- rts/Schedule.c | 56 +++++++++++++-------------- rts/Sparks.c | 6 +-- rts/Stable.c | 12 +++--- rts/Stats.c | 28 +++++++------- rts/Stats.h | 4 +- rts/Task.c | 12 +++--- rts/Task.h | 10 ++--- rts/ThreadPaused.c | 16 ++++---- rts/Threads.c | 8 ++-- rts/Trace.c | 8 ++-- rts/Trace.h | 24 ++++++------ rts/WSDeque.c | 2 +- rts/WSDeque.h | 2 +- rts/Weak.c | 2 +- rts/eventlog/EventLog.c | 30 +++++++-------- rts/eventlog/EventLog.h | 8 ++-- rts/posix/GetTime.c | 2 +- rts/posix/OSMem.c | 4 +- rts/posix/OSThreads.c | 28 +++++++------- rts/posix/Signals.c | 4 +- rts/sm/BlockAlloc.c | 16 ++++---- rts/sm/BlockAlloc.h | 2 +- rts/sm/Compact.h | 6 +-- rts/sm/Evac.c | 24 ++++++------ rts/sm/GC.c | 74 ++++++++++++++++++------------------ rts/sm/GC.h | 8 ++-- rts/sm/GCThread.h | 8 ++-- rts/sm/GCUtils.c | 16 ++++---- rts/sm/GCUtils.h | 8 ++-- rts/sm/HeapAlloc.h | 4 +- rts/sm/MBlock.c | 46 +++++++++++----------- rts/sm/MarkWeak.c | 10 ++--- rts/sm/OSMem.h | 4 +- rts/sm/Sanity.c | 48 +++++++++++------------ rts/sm/Scav.c | 18 ++++----- rts/sm/Storage.c | 38 +++++++++--------- rts/sm/Storage.h | 10 ++--- rts/sm/Sweep.c | 2 +- 79 files changed, 556 insertions(+), 555 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc dc71c3184c31706f54d8d23e1644d1ad8016eb80 From git at git.haskell.org Sun May 1 22:49:36 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 1 May 2016 22:49:36 +0000 (UTC) Subject: [commit: ghc] master: Export constructors for IntPtr and WordPtr (a28611b) Message-ID: <20160501224936.22ADA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a28611b14930c9fd73b0028857e1ea8c0e64a38a/ghc >--------------------------------------------------------------- commit a28611b14930c9fd73b0028857e1ea8c0e64a38a Author: RyanGlScott Date: Mon May 2 00:07:14 2016 +0200 Export constructors for IntPtr and WordPtr This finishes what #5529 started by exporting the constructors for `IntPtr` and `WordPtr` from `Foreign.Ptr`, allowing them to be used in `foreign` declarations. Fixes #11983. Test Plan: `make TEST=T11983` Reviewers: simonpj, hvr, bgamari, austin Reviewed By: simonpj Subscribers: simonpj, thomie Differential Revision: https://phabricator.haskell.org/D2142 GHC Trac Issues: #11983 >--------------------------------------------------------------- a28611b14930c9fd73b0028857e1ea8c0e64a38a libraries/base/Foreign/C/Types.hs | 4 ++++ libraries/base/Foreign/Ptr.hs | 25 +++++++++++++++++++++++-- libraries/base/System/Posix/Types.hs | 4 ++++ libraries/base/changelog.md | 6 ++++++ testsuite/tests/ffi/should_compile/T11983.c | 5 +++++ testsuite/tests/ffi/should_compile/T11983.h | 9 +++++++++ testsuite/tests/ffi/should_compile/T11983.hs | 11 +++++++++++ testsuite/tests/ffi/should_compile/all.T | 2 ++ 8 files changed, 64 insertions(+), 2 deletions(-) diff --git a/libraries/base/Foreign/C/Types.hs b/libraries/base/Foreign/C/Types.hs index fef8e4a..b725a4a 100644 --- a/libraries/base/Foreign/C/Types.hs +++ b/libraries/base/Foreign/C/Types.hs @@ -63,6 +63,10 @@ module Foreign.C.Types -- XXX GHC doesn't support CLDouble yet -- , CLDouble(..) + -- See Note [Exporting constructors of marshallable foreign types] + -- in Foreign.Ptr for why the constructors for these newtypes are + -- exported. + -- ** Other types -- Instances of: Eq and Storable diff --git a/libraries/base/Foreign/Ptr.hs b/libraries/base/Foreign/Ptr.hs index efe580a..5e6bccf 100644 --- a/libraries/base/Foreign/Ptr.hs +++ b/libraries/base/Foreign/Ptr.hs @@ -41,12 +41,15 @@ module Foreign.Ptr ( -- Free the function pointer created by foreign export dynamic. -- * Integral types with lossless conversion to and from pointers - IntPtr, + IntPtr(..), ptrToIntPtr, intPtrToPtr, - WordPtr, + WordPtr(..), ptrToWordPtr, wordPtrToPtr + + -- See Note [Exporting constructors of marshallable foreign types] + -- for why the constructors for IntPtr and WordPtr are exported. ) where import GHC.Ptr @@ -97,3 +100,21 @@ ptrToIntPtr (Ptr a#) = IntPtr (I# (addr2Int# a#)) -- | casts an @IntPtr@ to a @Ptr@ intPtrToPtr :: IntPtr -> Ptr a intPtrToPtr (IntPtr (I# i#)) = Ptr (int2Addr# i#) + +{- +Note [Exporting constructors of marshallable foreign types] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +One might expect that IntPtr, WordPtr, and the other newtypes in the +Foreign.C.Types and System.Posix.Types modules to be abstract, but this is not +the case in GHC (see Trac #5229 and #11983). In fact, we deliberately export +the constructors for these datatypes in order to satisfy a requirement of the +Haskell 2010 Report (? 8.4.2) that if a newtype is used in a foreign +declaration, then its constructor must be visible. + +This requirement was motivated by the fact that using a type in a foreign +declaration necessarily exposes some information about the type to the user, +so being able to use abstract types in a foreign declaration breaks their +abstraction (see Trac #3008). As a result, the constructors of all FFI-related +newtypes in base must be exported in order to be useful for FFI programming, +even at the cost of exposing their underlying, architecture-dependent types. +-} diff --git a/libraries/base/System/Posix/Types.hs b/libraries/base/System/Posix/Types.hs index c2ac65e..5389e6e 100644 --- a/libraries/base/System/Posix/Types.hs +++ b/libraries/base/System/Posix/Types.hs @@ -68,6 +68,10 @@ module System.Posix.Types ( Fd(..), + -- See Note [Exporting constructors of marshallable foreign types] + -- in Foreign.Ptr for why the constructors for these newtypes are + -- exported. + #if defined(HTYPE_NLINK_T) LinkCount, #endif diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index f935c59..dd386ed 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -1,5 +1,11 @@ # Changelog for [`base` package](http://hackage.haskell.org/package/base) +## next *TBA* + * Bundled with GHC *TBA* + + * `Foreign.Ptr` now exports the constructors for `IntPtr` and `WordPtr` + (#11983) + ## 4.9.0.0 *TBA* * Bundled with GHC 8.0 diff --git a/testsuite/tests/ffi/should_compile/T11983.c b/testsuite/tests/ffi/should_compile/T11983.c new file mode 100644 index 0000000..2b475fb --- /dev/null +++ b/testsuite/tests/ffi/should_compile/T11983.c @@ -0,0 +1,5 @@ +#include +#include "T11983.h" + +void intptr_example(intptr_t i) {} +void uintptr_example(uintptr_t u) {} diff --git a/testsuite/tests/ffi/should_compile/T11983.h b/testsuite/tests/ffi/should_compile/T11983.h new file mode 100644 index 0000000..33c78cb --- /dev/null +++ b/testsuite/tests/ffi/should_compile/T11983.h @@ -0,0 +1,9 @@ +#ifndef T11983_H +#define T11983_H + +#include + +void intptr_example(intptr_t); +void uintptr_example(uintptr_t); + +#endif // T11983_H diff --git a/testsuite/tests/ffi/should_compile/T11983.hs b/testsuite/tests/ffi/should_compile/T11983.hs new file mode 100644 index 0000000..162d241 --- /dev/null +++ b/testsuite/tests/ffi/should_compile/T11983.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE ForeignFunctionInterface #-} +module T11983 where + +{-# INCLUDE T11983.h #-} + +import Foreign.Ptr + +foreign import ccall "intptr_example" + intPtrExample :: IntPtr -> IO () +foreign import ccall "uintptr_example" + wordPtrExample :: WordPtr -> IO () diff --git a/testsuite/tests/ffi/should_compile/all.T b/testsuite/tests/ffi/should_compile/all.T index ec6326b..dac31ae 100644 --- a/testsuite/tests/ffi/should_compile/all.T +++ b/testsuite/tests/ffi/should_compile/all.T @@ -30,3 +30,5 @@ test('T3742', normal, compile, ['']) test('cc015', normal, compile, ['']) test('cc016', normal, compile, ['']) test('T10460', normal, compile, ['']) +test('T11983', [ omit_ways(['ghci']), extra_clean(['T11983.o']) ], + compile, ['T11983.c']) From git at git.haskell.org Sun May 1 22:49:38 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 1 May 2016 22:49:38 +0000 (UTC) Subject: [commit: ghc] master: Remove unused equivClassesByUniq (ea34f56) Message-ID: <20160501224938.BDBDD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ea34f565d370404f9ea5f8bcf6a8380ffa842c49/ghc >--------------------------------------------------------------- commit ea34f565d370404f9ea5f8bcf6a8380ffa842c49 Author: Bartosz Nitka Date: Mon May 2 00:09:22 2016 +0200 Remove unused equivClassesByUniq It uses `eltsUFM` so it can introduce nondeterminism, but it isn't used so we can delete it. Test Plan: it builds Reviewers: simonpj, goldfire, simonmar, austin, bgamari Reviewed By: austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2161 GHC Trac Issues: #4012 >--------------------------------------------------------------- ea34f565d370404f9ea5f8bcf6a8380ffa842c49 compiler/utils/ListSetOps.hs | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/compiler/utils/ListSetOps.hs b/compiler/utils/ListSetOps.hs index 207a00c..4113566 100644 --- a/compiler/utils/ListSetOps.hs +++ b/compiler/utils/ListSetOps.hs @@ -15,7 +15,7 @@ module ListSetOps ( -- Duplicate handling hasNoDups, runs, removeDups, findDupsEq, - equivClasses, equivClassesByUniq, + equivClasses, -- Indexing getNth @@ -24,8 +24,6 @@ module ListSetOps ( #include "HsVersions.h" import Outputable -import Unique -import UniqFM import Util import Data.List @@ -159,16 +157,3 @@ findDupsEq _ [] = [] findDupsEq eq (x:xs) | null eq_xs = findDupsEq eq xs | otherwise = (x:eq_xs) : findDupsEq eq neq_xs where (eq_xs, neq_xs) = partition (eq x) xs - -equivClassesByUniq :: (a -> Unique) -> [a] -> [[a]] - -- NB: it's *very* important that if we have the input list [a,b,c], - -- where a,b,c all have the same unique, then we get back the list - -- [a,b,c] - -- not - -- [c,b,a] - -- Hence the use of foldr, plus the reversed-args tack_on below -equivClassesByUniq get_uniq xs - = eltsUFM (foldr add emptyUFM xs) - where - add a ufm = addToUFM_C tack_on ufm (get_uniq a) [a] - tack_on old new = new++old From git at git.haskell.org Sun May 1 22:49:41 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 1 May 2016 22:49:41 +0000 (UTC) Subject: [commit: ghc] master: Make sure record pattern synonym selectors are in scope in GHCi. (cd85dc8) Message-ID: <20160501224941.CB9493A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cd85dc84b36bc5f600eb1b3805024a5b2443e1a3/ghc >--------------------------------------------------------------- commit cd85dc84b36bc5f600eb1b3805024a5b2443e1a3 Author: Matthew Pickering Date: Mon May 2 00:11:30 2016 +0200 Make sure record pattern synonym selectors are in scope in GHCi. Beforehand, when a record pattern synonym was defined in GHCi the selectors would not be in scope. This is because of `is_sub_bndr` in `HscTypes.icExtendGblRdrEnv` was throwing away the selectors. This was broken by the fix to #10520 but it is easy to resolve. Reviewers: austin, bgamari, simonpj Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2147 GHC Trac Issues: #11985 >--------------------------------------------------------------- cd85dc84b36bc5f600eb1b3805024a5b2443e1a3 compiler/main/HscTypes.hs | 16 +++++++++------- testsuite/tests/patsyn/should_run/T11985.script | 4 ++++ testsuite/tests/patsyn/should_run/T11985.stdout | 1 + testsuite/tests/patsyn/should_run/all.T | 1 + 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/compiler/main/HscTypes.hs b/compiler/main/HscTypes.hs index 541f0af..800958b 100644 --- a/compiler/main/HscTypes.hs +++ b/compiler/main/HscTypes.hs @@ -1504,9 +1504,9 @@ icExtendGblRdrEnv env tythings | is_sub_bndr thing = env | otherwise - = foldl extendGlobalRdrEnv env1 (localGREsFromAvail avail) + = foldl extendGlobalRdrEnv env1 (concatMap localGREsFromAvail avail) where - env1 = shadowNames env (availNames avail) + env1 = shadowNames env (concatMap availNames avail) avail = tyThingAvailInfo thing -- Ugh! The new_tythings may include record selectors, since they @@ -1829,19 +1829,21 @@ tyThingsTyCoVars tts = -- | The Names that a TyThing should bring into scope. Used to build -- the GlobalRdrEnv for the InteractiveContext. -tyThingAvailInfo :: TyThing -> AvailInfo +tyThingAvailInfo :: TyThing -> [AvailInfo] tyThingAvailInfo (ATyCon t) = case tyConClass_maybe t of - Just c -> AvailTC n (n : map getName (classMethods c) + Just c -> [AvailTC n (n : map getName (classMethods c) ++ map getName (classATs c)) - [] + [] ] where n = getName c - Nothing -> AvailTC n (n : map getName dcs) flds + Nothing -> [AvailTC n (n : map getName dcs) flds] where n = getName t dcs = tyConDataCons t flds = tyConFieldLabels t +tyThingAvailInfo (AConLike (PatSynCon p)) + = map patSynAvail ((getName p) : map flSelector (patSynFieldLabels p)) tyThingAvailInfo t - = avail (getName t) + = [avail (getName t)] {- ************************************************************************ diff --git a/testsuite/tests/patsyn/should_run/T11985.script b/testsuite/tests/patsyn/should_run/T11985.script new file mode 100644 index 0000000..efeba01 --- /dev/null +++ b/testsuite/tests/patsyn/should_run/T11985.script @@ -0,0 +1,4 @@ +:set -XPatternSynonyms + +pattern Point{x, y} = (x, y) +(1, 2) { x = 3} diff --git a/testsuite/tests/patsyn/should_run/T11985.stdout b/testsuite/tests/patsyn/should_run/T11985.stdout new file mode 100644 index 0000000..3f9e8ad --- /dev/null +++ b/testsuite/tests/patsyn/should_run/T11985.stdout @@ -0,0 +1 @@ +(3,2) diff --git a/testsuite/tests/patsyn/should_run/all.T b/testsuite/tests/patsyn/should_run/all.T index a0bd3ce..d98a1ff 100644 --- a/testsuite/tests/patsyn/should_run/all.T +++ b/testsuite/tests/patsyn/should_run/all.T @@ -12,4 +12,5 @@ test('match-unboxed', normal, compile_and_run, ['']) test('unboxed-wrapper', normal, compile_and_run, ['']) test('records-run', normal, compile_and_run, ['']) test('ghci', just_ghci, ghci_script, ['ghci.script']) +test('T11985', just_ghci, ghci_script, ['T11985.script']) test('T11224', normal, compile_and_run, ['']) From git at git.haskell.org Mon May 2 00:23:54 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 May 2016 00:23:54 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: rts: Replace `nat` with `uint32_t` (c7f72ae) Message-ID: <20160502002354.6F1013A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/c7f72ae9bcbf89db12c3de5a6041f0f69c2b3154/ghc >--------------------------------------------------------------- commit c7f72ae9bcbf89db12c3de5a6041f0f69c2b3154 Author: Erik de Castro Lopo Date: Mon May 2 06:37:14 2016 +1000 rts: Replace `nat` with `uint32_t` The `nat` type was an alias for `unsigned int` with a comment saying it was at least 32 bits. We keep the typedef in case client code is using it but mark it as deprecated. >--------------------------------------------------------------- c7f72ae9bcbf89db12c3de5a6041f0f69c2b3154 includes/rts/Flags.h | 44 ++++++++++----------- includes/rts/IOManager.h | 2 +- includes/rts/OSThreads.h | 4 +- includes/rts/SpinLock.h | 4 +- includes/rts/Threads.h | 4 +- includes/rts/Types.h | 3 +- includes/rts/prof/CCS.h | 2 +- includes/rts/storage/Block.h | 4 +- includes/rts/storage/ClosureMacros.h | 36 +++++++++--------- includes/rts/storage/GC.h | 8 ++-- includes/rts/storage/MBlock.h | 4 +- includes/rts/storage/SMPClosureOps.h | 2 +- rts/Adjustor.c | 4 +- rts/Arena.c | 4 +- rts/Capability.c | 34 ++++++++--------- rts/Capability.h | 22 +++++------ rts/CheckUnload.c | 4 +- rts/Disassembler.c | 6 +-- rts/Globals.c | 4 +- rts/Hpc.c | 10 ++--- rts/Interpreter.c | 16 ++++---- rts/LdvProfile.c | 6 +-- rts/LdvProfile.h | 2 +- rts/LibdwPool.c | 2 +- rts/Linker.c | 10 ++--- rts/Messages.c | 6 +-- rts/Messages.h | 2 +- rts/Pool.c | 22 +++++------ rts/Pool.h | 10 ++--- rts/Printer.c | 12 +++--- rts/ProfHeap.c | 30 +++++++-------- rts/ProfHeap.h | 2 +- rts/Profiling.c | 46 +++++++++++----------- rts/Proftimer.c | 4 +- rts/RaiseAsync.c | 12 +++--- rts/RaiseAsync.h | 2 +- rts/RetainerProfile.c | 60 ++++++++++++++--------------- rts/RetainerSet.c | 28 +++++++------- rts/RetainerSet.h | 6 +-- rts/RtsFlags.c | 18 ++++----- rts/RtsStartup.c | 2 +- rts/Schedule.c | 56 +++++++++++++-------------- rts/Sparks.c | 6 +-- rts/Stable.c | 12 +++--- rts/Stats.c | 28 +++++++------- rts/Stats.h | 4 +- rts/Task.c | 12 +++--- rts/Task.h | 10 ++--- rts/ThreadPaused.c | 16 ++++---- rts/Threads.c | 8 ++-- rts/Trace.c | 8 ++-- rts/Trace.h | 24 ++++++------ rts/WSDeque.c | 2 +- rts/WSDeque.h | 2 +- rts/Weak.c | 2 +- rts/eventlog/EventLog.c | 30 +++++++-------- rts/eventlog/EventLog.h | 8 ++-- rts/posix/GetTime.c | 2 +- rts/posix/OSMem.c | 4 +- rts/posix/OSThreads.c | 28 +++++++------- rts/posix/Signals.c | 4 +- rts/sm/BlockAlloc.c | 16 ++++---- rts/sm/BlockAlloc.h | 2 +- rts/sm/Compact.h | 6 +-- rts/sm/Evac.c | 24 ++++++------ rts/sm/GC.c | 74 ++++++++++++++++++------------------ rts/sm/GC.h | 8 ++-- rts/sm/GCThread.h | 8 ++-- rts/sm/GCUtils.c | 16 ++++---- rts/sm/GCUtils.h | 8 ++-- rts/sm/HeapAlloc.h | 4 +- rts/sm/MBlock.c | 46 +++++++++++----------- rts/sm/MarkWeak.c | 10 ++--- rts/sm/OSMem.h | 4 +- rts/sm/Sanity.c | 48 +++++++++++------------ rts/sm/Scav.c | 18 ++++----- rts/sm/Storage.c | 38 +++++++++--------- rts/sm/Storage.h | 10 ++--- rts/sm/Sweep.c | 2 +- rts/win32/AwaitEvent.c | 2 +- rts/win32/OSMem.c | 8 ++-- rts/win32/OSThreads.c | 8 ++-- rts/win32/ThrIOManager.c | 2 +- 83 files changed, 566 insertions(+), 565 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc c7f72ae9bcbf89db12c3de5a6041f0f69c2b3154 From git at git.haskell.org Mon May 2 00:23:56 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 May 2016 00:23:56 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat's head updated: rts: Replace `nat` with `uint32_t` (c7f72ae) Message-ID: <20160502002356.AFFD03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/erikd/remove-nat' now includes: a28611b Export constructors for IntPtr and WordPtr ea34f56 Remove unused equivClassesByUniq cd85dc8 Make sure record pattern synonym selectors are in scope in GHCi. c7f72ae rts: Replace `nat` with `uint32_t` From git at git.haskell.org Mon May 2 00:49:30 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 May 2016 00:49:30 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: rts: Replace `nat` with `uint32_t` (fda8668) Message-ID: <20160502004930.7DABC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/fda866843a89f49989ea90afc2d1e9f9ebeba321/ghc >--------------------------------------------------------------- commit fda866843a89f49989ea90afc2d1e9f9ebeba321 Author: Erik de Castro Lopo Date: Mon May 2 06:37:14 2016 +1000 rts: Replace `nat` with `uint32_t` The `nat` type was an alias for `unsigned int` with a comment saying it was at least 32 bits. We keep the typedef in case client code is using it but mark it as deprecated. >--------------------------------------------------------------- fda866843a89f49989ea90afc2d1e9f9ebeba321 includes/rts/Flags.h | 44 ++++++++++----------- includes/rts/IOManager.h | 2 +- includes/rts/OSThreads.h | 4 +- includes/rts/SpinLock.h | 4 +- includes/rts/Threads.h | 4 +- includes/rts/Types.h | 3 +- includes/rts/prof/CCS.h | 2 +- includes/rts/storage/Block.h | 4 +- includes/rts/storage/ClosureMacros.h | 36 +++++++++--------- includes/rts/storage/GC.h | 8 ++-- includes/rts/storage/MBlock.h | 4 +- includes/rts/storage/SMPClosureOps.h | 2 +- rts/Adjustor.c | 4 +- rts/Arena.c | 4 +- rts/Capability.c | 34 ++++++++--------- rts/Capability.h | 22 +++++------ rts/CheckUnload.c | 4 +- rts/Disassembler.c | 6 +-- rts/Globals.c | 4 +- rts/Hpc.c | 10 ++--- rts/Interpreter.c | 16 ++++---- rts/LdvProfile.c | 6 +-- rts/LdvProfile.h | 2 +- rts/LibdwPool.c | 2 +- rts/Linker.c | 10 ++--- rts/Messages.c | 6 +-- rts/Messages.h | 2 +- rts/Pool.c | 22 +++++------ rts/Pool.h | 10 ++--- rts/Printer.c | 12 +++--- rts/ProfHeap.c | 30 +++++++-------- rts/ProfHeap.h | 2 +- rts/Profiling.c | 46 +++++++++++----------- rts/Proftimer.c | 4 +- rts/RaiseAsync.c | 12 +++--- rts/RaiseAsync.h | 2 +- rts/RetainerProfile.c | 60 ++++++++++++++--------------- rts/RetainerSet.c | 28 +++++++------- rts/RetainerSet.h | 6 +-- rts/RtsFlags.c | 18 ++++----- rts/RtsStartup.c | 2 +- rts/Schedule.c | 56 +++++++++++++-------------- rts/Sparks.c | 6 +-- rts/Stable.c | 12 +++--- rts/Stats.c | 28 +++++++------- rts/Stats.h | 4 +- rts/Task.c | 12 +++--- rts/Task.h | 10 ++--- rts/ThreadPaused.c | 16 ++++---- rts/Threads.c | 8 ++-- rts/Trace.c | 8 ++-- rts/Trace.h | 24 ++++++------ rts/WSDeque.c | 2 +- rts/WSDeque.h | 2 +- rts/Weak.c | 2 +- rts/eventlog/EventLog.c | 30 +++++++-------- rts/eventlog/EventLog.h | 8 ++-- rts/posix/GetTime.c | 2 +- rts/posix/OSMem.c | 4 +- rts/posix/OSThreads.c | 28 +++++++------- rts/posix/Signals.c | 4 +- rts/sm/BlockAlloc.c | 16 ++++---- rts/sm/BlockAlloc.h | 2 +- rts/sm/Compact.h | 6 +-- rts/sm/Evac.c | 24 ++++++------ rts/sm/GC.c | 74 ++++++++++++++++++------------------ rts/sm/GC.h | 8 ++-- rts/sm/GCThread.h | 8 ++-- rts/sm/GCUtils.c | 16 ++++---- rts/sm/GCUtils.h | 8 ++-- rts/sm/HeapAlloc.h | 4 +- rts/sm/MBlock.c | 46 +++++++++++----------- rts/sm/MarkWeak.c | 10 ++--- rts/sm/OSMem.h | 4 +- rts/sm/Sanity.c | 48 +++++++++++------------ rts/sm/Scav.c | 18 ++++----- rts/sm/Storage.c | 38 +++++++++--------- rts/sm/Storage.h | 10 ++--- rts/sm/Sweep.c | 2 +- rts/win32/AwaitEvent.c | 2 +- rts/win32/OSMem.c | 8 ++-- rts/win32/OSThreads.c | 10 ++--- rts/win32/ThrIOManager.c | 2 +- 83 files changed, 567 insertions(+), 566 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc fda866843a89f49989ea90afc2d1e9f9ebeba321 From git at git.haskell.org Mon May 2 05:40:30 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 May 2016 05:40:30 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: rts: Replace `nat` with `uint32_t` (918de21) Message-ID: <20160502054030.A4F633A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/918de21efdaa52c7f4fe73a840016dd9a4727920/ghc >--------------------------------------------------------------- commit 918de21efdaa52c7f4fe73a840016dd9a4727920 Author: Erik de Castro Lopo Date: Mon May 2 06:37:14 2016 +1000 rts: Replace `nat` with `uint32_t` Summary: The `nat` type was an alias for `unsigned int` with a comment saying it was at least 32 bits. We keep the typedef in case client code is using it but mark it as deprecated. Test Plan: Validated on Linux, OS X and Windows Reviewers: simonmar, austin, thomie, hvr, bgamari, hsyl20 Differential Revision: https://phabricator.haskell.org/D2166 >--------------------------------------------------------------- 918de21efdaa52c7f4fe73a840016dd9a4727920 includes/rts/Flags.h | 48 +++++++++++------------ includes/rts/IOManager.h | 2 +- includes/rts/OSThreads.h | 4 +- includes/rts/SpinLock.h | 4 +- includes/rts/Threads.h | 4 +- includes/rts/Types.h | 3 +- includes/rts/prof/CCS.h | 2 +- includes/rts/storage/Block.h | 4 +- includes/rts/storage/ClosureMacros.h | 36 ++++++++--------- includes/rts/storage/GC.h | 8 ++-- includes/rts/storage/MBlock.h | 4 +- includes/rts/storage/SMPClosureOps.h | 2 +- rts/Adjustor.c | 4 +- rts/Arena.c | 4 +- rts/Capability.c | 34 ++++++++-------- rts/Capability.h | 22 +++++------ rts/CheckUnload.c | 4 +- rts/Disassembler.c | 10 ++--- rts/Globals.c | 4 +- rts/Hpc.c | 10 ++--- rts/Interpreter.c | 16 ++++---- rts/LdvProfile.c | 8 ++-- rts/LdvProfile.h | 2 +- rts/LibdwPool.c | 2 +- rts/Linker.c | 10 ++--- rts/Messages.c | 6 +-- rts/Messages.h | 2 +- rts/Pool.c | 22 +++++------ rts/Pool.h | 10 ++--- rts/Printer.c | 12 +++--- rts/ProfHeap.c | 30 +++++++------- rts/ProfHeap.h | 2 +- rts/Profiling.c | 51 ++++++++++++------------ rts/Proftimer.c | 4 +- rts/RaiseAsync.c | 12 +++--- rts/RaiseAsync.h | 2 +- rts/RetainerProfile.c | 72 +++++++++++++++++----------------- rts/RetainerSet.c | 28 ++++++------- rts/RetainerSet.h | 8 ++-- rts/RtsFlags.c | 21 +++++----- rts/RtsStartup.c | 2 +- rts/Schedule.c | 57 ++++++++++++++------------- rts/Sparks.c | 6 +-- rts/Stable.c | 12 +++--- rts/Stats.c | 28 ++++++------- rts/Stats.h | 10 ++--- rts/Task.c | 13 +++--- rts/Task.h | 10 ++--- rts/ThreadPaused.c | 18 ++++----- rts/Threads.c | 8 ++-- rts/Trace.c | 8 ++-- rts/Trace.h | 24 ++++++------ rts/WSDeque.c | 2 +- rts/WSDeque.h | 2 +- rts/Weak.c | 2 +- rts/eventlog/EventLog.c | 30 +++++++------- rts/eventlog/EventLog.h | 8 ++-- rts/posix/GetTime.c | 2 +- rts/posix/OSMem.c | 4 +- rts/posix/OSThreads.c | 28 ++++++------- rts/posix/Signals.c | 4 +- rts/sm/BlockAlloc.c | 16 ++++---- rts/sm/BlockAlloc.h | 2 +- rts/sm/Compact.h | 6 +-- rts/sm/Evac.c | 24 ++++++------ rts/sm/GC.c | 74 +++++++++++++++++------------------ rts/sm/GC.h | 8 ++-- rts/sm/GCThread.h | 8 ++-- rts/sm/GCUtils.c | 16 ++++---- rts/sm/GCUtils.h | 8 ++-- rts/sm/HeapAlloc.h | 4 +- rts/sm/MBlock.c | 46 +++++++++++----------- rts/sm/MarkWeak.c | 10 ++--- rts/sm/OSMem.h | 4 +- rts/sm/Sanity.c | 52 ++++++++++++------------ rts/sm/Scav.c | 18 ++++----- rts/sm/Storage.c | 38 +++++++++--------- rts/sm/Storage.h | 10 ++--- rts/sm/Sweep.c | 2 +- rts/win32/AwaitEvent.c | 2 +- rts/win32/OSMem.c | 8 ++-- rts/win32/OSThreads.c | 10 ++--- rts/win32/ThrIOManager.c | 2 +- testsuite/tests/rts/testblockalloc.c | 2 +- testsuite/tests/rts/testheapalloced.c | 2 +- testsuite/tests/rts/testmblockalloc.c | 2 +- testsuite/tests/rts/testwsdeque.c | 14 +++---- 87 files changed, 603 insertions(+), 596 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 918de21efdaa52c7f4fe73a840016dd9a4727920 From git at git.haskell.org Mon May 2 07:49:22 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 May 2016 07:49:22 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: rts: Replace `nat` with `uint32_t` (b74f8b0) Message-ID: <20160502074922.4557C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/b74f8b00c26f698145cc158c4f38495c44f6cd67/ghc >--------------------------------------------------------------- commit b74f8b00c26f698145cc158c4f38495c44f6cd67 Author: Erik de Castro Lopo Date: Mon May 2 06:37:14 2016 +1000 rts: Replace `nat` with `uint32_t` Summary: The `nat` type was an alias for `unsigned int` with a comment saying it was at least 32 bits. We keep the typedef in case client code is using it but mark it as deprecated. Test Plan: Validated on Linux, OS X and Windows Reviewers: simonmar, austin, thomie, hvr, bgamari, hsyl20 Differential Revision: https://phabricator.haskell.org/D2166 >--------------------------------------------------------------- b74f8b00c26f698145cc158c4f38495c44f6cd67 includes/rts/Flags.h | 48 +++++++++++------------ includes/rts/IOManager.h | 2 +- includes/rts/OSThreads.h | 4 +- includes/rts/SpinLock.h | 4 +- includes/rts/Threads.h | 4 +- includes/rts/Types.h | 3 +- includes/rts/prof/CCS.h | 2 +- includes/rts/storage/Block.h | 4 +- includes/rts/storage/ClosureMacros.h | 36 ++++++++--------- includes/rts/storage/GC.h | 8 ++-- includes/rts/storage/MBlock.h | 4 +- includes/rts/storage/SMPClosureOps.h | 2 +- rts/Adjustor.c | 4 +- rts/Arena.c | 4 +- rts/Capability.c | 35 +++++++++-------- rts/Capability.h | 23 +++++------ rts/CheckUnload.c | 4 +- rts/Disassembler.c | 10 ++--- rts/Globals.c | 4 +- rts/Hpc.c | 10 ++--- rts/Interpreter.c | 16 ++++---- rts/LdvProfile.c | 8 ++-- rts/LdvProfile.h | 2 +- rts/LibdwPool.c | 2 +- rts/Linker.c | 10 ++--- rts/Messages.c | 6 +-- rts/Messages.h | 2 +- rts/Pool.c | 22 +++++------ rts/Pool.h | 10 ++--- rts/Printer.c | 14 ++++--- rts/ProfHeap.c | 30 +++++++------- rts/ProfHeap.h | 2 +- rts/Profiling.c | 51 ++++++++++++------------ rts/Proftimer.c | 4 +- rts/RaiseAsync.c | 12 +++--- rts/RaiseAsync.h | 2 +- rts/RetainerProfile.c | 72 +++++++++++++++++----------------- rts/RetainerSet.c | 28 ++++++------- rts/RetainerSet.h | 8 ++-- rts/RtsFlags.c | 21 +++++----- rts/RtsStartup.c | 2 +- rts/Schedule.c | 57 ++++++++++++++------------- rts/Sparks.c | 6 +-- rts/Stable.c | 12 +++--- rts/Stats.c | 28 ++++++------- rts/Stats.h | 10 ++--- rts/Task.c | 13 +++--- rts/Task.h | 10 ++--- rts/ThreadPaused.c | 18 ++++----- rts/Threads.c | 8 ++-- rts/Trace.c | 8 ++-- rts/Trace.h | 24 ++++++------ rts/WSDeque.c | 2 +- rts/WSDeque.h | 2 +- rts/Weak.c | 2 +- rts/eventlog/EventLog.c | 30 +++++++------- rts/eventlog/EventLog.h | 8 ++-- rts/posix/GetTime.c | 2 +- rts/posix/OSMem.c | 4 +- rts/posix/OSThreads.c | 28 ++++++------- rts/posix/Signals.c | 4 +- rts/sm/BlockAlloc.c | 16 ++++---- rts/sm/BlockAlloc.h | 2 +- rts/sm/Compact.h | 6 +-- rts/sm/Evac.c | 24 ++++++------ rts/sm/GC.c | 74 +++++++++++++++++------------------ rts/sm/GC.h | 8 ++-- rts/sm/GCThread.h | 8 ++-- rts/sm/GCUtils.c | 16 ++++---- rts/sm/GCUtils.h | 8 ++-- rts/sm/HeapAlloc.h | 4 +- rts/sm/MBlock.c | 46 +++++++++++----------- rts/sm/MarkWeak.c | 10 ++--- rts/sm/OSMem.h | 4 +- rts/sm/Sanity.c | 52 ++++++++++++------------ rts/sm/Scav.c | 18 ++++----- rts/sm/Storage.c | 38 +++++++++--------- rts/sm/Storage.h | 10 ++--- rts/sm/Sweep.c | 2 +- rts/win32/AwaitEvent.c | 2 +- rts/win32/OSMem.c | 8 ++-- rts/win32/OSThreads.c | 10 ++--- rts/win32/ThrIOManager.c | 2 +- testsuite/tests/rts/testblockalloc.c | 2 +- testsuite/tests/rts/testheapalloced.c | 2 +- testsuite/tests/rts/testmblockalloc.c | 2 +- testsuite/tests/rts/testwsdeque.c | 14 +++---- 87 files changed, 607 insertions(+), 596 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc b74f8b00c26f698145cc158c4f38495c44f6cd67 From git at git.haskell.org Mon May 2 10:29:31 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 May 2016 10:29:31 +0000 (UTC) Subject: [commit: ghc] master: glasgow_exts.rst: fix quoting (81d8a23) Message-ID: <20160502102931.6C81E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/81d8a23ee7c0897d4ab2848ec2a990a8cdf9c66b/ghc >--------------------------------------------------------------- commit 81d8a23ee7c0897d4ab2848ec2a990a8cdf9c66b Author: Sergei Trofimovich Date: Thu Apr 21 22:43:11 2016 +0100 glasgow_exts.rst: fix quoting glasgow_exts.rst:6525: WARNING: Inline literal start-string without end-string. Signed-off-by: Sergei Trofimovich >--------------------------------------------------------------- 81d8a23ee7c0897d4ab2848ec2a990a8cdf9c66b 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 fe12568..deffd01 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -6540,7 +6540,7 @@ completely covers the cases covered by the instance head. cannot give any *subsequent* instances for ``(GMap Flob ...)``, this facility was not very useful, except perhaps when the free indexed parameter has a fixed number of alternatives - (e.g. ``Bool`). But in that case it is better to define an auxiliary + (e.g. ``Bool``). But in that case it is better to define an auxiliary closed type function like this: :: class C a where From git at git.haskell.org Mon May 2 10:29:34 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 May 2016 10:29:34 +0000 (UTC) Subject: [commit: ghc] master: added docstring for '-fhistory-size' flag (db2bfe0) Message-ID: <20160502102934.1C81A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/db2bfe00e3d277c387c7fc855306fe423462d758/ghc >--------------------------------------------------------------- commit db2bfe00e3d277c387c7fc855306fe423462d758 Author: Sergei Trofimovich Date: Sun Jan 3 11:55:38 2016 +0000 added docstring for '-fhistory-size' flag Signed-off-by: Sergei Trofimovich >--------------------------------------------------------------- db2bfe00e3d277c387c7fc855306fe423462d758 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 82cdf1b..00a25cd 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -676,7 +676,7 @@ data DynFlags = DynFlags { floatLamArgs :: Maybe Int, -- ^ Arg count for lambda floating -- See CoreMonad.FloatOutSwitches - historySize :: Int, + historySize :: Int, -- ^ Simplification history size importPaths :: [FilePath], mainModIs :: Module, From git at git.haskell.org Mon May 2 10:29:36 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 May 2016 10:29:36 +0000 (UTC) Subject: [commit: ghc] master: docs/users_guide/glasgow_exts.rst: fix merge conflict (c5be5e2) Message-ID: <20160502102936.BF8BE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c5be5e2e9e2679318a84447c0443f04c98b60371/ghc >--------------------------------------------------------------- commit c5be5e2e9e2679318a84447c0443f04c98b60371 Author: Sergei Trofimovich Date: Mon May 2 11:24:23 2016 +0100 docs/users_guide/glasgow_exts.rst: fix merge conflict Signed-off-by: Sergei Trofimovich >--------------------------------------------------------------- c5be5e2e9e2679318a84447c0443f04c98b60371 docs/users_guide/glasgow_exts.rst | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index deffd01..863c054 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -4556,7 +4556,14 @@ Constrained class method types .. ghc-flag:: -XConstrainedClassMethods -@ -4562,7 +4562,20 @@ class type variable, thus: :: + Allows the definition of further constraints on individual class methods. + +Haskell 98 prohibits class method types to mention constraints on the +class type variable, thus: :: + + class Seq s a where + fromList :: [a] -> s a + elem :: Eq a => a -> s a -> Bool The type of ``elem`` is illegal in Haskell 98, because it contains the constraint ``Eq a``, which constrains only the class type variable (in From git at git.haskell.org Mon May 2 10:49:52 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 May 2016 10:49:52 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: rts/ProfHeap.c: Use `size_t` instead of `long`. (b46536f) Message-ID: <20160502104952.5446B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/b46536fa8d92b00c4f7742af1df121cb0d1c5fb8/ghc >--------------------------------------------------------------- commit b46536fa8d92b00c4f7742af1df121cb0d1c5fb8 Author: Erik de Castro Lopo Date: Mon May 2 20:22:00 2016 +1000 rts/ProfHeap.c: Use `size_t` instead of `long`. On x64 Windows `sizeof long` is 4 which could easily overflow resulting in incorrect heap profiling results. This change does not affect either Linux or OS X where `sizeof long` == `sizeof size_t` regardless of machine word size. >--------------------------------------------------------------- b46536fa8d92b00c4f7742af1df121cb0d1c5fb8 rts/ProfHeap.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/rts/ProfHeap.c b/rts/ProfHeap.c index 875cc7e..2f940d2 100644 --- a/rts/ProfHeap.c +++ b/rts/ProfHeap.c @@ -50,13 +50,13 @@ static uint32_t max_era; typedef struct _counter { void *identity; union { - uint32_t resid; + size_t resid; struct { - long prim; // total size of 'inherently used' closures - long not_used; // total size of 'never used' closures - long used; // total size of 'used at least once' closures - long void_total; // current total size of 'destroyed without being used' closures - long drag_total; // current total size of 'used at least once and waiting to die' + size_t prim; // total size of 'inherently used' closures + size_t not_used; // total size of 'never used' closures + size_t used; // total size of 'used at least once' closures + size_t void_total; // current total size of 'destroyed without being used' closures + size_t drag_total; // current total size of 'used at least once and waiting to die' } ldv; } c; struct _counter *next; @@ -79,11 +79,11 @@ typedef struct { Arena * arena; // for LDV profiling, when just displaying by LDV - long prim; - long not_used; - long used; - long void_total; - long drag_total; + size_t prim; + size_t not_used; + size_t used; + size_t void_total; + size_t drag_total; } Census; static Census *censuses = NULL; @@ -739,7 +739,7 @@ static void dumpCensus( Census *census ) { counter *ctr; - long count; + size_t count; printSample(rtsTrue, census->time); @@ -778,8 +778,6 @@ dumpCensus( Census *census ) count = ctr->c.resid; } - ASSERT( count >= 0 ); - if (count == 0) continue; #if !defined(PROFILING) @@ -835,7 +833,7 @@ dumpCensus( Census *census ) } -static void heapProfObject(Census *census, StgClosure *p, uint32_t size, +static void heapProfObject(Census *census, StgClosure *p, size_t size, rtsBool prim #ifndef PROFILING STG_UNUSED @@ -843,7 +841,7 @@ static void heapProfObject(Census *census, StgClosure *p, uint32_t size, ) { void *identity; - uint32_t real_size; + size_t real_size; counter *ctr; identity = NULL; @@ -920,7 +918,7 @@ heapCensusChain( Census *census, bdescr *bd ) { StgPtr p; StgInfoTable *info; - uint32_t size; + size_t size; rtsBool prim; for (; bd != NULL; bd = bd->link) { From git at git.haskell.org Mon May 2 10:49:55 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 May 2016 10:49:55 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: rts: Replace `nat` with `uint32_t` (29f5837) Message-ID: <20160502104955.2BCB73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/29f5837de3e99642d41fe41561c1a848c3b7b12e/ghc >--------------------------------------------------------------- commit 29f5837de3e99642d41fe41561c1a848c3b7b12e Author: Erik de Castro Lopo Date: Mon May 2 06:37:14 2016 +1000 rts: Replace `nat` with `uint32_t` Summary: The `nat` type was an alias for `unsigned int` with a comment saying it was at least 32 bits. We keep the typedef in case client code is using it but mark it as deprecated. Test Plan: Validated on Linux, OS X and Windows Reviewers: simonmar, austin, thomie, hvr, bgamari, hsyl20 Differential Revision: https://phabricator.haskell.org/D2166 >--------------------------------------------------------------- 29f5837de3e99642d41fe41561c1a848c3b7b12e includes/rts/Flags.h | 48 +++++++++++------------ includes/rts/IOManager.h | 2 +- includes/rts/OSThreads.h | 4 +- includes/rts/SpinLock.h | 4 +- includes/rts/Threads.h | 4 +- includes/rts/Types.h | 3 +- includes/rts/prof/CCS.h | 2 +- includes/rts/storage/Block.h | 4 +- includes/rts/storage/ClosureMacros.h | 36 ++++++++--------- includes/rts/storage/GC.h | 8 ++-- includes/rts/storage/MBlock.h | 4 +- includes/rts/storage/SMPClosureOps.h | 2 +- rts/Adjustor.c | 4 +- rts/Arena.c | 4 +- rts/Capability.c | 35 +++++++++-------- rts/Capability.h | 23 +++++------ rts/CheckUnload.c | 4 +- rts/Disassembler.c | 10 ++--- rts/Globals.c | 4 +- rts/Hpc.c | 10 ++--- rts/Interpreter.c | 16 ++++---- rts/LdvProfile.c | 8 ++-- rts/LdvProfile.h | 2 +- rts/LibdwPool.c | 2 +- rts/Linker.c | 10 ++--- rts/Messages.c | 6 +-- rts/Messages.h | 2 +- rts/Pool.c | 22 +++++------ rts/Pool.h | 10 ++--- rts/Printer.c | 14 ++++--- rts/ProfHeap.c | 30 +++++++------- rts/ProfHeap.h | 2 +- rts/Profiling.c | 51 ++++++++++++------------ rts/Proftimer.c | 4 +- rts/RaiseAsync.c | 12 +++--- rts/RaiseAsync.h | 2 +- rts/RetainerProfile.c | 72 +++++++++++++++++----------------- rts/RetainerSet.c | 28 ++++++------- rts/RetainerSet.h | 8 ++-- rts/RtsFlags.c | 21 +++++----- rts/RtsStartup.c | 2 +- rts/Schedule.c | 57 ++++++++++++++------------- rts/Sparks.c | 6 +-- rts/Stable.c | 12 +++--- rts/Stats.c | 28 ++++++------- rts/Stats.h | 10 ++--- rts/Task.c | 13 +++--- rts/Task.h | 10 ++--- rts/ThreadPaused.c | 18 ++++----- rts/Threads.c | 8 ++-- rts/Trace.c | 8 ++-- rts/Trace.h | 24 ++++++------ rts/WSDeque.c | 2 +- rts/WSDeque.h | 2 +- rts/Weak.c | 2 +- rts/eventlog/EventLog.c | 30 +++++++------- rts/eventlog/EventLog.h | 8 ++-- rts/posix/GetTime.c | 2 +- rts/posix/OSMem.c | 4 +- rts/posix/OSThreads.c | 28 ++++++------- rts/posix/Signals.c | 4 +- rts/sm/BlockAlloc.c | 16 ++++---- rts/sm/BlockAlloc.h | 2 +- rts/sm/Compact.h | 6 +-- rts/sm/Evac.c | 24 ++++++------ rts/sm/GC.c | 74 +++++++++++++++++------------------ rts/sm/GC.h | 8 ++-- rts/sm/GCThread.h | 8 ++-- rts/sm/GCUtils.c | 16 ++++---- rts/sm/GCUtils.h | 8 ++-- rts/sm/HeapAlloc.h | 4 +- rts/sm/MBlock.c | 46 +++++++++++----------- rts/sm/MarkWeak.c | 10 ++--- rts/sm/OSMem.h | 4 +- rts/sm/Sanity.c | 52 ++++++++++++------------ rts/sm/Scav.c | 18 ++++----- rts/sm/Storage.c | 38 +++++++++--------- rts/sm/Storage.h | 10 ++--- rts/sm/Sweep.c | 2 +- rts/win32/AwaitEvent.c | 2 +- rts/win32/OSMem.c | 8 ++-- rts/win32/OSThreads.c | 10 ++--- rts/win32/ThrIOManager.c | 2 +- testsuite/tests/rts/testblockalloc.c | 2 +- testsuite/tests/rts/testheapalloced.c | 2 +- testsuite/tests/rts/testmblockalloc.c | 2 +- testsuite/tests/rts/testwsdeque.c | 14 +++---- 87 files changed, 607 insertions(+), 596 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 29f5837de3e99642d41fe41561c1a848c3b7b12e From git at git.haskell.org Mon May 2 10:49:57 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 May 2016 10:49:57 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: RtsUtils: Use `size_t` instead of `int` where appropriate (7fb63e5) Message-ID: <20160502104957.DAFD83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/7fb63e563fd44de909cd6f4c96f63798f105f11b/ghc >--------------------------------------------------------------- commit 7fb63e563fd44de909cd6f4c96f63798f105f11b Author: Erik de Castro Lopo Date: Mon May 2 20:07:05 2016 +1000 RtsUtils: Use `size_t` instead of `int` where appropriate Functions like `stgMallocBytes` take a size parameter which was of type `int`, but is commonly used as `stgMallocBytes (sizeof (...))`. This is problematic because the `sizeof` operator returns `size_t` so that on 64 bit systems, in this common use case the `size_t` parameter would be truncated to 32 bits when passed to `stgMallocBytes` where it was cast back to `size_t`. >--------------------------------------------------------------- 7fb63e563fd44de909cd6f4c96f63798f105f11b rts/RtsUtils.c | 22 +++++++++------------- rts/RtsUtils.h | 6 +++--- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/rts/RtsUtils.c b/rts/RtsUtils.c index c837143..716d203 100644 --- a/rts/RtsUtils.c +++ b/rts/RtsUtils.c @@ -57,13 +57,11 @@ extern char *ctime_r(const time_t *, char *); -------------------------------------------------------------------------- */ void * -stgMallocBytes (int n, char *msg) +stgMallocBytes (size_t n, char *msg) { - char *space; - size_t n2; + void *space; - n2 = (size_t) n; - if ((space = (char *) malloc(n2)) == NULL) { + if ((space = malloc(n)) == NULL) { /* Quoting POSIX.1-2008 (which says more or less the same as ISO C99): * * "Upon successful completion with size not equal to 0, malloc() shall @@ -85,13 +83,11 @@ stgMallocBytes (int n, char *msg) } void * -stgReallocBytes (void *p, int n, char *msg) +stgReallocBytes (void *p, size_t n, char *msg) { - char *space; - size_t n2; + void *space; - n2 = (size_t) n; - if ((space = (char *) realloc(p, (size_t) n2)) == NULL) { + if ((space = realloc(p, n)) == NULL) { /* don't fflush(stdout); WORKAROUND bug in Linux glibc */ rtsConfig.mallocFailHook((W_) n, msg); /*msg*/ stg_exit(EXIT_INTERNAL_ERROR); @@ -100,11 +96,11 @@ stgReallocBytes (void *p, int n, char *msg) } void * -stgCallocBytes (int n, int m, char *msg) +stgCallocBytes (size_t n, size_t m, char *msg) { - char *space; + void *space; - if ((space = (char *) calloc((size_t) n, (size_t) m)) == NULL) { + if ((space = calloc(n, m)) == NULL) { /* don't fflush(stdout); WORKAROUND bug in Linux glibc */ rtsConfig.mallocFailHook((W_) n*m, msg); /*msg*/ stg_exit(EXIT_INTERNAL_ERROR); diff --git a/rts/RtsUtils.h b/rts/RtsUtils.h index d76c921..2d5e5de 100644 --- a/rts/RtsUtils.h +++ b/rts/RtsUtils.h @@ -18,12 +18,12 @@ void initAllocator(void); void shutdownAllocator(void); -void *stgMallocBytes(int n, char *msg) +void *stgMallocBytes(size_t n, char *msg) GNUC3_ATTRIBUTE(__malloc__); -void *stgReallocBytes(void *p, int n, char *msg); +void *stgReallocBytes(void *p, size_t n, char *msg); -void *stgCallocBytes(int n, int m, char *msg) +void *stgCallocBytes(size_t n, size_t m, char *msg) GNUC3_ATTRIBUTE(__malloc__); char *stgStrndup(const char *s, size_t n); From git at git.haskell.org Mon May 2 10:50:00 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 May 2016 10:50:00 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat's head updated: RtsUtils: Use `size_t` instead of `int` where appropriate (7fb63e5) Message-ID: <20160502105000.38D2E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/erikd/remove-nat' now includes: db2bfe0 added docstring for '-fhistory-size' flag 81d8a23 glasgow_exts.rst: fix quoting c5be5e2 docs/users_guide/glasgow_exts.rst: fix merge conflict 29f5837 rts: Replace `nat` with `uint32_t` b46536f rts/ProfHeap.c: Use `size_t` instead of `long`. 7fb63e5 RtsUtils: Use `size_t` instead of `int` where appropriate From git at git.haskell.org Mon May 2 11:26:27 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 May 2016 11:26:27 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: RtsFlags: Make `mallocFailHook` const correct (a72db3e) Message-ID: <20160502112627.AEFD93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/a72db3e0601c358c70247d10d71a7c11db2fd327/ghc >--------------------------------------------------------------- commit a72db3e0601c358c70247d10d71a7c11db2fd327 Author: Erik de Castro Lopo Date: Mon May 2 21:20:28 2016 +1000 RtsFlags: Make `mallocFailHook` const correct >--------------------------------------------------------------- a72db3e0601c358c70247d10d71a7c11db2fd327 includes/RtsAPI.h | 2 +- rts/hooks/Hooks.h | 2 +- rts/hooks/MallocFail.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/RtsAPI.h b/includes/RtsAPI.h index 16b8486..a4a094f 100644 --- a/includes/RtsAPI.h +++ b/includes/RtsAPI.h @@ -90,7 +90,7 @@ typedef struct { void (* outOfHeapHook) (W_ request_size, W_ heap_size); // Called when malloc() fails, before exiting - void (* mallocFailHook) (W_ request_size /* in bytes */, char *msg); + void (* mallocFailHook) (W_ request_size /* in bytes */, const char *msg); // Called for every GC void (* gcDoneHook) (unsigned int gen, diff --git a/rts/hooks/Hooks.h b/rts/hooks/Hooks.h index 35a6011..1383ccd 100644 --- a/rts/hooks/Hooks.h +++ b/rts/hooks/Hooks.h @@ -21,7 +21,7 @@ extern char *ghc_rts_opts; extern void OnExitHook (void); extern void StackOverflowHook (W_ stack_size); extern void OutOfHeapHook (W_ request_size, W_ heap_size); -extern void MallocFailHook (W_ request_size /* in bytes */, char *msg); +extern void MallocFailHook (W_ request_size /* in bytes */, const char *msg); extern void FlagDefaultsHook (void); #include "EndPrivate.h" diff --git a/rts/hooks/MallocFail.c b/rts/hooks/MallocFail.c index 63343a7..42606b6 100644 --- a/rts/hooks/MallocFail.c +++ b/rts/hooks/MallocFail.c @@ -11,7 +11,7 @@ #include void -MallocFailHook (W_ request_size /* in bytes */, char *msg) +MallocFailHook (W_ request_size /* in bytes */, const char *msg) { fprintf(stderr, "malloc: failed on request for %" FMT_Word " bytes; message: %s\n", request_size, msg); } From git at git.haskell.org Mon May 2 12:10:55 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 May 2016 12:10:55 +0000 (UTC) Subject: [commit: ghc] wip/T10613: Remove dead code: countOnce, countMany (27e8ec7) Message-ID: <20160502121055.A6A163A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T10613 Link : http://ghc.haskell.org/trac/ghc/changeset/27e8ec7c2feba40e8161220513a0801b76d2e428/ghc >--------------------------------------------------------------- commit 27e8ec7c2feba40e8161220513a0801b76d2e428 Author: Joachim Breitner Date: Mon May 2 12:34:25 2016 +0200 Remove dead code: countOnce, countMany and export Count abstractly (the constructors are not used anywhere). >--------------------------------------------------------------- 27e8ec7c2feba40e8161220513a0801b76d2e428 compiler/basicTypes/Demand.hs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/compiler/basicTypes/Demand.hs b/compiler/basicTypes/Demand.hs index 928b038..f081842 100644 --- a/compiler/basicTypes/Demand.hs +++ b/compiler/basicTypes/Demand.hs @@ -9,7 +9,6 @@ module Demand ( StrDmd, UseDmd(..), Count(..), - countOnce, countMany, -- cardinality Demand, CleanDemand, getStrDmd, getUseDmd, mkProdDmd, mkOnceUsedDmd, mkManyUsedDmd, mkHeadStrict, oneifyDmd, @@ -378,11 +377,6 @@ instance Outputable Count where ppr One = char '1' ppr Many = text "" --- Well-formedness preserving constructors for the Absence domain -countOnce, countMany :: Count -countOnce = One -countMany = Many - useBot, useTop :: ArgUse useBot = Abs useTop = Use Many Used From git at git.haskell.org Mon May 2 12:10:58 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 May 2016 12:10:58 +0000 (UTC) Subject: [commit: ghc] wip/T10613: DmdAnal, temporary hack: Remember which “Many” are boring (78278ce) Message-ID: <20160502121058.5C8883A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T10613 Link : http://ghc.haskell.org/trac/ghc/changeset/78278ce51b7c4829de1fa09aca198f615201dedf/ghc >--------------------------------------------------------------- commit 78278ce51b7c4829de1fa09aca198f615201dedf Author: Joachim Breitner Date: Mon May 2 14:12:51 2016 +0200 DmdAnal, temporary hack: Remember which ?Many? are boring in the sense that we do not have to look at the core if this thunk turns out to be a missed opportunity. Not used in any rigoros way, but just to be able to focus on the interesting bits. >--------------------------------------------------------------- 78278ce51b7c4829de1fa09aca198f615201dedf compiler/basicTypes/Demand.hs | 89 ++++++++++++++++++++++----------------- compiler/basicTypes/MkId.hs | 6 +-- compiler/codeGen/StgCmmBind.hs | 8 +++- compiler/codeGen/StgCmmClosure.hs | 39 ++++++++++------- compiler/codeGen/StgCmmTicky.hs | 21 ++++++--- compiler/prelude/primops.txt.pp | 30 ++++++------- compiler/simplStg/StgStats.hs | 2 +- compiler/stgSyn/CoreToStg.hs | 4 +- compiler/stgSyn/StgSyn.hs | 14 ++++-- 9 files changed, 125 insertions(+), 88 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 78278ce51b7c4829de1fa09aca198f615201dedf From git at git.haskell.org Mon May 2 16:36:19 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 May 2016 16:36:19 +0000 (UTC) Subject: [commit: ghc] master: Make validDerivPred ignore non-visible arguments to a class type constructor (fa86ac7) Message-ID: <20160502163619.C0C013A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fa86ac7c14b67f27017d795811265c3a9750024b/ghc >--------------------------------------------------------------- commit fa86ac7c14b67f27017d795811265c3a9750024b Author: RyanGlScott Date: Mon May 2 12:38:04 2016 -0400 Make validDerivPred ignore non-visible arguments to a class type constructor Summary: GHC choked when trying to derive the following: ``` {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE PolyKinds #-} module Example where class Category (cat :: k -> k -> *) where catId :: cat a a catComp :: cat b c -> cat a b -> cat a c newtype T (c :: * -> * -> *) a b = MkT (c a b) deriving Category ``` Unlike in #8865, where we were deriving `Category` for a concrete type like `Either`, in the above example we are attempting to derive an instance of the form: ``` instance Category * c => Category (T * c) where ... ``` (using `-fprint-explicit-kinds` syntax). But `validDerivPred` is checking if `sizePred (Category * c)` equals the number of free type variables in `Category * c`. But note that `sizePred` counts both type variables //and// type constructors, and `*` is a type constructor! So `validDerivPred` erroneously rejects the above instance. The fix is to make `validDerivPred` ignore non-visible arguments to the class type constructor (e.g., ignore `*` is `Category * c`) by using `filterOutInvisibleTypes`. Fixes #11833. Test Plan: ./validate Reviewers: goldfire, hvr, simonpj, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2112 GHC Trac Issues: #11833 >--------------------------------------------------------------- fa86ac7c14b67f27017d795811265c3a9750024b compiler/typecheck/TcValidity.hs | 22 ++++++++++++++++------ testsuite/tests/deriving/should_compile/T11833.hs | 9 +++++++++ testsuite/tests/deriving/should_compile/all.T | 1 + 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/compiler/typecheck/TcValidity.hs b/compiler/typecheck/TcValidity.hs index 0833243..d9f43d3 100644 --- a/compiler/typecheck/TcValidity.hs +++ b/compiler/typecheck/TcValidity.hs @@ -1178,6 +1178,15 @@ It checks for three things So if they are the same, there must be no constructors. But there might be applications thus (f (g x)). + Note that tys only includes the visible arguments of the class type + constructor. Including the non-vivisble arguments can cause the following, + perfectly valid instance to be rejected: + class Category (cat :: k -> k -> *) where ... + newtype T (c :: * -> * -> *) a b = MkT (c a b) + instance Category c => Category (T c) where ... + since the first argument to Category is a non-visible *, which sizeTypes + would count as a constructor! See Trac #11833. + * Also check for a bizarre corner case, when the derived instance decl would look like instance C a b => D (T a) where ... @@ -1198,19 +1207,20 @@ validDerivPred :: TyVarSet -> PredType -> Bool -- See Note [Valid 'deriving' predicate] validDerivPred tv_set pred = case classifyPredType pred of - ClassPred cls _ -> cls `hasKey` typeableClassKey + ClassPred cls tys -> cls `hasKey` typeableClassKey -- Typeable constraints are bigger than they appear due -- to kind polymorphism, but that's OK - || check_tys + || check_tys cls tys EqPred {} -> False -- reject equality constraints _ -> True -- Non-class predicates are ok where - check_tys = hasNoDups fvs + check_tys cls tys + = hasNoDups fvs -- use sizePred to ignore implicit args && sizePred pred == fromIntegral (length fvs) && all (`elemVarSet` tv_set) fvs - - fvs = fvType pred + where tys' = filterOutInvisibleTypes (classTyCon cls) tys + fvs = fvTypes tys' {- ************************************************************************ @@ -1937,7 +1947,7 @@ sizePred ty = goClass ty go (ClassPred cls tys') | isTerminatingClass cls = 0 - | otherwise = sizeTypes tys' + | otherwise = sizeTypes (filterOutInvisibleTypes (classTyCon cls) tys') go (EqPred {}) = 0 go (IrredPred ty) = sizeType ty diff --git a/testsuite/tests/deriving/should_compile/T11833.hs b/testsuite/tests/deriving/should_compile/T11833.hs new file mode 100644 index 0000000..75d2a2d --- /dev/null +++ b/testsuite/tests/deriving/should_compile/T11833.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE PolyKinds #-} +module T11833 where + +class Category (cat :: k -> k -> *) where + catId :: cat a a + catComp :: cat b c -> cat a b -> cat a c + +newtype T (c :: * -> * -> *) a b = MkT (c a b) deriving Category diff --git a/testsuite/tests/deriving/should_compile/all.T b/testsuite/tests/deriving/should_compile/all.T index cfbb977..07242ec 100644 --- a/testsuite/tests/deriving/should_compile/all.T +++ b/testsuite/tests/deriving/should_compile/all.T @@ -69,3 +69,4 @@ test('T11357', normal, compile, ['']) test('T11732a', normal, compile, ['']) test('T11732b', normal, compile, ['']) test('T11732c', normal, compile, ['']) +test('T11833', normal, compile, ['']) From git at git.haskell.org Mon May 2 17:27:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 May 2016 17:27:23 +0000 (UTC) Subject: [commit: ghc] master: StaticPointers: Allow closed vars in the static form. (36d29f7) Message-ID: <20160502172723.912923A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/36d29f7ce332a2b1fbc36de831b0eef7a6405555/ghc >--------------------------------------------------------------- commit 36d29f7ce332a2b1fbc36de831b0eef7a6405555 Author: Facundo Dom?nguez Date: Thu Apr 7 16:20:19 2016 -0300 StaticPointers: Allow closed vars in the static form. Summary: With this patch closed variables are allowed regardless of whether they are bound at the top level or not. The FloatOut pass is always performed. When optimizations are disabled, only expressions that go to the top level are floated. Thus, the applications of the StaticPtr data constructor are always floated. The CoreTidy pass makes sure the floated applications appear in the symbol table of object files. It also collects the floated bindings and inserts them in the static pointer table. The renamer does not check anymore if free variables appearing in the static form are top-level. Instead, the typechecker looks at the tct_closed flag to decide if the free variables are closed. The linter checks that applications of StaticPtr only occur at the top of top-level bindings after the FloatOut pass. The field spInfoName of StaticPtrInfo has been removed. It used to contain the name of the top-level binding that contains the StaticPtr application. However, this information is no longer available when the StaticPtr is constructed, as the binding name is determined now by the FloatOut pass. Test Plan: ./validate Reviewers: goldfire, simonpj, austin, hvr, bgamari Reviewed By: simonpj Subscribers: thomie, mpickering, mboes Differential Revision: https://phabricator.haskell.org/D2104 GHC Trac Issues: #11656 >--------------------------------------------------------------- 36d29f7ce332a2b1fbc36de831b0eef7a6405555 compiler/coreSyn/CoreLint.hs | 69 +++++++++++- compiler/coreSyn/CoreSyn.hs | 2 +- compiler/deSugar/Coverage.hs | 2 +- compiler/deSugar/Desugar.hs | 10 +- compiler/deSugar/DsExpr.hs | 114 ++++++++----------- compiler/deSugar/DsMeta.hs | 2 +- compiler/deSugar/DsMonad.hs | 18 +-- compiler/deSugar/StaticPtrTable.hs | 97 ---------------- compiler/hsSyn/Convert.hs | 2 +- compiler/hsSyn/HsBinds.hs | 6 +- compiler/hsSyn/HsExpr.hs | 6 +- compiler/main/StaticPtrTable.hs | 125 +++++++++++++++++++++ compiler/main/TidyPgm.hs | 30 +++-- compiler/parser/Parser.y | 2 +- compiler/rename/RnExpr.hs | 24 +--- compiler/simplCore/CoreMonad.hs | 10 +- compiler/simplCore/SetLevels.hs | 12 +- compiler/simplCore/SimplCore.hs | 45 +++++++- compiler/typecheck/TcExpr.hs | 24 +++- compiler/typecheck/TcHsSyn.hs | 4 +- compiler/typecheck/TcRnTypes.hs | 3 - docs/users_guide/8.0.2-notes.rst | 23 ++++ docs/users_guide/glasgow_exts.rst | 15 ++- libraries/base/GHC/StaticPtr.hs | 26 +++-- libraries/base/changelog.md | 3 + .../tests/codeGen/should_run/CgStaticPointers.hs | 6 +- .../deSugar/should_run/DsStaticPointers.stdout | 10 +- .../should_fail/RnStaticPointersFail01.stderr | 7 +- .../rename/should_fail/RnStaticPointersFail03.hs | 8 ++ .../should_fail/RnStaticPointersFail03.stderr | 16 ++- 30 files changed, 445 insertions(+), 276 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 36d29f7ce332a2b1fbc36de831b0eef7a6405555 From git at git.haskell.org Mon May 2 20:21:38 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 May 2016 20:21:38 +0000 (UTC) Subject: [commit: ghc] master: Revert "Revert "Use __builtin_clz() to implement log_1()"" (5f8c0b8) Message-ID: <20160502202138.9631D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5f8c0b84b2b281abe4f7b44514efd80bc2e2b994/ghc >--------------------------------------------------------------- commit 5f8c0b84b2b281abe4f7b44514efd80bc2e2b994 Author: U-THEFACEBOOK\smarlow Date: Sun May 1 08:27:35 2016 +0100 Revert "Revert "Use __builtin_clz() to implement log_1()"" This reverts commit 546f24e4f8a7c086b1e5afcdda624176610cbcf8. And adds a fix for Windows: we need to use __builtin_clzll() rather than __builtin_clzl(), because StgWord is unsigned long long on Windows. >--------------------------------------------------------------- 5f8c0b84b2b281abe4f7b44514efd80bc2e2b994 rts/sm/BlockAlloc.c | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/rts/sm/BlockAlloc.c b/rts/sm/BlockAlloc.c index a633726..dc0d0ed 100644 --- a/rts/sm/BlockAlloc.c +++ b/rts/sm/BlockAlloc.c @@ -199,31 +199,47 @@ initGroup(bdescr *head) } } -// There are quicker non-loopy ways to do log_2, but we expect n to be -// usually small, and MAX_FREE_LIST is also small, so the loop version -// might well be the best choice here. +#if SIZEOF_VOID_P == SIZEOF_LONG +#define CLZW(n) (__builtin_clzl(n)) +#else +#define CLZW(n) (__builtin_clzll(n)) +#endif + +// log base 2 (floor), needs to support up to 2^MAX_FREE_LIST STATIC_INLINE nat -log_2_ceil(W_ n) +log_2(W_ n) { +#if defined(__GNUC__) + return CLZW(n) ^ (sizeof(StgWord)*8 - 1); + // generates good code on x86. __builtin_clz() compiles to bsr+xor, but + // we want just bsr, so the xor here cancels out gcc's xor. +#else W_ i, x; - x = 1; + x = n; for (i=0; i < MAX_FREE_LIST; i++) { - if (x >= n) return i; - x = x << 1; + x = x >> 1; + if (x == 0) return i; } return MAX_FREE_LIST; +#endif } +// log base 2 (ceiling), needs to support up to 2^MAX_FREE_LIST STATIC_INLINE nat -log_2(W_ n) +log_2_ceil(W_ n) { +#if defined(__GNUC__) + nat r = log_2(n); + return (n & (n-1)) ? r+1 : r; +#else W_ i, x; - x = n; + x = 1; for (i=0; i < MAX_FREE_LIST; i++) { - x = x >> 1; - if (x == 0) return i; + if (x >= n) return i; + x = x << 1; } return MAX_FREE_LIST; +#endif } STATIC_INLINE void From git at git.haskell.org Mon May 2 20:21:41 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 May 2016 20:21:41 +0000 (UTC) Subject: [commit: ghc] master: Cleanups related to MAX_FREE_LIST (ef44606) Message-ID: <20160502202141.461B33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ef44606692e731c9be45df5ee6819e0912f37a58/ghc >--------------------------------------------------------------- commit ef44606692e731c9be45df5ee6819e0912f37a58 Author: Simon Marlow Date: Mon May 2 20:26:15 2016 +0100 Cleanups related to MAX_FREE_LIST - Rename to the (more correct) NUM_FREE_LISTS - NUM_FREE_LISTS should be derived from the block and mblock sizes, not defined manually. It was actually too large by one, which caused a little bit of (benign) extra work in the form of a redundant loop iteration in some cases. - Add some ASSERTs for input preconditions to log_2() and log_2_ceil() - Fix some comments - Fix usage in allocLargeChunk, to account for the fact that log_2_ceil() can return NUM_FREE_LISTS. >--------------------------------------------------------------- ef44606692e731c9be45df5ee6819e0912f37a58 rts/sm/BlockAlloc.c | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/rts/sm/BlockAlloc.c b/rts/sm/BlockAlloc.c index dc0d0ed..a07dedb 100644 --- a/rts/sm/BlockAlloc.c +++ b/rts/sm/BlockAlloc.c @@ -145,18 +145,21 @@ static void initMBlock(void *mblock); --------------------------------------------------------------------------- */ -#define MAX_FREE_LIST 9 - -// In THREADED_RTS mode, the free list is protected by sm_mutex. - -static bdescr *free_list[MAX_FREE_LIST]; -static bdescr *free_mblock_list; - // free_list[i] contains blocks that are at least size 2^i, and at // most size 2^(i+1) - 1. // // To find the free list in which to place a block, use log_2(size). // To find a free block of the right size, use log_2_ceil(size). +// +// The largest free list (free_list[NUM_FREE_LISTS-1]) needs to contain sizes +// from half a megablock up to (but not including) a full megablock. + +#define NUM_FREE_LISTS (MBLOCK_SHIFT-BLOCK_SHIFT) + +// In THREADED_RTS mode, the free list is protected by sm_mutex. + +static bdescr *free_list[NUM_FREE_LISTS]; +static bdescr *free_mblock_list; W_ n_alloc_blocks; // currently allocated blocks W_ hw_alloc_blocks; // high-water allocated blocks @@ -168,7 +171,7 @@ W_ hw_alloc_blocks; // high-water allocated blocks void initBlockAllocator(void) { nat i; - for (i=0; i < MAX_FREE_LIST; i++) { + for (i=0; i < NUM_FREE_LISTS; i++) { free_list[i] = NULL; } free_mblock_list = NULL; @@ -205,10 +208,11 @@ initGroup(bdescr *head) #define CLZW(n) (__builtin_clzll(n)) #endif -// log base 2 (floor), needs to support up to 2^MAX_FREE_LIST +// log base 2 (floor), needs to support up to (2^NUM_FREE_LISTS)-1 STATIC_INLINE nat log_2(W_ n) { + ASSERT(n > 0 && n < (1<> 1; if (x == 0) return i; } - return MAX_FREE_LIST; + return NUM_FREE_LISTS; #endif } -// log base 2 (ceiling), needs to support up to 2^MAX_FREE_LIST +// log base 2 (ceiling), needs to support up to (2^NUM_FREE_LISTS)-1 STATIC_INLINE nat log_2_ceil(W_ n) { + ASSERT(n > 0 && n < (1< (2*1024*1024)/sizeof(W_)) { @@ -454,12 +459,12 @@ allocLargeChunk (W_ min, W_ max) } ln = log_2_ceil(min); - lnmax = log_2_ceil(max); // tops out at MAX_FREE_LIST + lnmax = log_2_ceil(max); - while (ln < lnmax && free_list[ln] == NULL) { + while (ln < NUM_FREE_LISTS && ln < lnmax && free_list[ln] == NULL) { ln++; } - if (ln == lnmax) { + if (ln == NUM_FREE_LISTS || ln == lnmax) { return allocGroup(max); } bd = free_list[ln]; @@ -795,7 +800,7 @@ checkFreeListSanity(void) min = 1; - for (ln = 0; ln < MAX_FREE_LIST; ln++) { + for (ln = 0; ln < NUM_FREE_LISTS; ln++) { IF_DEBUG(block_alloc, debugBelch("free block list [%" FMT_Word "]:\n", ln)); @@ -865,7 +870,7 @@ countFreeList(void) W_ total_blocks = 0; StgWord ln; - for (ln=0; ln < MAX_FREE_LIST; ln++) { + for (ln=0; ln < NUM_FREE_LISTS; ln++) { for (bd = free_list[ln]; bd != NULL; bd = bd->link) { total_blocks += bd->blocks; } From git at git.haskell.org Mon May 2 20:31:28 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 May 2016 20:31:28 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: RtsFlags: Make `mallocFailHook` const correct (a83304f) Message-ID: <20160502203128.BF9643A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/a83304f86dd720b2e0e829270632b8150c185667/ghc >--------------------------------------------------------------- commit a83304f86dd720b2e0e829270632b8150c185667 Author: Erik de Castro Lopo Date: Mon May 2 21:20:28 2016 +1000 RtsFlags: Make `mallocFailHook` const correct >--------------------------------------------------------------- a83304f86dd720b2e0e829270632b8150c185667 includes/RtsAPI.h | 2 +- rts/hooks/Hooks.h | 2 +- rts/hooks/MallocFail.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/RtsAPI.h b/includes/RtsAPI.h index 16b8486..a4a094f 100644 --- a/includes/RtsAPI.h +++ b/includes/RtsAPI.h @@ -90,7 +90,7 @@ typedef struct { void (* outOfHeapHook) (W_ request_size, W_ heap_size); // Called when malloc() fails, before exiting - void (* mallocFailHook) (W_ request_size /* in bytes */, char *msg); + void (* mallocFailHook) (W_ request_size /* in bytes */, const char *msg); // Called for every GC void (* gcDoneHook) (unsigned int gen, diff --git a/rts/hooks/Hooks.h b/rts/hooks/Hooks.h index 35a6011..1383ccd 100644 --- a/rts/hooks/Hooks.h +++ b/rts/hooks/Hooks.h @@ -21,7 +21,7 @@ extern char *ghc_rts_opts; extern void OnExitHook (void); extern void StackOverflowHook (W_ stack_size); extern void OutOfHeapHook (W_ request_size, W_ heap_size); -extern void MallocFailHook (W_ request_size /* in bytes */, char *msg); +extern void MallocFailHook (W_ request_size /* in bytes */, const char *msg); extern void FlagDefaultsHook (void); #include "EndPrivate.h" diff --git a/rts/hooks/MallocFail.c b/rts/hooks/MallocFail.c index 63343a7..42606b6 100644 --- a/rts/hooks/MallocFail.c +++ b/rts/hooks/MallocFail.c @@ -11,7 +11,7 @@ #include void -MallocFailHook (W_ request_size /* in bytes */, char *msg) +MallocFailHook (W_ request_size /* in bytes */, const char *msg) { fprintf(stderr, "malloc: failed on request for %" FMT_Word " bytes; message: %s\n", request_size, msg); } From git at git.haskell.org Mon May 2 20:31:31 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 May 2016 20:31:31 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: rts/ProfHeap.c: Use `size_t` instead of `long`. (def125e) Message-ID: <20160502203131.7B01F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/def125e556a4289c1300c496fb5caaf7100571c4/ghc >--------------------------------------------------------------- commit def125e556a4289c1300c496fb5caaf7100571c4 Author: Erik de Castro Lopo Date: Mon May 2 20:22:00 2016 +1000 rts/ProfHeap.c: Use `size_t` instead of `long`. On x64 Windows `sizeof long` is 4 which could easily overflow resulting in incorrect heap profiling results. This change does not affect either Linux or OS X where `sizeof long` == `sizeof size_t` regardless of machine word size. >--------------------------------------------------------------- def125e556a4289c1300c496fb5caaf7100571c4 rts/ProfHeap.c | 44 +++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/rts/ProfHeap.c b/rts/ProfHeap.c index 875cc7e..06d9602 100644 --- a/rts/ProfHeap.c +++ b/rts/ProfHeap.c @@ -50,13 +50,13 @@ static uint32_t max_era; typedef struct _counter { void *identity; union { - uint32_t resid; + size_t resid; struct { - long prim; // total size of 'inherently used' closures - long not_used; // total size of 'never used' closures - long used; // total size of 'used at least once' closures - long void_total; // current total size of 'destroyed without being used' closures - long drag_total; // current total size of 'used at least once and waiting to die' + size_t prim; // total size of 'inherently used' closures + size_t not_used; // total size of 'never used' closures + size_t used; // total size of 'used at least once' closures + size_t void_total; // current total size of 'destroyed without being used' closures + size_t drag_total; // current total size of 'used at least once and waiting to die' } ldv; } c; struct _counter *next; @@ -79,11 +79,11 @@ typedef struct { Arena * arena; // for LDV profiling, when just displaying by LDV - long prim; - long not_used; - long used; - long void_total; - long drag_total; + size_t prim; + size_t not_used; + size_t used; + size_t void_total; + size_t drag_total; } Census; static Census *censuses = NULL; @@ -193,14 +193,14 @@ LDV_recordDead( StgClosure *c, uint32_t size ) t = (LDVW((c)) & LDV_CREATE_MASK) >> LDV_SHIFT; if (t < era) { if (RtsFlags.ProfFlags.bioSelector == NULL) { - censuses[t].void_total += (long)size; - censuses[era].void_total -= (long)size; + censuses[t].void_total += size; + censuses[era].void_total -= size; ASSERT(censuses[t].void_total < censuses[t].not_used); } else { id = closureIdentity(c); ctr = lookupHashTable(censuses[t].hash, (StgWord)id); ASSERT( ctr != NULL ); - ctr->c.ldv.void_total += (long)size; + ctr->c.ldv.void_total += size; ctr = lookupHashTable(censuses[era].hash, (StgWord)id); if (ctr == NULL) { ctr = arenaAlloc(censuses[era].arena, sizeof(counter)); @@ -210,7 +210,7 @@ LDV_recordDead( StgClosure *c, uint32_t size ) ctr->next = censuses[era].ctrs; censuses[era].ctrs = ctr; } - ctr->c.ldv.void_total -= (long)size; + ctr->c.ldv.void_total -= size; } } } else { @@ -224,7 +224,7 @@ LDV_recordDead( StgClosure *c, uint32_t size ) id = closureIdentity(c); ctr = lookupHashTable(censuses[t+1].hash, (StgWord)id); ASSERT( ctr != NULL ); - ctr->c.ldv.drag_total += (long)size; + ctr->c.ldv.drag_total += size; ctr = lookupHashTable(censuses[era].hash, (StgWord)id); if (ctr == NULL) { ctr = arenaAlloc(censuses[era].arena, sizeof(counter)); @@ -234,7 +234,7 @@ LDV_recordDead( StgClosure *c, uint32_t size ) ctr->next = censuses[era].ctrs; censuses[era].ctrs = ctr; } - ctr->c.ldv.drag_total -= (long)size; + ctr->c.ldv.drag_total -= size; } } } @@ -739,7 +739,7 @@ static void dumpCensus( Census *census ) { counter *ctr; - long count; + size_t count; printSample(rtsTrue, census->time); @@ -778,8 +778,6 @@ dumpCensus( Census *census ) count = ctr->c.resid; } - ASSERT( count >= 0 ); - if (count == 0) continue; #if !defined(PROFILING) @@ -835,7 +833,7 @@ dumpCensus( Census *census ) } -static void heapProfObject(Census *census, StgClosure *p, uint32_t size, +static void heapProfObject(Census *census, StgClosure *p, size_t size, rtsBool prim #ifndef PROFILING STG_UNUSED @@ -843,7 +841,7 @@ static void heapProfObject(Census *census, StgClosure *p, uint32_t size, ) { void *identity; - uint32_t real_size; + size_t real_size; counter *ctr; identity = NULL; @@ -920,7 +918,7 @@ heapCensusChain( Census *census, bdescr *bd ) { StgPtr p; StgInfoTable *info; - uint32_t size; + size_t size; rtsBool prim; for (; bd != NULL; bd = bd->link) { From git at git.haskell.org Mon May 2 20:31:34 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 May 2016 20:31:34 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: RtsUtils: Use `size_t` instead of `int` where appropriate (d862fbf) Message-ID: <20160502203134.3BFD73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/d862fbf6de6d654383d930481777426fa49248d5/ghc >--------------------------------------------------------------- commit d862fbf6de6d654383d930481777426fa49248d5 Author: Erik de Castro Lopo Date: Mon May 2 20:07:05 2016 +1000 RtsUtils: Use `size_t` instead of `int` where appropriate Functions like `stgMallocBytes` take a size parameter which was of type `int`, but is commonly used as `stgMallocBytes (sizeof (...))`. This is problematic because the `sizeof` operator returns `size_t` so that on 64 bit systems, in this common use case the `size_t` parameter would be truncated to 32 bits when passed to `stgMallocBytes` where it was cast back to `size_t`. >--------------------------------------------------------------- d862fbf6de6d654383d930481777426fa49248d5 rts/RtsUtils.c | 22 +++++++++------------- rts/RtsUtils.h | 6 +++--- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/rts/RtsUtils.c b/rts/RtsUtils.c index c837143..716d203 100644 --- a/rts/RtsUtils.c +++ b/rts/RtsUtils.c @@ -57,13 +57,11 @@ extern char *ctime_r(const time_t *, char *); -------------------------------------------------------------------------- */ void * -stgMallocBytes (int n, char *msg) +stgMallocBytes (size_t n, char *msg) { - char *space; - size_t n2; + void *space; - n2 = (size_t) n; - if ((space = (char *) malloc(n2)) == NULL) { + if ((space = malloc(n)) == NULL) { /* Quoting POSIX.1-2008 (which says more or less the same as ISO C99): * * "Upon successful completion with size not equal to 0, malloc() shall @@ -85,13 +83,11 @@ stgMallocBytes (int n, char *msg) } void * -stgReallocBytes (void *p, int n, char *msg) +stgReallocBytes (void *p, size_t n, char *msg) { - char *space; - size_t n2; + void *space; - n2 = (size_t) n; - if ((space = (char *) realloc(p, (size_t) n2)) == NULL) { + if ((space = realloc(p, n)) == NULL) { /* don't fflush(stdout); WORKAROUND bug in Linux glibc */ rtsConfig.mallocFailHook((W_) n, msg); /*msg*/ stg_exit(EXIT_INTERNAL_ERROR); @@ -100,11 +96,11 @@ stgReallocBytes (void *p, int n, char *msg) } void * -stgCallocBytes (int n, int m, char *msg) +stgCallocBytes (size_t n, size_t m, char *msg) { - char *space; + void *space; - if ((space = (char *) calloc((size_t) n, (size_t) m)) == NULL) { + if ((space = calloc(n, m)) == NULL) { /* don't fflush(stdout); WORKAROUND bug in Linux glibc */ rtsConfig.mallocFailHook((W_) n*m, msg); /*msg*/ stg_exit(EXIT_INTERNAL_ERROR); diff --git a/rts/RtsUtils.h b/rts/RtsUtils.h index d76c921..2d5e5de 100644 --- a/rts/RtsUtils.h +++ b/rts/RtsUtils.h @@ -18,12 +18,12 @@ void initAllocator(void); void shutdownAllocator(void); -void *stgMallocBytes(int n, char *msg) +void *stgMallocBytes(size_t n, char *msg) GNUC3_ATTRIBUTE(__malloc__); -void *stgReallocBytes(void *p, int n, char *msg); +void *stgReallocBytes(void *p, size_t n, char *msg); -void *stgCallocBytes(int n, int m, char *msg) +void *stgCallocBytes(size_t n, size_t m, char *msg) GNUC3_ATTRIBUTE(__malloc__); char *stgStrndup(const char *s, size_t n); From git at git.haskell.org Mon May 2 23:23:32 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 May 2016 23:23:32 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: rts: Replace `nat` with `uint32_t` (63599c6) Message-ID: <20160502232332.1A8503A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/63599c6aeece46f5722340337d85a417de094c83/ghc >--------------------------------------------------------------- commit 63599c6aeece46f5722340337d85a417de094c83 Author: Erik de Castro Lopo Date: Mon May 2 06:37:14 2016 +1000 rts: Replace `nat` with `uint32_t` Summary: The `nat` type was an alias for `unsigned int` with a comment saying it was at least 32 bits. We keep the typedef in case client code is using it but mark it as deprecated. Test Plan: Validated on Linux, OS X and Windows Reviewers: simonmar, austin, thomie, hvr, bgamari, hsyl20 Differential Revision: https://phabricator.haskell.org/D2166 >--------------------------------------------------------------- 63599c6aeece46f5722340337d85a417de094c83 includes/rts/Flags.h | 48 +++++++++++------------ includes/rts/IOManager.h | 2 +- includes/rts/OSThreads.h | 4 +- includes/rts/SpinLock.h | 4 +- includes/rts/Threads.h | 4 +- includes/rts/Types.h | 3 +- includes/rts/prof/CCS.h | 2 +- includes/rts/storage/Block.h | 4 +- includes/rts/storage/ClosureMacros.h | 36 ++++++++--------- includes/rts/storage/GC.h | 8 ++-- includes/rts/storage/MBlock.h | 4 +- includes/rts/storage/SMPClosureOps.h | 2 +- rts/Adjustor.c | 4 +- rts/Arena.c | 4 +- rts/Capability.c | 35 +++++++++-------- rts/Capability.h | 23 +++++------ rts/CheckUnload.c | 4 +- rts/Disassembler.c | 10 ++--- rts/Globals.c | 4 +- rts/Hpc.c | 10 ++--- rts/Interpreter.c | 16 ++++---- rts/LdvProfile.c | 8 ++-- rts/LdvProfile.h | 2 +- rts/LibdwPool.c | 2 +- rts/Linker.c | 10 ++--- rts/Messages.c | 6 +-- rts/Messages.h | 2 +- rts/Pool.c | 22 +++++------ rts/Pool.h | 10 ++--- rts/Printer.c | 14 ++++--- rts/ProfHeap.c | 30 +++++++------- rts/ProfHeap.h | 2 +- rts/Profiling.c | 51 ++++++++++++------------ rts/Proftimer.c | 4 +- rts/RaiseAsync.c | 12 +++--- rts/RaiseAsync.h | 2 +- rts/RetainerProfile.c | 72 +++++++++++++++++----------------- rts/RetainerSet.c | 28 ++++++------- rts/RetainerSet.h | 8 ++-- rts/RtsFlags.c | 21 +++++----- rts/RtsStartup.c | 2 +- rts/Schedule.c | 57 ++++++++++++++------------- rts/Sparks.c | 6 +-- rts/Stable.c | 12 +++--- rts/Stats.c | 28 ++++++------- rts/Stats.h | 10 ++--- rts/Task.c | 13 +++--- rts/Task.h | 10 ++--- rts/ThreadPaused.c | 18 ++++----- rts/Threads.c | 8 ++-- rts/Trace.c | 8 ++-- rts/Trace.h | 24 ++++++------ rts/WSDeque.c | 2 +- rts/WSDeque.h | 2 +- rts/Weak.c | 2 +- rts/eventlog/EventLog.c | 30 +++++++------- rts/eventlog/EventLog.h | 8 ++-- rts/posix/GetTime.c | 2 +- rts/posix/OSMem.c | 4 +- rts/posix/OSThreads.c | 28 ++++++------- rts/posix/Signals.c | 4 +- rts/sm/BlockAlloc.c | 18 ++++----- rts/sm/BlockAlloc.h | 2 +- rts/sm/Compact.h | 6 +-- rts/sm/Evac.c | 24 ++++++------ rts/sm/GC.c | 74 +++++++++++++++++------------------ rts/sm/GC.h | 8 ++-- rts/sm/GCThread.h | 8 ++-- rts/sm/GCUtils.c | 16 ++++---- rts/sm/GCUtils.h | 8 ++-- rts/sm/HeapAlloc.h | 4 +- rts/sm/MBlock.c | 46 +++++++++++----------- rts/sm/MarkWeak.c | 10 ++--- rts/sm/OSMem.h | 4 +- rts/sm/Sanity.c | 52 ++++++++++++------------ rts/sm/Scav.c | 18 ++++----- rts/sm/Storage.c | 38 +++++++++--------- rts/sm/Storage.h | 10 ++--- rts/sm/Sweep.c | 2 +- rts/win32/AwaitEvent.c | 2 +- rts/win32/OSMem.c | 8 ++-- rts/win32/OSThreads.c | 10 ++--- rts/win32/ThrIOManager.c | 2 +- testsuite/tests/rts/testblockalloc.c | 2 +- testsuite/tests/rts/testheapalloced.c | 2 +- testsuite/tests/rts/testmblockalloc.c | 2 +- testsuite/tests/rts/testwsdeque.c | 14 +++---- 87 files changed, 608 insertions(+), 597 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 63599c6aeece46f5722340337d85a417de094c83 From git at git.haskell.org Mon May 2 23:23:34 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 May 2016 23:23:34 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: rts/ProfHeap.c: Use `size_t` instead of `long`. (978c8dc) Message-ID: <20160502232334.C70D63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/978c8dcfc9d9c5d4138a4478c23aae2ead040d37/ghc >--------------------------------------------------------------- commit 978c8dcfc9d9c5d4138a4478c23aae2ead040d37 Author: Erik de Castro Lopo Date: Mon May 2 20:22:00 2016 +1000 rts/ProfHeap.c: Use `size_t` instead of `long`. On x64 Windows `sizeof long` is 4 which could easily overflow resulting in incorrect heap profiling results. This change does not affect either Linux or OS X where `sizeof long` == `sizeof size_t` regardless of machine word size. >--------------------------------------------------------------- 978c8dcfc9d9c5d4138a4478c23aae2ead040d37 rts/ProfHeap.c | 44 +++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/rts/ProfHeap.c b/rts/ProfHeap.c index 875cc7e..06d9602 100644 --- a/rts/ProfHeap.c +++ b/rts/ProfHeap.c @@ -50,13 +50,13 @@ static uint32_t max_era; typedef struct _counter { void *identity; union { - uint32_t resid; + size_t resid; struct { - long prim; // total size of 'inherently used' closures - long not_used; // total size of 'never used' closures - long used; // total size of 'used at least once' closures - long void_total; // current total size of 'destroyed without being used' closures - long drag_total; // current total size of 'used at least once and waiting to die' + size_t prim; // total size of 'inherently used' closures + size_t not_used; // total size of 'never used' closures + size_t used; // total size of 'used at least once' closures + size_t void_total; // current total size of 'destroyed without being used' closures + size_t drag_total; // current total size of 'used at least once and waiting to die' } ldv; } c; struct _counter *next; @@ -79,11 +79,11 @@ typedef struct { Arena * arena; // for LDV profiling, when just displaying by LDV - long prim; - long not_used; - long used; - long void_total; - long drag_total; + size_t prim; + size_t not_used; + size_t used; + size_t void_total; + size_t drag_total; } Census; static Census *censuses = NULL; @@ -193,14 +193,14 @@ LDV_recordDead( StgClosure *c, uint32_t size ) t = (LDVW((c)) & LDV_CREATE_MASK) >> LDV_SHIFT; if (t < era) { if (RtsFlags.ProfFlags.bioSelector == NULL) { - censuses[t].void_total += (long)size; - censuses[era].void_total -= (long)size; + censuses[t].void_total += size; + censuses[era].void_total -= size; ASSERT(censuses[t].void_total < censuses[t].not_used); } else { id = closureIdentity(c); ctr = lookupHashTable(censuses[t].hash, (StgWord)id); ASSERT( ctr != NULL ); - ctr->c.ldv.void_total += (long)size; + ctr->c.ldv.void_total += size; ctr = lookupHashTable(censuses[era].hash, (StgWord)id); if (ctr == NULL) { ctr = arenaAlloc(censuses[era].arena, sizeof(counter)); @@ -210,7 +210,7 @@ LDV_recordDead( StgClosure *c, uint32_t size ) ctr->next = censuses[era].ctrs; censuses[era].ctrs = ctr; } - ctr->c.ldv.void_total -= (long)size; + ctr->c.ldv.void_total -= size; } } } else { @@ -224,7 +224,7 @@ LDV_recordDead( StgClosure *c, uint32_t size ) id = closureIdentity(c); ctr = lookupHashTable(censuses[t+1].hash, (StgWord)id); ASSERT( ctr != NULL ); - ctr->c.ldv.drag_total += (long)size; + ctr->c.ldv.drag_total += size; ctr = lookupHashTable(censuses[era].hash, (StgWord)id); if (ctr == NULL) { ctr = arenaAlloc(censuses[era].arena, sizeof(counter)); @@ -234,7 +234,7 @@ LDV_recordDead( StgClosure *c, uint32_t size ) ctr->next = censuses[era].ctrs; censuses[era].ctrs = ctr; } - ctr->c.ldv.drag_total -= (long)size; + ctr->c.ldv.drag_total -= size; } } } @@ -739,7 +739,7 @@ static void dumpCensus( Census *census ) { counter *ctr; - long count; + size_t count; printSample(rtsTrue, census->time); @@ -778,8 +778,6 @@ dumpCensus( Census *census ) count = ctr->c.resid; } - ASSERT( count >= 0 ); - if (count == 0) continue; #if !defined(PROFILING) @@ -835,7 +833,7 @@ dumpCensus( Census *census ) } -static void heapProfObject(Census *census, StgClosure *p, uint32_t size, +static void heapProfObject(Census *census, StgClosure *p, size_t size, rtsBool prim #ifndef PROFILING STG_UNUSED @@ -843,7 +841,7 @@ static void heapProfObject(Census *census, StgClosure *p, uint32_t size, ) { void *identity; - uint32_t real_size; + size_t real_size; counter *ctr; identity = NULL; @@ -920,7 +918,7 @@ heapCensusChain( Census *census, bdescr *bd ) { StgPtr p; StgInfoTable *info; - uint32_t size; + size_t size; rtsBool prim; for (; bd != NULL; bd = bd->link) { From git at git.haskell.org Mon May 2 23:23:37 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 May 2016 23:23:37 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: RtsUtils: Use `size_t` instead of `int` where appropriate (5d64280) Message-ID: <20160502232337.845673A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/5d6428099b3e3d026d378b74659e98a8232c272c/ghc >--------------------------------------------------------------- commit 5d6428099b3e3d026d378b74659e98a8232c272c Author: Erik de Castro Lopo Date: Mon May 2 20:07:05 2016 +1000 RtsUtils: Use `size_t` instead of `int` where appropriate Functions like `stgMallocBytes` take a size parameter which was of type `int`, but is commonly used as `stgMallocBytes (sizeof (...))`. This is problematic because the `sizeof` operator returns `size_t` so that on 64 bit systems, in this common use case the `size_t` parameter would be truncated to 32 bits when passed to `stgMallocBytes` where it was cast back to `size_t`. >--------------------------------------------------------------- 5d6428099b3e3d026d378b74659e98a8232c272c rts/RtsUtils.c | 22 +++++++++------------- rts/RtsUtils.h | 6 +++--- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/rts/RtsUtils.c b/rts/RtsUtils.c index c837143..716d203 100644 --- a/rts/RtsUtils.c +++ b/rts/RtsUtils.c @@ -57,13 +57,11 @@ extern char *ctime_r(const time_t *, char *); -------------------------------------------------------------------------- */ void * -stgMallocBytes (int n, char *msg) +stgMallocBytes (size_t n, char *msg) { - char *space; - size_t n2; + void *space; - n2 = (size_t) n; - if ((space = (char *) malloc(n2)) == NULL) { + if ((space = malloc(n)) == NULL) { /* Quoting POSIX.1-2008 (which says more or less the same as ISO C99): * * "Upon successful completion with size not equal to 0, malloc() shall @@ -85,13 +83,11 @@ stgMallocBytes (int n, char *msg) } void * -stgReallocBytes (void *p, int n, char *msg) +stgReallocBytes (void *p, size_t n, char *msg) { - char *space; - size_t n2; + void *space; - n2 = (size_t) n; - if ((space = (char *) realloc(p, (size_t) n2)) == NULL) { + if ((space = realloc(p, n)) == NULL) { /* don't fflush(stdout); WORKAROUND bug in Linux glibc */ rtsConfig.mallocFailHook((W_) n, msg); /*msg*/ stg_exit(EXIT_INTERNAL_ERROR); @@ -100,11 +96,11 @@ stgReallocBytes (void *p, int n, char *msg) } void * -stgCallocBytes (int n, int m, char *msg) +stgCallocBytes (size_t n, size_t m, char *msg) { - char *space; + void *space; - if ((space = (char *) calloc((size_t) n, (size_t) m)) == NULL) { + if ((space = calloc(n, m)) == NULL) { /* don't fflush(stdout); WORKAROUND bug in Linux glibc */ rtsConfig.mallocFailHook((W_) n*m, msg); /*msg*/ stg_exit(EXIT_INTERNAL_ERROR); diff --git a/rts/RtsUtils.h b/rts/RtsUtils.h index d76c921..2d5e5de 100644 --- a/rts/RtsUtils.h +++ b/rts/RtsUtils.h @@ -18,12 +18,12 @@ void initAllocator(void); void shutdownAllocator(void); -void *stgMallocBytes(int n, char *msg) +void *stgMallocBytes(size_t n, char *msg) GNUC3_ATTRIBUTE(__malloc__); -void *stgReallocBytes(void *p, int n, char *msg); +void *stgReallocBytes(void *p, size_t n, char *msg); -void *stgCallocBytes(int n, int m, char *msg) +void *stgCallocBytes(size_t n, size_t m, char *msg) GNUC3_ATTRIBUTE(__malloc__); char *stgStrndup(const char *s, size_t n); From git at git.haskell.org Mon May 2 23:23:40 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 May 2016 23:23:40 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: RtsFlags: Make `mallocFailHook` const correct (8d42d24) Message-ID: <20160502232340.365343A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/8d42d24f8421a15a2305531d1b12e0b83a4b0ac5/ghc >--------------------------------------------------------------- commit 8d42d24f8421a15a2305531d1b12e0b83a4b0ac5 Author: Erik de Castro Lopo Date: Mon May 2 21:20:28 2016 +1000 RtsFlags: Make `mallocFailHook` const correct >--------------------------------------------------------------- 8d42d24f8421a15a2305531d1b12e0b83a4b0ac5 includes/RtsAPI.h | 2 +- rts/hooks/Hooks.h | 2 +- rts/hooks/MallocFail.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/RtsAPI.h b/includes/RtsAPI.h index 16b8486..a4a094f 100644 --- a/includes/RtsAPI.h +++ b/includes/RtsAPI.h @@ -90,7 +90,7 @@ typedef struct { void (* outOfHeapHook) (W_ request_size, W_ heap_size); // Called when malloc() fails, before exiting - void (* mallocFailHook) (W_ request_size /* in bytes */, char *msg); + void (* mallocFailHook) (W_ request_size /* in bytes */, const char *msg); // Called for every GC void (* gcDoneHook) (unsigned int gen, diff --git a/rts/hooks/Hooks.h b/rts/hooks/Hooks.h index 35a6011..1383ccd 100644 --- a/rts/hooks/Hooks.h +++ b/rts/hooks/Hooks.h @@ -21,7 +21,7 @@ extern char *ghc_rts_opts; extern void OnExitHook (void); extern void StackOverflowHook (W_ stack_size); extern void OutOfHeapHook (W_ request_size, W_ heap_size); -extern void MallocFailHook (W_ request_size /* in bytes */, char *msg); +extern void MallocFailHook (W_ request_size /* in bytes */, const char *msg); extern void FlagDefaultsHook (void); #include "EndPrivate.h" diff --git a/rts/hooks/MallocFail.c b/rts/hooks/MallocFail.c index 63343a7..42606b6 100644 --- a/rts/hooks/MallocFail.c +++ b/rts/hooks/MallocFail.c @@ -11,7 +11,7 @@ #include void -MallocFailHook (W_ request_size /* in bytes */, char *msg) +MallocFailHook (W_ request_size /* in bytes */, const char *msg) { fprintf(stderr, "malloc: failed on request for %" FMT_Word " bytes; message: %s\n", request_size, msg); } From git at git.haskell.org Mon May 2 23:23:42 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 2 May 2016 23:23:42 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat's head updated: RtsFlags: Make `mallocFailHook` const correct (8d42d24) Message-ID: <20160502232342.7DA183A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/erikd/remove-nat' now includes: fa86ac7 Make validDerivPred ignore non-visible arguments to a class type constructor 36d29f7 StaticPointers: Allow closed vars in the static form. 5f8c0b8 Revert "Revert "Use __builtin_clz() to implement log_1()"" ef44606 Cleanups related to MAX_FREE_LIST 63599c6 rts: Replace `nat` with `uint32_t` 978c8dc rts/ProfHeap.c: Use `size_t` instead of `long`. 5d64280 RtsUtils: Use `size_t` instead of `int` where appropriate 8d42d24 RtsFlags: Make `mallocFailHook` const correct From git at git.haskell.org Tue May 3 16:26:10 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 16:26:10 +0000 (UTC) Subject: [commit: packages/hpc] master: Updated tested-with in cabal file (144d537) Message-ID: <20160503162611.00F893A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hpc On branch : master Link : http://git.haskell.org/packages/hpc.git/commitdiff/144d5374499143dd742d8e7ba12e65225d810224 >--------------------------------------------------------------- commit 144d5374499143dd742d8e7ba12e65225d810224 Author: Herbert Valerio Riedel Date: Tue May 3 17:33:51 2016 +0200 Updated tested-with in cabal file >--------------------------------------------------------------- 144d5374499143dd742d8e7ba12e65225d810224 hpc.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hpc.cabal b/hpc.cabal index 240b5d6..7e77973 100644 --- a/hpc.cabal +++ b/hpc.cabal @@ -10,7 +10,7 @@ category: Control synopsis: Code Coverage Library for Haskell build-type: Simple cabal-version:>=1.10 -tested-with: GHC==7.10.*, GHC==7.8.*, GHC==7.6.*, GHC==7.4.*, GHC==7.2.2 +tested-with: GHC==8.0.*, GHC==7.10.*, GHC==7.8.*, GHC==7.6.*, GHC==7.4.*, GHC==7.2.2 description: This package provides the code coverage library for Haskell. . From git at git.haskell.org Tue May 3 16:26:13 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 16:26:13 +0000 (UTC) Subject: [commit: packages/hpc] master: Update release month (c6e6e75) Message-ID: <20160503162613.057EC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hpc On branch : master Link : http://git.haskell.org/packages/hpc.git/commitdiff/c6e6e7547ed4c29d9d8e380b3f17a89ef2b4189d >--------------------------------------------------------------- commit c6e6e7547ed4c29d9d8e380b3f17a89ef2b4189d Author: Herbert Valerio Riedel Date: Tue May 3 17:23:47 2016 +0200 Update release month >--------------------------------------------------------------- c6e6e7547ed4c29d9d8e380b3f17a89ef2b4189d changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index 3659b30..cb96ecb 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,6 @@ # Changelog for [`hpc` package](http://hackage.haskell.org/package/hpc) -## 0.6.0.3 *Jan 2016* +## 0.6.0.3 *May 2016* * Bundled with GHC 8.0.1 From git at git.haskell.org Tue May 3 16:26:15 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 16:26:15 +0000 (UTC) Subject: [commit: packages/hpc] master: Fix compilation with GHC < 7.6 (88b389f) Message-ID: <20160503162615.0B0183A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hpc On branch : master Link : http://git.haskell.org/packages/hpc.git/commitdiff/88b389f368d1222078ee9592236b107d061cd5f2 >--------------------------------------------------------------- commit 88b389f368d1222078ee9592236b107d061cd5f2 Author: Herbert Valerio Riedel Date: Tue May 3 17:34:31 2016 +0200 Fix compilation with GHC < 7.6 >--------------------------------------------------------------- 88b389f368d1222078ee9592236b107d061cd5f2 Trace/Hpc/Mix.hs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Trace/Hpc/Mix.hs b/Trace/Hpc/Mix.hs index 2066284..709e70c 100644 --- a/Trace/Hpc/Mix.hs +++ b/Trace/Hpc/Mix.hs @@ -26,18 +26,14 @@ import Data.List import Data.Maybe (catMaybes, fromMaybe) import Data.Time (UTCTime) import Data.Tree - -import System.FilePath - #if MIN_VERSION_base(4,6,0) import Text.Read (readMaybe) #else -readMaybe :: Read a => String -> Maybe a -readMaybe s = case reads s of - [(x, s')] | all isSpace s' -> Just x - _ -> Nothing +import Data.Char (isSpace) #endif +import System.FilePath + -- a module index records the attributes of each tick-box that has -- been introduced in that module, accessed by tick-number position -- in the list @@ -45,6 +41,13 @@ readMaybe s = case reads s of import Trace.Hpc.Util (HpcPos, insideHpcPos, Hash, HpcHash(..), catchIO) import Trace.Hpc.Tix +#if !MIN_VERSION_base(4,6,0) +readMaybe :: Read a => String -> Maybe a +readMaybe s = case reads s of + [(x, s')] | all isSpace s' -> Just x + _ -> Nothing +#endif + -- | 'Mix' is the information about a modules static properties, like -- location of Tix's in a file. -- From git at git.haskell.org Tue May 3 19:24:25 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 19:24:25 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: deriveConstants: Fix nm-classic error message (ec5ddb6) Message-ID: <20160503192425.568AD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/ec5ddb64558ae8b039d24f10a1d33cf5716d6777/ghc >--------------------------------------------------------------- commit ec5ddb64558ae8b039d24f10a1d33cf5716d6777 Author: Ben Gamari Date: Sun Apr 24 11:31:51 2016 +0200 deriveConstants: Fix nm-classic error message Thanks to George Colpitts for the suggestion. (cherry picked from commit 28503fe984dbc00f687f0579967d583eebb9afcb) >--------------------------------------------------------------- ec5ddb64558ae8b039d24f10a1d33cf5716d6777 utils/deriveConstants/Main.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/utils/deriveConstants/Main.hs b/utils/deriveConstants/Main.hs index 96da166..6a050d3 100644 --- a/utils/deriveConstants/Main.hs +++ b/utils/deriveConstants/Main.hs @@ -691,7 +691,10 @@ getWanted verbose os tmpdir gccProgram gccFlags nmProgram mobjdumpProgram Just 292 -> return () -- OK Nothing -> die "CONTROL_GROUP_CONST_291 missing!" Just 0x292 -> die $ "broken 'nm' detected, see https://ghc.haskell.org/ticket/11744.\n" - ++ "Workaround: You may want to pass '--with-nm=nm-classic' to 'configure'." + ++ "\n" + ++ "Workaround: You may want to pass\n" + ++ " --with-nm=$(xcode-select -p)/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm-classic\n" + ++ "to 'configure'.\n" Just x -> die ("unexpected value round-tripped for CONTROL_GROUP_CONST_291: " ++ show x) rs <- mapM (lookupResult m) (wanteds os) From git at git.haskell.org Tue May 3 19:24:28 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 19:24:28 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Document -fmax-pmcheck-iterations a bit better (d90a177) Message-ID: <20160503192428.151383A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/d90a177a9f95cc1bdfb5ebeae0f3bb7d6237fb26/ghc >--------------------------------------------------------------- commit d90a177a9f95cc1bdfb5ebeae0f3bb7d6237fb26 Author: Ben Gamari Date: Wed Apr 27 09:57:41 2016 +0200 Document -fmax-pmcheck-iterations a bit better (cherry picked from commit 5adf8f3b74a4ee11d594b9993493bed4e3521ce2) >--------------------------------------------------------------- d90a177a9f95cc1bdfb5ebeae0f3bb7d6237fb26 docs/users_guide/8.0.1-notes.rst | 2 +- docs/users_guide/using-warnings.rst | 12 ++++++++++++ utils/mkUserGuidePart/Options/Warnings.hs | 5 +++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/docs/users_guide/8.0.1-notes.rst b/docs/users_guide/8.0.1-notes.rst index f627a6f..5f88037 100644 --- a/docs/users_guide/8.0.1-notes.rst +++ b/docs/users_guide/8.0.1-notes.rst @@ -344,7 +344,7 @@ Compiler the pattern match checker iterates. Since coverage checking is exponential in the general case, setting a default number of iterations prevents memory and performance blowups. By default, the number of iterations is set to - 10000000 but it can be set to ``n`` with: ``-fmax-pmcheck-iterations=n``. + 2000000 but it can be set with: ``-fmax-pmcheck-iterations=``. If the set number of iterations is exceeded, an informative warning is issued. diff --git a/docs/users_guide/using-warnings.rst b/docs/users_guide/using-warnings.rst index 16c6585..892be26 100644 --- a/docs/users_guide/using-warnings.rst +++ b/docs/users_guide/using-warnings.rst @@ -516,6 +516,18 @@ of ``-W(no-)*``. h = \[] -> 2 Just k = f y +.. ghc-flag:: -fmax-pmcheck-iterations= + + :default: 2000000 + + Sets how many iterations of the pattern-match checker will perform before + giving up. This limit is to catch cases where pattern-match checking might + be excessively costly (due to the exponential complexity of coverage + checking in the general case). It typically shouldn't be necessary to set + this unless GHC informs you that it has exceeded the pattern match checker's + iteration limit (in which case you may want to consider refactoring your + pattern match, for the sake of future readers of your code. + .. ghc-flag:: -Wincomplete-record-updates .. index:: diff --git a/utils/mkUserGuidePart/Options/Warnings.hs b/utils/mkUserGuidePart/Options/Warnings.hs index 3552172..31513d9 100644 --- a/utils/mkUserGuidePart/Options/Warnings.hs +++ b/utils/mkUserGuidePart/Options/Warnings.hs @@ -117,6 +117,11 @@ warningsOptions = , flagType = DynamicFlag , flagReverse = "-Wno-incomplete-uni-patterns" } + , flag { flagName = "-Wmax-pmcheck-iterations=" + , flagDescription = + "the iteration limit for the pattern match checker" + , flagType = DynamicFlag + } , flag { flagName = "-Wincomplete-record-updates" , flagDescription = "warn when a record update could fail" , flagType = DynamicFlag From git at git.haskell.org Tue May 3 19:24:30 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 19:24:30 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Recommend more reliable recourse for broken nm (91eeb12) Message-ID: <20160503192430.BC2C13A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/91eeb121ff23ed657876137a657994a2f986c321/ghc >--------------------------------------------------------------- commit 91eeb121ff23ed657876137a657994a2f986c321 Author: Ben Gamari Date: Thu Apr 28 10:11:13 2016 +0200 Recommend more reliable recourse for broken nm xcrun --find seems like the appropriate choice here. Thanks to Brandon Allbery for suggesting this. (cherry picked from commit a0e10510c64182c7126ff426127ea8fd78c07d00) >--------------------------------------------------------------- 91eeb121ff23ed657876137a657994a2f986c321 docs/users_guide/8.0.1-notes.rst | 3 +-- utils/deriveConstants/Main.hs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/users_guide/8.0.1-notes.rst b/docs/users_guide/8.0.1-notes.rst index 5f88037..aa120f7 100644 --- a/docs/users_guide/8.0.1-notes.rst +++ b/docs/users_guide/8.0.1-notes.rst @@ -24,8 +24,7 @@ performance improvements over the 7.10 branch. system to use the ``nm-classic`` command instead of Apple's new ``nm`` implementation as the latter breaks POSIX compliance (see :ghc-ticket:`11744`). This can be done by passing something like - ``--with-nm=/Library/Developer/CommandLineTools/usr/bin/nm-classic`` to - ``configure``. + ``--with-nm=$(xcrun --find nm-classic)`` to ``configure``. Highlights ---------- diff --git a/utils/deriveConstants/Main.hs b/utils/deriveConstants/Main.hs index 6a050d3..6cd48d4 100644 --- a/utils/deriveConstants/Main.hs +++ b/utils/deriveConstants/Main.hs @@ -693,7 +693,7 @@ getWanted verbose os tmpdir gccProgram gccFlags nmProgram mobjdumpProgram Just 0x292 -> die $ "broken 'nm' detected, see https://ghc.haskell.org/ticket/11744.\n" ++ "\n" ++ "Workaround: You may want to pass\n" - ++ " --with-nm=$(xcode-select -p)/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm-classic\n" + ++ " --with-nm=$(xcrun --find nm-classic\n" ++ "to 'configure'.\n" Just x -> die ("unexpected value round-tripped for CONTROL_GROUP_CONST_291: " ++ show x) From git at git.haskell.org Tue May 3 19:24:33 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 19:24:33 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: users-guide: Add index entry for "environment file" (72ab618) Message-ID: <20160503192433.6A1433A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/72ab618325cd7d6556ab03822e6758dcb10e0ed6/ghc >--------------------------------------------------------------- commit 72ab618325cd7d6556ab03822e6758dcb10e0ed6 Author: Ben Gamari Date: Sun May 1 13:21:55 2016 +0200 users-guide: Add index entry for "environment file" (cherry picked from commit 5a7149711a7c15a3434dd8e19bea77c57ff9879d) >--------------------------------------------------------------- 72ab618325cd7d6556ab03822e6758dcb10e0ed6 docs/users_guide/packages.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/users_guide/packages.rst b/docs/users_guide/packages.rst index c9e2ea4..77f23c5 100644 --- a/docs/users_guide/packages.rst +++ b/docs/users_guide/packages.rst @@ -1279,6 +1279,7 @@ Package environments .. index:: single: package environments + single: environment file A *package environment file* is a file that tells ``ghc`` precisely which packages should be visible. It can be used to create environments for ``ghc`` From git at git.haskell.org Tue May 3 19:24:36 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 19:24:36 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Bump haddock submodule (11444b8) Message-ID: <20160503192436.1AC223A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/11444b8460dd6c60714d87e799cb090637de0b36/ghc >--------------------------------------------------------------- commit 11444b8460dd6c60714d87e799cb090637de0b36 Author: Ben Gamari Date: Sun May 1 13:23:20 2016 +0200 Bump haddock submodule Fixes documentation installation. >--------------------------------------------------------------- 11444b8460dd6c60714d87e799cb090637de0b36 utils/haddock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/haddock b/utils/haddock index 3b980e7..fea4b0a 160000 --- a/utils/haddock +++ b/utils/haddock @@ -1 +1 @@ -Subproject commit 3b980e7fc47bb898b00c7d37d442e0fd5716cb7c +Subproject commit fea4b0a3589ad67d72594b16ceb0e6922e7f2bb8 From git at git.haskell.org Tue May 3 19:24:38 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 19:24:38 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: deriveConstants: Fix nm advice one last time (628262b) Message-ID: <20160503192438.C29643A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/628262b59d2565e3646b58a97265b34ac1cde7e7/ghc >--------------------------------------------------------------- commit 628262b59d2565e3646b58a97265b34ac1cde7e7 Author: Ben Gamari Date: Sun May 1 18:05:28 2016 +0200 deriveConstants: Fix nm advice one last time Missing a close paren. >--------------------------------------------------------------- 628262b59d2565e3646b58a97265b34ac1cde7e7 utils/deriveConstants/Main.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/deriveConstants/Main.hs b/utils/deriveConstants/Main.hs index 6cd48d4..1878fd9 100644 --- a/utils/deriveConstants/Main.hs +++ b/utils/deriveConstants/Main.hs @@ -693,7 +693,7 @@ getWanted verbose os tmpdir gccProgram gccFlags nmProgram mobjdumpProgram Just 0x292 -> die $ "broken 'nm' detected, see https://ghc.haskell.org/ticket/11744.\n" ++ "\n" ++ "Workaround: You may want to pass\n" - ++ " --with-nm=$(xcrun --find nm-classic\n" + ++ " --with-nm=$(xcrun --find nm-classic)\n" ++ "to 'configure'.\n" Just x -> die ("unexpected value round-tripped for CONTROL_GROUP_CONST_291: " ++ show x) From git at git.haskell.org Tue May 3 20:11:05 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 20:11:05 +0000 (UTC) Subject: [commit: ghc] master: Update libraries/hpc submodule to v0.6.0.3 release tag (0051ac1) Message-ID: <20160503201105.B91213A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0051ac1786ccdf0fb9babf188a9f9bc0da2ce520/ghc >--------------------------------------------------------------- commit 0051ac1786ccdf0fb9babf188a9f9bc0da2ce520 Author: Herbert Valerio Riedel Date: Tue May 3 22:11:59 2016 +0200 Update libraries/hpc submodule to v0.6.0.3 release tag >--------------------------------------------------------------- 0051ac1786ccdf0fb9babf188a9f9bc0da2ce520 libraries/hpc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/hpc b/libraries/hpc index fbe2b7b..88b389f 160000 --- a/libraries/hpc +++ b/libraries/hpc @@ -1 +1 @@ -Subproject commit fbe2b7b9e163daa8fbe3c8f2dddc1132aa4e735f +Subproject commit 88b389f368d1222078ee9592236b107d061cd5f2 From git at git.haskell.org Tue May 3 20:13:33 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 20:13:33 +0000 (UTC) Subject: [commit: packages/hpc] tag 'v0.6.0.3' created Message-ID: <20160503201333.2D4EB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hpc New tag : v0.6.0.3 Referencing: 39d23aad9aa724c8e73c3d27ee58746cc1f2e854 From git at git.haskell.org Tue May 3 20:16:53 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 20:16:53 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Update libraries/hpc submodule to v0.6.0.3 release tag (c7d21b1) Message-ID: <20160503201653.A12333A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/c7d21b1821ea8940f3496e0cd49c21ef8a4cd45b/ghc >--------------------------------------------------------------- commit c7d21b1821ea8940f3496e0cd49c21ef8a4cd45b Author: Herbert Valerio Riedel Date: Tue May 3 22:11:59 2016 +0200 Update libraries/hpc submodule to v0.6.0.3 release tag (cherry picked from commit 0051ac1786ccdf0fb9babf188a9f9bc0da2ce520) >--------------------------------------------------------------- c7d21b1821ea8940f3496e0cd49c21ef8a4cd45b libraries/hpc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/hpc b/libraries/hpc index 7cead32..88b389f 160000 --- a/libraries/hpc +++ b/libraries/hpc @@ -1 +1 @@ -Subproject commit 7cead32fc1f9929d69861d1b09e710bd6d374363 +Subproject commit 88b389f368d1222078ee9592236b107d061cd5f2 From git at git.haskell.org Tue May 3 20:16:56 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 20:16:56 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Update Cabal submodule to v1.24.0.0 releas tag (11a76c7) Message-ID: <20160503201656.4DCF13A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/11a76c73fce854ef40c01a1e0248d720fdb94bc8/ghc >--------------------------------------------------------------- commit 11a76c73fce854ef40c01a1e0248d720fdb94bc8 Author: Herbert Valerio Riedel Date: Tue May 3 22:16:36 2016 +0200 Update Cabal submodule to v1.24.0.0 releas tag >--------------------------------------------------------------- 11a76c73fce854ef40c01a1e0248d720fdb94bc8 libraries/Cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/Cabal b/libraries/Cabal index f99f91e..6e2d243 160000 --- a/libraries/Cabal +++ b/libraries/Cabal @@ -1 +1 @@ -Subproject commit f99f91eb570c11ea36e64bc451054bf7a3116a79 +Subproject commit 6e2d243d1cd243882b29ccd717bdf53c94c1cb76 From git at git.haskell.org Tue May 3 22:42:37 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:42:37 +0000 (UTC) Subject: [commit: packages/bytestring] branch 'wip/nix-local-build' created Message-ID: <20160503224237.B53B13A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring New branch : wip/nix-local-build Referencing: 7c4d17585f2698a3bfc97437b0678c25540df2d3 From git at git.haskell.org Tue May 3 22:42:39 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:42:39 +0000 (UTC) Subject: [commit: packages/bytestring] branch 'revert-46-patch-1' created Message-ID: <20160503224239.B57F73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring New branch : revert-46-patch-1 Referencing: 30d850803fd4834eafd60ecef95d1cabe2711d5a From git at git.haskell.org Tue May 3 22:42:41 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:42:41 +0000 (UTC) Subject: [commit: packages/bytestring] tag '0.10.8.0' created Message-ID: <20160503224241.B69603A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring New tag : 0.10.8.0 Referencing: 8d45a872802493dee06982e2eca45ad00090a909 From git at git.haskell.org Tue May 3 22:42:43 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:42:43 +0000 (UTC) Subject: [commit: packages/bytestring] master, revert-46-patch-1, wip/nix-local-build: `cabal repl` error (98d7782) Message-ID: <20160503224243.C1EC73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branches: master,revert-46-patch-1,wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/98d77823f144856de77a38fb2964788614d26c35 >--------------------------------------------------------------- commit 98d77823f144856de77a38fb2964788614d26c35 Author: Athan Clark Date: Thu Mar 19 11:18:21 2015 -0600 `cabal repl` error I'm not sure if this is an intended issue or flaw, but on GHC-7.8.3 running on an Intel i7 in linux, I could not seem to get into an interactive repl unless `-fobject-code` was also added - the `Data.ByteString.Builder.ASCII` module wasn't compiling. Here is the error for more detail: http://lpaste.net/128004 >--------------------------------------------------------------- 98d77823f144856de77a38fb2964788614d26c35 bytestring.cabal | 1 + 1 file changed, 1 insertion(+) diff --git a/bytestring.cabal b/bytestring.cabal index 40fa4ad..5eb5a41 100644 --- a/bytestring.cabal +++ b/bytestring.cabal @@ -125,6 +125,7 @@ library -fmax-simplifier-iterations=10 -fdicts-cheap -fspec-constr-count=6 + -fobject-code c-sources: cbits/fpstring.c cbits/itoa.c From git at git.haskell.org Tue May 3 22:42:45 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:42:45 +0000 (UTC) Subject: [commit: packages/bytestring] master, revert-46-patch-1, wip/nix-local-build: fix Char8.unwords type in module's comment (b697018) Message-ID: <20160503224245.CBD503A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branches: master,revert-46-patch-1,wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/b69701843c2057a82ce4ab6dd5aa807942cf06dd >--------------------------------------------------------------- commit b69701843c2057a82ce4ab6dd5aa807942cf06dd Author: Sergei Trofimovich Date: Sun Aug 9 16:40:46 2015 +0100 fix Char8.unwords type in module's comment Signed-off-by: Sergei Trofimovich >--------------------------------------------------------------- b69701843c2057a82ce4ab6dd5aa807942cf06dd Data/ByteString/Char8.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Data/ByteString/Char8.hs b/Data/ByteString/Char8.hs index 4725bce..30d0207 100644 --- a/Data/ByteString/Char8.hs +++ b/Data/ByteString/Char8.hs @@ -135,7 +135,7 @@ module Data.ByteString.Char8 ( lines, -- :: ByteString -> [ByteString] words, -- :: ByteString -> [ByteString] unlines, -- :: [ByteString] -> ByteString - unwords, -- :: ByteString -> [ByteString] + unwords, -- :: [ByteString] -> ByteString -- * Predicates isPrefixOf, -- :: ByteString -> ByteString -> Bool From git at git.haskell.org Tue May 3 22:42:47 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:42:47 +0000 (UTC) Subject: [commit: packages/bytestring] master, revert-46-patch-1, wip/nix-local-build: Implement Rabin-Karp substring search. (2160e09) Message-ID: <20160503224247.D66B73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branches: master,revert-46-patch-1,wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/2160e091e215fecc9177d55a37cd50fc253ba86a >--------------------------------------------------------------- commit 2160e091e215fecc9177d55a37cd50fc253ba86a Author: Sean Date: Fri Sep 18 09:14:01 2015 +0100 Implement Rabin-Karp substring search. Conflicts: Data/ByteString.hs >--------------------------------------------------------------- 2160e091e215fecc9177d55a37cd50fc253ba86a Data/ByteString.hs | 58 ++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 43 insertions(+), 15 deletions(-) diff --git a/Data/ByteString.hs b/Data/ByteString.hs index 42263a6..90eb301 100644 --- a/Data/ByteString.hs +++ b/Data/ByteString.hs @@ -1327,16 +1327,38 @@ isInfixOf p s = isJust (findSubstring p s) -- -- > fst (breakSubstring x y) -- +-- Note that calling `breakSubstring x` does some preprocessing work, so +-- you should avoid uneccesarily duplicating breakSubstring calls with the same +-- pattern. + breakSubstring :: ByteString -- ^ String to search for -> ByteString -- ^ String to search in -> (ByteString,ByteString) -- ^ Head and tail of string broken at substring - -breakSubstring pat src = search 0 src +breakSubstring pat = + case lp of + 0 -> \src -> (empty,src) + 1 -> breakByte (unsafeHead pat) + _ -> karpRabin where - search !n !s - | null s = (src,empty) -- not found - | pat `isPrefixOf` s = (take n src,s) - | otherwise = search (n+1) (unsafeTail s) + lp = length pat + k = 2891336453 :: Word32 + rollingHash = foldl' (\h b -> h * k + fromIntegral b) 0 + hp = rollingHash pat + m = k ^ lp + karpRabin src + | length src < lp = (src,empty) + | otherwise = search (rollingHash $ unsafeTake lp src) 0 + where + search !hs !n + | hp == hs && pat `isPrefixOf` s = (unsafeTake n src,s) + | length src - n <= lp = (src,empty) -- not found + | otherwise = search hs' (n+1) + where + get = fromIntegral . unsafeIndex src + s = unsafeDrop n src + hs' = hs * k + + get (n + lp) - + m * get n -- | Get the first index of a substring in another string, -- or 'Nothing' if the string is not found. @@ -1344,7 +1366,11 @@ breakSubstring pat src = search 0 src findSubstring :: ByteString -- ^ String to search for. -> ByteString -- ^ String to seach in. -> Maybe Int -findSubstring f i = listToMaybe (findSubstrings f i) +findSubstring pat src + | null pat && null src = Just 0 + | null b = Nothing + | otherwise = Just (length a) + where (a, b) = breakSubstring pat src {-# DEPRECATED findSubstring "findSubstring is deprecated in favour of breakSubstring." #-} @@ -1354,14 +1380,16 @@ findSubstring f i = listToMaybe (findSubstrings f i) findSubstrings :: ByteString -- ^ String to search for. -> ByteString -- ^ String to seach in. -> [Int] -findSubstrings pat str - | null pat = [0 .. length str] - | otherwise = search 0 str - where - search !n !s - | null s = [] - | pat `isPrefixOf` s = n : search (n+1) (unsafeTail s) - | otherwise = search (n+1) (unsafeTail s) +findSubstrings pat src + | null pat = [0 .. ls] + | otherwise = search 0 + where lp = length pat + ls = length src + search !n + | (n > ls - lp) || null b = [] + | otherwise = let k = n + length a + in k : search (k + lp) + where (a, b) = breakSubstring pat (unsafeDrop n src) {-# DEPRECATED findSubstrings "findSubstrings is deprecated in favour of breakSubstring." #-} From git at git.haskell.org Tue May 3 22:42:49 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:42:49 +0000 (UTC) Subject: [commit: packages/bytestring] master, revert-46-patch-1, wip/nix-local-build: Fix test performance to stop Travis CI timing out. (0cf9781) Message-ID: <20160503224249.E06653A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branches: master,revert-46-patch-1,wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/0cf9781aa72f04c6d00bb015fb46599d580a2a0a >--------------------------------------------------------------- commit 0cf9781aa72f04c6d00bb015fb46599d580a2a0a Author: Sean Date: Thu Sep 24 18:39:01 2015 +0100 Fix test performance to stop Travis CI timing out. >--------------------------------------------------------------- 0cf9781aa72f04c6d00bb015fb46599d580a2a0a tests/Properties.hs | 4 ++-- tests/QuickCheckUtils.hs | 24 +++++++++++++++--------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/tests/Properties.hs b/tests/Properties.hs index 7d86e27..a78270c 100644 --- a/tests/Properties.hs +++ b/tests/Properties.hs @@ -152,7 +152,7 @@ prop_concatBP = forAll (sized $ \n -> resize (n `div` 2) arbitrary) $ prop_nullBP = L.null `eq1` P.null prop_reverseBP = L.reverse `eq1` P.reverse -prop_transposeBP = L.transpose `eq1` P.transpose +--prop_transposeBP = L.transpose `eq1` P.transpose prop_groupBP = L.group `eq1` P.group prop_groupByBP = L.groupBy `eq2` P.groupBy prop_initsBP = L.inits `eq1` P.inits @@ -1900,7 +1900,7 @@ bp_tests = , testProperty "snoc" prop_snocBP , testProperty "tail" prop_tailBP , testProperty "scanl" prop_scanlBP - , testProperty "transpose" prop_transposeBP +-- , testProperty "transpose" prop_transposeBP , testProperty "replicate" prop_replicateBP , testProperty "take" prop_takeBP , testProperty "drop" prop_dropBP diff --git a/tests/QuickCheckUtils.hs b/tests/QuickCheckUtils.hs index 55730a1..cdcd700 100644 --- a/tests/QuickCheckUtils.hs +++ b/tests/QuickCheckUtils.hs @@ -32,24 +32,30 @@ integralRandomR (a,b) g = case randomR (fromIntegral a :: Integer, fromIntegral b :: Integer) g of (x,g) -> (fromIntegral x, g) -instance Arbitrary L.ByteString where - arbitrary = return . L.checkInvariant - . L.fromChunks - . filter (not. P.null) -- maintain the invariant. - =<< arbitrary - -instance CoArbitrary L.ByteString where - coarbitrary s = coarbitrary (L.unpack s) +sizedByteString n = do m <- choose(0, n) + fmap P.pack $ vectorOf m arbitrary instance Arbitrary P.ByteString where arbitrary = do - bs <- P.pack `fmap` arbitrary + bs <- sized sizedByteString n <- choose (0, 2) return (P.drop n bs) -- to give us some with non-0 offset instance CoArbitrary P.ByteString where coarbitrary s = coarbitrary (P.unpack s) +instance Arbitrary L.ByteString where + arbitrary = sized $ \n -> do numChunks <- choose (0, n) + if numChunks == 0 + then return L.empty + else fmap (L.checkInvariant . + L.fromChunks . + filter (not . P.null)) $ + vectorOf (sizedByteString + (n `div` numChunks)) + +instance CoArbitrary L.ByteString where + coarbitrary s = coarbitrary (L.unpack s) newtype CByteString = CByteString P.ByteString deriving Show From git at git.haskell.org Tue May 3 22:42:51 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:42:51 +0000 (UTC) Subject: [commit: packages/bytestring] master, revert-46-patch-1, wip/nix-local-build: Fix type error in previous commit. (e48344e) Message-ID: <20160503224251.E98053A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branches: master,revert-46-patch-1,wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/e48344e9a7f8421800ee0dbcb4883acbb7506335 >--------------------------------------------------------------- commit e48344e9a7f8421800ee0dbcb4883acbb7506335 Author: Sean Date: Thu Sep 24 18:51:49 2015 +0100 Fix type error in previous commit. >--------------------------------------------------------------- e48344e9a7f8421800ee0dbcb4883acbb7506335 tests/QuickCheckUtils.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/QuickCheckUtils.hs b/tests/QuickCheckUtils.hs index cdcd700..b61dcd1 100644 --- a/tests/QuickCheckUtils.hs +++ b/tests/QuickCheckUtils.hs @@ -51,7 +51,8 @@ instance Arbitrary L.ByteString where else fmap (L.checkInvariant . L.fromChunks . filter (not . P.null)) $ - vectorOf (sizedByteString + vectorOf numChunks + (sizedByteString (n `div` numChunks)) instance CoArbitrary L.ByteString where From git at git.haskell.org Tue May 3 22:42:53 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:42:53 +0000 (UTC) Subject: [commit: packages/bytestring] master, revert-46-patch-1, wip/nix-local-build: Small adjustments (c42e99a) Message-ID: <20160503224253.F32E33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branches: master,revert-46-patch-1,wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/c42e99a764c60f220b66d9117f146b31d95f7c9e >--------------------------------------------------------------- commit c42e99a764c60f220b66d9117f146b31d95f7c9e Author: Sean Date: Thu Sep 24 19:59:43 2015 +0100 Small adjustments >--------------------------------------------------------------- c42e99a764c60f220b66d9117f146b31d95f7c9e tests/Properties.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/Properties.hs b/tests/Properties.hs index a78270c..517e86c 100644 --- a/tests/Properties.hs +++ b/tests/Properties.hs @@ -152,7 +152,7 @@ prop_concatBP = forAll (sized $ \n -> resize (n `div` 2) arbitrary) $ prop_nullBP = L.null `eq1` P.null prop_reverseBP = L.reverse `eq1` P.reverse ---prop_transposeBP = L.transpose `eq1` P.transpose +prop_transposeBP = L.transpose `eq1` P.transpose prop_groupBP = L.group `eq1` P.group prop_groupByBP = L.groupBy `eq2` P.groupBy prop_initsBP = L.inits `eq1` P.inits @@ -1640,7 +1640,7 @@ short_tests = -- The entry point main :: IO () -main = defaultMain tests +main = defaultMainWithArgs tests ["-o 3"] -- timeout if a test runs for >3 secs -- -- And now a list of all the properties to test. @@ -1900,7 +1900,7 @@ bp_tests = , testProperty "snoc" prop_snocBP , testProperty "tail" prop_tailBP , testProperty "scanl" prop_scanlBP --- , testProperty "transpose" prop_transposeBP + , testProperty "transpose" prop_transposeBP , testProperty "replicate" prop_replicateBP , testProperty "take" prop_takeBP , testProperty "drop" prop_dropBP @@ -2271,7 +2271,7 @@ ll_tests = , testProperty "reverse" prop_reverse , testProperty "reverse1" prop_reverse1 , testProperty "reverse2" prop_reverse2 - , testProperty "transpose" prop_transpose + --, testProperty "transpose" prop_transpose , testProperty "foldl" prop_foldl , testProperty "foldl/reverse" prop_foldl_1 , testProperty "foldr" prop_foldr @@ -2289,7 +2289,7 @@ ll_tests = , testProperty "all" prop_all , testProperty "maximum" prop_maximum , testProperty "minimum" prop_minimum - , testProperty "replicate 1" prop_replicate1 + --, testProperty "replicate 1" prop_replicate1 , testProperty "replicate 2" prop_replicate2 , testProperty "take" prop_take1 , testProperty "drop" prop_drop1 From git at git.haskell.org Tue May 3 22:42:56 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:42:56 +0000 (UTC) Subject: [commit: packages/bytestring] master, revert-46-patch-1, wip/nix-local-build: Update cabal bounds (a721c40) Message-ID: <20160503224256.0AB033A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branches: master,revert-46-patch-1,wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/a721c4035e008ae7c8113ffcccd520ee8b12b269 >--------------------------------------------------------------- commit a721c4035e008ae7c8113ffcccd520ee8b12b269 Author: Sean Date: Thu Sep 24 22:17:02 2015 +0100 Update cabal bounds >--------------------------------------------------------------- a721c4035e008ae7c8113ffcccd520ee8b12b269 bytestring.cabal | 381 +++++++++++++++++++++++----------------------------- tests/Properties.hs | 2 +- 2 files changed, 171 insertions(+), 212 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc a721c4035e008ae7c8113ffcccd520ee8b12b269 From git at git.haskell.org Tue May 3 22:42:58 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:42:58 +0000 (UTC) Subject: [commit: packages/bytestring] master, revert-46-patch-1, wip/nix-local-build: fix cabal bounds in .travis.yml (bb14f0b) Message-ID: <20160503224258.1342A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branches: master,revert-46-patch-1,wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/bb14f0bca21c9bd161488f03ca0da19b1f41af18 >--------------------------------------------------------------- commit bb14f0bca21c9bd161488f03ca0da19b1f41af18 Author: Sean Date: Thu Sep 24 22:23:31 2015 +0100 fix cabal bounds in .travis.yml >--------------------------------------------------------------- bb14f0bca21c9bd161488f03ca0da19b1f41af18 .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1b738ab..7fcf2f4 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 && <2.7" "byteorder ==1.0.*" "dlist ==0.5.*" "mtl >=2.0 && <2.2" deepseq test-framework-hunit test-framework-quickcheck2 + - cabal install QuickCheck byteorder dlist mtl "deepseq >=1.3.0.2 && <1.4" test-framework-hunit test-framework-quickcheck2 script: - cabal configure --enable-tests -v2 From git at git.haskell.org Tue May 3 22:43:00 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:43:00 +0000 (UTC) Subject: [commit: packages/bytestring] master, revert-46-patch-1, wip/nix-local-build: Refresh sandbox (b6fe1f0) Message-ID: <20160503224300.1C2F43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branches: master,revert-46-patch-1,wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/b6fe1f02c6e93194b4aa00edaed9601f6cb77204 >--------------------------------------------------------------- commit b6fe1f02c6e93194b4aa00edaed9601f6cb77204 Author: Sean Date: Thu Sep 24 22:28:19 2015 +0100 Refresh sandbox >--------------------------------------------------------------- b6fe1f02c6e93194b4aa00edaed9601f6cb77204 .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 7fcf2f4..e0bef82 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,6 +21,8 @@ before_install: - cabal --version install: + - cabal sandbox delete + - cabal sandbox init - travis_retry cabal update # can't use "cabal install --only-dependencies --enable-tests" due to dep-cycle - cabal install QuickCheck byteorder dlist mtl "deepseq >=1.3.0.2 && <1.4" test-framework-hunit test-framework-quickcheck2 From git at git.haskell.org Tue May 3 22:43:02 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:43:02 +0000 (UTC) Subject: [commit: packages/bytestring] master,revert-46-patch-1,wip/nix-local-build: Force reinstalls; last ditch effort to get this working. (39d1e50) Message-ID: <20160503224302.248C33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branches: master,revert-46-patch-1,wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/39d1e50a4045a5249f22054e87a922a136cafc78 >--------------------------------------------------------------- commit 39d1e50a4045a5249f22054e87a922a136cafc78 Author: Sean Date: Thu Sep 24 22:36:11 2015 +0100 Force reinstalls; last ditch effort to get this working. >--------------------------------------------------------------- 39d1e50a4045a5249f22054e87a922a136cafc78 .travis.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index e0bef82..f3294e5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,11 +21,9 @@ before_install: - cabal --version install: - - cabal sandbox delete - - cabal sandbox init - travis_retry cabal update # can't use "cabal install --only-dependencies --enable-tests" due to dep-cycle - - cabal install QuickCheck byteorder dlist mtl "deepseq >=1.3.0.2 && <1.4" test-framework-hunit test-framework-quickcheck2 + - cabal install QuickCheck byteorder dlist mtl "deepseq >=1.3.0.2 && <1.4" test-framework-hunit test-framework-quickcheck2 --force-reinstalls script: - cabal configure --enable-tests -v2 From git at git.haskell.org Tue May 3 22:43:04 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:43:04 +0000 (UTC) Subject: [commit: packages/bytestring] master, revert-46-patch-1, wip/nix-local-build: Rejigger .travis.yml (48613a6) Message-ID: <20160503224304.2CF3F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branches: master,revert-46-patch-1,wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/48613a63eda83d69dcc90250cce3ebdd238d2e06 >--------------------------------------------------------------- commit 48613a63eda83d69dcc90250cce3ebdd238d2e06 Author: Sean Date: Thu Sep 24 23:42:03 2015 +0100 Rejigger .travis.yml >--------------------------------------------------------------- 48613a63eda83d69dcc90250cce3ebdd238d2e06 .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f3294e5..e1e487b 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 byteorder dlist mtl "deepseq >=1.3.0.2 && <1.4" test-framework-hunit test-framework-quickcheck2 --force-reinstalls + - cabal install QuickCheck byteorder dlist mtl "deepseq >=1.3.0.2 && <1.4" test-framework-hunit test-framework-quickcheck2 "ghc-prim >=0.3.1.0 && <0.4" --force-reinstalls script: - cabal configure --enable-tests -v2 From git at git.haskell.org Tue May 3 22:43:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:43:06 +0000 (UTC) Subject: [commit: packages/bytestring] master, revert-46-patch-1, wip/nix-local-build: Sigh... Trying again. (7ff2386) Message-ID: <20160503224306.367A73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branches: master,revert-46-patch-1,wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/7ff2386b63f176fb02a820506f7024107e0f5a72 >--------------------------------------------------------------- commit 7ff2386b63f176fb02a820506f7024107e0f5a72 Author: Sean Date: Thu Sep 24 23:47:30 2015 +0100 Sigh... Trying again. >--------------------------------------------------------------- 7ff2386b63f176fb02a820506f7024107e0f5a72 .travis.yml | 3 +- bytestring.cabal | 381 ++++++++++++++++++++++++++++++------------------------- 2 files changed, 213 insertions(+), 171 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 7ff2386b63f176fb02a820506f7024107e0f5a72 From git at git.haskell.org Tue May 3 22:43:08 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:43:08 +0000 (UTC) Subject: [commit: packages/bytestring] master, revert-46-patch-1, wip/nix-local-build: Change bounds again. (81f989d) Message-ID: <20160503224308.3F1A23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branches: master,revert-46-patch-1,wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/81f989d21c8cb93148492afcb6b556359babe41a >--------------------------------------------------------------- commit 81f989d21c8cb93148492afcb6b556359babe41a Author: Sean Date: Thu Sep 24 23:52:48 2015 +0100 Change bounds again. >--------------------------------------------------------------- 81f989d21c8cb93148492afcb6b556359babe41a bytestring.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bytestring.cabal b/bytestring.cabal index 0987fe1..48b927e 100644 --- a/bytestring.cabal +++ b/bytestring.cabal @@ -153,7 +153,7 @@ test-suite prop-compiled hs-source-dirs: . tests build-depends: base, ghc-prim, deepseq, random, directory, test-framework, test-framework-quickcheck2, - QuickCheck >= 2.3 && < 2.7 + QuickCheck >= 2.3 c-sources: cbits/fpstring.c include-dirs: include ghc-options: -fwarn-unused-binds From git at git.haskell.org Tue May 3 22:43:10 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:43:10 +0000 (UTC) Subject: [commit: packages/bytestring] master, revert-46-patch-1, wip/nix-local-build: Merge pull request #59 from SeanRBurton/fix-tests2 (e621181) Message-ID: <20160503224310.491E23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branches: master,revert-46-patch-1,wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/e6211810e5ab844f6c1d35a80af74ee517827283 >--------------------------------------------------------------- commit e6211810e5ab844f6c1d35a80af74ee517827283 Merge: c2ddcf9 81f989d Author: Gregory Collins Date: Mon Sep 28 06:54:50 2015 -0700 Merge pull request #59 from SeanRBurton/fix-tests2 Fix test performance to stop Travis CI timing out. >--------------------------------------------------------------- e6211810e5ab844f6c1d35a80af74ee517827283 .travis.yml | 3 ++- bytestring.cabal | 4 ++-- tests/Properties.hs | 4 ++-- tests/QuickCheckUtils.hs | 25 ++++++++++++++++--------- 4 files changed, 22 insertions(+), 14 deletions(-) From git at git.haskell.org Tue May 3 22:43:12 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:43:12 +0000 (UTC) Subject: [commit: packages/bytestring] master, revert-46-patch-1, wip/nix-local-build: Add benchmarks and improve substring matching performance. (84b1338) Message-ID: <20160503224312.5C8F73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branches: master,revert-46-patch-1,wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/84b1338856b9a433993005ff6ad5a5ae157059bb >--------------------------------------------------------------- commit 84b1338856b9a433993005ff6ad5a5ae157059bb Author: Sean Date: Mon Sep 28 14:42:15 2015 +0100 Add benchmarks and improve substring matching performance. >--------------------------------------------------------------- 84b1338856b9a433993005ff6ad5a5ae157059bb Data/ByteString.hs | 84 ++++-- bench/BenchAll.hs | 114 ++++++++ bench/bench-bytestring.cabal | 3 + bench/wiki-haskell.html | 674 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 850 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 84b1338856b9a433993005ff6ad5a5ae157059bb From git at git.haskell.org Tue May 3 22:43:14 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:43:14 +0000 (UTC) Subject: [commit: packages/bytestring] master, revert-46-patch-1, wip/nix-local-build: Merge https://github.com/haskell/bytestring (99ef40d) Message-ID: <20160503224314.6C0083A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branches: master,revert-46-patch-1,wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/99ef40ddbb70508cd93f9986c3cc1b723273b277 >--------------------------------------------------------------- commit 99ef40ddbb70508cd93f9986c3cc1b723273b277 Merge: 84b1338 e621181 Author: Sean Date: Mon Sep 28 15:46:23 2015 +0100 Merge https://github.com/haskell/bytestring >--------------------------------------------------------------- 99ef40ddbb70508cd93f9986c3cc1b723273b277 .travis.yml | 3 ++- bytestring.cabal | 4 ++-- tests/Properties.hs | 4 ++-- tests/QuickCheckUtils.hs | 25 ++++++++++++++++--------- 4 files changed, 22 insertions(+), 14 deletions(-) From git at git.haskell.org Tue May 3 22:43:16 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:43:16 +0000 (UTC) Subject: [commit: packages/bytestring] master, revert-46-patch-1, wip/nix-local-build: Tiny performance tweak. (7fda8bd) Message-ID: <20160503224316.760293A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branches: master,revert-46-patch-1,wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/7fda8bd8f5e13a1dddbe8baf16ac5f96b2586125 >--------------------------------------------------------------- commit 7fda8bd8f5e13a1dddbe8baf16ac5f96b2586125 Author: Sean Date: Mon Sep 28 16:10:51 2015 +0100 Tiny performance tweak. >--------------------------------------------------------------- 7fda8bd8f5e13a1dddbe8baf16ac5f96b2586125 Data/ByteString.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Data/ByteString.hs b/Data/ByteString.hs index 2737549..970693c 100644 --- a/Data/ByteString.hs +++ b/Data/ByteString.hs @@ -322,6 +322,7 @@ unsafeDupablePerformIO = unsafePerformIO #endif #if !MIN_VERSION_base(4,7,0) +finiteBitSize :: Word -> Int finiteBitSize = bitSize #endif @@ -1364,9 +1365,9 @@ breakSubstring pat = m = k ^ lp get = fromIntegral . unsafeIndex src search !hs !i - | hp == hs && pat `isPrefixOf` b = u - | length src <= i = (src,empty) -- not found - | otherwise = search hs' (i + 1) + | hp == hs && pat == unsafeTake lp b = u + | length src <= i = (src,empty) -- not found + | otherwise = search hs' (i + 1) where u@(_, b) = unsafeSplitAt (i - lp) src hs' = hs * k + From git at git.haskell.org Tue May 3 22:43:18 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:43:18 +0000 (UTC) Subject: [commit: packages/bytestring] master, revert-46-patch-1, wip/nix-local-build: Fix spelling error. (af2d250) Message-ID: <20160503224318.7F8B73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branches: master,revert-46-patch-1,wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/af2d250fb6725457048886971c622a6219a228ac >--------------------------------------------------------------- commit af2d250fb6725457048886971c622a6219a228ac Author: Sean Date: Mon Sep 28 22:04:21 2015 +0100 Fix spelling error. >--------------------------------------------------------------- af2d250fb6725457048886971c622a6219a228ac Data/ByteString.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Data/ByteString.hs b/Data/ByteString.hs index 970693c..93d7be8 100644 --- a/Data/ByteString.hs +++ b/Data/ByteString.hs @@ -1338,7 +1338,7 @@ isInfixOf p s = isJust (findSubstring p s) -- > fst (breakSubstring x y) -- -- Note that calling `breakSubstring x` does some preprocessing work, so --- you should avoid uneccesarily duplicating breakSubstring calls with the same +-- you should avoid unnecessarily duplicating breakSubstring calls with the same -- pattern. -- breakSubstring :: ByteString -- ^ String to search for From git at git.haskell.org Tue May 3 22:43:20 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:43:20 +0000 (UTC) Subject: [commit: packages/bytestring] master, revert-46-patch-1, wip/nix-local-build: Undo whitespace changes. (c72f64f) Message-ID: <20160503224320.891213A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branches: master,revert-46-patch-1,wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/c72f64fe00be522b23a34c7882efae81eaee7796 >--------------------------------------------------------------- commit c72f64fe00be522b23a34c7882efae81eaee7796 Author: Sean Date: Mon Sep 28 22:26:21 2015 +0100 Undo whitespace changes. >--------------------------------------------------------------- c72f64fe00be522b23a34c7882efae81eaee7796 Data/ByteString.hs | 0 1 file changed, 0 insertions(+), 0 deletions(-) From git at git.haskell.org Tue May 3 22:43:22 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:43:22 +0000 (UTC) Subject: [commit: packages/bytestring] master, revert-46-patch-1, wip/nix-local-build: Improve the performance of `partition` for lazy and strict bytestrings (fae6927) Message-ID: <20160503224322.93A3E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branches: master,revert-46-patch-1,wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/fae6927d42b8c9d31e670adfb2b80bbe18bacff9 >--------------------------------------------------------------- commit fae6927d42b8c9d31e670adfb2b80bbe18bacff9 Author: Sean Date: Fri Sep 18 09:14:01 2015 +0100 Improve the performance of `partition` for lazy and strict bytestrings >--------------------------------------------------------------- fae6927d42b8c9d31e670adfb2b80bbe18bacff9 Data/ByteString.hs | 46 ++++++++++++++++++++++++++++++++++++--------- Data/ByteString/Internal.hs | 2 +- Data/ByteString/Lazy.hs | 7 +++++-- 3 files changed, 43 insertions(+), 12 deletions(-) diff --git a/Data/ByteString.hs b/Data/ByteString.hs index 42263a6..c141441 100644 --- a/Data/ByteString.hs +++ b/Data/ByteString.hs @@ -231,7 +231,7 @@ import Data.Maybe (isJust, listToMaybe) #ifndef __NHC__ import Control.Exception (finally, bracket, assert, throwIO) #else -import Control.Exception (bracket, finally) +import Control.Exception (bracket, finally) #endif import Control.Monad (when) @@ -1259,14 +1259,42 @@ find f p = case findIndex f p of -- > partition p bs == (filter p xs, filter (not . p) xs) -- partition :: (Word8 -> Bool) -> ByteString -> (ByteString, ByteString) -partition p bs = (filter p bs, filter (not . p) bs) ---TODO: use a better implementation - --- --------------------------------------------------------------------- --- Searching for substrings - --- | /O(n)/ The 'isPrefixOf' function takes two ByteStrings and returns 'True' --- iff the first is a prefix of the second. +partition f s = unsafeDupablePerformIO $ + do fp' <- mallocByteString len + withForeignPtr fp' $ \p -> + do let end = p `plusPtr` (len - 1) + mid <- sep 0 p end + rev mid end + let i = mid `minusPtr` p + return (PS fp' 0 i, + PS fp' i (len - i)) + where + len = length s + incr = (`plusPtr` 1) + decr = (`plusPtr` (-1)) + + sep !i !p1 !p2 + | i == len = return p1 + | f w = do poke p1 w + sep (i + 1) (incr p1) p2 + | otherwise = do poke p2 w + sep (i + 1) p1 (decr p2) + where + w = s `unsafeIndex` i + + rev !p1 !p2 + | p1 >= p2 = return () + | otherwise = do a <- peek p1 + b <- peek p2 + poke p1 b + poke p2 a + rev (incr p1) (decr p2) + +-- -------------------------------------------------------------------- +-- Sarching for substrings + +-- |/O(n)/ The 'isPrefixOf' function takes two ByteStrings and returns 'True' +-- if the first is a prefix of the second. isPrefixOf :: ByteString -> ByteString -> Bool isPrefixOf (PS x1 s1 l1) (PS x2 s2 l2) | l1 == 0 = True diff --git a/Data/ByteString/Internal.hs b/Data/ByteString/Internal.hs index 0346d01..9747d10 100644 --- a/Data/ByteString/Internal.hs +++ b/Data/ByteString/Internal.hs @@ -169,7 +169,7 @@ import Foreign.ForeignPtr (newForeignPtr_) -- An alternative to Control.Exception (assert) for nhc98 #ifdef __NHC__ -#define assert assertS "__FILE__ : __LINE__" +#define assert assertS "__FILE__ : __LINE__" assertS :: String -> Bool -> a -> a assertS _ True = id assertS s False = error ("assertion failed at "++s) diff --git a/Data/ByteString/Lazy.hs b/Data/ByteString/Lazy.hs index ad8938b..5a0b0bd 100644 --- a/Data/ByteString/Lazy.hs +++ b/Data/ByteString/Lazy.hs @@ -1017,8 +1017,11 @@ filterNotByte w (LPS xs) = LPS (filterMap (P.filterNotByte w) xs) -- > partition p bs == (filter p xs, filter (not . p) xs) -- partition :: (Word8 -> Bool) -> ByteString -> (ByteString, ByteString) -partition f p = (filter f p, filter (not . f) p) ---TODO: use a better implementation +partition _ Empty = (Empty, Empty) +partition p (Chunk x xs) = (chunk t ts, chunk f fs) + where + (t, f) = S.partition p x + (ts, fs) = partition p xs -- --------------------------------------------------------------------- -- Searching for substrings From git at git.haskell.org Tue May 3 22:43:24 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:43:24 +0000 (UTC) Subject: [commit: packages/bytestring] master, revert-46-patch-1, wip/nix-local-build: Benchmark the new partition implementations. (c5da0d2) Message-ID: <20160503224324.9C1E73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branches: master,revert-46-patch-1,wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/c5da0d2f7a817d9dc2c6b7f1dfbd0ff2e6851926 >--------------------------------------------------------------- commit c5da0d2f7a817d9dc2c6b7f1dfbd0ff2e6851926 Author: Sean Date: Wed Sep 30 11:03:37 2015 +0100 Benchmark the new partition implementations. >--------------------------------------------------------------- c5da0d2f7a817d9dc2c6b7f1dfbd0ff2e6851926 bench/BenchAll.hs | 48 ++++++++++++++++++++++++++++++++++++++++++++ bench/bench-bytestring.cabal | 1 + 2 files changed, 49 insertions(+) diff --git a/bench/BenchAll.hs b/bench/BenchAll.hs index 109ea9a..1f8f69c 100644 --- a/bench/BenchAll.hs +++ b/bench/BenchAll.hs @@ -38,6 +38,8 @@ import qualified "bytestring" Data.ByteString.Lazy as OldL import Foreign +import System.Random + ------------------------------------------------------------------------------ -- Benchmark support ------------------------------------------------------------------------------ @@ -149,7 +151,30 @@ benchIntEncodingB n0 w | n <= 0 = return op | otherwise = PI.runB w n op >>= loop (n - 1) +hashInt :: Int -> Int +hashInt x = iterate step x !! 10 + where + step a = e + where b = (a `xor` 61) `xor` (a `shiftR` 16) + c = b + (b `shiftL` 3) + d = c `xor` (c `shiftR` 4) + e = d * 0x27d4eb2d + f = e `xor` (e `shiftR` 15) + +hashWord8 :: Word8 -> Word8 +hashWord8 = fromIntegral . hashInt . fromIntegral + +w :: Int -> Word8 +w = fromIntegral + +partitionStrict p = nf (S.partition p) . randomStrict $ mkStdGen 98423098 + where randomStrict = fst . S.unfoldrN 10000 (Just . random) +partitionLazy p = nf (L.partition p) . randomLazy $ (0, mkStdGen 98423098) + where step (k, g) + | k >= 10000 = Nothing + | otherwise = let (x, g') = random g in Just (x, (k + 1, g')) + randomLazy = L.unfoldr step -- benchmarks ------------- @@ -302,4 +327,27 @@ main = do , benchFE "floatHexFixed" $ fromIntegral >$< P.floatHexFixed , benchFE "doubleHexFixed" $ fromIntegral >$< P.doubleHexFixed ] + , bgroup "partition" + [ + bgroup "strict" + [ + bench "mostlyTrueFast" $ partitionStrict (< (w 225)) + , bench "mostlyFalseFast" $ partitionStrict (< (w 10)) + , bench "balancedFast" $ partitionStrict (< (w 128)) + + , bench "mostlyTrueSlow" $ partitionStrict (\x -> hashWord8 x < w 225) + , bench "mostlyFalseSlow" $ partitionStrict (\x -> hashWord8 x < w 10) + , bench "balancedSlow" $ partitionStrict (\x -> hashWord8 x < w 128) + ] + , bgroup "lazy" + [ + bench "mostlyTrueFast" $ partitionLazy (< (w 225)) + , bench "mostlyFalseFast" $ partitionLazy (< (w 10)) + , bench "balancedFast" $ partitionLazy (< (w 128)) + + , bench "mostlyTrueSlow" $ partitionLazy (\x -> hashWord8 x < w 225) + , bench "mostlyFalseSlow" $ partitionLazy (\x -> hashWord8 x < w 10) + , bench "balancedSlow" $ partitionLazy (\x -> hashWord8 x < w 128) + ] + ] ] diff --git a/bench/bench-bytestring.cabal b/bench/bench-bytestring.cabal index 6421301..ae87a10 100644 --- a/bench/bench-bytestring.cabal +++ b/bench/bench-bytestring.cabal @@ -42,6 +42,7 @@ executable bench-bytestring-builder -- we require bytestring due to benchmarking against -- blaze-textual, which uses blaze-builder , bytestring >= 0.9 + , random -- cabal complains about ../ dirs. However, this is better than symlinks, -- which probably don't work on windows. From git at git.haskell.org Tue May 3 22:43:26 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:43:26 +0000 (UTC) Subject: [commit: packages/bytestring] master, revert-46-patch-1, wip/nix-local-build: Merge pull request #53 from trofi/master (afc1eb5) Message-ID: <20160503224326.A5F403A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branches: master,revert-46-patch-1,wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/afc1eb530fe7934df5aa9fd60ddb75d118cf878f >--------------------------------------------------------------- commit afc1eb530fe7934df5aa9fd60ddb75d118cf878f Merge: e621181 b697018 Author: Duncan Coutts Date: Wed Sep 30 13:07:24 2015 +0100 Merge pull request #53 from trofi/master fix Char8.unwords type in module's comment >--------------------------------------------------------------- afc1eb530fe7934df5aa9fd60ddb75d118cf878f Data/ByteString/Char8.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) From git at git.haskell.org Tue May 3 22:43:28 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:43:28 +0000 (UTC) Subject: [commit: packages/bytestring] master, revert-46-patch-1, wip/nix-local-build: Merge pull request #46 from athanclark/patch-1 (df0073e) Message-ID: <20160503224328.AF2CC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branches: master,revert-46-patch-1,wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/df0073edd9395a1bdc6eee64d379f779fa6e2b41 >--------------------------------------------------------------- commit df0073edd9395a1bdc6eee64d379f779fa6e2b41 Merge: afc1eb5 98d7782 Author: Duncan Coutts Date: Wed Sep 30 13:08:24 2015 +0100 Merge pull request #46 from athanclark/patch-1 `cabal repl` error >--------------------------------------------------------------- df0073edd9395a1bdc6eee64d379f779fa6e2b41 bytestring.cabal | 1 + 1 file changed, 1 insertion(+) From git at git.haskell.org Tue May 3 22:43:30 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:43:30 +0000 (UTC) Subject: [commit: packages/bytestring] master, revert-46-patch-1, wip/nix-local-build: Merge pull request #62 from SeanRBurton/partition (9900f65) Message-ID: <20160503224330.B92A93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branches: master,revert-46-patch-1,wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/9900f65ef57294016f32ada111f35d0e1a0ab69b >--------------------------------------------------------------- commit 9900f65ef57294016f32ada111f35d0e1a0ab69b Merge: df0073e c5da0d2 Author: Gregory Collins Date: Sat Oct 10 08:41:50 2015 -0700 Merge pull request #62 from SeanRBurton/partition Improve the performance of `partition` for lazy and strict bytestrings >--------------------------------------------------------------- 9900f65ef57294016f32ada111f35d0e1a0ab69b Data/ByteString.hs | 46 +++++++++++++++++++++++++++++++++--------- Data/ByteString/Internal.hs | 2 +- Data/ByteString/Lazy.hs | 7 +++++-- bench/BenchAll.hs | 48 ++++++++++++++++++++++++++++++++++++++++++++ bench/bench-bytestring.cabal | 1 + 5 files changed, 92 insertions(+), 12 deletions(-) From git at git.haskell.org Tue May 3 22:43:32 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:43:32 +0000 (UTC) Subject: [commit: packages/bytestring] master, revert-46-patch-1, wip/nix-local-build: Radically reduce #ifdefs (9306e29) Message-ID: <20160503224332.C93D73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branches: master,revert-46-patch-1,wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/9306e2987b6ad889ddfc259b11e918a7828a35c1 >--------------------------------------------------------------- commit 9306e2987b6ad889ddfc259b11e918a7828a35c1 Author: Herbert Valerio Riedel Date: Sun Oct 18 10:35:07 2015 +0200 Radically reduce #ifdefs This assumes that __GLASGOW_HASKELL__ is 612 or later, as well as `base >= 4.2` (c.f. `bytestring.cabal`). >--------------------------------------------------------------- 9306e2987b6ad889ddfc259b11e918a7828a35c1 Data/ByteString.hs | 152 +-------------------- Data/ByteString/Builder/ASCII.hs | 4 +- Data/ByteString/Builder/Internal.hs | 10 +- .../Builder/Prim/Internal/UncheckedShifts.hs | 13 +- Data/ByteString/Char8.hs | 10 -- Data/ByteString/Internal.hs | 95 +------------ Data/ByteString/Lazy.hs | 12 -- Data/ByteString/Lazy/Char8.hs | 5 - Data/ByteString/Lazy/Internal.hs | 24 +--- Data/ByteString/Short/Internal.hs | 4 - Data/ByteString/Unsafe.hs | 22 --- tests/builder/Data/ByteString/Builder/Tests.hs | 6 - 12 files changed, 17 insertions(+), 340 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 9306e2987b6ad889ddfc259b11e918a7828a35c1 From git at git.haskell.org Tue May 3 22:43:34 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:43:34 +0000 (UTC) Subject: [commit: packages/bytestring] master, revert-46-patch-1, wip/nix-local-build: Merge pull request #63 from hvr/pr-de-cpp (dd3c07d) Message-ID: <20160503224334.D483D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branches: master,revert-46-patch-1,wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/dd3c07d115840d13482426a0084a39201eb6b6d4 >--------------------------------------------------------------- commit dd3c07d115840d13482426a0084a39201eb6b6d4 Merge: 9900f65 9306e29 Author: Duncan Coutts Date: Tue Oct 20 12:18:32 2015 +0100 Merge pull request #63 from hvr/pr-de-cpp Radically reduce #ifdefs >--------------------------------------------------------------- dd3c07d115840d13482426a0084a39201eb6b6d4 Data/ByteString.hs | 152 +-------------------- Data/ByteString/Builder/ASCII.hs | 4 +- Data/ByteString/Builder/Internal.hs | 10 +- .../Builder/Prim/Internal/UncheckedShifts.hs | 13 +- Data/ByteString/Char8.hs | 10 -- Data/ByteString/Internal.hs | 95 +------------ Data/ByteString/Lazy.hs | 12 -- Data/ByteString/Lazy/Char8.hs | 5 - Data/ByteString/Lazy/Internal.hs | 24 +--- Data/ByteString/Short/Internal.hs | 4 - Data/ByteString/Unsafe.hs | 22 --- tests/builder/Data/ByteString/Builder/Tests.hs | 6 - 12 files changed, 17 insertions(+), 340 deletions(-) From git at git.haskell.org Tue May 3 22:43:36 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:43:36 +0000 (UTC) Subject: [commit: packages/bytestring] master, revert-46-patch-1, wip/nix-local-build: Merge https://github.com/haskell/bytestring (1eff53d) Message-ID: <20160503224336.E6F5B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branches: master,revert-46-patch-1,wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/1eff53d49f4566416cf108a7a6d74e1b58280761 >--------------------------------------------------------------- commit 1eff53d49f4566416cf108a7a6d74e1b58280761 Merge: c72f64f dd3c07d Author: Sean Date: Mon Nov 2 15:33:27 2015 +0000 Merge https://github.com/haskell/bytestring Conflicts: Data/ByteString.hs bench/BenchAll.hs >--------------------------------------------------------------- 1eff53d49f4566416cf108a7a6d74e1b58280761 Data/ByteString.hs | 196 ++++----------------- Data/ByteString/Builder/ASCII.hs | 4 +- Data/ByteString/Builder/Internal.hs | 10 +- .../Builder/Prim/Internal/UncheckedShifts.hs | 13 +- Data/ByteString/Char8.hs | 12 +- Data/ByteString/Internal.hs | 95 +--------- Data/ByteString/Lazy.hs | 19 +- Data/ByteString/Lazy/Char8.hs | 5 - Data/ByteString/Lazy/Internal.hs | 24 +-- Data/ByteString/Short/Internal.hs | 4 - Data/ByteString/Unsafe.hs | 22 --- bench/BenchAll.hs | 54 +++++- bytestring.cabal | 1 + tests/builder/Data/ByteString/Builder/Tests.hs | 6 - 14 files changed, 107 insertions(+), 358 deletions(-) diff --cc bench/BenchAll.hs index c1a3f1f,1f8f69c..908af4e --- a/bench/BenchAll.hs +++ b/bench/BenchAll.hs @@@ -38,10 -38,8 +38,9 @@@ import qualified "bytestring" Data.Byte import Foreign - import Paths_bench_bytestring + import System.Random - import System.Random + ------------------------------------------------------------------------------ -- Benchmark support ------------------------------------------------------------------------------ @@@ -153,42 -151,30 +152,64 @@@ benchIntEncodingB n0 | n <= 0 = return op | otherwise = PI.runB w n op >>= loop (n - 1) - easySubstrings, randomSubstrings :: Int -> Int -> (S.ByteString, S.ByteString) - hardSubstrings, pathologicalSubstrings :: Int -> - Int -> (S.ByteString, S.ByteString) + hashInt :: Int -> Int + hashInt x = iterate step x !! 10 + where + step a = e + where b = (a `xor` 61) `xor` (a `shiftR` 16) + c = b + (b `shiftL` 3) + d = c `xor` (c `shiftR` 4) + e = d * 0x27d4eb2d + f = e `xor` (e `shiftR` 15) -hashWord8 :: Word8 -> Word8 -hashWord8 = fromIntegral . hashInt . fromIntegral - w :: Int -> Word8 w = fromIntegral ++hashWord8 :: Word8 -> Word8 ++hashWord8 = fromIntegral . hashInt . w ++ + partitionStrict p = nf (S.partition p) . randomStrict $ mkStdGen 98423098 + where randomStrict = fst . S.unfoldrN 10000 (Just . random) + + partitionLazy p = nf (L.partition p) . randomLazy $ (0, mkStdGen 98423098) - where step (k, g) - | k >= 10000 = Nothing - | otherwise = let (x, g') = random g in Just (x, (k + 1, g')) - randomLazy = L.unfoldr step ++ where step (k, g) ++ | k >= 10000 = Nothing ++ | otherwise = let (x, g') = random g in Just (x, (k + 1, g')) ++ randomLazy = L.unfoldr step ++ ++easySubstrings, randomSubstrings :: Int -> Int -> (S.ByteString, S.ByteString) ++hardSubstrings, pathologicalSubstrings :: Int -> ++ Int -> (S.ByteString, S.ByteString) ++ +{-# INLINE easySubstrings #-} +easySubstrings n h = (S.replicate n $ w 1, + S.replicate h $ w 0) + +{-# INLINE randomSubstrings #-} +randomSubstrings n h = (f 48278379 n, f 98403980 h) + where + next' g = let (x, g') = next g in (w x, g') + f g l = fst $ S.unfoldrN l (Just . next') (mkStdGen g) + +{-# INLINE hardSubstrings #-} +hardSubstrings n h = (f 48278379 n, f 98403980 h) + where + next' g = let (x, g') = next g + in (w $ x `mod` 4, g') + f g l = fst $ S.unfoldrN l (Just . next') (mkStdGen g) + +{-# INLINE pathologicalSubstrings #-} +pathologicalSubstrings n h = + (S.replicate n (w 0), + S.concat . replicate (h `div` n) $ S.replicate (n - 1) (w 0) `S.snoc` w 1) + +htmlSubstrings :: S.ByteString -> Int -> Int -> IO (S.ByteString, S.ByteString) +htmlSubstrings s n h = + do i <- randomRIO (0, l - n) + return (S.take n . S.drop i $ s', s') + where + s' = S.take h s + l = S.length s' -- benchmarks ------------- From git at git.haskell.org Tue May 3 22:43:38 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:43:38 +0000 (UTC) Subject: [commit: packages/bytestring] master, revert-46-patch-1, wip/nix-local-build: Fix build breakage. (de7331e) Message-ID: <20160503224338.F12C73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branches: master,revert-46-patch-1,wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/de7331e232c7502629a18f44a44c1f909ccccc39 >--------------------------------------------------------------- commit de7331e232c7502629a18f44a44c1f909ccccc39 Author: Sean Date: Mon Nov 2 15:58:01 2015 +0000 Fix build breakage. >--------------------------------------------------------------- de7331e232c7502629a18f44a44c1f909ccccc39 Data/ByteString.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Data/ByteString.hs b/Data/ByteString.hs index 9086f82..22afdf0 100644 --- a/Data/ByteString.hs +++ b/Data/ByteString.hs @@ -279,6 +279,11 @@ import GHC.Prim (Word#) import GHC.Base (build) import GHC.Word hiding (Word8) +#if !(MIN_VERSION_BASE(4,7,0)) +finiteBitSize :: Bits a => a -> Int +finiteBitSize = bitSize +#endif + -- ----------------------------------------------------------------------------- -- Introducing and eliminating 'ByteString's From git at git.haskell.org Tue May 3 22:43:41 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:43:41 +0000 (UTC) Subject: [commit: packages/bytestring] master, revert-46-patch-1, wip/nix-local-build: Further fix. (a07f7cc) Message-ID: <20160503224341.07D1C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branches: master,revert-46-patch-1,wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/a07f7cceecb88010e9aedfdb77b95c241f44fa57 >--------------------------------------------------------------- commit a07f7cceecb88010e9aedfdb77b95c241f44fa57 Author: Sean Date: Mon Nov 2 16:09:58 2015 +0000 Further fix. >--------------------------------------------------------------- a07f7cceecb88010e9aedfdb77b95c241f44fa57 Data/ByteString.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Data/ByteString.hs b/Data/ByteString.hs index 22afdf0..18cabcc 100644 --- a/Data/ByteString.hs +++ b/Data/ByteString.hs @@ -279,7 +279,7 @@ import GHC.Prim (Word#) import GHC.Base (build) import GHC.Word hiding (Word8) -#if !(MIN_VERSION_BASE(4,7,0)) +#if !(MIN_VERSION_base(4,7,0)) finiteBitSize :: Bits a => a -> Int finiteBitSize = bitSize #endif From git at git.haskell.org Tue May 3 22:43:43 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:43:43 +0000 (UTC) Subject: [commit: packages/bytestring] master, revert-46-patch-1, wip/nix-local-build: import `Bits` typeclass. (de2bdd0) Message-ID: <20160503224343.13C6E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branches: master,revert-46-patch-1,wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/de2bdd04705e30f7e8255213585f832714780e7b >--------------------------------------------------------------- commit de2bdd04705e30f7e8255213585f832714780e7b Author: Sean Date: Mon Nov 2 16:19:43 2015 +0000 import `Bits` typeclass. >--------------------------------------------------------------- de2bdd04705e30f7e8255213585f832714780e7b Data/ByteString.hs | 2 +- tests/Properties.hs | 114 ++++++++++++++++++++++++++-------------------------- 2 files changed, 58 insertions(+), 58 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc de2bdd04705e30f7e8255213585f832714780e7b From git at git.haskell.org Tue May 3 22:43:45 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:43:45 +0000 (UTC) Subject: [commit: packages/bytestring] master, revert-46-patch-1, wip/nix-local-build: Fix import issue. (820a522) Message-ID: <20160503224345.221483A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branches: master,revert-46-patch-1,wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/820a522c112d41d44088952f6f3830cbcadb0393 >--------------------------------------------------------------- commit 820a522c112d41d44088952f6f3830cbcadb0393 Author: Sean Date: Mon Nov 2 16:33:57 2015 +0000 Fix import issue. >--------------------------------------------------------------- 820a522c112d41d44088952f6f3830cbcadb0393 Data/ByteString.hs | 3 +- tests/Properties.hs | 115 ++++++++++++++++++++++++++-------------------------- 2 files changed, 59 insertions(+), 59 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 820a522c112d41d44088952f6f3830cbcadb0393 From git at git.haskell.org Tue May 3 22:43:47 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:43:47 +0000 (UTC) Subject: [commit: packages/bytestring] master, revert-46-patch-1, wip/nix-local-build: Merge pull request #57 from SeanRBurton/master (bc796f1) Message-ID: <20160503224347.3607A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branches: master,revert-46-patch-1,wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/bc796f1f3708b40f6dce07995a91d479d7728863 >--------------------------------------------------------------- commit bc796f1f3708b40f6dce07995a91d479d7728863 Merge: dd3c07d 820a522 Author: Gregory Collins Date: Mon Nov 2 11:46:16 2015 -0800 Merge pull request #57 from SeanRBurton/master Implement Rabin-Karp substring search. >--------------------------------------------------------------- bc796f1f3708b40f6dce07995a91d479d7728863 Data/ByteString.hs | 91 +++++- bench/BenchAll.hs | 124 +++++++- bench/bench-bytestring.cabal | 2 + bench/wiki-haskell.html | 674 +++++++++++++++++++++++++++++++++++++++++++ tests/Properties.hs | 1 + 5 files changed, 871 insertions(+), 21 deletions(-) From git at git.haskell.org Tue May 3 22:43:49 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:43:49 +0000 (UTC) Subject: [commit: packages/bytestring] master, revert-46-patch-1, wip/nix-local-build: silence redundant import warning (7f4389c) Message-ID: <20160503224349.4256A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branches: master,revert-46-patch-1,wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/7f4389c4b13032f7e59cb71c90c5e3ad37348606 >--------------------------------------------------------------- commit 7f4389c4b13032f7e59cb71c90c5e3ad37348606 Author: Herbert Valerio Riedel Date: Sat Nov 28 21:17:34 2015 +0100 silence redundant import warning >--------------------------------------------------------------- 7f4389c4b13032f7e59cb71c90c5e3ad37348606 Data/ByteString.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Data/ByteString.hs b/Data/ByteString.hs index f522807..ddc96f3 100644 --- a/Data/ByteString.hs +++ b/Data/ByteString.hs @@ -229,7 +229,7 @@ import Data.ByteString.Unsafe import qualified Data.List as List import Data.Word (Word8) -import Data.Maybe (isJust, listToMaybe) +import Data.Maybe (isJust) import Control.Exception (finally, bracket, assert, throwIO) import Control.Monad (when) From git at git.haskell.org Tue May 3 22:43:51 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:43:51 +0000 (UTC) Subject: [commit: packages/bytestring] master, revert-46-patch-1, wip/nix-local-build: Define Semigroup instances for base>=4.9 (21b18ec) Message-ID: <20160503224351.4B6D53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branches: master,revert-46-patch-1,wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/21b18ec8707211c58321d96b07d0d1fcce98930d >--------------------------------------------------------------- commit 21b18ec8707211c58321d96b07d0d1fcce98930d Author: Herbert Valerio Riedel Date: Sat Nov 28 21:39:19 2015 +0100 Define Semigroup instances for base>=4.9 See https://github.com/ekmett/semigroups/issues/56 for more details >--------------------------------------------------------------- 21b18ec8707211c58321d96b07d0d1fcce98930d Data/ByteString/Builder/Internal.hs | 13 +++++++++++++ Data/ByteString/Internal.hs | 12 ++++++++++++ Data/ByteString/Lazy/Internal.hs | 12 ++++++++++++ Data/ByteString/Short/Internal.hs | 12 ++++++++++++ 4 files changed, 49 insertions(+) diff --git a/Data/ByteString/Builder/Internal.hs b/Data/ByteString/Builder/Internal.hs index 90512e7..f5a2509 100644 --- a/Data/ByteString/Builder/Internal.hs +++ b/Data/ByteString/Builder/Internal.hs @@ -130,6 +130,9 @@ module Data.ByteString.Builder.Internal ( import Control.Arrow (second) +#if MIN_VERSION_base(4,9,0) +import Data.Semigroup (Semigroup((<>))) +#endif #if !(MIN_VERSION_base(4,8,0)) import Data.Monoid import Control.Applicative (Applicative(..),(<$>)) @@ -399,11 +402,21 @@ empty = Builder (\cont -> (\range -> cont range)) append :: Builder -> Builder -> Builder append (Builder b1) (Builder b2) = Builder $ b1 . b2 +#if MIN_VERSION_base(4,9,0) +instance Semigroup Builder where + {-# INLINE (<>) #-} + (<>) = append +#endif + instance Monoid Builder where {-# INLINE mempty #-} mempty = empty {-# INLINE mappend #-} +#if MIN_VERSION_base(4,9,0) + mappend = (<>) +#else mappend = append +#endif {-# INLINE mconcat #-} mconcat = foldr mappend mempty diff --git a/Data/ByteString/Internal.hs b/Data/ByteString/Internal.hs index 02ba01e..2565a49 100644 --- a/Data/ByteString/Internal.hs +++ b/Data/ByteString/Internal.hs @@ -89,6 +89,9 @@ import Foreign.C.Types (CInt, CSize, CULong) #endif import Foreign.C.String (CString) +#if MIN_VERSION_base(4,9,0) +import Data.Semigroup (Semigroup((<>))) +#endif #if !(MIN_VERSION_base(4,8,0)) import Data.Monoid (Monoid(..)) #endif @@ -150,9 +153,18 @@ instance Eq ByteString where instance Ord ByteString where compare = compareBytes +#if MIN_VERSION_base(4,9,0) +instance Semigroup ByteString where + (<>) = append +#endif + instance Monoid ByteString where mempty = PS nullForeignPtr 0 0 +#if MIN_VERSION_base(4,9,0) + mappend = (<>) +#else mappend = append +#endif mconcat = concat instance NFData ByteString where diff --git a/Data/ByteString/Lazy/Internal.hs b/Data/ByteString/Lazy/Internal.hs index 2d71732..964f23b 100644 --- a/Data/ByteString/Lazy/Internal.hs +++ b/Data/ByteString/Lazy/Internal.hs @@ -51,6 +51,9 @@ import qualified Data.ByteString as S (length, take, drop) import Data.Word (Word8) import Foreign.Storable (Storable(sizeOf)) +#if MIN_VERSION_base(4,9,0) +import Data.Semigroup (Semigroup((<>))) +#endif #if !(MIN_VERSION_base(4,8,0)) import Data.Monoid (Monoid(..)) #endif @@ -77,9 +80,18 @@ instance Eq ByteString where instance Ord ByteString where compare = cmp +#if MIN_VERSION_base(4,9,0) +instance Semigroup ByteString where + (<>) = append +#endif + instance Monoid ByteString where mempty = Empty +#if MIN_VERSION_base(4,9,0) + mappend = (<>) +#else mappend = append +#endif mconcat = concat instance NFData ByteString where diff --git a/Data/ByteString/Short/Internal.hs b/Data/ByteString/Short/Internal.hs index 1946271..15308d6 100644 --- a/Data/ByteString/Short/Internal.hs +++ b/Data/ByteString/Short/Internal.hs @@ -40,6 +40,9 @@ import Data.ByteString.Internal (ByteString(..), accursedUnutterablePerformIO) import Data.Typeable (Typeable) import Data.Data (Data(..), mkNoRepType) +#if MIN_VERSION_base(4,9,0) +import Data.Semigroup (Semigroup((<>))) +#endif import Data.Monoid (Monoid(..)) import Data.String (IsString(..)) import Control.DeepSeq (NFData(..)) @@ -131,9 +134,18 @@ instance Eq ShortByteString where instance Ord ShortByteString where compare = compareBytes +#if MIN_VERSION_base(4,9,0) +instance Semigroup ShortByteString where + (<>) = append +#endif + instance Monoid ShortByteString where mempty = empty +#if MIN_VERSION_base(4,9,0) + mappend = (<>) +#else mappend = append +#endif mconcat = concat instance NFData ShortByteString where From git at git.haskell.org Tue May 3 22:43:53 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:43:53 +0000 (UTC) Subject: [commit: packages/bytestring] master, revert-46-patch-1, wip/nix-local-build: Merge pull request #64 from hvr/pr/semigroups (37af688) Message-ID: <20160503224353.5609D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branches: master,revert-46-patch-1,wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/37af68852dcbc7432eec59cf43eaf85fb0bb2110 >--------------------------------------------------------------- commit 37af68852dcbc7432eec59cf43eaf85fb0bb2110 Merge: 7f4389c 21b18ec Author: Duncan Coutts Date: Mon Nov 30 11:13:03 2015 +0000 Merge pull request #64 from hvr/pr/semigroups Define Semigroup instances for base>=4.9 >--------------------------------------------------------------- 37af68852dcbc7432eec59cf43eaf85fb0bb2110 Data/ByteString/Builder/Internal.hs | 13 +++++++++++++ Data/ByteString/Internal.hs | 12 ++++++++++++ Data/ByteString/Lazy/Internal.hs | 12 ++++++++++++ Data/ByteString/Short/Internal.hs | 12 ++++++++++++ 4 files changed, 49 insertions(+) From git at git.haskell.org Tue May 3 22:43:55 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:43:55 +0000 (UTC) Subject: [commit: packages/bytestring] master, revert-46-patch-1, wip/nix-local-build: Bump to odd 0.10.7.0 version (994a845) Message-ID: <20160503224355.5E43C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branches: master,revert-46-patch-1,wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/994a8459820a945fde532befc677b05532789367 >--------------------------------------------------------------- commit 994a8459820a945fde532befc677b05532789367 Author: Herbert Valerio Riedel Date: Mon Nov 30 12:23:37 2015 +0100 Bump to odd 0.10.7.0 version This way snapshot builds of GHC HEAD will advertise clearly that `bytestring` is a dev snapshot >--------------------------------------------------------------- 994a8459820a945fde532befc677b05532789367 bytestring.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bytestring.cabal b/bytestring.cabal index 87b05c3..9aa4639 100644 --- a/bytestring.cabal +++ b/bytestring.cabal @@ -1,5 +1,5 @@ Name: bytestring -Version: 0.10.6.0 +Version: 0.10.7.0 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 Tue May 3 22:43:57 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:43:57 +0000 (UTC) Subject: [commit: packages/bytestring] master, revert-46-patch-1, wip/nix-local-build: Revert "`cabal repl` error" (30d8508) Message-ID: <20160503224357.66B453A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branches: master,revert-46-patch-1,wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/30d850803fd4834eafd60ecef95d1cabe2711d5a >--------------------------------------------------------------- commit 30d850803fd4834eafd60ecef95d1cabe2711d5a Author: Duncan Coutts Date: Wed Dec 2 11:39:52 2015 +0000 Revert "`cabal repl` error" >--------------------------------------------------------------- 30d850803fd4834eafd60ecef95d1cabe2711d5a bytestring.cabal | 1 - 1 file changed, 1 deletion(-) diff --git a/bytestring.cabal b/bytestring.cabal index 9aa4639..5c732e3 100644 --- a/bytestring.cabal +++ b/bytestring.cabal @@ -125,7 +125,6 @@ library -fmax-simplifier-iterations=10 -fdicts-cheap -fspec-constr-count=6 - -fobject-code c-sources: cbits/fpstring.c cbits/itoa.c From git at git.haskell.org Tue May 3 22:43:59 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:43:59 +0000 (UTC) Subject: [commit: packages/bytestring] master, wip/nix-local-build: Merge pull request #66 from haskell/revert-46-patch-1 (84d0416) Message-ID: <20160503224359.6F6AB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branches: master,wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/84d041649c39e7dc0fe8d348da10d6ed1679a8f9 >--------------------------------------------------------------- commit 84d041649c39e7dc0fe8d348da10d6ed1679a8f9 Merge: 994a845 30d8508 Author: Duncan Coutts Date: Wed Dec 2 11:40:38 2015 +0000 Merge pull request #66 from haskell/revert-46-patch-1 Revert "`cabal repl` error" Turns out it breaks the GHC testsuite. >--------------------------------------------------------------- 84d041649c39e7dc0fe8d348da10d6ed1679a8f9 bytestring.cabal | 1 - 1 file changed, 1 deletion(-) From git at git.haskell.org Tue May 3 22:44:01 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:44:01 +0000 (UTC) Subject: [commit: packages/bytestring] master, wip/nix-local-build: Implement `stripPrefix`/`stripSuffix` (e17d3de) Message-ID: <20160503224401.7EAA03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branches: master,wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/e17d3de26aff58f0a17e98672fcbf516368b3dd7 >--------------------------------------------------------------- commit e17d3de26aff58f0a17e98672fcbf516368b3dd7 Author: Mario Bla?evi? Date: Mon Sep 21 19:46:21 2015 -0400 Implement `stripPrefix`/`stripSuffix` This fixes #49 and closes #60 >--------------------------------------------------------------- e17d3de26aff58f0a17e98672fcbf516368b3dd7 Data/ByteString.hs | 18 +++++++++++++++++ Data/ByteString/Char8.hs | 3 +++ Data/ByteString/Lazy.hs | 22 +++++++++++++++++++++ Data/ByteString/Lazy/Char8.hs | 3 +++ tests/Properties.hs | 46 ++++++++++++++++++++++++++++++++++++++++++- 5 files changed, 91 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 e17d3de26aff58f0a17e98672fcbf516368b3dd7 From git at git.haskell.org Tue May 3 22:44:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:44:03 +0000 (UTC) Subject: [commit: packages/bytestring] master, wip/nix-local-build: Allow newer versions of dlist/mtl for testsuite (d562ea9) Message-ID: <20160503224403.8794F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branches: master,wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/d562ea96bb0425d07a99851f696d59bc144c0258 >--------------------------------------------------------------- commit d562ea96bb0425d07a99851f696d59bc144c0258 Author: Herbert Valerio Riedel Date: Mon Mar 28 16:42:42 2016 +0200 Allow newer versions of dlist/mtl for testsuite >--------------------------------------------------------------- d562ea96bb0425d07a99851f696d59bc144c0258 bytestring.cabal | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bytestring.cabal b/bytestring.cabal index 5c732e3..bc9d8a4 100644 --- a/bytestring.cabal +++ b/bytestring.cabal @@ -200,9 +200,9 @@ test-suite test-builder deepseq, QuickCheck >= 2.4, byteorder == 1.0.*, - dlist == 0.5.*, + dlist >= 0.5 && < 0.8, directory, - mtl >= 2.0 && < 2.2, + mtl >= 2.0 && < 2.3, HUnit, test-framework, test-framework-hunit, From git at git.haskell.org Tue May 3 22:44:05 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:44:05 +0000 (UTC) Subject: [commit: packages/bytestring] master, wip/nix-local-build: Cleanup whitespace and dead code (3d6d0f6) Message-ID: <20160503224405.921AC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branches: master,wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/3d6d0f60ac25736cc87a6f598886fe77e7b6ad90 >--------------------------------------------------------------- commit 3d6d0f60ac25736cc87a6f598886fe77e7b6ad90 Author: Ben Gamari Date: Thu Mar 24 12:24:12 2016 +0100 Cleanup whitespace and dead code >--------------------------------------------------------------- 3d6d0f60ac25736cc87a6f598886fe77e7b6ad90 Data/ByteString.hs | 0 Data/ByteString/Char8.hs | 22 ---------------------- 2 files changed, 22 deletions(-) diff --git a/Data/ByteString/Char8.hs b/Data/ByteString/Char8.hs index 2f7c250..1d35357 100644 --- a/Data/ByteString/Char8.hs +++ b/Data/ByteString/Char8.hs @@ -571,28 +571,6 @@ breakEnd :: (Char -> Bool) -> ByteString -> (ByteString, ByteString) breakEnd f = B.breakEnd (f . w2c) {-# INLINE breakEnd #-} -{- --- | 'breakChar' breaks its ByteString argument at the first occurence --- of the specified Char. It is more efficient than 'break' as it is --- implemented with @memchr(3)@. I.e. --- --- > break (=='c') "abcd" == breakChar 'c' "abcd" --- -breakChar :: Char -> ByteString -> (ByteString, ByteString) -breakChar = B.breakByte . c2w -{-# INLINE breakChar #-} - --- | 'spanChar' breaks its ByteString argument at the first --- occurence of a Char other than its argument. It is more efficient --- than 'span (==)' --- --- > span (=='c') "abcd" == spanByte 'c' "abcd" --- -spanChar :: Char -> ByteString -> (ByteString, ByteString) -spanChar = B.spanByte . c2w -{-# INLINE spanChar #-} --} - -- | /O(n)/ Break a 'ByteString' into pieces separated by the byte -- argument, consuming the delimiter. I.e. -- From git at git.haskell.org Tue May 3 22:44:07 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:44:07 +0000 (UTC) Subject: [commit: packages/bytestring] master, wip/nix-local-build: Fix breakByte and spanByte rewrite rules (4b97b6d) Message-ID: <20160503224407.9CFE03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branches: master,wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/4b97b6d0854c86f5c7acf3df40d5e22a0acf74e4 >--------------------------------------------------------------- commit 4b97b6d0854c86f5c7acf3df40d5e22a0acf74e4 Author: Ben Gamari Date: Tue Mar 8 17:53:50 2016 +0100 Fix breakByte and spanByte rewrite rules Previously these were matching on (==), which was rewritten by the class op rule before the breakByte rule had an opportunity to fire (#70). Unfortunately fixing this requires that we change the Eq instances provided by GHC. This has been done in GHC 8.0.1 (base-4.9.0). >--------------------------------------------------------------- 4b97b6d0854c86f5c7acf3df40d5e22a0acf74e4 Data/ByteString.hs | 36 ++++++++++++++++++++++++++++-------- Data/ByteString/Char8.hs | 18 ++++++++++++++++-- 2 files changed, 44 insertions(+), 10 deletions(-) diff --git a/Data/ByteString.hs b/Data/ByteString.hs index 9d73593..54d96e7 100644 --- a/Data/ByteString.hs +++ b/Data/ByteString.hs @@ -852,12 +852,22 @@ break :: (Word8 -> Bool) -> ByteString -> (ByteString, ByteString) break p ps = case findIndexOrEnd p ps of n -> (unsafeTake n ps, unsafeDrop n ps) {-# INLINE [1] break #-} +-- See bytestring #70 +#if MIN_VERSION_base(4,9,0) {-# RULES -"ByteString specialise break (x==)" forall x. - break ((==) x) = breakByte x -"ByteString specialise break (==x)" forall x. - break (==x) = breakByte x +"ByteString specialise break (x ==)" forall x. + break (x `eqWord8`) = breakByte x +"ByteString specialise break (== x)" forall x. + break (`eqWord8` x) = breakByte x #-} +#else +{-# RULES +"ByteString specialise break (x ==)" forall x. + break (x ==) = breakByte x +"ByteString specialise break (== x)" forall x. + break (== x) = breakByte x + #-} +#endif -- INTERNAL: @@ -905,12 +915,22 @@ spanByte c ps@(PS x s l) = else go p (i+1) {-# INLINE spanByte #-} +-- See bytestring #70 +#if MIN_VERSION_base(4,9,0) {-# RULES -"ByteString specialise span (x==)" forall x. - span ((==) x) = spanByte x -"ByteString specialise span (==x)" forall x. - span (==x) = spanByte x +"ByteString specialise span (x ==)" forall x. + span (x `eqWord8`) = spanByte x +"ByteString specialise span (== x)" forall x. + span (`eqWord8` x) = spanByte x #-} +#else +{-# RULES +"ByteString specialise span (x ==)" forall x. + span (x ==) = spanByte x +"ByteString specialise span (== x)" forall x. + span (== x) = spanByte x + #-} +#endif -- | 'spanEnd' behaves like 'span' but from the end of the 'ByteString'. -- We have diff --git a/Data/ByteString/Char8.hs b/Data/ByteString/Char8.hs index c153655..2f7c250 100644 --- a/Data/ByteString/Char8.hs +++ b/Data/ByteString/Char8.hs @@ -257,6 +257,10 @@ import Data.ByteString (empty,null,length,tail,init,append import Data.ByteString.Internal import Data.Char ( isSpace ) +#if MIN_VERSION_base(4,9,0) +-- See bytestring #70 +import GHC.Char (eqChar) +#endif import qualified Data.List as List (intersperse) import System.IO (Handle,stdout,openBinaryFile,hClose,hFileSize,IOMode(..)) @@ -508,12 +512,22 @@ break :: (Char -> Bool) -> ByteString -> (ByteString, ByteString) break f = B.break (f . w2c) {-# INLINE [1] break #-} +-- See bytestring #70 +#if MIN_VERSION_base(4,9,0) +{-# RULES +"ByteString specialise break (x==)" forall x. + break (x `eqChar`) = breakChar x +"ByteString specialise break (==x)" forall x. + break (`eqChar` x) = breakChar x + #-} +#else {-# RULES "ByteString specialise break (x==)" forall x. - break ((==) x) = breakChar x + break (x ==) = breakChar x "ByteString specialise break (==x)" forall x. - break (==x) = breakChar x + break (== x) = breakChar x #-} +#endif -- INTERNAL: From git at git.haskell.org Tue May 3 22:44:09 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:44:09 +0000 (UTC) Subject: [commit: packages/bytestring] wip/nix-local-build: Migrate to nix-local-build based .travis.yml (72d21b9) Message-ID: <20160503224409.A5D8A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/72d21b945addd6c1ca5b2403ec28eba5ed3fb8c5 >--------------------------------------------------------------- commit 72d21b945addd6c1ca5b2403ec28eba5ed3fb8c5 Author: Herbert Valerio Riedel Date: Wed Apr 13 16:47:47 2016 +0200 Migrate to nix-local-build based .travis.yml >--------------------------------------------------------------- 72d21b945addd6c1ca5b2403ec28eba5ed3fb8c5 .travis.yml | 98 +++++++++++++++++++++++++++++++++++++---------------------- cabal.project | 1 + 2 files changed, 62 insertions(+), 37 deletions(-) diff --git a/.travis.yml b/.travis.yml index 421cfff..05f2f17 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,47 +1,71 @@ -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.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=head CABALVER=1.20 +# This file has been generated by `make_travis_yml_2.hs` +# see https://github.com/hvr/multi-ghc-travis for more information +language: c +sudo: false + +cache: + directories: + - $HOME/.cabal/packages + - $HOME/.cabal/store + +before_cache: + - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log + - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.tar matrix: - allow_failures: - - env: GHCVER=head CABALVER=1.20 + include: + - env: CABALVER=1.24 GHCVER=7.4.2 + compiler: ": #GHC 7.4.2" + addons: {apt: {packages: [cabal-install-1.24,ghc-7.4.2], sources: [hvr-ghc]}} + - env: CABALVER=1.24 GHCVER=7.6.3 + compiler: ": #GHC 7.6.3" + addons: {apt: {packages: [cabal-install-1.24,ghc-7.6.3], sources: [hvr-ghc]}} + - env: CABALVER=1.24 GHCVER=7.8.4 + compiler: ": #GHC 7.8.4" + addons: {apt: {packages: [cabal-install-1.24,ghc-7.8.4], sources: [hvr-ghc]}} + - env: CABALVER=1.24 GHCVER=7.10.1 + compiler: ": #GHC 7.10.1" + addons: {apt: {packages: [cabal-install-1.24,ghc-7.10.1], sources: [hvr-ghc]}} before_install: - - travis_retry sudo add-apt-repository -y ppa:hvr/ghc - - travis_retry sudo apt-get update - - travis_retry sudo apt-get install cabal-install-$CABALVER ghc-$GHCVER + - unset CC - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH - - cabal --version 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 --version + - BENCH=${BENCH---enable-benchmarks} + - TEST=${TEST---enable-tests} + - 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 new-build ${TEST} ${BENCH} --dep +# 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: - - cabal configure --enable-tests -v2 - - cabal build - # --show-details=streaming is available for CABALVER>=1.20 only - - if [ "$(echo -e "1.20\n$CABALVER" | sort -rV | head -n1)" = "$CABALVER" ]; then - cabal test --show-details=streaming; - else - cabal test --show-details=always; - fi - - cabal sdist - # "cabal check" disabled due to -O2 warning - - export SRC_TGZ=$(cabal info . | awk '{print $2 ".tar.gz";exit}') ; - cd dist/; - if [ -f "$SRC_TGZ" ]; then - cabal install "$SRC_TGZ"; - else - echo "expected '$SRC_TGZ' not found"; - exit 1; - fi + - if [ -f configure.ac ]; then autoreconf -i; fi + # this builds all libraries and executables (including tests/benchmarks) + - cabal new-build ${TEST} ${BENCH} -v2 # -v2 provides useful information for debugging + + # there's no 'cabal new-test' yet, so let's emulate for now + - TESTS=( $(awk 'tolower($0) ~ /^test-suite / { print $2 }' *.cabal) ); + RC=true; for T in ${TESTS[@]}; do echo "== $T =="; + if dist-newstyle/build/*/build/$T/$T; then echo "= $T OK ="; + else echo "= $T FAILED ="; RC=false; fi; done; $RC + - cabal sdist # test that a source-distribution can be generated + + # Check that the resulting source distribution can be built w/o and w tests + - SRC_BASENAME=$(cabal info . | awk '{print $2;exit}') + - tar -C dist/ -xf dist/$SRC_BASENAME.tar.gz + - "echo 'packages: *.cabal' > dist/$SRC_BASENAME/cabal.project" + - cd dist/$SRC_BASENAME/ + - cabal new-build --disable-tests --disable-benchmarks + - rm -rf ./dist-newstyle + - cabal new-build ${TEST} ${BENCH} +# EOF diff --git a/cabal.project b/cabal.project new file mode 100644 index 0000000..0d7f076 --- /dev/null +++ b/cabal.project @@ -0,0 +1 @@ +packages: *.cabal From git at git.haskell.org Tue May 3 22:44:11 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:44:11 +0000 (UTC) Subject: [commit: packages/bytestring] wip/nix-local-build: update tested-with (7c4d175) Message-ID: <20160503224411.B06F63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : wip/nix-local-build Link : http://git.haskell.org/packages/bytestring.git/commitdiff/7c4d17585f2698a3bfc97437b0678c25540df2d3 >--------------------------------------------------------------- commit 7c4d17585f2698a3bfc97437b0678c25540df2d3 Author: Herbert Valerio Riedel Date: Wed Apr 13 16:53:40 2016 +0200 update tested-with >--------------------------------------------------------------- 7c4d17585f2698a3bfc97437b0678c25540df2d3 .travis.yml | 9 ++++++--- bytestring.cabal | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 05f2f17..75df119 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,9 +23,12 @@ matrix: - env: CABALVER=1.24 GHCVER=7.8.4 compiler: ": #GHC 7.8.4" addons: {apt: {packages: [cabal-install-1.24,ghc-7.8.4], sources: [hvr-ghc]}} - - env: CABALVER=1.24 GHCVER=7.10.1 - compiler: ": #GHC 7.10.1" - addons: {apt: {packages: [cabal-install-1.24,ghc-7.10.1], sources: [hvr-ghc]}} + - env: CABALVER=1.24 GHCVER=7.10.3 + compiler: ": #GHC 7.10.3" + addons: {apt: {packages: [cabal-install-1.24,ghc-7.10.3], sources: [hvr-ghc]}} + - env: CABALVER=1.24 GHCVER=8.0.1 + compiler: ": #GHC 8.0.1" + addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.1], sources: [hvr-ghc]}} before_install: - unset CC diff --git a/bytestring.cabal b/bytestring.cabal index bc9d8a4..da92c4d 100644 --- a/bytestring.cabal +++ b/bytestring.cabal @@ -54,7 +54,7 @@ Author: Don Stewart, Maintainer: Duncan Coutts Homepage: https://github.com/haskell/bytestring Bug-reports: https://github.com/haskell/bytestring/issues -Tested-With: GHC==7.10.1, GHC==7.8.4, GHC==7.6.3, GHC==7.4.2, GHC==6.12.3 +Tested-With: GHC==8.0.1, GHC==7.10.3, GHC==7.8.4, GHC==7.6.3, GHC==7.4.2, GHC==6.12.3 Build-Type: Simple Cabal-Version: >= 1.10 extra-source-files: README.md Changelog.md From git at git.haskell.org Tue May 3 22:44:13 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:44:13 +0000 (UTC) Subject: [commit: packages/bytestring] master: Bump version to "even" 0.10.8.0 version (717f115) Message-ID: <20160503224413.B97933A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : master Link : http://git.haskell.org/packages/bytestring.git/commitdiff/717f1151751fceb4e49874737dd0f15839ffd541 >--------------------------------------------------------------- commit 717f1151751fceb4e49874737dd0f15839ffd541 Author: Herbert Valerio Riedel Date: Wed Apr 20 23:08:55 2016 +0200 Bump version to "even" 0.10.8.0 version This is done now in order for GHC 8.0.1 RC4 (which is about to be cut) to advertise the proper even version of `bytestring` >--------------------------------------------------------------- 717f1151751fceb4e49874737dd0f15839ffd541 bytestring.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bytestring.cabal b/bytestring.cabal index bc9d8a4..acf6ef1 100644 --- a/bytestring.cabal +++ b/bytestring.cabal @@ -1,5 +1,5 @@ Name: bytestring -Version: 0.10.7.0 +Version: 0.10.8.0 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 Tue May 3 22:44:15 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:44:15 +0000 (UTC) Subject: [commit: packages/bytestring] master: Update changelog for 0.10.8.0 (0ee4596) Message-ID: <20160503224415.C2A223A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : master Link : http://git.haskell.org/packages/bytestring.git/commitdiff/0ee45965232f6838d5bbbf9f0fe666a32a79a6da >--------------------------------------------------------------- commit 0ee45965232f6838d5bbbf9f0fe666a32a79a6da Author: Duncan Coutts Date: Tue May 3 23:40:35 2016 +0100 Update changelog for 0.10.8.0 >--------------------------------------------------------------- 0ee45965232f6838d5bbbf9f0fe666a32a79a6da Changelog.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Changelog.md b/Changelog.md index 5f4e644..f162650 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,9 @@ +0.10.8.0 Duncan Coutts May 2016 + + * Use Rabin-Karp substring search for `breakSubstring` and `findSubstring` + * Improve the performance of `partition` for lazy and strict bytestrings + * Added `stripPrefix` and `stripSuffix` for lazy and strict bytestrings + * Fix building with ghc 8.0 & base 4.9 (Semigroup etc) 0.10.6.0 Duncan Coutts Mar 2015 From git at git.haskell.org Tue May 3 22:44:52 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:44:52 +0000 (UTC) Subject: [commit: ghc] master: Update bytestring submodule to 0.10.8.0 release tag (4466ae6) Message-ID: <20160503224452.E443B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4466ae6451b9d4ecf5fbb6851c41b00c60ec7d5c/ghc >--------------------------------------------------------------- commit 4466ae6451b9d4ecf5fbb6851c41b00c60ec7d5c Author: Herbert Valerio Riedel Date: Wed May 4 00:45:43 2016 +0200 Update bytestring submodule to 0.10.8.0 release tag >--------------------------------------------------------------- 4466ae6451b9d4ecf5fbb6851c41b00c60ec7d5c libraries/bytestring | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/bytestring b/libraries/bytestring index 3d6d0f6..0ee4596 160000 --- a/libraries/bytestring +++ b/libraries/bytestring @@ -1 +1 @@ -Subproject commit 3d6d0f60ac25736cc87a6f598886fe77e7b6ad90 +Subproject commit 0ee45965232f6838d5bbbf9f0fe666a32a79a6da From git at git.haskell.org Tue May 3 22:46:15 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 3 May 2016 22:46:15 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Update bytestring submodule to 0.10.8.0 release tag (0ab1a6a) Message-ID: <20160503224615.ABC823A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/0ab1a6af5a7a87c36cbc0618af92c45b6c0bd109/ghc >--------------------------------------------------------------- commit 0ab1a6af5a7a87c36cbc0618af92c45b6c0bd109 Author: Herbert Valerio Riedel Date: Wed May 4 00:45:43 2016 +0200 Update bytestring submodule to 0.10.8.0 release tag (cherry picked from commit 4466ae6451b9d4ecf5fbb6851c41b00c60ec7d5c) >--------------------------------------------------------------- 0ab1a6af5a7a87c36cbc0618af92c45b6c0bd109 libraries/bytestring | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/bytestring b/libraries/bytestring index 717f115..0ee4596 160000 --- a/libraries/bytestring +++ b/libraries/bytestring @@ -1 +1 @@ -Subproject commit 717f1151751fceb4e49874737dd0f15839ffd541 +Subproject commit 0ee45965232f6838d5bbbf9f0fe666a32a79a6da From git at git.haskell.org Wed May 4 01:16:18 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 4 May 2016 01:16:18 +0000 (UTC) Subject: [commit: ghc] branch 'wip/erikd/t11978b' created Message-ID: <20160504011618.3AE533A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/erikd/t11978b Referencing: bc07fe011abb2defaa9e3a4721f9de9e3a036835 From git at git.haskell.org Wed May 4 01:16:21 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 4 May 2016 01:16:21 +0000 (UTC) Subject: [commit: ghc] wip/erikd/t11978b: rts: Specialize `overwritingClosure` for `MSG_THROWTO` (bc07fe0) Message-ID: <20160504011621.65C223A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/t11978b Link : http://ghc.haskell.org/trac/ghc/changeset/bc07fe011abb2defaa9e3a4721f9de9e3a036835/ghc >--------------------------------------------------------------- commit bc07fe011abb2defaa9e3a4721f9de9e3a036835 Author: Erik de Castro Lopo Date: Tue May 3 21:13:17 2016 +1000 rts: Specialize `overwritingClosure` for `MSG_THROWTO` The function `executeMessage` replaces the `header.info` pointer with a `WHITEHOLE` passes it to `throwToMsg` and then passes it to `doneWithMsgThrowTo` which calls `overwritingClosure` on it. However, `overwritingClosure` needs to know the size of the closure which is based on the `header.info` pointer. Unfortunately, the `header.info` pointer can't be reset to `MSG_THROWTO` or it might cause race conditions. The solution suggested by Simon Marlow is to add and use a function `overwritingClosureWithSize` that takes an explicit size parameter. >--------------------------------------------------------------- bc07fe011abb2defaa9e3a4721f9de9e3a036835 includes/rts/storage/ClosureMacros.h | 26 ++++++++++++++++++++++ rts/Messages.h | 2 +- testsuite/config/ghc | 3 +++ testsuite/tests/profiling/should_run/T11978b.hs | 22 ++++++++++++++++++ .../tests/profiling/should_run/T11978b.stdout | 2 ++ testsuite/tests/profiling/should_run/all.T | 4 ++++ 6 files changed, 58 insertions(+), 1 deletion(-) diff --git a/includes/rts/storage/ClosureMacros.h b/includes/rts/storage/ClosureMacros.h index 03589f2..4f38c76 100644 --- a/includes/rts/storage/ClosureMacros.h +++ b/includes/rts/storage/ClosureMacros.h @@ -497,10 +497,12 @@ INLINE_HEADER StgWord8 *mutArrPtrsCard (StgMutArrPtrs *a, W_ n) #if ZERO_SLOP_FOR_LDV_PROF || ZERO_SLOP_FOR_SANITY_CHECK #define OVERWRITING_CLOSURE(c) overwritingClosure(c) +#define OVERWRITING_CLOSURE_SIZE(c,s) overwritingClosureWithSize(c,s) #define OVERWRITING_CLOSURE_OFS(c,n) \ overwritingClosureOfs(c,n) #else #define OVERWRITING_CLOSURE(c) /* nothing */ +#define OVERWRITING_CLOSURE_SIZE(c,s) /* nothing */ #define OVERWRITING_CLOSURE_OFS(c,n) /* nothing */ #endif @@ -508,6 +510,28 @@ INLINE_HEADER StgWord8 *mutArrPtrsCard (StgMutArrPtrs *a, W_ n) void LDV_recordDead (StgClosure *c, nat size); #endif +EXTERN_INLINE void overwritingClosureWithSize (StgClosure *p, nat size); +EXTERN_INLINE void overwritingClosureWithSize (StgClosure *p, nat size) +{ + nat i; + +#if ZERO_SLOP_FOR_LDV_PROF && !ZERO_SLOP_FOR_SANITY_CHECK + // see Note [zeroing slop], also #8402 + if (era <= 0) return; +#endif + + // For LDV profiling, we need to record the closure as dead +#if defined(PROFILING) + LDV_recordDead(p, size); +#endif + + ASSERT(size >= sizeofW(StgThunkHeader)); + + for (i = 0; i < size - sizeofW(StgThunkHeader); i++) { + ((StgThunk *)(p))->payload[i] = 0; + } +} + EXTERN_INLINE void overwritingClosure (StgClosure *p); EXTERN_INLINE void overwritingClosure (StgClosure *p) { @@ -525,6 +549,8 @@ EXTERN_INLINE void overwritingClosure (StgClosure *p) LDV_recordDead(p, size); #endif + ASSERT(size >= sizeofW(StgThunkHeader)); + for (i = 0; i < size - sizeofW(StgThunkHeader); i++) { ((StgThunk *)(p))->payload[i] = 0; } diff --git a/rts/Messages.h b/rts/Messages.h index 4121364..69319c2 100644 --- a/rts/Messages.h +++ b/rts/Messages.h @@ -22,7 +22,7 @@ void sendMessage (Capability *from_cap, Capability *to_cap, Message *msg); INLINE_HEADER void doneWithMsgThrowTo (MessageThrowTo *m) { - OVERWRITING_CLOSURE((StgClosure*)m); + OVERWRITING_CLOSURE_SIZE((StgClosure*)m, sizeofW(MessageThrowTo)); unlockClosure((StgClosure*)m, &stg_MSG_NULL_info); LDV_RECORD_CREATE(m); } diff --git a/testsuite/config/ghc b/testsuite/config/ghc index 595415a..347b8b1 100644 --- a/testsuite/config/ghc +++ b/testsuite/config/ghc @@ -75,6 +75,7 @@ config.ghc_dynamic = ghc_dynamic if (ghc_with_profiling == 1 and ghc_with_threaded_rts == 1): config.run_ways.append('profthreaded') + config.run_ways.append('profthrdebug') if (ghc_with_llvm == 1): config.compile_ways.append('optllvm') @@ -108,6 +109,7 @@ config.way_flags = lambda name : { 'prof_hr' : ['-O', '-prof', '-static', '-auto-all'], 'dyn' : ['-O', '-dynamic'], 'static' : ['-O', '-static'], + 'profthrdebug' : ['-O', '-prof', '-static', '-threaded', '-debug'], 'debug' : ['-O', '-g', '-dannot-lint'], # llvm variants... 'profllvm' : ['-prof', '-static', '-auto-all', '-fllvm'], @@ -138,6 +140,7 @@ config.way_rts_flags = { 'prof_hd' : ['-hd'], 'prof_hy' : ['-hy'], 'prof_hr' : ['-hr'], + 'profthrdebug' : ['-p'], 'dyn' : [], 'static' : [], 'debug' : [], diff --git a/testsuite/tests/profiling/should_run/T11978b.hs b/testsuite/tests/profiling/should_run/T11978b.hs new file mode 100644 index 0000000..226e7d1 --- /dev/null +++ b/testsuite/tests/profiling/should_run/T11978b.hs @@ -0,0 +1,22 @@ + +import Control.Concurrent +import Control.Concurrent.MVar +import Control.Exception +import Control.Monad + +main :: IO () +main = do + putStrLn "Start ..." + mvar <- newMVar (0 :: Int) + + let count = 50 + + forM_ [ 1 .. count ] $ const $ forkIO $ do + threadDelay 100 + i <- takeMVar mvar + putMVar mvar $! i + 1 + + threadDelay 1000000 + end <- takeMVar mvar + putStrLn $ "Final result " ++ show end + assert (end == count) $ return () diff --git a/testsuite/tests/profiling/should_run/T11978b.stdout b/testsuite/tests/profiling/should_run/T11978b.stdout new file mode 100644 index 0000000..10976f3 --- /dev/null +++ b/testsuite/tests/profiling/should_run/T11978b.stdout @@ -0,0 +1,2 @@ +Start ... +Final result 50 diff --git a/testsuite/tests/profiling/should_run/all.T b/testsuite/tests/profiling/should_run/all.T index 1f74a27..8c1ada9 100644 --- a/testsuite/tests/profiling/should_run/all.T +++ b/testsuite/tests/profiling/should_run/all.T @@ -110,3 +110,7 @@ test('T11627b', [ extra_run_opts('+RTS -i0 -RTS') # census after each GC test('T11978a', [only_ways(['profthreaded']), extra_run_opts('+RTS -hb -N10')], compile_and_run, ['']) + +test('T11978b', + [only_ways(['profthrdebug']), extra_run_opts('+RTS -hb -N10')], + compile_and_run, ['']) From git at git.haskell.org Wed May 4 07:52:04 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 4 May 2016 07:52:04 +0000 (UTC) Subject: [commit: ghc] master: Export oneShot from GHC.Exts (50e7055) Message-ID: <20160504075204.678493A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/50e70559a0be07e5b836397d4aa8facf180510f9/ghc >--------------------------------------------------------------- commit 50e70559a0be07e5b836397d4aa8facf180510f9 Author: Joachim Breitner Date: Wed May 4 09:54:40 2016 +0200 Export oneShot from GHC.Exts as suggested by carter in #12011. >--------------------------------------------------------------- 50e70559a0be07e5b836397d4aa8facf180510f9 libraries/base/GHC/Exts.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/base/GHC/Exts.hs b/libraries/base/GHC/Exts.hs index 9e58f5c..4c147ae 100755 --- a/libraries/base/GHC/Exts.hs +++ b/libraries/base/GHC/Exts.hs @@ -44,7 +44,7 @@ module GHC.Exts breakpoint, breakpointCond, -- * Ids with special behaviour - lazy, inline, + lazy, inline, oneShot, -- * Safe coercions -- From git at git.haskell.org Wed May 4 08:51:56 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 4 May 2016 08:51:56 +0000 (UTC) Subject: [commit: ghc] master: Adjust testsuite output to bytestring-0.10.8.0 (f9d9375) Message-ID: <20160504085156.733693A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f9d93751126e58fb990335095e02fd81a3595fde/ghc >--------------------------------------------------------------- commit f9d93751126e58fb990335095e02fd81a3595fde Author: Joachim Breitner Date: Wed May 4 10:54:39 2016 +0200 Adjust testsuite output to bytestring-0.10.8.0 This is a band-aid; the test suite should not be sensitive to these messages. >--------------------------------------------------------------- f9d93751126e58fb990335095e02fd81a3595fde testsuite/tests/safeHaskell/check/pkg01/ImpSafe03.stderr | 2 +- testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly07.stderr | 2 +- testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly08.stderr | 2 +- testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly09.stderr | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/testsuite/tests/safeHaskell/check/pkg01/ImpSafe03.stderr b/testsuite/tests/safeHaskell/check/pkg01/ImpSafe03.stderr index d8c8d67..cc3588f 100644 --- a/testsuite/tests/safeHaskell/check/pkg01/ImpSafe03.stderr +++ b/testsuite/tests/safeHaskell/check/pkg01/ImpSafe03.stderr @@ -1,4 +1,4 @@ [2 of 2] Compiling Main ( ImpSafe03.hs, ImpSafe03.o ) : - The package (bytestring-0.10.7.0) is required to be trusted but it isn't! + The package (bytestring-0.10.8.0) is required to be trusted but it isn't! diff --git a/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly07.stderr b/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly07.stderr index 0758def..79af2e0 100644 --- a/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly07.stderr +++ b/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly07.stderr @@ -3,4 +3,4 @@ The package (base-4.9.0.0) is required to be trusted but it isn't! : error: - The package (bytestring-0.10.7.0) is required to be trusted but it isn't! + The package (bytestring-0.10.8.0) is required to be trusted but it isn't! diff --git a/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly08.stderr b/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly08.stderr index 0758def..79af2e0 100644 --- a/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly08.stderr +++ b/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly08.stderr @@ -3,4 +3,4 @@ The package (base-4.9.0.0) is required to be trusted but it isn't! : error: - The package (bytestring-0.10.7.0) is required to be trusted but it isn't! + The package (bytestring-0.10.8.0) is required to be trusted but it isn't! diff --git a/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly09.stderr b/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly09.stderr index 4bd2a9d..4221723 100644 --- a/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly09.stderr +++ b/testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly09.stderr @@ -1,3 +1,3 @@ : - The package (bytestring-0.10.1.0) is required to be trusted but it isn't! + The package (bytestring-0.10.8.0) is required to be trusted but it isn't! From git at git.haskell.org Wed May 4 10:21:22 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 4 May 2016 10:21:22 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: rts: Replace `nat` with `uint32_t` (b036c0a) Message-ID: <20160504102122.D6A833A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/b036c0a7cdf6d11a5e543bd1d9aa53db7de23dee/ghc >--------------------------------------------------------------- commit b036c0a7cdf6d11a5e543bd1d9aa53db7de23dee Author: Erik de Castro Lopo Date: Mon May 2 06:37:14 2016 +1000 rts: Replace `nat` with `uint32_t` Summary: The `nat` type was an alias for `unsigned int` with a comment saying it was at least 32 bits. We keep the typedef in case client code is using it but mark it as deprecated. Test Plan: Validated on Linux, OS X and Windows Reviewers: simonmar, austin, thomie, hvr, bgamari, hsyl20 Differential Revision: https://phabricator.haskell.org/D2166 >--------------------------------------------------------------- b036c0a7cdf6d11a5e543bd1d9aa53db7de23dee includes/rts/Flags.h | 48 +++++++++++------------ includes/rts/IOManager.h | 2 +- includes/rts/OSThreads.h | 4 +- includes/rts/SpinLock.h | 4 +- includes/rts/Threads.h | 4 +- includes/rts/Types.h | 3 +- includes/rts/prof/CCS.h | 2 +- includes/rts/storage/Block.h | 4 +- includes/rts/storage/ClosureMacros.h | 36 ++++++++--------- includes/rts/storage/GC.h | 8 ++-- includes/rts/storage/MBlock.h | 4 +- includes/rts/storage/SMPClosureOps.h | 2 +- rts/Adjustor.c | 4 +- rts/Arena.c | 4 +- rts/Capability.c | 35 +++++++++-------- rts/Capability.h | 23 +++++------ rts/CheckUnload.c | 4 +- rts/Disassembler.c | 10 ++--- rts/Globals.c | 4 +- rts/Hpc.c | 10 ++--- rts/Interpreter.c | 16 ++++---- rts/LdvProfile.c | 8 ++-- rts/LdvProfile.h | 2 +- rts/LibdwPool.c | 2 +- rts/Linker.c | 10 ++--- rts/Messages.c | 6 +-- rts/Messages.h | 2 +- rts/Pool.c | 22 +++++------ rts/Pool.h | 10 ++--- rts/Printer.c | 14 ++++--- rts/ProfHeap.c | 30 +++++++------- rts/ProfHeap.h | 8 ++-- rts/Profiling.c | 51 ++++++++++++------------ rts/Proftimer.c | 4 +- rts/RaiseAsync.c | 12 +++--- rts/RaiseAsync.h | 2 +- rts/RetainerProfile.c | 72 +++++++++++++++++----------------- rts/RetainerSet.c | 28 ++++++------- rts/RetainerSet.h | 8 ++-- rts/RtsFlags.c | 21 +++++----- rts/RtsStartup.c | 2 +- rts/Schedule.c | 57 ++++++++++++++------------- rts/Sparks.c | 6 +-- rts/Stable.c | 12 +++--- rts/Stats.c | 28 ++++++------- rts/Stats.h | 10 ++--- rts/Task.c | 13 +++--- rts/Task.h | 10 ++--- rts/ThreadPaused.c | 18 ++++----- rts/Threads.c | 8 ++-- rts/Trace.c | 8 ++-- rts/Trace.h | 24 ++++++------ rts/WSDeque.c | 2 +- rts/WSDeque.h | 2 +- rts/Weak.c | 2 +- rts/eventlog/EventLog.c | 30 +++++++------- rts/eventlog/EventLog.h | 8 ++-- rts/posix/GetTime.c | 2 +- rts/posix/OSMem.c | 4 +- rts/posix/OSThreads.c | 28 ++++++------- rts/posix/Signals.c | 4 +- rts/sm/BlockAlloc.c | 18 ++++----- rts/sm/BlockAlloc.h | 2 +- rts/sm/Compact.h | 6 +-- rts/sm/Evac.c | 24 ++++++------ rts/sm/GC.c | 74 +++++++++++++++++------------------ rts/sm/GC.h | 8 ++-- rts/sm/GCThread.h | 8 ++-- rts/sm/GCUtils.c | 16 ++++---- rts/sm/GCUtils.h | 8 ++-- rts/sm/HeapAlloc.h | 4 +- rts/sm/MBlock.c | 46 +++++++++++----------- rts/sm/MarkWeak.c | 10 ++--- rts/sm/OSMem.h | 4 +- rts/sm/Sanity.c | 52 ++++++++++++------------ rts/sm/Scav.c | 18 ++++----- rts/sm/Storage.c | 38 +++++++++--------- rts/sm/Storage.h | 10 ++--- rts/sm/Sweep.c | 2 +- rts/win32/AwaitEvent.c | 2 +- rts/win32/OSMem.c | 8 ++-- rts/win32/OSThreads.c | 10 ++--- rts/win32/ThrIOManager.c | 2 +- testsuite/tests/rts/testblockalloc.c | 2 +- testsuite/tests/rts/testheapalloced.c | 2 +- testsuite/tests/rts/testmblockalloc.c | 2 +- testsuite/tests/rts/testwsdeque.c | 14 +++---- 87 files changed, 611 insertions(+), 600 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc b036c0a7cdf6d11a5e543bd1d9aa53db7de23dee From git at git.haskell.org Wed May 4 10:21:26 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 4 May 2016 10:21:26 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: rts: Specialize `overwritingClosure` for `MSG_THROWTO` (1e02493) Message-ID: <20160504102126.1281D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/1e024932ae7d1b669d9b4410b7e8fc90f0fcd33c/ghc >--------------------------------------------------------------- commit 1e024932ae7d1b669d9b4410b7e8fc90f0fcd33c Author: Erik de Castro Lopo Date: Tue May 3 21:13:17 2016 +1000 rts: Specialize `overwritingClosure` for `MSG_THROWTO` The function `executeMessage` replaces the `header.info` pointer with a `WHITEHOLE` passes it to `throwToMsg` and then passes it to `doneWithMsgThrowTo` which calls `overwritingClosure` on it. However, `overwritingClosure` needs to know the size of the closure which is based on the `header.info` pointer. Unfortunately, the `header.info` pointer can't be reset to `MSG_THROWTO` or it might cause race conditions. The solution suggested by Simon Marlow is to add and use a function `overwritingClosureWithSize` that takes an explicit size parameter. >--------------------------------------------------------------- 1e024932ae7d1b669d9b4410b7e8fc90f0fcd33c includes/rts/storage/ClosureMacros.h | 26 ++++++++++++++++++++++ rts/Messages.h | 2 +- testsuite/config/ghc | 3 +++ testsuite/tests/profiling/should_run/T11978b.hs | 22 ++++++++++++++++++ .../tests/profiling/should_run/T11978b.stdout | 2 ++ testsuite/tests/profiling/should_run/all.T | 4 ++++ 6 files changed, 58 insertions(+), 1 deletion(-) diff --git a/includes/rts/storage/ClosureMacros.h b/includes/rts/storage/ClosureMacros.h index d7ae5ea..9246fc6 100644 --- a/includes/rts/storage/ClosureMacros.h +++ b/includes/rts/storage/ClosureMacros.h @@ -497,10 +497,12 @@ INLINE_HEADER StgWord8 *mutArrPtrsCard (StgMutArrPtrs *a, W_ n) #if ZERO_SLOP_FOR_LDV_PROF || ZERO_SLOP_FOR_SANITY_CHECK #define OVERWRITING_CLOSURE(c) overwritingClosure(c) +#define OVERWRITING_CLOSURE_SIZE(c,s) overwritingClosureWithSize(c,s) #define OVERWRITING_CLOSURE_OFS(c,n) \ overwritingClosureOfs(c,n) #else #define OVERWRITING_CLOSURE(c) /* nothing */ +#define OVERWRITING_CLOSURE_SIZE(c,s) /* nothing */ #define OVERWRITING_CLOSURE_OFS(c,n) /* nothing */ #endif @@ -508,6 +510,28 @@ INLINE_HEADER StgWord8 *mutArrPtrsCard (StgMutArrPtrs *a, W_ n) void LDV_recordDead (StgClosure *c, uint32_t size); #endif +EXTERN_INLINE void overwritingClosureWithSize (StgClosure *p, nat size); +EXTERN_INLINE void overwritingClosureWithSize (StgClosure *p, nat size) +{ + nat i; + +#if ZERO_SLOP_FOR_LDV_PROF && !ZERO_SLOP_FOR_SANITY_CHECK + // see Note [zeroing slop], also #8402 + if (era <= 0) return; +#endif + + // For LDV profiling, we need to record the closure as dead +#if defined(PROFILING) + LDV_recordDead(p, size); +#endif + + ASSERT(size >= sizeofW(StgThunkHeader)); + + for (i = 0; i < size - sizeofW(StgThunkHeader); i++) { + ((StgThunk *)(p))->payload[i] = 0; + } +} + EXTERN_INLINE void overwritingClosure (StgClosure *p); EXTERN_INLINE void overwritingClosure (StgClosure *p) { @@ -525,6 +549,8 @@ EXTERN_INLINE void overwritingClosure (StgClosure *p) LDV_recordDead(p, size); #endif + ASSERT(size >= sizeofW(StgThunkHeader)); + for (i = 0; i < size - sizeofW(StgThunkHeader); i++) { ((StgThunk *)(p))->payload[i] = 0; } diff --git a/rts/Messages.h b/rts/Messages.h index 302cb94..fa7d26f 100644 --- a/rts/Messages.h +++ b/rts/Messages.h @@ -22,7 +22,7 @@ void sendMessage (Capability *from_cap, Capability *to_cap, Message *msg); INLINE_HEADER void doneWithMsgThrowTo (MessageThrowTo *m) { - OVERWRITING_CLOSURE((StgClosure*)m); + OVERWRITING_CLOSURE_SIZE((StgClosure*)m, sizeofW(MessageThrowTo)); unlockClosure((StgClosure*)m, &stg_MSG_NULL_info); LDV_RECORD_CREATE(m); } diff --git a/testsuite/config/ghc b/testsuite/config/ghc index 595415a..347b8b1 100644 --- a/testsuite/config/ghc +++ b/testsuite/config/ghc @@ -75,6 +75,7 @@ config.ghc_dynamic = ghc_dynamic if (ghc_with_profiling == 1 and ghc_with_threaded_rts == 1): config.run_ways.append('profthreaded') + config.run_ways.append('profthrdebug') if (ghc_with_llvm == 1): config.compile_ways.append('optllvm') @@ -108,6 +109,7 @@ config.way_flags = lambda name : { 'prof_hr' : ['-O', '-prof', '-static', '-auto-all'], 'dyn' : ['-O', '-dynamic'], 'static' : ['-O', '-static'], + 'profthrdebug' : ['-O', '-prof', '-static', '-threaded', '-debug'], 'debug' : ['-O', '-g', '-dannot-lint'], # llvm variants... 'profllvm' : ['-prof', '-static', '-auto-all', '-fllvm'], @@ -138,6 +140,7 @@ config.way_rts_flags = { 'prof_hd' : ['-hd'], 'prof_hy' : ['-hy'], 'prof_hr' : ['-hr'], + 'profthrdebug' : ['-p'], 'dyn' : [], 'static' : [], 'debug' : [], diff --git a/testsuite/tests/profiling/should_run/T11978b.hs b/testsuite/tests/profiling/should_run/T11978b.hs new file mode 100644 index 0000000..226e7d1 --- /dev/null +++ b/testsuite/tests/profiling/should_run/T11978b.hs @@ -0,0 +1,22 @@ + +import Control.Concurrent +import Control.Concurrent.MVar +import Control.Exception +import Control.Monad + +main :: IO () +main = do + putStrLn "Start ..." + mvar <- newMVar (0 :: Int) + + let count = 50 + + forM_ [ 1 .. count ] $ const $ forkIO $ do + threadDelay 100 + i <- takeMVar mvar + putMVar mvar $! i + 1 + + threadDelay 1000000 + end <- takeMVar mvar + putStrLn $ "Final result " ++ show end + assert (end == count) $ return () diff --git a/testsuite/tests/profiling/should_run/T11978b.stdout b/testsuite/tests/profiling/should_run/T11978b.stdout new file mode 100644 index 0000000..10976f3 --- /dev/null +++ b/testsuite/tests/profiling/should_run/T11978b.stdout @@ -0,0 +1,2 @@ +Start ... +Final result 50 diff --git a/testsuite/tests/profiling/should_run/all.T b/testsuite/tests/profiling/should_run/all.T index 1f74a27..8c1ada9 100644 --- a/testsuite/tests/profiling/should_run/all.T +++ b/testsuite/tests/profiling/should_run/all.T @@ -110,3 +110,7 @@ test('T11627b', [ extra_run_opts('+RTS -i0 -RTS') # census after each GC test('T11978a', [only_ways(['profthreaded']), extra_run_opts('+RTS -hb -N10')], compile_and_run, ['']) + +test('T11978b', + [only_ways(['profthrdebug']), extra_run_opts('+RTS -hb -N10')], + compile_and_run, ['']) From git at git.haskell.org Wed May 4 10:21:28 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 4 May 2016 10:21:28 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: rts: Specialize `overwritingClosure` for `MSG_THROWTO` (d755a3f) Message-ID: <20160504102128.B9A503A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/d755a3f1508ad439f95abe38b63f4652d879add0/ghc >--------------------------------------------------------------- commit d755a3f1508ad439f95abe38b63f4652d879add0 Author: Erik de Castro Lopo Date: Tue May 3 21:13:17 2016 +1000 rts: Specialize `overwritingClosure` for `MSG_THROWTO` The function `executeMessage` replaces the `header.info` pointer with a `WHITEHOLE` passes it to `throwToMsg` and then passes it to `doneWithMsgThrowTo` which calls `overwritingClosure` on it. However, `overwritingClosure` needs to know the size of the closure which is based on the `header.info` pointer. Unfortunately, the `header.info` pointer can't be reset to `MSG_THROWTO` or it might cause race conditions. The solution suggested by Simon Marlow is to add and use a function `overwritingClosureWithSize` that takes an explicit size parameter. >--------------------------------------------------------------- d755a3f1508ad439f95abe38b63f4652d879add0 includes/rts/storage/ClosureMacros.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/rts/storage/ClosureMacros.h b/includes/rts/storage/ClosureMacros.h index 9246fc6..73b9767 100644 --- a/includes/rts/storage/ClosureMacros.h +++ b/includes/rts/storage/ClosureMacros.h @@ -510,10 +510,10 @@ INLINE_HEADER StgWord8 *mutArrPtrsCard (StgMutArrPtrs *a, W_ n) void LDV_recordDead (StgClosure *c, uint32_t size); #endif -EXTERN_INLINE void overwritingClosureWithSize (StgClosure *p, nat size); -EXTERN_INLINE void overwritingClosureWithSize (StgClosure *p, nat size) +EXTERN_INLINE void overwritingClosureWithSize (StgClosure *p, uint32_t size); +EXTERN_INLINE void overwritingClosureWithSize (StgClosure *p, uint32_t size) { - nat i; + uint32_t i; #if ZERO_SLOP_FOR_LDV_PROF && !ZERO_SLOP_FOR_SANITY_CHECK // see Note [zeroing slop], also #8402 From git at git.haskell.org Wed May 4 10:21:31 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 4 May 2016 10:21:31 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: rts: Replace `nat` with `uint32_t` (87cf280) Message-ID: <20160504102131.700423A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/87cf28053b6845025902ac057d22c6a0d88f7281/ghc >--------------------------------------------------------------- commit 87cf28053b6845025902ac057d22c6a0d88f7281 Author: Erik de Castro Lopo Date: Mon May 2 06:37:14 2016 +1000 rts: Replace `nat` with `uint32_t` Summary: The `nat` type was an alias for `unsigned int` with a comment saying it was at least 32 bits. We keep the typedef in case client code is using it but mark it as deprecated. Test Plan: Validated on Linux, OS X and Windows Reviewers: simonmar, austin, thomie, hvr, bgamari, hsyl20 Differential Revision: https://phabricator.haskell.org/D2166 >--------------------------------------------------------------- 87cf28053b6845025902ac057d22c6a0d88f7281 rts/RaiseAsync.c | 0 1 file changed, 0 insertions(+), 0 deletions(-) From git at git.haskell.org Wed May 4 10:21:34 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 4 May 2016 10:21:34 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: RtsUtils: Use `size_t` instead of `int` where appropriate (08bfba9) Message-ID: <20160504102134.28F463A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/08bfba9e25dd43e004a1c557fce1629b18b4dc36/ghc >--------------------------------------------------------------- commit 08bfba9e25dd43e004a1c557fce1629b18b4dc36 Author: Erik de Castro Lopo Date: Mon May 2 20:07:05 2016 +1000 RtsUtils: Use `size_t` instead of `int` where appropriate Functions like `stgMallocBytes` take a size parameter which was of type `int`, but is commonly used as `stgMallocBytes (sizeof (...))`. This is problematic because the `sizeof` operator returns `size_t` so that on 64 bit systems, in this common use case the `size_t` parameter would be truncated to 32 bits when passed to `stgMallocBytes` where it was cast back to `size_t`. >--------------------------------------------------------------- 08bfba9e25dd43e004a1c557fce1629b18b4dc36 rts/RtsUtils.c | 22 +++++++++------------- rts/RtsUtils.h | 6 +++--- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/rts/RtsUtils.c b/rts/RtsUtils.c index c837143..716d203 100644 --- a/rts/RtsUtils.c +++ b/rts/RtsUtils.c @@ -57,13 +57,11 @@ extern char *ctime_r(const time_t *, char *); -------------------------------------------------------------------------- */ void * -stgMallocBytes (int n, char *msg) +stgMallocBytes (size_t n, char *msg) { - char *space; - size_t n2; + void *space; - n2 = (size_t) n; - if ((space = (char *) malloc(n2)) == NULL) { + if ((space = malloc(n)) == NULL) { /* Quoting POSIX.1-2008 (which says more or less the same as ISO C99): * * "Upon successful completion with size not equal to 0, malloc() shall @@ -85,13 +83,11 @@ stgMallocBytes (int n, char *msg) } void * -stgReallocBytes (void *p, int n, char *msg) +stgReallocBytes (void *p, size_t n, char *msg) { - char *space; - size_t n2; + void *space; - n2 = (size_t) n; - if ((space = (char *) realloc(p, (size_t) n2)) == NULL) { + if ((space = realloc(p, n)) == NULL) { /* don't fflush(stdout); WORKAROUND bug in Linux glibc */ rtsConfig.mallocFailHook((W_) n, msg); /*msg*/ stg_exit(EXIT_INTERNAL_ERROR); @@ -100,11 +96,11 @@ stgReallocBytes (void *p, int n, char *msg) } void * -stgCallocBytes (int n, int m, char *msg) +stgCallocBytes (size_t n, size_t m, char *msg) { - char *space; + void *space; - if ((space = (char *) calloc((size_t) n, (size_t) m)) == NULL) { + if ((space = calloc(n, m)) == NULL) { /* don't fflush(stdout); WORKAROUND bug in Linux glibc */ rtsConfig.mallocFailHook((W_) n*m, msg); /*msg*/ stg_exit(EXIT_INTERNAL_ERROR); diff --git a/rts/RtsUtils.h b/rts/RtsUtils.h index d76c921..2d5e5de 100644 --- a/rts/RtsUtils.h +++ b/rts/RtsUtils.h @@ -18,12 +18,12 @@ void initAllocator(void); void shutdownAllocator(void); -void *stgMallocBytes(int n, char *msg) +void *stgMallocBytes(size_t n, char *msg) GNUC3_ATTRIBUTE(__malloc__); -void *stgReallocBytes(void *p, int n, char *msg); +void *stgReallocBytes(void *p, size_t n, char *msg); -void *stgCallocBytes(int n, int m, char *msg) +void *stgCallocBytes(size_t n, size_t m, char *msg) GNUC3_ATTRIBUTE(__malloc__); char *stgStrndup(const char *s, size_t n); From git at git.haskell.org Wed May 4 10:21:36 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 4 May 2016 10:21:36 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: rts/ProfHeap.c: Use `ssize_t` instead of `long`. (28a1878) Message-ID: <20160504102136.D24CB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/28a1878f4db94e61e24ed67ef95d812d8ac7edce/ghc >--------------------------------------------------------------- commit 28a1878f4db94e61e24ed67ef95d812d8ac7edce Author: Erik de Castro Lopo Date: Mon May 2 20:22:00 2016 +1000 rts/ProfHeap.c: Use `ssize_t` instead of `long`. On x64 Windows `sizeof long` is 4 which could easily overflow resulting in incorrect heap profiling results. This change does not affect either Linux or OS X where `sizeof long` == `sizeof ssize_t` regardless of machine word size. >--------------------------------------------------------------- 28a1878f4db94e61e24ed67ef95d812d8ac7edce rts/ProfHeap.c | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/rts/ProfHeap.c b/rts/ProfHeap.c index 875cc7e..11e4274 100644 --- a/rts/ProfHeap.c +++ b/rts/ProfHeap.c @@ -50,13 +50,14 @@ static uint32_t max_era; typedef struct _counter { void *identity; union { - uint32_t resid; + size_t resid; struct { - long prim; // total size of 'inherently used' closures - long not_used; // total size of 'never used' closures - long used; // total size of 'used at least once' closures - long void_total; // current total size of 'destroyed without being used' closures - long drag_total; // current total size of 'used at least once and waiting to die' + // Total sizes of: + ssize_t prim; // 'inherently used' closures + ssize_t not_used; // 'never used' closures + ssize_t used; // 'used at least once' closures + ssize_t void_total; // 'destroyed without being used' closures + ssize_t drag_total; // 'used at least once and waiting to die' } ldv; } c; struct _counter *next; @@ -79,11 +80,11 @@ typedef struct { Arena * arena; // for LDV profiling, when just displaying by LDV - long prim; - long not_used; - long used; - long void_total; - long drag_total; + size_t prim; + size_t not_used; + size_t used; + size_t void_total; + size_t drag_total; } Census; static Census *censuses = NULL; @@ -193,14 +194,14 @@ LDV_recordDead( StgClosure *c, uint32_t size ) t = (LDVW((c)) & LDV_CREATE_MASK) >> LDV_SHIFT; if (t < era) { if (RtsFlags.ProfFlags.bioSelector == NULL) { - censuses[t].void_total += (long)size; - censuses[era].void_total -= (long)size; + censuses[t].void_total += size; + censuses[era].void_total -= size; ASSERT(censuses[t].void_total < censuses[t].not_used); } else { id = closureIdentity(c); ctr = lookupHashTable(censuses[t].hash, (StgWord)id); ASSERT( ctr != NULL ); - ctr->c.ldv.void_total += (long)size; + ctr->c.ldv.void_total += size; ctr = lookupHashTable(censuses[era].hash, (StgWord)id); if (ctr == NULL) { ctr = arenaAlloc(censuses[era].arena, sizeof(counter)); @@ -210,7 +211,7 @@ LDV_recordDead( StgClosure *c, uint32_t size ) ctr->next = censuses[era].ctrs; censuses[era].ctrs = ctr; } - ctr->c.ldv.void_total -= (long)size; + ctr->c.ldv.void_total -= size; } } } else { @@ -224,7 +225,7 @@ LDV_recordDead( StgClosure *c, uint32_t size ) id = closureIdentity(c); ctr = lookupHashTable(censuses[t+1].hash, (StgWord)id); ASSERT( ctr != NULL ); - ctr->c.ldv.drag_total += (long)size; + ctr->c.ldv.drag_total += size; ctr = lookupHashTable(censuses[era].hash, (StgWord)id); if (ctr == NULL) { ctr = arenaAlloc(censuses[era].arena, sizeof(counter)); @@ -234,7 +235,7 @@ LDV_recordDead( StgClosure *c, uint32_t size ) ctr->next = censuses[era].ctrs; censuses[era].ctrs = ctr; } - ctr->c.ldv.drag_total -= (long)size; + ctr->c.ldv.drag_total -= size; } } } @@ -739,7 +740,7 @@ static void dumpCensus( Census *census ) { counter *ctr; - long count; + size_t count; printSample(rtsTrue, census->time); @@ -778,8 +779,6 @@ dumpCensus( Census *census ) count = ctr->c.resid; } - ASSERT( count >= 0 ); - if (count == 0) continue; #if !defined(PROFILING) @@ -835,7 +834,7 @@ dumpCensus( Census *census ) } -static void heapProfObject(Census *census, StgClosure *p, uint32_t size, +static void heapProfObject(Census *census, StgClosure *p, size_t size, rtsBool prim #ifndef PROFILING STG_UNUSED @@ -843,7 +842,7 @@ static void heapProfObject(Census *census, StgClosure *p, uint32_t size, ) { void *identity; - uint32_t real_size; + size_t real_size; counter *ctr; identity = NULL; @@ -920,7 +919,7 @@ heapCensusChain( Census *census, bdescr *bd ) { StgPtr p; StgInfoTable *info; - uint32_t size; + size_t size; rtsBool prim; for (; bd != NULL; bd = bd->link) { From git at git.haskell.org Wed May 4 10:21:39 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 4 May 2016 10:21:39 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: RtsFlags: Make `mallocFailHook` const correct (7d6d5fa) Message-ID: <20160504102139.8A65A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/7d6d5fa64011cda8777e59258630ccf06787190c/ghc >--------------------------------------------------------------- commit 7d6d5fa64011cda8777e59258630ccf06787190c Author: Erik de Castro Lopo Date: Mon May 2 21:20:28 2016 +1000 RtsFlags: Make `mallocFailHook` const correct >--------------------------------------------------------------- 7d6d5fa64011cda8777e59258630ccf06787190c includes/RtsAPI.h | 2 +- rts/hooks/Hooks.h | 2 +- rts/hooks/MallocFail.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/RtsAPI.h b/includes/RtsAPI.h index 16b8486..a4a094f 100644 --- a/includes/RtsAPI.h +++ b/includes/RtsAPI.h @@ -90,7 +90,7 @@ typedef struct { void (* outOfHeapHook) (W_ request_size, W_ heap_size); // Called when malloc() fails, before exiting - void (* mallocFailHook) (W_ request_size /* in bytes */, char *msg); + void (* mallocFailHook) (W_ request_size /* in bytes */, const char *msg); // Called for every GC void (* gcDoneHook) (unsigned int gen, diff --git a/rts/hooks/Hooks.h b/rts/hooks/Hooks.h index 35a6011..1383ccd 100644 --- a/rts/hooks/Hooks.h +++ b/rts/hooks/Hooks.h @@ -21,7 +21,7 @@ extern char *ghc_rts_opts; extern void OnExitHook (void); extern void StackOverflowHook (W_ stack_size); extern void OutOfHeapHook (W_ request_size, W_ heap_size); -extern void MallocFailHook (W_ request_size /* in bytes */, char *msg); +extern void MallocFailHook (W_ request_size /* in bytes */, const char *msg); extern void FlagDefaultsHook (void); #include "EndPrivate.h" diff --git a/rts/hooks/MallocFail.c b/rts/hooks/MallocFail.c index 63343a7..42606b6 100644 --- a/rts/hooks/MallocFail.c +++ b/rts/hooks/MallocFail.c @@ -11,7 +11,7 @@ #include void -MallocFailHook (W_ request_size /* in bytes */, char *msg) +MallocFailHook (W_ request_size /* in bytes */, const char *msg) { fprintf(stderr, "malloc: failed on request for %" FMT_Word " bytes; message: %s\n", request_size, msg); } From git at git.haskell.org Wed May 4 10:21:42 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 4 May 2016 10:21:42 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: Add test T12009 (1d95cc7) Message-ID: <20160504102142.3B9F53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/1d95cc751b96cbd6df74d3bdf6df9c89fd076d5a/ghc >--------------------------------------------------------------- commit 1d95cc751b96cbd6df74d3bdf6df9c89fd076d5a Author: Erik de Castro Lopo Date: Wed May 4 15:39:27 2016 +1000 Add test T12009 >--------------------------------------------------------------- 1d95cc751b96cbd6df74d3bdf6df9c89fd076d5a testsuite/tests/profiling/should_run/{T11978a.hs => T12009.hs} | 0 .../should_run/T5594.stdout => profiling/should_run/T12009.stdout} | 0 testsuite/tests/profiling/should_run/all.T | 4 ++++ 3 files changed, 4 insertions(+) diff --git a/testsuite/tests/profiling/should_run/T11978a.hs b/testsuite/tests/profiling/should_run/T12009.hs similarity index 100% copy from testsuite/tests/profiling/should_run/T11978a.hs copy to testsuite/tests/profiling/should_run/T12009.hs diff --git a/testsuite/tests/ffi/should_run/T5594.stdout b/testsuite/tests/profiling/should_run/T12009.stdout similarity index 100% copy from testsuite/tests/ffi/should_run/T5594.stdout copy to testsuite/tests/profiling/should_run/T12009.stdout diff --git a/testsuite/tests/profiling/should_run/all.T b/testsuite/tests/profiling/should_run/all.T index 8c1ada9..4331ece 100644 --- a/testsuite/tests/profiling/should_run/all.T +++ b/testsuite/tests/profiling/should_run/all.T @@ -114,3 +114,7 @@ test('T11978a', test('T11978b', [only_ways(['profthrdebug']), extra_run_opts('+RTS -hb -N10')], compile_and_run, ['']) + +test('T12009', + [only_ways(['profthrdebug']), extra_run_opts('+RTS -hb -DS -N1')], + compile_and_run, ['']) From git at git.haskell.org Wed May 4 10:21:44 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 4 May 2016 10:21:44 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat's head updated: Add test T12009 (1d95cc7) Message-ID: <20160504102144.8679D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/erikd/remove-nat' now includes: 0051ac1 Update libraries/hpc submodule to v0.6.0.3 release tag 4466ae6 Update bytestring submodule to 0.10.8.0 release tag 50e7055 Export oneShot from GHC.Exts f9d9375 Adjust testsuite output to bytestring-0.10.8.0 b036c0a rts: Replace `nat` with `uint32_t` 1e02493 rts: Specialize `overwritingClosure` for `MSG_THROWTO` 87cf280 rts: Replace `nat` with `uint32_t` d755a3f rts: Specialize `overwritingClosure` for `MSG_THROWTO` 28a1878 rts/ProfHeap.c: Use `ssize_t` instead of `long`. 08bfba9 RtsUtils: Use `size_t` instead of `int` where appropriate 7d6d5fa RtsFlags: Make `mallocFailHook` const correct 1d95cc7 Add test T12009 From git at git.haskell.org Wed May 4 12:47:30 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 4 May 2016 12:47:30 +0000 (UTC) Subject: [commit: ghc] master: Make 'make fast' work for the User Guide (aa5e2dd) Message-ID: <20160504124730.A2AA03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/aa5e2ddcbb5f0435b7983413d107d59a25ef8861/ghc >--------------------------------------------------------------- commit aa5e2ddcbb5f0435b7983413d107d59a25ef8861 Author: Simon Marlow Date: Wed May 4 12:47:12 2016 +0100 Make 'make fast' work for the User Guide If you already have mkUserGuidePart compiled. >--------------------------------------------------------------- aa5e2ddcbb5f0435b7983413d107d59a25ef8861 docs/users_guide/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/users_guide/Makefile b/docs/users_guide/Makefile index 603a670..27f3a11 100644 --- a/docs/users_guide/Makefile +++ b/docs/users_guide/Makefile @@ -1,3 +1,7 @@ dir = docs/users_guide TOP = ../.. + include $(TOP)/mk/sub-makefile.mk + +# This makes 'make fast' work: assume that mkUserGuidePart exists +FAST_MAKE_OPTS += utils/mkUserGuidePart_dist_NOT_NEEDED=YES From git at git.haskell.org Wed May 4 12:47:33 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 4 May 2016 12:47:33 +0000 (UTC) Subject: [commit: ghc] master: Allow limiting the number of GC threads (+RTS -qn) (76ee260) Message-ID: <20160504124733.5A2F43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/76ee260778991367b8dbf07ecf7afd31f826c824/ghc >--------------------------------------------------------------- commit 76ee260778991367b8dbf07ecf7afd31f826c824 Author: Simon Marlow Date: Sat Apr 9 20:45:50 2016 +0100 Allow limiting the number of GC threads (+RTS -qn) This allows the GC to use fewer threads than the number of capabilities. At each GC, we choose some of the capabilities to be "idle", which means that the thread running on that capability (if any) will sleep for the duration of the GC, and the other threads will do its work. We choose capabilities that are already idle (if any) to be the idle capabilities. The idea is that this helps in the following situation: * We want to use a large -N value so as to make use of hyperthreaded cores * We use a large heap size, so GC is infrequent * But we don't want to use all -N threads in the GC, because that thrashes the memory too much. See docs for usage. >--------------------------------------------------------------- 76ee260778991367b8dbf07ecf7afd31f826c824 docs/users_guide/runtime_control.rst | 24 +++ includes/rts/Flags.h | 4 + rts/Capability.c | 48 +++--- rts/Capability.h | 23 ++- rts/RtsFlags.c | 20 +++ rts/Schedule.c | 277 ++++++++++++++++++++++++----------- rts/Task.h | 20 ++- rts/sm/GC.c | 4 +- 8 files changed, 299 insertions(+), 121 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 76ee260778991367b8dbf07ecf7afd31f826c824 From git at git.haskell.org Wed May 4 12:47:36 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 4 May 2016 12:47:36 +0000 (UTC) Subject: [commit: ghc] master: Add +RTS -AL (f703fd6) Message-ID: <20160504124736.08BB63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f703fd6b50f0ae58bc5f5ddb927a2ce28eeaddf6/ghc >--------------------------------------------------------------- commit f703fd6b50f0ae58bc5f5ddb927a2ce28eeaddf6 Author: Simon Marlow Date: Sun Apr 24 21:31:55 2016 +0100 Add +RTS -AL +RTS -AL controls the total size of large objects that can be allocated before a GC is triggered. Previously this was always just the value of -A, and the limit mainly existed to prevent runaway allocation in pathalogical programs that allocate a lot of large objects. However, since the limit is shared between all cores, on a large multicore the default becomes more restrictive, and can end up triggering GC well before it would normally have been. Arguably a better default would be A*N, but this is probably excessive. Adding a flag lets you choose, and I've left the default as it was. See docs for usage. >--------------------------------------------------------------- f703fd6b50f0ae58bc5f5ddb927a2ce28eeaddf6 docs/users_guide/runtime_control.rst | 28 ++++++++++++++++++++++++++++ includes/rts/Flags.h | 1 + rts/RtsFlags.c | 35 ++++++++++++++++++++++------------- rts/sm/Storage.c | 7 +++++-- 4 files changed, 56 insertions(+), 15 deletions(-) diff --git a/docs/users_guide/runtime_control.rst b/docs/users_guide/runtime_control.rst index 09e0afd..19135c6 100644 --- a/docs/users_guide/runtime_control.rst +++ b/docs/users_guide/runtime_control.rst @@ -285,6 +285,34 @@ performance. allocation area will be resized according to the amount of data in the heap (see :rts-flag:`-F`, below). +.. rts-flag:: -AL ?size? + + :default: ``-A`` value + :since: 8.2.1 + + .. index:: + single: allocation area for large objects, size + + Sets the limit on the total size of "large objects" (objects + larger than about 3KB) that can be allocated before a GC is + triggered. By default this limit is the same as the ``-A`` value. + + Large objects are not allocated from the normal allocation area + set by the ``-A`` flag, which is why there is a separate limit for + these. Large objects tend to be much rarer than small objects, so + most programs hit the ``-A`` limit before the ``-AL`` limit. However, + the ``-A`` limit is per-capability, whereas the ``-AL`` limit is global, + so as ``-N`` gets larger it becomes more likely that we hit the + ``-AL`` limit first. To counteract this, it might be necessary to + use a larger ``-AL`` limit when using a large ``-N``. + + To see whether you're making good use of all the memory reseverd + for the allocation area (``-A`` times ``-N``), look at the output of + ``+RTS -S`` and check whether the amount of memory allocated between + GCs is equal to ``-A`` times ``-N``. If not, there are two possible + remedies: use ``-n`` to set a nursery chunk size, or use ``-AL`` to + increase the limit for large objects. + .. rts-flag:: -O ?size? :default: 1m diff --git a/includes/rts/Flags.h b/includes/rts/Flags.h index 16417ce..d3bc001 100644 --- a/includes/rts/Flags.h +++ b/includes/rts/Flags.h @@ -41,6 +41,7 @@ typedef struct _GC_FLAGS { nat maxHeapSize; /* in *blocks* */ nat minAllocAreaSize; /* in *blocks* */ + nat largeAllocLim; /* in *blocks* */ nat nurseryChunkSize; /* in *blocks* */ nat minOldGenSize; /* in *blocks* */ nat heapSizeSuggestion; /* in *blocks* */ diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c index 73c5b45..084fc21 100644 --- a/rts/RtsFlags.c +++ b/rts/RtsFlags.c @@ -136,6 +136,7 @@ void initRtsFlagsDefaults(void) RtsFlags.GcFlags.stkChunkBufferSize = (1 * 1024) / sizeof(W_); RtsFlags.GcFlags.minAllocAreaSize = (512 * 1024) / BLOCK_SIZE; + RtsFlags.GcFlags.largeAllocLim = 0; /* defaults to minAllocAreasize */ RtsFlags.GcFlags.nurseryChunkSize = 0; RtsFlags.GcFlags.minOldGenSize = (1024 * 1024) / BLOCK_SIZE; RtsFlags.GcFlags.maxHeapSize = 0; /* off by default */ @@ -261,14 +262,16 @@ usage_text[] = { " -kc Sets the stack chunk size (default 32k)", " -kb Sets the stack chunk buffer size (default 1k)", "", -" -A Sets the minimum allocation area size (default 512k) Egs: -A1m -A10k", -" -n Allocation area chunk size (0 = disabled, default: 0)", -" -O Sets the minimum size of the old generation (default 1M)", -" -M Sets the maximum heap size (default unlimited) Egs: -M256k -M1G", -" -H Sets the minimum heap size (default 0M) Egs: -H24m -H1G", -" -m Minimum % of heap which must be available (default 3%)", -" -G Number of generations (default: 2)", -" -c Use in-place compaction instead of copying in the oldest generation", +" -A Sets the minimum allocation area size (default 512k) Egs: -A1m -A10k", +" -AL Sets the amount of large-object memory that can be allocated", +" before a GC is triggered (default: the value of -A)", +" -n Allocation area chunk size (0 = disabled, default: 0)", +" -O Sets the minimum size of the old generation (default 1M)", +" -M Sets the maximum heap size (default unlimited) Egs: -M256k -M1G", +" -H Sets the minimum heap size (default 0M) Egs: -H24m -H1G", +" -m Minimum % of heap which must be available (default 3%)", +" -G Number of generations (default: 2)", +" -c Use in-place compaction instead of copying in the oldest generation", " when live data is at least % of the maximum heap size set with", " -M (default: 30%)", " -c Use in-place compaction for all oldest generation collections", @@ -750,11 +753,17 @@ error = rtsTrue; break; case 'A': OPTION_UNSAFE; - // minimum two blocks in the nursery, so that we have one to - // grab for allocate(). - RtsFlags.GcFlags.minAllocAreaSize - = decodeSize(rts_argv[arg], 2, 2*BLOCK_SIZE, HS_INT_MAX) - / BLOCK_SIZE; + if (rts_argv[arg][2] == 'L') { + RtsFlags.GcFlags.largeAllocLim + = decodeSize(rts_argv[arg], 3, 2*BLOCK_SIZE, + HS_INT_MAX) / BLOCK_SIZE; + } else { + // minimum two blocks in the nursery, so that we have one + // to grab for allocate(). + RtsFlags.GcFlags.minAllocAreaSize + = decodeSize(rts_argv[arg], 2, 2*BLOCK_SIZE, + HS_INT_MAX) / BLOCK_SIZE; + } break; case 'n': OPTION_UNSAFE; diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c index 18ae796..3e421a6 100644 --- a/rts/sm/Storage.c +++ b/rts/sm/Storage.c @@ -179,8 +179,11 @@ initStorage (void) debug_caf_list = (StgIndStatic*)END_OF_CAF_LIST; revertible_caf_list = (StgIndStatic*)END_OF_CAF_LIST; - /* initialise the allocate() interface */ - large_alloc_lim = RtsFlags.GcFlags.minAllocAreaSize * BLOCK_SIZE_W; + if (RtsFlags.GcFlags.largeAllocLim > 0) { + large_alloc_lim = RtsFlags.GcFlags.largeAllocLim * BLOCK_SIZE_W; + } else { + large_alloc_lim = RtsFlags.GcFlags.minAllocAreaSize * BLOCK_SIZE_W; + } exec_block = NULL; From git at git.haskell.org Wed May 4 12:47:38 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 4 May 2016 12:47:38 +0000 (UTC) Subject: [commit: ghc] master: schedulePushWork: avoid unnecessary wakeups (1fa92ca) Message-ID: <20160504124738.ABEA33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1fa92ca9b1ed4cf44e2745830c9e9ccc2bee12d5/ghc >--------------------------------------------------------------- commit 1fa92ca9b1ed4cf44e2745830c9e9ccc2bee12d5 Author: Simon Marlow Date: Sun Apr 24 21:31:55 2016 +0100 schedulePushWork: avoid unnecessary wakeups This function had some pathalogically bad behaviour: if we had 2 threads on the current capability and 23 other idle capabilities, we would * grab all 23 capabilities * migrate one Haskell thread to one of them * wake up a worker on *all* 23 other capabilities. This lead to a lot of unnecessary wakeups when using large -N values. Now, we * Count how many capabilities we need to wake up * Start from cap->no+1, so that we don't overload low-numbered capabilities * Only wake up capabilities that we migrated a thread to (unless we have sparks to steal) This results in a pretty dramatic improvement in our production system. >--------------------------------------------------------------- 1fa92ca9b1ed4cf44e2745830c9e9ccc2bee12d5 rts/Schedule.c | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/rts/Schedule.c b/rts/Schedule.c index abf3be5..3eb9624 100644 --- a/rts/Schedule.c +++ b/rts/Schedule.c @@ -699,7 +699,8 @@ schedulePushWork(Capability *cap USED_IF_THREADS, #if defined(THREADED_RTS) Capability *free_caps[n_capabilities], *cap0; - nat i, n_free_caps; + nat i, n_wanted_caps, n_free_caps; + StgTSO *t; // migration can be turned off with +RTS -qm if (!RtsFlags.ParFlags.migrate) return; @@ -713,8 +714,22 @@ schedulePushWork(Capability *cap USED_IF_THREADS, sparkPoolSizeCap(cap) < 1) return; } - // First grab as many free Capabilities as we can. - for (i=0, n_free_caps=0; i < n_capabilities; i++) { + // Figure out how many capabilities we want to wake up. We need at least + // sparkPoolSize(cap) plus the number of spare threads we have. + t = cap->run_queue_hd; + n_wanted_caps = sparkPoolSizeCap(cap); + if (t != END_TSO_QUEUE) { + do { + t = t->_link; + if (t == END_TSO_QUEUE) break; + n_wanted_caps++; + } while (n_wanted_caps < n_capabilities-1); + } + + // Grab free capabilities, starting from cap->no+1. + for (i = (cap->no + 1) % n_capabilities, n_free_caps=0; + n_free_caps < n_wanted_caps && i != cap->no; + i = (i + 1) % n_capabilities) { cap0 = capabilities[i]; if (cap != cap0 && !cap0->disabled && tryGrabCapability(cap0,task)) { if (!emptyRunQueue(cap0) @@ -824,10 +839,13 @@ schedulePushWork(Capability *cap USED_IF_THREADS, // release the capabilities for (i = 0; i < n_free_caps; i++) { task->cap = free_caps[i]; - // The idea behind waking up the capability unconditionally is that - // it might be able to steal sparks. Perhaps we should only do this - // if there were sparks to steal? - releaseAndWakeupCapability(free_caps[i]); + if (sparkPoolSizeCap(cap) > 0) { + // If we have sparks to steal, wake up a worker on the + // capability, even if it has no threads to run. + releaseAndWakeupCapability(free_caps[i]); + } else { + releaseCapability(free_caps[i]); + } } } task->cap = cap; // reset to point to our Capability. From git at git.haskell.org Wed May 4 12:47:41 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 4 May 2016 12:47:41 +0000 (UTC) Subject: [commit: ghc] master: Don't STATIC_INLINE giveCapabilityToTask (dbcaa8c) Message-ID: <20160504124741.54C873A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/dbcaa8c2c16aac3908d177601e949ecdd5ed6752/ghc >--------------------------------------------------------------- commit dbcaa8c2c16aac3908d177601e949ecdd5ed6752 Author: Simon Marlow Date: Wed May 4 04:29:06 2016 -0700 Don't STATIC_INLINE giveCapabilityToTask This causes errors with some versions of gcc (4.4.7 here). >--------------------------------------------------------------- dbcaa8c2c16aac3908d177601e949ecdd5ed6752 rts/Capability.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rts/Capability.c b/rts/Capability.c index aa77d1b..2f8e152 100644 --- a/rts/Capability.c +++ b/rts/Capability.c @@ -428,7 +428,7 @@ void interruptAllCapabilities(void) * ------------------------------------------------------------------------- */ #if defined(THREADED_RTS) -STATIC_INLINE void +static void giveCapabilityToTask (Capability *cap USED_IF_DEBUG, Task *task) { ASSERT_LOCK_HELD(&cap->lock); From git at git.haskell.org Wed May 4 13:02:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 4 May 2016 13:02:03 +0000 (UTC) Subject: [commit: ghc] master: Be more aggressive when checking constraints for custom type errors. (b75d194) Message-ID: <20160504130203.11EE73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b75d1940dd3362382c0bc94018a9045c2def82a9/ghc >--------------------------------------------------------------- commit b75d1940dd3362382c0bc94018a9045c2def82a9 Author: Iavor S. Diatchki Date: Tue May 3 22:55:07 2016 +0200 Be more aggressive when checking constraints for custom type errors. This fixes #11990. The current rule is simpler than before: if we encounter an unsolved constraint that contains any mentions of properly applied `TypeError`, then we report the type error. If there are multiple `TypeErrors`, then we just report one of them. Reviewers: simonpj, bgamari, austin Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2151 GHC Trac Issues: #11990 >--------------------------------------------------------------- b75d1940dd3362382c0bc94018a9045c2def82a9 compiler/typecheck/TcRnTypes.hs | 55 ++++++++++++++++++---- testsuite/tests/typecheck/should_fail/T11990a.hs | 24 ++++++++++ .../tests/typecheck/should_fail/T11990a.stderr | 5 ++ testsuite/tests/typecheck/should_fail/T11990b.hs | 28 +++++++++++ .../tests/typecheck/should_fail/T11990b.stderr | 5 ++ testsuite/tests/typecheck/should_fail/all.T | 2 + 6 files changed, 109 insertions(+), 10 deletions(-) diff --git a/compiler/typecheck/TcRnTypes.hs b/compiler/typecheck/TcRnTypes.hs index bce7002..dc05c13 100644 --- a/compiler/typecheck/TcRnTypes.hs +++ b/compiler/typecheck/TcRnTypes.hs @@ -1782,18 +1782,53 @@ isTypeHoleCt :: Ct -> Bool isTypeHoleCt (CHoleCan { cc_hole = TypeHole {} }) = True isTypeHoleCt _ = False --- | The following constraints are considered to be a custom type error: --- 1. TypeError msg a b c --- 2. TypeError msg a b c ~ Something (and the other way around) --- 4. C (TypeError msg a b c) (for any parameter of class constraint) + +{- Note [Custom type errors in constraints] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +When GHC reports a type-error about an unsolved-constraint, we check +to see if the constraint contains any custom-type errors, and if so +we report them. Here are some examples of constraints containing type +errors: + +TypeError msg -- The actual constraint is a type error + +TypError msg ~ Int -- Some type was supposed to be Int, but ended up + -- being a type error instead + +Eq (TypeError msg) -- A class constraint is stuck due to a type error + +F (TypeError msg) ~ a -- A type function failed to evaluate due to a type err + +It is also possible to have constraints where the type error is nested deeper, +for example see #11990, and also: + +Eq (F (TypeError msg)) -- Here the type error is nested under a type-function + -- call, which failed to evaluate because of it, + -- and so the `Eq` constraint was unsolved. + -- This may happen when one function calls another + -- and the called function produced a custom type error. +-} + +-- | A constraint is considered to be a custom type error, if it contains +-- custom type errors anywhere in it. +-- See Note [Custom type errors in constraints] getUserTypeErrorMsg :: Ct -> Maybe Type -getUserTypeErrorMsg ct - | Just (_,t1,t2) <- getEqPredTys_maybe ctT = oneOf [t1,t2] - | Just (_,ts) <- getClassPredTys_maybe ctT = oneOf ts - | otherwise = userTypeError_maybe ctT +getUserTypeErrorMsg ct = findUserTypeError (ctPred ct) where - ctT = ctPred ct - oneOf xs = msum (map userTypeError_maybe xs) + findUserTypeError t = msum ( userTypeError_maybe t + : map findUserTypeError (subTys t) + ) + + subTys t = case splitAppTys t of + (t,[]) -> + case splitTyConApp_maybe t of + Nothing -> [] + Just (_,ts) -> ts + (t,ts) -> t : ts + + + isUserTypeErrorCt :: Ct -> Bool isUserTypeErrorCt ct = case getUserTypeErrorMsg ct of diff --git a/testsuite/tests/typecheck/should_fail/T11990a.hs b/testsuite/tests/typecheck/should_fail/T11990a.hs new file mode 100644 index 0000000..7b7a03b --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T11990a.hs @@ -0,0 +1,24 @@ +{-# LANGUAGE DataKinds, TypeOperators, TypeFamilies #-} +{-# LANGUAGE UndecidableInstances, ScopedTypeVariables, FlexibleContexts #-} + +module T11990a where + +import GHC.TypeLits +import Data.Proxy + +type family PartialTF t :: Symbol where + PartialTF Int = "Int" + PartialTF Bool = "Bool" + PartialTF a = TypeError (Text "Unexpected type @ PartialTF: " + :<>: ShowType a) + +testPartialTF :: forall a.(KnownSymbol (PartialTF a)) => a -> String +testPartialTF t = symbolVal (Proxy :: Proxy (PartialTF a)) + +t1 = testPartialTF 'a' + +{- Above code rightly fails with the following error: + ? Unexpected type: Char + ? In the expression: testPartialTF 'a' + In an equation for ?t1?: t1 = testPartialTF 'a' +-} diff --git a/testsuite/tests/typecheck/should_fail/T11990a.stderr b/testsuite/tests/typecheck/should_fail/T11990a.stderr new file mode 100644 index 0000000..f875e67 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T11990a.stderr @@ -0,0 +1,5 @@ + +T11990a.hs:18:6: + Unexpected type @ PartialTF: Char + In the expression: testPartialTF 'a' + In an equation for ?t1?: t1 = testPartialTF 'a' diff --git a/testsuite/tests/typecheck/should_fail/T11990b.hs b/testsuite/tests/typecheck/should_fail/T11990b.hs new file mode 100644 index 0000000..9a31670 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T11990b.hs @@ -0,0 +1,28 @@ +{-# LANGUAGE DataKinds, TypeOperators, TypeFamilies #-} +{-# LANGUAGE UndecidableInstances, ScopedTypeVariables, FlexibleContexts #-} + +module T11990b where + +import GHC.TypeLits +import Data.Proxy + +type family PartialTF t :: Symbol where + PartialTF Int = "Int" + PartialTF Bool = "Bool" + PartialTF a = TypeError (Text "Unexpected type @ PartialTF: " + :<>: ShowType a) + +type family NestedPartialTF (tsym :: Symbol) :: Symbol where + NestedPartialTF "Int" = "int" + NestedPartialTF "Bool" = "bool" + NestedPartialTF a = + TypeError (Text "Unexpected type @ NestedPartialTF: " :<>: ShowType a) + +testPartialTF :: forall a.(KnownSymbol (PartialTF a)) => a -> String +testPartialTF t = symbolVal (Proxy :: Proxy (PartialTF a)) + +testNesPartialTF :: + forall a.(KnownSymbol (NestedPartialTF (PartialTF a))) => a -> String +testNesPartialTF t = symbolVal (Proxy :: Proxy (NestedPartialTF (PartialTF a))) + +t2 = testNesPartialTF 'a' diff --git a/testsuite/tests/typecheck/should_fail/T11990b.stderr b/testsuite/tests/typecheck/should_fail/T11990b.stderr new file mode 100644 index 0000000..9a92d43 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T11990b.stderr @@ -0,0 +1,5 @@ + +T11990b.hs:28:6: + Unexpected type @ PartialTF: Char + In the expression: testNesPartialTF 'a' + In an equation for ?t2?: t2 = testNesPartialTF 'a' diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index 3310ec9..6519768 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -416,3 +416,5 @@ test('BadUnboxedTuple', normal, compile_fail, ['']) test('T11698', normal, compile_fail, ['']) test('T11947a', normal, compile_fail, ['']) test('T11948', normal, compile_fail, ['']) +test('T11990a', normal, compile_fail, ['']) +test('T11990b', normal, compile_fail, ['']) From git at git.haskell.org Wed May 4 13:02:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 4 May 2016 13:02:06 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Add test for #11959 (4f2afe1) Message-ID: <20160504130206.8BEF43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4f2afe1e674606230f2dc2f8ce040a2bd345a647/ghc >--------------------------------------------------------------- commit 4f2afe1e674606230f2dc2f8ce040a2bd345a647 Author: Ben Gamari Date: Tue May 3 22:58:47 2016 +0200 testsuite: Add test for #11959 Test Plan: Validate, expected to fail Reviewers: goldfire, austin Reviewed By: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2132 GHC Trac Issues: #11959 >--------------------------------------------------------------- 4f2afe1e674606230f2dc2f8ce040a2bd345a647 testsuite/tests/patsyn/should_compile/T11959.hs | 6 ++++++ testsuite/tests/patsyn/should_compile/T11959.stdout | 3 +++ testsuite/tests/patsyn/should_compile/T11959Lib.hs | 11 +++++++++++ testsuite/tests/patsyn/should_compile/all.T | 1 + 4 files changed, 21 insertions(+) diff --git a/testsuite/tests/patsyn/should_compile/T11959.hs b/testsuite/tests/patsyn/should_compile/T11959.hs new file mode 100644 index 0000000..ccff2e0 --- /dev/null +++ b/testsuite/tests/patsyn/should_compile/T11959.hs @@ -0,0 +1,6 @@ +{-# LANGUAGE PatternSynonyms #-} +module Main where + +import T11959Lib (Vec2(..), pattern (:>)) + +main = return () diff --git a/testsuite/tests/patsyn/should_compile/T11959.stdout b/testsuite/tests/patsyn/should_compile/T11959.stdout new file mode 100644 index 0000000..01c0f01 --- /dev/null +++ b/testsuite/tests/patsyn/should_compile/T11959.stdout @@ -0,0 +1,3 @@ + +T11959Lib.hs:2:35: warning: [-Wduplicate-exports (in -Wdefault)] + ?:>? is exported by ?(:>)? and ?Vec2(Nil, type (:>))? diff --git a/testsuite/tests/patsyn/should_compile/T11959Lib.hs b/testsuite/tests/patsyn/should_compile/T11959Lib.hs new file mode 100644 index 0000000..4c00721 --- /dev/null +++ b/testsuite/tests/patsyn/should_compile/T11959Lib.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE PatternSynonyms, ViewPatterns #-} +module T11959Lib (Vec2(Nil,(:>)), pattern (:>)) where + +newtype Vec2 a = Vec2 {unvec2 :: [a]} + +pattern Nil :: Vec2 a +pattern Nil = Vec2 [] + +pattern (:>) x xs <- ((\ys -> (head $ unvec2 ys,Vec2 . tail $ unvec2 ys)) -> (x,xs)) + where + (:>) x xs = Vec2 (x:unvec2 xs) diff --git a/testsuite/tests/patsyn/should_compile/all.T b/testsuite/tests/patsyn/should_compile/all.T index 3032096..d2f6809 100644 --- a/testsuite/tests/patsyn/should_compile/all.T +++ b/testsuite/tests/patsyn/should_compile/all.T @@ -52,3 +52,4 @@ test('T11336', normal, compile, ['']) test('T11367', normal, compile, ['']) test('T11351', normal, compile, ['']) test('T11633', normal, compile, ['']) +test('T11959', expect_broken(11959), multimod_compile, ['T11959', '-v0']) \ No newline at end of file From git at git.haskell.org Wed May 4 17:10:17 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 4 May 2016 17:10:17 +0000 (UTC) Subject: [commit: ghc] master: base: Export runRW# from GHC.Exts (763610e) Message-ID: <20160504171017.AE75D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/763610e990207eaa143856fca411d5ad420651ed/ghc >--------------------------------------------------------------- commit 763610e990207eaa143856fca411d5ad420651ed Author: Ben Gamari Date: Wed May 4 18:30:51 2016 +0200 base: Export runRW# from GHC.Exts Seems like this should be available in GHC.Exts. Thanks for @carter for pointing this out. Test Plan: Validate Reviewers: rwbarton, hvr, austin Reviewed By: austin Subscribers: thomie, carter Differential Revision: https://phabricator.haskell.org/D2171 >--------------------------------------------------------------- 763610e990207eaa143856fca411d5ad420651ed libraries/base/GHC/Exts.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libraries/base/GHC/Exts.hs b/libraries/base/GHC/Exts.hs index 4c147ae..35d344c 100755 --- a/libraries/base/GHC/Exts.hs +++ b/libraries/base/GHC/Exts.hs @@ -46,6 +46,9 @@ module GHC.Exts -- * Ids with special behaviour lazy, inline, oneShot, + -- * Running 'RealWorld' state transformers + runRW#, + -- * Safe coercions -- -- | These are available from the /Trustworthy/ module "Data.Coerce" as well From git at git.haskell.org Wed May 4 17:16:37 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 4 May 2016 17:16:37 +0000 (UTC) Subject: [commit: ghc] master: Kill non-deterministic foldUFM in TrieMap and TcAppMap (ad4392c) Message-ID: <20160504171637.A754C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ad4392c142696d5092533480a82ed65322e9d413/ghc >--------------------------------------------------------------- commit ad4392c142696d5092533480a82ed65322e9d413 Author: Bartosz Nitka Date: Wed May 4 09:22:37 2016 -0700 Kill non-deterministic foldUFM in TrieMap and TcAppMap Summary: foldUFM introduces unnecessary non-determinism that actually leads to different generated code as explained in Note [TrieMap determinism]. As we're switching from UniqFM to UniqDFM here you might be concerned about performance. There's nothing that ./validate detects. nofib reports no change in Compile Allocations, but Compile Time got better on some tests and worse on some, yielding this summary: -1 s.d. ----- -3.8% +1 s.d. ----- +5.4% Average ----- +0.7% This is not a fair comparison as the order of Uniques changes what GHC is actually doing. One benefit from making this deterministic is also that it will make the performance results more stable. Full nofib results: P108 Test Plan: ./validate, nofib Reviewers: goldfire, simonpj, simonmar, austin, bgamari Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2169 GHC Trac Issues: #4012 >--------------------------------------------------------------- ad4392c142696d5092533480a82ed65322e9d413 compiler/basicTypes/NameEnv.hs | 24 ++++ compiler/basicTypes/VarEnv.hs | 8 ++ compiler/coreSyn/TrieMap.hs | 132 ++++++++++++++++----- compiler/typecheck/TcSMonad.hs | 28 +++-- testsuite/tests/ado/ado004.stderr | 4 +- .../tests/ghc-api/apirecomp001/apirecomp001.stderr | 16 +-- .../indexed-types/should_compile/T3017.stderr | 2 +- testsuite/tests/parser/should_compile/T2245.stderr | 8 +- .../should_compile/ExtraConstraints1.stderr | 6 +- .../should_compile/ExtraConstraints3.stderr | 32 ++--- .../WarningWildcardInstantiations.stderr | 2 +- .../InstantiatedNamedWildcardsInConstraints.stderr | 2 +- .../should_fail/WildcardInstantiations.stderr | 2 +- testsuite/tests/rebindable/rebindable6.stderr | 17 +-- .../tests/typecheck/should_compile/T10971a.stderr | 6 +- testsuite/tests/typecheck/should_fail/T5300.stderr | 4 +- testsuite/tests/typecheck/should_fail/T5853.stderr | 29 +++-- .../tests/typecheck/should_fail/tcfail171.stderr | 4 +- .../tests/typecheck/should_fail/tcfail204.stderr | 9 +- .../tests/warnings/should_compile/PluralS.stderr | 7 +- 20 files changed, 222 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 ad4392c142696d5092533480a82ed65322e9d413 From git at git.haskell.org Wed May 4 22:27:49 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 4 May 2016 22:27:49 +0000 (UTC) Subject: [commit: ghc] master: rts: Replace `nat` with `uint32_t` (db9de7e) Message-ID: <20160504222749.DFADF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/db9de7eb3e91820024f673bfdb6fb8064cfed20d/ghc >--------------------------------------------------------------- commit db9de7eb3e91820024f673bfdb6fb8064cfed20d Author: Erik de Castro Lopo Date: Mon May 2 06:37:14 2016 +1000 rts: Replace `nat` with `uint32_t` The `nat` type was an alias for `unsigned int` with a comment saying it was at least 32 bits. We keep the typedef in case client code is using it but mark it as deprecated. Test Plan: Validated on Linux, OS X and Windows Reviewers: simonmar, austin, thomie, hvr, bgamari, hsyl20 Differential Revision: https://phabricator.haskell.org/D2166 >--------------------------------------------------------------- db9de7eb3e91820024f673bfdb6fb8064cfed20d includes/rts/Flags.h | 54 ++++++++++++------------- includes/rts/IOManager.h | 2 +- includes/rts/OSThreads.h | 4 +- includes/rts/SpinLock.h | 4 +- includes/rts/Threads.h | 4 +- includes/rts/Types.h | 3 +- includes/rts/prof/CCS.h | 2 +- includes/rts/storage/Block.h | 4 +- includes/rts/storage/ClosureMacros.h | 36 ++++++++--------- includes/rts/storage/GC.h | 8 ++-- includes/rts/storage/MBlock.h | 4 +- includes/rts/storage/SMPClosureOps.h | 2 +- rts/Adjustor.c | 4 +- rts/Arena.c | 4 +- rts/Capability.c | 35 +++++++++-------- rts/Capability.h | 23 +++++------ rts/CheckUnload.c | 4 +- rts/Disassembler.c | 10 ++--- rts/Globals.c | 4 +- rts/Hpc.c | 10 ++--- rts/Interpreter.c | 16 ++++---- rts/LdvProfile.c | 8 ++-- rts/LdvProfile.h | 2 +- rts/LibdwPool.c | 2 +- rts/Linker.c | 10 ++--- rts/Messages.c | 6 +-- rts/Messages.h | 2 +- rts/Pool.c | 22 +++++------ rts/Pool.h | 10 ++--- rts/Printer.c | 14 ++++--- rts/ProfHeap.c | 30 +++++++------- rts/ProfHeap.h | 8 ++-- rts/Profiling.c | 51 ++++++++++++------------ rts/Proftimer.c | 4 +- rts/RaiseAsync.c | 12 +++--- rts/RaiseAsync.h | 2 +- rts/RetainerProfile.c | 72 +++++++++++++++++----------------- rts/RetainerSet.c | 28 ++++++------- rts/RetainerSet.h | 8 ++-- rts/RtsFlags.c | 21 +++++----- rts/RtsStartup.c | 2 +- rts/Schedule.c | 52 ++++++++++++------------ rts/Sparks.c | 6 +-- rts/Stable.c | 12 +++--- rts/Stats.c | 28 ++++++------- rts/Stats.h | 10 ++--- rts/Task.c | 13 +++--- rts/Task.h | 10 ++--- rts/ThreadPaused.c | 18 ++++----- rts/Threads.c | 8 ++-- rts/Trace.c | 8 ++-- rts/Trace.h | 24 ++++++------ rts/WSDeque.c | 2 +- rts/WSDeque.h | 2 +- rts/Weak.c | 2 +- rts/eventlog/EventLog.c | 30 +++++++------- rts/eventlog/EventLog.h | 8 ++-- rts/posix/GetTime.c | 2 +- rts/posix/OSMem.c | 4 +- rts/posix/OSThreads.c | 28 ++++++------- rts/posix/Signals.c | 4 +- rts/sm/BlockAlloc.c | 18 ++++----- rts/sm/BlockAlloc.h | 2 +- rts/sm/Compact.h | 6 +-- rts/sm/Evac.c | 24 ++++++------ rts/sm/GC.c | 74 +++++++++++++++++------------------ rts/sm/GC.h | 8 ++-- rts/sm/GCThread.h | 8 ++-- rts/sm/GCUtils.c | 16 ++++---- rts/sm/GCUtils.h | 8 ++-- rts/sm/HeapAlloc.h | 4 +- rts/sm/MBlock.c | 46 +++++++++++----------- rts/sm/MarkWeak.c | 10 ++--- rts/sm/OSMem.h | 4 +- rts/sm/Sanity.c | 52 ++++++++++++------------ rts/sm/Scav.c | 18 ++++----- rts/sm/Storage.c | 38 +++++++++--------- rts/sm/Storage.h | 10 ++--- rts/sm/Sweep.c | 2 +- rts/win32/AwaitEvent.c | 2 +- rts/win32/OSMem.c | 8 ++-- rts/win32/OSThreads.c | 10 ++--- rts/win32/ThrIOManager.c | 2 +- testsuite/tests/rts/testblockalloc.c | 2 +- testsuite/tests/rts/testheapalloced.c | 2 +- testsuite/tests/rts/testmblockalloc.c | 2 +- testsuite/tests/rts/testwsdeque.c | 14 +++---- 87 files changed, 611 insertions(+), 601 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc db9de7eb3e91820024f673bfdb6fb8064cfed20d From git at git.haskell.org Thu May 5 05:19:09 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 5 May 2016 05:19:09 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: rts: Ensure `overwritingClosure` uses correct closure size (33bea14) Message-ID: <20160505051909.C04AF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/33bea144990bdd5e2846a2aa084f2d645cf18fa1/ghc >--------------------------------------------------------------- commit 33bea144990bdd5e2846a2aa084f2d645cf18fa1 Author: Erik de Castro Lopo Date: Tue May 3 21:13:17 2016 +1000 rts: Ensure `overwritingClosure` uses correct closure size The function `executeMessage` replaces the `header.info` pointer with a `WHITEHOLE` passes it to `throwToMsg` and then passes it to `doneWithMsgThrowTo` which calls `overwritingClosure` on it. However, `overwritingClosure` needs to know the size of the closure which is based on the `header.info` pointer. Unfortunately, the `header.info` pointer can't be reset to `MSG_THROWTO` or it might cause race conditions. The solution suggested by Simon Marlow is to add and use a function `overwritingClosureWithSize` that takes an explicit size parameter. >--------------------------------------------------------------- 33bea144990bdd5e2846a2aa084f2d645cf18fa1 includes/rts/storage/ClosureMacros.h | 18 +++++++++++++----- rts/Messages.h | 2 +- testsuite/config/ghc | 3 +++ testsuite/tests/profiling/should_run/T11978b.hs | 22 ++++++++++++++++++++++ .../tests/profiling/should_run/T11978b.stdout | 2 ++ testsuite/tests/profiling/should_run/all.T | 4 ++++ 6 files changed, 45 insertions(+), 6 deletions(-) diff --git a/includes/rts/storage/ClosureMacros.h b/includes/rts/storage/ClosureMacros.h index d7ae5ea..dc0b557 100644 --- a/includes/rts/storage/ClosureMacros.h +++ b/includes/rts/storage/ClosureMacros.h @@ -497,10 +497,12 @@ INLINE_HEADER StgWord8 *mutArrPtrsCard (StgMutArrPtrs *a, W_ n) #if ZERO_SLOP_FOR_LDV_PROF || ZERO_SLOP_FOR_SANITY_CHECK #define OVERWRITING_CLOSURE(c) overwritingClosure(c) +#define OVERWRITING_CLOSURE_SIZE(c,s) overwritingClosureWithSize(c,s) #define OVERWRITING_CLOSURE_OFS(c,n) \ overwritingClosureOfs(c,n) #else #define OVERWRITING_CLOSURE(c) /* nothing */ +#define OVERWRITING_CLOSURE_SIZE(c,s) /* nothing */ #define OVERWRITING_CLOSURE_OFS(c,n) /* nothing */ #endif @@ -508,28 +510,34 @@ INLINE_HEADER StgWord8 *mutArrPtrsCard (StgMutArrPtrs *a, W_ n) void LDV_recordDead (StgClosure *c, uint32_t size); #endif -EXTERN_INLINE void overwritingClosure (StgClosure *p); -EXTERN_INLINE void overwritingClosure (StgClosure *p) +EXTERN_INLINE void overwritingClosureWithSize (StgClosure *p, uint32_t size); +EXTERN_INLINE void overwritingClosureWithSize (StgClosure *p, uint32_t size) { - uint32_t size, i; + uint32_t i; #if ZERO_SLOP_FOR_LDV_PROF && !ZERO_SLOP_FOR_SANITY_CHECK // see Note [zeroing slop], also #8402 if (era <= 0) return; #endif - size = closure_sizeW(p); - // For LDV profiling, we need to record the closure as dead #if defined(PROFILING) LDV_recordDead(p, size); #endif + ASSERT(size >= sizeofW(StgThunkHeader)); + for (i = 0; i < size - sizeofW(StgThunkHeader); i++) { ((StgThunk *)(p))->payload[i] = 0; } } +EXTERN_INLINE void overwritingClosure (StgClosure *p); +EXTERN_INLINE void overwritingClosure (StgClosure *p) +{ + overwritingClosureWithSize(p, closure_sizeW(p)); +} + // Version of 'overwritingClosure' which overwrites only a suffix of a // closure. The offset is expressed in words relative to 'p' and shall // be less than or equal to closure_sizeW(p), and usually at least as diff --git a/rts/Messages.h b/rts/Messages.h index 302cb94..fa7d26f 100644 --- a/rts/Messages.h +++ b/rts/Messages.h @@ -22,7 +22,7 @@ void sendMessage (Capability *from_cap, Capability *to_cap, Message *msg); INLINE_HEADER void doneWithMsgThrowTo (MessageThrowTo *m) { - OVERWRITING_CLOSURE((StgClosure*)m); + OVERWRITING_CLOSURE_SIZE((StgClosure*)m, sizeofW(MessageThrowTo)); unlockClosure((StgClosure*)m, &stg_MSG_NULL_info); LDV_RECORD_CREATE(m); } diff --git a/testsuite/config/ghc b/testsuite/config/ghc index 595415a..347b8b1 100644 --- a/testsuite/config/ghc +++ b/testsuite/config/ghc @@ -75,6 +75,7 @@ config.ghc_dynamic = ghc_dynamic if (ghc_with_profiling == 1 and ghc_with_threaded_rts == 1): config.run_ways.append('profthreaded') + config.run_ways.append('profthrdebug') if (ghc_with_llvm == 1): config.compile_ways.append('optllvm') @@ -108,6 +109,7 @@ config.way_flags = lambda name : { 'prof_hr' : ['-O', '-prof', '-static', '-auto-all'], 'dyn' : ['-O', '-dynamic'], 'static' : ['-O', '-static'], + 'profthrdebug' : ['-O', '-prof', '-static', '-threaded', '-debug'], 'debug' : ['-O', '-g', '-dannot-lint'], # llvm variants... 'profllvm' : ['-prof', '-static', '-auto-all', '-fllvm'], @@ -138,6 +140,7 @@ config.way_rts_flags = { 'prof_hd' : ['-hd'], 'prof_hy' : ['-hy'], 'prof_hr' : ['-hr'], + 'profthrdebug' : ['-p'], 'dyn' : [], 'static' : [], 'debug' : [], diff --git a/testsuite/tests/profiling/should_run/T11978b.hs b/testsuite/tests/profiling/should_run/T11978b.hs new file mode 100644 index 0000000..226e7d1 --- /dev/null +++ b/testsuite/tests/profiling/should_run/T11978b.hs @@ -0,0 +1,22 @@ + +import Control.Concurrent +import Control.Concurrent.MVar +import Control.Exception +import Control.Monad + +main :: IO () +main = do + putStrLn "Start ..." + mvar <- newMVar (0 :: Int) + + let count = 50 + + forM_ [ 1 .. count ] $ const $ forkIO $ do + threadDelay 100 + i <- takeMVar mvar + putMVar mvar $! i + 1 + + threadDelay 1000000 + end <- takeMVar mvar + putStrLn $ "Final result " ++ show end + assert (end == count) $ return () diff --git a/testsuite/tests/profiling/should_run/T11978b.stdout b/testsuite/tests/profiling/should_run/T11978b.stdout new file mode 100644 index 0000000..10976f3 --- /dev/null +++ b/testsuite/tests/profiling/should_run/T11978b.stdout @@ -0,0 +1,2 @@ +Start ... +Final result 50 diff --git a/testsuite/tests/profiling/should_run/all.T b/testsuite/tests/profiling/should_run/all.T index 1f74a27..8c1ada9 100644 --- a/testsuite/tests/profiling/should_run/all.T +++ b/testsuite/tests/profiling/should_run/all.T @@ -110,3 +110,7 @@ test('T11627b', [ extra_run_opts('+RTS -i0 -RTS') # census after each GC test('T11978a', [only_ways(['profthreaded']), extra_run_opts('+RTS -hb -N10')], compile_and_run, ['']) + +test('T11978b', + [only_ways(['profthrdebug']), extra_run_opts('+RTS -hb -N10')], + compile_and_run, ['']) From git at git.haskell.org Thu May 5 05:19:12 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 5 May 2016 05:19:12 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: Add test T12009 (2d3a1b7) Message-ID: <20160505051912.6CEBF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/2d3a1b7722af767685b68d8ac425353075fded5a/ghc >--------------------------------------------------------------- commit 2d3a1b7722af767685b68d8ac425353075fded5a Author: Erik de Castro Lopo Date: Wed May 4 15:39:27 2016 +1000 Add test T12009 >--------------------------------------------------------------- 2d3a1b7722af767685b68d8ac425353075fded5a testsuite/tests/profiling/should_run/{T11978a.hs => T12009.hs} | 0 .../should_run/T5594.stdout => profiling/should_run/T12009.stdout} | 0 testsuite/tests/profiling/should_run/all.T | 4 ++++ 3 files changed, 4 insertions(+) diff --git a/testsuite/tests/profiling/should_run/T11978a.hs b/testsuite/tests/profiling/should_run/T12009.hs similarity index 100% copy from testsuite/tests/profiling/should_run/T11978a.hs copy to testsuite/tests/profiling/should_run/T12009.hs diff --git a/testsuite/tests/ffi/should_run/T5594.stdout b/testsuite/tests/profiling/should_run/T12009.stdout similarity index 100% copy from testsuite/tests/ffi/should_run/T5594.stdout copy to testsuite/tests/profiling/should_run/T12009.stdout diff --git a/testsuite/tests/profiling/should_run/all.T b/testsuite/tests/profiling/should_run/all.T index 8c1ada9..4331ece 100644 --- a/testsuite/tests/profiling/should_run/all.T +++ b/testsuite/tests/profiling/should_run/all.T @@ -114,3 +114,7 @@ test('T11978a', test('T11978b', [only_ways(['profthrdebug']), extra_run_opts('+RTS -hb -N10')], compile_and_run, ['']) + +test('T12009', + [only_ways(['profthrdebug']), extra_run_opts('+RTS -hb -DS -N1')], + compile_and_run, ['']) From git at git.haskell.org Thu May 5 05:19:15 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 5 May 2016 05:19:15 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: RtsFlags: Make `mallocFailHook` const correct (7392662) Message-ID: <20160505051915.1B5A33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/739266233ee35aecd86ab218ecf3900a6be04b95/ghc >--------------------------------------------------------------- commit 739266233ee35aecd86ab218ecf3900a6be04b95 Author: Erik de Castro Lopo Date: Mon May 2 21:20:28 2016 +1000 RtsFlags: Make `mallocFailHook` const correct >--------------------------------------------------------------- 739266233ee35aecd86ab218ecf3900a6be04b95 includes/RtsAPI.h | 2 +- rts/hooks/Hooks.h | 2 +- rts/hooks/MallocFail.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/RtsAPI.h b/includes/RtsAPI.h index 16b8486..a4a094f 100644 --- a/includes/RtsAPI.h +++ b/includes/RtsAPI.h @@ -90,7 +90,7 @@ typedef struct { void (* outOfHeapHook) (W_ request_size, W_ heap_size); // Called when malloc() fails, before exiting - void (* mallocFailHook) (W_ request_size /* in bytes */, char *msg); + void (* mallocFailHook) (W_ request_size /* in bytes */, const char *msg); // Called for every GC void (* gcDoneHook) (unsigned int gen, diff --git a/rts/hooks/Hooks.h b/rts/hooks/Hooks.h index 35a6011..1383ccd 100644 --- a/rts/hooks/Hooks.h +++ b/rts/hooks/Hooks.h @@ -21,7 +21,7 @@ extern char *ghc_rts_opts; extern void OnExitHook (void); extern void StackOverflowHook (W_ stack_size); extern void OutOfHeapHook (W_ request_size, W_ heap_size); -extern void MallocFailHook (W_ request_size /* in bytes */, char *msg); +extern void MallocFailHook (W_ request_size /* in bytes */, const char *msg); extern void FlagDefaultsHook (void); #include "EndPrivate.h" diff --git a/rts/hooks/MallocFail.c b/rts/hooks/MallocFail.c index 63343a7..42606b6 100644 --- a/rts/hooks/MallocFail.c +++ b/rts/hooks/MallocFail.c @@ -11,7 +11,7 @@ #include void -MallocFailHook (W_ request_size /* in bytes */, char *msg) +MallocFailHook (W_ request_size /* in bytes */, const char *msg) { fprintf(stderr, "malloc: failed on request for %" FMT_Word " bytes; message: %s\n", request_size, msg); } From git at git.haskell.org Thu May 5 05:19:17 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 5 May 2016 05:19:17 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: rts/ProfHeap.c: Use `ssize_t` instead of `long`. (c9fe98d) Message-ID: <20160505051917.C004A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/c9fe98d49a2a07e369df6d7935ea7e3cac651373/ghc >--------------------------------------------------------------- commit c9fe98d49a2a07e369df6d7935ea7e3cac651373 Author: Erik de Castro Lopo Date: Mon May 2 20:22:00 2016 +1000 rts/ProfHeap.c: Use `ssize_t` instead of `long`. On x64 Windows `sizeof long` is 4 which could easily overflow resulting in incorrect heap profiling results. This change does not affect either Linux or OS X where `sizeof long` == `sizeof ssize_t` regardless of machine word size. >--------------------------------------------------------------- c9fe98d49a2a07e369df6d7935ea7e3cac651373 rts/ProfHeap.c | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/rts/ProfHeap.c b/rts/ProfHeap.c index 875cc7e..11e4274 100644 --- a/rts/ProfHeap.c +++ b/rts/ProfHeap.c @@ -50,13 +50,14 @@ static uint32_t max_era; typedef struct _counter { void *identity; union { - uint32_t resid; + size_t resid; struct { - long prim; // total size of 'inherently used' closures - long not_used; // total size of 'never used' closures - long used; // total size of 'used at least once' closures - long void_total; // current total size of 'destroyed without being used' closures - long drag_total; // current total size of 'used at least once and waiting to die' + // Total sizes of: + ssize_t prim; // 'inherently used' closures + ssize_t not_used; // 'never used' closures + ssize_t used; // 'used at least once' closures + ssize_t void_total; // 'destroyed without being used' closures + ssize_t drag_total; // 'used at least once and waiting to die' } ldv; } c; struct _counter *next; @@ -79,11 +80,11 @@ typedef struct { Arena * arena; // for LDV profiling, when just displaying by LDV - long prim; - long not_used; - long used; - long void_total; - long drag_total; + size_t prim; + size_t not_used; + size_t used; + size_t void_total; + size_t drag_total; } Census; static Census *censuses = NULL; @@ -193,14 +194,14 @@ LDV_recordDead( StgClosure *c, uint32_t size ) t = (LDVW((c)) & LDV_CREATE_MASK) >> LDV_SHIFT; if (t < era) { if (RtsFlags.ProfFlags.bioSelector == NULL) { - censuses[t].void_total += (long)size; - censuses[era].void_total -= (long)size; + censuses[t].void_total += size; + censuses[era].void_total -= size; ASSERT(censuses[t].void_total < censuses[t].not_used); } else { id = closureIdentity(c); ctr = lookupHashTable(censuses[t].hash, (StgWord)id); ASSERT( ctr != NULL ); - ctr->c.ldv.void_total += (long)size; + ctr->c.ldv.void_total += size; ctr = lookupHashTable(censuses[era].hash, (StgWord)id); if (ctr == NULL) { ctr = arenaAlloc(censuses[era].arena, sizeof(counter)); @@ -210,7 +211,7 @@ LDV_recordDead( StgClosure *c, uint32_t size ) ctr->next = censuses[era].ctrs; censuses[era].ctrs = ctr; } - ctr->c.ldv.void_total -= (long)size; + ctr->c.ldv.void_total -= size; } } } else { @@ -224,7 +225,7 @@ LDV_recordDead( StgClosure *c, uint32_t size ) id = closureIdentity(c); ctr = lookupHashTable(censuses[t+1].hash, (StgWord)id); ASSERT( ctr != NULL ); - ctr->c.ldv.drag_total += (long)size; + ctr->c.ldv.drag_total += size; ctr = lookupHashTable(censuses[era].hash, (StgWord)id); if (ctr == NULL) { ctr = arenaAlloc(censuses[era].arena, sizeof(counter)); @@ -234,7 +235,7 @@ LDV_recordDead( StgClosure *c, uint32_t size ) ctr->next = censuses[era].ctrs; censuses[era].ctrs = ctr; } - ctr->c.ldv.drag_total -= (long)size; + ctr->c.ldv.drag_total -= size; } } } @@ -739,7 +740,7 @@ static void dumpCensus( Census *census ) { counter *ctr; - long count; + size_t count; printSample(rtsTrue, census->time); @@ -778,8 +779,6 @@ dumpCensus( Census *census ) count = ctr->c.resid; } - ASSERT( count >= 0 ); - if (count == 0) continue; #if !defined(PROFILING) @@ -835,7 +834,7 @@ dumpCensus( Census *census ) } -static void heapProfObject(Census *census, StgClosure *p, uint32_t size, +static void heapProfObject(Census *census, StgClosure *p, size_t size, rtsBool prim #ifndef PROFILING STG_UNUSED @@ -843,7 +842,7 @@ static void heapProfObject(Census *census, StgClosure *p, uint32_t size, ) { void *identity; - uint32_t real_size; + size_t real_size; counter *ctr; identity = NULL; @@ -920,7 +919,7 @@ heapCensusChain( Census *census, bdescr *bd ) { StgPtr p; StgInfoTable *info; - uint32_t size; + size_t size; rtsBool prim; for (; bd != NULL; bd = bd->link) { From git at git.haskell.org Thu May 5 05:19:20 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 5 May 2016 05:19:20 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: rts: Replace `nat` with `uint32_t` (a5c7d2d) Message-ID: <20160505051920.6A44D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/a5c7d2db6d53a7b83177f5e04cca712cd24c7bd6/ghc >--------------------------------------------------------------- commit a5c7d2db6d53a7b83177f5e04cca712cd24c7bd6 Author: Erik de Castro Lopo Date: Mon May 2 06:37:14 2016 +1000 rts: Replace `nat` with `uint32_t` Summary: The `nat` type was an alias for `unsigned int` with a comment saying it was at least 32 bits. We keep the typedef in case client code is using it but mark it as deprecated. Test Plan: Validated on Linux, OS X and Windows Reviewers: simonmar, austin, thomie, hvr, bgamari, hsyl20 Differential Revision: https://phabricator.haskell.org/D2166 >--------------------------------------------------------------- a5c7d2db6d53a7b83177f5e04cca712cd24c7bd6 rts/RaiseAsync.c | 0 1 file changed, 0 insertions(+), 0 deletions(-) From git at git.haskell.org Thu May 5 05:19:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 5 May 2016 05:19:23 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: RtsUtils: Use `size_t` instead of `int` where appropriate (6857ff9) Message-ID: <20160505051923.141FE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/6857ff9513902f6d27fd9093beedc82803d680cf/ghc >--------------------------------------------------------------- commit 6857ff9513902f6d27fd9093beedc82803d680cf Author: Erik de Castro Lopo Date: Mon May 2 20:07:05 2016 +1000 RtsUtils: Use `size_t` instead of `int` where appropriate Functions like `stgMallocBytes` take a size parameter which was of type `int`, but is commonly used as `stgMallocBytes (sizeof (...))`. This is problematic because the `sizeof` operator returns `size_t` so that on 64 bit systems, in this common use case the `size_t` parameter would be truncated to 32 bits when passed to `stgMallocBytes` where it was cast back to `size_t`. >--------------------------------------------------------------- 6857ff9513902f6d27fd9093beedc82803d680cf rts/RtsUtils.c | 22 +++++++++------------- rts/RtsUtils.h | 6 +++--- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/rts/RtsUtils.c b/rts/RtsUtils.c index c837143..716d203 100644 --- a/rts/RtsUtils.c +++ b/rts/RtsUtils.c @@ -57,13 +57,11 @@ extern char *ctime_r(const time_t *, char *); -------------------------------------------------------------------------- */ void * -stgMallocBytes (int n, char *msg) +stgMallocBytes (size_t n, char *msg) { - char *space; - size_t n2; + void *space; - n2 = (size_t) n; - if ((space = (char *) malloc(n2)) == NULL) { + if ((space = malloc(n)) == NULL) { /* Quoting POSIX.1-2008 (which says more or less the same as ISO C99): * * "Upon successful completion with size not equal to 0, malloc() shall @@ -85,13 +83,11 @@ stgMallocBytes (int n, char *msg) } void * -stgReallocBytes (void *p, int n, char *msg) +stgReallocBytes (void *p, size_t n, char *msg) { - char *space; - size_t n2; + void *space; - n2 = (size_t) n; - if ((space = (char *) realloc(p, (size_t) n2)) == NULL) { + if ((space = realloc(p, n)) == NULL) { /* don't fflush(stdout); WORKAROUND bug in Linux glibc */ rtsConfig.mallocFailHook((W_) n, msg); /*msg*/ stg_exit(EXIT_INTERNAL_ERROR); @@ -100,11 +96,11 @@ stgReallocBytes (void *p, int n, char *msg) } void * -stgCallocBytes (int n, int m, char *msg) +stgCallocBytes (size_t n, size_t m, char *msg) { - char *space; + void *space; - if ((space = (char *) calloc((size_t) n, (size_t) m)) == NULL) { + if ((space = calloc(n, m)) == NULL) { /* don't fflush(stdout); WORKAROUND bug in Linux glibc */ rtsConfig.mallocFailHook((W_) n*m, msg); /*msg*/ stg_exit(EXIT_INTERNAL_ERROR); diff --git a/rts/RtsUtils.h b/rts/RtsUtils.h index d76c921..2d5e5de 100644 --- a/rts/RtsUtils.h +++ b/rts/RtsUtils.h @@ -18,12 +18,12 @@ void initAllocator(void); void shutdownAllocator(void); -void *stgMallocBytes(int n, char *msg) +void *stgMallocBytes(size_t n, char *msg) GNUC3_ATTRIBUTE(__malloc__); -void *stgReallocBytes(void *p, int n, char *msg); +void *stgReallocBytes(void *p, size_t n, char *msg); -void *stgCallocBytes(int n, int m, char *msg) +void *stgCallocBytes(size_t n, size_t m, char *msg) GNUC3_ATTRIBUTE(__malloc__); char *stgStrndup(const char *s, size_t n); From git at git.haskell.org Thu May 5 05:19:25 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 5 May 2016 05:19:25 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: rts: Fix segfault in profiling/debug/sanity checking mode (b59edda) Message-ID: <20160505051925.B7CA43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/b59edda69f5a92b54920b1a0e61065e4115d69f9/ghc >--------------------------------------------------------------- commit b59edda69f5a92b54920b1a0e61065e4115d69f9 Author: Erik de Castro Lopo Date: Thu May 5 15:10:24 2016 +1000 rts: Fix segfault in profiling/debug/sanity checking mode The profiling code assumes that un-used memory at the start of a block is zero filled so the profiling code can just skip over it. However, when compiled in DEBUG mode and with the debug sanity checking RTS flag (`-DS`) given on the command line, the memory allocator pre-fills new blocks with `0xaa` which causes the profiling code to segfault. The fix is just to detect debug sanity checking and ignore any `0xaa` filled memory. It does however mean that profiling results when debug sanity checking is enabled may produce incorrect results. >--------------------------------------------------------------- b59edda69f5a92b54920b1a0e61065e4115d69f9 rts/LdvProfile.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rts/LdvProfile.c b/rts/LdvProfile.c index 1dfdc56..42081ae 100644 --- a/rts/LdvProfile.c +++ b/rts/LdvProfile.c @@ -184,7 +184,14 @@ processNurseryForDead( void ) for (bd = MainCapability.r.rNursery->blocks; bd != NULL; bd = bd->link) { p = bd->start; while (p < bd->free) { + // The start of the block may be zero filled which we need to skip + // over. while (p < bd->free && !*p) p++; // skip slop + + // In debug mode, with sanity checking enabled, the start of the + // block may be filled with `0xaa` so if we find it, we just break. + IF_DEBUG(sanity, if (*((StgWord32*)p) == 0xaaaaaaaa) break;); + if (p >= bd->free) break; p += processHeapClosureForDead((StgClosure *)p); } From git at git.haskell.org Thu May 5 05:19:28 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 5 May 2016 05:19:28 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat's head updated: rts: Fix segfault in profiling/debug/sanity checking mode (b59edda) Message-ID: <20160505051928.15FD83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/erikd/remove-nat' now includes: 76ee260 Allow limiting the number of GC threads (+RTS -qn) f703fd6 Add +RTS -AL 1fa92ca schedulePushWork: avoid unnecessary wakeups dbcaa8c Don't STATIC_INLINE giveCapabilityToTask aa5e2dd Make 'make fast' work for the User Guide b75d194 Be more aggressive when checking constraints for custom type errors. 4f2afe1 testsuite: Add test for #11959 763610e base: Export runRW# from GHC.Exts ad4392c Kill non-deterministic foldUFM in TrieMap and TcAppMap db9de7e rts: Replace `nat` with `uint32_t` 33bea14 rts: Ensure `overwritingClosure` uses correct closure size a5c7d2d rts: Replace `nat` with `uint32_t` c9fe98d rts/ProfHeap.c: Use `ssize_t` instead of `long`. 6857ff9 RtsUtils: Use `size_t` instead of `int` where appropriate 7392662 RtsFlags: Make `mallocFailHook` const correct 2d3a1b7 Add test T12009 b59edda rts: Fix segfault in profiling/debug/sanity checking mode From git at git.haskell.org Thu May 5 09:22:26 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 5 May 2016 09:22:26 +0000 (UTC) Subject: [commit: ghc] master: Comments only explaining export list parsing. (e340520) Message-ID: <20160505092226.3A9B53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e340520db86d492e0af7fe68704949eee7fa716c/ghc >--------------------------------------------------------------- commit e340520db86d492e0af7fe68704949eee7fa716c Author: Matthew Pickering Date: Thu May 5 10:25:12 2016 +0100 Comments only explaining export list parsing. >--------------------------------------------------------------- e340520db86d492e0af7fe68704949eee7fa716c compiler/parser/Parser.y | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/compiler/parser/Parser.y b/compiler/parser/Parser.y index 998ef6c..9489be4 100644 --- a/compiler/parser/Parser.y +++ b/compiler/parser/Parser.y @@ -673,7 +673,9 @@ qcname_ext :: { Located RdrName } [mj AnnType $1,mj AnnVal $2] } qcname :: { Located RdrName } -- Variable or type constructor - : qvar { $1 } + : qvar { $1 } -- Things which look like functions + -- Note: This includes record selectors but + -- also (-.->), see #11432 | oqtycon_no_varcon { $1 } -- see Note [Type constructors in export list] ----------------------------------------------------------------------------- @@ -2866,17 +2868,22 @@ oqtycon_no_varcon :: { Located RdrName } -- Type constructor which cannot be mi {- Note [Type constructors in export list] ~~~~~~~~~~~~~~~~~~~~~ -Mixing type constructors and variable constructors in export lists introduces +Mixing type constructors and data constructors in export lists introduces ambiguity in grammar: e.g. (*) may be both a type constructor and a function. -XExplicitNamespaces allows to disambiguate by explicitly prefixing type constructors with 'type' keyword. This ambiguity causes reduce/reduce conflicts in parser, which are always -resolved in favour of variable constructors. To get rid of conflicts we demand +resolved in favour of data constructors. To get rid of conflicts we demand that ambiguous type constructors (those, which are formed by the same productions as variable constructors) are always prefixed with 'type' keyword. Unambiguous type constructors may occur both with or without 'type' keyword. + +Note that in the parser we still parse data constructors as type +constructors. As such, they still end up in the type constructor namespace +until after renaming when we resolve the proper namespace for each exported +child. -} qtyconop :: { Located RdrName } -- Qualified or unqualified From git at git.haskell.org Thu May 5 15:44:56 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 5 May 2016 15:44:56 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Bump time submodule (f4c272e) Message-ID: <20160505154456.F3FF53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/f4c272ef3af9086a132036dcf44ed102f75545a9/ghc >--------------------------------------------------------------- commit f4c272ef3af9086a132036dcf44ed102f75545a9 Author: Ben Gamari Date: Thu May 5 11:44:30 2016 +0200 Bump time submodule This isn't quite a valid release yet but at least it's closer. >--------------------------------------------------------------- f4c272ef3af9086a132036dcf44ed102f75545a9 libraries/time | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/time b/libraries/time index a73564c..393e6e2 160000 --- a/libraries/time +++ b/libraries/time @@ -1 +1 @@ -Subproject commit a73564c366b15f7057b614188662d7b7a8eaab19 +Subproject commit 393e6e247fd472d8833e69cc79679ba9c09311bc From git at git.haskell.org Thu May 5 15:44:59 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 5 May 2016 15:44:59 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Bump Win32 submodule to 2.3.1.1 (c47af0e) Message-ID: <20160505154459.9E2903A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/c47af0e1af089648bd61c8d900f90f1c464cb3e0/ghc >--------------------------------------------------------------- commit c47af0e1af089648bd61c8d900f90f1c464cb3e0 Author: Ben Gamari Date: Thu May 5 14:57:48 2016 +0200 Bump Win32 submodule to 2.3.1.1 >--------------------------------------------------------------- c47af0e1af089648bd61c8d900f90f1c464cb3e0 libraries/Win32 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/Win32 b/libraries/Win32 index fec966e6..bb9469e 160000 --- a/libraries/Win32 +++ b/libraries/Win32 @@ -1 +1 @@ -Subproject commit fec966e6d77a5e7f4a586de6096954137a1fe914 +Subproject commit bb9469ece0b882017fa7f3b51e8db1d2985d6720 From git at git.haskell.org Fri May 6 00:30:50 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 6 May 2016 00:30:50 +0000 (UTC) Subject: [commit: ghc] master: Explain linter optimization for StaticPtr checks. (94f2ee1) Message-ID: <20160506003050.67E143A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/94f2ee1e03d5a4baf29d2893b0efd2bd155b0bc2/ghc >--------------------------------------------------------------- commit 94f2ee1e03d5a4baf29d2893b0efd2bd155b0bc2 Author: Facundo Dom?nguez Date: Thu May 5 21:32:49 2016 -0300 Explain linter optimization for StaticPtr checks. >--------------------------------------------------------------- 94f2ee1e03d5a4baf29d2893b0efd2bd155b0bc2 compiler/coreSyn/CoreLint.hs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/compiler/coreSyn/CoreLint.hs b/compiler/coreSyn/CoreLint.hs index 5ce4cee..b3cec5f 100644 --- a/compiler/coreSyn/CoreLint.hs +++ b/compiler/coreSyn/CoreLint.hs @@ -1641,6 +1641,14 @@ Every occurrence of the data constructor @StaticPtr@ should be moved to the top level by the FloatOut pass. The linter is checking that no occurrence is left nested within an expression. +The check is enabled only if the module uses the StaticPointers language +extension. This optimization arose from the need to compile "GHC.StaticPtr", +which otherwise would be rejected because the following binding + + StaticPtr = \a b1 b2 b3 b4 -> StaticPtr a b1 b2 b3 b4 + +contains an application of `StaticPtr` nested within the lambda abstractions. + Note [Type substitution] ~~~~~~~~~~~~~~~~~~~~~~~~ Why do we need a type substitution? Consider From git at git.haskell.org Fri May 6 07:30:39 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 6 May 2016 07:30:39 +0000 (UTC) Subject: [commit: ghc] master: Use tcExtendGlobalValEnv for default methods (990ce8c) Message-ID: <20160506073039.AB6E03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/990ce8c95bf99e79c728f90aa68bff101867c073/ghc >--------------------------------------------------------------- commit 990ce8c95bf99e79c728f90aa68bff101867c073 Author: Simon Peyton Jones Date: Fri May 6 08:21:33 2016 +0100 Use tcExtendGlobalValEnv for default methods We add the default method Ids to the global type envt in tcAddImplicits; and then again in tcInstDcls2 (for reasons explained there). But for some reason in the latter case we added them to the /local/ type envt, via tcExtendLetEnv. This patch just uses tcExtendGlobalValEnv consistently for both. (I found this when reviewing slightly-awkward code from Facundo's static-form error-message patch; turned out that the awkwardness came back to this inconsistency in the handling of default methods.) >--------------------------------------------------------------- 990ce8c95bf99e79c728f90aa68bff101867c073 compiler/typecheck/TcInstDcls.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/typecheck/TcInstDcls.hs b/compiler/typecheck/TcInstDcls.hs index 483d322..59ddaee 100644 --- a/compiler/typecheck/TcInstDcls.hs +++ b/compiler/typecheck/TcInstDcls.hs @@ -731,8 +731,9 @@ tcInstDecls2 tycl_decls inst_decls -- (b) instance declarations ; let dm_ids = collectHsBindsBinders dm_binds -- Add the default method Ids (again) + -- (they were arready added in TcTyDecls.tcAddImplicits) -- See Note [Default methods and instances] - ; inst_binds_s <- tcExtendLetEnv TopLevel TopLevel dm_ids $ + ; inst_binds_s <- tcExtendGlobalValEnv dm_ids $ mapM tcInstDecl2 inst_decls -- Done @@ -742,7 +743,7 @@ tcInstDecls2 tycl_decls inst_decls See Note [Default methods and instances] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The default method Ids are already in the type environment (see Note -[Default method Ids and Template Haskell] in TcTyClsDcls), BUT they +[Default method Ids and Template Haskell] in TcTyDcls), BUT they don't have their InlinePragmas yet. Usually that would not matter, because the simplifier propagates information from binding site to use. But, unusually, when compiling instance decls we *copy* the From git at git.haskell.org Fri May 6 08:42:29 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 6 May 2016 08:42:29 +0000 (UTC) Subject: [commit: packages/Win32] tag 'v2.3.1.1' created Message-ID: <20160506084229.D5BA03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 New tag : v2.3.1.1 Referencing: 8010bcf7a364164e2668d477b7b4954092ed0cdf From git at git.haskell.org Fri May 6 08:42:31 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 6 May 2016 08:42:31 +0000 (UTC) Subject: [commit: packages/Win32] master: M-x untabify & delete-trailing-whitespace (fec966e) Message-ID: <20160506084231.E1A663A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branch : master Link : http://git.haskell.org/packages/Win32.git/commitdiff/fec966e6d77a5e7f4a586de6096954137a1fe914 >--------------------------------------------------------------- commit fec966e6d77a5e7f4a586de6096954137a1fe914 Author: Herbert Valerio Riedel Date: Fri Dec 18 12:51:34 2015 +0100 M-x untabify & delete-trailing-whitespace >--------------------------------------------------------------- fec966e6d77a5e7f4a586de6096954137a1fe914 Graphics/Win32.hs | 24 ++++---- Graphics/Win32/Dialogue.hsc | 62 ++++++++++---------- Graphics/Win32/GDI.hs | 24 ++++---- Graphics/Win32/GDI/Bitmap.hsc | 124 +++++++++++++++++++-------------------- Graphics/Win32/GDI/Font.hsc | 50 ++++++++-------- Graphics/Win32/GDI/Graphics2D.hs | 2 +- Graphics/Win32/GDI/HDC.hs | 4 +- Graphics/Win32/GDI/Path.hs | 6 +- Graphics/Win32/GDI/Types.hsc | 70 +++++++++++----------- System/Win32.hs | 28 ++++----- System/Win32/Console.hsc | 24 ++++---- System/Win32/File.hsc | 14 ++--- System/Win32/Info.hsc | 12 ++-- System/Win32/Mem.hsc | 6 +- System/Win32/NLS.hsc | 12 ++-- System/Win32/Registry.hsc | 72 +++++++++++------------ System/Win32/Types.hs | 6 +- tests/helloworld.hs | 44 +++++++------- 18 files changed, 292 insertions(+), 292 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc fec966e6d77a5e7f4a586de6096954137a1fe914 From git at git.haskell.org Fri May 6 08:42:33 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 6 May 2016 08:42:33 +0000 (UTC) Subject: [commit: packages/Win32] master: Initial Appveyor test file (5a82561) Message-ID: <20160506084233.E807B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branch : master Link : http://git.haskell.org/packages/Win32.git/commitdiff/5a8256122509ef10ae5f877442b64ac1282db2d1 >--------------------------------------------------------------- commit 5a8256122509ef10ae5f877442b64ac1282db2d1 Author: Neil Mitchell Date: Wed Dec 23 10:26:46 2015 +0000 Initial Appveyor test file >--------------------------------------------------------------- 5a8256122509ef10ae5f877442b64ac1282db2d1 appveyor.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..a76c9fa --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,18 @@ +cache: +- "c:\\sr" # stack root, short paths == less problems + +build: off + +before_test: +- curl -ostack.zip -L --insecure http://www.stackage.org/stack/windows-i386 +- 7z x stack.zip stack.exe + +clone_folder: "c:\\project" +environment: + global: + STACK_ROOT: "c:\\sr" + +test_script: +- stack init +- stack setup > nul +- echo "" | stack --no-terminal build From git at git.haskell.org Fri May 6 08:42:35 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 6 May 2016 08:42:35 +0000 (UTC) Subject: [commit: packages/Win32] master: Merge pull request #41 from ndmitchell/master (14550e8) Message-ID: <20160506084235.EE9CF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branch : master Link : http://git.haskell.org/packages/Win32.git/commitdiff/14550e8f7bde475b4209b89117e937b92cee08bb >--------------------------------------------------------------- commit 14550e8f7bde475b4209b89117e937b92cee08bb Merge: fec966e 5a82561 Author: Herbert Valerio Riedel Date: Wed Dec 23 11:35:05 2015 +0100 Merge pull request #41 from ndmitchell/master Add Appveyor support >--------------------------------------------------------------- 14550e8f7bde475b4209b89117e937b92cee08bb appveyor.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) From git at git.haskell.org Fri May 6 08:42:37 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 6 May 2016 08:42:37 +0000 (UTC) Subject: [commit: packages/Win32] master: Win32: Bump version of Win32 for usage in GHC 8.0.1 (563397c) Message-ID: <20160506084238.002E13A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branch : master Link : http://git.haskell.org/packages/Win32.git/commitdiff/563397c3f76117d14eafa4196354b3a660f0548b >--------------------------------------------------------------- commit 563397c3f76117d14eafa4196354b3a660f0548b Author: Tamar Christina Date: Thu May 5 13:06:22 2016 +0200 Win32: Bump version of Win32 for usage in GHC 8.0.1 >--------------------------------------------------------------- 563397c3f76117d14eafa4196354b3a660f0548b Win32.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Win32.cabal b/Win32.cabal index 72a5618..21f1666 100644 --- a/Win32.cabal +++ b/Win32.cabal @@ -1,5 +1,5 @@ name: Win32 -version: 2.3.1.0 +version: 2.3.1.1 license: BSD3 license-file: LICENSE author: Alastair Reid From git at git.haskell.org Fri May 6 08:42:40 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 6 May 2016 08:42:40 +0000 (UTC) Subject: [commit: packages/Win32] master: Merge pull request #45 from Mistuke/win32-prepare-for-ghc8-release (bb9469e) Message-ID: <20160506084240.05DA73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/Win32 On branch : master Link : http://git.haskell.org/packages/Win32.git/commitdiff/bb9469ece0b882017fa7f3b51e8db1d2985d6720 >--------------------------------------------------------------- commit bb9469ece0b882017fa7f3b51e8db1d2985d6720 Merge: 14550e8 563397c Author: Tamar Christina Date: Thu May 5 13:15:02 2016 +0200 Merge pull request #45 from Mistuke/win32-prepare-for-ghc8-release Win32: Bump version of Win32 for usage in GHC 8.0.1 >--------------------------------------------------------------- bb9469ece0b882017fa7f3b51e8db1d2985d6720 Win32.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) From git at git.haskell.org Fri May 6 08:44:09 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 6 May 2016 08:44:09 +0000 (UTC) Subject: [commit: ghc] master: Update Win32 submodule to v2.3.1.1 release tag (ecc1d58) Message-ID: <20160506084409.A89A03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ecc1d586e1b6a0ab40c41eea8881dac3e12098fb/ghc >--------------------------------------------------------------- commit ecc1d586e1b6a0ab40c41eea8881dac3e12098fb Author: Herbert Valerio Riedel Date: Fri May 6 10:45:36 2016 +0200 Update Win32 submodule to v2.3.1.1 release tag >--------------------------------------------------------------- ecc1d586e1b6a0ab40c41eea8881dac3e12098fb libraries/Win32 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/Win32 b/libraries/Win32 index fec966e6..bb9469e 160000 --- a/libraries/Win32 +++ b/libraries/Win32 @@ -1 +1 @@ -Subproject commit fec966e6d77a5e7f4a586de6096954137a1fe914 +Subproject commit bb9469ece0b882017fa7f3b51e8db1d2985d6720 From git at git.haskell.org Fri May 6 16:18:27 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 6 May 2016 16:18:27 +0000 (UTC) Subject: [commit: ghc] master: Fix pretty printing of IEThingWith (018487e) Message-ID: <20160506161827.357313A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/018487e686793e22efd595491be5b5305ed2b9c0/ghc >--------------------------------------------------------------- commit 018487e686793e22efd595491be5b5305ed2b9c0 Author: Matthew Pickering Date: Fri May 6 17:15:54 2016 +0100 Fix pretty printing of IEThingWith [skip ci] >--------------------------------------------------------------- 018487e686793e22efd595491be5b5305ed2b9c0 compiler/hsSyn/HsImpExp.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/hsSyn/HsImpExp.hs b/compiler/hsSyn/HsImpExp.hs index 493a92b..4c72b35 100644 --- a/compiler/hsSyn/HsImpExp.hs +++ b/compiler/hsSyn/HsImpExp.hs @@ -228,8 +228,8 @@ instance (HasOccName name, OutputableBndr name) => Outputable (IE name) where ppr (IEThingAll thing) = hcat [pprImpExp (unLoc thing), text "(..)"] ppr (IEThingWith thing wc withs flds) = pprImpExp (unLoc thing) <> parens (fsep (punctuate comma - ppWiths ++ - map (ppr . flLabel . unLoc) flds)) + (ppWiths ++ + map (ppr . flLabel . unLoc) flds))) where ppWiths = case wc of From git at git.haskell.org Fri May 6 16:18:29 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 6 May 2016 16:18:29 +0000 (UTC) Subject: [commit: ghc] master: Remove trailing whitespace from 'testsuite/tests/module/all.T' (fe190ae) Message-ID: <20160506161829.E74623A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fe190ae82aa3d9c2c86005959f7ce82f1e2ccb6d/ghc >--------------------------------------------------------------- commit fe190ae82aa3d9c2c86005959f7ce82f1e2ccb6d Author: Matthew Pickering Date: Fri May 6 17:16:55 2016 +0100 Remove trailing whitespace from 'testsuite/tests/module/all.T' [skip ci] >--------------------------------------------------------------- fe190ae82aa3d9c2c86005959f7ce82f1e2ccb6d testsuite/tests/module/all.T | 0 1 file changed, 0 insertions(+), 0 deletions(-) From git at git.haskell.org Sat May 7 06:39:10 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:39:10 +0000 (UTC) Subject: [commit: packages/time] branch 'ghc-7.8' created Message-ID: <20160507063910.3A6963A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time New branch : ghc-7.8 Referencing: adafac26307cffab0be20c126385ab161c259237 From git at git.haskell.org Sat May 7 06:39:12 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:39:12 +0000 (UTC) Subject: [commit: packages/time] branch 'wip/travis' created Message-ID: <20160507063912.3A9C53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time New branch : wip/travis Referencing: b837d6c1a7ba651fe67043a27d2bd0ffea2235fa From git at git.haskell.org Sat May 7 06:39:14 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:39:14 +0000 (UTC) Subject: [commit: packages/time] branch 'ghc-head' deleted Message-ID: <20160507063914.3B0E63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time Deleted branch: ghc-head From git at git.haskell.org Sat May 7 06:39:16 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:39:16 +0000 (UTC) Subject: [commit: packages/time] branch 'ezyang-scrap' deleted Message-ID: <20160507063916.3C2063A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time Deleted branch: ezyang-scrap From git at git.haskell.org Sat May 7 06:39:18 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:39:18 +0000 (UTC) Subject: [commit: packages/time] tag 'time-1.5.0.1-release' created Message-ID: <20160507063918.3DACA3A300@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 Sat May 7 06:39:20 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:39:20 +0000 (UTC) Subject: [commit: packages/time] tag 'time-1.6.0.1-release' created Message-ID: <20160507063920.3DF8A3A300@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 Sat May 7 06:39:22 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:39:22 +0000 (UTC) Subject: [commit: packages/time] tag 'time-1.6-release' created Message-ID: <20160507063922.3EB3D3A300@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 Sat May 7 06:39:24 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:39:24 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: initial revision, including draft of Clock and outlines of TAI and Calendar (239f07b) Message-ID: <20160507063924.4B7593A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:39:26 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:39:26 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: make diff times instances of Num (7339f64) Message-ID: <20160507063926.516D23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:39:28 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:39:28 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: export addUTCTime and diffUTCTime (3dfb0c3) Message-ID: <20160507063928.57BC03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:39:30 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:39:30 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: get TAI to compile (cf576d3) Message-ID: <20160507063930.5E39C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:39:32 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:39:32 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: clean up Makefile (cc4d5c2) Message-ID: <20160507063932.647123A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:39:34 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:39:34 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: get Calendar to compile, make TestTime a proper test, create CurrentTime to show the current time (d00d4f9) Message-ID: <20160507063934.6BF9C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:39:36 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:39:36 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: more haddock comments, timezone conversion functions (3ad0923) Message-ID: <20160507063936.72B3A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:39:38 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:39:38 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: add dayToCalendar function, with test (266f005) Message-ID: <20160507063938.7914B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:39:40 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:39:40 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: more calendar functions, plus test for UTC - Calendar conversion (70e1b39) Message-ID: <20160507063940.804C43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:39:42 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:39:42 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: UT1 calendar functions, with test (49c8b0d) Message-ID: <20160507063942.861313A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:39:44 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:39:44 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: clean up Makefile (b1c2cb6) Message-ID: <20160507063944.8D64F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:39:46 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:39:46 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: remove -fglasgow-exts, add -Wall -Werror to all library modules (8ae7ab8) Message-ID: <20160507063946.93C0C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:39:48 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:39:48 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: new Data.Fixed module with test, move System.Time.* to Fixed arithmetic (fd8f5d0) Message-ID: <20160507063948.9BD7D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:39:50 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:39:50 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: use realToFrac (dfadfd1) Message-ID: <20160507063950.A1CDB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:39:52 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:39:52 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: getCurrentTimezone, with test (cb6d14e) Message-ID: <20160507063952.A81E43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:39:54 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:39:54 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: fix Enums to conform with Haskell 98 (and GHC 6.4) (59ab29a) Message-ID: <20160507063954.AF7D93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:39:56 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:39:56 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: use correct time C header (0d51531) Message-ID: <20160507063956.B4F9D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:39:58 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:39:58 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Makefile to clean properly (0a170a3) Message-ID: <20160507063958.BB2943A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:40:00 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:40:00 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: convert to Cabal (a352b22) Message-ID: <20160507064000.C1B9E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:40:02 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:40:02 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: time-zone test (3317848) Message-ID: <20160507064002.C808F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:40:04 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:40:04 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: correct time-zone handling (066e6ee) Message-ID: <20160507064004.CEA963A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:40:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:40:06 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: fix posixToCTime for compile on 6.4 (81468e1) Message-ID: <20160507064006.D4B623A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:40:08 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:40:08 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: expose getTimeZone (51caf03) Message-ID: <20160507064008.DB3083A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:40:10 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:40:10 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: rename id to Timezone (126e42f) Message-ID: <20160507064010.E14793A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:40:12 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:40:12 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: midnight and midday (5564e25) Message-ID: <20160507064012.E73E03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:40:14 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:40:14 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Eq and Ord instances for UTCTime (2ba76c8) Message-ID: <20160507064014.ED9923A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:40:16 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:40:16 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: add ShowDST test program (445ae81) Message-ID: <20160507064017.004283A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:40:19 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:40:19 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: generalise calendar type, split Calendar module (78c7468) Message-ID: <20160507064019.08AED3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:40:21 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:40:21 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: first attempt at formatting (with failing test) (2678bff) Message-ID: <20160507064021.122583A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:40:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:40:23 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: add DST field to Timezone (471f5ea) Message-ID: <20160507064023.187BC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:40:25 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:40:25 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: add GNU and other extensions to formatting (ce92c0a) Message-ID: <20160507064025.1F4FE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:40:27 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:40:27 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: generalise types with classes, introduce zoned time (1c076bc) Message-ID: <20160507064027.26C413A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:40:29 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:40:29 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: fix for Makefile (86fca98) Message-ID: <20160507064029.2D5A03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:40:31 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:40:31 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: add %s format option to ZonedTime (18b9d5a) Message-ID: <20160507064031.33E613A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:40:33 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:40:33 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: add name to Timezone (d028ced) Message-ID: <20160507064033.39EC33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:40:35 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:40:35 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: build/test target fiddling in Makefile (1c01493) Message-ID: <20160507064035.406313A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:40:37 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:40:37 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: better type for formatCharacter (a55e303) Message-ID: <20160507064037.481743A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:40:39 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:40:39 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: separate tests into dir, new ISOWeek and YearDay modules, pull Format code into module, new ConvertBack test (ffc5046) Message-ID: <20160507064039.50FED3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:40:41 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:40:41 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Clock documentation (622d6b5) Message-ID: <20160507064041.585593A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:40:43 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:40:43 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: TAI documentation (0782592) Message-ID: <20160507064043.5E4C13A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:40:45 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:40:45 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: test in Makefile (e12e45e) Message-ID: <20160507064045.653003A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:40:47 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:40:47 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: fix decodeDay in ISOWeek, with improved ConvertBack test (899a104) Message-ID: <20160507064047.6CB6C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:40:49 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:40:49 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: remove maybeDecodeDay (7ece834) Message-ID: <20160507064049.74AF23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:40:53 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:40:53 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: organise week functions (73c160c) Message-ID: <20160507064053.80F823A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:40:51 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:40:51 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: fix week-based formatting chars, with more testing (f61178d) Message-ID: <20160507064051.7AD793A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:40:55 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:40:55 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: clean up some type names, more doc (23be1cb) Message-ID: <20160507064055.893DB3A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:41:01 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:41:01 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: better C type for name param (7a52230) Message-ID: <20160507064101.9BEA33A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:40:57 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:40:57 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: CalendarTime synonym with convenience functions (f853253) Message-ID: <20160507064057.8F84B3A302@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:41:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:41:03 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: XCode 2.0 project (1ecbd6c) Message-ID: <20160507064103.A34843A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:40:59 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:40:59 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: better tz for test (865557b) Message-ID: <20160507064059.95FE63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:41:05 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:41:05 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: clean up XCode project & makefile (0bb6871) Message-ID: <20160507064105.AAC763A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:41:07 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:41:07 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: hide submodules in Haddock docs (e128961) Message-ID: <20160507064107.B09BF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:41:09 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:41:09 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: use "time" for package name (f323ece) Message-ID: <20160507064109.B6CB13A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:41:13 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:41:13 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: split up System.Time.Clock (462818f) Message-ID: <20160507064113.C66403A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:41:15 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:41:15 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: migrate to XCode 2.1 (64d9973) Message-ID: <20160507064115.CE90E3A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:41:11 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:41:11 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: put doc index in project (c2214f5) Message-ID: <20160507064111.BCF4B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:41:17 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:41:17 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: use BSD license (02e4b6b) Message-ID: <20160507064117.D54253A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:41:21 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:41:21 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: add missing Current file (bcb1ac3) Message-ID: <20160507064121.E31203A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:41:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:41:23 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: fix exposed/hidden module lists in cabal file (53e4437) Message-ID: <20160507064123.E8AD13A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:41:19 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:41:19 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: fix cabal file private mods (1a29bf0) Message-ID: <20160507064119.DB5843A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:41:25 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:41:25 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: difftime doc seconds (cdfb558) Message-ID: <20160507064125.EFA3F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:41:28 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:41:28 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: rename ISOWeek to ISOWeekDay (3ccb9bf) Message-ID: <20160507064128.043C63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:41:30 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:41:30 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Separate out DayEncoding into Days.hs (0fdf95f) Message-ID: <20160507064130.0CE9E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:41:32 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:41:32 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Major simplification of calendar types (3cec8f8) Message-ID: <20160507064132.157683A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:41:36 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:41:36 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: correct showing of years before 1000 CE, with test (869ebcc) Message-ID: <20160507064136.2BAB03A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:41:38 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:41:38 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: clip incorrect values in converters, with tests (b107508) Message-ID: <20160507064138.358BD3A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:41:34 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:41:34 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: move from System to Data (64ab015) Message-ID: <20160507064134.2101F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:41:40 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:41:40 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: new gregorianMonthLength function (cfab0ea) Message-ID: <20160507064140.3B5B93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:41:42 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:41:42 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: conversion documentation (c2ff391) Message-ID: <20160507064142.4135B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:41:44 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:41:44 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: more time doc (8cea925) Message-ID: <20160507064144.474AB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:41:46 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:41:46 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: rename names in Data.Time.Calendar.Calendar (f35dd9e) Message-ID: <20160507064146.4F19D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:41:48 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:41:48 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: reorg modules with new LocalTime hier (ce92c8a) Message-ID: <20160507064148.59C643A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:41:50 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:41:50 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Timezone -> TimeZone (3db5c8e) Message-ID: <20160507064150.62DC53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:41:50 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:41:50 +0000 (UTC) Subject: [commit: ghc] master: Update time submodule to 1.6.0.1 release tag (633b099) Message-ID: <20160507064150.99FDF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/633b099cb683b3d2e9bb2776ecaa7a83e5736de7/ghc >--------------------------------------------------------------- commit 633b099cb683b3d2e9bb2776ecaa7a83e5736de7 Author: Herbert Valerio Riedel Date: Sat May 7 08:41:54 2016 +0200 Update time submodule to 1.6.0.1 release tag >--------------------------------------------------------------- 633b099cb683b3d2e9bb2776ecaa7a83e5736de7 libraries/time | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/time b/libraries/time index a73564c..52e0f5e 160000 --- a/libraries/time +++ b/libraries/time @@ -1 +1 @@ -Subproject commit a73564c366b15f7057b614188662d7b7a8eaab19 +Subproject commit 52e0f5e85ffbaab77b155d48720fb216021c8a73 From git at git.haskell.org Sat May 7 06:41:52 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:41:52 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: fix TimeLib.cabal (aba753e) Message-ID: <20160507064152.69C813A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:41:54 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:41:54 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: tiny doc fix (e2b7e0f) Message-ID: <20160507064154.702D73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:41:56 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:41:56 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: rename to-converter functions (f783b6b) Message-ID: <20160507064156.77DC93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:41:58 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:41:58 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: rename Date to Day (9c5fedd) Message-ID: <20160507064158.7F6F83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:42:00 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:42:00 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: reorder modules in Makefile (bbbc983) Message-ID: <20160507064200.8586B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:42:02 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:42:02 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: add months (with test) (853190e) Message-ID: <20160507064202.8FB1E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:42:04 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:42:04 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: clean up deps (957955c) Message-ID: <20160507064204.9686B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:42:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:42:06 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: rename ISOWeekDay to ISO8601Week (8723c5f) Message-ID: <20160507064206.A03F63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:42:08 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:42:08 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: utcToLocalZonedTime (5f330c5) Message-ID: <20160507064208.A6BB83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:42:10 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:42:10 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: rename UTCDiffTime to NominalDiffTime (6a21693) Message-ID: <20160507064210.AD16A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:42:12 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:42:12 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: use cases (as test) (68e172c) Message-ID: <20160507064212.B46EC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:42:14 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:42:14 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: add missing file (70544be) Message-ID: <20160507064214.BA4573A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:42:16 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:42:16 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: add missing file (e3f3a03) Message-ID: <20160507064216.C0DE13A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:42:18 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:42:18 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: get taiToUTCTime working (with test) (db06886) Message-ID: <20160507064218.CB32B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:42:20 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:42:20 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: comments (cae9a55) Message-ID: <20160507064220.D12443A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:42:22 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:42:22 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: set cabal to 0.2 (e1f3f24) Message-ID: <20160507064222.D7F653A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:42:24 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:42:24 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: instance Show UTCTime (c03ad77) Message-ID: <20160507064224.DE7F33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:42:26 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:42:26 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: more sensible identifer names (acc1fc8) Message-ID: <20160507064226.E57063A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:42:28 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:42:28 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: version 0.2.1 (68b10d9) Message-ID: <20160507064228.EBED03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:42:33 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:42:33 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: new MonthDay module (f4e177d) Message-ID: <20160507064233.093613A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:42:35 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:42:35 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Julian and Easter calendars (869b07f) Message-ID: <20160507064235.14D2C3A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:42:37 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:42:37 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: move ISO8601Week to separate module space (b802476) Message-ID: <20160507064237.1B7D13A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:42:39 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:42:39 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: fix identifier in UseCases.lhs (0e3dd85) Message-ID: <20160507064239.226C43A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:42:30 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:42:30 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: ZonedTime id names (e0937c8) Message-ID: <20160507064230.F2C383A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:42:41 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:42:41 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: move out MonthDay and YearDay (6f8d525) Message-ID: <20160507064241.29EDE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:42:43 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:42:43 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: fix tests; rename ISO 8601 modules (be389b5) Message-ID: <20160507064243.33BBD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:42:45 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:42:45 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: more sensible WeekDate and OrdinalDate names (4752044) Message-ID: <20160507064245.3B0EA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:42:47 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:42:47 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: version 0.3 (90f8854) Message-ID: <20160507064247.416CD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:42:49 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:42:49 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: haddock comments for formatTime and others (8573895) Message-ID: <20160507064249.487B53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:42:51 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:42:51 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: move Data.Time.TAI to Data.Time.Clock.TAI (f99b7a1) Message-ID: <20160507064251.509C63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:42:53 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:42:53 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: sort out POSIX module mess (4bfc389) Message-ID: <20160507064253.59DDE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:42:55 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:42:55 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Big Split into separate fixed and time packages (f82aac1) Message-ID: <20160507064255.66F6D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:42:57 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:42:57 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: add missing file; README file; root Makefile clean fix (76b8ca2) Message-ID: <20160507064257.6FBEB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:42:59 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:42:59 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: export isLeapYear in Calendar; new version (eb6d142) Message-ID: <20160507064259.76B0D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:43:01 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:43:01 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: remove everything not part of time package (df1c341) Message-ID: <20160507064301.7EEF43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:43:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:43:03 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: move time files to proper place (e29bc42) Message-ID: <20160507064303.8590D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:43:05 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:43:05 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: make suitable for build process (7d86eaa) Message-ID: <20160507064305.8C7423A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:43:07 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:43:07 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: haddock working with time package (021cdd7) Message-ID: <20160507064307.92AEA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:43:09 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:43:09 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: set up boringfile (706483e) Message-ID: <20160507064309.997EA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:43:11 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:43:11 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: XCode build and temp files are boring (e5ea873) Message-ID: <20160507064311.A02753A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:43:13 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:43:13 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Various fixes to make this build & work on Windows (4b425ec) Message-ID: <20160507064313.A94723A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:43:15 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:43:15 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: fix build breakage on Linux (a499f3f) Message-ID: <20160507064315.AFB253A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:43:17 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:43:17 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: CFILES directive for the benefit of Hugs (76bf7f8) Message-ID: <20160507064317.B5E283A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:43:21 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:43:21 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: extra Cabal fields for clean and sdist (37fd2cd) Message-ID: <20160507064321.C1FAC3A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:43:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:43:23 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: fix typo (3721982) Message-ID: <20160507064323.C8C0D3A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:43:19 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:43:19 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: remove dependency on ghcconfig.h (f67b546) Message-ID: <20160507064319.BC3E93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:43:25 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:43:25 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: re-add #include "ghcconfig.h", conditional on __GLASGOW_HASKELL__ (17faab4) Message-ID: <20160507064325.CEA4A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:43:27 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:43:27 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: remove debugging code (580b6d2) Message-ID: <20160507064327.D58B63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:43:29 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:43:29 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: use non-GHC-specific #ifdef test for Windows (d65e1de) Message-ID: <20160507064329.DC0383A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:43:31 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:43:31 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: no need to include ghcconfig.h any more (cecf1ab) Message-ID: <20160507064331.E29D33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:43:33 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:43:33 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: eliminate the other mingw32_HOST_OS test (0108ad0) Message-ID: <20160507064333.E91B93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:43:35 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:43:35 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Set version to 1.0 stable (0908d41) Message-ID: <20160507064335.F06663A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:43:38 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:43:38 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: add aclocal.m4 to extra sources (4def2c0) Message-ID: <20160507064338.029BE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:43:40 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:43:40 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: includes -> install-includes (ca25b1b) Message-ID: <20160507064340.093C23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:43:42 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:43:42 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: fix C-Sources (#893) (3b0c7d3) Message-ID: <20160507064342.0FDB33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:43:44 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:43:44 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: note CPP extension (0323c8c) Message-ID: <20160507064344.1624E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:43:46 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:43:46 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: fix up XCode project file for added files (b50f0c7) Message-ID: <20160507064346.1D47D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:43:48 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:43:48 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: add Setup.hs (de08f7e) Message-ID: <20160507064348.23A4D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:43:50 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:43:50 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Changed docs for %U and %W to include the possibility of week 0 results. (85fd256) Message-ID: <20160507064350.29D593A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:43:54 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:43:54 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Added missing example for showWeekDate. (147381b) Message-ID: <20160507064354.36C853A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:43:56 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:43:56 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Handle 'c' also in formatTime for ZonedTime, to get %Z filled in for ZonedTime and UTCTime. (573daed) Message-ID: <20160507064356.3DF633A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:43:52 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:43:52 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Fixed typo: s/propleptic/proleptic/. (927eb34) Message-ID: <20160507064352.307303A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:43:58 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:43:58 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Add secondsToDiffTime and picosecondsToDiffTime. (96ec994) Message-ID: <20160507064358.448553A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:44:00 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:44:00 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Added fromMondayStartWeek and fromSundayStartWeek to Data.Time.Calendar.OrdinalDate. (04282fe) Message-ID: <20160507064400.4B88A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:44:02 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:44:02 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Some haddock formatting for fromMondayStartWeek and fromSundayStartWeek. (c2bc34a) Message-ID: <20160507064402.51FEC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:44:04 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:44:04 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Added Data.Time.LocalTime.Parse, UNIX-style time parsing. (06ad028) Message-ID: <20160507064404.5A6263A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:44:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:44:06 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Updated SRC and dependencies in time/Makefile to include Data.Time.LocalTime.Parse. (d6ff855) Message-ID: <20160507064406.618A73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:44:08 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:44:08 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Changed UTC to +0000 in default time zone in ParseTime, to avoid spurios time zone names. (16a9225) Message-ID: <20160507064408.68AAB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:44:10 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:44:10 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Added quickcheck properties for time parsing. (ad26aa5) Message-ID: <20160507064410.7228C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:44:12 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:44:12 +0000 (UTC) Subject: [commit: packages/time] master, 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: <20160507064412.77BB13A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:44:14 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:44:14 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Changed test case Makefile to work with GHC 6.6 (there is no -package fixed). (eba81c2) Message-ID: <20160507064414.7EDF83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:44:16 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:44:16 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Compile test programs using ../../dist/build/libHStime-1.0.a as produced by the Cabal build step. (43d95b2) Message-ID: <20160507064416.84AEE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:44:18 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:44:18 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Fixed taiEpoch Haddock comment to include the epoch time. (1632436) Message-ID: <20160507064418.8ABB53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:44:20 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:44:20 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: move test dir up, remove old junk (9b6744e) Message-ID: <20160507064420.937583A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:44:22 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:44:22 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: HsTime.h should be installed (acf02ec) Message-ID: <20160507064422.99BD43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:44:24 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:44:24 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: clean up .xcodeproj to use cabal (5892926) Message-ID: <20160507064424.A2F263A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:44:26 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:44:26 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: improve error reporting in XCode (a4b8812) Message-ID: <20160507064426.A9C1C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:44:28 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:44:28 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: XCode tweak (ef08a05) Message-ID: <20160507064428.B00233A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:44:30 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:44:30 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: xcodeproj cleanup (49451d6) Message-ID: <20160507064430.B6C9C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:44:32 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:44:32 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: attempt to get cabal test working (843ed89) Message-ID: <20160507064432.BD5FD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:44:34 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:44:34 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: get "runhaskell Setup.hs test" to work (ab61764) Message-ID: <20160507064434.C39403A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:44:38 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:44:38 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: QuickCheck properties for the new %S, %q and %Q. (fcf3460) Message-ID: <20160507064438.D14523A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:44:36 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:44:36 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Changed %S to return whole seconds, and added %Q and %q. (f73da90) Message-ID: <20160507064436.CA9FD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:44:42 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:44:42 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Changed %Z to produce the time zone offset if the time zone name is "". (4d14562) Message-ID: <20160507064442.DE3C33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:44:44 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:44:44 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Cleaned up date parsing QuickCheck properties. (3750abf) Message-ID: <20160507064444.E4EC43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:44:40 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:44:40 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Added %f: The century part of the week date year. (5ac1884) Message-ID: <20160507064440.D815C3A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:44:46 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:44:46 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: move parsing and formatting into new module (48535e6) Message-ID: <20160507064446.EEBAD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:44:49 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:44:49 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: README about building from darcs (09c85ef) Message-ID: <20160507064449.022B13A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:44:53 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:44:53 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: clean up HsTime (696f384) Message-ID: <20160507064453.0DEE43A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:44:55 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:44:55 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: build/license/boring cleanup (cc9a460) Message-ID: <20160507064455.141653A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:44:51 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:44:51 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: version 1.1 (28d5ef3) Message-ID: <20160507064451.07E003A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:44:57 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:44:57 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Fixed hyperlinks to formatTime (7053937) Message-ID: <20160507064457.1AD783A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:44:59 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:44:59 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Added missing directory (a293612) Message-ID: <20160507064459.20E043A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:45:01 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:45:01 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Make Setup.hs suitable for building in a GHC tree (2f507d7) Message-ID: <20160507064501.270BB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:45:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:45:03 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Fix -Wall warnings (ae16651) Message-ID: <20160507064503.2D0E83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:45:05 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:45:05 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Hack due to time needing Win32 on Windows (dbd2265) Message-ID: <20160507064505.33CED3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:45:09 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:45:09 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: We now need to check the exitcode of the tests (ccb1264) Message-ID: <20160507064509.407823A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:45:11 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:45:11 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Bump version to 1.1.1 (9eb62d6) Message-ID: <20160507064511.46F5B3A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:45:07 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:45:07 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Follow Cabal changes in Setup.*hs (fae8a55) Message-ID: <20160507064507.398FD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:45:13 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:45:13 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Remove Makefile and package.conf.in (used in the old GHC build system) (ef82b6f) Message-ID: <20160507064513.4D71F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:45:15 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:45:15 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Follow base split (now dep on old-locale) (c0d8daf) Message-ID: <20160507064515.53F383A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:45:17 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:45:17 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: --configure-option and --ghc-option are now provided by Cabal (a9edca5) Message-ID: <20160507064517.5A1A93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:45:19 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:45:19 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: #undef PACKAGE_NAME and friends to avoid clashes (2f36990) Message-ID: <20160507064519.608A83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:45:21 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:45:21 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Provide a configure flag to set which C compiler is used (96f1b36) Message-ID: <20160507064521.66A743A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:45:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:45:23 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: FIX #1486: timezone offset has the wrong sign on Windows (8e487ba) Message-ID: <20160507064523.6E1E73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:45:25 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:45:25 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Use configurations rather than Setup.hs hacks (5b0af2b) Message-ID: <20160507064525.742B03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:45:27 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:45:27 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Track .cabal syntax changes once again (8b0d7b8) Message-ID: <20160507064527.7ACF03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:45:29 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:45:29 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Fixed Cabal-induced breakage, once again... (635d902) Message-ID: <20160507064529.8160F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:45:31 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:45:31 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Allow a colon between the hours and minutes when parsing with %z and %Z. (e6e4837) Message-ID: <20160507064531.8874D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:45:33 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:45:33 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Document the format used for output with %z. (894b1f8) Message-ID: <20160507064533.8EC7C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:45:41 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:45:41 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: document how to get a POSIXTime from an EpochTime or CTime. (2869c91) Message-ID: <20160507064541.A84A63A303@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:45:35 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:45:35 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Haddock for parseTime and friends. (0f2e21b) Message-ID: <20160507064535.957603A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:45:37 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:45:37 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Use configurations to allow building with ghc-6.6, 6.8 (eff99ca) Message-ID: <20160507064537.9B5193A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:45:43 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:45:43 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Figure out timezone offset from timezone name (3c404c3) Message-ID: <20160507064543.AFD823A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:45:39 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:45:39 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Bump version number (39c0eef) Message-ID: <20160507064539.A199A3A302@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:45:45 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:45:45 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Bump version to 1.1.2.1 (71f2aa9) Message-ID: <20160507064545.B659F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:45:47 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:45:47 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Remove -Wall and -Werror, they don't belong here (c46f680) Message-ID: <20160507064547.BEAD03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:45:49 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:45:49 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Change "accuracy" to "precision". (cc3dae0) Message-ID: <20160507064549.C4A1C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:45:51 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:45:51 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: don't warn about orphan instances; they're real warnings now (i.e. errors with -Werror) (b010dd2) Message-ID: <20160507064551.CB7C83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:45:53 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:45:53 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: remove -ffi options (in favour of -XForeignFunctionInterface) (e581e9c) Message-ID: <20160507064553.D216F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:45:55 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:45:55 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Add x-follows-version-policy tag (230f9ee) Message-ID: <20160507064555.D765E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:45:57 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:45:57 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Bump version number to 1.1.2.2 (3f174bc) Message-ID: <20160507064557.DD76A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:45:59 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:45:59 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Improve meta-data (989fc61) Message-ID: <20160507064559.E42B03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:46:01 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:46:01 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Ix instance for Day. This is useful for e.g. storing daily tabulated data in arrays. (b94d3b7) Message-ID: <20160507064601.EA21A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:46:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:46:03 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: fix warnings; fix tests; remove GHC cruft; bump to 1.1.2.3 (578a832) Message-ID: <20160507064603.F18483A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:46:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:46:06 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: fix Julian haddock docs (6a4e1ea) Message-ID: <20160507064606.042C73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:46:08 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:46:08 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: add Makefile for development building; remove OPTIONS -Wall -Werror in each file (a8f5da7) Message-ID: <20160507064608.0E7A83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:46:10 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:46:10 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: prop_name helper for defining named properties. (c8bba9b) Message-ID: <20160507064610.161603A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:46:12 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:46:12 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Properties for testing case-insensitivity. (bd8607f) Message-ID: <20160507064612.1C43F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:46:14 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:46:14 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Case-insensitive parsing. (781548a) Message-ID: <20160507064614.232E03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:46:16 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:46:16 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: clean up .cabal; first attempt at Windows compilability (1e426ff) Message-ID: <20160507064616.29CCA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:46:18 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:46:18 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: get building on Windows (89e52b0) Message-ID: <20160507064618.3082F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:46:20 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:46:20 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: next version will be 1.1.3 (1b7d9c2) Message-ID: <20160507064620.371BE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:46:22 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:46:22 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Typeable instances for all types (1b0f97e) Message-ID: <20160507064622.3E5533A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:46:24 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:46:24 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: cap in .cabal (6d9856b) Message-ID: <20160507064624.456F33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:46:26 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:46:26 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: add validating converters (0cf7847) Message-ID: <20160507064626.4C39C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:46:28 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:46:28 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: use base==4.* (1a31e47) Message-ID: <20160507064628.52BFA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:46:30 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:46:30 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: add validating constructors (9884b31) Message-ID: <20160507064630.58D613A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:46:32 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:46:32 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: version 1.1.4 (2c8d2f1) Message-ID: <20160507064632.5EE983A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:46:34 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:46:34 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: formatTime: glibc-style modifier flags (2dc3703) Message-ID: <20160507064634.673C13A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:46:36 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:46:36 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: update cabal-version constraint (2084584) Message-ID: <20160507064636.6EAFB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:46:38 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:46:38 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: copyright date (f071372) Message-ID: <20160507064638.74D393A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:46:40 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:46:40 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: sort out GHC 6.12 warnings (66ee658) Message-ID: <20160507064640.7B4683A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:46:42 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:46:42 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: version 1.2; add Data instance, conditional on support (1bf713f) Message-ID: <20160507064642.82D553A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:46:48 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:46:48 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: 1.2.0.1, include missing HsConfigure in sdist (bfa764f) Message-ID: <20160507064648.9A23F3A302@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:46:44 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:46:44 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: fix tests (cec60a0) Message-ID: <20160507064644.8980B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:46:50 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:46:50 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: include test files in package (5c73538) Message-ID: <20160507064650.A0A973A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:46:46 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:46:46 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: get working with both GHC 6.10 and 6.12 (f4a0fd3) Message-ID: <20160507064646.923CB3A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:46:52 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:46:52 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Fixed loss of accuracy in timeOfDayToDayFraction. (2677235) Message-ID: <20160507064652.A754D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:46:54 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:46:54 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: set version to 1.2.1 (5c06110) Message-ID: <20160507064654.AD6913A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:46:56 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:46:56 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: version 1.2.0.3 is more appropriate than 1.2.1. (aeb4c0e) Message-ID: <20160507064656.B3B6A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:46:58 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:46:58 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: test says Success (f3d2c2a) Message-ID: <20160507064658.BA7553A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:47:00 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:47:00 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: fix parse "undefined" bug; added TestParseTime into tests (c5041a7) Message-ID: <20160507064700.C1D853A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:47:02 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:47:02 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: .run files are boring (ff06923) Message-ID: <20160507064702.C82A43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:47:08 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:47:08 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: test parse %C %y (c3d1c28) Message-ID: <20160507064708.DCCF93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:47:04 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:47:04 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: specify QuickCheck version (1c69e66) Message-ID: <20160507064704.CE9333A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:47:10 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:47:10 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: parse %y range 1969 - 2068, bug #2671 (84f1505) Message-ID: <20160507064710.E3E723A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:47:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:47:06 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: test for %y parse to 1969 - 2068 (ac3fc0b) Message-ID: <20160507064706.D5DB83A302@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:47:12 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:47:12 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: test for parse %m single digit (3dd4c2c) Message-ID: <20160507064712.E9EA83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:47:14 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:47:14 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: test parse %d %e single digit (8028949) Message-ID: <20160507064714.F04BA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:47:17 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:47:17 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: test parse %-m single digit (7cef519) Message-ID: <20160507064717.02D7A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:47:19 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:47:19 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: allow - _ 0 modifiers in % parsing (b2902c9) Message-ID: <20160507064719.09F813A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:47:21 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:47:21 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: version 1.2.0.5 (c8c840a) Message-ID: <20160507064721.0FF2C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:47:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:47:23 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: correct padding in parse; doc (83ec536) Message-ID: <20160507064723.1623F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:47:25 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:47:25 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: version 1.3: instance RealFrac DiffTime (234e6ce) Message-ID: <20160507064725.1CDBE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:47:27 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:47:27 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: NFData instances, contributed by Herbert Valerio Riedel (4466857) Message-ID: <20160507064727.23EBA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:47:29 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:47:29 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: remove upper bound on deepseq dependency (e395b77) Message-ID: <20160507064729.29D463A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:47:31 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:47:31 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: RULES for realToFrac, for speed, contributed by Liyang HU (8eee78e) Message-ID: <20160507064731.3116F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:47:33 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:47:33 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: fix for latest GHC (1674b5d) Message-ID: <20160507064733.3781C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:47:35 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:47:35 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: changed uses of mkTyCon to mkTyCon3 (8f9b7ae) Message-ID: <20160507064735.3ECB23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:47:37 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:47:37 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: revamped tests to use the new cabal testing interface (df3fc69) Message-ID: <20160507064737.4F4423A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:47:39 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:47:39 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: removed unneccesary Makefile (b317b99) Message-ID: <20160507064739.556883A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:47:43 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:47:43 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: get working with Cabal 1.16; fix up build process (2fa30f7) Message-ID: <20160507064743.63AD63A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:47:45 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:47:45 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: clean up tests (54a7b3b) Message-ID: <20160507064745.6AC173A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:47:41 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:47:41 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: added Test.Tests and Test.TestUtil modules (46ce767) Message-ID: <20160507064741.5CBF43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:47:47 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:47:47 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: clean up cabal (f3549c0) Message-ID: <20160507064747.729653A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:47:49 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:47:49 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: more TestInstance clean-up (0417890) Message-ID: <20160507064749.7A4D23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:47:51 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:47:51 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: %C not restricted to two characters in format (295c172) Message-ID: <20160507064751.80E063A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:47:53 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:47:53 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: fix up test infrastructure (500ca20) Message-ID: <20160507064753.892873A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:47:55 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:47:55 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: more test infrastructure (b85fefa) Message-ID: <20160507064755.8FFB73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:47:57 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:47:57 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: fixed some parsing issues; more test sorting out (3d0480a) Message-ID: <20160507064757.98B053A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:47:59 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:47:59 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: fix format modifiers for YCGf (fc49f3e) Message-ID: <20160507064759.9F5673A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:48:01 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:48:01 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: test warning on 32-bit systems (63896a3) Message-ID: <20160507064801.A5E6A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:48:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:48:03 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: update haddock for format & parse (9b3c6c7) Message-ID: <20160507064803.ADDAB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:48:05 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:48:05 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: fix time.cabal (c5f3fdc) Message-ID: <20160507064805.B4CB03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:48:07 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:48:07 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: more fixing of time.cabal (d452222) Message-ID: <20160507064807.BAB2D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:48:09 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:48:09 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Derive Typeable instances (222f71c) Message-ID: <20160507064809.C19CD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:48:11 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:48:11 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: use throwErrnoIfMinus1 gettimeofday for consistency in error handling (d575902) Message-ID: <20160507064811.C7B663A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:48:13 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:48:13 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Make getTimeZone cross-platform consistent by always considering the TZ environment variable. (9926c4a) Message-ID: <20160507064813.CF15A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:48:15 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:48:15 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Regression test for getTimeZone. (27173fc) Message-ID: <20160507064815.D718C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:48:17 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:48:17 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: detabify cbits (a4fbbed) Message-ID: <20160507064817.DC2073A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:48:19 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:48:19 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Changes for Safe Haskell (7cc0d01) Message-ID: <20160507064819.E53043A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:48:21 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:48:21 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: version 1.4.2; improve Makefile (1e92867) Message-ID: <20160507064821.EB44A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:48:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:48:23 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: tzset regardless of HAVE_LOCALTIME_R (a22e848) Message-ID: <20160507064823.F247A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:48:26 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:48:26 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: use latest test library (656b250) Message-ID: <20160507064826.049C13A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:48:28 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:48:28 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: .gitignore (08a0531) Message-ID: <20160507064828.0B4983A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:48:30 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:48:30 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: time.cabal: note homepage and source-repository (dff2fcf) Message-ID: <20160507064830.122663A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:48:32 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:48:32 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: more parse tests (757c5c4) Message-ID: <20160507064832.190303A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:48:34 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:48:34 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Data.Time.Format.Parse re-exports System.Locale. Bump to 1.5 for this. (f1853e7) Message-ID: <20160507064834.207523A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:48:36 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:48:36 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: .Format.Parse: add parseTimeM parseTimeOrError readSTime readPTime, deprecate parseTime readTime readsTime (1a633e6) Message-ID: <20160507064836.28CF23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:48:38 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:48:38 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: clean up source (50ddcf7) Message-ID: <20160507064838.2FD0C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:48:40 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:48:40 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: TestParseTime: more tests (c732e4d) Message-ID: <20160507064840.3620B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:48:42 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:48:42 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: move lib/test sources to separate directories (ad32d01) Message-ID: <20160507064842.3FCFE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:48:44 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:48:44 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: further file moves and .cabal fixes (0939180) Message-ID: <20160507064844.49F9C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:48:46 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:48:46 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: remove odd file (185cb99) Message-ID: <20160507064846.505673A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:48:48 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:48:48 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Makefile: slight fix (077665f) Message-ID: <20160507064848.58D633A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:48:50 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:48:50 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: .Format.Parse: be cleverer about skipping spaces (42afd39) Message-ID: <20160507064850.611183A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:48:52 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:48:52 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: .Format.Parse: fix spaces parsing (f964074) Message-ID: <20160507064852.677B53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:48:54 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:48:54 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: remove dependency on old-locale (907cbc2) Message-ID: <20160507064854.6F8FA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:48:56 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:48:56 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: LICENSE: some code U. Glasgow (635917c) Message-ID: <20160507064856.7629E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:48:58 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:48:58 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: remove System.Locale (e4ea1d9) Message-ID: <20160507064858.7C54D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:49:00 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:49:00 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: allow user control of parsing of time-zone names (dc4157a) Message-ID: <20160507064900.842BA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:49:02 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:49:02 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: parse single-letter "military" time zones; test parsing of all defaultLocale time zones. Test failure: "EAST" is there twice. (2e0c3f8) Message-ID: <20160507064902.8BCF73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:49:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:49:06 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: remove "intervals" from TimeLocale (2be4631) Message-ID: <20160507064906.999893A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:49:08 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:49:08 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: doc quote cleanup (2a14cb0) Message-ID: <20160507064908.A020E3A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:49:04 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:49:04 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: We're not in the time-zone business. defaultTimeLocale only has the time-zones mentioned in RFC 822. (f5ed156) Message-ID: <20160507064904.93D423A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:49:10 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:49:10 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Added bug-reports line to time.cabal (892717c) Message-ID: <20160507064910.A6A1E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:49:12 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:49:12 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Removed autogenerated HsTimeConfig.h* from repository, updated .gitignore. (82e0256) Message-ID: <20160507064912.ACDEE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:49:14 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:49:14 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Use `_tzset()` for non-POSIX Windows environments (9f12261) Message-ID: <20160507064914.B345F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:49:16 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:49:16 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Merge pull request #4 from hvr/pr-tzset (7633c67) Message-ID: <20160507064916.BA1123A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:49:18 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:49:18 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Merge pull request #3 from gintas/master (991e6be) Message-ID: <20160507064918.C029C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:49:20 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:49:20 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Add `Setup.hs` file (5511b80) Message-ID: <20160507064920.C74B33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:49:22 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:49:22 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Remove an extra division (52523fb) Message-ID: <20160507064922.CE92C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:49:24 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:49:24 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Merge pull request #10 from treeowl/master (b55b3c2) Message-ID: <20160507064924.D54C93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:49:26 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:49:26 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Add support for `deepseq-1.4.0.0` (e6d887a) Message-ID: <20160507064926.DC09E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:49:28 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:49:28 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Merge pull request #11 from hvr/pr-deepseq14 (982ea8f) Message-ID: <20160507064928.E2F993A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:49:30 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:49:30 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Merge pull request #5 from hvr/pr-setuphs (ab6475c) Message-ID: <20160507064930.EA26D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:49:32 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:49:32 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: fix deprecation of base 4.8 (7513fad) Message-ID: <20160507064932.F0FA23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:49:35 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:49:35 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Merge pull request #12 from dterei/base48-foreign-fix (8c7c106) Message-ID: <20160507064935.033263A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:49:37 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:49:37 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Improve documentation of wdays in TimeLocale (9366adb) Message-ID: <20160507064937.0A0203A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:49:39 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:49:39 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Merge pull request #14 from lubomir/document-locale (968ec05) Message-ID: <20160507064939.10EA43A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:49:41 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:49:41 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: version 1.5.0.1 (8d3c90a) Message-ID: <20160507064941.178113A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:49:43 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:49:43 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Fix note about `%Y` padding. (a52561a) Message-ID: <20160507064943.1E3563A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:49:45 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:49:45 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Merge pull request #17 from bjornbm/patch-1 (ba160e5) Message-ID: <20160507064945.271C43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:49:47 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:49:47 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: De-tabify all Haskell source files. (63d2c82) Message-ID: <20160507064947.334073A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:49:49 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:49:49 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Merge pull request #19 from erikd/master (b0c04d9) Message-ID: <20160507064949.380E93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:49:51 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:49:51 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Convert README file to markdown. (5808f3e) Message-ID: <20160507064951.3F3583A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:49:53 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:49:53 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Document that the show instance for UTCTime is elsewhere. (5bcf96f) Message-ID: <20160507064953.45F5B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:49:55 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:49:55 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Merge pull request #21 from tomjaguarpaw/master (acc5478) Message-ID: <20160507064955.4CE1B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:49:57 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:49:57 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: document orphan Read instances (0a8946c) Message-ID: <20160507064957.53D933A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:49:59 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:49:59 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Days: remove unused code (1749892) Message-ID: <20160507064959.59B8D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:50:01 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:50:01 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: instance Show UniversalTime (7b06a35) Message-ID: <20160507065001.609193A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:50:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:50:03 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: instance FormatTime UniversalTime; instance ParseTime UniversalTime; instance Read UniversalTime (1ca245b) Message-ID: <20160507065003.67B663A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:50:05 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:50:05 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Ensure Read/Show instances are always provided with UTCTime and Universal (34c255e) Message-ID: <20160507065005.6ECB23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:50:09 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:50:09 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Merge pull request #32 from bergmark/patch-1 (7875368) Message-ID: <20160507065009.7D0173A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:50:11 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:50:11 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Merge pull request #20 from erikd/master (ad3ee77) Message-ID: <20160507065011.850493A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:50:07 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:50:07 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Loosen required cabal-version (85cf1aa) Message-ID: <20160507065007.74ED13A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:50:13 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:50:13 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: ensure read instances for additional types -- TimeZone, Day, LocalTime, ZonedTime, TimeOfDay (60408b8) Message-ID: <20160507065013.8C29B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:50:15 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:50:15 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: newline (76bd850) Message-ID: <20160507065015.938213A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:50:17 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:50:17 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: remove tabs and trailing spaces (dd6dce8) Message-ID: <20160507065017.9D3273A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:50:19 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:50:19 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: clean up .cabal (e1246f4) Message-ID: <20160507065019.A40573A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:50:21 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:50:21 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: bump version (3a3bbe0) Message-ID: <20160507065021.A9E923A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:50:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:50:23 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: bump version (5b4f363) Message-ID: <20160507065023.B07783A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:50:25 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:50:25 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Merge pull request #26 from gbaz/instances (80a554c) Message-ID: <20160507065025.B88EC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:50:27 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:50:27 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: test sdist (ccd0609) Message-ID: <20160507065027.BF10D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:50:29 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:50:29 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Test.TestTimeZone was missing in time.cabal, added (4c63614) Message-ID: <20160507065029.C53003A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:50:31 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:50:31 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Added diffTimeToPicoseconds (also cleaned up picosecondsToDiffTime) (020ce40) Message-ID: <20160507065031.CC5433A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:50:33 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:50:33 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Fix compilation on GHC 7.0 by not using Trustworthy (603b058) Message-ID: <20160507065033.D2C533A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:50:35 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:50:35 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: use clock_gettime to implement getPOSIXTime if available (1b74336) Message-ID: <20160507065035.DB7293A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:50:39 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:50:39 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Merge pull request #35 from bergmark/ghc70 (45c652b) Message-ID: <20160507065039.ED05F3A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:50:42 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:50:42 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: use stack; include autotools stuff (899f339) Message-ID: <20160507065042.05F0F3A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:50:37 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:50:37 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Merge pull request #38 from redneb/clock_gettime (882305f) Message-ID: <20160507065037.E39DE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:50:44 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:50:44 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: fix bug in fromSundayStartWeekValid, with tests (1732b96) Message-ID: <20160507065044.100593A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:50:46 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:50:46 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: make parsing reject invalid dates and the like (e9cd141) Message-ID: <20160507065046.180753A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:50:48 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:50:48 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: bump version (05ae57a) Message-ID: <20160507065048.206073A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:50:50 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:50:50 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: remove trailing space (b31cee9) Message-ID: <20160507065050.26DDE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:50:52 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:50:52 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: added changelog.md (346ced4) Message-ID: <20160507065052.2DB7A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:50:54 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:50:54 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Remove autogenerated artifacts from Git (409d7a0) Message-ID: <20160507065054.371B73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:50:56 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:50:56 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Restore compat for GHC 7.8 (5cd5490) Message-ID: <20160507065056.3D3ED3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:50:58 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:50:58 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Merge pull request #42 from hvr/pr/ghc-78-fix (cc7f64b) Message-ID: <20160507065058.43E2B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:51:00 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:51:00 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Remove obsolete `--with-cc` flag from configure.ac (2d939c9) Message-ID: <20160507065100.4A5063A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:51:02 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:51:02 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Enable AC_USE_SYSTEM_EXTENSIONS (716033d) Message-ID: <20160507065102.512413A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:51:04 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:51:04 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Merge pull request #44 from hvr/pr/configure (a73564c) Message-ID: <20160507065104.57BCD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:51:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:51:06 +0000 (UTC) Subject: [commit: packages/time] master,wip/travis: version 1.6.0.1 (1eb323b) Message-ID: <20160507065106.5EA9E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:51:08 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:51:08 +0000 (UTC) Subject: [commit: packages/time] master, wip/travis: Add Travis-CI job config (393e6e2) Message-ID: <20160507065108.66A353A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branches: master,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 Sat May 7 06:51:10 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:51:10 +0000 (UTC) Subject: [commit: packages/time] wip/travis: Disable travis caching logic for now (6c35d3a) Message-ID: <20160507065110.6DA7B3A300@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 Sat May 7 06:51:12 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:51:12 +0000 (UTC) Subject: [commit: packages/time] wip/travis: force-reinstalls (f18e3c3) Message-ID: <20160507065112.745533A300@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 Sat May 7 06:51:14 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:51:14 +0000 (UTC) Subject: [commit: packages/time] wip/travis: disable tests (b837d6c) Message-ID: <20160507065114.7AE193A300@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 Sat May 7 06:51:18 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:51:18 +0000 (UTC) Subject: [commit: packages/time] master: remove stack.yaml for the time being (52e0f5e) Message-ID: <20160507065118.885023A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branch : master 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 Sat May 7 06:51:16 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 06:51:16 +0000 (UTC) Subject: [commit: packages/time] master: Disable travis caching logic for now (16a36e4) Message-ID: <20160507065116.81C7E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/time On branch : master 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 Sat May 7 07:06:56 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 07:06:56 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Update time submodule to 1.6.0.1 release tag (aa55caf) Message-ID: <20160507070656.974623A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/aa55caf0152f8f5dcd68d091068b747eca1c290d/ghc >--------------------------------------------------------------- commit aa55caf0152f8f5dcd68d091068b747eca1c290d Author: Herbert Valerio Riedel Date: Sat May 7 08:41:54 2016 +0200 Update time submodule to 1.6.0.1 release tag (cherry picked from commit 633b099cb683b3d2e9bb2776ecaa7a83e5736de7) >--------------------------------------------------------------- aa55caf0152f8f5dcd68d091068b747eca1c290d libraries/time | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/time b/libraries/time index 393e6e2..52e0f5e 160000 --- a/libraries/time +++ b/libraries/time @@ -1 +1 @@ -Subproject commit 393e6e247fd472d8833e69cc79679ba9c09311bc +Subproject commit 52e0f5e85ffbaab77b155d48720fb216021c8a73 From git at git.haskell.org Sat May 7 07:07:01 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 07:07:01 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: users-guide: Clean up version numbers and TODOs (23df0d5) Message-ID: <20160507070701.E037B3A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/23df0d56ea4762dada79b83fd18bcb7c691a039d/ghc >--------------------------------------------------------------- commit 23df0d56ea4762dada79b83fd18bcb7c691a039d Author: Ben Gamari Date: Sat May 7 09:09:39 2016 +0200 users-guide: Clean up version numbers and TODOs >--------------------------------------------------------------- 23df0d56ea4762dada79b83fd18bcb7c691a039d docs/users_guide/8.0.1-notes.rst | 48 ++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/docs/users_guide/8.0.1-notes.rst b/docs/users_guide/8.0.1-notes.rst index aa120f7..58f13c3 100644 --- a/docs/users_guide/8.0.1-notes.rst +++ b/docs/users_guide/8.0.1-notes.rst @@ -31,8 +31,6 @@ Highlights The highlights, since the 7.10 branch, are: -- TODO FIXME - - The new :ghc-flag:`-XTypeInType` allows promotion of all types into kinds, allowing kind synonyms, kind families, promoted GADTs, and other goodies. @@ -86,8 +84,6 @@ Full details Language ~~~~~~~~ -- TODO FIXME. - - :ghc-flag:`-XTypeInType` supports universal type promotion and merges the type and kind language. This allows, for example, higher-rank kinds, along with kind families and type-level GADTs. Support is still @@ -502,12 +498,12 @@ Runtime system Build system ~~~~~~~~~~~~ -- TODO FIXME. +- Nothing changed here. Package system ~~~~~~~~~~~~~~ -- TODO FIXME. +- Various internal changes but nothing user-facing. hsc2hs ~~~~~~ @@ -543,7 +539,7 @@ Libraries array ~~~~~ -- Version number XXXXX (was 0.5.0.0) +- Version number 0.5.1.1 (was 0.5.0.0) .. _lib-base: @@ -622,43 +618,41 @@ See ``changelog.md`` in the ``base`` package for full release notes. binary ~~~~~~ -- Version number XXXXX (was 0.7.1.0) +- Version number 0.8.3.0 (was 0.7.1.0) bytestring ~~~~~~~~~~ -- Version number XXXXX (was 0.10.4.0) +- Version number 0.10.8.0 (was 0.10.4.0) Cabal ~~~~~ -- Version number XXXXX (was 1.18.1.3) +- Version number 1.24.0 (was 1.18.1.3) containers ~~~~~~~~~~ -- Version number XXXXX (was 0.5.4.0) +- Version number 0.5.7.1 (was 0.5.4.0) deepseq ~~~~~~~ -- Version number XXXXX (was 1.3.0.2) +- Version number 1.4.2.0 (was 1.3.0.2) directory ~~~~~~~~~ -- Version number XXXXX (was 1.2.0.2) +- Version number 1.2.6.2 (was 1.2.0.2) filepath ~~~~~~~~ -- Version number XXXXX (was 1.3.0.2) +- Version number 1.4.1.0 (was 1.3.0.2) ghc ~~~ -- TODO FIXME. - - The ``HsBang`` type has been removed in favour of ``HsSrcBang`` and ``HsImplBang``. Data constructors now always carry around their strictness annotations as the user wrote them, whether from an @@ -683,6 +677,8 @@ ghc-boot - This is an internal package. Use with caution. +- Version number 8.0.1 + - This package was renamed from ``bin-package-db`` to reflect its new purpose of containing intra-GHC functionality that needs to be shared across multiple GHC boot libraries. @@ -698,7 +694,7 @@ ghc-boot ghc-prim ~~~~~~~~ -- Version number XXXXX (was 0.3.1.0) +- Version number 0.5.0.0 (was 0.3.1.0) haskell98 ~~~~~~~~~ @@ -713,17 +709,17 @@ haskell2010 hoopl ~~~~~ -- Version number XXXXX (was 3.10.0.0) +- Version number 3.10.2.1 (was 3.10.0.0) hpc ~~~ -- Version number XXXXX (was 0.6.0.1) +- Version number 0.6.0.3 (was 0.6.0.1) integer-gmp ~~~~~~~~~~~ -- Version number XXXXX (was 0.5.1.0) +- Version number 1.0.0.1 (was 0.5.1.0) old-locale ~~~~~~~~~~ @@ -738,12 +734,12 @@ old-time process ~~~~~~~ -- Version number XXXXX (was 1.2.0.0) +- Version number 1.4.2.0 (was 1.2.0.0) template-haskell ~~~~~~~~~~~~~~~~ -- Version number XXXXX (was 2.9.0.0) +- Version number 2.11.0.0 (was 2.9.0.0) - The ``Lift`` type class for lifting values into Template Haskell splices now has a default signature ``lift :: Data a => a -> Q Exp``, @@ -761,19 +757,19 @@ template-haskell time ~~~~ -- Version number XXXXX (was 1.4.1) +- Version number 1.6.0.1 (was 1.4.1) unix ~~~~ -- Version number XXXXX (was 2.7.0.0) +- Version number 2.7.2.0 (was 2.7.0.0) Win32 ~~~~~ -- Version number XXXXX (was 2.3.0.1) +- Version number 2.3.1.1 (was 2.3.0.1) Known bugs ---------- -- TODO FIXME +- None From git at git.haskell.org Sat May 7 07:06:59 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 7 May 2016 07:06:59 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: ghc-boot: Bump version number in changelog (cc6900e) Message-ID: <20160507070659.413693A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/cc6900ecd1fdce8ba21490237d9906e235cfc42c/ghc >--------------------------------------------------------------- commit cc6900ecd1fdce8ba21490237d9906e235cfc42c Author: Ben Gamari Date: Sat May 7 09:09:27 2016 +0200 ghc-boot: Bump version number in changelog >--------------------------------------------------------------- cc6900ecd1fdce8ba21490237d9906e235cfc42c libraries/ghc-boot/changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/ghc-boot/changelog.md b/libraries/ghc-boot/changelog.md index e0b4d69..3775eda 100644 --- a/libraries/ghc-boot/changelog.md +++ b/libraries/ghc-boot/changelog.md @@ -1,4 +1,4 @@ -## 0.0.0.0 *Feb 2016* +## 8.0.1 *Feb 2016* * Bundled with GHC 8.0.1 From git at git.haskell.org Sun May 8 11:21:41 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 8 May 2016 11:21:41 +0000 (UTC) Subject: [commit: ghc] master: rts/ProfHeap.c: Use `ssize_t` instead of `long`. (8e5776b) Message-ID: <20160508112141.8B5303A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8e5776b8ec98b1b9f55c938b818b0a2fd0eb9928/ghc >--------------------------------------------------------------- commit 8e5776b8ec98b1b9f55c938b818b0a2fd0eb9928 Author: Erik de Castro Lopo Date: Thu May 5 18:36:16 2016 +1000 rts/ProfHeap.c: Use `ssize_t` instead of `long`. On x64 Windows `sizeof long` is 4 which could easily overflow resulting in incorrect heap profiling results. This change does not affect either Linux or OS X where `sizeof long` == `sizeof ssize_t` regardless of machine word size. Test Plan: Validate on Linux and Windows Reviewers: hsyl20, bgamari, simonmar, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2177 >--------------------------------------------------------------- 8e5776b8ec98b1b9f55c938b818b0a2fd0eb9928 rts/ProfHeap.c | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/rts/ProfHeap.c b/rts/ProfHeap.c index 875cc7e..58d66eb 100644 --- a/rts/ProfHeap.c +++ b/rts/ProfHeap.c @@ -50,13 +50,14 @@ static uint32_t max_era; typedef struct _counter { void *identity; union { - uint32_t resid; + ssize_t resid; struct { - long prim; // total size of 'inherently used' closures - long not_used; // total size of 'never used' closures - long used; // total size of 'used at least once' closures - long void_total; // current total size of 'destroyed without being used' closures - long drag_total; // current total size of 'used at least once and waiting to die' + // Total sizes of: + ssize_t prim; // 'inherently used' closures + ssize_t not_used; // 'never used' closures + ssize_t used; // 'used at least once' closures + ssize_t void_total; // 'destroyed without being used' closures + ssize_t drag_total; // 'used at least once and waiting to die' } ldv; } c; struct _counter *next; @@ -79,11 +80,11 @@ typedef struct { Arena * arena; // for LDV profiling, when just displaying by LDV - long prim; - long not_used; - long used; - long void_total; - long drag_total; + ssize_t prim; + ssize_t not_used; + ssize_t used; + ssize_t void_total; + ssize_t drag_total; } Census; static Census *censuses = NULL; @@ -193,14 +194,14 @@ LDV_recordDead( StgClosure *c, uint32_t size ) t = (LDVW((c)) & LDV_CREATE_MASK) >> LDV_SHIFT; if (t < era) { if (RtsFlags.ProfFlags.bioSelector == NULL) { - censuses[t].void_total += (long)size; - censuses[era].void_total -= (long)size; + censuses[t].void_total += size; + censuses[era].void_total -= size; ASSERT(censuses[t].void_total < censuses[t].not_used); } else { id = closureIdentity(c); ctr = lookupHashTable(censuses[t].hash, (StgWord)id); ASSERT( ctr != NULL ); - ctr->c.ldv.void_total += (long)size; + ctr->c.ldv.void_total += size; ctr = lookupHashTable(censuses[era].hash, (StgWord)id); if (ctr == NULL) { ctr = arenaAlloc(censuses[era].arena, sizeof(counter)); @@ -210,7 +211,7 @@ LDV_recordDead( StgClosure *c, uint32_t size ) ctr->next = censuses[era].ctrs; censuses[era].ctrs = ctr; } - ctr->c.ldv.void_total -= (long)size; + ctr->c.ldv.void_total -= size; } } } else { @@ -224,7 +225,7 @@ LDV_recordDead( StgClosure *c, uint32_t size ) id = closureIdentity(c); ctr = lookupHashTable(censuses[t+1].hash, (StgWord)id); ASSERT( ctr != NULL ); - ctr->c.ldv.drag_total += (long)size; + ctr->c.ldv.drag_total += size; ctr = lookupHashTable(censuses[era].hash, (StgWord)id); if (ctr == NULL) { ctr = arenaAlloc(censuses[era].arena, sizeof(counter)); @@ -234,7 +235,7 @@ LDV_recordDead( StgClosure *c, uint32_t size ) ctr->next = censuses[era].ctrs; censuses[era].ctrs = ctr; } - ctr->c.ldv.drag_total -= (long)size; + ctr->c.ldv.drag_total -= size; } } } @@ -739,7 +740,7 @@ static void dumpCensus( Census *census ) { counter *ctr; - long count; + ssize_t count; printSample(rtsTrue, census->time); @@ -835,7 +836,7 @@ dumpCensus( Census *census ) } -static void heapProfObject(Census *census, StgClosure *p, uint32_t size, +static void heapProfObject(Census *census, StgClosure *p, size_t size, rtsBool prim #ifndef PROFILING STG_UNUSED @@ -843,7 +844,7 @@ static void heapProfObject(Census *census, StgClosure *p, uint32_t size, ) { void *identity; - uint32_t real_size; + size_t real_size; counter *ctr; identity = NULL; @@ -920,7 +921,7 @@ heapCensusChain( Census *census, bdescr *bd ) { StgPtr p; StgInfoTable *info; - uint32_t size; + size_t size; rtsBool prim; for (; bd != NULL; bd = bd->link) { From git at git.haskell.org Tue May 10 04:26:31 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 04:26:31 +0000 (UTC) Subject: [commit: ghc] master: Documentation for simplifyDeriv. (dd3e847) Message-ID: <20160510042631.15E863A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/dd3e84701db7d05a6664aa5826732da3ee8ce265/ghc >--------------------------------------------------------------- commit dd3e84701db7d05a6664aa5826732da3ee8ce265 Author: Edward Z. Yang Date: Fri May 6 16:34:50 2016 -0700 Documentation for simplifyDeriv. Signed-off-by: Edward Z. Yang Test Plan: docs only Reviewers: simonpj, austin, goldfire, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2180 >--------------------------------------------------------------- dd3e84701db7d05a6664aa5826732da3ee8ce265 compiler/typecheck/TcDeriv.hs | 44 ++++++++++++++++++++++++++--------------- compiler/typecheck/TcMType.hs | 6 ++++++ compiler/typecheck/TcRnMonad.hs | 1 + 3 files changed, 35 insertions(+), 16 deletions(-) diff --git a/compiler/typecheck/TcDeriv.hs b/compiler/typecheck/TcDeriv.hs index 57a4037..06f87a3 100644 --- a/compiler/typecheck/TcDeriv.hs +++ b/compiler/typecheck/TcDeriv.hs @@ -130,6 +130,8 @@ type DerivContext = Maybe ThetaType -- Nothing <=> Vanilla deriving; infer the context of the instance decl -- Just theta <=> Standalone deriving: context supplied by programmer +-- | A 'PredType' annotated with the origin of the constraint 'CtOrigin', +-- and whether or the constraint deals in types or kinds. data PredOrigin = PredOrigin PredType CtOrigin TypeOrKind type ThetaOrigin = [PredOrigin] @@ -1950,13 +1952,14 @@ extendLocalInstEnv dfuns thing_inside *********************************************************************************** -} -simplifyDeriv :: PredType - -> [TyVar] - -> ThetaOrigin -- Wanted - -> TcM ThetaType -- Needed --- Given instance (wanted) => C inst_ty --- Simplify 'wanted' as much as possibles --- Fail if not possible +-- | Given @instance (wanted) => C inst_ty@, simplify 'wanted' as much +-- as possible. Fail if not possible. +simplifyDeriv :: PredType -- ^ @C inst_ty@, head of the instance we are + -- deriving. Only used for SkolemInfo. + -> [TyVar] -- ^ The tyvars bound by @inst_ty at . + -> ThetaOrigin -- ^ @wanted@ constraints, i.e. @['PredOrigin']@. + -> TcM ThetaType -- ^ Needed constraints (after simplification), + -- i.e. @['PredType']@. simplifyDeriv pred tvs theta = do { (skol_subst, tvs_skols) <- tcInstSkolTyVars tvs -- Skolemize -- The constraint solving machinery @@ -1970,31 +1973,38 @@ simplifyDeriv pred tvs theta mk_ct (PredOrigin t o t_or_k) = newWanted o (Just t_or_k) (substTy skol_subst t) + -- Generate the wanted constraints with the skolemized variables ; (wanted, tclvl) <- pushTcLevelM (mapM mk_ct theta) - ; traceTc "simplifyDeriv" $ + ; traceTc "simplifyDeriv inputs" $ vcat [ pprTvBndrs tvs $$ ppr theta $$ ppr wanted, doc ] + -- Simplify the constraints ; residual_wanted <- simplifyWantedsTcM wanted -- Result is zonked + -- Split the resulting constraints into bad and good constraints, + -- building an @unsolved :: WantedConstraints@ representing all + -- the constraints we can't just shunt to the predicates. + -- See Note [Exotic derived instance contexts] ; let residual_simple = wc_simple residual_wanted - (good, bad) = partitionBagWith get_good residual_simple + (bad, good) = partitionBagWith get_good residual_simple unsolved = residual_wanted { wc_simple = bad } -- See Note [Exotic derived instance contexts] - get_good :: Ct -> Either PredType Ct + get_good :: Ct -> Either Ct PredType get_good ct | validDerivPred skol_set p , isWantedCt ct - = Left p - -- NB: residual_wanted may contain unsolved - -- Derived and we stick them into the bad set - -- so that reportUnsolved may decide what to do with them + = Right p + -- NB re 'isWantedCt': residual_wanted may contain + -- unsolved CtDerived and we stick them into the + -- bad set so that reportUnsolved may decide what + -- to do with them | otherwise - = Right ct + = Left ct where p = ctPred ct - ; traceTc "simplifyDeriv 2" $ + ; traceTc "simplifyDeriv outputs" $ vcat [ ppr tvs_skols, ppr residual_simple, ppr good, ppr bad ] -- If we are deferring type errors, simply ignore any insoluble @@ -2005,9 +2015,11 @@ simplifyDeriv pred tvs theta -- The buildImplicationFor is just to bind the skolems, -- in case they are mentioned in error messages -- See Trac #11347 + -- Report the (bad) unsolved constraints ; unless defer (reportAllUnsolved (mkImplicWC implic)) + -- Return the good unsolved constraints (unskolemizing on the way out.) ; let min_theta = mkMinimalBySCs (bagToList good) subst_skol = zipTvSubst tvs_skols $ mkTyVarTys tvs -- The reverse substitution (sigh) diff --git a/compiler/typecheck/TcMType.hs b/compiler/typecheck/TcMType.hs index 861fa10..71bf861 100644 --- a/compiler/typecheck/TcMType.hs +++ b/compiler/typecheck/TcMType.hs @@ -471,6 +471,12 @@ tcSuperSkolTyVar subst tv tcInstSkolTyVarsLoc :: SrcSpan -> [TyVar] -> TcRnIf gbl lcl (TCvSubst, [TcTyVar]) tcInstSkolTyVarsLoc loc = instSkolTyCoVars (mkTcSkolTyVar loc False) +-- | Given a list of @['TyVar']@, skolemize the type variables, +-- returning a substitution mapping the original tyvars to the +-- skolems, and the list of newly bound skolems. See also +-- tcInstSkolTyVars' for a precondition. The resulting +-- skolems are non-overlappable; see Note [Overlap and deriving] +-- for an example where this matters. tcInstSkolTyVars :: [TyVar] -> TcM (TCvSubst, [TcTyVar]) tcInstSkolTyVars = tcInstSkolTyVars' False emptyTCvSubst diff --git a/compiler/typecheck/TcRnMonad.hs b/compiler/typecheck/TcRnMonad.hs index 91a6a57..2691c82 100644 --- a/compiler/typecheck/TcRnMonad.hs +++ b/compiler/typecheck/TcRnMonad.hs @@ -1303,6 +1303,7 @@ pushTcLevelM_ :: TcM a -> TcM a pushTcLevelM_ x = updLclEnv (\ env -> env { tcl_tclvl = pushTcLevel (tcl_tclvl env) }) x pushTcLevelM :: TcM a -> TcM (a, TcLevel) +-- See Note [TcLevel assignment] pushTcLevelM thing_inside = do { env <- getLclEnv ; let tclvl' = pushTcLevel (tcl_tclvl env) From git at git.haskell.org Tue May 10 06:38:10 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 06:38:10 +0000 (UTC) Subject: [commit: ghc] master: Use stdint types for Stg{Word, Int}{8, 16, 32, 64} (260a564) Message-ID: <20160510063810.189213A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/260a5648c299636a94b12b9b97bf9743b0a1496d/ghc >--------------------------------------------------------------- commit 260a5648c299636a94b12b9b97bf9743b0a1496d Author: Tomas Carnecky Date: Sun May 8 14:44:07 2016 +0200 Use stdint types for Stg{Word,Int}{8,16,32,64} We can't define Stg{Int,Word} in terms of {,u}intptr_t because STG depends on them being the exact same size as void*, and {,u}intptr_t does not make that guarantee. Furthermore, we also need to define StgHalf{Int,Word}, so the preprocessor if needs to stay. But we can at least keep it in a single place instead of repeating it in various files. Also define STG_{INT,WORD}{8,16,32,64}_{MIN,MAX} and use it in HsFFI.h, further reducing the need for CPP in other files. Reviewers: austin, bgamari, simonmar, hvr, erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2182 >--------------------------------------------------------------- 260a5648c299636a94b12b9b97bf9743b0a1496d includes/HsFFI.h | 84 +++++++-------------------------- includes/stg/Types.h | 130 +++++++++++++++++++++++++++++---------------------- rts/ProfHeap.c | 2 +- rts/Stats.c | 6 +-- rts/sm/Sanity.c | 2 +- 5 files changed, 96 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 260a5648c299636a94b12b9b97bf9743b0a1496d From git at git.haskell.org Tue May 10 08:31:15 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 08:31:15 +0000 (UTC) Subject: [commit: ghc] master: Emit wild-card constraints in the right place (76d9156) Message-ID: <20160510083115.655C83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/76d9156f6446d87e0f859a44959d63c2067fc805/ghc >--------------------------------------------------------------- commit 76d9156f6446d87e0f859a44959d63c2067fc805 Author: Simon Peyton Jones Date: Mon May 9 11:49:15 2016 +0100 Emit wild-card constraints in the right place We were failing to emit wild-card hole constraints altogether in the case of pattern bindings. Reason: it was done in tcExtendTyVarEnvFromSig, which isn't called for pattern bindings. This patch make it work right for both pattern and function bindings. Mainly, there is a call to emitWildCardHolds in tcRhs for both PatBind and FunBind. I also killed off TcExpr.typeSigCtxt. >--------------------------------------------------------------- 76d9156f6446d87e0f859a44959d63c2067fc805 compiler/typecheck/TcBinds.hs | 34 +++++++++++++++++++--------------- compiler/typecheck/TcExpr.hs | 11 +++++++---- compiler/typecheck/TcHsType.hs | 2 +- compiler/typecheck/TcType.hs | 14 +++++++------- 4 files changed, 34 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 76d9156f6446d87e0f859a44959d63c2067fc805 From git at git.haskell.org Tue May 10 08:31:18 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 08:31:18 +0000 (UTC) Subject: [commit: ghc] master: White space only (2593e20) Message-ID: <20160510083118.181773A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2593e20416c2e4222ed33c6f363c0341f44a120a/ghc >--------------------------------------------------------------- commit 2593e20416c2e4222ed33c6f363c0341f44a120a Author: Simon Peyton Jones Date: Mon May 9 11:45:49 2016 +0100 White space only >--------------------------------------------------------------- 2593e20416c2e4222ed33c6f363c0341f44a120a compiler/typecheck/TcBinds.hs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/compiler/typecheck/TcBinds.hs b/compiler/typecheck/TcBinds.hs index aef80a8..2bb2dca 100644 --- a/compiler/typecheck/TcBinds.hs +++ b/compiler/typecheck/TcBinds.hs @@ -1483,15 +1483,15 @@ tcMonoBinds _ sig_fn no_gen binds -- Bring the monomorphic Ids, into scope for the RHSs ; let mono_infos = getMonoBindInfo tc_binds - rhs_id_env = [(name, mono_id) | MBI { mbi_poly_name = name - , mbi_sig = mb_sig - , mbi_mono_id = mono_id } - <- mono_infos - , case mb_sig of - Just sig -> isPartialSig sig - Nothing -> True ] - -- A monomorphic binding for each term variable that lacks - -- a type sig. (Ones with a sig are already in scope.) + rhs_id_env = [ (name, mono_id) + | MBI { mbi_poly_name = name + , mbi_sig = mb_sig + , mbi_mono_id = mono_id } <- mono_infos + , case mb_sig of + Just sig -> isPartialSig sig + Nothing -> True ] + -- A monomorphic binding for each term variable that lacks + -- a complete type sig. (Ones with a sig are already in scope.) ; traceTc "tcMonoBinds" $ vcat [ ppr n <+> ppr id <+> ppr (idType id) | (n,id) <- rhs_id_env] From git at git.haskell.org Tue May 10 08:31:20 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 08:31:20 +0000 (UTC) Subject: [commit: ghc] master: Comments only (cc75a5d) Message-ID: <20160510083120.BF12C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cc75a5d9b80c87d2d5769b2a3f527e0a891138c4/ghc >--------------------------------------------------------------- commit cc75a5d9b80c87d2d5769b2a3f527e0a891138c4 Author: Simon Peyton Jones Date: Mon May 9 11:52:11 2016 +0100 Comments only >--------------------------------------------------------------- cc75a5d9b80c87d2d5769b2a3f527e0a891138c4 compiler/typecheck/TcExpr.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compiler/typecheck/TcExpr.hs b/compiler/typecheck/TcExpr.hs index 2a341bd..a4c8d02 100644 --- a/compiler/typecheck/TcExpr.hs +++ b/compiler/typecheck/TcExpr.hs @@ -1060,6 +1060,8 @@ arithSeqEltType (Just fl) res_ty type LHsExprArgIn = Either (LHsExpr Name) (LHsWcType Name) type LHsExprArgOut = Either (LHsExpr TcId) (LHsWcType Name) + -- Left e => argument expression + -- Right ty => visible type application tcApp1 :: HsExpr Name -- either HsApp or HsAppType -> ExpRhoType -> TcM (HsExpr TcId) From git at git.haskell.org Tue May 10 08:31:24 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 08:31:24 +0000 (UTC) Subject: [commit: ghc] master: Fix partial sigs and pattern bindings interaction (e1ff2b4) Message-ID: <20160510083124.6248B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e1ff2b4950a02bc26b9ab36c9c589a8156e324bd/ghc >--------------------------------------------------------------- commit e1ff2b4950a02bc26b9ab36c9c589a8156e324bd Author: Simon Peyton Jones Date: Mon May 9 13:08:02 2016 +0100 Fix partial sigs and pattern bindings interaction It turns out that GHC 8.0 would accept entirely bogus programs like f2 :: (True, _) -> Char Just f2 = Just (\x->x) (which is now partial-sigs/should_fail/PatBind3) This also fixes Trac #9478, test `PatBind2`. >--------------------------------------------------------------- e1ff2b4950a02bc26b9ab36c9c589a8156e324bd compiler/typecheck/TcPat.hs | 96 +++++++++++++++++++--- testsuite/tests/partial-sigs/should_compile/all.T | 2 +- .../tests/partial-sigs/should_fail/PatBind3.hs | 6 ++ .../tests/partial-sigs/should_fail/PatBind3.stderr | 9 ++ testsuite/tests/partial-sigs/should_fail/all.T | 1 + 5 files changed, 100 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 e1ff2b4950a02bc26b9ab36c9c589a8156e324bd From git at git.haskell.org Tue May 10 08:31:27 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 08:31:27 +0000 (UTC) Subject: [commit: ghc] master: Tidy up partial-sig quantification (9dbf5f5) Message-ID: <20160510083127.142113A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9dbf5f5c63f6ffde86c2faab60c97e97c77a27c3/ghc >--------------------------------------------------------------- commit 9dbf5f5c63f6ffde86c2faab60c97e97c77a27c3 Author: Simon Peyton Jones Date: Mon May 9 13:48:34 2016 +0100 Tidy up partial-sig quantification There's a messy bit of tcSimplifyInfer which concerns how quantify when partial type signatures are involved. This patch tidies it up a lot. Notice that decideQuantification and quantify_tvs get much simpler. And previously the inferred type of a function could be cluttered with phantom variables that were relevant only to the error messgas. See Note [Quantification and partial signatures]. >--------------------------------------------------------------- 9dbf5f5c63f6ffde86c2faab60c97e97c77a27c3 compiler/typecheck/TcSimplify.hs | 115 +++++++++++++++++++-------------------- 1 file changed, 57 insertions(+), 58 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 9dbf5f5c63f6ffde86c2faab60c97e97c77a27c3 From git at git.haskell.org Tue May 10 08:31:29 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 08:31:29 +0000 (UTC) Subject: [commit: ghc] master: Error message wibbles, re partial type sigs (bb296bf) Message-ID: <20160510083129.B89F33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/bb296bf1b5d92b2c4059c2d97a317622247c3397/ghc >--------------------------------------------------------------- commit bb296bf1b5d92b2c4059c2d97a317622247c3397 Author: Simon Peyton Jones Date: Mon May 9 13:52:18 2016 +0100 Error message wibbles, re partial type sigs I committed three patches involving partial type sigs that are collectively responsible for these error message changes. The are all just changes to numbering in the pretty-printer. I didn't bother to partition them between patches -- sorry! >--------------------------------------------------------------- bb296bf1b5d92b2c4059c2d97a317622247c3397 .../should_compile/ExtraConstraints1.stderr | 0 .../should_compile/ExtraConstraints3.stderr | 28 ++++++------- .../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/Uncurry.stderr | 2 +- .../should_compile/UncurryNamed.stderr | 2 +- .../WarningWildcardInstantiations.stderr | 48 ++++++++++------------ .../NamedExtraConstraintsWildcard.stderr | 2 +- .../partial-sigs/should_fail/TidyClash.stderr | 22 +++++----- .../partial-sigs/should_fail/TidyClash2.stderr | 46 ++++++++++----------- .../should_fail/WildcardInstantiations.stderr | 46 +++++++++------------ .../tests/typecheck/should_fail/tcfail198.stderr | 6 +-- 13 files changed, 96 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 bb296bf1b5d92b2c4059c2d97a317622247c3397 From git at git.haskell.org Tue May 10 08:31:32 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 08:31:32 +0000 (UTC) Subject: [commit: ghc] master: Re-do the invariant for TcDepVars (0597493) Message-ID: <20160510083132.657613A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0597493293eeea9b966697471d443fb20025bbf9/ghc >--------------------------------------------------------------- commit 0597493293eeea9b966697471d443fb20025bbf9 Author: Simon Peyton Jones Date: Mon May 9 23:12:31 2016 +0100 Re-do the invariant for TcDepVars Previously I had it so that dv_kvs and dv_tvs didn't overlap. Now they can, and quantifyZonkedTyVars removes the former from the latter. This is more economical, and in fact there was a bug where the invariant wasn't re-established. It's much easier to allow dv_kvs and dv_kvs to overlap, and to eliminate the overlap in TcMType.quantifyZonkedTyVars >--------------------------------------------------------------- 0597493293eeea9b966697471d443fb20025bbf9 compiler/typecheck/TcMType.hs | 21 ++++++++----- compiler/typecheck/TcType.hs | 68 +++++++++++++++++++++++++------------------ 2 files changed, 53 insertions(+), 36 deletions(-) diff --git a/compiler/typecheck/TcMType.hs b/compiler/typecheck/TcMType.hs index 71bf861..8ad9aba 100644 --- a/compiler/typecheck/TcMType.hs +++ b/compiler/typecheck/TcMType.hs @@ -866,13 +866,13 @@ quantifyTyVars, quantifyZonkedTyVars quantifyTyVars gbl_tvs (DV { dv_kvs = dep_tkvs, dv_tvs = nondep_tkvs }) = do { dep_tkvs <- zonkTyCoVarsAndFVDSet dep_tkvs - ; nondep_tkvs <- (`minusDVarSet` dep_tkvs) <$> - zonkTyCoVarsAndFVDSet nondep_tkvs + ; nondep_tkvs <- zonkTyCoVarsAndFVDSet nondep_tkvs ; gbl_tvs <- zonkTyCoVarsAndFV gbl_tvs ; quantifyZonkedTyVars gbl_tvs (DV { dv_kvs = dep_tkvs, dv_tvs = nondep_tkvs }) } -quantifyZonkedTyVars gbl_tvs (DV{ dv_kvs = dep_tkvs, dv_tvs = nondep_tkvs }) - = do { let all_cvs = filterVarSet isCoVar $ dVarSetToVarSet dep_tkvs +quantifyZonkedTyVars gbl_tvs dvs@(DV{ dv_kvs = dep_tkvs, dv_tvs = nondep_tkvs }) + = do { traceTc "quantifyZonkedTyVars" (vcat [ppr dvs, ppr gbl_tvs]) + ; let all_cvs = filterVarSet isCoVar $ dVarSetToVarSet dep_tkvs dep_kvs = dVarSetElemsWellScoped $ dep_tkvs `dVarSetMinusVarSet` gbl_tvs `dVarSetMinusVarSet` closeOverKinds all_cvs @@ -883,12 +883,17 @@ quantifyZonkedTyVars gbl_tvs (DV{ dv_kvs = dep_tkvs, dv_tvs = nondep_tkvs }) -- variables, or any any tvs that a covar depends on nondep_tvs = dVarSetElems $ - nondep_tkvs `dVarSetMinusVarSet` gbl_tvs - -- No worry about dependent covars here; they are - -- all in dep_tkvs + (nondep_tkvs `minusDVarSet` dep_tkvs) + `dVarSetMinusVarSet` gbl_tvs + -- See Note [Dependent type variables] in TcType + -- The `minus` dep_tkvs removes any kind-level vars + -- e.g. T k (a::k) Since k appear in a kind it'll + -- be in dv_kvs, and is dependent. So remove it from + -- dv_tvs which will also contain k + -- No worry about dependent covars here; + -- they are all in dep_tkvs -- No worry about scoping, becuase these are all -- type variables - -- See Note [Dependent type variables] in TcType -- NB kinds of tvs are zonked by zonkTyCoVarsAndFV -- In the non-PolyKinds case, default the kind variables diff --git a/compiler/typecheck/TcType.hs b/compiler/typecheck/TcType.hs index a373dc6..94ab0bc 100644 --- a/compiler/typecheck/TcType.hs +++ b/compiler/typecheck/TcType.hs @@ -214,7 +214,7 @@ import BasicTypes import Util import Bag import Maybes -import Pair +import Pair( pFst ) import Outputable import FastString import ErrUtils( Validity(..), MsgDoc, isValid ) @@ -855,12 +855,22 @@ data TcDepVars -- See Note [Dependent type variables] -- See Note [TcDepVars determinism] = DV { dv_kvs :: DTyCoVarSet -- "kind" variables (dependent) , dv_tvs :: DTyVarSet -- "type" variables (non-dependent) - -- The two are disjoint sets + -- A variable may appear in both sets + -- E.g. T k (x::k) The first occurence of k makes it + -- show up in dv_tvs, the second in dv_kvs + -- See Note [Dependent type variables] } depVarsTyVars :: TcDepVars -> DTyVarSet depVarsTyVars = dv_tvs +instance Monoid TcDepVars where + mempty = DV { dv_kvs = emptyDVarSet, dv_tvs = emptyDVarSet } + mappend (DV { dv_kvs = kv1, dv_tvs = tv1 }) + (DV { dv_kvs = kv2, dv_tvs = tv2 }) + = DV { dv_kvs = kv1 `unionDVarSet` kv2 + , dv_tvs = tv1 `unionDVarSet` tv2} + instance Outputable TcDepVars where ppr (DV {dv_kvs = kvs, dv_tvs = tvs }) = text "DV" <+> braces (sep [ text "dv_kvs =" <+> ppr kvs @@ -885,8 +895,20 @@ E.g. In the type T k (a::k) even though it also appears at "top level" of the type 'a' is a type variable, becuase it doesn't +We gather these variables using a TcDepVars record: + DV { dv_kvs: Variables free in the kind of a free type variable + or of a forall-bound type variable + , dv_tvs: Variables sytactically free in the type } + +So: dv_kvs are the kind variables of the type + (dv_tvs - dv_kvs) are the type variable of the type + Note that +* A variable can occur in both. + T k (x::k) The first occurence of k makes it + show up in dv_tvs, the second in dv_kvs + * We include any coercion variables in the "dependent", "kind-variable" set because we never quantify over them. @@ -911,43 +933,33 @@ For more information about deterministic sets see Note [Deterministic UniqFM] in UniqDFM. -} -splitDepVarsOfType :: Type -> TcDepVars --- See Note [Dependent type variables] -splitDepVarsOfType ty - = DV { dv_kvs = dep_vars - , dv_tvs = nondep_vars `minusDVarSet` dep_vars } - where - Pair dep_vars nondep_vars = split_dep_vars ty - -- | Like 'splitDepVarsOfType', but over a list of types splitDepVarsOfTypes :: [Type] -> TcDepVars --- See Note [Dependent type variables] -splitDepVarsOfTypes tys - = DV { dv_kvs = dep_vars - , dv_tvs = nondep_vars `minusDVarSet` dep_vars } - where - Pair dep_vars nondep_vars = foldMap split_dep_vars tys +splitDepVarsOfTypes = foldMap splitDepVarsOfType -- | Worker for 'splitDepVarsOfType'. This might output the same var -- in both sets, if it's used in both a type and a kind. -- See Note [TcDepVars determinism] -split_dep_vars :: Type -> Pair DTyCoVarSet -- Pair kvs tvs -split_dep_vars = go +-- See Note [Dependent type variables] +splitDepVarsOfType :: Type -> TcDepVars +splitDepVarsOfType = go where - go (TyVarTy tv) = Pair (tyCoVarsOfTypeDSet $ tyVarKind tv) - (unitDVarSet tv) + go (TyVarTy tv) = DV { dv_kvs =tyCoVarsOfTypeDSet $ tyVarKind tv + , dv_tvs = unitDVarSet tv } go (AppTy t1 t2) = go t1 `mappend` go t2 go (TyConApp _ tys) = foldMap go tys go (ForAllTy (Anon arg) res) = go arg `mappend` go res - go (ForAllTy (Named tv _) ty) - = let Pair kvs tvs = go ty in - Pair (kvs `delDVarSet` tv - `extendDVarSetList` tyCoVarsOfTypeList (tyVarKind tv)) - (tvs `delDVarSet` tv) go (LitTy {}) = mempty - go (CastTy ty co) = go ty `mappend` Pair (tyCoVarsOfCoDSet co) - emptyDVarSet - go (CoercionTy co) = Pair (tyCoVarsOfCoDSet co) emptyDVarSet + go (CastTy ty co) = go ty `mappend` go_co co + go (CoercionTy co) = go_co co + go (ForAllTy (Named tv _) ty) + = let DV { dv_kvs = kvs, dv_tvs = tvs } = go ty in + DV { dv_kvs = (kvs `delDVarSet` tv) + `extendDVarSetList` tyCoVarsOfTypeList (tyVarKind tv) + , dv_tvs = tvs `delDVarSet` tv } + + go_co co = DV { dv_kvs = tyCoVarsOfCoDSet co + , dv_tvs = emptyDVarSet } {- ************************************************************************ From git at git.haskell.org Tue May 10 09:59:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 09:59:03 +0000 (UTC) Subject: [commit: ghc] master: stg/Types.h: Fix comment and #include (3ca7806) Message-ID: <20160510095903.7CA303A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3ca78062968f7ab6efff82122101e6f91b8c2cef/ghc >--------------------------------------------------------------- commit 3ca78062968f7ab6efff82122101e6f91b8c2cef Author: Ben Gamari Date: Tue May 10 08:51:25 2016 +0200 stg/Types.h: Fix comment and #include >--------------------------------------------------------------- 3ca78062968f7ab6efff82122101e6f91b8c2cef includes/stg/Types.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/includes/stg/Types.h b/includes/stg/Types.h index 48201b1..1a61c8b 100644 --- a/includes/stg/Types.h +++ b/includes/stg/Types.h @@ -25,10 +25,12 @@ * "C++ implementations should define these macros only when * __STDC_LIMIT_MACROS is defined before is included." * - * C++11 does not require it anymore. Remove once we upgrade to C++11 or newer. + * So we need to define it for now to compile with C++ compilers. + * However, C++11 does not require it anymore so we can remove this once we + * upgrade to requiring C++11 or newer. */ #define __STDC_LIMIT_MACROS -#import +#include /* @@ -122,7 +124,7 @@ typedef int32_t StgInt; typedef uint32_t StgWord; typedef int16_t StgHalfInt; -typedef uint16_s StgHalfWord; +typedef uint16_t StgHalfWord; #define STG_INT_MIN INT32_MIN #define STG_INT_MAX INT32_MAX From git at git.haskell.org Tue May 10 09:59:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 09:59:06 +0000 (UTC) Subject: [commit: ghc] master: RdrHsSyn: Only suggest `type` qualification when appropriate (e996e85) Message-ID: <20160510095906.332BC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e996e85f003e783fc8f9af0da653cdd0058d9646/ghc >--------------------------------------------------------------- commit e996e85f003e783fc8f9af0da653cdd0058d9646 Author: Ben Gamari Date: Tue May 10 11:02:19 2016 +0200 RdrHsSyn: Only suggest `type` qualification when appropriate This suggestion only applies to operators. >--------------------------------------------------------------- e996e85f003e783fc8f9af0da653cdd0058d9646 compiler/parser/RdrHsSyn.hs | 7 ++++--- testsuite/tests/module/T11432.stderr | 4 ++-- testsuite/tests/module/T11432a.stderr | 2 +- testsuite/tests/module/T12026.stderr | 3 +-- testsuite/tests/module/mod89.stderr | 3 +-- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/compiler/parser/RdrHsSyn.hs b/compiler/parser/RdrHsSyn.hs index c3f1d53..c445bee 100644 --- a/compiler/parser/RdrHsSyn.hs +++ b/compiler/parser/RdrHsSyn.hs @@ -1406,11 +1406,12 @@ mkModuleImpExp n@(L l name) subs = nameT = if isVarNameSpace (rdrNameSpace name) then parseErrorSDoc l - (text "Expecting a type constructor but found a variable." + (text "Expecting a type constructor but found a variable," + <+> quotes (ppr name) <> text "." $$ if isSymOcc $ rdrNameOcc name then text "If" <+> quotes (ppr name) <+> text "is a type constructor" - else empty - <+> text "then enable ExplicitNamespaces and use the 'type' keyword.") + <+> text "then enable ExplicitNamespaces and use the 'type' keyword." + else empty) else return $ name mkTypeImpExp :: Located RdrName -- TcCls or Var name space diff --git a/testsuite/tests/module/T11432.stderr b/testsuite/tests/module/T11432.stderr index 9e61092..61ccc7d 100644 --- a/testsuite/tests/module/T11432.stderr +++ b/testsuite/tests/module/T11432.stderr @@ -1,4 +1,4 @@ T11432.hs:7:16: error: - Expecting a type constructor but found a variable. - If ?-.->? is a type constructor then enable ExplicitNamespaces and use the 'type' keyword. + Expecting a type constructor but found a variable, ?-.->?. + If ?-.->? is a type constructor then enable ExplicitNamespaces and use the 'type' keyword. diff --git a/testsuite/tests/module/T11432a.stderr b/testsuite/tests/module/T11432a.stderr index 2542af3..79d6525 100644 --- a/testsuite/tests/module/T11432a.stderr +++ b/testsuite/tests/module/T11432a.stderr @@ -1,4 +1,4 @@ T11432a.hs:7:17: error: - Expecting a type constructor but found a variable. + Expecting a type constructor but found a variable, ?-.->?. If ?-.->? is a type constructor then enable ExplicitNamespaces and use the 'type' keyword. diff --git a/testsuite/tests/module/T12026.stderr b/testsuite/tests/module/T12026.stderr index 38d53d7..cd93875 100644 --- a/testsuite/tests/module/T12026.stderr +++ b/testsuite/tests/module/T12026.stderr @@ -1,4 +1,3 @@ T12026.hs:3:17: error: - Expecting a type constructor but found a variable. - If ?map? is a type constructor then enable ExplicitNamespaces and use the 'type' keyword. + Expecting a type constructor but found a variable, ?map?. diff --git a/testsuite/tests/module/mod89.stderr b/testsuite/tests/module/mod89.stderr index afdc464..ef07a5a 100644 --- a/testsuite/tests/module/mod89.stderr +++ b/testsuite/tests/module/mod89.stderr @@ -1,4 +1,3 @@ mod89.hs:5:16: error: - Expecting a type constructor but found a variable. - If ?map? is a type constructor then enable ExplicitNamespaces and use the 'type' keyword. + Expecting a type constructor but found a variable, ?map?. From git at git.haskell.org Tue May 10 09:59:09 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 09:59:09 +0000 (UTC) Subject: [commit: ghc] master: Forbid variables to be parents in import lists. (53f26f5) Message-ID: <20160510095909.DC6893A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/53f26f5a45f146e1cc988bbcf76a362c877beaa2/ghc >--------------------------------------------------------------- commit 53f26f5a45f146e1cc988bbcf76a362c877beaa2 Author: Matthew Pickering Date: Tue May 10 08:41:46 2016 +0200 Forbid variables to be parents in import lists. In the long discussion on #11432, it was decided that when a type constructor is parsed as a variable ((--.->) is one example) then in order to export the type constructor then the user should be required to use the ExplicitNamespaces keyword. This was implemented in quite an indirect manner in the renamer. It is much more direct to enforce this in the parser at the expense of slighty worse error messages. Further to this, the check in the renamer was actually slightly wrong. If the variable was in scope then no error was raised, this was causing panics, see #12026 for an example. Reviewers: austin, bgamari Subscribers: davean, skvadrik, thomie Differential Revision: https://phabricator.haskell.org/D2181 GHC Trac Issues: #12026 >--------------------------------------------------------------- 53f26f5a45f146e1cc988bbcf76a362c877beaa2 compiler/parser/RdrHsSyn.hs | 18 ++++++++++++++---- compiler/rename/RnEnv.hs | 23 +---------------------- compiler/rename/RnNames.hs | 4 ++-- testsuite/tests/module/T11432.stderr | 12 +++--------- testsuite/tests/module/{T11432.hs => T11432a.hs} | 4 +++- testsuite/tests/module/T11432a.stderr | 4 ++++ testsuite/tests/module/T12026.hs | 3 +++ testsuite/tests/module/T12026.stderr | 4 ++++ testsuite/tests/module/all.T | 4 +++- testsuite/tests/module/mod89.stderr | 12 +++--------- 10 files changed, 40 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 53f26f5a45f146e1cc988bbcf76a362c877beaa2 From git at git.haskell.org Tue May 10 10:59:25 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 10:59:25 +0000 (UTC) Subject: [commit: ghc] master: Fix a crash in requestSync() (ea3d1ef) Message-ID: <20160510105925.92C763A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ea3d1efb863ca83b28af9056576d47f1abf98fa9/ghc >--------------------------------------------------------------- commit ea3d1efb863ca83b28af9056576d47f1abf98fa9 Author: Simon Marlow Date: Tue May 10 03:22:57 2016 -0700 Fix a crash in requestSync() It was possible for a thread to read invalid memory after a conflict when multiple threads were synchronising. I haven't been successful in constructing a test case that triggers this, but we have some internal code that ran into it. >--------------------------------------------------------------- ea3d1efb863ca83b28af9056576d47f1abf98fa9 rts/Schedule.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/rts/Schedule.c b/rts/Schedule.c index 8bbc9cf..d077ce2 100644 --- a/rts/Schedule.c +++ b/rts/Schedule.c @@ -1416,25 +1416,30 @@ static void stopAllCapabilities (Capability **pCap, Task *task) #if defined(THREADED_RTS) static rtsBool requestSync ( - Capability **pcap, Task *task, PendingSync *sync, + Capability **pcap, Task *task, PendingSync *new_sync, SyncType *prev_sync_type) { - PendingSync *prev_sync; + PendingSync *sync; - prev_sync = (PendingSync*)cas((StgVolatilePtr)&pending_sync, - (StgWord)NULL, - (StgWord)sync); + sync = (PendingSync*)cas((StgVolatilePtr)&pending_sync, + (StgWord)NULL, + (StgWord)new_sync); - if (prev_sync) + if (sync != NULL) { + // sync is valid until we have called yieldCapability(). + // After the sync is completed, we cannot read that struct any + // more because it has been freed. + *prev_sync_type = sync->type; do { debugTrace(DEBUG_sched, "someone else is trying to sync (%d)...", - prev_sync->type); + sync->type); ASSERT(*pcap); yieldCapability(pcap,task,rtsTrue); - } while (pending_sync); + sync = pending_sync; + } while (sync != NULL); + // NOTE: task->cap might have changed now - *prev_sync_type = prev_sync->type; return rtsTrue; } else From git at git.haskell.org Tue May 10 12:06:09 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 12:06:09 +0000 (UTC) Subject: [commit: ghc] master: Comments only (bff6e1b) Message-ID: <20160510120609.107DD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/bff6e1bbf0a9149493cba3b3c78caa57ba6071bf/ghc >--------------------------------------------------------------- commit bff6e1bbf0a9149493cba3b3c78caa57ba6071bf Author: Erik de Castro Lopo Date: Tue May 10 18:09:50 2016 +1000 Comments only [skip ci] >--------------------------------------------------------------- bff6e1bbf0a9149493cba3b3c78caa57ba6071bf mk/config.mk.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mk/config.mk.in b/mk/config.mk.in index b5d910b..6d97463 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -192,6 +192,8 @@ else ArchSupportsSMP=$(strip $(patsubst $(TargetArch_CPP), YES, $(findstring $(TargetArch_CPP), i386 x86_64 sparc powerpc powerpc64 powerpc64le aarch64))) endif +# The THREADED_RTS requites `BaseReg` to be in a register and the +# `GhcUnregisterised` mode doesn't allow that. GhcWithSMP := $(strip $(if $(filter YESNO, $(ArchSupportsSMP)$(GhcUnregisterised)),YES,NO)) # Whether to include GHCi in the compiler. Depends on whether the RTS linker From git at git.haskell.org Tue May 10 12:26:49 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 12:26:49 +0000 (UTC) Subject: [commit: ghc] master: Kill unnecessary cmpType in lhs_cmp_type (4ac0e81) Message-ID: <20160510122649.878583A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4ac0e815739f6362c2815dd3ae531055a095d6a9/ghc >--------------------------------------------------------------- commit 4ac0e815739f6362c2815dd3ae531055a095d6a9 Author: Bartosz Nitka Date: Tue May 10 05:26:06 2016 -0700 Kill unnecessary cmpType in lhs_cmp_type This is the only call site of `lhs_cmp_type` and we only care about equality. `cmpType` is nondeterministic (because `TyCon`s are compared with Uniques in `cmpTc`), so if we don't have to use it, it's better not to. Test Plan: ./validate Reviewers: simonmar, goldfire, bgamari, austin, simonpj Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2172 GHC Trac Issues: #4012 >--------------------------------------------------------------- 4ac0e815739f6362c2815dd3ae531055a095d6a9 compiler/typecheck/TcErrors.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/compiler/typecheck/TcErrors.hs b/compiler/typecheck/TcErrors.hs index 78320c4..d9ba069 100644 --- a/compiler/typecheck/TcErrors.hs +++ b/compiler/typecheck/TcErrors.hs @@ -529,9 +529,9 @@ mkSkolReporter ctxt cts (yeses, noes) = partition (group_with ct) cts group_with ct1 ct2 - | EQ <- cmp_loc ct1 ct2 = True - | EQ <- cmp_lhs_type ct1 ct2 = True - | otherwise = False + | EQ <- cmp_loc ct1 ct2 = True + | eq_lhs_type ct1 ct2 = True + | otherwise = False mkHoleReporter :: Reporter -- Reports errors one at a time @@ -563,11 +563,11 @@ mkGroupReporter mk_err ctxt cts = mapM_ (reportGroup mk_err ctxt) (equivClasses cmp_loc cts) where -cmp_lhs_type :: Ct -> Ct -> Ordering -cmp_lhs_type ct1 ct2 +eq_lhs_type :: Ct -> Ct -> Bool +eq_lhs_type ct1 ct2 = case (classifyPredType (ctPred ct1), classifyPredType (ctPred ct2)) of (EqPred eq_rel1 ty1 _, EqPred eq_rel2 ty2 _) -> - (eq_rel1 `compare` eq_rel2) `thenCmp` (ty1 `cmpType` ty2) + (eq_rel1 == eq_rel2) && (ty1 `eqType` ty2) _ -> pprPanic "mkSkolReporter" (ppr ct1 $$ ppr ct2) cmp_loc :: Ct -> Ct -> Ordering From git at git.haskell.org Tue May 10 12:31:20 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 12:31:20 +0000 (UTC) Subject: [commit: ghc] master: Make simplifyInstanceContexts deterministic (b58b0e1) Message-ID: <20160510123120.DF1CC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b58b0e18a568bbf6381a85eea7adc72679355671/ghc >--------------------------------------------------------------- commit b58b0e18a568bbf6381a85eea7adc72679355671 Author: Bartosz Nitka Date: Tue May 10 05:32:28 2016 -0700 Make simplifyInstanceContexts deterministic simplifyInstanceContexts used cmpType which is nondeterministic for canonicalising typeclass constraints in derived instances. Following changes make it deterministic as explained by the Note [Deterministic simplifyInstanceContexts]. Test Plan: ./validate Reviewers: simonmar, goldfire, simonpj, austin, bgamari Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2173 GHC Trac Issues: #4012 >--------------------------------------------------------------- b58b0e18a568bbf6381a85eea7adc72679355671 compiler/basicTypes/Unique.hs | 15 ++++++++------- compiler/basicTypes/Var.hs | 14 ++++++++++++-- compiler/typecheck/TcDeriv.hs | 31 ++++++++++++++++++++++++++++--- compiler/types/Type.hs | 16 ++++++++++++++-- 4 files changed, 62 insertions(+), 14 deletions(-) diff --git a/compiler/basicTypes/Unique.hs b/compiler/basicTypes/Unique.hs index ca74373..eddf265 100644 --- a/compiler/basicTypes/Unique.hs +++ b/compiler/basicTypes/Unique.hs @@ -23,7 +23,7 @@ module Unique ( Unique, Uniquable(..), -- ** Constructors, destructors and operations on 'Unique's - hasKey, cmpByUnique, + hasKey, pprUnique, @@ -35,6 +35,7 @@ module Unique ( deriveUnique, -- Ditto newTagUnique, -- Used in CgCase initTyVarUnique, + nonDetCmpUnique, -- ** Making built-in uniques @@ -168,9 +169,6 @@ instance Uniquable FastString where instance Uniquable Int where getUnique i = mkUniqueGrimily i -cmpByUnique :: Uniquable a => a -> a -> Ordering -cmpByUnique x y = (getUnique x) `cmpUnique` (getUnique y) - {- ************************************************************************ * * @@ -204,8 +202,11 @@ eqUnique (MkUnique u1) (MkUnique u2) = u1 == u2 ltUnique (MkUnique u1) (MkUnique u2) = u1 < u2 leUnique (MkUnique u1) (MkUnique u2) = u1 <= u2 -cmpUnique :: Unique -> Unique -> Ordering -cmpUnique (MkUnique u1) (MkUnique u2) +-- Provided here to make it explicit at the call-site that it can +-- introduce non-determinism. +-- See Note [Unique Determinism] +nonDetCmpUnique :: Unique -> Unique -> Ordering +nonDetCmpUnique (MkUnique u1) (MkUnique u2) = if u1 == u2 then EQ else if u1 < u2 then LT else GT instance Eq Unique where @@ -217,7 +218,7 @@ instance Ord Unique where a <= b = leUnique a b a > b = not (leUnique a b) a >= b = not (ltUnique a b) - compare a b = cmpUnique a b + compare a b = nonDetCmpUnique a b ----------------- instance Uniquable Unique where diff --git a/compiler/basicTypes/Var.hs b/compiler/basicTypes/Var.hs index e641976..0af961e 100644 --- a/compiler/basicTypes/Var.hs +++ b/compiler/basicTypes/Var.hs @@ -64,7 +64,9 @@ module Var ( -- ** Modifying 'TyVar's setTyVarName, setTyVarUnique, setTyVarKind, updateTyVarKind, - updateTyVarKindM + updateTyVarKindM, + + nonDetCmpVar ) where @@ -80,6 +82,7 @@ import Util import DynFlags import Outputable +import Unique (nonDetCmpUnique) import Data.Data {- @@ -269,7 +272,14 @@ instance Ord Var where a < b = realUnique a < realUnique b a >= b = realUnique a >= realUnique b a > b = realUnique a > realUnique b - a `compare` b = varUnique a `compare` varUnique b + a `compare` b = a `nonDetCmpVar` b + +-- | Compare Vars by their Uniques. +-- This is what Ord Var does, provided here to make it explicit at the +-- call-site that it can introduce non-determinism. +-- See Note [Unique Determinism] +nonDetCmpVar :: Var -> Var -> Ordering +nonDetCmpVar a b = varUnique a `nonDetCmpUnique` varUnique b instance Data Var where -- don't traverse? diff --git a/compiler/typecheck/TcDeriv.hs b/compiler/typecheck/TcDeriv.hs index 06f87a3..7cc034c 100644 --- a/compiler/typecheck/TcDeriv.hs +++ b/compiler/typecheck/TcDeriv.hs @@ -1862,6 +1862,29 @@ this by simplifying the RHS to a form in which - the list is sorted by tyvar (major key) and then class (minor key) - no duplicates, of course +Note [Deterministic simplifyInstanceContexts] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Canonicalisation uses cmpType which is nondeterministic. Sorting +with cmpType puts the returned lists in a nondeterministic order. +If we were to return them, we'd get class constraints in +nondeterministic order. + +Consider: + + data ADT a b = Z a b deriving Eq + +The generated code could be either: + + instance (Eq a, Eq b) => Eq (Z a b) where + +Or: + + instance (Eq b, Eq a) => Eq (Z a b) where + +To prevent the order from being nondeterministic we only +canonicalize when comparing and return them in the same order as +simplifyDeriv returned them. +See also Note [cmpType nondeterminism] -} @@ -1909,8 +1932,10 @@ simplifyInstanceContexts infer_specs else iterate_deriv (n+1) new_solns } - eqSolution = eqListBy (eqListBy eqType) - + eqSolution a b = eqListBy (eqListBy eqType) (canSolution a) (canSolution b) + -- Canonicalise for comparison + -- See Note [Deterministic simplifyInstanceContexts] + canSolution = map (sortBy cmpType) ------------------------------------------------------------------ gen_soln :: DerivSpec ThetaOrigin -> TcM ThetaType gen_soln (DS { ds_loc = loc, ds_tvs = tyvars @@ -1925,7 +1950,7 @@ simplifyInstanceContexts infer_specs -- Claim: the result instance declaration is guaranteed valid -- Hence no need to call: -- checkValidInstance tyvars theta clas inst_tys - ; return (sortBy cmpType theta) } -- Canonicalise before returning the solution + ; return theta } where the_pred = mkClassPred clas inst_tys diff --git a/compiler/types/Type.hs b/compiler/types/Type.hs index 49c7267..124015f 100644 --- a/compiler/types/Type.hs +++ b/compiler/types/Type.hs @@ -223,6 +223,7 @@ import FastString import Pair import ListSetOps import Digraph +import Unique ( nonDetCmpUnique ) import Maybes ( orElse ) import Data.Maybe ( isJust, mapMaybe ) @@ -2086,6 +2087,16 @@ eqVarBndrs _ _ _= Nothing -- Now here comes the real worker +{- +Note [cmpType nondeterminism] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +cmpType is implemented in terms of cmpTypeX. cmpTypeX uses cmpTc which +compares TyCons by their Unique value. Using Uniques for ordering leads +to nondeterminism. We hit the same problem in the TyVarTy case, comparing +type variables is nondeterministic, note the call to nonDetCmpVar in cmpTypeX. +See Note [Unique Determinism] for more details. +-} + cmpType :: Type -> Type -> Ordering cmpType t1 t2 -- we know k1 and k2 have the same kind, because they both have kind *. @@ -2148,7 +2159,7 @@ cmpTypeX env orig_t1 orig_t2 = | Just t2' <- coreViewOneStarKind t2 = go env t1 t2' go env (TyVarTy tv1) (TyVarTy tv2) - = liftOrdering $ rnOccL env tv1 `compare` rnOccR env tv2 + = liftOrdering $ rnOccL env tv1 `nonDetCmpVar` rnOccR env tv2 go env (ForAllTy (Named tv1 _) t1) (ForAllTy (Named tv2 _) t2) = go env (tyVarKind tv1) (tyVarKind tv2) `thenCmpTy` go (rnBndr2 env tv1 tv2) t1 t2 @@ -2200,10 +2211,11 @@ cmpTypesX _ _ [] = GT -- | Compare two 'TyCon's. NB: This should /never/ see the "star synonyms", -- as recognized by Kind.isStarKindSynonymTyCon. See Note -- [Kind Constraint and kind *] in Kind. +-- See Note [cmpType nondeterminism] cmpTc :: TyCon -> TyCon -> Ordering cmpTc tc1 tc2 = ASSERT( not (isStarKindSynonymTyCon tc1) && not (isStarKindSynonymTyCon tc2) ) - u1 `compare` u2 + u1 `nonDetCmpUnique` u2 where u1 = tyConUnique tc1 u2 = tyConUnique tc2 From git at git.haskell.org Tue May 10 13:05:07 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 13:05:07 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: users-guide: Document (9cb4ce6) Message-ID: <20160510130507.148903A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/9cb4ce637e525344182c99b63b216aa7a294e5c5/ghc >--------------------------------------------------------------- commit 9cb4ce637e525344182c99b63b216aa7a294e5c5 Author: Ben Gamari Date: Sat May 7 09:16:28 2016 +0200 users-guide: Document >--------------------------------------------------------------- 9cb4ce637e525344182c99b63b216aa7a294e5c5 docs/users_guide/8.0.1-notes.rst | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/users_guide/8.0.1-notes.rst b/docs/users_guide/8.0.1-notes.rst index 58f13c3..4ab5b20 100644 --- a/docs/users_guide/8.0.1-notes.rst +++ b/docs/users_guide/8.0.1-notes.rst @@ -699,12 +699,13 @@ ghc-prim haskell98 ~~~~~~~~~ -- Version number XXXXX (was 2.0.0.3) +- No longer shipped haskell2010 ~~~~~~~~~~~ -- Version number XXXXX (was 1.1.1.1) +- No longer shipped. We hope that this package or something like it will be + restored in a future GHC release. hoopl ~~~~~ @@ -722,14 +723,14 @@ integer-gmp - Version number 1.0.0.1 (was 0.5.1.0) old-locale -~~~~~~~~~~ +---------- -- Version number XXXXX (was 1.0.0.6) +- No longer shipped old-time ~~~~~~~~ -- Version number XXXXX (was 1.1.0.2) +- No longer shipped process ~~~~~~~ From git at git.haskell.org Tue May 10 13:05:09 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 13:05:09 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: users-guide/relnotes: Document -Weverything and -Wdefault (0e11297) Message-ID: <20160510130509.B5DA23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/0e11297ec1b125eafa22368e4a4449f48569db9b/ghc >--------------------------------------------------------------- commit 0e11297ec1b125eafa22368e4a4449f48569db9b Author: Ben Gamari Date: Sat May 7 09:29:41 2016 +0200 users-guide/relnotes: Document -Weverything and -Wdefault >--------------------------------------------------------------- 0e11297ec1b125eafa22368e4a4449f48569db9b docs/users_guide/8.0.1-notes.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/users_guide/8.0.1-notes.rst b/docs/users_guide/8.0.1-notes.rst index 4ab5b20..35da123 100644 --- a/docs/users_guide/8.0.1-notes.rst +++ b/docs/users_guide/8.0.1-notes.rst @@ -297,6 +297,16 @@ Compiler - When printing an out-of-scope error message, GHC will give helpful advice if the error might be caused by too restrictive imports. +- Added the :ghc-flag:`-Weverything` warning group, along with its opposite + :ghc-flag:`-Wno-everything`. This group includes all warnings supported by + GHC. This is in contrast to `-Wall` which excludes some stylistic or + otherwise controversial warnings. + +- Added the :ghc-flag:`-Wdefault` warning group, along with its opposite + :ghc-flag:`-Wno-default`. This group is defined to be the set of warnings + which ``ghc`` enables by default (e.g. when no additional ``-W`` flags are + used). + - Added the :ghc-flag:`-Wcompat` warning group, along with its opposite :ghc-flag:`-Wno-compat`. Turns on warnings that will be enabled by default in the future, but remain off in normal compilations for the time being. This From git at git.haskell.org Tue May 10 13:05:12 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 13:05:12 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: base: Add release date to changelog (3d4fa5b) Message-ID: <20160510130512.716283A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/3d4fa5b3dc7d4fda88615769758b16e0cb122671/ghc >--------------------------------------------------------------- commit 3d4fa5b3dc7d4fda88615769758b16e0cb122671 Author: Ben Gamari Date: Sat May 7 09:30:20 2016 +0200 base: Add release date to changelog >--------------------------------------------------------------- 3d4fa5b3dc7d4fda88615769758b16e0cb122671 libraries/base/changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index f935c59..4205efb 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -1,6 +1,6 @@ # Changelog for [`base` package](http://hackage.haskell.org/package/base) -## 4.9.0.0 *TBA* +## 4.9.0.0 *May 2016* * Bundled with GHC 8.0 From git at git.haskell.org Tue May 10 13:05:15 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 13:05:15 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: relnotes: Note portability improvements (89a0be3) Message-ID: <20160510130515.1FDFD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/89a0be3052763bda5ec127cf62820ca8f4679b47/ghc >--------------------------------------------------------------- commit 89a0be3052763bda5ec127cf62820ca8f4679b47 Author: Ben Gamari Date: Sat May 7 10:43:19 2016 +0200 relnotes: Note portability improvements >--------------------------------------------------------------- 89a0be3052763bda5ec127cf62820ca8f4679b47 docs/users_guide/8.0.1-notes.rst | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/users_guide/8.0.1-notes.rst b/docs/users_guide/8.0.1-notes.rst index 35da123..5fdb328 100644 --- a/docs/users_guide/8.0.1-notes.rst +++ b/docs/users_guide/8.0.1-notes.rst @@ -29,7 +29,7 @@ performance improvements over the 7.10 branch. Highlights ---------- -The highlights, since the 7.10 branch, are: +The highlights, since the 7.10 series, are: - The new :ghc-flag:`-XTypeInType` allows promotion of all types into kinds, allowing kind synonyms, kind families, promoted GADTs, and other @@ -69,7 +69,8 @@ The highlights, since the 7.10 branch, are: :ghc-flag:`-fexternal-interpreter` and :ghc-flag:`-prof` (see :ref:`ghci-stack-traces`). -- A native code generator for powerpc64 and powerpc64le architectures +- A native code generator for powerpc64 and powerpc64le architectures, support + for AIX targets, and significantly improved support on ARM. - The reworked users guide you are now reading @@ -502,9 +503,12 @@ Runtime system - The runtime linker is no longer greedy and will load only the needed objects from archives. This means particularly on Windows packages requiring e.g. C99 support will now function properly. As part of this the RTS on Windows - no longer re-exports deprecated posix functions under the undeprecated names + no longer re-exports deprecated POSIX functions under the undeprecated names (see :ghc-ticket:`11223`). +- A number of subtle but serious issues in the runtime linker were resolved on + ARM (summarized in :ghc-ticket:`11206`). + Build system ~~~~~~~~~~~~ From git at git.haskell.org Tue May 10 13:05:17 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 13:05:17 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: rel-notes: Group together warning-related items, add (91222fc) Message-ID: <20160510130517.BE4643A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/91222fc3ccce791637267f3aa26f30180c54f35e/ghc >--------------------------------------------------------------- commit 91222fc3ccce791637267f3aa26f30180c54f35e Author: Ben Gamari Date: Sat May 7 10:55:31 2016 +0200 rel-notes: Group together warning-related items, add Mention -fshow-warning-groups, etc. >--------------------------------------------------------------- 91222fc3ccce791637267f3aa26f30180c54f35e docs/users_guide/8.0.1-notes.rst | 105 +++++++++++++++++++++------------------ 1 file changed, 57 insertions(+), 48 deletions(-) diff --git a/docs/users_guide/8.0.1-notes.rst b/docs/users_guide/8.0.1-notes.rst index 5fdb328..b2131ec 100644 --- a/docs/users_guide/8.0.1-notes.rst +++ b/docs/users_guide/8.0.1-notes.rst @@ -262,13 +262,6 @@ Compiler code that does not exist in the .hs file and a comment for the splice location in the original file. -- After a long hiatus (see :ghc-ticket:`10935`) the - :ghc-flag:`-Wmonomorphism-restriction` (formerly - :ghc-flag:`-fwarn-monomorphism-restriction`) flag has returned. - The functionality of this flag was inadvertently removed by a commit in 2010; - this has been fixed and the flag should now issue warnings as it - previously did. - - Added the option :ghc-flag:`-fprint-expanded-types`. When enabled, GHC also prints type-synonym-expanded types in type errors. @@ -283,21 +276,47 @@ Compiler Enabling :ghc-flag:`-fworker-wrapper` while strictness analysis is disabled (by :ghc-flag:`-fno-strictness`) has no effect. -- Added the options :ghc-flag:`-Wmissed-specialisations` and - :ghc-flag:`-Wall-missed-specialisations`. When enabled, the simplifier will - produce a warning when a overloaded imported function cannot be - specialised (typically due to a missing ``INLINEABLE`` pragma). This - is intended to alert users to cases where they apply ``INLINEABLE`` but - may not get the speed-up they expect. +- :ghc-flag:`-ddump-strsigs` has been renamed to + :ghc-flag:`-ddump-str-signatures`. -- Added the option :ghc-flag:`-Wnoncanonical-monad-instances` and - :ghc-flag:`-Wnoncanonical-monadfail-instances` which help detect noncanonical - ``Applicative``/``Monad``/``MonadFail`` instance definitions. - See flag description in :ref:`options-sanity` for more details. +- :ghc-flag:`-XDeriveGeneric` is now less picky about instantiating type + arguments when deriving (:ghc-ticket:`11732`). As a consequence, the + following code is now legal (whereas before it would have been rejected). :: + + data T a b = T a b + deriving instance Generic (T Int b) + +- Added the :ghc-flag:`-fmax-pmcheck-iterations` to control how many times + the pattern match checker iterates. Since coverage checking is exponential + in the general case, setting a default number of iterations prevents memory + and performance blowups. By default, the number of iterations is set to + 2000000 but it can be set with: ``-fmax-pmcheck-iterations=``. + If the set number of iterations is exceeded, an informative warning is + issued. + +- :ghc-flag:`-this-package-key` has been renamed again (hopefully for the last time!) + to :ghc-flag:`-this-unit-id`. The renaming was motivated by the fact that + the identifier you pass to GHC here doesn't have much to do with packages: + you may provide different unit IDs for libraries which are in the same + package. :ghc-flag:`-this-package-key` is deprecated; you should use + :ghc-flag:`-this-unit-id` or, if you need compatibility over multiple + versions of GHC, :ghc-flag:`-package-name`. + +- When :ghc-flag:`-fdefer-type-errors` is enabled and an expression fails to + typecheck, ``Control.Exception.TypeError`` will now be thrown instead of + ``Control.Exception.ErrorCall``. + +Warnings +^^^^^^^^ - When printing an out-of-scope error message, GHC will give helpful advice if the error might be caused by too restrictive imports. +- Warning messages now mention the name of the warning flag which the message is + controlled by (:ghc-ticket:`10752`) If the flag was implied via a warning + group then the name of the group will also be shown if + :ghc-flag:`-fshow-warning-groups` is used. + - Added the :ghc-flag:`-Weverything` warning group, along with its opposite :ghc-flag:`-Wno-everything`. This group includes all warnings supported by GHC. This is in contrast to `-Wall` which excludes some stylistic or @@ -308,7 +327,7 @@ Compiler which ``ghc`` enables by default (e.g. when no additional ``-W`` flags are used). -- Added the :ghc-flag:`-Wcompat` warning group, along with its opposite +- Added the :ghc-flag:`-Wcompat` warning group (:ghc-ticket:`11000`), along with its opposite :ghc-flag:`-Wno-compat`. Turns on warnings that will be enabled by default in the future, but remain off in normal compilations for the time being. This allows library authors eager to make their code future compatible to adapt @@ -326,6 +345,26 @@ Compiler warnings makes sure the definition of ``Semigroup`` as a superclass of ``Monoid`` does not break any code. +- After a long hiatus (see :ghc-ticket:`10935`) the + :ghc-flag:`-Wmonomorphism-restriction` (formerly + :ghc-flag:`-fwarn-monomorphism-restriction`) flag has returned. + The functionality of this flag was inadvertently removed by a commit in 2010; + this has been fixed and the flag should now issue warnings as it + previously did. + +- Added the options :ghc-flag:`-Wmissed-specialisations` and + :ghc-flag:`-Wall-missed-specialisations`. When enabled, the simplifier will + produce a warning when a overloaded imported function cannot be + specialised (typically due to a missing ``INLINEABLE`` pragma). This + is intended to alert users to cases where they apply ``INLINEABLE`` but + may not get the speed-up they expect. + +- Added the option :ghc-flag:`-Wnoncanonical-monad-instances` and + :ghc-flag:`-Wnoncanonical-monadfail-instances` which help detect noncanonical + ``Applicative``/``Monad``/``MonadFail`` instance definitions. + See flag description in :ref:`options-sanity` for more details. + + - Added the :ghc-flag:`-Wmissing-pattern-synonym-signatures` flag. When enabled, this will issue a warning when a pattern synonym definition doesn't have a type signature. It is turned off @@ -346,42 +385,12 @@ Compiler warns in the case of unused term-level patterns. Both flags are implied by :ghc-flag:`-W`. -- Added the :ghc-flag:`-fmax-pmcheck-iterations` to control how many times - the pattern match checker iterates. Since coverage checking is exponential - in the general case, setting a default number of iterations prevents memory - and performance blowups. By default, the number of iterations is set to - 2000000 but it can be set with: ``-fmax-pmcheck-iterations=``. - If the set number of iterations is exceeded, an informative warning is - issued. - -- :ghc-flag:`-this-package-key` has been renamed again (hopefully for the last time!) - to :ghc-flag:`-this-unit-id`. The renaming was motivated by the fact that - the identifier you pass to GHC here doesn't have much to do with packages: - you may provide different unit IDs for libraries which are in the same - package. :ghc-flag:`-this-package-key` is deprecated; you should use - :ghc-flag:`-this-unit-id` or, if you need compatibility over multiple - versions of GHC, :ghc-flag:`-package-name`. - -- When :ghc-flag:`-fdefer-type-errors` is enabled and an expression fails to - typecheck, ``Control.Exception.TypeError`` will now be thrown instead of - ``Control.Exception.ErrorCall``. - - :ghc-flag:`-Wmissing-local-sigs` is now deprecated in favor of :ghc-flag:`-Wmissing-local-signatures`. - :ghc-flag:`-Wmissing-exported-sigs` is now deprecated in favor of :ghc-flag:`-Wmissing-exported-signatures`. -- :ghc-flag:`-ddump-strsigs` has been renamed to - :ghc-flag:`-ddump-str-signatures`. - -- :ghc-flag:`-XDeriveGeneric` is now less picky about instantiating type - arguments when deriving (:ghc-ticket:`11732`). As a consequence, the - following code is now legal (whereas before it would have been rejected). :: - - data T a b = T a b - deriving instance Generic (T Int b) - GHCi ~~~~ From git at git.haskell.org Tue May 10 13:05:21 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 13:05:21 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Forbid variables to be parents in import lists. (638c1d4) Message-ID: <20160510130521.6C79D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/638c1d43b6f7258a5f1936482f11d30b6b089c1d/ghc >--------------------------------------------------------------- commit 638c1d43b6f7258a5f1936482f11d30b6b089c1d Author: Matthew Pickering Date: Tue May 10 08:41:46 2016 +0200 Forbid variables to be parents in import lists. In the long discussion on #11432, it was decided that when a type constructor is parsed as a variable ((--.->) is one example) then in order to export the type constructor then the user should be required to use the ExplicitNamespaces keyword. This was implemented in quite an indirect manner in the renamer. It is much more direct to enforce this in the parser at the expense of slighty worse error messages. Further to this, the check in the renamer was actually slightly wrong. If the variable was in scope then no error was raised, this was causing panics, see #12026 for an example. Reviewers: austin, bgamari Subscribers: davean, skvadrik, thomie Differential Revision: https://phabricator.haskell.org/D2181 GHC Trac Issues: #12026 >--------------------------------------------------------------- 638c1d43b6f7258a5f1936482f11d30b6b089c1d compiler/parser/RdrHsSyn.hs | 18 ++++++++++++++---- compiler/rename/RnEnv.hs | 23 +---------------------- compiler/rename/RnNames.hs | 4 ++-- testsuite/tests/module/T11432.stderr | 12 +++--------- testsuite/tests/module/{T11432.hs => T11432a.hs} | 4 +++- testsuite/tests/module/T11432a.stderr | 4 ++++ testsuite/tests/module/T12026.hs | 3 +++ testsuite/tests/module/T12026.stderr | 4 ++++ testsuite/tests/module/all.T | 4 +++- testsuite/tests/module/mod89.stderr | 12 +++--------- 10 files changed, 40 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 638c1d43b6f7258a5f1936482f11d30b6b089c1d From git at git.haskell.org Tue May 10 13:05:24 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 13:05:24 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: RdrHsSyn: Only suggest `type` qualification when appropriate (d7cd313) Message-ID: <20160510130524.1661B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/d7cd313171c2669ddfdcf72faace23bacf79d320/ghc >--------------------------------------------------------------- commit d7cd313171c2669ddfdcf72faace23bacf79d320 Author: Ben Gamari Date: Tue May 10 11:02:19 2016 +0200 RdrHsSyn: Only suggest `type` qualification when appropriate This suggestion only applies to operators. >--------------------------------------------------------------- d7cd313171c2669ddfdcf72faace23bacf79d320 compiler/parser/RdrHsSyn.hs | 7 ++++--- testsuite/tests/module/T11432.stderr | 4 ++-- testsuite/tests/module/T11432a.stderr | 2 +- testsuite/tests/module/T12026.stderr | 3 +-- testsuite/tests/module/mod89.stderr | 3 +-- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/compiler/parser/RdrHsSyn.hs b/compiler/parser/RdrHsSyn.hs index 35b82a2..3ed972e 100644 --- a/compiler/parser/RdrHsSyn.hs +++ b/compiler/parser/RdrHsSyn.hs @@ -1410,11 +1410,12 @@ mkModuleImpExp n@(L l name) subs = nameT = if isVarNameSpace (rdrNameSpace name) then parseErrorSDoc l - (text "Expecting a type constructor but found a variable." + (text "Expecting a type constructor but found a variable," + <+> quotes (ppr name) <> text "." $$ if isSymOcc $ rdrNameOcc name then text "If" <+> quotes (ppr name) <+> text "is a type constructor" - else empty - <+> text "then enable ExplicitNamespaces and use the 'type' keyword.") + <+> text "then enable ExplicitNamespaces and use the 'type' keyword." + else empty) else return $ name mkTypeImpExp :: Located RdrName -- TcCls or Var name space diff --git a/testsuite/tests/module/T11432.stderr b/testsuite/tests/module/T11432.stderr index 9e61092..61ccc7d 100644 --- a/testsuite/tests/module/T11432.stderr +++ b/testsuite/tests/module/T11432.stderr @@ -1,4 +1,4 @@ T11432.hs:7:16: error: - Expecting a type constructor but found a variable. - If ?-.->? is a type constructor then enable ExplicitNamespaces and use the 'type' keyword. + Expecting a type constructor but found a variable, ?-.->?. + If ?-.->? is a type constructor then enable ExplicitNamespaces and use the 'type' keyword. diff --git a/testsuite/tests/module/T11432a.stderr b/testsuite/tests/module/T11432a.stderr index 2542af3..79d6525 100644 --- a/testsuite/tests/module/T11432a.stderr +++ b/testsuite/tests/module/T11432a.stderr @@ -1,4 +1,4 @@ T11432a.hs:7:17: error: - Expecting a type constructor but found a variable. + Expecting a type constructor but found a variable, ?-.->?. If ?-.->? is a type constructor then enable ExplicitNamespaces and use the 'type' keyword. diff --git a/testsuite/tests/module/T12026.stderr b/testsuite/tests/module/T12026.stderr index 38d53d7..cd93875 100644 --- a/testsuite/tests/module/T12026.stderr +++ b/testsuite/tests/module/T12026.stderr @@ -1,4 +1,3 @@ T12026.hs:3:17: error: - Expecting a type constructor but found a variable. - If ?map? is a type constructor then enable ExplicitNamespaces and use the 'type' keyword. + Expecting a type constructor but found a variable, ?map?. diff --git a/testsuite/tests/module/mod89.stderr b/testsuite/tests/module/mod89.stderr index afdc464..ef07a5a 100644 --- a/testsuite/tests/module/mod89.stderr +++ b/testsuite/tests/module/mod89.stderr @@ -1,4 +1,3 @@ mod89.hs:5:16: error: - Expecting a type constructor but found a variable. - If ?map? is a type constructor then enable ExplicitNamespaces and use the 'type' keyword. + Expecting a type constructor but found a variable, ?map?. From git at git.haskell.org Tue May 10 13:21:59 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 13:21:59 +0000 (UTC) Subject: [commit: ghc] master: Add Outputable ShowHowMuch (e7e5939) Message-ID: <20160510132159.BB97F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e7e5939d80f05cfc52e98af50d0e0227aeee826d/ghc >--------------------------------------------------------------- commit e7e5939d80f05cfc52e98af50d0e0227aeee826d Author: Simon Peyton Jones Date: Mon May 9 09:46:27 2016 +0100 Add Outputable ShowHowMuch I needed this instance when debugging, so I thought I'd add it permanently. >--------------------------------------------------------------- e7e5939d80f05cfc52e98af50d0e0227aeee826d compiler/iface/IfaceSyn.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/compiler/iface/IfaceSyn.hs b/compiler/iface/IfaceSyn.hs index de582bf..a95d8c9 100644 --- a/compiler/iface/IfaceSyn.hs +++ b/compiler/iface/IfaceSyn.hs @@ -565,6 +565,11 @@ data ShowHowMuch -- May 14: the list is max 1 element long at the moment | ShowIface -- Everything including GHC-internal information (used in --show-iface) +instance Outputable ShowHowMuch where + ppr ShowHeader = text "ShowHeader" + ppr ShowIface = text "ShowIface" + ppr (ShowSome occs) = text "ShowSome" <+> ppr occs + showAll :: ShowSub showAll = ShowSub { ss_how_much = ShowIface, ss_ppr_bndr = ppr } From git at git.haskell.org Tue May 10 13:22:02 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 13:22:02 +0000 (UTC) Subject: [commit: ghc] master: Comments about static forms (a4717f5) Message-ID: <20160510132202.70BF43A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a4717f51433d16e948d102477564e257cdece475/ghc >--------------------------------------------------------------- commit a4717f51433d16e948d102477564e257cdece475 Author: Simon Peyton Jones Date: Fri May 6 09:49:46 2016 +0100 Comments about static forms >--------------------------------------------------------------- a4717f51433d16e948d102477564e257cdece475 compiler/coreSyn/CoreLint.hs | 28 ++++++++++++++----- compiler/main/StaticPtrTable.hs | 2 ++ compiler/main/TidyPgm.hs | 7 +++-- compiler/simplCore/SimplCore.hs | 62 +++++++++++++++++++++++++---------------- 4 files changed, 66 insertions(+), 33 deletions(-) diff --git a/compiler/coreSyn/CoreLint.hs b/compiler/coreSyn/CoreLint.hs index b3cec5f..2a2284b 100644 --- a/compiler/coreSyn/CoreLint.hs +++ b/compiler/coreSyn/CoreLint.hs @@ -1636,18 +1636,32 @@ top-level ones. See Note [Exported LocalIds] and Trac #9857. Note [Checking StaticPtrs] ~~~~~~~~~~~~~~~~~~~~~~~~~~ +See SimplCore Note [Grand plan for static forms] for an overview. -Every occurrence of the data constructor @StaticPtr@ should be moved to the top -level by the FloatOut pass. The linter is checking that no occurrence is left -nested within an expression. +Every occurrence of the data constructor @StaticPtr@ should be moved +to the top level by the FloatOut pass. It's vital that we don't have +nested StaticPtr uses after CorePrep, because we populate the Static +Pointer Table from the top-level bindings. See SimplCore Note [Grand +plan for static forms]. -The check is enabled only if the module uses the StaticPointers language -extension. This optimization arose from the need to compile "GHC.StaticPtr", -which otherwise would be rejected because the following binding +The linter checks that no occurrence is left behind, nested within an +expression. The check is enabled only: + +* After the FloatOut, CorePrep, and CoreTidy passes. + We could check more often, but the condition doesn't hold until + after the first FloatOut pass. + +* When the module uses the StaticPointers language extension. This is + a little hack. This optimization arose from the need to compile + GHC.StaticPtr, which otherwise would be rejected because of the + following binding for the StaticPtr data constructor itself: StaticPtr = \a b1 b2 b3 b4 -> StaticPtr a b1 b2 b3 b4 -contains an application of `StaticPtr` nested within the lambda abstractions. + which contains an application of `StaticPtr` nested within the + lambda abstractions. This binding is injected by CorePrep. + + Note that GHC.StaticPtr is itself compiled without -XStaticPointers. Note [Type substitution] ~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/compiler/main/StaticPtrTable.hs b/compiler/main/StaticPtrTable.hs index c13bcd8..9ec970f 100644 --- a/compiler/main/StaticPtrTable.hs +++ b/compiler/main/StaticPtrTable.hs @@ -48,6 +48,8 @@ {-# LANGUAGE ViewPatterns #-} module StaticPtrTable (sptModuleInitCode) where +-- See SimplCore Note [Grand plan for static forms] + import CLabel import CoreSyn import DataCon diff --git a/compiler/main/TidyPgm.hs b/compiler/main/TidyPgm.hs index 945e3f8..401f939 100644 --- a/compiler/main/TidyPgm.hs +++ b/compiler/main/TidyPgm.hs @@ -375,7 +375,10 @@ tidyProgram hsc_env (ModGuts { mg_module = mod -- See Note [Injecting implicit bindings] ; all_tidy_binds = implicit_binds ++ tidy_binds - -- get the TyCons to generate code for. Careful! We must use + -- See SimplCore Note [Grand plan for static forms] + ; spt_init_code = sptModuleInitCode mod all_tidy_binds + + -- Get the TyCons to generate code for. Careful! We must use -- the untidied TypeEnv here, because we need -- (a) implicit TyCons arising from types and classes defined -- in this module @@ -409,7 +412,7 @@ tidyProgram hsc_env (ModGuts { mg_module = mod cg_tycons = alg_tycons, cg_binds = all_tidy_binds, cg_foreign = foreign_stubs `appendStubC` - sptModuleInitCode mod all_tidy_binds, + spt_init_code, cg_dep_pkgs = map fst $ dep_pkgs deps, cg_hpc_info = hpc_info, cg_modBreaks = modBreaks }, diff --git a/compiler/simplCore/SimplCore.hs b/compiler/simplCore/SimplCore.hs index 654fd52..86eadc7 100644 --- a/compiler/simplCore/SimplCore.hs +++ b/compiler/simplCore/SimplCore.hs @@ -990,27 +990,41 @@ transferIdInfo exported_id local_id -- rules as we transfer them from one function to another --- Note [Grand plan for static forms] --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- --- Static forms go through the compilation phases as follows: --- --- The renamer looks for out-of-scope names in the body of the static form. --- If all names are in scope, the free variables of the body are stored in AST --- at the location of the static form. --- --- The typechecker verifies that all free variables occurring in the static form --- are closed (see Note [Bindings with closed types] in TcRnTypes). --- --- The desugarer replaces the static form with an application of the data --- constructor 'StaticPtr' (defined in module GHC.StaticPtr of base). --- --- The simplifier runs the FloatOut pass which moves the applications of --- 'StaticPtr' to the top level. Thus the FloatOut pass is always executed, --- event when optimizations are disabled. --- --- The CoreTidy pass produces a C function which inserts all the floated --- 'StaticPtr' in the static pointer table (See StaticPtrTable.hs). --- This pass also exports the Ids of floated 'StaticPtr's so they can be linked --- with the C function. --- +{- Note [Grand plan for static forms] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Static forms go through the compilation phases as follows. +Here is a running example: + + f x = let k = map toUpper + in ...(static k)... + +* The renamer looks for out-of-scope names in the body of the static + form, as always If all names are in scope, the free variables of the + body are stored in AST at the location of the static form. + +* The typechecker verifies that all free variables occurring in the + static form are closed (see Note [Bindings with closed types] in + TcRnTypes). In our example, 'k' is closed, even though it is bound + in a nested let, we are fine. + +* The desugarer replaces the static form with an application of the + data constructor 'StaticPtr' (defined in module GHC.StaticPtr of + base). So we get + + f x = let k = map toUpper + in ...(StaticPtr k)... + +* The simplifier runs the FloatOut pass which moves the applications + of 'StaticPtr' to the top level. Thus the FloatOut pass is always + executed, even when optimizations are disabled. So we get + + k = map toUpper + lvl = StaticPtr k + f x = ...lvl... + +* The CoreTidy pass produces a C function which inserts all the + floated 'StaticPtr' in the static pointer table (see the call to + StaticPtrTable.sptModuleInitCode in TidyPgm). CoreTidy pass also + exports the Ids of floated 'StaticPtr's so they can be linked with + the C function. +-} From git at git.haskell.org Tue May 10 13:22:08 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 13:22:08 +0000 (UTC) Subject: [commit: ghc] master: Comments only (b21e8cc) Message-ID: <20160510132208.9083E3A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b21e8cc32302d2e9f3f2ea65173741cd43b0411a/ghc >--------------------------------------------------------------- commit b21e8cc32302d2e9f3f2ea65173741cd43b0411a Author: Simon Peyton Jones Date: Fri May 6 09:50:03 2016 +0100 Comments only >--------------------------------------------------------------- b21e8cc32302d2e9f3f2ea65173741cd43b0411a compiler/typecheck/TcRnTypes.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compiler/typecheck/TcRnTypes.hs b/compiler/typecheck/TcRnTypes.hs index dc05c13..3fd2a83 100644 --- a/compiler/typecheck/TcRnTypes.hs +++ b/compiler/typecheck/TcRnTypes.hs @@ -754,6 +754,8 @@ type TcIdSet = IdSet type TcIdBinderStack = [TcIdBinder] -- This is a stack of locally-bound ids, innermost on top -- Used ony in error reporting (relevantBindings in TcError) + -- We can't use the tcl_env type environment, because it doesn't + -- keep track of the nesting order data TcIdBinder = TcIdBndr From git at git.haskell.org Tue May 10 13:22:05 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 13:22:05 +0000 (UTC) Subject: [commit: ghc] master: Use partial-sig constraints as givens (e24b50c) Message-ID: <20160510132205.DB2563A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e24b50c3a70a247a4695a80aceba0cf351eb1e9e/ghc >--------------------------------------------------------------- commit e24b50c3a70a247a4695a80aceba0cf351eb1e9e Author: Simon Peyton Jones Date: Tue May 10 12:48:29 2016 +0100 Use partial-sig constraints as givens In TcSimplify.simplifyInfer, use the context of a partial type signature as 'givens' when simplifying the inferred constraints of the group. This way we get maximum benefit from them. See Note [Add signature contexts as givens]. This (finally) fixes test EqualityConstraints in Trac #9478. And it's a nice tidy-up. >--------------------------------------------------------------- e24b50c3a70a247a4695a80aceba0cf351eb1e9e compiler/typecheck/TcBinds.hs | 11 +- compiler/typecheck/TcSimplify.hs | 130 +++++++++++---------- compiler/typecheck/TcType.hs | 36 +++--- .../tests/partial-sigs/should_compile/SuperCls.hs | 7 ++ .../partial-sigs/should_compile/SuperCls.stderr | 4 + .../WarningWildcardInstantiations.stderr | 2 +- testsuite/tests/partial-sigs/should_compile/all.T | 1 + .../should_fail/WildcardInstantiations.stderr | 2 +- 8 files changed, 111 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 e24b50c3a70a247a4695a80aceba0cf351eb1e9e From git at git.haskell.org Tue May 10 13:34:45 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 13:34:45 +0000 (UTC) Subject: [commit: ghc] master: Record that EqualityConstraint now works (1a43783) Message-ID: <20160510133445.828A93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1a43783edd3bda2b934aaedf2f68b4d0e0c5eb02/ghc >--------------------------------------------------------------- commit 1a43783edd3bda2b934aaedf2f68b4d0e0c5eb02 Author: Simon Peyton Jones Date: Tue May 10 14:37:36 2016 +0100 Record that EqualityConstraint now works Fixing Trac #9478 >--------------------------------------------------------------- 1a43783edd3bda2b934aaedf2f68b4d0e0c5eb02 testsuite/tests/partial-sigs/should_compile/EqualityConstraint.stderr | 4 ++-- testsuite/tests/partial-sigs/should_compile/all.T | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/testsuite/tests/partial-sigs/should_compile/EqualityConstraint.stderr b/testsuite/tests/partial-sigs/should_compile/EqualityConstraint.stderr index a3c9de1..e79efec 100644 --- a/testsuite/tests/partial-sigs/should_compile/EqualityConstraint.stderr +++ b/testsuite/tests/partial-sigs/should_compile/EqualityConstraint.stderr @@ -3,5 +3,5 @@ TYPE SIGNATURES TYPE CONSTRUCTORS COERCION AXIOMS Dependent modules: [] -Dependent packages: [base-4.9.0.0, ghc-prim-0.3.1.0, - integer-gmp-0.5.1.0] +Dependent packages: [base-4.9.0.0, ghc-prim-0.5.0.0, + integer-gmp-1.0.0.1] diff --git a/testsuite/tests/partial-sigs/should_compile/all.T b/testsuite/tests/partial-sigs/should_compile/all.T index 57b0e3a..18895ad 100644 --- a/testsuite/tests/partial-sigs/should_compile/all.T +++ b/testsuite/tests/partial-sigs/should_compile/all.T @@ -14,7 +14,7 @@ test('Either', normal, compile, ['-ddump-types -fno-warn-partial-type-signatures test('Every', normal, compile, ['-ddump-types -fno-warn-partial-type-signatures']) test('EveryNamed', normal, compile, ['-ddump-types -fno-warn-partial-type-signatures']) # Bug -test('EqualityConstraint', expect_broken(9478), compile, ['-ddump-types -fno-warn-partial-type-signatures']) +test('EqualityConstraint', normal, compile, ['-ddump-types -fno-warn-partial-type-signatures']) test('ExpressionSig', normal, compile, ['-ddump-types -fno-warn-partial-type-signatures']) test('ExpressionSigNamed', normal, compile, ['-ddump-types -fno-warn-partial-type-signatures']) test('ExtraConstraints1', normal, compile, ['-ddump-types -fno-warn-partial-type-signatures']) From git at git.haskell.org Tue May 10 14:11:10 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 14:11:10 +0000 (UTC) Subject: [commit: ghc] master: Test Trac #11640 (f6e58be) Message-ID: <20160510141110.CD82A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f6e58be297f97e8871396f80a81fe3a9984d77b9/ghc >--------------------------------------------------------------- commit f6e58be297f97e8871396f80a81fe3a9984d77b9 Author: Simon Peyton Jones Date: Tue May 10 15:14:11 2016 +0100 Test Trac #11640 >--------------------------------------------------------------- f6e58be297f97e8871396f80a81fe3a9984d77b9 testsuite/tests/polykinds/T11640.hs | 7 +++++++ testsuite/tests/polykinds/all.T | 1 + 2 files changed, 8 insertions(+) diff --git a/testsuite/tests/polykinds/T11640.hs b/testsuite/tests/polykinds/T11640.hs new file mode 100644 index 0000000..16d9f7c --- /dev/null +++ b/testsuite/tests/polykinds/T11640.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE RankNTypes, TypeInType #-} + +module T11640 where + +import Data.Kind + +data HEq :: forall k1. k1 -> forall k2. k2 -> Type where diff --git a/testsuite/tests/polykinds/all.T b/testsuite/tests/polykinds/all.T index f2e274b..2c3d1df 100644 --- a/testsuite/tests/polykinds/all.T +++ b/testsuite/tests/polykinds/all.T @@ -147,3 +147,4 @@ test('T11648', normal, compile, ['']) test('T11648b', normal, compile_fail, ['']) test('KindVType', normal, compile_fail, ['']) test('T11821', normal, compile, ['']) +test('T11640', normal, compile, ['']) From git at git.haskell.org Tue May 10 14:14:48 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 14:14:48 +0000 (UTC) Subject: [commit: ghc] master: Get rid of Traversable UniqFM and Foldable UniqFM (7e28e47) Message-ID: <20160510141448.A35E83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7e28e47ca36e849ed104f5a13e0c08253b135fae/ghc >--------------------------------------------------------------- commit 7e28e47ca36e849ed104f5a13e0c08253b135fae Author: Bartosz Nitka Date: Tue May 10 07:17:28 2016 -0700 Get rid of Traversable UniqFM and Foldable UniqFM Both Traversable and Foldable can introduce non-determinism and because of typeclass overloading it's implicit and not obvious at the call site. This removes the instances, so that they can't accidentally be used. Test Plan: ./validate Reviewers: austin, goldfire, bgamari, simonmar, simonpj Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2190 GHC Trac Issues: #4012 >--------------------------------------------------------------- 7e28e47ca36e849ed104f5a13e0c08253b135fae compiler/typecheck/TcExpr.hs | 5 ++++- compiler/utils/UniqFM.hs | 23 ++++++++++++----------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/compiler/typecheck/TcExpr.hs b/compiler/typecheck/TcExpr.hs index a4c8d02..834287a 100644 --- a/compiler/typecheck/TcExpr.hs +++ b/compiler/typecheck/TcExpr.hs @@ -69,6 +69,7 @@ import Outputable import FastString import Control.Monad import Class(classTyCon) +import UniqFM ( nonDetEltsUFM ) import qualified GHC.LanguageExtensions as LangExt import Data.Function @@ -575,7 +576,9 @@ tcExpr (HsStatic fvs expr) res_ty ) $ tcPolyExprNC expr expr_ty -- Check that the free variables of the static form are closed. - ; mapM_ checkClosedInStaticForm fvs + -- It's OK to use nonDetEltsUFM here as the only side effects of + -- checkClosedInStaticForm are error messages. + ; mapM_ checkClosedInStaticForm $ nonDetEltsUFM fvs -- Require the type of the argument to be Typeable. -- The evidence is not used, but asking the constraint ensures that diff --git a/compiler/utils/UniqFM.hs b/compiler/utils/UniqFM.hs index ed82fee..590358a 100644 --- a/compiler/utils/UniqFM.hs +++ b/compiler/utils/UniqFM.hs @@ -22,10 +22,7 @@ of arguments of combining function. {-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} -{-# LANGUAGE DeriveTraversable #-} -{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} -{-# LANGUAGE StandaloneDeriving #-} {-# OPTIONS_GHC -Wall #-} module UniqFM ( @@ -64,7 +61,7 @@ module UniqFM ( isNullUFM, lookupUFM, lookupUFM_Directly, lookupWithDefaultUFM, lookupWithDefaultUFM_Directly, - eltsUFM, keysUFM, splitUFM, + nonDetEltsUFM, eltsUFM, keysUFM, splitUFM, ufmToSet_Directly, ufmToList, ufmToIntMap, joinUFM, pprUniqFM, pprUFM, pluralUFM @@ -77,8 +74,6 @@ import Compiler.Hoopl hiding (Unique) import qualified Data.IntMap as M import qualified Data.IntSet as S -import qualified Data.Foldable as Foldable -import qualified Data.Traversable as Traversable import Data.Typeable import Data.Data #if __GLASGOW_HASKELL__ > 710 @@ -221,11 +216,13 @@ instance Monoid (UniqFM a) where ************************************************************************ -} -newtype UniqFM ele = UFM (M.IntMap ele) - deriving (Data, Eq, Functor, Traversable.Traversable, - Typeable) -deriving instance Foldable.Foldable UniqFM +newtype UniqFM ele = UFM (M.IntMap ele) + deriving (Data, Eq, Functor, Typeable) + -- We used to derive Traversable and Foldable, but they were nondeterministic + -- and not obvious at the call site. You can use explicit nonDetEltsUFM + -- and fold a list if needed. + -- See Note [Deterministic UniqFM] in UniqDFM to learn about determinism. emptyUFM = UFM M.empty isNullUFM (UFM m) = M.null m @@ -306,6 +303,10 @@ anyUFM p (UFM m) = M.fold ((||) . p) False m allUFM :: (elt -> Bool) -> UniqFM elt -> Bool allUFM p (UFM m) = M.fold ((&&) . p) True m +-- See Note [Deterministic UniqFM] to learn about nondeterminism +nonDetEltsUFM :: UniqFM elt -> [elt] +nonDetEltsUFM (UFM m) = M.elems m + ufmToIntMap :: UniqFM elt -> M.IntMap elt ufmToIntMap (UFM m) = m @@ -345,7 +346,7 @@ pprUFM :: ([a] -> SDoc) -- ^ The pretty printing function to use on the elements -> UniqFM a -- ^ The things to be pretty printed -> SDoc -- ^ 'SDoc' where the things have been pretty -- printed -pprUFM pp ufm = pp (eltsUFM ufm) +pprUFM pp ufm = pp (nonDetEltsUFM ufm) -- | Determines the pluralisation suffix appropriate for the length of a set -- in the same way that plural from Outputable does for lists. From git at git.haskell.org Tue May 10 14:42:57 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 14:42:57 +0000 (UTC) Subject: [commit: ghc] master: Fix typos (402f201) Message-ID: <20160510144257.078BB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/402f201d617bdd296108b5f6afb17559d97cc7bb/ghc >--------------------------------------------------------------- commit 402f201d617bdd296108b5f6afb17559d97cc7bb Author: Bartosz Nitka Date: Tue May 10 07:45:55 2016 -0700 Fix typos >--------------------------------------------------------------- 402f201d617bdd296108b5f6afb17559d97cc7bb compiler/typecheck/TcSMonad.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/typecheck/TcSMonad.hs b/compiler/typecheck/TcSMonad.hs index 88f2f87..10fd0cc 100644 --- a/compiler/typecheck/TcSMonad.hs +++ b/compiler/typecheck/TcSMonad.hs @@ -679,13 +679,13 @@ Note [inert_model: the inert model] any solution. * Domain of the model = skolems + untouchables. - A touchable unification variable wouuld have been unified first. + A touchable unification variable would have been unified first. * The inert_eqs are all Given/Wanted. The Derived ones are in the inert_model only. * However inert_dicts, inert_funeqs, inert_irreds - may well contain derived costraints. + may well contain derived constraints. Note [inert_eqs: the inert equalities] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From git at git.haskell.org Tue May 10 14:55:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 14:55:06 +0000 (UTC) Subject: [commit: ghc] master: make accept for Make simplifyInstanceContexts deterministic (ab91b85) Message-ID: <20160510145506.2D9283A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ab91b851637437844359bc6e82efff44dfb0c0ea/ghc >--------------------------------------------------------------- commit ab91b851637437844359bc6e82efff44dfb0c0ea Author: Bartosz Nitka Date: Tue May 10 07:56:06 2016 -0700 make accept for Make simplifyInstanceContexts deterministic Making it deterministic changed some error messages and I forgot to make accept. Relevant change: b58b0e18a568. >--------------------------------------------------------------- ab91b851637437844359bc6e82efff44dfb0c0ea testsuite/tests/ghci.debugger/scripts/break006.stderr | 4 ++-- testsuite/tests/typecheck/should_fail/T5095.stderr | 2 +- testsuite/tests/typecheck/should_fail/tcfail133.stderr | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/testsuite/tests/ghci.debugger/scripts/break006.stderr b/testsuite/tests/ghci.debugger/scripts/break006.stderr index 2b43dff..463b66f 100644 --- a/testsuite/tests/ghci.debugger/scripts/break006.stderr +++ b/testsuite/tests/ghci.debugger/scripts/break006.stderr @@ -5,7 +5,7 @@ Use :print or :force to determine these types Relevant bindings include it :: t (bound at :4:1) These potential instances exist: - instance (Show a, Show b) => Show (Either a b) + instance (Show b, Show a) => Show (Either a b) -- Defined in ?Data.Either? instance Show Ordering -- Defined in ?GHC.Show? instance Show Integer -- Defined in ?GHC.Show? @@ -20,7 +20,7 @@ Use :print or :force to determine these types Relevant bindings include it :: t (bound at :6:1) These potential instances exist: - instance (Show a, Show b) => Show (Either a b) + instance (Show b, Show a) => Show (Either a b) -- Defined in ?Data.Either? instance Show Ordering -- Defined in ?GHC.Show? instance Show Integer -- Defined in ?GHC.Show? diff --git a/testsuite/tests/typecheck/should_fail/T5095.stderr b/testsuite/tests/typecheck/should_fail/T5095.stderr index dcde111..dc10d40 100644 --- a/testsuite/tests/typecheck/should_fail/T5095.stderr +++ b/testsuite/tests/typecheck/should_fail/T5095.stderr @@ -3,7 +3,7 @@ T5095.hs:9:9: error: ? Overlapping instances for Eq a arising from a use of ?==? Matching instances: instance [overlappable] Show a => Eq a -- Defined at T5095.hs:5:31 - instance (Eq a, Eq b) => Eq (Either a b) + instance (Eq b, Eq a) => Eq (Either a b) -- Defined in ?Data.Either? instance Eq Ordering -- Defined in ?GHC.Classes? ...plus 24 others diff --git a/testsuite/tests/typecheck/should_fail/tcfail133.stderr b/testsuite/tests/typecheck/should_fail/tcfail133.stderr index 72dc14e..a2b602c 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail133.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail133.stderr @@ -9,7 +9,7 @@ tcfail133.hs:68:7: error: These potential instances exist: instance Show Ordering -- Defined in ?GHC.Show? instance Show Integer -- Defined in ?GHC.Show? - instance (Show a, Show b, Number a, Digit b) => Show (a :@ b) + instance (Show b, Show a, Digit b, Number a) => Show (a :@ b) -- Defined at tcfail133.hs:11:54 ...plus 25 others ...plus five instances involving out-of-scope types From git at git.haskell.org Tue May 10 15:28:09 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 15:28:09 +0000 (UTC) Subject: [commit: ghc] master: Kill foldUFM in classifyTyCon (e207198) Message-ID: <20160510152809.0C9973A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e207198fce4b49f673b72916dbb4a94b9793813c/ghc >--------------------------------------------------------------- commit e207198fce4b49f673b72916dbb4a94b9793813c Author: Bartosz Nitka Date: Tue May 10 08:29:39 2016 -0700 Kill foldUFM in classifyTyCon We can get away with anyUFM here. >--------------------------------------------------------------- e207198fce4b49f673b72916dbb4a94b9793813c compiler/vectorise/Vectorise/Type/Classify.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/vectorise/Vectorise/Type/Classify.hs b/compiler/vectorise/Vectorise/Type/Classify.hs index 07d8b1f..0140989 100644 --- a/compiler/vectorise/Vectorise/Type/Classify.hs +++ b/compiler/vectorise/Vectorise/Type/Classify.hs @@ -75,7 +75,7 @@ classifyTyCons convStatus parTyCons tcs = classify [] [] [] [] convStatus parTyC can_convert = (isNullUFM (filterUniqSet ((`elemNameSet` pts) . tyConName) (refs `minusUFM` cs)) && all convertable tcs) || isShowClass tcs - must_convert = foldUFM (||) False (intersectUFM_C const cs refs) + must_convert = anyUFM id (intersectUFM_C const cs refs) && (not . isShowClass $ tcs) -- We currently admit Haskell 2011-style data and newtype declarations as well as type From git at git.haskell.org Tue May 10 20:57:15 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 20:57:15 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Bump haddock submodule (8b75571) Message-ID: <20160510205715.83E8A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/8b75571bda079946f9abf780cc1d035adf615b5f/ghc >--------------------------------------------------------------- commit 8b75571bda079946f9abf780cc1d035adf615b5f Author: Ben Gamari Date: Tue May 10 18:24:34 2016 +0200 Bump haddock submodule >--------------------------------------------------------------- 8b75571bda079946f9abf780cc1d035adf615b5f utils/haddock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/haddock b/utils/haddock index fea4b0a..48521cf 160000 --- a/utils/haddock +++ b/utils/haddock @@ -1 +1 @@ -Subproject commit fea4b0a3589ad67d72594b16ceb0e6922e7f2bb8 +Subproject commit 48521cfd5ed96dd9e07f76b1c1c86fcc991867a2 From git at git.haskell.org Tue May 10 20:57:18 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 20:57:18 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: users-guide: Note #11995 in release notes (d7c5ddc) Message-ID: <20160510205718.2E33E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/d7c5ddc80b3d6493832a1812b3832f4271ccb39a/ghc >--------------------------------------------------------------- commit d7c5ddc80b3d6493832a1812b3832f4271ccb39a Author: Ben Gamari Date: Tue May 10 22:58:27 2016 +0200 users-guide: Note #11995 in release notes >--------------------------------------------------------------- d7c5ddc80b3d6493832a1812b3832f4271ccb39a docs/users_guide/8.0.1-notes.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/users_guide/8.0.1-notes.rst b/docs/users_guide/8.0.1-notes.rst index b2131ec..1e394d1 100644 --- a/docs/users_guide/8.0.1-notes.rst +++ b/docs/users_guide/8.0.1-notes.rst @@ -161,7 +161,7 @@ Language synonym ``P`` and a type constructor ``T``, ``P`` can be bundled with ``T`` so that when ``T`` is imported ``P`` is also imported. With this change a library author can provide either real data constructors or pattern - synonyms in an opaque manner. See :ref:`pattern-synonyms` for details. :: + synonyms in an opaque manner. See :ref:`patsyn-impexp` for details. :: -- Foo.hs module Foo ( T(P) ) where @@ -796,4 +796,6 @@ Win32 Known bugs ---------- -- None +- The Haddock release shipped with the release currently does not show + :ref:`bundled pattern synonyms ` in generated documentation + (:ghc-ticket:`111955`). From git at git.haskell.org Tue May 10 21:33:52 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 21:33:52 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: users-guide: Add -Wnoncanonical-semigroup-instances to relnotes (fc30ebc) Message-ID: <20160510213352.04E803A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/fc30ebcd85ea9f7f60569b778de2d891e49cfe63/ghc >--------------------------------------------------------------- commit fc30ebcd85ea9f7f60569b778de2d891e49cfe63 Author: Ben Gamari Date: Tue May 10 23:27:01 2016 +0200 users-guide: Add -Wnoncanonical-semigroup-instances to relnotes >--------------------------------------------------------------- fc30ebcd85ea9f7f60569b778de2d891e49cfe63 docs/users_guide/8.0.1-notes.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/users_guide/8.0.1-notes.rst b/docs/users_guide/8.0.1-notes.rst index 1e394d1..4e11b77 100644 --- a/docs/users_guide/8.0.1-notes.rst +++ b/docs/users_guide/8.0.1-notes.rst @@ -364,6 +364,9 @@ Warnings ``Applicative``/``Monad``/``MonadFail`` instance definitions. See flag description in :ref:`options-sanity` for more details. +- Added the option :ghc-flag:`-Wnoncanonical-semigroup-instances` which + warns of ``Monoid`` instances where ``mappend`` is not defined in term of + ``Semigroup``'s ``(<>)`` operation. - Added the :ghc-flag:`-Wmissing-pattern-synonym-signatures` flag. When enabled, this will issue a warning when a pattern From git at git.haskell.org Tue May 10 21:33:54 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 21:33:54 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: users-guide: Fix former base version number (86f9e0c) Message-ID: <20160510213354.A3AA23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/86f9e0cd445056d8743725fb2c906326424dc794/ghc >--------------------------------------------------------------- commit 86f9e0cd445056d8743725fb2c906326424dc794 Author: Ben Gamari Date: Tue May 10 23:28:57 2016 +0200 users-guide: Fix former base version number >--------------------------------------------------------------- 86f9e0cd445056d8743725fb2c906326424dc794 docs/users_guide/8.0.1-notes.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/users_guide/8.0.1-notes.rst b/docs/users_guide/8.0.1-notes.rst index 4e11b77..46068e6 100644 --- a/docs/users_guide/8.0.1-notes.rst +++ b/docs/users_guide/8.0.1-notes.rst @@ -575,7 +575,7 @@ base See ``changelog.md`` in the ``base`` package for full release notes. -- Version number 4.9.0.0 (was 4.7.0.0) +- Version number 4.9.0.0 (was 4.8.2.0) - :base-ref:`GHC.Stack ` exports two new types ``SrcLoc`` and ``CallStack``. A ``SrcLoc`` contains package, module, and file names, as well as start From git at git.haskell.org Tue May 10 21:33:57 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 21:33:57 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: relnotes: Update submodule versions (f5837cd) Message-ID: <20160510213357.506153A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/f5837cd32f107a013564f6b80bc9eac671d4d32c/ghc >--------------------------------------------------------------- commit f5837cd32f107a013564f6b80bc9eac671d4d32c Author: Ben Gamari Date: Tue May 10 23:36:49 2016 +0200 relnotes: Update submodule versions >--------------------------------------------------------------- f5837cd32f107a013564f6b80bc9eac671d4d32c docs/users_guide/8.0.1-notes.rst | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/docs/users_guide/8.0.1-notes.rst b/docs/users_guide/8.0.1-notes.rst index 46068e6..cbc7acb 100644 --- a/docs/users_guide/8.0.1-notes.rst +++ b/docs/users_guide/8.0.1-notes.rst @@ -565,7 +565,7 @@ Libraries array ~~~~~ -- Version number 0.5.1.1 (was 0.5.0.0) +- Version number 0.5.1.1 (was 0.5.1.0) .. _lib-base: @@ -644,37 +644,37 @@ See ``changelog.md`` in the ``base`` package for full release notes. binary ~~~~~~ -- Version number 0.8.3.0 (was 0.7.1.0) +- Version number 0.8.3.0 (was 0.7.5.0) bytestring ~~~~~~~~~~ -- Version number 0.10.8.0 (was 0.10.4.0) +- Version number 0.10.8.0 (was 0.10.6.0) Cabal ~~~~~ -- Version number 1.24.0 (was 1.18.1.3) +- Version number 1.24.0 (was 1.22.5.0) containers ~~~~~~~~~~ -- Version number 0.5.7.1 (was 0.5.4.0) +- Version number 0.5.7.1 (was 0.5.6.2) deepseq ~~~~~~~ -- Version number 1.4.2.0 (was 1.3.0.2) +- Version number 1.4.2.0 (was 1.4.1.1) directory ~~~~~~~~~ -- Version number 1.2.6.2 (was 1.2.0.2) +- Version number 1.2.6.2 (was 1.2.2.0) filepath ~~~~~~~~ -- Version number 1.4.1.0 (was 1.3.0.2) +- Version number 1.4.1.0 (was 1.4.0.0) ghc ~~~ @@ -720,7 +720,7 @@ ghc-boot ghc-prim ~~~~~~~~ -- Version number 0.5.0.0 (was 0.3.1.0) +- Version number 0.5.0.0 (was 0.4.0.0) haskell98 ~~~~~~~~~ @@ -736,12 +736,12 @@ haskell2010 hoopl ~~~~~ -- Version number 3.10.2.1 (was 3.10.0.0) +- Version number 3.10.2.1 (was 3.10.0.2) hpc ~~~ -- Version number 0.6.0.3 (was 0.6.0.1) +- Version number 0.6.0.3 (was 0.6.0.2) integer-gmp ~~~~~~~~~~~ @@ -761,12 +761,12 @@ old-time process ~~~~~~~ -- Version number 1.4.2.0 (was 1.2.0.0) +- Version number 1.4.2.0 (was 1.2.3.0) template-haskell ~~~~~~~~~~~~~~~~ -- Version number 2.11.0.0 (was 2.9.0.0) +- Version number 2.11.0.0 (was 2.10.0.0) - The ``Lift`` type class for lifting values into Template Haskell splices now has a default signature ``lift :: Data a => a -> Q Exp``, @@ -784,17 +784,17 @@ template-haskell time ~~~~ -- Version number 1.6.0.1 (was 1.4.1) +- Version number 1.6.0.1 (was 1.5.0.1) unix ~~~~ -- Version number 2.7.2.0 (was 2.7.0.0) +- Version number 2.7.2.0 (was 2.7.1.0) Win32 ~~~~~ -- Version number 2.3.1.1 (was 2.3.0.1) +- Version number 2.3.1.1 (was 2.3.1.0) Known bugs ---------- From git at git.haskell.org Tue May 10 21:35:58 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 21:35:58 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: relnotes: Fix typo in ticket number (5beb03b) Message-ID: <20160510213558.E9B0B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/5beb03bcc936a328bf86d2e42b2977914f1f985d/ghc >--------------------------------------------------------------- commit 5beb03bcc936a328bf86d2e42b2977914f1f985d Author: Ben Gamari Date: Tue May 10 23:38:41 2016 +0200 relnotes: Fix typo in ticket number Thanks Mikhail! >--------------------------------------------------------------- 5beb03bcc936a328bf86d2e42b2977914f1f985d docs/users_guide/8.0.1-notes.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/users_guide/8.0.1-notes.rst b/docs/users_guide/8.0.1-notes.rst index cbc7acb..f6714af 100644 --- a/docs/users_guide/8.0.1-notes.rst +++ b/docs/users_guide/8.0.1-notes.rst @@ -801,4 +801,4 @@ Known bugs - The Haddock release shipped with the release currently does not show :ref:`bundled pattern synonyms ` in generated documentation - (:ghc-ticket:`111955`). + (:ghc-ticket:`11955`). From git at git.haskell.org Tue May 10 22:15:04 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 22:15:04 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: RtsUtils: Use `size_t` instead of `int` where appropriate (c3bb8f5) Message-ID: <20160510221504.D78043A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/c3bb8f525789fc88b6dcb12bd144c26ecf7fcdae/ghc >--------------------------------------------------------------- commit c3bb8f525789fc88b6dcb12bd144c26ecf7fcdae Author: Erik de Castro Lopo Date: Mon May 2 20:07:05 2016 +1000 RtsUtils: Use `size_t` instead of `int` where appropriate Functions like `stgMallocBytes` take a size parameter which was of type `int`, but is commonly used as `stgMallocBytes (sizeof (...))`. This is problematic because the `sizeof` operator returns `size_t` so that on 64 bit systems, in this common use case the `size_t` parameter would be truncated to 32 bits when passed to `stgMallocBytes` where it was cast back to `size_t`. >--------------------------------------------------------------- c3bb8f525789fc88b6dcb12bd144c26ecf7fcdae rts/RtsUtils.c | 22 +++++++++------------- rts/RtsUtils.h | 6 +++--- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/rts/RtsUtils.c b/rts/RtsUtils.c index c837143..716d203 100644 --- a/rts/RtsUtils.c +++ b/rts/RtsUtils.c @@ -57,13 +57,11 @@ extern char *ctime_r(const time_t *, char *); -------------------------------------------------------------------------- */ void * -stgMallocBytes (int n, char *msg) +stgMallocBytes (size_t n, char *msg) { - char *space; - size_t n2; + void *space; - n2 = (size_t) n; - if ((space = (char *) malloc(n2)) == NULL) { + if ((space = malloc(n)) == NULL) { /* Quoting POSIX.1-2008 (which says more or less the same as ISO C99): * * "Upon successful completion with size not equal to 0, malloc() shall @@ -85,13 +83,11 @@ stgMallocBytes (int n, char *msg) } void * -stgReallocBytes (void *p, int n, char *msg) +stgReallocBytes (void *p, size_t n, char *msg) { - char *space; - size_t n2; + void *space; - n2 = (size_t) n; - if ((space = (char *) realloc(p, (size_t) n2)) == NULL) { + if ((space = realloc(p, n)) == NULL) { /* don't fflush(stdout); WORKAROUND bug in Linux glibc */ rtsConfig.mallocFailHook((W_) n, msg); /*msg*/ stg_exit(EXIT_INTERNAL_ERROR); @@ -100,11 +96,11 @@ stgReallocBytes (void *p, int n, char *msg) } void * -stgCallocBytes (int n, int m, char *msg) +stgCallocBytes (size_t n, size_t m, char *msg) { - char *space; + void *space; - if ((space = (char *) calloc((size_t) n, (size_t) m)) == NULL) { + if ((space = calloc(n, m)) == NULL) { /* don't fflush(stdout); WORKAROUND bug in Linux glibc */ rtsConfig.mallocFailHook((W_) n*m, msg); /*msg*/ stg_exit(EXIT_INTERNAL_ERROR); diff --git a/rts/RtsUtils.h b/rts/RtsUtils.h index d76c921..2d5e5de 100644 --- a/rts/RtsUtils.h +++ b/rts/RtsUtils.h @@ -18,12 +18,12 @@ void initAllocator(void); void shutdownAllocator(void); -void *stgMallocBytes(int n, char *msg) +void *stgMallocBytes(size_t n, char *msg) GNUC3_ATTRIBUTE(__malloc__); -void *stgReallocBytes(void *p, int n, char *msg); +void *stgReallocBytes(void *p, size_t n, char *msg); -void *stgCallocBytes(int n, int m, char *msg) +void *stgCallocBytes(size_t n, size_t m, char *msg) GNUC3_ATTRIBUTE(__malloc__); char *stgStrndup(const char *s, size_t n); From git at git.haskell.org Tue May 10 22:15:07 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 22:15:07 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: RtsFlags: Make `mallocFailHook` const correct (69ceab2) Message-ID: <20160510221507.8DD2A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/69ceab275165d8a0794d26ee61e82e5f554dcb44/ghc >--------------------------------------------------------------- commit 69ceab275165d8a0794d26ee61e82e5f554dcb44 Author: Erik de Castro Lopo Date: Mon May 2 21:20:28 2016 +1000 RtsFlags: Make `mallocFailHook` const correct >--------------------------------------------------------------- 69ceab275165d8a0794d26ee61e82e5f554dcb44 includes/RtsAPI.h | 2 +- rts/hooks/Hooks.h | 2 +- rts/hooks/MallocFail.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/RtsAPI.h b/includes/RtsAPI.h index 16b8486..a4a094f 100644 --- a/includes/RtsAPI.h +++ b/includes/RtsAPI.h @@ -90,7 +90,7 @@ typedef struct { void (* outOfHeapHook) (W_ request_size, W_ heap_size); // Called when malloc() fails, before exiting - void (* mallocFailHook) (W_ request_size /* in bytes */, char *msg); + void (* mallocFailHook) (W_ request_size /* in bytes */, const char *msg); // Called for every GC void (* gcDoneHook) (unsigned int gen, diff --git a/rts/hooks/Hooks.h b/rts/hooks/Hooks.h index 35a6011..1383ccd 100644 --- a/rts/hooks/Hooks.h +++ b/rts/hooks/Hooks.h @@ -21,7 +21,7 @@ extern char *ghc_rts_opts; extern void OnExitHook (void); extern void StackOverflowHook (W_ stack_size); extern void OutOfHeapHook (W_ request_size, W_ heap_size); -extern void MallocFailHook (W_ request_size /* in bytes */, char *msg); +extern void MallocFailHook (W_ request_size /* in bytes */, const char *msg); extern void FlagDefaultsHook (void); #include "EndPrivate.h" diff --git a/rts/hooks/MallocFail.c b/rts/hooks/MallocFail.c index 63343a7..42606b6 100644 --- a/rts/hooks/MallocFail.c +++ b/rts/hooks/MallocFail.c @@ -11,7 +11,7 @@ #include void -MallocFailHook (W_ request_size /* in bytes */, char *msg) +MallocFailHook (W_ request_size /* in bytes */, const char *msg) { fprintf(stderr, "malloc: failed on request for %" FMT_Word " bytes; message: %s\n", request_size, msg); } From git at git.haskell.org Tue May 10 22:15:10 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 22:15:10 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat's head updated: RtsFlags: Make `mallocFailHook` const correct (69ceab2) Message-ID: <20160510221510.0F0983A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/erikd/remove-nat' now includes: e340520 Comments only explaining export list parsing. 94f2ee1 Explain linter optimization for StaticPtr checks. 990ce8c Use tcExtendGlobalValEnv for default methods ecc1d58 Update Win32 submodule to v2.3.1.1 release tag 018487e Fix pretty printing of IEThingWith fe190ae Remove trailing whitespace from 'testsuite/tests/module/all.T' 633b099 Update time submodule to 1.6.0.1 release tag 8e5776b rts/ProfHeap.c: Use `ssize_t` instead of `long`. dd3e847 Documentation for simplifyDeriv. 260a564 Use stdint types for Stg{Word,Int}{8,16,32,64} 2593e20 White space only 76d9156 Emit wild-card constraints in the right place cc75a5d Comments only e1ff2b4 Fix partial sigs and pattern bindings interaction 9dbf5f5 Tidy up partial-sig quantification bb296bf Error message wibbles, re partial type sigs 0597493 Re-do the invariant for TcDepVars 3ca7806 stg/Types.h: Fix comment and #include 53f26f5 Forbid variables to be parents in import lists. e996e85 RdrHsSyn: Only suggest `type` qualification when appropriate ea3d1ef Fix a crash in requestSync() bff6e1b Comments only 4ac0e81 Kill unnecessary cmpType in lhs_cmp_type b58b0e1 Make simplifyInstanceContexts deterministic a4717f5 Comments about static forms b21e8cc Comments only e7e5939 Add Outputable ShowHowMuch e24b50c Use partial-sig constraints as givens 1a43783 Record that EqualityConstraint now works f6e58be Test Trac #11640 7e28e47 Get rid of Traversable UniqFM and Foldable UniqFM 402f201 Fix typos ab91b85 make accept for Make simplifyInstanceContexts deterministic e207198 Kill foldUFM in classifyTyCon c3bb8f5 RtsUtils: Use `size_t` instead of `int` where appropriate 69ceab2 RtsFlags: Make `mallocFailHook` const correct From git at git.haskell.org Tue May 10 23:59:11 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 23:59:11 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: RtsFlags: Make `mallocFailHook` const correct (7f9eb4c) Message-ID: <20160510235911.C1C963A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/7f9eb4c4552cc996a9611d2334c680bdeb188cf5/ghc >--------------------------------------------------------------- commit 7f9eb4c4552cc996a9611d2334c680bdeb188cf5 Author: Erik de Castro Lopo Date: Mon May 2 21:20:28 2016 +1000 RtsFlags: Make `mallocFailHook` const correct >--------------------------------------------------------------- 7f9eb4c4552cc996a9611d2334c680bdeb188cf5 includes/RtsAPI.h | 2 +- rts/hooks/Hooks.h | 2 +- rts/hooks/MallocFail.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/RtsAPI.h b/includes/RtsAPI.h index 16b8486..a4a094f 100644 --- a/includes/RtsAPI.h +++ b/includes/RtsAPI.h @@ -90,7 +90,7 @@ typedef struct { void (* outOfHeapHook) (W_ request_size, W_ heap_size); // Called when malloc() fails, before exiting - void (* mallocFailHook) (W_ request_size /* in bytes */, char *msg); + void (* mallocFailHook) (W_ request_size /* in bytes */, const char *msg); // Called for every GC void (* gcDoneHook) (unsigned int gen, diff --git a/rts/hooks/Hooks.h b/rts/hooks/Hooks.h index 35a6011..1383ccd 100644 --- a/rts/hooks/Hooks.h +++ b/rts/hooks/Hooks.h @@ -21,7 +21,7 @@ extern char *ghc_rts_opts; extern void OnExitHook (void); extern void StackOverflowHook (W_ stack_size); extern void OutOfHeapHook (W_ request_size, W_ heap_size); -extern void MallocFailHook (W_ request_size /* in bytes */, char *msg); +extern void MallocFailHook (W_ request_size /* in bytes */, const char *msg); extern void FlagDefaultsHook (void); #include "EndPrivate.h" diff --git a/rts/hooks/MallocFail.c b/rts/hooks/MallocFail.c index 63343a7..42606b6 100644 --- a/rts/hooks/MallocFail.c +++ b/rts/hooks/MallocFail.c @@ -11,7 +11,7 @@ #include void -MallocFailHook (W_ request_size /* in bytes */, char *msg) +MallocFailHook (W_ request_size /* in bytes */, const char *msg) { fprintf(stderr, "malloc: failed on request for %" FMT_Word " bytes; message: %s\n", request_size, msg); } From git at git.haskell.org Tue May 10 23:59:14 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 10 May 2016 23:59:14 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: RtsUtils: Use `size_t` instead of `int` where appropriate (2b86f6f) Message-ID: <20160510235914.70B3F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/2b86f6f078408d5857091b6bc653da28aaa554f7/ghc >--------------------------------------------------------------- commit 2b86f6f078408d5857091b6bc653da28aaa554f7 Author: Erik de Castro Lopo Date: Mon May 2 20:07:05 2016 +1000 RtsUtils: Use `size_t` instead of `int` where appropriate Functions like `stgMallocBytes` take a size parameter which was of type `int`, but is commonly used as `stgMallocBytes (sizeof (...))`. This is problematic because the `sizeof` operator returns `size_t` so that on 64 bit systems, in this common use case the `size_t` parameter would be truncated to 32 bits when passed to `stgMallocBytes` where it was cast back to `size_t`. >--------------------------------------------------------------- 2b86f6f078408d5857091b6bc653da28aaa554f7 rts/Linker.c | 6 +++--- rts/RtsUtils.c | 22 +++++++++------------- rts/RtsUtils.h | 6 +++--- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/rts/Linker.c b/rts/Linker.c index 981df25..109d17d 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -3799,9 +3799,9 @@ ocVerifyImage_PEi386 ( ObjectCode* oc ) IF_DEBUG(linker, i=1); if (i == 0) return 1; - debugBelch( "sectab offset = %" FMT_Int "\n", ((UChar*)sectab) - ((UChar*)hdr) ); - debugBelch( "symtab offset = %" FMT_Int "\n", ((UChar*)symtab) - ((UChar*)hdr) ); - debugBelch( "strtab offset = %" FMT_Int "\n", ((UChar*)strtab) - ((UChar*)hdr) ); + debugBelch( "sectab offset = %" FMT_SizeT "\n", ((UChar*)sectab) - ((UChar*)hdr) ); + debugBelch( "symtab offset = %" FMT_SizeT "\n", ((UChar*)symtab) - ((UChar*)hdr) ); + debugBelch( "strtab offset = %" FMT_SizeT "\n", ((UChar*)strtab) - ((UChar*)hdr) ); debugBelch("\n" ); debugBelch( "Machine: 0x%x\n", (UInt32)(hdr->Machine) ); diff --git a/rts/RtsUtils.c b/rts/RtsUtils.c index c837143..716d203 100644 --- a/rts/RtsUtils.c +++ b/rts/RtsUtils.c @@ -57,13 +57,11 @@ extern char *ctime_r(const time_t *, char *); -------------------------------------------------------------------------- */ void * -stgMallocBytes (int n, char *msg) +stgMallocBytes (size_t n, char *msg) { - char *space; - size_t n2; + void *space; - n2 = (size_t) n; - if ((space = (char *) malloc(n2)) == NULL) { + if ((space = malloc(n)) == NULL) { /* Quoting POSIX.1-2008 (which says more or less the same as ISO C99): * * "Upon successful completion with size not equal to 0, malloc() shall @@ -85,13 +83,11 @@ stgMallocBytes (int n, char *msg) } void * -stgReallocBytes (void *p, int n, char *msg) +stgReallocBytes (void *p, size_t n, char *msg) { - char *space; - size_t n2; + void *space; - n2 = (size_t) n; - if ((space = (char *) realloc(p, (size_t) n2)) == NULL) { + if ((space = realloc(p, n)) == NULL) { /* don't fflush(stdout); WORKAROUND bug in Linux glibc */ rtsConfig.mallocFailHook((W_) n, msg); /*msg*/ stg_exit(EXIT_INTERNAL_ERROR); @@ -100,11 +96,11 @@ stgReallocBytes (void *p, int n, char *msg) } void * -stgCallocBytes (int n, int m, char *msg) +stgCallocBytes (size_t n, size_t m, char *msg) { - char *space; + void *space; - if ((space = (char *) calloc((size_t) n, (size_t) m)) == NULL) { + if ((space = calloc(n, m)) == NULL) { /* don't fflush(stdout); WORKAROUND bug in Linux glibc */ rtsConfig.mallocFailHook((W_) n*m, msg); /*msg*/ stg_exit(EXIT_INTERNAL_ERROR); diff --git a/rts/RtsUtils.h b/rts/RtsUtils.h index d76c921..2d5e5de 100644 --- a/rts/RtsUtils.h +++ b/rts/RtsUtils.h @@ -18,12 +18,12 @@ void initAllocator(void); void shutdownAllocator(void); -void *stgMallocBytes(int n, char *msg) +void *stgMallocBytes(size_t n, char *msg) GNUC3_ATTRIBUTE(__malloc__); -void *stgReallocBytes(void *p, int n, char *msg); +void *stgReallocBytes(void *p, size_t n, char *msg); -void *stgCallocBytes(int n, int m, char *msg) +void *stgCallocBytes(size_t n, size_t m, char *msg) GNUC3_ATTRIBUTE(__malloc__); char *stgStrndup(const char *s, size_t n); From git at git.haskell.org Wed May 11 03:03:59 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 11 May 2016 03:03:59 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: RtsUtils: Use `size_t` instead of `int` where appropriate (30dea0d) Message-ID: <20160511030359.881A53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/30dea0d89a7d8ab14925ac93764c4eeb25e96476/ghc >--------------------------------------------------------------- commit 30dea0d89a7d8ab14925ac93764c4eeb25e96476 Author: Erik de Castro Lopo Date: Mon May 2 20:07:05 2016 +1000 RtsUtils: Use `size_t` instead of `int` where appropriate Functions like `stgMallocBytes` take a size parameter which was of type `int`, but is commonly used as `stgMallocBytes (sizeof (...))`. This is problematic because the `sizeof` operator returns `size_t` so that on 64 bit systems, in this common use case the `size_t` parameter would be truncated to 32 bits when passed to `stgMallocBytes` where it was cast back to `size_t`. >--------------------------------------------------------------- 30dea0d89a7d8ab14925ac93764c4eeb25e96476 rts/RtsUtils.c | 22 +++++++++------------- rts/RtsUtils.h | 6 +++--- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/rts/RtsUtils.c b/rts/RtsUtils.c index c837143..716d203 100644 --- a/rts/RtsUtils.c +++ b/rts/RtsUtils.c @@ -57,13 +57,11 @@ extern char *ctime_r(const time_t *, char *); -------------------------------------------------------------------------- */ void * -stgMallocBytes (int n, char *msg) +stgMallocBytes (size_t n, char *msg) { - char *space; - size_t n2; + void *space; - n2 = (size_t) n; - if ((space = (char *) malloc(n2)) == NULL) { + if ((space = malloc(n)) == NULL) { /* Quoting POSIX.1-2008 (which says more or less the same as ISO C99): * * "Upon successful completion with size not equal to 0, malloc() shall @@ -85,13 +83,11 @@ stgMallocBytes (int n, char *msg) } void * -stgReallocBytes (void *p, int n, char *msg) +stgReallocBytes (void *p, size_t n, char *msg) { - char *space; - size_t n2; + void *space; - n2 = (size_t) n; - if ((space = (char *) realloc(p, (size_t) n2)) == NULL) { + if ((space = realloc(p, n)) == NULL) { /* don't fflush(stdout); WORKAROUND bug in Linux glibc */ rtsConfig.mallocFailHook((W_) n, msg); /*msg*/ stg_exit(EXIT_INTERNAL_ERROR); @@ -100,11 +96,11 @@ stgReallocBytes (void *p, int n, char *msg) } void * -stgCallocBytes (int n, int m, char *msg) +stgCallocBytes (size_t n, size_t m, char *msg) { - char *space; + void *space; - if ((space = (char *) calloc((size_t) n, (size_t) m)) == NULL) { + if ((space = calloc(n, m)) == NULL) { /* don't fflush(stdout); WORKAROUND bug in Linux glibc */ rtsConfig.mallocFailHook((W_) n*m, msg); /*msg*/ stg_exit(EXIT_INTERNAL_ERROR); diff --git a/rts/RtsUtils.h b/rts/RtsUtils.h index d76c921..2d5e5de 100644 --- a/rts/RtsUtils.h +++ b/rts/RtsUtils.h @@ -18,12 +18,12 @@ void initAllocator(void); void shutdownAllocator(void); -void *stgMallocBytes(int n, char *msg) +void *stgMallocBytes(size_t n, char *msg) GNUC3_ATTRIBUTE(__malloc__); -void *stgReallocBytes(void *p, int n, char *msg); +void *stgReallocBytes(void *p, size_t n, char *msg); -void *stgCallocBytes(int n, int m, char *msg) +void *stgCallocBytes(size_t n, size_t m, char *msg) GNUC3_ATTRIBUTE(__malloc__); char *stgStrndup(const char *s, size_t n); From git at git.haskell.org Wed May 11 03:04:02 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 11 May 2016 03:04:02 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: RtsFlags: Make `mallocFailHook` const correct (04a30b2) Message-ID: <20160511030402.369E23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/04a30b26366dca9184808febaccda5f49f640713/ghc >--------------------------------------------------------------- commit 04a30b26366dca9184808febaccda5f49f640713 Author: Erik de Castro Lopo Date: Mon May 2 21:20:28 2016 +1000 RtsFlags: Make `mallocFailHook` const correct >--------------------------------------------------------------- 04a30b26366dca9184808febaccda5f49f640713 includes/RtsAPI.h | 2 +- rts/hooks/Hooks.h | 2 +- rts/hooks/MallocFail.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/RtsAPI.h b/includes/RtsAPI.h index 16b8486..a4a094f 100644 --- a/includes/RtsAPI.h +++ b/includes/RtsAPI.h @@ -90,7 +90,7 @@ typedef struct { void (* outOfHeapHook) (W_ request_size, W_ heap_size); // Called when malloc() fails, before exiting - void (* mallocFailHook) (W_ request_size /* in bytes */, char *msg); + void (* mallocFailHook) (W_ request_size /* in bytes */, const char *msg); // Called for every GC void (* gcDoneHook) (unsigned int gen, diff --git a/rts/hooks/Hooks.h b/rts/hooks/Hooks.h index 35a6011..1383ccd 100644 --- a/rts/hooks/Hooks.h +++ b/rts/hooks/Hooks.h @@ -21,7 +21,7 @@ extern char *ghc_rts_opts; extern void OnExitHook (void); extern void StackOverflowHook (W_ stack_size); extern void OutOfHeapHook (W_ request_size, W_ heap_size); -extern void MallocFailHook (W_ request_size /* in bytes */, char *msg); +extern void MallocFailHook (W_ request_size /* in bytes */, const char *msg); extern void FlagDefaultsHook (void); #include "EndPrivate.h" diff --git a/rts/hooks/MallocFail.c b/rts/hooks/MallocFail.c index 63343a7..42606b6 100644 --- a/rts/hooks/MallocFail.c +++ b/rts/hooks/MallocFail.c @@ -11,7 +11,7 @@ #include void -MallocFailHook (W_ request_size /* in bytes */, char *msg) +MallocFailHook (W_ request_size /* in bytes */, const char *msg) { fprintf(stderr, "malloc: failed on request for %" FMT_Word " bytes; message: %s\n", request_size, msg); } From git at git.haskell.org Wed May 11 03:04:04 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 11 May 2016 03:04:04 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: rts: Fix C compiler warnings on Windows (cb3f4e6) Message-ID: <20160511030404.DB40A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/cb3f4e647ab1baf7e670d3ec4474d1ac74b45099/ghc >--------------------------------------------------------------- commit cb3f4e647ab1baf7e670d3ec4474d1ac74b45099 Author: Erik de Castro Lopo Date: Wed May 11 11:05:40 2016 +1000 rts: Fix C compiler warnings on Windows Specifcally we want the MinGW compiler to use ISO print format specfifiers. >--------------------------------------------------------------- cb3f4e647ab1baf7e670d3ec4474d1ac74b45099 includes/stg/Types.h | 5 +++++ rts/Linker.c | 6 +++--- rts/Trace.c | 16 +++++++++------- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/includes/stg/Types.h b/includes/stg/Types.h index 1a61c8b..0ad3c5c 100644 --- a/includes/stg/Types.h +++ b/includes/stg/Types.h @@ -21,6 +21,11 @@ #ifndef STGTYPES_H #define STGTYPES_H +#if defined(mingw32_HOST_OS) +/* Inform mingw we want the ISO rather than Windows printf format specifiers. */ +#define __USE_MINGW_ANSI_STDIO 1 +#endif + /* ISO C 99 says: * "C++ implementations should define these macros only when * __STDC_LIMIT_MACROS is defined before is included." diff --git a/rts/Linker.c b/rts/Linker.c index 981df25..109d17d 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -3799,9 +3799,9 @@ ocVerifyImage_PEi386 ( ObjectCode* oc ) IF_DEBUG(linker, i=1); if (i == 0) return 1; - debugBelch( "sectab offset = %" FMT_Int "\n", ((UChar*)sectab) - ((UChar*)hdr) ); - debugBelch( "symtab offset = %" FMT_Int "\n", ((UChar*)symtab) - ((UChar*)hdr) ); - debugBelch( "strtab offset = %" FMT_Int "\n", ((UChar*)strtab) - ((UChar*)hdr) ); + debugBelch( "sectab offset = %" FMT_SizeT "\n", ((UChar*)sectab) - ((UChar*)hdr) ); + debugBelch( "symtab offset = %" FMT_SizeT "\n", ((UChar*)symtab) - ((UChar*)hdr) ); + debugBelch( "strtab offset = %" FMT_SizeT "\n", ((UChar*)strtab) - ((UChar*)hdr) ); debugBelch("\n" ); debugBelch( "Machine: 0x%x\n", (UInt32)(hdr->Machine) ); diff --git a/rts/Trace.c b/rts/Trace.c index cf47e16..2e81487 100644 --- a/rts/Trace.c +++ b/rts/Trace.c @@ -6,6 +6,8 @@ * * ---------------------------------------------------------------------------*/ +#include "PosixSource.h" + // external headers #include "Rts.h" @@ -424,18 +426,18 @@ void traceCapsetEvent (EventTypeNum tag, tracePreface(); switch (tag) { case EVENT_CAPSET_CREATE: // (capset, capset_type) - debugBelch("created capset %" FMT_Word " of type %d\n", (W_)capset, (int)info); + debugBelch("created capset %" FMT_Word32 " of type %d\n", capset, (int)info); break; case EVENT_CAPSET_DELETE: // (capset) - debugBelch("deleted capset %" FMT_Word "\n", (W_)capset); + debugBelch("deleted capset %" FMT_Word32 "\n", capset); break; case EVENT_CAPSET_ASSIGN_CAP: // (capset, capno) - debugBelch("assigned cap %" FMT_Word " to capset %" FMT_Word "\n", - (W_)info, (W_)capset); + debugBelch("assigned cap %" FMT_Word " to capset %" FMT_Word32 "\n", + info, capset); break; case EVENT_CAPSET_REMOVE_CAP: // (capset, capno) - debugBelch("removed cap %" FMT_Word " from capset %" FMT_Word "\n", - (W_)info, (W_)capset); + debugBelch("removed cap %" FMT_Word " from capset %" FMT_Word32 "\n", + info, capset); break; } RELEASE_LOCK(&trace_utx); @@ -738,7 +740,7 @@ void traceThreadLabel_(Capability *cap, ACQUIRE_LOCK(&trace_utx); tracePreface(); debugBelch("cap %d: thread %" FMT_Word " has label %s\n", - cap->no, (W_)tso->id, label); + cap->no, tso->id, label); RELEASE_LOCK(&trace_utx); } else #endif From git at git.haskell.org Wed May 11 03:23:42 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 11 May 2016 03:23:42 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: rts: Fix C compiler warnings on Windows (62703e2) Message-ID: <20160511032342.62F8C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/62703e23385068e23cbf25b6c469a8fd1b4d3a08/ghc >--------------------------------------------------------------- commit 62703e23385068e23cbf25b6c469a8fd1b4d3a08 Author: Erik de Castro Lopo Date: Wed May 11 11:05:40 2016 +1000 rts: Fix C compiler warnings on Windows Specifcally we want the MinGW compiler to use ISO print format specfifiers. >--------------------------------------------------------------- 62703e23385068e23cbf25b6c469a8fd1b4d3a08 includes/stg/Types.h | 5 +++++ rts/Linker.c | 6 +++--- rts/Trace.c | 14 ++++++++------ 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/includes/stg/Types.h b/includes/stg/Types.h index 1a61c8b..0ad3c5c 100644 --- a/includes/stg/Types.h +++ b/includes/stg/Types.h @@ -21,6 +21,11 @@ #ifndef STGTYPES_H #define STGTYPES_H +#if defined(mingw32_HOST_OS) +/* Inform mingw we want the ISO rather than Windows printf format specifiers. */ +#define __USE_MINGW_ANSI_STDIO 1 +#endif + /* ISO C 99 says: * "C++ implementations should define these macros only when * __STDC_LIMIT_MACROS is defined before is included." diff --git a/rts/Linker.c b/rts/Linker.c index 981df25..109d17d 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -3799,9 +3799,9 @@ ocVerifyImage_PEi386 ( ObjectCode* oc ) IF_DEBUG(linker, i=1); if (i == 0) return 1; - debugBelch( "sectab offset = %" FMT_Int "\n", ((UChar*)sectab) - ((UChar*)hdr) ); - debugBelch( "symtab offset = %" FMT_Int "\n", ((UChar*)symtab) - ((UChar*)hdr) ); - debugBelch( "strtab offset = %" FMT_Int "\n", ((UChar*)strtab) - ((UChar*)hdr) ); + debugBelch( "sectab offset = %" FMT_SizeT "\n", ((UChar*)sectab) - ((UChar*)hdr) ); + debugBelch( "symtab offset = %" FMT_SizeT "\n", ((UChar*)symtab) - ((UChar*)hdr) ); + debugBelch( "strtab offset = %" FMT_SizeT "\n", ((UChar*)strtab) - ((UChar*)hdr) ); debugBelch("\n" ); debugBelch( "Machine: 0x%x\n", (UInt32)(hdr->Machine) ); diff --git a/rts/Trace.c b/rts/Trace.c index cf47e16..212b5d8 100644 --- a/rts/Trace.c +++ b/rts/Trace.c @@ -6,6 +6,8 @@ * * ---------------------------------------------------------------------------*/ +#include "PosixSource.h" + // external headers #include "Rts.h" @@ -424,18 +426,18 @@ void traceCapsetEvent (EventTypeNum tag, tracePreface(); switch (tag) { case EVENT_CAPSET_CREATE: // (capset, capset_type) - debugBelch("created capset %" FMT_Word " of type %d\n", (W_)capset, (int)info); + debugBelch("created capset %" FMT_Word32 " of type %d\n", capset, (int)info); break; case EVENT_CAPSET_DELETE: // (capset) - debugBelch("deleted capset %" FMT_Word "\n", (W_)capset); + debugBelch("deleted capset %" FMT_Word32 "\n", capset); break; case EVENT_CAPSET_ASSIGN_CAP: // (capset, capno) - debugBelch("assigned cap %" FMT_Word " to capset %" FMT_Word "\n", - (W_)info, (W_)capset); + debugBelch("assigned cap %" FMT_Word " to capset %" FMT_Word32 "\n", + info, capset); break; case EVENT_CAPSET_REMOVE_CAP: // (capset, capno) - debugBelch("removed cap %" FMT_Word " from capset %" FMT_Word "\n", - (W_)info, (W_)capset); + debugBelch("removed cap %" FMT_Word " from capset %" FMT_Word32 "\n", + info, capset); break; } RELEASE_LOCK(&trace_utx); From git at git.haskell.org Wed May 11 10:38:32 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 11 May 2016 10:38:32 +0000 (UTC) Subject: [commit: ghc] master: Document why closeOverKind is OK for determinism (8669c48) Message-ID: <20160511103833.0075A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8669c48d06ca260c13740e0bda97beea52d332fb/ghc >--------------------------------------------------------------- commit 8669c48d06ca260c13740e0bda97beea52d332fb Author: Bartosz Nitka Date: Wed May 11 03:39:25 2016 -0700 Document why closeOverKind is OK for determinism There's no point in converting the existing call sites to use deterministic closeOverKinds if they never linearize the set. Test Plan: it compiles, this is basically just documentation Reviewers: simonpj, goldfire, simonmar, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2191 GHC Trac Issues: #4012 >--------------------------------------------------------------- 8669c48d06ca260c13740e0bda97beea52d332fb compiler/types/TyCoRep.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/types/TyCoRep.hs b/compiler/types/TyCoRep.hs index 4cdd883..0d95bd7 100644 --- a/compiler/types/TyCoRep.hs +++ b/compiler/types/TyCoRep.hs @@ -1513,7 +1513,9 @@ coVarsOfCos cos = mapUnionVarSet coVarsOfCo cos -- | Add the kind variables free in the kinds of the tyvars in the given set. -- Returns a non-deterministic set. closeOverKinds :: TyVarSet -> TyVarSet -closeOverKinds = fvVarSet . closeOverKindsFV . varSetElems +closeOverKinds = fvVarSet . closeOverKindsFV . nonDetEltsUFM + -- It's OK to use nonDetEltsUFM here because we immediately forget + -- about the ordering by returning a set. -- | Given a list of tyvars returns a deterministic FV computation that -- returns the given tyvars with the kind variables free in the kinds of the From git at git.haskell.org Wed May 11 12:02:54 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 11 May 2016 12:02:54 +0000 (UTC) Subject: [commit: ghc] master: RtsFlags: Make `mallocFailHook` const correct (584ade6) Message-ID: <20160511120254.63F583A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/584ade67630f4e5c599c8422801e93f352b9a6df/ghc >--------------------------------------------------------------- commit 584ade67630f4e5c599c8422801e93f352b9a6df Author: Erik de Castro Lopo Date: Mon May 2 21:20:28 2016 +1000 RtsFlags: Make `mallocFailHook` const correct Test Plan: Validate Reviewers: hvr, austin, bgamari, simonmar Reviewed By: bgamari, simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2193 >--------------------------------------------------------------- 584ade67630f4e5c599c8422801e93f352b9a6df includes/RtsAPI.h | 2 +- rts/hooks/Hooks.h | 2 +- rts/hooks/MallocFail.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/RtsAPI.h b/includes/RtsAPI.h index 16b8486..a4a094f 100644 --- a/includes/RtsAPI.h +++ b/includes/RtsAPI.h @@ -90,7 +90,7 @@ typedef struct { void (* outOfHeapHook) (W_ request_size, W_ heap_size); // Called when malloc() fails, before exiting - void (* mallocFailHook) (W_ request_size /* in bytes */, char *msg); + void (* mallocFailHook) (W_ request_size /* in bytes */, const char *msg); // Called for every GC void (* gcDoneHook) (unsigned int gen, diff --git a/rts/hooks/Hooks.h b/rts/hooks/Hooks.h index 35a6011..1383ccd 100644 --- a/rts/hooks/Hooks.h +++ b/rts/hooks/Hooks.h @@ -21,7 +21,7 @@ extern char *ghc_rts_opts; extern void OnExitHook (void); extern void StackOverflowHook (W_ stack_size); extern void OutOfHeapHook (W_ request_size, W_ heap_size); -extern void MallocFailHook (W_ request_size /* in bytes */, char *msg); +extern void MallocFailHook (W_ request_size /* in bytes */, const char *msg); extern void FlagDefaultsHook (void); #include "EndPrivate.h" diff --git a/rts/hooks/MallocFail.c b/rts/hooks/MallocFail.c index 63343a7..42606b6 100644 --- a/rts/hooks/MallocFail.c +++ b/rts/hooks/MallocFail.c @@ -11,7 +11,7 @@ #include void -MallocFailHook (W_ request_size /* in bytes */, char *msg) +MallocFailHook (W_ request_size /* in bytes */, const char *msg) { fprintf(stderr, "malloc: failed on request for %" FMT_Word " bytes; message: %s\n", request_size, msg); } From git at git.haskell.org Wed May 11 12:09:56 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 11 May 2016 12:09:56 +0000 (UTC) Subject: [commit: ghc] master: rts: Fix C compiler warnings on Windows (0efbf18) Message-ID: <20160511120956.9FE573A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0efbf18b80c261708da9ef61bcd420fa94cfed42/ghc >--------------------------------------------------------------- commit 0efbf18b80c261708da9ef61bcd420fa94cfed42 Author: Erik de Castro Lopo Date: Wed May 11 16:17:08 2016 +1000 rts: Fix C compiler warnings on Windows Summary: Specifcally we want the MinGW compiler to use ISO print format specfifiers. Test Plan: Validate on Linux, OS X and Windows Reviewers: Phyx, austin, bgamari, simonmar Reviewed By: bgamari, simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2192 >--------------------------------------------------------------- 0efbf18b80c261708da9ef61bcd420fa94cfed42 includes/stg/Types.h | 5 +++++ rts/Linker.c | 9 ++++++--- rts/Trace.c | 13 +++++++------ 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/includes/stg/Types.h b/includes/stg/Types.h index 1a61c8b..0ad3c5c 100644 --- a/includes/stg/Types.h +++ b/includes/stg/Types.h @@ -21,6 +21,11 @@ #ifndef STGTYPES_H #define STGTYPES_H +#if defined(mingw32_HOST_OS) +/* Inform mingw we want the ISO rather than Windows printf format specifiers. */ +#define __USE_MINGW_ANSI_STDIO 1 +#endif + /* ISO C 99 says: * "C++ implementations should define these macros only when * __STDC_LIMIT_MACROS is defined before is included." diff --git a/rts/Linker.c b/rts/Linker.c index 981df25..09d4f6a 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -3799,9 +3799,12 @@ ocVerifyImage_PEi386 ( ObjectCode* oc ) IF_DEBUG(linker, i=1); if (i == 0) return 1; - debugBelch( "sectab offset = %" FMT_Int "\n", ((UChar*)sectab) - ((UChar*)hdr) ); - debugBelch( "symtab offset = %" FMT_Int "\n", ((UChar*)symtab) - ((UChar*)hdr) ); - debugBelch( "strtab offset = %" FMT_Int "\n", ((UChar*)strtab) - ((UChar*)hdr) ); + debugBelch("sectab offset = %" FMT_SizeT "\n", + ((UChar*)sectab) - ((UChar*)hdr) ); + debugBelch("symtab offset = %" FMT_SizeT "\n", + ((UChar*)symtab) - ((UChar*)hdr) ); + debugBelch("strtab offset = %" FMT_SizeT "\n", + ((UChar*)strtab) - ((UChar*)hdr) ); debugBelch("\n" ); debugBelch( "Machine: 0x%x\n", (UInt32)(hdr->Machine) ); diff --git a/rts/Trace.c b/rts/Trace.c index cf47e16..8480f10 100644 --- a/rts/Trace.c +++ b/rts/Trace.c @@ -424,18 +424,19 @@ void traceCapsetEvent (EventTypeNum tag, tracePreface(); switch (tag) { case EVENT_CAPSET_CREATE: // (capset, capset_type) - debugBelch("created capset %" FMT_Word " of type %d\n", (W_)capset, (int)info); + debugBelch("created capset %" FMT_Word32 " of type %d\n", capset, + (int)info); break; case EVENT_CAPSET_DELETE: // (capset) - debugBelch("deleted capset %" FMT_Word "\n", (W_)capset); + debugBelch("deleted capset %" FMT_Word32 "\n", capset); break; case EVENT_CAPSET_ASSIGN_CAP: // (capset, capno) - debugBelch("assigned cap %" FMT_Word " to capset %" FMT_Word "\n", - (W_)info, (W_)capset); + debugBelch("assigned cap %" FMT_Word " to capset %" FMT_Word32 "\n", + info, capset); break; case EVENT_CAPSET_REMOVE_CAP: // (capset, capno) - debugBelch("removed cap %" FMT_Word " from capset %" FMT_Word "\n", - (W_)info, (W_)capset); + debugBelch("removed cap %" FMT_Word " from capset %" FMT_Word32 + "\n", info, capset); break; } RELEASE_LOCK(&trace_utx); From git at git.haskell.org Wed May 11 13:18:52 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 11 May 2016 13:18:52 +0000 (UTC) Subject: [commit: ghc] master: Handle promotion failures when scavenging a WEAK (#11108) (9363f04) Message-ID: <20160511131852.AC1833A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9363f04d0ff22f3d898af35bb5432c4287e6dc9a/ghc >--------------------------------------------------------------- commit 9363f04d0ff22f3d898af35bb5432c4287e6dc9a Author: Takano Akio Date: Wed May 11 14:45:29 2016 +0200 Handle promotion failures when scavenging a WEAK (#11108) Previously, we ignored promotion failures when evacuating fields of a WEAK object. When a failure happens, this resulted in an WEAK object pointing to another object in a younger generation, causing crashes. I used the test case from #11746 to check that the fix is working. However I haven't managed to produce a test case that quickly reproduces the issue. Test Plan: ./validate Reviewers: austin, bgamari, simonmar Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2189 GHC Trac Issues: #11108 >--------------------------------------------------------------- 9363f04d0ff22f3d898af35bb5432c4287e6dc9a rts/sm/MarkWeak.c | 37 +++++++++++++++++++++++++++++++++++-- rts/sm/MarkWeak.h | 1 + rts/sm/Scav.c | 7 ++++++- 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/rts/sm/MarkWeak.c b/rts/sm/MarkWeak.c index c6ab5b1..2393536 100644 --- a/rts/sm/MarkWeak.c +++ b/rts/sm/MarkWeak.c @@ -25,6 +25,8 @@ #include "Storage.h" #include "Threads.h" +#include "sm/GCUtils.h" +#include "sm/MarkWeak.h" #include "sm/Sanity.h" /* ----------------------------------------------------------------------------- @@ -265,10 +267,25 @@ static rtsBool tidyWeakList(generation *gen) new_gen = Bdescr((P_)w)->gen; gct->evac_gen_no = new_gen->no; + gct->failed_to_evac = rtsFalse; // evacuate the value and finalizer - evacuate(&w->value); - evacuate(&w->finalizer); + // + // This WEAK object will not be considered by tidyWeakList + // during this collection because it is in a generation >= N, + // but it is on the mutable list so we must evacuate all of its + // pointers because some of them may point into a younger + // generation. + scavengeLiveWeak(w); + + if (gct->failed_to_evac) { + debugTrace(DEBUG_weak, + "putting weak pointer %p into mutable list", + w); + gct->failed_to_evac = rtsFalse; + recordMutableGen_GC((StgClosure *)w, new_gen->no); + } + // remove this weak ptr from the old_weak_ptr list *last_w = w->link; next_w = w->link; @@ -418,3 +435,19 @@ markWeakPtrList ( void ) } } +/* ----------------------------------------------------------------------------- + Fully scavenge a known-to-be-alive weak pointer. + + In scavenge_block, we only partially scavenge a weak pointer because it may + turn out to be dead. This function should be called when we decide that the + weak pointer is alive after this GC. + -------------------------------------------------------------------------- */ + +void +scavengeLiveWeak(StgWeak *w) +{ + evacuate(&w->value); + evacuate(&w->key); + evacuate(&w->finalizer); + evacuate(&w->cfinalizers); +} diff --git a/rts/sm/MarkWeak.h b/rts/sm/MarkWeak.h index bd0231d..aabb954 100644 --- a/rts/sm/MarkWeak.h +++ b/rts/sm/MarkWeak.h @@ -24,6 +24,7 @@ void collectFreshWeakPtrs ( void ); void initWeakForGC ( void ); rtsBool traverseWeakPtrList ( void ); void markWeakPtrList ( void ); +void scavengeLiveWeak ( StgWeak * ); #include "EndPrivate.h" diff --git a/rts/sm/Scav.c b/rts/sm/Scav.c index 2fbb8f0..b046f39 100644 --- a/rts/sm/Scav.c +++ b/rts/sm/Scav.c @@ -28,6 +28,8 @@ #include "Capability.h" #include "LdvProfile.h" +#include "sm/MarkWeak.h" + static void scavenge_stack (StgPtr p, StgPtr stack_end); static void scavenge_large_bitmap (StgPtr p, @@ -1286,7 +1288,6 @@ scavenge_one(StgPtr p) case CONSTR_1_1: case CONSTR_0_2: case CONSTR_2_0: - case WEAK: case PRIM: { StgPtr q, end; @@ -1298,6 +1299,10 @@ scavenge_one(StgPtr p) break; } + case WEAK: + scavengeLiveWeak((StgWeak *)p); + break; + case MUT_VAR_CLEAN: case MUT_VAR_DIRTY: { StgPtr q = p; From git at git.haskell.org Wed May 11 15:20:05 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 11 May 2016 15:20:05 +0000 (UTC) Subject: [commit: ghc] master: Remove some varSetElems in dsCmdStmt (0e71988) Message-ID: <20160511152005.7F10A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0e719885f53e20f2e14a94b32d858b47b516a8fc/ghc >--------------------------------------------------------------- commit 0e719885f53e20f2e14a94b32d858b47b516a8fc Author: Bartosz Nitka Date: Wed May 11 07:47:15 2016 -0700 Remove some varSetElems in dsCmdStmt varSetElems introduces unnecessary determinism and it's easy to preserve determinism here. Test Plan: ./validate Reviewers: goldfire, simonmar, austin, bgamari, simonpj Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2195 GHC Trac Issues: #4012 >--------------------------------------------------------------- 0e719885f53e20f2e14a94b32d858b47b516a8fc compiler/deSugar/DsArrows.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/compiler/deSugar/DsArrows.hs b/compiler/deSugar/DsArrows.hs index ea10b74..cdf839a 100644 --- a/compiler/deSugar/DsArrows.hs +++ b/compiler/deSugar/DsArrows.hs @@ -48,6 +48,7 @@ import VarSet import SrcLoc import ListSetOps( assocDefault ) import Data.List +import Util data DsCmdEnv = DsCmdEnv { arr_id, compose_id, first_id, app_id, choice_id, loop_id :: CoreExpr @@ -786,7 +787,7 @@ dsCmdStmt ids local_vars out_ids (BindStmt pat cmd _ _ _) env_ids = do (core_cmd, fv_cmd, env_ids1) <- dsfixCmd ids local_vars unitTy pat_ty cmd let pat_vars = mkVarSet (collectPatBinders pat) let - env_ids2 = varSetElems (mkVarSet out_ids `minusVarSet` pat_vars) + env_ids2 = filterOut (`elemVarSet` pat_vars) out_ids env_ty2 = mkBigCoreVarTupTy env_ids2 -- multiplexing function @@ -863,8 +864,9 @@ dsCmdStmt ids local_vars out_ids , recS_later_rets = later_rets, recS_rec_rets = rec_rets }) env_ids = do let - env2_id_set = mkVarSet out_ids `minusVarSet` mkVarSet later_ids - env2_ids = varSetElems env2_id_set + later_ids_set = mkVarSet later_ids + env2_ids = filterOut (`elemVarSet` later_ids_set) out_ids + env2_id_set = mkVarSet env2_ids env2_ty = mkBigCoreVarTupTy env2_ids -- post_loop_fn = \((later_ids),(env2_ids)) -> (out_ids) From git at git.haskell.org Wed May 11 15:20:08 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 11 May 2016 15:20:08 +0000 (UTC) Subject: [commit: ghc] master: Document SCC determinism (3edbd09) Message-ID: <20160511152008.424983A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3edbd091341ab0ab60862ba18d3107f34c7fc876/ghc >--------------------------------------------------------------- commit 3edbd091341ab0ab60862ba18d3107f34c7fc876 Author: Bartosz Nitka Date: Wed May 11 07:47:47 2016 -0700 Document SCC determinism I've documented the guarantees that stronglyConnCompFromEdgedVertices provides and commented on the call sites to explain why they are OK from determinism standpoint. I've changed the functions to nonDetUFM versions, so that it's explicit they could introduce nondeterminism. I haven't defined container (VarSet, NameSet) specific versions, so that we have less functions to worry about. Test Plan: this is mostly just documentation, it should have no runtime effect Reviewers: bgamari, simonmar, austin, simonpj Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2194 GHC Trac Issues: #4012 >--------------------------------------------------------------- 3edbd091341ab0ab60862ba18d3107f34c7fc876 compiler/basicTypes/NameEnv.hs | 10 ++++++++++ compiler/iface/MkIface.hs | 8 +++++++- compiler/rename/RnBinds.hs | 5 ++++- compiler/rename/RnSource.hs | 7 ++++++- compiler/simplCore/OccurAnal.hs | 11 +++++++++-- compiler/typecheck/TcBinds.hs | 6 +++++- compiler/typecheck/TcEvidence.hs | 8 ++++++-- compiler/typecheck/TcSMonad.hs | 6 +++++- compiler/typecheck/TcTyDecls.hs | 23 ++++++++++++++++++++--- compiler/utils/Digraph.hs | 15 +++++++++++++++ compiler/utils/UniqFM.hs | 12 ++++++++++-- compiler/vectorise/Vectorise/Type/Classify.hs | 6 +++++- 12 files changed, 102 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 3edbd091341ab0ab60862ba18d3107f34c7fc876 From git at git.haskell.org Wed May 11 15:37:33 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 11 May 2016 15:37:33 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: relnotes: Fix ticket number yet again (046f3a0) Message-ID: <20160511153733.5B4633A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/046f3a0700c3448d7425b754e40432898cd1dc38/ghc >--------------------------------------------------------------- commit 046f3a0700c3448d7425b754e40432898cd1dc38 Author: Ben Gamari Date: Wed May 11 10:10:04 2016 +0200 relnotes: Fix ticket number yet again >--------------------------------------------------------------- 046f3a0700c3448d7425b754e40432898cd1dc38 docs/users_guide/8.0.1-notes.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/users_guide/8.0.1-notes.rst b/docs/users_guide/8.0.1-notes.rst index f6714af..889142b 100644 --- a/docs/users_guide/8.0.1-notes.rst +++ b/docs/users_guide/8.0.1-notes.rst @@ -801,4 +801,4 @@ Known bugs - The Haddock release shipped with the release currently does not show :ref:`bundled pattern synonyms ` in generated documentation - (:ghc-ticket:`11955`). + (:ghc-ticket:`11954`). From git at git.haskell.org Wed May 11 15:37:36 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 11 May 2016 15:37:36 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: configure.ac: Prepare for 8.0.1 release (e99c1e2) Message-ID: <20160511153736.07E903A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/e99c1e2516aeb283172c7e6898508238e33cf065/ghc >--------------------------------------------------------------- commit e99c1e2516aeb283172c7e6898508238e33cf065 Author: Ben Gamari Date: Tue May 10 23:48:38 2016 +0200 configure.ac: Prepare for 8.0.1 release >--------------------------------------------------------------- e99c1e2516aeb283172c7e6898508238e33cf065 configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 271c216..2a9390d 100644 --- a/configure.ac +++ b/configure.ac @@ -13,10 +13,10 @@ dnl # see what flags are available. (Better yet, read the documentation!) # -AC_INIT([The Glorious Glasgow Haskell Compilation System], [8.0.0], [glasgow-haskell-bugs at haskell.org], [ghc-AC_PACKAGE_VERSION]) +AC_INIT([The Glorious Glasgow Haskell Compilation System], [8.0.1], [glasgow-haskell-bugs at haskell.org], [ghc-AC_PACKAGE_VERSION]) # Set this to YES for a released version, otherwise NO -: ${RELEASE=NO} +: ${RELEASE=YES} # The primary version (e.g. 7.5, 7.4.1) is set in the AC_INIT line # above. If this is not a released version, then we will append the From git at git.haskell.org Wed May 11 15:37:38 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 11 May 2016 15:37:38 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Handle promotion failures when scavenging a WEAK (#11108) (0e12124) Message-ID: <20160511153738.B07303A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/0e12124320f0e09a56813fe6361e61043667db53/ghc >--------------------------------------------------------------- commit 0e12124320f0e09a56813fe6361e61043667db53 Author: Takano Akio Date: Wed May 11 14:45:29 2016 +0200 Handle promotion failures when scavenging a WEAK (#11108) Previously, we ignored promotion failures when evacuating fields of a WEAK object. When a failure happens, this resulted in an WEAK object pointing to another object in a younger generation, causing crashes. I used the test case from #11746 to check that the fix is working. However I haven't managed to produce a test case that quickly reproduces the issue. Test Plan: ./validate Reviewers: austin, bgamari, simonmar Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2189 GHC Trac Issues: #11108 (cherry picked from commit 9363f04d0ff22f3d898af35bb5432c4287e6dc9a) >--------------------------------------------------------------- 0e12124320f0e09a56813fe6361e61043667db53 rts/sm/MarkWeak.c | 37 +++++++++++++++++++++++++++++++++++-- rts/sm/MarkWeak.h | 1 + rts/sm/Scav.c | 7 ++++++- 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/rts/sm/MarkWeak.c b/rts/sm/MarkWeak.c index 9a32198..bb6309d 100644 --- a/rts/sm/MarkWeak.c +++ b/rts/sm/MarkWeak.c @@ -25,6 +25,8 @@ #include "Storage.h" #include "Threads.h" +#include "sm/GCUtils.h" +#include "sm/MarkWeak.h" #include "sm/Sanity.h" /* ----------------------------------------------------------------------------- @@ -265,10 +267,25 @@ static rtsBool tidyWeakList(generation *gen) new_gen = Bdescr((P_)w)->gen; gct->evac_gen_no = new_gen->no; + gct->failed_to_evac = rtsFalse; // evacuate the value and finalizer - evacuate(&w->value); - evacuate(&w->finalizer); + // + // This WEAK object will not be considered by tidyWeakList + // during this collection because it is in a generation >= N, + // but it is on the mutable list so we must evacuate all of its + // pointers because some of them may point into a younger + // generation. + scavengeLiveWeak(w); + + if (gct->failed_to_evac) { + debugTrace(DEBUG_weak, + "putting weak pointer %p into mutable list", + w); + gct->failed_to_evac = rtsFalse; + recordMutableGen_GC((StgClosure *)w, new_gen->no); + } + // remove this weak ptr from the old_weak_ptr list *last_w = w->link; next_w = w->link; @@ -422,3 +439,19 @@ markWeakPtrList ( void ) } } +/* ----------------------------------------------------------------------------- + Fully scavenge a known-to-be-alive weak pointer. + + In scavenge_block, we only partially scavenge a weak pointer because it may + turn out to be dead. This function should be called when we decide that the + weak pointer is alive after this GC. + -------------------------------------------------------------------------- */ + +void +scavengeLiveWeak(StgWeak *w) +{ + evacuate(&w->value); + evacuate(&w->key); + evacuate(&w->finalizer); + evacuate(&w->cfinalizers); +} diff --git a/rts/sm/MarkWeak.h b/rts/sm/MarkWeak.h index bd0231d..aabb954 100644 --- a/rts/sm/MarkWeak.h +++ b/rts/sm/MarkWeak.h @@ -24,6 +24,7 @@ void collectFreshWeakPtrs ( void ); void initWeakForGC ( void ); rtsBool traverseWeakPtrList ( void ); void markWeakPtrList ( void ); +void scavengeLiveWeak ( StgWeak * ); #include "EndPrivate.h" diff --git a/rts/sm/Scav.c b/rts/sm/Scav.c index a28d842..de098d2 100644 --- a/rts/sm/Scav.c +++ b/rts/sm/Scav.c @@ -28,6 +28,8 @@ #include "Capability.h" #include "LdvProfile.h" +#include "sm/MarkWeak.h" + static void scavenge_stack (StgPtr p, StgPtr stack_end); static void scavenge_large_bitmap (StgPtr p, @@ -1293,7 +1295,6 @@ scavenge_one(StgPtr p) case CONSTR_1_1: case CONSTR_0_2: case CONSTR_2_0: - case WEAK: case PRIM: case IND_PERM: { @@ -1306,6 +1307,10 @@ scavenge_one(StgPtr p) break; } + case WEAK: + scavengeLiveWeak((StgWeak *)p); + break; + case MUT_VAR_CLEAN: case MUT_VAR_DIRTY: { StgPtr q = p; From git at git.haskell.org Wed May 11 16:02:00 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 11 May 2016 16:02:00 +0000 (UTC) Subject: [commit: ghc] master: Fix ASSERT failure and re-enable setnumcapabilities001 (cfc5df4) Message-ID: <20160511160200.3B9DC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cfc5df43a7789832a2789e517d8270650cc31b7f/ghc >--------------------------------------------------------------- commit cfc5df43a7789832a2789e517d8270650cc31b7f Author: Simon Marlow Date: Wed May 11 15:38:25 2016 +0100 Fix ASSERT failure and re-enable setnumcapabilities001 The assertion failure was fairly benign, I think, but this fixes it. I've been running the test repeatedly for the last 30 mins and it hasn't triggered. There are other problems exposed by this test (see #12038), but I've worked around those in the test itself for now. I also copied the relevant bits of the parallel library here so that we don't need parallel for the test to run. >--------------------------------------------------------------- cfc5df43a7789832a2789e517d8270650cc31b7f rts/Schedule.c | 7 ++- testsuite/tests/concurrent/should_run/all.T | 13 ++--- .../concurrent/should_run/setnumcapabilities001.hs | 55 ++++++++++++++++++++-- 3 files changed, 62 insertions(+), 13 deletions(-) diff --git a/rts/Schedule.c b/rts/Schedule.c index d077ce2..0db9ff8 100644 --- a/rts/Schedule.c +++ b/rts/Schedule.c @@ -1626,11 +1626,14 @@ scheduleDoGC (Capability **pcap, Task *task USED_IF_THREADS, if (was_syncing) { stgFree(idle_cap); } - if (was_syncing && (prev_sync == SYNC_GC_SEQ || - prev_sync == SYNC_GC_PAR)) { + if (was_syncing && + (prev_sync == SYNC_GC_SEQ || prev_sync == SYNC_GC_PAR) && + !(sched_state == SCHED_INTERRUPTING && force_major)) { // someone else had a pending sync request for a GC, so // let's assume GC has been done and we don't need to GC // again. + // Exception to this: if SCHED_INTERRUPTING, then we still + // need to do the final GC. return; } if (sched_state == SCHED_SHUTTING_DOWN) { diff --git a/testsuite/tests/concurrent/should_run/all.T b/testsuite/tests/concurrent/should_run/all.T index cc3440e..3d5e08b 100644 --- a/testsuite/tests/concurrent/should_run/all.T +++ b/testsuite/tests/concurrent/should_run/all.T @@ -244,14 +244,11 @@ test('conc067', ignore_output, compile_and_run, ['']) # than one CPU. test('conc068', [ omit_ways('threaded2'), exit_code(1) ], compile_and_run, ['']) -# Commented out, instead of marked expect_broken, because it fails only -# sometimes. See #10860. -#test('setnumcapabilities001', -# [ only_ways(['threaded1','threaded2']), -# extra_run_opts('4 12 2000'), -# reqlib('parallel'), -# req_smp ], -# compile_and_run, ['']) +test('setnumcapabilities001', + [ only_ways(['threaded1','threaded2']), + extra_run_opts('4 12 2000'), + req_smp ], + compile_and_run, ['']) # omit ghci, which can't handle unboxed tuples: test('compareAndSwap', [omit_ways(['ghci','hpc']), reqlib('primitive')], compile_and_run, ['']) diff --git a/testsuite/tests/concurrent/should_run/setnumcapabilities001.hs b/testsuite/tests/concurrent/should_run/setnumcapabilities001.hs index 1927cd8..27685f0 100644 --- a/testsuite/tests/concurrent/should_run/setnumcapabilities001.hs +++ b/testsuite/tests/concurrent/should_run/setnumcapabilities001.hs @@ -1,19 +1,25 @@ +{-# LANGUAGE MagicHash, UnboxedTuples #-} + import GHC.Conc -import Control.Parallel -import Control.Parallel.Strategies +import GHC.Prim import System.Environment import System.IO import Control.Monad import Text.Printf import Data.Time.Clock +import Control.DeepSeq main = do [n,q,t] <- fmap (fmap read) getArgs - forkIO $ do + t <- forkIO $ do forM_ (cycle ([n,n-1..1] ++ [2..n-1])) $ \m -> do setNumCapabilities m threadDelay t printf "%d" (nqueens q) + killThread t + -- If we don't kill the child thread, it might be about to + -- call setNumCapabilities() in C when the main thread exits, + -- and chaos can ensue. See #12038 nqueens :: Int -> Int nqueens nq = length (pargen 0 []) @@ -32,3 +38,46 @@ nqueens nq = length (pargen 0 []) where bs = map (pargen (n+1)) (gen [b]) `using` parList rdeepseq threshold = 3 + +using :: a -> Strategy a -> a +x `using` strat = runEval (strat x) + +type Strategy a = a -> Eval a + +newtype Eval a = Eval (State# RealWorld -> (# State# RealWorld, a #)) + +runEval :: Eval a -> a +runEval (Eval x) = case x realWorld# of (# _, a #) -> a + +instance Functor Eval where + fmap = liftM + +instance Applicative Eval where + pure x = Eval $ \s -> (# s, x #) + (<*>) = ap + +instance Monad Eval where + return = pure + Eval x >>= k = Eval $ \s -> case x s of + (# s', a #) -> case k a of + Eval f -> f s' + +parList :: Strategy a -> Strategy [a] +parList strat = traverse (rparWith strat) + +rpar :: Strategy a +rpar x = Eval $ \s -> spark# x s + +rseq :: Strategy a +rseq x = Eval $ \s -> seq# x s + +rparWith :: Strategy a -> Strategy a +rparWith s a = do l <- rpar r; return (case l of Lift x -> x) + where r = case s a of + Eval f -> case f realWorld# of + (# _, a' #) -> Lift a' + +data Lift a = Lift a + +rdeepseq :: NFData a => Strategy a +rdeepseq x = do rseq (rnf x); return x From git at git.haskell.org Wed May 11 16:02:02 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 11 May 2016 16:02:02 +0000 (UTC) Subject: [commit: ghc] master: Make random an "extra" package (2a0d00d) Message-ID: <20160511160202.DC56A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2a0d00d29dc7a0c43da5150b6d38546e5bea8eda/ghc >--------------------------------------------------------------- commit 2a0d00d29dc7a0c43da5150b6d38546e5bea8eda Author: Simon Marlow Date: Wed May 11 16:01:05 2016 +0100 Make random an "extra" package It will get built as part of "validate --slow". We have 11 tests that depend on random, so this enables more tests to work. >--------------------------------------------------------------- 2a0d00d29dc7a0c43da5150b6d38546e5bea8eda packages | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages b/packages index c621a67..f368065 100644 --- a/packages +++ b/packages @@ -63,7 +63,7 @@ libraries/xhtml - - https:/ nofib nofib - - libraries/parallel extra - ssh://git at github.com/haskell/parallel.git libraries/stm extra - - -libraries/random dph - https://github.com/haskell/random.git +libraries/random extra - https://github.com/haskell/random.git libraries/primitive dph - https://github.com/haskell/primitive.git libraries/vector dph - https://github.com/haskell/vector.git libraries/dph dph - - From git at git.haskell.org Wed May 11 16:02:05 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 11 May 2016 16:02:05 +0000 (UTC) Subject: [commit: ghc] master: Remove a copy of System.Random and use reqlib('random') (86a1f20) Message-ID: <20160511160205.926F33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/86a1f20808a41c58345f72024facbcfc5d873f7d/ghc >--------------------------------------------------------------- commit 86a1f20808a41c58345f72024facbcfc5d873f7d Author: Simon Marlow Date: Wed May 11 16:05:46 2016 +0100 Remove a copy of System.Random and use reqlib('random') >--------------------------------------------------------------- 86a1f20808a41c58345f72024facbcfc5d873f7d testsuite/tests/concurrent/should_run/RandomPGC.hs | 597 --------------------- testsuite/tests/concurrent/should_run/all.T | 5 +- testsuite/tests/concurrent/should_run/performGC.hs | 2 +- 3 files changed, 4 insertions(+), 600 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 86a1f20808a41c58345f72024facbcfc5d873f7d From git at git.haskell.org Wed May 11 23:37:18 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 11 May 2016 23:37:18 +0000 (UTC) Subject: [commit: ghc] branch 'wip/erikd/t11978b' deleted Message-ID: <20160511233718.DCC5E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Deleted branch: wip/erikd/t11978b From git at git.haskell.org Thu May 12 01:28:19 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 12 May 2016 01:28:19 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: RtsUtils: Use `size_t` instead of `int` where appropriate (0e1f893) Message-ID: <20160512012819.D94FA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/0e1f893949bc85ec58fa90ca2cb8dafe7e4c84db/ghc >--------------------------------------------------------------- commit 0e1f893949bc85ec58fa90ca2cb8dafe7e4c84db Author: Erik de Castro Lopo Date: Mon May 2 20:07:05 2016 +1000 RtsUtils: Use `size_t` instead of `int` where appropriate Functions like `stgMallocBytes` take a size parameter which was of type `int`, but is commonly used as `stgMallocBytes (sizeof (...))`. This is problematic because the `sizeof` operator returns `size_t` so that on 64 bit systems, in this common use case the `size_t` parameter would be truncated to 32 bits when passed to `stgMallocBytes` where it was cast back to `size_t`. >--------------------------------------------------------------- 0e1f893949bc85ec58fa90ca2cb8dafe7e4c84db rts/RtsUtils.c | 22 +++++++++------------- rts/RtsUtils.h | 6 +++--- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/rts/RtsUtils.c b/rts/RtsUtils.c index c837143..716d203 100644 --- a/rts/RtsUtils.c +++ b/rts/RtsUtils.c @@ -57,13 +57,11 @@ extern char *ctime_r(const time_t *, char *); -------------------------------------------------------------------------- */ void * -stgMallocBytes (int n, char *msg) +stgMallocBytes (size_t n, char *msg) { - char *space; - size_t n2; + void *space; - n2 = (size_t) n; - if ((space = (char *) malloc(n2)) == NULL) { + if ((space = malloc(n)) == NULL) { /* Quoting POSIX.1-2008 (which says more or less the same as ISO C99): * * "Upon successful completion with size not equal to 0, malloc() shall @@ -85,13 +83,11 @@ stgMallocBytes (int n, char *msg) } void * -stgReallocBytes (void *p, int n, char *msg) +stgReallocBytes (void *p, size_t n, char *msg) { - char *space; - size_t n2; + void *space; - n2 = (size_t) n; - if ((space = (char *) realloc(p, (size_t) n2)) == NULL) { + if ((space = realloc(p, n)) == NULL) { /* don't fflush(stdout); WORKAROUND bug in Linux glibc */ rtsConfig.mallocFailHook((W_) n, msg); /*msg*/ stg_exit(EXIT_INTERNAL_ERROR); @@ -100,11 +96,11 @@ stgReallocBytes (void *p, int n, char *msg) } void * -stgCallocBytes (int n, int m, char *msg) +stgCallocBytes (size_t n, size_t m, char *msg) { - char *space; + void *space; - if ((space = (char *) calloc((size_t) n, (size_t) m)) == NULL) { + if ((space = calloc(n, m)) == NULL) { /* don't fflush(stdout); WORKAROUND bug in Linux glibc */ rtsConfig.mallocFailHook((W_) n*m, msg); /*msg*/ stg_exit(EXIT_INTERNAL_ERROR); diff --git a/rts/RtsUtils.h b/rts/RtsUtils.h index d76c921..2d5e5de 100644 --- a/rts/RtsUtils.h +++ b/rts/RtsUtils.h @@ -18,12 +18,12 @@ void initAllocator(void); void shutdownAllocator(void); -void *stgMallocBytes(int n, char *msg) +void *stgMallocBytes(size_t n, char *msg) GNUC3_ATTRIBUTE(__malloc__); -void *stgReallocBytes(void *p, int n, char *msg); +void *stgReallocBytes(void *p, size_t n, char *msg); -void *stgCallocBytes(int n, int m, char *msg) +void *stgCallocBytes(size_t n, size_t m, char *msg) GNUC3_ATTRIBUTE(__malloc__); char *stgStrndup(const char *s, size_t n); From git at git.haskell.org Thu May 12 01:28:22 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 12 May 2016 01:28:22 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: rts: Make function pointer parameters `const` where possible (cea63c2) Message-ID: <20160512012822.8423E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/cea63c2170034e1a705635d6bb7d877cf967bef3/ghc >--------------------------------------------------------------- commit cea63c2170034e1a705635d6bb7d877cf967bef3 Author: Erik de Castro Lopo Date: Mon May 9 21:14:50 2016 +1000 rts: Make function pointer parameters `const` where possible If a function takes a pointer parameter and doesn't update what the pointer points to, we can add `const` to the parameter declaration to document that no updates occur. >--------------------------------------------------------------- cea63c2170034e1a705635d6bb7d877cf967bef3 includes/rts/storage/ClosureMacros.h | 16 ++++++++-------- rts/Capability.h | 4 ++-- rts/LdvProfile.c | 2 +- rts/ProfHeap.c | 8 ++++---- rts/RetainerProfile.h | 2 +- rts/sm/Sanity.c | 6 +++--- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/includes/rts/storage/ClosureMacros.h b/includes/rts/storage/ClosureMacros.h index d7ae5ea..5ed6928 100644 --- a/includes/rts/storage/ClosureMacros.h +++ b/includes/rts/storage/ClosureMacros.h @@ -194,13 +194,13 @@ INLINE_HEADER P_ INTLIKE_CLOSURE(int n) { ------------------------------------------------------------------------- */ static inline StgWord -GET_CLOSURE_TAG(StgClosure * p) +GET_CLOSURE_TAG(const StgClosure * p) { return (StgWord)p & TAG_MASK; } static inline StgClosure * -UNTAG_CLOSURE(StgClosure * p) +UNTAG_CLOSURE(const StgClosure * p) { return (StgClosure*)((StgWord)p & ~TAG_MASK); } @@ -247,7 +247,7 @@ INLINE_HEADER rtsBool LOOKS_LIKE_INFO_PTR (StgWord p) return (p && (IS_FORWARDING_PTR(p) || LOOKS_LIKE_INFO_PTR_NOT_NULL(p))) ? rtsTrue : rtsFalse; } -INLINE_HEADER rtsBool LOOKS_LIKE_CLOSURE_PTR (void *p) +INLINE_HEADER rtsBool LOOKS_LIKE_CLOSURE_PTR (const void *p) { return LOOKS_LIKE_INFO_PTR((StgWord)(UNTAG_CLOSURE((StgClosure *)(p)))->header.info); } @@ -337,9 +337,9 @@ EXTERN_INLINE StgWord bco_sizeW ( StgBCO *bco ) * * (Also for 'closure_sizeW' below) */ -EXTERN_INLINE uint32_t closure_sizeW_ (StgClosure *p, StgInfoTable *info); +EXTERN_INLINE uint32_t closure_sizeW_ (const StgClosure *p, StgInfoTable *info); EXTERN_INLINE uint32_t -closure_sizeW_ (StgClosure *p, StgInfoTable *info) +closure_sizeW_ (const StgClosure *p, StgInfoTable *info) { switch (info->type) { case THUNK_0_1: @@ -399,8 +399,8 @@ closure_sizeW_ (StgClosure *p, StgInfoTable *info) } // The definitive way to find the size, in words, of a heap-allocated closure -EXTERN_INLINE uint32_t closure_sizeW (StgClosure *p); -EXTERN_INLINE uint32_t closure_sizeW (StgClosure *p) +EXTERN_INLINE uint32_t closure_sizeW (const StgClosure *p); +EXTERN_INLINE uint32_t closure_sizeW (const StgClosure *p) { return closure_sizeW_(p, get_itbl(p)); } @@ -505,7 +505,7 @@ INLINE_HEADER StgWord8 *mutArrPtrsCard (StgMutArrPtrs *a, W_ n) #endif #ifdef PROFILING -void LDV_recordDead (StgClosure *c, uint32_t size); +void LDV_recordDead (const StgClosure *c, uint32_t size); #endif EXTERN_INLINE void overwritingClosure (StgClosure *p); diff --git a/rts/Capability.h b/rts/Capability.h index 46ae8b9..22c1d2a 100644 --- a/rts/Capability.h +++ b/rts/Capability.h @@ -260,7 +260,7 @@ extern PendingSync * volatile pending_sync; // void waitForCapability (Capability **cap/*in/out*/, Task *task); -EXTERN_INLINE void recordMutableCap (StgClosure *p, Capability *cap, +EXTERN_INLINE void recordMutableCap (const StgClosure *p, Capability *cap, uint32_t gen); EXTERN_INLINE void recordClosureMutated (Capability *cap, StgClosure *p); @@ -354,7 +354,7 @@ INLINE_HEADER rtsBool emptyInbox(Capability *cap); * -------------------------------------------------------------------------- */ EXTERN_INLINE void -recordMutableCap (StgClosure *p, Capability *cap, uint32_t gen) +recordMutableCap (const StgClosure *p, Capability *cap, uint32_t gen) { bdescr *bd; diff --git a/rts/LdvProfile.c b/rts/LdvProfile.c index 1dfdc56..428078b 100644 --- a/rts/LdvProfile.c +++ b/rts/LdvProfile.c @@ -28,7 +28,7 @@ * header portion, so that the caller can find the next closure. * ----------------------------------------------------------------------- */ STATIC_INLINE uint32_t -processHeapClosureForDead( StgClosure *c ) +processHeapClosureForDead( const StgClosure *c ) { uint32_t size; const StgInfoTable *info; diff --git a/rts/ProfHeap.c b/rts/ProfHeap.c index def490d..e98704d 100644 --- a/rts/ProfHeap.c +++ b/rts/ProfHeap.c @@ -96,7 +96,7 @@ static void aggregateCensusInfo( void ); static void dumpCensus( Census *census ); -static rtsBool closureSatisfiesConstraints( StgClosure* p ); +static rtsBool closureSatisfiesConstraints( const StgClosure* p ); /* ---------------------------------------------------------------------------- * Find the "closure identity", which is a unique pointer representing @@ -104,7 +104,7 @@ static rtsBool closureSatisfiesConstraints( StgClosure* p ); * heap profile. * ------------------------------------------------------------------------- */ static void * -closureIdentity( StgClosure *p ) +closureIdentity( const StgClosure *p ) { switch (RtsFlags.ProfFlags.doHeapProfile) { @@ -181,7 +181,7 @@ doingRetainerProfiling( void ) #ifdef PROFILING void -LDV_recordDead( StgClosure *c, uint32_t size ) +LDV_recordDead( const StgClosure *c, uint32_t size ) { void *id; uint32_t t; @@ -576,7 +576,7 @@ strMatchesSelector( const char* str, const char* sel ) * testing against all the specified constraints. * -------------------------------------------------------------------------- */ static rtsBool -closureSatisfiesConstraints( StgClosure* p ) +closureSatisfiesConstraints( const StgClosure* p ) { #if !defined(PROFILING) (void)p; /* keep gcc -Wall happy */ diff --git a/rts/RetainerProfile.h b/rts/RetainerProfile.h index d92563f..180c4e2 100644 --- a/rts/RetainerProfile.h +++ b/rts/RetainerProfile.h @@ -33,7 +33,7 @@ extern StgWord flip; ((((StgWord)(c)->header.prof.hp.rs & 1) ^ flip) == 0) static inline RetainerSet * -retainerSetOf( StgClosure *c ) +retainerSetOf( const StgClosure *c ) { ASSERT( isRetainerSetFieldValid(c) ); // StgWord has the same size as pointers, so the following type diff --git a/rts/sm/Sanity.c b/rts/sm/Sanity.c index 794bce7..2abe56b 100644 --- a/rts/sm/Sanity.c +++ b/rts/sm/Sanity.c @@ -35,7 +35,7 @@ static void checkSmallBitmap ( StgPtr payload, StgWord bitmap, uint32_t ); static void checkLargeBitmap ( StgPtr payload, StgLargeBitmap*, uint32_t ); -static void checkClosureShallow ( StgClosure * ); +static void checkClosureShallow ( const StgClosure * ); static void checkSTACK (StgStack *stack); /* ----------------------------------------------------------------------------- @@ -79,9 +79,9 @@ checkLargeBitmap( StgPtr payload, StgLargeBitmap* large_bitmap, uint32_t size ) */ static void -checkClosureShallow( StgClosure* p ) +checkClosureShallow( const StgClosure* p ) { - StgClosure *q; + const StgClosure *q; q = UNTAG_CLOSURE(p); ASSERT(LOOKS_LIKE_CLOSURE_PTR(q)); From git at git.haskell.org Thu May 12 01:28:24 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 12 May 2016 01:28:24 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat's head updated: rts: Make function pointer parameters `const` where possible (cea63c2) Message-ID: <20160512012824.D14EF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/erikd/remove-nat' now includes: 8669c48 Document why closeOverKind is OK for determinism 584ade6 RtsFlags: Make `mallocFailHook` const correct 0efbf18 rts: Fix C compiler warnings on Windows 9363f04 Handle promotion failures when scavenging a WEAK (#11108) 0e71988 Remove some varSetElems in dsCmdStmt 3edbd09 Document SCC determinism cfc5df4 Fix ASSERT failure and re-enable setnumcapabilities001 2a0d00d Make random an "extra" package 86a1f20 Remove a copy of System.Random and use reqlib('random') 0e1f893 RtsUtils: Use `size_t` instead of `int` where appropriate cea63c2 rts: Make function pointer parameters `const` where possible From git at git.haskell.org Thu May 12 02:44:11 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 12 May 2016 02:44:11 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: rts: Make function pointer parameters `const` where possible (a02dc15) Message-ID: <20160512024411.41FF83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/a02dc159ad8401b0f96fc4d418c86078f353cb81/ghc >--------------------------------------------------------------- commit a02dc159ad8401b0f96fc4d418c86078f353cb81 Author: Erik de Castro Lopo Date: Mon May 9 21:14:50 2016 +1000 rts: Make function pointer parameters `const` where possible If a function takes a pointer parameter and doesn't update what the pointer points to, we can add `const` to the parameter declaration to document that no updates occur. >--------------------------------------------------------------- a02dc159ad8401b0f96fc4d418c86078f353cb81 includes/rts/storage/ClosureMacros.h | 16 ++++++++-------- rts/Capability.h | 4 ++-- rts/LdvProfile.c | 2 +- rts/ProfHeap.c | 8 ++++---- rts/RetainerProfile.h | 2 +- rts/sm/HeapAlloc.h | 4 ++-- rts/sm/MBlock.c | 4 ++-- rts/sm/Sanity.c | 6 +++--- 8 files changed, 23 insertions(+), 23 deletions(-) diff --git a/includes/rts/storage/ClosureMacros.h b/includes/rts/storage/ClosureMacros.h index d7ae5ea..5ed6928 100644 --- a/includes/rts/storage/ClosureMacros.h +++ b/includes/rts/storage/ClosureMacros.h @@ -194,13 +194,13 @@ INLINE_HEADER P_ INTLIKE_CLOSURE(int n) { ------------------------------------------------------------------------- */ static inline StgWord -GET_CLOSURE_TAG(StgClosure * p) +GET_CLOSURE_TAG(const StgClosure * p) { return (StgWord)p & TAG_MASK; } static inline StgClosure * -UNTAG_CLOSURE(StgClosure * p) +UNTAG_CLOSURE(const StgClosure * p) { return (StgClosure*)((StgWord)p & ~TAG_MASK); } @@ -247,7 +247,7 @@ INLINE_HEADER rtsBool LOOKS_LIKE_INFO_PTR (StgWord p) return (p && (IS_FORWARDING_PTR(p) || LOOKS_LIKE_INFO_PTR_NOT_NULL(p))) ? rtsTrue : rtsFalse; } -INLINE_HEADER rtsBool LOOKS_LIKE_CLOSURE_PTR (void *p) +INLINE_HEADER rtsBool LOOKS_LIKE_CLOSURE_PTR (const void *p) { return LOOKS_LIKE_INFO_PTR((StgWord)(UNTAG_CLOSURE((StgClosure *)(p)))->header.info); } @@ -337,9 +337,9 @@ EXTERN_INLINE StgWord bco_sizeW ( StgBCO *bco ) * * (Also for 'closure_sizeW' below) */ -EXTERN_INLINE uint32_t closure_sizeW_ (StgClosure *p, StgInfoTable *info); +EXTERN_INLINE uint32_t closure_sizeW_ (const StgClosure *p, StgInfoTable *info); EXTERN_INLINE uint32_t -closure_sizeW_ (StgClosure *p, StgInfoTable *info) +closure_sizeW_ (const StgClosure *p, StgInfoTable *info) { switch (info->type) { case THUNK_0_1: @@ -399,8 +399,8 @@ closure_sizeW_ (StgClosure *p, StgInfoTable *info) } // The definitive way to find the size, in words, of a heap-allocated closure -EXTERN_INLINE uint32_t closure_sizeW (StgClosure *p); -EXTERN_INLINE uint32_t closure_sizeW (StgClosure *p) +EXTERN_INLINE uint32_t closure_sizeW (const StgClosure *p); +EXTERN_INLINE uint32_t closure_sizeW (const StgClosure *p) { return closure_sizeW_(p, get_itbl(p)); } @@ -505,7 +505,7 @@ INLINE_HEADER StgWord8 *mutArrPtrsCard (StgMutArrPtrs *a, W_ n) #endif #ifdef PROFILING -void LDV_recordDead (StgClosure *c, uint32_t size); +void LDV_recordDead (const StgClosure *c, uint32_t size); #endif EXTERN_INLINE void overwritingClosure (StgClosure *p); diff --git a/rts/Capability.h b/rts/Capability.h index 46ae8b9..22c1d2a 100644 --- a/rts/Capability.h +++ b/rts/Capability.h @@ -260,7 +260,7 @@ extern PendingSync * volatile pending_sync; // void waitForCapability (Capability **cap/*in/out*/, Task *task); -EXTERN_INLINE void recordMutableCap (StgClosure *p, Capability *cap, +EXTERN_INLINE void recordMutableCap (const StgClosure *p, Capability *cap, uint32_t gen); EXTERN_INLINE void recordClosureMutated (Capability *cap, StgClosure *p); @@ -354,7 +354,7 @@ INLINE_HEADER rtsBool emptyInbox(Capability *cap); * -------------------------------------------------------------------------- */ EXTERN_INLINE void -recordMutableCap (StgClosure *p, Capability *cap, uint32_t gen) +recordMutableCap (const StgClosure *p, Capability *cap, uint32_t gen) { bdescr *bd; diff --git a/rts/LdvProfile.c b/rts/LdvProfile.c index 1dfdc56..428078b 100644 --- a/rts/LdvProfile.c +++ b/rts/LdvProfile.c @@ -28,7 +28,7 @@ * header portion, so that the caller can find the next closure. * ----------------------------------------------------------------------- */ STATIC_INLINE uint32_t -processHeapClosureForDead( StgClosure *c ) +processHeapClosureForDead( const StgClosure *c ) { uint32_t size; const StgInfoTable *info; diff --git a/rts/ProfHeap.c b/rts/ProfHeap.c index def490d..e98704d 100644 --- a/rts/ProfHeap.c +++ b/rts/ProfHeap.c @@ -96,7 +96,7 @@ static void aggregateCensusInfo( void ); static void dumpCensus( Census *census ); -static rtsBool closureSatisfiesConstraints( StgClosure* p ); +static rtsBool closureSatisfiesConstraints( const StgClosure* p ); /* ---------------------------------------------------------------------------- * Find the "closure identity", which is a unique pointer representing @@ -104,7 +104,7 @@ static rtsBool closureSatisfiesConstraints( StgClosure* p ); * heap profile. * ------------------------------------------------------------------------- */ static void * -closureIdentity( StgClosure *p ) +closureIdentity( const StgClosure *p ) { switch (RtsFlags.ProfFlags.doHeapProfile) { @@ -181,7 +181,7 @@ doingRetainerProfiling( void ) #ifdef PROFILING void -LDV_recordDead( StgClosure *c, uint32_t size ) +LDV_recordDead( const StgClosure *c, uint32_t size ) { void *id; uint32_t t; @@ -576,7 +576,7 @@ strMatchesSelector( const char* str, const char* sel ) * testing against all the specified constraints. * -------------------------------------------------------------------------- */ static rtsBool -closureSatisfiesConstraints( StgClosure* p ) +closureSatisfiesConstraints( const StgClosure* p ) { #if !defined(PROFILING) (void)p; /* keep gcc -Wall happy */ diff --git a/rts/RetainerProfile.h b/rts/RetainerProfile.h index d92563f..180c4e2 100644 --- a/rts/RetainerProfile.h +++ b/rts/RetainerProfile.h @@ -33,7 +33,7 @@ extern StgWord flip; ((((StgWord)(c)->header.prof.hp.rs & 1) ^ flip) == 0) static inline RetainerSet * -retainerSetOf( StgClosure *c ) +retainerSetOf( const StgClosure *c ) { ASSERT( isRetainerSetFieldValid(c) ); // StgWord has the same size as pointers, so the following type diff --git a/rts/sm/HeapAlloc.h b/rts/sm/HeapAlloc.h index a867a48..0ec1e6d 100644 --- a/rts/sm/HeapAlloc.h +++ b/rts/sm/HeapAlloc.h @@ -162,10 +162,10 @@ typedef struct { extern W_ mpc_misses; -StgBool HEAP_ALLOCED_miss(StgWord mblock, void *p); +StgBool HEAP_ALLOCED_miss(StgWord mblock, const void *p); INLINE_HEADER -StgBool HEAP_ALLOCED(void *p) +StgBool HEAP_ALLOCED(const void *p) { StgWord mblock; uint32_t entry_no; diff --git a/rts/sm/MBlock.c b/rts/sm/MBlock.c index 11b12d1..9d66f57 100644 --- a/rts/sm/MBlock.c +++ b/rts/sm/MBlock.c @@ -359,7 +359,7 @@ uint32_t mblock_map_count = 0; MbcCacheLine mblock_cache[MBC_ENTRIES]; static MBlockMap * -findMBlockMap(void *p) +findMBlockMap(void void *p) { uint32_t i; StgWord32 hi = (StgWord32) (((StgWord)p) >> 32); @@ -373,7 +373,7 @@ findMBlockMap(void *p) return NULL; } -StgBool HEAP_ALLOCED_miss(StgWord mblock, void *p) +StgBool HEAP_ALLOCED_miss(StgWord mblock, void void *p) { MBlockMap *map; MBlockMapLine value; diff --git a/rts/sm/Sanity.c b/rts/sm/Sanity.c index 794bce7..2abe56b 100644 --- a/rts/sm/Sanity.c +++ b/rts/sm/Sanity.c @@ -35,7 +35,7 @@ static void checkSmallBitmap ( StgPtr payload, StgWord bitmap, uint32_t ); static void checkLargeBitmap ( StgPtr payload, StgLargeBitmap*, uint32_t ); -static void checkClosureShallow ( StgClosure * ); +static void checkClosureShallow ( const StgClosure * ); static void checkSTACK (StgStack *stack); /* ----------------------------------------------------------------------------- @@ -79,9 +79,9 @@ checkLargeBitmap( StgPtr payload, StgLargeBitmap* large_bitmap, uint32_t size ) */ static void -checkClosureShallow( StgClosure* p ) +checkClosureShallow( const StgClosure* p ) { - StgClosure *q; + const StgClosure *q; q = UNTAG_CLOSURE(p); ASSERT(LOOKS_LIKE_CLOSURE_PTR(q)); From git at git.haskell.org Thu May 12 02:52:33 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 12 May 2016 02:52:33 +0000 (UTC) Subject: [commit: ghc] master: Remove stale comment. (b5f85ce) Message-ID: <20160512025233.E632E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b5f85cef46b1c85e1d938692c4f08c6d70e65fed/ghc >--------------------------------------------------------------- commit b5f85cef46b1c85e1d938692c4f08c6d70e65fed Author: Edward Z. Yang Date: Mon May 9 19:56:41 2016 -0700 Remove stale comment. Summary: The code was reordered before tcRnImports in 3c44a46b352a4eb7ff72eb3aa5495b25dee8351f. I don't think the new code is buggy. Signed-off-by: Edward Z. Yang Reviewers: simonpj, austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2186 >--------------------------------------------------------------- b5f85cef46b1c85e1d938692c4f08c6d70e65fed compiler/typecheck/TcRnDriver.hs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/compiler/typecheck/TcRnDriver.hs b/compiler/typecheck/TcRnDriver.hs index e21d614..bb3056b 100644 --- a/compiler/typecheck/TcRnDriver.hs +++ b/compiler/typecheck/TcRnDriver.hs @@ -300,10 +300,6 @@ tcRnModuleTcRnM hsc_env hsc_src -- We do this now so that the boot_names can be passed -- to tcTyAndClassDecls, because the boot_names are -- automatically considered to be loop breakers - -- - -- Do this *after* tcRnImports, so that we know whether - -- a module that we import imports us; and hence whether to - -- look for a hi-boot file boot_info <- tcHiBootIface hsc_src this_mod ; setGblEnv (tcg_env { tcg_self_boot = boot_info }) $ do { From git at git.haskell.org Thu May 12 02:52:36 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 12 May 2016 02:52:36 +0000 (UTC) Subject: [commit: ghc] master: Don't prematurely force TyThing thunks with -ddump-if-trace. (da105ca) Message-ID: <20160512025236.9DE243A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/da105ca104f8382c33c01050dd04443c9c2d63ea/ghc >--------------------------------------------------------------- commit da105ca104f8382c33c01050dd04443c9c2d63ea Author: Edward Z. Yang Date: Tue May 10 00:14:05 2016 -0700 Don't prematurely force TyThing thunks with -ddump-if-trace. Signed-off-by: Edward Z. Yang Test Plan: validate Reviewers: simonpj, austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2187 >--------------------------------------------------------------- da105ca104f8382c33c01050dd04443c9c2d63ea compiler/iface/TcIface.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/iface/TcIface.hs b/compiler/iface/TcIface.hs index 25fa227..9a4a5c7 100644 --- a/compiler/iface/TcIface.hs +++ b/compiler/iface/TcIface.hs @@ -144,7 +144,10 @@ typecheckIface iface -- Finished ; traceIf (vcat [text "Finished typechecking interface for" <+> ppr (mi_module iface), - text "Type envt:" <+> ppr type_env]) + -- Careful! If we tug on the TyThing thunks too early + -- we'll infinite loop with hs-boot. See #10083 for + -- an example where this would cause non-termination. + text "Type envt:" <+> ppr (map fst names_w_things)]) ; return $ ModDetails { md_types = type_env , md_insts = insts , md_fam_insts = fam_insts From git at git.haskell.org Thu May 12 03:08:22 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 12 May 2016 03:08:22 +0000 (UTC) Subject: [commit: ghc] wip/erikd/remove-nat: rts: Make function pointer parameters `const` where possible (f97c3f4) Message-ID: <20160512030822.D25BB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/remove-nat Link : http://ghc.haskell.org/trac/ghc/changeset/f97c3f40df51d434bc47d5d17d1daba2848d3bcb/ghc >--------------------------------------------------------------- commit f97c3f40df51d434bc47d5d17d1daba2848d3bcb Author: Erik de Castro Lopo Date: Mon May 9 21:14:50 2016 +1000 rts: Make function pointer parameters `const` where possible If a function takes a pointer parameter and doesn't update what the pointer points to, we can add `const` to the parameter declaration to document that no updates occur. >--------------------------------------------------------------- f97c3f40df51d434bc47d5d17d1daba2848d3bcb includes/rts/storage/ClosureMacros.h | 16 ++++++++-------- rts/Capability.h | 4 ++-- rts/LdvProfile.c | 2 +- rts/ProfHeap.c | 8 ++++---- rts/RetainerProfile.h | 2 +- rts/sm/HeapAlloc.h | 4 ++-- rts/sm/MBlock.c | 4 ++-- rts/sm/Sanity.c | 6 +++--- 8 files changed, 23 insertions(+), 23 deletions(-) diff --git a/includes/rts/storage/ClosureMacros.h b/includes/rts/storage/ClosureMacros.h index d7ae5ea..5ed6928 100644 --- a/includes/rts/storage/ClosureMacros.h +++ b/includes/rts/storage/ClosureMacros.h @@ -194,13 +194,13 @@ INLINE_HEADER P_ INTLIKE_CLOSURE(int n) { ------------------------------------------------------------------------- */ static inline StgWord -GET_CLOSURE_TAG(StgClosure * p) +GET_CLOSURE_TAG(const StgClosure * p) { return (StgWord)p & TAG_MASK; } static inline StgClosure * -UNTAG_CLOSURE(StgClosure * p) +UNTAG_CLOSURE(const StgClosure * p) { return (StgClosure*)((StgWord)p & ~TAG_MASK); } @@ -247,7 +247,7 @@ INLINE_HEADER rtsBool LOOKS_LIKE_INFO_PTR (StgWord p) return (p && (IS_FORWARDING_PTR(p) || LOOKS_LIKE_INFO_PTR_NOT_NULL(p))) ? rtsTrue : rtsFalse; } -INLINE_HEADER rtsBool LOOKS_LIKE_CLOSURE_PTR (void *p) +INLINE_HEADER rtsBool LOOKS_LIKE_CLOSURE_PTR (const void *p) { return LOOKS_LIKE_INFO_PTR((StgWord)(UNTAG_CLOSURE((StgClosure *)(p)))->header.info); } @@ -337,9 +337,9 @@ EXTERN_INLINE StgWord bco_sizeW ( StgBCO *bco ) * * (Also for 'closure_sizeW' below) */ -EXTERN_INLINE uint32_t closure_sizeW_ (StgClosure *p, StgInfoTable *info); +EXTERN_INLINE uint32_t closure_sizeW_ (const StgClosure *p, StgInfoTable *info); EXTERN_INLINE uint32_t -closure_sizeW_ (StgClosure *p, StgInfoTable *info) +closure_sizeW_ (const StgClosure *p, StgInfoTable *info) { switch (info->type) { case THUNK_0_1: @@ -399,8 +399,8 @@ closure_sizeW_ (StgClosure *p, StgInfoTable *info) } // The definitive way to find the size, in words, of a heap-allocated closure -EXTERN_INLINE uint32_t closure_sizeW (StgClosure *p); -EXTERN_INLINE uint32_t closure_sizeW (StgClosure *p) +EXTERN_INLINE uint32_t closure_sizeW (const StgClosure *p); +EXTERN_INLINE uint32_t closure_sizeW (const StgClosure *p) { return closure_sizeW_(p, get_itbl(p)); } @@ -505,7 +505,7 @@ INLINE_HEADER StgWord8 *mutArrPtrsCard (StgMutArrPtrs *a, W_ n) #endif #ifdef PROFILING -void LDV_recordDead (StgClosure *c, uint32_t size); +void LDV_recordDead (const StgClosure *c, uint32_t size); #endif EXTERN_INLINE void overwritingClosure (StgClosure *p); diff --git a/rts/Capability.h b/rts/Capability.h index 46ae8b9..22c1d2a 100644 --- a/rts/Capability.h +++ b/rts/Capability.h @@ -260,7 +260,7 @@ extern PendingSync * volatile pending_sync; // void waitForCapability (Capability **cap/*in/out*/, Task *task); -EXTERN_INLINE void recordMutableCap (StgClosure *p, Capability *cap, +EXTERN_INLINE void recordMutableCap (const StgClosure *p, Capability *cap, uint32_t gen); EXTERN_INLINE void recordClosureMutated (Capability *cap, StgClosure *p); @@ -354,7 +354,7 @@ INLINE_HEADER rtsBool emptyInbox(Capability *cap); * -------------------------------------------------------------------------- */ EXTERN_INLINE void -recordMutableCap (StgClosure *p, Capability *cap, uint32_t gen) +recordMutableCap (const StgClosure *p, Capability *cap, uint32_t gen) { bdescr *bd; diff --git a/rts/LdvProfile.c b/rts/LdvProfile.c index 1dfdc56..428078b 100644 --- a/rts/LdvProfile.c +++ b/rts/LdvProfile.c @@ -28,7 +28,7 @@ * header portion, so that the caller can find the next closure. * ----------------------------------------------------------------------- */ STATIC_INLINE uint32_t -processHeapClosureForDead( StgClosure *c ) +processHeapClosureForDead( const StgClosure *c ) { uint32_t size; const StgInfoTable *info; diff --git a/rts/ProfHeap.c b/rts/ProfHeap.c index def490d..e98704d 100644 --- a/rts/ProfHeap.c +++ b/rts/ProfHeap.c @@ -96,7 +96,7 @@ static void aggregateCensusInfo( void ); static void dumpCensus( Census *census ); -static rtsBool closureSatisfiesConstraints( StgClosure* p ); +static rtsBool closureSatisfiesConstraints( const StgClosure* p ); /* ---------------------------------------------------------------------------- * Find the "closure identity", which is a unique pointer representing @@ -104,7 +104,7 @@ static rtsBool closureSatisfiesConstraints( StgClosure* p ); * heap profile. * ------------------------------------------------------------------------- */ static void * -closureIdentity( StgClosure *p ) +closureIdentity( const StgClosure *p ) { switch (RtsFlags.ProfFlags.doHeapProfile) { @@ -181,7 +181,7 @@ doingRetainerProfiling( void ) #ifdef PROFILING void -LDV_recordDead( StgClosure *c, uint32_t size ) +LDV_recordDead( const StgClosure *c, uint32_t size ) { void *id; uint32_t t; @@ -576,7 +576,7 @@ strMatchesSelector( const char* str, const char* sel ) * testing against all the specified constraints. * -------------------------------------------------------------------------- */ static rtsBool -closureSatisfiesConstraints( StgClosure* p ) +closureSatisfiesConstraints( const StgClosure* p ) { #if !defined(PROFILING) (void)p; /* keep gcc -Wall happy */ diff --git a/rts/RetainerProfile.h b/rts/RetainerProfile.h index d92563f..180c4e2 100644 --- a/rts/RetainerProfile.h +++ b/rts/RetainerProfile.h @@ -33,7 +33,7 @@ extern StgWord flip; ((((StgWord)(c)->header.prof.hp.rs & 1) ^ flip) == 0) static inline RetainerSet * -retainerSetOf( StgClosure *c ) +retainerSetOf( const StgClosure *c ) { ASSERT( isRetainerSetFieldValid(c) ); // StgWord has the same size as pointers, so the following type diff --git a/rts/sm/HeapAlloc.h b/rts/sm/HeapAlloc.h index a867a48..0ec1e6d 100644 --- a/rts/sm/HeapAlloc.h +++ b/rts/sm/HeapAlloc.h @@ -162,10 +162,10 @@ typedef struct { extern W_ mpc_misses; -StgBool HEAP_ALLOCED_miss(StgWord mblock, void *p); +StgBool HEAP_ALLOCED_miss(StgWord mblock, const void *p); INLINE_HEADER -StgBool HEAP_ALLOCED(void *p) +StgBool HEAP_ALLOCED(const void *p) { StgWord mblock; uint32_t entry_no; diff --git a/rts/sm/MBlock.c b/rts/sm/MBlock.c index 11b12d1..440b03e 100644 --- a/rts/sm/MBlock.c +++ b/rts/sm/MBlock.c @@ -359,7 +359,7 @@ uint32_t mblock_map_count = 0; MbcCacheLine mblock_cache[MBC_ENTRIES]; static MBlockMap * -findMBlockMap(void *p) +findMBlockMap(const void *p) { uint32_t i; StgWord32 hi = (StgWord32) (((StgWord)p) >> 32); @@ -373,7 +373,7 @@ findMBlockMap(void *p) return NULL; } -StgBool HEAP_ALLOCED_miss(StgWord mblock, void *p) +StgBool HEAP_ALLOCED_miss(StgWord mblock, const void *p) { MBlockMap *map; MBlockMapLine value; diff --git a/rts/sm/Sanity.c b/rts/sm/Sanity.c index 794bce7..2abe56b 100644 --- a/rts/sm/Sanity.c +++ b/rts/sm/Sanity.c @@ -35,7 +35,7 @@ static void checkSmallBitmap ( StgPtr payload, StgWord bitmap, uint32_t ); static void checkLargeBitmap ( StgPtr payload, StgLargeBitmap*, uint32_t ); -static void checkClosureShallow ( StgClosure * ); +static void checkClosureShallow ( const StgClosure * ); static void checkSTACK (StgStack *stack); /* ----------------------------------------------------------------------------- @@ -79,9 +79,9 @@ checkLargeBitmap( StgPtr payload, StgLargeBitmap* large_bitmap, uint32_t size ) */ static void -checkClosureShallow( StgClosure* p ) +checkClosureShallow( const StgClosure* p ) { - StgClosure *q; + const StgClosure *q; q = UNTAG_CLOSURE(p); ASSERT(LOOKS_LIKE_CLOSURE_PTR(q)); From git at git.haskell.org Thu May 12 07:50:15 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 12 May 2016 07:50:15 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Bump haddock submodule (412e22c) Message-ID: <20160512075015.965563A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/412e22caecf742be2d6c4acedf621c7520d6e900/ghc >--------------------------------------------------------------- commit 412e22caecf742be2d6c4acedf621c7520d6e900 Author: Ben Gamari Date: Wed May 11 23:16:46 2016 +0200 Bump haddock submodule Ensures that haddock documentation is built as part of the `all` target. >--------------------------------------------------------------- 412e22caecf742be2d6c4acedf621c7520d6e900 utils/haddock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/haddock b/utils/haddock index 48521cf..48c63a3 160000 --- a/utils/haddock +++ b/utils/haddock @@ -1 +1 @@ -Subproject commit 48521cfd5ed96dd9e07f76b1c1c86fcc991867a2 +Subproject commit 48c63a3a4cd912aedc58b37ea8007c38c55e28ca From git at git.haskell.org Thu May 12 09:14:42 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 12 May 2016 09:14:42 +0000 (UTC) Subject: [commit: ghc] branch 'wip/erikd/remove-nat' deleted Message-ID: <20160512091442.B4C663A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Deleted branch: wip/erikd/remove-nat From git at git.haskell.org Thu May 12 09:16:10 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 12 May 2016 09:16:10 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Bump haddock submodule (b594f81) Message-ID: <20160512091610.CABC13A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/b594f8191273f4c913bc8413d30fd3061bb577c1/ghc >--------------------------------------------------------------- commit b594f8191273f4c913bc8413d30fd3061bb577c1 Author: Ben Gamari Date: Wed May 11 23:16:46 2016 +0200 Bump haddock submodule Fixes `make clean`. >--------------------------------------------------------------- b594f8191273f4c913bc8413d30fd3061bb577c1 utils/haddock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/haddock b/utils/haddock index 48c63a3..af1a868 160000 --- a/utils/haddock +++ b/utils/haddock @@ -1 +1 @@ -Subproject commit 48c63a3a4cd912aedc58b37ea8007c38c55e28ca +Subproject commit af1a8689da1990da9a152ae8a0e51976f2a27ff6 From git at git.haskell.org Thu May 12 12:40:28 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 12 May 2016 12:40:28 +0000 (UTC) Subject: [commit: ghc] master: Make absentError not depend on uniques (925b0ae) Message-ID: <20160512124028.00B213A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/925b0aea8edc1761fcc16feba1601bea38422c92/ghc >--------------------------------------------------------------- commit 925b0aea8edc1761fcc16feba1601bea38422c92 Author: Bartosz Nitka Date: Thu May 12 05:42:21 2016 -0700 Make absentError not depend on uniques As explained in the comment it will cause changes in inlining if we don't suppress them. Test Plan: ./validate Reviewers: bgamari, austin, simonpj, goldfire, simonmar Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2203 GHC Trac Issues: #4012 >--------------------------------------------------------------- 925b0aea8edc1761fcc16feba1601bea38422c92 compiler/stranal/WwLib.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/compiler/stranal/WwLib.hs b/compiler/stranal/WwLib.hs index 4ec36ba..d285159 100644 --- a/compiler/stranal/WwLib.hs +++ b/compiler/stranal/WwLib.hs @@ -720,7 +720,14 @@ mk_absent_let dflags arg where arg_ty = idType arg abs_rhs = mkRuntimeErrorApp aBSENT_ERROR_ID arg_ty msg - msg = showSDoc dflags (ppr arg <+> ppr (idType arg)) + msg = showSDoc (gopt_set dflags Opt_SuppressUniques) + (ppr arg <+> ppr (idType arg)) + -- We need to suppress uniques here because otherwise they'd + -- end up in the generated code as strings. This is bad for + -- determinism, because with different uniques the strings + -- will have different lengths and hence different costs for + -- the inliner leading to different inlining. + -- See also Note [Unique Determinism] in Unique mk_seq_case :: Id -> CoreExpr -> CoreExpr mk_seq_case arg body = Case (Var arg) (sanitiseCaseBndr arg) (exprType body) [(DEFAULT, [], body)] From git at git.haskell.org Thu May 12 13:39:53 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 12 May 2016 13:39:53 +0000 (UTC) Subject: [commit: ghc] master: docs: add skeleton 8.2.1 release notes (eae3362) Message-ID: <20160512133953.A12383A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/eae33620575fcad49f523a0cf75bddd676ba0f21/ghc >--------------------------------------------------------------- commit eae33620575fcad49f523a0cf75bddd676ba0f21 Author: Austin Seipp Date: Wed May 11 15:52:08 2016 +0200 docs: add skeleton 8.2.1 release notes Summary: Out with the old, in with the new. Not much has diverged yet, but it's good to get this out of the way early. Signed-off-by: Austin Seipp Test Plan: Built and looked at the documentation. Reviewers: bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2066 >--------------------------------------------------------------- eae33620575fcad49f523a0cf75bddd676ba0f21 docs/users_guide/8.0.1-notes.rst | 796 --------------------------------------- docs/users_guide/8.2.1-notes.rst | 193 ++++++++++ docs/users_guide/index.rst | 2 +- 3 files changed, 194 insertions(+), 797 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc eae33620575fcad49f523a0cf75bddd676ba0f21 From git at git.haskell.org Thu May 12 13:39:56 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 12 May 2016 13:39:56 +0000 (UTC) Subject: [commit: ghc] master: Bump haddock submodule (e217287) Message-ID: <20160512133956.59E533A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e21728736d2ca0d65da9e84c18a12c2f29c116ee/ghc >--------------------------------------------------------------- commit e21728736d2ca0d65da9e84c18a12c2f29c116ee Author: Ben Gamari Date: Thu May 12 15:39:24 2016 +0200 Bump haddock submodule >--------------------------------------------------------------- e21728736d2ca0d65da9e84c18a12c2f29c116ee utils/haddock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/haddock b/utils/haddock index 609018d..9760ee9 160000 --- a/utils/haddock +++ b/utils/haddock @@ -1 +1 @@ -Subproject commit 609018dd09c4ffe27f9248b2d8b50f6196cd42b9 +Subproject commit 9760ee9efe22f0256d626bc567a7adfc754e9066 From git at git.haskell.org Thu May 12 13:39:59 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 12 May 2016 13:39:59 +0000 (UTC) Subject: [commit: ghc] master: Fix deriveTyData's kind unification when two kind variables are unified (e53f218) Message-ID: <20160512133959.C51A83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e53f2180e89652c72e51ffa614c56294ba67cf37/ghc >--------------------------------------------------------------- commit e53f2180e89652c72e51ffa614c56294ba67cf37 Author: RyanGlScott Date: Wed May 11 15:57:24 2016 +0200 Fix deriveTyData's kind unification when two kind variables are unified When `deriveTyData` attempts to unify two kind variables (which can happen if both the typeclass and the datatype are poly-kinded), it mistakenly adds an extra mapping to its substitution which causes the unification to fail when applying the substitution. This can be prevented by checking both the domain and the range of the original substitution to see which kind variables shouldn't be put into the domain of the substitution. A more in-depth explanation is included in `Note [Unification of two kind variables in deriving]`. Fixes #11837. Test Plan: ./validate Reviewers: simonpj, hvr, goldfire, niteria, austin, bgamari Reviewed By: bgamari Subscribers: niteria, thomie Differential Revision: https://phabricator.haskell.org/D2117 GHC Trac Issues: #11837 >--------------------------------------------------------------- e53f2180e89652c72e51ffa614c56294ba67cf37 compiler/typecheck/TcDeriv.hs | 60 ++++++++++++++++++++-- compiler/types/TyCoRep.hs | 12 ++++- compiler/types/Type.hs | 2 +- .../should_compile/{T11833.hs => T11837.hs} | 4 +- testsuite/tests/deriving/should_compile/all.T | 1 + 5 files changed, 70 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 e53f2180e89652c72e51ffa614c56294ba67cf37 From git at git.haskell.org Thu May 12 13:40:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 12 May 2016 13:40:03 +0000 (UTC) Subject: [commit: ghc] master: Add TH support for pattern synonyms (fixes #8761) (c079de3) Message-ID: <20160512134003.3CE253A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c079de3c43704ea88f592e441389e520313e30ad/ghc >--------------------------------------------------------------- commit c079de3c43704ea88f592e441389e520313e30ad Author: Dominik Bollmann Date: Wed May 11 15:55:13 2016 +0200 Add TH support for pattern synonyms (fixes #8761) This commit adds Template Haskell support for pattern synonyms as requested by trac ticket #8761. Test Plan: ./validate Reviewers: thomie, jstolarek, osa1, RyanGlScott, mpickering, austin, goldfire, bgamari Reviewed By: goldfire, bgamari Subscribers: rdragon Differential Revision: https://phabricator.haskell.org/D1940 GHC Trac Issues: #8761 >--------------------------------------------------------------- c079de3c43704ea88f592e441389e520313e30ad compiler/deSugar/DsMeta.hs | 129 +++++++++++++-- compiler/hsSyn/Convert.hs | 108 ++++++++++++- compiler/hsSyn/HsTypes.hs | 25 ++- compiler/hsSyn/HsUtils.hs | 38 ++--- compiler/prelude/THNames.hs | 174 ++++++++++++--------- compiler/typecheck/TcSplice.hs | 21 ++- libraries/ghci/GHCi/TH/Binary.hs | 2 + libraries/template-haskell/Language/Haskell/TH.hs | 12 +- .../template-haskell/Language/Haskell/TH/Lib.hs | 39 ++++- .../template-haskell/Language/Haskell/TH/Ppr.hs | 65 ++++++-- .../template-haskell/Language/Haskell/TH/PprLib.hs | 0 .../template-haskell/Language/Haskell/TH/Syntax.hs | 92 ++++++++++- testsuite/tests/quotes/T8759a.stderr | 4 - testsuite/tests/quotes/all.T | 2 +- testsuite/tests/th/T10019.stdout | 2 +- testsuite/tests/th/T8759.stderr | 4 +- testsuite/tests/th/T8761.hs | 111 +++++++++++++ testsuite/tests/th/T8761.stderr | 158 +++++++++++++++++++ testsuite/tests/th/T9064.stderr | 5 +- testsuite/tests/th/all.T | 4 +- 20 files changed, 832 insertions(+), 163 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc c079de3c43704ea88f592e441389e520313e30ad From git at git.haskell.org Thu May 12 13:40:07 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 12 May 2016 13:40:07 +0000 (UTC) Subject: [commit: ghc] master: Make Generic1 poly-kinded (b8e2565) Message-ID: <20160512134007.EDA403A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b8e2565123de45f215277e3a92fbc7ace2b8fd71/ghc >--------------------------------------------------------------- commit b8e2565123de45f215277e3a92fbc7ace2b8fd71 Author: RyanGlScott Date: Wed May 11 15:57:48 2016 +0200 Make Generic1 poly-kinded This generalizes the `Generic1` typeclass to be of kind `k -> *`, and this also makes the relevant datatypes and typeclasses in `GHC.Generics` poly-kinded. If `PolyKinds` is enabled, `DeriveGeneric` derives `Generic1` instances such that they use the most general kind possible. Otherwise, deriving `Generic1` defaults to make an instance where the argument is of kind `* -> *` (the current behavior). Fixes #10604. Depends on D2117. Test Plan: ./validate Reviewers: kosmikus, dreixel, goldfire, austin, hvr, simonpj, bgamari Reviewed By: simonpj, bgamari Subscribers: thomie, ekmett Differential Revision: https://phabricator.haskell.org/D2168 GHC Trac Issues: #10604 >--------------------------------------------------------------- b8e2565123de45f215277e3a92fbc7ace2b8fd71 compiler/typecheck/TcDeriv.hs | 90 ++-- compiler/typecheck/TcGenGenerics.hs | 114 +++-- docs/users_guide/glasgow_exts.rst | 14 +- libraries/base/Data/Data.hs | 3 +- libraries/base/GHC/Generics.hs | 115 +++-- libraries/base/changelog.md | 3 + .../should_compile => generics/T10604}/Makefile | 0 .../tests/generics/T10604/T10604_Authenticated.hs | 41 ++ .../T10604/T10604_bad_variable_occurrence.hs | 8 + .../T10604/T10604_bad_variable_occurrence.stderr | 6 + testsuite/tests/generics/T10604/T10604_deriving.hs | 22 + .../tests/generics/T10604/T10604_deriving.stderr | 518 +++++++++++++++++++++ .../tests/generics/T10604/T10604_no_PolyKinds.hs | 7 + .../generics/T10604/T10604_no_PolyKinds.stderr | 6 + testsuite/tests/generics/T10604/all.T | 4 + testsuite/tests/perf/compiler/all.T | 3 +- testsuite/tests/perf/haddock/all.T | 6 +- 17 files changed, 837 insertions(+), 123 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc b8e2565123de45f215277e3a92fbc7ace2b8fd71 From git at git.haskell.org Thu May 12 13:40:11 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 12 May 2016 13:40:11 +0000 (UTC) Subject: [commit: ghc] master: Allow putting Haddocks on derived instances (6971430) Message-ID: <20160512134011.408E93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/697143064c271c57a69e80850a768449f8bcf4ca/ghc >--------------------------------------------------------------- commit 697143064c271c57a69e80850a768449f8bcf4ca Author: Ryan Scott Date: Wed May 11 15:58:35 2016 +0200 Allow putting Haddocks on derived instances Currently, one can document top-level instance declarations, but derived instances (both those in `deriving` clauses and standalone `deriving` instances) do not enjoy the same privilege. This makes the necessary changes to the parser to enable attaching Haddock comments for derived instances. Updates haddock submodule. Fixes #11768. Test Plan: ./validate Reviewers: hvr, bgamari, austin Reviewed By: austin Subscribers: thomie, mpickering Differential Revision: https://phabricator.haskell.org/D2175 GHC Trac Issues: #11768 >--------------------------------------------------------------- 697143064c271c57a69e80850a768449f8bcf4ca compiler/parser/Parser.y | 13 ++++++++----- .../tests/haddock/should_compile_flag_haddock/T11768.hs | 13 +++++++++++++ .../tests/haddock/should_compile_flag_haddock/T11768.stderr | 13 +++++++++++++ testsuite/tests/haddock/should_compile_flag_haddock/all.T | 1 + utils/haddock | 2 +- 5 files changed, 36 insertions(+), 6 deletions(-) diff --git a/compiler/parser/Parser.y b/compiler/parser/Parser.y index 9489be4..ef1c3ec 100644 --- a/compiler/parser/Parser.y +++ b/compiler/parser/Parser.y @@ -1727,9 +1727,9 @@ inst_type :: { LHsSigType RdrName } : sigtype { mkLHsSigType $1 } deriv_types :: { [LHsSigType RdrName] } - : type { [mkLHsSigType $1] } + : typedoc { [mkLHsSigType $1] } - | type ',' deriv_types {% addAnnotation (gl $1) AnnComma (gl $2) + | typedoc ',' deriv_types {% addAnnotation (gl $1) AnnComma (gl $2) >> return (mkLHsSigType $1 : $3) } comma_types0 :: { [LHsType RdrName] } -- Zero or more: ty,ty,ty @@ -1936,10 +1936,9 @@ fielddecl :: { LConDeclField RdrName } -- know the rightmost extremity of the 'deriving' clause deriving :: { Located (HsDeriving RdrName) } : {- empty -} { noLoc Nothing } - | 'deriving' qtycon {% let { L tv_loc tv = $2 - ; full_loc = comb2 $1 $> } + | 'deriving' qtycondoc {% let { full_loc = comb2 $1 $> } in ams (L full_loc $ Just $ L full_loc $ - [mkLHsSigType (L tv_loc (HsTyVar $2))]) + [mkLHsSigType $2]) [mj AnnDeriving $1] } | 'deriving' '(' ')' {% let { full_loc = comb2 $1 $> } @@ -2896,6 +2895,10 @@ qtycon :: { Located RdrName } -- Qualified or unqualified : QCONID { sL1 $1 $! mkQual tcClsName (getQCONID $1) } | tycon { $1 } +qtycondoc :: { LHsType RdrName } -- Qualified or unqualified + : qtycon { sL1 $1 (HsTyVar $1) } + | qtycon docprev { sLL $1 $> (HsDocTy (sL1 $1 (HsTyVar $1)) $2) } + tycon :: { Located RdrName } -- Unqualified : CONID { sL1 $1 $! mkUnqual tcClsName (getCONID $1) } diff --git a/testsuite/tests/haddock/should_compile_flag_haddock/T11768.hs b/testsuite/tests/haddock/should_compile_flag_haddock/T11768.hs new file mode 100644 index 0000000..5689b42 --- /dev/null +++ b/testsuite/tests/haddock/should_compile_flag_haddock/T11768.hs @@ -0,0 +1,13 @@ +{-# LANGUAGE StandaloneDeriving #-} +module T11768 where + +data Foo = Foo + deriving Eq -- ^ Documenting a single type + +data Bar = Bar + deriving ( Eq -- ^ Documenting one of multiple types + , Ord + ) + +-- | Documenting a standalone deriving instance +deriving instance Read Bar diff --git a/testsuite/tests/haddock/should_compile_flag_haddock/T11768.stderr b/testsuite/tests/haddock/should_compile_flag_haddock/T11768.stderr new file mode 100644 index 0000000..684a6f0 --- /dev/null +++ b/testsuite/tests/haddock/should_compile_flag_haddock/T11768.stderr @@ -0,0 +1,13 @@ + +==================== Parser ==================== +module T11768 where +data Foo + = Foo + deriving (Eq Documenting a single type) +data Bar + = Bar + deriving (Eq Documenting one of multiple types, Ord) + +deriving instance Read Bar + + diff --git a/testsuite/tests/haddock/should_compile_flag_haddock/all.T b/testsuite/tests/haddock/should_compile_flag_haddock/all.T index 344210e..7db4379 100644 --- a/testsuite/tests/haddock/should_compile_flag_haddock/all.T +++ b/testsuite/tests/haddock/should_compile_flag_haddock/all.T @@ -46,3 +46,4 @@ test('haddockA032', normal, compile, ['-haddock -ddump-parsed']) test('haddockA033', normal, compile, ['-haddock -ddump-parsed']) test('haddockA034', normal, compile, ['-haddock -ddump-parsed']) test('T10398', normal, compile, ['-haddock -ddump-parsed']) +test('T11768', normal, compile, ['-haddock -ddump-parsed']) diff --git a/utils/haddock b/utils/haddock index 9760ee9..d7ef908 160000 --- a/utils/haddock +++ b/utils/haddock @@ -1 +1 @@ -Subproject commit 9760ee9efe22f0256d626bc567a7adfc754e9066 +Subproject commit d7ef90898c6d8ddeae23caf0f9fb68c25537dcd0 From git at git.haskell.org Thu May 12 13:42:18 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 12 May 2016 13:42:18 +0000 (UTC) Subject: [commit: ghc] master: Document zonkTyCoVarsAndFV determinism (01bc109) Message-ID: <20160512134218.F2EC73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/01bc10965d993babf6c2c35d340655f683ba0ca2/ghc >--------------------------------------------------------------- commit 01bc10965d993babf6c2c35d340655f683ba0ca2 Author: Bartosz Nitka Date: Thu May 12 06:44:52 2016 -0700 Document zonkTyCoVarsAndFV determinism I've changed it to use nonDetEltsUFM and documented why it's OK. Test Plan: it builds Reviewers: bgamari, austin, simonmar, goldfire, simonpj Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2204 GHC Trac Issues: #4012 >--------------------------------------------------------------- 01bc10965d993babf6c2c35d340655f683ba0ca2 compiler/typecheck/TcMType.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/compiler/typecheck/TcMType.hs b/compiler/typecheck/TcMType.hs index 8ad9aba..94c4947 100644 --- a/compiler/typecheck/TcMType.hs +++ b/compiler/typecheck/TcMType.hs @@ -108,6 +108,7 @@ import FastString import SrcLoc import Bag import Pair +import UniqFM import qualified GHC.LanguageExtensions as LangExt import Control.Monad @@ -1230,7 +1231,11 @@ zonkTyCoVar tv | isTcTyVar tv = zonkTcTyVar tv -- painful to make them into TcTyVars there zonkTyCoVarsAndFV :: TyCoVarSet -> TcM TyCoVarSet -zonkTyCoVarsAndFV tycovars = tyCoVarsOfTypes <$> mapM zonkTyCoVar (varSetElems tycovars) +zonkTyCoVarsAndFV tycovars = + tyCoVarsOfTypes <$> mapM zonkTyCoVar (nonDetEltsUFM tycovars) + -- It's OK to use nonDetEltsUFM here because we immediately forget about + -- the ordering by turning it into a nondeterministic set and the order + -- of zonking doesn't matter for determinism. -- Takes a list of TyCoVars, zonks them and returns a -- deterministically ordered list of their free variables. From git at git.haskell.org Thu May 12 13:52:16 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 12 May 2016 13:52:16 +0000 (UTC) Subject: [commit: ghc] master: Kill varEnvElts in specImports (6bf0eef) Message-ID: <20160512135216.5647E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6bf0eef74d2b2ce9a48c7acc08ca2a1c0c8a7fbc/ghc >--------------------------------------------------------------- commit 6bf0eef74d2b2ce9a48c7acc08ca2a1c0c8a7fbc Author: Bartosz Nitka Date: Thu May 12 06:55:00 2016 -0700 Kill varEnvElts in specImports We need the order of specialized binds and rules to be deterministic, so we use a deterministic set here. Test Plan: ./validate Reviewers: simonmar, bgamari, austin, simonpj Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2197 GHC Trac Issues: #4012 >--------------------------------------------------------------- 6bf0eef74d2b2ce9a48c7acc08ca2a1c0c8a7fbc compiler/basicTypes/VarEnv.hs | 25 +++++++++++++++++++++++-- compiler/specialise/Specialise.hs | 28 ++++++++++++++++++---------- compiler/utils/UniqDFM.hs | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 73 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 6bf0eef74d2b2ce9a48c7acc08ca2a1c0c8a7fbc From git at git.haskell.org Thu May 12 15:30:29 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 12 May 2016 15:30:29 +0000 (UTC) Subject: [commit: ghc] master: RtsUtils: Use `size_t` instead of `int` where appropriate (0c0129b) Message-ID: <20160512153029.09A103A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0c0129b6a82a87a9bba19f27a4b19fec9ccc5a8d/ghc >--------------------------------------------------------------- commit 0c0129b6a82a87a9bba19f27a4b19fec9ccc5a8d Author: Erik de Castro Lopo Date: Thu May 12 15:45:10 2016 +0200 RtsUtils: Use `size_t` instead of `int` where appropriate Functions like `stgMallocBytes` take a size parameter which was of type `int`, but is commonly used as `stgMallocBytes (sizeof (...))`. This is problematic because the `sizeof` operator returns `size_t` so that on 64 bit systems, in this common use case the `size_t` parameter would be truncated to 32 bits when passed to `stgMallocBytes` where it was cast back to `size_t`. Test Plan: Validate on Linux, OS X and Windows Reviewers: austin, hvr, bgamari, simonmar, hsyl20 Reviewed By: hvr, bgamari, simonmar, hsyl20 Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2201 >--------------------------------------------------------------- 0c0129b6a82a87a9bba19f27a4b19fec9ccc5a8d rts/RtsUtils.c | 22 +++++++++------------- rts/RtsUtils.h | 6 +++--- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/rts/RtsUtils.c b/rts/RtsUtils.c index c837143..716d203 100644 --- a/rts/RtsUtils.c +++ b/rts/RtsUtils.c @@ -57,13 +57,11 @@ extern char *ctime_r(const time_t *, char *); -------------------------------------------------------------------------- */ void * -stgMallocBytes (int n, char *msg) +stgMallocBytes (size_t n, char *msg) { - char *space; - size_t n2; + void *space; - n2 = (size_t) n; - if ((space = (char *) malloc(n2)) == NULL) { + if ((space = malloc(n)) == NULL) { /* Quoting POSIX.1-2008 (which says more or less the same as ISO C99): * * "Upon successful completion with size not equal to 0, malloc() shall @@ -85,13 +83,11 @@ stgMallocBytes (int n, char *msg) } void * -stgReallocBytes (void *p, int n, char *msg) +stgReallocBytes (void *p, size_t n, char *msg) { - char *space; - size_t n2; + void *space; - n2 = (size_t) n; - if ((space = (char *) realloc(p, (size_t) n2)) == NULL) { + if ((space = realloc(p, n)) == NULL) { /* don't fflush(stdout); WORKAROUND bug in Linux glibc */ rtsConfig.mallocFailHook((W_) n, msg); /*msg*/ stg_exit(EXIT_INTERNAL_ERROR); @@ -100,11 +96,11 @@ stgReallocBytes (void *p, int n, char *msg) } void * -stgCallocBytes (int n, int m, char *msg) +stgCallocBytes (size_t n, size_t m, char *msg) { - char *space; + void *space; - if ((space = (char *) calloc((size_t) n, (size_t) m)) == NULL) { + if ((space = calloc(n, m)) == NULL) { /* don't fflush(stdout); WORKAROUND bug in Linux glibc */ rtsConfig.mallocFailHook((W_) n*m, msg); /*msg*/ stg_exit(EXIT_INTERNAL_ERROR); diff --git a/rts/RtsUtils.h b/rts/RtsUtils.h index d76c921..2d5e5de 100644 --- a/rts/RtsUtils.h +++ b/rts/RtsUtils.h @@ -18,12 +18,12 @@ void initAllocator(void); void shutdownAllocator(void); -void *stgMallocBytes(int n, char *msg) +void *stgMallocBytes(size_t n, char *msg) GNUC3_ATTRIBUTE(__malloc__); -void *stgReallocBytes(void *p, int n, char *msg); +void *stgReallocBytes(void *p, size_t n, char *msg); -void *stgCallocBytes(int n, int m, char *msg) +void *stgCallocBytes(size_t n, size_t m, char *msg) GNUC3_ATTRIBUTE(__malloc__); char *stgStrndup(const char *s, size_t n); From git at git.haskell.org Thu May 12 15:30:31 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 12 May 2016 15:30:31 +0000 (UTC) Subject: [commit: ghc] master: rts: Make function pointer parameters `const` where possible (995cf0f) Message-ID: <20160512153031.AF3223A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/995cf0f356ef3a8b7a394de640a853fd6ca9c2b5/ghc >--------------------------------------------------------------- commit 995cf0f356ef3a8b7a394de640a853fd6ca9c2b5 Author: Erik de Castro Lopo Date: Thu May 12 15:45:00 2016 +0200 rts: Make function pointer parameters `const` where possible If a function takes a pointer parameter and doesn't update what the pointer points to, we can add `const` to the parameter declaration to document that no updates occur. Test Plan: Validate on Linux, OS X and Windows Reviewers: austin, Phyx, bgamari, simonmar, hsyl20 Reviewed By: bgamari, simonmar, hsyl20 Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2200 >--------------------------------------------------------------- 995cf0f356ef3a8b7a394de640a853fd6ca9c2b5 includes/rts/storage/ClosureMacros.h | 16 ++++++++-------- rts/Capability.h | 4 ++-- rts/LdvProfile.c | 2 +- rts/ProfHeap.c | 8 ++++---- rts/RetainerProfile.h | 2 +- rts/sm/HeapAlloc.h | 4 ++-- rts/sm/MBlock.c | 4 ++-- rts/sm/Sanity.c | 6 +++--- 8 files changed, 23 insertions(+), 23 deletions(-) diff --git a/includes/rts/storage/ClosureMacros.h b/includes/rts/storage/ClosureMacros.h index d7ae5ea..5ed6928 100644 --- a/includes/rts/storage/ClosureMacros.h +++ b/includes/rts/storage/ClosureMacros.h @@ -194,13 +194,13 @@ INLINE_HEADER P_ INTLIKE_CLOSURE(int n) { ------------------------------------------------------------------------- */ static inline StgWord -GET_CLOSURE_TAG(StgClosure * p) +GET_CLOSURE_TAG(const StgClosure * p) { return (StgWord)p & TAG_MASK; } static inline StgClosure * -UNTAG_CLOSURE(StgClosure * p) +UNTAG_CLOSURE(const StgClosure * p) { return (StgClosure*)((StgWord)p & ~TAG_MASK); } @@ -247,7 +247,7 @@ INLINE_HEADER rtsBool LOOKS_LIKE_INFO_PTR (StgWord p) return (p && (IS_FORWARDING_PTR(p) || LOOKS_LIKE_INFO_PTR_NOT_NULL(p))) ? rtsTrue : rtsFalse; } -INLINE_HEADER rtsBool LOOKS_LIKE_CLOSURE_PTR (void *p) +INLINE_HEADER rtsBool LOOKS_LIKE_CLOSURE_PTR (const void *p) { return LOOKS_LIKE_INFO_PTR((StgWord)(UNTAG_CLOSURE((StgClosure *)(p)))->header.info); } @@ -337,9 +337,9 @@ EXTERN_INLINE StgWord bco_sizeW ( StgBCO *bco ) * * (Also for 'closure_sizeW' below) */ -EXTERN_INLINE uint32_t closure_sizeW_ (StgClosure *p, StgInfoTable *info); +EXTERN_INLINE uint32_t closure_sizeW_ (const StgClosure *p, StgInfoTable *info); EXTERN_INLINE uint32_t -closure_sizeW_ (StgClosure *p, StgInfoTable *info) +closure_sizeW_ (const StgClosure *p, StgInfoTable *info) { switch (info->type) { case THUNK_0_1: @@ -399,8 +399,8 @@ closure_sizeW_ (StgClosure *p, StgInfoTable *info) } // The definitive way to find the size, in words, of a heap-allocated closure -EXTERN_INLINE uint32_t closure_sizeW (StgClosure *p); -EXTERN_INLINE uint32_t closure_sizeW (StgClosure *p) +EXTERN_INLINE uint32_t closure_sizeW (const StgClosure *p); +EXTERN_INLINE uint32_t closure_sizeW (const StgClosure *p) { return closure_sizeW_(p, get_itbl(p)); } @@ -505,7 +505,7 @@ INLINE_HEADER StgWord8 *mutArrPtrsCard (StgMutArrPtrs *a, W_ n) #endif #ifdef PROFILING -void LDV_recordDead (StgClosure *c, uint32_t size); +void LDV_recordDead (const StgClosure *c, uint32_t size); #endif EXTERN_INLINE void overwritingClosure (StgClosure *p); diff --git a/rts/Capability.h b/rts/Capability.h index 46ae8b9..22c1d2a 100644 --- a/rts/Capability.h +++ b/rts/Capability.h @@ -260,7 +260,7 @@ extern PendingSync * volatile pending_sync; // void waitForCapability (Capability **cap/*in/out*/, Task *task); -EXTERN_INLINE void recordMutableCap (StgClosure *p, Capability *cap, +EXTERN_INLINE void recordMutableCap (const StgClosure *p, Capability *cap, uint32_t gen); EXTERN_INLINE void recordClosureMutated (Capability *cap, StgClosure *p); @@ -354,7 +354,7 @@ INLINE_HEADER rtsBool emptyInbox(Capability *cap); * -------------------------------------------------------------------------- */ EXTERN_INLINE void -recordMutableCap (StgClosure *p, Capability *cap, uint32_t gen) +recordMutableCap (const StgClosure *p, Capability *cap, uint32_t gen) { bdescr *bd; diff --git a/rts/LdvProfile.c b/rts/LdvProfile.c index 1dfdc56..428078b 100644 --- a/rts/LdvProfile.c +++ b/rts/LdvProfile.c @@ -28,7 +28,7 @@ * header portion, so that the caller can find the next closure. * ----------------------------------------------------------------------- */ STATIC_INLINE uint32_t -processHeapClosureForDead( StgClosure *c ) +processHeapClosureForDead( const StgClosure *c ) { uint32_t size; const StgInfoTable *info; diff --git a/rts/ProfHeap.c b/rts/ProfHeap.c index def490d..e98704d 100644 --- a/rts/ProfHeap.c +++ b/rts/ProfHeap.c @@ -96,7 +96,7 @@ static void aggregateCensusInfo( void ); static void dumpCensus( Census *census ); -static rtsBool closureSatisfiesConstraints( StgClosure* p ); +static rtsBool closureSatisfiesConstraints( const StgClosure* p ); /* ---------------------------------------------------------------------------- * Find the "closure identity", which is a unique pointer representing @@ -104,7 +104,7 @@ static rtsBool closureSatisfiesConstraints( StgClosure* p ); * heap profile. * ------------------------------------------------------------------------- */ static void * -closureIdentity( StgClosure *p ) +closureIdentity( const StgClosure *p ) { switch (RtsFlags.ProfFlags.doHeapProfile) { @@ -181,7 +181,7 @@ doingRetainerProfiling( void ) #ifdef PROFILING void -LDV_recordDead( StgClosure *c, uint32_t size ) +LDV_recordDead( const StgClosure *c, uint32_t size ) { void *id; uint32_t t; @@ -576,7 +576,7 @@ strMatchesSelector( const char* str, const char* sel ) * testing against all the specified constraints. * -------------------------------------------------------------------------- */ static rtsBool -closureSatisfiesConstraints( StgClosure* p ) +closureSatisfiesConstraints( const StgClosure* p ) { #if !defined(PROFILING) (void)p; /* keep gcc -Wall happy */ diff --git a/rts/RetainerProfile.h b/rts/RetainerProfile.h index d92563f..180c4e2 100644 --- a/rts/RetainerProfile.h +++ b/rts/RetainerProfile.h @@ -33,7 +33,7 @@ extern StgWord flip; ((((StgWord)(c)->header.prof.hp.rs & 1) ^ flip) == 0) static inline RetainerSet * -retainerSetOf( StgClosure *c ) +retainerSetOf( const StgClosure *c ) { ASSERT( isRetainerSetFieldValid(c) ); // StgWord has the same size as pointers, so the following type diff --git a/rts/sm/HeapAlloc.h b/rts/sm/HeapAlloc.h index a867a48..0ec1e6d 100644 --- a/rts/sm/HeapAlloc.h +++ b/rts/sm/HeapAlloc.h @@ -162,10 +162,10 @@ typedef struct { extern W_ mpc_misses; -StgBool HEAP_ALLOCED_miss(StgWord mblock, void *p); +StgBool HEAP_ALLOCED_miss(StgWord mblock, const void *p); INLINE_HEADER -StgBool HEAP_ALLOCED(void *p) +StgBool HEAP_ALLOCED(const void *p) { StgWord mblock; uint32_t entry_no; diff --git a/rts/sm/MBlock.c b/rts/sm/MBlock.c index 11b12d1..440b03e 100644 --- a/rts/sm/MBlock.c +++ b/rts/sm/MBlock.c @@ -359,7 +359,7 @@ uint32_t mblock_map_count = 0; MbcCacheLine mblock_cache[MBC_ENTRIES]; static MBlockMap * -findMBlockMap(void *p) +findMBlockMap(const void *p) { uint32_t i; StgWord32 hi = (StgWord32) (((StgWord)p) >> 32); @@ -373,7 +373,7 @@ findMBlockMap(void *p) return NULL; } -StgBool HEAP_ALLOCED_miss(StgWord mblock, void *p) +StgBool HEAP_ALLOCED_miss(StgWord mblock, const void *p) { MBlockMap *map; MBlockMapLine value; diff --git a/rts/sm/Sanity.c b/rts/sm/Sanity.c index 794bce7..2abe56b 100644 --- a/rts/sm/Sanity.c +++ b/rts/sm/Sanity.c @@ -35,7 +35,7 @@ static void checkSmallBitmap ( StgPtr payload, StgWord bitmap, uint32_t ); static void checkLargeBitmap ( StgPtr payload, StgLargeBitmap*, uint32_t ); -static void checkClosureShallow ( StgClosure * ); +static void checkClosureShallow ( const StgClosure * ); static void checkSTACK (StgStack *stack); /* ----------------------------------------------------------------------------- @@ -79,9 +79,9 @@ checkLargeBitmap( StgPtr payload, StgLargeBitmap* large_bitmap, uint32_t size ) */ static void -checkClosureShallow( StgClosure* p ) +checkClosureShallow( const StgClosure* p ) { - StgClosure *q; + const StgClosure *q; q = UNTAG_CLOSURE(p); ASSERT(LOOKS_LIKE_CLOSURE_PTR(q)); From git at git.haskell.org Thu May 12 15:30:34 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 12 May 2016 15:30:34 +0000 (UTC) Subject: [commit: ghc] master: Use StgHalfWord instead of a CPP #if (69c974f) Message-ID: <20160512153034.62FFD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/69c974fef825cfc286c9cad17ed8f4e138bf84fc/ghc >--------------------------------------------------------------- commit 69c974fef825cfc286c9cad17ed8f4e138bf84fc Author: Tomas Carnecky Date: Thu May 12 15:44:42 2016 +0200 Use StgHalfWord instead of a CPP #if Reviewers: simonmar, bgamari, austin Reviewed By: bgamari, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2183 >--------------------------------------------------------------- 69c974fef825cfc286c9cad17ed8f4e138bf84fc rts/RetainerProfile.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/rts/RetainerProfile.c b/rts/RetainerProfile.c index 04bbd82..7c3b9da 100644 --- a/rts/RetainerProfile.c +++ b/rts/RetainerProfile.c @@ -117,14 +117,9 @@ typedef union { // layout.payload struct { - // See StgClosureInfo in InfoTables.h -#if SIZEOF_VOID_P == 8 - StgWord32 pos; - StgWord32 ptrs; -#else - StgWord16 pos; - StgWord16 ptrs; -#endif + // See StgClosureInfo in InfoTables.h + StgHalfWord pos; + StgHalfWord ptrs; StgPtr payload; } ptrs; From git at git.haskell.org Thu May 12 15:30:37 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 12 May 2016 15:30:37 +0000 (UTC) Subject: [commit: ghc] master: Fix comments about scavenging WEAK objects (7c0b595) Message-ID: <20160512153037.2CEC23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7c0b595e55d31f9f89e6dede11981e942c5bb32f/ghc >--------------------------------------------------------------- commit 7c0b595e55d31f9f89e6dede11981e942c5bb32f Author: Takano Akio Date: Thu May 12 15:45:44 2016 +0200 Fix comments about scavenging WEAK objects This is a follow-up of D2189. If fixes some comments, deletes a section in the User's Guide about the bug, and updates .mailmap as suggested on the WorkinConventions wiki page. Test Plan: It compiles. Reviewers: austin, simonmar, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2202 GHC Trac Issues: #11108 >--------------------------------------------------------------- 7c0b595e55d31f9f89e6dede11981e942c5bb32f .mailmap | 1 + docs/users_guide/bugs.rst | 5 ----- rts/sm/MarkWeak.c | 8 +------- rts/sm/Scav.c | 4 ++++ 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/.mailmap b/.mailmap index 5ea062b..81dec3d 100644 --- a/.mailmap +++ b/.mailmap @@ -242,6 +242,7 @@ Sven Panne panne Sven Panne sven.panne at aedion.de Sylvain Henry S?bastien Carlier sebc +Takano Akio Thorkil Naur naur at post11.tele.dk Tibor Erdesz Tim Chevalier diff --git a/docs/users_guide/bugs.rst b/docs/users_guide/bugs.rst index c4ac9ce..ff83725 100644 --- a/docs/users_guide/bugs.rst +++ b/docs/users_guide/bugs.rst @@ -486,11 +486,6 @@ Bugs in GHC data A :: Type where B :: forall (a :: A). A -- There is known to be maleficent interactions between weak references and - laziness. Particularly, it has been observed that placing a thunk containing - a reference to a weak reference inside of another weak reference may cause - runtime crashes. See :ghc-ticket:`11108` for details. - .. _bugs-ghci: Bugs in GHCi (the interactive GHC) diff --git a/rts/sm/MarkWeak.c b/rts/sm/MarkWeak.c index 2393536..7e3e1d5 100644 --- a/rts/sm/MarkWeak.c +++ b/rts/sm/MarkWeak.c @@ -269,13 +269,7 @@ static rtsBool tidyWeakList(generation *gen) gct->evac_gen_no = new_gen->no; gct->failed_to_evac = rtsFalse; - // evacuate the value and finalizer - // - // This WEAK object will not be considered by tidyWeakList - // during this collection because it is in a generation >= N, - // but it is on the mutable list so we must evacuate all of its - // pointers because some of them may point into a younger - // generation. + // evacuate the fields of the weak ptr scavengeLiveWeak(w); if (gct->failed_to_evac) { diff --git a/rts/sm/Scav.c b/rts/sm/Scav.c index b046f39..7a799d6 100644 --- a/rts/sm/Scav.c +++ b/rts/sm/Scav.c @@ -1300,6 +1300,10 @@ scavenge_one(StgPtr p) } case WEAK: + // This WEAK object will not be considered by tidyWeakList during this + // collection because it is in a generation >= N, but it is on the + // mutable list so we must evacuate all of its pointers because some + // of them may point into a younger generation. scavengeLiveWeak((StgWeak *)p); break; From git at git.haskell.org Thu May 12 16:31:17 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 12 May 2016 16:31:17 +0000 (UTC) Subject: [commit: ghc] master: Refactor some ppr functions to use pprUFM (5416fad) Message-ID: <20160512163117.7AA2A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5416fadb7387cbe89752faa875b2dade60655cf2/ghc >--------------------------------------------------------------- commit 5416fadb7387cbe89752faa875b2dade60655cf2 Author: Bartosz Nitka Date: Thu May 12 08:01:34 2016 -0700 Refactor some ppr functions to use pprUFM Nondeterminism doesn't matter in these places and pprUFM makes it obvious. I've flipped the order of arguments for convenience. Test Plan: ./validate Reviewers: simonmar, bgamari, austin, simonpj Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2205 GHC Trac Issues: #4012 >--------------------------------------------------------------- 5416fadb7387cbe89752faa875b2dade60655cf2 compiler/basicTypes/RdrName.hs | 3 ++- compiler/basicTypes/VarSet.hs | 4 ++-- compiler/coreSyn/CoreSubst.hs | 4 +++- compiler/main/HscTypes.hs | 6 +++--- compiler/simplCore/SimplEnv.hs | 5 +++-- compiler/specialise/Rules.hs | 6 ++++-- compiler/typecheck/FamInst.hs | 2 +- compiler/typecheck/FunDeps.hs | 2 +- compiler/typecheck/TcErrors.hs | 2 +- compiler/typecheck/TcHsSyn.hs | 3 ++- compiler/typecheck/TcRnDriver.hs | 2 +- compiler/utils/UniqFM.hs | 8 ++++---- 12 files changed, 27 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 5416fadb7387cbe89752faa875b2dade60655cf2 From git at git.haskell.org Fri May 13 08:30:43 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 13 May 2016 08:30:43 +0000 (UTC) Subject: [commit: ghc] master: Test Trac #12039 (bd01bbb) Message-ID: <20160513083043.252E43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/bd01bbb24dcd9e426af85fc542ae5c9b5ab999b9/ghc >--------------------------------------------------------------- commit bd01bbb24dcd9e426af85fc542ae5c9b5ab999b9 Author: Simon Peyton Jones Date: Thu May 12 16:15:18 2016 +0100 Test Trac #12039 >--------------------------------------------------------------- bd01bbb24dcd9e426af85fc542ae5c9b5ab999b9 testsuite/tests/partial-sigs/should_fail/T12039.hs | 5 +++++ testsuite/tests/partial-sigs/should_fail/T12039.stderr | 4 ++++ testsuite/tests/partial-sigs/should_fail/all.T | 1 + 3 files changed, 10 insertions(+) diff --git a/testsuite/tests/partial-sigs/should_fail/T12039.hs b/testsuite/tests/partial-sigs/should_fail/T12039.hs new file mode 100644 index 0000000..f72f8af --- /dev/null +++ b/testsuite/tests/partial-sigs/should_fail/T12039.hs @@ -0,0 +1,5 @@ +{-# LANGUAGE PartialTypeSignatures #-} + +module T12039 where + +class Num _ => B a diff --git a/testsuite/tests/partial-sigs/should_fail/T12039.stderr b/testsuite/tests/partial-sigs/should_fail/T12039.stderr new file mode 100644 index 0000000..2a5fe33 --- /dev/null +++ b/testsuite/tests/partial-sigs/should_fail/T12039.stderr @@ -0,0 +1,4 @@ + +T12039.hs:5:11: error: + Wildcard ?_? not allowed + in the declaration for class ?B? diff --git a/testsuite/tests/partial-sigs/should_fail/all.T b/testsuite/tests/partial-sigs/should_fail/all.T index 9553d9d..67d59a5 100644 --- a/testsuite/tests/partial-sigs/should_fail/all.T +++ b/testsuite/tests/partial-sigs/should_fail/all.T @@ -61,3 +61,4 @@ test('T10999', normal, compile_fail, ['']) test('T11122', normal, compile, ['']) test('T11976', normal, compile_fail, ['']) test('PatBind3', normal, compile_fail, ['']) +test('T12039', normal, compile_fail, ['']) From git at git.haskell.org Sat May 14 08:03:29 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 14 May 2016 08:03:29 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Another haddock submodule bump (7eb2ad9) Message-ID: <20160514080329.651A33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/7eb2ad9595c90abdb792a291d6473b4b3a2934e6/ghc >--------------------------------------------------------------- commit 7eb2ad9595c90abdb792a291d6473b4b3a2934e6 Author: Ben Gamari Date: Sat May 14 09:59:12 2016 +0200 Another haddock submodule bump This resolves #12058. Thanks to P?li for tidentifying this issue so clearly. >--------------------------------------------------------------- 7eb2ad9595c90abdb792a291d6473b4b3a2934e6 utils/haddock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/haddock b/utils/haddock index af1a868..26e6b39 160000 --- a/utils/haddock +++ b/utils/haddock @@ -1 +1 @@ -Subproject commit af1a8689da1990da9a152ae8a0e51976f2a27ff6 +Subproject commit 26e6b39de3213969d7de7f8bb3d4a849136866d1 From git at git.haskell.org Sat May 14 10:50:04 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 14 May 2016 10:50:04 +0000 (UTC) Subject: [commit: ghc] branch 'wip/foldl' created Message-ID: <20160514105004.1610B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/foldl Referencing: ba46dd060f959e3c96a74c1546946c3f8bf84dd0 From git at git.haskell.org Sat May 14 10:50:07 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 14 May 2016 10:50:07 +0000 (UTC) Subject: [commit: ghc] wip/foldl: Use strict foldls (ba46dd0) Message-ID: <20160514105007.0A3E73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/foldl Link : http://ghc.haskell.org/trac/ghc/changeset/ba46dd060f959e3c96a74c1546946c3f8bf84dd0/ghc >--------------------------------------------------------------- commit ba46dd060f959e3c96a74c1546946c3f8bf84dd0 Author: Ben Gamari Date: Tue May 10 11:57:02 2016 +0200 Use strict foldls >--------------------------------------------------------------- ba46dd060f959e3c96a74c1546946c3f8bf84dd0 compiler/basicTypes/NameSet.hs | 3 ++- compiler/basicTypes/OccName.hs | 3 ++- compiler/basicTypes/RdrName.hs | 4 ++-- compiler/basicTypes/VarEnv.hs | 5 +++-- compiler/cmm/CmmBuildInfoTables.hs | 8 ++++---- compiler/cmm/CmmCommonBlockElim.hs | 2 +- compiler/cmm/CmmLayoutStack.hs | 4 ++-- compiler/cmm/CmmProcPoint.hs | 16 ++++++++-------- compiler/cmm/CmmSink.hs | 6 +++--- compiler/codeGen/StgCmmEnv.hs | 8 +++++--- compiler/codeGen/StgCmmMonad.hs | 2 +- compiler/codeGen/StgCmmPrim.hs | 2 +- compiler/coreSyn/CoreArity.hs | 3 ++- compiler/coreSyn/CoreSubst.hs | 11 ++++++----- compiler/coreSyn/CoreSyn.hs | 9 +++++---- compiler/coreSyn/CoreUtils.hs | 4 ++-- compiler/coreSyn/TrieMap.hs | 5 +++-- compiler/deSugar/DsExpr.hs | 3 ++- compiler/deSugar/DsForeign.hs | 2 +- compiler/deSugar/DsMeta.hs | 2 +- compiler/deSugar/DsUtils.hs | 3 ++- compiler/deSugar/Match.hs | 3 ++- compiler/hsSyn/HsTypes.hs | 3 ++- compiler/hsSyn/HsUtils.hs | 14 +++++++------- compiler/iface/IfaceEnv.hs | 4 ++-- compiler/main/GhcMake.hs | 6 +++--- compiler/main/HscMain.hs | 4 ++-- compiler/main/HscTypes.hs | 3 ++- compiler/main/Packages.hs | 2 +- compiler/nativeGen/AsmCodeGen.hs | 9 ++++----- compiler/rename/RnNames.hs | 6 +++--- compiler/simplCore/CallArity.hs | 3 ++- compiler/simplCore/FloatIn.hs | 6 +++--- compiler/simplCore/SetLevels.hs | 18 ++++++++++-------- compiler/specialise/Rules.hs | 4 ++-- compiler/specialise/Specialise.hs | 3 ++- compiler/stranal/DmdAnal.hs | 4 ++-- compiler/typecheck/FunDeps.hs | 4 ++-- compiler/typecheck/TcBinds.hs | 3 ++- compiler/typecheck/TcExpr.hs | 6 +++--- compiler/typecheck/TcGenDeriv.hs | 12 ++++++------ compiler/typecheck/TcInstDcls.hs | 3 ++- compiler/typecheck/TcPatSyn.hs | 8 ++++---- compiler/typecheck/TcRnTypes.hs | 3 ++- compiler/typecheck/TcSplice.hs | 3 ++- compiler/typecheck/TcType.hs | 3 ++- compiler/typecheck/TcValidity.hs | 10 +++++----- compiler/types/Coercion.hs | 11 ++++++----- compiler/types/FamInstEnv.hs | 3 ++- compiler/types/InstEnv.hs | 3 ++- compiler/types/TyCoRep.hs | 2 +- compiler/types/Type.hs | 3 ++- compiler/utils/Bag.hs | 4 ++-- compiler/utils/FiniteMap.hs | 7 ++++--- compiler/utils/OrdList.hs | 3 ++- compiler/utils/UniqDFM.hs | 8 ++++---- compiler/utils/UniqDSet.hs | 5 +++-- compiler/utils/UniqFM.hs | 17 +++++++++-------- compiler/utils/UniqSet.hs | 5 +++-- compiler/utils/Util.hs | 2 +- 60 files changed, 178 insertions(+), 147 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc ba46dd060f959e3c96a74c1546946c3f8bf84dd0 From git at git.haskell.org Sat May 14 10:50:27 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 14 May 2016 10:50:27 +0000 (UTC) Subject: [commit: ghc] master: Bump haddock submodule (8e48d24) Message-ID: <20160514105027.B6EE33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8e48d2478083af65147a302f435ee2df54d4b321/ghc >--------------------------------------------------------------- commit 8e48d2478083af65147a302f435ee2df54d4b321 Author: Ben Gamari Date: Thu May 12 17:44:49 2016 +0200 Bump haddock submodule This includes various fixes to Haddock's integration with the GHC build system. >--------------------------------------------------------------- 8e48d2478083af65147a302f435ee2df54d4b321 utils/haddock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/haddock b/utils/haddock index d7ef908..261342e 160000 --- a/utils/haddock +++ b/utils/haddock @@ -1 +1 @@ -Subproject commit d7ef90898c6d8ddeae23caf0f9fb68c25537dcd0 +Subproject commit 261342e47efc2756c6befd1e3d83c42d5dd082c6 From git at git.haskell.org Sun May 15 09:04:28 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 15 May 2016 09:04:28 +0000 (UTC) Subject: [commit: ghc] branch 'wip/erikd/rts' created Message-ID: <20160515090428.EC8F03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/erikd/rts Referencing: cb6f0a009e7d1e9552d27110a5a53882f2dbad68 From git at git.haskell.org Sun May 15 09:04:31 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 15 May 2016 09:04:31 +0000 (UTC) Subject: [commit: ghc] wip/erikd/rts: rts: More const correct-ness fixes (cb6f0a0) Message-ID: <20160515090431.B17773A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/rts Link : http://ghc.haskell.org/trac/ghc/changeset/cb6f0a009e7d1e9552d27110a5a53882f2dbad68/ghc >--------------------------------------------------------------- commit cb6f0a009e7d1e9552d27110a5a53882f2dbad68 Author: Erik de Castro Lopo Date: Sun May 15 14:33:15 2016 +1000 rts: More const correct-ness fixes >--------------------------------------------------------------- cb6f0a009e7d1e9552d27110a5a53882f2dbad68 includes/rts/storage/ClosureMacros.h | 31 ++++++++++++++--------- includes/rts/storage/InfoTables.h | 5 ++-- rts/CheckUnload.c | 6 ++--- rts/Hash.c | 10 ++++---- rts/Hash.h | 9 +++++-- rts/Hpc.c | 3 ++- rts/Printer.c | 49 ++++++++++++++++++------------------ rts/Printer.h | 16 ++++++------ rts/ProfHeap.c | 18 ++++++------- rts/Profiling.c | 6 ++--- rts/RaiseAsync.c | 2 +- rts/RetainerProfile.c | 2 +- rts/RtsAPI.c | 4 +-- rts/STM.c | 2 +- rts/Schedule.c | 8 +++--- rts/Stable.c | 2 +- rts/ThreadPaused.c | 2 +- rts/sm/Compact.c | 8 +++--- rts/sm/Sanity.c | 20 +++++++-------- rts/sm/Sanity.h | 2 +- rts/sm/Scav.c | 12 ++++----- 21 files changed, 116 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 cb6f0a009e7d1e9552d27110a5a53882f2dbad68 From git at git.haskell.org Sun May 15 11:02:34 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 15 May 2016 11:02:34 +0000 (UTC) Subject: [commit: ghc] master: Fix a performance issue with -fprint-expanded-synonyms (e4834ed) Message-ID: <20160515110234.65FB33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e4834edf4418ace657361649365979e29ebd9daa/ghc >--------------------------------------------------------------- commit e4834edf4418ace657361649365979e29ebd9daa Author: ?mer Sinan A?acan Date: Sun May 15 07:04:39 2016 -0400 Fix a performance issue with -fprint-expanded-synonyms The type synonym expander was doing redundant work by looking at same types again and again. This patch fixes the loop code when both of the types can be expanded, to do `O(min(n, m))` comparisons and `O(n + m)` expansions, where `n` is expansions of the first type and `m` is expansions of the second type. Reported by sjcjoosten in T10547. Test Plan: Added a regression test that was taking several minutes to type check before this patch. Reviewers: bgamari, simonpj, austin, ezyang Reviewed By: bgamari, simonpj, austin, ezyang Subscribers: simonpj, thomie Differential Revision: https://phabricator.haskell.org/D2198 GHC Trac Issues: #10547 >--------------------------------------------------------------- e4834edf4418ace657361649365979e29ebd9daa compiler/typecheck/TcErrors.hs | 196 +++++++++++++++++----------- testsuite/tests/perf/compiler/T10547.hs | 90 +++++++++++++ testsuite/tests/perf/compiler/T10547.stderr | 11 ++ testsuite/tests/perf/compiler/all.T | 8 ++ 4 files changed, 226 insertions(+), 79 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc e4834edf4418ace657361649365979e29ebd9daa From git at git.haskell.org Sun May 15 21:16:47 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 15 May 2016 21:16:47 +0000 (UTC) Subject: [commit: packages/bytestring] tag '0.10.8.1' created Message-ID: <20160515211647.0914D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring New tag : 0.10.8.1 Referencing: 5f8ac2d110294cdb7ff3dd7019478617ae3e9f2d From git at git.haskell.org Sun May 15 21:16:49 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 15 May 2016 21:16:49 +0000 (UTC) Subject: [commit: packages/bytestring] master: Add missing operator import (fixes #72) (9156ae5) Message-ID: <20160515211649.13AE83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : master Link : http://git.haskell.org/packages/bytestring.git/commitdiff/9156ae522936bda7f7ceaa1141ee13f95fa77945 >--------------------------------------------------------------- commit 9156ae522936bda7f7ceaa1141ee13f95fa77945 Author: Michael Snoyman Date: Wed May 4 07:34:25 2016 +0300 Add missing operator import (fixes #72) >--------------------------------------------------------------- 9156ae522936bda7f7ceaa1141ee13f95fa77945 Data/ByteString/Lazy.hs | 1 + tests/Properties.hs | 1 + 2 files changed, 2 insertions(+) diff --git a/Data/ByteString/Lazy.hs b/Data/ByteString/Lazy.hs index 77e1520..01d4c1c 100644 --- a/Data/ByteString/Lazy.hs +++ b/Data/ByteString/Lazy.hs @@ -225,6 +225,7 @@ import qualified Data.ByteString.Unsafe as S import Data.ByteString.Lazy.Internal #if !(MIN_VERSION_base(4,8,0)) +import Control.Applicative ((<$>)) import Data.Monoid (Monoid(..)) #endif import Control.Monad (mplus) diff --git a/tests/Properties.hs b/tests/Properties.hs index 60e3a49..d5ed575 100644 --- a/tests/Properties.hs +++ b/tests/Properties.hs @@ -14,6 +14,7 @@ import Foreign.Marshal.Alloc import Foreign.Marshal.Array import GHC.Ptr import Test.QuickCheck +import Control.Applicative import Control.Monad import Control.Concurrent import Control.Exception From git at git.haskell.org Sun May 15 21:16:51 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 15 May 2016 21:16:51 +0000 (UTC) Subject: [commit: packages/bytestring] master: Fix misspelled WORDS_BIGENDIAN macro (4f52849) Message-ID: <20160515211651.1DD293A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : master Link : http://git.haskell.org/packages/bytestring.git/commitdiff/4f52849a99753fab63d634769dd35a31f4d5a1b2 >--------------------------------------------------------------- commit 4f52849a99753fab63d634769dd35a31f4d5a1b2 Author: Herbert Valerio Riedel Date: Thu May 12 20:36:34 2016 +0200 Fix misspelled WORDS_BIGENDIAN macro This was causing word{16,32,64}{le,be} primitives to break on big endian archs (such as `powerpc`/`powerpc64`) with serious consequences such as https://github.com/TomMD/pureMD5/issues/5 >--------------------------------------------------------------- 4f52849a99753fab63d634769dd35a31f4d5a1b2 Data/ByteString/Builder/Prim/Binary.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Data/ByteString/Builder/Prim/Binary.hs b/Data/ByteString/Builder/Prim/Binary.hs index 136a75a..af0c0bb 100644 --- a/Data/ByteString/Builder/Prim/Binary.hs +++ b/Data/ByteString/Builder/Prim/Binary.hs @@ -83,7 +83,7 @@ word8 = storableToF -- | Encoding 'Word16's in big endian format. {-# INLINE word16BE #-} word16BE :: FixedPrim Word16 -#ifdef WORD_BIGENDIAN +#ifdef WORDS_BIGENDIAN word16BE = word16Host #else word16BE = fixedPrim 2 $ \w p -> do @@ -94,7 +94,7 @@ word16BE = fixedPrim 2 $ \w p -> do -- | Encoding 'Word16's in little endian format. {-# INLINE word16LE #-} word16LE :: FixedPrim Word16 -#ifdef WORD_BIGENDIAN +#ifdef WORDS_BIGENDIAN word16LE = fixedPrim 2 $ \w p -> do poke p (fromIntegral (w) :: Word8) poke (p `plusPtr` 1) (fromIntegral (shiftr_w16 w 8) :: Word8) @@ -105,7 +105,7 @@ word16LE = word16Host -- | Encoding 'Word32's in big endian format. {-# INLINE word32BE #-} word32BE :: FixedPrim Word32 -#ifdef WORD_BIGENDIAN +#ifdef WORDS_BIGENDIAN word32BE = word32Host #else word32BE = fixedPrim 4 $ \w p -> do @@ -118,7 +118,7 @@ word32BE = fixedPrim 4 $ \w p -> do -- | Encoding 'Word32's in little endian format. {-# INLINE word32LE #-} word32LE :: FixedPrim Word32 -#ifdef WORD_BIGENDIAN +#ifdef WORDS_BIGENDIAN word32LE = fixedPrim 4 $ \w p -> do poke p (fromIntegral (w) :: Word8) poke (p `plusPtr` 1) (fromIntegral (shiftr_w32 w 8) :: Word8) @@ -134,7 +134,7 @@ word32LE = word32Host -- | Encoding 'Word64's in big endian format. {-# INLINE word64BE #-} word64BE :: FixedPrim Word64 -#ifdef WORD_BIGENDIAN +#ifdef WORDS_BIGENDIAN word64BE = word64Host #else #if WORD_SIZE_IN_BITS < 64 @@ -170,7 +170,7 @@ word64BE = fixedPrim 8 $ \w p -> do -- | Encoding 'Word64's in little endian format. {-# INLINE word64LE #-} word64LE :: FixedPrim Word64 -#ifdef WORD_BIGENDIAN +#ifdef WORDS_BIGENDIAN #if WORD_SIZE_IN_BITS < 64 word64LE = fixedPrim 8 $ \w p -> do From git at git.haskell.org Sun May 15 21:16:53 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 15 May 2016 21:16:53 +0000 (UTC) Subject: [commit: packages/bytestring] master: Bump version to 0.10.8.1 (84253da) Message-ID: <20160515211653.256983A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/bytestring On branch : master Link : http://git.haskell.org/packages/bytestring.git/commitdiff/84253da85952765dd7631e467cc2b1d1bba03f24 >--------------------------------------------------------------- commit 84253da85952765dd7631e467cc2b1d1bba03f24 Author: Duncan Coutts Date: Sun May 15 21:59:50 2016 +0100 Bump version to 0.10.8.1 And update changelog >--------------------------------------------------------------- 84253da85952765dd7631e467cc2b1d1bba03f24 Changelog.md | 5 +++++ bytestring.cabal | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index f162650..f044365 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,8 @@ +0.10.8.1 Duncan Coutts May 2016 + + * Fix Builder output on big-endian architectures + * Fix building with ghc-7.6 and older + 0.10.8.0 Duncan Coutts May 2016 * Use Rabin-Karp substring search for `breakSubstring` and `findSubstring` diff --git a/bytestring.cabal b/bytestring.cabal index acf6ef1..5890959 100644 --- a/bytestring.cabal +++ b/bytestring.cabal @@ -1,5 +1,5 @@ Name: bytestring -Version: 0.10.8.0 +Version: 0.10.8.1 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 Sun May 15 21:18:28 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 15 May 2016 21:18:28 +0000 (UTC) Subject: [commit: ghc] master: Update bytestring submodule to 0.10.8.1 release tag (c974927) Message-ID: <20160515211828.CCC693A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c974927318c177483b47d62af6c61e5a4d6f59e1/ghc >--------------------------------------------------------------- commit c974927318c177483b47d62af6c61e5a4d6f59e1 Author: Herbert Valerio Riedel Date: Sun May 15 23:19:18 2016 +0200 Update bytestring submodule to 0.10.8.1 release tag >--------------------------------------------------------------- c974927318c177483b47d62af6c61e5a4d6f59e1 libraries/bytestring | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/bytestring b/libraries/bytestring index 0ee4596..84253da 160000 --- a/libraries/bytestring +++ b/libraries/bytestring @@ -1 +1 @@ -Subproject commit 0ee45965232f6838d5bbbf9f0fe666a32a79a6da +Subproject commit 84253da85952765dd7631e467cc2b1d1bba03f24 From git at git.haskell.org Mon May 16 00:19:52 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 May 2016 00:19:52 +0000 (UTC) Subject: [commit: ghc] wip/erikd/rts: rts: More const correct-ness fixes (7d95b20) Message-ID: <20160516001952.6AF463A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/rts Link : http://ghc.haskell.org/trac/ghc/changeset/7d95b20a1cd224299bf168d9c885c7f379fc103f/ghc >--------------------------------------------------------------- commit 7d95b20a1cd224299bf168d9c885c7f379fc103f Author: Erik de Castro Lopo Date: Sun May 15 14:33:15 2016 +1000 rts: More const correct-ness fixes >--------------------------------------------------------------- 7d95b20a1cd224299bf168d9c885c7f379fc103f includes/rts/storage/ClosureMacros.h | 31 ++++++++++++++--------- includes/rts/storage/InfoTables.h | 5 ++-- rts/CheckUnload.c | 6 ++--- rts/Hash.c | 10 ++++---- rts/Hash.h | 9 +++++-- rts/Hpc.c | 3 ++- rts/Printer.c | 49 ++++++++++++++++++------------------ rts/Printer.h | 16 ++++++------ rts/ProfHeap.c | 18 ++++++------- rts/Profiling.c | 6 ++--- rts/RaiseAsync.c | 2 +- rts/RetainerProfile.c | 2 +- rts/RtsAPI.c | 4 +-- rts/STM.c | 2 +- rts/Schedule.c | 8 +++--- rts/Stable.c | 2 +- rts/ThreadPaused.c | 2 +- rts/sm/Compact.c | 8 +++--- rts/sm/Sanity.c | 20 +++++++-------- rts/sm/Sanity.h | 2 +- rts/sm/Scav.c | 12 ++++----- 21 files changed, 116 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 7d95b20a1cd224299bf168d9c885c7f379fc103f From git at git.haskell.org Mon May 16 00:19:55 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 May 2016 00:19:55 +0000 (UTC) Subject: [commit: ghc] wip/erikd/rts: Set `USE_MMAP` at configure time (5fae81c) Message-ID: <20160516001955.172773A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/rts Link : http://ghc.haskell.org/trac/ghc/changeset/5fae81ceb24d3e306a127a61bcf5fe6ab8db1f95/ghc >--------------------------------------------------------------- commit 5fae81ceb24d3e306a127a61bcf5fe6ab8db1f95 Author: Erik de Castro Lopo Date: Sun May 15 21:07:25 2016 +1000 Set `USE_MMAP` at configure time The `USE_MMAP` macro is used in the run time linker and was being set with some really ugly CPP hackery. Setting it in the configure script is much neater. >--------------------------------------------------------------- 5fae81ceb24d3e306a127a61bcf5fe6ab8db1f95 configure.ac | 22 ++++++++++++++++++++++ rts/Linker.c | 18 +----------------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/configure.ac b/configure.ac index defc182..e39d77b 100644 --- a/configure.ac +++ b/configure.ac @@ -1062,6 +1062,28 @@ if test "$use_large_address_space" = "yes" ; then AC_DEFINE([USE_LARGE_ADDRESS_SPACE], [1], [Enable single heap address space support]) fi +dnl ** Use MMAP in the runtime linker? +dnl -------------------------------------------------------------- + +case ${TargetArch}-${TargetOS} in + powerpc-darwmin) + # Don't use mmap on powerpc/darwin as the mmap there doesn't support + # reallocating but we need to allocate jump islands just after each + # object images. Otherwise relative branches to jump islands can fail + # due to 24-bits displacement overflow. + UseMmap=0 + ;; + *-mingw32) + # Mmap is not available on Windows. + UseMmap=0 + ;; + *) + UseMmap=1 + ;; + esac + +AC_DEFINE_UNQUOTED([USE_MMAP], [$UseMmap], [Use mmap in the runtime linker]) + dnl ** Have libdw? dnl -------------------------------------------------------------- AC_ARG_ENABLE(libdw, diff --git a/rts/Linker.c b/rts/Linker.c index 09d4f6a..c4ca32f 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -52,19 +52,7 @@ #include #endif -#if (defined(powerpc_HOST_ARCH) && defined(linux_HOST_OS)) \ - || (!defined(powerpc_HOST_ARCH) && \ - ( defined(linux_HOST_OS) || defined(freebsd_HOST_OS) || \ - defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS ) || \ - defined(openbsd_HOST_OS ) || defined(darwin_HOST_OS ) || \ - defined(kfreebsdgnu_HOST_OS) || defined(gnu_HOST_OS ) || \ - defined(solaris2_HOST_OS))) -/* Don't use mmap on powerpc/darwin as the mmap there doesn't support - * reallocating but we need to allocate jump islands just after each - * object images. Otherwise relative branches to jump islands can fail - * due to 24-bits displacement overflow. - */ -#define USE_MMAP 1 +#if USE_MMAP #include #include @@ -72,10 +60,6 @@ #include #endif -#else - -#define USE_MMAP 0 - #endif From git at git.haskell.org Mon May 16 00:19:57 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 May 2016 00:19:57 +0000 (UTC) Subject: [commit: ghc] wip/erikd/rts's head updated: Set `USE_MMAP` at configure time (5fae81c) Message-ID: <20160516001957.89F573A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/erikd/rts' now includes: e4834ed Fix a performance issue with -fprint-expanded-synonyms c974927 Update bytestring submodule to 0.10.8.1 release tag 7d95b20 rts: More const correct-ness fixes 5fae81c Set `USE_MMAP` at configure time From git at git.haskell.org Mon May 16 02:11:28 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 May 2016 02:11:28 +0000 (UTC) Subject: [commit: ghc] wip/erikd/rts: Set `USE_MMAP` at configure time (431ada2) Message-ID: <20160516021128.F077F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/rts Link : http://ghc.haskell.org/trac/ghc/changeset/431ada2aa2c756316145b290dd2eadfe5978c9e8/ghc >--------------------------------------------------------------- commit 431ada2aa2c756316145b290dd2eadfe5978c9e8 Author: Erik de Castro Lopo Date: Mon May 16 09:07:25 2016 +1000 Set `USE_MMAP` at configure time The `USE_MMAP` macro is used in the run time linker and was being set with some really ugly CPP hackery. Setting in the configure script is much neater. >--------------------------------------------------------------- 431ada2aa2c756316145b290dd2eadfe5978c9e8 configure.ac | 30 ++++++++++++++++++++++++++++++ rts/Linker.c | 18 +----------------- 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/configure.ac b/configure.ac index defc182..c04e9b0 100644 --- a/configure.ac +++ b/configure.ac @@ -1062,6 +1062,36 @@ if test "$use_large_address_space" = "yes" ; then AC_DEFINE([USE_LARGE_ADDRESS_SPACE], [1], [Enable single heap address space support]) fi +dnl ** Use MMAP in the runtime linker? +dnl -------------------------------------------------------------- + +case ${TargetOS} in + linux|freebsd|dragonfly|netbsd|openbsd|kfreebsdgnu|gnu|solaris2) + UseMmap=1 + ;; + darwin) + # Don't use mmap on powerpc/darwin as the mmap there doesn't support + # reallocating. Reallocating is needed to allocate jump islands just + # after each object image. Jumps to these jump islands use relative + # branches which are limited to offsets that can be represented in + # 24-bits. + if test ${TargetArch} != "powerpc" ; then + UseMmap=1 + else + UseMmap=0 + fi + ;; + mingw32) + # Mmap is not available on Windows. + UseMmap=0 + ;; + *) + UseMmap=0 + ;; + esac + +AC_DEFINE_UNQUOTED([USE_MMAP], [$UseMmap], [Use mmap in the runtime linker]) + dnl ** Have libdw? dnl -------------------------------------------------------------- AC_ARG_ENABLE(libdw, diff --git a/rts/Linker.c b/rts/Linker.c index 09d4f6a..c4ca32f 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -52,19 +52,7 @@ #include #endif -#if (defined(powerpc_HOST_ARCH) && defined(linux_HOST_OS)) \ - || (!defined(powerpc_HOST_ARCH) && \ - ( defined(linux_HOST_OS) || defined(freebsd_HOST_OS) || \ - defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS ) || \ - defined(openbsd_HOST_OS ) || defined(darwin_HOST_OS ) || \ - defined(kfreebsdgnu_HOST_OS) || defined(gnu_HOST_OS ) || \ - defined(solaris2_HOST_OS))) -/* Don't use mmap on powerpc/darwin as the mmap there doesn't support - * reallocating but we need to allocate jump islands just after each - * object images. Otherwise relative branches to jump islands can fail - * due to 24-bits displacement overflow. - */ -#define USE_MMAP 1 +#if USE_MMAP #include #include @@ -72,10 +60,6 @@ #include #endif -#else - -#define USE_MMAP 0 - #endif From git at git.haskell.org Mon May 16 08:06:57 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 May 2016 08:06:57 +0000 (UTC) Subject: [commit: ghc] branch 'wip/hasfield' created Message-ID: <20160516080657.895453A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/hasfield Referencing: b50eb34cc3a941ded2b8c1e1b036b5767a620f55 From git at git.haskell.org Mon May 16 08:07:00 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 May 2016 08:07:00 +0000 (UTC) Subject: [commit: ghc] wip/hasfield: Add EvExpr constructor to EvTerm (bca49cd) Message-ID: <20160516080700.4E5A43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/hasfield Link : http://ghc.haskell.org/trac/ghc/changeset/bca49cd5c74b4b42b39151daceea7cac74096e56/ghc >--------------------------------------------------------------- commit bca49cd5c74b4b42b39151daceea7cac74096e56 Author: Adam Gundry Date: Tue Dec 22 16:05:21 2015 +0000 Add EvExpr constructor to EvTerm This makes it possible to embed arbitrary HsExprs as evidence terms, which will be useful for solving HasField constraints and for typechecker plugins. >--------------------------------------------------------------- bca49cd5c74b4b42b39151daceea7cac74096e56 compiler/deSugar/DsBinds.hs | 3 ++- compiler/typecheck/TcEvidence.hs | 6 ++++++ compiler/typecheck/TcHsSyn.hs | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/compiler/deSugar/DsBinds.hs b/compiler/deSugar/DsBinds.hs index 1249806..ab27625 100644 --- a/compiler/deSugar/DsBinds.hs +++ b/compiler/deSugar/DsBinds.hs @@ -18,7 +18,7 @@ module DsBinds ( dsTopLHsBinds, dsLHsBinds, decomposeRuleLhs, dsSpec, #include "HsVersions.h" -import {-# SOURCE #-} DsExpr( dsLExpr ) +import {-# SOURCE #-} DsExpr( dsExpr, dsLExpr ) import {-# SOURCE #-} Match( matchWrapper ) import DsMonad @@ -1007,6 +1007,7 @@ dsEvTerm (EvCallStack cs) = dsEvCallStack cs dsEvTerm (EvTypeable ty ev) = dsEvTypeable ty ev dsEvTerm (EvLit (EvNum n)) = mkIntegerExpr n dsEvTerm (EvLit (EvStr s)) = mkStringExprFS s +dsEvTerm (EvExpr e) = dsExpr e dsEvTerm (EvCast tm co) = do { tm' <- dsEvTerm tm diff --git a/compiler/typecheck/TcEvidence.hs b/compiler/typecheck/TcEvidence.hs index 7890115..2866383 100644 --- a/compiler/typecheck/TcEvidence.hs +++ b/compiler/typecheck/TcEvidence.hs @@ -53,6 +53,7 @@ import VarEnv import VarSet import Name import Pair +import HsExpr ( HsExpr ) import Util import Bag @@ -361,6 +362,9 @@ data EvTerm | EvTypeable Type EvTypeable -- Dictionary for (Typeable ty) + | EvExpr (HsExpr Id) -- Dictionary for HasField (internally generated) + -- or arbitrary class (generated by plugin) + deriving( Data.Data, Data.Typeable ) @@ -657,6 +661,7 @@ evVarsOfTerm (EvDelayedError _ _) = emptyVarSet evVarsOfTerm (EvLit _) = emptyVarSet evVarsOfTerm (EvCallStack cs) = evVarsOfCallStack cs evVarsOfTerm (EvTypeable _ ev) = evVarsOfTypeable ev +evVarsOfTerm (EvExpr _) = emptyVarSet evVarsOfTerms :: [EvTerm] -> VarSet evVarsOfTerms = mapUnionVarSet evVarsOfTerm @@ -756,6 +761,7 @@ instance Outputable EvTerm where ppr (EvDelayedError ty msg) = ptext (sLit "error") <+> sep [ char '@' <> ppr ty, ppr msg ] ppr (EvTypeable ty ev) = ppr ev <+> dcolon <+> ptext (sLit "Typeable") <+> ppr ty + ppr (EvExpr e) = ppr e instance Outputable EvLit where ppr (EvNum n) = integer n diff --git a/compiler/typecheck/TcHsSyn.hs b/compiler/typecheck/TcHsSyn.hs index ee7038d..0780325 100644 --- a/compiler/typecheck/TcHsSyn.hs +++ b/compiler/typecheck/TcHsSyn.hs @@ -1278,6 +1278,9 @@ zonkEvTerm env (EvDFunApp df tys tms) zonkEvTerm env (EvDelayedError ty msg) = do { ty' <- zonkTcTypeToType env ty ; return (EvDelayedError ty' msg) } +zonkEvTerm env (EvExpr e) + = do { e' <- zonkExpr env e + ; return (EvExpr e') } zonkEvTypeable :: ZonkEnv -> EvTypeable -> TcM EvTypeable zonkEvTypeable env (EvTypeableTyCon ts) From git at git.haskell.org Mon May 16 08:07:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 May 2016 08:07:03 +0000 (UTC) Subject: [commit: ghc] wip/hasfield: Add dataConFieldType_maybe (35cd301) Message-ID: <20160516080703.0557C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/hasfield Link : http://ghc.haskell.org/trac/ghc/changeset/35cd30152f88508f4c171596d93e87f81a7c0b14/ghc >--------------------------------------------------------------- commit 35cd30152f88508f4c171596d93e87f81a7c0b14 Author: Adam Gundry Date: Tue Dec 22 16:07:26 2015 +0000 Add dataConFieldType_maybe >--------------------------------------------------------------- 35cd30152f88508f4c171596d93e87f81a7c0b14 compiler/basicTypes/DataCon.hs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/compiler/basicTypes/DataCon.hs b/compiler/basicTypes/DataCon.hs index 712a9b2..ec7c9a7 100644 --- a/compiler/basicTypes/DataCon.hs +++ b/compiler/basicTypes/DataCon.hs @@ -35,7 +35,7 @@ module DataCon ( dataConStupidTheta, dataConInstArgTys, dataConOrigArgTys, dataConOrigResTy, dataConInstOrigArgTys, dataConRepArgTys, - dataConFieldLabels, dataConFieldType, + dataConFieldLabels, dataConFieldType, dataConFieldType_maybe, dataConSrcBangs, dataConSourceArity, dataConRepArity, dataConRepRepArity, dataConIsInfix, @@ -81,7 +81,7 @@ import qualified Data.Data as Data import qualified Data.Typeable import Data.Char import Data.Word -import Data.List( mapAccumL, find ) +import Data.List( mapAccumL ) {- Data constructor representation @@ -889,11 +889,16 @@ dataConFieldLabels = dcFields -- | Extract the type for any given labelled field of the 'DataCon' dataConFieldType :: DataCon -> FieldLabelString -> Type -dataConFieldType con label - = case find ((== label) . flLabel . fst) (dcFields con `zip` dcOrigArgTys con) of - Just (_, ty) -> ty +dataConFieldType con label = case dataConFieldType_maybe con label of + Just ty -> ty Nothing -> pprPanic "dataConFieldType" (ppr con <+> ppr label) +-- | Extract the type for any given labelled field of the 'DataCon', +-- or return 'Nothing' if the field does not belong to it +dataConFieldType_maybe :: DataCon -> FieldLabelString -> Maybe Type +dataConFieldType_maybe con label + = lookup label (map flLabel (dcFields con) `zip` dcOrigArgTys con) + -- | Strictness/unpack annotations, from user; or, for imported -- DataCons, from the interface file -- The list is in one-to-one correspondence with the arity of the 'DataCon' From git at git.haskell.org Mon May 16 08:07:05 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 May 2016 08:07:05 +0000 (UTC) Subject: [commit: ghc] wip/hasfield: Make tcLookupId available in TcS (9822545) Message-ID: <20160516080705.A73C43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/hasfield Link : http://ghc.haskell.org/trac/ghc/changeset/9822545bbb2efb119be006843f63765f2b2fa41f/ghc >--------------------------------------------------------------- commit 9822545bbb2efb119be006843f63765f2b2fa41f Author: Adam Gundry Date: Tue Dec 22 16:08:12 2015 +0000 Make tcLookupId available in TcS >--------------------------------------------------------------- 9822545bbb2efb119be006843f63765f2b2fa41f compiler/typecheck/TcSMonad.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/compiler/typecheck/TcSMonad.hs b/compiler/typecheck/TcSMonad.hs index ac38e17..af7c4cc 100644 --- a/compiler/typecheck/TcSMonad.hs +++ b/compiler/typecheck/TcSMonad.hs @@ -42,6 +42,7 @@ module TcSMonad ( getTcEvBinds, getTcEvBindsFromVar, getTcLevel, getTcEvBindsMap, tcLookupClass, + tcLookupId, -- Inerts InertSet(..), InertCans(..), @@ -119,7 +120,7 @@ import FamInstEnv import qualified TcRnMonad as TcM import qualified TcMType as TcM import qualified TcEnv as TcM - ( checkWellStaged, topIdLvl, tcGetDefaultTys, tcLookupClass ) + ( checkWellStaged, topIdLvl, tcGetDefaultTys, tcLookupClass, tcLookupId ) import Kind import TcType import DynFlags @@ -2647,6 +2648,9 @@ getLclEnv = wrapTcS $ TcM.getLclEnv tcLookupClass :: Name -> TcS Class tcLookupClass c = wrapTcS $ TcM.tcLookupClass c +tcLookupId :: Name -> TcS Id +tcLookupId n = wrapTcS $ TcM.tcLookupId n + -- Setting names as used (used in the deriving of Coercible evidence) -- Too hackish to expose it to TcS? In that case somehow extract the used -- constructors from the result of solveInteract From git at git.haskell.org Mon May 16 08:07:08 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 May 2016 08:07:08 +0000 (UTC) Subject: [commit: ghc] wip/hasfield: Make addUsedGRE available in TcS (cc1fc74) Message-ID: <20160516080708.544423A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/hasfield Link : http://ghc.haskell.org/trac/ghc/changeset/cc1fc74834f94c32f1a5c44735e7bda38d0a45b3/ghc >--------------------------------------------------------------- commit cc1fc74834f94c32f1a5c44735e7bda38d0a45b3 Author: Adam Gundry Date: Tue Dec 22 16:23:03 2015 +0000 Make addUsedGRE available in TcS >--------------------------------------------------------------- cc1fc74834f94c32f1a5c44735e7bda38d0a45b3 compiler/typecheck/TcSMonad.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/compiler/typecheck/TcSMonad.hs b/compiler/typecheck/TcSMonad.hs index af7c4cc..c0ea916 100644 --- a/compiler/typecheck/TcSMonad.hs +++ b/compiler/typecheck/TcSMonad.hs @@ -16,7 +16,7 @@ module TcSMonad ( runTcSEqualities, nestTcS, nestImplicTcS, - runTcPluginTcS, addUsedDataCons, deferTcSForAllEq, + runTcPluginTcS, addUsedDataCons, addUsedGRE, deferTcSForAllEq, -- Tracing etc panicTcS, traceTcS, @@ -134,7 +134,7 @@ import TyCon import TcErrors ( solverDepthErrorTcS ) import Name -import RdrName ( GlobalRdrEnv) +import RdrName ( GlobalRdrEnv, GlobalRdrElt ) import qualified RnEnv as TcM import Var import VarEnv @@ -2657,6 +2657,10 @@ tcLookupId n = wrapTcS $ TcM.tcLookupId n addUsedDataCons :: GlobalRdrEnv -> TyCon -> TcS () addUsedDataCons rdr_env tycon = wrapTcS $ TcM.addUsedDataCons rdr_env tycon +addUsedGRE :: Bool -> GlobalRdrElt -> TcS () +addUsedGRE warn_if_deprec gre = wrapTcS $ TcM.addUsedGRE warn_if_deprec gre + + -- Various smaller utilities [TODO, maybe will be absorbed in the instance matcher] -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From git at git.haskell.org Mon May 16 08:07:11 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 May 2016 08:07:11 +0000 (UTC) Subject: [commit: ghc] wip/hasfield: Add GHC.Records module including HasField class (760d4e8) Message-ID: <20160516080711.4E7ED3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/hasfield Link : http://ghc.haskell.org/trac/ghc/changeset/760d4e8399ce3394a7a685ad67cc093455a380b9/ghc >--------------------------------------------------------------- commit 760d4e8399ce3394a7a685ad67cc093455a380b9 Author: Adam Gundry Date: Tue Dec 22 16:10:46 2015 +0000 Add GHC.Records module including HasField class >--------------------------------------------------------------- 760d4e8399ce3394a7a685ad67cc093455a380b9 compiler/prelude/PrelNames.hs | 14 ++++++++++++++ libraries/base/GHC/Records.hs | 30 ++++++++++++++++++++++++++++++ libraries/base/base.cabal | 1 + 3 files changed, 45 insertions(+) diff --git a/compiler/prelude/PrelNames.hs b/compiler/prelude/PrelNames.hs index c83c73f..6fa7c40 100644 --- a/compiler/prelude/PrelNames.hs +++ b/compiler/prelude/PrelNames.hs @@ -326,6 +326,9 @@ basicKnownKeyNames -- Overloaded labels isLabelClassName, + -- Overloaded record fields + hasFieldClassName, + -- Source locations callStackDataConName, callStackTyConName, srcLocDataConName, @@ -503,6 +506,9 @@ gHC_FINGERPRINT_TYPE = mkBaseModule (fsLit "GHC.Fingerprint.Type") gHC_OVER_LABELS :: Module gHC_OVER_LABELS = mkBaseModule (fsLit "GHC.OverloadedLabels") +gHC_RECORDS :: Module +gHC_RECORDS = mkBaseModule (fsLit "GHC.Records") + mAIN, rOOT_MAIN :: Module mAIN = mkMainModule_ mAIN_NAME rOOT_MAIN = mkMainModule (fsLit ":Main") -- Root module for initialisation @@ -1349,6 +1355,11 @@ isLabelClassName :: Name isLabelClassName = clsQual gHC_OVER_LABELS (fsLit "IsLabel") isLabelClassNameKey +-- Overloaded record fields +hasFieldClassName :: Name +hasFieldClassName + = clsQual gHC_RECORDS (fsLit "HasField") hasFieldClassNameKey + -- Source Locations callStackDataConName, callStackTyConName, srcLocDataConName :: Name callStackDataConName @@ -1501,6 +1512,9 @@ semigroupClassKey, monoidClassKey :: Unique semigroupClassKey = mkPreludeClassUnique 46 monoidClassKey = mkPreludeClassUnique 47 +hasFieldClassNameKey :: Unique +hasFieldClassNameKey = mkPreludeClassUnique 48 + ---------------- Template Haskell ------------------- -- THNames.hs: USES ClassUniques 200-299 ----------------------------------------------------- diff --git a/libraries/base/GHC/Records.hs b/libraries/base/GHC/Records.hs new file mode 100644 index 0000000..16c10d0 --- /dev/null +++ b/libraries/base/GHC/Records.hs @@ -0,0 +1,30 @@ +{-# LANGUAGE NoImplicitPrelude + , MultiParamTypeClasses + , MagicHash + , KindSignatures + , DataKinds + , FunctionalDependencies + #-} + +----------------------------------------------------------------------------- +-- | +-- Module : GHC.Records +-- Copyright : (c) Adam Gundry 2015 +-- License : see libraries/base/LICENSE +-- +-- Maintainer : cvs-ghc at haskell.org +-- Stability : internal +-- Portability : non-portable (GHC extensions) +-- +-- +----------------------------------------------------------------------------- + +module GHC.Records + ( HasField(..) + ) where + +import GHC.Base ( Symbol ) +import GHC.Exts ( Proxy# ) + +class HasField (x :: Symbol) r a | x r -> a where + getField :: Proxy# x -> r -> a diff --git a/libraries/base/base.cabal b/libraries/base/base.cabal index cd77e55..8b99821 100644 --- a/libraries/base/base.cabal +++ b/libraries/base/base.cabal @@ -262,6 +262,7 @@ Library GHC.Ptr GHC.Read GHC.Real + GHC.Records GHC.RTS.Flags GHC.ST GHC.StaticPtr From git at git.haskell.org Mon May 16 08:07:13 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 May 2016 08:07:13 +0000 (UTC) Subject: [commit: ghc] wip/hasfield: Initial work on magic solving of HasField constraints (8966ab3) Message-ID: <20160516080713.EA9423A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/hasfield Link : http://ghc.haskell.org/trac/ghc/changeset/8966ab38686b8d7d000d4caeaafafd0fa503d050/ghc >--------------------------------------------------------------- commit 8966ab38686b8d7d000d4caeaafafd0fa503d050 Author: Adam Gundry Date: Tue Dec 22 16:12:40 2015 +0000 Initial work on magic solving of HasField constraints >--------------------------------------------------------------- 8966ab38686b8d7d000d4caeaafafd0fa503d050 compiler/typecheck/TcInteract.hs | 76 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 72 insertions(+), 4 deletions(-) diff --git a/compiler/typecheck/TcInteract.hs b/compiler/typecheck/TcInteract.hs index 78bf845..c0e37b0 100644 --- a/compiler/typecheck/TcInteract.hs +++ b/compiler/typecheck/TcInteract.hs @@ -9,7 +9,7 @@ module TcInteract ( #include "HsVersions.h" -import BasicTypes ( infinity, IntWithInf, intGtLimit ) +import BasicTypes ( infinity, IntWithInf, intGtLimit, Origin(Generated) ) import HsTypes ( HsIPName(..) ) import FastString import TcCanonical @@ -22,22 +22,29 @@ import CoAxiom( sfInteractTop, sfInteractInert ) import Var import TcType import Name +import RdrName ( lookupGRE_Field_Name ) import PrelNames ( knownNatClassName, knownSymbolClassName, typeableClassName, coercibleTyConKey, - heqTyConKey ) + heqTyConKey, hasFieldClassName ) import TysWiredIn ( ipClass, typeNatKind, typeSymbolKind, heqDataCon, coercibleDataCon ) -import TysPrim ( eqPrimTyCon, eqReprPrimTyCon ) +import TysPrim ( eqPrimTyCon, eqReprPrimTyCon, mkProxyPrimTy ) import Id( idType ) import CoAxiom ( Eqn, CoAxiom(..), CoAxBranch(..), fromBranches ) import Class import TyCon -import DataCon( dataConWrapId ) +import DataCon( dataConWrapId, dataConFieldType_maybe, dataConUnivTyVars ) +import FieldLabel import FunDeps import FamInst import FamInstEnv import Unify ( tcUnifyTyWithTFs ) +import HsBinds ( emptyLocalBinds ) +import HsExpr +import HsPat ( Pat(WildPat) ) +import HsUtils ( mkHsWrap ) + import TcEvidence import Outputable @@ -1794,6 +1801,7 @@ match_class_inst dflags clas tys loc | cls_name == typeableClassName = matchTypeable clas tys | clas `hasKey` heqTyConKey = matchLiftedEquality tys | clas `hasKey` coercibleTyConKey = matchLiftedCoercible tys + | cls_name == hasFieldClassName = matchHasField clas tys | otherwise = matchInstEnv dflags clas tys loc where cls_name = className clas @@ -2115,3 +2123,63 @@ matchLiftedCoercible args@[k, t1, t2] where args' = [k, k, t1, t2] matchLiftedCoercible args = pprPanic "matchLiftedCoercible" (ppr args) + + +{- ******************************************************************** +* * + Class lookup for overloaded record fields +* * +***********************************************************************-} + +matchHasField :: Class -> [Type] -> TcS LookupInstResult +matchHasField clas tys@[x_ty, r_ty, a_ty] + | Just x <- isStrLitTy x_ty + , Just (tycon, r_args) <- tcSplitTyConApp_maybe r_ty + , Just fl <- lookupFsEnv (tyConFieldLabelEnv tycon) x + , Just (_, ax) <- tcInstNewTyCon_maybe (classTyCon clas) tys + = do { env <- getGlobalRdrEnvTcS + ; let gres = lookupGRE_Field_Name env (flSelector fl) (flLabel fl) + ; case gres of + [] -> return NoInstance + (gre:_) -> do { + ; addUsedGRE True gre + ; sel_id <- tcLookupId (flSelector fl) + + ; let data_cons_with_field = [ (dc, ty) + | dc <- tyConDataCons tycon + , Just ty <- [dataConFieldType_maybe dc x] + ] + (data_con, field_ty) = ASSERT( not (null data_cons_with_field) ) head data_cons_with_field + tenv = mkTopTCvSubst (dataConUnivTyVars data_con `zip` r_args) + inst_field_ty = substTy tenv field_ty + theta = mkTyConApp eqPrimTyCon [liftedTypeKind, liftedTypeKind, inst_field_ty, a_ty ] + + ; let mk_ev [ev] = EvCast (EvExpr (mkHsLamConst proxy_ty (mkFunTy r_ty a_ty) body)) (mkTcSymCo ax) + where + proxy_ty = mkProxyPrimTy typeSymbolKind x_ty + co = mkTcFunCo Nominal (mkTcReflCo Nominal r_ty) (evTermCoercion ev) + body = mkHsWrap (mkWpCastN co <.> mkWpTyApps r_args) (HsVar (noLoc sel_id)) + + mk_ev _ = panic "matchHasField.mk_ev" + + ; return (GenInst { lir_new_theta = [ theta ] + , lir_mk_ev = mk_ev + , lir_safe_over = True + }) + } } +matchHasField _ _ = return NoInstance + +mkHsLamConst :: Type -> Type -> HsExpr Id -> HsExpr Id +mkHsLamConst arg_ty res_ty body = HsLam mg + where + m = Match { m_fixity = NonFunBindMatch + , m_pats = [noLoc (WildPat arg_ty)] + , m_type = Nothing + , m_grhss = GRHSs { grhssGRHSs = [noLoc (GRHS [] (noLoc body))] + , grhssLocalBinds = noLoc emptyLocalBinds } + } + mg = MG { mg_alts = noLoc [noLoc m] + , mg_arg_tys = [arg_ty] + , mg_res_ty = res_ty + , mg_origin = Generated + } From git at git.haskell.org Mon May 16 08:07:17 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 May 2016 08:07:17 +0000 (UTC) Subject: [commit: ghc] wip/hasfield: Do not solve HasField constraints where the field is naughty or higher-rank (eb6f660) Message-ID: <20160516080717.068653A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/hasfield Link : http://ghc.haskell.org/trac/ghc/changeset/eb6f660b85c7d0ac173b314c8b30fd3a045efe6b/ghc >--------------------------------------------------------------- commit eb6f660b85c7d0ac173b314c8b30fd3a045efe6b Author: Adam Gundry Date: Tue Dec 22 16:34:59 2015 +0000 Do not solve HasField constraints where the field is naughty or higher-rank >--------------------------------------------------------------- eb6f660b85c7d0ac173b314c8b30fd3a045efe6b compiler/typecheck/TcInteract.hs | 8 ++++++-- testsuite/tests/overloadedrecflds/should_fail/all.T | 1 + .../overloadedrecflds/should_fail/hasfieldfail02.hs | 16 ++++++++++++++++ .../overloadedrecflds/should_fail/hasfieldfail02.stderr | 14 ++++++++++++++ 4 files changed, 37 insertions(+), 2 deletions(-) diff --git a/compiler/typecheck/TcInteract.hs b/compiler/typecheck/TcInteract.hs index c0e37b0..d246b15 100644 --- a/compiler/typecheck/TcInteract.hs +++ b/compiler/typecheck/TcInteract.hs @@ -29,7 +29,7 @@ import PrelNames ( knownNatClassName, knownSymbolClassName, import TysWiredIn ( ipClass, typeNatKind, typeSymbolKind, heqDataCon, coercibleDataCon ) import TysPrim ( eqPrimTyCon, eqReprPrimTyCon, mkProxyPrimTy ) -import Id( idType ) +import Id( idType, isNaughtyRecordSelector ) import CoAxiom ( Eqn, CoAxiom(..), CoAxBranch(..), fromBranches ) import Class import TyCon @@ -2154,6 +2154,10 @@ matchHasField clas tys@[x_ty, r_ty, a_ty] inst_field_ty = substTy tenv field_ty theta = mkTyConApp eqPrimTyCon [liftedTypeKind, liftedTypeKind, inst_field_ty, a_ty ] + ; if isNaughtyRecordSelector sel_id || not (isTauTy inst_field_ty) + then return NoInstance + else do { + ; let mk_ev [ev] = EvCast (EvExpr (mkHsLamConst proxy_ty (mkFunTy r_ty a_ty) body)) (mkTcSymCo ax) where proxy_ty = mkProxyPrimTy typeSymbolKind x_ty @@ -2166,7 +2170,7 @@ matchHasField clas tys@[x_ty, r_ty, a_ty] , lir_mk_ev = mk_ev , lir_safe_over = True }) - } } + } } } matchHasField _ _ = return NoInstance mkHsLamConst :: Type -> Type -> HsExpr Id -> HsExpr Id diff --git a/testsuite/tests/overloadedrecflds/should_fail/all.T b/testsuite/tests/overloadedrecflds/should_fail/all.T index 9f5b780..5f378e9 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/all.T +++ b/testsuite/tests/overloadedrecflds/should_fail/all.T @@ -33,3 +33,4 @@ test('T11167_ambiguous_fixity', test('hasfieldfail01', extra_clean(['HasFieldFail01_A.hi', 'HasFieldFail01_A.o']), multimod_compile_fail, ['hasfieldfail01', '']) +test('hasfieldfail02', normal, compile_fail, ['']) diff --git a/testsuite/tests/overloadedrecflds/should_fail/hasfieldfail02.hs b/testsuite/tests/overloadedrecflds/should_fail/hasfieldfail02.hs new file mode 100644 index 0000000..d3175d2 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_fail/hasfieldfail02.hs @@ -0,0 +1,16 @@ +{-# LANGUAGE DataKinds, ExistentialQuantification, MagicHash, RankNTypes #-} + +import GHC.Prim (Proxy#, proxy#) +import GHC.Records (HasField(..)) + +data T = MkT { foo :: forall a . a -> a } +data U = forall b . MkU { bar :: b } + +-- This should fail because foo is higher-rank. +x = getField (proxy# :: Proxy# "foo") (MkT id) + +-- This should fail because bar is a naughty record selector (it +-- involves an existential). +y = getField (proxy# :: Proxy# "bar") (MkU True) + +main = return () diff --git a/testsuite/tests/overloadedrecflds/should_fail/hasfieldfail02.stderr b/testsuite/tests/overloadedrecflds/should_fail/hasfieldfail02.stderr new file mode 100644 index 0000000..aea9fea --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_fail/hasfieldfail02.stderr @@ -0,0 +1,14 @@ + +hasfieldfail02.hs:10:5: error: + ? No instance for (HasField "foo" T a1) + arising from a use of ?getField? + ? In the expression: getField (proxy# :: Proxy# "foo") (MkT id) + In an equation for ?x?: + x = getField (proxy# :: Proxy# "foo") (MkT id) + +hasfieldfail02.hs:14:5: error: + ? No instance for (HasField "bar" U a0) + arising from a use of ?getField? + ? In the expression: getField (proxy# :: Proxy# "bar") (MkU True) + In an equation for ?y?: + y = getField (proxy# :: Proxy# "bar") (MkU True) From git at git.haskell.org Mon May 16 08:07:20 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 May 2016 08:07:20 +0000 (UTC) Subject: [commit: ghc] wip/hasfield: Basic tests for HasField constraint solving (c9f8c92) Message-ID: <20160516080720.90C8A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/hasfield Link : http://ghc.haskell.org/trac/ghc/changeset/c9f8c927fb2f74b4fa4e60487167922b357e89a5/ghc >--------------------------------------------------------------- commit c9f8c927fb2f74b4fa4e60487167922b357e89a5 Author: Adam Gundry Date: Tue Dec 22 16:23:40 2015 +0000 Basic tests for HasField constraint solving >--------------------------------------------------------------- c9f8c927fb2f74b4fa4e60487167922b357e89a5 .../overloadedrecflds/should_fail/HasFieldFail01_A.hs | 3 +++ testsuite/tests/overloadedrecflds/should_fail/all.T | 3 +++ .../overloadedrecflds/should_fail/hasfieldfail01.hs | 10 ++++++++++ .../overloadedrecflds/should_fail/hasfieldfail01.stderr | 12 ++++++++++++ testsuite/tests/overloadedrecflds/should_run/all.T | 1 + .../tests/overloadedrecflds/should_run/hasfieldrun01.hs | 17 +++++++++++++++++ ...erloadedrecfldsrun06.stdout => hasfieldrun01.stdout} | 1 + 7 files changed, 47 insertions(+) diff --git a/testsuite/tests/overloadedrecflds/should_fail/HasFieldFail01_A.hs b/testsuite/tests/overloadedrecflds/should_fail/HasFieldFail01_A.hs new file mode 100644 index 0000000..f7dc113 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_fail/HasFieldFail01_A.hs @@ -0,0 +1,3 @@ +module HasFieldFail01_A where + +data T = MkT { foo :: Int } diff --git a/testsuite/tests/overloadedrecflds/should_fail/all.T b/testsuite/tests/overloadedrecflds/should_fail/all.T index 3626405..9f5b780 100644 --- a/testsuite/tests/overloadedrecflds/should_fail/all.T +++ b/testsuite/tests/overloadedrecflds/should_fail/all.T @@ -30,3 +30,6 @@ test('T11167_ambiguous_fixity', extra_clean([ 'T11167_ambiguous_fixity_A.hi', 'T11167_ambiguous_fixity_A.o' , 'T11167_ambiguous_fixity_B.hi', 'T11167_ambiguous_fixity_B.o' ]), multimod_compile_fail, ['T11167_ambiguous_fixity', '']) +test('hasfieldfail01', + extra_clean(['HasFieldFail01_A.hi', 'HasFieldFail01_A.o']), + multimod_compile_fail, ['hasfieldfail01', '']) diff --git a/testsuite/tests/overloadedrecflds/should_fail/hasfieldfail01.hs b/testsuite/tests/overloadedrecflds/should_fail/hasfieldfail01.hs new file mode 100644 index 0000000..0e611d6 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_fail/hasfieldfail01.hs @@ -0,0 +1,10 @@ +{-# LANGUAGE DataKinds, MagicHash, TypeFamilies #-} + +import HasFieldFail01_A (T(MkT)) + +import GHC.Prim (Proxy#, proxy#) +import GHC.Records (HasField(..)) + +-- This should fail to solve the HasField constraint, because foo is +-- not in scope. +main = print (getField (proxy# :: Proxy# "foo") (MkT 42) :: Int) diff --git a/testsuite/tests/overloadedrecflds/should_fail/hasfieldfail01.stderr b/testsuite/tests/overloadedrecflds/should_fail/hasfieldfail01.stderr new file mode 100644 index 0000000..d2623d8 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_fail/hasfieldfail01.stderr @@ -0,0 +1,12 @@ +[1 of 2] Compiling HasFieldFail01_A ( HasFieldFail01_A.hs, HasFieldFail01_A.o ) +[2 of 2] Compiling Main ( hasfieldfail01.hs, hasfieldfail01.o ) + +hasfieldfail01.hs:10:15: error: + ? No instance for (HasField "foo" T Int) + arising from a use of ?getField? + ? In the first argument of ?print?, namely + ?(getField (proxy# :: Proxy# "foo") (MkT 42) :: Int)? + In the expression: + print (getField (proxy# :: Proxy# "foo") (MkT 42) :: Int) + In an equation for ?main?: + main = print (getField (proxy# :: Proxy# "foo") (MkT 42) :: Int) diff --git a/testsuite/tests/overloadedrecflds/should_run/all.T b/testsuite/tests/overloadedrecflds/should_run/all.T index 019a1ef..1e0787e 100644 --- a/testsuite/tests/overloadedrecflds/should_run/all.T +++ b/testsuite/tests/overloadedrecflds/should_run/all.T @@ -15,3 +15,4 @@ test('overloadedlabelsrun03', normal, compile_and_run, ['']) test('overloadedlabelsrun04', extra_clean(['OverloadedLabelsRun04_A.hi', 'OverloadedLabelsRun04_A.o']), multimod_compile_and_run, ['overloadedlabelsrun04', '']) +test('hasfieldrun01', normal, compile_and_run, ['']) diff --git a/testsuite/tests/overloadedrecflds/should_run/hasfieldrun01.hs b/testsuite/tests/overloadedrecflds/should_run/hasfieldrun01.hs new file mode 100644 index 0000000..0f27c6b --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_run/hasfieldrun01.hs @@ -0,0 +1,17 @@ +{-# LANGUAGE DataKinds, MagicHash, TypeFamilies #-} + +import GHC.Prim (Proxy#, proxy#) +import GHC.Records (getField) + +type family B where B = Bool + +data T = MkT { foo :: Int, bar :: B } + +data U a b = MkU { baf :: a } + +t = MkT 42 True +u = MkU 'x' + +main = do print (getField (proxy# :: Proxy# "foo") t) + print (getField (proxy# :: Proxy# "bar") t) + print (getField (proxy# :: Proxy# "baf") u) diff --git a/testsuite/tests/overloadedrecflds/should_run/overloadedrecfldsrun06.stdout b/testsuite/tests/overloadedrecflds/should_run/hasfieldrun01.stdout similarity index 66% copy from testsuite/tests/overloadedrecflds/should_run/overloadedrecfldsrun06.stdout copy to testsuite/tests/overloadedrecflds/should_run/hasfieldrun01.stdout index abc4e3b..1bfbe7a 100644 --- a/testsuite/tests/overloadedrecflds/should_run/overloadedrecfldsrun06.stdout +++ b/testsuite/tests/overloadedrecflds/should_run/hasfieldrun01.stdout @@ -1,2 +1,3 @@ 42 True +'x' From git at git.haskell.org Mon May 16 08:07:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 May 2016 08:07:23 +0000 (UTC) Subject: [commit: ghc] wip/hasfield: Support virtual fields via manual HasField instances (9a390aa) Message-ID: <20160516080723.3744E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/hasfield Link : http://ghc.haskell.org/trac/ghc/changeset/9a390aa6277b6c21fe69b662d2dbd398c48523f2/ghc >--------------------------------------------------------------- commit 9a390aa6277b6c21fe69b662d2dbd398c48523f2 Author: Adam Gundry Date: Tue Dec 22 16:56:04 2015 +0000 Support virtual fields via manual HasField instances >--------------------------------------------------------------- 9a390aa6277b6c21fe69b662d2dbd398c48523f2 compiler/typecheck/TcInteract.hs | 12 ++++++------ .../tests/overloadedrecflds/should_run/hasfieldrun01.hs | 12 ++++++++++-- .../tests/overloadedrecflds/should_run/hasfieldrun01.stdout | 1 + 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/compiler/typecheck/TcInteract.hs b/compiler/typecheck/TcInteract.hs index d246b15..66cacea 100644 --- a/compiler/typecheck/TcInteract.hs +++ b/compiler/typecheck/TcInteract.hs @@ -1801,7 +1801,7 @@ match_class_inst dflags clas tys loc | cls_name == typeableClassName = matchTypeable clas tys | clas `hasKey` heqTyConKey = matchLiftedEquality tys | clas `hasKey` coercibleTyConKey = matchLiftedCoercible tys - | cls_name == hasFieldClassName = matchHasField clas tys + | cls_name == hasFieldClassName = matchHasField dflags clas tys loc | otherwise = matchInstEnv dflags clas tys loc where cls_name = className clas @@ -2131,8 +2131,8 @@ matchLiftedCoercible args = pprPanic "matchLiftedCoercible" (ppr args) * * ***********************************************************************-} -matchHasField :: Class -> [Type] -> TcS LookupInstResult -matchHasField clas tys@[x_ty, r_ty, a_ty] +matchHasField :: DynFlags -> Class -> [Type] -> CtLoc -> TcS LookupInstResult +matchHasField dflags clas tys@[x_ty, r_ty, a_ty] loc | Just x <- isStrLitTy x_ty , Just (tycon, r_args) <- tcSplitTyConApp_maybe r_ty , Just fl <- lookupFsEnv (tyConFieldLabelEnv tycon) x @@ -2140,7 +2140,7 @@ matchHasField clas tys@[x_ty, r_ty, a_ty] = do { env <- getGlobalRdrEnvTcS ; let gres = lookupGRE_Field_Name env (flSelector fl) (flLabel fl) ; case gres of - [] -> return NoInstance + [] -> matchInstEnv dflags clas tys loc (gre:_) -> do { ; addUsedGRE True gre ; sel_id <- tcLookupId (flSelector fl) @@ -2155,7 +2155,7 @@ matchHasField clas tys@[x_ty, r_ty, a_ty] theta = mkTyConApp eqPrimTyCon [liftedTypeKind, liftedTypeKind, inst_field_ty, a_ty ] ; if isNaughtyRecordSelector sel_id || not (isTauTy inst_field_ty) - then return NoInstance + then matchInstEnv dflags clas tys loc else do { ; let mk_ev [ev] = EvCast (EvExpr (mkHsLamConst proxy_ty (mkFunTy r_ty a_ty) body)) (mkTcSymCo ax) @@ -2171,7 +2171,7 @@ matchHasField clas tys@[x_ty, r_ty, a_ty] , lir_safe_over = True }) } } } -matchHasField _ _ = return NoInstance +matchHasField dflags clas tys loc = matchInstEnv dflags clas tys loc mkHsLamConst :: Type -> Type -> HsExpr Id -> HsExpr Id mkHsLamConst arg_ty res_ty body = HsLam mg diff --git a/testsuite/tests/overloadedrecflds/should_run/hasfieldrun01.hs b/testsuite/tests/overloadedrecflds/should_run/hasfieldrun01.hs index 0f27c6b..eeda42e 100644 --- a/testsuite/tests/overloadedrecflds/should_run/hasfieldrun01.hs +++ b/testsuite/tests/overloadedrecflds/should_run/hasfieldrun01.hs @@ -1,7 +1,8 @@ -{-# LANGUAGE DataKinds, MagicHash, TypeFamilies #-} +{-# LANGUAGE DataKinds, FlexibleInstances, MagicHash, + MultiParamTypeClasses, TypeFamilies #-} import GHC.Prim (Proxy#, proxy#) -import GHC.Records (getField) +import GHC.Records (HasField(..)) type family B where B = Bool @@ -10,8 +11,15 @@ data T = MkT { foo :: Int, bar :: B } data U a b = MkU { baf :: a } t = MkT 42 True + +u :: U Char Char u = MkU 'x' +-- A virtual foo field for U +instance HasField "foo" (U a b) [Char] where + getField _ _ = "virtual" + main = do print (getField (proxy# :: Proxy# "foo") t) print (getField (proxy# :: Proxy# "bar") t) print (getField (proxy# :: Proxy# "baf") u) + print (getField (proxy# :: Proxy# "foo") u) diff --git a/testsuite/tests/overloadedrecflds/should_run/hasfieldrun01.stdout b/testsuite/tests/overloadedrecflds/should_run/hasfieldrun01.stdout index 1bfbe7a..4c188ae 100644 --- a/testsuite/tests/overloadedrecflds/should_run/hasfieldrun01.stdout +++ b/testsuite/tests/overloadedrecflds/should_run/hasfieldrun01.stdout @@ -1,3 +1,4 @@ 42 True 'x' +"virtual" From git at git.haskell.org Mon May 16 08:07:25 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 May 2016 08:07:25 +0000 (UTC) Subject: [commit: ghc] wip/hasfield: Comment matchHasField, move addUsedGRE to right place (97ebccc) Message-ID: <20160516080725.D44493A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/hasfield Link : http://ghc.haskell.org/trac/ghc/changeset/97ebccc0f0f256eb216dca81545ea51c6df8417f/ghc >--------------------------------------------------------------- commit 97ebccc0f0f256eb216dca81545ea51c6df8417f Author: Adam Gundry Date: Tue Dec 22 17:37:14 2015 +0000 Comment matchHasField, move addUsedGRE to right place >--------------------------------------------------------------- 97ebccc0f0f256eb216dca81545ea51c6df8417f compiler/typecheck/TcInteract.hs | 69 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 64 insertions(+), 5 deletions(-) diff --git a/compiler/typecheck/TcInteract.hs b/compiler/typecheck/TcInteract.hs index 66cacea..096af23 100644 --- a/compiler/typecheck/TcInteract.hs +++ b/compiler/typecheck/TcInteract.hs @@ -2131,6 +2131,50 @@ matchLiftedCoercible args = pprPanic "matchLiftedCoercible" (ppr args) * * ***********************************************************************-} +{- +Note [HasField instances] +~~~~~~~~~~~~~~~~~~~~~~~~~ +Suppose we have + + data T y = MkT { foo :: [y] } + +and `foo` is in scope. Then GHC will automatically solve a constraint like + + HasField "foo" (T Int) b + +by emitting a new wanted ([Int] ~# b) and building a HasField dictionary +out of the selector function `foo`. The HasField class is defined (in +GHC.Records) thus: + + class HasField (x :: Symbol) r a | x r -> a where + getField :: Proxy# x -> r -> a + +Since this is a one-method class, it is represented as a newtype. +Hence we can solve `HasField "foo" (T Int) b` by taking an expression +of type `Proxy# "foo" -> T Int -> b` and coercing it appropriately. +Note that + + foo :: forall y . T y -> [y] + +so the expression we construct is + + \ (_ :: Proxy# "foo") -> foo @Int |> co + +where + + co :: (T Int -> [Int]) ~# (T Int -> b) + +is built from the new wanted ([Int] ~# b). + +If `foo` is not in scope, higher-rank or existentially quantified then +the constraint is not solved automatically, but may be solved by a +user-supplied HasField instance. Similarly, if we encounter a +HasField constraint where the field is not a literal string, or does +not belong to the type, then we fall back on the normal constraint +solver behaviour. +-} + +-- See Note [HasField instances] matchHasField :: DynFlags -> Class -> [Type] -> CtLoc -> TcS LookupInstResult matchHasField dflags clas tys@[x_ty, r_ty, a_ty] loc | Just x <- isStrLitTy x_ty @@ -2138,32 +2182,44 @@ matchHasField dflags clas tys@[x_ty, r_ty, a_ty] loc , Just fl <- lookupFsEnv (tyConFieldLabelEnv tycon) x , Just (_, ax) <- tcInstNewTyCon_maybe (classTyCon clas) tys = do { env <- getGlobalRdrEnvTcS - ; let gres = lookupGRE_Field_Name env (flSelector fl) (flLabel fl) - ; case gres of + -- Check that the field selector is in scope + ; case lookupGRE_Field_Name env (flSelector fl) (flLabel fl) of [] -> matchInstEnv dflags clas tys loc (gre:_) -> do { - ; addUsedGRE True gre ; sel_id <- tcLookupId (flSelector fl) + -- We've already looked up the field label in this tycon, so + -- there must be at least one data con with the field: find + -- it and hence the field's type. ; let data_cons_with_field = [ (dc, ty) | dc <- tyConDataCons tycon , Just ty <- [dataConFieldType_maybe dc x] ] - (data_con, field_ty) = ASSERT( not (null data_cons_with_field) ) head data_cons_with_field + (data_con, field_ty) = ASSERT( not (null data_cons_with_field) ) + head data_cons_with_field + + -- Calculate the new wanted constraint by equating the actual + -- type of the field (instantiated appropriately) with the + -- type in the third parameter of the HasField constraint. tenv = mkTopTCvSubst (dataConUnivTyVars data_con `zip` r_args) inst_field_ty = substTy tenv field_ty theta = mkTyConApp eqPrimTyCon [liftedTypeKind, liftedTypeKind, inst_field_ty, a_ty ] + -- Give up if the selector is "naughty" (i.e. this is an + -- existentially quantified type) or has a higher-rank type. ; if isNaughtyRecordSelector sel_id || not (isTauTy inst_field_ty) then matchInstEnv dflags clas tys loc else do { + -- Record usage of the selector, as we need it to build an instance + ; addUsedGRE True gre + + -- Build evidence term as described in Note [HasField instances] ; let mk_ev [ev] = EvCast (EvExpr (mkHsLamConst proxy_ty (mkFunTy r_ty a_ty) body)) (mkTcSymCo ax) where proxy_ty = mkProxyPrimTy typeSymbolKind x_ty co = mkTcFunCo Nominal (mkTcReflCo Nominal r_ty) (evTermCoercion ev) body = mkHsWrap (mkWpCastN co <.> mkWpTyApps r_args) (HsVar (noLoc sel_id)) - mk_ev _ = panic "matchHasField.mk_ev" ; return (GenInst { lir_new_theta = [ theta ] @@ -2173,6 +2229,9 @@ matchHasField dflags clas tys@[x_ty, r_ty, a_ty] loc } } } matchHasField dflags clas tys loc = matchInstEnv dflags clas tys loc +-- | Make a constant lambda-expression +-- +-- > \ (_ :: arg_ty) -> (body :: res_ty) mkHsLamConst :: Type -> Type -> HsExpr Id -> HsExpr Id mkHsLamConst arg_ty res_ty body = HsLam mg where From git at git.haskell.org Mon May 16 08:07:28 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 May 2016 08:07:28 +0000 (UTC) Subject: [commit: ghc] wip/hasfield: OverloadedRecordFields magic constraint solving for HasField (835c52e) Message-ID: <20160516080728.802C83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/hasfield Link : http://ghc.haskell.org/trac/ghc/changeset/835c52e2d7c0089bc0f7e89fa0d328f8d65a80f5/ghc >--------------------------------------------------------------- commit 835c52e2d7c0089bc0f7e89fa0d328f8d65a80f5 Author: Adam Gundry Date: Tue Dec 22 17:44:04 2015 +0000 OverloadedRecordFields magic constraint solving for HasField Summary: This makes a start at implementing part 3 of the OverloadedRecordFields trilogy (see https://ghc.haskell.org/trac/ghc/wiki/Records/OverloadedRecordFields/MagicClasses). Only HasField has been done so far; updates need a bit more thought about the design. Moreover, I've gone for the functional dependency version as it seems simplest. Rather than adding another special-purpose constructor to EvTerm, I made it possible to embed arbitrary HsExprs in evidence. This should be useful for typechecker plugins. But I can specialise it if needed. Test Plan: some new tests added, more needed Reviewers: bgamari, austin, simonpj, hvr Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1687 >--------------------------------------------------------------- 835c52e2d7c0089bc0f7e89fa0d328f8d65a80f5 compiler/typecheck/TcEvidence.hs | 2 +- compiler/typecheck/TcInteract.hs | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/compiler/typecheck/TcEvidence.hs b/compiler/typecheck/TcEvidence.hs index 2866383..e2ad4b8 100644 --- a/compiler/typecheck/TcEvidence.hs +++ b/compiler/typecheck/TcEvidence.hs @@ -362,7 +362,7 @@ data EvTerm | EvTypeable Type EvTypeable -- Dictionary for (Typeable ty) - | EvExpr (HsExpr Id) -- Dictionary for HasField (internally generated) + | EvExpr (HsExpr Id) -- Dictionary for HasField (internal) -- or arbitrary class (generated by plugin) deriving( Data.Data, Data.Typeable ) diff --git a/compiler/typecheck/TcInteract.hs b/compiler/typecheck/TcInteract.hs index 096af23..ffcb27c 100644 --- a/compiler/typecheck/TcInteract.hs +++ b/compiler/typecheck/TcInteract.hs @@ -2180,7 +2180,6 @@ matchHasField dflags clas tys@[x_ty, r_ty, a_ty] loc | Just x <- isStrLitTy x_ty , Just (tycon, r_args) <- tcSplitTyConApp_maybe r_ty , Just fl <- lookupFsEnv (tyConFieldLabelEnv tycon) x - , Just (_, ax) <- tcInstNewTyCon_maybe (classTyCon clas) tys = do { env <- getGlobalRdrEnvTcS -- Check that the field selector is in scope ; case lookupGRE_Field_Name env (flSelector fl) (flLabel fl) of @@ -2203,7 +2202,8 @@ matchHasField dflags clas tys@[x_ty, r_ty, a_ty] loc -- type in the third parameter of the HasField constraint. tenv = mkTopTCvSubst (dataConUnivTyVars data_con `zip` r_args) inst_field_ty = substTy tenv field_ty - theta = mkTyConApp eqPrimTyCon [liftedTypeKind, liftedTypeKind, inst_field_ty, a_ty ] + theta = mkTyConApp eqPrimTyCon [liftedTypeKind, liftedTypeKind + , inst_field_ty, a_ty ] -- Give up if the selector is "naughty" (i.e. this is an -- existentially quantified type) or has a higher-rank type. @@ -2215,11 +2215,17 @@ matchHasField dflags clas tys@[x_ty, r_ty, a_ty] loc ; addUsedGRE True gre -- Build evidence term as described in Note [HasField instances] - ; let mk_ev [ev] = EvCast (EvExpr (mkHsLamConst proxy_ty (mkFunTy r_ty a_ty) body)) (mkTcSymCo ax) + ; let mk_ev [ev] = EvExpr lam `EvCast` mkTcSymCo ax where + lam = mkHsLamConst proxy_ty (mkFunTy r_ty a_ty) body proxy_ty = mkProxyPrimTy typeSymbolKind x_ty - co = mkTcFunCo Nominal (mkTcReflCo Nominal r_ty) (evTermCoercion ev) - body = mkHsWrap (mkWpCastN co <.> mkWpTyApps r_args) (HsVar (noLoc sel_id)) + co = mkTcFunCo Nominal (mkTcReflCo Nominal r_ty) + (evTermCoercion ev) + body = mkHsWrap (mkWpCastN co <.> mkWpTyApps r_args) + (HsVar (noLoc sel_id)) + ax = case tcInstNewTyCon_maybe (classTyCon clas) tys of + Just x -> snd x + Nothing -> panic "HasField not a newtype" mk_ev _ = panic "matchHasField.mk_ev" ; return (GenInst { lir_new_theta = [ theta ] From git at git.haskell.org Mon May 16 08:07:31 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 May 2016 08:07:31 +0000 (UTC) Subject: [commit: ghc] wip/hasfield: Resolve module import loop by adding a new boot file :-( (068f69b) Message-ID: <20160516080731.540DE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/hasfield Link : http://ghc.haskell.org/trac/ghc/changeset/068f69b4021cd129e7398dfffa0073f06f802382/ghc >--------------------------------------------------------------- commit 068f69b4021cd129e7398dfffa0073f06f802382 Author: Adam Gundry Date: Wed Dec 23 11:52:23 2015 +0000 Resolve module import loop by adding a new boot file :-( >--------------------------------------------------------------- 068f69b4021cd129e7398dfffa0073f06f802382 compiler/hsSyn/PlaceHolder.hs | 2 +- compiler/typecheck/TcEvidence.hs | 2 +- .../drvrun015.stdout => compiler/typecheck/TcEvidence.hs-boot | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/compiler/hsSyn/PlaceHolder.hs b/compiler/hsSyn/PlaceHolder.hs index 8e3b9a3..a29d387 100644 --- a/compiler/hsSyn/PlaceHolder.hs +++ b/compiler/hsSyn/PlaceHolder.hs @@ -15,7 +15,7 @@ import RdrName import Var import Coercion import {-# SOURCE #-} ConLike (ConLike) -import TcEvidence (HsWrapper) +import {-# SOURCE #-} TcEvidence (HsWrapper) import FieldLabel import SrcLoc (Located) diff --git a/compiler/typecheck/TcEvidence.hs b/compiler/typecheck/TcEvidence.hs index e2ad4b8..ddac3e4 100644 --- a/compiler/typecheck/TcEvidence.hs +++ b/compiler/typecheck/TcEvidence.hs @@ -53,7 +53,7 @@ import VarEnv import VarSet import Name import Pair -import HsExpr ( HsExpr ) +import {-# SOURCE #-} HsExpr ( HsExpr ) import Util import Bag diff --git a/testsuite/tests/deriving/should_run/drvrun015.stdout b/compiler/typecheck/TcEvidence.hs-boot similarity index 60% copy from testsuite/tests/deriving/should_run/drvrun015.stdout copy to compiler/typecheck/TcEvidence.hs-boot index d7059cd..48c3cbc 100644 --- a/testsuite/tests/deriving/should_run/drvrun015.stdout +++ b/compiler/typecheck/TcEvidence.hs-boot @@ -1 +1,3 @@ -"Obj {_id = 1, p1 = 10, p2 = 20}" +module TcEvidence where + +data HsWrapper From git at git.haskell.org Mon May 16 08:07:34 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 May 2016 08:07:34 +0000 (UTC) Subject: [commit: ghc] wip/hasfield: Test interaction between HasField and DuplicateRecordFields (2b91d14) Message-ID: <20160516080734.58A8F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/hasfield Link : http://ghc.haskell.org/trac/ghc/changeset/2b91d149005bede1ea22c74d1d86d9897adb51ad/ghc >--------------------------------------------------------------- commit 2b91d149005bede1ea22c74d1d86d9897adb51ad Author: Adam Gundry Date: Wed Dec 23 12:00:01 2015 +0000 Test interaction between HasField and DuplicateRecordFields >--------------------------------------------------------------- 2b91d149005bede1ea22c74d1d86d9897adb51ad testsuite/tests/overloadedrecflds/should_run/all.T | 1 + .../tests/overloadedrecflds/should_run/hasfieldrun02.hs | 15 +++++++++++++++ ...overloadedrecfldsrun06.stdout => hasfieldrun02.stdout} | 0 3 files changed, 16 insertions(+) diff --git a/testsuite/tests/overloadedrecflds/should_run/all.T b/testsuite/tests/overloadedrecflds/should_run/all.T index 1e0787e..c6fc8ad 100644 --- a/testsuite/tests/overloadedrecflds/should_run/all.T +++ b/testsuite/tests/overloadedrecflds/should_run/all.T @@ -16,3 +16,4 @@ test('overloadedlabelsrun04', extra_clean(['OverloadedLabelsRun04_A.hi', 'OverloadedLabelsRun04_A.o']), multimod_compile_and_run, ['overloadedlabelsrun04', '']) test('hasfieldrun01', normal, compile_and_run, ['']) +test('hasfieldrun02', normal, compile_and_run, ['']) diff --git a/testsuite/tests/overloadedrecflds/should_run/hasfieldrun02.hs b/testsuite/tests/overloadedrecflds/should_run/hasfieldrun02.hs new file mode 100644 index 0000000..cb255f1 --- /dev/null +++ b/testsuite/tests/overloadedrecflds/should_run/hasfieldrun02.hs @@ -0,0 +1,15 @@ +{-# LANGUAGE DuplicateRecordFields, OverloadedLabels, + ExistentialQuantification, + FlexibleInstances, MultiParamTypeClasses #-} + +import GHC.OverloadedLabels (IsLabel(..)) +import GHC.Records (HasField(..)) + +data S = MkS { foo :: Int } +data T x y z = forall b . MkT { foo :: y, bar :: b } + +instance HasField x r a => IsLabel x (r -> a) where + fromLabel = getField + +main = do print (#foo (MkS 42)) + print (#foo (MkT True False)) diff --git a/testsuite/tests/overloadedrecflds/should_run/overloadedrecfldsrun06.stdout b/testsuite/tests/overloadedrecflds/should_run/hasfieldrun02.stdout similarity index 100% copy from testsuite/tests/overloadedrecflds/should_run/overloadedrecfldsrun06.stdout copy to testsuite/tests/overloadedrecflds/should_run/hasfieldrun02.stdout From git at git.haskell.org Mon May 16 08:07:36 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 May 2016 08:07:36 +0000 (UTC) Subject: [commit: ghc] wip/hasfield: Solve HasField constraints involving data families (d3809a5) Message-ID: <20160516080736.F293B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/hasfield Link : http://ghc.haskell.org/trac/ghc/changeset/d3809a56bc66111fad0ae16a7d078aeffa7df145/ghc >--------------------------------------------------------------- commit d3809a56bc66111fad0ae16a7d078aeffa7df145 Author: Adam Gundry Date: Wed Dec 23 12:20:14 2015 +0000 Solve HasField constraints involving data families >--------------------------------------------------------------- d3809a56bc66111fad0ae16a7d078aeffa7df145 compiler/typecheck/TcInteract.hs | 23 ++++++++++++++++------ .../overloadedrecflds/should_run/hasfieldrun01.hs | 6 ++++++ .../should_run/hasfieldrun01.stdout | 1 + 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/compiler/typecheck/TcInteract.hs b/compiler/typecheck/TcInteract.hs index ffcb27c..1657549 100644 --- a/compiler/typecheck/TcInteract.hs +++ b/compiler/typecheck/TcInteract.hs @@ -2179,8 +2179,19 @@ matchHasField :: DynFlags -> Class -> [Type] -> CtLoc -> TcS LookupInstResult matchHasField dflags clas tys@[x_ty, r_ty, a_ty] loc | Just x <- isStrLitTy x_ty , Just (tycon, r_args) <- tcSplitTyConApp_maybe r_ty - , Just fl <- lookupFsEnv (tyConFieldLabelEnv tycon) x - = do { env <- getGlobalRdrEnvTcS + = do { fam_inst_envs <- getFamInstEnvs + -- Look up the representation tycon if this is a data family, + -- because that's where the datacons and fields live + ; let (rep_tycon, rep_tc_args, _) = tcLookupDataFamInst fam_inst_envs + tycon r_args + + -- Check that the field belongs to the tycon, and get its + -- selector name from the FieldLabel + ; case lookupFsEnv (tyConFieldLabelEnv rep_tycon) x of + Nothing -> matchInstEnv dflags clas tys loc + Just fl -> do { + + ; env <- getGlobalRdrEnvTcS -- Check that the field selector is in scope ; case lookupGRE_Field_Name env (flSelector fl) (flLabel fl) of [] -> matchInstEnv dflags clas tys loc @@ -2191,7 +2202,7 @@ matchHasField dflags clas tys@[x_ty, r_ty, a_ty] loc -- there must be at least one data con with the field: find -- it and hence the field's type. ; let data_cons_with_field = [ (dc, ty) - | dc <- tyConDataCons tycon + | dc <- tyConDataCons rep_tycon , Just ty <- [dataConFieldType_maybe dc x] ] (data_con, field_ty) = ASSERT( not (null data_cons_with_field) ) @@ -2200,7 +2211,7 @@ matchHasField dflags clas tys@[x_ty, r_ty, a_ty] loc -- Calculate the new wanted constraint by equating the actual -- type of the field (instantiated appropriately) with the -- type in the third parameter of the HasField constraint. - tenv = mkTopTCvSubst (dataConUnivTyVars data_con `zip` r_args) + tenv = mkTopTCvSubst (dataConUnivTyVars data_con `zip` rep_tc_args) inst_field_ty = substTy tenv field_ty theta = mkTyConApp eqPrimTyCon [liftedTypeKind, liftedTypeKind , inst_field_ty, a_ty ] @@ -2221,7 +2232,7 @@ matchHasField dflags clas tys@[x_ty, r_ty, a_ty] loc proxy_ty = mkProxyPrimTy typeSymbolKind x_ty co = mkTcFunCo Nominal (mkTcReflCo Nominal r_ty) (evTermCoercion ev) - body = mkHsWrap (mkWpCastN co <.> mkWpTyApps r_args) + body = mkHsWrap (mkWpCastN co <.> mkWpTyApps rep_tc_args) (HsVar (noLoc sel_id)) ax = case tcInstNewTyCon_maybe (classTyCon clas) tys of Just x -> snd x @@ -2232,7 +2243,7 @@ matchHasField dflags clas tys@[x_ty, r_ty, a_ty] loc , lir_mk_ev = mk_ev , lir_safe_over = True }) - } } } + } } } } matchHasField dflags clas tys loc = matchInstEnv dflags clas tys loc -- | Make a constant lambda-expression diff --git a/testsuite/tests/overloadedrecflds/should_run/hasfieldrun01.hs b/testsuite/tests/overloadedrecflds/should_run/hasfieldrun01.hs index eeda42e..7d1cb7f 100644 --- a/testsuite/tests/overloadedrecflds/should_run/hasfieldrun01.hs +++ b/testsuite/tests/overloadedrecflds/should_run/hasfieldrun01.hs @@ -10,11 +10,16 @@ data T = MkT { foo :: Int, bar :: B } data U a b = MkU { baf :: a } +data family V a b c d +data instance V x Int y [z] = MkVInt { baz :: (x, y, z, Bool) } + t = MkT 42 True u :: U Char Char u = MkU 'x' +v = MkVInt (42, 'x', True, False) + -- A virtual foo field for U instance HasField "foo" (U a b) [Char] where getField _ _ = "virtual" @@ -23,3 +28,4 @@ main = do print (getField (proxy# :: Proxy# "foo") t) print (getField (proxy# :: Proxy# "bar") t) print (getField (proxy# :: Proxy# "baf") u) print (getField (proxy# :: Proxy# "foo") u) + print (getField (proxy# :: Proxy# "baz") v) diff --git a/testsuite/tests/overloadedrecflds/should_run/hasfieldrun01.stdout b/testsuite/tests/overloadedrecflds/should_run/hasfieldrun01.stdout index 4c188ae..2b1e91e 100644 --- a/testsuite/tests/overloadedrecflds/should_run/hasfieldrun01.stdout +++ b/testsuite/tests/overloadedrecflds/should_run/hasfieldrun01.stdout @@ -2,3 +2,4 @@ True 'x' "virtual" +(42,'x',True,False) From git at git.haskell.org Mon May 16 08:07:40 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 May 2016 08:07:40 +0000 (UTC) Subject: [commit: ghc] wip/hasfield: Merge remote-tracking branch 'origin/master' into wip/hasfield (b50eb34) Message-ID: <20160516080740.9E2403A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/hasfield Link : http://ghc.haskell.org/trac/ghc/changeset/b50eb34cc3a941ded2b8c1e1b036b5767a620f55/ghc >--------------------------------------------------------------- commit b50eb34cc3a941ded2b8c1e1b036b5767a620f55 Merge: d3809a5 f141f41 Author: Adam Gundry Date: Wed Dec 23 13:22:21 2015 +0000 Merge remote-tracking branch 'origin/master' into wip/hasfield >--------------------------------------------------------------- Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc b50eb34cc3a941ded2b8c1e1b036b5767a620f55 From git at git.haskell.org Mon May 16 14:50:15 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 May 2016 14:50:15 +0000 (UTC) Subject: [commit: ghc] master: Bump haddock submodule (bf669a0) Message-ID: <20160516145015.9FFC83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/bf669a05fdab22cafcff4c692d1091ae582fbe0d/ghc >--------------------------------------------------------------- commit bf669a05fdab22cafcff4c692d1091ae582fbe0d Author: Ben Gamari Date: Mon May 16 15:14:18 2016 +0200 Bump haddock submodule Vendorise alabaster theme for older sphinx releases. >--------------------------------------------------------------- bf669a05fdab22cafcff4c692d1091ae582fbe0d utils/haddock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/haddock b/utils/haddock index 261342e..1bfcca3 160000 --- a/utils/haddock +++ b/utils/haddock @@ -1 +1 @@ -Subproject commit 261342e47efc2756c6befd1e3d83c42d5dd082c6 +Subproject commit 1bfcca3f2212e1f8e527ad3a2c4bb48aef082ff9 From git at git.haskell.org Mon May 16 14:50:18 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 May 2016 14:50:18 +0000 (UTC) Subject: [commit: ghc] master: PPC NCG: Fix pretty printing of st[wd]ux instr. (2dbdc79) Message-ID: <20160516145018.4C4D03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2dbdc79bb9e2760394ebfe630908813b630146c7/ghc >--------------------------------------------------------------- commit 2dbdc79bb9e2760394ebfe630908813b630146c7 Author: Peter Trommler Date: Mon May 16 15:16:49 2016 +0200 PPC NCG: Fix pretty printing of st[wd]ux instr. Printing STU was mixed up. The tab character must appear after the 'x'. Test Plan: validate on powerpc Reviewers: bgamari, austin, erikd Reviewed By: austin, erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2214 GHC Trac Issues: #12054 >--------------------------------------------------------------- 2dbdc79bb9e2760394ebfe630908813b630146c7 compiler/nativeGen/PPC/Ppr.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/nativeGen/PPC/Ppr.hs b/compiler/nativeGen/PPC/Ppr.hs index 3e1fd07..a406a6f 100644 --- a/compiler/nativeGen/PPC/Ppr.hs +++ b/compiler/nativeGen/PPC/Ppr.hs @@ -494,9 +494,10 @@ pprInstr (STU fmt reg addr) = hcat [ char '\t', text "st", pprFormat fmt, - text "u\t", + char 'u', case addr of AddrRegImm _ _ -> empty AddrRegReg _ _ -> char 'x', + char '\t', pprReg reg, text ", ", pprAddr addr From git at git.haskell.org Mon May 16 14:50:20 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 May 2016 14:50:20 +0000 (UTC) Subject: [commit: ghc] master: PPC: Implement SMP primitives using gcc built-ins (563a485) Message-ID: <20160516145020.E89FB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/563a4857abcee4a6e43c68323274309c58f42aa0/ghc >--------------------------------------------------------------- commit 563a4857abcee4a6e43c68323274309c58f42aa0 Author: Peter Trommler Date: Mon May 16 15:19:09 2016 +0200 PPC: Implement SMP primitives using gcc built-ins The SMP primitives were missing appropriate memory barriers (sync, isync instructions) on all PowerPCs. Use the built-ins _sync_* provided by gcc and clang. This reduces code size significantly. Remove broken mark for concprog001 on powerpc64. The referenced ticket number (11259) was wrong. Test Plan: validate on powerpc and ARM Reviewers: erikd, austin, simonmar, bgamari, hvr Reviewed By: bgamari, hvr Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2225 GHC Trac Issues: #12070 >--------------------------------------------------------------- 563a4857abcee4a6e43c68323274309c58f42aa0 includes/stg/SMP.h | 73 ++++---------------------------- testsuite/tests/concurrent/prog001/all.T | 1 - 2 files changed, 9 insertions(+), 65 deletions(-) diff --git a/includes/stg/SMP.h b/includes/stg/SMP.h index 21f05ed..fabc540 100644 --- a/includes/stg/SMP.h +++ b/includes/stg/SMP.h @@ -119,31 +119,8 @@ xchg(StgPtr p, StgWord w) :"+r" (result), "+m" (*p) : /* no input-only operands */ ); -#elif powerpc_HOST_ARCH - __asm__ __volatile__ ( -# if aix_HOST_OS - /* IBM's assembler doesn't seem to support local labels so we use - * explicit relative numeric offsets to workaround this limitation - */ - " lwarx %0, 0, %2\n" - " stwcx. %1, 0, %2\n" - " bne- $-8" -# else // aix_HOST_OS - "1: lwarx %0, 0, %2\n" - " stwcx. %1, 0, %2\n" - " bne- 1b" -# endif - :"=&r" (result) - :"r" (w), "r" (p) - ); -#elif powerpc64_HOST_ARCH || powerpc64le_HOST_ARCH - __asm__ __volatile__ ( - "1: ldarx %0, 0, %2\n" - " stdcx. %1, 0, %2\n" - " bne- 1b" - :"=&r" (result) - :"r" (w), "r" (p) - ); +#elif powerpc_HOST_ARCH || powerpc64_HOST_ARCH || powerpc64le_HOST_ARCH + result = __sync_lock_test_and_set(p, w); #elif sparc_HOST_ARCH result = w; __asm__ __volatile__ ( @@ -211,45 +188,8 @@ cas(StgVolatilePtr p, StgWord o, StgWord n) :"=a"(o), "+m" (*(volatile unsigned int *)p) :"0" (o), "r" (n)); return o; -#elif powerpc_HOST_ARCH - StgWord result; - __asm__ __volatile__ ( -# if aix_HOST_OS - /* IBM's assembler doesn't seem to support local labels so we use - * explicit relative numeric offsets to workaround this limitation - */ - " lwarx %0, 0, %3\n" - " cmpw %0, %1\n" - " bne $+12\n" - " stwcx. %2, 0, %3\n" - " bne- $-16\n" -# else // aix_HOST_OS - "1: lwarx %0, 0, %3\n" - " cmpw %0, %1\n" - " bne 2f\n" - " stwcx. %2, 0, %3\n" - " bne- 1b\n" - "2:" -# endif // !aix_HOST_OS - :"=&r" (result) - :"r" (o), "r" (n), "r" (p) - :"cc", "memory" - ); - return result; -#elif powerpc64_HOST_ARCH || powerpc64le_HOST_ARCH - StgWord result; - __asm__ __volatile__ ( - "1: ldarx %0, 0, %3\n" - " cmpd %0, %1\n" - " bne 2f\n" - " stdcx. %2, 0, %3\n" - " bne- 1b\n" - "2:" - :"=&r" (result) - :"r" (o), "r" (n), "r" (p) - :"cc", "memory" - ); - return result; +#elif powerpc_HOST_ARCH || powerpc64_HOST_ARCH || powerpc64le_HOST_ARCH + return __sync_val_compare_and_swap(p, o, n); #elif sparc_HOST_ARCH __asm__ __volatile__ ( "cas [%1], %2, %0" @@ -310,6 +250,7 @@ cas(StgVolatilePtr p, StgWord o, StgWord n) // RRN: Generalized to arbitrary increments to enable fetch-and-add in // Haskell code (fetchAddIntArray#). +// PT: add-and-fetch, returns new value EXTERN_INLINE StgWord atomic_inc(StgVolatilePtr p, StgWord incr) { @@ -321,6 +262,8 @@ atomic_inc(StgVolatilePtr p, StgWord incr) "+r" (r), "+m" (*p): ); return r + incr; +#elif powerpc_HOST_ARCH || powerpc64_HOST_ARCH || powerpc64le_HOST_ARCH + return __sync_add_and_fetch(p, incr); #else StgWord old, new_; do { @@ -342,6 +285,8 @@ atomic_dec(StgVolatilePtr p) "+r" (r), "+m" (*p): ); return r-1; +#elif powerpc_HOST_ARCH || powerpc64_HOST_ARCH || powerpc64le_HOST_ARCH + return __sync_sub_and_fetch(p, (StgWord) 1); #else StgWord old, new_; do { diff --git a/testsuite/tests/concurrent/prog001/all.T b/testsuite/tests/concurrent/prog001/all.T index 79a3146..a3ba7b6 100644 --- a/testsuite/tests/concurrent/prog001/all.T +++ b/testsuite/tests/concurrent/prog001/all.T @@ -14,7 +14,6 @@ test('concprog001', [when(fast(), skip), - when(arch('powerpc64'), expect_broken(11259)), only_ways(['threaded2']), extra_clean(['Arithmetic.hi', 'Arithmetic.o', 'Converter.hi', 'Converter.o', From git at git.haskell.org Mon May 16 14:50:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 May 2016 14:50:23 +0000 (UTC) Subject: [commit: ghc] master: testsuite/ImpSafe03: Normalize version of bytestring (d78faa1) Message-ID: <20160516145023.94A123A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d78faa135921dfe7a6b92f908171af1a2cdce512/ghc >--------------------------------------------------------------- commit d78faa135921dfe7a6b92f908171af1a2cdce512 Author: Ben Gamari Date: Mon May 16 15:56:09 2016 +0200 testsuite/ImpSafe03: Normalize version of bytestring >--------------------------------------------------------------- d78faa135921dfe7a6b92f908171af1a2cdce512 testsuite/tests/safeHaskell/check/pkg01/all.T | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/safeHaskell/check/pkg01/all.T b/testsuite/tests/safeHaskell/check/pkg01/all.T index aea4406..49e4ec2 100644 --- a/testsuite/tests/safeHaskell/check/pkg01/all.T +++ b/testsuite/tests/safeHaskell/check/pkg01/all.T @@ -42,7 +42,9 @@ test('ImpSafe01', normal, compile_fail, ['-fpackage-trust -distrust base']) test('ImpSafe02', normal, compile, ['-distrust base']) # Fail since we don't trust base of bytestring -test('ImpSafe03', normal, multi_compile_fail, +test('ImpSafe03', + [normalise_version("bytestring")], + multi_compile_fail, ['ImpSafe03 -trust base -distrust bytestring', [ ('ImpSafe03_A.hs', ' -trust base -trust bytestring') ], '-fpackage-trust' ]) From git at git.haskell.org Mon May 16 14:50:27 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 May 2016 14:50:27 +0000 (UTC) Subject: [commit: ghc] master: Move Extension type to ghc-boot-th (eed820b) Message-ID: <20160516145027.3FD163A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/eed820b672e6c3d23106cd151b1e31ce29326e32/ghc >--------------------------------------------------------------- commit eed820b672e6c3d23106cd151b1e31ce29326e32 Author: Ben Gamari Date: Mon May 16 15:21:34 2016 +0200 Move Extension type to ghc-boot-th This creates a new package, `ghc-boot-th`, to contain the `Extension` type, which now lives in `GHC.LanguageExtension.Type`. This ensures that the transitive dependency set of the `template-haskell` package remains minimal. The `GHC.LanguageExtensions.Type` module is also re-exported by `ghc-boot`, which provides an orphan `binary` instance as well. Test Plan: Validate Reviewers: goldfire, thomie, hvr, austin Reviewed By: thomie Subscribers: RyanGlScott, thomie, erikd, ezyang Differential Revision: https://phabricator.haskell.org/D2224 >--------------------------------------------------------------- eed820b672e6c3d23106cd151b1e31ce29326e32 .gitignore | 3 + compiler/main/DynFlags.hs | 4 +- configure.ac | 2 +- ghc.mk | 3 +- .../GHC/LanguageExtensions/Type.hs} | 12 +- libraries/{ghc-boot => ghc-boot-th}/GHC/Lexeme.hs | 0 LICENSE => libraries/ghc-boot-th/LICENSE | 0 libraries/{ghci => ghc-boot-th}/changelog.md | 2 +- libraries/ghc-boot-th/ghc-boot-th.cabal.in | 37 ++++++ libraries/ghc-boot/GHC/LanguageExtensions.hs | 135 ++------------------- libraries/ghc-boot/changelog.md | 2 +- libraries/ghc-boot/ghc-boot.cabal.in | 13 +- .../Language/Haskell/TH/LanguageExtensions.hs | 2 +- libraries/template-haskell/template-haskell.cabal | 6 +- testsuite/tests/th/TH_Roles2.stderr | 7 +- testsuite/tests/th/all.T | 3 +- 16 files changed, 82 insertions(+), 149 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc eed820b672e6c3d23106cd151b1e31ce29326e32 From git at git.haskell.org Mon May 16 15:18:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 May 2016 15:18:03 +0000 (UTC) Subject: [commit: ghc] master: Kill varSetElems in tcInferPatSynDecl (21fe4ff) Message-ID: <20160516151803.D11CE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/21fe4ffd049c8ab4b9ee36af3cf8f70b46d6beda/ghc >--------------------------------------------------------------- commit 21fe4ffd049c8ab4b9ee36af3cf8f70b46d6beda Author: Bartosz Nitka Date: Mon May 16 03:27:53 2016 -0700 Kill varSetElems in tcInferPatSynDecl varSetElems introduces unnecessary non-determinism and while I didn't estabilish experimentally that this matters here I'm convinced that it will, because I expect pattern synonyms to end up in interface files. Test Plan: ./validate Reviewers: austin, simonmar, bgamari, mpickering, simonpj Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2206 GHC Trac Issues: #4012 >--------------------------------------------------------------- 21fe4ffd049c8ab4b9ee36af3cf8f70b46d6beda compiler/typecheck/TcPatSyn.hs | 42 ++++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/compiler/typecheck/TcPatSyn.hs b/compiler/typecheck/TcPatSyn.hs index 002ab04..8c577cf 100644 --- a/compiler/typecheck/TcPatSyn.hs +++ b/compiler/typecheck/TcPatSyn.hs @@ -48,6 +48,7 @@ import FieldLabel import Bag import Util import ErrUtils +import FV import Control.Monad ( unless, zipWithM ) import Data.List( partition ) @@ -215,9 +216,8 @@ tcInferPatSynDecl PSB{ psb_id = lname@(L _ name), psb_args = details, ; (qtvs, req_dicts, ev_binds) <- simplifyInfer tclvl False [] named_taus wanted - ; let (ex_vars, prov_dicts) = tcCollectEx lpat' + ; let ((ex_tvs, ex_vars), prov_dicts) = tcCollectEx lpat' univ_tvs = filter (not . (`elemVarSet` ex_vars)) qtvs - ex_tvs = varSetElems ex_vars prov_theta = map evVarPred prov_dicts req_theta = map evVarPred req_dicts @@ -946,34 +946,44 @@ nonBidirectionalErr name = failWithTc $ -- These are used in computing the type of a pattern synonym and also -- in generating matcher functions, since success continuations need -- to be passed these pattern-bound evidences. -tcCollectEx :: LPat Id -> (TyVarSet, [EvVar]) -tcCollectEx pat = go pat +tcCollectEx + :: LPat Id + -> ( ([Var], VarSet) -- Existentially-bound type variables as a + -- deterministically ordered list and a set. + -- See Note [Deterministic FV] in FV + , [EvVar] + ) +tcCollectEx pat = let (fv, evs) = go pat in (fvVarListVarSet fv, evs) where - go :: LPat Id -> (TyVarSet, [EvVar]) + go :: LPat Id -> (FV, [EvVar]) go = go1 . unLoc - go1 :: Pat Id -> (TyVarSet, [EvVar]) + go1 :: Pat Id -> (FV, [EvVar]) go1 (LazyPat p) = go p go1 (AsPat _ p) = go p go1 (ParPat p) = go p go1 (BangPat p) = go p - go1 (ListPat ps _ _) = mconcat . map go $ ps - go1 (TuplePat ps _ _) = mconcat . map go $ ps - go1 (PArrPat ps _) = mconcat . map go $ ps + go1 (ListPat ps _ _) = mergeMany . map go $ ps + go1 (TuplePat ps _ _) = mergeMany . map go $ ps + go1 (PArrPat ps _) = mergeMany . map go $ ps go1 (ViewPat _ p _) = go p - go1 con at ConPatOut{} = mappend (mkVarSet (pat_tvs con), pat_dicts con) $ + go1 con at ConPatOut{} = merge (FV.mkFVs (pat_tvs con), pat_dicts con) $ goConDetails $ pat_args con go1 (SigPatOut p _) = go p go1 (CoPat _ p _) = go1 p go1 (NPlusKPat n k _ geq subtract _) = pprPanic "TODO: NPlusKPat" $ ppr n $$ ppr k $$ ppr geq $$ ppr subtract - go1 _ = mempty + go1 _ = empty - goConDetails :: HsConPatDetails Id -> (TyVarSet, [EvVar]) - goConDetails (PrefixCon ps) = mconcat . map go $ ps - goConDetails (InfixCon p1 p2) = go p1 `mappend` go p2 + goConDetails :: HsConPatDetails Id -> (FV, [EvVar]) + goConDetails (PrefixCon ps) = mergeMany . map go $ ps + goConDetails (InfixCon p1 p2) = go p1 `merge` go p2 goConDetails (RecCon HsRecFields{ rec_flds = flds }) - = mconcat . map goRecFd $ flds + = mergeMany . map goRecFd $ flds - goRecFd :: LHsRecField Id (LPat Id) -> (TyVarSet, [EvVar]) + goRecFd :: LHsRecField Id (LPat Id) -> (FV, [EvVar]) goRecFd (L _ HsRecField{ hsRecFieldArg = p }) = go p + + merge (vs1, evs1) (vs2, evs2) = (vs1 `unionFV` vs2, evs1 ++ evs2) + mergeMany = foldr merge empty + empty = (emptyFV, []) From git at git.haskell.org Mon May 16 17:54:17 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 May 2016 17:54:17 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Bump bytestring submodule to 0.8.10.1 (e7cb1ca) Message-ID: <20160516175417.8E2A63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/e7cb1ca50e4956807464a3e74b0b6a1a9993c366/ghc >--------------------------------------------------------------- commit e7cb1ca50e4956807464a3e74b0b6a1a9993c366 Author: Ben Gamari Date: Mon May 16 15:19:39 2016 +0200 Bump bytestring submodule to 0.8.10.1 >--------------------------------------------------------------- e7cb1ca50e4956807464a3e74b0b6a1a9993c366 libraries/bytestring | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/bytestring b/libraries/bytestring index 0ee4596..84253da 160000 --- a/libraries/bytestring +++ b/libraries/bytestring @@ -1 +1 @@ -Subproject commit 0ee45965232f6838d5bbbf9f0fe666a32a79a6da +Subproject commit 84253da85952765dd7631e467cc2b1d1bba03f24 From git at git.haskell.org Mon May 16 17:54:20 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 May 2016 17:54:20 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: PPC NCG: Fix pretty printing of st[wd]ux instr. (87a3ea5) Message-ID: <20160516175420.413AD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/87a3ea5612b0b9a174131a9a0bf9287c0820e8db/ghc >--------------------------------------------------------------- commit 87a3ea5612b0b9a174131a9a0bf9287c0820e8db Author: Peter Trommler Date: Mon May 16 15:16:49 2016 +0200 PPC NCG: Fix pretty printing of st[wd]ux instr. Printing STU was mixed up. The tab character must appear after the 'x'. Test Plan: validate on powerpc Reviewers: bgamari, austin, erikd Reviewed By: austin, erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2214 GHC Trac Issues: #12054 (cherry picked from commit 2dbdc79bb9e2760394ebfe630908813b630146c7) >--------------------------------------------------------------- 87a3ea5612b0b9a174131a9a0bf9287c0820e8db compiler/nativeGen/PPC/Ppr.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/nativeGen/PPC/Ppr.hs b/compiler/nativeGen/PPC/Ppr.hs index 59b0ad8..b7d2196 100644 --- a/compiler/nativeGen/PPC/Ppr.hs +++ b/compiler/nativeGen/PPC/Ppr.hs @@ -494,9 +494,10 @@ pprInstr (STU fmt reg addr) = hcat [ char '\t', text "st", pprFormat fmt, - text "u\t", + char 'u', case addr of AddrRegImm _ _ -> empty AddrRegReg _ _ -> char 'x', + char '\t', pprReg reg, text ", ", pprAddr addr From git at git.haskell.org Mon May 16 17:54:22 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 May 2016 17:54:22 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: PPC: Implement SMP primitives using gcc built-ins (f4e6b32) Message-ID: <20160516175422.E06023A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/f4e6b32831bd718a040b382865ac7aea1254bf4e/ghc >--------------------------------------------------------------- commit f4e6b32831bd718a040b382865ac7aea1254bf4e Author: Peter Trommler Date: Mon May 16 15:19:09 2016 +0200 PPC: Implement SMP primitives using gcc built-ins The SMP primitives were missing appropriate memory barriers (sync, isync instructions) on all PowerPCs. Use the built-ins _sync_* provided by gcc and clang. This reduces code size significantly. Remove broken mark for concprog001 on powerpc64. The referenced ticket number (11259) was wrong. Test Plan: validate on powerpc and ARM Reviewers: erikd, austin, simonmar, bgamari, hvr Reviewed By: bgamari, hvr Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2225 GHC Trac Issues: #12070 (cherry picked from commit 563a4857abcee4a6e43c68323274309c58f42aa0) >--------------------------------------------------------------- f4e6b32831bd718a040b382865ac7aea1254bf4e includes/stg/SMP.h | 73 +++++++----------------------------------------------- 1 file changed, 9 insertions(+), 64 deletions(-) diff --git a/includes/stg/SMP.h b/includes/stg/SMP.h index 21f05ed..fabc540 100644 --- a/includes/stg/SMP.h +++ b/includes/stg/SMP.h @@ -119,31 +119,8 @@ xchg(StgPtr p, StgWord w) :"+r" (result), "+m" (*p) : /* no input-only operands */ ); -#elif powerpc_HOST_ARCH - __asm__ __volatile__ ( -# if aix_HOST_OS - /* IBM's assembler doesn't seem to support local labels so we use - * explicit relative numeric offsets to workaround this limitation - */ - " lwarx %0, 0, %2\n" - " stwcx. %1, 0, %2\n" - " bne- $-8" -# else // aix_HOST_OS - "1: lwarx %0, 0, %2\n" - " stwcx. %1, 0, %2\n" - " bne- 1b" -# endif - :"=&r" (result) - :"r" (w), "r" (p) - ); -#elif powerpc64_HOST_ARCH || powerpc64le_HOST_ARCH - __asm__ __volatile__ ( - "1: ldarx %0, 0, %2\n" - " stdcx. %1, 0, %2\n" - " bne- 1b" - :"=&r" (result) - :"r" (w), "r" (p) - ); +#elif powerpc_HOST_ARCH || powerpc64_HOST_ARCH || powerpc64le_HOST_ARCH + result = __sync_lock_test_and_set(p, w); #elif sparc_HOST_ARCH result = w; __asm__ __volatile__ ( @@ -211,45 +188,8 @@ cas(StgVolatilePtr p, StgWord o, StgWord n) :"=a"(o), "+m" (*(volatile unsigned int *)p) :"0" (o), "r" (n)); return o; -#elif powerpc_HOST_ARCH - StgWord result; - __asm__ __volatile__ ( -# if aix_HOST_OS - /* IBM's assembler doesn't seem to support local labels so we use - * explicit relative numeric offsets to workaround this limitation - */ - " lwarx %0, 0, %3\n" - " cmpw %0, %1\n" - " bne $+12\n" - " stwcx. %2, 0, %3\n" - " bne- $-16\n" -# else // aix_HOST_OS - "1: lwarx %0, 0, %3\n" - " cmpw %0, %1\n" - " bne 2f\n" - " stwcx. %2, 0, %3\n" - " bne- 1b\n" - "2:" -# endif // !aix_HOST_OS - :"=&r" (result) - :"r" (o), "r" (n), "r" (p) - :"cc", "memory" - ); - return result; -#elif powerpc64_HOST_ARCH || powerpc64le_HOST_ARCH - StgWord result; - __asm__ __volatile__ ( - "1: ldarx %0, 0, %3\n" - " cmpd %0, %1\n" - " bne 2f\n" - " stdcx. %2, 0, %3\n" - " bne- 1b\n" - "2:" - :"=&r" (result) - :"r" (o), "r" (n), "r" (p) - :"cc", "memory" - ); - return result; +#elif powerpc_HOST_ARCH || powerpc64_HOST_ARCH || powerpc64le_HOST_ARCH + return __sync_val_compare_and_swap(p, o, n); #elif sparc_HOST_ARCH __asm__ __volatile__ ( "cas [%1], %2, %0" @@ -310,6 +250,7 @@ cas(StgVolatilePtr p, StgWord o, StgWord n) // RRN: Generalized to arbitrary increments to enable fetch-and-add in // Haskell code (fetchAddIntArray#). +// PT: add-and-fetch, returns new value EXTERN_INLINE StgWord atomic_inc(StgVolatilePtr p, StgWord incr) { @@ -321,6 +262,8 @@ atomic_inc(StgVolatilePtr p, StgWord incr) "+r" (r), "+m" (*p): ); return r + incr; +#elif powerpc_HOST_ARCH || powerpc64_HOST_ARCH || powerpc64le_HOST_ARCH + return __sync_add_and_fetch(p, incr); #else StgWord old, new_; do { @@ -342,6 +285,8 @@ atomic_dec(StgVolatilePtr p) "+r" (r), "+m" (*p): ); return r-1; +#elif powerpc_HOST_ARCH || powerpc64_HOST_ARCH || powerpc64le_HOST_ARCH + return __sync_sub_and_fetch(p, (StgWord) 1); #else StgWord old, new_; do { From git at git.haskell.org Mon May 16 17:54:25 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 May 2016 17:54:25 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: testsuite/ImpSafe03: Normalize version of bytestring (b0f027c) Message-ID: <20160516175425.89B673A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/b0f027cd03301efcc89b9c85db1dc58db2e90788/ghc >--------------------------------------------------------------- commit b0f027cd03301efcc89b9c85db1dc58db2e90788 Author: Ben Gamari Date: Mon May 16 15:56:09 2016 +0200 testsuite/ImpSafe03: Normalize version of bytestring (cherry picked from commit d78faa135921dfe7a6b92f908171af1a2cdce512) >--------------------------------------------------------------- b0f027cd03301efcc89b9c85db1dc58db2e90788 testsuite/tests/safeHaskell/check/pkg01/all.T | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/safeHaskell/check/pkg01/all.T b/testsuite/tests/safeHaskell/check/pkg01/all.T index aea4406..49e4ec2 100644 --- a/testsuite/tests/safeHaskell/check/pkg01/all.T +++ b/testsuite/tests/safeHaskell/check/pkg01/all.T @@ -42,7 +42,9 @@ test('ImpSafe01', normal, compile_fail, ['-fpackage-trust -distrust base']) test('ImpSafe02', normal, compile, ['-distrust base']) # Fail since we don't trust base of bytestring -test('ImpSafe03', normal, multi_compile_fail, +test('ImpSafe03', + [normalise_version("bytestring")], + multi_compile_fail, ['ImpSafe03 -trust base -distrust bytestring', [ ('ImpSafe03_A.hs', ' -trust base -trust bytestring') ], '-fpackage-trust' ]) From git at git.haskell.org Mon May 16 17:54:29 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 May 2016 17:54:29 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Move Extension type to ghc-boot-th (c014794) Message-ID: <20160516175429.314023A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/c0147941245eafe33f302d9fe62e81505e4c4eea/ghc >--------------------------------------------------------------- commit c0147941245eafe33f302d9fe62e81505e4c4eea Author: Ben Gamari Date: Mon May 16 15:21:34 2016 +0200 Move Extension type to ghc-boot-th This creates a new package, `ghc-boot-th`, to contain the `Extension` type, which now lives in `GHC.LanguageExtension.Type`. This ensures that the transitive dependency set of the `template-haskell` package remains minimal. The `GHC.LanguageExtensions.Type` module is also re-exported by `ghc-boot`, which provides an orphan `binary` instance as well. Test Plan: Validate Reviewers: goldfire, thomie, hvr, austin Reviewed By: thomie Subscribers: RyanGlScott, thomie, erikd, ezyang Differential Revision: https://phabricator.haskell.org/D2224 (cherry picked from commit eed820b672e6c3d23106cd151b1e31ce29326e32) >--------------------------------------------------------------- c0147941245eafe33f302d9fe62e81505e4c4eea .gitignore | 3 + compiler/main/DynFlags.hs | 4 +- configure.ac | 2 +- ghc.mk | 3 +- .../GHC/LanguageExtensions/Type.hs} | 12 +- libraries/{ghc-boot => ghc-boot-th}/GHC/Lexeme.hs | 0 LICENSE => libraries/ghc-boot-th/LICENSE | 0 libraries/{ghc-boot => ghc-boot-th}/changelog.md | 2 +- libraries/ghc-boot-th/ghc-boot-th.cabal.in | 37 ++++++ libraries/ghc-boot/GHC/LanguageExtensions.hs | 135 ++------------------- libraries/ghc-boot/changelog.md | 2 +- libraries/ghc-boot/ghc-boot.cabal.in | 13 +- .../Language/Haskell/TH/LanguageExtensions.hs | 2 +- libraries/template-haskell/template-haskell.cabal | 6 +- testsuite/tests/th/TH_Roles2.stderr | 7 +- testsuite/tests/th/all.T | 3 +- 16 files changed, 82 insertions(+), 149 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc c0147941245eafe33f302d9fe62e81505e4c4eea From git at git.haskell.org Mon May 16 17:54:32 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 May 2016 17:54:32 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: ghc-boot: Don't use reexported-modules (e303d93) Message-ID: <20160516175432.6F0693A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/e303d93fecdcb748cd341ca69f803b8201a84f51/ghc >--------------------------------------------------------------- commit e303d93fecdcb748cd341ca69f803b8201a84f51 Author: Ben Gamari Date: Mon May 16 16:14:07 2016 +0200 ghc-boot: Don't use reexported-modules This isn't supported by GHC 7.8 >--------------------------------------------------------------- e303d93fecdcb748cd341ca69f803b8201a84f51 libraries/ghc-boot-th/ghc-boot-th.cabal.in | 2 ++ libraries/ghc-boot/GHC/LanguageExtensions/Type.hs | 5 +++++ libraries/ghc-boot/GHC/Lexeme.hs | 5 +++++ libraries/ghc-boot/ghc-boot.cabal.in | 6 ++---- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/libraries/ghc-boot-th/ghc-boot-th.cabal.in b/libraries/ghc-boot-th/ghc-boot-th.cabal.in index 3aebfbf..58d8961 100644 --- a/libraries/ghc-boot-th/ghc-boot-th.cabal.in +++ b/libraries/ghc-boot-th/ghc-boot-th.cabal.in @@ -20,6 +20,8 @@ description: This library contains various bits shared between the @ghc@ and cabal-version: >=1.10 build-type: Simple extra-source-files: changelog.md +exposed: False +-- Since this is re-exported by ghc-boot source-repository head type: git diff --git a/libraries/ghc-boot/GHC/LanguageExtensions/Type.hs b/libraries/ghc-boot/GHC/LanguageExtensions/Type.hs new file mode 100644 index 0000000..0b3fc92 --- /dev/null +++ b/libraries/ghc-boot/GHC/LanguageExtensions/Type.hs @@ -0,0 +1,5 @@ +{-# LANGUAGE PackageImports #-} + +module GHC.LanguageExtensions.Type ( module X ) where + +import "ghc-boot-th" GHC.LanguageExtensions.Type as X diff --git a/libraries/ghc-boot/GHC/Lexeme.hs b/libraries/ghc-boot/GHC/Lexeme.hs new file mode 100644 index 0000000..ab9310e --- /dev/null +++ b/libraries/ghc-boot/GHC/Lexeme.hs @@ -0,0 +1,5 @@ +{-# LANGUAGE PackageImports #-} + +module GHC.Lexeme ( module X ) where + +import "ghc-boot-th" GHC.Lexeme as X diff --git a/libraries/ghc-boot/ghc-boot.cabal.in b/libraries/ghc-boot/ghc-boot.cabal.in index eed11e3..49b45c1 100644 --- a/libraries/ghc-boot/ghc-boot.cabal.in +++ b/libraries/ghc-boot/ghc-boot.cabal.in @@ -37,13 +37,11 @@ Library exposed-modules: GHC.LanguageExtensions + GHC.LanguageExtensions.Type + GHC.Lexeme GHC.PackageDb GHC.Serialized - reexported-modules: - GHC.LanguageExtensions.Type, - GHC.Lexeme - build-depends: base >= 4.7 && < 4.10, binary == 0.8.*, bytestring == 0.10.*, From git at git.haskell.org Mon May 16 17:54:35 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 May 2016 17:54:35 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Describe ghc-boot-th in the release notes (38cecbd) Message-ID: <20160516175435.19A193A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/38cecbdfcbce53d2d5da2bd0340b058b73b96735/ghc >--------------------------------------------------------------- commit 38cecbdfcbce53d2d5da2bd0340b058b73b96735 Author: Ben Gamari Date: Mon May 16 17:49:52 2016 +0200 Describe ghc-boot-th in the release notes >--------------------------------------------------------------- 38cecbdfcbce53d2d5da2bd0340b058b73b96735 docs/users_guide/8.0.1-notes.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/users_guide/8.0.1-notes.rst b/docs/users_guide/8.0.1-notes.rst index 889142b..6e552be 100644 --- a/docs/users_guide/8.0.1-notes.rst +++ b/docs/users_guide/8.0.1-notes.rst @@ -709,6 +709,16 @@ ghc-boot of containing intra-GHC functionality that needs to be shared across multiple GHC boot libraries. +ghc-boot-th +~~~~~~~~~~~ + +- This is an internal package. Use with caution. + +- Version number 8.0.1 + +- This package was created to share types and utilities between the ``ghc`` and + ``template-haskell`` packages + - Added ``GHC.Lexeme``, which contains functions for determining if a character can be the first letter of a variable or data constructor in Haskell, as defined by GHC. (These functions were moved from ``Lexeme`` From git at git.haskell.org Mon May 16 17:54:37 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 May 2016 17:54:37 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Bump haddock submodule (b105b0a) Message-ID: <20160516175437.B689E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/b105b0a09dd5aaf663b661fade7c01e6a2670519/ghc >--------------------------------------------------------------- commit b105b0a09dd5aaf663b661fade7c01e6a2670519 Author: Ben Gamari Date: Mon May 16 17:03:21 2016 +0200 Bump haddock submodule This will be the 2.17.2 haddock release. >--------------------------------------------------------------- b105b0a09dd5aaf663b661fade7c01e6a2670519 utils/haddock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/haddock b/utils/haddock index 26e6b39..d100c8f 160000 --- a/utils/haddock +++ b/utils/haddock @@ -1 +1 @@ -Subproject commit 26e6b39de3213969d7de7f8bb3d4a849136866d1 +Subproject commit d100c8f38e8ee6c7e6ba291afbf2c9eaf4f7743d From git at git.haskell.org Mon May 16 18:35:15 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 May 2016 18:35:15 +0000 (UTC) Subject: [commit: ghc] master: Another bump of haddock submodule (d20d843) Message-ID: <20160516183515.C99AD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d20d8437a2b1dfde2399263de309a4aa537cfacd/ghc >--------------------------------------------------------------- commit d20d8437a2b1dfde2399263de309a4aa537cfacd Author: Ben Gamari Date: Mon May 16 19:37:11 2016 +0200 Another bump of haddock submodule Trying to ensure consistent haddock documentation across Sphinx versions is far too much work for too little benefit; reverting Alabaster vendorization. >--------------------------------------------------------------- d20d8437a2b1dfde2399263de309a4aa537cfacd utils/haddock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/haddock b/utils/haddock index 1bfcca3..e82d093 160000 --- a/utils/haddock +++ b/utils/haddock @@ -1 +1 @@ -Subproject commit 1bfcca3f2212e1f8e527ad3a2c4bb48aef082ff9 +Subproject commit e82d093a9b3fb68486920896a3d67d84a822cbc5 From git at git.haskell.org Mon May 16 19:07:04 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 May 2016 19:07:04 +0000 (UTC) Subject: [commit: ghc] master: Remove html_theme requirement of haddock docs (7814420) Message-ID: <20160516190704.02C113A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/781442096b02a3dac7ab5ad6335f07b7edb569ea/ghc >--------------------------------------------------------------- commit 781442096b02a3dac7ab5ad6335f07b7edb569ea Author: Ben Gamari Date: Mon May 16 21:07:13 2016 +0200 Remove html_theme requirement of haddock docs Updates haddock submodule. >--------------------------------------------------------------- 781442096b02a3dac7ab5ad6335f07b7edb569ea utils/haddock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/haddock b/utils/haddock index e82d093..375a8d8 160000 --- a/utils/haddock +++ b/utils/haddock @@ -1 +1 @@ -Subproject commit e82d093a9b3fb68486920896a3d67d84a822cbc5 +Subproject commit 375a8d8c7203857863992483df9f9d24ec93ecab From git at git.haskell.org Mon May 16 19:26:41 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 May 2016 19:26:41 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Cache the size of part_list/scavd_list (#11783) (9649973) Message-ID: <20160516192641.481203A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/9649973c8038591a2c9f77e1183dd920b724daa5/ghc >--------------------------------------------------------------- commit 9649973c8038591a2c9f77e1183dd920b724daa5 Author: Simon Marlow Date: Mon Apr 11 19:29:14 2016 -0700 Cache the size of part_list/scavd_list (#11783) After a parallel GC, it is possible to have a long list of blocks in ws->part_list, if we did a lot of work stealing but didn't fill up the blocks we stole. These blocks persist until the next load-balanced GC, which might be a long time, and during every GC we were traversing this list to find its size. The fix is to maintain the size all the time, so we don't have to compute it. (cherry picked from commit 5c4cd0e44657d52f7ca5fee63f8765d17f1fbe85) >--------------------------------------------------------------- 9649973c8038591a2c9f77e1183dd920b724daa5 rts/sm/GC.c | 7 ++++++- rts/sm/GCThread.h | 8 +++++--- rts/sm/GCUtils.c | 3 +++ rts/sm/Storage.c | 11 ++++++----- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/rts/sm/GC.c b/rts/sm/GC.c index 95d9951..470db0a 100644 --- a/rts/sm/GC.c +++ b/rts/sm/GC.c @@ -820,9 +820,11 @@ new_gc_thread (nat n, gc_thread *t) ws->part_list = NULL; ws->n_part_blocks = 0; + ws->n_part_words = 0; ws->scavd_list = NULL; ws->n_scavd_blocks = 0; + ws->n_scavd_words = 0; } } @@ -1219,9 +1221,11 @@ prepare_collected_gen (generation *gen) } ws->part_list = NULL; ws->n_part_blocks = 0; + ws->n_part_words = 0; ASSERT(ws->scavd_list == NULL); ASSERT(ws->n_scavd_blocks == 0); + ASSERT(ws->n_scavd_words == 0); if (ws->todo_free != ws->todo_bd->start) { ws->todo_bd->free = ws->todo_free; @@ -1346,7 +1350,6 @@ collect_gct_blocks (void) prev = NULL; for (bd = ws->scavd_list; bd != NULL; bd = bd->link) { - ws->gen->n_words += bd->free - bd->start; prev = bd; } if (prev != NULL) { @@ -1354,9 +1357,11 @@ collect_gct_blocks (void) ws->gen->blocks = ws->scavd_list; } ws->gen->n_blocks += ws->n_scavd_blocks; + ws->gen->n_words += ws->n_scavd_words; ws->scavd_list = NULL; ws->n_scavd_blocks = 0; + ws->n_scavd_words = 0; RELEASE_SPIN_LOCK(&ws->gen->sync); } diff --git a/rts/sm/GCThread.h b/rts/sm/GCThread.h index ca90717..1fee7a6 100644 --- a/rts/sm/GCThread.h +++ b/rts/sm/GCThread.h @@ -94,13 +94,15 @@ typedef struct gen_workspace_ { // Objects that have already been scavenged. bdescr * scavd_list; - nat n_scavd_blocks; // count of blocks in this list + StgWord n_scavd_blocks; // count of blocks in this list + StgWord n_scavd_words; // Partially-full, scavenged, blocks bdescr * part_list; - unsigned int n_part_blocks; // count of above + StgWord n_part_blocks; // count of above + StgWord n_part_words; - StgWord pad[3]; + StgWord pad[1]; } gen_workspace ATTRIBUTE_ALIGNED(64); // align so that computing gct->gens[n] is a shift, not a multiply diff --git a/rts/sm/GCUtils.c b/rts/sm/GCUtils.c index 1c6a93c..364a10a 100644 --- a/rts/sm/GCUtils.c +++ b/rts/sm/GCUtils.c @@ -146,6 +146,7 @@ push_scanned_block (bdescr *bd, gen_workspace *ws) bd->link = ws->part_list; ws->part_list = bd; ws->n_part_blocks += bd->blocks; + ws->n_part_words += bd->free - bd->start; IF_DEBUG(sanity, ASSERT(countBlocks(ws->part_list) == ws->n_part_blocks)); } @@ -155,6 +156,7 @@ push_scanned_block (bdescr *bd, gen_workspace *ws) bd->link = ws->scavd_list; ws->scavd_list = bd; ws->n_scavd_blocks += bd->blocks; + ws->n_scavd_words += bd->free - bd->start; IF_DEBUG(sanity, ASSERT(countBlocks(ws->scavd_list) == ws->n_scavd_blocks)); } @@ -306,6 +308,7 @@ alloc_todo_block (gen_workspace *ws, nat size) { ws->part_list = bd->link; ws->n_part_blocks -= bd->blocks; + ws->n_part_words -= bd->free - bd->start; } else { diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c index bfc6eb1..cd66e06 100644 --- a/rts/sm/Storage.c +++ b/rts/sm/Storage.c @@ -1183,13 +1183,14 @@ W_ genLiveBlocks (generation *gen) W_ gcThreadLiveWords (nat i, nat g) { - W_ words; + W_ a, b, c; - words = countOccupied(gc_threads[i]->gens[g].todo_bd); - words += countOccupied(gc_threads[i]->gens[g].part_list); - words += countOccupied(gc_threads[i]->gens[g].scavd_list); + a = countOccupied(gc_threads[i]->gens[g].todo_bd); + b = gc_threads[i]->gens[g].n_part_words; + c = gc_threads[i]->gens[g].n_scavd_words; - return words; +// debugBelch("cap %d, g%d, %ld %ld %ld\n", i, g, a, b, c); + return a + b + c; } W_ gcThreadLiveBlocks (nat i, nat g) From git at git.haskell.org Mon May 16 19:26:43 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 May 2016 19:26:43 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: One more update to haddock submodule (7617793) Message-ID: <20160516192643.F03D43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/76177935426c5558c62323e7b8c0afea2b37cd72/ghc >--------------------------------------------------------------- commit 76177935426c5558c62323e7b8c0afea2b37cd72 Author: Ben Gamari Date: Mon May 16 21:04:40 2016 +0200 One more update to haddock submodule Remove html_theme declaration. >--------------------------------------------------------------- 76177935426c5558c62323e7b8c0afea2b37cd72 utils/haddock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/haddock b/utils/haddock index d100c8f..6db811a 160000 --- a/utils/haddock +++ b/utils/haddock @@ -1 +1 @@ -Subproject commit d100c8f38e8ee6c7e6ba291afbf2c9eaf4f7743d +Subproject commit 6db811aefb9cba65c8efe3876e850c813f280b6c From git at git.haskell.org Mon May 16 20:22:00 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 16 May 2016 20:22:00 +0000 (UTC) Subject: [commit: ghc] master: Set `USE_MMAP` at configure time (4a037a9) Message-ID: <20160516202200.5CCA73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4a037a9a933e043bdc08ae13bfbc846fe0e26ec9/ghc >--------------------------------------------------------------- commit 4a037a9a933e043bdc08ae13bfbc846fe0e26ec9 Author: Erik de Castro Lopo Date: Mon May 16 13:59:57 2016 +1000 Set `USE_MMAP` at configure time Summary: The `USE_MMAP` macro is used in the run time linker and was being set with some really ugly CPP hackery. Setting in the configure script is much neater. Reviewers: rwbarton, hvr, austin, simonmar, bgamari Reviewed By: hvr, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2223 >--------------------------------------------------------------- 4a037a9a933e043bdc08ae13bfbc846fe0e26ec9 configure.ac | 28 ++++++++++++++++++++++++++++ rts/Linker.c | 54 +++++++++++++++++++----------------------------------- 2 files changed, 47 insertions(+), 35 deletions(-) diff --git a/configure.ac b/configure.ac index ff0dc05..4adf9c5 100644 --- a/configure.ac +++ b/configure.ac @@ -1062,6 +1062,34 @@ if test "$use_large_address_space" = "yes" ; then AC_DEFINE([USE_LARGE_ADDRESS_SPACE], [1], [Enable single heap address space support]) fi +dnl ** Use MMAP in the runtime linker? +dnl -------------------------------------------------------------- + +case ${TargetOS} in + linux|freebsd|dragonfly|netbsd|openbsd|kfreebsdgnu|gnu|solaris2) + RtsLinkerUseMmap=1 + ;; + darwin) + # Don't use mmap on powerpc/darwin as the mmap there doesn't support + # reallocating. Reallocating is needed to allocate jump islands just + # after each object image. Jumps to these jump islands use relative + # branches which are limited to offsets that can be represented in + # 24-bits. + if test "$TargetArch" != "powerpc" ; then + RtsLinkerUseMmap=1 + else + RtsLinkerUseMmap=0 + fi + ;; + *) + # Windows (which doesn't have mmap) and everything else. + RtsLinkerUseMmap=0 + ;; + esac + +AC_DEFINE_UNQUOTED([RTS_LINKER_USE_MMAP], [$RtsLinkerUseMmap], + [Use mmap in the runtime linker]) + dnl ** Have libdw? dnl -------------------------------------------------------------- AC_ARG_ENABLE(libdw, diff --git a/rts/Linker.c b/rts/Linker.c index 09d4f6a..61b10d8 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -52,19 +52,7 @@ #include #endif -#if (defined(powerpc_HOST_ARCH) && defined(linux_HOST_OS)) \ - || (!defined(powerpc_HOST_ARCH) && \ - ( defined(linux_HOST_OS) || defined(freebsd_HOST_OS) || \ - defined(dragonfly_HOST_OS) || defined(netbsd_HOST_OS ) || \ - defined(openbsd_HOST_OS ) || defined(darwin_HOST_OS ) || \ - defined(kfreebsdgnu_HOST_OS) || defined(gnu_HOST_OS ) || \ - defined(solaris2_HOST_OS))) -/* Don't use mmap on powerpc/darwin as the mmap there doesn't support - * reallocating but we need to allocate jump islands just after each - * object images. Otherwise relative branches to jump islands can fail - * due to 24-bits displacement overflow. - */ -#define USE_MMAP 1 +#if RTS_LINKER_USE_MMAP #include #include @@ -72,10 +60,6 @@ #include #endif -#else - -#define USE_MMAP 0 - #endif @@ -90,7 +74,7 @@ #define SHORT_REL_BRANCH 1 #endif -#if (USE_MMAP && defined(SHORT_REL_BRANCH) && defined(linux_HOST_OS)) +#if (RTS_LINKER_USE_MMAP && defined(SHORT_REL_BRANCH) && defined(linux_HOST_OS)) #define USE_CONTIGUOUS_MMAP 1 #else #define USE_CONTIGUOUS_MMAP 0 @@ -397,7 +381,7 @@ typedef WINBOOL(WINAPI *LPRemoveDLLDirectory)(DLL_DIRECTORY_COOKIE Cookie); static void freeProddableBlocks (ObjectCode *oc); -#if USE_MMAP +#if RTS_LINKER_USE_MMAP /** * An allocated page being filled by the allocator */ @@ -825,7 +809,7 @@ initLinker_ (int retain_cafs) addDLLHandle(WSTR("*.exe"), GetModuleHandle(NULL)); #endif -#if USE_MMAP +#if RTS_LINKER_USE_MMAP m32_allocator_init(&allocator); #endif @@ -1493,7 +1477,7 @@ void ghci_enquire ( char* addr ) } #endif -#if USE_MMAP +#if RTS_LINKER_USE_MMAP #define ROUND_UP(x,size) ((x + size - 1) & ~(size - 1)) #define ROUND_DOWN(x,size) (x & ~(size - 1)) @@ -1834,7 +1818,7 @@ m32_alloc(m32_allocator m32, unsigned int size, * END (M32 ALLOCATOR) ***************************************************************************/ -#endif // USE_MMAP +#endif // RTS_LINKER_USE_MMAP /* * Remove symbols from the symbol table, and free oc->symbols. @@ -1892,7 +1876,7 @@ freePreloadObjectFile (ObjectCode *oc) #else - if (USE_MMAP && oc->imageMapped) { + if (RTS_LINKER_USE_MMAP && oc->imageMapped) { munmap(oc->image, oc->fileSize); } else { @@ -1924,7 +1908,7 @@ void freeObjectCode (ObjectCode *oc) for (i=0; i < oc->n_sections; i++) { if (oc->sections[i].start != NULL) { switch(oc->sections[i].alloc){ -#if USE_MMAP +#if RTS_LINKER_USE_MMAP case SECTION_MMAP: munmap(oc->sections[i].mapped_start, oc->sections[i].mapped_size); @@ -1950,7 +1934,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 (USE_MMAP) { + if (RTS_LINKER_USE_MMAP) { if (!USE_CONTIGUOUS_MMAP && oc->symbol_extras != NULL) { m32_free(oc->symbol_extras, sizeof(SymbolExtra) * oc->n_symbol_extras); @@ -2386,7 +2370,7 @@ static HsInt loadArchive_ (pathchar *path) #endif memberSize); #elif defined(darwin_HOST_OS) - if (USE_MMAP) + if (RTS_LINKER_USE_MMAP) image = mmapForLinker(memberSize, MAP_ANONYMOUS, -1, 0); else { /* See loadObj() */ @@ -2484,7 +2468,7 @@ static HsInt loadArchive_ (pathchar *path) barf("loadArchive: GNU-variant index found, but already have an index, while reading filename from `%s'", path); } IF_DEBUG(linker, debugBelch("loadArchive: Found GNU-variant file index\n")); -#if USE_MMAP +#if RTS_LINKER_USE_MMAP gnuFileIndex = mmapForLinker(memberSize + 1, MAP_ANONYMOUS, -1, 0); #else gnuFileIndex = stgMallocBytes(memberSize + 1, "loadArchive(image)"); @@ -2542,14 +2526,14 @@ static HsInt loadArchive_ (pathchar *path) stgFree(fileName); if (gnuFileIndex != NULL) { -#if USE_MMAP +#if RTS_LINKER_USE_MMAP munmap(gnuFileIndex, gnuFileIndexSize + 1); #else stgFree(gnuFileIndex); #endif } -#if USE_MMAP +#if RTS_LINKER_USE_MMAP m32_allocator_flush(&allocator); #endif @@ -2588,7 +2572,7 @@ preloadObjectFile (pathchar *path) fileSize = st.st_size; -#if USE_MMAP +#if RTS_LINKER_USE_MMAP int fd; /* On many architectures malloc'd memory isn't executable, so we need to use @@ -2609,7 +2593,7 @@ preloadObjectFile (pathchar *path) // not 32-bit yet, we'll remap later close(fd); -#else /* !USE_MMAP */ +#else /* !RTS_LINKER_USE_MMAP */ FILE *f; /* load the image into memory */ @@ -2664,7 +2648,7 @@ preloadObjectFile (pathchar *path) return NULL; } -#endif /* USE_MMAP */ +#endif /* RTS_LINKER_USE_MMAP */ oc = mkOc(path, image, fileSize, rtsTrue, NULL, misalignment); @@ -3056,7 +3040,7 @@ static int ocAllocateSymbolExtras( ObjectCode* oc, int count, int first ) { StgWord n; - if (USE_MMAP && USE_CONTIGUOUS_MMAP) { + if (RTS_LINKER_USE_MMAP && USE_CONTIGUOUS_MMAP) { n = roundUpToPage(oc->fileSize); /* Keep image and symbol_extras contiguous */ @@ -3078,7 +3062,7 @@ static int ocAllocateSymbolExtras( ObjectCode* oc, int count, int first ) } } else if( count > 0 ) { - if (USE_MMAP) { + if (RTS_LINKER_USE_MMAP) { n = roundUpToPage(oc->fileSize); oc->symbol_extras = m32_alloc(&allocator, @@ -7004,7 +6988,7 @@ ocGetNames_MachO(ObjectCode* oc) if((sections[i].flags & SECTION_TYPE) == S_ZEROFILL) { char * zeroFillArea; - if (USE_MMAP) { + if (RTS_LINKER_USE_MMAP) { zeroFillArea = mmapForLinker(sections[i].size, MAP_ANONYMOUS, -1, 0); if (zeroFillArea == NULL) return 0; From git at git.haskell.org Tue May 17 01:44:48 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 17 May 2016 01:44:48 +0000 (UTC) Subject: [commit: ghc] wip/erikd/rts: rts: More const correct-ness fixes (e9e9c77) Message-ID: <20160517014448.0174F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/rts Link : http://ghc.haskell.org/trac/ghc/changeset/e9e9c771a72efa94ca00e4d2dd54926951b153f7/ghc >--------------------------------------------------------------- commit e9e9c771a72efa94ca00e4d2dd54926951b153f7 Author: Erik de Castro Lopo Date: Sun May 15 14:33:15 2016 +1000 rts: More const correct-ness fixes >--------------------------------------------------------------- e9e9c771a72efa94ca00e4d2dd54926951b153f7 includes/rts/storage/ClosureMacros.h | 31 ++++++++++++++--------- includes/rts/storage/InfoTables.h | 5 ++-- rts/CheckUnload.c | 6 ++--- rts/Hash.c | 10 ++++---- rts/Hash.h | 9 +++++-- rts/Hpc.c | 3 ++- rts/Printer.c | 49 ++++++++++++++++++------------------ rts/Printer.h | 16 ++++++------ rts/ProfHeap.c | 18 ++++++------- rts/Profiling.c | 6 ++--- rts/RaiseAsync.c | 2 +- rts/RetainerProfile.c | 2 +- rts/RtsAPI.c | 4 +-- rts/STM.c | 2 +- rts/Schedule.c | 8 +++--- rts/Stable.c | 2 +- rts/ThreadPaused.c | 2 +- rts/sm/Compact.c | 8 +++--- rts/sm/Sanity.c | 20 +++++++-------- rts/sm/Sanity.h | 2 +- rts/sm/Scav.c | 12 ++++----- 21 files changed, 116 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 e9e9c771a72efa94ca00e4d2dd54926951b153f7 From git at git.haskell.org Tue May 17 01:44:50 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 17 May 2016 01:44:50 +0000 (UTC) Subject: [commit: ghc] wip/erikd/rts's head updated: rts: More const correct-ness fixes (e9e9c77) Message-ID: <20160517014450.7FE153A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/erikd/rts' now includes: bf669a0 Bump haddock submodule 2dbdc79 PPC NCG: Fix pretty printing of st[wd]ux instr. 563a485 PPC: Implement SMP primitives using gcc built-ins d78faa1 testsuite/ImpSafe03: Normalize version of bytestring eed820b Move Extension type to ghc-boot-th 21fe4ff Kill varSetElems in tcInferPatSynDecl d20d843 Another bump of haddock submodule 7814420 Remove html_theme requirement of haddock docs 4a037a9 Set `USE_MMAP` at configure time e9e9c77 rts: More const correct-ness fixes From git at git.haskell.org Tue May 17 10:08:40 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 17 May 2016 10:08:40 +0000 (UTC) Subject: [commit: ghc] master: Add ghc-boot-th to rules/foreachLibrary (770d708) Message-ID: <20160517100840.439943A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/770d7085d6e3f3e74e3ffe318aeaf135cf3aea72/ghc >--------------------------------------------------------------- commit 770d7085d6e3f3e74e3ffe318aeaf135cf3aea72 Author: Ben Gamari Date: Tue May 17 09:53:00 2016 +0200 Add ghc-boot-th to rules/foreachLibrary This may have been the cause of various build failures on FreeBSD and Solaris. >--------------------------------------------------------------- 770d7085d6e3f3e74e3ffe318aeaf135cf3aea72 rules/foreachLibrary.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rules/foreachLibrary.mk b/rules/foreachLibrary.mk index 1f44c9e..d65533e 100644 --- a/rules/foreachLibrary.mk +++ b/rules/foreachLibrary.mk @@ -29,6 +29,7 @@ # # - base # - ghc-boot +# - ghc-boot-th # - ghc-prim # - integer-gmp # - integer-simple @@ -37,7 +38,8 @@ define foreachLibrary # $1 = function to call for each library # We will give it the package path and the tag as arguments -$$(foreach hashline,libraries/ghc-boot#-#no-remote-repo#no-vcs \ +$$(foreach hashline,libraries/ghc-boot-th-#no-remote-repo#no-vcs \ + libraries/ghc-boot#-#no-remote-repo#no-vcs \ libraries/ghci#-#no-remote-repo#no-vcs \ libraries/base#-#no-remote-repo#no-vcs \ libraries/ghc-prim#-#no-remote-repo#no-vcs \ From git at git.haskell.org Tue May 17 10:37:49 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 17 May 2016 10:37:49 +0000 (UTC) Subject: [commit: ghc] master: Document determinism in shortOutIndirections (dc94914) Message-ID: <20160517103749.C08943A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/dc94914eb0da985a2f006e2bd390fa1fdbafcc33/ghc >--------------------------------------------------------------- commit dc94914eb0da985a2f006e2bd390fa1fdbafcc33 Author: Bartosz Nitka Date: Tue May 17 02:46:30 2016 -0700 Document determinism in shortOutIndirections varEnvElts didn't introduce nondeterminism here. This makes it obvious that it could and explains why it doesn't. Test Plan: ./validate Reviewers: bgamari, simonmar, austin, simonpj Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2228 GHC Trac Issues: #4012 >--------------------------------------------------------------- dc94914eb0da985a2f006e2bd390fa1fdbafcc33 compiler/simplCore/SimplCore.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/compiler/simplCore/SimplCore.hs b/compiler/simplCore/SimplCore.hs index 86eadc7..6884696 100644 --- a/compiler/simplCore/SimplCore.hs +++ b/compiler/simplCore/SimplCore.hs @@ -51,6 +51,7 @@ import Module import Maybes import UniqSupply ( UniqSupply, mkSplitUniqSupply, splitUniqSupply ) +import UniqFM import Outputable import Control.Monad import qualified GHC.LanguageExtensions as LangExt @@ -901,7 +902,10 @@ shortOutIndirections binds where ind_env = makeIndEnv binds -- These exported Ids are the subjects of the indirection-elimination - exp_ids = map fst $ varEnvElts ind_env + exp_ids = map fst $ nonDetEltsUFM ind_env + -- It's OK to use nonDetEltsUFM here because we forget the ordering + -- by immediately converting to a set or check if all the elements + -- satisfy a predicate. exp_id_set = mkVarSet exp_ids no_need_to_flatten = all (null . ruleInfoRules . idSpecialisation) exp_ids binds' = concatMap zap binds From git at git.haskell.org Tue May 17 12:08:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 17 May 2016 12:08:06 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Add ghc-boot-th to rules/foreachLibrary (e705ef1) Message-ID: <20160517120806.443E53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/e705ef137db404cda1537cb5e68b6c0ceb0a21d3/ghc >--------------------------------------------------------------- commit e705ef137db404cda1537cb5e68b6c0ceb0a21d3 Author: Ben Gamari Date: Tue May 17 09:53:00 2016 +0200 Add ghc-boot-th to rules/foreachLibrary This may have been the cause of various build failures on FreeBSD and Solaris. (cherry picked from commit 770d7085d6e3f3e74e3ffe318aeaf135cf3aea72) >--------------------------------------------------------------- e705ef137db404cda1537cb5e68b6c0ceb0a21d3 rules/foreachLibrary.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rules/foreachLibrary.mk b/rules/foreachLibrary.mk index 1f44c9e..d65533e 100644 --- a/rules/foreachLibrary.mk +++ b/rules/foreachLibrary.mk @@ -29,6 +29,7 @@ # # - base # - ghc-boot +# - ghc-boot-th # - ghc-prim # - integer-gmp # - integer-simple @@ -37,7 +38,8 @@ define foreachLibrary # $1 = function to call for each library # We will give it the package path and the tag as arguments -$$(foreach hashline,libraries/ghc-boot#-#no-remote-repo#no-vcs \ +$$(foreach hashline,libraries/ghc-boot-th-#no-remote-repo#no-vcs \ + libraries/ghc-boot#-#no-remote-repo#no-vcs \ libraries/ghci#-#no-remote-repo#no-vcs \ libraries/base#-#no-remote-repo#no-vcs \ libraries/ghc-prim#-#no-remote-repo#no-vcs \ From git at git.haskell.org Tue May 17 12:08:08 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 17 May 2016 12:08:08 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: testsuite: Bump expected 32-bit perf numbers for haddock.base (7879001) Message-ID: <20160517120808.E52DA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/787900138b94790ddd13d76c2853d789d3335a5d/ghc >--------------------------------------------------------------- commit 787900138b94790ddd13d76c2853d789d3335a5d Author: Ben Gamari Date: Tue May 17 14:10:32 2016 +0200 testsuite: Bump expected 32-bit perf numbers for haddock.base >--------------------------------------------------------------- 787900138b94790ddd13d76c2853d789d3335a5d testsuite/tests/perf/haddock/all.T | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/testsuite/tests/perf/haddock/all.T b/testsuite/tests/perf/haddock/all.T index 5d9ab8c..de45ea4 100644 --- a/testsuite/tests/perf/haddock/all.T +++ b/testsuite/tests/perf/haddock/all.T @@ -37,13 +37,14 @@ test('haddock.base', # 2014-12-01: 4202377432 (x86/Windows, 64bit machine) # 2015-01-20: 4434804940 (x86/Windows, 64bit machine) - ,(wordsize(32), 5509757068, 5)]) + ,(wordsize(32), 5876620892, 5)]) # 2012-08-14: 3046487920 (x86/OSX) # 2012-10-30: 2955470952 (x86/Windows) # 2013-02-10: 3146596848 (x86/OSX) - # 2014-02-22: 3554624600 (x86/Linux - new haddock) + # 2014-02-22: 3554624600 (x86/Linux, new haddock) # 2014-06-29: 3799130400 (x86/Linux) # 2016-04-06: 5509757068 (x86/Linux) + # 2016-05-17: 5876620892 (x86/Linux, haddock changes) ], stats, ['../../../../libraries/base/dist-install/haddock.t']) From git at git.haskell.org Tue May 17 16:03:15 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 17 May 2016 16:03:15 +0000 (UTC) Subject: [commit: ghc] master: Testsuite: delete old cleanup code (#11980) (1a9ae4b) Message-ID: <20160517160315.C6BC53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1a9ae4b39c057d2a21192f6be033c8545702f345/ghc >--------------------------------------------------------------- commit 1a9ae4b39c057d2a21192f6be033c8545702f345 Author: Thomas Miedema Date: Sun Apr 24 16:24:25 2016 +0200 Testsuite: delete old cleanup code (#11980) >--------------------------------------------------------------- 1a9ae4b39c057d2a21192f6be033c8545702f345 testsuite/Makefile | 3 - testsuite/config/ghc | 1 - testsuite/driver/testlib.py | 159 ++++---------------------------------------- testsuite/mk/test.mk | 6 -- 4 files changed, 13 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 1a9ae4b39c057d2a21192f6be033c8545702f345 From git at git.haskell.org Tue May 17 16:03:18 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 17 May 2016 16:03:18 +0000 (UTC) Subject: [commit: ghc] master: Testsuite: don't skip concio001 and concio001_thr (c92cfbc) Message-ID: <20160517160318.764583A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c92cfbce82e69a785951616e5918a90f221bb7a1/ghc >--------------------------------------------------------------- commit c92cfbce82e69a785951616e5918a90f221bb7a1 Author: Thomas Miedema Date: Mon Apr 25 20:33:52 2016 +0200 Testsuite: don't skip concio001 and concio001_thr I think they were skipped before because they write to the same output file (concio001). This is no longer a problem. >--------------------------------------------------------------- c92cfbce82e69a785951616e5918a90f221bb7a1 libraries/base/tests/IO/Makefile | 4 ++-- libraries/base/tests/IO/all.T | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/base/tests/IO/Makefile b/libraries/base/tests/IO/Makefile index 9d5089d..d1a9402 100644 --- a/libraries/base/tests/IO/Makefile +++ b/libraries/base/tests/IO/Makefile @@ -7,11 +7,11 @@ include $(TOP)/mk/boilerplate.mk include $(TOP)/mk/test.mk test.concio001: - $(TEST_HC) $(TEST_HC_OPTS) --make -fforce-recomp -v0 concio001 -o concio001 + "$(TEST_HC)" $(TEST_HC_OPTS) --make -fforce-recomp -v0 concio001 -o concio001 (sleep 1; echo x) | ./concio001 test.concio001.thr: - $(TEST_HC) $(TEST_HC_OPTS) --make -fforce-recomp -v0 -threaded concio001 -o concio001 + "$(TEST_HC)" $(TEST_HC_OPTS) --make -fforce-recomp -v0 -threaded concio001 -o concio001 (sleep 1; echo x) | ./concio001 # NB. utf8-test should *not* have a final newline. The last char should be 'X'. diff --git a/libraries/base/tests/IO/all.T b/libraries/base/tests/IO/all.T index 396e9b7..d04f3c4 100644 --- a/libraries/base/tests/IO/all.T +++ b/libraries/base/tests/IO/all.T @@ -107,8 +107,8 @@ test('countReaders001', extra_clean(['countReaders001.txt']), compile_and_run, ['']) -test('concio001', skip, run_command, ['$MAKE -s --no-print-directory test.concio001']) -test('concio001.thr', skip, run_command, ['$MAKE -s --no-print-directory test.concio001.thr']) +test('concio001', normal, run_command, ['$MAKE -s --no-print-directory test.concio001']) +test('concio001.thr', normal, run_command, ['$MAKE -s --no-print-directory test.concio001.thr']) test('concio002', reqlib('process'), compile_and_run, ['']) From git at git.haskell.org Tue May 17 16:03:21 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 17 May 2016 16:03:21 +0000 (UTC) Subject: [commit: ghc] master: Testsuite: run tests in /tmp after copying required files (3f3dc23) Message-ID: <20160517160321.D71713A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3f3dc23ea64573a12e2f4bfdaaa3aa536ad3188d/ghc >--------------------------------------------------------------- commit 3f3dc23ea64573a12e2f4bfdaaa3aa536ad3188d Author: Thomas Miedema Date: Sat Aug 29 15:52:43 2015 +0200 Testsuite: run tests in /tmp after copying required files Major change to the testsuite driver. For each TEST: * create a directory `` inside `/tmp`. * link/copy all source files that the test needs into ``. * run the test inside ``. * delete `` Extra files are (temporarily) tracked in `testsuite/driver/extra_files.py`, but can also be specified using the `extra_files` setup function. Differential Revision: https://phabricator.haskell.org/D1187 Reviewed by: Rufflewind, bgamari Trac: #11980 >--------------------------------------------------------------- 3f3dc23ea64573a12e2f4bfdaaa3aa536ad3188d testsuite/driver/extra_files.py | 535 +++++++++++++++++++++++++ testsuite/driver/runtests.py | 30 +- testsuite/driver/testglobals.py | 3 + testsuite/driver/testlib.py | 151 ++++++- testsuite/driver/testutil.py | 32 ++ testsuite/tests/plugins/all.T | 17 +- testsuite/tests/simplCore/should_compile/all.T | 2 +- 7 files changed, 743 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 3f3dc23ea64573a12e2f4bfdaaa3aa536ad3188d From git at git.haskell.org Tue May 17 16:03:24 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 17 May 2016 16:03:24 +0000 (UTC) Subject: [commit: ghc] master: Delete libraries/ghci/GNUmakefile [skip ci] (931b3c7) Message-ID: <20160517160324.A92923A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/931b3c74fe7cb772be6abc483f1811c7db552a2e/ghc >--------------------------------------------------------------- commit 931b3c74fe7cb772be6abc483f1811c7db552a2e Author: Thomas Miedema Date: Tue May 17 18:05:28 2016 +0200 Delete libraries/ghci/GNUmakefile [skip ci] This file should not have been included in the repository, as it is generated by `./boot`. >--------------------------------------------------------------- 931b3c74fe7cb772be6abc483f1811c7db552a2e libraries/ghci/GNUmakefile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/libraries/ghci/GNUmakefile b/libraries/ghci/GNUmakefile deleted file mode 100644 index ce6a24f..0000000 --- a/libraries/ghci/GNUmakefile +++ /dev/null @@ -1,4 +0,0 @@ -dir = libraries/ghci -TOP = ../.. -include $(TOP)/mk/sub-makefile.mk -FAST_MAKE_OPTS += stage=0 From git at git.haskell.org Tue May 17 16:03:27 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 17 May 2016 16:03:27 +0000 (UTC) Subject: [commit: ghc] master: Testsuite: delete unused file [skip ci] (a9dd9b7) Message-ID: <20160517160327.555E23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a9dd9b7409ae89423d12909b82b8eb1724217db6/ghc >--------------------------------------------------------------- commit a9dd9b7409ae89423d12909b82b8eb1724217db6 Author: Thomas Miedema Date: Fri May 6 10:12:38 2016 +0200 Testsuite: delete unused file [skip ci] >--------------------------------------------------------------- a9dd9b7409ae89423d12909b82b8eb1724217db6 testsuite/tests/concurrent/prog001/Main.hs | 3 --- 1 file changed, 3 deletions(-) diff --git a/testsuite/tests/concurrent/prog001/Main.hs b/testsuite/tests/concurrent/prog001/Main.hs deleted file mode 100644 index b90fe11..0000000 --- a/testsuite/tests/concurrent/prog001/Main.hs +++ /dev/null @@ -1,3 +0,0 @@ -import Mutiply - -main = startM1 From git at git.haskell.org Tue May 17 16:26:33 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 17 May 2016 16:26:33 +0000 (UTC) Subject: [commit: ghc] master: rules: Fix name of ghc-boot-th library (a54d87a) Message-ID: <20160517162633.CC2D43A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a54d87a9e69746446adfe84a38d888861b3ec02b/ghc >--------------------------------------------------------------- commit a54d87a9e69746446adfe84a38d888861b3ec02b Author: Ben Gamari Date: Tue May 17 15:18:37 2016 +0200 rules: Fix name of ghc-boot-th library There was a missing `#`. Hadrian couldn't come soon enough. >--------------------------------------------------------------- a54d87a9e69746446adfe84a38d888861b3ec02b rules/foreachLibrary.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/foreachLibrary.mk b/rules/foreachLibrary.mk index d65533e..be79fcc 100644 --- a/rules/foreachLibrary.mk +++ b/rules/foreachLibrary.mk @@ -38,7 +38,7 @@ define foreachLibrary # $1 = function to call for each library # We will give it the package path and the tag as arguments -$$(foreach hashline,libraries/ghc-boot-th-#no-remote-repo#no-vcs \ +$$(foreach hashline,libraries/ghc-boot-th#-#no-remote-repo#no-vcs \ libraries/ghc-boot#-#no-remote-repo#no-vcs \ libraries/ghci#-#no-remote-repo#no-vcs \ libraries/base#-#no-remote-repo#no-vcs \ From git at git.haskell.org Tue May 17 16:26:31 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 17 May 2016 16:26:31 +0000 (UTC) Subject: [commit: ghc] master: rules/build-prog: Ensure programs depend upon their transitive deps (5d80d14) Message-ID: <20160517162631.294E23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5d80d14196ef048ffe037b2d92af2e9af0cb9e19/ghc >--------------------------------------------------------------- commit 5d80d14196ef048ffe037b2d92af2e9af0cb9e19 Author: Ben Gamari Date: Tue May 17 18:05:24 2016 +0200 rules/build-prog: Ensure programs depend upon their transitive deps Previously programs only depended upon the direct dependencies; while I would have thought that this would be sufficient, somehow we were getting to the link step of building `ghc-pkg` before `ghc-boot-th` was built (despite the fact that `ghc-boot` has a direct dependency on `ghc-boot-th`). See #12078. >--------------------------------------------------------------- 5d80d14196ef048ffe037b2d92af2e9af0cb9e19 rules/build-prog.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rules/build-prog.mk b/rules/build-prog.mk index 74bcc4a..82c55a7 100644 --- a/rules/build-prog.mk +++ b/rules/build-prog.mk @@ -197,8 +197,10 @@ ifneq "$$(BINDIST)" "YES" # The quadrupled $'s here are because the __LIB variables aren't # necessarily set when this part of the makefile is read $1/$2/build/tmp/$$($1_$2_PROG) $1/$2/build/tmp/$$($1_$2_PROG).dll : \ - $$(foreach dep,$$($1_$2_DEP_COMPONENT_IDS),\ + $$(foreach dep,$$($1_$2_TRANSITIVE_DEP_COMPONENT_IDS),\ $$$$($$(dep)_dist-$(if $(filter 0,$3),boot,install)_PROGRAM_DEP_LIB)) +# Workaround: We use TRANSITIVE_DEP_COMPONENT_IDS here as a workaround for +# Trac #12078. $1_$2_PROG_NEEDS_C_WRAPPER = NO $1_$2_PROG_INPLACE = $$($1_$2_PROG) From git at git.haskell.org Tue May 17 17:33:27 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 17 May 2016 17:33:27 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: rules: Fix name of ghc-boot-th library (a5b3a6a) Message-ID: <20160517173327.91E5A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/a5b3a6acb3b627f5527a0404ba281082e4475888/ghc >--------------------------------------------------------------- commit a5b3a6acb3b627f5527a0404ba281082e4475888 Author: Ben Gamari Date: Tue May 17 15:18:37 2016 +0200 rules: Fix name of ghc-boot-th library There was a missing `#`. Hadrian couldn't come soon enough. (cherry picked from commit a54d87a9e69746446adfe84a38d888861b3ec02b) >--------------------------------------------------------------- a5b3a6acb3b627f5527a0404ba281082e4475888 rules/foreachLibrary.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/foreachLibrary.mk b/rules/foreachLibrary.mk index d65533e..be79fcc 100644 --- a/rules/foreachLibrary.mk +++ b/rules/foreachLibrary.mk @@ -38,7 +38,7 @@ define foreachLibrary # $1 = function to call for each library # We will give it the package path and the tag as arguments -$$(foreach hashline,libraries/ghc-boot-th-#no-remote-repo#no-vcs \ +$$(foreach hashline,libraries/ghc-boot-th#-#no-remote-repo#no-vcs \ libraries/ghc-boot#-#no-remote-repo#no-vcs \ libraries/ghci#-#no-remote-repo#no-vcs \ libraries/base#-#no-remote-repo#no-vcs \ From git at git.haskell.org Tue May 17 17:33:30 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 17 May 2016 17:33:30 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: rules/build-prog: Ensure programs depend upon their transitive deps (4986837) Message-ID: <20160517173330.456873A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/4986837f8168cacf95c24fecc84d7b36c47f3c11/ghc >--------------------------------------------------------------- commit 4986837f8168cacf95c24fecc84d7b36c47f3c11 Author: Ben Gamari Date: Tue May 17 18:05:24 2016 +0200 rules/build-prog: Ensure programs depend upon their transitive deps Previously programs only depended upon the direct dependencies; while I would have thought that this would be sufficient, somehow we were getting to the link step of building `ghc-pkg` before `ghc-boot-th` was built (despite the fact that `ghc-boot` has a direct dependency on `ghc-boot-th`). See #12078. (cherry picked from commit 5d80d14196ef048ffe037b2d92af2e9af0cb9e19) >--------------------------------------------------------------- 4986837f8168cacf95c24fecc84d7b36c47f3c11 rules/build-prog.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rules/build-prog.mk b/rules/build-prog.mk index 74bcc4a..82c55a7 100644 --- a/rules/build-prog.mk +++ b/rules/build-prog.mk @@ -197,8 +197,10 @@ ifneq "$$(BINDIST)" "YES" # The quadrupled $'s here are because the __LIB variables aren't # necessarily set when this part of the makefile is read $1/$2/build/tmp/$$($1_$2_PROG) $1/$2/build/tmp/$$($1_$2_PROG).dll : \ - $$(foreach dep,$$($1_$2_DEP_COMPONENT_IDS),\ + $$(foreach dep,$$($1_$2_TRANSITIVE_DEP_COMPONENT_IDS),\ $$$$($$(dep)_dist-$(if $(filter 0,$3),boot,install)_PROGRAM_DEP_LIB)) +# Workaround: We use TRANSITIVE_DEP_COMPONENT_IDS here as a workaround for +# Trac #12078. $1_$2_PROG_NEEDS_C_WRAPPER = NO $1_$2_PROG_INPLACE = $$($1_$2_PROG) From git at git.haskell.org Tue May 17 23:05:06 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 17 May 2016 23:05:06 +0000 (UTC) Subject: [commit: ghc] master: rts: More const correct-ness fixes (33c029d) Message-ID: <20160517230506.0D5AB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/33c029dd77888ee5f9b1c7ce8884c982e0428adf/ghc >--------------------------------------------------------------- commit 33c029dd77888ee5f9b1c7ce8884c982e0428adf Author: Erik de Castro Lopo Date: Wed May 18 06:33:03 2016 +1000 rts: More const correct-ness fixes In addition to more const-correctness fixes this patch fixes an infelicity of the previous const-correctness patch (995cf0f356) which left `UNTAG_CLOSURE` taking a `const StgClosure` pointer parameter but returning a non-const pointer. Here we restore the original type signature of `UNTAG_CLOSURE` and add a new function `UNTAG_CONST_CLOSURE` which takes and returns a const `StgClosure` pointer and uses that wherever possible. Test Plan: Validate on Linux, OS X and Windows Reviewers: Phyx, hsyl20, bgamari, austin, simonmar, trofi Reviewed By: simonmar, trofi Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2231 >--------------------------------------------------------------- 33c029dd77888ee5f9b1c7ce8884c982e0428adf includes/rts/storage/ClosureMacros.h | 50 ++++++++++++++++++++++++++---------- includes/rts/storage/InfoTables.h | 8 +++--- rts/CheckUnload.c | 6 ++--- rts/Hash.c | 10 ++++---- rts/Hash.h | 9 +++++-- rts/Hpc.c | 3 ++- rts/Printer.c | 49 ++++++++++++++++++----------------- rts/Printer.h | 16 ++++++------ rts/ProfHeap.c | 18 ++++++------- rts/Profiling.c | 6 ++--- rts/RaiseAsync.c | 2 +- rts/RetainerProfile.c | 2 +- rts/RtsAPI.c | 4 +-- rts/STM.c | 2 +- rts/Schedule.c | 8 +++--- rts/Stable.c | 2 +- rts/ThreadPaused.c | 2 +- rts/sm/Compact.c | 9 ++++--- rts/sm/Sanity.c | 21 +++++++-------- rts/sm/Sanity.h | 2 +- rts/sm/Scav.c | 12 ++++----- 21 files changed, 138 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 33c029dd77888ee5f9b1c7ce8884c982e0428adf From git at git.haskell.org Wed May 18 00:13:13 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 18 May 2016 00:13:13 +0000 (UTC) Subject: [commit: ghc] branch 'wip/erikd/linker' created Message-ID: <20160518001313.83E613A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/erikd/linker Referencing: a507ff19e7f2225751e1dcd34e1127c68e5edef1 From git at git.haskell.org Wed May 18 00:13:17 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 18 May 2016 00:13:17 +0000 (UTC) Subject: [commit: ghc] wip/erikd/linker: WIP: Runtime linker: Break m32 allocator out into its own file (a507ff1) Message-ID: <20160518001317.266A93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/linker Link : http://ghc.haskell.org/trac/ghc/changeset/a507ff19e7f2225751e1dcd34e1127c68e5edef1/ghc >--------------------------------------------------------------- commit a507ff19e7f2225751e1dcd34e1127c68e5edef1 Author: Erik de Castro Lopo Date: Sat May 14 17:27:38 2016 +1000 WIP: Runtime linker: Break m32 allocator out into its own file This makes the code a little more modular and allows the removal of some CPP hackery. By providing dummy implementations of of the `m32_*` functions (which simply call `errorBelch`) it means that the call sites for these functions are syntax checked even when `RTS_LINKER_USE_MMAP` is `0`. Also changes some size parameter types from `unsigned int` to `size_t`. >--------------------------------------------------------------- a507ff19e7f2225751e1dcd34e1127c68e5edef1 rts/Linker.c | 299 ++-------------------------------------------- rts/ghc.mk | 2 +- rts/linker/M32Alloc.c | 320 ++++++++++++++++++++++++++++++++++++++++++++++++++ rts/linker/M32Alloc.h | 25 ++++ rts/posix/OSMem.c | 12 +- rts/sm/OSMem.h | 2 +- rts/win32/OSMem.c | 12 +- 7 files changed, 370 insertions(+), 302 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc a507ff19e7f2225751e1dcd34e1127c68e5edef1 From git at git.haskell.org Wed May 18 01:45:57 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 18 May 2016 01:45:57 +0000 (UTC) Subject: [commit: ghc] wip/erikd/linker: WIP: Runtime linker: Break m32 allocator out into its own file (29125b9) Message-ID: <20160518014558.00ABD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/linker Link : http://ghc.haskell.org/trac/ghc/changeset/29125b902dca24a96aa446774f091ead60195077/ghc >--------------------------------------------------------------- commit 29125b902dca24a96aa446774f091ead60195077 Author: Erik de Castro Lopo Date: Sat May 14 17:27:38 2016 +1000 WIP: Runtime linker: Break m32 allocator out into its own file This makes the code a little more modular and allows the removal of some CPP hackery. By providing dummy implementations of of the `m32_*` functions (which simply call `errorBelch`) it means that the call sites for these functions are syntax checked even when `RTS_LINKER_USE_MMAP` is `0`. Also changes some size parameter types from `unsigned int` to `size_t`. >--------------------------------------------------------------- 29125b902dca24a96aa446774f091ead60195077 rts/Linker.c | 310 +++--------------------------------------------- rts/ghc.mk | 2 +- rts/linker/M32Alloc.c | 320 ++++++++++++++++++++++++++++++++++++++++++++++++++ rts/linker/M32Alloc.h | 30 +++++ rts/posix/OSMem.c | 12 +- rts/sm/OSMem.h | 2 +- rts/win32/OSMem.c | 12 +- 7 files changed, 378 insertions(+), 310 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 29125b902dca24a96aa446774f091ead60195077 From git at git.haskell.org Wed May 18 04:15:55 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 18 May 2016 04:15:55 +0000 (UTC) Subject: [commit: ghc] wip/erikd/linker: WIP: Runtime linker: Break m32 allocator out into its own file (e1ddb93) Message-ID: <20160518041555.9916A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/linker Link : http://ghc.haskell.org/trac/ghc/changeset/e1ddb93604568482a2c7e46e791c1c3ae9729a62/ghc >--------------------------------------------------------------- commit e1ddb93604568482a2c7e46e791c1c3ae9729a62 Author: Erik de Castro Lopo Date: Sat May 14 17:27:38 2016 +1000 WIP: Runtime linker: Break m32 allocator out into its own file This makes the code a little more modular and allows the removal of some CPP hackery. By providing dummy implementations of of the `m32_*` functions (which simply call `errorBelch`) it means that the call sites for these functions are syntax checked even when `RTS_LINKER_USE_MMAP` is `0`. Also changes some size parameter types from `unsigned int` to `size_t`. >--------------------------------------------------------------- e1ddb93604568482a2c7e46e791c1c3ae9729a62 rts/Linker.c | 321 +++----------------------------------------------- rts/ghc.mk | 2 +- rts/linker/M32Alloc.c | 320 +++++++++++++++++++++++++++++++++++++++++++++++++ rts/linker/M32Alloc.h | 40 +++++++ rts/posix/OSMem.c | 12 +- rts/sm/OSMem.h | 2 +- rts/win32/OSMem.c | 12 +- 7 files changed, 388 insertions(+), 321 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc e1ddb93604568482a2c7e46e791c1c3ae9729a62 From git at git.haskell.org Wed May 18 09:11:10 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 18 May 2016 09:11:10 +0000 (UTC) Subject: [commit: ghc] master: Testsuite: T10052 requires interpreter (#11730) (b088c02) Message-ID: <20160518091110.D825E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b088c0297db2f0a86746fdc60977462ffb8c22ca/ghc >--------------------------------------------------------------- commit b088c0297db2f0a86746fdc60977462ffb8c22ca Author: Thomas Miedema Date: Wed May 18 11:07:35 2016 +0200 Testsuite: T10052 requires interpreter (#11730) >--------------------------------------------------------------- b088c0297db2f0a86746fdc60977462ffb8c22ca testsuite/tests/ghc-api/T10052/all.T | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testsuite/tests/ghc-api/T10052/all.T b/testsuite/tests/ghc-api/T10052/all.T index 40b80cd..04f4b16 100644 --- a/testsuite/tests/ghc-api/T10052/all.T +++ b/testsuite/tests/ghc-api/T10052/all.T @@ -1,2 +1,2 @@ -test('T10052', when(arch('powerpc64'), expect_broken(11259)), run_command, - ['$MAKE -s --no-print-directory T10052']) +test('T10052', [when(arch('powerpc64'), expect_broken(11259)), req_interp], + run_command, ['$MAKE -s --no-print-directory T10052']) From git at git.haskell.org Wed May 18 09:11:13 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 18 May 2016 09:11:13 +0000 (UTC) Subject: [commit: ghc] master: Testsuite: don't warn when mk/ghcconfig_* hasn't been created yet (3251743) Message-ID: <20160518091113.961AF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3251743acb7da3be6d83c237d537ca91d5a96cf8/ghc >--------------------------------------------------------------- commit 3251743acb7da3be6d83c237d537ca91d5a96cf8 Author: Thomas Miedema Date: Wed May 18 11:08:55 2016 +0200 Testsuite: don't warn when mk/ghcconfig_* hasn't been created yet [skip ci] >--------------------------------------------------------------- 3251743acb7da3be6d83c237d537ca91d5a96cf8 testsuite/mk/boilerplate.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testsuite/mk/boilerplate.mk b/testsuite/mk/boilerplate.mk index 077d503..09c61a4 100644 --- a/testsuite/mk/boilerplate.mk +++ b/testsuite/mk/boilerplate.mk @@ -244,7 +244,7 @@ $(ghc-config-mk) : $(TOP)/mk/ghc-config # Note: $(CLEANING) is not defined in the testsuite. ifeq "$(findstring clean,$(MAKECMDGOALS))" "" -include $(ghc-config-mk) +-include $(ghc-config-mk) endif # Note [WayFlags] From git at git.haskell.org Wed May 18 09:11:16 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 18 May 2016 09:11:16 +0000 (UTC) Subject: [commit: ghc] master: Update .mailmap [skip ci] (77ee3a9) Message-ID: <20160518091116.478EE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/77ee3a92a4012530cbd0b63c7b10b544eae50754/ghc >--------------------------------------------------------------- commit 77ee3a92a4012530cbd0b63c7b10b544eae50754 Author: Thomas Miedema Date: Tue May 17 19:33:01 2016 +0200 Update .mailmap [skip ci] >--------------------------------------------------------------- 77ee3a92a4012530cbd0b63c7b10b544eae50754 .mailmap | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.mailmap b/.mailmap index 81dec3d..cc3e031 100644 --- a/.mailmap +++ b/.mailmap @@ -11,7 +11,8 @@ Alexander Lukyanov # Ticket #9360. Alexander Vershilov Alexey Rodriguez Alexey Rodriguez mrchebas at gmail.com -Andrew Farmer +Andrew Farmer +Andrew Farmer Andrew Pimlott andrew.pimlott.ctr at metnet.navy.mil Andrew Tolmach apt Andr? Santos andre @@ -75,7 +76,8 @@ David Himmelstrup # http://www.haskell David M Peixotto dmp at rice.edu David Terei # Ticket #5785. David Terei -David Turner dnt # Same domain as Will Partain, who mentions "(from dnt)" +David C. Turner +David N. Turner dnt # Same domain as Will Partain, who mentions "(from dnt)" David Waern David Waern David Waern @@ -182,6 +184,7 @@ Nathan Huesken Neil Mitchell Neil Mitchell Neil Mitchell Nicholas Nethercote njn +Nikita Sazanovich Niklas Larsson # Commit 664063. Norman Ramsey nr at eecs.harvard.edu Orphi # Uses this name online. @@ -223,6 +226,7 @@ Simon Marlow Simon Marlow simonm Simon Marlow simonmar Simon Marlow simonmar at microsoft.com +Simon Marlow Simon Marlow uid245 # See Note [uid245] Simon Peyton Jones Simon Peyton Jones @@ -265,6 +269,7 @@ Yuri de Wit # Commit 37d64a. Yusuke Matsushita # https://github.com/Kinokkory Zejun Wu gwern gwern0 at gmail.com # Uses this name online. +mniip # Uses this name online. shelarcy # Uses this name online. ?mer Sinan A?acan # https://github.com/osa1 From git at git.haskell.org Wed May 18 12:51:48 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 18 May 2016 12:51:48 +0000 (UTC) Subject: [commit: ghc] master: Make inert_model and inert_eqs deterministic sets (fffe3a2) Message-ID: <20160518125148.E8EB43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fffe3a25adab41d44943ed1be0191cf570d3e154/ghc >--------------------------------------------------------------- commit fffe3a25adab41d44943ed1be0191cf570d3e154 Author: Bartosz Nitka Date: Tue May 17 05:45:43 2016 -0700 Make inert_model and inert_eqs deterministic sets The order inert_model and intert_eqs fold affects the order that the typechecker looks at things. I've been able to experimentally confirm that the order of equalities and the order of the model matter for determinism. This is just a straigthforward replacement of nondeterministic VarEnv for deterministic DVarEnv. Test Plan: ./validate Reviewers: simonpj, goldfire, austin, bgamari, simonmar Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2232 GHC Trac Issues: #4012 >--------------------------------------------------------------- fffe3a25adab41d44943ed1be0191cf570d3e154 compiler/basicTypes/VarEnv.hs | 28 +++++++++-- compiler/typecheck/TcFlatten.hs | 4 +- compiler/typecheck/TcInteract.hs | 2 +- compiler/typecheck/TcSMonad.hs | 58 +++++++++++----------- compiler/utils/UniqDFM.hs | 22 +++++++- .../tests/indexed-types/should_fail/T3330a.stderr | 5 +- .../tests/indexed-types/should_fail/T4174.stderr | 4 +- .../tests/indexed-types/should_fail/T4179.stderr | 6 +-- .../tests/indexed-types/should_fail/T9662.stderr | 4 +- testsuite/tests/polykinds/T9017.stderr | 4 +- testsuite/tests/typecheck/should_fail/T7869.stderr | 8 ++- 11 files changed, 93 insertions(+), 52 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc fffe3a25adab41d44943ed1be0191cf570d3e154 From git at git.haskell.org Wed May 18 20:00:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 18 May 2016 20:00:03 +0000 (UTC) Subject: [commit: ghc] master: Fix histograms for ticky code (f0f0ac8) Message-ID: <20160518200003.0DC963A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f0f0ac859257a0b528815adb61d3f024c8bafa16/ghc >--------------------------------------------------------------- commit f0f0ac859257a0b528815adb61d3f024c8bafa16 Author: Mateusz Lenik Date: Tue May 17 08:33:54 2016 +0200 Fix histograms for ticky code This patch fixes Cmm generation required to produce histograms when compiling with -ticky flag, strips dead code from rts/Ticky.c and reworks it to use a shared constant in both C and Haskell code. Fixes #8308. Test Plan: T8308 Reviewers: jstolarek, simonpj, austin Reviewed By: simonpj Subscribers: mpickering, simonpj, bgamari, mlen, thomie, jstolarek Differential Revision: https://phabricator.haskell.org/D931 GHC Trac Issues: #8308 >--------------------------------------------------------------- f0f0ac859257a0b528815adb61d3f024c8bafa16 compiler/codeGen/StgCmmExpr.hs | 1 + compiler/codeGen/StgCmmTicky.hs | 38 +-- includes/stg/Ticky.h | 11 +- rts/RtsSymbols.c | 5 +- rts/Ticky.c | 298 ++------------------- testsuite/tests/rts/T8308/Makefile | 10 + testsuite/tests/rts/T8308/T8308.hs | 7 + .../T5149.stdout => rts/T8308/T8308.stdout} | 0 testsuite/tests/rts/T8308/all.T | 2 + utils/deriveConstants/Main.hs | 3 + 10 files changed, 74 insertions(+), 301 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc f0f0ac859257a0b528815adb61d3f024c8bafa16 From git at git.haskell.org Wed May 18 20:00:05 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 18 May 2016 20:00:05 +0000 (UTC) Subject: [commit: ghc] master: Add a test for #11108 (ba3e1fd) Message-ID: <20160518200005.EB90C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ba3e1fd37dc5004c4307ed205f6701b16faceb59/ghc >--------------------------------------------------------------- commit ba3e1fd37dc5004c4307ed205f6701b16faceb59 Author: Ben Gamari Date: Tue May 17 19:03:16 2016 +0200 Add a test for #11108 Reviewers: austin, simonmar, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2196 GHC Trac Issues: #11108 >--------------------------------------------------------------- ba3e1fd37dc5004c4307ed205f6701b16faceb59 testsuite/tests/rts/T11108.hs | 77 +++++++++++++++++++++++++++++++++++++++++++ testsuite/tests/rts/all.T | 2 ++ 2 files changed, 79 insertions(+) diff --git a/testsuite/tests/rts/T11108.hs b/testsuite/tests/rts/T11108.hs new file mode 100644 index 0000000..d70f333 --- /dev/null +++ b/testsuite/tests/rts/T11108.hs @@ -0,0 +1,77 @@ +{-# LANGUAGE RecursiveDo, LambdaCase #-} + +import Control.Monad.Fix +import Data.IORef +import System.Mem.Weak +import System.Mem + +import Control.Monad +import Data.Foldable + +data Pull = Pull + { weakSelf :: Weak Pull + , compute :: Weak Pull -> IO Int + , invalidators :: IORef [Weak Pull] + , cached :: IORef (Maybe Int) + } + + +makePull :: (Weak Pull -> IO Int) -> IO Pull +makePull f = do + rec + -- This seems to be the culprit, changing the order makes the weakRef get gc'ed + -- In this configuration it crashes + + foo <- Pull weak f <$> newIORef [] <*> newIORef Nothing + weak <- mkWeakPtr foo (Just $ print "died") + + return foo + + +invalidate :: Pull -> IO () +invalidate p = do + writeIORef (cached p) Nothing + invs <- readIORef (invalidators p) + writeIORef (invalidators p) [] + traverse_ (deRefWeak >=> traverse_ invalidate) invs + + +pull :: Weak Pull -> Pull -> IO Int +pull weak p = do + modifyIORef (invalidators p) (weak :) + pull' p + +pull' :: Pull -> IO Int +pull' p = do + readIORef (cached p) >>= \case + Nothing -> do + r <- compute p (weakSelf p) + writeIORef (cached p) (Just r) + return r + + Just r -> return r + +add :: Pull -> Int -> IO (Pull) +add p n = makePull (\w -> (+n) <$> pull w p) + +main = do + h <- newIORef 0 + + source <- makePull (const $ readIORef h) + p <- foldM add source (take 1000 (repeat 1)) -- 100 is not enough for crash + + forM_ [1..10] $ \i -> do + + writeIORef h i + invalidate source -- Crashes here on second iteration + + --performGC + -- This avoids the crash + + print =<< pull' p + + + + + + diff --git a/testsuite/tests/rts/all.T b/testsuite/tests/rts/all.T index 720ebfb..d462e39 100644 --- a/testsuite/tests/rts/all.T +++ b/testsuite/tests/rts/all.T @@ -260,6 +260,8 @@ test('T9078', [ omit_ways(threaded_ways) ], compile_and_run, ['-with-rtsopts="-D test('T10017', [ when(opsys('mingw32'), skip) , only_ways(threaded_ways), extra_run_opts('+RTS -N2 -RTS') ], compile_and_run, ['']) +test('T11108', normal, compile_and_run, ['']) + test('rdynamic', [ unless(opsys('linux') or opsys('mingw32'), skip) # this needs runtime infrastructure to do in ghci: # '-rdynamic' ghc, load modules only via dlopen(RTLD_BLOBAL) and more. From git at git.haskell.org Wed May 18 20:00:09 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 18 May 2016 20:00:09 +0000 (UTC) Subject: [commit: ghc] master: Rework parser to allow use with DynFlags (39a2faa) Message-ID: <20160518200009.0BE0D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/39a2faa05fbbdb4a5ef0682afc42b5809cbd86ce/ghc >--------------------------------------------------------------- commit 39a2faa05fbbdb4a5ef0682afc42b5809cbd86ce Author: Dave Laing Date: Tue May 17 19:03:41 2016 +0200 Rework parser to allow use with DynFlags Split out the options needed by the parser from DynFlags, making the parser more friendly to standalone usage. Test Plan: validate Reviewers: simonmar, alanz, bgamari, austin, thomie Reviewed By: simonmar, alanz, bgamari, thomie Subscribers: thomie, mpickering Differential Revision: https://phabricator.haskell.org/D2208 GHC Trac Issues: #10961 >--------------------------------------------------------------- 39a2faa05fbbdb4a5ef0682afc42b5809cbd86ce compiler/cmm/CmmLex.x | 41 +++++----- compiler/cmm/CmmMonad.hs | 58 +++++++++++++++ compiler/cmm/CmmParse.y | 43 +++++------ compiler/ghc.cabal.in | 1 + compiler/main/GHC.hs | 2 +- compiler/main/HeaderInfo.hs | 2 +- compiler/main/HscMain.hs | 4 +- compiler/parser/Lexer.x | 177 +++++++++++++++++++++++++++----------------- compiler/parser/Parser.y | 4 +- compiler/parser/RdrHsSyn.hs | 9 +-- 10 files changed, 222 insertions(+), 119 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 39a2faa05fbbdb4a5ef0682afc42b5809cbd86ce From git at git.haskell.org Wed May 18 20:00:11 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 18 May 2016 20:00:11 +0000 (UTC) Subject: [commit: ghc] master: CLabel: Catch #11155 during C-- pretty-printing (f091218) Message-ID: <20160518200011.A8D793A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f091218ae14a24f9dbd991794c2da6377364578b/ghc >--------------------------------------------------------------- commit f091218ae14a24f9dbd991794c2da6377364578b Author: Ben Gamari Date: Tue May 17 19:16:30 2016 +0200 CLabel: Catch #11155 during C-- pretty-printing In #11555 we ended up generating references to the non-existence stg_ap_0_upd. Here we add asserts to verify that we don't generate references to non-existent selector or application symbols. It would likely also make sense to add further asserts during code generation, so we can catch the issue even closer to its source. Test Plan: Validate Reviewers: simonmar, austin, ezyang Reviewed By: simonmar, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2230 GHC Trac Issues: #11155 >--------------------------------------------------------------- f091218ae14a24f9dbd991794c2da6377364578b compiler/cmm/CLabel.hs | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/compiler/cmm/CLabel.hs b/compiler/cmm/CLabel.hs index bb5be5d..df00203 100644 --- a/compiler/cmm/CLabel.hs +++ b/compiler/cmm/CLabel.hs @@ -6,6 +6,8 @@ -- ----------------------------------------------------------------------------- +{-# LANGUAGE CPP #-} + module CLabel ( CLabel, -- abstract type ForeignLabelSource(..), @@ -113,6 +115,8 @@ module CLabel ( pprCLabel ) where +#include "HsVersions.h" + import IdInfo import BasicTypes import Packages @@ -127,6 +131,7 @@ import FastString import DynFlags import Platform import UniqSet +import Util import PprCore ( {- instances -} ) -- ----------------------------------------------------------------------------- @@ -1062,28 +1067,36 @@ pprCLbl (CmmLabel _ str CmmPrimCall) = ftext str pprCLbl (RtsLabel (RtsApFast str)) = ftext str <> text "_fast" pprCLbl (RtsLabel (RtsSelectorInfoTable upd_reqd offset)) - = hcat [text "stg_sel_", text (show offset), + = sdocWithDynFlags $ \dflags -> + ASSERT(offset >= 0 && offset <= mAX_SPEC_SELECTEE_SIZE dflags) + hcat [text "stg_sel_", text (show offset), ptext (if upd_reqd then (sLit "_upd_info") else (sLit "_noupd_info")) ] pprCLbl (RtsLabel (RtsSelectorEntry upd_reqd offset)) - = hcat [text "stg_sel_", text (show offset), + = sdocWithDynFlags $ \dflags -> + ASSERT(offset >= 0 && offset <= mAX_SPEC_SELECTEE_SIZE dflags) + hcat [text "stg_sel_", text (show offset), ptext (if upd_reqd then (sLit "_upd_entry") else (sLit "_noupd_entry")) ] pprCLbl (RtsLabel (RtsApInfoTable upd_reqd arity)) - = hcat [text "stg_ap_", text (show arity), + = sdocWithDynFlags $ \dflags -> + ASSERT(arity > 0 && arity <= mAX_SPEC_AP_SIZE dflags) + hcat [text "stg_ap_", text (show arity), ptext (if upd_reqd then (sLit "_upd_info") else (sLit "_noupd_info")) ] pprCLbl (RtsLabel (RtsApEntry upd_reqd arity)) - = hcat [text "stg_ap_", text (show arity), + = sdocWithDynFlags $ \dflags -> + ASSERT(arity > 0 && arity <= mAX_SPEC_AP_SIZE dflags) + hcat [text "stg_ap_", text (show arity), ptext (if upd_reqd then (sLit "_upd_entry") else (sLit "_noupd_entry")) From git at git.haskell.org Wed May 18 20:00:14 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 18 May 2016 20:00:14 +0000 (UTC) Subject: [commit: ghc] master: Add (broken) test for #12063. (9dd0481) Message-ID: <20160518200014.9415A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9dd04810b2ed51a5a4db9356858b7233329d6a45/ghc >--------------------------------------------------------------- commit 9dd04810b2ed51a5a4db9356858b7233329d6a45 Author: Edward Z. Yang Date: Sun May 15 16:29:35 2016 -0700 Add (broken) test for #12063. Signed-off-by: Edward Z. Yang Test Plan: validate Reviewers: austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2222 GHC Trac Issues: #12063 >--------------------------------------------------------------- 9dd04810b2ed51a5a4db9356858b7233329d6a45 testsuite/tests/typecheck/should_fail/T12063.hs | 4 ++++ testsuite/tests/typecheck/should_fail/T12063.hs-boot | 2 ++ testsuite/tests/typecheck/should_fail/T12063a.hs | 3 +++ testsuite/tests/typecheck/should_fail/all.T | 2 ++ 4 files changed, 11 insertions(+) diff --git a/testsuite/tests/typecheck/should_fail/T12063.hs b/testsuite/tests/typecheck/should_fail/T12063.hs new file mode 100644 index 0000000..548dd4e --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T12063.hs @@ -0,0 +1,4 @@ +module T12063 where +import T12063a +x :: S +x = undefined diff --git a/testsuite/tests/typecheck/should_fail/T12063.hs-boot b/testsuite/tests/typecheck/should_fail/T12063.hs-boot new file mode 100644 index 0000000..f740af2 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T12063.hs-boot @@ -0,0 +1,2 @@ +module T12063 where +data T diff --git a/testsuite/tests/typecheck/should_fail/T12063a.hs b/testsuite/tests/typecheck/should_fail/T12063a.hs new file mode 100644 index 0000000..f622acf --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T12063a.hs @@ -0,0 +1,3 @@ +module T12063a where +import {-# SOURCE #-} T12063 +type S = T diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index 6519768..bfae69b 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -418,3 +418,5 @@ test('T11947a', normal, compile_fail, ['']) test('T11948', normal, compile_fail, ['']) test('T11990a', normal, compile_fail, ['']) test('T11990b', normal, compile_fail, ['']) +test('T12063', [ expect_broken(12063), extra_clean(['T12063.hi-boot', 'T12063.o-boot', 'T12063a.hi', 'T12063a.o']) ], + multimod_compile_fail, ['T12063', '-v0']) From git at git.haskell.org Wed May 18 20:00:17 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 18 May 2016 20:00:17 +0000 (UTC) Subject: [commit: ghc] master: rts: Add isPinnedByteArray# primop (310371f) Message-ID: <20160518200017.A52153A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/310371ff2d5b73cdcb2439b67170ca5e613541c0/ghc >--------------------------------------------------------------- commit 310371ff2d5b73cdcb2439b67170ca5e613541c0 Author: Ben Gamari Date: Tue May 17 19:05:26 2016 +0200 rts: Add isPinnedByteArray# primop Adds a primitive operation to determine whether a particular `MutableByteArray#` is backed by a pinned buffer. Test Plan: Validate with included testcase Reviewers: austin, simonmar Reviewed By: austin, simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2217 GHC Trac Issues: #12059 >--------------------------------------------------------------- 310371ff2d5b73cdcb2439b67170ca5e613541c0 compiler/prelude/primops.txt.pp | 5 ++++ docs/users_guide/8.2.1-notes.rst | 2 ++ includes/stg/MiscClosures.h | 1 + libraries/ghc-prim/changelog.md | 10 ++++++++ rts/PrimOps.cmm | 11 +++++++++ rts/RtsSymbols.c | 1 + testsuite/tests/codeGen/should_run/T12059.hs | 27 ++++++++++++++++++++++ .../should_run/T12059.stdout} | 2 +- testsuite/tests/codeGen/should_run/all.T | 1 + utils/deriveConstants/Main.hs | 1 + 10 files changed, 60 insertions(+), 1 deletion(-) diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp index d481d1a..53bc8a4 100644 --- a/compiler/prelude/primops.txt.pp +++ b/compiler/prelude/primops.txt.pp @@ -1077,6 +1077,11 @@ primop NewAlignedPinnedByteArrayOp_Char "newAlignedPinnedByteArray#" GenPrimOp with out_of_line = True has_side_effects = True +primop ByteArrayIsPinnedOp "isPinnedByteArray#" GenPrimOp + MutableByteArray# s -> Int# + {Determine whether a {\tt MutableByteArray\#} is guaranteed not to move.} + with out_of_line = True + primop ByteArrayContents_Char "byteArrayContents#" GenPrimOp ByteArray# -> Addr# {Intended for use with pinned arrays; otherwise very unsafe!} diff --git a/docs/users_guide/8.2.1-notes.rst b/docs/users_guide/8.2.1-notes.rst index 957552b..b52f0ed 100644 --- a/docs/users_guide/8.2.1-notes.rst +++ b/docs/users_guide/8.2.1-notes.rst @@ -127,6 +127,8 @@ ghc-prim - Version number XXXXX (was 0.3.1.0) +- Added new ``isPinnedbyteArray#`` operation. + haskell98 ~~~~~~~~~ diff --git a/includes/stg/MiscClosures.h b/includes/stg/MiscClosures.h index 3fd4128..337f586 100644 --- a/includes/stg/MiscClosures.h +++ b/includes/stg/MiscClosures.h @@ -347,6 +347,7 @@ RTS_FUN_DECL(stg_casArrayzh); RTS_FUN_DECL(stg_newByteArrayzh); RTS_FUN_DECL(stg_newPinnedByteArrayzh); RTS_FUN_DECL(stg_newAlignedPinnedByteArrayzh); +RTS_FUN_DECL(stg_isPinnedByteArrayzh); RTS_FUN_DECL(stg_shrinkMutableByteArrayzh); RTS_FUN_DECL(stg_resizzeMutableByteArrayzh); RTS_FUN_DECL(stg_casIntArrayzh); diff --git a/libraries/ghc-prim/changelog.md b/libraries/ghc-prim/changelog.md index 45daa64..0c9ca42 100644 --- a/libraries/ghc-prim/changelog.md +++ b/libraries/ghc-prim/changelog.md @@ -1,5 +1,15 @@ +## 0.6.0.0 + +- Shipped with GHC 8.2.1 + +- Added to `GHC.Prim`: + + isPinnedByteArray# :: MutableByteArray# s -> Int# + ## 0.5.0.0 +- Shipped with GHC 8.0.1 + - `GHC.Classes`: new `class IP (a :: Symbol) b | a -> b` - `GHC.Prim`: changed type signatures from diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm index a802e67..a8e2a1b 100644 --- a/rts/PrimOps.cmm +++ b/rts/PrimOps.cmm @@ -141,6 +141,17 @@ stg_newAlignedPinnedByteArrayzh ( W_ n, W_ alignment ) return (p); } +stg_isPinnedByteArrayzh ( gcptr mba ) +// MutableByteArray# s -> Int# +{ + W_ bd, flags; + bd = Bdescr(mba); + // pinned byte arrays live in blocks with the BF_PINNED flag set. + // See the comment in Storage.c:allocatePinned. + flags = TO_W_(bdescr_flags(bd)); + return (flags & BF_PINNED != 0); +} + // shrink size of MutableByteArray in-place stg_shrinkMutableByteArrayzh ( gcptr mba, W_ new_size ) // MutableByteArray# s -> Int# -> State# s -> State# s diff --git a/rts/RtsSymbols.c b/rts/RtsSymbols.c index 11bc0e6..f420c01 100644 --- a/rts/RtsSymbols.c +++ b/rts/RtsSymbols.c @@ -514,6 +514,7 @@ SymI_HasProto(stg_casMutVarzh) \ SymI_HasProto(stg_newPinnedByteArrayzh) \ SymI_HasProto(stg_newAlignedPinnedByteArrayzh) \ + SymI_HasProto(stg_isPinnedByteArrayzh) \ SymI_HasProto(stg_shrinkMutableByteArrayzh) \ SymI_HasProto(stg_resizzeMutableByteArrayzh) \ SymI_HasProto(newSpark) \ diff --git a/testsuite/tests/codeGen/should_run/T12059.hs b/testsuite/tests/codeGen/should_run/T12059.hs new file mode 100644 index 0000000..0b99bd3 --- /dev/null +++ b/testsuite/tests/codeGen/should_run/T12059.hs @@ -0,0 +1,27 @@ +{-# LANGUAGE MagicHash #-} +{-# LANGUAGE UnboxedTuples #-} + +-- Test the function of the isPinnedByteArray# primop + +import GHC.Exts +import GHC.IO + +main :: IO () +main = do + r <- IO $ \s0 -> + case newByteArray# 1024# s0 of + (# s1, mba #) -> + (# s1, isTrue# (isPinnedByteArray# mba) #) + print r + + r <- IO $ \s0 -> + case newPinnedByteArray# 1024# s0 of + (# s1, mba #) -> + (# s1, isTrue# (isPinnedByteArray# mba) #) + print r + + r <- IO $ \s0 -> + case newAlignedPinnedByteArray# 1024# 16# s0 of + (# s1, mba #) -> + (# s1, isTrue# (isPinnedByteArray# mba) #) + print r diff --git a/testsuite/tests/overloadedrecflds/should_run/overloadedlabelsrun01.stdout b/testsuite/tests/codeGen/should_run/T12059.stdout similarity index 100% copy from testsuite/tests/overloadedrecflds/should_run/overloadedlabelsrun01.stdout copy to testsuite/tests/codeGen/should_run/T12059.stdout index 4644fbc..70cea9e 100644 --- a/testsuite/tests/overloadedrecflds/should_run/overloadedlabelsrun01.stdout +++ b/testsuite/tests/codeGen/should_run/T12059.stdout @@ -1,3 +1,3 @@ -True False True +True diff --git a/testsuite/tests/codeGen/should_run/all.T b/testsuite/tests/codeGen/should_run/all.T index 1175f22..921f2c3 100644 --- a/testsuite/tests/codeGen/should_run/all.T +++ b/testsuite/tests/codeGen/should_run/all.T @@ -140,3 +140,4 @@ test('T10521b', normal, compile_and_run, ['']) test('T10870', when(wordsize(32), skip), compile_and_run, ['']) test('PopCnt', omit_ways(['ghci']), multi_compile_and_run, ['PopCnt', [('PopCnt_cmm.cmm', '')], '']) +test('T12059', normal, compile_and_run, ['']) diff --git a/utils/deriveConstants/Main.hs b/utils/deriveConstants/Main.hs index 16f3255..63e2233 100644 --- a/utils/deriveConstants/Main.hs +++ b/utils/deriveConstants/Main.hs @@ -391,6 +391,7 @@ wanteds os = concat ,structField Both "bdescr" "blocks" ,structField C "bdescr" "gen_no" ,structField C "bdescr" "link" + ,structField C "bdescr" "flags" ,structSize C "generation" ,structField C "generation" "n_new_large_words" From git at git.haskell.org Wed May 18 20:00:20 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 18 May 2016 20:00:20 +0000 (UTC) Subject: [commit: ghc] master: Failing test case for #12076. (5f1557e) Message-ID: <20160518200020.DCB1A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5f1557eea2c1a5cf09321d9dc01070b6c068e2fa/ghc >--------------------------------------------------------------- commit 5f1557eea2c1a5cf09321d9dc01070b6c068e2fa Author: Edward Z. Yang Date: Mon May 16 21:05:24 2016 -0700 Failing test case for #12076. Signed-off-by: Edward Z. Yang Test Plan: validate Reviewers: austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2229 GHC Trac Issues: #12076 >--------------------------------------------------------------- 5f1557eea2c1a5cf09321d9dc01070b6c068e2fa testsuite/tests/simplCore/should_compile/T12076.hs | 2 ++ testsuite/tests/simplCore/should_compile/T12076a.hs | 15 +++++++++++++++ testsuite/tests/simplCore/should_compile/all.T | 2 ++ 3 files changed, 19 insertions(+) diff --git a/testsuite/tests/simplCore/should_compile/T12076.hs b/testsuite/tests/simplCore/should_compile/T12076.hs new file mode 100644 index 0000000..8b35039 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T12076.hs @@ -0,0 +1,2 @@ +import T12076a +main = f `seq` return () diff --git a/testsuite/tests/simplCore/should_compile/T12076a.hs b/testsuite/tests/simplCore/should_compile/T12076a.hs new file mode 100644 index 0000000..2e5acc9 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T12076a.hs @@ -0,0 +1,15 @@ +{-# OPTIONS_GHC -O0 #-} +module T12076a(f) where + +import GHC.Exts + +{-# NOINLINE z #-} +z = () + +f :: () -> () +f _ = let x = lazy z + in g x x + +{-# NOINLINE g #-} +g :: () -> () -> () +g _ _ = () diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index 0e03b16..b1b7d64 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -236,3 +236,5 @@ test('T3990', normal, run_command, ['$MAKE -s --no-print-directory T3990']) + +test('T12076', [expect_broken(12076), extra_clean(['T12076a.hi', 'T12076a.o'])], multimod_compile, ['T12076', '-v0']) From git at git.haskell.org Wed May 18 20:54:53 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 18 May 2016 20:54:53 +0000 (UTC) Subject: [commit: ghc] master: rts: Add missing `const` from HashTable API (f18e8d8) Message-ID: <20160518205453.E39BB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f18e8d8db6246340c8840bd0ca2c43767009f14c/ghc >--------------------------------------------------------------- commit f18e8d8db6246340c8840bd0ca2c43767009f14c Author: Erik de Castro Lopo Date: Thu May 19 06:19:24 2016 +1000 rts: Add missing `const` from HashTable API Thanks to Tamar Christina (Phyx) for spotting this. Test Plan: Validate Reviewers: simonmar, austin, trofi, bgamari, hsyl20, Phyx Reviewed By: Phyx Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2236 >--------------------------------------------------------------- f18e8d8db6246340c8840bd0ca2c43767009f14c rts/Hash.c | 2 +- rts/Hash.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rts/Hash.c b/rts/Hash.c index 1b193e3..1f8c0ca 100644 --- a/rts/Hash.c +++ b/rts/Hash.c @@ -303,7 +303,7 @@ insertHashTable(HashTable *table, StgWord key, const void *data) } void * -removeHashTable(HashTable *table, StgWord key, void *data) +removeHashTable(HashTable *table, StgWord key, const void *data) { int bucket; int segment; diff --git a/rts/Hash.h b/rts/Hash.h index 2d0c558..ebefd6f 100644 --- a/rts/Hash.h +++ b/rts/Hash.h @@ -22,7 +22,7 @@ typedef struct hashtable HashTable; /* abstract */ HashTable * allocHashTable ( void ); void insertHashTable ( HashTable *table, StgWord key, const void *data ); void * lookupHashTable ( const HashTable *table, StgWord key ); -void * removeHashTable ( HashTable *table, StgWord key, void *data ); +void * removeHashTable ( HashTable *table, StgWord key, const void *data ); int keyCountHashTable (HashTable *table); From git at git.haskell.org Wed May 18 23:42:08 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 18 May 2016 23:42:08 +0000 (UTC) Subject: [commit: ghc] master: Kill varSetElems in tidyFreeTyCoVars (6282bc3) Message-ID: <20160518234208.8A1C23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6282bc31808e335cd8386dd20d469bc2457f84de/ghc >--------------------------------------------------------------- commit 6282bc31808e335cd8386dd20d469bc2457f84de Author: Bartosz Nitka Date: Wed May 18 10:36:49 2016 -0700 Kill varSetElems in tidyFreeTyCoVars I haven't observed this to have an effect on nondeterminism, but tidyOccName appears to modify the TidyOccEnv in a way dependent on the order of inputs. It's easy enough to change it to be deterministic to be on the safe side. Test Plan: ./validate Reviewers: simonmar, austin, bgamari, simonpj Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2238 GHC Trac Issues: #4012 >--------------------------------------------------------------- 6282bc31808e335cd8386dd20d469bc2457f84de compiler/typecheck/TcErrors.hs | 8 +- compiler/typecheck/TcRnMonad.hs | 2 +- compiler/typecheck/TcValidity.hs | 8 +- compiler/types/TyCoRep.hs | 8 +- .../tests/indexed-types/should_fail/T2693.stderr | 4 +- .../should_fail/overloadedlabelsfail01.stderr | 46 ++-- testsuite/tests/parser/should_fail/T7848.stderr | 4 +- testsuite/tests/rename/should_fail/T10618.stderr | 2 +- .../tests/typecheck/should_fail/T11355.stderr | 2 +- testsuite/tests/typecheck/should_fail/T5684.stderr | 286 ++++++++++----------- testsuite/tests/typecheck/should_fail/T7851.stderr | 4 +- .../tests/typecheck/should_fail/tcfail001.stderr | 2 +- 12 files changed, 188 insertions(+), 188 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 6282bc31808e335cd8386dd20d469bc2457f84de From git at git.haskell.org Thu May 19 00:19:59 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 19 May 2016 00:19:59 +0000 (UTC) Subject: [commit: ghc] master: Kill varEnvElts in tcPragExpr (13e40f9) Message-ID: <20160519001959.85EF93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/13e40f998e15a626a4212bde0987ddbc98b3f56f/ghc >--------------------------------------------------------------- commit 13e40f998e15a626a4212bde0987ddbc98b3f56f Author: Bartosz Nitka Date: Wed May 18 16:47:29 2016 -0700 Kill varEnvElts in tcPragExpr I had to refactor some things to take VarSet instead of [Var], but I think it's more precise this way. Test Plan: ./validate Reviewers: simonmar, simonpj, austin, bgamari, goldfire Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2227 GHC Trac Issues: #4012 >--------------------------------------------------------------- 13e40f998e15a626a4212bde0987ddbc98b3f56f compiler/coreSyn/CoreLint.hs | 10 ++++++++-- compiler/iface/IfaceEnv.hs | 16 ++++++++-------- compiler/iface/TcIface.hs | 13 +++++++++---- compiler/typecheck/TcRnMonad.hs | 5 ++--- compiler/typecheck/TcRnTypes.hs | 4 ++-- 5 files changed, 29 insertions(+), 19 deletions(-) diff --git a/compiler/coreSyn/CoreLint.hs b/compiler/coreSyn/CoreLint.hs index 2a2284b..0261f7e 100644 --- a/compiler/coreSyn/CoreLint.hs +++ b/compiler/coreSyn/CoreLint.hs @@ -428,7 +428,7 @@ We use this to check all unfoldings that come in from interfaces lintUnfolding :: DynFlags -> SrcLoc - -> [Var] -- Treat these as in scope + -> VarSet -- Treat these as in scope -> CoreExpr -> Maybe MsgDoc -- Nothing => OK @@ -438,7 +438,7 @@ lintUnfolding dflags locn vars expr where (_warns, errs) = initL dflags defaultLintFlags linter linter = addLoc (ImportedUnfolding locn) $ - addInScopeVars vars $ + addInScopeVarSet vars $ lintCoreExpr expr lintExpr :: DynFlags @@ -1778,6 +1778,12 @@ addInScopeVars vars m unLintM m (env { le_subst = extendTCvInScopeList (le_subst env) vars }) errs +addInScopeVarSet :: VarSet -> LintM a -> LintM a +addInScopeVarSet vars m + = LintM $ \ env errs -> + unLintM m (env { le_subst = extendTCvInScopeSet (le_subst env) vars }) + errs + addInScopeVar :: Var -> LintM a -> LintM a addInScopeVar var m = LintM $ \ env errs -> diff --git a/compiler/iface/IfaceEnv.hs b/compiler/iface/IfaceEnv.hs index 20b497b..0c8d8e9 100644 --- a/compiler/iface/IfaceEnv.hs +++ b/compiler/iface/IfaceEnv.hs @@ -30,8 +30,8 @@ import Var import Name import Avail import Module -import UniqFM import FastString +import FastStringEnv import IfaceType import UniqSupply import SrcLoc @@ -259,7 +259,7 @@ initOrigNames names = foldl extendOrigNameCache emptyModuleEnv names tcIfaceLclId :: FastString -> IfL Id tcIfaceLclId occ = do { lcl <- getLclEnv - ; case (lookupUFM (if_id_env lcl) occ) of + ; case (lookupFsEnv (if_id_env lcl) occ) of Just ty_var -> return ty_var Nothing -> failIfM (text "Iface id out of scope: " <+> ppr occ) } @@ -267,7 +267,7 @@ tcIfaceLclId occ extendIfaceIdEnv :: [Id] -> IfL a -> IfL a extendIfaceIdEnv ids thing_inside = do { env <- getLclEnv - ; let { id_env' = addListToUFM (if_id_env env) pairs + ; let { id_env' = extendFsEnvList (if_id_env env) pairs ; pairs = [(occNameFS (getOccName id), id) | id <- ids] } ; setLclEnv (env { if_id_env = id_env' }) thing_inside } @@ -275,7 +275,7 @@ extendIfaceIdEnv ids thing_inside tcIfaceTyVar :: FastString -> IfL TyVar tcIfaceTyVar occ = do { lcl <- getLclEnv - ; case (lookupUFM (if_tv_env lcl) occ) of + ; case (lookupFsEnv (if_tv_env lcl) occ) of Just ty_var -> return ty_var Nothing -> failIfM (text "Iface type variable out of scope: " <+> ppr occ) } @@ -283,20 +283,20 @@ tcIfaceTyVar occ lookupIfaceTyVar :: IfaceTvBndr -> IfL (Maybe TyVar) lookupIfaceTyVar (occ, _) = do { lcl <- getLclEnv - ; return (lookupUFM (if_tv_env lcl) occ) } + ; return (lookupFsEnv (if_tv_env lcl) occ) } lookupIfaceVar :: IfaceBndr -> IfL (Maybe TyCoVar) lookupIfaceVar (IfaceIdBndr (occ, _)) = do { lcl <- getLclEnv - ; return (lookupUFM (if_id_env lcl) occ) } + ; return (lookupFsEnv (if_id_env lcl) occ) } lookupIfaceVar (IfaceTvBndr (occ, _)) = do { lcl <- getLclEnv - ; return (lookupUFM (if_tv_env lcl) occ) } + ; return (lookupFsEnv (if_tv_env lcl) occ) } extendIfaceTyVarEnv :: [TyVar] -> IfL a -> IfL a extendIfaceTyVarEnv tyvars thing_inside = do { env <- getLclEnv - ; let { tv_env' = addListToUFM (if_tv_env env) pairs + ; let { tv_env' = extendFsEnvList (if_tv_env env) pairs ; pairs = [(occNameFS (getOccName tv), tv) | tv <- tyvars] } ; setLclEnv (env { if_tv_env = tv_env' }) thing_inside } diff --git a/compiler/iface/TcIface.hs b/compiler/iface/TcIface.hs index 9a4a5c7..8bc0dd1 100644 --- a/compiler/iface/TcIface.hs +++ b/compiler/iface/TcIface.hs @@ -1277,7 +1277,7 @@ tcPragExpr name expr where doc = text "Unfolding of" <+> ppr name - get_in_scope :: IfL [Var] -- Totally disgusting; but just for linting + get_in_scope :: IfL VarSet -- Totally disgusting; but just for linting get_in_scope = do { (gbl_env, lcl_env) <- getEnvs ; rec_ids <- case if_rec_types gbl_env of @@ -1285,9 +1285,14 @@ tcPragExpr name expr Just (_, get_env) -> do { type_env <- setLclEnv () get_env ; return (typeEnvIds type_env) } - ; return (varEnvElts (if_tv_env lcl_env) ++ - varEnvElts (if_id_env lcl_env) ++ - rec_ids) } + ; return (bindingsVars (if_tv_env lcl_env) `unionVarSet` + bindingsVars (if_id_env lcl_env) `unionVarSet` + mkVarSet rec_ids) } + + bindingsVars :: FastStringEnv Var -> VarSet + bindingsVars ufm = mkVarSet $ nonDetEltsUFM ufm + -- It's OK to use nonDetEltsUFM here because we immediately forget + -- the ordering by creating a set {- ************************************************************************ diff --git a/compiler/typecheck/TcRnMonad.hs b/compiler/typecheck/TcRnMonad.hs index c4e66a0..88c63f9 100644 --- a/compiler/typecheck/TcRnMonad.hs +++ b/compiler/typecheck/TcRnMonad.hs @@ -42,7 +42,6 @@ import NameSet import Bag import Outputable import UniqSupply -import UniqFM import DynFlags import StaticFlags import FastString @@ -1465,8 +1464,8 @@ setLocalRdrEnv rdr_env thing_inside mkIfLclEnv :: Module -> SDoc -> IfLclEnv mkIfLclEnv mod loc = IfLclEnv { if_mod = mod, if_loc = loc, - if_tv_env = emptyUFM, - if_id_env = emptyUFM } + if_tv_env = emptyFsEnv, + if_id_env = emptyFsEnv } -- | Run an 'IfG' (top-level interface monad) computation inside an existing -- 'TcRn' (typecheck-renaming monad) computation by initializing an 'IfGblEnv' diff --git a/compiler/typecheck/TcRnTypes.hs b/compiler/typecheck/TcRnTypes.hs index 3fd2a83..dede932 100644 --- a/compiler/typecheck/TcRnTypes.hs +++ b/compiler/typecheck/TcRnTypes.hs @@ -279,8 +279,8 @@ data IfLclEnv -- .hi file, or GHCi state, or ext core -- plus which bit is currently being examined - if_tv_env :: UniqFM TyVar, -- Nested tyvar bindings - if_id_env :: UniqFM Id -- Nested id binding + if_tv_env :: FastStringEnv TyVar, -- Nested tyvar bindings + if_id_env :: FastStringEnv Id -- Nested id binding } {- From git at git.haskell.org Thu May 19 09:20:08 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 19 May 2016 09:20:08 +0000 (UTC) Subject: [commit: ghc] wip/erikd/rts: rts: Add `-Wundef` to CFLAGS and fix warnings (4c1cb82) Message-ID: <20160519092008.E585F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/rts Link : http://ghc.haskell.org/trac/ghc/changeset/4c1cb823e6c76ee328b7815b74a632b8b1a06169/ghc >--------------------------------------------------------------- commit 4c1cb823e6c76ee328b7815b74a632b8b1a06169 Author: Erik de Castro Lopo Date: Wed May 18 20:04:26 2016 +1000 rts: Add `-Wundef` to CFLAGS and fix warnings >--------------------------------------------------------------- 4c1cb823e6c76ee328b7815b74a632b8b1a06169 includes/Stg.h | 8 ++--- includes/rts/OSThreads.h | 2 +- includes/rts/storage/InfoTables.h | 2 +- includes/stg/MachRegs.h | 2 +- includes/stg/SMP.h | 63 +++++++++++++++++++++------------------ rts/Adjustor.c | 3 ++ rts/Interpreter.c | 3 ++ rts/Linker.c | 12 ++++---- rts/LinkerInternals.h | 3 +- rts/OldARMAtomic.c | 2 +- rts/PrimOps.cmm | 4 +-- rts/RtsMessages.c | 4 +-- rts/Schedule.c | 16 +++++----- rts/Threads.c | 2 +- rts/Ticky.c | 6 ++-- rts/ghc.mk | 4 ++- rts/posix/GetTime.c | 2 +- rts/posix/OSMem.c | 8 ++--- rts/posix/OSThreads.c | 2 +- rts/sm/GCUtils.c | 2 +- rts/sm/GCUtils.h | 2 +- rts/sm/MBlock.c | 2 +- rts/sm/Storage.c | 3 ++ 23 files changed, 87 insertions(+), 70 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 4c1cb823e6c76ee328b7815b74a632b8b1a06169 From git at git.haskell.org Thu May 19 09:20:11 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 19 May 2016 09:20:11 +0000 (UTC) Subject: [commit: ghc] wip/erikd/rts's head updated: rts: Add `-Wundef` to CFLAGS and fix warnings (4c1cb82) Message-ID: <20160519092011.7B0EB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/erikd/rts' now includes: 770d708 Add ghc-boot-th to rules/foreachLibrary dc94914 Document determinism in shortOutIndirections 3f3dc23 Testsuite: run tests in /tmp after copying required files 1a9ae4b Testsuite: delete old cleanup code (#11980) a9dd9b7 Testsuite: delete unused file [skip ci] c92cfbc Testsuite: don't skip concio001 and concio001_thr 931b3c7 Delete libraries/ghci/GNUmakefile [skip ci] a54d87a rules: Fix name of ghc-boot-th library 5d80d14 rules/build-prog: Ensure programs depend upon their transitive deps 33c029d rts: More const correct-ness fixes b088c02 Testsuite: T10052 requires interpreter (#11730) 3251743 Testsuite: don't warn when mk/ghcconfig_* hasn't been created yet 77ee3a9 Update .mailmap [skip ci] fffe3a2 Make inert_model and inert_eqs deterministic sets f0f0ac8 Fix histograms for ticky code ba3e1fd Add a test for #11108 39a2faa Rework parser to allow use with DynFlags 310371f rts: Add isPinnedByteArray# primop f091218 CLabel: Catch #11155 during C-- pretty-printing 9dd0481 Add (broken) test for #12063. 5f1557e Failing test case for #12076. f18e8d8 rts: Add missing `const` from HashTable API 6282bc3 Kill varSetElems in tidyFreeTyCoVars 13e40f9 Kill varEnvElts in tcPragExpr 4c1cb82 rts: Add `-Wundef` to CFLAGS and fix warnings From git at git.haskell.org Thu May 19 11:15:36 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 19 May 2016 11:15:36 +0000 (UTC) Subject: [commit: ghc] wip/erikd/rts: rts: Add `-Wundef` to CFLAGS and fix warnings (39c9149) Message-ID: <20160519111536.1C3E33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/rts Link : http://ghc.haskell.org/trac/ghc/changeset/39c9149228d9aaa4da0e2407deaeb72c36b293b2/ghc >--------------------------------------------------------------- commit 39c9149228d9aaa4da0e2407deaeb72c36b293b2 Author: Erik de Castro Lopo Date: Wed May 18 20:04:26 2016 +1000 rts: Add `-Wundef` to CFLAGS and fix warnings >--------------------------------------------------------------- 39c9149228d9aaa4da0e2407deaeb72c36b293b2 includes/Stg.h | 8 ++--- includes/rts/OSThreads.h | 2 +- includes/rts/storage/InfoTables.h | 2 +- includes/stg/MachRegs.h | 2 +- includes/stg/SMP.h | 63 +++++++++++++++++++++------------------ rts/Adjustor.c | 3 ++ rts/Interpreter.c | 3 ++ rts/Linker.c | 12 ++++---- rts/LinkerInternals.h | 3 +- rts/OldARMAtomic.c | 2 +- rts/PrimOps.cmm | 4 +-- rts/RtsMessages.c | 4 +-- rts/Schedule.c | 16 +++++----- rts/Threads.c | 2 +- rts/Ticky.c | 8 ++--- rts/ghc.mk | 4 ++- rts/posix/GetTime.c | 2 +- rts/posix/OSMem.c | 8 ++--- rts/posix/OSThreads.c | 2 +- rts/sm/GCUtils.c | 2 +- rts/sm/GCUtils.h | 2 +- rts/sm/MBlock.c | 2 +- rts/sm/Storage.c | 3 ++ 23 files changed, 88 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 39c9149228d9aaa4da0e2407deaeb72c36b293b2 From git at git.haskell.org Thu May 19 11:20:36 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 19 May 2016 11:20:36 +0000 (UTC) Subject: [commit: ghc] wip/erikd/rts: rts: Add `-Wundef` to CFLAGS and fix warnings (57d1798) Message-ID: <20160519112036.73A453A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/rts Link : http://ghc.haskell.org/trac/ghc/changeset/57d17986023447fefc3a69b1e57c9da25aa856c4/ghc >--------------------------------------------------------------- commit 57d17986023447fefc3a69b1e57c9da25aa856c4 Author: Erik de Castro Lopo Date: Wed May 18 20:04:26 2016 +1000 rts: Add `-Wundef` to CFLAGS and fix warnings >--------------------------------------------------------------- 57d17986023447fefc3a69b1e57c9da25aa856c4 includes/Stg.h | 8 ++--- includes/rts/OSThreads.h | 2 +- includes/rts/storage/InfoTables.h | 2 +- includes/stg/MachRegs.h | 2 +- includes/stg/SMP.h | 63 +++++++++++++++++++++------------------ rts/Adjustor.c | 3 ++ rts/Interpreter.c | 3 ++ rts/Linker.c | 12 ++++---- rts/LinkerInternals.h | 3 +- rts/OldARMAtomic.c | 2 +- rts/PrimOps.cmm | 4 +-- rts/RtsMessages.c | 4 +-- rts/RtsUtils.c | 4 +-- rts/Schedule.c | 16 +++++----- rts/Threads.c | 2 +- rts/Ticky.c | 8 ++--- rts/ghc.mk | 4 ++- rts/posix/GetTime.c | 2 +- rts/posix/OSMem.c | 8 ++--- rts/posix/OSThreads.c | 2 +- rts/sm/GCUtils.c | 2 +- rts/sm/GCUtils.h | 2 +- rts/sm/MBlock.c | 2 +- rts/sm/Storage.c | 3 ++ 24 files changed, 90 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 57d17986023447fefc3a69b1e57c9da25aa856c4 From git at git.haskell.org Thu May 19 11:23:25 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 19 May 2016 11:23:25 +0000 (UTC) Subject: [commit: ghc] master: Improve documentation for type wildcards (f9e90bc) Message-ID: <20160519112325.8412B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f9e90bcb202b164189d71535eafbb39577682ff2/ghc >--------------------------------------------------------------- commit f9e90bcb202b164189d71535eafbb39577682ff2 Author: Simon Peyton Jones Date: Wed May 18 17:13:29 2016 +0100 Improve documentation for type wildcards This docmentation improvement was triggered by Trac #12072 >--------------------------------------------------------------- f9e90bcb202b164189d71535eafbb39577682ff2 docs/users_guide/glasgow_exts.rst | 60 ++++++++++++++++++++++++++++----------- 1 file changed, 43 insertions(+), 17 deletions(-) diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index 9e30e93..0e9b799 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -6065,15 +6065,6 @@ instance for ``GMap`` is :: In this example, the declaration has only one variant. In general, it can be any number. -When the name of a type argument of a data or newtype instance -declaration doesn't matter, it can be replaced with an underscore -(``_``). This is the same as writing a type variable with a unique name. :: - - data family F a b :: * - data instance F Int _ = Int - -- Equivalent to - data instance F Int b = Int - When the flag :ghc-flag:`-Wunused-type-patterns` is enabled, type variables that are mentioned in the patterns on the left hand side, but not used on the right hand side are reported. Variables that occur multiple times @@ -6439,6 +6430,37 @@ If the option :ghc-flag:`-XUndecidableInstances` is passed to the compiler, the above restrictions are not enforced and it is on the programmer to ensure termination of the normalisation of type families during type inference. +.. _type-wildcards-lhs: + +Wildcards on the LHS of data and type family instances +------------------------------------------------------ + +When the name of a type argument of a data or type instance +declaration doesn't matter, it can be replaced with an underscore +(``_``). This is the same as writing a type variable with a unique name. :: + + data family F a b :: * + data instance F Int _ = Int + -- Equivalent to data instance F Int b = Int + + type family T a :: * + type instance T (a,_) = a + -- Equivalent to type instance T (a,b) = a + +This use of underscore for wildcard in a type pattern is exactly like +pattern matching in the term language, but is rather different to the +use of a underscore in a partial type signature (see :ref:`type-wildcards`). + +A type variable beginning with an underscore is not treated specially in a +type or data instance declaration. For example: :: + + data instance F Bool _a = _a -> Int + -- Equivalent to data instance F Bool a = a -> Int + +Contrast this with the special treatment of named wildcards in +type signatures (:ref:`named-wildcards`). + + .. _assoc-decl: Associated data and type families @@ -9718,11 +9740,9 @@ Where can they occur? --------------------- Partial type signatures are allowed for bindings, pattern and expression -signatures. In all other contexts, e.g. type class or type family -declarations, they are disallowed. In the following example a wildcard -is used in each of the three possible contexts. Extra-constraints +signatures, except that extra-constraints wildcards are not supported in pattern or expression signatures. - +In the following example a wildcard is used in each of the three possible contexts. :: {-# LANGUAGE ScopedTypeVariables #-} @@ -9730,10 +9750,16 @@ wildcards are not supported in pattern or expression signatures. foo (x :: _) = (x :: _) -- Inferred: forall w_. w_ -> w_ -Anonymous and named wildcards *can* occur in type or data instance -declarations. However, these declarations are not partial type signatures -and different rules apply. See :ref:`data-instance-declarations` for more -details. +Anonymous and named wildcards *can* occur on the left hand side of a +type or data instance declaration; +see :ref:`type-wildcards-lhs`. + +In all other contexts, type wildcards are disallowed, and a named wildcard is treated +as an ordinary type variable. For example: :: + + class C _ where ... -- Illegal + instance Eq (T _) -- Illegal (currently; would actually make sense) + instance Eq _a => Eq (T _a) -- Perfectly fine, same as Eq a => Eq (T a) Partial type signatures can also be used in :ref:`template-haskell` splices. From git at git.haskell.org Thu May 19 11:23:28 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 19 May 2016 11:23:28 +0000 (UTC) Subject: [commit: ghc] master: Improve pretty-printing of equalities (ad7f122) Message-ID: <20160519112328.B45F23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ad7f12260e227e849b815f4959df0f886ecbe807/ghc >--------------------------------------------------------------- commit ad7f12260e227e849b815f4959df0f886ecbe807 Author: Simon Peyton Jones Date: Mon May 16 13:42:22 2016 +0100 Improve pretty-printing of equalities The previous pretty-printer didn't account for partially applied equalities, causing Trac #12041 >--------------------------------------------------------------- ad7f12260e227e849b815f4959df0f886ecbe807 compiler/types/TyCoRep.hs | 107 ++++++++++----------- .../tests/indexed-types/should_fail/T12041.hs | 12 +++ .../tests/indexed-types/should_fail/T12041.stderr | 7 ++ testsuite/tests/indexed-types/should_fail/all.T | 1 + 4 files changed, 70 insertions(+), 57 deletions(-) diff --git a/compiler/types/TyCoRep.hs b/compiler/types/TyCoRep.hs index 9f79243..b1ffccb 100644 --- a/compiler/types/TyCoRep.hs +++ b/compiler/types/TyCoRep.hs @@ -2971,12 +2971,14 @@ pprTcApp_help :: (a -> Type) -> TyPrec -> (TyPrec -> a -> SDoc) -> TyCon -> [a] -> DynFlags -> PprStyle -> SDoc -- This one has accss to the DynFlags pprTcApp_help to_type p pp tc tys dflags style - | is_equality - = print_equality - - | print_prefix + | not (isSymOcc (nameOccName tc_name)) -- Print prefix = pprPrefixApp p pp_tc (map (pp TyConPrec) tys_wo_kinds) + | Just args <- mb_saturated_equality + = print_equality args + + -- So we have an operator symbol of some kind + | [ty1,ty2] <- tys_wo_kinds -- Infix, two arguments; -- we know nothing of precedence though = pprInfixApp p pp pp_tc ty1 ty2 @@ -2986,66 +2988,57 @@ pprTcApp_help to_type p pp tc tys dflags style || tc_name `hasKey` unliftedTypeKindTyConKey = pp_tc -- Do not wrap *, # in parens - | otherwise + | otherwise -- Unsaturated operator = pprPrefixApp p (parens (pp_tc)) (map (pp TyConPrec) tys_wo_kinds) where - tc_name = tyConName tc + tc_name = tyConName tc + pp_tc = ppr tc + tys_wo_kinds = suppressInvisibles to_type dflags tc tys - is_equality = tc `hasKey` eqPrimTyConKey || - tc `hasKey` heqTyConKey || - tc `hasKey` eqReprPrimTyConKey || - tc `hasKey` eqTyConKey - -- don't include Coercible here, which should be printed - -- normally + mb_saturated_equality + | hetero_eq_tc + , [k1, k2, t1, t2] <- tys + = Just (k1, k2, t1, t2) + | homo_eq_tc + , [k, t1, t2] <- tys -- we must have (~) + = Just (k, k, t1, t2) + | otherwise + = Nothing + + homo_eq_tc = tc `hasKey` eqTyConKey -- ~ + hetero_eq_tc = tc `hasKey` eqPrimTyConKey -- ~# + || tc `hasKey` eqReprPrimTyConKey -- ~R# + || tc `hasKey` heqTyConKey -- ~~ -- This is all a bit ad-hoc, trying to print out the best representation -- of equalities. If you see a better design, go for it. - print_equality = case either_op_msg of - Left op -> - sep [ parens (pp TyOpPrec ty1 <+> dcolon <+> pp TyOpPrec ki1) - , op - , parens (pp TyOpPrec ty2 <+> dcolon <+> pp TyOpPrec ki2)] - Right msg -> - msg + + print_equality (ki1, ki2, ty1, ty2) + | print_eqs + = ppr_infix_eq pp_tc + + | hetero_eq_tc + , print_kinds || not (to_type ki1 `eqType` to_type ki2) + = ppr_infix_eq $ if tc `hasKey` eqPrimTyConKey + then text "~~" + else pp_tc + + | otherwise + = if tc `hasKey` eqReprPrimTyConKey + then text "Coercible" <+> (sep [ pp TyConPrec ty1 + , pp TyConPrec ty2 ]) + else sep [pp TyOpPrec ty1, text "~", pp TyOpPrec ty2] + where - hetero_tc = tc `hasKey` eqPrimTyConKey - || tc `hasKey` eqReprPrimTyConKey - || tc `hasKey` heqTyConKey - - print_kinds = gopt Opt_PrintExplicitKinds dflags - print_eqs = gopt Opt_PrintEqualityRelations dflags || - dumpStyle style || - debugStyle style - - (ki1, ki2, ty1, ty2) - | hetero_tc - , [k1, k2, t1, t2] <- tys - = (k1, k2, t1, t2) - | [k, t1, t2] <- tys -- we must have (~) - = (k, k, t1, t2) - | otherwise - = pprPanic "print_equality" pp_tc - - -- if "Left", print hetero equality; if "Right" just print that msg - either_op_msg - | print_eqs - = Left pp_tc - - | hetero_tc - , print_kinds || not (to_type ki1 `eqType` to_type ki2) - = Left $ if tc `hasKey` eqPrimTyConKey - then text "~~" - else pp_tc - - | otherwise - = Right $ if tc `hasKey` eqReprPrimTyConKey - then text "Coercible" <+> (sep [ pp TyConPrec ty1 - , pp TyConPrec ty2 ]) - else sep [pp TyOpPrec ty1, text "~", pp TyOpPrec ty2] - - print_prefix = not (isSymOcc (nameOccName tc_name)) - tys_wo_kinds = suppressInvisibles to_type dflags tc tys - pp_tc = ppr tc + ppr_infix_eq eq_op + = sep [ parens (pp TyOpPrec ty1 <+> dcolon <+> pp TyOpPrec ki1) + , eq_op + , parens (pp TyOpPrec ty2 <+> dcolon <+> pp TyOpPrec ki2)] + + print_kinds = gopt Opt_PrintExplicitKinds dflags + print_eqs = gopt Opt_PrintEqualityRelations dflags || + dumpStyle style || + debugStyle style ------------------ -- | Given a 'TyCon',and the args to which it is applied, diff --git a/testsuite/tests/indexed-types/should_fail/T12041.hs b/testsuite/tests/indexed-types/should_fail/T12041.hs new file mode 100644 index 0000000..9210280 --- /dev/null +++ b/testsuite/tests/indexed-types/should_fail/T12041.hs @@ -0,0 +1,12 @@ +{-# Language PolyKinds, TypeFamilies #-} + +module T12041 where + +import Data.Kind + +class Category (p :: i -> i -> Type) where + type Ob p :: i -> Constraint + +data I a b +instance Category I where + type Ob I = (~) Int diff --git a/testsuite/tests/indexed-types/should_fail/T12041.stderr b/testsuite/tests/indexed-types/should_fail/T12041.stderr new file mode 100644 index 0000000..006ca37 --- /dev/null +++ b/testsuite/tests/indexed-types/should_fail/T12041.stderr @@ -0,0 +1,7 @@ + +T12041.hs:12:15: error: + ? Expected kind ?i -> Constraint?, + but ?(~) Int? has kind ?* -> Constraint? + ? In the type ?(~) Int? + In the type instance declaration for ?Ob? + In the instance declaration for ?Category I? diff --git a/testsuite/tests/indexed-types/should_fail/all.T b/testsuite/tests/indexed-types/should_fail/all.T index dfc0326..041282e 100644 --- a/testsuite/tests/indexed-types/should_fail/all.T +++ b/testsuite/tests/indexed-types/should_fail/all.T @@ -140,3 +140,4 @@ test('T10899', normal, compile_fail, ['']) test('T11136', normal, compile_fail, ['']) test('T7788', normal, compile_fail, ['']) test('T11450', normal, compile_fail, ['']) +test('T12041', normal, compile_fail, ['']) From git at git.haskell.org Thu May 19 11:23:31 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 19 May 2016 11:23:31 +0000 (UTC) Subject: [commit: ghc] master: Comments only (d1efe86) Message-ID: <20160519112331.5F2EE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d1efe86532650944128be7d31f5cdc9d08e435a9/ghc >--------------------------------------------------------------- commit d1efe86532650944128be7d31f5cdc9d08e435a9 Author: Simon Peyton Jones Date: Thu May 19 10:44:02 2016 +0100 Comments only >--------------------------------------------------------------- d1efe86532650944128be7d31f5cdc9d08e435a9 compiler/typecheck/TcTyClsDecls.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/typecheck/TcTyClsDecls.hs b/compiler/typecheck/TcTyClsDecls.hs index c467c32..f07d877 100644 --- a/compiler/typecheck/TcTyClsDecls.hs +++ b/compiler/typecheck/TcTyClsDecls.hs @@ -141,6 +141,7 @@ tcTyAndClassDecls tyclds_s tcTyClGroup :: TyClGroup Name -> TcM (TcGblEnv, [InstInfo Name], [DerivInfo]) -- Typecheck one strongly-connected component of type, class, and instance decls +-- See Note [TyClGroups and dependency analysis] in HsDecls tcTyClGroup (TyClGroup { group_tyclds = tyclds , group_roles = roles , group_instds = instds }) From git at git.haskell.org Thu May 19 11:23:34 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 19 May 2016 11:23:34 +0000 (UTC) Subject: [commit: ghc] master: Comments only (0bfcfd0) Message-ID: <20160519112334.06FFE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0bfcfd068a3684728c61345c4ead6ca19be49c8f/ghc >--------------------------------------------------------------- commit 0bfcfd068a3684728c61345c4ead6ca19be49c8f Author: Simon Peyton Jones Date: Thu May 19 10:43:45 2016 +0100 Comments only >--------------------------------------------------------------- 0bfcfd068a3684728c61345c4ead6ca19be49c8f compiler/typecheck/FamInst.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compiler/typecheck/FamInst.hs b/compiler/typecheck/FamInst.hs index 6c357ce..de1f302 100644 --- a/compiler/typecheck/FamInst.hs +++ b/compiler/typecheck/FamInst.hs @@ -93,6 +93,8 @@ newFamInst flavor axiom@(CoAxiom { co_ax_tc = fam_tc }) * * ************************************************************************ +Note [Checking family instance consistency] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ For any two family instance modules that we import directly or indirectly, we check whether the instances in the two modules are consistent, *unless* we can be certain that the instances of the two modules have already been checked for @@ -143,6 +145,7 @@ listToSet :: [ModulePair] -> ModulePairSet listToSet l = Map.fromList (zip l (repeat ())) checkFamInstConsistency :: [Module] -> [Module] -> TcM () +-- See Note [Checking family instance consistency] checkFamInstConsistency famInstMods directlyImpMods = do { dflags <- getDynFlags ; (eps, hpt) <- getEpsAndHpt From git at git.haskell.org Thu May 19 11:23:36 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 19 May 2016 11:23:36 +0000 (UTC) Subject: [commit: ghc] master: Fix Trac #12051 (72b677d) Message-ID: <20160519112336.E20853A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/72b677d31e39f417e4403b1b151f02913f483d32/ghc >--------------------------------------------------------------- commit 72b677d31e39f417e4403b1b151f02913f483d32 Author: Simon Peyton Jones Date: Mon May 16 13:41:06 2016 +0100 Fix Trac #12051 A minor parser issue, allowing a mal-formed data constructor through. >--------------------------------------------------------------- 72b677d31e39f417e4403b1b151f02913f483d32 compiler/parser/Parser.y | 15 +---- compiler/parser/RdrHsSyn.hs | 73 ++++++++++++++++-------- testsuite/tests/parser/should_fail/T12051.hs | 3 + testsuite/tests/parser/should_fail/T12051.stderr | 2 + testsuite/tests/parser/should_fail/all.T | 1 + 5 files changed, 57 insertions(+), 37 deletions(-) diff --git a/compiler/parser/Parser.y b/compiler/parser/Parser.y index 4c272a1..4502dca 100644 --- a/compiler/parser/Parser.y +++ b/compiler/parser/Parser.y @@ -1642,7 +1642,7 @@ btype :: { LHsType RdrName } -- Used for parsing Haskell98-style data constructors, -- in order to forbid the blasphemous -- > data Foo = Int :+ Char :* Bool --- See also Note [Parsing data constructors is hard]. +-- See also Note [Parsing data constructors is hard] in RdrHsSyn btype_no_ops :: { LHsType RdrName } : btype_no_ops atype { sLL $1 $> $ HsAppTy $1 $2 } | atype { $1 } @@ -1898,23 +1898,12 @@ forall :: { Located ([AddAnn], Maybe [LHsTyVarBndr RdrName]) } | {- empty -} { noLoc ([], Nothing) } constr_stuff :: { Located (Located RdrName, HsConDeclDetails RdrName) } - -- see Note [Parsing data constructors is hard] + -- See Note [Parsing data constructors is hard] in RdrHsSyn : btype_no_ops {% do { c <- splitCon $1 ; return $ sLL $1 $> c } } | btype_no_ops conop btype_no_ops {% do { ty <- splitTilde $1 ; return $ sLL $1 $> ($2, InfixCon ty $3) } } -{- Note [Parsing data constructors is hard] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -We parse the constructor declaration - C t1 t2 -as a btype_no_ops (treating C as a type constructor) and then convert C to be -a data constructor. Reason: it might continue like this: - C t1 t2 :% D Int -in which case C really would be a type constructor. We can't resolve this -ambiguity till we come across the constructor oprerator :% (or not, more usually) --} - fielddecls :: { [LConDeclField RdrName] } : {- empty -} { [] } | fielddecls1 { $1 } diff --git a/compiler/parser/RdrHsSyn.hs b/compiler/parser/RdrHsSyn.hs index d650b01..43ff230 100644 --- a/compiler/parser/RdrHsSyn.hs +++ b/compiler/parser/RdrHsSyn.hs @@ -74,6 +74,7 @@ import Name import BasicTypes import TcEvidence ( idHsWrapper ) import Lexer +import Lexeme ( isLexCon ) import Type ( TyThing(..) ) import TysWiredIn ( cTupleTyConName, tupleTyCon, tupleDataCon, nilDataConName, nilDataConKey, @@ -425,16 +426,34 @@ has_args ((L _ (Match _ args _ _)) : _) = not (null args) ********************************************************************* -} ------------------------------------------------------------------------------ --- splitCon - --- When parsing data declarations, we sometimes inadvertently parse --- a constructor application as a type (eg. in data T a b = C a b `D` E a b) --- This function splits up the type application, adds any pending --- arguments, and converts the type constructor back into a data constructor. +{- Note [Parsing data constructors is hard] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +We parse the RHS of the constructor declaration + data T = C t1 t2 +as a btype_no_ops (treating C as a type constructor) and then convert C to be +a data constructor. Reason: it might continue like this: + data T = C t1 t2 :% D Int +in which case C really /would/ be a type constructor. We can't resolve this +ambiguity till we come across the constructor oprerator :% (or not, more usually) + +So the plan is: + +* Parse the data constructor declration as a type (actually btype_no_ops) + +* Use 'splitCon' to rejig it into the data constructor and the args + +* In doing so, we use 'tyConToDataCon' to convert the RdrName for + the data con, which has been parsed as a tycon, back to a datacon. + This is more than just adjusting the name space; for operators we + need to check that it begins with a colon. E.g. + data T = (+++) + will parse ok (since tycons can be operators), but we should reject + it (Trac #12051). +-} splitCon :: LHsType RdrName -> P (Located RdrName, HsConDeclDetails RdrName) +-- See Note [Parsing data constructors is hard] -- This gets given a "type" that should look like -- C Int Bool -- or C { x::Int, y::Bool } @@ -453,11 +472,23 @@ splitCon ty mk_rest [L l (HsRecTy flds)] = RecCon (L l flds) mk_rest ts = PrefixCon ts -recordPatSynErr :: SrcSpan -> LPat RdrName -> P a -recordPatSynErr loc pat = - parseErrorSDoc loc $ - text "record syntax not supported for pattern synonym declarations:" $$ - ppr pat +tyConToDataCon :: SrcSpan -> RdrName -> P (Located RdrName) +-- See Note [Parsing data constructors is hard] +-- Data constructor RHSs are parsed as types +tyConToDataCon loc tc + | isTcOcc occ + , isLexCon (occNameFS occ) + = return (L loc (setRdrNameSpace tc srcDataName)) + + | otherwise + = parseErrorSDoc loc (msg $$ extra) + where + occ = rdrNameOcc tc + + msg = text "Not a data constructor:" <+> quotes (ppr tc) + extra | tc == forall_tv_RDR + = text "Perhaps you intended to use ExistentialQuantification" + | otherwise = empty mkPatSynMatchGroup :: Located RdrName -> Located (OrdList (LHsDecl RdrName)) @@ -493,6 +524,12 @@ mkPatSynMatchGroup (L loc patsyn_name) (L _ decls) = text "pattern synonym 'where' clause cannot be empty" $$ text "In the pattern synonym declaration for: " <+> ppr (patsyn_name) +recordPatSynErr :: SrcSpan -> LPat RdrName -> P a +recordPatSynErr loc pat = + parseErrorSDoc loc $ + text "record syntax not supported for pattern synonym declarations:" $$ + ppr pat + mkConDeclH98 :: Located RdrName -> Maybe [LHsTyVarBndr RdrName] -> LHsContext RdrName -> HsConDeclDetails RdrName -> ConDecl RdrName @@ -513,18 +550,6 @@ mkGadtDecl names ty = ConDeclGADT { con_names = names , con_type = ty , con_doc = Nothing } -tyConToDataCon :: SrcSpan -> RdrName -> P (Located RdrName) -tyConToDataCon loc tc - | isTcOcc (rdrNameOcc tc) - = return (L loc (setRdrNameSpace tc srcDataName)) - | otherwise - = parseErrorSDoc loc (msg $$ extra) - where - msg = text "Not a data constructor:" <+> quotes (ppr tc) - extra | tc == forall_tv_RDR - = text "Perhaps you intended to use ExistentialQuantification" - | otherwise = empty - setRdrNameSpace :: RdrName -> NameSpace -> RdrName -- ^ This rather gruesome function is used mainly by the parser. -- When parsing: diff --git a/testsuite/tests/parser/should_fail/T12051.hs b/testsuite/tests/parser/should_fail/T12051.hs new file mode 100644 index 0000000..3744f77 --- /dev/null +++ b/testsuite/tests/parser/should_fail/T12051.hs @@ -0,0 +1,3 @@ +module T12051 where + +data T = (+++) Int diff --git a/testsuite/tests/parser/should_fail/T12051.stderr b/testsuite/tests/parser/should_fail/T12051.stderr new file mode 100644 index 0000000..ae65eae --- /dev/null +++ b/testsuite/tests/parser/should_fail/T12051.stderr @@ -0,0 +1,2 @@ + +T12051.hs:3:10: error: Not a data constructor: ?+++? diff --git a/testsuite/tests/parser/should_fail/all.T b/testsuite/tests/parser/should_fail/all.T index e6c6f41..ca23d3b 100644 --- a/testsuite/tests/parser/should_fail/all.T +++ b/testsuite/tests/parser/should_fail/all.T @@ -93,3 +93,4 @@ test('T10196Fail1', normal, compile_fail, ['']) test('T10196Fail2', normal, compile_fail, ['']) test('T10498a', normal, compile_fail, ['']) test('T10498b', normal, compile_fail, ['']) +test('T12051', normal, compile_fail, ['']) From git at git.haskell.org Thu May 19 11:28:12 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 19 May 2016 11:28:12 +0000 (UTC) Subject: [commit: ghc] wip/erikd/rts: rts: Add `-Wundef` to CFLAGS and fix warnings (5b8be80) Message-ID: <20160519112812.E0E8C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/rts Link : http://ghc.haskell.org/trac/ghc/changeset/5b8be80a5e4193970056566570b1bc1db6e2c980/ghc >--------------------------------------------------------------- commit 5b8be80a5e4193970056566570b1bc1db6e2c980 Author: Erik de Castro Lopo Date: Wed May 18 20:04:26 2016 +1000 rts: Add `-Wundef` to CFLAGS and fix warnings >--------------------------------------------------------------- 5b8be80a5e4193970056566570b1bc1db6e2c980 includes/Stg.h | 8 ++--- includes/rts/OSThreads.h | 4 +-- includes/rts/storage/InfoTables.h | 2 +- includes/stg/MachRegs.h | 2 +- includes/stg/SMP.h | 63 +++++++++++++++++++++------------------ rts/Adjustor.c | 3 ++ rts/Interpreter.c | 3 ++ rts/Linker.c | 12 ++++---- rts/LinkerInternals.h | 3 +- rts/OldARMAtomic.c | 2 +- rts/PrimOps.cmm | 4 +-- rts/RtsMessages.c | 4 +-- rts/RtsUtils.c | 4 +-- rts/Schedule.c | 16 +++++----- rts/Threads.c | 2 +- rts/Ticky.c | 8 ++--- rts/ghc.mk | 4 ++- rts/posix/GetTime.c | 2 +- rts/posix/OSMem.c | 8 ++--- rts/posix/OSThreads.c | 2 +- rts/sm/GCUtils.c | 2 +- rts/sm/GCUtils.h | 2 +- rts/sm/MBlock.c | 2 +- rts/sm/Storage.c | 3 ++ 24 files changed, 91 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 5b8be80a5e4193970056566570b1bc1db6e2c980 From git at git.haskell.org Thu May 19 12:11:41 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 19 May 2016 12:11:41 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Add expected output for T11108 (358567a) Message-ID: <20160519121141.46E753A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/358567a34bdb06b639d081a1c013d9cdd64709f0/ghc >--------------------------------------------------------------- commit 358567a34bdb06b639d081a1c013d9cdd64709f0 Author: Ben Gamari Date: Thu May 19 14:14:40 2016 +0200 testsuite: Add expected output for T11108 >--------------------------------------------------------------- 358567a34bdb06b639d081a1c013d9cdd64709f0 testsuite/tests/rts/T11108.stdout | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/testsuite/tests/rts/T11108.stdout b/testsuite/tests/rts/T11108.stdout new file mode 100644 index 0000000..4aa4715 --- /dev/null +++ b/testsuite/tests/rts/T11108.stdout @@ -0,0 +1,10 @@ +1001 +1002 +1003 +1004 +1005 +1006 +1007 +1008 +1009 +1010 From git at git.haskell.org Thu May 19 14:05:00 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 19 May 2016 14:05:00 +0000 (UTC) Subject: [commit: ghc] master: Testsuite: fix T11827 (#11827) (470def9) Message-ID: <20160519140500.8FAA63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/470def9a98a89ead3d162af9ea4dabb28a58dfed/ghc >--------------------------------------------------------------- commit 470def9a98a89ead3d162af9ea4dabb28a58dfed Author: Thomas Miedema Date: Thu May 19 14:29:44 2016 +0200 Testsuite: fix T11827 (#11827) It didn't trigger the bug before. >--------------------------------------------------------------- 470def9a98a89ead3d162af9ea4dabb28a58dfed testsuite/tests/ghci/T11827/T11827.script | 10 ++++++++++ testsuite/tests/ghci/T11827/all.T | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/ghci/T11827/T11827.script b/testsuite/tests/ghci/T11827/T11827.script index fa13992..e3629e6 100644 --- a/testsuite/tests/ghci/T11827/T11827.script +++ b/testsuite/tests/ghci/T11827/T11827.script @@ -1 +1,11 @@ :load B.hs + +-- The testsuite driver runs ghci script tests by default with `-v0`, which +-- prevents the bug from triggering. By adding a `:show modules` here, we do +-- trigger the bug. +-- +-- Adding the setup function `extra_run_opts('-v1')` would also work, but it +-- annoyingly prints the ghc version number, which would make the expected +-- test output dependent on that version number. + +:show modules diff --git a/testsuite/tests/ghci/T11827/all.T b/testsuite/tests/ghci/T11827/all.T index d31f6af..e2740f8 100644 --- a/testsuite/tests/ghci/T11827/all.T +++ b/testsuite/tests/ghci/T11827/all.T @@ -1,4 +1,4 @@ test('T11827', [extra_clean(['A.hi', 'A.hi-boot', 'A.o', 'B.hi', 'B.o']), - exit_code(1), expect_broken(11827)], + expect_broken(11827)], ghci_script, ['T11827.script']) From git at git.haskell.org Thu May 19 14:05:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 19 May 2016 14:05:03 +0000 (UTC) Subject: [commit: ghc] master: Add libraries/ghci/GNUmakefile to .gitignore [skip ci] (296b8f1) Message-ID: <20160519140503.3AD0C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/296b8f1baef2e6c88a418bbc5ac8b1ced111c745/ghc >--------------------------------------------------------------- commit 296b8f1baef2e6c88a418bbc5ac8b1ced111c745 Author: Thomas Miedema Date: Thu May 19 16:04:29 2016 +0200 Add libraries/ghci/GNUmakefile to .gitignore [skip ci] >--------------------------------------------------------------- 296b8f1baef2e6c88a418bbc5ac8b1ced111c745 .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index ff87375..cd556d5 100644 --- a/.gitignore +++ b/.gitignore @@ -132,6 +132,7 @@ _darcs/ /libraries/ghc-boot-th/GNUmakefile /libraries/ghc-boot-th/ghc-boot-th.cabal /libraries/ghc-boot-th/ghc.mk +/libraries/ghci/GNUmakefile /libraries/ghci/ghci.cabal /libraries/ghci/ghc.mk /libraries/haddock-util.js From git at git.haskell.org Thu May 19 19:31:32 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 19 May 2016 19:31:32 +0000 (UTC) Subject: [commit: ghc] master: Remove use of caddr_t (f0f3517) Message-ID: <20160519193132.DA8AD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f0f351775dfb157889c42863b00a2b331bb422eb/ghc >--------------------------------------------------------------- commit f0f351775dfb157889c42863b00a2b331bb422eb Author: Tomas Carnecky Date: Thu May 19 21:03:32 2016 +0200 Remove use of caddr_t > caddr_t is a legacy BSD type associated with some low level calls like > mmap, and it should never be used in modern code. It was rejected by > the POSIX standard. The standardized mmap uses void *. (http://stackoverflow.com/questions/6381526/what-is-the-significance-of- caddr-t-and-when-is-it-used) Reviewers: austin, simonmar, rwbarton, bgamari, erikd Reviewed By: rwbarton, bgamari, erikd Subscribers: erikd, thomie Differential Revision: https://phabricator.haskell.org/D2234 >--------------------------------------------------------------- f0f351775dfb157889c42863b00a2b331bb422eb rts/posix/OSMem.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rts/posix/OSMem.c b/rts/posix/OSMem.c index a06f544..4e6ecc2 100644 --- a/rts/posix/OSMem.c +++ b/rts/posix/OSMem.c @@ -39,11 +39,11 @@ #include #endif -static caddr_t next_request = 0; +static void *next_request = 0; void osMemInit(void) { - next_request = (caddr_t)RtsFlags.GcFlags.heapBase; + next_request = (void *)RtsFlags.GcFlags.heapBase; } /* ----------------------------------------------------------------------------- @@ -262,7 +262,7 @@ gen_map_mblocks (W_ size) void * osGetMBlocks(uint32_t n) { - caddr_t ret; + void *ret; W_ size = MBLOCK_SIZE * (W_)n; if (next_request == 0) { @@ -289,7 +289,7 @@ osGetMBlocks(uint32_t n) } // Next time, we'll try to allocate right after the block we just got. // ToDo: check that we haven't already grabbed the memory at next_request - next_request = ret + size; + next_request = (char *)ret + size; return ret; } From git at git.haskell.org Thu May 19 19:31:35 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 19 May 2016 19:31:35 +0000 (UTC) Subject: [commit: ghc] master: Get types in osFreeMBlocks in sync with osGetMBlocks (8abc193) Message-ID: <20160519193135.80E8C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8abc193dd3117adae126d43da3ae04cb045808da/ghc >--------------------------------------------------------------- commit 8abc193dd3117adae126d43da3ae04cb045808da Author: Tomas Carnecky Date: Thu May 19 21:03:42 2016 +0200 Get types in osFreeMBlocks in sync with osGetMBlocks The first argument of 'osFreeMBlocks' ought to have the same type as the return value from 'osGetMBlocks'. Make it so. Reviewers: austin, simonmar, bgamari Reviewed By: bgamari Subscribers: erikd, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D2235 >--------------------------------------------------------------- 8abc193dd3117adae126d43da3ae04cb045808da rts/posix/OSMem.c | 2 +- rts/sm/OSMem.h | 2 +- rts/win32/OSMem.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rts/posix/OSMem.c b/rts/posix/OSMem.c index 4e6ecc2..5c997ab 100644 --- a/rts/posix/OSMem.c +++ b/rts/posix/OSMem.c @@ -294,7 +294,7 @@ osGetMBlocks(uint32_t n) return ret; } -void osFreeMBlocks(char *addr, uint32_t n) +void osFreeMBlocks(void *addr, uint32_t n) { munmap(addr, n * MBLOCK_SIZE); } diff --git a/rts/sm/OSMem.h b/rts/sm/OSMem.h index defa0d4..a9d4fc9 100644 --- a/rts/sm/OSMem.h +++ b/rts/sm/OSMem.h @@ -13,7 +13,7 @@ void osMemInit(void); void *osGetMBlocks(uint32_t n); -void osFreeMBlocks(char *addr, uint32_t n); +void osFreeMBlocks(void *addr, uint32_t n); void osReleaseFreeMemory(void); void osFreeAllMBlocks(void); W_ getPageSize (void); diff --git a/rts/win32/OSMem.c b/rts/win32/OSMem.c index 65791b6..c51aab7 100644 --- a/rts/win32/OSMem.c +++ b/rts/win32/OSMem.c @@ -246,7 +246,7 @@ static void decommitBlocks(char *addr, W_ nBytes) } } -void osFreeMBlocks(char *addr, uint32_t n) +void osFreeMBlocks(void *addr, uint32_t n) { W_ nBytes = (W_)n * MBLOCK_SIZE; From git at git.haskell.org Thu May 19 19:31:38 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 19 May 2016 19:31:38 +0000 (UTC) Subject: [commit: ghc] master: Give lifted primitive types a representation (a88bb1b) Message-ID: <20160519193138.264B23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a88bb1b1518389817583290acaebfd6454aa3cec/ghc >--------------------------------------------------------------- commit a88bb1b1518389817583290acaebfd6454aa3cec Author: Ben Gamari Date: Thu May 19 21:05:30 2016 +0200 Give lifted primitive types a representation As of D1774 everything in GHC.Prim has a representation generated for it by TcTypeable (see #11120). Unfortunately I evidently missed propagating this change to lifted primitive types. This patch fixes this (#12082). Test Plan: Validate Reviewers: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2240 GHC Trac Issues: #12082 >--------------------------------------------------------------- a88bb1b1518389817583290acaebfd6454aa3cec compiler/types/TyCon.hs | 3 ++- testsuite/tests/typecheck/should_run/all.T | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/types/TyCon.hs b/compiler/types/TyCon.hs index 628eabd..55f6416 100644 --- a/compiler/types/TyCon.hs +++ b/compiler/types/TyCon.hs @@ -1365,7 +1365,8 @@ mkLiftedPrimTyCon :: Name -> [TyBinder] -> Kind -- ^ /result/ kind -> [Role] -> TyCon mkLiftedPrimTyCon name binders res_kind roles - = mkPrimTyCon' name binders res_kind roles False Nothing + = mkPrimTyCon' name binders res_kind roles False (Just rep_nm) + where rep_nm = mkPrelTyConRepName name mkPrimTyCon' :: Name -> [TyBinder] -> Kind -- ^ /result/ kind diff --git a/testsuite/tests/typecheck/should_run/all.T b/testsuite/tests/typecheck/should_run/all.T index 74d8f84..c2b277d 100755 --- a/testsuite/tests/typecheck/should_run/all.T +++ b/testsuite/tests/typecheck/should_run/all.T @@ -115,5 +115,5 @@ test('T11049', exit_code(1), compile_and_run, ['']) test('T11230', normal, compile_and_run, ['']) test('TypeOf', normal, compile_and_run, ['']) test('TypeRep', normal, compile_and_run, ['']) -test('T11120', expect_broken(12082), compile_and_run, ['']) +test('T11120', normal, compile_and_run, ['']) test('KindInvariant', normal, ghci_script, ['KindInvariant.script']) From git at git.haskell.org Thu May 19 19:31:40 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 19 May 2016 19:31:40 +0000 (UTC) Subject: [commit: ghc] master: {, M}BLOCK_SIZE_W * sizeof(W_) -> {, M}BLOCK_SIZE (464b6f8) Message-ID: <20160519193140.BF9373A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/464b6f8a2d85285730198fe493ee653e662615d3/ghc >--------------------------------------------------------------- commit 464b6f8a2d85285730198fe493ee653e662615d3 Author: Tomas Carnecky Date: Thu May 19 21:04:04 2016 +0200 {,M}BLOCK_SIZE_W * sizeof(W_) -> {,M}BLOCK_SIZE Reviewers: austin, erikd, simonmar, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2241 >--------------------------------------------------------------- 464b6f8a2d85285730198fe493ee653e662615d3 rts/Stats.c | 4 ++-- rts/sm/Storage.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/rts/Stats.c b/rts/Stats.c index cf426ca..30f346e 100644 --- a/rts/Stats.c +++ b/rts/Stats.c @@ -299,7 +299,7 @@ stat_endGC (Capability *cap, gc_thread *gct, slop * sizeof(W_), /* current loss due to fragmentation */ (mblocks_allocated * BLOCKS_PER_MBLOCK - n_alloc_blocks) - * BLOCK_SIZE_W * sizeof(W_), + * BLOCK_SIZE, par_n_threads, par_max_copied * sizeof(W_), par_tot_copied * sizeof(W_)); @@ -355,7 +355,7 @@ stat_endGC (Capability *cap, gc_thread *gct, copied*sizeof(W_), par_max_copied * sizeof(W_), mblocks_allocated * BLOCKS_PER_MBLOCK - * BLOCK_SIZE_W * sizeof(W_), + * BLOCK_SIZE, slop * sizeof(W_), TimeToNS(gc_sync_elapsed), TimeToNS(gc_elapsed), diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c index b505941..717c96a 100644 --- a/rts/sm/Storage.c +++ b/rts/sm/Storage.c @@ -205,10 +205,10 @@ initStorage (void) traceEventHeapInfo(CAPSET_HEAP_DEFAULT, RtsFlags.GcFlags.generations, - RtsFlags.GcFlags.maxHeapSize * BLOCK_SIZE_W * sizeof(W_), - RtsFlags.GcFlags.minAllocAreaSize * BLOCK_SIZE_W * sizeof(W_), - MBLOCK_SIZE_W * sizeof(W_), - BLOCK_SIZE_W * sizeof(W_)); + RtsFlags.GcFlags.maxHeapSize * BLOCK_SIZE, + RtsFlags.GcFlags.minAllocAreaSize * BLOCK_SIZE, + MBLOCK_SIZE, + BLOCK_SIZE); } void storageAddCapabilities (uint32_t from, uint32_t to) From git at git.haskell.org Thu May 19 19:31:44 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 19 May 2016 19:31:44 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Add a TypeRep test (2e6433a) Message-ID: <20160519193144.05AAF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2e6433af56a97ad9c501648afa5e1d8c6c17f82a/ghc >--------------------------------------------------------------- commit 2e6433af56a97ad9c501648afa5e1d8c6c17f82a Author: Ben Gamari Date: Thu May 19 21:05:22 2016 +0200 testsuite: Add a TypeRep test Test Plan: Validate Reviewers: goldfire, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2239 GHC Trac Issues: #12082, #11120 >--------------------------------------------------------------- 2e6433af56a97ad9c501648afa5e1d8c6c17f82a testsuite/tests/typecheck/should_run/TypeRep.hs | 48 ++++++++++++++++++++++ .../should_run/{TypeOf.stdout => TypeRep.stdout} | 5 ++- testsuite/tests/typecheck/should_run/all.T | 3 +- 3 files changed, 53 insertions(+), 3 deletions(-) diff --git a/testsuite/tests/typecheck/should_run/TypeRep.hs b/testsuite/tests/typecheck/should_run/TypeRep.hs new file mode 100644 index 0000000..3ae9577 --- /dev/null +++ b/testsuite/tests/typecheck/should_run/TypeRep.hs @@ -0,0 +1,48 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE TypeInType #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE AllowAmbiguousTypes #-} +{-# LANGUAGE TypeOperators #-} + +import Data.Typeable +import Data.Kind +import GHC.Exts + +-- Test that Typeable works for various wired-in types. +-- See, for instance, #11120. + +rep :: forall a. Typeable a => TypeRep +rep = typeRep (Proxy :: Proxy a) + +main :: IO () +main = do + -- the basics + print $ rep @String + print $ rep @Char + print $ rep @Int + print $ rep @Word + print $ rep @Double + print $ rep @(IO ()) + print $ rep @IO + print $ rep @"hi" + print $ rep @(Char, Int, String) + print $ rep @Bool + print $ rep @Ordering + print $ rep @(Int -> Int) + + -- Various instantiations of a kind-polymorphic type + print $ rep @(Proxy (Eq Int)) + print $ rep @(Proxy (Int, Int)) + print $ rep @(Proxy "hello world") + print $ rep @(Proxy 1) + print $ rep @(Proxy [1,2,3]) + print $ rep @(Proxy 'EQ) + print $ rep @(Proxy TYPE) + print $ rep @(Proxy (TYPE 'PtrRepLifted)) + print $ rep @(Proxy *) + print $ rep @(Proxy ?) + print $ rep @(Proxy 'PtrRepLifted) + + -- Something lifted and primitive + print $ rep @RealWorld diff --git a/testsuite/tests/typecheck/should_run/TypeOf.stdout b/testsuite/tests/typecheck/should_run/TypeRep.stdout similarity index 87% copy from testsuite/tests/typecheck/should_run/TypeOf.stdout copy to testsuite/tests/typecheck/should_run/TypeRep.stdout index 6f160f5..de00864 100644 --- a/testsuite/tests/typecheck/should_run/TypeOf.stdout +++ b/testsuite/tests/typecheck/should_run/TypeRep.stdout @@ -4,8 +4,9 @@ Int Word Double IO () +IO +"hi" (Char,Int,[Char]) -TypeRep Bool Ordering Int -> Int @@ -20,4 +21,4 @@ Proxy Constraint Constraint Proxy Constraint Constraint Proxy Constraint Constraint Proxy RuntimeRep 'PtrRepLifted -Proxy (Constraint -> Constraint -> Constraint) ~~ +RealWorld diff --git a/testsuite/tests/typecheck/should_run/all.T b/testsuite/tests/typecheck/should_run/all.T index ca3753d..74d8f84 100755 --- a/testsuite/tests/typecheck/should_run/all.T +++ b/testsuite/tests/typecheck/should_run/all.T @@ -114,5 +114,6 @@ test('T10284', exit_code(1), compile_and_run, ['']) test('T11049', exit_code(1), compile_and_run, ['']) test('T11230', normal, compile_and_run, ['']) test('TypeOf', normal, compile_and_run, ['']) -test('T11120', normal, compile_and_run, ['']) +test('TypeRep', normal, compile_and_run, ['']) +test('T11120', expect_broken(12082), compile_and_run, ['']) test('KindInvariant', normal, ghci_script, ['KindInvariant.script']) From git at git.haskell.org Thu May 19 19:47:12 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 19 May 2016 19:47:12 +0000 (UTC) Subject: [commit: ghc] master: Use the correct return type for Windows' send()/recv() (Fix #12010) (1ee47c1) Message-ID: <20160519194712.4A3153A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1ee47c1bfa35c7be435adaec5c1fa9ec92cc776d/ghc >--------------------------------------------------------------- commit 1ee47c1bfa35c7be435adaec5c1fa9ec92cc776d Author: Tamar Christina Date: Thu May 19 21:48:53 2016 +0200 Use the correct return type for Windows' send()/recv() (Fix #12010) Summary: They return signed 32 bit ints on Windows, even on a 64 bit OS, rather than Linux's 64 bit ssize_t. This means when recv() returned -1 to signal an error we thought it was 4294967295. It was converted to an int, -1 and the buffer was memcpy'd which caused a segfault. Other bad stuff happened with send()s. See also note CSsize in System.Posix.Internals. Add a test for #12010 Test Plan: - GHC testsuite (T12010) - http-conduit test (https://github.com/snoyberg/http-client/issues/191) Reviewers: austin, hvr, bgamari, Phyx Reviewed By: Phyx Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2170 GHC Trac Issues: #12010 >--------------------------------------------------------------- 1ee47c1bfa35c7be435adaec5c1fa9ec92cc776d libraries/base/GHC/IO/FD.hs | 16 ++++---- libraries/base/System/Posix/Internals.hs | 41 ++++++++++----------- libraries/base/tests/IO/T12010/Makefile | 10 +++++ libraries/base/tests/IO/T12010/T12010.hsc | 40 ++++++++++++++++++++ libraries/base/tests/IO/T12010/T12010.stdout | 2 + libraries/base/tests/IO/T12010/cbits/initWinSock.c | 43 ++++++++++++++++++++++ libraries/base/tests/IO/T12010/test.T | 8 ++++ 7 files changed, 131 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 1ee47c1bfa35c7be435adaec5c1fa9ec92cc776d From git at git.haskell.org Thu May 19 20:51:01 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 19 May 2016 20:51:01 +0000 (UTC) Subject: [commit: ghc] wip/erikd/rts: rts: Add `-Wundef` to CFLAGS and fix warnings (3c78114) Message-ID: <20160519205101.65F5B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/rts Link : http://ghc.haskell.org/trac/ghc/changeset/3c78114ce20d22adbb2f9eb3b7aff9aca41baf04/ghc >--------------------------------------------------------------- commit 3c78114ce20d22adbb2f9eb3b7aff9aca41baf04 Author: Erik de Castro Lopo Date: Wed May 18 20:04:26 2016 +1000 rts: Add `-Wundef` to CFLAGS and fix warnings >--------------------------------------------------------------- 3c78114ce20d22adbb2f9eb3b7aff9aca41baf04 includes/Stg.h | 8 ++--- includes/rts/OSThreads.h | 4 +-- includes/rts/storage/InfoTables.h | 2 +- includes/stg/MachRegs.h | 2 +- includes/stg/SMP.h | 63 +++++++++++++++++++++------------------ rts/Adjustor.c | 3 ++ rts/Interpreter.c | 3 ++ rts/Linker.c | 12 ++++---- rts/LinkerInternals.h | 3 +- rts/OldARMAtomic.c | 2 +- rts/PrimOps.cmm | 4 +-- rts/RtsMessages.c | 4 +-- rts/RtsUtils.c | 4 +-- rts/Schedule.c | 16 +++++----- rts/Threads.c | 2 +- rts/Ticky.c | 8 ++--- rts/ghc.mk | 4 ++- rts/posix/GetTime.c | 2 +- rts/posix/OSMem.c | 8 ++--- rts/posix/OSThreads.c | 2 +- rts/sm/GCUtils.c | 2 +- rts/sm/GCUtils.h | 2 +- rts/sm/MBlock.c | 2 +- rts/sm/Storage.c | 3 ++ 24 files changed, 91 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 3c78114ce20d22adbb2f9eb3b7aff9aca41baf04 From git at git.haskell.org Thu May 19 20:51:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 19 May 2016 20:51:03 +0000 (UTC) Subject: [commit: ghc] wip/erikd/rts's head updated: rts: Add `-Wundef` to CFLAGS and fix warnings (3c78114) Message-ID: <20160519205103.E87213A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/erikd/rts' now includes: 72b677d Fix Trac #12051 ad7f122 Improve pretty-printing of equalities f9e90bc Improve documentation for type wildcards 0bfcfd0 Comments only d1efe86 Comments only 358567a testsuite: Add expected output for T11108 470def9 Testsuite: fix T11827 (#11827) 296b8f1 Add libraries/ghci/GNUmakefile to .gitignore [skip ci] f0f3517 Remove use of caddr_t 8abc193 Get types in osFreeMBlocks in sync with osGetMBlocks 464b6f8 {,M}BLOCK_SIZE_W * sizeof(W_) -> {,M}BLOCK_SIZE 2e6433a testsuite: Add a TypeRep test a88bb1b Give lifted primitive types a representation 1ee47c1 Use the correct return type for Windows' send()/recv() (Fix #12010) 3c78114 rts: Add `-Wundef` to CFLAGS and fix warnings From git at git.haskell.org Thu May 19 22:44:12 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 19 May 2016 22:44:12 +0000 (UTC) Subject: [commit: ghc] master: Add -XStaticPointers to the flag reference. (3910306) Message-ID: <20160519224412.41CDD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/39103062e50249da857761d0eaca325aa428e446/ghc >--------------------------------------------------------------- commit 39103062e50249da857761d0eaca325aa428e446 Author: Facundo Dom?nguez Date: Thu May 19 17:44:34 2016 -0300 Add -XStaticPointers to the flag reference. >--------------------------------------------------------------- 39103062e50249da857761d0eaca325aa428e446 utils/mkUserGuidePart/Options/Language.hs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/utils/mkUserGuidePart/Options/Language.hs b/utils/mkUserGuidePart/Options/Language.hs index c9bb6ea..7dd8429 100644 --- a/utils/mkUserGuidePart/Options/Language.hs +++ b/utils/mkUserGuidePart/Options/Language.hs @@ -637,6 +637,13 @@ languageOptions = , flagReverse = "-XNoStandaloneDeriving" , flagSince = "6.8.1" } + , flag { flagName = "-XStaticPointers" + , flagDescription = + "Enable :ref:`static pointers `." + , flagType = DynamicFlag + , flagReverse = "-XNoStaticPointers" + , flagSince = "7.10.1" + } , flag { flagName = "-XStrictData" , flagDescription = "Enable :ref:`default strict datatype fields `." From git at git.haskell.org Fri May 20 08:37:11 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 20 May 2016 08:37:11 +0000 (UTC) Subject: [commit: ghc] master: FunDep printer: Fix unicode arrow (08e47ca) Message-ID: <20160520083711.F343A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/08e47ca9849ab986d0367746a003754fcf0d4176/ghc >--------------------------------------------------------------- commit 08e47ca9849ab986d0367746a003754fcf0d4176 Author: ?mer Sinan A?acan Date: Fri May 20 04:39:57 2016 -0400 FunDep printer: Fix unicode arrow The arrow should be printed in unicode arrow syntax when -fprint-unicode-syntax is used. Reviewers: austin, bgamari, thomie Reviewed By: thomie Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2243 GHC Trac Issues: #11825 >--------------------------------------------------------------- 08e47ca9849ab986d0367746a003754fcf0d4176 compiler/types/Class.hs | 2 +- testsuite/tests/ghci/should_run/T11825.hs | 4 ++++ .../tests/ghci/{scripts/T8959b.script => should_run/T11825.script} | 3 ++- testsuite/tests/ghci/should_run/T11825.stdout | 4 ++++ testsuite/tests/ghci/should_run/all.T | 1 + 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/compiler/types/Class.hs b/compiler/types/Class.hs index 09c8da9..d62f90f 100644 --- a/compiler/types/Class.hs +++ b/compiler/types/Class.hs @@ -308,7 +308,7 @@ pprFundeps [] = empty pprFundeps fds = hsep (vbar : punctuate comma (map pprFunDep fds)) pprFunDep :: Outputable a => FunDep a -> SDoc -pprFunDep (us, vs) = hsep [interppSP us, text "->", interppSP vs] +pprFunDep (us, vs) = hsep [interppSP us, arrow, interppSP vs] instance Data.Data Class where -- don't traverse? diff --git a/testsuite/tests/ghci/should_run/T11825.hs b/testsuite/tests/ghci/should_run/T11825.hs new file mode 100644 index 0000000..c3dd32e --- /dev/null +++ b/testsuite/tests/ghci/should_run/T11825.hs @@ -0,0 +1,4 @@ +{-# LANGUAGE FunctionalDependencies #-} + +class X a b | a -> b where + to :: a -> b diff --git a/testsuite/tests/ghci/scripts/T8959b.script b/testsuite/tests/ghci/should_run/T11825.script similarity index 53% copy from testsuite/tests/ghci/scripts/T8959b.script copy to testsuite/tests/ghci/should_run/T11825.script index e4d0df6..7c9d10a 100644 --- a/testsuite/tests/ghci/scripts/T8959b.script +++ b/testsuite/tests/ghci/should_run/T11825.script @@ -1,2 +1,3 @@ :set -fprint-unicode-syntax -:l T8959b.hs +:load T11825.hs +:info X diff --git a/testsuite/tests/ghci/should_run/T11825.stdout b/testsuite/tests/ghci/should_run/T11825.stdout new file mode 100644 index 0000000..9ab7b1b --- /dev/null +++ b/testsuite/tests/ghci/should_run/T11825.stdout @@ -0,0 +1,4 @@ +class X a b | a ? b where + to ? a ? b + {-# MINIMAL to #-} + -- Defined at T11825.hs:3:1 diff --git a/testsuite/tests/ghci/should_run/all.T b/testsuite/tests/ghci/should_run/all.T index 930f14b..08fe33d 100644 --- a/testsuite/tests/ghci/should_run/all.T +++ b/testsuite/tests/ghci/should_run/all.T @@ -23,3 +23,4 @@ test('T9915', just_ghci, ghci_script, ['T9915.script']) test('T10145', just_ghci, ghci_script, ['T10145.script']) test('T7253', just_ghci, ghci_script, ['T7253.script']) test('T11328', just_ghci, ghci_script, ['T11328.script']) +test('T11825', just_ghci, ghci_script, ['T11825.script']) From git at git.haskell.org Fri May 20 20:58:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 20 May 2016 20:58:03 +0000 (UTC) Subject: [commit: ghc] master: testsuite: add CmmSwitchTest for 32-bit platforms (43589f5) Message-ID: <20160520205803.E5B413A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/43589f5cad0926ec077214e7a21a27ef7a8cfe25/ghc >--------------------------------------------------------------- commit 43589f5cad0926ec077214e7a21a27ef7a8cfe25 Author: Alex Dzyoba Date: Fri May 20 20:28:38 2016 +0000 testsuite: add CmmSwitchTest for 32-bit platforms Move CmmSwitchTest to CmmSwitchTest64, because it's broken on 32-bit platforms. Create CmmSwitchTest32 that repeats CmmSwitchTest64 for platforms with 32-bit wordsize. Reviewed By: nomeata, austin, bgamari, thomie Differential Revision: https://phabricator.haskell.org/D2226 GHC Trac Issues: #11297 >--------------------------------------------------------------- 43589f5cad0926ec077214e7a21a27ef7a8cfe25 .../tests/codeGen/should_run/CmmSwitchTest32.hs | 791 +++++++++++++++++++++ .../{CmmSwitchTest.hs => CmmSwitchTest64.hs} | 342 ++++++++- .../tests/codeGen/should_run/CmmSwitchTestGen.hs | 59 +- testsuite/tests/codeGen/should_run/all.T | 5 +- 4 files changed, 1148 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 43589f5cad0926ec077214e7a21a27ef7a8cfe25 From git at git.haskell.org Sat May 21 07:46:13 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 21 May 2016 07:46:13 +0000 (UTC) Subject: [commit: ghc] tag 'ghc-8.0.1-release' created Message-ID: <20160521074613.D089F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New tag : ghc-8.0.1-release Referencing: 9cb4d061d3c8a241b0ee8d0e26e346bd9ec2c30f From git at git.haskell.org Sat May 21 08:04:14 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 21 May 2016 08:04:14 +0000 (UTC) Subject: [commit: ghc] wip/erikd/linker: WIP: Runtime linker: Break m32 allocator out into its own file (f66c38f) Message-ID: <20160521080414.04C5B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/linker Link : http://ghc.haskell.org/trac/ghc/changeset/f66c38ff5b76ca4e6464cf01dc9cb289c4034463/ghc >--------------------------------------------------------------- commit f66c38ff5b76ca4e6464cf01dc9cb289c4034463 Author: Erik de Castro Lopo Date: Sat May 14 17:27:38 2016 +1000 WIP: Runtime linker: Break m32 allocator out into its own file Summary: This makes the code a little more modular and allows the removal of some CPP hackery. By providing dummy implementations of of the `m32_*` functions (which simply call `errorBelch`) it means that the call sites for these functions are syntax checked even when `RTS_LINKER_USE_MMAP` is `0`. Also changes some size parameter types from `unsigned int` to `size_t`. Test Plan: Validate on Linux, OS X and Windows Reviewers: simonmar, austin, Phyx, hsyl20, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2237 >--------------------------------------------------------------- f66c38ff5b76ca4e6464cf01dc9cb289c4034463 rts/Linker.c | 321 +++------------------------------------------- rts/ghc.mk | 2 +- rts/linker/M32Alloc.c | 342 ++++++++++++++++++++++++++++++++++++++++++++++++++ rts/linker/M32Alloc.h | 41 ++++++ rts/posix/OSMem.c | 12 +- rts/sm/OSMem.h | 17 ++- rts/win32/OSMem.c | 12 +- 7 files changed, 426 insertions(+), 321 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc f66c38ff5b76ca4e6464cf01dc9cb289c4034463 From git at git.haskell.org Sat May 21 08:04:16 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 21 May 2016 08:04:16 +0000 (UTC) Subject: [commit: ghc] wip/erikd/linker's head updated: WIP: Runtime linker: Break m32 allocator out into its own file (f66c38f) Message-ID: <20160521080416.5E21C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/erikd/linker' now includes: b088c02 Testsuite: T10052 requires interpreter (#11730) 3251743 Testsuite: don't warn when mk/ghcconfig_* hasn't been created yet 77ee3a9 Update .mailmap [skip ci] fffe3a2 Make inert_model and inert_eqs deterministic sets f0f0ac8 Fix histograms for ticky code ba3e1fd Add a test for #11108 39a2faa Rework parser to allow use with DynFlags 310371f rts: Add isPinnedByteArray# primop f091218 CLabel: Catch #11155 during C-- pretty-printing 9dd0481 Add (broken) test for #12063. 5f1557e Failing test case for #12076. f18e8d8 rts: Add missing `const` from HashTable API 6282bc3 Kill varSetElems in tidyFreeTyCoVars 13e40f9 Kill varEnvElts in tcPragExpr 72b677d Fix Trac #12051 ad7f122 Improve pretty-printing of equalities f9e90bc Improve documentation for type wildcards 0bfcfd0 Comments only d1efe86 Comments only 358567a testsuite: Add expected output for T11108 470def9 Testsuite: fix T11827 (#11827) 296b8f1 Add libraries/ghci/GNUmakefile to .gitignore [skip ci] f0f3517 Remove use of caddr_t 8abc193 Get types in osFreeMBlocks in sync with osGetMBlocks 464b6f8 {,M}BLOCK_SIZE_W * sizeof(W_) -> {,M}BLOCK_SIZE 2e6433a testsuite: Add a TypeRep test a88bb1b Give lifted primitive types a representation 1ee47c1 Use the correct return type for Windows' send()/recv() (Fix #12010) 3910306 Add -XStaticPointers to the flag reference. 08e47ca FunDep printer: Fix unicode arrow 43589f5 testsuite: add CmmSwitchTest for 32-bit platforms f66c38f WIP: Runtime linker: Break m32 allocator out into its own file From git at git.haskell.org Sat May 21 09:22:02 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 21 May 2016 09:22:02 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Avoid double error on out-of-scope identifier (8405c2e) Message-ID: <20160521092202.D275D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/8405c2edddd0cc76c748b109d99f096c33d1dc50/ghc >--------------------------------------------------------------- commit 8405c2edddd0cc76c748b109d99f096c33d1dc50 Author: Simon Peyton Jones Date: Thu Apr 21 14:34:07 2016 +0100 Avoid double error on out-of-scope identifier Trac #11941 demonstrated a case where an out-of-scope error also gave rise to a (bogus and confusing) stage restriction message. It's caused by the fact that out-of-scope errors do not stop renaming, but rather return an "unbound name". We need to detect this in the stage-restriction test to avoid the double error. Easy fix. (cherry picked from commit c2b7a3d9f6ad946a2cb2773e96a377cc2216cb5b) >--------------------------------------------------------------- 8405c2edddd0cc76c748b109d99f096c33d1dc50 compiler/typecheck/TcEnv.hs | 12 ++++++++---- testsuite/tests/th/T11941.hs | 7 +++++++ testsuite/tests/th/T11941.stderr | 6 ++++++ testsuite/tests/th/all.T | 1 + 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/compiler/typecheck/TcEnv.hs b/compiler/typecheck/TcEnv.hs index f86156b..369605b 100644 --- a/compiler/typecheck/TcEnv.hs +++ b/compiler/typecheck/TcEnv.hs @@ -955,7 +955,10 @@ notFound name = do { lcl_env <- getLclEnv ; let stage = tcl_th_ctxt lcl_env ; case stage of -- See Note [Out of scope might be a staging error] - Splice {} -> stageRestrictionError (quotes (ppr name)) + Splice {} + | isUnboundName name -> failM -- If the name really isn't in scope + -- don't report it again (Trac #11941) + | otherwise -> stageRestrictionError (quotes (ppr name)) _ -> failWithTc $ vcat[text "GHC internal error:" <+> quotes (ppr name) <+> text "is not in scope during type checking, but it passed the renamer", @@ -975,13 +978,14 @@ wrongThingErr expected thing name = failWithTc (pprTcTyThingCategory thing <+> quotes (ppr name) <+> text "used as a" <+> text expected) -{- -Note [Out of scope might be a staging error] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +{- Note [Out of scope might be a staging error] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Consider x = 3 data T = MkT $(foo x) +where 'foo' is is imported from somewhere. + This is really a staging error, because we can't run code involving 'x'. But in fact the type checker processes types first, so 'x' won't even be in the type envt when we look for it in $(foo x). So inside splices we diff --git a/testsuite/tests/th/T11941.hs b/testsuite/tests/th/T11941.hs new file mode 100644 index 0000000..ed7e746 --- /dev/null +++ b/testsuite/tests/th/T11941.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE TemplateHaskell #-} + +module T11941 where + +import Data.Monoid + +const (return []) $ mempty { getFrst = Just () } diff --git a/testsuite/tests/th/T11941.stderr b/testsuite/tests/th/T11941.stderr new file mode 100644 index 0000000..4508ed3 --- /dev/null +++ b/testsuite/tests/th/T11941.stderr @@ -0,0 +1,6 @@ + +T11941.hs:7:30: error: + Not in scope: ?getFrst? + Perhaps you meant one of these: + ?getFirst? (imported from Data.Monoid), + ?getLast? (imported from Data.Monoid) diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index 3f1af26..864fa74 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -407,3 +407,4 @@ test('T11463', normal, compile_and_run, ['-v0 -dsuppress-uniques']) test('T11680', normal, compile_fail, ['-v0']) test('T11809', normal, compile, ['-v0']) test('T11797', normal, compile, ['-v0 -dsuppress-uniques']) +test('T11941', normal, compile_fail, ['-v0']) From git at git.haskell.org Sat May 21 09:22:05 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 21 May 2016 09:22:05 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Give lifted primitive types a representation (2c5a5fc) Message-ID: <20160521092205.777203A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/2c5a5fc14300e1615bde63f4ba63c98727442061/ghc >--------------------------------------------------------------- commit 2c5a5fc14300e1615bde63f4ba63c98727442061 Author: Ben Gamari Date: Thu May 19 21:05:30 2016 +0200 Give lifted primitive types a representation As of D1774 everything in GHC.Prim has a representation generated for it by TcTypeable (see #11120). Unfortunately I evidently missed propagating this change to lifted primitive types. This patch fixes this (#12082). Test Plan: Validate Reviewers: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2240 GHC Trac Issues: #12082 (cherry picked from commit a88bb1b1518389817583290acaebfd6454aa3cec) >--------------------------------------------------------------- 2c5a5fc14300e1615bde63f4ba63c98727442061 compiler/types/TyCon.hs | 3 ++- testsuite/tests/typecheck/should_run/all.T | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/types/TyCon.hs b/compiler/types/TyCon.hs index 69a9360..8954102 100644 --- a/compiler/types/TyCon.hs +++ b/compiler/types/TyCon.hs @@ -1322,7 +1322,8 @@ mkLiftedPrimTyCon :: Name -> [TyBinder] -> Kind -- ^ /result/ kind -> [Role] -> TyCon mkLiftedPrimTyCon name binders res_kind roles - = mkPrimTyCon' name binders res_kind roles False Nothing + = mkPrimTyCon' name binders res_kind roles False (Just rep_nm) + where rep_nm = mkPrelTyConRepName name mkPrimTyCon' :: Name -> [TyBinder] -> Kind -- ^ /result/ kind diff --git a/testsuite/tests/typecheck/should_run/all.T b/testsuite/tests/typecheck/should_run/all.T index 9382cb1..03eb41a 100755 --- a/testsuite/tests/typecheck/should_run/all.T +++ b/testsuite/tests/typecheck/should_run/all.T @@ -115,5 +115,5 @@ test('T11049', exit_code(1), compile_and_run, ['']) test('T11230', normal, compile_and_run, ['']) test('TypeOf', normal, compile_and_run, ['']) test('TypeRep', normal, compile_and_run, ['']) -test('T11120', expect_broken(12082), compile_and_run, ['']) +test('T11120', normal, compile_and_run, ['']) test('KindInvariant', normal, ghci_script, ['KindInvariant.script']) From git at git.haskell.org Sat May 21 09:22:08 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 21 May 2016 09:22:08 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Set RELEASE=NO (564af9f) Message-ID: <20160521092208.1CA113A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/564af9f4f4865f2dc37482cb2fbd8cc83c6627b5/ghc >--------------------------------------------------------------- commit 564af9f4f4865f2dc37482cb2fbd8cc83c6627b5 Author: Ben Gamari Date: Sat May 21 11:20:10 2016 +0200 Set RELEASE=NO >--------------------------------------------------------------- 564af9f4f4865f2dc37482cb2fbd8cc83c6627b5 configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 31401d7..7d176dd 100644 --- a/configure.ac +++ b/configure.ac @@ -16,7 +16,7 @@ dnl AC_INIT([The Glorious Glasgow Haskell Compilation System], [8.0.1], [glasgow-haskell-bugs at haskell.org], [ghc-AC_PACKAGE_VERSION]) # Set this to YES for a released version, otherwise NO -: ${RELEASE=YES} +: ${RELEASE=NO} # The primary version (e.g. 7.5, 7.4.1) is set in the AC_INIT line # above. If this is not a released version, then we will append the From git at git.haskell.org Sat May 21 09:22:11 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 21 May 2016 09:22:11 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: testsuite: Add a TypeRep test (f3114cf) Message-ID: <20160521092211.5473C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/f3114cfdedd9c704d324dadd9259c18b28e2417b/ghc >--------------------------------------------------------------- commit f3114cfdedd9c704d324dadd9259c18b28e2417b Author: Ben Gamari Date: Thu May 19 21:05:22 2016 +0200 testsuite: Add a TypeRep test Test Plan: Validate Reviewers: goldfire, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2239 GHC Trac Issues: #12082, #11120 (cherry picked from commit 2e6433af56a97ad9c501648afa5e1d8c6c17f82a) >--------------------------------------------------------------- f3114cfdedd9c704d324dadd9259c18b28e2417b testsuite/tests/typecheck/should_run/TypeRep.hs | 48 ++++++++++++++++++++++ .../should_run/{TypeOf.stdout => TypeRep.stdout} | 5 ++- testsuite/tests/typecheck/should_run/all.T | 4 +- 3 files changed, 54 insertions(+), 3 deletions(-) diff --git a/testsuite/tests/typecheck/should_run/TypeRep.hs b/testsuite/tests/typecheck/should_run/TypeRep.hs new file mode 100644 index 0000000..3ae9577 --- /dev/null +++ b/testsuite/tests/typecheck/should_run/TypeRep.hs @@ -0,0 +1,48 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE TypeInType #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE AllowAmbiguousTypes #-} +{-# LANGUAGE TypeOperators #-} + +import Data.Typeable +import Data.Kind +import GHC.Exts + +-- Test that Typeable works for various wired-in types. +-- See, for instance, #11120. + +rep :: forall a. Typeable a => TypeRep +rep = typeRep (Proxy :: Proxy a) + +main :: IO () +main = do + -- the basics + print $ rep @String + print $ rep @Char + print $ rep @Int + print $ rep @Word + print $ rep @Double + print $ rep @(IO ()) + print $ rep @IO + print $ rep @"hi" + print $ rep @(Char, Int, String) + print $ rep @Bool + print $ rep @Ordering + print $ rep @(Int -> Int) + + -- Various instantiations of a kind-polymorphic type + print $ rep @(Proxy (Eq Int)) + print $ rep @(Proxy (Int, Int)) + print $ rep @(Proxy "hello world") + print $ rep @(Proxy 1) + print $ rep @(Proxy [1,2,3]) + print $ rep @(Proxy 'EQ) + print $ rep @(Proxy TYPE) + print $ rep @(Proxy (TYPE 'PtrRepLifted)) + print $ rep @(Proxy *) + print $ rep @(Proxy ?) + print $ rep @(Proxy 'PtrRepLifted) + + -- Something lifted and primitive + print $ rep @RealWorld diff --git a/testsuite/tests/typecheck/should_run/TypeOf.stdout b/testsuite/tests/typecheck/should_run/TypeRep.stdout similarity index 87% copy from testsuite/tests/typecheck/should_run/TypeOf.stdout copy to testsuite/tests/typecheck/should_run/TypeRep.stdout index 6f160f5..de00864 100644 --- a/testsuite/tests/typecheck/should_run/TypeOf.stdout +++ b/testsuite/tests/typecheck/should_run/TypeRep.stdout @@ -4,8 +4,9 @@ Int Word Double IO () +IO +"hi" (Char,Int,[Char]) -TypeRep Bool Ordering Int -> Int @@ -20,4 +21,4 @@ Proxy Constraint Constraint Proxy Constraint Constraint Proxy Constraint Constraint Proxy RuntimeRep 'PtrRepLifted -Proxy (Constraint -> Constraint -> Constraint) ~~ +RealWorld diff --git a/testsuite/tests/typecheck/should_run/all.T b/testsuite/tests/typecheck/should_run/all.T index cfd35e4..9382cb1 100755 --- a/testsuite/tests/typecheck/should_run/all.T +++ b/testsuite/tests/typecheck/should_run/all.T @@ -114,4 +114,6 @@ test('T10284', exit_code(1), compile_and_run, ['']) test('T11049', exit_code(1), compile_and_run, ['']) test('T11230', normal, compile_and_run, ['']) test('TypeOf', normal, compile_and_run, ['']) -test('T11120', normal, compile_and_run, ['']) +test('TypeRep', normal, compile_and_run, ['']) +test('T11120', expect_broken(12082), compile_and_run, ['']) +test('KindInvariant', normal, ghci_script, ['KindInvariant.script']) From git at git.haskell.org Sat May 21 10:25:20 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 21 May 2016 10:25:20 +0000 (UTC) Subject: [commit: ghc] wip/erikd/linker: Runtime linker: Break m32 allocator out into its own file (d3f1508) Message-ID: <20160521102520.029B63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/linker Link : http://ghc.haskell.org/trac/ghc/changeset/d3f15089d47af1f65ad4a3b6ea08b182309c0c2d/ghc >--------------------------------------------------------------- commit d3f15089d47af1f65ad4a3b6ea08b182309c0c2d Author: Erik de Castro Lopo Date: Sat May 14 17:27:38 2016 +1000 Runtime linker: Break m32 allocator out into its own file Summary: This makes the code a little more modular and allows the removal of some CPP hackery. By providing dummy implementations of of the `m32_*` functions (which simply call `errorBelch`) it means that the call sites for these functions are syntax checked even when `RTS_LINKER_USE_MMAP` is `0`. Also changes some size parameter types from `unsigned int` to `size_t`. Test Plan: Validate on Linux, OS X and Windows Reviewers: simonmar, austin, Phyx, hsyl20, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2237 >--------------------------------------------------------------- d3f15089d47af1f65ad4a3b6ea08b182309c0c2d rts/Linker.c | 321 +++------------------------------------------- rts/ghc.mk | 2 +- rts/linker/M32Alloc.c | 342 ++++++++++++++++++++++++++++++++++++++++++++++++++ rts/linker/M32Alloc.h | 47 +++++++ rts/posix/OSMem.c | 12 +- rts/sm/OSMem.h | 17 ++- rts/win32/OSMem.c | 12 +- 7 files changed, 432 insertions(+), 321 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc d3f15089d47af1f65ad4a3b6ea08b182309c0c2d From git at git.haskell.org Sat May 21 10:40:48 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 21 May 2016 10:40:48 +0000 (UTC) Subject: [commit: ghc] wip/erikd/linker: fixup (a9b07c8) Message-ID: <20160521104048.8C3F03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/linker Link : http://ghc.haskell.org/trac/ghc/changeset/a9b07c801abc0f2d0a7124099d76cc088a8daaa3/ghc >--------------------------------------------------------------- commit a9b07c801abc0f2d0a7124099d76cc088a8daaa3 Author: Erik de Castro Lopo Date: Sat May 21 20:35:51 2016 +1000 fixup >--------------------------------------------------------------- a9b07c801abc0f2d0a7124099d76cc088a8daaa3 rts/linker/M32Alloc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rts/linker/M32Alloc.c b/rts/linker/M32Alloc.c index 596cb7d..d5a9cb1 100644 --- a/rts/linker/M32Alloc.c +++ b/rts/linker/M32Alloc.c @@ -315,19 +315,19 @@ m32_alloc(size_t size, size_t alignment) // See the note titled "Compile Time Trickery" at the top of this file. void -m32_allocator_init(void) GNUC3_ATTRIBUTE(__noreturn__) +m32_allocator_init(void) { barf("%s: RTS_LINKER_USE_MMAP is %d", __func__, RTS_LINKER_USE_MMAP); } void -m32_allocator_flush(void) GNUC3_ATTRIBUTE(__noreturn__) +m32_allocator_flush(void) { barf("%s: RTS_LINKER_USE_MMAP is %d", __func__, RTS_LINKER_USE_MMAP); } void -m32_free(void *addr STG_UNUSED, size_t size STG_UNUSED) GNUC3_ATTRIBUTE(__noreturn__) +m32_free(void *addr STG_UNUSED, size_t size STG_UNUSED) { barf("%s: RTS_LINKER_USE_MMAP is %d", __func__, RTS_LINKER_USE_MMAP); } From git at git.haskell.org Sat May 21 10:50:15 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 21 May 2016 10:50:15 +0000 (UTC) Subject: [commit: ghc] wip/erikd/linker: Runtime linker: Break m32 allocator out into its own file (dbfb818) Message-ID: <20160521105015.68CB23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/linker Link : http://ghc.haskell.org/trac/ghc/changeset/dbfb818d68a7d9b5277043584580d2d37f061f23/ghc >--------------------------------------------------------------- commit dbfb818d68a7d9b5277043584580d2d37f061f23 Author: Erik de Castro Lopo Date: Sat May 14 17:27:38 2016 +1000 Runtime linker: Break m32 allocator out into its own file Summary: This makes the code a little more modular and allows the removal of some CPP hackery. By providing dummy implementations of of the `m32_*` functions (which simply call `errorBelch`) it means that the call sites for these functions are syntax checked even when `RTS_LINKER_USE_MMAP` is `0`. Also changes some size parameter types from `unsigned int` to `size_t`. Test Plan: Validate on Linux, OS X and Windows Reviewers: simonmar, austin, Phyx, hsyl20, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2237 >--------------------------------------------------------------- dbfb818d68a7d9b5277043584580d2d37f061f23 rts/Linker.c | 321 +++------------------------------------------- rts/ghc.mk | 2 +- rts/linker/M32Alloc.c | 342 ++++++++++++++++++++++++++++++++++++++++++++++++++ rts/linker/M32Alloc.h | 47 +++++++ rts/posix/OSMem.c | 12 +- rts/sm/OSMem.h | 17 ++- rts/win32/OSMem.c | 12 +- 7 files changed, 432 insertions(+), 321 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc dbfb818d68a7d9b5277043584580d2d37f061f23 From git at git.haskell.org Sat May 21 10:50:18 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 21 May 2016 10:50:18 +0000 (UTC) Subject: [commit: ghc] wip/erikd/linker: Fix Windows build after Ticky changes (259ac74) Message-ID: <20160521105018.0C65E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/linker Link : http://ghc.haskell.org/trac/ghc/changeset/259ac746c2cf6f9e6a982d6a800a85ab8f7e8105/ghc >--------------------------------------------------------------- commit 259ac746c2cf6f9e6a982d6a800a85ab8f7e8105 Author: Tamar Christina Date: Sat May 21 20:52:55 2016 +1000 Fix Windows build after Ticky changes Summary: Replace hardcoded ld with FMT_Int for StgInt types. Test Plan: ./validate Reviewers: austin, bgamari, simonmar, erikd Reviewed By: erikd Subscribers: thomie, #ghc_windows_task_force Differential Revision: https://phabricator.haskell.org/D2249 >--------------------------------------------------------------- 259ac746c2cf6f9e6a982d6a800a85ab8f7e8105 rts/Ticky.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rts/Ticky.c b/rts/Ticky.c index cb3651d..b854e9e 100644 --- a/rts/Ticky.c +++ b/rts/Ticky.c @@ -135,19 +135,19 @@ PrintTickyInfo(void) PC(INTAVG(tot_returns_of_new,tot_returns))); - fprintf(tf, "\nRET_NEW: %11ld: ", RET_NEW_ctr); + fprintf(tf, "\nRET_NEW: %11" FMT_Int ": ", RET_NEW_ctr); for (i = 0; i < TICKY_BIN_COUNT; i++) { fprintf(tf, "%5.1f%%", PC(INTAVG(RET_NEW_hst[i], RET_NEW_ctr))); } fprintf(tf, "\n"); - fprintf(tf, "RET_OLD: %11ld: ", RET_OLD_ctr); + fprintf(tf, "RET_OLD: %11" FMT_Int ": ", RET_OLD_ctr); for (i = 0; i < TICKY_BIN_COUNT; i++) { fprintf(tf, "%5.1f%%", PC(INTAVG(RET_OLD_hst[i], RET_OLD_ctr))); } fprintf(tf, "\n"); - fprintf(tf, "RET_UNBOXED_TUP: %11ld: ", RET_UNBOXED_TUP_ctr); + fprintf(tf, "RET_UNBOXED_TUP: %11" FMT_Int ": ", RET_UNBOXED_TUP_ctr); for (i = 0; i < TICKY_BIN_COUNT; i++) { fprintf(tf, "%5.1f%%", PC(INTAVG(RET_UNBOXED_TUP_hst[i], RET_UNBOXED_TUP_ctr))); @@ -311,7 +311,7 @@ PrintTickyInfo(void) PR_CTR(RET_UNBOXED_TUP_ctr); #define PR_HST_BINS(hst) for (i = 0; i < TICKY_BIN_COUNT; i++) \ - { fprintf(tf,"%11ld " #hst "_%lu\n", hst[i], i); } + { fprintf(tf,"%11" FMT_Int " " #hst "_%lu\n", hst[i], i); } PR_HST_BINS(RET_NEW_hst); PR_HST_BINS(RET_OLD_hst); From git at git.haskell.org Sat May 21 10:52:56 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 21 May 2016 10:52:56 +0000 (UTC) Subject: [commit: ghc] master: Fix Windows build after Ticky changes (ae7e9cb) Message-ID: <20160521105256.BFE533A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ae7e9cb574801954c7769c210829b06193fa72ea/ghc >--------------------------------------------------------------- commit ae7e9cb574801954c7769c210829b06193fa72ea Author: Tamar Christina Date: Sat May 21 11:31:58 2016 +0200 Fix Windows build after Ticky changes Summary: Replace hardcoded ld with FMT_Int for StgInt types. Test Plan: ./validate Reviewers: austin, bgamari, simonmar, erikd Reviewed By: erikd Subscribers: thomie, #ghc_windows_task_force Differential Revision: https://phabricator.haskell.org/D2249 >--------------------------------------------------------------- ae7e9cb574801954c7769c210829b06193fa72ea rts/Ticky.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rts/Ticky.c b/rts/Ticky.c index cb3651d..b854e9e 100644 --- a/rts/Ticky.c +++ b/rts/Ticky.c @@ -135,19 +135,19 @@ PrintTickyInfo(void) PC(INTAVG(tot_returns_of_new,tot_returns))); - fprintf(tf, "\nRET_NEW: %11ld: ", RET_NEW_ctr); + fprintf(tf, "\nRET_NEW: %11" FMT_Int ": ", RET_NEW_ctr); for (i = 0; i < TICKY_BIN_COUNT; i++) { fprintf(tf, "%5.1f%%", PC(INTAVG(RET_NEW_hst[i], RET_NEW_ctr))); } fprintf(tf, "\n"); - fprintf(tf, "RET_OLD: %11ld: ", RET_OLD_ctr); + fprintf(tf, "RET_OLD: %11" FMT_Int ": ", RET_OLD_ctr); for (i = 0; i < TICKY_BIN_COUNT; i++) { fprintf(tf, "%5.1f%%", PC(INTAVG(RET_OLD_hst[i], RET_OLD_ctr))); } fprintf(tf, "\n"); - fprintf(tf, "RET_UNBOXED_TUP: %11ld: ", RET_UNBOXED_TUP_ctr); + fprintf(tf, "RET_UNBOXED_TUP: %11" FMT_Int ": ", RET_UNBOXED_TUP_ctr); for (i = 0; i < TICKY_BIN_COUNT; i++) { fprintf(tf, "%5.1f%%", PC(INTAVG(RET_UNBOXED_TUP_hst[i], RET_UNBOXED_TUP_ctr))); @@ -311,7 +311,7 @@ PrintTickyInfo(void) PR_CTR(RET_UNBOXED_TUP_ctr); #define PR_HST_BINS(hst) for (i = 0; i < TICKY_BIN_COUNT; i++) \ - { fprintf(tf,"%11ld " #hst "_%lu\n", hst[i], i); } + { fprintf(tf,"%11" FMT_Int " " #hst "_%lu\n", hst[i], i); } PR_HST_BINS(RET_NEW_hst); PR_HST_BINS(RET_OLD_hst); From git at git.haskell.org Sat May 21 11:19:33 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 21 May 2016 11:19:33 +0000 (UTC) Subject: [commit: ghc] master: Testsuite: mark T8761 expect_broken #12077 (8e92974) Message-ID: <20160521111933.A87563A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8e929744eb332eed878aa2b334beea435d30ddfd/ghc >--------------------------------------------------------------- commit 8e929744eb332eed878aa2b334beea435d30ddfd Author: Thomas Miedema Date: Sat May 21 13:11:26 2016 +0200 Testsuite: mark T8761 expect_broken #12077 >--------------------------------------------------------------- 8e929744eb332eed878aa2b334beea435d30ddfd testsuite/tests/th/all.T | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index 1cebbe8..75364dc 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -405,4 +405,5 @@ test('T11809', normal, compile, ['-v0']) test('T11797', normal, compile, ['-v0 -dsuppress-uniques']) test('T11941', normal, compile_fail, ['-v0']) test('T11484', normal, compile, ['-v0']) -test('T8761', normal, compile, ['-v0 -ddump-splices -dsuppress-uniques']) +test('T8761', unless(ghc_dynamic(), expect_broken(12077)), compile, + ['-v0 -ddump-splices -dsuppress-uniques']) From git at git.haskell.org Sat May 21 14:15:15 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 21 May 2016 14:15:15 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: ghc-boot(-th): Fix incorrect 'expose'-property and relax cabal-version (00aa3e6) Message-ID: <20160521141515.E0D1C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/00aa3e6e3f09519a0ce49e32912b24a304cbb745/ghc >--------------------------------------------------------------- commit 00aa3e6e3f09519a0ce49e32912b24a304cbb745 Author: Herbert Valerio Riedel Date: Sat May 21 16:15:10 2016 +0200 ghc-boot(-th): Fix incorrect 'expose'-property and relax cabal-version This is a follow-up to e303d93fecdcb748cd341ca69f803b8201a84f51 >--------------------------------------------------------------- 00aa3e6e3f09519a0ce49e32912b24a304cbb745 libraries/ghc-boot-th/ghc-boot-th.cabal.in | 5 +++-- libraries/ghc-boot/ghc-boot.cabal.in | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/libraries/ghc-boot-th/ghc-boot-th.cabal.in b/libraries/ghc-boot-th/ghc-boot-th.cabal.in index 58d8961..b2172bb 100644 --- a/libraries/ghc-boot-th/ghc-boot-th.cabal.in +++ b/libraries/ghc-boot-th/ghc-boot-th.cabal.in @@ -20,8 +20,6 @@ description: This library contains various bits shared between the @ghc@ and cabal-version: >=1.10 build-type: Simple extra-source-files: changelog.md -exposed: False --- Since this is re-exported by ghc-boot source-repository head type: git @@ -32,6 +30,9 @@ Library default-language: Haskell2010 other-extensions: DeriveGeneric + -- Since this is re-exported by ghc-boot + exposed: False + exposed-modules: GHC.LanguageExtensions.Type GHC.Lexeme diff --git a/libraries/ghc-boot/ghc-boot.cabal.in b/libraries/ghc-boot/ghc-boot.cabal.in index 49b45c1..da2cb32 100644 --- a/libraries/ghc-boot/ghc-boot.cabal.in +++ b/libraries/ghc-boot/ghc-boot.cabal.in @@ -22,7 +22,7 @@ description: This library is shared between GHC, ghc-pkg, and other boot The package database format and this library are constructed in such a way that while ghc-pkg depends on Cabal, the GHC library and program do not have to depend on Cabal. -cabal-version: >=1.22 +cabal-version: >=1.10 build-type: Simple extra-source-files: changelog.md From git at git.haskell.org Sat May 21 16:45:00 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 21 May 2016 16:45:00 +0000 (UTC) Subject: [commit: ghc] master: Fix failing T12010 (a1f3bb8) Message-ID: <20160521164500.DDCD53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a1f3bb8ca454f05fa35cb6b5c64e92f640380802/ghc >--------------------------------------------------------------- commit a1f3bb8ca454f05fa35cb6b5c64e92f640380802 Author: Tamar Christina Date: Sat May 21 10:23:59 2016 -0400 Fix failing T12010 Summary: T12010 seems to be failing because it can't find the correct paths. This gives the test some more qualified paths. Test Plan: make TEST=12010 Reviewers: hvr, bgamari, austin, thomie Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D2252 GHC Trac Issues: #12010 >--------------------------------------------------------------- a1f3bb8ca454f05fa35cb6b5c64e92f640380802 libraries/base/tests/IO/T12010/Makefile | 7 ++++--- libraries/base/tests/IO/T12010/T12010.stdout | 2 -- libraries/base/tests/IO/T12010/test.T | 2 ++ 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/libraries/base/tests/IO/T12010/Makefile b/libraries/base/tests/IO/T12010/Makefile index 112e1f1..b924de2 100644 --- a/libraries/base/tests/IO/T12010/Makefile +++ b/libraries/base/tests/IO/T12010/Makefile @@ -1,10 +1,11 @@ TOP=../../../../../testsuite include $(TOP)/mk/boilerplate.mk include $(TOP)/mk/test.mk +TESTDIR=$(TOP)/../libraries/base/tests/IO/T12010 .PHONY: T12010 T12010: - '$(HSC2HS)' -I ../../../include/ -I ../../../../../includes/ T12010.hsc - '$(TEST_HC)' $(TEST_HC_OPTS) $(WAY_FLAGS) -c cbits/initWinSock.c - '$(TEST_HC)' $(TEST_HC_OPTS) $(WAY_FLAGS) -fno-warn-unsupported-calling-conventions cbits/initWinSock.o T12010.hs + '$(HSC2HS)' -I $(TOP)/../libraries/base/include/ -I $(TOP)/../includes/ T12010.hsc + '$(TEST_HC)' $(TEST_HC_OPTS) $(WAY_FLAGS) -c $(TESTDIR)/cbits/initWinSock.c + '$(TEST_HC)' $(TEST_HC_OPTS) $(WAY_FLAGS) -fno-warn-unsupported-calling-conventions $(TESTDIR)/cbits/initWinSock.o $(TESTDIR)/T12010.hs ./T12010 diff --git a/libraries/base/tests/IO/T12010/T12010.stdout b/libraries/base/tests/IO/T12010/T12010.stdout deleted file mode 100644 index dec7b86..0000000 --- a/libraries/base/tests/IO/T12010/T12010.stdout +++ /dev/null @@ -1,2 +0,0 @@ -[1 of 1] Compiling Main ( T12010.hs, T12010.o ) -Linking T12010 ... diff --git a/libraries/base/tests/IO/T12010/test.T b/libraries/base/tests/IO/T12010/test.T index 178814f..ecf4828 100644 --- a/libraries/base/tests/IO/T12010/test.T +++ b/libraries/base/tests/IO/T12010/test.T @@ -3,6 +3,8 @@ test('T12010', extra_clean(['cbits/initWinSock.o', 'T12010.hi', 'T12010.hs']), only_ways(['threaded1']), extra_ways(['threaded1']), + exit_code(0), + ignore_output, cmd_prefix('WAY_FLAGS="' + ' '.join(config.way_flags('T12010')['threaded1']) + '"')], run_command, ['$MAKE -s --no-print-directory T12010']) From git at git.haskell.org Sat May 21 16:52:36 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 21 May 2016 16:52:36 +0000 (UTC) Subject: [commit: ghc] master: compiler/iface: compress .hi files (d9cb7a8) Message-ID: <20160521165236.77A8E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d9cb7a8a94daa4d20aa042cd053e20b491315633/ghc >--------------------------------------------------------------- commit d9cb7a8a94daa4d20aa042cd053e20b491315633 Author: Austin Seipp Date: Fri May 20 03:25:08 2016 +0000 compiler/iface: compress .hi files Compress all interface files generated by the compiler with LZ4. While being only a tiny amount of code, LZ4 is both fast at compression and decompression, and has good compression ratios. Non-scientific size test: size of stage2 compiler .hi files: `find ./compiler/stage2 -type f -iname '*.hi' -exec du -ch {} + | grep total$` Without this patch: 22MB of .hi files for stage2. With this patch: 9.2MB of .hi files for stage2. Signed-off-by: Austin Seipp Reviewed By: bgamari Differential Revision: https://phabricator.haskell.org/D1159 >--------------------------------------------------------------- d9cb7a8a94daa4d20aa042cd053e20b491315633 compiler/cbits/lz4.c | 1520 ++++++++++++++++++++++++++++++++++++++ compiler/cbits/lz4.h | 364 +++++++++ compiler/ghc.cabal.in | 2 + compiler/ghc.mk | 1 + compiler/utils/Binary.hs | 37 +- compiler/utils/LZ4.hs | 126 ++++ docs/users_guide/8.2.1-notes.rst | 3 +- 7 files changed, 2033 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 d9cb7a8a94daa4d20aa042cd053e20b491315633 From git at git.haskell.org Sat May 21 17:11:12 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 21 May 2016 17:11:12 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: users-guide: Vector version of Thomson-Wheeler logo (62137e2) Message-ID: <20160521171112.441683A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/62137e27a6c22f33ff960a5038e5de59de5f924a/ghc >--------------------------------------------------------------- commit 62137e27a6c22f33ff960a5038e5de59de5f924a Author: Ben Gamari Date: Sat May 21 12:49:27 2016 +0200 users-guide: Vector version of Thomson-Wheeler logo >--------------------------------------------------------------- 62137e27a6c22f33ff960a5038e5de59de5f924a docs/users_guide/images/logo.pdf | Bin 15443 -> 1499 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/docs/users_guide/images/logo.pdf b/docs/users_guide/images/logo.pdf index e20d1da..ad13e72 100644 Binary files a/docs/users_guide/images/logo.pdf and b/docs/users_guide/images/logo.pdf differ From git at git.haskell.org Sat May 21 17:11:14 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 21 May 2016 17:11:14 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: users-guide: Fix index in PDF output (528fb33) Message-ID: <20160521171114.E004D3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/528fb332de50b5719f4e83470cbb3887cd535f1c/ghc >--------------------------------------------------------------- commit 528fb332de50b5719f4e83470cbb3887cd535f1c Author: Ben Gamari Date: Sat May 21 13:20:15 2016 +0200 users-guide: Fix index in PDF output The madness that is latex never ceases to amaze. >--------------------------------------------------------------- 528fb332de50b5719f4e83470cbb3887cd535f1c docs/users_guide/conf.py | 1 + rules/sphinx.mk | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/docs/users_guide/conf.py b/docs/users_guide/conf.py index f9c326e..b2311c4 100644 --- a/docs/users_guide/conf.py +++ b/docs/users_guide/conf.py @@ -66,6 +66,7 @@ latex_elements = { 'utf8extra': '', 'preamble': ''' \usepackage{fontspec} +\usepackage{makeidx} \setsansfont{DejaVu Sans} \setromanfont{DejaVu Serif} \setmonofont{DejaVu Sans Mono} diff --git a/rules/sphinx.mk b/rules/sphinx.mk index 823a2af..f3c46b4 100644 --- a/rules/sphinx.mk +++ b/rules/sphinx.mk @@ -60,6 +60,10 @@ $1/$2.pdf: $1/conf.py $$($1_RST_SOURCES) $(SPHINXBUILD) -b latex -d $1/.doctrees-pdf $(SPHINXOPTS) $1 $1/build-pdf/$2 cd $1/build-pdf/$2 ; xelatex $2.tex cd $1/build-pdf/$2 ; xelatex $2.tex + cd $1/build-pdf/$2 ; xelatex $2.tex + cd $1/build-pdf/$2 ; makeindex $2.idx + cd $1/build-pdf/$2 ; xelatex $2.tex + cd $1/build-pdf/$2 ; xelatex $2.tex cp $1/build-pdf/$2/$2.pdf $1/$2.pdf endif From git at git.haskell.org Sat May 21 17:11:20 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 21 May 2016 17:11:20 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: Rework ANNOUNCE (b2c661c) Message-ID: <20160521171120.3F2533A301@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/b2c661ce5f4de603ae168d365b5b8a172d6c1173/ghc >--------------------------------------------------------------- commit b2c661ce5f4de603ae168d365b5b8a172d6c1173 Author: Ben Gamari Date: Sat May 21 13:47:34 2016 +0200 Rework ANNOUNCE >--------------------------------------------------------------- b2c661ce5f4de603ae168d365b5b8a172d6c1173 ANNOUNCE | 158 ++++++++++++++++++++++++++++++++------------------------------- 1 file changed, 80 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 b2c661ce5f4de603ae168d365b5b8a172d6c1173 From git at git.haskell.org Sat May 21 17:11:17 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 21 May 2016 17:11:17 +0000 (UTC) Subject: [commit: ghc] ghc-8.0: rules/sphinx: Add missing dependency on conf.py for pdf rule (0438321) Message-ID: <20160521171117.8E1AC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : ghc-8.0 Link : http://ghc.haskell.org/trac/ghc/changeset/043832183538e7c0bdecaae2309a673427740ce5/ghc >--------------------------------------------------------------- commit 043832183538e7c0bdecaae2309a673427740ce5 Author: Ben Gamari Date: Sat May 21 13:13:26 2016 +0200 rules/sphinx: Add missing dependency on conf.py for pdf rule >--------------------------------------------------------------- 043832183538e7c0bdecaae2309a673427740ce5 rules/sphinx.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/sphinx.mk b/rules/sphinx.mk index 52fbe28..823a2af 100644 --- a/rules/sphinx.mk +++ b/rules/sphinx.mk @@ -56,7 +56,7 @@ pdf_$1 : $1/$2.pdf pdf : pdf_$1 ifneq "$$(BINDIST)" "YES" -$1/$2.pdf: $$($1_RST_SOURCES) +$1/$2.pdf: $1/conf.py $$($1_RST_SOURCES) $(SPHINXBUILD) -b latex -d $1/.doctrees-pdf $(SPHINXOPTS) $1 $1/build-pdf/$2 cd $1/build-pdf/$2 ; xelatex $2.tex cd $1/build-pdf/$2 ; xelatex $2.tex From git at git.haskell.org Sat May 21 18:14:39 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 21 May 2016 18:14:39 +0000 (UTC) Subject: [commit: ghc] master: Fix deriving Ord when RebindableSyntax is enabled (527ed72) Message-ID: <20160521181439.60C233A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/527ed7246a35fe8bab89c7c582084cd20661018a/ghc >--------------------------------------------------------------- commit 527ed7246a35fe8bab89c7c582084cd20661018a Author: Andrew Farmer Date: Sat May 21 18:38:47 2016 +0200 Fix deriving Ord when RebindableSyntax is enabled Deriving clauses (Ord especially) generated if-expressions with nlHsIf which were subject to RebindableSyntax. This changes nlHsIf to generate concrete if-expressions. There was also an error about calling tagToEnum# at a polymorphic type, which is not allowed. Fixing nlHsIf didn't fix this for some reason, so I generated a type ascription around the call to tagToEnum#. Not sure why the typechecker could not figure this out. Test Plan: Added a test, ran validate. Reviewers: simonpj, simonmar, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2247 GHC Trac Issues: #12080 >--------------------------------------------------------------- 527ed7246a35fe8bab89c7c582084cd20661018a compiler/hsSyn/HsUtils.hs | 7 ++++++- compiler/typecheck/TcGenDeriv.hs | 10 ++++++---- testsuite/tests/rebindable/T12080.hs | 16 ++++++++++++++++ testsuite/tests/rebindable/all.T | 1 + 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/compiler/hsSyn/HsUtils.hs b/compiler/hsSyn/HsUtils.hs index ee34773..6b90f00 100644 --- a/compiler/hsSyn/HsUtils.hs +++ b/compiler/hsSyn/HsUtils.hs @@ -450,7 +450,12 @@ nlList :: [LHsExpr RdrName] -> LHsExpr RdrName nlHsLam match = noLoc (HsLam (mkMatchGroup Generated [match])) nlHsPar e = noLoc (HsPar e) -nlHsIf cond true false = noLoc (mkHsIf cond true false) + +-- Note [Rebindable nlHsIf] +-- nlHsIf should generate if-expressions which are NOT subject to +-- RebindableSyntax, so the first field of HsIf is Nothing. (#12080) +nlHsIf cond true false = noLoc (HsIf Nothing cond true false) + nlHsCase expr matches = noLoc (HsCase expr (mkMatchGroup Generated matches)) nlList exprs = noLoc (ExplicitList placeHolderType Nothing exprs) diff --git a/compiler/typecheck/TcGenDeriv.hs b/compiler/typecheck/TcGenDeriv.hs index 15f0480..4157b02 100644 --- a/compiler/typecheck/TcGenDeriv.hs +++ b/compiler/typecheck/TcGenDeriv.hs @@ -524,11 +524,13 @@ unliftedCompare :: RdrName -> RdrName -> LHsExpr RdrName -- Return (if a < b then lt else if a == b then eq else gt) unliftedCompare lt_op eq_op a_expr b_expr lt eq gt - = nlHsIf (genPrimOpApp a_expr lt_op b_expr) lt $ + = nlHsIf (ascribeBool $ genPrimOpApp a_expr lt_op b_expr) lt $ -- Test (<) first, not (==), because the latter -- is true less often, so putting it first would -- mean more tests (dynamically) - nlHsIf (genPrimOpApp a_expr eq_op b_expr) eq gt + nlHsIf (ascribeBool $ genPrimOpApp a_expr eq_op b_expr) eq gt + where + ascribeBool e = nlExprWithTySig e (toLHsSigWcType boolTy) nlConWildPat :: DataCon -> LPat RdrName -- The pattern (K {}) @@ -2189,8 +2191,8 @@ gen_Newtype_binds loc cls inst_tvs cls_tys rhs_ty `nlExprWithTySig` toLHsSigWcType to_ty - nlExprWithTySig :: LHsExpr RdrName -> LHsSigWcType RdrName -> LHsExpr RdrName - nlExprWithTySig e s = noLoc (ExprWithTySig e s) +nlExprWithTySig :: LHsExpr RdrName -> LHsSigWcType RdrName -> LHsExpr RdrName +nlExprWithTySig e s = noLoc (ExprWithTySig e s) mkCoerceClassMethEqn :: Class -- the class being derived -> [TyVar] -- the tvs in the instance head diff --git a/testsuite/tests/rebindable/T12080.hs b/testsuite/tests/rebindable/T12080.hs new file mode 100644 index 0000000..5413ed0 --- /dev/null +++ b/testsuite/tests/rebindable/T12080.hs @@ -0,0 +1,16 @@ +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE RebindableSyntax #-} + +import Prelude + +class IfThenElse a b where + ifThenElse :: a -> b -> b -> b + +instance IfThenElse Bool b where + ifThenElse c x y = if c then x else y + +data Foo = Foo | Bar | Baz deriving (Eq, Ord) + +main :: IO () +main = print $ Foo < Bar diff --git a/testsuite/tests/rebindable/all.T b/testsuite/tests/rebindable/all.T index b42f884..f1737e9 100644 --- a/testsuite/tests/rebindable/all.T +++ b/testsuite/tests/rebindable/all.T @@ -32,3 +32,4 @@ test('T4851', normal, compile, ['']) test('T5908', normal, compile, ['']) test('T10112', normal, compile, ['']) test('T11216', [expect_broken(11216)], compile, ['']) +test('T12080', normal, compile, ['']) From git at git.haskell.org Sat May 21 18:14:42 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 21 May 2016 18:14:42 +0000 (UTC) Subject: [commit: ghc] master: Enable checkProddableBlock on x86_64 (da3c1eb) Message-ID: <20160521181442.0D9E53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/da3c1ebb8a57e81f12c5be192e477f79158a2398/ghc >--------------------------------------------------------------- commit da3c1ebb8a57e81f12c5be192e477f79158a2398 Author: Simon Marlow Date: Sat May 21 18:36:49 2016 +0200 Enable checkProddableBlock on x86_64 We've been seeing some memory corruption after using the linker, and I want to enable this to see if it catches anything. Test Plan: * validate * modified the linker_unload test to remove the performGC calls to use as a benchmark, saw no significant difference after this change. Reviewers: bgamari, erikd, austin Reviewed By: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2245 >--------------------------------------------------------------- da3c1ebb8a57e81f12c5be192e477f79158a2398 rts/Linker.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rts/Linker.c b/rts/Linker.c index 61b10d8..e867d04 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -4034,7 +4034,7 @@ ocGetNames_PEi386 ( ObjectCode* oc ) if (kind != SECTIONKIND_OTHER && end >= start) { addSection(§ions[i], kind, SECTION_NOMEM, start, sz, 0, 0, 0); - addProddableBlock(oc, start, end - start + 1); + addProddableBlock(oc, start, sz); } stgFree(secname); @@ -5756,7 +5756,7 @@ do_Elf_Rela_relocations ( ObjectCode* oc, char* ehdrC, IF_DEBUG(linker,debugBelch("Reloc: P = %p S = %p A = %p\n", (void*)P, (void*)S, (void*)A )); - /* checkProddableBlock ( oc, (void*)P ); */ + checkProddableBlock(oc, (void*)P, sizeof(Elf_Word)); #if defined(sparc_HOST_ARCH) || defined(powerpc_HOST_ARCH) || defined(x86_64_HOST_ARCH) value = S + A; From git at git.haskell.org Sat May 21 18:14:44 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 21 May 2016 18:14:44 +0000 (UTC) Subject: [commit: ghc] master: rules/sphinx: Add missing dependency on conf.py for pdf rule (6d6d6e4) Message-ID: <20160521181444.ADFA13A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6d6d6e4f47d023f3f6b1b5b3b4a3bad29f8fd98a/ghc >--------------------------------------------------------------- commit 6d6d6e4f47d023f3f6b1b5b3b4a3bad29f8fd98a Author: Ben Gamari Date: Sat May 21 13:13:26 2016 +0200 rules/sphinx: Add missing dependency on conf.py for pdf rule >--------------------------------------------------------------- 6d6d6e4f47d023f3f6b1b5b3b4a3bad29f8fd98a rules/sphinx.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/sphinx.mk b/rules/sphinx.mk index 52fbe28..823a2af 100644 --- a/rules/sphinx.mk +++ b/rules/sphinx.mk @@ -56,7 +56,7 @@ pdf_$1 : $1/$2.pdf pdf : pdf_$1 ifneq "$$(BINDIST)" "YES" -$1/$2.pdf: $$($1_RST_SOURCES) +$1/$2.pdf: $1/conf.py $$($1_RST_SOURCES) $(SPHINXBUILD) -b latex -d $1/.doctrees-pdf $(SPHINXOPTS) $1 $1/build-pdf/$2 cd $1/build-pdf/$2 ; xelatex $2.tex cd $1/build-pdf/$2 ; xelatex $2.tex From git at git.haskell.org Sat May 21 18:14:47 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 21 May 2016 18:14:47 +0000 (UTC) Subject: [commit: ghc] master: users-guide: Fix index in PDF output (cf1efc7) Message-ID: <20160521181447.5A8183A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cf1efc7f0f97f272645af93491ca890137df3704/ghc >--------------------------------------------------------------- commit cf1efc7f0f97f272645af93491ca890137df3704 Author: Ben Gamari Date: Sat May 21 13:20:15 2016 +0200 users-guide: Fix index in PDF output The madness that is latex never ceases to amaze. >--------------------------------------------------------------- cf1efc7f0f97f272645af93491ca890137df3704 docs/users_guide/conf.py | 1 + rules/sphinx.mk | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/docs/users_guide/conf.py b/docs/users_guide/conf.py index f9c326e..b2311c4 100644 --- a/docs/users_guide/conf.py +++ b/docs/users_guide/conf.py @@ -66,6 +66,7 @@ latex_elements = { 'utf8extra': '', 'preamble': ''' \usepackage{fontspec} +\usepackage{makeidx} \setsansfont{DejaVu Sans} \setromanfont{DejaVu Serif} \setmonofont{DejaVu Sans Mono} diff --git a/rules/sphinx.mk b/rules/sphinx.mk index 823a2af..f3c46b4 100644 --- a/rules/sphinx.mk +++ b/rules/sphinx.mk @@ -60,6 +60,10 @@ $1/$2.pdf: $1/conf.py $$($1_RST_SOURCES) $(SPHINXBUILD) -b latex -d $1/.doctrees-pdf $(SPHINXOPTS) $1 $1/build-pdf/$2 cd $1/build-pdf/$2 ; xelatex $2.tex cd $1/build-pdf/$2 ; xelatex $2.tex + cd $1/build-pdf/$2 ; xelatex $2.tex + cd $1/build-pdf/$2 ; makeindex $2.idx + cd $1/build-pdf/$2 ; xelatex $2.tex + cd $1/build-pdf/$2 ; xelatex $2.tex cp $1/build-pdf/$2/$2.pdf $1/$2.pdf endif From git at git.haskell.org Sat May 21 18:14:50 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 21 May 2016 18:14:50 +0000 (UTC) Subject: [commit: ghc] master: users-guide: Vector version of Thomson-Wheeler logo (e44a6f9) Message-ID: <20160521181450.148E83A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e44a6f9deb4a789c059097ee8d8764911d7b6878/ghc >--------------------------------------------------------------- commit e44a6f9deb4a789c059097ee8d8764911d7b6878 Author: Ben Gamari Date: Sat May 21 12:49:27 2016 +0200 users-guide: Vector version of Thomson-Wheeler logo >--------------------------------------------------------------- e44a6f9deb4a789c059097ee8d8764911d7b6878 docs/users_guide/images/logo.pdf | Bin 15443 -> 1499 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/docs/users_guide/images/logo.pdf b/docs/users_guide/images/logo.pdf index e20d1da..ad13e72 100644 Binary files a/docs/users_guide/images/logo.pdf and b/docs/users_guide/images/logo.pdf differ From git at git.haskell.org Sun May 22 08:12:11 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 22 May 2016 08:12:11 +0000 (UTC) Subject: [commit: ghc] master: Build system: temp solution for parallelisation bug (#11960) (c81e7b2) Message-ID: <20160522081211.259013A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/c81e7b2014e284774eecf5e48e42aab31892cec1/ghc >--------------------------------------------------------------- commit c81e7b2014e284774eecf5e48e42aab31892cec1 Author: Thomas Miedema Date: Sun May 22 10:14:44 2016 +0200 Build system: temp solution for parallelisation bug (#11960) >--------------------------------------------------------------- c81e7b2014e284774eecf5e48e42aab31892cec1 libffi/ghc.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libffi/ghc.mk b/libffi/ghc.mk index 404cce9..7c5bc9e 100644 --- a/libffi/ghc.mk +++ b/libffi/ghc.mk @@ -111,7 +111,8 @@ $(libffi_STAMP_CONFIGURE): $(TOUCH_DEP) "$(TOUCH_CMD)" $@ $(libffi_STAMP_BUILD): $(libffi_STAMP_CONFIGURE) $(TOUCH_DEP) - $(MAKE) -C libffi/build MAKEFLAGS= + # Use 'sync' as a temporary solution for #11960 (parallelisation bug). + sync; $(MAKE) -C libffi/build MAKEFLAGS= "$(TOUCH_CMD)" $@ $(libffi_STAMP_INSTALL): $(libffi_STAMP_BUILD) $(TOUCH_DEP) From git at git.haskell.org Sun May 22 08:58:01 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 22 May 2016 08:58:01 +0000 (UTC) Subject: [commit: ghc] master: Use `setSession` instead of `modifySession` when setting `HscEnv` (f669764) Message-ID: <20160522085801.507A33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f669764f74ec6973ce62fa3488c3fefdd393212b/ghc >--------------------------------------------------------------- commit f669764f74ec6973ce62fa3488c3fefdd393212b Author: ?mer Sinan A?acan Date: Sun May 22 05:00:51 2016 -0400 Use `setSession` instead of `modifySession` when setting `HscEnv` Reviewers: austin, hvr, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2253 >--------------------------------------------------------------- f669764f74ec6973ce62fa3488c3fefdd393212b compiler/ghci/Debugger.hs | 2 +- compiler/main/GhcMake.hs | 2 +- compiler/main/InteractiveEval.hs | 16 ++++++++-------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/compiler/ghci/Debugger.hs b/compiler/ghci/Debugger.hs index 6424472..acc900f 100644 --- a/compiler/ghci/Debugger.hs +++ b/compiler/ghci/Debugger.hs @@ -121,7 +121,7 @@ bindSuspensions t = do new_ic = extendInteractiveContextWithIds ictxt ids fhvs <- liftIO $ mapM (mkFinalizedHValue hsc_env <=< mkRemoteRef) hvals liftIO $ extendLinkEnv (zip names fhvs) - modifySession $ \_ -> hsc_env {hsc_IC = new_ic } + setSession hsc_env {hsc_IC = new_ic } return t' where diff --git a/compiler/main/GhcMake.hs b/compiler/main/GhcMake.hs index 46a4990..af78065 100644 --- a/compiler/main/GhcMake.hs +++ b/compiler/main/GhcMake.hs @@ -122,7 +122,7 @@ depanal excluded_mods allow_dup_roots = do mod_graphE <- liftIO $ downsweep hsc_env old_graph excluded_mods allow_dup_roots mod_graph <- reportImportErrors mod_graphE - modifySession $ \_ -> hsc_env { hsc_mod_graph = mod_graph } + setSession hsc_env { hsc_mod_graph = mod_graph } return mod_graph -- | Describes which modules of the module graph need to be loaded. diff --git a/compiler/main/InteractiveEval.hs b/compiler/main/InteractiveEval.hs index e2b4c68..e564288 100644 --- a/compiler/main/InteractiveEval.hs +++ b/compiler/main/InteractiveEval.hs @@ -246,7 +246,7 @@ runDeclsWithLocation source linenumber expr = setSession $ hsc_env { hsc_IC = ic } hsc_env <- getSession hsc_env' <- liftIO $ rttiEnvironment hsc_env - modifySession (\_ -> hsc_env') + setSession hsc_env' return $ filter (not . isDerivedOccName . nameOccName) -- For this filter, see Note [What to show to users] $ map getName tyThings @@ -356,7 +356,7 @@ handleRunStatus step expr bindings final_ids status history , resumeHistoryIx = 0 } hsc_env2 = pushResume hsc_env1 resume - modifySession (\_ -> hsc_env2) + setSession hsc_env2 return (ExecBreak names bp) -- Completed successfully @@ -366,7 +366,7 @@ handleRunStatus step expr bindings final_ids status history final_names = map getName final_ids liftIO $ Linker.extendLinkEnv (zip final_names hvals) hsc_env' <- liftIO $ rttiEnvironment hsc_env{hsc_IC=final_ic} - modifySession (\_ -> hsc_env') + setSession hsc_env' return (ExecComplete (Right final_names) allocs) -- Completed with an exception @@ -398,7 +398,7 @@ resumeExec canLogSpan step ic' = ic { ic_tythings = resume_tmp_te, ic_rn_gbl_env = resume_rdr_env, ic_resume = rs } - modifySession (\_ -> hsc_env{ hsc_IC = ic' }) + setSession hsc_env{ hsc_IC = ic' } -- remove any bindings created since the breakpoint from the -- linker's environment @@ -455,7 +455,7 @@ moveHist fn = do r' = r { resumeHistoryIx = new_ix } ic' = ic { ic_resume = r':rs } - modifySession (\_ -> hsc_env1{ hsc_IC = ic' }) + setSession hsc_env1{ hsc_IC = ic' } return (names, new_ix, span, decl) @@ -634,7 +634,7 @@ abandon = do case resume of [] -> return False r:rs -> do - modifySession $ \_ -> hsc_env{ hsc_IC = ic { ic_resume = rs } } + setSession hsc_env{ hsc_IC = ic { ic_resume = rs } } liftIO $ abandonStmt hsc_env (resumeContext r) return True @@ -646,7 +646,7 @@ abandonAll = do case resume of [] -> return False rs -> do - modifySession $ \_ -> hsc_env{ hsc_IC = ic { ic_resume = [] } } + setSession hsc_env{ hsc_IC = ic { ic_resume = [] } } liftIO $ mapM_ (abandonStmt hsc_env. resumeContext) rs return True @@ -697,7 +697,7 @@ setContext imports Right all_env -> do { ; let old_ic = hsc_IC hsc_env !final_rdr_env = all_env `icExtendGblRdrEnv` ic_tythings old_ic - ; modifySession $ \_ -> + ; setSession hsc_env{ hsc_IC = old_ic { ic_imports = imports , ic_rn_gbl_env = final_rdr_env }}}} where From git at git.haskell.org Sun May 22 09:43:57 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 22 May 2016 09:43:57 +0000 (UTC) Subject: [commit: ghc] master: rts/Linker.c: Fix compile error on Arm (a70a6da) Message-ID: <20160522094357.DA0FE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/a70a6da91d982f9d966cc694e37cdbb807aeafe9/ghc >--------------------------------------------------------------- commit a70a6da91d982f9d966cc694e37cdbb807aeafe9 Author: Erik de Castro Lopo Date: Sun May 22 17:59:18 2016 +1000 rts/Linker.c: Fix compile error on Arm Commit da3c1ebb8a left Arm with a compile error. This is a short term fixup pending a much more through fix of removing as much CPP hackery as possible. Test Plan: Validate on arm and x86_64 Reviewers: simonmar, austin, hsyl20, bgamari, Phyx Reviewed By: Phyx Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2254 >--------------------------------------------------------------- a70a6da91d982f9d966cc694e37cdbb807aeafe9 rts/Linker.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rts/Linker.c b/rts/Linker.c index e867d04..9deefca 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -5754,9 +5754,12 @@ do_Elf_Rela_relocations ( ObjectCode* oc, char* ehdrC, IF_DEBUG(linker,debugBelch( "`%s' resolves to %p\n", symbol, (void*)S )); } +#if defined(DEBUG) || defined(sparc_HOST_ARCH) || defined(powerpc_HOST_ARCH) \ + || defined(x86_64_HOST_ARCH) IF_DEBUG(linker,debugBelch("Reloc: P = %p S = %p A = %p\n", (void*)P, (void*)S, (void*)A )); checkProddableBlock(oc, (void*)P, sizeof(Elf_Word)); +#endif #if defined(sparc_HOST_ARCH) || defined(powerpc_HOST_ARCH) || defined(x86_64_HOST_ARCH) value = S + A; From git at git.haskell.org Sun May 22 16:36:16 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 22 May 2016 16:36:16 +0000 (UTC) Subject: [commit: ghc] master: Update format specifiers for Tickey.c (fa58710) Message-ID: <20160522163616.D39303A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fa58710feef38337230bf9d69670dcad2d3c1fb1/ghc >--------------------------------------------------------------- commit fa58710feef38337230bf9d69670dcad2d3c1fb1 Author: Tamar Christina Date: Sun May 22 11:13:11 2016 +0200 Update format specifiers for Tickey.c Summary: all `tot_` values in `Tickey.c` are `unsigned long` but are being printed as `%ld` instead of `%lu`. Test Plan: ./validate Reviewers: austin, bgamari, simonmar, erikd Reviewed By: erikd Subscribers: thomie, #ghc_windows_task_force Differential Revision: https://phabricator.haskell.org/D2251 >--------------------------------------------------------------- fa58710feef38337230bf9d69670dcad2d3c1fb1 rts/Ticky.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/rts/Ticky.c b/rts/Ticky.c index b854e9e..44d49b6 100644 --- a/rts/Ticky.c +++ b/rts/Ticky.c @@ -95,17 +95,17 @@ PrintTickyInfo(void) fprintf(tf,"\nSTACK USAGE:\n"); /* NB: some bits are direction sensitive */ - fprintf(tf,"\nENTERS: %ld of which %ld (%.1f%%) direct to the entry code\n\t\t [the rest indirected via Node's info ptr]\n", + fprintf(tf,"\nENTERS: %lu of which %lu (%.1f%%) direct to the entry code\n\t\t [the rest indirected via Node's info ptr]\n", tot_enters, jump_direct_enters, PC(INTAVG(jump_direct_enters,tot_enters))); - fprintf(tf,"%11ld (%5.1f%%) thunks\n", + fprintf(tf,"%11lu (%5.1f%%) thunks\n", tot_thk_enters, PC(INTAVG(tot_thk_enters,tot_enters))); - fprintf(tf,"%11ld (%5.1f%%) data values\n", + fprintf(tf, "%11lu (%5.1f%%) data values\n", tot_con_enters, PC(INTAVG(tot_con_enters,tot_enters))); - fprintf(tf,"%11ld (%5.1f%%) normal indirections\n", + fprintf(tf, "%11lu (%5.1f%%) normal indirections\n", tot_ind_enters, PC(INTAVG(tot_ind_enters,tot_enters))); fprintf(tf,"%11" FMT_Int " (%5.1f%%) permanent indirections\n", @@ -113,9 +113,9 @@ PrintTickyInfo(void) PC(INTAVG(ENT_PERM_IND_ctr,tot_enters))); - fprintf(tf,"\nFUNCTION ENTRIES: %ld\n", tot_fun_direct_enters); + fprintf(tf, "\nFUNCTION ENTRIES: %lu\n", tot_fun_direct_enters); - fprintf(tf, "\nTAIL CALLS: %ld, of which %ld (%.lf%%) were to known functions\n", + fprintf(tf, "\nTAIL CALLS: %lu, of which %lu (%.lf%%) were to known functions\n", tot_tail_calls, tot_known_calls, PC(INTAVG(tot_known_calls,tot_tail_calls))); @@ -129,8 +129,8 @@ PrintTickyInfo(void) SLOW_CALL_PAP_TOO_FEW_ctr, SLOW_CALL_PAP_CORRECT_ctr, SLOW_CALL_PAP_TOO_MANY_ctr); fprintf(tf, "\n"); - fprintf(tf,"\nRETURNS: %ld\n", tot_returns); - fprintf(tf,"%11ld (%5.1f%%) from entering a new constructor\n\t\t [the rest from entering an existing constructor]\n", + fprintf(tf, "\nRETURNS: %lu\n", tot_returns); + fprintf(tf, "%11lu (%5.1f%%) from entering a new constructor\n\t\t [the rest from entering an existing constructor]\n", tot_returns_of_new, PC(INTAVG(tot_returns_of_new,tot_returns))); @@ -167,12 +167,12 @@ PrintTickyInfo(void) } fprintf(tf,"\nUPDATES: %ld\n", tot_updates); - fprintf(tf,"%11ld (%5.1f%%) data values\n\t\t [%" FMT_Int " in place, %" FMT_Int " allocated new space]\n", + fprintf(tf, "%11lu (%5.1f%%) data values\n\t\t [%" FMT_Int " in place, %" FMT_Int " allocated new space]\n", con_updates, PC(INTAVG(con_updates,tot_updates)), UPD_CON_IN_PLACE_ctr, UPD_CON_IN_NEW_ctr); - fprintf(tf,"%11ld (%5.1f%%) partial applications\n\t\t [%" FMT_Int " in place, %" FMT_Int " allocated new space]\n", + fprintf(tf, "%11lu (%5.1f%%) partial applications\n\t\t [%" FMT_Int " in place, %" FMT_Int " allocated new space]\n", pap_updates, PC(INTAVG(pap_updates,tot_updates)), UPD_PAP_IN_PLACE_ctr, UPD_PAP_IN_NEW_ctr); @@ -182,10 +182,10 @@ PrintTickyInfo(void) PC(INTAVG(UPD_SQUEEZED_ctr, tot_updates))); if (tot_gengc_updates != 0) { - fprintf(tf,"\nNEW GEN UPDATES: %9ld (%5.1f%%)\n", + fprintf(tf, "\nNEW GEN UPDATES: %9lu (%5.1f%%)\n", tot_new_updates, PC(INTAVG(tot_new_updates,tot_gengc_updates))); - fprintf(tf,"OLD GEN UPDATES: %9ld (%5.1f%%)\n", + fprintf(tf, "OLD GEN UPDATES: %9lu (%5.1f%%)\n", tot_old_updates, PC(INTAVG(tot_old_updates,tot_gengc_updates))); } @@ -207,7 +207,7 @@ PrintTickyInfo(void) if (b) { fprintf(tf,"%11" FMT_Int " " #ctr "\n", ctr); } else { fprintf(tf,"%11" FMT_Int " " msg "\n", ctr); } #define PR_HST(hst,i) \ - do { fprintf(tf,"%11ld " #hst "_" #i "\n", hst[i]); } while(0) + do { fprintf(tf,"%11" FMT_Int " " #hst "_" #i "\n", hst[i]); } while(0) ALLOC_HEAP_ctr = (StgInt)ALLOC_HEAP_ctr + (StgInt)ALLOC_RTS_ctr; ALLOC_HEAP_tot = (StgInt)ALLOC_HEAP_tot + (StgInt)ALLOC_RTS_tot; From git at git.haskell.org Sun May 22 17:20:38 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 22 May 2016 17:20:38 +0000 (UTC) Subject: [commit: nofib] master: Fix: #12084 deprecate old profiling flags (35fc121) Message-ID: <20160522172038.369D43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/nofib On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/35fc121fc8cc501ea2713c579a053be7ea65b16e/nofib >--------------------------------------------------------------- commit 35fc121fc8cc501ea2713c579a053be7ea65b16e Author: Seraphime Kirkovski Date: Sun May 22 17:47:26 2016 +0200 Fix: #12084 deprecate old profiling flags >--------------------------------------------------------------- 35fc121fc8cc501ea2713c579a053be7ea65b16e fibon/Hackage/Funsat/bitset/bitset.cabal | 2 +- fibon/Hackage/Funsat/parse-dimacs/parse-dimacs.cabal | 2 +- fibon/Hackage/Funsat/parsec/parsec.cabal | 2 +- fibon/Hackage/Regex/bitset/bitset.cabal | 2 +- fibon/Hackage/Regex/regex-base/regex-base.cabal | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fibon/Hackage/Funsat/bitset/bitset.cabal b/fibon/Hackage/Funsat/bitset/bitset.cabal index af0d6e2..f9a5067 100644 --- a/fibon/Hackage/Funsat/bitset/bitset.cabal +++ b/fibon/Hackage/Funsat/bitset/bitset.cabal @@ -16,5 +16,5 @@ Build-type: Simple Exposed-modules: Data.BitSet Ghc-options: -Wall -Ghc-prof-options: -prof -auto-all +Ghc-prof-options: -prof -fprof-auto Extra-source-files: tests/Properties.hs diff --git a/fibon/Hackage/Funsat/parse-dimacs/parse-dimacs.cabal b/fibon/Hackage/Funsat/parse-dimacs/parse-dimacs.cabal index 3f36e3a..e595ae2 100644 --- a/fibon/Hackage/Funsat/parse-dimacs/parse-dimacs.cabal +++ b/fibon/Hackage/Funsat/parse-dimacs/parse-dimacs.cabal @@ -26,7 +26,7 @@ Extra-source-files: CHANGES -- -fwarn-incomplete-patterns -- -fwarn-dodgy-imports -fwarn-incomplete-record-updates -- -fwarn-unused-binds -fwarn-unused-imports --- Ghc-prof-options: -auto-all +-- Ghc-prof-options: -fprof-auto -- Hs-source-dirs: . tests -- Other-modules: Language.CNF.Parse.ParseDIMACS diff --git a/fibon/Hackage/Funsat/parsec/parsec.cabal b/fibon/Hackage/Funsat/parsec/parsec.cabal index 59c9723..4d848f9 100644 --- a/fibon/Hackage/Funsat/parsec/parsec.cabal +++ b/fibon/Hackage/Funsat/parsec/parsec.cabal @@ -53,4 +53,4 @@ library build-depends: mtl, bytestring extensions: ExistentialQuantification, PolymorphicComponents, MultiParamTypeClasses, FlexibleInstances, FlexibleContexts, DeriveDataTypeable ghc-options: -O2 - ghc-prof-options: -auto-all + ghc-prof-options: -fprof-auto diff --git a/fibon/Hackage/Regex/bitset/bitset.cabal b/fibon/Hackage/Regex/bitset/bitset.cabal index eb8d4ae..8c3bc1f 100644 --- a/fibon/Hackage/Regex/bitset/bitset.cabal +++ b/fibon/Hackage/Regex/bitset/bitset.cabal @@ -19,5 +19,5 @@ Exposed-modules: Data.BitSet Build-depends: base >= 4.0.0 Extensions: ScopedTypeVariables, DeriveDataTypeable Ghc-options: -Wall -O2 -Ghc-prof-options: -prof -auto-all +Ghc-prof-options: -prof -fprof-auto Extra-source-files: tests/Properties.hs diff --git a/fibon/Hackage/Regex/regex-base/regex-base.cabal b/fibon/Hackage/Regex/regex-base/regex-base.cabal index 2595171..9ccdccf 100644 --- a/fibon/Hackage/Regex/regex-base/regex-base.cabal +++ b/fibon/Hackage/Regex/regex-base/regex-base.cabal @@ -45,7 +45,7 @@ library GHC-Options: -Wall -O2 -- GHC-Options: -Wall -Werror -O2 -- GHC-Options: -Wall -ddump-minimal-GHC - -- imports-Prof-Options: -auto-all + -- imports-Prof-Options: -fprof-auto -- Hugs-Options: -- NHC-Options: -- Includes: From git at git.haskell.org Sun May 22 18:48:31 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 22 May 2016 18:48:31 +0000 (UTC) Subject: [commit: ghc] master: Testsuite: fix T12010 for real (2230c88) Message-ID: <20160522184831.9FB173A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/2230c8822233d6d68f930170cd51d96169649056/ghc >--------------------------------------------------------------- commit 2230c8822233d6d68f930170cd51d96169649056 Author: Thomas Miedema Date: Sun May 22 14:41:48 2016 +0200 Testsuite: fix T12010 for real * Use `extra_files` instead of (the deprecated) `extra_clean` (#11980). * Don't depend on generated files from build tree (libraries/base/include/HsBaseConfig.h). Running 'make test TEST=T12010' should work, even without building GHC first (it will use the system installed ghc). Test Plan: 'make test TEST=T12010' on Linux and Windows. Reviewed by: Phyx Differential Revision: https://phabricator.haskell.org/D2256 GHC Trac Issues: #12010 >--------------------------------------------------------------- 2230c8822233d6d68f930170cd51d96169649056 libraries/base/tests/IO/T12010/Makefile | 7 +++---- libraries/base/tests/IO/T12010/T12010.hsc | 7 +++---- libraries/base/tests/IO/T12010/test.T | 4 +--- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/libraries/base/tests/IO/T12010/Makefile b/libraries/base/tests/IO/T12010/Makefile index b924de2..ac7a13c 100644 --- a/libraries/base/tests/IO/T12010/Makefile +++ b/libraries/base/tests/IO/T12010/Makefile @@ -1,11 +1,10 @@ TOP=../../../../../testsuite include $(TOP)/mk/boilerplate.mk include $(TOP)/mk/test.mk -TESTDIR=$(TOP)/../libraries/base/tests/IO/T12010 .PHONY: T12010 T12010: - '$(HSC2HS)' -I $(TOP)/../libraries/base/include/ -I $(TOP)/../includes/ T12010.hsc - '$(TEST_HC)' $(TEST_HC_OPTS) $(WAY_FLAGS) -c $(TESTDIR)/cbits/initWinSock.c - '$(TEST_HC)' $(TEST_HC_OPTS) $(WAY_FLAGS) -fno-warn-unsupported-calling-conventions $(TESTDIR)/cbits/initWinSock.o $(TESTDIR)/T12010.hs + '$(HSC2HS)' T12010.hsc + '$(TEST_HC)' $(TEST_HC_OPTS) $(WAY_FLAGS) -c cbits/initWinSock.c + '$(TEST_HC)' $(TEST_HC_OPTS) $(WAY_FLAGS) -v0 -fno-warn-unsupported-calling-conventions cbits/initWinSock.o T12010.hs ./T12010 diff --git a/libraries/base/tests/IO/T12010/T12010.hsc b/libraries/base/tests/IO/T12010/T12010.hsc index fa566e0..e13a5fe 100644 --- a/libraries/base/tests/IO/T12010/T12010.hsc +++ b/libraries/base/tests/IO/T12010/T12010.hsc @@ -7,10 +7,9 @@ import Foreign.Marshal.Alloc import GHC.IO.FD import System.Exit --- HsBase includes WinSock on Windows, on POSIX we need to explicitly ask for --- sockets. -#include "HsBase.h" -#ifndef _WIN32 +#ifdef _WIN32 +#include +#else #include #endif diff --git a/libraries/base/tests/IO/T12010/test.T b/libraries/base/tests/IO/T12010/test.T index ecf4828..b7b64c7 100644 --- a/libraries/base/tests/IO/T12010/test.T +++ b/libraries/base/tests/IO/T12010/test.T @@ -1,10 +1,8 @@ test('T12010', [ - extra_clean(['cbits/initWinSock.o', 'T12010.hi', 'T12010.hs']), + extra_files(['cbits/']), only_ways(['threaded1']), extra_ways(['threaded1']), - exit_code(0), - ignore_output, cmd_prefix('WAY_FLAGS="' + ' '.join(config.way_flags('T12010')['threaded1']) + '"')], run_command, ['$MAKE -s --no-print-directory T12010']) From git at git.haskell.org Mon May 23 12:19:34 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 23 May 2016 12:19:34 +0000 (UTC) Subject: [commit: ghc] master: Allow unlifted types in pattern synonym result type (8c9b8a3) Message-ID: <20160523121934.A2FFC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8c9b8a31dd9e085704ecac3361a64f196a0bc09d/ghc >--------------------------------------------------------------- commit 8c9b8a31dd9e085704ecac3361a64f196a0bc09d Author: Matthew Pickering Date: Sun May 22 11:52:26 2016 +0100 Allow unlifted types in pattern synonym result type Fixes #12094 Test Plan: ./validate Reviewers: austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2255 GHC Trac Issues: #12094 >--------------------------------------------------------------- 8c9b8a31dd9e085704ecac3361a64f196a0bc09d compiler/typecheck/TcPatSyn.hs | 4 +++- testsuite/tests/patsyn/should_compile/T12094.hs | 8 ++++++++ testsuite/tests/patsyn/should_compile/all.T | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/compiler/typecheck/TcPatSyn.hs b/compiler/typecheck/TcPatSyn.hs index 8c577cf..8763774 100644 --- a/compiler/typecheck/TcPatSyn.hs +++ b/compiler/typecheck/TcPatSyn.hs @@ -113,7 +113,9 @@ tcPatSynSig name sig_ty do { req <- tcHsContext hs_req ; prov <- tcHsContext hs_prov ; arg_tys <- mapM tcHsOpenType (hs_arg_tys :: [LHsType Name]) - ; body_ty <- tcHsLiftedType hs_body_ty + -- A (literal) pattern can be unlifted; + -- -- e.g. pattern Zero <- 0# (Trac #12094) + ; body_ty <- tcHsOpenType hs_body_ty ; let bound_tvs = unionVarSets [ allBoundVariabless req , allBoundVariabless prov diff --git a/testsuite/tests/patsyn/should_compile/T12094.hs b/testsuite/tests/patsyn/should_compile/T12094.hs new file mode 100644 index 0000000..5b4e6b4 --- /dev/null +++ b/testsuite/tests/patsyn/should_compile/T12094.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE MagicHash #-} +{-# LANGUAGE PatternSynonyms #-} +module T12094 where + +import GHC.Exts (Int#) + +pattern Zero :: Int# -- commenting out this line works +pattern Zero <- 0# diff --git a/testsuite/tests/patsyn/should_compile/all.T b/testsuite/tests/patsyn/should_compile/all.T index d2f6809..035cd00 100644 --- a/testsuite/tests/patsyn/should_compile/all.T +++ b/testsuite/tests/patsyn/should_compile/all.T @@ -53,3 +53,4 @@ test('T11367', normal, compile, ['']) test('T11351', normal, compile, ['']) test('T11633', normal, compile, ['']) test('T11959', expect_broken(11959), multimod_compile, ['T11959', '-v0']) +test('T12094', normal, compile, ['']) From git at git.haskell.org Mon May 23 13:50:56 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 23 May 2016 13:50:56 +0000 (UTC) Subject: [commit: ghc] master: Fix build by removing unused import. (d835ee6) Message-ID: <20160523135056.A3E4A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d835ee6208119d62bbdfa2915ba1bfc0558e9045/ghc >--------------------------------------------------------------- commit d835ee6208119d62bbdfa2915ba1bfc0558e9045 Author: Matthew Pickering Date: Mon May 23 14:53:39 2016 +0100 Fix build by removing unused import. >--------------------------------------------------------------- d835ee6208119d62bbdfa2915ba1bfc0558e9045 compiler/typecheck/TcPatSyn.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/typecheck/TcPatSyn.hs b/compiler/typecheck/TcPatSyn.hs index 8763774..260a3f2 100644 --- a/compiler/typecheck/TcPatSyn.hs +++ b/compiler/typecheck/TcPatSyn.hs @@ -14,7 +14,7 @@ module TcPatSyn ( tcPatSynSig, tcInferPatSynDecl, tcCheckPatSynDecl import HsSyn import TcPat import TcHsType( tcImplicitTKBndrs, tcExplicitTKBndrs - , tcHsContext, tcHsLiftedType, tcHsOpenType, kindGeneralize ) + , tcHsContext, tcHsOpenType, kindGeneralize ) import Type( binderVar, mkNamedBinders, binderVisibility , tidyTyCoVarBndrs, tidyTypes, tidyType ) import TcRnMonad From git at git.haskell.org Mon May 23 14:04:24 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 23 May 2016 14:04:24 +0000 (UTC) Subject: [commit: ghc] master: testsuite: Update max_bytes_used for T4029 (785b38f) Message-ID: <20160523140424.1890E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/785b38ff4326f3cd9cf2097bf9967e7fd66995cd/ghc >--------------------------------------------------------------- commit 785b38ff4326f3cd9cf2097bf9967e7fd66995cd Author: Ben Gamari Date: Mon May 23 14:41:44 2016 +0200 testsuite: Update max_bytes_used for T4029 >--------------------------------------------------------------- 785b38ff4326f3cd9cf2097bf9967e7fd66995cd testsuite/tests/perf/space_leaks/all.T | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/testsuite/tests/perf/space_leaks/all.T b/testsuite/tests/perf/space_leaks/all.T index 4904289..e3597df 100644 --- a/testsuite/tests/perf/space_leaks/all.T +++ b/testsuite/tests/perf/space_leaks/all.T @@ -57,12 +57,15 @@ test('T4018', test('T4029', [stats_num_field('peak_megabytes_allocated', - [(wordsize(64), 66, 10)]), + [(wordsize(64), 82, 10)]), # 2016-02-26: 66 (amd64/Linux) INITIAL + # 2016-05-23: 82 (amd64/Linux) Use -G1 stats_num_field('max_bytes_used', - [(wordsize(64), 25542832, 5)]) + [(wordsize(64), 25247216, 5)]), # 2016-02-26: 24071720 (amd64/Linux) INITIAL # 2016-04-21: 25542832 (amd64/Linux) + # 2016-05-23: 25247216 (amd64/Linux) Use -G1 + extra_hc_opts('+RTS -G1 -RTS' ), ], ghci_script, ['T4029.script']) From git at git.haskell.org Mon May 23 15:20:26 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 23 May 2016 15:20:26 +0000 (UTC) Subject: [commit: ghc] master: Revert "compiler/iface: compress .hi files" (9bb2772) Message-ID: <20160523152026.8474B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9bb277269ec020f138fe70a65f5972466113ab61/ghc >--------------------------------------------------------------- commit 9bb277269ec020f138fe70a65f5972466113ab61 Author: Ben Gamari Date: Mon May 23 15:32:12 2016 +0200 Revert "compiler/iface: compress .hi files" This appears to cause validation issues on, TEST="T11108 T9071 T11076 T7600 T7672 T8329 T10420 T10322 T8308 T4114a T4114c T10602 T10110 T9204 T2435 T9838 T4114d T10233 T8696 T1735 T5281 T6056 T10134 T9580 T6018 T9762 T8103" With compiler panics of the form, Compile failed (status 256) errors were: ghc: panic! (the 'impossible' happened) (GHC version 8.1.20160523 for x86_64-unknown-linux): Binary.readBinMem: decompression failed CallStack (from HasCallStack): error, called at compiler/utils/Binary.hs:192:16 in ghc:Binary Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug This reverts commit d9cb7a8a94daa4d20aa042cd053e20b491315633. >--------------------------------------------------------------- 9bb277269ec020f138fe70a65f5972466113ab61 compiler/cbits/lz4.c | 1520 -------------------------------------- compiler/cbits/lz4.h | 364 --------- compiler/ghc.cabal.in | 2 - compiler/ghc.mk | 1 - compiler/utils/Binary.hs | 37 +- compiler/utils/LZ4.hs | 126 ---- docs/users_guide/8.2.1-notes.rst | 3 +- 7 files changed, 20 insertions(+), 2033 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 9bb277269ec020f138fe70a65f5972466113ab61 From git at git.haskell.org Tue May 24 07:01:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 24 May 2016 07:01:23 +0000 (UTC) Subject: [commit: ghc] master: Suppress the warning about __sync_fetch_and_nand (#9678) (4f5b335) Message-ID: <20160524070123.ED7DA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4f5b33529b9e13b49a3ee00e9116b0edc9df1234/ghc >--------------------------------------------------------------- commit 4f5b33529b9e13b49a3ee00e9116b0edc9df1234 Author: Thomas Miedema Date: Tue May 24 00:35:33 2016 +0200 Suppress the warning about __sync_fetch_and_nand (#9678) >--------------------------------------------------------------- 4f5b33529b9e13b49a3ee00e9116b0edc9df1234 aclocal.m4 | 3 +++ mk/config.mk.in | 1 + mk/warnings.mk | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/aclocal.m4 b/aclocal.m4 index 1c9c49f..dcc3448 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1252,6 +1252,7 @@ then AC_MSG_ERROR([gcc is required]) fi GccLT34=NO +GccLT44=NO GccLT46=NO AC_CACHE_CHECK([version of gcc], [fp_cv_gcc_version], [ @@ -1262,10 +1263,12 @@ AC_CACHE_CHECK([version of gcc], [fp_cv_gcc_version], # isn't a very good reason for that, but for now just make configure # fail. FP_COMPARE_VERSIONS([$fp_cv_gcc_version], [-lt], [3.4], GccLT34=YES) + FP_COMPARE_VERSIONS([$fp_cv_gcc_version], [-lt], [4.4], GccLT44=YES) FP_COMPARE_VERSIONS([$fp_cv_gcc_version], [-lt], [4.6], GccLT46=YES) ]) AC_SUBST([GccVersion], [$fp_cv_gcc_version]) AC_SUBST(GccLT34) +AC_SUBST(GccLT44) AC_SUBST(GccLT46) ])# FP_GCC_VERSION diff --git a/mk/config.mk.in b/mk/config.mk.in index 6d97463..5dbde02 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -525,6 +525,7 @@ endif # the necessary format to pass to libffi's configure. TargetPlatformFull = @TargetPlatformFull@ GccLT34 = @GccLT34@ +GccLT44 = @GccLT44@ GccLT46 = @GccLT46@ GccIsClang = @GccIsClang@ diff --git a/mk/warnings.mk b/mk/warnings.mk index b1e4bbd..61d60ab 100644 --- a/mk/warnings.mk +++ b/mk/warnings.mk @@ -25,6 +25,11 @@ endif SRC_CC_WARNING_OPTS += -Wno-error=inline endif +ifeq "$(GccLT44)" "NO" +# Suppress the warning about __sync_fetch_and_nand (#9678). +libraries/ghc-prim/cbits/atomic_CC_OPTS += -Wno-sync-nand +endif + else # Don't warn about unknown GCC pragmas when using clang From git at git.haskell.org Tue May 24 08:47:10 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 24 May 2016 08:47:10 +0000 (UTC) Subject: [commit: ghc] master: Don't split the arg types in a PatSyn signature (03d8960) Message-ID: <20160524084710.2475E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/03d8960388d64f5d5c9617dd0e21555e9e987e26/ghc >--------------------------------------------------------------- commit 03d8960388d64f5d5c9617dd0e21555e9e987e26 Author: Simon Peyton Jones Date: Thu May 19 15:02:09 2016 +0100 Don't split the arg types in a PatSyn signature This patch fixes Trac #11977, and #12108, rather satisfactorily maily by deleting code! pattern P :: Eq a => a -> a -> Int The idea is simply /not/ to split the bit after the '=>' into the pattern argument types, but to keep the (a->a->Int) part un-decomposed, in the patsig_body_ty field of a TcPatSynInfo. There is one awkward wrinkle, which is that we can't split the implicitly-bound type variables into existential and universal until we know which types are arguments and which are part of the result. So we postpone the decision until we have the declaration in hand. See TcPatSyn Note [The pattern-synonym signature splitting rule] >--------------------------------------------------------------- 03d8960388d64f5d5c9617dd0e21555e9e987e26 compiler/typecheck/TcExpr.hs | 2 +- compiler/typecheck/TcPatSyn.hs | 177 +++++++++++++----------- compiler/typecheck/TcRnTypes.hs | 16 ++- compiler/typecheck/TcType.hs | 32 +++-- testsuite/tests/patsyn/should_compile/T11977.hs | 8 ++ testsuite/tests/patsyn/should_compile/T12108.hs | 8 ++ testsuite/tests/patsyn/should_compile/all.T | 2 + 7 files changed, 145 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 03d8960388d64f5d5c9617dd0e21555e9e987e26 From git at git.haskell.org Tue May 24 08:47:12 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 24 May 2016 08:47:12 +0000 (UTC) Subject: [commit: ghc] master: Spelling in comment (eb8eb02) Message-ID: <20160524084712.C03C53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/eb8eb02bff129223783178fe36251eb69ff74079/ghc >--------------------------------------------------------------- commit eb8eb02bff129223783178fe36251eb69ff74079 Author: Simon Peyton Jones Date: Mon May 23 10:46:26 2016 +0100 Spelling in comment >--------------------------------------------------------------- eb8eb02bff129223783178fe36251eb69ff74079 compiler/typecheck/FamInst.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/typecheck/FamInst.hs b/compiler/typecheck/FamInst.hs index de1f302..69a1100 100644 --- a/compiler/typecheck/FamInst.hs +++ b/compiler/typecheck/FamInst.hs @@ -275,7 +275,7 @@ tcTopNormaliseNewTypeTF_maybe faminsts rdr_env ty stepper = unwrap_newtype `composeSteppers` unwrap_newtype_instance -- For newtype instances we take a double step or nothing, so that - -- we don't return the reprsentation type of the newtype instance, + -- we don't return the representation type of the newtype instance, -- which would lead to terrible error messages unwrap_newtype_instance rec_nts tc tys | Just (tc', tys', co) <- tcLookupDataFamInst_maybe faminsts tc tys From git at git.haskell.org Tue May 24 08:47:15 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 24 May 2016 08:47:15 +0000 (UTC) Subject: [commit: ghc] master: Remove unused Type.splitFunTysN (839b424) Message-ID: <20160524084715.66D993A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/839b4248ccca9e1374a06f03a8ac3d26847b16f7/ghc >--------------------------------------------------------------- commit 839b4248ccca9e1374a06f03a8ac3d26847b16f7 Author: Simon Peyton Jones Date: Mon May 23 10:46:47 2016 +0100 Remove unused Type.splitFunTysN >--------------------------------------------------------------- 839b4248ccca9e1374a06f03a8ac3d26847b16f7 compiler/types/Type.hs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/compiler/types/Type.hs b/compiler/types/Type.hs index e3169f7..ecf1f36 100644 --- a/compiler/types/Type.hs +++ b/compiler/types/Type.hs @@ -25,8 +25,7 @@ module Type ( splitAppTy_maybe, repSplitAppTy_maybe, tcRepSplitAppTy_maybe, mkFunTy, mkFunTys, splitFunTy, splitFunTy_maybe, - splitFunTys, splitFunTysN, - funResultTy, funArgTy, + splitFunTys, funResultTy, funArgTy, mkTyConApp, mkTyConTy, tyConAppTyCon_maybe, tyConAppTyConPicky_maybe, @@ -809,14 +808,6 @@ splitFunTys ty = split [] ty ty split args _ (ForAllTy (Anon arg) res) = split (arg:args) res res split args orig_ty _ = (reverse args, orig_ty) -splitFunTysN :: Int -> Type -> ([Type], Type) --- ^ Split off exactly the given number argument types, and panics if that is not possible -splitFunTysN 0 ty = ([], ty) -splitFunTysN n ty = ASSERT2( isFunTy ty, int n <+> ppr ty ) - case splitFunTy ty of { (arg, res) -> - case splitFunTysN (n-1) res of { (args, res) -> - (arg:args, res) }} - funResultTy :: Type -> Type -- ^ Extract the function result type and panic if that is not possible funResultTy ty | Just ty' <- coreView ty = funResultTy ty' From git at git.haskell.org Tue May 24 08:47:18 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 24 May 2016 08:47:18 +0000 (UTC) Subject: [commit: ghc] master: Comments only (9c3e55b) Message-ID: <20160524084718.1BFA43A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9c3e55bd029447d9c2cac1c9ca1607a8a803cd79/ghc >--------------------------------------------------------------- commit 9c3e55bd029447d9c2cac1c9ca1607a8a803cd79 Author: Simon Peyton Jones Date: Mon May 23 16:27:08 2016 +0100 Comments only >--------------------------------------------------------------- 9c3e55bd029447d9c2cac1c9ca1607a8a803cd79 compiler/simplStg/UnariseStg.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/simplStg/UnariseStg.hs b/compiler/simplStg/UnariseStg.hs index c2d73a5..4c8a665 100644 --- a/compiler/simplStg/UnariseStg.hs +++ b/compiler/simplStg/UnariseStg.hs @@ -12,7 +12,8 @@ f (x :: (# Int, Bool #)) = f x + f (# 1, True #) f (x1 :: Int) (x2 :: Bool) = f x1 x2 + f 1 True It is important that we do this at the STG level and NOT at the core level -because it would be very hard to make this pass Core-type-preserving. +because it would be very hard to make this pass Core-type-preserving. In +this example the type of 'f' changes, for example. STG fed to the code generators *must* be unarised because the code generators do not support unboxed tuple binders natively. From git at git.haskell.org Tue May 24 09:47:38 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 24 May 2016 09:47:38 +0000 (UTC) Subject: [commit: ghc] master: Testsuite: delete check_files_written (35053eb) Message-ID: <20160524094738.CB29E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/35053eb6c3f9058020f9818bf0de672aef6894c9/ghc >--------------------------------------------------------------- commit 35053eb6c3f9058020f9818bf0de672aef6894c9 Author: Thomas Miedema Date: Tue Feb 2 19:07:51 2016 +0100 Testsuite: delete check_files_written The CHECK_FILES_WRITTEN feature is no longer necessary, since tests don't write to the source directory anymore (#11980). Reviewed by: bgamari Differential Revision: https://phabricator.haskell.org/D2162 >--------------------------------------------------------------- 35053eb6c3f9058020f9818bf0de672aef6894c9 testsuite/driver/runtests.py | 3 - testsuite/driver/testglobals.py | 3 - testsuite/driver/testlib.py | 180 +--------------------------------------- testsuite/mk/test.mk | 4 - 4 files changed, 1 insertion(+), 189 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 35053eb6c3f9058020f9818bf0de672aef6894c9 From git at git.haskell.org Tue May 24 10:56:23 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 24 May 2016 10:56:23 +0000 (UTC) Subject: [commit: ghc] master: Spelling (1bf5c12) Message-ID: <20160524105623.DC5973A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1bf5c126c028285911138454689ea8068a7f9c37/ghc >--------------------------------------------------------------- commit 1bf5c126c028285911138454689ea8068a7f9c37 Author: Gabor Greif Date: Tue May 24 12:58:18 2016 +0200 Spelling >--------------------------------------------------------------- 1bf5c126c028285911138454689ea8068a7f9c37 compiler/basicTypes/PatSyn.hs | 2 +- docs/users_guide/glasgow_exts.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/basicTypes/PatSyn.hs b/compiler/basicTypes/PatSyn.hs index b54a11d..e3fdd09 100644 --- a/compiler/basicTypes/PatSyn.hs +++ b/compiler/basicTypes/PatSyn.hs @@ -245,7 +245,7 @@ This means that when typechecking an occurrence of P in an expression, we must remember that the builder has this void argument. This is done by TcPatSyn.patSynBuilderOcc. -Note [Patterns synonyms and the data type Type] +Note [Pattern synonyms and the data type Type] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The type of a pattern synonym is of the form (See Note [Pattern synonym signatures]): diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index 0e9b799..8abb218 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -4306,7 +4306,7 @@ all currently bundled constructors. For example, we could write: :: in which case, ``Example`` would export the type constructor ``MyNum`` with the data constructor ``MkNum`` and also the pattern synonym ``Zero``. -Bundled patterns synonyms are type checked to ensure that they are of the same +Bundled pattern synonyms are type checked to ensure that they are of the same type as the type constructor which they are bundled with. A pattern synonym ``P`` can not be bundled with a type constructor ``T`` if ``P``\'s type is visibly incompatible with ``T``. From git at git.haskell.org Tue May 24 10:59:43 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 24 May 2016 10:59:43 +0000 (UTC) Subject: [commit: ghc] master: Add support for unicode TH quotes (#11743) (8f7d016) Message-ID: <20160524105943.8E5EC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8f7d01632cd79957fe42ea37103ca9b91a1c54f5/ghc >--------------------------------------------------------------- commit 8f7d01632cd79957fe42ea37103ca9b91a1c54f5 Author: Josh Price Date: Tue May 24 12:35:21 2016 +0200 Add support for unicode TH quotes (#11743) I've also added cases for `IToparenbar` and `ITcparenbar` (aka banana brackets) to `isUnicode`. Document unicode TH quote alternatives (#11743) Test Plan: ./validate Reviewers: austin, goldfire, bgamari Reviewed By: bgamari Subscribers: thomie, mpickering Differential Revision: https://phabricator.haskell.org/D2185 GHC Trac Issues: #11743 >--------------------------------------------------------------- 8f7d01632cd79957fe42ea37103ca9b91a1c54f5 compiler/parser/Lexer.x | 42 +++++++++------ compiler/parser/Parser.y | 32 +++++++----- docs/users_guide/glasgow_exts.rst | 60 ++++++++++++---------- testsuite/tests/parser/unicode/all.T | 2 +- testsuite/tests/parser/unicode/arrowsyntax.hs | 34 ------------ .../arrowform1.hs => parser/unicode/brackets.hs} | 23 +++++++-- 6 files changed, 96 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 8f7d01632cd79957fe42ea37103ca9b91a1c54f5 From git at git.haskell.org Tue May 24 11:17:17 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 24 May 2016 11:17:17 +0000 (UTC) Subject: [commit: ghc] wip/erikd/linker: Runtime linker: Break m32 allocator out into its own file (15318c4) Message-ID: <20160524111717.397203A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/linker Link : http://ghc.haskell.org/trac/ghc/changeset/15318c4de1d976ecf1034178922ad33087dccdd6/ghc >--------------------------------------------------------------- commit 15318c4de1d976ecf1034178922ad33087dccdd6 Author: Erik de Castro Lopo Date: Tue May 24 19:26:56 2016 +1000 Runtime linker: Break m32 allocator out into its own file This makes the code a little more modular and allows the removal of some CPP hackery. By providing dummy implementations of of the `m32_*` functions (which simply call `errorBelch`) it means that the call sites for these functions are syntax checked even when `RTS_LINKER_USE_MMAP` is `0`. Also changes some size parameter types from `unsigned int` to `size_t`. Test Plan: Validate on Linux, OS X and Windows Reviewers: Phyx, hsyl20, bgamari, simonmar, austin Reviewed By: simonmar, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2237 >--------------------------------------------------------------- 15318c4de1d976ecf1034178922ad33087dccdd6 rts/Linker.c | 321 ++-------------------------------------------- rts/ghc.mk | 2 +- rts/linker/M32Alloc.c | 345 ++++++++++++++++++++++++++++++++++++++++++++++++++ rts/linker/M32Alloc.h | 47 +++++++ rts/posix/OSMem.c | 12 +- rts/sm/OSMem.h | 17 ++- rts/win32/OSMem.c | 12 +- 7 files changed, 435 insertions(+), 321 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 15318c4de1d976ecf1034178922ad33087dccdd6 From git at git.haskell.org Tue May 24 11:17:19 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 24 May 2016 11:17:19 +0000 (UTC) Subject: [commit: ghc] wip/erikd/linker's head updated: Runtime linker: Break m32 allocator out into its own file (15318c4) Message-ID: <20160524111719.8516B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/erikd/linker' now includes: ae7e9cb Fix Windows build after Ticky changes 8e92974 Testsuite: mark T8761 expect_broken #12077 a1f3bb8 Fix failing T12010 d9cb7a8 compiler/iface: compress .hi files e44a6f9 users-guide: Vector version of Thomson-Wheeler logo 6d6d6e4 rules/sphinx: Add missing dependency on conf.py for pdf rule cf1efc7 users-guide: Fix index in PDF output da3c1eb Enable checkProddableBlock on x86_64 527ed72 Fix deriving Ord when RebindableSyntax is enabled c81e7b2 Build system: temp solution for parallelisation bug (#11960) f669764 Use `setSession` instead of `modifySession` when setting `HscEnv` a70a6da rts/Linker.c: Fix compile error on Arm fa58710 Update format specifiers for Tickey.c 2230c88 Testsuite: fix T12010 for real 8c9b8a3 Allow unlifted types in pattern synonym result type d835ee6 Fix build by removing unused import. 785b38f testsuite: Update max_bytes_used for T4029 9bb2772 Revert "compiler/iface: compress .hi files" 4f5b335 Suppress the warning about __sync_fetch_and_nand (#9678) 03d8960 Don't split the arg types in a PatSyn signature eb8eb02 Spelling in comment 839b424 Remove unused Type.splitFunTysN 9c3e55b Comments only 15318c4 Runtime linker: Break m32 allocator out into its own file From git at git.haskell.org Tue May 24 11:31:14 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 24 May 2016 11:31:14 +0000 (UTC) Subject: [commit: ghc] master: Document some benign nondeterminism (4c6e69d) Message-ID: <20160524113115.002663A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/4c6e69d58a300d6ef440d326a3fd29b58b284fa1/ghc >--------------------------------------------------------------- commit 4c6e69d58a300d6ef440d326a3fd29b58b284fa1 Author: Bartosz Nitka Date: Tue May 24 02:56:59 2016 -0700 Document some benign nondeterminism I've changed the functions to their nonDet equivalents and explained why they're OK there. This allowed me to remove foldNameSet, foldVarEnv, foldVarEnv_Directly, foldVarSet and foldUFM_Directly. Test Plan: ./validate, there should be no change in behavior Reviewers: simonpj, simonmar, austin, goldfire, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2244 GHC Trac Issues: #4012 >--------------------------------------------------------------- 4c6e69d58a300d6ef440d326a3fd29b58b284fa1 compiler/basicTypes/DataCon.hs | 5 ++-- compiler/basicTypes/Demand.hs | 14 ++++++++--- compiler/basicTypes/NameEnv.hs | 5 +--- compiler/basicTypes/NameSet.hs | 4 +--- compiler/basicTypes/VarEnv.hs | 12 ++-------- compiler/basicTypes/VarSet.hs | 4 +--- compiler/codeGen/StgCmmEnv.hs | 4 +++- compiler/deSugar/Desugar.hs | 4 +++- compiler/main/HscMain.hs | 4 +++- compiler/rename/RnSource.hs | 4 +++- compiler/simplCore/OccurAnal.hs | 10 +++++--- compiler/simplCore/SetLevels.hs | 5 ++-- compiler/specialise/Rules.hs | 4 +++- compiler/typecheck/TcSimplify.hs | 5 +++- compiler/types/Coercion.hs | 6 ++++- compiler/types/TyCoRep.hs | 4 +++- compiler/types/Unify.hs | 14 ++++++++--- compiler/utils/FastStringEnv.hs | 5 +--- compiler/utils/UniqFM.hs | 51 ++++++++++++++++++++-------------------- 19 files changed, 93 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 4c6e69d58a300d6ef440d326a3fd29b58b284fa1 From git at git.haskell.org Tue May 24 12:41:40 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 24 May 2016 12:41:40 +0000 (UTC) Subject: [commit: ghc] master: Make Arrow desugaring deterministic (9d06ef1) Message-ID: <20160524124140.D9C093A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/9d06ef1ae451a145607301dc7556931b537a7d83/ghc >--------------------------------------------------------------- commit 9d06ef1ae451a145607301dc7556931b537a7d83 Author: Bartosz Nitka Date: Tue May 24 04:44:37 2016 -0700 Make Arrow desugaring deterministic This kills two instances of varSetElems that turned out to be nondeterministic. I've tried to untangle this before, but it's a bit hard with the fixDs in the middle. Fortunately I now have a test case that proves that we need determinism here. Test Plan: ./validate, new testcase Reviewers: simonpj, simonmar, austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2258 GHC Trac Issues: #4012 >--------------------------------------------------------------- 9d06ef1ae451a145607301dc7556931b537a7d83 compiler/coreSyn/CoreFVs.hs | 33 ++++++++++++ compiler/deSugar/DsArrows.hs | 63 +++++++++++----------- compiler/utils/UniqDFM.hs | 7 ++- testsuite/driver/extra_files.py | 1 + testsuite/tests/determinism/determ018/A.hs | 32 +++++++++++ .../determinism/{determ010 => determ018}/Makefile | 6 +-- .../determinism/{determ003 => determ018}/all.T | 4 +- .../determ018.stdout} | 0 8 files changed, 109 insertions(+), 37 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 9d06ef1ae451a145607301dc7556931b537a7d83 From git at git.haskell.org Tue May 24 13:19:11 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 24 May 2016 13:19:11 +0000 (UTC) Subject: [commit: ghc] master: Remove 'deriving Typeable' statements (95dfdce) Message-ID: <20160524131911.12A013A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/95dfdceb8b4dcc54a366949577d9ee389bad5bc3/ghc >--------------------------------------------------------------- commit 95dfdceb8b4dcc54a366949577d9ee389bad5bc3 Author: Ryan Scott Date: Tue May 24 09:22:04 2016 -0400 Remove 'deriving Typeable' statements Summary: Deriving `Typeable` has been a no-op since GHC 7.10, and now that we require 7.10+ to build GHC, we can remove all the redundant `deriving Typeable` statements in GHC. Test Plan: ./validate Reviewers: goldfire, austin, hvr, bgamari Reviewed By: austin, hvr, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2260 >--------------------------------------------------------------- 95dfdceb8b4dcc54a366949577d9ee389bad5bc3 compiler/basicTypes/Avail.hs | 2 - compiler/basicTypes/BasicTypes.hs | 32 +++---- compiler/basicTypes/ConLike.hs | 4 +- compiler/basicTypes/DataCon.hs | 10 +-- compiler/basicTypes/FieldLabel.hs | 2 +- compiler/basicTypes/Literal.hs | 4 +- compiler/basicTypes/Module.hs | 6 +- compiler/basicTypes/Name.hs | 2 - compiler/basicTypes/OccName.hs | 3 +- compiler/basicTypes/PatSyn.hs | 4 +- compiler/basicTypes/RdrName.hs | 12 +-- compiler/basicTypes/SrcLoc.hs | 8 +- compiler/basicTypes/Var.hs | 3 +- compiler/coreSyn/CoreSyn.hs | 10 +-- compiler/hsSyn/HsBinds.hs | 21 ++--- compiler/hsSyn/HsDecls.hs | 47 +++------- compiler/hsSyn/HsDoc.hs | 2 +- compiler/hsSyn/HsExpr.hs | 34 +++---- compiler/hsSyn/HsImpExp.hs | 6 +- compiler/hsSyn/HsLit.hs | 5 +- compiler/hsSyn/HsPat.hs | 5 +- compiler/hsSyn/HsSyn.hs | 1 - compiler/hsSyn/HsTypes.hs | 18 +--- compiler/hsSyn/PlaceHolder.hs | 2 +- compiler/main/HscTypes.hs | 5 +- compiler/parser/ApiAnnotation.hs | 8 +- compiler/prelude/ForeignCall.hs | 12 +-- compiler/profiling/CostCentre.hs | 4 +- compiler/typecheck/TcDeriv.hs | 4 +- compiler/typecheck/TcEvidence.hs | 12 ++- compiler/types/Class.hs | 4 +- compiler/types/CoAxiom.hs | 10 +-- compiler/types/Coercion.hs | 2 +- compiler/types/InstEnv.hs | 4 +- compiler/types/TyCoRep.hs | 15 ++-- compiler/types/TyCon.hs | 4 +- compiler/utils/Bag.hs | 3 +- compiler/utils/BooleanFormula.hs | 2 +- compiler/utils/FastString.hs | 4 +- compiler/utils/IOEnv.hs | 3 - compiler/utils/Panic.hs | 4 +- compiler/utils/UniqDFM.hs | 5 +- libraries/base/Data/Semigroup.hs | 14 +-- libraries/base/GHC/Exception.hs | 6 +- libraries/ghci/GHCi/TH.hs | 2 +- .../template-haskell/Language/Haskell/TH/Syntax.hs | 100 ++++++++++----------- 46 files changed, 189 insertions(+), 281 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 95dfdceb8b4dcc54a366949577d9ee389bad5bc3 From git at git.haskell.org Tue May 24 21:41:35 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 24 May 2016 21:41:35 +0000 (UTC) Subject: [commit: ghc] master: Runtime linker: Break m32 allocator out into its own file (fe8a4e5) Message-ID: <20160524214135.D42303A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/fe8a4e5d77ef8b2bdb2e7e87d50eb477c94bce43/ghc >--------------------------------------------------------------- commit fe8a4e5d77ef8b2bdb2e7e87d50eb477c94bce43 Author: Erik de Castro Lopo Date: Tue May 24 19:26:56 2016 +1000 Runtime linker: Break m32 allocator out into its own file This makes the code a little more modular and allows the removal of some CPP hackery. By providing dummy implementations of of the `m32_*` functions (which simply call `errorBelch`) it means that the call sites for these functions are syntax checked even when `RTS_LINKER_USE_MMAP` is `0`. Also changes some size parameter types from `unsigned int` to `size_t`. Test Plan: Validate on Linux, OS X and Windows Reviewers: Phyx, hsyl20, bgamari, simonmar, austin Reviewed By: simonmar, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2237 >--------------------------------------------------------------- fe8a4e5d77ef8b2bdb2e7e87d50eb477c94bce43 rts/Linker.c | 321 ++-------------------------------------------- rts/ghc.mk | 2 +- rts/linker/M32Alloc.c | 345 ++++++++++++++++++++++++++++++++++++++++++++++++++ rts/linker/M32Alloc.h | 47 +++++++ rts/posix/OSMem.c | 12 +- rts/sm/OSMem.h | 17 ++- rts/win32/OSMem.c | 12 +- 7 files changed, 435 insertions(+), 321 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc fe8a4e5d77ef8b2bdb2e7e87d50eb477c94bce43 From git at git.haskell.org Tue May 24 21:45:59 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 24 May 2016 21:45:59 +0000 (UTC) Subject: [commit: ghc] master: Always use native-Haskell de/encoders for ASCII and latin1 (1319363) Message-ID: <20160524214559.486583A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1319363f7633c441bdb1f659616d71ecd700076d/ghc >--------------------------------------------------------------- commit 1319363f7633c441bdb1f659616d71ecd700076d Author: Thomas Miedema Date: Tue May 24 11:31:45 2016 +0200 Always use native-Haskell de/encoders for ASCII and latin1 This fixes test encoding005 on Windows (#10623). Reviewed by: austin, bgamari Differential Revision: https://phabricator.haskell.org/D2262 >--------------------------------------------------------------- 1319363f7633c441bdb1f659616d71ecd700076d libraries/base/GHC/IO/Encoding.hs | 34 +++++++++++++++++------------- libraries/base/tests/IO/all.T | 3 +-- libraries/base/tests/IO/encoding005.hs | 16 +++++++------- libraries/base/tests/IO/encoding005.stdout | 2 +- 4 files changed, 29 insertions(+), 26 deletions(-) diff --git a/libraries/base/GHC/IO/Encoding.hs b/libraries/base/GHC/IO/Encoding.hs index 18b5432..578a420 100644 --- a/libraries/base/GHC/IO/Encoding.hs +++ b/libraries/base/GHC/IO/Encoding.hs @@ -245,8 +245,16 @@ mkTextEncoding' cfm enc = "UTF32" -> return $ UTF32.mkUTF32 cfm "UTF32LE" -> return $ UTF32.mkUTF32le cfm "UTF32BE" -> return $ UTF32.mkUTF32be cfm - -- ISO8859-1 we can handle ourselves as well - "ISO88591" -> return $ Latin1.mkLatin1 cfm + -- On AIX, we want to avoid iconv, because it is either + -- a) totally broken, or b) non-reentrant, or c) actually works. + -- Detecting b) is difficult as you'd have to trigger the reentrancy + -- corruption. + -- Therefore, on AIX, we handle the popular ASCII and latin1 encodings + -- ourselves. For consistency, we do the same on other platforms. + -- We use `mkLatin1_checked` instead of `mkLatin1`, since the latter + -- completely ignores the CodingFailureMode (TEST=encoding005). + _ | isAscii -> return (Latin1.mkAscii cfm) + _ | isLatin1 -> return (Latin1.mkLatin1_checked cfm) #if defined(mingw32_HOST_OS) 'C':'P':n | [(cp,"")] <- reads n -> return $ CodePage.mkCodePageEncoding cfm cp _ -> unknownEncodingErr (enc ++ codingFailureModeSuffix cfm) @@ -256,25 +264,21 @@ mkTextEncoding' cfm enc = -- Unfortunately there is no good way to determine whether iconv is actually -- functional without telling it to do something. _ -> do res <- Iconv.mkIconvEncoding cfm enc - let isAscii = any (== enc) ansiEncNames case res of Just e -> return e - -- At this point we know that we can't count on iconv to work - -- (see, for instance, Trac #10298). However, we still want to do - -- what we can to work with what we have. For instance, ASCII is - -- easy. We match on ASCII encodings directly using several - -- possible aliases (specified by RFC 1345 & Co) and for this use - -- the 'ascii' encoding - Nothing - | isAscii -> return (Latin1.mkAscii cfm) - | otherwise -> - unknownEncodingErr (enc ++ codingFailureModeSuffix cfm) + Nothing -> unknownEncodingErr (enc ++ codingFailureModeSuffix cfm) +#endif where - ansiEncNames = -- ASCII aliases + isAscii = enc `elem` asciiEncNames + isLatin1 = enc `elem` latin1EncNames + asciiEncNames = -- ASCII aliases specified by RFC 1345 and RFC 3808. [ "ANSI_X3.4-1968", "iso-ir-6", "ANSI_X3.4-1986", "ISO_646.irv:1991" , "US-ASCII", "us", "IBM367", "cp367", "csASCII", "ASCII", "ISO646-US" ] -#endif + latin1EncNames = -- latin1 aliases specified by RFC 1345 and RFC 3808. + [ "ISO_8859-1:1987", "iso-ir-100", "ISO_8859-1", "ISO-8859-1", "latin1", + "l1", "IBM819", "CP819", "csISOLatin1" + ] latin1_encode :: CharBuffer -> Buffer Word8 -> IO (CharBuffer, Buffer Word8) diff --git a/libraries/base/tests/IO/all.T b/libraries/base/tests/IO/all.T index d04f3c4..295553f 100644 --- a/libraries/base/tests/IO/all.T +++ b/libraries/base/tests/IO/all.T @@ -138,8 +138,7 @@ test('encoding001', test('encoding002', normal, compile_and_run, ['']) test('encoding003', normal, compile_and_run, ['']) test('encoding004', normal, compile_and_run, ['']) -test('encoding005', when(opsys('mingw32'), expect_broken(10623)), - compile_and_run, ['']) +test('encoding005', normal, compile_and_run, ['']) test('environment001', [extra_clean(['environment001'])], diff --git a/libraries/base/tests/IO/encoding005.hs b/libraries/base/tests/IO/encoding005.hs index 99db84a..b4ee381 100644 --- a/libraries/base/tests/IO/encoding005.hs +++ b/libraries/base/tests/IO/encoding005.hs @@ -44,9 +44,9 @@ test_latin1 cfm enc = do ErrorOnCodingFailure -> Nothing IgnoreCodingFailure -> Just [0xfe,0xff,0xff,0xfe] TransliterateCodingFailure -> Just [0xfe,0xff,0x3f,0x3f,0x3f,0xff,0xfe] - -- N.B. The argument "LATIN1//TRANSLIT" to mkTextEncoding does not - -- correspond to "LATIN1//TRANSLIT" in iconv! Instead GHC asks iconv - -- to encode to "LATIN1" and uses its own "evil hack" to insert '?' + -- N.B. The argument "latin1//TRANSLIT" to mkTextEncoding does not + -- correspond to "latin1//TRANSLIT" in iconv! Instead GHC asks iconv + -- to encode to "latin1" and uses its own "evil hack" to insert '?' -- (ASCII 0x3f) in place of failures. See GHC.IO.Encoding.recoverEncode. -- -- U+0100 is LATIN CAPITAL LETTER A WITH MACRON, which iconv would @@ -108,8 +108,8 @@ main = do test_ascii TransliterateCodingFailure =<< mkTextEncoding "ASCII//TRANSLIT" test_ascii RoundtripFailure =<< mkTextEncoding "ASCII//ROUNDTRIP" - putStrLn "mkTextEncoding LATIN1 tests" - test_latin1 ErrorOnCodingFailure =<< mkTextEncoding "LATIN1" - test_latin1 IgnoreCodingFailure =<< mkTextEncoding "LATIN1//IGNORE" - test_latin1 TransliterateCodingFailure =<< mkTextEncoding "LATIN1//TRANSLIT" - test_latin1 RoundtripFailure =<< mkTextEncoding "LATIN1//ROUNDTRIP" + putStrLn "mkTextEncoding latin1 tests" + test_latin1 ErrorOnCodingFailure =<< mkTextEncoding "latin1" + test_latin1 IgnoreCodingFailure =<< mkTextEncoding "latin1//IGNORE" + test_latin1 TransliterateCodingFailure =<< mkTextEncoding "latin1//TRANSLIT" + test_latin1 RoundtripFailure =<< mkTextEncoding "latin1//ROUNDTRIP" diff --git a/libraries/base/tests/IO/encoding005.stdout b/libraries/base/tests/IO/encoding005.stdout index 664a193..e7995b1 100644 --- a/libraries/base/tests/IO/encoding005.stdout +++ b/libraries/base/tests/IO/encoding005.stdout @@ -2,4 +2,4 @@ char8 tests Latin1.ascii tests Latin1.latin1_checked tests mkTextEncoding ASCII tests -mkTextEncoding LATIN1 tests +mkTextEncoding latin1 tests From git at git.haskell.org Tue May 24 21:46:01 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 24 May 2016 21:46:01 +0000 (UTC) Subject: [commit: ghc] master: Fix: #12084 deprecate old profiling flags (1956cbf) Message-ID: <20160524214602.0031B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1956cbf13bd2138500daebd5f1f0a4931d8710ec/ghc >--------------------------------------------------------------- commit 1956cbf13bd2138500daebd5f1f0a4931d8710ec Author: Seraphime Kirkovski Date: Tue May 24 22:30:09 2016 +0200 Fix: #12084 deprecate old profiling flags Change help message so it doesn't specify -auto-all. Make old profiling flags deprecated as they are no longer documented. Update Makefile and documentation accordingly. Update release notes for ghc 8.2 Test Plan: ./verify; `ghc --help` shouldn't specify the -auto-all flag. Furthermore `ghc -fprof -auto-all` should emit a warning Reviewed By: thomie, austin Differential Revision: https://phabricator.haskell.org/D2257 GHC Trac Issues: #12084 Update submodule nofib >--------------------------------------------------------------- 1956cbf13bd2138500daebd5f1f0a4931d8710ec compiler/main/DynFlags.hs | 30 ++++++++++++++--------- compiler/profiling/NOTES | 6 +++-- docs/storage-mgt/rp.tex | 6 ++--- docs/users_guide/8.2.1-notes.rst | 4 +++ docs/users_guide/separate_compilation.rst | 2 +- driver/ghc-usage.txt | 2 +- nofib | 2 +- testsuite/config/ghc | 22 ++++++++--------- testsuite/tests/profiling/should_compile/all.T | 6 ++--- testsuite/tests/profiling/should_fail/all.T | 2 +- testsuite/tests/profiling/should_run/Makefile | 2 +- testsuite/tests/profiling/should_run/all.T | 2 +- testsuite/tests/stranal/should_compile/all.T | 2 +- testsuite/tests/stranal/should_compile/newtype.hs | 2 +- testsuite/tests/th/Makefile | 4 +-- 15 files changed, 53 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 1956cbf13bd2138500daebd5f1f0a4931d8710ec From git at git.haskell.org Tue May 24 21:46:04 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 24 May 2016 21:46:04 +0000 (UTC) Subject: [commit: ghc] master: Testsuite: delete drvfail015.stderr-7.0 [skip ci] (31f1804) Message-ID: <20160524214604.9A6E03A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/31f180438ee21962591fe186787970dec643b719/ghc >--------------------------------------------------------------- commit 31f180438ee21962591fe186787970dec643b719 Author: Thomas Miedema Date: Tue May 24 22:32:07 2016 +0200 Testsuite: delete drvfail015.stderr-7.0 [skip ci] Running the testsuite with ghc-7.0 is not supported. >--------------------------------------------------------------- 31f180438ee21962591fe186787970dec643b719 testsuite/tests/deriving/should_fail/drvfail015.stderr-7.0 | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/testsuite/tests/deriving/should_fail/drvfail015.stderr-7.0 b/testsuite/tests/deriving/should_fail/drvfail015.stderr-7.0 deleted file mode 100644 index 9f0166e..0000000 --- a/testsuite/tests/deriving/should_fail/drvfail015.stderr-7.0 +++ /dev/null @@ -1,12 +0,0 @@ - -drvfail015.hs:10:19: - Illegal instance declaration for `Eq T' - (All instance types must be of the form (T t1 ... tn) - where T is not a synonym. - Use -XTypeSynonymInstances if you want to disable this.) - In the stand-alone deriving instance for `Eq T' - -drvfail015.hs:13:1: - The data constructors of `Handle' are not all in scope - so you cannot derive an instance for it - In the stand-alone deriving instance for `Eq Handle' From git at git.haskell.org Tue May 24 21:46:07 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 24 May 2016 21:46:07 +0000 (UTC) Subject: [commit: ghc] master: Update submodule vector [skip ci] (ac38c02) Message-ID: <20160524214607.45C033A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/ac38c025b99868d348e3797e85a4af9c6d6377ac/ghc >--------------------------------------------------------------- commit ac38c025b99868d348e3797e85a4af9c6d6377ac Author: Thomas Miedema Date: Tue May 24 11:26:58 2016 +0200 Update submodule vector [skip ci] Contains commits to let vector compile with primitive master. >--------------------------------------------------------------- ac38c025b99868d348e3797e85a4af9c6d6377ac libraries/vector | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/vector b/libraries/vector index 6c17dd6..224eccb 160000 --- a/libraries/vector +++ b/libraries/vector @@ -1 +1 @@ -Subproject commit 6c17dd6fadc5e7e3e09f7892380ce1339f296efd +Subproject commit 224eccbac0125b7bd302f24063bbb473b2c2e1dc From git at git.haskell.org Wed May 25 13:49:31 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 May 2016 13:49:31 +0000 (UTC) Subject: [commit: ghc] branch 'wip/no-telescope-tvs' deleted Message-ID: <20160525134931.901B33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Deleted branch: wip/no-telescope-tvs From git at git.haskell.org Wed May 25 15:01:33 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 May 2016 15:01:33 +0000 (UTC) Subject: [commit: ghc] wip/rae: Very confusing typo in error message. (80684b0) Message-ID: <20160525150133.88BBF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rae Link : http://ghc.haskell.org/trac/ghc/changeset/80684b0e01fae2dfae8f13be433cec2354f3ad83/ghc >--------------------------------------------------------------- commit 80684b0e01fae2dfae8f13be433cec2354f3ad83 Author: Richard Eisenberg Date: Fri Apr 22 15:29:10 2016 -0400 Very confusing typo in error message. >--------------------------------------------------------------- 80684b0e01fae2dfae8f13be433cec2354f3ad83 compiler/typecheck/TcInteract.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/typecheck/TcInteract.hs b/compiler/typecheck/TcInteract.hs index 8cd6066..8ea55cc 100644 --- a/compiler/typecheck/TcInteract.hs +++ b/compiler/typecheck/TcInteract.hs @@ -165,7 +165,7 @@ solveSimpleWanteds simples | n `intGtLimit` limit = failTcS (hang (text "solveSimpleWanteds: too many iterations" <+> parens (text "limit =" <+> ppr limit)) - 2 (vcat [ text "Set limit with -fsolver-iterations=n; n=0 for no limit" + 2 (vcat [ text "Set limit with -fconstraint-solver-iterations=n; n=0 for no limit" , text "Simples =" <+> ppr simples , text "WC =" <+> ppr wc ])) From git at git.haskell.org Wed May 25 15:01:36 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 May 2016 15:01:36 +0000 (UTC) Subject: [commit: ghc] wip/rae: Fix #11974 by adding a more smarts to TcDefaults. (f92b765) Message-ID: <20160525150136.824963A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rae Link : http://ghc.haskell.org/trac/ghc/changeset/f92b7652628fbce6db8fa551526585bb590af8a7/ghc >--------------------------------------------------------------- commit f92b7652628fbce6db8fa551526585bb590af8a7 Author: Richard Eisenberg Date: Fri Apr 22 22:28:35 2016 -0400 Fix #11974 by adding a more smarts to TcDefaults. Test cases: typecheck/should_compile/T11974 typecheck/should_fail/T11974b >--------------------------------------------------------------- f92b7652628fbce6db8fa551526585bb590af8a7 compiler/prelude/PrelNames.hs | 12 +++++++ compiler/typecheck/TcDefaults.hs | 37 ++++++++++++---------- compiler/typecheck/TcSimplify.hs | 2 +- testsuite/tests/typecheck/should_compile/T11974.hs | 5 +++ testsuite/tests/typecheck/should_compile/all.T | 1 + testsuite/tests/typecheck/should_fail/all.T | 1 + 6 files changed, 40 insertions(+), 18 deletions(-) diff --git a/compiler/prelude/PrelNames.hs b/compiler/prelude/PrelNames.hs index 1480851..5ed3151 100644 --- a/compiler/prelude/PrelNames.hs +++ b/compiler/prelude/PrelNames.hs @@ -2245,6 +2245,18 @@ derivableClassKeys = [ eqClassKey, ordClassKey, enumClassKey, ixClassKey, boundedClassKey, showClassKey, readClassKey ] + +-- These are the "interactive classes" that are consulted when doing +-- defaulting. Does not include Num or IsString, which have special +-- handling. +interactiveClassNames :: [Name] +interactiveClassNames + = [ showClassName, eqClassName, ordClassName, foldableClassName + , traversableClassName ] + +interactiveClassKeys :: [Unique] +interactiveClassKeys = map getUnique interactiveClassNames + {- ************************************************************************ * * diff --git a/compiler/typecheck/TcDefaults.hs b/compiler/typecheck/TcDefaults.hs index f45dd63..e33b8c5 100644 --- a/compiler/typecheck/TcDefaults.hs +++ b/compiler/typecheck/TcDefaults.hs @@ -13,12 +13,12 @@ import Class import TcRnMonad import TcEnv import TcHsType +import TcHsSyn import TcSimplify -import TcMType +import TcValidity import TcType import PrelNames import SrcLoc -import Data.Maybe import Outputable import FastString import qualified GHC.LanguageExtensions as LangExt @@ -46,13 +46,18 @@ tcDefaults [L _ (DefaultDecl [])] tcDefaults [L locn (DefaultDecl mono_tys)] = setSrcSpan locn $ addErrCtxt defaultDeclCtxt $ - do { ovl_str <- xoptM LangExt.OverloadedStrings + do { ovl_str <- xoptM LangExt.OverloadedStrings + ; ext_deflt <- xoptM LangExt.ExtendedDefaultRules ; num_class <- tcLookupClass numClassName - ; is_str_class <- tcLookupClass isStringClassName - ; let deflt_clss | ovl_str = [num_class, is_str_class] - | otherwise = [num_class] + ; deflt_str <- if ovl_str + then mapM tcLookupClass [isStringClassName] + else return [] + ; deflt_interactive <- if ext_deflt + then mapM tcLookupClass interactiveClassNames + else return [] + ; let deflt_clss = num_class : deflt_str ++ deflt_interactive - ; tau_tys <- mapM (tc_default_ty deflt_clss) mono_tys + ; tau_tys <- mapAndReportM (tc_default_ty deflt_clss) mono_tys ; return (Just tau_tys) } @@ -63,10 +68,10 @@ tcDefaults decls@(L locn (DefaultDecl _) : _) tc_default_ty :: [Class] -> LHsType Name -> TcM Type tc_default_ty deflt_clss hs_ty - = do { ty <- solveEqualities $ - tcHsLiftedType hs_ty - ; ty <- zonkTcType ty -- establish Type invariants - ; checkTc (isTauTy ty) (polyDefErr hs_ty) + = do { (ty, _kind) <- solveEqualities $ + tcLHsType hs_ty + ; ty <- zonkTcTypeToType emptyZonkEnv ty -- establish Type invariants + ; checkValidType DefaultDeclCtxt ty -- Check that the type is an instance of at least one of the deflt_clss ; oks <- mapM (check_instance ty) deflt_clss @@ -77,8 +82,10 @@ check_instance :: Type -> Class -> TcM Bool -- Check that ty is an instance of cls -- We only care about whether it worked or not; return a boolean check_instance ty cls - = do { (_, mb_res) <- tryTc (simplifyDefault [mkClassPred cls [ty]]) - ; return (isJust mb_res) } + = do { (_, success) <- discardErrs $ + askNoErrs $ + simplifyDefault [mkClassPred cls [ty]] + ; return success } defaultDeclCtxt :: SDoc defaultDeclCtxt = text "When checking the types in a default declaration" @@ -91,10 +98,6 @@ dupDefaultDeclErr (L _ (DefaultDecl _) : dup_things) pp (L locn (DefaultDecl _)) = text "here was another default declaration" <+> ppr locn dupDefaultDeclErr [] = panic "dupDefaultDeclErr []" -polyDefErr :: LHsType Name -> SDoc -polyDefErr ty - = hang (text "Illegal polymorphic type in default declaration" <> colon) 2 (ppr ty) - badDefaultTy :: Type -> [Class] -> SDoc badDefaultTy ty deflt_clss = hang (text "The default type" <+> quotes (ppr ty) <+> ptext (sLit "is not an instance of")) diff --git a/compiler/typecheck/TcSimplify.hs b/compiler/typecheck/TcSimplify.hs index 4c621dd..60663ed 100644 --- a/compiler/typecheck/TcSimplify.hs +++ b/compiler/typecheck/TcSimplify.hs @@ -427,7 +427,7 @@ simplifyInteractive wanteds simplifyDefault :: ThetaType -- Wanted; has no type variables in it -> TcM () -- Succeeds if the constraint is soluble simplifyDefault theta - = do { traceTc "simplifyInteractive" empty + = do { traceTc "simplifyDefault" empty ; loc <- getCtLocM DefaultOrigin Nothing ; let wanted = [ CtDerived { ctev_pred = pred , ctev_loc = loc } diff --git a/testsuite/tests/typecheck/should_compile/T11974.hs b/testsuite/tests/typecheck/should_compile/T11974.hs new file mode 100644 index 0000000..dc157cf --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T11974.hs @@ -0,0 +1,5 @@ +{-# LANGUAGE ExtendedDefaultRules #-} + +module T11974 where + +default (Maybe, []) diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index e58feae..bf03c22 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -515,3 +515,4 @@ test('T11811', normal, compile, ['']) test('T11793', normal, compile, ['']) test('T11348', normal, compile, ['']) test('T11947', normal, compile, ['']) +test('T11974', normal, compile, ['']) diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index bfae69b..a376a31 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -420,3 +420,4 @@ test('T11990a', normal, compile_fail, ['']) test('T11990b', normal, compile_fail, ['']) test('T12063', [ expect_broken(12063), extra_clean(['T12063.hi-boot', 'T12063.o-boot', 'T12063a.hi', 'T12063a.o']) ], multimod_compile_fail, ['T12063', '-v0']) +test('T11974b', normal, compile_fail, ['']) From git at git.haskell.org Wed May 25 15:01:40 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 May 2016 15:01:40 +0000 (UTC) Subject: [commit: ghc] wip/rae: Fix #10963 and #11975 by adding new cmds to GHCi. (e627c9b) Message-ID: <20160525150140.50D9A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rae Link : http://ghc.haskell.org/trac/ghc/changeset/e627c9b7881c3249fef3f58f78a8cad30922f468/ghc >--------------------------------------------------------------- commit e627c9b7881c3249fef3f58f78a8cad30922f468 Author: Richard Eisenberg Date: Fri Apr 22 22:39:17 2016 -0400 Fix #10963 and #11975 by adding new cmds to GHCi. See the user's guide entry or the Note [TcRnExprMode] in TcRnDriver. Test cases: ghci/scripts/T{10963,11975} >--------------------------------------------------------------- e627c9b7881c3249fef3f58f78a8cad30922f468 compiler/main/GHC.hs | 2 +- compiler/main/HscMain.hs | 8 +-- compiler/main/InteractiveEval.hs | 8 +-- compiler/typecheck/TcBinds.hs | 9 +-- compiler/typecheck/TcExpr.hs | 4 +- compiler/typecheck/TcPatSyn.hs | 3 +- compiler/typecheck/TcRnDriver.hs | 101 ++++++++++++++++++++++------- compiler/typecheck/TcSimplify.hs | 89 +++++++++++++++++-------- docs/users_guide/ghci.rst | 66 +++++++++++++++++-- ghc/GHCi/UI.hs | 12 +++- ghc/GHCi/UI/Info.hs | 2 +- testsuite/tests/ghci/scripts/T10963.script | 7 ++ testsuite/tests/ghci/scripts/T10963.stderr | 12 ++++ testsuite/tests/ghci/scripts/T10963.stdout | 4 ++ testsuite/tests/ghci/scripts/T11975.script | 9 +++ testsuite/tests/ghci/scripts/T11975.stdout | 15 +++++ testsuite/tests/ghci/scripts/all.T | 2 + 17 files changed, 277 insertions(+), 76 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc e627c9b7881c3249fef3f58f78a8cad30922f468 From git at git.haskell.org Wed May 25 15:01:43 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 May 2016 15:01:43 +0000 (UTC) Subject: [commit: ghc] wip/rae's head updated: Fix #10963 and #11975 by adding new cmds to GHCi. (e627c9b) Message-ID: <20160525150143.86D743A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/rae' now includes: 28503fe deriveConstants: Fix nm-classic error message e8c04d4 Testsuite: Delete test for deprecated "packedstring" dadf82d Testsuite: fixup lots of tests 2a83713 Testsuite: delete Roles9.stderr fd5212f Testsuite: delete unused concurrent/prog002/FileIO.hs c9bcaf3 Kill varSetElemsWellScoped in quantifyTyVars e68195a RTS: Add setInCallCapability() 95f9334 GHCi: use real time instead of CPU time for :set -s d396996 Doc improvement for ApplicativeDo 24864ba Use __builtin_clz() to implement log_2() 0712f55 Just comments & reformatting 2dc5b92 Kill varSetElems in TcErrors 94320e1 Kill varSetElems try_tyvar_defaulting f13a8d2 Kill varSetElems in markNominal a48ebcc Implement the state hack without modifiyng OneShotInfo 5adf8f3 Document -fmax-pmcheck-iterations a bit better a0e1051 Recommend more reliable recourse for broken nm 57c636f Update nofib submodule to nofib master fa3ba06 Expand the comment on pprVarSet 82538f6 Kill varSetElems in injImproveEqns af6dced Comments only a2abcf6 Minor improvement to error message 1e86cab Comments only 9ed57d6 Remove unused unifyType_ 4c746cb Add missing solveEqualities 3dce4f2 Refactor RecordPatSynField, FieldLabel c4dd4ae Better documentation of -XConstrainedClassMethods c5b1014 Fix debug-only check in CoreLint 546f24e Revert "Use __builtin_clz() to implement log_2()" 3a53380 Kill unused foldOccSet 196ce62 Testsuite: delete accidentally committed .stderr.normalised file 89c6d07 Testsuite: add -ignore-dot-ghci to some ghci tests [skip ci] 9dc34d3 Testsuite: fix T11223_simple_(unused_)duplicate_lib b0569e8 Testsuite: benign test fixes 3c426b0 Add uniqSetAny and uniqSetAll and use them 7312923 Kill mapUniqSet 32c0aba Testsuite: delete -fesc tests e20b3ed Testsuite: delete T5054 and T5054_2 (#5054) bcfee21 rts/LdvProfile.c: Fix NULL dereference on shutdown f255f80 Linker: Fix implicit function declaration warning on OS X 6e195f4 Remove unused foldFsEnv 031de8b Remove unused foldNameEnv f99db38 Fix path to the new build system, now called Hadrian. 0fa1d07 testsuite: fix up T11223's Makefile a2970f8 RTS: delete BlockedOnGA* + dead code c5919f7 Remove the incredibly hairy splitTelescopeTvs. 7242582 Test #11484 in th/T11484 00053ee Fix typo: Superclases -> Superclasses b725fe0 PPC NCG: Improve pointer de-tagging code c4259ff Testsuite: make CLEANUP=1 the default (#9758) 2ae39ac Testsuite: accept new output for 2 partial-sigs tests 2fe7a0a Fix reference to Note in TcCanonical cb05860 Comment typos: Mkae -> Make, Hsakell -> Haskell 49bae46 Comment typo: unambigious -> unambiguous f69e707 Typos in DmdAnal e6627d1 Fix aggressive cleanup of T1407 868d2c4 rts: Remove deprecated C type `lnat` eac6967 users-guide: Add index entry for "environment file" 18676a4 Bump haddock submodule 533037c Greater customization of GHCi prompt 16a51a6 rts: Close livelock window due to rapid ticker enable/disable 65e13f6 rts: Split up Itimer.c df9b772 Catch errors from timerfd_settime 55f4009 Kill Itimer.h 999c464 rts/itimer/pthread: Stop timer when ticker is stopped 116d3fe Remove unused getScopedTyVarBinds 1161932 Add T11747 as a test ecc0603 deriveConstants: Fix nm advice one last time a28611b Export constructors for IntPtr and WordPtr ea34f56 Remove unused equivClassesByUniq cd85dc8 Make sure record pattern synonym selectors are in scope in GHCi. db2bfe0 added docstring for '-fhistory-size' flag 81d8a23 glasgow_exts.rst: fix quoting c5be5e2 docs/users_guide/glasgow_exts.rst: fix merge conflict fa86ac7 Make validDerivPred ignore non-visible arguments to a class type constructor 36d29f7 StaticPointers: Allow closed vars in the static form. 5f8c0b8 Revert "Revert "Use __builtin_clz() to implement log_1()"" ef44606 Cleanups related to MAX_FREE_LIST 0051ac1 Update libraries/hpc submodule to v0.6.0.3 release tag 4466ae6 Update bytestring submodule to 0.10.8.0 release tag 50e7055 Export oneShot from GHC.Exts f9d9375 Adjust testsuite output to bytestring-0.10.8.0 76ee260 Allow limiting the number of GC threads (+RTS -qn) f703fd6 Add +RTS -AL 1fa92ca schedulePushWork: avoid unnecessary wakeups dbcaa8c Don't STATIC_INLINE giveCapabilityToTask aa5e2dd Make 'make fast' work for the User Guide b75d194 Be more aggressive when checking constraints for custom type errors. 4f2afe1 testsuite: Add test for #11959 763610e base: Export runRW# from GHC.Exts ad4392c Kill non-deterministic foldUFM in TrieMap and TcAppMap db9de7e rts: Replace `nat` with `uint32_t` e340520 Comments only explaining export list parsing. 94f2ee1 Explain linter optimization for StaticPtr checks. 990ce8c Use tcExtendGlobalValEnv for default methods ecc1d58 Update Win32 submodule to v2.3.1.1 release tag 018487e Fix pretty printing of IEThingWith fe190ae Remove trailing whitespace from 'testsuite/tests/module/all.T' 633b099 Update time submodule to 1.6.0.1 release tag 8e5776b rts/ProfHeap.c: Use `ssize_t` instead of `long`. dd3e847 Documentation for simplifyDeriv. 260a564 Use stdint types for Stg{Word,Int}{8,16,32,64} 2593e20 White space only 76d9156 Emit wild-card constraints in the right place cc75a5d Comments only e1ff2b4 Fix partial sigs and pattern bindings interaction 9dbf5f5 Tidy up partial-sig quantification bb296bf Error message wibbles, re partial type sigs 0597493 Re-do the invariant for TcDepVars 3ca7806 stg/Types.h: Fix comment and #include 53f26f5 Forbid variables to be parents in import lists. e996e85 RdrHsSyn: Only suggest `type` qualification when appropriate ea3d1ef Fix a crash in requestSync() bff6e1b Comments only 4ac0e81 Kill unnecessary cmpType in lhs_cmp_type b58b0e1 Make simplifyInstanceContexts deterministic a4717f5 Comments about static forms b21e8cc Comments only e7e5939 Add Outputable ShowHowMuch e24b50c Use partial-sig constraints as givens 1a43783 Record that EqualityConstraint now works f6e58be Test Trac #11640 7e28e47 Get rid of Traversable UniqFM and Foldable UniqFM 402f201 Fix typos ab91b85 make accept for Make simplifyInstanceContexts deterministic e207198 Kill foldUFM in classifyTyCon 8669c48 Document why closeOverKind is OK for determinism 584ade6 RtsFlags: Make `mallocFailHook` const correct 0efbf18 rts: Fix C compiler warnings on Windows 9363f04 Handle promotion failures when scavenging a WEAK (#11108) 0e71988 Remove some varSetElems in dsCmdStmt 3edbd09 Document SCC determinism cfc5df4 Fix ASSERT failure and re-enable setnumcapabilities001 2a0d00d Make random an "extra" package 86a1f20 Remove a copy of System.Random and use reqlib('random') b5f85ce Remove stale comment. da105ca Don't prematurely force TyThing thunks with -ddump-if-trace. 925b0ae Make absentError not depend on uniques eae3362 docs: add skeleton 8.2.1 release notes e217287 Bump haddock submodule c079de3 Add TH support for pattern synonyms (fixes #8761) e53f218 Fix deriveTyData's kind unification when two kind variables are unified b8e2565 Make Generic1 poly-kinded 6971430 Allow putting Haddocks on derived instances 01bc109 Document zonkTyCoVarsAndFV determinism 6bf0eef Kill varEnvElts in specImports 69c974f Use StgHalfWord instead of a CPP #if 995cf0f rts: Make function pointer parameters `const` where possible 0c0129b RtsUtils: Use `size_t` instead of `int` where appropriate 7c0b595 Fix comments about scavenging WEAK objects 5416fad Refactor some ppr functions to use pprUFM bd01bbb Test Trac #12039 8e48d24 Bump haddock submodule e4834ed Fix a performance issue with -fprint-expanded-synonyms c974927 Update bytestring submodule to 0.10.8.1 release tag bf669a0 Bump haddock submodule 2dbdc79 PPC NCG: Fix pretty printing of st[wd]ux instr. 563a485 PPC: Implement SMP primitives using gcc built-ins d78faa1 testsuite/ImpSafe03: Normalize version of bytestring eed820b Move Extension type to ghc-boot-th 21fe4ff Kill varSetElems in tcInferPatSynDecl d20d843 Another bump of haddock submodule 7814420 Remove html_theme requirement of haddock docs 4a037a9 Set `USE_MMAP` at configure time 770d708 Add ghc-boot-th to rules/foreachLibrary dc94914 Document determinism in shortOutIndirections 3f3dc23 Testsuite: run tests in /tmp after copying required files 1a9ae4b Testsuite: delete old cleanup code (#11980) a9dd9b7 Testsuite: delete unused file [skip ci] c92cfbc Testsuite: don't skip concio001 and concio001_thr 931b3c7 Delete libraries/ghci/GNUmakefile [skip ci] a54d87a rules: Fix name of ghc-boot-th library 5d80d14 rules/build-prog: Ensure programs depend upon their transitive deps 33c029d rts: More const correct-ness fixes b088c02 Testsuite: T10052 requires interpreter (#11730) 3251743 Testsuite: don't warn when mk/ghcconfig_* hasn't been created yet 77ee3a9 Update .mailmap [skip ci] fffe3a2 Make inert_model and inert_eqs deterministic sets f0f0ac8 Fix histograms for ticky code ba3e1fd Add a test for #11108 39a2faa Rework parser to allow use with DynFlags 310371f rts: Add isPinnedByteArray# primop f091218 CLabel: Catch #11155 during C-- pretty-printing 9dd0481 Add (broken) test for #12063. 5f1557e Failing test case for #12076. f18e8d8 rts: Add missing `const` from HashTable API 6282bc3 Kill varSetElems in tidyFreeTyCoVars 13e40f9 Kill varEnvElts in tcPragExpr 72b677d Fix Trac #12051 ad7f122 Improve pretty-printing of equalities f9e90bc Improve documentation for type wildcards 0bfcfd0 Comments only d1efe86 Comments only 358567a testsuite: Add expected output for T11108 470def9 Testsuite: fix T11827 (#11827) 296b8f1 Add libraries/ghci/GNUmakefile to .gitignore [skip ci] f0f3517 Remove use of caddr_t 8abc193 Get types in osFreeMBlocks in sync with osGetMBlocks 464b6f8 {,M}BLOCK_SIZE_W * sizeof(W_) -> {,M}BLOCK_SIZE 2e6433a testsuite: Add a TypeRep test a88bb1b Give lifted primitive types a representation 1ee47c1 Use the correct return type for Windows' send()/recv() (Fix #12010) 3910306 Add -XStaticPointers to the flag reference. 08e47ca FunDep printer: Fix unicode arrow 43589f5 testsuite: add CmmSwitchTest for 32-bit platforms ae7e9cb Fix Windows build after Ticky changes 8e92974 Testsuite: mark T8761 expect_broken #12077 a1f3bb8 Fix failing T12010 d9cb7a8 compiler/iface: compress .hi files e44a6f9 users-guide: Vector version of Thomson-Wheeler logo 6d6d6e4 rules/sphinx: Add missing dependency on conf.py for pdf rule cf1efc7 users-guide: Fix index in PDF output da3c1eb Enable checkProddableBlock on x86_64 527ed72 Fix deriving Ord when RebindableSyntax is enabled c81e7b2 Build system: temp solution for parallelisation bug (#11960) f669764 Use `setSession` instead of `modifySession` when setting `HscEnv` a70a6da rts/Linker.c: Fix compile error on Arm fa58710 Update format specifiers for Tickey.c 2230c88 Testsuite: fix T12010 for real 8c9b8a3 Allow unlifted types in pattern synonym result type d835ee6 Fix build by removing unused import. 785b38f testsuite: Update max_bytes_used for T4029 9bb2772 Revert "compiler/iface: compress .hi files" 4f5b335 Suppress the warning about __sync_fetch_and_nand (#9678) 03d8960 Don't split the arg types in a PatSyn signature eb8eb02 Spelling in comment 839b424 Remove unused Type.splitFunTysN 9c3e55b Comments only 35053eb Testsuite: delete check_files_written 1bf5c12 Spelling 8f7d016 Add support for unicode TH quotes (#11743) 4c6e69d Document some benign nondeterminism 9d06ef1 Make Arrow desugaring deterministic 95dfdce Remove 'deriving Typeable' statements fe8a4e5 Runtime linker: Break m32 allocator out into its own file 1956cbf Fix: #12084 deprecate old profiling flags 31f1804 Testsuite: delete drvfail015.stderr-7.0 [skip ci] 1319363 Always use native-Haskell de/encoders for ASCII and latin1 ac38c02 Update submodule vector [skip ci] 80684b0 Very confusing typo in error message. f92b765 Fix #11974 by adding a more smarts to TcDefaults. e627c9b Fix #10963 and #11975 by adding new cmds to GHCi. From git at git.haskell.org Wed May 25 15:07:33 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 May 2016 15:07:33 +0000 (UTC) Subject: [commit: ghc] wip/rae: Fix #11974 by adding a more smarts to TcDefaults. (5b8b444) Message-ID: <20160525150733.232C23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rae Link : http://ghc.haskell.org/trac/ghc/changeset/5b8b4446a7abc0ec680e545e161d9de38d822e7a/ghc >--------------------------------------------------------------- commit 5b8b4446a7abc0ec680e545e161d9de38d822e7a Author: Richard Eisenberg Date: Fri Apr 22 22:28:35 2016 -0400 Fix #11974 by adding a more smarts to TcDefaults. Test cases: typecheck/should_compile/T11974 typecheck/should_fail/T11974b >--------------------------------------------------------------- 5b8b4446a7abc0ec680e545e161d9de38d822e7a compiler/prelude/PrelNames.hs | 12 +++++++ compiler/typecheck/TcDefaults.hs | 37 ++++++++++++---------- compiler/typecheck/TcSimplify.hs | 2 +- testsuite/tests/typecheck/should_compile/T11974.hs | 5 +++ testsuite/tests/typecheck/should_compile/all.T | 1 + testsuite/tests/typecheck/should_fail/T11974b.hs | 7 ++++ .../tests/typecheck/should_fail/T11974b.stderr | 15 +++++++++ testsuite/tests/typecheck/should_fail/all.T | 1 + 8 files changed, 62 insertions(+), 18 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 5b8b4446a7abc0ec680e545e161d9de38d822e7a From git at git.haskell.org Wed May 25 15:07:36 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 May 2016 15:07:36 +0000 (UTC) Subject: [commit: ghc] wip/rae: Fix #10963 and #11975 by adding new cmds to GHCi. (e20344d) Message-ID: <20160525150736.DCF8C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rae Link : http://ghc.haskell.org/trac/ghc/changeset/e20344d65b377f9f594fd94ed237d234fdfc751d/ghc >--------------------------------------------------------------- commit e20344d65b377f9f594fd94ed237d234fdfc751d Author: Richard Eisenberg Date: Fri Apr 22 22:39:17 2016 -0400 Fix #10963 and #11975 by adding new cmds to GHCi. See the user's guide entry or the Note [TcRnExprMode] in TcRnDriver. Test cases: ghci/scripts/T{10963,11975} >--------------------------------------------------------------- e20344d65b377f9f594fd94ed237d234fdfc751d compiler/main/GHC.hs | 2 +- compiler/main/HscMain.hs | 8 +-- compiler/main/InteractiveEval.hs | 8 +-- compiler/typecheck/TcBinds.hs | 9 +-- compiler/typecheck/TcExpr.hs | 4 +- compiler/typecheck/TcPatSyn.hs | 3 +- compiler/typecheck/TcRnDriver.hs | 101 ++++++++++++++++++++++------- compiler/typecheck/TcSimplify.hs | 89 +++++++++++++++++-------- docs/users_guide/ghci.rst | 66 +++++++++++++++++-- ghc/GHCi/UI.hs | 12 +++- ghc/GHCi/UI/Info.hs | 2 +- testsuite/tests/ghci/scripts/T10963.script | 7 ++ testsuite/tests/ghci/scripts/T10963.stderr | 12 ++++ testsuite/tests/ghci/scripts/T10963.stdout | 4 ++ testsuite/tests/ghci/scripts/T11975.script | 9 +++ testsuite/tests/ghci/scripts/T11975.stdout | 15 +++++ testsuite/tests/ghci/scripts/all.T | 2 + 17 files changed, 277 insertions(+), 76 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc e20344d65b377f9f594fd94ed237d234fdfc751d From git at git.haskell.org Wed May 25 16:23:05 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 May 2016 16:23:05 +0000 (UTC) Subject: [commit: ghc] master: Fix broken links to mdo papers (961ed26) Message-ID: <20160525162305.6547B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/961ed26b69292f6bfb75cd2209ea0c67e77abf7b/ghc >--------------------------------------------------------------- commit 961ed26b69292f6bfb75cd2209ea0c67e77abf7b Author: Bartosz Nitka Date: Wed May 25 09:25:51 2016 -0700 Fix broken links to mdo papers There's no guarantee that the links will work in the future. Is there a more future-proof solution to this? Test Plan: none Reviewers: bgamari, austin, simonmar Reviewed By: simonmar Subscribers: thomie, simonmar Differential Revision: https://phabricator.haskell.org/D2266 >--------------------------------------------------------------- 961ed26b69292f6bfb75cd2209ea0c67e77abf7b docs/users_guide/glasgow_exts.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index c48812c..a8a7f8f 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -721,9 +721,9 @@ As you can guess ``justOnes`` will evaluate to ``Just [-1,-1,-1,...``. GHC's implementation the mdo-notation closely follows the original translation as described in the paper `A recursive do for -Haskell `__, which +Haskell `__, which in turn is based on the work `Value Recursion in Monadic -Computations `__. +Computations `__. Furthermore, GHC extends the syntax described in the former paper with a lower level syntax flagged by the ``rec`` keyword, as we describe next. @@ -784,7 +784,7 @@ can be rather delicate: in particular, we would like the knots to be wrapped around as minimal groups as possible. This process is known as *segmentation*, and is described in detail in Section 3.2 of `A recursive do for -Haskell `__. +Haskell `__. Segmentation improves polymorphism and reduces the size of the recursive knot. Most importantly, it avoids unnecessary interference caused by a fundamental issue with the so-called *right-shrinking* axiom for monadic @@ -793,7 +793,7 @@ recursion. In brief, most monads of interest (IO, strict state, etc.) do performing segmentation can cause unnecessary interference, changing the termination behavior of the resulting translation. (Details can be found in Sections 3.1 and 7.2.2 of `Value Recursion in Monadic -Computations `__.) +Computations `__.) The ``mdo`` notation removes the burden of placing explicit ``rec`` blocks in the code. Unlike an ordinary ``do`` expression, in which From git at git.haskell.org Wed May 25 17:21:34 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 May 2016 17:21:34 +0000 (UTC) Subject: [commit: ghc] master: Testsuite: introduce TEST_HC_OPTS_INTERACTIVE (#11468) (bdc5558) Message-ID: <20160525172134.9A3C73A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/bdc555885b8898684549eca70053c9ce0ec7fa39/ghc >--------------------------------------------------------------- commit bdc555885b8898684549eca70053c9ce0ec7fa39 Author: Thomas Miedema Date: Wed May 25 13:01:42 2016 +0200 Testsuite: introduce TEST_HC_OPTS_INTERACTIVE (#11468) Refactoring only. >--------------------------------------------------------------- bdc555885b8898684549eca70053c9ce0ec7fa39 testsuite/mk/test.mk | 2 ++ testsuite/tests/ghci/linking/dyn/Makefile | 8 ++++---- testsuite/tests/ghci/prog004/Makefile | 2 +- testsuite/tests/ghci/scripts/Makefile | 20 ++++++++++---------- testsuite/tests/ghci/should_run/Makefile | 2 +- testsuite/tests/rts/T11223/Makefile | 30 +++++++++++++++--------------- testsuite/tests/th/Makefile | 2 +- 7 files changed, 34 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 bdc555885b8898684549eca70053c9ce0ec7fa39 From git at git.haskell.org Wed May 25 17:21:37 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 May 2016 17:21:37 +0000 (UTC) Subject: [commit: ghc] master: RTS: simplify read_heap_profiling_flag (eec88ee) Message-ID: <20160525172137.3F00E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/eec88ee07c28a18b1b5b4edfde8e898324264bce/ghc >--------------------------------------------------------------- commit eec88ee07c28a18b1b5b4edfde8e898324264bce Author: Thomas Miedema Date: Thu May 19 10:20:15 2016 +0200 RTS: simplify read_heap_profiling_flag Since 535896e58f7fc8d89a5ff34629a3471eac529d93, "args" is not mutated anymore, so we don't need to create a temporary copy. Reviewed by: bgamari Differential Revision: https://phabricator.haskell.org/D2264 >--------------------------------------------------------------- eec88ee07c28a18b1b5b4edfde8e898324264bce rts/RtsFlags.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c index b0ce8be..31a2c8b 100644 --- a/rts/RtsFlags.c +++ b/rts/RtsFlags.c @@ -1588,15 +1588,10 @@ static void read_debug_flags(const char* arg) #ifdef PROFILING // Parse a "-h" flag, returning whether the parse resulted in an error. -static rtsBool read_heap_profiling_flag(const char *arg_in) +static rtsBool read_heap_profiling_flag(const char *arg) { // Already parsed "-h" - // For historical reasons the parser here mutates the arguments. - // However, for sanity we want to guarantee const-correctness and parsing - // really ought to be an immutable operation. To avoid rewriting the parser - // we just operate on a temporary copy of the argument. - char *arg = strdup(arg_in); rtsBool error = rtsFalse; switch (arg[2]) { case '\0': @@ -1703,7 +1698,6 @@ static rtsBool read_heap_profiling_flag(const char *arg_in) error = rtsTrue; } - free(arg); return error; } #endif From git at git.haskell.org Wed May 25 18:45:36 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 May 2016 18:45:36 +0000 (UTC) Subject: [commit: ghc] master: Spelling in comments (8408d84) Message-ID: <20160525184536.4CBBF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/8408d84e18145ebab552331248af8093f9747d3c/ghc >--------------------------------------------------------------- commit 8408d84e18145ebab552331248af8093f9747d3c Author: Gabor Greif Date: Tue May 24 14:10:15 2016 +0200 Spelling in comments >--------------------------------------------------------------- 8408d84e18145ebab552331248af8093f9747d3c compiler/simplCore/CSE.hs | 2 +- compiler/typecheck/TcMType.hs | 2 +- compiler/typecheck/TcType.hs | 2 +- testsuite/tests/perf/compiler/T10547.hs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/simplCore/CSE.hs b/compiler/simplCore/CSE.hs index 0f87e82..f119f9f 100644 --- a/compiler/simplCore/CSE.hs +++ b/compiler/simplCore/CSE.hs @@ -224,7 +224,7 @@ This is a vanishingly strange corner case, but we still have to check. We do the check in cseRhs, but it can't fire when cseRhs is called -from a let-binding, becuase they are always ok-for-speculation. Never +from a let-binding, because they are always ok-for-speculation. Never mind! diff --git a/compiler/typecheck/TcMType.hs b/compiler/typecheck/TcMType.hs index 94c4947..ae5e031 100644 --- a/compiler/typecheck/TcMType.hs +++ b/compiler/typecheck/TcMType.hs @@ -893,7 +893,7 @@ quantifyZonkedTyVars gbl_tvs dvs@(DV{ dv_kvs = dep_tkvs, dv_tvs = nondep_tkvs }) -- dv_tvs which will also contain k -- No worry about dependent covars here; -- they are all in dep_tkvs - -- No worry about scoping, becuase these are all + -- No worry about scoping, because these are all -- type variables -- NB kinds of tvs are zonked by zonkTyCoVarsAndFV diff --git a/compiler/typecheck/TcType.hs b/compiler/typecheck/TcType.hs index ea4224d..3a469bc 100644 --- a/compiler/typecheck/TcType.hs +++ b/compiler/typecheck/TcType.hs @@ -895,7 +895,7 @@ arbitrary distinction based on how the variables appear: E.g. In the type T k (a::k) 'k' is a kind variable, because it occurs in the kind of 'a', even though it also appears at "top level" of the type - 'a' is a type variable, becuase it doesn't + 'a' is a type variable, because it doesn't We gather these variables using a TcDepVars record: DV { dv_kvs: Variables free in the kind of a free type variable diff --git a/testsuite/tests/perf/compiler/T10547.hs b/testsuite/tests/perf/compiler/T10547.hs index 5501b3d..7a66750 100644 --- a/testsuite/tests/perf/compiler/T10547.hs +++ b/testsuite/tests/perf/compiler/T10547.hs @@ -1,4 +1,4 @@ --- Reported by sjcjoosten in T10547, this was taking forever becuase of a bug in +-- Reported by sjcjoosten in T10547, this was taking forever because of a bug in -- the implementation. See bottom of the file for some notes. module Test where From git at git.haskell.org Wed May 25 19:27:39 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 May 2016 19:27:39 +0000 (UTC) Subject: [commit: ghc] master: Testsuite: also normalise platform-dependent .stdout/stderr (6a5bce1) Message-ID: <20160525192739.48F613A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/6a5bce14ffb8b10def150b185fc95d7b2ebab263/ghc >--------------------------------------------------------------- commit 6a5bce14ffb8b10def150b185fc95d7b2ebab263 Author: Thomas Miedema Date: Wed May 25 16:03:19 2016 +0200 Testsuite: also normalise platform-dependent .stdout/stderr This effectively reverses commit 429f0099ab9adfadc779ca76f3aae1c9c160fb8c (2006). I don't see why platform-dependent .stdout/stderr files should //not// get normalised. It fixes T11223_link_order_a_b_2_fail on Windows, by normalising `ghc-stage2.exe` to `ghc` when comparing stderr with .stderr-mingw32. Reviewed by: Phyx Differential Revision: https://phabricator.haskell.org/D2267 GHC Trac Issues: #12118 >--------------------------------------------------------------- 6a5bce14ffb8b10def150b185fc95d7b2ebab263 testsuite/driver/testlib.py | 38 ++++++++++++-------------------------- 1 file changed, 12 insertions(+), 26 deletions(-) diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index b302d8f..62f50ff 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -1057,7 +1057,7 @@ def do_compile( name, way, should_fail, top_mod, extra_mods, extra_hc_opts, over # of whether we expected the compilation to fail or not (successful # compilations may generate warnings). - (_, expected_stderr_file) = find_expected_file(name, 'stderr') + expected_stderr_file = find_expected_file(name, 'stderr') actual_stderr_file = add_suffix(name, 'comp.stderr') if not compare_outputs(way, 'stderr', @@ -1081,7 +1081,7 @@ def compile_cmp_asm( name, way, extra_hc_opts ): # of whether we expected the compilation to fail or not (successful # compilations may generate warnings). - (_, expected_asm_file) = find_expected_file(name, 'asm') + expected_asm_file = find_expected_file(name, 'asm') actual_asm_file = add_suffix(name, 's') if not compare_outputs(way, 'asm', @@ -1506,15 +1506,9 @@ def get_compiler_flags(override_flags, noforce): def check_stdout_ok(name, way): actual_stdout_file = add_suffix(name, 'run.stdout') - (platform_specific, expected_stdout_file) = find_expected_file(name, 'stdout') + expected_stdout_file = find_expected_file(name, 'stdout') - def norm(str): - if platform_specific: - return str - else: - return normalise_output(str) - - extra_norm = join_normalisers(norm, getTestOpts().extra_normaliser) + extra_norm = join_normalisers(normalise_output, getTestOpts().extra_normaliser) check_stdout = getTestOpts().check_stdout if check_stdout: @@ -1530,16 +1524,10 @@ def dump_stdout( name ): def check_stderr_ok(name, way): actual_stderr_file = add_suffix(name, 'run.stderr') - (platform_specific, expected_stderr_file) = find_expected_file(name, 'stderr') - - def norm(str): - if platform_specific: - return str - else: - return normalise_errmsg(str) + expected_stderr_file = find_expected_file(name, 'stderr') return compare_outputs(way, 'stderr', - join_normalisers(norm, getTestOpts().extra_errmsg_normaliser), \ + join_normalisers(normalise_errmsg, getTestOpts().extra_errmsg_normaliser), \ expected_stderr_file, actual_stderr_file, whitespace_normaliser=normalise_whitespace) @@ -1590,7 +1578,7 @@ def check_hp_ok(name): return(False) def check_prof_ok(name, way): - (_, expected_prof_file) = find_expected_file(name, 'prof.sample') + expected_prof_file = find_expected_file(name, 'prof.sample') expected_prof_path = in_testdir(expected_prof_file) # Check actual prof file only if we have an expected prof file to @@ -1987,20 +1975,18 @@ def find_expected_file(name, suff): basename = add_suffix(name, suff) basepath = in_srcdir(basename) - files = [(platformSpecific, basename + ws + plat) - for (platformSpecific, plat) in [(1, '-' + config.platform), - (1, '-' + config.os), - (0, '')] + files = [basename + ws + plat + for plat in ['-' + config.platform, '-' + config.os, ''] for ws in ['-ws-' + config.wordsize, '']] dir = glob.glob(basepath + '*') dir = [normalise_slashes_(d) for d in dir] - for (platformSpecific, f) in files: + for f in files: if in_srcdir(f) in dir: - return (platformSpecific,f) + return f - return (0, basename) + return basename def cleanup(): shutil.rmtree(getTestOpts().testdir, ignore_errors=True) From git at git.haskell.org Wed May 25 19:27:41 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 May 2016 19:27:41 +0000 (UTC) Subject: [commit: ghc] master: Testsuite: add a test for #5522 (-fliberate-case -fspec-constr) (5020bc8) Message-ID: <20160525192741.E51843A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5020bc8fd2a99a557f45ea5abf8240ac995cc03d/ghc >--------------------------------------------------------------- commit 5020bc8fd2a99a557f45ea5abf8240ac995cc03d Author: Thomas Miedema Date: Wed May 25 21:23:09 2016 +0200 Testsuite: add a test for #5522 (-fliberate-case -fspec-constr) >--------------------------------------------------------------- 5020bc8fd2a99a557f45ea5abf8240ac995cc03d testsuite/tests/deSugar/should_run/all.T | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/testsuite/tests/deSugar/should_run/all.T b/testsuite/tests/deSugar/should_run/all.T index 7bc911e..fce86c5 100644 --- a/testsuite/tests/deSugar/should_run/all.T +++ b/testsuite/tests/deSugar/should_run/all.T @@ -32,6 +32,12 @@ test('T3382', normal, compile_and_run, ['']) test('mc01', normal, compile_and_run, ['']) test('mc02', normal, compile_and_run, ['']) test('mc03', normal, compile_and_run, ['']) + +# #5522: "I noticed that test mc03 runs out of memory compiled with +# -O -fliberate-case -fspec-constr." +test('T5522', [only_ways(['optasm']), extra_files(['mc03.hs'])], multimod_compile, + ['mc03', '-fliberate-case -fspec-constr -v0 +RTS -M1G -RTS']) + test('mc04', normal, compile_and_run, ['']) test('mc05', normal, compile_and_run, ['']) test('mc06', normal, compile_and_run, ['']) From git at git.haskell.org Wed May 25 19:27:45 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 May 2016 19:27:45 +0000 (UTC) Subject: [commit: ghc] master: Testsuite: fix enum01/02/03 on Windows (#9399) (f07bf19) Message-ID: <20160525192745.09BDE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/f07bf19ec49d25395dd47923ba5e6b525ce7e68f/ghc >--------------------------------------------------------------- commit f07bf19ec49d25395dd47923ba5e6b525ce7e68f Author: Thomas Miedema Date: Wed May 25 17:51:26 2016 +0200 Testsuite: fix enum01/02/03 on Windows (#9399) >--------------------------------------------------------------- f07bf19ec49d25395dd47923ba5e6b525ce7e68f libraries/base/tests/all.T | 2 +- libraries/base/tests/enum01.hs | 2 +- libraries/base/tests/enum02.hs | 2 +- libraries/base/tests/enum03.hs | 2 +- libraries/base/tests/enum_processor.bat | 11 +++++++++++ libraries/base/tests/enum_processor.py | 2 -- testsuite/driver/extra_files.py | 6 +++--- testsuite/mk/test.mk | 2 +- 8 files changed, 19 insertions(+), 10 deletions(-) diff --git a/libraries/base/tests/all.T b/libraries/base/tests/all.T index fc97666..ac22336 100644 --- a/libraries/base/tests/all.T +++ b/libraries/base/tests/all.T @@ -78,7 +78,7 @@ test('dynamic003', extra_run_opts('+RTS -K32m -RTS'), compile_and_run, [''] test('dynamic004', omit_ways(['normal', 'threaded1', 'ghci']), compile_and_run, ['']) test('dynamic005', normal, compile_and_run, ['']) -enum_setups = [when(fast(), skip), when(opsys('mingw32'), expect_broken(9399))] +enum_setups = [when(fast(), skip)] test('enum01', enum_setups, compile_and_run, ['']) test('enum02', enum_setups, compile_and_run, ['']) test('enum03', enum_setups, compile_and_run, ['']) diff --git a/libraries/base/tests/enum01.hs b/libraries/base/tests/enum01.hs index 0ae39b1..245f6f7 100644 --- a/libraries/base/tests/enum01.hs +++ b/libraries/base/tests/enum01.hs @@ -1,5 +1,5 @@ -- !!! Testing the Prelude's Enum instances. -{-# OPTIONS_GHC -F -pgmF ./enum_processor.py #-} +{-# OPTIONS_GHC -F -pgmF ./enum_processor.bat #-} -- The processor is a non-CPP-based equivalent of -- #define printTest(x) (do{ putStr ( " " ++ "x" ++ " = " ) ; print (x) }) -- which is not portable to clang diff --git a/libraries/base/tests/enum02.hs b/libraries/base/tests/enum02.hs index f7e843c..2d06f95 100644 --- a/libraries/base/tests/enum02.hs +++ b/libraries/base/tests/enum02.hs @@ -1,5 +1,5 @@ -- !!! Testing the Int Enum instances. -{-# OPTIONS_GHC -F -pgmF ./enum_processor.py #-} +{-# OPTIONS_GHC -F -pgmF ./enum_processor.bat #-} -- The processor is a non-CPP-based equivalent of -- #define printTest(x) (do{ putStr ( " " ++ "x" ++ " = " ) ; print (x) }) -- which is not portable to clang diff --git a/libraries/base/tests/enum03.hs b/libraries/base/tests/enum03.hs index 181354a..28d02d1 100644 --- a/libraries/base/tests/enum03.hs +++ b/libraries/base/tests/enum03.hs @@ -1,5 +1,5 @@ -- !!! Testing the Word Enum instances. -{-# OPTIONS_GHC -F -pgmF ./enum_processor.py #-} +{-# OPTIONS_GHC -F -pgmF ./enum_processor.bat #-} -- The processor is a non-CPP-based equivalent of -- #define printTest(x) (do{ putStr ( " " ++ "x" ++ " = " ) ; print (x) }) -- which is not portable to clang diff --git a/libraries/base/tests/enum_processor.bat b/libraries/base/tests/enum_processor.bat new file mode 100755 index 0000000..2b13a7d --- /dev/null +++ b/libraries/base/tests/enum_processor.bat @@ -0,0 +1,11 @@ +:;# Problem: GHC on Windows doesn't like '-pgmF ./enum_processor.py'. +:;# See ticket:365#comment:7 for details. +:;# +:;# Workaround: this file, which functions both as a Windows .bat script and a +:;# Unix shell script. Hacky, but it seems to work. + +:;# Starts with a ':', to skip on Windows. +:; "${PYTHON}" enum_processor.py $@; exit $? + +:;# Windows only: +%PYTHON% enum_processor.py %* diff --git a/libraries/base/tests/enum_processor.py b/libraries/base/tests/enum_processor.py old mode 100755 new mode 100644 index 53bea4c..15243f1 --- a/libraries/base/tests/enum_processor.py +++ b/libraries/base/tests/enum_processor.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - # The rough equivalent of the traditional CPP: # #define printTest(x) (do{ putStr ( " " ++ "x" ++ " = " ) ; print (x) }) # which is not portable to clang. diff --git a/testsuite/driver/extra_files.py b/testsuite/driver/extra_files.py index 0a2bfe6..650ba45 100644 --- a/testsuite/driver/extra_files.py +++ b/testsuite/driver/extra_files.py @@ -251,9 +251,9 @@ extra_src_files = { 'dynbrk004': ['../mdo.hs'], 'dynbrk005': ['TupleN.hs'], 'encoding004': ['encoded-data/'], - 'enum01': ['enum_processor.py'], - 'enum02': ['enum_processor.py'], - 'enum03': ['enum_processor.py'], + 'enum01': ['enum_processor.bat', 'enum_processor.py'], + 'enum02': ['enum_processor.bat', 'enum_processor.py'], + 'enum03': ['enum_processor.bat', 'enum_processor.py'], 'exampleTest': ['AnnotationTuple.hs'], 'fast2haskell': ['Fast2haskell.hs', 'Main.hs'], 'ffi018_ghci': ['ffi018.h'], diff --git a/testsuite/mk/test.mk b/testsuite/mk/test.mk index 4091b98..d7e65bb 100644 --- a/testsuite/mk/test.mk +++ b/testsuite/mk/test.mk @@ -281,7 +281,7 @@ $(TIMEOUT_PROGRAM) : # communicate with the topmake. # See Note [Communicating options and variables to a submake] test: $(TIMEOUT_PROGRAM) - +$(PYTHON) $(RUNTESTS) $(RUNTEST_OPTS) \ + +PYTHON="$(PYTHON)" "$(PYTHON)" $(RUNTESTS) $(RUNTEST_OPTS) \ $(patsubst %, --only=%, $(TEST)) \ $(patsubst %, --only=%, $(TESTS)) \ $(patsubst %, --way=%, $(WAY)) \ From git at git.haskell.org Wed May 25 21:14:55 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 May 2016 21:14:55 +0000 (UTC) Subject: [commit: ghc] wip/rae: Fix #10963 and #11975 by adding new cmds to GHCi. (4d517c4) Message-ID: <20160525211455.813653A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rae Link : http://ghc.haskell.org/trac/ghc/changeset/4d517c4d33ab17cdbb2c61d644ad411d942d7d44/ghc >--------------------------------------------------------------- commit 4d517c4d33ab17cdbb2c61d644ad411d942d7d44 Author: Richard Eisenberg Date: Fri Apr 22 22:39:17 2016 -0400 Fix #10963 and #11975 by adding new cmds to GHCi. See the user's guide entry or the Note [TcRnExprMode] in TcRnDriver. Test cases: ghci/scripts/T{10963,11975} >--------------------------------------------------------------- 4d517c4d33ab17cdbb2c61d644ad411d942d7d44 compiler/main/GHC.hs | 2 +- compiler/main/HscMain.hs | 8 +-- compiler/main/InteractiveEval.hs | 8 +-- compiler/typecheck/TcBinds.hs | 9 +-- compiler/typecheck/TcExpr.hs | 4 +- compiler/typecheck/TcPatSyn.hs | 3 +- compiler/typecheck/TcRnDriver.hs | 101 ++++++++++++++++++++++------- compiler/typecheck/TcSimplify.hs | 89 +++++++++++++++++-------- docs/users_guide/ghci.rst | 66 +++++++++++++++++-- ghc/GHCi/UI.hs | 12 +++- ghc/GHCi/UI/Info.hs | 2 +- testsuite/tests/ghc-api/T8639_api.hs | 2 +- testsuite/tests/ghci/scripts/T10963.script | 7 ++ testsuite/tests/ghci/scripts/T10963.stderr | 12 ++++ testsuite/tests/ghci/scripts/T10963.stdout | 4 ++ testsuite/tests/ghci/scripts/T11975.script | 9 +++ testsuite/tests/ghci/scripts/T11975.stdout | 15 +++++ testsuite/tests/ghci/scripts/all.T | 2 + 18 files changed, 278 insertions(+), 77 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 4d517c4d33ab17cdbb2c61d644ad411d942d7d44 From git at git.haskell.org Wed May 25 21:53:17 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 May 2016 21:53:17 +0000 (UTC) Subject: [commit: ghc] branch 'wip/T12105' created Message-ID: <20160525215317.C636E3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc New branch : wip/T12105 Referencing: 94c5d25ff85f0ac2a9e43744660b0fe27270ca95 From git at git.haskell.org Wed May 25 21:53:20 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Wed, 25 May 2016 21:53:20 +0000 (UTC) Subject: [commit: ghc] wip/T12105: wip/T12105 (94c5d25) Message-ID: <20160525215320.9348A3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/T12105 Link : http://ghc.haskell.org/trac/ghc/changeset/94c5d25ff85f0ac2a9e43744660b0fe27270ca95/ghc >--------------------------------------------------------------- commit 94c5d25ff85f0ac2a9e43744660b0fe27270ca95 Author: Alan Zimmerman Date: Wed May 25 00:09:34 2016 +0200 wip/T12105 updates submodule haddock >--------------------------------------------------------------- 94c5d25ff85f0ac2a9e43744660b0fe27270ca95 compiler/deSugar/Check.hs | 5 +- compiler/deSugar/DsBinds.hs | 8 +- compiler/deSugar/DsExpr.hs | 14 +- compiler/deSugar/DsMeta.hs | 2 +- compiler/hsSyn/Convert.hs | 27 ++- compiler/hsSyn/HsBinds.hs | 58 +++-- compiler/hsSyn/HsDecls.hs | 87 +++++--- compiler/hsSyn/HsExpr.hs | 244 +++++++++++++++------ compiler/hsSyn/HsExpr.hs-boot | 29 ++- compiler/hsSyn/HsLit.hs | 5 +- compiler/hsSyn/HsPat.hs | 23 +- compiler/hsSyn/HsPat.hs-boot | 5 +- compiler/hsSyn/HsSyn.hs | 3 +- compiler/hsSyn/HsTypes.hs | 58 +++-- compiler/hsSyn/HsUtils.hs | 27 ++- compiler/hsSyn/PlaceHolder.hs | 10 + compiler/main/HscStats.hs | 3 + compiler/parser/Parser.y | 4 +- compiler/parser/RdrHsSyn.hs | 6 +- compiler/rename/RnBinds.hs | 16 +- compiler/typecheck/TcAnnotations.hs | 4 +- compiler/typecheck/TcArrows.hs | 4 +- compiler/typecheck/TcBinds.hs | 9 +- compiler/typecheck/TcEnv.hs | 9 +- compiler/typecheck/TcExpr.hs | 3 +- compiler/typecheck/TcGenDeriv.hs | 46 ++-- compiler/typecheck/TcInstDcls.hs | 5 +- compiler/typecheck/TcMatches.hs | 12 +- compiler/typecheck/TcMatches.hs-boot | 4 +- compiler/typecheck/TcPat.hs | 4 +- compiler/typecheck/TcPatSyn.hs | 24 +- compiler/typecheck/TcRnDriver.hs | 3 +- compiler/typecheck/TcTyDecls.hs | 9 +- testsuite/tests/ghc-api/landmines/landmines.stdout | 4 +- utils/haddock | 2 +- 35 files changed, 518 insertions(+), 258 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 94c5d25ff85f0ac2a9e43744660b0fe27270ca95 From git at git.haskell.org Thu May 26 16:25:14 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 26 May 2016 16:25:14 +0000 (UTC) Subject: [commit: ghc] master: Fix bytecode gen to deal with rep-polymorphism (0f1e315) Message-ID: <20160526162514.DED643A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0f1e315b9274725c4a2c975f4d06a5c956cf5385/ghc >--------------------------------------------------------------- commit 0f1e315b9274725c4a2c975f4d06a5c956cf5385 Author: Simon Peyton Jones Date: Thu May 26 14:20:29 2016 +0100 Fix bytecode gen to deal with rep-polymorphism When faced runtime-rep-polymorphic code from a pattern-synonym matcher, the bytecode generator was treating the result as lifted, which it isn't. The fix is just to treat those rep-polymorphic continuations like unlifted types, and add a dummy arg. Trac #12007 is a case in point. >--------------------------------------------------------------- 0f1e315b9274725c4a2c975f4d06a5c956cf5385 compiler/ghci/ByteCodeGen.hs | 37 ++++++++++++++++++++---------- testsuite/tests/ghci/scripts/T12007.hs | 7 ++++++ testsuite/tests/ghci/scripts/T12007.script | 3 +++ testsuite/tests/ghci/scripts/T12007.stdout | 1 + testsuite/tests/ghci/scripts/all.T | 1 + 5 files changed, 37 insertions(+), 12 deletions(-) diff --git a/compiler/ghci/ByteCodeGen.hs b/compiler/ghci/ByteCodeGen.hs index f1d0670..e752fc2 100644 --- a/compiler/ghci/ByteCodeGen.hs +++ b/compiler/ghci/ByteCodeGen.hs @@ -31,6 +31,7 @@ import Literal import PrimOp import CoreFVs import Type +import Kind ( isLiftedTypeKind ) import DataCon import TyCon import Util @@ -482,35 +483,47 @@ schemeE d s p (AnnLet binds (_,body)) = do thunk_codes <- sequence compile_binds return (alloc_code `appOL` concatOL thunk_codes `appOL` body_code) --- introduce a let binding for a ticked case expression. This rule +-- Introduce a let binding for a ticked case expression. This rule -- *should* only fire when the expression was not already let-bound -- (the code gen for let bindings should take care of that). Todo: we -- call exprFreeVars on a deAnnotated expression, this may not be the -- best way to calculate the free vars but it seemed like the least -- intrusive thing to do schemeE d s p exp@(AnnTick (Breakpoint _id _fvs) _rhs) - = if isUnliftedType ty - then do - -- If the result type is unlifted, then we must generate + | isLiftedTypeKind (typeKind ty) + = do id <- newId ty + -- Todo: is emptyVarSet correct on the next line? + let letExp = AnnLet (AnnNonRec id (fvs, exp)) (emptyDVarSet, AnnVar id) + schemeE d s p letExp + + | otherwise + = do -- If the result type is not definitely lifted, then we must generate -- let f = \s . tick e -- in f realWorld# -- When we stop at the breakpoint, _result will have an unlifted -- type and hence won't be bound in the environment, but the -- breakpoint will otherwise work fine. + -- + -- NB (Trac #12007) this /also/ applies for if (ty :: TYPE r), where + -- r :: RuntimeRep is a variable. This can happen in the + -- continuations for a pattern-synonym matcher + -- match = /\(r::RuntimeRep) /\(a::TYPE r). + -- \(k :: Int -> a) \(v::T). + -- case v of MkV n -> k n + -- Here (k n) :: a :: Type r, so we don't know if it's lifted + -- or not; but that should be fine provided we add that void arg. + id <- newId (mkFunTy realWorldStatePrimTy ty) st <- newId realWorldStatePrimTy let letExp = AnnLet (AnnNonRec id (fvs, AnnLam st (emptyDVarSet, exp))) (emptyDVarSet, (AnnApp (emptyDVarSet, AnnVar id) (emptyDVarSet, AnnVar realWorldPrimId))) schemeE d s p letExp - else do - id <- newId ty - -- Todo: is emptyVarSet correct on the next line? - let letExp = AnnLet (AnnNonRec id (fvs, exp)) (emptyDVarSet, AnnVar id) - schemeE d s p letExp - where exp' = deAnnotate' exp - fvs = exprFreeVarsDSet exp' - ty = exprType exp' + + where + exp' = deAnnotate' exp + fvs = exprFreeVarsDSet exp' + ty = exprType exp' -- ignore other kinds of tick schemeE d s p (AnnTick _ (_, rhs)) = schemeE d s p rhs diff --git a/testsuite/tests/ghci/scripts/T12007.hs b/testsuite/tests/ghci/scripts/T12007.hs new file mode 100644 index 0000000..c678727 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T12007.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE PatternSynonyms #-} +module T12007 where + +data Foo a = Foo a a + +pattern A a1 a2 = Foo a1 a2 +pattern B a1 a2 = A a1 a2 diff --git a/testsuite/tests/ghci/scripts/T12007.script b/testsuite/tests/ghci/scripts/T12007.script new file mode 100644 index 0000000..8e6a27a --- /dev/null +++ b/testsuite/tests/ghci/scripts/T12007.script @@ -0,0 +1,3 @@ +:l T12007 +let f (B x y) = (y,x) +f (Foo 'c' 'd') diff --git a/testsuite/tests/ghci/scripts/T12007.stdout b/testsuite/tests/ghci/scripts/T12007.stdout new file mode 100644 index 0000000..a6a2425 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T12007.stdout @@ -0,0 +1 @@ +('d','c') diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T index 6e9e91b..680bc8d 100755 --- a/testsuite/tests/ghci/scripts/all.T +++ b/testsuite/tests/ghci/scripts/all.T @@ -252,3 +252,4 @@ test('T11456', normal, ghci_script, ['T11456.script']) test('TypeAppData', normal, ghci_script, ['TypeAppData.script']) test('T11728', normal, ghci_script, ['T11728.script']) test('T11376', normal, ghci_script, ['T11376.script']) +test('T12007', normal, ghci_script, ['T12007.script']) From git at git.haskell.org Thu May 26 16:25:18 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 26 May 2016 16:25:18 +0000 (UTC) Subject: [commit: ghc] master: Reduce special-casing for nullary unboxed tuple (e9e61f1) Message-ID: <20160526162518.32FA33A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/e9e61f18a548b70693f4ccd245bc56335c94b498/ghc >--------------------------------------------------------------- commit e9e61f18a548b70693f4ccd245bc56335c94b498 Author: Simon Peyton Jones Date: Thu May 26 15:24:53 2016 +0100 Reduce special-casing for nullary unboxed tuple When we built the kind of a nullary unboxed tuple, we said, in TysWiredIn.mk_tuple: res_rep | arity == 0 = voidRepDataConTy -- See Note [Nullary unboxed tuple] in Type | otherwise = unboxedTupleRepDataConTy But this is bogus. The Note deals with what the 'unarise' transformation does, and up to that point it's simpler and more uniform to treat nullary unboxed tuples the same as all the others. Nicer now. And it fixes the Lint error in Trac #12115 >--------------------------------------------------------------- e9e61f18a548b70693f4ccd245bc56335c94b498 compiler/prelude/TysWiredIn.hs | 11 +- compiler/typecheck/TcHsType.hs | 2 +- compiler/types/TyCoRep.hs | 7 + compiler/types/Type.hs | 254 ++++++++++++----------- testsuite/tests/codeGen/should_compile/T12115.hs | 9 + testsuite/tests/codeGen/should_compile/all.T | 1 + 6 files changed, 153 insertions(+), 131 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc e9e61f18a548b70693f4ccd245bc56335c94b498 From git at git.haskell.org Thu May 26 18:38:29 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 26 May 2016 18:38:29 +0000 (UTC) Subject: [commit: ghc] master: Coverage.hs: Fix a duplication (5b145c9) Message-ID: <20160526183829.AA21C3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5b145c98900470c09ed6555e481b19cb27ec8b14/ghc >--------------------------------------------------------------- commit 5b145c98900470c09ed6555e481b19cb27ec8b14 Author: ?mer Sinan A?acan Date: Thu May 26 12:06:35 2016 -0400 Coverage.hs: Fix a duplication >--------------------------------------------------------------- 5b145c98900470c09ed6555e481b19cb27ec8b14 compiler/deSugar/Coverage.hs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/compiler/deSugar/Coverage.hs b/compiler/deSugar/Coverage.hs index b082a02..5287320 100644 --- a/compiler/deSugar/Coverage.hs +++ b/compiler/deSugar/Coverage.hs @@ -71,11 +71,8 @@ addTicksToBinds addTicksToBinds hsc_env mod mod_loc exports tyCons binds | let dflags = hsc_dflags hsc_env passes = coveragePasses dflags, not (null passes), - Just orig_file <- ml_hs_file mod_loc = do - - if "boot" `isSuffixOf` orig_file - then return (binds, emptyHpcInfo False, Nothing) - else do + Just orig_file <- ml_hs_file mod_loc, + not ("boot" `isSuffixOf` orig_file) = do us <- mkSplitUniqSupply 'C' -- for cost centres let orig_file2 = guessSourceFile binds orig_file From git at git.haskell.org Thu May 26 18:38:32 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Thu, 26 May 2016 18:38:32 +0000 (UTC) Subject: [commit: ghc] master: StgCmmExpr: Fix a duplication (5b8bec2) Message-ID: <20160526183832.550223A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/5b8bec25305eee2dc0ad9ec2cc385f2055abc892/ghc >--------------------------------------------------------------- commit 5b8bec25305eee2dc0ad9ec2cc385f2055abc892 Author: ?mer Sinan A?acan Date: Thu May 26 12:04:36 2016 -0400 StgCmmExpr: Fix a duplication >--------------------------------------------------------------- 5b8bec25305eee2dc0ad9ec2cc385f2055abc892 compiler/codeGen/StgCmmExpr.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/codeGen/StgCmmExpr.hs b/compiler/codeGen/StgCmmExpr.hs index a472191..79b9cd0 100644 --- a/compiler/codeGen/StgCmmExpr.hs +++ b/compiler/codeGen/StgCmmExpr.hs @@ -582,7 +582,6 @@ cgAlts gc_plan bndr (AlgAlt tycon) alts tag_expr = cmmConstrTag1 dflags (CmmReg bndr_reg) branches' = [(tag+1,branch) | (tag,branch) <- branches] emitSwitch tag_expr branches' mb_deflt 1 fam_sz - return AssignedDirectly else -- No, get tag from info table do dflags <- getDynFlags @@ -591,7 +590,8 @@ cgAlts gc_plan bndr (AlgAlt tycon) alts untagged_ptr = cmmRegOffB bndr_reg (-1) tag_expr = getConstrTag dflags (untagged_ptr) emitSwitch tag_expr branches mb_deflt 0 (fam_sz - 1) - return AssignedDirectly } + + ; return AssignedDirectly } cgAlts _ _ _ _ = panic "cgAlts" -- UbxTupAlt and PolyAlt have only one alternative From git at git.haskell.org Fri May 27 09:18:03 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 27 May 2016 09:18:03 +0000 (UTC) Subject: [commit: ghc] master: StgCmmCon: Do not generate moves from unused fields to local variables (cd50d23) Message-ID: <20160527091803.EA71F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/cd50d236a4b29a9932ce4e12972db1fdd69f31be/ghc >--------------------------------------------------------------- commit cd50d236a4b29a9932ce4e12972db1fdd69f31be Author: ?mer Sinan A?acan Date: Fri May 27 05:18:47 2016 -0400 StgCmmCon: Do not generate moves from unused fields to local variables Say we have a record like this: data Rec = Rec { f1 :: Int , f2 :: Int , f3 :: Int , f4 :: Int , f5 :: Int } Before this patch, the code generated for `f1` looked like this: f1_entry() {offset ... cJT: _sI6::P64 = R1; _sI7::P64 = P64[_sI6::P64 + 7]; _sI8::P64 = P64[_sI6::P64 + 15]; _sI9::P64 = P64[_sI6::P64 + 23]; _sIa::P64 = P64[_sI6::P64 + 31]; _sIb::P64 = P64[_sI6::P64 + 39]; R1 = _sI7::P64 & (-8); Sp = Sp + 8; call (I64[R1])(R1) args: 8, res: 0, upd: 8; } Note how all fields of the record are moved to local variables, even though they're never used. These moves make it to the final assembly: f1_info: ... _cJT: movq 7(%rbx),%rax movq 15(%rbx),%rcx movq 23(%rbx),%rcx movq 31(%rbx),%rcx movq 39(%rbx),%rbx movq %rax,%rbx andq $-8,%rbx addq $8,%rbp jmp *(%rbx) With this patch we stop generating these move instructions. Cmm becomes this: f1_entry() {offset ... cJT: _sI6::P64 = R1; _sI7::P64 = P64[_sI6::P64 + 7]; R1 = _sI7::P64 & (-8); Sp = Sp + 8; call (I64[R1])(R1) args: 8, res: 0, upd: 8; } Assembly becomes this: f1_info: ... _cJT: movq 7(%rbx),%rax movq %rax,%rbx andq $-8,%rbx addq $8,%rbp jmp *(%rbx) It turns out CmmSink already optimizes this, but it's better to generate better code in the first place. Reviewers: simonmar, simonpj, austin, bgamari Reviewed By: simonmar, simonpj Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D2269 >--------------------------------------------------------------- cd50d236a4b29a9932ce4e12972db1fdd69f31be compiler/codeGen/StgCmmCon.hs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/compiler/codeGen/StgCmmCon.hs b/compiler/codeGen/StgCmmCon.hs index 745dd72..04257dd 100644 --- a/compiler/codeGen/StgCmmCon.hs +++ b/compiler/codeGen/StgCmmCon.hs @@ -43,6 +43,7 @@ import PrelInfo import Outputable import Platform import Util +import MonadUtils (mapMaybeM) import Control.Monad import Data.Char @@ -258,12 +259,18 @@ bindConArgs (DataAlt con) base args -- The binding below forces the masking out of the tag bits -- when accessing the constructor field. - bind_arg :: (NonVoid Id, VirtualHpOffset) -> FCode LocalReg - bind_arg (arg, offset) - = do emit $ mkTaggedObjectLoad dflags (idToReg dflags arg) base offset tag - bindArgToReg arg - mapM bind_arg args_w_offsets + bind_arg :: (NonVoid Id, VirtualHpOffset) -> FCode (Maybe LocalReg) + bind_arg (arg@(NonVoid b), offset) + | isDeadBinder b = + -- Do not load unused fields from objects to local variables. + -- (CmmSink can optimize this, but it's cheap and common enough + -- to handle here) + return Nothing + | otherwise = do + emit $ mkTaggedObjectLoad dflags (idToReg dflags arg) base offset tag + Just <$> bindArgToReg arg + + mapMaybeM bind_arg args_w_offsets bindConArgs _other_con _base args = ASSERT( null args ) return [] - From git at git.haskell.org Fri May 27 13:35:16 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 27 May 2016 13:35:16 +0000 (UTC) Subject: [commit: ghc] master: More fixes for unboxed tuples (b43a793) Message-ID: <20160527133516.8DA093A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/b43a7936ebf77bce744d50a131d686c83f63e60b/ghc >--------------------------------------------------------------- commit b43a7936ebf77bce744d50a131d686c83f63e60b Author: Simon Peyton Jones Date: Fri May 27 14:34:45 2016 +0100 More fixes for unboxed tuples This is a continuation of commit e9e61f18a548b70693f4ccd245bc56335c94b498 Date: Thu May 26 15:24:53 2016 +0100 Reduce special-casing for nullary unboxed tuple which related to Trac #12115. But typecheck/should_run/tcrun051 revealed that my patch was incomplete. This fixes it, by removing another special case in Type.repType. I had also missed a case in UnariseStg.unariseIdBinder. I took the opportunity to add explanatory notes Note [Unarisation] Note [Unarisation and nullary tuples] in UnariseStg >--------------------------------------------------------------- b43a7936ebf77bce744d50a131d686c83f63e60b compiler/simplStg/UnariseStg.hs | 87 +++++++++++++++++++++++++++++++++-------- compiler/types/Type.hs | 10 ++--- 2 files changed, 76 insertions(+), 21 deletions(-) diff --git a/compiler/simplStg/UnariseStg.hs b/compiler/simplStg/UnariseStg.hs index 4c8a665..9eca768 100644 --- a/compiler/simplStg/UnariseStg.hs +++ b/compiler/simplStg/UnariseStg.hs @@ -4,8 +4,8 @@ Note [Unarisation] ~~~~~~~~~~~~~~~~~~ - -The idea of this pass is to translate away *all* unboxed-tuple binders. So for example: +The idea of this pass is to translate away *all* unboxed-tuple binders. +So for example: f (x :: (# Int, Bool #)) = f x + f (# 1, True #) ==> @@ -18,10 +18,55 @@ this example the type of 'f' changes, for example. STG fed to the code generators *must* be unarised because the code generators do not support unboxed tuple binders natively. +In more detail: + +Suppose that a variable x : (# t1, t2 #). + + * At the binding site for x, make up fresh vars x1:t1, x2:t2 + + * Extend the UniariseEnv x :-> [x1,x2] + + * Replace the binding with a curried binding for x1,x2 + Lambda: \x.e ==> \x1 x2. e + Case alt: MkT a b x c d -> e ==> MkT a b x1 x2 c d -> e + + * Replace argument occurrences with a sequence of args + via a lookup in UnariseEnv + f a b x c d ==> f a b x1 x2 c d + + * Replace tail-call occurrences with an unboxed tuple + via a lookup in UnariseEnv + x ==> (# x1, x2 #) + So, for example + f x = x ==> f x1 x2 = (# x1, x2 #) + + This applies to case scrutinees too + case x of (# a,b #) -> e ==> case (# x1,x2 #) of (# a,b #) -> e + I think we rely on the code generator to short-circuit this + case without generating any actual code. + +Of course all this applies recursively, so that we flattn out nested tuples. + +Note [Unarisation and nullary tuples] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +The above scheme has a special cases for nullary unboxed tuples, x :: (# #) + + * Extend the UnariseEnv with x :-> [voidPrimId] + + * Replace bindings with a binding for void:Void# + \x. e => \void. e + and similarly case alternatives + + * If we find (# #) as an argument all by itself + f ...(# #)... + it looks like an Id, so we look up in UnariseEnv. We want to replace it + with voidPrimId, so the convenient thing is to initalise the UniariseEnv + with (# #) :-> [voidPrimId] + +See also Note [Nullary unboxed tuple] in Type.hs. Note [Unarisation and arity] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Because of unarisation, the arity that will be recorded in the generated info table for an Id may be larger than the idArity. Instead we record what we call the RepArity, which is the Arity taking into account any expanded arguments, and corresponds to @@ -39,7 +84,7 @@ import StgSyn import VarEnv import UniqSupply import Id -import MkId (realWorldPrimId) +import MkId ( voidPrimId, voidArgId ) import Type import TysWiredIn import DataCon @@ -58,13 +103,12 @@ import BasicTypes -- the domain of the mapping at all. type UnariseEnv = VarEnv [Id] -ubxTupleId0 :: Id -ubxTupleId0 = dataConWorkId (tupleDataCon Unboxed 0) - unarise :: UniqSupply -> [StgBinding] -> [StgBinding] unarise us binds = zipWith (\us -> unariseBinding us init_env) (listSplitUniqSupply us) binds - where -- See Note [Nullary unboxed tuple] in Type.hs - init_env = unitVarEnv ubxTupleId0 [realWorldPrimId] + where + -- See Note [Unarisation and nullary tuples] + nullary_tup = dataConWorkId unboxedUnitDataCon + init_env = unitVarEnv nullary_tup [voidPrimId] unariseBinding :: UniqSupply -> UnariseEnv -> StgBinding -> StgBinding unariseBinding us rho bind = case bind of @@ -170,7 +214,7 @@ unariseIds rho = concatMap (unariseId rho) unariseId :: UnariseEnv -> Id -> [Id] unariseId rho x | Just ys <- lookupVarEnv rho x - = ASSERT2( case repType (idType x) of UbxTupleRep _ -> True; _ -> x == ubxTupleId0 + = ASSERT2( case repType (idType x) of UbxTupleRep _ -> True; _ -> False , text "unariseId: not unboxed tuple" <+> ppr x ) ys @@ -182,13 +226,24 @@ unariseId rho x unariseIdBinders :: UniqSupply -> UnariseEnv -> [Id] -> (UniqSupply, UnariseEnv, [Id]) unariseIdBinders us rho xs = third3 concat $ mapAccumL2 unariseIdBinder us rho xs -unariseIdBinder :: UniqSupply -> UnariseEnv -> Id -> (UniqSupply, UnariseEnv, [Id]) +unariseIdBinder :: UniqSupply -> UnariseEnv + -> Id -- Binder + -> (UniqSupply, + UnariseEnv, -- What to expand to at occurrence sites + [Id]) -- What to expand to at binding site unariseIdBinder us rho x = case repType (idType x) of - UnaryRep _ -> (us, rho, [x]) - UbxTupleRep tys -> let (us0, us1) = splitUniqSupply us - ys = unboxedTupleBindersFrom us0 x tys - rho' = extendVarEnv rho x ys - in (us1, rho', ys) + UnaryRep {} -> (us, rho, [x]) + + UbxTupleRep tys + | null tys -> -- See Note [Unarisation and nullary tuples] + let ys = [voidPrimId] + rho' = extendVarEnv rho x ys + in (us, rho', [voidArgId]) + + | otherwise -> let (us0, us1) = splitUniqSupply us + ys = unboxedTupleBindersFrom us0 x tys + rho' = extendVarEnv rho x ys + in (us1, rho', ys) unboxedTupleBindersFrom :: UniqSupply -> Id -> [UnaryType] -> [Id] unboxedTupleBindersFrom us x tys = zipWith (mkSysLocalOrCoVar fs) (uniqsFromSupply us) tys diff --git a/compiler/types/Type.hs b/compiler/types/Type.hs index 913664e..9aaf3de 100644 --- a/compiler/types/Type.hs +++ b/compiler/types/Type.hs @@ -141,7 +141,7 @@ module Type ( tyConsOfType, -- * Type representation for the code generator - typePrimRep, typeRepArity, kindPrimRep, tyConPrimRep, + typePrimRep, typeRepArity, tyConPrimRep, -- * Main type substitution data types TvSubstEnv, -- Representation widely visible @@ -1715,7 +1715,7 @@ typeSize (CoercionTy co) = coercionSize co ********************************************************************** -} {- Note [Nullary unboxed tuple] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ At runtime we represent the nullary unboxed tuple as the type Void#. To see why, consider f2 :: (# Int, Int #) -> Int @@ -1731,6 +1731,8 @@ we'll transform to We do not want to give f0 zero arguments, otherwise a lambda will turn into a thunk! So we want to get f0 :: Void# -> Int + +See Note [Unarisation and nullary tuples] in UnariseStg for more detail. -} type UnaryType = Type @@ -1777,9 +1779,7 @@ repType ty = go rec_nts' (newTyConInstRhs tc tys) | isUnboxedTupleTyCon tc - = if null tys - then UnaryRep voidPrimTy -- See Note [Nullary unboxed tuple] - else UbxTupleRep (concatMap (flattenRepType . go rec_nts) non_rr_tys) + = UbxTupleRep (concatMap (flattenRepType . go rec_nts) non_rr_tys) where -- See Note [Unboxed tuple RuntimeRep vars] in TyCon non_rr_tys = dropRuntimeRepArgs tys From git at git.haskell.org Fri May 27 13:35:19 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 27 May 2016 13:35:19 +0000 (UTC) Subject: [commit: ghc] master: Comments and white space only (72fd407) Message-ID: <20160527133519.3B4BB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/72fd407e15c7cc1d1ad671d6b4cd184a40ea2a61/ghc >--------------------------------------------------------------- commit 72fd407e15c7cc1d1ad671d6b4cd184a40ea2a61 Author: Simon Peyton Jones Date: Fri May 27 14:38:25 2016 +0100 Comments and white space only >--------------------------------------------------------------- 72fd407e15c7cc1d1ad671d6b4cd184a40ea2a61 compiler/codeGen/StgCmmClosure.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/compiler/codeGen/StgCmmClosure.hs b/compiler/codeGen/StgCmmClosure.hs index f9d0990..d76eedd 100644 --- a/compiler/codeGen/StgCmmClosure.hs +++ b/compiler/codeGen/StgCmmClosure.hs @@ -169,7 +169,7 @@ data LambdaFormInfo -- Imported things which we *do* know something about use -- one of the other LF constructors (eg LFReEntrant for -- known functions) - !Bool -- True <=> *might* be a function type + !Bool -- True <=> *might* be a function type -- The False case is good when we want to enter it, -- because then we know the entry code will do -- For a function, the entry code is the fast entry point @@ -212,9 +212,9 @@ data StandardFormInfo mkLFArgument :: Id -> LambdaFormInfo mkLFArgument id - | isUnliftedType ty = LFUnlifted + | isUnliftedType ty = LFUnlifted | might_be_a_function ty = LFUnknown True - | otherwise = LFUnknown False + | otherwise = LFUnknown False where ty = idType id @@ -534,6 +534,8 @@ getCallMethod _ _name _ LFUnlifted n_args _v_args _cg_loc _self_loop_info getCallMethod _ _name _ (LFCon _) n_args _v_args _cg_loc _self_loop_info = ASSERT( n_args == 0 ) ReturnIt + -- n_args=0 because it'd be ill-typed to apply a saturated + -- constructor application to anything getCallMethod dflags name id (LFThunk _ _ updatable std_form_info is_fun) n_args _v_args _cg_loc _self_loop_info From git at git.haskell.org Fri May 27 14:45:07 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 27 May 2016 14:45:07 +0000 (UTC) Subject: [commit: ghc] master: StgCmmExpr: Remove a redundant list (59250dc) Message-ID: <20160527144507.E81CE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/59250dce325a6115c8419cb8578025f0d76184d2/ghc >--------------------------------------------------------------- commit 59250dce325a6115c8419cb8578025f0d76184d2 Author: ?mer Sinan A?acan Date: Fri May 27 10:47:50 2016 -0400 StgCmmExpr: Remove a redundant list >--------------------------------------------------------------- 59250dce325a6115c8419cb8578025f0d76184d2 compiler/codeGen/StgCmmExpr.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/codeGen/StgCmmExpr.hs b/compiler/codeGen/StgCmmExpr.hs index 79b9cd0..a697ff6 100644 --- a/compiler/codeGen/StgCmmExpr.hs +++ b/compiler/codeGen/StgCmmExpr.hs @@ -404,7 +404,7 @@ cgCase (StgApp v []) bndr alt_type@(PrimAlt _) alts ; v_info <- getCgIdInfo v ; emitAssign (CmmLocal (idToReg dflags (NonVoid bndr))) (idInfoToAmode v_info) - ; bindArgsToRegs [NonVoid bndr] + ; bindArgToReg (NonVoid bndr) ; cgAlts (NoGcInAlts,AssignedDirectly) (NonVoid bndr) alt_type alts } where reps_compatible = idPrimRep v == idPrimRep bndr From git at git.haskell.org Fri May 27 14:59:57 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 27 May 2016 14:59:57 +0000 (UTC) Subject: [commit: ghc] master: Do not init record accessors as exported (3a00ff9) Message-ID: <20160527145957.04EFA3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3a00ff92a3ee66c096b85b180d247d1a471a6b6e/ghc >--------------------------------------------------------------- commit 3a00ff92a3ee66c096b85b180d247d1a471a6b6e Author: ?mer Sinan A?acan Date: Fri May 27 11:02:47 2016 -0400 Do not init record accessors as exported This was causing redundant code generation when accessors are not actually exported, as they were being marked as "exported" at initialization. Test Plan: validate Reviewers: simonpj, austin, bgamari Reviewed By: simonpj Subscribers: mpickering, thomie Differential Revision: https://phabricator.haskell.org/D2270 >--------------------------------------------------------------- 3a00ff92a3ee66c096b85b180d247d1a471a6b6e compiler/basicTypes/Id.hs | 7 +++++++ compiler/deSugar/Desugar.hs | 5 ++++- compiler/typecheck/TcTyDecls.hs | 7 ++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/compiler/basicTypes/Id.hs b/compiler/basicTypes/Id.hs index b589809..6045937 100644 --- a/compiler/basicTypes/Id.hs +++ b/compiler/basicTypes/Id.hs @@ -33,6 +33,7 @@ module Id ( mkLocalId, mkLocalCoVar, mkLocalIdOrCoVar, mkLocalIdOrCoVarWithInfo, mkLocalIdWithInfo, mkExportedLocalId, mkExportedVanillaId, + mkNonExportedLocalId, mkSysLocal, mkSysLocalM, mkSysLocalOrCoVar, mkSysLocalOrCoVarM, mkUserLocal, mkUserLocalOrCoVar, mkTemplateLocals, mkTemplateLocalsNum, mkTemplateLocal, @@ -287,6 +288,12 @@ mkExportedLocalId :: IdDetails -> Name -> Type -> Id mkExportedLocalId details name ty = Var.mkExportedLocalVar details name ty vanillaIdInfo -- Note [Free type variables] +-- | Create a local 'Id' that is marked as not-exported. +-- These may be removed as dead code. +mkNonExportedLocalId :: IdDetails -> Name -> Type -> Id +mkNonExportedLocalId details name ty = + Var.mkLocalVar details name ty vanillaIdInfo + mkExportedVanillaId :: Name -> Type -> Id mkExportedVanillaId name ty = Var.mkExportedLocalVar VanillaId name ty vanillaIdInfo -- Note [Free type variables] diff --git a/compiler/deSugar/Desugar.hs b/compiler/deSugar/Desugar.hs index 75f6a34..c7a869d 100644 --- a/compiler/deSugar/Desugar.hs +++ b/compiler/deSugar/Desugar.hs @@ -296,7 +296,10 @@ deSugar hsc_env (text "Desugar"<+>brackets (ppr mod)) (const ()) $ do { -- Desugar the program - ; let export_set = availsToNameSet exports + ; let export_set = + -- Used to be 'availsToNameSet', but we now export selectors + -- only when necessary. See #12125. + availsToNameSetWithSelectors exports target = hscTarget dflags hpcInfo = emptyHpcInfo other_hpc_info diff --git a/compiler/typecheck/TcTyDecls.hs b/compiler/typecheck/TcTyDecls.hs index 2d6637e..8c91b48 100644 --- a/compiler/typecheck/TcTyDecls.hs +++ b/compiler/typecheck/TcTyDecls.hs @@ -941,7 +941,12 @@ mkOneRecordSelector all_cons idDetails fl lbl = flLabel fl sel_name = flSelector fl - sel_id = mkExportedLocalId rec_details sel_name sel_ty + sel_id = + -- Do not mark record selectors as exported to avoid keeping these Ids + -- alive unnecessarily. See #12125. Selectors are now marked as exported + -- when necessary by desugarer ('Desugar.addExportFlagsAndRules', also see + -- uses of 'availsToNameSetWithSelectors' in 'Desugar.hs'). + mkNonExportedLocalId rec_details sel_name sel_ty rec_details = RecSelId { sel_tycon = idDetails, sel_naughty = is_naughty } -- Find a representative constructor, con1 From git at git.haskell.org Fri May 27 15:07:19 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 27 May 2016 15:07:19 +0000 (UTC) Subject: [commit: ghc] master: Typos in comments (3f20da1) Message-ID: <20160527150719.9E2033A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/3f20da1c569561248ad6282111df2a2d42f34768/ghc >--------------------------------------------------------------- commit 3f20da1c569561248ad6282111df2a2d42f34768 Author: Gabor Greif Date: Fri May 27 17:09:33 2016 +0200 Typos in comments >--------------------------------------------------------------- 3f20da1c569561248ad6282111df2a2d42f34768 compiler/simplStg/UnariseStg.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/simplStg/UnariseStg.hs b/compiler/simplStg/UnariseStg.hs index 9eca768..d580942 100644 --- a/compiler/simplStg/UnariseStg.hs +++ b/compiler/simplStg/UnariseStg.hs @@ -24,7 +24,7 @@ Suppose that a variable x : (# t1, t2 #). * At the binding site for x, make up fresh vars x1:t1, x2:t2 - * Extend the UniariseEnv x :-> [x1,x2] + * Extend the UnariseEnv x :-> [x1,x2] * Replace the binding with a curried binding for x1,x2 Lambda: \x.e ==> \x1 x2. e @@ -45,7 +45,7 @@ Suppose that a variable x : (# t1, t2 #). I think we rely on the code generator to short-circuit this case without generating any actual code. -Of course all this applies recursively, so that we flattn out nested tuples. +Of course all this applies recursively, so that we flatten out nested tuples. Note [Unarisation and nullary tuples] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -60,7 +60,7 @@ The above scheme has a special cases for nullary unboxed tuples, x :: (# #) * If we find (# #) as an argument all by itself f ...(# #)... it looks like an Id, so we look up in UnariseEnv. We want to replace it - with voidPrimId, so the convenient thing is to initalise the UniariseEnv + with voidPrimId, so the convenient thing is to initalise the UnariseEnv with (# #) :-> [voidPrimId] See also Note [Nullary unboxed tuple] in Type.hs. From git at git.haskell.org Fri May 27 18:10:04 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 27 May 2016 18:10:04 +0000 (UTC) Subject: [commit: ghc] master: Clarify users' guide section on GeneralizedNewtypeDeriving (d0dd572) Message-ID: <20160527181004.20A013A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d0dd572b707631a104e060711faf9bd169bdc968/ghc >--------------------------------------------------------------- commit d0dd572b707631a104e060711faf9bd169bdc968 Author: Ryan Scott Date: Fri May 27 14:12:57 2016 -0400 Clarify users' guide section on GeneralizedNewtypeDeriving Summary: It seemed to imply that GHC was generating infelicitous code when it actually wasn't. Fixes #12047. Reviewers: hvr, bgamari, austin Reviewed By: austin Subscribers: thomie, Iceland_jack Differential Revision: https://phabricator.haskell.org/D2273 GHC Trac Issues: #12047 >--------------------------------------------------------------- d0dd572b707631a104e060711faf9bd169bdc968 docs/users_guide/glasgow_exts.rst | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index a8a7f8f..5860878 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -3814,16 +3814,26 @@ Generalising the deriving clause GHC now permits such instances to be derived instead, using the flag :ghc-flag:`-XGeneralizedNewtypeDeriving`, so one can write :: - newtype Dollars = Dollars Int deriving (Eq,Show,Num) + newtype Dollars = Dollars { getDollars :: Int } deriving (Eq,Show,Num) and the implementation uses the *same* ``Num`` dictionary for -``Dollars`` as for ``Int``. Notionally, the compiler derives an instance -declaration of the form :: +``Dollars`` as for ``Int``. In other words, GHC will generate something that +resembles the following code :: instance Num Int => Num Dollars -which just adds or removes the ``newtype`` constructor according to the -type. +and then attempt to simplify the ``Num Int`` context as much as possible. +GHC knows that there is a ``Num Int`` instance in scope, so it is able to +discharge the ``Num Int`` constraint, leaving the code that GHC actually +generates :: + + instance Num Dollars + +One can think of this instance being implementated with the same code as the +``Num Int`` instance, but with ``Dollars`` and ``getDollars`` added wherever +necessary in order to make it typecheck. (In practice, GHC uses a somewhat +different approach to code generation. See the :ref:`precise-gnd-specification` +section below for more details.) We can also derive instances of constructor classes in a similar way. For example, suppose we have implemented state and failure monad @@ -3876,6 +3886,8 @@ declarations are treated uniformly (and implemented just by reusing the dictionary for the representation type), *except* ``Show`` and ``Read``, which really behave differently for the newtype and its representation. +.. _precise-gnd-specification: + A more precise specification ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From git at git.haskell.org Fri May 27 20:46:13 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 27 May 2016 20:46:13 +0000 (UTC) Subject: [commit: packages/hpc] master: Testsuite: use TEST_HC_OPTS_INTERACTIVE (d8b5381) Message-ID: <20160527204613.E103B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/hpc On branch : master Link : http://git.haskell.org/packages/hpc.git/commitdiff/d8b5381bd5d03a3a75f4a1b91f1ede6fe0fd0ce9 >--------------------------------------------------------------- commit d8b5381bd5d03a3a75f4a1b91f1ede6fe0fd0ce9 Author: Thomas Miedema Date: Wed May 25 12:38:02 2016 +0200 Testsuite: use TEST_HC_OPTS_INTERACTIVE >--------------------------------------------------------------- d8b5381bd5d03a3a75f4a1b91f1ede6fe0fd0ce9 tests/ghc_ghci/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ghc_ghci/Makefile b/tests/ghc_ghci/Makefile index 22881d1..d8e5da6 100644 --- a/tests/ghc_ghci/Makefile +++ b/tests/ghc_ghci/Makefile @@ -9,5 +9,5 @@ include $(TOP)/mk/test.mk hpc_ghc_ghci: rm -f A.o A.hi '$(TEST_HC)' $(TEST_HC_OPTS) -fhpc -c A.hs - echo b | '$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -v0 --interactive B.hs + echo b | '$(TEST_HC)' $(TEST_HC_OPTS_INTERACTIVE) B.hs From git at git.haskell.org Fri May 27 20:46:33 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Fri, 27 May 2016 20:46:33 +0000 (UTC) Subject: [commit: ghc] master: Testsuite: don't use --interactive in Makefiles (d40682e) Message-ID: <20160527204633.1FE5F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/d40682ec74d802376d7cf50f2d3612b3292b29c5/ghc >--------------------------------------------------------------- commit d40682ec74d802376d7cf50f2d3612b3292b29c5 Author: Thomas Miedema Date: Wed May 25 13:24:34 2016 +0200 Testsuite: don't use --interactive in Makefiles Add a linter to encourage the use of `$(TEST_HC_OPTS_INTERACTIVE)` instead of `$(TEST_HC_OPTS) --interactive -ignore-dot-ghci -v0`. It's too easy to forget one of those flags when adding a new test. Update submodule hpc. Reviewed by: austin Differential Revision: https://phabricator.haskell.org/D2265 GHC Trac Issues: #11468 >--------------------------------------------------------------- d40682ec74d802376d7cf50f2d3612b3292b29c5 .arc-linters/check-cpp.py | 3 +-- .arc-linters/check-makefiles.py | 27 +++++++++++++++++++++++++++ .arclint | 5 +++++ libraries/hpc | 2 +- testsuite/tests/driver/Makefile | 26 +++++++++++++++----------- testsuite/tests/driver/mode001.stdout | 4 ++-- testsuite/tests/ghci/linking/Makefile | 16 ++++++++-------- testsuite/tests/ghci/linking/dyn/Makefile | 2 +- testsuite/tests/ghci/scripts/Makefile | 2 +- 9 files changed, 61 insertions(+), 26 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc d40682ec74d802376d7cf50f2d3612b3292b29c5 From git at git.haskell.org Sat May 28 11:03:45 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 28 May 2016 11:03:45 +0000 (UTC) Subject: [commit: ghc] wip/erikd/rts: RtsFlags.c: Const correct fixes (da861e6) Message-ID: <20160528110345.236453A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/rts Link : http://ghc.haskell.org/trac/ghc/changeset/da861e6da95c68905aa4a863f3caaff81adb6aee/ghc >--------------------------------------------------------------- commit da861e6da95c68905aa4a863f3caaff81adb6aee Author: Erik de Castro Lopo Date: Fri May 27 19:37:55 2016 +1000 RtsFlags.c: Const correct fixes Test Plan: validate Reviewers: hvr, austin, bgamari, simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2275 >--------------------------------------------------------------- da861e6da95c68905aa4a863f3caaff81adb6aee rts/RtsFlags.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c index 31a2c8b..1ec5db0 100644 --- a/rts/RtsFlags.c +++ b/rts/RtsFlags.c @@ -1609,8 +1609,8 @@ static rtsBool read_heap_profiling_flag(const char *arg) case 'b': if (arg[2] != '\0' && arg[3] != '\0') { { - char *left = strchr(arg, '{'); - char *right = strrchr(arg, '}'); + const char *left = strchr(arg, '{'); + const char *right = strrchr(arg, '}'); // curly braces are optional, for // backwards compat. From git at git.haskell.org Sat May 28 11:03:47 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 28 May 2016 11:03:47 +0000 (UTC) Subject: [commit: ghc] wip/erikd/rts: Fix detection and use of `USE_LIBDW` (54b2d1e) Message-ID: <20160528110347.CBADF3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/rts Link : http://ghc.haskell.org/trac/ghc/changeset/54b2d1e5231d86422ffff4eb1217080158c4bc81/ghc >--------------------------------------------------------------- commit 54b2d1e5231d86422ffff4eb1217080158c4bc81 Author: Erik de Castro Lopo Date: Sat May 28 19:49:42 2016 +1000 Fix detection and use of `USE_LIBDW` >--------------------------------------------------------------- 54b2d1e5231d86422ffff4eb1217080158c4bc81 configure.ac | 8 ++++++-- rts/Libdw.c | 2 +- rts/Libdw.h | 2 +- rts/LibdwPool.c | 2 +- rts/LibdwPool.h | 2 +- rts/posix/Signals.c | 2 +- 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index 4adf9c5..d621f41 100644 --- a/configure.ac +++ b/configure.ac @@ -1092,13 +1092,17 @@ AC_DEFINE_UNQUOTED([RTS_LINKER_USE_MMAP], [$RtsLinkerUseMmap], dnl ** Have libdw? dnl -------------------------------------------------------------- +USE_LIBDW=0 AC_ARG_ENABLE(libdw, - [AC_HELP_STRING([--enable-dwarf-unwind], + [AC_HELP_STRING([--enable-libdw], [Enable DWARF unwinding support in the runtime system via elfutils' libdw [default=no]])], [AC_CHECK_LIB(dw, dwfl_attach_state, [HaveLibdw=YES], [HaveLibdw=NO])], [HaveLibdw=NO] ) -AC_SUBST(HaveLibdw) +if test "$HaveLibdw" = "YES" ; then + USE_LIBDW=1 +fi +AC_DEFINE_UNQUOTED([USE_LIBDW], [$USE_LIBDW],[Have libdw]) if test -n "$SPHINXBUILD"; then BUILD_MAN=YES diff --git a/rts/Libdw.c b/rts/Libdw.c index e796840..a16ea59 100644 --- a/rts/Libdw.c +++ b/rts/Libdw.c @@ -10,7 +10,7 @@ #include "RtsUtils.h" #include "Libdw.h" -#ifdef USE_LIBDW +#if USE_LIBDW #include #include diff --git a/rts/Libdw.h b/rts/Libdw.h index e5fa054..bb3e71b 100644 --- a/rts/Libdw.h +++ b/rts/Libdw.h @@ -16,7 +16,7 @@ #include "BeginPrivate.h" -#ifdef USE_LIBDW +#if USE_LIBDW /* Begin a libdw session. A session is tied to a particular capability */ LibdwSession *libdwInit(void); diff --git a/rts/LibdwPool.c b/rts/LibdwPool.c index 2363212..8d065c3 100644 --- a/rts/LibdwPool.c +++ b/rts/LibdwPool.c @@ -10,7 +10,7 @@ #include "RtsUtils.h" #include "LibdwPool.h" -#ifdef USE_LIBDW +#if USE_LIBDW #include diff --git a/rts/LibdwPool.h b/rts/LibdwPool.h index a6b670e..3c4216d 100644 --- a/rts/LibdwPool.h +++ b/rts/LibdwPool.h @@ -14,7 +14,7 @@ #include "Rts.h" #include "Libdw.h" -#ifdef USE_LIBDW +#if USE_LIBDW /* Initialize the pool */ void libdwPoolInit(void); diff --git a/rts/posix/Signals.c b/rts/posix/Signals.c index 496ec7b..d73143b 100644 --- a/rts/posix/Signals.c +++ b/rts/posix/Signals.c @@ -536,7 +536,7 @@ shutdown_handler(int sig STG_UNUSED) static void backtrace_handler(int sig STG_UNUSED) { -#ifdef USE_LIBDW +#if USE_LIBDW LibdwSession *session = libdwInit(); Backtrace *bt = libdwGetBacktrace(session); libdwPrintBacktrace(session, stderr, bt); From git at git.haskell.org Sat May 28 11:03:50 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 28 May 2016 11:03:50 +0000 (UTC) Subject: [commit: ghc] wip/erikd/rts: rts: Add `-Wundef` to CFLAGS and fix warnings (7642825) Message-ID: <20160528110350.915FD3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/rts Link : http://ghc.haskell.org/trac/ghc/changeset/764282565af415d830e220938777c96b9e561c45/ghc >--------------------------------------------------------------- commit 764282565af415d830e220938777c96b9e561c45 Author: Erik de Castro Lopo Date: Wed May 18 20:04:26 2016 +1000 rts: Add `-Wundef` to CFLAGS and fix warnings >--------------------------------------------------------------- 764282565af415d830e220938777c96b9e561c45 includes/Stg.h | 8 ++--- includes/rts/OSThreads.h | 4 +-- includes/rts/storage/InfoTables.h | 2 +- includes/stg/MachRegs.h | 2 +- includes/stg/SMP.h | 63 +++++++++++++++++++++------------------ rts/Adjustor.c | 3 ++ rts/Interpreter.c | 3 ++ rts/Linker.c | 12 ++++---- rts/LinkerInternals.h | 3 +- rts/OldARMAtomic.c | 2 +- rts/PrimOps.cmm | 4 +-- rts/RtsMessages.c | 4 +-- rts/RtsUtils.c | 4 +-- rts/Schedule.c | 16 +++++----- rts/Threads.c | 2 +- rts/ghc.mk | 4 ++- rts/posix/GetTime.c | 2 +- rts/posix/OSMem.c | 8 ++--- rts/posix/OSThreads.c | 2 +- rts/sm/GCUtils.c | 2 +- rts/sm/GCUtils.h | 2 +- rts/sm/MBlock.c | 2 +- rts/sm/Storage.c | 3 ++ 23 files changed, 87 insertions(+), 70 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 764282565af415d830e220938777c96b9e561c45 From git at git.haskell.org Sat May 28 11:03:53 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 28 May 2016 11:03:53 +0000 (UTC) Subject: [commit: ghc] wip/erikd/rts's head updated: rts: Add `-Wundef` to CFLAGS and fix warnings (7642825) Message-ID: <20160528110353.5E1193A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/erikd/rts' now includes: 3910306 Add -XStaticPointers to the flag reference. 08e47ca FunDep printer: Fix unicode arrow 43589f5 testsuite: add CmmSwitchTest for 32-bit platforms ae7e9cb Fix Windows build after Ticky changes 8e92974 Testsuite: mark T8761 expect_broken #12077 a1f3bb8 Fix failing T12010 d9cb7a8 compiler/iface: compress .hi files e44a6f9 users-guide: Vector version of Thomson-Wheeler logo 6d6d6e4 rules/sphinx: Add missing dependency on conf.py for pdf rule cf1efc7 users-guide: Fix index in PDF output da3c1eb Enable checkProddableBlock on x86_64 527ed72 Fix deriving Ord when RebindableSyntax is enabled c81e7b2 Build system: temp solution for parallelisation bug (#11960) f669764 Use `setSession` instead of `modifySession` when setting `HscEnv` a70a6da rts/Linker.c: Fix compile error on Arm fa58710 Update format specifiers for Tickey.c 2230c88 Testsuite: fix T12010 for real 8c9b8a3 Allow unlifted types in pattern synonym result type d835ee6 Fix build by removing unused import. 785b38f testsuite: Update max_bytes_used for T4029 9bb2772 Revert "compiler/iface: compress .hi files" 4f5b335 Suppress the warning about __sync_fetch_and_nand (#9678) 03d8960 Don't split the arg types in a PatSyn signature eb8eb02 Spelling in comment 839b424 Remove unused Type.splitFunTysN 9c3e55b Comments only 35053eb Testsuite: delete check_files_written 1bf5c12 Spelling 8f7d016 Add support for unicode TH quotes (#11743) 4c6e69d Document some benign nondeterminism 9d06ef1 Make Arrow desugaring deterministic 95dfdce Remove 'deriving Typeable' statements fe8a4e5 Runtime linker: Break m32 allocator out into its own file 1956cbf Fix: #12084 deprecate old profiling flags 31f1804 Testsuite: delete drvfail015.stderr-7.0 [skip ci] 1319363 Always use native-Haskell de/encoders for ASCII and latin1 ac38c02 Update submodule vector [skip ci] 961ed26 Fix broken links to mdo papers eec88ee RTS: simplify read_heap_profiling_flag bdc5558 Testsuite: introduce TEST_HC_OPTS_INTERACTIVE (#11468) 8408d84 Spelling in comments 6a5bce1 Testsuite: also normalise platform-dependent .stdout/stderr f07bf19 Testsuite: fix enum01/02/03 on Windows (#9399) 5020bc8 Testsuite: add a test for #5522 (-fliberate-case -fspec-constr) 0f1e315 Fix bytecode gen to deal with rep-polymorphism e9e61f1 Reduce special-casing for nullary unboxed tuple 5b8bec2 StgCmmExpr: Fix a duplication 5b145c9 Coverage.hs: Fix a duplication cd50d23 StgCmmCon: Do not generate moves from unused fields to local variables b43a793 More fixes for unboxed tuples 72fd407 Comments and white space only 59250dc StgCmmExpr: Remove a redundant list 3a00ff9 Do not init record accessors as exported 3f20da1 Typos in comments d0dd572 Clarify users' guide section on GeneralizedNewtypeDeriving d40682e Testsuite: don't use --interactive in Makefiles da861e6 RtsFlags.c: Const correct fixes 54b2d1e Fix detection and use of `USE_LIBDW` 7642825 rts: Add `-Wundef` to CFLAGS and fix warnings From git at git.haskell.org Sat May 28 12:15:56 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 28 May 2016 12:15:56 +0000 (UTC) Subject: [commit: ghc] wip/erikd/rts: Fix detection and use of `USE_LIBDW` (ce16015) Message-ID: <20160528121556.D97DB3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/rts Link : http://ghc.haskell.org/trac/ghc/changeset/ce160153e336dab364be8254d3a075f83392fb97/ghc >--------------------------------------------------------------- commit ce160153e336dab364be8254d3a075f83392fb97 Author: Erik de Castro Lopo Date: Sat May 28 19:49:42 2016 +1000 Fix detection and use of `USE_LIBDW` >--------------------------------------------------------------- ce160153e336dab364be8254d3a075f83392fb97 configure.ac | 7 ++++++- rts/Libdw.c | 2 +- rts/Libdw.h | 2 +- rts/LibdwPool.c | 2 +- rts/LibdwPool.h | 2 +- rts/posix/Signals.c | 2 +- 6 files changed, 11 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index 4adf9c5..4d286e3 100644 --- a/configure.ac +++ b/configure.ac @@ -1092,13 +1092,18 @@ AC_DEFINE_UNQUOTED([RTS_LINKER_USE_MMAP], [$RtsLinkerUseMmap], dnl ** Have libdw? dnl -------------------------------------------------------------- +USE_LIBDW=0 AC_ARG_ENABLE(libdw, - [AC_HELP_STRING([--enable-dwarf-unwind], + [AC_HELP_STRING([--enable-libdw], [Enable DWARF unwinding support in the runtime system via elfutils' libdw [default=no]])], [AC_CHECK_LIB(dw, dwfl_attach_state, [HaveLibdw=YES], [HaveLibdw=NO])], [HaveLibdw=NO] ) +if test "$HaveLibdw" = "YES" ; then + USE_LIBDW=1 +fi AC_SUBST(HaveLibdw) +AC_DEFINE_UNQUOTED([USE_LIBDW], [$USE_LIBDW],[Have libdw]) if test -n "$SPHINXBUILD"; then BUILD_MAN=YES diff --git a/rts/Libdw.c b/rts/Libdw.c index e796840..a16ea59 100644 --- a/rts/Libdw.c +++ b/rts/Libdw.c @@ -10,7 +10,7 @@ #include "RtsUtils.h" #include "Libdw.h" -#ifdef USE_LIBDW +#if USE_LIBDW #include #include diff --git a/rts/Libdw.h b/rts/Libdw.h index e5fa054..bb3e71b 100644 --- a/rts/Libdw.h +++ b/rts/Libdw.h @@ -16,7 +16,7 @@ #include "BeginPrivate.h" -#ifdef USE_LIBDW +#if USE_LIBDW /* Begin a libdw session. A session is tied to a particular capability */ LibdwSession *libdwInit(void); diff --git a/rts/LibdwPool.c b/rts/LibdwPool.c index 2363212..8d065c3 100644 --- a/rts/LibdwPool.c +++ b/rts/LibdwPool.c @@ -10,7 +10,7 @@ #include "RtsUtils.h" #include "LibdwPool.h" -#ifdef USE_LIBDW +#if USE_LIBDW #include diff --git a/rts/LibdwPool.h b/rts/LibdwPool.h index a6b670e..3c4216d 100644 --- a/rts/LibdwPool.h +++ b/rts/LibdwPool.h @@ -14,7 +14,7 @@ #include "Rts.h" #include "Libdw.h" -#ifdef USE_LIBDW +#if USE_LIBDW /* Initialize the pool */ void libdwPoolInit(void); diff --git a/rts/posix/Signals.c b/rts/posix/Signals.c index 496ec7b..d73143b 100644 --- a/rts/posix/Signals.c +++ b/rts/posix/Signals.c @@ -536,7 +536,7 @@ shutdown_handler(int sig STG_UNUSED) static void backtrace_handler(int sig STG_UNUSED) { -#ifdef USE_LIBDW +#if USE_LIBDW LibdwSession *session = libdwInit(); Backtrace *bt = libdwGetBacktrace(session); libdwPrintBacktrace(session, stderr, bt); From git at git.haskell.org Sat May 28 12:15:59 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 28 May 2016 12:15:59 +0000 (UTC) Subject: [commit: ghc] wip/erikd/rts: rts: Add `-Wundef` to CFLAGS and fix warnings (8c23f05) Message-ID: <20160528121559.9584F3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/rts Link : http://ghc.haskell.org/trac/ghc/changeset/8c23f05f9681c3802dd2cb6c916ca0f1ef5a73ef/ghc >--------------------------------------------------------------- commit 8c23f05f9681c3802dd2cb6c916ca0f1ef5a73ef Author: Erik de Castro Lopo Date: Wed May 18 20:04:26 2016 +1000 rts: Add `-Wundef` to CFLAGS and fix warnings >--------------------------------------------------------------- 8c23f05f9681c3802dd2cb6c916ca0f1ef5a73ef includes/Stg.h | 8 ++--- includes/rts/OSThreads.h | 4 +-- includes/rts/storage/InfoTables.h | 2 +- includes/stg/MachRegs.h | 2 +- includes/stg/SMP.h | 63 +++++++++++++++++++++------------------ rts/Adjustor.c | 3 ++ rts/Interpreter.c | 3 ++ rts/Linker.c | 12 ++++---- rts/LinkerInternals.h | 3 +- rts/OldARMAtomic.c | 2 +- rts/PrimOps.cmm | 4 +-- rts/RtsMessages.c | 4 +-- rts/RtsUtils.c | 4 +-- rts/Schedule.c | 16 +++++----- rts/Threads.c | 2 +- rts/ghc.mk | 4 ++- rts/posix/GetTime.c | 2 +- rts/posix/OSMem.c | 8 ++--- rts/posix/OSThreads.c | 2 +- rts/sm/GCUtils.c | 2 +- rts/sm/GCUtils.h | 2 +- rts/sm/MBlock.c | 2 +- rts/sm/Storage.c | 3 ++ 23 files changed, 87 insertions(+), 70 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 8c23f05f9681c3802dd2cb6c916ca0f1ef5a73ef From git at git.haskell.org Sat May 28 21:23:37 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sat, 28 May 2016 21:23:37 +0000 (UTC) Subject: [commit: ghc] master: RtsFlags.c: Const correct fixes (1e67010) Message-ID: <20160528212337.907C53A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/1e6701011425edb3553abc17c094a2a9faee4fd5/ghc >--------------------------------------------------------------- commit 1e6701011425edb3553abc17c094a2a9faee4fd5 Author: Erik de Castro Lopo Date: Sun May 29 07:26:39 2016 +1000 RtsFlags.c: Const correct fixes Test Plan: validate Reviewers: hvr, austin, simonmar, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2275 >--------------------------------------------------------------- 1e6701011425edb3553abc17c094a2a9faee4fd5 rts/RtsFlags.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c index 31a2c8b..1ec5db0 100644 --- a/rts/RtsFlags.c +++ b/rts/RtsFlags.c @@ -1609,8 +1609,8 @@ static rtsBool read_heap_profiling_flag(const char *arg) case 'b': if (arg[2] != '\0' && arg[3] != '\0') { { - char *left = strchr(arg, '{'); - char *right = strrchr(arg, '}'); + const char *left = strchr(arg, '{'); + const char *right = strrchr(arg, '}'); // curly braces are optional, for // backwards compat. From git at git.haskell.org Sun May 29 08:01:16 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 29 May 2016 08:01:16 +0000 (UTC) Subject: [commit: ghc] wip/erikd/rts: Fix detection and use of `USE_LIBDW` (fd0d0fc) Message-ID: <20160529080116.DE3563A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/rts Link : http://ghc.haskell.org/trac/ghc/changeset/fd0d0fc14d5329dab4bcff515941ba3499c4326c/ghc >--------------------------------------------------------------- commit fd0d0fc14d5329dab4bcff515941ba3499c4326c Author: Erik de Castro Lopo Date: Sat May 28 21:19:49 2016 +1000 Fix detection and use of `USE_LIBDW` Test Plan: Configure/build with and without --enable-libdw Reviewers: bgamari, hvr, trofi, austin, simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2276 >--------------------------------------------------------------- fd0d0fc14d5329dab4bcff515941ba3499c4326c configure.ac | 18 +++++++++++++----- distrib/configure.ac.in | 4 ++-- mk/config.mk.in | 2 +- rts/Libdw.c | 2 +- rts/Libdw.h | 2 +- rts/LibdwPool.c | 2 +- rts/LibdwPool.h | 2 +- rts/ghc.mk | 8 -------- rts/package.conf.in | 2 +- rts/posix/Signals.c | 2 +- 10 files changed, 22 insertions(+), 22 deletions(-) diff --git a/configure.ac b/configure.ac index 4adf9c5..e0bc755 100644 --- a/configure.ac +++ b/configure.ac @@ -1092,14 +1092,22 @@ AC_DEFINE_UNQUOTED([RTS_LINKER_USE_MMAP], [$RtsLinkerUseMmap], dnl ** Have libdw? dnl -------------------------------------------------------------- +UseLibdw=NO +USE_LIBDW=0 AC_ARG_ENABLE(libdw, - [AC_HELP_STRING([--enable-dwarf-unwind], - [Enable DWARF unwinding support in the runtime system via elfutils' libdw [default=no]])], - [AC_CHECK_LIB(dw, dwfl_attach_state, [HaveLibdw=YES], [HaveLibdw=NO])], - [HaveLibdw=NO] + [AC_HELP_STRING([--enable-libdw], + [Enable DWARF debugging support in the runtime system [default=no]])], + [AC_CHECK_LIB(dw, dwfl_attach_state, [UseLibdw=YES], [UseLibdw=NO])], + [UseLibdw=NO] ) -AC_SUBST(HaveLibdw) +AC_SUBST(UseLibdw) +if test $UseLibdw = "YES" ; then + USE_LIBDW=1 +fi +AC_DEFINE_UNQUOTED([USE_LIBDW], [$USE_LIBDW], [Set to 1 to use libdw]) +dnl ** Documentation +dnl -------------------------------------------------------------- if test -n "$SPHINXBUILD"; then BUILD_MAN=YES BUILD_SPHINX_HTML=YES diff --git a/distrib/configure.ac.in b/distrib/configure.ac.in index fdd9fd9..33023a7 100644 --- a/distrib/configure.ac.in +++ b/distrib/configure.ac.in @@ -93,9 +93,9 @@ dnl ** Have libdw? dnl -------------------------------------------------------------- dnl Check for a usable version of libdw/elfutils dnl Currently we need 0.158 or newer. -BinDistNeedsLibdw=@HaveLibdw@ +BinDistNeedsLibdw=@UseLibdw@ if test "x$BinDistNeedsLibdw" = "xyes" ; then - AC_CHECK_LIB(dw, dwfl_attach_state, [HaveLibdw=YES], + AC_CHECK_LIB(dw, dwfl_attach_state, [UseLibdw=YES], [AC_MSG_ERROR([Binary distribution was built with libdw support but target system doesn't have supported libdw version (needs at least 0.158)])] )]; fi diff --git a/mk/config.mk.in b/mk/config.mk.in index 5dbde02..47198b9 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -381,7 +381,7 @@ FFIIncludeDir=@FFIIncludeDir@ # GHC needs arch-specific tweak at least in # rts/Libdw.c:set_initial_registers() -GhcRtsWithLibdw=$(strip $(if $(filter $(TargetArch_CPP),i386 x86_64), at HaveLibdw@,NO)) +GhcRtsWithLibdw=$(strip $(if $(filter $(TargetArch_CPP),i386 x86_64), at UseLibdw@,NO)) ################################################################################ # diff --git a/rts/Libdw.c b/rts/Libdw.c index e796840..a16ea59 100644 --- a/rts/Libdw.c +++ b/rts/Libdw.c @@ -10,7 +10,7 @@ #include "RtsUtils.h" #include "Libdw.h" -#ifdef USE_LIBDW +#if USE_LIBDW #include #include diff --git a/rts/Libdw.h b/rts/Libdw.h index e5fa054..bb3e71b 100644 --- a/rts/Libdw.h +++ b/rts/Libdw.h @@ -16,7 +16,7 @@ #include "BeginPrivate.h" -#ifdef USE_LIBDW +#if USE_LIBDW /* Begin a libdw session. A session is tied to a particular capability */ LibdwSession *libdwInit(void); diff --git a/rts/LibdwPool.c b/rts/LibdwPool.c index 2363212..8d065c3 100644 --- a/rts/LibdwPool.c +++ b/rts/LibdwPool.c @@ -10,7 +10,7 @@ #include "RtsUtils.h" #include "LibdwPool.h" -#ifdef USE_LIBDW +#if USE_LIBDW #include diff --git a/rts/LibdwPool.h b/rts/LibdwPool.h index a6b670e..3c4216d 100644 --- a/rts/LibdwPool.h +++ b/rts/LibdwPool.h @@ -14,7 +14,7 @@ #include "Rts.h" #include "Libdw.h" -#ifdef USE_LIBDW +#if USE_LIBDW /* Initialize the pool */ void libdwPoolInit(void); diff --git a/rts/ghc.mk b/rts/ghc.mk index 6fdc2cc..2dd1b85 100644 --- a/rts/ghc.mk +++ b/rts/ghc.mk @@ -480,14 +480,6 @@ rts_PACKAGE_CPP_OPTS += '-DFFI_LIB="C$(LIBFFI_NAME)"' endif -#----------------------------------------------------------------------------- -# Add support for reading DWARF debugging information, if available - -ifeq "$(GhcRtsWithLibdw)" "YES" -rts_CC_OPTS += -DUSE_LIBDW -rts_PACKAGE_CPP_OPTS += -DUSE_LIBDW -endif - # ----------------------------------------------------------------------------- # dependencies diff --git a/rts/package.conf.in b/rts/package.conf.in index 5c6d240..b52a867 100644 --- a/rts/package.conf.in +++ b/rts/package.conf.in @@ -61,7 +61,7 @@ unresolved symbols. */ ,"mingwex" # endif #endif -#ifdef USE_LIBDW +#if USE_LIBDW , "elf" , "dw" /* for backtraces */ #endif diff --git a/rts/posix/Signals.c b/rts/posix/Signals.c index 496ec7b..d73143b 100644 --- a/rts/posix/Signals.c +++ b/rts/posix/Signals.c @@ -536,7 +536,7 @@ shutdown_handler(int sig STG_UNUSED) static void backtrace_handler(int sig STG_UNUSED) { -#ifdef USE_LIBDW +#if USE_LIBDW LibdwSession *session = libdwInit(); Backtrace *bt = libdwGetBacktrace(session); libdwPrintBacktrace(session, stderr, bt); From git at git.haskell.org Sun May 29 08:01:19 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 29 May 2016 08:01:19 +0000 (UTC) Subject: [commit: ghc] wip/erikd/rts: rts: Add `-Wundef` to CFLAGS and fix warnings (e57c199) Message-ID: <20160529080119.AA6963A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/rts Link : http://ghc.haskell.org/trac/ghc/changeset/e57c199d079a4f7695b3379e855a95c3152c3ed0/ghc >--------------------------------------------------------------- commit e57c199d079a4f7695b3379e855a95c3152c3ed0 Author: Erik de Castro Lopo Date: Wed May 18 20:04:26 2016 +1000 rts: Add `-Wundef` to CFLAGS and fix warnings >--------------------------------------------------------------- e57c199d079a4f7695b3379e855a95c3152c3ed0 includes/Stg.h | 8 ++--- includes/rts/OSThreads.h | 4 +-- includes/rts/storage/InfoTables.h | 2 +- includes/stg/MachRegs.h | 2 +- includes/stg/SMP.h | 63 +++++++++++++++++++++------------------ rts/Adjustor.c | 3 ++ rts/Interpreter.c | 3 ++ rts/Linker.c | 12 ++++---- rts/LinkerInternals.h | 3 +- rts/OldARMAtomic.c | 2 +- rts/PrimOps.cmm | 4 +-- rts/RtsMessages.c | 4 +-- rts/RtsUtils.c | 4 +-- rts/Schedule.c | 16 +++++----- rts/Threads.c | 2 +- rts/ghc.mk | 3 ++ rts/posix/GetTime.c | 2 +- rts/posix/OSMem.c | 8 ++--- rts/posix/OSThreads.c | 2 +- rts/sm/GCUtils.c | 2 +- rts/sm/GCUtils.h | 2 +- rts/sm/MBlock.c | 2 +- rts/sm/Storage.c | 3 ++ 23 files changed, 87 insertions(+), 69 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc e57c199d079a4f7695b3379e855a95c3152c3ed0 From git at git.haskell.org Sun May 29 08:01:22 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 29 May 2016 08:01:22 +0000 (UTC) Subject: [commit: ghc] wip/erikd/rts's head updated: rts: Add `-Wundef` to CFLAGS and fix warnings (e57c199) Message-ID: <20160529080122.33FDE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/erikd/rts' now includes: 1e67010 RtsFlags.c: Const correct fixes fd0d0fc Fix detection and use of `USE_LIBDW` e57c199 rts: Add `-Wundef` to CFLAGS and fix warnings From git at git.haskell.org Sun May 29 09:24:49 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Sun, 29 May 2016 09:24:49 +0000 (UTC) Subject: [commit: ghc] wip/erikd/rts: rts: Add `-Wundef` to CFLAGS and fix warnings (a514184) Message-ID: <20160529092449.6BCB93A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/rts Link : http://ghc.haskell.org/trac/ghc/changeset/a5141844420bd2f75b509c7b220121c4a76d5043/ghc >--------------------------------------------------------------- commit a5141844420bd2f75b509c7b220121c4a76d5043 Author: Erik de Castro Lopo Date: Wed May 18 20:04:26 2016 +1000 rts: Add `-Wundef` to CFLAGS and fix warnings >--------------------------------------------------------------- a5141844420bd2f75b509c7b220121c4a76d5043 includes/Stg.h | 8 ++--- includes/rts/OSThreads.h | 4 +-- includes/rts/storage/InfoTables.h | 2 +- includes/stg/MachRegs.h | 2 +- includes/stg/SMP.h | 63 +++++++++++++++++++++------------------ rts/Adjustor.c | 3 ++ rts/Interpreter.c | 3 ++ rts/Linker.c | 12 ++++---- 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/posix/GetTime.c | 2 +- rts/posix/OSMem.c | 8 ++--- rts/posix/OSThreads.c | 2 +- rts/sm/GCUtils.c | 2 +- rts/sm/GCUtils.h | 2 +- rts/sm/MBlock.c | 2 +- rts/sm/Storage.c | 3 ++ 22 files changed, 85 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 a5141844420bd2f75b509c7b220121c4a76d5043 From git at git.haskell.org Mon May 30 03:19:46 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 30 May 2016 03:19:46 +0000 (UTC) Subject: [commit: ghc] wip/rae: Very confusing typo in error message. (917004a) Message-ID: <20160530031946.49C563A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rae Link : http://ghc.haskell.org/trac/ghc/changeset/917004ad6632df5b2f3d8385fcb11e927ba27688/ghc >--------------------------------------------------------------- commit 917004ad6632df5b2f3d8385fcb11e927ba27688 Author: Richard Eisenberg Date: Fri Apr 22 15:29:10 2016 -0400 Very confusing typo in error message. >--------------------------------------------------------------- 917004ad6632df5b2f3d8385fcb11e927ba27688 compiler/typecheck/TcInteract.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/typecheck/TcInteract.hs b/compiler/typecheck/TcInteract.hs index 8cd6066..8ea55cc 100644 --- a/compiler/typecheck/TcInteract.hs +++ b/compiler/typecheck/TcInteract.hs @@ -165,7 +165,7 @@ solveSimpleWanteds simples | n `intGtLimit` limit = failTcS (hang (text "solveSimpleWanteds: too many iterations" <+> parens (text "limit =" <+> ppr limit)) - 2 (vcat [ text "Set limit with -fsolver-iterations=n; n=0 for no limit" + 2 (vcat [ text "Set limit with -fconstraint-solver-iterations=n; n=0 for no limit" , text "Simples =" <+> ppr simples , text "WC =" <+> ppr wc ])) From git at git.haskell.org Mon May 30 03:19:50 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 30 May 2016 03:19:50 +0000 (UTC) Subject: [commit: ghc] wip/rae: Fix #11974 by adding a more smarts to TcDefaults. (95ebfcf) Message-ID: <20160530031950.140703A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rae Link : http://ghc.haskell.org/trac/ghc/changeset/95ebfcf4c9d85dd5251e5289223c18dc93e32555/ghc >--------------------------------------------------------------- commit 95ebfcf4c9d85dd5251e5289223c18dc93e32555 Author: Richard Eisenberg Date: Fri Apr 22 22:28:35 2016 -0400 Fix #11974 by adding a more smarts to TcDefaults. Test cases: typecheck/should_compile/T11974 typecheck/should_fail/T11974b >--------------------------------------------------------------- 95ebfcf4c9d85dd5251e5289223c18dc93e32555 compiler/prelude/PrelNames.hs | 12 +++++++ compiler/typecheck/TcDefaults.hs | 37 ++++++++++++---------- compiler/typecheck/TcSimplify.hs | 2 +- testsuite/tests/typecheck/should_compile/T11974.hs | 5 +++ testsuite/tests/typecheck/should_compile/all.T | 1 + testsuite/tests/typecheck/should_fail/T11974b.hs | 7 ++++ .../tests/typecheck/should_fail/T11974b.stderr | 15 +++++++++ testsuite/tests/typecheck/should_fail/all.T | 1 + 8 files changed, 62 insertions(+), 18 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 95ebfcf4c9d85dd5251e5289223c18dc93e32555 From git at git.haskell.org Mon May 30 03:19:53 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 30 May 2016 03:19:53 +0000 (UTC) Subject: [commit: ghc] wip/rae: Fix #10963 and #11975 by adding new cmds to GHCi. (a79cd45) Message-ID: <20160530031953.C396B3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rae Link : http://ghc.haskell.org/trac/ghc/changeset/a79cd45fed716bda050ff95267051b59bf5bc91a/ghc >--------------------------------------------------------------- commit a79cd45fed716bda050ff95267051b59bf5bc91a Author: Richard Eisenberg Date: Fri Apr 22 22:39:17 2016 -0400 Fix #10963 and #11975 by adding new cmds to GHCi. See the user's guide entry or the Note [TcRnExprMode] in TcRnDriver. Test cases: ghci/scripts/T{10963,11975} >--------------------------------------------------------------- a79cd45fed716bda050ff95267051b59bf5bc91a compiler/main/GHC.hs | 2 +- compiler/main/HscMain.hs | 8 +-- compiler/main/InteractiveEval.hs | 8 +-- compiler/typecheck/TcBinds.hs | 9 +-- compiler/typecheck/TcExpr.hs | 4 +- compiler/typecheck/TcPatSyn.hs | 3 +- compiler/typecheck/TcRnDriver.hs | 101 ++++++++++++++++++++++------- compiler/typecheck/TcSimplify.hs | 90 +++++++++++++++++-------- docs/users_guide/ghci.rst | 66 +++++++++++++++++-- ghc/GHCi/UI.hs | 12 +++- ghc/GHCi/UI/Info.hs | 2 +- testsuite/tests/ghc-api/T8639_api.hs | 2 +- testsuite/tests/ghci/scripts/T10963.script | 7 ++ testsuite/tests/ghci/scripts/T10963.stderr | 12 ++++ testsuite/tests/ghci/scripts/T10963.stdout | 4 ++ testsuite/tests/ghci/scripts/T11975.script | 9 +++ testsuite/tests/ghci/scripts/T11975.stdout | 15 +++++ testsuite/tests/ghci/scripts/all.T | 2 + 18 files changed, 279 insertions(+), 77 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc a79cd45fed716bda050ff95267051b59bf5bc91a From git at git.haskell.org Mon May 30 03:19:56 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 30 May 2016 03:19:56 +0000 (UTC) Subject: [commit: ghc] wip/rae: Simplify decideQuantification. (47f2f20) Message-ID: <20160530031956.701C23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/rae Link : http://ghc.haskell.org/trac/ghc/changeset/47f2f20924562a7cd4bd4ad5ae09f0bc6bbae221/ghc >--------------------------------------------------------------- commit 47f2f20924562a7cd4bd4ad5ae09f0bc6bbae221 Author: Richard Eisenberg Date: Sun May 29 23:17:45 2016 -0400 Simplify decideQuantification. As per Simon's suggestion, the two main branches of decideQuantification have become quite similar. This merges the two. (Related to #10963 and #11975.) >--------------------------------------------------------------- 47f2f20924562a7cd4bd4ad5ae09f0bc6bbae221 compiler/typecheck/TcSimplify.hs | 85 ++++++++++++++++++---------------------- 1 file changed, 38 insertions(+), 47 deletions(-) diff --git a/compiler/typecheck/TcSimplify.hs b/compiler/typecheck/TcSimplify.hs index 553defd..db1aeab 100644 --- a/compiler/typecheck/TcSimplify.hs +++ b/compiler/typecheck/TcSimplify.hs @@ -772,54 +772,28 @@ decideQuantification , [PredType] ) -- and this context (fully zonked) -- See Note [Deciding quantification] decideQuantification infer_mode name_taus psig_theta constraints - | ApplyMR <- infer_mode -- Apply the Monomorphism restriction - = do { gbl_tvs <- tcGetGlobalTyCoVars - ; zonked_taus <- mapM TcM.zonkTcType (psig_theta ++ taus) - -- psig_theta: see Note [Quantification and partial signatures] - ; let zonked_dvs = splitDepVarsOfTypes zonked_taus - zonked_tkvs = tcDepVarSet zonked_dvs - constrained_tvs = tyCoVarsOfTypes constraints `unionVarSet` - filterVarSet isCoVar zonked_tkvs - mono_tvs = gbl_tvs `unionVarSet` constrained_tvs - - ; qtvs <- quantifyZonkedTyVars mono_tvs zonked_dvs - - -- Warn about the monomorphism restriction - ; warn_mono <- woptM Opt_WarnMonomorphism - ; let mr_bites = constrained_tvs `intersectsVarSet` zonked_tkvs - ; warnTc (Reason Opt_WarnMonomorphism) (warn_mono && mr_bites) $ - hang (text "The Monomorphism Restriction applies to the binding" - <> plural bndrs <+> text "for" <+> pp_bndrs) - 2 (text "Consider giving a type signature for" - <+> if isSingleton bndrs then pp_bndrs - else text "these binders") - - -- All done - ; traceTc "decideQuantification 1" (vcat [ppr constraints, ppr gbl_tvs, ppr mono_tvs - , ppr qtvs, ppr mr_bites]) - ; return (qtvs, []) } - - | otherwise = do { gbl_tvs <- tcGetGlobalTyCoVars ; zonked_taus <- mapM TcM.zonkTcType (psig_theta ++ taus) -- psig_theta: see Note [Quantification and partial signatures] ; ovl_strings <- xoptM LangExt.OverloadedStrings - ; let interactive_constraints = filter is_interactive_ct constraints - is_interactive_ct ct + ; let is_interactive_ct ct | Just (cls, _) <- getClassPredTys_maybe ct = isInteractiveClass ovl_strings cls | otherwise = False - defaultable = case infer_mode of - EagerDefaulting -> interactive_constraints - _ -> [] - default_tvs = tyCoVarsOfTypes defaultable + (mono_constraints, maybe_quant_constraints) + = case infer_mode of + ApplyMR -> (constraints, []) + EagerDefaulting -> partition is_interactive_ct constraints + NoRestrictions -> ([], constraints) + + constrained_tvs = tyCoVarsOfTypes mono_constraints + mono_tvs = growThetaTyVars equality_constraints $ + gbl_tvs `unionVarSet` constrained_tvs - DV { dv_kvs = zkvs, dv_tvs = ztvs} = splitDepVarsOfTypes zonked_taus - mono_tvs = growThetaTyVars equality_constraints $ - gbl_tvs `unionVarSet` default_tvs - tau_tvs_plus = growThetaTyVarsDSet constraints ztvs + DV {dv_kvs = zkvs, dv_tvs = ztvs} = splitDepVarsOfTypes zonked_taus + tau_tvs_plus = growThetaTyVarsDSet maybe_quant_constraints ztvs dvs_plus = DV { dv_kvs = zkvs, dv_tvs = tau_tvs_plus } ; qtvs <- quantifyZonkedTyVars mono_tvs dvs_plus -- We don't grow the kvs, as there's no real need to. Recall @@ -827,23 +801,40 @@ decideQuantification infer_mode name_taus psig_theta constraints -- only for defaulting, and we don't want (ever) to default a tv -- to *. So, don't grow the kvs. - ; constraints <- TcM.zonkTcTypes constraints + -- Warn about the monomorphism restriction + ; warn_mono <- woptM Opt_WarnMonomorphism + ; let mr_bites | ApplyMR <- infer_mode + = constrained_tvs `intersectsVarSet` tcDepVarSet dvs_plus + | otherwise + = False + ; warnTc (Reason Opt_WarnMonomorphism) (warn_mono && mr_bites) $ + hang (text "The Monomorphism Restriction applies to the binding" + <> plural bndrs <+> text "for" <+> pp_bndrs) + 2 (text "Consider giving a type signature for" + <+> if isSingleton bndrs then pp_bndrs + else text "these binders") + + ; maybe_quant_constraints <- TcM.zonkTcTypes maybe_quant_constraints -- quantifyTyVars turned some meta tyvars into -- quantified skolems, so we have to zonk again ; let qtv_set = mkVarSet qtvs - theta = pickQuantifiablePreds qtv_set constraints + theta = pickQuantifiablePreds qtv_set maybe_quant_constraints min_theta = mkMinimalBySCs theta -- See Note [Minimize by Superclasses] ; traceTc "decideQuantification 2" - (vcat [ text "infer_mode:" <+> ppr infer_mode - , text "constraints:" <+> ppr constraints - , text "gbl_tvs:" <+> ppr gbl_tvs - , text "mono_tvs:" <+> ppr mono_tvs - , text "tau_tvs_plus:" <+> ppr tau_tvs_plus - , text "qtvs:" <+> ppr qtvs - , text "min_theta:" <+> ppr min_theta ]) + (vcat [ text "infer_mode:" <+> ppr infer_mode + , text "constraints:" <+> ppr constraints + , text "mono_contraints:" <+> ppr mono_constraints + , text "maybe_quant_constraints:" <+> ppr maybe_quant_constraints + , text "gbl_tvs:" <+> ppr gbl_tvs + , text "mono_tvs:" <+> ppr mono_tvs + , text "zkvs:" <+> ppr zkvs + , text "tau_tvs_plus:" <+> ppr tau_tvs_plus + , text "mr_bites:" <+> ppr mr_bites + , text "qtvs:" <+> ppr qtvs + , text "min_theta:" <+> ppr min_theta ]) ; return (qtvs, min_theta) } where pp_bndrs = pprWithCommas (quotes . ppr) bndrs From git at git.haskell.org Mon May 30 03:19:58 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 30 May 2016 03:19:58 +0000 (UTC) Subject: [commit: ghc] wip/rae's head updated: Simplify decideQuantification. (47f2f20) Message-ID: <20160530031958.A62033A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc Branch 'wip/rae' now includes: 961ed26 Fix broken links to mdo papers eec88ee RTS: simplify read_heap_profiling_flag bdc5558 Testsuite: introduce TEST_HC_OPTS_INTERACTIVE (#11468) 8408d84 Spelling in comments 6a5bce1 Testsuite: also normalise platform-dependent .stdout/stderr f07bf19 Testsuite: fix enum01/02/03 on Windows (#9399) 5020bc8 Testsuite: add a test for #5522 (-fliberate-case -fspec-constr) 0f1e315 Fix bytecode gen to deal with rep-polymorphism e9e61f1 Reduce special-casing for nullary unboxed tuple 5b8bec2 StgCmmExpr: Fix a duplication 5b145c9 Coverage.hs: Fix a duplication cd50d23 StgCmmCon: Do not generate moves from unused fields to local variables b43a793 More fixes for unboxed tuples 72fd407 Comments and white space only 59250dc StgCmmExpr: Remove a redundant list 3a00ff9 Do not init record accessors as exported 3f20da1 Typos in comments d0dd572 Clarify users' guide section on GeneralizedNewtypeDeriving d40682e Testsuite: don't use --interactive in Makefiles 1e67010 RtsFlags.c: Const correct fixes 917004a Very confusing typo in error message. 95ebfcf Fix #11974 by adding a more smarts to TcDefaults. a79cd45 Fix #10963 and #11975 by adding new cmds to GHCi. 47f2f20 Simplify decideQuantification. From git at git.haskell.org Mon May 30 14:37:02 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Mon, 30 May 2016 14:37:02 +0000 (UTC) Subject: [commit: ghc] master: StgCmmUtils.emitMultiAssign: Make assertion msg more helpful (7e4f3dc) Message-ID: <20160530143702.67EF23A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/7e4f3dc26fa984a00e48955b56295a7cf78682c4/ghc >--------------------------------------------------------------- commit 7e4f3dc26fa984a00e48955b56295a7cf78682c4 Author: ?mer Sinan A?acan Date: Mon May 30 10:39:59 2016 -0400 StgCmmUtils.emitMultiAssign: Make assertion msg more helpful >--------------------------------------------------------------- 7e4f3dc26fa984a00e48955b56295a7cf78682c4 compiler/codeGen/StgCmmUtils.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/codeGen/StgCmmUtils.hs b/compiler/codeGen/StgCmmUtils.hs index a98ce73..86c03ac 100644 --- a/compiler/codeGen/StgCmmUtils.hs +++ b/compiler/codeGen/StgCmmUtils.hs @@ -396,7 +396,7 @@ emitMultiAssign [] [] = return () emitMultiAssign [reg] [rhs] = emitAssign (CmmLocal reg) rhs emitMultiAssign regs rhss = do dflags <- getDynFlags - ASSERT( equalLength regs rhss ) + ASSERT2( equalLength regs rhss, ppr regs $$ ppr rhss ) unscramble dflags ([1..] `zip` (regs `zip` rhss)) unscramble :: DynFlags -> [Vrtx] -> FCode () From git at git.haskell.org Tue May 31 08:05:18 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 31 May 2016 08:05:18 +0000 (UTC) Subject: [commit: ghc] master: Remove unused FAST_STRING_NOT_NEEDED macro defs (0ffa23d) Message-ID: <20160531080518.AC2AC3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0ffa23d5b912f6e3a90cdda5ead66168fe518cbc/ghc >--------------------------------------------------------------- commit 0ffa23d5b912f6e3a90cdda5ead66168fe518cbc Author: ?mer Sinan A?acan Date: Tue May 31 04:08:35 2016 -0400 Remove unused FAST_STRING_NOT_NEEDED macro defs Reviewers: austin, bgamari, simonmar, hvr Reviewed By: hvr Subscribers: hvr, thomie Differential Revision: https://phabricator.haskell.org/D2285 >--------------------------------------------------------------- 0ffa23d5b912f6e3a90cdda5ead66168fe518cbc compiler/codeGen/StgCmm.hs | 1 - compiler/codeGen/StgCmmClosure.hs | 1 - compiler/codeGen/StgCmmExpr.hs | 1 - 3 files changed, 3 deletions(-) diff --git a/compiler/codeGen/StgCmm.hs b/compiler/codeGen/StgCmm.hs index 9d14db9..73b9bf6 100644 --- a/compiler/codeGen/StgCmm.hs +++ b/compiler/codeGen/StgCmm.hs @@ -10,7 +10,6 @@ module StgCmm ( codeGen ) where -#define FAST_STRING_NOT_NEEDED #include "HsVersions.h" import StgCmmProf (initCostCentres, ldvEnter) diff --git a/compiler/codeGen/StgCmmClosure.hs b/compiler/codeGen/StgCmmClosure.hs index d76eedd..ca6b404 100644 --- a/compiler/codeGen/StgCmmClosure.hs +++ b/compiler/codeGen/StgCmmClosure.hs @@ -61,7 +61,6 @@ module StgCmmClosure ( #include "../includes/MachDeps.h" -#define FAST_STRING_NOT_NEEDED #include "HsVersions.h" import StgSyn diff --git a/compiler/codeGen/StgCmmExpr.hs b/compiler/codeGen/StgCmmExpr.hs index a697ff6..3de91c1 100644 --- a/compiler/codeGen/StgCmmExpr.hs +++ b/compiler/codeGen/StgCmmExpr.hs @@ -11,7 +11,6 @@ module StgCmmExpr ( cgExpr ) where -#define FAST_STRING_NOT_NEEDED #include "HsVersions.h" import {-# SOURCE #-} StgCmmBind ( cgBind ) From git at git.haskell.org Tue May 31 11:50:55 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 31 May 2016 11:50:55 +0000 (UTC) Subject: [commit: ghc] master: Update a Cmm note (930e74f) Message-ID: <20160531115055.1C8483A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/930e74f8f494962745c16a59f156a0ed9f2f1df1/ghc >--------------------------------------------------------------- commit 930e74f8f494962745c16a59f156a0ed9f2f1df1 Author: ?mer Sinan A?acan Date: Tue May 31 07:54:17 2016 -0400 Update a Cmm note >--------------------------------------------------------------- 930e74f8f494962745c16a59f156a0ed9f2f1df1 compiler/cmm/cmm-notes | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/cmm/cmm-notes b/compiler/cmm/cmm-notes index 2b7e0a4..136ac38 100644 --- a/compiler/cmm/cmm-notes +++ b/compiler/cmm/cmm-notes @@ -6,6 +6,7 @@ More notes (Aug 11) * Why is FCode a lazy monad? That makes it inefficient. We want laziness to get code out one procedure at a time, but not at the instruction level. + UPDATE (31/5/2016): FCode is strict since 09afcc9b. Things we did * Remove CmmCvt.graphToZgraph (Conversion from old to new Cmm reps) From git at git.haskell.org Tue May 31 12:17:31 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 31 May 2016 12:17:31 +0000 (UTC) Subject: [commit: ghc] wip/erikd/rts: rts: Add `-Wundef` to CFLAGS and fix warnings (fb523b8) Message-ID: <20160531121731.483183A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/rts Link : http://ghc.haskell.org/trac/ghc/changeset/fb523b8449d891ed7e35bb999c64fd5b2f73772c/ghc >--------------------------------------------------------------- commit fb523b8449d891ed7e35bb999c64fd5b2f73772c Author: Erik de Castro Lopo Date: Wed May 18 20:04:26 2016 +1000 rts: Add `-Wundef` to CFLAGS and fix warnings >--------------------------------------------------------------- fb523b8449d891ed7e35bb999c64fd5b2f73772c includes/Stg.h | 8 ++--- includes/rts/OSThreads.h | 4 +-- includes/rts/storage/InfoTables.h | 2 +- includes/stg/MachRegs.h | 2 +- includes/stg/SMP.h | 63 +++++++++++++++++++++------------------ rts/Adjustor.c | 3 ++ rts/Interpreter.c | 3 ++ rts/Linker.c | 12 ++++---- rts/LinkerInternals.h | 7 +++-- 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/posix/GetTime.c | 2 +- rts/posix/OSMem.c | 8 ++--- rts/posix/OSThreads.c | 2 +- rts/sm/GCUtils.c | 2 +- rts/sm/GCUtils.h | 2 +- rts/sm/MBlock.c | 2 +- rts/sm/Storage.c | 3 ++ 22 files changed, 87 insertions(+), 69 deletions(-) Diff suppressed because of size. To see it, use: git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc fb523b8449d891ed7e35bb999c64fd5b2f73772c From git at git.haskell.org Tue May 31 12:25:16 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 31 May 2016 12:25:16 +0000 (UTC) Subject: [commit: ghc] wip/erikd/rts: rts: Add `-Wundef` to CFLAGS and fix warnings (bd12a49) Message-ID: <20160531122516.925BE3A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : wip/erikd/rts Link : http://ghc.haskell.org/trac/ghc/changeset/bd12a4971350610f3f542fe12565922975c7cef9/ghc >--------------------------------------------------------------- commit bd12a4971350610f3f542fe12565922975c7cef9 Author: Erik de Castro Lopo Date: Wed May 18 20:04:26 2016 +1000 rts: Add `-Wundef` to CFLAGS and fix warnings >--------------------------------------------------------------- bd12a4971350610f3f542fe12565922975c7cef9 includes/Stg.h | 8 ++--- includes/rts/OSThreads.h | 4 +-- includes/rts/storage/InfoTables.h | 2 +- includes/stg/MachRegs.h | 2 +- includes/stg/SMP.h | 69 +++++++++++++++++++++------------------ rts/Adjustor.c | 3 ++ rts/Interpreter.c | 3 ++ rts/Linker.c | 12 +++---- rts/LinkerInternals.h | 7 ++-- 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/posix/GetTime.c | 2 +- rts/posix/OSMem.c | 8 ++--- rts/posix/OSThreads.c | 2 +- rts/sm/GCUtils.c | 2 +- rts/sm/GCUtils.h | 2 +- rts/sm/MBlock.c | 2 +- rts/sm/Storage.c | 3 ++ 22 files changed, 91 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 bd12a4971350610f3f542fe12565922975c7cef9 From git at git.haskell.org Tue May 31 20:11:54 2016 From: git at git.haskell.org (git at git.haskell.org) Date: Tue, 31 May 2016 20:11:54 +0000 (UTC) Subject: [commit: ghc] master: Fix detection and use of `USE_LIBDW` (0676e68) Message-ID: <20160531201154.052E63A300@ghc.haskell.org> Repository : ssh://git at git.haskell.org/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/0676e68cf5fe8696f1f760fef0f35dba14db1104/ghc >--------------------------------------------------------------- commit 0676e68cf5fe8696f1f760fef0f35dba14db1104 Author: Erik de Castro Lopo Date: Wed Jun 1 06:14:00 2016 +1000 Fix detection and use of `USE_LIBDW` Test Plan: Configure/build with and without --enable-libdw Reviewers: trofi, hvr, austin, simonmar, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2276 >--------------------------------------------------------------- 0676e68cf5fe8696f1f760fef0f35dba14db1104 configure.ac | 16 ++++++++++++---- distrib/configure.ac.in | 4 ++-- mk/config.mk.in | 2 +- rts/Libdw.c | 2 +- rts/Libdw.h | 2 +- rts/LibdwPool.c | 2 +- rts/LibdwPool.h | 2 +- rts/ghc.mk | 8 -------- rts/package.conf.in | 2 +- rts/posix/Signals.c | 2 +- 10 files changed, 21 insertions(+), 21 deletions(-) diff --git a/configure.ac b/configure.ac index 4adf9c5..15561d0 100644 --- a/configure.ac +++ b/configure.ac @@ -1092,14 +1092,22 @@ AC_DEFINE_UNQUOTED([RTS_LINKER_USE_MMAP], [$RtsLinkerUseMmap], dnl ** Have libdw? dnl -------------------------------------------------------------- -AC_ARG_ENABLE(libdw, +UseLibdw=NO +USE_LIBDW=0 +AC_ARG_ENABLE(dwarf-unwind, [AC_HELP_STRING([--enable-dwarf-unwind], [Enable DWARF unwinding support in the runtime system via elfutils' libdw [default=no]])], - [AC_CHECK_LIB(dw, dwfl_attach_state, [HaveLibdw=YES], [HaveLibdw=NO])], - [HaveLibdw=NO] + [AC_CHECK_LIB(dw, dwfl_attach_state, [UseLibdw=YES], [UseLibdw=NO])], + [UseLibdw=NO] ) -AC_SUBST(HaveLibdw) +AC_SUBST(UseLibdw) +if test $UseLibdw = "YES" ; then + USE_LIBDW=1 +fi +AC_DEFINE_UNQUOTED([USE_LIBDW], [$USE_LIBDW], [Set to 1 to use libdw]) +dnl ** Documentation +dnl -------------------------------------------------------------- if test -n "$SPHINXBUILD"; then BUILD_MAN=YES BUILD_SPHINX_HTML=YES diff --git a/distrib/configure.ac.in b/distrib/configure.ac.in index fdd9fd9..33023a7 100644 --- a/distrib/configure.ac.in +++ b/distrib/configure.ac.in @@ -93,9 +93,9 @@ dnl ** Have libdw? dnl -------------------------------------------------------------- dnl Check for a usable version of libdw/elfutils dnl Currently we need 0.158 or newer. -BinDistNeedsLibdw=@HaveLibdw@ +BinDistNeedsLibdw=@UseLibdw@ if test "x$BinDistNeedsLibdw" = "xyes" ; then - AC_CHECK_LIB(dw, dwfl_attach_state, [HaveLibdw=YES], + AC_CHECK_LIB(dw, dwfl_attach_state, [UseLibdw=YES], [AC_MSG_ERROR([Binary distribution was built with libdw support but target system doesn't have supported libdw version (needs at least 0.158)])] )]; fi diff --git a/mk/config.mk.in b/mk/config.mk.in index 5dbde02..47198b9 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -381,7 +381,7 @@ FFIIncludeDir=@FFIIncludeDir@ # GHC needs arch-specific tweak at least in # rts/Libdw.c:set_initial_registers() -GhcRtsWithLibdw=$(strip $(if $(filter $(TargetArch_CPP),i386 x86_64), at HaveLibdw@,NO)) +GhcRtsWithLibdw=$(strip $(if $(filter $(TargetArch_CPP),i386 x86_64), at UseLibdw@,NO)) ################################################################################ # diff --git a/rts/Libdw.c b/rts/Libdw.c index e796840..a16ea59 100644 --- a/rts/Libdw.c +++ b/rts/Libdw.c @@ -10,7 +10,7 @@ #include "RtsUtils.h" #include "Libdw.h" -#ifdef USE_LIBDW +#if USE_LIBDW #include #include diff --git a/rts/Libdw.h b/rts/Libdw.h index e5fa054..bb3e71b 100644 --- a/rts/Libdw.h +++ b/rts/Libdw.h @@ -16,7 +16,7 @@ #include "BeginPrivate.h" -#ifdef USE_LIBDW +#if USE_LIBDW /* Begin a libdw session. A session is tied to a particular capability */ LibdwSession *libdwInit(void); diff --git a/rts/LibdwPool.c b/rts/LibdwPool.c index 2363212..8d065c3 100644 --- a/rts/LibdwPool.c +++ b/rts/LibdwPool.c @@ -10,7 +10,7 @@ #include "RtsUtils.h" #include "LibdwPool.h" -#ifdef USE_LIBDW +#if USE_LIBDW #include diff --git a/rts/LibdwPool.h b/rts/LibdwPool.h index a6b670e..3c4216d 100644 --- a/rts/LibdwPool.h +++ b/rts/LibdwPool.h @@ -14,7 +14,7 @@ #include "Rts.h" #include "Libdw.h" -#ifdef USE_LIBDW +#if USE_LIBDW /* Initialize the pool */ void libdwPoolInit(void); diff --git a/rts/ghc.mk b/rts/ghc.mk index 6fdc2cc..49eaab5 100644 --- a/rts/ghc.mk +++ b/rts/ghc.mk @@ -480,14 +480,6 @@ rts_PACKAGE_CPP_OPTS += '-DFFI_LIB="C$(LIBFFI_NAME)"' endif -#----------------------------------------------------------------------------- -# Add support for reading DWARF debugging information, if available - -ifeq "$(GhcRtsWithLibdw)" "YES" -rts_CC_OPTS += -DUSE_LIBDW -rts_PACKAGE_CPP_OPTS += -DUSE_LIBDW -endif - # ----------------------------------------------------------------------------- # dependencies diff --git a/rts/package.conf.in b/rts/package.conf.in index 5c6d240..b52a867 100644 --- a/rts/package.conf.in +++ b/rts/package.conf.in @@ -61,7 +61,7 @@ unresolved symbols. */ ,"mingwex" # endif #endif -#ifdef USE_LIBDW +#if USE_LIBDW , "elf" , "dw" /* for backtraces */ #endif diff --git a/rts/posix/Signals.c b/rts/posix/Signals.c index 496ec7b..d73143b 100644 --- a/rts/posix/Signals.c +++ b/rts/posix/Signals.c @@ -536,7 +536,7 @@ shutdown_handler(int sig STG_UNUSED) static void backtrace_handler(int sig STG_UNUSED) { -#ifdef USE_LIBDW +#if USE_LIBDW LibdwSession *session = libdwInit(); Backtrace *bt = libdwGetBacktrace(session); libdwPrintBacktrace(session, stderr, bt);