ghc-base.git
15 years agoFix the build on Windows 2008-05-28
Ian Lynagh [Tue, 20 May 2008 21:36:43 +0000 (21:36 +0000)]
Fix the build on Windows

15 years agoAdd wrappers for [gs]etrlimit
Ian Lynagh [Tue, 20 May 2008 16:24:11 +0000 (16:24 +0000)]
Add wrappers for [gs]etrlimit
This is for #2038: macros are used in the Linux .h includes to redirect
to a 64-bit version when large file support is enabled.

15 years agoAdd a wrapper for mkstemp
Ian Lynagh [Tue, 20 May 2008 16:13:12 +0000 (16:13 +0000)]
Add a wrapper for mkstemp
This is for #2038: macros are used in the Linux .h includes to redirect
to a 64-bit version when large file support is enabled.

15 years agoAvoid calling varargs functions using the FFI
Simon Marlow [Fri, 9 May 2008 14:53:34 +0000 (14:53 +0000)]
Avoid calling varargs functions using the FFI
Calling varargs functions is explicitly deprecated according to the
FFI specification.  It used to work, just about, but it broke with the
recent changes to the via-C backend to not use header files.

15 years agoAdd comments about why rotate has an INLINE
simonpj@microsoft.com [Fri, 2 May 2008 07:41:37 +0000 (07:41 +0000)]
Add comments about why rotate has an INLINE

15 years agoInline Data.Bits.rotate@Int, enables rotate to be constant folded
Don Stewart [Thu, 1 May 2008 23:01:52 +0000 (23:01 +0000)]
Inline Data.Bits.rotate@Int, enables rotate to be constant folded

All other Bits instances seem to inline well enough on their own
to enable constant folding, e.g.

    sumU . mapU (`shift` 3) . replicateU 10000000 $ (7 :: Int)

