ghc-hetmet.git
17 years agoFall over more gracefully when there's a Template Haskell error
simonpj@microsoft.com [Fri, 18 Aug 2006 11:07:02 +0000 (11:07 +0000)]
Fall over more gracefully when there's a Template Haskell error

For a long time, Template Haskell has fallen over in a very un-graceful
way (i.e. panic) even when it encounters a programmer error.  In particular,
when DsMeta converts HsSyn to TH syntax, it may find Haskell code that
TH does not understand. This should be reported as a normal programmer
error, not with a compiler panic!

Originally the desugarer was supposed to never generate error
messages, but this TH desugaring thing does make it do so.  And in
fact, for other reasons, the desugarer now uses the TcRnIf monad, the
common monad used by the renamer, typechecker, interface checker, and
desugarer.

This patch completes the job, by
 - allowing the desugarer to generate errors
 - re-plumbing the error handling to take account of this
 - making DsMeta use the new facilities to report error gracefully

Quite a few lines of code are touched, but nothing deep is going on.

Fixes Trac# 760.

17 years agoFix typo (fst --> head) in docs on implicit parameters
simonpj@microsoft.com [Fri, 18 Aug 2006 07:59:37 +0000 (07:59 +0000)]
Fix typo (fst --> head) in docs on implicit parameters

17 years agoOne last hs-boot update
simonpj@microsoft.com [Thu, 17 Aug 2006 13:42:16 +0000 (13:42 +0000)]
One last hs-boot update

17 years agoMissing import for stage 2
simonpj@microsoft.com [Thu, 17 Aug 2006 13:32:47 +0000 (13:32 +0000)]
Missing import for stage 2

17 years agoOne more hs-boot file
simonpj@microsoft.com [Thu, 17 Aug 2006 13:32:20 +0000 (13:32 +0000)]
One more hs-boot file

17 years agoRefactoring for valid rule checking
simonpj@microsoft.com [Thu, 17 Aug 2006 13:01:41 +0000 (13:01 +0000)]
Refactoring for valid rule checking

17 years agoDo not CSE in INLINE and NOINLINE things
simonpj@microsoft.com [Thu, 17 Aug 2006 13:00:05 +0000 (13:00 +0000)]
Do not CSE in INLINE and NOINLINE things

See extensive comments with Note [INLINE and NOINLINE] in this file.

17 years agoUpdate lhs-boot files
simonpj@microsoft.com [Thu, 17 Aug 2006 13:20:03 +0000 (13:20 +0000)]
Update lhs-boot files

A consequence of my recent meddling with hs-boot files is that GHC is
more picky about the correpondence between the hs-boot file and the hs file.
In particular, you must use the same type synonyms.

This patche fixes up GHC's own hs-boot files to match the restriction.

17 years agoAdd ad-hoc typing checks for tagToEnum#
simonpj@microsoft.com [Wed, 16 Aug 2006 20:31:56 +0000 (20:31 +0000)]
Add ad-hoc typing checks for tagToEnum#

The problem with tagToEnum# is that it is not overloaded (in the
Haskell sense) but you are only supposed to apply it to a TyCon
that is an enumeration (isEnumerationTyCon).

The Real Way to do this is to have some special kind of type constraint
for the purpose, but that is wild overkill. So this patch adds a small
rather ad-hoc check to TcExpr.instFun.  Crude, simple, but it works fine.

Fixes Trac #786
Test is tcfail164

17 years agoGet dead-ness right in knownCon
simonpj@microsoft.com [Wed, 16 Aug 2006 16:42:16 +0000 (16:42 +0000)]
Get dead-ness right in knownCon

17 years agoTuning for argToPat
simonpj@microsoft.com [Wed, 16 Aug 2006 16:41:03 +0000 (16:41 +0000)]
Tuning for argToPat

argToPat is a crucial function for SpecConstr, because it decides
what patterns are worth specialising.  I was being much too gung-ho about
constants.  This patch makes it much better.

17 years agoRe-factor mkAtomicArgs and completeNonRecX
simonpj@microsoft.com [Wed, 16 Aug 2006 16:36:45 +0000 (16:36 +0000)]
Re-factor mkAtomicArgs and completeNonRecX

This refactoring ensures that when mkAtomicArgs adds new bindings,
it does so using completeNonRecX, which adds unfoldings etc.  More
modular, and saves passes too.

