packages/base.git
7 years agoadd setNumCapabilities :: Int -> IO ()
Simon Marlow [Tue, 6 Dec 2011 15:09:20 +0000 (15:09 +0000)] 
add setNumCapabilities :: Int -> IO ()

{- |
Set the number of Haskell threads that can run truly simultaneously
(on separate physical processors) at any given time.

GHC notes: in the current implementation, the value may only be
/increased/, not decreased, by calling 'setNumCapabilities'.  The
initial value is given by the @+RTS -N@ flag, and the current value
may be obtained using 'getNumCapabilities'.
-}

7 years agorenderStack: reverse the stack trace (most recent frame first)
Simon Marlow [Mon, 5 Dec 2011 10:15:10 +0000 (10:15 +0000)] 
renderStack: reverse the stack trace (most recent frame first)

7 years agodoc update: mention -fprof-auto-calls
Simon Marlow [Mon, 5 Dec 2011 10:14:50 +0000 (10:14 +0000)] 
doc update: mention -fprof-auto-calls

7 years agoRoll back the sigset capi changes
Ian Lynagh [Sun, 4 Dec 2011 13:20:40 +0000 (13:20 +0000)] 
Roll back the sigset capi changes

They broken the build on OSX. See #2979.

7 years agoAdd source locations to call stack entries.
Simon Marlow [Fri, 2 Dec 2011 13:09:51 +0000 (13:09 +0000)] 
Add source locations to call stack entries.

7 years agoChange the layout of stack traces
Simon Marlow [Thu, 1 Dec 2011 11:10:55 +0000 (11:10 +0000)] 
Change the layout of stack traces

Stack trace:
  Main.CAF
  Main.main
  Main.main.xs
  Main.map
  Main.map.go
  Main.f

7 years agoAdd traceStack :: String -> a -> a
Simon Marlow [Wed, 30 Nov 2011 10:37:40 +0000 (10:37 +0000)] 
Add traceStack :: String -> a -> a

-- | like 'trace', but additionally prints a call stack if one is
-- available.
--
-- In the current GHC implementation, the call stack is only
-- availble if the program was compiled with @-prof@; otherwise
-- 'traceStack' behaves exactly like 'trace'.  Entries in the call
-- stack correspond to @SCC@ annotations, so it is a good idea to use
-- @-fprof-auto@ to add SCC annotations automatically.

7 years agoExpand the stack-tracing API
Simon Marlow [Wed, 30 Nov 2011 10:36:11 +0000 (10:36 +0000)] 
Expand the stack-tracing API

 - add whoCreated :: a -> IO [String]
   Get the stack trace attached to an object

 - rename getCCCS to getCurrentCCS

 - add getCCSOf (used to implement whoCreated)

 - add renderStack :: [String] -> String
   A handy function for prettifying a stack

7 years agoUse utf8 when decoding cost centre strings
Simon Marlow [Tue, 29 Nov 2011 15:34:44 +0000 (15:34 +0000)] 
Use utf8 when decoding cost centre strings

7 years agoUse capi to define the fcntl FFI imports
Ian Lynagh [Mon, 28 Nov 2011 18:58:59 +0000 (18:58 +0000)] 
Use capi to define the fcntl FFI imports