goes to:

    Main.$wfold =
      \ (ww_sOb :: Int#) (ww1_sOf :: Int#) ->
        case ww1_sOf of wild_XM {
          __DEFAULT -> Main.$wfold (+# ww_sOb 56) (+# wild_XM 1);
          10000000 -> ww_sOb
        }

With this patch, rotate gets inlined and folded too,

    sumU . mapU (`rotate` 3) . replicateU 10000000 $ (7 :: Int)

to:

  Main.$wfold =
    \ (ww_sO7 :: Int#) (ww1_sOb :: Int#) ->
      case ww1_sOb of wild_XM {
        __DEFAULT -> Main.$wfold (+# ww_sO7 56) (+# wild_XM 1);
        10000000 -> ww_sO7

Whereas it was left as a call to $wrotate before.

15 years agoMoved def. of emptyP
keller@cse.unsw.edu.au [Thu, 1 May 2008 02:42:23 +0000 (02:42 +0000)]
Moved def. of emptyP

15 years agoemptyP def to gHC.PArr
keller@cse.unsw.edu.au [Thu, 1 May 2008 01:25:47 +0000 (01:25 +0000)]
emptyP def to gHC.PArr

15 years agoReexport (>>>) and (<<<) from Control.Arrow. Preserves API compatibility
Don Stewart [Wed, 30 Apr 2008 23:10:55 +0000 (23:10 +0000)]
Reexport (>>>) and (<<<) from Control.Arrow. Preserves API compatibility

15 years agoAdd realToFrac RULE comments from patch message into the source code
simonpj@microsoft.com [Wed, 30 Apr 2008 21:43:55 +0000 (21:43 +0000)]
Add realToFrac RULE comments from patch message into the source code

15 years agoAdd RULES for realToFrac from Int.
Don Stewart [Wed, 30 Apr 2008 17:41:26 +0000 (17:41 +0000)]
Add RULES for realToFrac from Int.

    {-# RULES
    "realToFrac/Int->Double"    realToFrac   = int2Double
    "realToFrac/Int->Float"     realToFrac   = int2Float
      #-}

Note that this only matters for realToFrac. If you've been using
fromIntegral to promote Int to Doubles, things should be fine as they are.

The following program, using stream fusion to eliminate arrays:

    import Data.Array.Vector

    n = 40000000

    main = do
          let c = replicateU n (2::Double)
              a = mapU realToFrac (enumFromToU 0 (n-1) ) :: UArr Double
          print (sumU (zipWithU (*) c a))

Yields this loop body without the RULE:

    case $wtoRational sc_sY4 of ww_aM7 { (# ww1_aM9, ww2_aMa #) ->
    case $wfromRat ww1_aM9 ww2_aMa of tpl_X1P { D# ipv_sW3 ->
    Main.$s$wfold
      (+# sc_sY4 1)
      (+# wild_X1i 1)
      (+## sc2_sY6 (*## 2.0 ipv_sW3))

And with the rule:

   Main.$s$wfold
      (+# sc_sXT 1)
      (+# wild_X1h 1)
      (+## sc2_sXV (*## 2.0 (int2Double# sc_sXT)))

The running time of the program goes from 120 seconds to 0.198 seconds
with the native backend, and 0.143 seconds with the C backend.

And just so I don't forget, here's the difference in resulting
assembly (x86_64), between the native code generator, and the
C backend.

-fasm

    Main_zdszdwfold_info:
      movq %rdi,%rax
      cmpq $40000000,%rax
      jne .LcZK
      jmp *(%rbp)
    .LcZK:
      cmpq $39999999,%rsi
      jg .LcZN
      cvtsi2sdq %rsi,%xmm0
      mulsd .LnZP(%rip),%xmm0
      movsd %xmm5,%xmm7
      addsd %xmm0,%xmm7
      incq %rax
      incq %rsi
      movq %rax,%rdi
      movsd %xmm7,%xmm5
      jmp Main_zdszdwfold_info

With the C backend we get the even better assembly, (-fvia-C -optc-O3)

    Main_zdszdwfold_info:
        cmpq    $40000000, %rdi
        je  .L9
    .L5:
        cmpq    $39999999, %rsi
        jg  .L9
        cvtsi2sdq   %rsi, %xmm0
        leaq    1(%rdi), %rdi
        addq    $1, %rsi
        addsd   %xmm0, %xmm0
        addsd   %xmm0, %xmm5
        jmp Main_zdszdwfold_info
    .L9:
        jmp *(%rbp)

So might make a useful test once the native codegen project starts up.

16 years agoJust (-0/1) is now printed as Just (-0.0), not Just -0.0; trac #2036
Ian Lynagh [Sun, 27 Apr 2008 13:32:30 +0000 (13:32 +0000)]
Just (-0/1) is now printed as Just (-0.0), not Just -0.0; trac #2036

16 years agorecord libraries@haskell.org as maintainer
Ross Paterson [Fri, 25 Apr 2008 09:52:00 +0000 (09:52 +0000)]
record libraries@haskell.org as maintainer

16 years agoAdded emptyP def
keller@cse.unsw.edu.au [Thu, 24 Apr 2008 02:14:03 +0000 (02:14 +0000)]
Added emptyP def

16 years agodon't set O_NONBLOCK on FDs passed to fdToHandle
Simon Marlow [Tue, 22 Apr 2008 20:47:19 +0000 (20:47 +0000)]
don't set O_NONBLOCK on FDs passed to fdToHandle

16 years agoImprove docs for unsafeCoerce
Malcolm.Wallace@cs.york.ac.uk [Tue, 22 Apr 2008 13:05:47 +0000 (13:05 +0000)]
Improve docs for unsafeCoerce
Make it clear that compilers differ.  Point to GHC docs in GHC.Base, and
add a short description of nhc98's representation-safe conversions.

16 years agoSpelling only
simonpj@microsoft.com [Tue, 22 Apr 2008 08:20:33 +0000 (08:20 +0000)]
Spelling only

16 years agoIn docs for unsafeCoerce, point to unsafeCoerce#
simonpj@microsoft.com [Mon, 21 Apr 2008 15:22:51 +0000 (15:22 +0000)]
In docs for unsafeCoerce, point to unsafeCoerce#

16 years agoTurn off the gcd/lcm optimisations for Integer for now
Ian Lynagh [Fri, 18 Apr 2008 19:02:38 +0000 (19:02 +0000)]
Turn off the gcd/lcm optimisations for Integer for now
This makes it easier to experiment with other implementations

16 years agoOrdering has now moved to ghc-prim
Ian Lynagh [Sat, 12 Apr 2008 10:07:41 +0000 (10:07 +0000)]
Ordering has now moved to ghc-prim

16 years agofix types for __hscore_st_dev() and __hscore_st_ino()
Simon Marlow [Wed, 19 Mar 2008 17:41:01 +0000 (17:41 +0000)]
fix types for __hscore_st_dev() and __hscore_st_ino()

16 years agogive an absolute path to 'harch'
Malcolm.Wallace@cs.york.ac.uk [Thu, 27 Mar 2008 14:29:12 +0000 (14:29 +0000)]
give an absolute path to 'harch'

16 years agoMove Word64/Int64/Word32/Int32 primitives into ghc-prim
Ian Lynagh [Tue, 25 Mar 2008 20:26:34 +0000 (20:26 +0000)]
Move Word64/Int64/Word32/Int32 primitives into ghc-prim

16 years agoUpdate .darcs-boring
Ian Lynagh [Mon, 24 Mar 2008 20:58:08 +0000 (20:58 +0000)]
Update .darcs-boring
GHC/Prim.hs, GHC/PrimopWrappers.hs are no longer generated in this package

16 years agoRemove GHC.PrimopWrappers from base's exposed modules list
Ian Lynagh [Mon, 24 Mar 2008 20:57:34 +0000 (20:57 +0000)]
Remove GHC.PrimopWrappers from base's exposed modules list

16 years agobase now uses build-type: Configure
Ian Lynagh [Sun, 23 Mar 2008 19:11:46 +0000 (19:11 +0000)]
base now uses build-type: Configure

16 years agoMove Integer out into its own package
Ian Lynagh [Sun, 23 Mar 2008 18:13:42 +0000 (18:13 +0000)]
Move Integer out into its own package
We now depend on the new integer package.
We also depend on a new ghc-prim package, which has GHC.Prim,
GHC.PrimopWrappers, and new modules GHC.Bool and GHC.Generics,
containing Bool and Unit/Inl/Inr respectively.

16 years agoList extensions used rather than using the -fglasgow-exts hammer
Ian Lynagh [Sat, 22 Mar 2008 13:36:22 +0000 (13:36 +0000)]
List extensions used rather than using the -fglasgow-exts hammer

16 years agoRemove a gratuitous pattern type sig
Ian Lynagh [Fri, 21 Mar 2008 01:13:56 +0000 (01:13 +0000)]
Remove a gratuitous pattern type sig

16 years agoAn even better definition for (^) (trac #1687)
Ian Lynagh [Thu, 20 Mar 2008 00:39:57 +0000 (00:39 +0000)]
An even better definition for (^) (trac #1687)

16 years agoReplace (^) with a faster variant (from trac #1687)
Ian Lynagh [Tue, 18 Mar 2008 00:30:17 +0000 (00:30 +0000)]
Replace (^) with a faster variant (from trac #1687)

16 years agoAdd partitionEithers, lefts, and rights.
Ian Lynagh [Fri, 14 Mar 2008 19:30:37 +0000 (19:30 +0000)]
Add partitionEithers, lefts, and rights.
Patch from Russell O'Connor, trac proposal #974.

16 years agoSystem.Console.GetOpt mistakenly rejects options as ambiguous.
Malcolm.Wallace@cs.york.ac.uk [Wed, 12 Mar 2008 11:10:47 +0000 (11:10 +0000)]
System.Console.GetOpt mistakenly rejects options as ambiguous.
From "Eelis van der Weegen" <haskell-libs@contacts.eelis.net>.
Testcase:

> import System.Console.GetOpt
>
> type Color = String
>
> optsDesc :: [OptDescr Color]
> optsDesc = [Option "" ["color", "colour"]
>                    (ReqArg id "color") "Foreground color"]
>
> main = do
>   let args = ["--col=blue"]
>   case getOpt RequireOrder optsDesc args of
>     (_, _, err:_) -> putStrLn err
>     _ -> return ()

Output:
  option `--col' is ambiguous; could be one of:
      --color=color, --colour=color  Foreground color
      --color=color, --colour=color  Foreground color

This error is silly, because the two alternatives listed are the same
option.  The problem is caused by incorrect use of a generator in a list
comprehension.

16 years agountabify
Don Stewart [Mon, 10 Mar 2008 00:54:55 +0000 (00:54 +0000)]
untabify

16 years agountabify
Don Stewart [Sat, 8 Mar 2008 01:42:56 +0000 (01:42 +0000)]
untabify

16 years agountabify
Don Stewart [Sat, 8 Mar 2008 01:41:29 +0000 (01:41 +0000)]
untabify

16 years agountabify
Don Stewart [Sat, 8 Mar 2008 01:40:40 +0000 (01:40 +0000)]
untabify

16 years agountabify
Don Stewart [Sat, 8 Mar 2008 01:35:56 +0000 (01:35 +0000)]
untabify

16 years agountabify
Don Stewart [Sat, 8 Mar 2008 01:24:57 +0000 (01:24 +0000)]
untabify

16 years agountabify
Don Stewart [Sat, 8 Mar 2008 01:20:59 +0000 (01:20 +0000)]
untabify

16 years agountabify
Don Stewart [Fri, 7 Mar 2008 19:27:27 +0000 (19:27 +0000)]
untabify

16 years agountabify
Don Stewart [Wed, 5 Mar 2008 03:37:12 +0000 (03:37 +0000)]
untabify

16 years agountabify
Don Stewart [Wed, 5 Mar 2008 01:58:27 +0000 (01:58 +0000)]
untabify

16 years agountabify
Don Stewart [Wed, 5 Mar 2008 01:25:30 +0000 (01:25 +0000)]
untabify

16 years agountabify
Don Stewart [Wed, 5 Mar 2008 01:03:43 +0000 (01:03 +0000)]
untabify

16 years agountabify
Don Stewart [Wed, 5 Mar 2008 01:02:55 +0000 (01:02 +0000)]
untabify

16 years agountabify
Don Stewart [Wed, 5 Mar 2008 00:50:41 +0000 (00:50 +0000)]
untabify

16 years agountabify
Don Stewart [Wed, 5 Mar 2008 00:50:25 +0000 (00:50 +0000)]
untabify

16 years agountabify
Don Stewart [Tue, 4 Mar 2008 23:53:30 +0000 (23:53 +0000)]
untabify

16 years agountabify
Don Stewart [Tue, 4 Mar 2008 22:51:20 +0000 (22:51 +0000)]
untabify

16 years agountabify
Don Stewart [Tue, 4 Mar 2008 17:48:27 +0000 (17:48 +0000)]
untabify

16 years agountabify
Don Stewart [Mon, 3 Mar 2008 19:51:09 +0000 (19:51 +0000)]
untabify

16 years agountabify
Don Stewart [Mon, 3 Mar 2008 19:50:02 +0000 (19:50 +0000)]
untabify

16 years agountabify
Don Stewart [Mon, 3 Mar 2008 19:44:54 +0000 (19:44 +0000)]
untabify

16 years agountabify
Don Stewart [Thu, 28 Feb 2008 23:44:43 +0000 (23:44 +0000)]
untabify

16 years agountabify
Don Stewart [Thu, 28 Feb 2008 18:54:09 +0000 (18:54 +0000)]
untabify

16 years agountabify
Don Stewart [Thu, 28 Feb 2008 18:53:56 +0000 (18:53 +0000)]
untabify

16 years agountabify
Don Stewart [Thu, 28 Feb 2008 18:53:31 +0000 (18:53 +0000)]
untabify

16 years agoexport MVar, TVar, and STM non-abstractly
Simon Marlow [Thu, 28 Feb 2008 11:30:35 +0000 (11:30 +0000)]
export MVar, TVar, and STM non-abstractly
As requested by Sterling Clover on ghc-users

16 years agoAdded Down class and improved groupWith fusion
Max Bolingbroke [Wed, 13 Feb 2008 21:22:46 +0000 (21:22 +0000)]
Added Down class and improved groupWith fusion

16 years agountabify
Don Stewart [Wed, 27 Feb 2008 06:28:36 +0000 (06:28 +0000)]
untabify

16 years agountabify
Don Stewart [Tue, 26 Feb 2008 07:06:30 +0000 (07:06 +0000)]
untabify

16 years agomention explicitly that hIsEOF may block
Simon Marlow [Wed, 20 Feb 2008 14:12:09 +0000 (14:12 +0000)]
mention explicitly that hIsEOF may block

16 years agountabify
Don Stewart [Tue, 19 Feb 2008 23:36:44 +0000 (23:36 +0000)]
untabify

16 years agountabify
Don Stewart [Tue, 19 Feb 2008 23:30:47 +0000 (23:30 +0000)]
untabify

16 years agountabify
Don Stewart [Tue, 19 Feb 2008 23:29:10 +0000 (23:29 +0000)]
untabify

16 years agountabify
Don Stewart [Tue, 19 Feb 2008 22:54:37 +0000 (22:54 +0000)]
untabify

16 years agountabify
Don Stewart [Tue, 19 Feb 2008 06:15:13 +0000 (06:15 +0000)]
untabify

16 years agoAdd exitSuccess :: IO a. For symmetry with exitFailure
Don Stewart [Wed, 13 Feb 2008 22:26:44 +0000 (22:26 +0000)]
Add exitSuccess :: IO a. For symmetry with exitFailure

16 years agountabify
Don Stewart [Mon, 18 Feb 2008 07:57:32 +0000 (07:57 +0000)]
untabify

16 years agountabify
Don Stewart [Mon, 18 Feb 2008 06:54:11 +0000 (06:54 +0000)]
untabify

16 years agountabify
Don Stewart [Fri, 15 Feb 2008 00:55:43 +0000 (00:55 +0000)]
untabify

16 years agoFIX dynamic001, dynamic002: further fixes to tuple printing
Simon Marlow [Mon, 11 Feb 2008 10:19:08 +0000 (10:19 +0000)]
FIX dynamic001, dynamic002: further fixes to tuple printing

16 years agountabify
Don Stewart [Wed, 13 Feb 2008 22:19:50 +0000 (22:19 +0000)]
untabify

16 years agountabify only
Don Stewart [Wed, 13 Feb 2008 22:18:56 +0000 (22:18 +0000)]
untabify only

16 years agowhitespace only
Don Stewart [Thu, 7 Feb 2008 19:19:39 +0000 (19:19 +0000)]
whitespace only

16 years agoWhitespace only
Don Stewart [Thu, 7 Feb 2008 18:39:54 +0000 (18:39 +0000)]
Whitespace only

16 years agoFIX dynamic001 dynamic002: isTupleTyCon had rotted
Simon Marlow [Tue, 5 Feb 2008 10:39:04 +0000 (10:39 +0000)]
FIX dynamic001 dynamic002: isTupleTyCon had rotted
In the patch "Tuple tycons have parens around their names", the names
of the tuple tycons were changed to include parens, but isTupleTyCon
was not updated to match, which made tuple types show as "(,) a b"
rather than "(a,b)"

16 years agodeforestation rules for enumFromThenTo; based on a patch from Robin Houston
Ian Lynagh [Sun, 3 Feb 2008 15:27:55 +0000 (15:27 +0000)]
deforestation rules for enumFromThenTo; based on a patch from Robin Houston

16 years agoGeneralise type of forever :: (Monad m) => m a -> m b
Don Stewart [Tue, 29 Jan 2008 19:19:40 +0000 (19:19 +0000)]
Generalise type of forever :: (Monad m) => m a -> m b

16 years agoFIX #1936: hGetBufNonBlocking was blocking on stdin/stdout/stderr
Simon Marlow [Thu, 24 Jan 2008 09:22:03 +0000 (09:22 +0000)]
FIX #1936: hGetBufNonBlocking was blocking on stdin/stdout/stderr

16 years agoThe default uncaught exception handler was adding an extra \n
Simon Marlow [Thu, 24 Jan 2008 09:12:16 +0000 (09:12 +0000)]
The default uncaught exception handler was adding an extra \n

16 years agoadd comment about lack of _chsize_s()
Simon Marlow [Wed, 23 Jan 2008 13:12:48 +0000 (13:12 +0000)]
add comment about lack of _chsize_s()

16 years agoWindows: large file support for hFileSize and hSeek (#1771)
Simon Marlow [Wed, 23 Jan 2008 10:29:04 +0000 (10:29 +0000)]
Windows: large file support for hFileSize and hSeek (#1771)

16 years agoExport topHandler, topHandlerFastExit from GHC.TopHandler
Ian Lynagh [Sun, 20 Jan 2008 18:24:29 +0000 (18:24 +0000)]
Export topHandler, topHandlerFastExit from GHC.TopHandler
We now use one of these in ghc when running with ghc -e

16 years agohaddock attributes for haddock-2.0
Ross Paterson [Sun, 20 Jan 2008 02:23:08 +0000 (02:23 +0000)]
haddock attributes for haddock-2.0

16 years agoData.List.sort: force elements from start to end.
Bertram Felgenhauer [Wed, 21 Nov 2007 10:14:58 +0000 (10:14 +0000)]
Data.List.sort: force elements from start to end.
this prevents a stack overflow on  sort (take 10^6 [1..])

16 years agoFix comment on GHC.Ptr.minusPtr
simonpj@microsoft.com [Wed, 9 Jan 2008 11:47:36 +0000 (11:47 +0000)]
Fix comment on GHC.Ptr.minusPtr

16 years agoRemove redundant imports of GHC.Err
simonpj@microsoft.com [Fri, 4 Jan 2008 09:13:14 +0000 (09:13 +0000)]
Remove redundant imports of GHC.Err

GHC.Base SOURCE-imports GHC.Err, and re-exports 'error'.  So
other modules need only import GHC.Base.

This doesn't change the fact that these other modules are all compiled
before GHC.Err, so they are all part of the module loop that starts with
GHC.Base and finishes with GHC.Err.  But it does reduce the occurrence
of those SOURCE imports.

16 years agoTuple tycons have parens around their names
simonpj@microsoft [Thu, 20 Dec 2007 17:18:12 +0000 (17:18 +0000)]
Tuple tycons have parens around their names

The name of the pair TyCon, in the Typeable instance,
should be "(,)" not ",".

Don't merge to 6.8; it's a minor API change.

16 years agoAdd groupWith, sortWith, the, to support generalised list comprehensions
simonpj@microsoft.com [Thu, 20 Dec 2007 11:19:29 +0000 (11:19 +0000)]
Add groupWith, sortWith, the, to support generalised list comprehensions

  This the base-library patch to support the main compiler patch
     Implement generalised list comprehensions

  It just adds three functions to GHC.Exts.

16 years agoAdd GHC.Prim to exposedModules in the Haddock 0.x hook
David Waern [Sun, 9 Dec 2007 17:39:31 +0000 (17:39 +0000)]
Add GHC.Prim to exposedModules in the Haddock 0.x hook

Please merge to the stable branch

16 years agoAdd GHC.Prim to exposedModules in the Haddock 0.x hook
David Waern [Sun, 9 Dec 2007 17:39:31 +0000 (17:39 +0000)]
Add GHC.Prim to exposedModules in the Haddock 0.x hook

Please merge to the stable branch

16 years agoSimplify the GHC.Prim hack in base.cabal/Setup.hs
Ian Lynagh [Sun, 2 Dec 2007 21:57:58 +0000 (21:57 +0000)]
Simplify the GHC.Prim hack in base.cabal/Setup.hs

16 years agoImplement 'openTempFile' for nhc98.
Malcolm.Wallace@cs.york.ac.uk [Fri, 7 Dec 2007 13:33:35 +0000 (13:33 +0000)]
Implement 'openTempFile' for nhc98.

16 years agodocs: describe the changes to forkIO, and document forkOnIO
Simon Marlow [Wed, 5 Dec 2007 09:14:23 +0000 (09:14 +0000)]
docs: describe the changes to forkIO, and document forkOnIO

16 years agodoc only: use realToFrac instead of fromRational.toRational
Simon Marlow [Wed, 5 Dec 2007 09:13:34 +0000 (09:13 +0000)]
doc only: use realToFrac instead of fromRational.toRational

16 years agoAdd singletonP to GHC.PArr
Roman Leshchinskiy [Wed, 5 Dec 2007 22:08:59 +0000 (22:08 +0000)]
Add singletonP to GHC.PArr

16 years agoFIX #1621: bug in Windows code for getCPUTime
Simon Marlow [Wed, 5 Dec 2007 12:01:18 +0000 (12:01 +0000)]
FIX #1621: bug in Windows code for getCPUTime
We were reading the components of FILETIME as CLong, when they should
be unsigned.  Word32 seems to be the correct type here.

16 years agoprotect console handler against concurrent access (#1922)
Simon Marlow [Tue, 4 Dec 2007 15:39:40 +0000 (15:39 +0000)]
protect console handler against concurrent access (#1922)