(This was important when getting rules to work right.  We want tob
fire a rule as soon as possible, taking into account all inlinings,
else a less-good rule applies.  That's what I found when doing
stream fusion anyway.)

Regardless, this is an improvement.

17 years agoAnother try at the continuation-swapping stuff
simonpj@microsoft.com [Wed, 16 Aug 2006 10:50:42 +0000 (10:50 +0000)]
Another try at the continuation-swapping stuff

I have spent altogether too long on my attempt to avoid case-of-case
in situations where it is a Bad Thing.  All the action is in the
case for mkDupableAlt that handles cases with a single alternative.

I've added rather extensive comments, and it finally seems to be working
more or less right.  If you compile (say) GHC/Real.o you'll see quite a
few case-of-cases remain (which didn't happen before), and they mostly look
pretty sensible to me.

17 years agoDon't build unnecessary lets in knownCon
simonpj@microsoft.com [Wed, 16 Aug 2006 10:48:31 +0000 (10:48 +0000)]
Don't build unnecessary lets in knownCon

Faced with
case x of y { (a,b) -> rhs }

where x is bound to (c,d), we were generating

let y = (c,d) in rhs

and thenn hoping to get rid of the y binding by CSE or some such.  It's
better simply not to build it in the first place, by generating

let y = x in rhs

This patch does the job.

17 years agoComments only
simonpj@microsoft.com [Wed, 16 Aug 2006 10:48:17 +0000 (10:48 +0000)]
Comments only

17 years agoRefactoring, plus record recursive-function *components* as RecArg too
simonpj@microsoft.com [Wed, 16 Aug 2006 08:58:09 +0000 (08:58 +0000)]
Refactoring, plus record recursive-function *components* as RecArg too

17 years agoRecord constructor arg occs correctly (bug-fix)
simonpj@microsoft.com [Wed, 16 Aug 2006 08:56:28 +0000 (08:56 +0000)]
Record constructor arg occs correctly (bug-fix)

I was forgetting the non-pattern-matched type args of a constructor.

17 years agoDisable form-checking for rule LHSs
simonpj@microsoft.com [Wed, 16 Aug 2006 08:56:12 +0000 (08:56 +0000)]
Disable form-checking for rule LHSs

Previously we checked the form of the arguments of a RULE lhs, to
ensure that they were simple applications. There was no good reason
for that, save to prevent you writing LHSs that were unlikely to match.

And Don Stewart found he wanted to do something we didn't allow (a section,
I think).  So I have just disabled the check.

17 years agoAllow class and instance decls in hs-boot files
simonpj@microsoft.com [Tue, 15 Aug 2006 12:34:02 +0000 (12:34 +0000)]
Allow class and instance decls in hs-boot files

For some reason, in 6.5 the manual said you could put a class decl in
an interface file, but not an instance decl; whereas the implementation
was exactly the othe way round.

This patch makes it possible to put *both* class and instance decls
in an interface file.

I also did a bit of re-factoring; comparing the declarations in the
hs-boot and hs file is now done by converting to IfaceSyn, because we
have good comparison operations for IfaceSyn already implemented.
This fixed a bug that previously let through an inconsistent declaration
of a data type.

The remaining infelicity concerns "abstract" TyCons.  They are a bit
of a hack anyway; and Classes are not handled in the same way.  Need
to think about this, but I think it's probably ok as it stands.

17 years agoReject derivable type classes with higher-rank methods
simonpj@microsoft.com [Tue, 15 Aug 2006 07:59:28 +0000 (07:59 +0000)]
Reject derivable type classes with higher-rank methods

Trac #864 suggested a derivable type class with a higher-rank method.

In principle this is quite do-able, but in practice the mechanism works
by generating source code and then doing type inference.  To make this work
with higher-rank types would require impredicative polymorphism. And we
do have that, so it could probably be made to work by generating (source-level)
type annotations.  But it's real work, so I'm settling for generating a
decent error message rather than crashing.

17 years agoSpecConstr now specialises on constants and lambdas
simonpj@microsoft.com [Tue, 15 Aug 2006 16:26:05 +0000 (16:26 +0000)]
SpecConstr now specialises on constants and lambdas

Roman inspired me to beef up SpecConstr to deal with
a) constant arguments
b) lambda arguments

This is described in elaborate comments in the file:
  Note [Specialising for constant parameters]
Note [Specialising for lambda parameters]

I also took the opportunity to fix the usage analysis done by
SpecConstr, which was only handling the top-level correctly.
Now it does nesting too.

