ghc-base.git
14 years agofix the windows build even more 2009-06-25
Simon Marlow [Thu, 25 Jun 2009 15:25:27 +0000 (15:25 +0000)]
fix the windows build even more

14 years agonot having iconv is not fatal on Windows
Simon Marlow [Thu, 25 Jun 2009 11:58:04 +0000 (11:58 +0000)]
not having iconv is not fatal on Windows

14 years agofix build failure on Windows
Simon Marlow [Thu, 25 Jun 2009 09:46:09 +0000 (09:46 +0000)]
fix build failure on Windows

14 years agoFix iconv detection on OpenBSD
Ian Lynagh [Wed, 24 Jun 2009 12:54:22 +0000 (12:54 +0000)]
Fix iconv detection on OpenBSD
Matthias Kilian discovered that iconv_open is #define'd to something
else on OpenBSD, so the test needs to include the iconv header.

14 years agosetNonBlockingMode now takes a flag, can turn blocking mode back on again
Simon Marlow [Wed, 24 Jun 2009 11:50:29 +0000 (11:50 +0000)]
setNonBlockingMode now takes a flag, can turn blocking mode back on again

14 years agoCall nl_langinfo(CODESET) to get the name of the locale encoding on Unix
Simon Marlow [Tue, 23 Jun 2009 14:38:13 +0000 (14:38 +0000)]
Call nl_langinfo(CODESET) to get the name of the locale encoding on Unix

14 years agoadd hFlushAll, flushes both read and write buffers
Simon Marlow [Tue, 23 Jun 2009 13:38:18 +0000 (13:38 +0000)]
add hFlushAll, flushes both read and write buffers

14 years agofix bug in partial writes
Simon Marlow [Tue, 23 Jun 2009 10:50:04 +0000 (10:50 +0000)]
fix bug in partial writes

14 years agoTidy up use of read/write/recv/send; avoid unnecessary wrappers
Simon Marlow [Mon, 22 Jun 2009 09:26:56 +0000 (09:26 +0000)]
Tidy up use of read/write/recv/send; avoid unnecessary wrappers

14 years agoMake this file independent of HsBase.h, use HsBaseConfig.h only
Simon Marlow [Mon, 22 Jun 2009 08:39:57 +0000 (08:39 +0000)]
Make this file independent of HsBase.h, use HsBaseConfig.h only

14 years agoWindows: Unicode openFile and stat functions
Simon Marlow [Thu, 18 Jun 2009 13:54:58 +0000 (13:54 +0000)]
Windows: Unicode openFile and stat functions

14 years agoAdd a comment to remind us that memcpy_src_off is used by dph
Simon Marlow [Thu, 18 Jun 2009 11:26:16 +0000 (11:26 +0000)]
Add a comment to remind us that memcpy_src_off is used by dph

14 years agoUnconditionally make a (Show Ptr) instance
Ian Lynagh [Sat, 20 Jun 2009 20:48:09 +0000 (20:48 +0000)]
Unconditionally make a (Show Ptr) instance
It used to only exist if (WORD_SIZE_IN_BITS == 32 || WORD_SIZE_IN_BITS == 64)

14 years agoRemove AC_C_CONST
Ian Lynagh [Mon, 15 Jun 2009 20:32:40 +0000 (20:32 +0000)]
Remove AC_C_CONST
It was breaking the build on Windows. The problem was that we included
stdio.h which gave a prototype for some functions (e.g. remove), then
the AC_C_CONST meant that we did
    /* Define to empty if `const' does not conform to ANSI C. */
    #define const /**/
and then we included io.h which gave prototypes that, due to const
being removed, conflicted with the earlier prototypes.

14 years agoRemove old Integer prototypes
Ian Lynagh [Mon, 15 Jun 2009 20:24:44 +0000 (20:24 +0000)]
Remove old Integer prototypes

14 years agoRedefine gcdInt to use gcdInteger rather than gcdInt# primop
Duncan Coutts [Fri, 12 Jun 2009 14:29:51 +0000 (14:29 +0000)]
Redefine gcdInt to use gcdInteger rather than gcdInt# primop
The gcdInt# primop uses gmp internally, even though the interface is
just Int#. Since we want to get gmp out of the rts we cannot keep
gcdInt#, however it's also a bit odd for the integer package to export
something that doesn't actually use Integer in its interface. Using
gcdInteger is still not terribly satisfactory aesthetically. However
in the short-term it works and it is no slower since gcdInteger calls
gcdInt# for the special case of two small Integers.

14 years agoThe IO type has moved to GHC.Types in ghc-prim
Ian Lynagh [Sat, 20 Jun 2009 15:52:08 +0000 (15:52 +0000)]
The IO type has moved to GHC.Types in ghc-prim