7 years agoUse capi some more (part of #5480)
Ian Lynagh [Mon, 28 Nov 2011 18:19:29 +0000 (18:19 +0000)] 
Use capi some more (part of #5480)

7 years agoAdd a way to get hold of the current call stack
Simon Marlow [Tue, 29 Nov 2011 14:10:59 +0000 (14:10 +0000)] 
Add a way to get hold of the current call stack

  GHC.Stack.currentCallStack :: IO [String]

At the moment this uses the profiler's cost-centre stack; maybe in the
future it might use some other mechanism.  Right now it only gives
useful results when profiling and using -fprof-auto or similar, but it
could be quite handy. e.g.

f :: Int -> IO Int
f x = do currentCallStack >>= print; return (x+1)

mapM :: Monad m => (a -> m b) -> [a] -> m [b]
mapM f xs = go xs
  where go []     = return []
        go (x:xs) = do
          x' <- f x
          xs' <- mapM f xs
          return (x':xs')

main = mapM f [42,42]

$ ./stack
["MAIN.MAIN","Main.main","Main.mapM","Main.mapM.go","Main.f"]
["MAIN.MAIN","Main.main","Main.mapM","Main.mapM.go","Main.f"]

7 years agoConvert come FFI bindings to use the capi calling convention
Ian Lynagh [Sat, 26 Nov 2011 16:16:27 +0000 (16:16 +0000)] 
Convert come FFI bindings to use the capi calling convention

7 years agoMake a wrapper for getrusage; part of #5480
Ian Lynagh [Fri, 25 Nov 2011 23:18:57 +0000 (23:18 +0000)] 
Make a wrapper for getrusage; part of #5480

7 years agoSimplify some CPP
Ian Lynagh [Fri, 25 Nov 2011 22:36:50 +0000 (22:36 +0000)] 
Simplify some CPP

7 years agoRemove some unused functions from include/HsBase.h
Ian Lynagh [Fri, 25 Nov 2011 18:00:20 +0000 (18:00 +0000)] 
Remove some unused functions from include/HsBase.h

7 years agoAdd a C wrapper for gettimeofday
Ian Lynagh [Fri, 25 Nov 2011 17:31:45 +0000 (17:31 +0000)] 
Add a C wrapper for gettimeofday

Based on part of a patch from Arnaud Degroote in #5480.
On NetBSD just calling the function directly warns:
    warning: reference to compatibility gettimeofday(); include <sys/time.h>
    to generate correct reference

7 years agoEta contract 'PArr' synonym
Manuel M T Chakravarty [Fri, 25 Nov 2011 12:00:18 +0000 (23:00 +1100)] 
Eta contract 'PArr' synonym

7 years agoRules for powers with small exponents (fixes #5237)
Daniel Fischer [Fri, 25 Nov 2011 02:46:46 +0000 (03:46 +0100)] 
Rules for powers with small exponents (fixes #5237)

Calculating small powers by direct multiplication is more efficient
than using (^). For small exponents known at compile time, there are
now rewrite rules.

7 years agoFix compilation error on windows.
David Terei [Tue, 22 Nov 2011 18:58:28 +0000 (10:58 -0800)] 
Fix compilation error on windows.

7 years agoUpdate system001 output
Ian Lynagh [Sun, 20 Nov 2011 00:11:22 +0000 (00:11 +0000)] 
Update system001 output

7 years agoMove ioref001 to base/tests
Ian Lynagh [Sat, 19 Nov 2011 23:53:35 +0000 (23:53 +0000)] 
Move ioref001 to base/tests

7 years agoWhitespace and modernise some tests
Ian Lynagh [Sat, 19 Nov 2011 23:46:51 +0000 (23:46 +0000)] 
Whitespace and modernise some tests

7 years agoMove lib/System tests to base/tests
Ian Lynagh [Sat, 19 Nov 2011 23:43:03 +0000 (23:43 +0000)] 
Move lib/System tests to base/tests

7 years agoMove ix001 to base/tests
Ian Lynagh [Sat, 19 Nov 2011 23:33:50 +0000 (23:33 +0000)] 
Move ix001 to base/tests

7 years agoWhitespace only in tests
Ian Lynagh [Sat, 19 Nov 2011 23:23:46 +0000 (23:23 +0000)] 
Whitespace only in tests

7 years agoMove Data.List tests to base/tests
Ian Lynagh [Sat, 19 Nov 2011 23:23:29 +0000 (23:23 +0000)] 
Move Data.List tests to base/tests

7 years agoWhitespce only in lexNum
Ian Lynagh [Sat, 19 Nov 2011 23:20:55 +0000 (23:20 +0000)] 
Whitespce only in lexNum

7 years agoMove lexNum to base/tests
Ian Lynagh [Sat, 19 Nov 2011 23:19:34 +0000 (23:19 +0000)] 
Move lexNum to base/tests

7 years agoWhitespace only in hash001 test
Ian Lynagh [Sat, 19 Nov 2011 23:14:21 +0000 (23:14 +0000)] 
Whitespace only in hash001 test

7 years agoMove hash001 to base/tests
Ian Lynagh [Sat, 19 Nov 2011 23:13:30 +0000 (23:13 +0000)] 
Move hash001 to base/tests

7 years agoWhitespace only in tests
Ian Lynagh [Sat, 19 Nov 2011 22:42:42 +0000 (22:42 +0000)] 
Whitespace only in tests

7 years agoMove testsuite/tests/lib/Numeric to base/tests
Ian Lynagh [Sat, 19 Nov 2011 22:37:56 +0000 (22:37 +0000)] 
Move testsuite/tests/lib/Numeric to base/tests

7 years agoMove testsuite/tests/lib/Show to base/tests
Ian Lynagh [Sat, 19 Nov 2011 22:26:41 +0000 (22:26 +0000)] 
Move testsuite/tests/lib/Show to base/tests

7 years agoMove testsuite/tests/lib/Data.Fixed test to base/tests
Ian Lynagh [Sat, 19 Nov 2011 22:17:33 +0000 (22:17 +0000)] 
Move testsuite/tests/lib/Data.Fixed test to base/tests

7 years agoMove lib/Char tests from testsuite to base
Ian Lynagh [Sat, 19 Nov 2011 22:07:24 +0000 (22:07 +0000)] 
Move lib/Char tests from testsuite to base

7 years agoRemove some comments about interfaces being checked against H98
Ian Lynagh [Sat, 19 Nov 2011 21:41:45 +0000 (21:41 +0000)] 
Remove some comments about interfaces being checked against H98

base doesn't follow Haskell 98

7 years agoMove CPUTime001 here from testsuite/tests/lib/CPUTime
Ian Lynagh [Sat, 19 Nov 2011 21:36:10 +0000 (21:36 +0000)] 
Move CPUTime001 here from testsuite/tests/lib/CPUTime

7 years agoGo back to using private-use characters in roundtripping
Max Bolingbroke [Fri, 18 Nov 2011 17:45:34 +0000 (17:45 +0000)] 
Go back to using private-use characters in roundtripping

7 years agoMake the fileSystemEncoding/localeEncoding/foreignEncoding mutable
Max Bolingbroke [Fri, 18 Nov 2011 17:40:55 +0000 (17:40 +0000)] 
Make the fileSystemEncoding/localeEncoding/foreignEncoding mutable

7 years agoAdd "dropWhileEnd", as discussed on the libraries list
Simon Marlow [Mon, 14 Nov 2011 12:40:03 +0000 (12:40 +0000)] 
Add "dropWhileEnd", as discussed on the libraries list

7 years agoAdd GHC.PArr.PArr to break a cycle in compiling Data.Array.Parallel
Manuel M T Chakravarty [Thu, 10 Nov 2011 08:09:49 +0000 (19:09 +1100)] 
Add GHC.PArr.PArr to break a cycle in compiling Data.Array.Parallel

7 years agofix typo
Simon Marlow [Wed, 9 Nov 2011 09:41:11 +0000 (09:41 +0000)] 
fix typo

7 years agoexport tyConName, tyConModule and tyConPackage; deprecate tyConString
Simon Marlow [Tue, 8 Nov 2011 14:47:13 +0000 (14:47 +0000)] 
export tyConName, tyConModule and tyConPackage; deprecate tyConString

7 years agoAdd unsafeShift to Data.Bits
Johan Tibell [Sun, 14 Aug 2011 10:45:27 +0000 (11:45 +0100)] 
Add unsafeShift to Data.Bits

This allows shifting by a non-statically known amount without
introducing a branch (to check for "overflow").

7 years agoexport flushAllHandles (#5594)
Simon Marlow [Mon, 7 Nov 2011 15:24:35 +0000 (15:24 +0000)] 
export flushAllHandles (#5594)

7 years agoadd unsafeFixIO (#5421)
Simon Marlow [Mon, 7 Nov 2011 09:19:09 +0000 (09:19 +0000)] 
add unsafeFixIO (#5421)

7 years agouse MVar to define fixIO, for thread-safety (see #5421)
Simon Marlow [Fri, 4 Nov 2011 15:27:39 +0000 (15:27 +0000)] 
use MVar to define fixIO, for thread-safety (see #5421)

7 years agoFix build on Windows
Max Bolingbroke [Wed, 2 Nov 2011 18:13:41 +0000 (18:13 +0000)] 
Fix build on Windows

7 years agoBe more forgiving about encoding name capitalization/hyphenization
Max Bolingbroke [Wed, 2 Nov 2011 13:46:24 +0000 (13:46 +0000)] 
Be more forgiving about encoding name capitalization/hyphenization

7 years agoAvoid using iconv for the locale TextEncoding if we can help it
Max Bolingbroke [Wed, 2 Nov 2011 13:44:17 +0000 (13:44 +0000)] 
Avoid using iconv for the locale TextEncoding if we can help it

7 years agoUpdate Debug.Trace haddock docs and rename putTraceMsg to traceIO
Duncan Coutts [Wed, 26 Oct 2011 12:37:18 +0000 (13:37 +0100)] 
Update Debug.Trace haddock docs and rename putTraceMsg to traceIO

putTraceMsg is deprecated in favour of traceIO. This makes the names
more consistent.

7 years agoAdd pure traceEvent and re-export from Debug.Trace
Duncan Coutts [Wed, 26 Oct 2011 12:33:48 +0000 (13:33 +0100)] 
Add pure traceEvent and re-export from Debug.Trace

Previously traceEvent was exported only from GHC.Exts and had an IO
type. The new scheme is:

  GHC.Exts.traceEventIO    :: String -> IO ()

  Debug.Trace.traceEventIO :: String -> IO ()
  Debug.Trace.traceEvent   :: String -> a -> a

The new traceEvent has a pure type like Debug.Trace.trace and can be
used in pure code. The previous GHC.Exts.traceEvent is deprecated.

7 years agoadd laws to class documentation
Ross Paterson [Wed, 26 Oct 2011 12:30:42 +0000 (13:30 +0100)] 
add laws to class documentation

7 years agoGHC.Stats: Use camelCase in public APIs
Johan Tibell [Wed, 26 Oct 2011 00:12:06 +0000 (17:12 -0700)] 
GHC.Stats: Use camelCase in public APIs

7 years agoUpdate base for latest Safe Haskell.
David Terei [Wed, 26 Oct 2011 03:43:23 +0000 (20:43 -0700)] 
Update base for latest Safe Haskell.

7 years agoUpdate base for new Safe Haskell design
David Terei [Tue, 25 Oct 2011 18:13:08 +0000 (11:13 -0700)] 
Update base for new Safe Haskell design

7 years agoWarn about ArrowLoop instance for Kleisli Arrows
Ross Paterson [Tue, 25 Oct 2011 15:47:46 +0000 (16:47 +0100)] 
Warn about ArrowLoop instance for Kleisli Arrows

Suggested by Heinrich Apfelmus on the libraries list.

7 years agoFix error in KQueue caused by changes to FFI import requirements
Max Bolingbroke [Fri, 21 Oct 2011 23:42:14 +0000 (00:42 +0100)] 
Fix error in KQueue caused by changes to FFI import requirements

7 years agoExport constructors for Foreign.C.Types and System.Posix.Types newtypes
Ian Lynagh [Thu, 20 Oct 2011 23:49:09 +0000 (00:49 +0100)] 
Export constructors for Foreign.C.Types and System.Posix.Types newtypes

Part of trac #5529. We also now import the constructors in various
modules that use them in FFI decls.

7 years agoIf an assertion fails, through it rather than a deeper error; fixes #5561
Ian Lynagh [Wed, 19 Oct 2011 21:23:19 +0000 (22:23 +0100)] 
If an assertion fails, through it rather than a deeper error; fixes #5561

An expression like
    assert False (throw e)
should throw the assertion failure rather than e

7 years agoupdate IO manager documentation (#5547)
Simon Marlow [Tue, 18 Oct 2011 09:48:48 +0000 (10:48 +0100)] 
update IO manager documentation (#5547)

7 years agoupdate ref to deprecated function forkIOUnmasked -> forkIOWithUnmask (#5546)
Simon Marlow [Tue, 18 Oct 2011 09:42:31 +0000 (10:42 +0100)] 
update ref to deprecated function forkIOUnmasked -> forkIOWithUnmask (#5546)

7 years agofix cross-ref to "Catching all exceptions" section (#5546)
Simon Marlow [Tue, 18 Oct 2011 09:42:04 +0000 (10:42 +0100)] 
fix cross-ref to "Catching all exceptions" section (#5546)

7 years agoFix build on Windows
Ian Lynagh [Fri, 14 Oct 2011 18:11:22 +0000 (19:11 +0100)] 
Fix build on Windows

7 years agoMerge branch 'master' of mac:ghc/git/val32/libraries/base
Ian Lynagh [Fri, 14 Oct 2011 02:12:08 +0000 (03:12 +0100)] 
Merge branch 'master' of mac:ghc/git/val32/libraries/base

7 years agotweak unpack/unpack_nl to generate better Core (#5536)
Simon Marlow [Thu, 13 Oct 2011 10:10:42 +0000 (11:10 +0100)] 
tweak unpack/unpack_nl to generate better Core (#5536)

7 years ago80-columnify
Simon Marlow [Wed, 12 Oct 2011 09:26:56 +0000 (10:26 +0100)] 
80-columnify

7 years agoDe-orphan the Show Integer instance
Ian Lynagh [Thu, 15 Sep 2011 21:14:17 +0000 (22:14 +0100)] 
De-orphan the Show Integer instance

7 years agoRemove the Eq superclass of Num
Ian Lynagh [Thu, 15 Sep 2011 21:03:19 +0000 (22:03 +0100)] 
Remove the Eq superclass of Num

7 years agoRemove the Show superclass of Num
Ian Lynagh [Thu, 15 Sep 2011 19:42:22 +0000 (20:42 +0100)] 
Remove the Show superclass of Num

7 years agoCombine two calls to 'ord' (seems to be just slightly faster)
Max Bolingbroke [Tue, 11 Oct 2011 12:43:26 +0000 (13:43 +0100)] 
Combine two calls to 'ord' (seems to be just slightly faster)

7 years agoImprove performance of the unpack loop
Max Bolingbroke [Tue, 11 Oct 2011 12:15:47 +0000 (13:15 +0100)] 
Improve performance of the unpack loop

7 years agoMinor: replace undefined uses with error as mentioned in ticket #5532
Ryan Newton [Thu, 6 Oct 2011 18:52:59 +0000 (14:52 -0400)] 
Minor: replace undefined uses with error as mentioned in ticket #5532

7 years agoRemove now unnecessary helper function
Daniel Fischer [Thu, 6 Oct 2011 09:16:39 +0000 (11:16 +0200)] 
Remove now unnecessary helper function

7 years agoMerge /home/dafis/GHC/bghc/libraries/base
Daniel Fischer [Tue, 4 Oct 2011 19:46:03 +0000 (21:46 +0200)] 
Merge /home/dafis/GHC/bghc/libraries/base

7 years agoFix typo in error message
Daniel Fischer [Tue, 4 Oct 2011 18:30:38 +0000 (20:30 +0200)] 
Fix typo in error message

7 years agoWhitespace only
Daniel Fischer [Tue, 4 Oct 2011 18:29:43 +0000 (20:29 +0200)] 
Whitespace only

7 years agoAlign arrows
Daniel Fischer [Tue, 4 Oct 2011 16:14:55 +0000 (18:14 +0200)] 
Align arrows

7 years agoEliminate unnecessary shift and reorder branches in fromRat''
Daniel Fischer [Tue, 4 Oct 2011 16:14:23 +0000 (18:14 +0200)] 
Eliminate unnecessary shift and reorder branches in fromRat''

7 years agoUse Rational constructor if numerator or denominator is 1
Daniel Fischer [Tue, 4 Oct 2011 15:17:31 +0000 (17:17 +0200)] 
Use Rational constructor if numerator or denominator is 1

7 years agoExplanatory comments
Daniel Fischer [Tue, 4 Oct 2011 15:15:11 +0000 (17:15 +0200)] 
Explanatory comments

7 years agoFix fromRat' and fromRat''
Daniel Fischer [Tue, 4 Oct 2011 14:31:36 +0000 (16:31 +0200)] 
Fix fromRat' and fromRat''

Due to a wrong order of tests, values near the normalised/denormalised
border were sent down the wrong branch. That led to rounding twice and
picking the wrong neighbour for some values.

fromRat' no longer uses scaleRat, if we're confident nobody uses that,
we could remove it.

7 years agoChange haddock for encodeFloat, fixes #5525
Daniel Fischer [Sun, 2 Oct 2011 14:38:15 +0000 (16:38 +0200)] 
Change haddock for encodeFloat, fixes #5525

7 years agoFixed mistake in documentation and a typo in a comment
Daniel Fischer [Sun, 2 Oct 2011 13:29:37 +0000 (15:29 +0200)] 
Fixed mistake in documentation and a typo in a comment

7 years agoFixed documentation bug
Daniel Fischer [Sun, 2 Oct 2011 12:42:41 +0000 (14:42 +0200)] 
Fixed documentation bug

7 years agoWhitespace only in GHC.Show
Daniel Fischer [Sun, 2 Oct 2011 12:38:50 +0000 (14:38 +0200)] 
Whitespace only in GHC.Show

7 years agoRemoved pointless rule (realToFrac :: Int -> Int)
Daniel Fischer [Sun, 2 Oct 2011 12:13:39 +0000 (14:13 +0200)] 
Removed pointless rule (realToFrac :: Int -> Int)

7 years agoDon't try to detect iconv or libcharset if we are on Windows
Ian Lynagh [Sun, 25 Sep 2011 15:20:35 +0000 (16:20 +0100)] 
Don't try to detect iconv or libcharset if we are on Windows

We don't use iconv or libcharset on Windows, but if configure finds
them then it can cause problems. So we don't even try looking if
we are on Windows.

See http://www.haskell.org/pipermail/cvs-ghc/2011-September/065980.html

Patch from Bill Tutt.

8 years agoFix #5436 by using 'recover' on handle EOF
Max Bolingbroke [Fri, 23 Sep 2011 14:24:36 +0000 (23:24 +0900)] 
Fix #5436 by using 'recover' on handle EOF

8 years agoBe more efficient reading fractional literals
Daniel Fischer [Mon, 19 Sep 2011 13:32:49 +0000 (15:32 +0200)] 
Be more efficient reading fractional literals

Avoid a few unnecessary gcds to speed up reading.

8 years agoWhitespace only in Text.Read.Lex
Daniel Fischer [Mon, 19 Sep 2011 10:41:38 +0000 (12:41 +0200)] 
Whitespace only in Text.Read.Lex

8 years agoUse the Ratio constructor for toRational from Int/Integer
Daniel Fischer [Mon, 19 Sep 2011 10:36:22 +0000 (12:36 +0200)] 
Use the Ratio constructor for toRational from Int/Integer

The denominator is always 1, so there's no need for gcd.

8 years agoGive Word a proper Show instance
Ian Lynagh [Fri, 16 Sep 2011 01:57:44 +0000 (02:57 +0100)] 
Give Word a proper Show instance

It was going via Integer before

8 years agoMove some Enum helpers into GHC.Enum
Ian Lynagh [Thu, 15 Sep 2011 18:18:04 +0000 (19:18 +0100)] 
Move some Enum helpers into GHC.Enum

They were in GHC.Word, but are also used in GHC.Int

8 years agoEliminate the orphaned Enum Integer instance
Ian Lynagh [Thu, 15 Sep 2011 17:46:17 +0000 (18:46 +0100)] 
Eliminate the orphaned Enum Integer instance

Also allows us to make GHC.Enum depend on GHC.Num rather than the
other way round.

8 years agoImport GMP-only functions from a GMP modules
Ian Lynagh [Tue, 13 Sep 2011 19:19:35 +0000 (20:19 +0100)] 
Import GMP-only functions from a GMP modules

8 years agoFix build on Windows
Ian Lynagh [Tue, 13 Sep 2011 15:58:24 +0000 (16:58 +0100)] 
Fix build on Windows

Now hsc2hs's template doesn't include HsFFI.h for us, we have
to do it ourselves.

8 years agoFIX BUILD on 32-bits
Daniel Fischer [Sat, 27 Aug 2011 15:38:17 +0000 (17:38 +0200)] 
FIX BUILD on 32-bits

popCount had the wrong type for Int64 on 32-bit systems.

8 years agoTrailing Whitespace
Daniel Fischer [Sat, 27 Aug 2011 15:37:19 +0000 (17:37 +0200)] 
Trailing Whitespace