17 years agoFix two bugs in rule-matching
simonpj@microsoft.com [Tue, 15 Aug 2006 16:20:30 +0000 (16:20 +0000)]
Fix two bugs in rule-matching

These two typo-like bugs have been there for a long time!

  One concerns the selection of overlapping rules,
  which was back to front

  The other was name-lining-up bug in the Case case of matching

This patch also arranges to export matchN.
  (Not a good name, but still!)

17 years agoMoving list-length code from one place in the file to another
simonpj@microsoft.com [Tue, 15 Aug 2006 16:19:47 +0000 (16:19 +0000)]
Moving list-length code from one place in the file to another

17 years agoMake UniqSM into a proper monad
simonpj@microsoft.com [Tue, 15 Aug 2006 16:18:29 +0000 (16:18 +0000)]
Make UniqSM into a proper monad

17 years agoTypo in patch that dealt with duplicating continuations in Simplify
simonpj@microsoft.com [Tue, 15 Aug 2006 07:02:46 +0000 (07:02 +0000)]
Typo in patch that dealt with duplicating continuations in Simplify

17 years agoBe more conservative about duplicating continuations
simonpj@microsoft.com [Mon, 14 Aug 2006 16:54:24 +0000 (16:54 +0000)]
Be more conservative about duplicating continuations

Roman found that GHC was duplicating continuations that arose (essentially)
from uses of 'seq', or strict constructors.  This fixes the problem;
see the comments mkDupableCont (the Select case with a single alternative).

I'm a little concerned that this may also miss useful case-of-case
tranformations, so I'd like to know if anyone finds that this patch
makes performance worse.

To make it a bit more gung-ho, one could check for all the binders
being dead, before choosing this new, conservative alternative.

17 years agoInline into tail-called constructor args
simonpj@microsoft.com [Mon, 14 Aug 2006 16:51:27 +0000 (16:51 +0000)]
Inline into tail-called constructor args

Consider
x = case y of { True -> (p,q); ... }

The occurrence analyser was marking p,q as 'Many', because they args
of a constructor in an RhsCtxt.  But actually they aren't in a RhsCtxt,
and in this case it's better to inline.

17 years agoImprove exprIsCheap
simonpj@microsoft.com [Mon, 14 Aug 2006 16:50:43 +0000 (16:50 +0000)]
Improve exprIsCheap

exprIsCheap is meant to return True iff it's ok to push the expression
inside a lambda.  But the previous version would return True of a nested
construtor application like (1:2:3:[]), which isn't right.

This patch re-factors the code somewhat, and fixes the bug.

17 years agoAdded xhtml and cgi as default libraries.
bringert@cs.chalmers.se [Mon, 14 Aug 2006 11:32:42 +0000 (11:32 +0000)]
Added xhtml and cgi as default libraries.

17 years agoImprove error message in TcHsType
simonpj@microsoft.com [Mon, 14 Aug 2006 09:56:17 +0000 (09:56 +0000)]
Improve error message in TcHsType

Fixes Trac #863.
Test is tcfail162

17 years agoWarning police: Removed overlapped pattern warnings
sven.panne@aedion.de [Fri, 11 Aug 2006 15:13:53 +0000 (15:13 +0000)]
Warning police: Removed overlapped pattern warnings

17 years agoComplete -fmono-pat-binds patch
simonpj@microsoft.com [Fri, 11 Aug 2006 14:28:42 +0000 (14:28 +0000)]
Complete -fmono-pat-binds patch

When adding the experimental -fmono-pat-binds, I forgot to check
for type signatures of the now-monomorphic patterns.  This patch
completes the job.

I documented the design too:
   http://haskell.galois.com/cgi-bin/haskell-prime/trac.cgi/wiki/MonomorphicPatternBindings

17 years agoAvoid warning about overlapped pattern for Linux target
sven.panne@aedion.de [Fri, 11 Aug 2006 14:05:12 +0000 (14:05 +0000)]
Avoid warning about overlapped pattern for Linux target

17 years agoImprove error message layouts
simonpj@microsoft.com [Fri, 11 Aug 2006 13:33:17 +0000 (13:33 +0000)]
Improve error message layouts

17 years agoAdd type signature
simonpj@microsoft.com [Fri, 11 Aug 2006 13:33:02 +0000 (13:33 +0000)]
Add type signature