14 years agoFix warnings in configure script
Ian Lynagh [Mon, 15 Jun 2009 21:48:50 +0000 (21:48 +0000)]
Fix warnings in configure script

14 years agoFix warnings in C programs generated by configure; fixes failures with -Werror
Ian Lynagh [Mon, 15 Jun 2009 20:16:34 +0000 (20:16 +0000)]
Fix warnings in C programs generated by configure; fixes failures with -Werror

14 years agoSave and restore the codec state when re-decoding
Simon Marlow [Sun, 14 Jun 2009 18:53:32 +0000 (18:53 +0000)]
Save and restore the codec state when re-decoding

We previously had an ugly hack to check for a BOM when re-decoding
some binary data in flushCharBuffer.  The hack was there essentially
because codecs like UTF-16 have a state, and we had not restored it.
This patch gives codecs an explicit state, and implemented
saving/restoring of the state as necessary.  Hence, the hack in
flushCharBuffer is replaced by a more general mechanism that works for
any codec with state.

Unfortunately, iconv doesn't give us a way to save and restore the
state, so this is currently only implemented for the built-in codecs.

14 years agoFix #3128: file descriptor leak when hClose fails
Simon Marlow [Tue, 16 Jun 2009 11:07:55 +0000 (11:07 +0000)]
Fix #3128: file descriptor leak when hClose fails

14 years agoAllow System.Posix.Internals to compile with nhc98 again.
Malcolm.Wallace@cs.york.ac.uk [Mon, 15 Jun 2009 15:52:49 +0000 (15:52 +0000)]
Allow System.Posix.Internals to compile with nhc98 again.
Also affects GHC.IO.Device, which is not very GHC-specific at all.

14 years agoAdd iconv as an extra library on platform that need to link with it
Ian Lynagh [Fri, 12 Jun 2009 23:13:07 +0000 (23:13 +0000)]
Add iconv as an extra library on platform that need to link with it
For example, we need -liconv on OS X.

14 years agoRewrite of the IO library, including Unicode support
Simon Marlow [Fri, 12 Jun 2009 13:56:31 +0000 (13:56 +0000)]
Rewrite of the IO library, including Unicode support

Highlights:

* Unicode support for Handle I/O:

  ** Automatic encoding and decoding using a per-Handle encoding.

  ** The encoding defaults to the locale encoding (only on Unix
     so far, perhaps Windows later).

  ** Built-in UTF-8, UTF-16 (BE/LE), and UTF-32 (BE/LE) codecs.

  ** iconv-based codec for other encodings on Unix

* Modularity: the low-level IO interface is exposed as a type class
  (GHC.IO.IODevice) so you can build your own low-level IO providers and
  make Handles from them.

* Newline translation: instead of being Windows-specific wired-in
  magic, the translation from \r\n -> \n and back again is available
  on all platforms and is configurable for reading/writing
  independently.

Unicode-aware Handles
~~~~~~~~~~~~~~~~~~~~~

This is a significant restructuring of the Handle implementation with
the primary goal of supporting Unicode character encodings.

The only change to the existing behaviour is that by default, text IO
is done in the prevailing locale encoding of the system (except on
Windows [1]).

Handles created by openBinaryFile use the Latin-1 encoding, as do
Handles placed in binary mode using hSetBinaryMode.

We provide a way to change the encoding for an existing Handle:

   GHC.IO.Handle.hSetEncoding :: Handle -> TextEncoding -> IO ()

and various encodings (from GHC.IO.Encoding):

   latin1,
   utf8,
   utf16, utf16le, utf16be,
   utf32, utf32le, utf32be,
   localeEncoding,

and a way to lookup other encodings:

   GHC.IO.Encoding.mkTextEncoding :: String -> IO TextEncoding

(it's system-dependent whether the requested encoding will be
available).

We may want to export these from somewhere more permanent; that's a
topic for a future library proposal.

Thanks to suggestions from Duncan Coutts, it's possible to call
hSetEncoding even on buffered read Handles, and the right thing
happens.  So we can read from text streams that include multiple
encodings, such as an HTTP response or email message, without having
to turn buffering off (though there is a penalty for switching
encodings on a buffered Handle, as the IO system has to do some
re-decoding to figure out where it should start reading from again).

If there is a decoding error, it is reported when an attempt is made
to read the offending character from the Handle, as you would expect.

Performance varies.  For "hGetContents >>= putStr" I found the new
library was faster on my x86_64 machine, but slower on an x86.  On the
whole I'd expect things to be a bit slower due to the extra
decoding/encoding, but probabaly not noticeably.  If performance is
critical for your app, then you should be using bytestring and text
anyway.

[1] Note: locale encoding is not currently implemented on Windows due
to the built-in Win32 APIs for encoding/decoding not being sufficient
for our purposes.  Ask me for details.  Offers of help gratefully
accepted.

Newline Translation
~~~~~~~~~~~~~~~~~~~

In the old IO library, text-mode Handles on Windows had automatic
translation from \r\n -> \n on input, and the opposite on output.  It
was implemented using the underlying CRT functions, which meant that
there were certain odd restrictions, such as read/write text handles
needing to be unbuffered, and seeking not working at all on text
Handles.

In the rewrite, newline translation is now implemented in the upper
layers, as it needs to be since we have to perform Unicode decoding
before newline translation.  This means that it is now available on
all platforms, which can be quite handy for writing portable code.

For now, I have left the behaviour as it was, namely \r\n -> \n on
Windows, and no translation on Unix.  However, another reasonable
default (similar to what Python does) would be to do \r\n -> \n on
input, and convert to the platform-native representation (either \r\n
or \n) on output.  This is called universalNewlineMode (below).

The API is as follows.  (available from GHC.IO.Handle for now, again
this is something we will probably want to try to get into System.IO
at some point):

-- | The representation of a newline in the external file or stream.
data Newline = LF    -- ^ "\n"
             | CRLF  -- ^ "\r\n"
             deriving Eq

-- | Specifies the translation, if any, of newline characters between
-- internal Strings and the external file or stream.  Haskell Strings
-- are assumed to represent newlines with the '\n' character; the
-- newline mode specifies how to translate '\n' on output, and what to
-- translate into '\n' on input.
data NewlineMode
  = NewlineMode { inputNL :: Newline,
                    -- ^ the representation of newlines on input
                  outputNL :: Newline
                    -- ^ the representation of newlines on output
                 }
             deriving Eq

-- | The native newline representation for the current platform
nativeNewline :: Newline

-- | Map "\r\n" into "\n" on input, and "\n" to the native newline
-- represetnation on output.  This mode can be used on any platform, and
-- works with text files using any newline convention.  The downside is
-- that @readFile a >>= writeFile b@ might yield a different file.
universalNewlineMode :: NewlineMode
universalNewlineMode  = NewlineMode { inputNL  = CRLF,
                                      outputNL = nativeNewline }

-- | Use the native newline representation on both input and output
nativeNewlineMode    :: NewlineMode
nativeNewlineMode     = NewlineMode { inputNL  = nativeNewline,
                                      outputNL = nativeNewline }

-- | Do no newline translation at all.
noNewlineTranslation :: NewlineMode
noNewlineTranslation  = NewlineMode { inputNL  = LF, outputNL = LF }

-- | Change the newline translation mode on the Handle.
hSetNewlineMode :: Handle -> NewlineMode -> IO ()

IO Devices
~~~~~~~~~~

The major change here is that the implementation of the Handle
operations is separated from the underlying IO device, using type
classes.  File descriptors are just one IO provider; I have also
implemented memory-mapped files (good for random-access read/write)
and a Handle that pipes output to a Chan (useful for testing code that
writes to a Handle).  New kinds of Handle can be implemented outside
the base package, for instance someone could write bytestringToHandle.
A Handle is made using mkFileHandle:

-- | makes a new 'Handle'
mkFileHandle :: (IODevice dev, BufferedIO dev, Typeable dev)
              => dev -- ^ the underlying IO device, which must support
                     -- 'IODevice', 'BufferedIO' and 'Typeable'
              -> FilePath
                     -- ^ a string describing the 'Handle', e.g. the file
                     -- path for a file.  Used in error messages.
              -> IOMode
                     -- ^ The mode in which the 'Handle' is to be used
              -> Maybe TextEncoding
                     -- ^ text encoding to use, if any
              -> NewlineMode
                     -- ^ newline translation mode
              -> IO Handle

This also means that someone can write a completely new IO
implementation on Windows based on native Win32 HANDLEs, and
distribute it as a separate package (I really hope somebody does
this!).

This restructuring isn't as radical as previous designs.  I haven't
made any attempt to make a separate binary I/O layer, for example
(although hGetBuf/hPutBuf do bypass the text encoding and newline
translation).  The main goal here was to get Unicode support in, and
to allow others to experiment with making new kinds of Handle.  We
could split up the layers further later.

API changes and Module structure
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

NB. GHC.IOBase and GHC.Handle are now DEPRECATED (they are still
present, but are just re-exporting things from other modules now).
For 6.12 we'll want to bump base to version 5 and add a base4-compat.
For now I'm using #if __GLASGOW_HASKEL__ >= 611 to avoid deprecated
warnings.