17 years agoImprove the "could not find module" error message
Simon Marlow [Fri, 11 Aug 2006 13:21:35 +0000 (13:21 +0000)]
Improve the "could not find module" error message
In particular, if we're searching for the profiling version of a
module in another package, then suggest that perhaps it might not have
been installed.

17 years agoOn FreeBSD, use -lthr instead of -pthread for now (see comments)
Simon Marlow [Fri, 11 Aug 2006 11:34:53 +0000 (11:34 +0000)]
On FreeBSD, use -lthr instead of -pthread for now (see comments)

17 years agoTwo more error message indendations
simonpj@microsoft.com [Fri, 11 Aug 2006 11:04:35 +0000 (11:04 +0000)]
Two more error message indendations

17 years agoGo back to calling type veriables t
simonpj@microsoft.com [Fri, 11 Aug 2006 11:04:12 +0000 (11:04 +0000)]
Go back to calling type veriables t

17 years agoIndent an error message
simonpj@microsoft.com [Fri, 11 Aug 2006 11:03:47 +0000 (11:03 +0000)]
Indent an error message

17 years agoImprove error message (imported from Prelude at Implicit import declaration)
simonpj@microsoft.com [Fri, 11 Aug 2006 11:03:01 +0000 (11:03 +0000)]
Improve error message (imported from Prelude at Implicit import declaration)

17 years agodon't qualify module name for importedSrcLoc
Simon Marlow [Fri, 11 Aug 2006 10:13:27 +0000 (10:13 +0000)]
don't qualify module name for importedSrcLoc

17 years agouse "Defined in" rather than "Imported from" when printing ImportedSrcLoc
Simon Marlow [Fri, 11 Aug 2006 10:11:59 +0000 (10:11 +0000)]
use "Defined in" rather than "Imported from" when printing ImportedSrcLoc

17 years agoNow that we have an "html" package, put the Haddock docs somewhere else
sven.panne@aedion.de [Fri, 11 Aug 2006 09:26:09 +0000 (09:26 +0000)]
Now that we have an "html" package, put the Haddock docs somewhere else

17 years agoNuked hschooks.h in favour of cutils.h, which has the prototypes we need
sven.panne@aedion.de [Thu, 10 Aug 2006 15:42:25 +0000 (15:42 +0000)]
Nuked hschooks.h in favour of cutils.h, which has the prototypes we need

17 years agoMatch format strings and arguments for printf-like functions
sven.panne@aedion.de [Thu, 10 Aug 2006 15:36:24 +0000 (15:36 +0000)]
Match format strings and arguments for printf-like functions

17 years agoWarning police: Make prototype for LDV_recordDead_FILL_SLOP_DYNAMIC visible
sven.panne@aedion.de [Thu, 10 Aug 2006 14:48:37 +0000 (14:48 +0000)]
Warning police: Make prototype for LDV_recordDead_FILL_SLOP_DYNAMIC visible

17 years agoWarning police: Make strlen and friends known
sven.panne@aedion.de [Thu, 10 Aug 2006 14:47:29 +0000 (14:47 +0000)]
Warning police: Make strlen and friends known

17 years agoTweak GCC's inlining parameters to get thread_obj inlined
sven.panne@aedion.de [Thu, 10 Aug 2006 14:45:05 +0000 (14:45 +0000)]
Tweak GCC's inlining parameters to get thread_obj inlined

17 years agoAdd an IAmDead case to postInlineUnconditionally, and comments
simonpj@microsoft.com [Thu, 10 Aug 2006 14:20:34 +0000 (14:20 +0000)]
Add an IAmDead case to postInlineUnconditionally, and comments

17 years agoDo not repeatedly simplify an argument more than once
simonpj@microsoft.com [Thu, 10 Aug 2006 14:15:26 +0000 (14:15 +0000)]
Do not repeatedly simplify an argument more than once

A very important invariant of the simplifier is that we do not simplify
an arbitrarily large expression more than once in a single pass. If this
can happen, then we can get exponential behaviour, when the large expression
itself has a large sub-expression which is simplified twice, and so on.

GHC has a long-standing bug which allows this repeated simplification to
happen.  It shows up when we have a function like this

f d BIG
where f's unfolding looks like
\x -> case x of (a,b) -> a
Of course this is v common for overloaded functions.

Before this patch we simplified all the args (d and BIG) before
deciding to unfold f.  Then we push back the simplified BIG onto the
continuation stack, inline f, so now we have
(case d of (a,b) -> a) BIG
After we reduce the case a bit, we'll simplify BIG a second time.  And
that's the problem.