I split modules into smaller parts in many places.  For example, we
now have GHC.IORef, GHC.MVar and GHC.IOArray containing the
implementations of IORef, MVar and IOArray respectively.  This was
necessary for untangling dependencies, but it also makes things easier
to follow.

The new module structurue for the IO-relatied parts of the base
package is:

GHC.IO
   Implementation of the IO monad; unsafe*; throw/catch

GHC.IO.IOMode
   The IOMode type

GHC.IO.Buffer
   Buffers and operations on them

GHC.IO.Device
   The IODevice and RawIO classes.

GHC.IO.BufferedIO
   The BufferedIO class.

GHC.IO.FD
   The FD type, with instances of IODevice, RawIO and BufferedIO.

GHC.IO.Exception
   IO-related Exceptions

GHC.IO.Encoding
   The TextEncoding type; built-in TextEncodings; mkTextEncoding

GHC.IO.Encoding.Types
GHC.IO.Encoding.Iconv
GHC.IO.Encoding.Latin1
GHC.IO.Encoding.UTF8
GHC.IO.Encoding.UTF16
GHC.IO.Encoding.UTF32
   Implementation internals for GHC.IO.Encoding

GHC.IO.Handle
   The main API for GHC's Handle implementation, provides all the Handle
   operations + mkFileHandle + hSetEncoding.

GHC.IO.Handle.Types
GHC.IO.Handle.Internals
GHC.IO.Handle.Text
   Implementation of Handles and operations.

GHC.IO.Handle.FD
   Parts of the Handle API implemented by file-descriptors: openFile,
   stdin, stdout, stderr, fdToHandle etc.

14 years agoRemove unused foreign imports of __encodeFloat/Double
Duncan Coutts [Thu, 11 Jun 2009 16:01:00 +0000 (16:01 +0000)]
Remove unused foreign imports of __encodeFloat/Double

14 years agonhc98 must build dirUtils.c as well.
Malcolm.Wallace@cs.york.ac.uk [Fri, 5 Jun 2009 09:17:30 +0000 (09:17 +0000)]
nhc98 must build dirUtils.c as well.
Fixes this bootstrapping error:
  Undefined symbols:
  "___hscore_readdir", referenced from:
      _FR_System_46Posix_46Internals_46readdir_35 in libHSbase.a(Internals.o)

14 years agoRemove unnecessary parens
Ian Lynagh [Tue, 2 Jun 2009 18:36:08 +0000 (18:36 +0000)]
Remove unnecessary parens

14 years agoFix validate (on Windows)
Simon Marlow [Fri, 29 May 2009 13:02:14 +0000 (13:02 +0000)]
Fix validate (on Windows)

14 years agoMake two type defaults explicit
simonpj@microsoft.com [Fri, 29 May 2009 08:35:49 +0000 (08:35 +0000)]
Make two type defaults explicit

Now that -Werror rejects programs that use silent type-class defaulting,
we must commit in the source code.

I've used Double in CPUTime, which is the same as was picked automatically
before, but I expect Float would be ok.

   realToInteger :: Real a => a -> Integer
   realToInteger ct = round (realToFrac ct :: Double)

In GHC.Float I used Float (rather that than the auto-picked Double)
because I'm pretty certain it has enough precision.