The quick-and-dirty solution is to keep a flag in the ApplyTo continuation
to say whather the arg has already been simplified.  An alternative would
be to simplify it when first encountered, but that's a bigger change.

17 years agoDo not call preInlineUnconditionally in simplNonRecX
simonpj@microsoft.com [Thu, 10 Aug 2006 14:13:40 +0000 (14:13 +0000)]
Do not call preInlineUnconditionally in simplNonRecX

This looks to me like a long-standing bug. simplNonRecX was calling
preInlineUnconditionally, even though it was given an already-simplified
expression.  Exponential behaviour beckons.

17 years agoMake postInlineUnconditaionally more conservative
simonpj@microsoft.com [Thu, 10 Aug 2006 14:11:45 +0000 (14:11 +0000)]
Make postInlineUnconditaionally more conservative

I'm being more paranoid about repeatedly simplifying things (to avoid
exponential behaviour.)  postInlineUnconditionally looks as if it
could repeated simplify the same expression; this patch stops it doing
so.

The extra lines are all comments!

17 years agoControl.Exception.unblock wasn't unblocking exceptions
Simon Marlow [Thu, 10 Aug 2006 13:23:07 +0000 (13:23 +0000)]
Control.Exception.unblock wasn't unblocking exceptions

17 years agoremove out of date comment
Simon Marlow [Thu, 10 Aug 2006 13:01:54 +0000 (13:01 +0000)]
remove out of date comment

17 years agomove html before network, for now
Simon Marlow [Thu, 10 Aug 2006 12:19:30 +0000 (12:19 +0000)]
move html before network, for now

17 years agoadd html package
Simon Marlow [Thu, 10 Aug 2006 11:37:19 +0000 (11:37 +0000)]
add html package

17 years agoEgregious bug in tcLHsConResTy
simonpj@microsoft.com [Thu, 10 Aug 2006 12:08:28 +0000 (12:08 +0000)]
Egregious bug in tcLHsConResTy

This terrible bug in tcLHsConTy is pretty much guaranteed to show up
on an program involving a GADT with more than one type parameter.

This bug isn't present in the STABLE branch.

Manuel: it is *not* necesary to merge this patch into the FC branch;
just ignore it.

17 years agoComments about improvements to SpecConstr
simonpj@microsoft.com [Thu, 10 Aug 2006 12:07:59 +0000 (12:07 +0000)]
Comments about improvements to SpecConstr

17 years agoRemove HasBounds-instance and implement MArray.getBounds instead
Esa Ilari Vuokko [Wed, 9 Aug 2006 16:30:12 +0000 (16:30 +0000)]
Remove HasBounds-instance and implement MArray.getBounds instead

17 years agoFix Array imports
Esa Ilari Vuokko [Wed, 9 Aug 2006 16:13:41 +0000 (16:13 +0000)]
Fix Array imports

17 years agoWhere we use $(GhcHcOpts), also add $(GhcStage1HcOpts)
Simon Marlow [Wed, 9 Aug 2006 14:48:45 +0000 (14:48 +0000)]
Where we use $(GhcHcOpts), also add $(GhcStage1HcOpts)
This fixes building the compiler with -prof in $(GhcStage1HcOpts)

17 years agofixes to the stage2 build following removal of old FFI syntax
Simon Marlow [Wed, 9 Aug 2006 14:31:53 +0000 (14:31 +0000)]
fixes to the stage2 build following removal of old FFI syntax

17 years agofix bug in task freeing
Simon Marlow [Wed, 9 Aug 2006 14:12:25 +0000 (14:12 +0000)]
fix bug in task freeing

17 years agoadd some more options to stage 2
Simon Marlow [Wed, 9 Aug 2006 14:10:58 +0000 (14:10 +0000)]
add some more options to stage 2

17 years agoremove debugging code accidentally left in
Simon Marlow [Wed, 9 Aug 2006 10:29:36 +0000 (10:29 +0000)]
remove debugging code accidentally left in

17 years agoremember that old FFI syntax has been dropped
Simon Marlow [Wed, 9 Aug 2006 10:16:55 +0000 (10:16 +0000)]
remember that old FFI syntax has been dropped