-- f :: Integer, log :: Float -> Float,
        --               ceiling :: Float -> Int
        ceiling ((log (fromInteger (f+1) :: Float) +

14 years agoFix #3257: document that exitWith in a forkIO'd thread does not exit the process
Simon Marlow [Thu, 28 May 2009 12:37:38 +0000 (12:37 +0000)]
Fix #3257: document that exitWith in a forkIO'd thread does not exit the process

14 years agoIncrease the version number to that in the 6.10 branch
Ian Lynagh [Sun, 24 May 2009 15:56:10 +0000 (15:56 +0000)]
Increase the version number to that in the 6.10 branch

14 years agoFix warnings
Ian Lynagh [Sat, 23 May 2009 22:45:08 +0000 (22:45 +0000)]
Fix warnings

14 years agoDocument that the initial quantity for QSem and QSemN must be >= 0
Ian Lynagh [Sat, 23 May 2009 20:02:38 +0000 (20:02 +0000)]
Document that the initial quantity for QSem and QSemN must be >= 0

14 years agoadd _O_NOINHERIT when opening files on Windows (see #2650)
Simon Marlow [Wed, 20 May 2009 13:09:26 +0000 (13:09 +0000)]
add _O_NOINHERIT when opening files on Windows (see #2650)

14 years agoremove msvcrt and kernel32 from extra-libraries
Simon Marlow [Wed, 20 May 2009 11:16:26 +0000 (11:16 +0000)]
remove msvcrt and kernel32 from extra-libraries

14 years agoAdd wrappers around fcntl
Ian Lynagh [Wed, 20 May 2009 17:53:58 +0000 (17:53 +0000)]
Add wrappers around fcntl
We need to do this as it has a (, ...) type, which we aren't allowed to
directly call with the FFI.

14 years agoAdd more bang patterns, needed to fix the 32bit build
Ian Lynagh [Fri, 24 Apr 2009 16:07:01 +0000 (16:07 +0000)]
Add more bang patterns, needed to fix the 32bit build

14 years agoUse a bang pattern when we where/let-bind values with unlifted types
Ian Lynagh [Fri, 24 Apr 2009 12:53:20 +0000 (12:53 +0000)]
Use a bang pattern when we where/let-bind values with unlifted types

15 years agoFIX #3171: make sure we have only one table of signal handlers
Simon Marlow [Thu, 23 Apr 2009 11:28:37 +0000 (11:28 +0000)]
FIX #3171: make sure we have only one table of signal handlers

15 years agoFix QSem and QSemN: Initial amount must be non-negative
Ian Lynagh [Fri, 10 Apr 2009 16:40:13 +0000 (16:40 +0000)]
Fix QSem and QSemN: Initial amount must be non-negative

15 years agoDon't inline enumDeltaToInteger until its rules have had a chance to fire
simonpj@microsoft.com [Fri, 3 Apr 2009 09:17:50 +0000 (09:17 +0000)]
Don't inline enumDeltaToInteger until its rules have had a chance to fire

15 years agoImport GHC.Err so we see bottoming functions properly
simonpj@microsoft.com [Fri, 3 Apr 2009 09:11:18 +0000 (09:11 +0000)]
Import GHC.Err so we see bottoming functions properly

Before this patch, GHC/Err.lhs-boot exported divZeroError and overflowError,
as well as plain 'error'.  The latter has a wired-in defn in GHC (MkId.lhs),
but the former two do not.  As a result GHC doesn't see that overflowError
is a bottoming function at a crucial moment when compiling GHC.Real, and
that means that divMod wasn't getting the CPR property.

The fix is easy:
  - GHC/Err.lhs-boot should export only 'error'

  - GHC.Real, GHC.Int, and GHC.Word should import GHC.Err
    directly.  They can do this nowadays without creating
    a module loop, thanks to the new exception story

15 years agoDon't inline unpackCString
simonpj@microsoft.com [Fri, 3 Apr 2009 09:08:44 +0000 (09:08 +0000)]
Don't inline unpackCString

There's no point in inlining unpackCString, so this patch adds a
NOINLINE pragma.  (Otherwise, it's just on the threshold.)

15 years agobe sure to install Nhc98BaseConfig.h
Malcolm.Wallace@cs.york.ac.uk [Wed, 1 Apr 2009 12:20:28 +0000 (12:20 +0000)]
be sure to install Nhc98BaseConfig.h

15 years agoAvoid unnecessarily using Integer when decoding Floats
Ian Lynagh [Mon, 30 Mar 2009 22:52:41 +0000 (22:52 +0000)]
Avoid unnecessarily using Integer when decoding Floats

15 years agoAdd another Data.List.intersect example from Christian Maeder
Ian Lynagh [Fri, 27 Mar 2009 23:21:18 +0000 (23:21 +0000)]
Add another Data.List.intersect example from Christian Maeder

15 years agoRemove some redundant fromInteger's
Ian Lynagh [Tue, 24 Mar 2009 14:53:25 +0000 (14:53 +0000)]
Remove some redundant fromInteger's

15 years agoAdd an import needed in the new build system
Ian Lynagh [Sun, 22 Mar 2009 16:22:41 +0000 (16:22 +0000)]
Add an import needed in the new build system

15 years agoghcconfig.h is __GLASGOW_HASKELL__ only
Malcolm.Wallace@cs.york.ac.uk [Mon, 16 Mar 2009 13:45:32 +0000 (13:45 +0000)]
ghcconfig.h is __GLASGOW_HASKELL__ only

15 years agoFix layout to comply with H'98.
Malcolm.Wallace@cs.york.ac.uk [Mon, 16 Mar 2009 12:56:51 +0000 (12:56 +0000)]
Fix layout to comply with H'98.
Also, configure correctly for nhc98, to avoid win32 code.

15 years agoFIX #2189: re-enabled cooked mode for Console-connected Handles on Windows
Simon Marlow [Thu, 5 Mar 2009 11:33:23 +0000 (11:33 +0000)]
FIX #2189: re-enabled cooked mode for Console-connected Handles on Windows
Patch from Sigbjorn Finne <sof@galois.com>

15 years agoavoid a space leak building up in the "prodding" IORef (part of #2992)
Simon Marlow [Wed, 11 Mar 2009 09:39:38 +0000 (09:39 +0000)]
avoid a space leak building up in the "prodding" IORef (part of #2992)

15 years agoPartial fix for #2917
Simon Marlow [Thu, 5 Mar 2009 15:41:53 +0000 (15:41 +0000)]
Partial fix for #2917

 - add newAlignedPinnedByteArray# for allocating pinned BAs with
   arbitrary alignment

 - the old newPinnedByteArray# now aligns to 16 bytes

Foreign.alloca will use newAlignedPinnedByteArray#, and so might end
up wasting less space than before (we used to align to 8 by default).
Foreign.allocaBytes and Foreign.mallocForeignPtrBytes will get 16-byte
aligned memory, which is enough to avoid problems with SSE
instructions on x86, for example.

There was a bug in the old newPinnedByteArray#: it aligned to 8 bytes,
but would have failed if the header was not a multiple of 8
(fortunately it always was, even with profiling).  Also we
occasionally wasted some space unnecessarily due to alignment in
allocatePinned().

I haven't done anything about Foreign.malloc/mallocBytes, which will
give you the same alignment guarantees as malloc() (8 bytes on
Linux/x86 here).

15 years agoAdd config.guess, config.sub and install-sh
Ian Lynagh [Sat, 7 Mar 2009 15:38:31 +0000 (15:38 +0000)]
Add config.guess, config.sub and install-sh

15 years agoadd final newline; fix build (on Windows?)
Simon Marlow [Thu, 5 Mar 2009 12:04:26 +0000 (12:04 +0000)]
add final newline; fix build (on Windows?)

15 years agoFIX #2189: re-enabled cooked mode for Console-connected Handles on Windows
Simon Marlow [Thu, 5 Mar 2009 11:33:23 +0000 (11:33 +0000)]
FIX #2189: re-enabled cooked mode for Console-connected Handles on Windows
Patch from Sigbjorn Finne <sof@galois.com>

15 years agoRules to make genericLength strict for Int/Integer lengths, see #2962
naur@post11.tele.dk [Sat, 7 Feb 2009 18:14:27 +0000 (18:14 +0000)]
Rules to make genericLength strict for Int/Integer lengths, see #2962

15 years ago#2759: Amend previous patch
Jose Pedro Magalhaes [Thu, 12 Feb 2009 13:23:27 +0000 (13:23 +0000)]
#2759: Amend previous patch

15 years agoifdef out the definition of setCloseOnExec on Windows; fixes the build
Ian Lynagh [Fri, 20 Feb 2009 17:30:41 +0000 (17:30 +0000)]
ifdef out the definition of setCloseOnExec on Windows; fixes the build

15 years agoFix warnings: put imports inside ifdefs
Ian Lynagh [Fri, 20 Feb 2009 17:39:41 +0000 (17:39 +0000)]
Fix warnings: put imports inside ifdefs

15 years agoifdef out the syncIOManager export on Windows; fixes the build
Ian Lynagh [Fri, 20 Feb 2009 17:34:14 +0000 (17:34 +0000)]
ifdef out the syncIOManager export on Windows; fixes the build

15 years agoSet the IO manager pipe descriptors to FD_CLOEXEC
Simon Marlow [Thu, 19 Feb 2009 11:42:17 +0000 (11:42 +0000)]
Set the IO manager pipe descriptors to FD_CLOEXEC
This pipe is an internal implementation detail, we don't really want
it to be exposed.

15 years agoRewrite of signal-handling (base patch; see also ghc and unix patches)
Simon Marlow [Thu, 19 Feb 2009 10:22:03 +0000 (10:22 +0000)]
Rewrite of signal-handling (base patch; see also ghc and unix patches)

The API is the same (for now).  The new implementation has the
capability to define signal handlers that have access to the siginfo
of the signal (#592), but this functionality is not exposed in this
patch.

#2451 is the ticket for the new API.

The main purpose of bringing this in now is to fix race conditions in
the old signal handling code (#2858).  Later we can enable the new
API in the HEAD.

Implementation differences:

 - More of the signal-handling is moved into Haskell.  We store the
   table of signal handlers in an MVar, rather than having a table of
   StablePtrs in the RTS.

 - In the threaded RTS, the siginfo of the signal is passed down the
   pipe to the IO manager thread, which manages the business of
   starting up new signal handler threads.  In the non-threaded RTS,
   the siginfo of caught signals is stored in the RTS, and the
   scheduler starts new signal handler threads.

15 years agoFix #2971: we had lost the non-blocking flag on Handles created by openFile
Simon Marlow [Fri, 6 Feb 2009 16:59:12 +0000 (16:59 +0000)]
Fix #2971: we had lost the non-blocking flag on Handles created by openFile
This code is a mess, fortunately the new IO library cleans it up.

15 years agoadd some rules of thumb for catching exceptions, restructure the docs a bit
Simon Marlow [Thu, 5 Feb 2009 15:06:42 +0000 (15:06 +0000)]
add some rules of thumb for catching exceptions, restructure the docs a bit

15 years agoimplement System.IO.Error more fully for nhc98
Malcolm.Wallace@cs.york.ac.uk [Fri, 6 Feb 2009 17:33:14 +0000 (17:33 +0000)]
implement System.IO.Error more fully for nhc98

15 years agoMake System.Posix.Internals buildable by nhc98.
Malcolm.Wallace@cs.york.ac.uk [Fri, 6 Feb 2009 11:11:52 +0000 (11:11 +0000)]
Make System.Posix.Internals buildable by nhc98.

15 years agoFix #2903: ensure CWStringLen contains the length of the array rather than the String
Ross Paterson [Tue, 3 Feb 2009 01:10:26 +0000 (01:10 +0000)]
Fix #2903: ensure CWStringLen contains the length of the array rather than the String

15 years agoOldException catches unknown exceptions as DynException
Ian Lynagh [Mon, 2 Feb 2009 15:18:56 +0000 (15:18 +0000)]
OldException catches unknown exceptions as DynException
It's important that we put all exceptions into the old Exception
type somehow, or throwing a new exception wouldn't cause the
cleanup code for bracket, finally etc to happen.

15 years agoUpdate the Exception docs
Ian Lynagh [Sat, 31 Jan 2009 20:48:45 +0000 (20:48 +0000)]
Update the Exception docs

15 years agoRequire Cabal version >= 1.6
Ian Lynagh [Thu, 22 Jan 2009 01:12:51 +0000 (01:12 +0000)]
Require Cabal version >= 1.6

15 years agoAdd "bug-reports" and "source-repository" info to the Cabal file
Ian Lynagh [Wed, 21 Jan 2009 18:20:10 +0000 (18:20 +0000)]
Add "bug-reports" and "source-repository" info to the Cabal file

15 years agoProposal #2875: remove StringRep and StringConstr
Jose Pedro Magalhaes [Fri, 16 Jan 2009 14:26:17 +0000 (14:26 +0000)]
Proposal #2875: remove StringRep and StringConstr

15 years agoFix #2759: add mkRealConstr and mkIntegralConstr, deprecate mkFloatConstr and mkIntConstr
Jose Pedro Magalhaes [Fri, 16 Jan 2009 14:06:55 +0000 (14:06 +0000)]
Fix #2759: add mkRealConstr and mkIntegralConstr, deprecate mkFloatConstr and mkIntConstr

15 years agoCorrect SYB's representation of Char
Jose Pedro Magalhaes [Thu, 11 Dec 2008 14:47:16 +0000 (14:47 +0000)]
Correct SYB's representation of Char

15 years agoavoid `mappend` in monoid laws, because it doesn't work with haddock
Ross Paterson [Sun, 18 Jan 2009 01:15:08 +0000 (01:15 +0000)]
avoid `mappend` in monoid laws, because it doesn't work with haddock

15 years agoMake Data.Typeable imports and exports more explicit
Ian Lynagh [Wed, 14 Jan 2009 23:45:12 +0000 (23:45 +0000)]
Make Data.Typeable imports and exports more explicit

15 years agoadd Monoid laws
Ross Paterson [Fri, 16 Jan 2009 15:16:24 +0000 (15:16 +0000)]
add Monoid laws

15 years agoUnbreak an import cycle caused by moving 'catch' definitions around.
Malcolm.Wallace@cs.york.ac.uk [Fri, 16 Jan 2009 11:01:32 +0000 (11:01 +0000)]
Unbreak an import cycle caused by moving 'catch' definitions around.
The new cycle was introduced for nhc98 only.

15 years agomake the Monoid docs more self-contained
Ross Paterson [Thu, 15 Jan 2009 22:24:41 +0000 (22:24 +0000)]
make the Monoid docs more self-contained

15 years agoMove some catch definitions around to avoid an import loop
Ian Lynagh [Wed, 14 Jan 2009 21:10:33 +0000 (21:10 +0000)]
Move some catch definitions around to avoid an import loop
As suggested by simonpj in trac #2822.

15 years agoAdd NoImplicitPrelude to the extensions used when building with GHC
Ian Lynagh [Wed, 14 Jan 2009 20:28:10 +0000 (20:28 +0000)]
Add NoImplicitPrelude to the extensions used when building with GHC

15 years ago#2699: exit silently for EPIPE on stdout
Simon Marlow [Wed, 14 Jan 2009 13:46:12 +0000 (13:46 +0000)]
#2699: exit silently for EPIPE on stdout

15 years agoFix build when we have HTYPE_TCFLAG_T
Ian Lynagh [Mon, 5 Jan 2009 10:20:20 +0000 (10:20 +0000)]
Fix build when we have HTYPE_TCFLAG_T

15 years agoFix the build on Windows
Ian Lynagh [Mon, 5 Jan 2009 01:46:25 +0000 (01:46 +0000)]
Fix the build on Windows

15 years agoAdd errno to the IOError type
Ian Lynagh [Sun, 4 Jan 2009 17:30:18 +0000 (17:30 +0000)]
Add errno to the IOError type

15 years agoFix typo (reqwests -> requests); trac #2908, spotted by bancroft
Ian Lynagh [Sun, 4 Jan 2009 15:44:05 +0000 (15:44 +0000)]
Fix typo (reqwests -> requests); trac #2908, spotted by bancroft

15 years agoMore compact error messages for record selectors
simonpj@microsoft.com [Fri, 2 Jan 2009 14:53:25 +0000 (14:53 +0000)]
More compact error messages for record selectors

Make recSelError generate the standard part of the record selector
error message (i.e. "No match in record selector") rather than have
that string duplicated for every record selector.

15 years agoextra dependencies for the new build system
Simon Marlow [Wed, 17 Dec 2008 10:46:55 +0000 (10:46 +0000)]
extra dependencies for the new build system

15 years agowarning fix: don't use -XPatternSignatures in GHC >= 6.10
Simon Marlow [Wed, 17 Dec 2008 10:46:37 +0000 (10:46 +0000)]
warning fix: don't use -XPatternSignatures in GHC >= 6.10

15 years agoRollback INLINE patches
Simon Marlow [Tue, 16 Dec 2008 10:41:43 +0000 (10:41 +0000)]
Rollback INLINE patches

rolling back:

Fri Dec  5 17:00:15 GMT 2008  simonpj@microsoft.com
  * Update INLINE pragmas for new INLINE story

  - (.) and foldr should inline when applied to only two arguments
  - Make unpackCString# NOINLINE; it inlines too much (with little gain)

    M ./GHC/Base.lhs -10 +31

15 years agoFIX #1364: added support for C finalizers that run as soon as the value is no longer...
Ivan Tomac [Wed, 10 Dec 2008 15:05:10 +0000 (15:05 +0000)]
FIX #1364: added support for C finalizers that run as soon as the value is no longer reachable.

Patch amended by Simon Marlow:
  - mkWeakFinalizer# commoned up with mkWeakFinalizerEnv#

15 years agoFix #2760: deprecate mkNorepType, add mkNoRepType
Jose Pedro Magalhaes [Fri, 21 Nov 2008 14:19:05 +0000 (14:19 +0000)]
Fix #2760: deprecate mkNorepType, add mkNoRepType

15 years agoUpdate INLINE pragmas for new INLINE story
simonpj@microsoft.com [Fri, 5 Dec 2008 17:00:15 +0000 (17:00 +0000)]
Update INLINE pragmas for new INLINE story

- (.) and foldr should inline when applied to only two arguments
- Make unpackCString# NOINLINE; it inlines too much (with little gain)

15 years agoFix #2750: change Prelude.(,) to Prelude.(,,)
Jose Pedro Magalhaes [Mon, 1 Dec 2008 11:34:11 +0000 (11:34 +0000)]
Fix #2750: change Prelude.(,) to Prelude.(,,)

15 years agoFix typo (or out of date reference) in throwTo documentation.
shelarcy [Sat, 29 Nov 2008 02:46:39 +0000 (02:46 +0000)]
Fix typo (or out of date reference) in throwTo documentation.

15 years agoAdd more description of what "round" does, from the H98 report
Ian Lynagh [Wed, 19 Nov 2008 14:31:31 +0000 (14:31 +0000)]
Add more description of what "round" does, from the H98 report

15 years agore-instate the gcd/Integer and lcm/Integer RULES
Simon Marlow [Thu, 20 Nov 2008 10:18:26 +0000 (10:18 +0000)]
re-instate the gcd/Integer and lcm/Integer RULES
Fixes a performance regression between 6.8.3 and 6.10.1

15 years agoChange an "undefined" into a more informative error; trac #2782
Ian Lynagh [Sun, 16 Nov 2008 16:02:28 +0000 (16:02 +0000)]
Change an "undefined" into a more informative error; trac #2782

15 years agoupdating Haddock documentation
jpm@cs.uu.nl [Tue, 11 Nov 2008 09:50:23 +0000 (09:50 +0000)]
updating Haddock documentation

Fixed the broken link from Data.Generics to Data.Data.