17 years agoonly define GHCI if $(GhcWithInterpreter)=YES, also add -threaded
Simon Marlow [Wed, 9 Aug 2006 10:16:34 +0000 (10:16 +0000)]
only define GHCI if $(GhcWithInterpreter)=YES, also add -threaded

17 years agomove altzone test to base package
Ross Paterson [Wed, 9 Aug 2006 12:42:15 +0000 (12:42 +0000)]
move altzone test to base package

17 years agoremove unused FPTOOLS_CHECK_HTYPE macro
Ross Paterson [Wed, 9 Aug 2006 12:40:36 +0000 (12:40 +0000)]
remove unused FPTOOLS_CHECK_HTYPE macro

17 years agoRemove the artifical cap on the number of workers
Simon Marlow [Wed, 9 Aug 2006 09:59:08 +0000 (09:59 +0000)]
Remove the artifical cap on the number of workers
See #805.  This was here to catch bugs that resulted in an infinite
number of worker threads being created.  However, we can't put a
reasonable bound on the number of worker threads, because legitimate
programs may need to create large numbers of (probably blocked) worker
threads.  Furthermore, the OS probably has a bound on the number of
threads that a process can create in any case.

17 years agoRemove old FFI syntax
Simon Marlow [Wed, 9 Aug 2006 09:52:01 +0000 (09:52 +0000)]
Remove old FFI syntax
See #815

17 years agomake exit() overridable, for use in DLLs
Simon Marlow [Wed, 9 Aug 2006 09:24:39 +0000 (09:24 +0000)]
make exit() overridable, for use in DLLs
See #753

17 years agoMore fixes to pre-matching and pre-subsumption
simonpj@microsoft.com [Tue, 8 Aug 2006 22:49:24 +0000 (22:49 +0000)]
More fixes to pre-matching and pre-subsumption

Actually this patch fixes two errors. one was a trivial typo in
tha last patch (b_ty should be b_tau), which led to an infinite loop
when compiling Data.Generic.Twins.

Fixing that revealed a more serious error in the same function.
I was sloppy about dealing robsutly with name-capture for nested
quantifiers in pre-subsumption and pre-matching; and sure enough
I got bitten.  Sigh.  I think it is right now.

17 years agoGroup exports so that all length functions are together; no semantic change
simonpj@microsoft.com [Tue, 8 Aug 2006 22:48:08 +0000 (22:48 +0000)]
Group exports so that all length functions are together; no semantic change

17 years agoCheck that lazy patterns are for lifted types
simonpj@microsoft.com [Tue, 8 Aug 2006 13:59:10 +0000 (13:59 +0000)]
Check that lazy patterns are for lifted types

A lazy pattern match must be for a lifted type. This is illegal:

f x = case g x of
                ~(# x,y #) -> ...

This commit fixes the problem.  Trac #845, test is tcfail159

17 years agoSpelling in a comment
simonpj@microsoft.com [Tue, 8 Aug 2006 12:35:14 +0000 (12:35 +0000)]
Spelling in a comment

17 years agoRemove srcSpanStartLine/srcSpanEndLine crash
simonpj@microsoft.com [Tue, 8 Aug 2006 12:32:11 +0000 (12:32 +0000)]
Remove srcSpanStartLine/srcSpanEndLine crash

srcSpanStartLine/srcSpanEndLine panic on UnhelpfulLoc. They should not
really be exported by SrcLoc at all, but unfortunately they are used in
Lexer.x, which knows enough to avoid the panic.

However the call in RnEnv didn't know, and the panic was triggered
by Template Haskell spliced code.  This patch fixes it by exporting
the predicate RnEnv wanted, namely isOneLineSpan.

17 years agoReplace deprecated AC_TRY_COMPILE macro with the reccomended replcament
Duncan Coutts [Thu, 6 Jul 2006 11:49:02 +0000 (11:49 +0000)]
Replace deprecated AC_TRY_COMPILE macro with the reccomended replcament
See: http://www.gnu.org/software/autoconf/manual/html_node/Obsolete-Macros.html

17 years agoAdd ghc and version number in .ident directive in NCG
Duncan Coutts [Thu, 6 Jul 2006 11:47:12 +0000 (11:47 +0000)]
Add ghc and version number in .ident directive in NCG
Just because we can and because every other compiler does,
lets stick in an identifier directive: .ident "GHC x.y.z"
into the assembly output of the NCG.

17 years agoSupport the GNU non-exec stack annotation system
Duncan Coutts [Thu, 6 Jul 2006 11:43:31 +0000 (11:43 +0000)]
Support the GNU non-exec stack annotation system
On recent GNU ELF systems one can mark an object file as not
requiring an executable stack. If all objects- linked into a
program have this note then the program will not use an executable
stack, which is good for security (and some distros have it as a
QA policy). GHC generated code does not need an executable stack
so add the note to the assembly output of the native code
generator (conditional on a configure test).

17 years agoComplain more loudly if any of the hsc2hs phases fail
Duncan Coutts [Mon, 3 Jul 2006 23:43:56 +0000 (23:43 +0000)]
Complain more loudly if any of the hsc2hs phases fail
previously hsc2hs just exits with a non-zero exit code, now if any of
the compilation, linking or runing phases fail then we get a message
saying so and the failing command is printed.

17 years agoRemember to free() memory on exit
Simon Marlow [Tue, 8 Aug 2006 10:31:10 +0000 (10:31 +0000)]
Remember to free() memory on exit
Patch mostly from Lennart Augustsson in #803, with additions to
Task.c by me.

17 years agoFix pre-subsumption and pre-matching
simonpj@microsoft.com [Tue, 8 Aug 2006 09:11:08 +0000 (09:11 +0000)]
Fix pre-subsumption and pre-matching

The pre-subsuption and pre-matching functions should NEVER make bogus
bindings of type variables, although they are free to bale out and make
too few bindings.

I hadn't been thiking carefully enough about this, and there were two
separate bugs.

- Firstly, in pre-subsumption we must ignore the 'theta'
  part of any overloaded type.

- Second, in pre-matching, we must return the empty subustition
  on a mis-match, rather than returning the substitution so far.

This bug showed up when compiling Data.Generics.Schemes.hs, and is
imortalised in test tc206

17 years agoImprove error message
simonpj@microsoft.com [Tue, 8 Aug 2006 08:02:55 +0000 (08:02 +0000)]
Improve error message

Improve a little-used error message.  Given
f :: a -> a
f x y = e
the error says

The equations for f have two arguments
but its type `a -> a' has only one

(Before, it said "its type `a' has only one" which is bogus.

17 years agoPull out common removal code, and detect does-not-exist correctly
Ian Lynagh [Mon, 10 Jul 2006 21:43:08 +0000 (21:43 +0000)]
Pull out common removal code, and detect does-not-exist correctly

17 years agoCreate our own directory in the temporary directory to avoid various races
Ian Lynagh [Mon, 10 Jul 2006 20:44:24 +0000 (20:44 +0000)]
Create our own directory in the temporary directory to avoid various races

17 years agoMerge SysTools import declarations
Ian Lynagh [Sun, 9 Jul 2006 18:38:50 +0000 (18:38 +0000)]
Merge SysTools import declarations

17 years agoDon't freeze the dynamic flags used for filename generation before the pipeline starts
Ian Lynagh [Sun, 9 Jul 2006 14:51:01 +0000 (14:51 +0000)]
Don't freeze the dynamic flags used for filename generation before the pipeline starts

17 years ago#807: Removed double fclose of prof_file
Ian Lynagh [Sat, 8 Jul 2006 15:24:24 +0000 (15:24 +0000)]
#807: Removed double fclose of prof_file
prof_file was being fclose'd in both gen_XML_logfile and hs_exit, leading
to glibc complaining of a double free.

17 years agoAdd -fextended-default-rules and -fmono-pat-binds
simonpj@microsoft.com [Mon, 7 Aug 2006 11:21:07 +0000 (11:21 +0000)]
Add -fextended-default-rules and -fmono-pat-binds

Add -fextended-deafult-rules (in response to Don Stewart's message below),
and document them.

Also doucument -fmono-pat-binds/-fno-mono-pat-binds, which has been in
GHC a few weeks now.

(The two are in one patch because the diffs were so close together
that Darcs combined them.)

Simon

From: Donald Bruce Stewart [mailto:dons@cse.unsw.edu.au]
Sent: 07 August 2006 10:52

While we're thinking about defaulting, I have a question..

ghci uses an extended defaulting system, to allow things like:
        Prelude> reverse []
        []
to work, and to have the right instance of Show found. The manual says:

    "..it is tiresome for the user to have to specify the type, so GHCi extends
    Haskell's type-defaulting rules (Section 4.3.4 of the Haskell 98 Report
    (Revised)) as follows. If the expression yields a set of type constraints
    that are all from standard classes (Num, Eq etc.), and at least one is
    either a numeric class or the Show, Eq, or Ord class, GHCi will try to use
    one of the default types, just as described in the Report. The standard
    defaulting rules require that one of the classes is numeric; the difference
    here is that defaulting is also triggered at least one is Show, Eq, or Ord."

Currently, there is no way to get at this "extended" defaulting for compiled
modules. However, I have a use case for in fact doing this.

With runtime evaluated Haskell, embedding 'interpreters' (over hs-plugins) is
easy. lambdabot, for example, implements a sandboxed haskell eval system. But
it doesn't have access to the defaulting mechanism of ghci, so we have:

    dons:: > reverse []
    lambdabot:: Add a type signature
    dons:: > reverse [] :: [()]
    lambdabot:: []

Which is annoying -- newbies wonder why they have to add these extra
constraints to get a Show instance.

I'm wondering, since the extended defaulting mechanisms are already
implemented, could they be made available to compiled modules as well,
perhaps using a flag, -fextended-defaulting?

17 years agoadd a comment
Simon Marlow [Mon, 7 Aug 2006 14:31:02 +0000 (14:31 +0000)]
add a comment

17 years agoDo pre-subsumption in the main subsumption check
simonpj@microsoft.com [Fri, 4 Aug 2006 21:49:42 +0000 (21:49 +0000)]
Do pre-subsumption in the main subsumption check

This patch improves the subsumption check (in TcUnify.tc_sub) so that
it does pre-subsumption first.  The key code is in the case with
guard (isSigmaTy actual_ty); note the new call to preSubType.

Shorn of details, the question is this.  Should this hold?

forall a. a->a   <=   Int -> (forall b. Int)

Really, it should; just instantiate 'a' to Int.  This is just what
the pre-subsumption phase (which used in function applications),
will do.

I did a bit of refactoring to achieve this.

Fixes Trac #821.  Test tc205 tests.

17 years agoMake unification robust to a boxy type variable meeting itself
simonpj@microsoft.com [Tue, 1 Aug 2006 21:43:02 +0000 (21:43 +0000)]
Make unification robust to a boxy type variable meeting itself

Previously, the implicit assumption in unification is that a boxy
type variable could never occur on both sides of the unification,
so that we'd never find
bx5 :=: bx5

But the pre-subsumption stuff really means that the same variable
can occur on both sides.  Consider
forall a. a->Int <= bx5->Int
Then pre-subumption will find a->bx5; and the full subsumption step
will find bx5:=bx5.

However, I think there is still no possiblity of a full occurs-check
failure; that is,
bx5 :=: Tree bx5
Although I can't quite see how to prove it!  So I've added a
DEBUG test in uMetaVar to check for this case.

17 years agoAdded cabal-setup
sven.panne@aedion.de [Fri, 4 Aug 2006 14:21:49 +0000 (14:21 +0000)]
Added cabal-setup

17 years agoDon't include the package name in a cost centre's module name
Simon Marlow [Thu, 3 Aug 2006 09:33:37 +0000 (09:33 +0000)]
Don't include the package name in a cost centre's module name
This is mainly to restore the old behaviour, but also we shouldn't
normally need the package name in a cost centre because only the
"main" package normally has cost centres.

17 years agoAdd a new section "Getting the Source" to both HACKING and README. But what about...
shae@ScannedInAvian.com [Thu, 20 Jul 2006 15:29:29 +0000 (15:29 +0000)]
Add a new section "Getting the Source" to both HACKING and README. But what about win32 users?

17 years agosavingOldConfig: add Exception.block for extra paranoia
Simon Marlow [Tue, 1 Aug 2006 13:10:27 +0000 (13:10 +0000)]
savingOldConfig: add Exception.block for extra paranoia

17 years agoRefactor ghc-pkg
Ian Lynagh [Sat, 29 Jul 2006 19:29:46 +0000 (19:29 +0000)]
Refactor ghc-pkg
This patch fixes a couple of issues with the
    Be lazier in user config creation, and don't fail on missing configs.
patch. It puts the createDirectoryIfMissing back in and removes assumptions
that the package.conf file already exists.

17 years agoNo functionality changes
Ian Lynagh [Sun, 30 Jul 2006 10:52:56 +0000 (10:52 +0000)]
No functionality changes
Consistently used spaces rather than tabs.
Removed trailing whitespace.
Wrapped comments to fit in a standard terminal.